diff --git a/core/src/utils/xhr-request.js b/core/src/utils/xhr-request.js
index 0432fc9fd3f67..66f994246e0bc 100644
--- a/core/src/utils/xhr-request.js
+++ b/core/src/utils/xhr-request.js
@@ -21,6 +21,10 @@
import { getRootUrl } from '@nextcloud/router'
+/**
+ * @param {string} url The URL to check
+ * @return {boolean} true if the URL points to this nextcloud instance
+ */
const isNextcloudUrl = (url) => {
const nextcloudBaseUrl = window.location.protocol + '//' + window.location.host + getRootUrl()
// try with relative and absolute URL
@@ -43,24 +47,25 @@ export const interceptRequests = () => {
})(XMLHttpRequest.prototype.open)
window.fetch = (function(fetch) {
- return (input, init) => {
- if (!isNextcloudUrl(input.url)) {
- return fetch(input, init)
+ return (resource, options) => {
+ // fetch allows the `input` to be either a Request object or any stringifyable value
+ if (!isNextcloudUrl(resource.url ?? resource.toString())) {
+ return fetch(resource, options)
}
- if (!init) {
- init = {}
+ if (!options) {
+ options = {}
}
- if (!init.headers) {
- init.headers = new Headers()
+ if (!options.headers) {
+ options.headers = new Headers()
}
- if (init.headers instanceof Headers && !init.headers.has('X-Requested-With')) {
- init.headers.append('X-Requested-With', 'XMLHttpRequest')
- } else if (init.headers instanceof Object && !init.headers['X-Requested-With']) {
- init.headers['X-Requested-With'] = 'XMLHttpRequest'
+ if (options.headers instanceof Headers && !options.headers.has('X-Requested-With')) {
+ options.headers.append('X-Requested-With', 'XMLHttpRequest')
+ } else if (options.headers instanceof Object && !options.headers['X-Requested-With']) {
+ options.headers['X-Requested-With'] = 'XMLHttpRequest'
}
- return fetch(input, init)
+ return fetch(resource, options)
}
})(window.fetch)
}
diff --git a/dist/core-main.js b/dist/core-main.js
index b82763580f82e..7e1ef2f210dba 100644
--- a/dist/core-main.js
+++ b/dist/core-main.js
@@ -1,3 +1,3 @@
/*! For license information please see core-main.js.LICENSE.txt */
-!function(){var e,i,o,r={35788:function(e,i,o){"use strict";var r={};o.r(r),o.d(r,{deleteKey:function(){return k},getApps:function(){return C},getKeys:function(){return x},getValue:function(){return y},setValue:function(){return w}});var s={};o.r(s),o.d(s,{formatLinksPlain:function(){return Tn},formatLinksRich:function(){return Sn},plainToRich:function(){return Dn},richToPlain:function(){return In}});var a={};o.r(a),o.d(a,{dismiss:function(){return On},query:function(){return Pn}}),o(28594),o(35666);var c=o(69183),u=o(59050),l=o(19755),h=o.n(l),d=o(64024),p=o(25108),A={updatableNotification:null,getDefaultNotificationFunction:null,setDefault:function(t){this.getDefaultNotificationFunction=t},hide:function(t,e){u.default.isFunction(t)&&(e=t,t=void 0),t?(t.each((function(){h()(this)[0].toastify?h()(this)[0].toastify.hideToast():p.error("cannot hide toast because object is not set"),this===this.updatableNotification&&(this.updatableNotification=null)})),e&&e.call(),this.getDefaultNotificationFunction&&this.getDefaultNotificationFunction()):p.error("Missing argument $row in OC.Notification.hide() call, caller needs to be adjusted to only dismiss its own notification")},showHtml:function(t,e){(e=e||{}).isHTML=!0,e.timeout=e.timeout?e.timeout:d.Rl;var n=(0,d.PV)(t,e);return n.toastElement.toastify=n,h()(n.toastElement)},show:function(t,e){(e=e||{}).timeout=e.timeout?e.timeout:d.Rl;var n=(0,d.PV)(function(t){return t.toString().split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}(t),e);return n.toastElement.toastify=n,h()(n.toastElement)},showUpdate:function(t){return this.updatableNotification&&this.updatableNotification.hideToast(),this.updatableNotification=(0,d.PV)(t,{timeout:d.Rl}),this.updatableNotification.toastElement.toastify=this.updatableNotification,h()(this.updatableNotification.toastElement)},showTemporary:function(t,e){(e=e||{}).timeout=e.timeout||d.TN;var n=(0,d.PV)(t,e);return n.toastElement.toastify=n,h()(n.toastElement)},isHidden:function(){return!h()("#content").find(".toastify").length}},f=u.default.throttle((function(){A.showTemporary(t("core","Connection to server lost"))}),7e3,{trailing:!1}),g=!1,m={enableDynamicSlideToggle:function(){g=!0},showAppSidebar:function(t){(t||h()("#app-sidebar")).removeClass("disappear").show(),h()("#app-content").trigger(new(h().Event)("appresized"))},hideAppSidebar:function(t){(t||h()("#app-sidebar")).hide().addClass("disappear"),h()("#app-content").trigger(new(h().Event)("appresized"))}},v=o(79753);function b(t,e,n){"post"!==t&&"delete"!==t||!Dt.PasswordConfirmation.requiresPasswordConfirmation()?(n=n||{},h().ajax({type:t.toUpperCase(),url:(0,v.generateOcsUrl)("apps/provisioning_api/api/v1/config/apps")+e,data:n.data||{},success:n.success,error:n.error})):Dt.PasswordConfirmation.requirePasswordConfirmation(_.bind(b,this,t,e,n))}function C(t){b("get","",t)}function x(t,e){b("get","/"+t,e)}function y(t,e,n,i){(i=i||{}).data={defaultValue:n},b("get","/"+t+"/"+e,i)}function w(t,e,n,i){(i=i||{}).data={value:n},b("post","/"+t+"/"+e,i)}function k(t,e,n){b("delete","/"+t+"/"+e,n)}var B=window.oc_appconfig||{},E={getValue:function(t,e,n,i){y(t,e,n,{success:i})},setValue:function(t,e,n){w(t,e,n)},getApps:function(t){C({success:t})},getKeys:function(t,e){x(t,{success:e})},deleteKey:function(t,e){k(t,e)}},D=void 0!==window._oc_appswebroots&&window._oc_appswebroots,I=o(72316),S=o.n(I),T=o(76591),M=o(25108),P={create:"POST",update:"PROPPATCH",patch:"PROPPATCH",delete:"DELETE",read:"PROPFIND"};function O(t,e){if(u.default.isArray(t))return u.default.map(t,(function(t){return O(t,e)}));var n={href:t.href};return u.default.each(t.propStat,(function(t){if("HTTP/1.1 200 OK"===t.status)for(var i in t.properties){var o=i;i in e&&(o=e[i]),n[o]=t.properties[i]}})),n.id||(n.id=z(n.href)),n}function z(t){var e=t.indexOf("?");e>0&&(t=t.substr(0,e));var n,i=t.split("/");do{n=i[i.length-1],i.pop()}while(!n&&i.length>0);return n}function R(t){return t>=200&&t<=299}function N(t,e,n,i){return t.propPatch(e.url,function(t,e){var n,i={};for(n in t){var o=e[n],r=t[n];o||(M.warn('No matching DAV property for property "'+n),o=n),(u.default.isBoolean(r)||u.default.isNumber(r))&&(r=""+r),i[o]=r}return i}(n.changed,e.davProperties),i).then((function(t){R(t.status)?u.default.isFunction(e.success)&&e.success(n.toJSON()):u.default.isFunction(e.error)&&e.error(t)}))}var H=S().noConflict();Object.assign(H,{davCall:function(t,e){var n=new T.dav.Client({baseUrl:t.url,xmlNamespaces:u.default.extend({"DAV:":"d","http://owncloud.org/ns":"oc"},t.xmlNamespaces||{})});n.resolveUrl=function(){return t.url};var i=u.default.extend({"X-Requested-With":"XMLHttpRequest",requesttoken:OC.requestToken},t.headers);return"PROPFIND"===t.type?function(t,e,n,i){return t.propFind(e.url,u.default.values(e.davProperties)||[],e.depth,i).then((function(t){if(R(t.status)){if(u.default.isFunction(e.success)){var n=u.default.invert(e.davProperties),i=O(t.body,n);e.depth>0&&i.shift(),e.success(i)}}else u.default.isFunction(e.error)&&e.error(t)}))}(n,t,0,i):"PROPPATCH"===t.type?N(n,t,e,i):"MKCOL"===t.type?function(t,e,n,i){return t.request(e.type,e.url,i,null).then((function(o){R(o.status)?N(t,e,n,i):u.default.isFunction(e.error)&&e.error(o)}))}(n,t,e,i):function(t,e,n,i){return i["Content-Type"]="application/json",t.request(e.type,e.url,i,e.data).then((function(t){if(R(t.status)){if(u.default.isFunction(e.success)){if("PUT"===e.type||"POST"===e.type||"MKCOL"===e.type){var i=t.body||n.toJSON(),o=t.xhr.getResponseHeader("Content-Location");return"POST"===e.type&&o&&(i.id=z(o)),void e.success(i)}if(207===t.status){var r=u.default.invert(e.davProperties);e.success(O(t.body,r))}else e.success(t.body)}}else u.default.isFunction(e.error)&&e.error(t)}))}(n,t,e,i)},davSync:function(t){return function(e,n,i){var o={type:P[e]||e},r=n instanceof t.Collection;if("update"===e&&(n.hasInnerCollection?o.type="MKCOL":(n.usePUT||n.collection&&n.collection.usePUT)&&(o.type="PUT")),i.url||(o.url=u.default.result(n,"url")||function(){throw new Error('A "url" property or function must be specified')}()),null!=i.data||!n||"create"!==e&&"update"!==e&&"patch"!==e||(o.data=JSON.stringify(i.attrs||n.toJSON(i))),"PROPFIND"!==o.type&&(o.processData=!1),"PROPFIND"===o.type||"PROPPATCH"===o.type){var s=n.davProperties;!s&&n.model&&(s=n.model.prototype.davProperties),s&&(u.default.isFunction(s)?o.davProperties=s.call(n):o.davProperties=s),o.davProperties=u.default.extend(o.davProperties||{},i.davProperties),u.default.isUndefined(i.depth)&&(i.depth=r?1:0)}var a=i.error;i.error=function(t,e,n){i.textStatus=e,i.errorThrown=n,a&&a.call(i.context,t,e,n)};var c=i.xhr=t.davCall(u.default.extend(o,i),n);return n.trigger("request",n,c,i),c}}(H)});var j=H,L=o(65358),U=window._oc_config||{},F=document.getElementsByTagName("head")[0].getAttribute("data-user"),W=document.getElementsByTagName("head")[0].getAttribute("data-user-displayname"),Y=void 0!==F&&F,Q=o(96384),q=o(62520);function G(t){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(t)}var X={YES_NO_BUTTONS:70,OK_BUTTONS:71,FILEPICKER_TYPE_CHOOSE:1,FILEPICKER_TYPE_MOVE:2,FILEPICKER_TYPE_COPY:3,FILEPICKER_TYPE_COPY_MOVE:4,FILEPICKER_TYPE_CUSTOM:5,dialogsCounter:0,alert:function(t,e,n,i){this.message(t,e,"alert",X.OK_BUTTON,n,i)},info:function(t,e,n,i){this.message(t,e,"info",X.OK_BUTTON,n,i)},confirm:function(t,e,n,i){return this.message(t,e,"notice",X.YES_NO_BUTTONS,n,i)},confirmDestructive:function(t,e,n,i,o){return this.message(t,e,"none",n,i,void 0===o||o)},confirmHtml:function(t,e,n,i){return this.message(t,e,"notice",X.YES_NO_BUTTONS,n,i,!0)},prompt:function(e,n,i,o,r,s){return h().when(this._getMessageTemplate()).then((function(a){var c="oc-dialog-"+X.dialogsCounter+"-content",l="#"+c,d=a.octemplate({dialog_name:c,title:n,message:e,type:"notice"}),p=h()("");p.attr("type",s?"password":"text").attr("id",c+"-input").attr("placeholder",r);var A=h()("").attr("for",c+"-input").text(r+": ");d.append(A),d.append(p),void 0===o&&(o=!1),h()("body").append(d),void 0!==i&&(i=u.default.once(i));var f=[{text:t("core","No"),click:function(){void 0!==i&&i(!1,p.val()),h()(l).ocdialog("close")}},{text:t("core","Yes"),click:function(){void 0!==i&&i(!0,p.val()),h()(l).ocdialog("close")},defaultButton:!0}];h()(l).ocdialog({closeOnEscape:!0,modal:o,buttons:f,close:function(){void 0!==i&&i(!1,p.val())}}),p.focus(),X.dialogsCounter++}))},filepicker:function(e,n){var i=this,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:d.K9.Choose,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:void 0,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:void 0,u=function(t,e){var n=function(t){var e=(null==t?void 0:t.root)||"",n=(null==t?void 0:t.path)||"";return n.startsWith(e)&&(n=n.slice(e.length)||"/"),n};return o?function(i){return t(i.map(n),e)}:function(i){return t(n(i[0]),e)}},l=(0,d.fn)(e);s===this.FILEPICKER_TYPE_CUSTOM?(c.buttons||[]).forEach((function(t){l.addButton({callback:u(n,t.type),label:t.text,type:t.defaultButton?"primary":"secondary"})})):l.setButtonFactory((function(e,o){var r,a,c=[],l=(null==e||null===(r=e[0])||void 0===r||null===(r=r.attributes)||void 0===r?void 0:r.displayName)||(null==e||null===(a=e[0])||void 0===a?void 0:a.basename),h=l||(0,q.basename)(o);return s===d.K9.Choose&&c.push({callback:u(n,d.K9.Choose),label:l&&!i.multiSelect?t("core","Choose {file}",{file:l}):t("core","Choose"),type:"primary"}),s!==d.K9.CopyMove&&s!==d.K9.Copy||c.push({callback:u(n,d.K9.Copy),label:h?t("core","Copy to {target}",{target:h}):t("core","Copy"),type:"primary",icon:''}),s!==d.K9.Move&&s!==d.K9.CopyMove||c.push({callback:u(n,d.K9.Move),label:h?t("core","Move to {target}",{target:h}):t("core","Move"),type:s===d.K9.Move?"primary":"secondary",icon:Q}),c})),r&&l.setMimeTypeFilter("string"==typeof r?[r]:r||[]),"function"==typeof(null==c?void 0:c.filter)&&l.setFilter((function(t){return c.filter(function(t){var e,n,i,o,r,s;return{id:t.fileid||null,path:t.path,mimetype:t.mime||null,mtime:(null===(e=t.mtime)||void 0===e?void 0:e.getTime())||null,permissions:t.permissions,name:(null===(n=t.attributes)||void 0===n?void 0:n.displayName)||t.basename,etag:(null===(i=t.attributes)||void 0===i?void 0:i.etag)||null,hasPreview:(null===(o=t.attributes)||void 0===o?void 0:o.hasPreview)||null,mountType:(null===(r=t.attributes)||void 0===r?void 0:r.mountType)||null,quotaAvailableBytes:(null===(s=t.attributes)||void 0===s?void 0:s.quotaAvailableBytes)||null,icon:null,sharePermissions:null}}(t))})),l.allowDirectories(!0===(null==c?void 0:c.allowDirectoryChooser)||(null==r?void 0:r.includes("httpd/unix-directory"))||!1).setMultiSelect(o).startAt(a).build().pick()},message:function(e,n,i,o,r,s,a){return h().when(this._getMessageTemplate()).then((function(c){var u="oc-dialog-"+X.dialogsCounter+"-content",l="#"+u,d=c.octemplate({dialog_name:u,title:n,message:e,type:i},a?{escapeFunction:""}:{});void 0===s&&(s=!1),h()("body").append(d);var p=[];switch(o){case X.YES_NO_BUTTONS:p=[{text:t("core","No"),click:function(){void 0!==r&&r(!1),h()(l).ocdialog("close")}},{text:t("core","Yes"),click:function(){void 0!==r&&r(!0),h()(l).ocdialog("close")},defaultButton:!0}];break;case X.OK_BUTTON:p[0]={text:t("core","OK"),click:function(){h()(l).ocdialog("close"),void 0!==r&&r()},defaultButton:!0};break;default:"object"===G(o)&&o.type===X.YES_NO_BUTTONS&&(p=[{text:o.cancel||t("core","No"),click:function(){void 0!==r&&r(!1),h()(l).ocdialog("close")}},{text:o.confirm||t("core","Yes"),click:function(){void 0!==r&&r(!0),h()(l).ocdialog("close")},defaultButton:!0,classes:o.confirmClasses}])}h()(l).ocdialog({closeOnEscape:!0,closeCallback:function(){r&&r(!1)},modal:s,buttons:p}),X.dialogsCounter++})).fail((function(i,o){0===i?alert(n+": "+e):alert(t("core","Error loading message template: {error}",{error:o}))}))},_fileexistsshown:!1,fileexists:function(e,i,o,r){var s=this,a=new(h().Deferred),c=function(t,e,n,i,o){i=Math.round(i),o=Math.round(o);for(var r=t.getContext("2d").getImageData(0,0,e,n),s=t.getContext("2d").getImageData(0,0,i,o),a=r.data,c=s.data,u=e/i,l=n/o,h=Math.ceil(u/2),d=Math.ceil(l/2),p=0;p=-1&&S<=1&&(g=2*S*S*S-3*S*S+1)>0&&(y+=g*a[3+(I=4*(D+k*e))],v+=g,a[I+3]<255&&(g=g*a[I+3]/250),b+=g*a[I],C+=g*a[I+1],x+=g*a[I+2],m+=g)}c[f]=b/m,c[f+1]=C/m,c[f+2]=x/m,c[f+3]=y/v}t.getContext("2d").clearRect(0,0,Math.max(e,i),Math.max(n,o)),t.width=i,t.height=o,t.getContext("2d").putImageData(s,0,0)},u=function(n,i,o){var r=n.find(".template").clone().removeClass("template").addClass("conflict"),s=r.find(".original"),a=r.find(".replacement");r.data("data",e),r.find(".filename").text(i.name),s.find(".size").text(Dt.Util.humanFileSize(i.size)),s.find(".mtime").text(Dt.Util.formatDate(i.mtime)),o.size&&o.lastModified&&(a.find(".size").text(Dt.Util.humanFileSize(o.size)),a.find(".mtime").text(Dt.Util.formatDate(o.lastModified)));var u=i.directory+"/"+i.name,l={file:u,x:96,y:96,c:i.etag,forceIcon:0},d=Files.generatePreviewUrl(l);d=d.replace(/'/g,"%27"),s.find(".icon").css({"background-image":"url('"+d+"')"}),function(t){var e=new(h().Deferred),n=t.type&&t.type.split("/").shift();if(window.FileReader&&"image"===n){var i=new FileReader;i.onload=function(t){var n=new Blob([t.target.result]);window.URL=window.URL||window.webkitURL;var i=window.URL.createObjectURL(n),o=new Image;o.src=i,o.onload=function(){var t,n,i,r,s,a,u,l=(t=o,s=document.createElement("canvas"),a=t.width,u=t.height,a>u?(i=0,n=(a-u)/2):(i=(u-a)/2,n=0),r=Math.min(a,u),s.width=r,s.height=r,s.getContext("2d").drawImage(t,n,i,r,r,0,0,r,r),c(s,r,r,96,96),s.toDataURL("image/png",.7));e.resolve(l)}},i.readAsArrayBuffer(t)}else e.reject();return e}(o).then((function(t){a.find(".icon").css("background-image","url("+t+")")}),(function(){u=Dt.MimeType.getIconUrl(o.type),a.find(".icon").css("background-image","url("+u+")")}));var p=n.find(".conflict").length;s.find("input:checkbox").attr("id","checkbox_original_"+p),a.find("input:checkbox").attr("id","checkbox_replacement_"+p),n.append(r),o.lastModified>i.mtime?a.find(".mtime").css("font-weight","bold"):o.lastModifiedi.size?a.find(".size").css("font-weight","bold"):o.size&&o.size0?(h()(d).find(".allnewfiles").prop("checked",!1),h()(d).find(".allnewfiles + .count").text(t("core","({count} selected)",{count:e}))):(h()(d).find(".allnewfiles").prop("checked",!1),h()(d).find(".allnewfiles + .count").text("")),m()})),h()(d).on("click",".original,.allexistingfiles",(function(){var e=h()(d).find('.conflict .original input[type="checkbox"]:checked').length;e===h()(d+" .conflict").length?(h()(d).find(".allexistingfiles").prop("checked",!0),h()(d).find(".allexistingfiles + .count").text(t("core","(all selected)"))):e>0?(h()(d).find(".allexistingfiles").prop("checked",!1),h()(d).find(".allexistingfiles + .count").text(t("core","({count} selected)",{count:e}))):(h()(d).find(".allexistingfiles").prop("checked",!1),h()(d).find(".allexistingfiles + .count").text("")),m()})),a.resolve()})).fail((function(){a.reject(),alert(t("core","Error loading file exists template"))}));return a.promise()},_getMessageTemplate:function(){var t=h().Deferred();if(this.$messageTemplate)t.resolve(this.$messageTemplate);else{var e=this;h().get(Dt.filePath("core","templates","message.html"),(function(n){e.$messageTemplate=h()(n),t.resolve(e.$messageTemplate)})).fail((function(e,n,i){t.reject(e.status,i)}))}return t.promise()},_getFileExistsTemplate:function(){var t=h().Deferred();if(this.$fileexistsTemplate)t.resolve(this.$fileexistsTemplate);else{var e=this;h().get(Dt.filePath("files","templates","fileexists.html"),(function(n){e.$fileexistsTemplate=h()(n),t.resolve(e.$fileexistsTemplate)})).fail((function(){t.reject()}))}return t.promise()}},V=X,K=function(t,e){var n=t.getElementsByTagName("head")[0].getAttribute("data-requesttoken");return{getToken:function(){return n},setToken:function(t){e("csrf-token-update",{token:n=t})}}}(document,c.j8),Z=K.getToken,J=K.setToken,$=function t(e,n){var i,o,r="";if(this.typelessListeners=[],this.closed=!1,this.listeners={},n)for(i in n)r+=i+"="+encodeURIComponent(n[i])+"&";if(r+="requesttoken="+encodeURIComponent(Z()),this.useFallBack||"undefined"==typeof EventSource){var s="oc_eventsource_iframe_"+t.iframeCount;t.fallBackSources[t.iframeCount]=this,this.iframe=h()(""),this.iframe.attr("id",s),this.iframe.hide(),o="&",-1===e.indexOf("?")&&(o="?"),this.iframe.attr("src",e+o+"fallback=true&fallback_id="+t.iframeCount+"&"+r),h()("body").append(this.iframe),this.useFallBack=!0,t.iframeCount++}else o="&",-1===e.indexOf("?")&&(o="?"),this.source=new EventSource(e+o+r),this.source.onmessage=function(t){for(var e=0;e-1&&parseInt(navigator.userAgent.split("/").pop())<51)for(var o,r=document.querySelectorAll('[fill^="url(#"], [stroke^="url(#"], [filter^="url(#invert"]'),s=0,a=r.length;s=0?t.substr(e+1):t.length?t.substr(1):""},_decodeQuery:function(t){return t.replace(/\+/g," ")},parseUrlQuery:function(){var t,e=this._parseHashQuery();return e&&(t=Dt.parseQueryString(this._decodeQuery(e))),(t=u.default.extend(t||{},Dt.parseQueryString(this._decodeQuery(location.search))))||{}},_onPopState:function(t){var e;if(this._cancelPop)this._cancelPop=!1;else if(this._handlers.length){e=t&&t.state,u.default.isString(e)?e=Dt.parseQueryString(e):e||(e=this.parseUrlQuery()||{});for(var n=0;n="0"&&e<="9";s!==r&&(n[++o]="",r=s),n[o]+=e,i++}return n}var xt={History:mt,humanFileSize:vt.sS,computerFileSize:function(t){if("string"!=typeof t)return null;var e=t.toLowerCase().trim(),n=null,i=e.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i);return null===i?null:(n=parseFloat(e),isFinite(n)?(i[5]&&(n*={b:1,k:1024,kb:1024,mb:1048576,m:1048576,gb:1073741824,g:1073741824,tb:1099511627776,t:1099511627776,pb:0x4000000000000,p:0x4000000000000}[i[5]]),n=Math.round(n)):null)},formatDate:function(t,e){return void 0===window.TESTING&&Dt.debug&&bt.warn("OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment"),e=e||"LLL",gt()(t).format(e)},relativeModifiedDate:function(e){void 0===window.TESTING&&Dt.debug&&bt.warn("OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment");var n=gt()().diff(gt()(e));return n>=0&&n<45e3?t("core","seconds ago"):gt()(e).fromNow()},getScrollBarWidth:function(){if(this._scrollBarWidth)return this._scrollBarWidth;var t=document.createElement("p");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);var n=t.offsetWidth;e.style.overflow="scroll";var i=t.offsetWidth;return n===i&&(i=e.clientWidth),document.body.removeChild(e),this._scrollBarWidth=n-i,this._scrollBarWidth},stripTime:function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())},naturalSortCompare:function(t,e){var n,i=Ct(t),o=Ct(e);for(n=0;i[n]&&o[n];n++)if(i[n]!==o[n]){var r=Number(i[n]),s=Number(o[n]);return r==i[n]&&s==o[n]?r-s:i[n].localeCompare(o[n],Dt.getLanguage())}return i.length-o.length},waitFor:function(t,e){!function n(){!0!==t()&&setTimeout(n,e)}()},isCookieSetToValue:function(t,e){for(var n=document.cookie.split(";"),i=0;i!$_",fileIsBlacklisted:function(t){return!!t.match(U.blacklist_files_regex)},Apps:m,AppConfig:E,appConfig:B,appswebroots:D,Backbone:j,config:U,currentUser:Y,dialogs:V,EventSource:tt,getCurrentUser:function(){return{uid:Y,displayName:W}},isUserAdmin:function(){return st},L10N:lt,_ajaxConnectionLostHandler:f,_processAjaxError:function(t){(0!==t.status||"abort"!==t.statusText&&"timeout"!==t.statusText&&!Dt._reloadCalled)&&(u.default.contains([302,303,307,401],t.status)&&Dt.currentUser?setTimeout((function(){if(!Dt._userIsNavigatingAway&&!Dt._reloadCalled){var t=0,e=setInterval((function(){A.showUpdate(n("core","Problem loading page, reloading in %n second","Problem loading page, reloading in %n seconds",5-t)),t>=5&&(clearInterval(e),Dt.reload()),t++}),1e3);Dt._reloadCalled=!0}}),100):0===t.status&&setTimeout((function(){Dt._userIsNavigatingAway||Dt._reloadCalled||Dt._ajaxConnectionLostHandler()}),100))},registerXHRForErrorProcessing:function(t){t.addEventListener&&(t.addEventListener("load",(function(){4===t.readyState&&(t.status>=200&&t.status<300||304===t.status||h()(document).trigger(new(h().Event)("ajaxError"),t))})),t.addEventListener("error",(function(){h()(document).trigger(new(h().Event)("ajaxError"),t)})))},getCapabilities:function(){return OC.debug&&nt.warn("OC.getCapabilities is deprecated and will be removed in Nextcloud 21. See @nextcloud/capabilities"),(0,et.getCapabilities)()},hideMenus:rt,registerMenu:function(t,e,n,i){e.addClass("menu");var o="A"===t.prop("tagName")||"BUTTON"===t.prop("tagName");t.on(o?"click.menu":"click.menu keyup.menu",(function(o){o.preventDefault(),o.key&&"Enter"!==o.key||(e.is(it)?rt():(it&&rt(),!0===i&&e.parent().addClass("openedMenu"),t.attr("aria-expanded",!0),e.slideToggle(50,n),it=e,ot=t))}))},showMenu:function(t,e,n){e.is(it)||(rt(),it=e,ot=t,e.trigger(new(h().Event)("beforeShow")),e.show(),e.trigger(new(h().Event)("afterShow")),u.default.isFunction(n)&&n())},unregisterMenu:function(t,e){e.is(it)&&rt(),t.off("click.menu").removeClass("menutoggle"),e.removeClass("menu")},basename:L.EZ,encodePath:L.Ec,dirname:L.XX,isSamePath:L.Mg,joinPaths:L.RQ,getHost:function(){return window.location.host},getHostName:function(){return window.location.hostname},getPort:function(){return window.location.port},getProtocol:function(){return window.location.protocol.split(":")[0]},getCanonicalLocale:ut.aj,getLocale:ut.Kd,getLanguage:ut.G3,buildQueryString:function(t){return t?h().map(t,(function(t,e){var n=encodeURIComponent(e);return null!=t&&(n+="="+encodeURIComponent(t)),n})).join("&"):""},parseQueryString:function(t){var e,n,i,o={};if(!t)return null;(e=t.indexOf("?"))>=0&&(t=t.substr(e+1));for(var r=t.replace(/\+/g,"%20").split("&"),s=0;s=0?[a.substr(0,e),a.substr(e+1)]:[a]).length&&(i=decodeURIComponent(n[0]))&&(o[i]=n.length>1?decodeURIComponent(n[1]):null)}return o},msg:ht,Notification:A,PasswordConfirmation:pt,Plugins:{_plugins:{},register:function(t,e){var n=this._plugins[t];n||(n=this._plugins[t]=[]),n.push(e)},getPlugins:function(t){return this._plugins[t]||[]},attach:function(t,e,n){for(var i=this.getPlugins(t),o=0;o=0;--o){var r=this.tryEntries[o],s=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var a=n.call(r,"catchLoc"),c=n.call(r,"finallyLoc");if(a&&c){if(this.prev=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var o=i.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function Ot(t,e,n,i,o,r,s){try{var a=t[r](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(i,o)}function zt(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var r=t.apply(e,n);function s(t){Ot(r,i,o,s,a,"next",t)}function a(t){Ot(r,i,o,s,a,"throw",t)}s(void 0)}))}}var Rt=null,Nt=function(){var t=zt(Pt().mark((function t(){var e,n;return Pt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=(0,v.generateUrl)("/csrftoken"),t.next=3,h().get(e);case 3:return n=t.sent,t.abrupt("return",n.token);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),Ht=function(){var t=zt(Pt().mark((function t(){var e;return Pt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Nt();case 3:e=t.sent,J(e),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),Tt.error("session heartbeat failed",t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}(),jt=function(){var t=setInterval(Ht,1e3*function(){var t=NaN;return Rt.session_lifetime&&(t=Math.floor(Rt.session_lifetime/2)),Math.min(86400,Math.max(60,isNaN(t)?900:t))}());return Tt.info("session heartbeat polling started"),t},Lt=o(20144),Ut=o(93664),Ft={name:"ContactsIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Wt=o(51900),Yt=(0,Wt.Z)(Ft,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon contacts-icon",attrs:{"aria-hidden":!t.title,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M20,0H4V2H20V0M4,24H20V22H4V24M20,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M12,6.75A2.25,2.25 0 0,1 14.25,9A2.25,2.25 0 0,1 12,11.25A2.25,2.25 0 0,1 9.75,9A2.25,2.25 0 0,1 12,6.75M17,17H7V15.5C7,13.83 10.33,13 12,13C13.67,13 17,13.83 17,15.5V17Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports,Qt=o(20296),qt=o.n(Qt),Gt=o(9062),Xt=o(21146),Vt=(0,Wt.Z)(Xt.Z,Gt.s,Gt.x,!1,null,null,null).exports,Kt=o(86514),Zt=o(93815),Jt=o(20435),$t=o(74176),te=o(76955),ee=o(3349),ne=o(18519);function ie(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=0;--o){var r=this.tryEntries[o],s=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var a=n.call(r,"catchLoc"),c=n.call(r,"finallyLoc");if(a&&c){if(this.prev=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var o=i.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function Ee(t,e,n,i,o,r,s){try{var a=t[r](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(i,o)}function _e(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var r=t.apply(e,n);function s(t){Ee(r,i,o,s,a,"next",t)}function a(t){Ee(r,i,o,s,a,"throw",t)}s(void 0)}))}}var De={name:"ContactsMenu",components:{Contact:Ce,Contacts:Yt,Magnify:Vt,NcEmptyContent:Kt.Z,NcHeaderMenu:Zt.Z,NcLoadingIcon:Jt.Z},mixins:[we],data:function(){var t=(0,St.ts)();return{contactsAppEnabled:!1,contactsAppURL:(0,v.generateUrl)("/apps/contacts"),contactsAppMgmtURL:(0,v.generateUrl)("/settings/apps/social/contacts"),canInstallApp:t.isAdmin,contacts:[],loadingText:void 0,error:!1,searchTerm:""}},methods:{handleOpen:function(){var t=this;return _e(Be().mark((function e(){return Be().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getContacts("");case 2:case"end":return e.stop()}}),e)})))()},getContacts:function(t){var e=this;return _e(Be().mark((function n(){var i,o,r,s;return Be().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e.loadingText=""===t?(0,ut.Iu)("core","Loading your contacts …"):(0,ut.Iu)("core","Looking for {term} …",{term:t}),e.error=!1,n.prev=2,n.next=5,Ut.Z.post((0,v.generateUrl)("/contactsmenu/contacts"),{filter:t});case 5:i=n.sent,o=i.data,r=o.contacts,s=o.contactsAppEnabled,e.contacts=r,e.contactsAppEnabled=s,e.loadingText=void 0,n.next=18;break;case 14:n.prev=14,n.t0=n.catch(2),ye.error("could not load contacts",{error:n.t0,searchTerm:t}),e.error=!0;case 18:case"end":return n.stop()}}),n,null,[[2,14]])})))()},onInputDebounced:qt()((function(){this.getContacts(this.searchTerm)}),500)}},Ie=De,Se=o(87911),Te={};Te.styleTagTransform=ge(),Te.setAttributes=de(),Te.insert=le().bind(null,"head"),Te.domAPI=ce(),Te.insertStyleElement=Ae(),se()(Se.Z,Te),Se.Z&&Se.Z.locals&&Se.Z.locals;var Me=(0,Wt.Z)(Ie,(function(){var t=this,e=t._self._c;return e("NcHeaderMenu",{staticClass:"contactsmenu",attrs:{id:"contactsmenu","aria-label":t.t("core","Search contacts")},on:{open:t.handleOpen},scopedSlots:t._u([{key:"trigger",fn:function(){return[e("Contacts",{attrs:{size:20}})]},proxy:!0}])},[t._v(" "),e("div",{staticClass:"contactsmenu__menu"},[e("label",{attrs:{for:"contactsmenu__menu__search"}},[t._v(t._s(t.t("core","Search contacts")))]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.searchTerm,expression:"searchTerm"}],staticClass:"contactsmenu__menu__search",attrs:{id:"contactsmenu__menu__search",type:"search",placeholder:t.t("core","Search contacts …")},domProps:{value:t.searchTerm},on:{input:[function(e){e.target.composing||(t.searchTerm=e.target.value)},t.onInputDebounced]}}),t._v(" "),t.error?e("NcEmptyContent",{attrs:{name:t.t("core","Could not load your contacts")},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Magnify")]},proxy:!0}],null,!1,931131664)}):t.loadingText?e("NcEmptyContent",{attrs:{name:t.loadingText},scopedSlots:t._u([{key:"icon",fn:function(){return[e("NcLoadingIcon")]},proxy:!0}])}):0===t.contacts.length?e("NcEmptyContent",{attrs:{name:t.t("core","No contacts found")},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Magnify")]},proxy:!0}])}):e("div",{staticClass:"contactsmenu__menu__content"},[e("div",{attrs:{id:"contactsmenu-contacts"}},[e("ul",t._l(t.contacts,(function(t){return e("Contact",{key:t.id,attrs:{contact:t}})})),1)]),t._v(" "),t.contactsAppEnabled?e("div",{staticClass:"contactsmenu__menu__content__footer"},[e("a",{attrs:{href:t.contactsAppURL}},[t._v(t._s(t.t("core","Show all contacts …")))])]):t.canInstallApp?e("div",{staticClass:"contactsmenu__menu__content__footer"},[e("a",{attrs:{href:t.contactsAppMgmtURL}},[t._v(t._s(t.t("core","Install the Contacts app")))])]):t._e()])],1)])}),[],!1,null,"3cef19f7",null).exports,Pe={name:"AppMenu",components:{NcActions:ee.Z,NcActionLink:$t.Z},data:function(){return{apps:(0,It.j)("core","apps",{}),appLimit:0,observer:null}},computed:{appList:function(){return Object.values(this.apps)},mainAppList:function(){return this.appList.slice(0,this.appLimit)},popoverAppList:function(){return this.appList.slice(this.appLimit)},appLabel:function(){return function(e){return e.name+(e.active?" ("+t("core","Currently open")+")":"")+(e.unread>0?" ("+n("core","{count} notification","{count} notifications",e.unread,{count:e.unread})+")":"")}}},mounted:function(){this.observer=new ResizeObserver(this.resize),this.observer.observe(this.$el),this.resize(),(0,c.Ld)("nextcloud:app-menu.refresh",this.setApps)},beforeDestroy:function(){this.observer.disconnect(),(0,c.r1)("nextcloud:app-menu.refresh",this.setApps)},methods:{setNavigationCounter:function(t,e){this.$set(this.apps[t],"unread",e)},setApps:function(t){var e=t.apps;this.apps=e},resize:function(){var t=this.$el.offsetWidth,e=Math.floor(t/50)-1;1==this.appList.length-e&&e--,e<1&&(e=0),this.appLimit=e}}},Oe=Pe,ze=o(20424),Re={};Re.styleTagTransform=ge(),Re.setAttributes=de(),Re.insert=le().bind(null,"head"),Re.domAPI=ce(),Re.insertStyleElement=Ae(),se()(ze.Z,Re),ze.Z&&ze.Z.locals&&ze.Z.locals;var Ne=(0,Wt.Z)(Oe,(function(){var t=this,e=t._self._c;return e("nav",{staticClass:"app-menu",attrs:{"aria-label":t.t("core","Applications menu")}},[e("ul",{staticClass:"app-menu-main"},t._l(t.mainAppList,(function(n){return e("li",{key:n.id,staticClass:"app-menu-entry",class:{"app-menu-entry__active":n.active},attrs:{"data-app-id":n.id}},[e("a",{class:{"has-unread":n.unread>0},attrs:{href:n.href,"aria-label":t.appLabel(n),title:n.name,"aria-current":!!n.active&&"page",target:n.target?"_blank":void 0,rel:n.target?"noopener noreferrer":void 0}},[e("img",{attrs:{src:n.icon,alt:""}}),t._v(" "),e("div",{staticClass:"app-menu-entry--label"},[t._v("\n\t\t\t\t\t"+t._s(n.name)+"\n\t\t\t\t\t"),n.unread>0?e("span",{staticClass:"hidden-visually unread-counter"},[t._v(t._s(n.unread))]):t._e()])])])})),0),t._v(" "),e("NcActions",{staticClass:"app-menu-more",attrs:{"aria-label":t.t("core","More apps")}},t._l(t.popoverAppList,(function(n){return e("NcActionLink",{key:n.id,staticClass:"app-menu-popover-entry",attrs:{"aria-label":t.appLabel(n),"aria-current":!!n.active&&"page",href:n.href},scopedSlots:t._u([{key:"icon",fn:function(){return[e("div",{staticClass:"app-icon",class:{"has-unread":n.unread>0}},[e("img",{attrs:{src:n.icon,alt:""}})])]},proxy:!0}],null,!0)},[t._v("\n\t\t\t"+t._s(n.name)+"\n\t\t\t"),n.unread>0?e("span",{staticClass:"hidden-visually unread-counter"},[t._v(t._s(n.unread))]):t._e()])})),1)],1)}),[],!1,null,"4cadd91a",null).exports,He=(0,It.j)("core","versionHash",""),je={name:"UserMenuEntry",components:{NcLoadingIcon:Jt.Z},props:{id:{type:String,required:!0},name:{type:String,required:!0},href:{type:String,required:!0},active:{type:Boolean,required:!0},icon:{type:String,required:!0}},data:function(){return{loading:!1}},computed:{cachedIcon:function(){return"".concat(this.icon,"?v=").concat(He)}},methods:{handleClick:function(){this.loading=!0}}},Le=o(88951),Ue={};Ue.styleTagTransform=ge(),Ue.setAttributes=de(),Ue.insert=le().bind(null,"head"),Ue.domAPI=ce(),Ue.insertStyleElement=Ae(),se()(Le.Z,Ue),Le.Z&&Le.Z.locals&&Le.Z.locals;var Fe=(0,Wt.Z)(je,(function(){var t=this,e=t._self._c;return e("li",{staticClass:"menu-entry",attrs:{id:t.id}},[t.href?e("a",{class:{active:t.active},attrs:{href:t.href},on:{click:function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey?null:t.handleClick.apply(null,arguments)}}},[t.loading?e("NcLoadingIcon",{staticClass:"menu-entry__loading-icon",attrs:{size:18}}):e("img",{attrs:{src:t.cachedIcon,alt:""}}),t._v("\n\t\t"+t._s(t.name)+"\n\t")],1):e("button",[e("img",{attrs:{src:t.cachedIcon,alt:""}}),t._v("\n\t\t"+t._s(t.name)+"\n\t")])])}),[],!1,null,"6e59d13c",null),We=Fe.exports;function Ye(t){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ye(t)}function Qe(){Qe=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function u(t,e,n,o){var r=e&&e.prototype instanceof d?e:d,s=Object.create(r.prototype),a=new B(o||[]);return i(s,"_invoke",{value:x(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function p(){}function A(){}var f={};c(f,r,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==e&&n.call(m,r)&&(f=m);var v=A.prototype=d.prototype=Object.create(f);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function o(i,r,s,a){var c=l(t[i],t,r);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==Ye(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){o("next",t,s,a)}),(function(t){o("throw",t,s,a)})):e.resolve(h).then((function(t){u.value=t,s(u)}),(function(t){return o("throw",t,s,a)}))}a(c.arg)}var r;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){o(t,n,e,i)}))}return r=r?r.then(i,i):i()}})}function x(t,e,n){var i="suspendedStart";return function(o,r){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw r;return{value:void 0,done:!0}}for(n.method=o,n.arg=r;;){var s=n.delegate;if(s){var a=y(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var c=l(t,e,n);if("normal"===c.type){if(i=n.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i="completed",n.method="throw",n.arg=c.arg)}}}function y(t,e){var n=e.method,i=t.iterator[n];if(void 0===i)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,y(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=l(i,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var r=o.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--o){var r=this.tryEntries[o],s=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var a=n.call(r,"catchLoc"),c=n.call(r,"finallyLoc");if(a&&c){if(this.prev=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var o=i.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function qe(t,e,n,i,o,r,s){try{var a=t[r](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(i,o)}function Ge(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n