@micromag/viewer-build 0.3.516 → 0.3.518

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/build/asset-manifest.json +6 -23
  2. package/build/index.html +1 -1
  3. package/build/static/js/175.42d3627e.js +2 -0
  4. package/build/static/js/{625.6bcbdc63.js.LICENSE.txt → 175.42d3627e.js.LICENSE.txt} +0 -10
  5. package/build/static/js/main.5411c29e.js +2 -0
  6. package/build/static/js/runtime~main.3754c53b.js +1 -0
  7. package/package.json +6 -6
  8. package/build/static/js/104.e7b2f53b.chunk.js +0 -1
  9. package/build/static/js/119.409edb1a.chunk.js +0 -1
  10. package/build/static/js/139.4365a1df.chunk.js +0 -1
  11. package/build/static/js/165.a09e3185.chunk.js +0 -1
  12. package/build/static/js/177.d6cc3845.chunk.js +0 -1
  13. package/build/static/js/299.a106f35a.chunk.js +0 -1
  14. package/build/static/js/359.768ec35e.chunk.js +0 -1
  15. package/build/static/js/375.0bcd7609.chunk.js +0 -2
  16. package/build/static/js/375.0bcd7609.chunk.js.LICENSE.txt +0 -10
  17. package/build/static/js/462.307a7cd0.chunk.js +0 -1
  18. package/build/static/js/50.9da80c9d.chunk.js +0 -1
  19. package/build/static/js/526.efc3b856.chunk.js +0 -2
  20. package/build/static/js/526.efc3b856.chunk.js.LICENSE.txt +0 -10
  21. package/build/static/js/567.1a366653.chunk.js +0 -1
  22. package/build/static/js/595.27131768.chunk.js +0 -1
  23. package/build/static/js/625.6bcbdc63.js +0 -2
  24. package/build/static/js/626.c42d15c2.chunk.js +0 -2
  25. package/build/static/js/626.c42d15c2.chunk.js.LICENSE.txt +0 -1
  26. package/build/static/js/784.1708dd96.chunk.js +0 -1
  27. package/build/static/js/786.6bf1d59f.chunk.js +0 -1
  28. package/build/static/js/793.ed1b7b39.chunk.js +0 -1
  29. package/build/static/js/main.065e9735.js +0 -2
  30. package/build/static/js/runtime~main.4d15fd3a.js +0 -1
  31. /package/build/static/js/{main.065e9735.js.LICENSE.txt → main.5411c29e.js.LICENSE.txt} +0 -0
@@ -1,2 +0,0 @@
1
- /*! For license information please see 626.c42d15c2.chunk.js.LICENSE.txt */
2
- "use strict";(self.webpackChunk_micromag_viewer_build=self.webpackChunk_micromag_viewer_build||[]).push([[626],{1359:function(e,t){var r=Object.prototype.hasOwnProperty;function n(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function o(e){try{return encodeURIComponent(e)}catch(e){return null}}t.stringify=function(e,t){t=t||"";var n,i,a=[];for(i in"string"!=typeof t&&(t="?"),e)if(r.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=o(i),n=o(n),null===i||null===n)continue;a.push(i+"="+n)}return a.length?t+a.join("&"):""},t.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,o={};t=r.exec(e);){var i=n(t[1]),a=n(t[2]);null===i||null===a||i in o||(o[i]=a)}return o}},3062:function(e){e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},2225:function(e,t,r){var n=r(3062),o=r(1359),i=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,a=/[\n\r\t]/g,u=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,s=/:\d+$/,l=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,c=/^[a-zA-Z]:/;function f(e){return(e||"").toString().replace(i,"")}var p=[["#","hash"],["?","query"],function(e,t){return y(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],h={hash:1,query:1};function d(e){var t,n=("undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{}).location||{},o={},i=typeof(e=e||n);if("blob:"===e.protocol)o=new m(unescape(e.pathname),{});else if("string"===i)for(t in o=new m(e,{}),h)delete o[t];else if("object"===i){for(t in e)t in h||(o[t]=e[t]);void 0===o.slashes&&(o.slashes=u.test(e.href))}return o}function y(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function v(e,t){e=(e=f(e)).replace(a,""),t=t||{};var r,n=l.exec(e),o=n[1]?n[1].toLowerCase():"",i=!!n[2],u=!!n[3],s=0;return i?u?(r=n[2]+n[3]+n[4],s=n[2].length+n[3].length):(r=n[2]+n[4],s=n[2].length):u?(r=n[3]+n[4],s=n[3].length):r=n[4],"file:"===o?s>=2&&(r=r.slice(2)):y(o)?r=n[4]:o?i&&(r=r.slice(2)):s>=2&&y(t.protocol)&&(r=n[4]),{protocol:o,slashes:i||y(o),slashesCount:s,rest:r}}function m(e,t,r){if(e=(e=f(e)).replace(a,""),!(this instanceof m))return new m(e,t,r);var i,u,s,l,h,g,b=p.slice(),w=typeof t,_=this,S=0;for("object"!==w&&"string"!==w&&(r=t,t=null),r&&"function"!=typeof r&&(r=o.parse),i=!(u=v(e||"",t=d(t))).protocol&&!u.slashes,_.slashes=u.slashes||i&&t.slashes,_.protocol=u.protocol||t.protocol||"",e=u.rest,("file:"===u.protocol&&(2!==u.slashesCount||c.test(e))||!u.slashes&&(u.protocol||u.slashesCount<2||!y(_.protocol)))&&(b[3]=[/(.*)/,"pathname"]);S<b.length;S++)"function"!=typeof(l=b[S])?(s=l[0],g=l[1],s!=s?_[g]=e:"string"==typeof s?~(h="@"===s?e.lastIndexOf(s):e.indexOf(s))&&("number"==typeof l[2]?(_[g]=e.slice(0,h),e=e.slice(h+l[2])):(_[g]=e.slice(h),e=e.slice(0,h))):(h=s.exec(e))&&(_[g]=h[1],e=e.slice(0,h.index)),_[g]=_[g]||i&&l[3]&&t[g]||"",l[4]&&(_[g]=_[g].toLowerCase())):e=l(e,_);r&&(_.query=r(_.query)),i&&t.slashes&&"/"!==_.pathname.charAt(0)&&(""!==_.pathname||""!==t.pathname)&&(_.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),a++):a&&(0===n&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(_.pathname,t.pathname)),"/"!==_.pathname.charAt(0)&&y(_.protocol)&&(_.pathname="/"+_.pathname),n(_.port,_.protocol)||(_.host=_.hostname,_.port=""),_.username=_.password="",_.auth&&(~(h=_.auth.indexOf(":"))?(_.username=_.auth.slice(0,h),_.username=encodeURIComponent(decodeURIComponent(_.username)),_.password=_.auth.slice(h+1),_.password=encodeURIComponent(decodeURIComponent(_.password))):_.username=encodeURIComponent(decodeURIComponent(_.auth)),_.auth=_.password?_.username+":"+_.password:_.username),_.origin="file:"!==_.protocol&&y(_.protocol)&&_.host?_.protocol+"//"+_.host:"null",_.href=_.toString()}m.prototype={set:function(e,t,r){var i=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||o.parse)(t)),i[e]=t;break;case"port":i[e]=t,n(t,i.protocol)?t&&(i.host=i.hostname+":"+t):(i.host=i.hostname,i[e]="");break;case"hostname":i[e]=t,i.port&&(t+=":"+i.port),i.host=t;break;case"host":i[e]=t,s.test(t)?(t=t.split(":"),i.port=t.pop(),i.hostname=t.join(":")):(i.hostname=t,i.port="");break;case"protocol":i.protocol=t.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(t){var a="pathname"===e?"/":"#";i[e]=t.charAt(0)!==a?a+t:t}else i[e]=t;break;case"username":case"password":i[e]=encodeURIComponent(t);break;case"auth":var u=t.indexOf(":");~u?(i.username=t.slice(0,u),i.username=encodeURIComponent(decodeURIComponent(i.username)),i.password=t.slice(u+1),i.password=encodeURIComponent(decodeURIComponent(i.password))):i.username=encodeURIComponent(decodeURIComponent(t))}for(var l=0;l<p.length;l++){var c=p[l];c[4]&&(i[c[1]]=i[c[1]].toLowerCase())}return i.auth=i.password?i.username+":"+i.password:i.username,i.origin="file:"!==i.protocol&&y(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(e){e&&"function"==typeof e||(e=o.stringify);var t,r=this,n=r.host,i=r.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var a=i+(r.protocol&&r.slashes||y(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):"file:"!==r.protocol&&y(r.protocol)&&!n&&"/"!==r.pathname&&(a+="@"),(":"===n[n.length-1]||s.test(r.hostname)&&!r.port)&&(n+=":"),a+=n+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(a+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(a+=r.hash),a}},m.extractProtocol=v,m.location=d,m.trimLeft=f,m.qs=o,e.exports=m},4626:function(e,t,r){r.r(t),r.d(t,{default:function(){return ot}});var n=r(2729);const o="function"==typeof Buffer,i=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),a=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),u=((e=>{let t={};e.forEach(((e,r)=>t[e]=r))})(a),String.fromCharCode.bind(String)),s=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),l="function"==typeof btoa?e=>btoa(e):o?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,r,n,o,i="";const u=e.length%3;for(let u=0;u<e.length;){if((r=e.charCodeAt(u++))>255||(n=e.charCodeAt(u++))>255||(o=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,i+=a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}return u?i.slice(0,u-3)+"===".substring(u):i},c=o?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(u.apply(null,e.subarray(r,r+4096)));return l(t.join(""))},f=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?u(192|t>>>6)+u(128|63&t):u(224|t>>>12&15)+u(128|t>>>6&63)+u(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return u(240|t>>>18&7)+u(128|t>>>12&63)+u(128|t>>>6&63)+u(128|63&t)},p=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,h=o?e=>Buffer.from(e,"utf8").toString("base64"):i?e=>c(i.encode(e)):e=>l(e.replace(p,f)),d=(e,t=!1)=>t?s(h(e)):h(e);var y=r(2225),v=r.n(y);function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function g(e){var t="function"==typeof Map?new Map:void 0;return g=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return b(e,arguments,S(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_(r,e)},g(e)}function b(e,t,r){return b=w()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&_(o,r.prototype),o},b.apply(null,arguments)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_(e,t)}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}var U=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_(e,t)}(i,e);var t,r,n,o=(r=i,n=w(),function(){var e,t=S(r);if(n){var o=S(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e)).originalRequest=n,t.originalResponse=a,t.causingError=r,null!=r&&(e+=", caused by ".concat(r.toString())),null!=n){var u=n.getHeader("X-Request-ID")||"n/a",s=n.getMethod(),l=n.getURL(),c=a?a.getStatus():"n/a",f=a?a.getBody()||"":"n/a";e+=", originated from request (method: ".concat(s,", url: ").concat(l,", response code: ").concat(c,", response text: ").concat(f,", request id: ").concat(u,")")}return t.message=e,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(g(Error)),P=U;function O(){O=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),u=new C(n||[]);return o(a,"_invoke",{value:x(e,r,u)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(T([])));S&&S!==r&&n.call(S,a)&&(w=S);var U=b.prototype=m.prototype=Object.create(w);function P(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(o,i,a,u){var s=f(e[o],e,i);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"==R(c)&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(c).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(s.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function x(t,r,n){var o=p;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var s=j(u,n);if(s){if(s===v)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(t,r,n);if("normal"===l.type){if(o=n.done?y:h,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function T(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(R(t)+" is not iterable")}return g.prototype=b,o(U,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(U),e},t.awrap=function(e){return{__await:e}},P(E.prototype),l(E.prototype,u,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new E(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},P(U),l(U,s,"Generator"),l(U,a,(function(){return this})),l(U,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=T,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:T(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function E(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],s=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function C(e,t,r){return(t=q(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,q(n.key),n)}}function q(e){var t=function(e,t){if("object"!==R(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===R(t)?t:String(t)}var A={endpoint:null,uploadUrl:null,metadata:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:M,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null},D=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}var t,r,n;return t=e,r=[{key:"findPreviousUploads",value:function(){var e=this;return this.options.fingerprint(this.file,this.options).then((function(t){return e._urlStorage.findUploadsByFingerprint(t)}))}},{key:"resumeFromPreviousUpload",value:function(e){this.url=e.uploadUrl||null,this._parallelUploadUrls=e.parallelUploadUrls||null,this._urlStorageKey=e.urlStorageKey}},{key:"start",value:function(){var e=this,t=this.file;if(t)if(this.options.endpoint||this.options.uploadUrl||this.url){var r=this.options.retryDelays;if(null==r||"[object Array]"===Object.prototype.toString.call(r)){if(this.options.parallelUploads>1)for(var n=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];n<o.length;n++){var i=o[n];if(this.options[i])return void this._emitError(new Error("tus: cannot use the ".concat(i," option when parallelUploads is enabled")))}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1)return void this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length)return void this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"))}this.options.fingerprint(t,this.options).then((function(r){return null==r||"Calculated fingerprint: ".concat(r),e._fingerprint=r,e._source?e._source:e.options.fileReader.openFile(t,e.options.chunkSize)})).then((function(t){if(e._source=t,e.options.uploadLengthDeferred)e._size=null;else if(null!=e.options.uploadSize){if(e._size=Number(e.options.uploadSize),Number.isNaN(e._size))return void e._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))}else if(e._size=e._source.size,null==e._size)return void e._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));e.options.parallelUploads>1||null!=e._parallelUploadUrls?e._startParallelUpload():e._startSingleUpload()})).catch((function(t){e._emitError(t)}))}else this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var t,r=this,n=this._size,o=0;this._parallelUploads=[];var i=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,a=null!==(t=this.options.parallelUploadBoundaries)&&void 0!==t?t:function(e,t){for(var r=Math.floor(e/t),n=[],o=0;o<t;o++)n.push({start:r*o,end:r*(o+1)});return n[t-1].end=e,n}(this._source.size,i);this._parallelUploadUrls&&a.forEach((function(e,t){e.uploadUrl=r._parallelUploadUrls[t]||null})),this._parallelUploadUrls=new Array(a.length);var u,s=a.map((function(t,i){var u=0;return r._source.slice(t.start,t.end).then((function(s){var l=s.value;return new Promise((function(s,c){var f=L(L({},r.options),{},{uploadUrl:t.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:{},headers:L(L({},r.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:s,onError:c,onProgress:function(e){o=o-u+e,u=e,r._emitProgress(o,n)},onUploadUrlAvailable:function(){r._parallelUploadUrls[i]=p.url,r._parallelUploadUrls.filter((function(e){return Boolean(e)})).length===a.length&&r._saveUploadInUrlStorage()}}),p=new e(l,f);p.start(),r._parallelUploads.push(p)}))}))}));Promise.all(s).then((function(){(u=r._openRequest("POST",r.options.endpoint)).setHeader("Upload-Concat","final;".concat(r._parallelUploadUrls.join(" ")));var e=F(r.options.metadata);return""!==e&&u.setHeader("Upload-Metadata",e),r._sendRequest(u,null)})).then((function(e){if(z(e.getStatus(),200)){var t=e.getHeader("Location");null!=t?(r.url=G(r.options.endpoint,t),"Created upload at ".concat(r.url),r._emitSuccess()):r._emitHttpError(u,e,"tus: invalid or missing Location header")}else r._emitHttpError(u,e,"tus: unexpected response while creating upload")})).catch((function(e){r._emitError(e)}))}},{key:"_startSingleUpload",value:function(){return this._aborted=!1,null!=this.url?("Resuming upload from previous URL: ".concat(this.url),void this._resumeUpload()):null!=this.options.uploadUrl?("Resuming upload from provided URL: ".concat(this.options.uploadUrl),this.url=this.options.uploadUrl,void this._resumeUpload()):void this._createUpload()}},{key:"abort",value:function(t){var r=this;return null!=this._parallelUploads&&this._parallelUploads.forEach((function(e){e.abort(t)})),null!==this._req&&this._req.abort(),this._aborted=!0,null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),t&&null!=this.url?e.terminate(this.url,this.options).then((function(){return r._removeFromUrlStorage()})):Promise.resolve()}},{key:"_emitHttpError",value:function(e,t,r,n){this._emitError(new P(r,n,e,t))}},{key:"_emitError",value:function(e){var t=this;if(!this._aborted){if(null!=this.options.retryDelays&&(null!=this._offset&&this._offset>this._offsetBeforeRetry&&(this._retryAttempt=0),B(e,this._retryAttempt,this.options))){var r=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){t.start()}),r))}if("function"!=typeof this.options.onError)throw e;this.options.onError(e)}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"==typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(e,t){"function"==typeof this.options.onProgress&&this.options.onProgress(e,t)}},{key:"_emitChunkComplete",value:function(e,t,r){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(e,t,r)}},{key:"_createUpload",value:function(){var e=this;if(this.options.endpoint){var t=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?t.setHeader("Upload-Defer-Length",1):t.setHeader("Upload-Length",this._size);var r,n=F(this.options.metadata);""!==n&&t.setHeader("Upload-Metadata",n),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,r=this._addChunkToRequest(t)):r=this._sendRequest(t,null),r.then((function(r){if(z(r.getStatus(),200)){var n=r.getHeader("Location");if(null!=n){if(e.url=G(e.options.endpoint,n),"Created upload at ".concat(e.url),"function"==typeof e.options.onUploadUrlAvailable&&e.options.onUploadUrlAvailable(),0===e._size)return e._emitSuccess(),void e._source.close();e._saveUploadInUrlStorage().then((function(){e.options.uploadDataDuringCreation?e._handleUploadResponse(t,r):(e._offset=0,e._performUpload())}))}else e._emitHttpError(t,r,"tus: invalid or missing Location header")}else e._emitHttpError(t,r,"tus: unexpected response while creating upload")})).catch((function(r){e._emitHttpError(t,null,"tus: failed to create upload",r)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var e=this,t=this._openRequest("HEAD",this.url);this._sendRequest(t,null).then((function(r){var n=r.getStatus();if(!z(n,200))return 423===n?void e._emitHttpError(t,r,"tus: upload is currently locked; retry later"):(z(n,400)&&e._removeFromUrlStorage(),e.options.endpoint?(e.url=null,void e._createUpload()):void e._emitHttpError(t,r,"tus: unable to resume upload (new upload cannot be created without an endpoint)"));var o=parseInt(r.getHeader("Upload-Offset"),10);if(Number.isNaN(o))e._emitHttpError(t,r,"tus: invalid or missing offset value");else{var i=parseInt(r.getHeader("Upload-Length"),10);!Number.isNaN(i)||e.options.uploadLengthDeferred?("function"==typeof e.options.onUploadUrlAvailable&&e.options.onUploadUrlAvailable(),e._saveUploadInUrlStorage().then((function(){if(o===i)return e._emitProgress(i,i),void e._emitSuccess();e._offset=o,e._performUpload()}))):e._emitHttpError(t,r,"tus: invalid or missing length value")}})).catch((function(r){e._emitHttpError(t,null,"tus: failed to resume upload",r)}))}},{key:"_performUpload",value:function(){var e,t=this;this._aborted||(this.options.overridePatchMethod?(e=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):e=this._openRequest("PATCH",this.url),e.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(e).then((function(r){z(r.getStatus(),200)?t._handleUploadResponse(e,r):t._emitHttpError(e,r,"tus: unexpected response while uploading chunk")})).catch((function(r){t._aborted||t._emitHttpError(e,null,"tus: failed to upload chunk at offset ".concat(t._offset),r)})))}},{key:"_addChunkToRequest",value:function(e){var t=this,r=this._offset,n=this._offset+this.options.chunkSize;return e.setProgressHandler((function(e){t._emitProgress(r+e,t._size)})),e.setHeader("Content-Type","application/offset+octet-stream"),(n===1/0||n>this._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(r,n).then((function(r){var n=r.value,o=r.done,i=n&&n.size?n.size:0;t.options.uploadLengthDeferred&&o&&(t._size=t._offset+i,e.setHeader("Upload-Length",t._size));var a=t._offset+i;return!t.options.uploadLengthDeferred&&o&&a!==t._size?Promise.reject(new Error("upload was configured with a size of ".concat(t._size," bytes, but the source is done after ").concat(a," bytes"))):null===n?t._sendRequest(e):(t._emitProgress(t._offset,t._size),t._sendRequest(e,n))}))}},{key:"_handleUploadResponse",value:function(e,t){var r=parseInt(t.getHeader("Upload-Offset"),10);if(Number.isNaN(r))this._emitHttpError(e,t,"tus: invalid or missing offset value");else{if(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),this._offset=r,r===this._size)return this._emitSuccess(),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(e,t){var r=H(e,t,this.options);return this._req=r,r}},{key:"_removeFromUrlStorage",value:function(){var e=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(t){e._emitError(t)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var e=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||null!==this._urlStorageKey)return Promise.resolve();var t={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};return this._parallelUploads?t.parallelUploadUrls=this._parallelUploadUrls:t.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,t).then((function(t){e._urlStorageKey=t}))}},{key:"_sendRequest",value:function(e){return I(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,this.options)}}],n=[{key:"terminate",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=H("DELETE",t,r);return I(n,null,r).then((function(e){if(204!==e.getStatus())throw new P("tus: unexpected response while terminating upload",null,n,e)})).catch((function(o){if(o instanceof P||(o=new P("tus: failed to terminate upload",o,n,null)),!B(o,0,r))throw o;var i=r.retryDelays[0],a=r.retryDelays.slice(1),u=L(L({},r),{},{retryDelays:a});return new Promise((function(e){return setTimeout(e,i)})).then((function(){return e.terminate(t,u)}))}))}}],r&&T(t.prototype,r),n&&T(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function F(e){return Object.entries(e).map((function(e){var t=x(e,2),r=t[0],n=t[1];return"".concat(r," ").concat(d(String(n)))})).join(",")}function z(e,t){return e>=t&&e<t+100}function H(e,t,r){var n=r.httpStack.createRequest(e,t);n.setHeader("Tus-Resumable","1.0.0");var o=r.headers||{};if(Object.entries(o).forEach((function(e){var t=x(e,2),r=t[0],o=t[1];n.setHeader(r,o)})),r.addRequestId){var i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));n.setHeader("X-Request-ID",i)}return n}function I(e,t,r){return N.apply(this,arguments)}function N(){var e;return e=O().mark((function e(t,r,n){var o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof n.onBeforeRequest){e.next=3;break}return e.next=3,n.onBeforeRequest(t);case 3:return e.next=5,t.send(r);case 5:if(o=e.sent,"function"!=typeof n.onAfterResponse){e.next=9;break}return e.next=9,n.onAfterResponse(t,o);case 9:return e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})),N=function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){E(i,n,o,a,u,"next",e)}function u(e){E(i,n,o,a,u,"throw",e)}a(void 0)}))},N.apply(this,arguments)}function B(e,t,r){return!(null==r.retryDelays||t>=r.retryDelays.length||null==e.originalRequest)&&(r&&"function"==typeof r.onShouldRetry?r.onShouldRetry(e,t,r):M(e))}function M(e){var t,r=e.originalResponse?e.originalResponse.getStatus():0;return(!z(r,400)||409===r||423===r)&&(t=!0,"undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(t=!1),t)}function G(e,t){return new(v())(t,e).toString()}D.defaultOptions=A;var K=D;function X(e){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(e)}function $(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Y(n.key),n)}}function Y(e){var t=function(e,t){if("object"!==X(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==X(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===X(t)?t:String(t)}var J=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r;return t=e,(r=[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(e){return Promise.resolve([])}},{key:"removeUpload",value:function(e){return Promise.resolve()}},{key:"addUpload",value:function(e,t){return Promise.resolve(null)}}])&&$(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Q(e){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Q(e)}function Z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,V(n.key),n)}}function V(e){var t=function(e,t){if("object"!==Q(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==Q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Q(t)?t:String(t)}var W=!1;try{W="localStorage"in window;var ee="tusSupport",te=localStorage.getItem(ee);localStorage.setItem(ee,te),null===te&&localStorage.removeItem(ee)}catch(e){if(e.code!==e.SECURITY_ERR&&e.code!==e.QUOTA_EXCEEDED_ERR)throw e;W=!1}var re=W,ne=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r;return t=e,r=[{key:"findAllUploads",value:function(){var e=this._findEntries("tus::");return Promise.resolve(e)}},{key:"findUploadsByFingerprint",value:function(e){var t=this._findEntries("tus::".concat(e,"::"));return Promise.resolve(t)}},{key:"removeUpload",value:function(e){return localStorage.removeItem(e),Promise.resolve()}},{key:"addUpload",value:function(e,t){var r=Math.round(1e12*Math.random()),n="tus::".concat(e,"::").concat(r);return localStorage.setItem(n,JSON.stringify(t)),Promise.resolve(n)}},{key:"_findEntries",value:function(e){for(var t=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);if(0===n.indexOf(e))try{var o=JSON.parse(localStorage.getItem(n));o.urlStorageKey=n,t.push(o)}catch(e){}}return t}}],r&&Z(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function oe(e){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oe(e)}function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,se(n.key),n)}}function ue(e,t,r){return t&&ae(e.prototype,t),r&&ae(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function se(e){var t=function(e,t){if("object"!==oe(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===oe(t)?t:String(t)}var le=function(){function e(){ie(this,e)}return ue(e,[{key:"createRequest",value:function(e,t){return new ce(e,t)}},{key:"getName",value:function(){return"XHRHttpStack"}}]),e}(),ce=function(){function e(t,r){ie(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,!0),this._method=t,this._url=r,this._headers={}}return ue(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(e,t){this._xhr.setRequestHeader(e,t),this._headers[e]=t}},{key:"getHeader",value:function(e){return this._headers[e]}},{key:"setProgressHandler",value:function(e){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(t){t.lengthComputable&&e(t.loaded)})}},{key:"send",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(r,n){e._xhr.onload=function(){r(new fe(e._xhr))},e._xhr.onerror=function(e){n(e)},e._xhr.send(t)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),fe=function(){function e(t){ie(this,e),this._xhr=t}return ue(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(e){return this._xhr.getResponseHeader(e)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),pe=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};function he(e){return new Promise((function(t,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var e=n.response;t(e)},n.onerror=function(e){r(e)},n.open("GET",e),n.send()}))}function de(e){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},de(e)}function ye(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ve(n.key),n)}}function ve(e){var t=function(e,t){if("object"!==de(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===de(t)?t:String(t)}var me=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._file=t,this.size=t.size}var t,r;return t=e,(r=[{key:"slice",value:function(e,t){if("undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova))return r=this._file.slice(e,t),new Promise((function(e,t){var n=new FileReader;n.onload=function(){var t=new Uint8Array(n.result);e({value:t})},n.onerror=function(e){t(e)},n.readAsArrayBuffer(r)}));var r,n=this._file.slice(e,t),o=t>=this.size;return Promise.resolve({value:n,done:o})}},{key:"close",value:function(){}}])&&ye(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function ge(e){return ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ge(e)}function be(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,we(n.key),n)}}function we(e){var t=function(e,t){if("object"!==ge(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===ge(t)?t:String(t)}function _e(e){return void 0===e?0:void 0!==e.size?e.size:e.length}var Se=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=!1}var t,r;return t=e,(r=[{key:"slice",value:function(e,t){return e<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(e,t)}},{key:"_readUntilEnoughDataOrDone",value:function(e,t){var r=this,n=t<=this._bufferOffset+_e(this._buffer);if(this._done||n){var o=this._getDataFromBuffer(e,t),i=null==o&&this._done;return Promise.resolve({value:o,done:i})}return this._reader.read().then((function(n){var o=n.value;return n.done?r._done=!0:void 0===r._buffer?r._buffer=o:r._buffer=function(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}throw new Error("Unknown data type")}(r._buffer,o),r._readUntilEnoughDataOrDone(e,t)}))}},{key:"_getDataFromBuffer",value:function(e,t){e>this._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var r=0===_e(this._buffer);return this._done&&r?null:this._buffer.slice(0,t-e)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}])&&be(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ue(e){return Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ue(e)}function Pe(){Pe=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),u=new k(n||[]);return o(a,"_invoke",{value:E(e,r,u)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(L([])));S&&S!==r&&n.call(S,a)&&(w=S);var U=b.prototype=m.prototype=Object.create(w);function P(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(o,i,a,u){var s=f(e[o],e,i);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"==Ue(c)&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(c).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(s.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function E(t,r,n){var o=p;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var s=x(u,n);if(s){if(s===v)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(t,r,n);if("normal"===l.type){if(o=n.done?y:h,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function x(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,x(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(Ue(t)+" is not iterable")}return g.prototype=b,o(U,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(U),e},t.awrap=function(e){return{__await:e}},P(O.prototype),l(O.prototype,u,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},P(U),l(U,s,"Generator"),l(U,a,(function(){return this})),l(U,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=L,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;R(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function Oe(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function Ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xe(n.key),n)}}function xe(e){var t=function(e,t){if("object"!==Ue(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==Ue(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Ue(t)?t:String(t)}var je=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n,o;return t=e,r=[{key:"openFile",value:(n=Pe().mark((function e(t,r){var n;return Pe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!pe()||!t||void 0===t.uri){e.next=11;break}return e.prev=1,e.next=4,he(t.uri);case 4:return n=e.sent,e.abrupt("return",new me(n));case 8:throw e.prev=8,e.t0=e.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(e.t0));case 11:if("function"!=typeof t.slice||void 0===t.size){e.next=13;break}return e.abrupt("return",Promise.resolve(new me(t)));case 13:if("function"!=typeof t.read){e.next=18;break}if(r=Number(r),Number.isFinite(r)){e.next=17;break}return e.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return e.abrupt("return",Promise.resolve(new Se(t,r)));case 18:return e.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case"end":return e.stop()}}),e,null,[[1,8]])})),o=function(){var e=this,t=arguments;return new Promise((function(r,o){var i=n.apply(e,t);function a(e){Oe(i,r,o,a,u,"next",e)}function u(e){Oe(i,r,o,a,u,"throw",e)}a(void 0)}))},function(e,t){return o.apply(this,arguments)})}],r&&Ee(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Re(e){return Re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Re(e)}function ke(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,De(n.key),n)}}function Le(e,t){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Le(e,t)}function Ce(e){return Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ce(e)}function Te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(r),!0).forEach((function(t){Ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ae(e,t,r){return(t=De(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function De(e){var t=function(e,t){if("object"!==Re(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==Re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Re(t)?t:String(t)}var Fe=qe(qe({},K.defaultOptions),{},{httpStack:new le,fileReader:new je,urlStorage:re?new ne:new J,fingerprint:function(e,t){return pe()?Promise.resolve(function(e,t){var r=e.exif?function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}(JSON.stringify(e.exif)):"noexif";return["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}}),ze=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Le(e,t)}(a,e);var t,r,n,o,i=(n=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Ce(n);if(o){var r=Ce(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===Re(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=qe(qe({},Fe),t),i.call(this,e,t)}return t=a,r=[{key:"terminate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=qe(qe({},Fe),t),K.terminate(e,t)}}],null&&ke(t.prototype,null),r&&ke(t,r),Object.defineProperty(t,"prototype",{writable:!1}),a}(K),He=window,Ie=He.XMLHttpRequest,Ne=He.Blob,Be=(Ie&&Ne&&Ne.prototype.slice,r(4528)),Me=r(6681),Ge=r(7853),Ke=r(1422),Xe=r(9420),$e=r(8284);function Ye(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Je=0;function Qe(e){return"__private_"+Je+++"_"+e}const Ze={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[100,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1},Ve={limit:20,retryDelays:Ze.retryDelays,withCredentials:!1};var We=Qe("retryDelayIterator"),et=Qe("uploadLocalFile"),tt=Qe("getCompanionClientArgs"),rt=Qe("uploadFiles"),nt=Qe("handleUpload");class ot extends n.A{constructor(e,t){var r,n;if(super(e,{...Ve,...t}),Object.defineProperty(this,rt,{value:ut}),Object.defineProperty(this,tt,{value:at}),Object.defineProperty(this,et,{value:it}),Object.defineProperty(this,We,{writable:!0,value:void 0}),Object.defineProperty(this,nt,{writable:!0,value:async e=>{if(0===e.length)return void this.uppy.log("[Tus] No files to upload");0===this.opts.limit&&this.uppy.log("[Tus] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");const t=this.uppy.getFilesByIds(e);await Ye(this,rt)[rt](t)}}),this.type="uploader",this.id=this.opts.id||"Tus",void 0===(null==t?void 0:t.allowedMetaFields)&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");if("autoRetry"in t)throw new Error("The `autoRetry` option was deprecated and has been removed.");this.requests=null!=(r=this.opts.rateLimitedQueue)?r:new Ke.i(this.opts.limit),Ye(this,We)[We]=null==(n=this.opts.retryDelays)?void 0:n.values(),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null),this.handleResetProgress=this.handleResetProgress.bind(this)}handleResetProgress(){const e={...this.uppy.getState().files};Object.keys(e).forEach((t=>{var r;if(null!=(r=e[t])&&null!=(r=r.tus)&&r.uploadUrl){const r={...e[t].tus};delete r.uploadUrl,e[t]={...e[t],tus:r}}})),this.uppy.setState({files:e})}resetUploaderReferences(e,t){const r=this.uploaders[e];r&&(r.abort(),null!=t&&t.abort&&r.abort(!0),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}onReceiveUploadUrl(e,t){const r=this.uppy.getFile(e.id);r&&(r.tus&&r.tus.uploadUrl===t||(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(r.id,{tus:{...r.tus,uploadUrl:t}})))}install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(Ye(this,nt)[nt]),this.uppy.on("reset-progress",this.handleResetProgress)}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(Ye(this,nt)[nt])}}function it(e){var t=this;return this.resetUploaderReferences(e.id),new Promise(((r,n)=>{let o,i,a;const u={...this.opts,...e.tus||{}};"function"==typeof u.headers&&(u.headers=u.headers(e));const{onShouldRetry:s,onBeforeRequest:l,...c}=u,f={...Ze,...c};var p;f.fingerprint=(p=e,(e,t)=>{if("undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova)||"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase())return Fe.fingerprint(e,t);const r=["tus",p.id,t.endpoint].join("-");return Promise.resolve(r)}),f.onBeforeRequest=async t=>{let r;if(t.getUnderlyingObject().withCredentials=!!u.withCredentials,"function"==typeof l&&(r=l(t,e)),(0,Xe.A)(o,"shouldBeRequeued")){if(!o.shouldBeRequeued)return Promise.reject();let t;const n=new Promise((e=>{t=e}));return o=this.requests.run((()=>(e.isPaused&&o.abort(),t(),()=>{}))),void await Promise.all([n,r])}return r},f.onError=t=>{var r;this.uppy.log(t);const i=null!=t.originalRequest?t.originalRequest.getUnderlyingObject():null;(0,Ge.A)(i)&&(t=new Me.A(t,i)),this.resetUploaderReferences(e.id),null==(r=o)||r.abort(),this.uppy.emit("upload-error",e,t),"function"==typeof u.onError&&u.onError(t),n(t)},f.onProgress=(t,r)=>{this.onReceiveUploadUrl(e,a.url),"function"==typeof u.onProgress&&u.onProgress(t,r),this.uppy.emit("upload-progress",this.uppy.getFile(e.id),{uploader:this,bytesUploaded:t,bytesTotal:r})},f.onSuccess=()=>{var t;const n={uploadURL:null!=(t=a.url)?t:void 0,status:200,body:{}};if(this.resetUploaderReferences(e.id),o.done(),this.uppy.emit("upload-success",this.uppy.getFile(e.id),n),a.url){const{name:e}=a.file;this.uppy.log(`Download ${e} from ${a.url}`)}"function"==typeof u.onSuccess&&u.onSuccess(),r(a)};const h=e=>{var t;const r=null==e||null==(t=e.originalResponse)?void 0:t.getStatus();if(429===r){if(!this.requests.isPaused){var n;const e=null==(n=Ye(this,We)[We])?void 0:n.next();if(null==e||e.done)return!1;this.requests.rateLimit(e.value)}}else{if(null!=r&&r>400&&r<500&&409!==r&&423!==r)return!1;"undefined"!=typeof navigator&&!1===navigator.onLine&&(this.requests.isPaused||(this.requests.pause(),window.addEventListener("online",(()=>{this.requests.resume()}),{once:!0})))}return o.abort(),o={shouldBeRequeued:!0,abort(){this.shouldBeRequeued=!1},done(){throw new Error("Cannot mark a queued request as done: this indicates a bug")},fn(){throw new Error("Cannot run a queued request: this indicates a bug")}},!0};f.onShouldRetry=null!=s?(e,t)=>s(e,t,u,h):h;const d=(e,t,r)=>{(0,Xe.A)(e,t)&&!(0,Xe.A)(e,r)&&(e[r]=e[t])},y={};(Array.isArray(u.allowedMetaFields)?u.allowedMetaFields:Object.keys(e.meta)).forEach((t=>{y[t]=String(e.meta[t])})),d(y,"type","filetype"),d(y,"name","filename"),f.metadata=y,a=new ze(e.data,f),this.uploaders[e.id]=a;const v=new Be.A(this.uppy);this.uploaderEvents[e.id]=v,i=()=>(e.isPaused||a.start(),()=>{}),a.findPreviousUploads().then((t=>{const r=t[0];r&&(this.uppy.log(`[Tus] Resuming upload of ${e.id} started at ${r.creationTime}`),a.resumeFromPreviousUpload(r))})),o=this.requests.run(i),v.onFileRemove(e.id,(t=>{o.abort(),this.resetUploaderReferences(e.id,{abort:!!a.url}),r(`upload ${t} was removed`)})),v.onPause(e.id,(e=>{o.abort(),e?a.abort():o=this.requests.run(i)})),v.onPauseAll(e.id,(()=>{o.abort(),a.abort()})),v.onCancelAll(e.id,(function(n){let{reason:i}=void 0===n?{}:n;"user"===i&&(o.abort(),t.resetUploaderReferences(e.id,{abort:!!a.url})),r(`upload ${e.id} was canceled`)})),v.onResumeAll(e.id,(()=>{o.abort(),e.error&&a.abort(),o=this.requests.run(i)}))})).catch((t=>{throw this.uppy.emit("upload-error",e,t),t}))}function at(e){var t;const r={...this.opts};return e.tus&&Object.assign(r,e.tus),{...null==(t=e.remote)?void 0:t.body,endpoint:r.endpoint,uploadUrl:r.uploadUrl,protocol:"tus",size:e.data.size,headers:r.headers,metadata:e.meta}}async function ut(e){const t=(0,$e.Y)(e),r=(0,$e.S)(t);this.uppy.emit("upload-start",r),await Promise.allSettled(t.map((e=>{if(e.isRemote){const t=()=>this.requests,r=new AbortController,n=t=>{t.id===e.id&&r.abort()};this.uppy.on("file-removed",n);const o=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,Ye(this,tt)[tt](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction((()=>{this.uppy.off("file-removed",n)}),{priority:-1})(),o}return Ye(this,et)[et](e)})))}ot.VERSION="3.5.4"},9420:function(e,t,r){function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.d(t,{A:function(){return n}})}}]);
@@ -1 +0,0 @@
1
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_micromag_viewer_build=self.webpackChunk_micromag_viewer_build||[]).push([[784],{5611:function(e){e.exports=s,e.exports.isMobile=s,e.exports.default=s;const t=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/CrOS/,o=/android|ipad|playbook|silk/i;function s(e){e||(e={});let s=e.ua;if(s||"undefined"==typeof navigator||(s=navigator.userAgent),s&&s.headers&&"string"==typeof s.headers["user-agent"]&&(s=s.headers["user-agent"]),"string"!=typeof s)return!1;let r=t.test(s)&&!i.test(s)||!!e.tablet&&o.test(s);return!r&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==s.indexOf("Macintosh")&&-1!==s.indexOf("Safari")&&(r=!0),r}},6784:function(e,t,i){i.r(t),i.d(t,{default:function(){return L}});var o=i(5181),s=i(7496);const r={__proto__:null,"audio/mp3":"mp3","audio/mp4":"mp4","audio/ogg":"ogg","audio/webm":"webm","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/png":"png","image/svg+xml":"svg","video/mp4":"mp4","video/ogg":"ogv","video/quicktime":"mov","video/webm":"webm","video/x-matroska":"mkv","video/x-msvideo":"avi"};function n(e){return[e]=e.split(";",1),r[e]||null}var a=i(7544),c=i(5611);function d(){return(0,o.h)("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55"},(0,o.h)("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z",fillRule:"evenodd"}))}function h(e){let{onSnapshot:t,i18n:i}=e;return(0,o.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:i("takePicture"),"aria-label":i("takePicture"),onClick:t,"data-uppy-super-focusable":!0},d())}function u(e){let{recording:t,onStartRecording:i,onStopRecording:s,i18n:r}=e;return t?(0,o.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:r("stopRecording"),"aria-label":r("stopRecording"),onClick:s,"data-uppy-super-focusable":!0},(0,o.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},(0,o.h)("rect",{x:"15",y:"15",width:"70",height:"70"}))):(0,o.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:r("startRecording"),"aria-label":r("startRecording"),onClick:i,"data-uppy-super-focusable":!0},(0,o.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},(0,o.h)("circle",{cx:"50",cy:"50",r:"40"})))}function p(e){let{recordingLengthSeconds:t,i18n:i}=e;const s=(r=t,`${Math.floor(r/60)}:${String(r%60).padStart(2,"0")}`);var r;return(0,o.h)("span",{"aria-label":i("recordingLength",{recording_length:s})},s)}var l=function(e){let{onSubmit:t,i18n:i}=e;return(0,o.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:i("submitRecordedFile"),"aria-label":i("submitRecordedFile"),onClick:t,"data-uppy-super-focusable":!0},(0,o.h)("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},(0,o.h)("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})))},g=function(e){let{onDiscard:t,i18n:i}=e;return(0,o.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard",type:"button",title:i("discardRecordedFile"),"aria-label":i("discardRecordedFile"),onClick:t,"data-uppy-super-focusable":!0},(0,o.h)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},(0,o.h)("g",{fill:"#FFF",fillRule:"evenodd"},(0,o.h)("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),(0,o.h)("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"}))))};function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},m.apply(this,arguments)}function v(e,t){return e.includes(t)}class b extends o.uA{componentDidMount(){const{onFocus:e}=this.props;e()}componentWillUnmount(){const{onStop:e}=this.props;e()}render(){const{src:e,recordedVideo:t,recording:i,modes:s,supportsRecording:r,videoSources:n,showVideoSourceDropdown:a,showRecordingLength:c,onSubmit:d,i18n:b,mirror:f,onSnapshot:y,onStartRecording:w,onStopRecording:S,onDiscardRecordedVideo:R,recordingLengthSeconds:C}=this.props,k=!!t,P=!k&&r&&(v(s,"video-only")||v(s,"audio-only")||v(s,"video-audio")),M=!k&&v(s,"picture"),I=r&&c&&!k,T=a&&n&&n.length>1,x={playsInline:!0};return t?(x.muted=!1,x.controls=!0,x.src=t,this.videoElement&&(this.videoElement.srcObject=null)):(x.muted=!0,x.autoPlay=!0,x.srcObject=e),(0,o.h)("div",{className:"uppy uppy-Webcam-container"},(0,o.h)("div",{className:"uppy-Webcam-videoContainer"},(0,o.h)("video",m({ref:e=>this.videoElement=e,className:"uppy-Webcam-video "+(f?"uppy-Webcam-video--mirrored":"")},x))),(0,o.h)("div",{className:"uppy-Webcam-footer"},(0,o.h)("div",{className:"uppy-Webcam-videoSourceContainer"},T?function(e){let{currentDeviceId:t,videoSources:i,onChangeVideoSource:s}=e;return(0,o.h)("div",{className:"uppy-Webcam-videoSource"},(0,o.h)("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:e=>{s(e.target.value)}},i.map((e=>(0,o.h)("option",{key:e.deviceId,value:e.deviceId,selected:e.deviceId===t},e.label)))))}(this.props):null),(0,o.h)("div",{className:"uppy-Webcam-buttonContainer"},M&&(0,o.h)(h,{onSnapshot:y,i18n:b}),P&&(0,o.h)(u,{recording:i,onStartRecording:w,onStopRecording:S,i18n:b}),k&&(0,o.h)(l,{onSubmit:d,i18n:b}),k&&(0,o.h)(g,{onDiscard:R,i18n:b})),(0,o.h)("div",{className:"uppy-Webcam-recordingLength"},I&&(0,o.h)(p,{recordingLengthSeconds:C,i18n:b}))))}}var f=b;function y(e){let{icon:t,i18n:i,hasCamera:s}=e;return(0,o.h)("div",{className:"uppy-Webcam-permissons"},(0,o.h)("div",{className:"uppy-Webcam-permissonsIcon"},t()),(0,o.h)("h1",{className:"uppy-Webcam-title"},i(s?"allowAccessTitle":"noCameraTitle")),(0,o.h)("p",null,i(s?"allowAccessDescription":"noCameraDescription")))}var w={strings:{pluginNameCamera:"Camera",noCameraTitle:"Camera Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",recordingLength:"Recording length %{recording_length}",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site."}};function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},S.apply(this,arguments)}function R(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var C=0;function k(e){return"__private_"+C+++"_"+e}function P(e){return"."===e[0]?a.A[e.slice(1)]:e}function M(e){return/^video\/[^*]+$/.test(e)}function I(e){return/^image\/[^*]+$/.test(e)}function T(e,t){return e.includes(t)}const x={onBeforeSnapshot:()=>Promise.resolve(),countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,facingMode:"user",preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1,mobileNativeCamera:c({tablet:!0})};var V=k("enableMirror");class L extends s.A{constructor(e,t){super(e,{...x,...t}),Object.defineProperty(this,V,{writable:!0,value:void 0}),this.mediaDevices=navigator.mediaDevices,this.supportsUserMedia=!!this.mediaDevices,this.protocol=location.protocol.match(/https/i)?"https":"http",this.id=this.opts.id||"Webcam",this.type="acquirer",this.capturedMediaFile=null,this.icon=()=>(0,o.h)("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},(0,o.h)("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383",fillRule:"nonzero"})),this.defaultLocale=w,this.i18nInit(),this.title=this.i18n("pluginNameCamera"),R(this,V)[V]=this.opts.mirror,this.install=this.install.bind(this),this.setPluginState=this.setPluginState.bind(this),this.render=this.render.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.takeSnapshot=this.takeSnapshot.bind(this),this.startRecording=this.startRecording.bind(this),this.stopRecording=this.stopRecording.bind(this),this.discardRecordedVideo=this.discardRecordedVideo.bind(this),this.submit=this.submit.bind(this),this.oneTwoThreeSmile=this.oneTwoThreeSmile.bind(this),this.focus=this.focus.bind(this),this.changeVideoSource=this.changeVideoSource.bind(this),this.webcamActive=!1,this.opts.countdown&&(this.opts.onBeforeSnapshot=this.oneTwoThreeSmile),this.setPluginState({hasCamera:!1,cameraReady:!1,cameraError:null,recordingLengthSeconds:0,videoSources:[],currentDeviceId:null})}setOptions(e){super.setOptions({...e,videoConstraints:{...this.opts.videoConstraints,...null==e?void 0:e.videoConstraints}})}hasCameraCheck(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then((e=>e.some((e=>"videoinput"===e.kind)))):Promise.resolve(!1)}isAudioOnly(){return 1===this.opts.modes.length&&"audio-only"===this.opts.modes[0]}getConstraints(e){void 0===e&&(e=null);const t=-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("audio-only"),i=!this.isAudioOnly()&&(-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("video-only")||-1!==this.opts.modes.indexOf("picture")),o={...this.opts.videoConstraints||{facingMode:this.opts.facingMode},...e?{deviceId:e,facingMode:null}:{}};return{audio:t,video:!!i&&o}}start(e){var t;if(void 0===e&&(e=null),!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&(R(this,V)[V]=!0);const i=this.getConstraints(null==(t=e)?void 0:t.deviceId);this.hasCameraCheck().then((t=>(this.setPluginState({hasCamera:t}),this.mediaDevices.getUserMedia(i).then((t=>{this.stream=t;let i=null;const o=this.isAudioOnly()?t.getAudioTracks():t.getVideoTracks();e&&e.deviceId?o.forEach((t=>{t.getSettings().deviceId===e.deviceId&&(i=t.getSettings().deviceId)})):i=o[0].getSettings().deviceId,this.updateVideoSources(),this.setPluginState({currentDeviceId:i,cameraReady:!0})})).catch((e=>{this.setPluginState({cameraReady:!1,cameraError:e}),this.uppy.info(e.message,"error")})))))}getMediaRecorderOptions(){const e={};if(MediaRecorder.isTypeSupported){const{restrictions:t}=this.uppy.opts;let i=[];this.opts.preferredVideoMimeType?i=[this.opts.preferredVideoMimeType]:t.allowedFileTypes&&(i=t.allowedFileTypes.map(P).filter(M));const o=e=>MediaRecorder.isTypeSupported(e)&&n(e),s=i.filter(o);s.length>0&&(e.mimeType=s[0])}return e}startRecording(){this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];let e=!1;this.recorder.addEventListener("dataavailable",(t=>{this.recordingChunks.push(t.data);const{restrictions:i}=this.uppy.opts;if(this.recordingChunks.length>1&&null!=i.maxFileSize&&!e){const t=this.recordingChunks.reduce(((e,t)=>e+t.size),0),o=(t-this.recordingChunks[0].size)/(this.recordingChunks.length-1)*3;t>Math.max(0,i.maxFileSize-o)&&(e=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.stopRecording())}})),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval((()=>{const e=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:e+1})}),1e3)),this.setPluginState({isRecording:!0})}stopRecording(){return new Promise((e=>{this.recorder.addEventListener("stop",(()=>{e()})),this.recorder.stop(),this.opts.showRecordingLength&&(clearInterval(this.recordingLengthTimer),this.setPluginState({recordingLengthSeconds:0}))})).then((()=>(this.setPluginState({isRecording:!1}),this.getVideo()))).then((e=>{try{this.capturedMediaFile=e,this.setPluginState({recordedVideo:URL.createObjectURL(e.data)}),R(this,V)[V]=!1}catch(e){e.isRestriction||this.uppy.log(e)}})).then((()=>{this.recordingChunks=null,this.recorder=null}),(e=>{throw this.recordingChunks=null,this.recorder=null,e}))}discardRecordedVideo(){this.setPluginState({recordedVideo:null}),this.opts.mirror&&(R(this,V)[V]=!0),this.capturedMediaFile=null}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"error")}}async stop(){if(this.stream){const e=this.stream.getAudioTracks(),t=this.stream.getVideoTracks();e.concat(t).forEach((e=>e.stop()))}this.recorder&&await new Promise((e=>{this.recorder.addEventListener("stop",e,{once:!0}),this.recorder.stop(),this.opts.showRecordingLength&&clearInterval(this.recordingLengthTimer)})),this.recordingChunks=null,this.recorder=null,this.webcamActive=!1,this.stream=null,this.setPluginState({recordedVideo:null,isRecording:!1,recordingLengthSeconds:0})}getVideoElement(){return this.el.querySelector(".uppy-Webcam-video")}oneTwoThreeSmile(){return new Promise(((e,t)=>{let i=this.opts.countdown;const o=setInterval((()=>{if(!this.webcamActive)return clearInterval(o),this.captureInProgress=!1,t(new Error("Webcam is not active"));i?(this.uppy.info(`${i}...`,"warning",800),i--):(clearInterval(o),this.uppy.info(this.i18n("smile"),"success",1500),setTimeout((()=>e()),1500))}),1e3)}))}takeSnapshot(){this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch((e=>{const t="object"==typeof e?e.message:e;return this.uppy.info(t,"error",5e3),Promise.reject(new Error(`onBeforeSnapshot: ${t}`))})).then((()=>this.getImage())).then((e=>{this.captureInProgress=!1;try{this.uppy.addFile(e)}catch(e){e.isRestriction||this.uppy.log(e)}}),(e=>{throw this.captureInProgress=!1,e})))}getImage(){const e=this.getVideoElement();if(!e)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));const t=e.videoWidth,i=e.videoHeight,o=document.createElement("canvas");o.width=t,o.height=i,o.getContext("2d").drawImage(e,0,0);const{restrictions:s}=this.uppy.opts;let r=[];this.opts.preferredImageMimeType?r=[this.opts.preferredImageMimeType]:s.allowedFileTypes&&(r=s.allowedFileTypes.map(P).filter(I));const a=r[0]||"image/jpeg",c=n(a)||"jpg",d=`cam-${Date.now()}.${c}`;return function(e,t,i){return new Promise((i=>{e.toBlob(i,t,undefined)}))}(o,a).then((e=>({source:this.id,name:d,data:new Blob([e],{type:a}),type:a})))}getVideo(){const e=this.recordingChunks.find((e=>{var t;return(null==(t=e.type)?void 0:t.length)>0})).type,t=n(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));const i=`webcam-${Date.now()}.${t}`,o=new Blob(this.recordingChunks,{type:e}),s={source:this.id,name:i,data:new Blob([o],{type:e}),type:e};return Promise.resolve(s)}focus(){this.opts.countdown&&setTimeout((()=>{this.uppy.info(this.i18n("smile"),"success",1500)}),1e3)}changeVideoSource(e){this.stop(),this.start({deviceId:e})}updateVideoSources(){this.mediaDevices.enumerateDevices().then((e=>{this.setPluginState({videoSources:e.filter((e=>"videoinput"===e.kind))})}))}render(){this.webcamActive||this.start();const e=this.getPluginState();return e.cameraReady&&e.hasCamera?(0,o.h)(f,S({},e,{onChangeVideoSource:this.changeVideoSource,onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onDiscardRecordedVideo:this.discardRecordedVideo,onSubmit:this.submit,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:"function"==typeof MediaRecorder&&!!MediaRecorder.prototype&&"function"==typeof MediaRecorder.prototype.start,recording:e.isRecording,mirror:R(this,V)[V],src:this.stream})):(0,o.h)(y,{icon:d,i18n:this.i18n,hasCamera:e.hasCamera})}install(){const{mobileNativeCamera:e,modes:t,facingMode:i,videoConstraints:o}=this.opts,{target:s}=this.opts;var r;e&&s?null==(r=this.getTargetPlugin(s))||r.setOptions({showNativeVideoCameraButton:T(t,"video-only")||T(t,"video-audio"),showNativePhotoCameraButton:T(t,"picture"),nativeCameraFacingMode:(null==o?void 0:o.facingMode)||i}):(this.setPluginState({cameraReady:!1,recordingLengthSeconds:0}),s&&this.mount(s,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=()=>{if(this.updateVideoSources(),this.stream){let e=!0;const{videoSources:t,currentDeviceId:i}=this.getPluginState();t.forEach((t=>{i===t.deviceId&&(e=!1)})),e&&(this.stop(),this.start())}}))}uninstall(){this.stop(),this.unmount()}onUnmount(){this.stop()}}L.VERSION="3.4.0"}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_micromag_viewer_build=self.webpackChunk_micromag_viewer_build||[]).push([[786],{9364:function(t,e,r){t.exports=r(1386)},1386:function(t,e,r){var o=r(3884);e.operation=function(t){var r=e.timeouts(t);return new o(r,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],s=0;s<e.retries;s++)o.push(this.createTimeout(s,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(s,e)),o.sort((function(t,e){return t-e})),o},e.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,o=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return Math.min(o,e.maxTimeout)},e.wrap=function(t,r,o){if(r instanceof Array&&(o=r,r=null),!o)for(var s in o=[],t)"function"==typeof t[s]&&o.push(s);for(var i=0;i<o.length;i++){var n=o[i],a=t[n];t[n]=function(o){var s=e.operation(r),i=Array.prototype.slice.call(arguments,1),n=i.pop();i.push((function(t){s.retry(t)||(t&&(arguments[0]=s.mainError()),n.apply(this,arguments))})),s.attempt((function(){o.apply(t,i)}))}.bind(t,a),t[n].options=r}}},3884:function(t){function e(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1)}var o=this;return this._timer=setTimeout((function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout((function(){o._operationTimeoutCb(o._attempts)}),o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)}),r),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){r._operationTimeoutCb()}),r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},e.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},e.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,r=0,o=0;o<this._errors.length;o++){var s=this._errors[o],i=s.message,n=(t[i]||0)+1;t[i]=n,n>=r&&(e=s,r=n)}return e}},5786:function(t,e,r){"use strict";r.d(e,{Kq:function(){return L},cP:function(){return K},HM:function(){return o}});var o={};r.r(o),r.d(o,{getItem:function(){return D},removeItem:function(){return H},setItem:function(){return J}});class s extends Error{constructor(){super(...arguments),this.name="UserFacingApiError"}}var i=s,n=r(9364);const a=Object.prototype.toString,u=t=>"[object Error]"===a.call(t),p=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated"]);class h extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,({message:t}=t)):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const l=(t,e,r)=>{const o=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t};async function c(t,e){return new Promise(((r,o)=>{e={onFailedAttempt(){},retries:10,shouldRetry:()=>!0,...e};const s=n.operation(e),i=()=>{s.stop(),o(e.signal?.reason)};e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",i,{once:!0});const a=()=>{e.signal?.removeEventListener("abort",i),s.stop()};s.attempt((async i=>{try{const e=await t(i);a(),r(e)}catch(t){try{if(!(t instanceof Error))throw new TypeError(`Non-error was thrown: "${t}". You should only throw errors.`);if(t instanceof h)throw t.originalError;if(t instanceof TypeError&&!function(t){return!(!t||!u(t)||"TypeError"!==t.name||"string"!=typeof t.message)&&("Load failed"===t.message?void 0===t.stack:p.has(t.message))}(t))throw t;if(l(t,i,e),await e.shouldRetry(t)||(s.stop(),o(t)),await e.onFailedAttempt(t),!s.retry(t))throw s.mainError()}catch(t){l(t,i,e),a(),o(t)}}}))}))}var m=r(5945),d=r(8396),f=r(7331)((function(t,e,r){const{progress:o,bytesUploaded:s,bytesTotal:i}=e;o&&(t.uppy.log(`Upload progress: ${o}`),t.uppy.emit("upload-progress",r,{uploader:t,bytesUploaded:s,bytesTotal:i}))}),300,{leading:!0,trailing:!0});class y extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}var g=y;let w;function v(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var b=0;function T(t){return"__private_"+b+++"_"+t}class k extends Error{constructor(t){let{statusCode:e,message:r}=t;super(r),this.name="HttpError",this.statusCode=e}}var _=T("companionHeaders"),E=T("getUrl"),A=T("requestSocketToken"),$=T("awaitRemoteFileUpload");w=Symbol.for("uppy test: getCompanionHeaders");class P{constructor(t,e){Object.defineProperty(this,$,{value:S}),Object.defineProperty(this,E,{value:R}),Object.defineProperty(this,_,{writable:!0,value:void 0}),Object.defineProperty(this,A,{writable:!0,value:async t=>{var e;let{file:r,postBody:o,signal:s}=t;if(null==(null==(e=r.remote)?void 0:e.url))throw new Error("Cannot connect to an undefined URL");return(await this.post(r.remote.url,{...r.remote.body,...o},{signal:s})).token}}),this.uppy=t,this.opts=e,this.onReceiveResponse=this.onReceiveResponse.bind(this),v(this,_)[_]=null==e?void 0:e.companionHeaders}setCompanionHeaders(t){v(this,_)[_]=t}[w](){return v(this,_)[_]}get hostname(){const{companion:t}=this.uppy.getState(),e=this.opts.companionUrl;return(t&&t[e]?t[e]:e).replace(/\/$/,"")}async headers(t){return void 0===t&&(t=!1),{...{Accept:"application/json",...t?void 0:{"Content-Type":"application/json"}},...v(this,_)[_]}}onReceiveResponse(t){const{headers:e}=t,r=this.uppy.getState().companion||{},o=this.opts.companionUrl;e.has("i-am")&&e.get("i-am")!==r[o]&&this.uppy.setState({companion:{...r,[o]:e.get("i-am")}})}async request(t){let{path:e,method:r="GET",data:o,skipPostResponse:s,signal:n}=t;try{const t=await this.headers(!o),a=await(0,m.A)(v(this,E)[E](e),{method:r,signal:n,headers:t,credentials:this.opts.companionCookiesRule||"same-origin",body:o?JSON.stringify(o):null});return s||this.onReceiveResponse(a),await async function(t){if(401===t.status)throw new g;if(t.ok)return t.json();let e,r=`Failed request with status: ${t.status}. ${t.statusText}`;try{e=await t.json(),e.message&&(r=`${r} message: ${e.message}`),e.requestId&&(r=`${r} request-Id: ${e.requestId}`)}catch(t){throw new Error(r,{cause:t})}if(t.status>=400&&t.status<=499&&e.message)throw new i(e.message);throw new k({statusCode:t.status,message:r})}(a)}catch(t){if(t.isAuthError||"UserFacingApiError"===t.name||"AbortError"===t.name)throw t;throw new d.A(`Could not ${r} ${v(this,E)[E](e)}`,{cause:t})}}async get(t,e){return"boolean"==typeof e&&(e={skipPostResponse:e}),this.request({...e,path:t})}async post(t,e,r){return"boolean"==typeof r&&(r={skipPostResponse:r}),this.request({...r,path:t,method:"POST",data:e})}async delete(t,e,r){return"boolean"==typeof r&&(r={skipPostResponse:r}),this.request({...r,path:t,method:"DELETE",data:e})}async uploadRemoteFile(t,e,r){var o=this;try{const{signal:s,getQueue:i}=r||{};return await c((async()=>{var r;const n=null==(r=this.uppy.getFile(t.id))?void 0:r.serverToken;if(null!=n)return this.uppy.log(`Connecting to exiting websocket ${n}`),v(this,$)[$]({file:t,queue:i(),signal:s});const a=i().wrapPromiseFunction((async function(){try{return await v(o,A)[A](...arguments)}catch(t){if(t.isAuthError)throw new h(t);if(null==t.cause)throw t;const e=t.cause,r=()=>[408,409,429,418,423].includes(e.statusCode)||e.statusCode>=500&&e.statusCode<=599&&![501,505].includes(e.statusCode);if("HttpError"===e.name&&!r())throw new h(e);throw e}}),{priority:-1}),u=await a({file:t,postBody:e,signal:s}).abortOn(s);return this.uppy.getFile(t.id)?(this.uppy.setFileState(t.id,{serverToken:u}),v(this,$)[$]({file:this.uppy.getFile(t.id),queue:i(),signal:s})):void 0}),{retries:10,signal:s,onFailedAttempt:t=>this.uppy.log(`Retrying upload due to: ${t.message}`,"warning")})}catch(e){if("AbortError"===e.name)return;throw this.uppy.emit("upload-error",t,e),e}}}function R(t){return/^(https?:|)\/\//.test(t)?t:`${this.hostname}/${t}`}async function S(t){let e,{file:r,queue:o,signal:s}=t;const{capabilities:i}=this.uppy.getState();try{return await new Promise(((t,n)=>{const a=r.serverToken,u=function(t){var e;const r=null==(e=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(t))?void 0:e[1];return`${/^http:\/\//i.test(t)?"ws":"wss"}://${r}`}(r.remote.companionUrl);let p,h,l,{isPaused:m}=r;const d=(t,e)=>{var o;null!=p&&p.readyState===p.OPEN?p.send(JSON.stringify({action:t,payload:null!=e?e:{}})):this.uppy.log(`Cannot send "${t}" to socket ${r.id} because the socket state was ${String(null==(o=p)?void 0:o.readyState)}`,"warning")};function y(){i.resumableUploads&&d(m?"pause":"resume")}const g=async()=>{h&&h.abort(),h=new AbortController;const e=t=>{var e;this.uppy.setFileState(r.id,{serverToken:null}),null==(e=h)||null==e.abort||e.abort(),n(t)};function s(){clearTimeout(l),m||(l=setTimeout((()=>e(new Error("Timeout waiting for message from Companion socket"))),3e5))}try{await o.wrapPromiseFunction((async()=>{await c((async()=>new Promise(((o,i)=>{p=new WebSocket(`${u}/api/${a}`),s(),p.addEventListener("close",(()=>{p=void 0,i(new Error("Socket closed unexpectedly"))})),p.addEventListener("error",(t=>{var e;this.uppy.log(`Companion socket error ${JSON.stringify(t)}, closing socket`,"warning"),null==(e=p)||e.close()})),p.addEventListener("open",(()=>{y()})),p.addEventListener("message",(o=>{s();try{const{action:e,payload:s}=JSON.parse(o.data);switch(e){case"progress":f(this,s,this.uppy.getFile(r.id));break;case"success":{var i,n,a,u;const e=null==(i=s.response)?void 0:i.responseText;this.uppy.emit("upload-success",this.uppy.getFile(r.id),{uploadURL:s.url,status:null!=(n=null==(a=s.response)?void 0:a.status)?n:200,body:e?JSON.parse(e):void 0}),null==(u=h)||null==u.abort||u.abort(),t();break}case"error":{const{message:t}=s.error;throw Object.assign(new Error(t),{cause:s.error})}default:this.uppy.log(`Companion socket unknown action ${e}`,"warning")}}catch(t){e(t)}}));const n=()=>{this.uppy.log(`Closing socket ${r.id}`,"info"),clearTimeout(l),p&&p.close(),p=void 0};h.signal.addEventListener("abort",(()=>{n()}))}))),{retries:10,signal:h.signal,onFailedAttempt:()=>{h.signal.aborted||this.uppy.log(`Retrying websocket ${r.id}`,"info")}})}))().abortOn(h.signal)}catch(t){if(h.signal.aborted)return;e(t)}},w=t=>{var e;i.resumableUploads&&(m=t,p&&y(),t?null==(e=h)||null==e.abort||e.abort():g())},v=e=>{var o;i.individualCancellation&&e.id===r.id&&(d("cancel"),null==(o=h)||null==o.abort||o.abort(),this.uppy.log(`upload ${r.id} was removed`,"info"),t())},b=e=>{var o;let{reason:s}=e;"user"===s&&d("cancel"),null==(o=h)||null==o.abort||o.abort(),this.uppy.log(`upload ${r.id} was canceled`,"info"),t()},T=(t,e)=>{t===r.id&&w(e)},k=()=>w(!0),_=()=>w(!1);this.uppy.on("file-removed",v),this.uppy.on("cancel-all",b),this.uppy.on("upload-pause",T),this.uppy.on("pause-all",k),this.uppy.on("resume-all",_),e=()=>{this.uppy.off("file-removed",v),this.uppy.off("cancel-all",b),this.uppy.off("upload-pause",T),this.uppy.off("pause-all",k),this.uppy.off("resume-all",_)},s.addEventListener("abort",(()=>{var t;null==(t=h)||t.abort()})),g()}))}finally{null==e||e()}}function O(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}P.VERSION="3.8.0";var C=0;function x(t){return"__private_"+C+++"_"+t}function F(t){return"string"==typeof t?new RegExp(`^${t}$`):t instanceof RegExp?t:void 0}var q=x("refreshingTokenPromise"),U=x("getAuthToken"),N=x("getPlugin");class L extends P{constructor(t,e){var r;super(t,e),Object.defineProperty(this,N,{value:I}),Object.defineProperty(this,U,{value:j}),Object.defineProperty(this,q,{writable:!0,value:void 0}),this.provider=e.provider,this.id=this.provider,this.name=this.opts.name||(t=>this.id.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join(" "))(),this.pluginId=this.opts.pluginId,this.tokenKey=`companion-${this.pluginId}-auth-token`,this.companionKeysParams=this.opts.companionKeysParams,this.preAuthToken=null,this.supportsRefreshToken=null==(r=e.supportsRefreshToken)||r}async headers(){const[t,e]=await Promise.all([super.headers(),O(this,U)[U]()]),r={};return e&&(r["uppy-auth-token"]=e),this.companionKeysParams&&(r["uppy-credentials-params"]=btoa(JSON.stringify({params:this.companionKeysParams}))),{...t,...r}}onReceiveResponse(t){super.onReceiveResponse(t);const e=O(this,N)[N](),r=e.getPluginState().authenticated?401!==t.status:t.status<400;return e.setPluginState({authenticated:r}),t}async setAuthToken(t){return O(this,N)[N]().storage.setItem(this.tokenKey,t)}async removeAuthToken(){return O(this,N)[N]().storage.removeItem(this.tokenKey)}async ensurePreAuth(){if(this.companionKeysParams&&!this.preAuthToken&&(await this.fetchPreAuthToken(),!this.preAuthToken))throw new Error("Could not load authentication data required for third-party login. Please try again later.")}authQuery(t){return{}}authUrl(t){let{authFormData:e,query:r}=t;const o=new URLSearchParams({...r,state:btoa(JSON.stringify({origin:location.origin})),...this.authQuery({authFormData:e})});return this.preAuthToken&&o.set("uppyPreAuthToken",this.preAuthToken),`${this.hostname}/${this.id}/connect?${o}`}async loginSimpleAuth(t){let{uppyVersions:e,authFormData:r,signal:o}=t;const s=await this.post(`${this.id}/simple-auth`,{form:r},{qs:{uppyVersions:e},signal:o});this.setAuthToken(s.uppyAuthToken)}async loginOAuth(t){let{uppyVersions:e,authFormData:r,signal:o}=t;return await this.ensurePreAuth(),o.throwIfAborted(),new Promise(((t,s)=>{const i=this.authUrl({query:{uppyVersions:e},authFormData:r}),n=window.open(i,"_blank");let a;const u=e=>{if(e.source!==n){let t="";try{t=JSON.stringify(e.data)}catch(t){}return void this.uppy.log(`ignoring event from unknown source ${t}`,"warning")}const{companionAllowedHosts:r}=O(this,N)[N]().opts;if(o=e.origin,i=r,!(Array.isArray(i)?i.map(F):[F(i)]).some((t=>(null==t?void 0:t.test(o))||(null==t?void 0:t.test(`${o}/`)))))return void s(new Error(`rejecting event from ${e.origin} vs allowed pattern ${r}`));var o,i;const u="string"==typeof e.data?JSON.parse(e.data):e.data;if(u.error){const{uppy:t}=this,e=t.i18n("authAborted");return t.info({message:e},"warning",5e3),void s(new Error("auth aborted"))}u.token?(a(),t(this.setAuthToken(u.token))):s(new Error("did not receive token from auth window"))};a=()=>{null==n||n.close(),window.removeEventListener("message",u),o.removeEventListener("abort",a)},o.addEventListener("abort",a),window.addEventListener("message",u)}))}async login(t){let{uppyVersions:e,authFormData:r,signal:o}=t;return this.loginOAuth({uppyVersions:e,authFormData:r,signal:o})}refreshTokenUrl(){return`${this.hostname}/${this.id}/refresh-token`}fileUrl(t){return`${this.hostname}/${this.id}/get/${t}`}async request(){await O(this,q)[q];try{return await super.request(...arguments)}catch(t){if(!this.supportsRefreshToken)throw t;const e=await O(this,U)[U]();if(!t.isAuthError||!e)throw t;return null==O(this,q)[q]&&(O(this,q)[q]=(async()=>{try{this.uppy.log("[CompanionClient] Refreshing expired auth token","info");const t=await super.request({path:this.refreshTokenUrl(),method:"POST"});await this.setAuthToken(t.uppyAuthToken)}catch(e){throw e.isAuthError&&await this.removeAuthToken(),t}finally{O(this,q)[q]=void 0}})()),await O(this,q)[q],super.request(...arguments)}}async fetchPreAuthToken(){if(this.companionKeysParams)try{const t=await this.post(`${this.id}/preauth/`,{params:this.companionKeysParams});this.preAuthToken=t.token}catch(t){this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${t}`,"warning")}}list(t,e){return this.get(`${this.id}/list/${t||""}`,e)}async logout(t){const e=await this.get(`${this.id}/logout`,t);return await this.removeAuthToken(),e}}async function j(){return O(this,N)[N]().storage.getItem(this.tokenKey)}function I(){const t=this.uppy.getPlugin(this.pluginId);if(null==t)throw new Error("Plugin was nullish");return t}function K(t,e){if(t){if(!("string"==typeof t||Array.isArray(t)||t instanceof RegExp))throw new TypeError('The option "companionAllowedHosts" must be one of string, Array, RegExp');return t}return/^(?!https?:\/\/).*$/i.test(e)?`https://${e.replace(/^\/\//,"")}`:new URL(e).origin}function J(t,e){return new Promise((r=>{localStorage.setItem(t,e),r()}))}function D(t){return Promise.resolve(localStorage.getItem(t))}function H(t){return new Promise((e=>{localStorage.removeItem(t),e()}))}let V,M;r(2162),V=Symbol.for("uppy test: getSocket"),M=Symbol.for("uppy test: getQueued")},8396:function(t,e,r){"use strict";var o=r(9420);class s extends Error{constructor(t,e){super(t),this.cause=null==e?void 0:e.cause,this.cause&&(0,o.A)(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}e.A=s},6681:function(t,e){"use strict";class r extends Error{constructor(t,e){void 0===e&&(e=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=t,this.isNetworkError=!0,this.request=e}}e.A=r},5945:function(t,e,r){"use strict";r.d(e,{A:function(){return s}});var o=r(6681);function s(){return fetch(...arguments).catch((t=>{throw"AbortError"===t.name?t:new o.A(t)}))}},9420:function(t,e,r){"use strict";function o(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.d(e,{A:function(){return o}})}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_micromag_viewer_build=self.webpackChunk_micromag_viewer_build||[]).push([[793],{2534:function(e){"use strict";var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function s(e,t,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||e,o),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,o=new Array(s);r<s;r++)o[r]=n[r].fn;return o},a.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,r,s,o){var a=i?i+e:e;if(!this._events[a])return!1;var l,h,c=this._events[a],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,s),!0;case 6:return c.fn.call(c.context,t,n,r,s,o),!0}for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var p,d=c.length;for(h=0;h<d;h++)switch(c[h].once&&this.removeListener(e,c[h].fn,void 0,!0),u){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,t);break;case 3:c[h].fn.call(c[h].context,t,n);break;case 4:c[h].fn.call(c[h].context,t,n,r);break;default:if(!l)for(p=1,l=new Array(u-1);p<u;p++)l[p-1]=arguments[p];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(e,t,i){return s(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return s(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,n,r){var s=i?i+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||o(this,s);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==t||r&&!a[l].once||n&&a[l].context!==n)&&h.push(a[l]);h.length?this._events[s]=1===h.length?h[0]:h:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a},2162:function(e){e.exports=function(){var e={},t=e._fns={};return e.emit=function(e,i,n,r,s,o,a){var l=function(e){for(var i=t[e]?t[e]:[],n=e.indexOf(":"),r=-1===n?[e]:[e.substring(0,n),e.substring(n+1)],s=Object.keys(t),o=0,a=s.length;o<a;o++){var l=s[o];if("*"===l&&(i=i.concat(t[l])),2===r.length&&r[0]===l){i=i.concat(t[l]);break}}return i}(e);l.length&&function(e,t,i){for(var n=0,r=t.length;n<r&&t[n];n++)t[n].event=e,t[n].apply(t[n],i)}(e,l,[i,n,r,s,o,a])},e.on=function(e,i){t[e]||(t[e]=[]),t[e].push(i)},e.once=function(t,i){this.on(t,(function n(){i.apply(this,arguments),e.off(t,n)}))},e.off=function(e,t){var i=[];if(e&&t)for(var n=this._fns[e],r=0,s=n?n.length:0;r<s;r++)n[r]!==t&&i.push(n[r]);i.length?this._fns[e]=i:delete this._fns[e]},e}},3817:function(e,t,i){"use strict";i.d(t,{J0:function(){return b},Kr:function(){return P},hb:function(){return S},li:function(){return w},vJ:function(){return _}});var n,r,s,o,a=i(5181),l=0,h=[],c=[],u=a.fF,p=u.__b,d=u.__r,f=u.diffed,m=u.__c,g=u.unmount,v=u.__;function y(e,t){u.__h&&u.__h(r,e,l||t),l=0;var i=r.__H||(r.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({__V:c}),i.__[e]}function b(e){return l=1,function(e,t,i){var s=y(n++,2);if(s.t=e,!s.__c&&(s.__=[T(void 0,t),function(e){var t=s.__N?s.__N[0]:s.__[0],i=s.t(t,e);t!==i&&(s.__N=[i,s.__[1]],s.__c.setState({}))}],s.__c=r,!r.u)){var o=function(e,t,i){if(!s.__c.__H)return!0;var n=s.__c.__H.__.filter((function(e){return!!e.__c}));if(n.every((function(e){return!e.__N})))return!a||a.call(this,e,t,i);var r=!1;return n.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(r=!0)}})),!(!r&&s.__c.props===e)&&(!a||a.call(this,e,t,i))};r.u=!0;var a=r.shouldComponentUpdate,l=r.componentWillUpdate;r.componentWillUpdate=function(e,t,i){if(this.__e){var n=a;a=void 0,o(e,t,i),a=n}l&&l.call(this,e,t,i)},r.shouldComponentUpdate=o}return s.__N||s.__}(T,e)}function _(e,t){var i=y(n++,3);!u.__s&&N(i.__H,t)&&(i.__=e,i.i=t,r.__H.__h.push(i))}function w(e){return l=5,P((function(){return{current:e}}),[])}function P(e,t){var i=y(n++,7);return N(i.__H,t)?(i.__V=e(),i.i=t,i.__h=e,i.__V):i.__}function S(e,t){return l=8,P((function(){return e}),t)}function F(){for(var e;e=h.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(I),e.__H.__h.forEach(k),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){r=null,p&&p(e)},u.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),v&&v(e,t)},u.__r=function(e){d&&d(e),n=0;var t=(r=e.__c).__H;t&&(s===r?(t.__h=[],r.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=c,e.__N=e.i=void 0}))):(t.__h.forEach(I),t.__h.forEach(k),t.__h=[],n=0)),s=r},u.diffed=function(e){f&&f(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==h.push(t)&&o===u.requestAnimationFrame||((o=u.requestAnimationFrame)||C)(F)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==c&&(e.__=e.__V),e.i=void 0,e.__V=c}))),s=r=null},u.__c=function(e,t){t.some((function(e){try{e.__h.forEach(I),e.__h=e.__h.filter((function(e){return!e.__||k(e)}))}catch(i){t.some((function(e){e.__h&&(e.__h=[])})),t=[],u.__e(i,e.__v)}})),m&&m(e,t)},u.unmount=function(e){g&&g(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.forEach((function(e){try{I(e)}catch(e){t=e}})),i.__H=void 0,t&&u.__e(t,i.__v))};var x="function"==typeof requestAnimationFrame;function C(e){var t,i=function(){clearTimeout(n),x&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(i,100);x&&(t=requestAnimationFrame(i))}function I(e){var t=r,i=e.__c;"function"==typeof i&&(e.__c=void 0,i()),r=t}function k(e){var t=r;e.__c=e.__(),r=t}function N(e,t){return!e||e.length!==t.length||t.some((function(t,i){return t!==e[i]}))}function T(e,t){return"function"==typeof t?t(e):t}},5144:function(e,t,i){"use strict";i.d(t,{gi:function(){return Te},ZY:function(){return Se}});var n=i(5181),r=i(2534);class s extends Error{constructor(e){super(e),this.name="TimeoutError"}}class o extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const a=e=>void 0===globalThis.DOMException?new o(e):new DOMException(e),l=e=>{const t=void 0===e.reason?a("This operation was aborted."):e.reason;return t instanceof Error?t:a(t)};var h,c=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)};h=new WeakMap;var u,p,d,f,m,g,v,y,b,_,w,P,S,F,x,C,I,k,N,T,E,A,L,B,z,H,O=class{constructor(){h.set(this,[])}enqueue(e,t){const i={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&c(this,h,"f")[this.size-1].priority>=t.priority)return void c(this,h,"f").push(i);const n=function(e,t,i){let n=0,r=e.length;for(;r>0;){const i=Math.trunc(r/2);let o=n+i;s=e[o],t.priority-s.priority<=0?(n=++o,r-=i+1):r=i}var s;return n}(c(this,h,"f"),i);c(this,h,"f").splice(n,0,i)}dequeue(){const e=c(this,h,"f").shift();return null==e?void 0:e.run}filter(e){return c(this,h,"f").filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return c(this,h,"f").length}},M=function(e,t,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,i):r?r.value=i:t.set(e,i),i},D=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)};class R extends Error{}p=new WeakMap,d=new WeakMap,f=new WeakMap,m=new WeakMap,g=new WeakMap,v=new WeakMap,y=new WeakMap,b=new WeakMap,_=new WeakMap,w=new WeakMap,P=new WeakMap,S=new WeakMap,F=new WeakMap,x=new WeakMap,u=new WeakSet,C=function(){return D(this,d,"f")||D(this,f,"f")<D(this,m,"f")},I=function(){return D(this,P,"f")<D(this,S,"f")},k=function(){var e;M(this,P,(e=D(this,P,"f"),--e),"f"),D(this,u,"m",E).call(this),this.emit("next")},N=function(){D(this,u,"m",L).call(this),D(this,u,"m",A).call(this),M(this,b,void 0,"f")},T=function(){const e=Date.now();if(void 0===D(this,y,"f")){const t=D(this,v,"f")-e;if(!(t<0))return void 0===D(this,b,"f")&&M(this,b,setTimeout((()=>{D(this,u,"m",N).call(this)}),t),"f"),!0;M(this,f,D(this,p,"f")?D(this,P,"f"):0,"f")}return!1},E=function(){if(0===D(this,_,"f").size)return D(this,y,"f")&&clearInterval(D(this,y,"f")),M(this,y,void 0,"f"),this.emit("empty"),0===D(this,P,"f")&&this.emit("idle"),!1;if(!D(this,F,"f")){const e=!D(this,u,"a",T);if(D(this,u,"a",C)&&D(this,u,"a",I)){const t=D(this,_,"f").dequeue();return!!t&&(this.emit("active"),t(),e&&D(this,u,"m",A).call(this),!0)}}return!1},A=function(){D(this,d,"f")||void 0!==D(this,y,"f")||(M(this,y,setInterval((()=>{D(this,u,"m",L).call(this)}),D(this,g,"f")),"f"),M(this,v,Date.now()+D(this,g,"f"),"f"))},L=function(){0===D(this,f,"f")&&0===D(this,P,"f")&&D(this,y,"f")&&(clearInterval(D(this,y,"f")),M(this,y,void 0,"f")),M(this,f,D(this,p,"f")?D(this,P,"f"):0,"f"),D(this,u,"m",B).call(this)},B=function(){for(;D(this,u,"m",E).call(this););},z=async function(e){return new Promise(((t,i)=>{e.addEventListener("abort",(()=>{i(new R("The task was aborted."))}),{once:!0})}))},H=async function(e,t){return new Promise((i=>{const n=()=>{t&&!t()||(this.off(e,n),i())};this.on(e,n)}))};var q=class extends r{constructor(e){var t,i,n,r;if(super(),u.add(this),p.set(this,void 0),d.set(this,void 0),f.set(this,0),m.set(this,void 0),g.set(this,void 0),v.set(this,0),y.set(this,void 0),b.set(this,void 0),_.set(this,void 0),w.set(this,void 0),P.set(this,0),S.set(this,void 0),F.set(this,void 0),x.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:O,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(i=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==i?i:""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(r=null===(n=e.interval)||void 0===n?void 0:n.toString())&&void 0!==r?r:""}\` (${typeof e.interval})`);M(this,p,e.carryoverConcurrencyCount,"f"),M(this,d,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,"f"),M(this,m,e.intervalCap,"f"),M(this,g,e.interval,"f"),M(this,_,new e.queueClass,"f"),M(this,w,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,M(this,x,!0===e.throwOnTimeout,"f"),M(this,F,!1===e.autoStart,"f")}get concurrency(){return D(this,S,"f")}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);M(this,S,e,"f"),D(this,u,"m",B).call(this)}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:D(this,x,"f"),...t},new Promise(((i,n)=>{D(this,_,"f").enqueue((async()=>{var r,o,a;M(this,P,(o=D(this,P,"f"),++o),"f"),M(this,f,(a=D(this,f,"f"),++a),"f");try{if(null===(r=t.signal)||void 0===r?void 0:r.aborted)throw new R("The task was aborted.");let n=e({signal:t.signal});t.timeout&&(n=function(e,t,i,n){let r;const o=new Promise(((o,a)=>{if("number"!=typeof t||1!==Math.sign(t))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t!==Number.POSITIVE_INFINITY){if((n={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...n}).signal){const{signal:e}=n;e.aborted&&a(l(e)),e.addEventListener("abort",(()=>{a(l(e))}))}r=n.customTimers.setTimeout.call(void 0,(()=>{const n=i instanceof Error?i:new s(`Promise timed out after ${t} milliseconds`);"function"==typeof e.cancel&&e.cancel(),a(n)}),t),(async()=>{try{o(await e)}catch(e){a(e)}finally{n.customTimers.clearTimeout.call(void 0,r)}})()}else o(e)}));return o.clear=()=>{clearTimeout(r),r=void 0},o}(Promise.resolve(n),t.timeout)),t.signal&&(n=Promise.race([n,D(this,u,"m",z).call(this,t.signal)]));const o=await n;i(o),this.emit("completed",o)}catch(e){if(e instanceof s&&!t.throwOnTimeout)return void i();n(e),this.emit("error",e)}finally{D(this,u,"m",k).call(this)}}),t),this.emit("add"),D(this,u,"m",E).call(this)}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return D(this,F,"f")?(M(this,F,!1,"f"),D(this,u,"m",B).call(this),this):this}pause(){M(this,F,!0,"f")}clear(){M(this,_,new(D(this,w,"f")),"f")}async onEmpty(){0!==D(this,_,"f").size&&await D(this,u,"m",H).call(this,"empty")}async onSizeLessThan(e){D(this,_,"f").size<e||await D(this,u,"m",H).call(this,"next",(()=>D(this,_,"f").size<e))}async onIdle(){0===D(this,P,"f")&&0===D(this,_,"f").size||await D(this,u,"m",H).call(this,"idle")}get size(){return D(this,_,"f").size}sizeBy(e){return D(this,_,"f").filter(e).length}get pending(){return D(this,P,"f")}get isPaused(){return D(this,F,"f")}},$=i(5417),W=i(3817);function j(){return(0,n.h)("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("g",{fill:"none","fill-rule":"evenodd"},(0,n.h)("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),(0,n.h)("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),(0,n.h)("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),(0,n.h)("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),(0,n.h)("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),(0,n.h)("path",{d:"M4 4h18v18H4z"})))}function V(e){let{pluginName:t,i18n:i,onAuth:r}=e;const s="Google Drive"===t,o=(0,W.hb)((e=>{e.preventDefault(),r()}),[r]);return(0,n.h)("form",{onSubmit:o},s?(0,n.h)("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0},(0,n.h)(j,null),i("signInWithGoogle")):(0,n.h)("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0},i("authenticateWith",{pluginName:t})))}const K=e=>{let{pluginName:t,i18n:i,onAuth:r}=e;return(0,n.h)(V,{pluginName:t,i18n:i,onAuth:r})};function U(e){const{loading:t,pluginName:i,pluginIcon:r,i18n:s,handleAuth:o,renderForm:a=K}=e;return(0,n.h)("div",{className:"uppy-Provider-auth"},(0,n.h)("div",{className:"uppy-Provider-authIcon"},r()),(0,n.h)("div",{className:"uppy-Provider-authTitle"},s("authenticateWithTitle",{pluginName:i})),(0,n.h)("div",{className:"uppy-Provider-authForm"},a({pluginName:i,i18n:s,loading:t,onAuth:o})))}function Q(e){let{i18n:t,logout:i,username:r}=e;return(0,n.h)(n.FK,null,(0,n.h)("span",{className:"uppy-ProviderBrowser-user",key:"username"},r),(0,n.h)("button",{type:"button",onClick:i,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",key:"logout"},t("logOut")))}const J=e=>{const{getFolder:t,title:i,isLast:r}=e;return(0,n.h)(n.FK,null,(0,n.h)("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:t},i),r?"":" / ")};function Y(e){const{getFolder:t,title:i,breadcrumbsIcon:r,breadcrumbs:s}=e;return(0,n.h)("div",{className:"uppy-Provider-breadcrumbs"},(0,n.h)("div",{className:"uppy-Provider-breadcrumbsIcon"},r),s.map(((e,r)=>(0,n.h)(J,{key:e.id,getFolder:()=>t(e.requestPath,e.name),title:0===r?i:e.name,isLast:r+1===s.length}))))}function G(e){return(0,n.h)(n.FK,null,e.showBreadcrumbs&&(0,n.h)(Y,{getFolder:e.getFolder,breadcrumbs:e.breadcrumbs,breadcrumbsIcon:e.pluginIcon&&e.pluginIcon(),title:e.title}),(0,n.h)(Q,{logout:e.logout,username:e.username,i18n:e.i18n}))}var X=i(3373),Z=i(6506);function ee(e){return{...e,type:e.mimeType,extension:e.name?(0,Z.A)(e.name).extension:null}}var te=i(4414),ie=i(590);function ne(e){const{search:t,searchOnInput:i,searchTerm:r,showButton:s,inputLabel:o,clearSearchLabel:a,buttonLabel:l,clearSearch:h,inputClassName:c,buttonCSSClassName:u}=e,[p,d]=(0,W.J0)(null!=r?r:""),f=(0,W.hb)((e=>{e.preventDefault(),t(p)}),[t,p]),m=(0,W.hb)((e=>{const n=e.target.value;d(n),i&&t(n)}),[d,i,t]),[g]=(0,W.J0)((()=>{const e=document.createElement("form");return e.setAttribute("tabindex","-1"),e.id=(0,ie.A)(),e}));return(0,W.vJ)((()=>(document.body.appendChild(g),g.addEventListener("submit",f),()=>{g.removeEventListener("submit",f),document.body.removeChild(g)})),[g,f]),(0,n.h)(n.FK,null,(0,n.h)("input",{className:`uppy-u-reset ${c}`,type:"search","aria-label":o,placeholder:o,value:p,onInput:m,form:g.id,"data-uppy-super-focusable":!0}),!s&&(0,n.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12"},(0,n.h)("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})),!s&&p&&(0,n.h)("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":a,title:a,onClick:()=>{d(""),h&&h()}},(0,n.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19"},(0,n.h)("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"}))),s&&(0,n.h)("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${u}`,type:"submit",form:g.id},l))}function re(e){let{cancel:t,done:i,i18n:r,selected:s}=e;return(0,n.h)("div",{className:"uppy-ProviderBrowser-footer"},(0,n.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",onClick:i,type:"button"},r("selectX",{smart_count:s})),(0,n.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:t,type:"button"},r("cancel")))}function se(){return(0,n.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58"},(0,n.h)("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"}))}function oe(){return(0,n.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157"},(0,n.h)("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"}))}function ae(){return(0,n.h)("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58"},(0,n.h)("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),(0,n.h)("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}))}function le(e){const{itemIconString:t}=e;if(null===t)return null;switch(t){case"file":return(0,n.h)(se,null);case"folder":return(0,n.h)(oe,null);case"video":return(0,n.h)(ae,null);default:{const{alt:i}=e;return(0,n.h)("img",{src:t,alt:i,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}}var he=function(e){const{className:t,isDisabled:i,restrictionError:r,isChecked:s,title:o,itemIconEl:a,showTitles:l,toggleCheckbox:h,recordShiftKeyPress:c,id:u,children:p}=e,d=X("uppy-u-reset","uppy-ProviderBrowserItem-checkbox","uppy-ProviderBrowserItem-checkbox--grid",{"uppy-ProviderBrowserItem-checkbox--is-checked":s});return(0,n.h)("li",{className:t,title:i?null==r?void 0:r.message:void 0},(0,n.h)("input",{type:"checkbox",className:d,onChange:h,onKeyDown:c,onMouseDown:c,name:"listitem",id:u,checked:s,disabled:i,"data-uppy-super-focusable":!0}),(0,n.h)("label",{htmlFor:u,"aria-label":o,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},a,l&&o,p))};function ce(e){const{className:t,isDisabled:i,restrictionError:r,isCheckboxDisabled:s,isChecked:o,toggleCheckbox:a,recordShiftKeyPress:l,type:h,id:c,itemIconEl:u,title:p,handleFolderClick:d,showTitles:f,i18n:m}=e;return(0,n.h)("li",{className:t,title:i?null==r?void 0:r.message:void 0},s?null:(0,n.h)("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox "+(o?"uppy-ProviderBrowserItem-checkbox--is-checked":""),onChange:a,onKeyDown:l,onMouseDown:l,name:"listitem",id:c,checked:o,"aria-label":"file"===h?null:m("allFilesFromFolderNamed",{name:p}),disabled:i,"data-uppy-super-focusable":!0}),"file"===h?(0,n.h)("label",{htmlFor:c,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},(0,n.h)("div",{className:"uppy-ProviderBrowserItem-iconWrap"},u),f&&p):(0,n.h)("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:d,"aria-label":m("openFolderNamed",{name:p})},(0,n.h)("div",{className:"uppy-ProviderBrowserItem-iconWrap"},u),f&&(0,n.h)("span",null,p)))}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},ue.apply(this,arguments)}function pe(e){const{author:t,getItemIcon:i,isChecked:r,isDisabled:s,viewType:o}=e,a=i(),l=X("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--selected":r},{"uppy-ProviderBrowserItem--disabled":s},{"uppy-ProviderBrowserItem--noPreview":"video"===a}),h=(0,n.h)(le,{itemIconString:a});switch(o){case"grid":return(0,n.h)(he,ue({},e,{className:l,itemIconEl:h}));case"list":return(0,n.h)(ce,ue({},e,{className:l,itemIconEl:h}));case"unsplash":return(0,n.h)(he,ue({},e,{className:l,itemIconEl:h}),(0,n.h)("a",{href:`${t.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1},t.name));default:throw new Error(`There is no such type ${o}`)}}function de(e){const{currentSelection:t,uppyFiles:i,viewType:n,isChecked:r,toggleCheckbox:s,recordShiftKeyPress:o,showTitles:a,i18n:l,validateRestrictions:h,getNextFolder:c,f:u}=e;if(u.isFolder)return pe({showTitles:a,viewType:n,i18n:l,id:u.id,title:u.name,getItemIcon:()=>u.icon,isChecked:r(u),toggleCheckbox:e=>s(e,u),recordShiftKeyPress:o,type:"folder",isDisabled:!1,isCheckboxDisabled:"shared-with-me"===u.id,handleFolderClick:()=>c(u)});const p=h(ee(u),[...i,...t]);return pe({id:u.id,title:u.name,author:u.author,getItemIcon:()=>u.icon,isChecked:r(u),toggleCheckbox:e=>s(e,u),isCheckboxDisabled:!1,recordShiftKeyPress:o,showTitles:a,viewType:n,i18n:l,type:"file",isDisabled:Boolean(p)&&!r(u),restrictionError:p})}var fe=function(e){const{currentSelection:t,folders:i,files:r,uppyFiles:s,viewType:o,headerComponent:a,showBreadcrumbs:l,isChecked:h,toggleCheckbox:c,recordShiftKeyPress:u,handleScroll:p,showTitles:d,i18n:f,validateRestrictions:m,isLoading:g,showSearchFilter:v,search:y,searchTerm:b,clearSearch:_,searchOnInput:w,searchInputLabel:P,clearSearchLabel:S,getNextFolder:F,cancel:x,done:C,noResultsLabel:I,loadAllFiles:k}=e,N=t.length,T=(0,W.Kr)((()=>[...i,...r]),[i,r]);return(0,n.h)("div",{className:X("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${o}`)},a&&(0,n.h)("div",{className:"uppy-ProviderBrowser-header"},(0,n.h)("div",{className:X("uppy-ProviderBrowser-headerBar",!l&&"uppy-ProviderBrowser-headerBar--simple")},a)),v&&(0,n.h)("div",{class:"uppy-ProviderBrowser-searchFilter"},(0,n.h)(ne,{search:y,searchTerm:b,clearSearch:_,inputLabel:P,clearSearchLabel:S,inputClassName:"uppy-ProviderBrowser-searchFilterInput",searchOnInput:w})),g?(0,n.h)("div",{className:"uppy-Provider-loading"},(0,n.h)("span",null,f("loading"))):i.length||r.length?k?(0,n.h)("div",{className:"uppy-ProviderBrowser-body"},(0,n.h)("ul",{className:"uppy-ProviderBrowser-list"},(0,n.h)(te.A,{data:T,renderRow:e=>(0,n.h)(de,{currentSelection:t,uppyFiles:s,viewType:o,isChecked:h,toggleCheckbox:c,recordShiftKeyPress:u,showTitles:d,i18n:f,validateRestrictions:m,getNextFolder:F,f:e}),rowHeight:31}))):(0,n.h)("div",{className:"uppy-ProviderBrowser-body"},(0,n.h)("ul",{className:"uppy-ProviderBrowser-list",onScroll:p,role:"listbox",tabIndex:-1},T.map((e=>(0,n.h)(de,{currentSelection:t,uppyFiles:s,viewType:o,isChecked:h,toggleCheckbox:c,recordShiftKeyPress:u,showTitles:d,i18n:f,validateRestrictions:m,getNextFolder:F,f:e}))))):(0,n.h)("div",{className:"uppy-Provider-empty"},I),N>0&&(0,n.h)(re,{selected:N,done:C,cancel:x,i18n:f}))};class me extends n.uA{componentWillUnmount(){const{onUnmount:e}=this.props;e()}render(){const{children:e}=this.props;return(0,n.v2)(e)[0]}}var ge=i(7623),ve=i(8311);class ye{constructor(e,t){this.filterItems=e=>{const t=this.plugin.getPluginState();return t.filterInput&&""!==t.filterInput?e.filter((e=>-1!==e.name.toLowerCase().indexOf(t.filterInput.toLowerCase()))):e},this.recordShiftKeyPress=e=>{this.isShiftKeyPressed=e.shiftKey},this.isChecked=e=>{const{currentSelection:t}=this.plugin.getPluginState();return t.some((t=>t.id===e.id))},this.plugin=e,this.provider=t.provider,this.opts=t,this.isHandlingScroll=!1,this.preFirstRender=this.preFirstRender.bind(this),this.handleError=this.handleError.bind(this),this.clearSelection=this.clearSelection.bind(this),this.cancelPicking=this.cancelPicking.bind(this)}preFirstRender(){this.plugin.setPluginState({didFirstRender:!0}),this.plugin.onFirstRender()}shouldHandleScroll(e){const{scrollHeight:t,scrollTop:i,offsetHeight:n}=e.target;return t-(i+n)<50&&!this.isHandlingScroll}clearSelection(){this.plugin.setPluginState({currentSelection:[],filterInput:""})}cancelPicking(){this.clearSelection();const e=this.plugin.uppy.getPlugin("Dashboard");e&&e.hideAllPanels()}handleError(e){var t;const{uppy:i}=this.plugin,n=i.i18n("companionError");i.log(e.toString()),e.isAuthError||"AbortError"===(null==(t=e.cause)?void 0:t.name)||i.info({message:n,details:e.toString()},"error",5e3)}registerRequestClient(){this.requestClientId=this.provider.provider,this.plugin.uppy.registerRequestClient(this.requestClientId,this.provider)}getTagFile(e){const t={id:e.id,source:this.plugin.id,name:e.name||e.id,type:e.mimeType,isRemote:!0,data:e,meta:{},body:{fileId:e.id},remote:{companionUrl:this.plugin.opts.companionUrl,url:`${this.provider.fileUrl(e.requestPath)}`,body:{fileId:e.id},providerName:this.provider.name,provider:this.provider.provider,requestClientId:this.requestClientId}},i=(0,ge.A)(t);return i&&(0,ve.A)(i)&&(t.preview=e.thumbnail),e.author&&(null!=e.author.name&&(t.meta.authorName=String(e.author.name)),e.author.url&&(t.meta.authorUrl=e.author.url)),null!=e.relDirPath&&(t.meta.relativePath=e.relDirPath?`${e.relDirPath}/${t.name}`:null),null!=e.absDirPath&&(t.meta.absolutePath=e.absDirPath?`/${e.absDirPath}/${t.name}`:`/${t.name}`),t}toggleCheckbox(e,t){e.stopPropagation(),e.preventDefault(),e.currentTarget.focus();const{folders:i,files:n}=this.plugin.getPluginState(),r=this.filterItems(i.concat(n));if(this.lastCheckbox&&this.isShiftKeyPressed){const{currentSelection:e}=this.plugin.getPluginState(),i=r.indexOf(this.lastCheckbox),n=r.indexOf(t),s=i<n?r.slice(i,n+1):r.slice(n,i+1),o=[];for(const e of s){const{uppy:t}=this.plugin,i=t.validateRestrictions(ee(e),[...t.getFiles(),...o]);i?t.info({message:i.message},"error",t.opts.infoTimeout):o.push(e)}return void this.plugin.setPluginState({currentSelection:[...new Set([...e,...o])]})}this.lastCheckbox=t;const{currentSelection:s}=this.plugin.getPluginState();this.isChecked(t)?this.plugin.setPluginState({currentSelection:s.filter((e=>e.id!==t.id))}):this.plugin.setPluginState({currentSelection:s.concat([t])})}setLoading(e){this.plugin.setPluginState({loading:e})}}function be(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var _e=0;function we(e){return"__private_"+_e+++"_"+e}function Pe(e,t){return e?`${e}/${t}`:t}function Se(){return(0,n.h)("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30"},(0,n.h)("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"}))}const Fe={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1};var xe=we("abortController"),Ce=we("withAbort"),Ie=we("list"),ke=we("listFilesAndFolders"),Ne=we("recursivelyListAllFiles");class Te extends ye{constructor(e,t){super(e,{...Fe,...t}),Object.defineProperty(this,Ne,{value:Be}),Object.defineProperty(this,ke,{value:Le}),Object.defineProperty(this,Ie,{value:Ae}),Object.defineProperty(this,Ce,{value:Ee}),Object.defineProperty(this,xe,{writable:!0,value:void 0}),this.filterQuery=this.filterQuery.bind(this),this.clearFilter=this.clearFilter.bind(this),this.getFolder=this.getFolder.bind(this),this.getNextFolder=this.getNextFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.plugin.setPluginState({authenticated:void 0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[]}),this.registerRequestClient()}tearDown(){}async getFolder(e,t){this.setLoading(!0);try{await be(this,Ce)[Ce]((async i=>{this.lastCheckbox=void 0;let{breadcrumbs:n}=this.plugin.getPluginState();const r=n.findIndex((t=>e===t.requestPath));n=-1!==r?n.slice(0,r+1):[...n,{requestPath:e,name:t}],this.nextPagePath=e;let s=[],o=[];do{const{files:e,folders:t}=await be(this,ke)[ke]({breadcrumbs:n,signal:i});s=s.concat(e),o=o.concat(t),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:s.length+o.length}))}while(this.opts.loadAllFiles&&this.nextPagePath);this.plugin.setPluginState({folders:o,files:s,breadcrumbs:n,filterInput:""})}))}catch(e){if("UserFacingApiError"===(null==e?void 0:e.name))return void this.plugin.uppy.info({message:this.plugin.uppy.i18n(e.message)},"warning",5e3);this.handleError(e)}finally{this.setLoading(!1)}}getNextFolder(e){this.getFolder(e.requestPath,e.name),this.lastCheckbox=void 0}async logout(){try{await be(this,Ce)[Ce]((async e=>{const t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){const e=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(e,"info",7e3)}const e={authenticated:!1,files:[],folders:[],breadcrumbs:[],filterInput:""};this.plugin.setPluginState(e)}}))}catch(e){this.handleError(e)}}filterQuery(e){this.plugin.setPluginState({filterInput:e})}clearFilter(){this.plugin.setPluginState({filterInput:""})}async handleAuth(e){try{await be(this,Ce)[Ce]((async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),this.preFirstRender()}))}catch(e){if("UserFacingApiError"===e.name)return void this.plugin.uppy.info({message:this.plugin.uppy.i18n(e.message)},"warning",5e3);this.plugin.uppy.log(`login failed: ${e.message}`)}finally{this.setLoading(!1)}}async handleScroll(e){if(this.shouldHandleScroll(e)&&this.nextPagePath){this.isHandlingScroll=!0;try{await be(this,Ce)[Ce]((async e=>{const{files:t,folders:i,breadcrumbs:n}=this.plugin.getPluginState(),{files:r,folders:s}=await be(this,ke)[ke]({breadcrumbs:n,signal:e}),o=t.concat(r),a=i.concat(s);this.plugin.setPluginState({folders:a,files:o})}))}catch(e){this.handleError(e)}finally{this.isHandlingScroll=!1}}}async donePicking(){this.setLoading(!0);try{await be(this,Ce)[Ce]((async e=>{const{currentSelection:t}=this.plugin.getPluginState(),i=[],n=[];for(const r of t){const{requestPath:t}=r,s=e=>({...e,relDirPath:e.absDirPath.replace(r.absDirPath,"").replace(/^\//,"")});if(r.isFolder){let o=!0,a=0;const l=new q({concurrency:6}),h=e=>{for(const t of e){const e=this.getTagFile(t),i=(0,$.N)(e);this.plugin.uppy.checkIfFileAlreadyExists(i)||(n.push(s(t)),a++,this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:a}))),o=!1}};let c;await be(this,Ne)[Ne]({requestPath:t,absDirPath:Pe(r.absDirPath,r.name),relDirPath:r.name,queue:l,onFiles:h,signal:e}),await l.onIdle(),c=o?this.plugin.uppy.i18n("emptyFolderAdded"):0===a?this.plugin.uppy.i18n("folderAlreadyAdded",{folder:r.name}):this.plugin.uppy.i18n("folderAdded",{smart_count:a,folder:r.name}),i.push(c)}else n.push(s(r))}this.plugin.uppy.log("Adding files from a remote provider"),this.plugin.uppy.addFiles(n.map((e=>this.getTagFile(e,this.requestClientId)))),this.plugin.setPluginState({filterInput:""}),i.forEach((e=>this.plugin.uppy.info(e))),this.clearSelection()}))}catch(e){this.handleError(e)}finally{this.setLoading(!1)}}render(e,t){var i=this;void 0===t&&(t={});const{authenticated:r,didFirstRender:s}=this.plugin.getPluginState(),{i18n:o}=this.plugin.uppy;s||this.preFirstRender();const a={...this.opts,...t},{files:l,folders:h,filterInput:c,loading:u,currentSelection:p}=this.plugin.getPluginState(),{isChecked:d,recordShiftKeyPress:f,filterItems:m}=this,g=""!==c,v=this.plugin.icon||Se,y={showBreadcrumbs:a.showBreadcrumbs,getFolder:this.getFolder,breadcrumbs:this.plugin.getPluginState().breadcrumbs,pluginIcon:v,title:this.plugin.title,logout:this.logout,username:this.username,i18n:o},b={isChecked:d,toggleCheckbox:this.toggleCheckbox.bind(this),recordShiftKeyPress:f,currentSelection:p,files:g?m(l):l,folders:g?m(h):h,getNextFolder:this.getNextFolder,getFolder:this.getFolder,loadAllFiles:this.opts.loadAllFiles,showSearchFilter:a.showFilter,search:this.filterQuery,clearSearch:this.clearFilter,searchTerm:c,searchOnInput:!0,searchInputLabel:o("filter"),clearSearchLabel:o("resetFilter"),noResultsLabel:o("noFilesFound"),logout:this.logout,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,headerComponent:(0,n.h)(G,y),title:this.plugin.title,viewType:a.viewType,showTitles:a.showTitles,showBreadcrumbs:a.showBreadcrumbs,pluginIcon:v,i18n:this.plugin.uppy.i18n,uppyFiles:this.plugin.uppy.getFiles(),validateRestrictions:function(){return i.plugin.uppy.validateRestrictions(...arguments)},isLoading:u};return!1===r?(0,n.h)(me,{onUnmount:this.clearSelection},(0,n.h)(U,{pluginName:this.plugin.title,pluginIcon:v,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18nArray,renderForm:this.opts.renderAuthForm,loading:u})):(0,n.h)(me,{onUnmount:this.clearSelection},(0,n.h)(fe,b))}}async function Ee(e){var t;null==(t=be(this,xe)[xe])||t.abort();const i=new AbortController;be(this,xe)[xe]=i;const n=()=>{i.abort(),this.clearSelection()};try{this.plugin.uppy.on("dashboard:close-panel",n),this.plugin.uppy.on("cancel-all",n),await e(i.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",n),this.plugin.uppy.off("cancel-all",n),be(this,xe)[xe]=void 0}}async function Ae(e){let{requestPath:t,absDirPath:i,signal:n}=e;const{username:r,nextPagePath:s,items:o}=await this.provider.list(t,{signal:n});return this.username=r||this.username,{items:o.map((e=>({...e,absDirPath:i}))),nextPagePath:s}}async function Le(e){let{breadcrumbs:t,signal:i}=e;const n=function(e){return e.slice(1).map((e=>e.name)).join("/")}(t),{items:r,nextPagePath:s}=await be(this,Ie)[Ie]({requestPath:this.nextPagePath,absDirPath:n,signal:i});this.nextPagePath=s;const o=[],a=[];return r.forEach((e=>{e.isFolder?a.push(e):o.push(e)})),{files:o,folders:a}}async function Be(e){let{requestPath:t,absDirPath:i,relDirPath:n,queue:r,onFiles:s,signal:o}=e,a=t;for(;a;){const e=await be(this,Ie)[Ie]({requestPath:a,absDirPath:i,signal:o});a=e.nextPagePath;const t=e.items.filter((e=>!e.isFolder)),l=e.items.filter((e=>e.isFolder));s(t);const h=l.map((async e=>r.add((async()=>be(this,Ne)[Ne]({requestPath:e.requestPath,absDirPath:Pe(i,e.name),relDirPath:Pe(n,e.name),queue:r,onFiles:s,signal:o})))));await Promise.all(h)}}function ze(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Te.VERSION="3.11.0";var He=0;function Oe(e){return"__private_"+He+++"_"+e}const Me={isInputMode:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",currentSelection:[],searchTerm:null},De={viewType:"grid",showTitles:!0,showFilter:!0,showBreadcrumbs:!0};var Re=Oe("updateFilesAndInputMode");function qe(e,t){this.nextPageQuery=e.nextPageQuery,e.items.forEach((e=>{t.push(e)})),this.plugin.setPluginState({currentSelection:[],isInputMode:!1,files:t,searchTerm:e.searchedFor})}(class extends ye{constructor(e,t){super(e,{...De,...t}),Object.defineProperty(this,Re,{value:qe}),this.nextPageQuery=null,this.search=this.search.bind(this),this.clearSearch=this.clearSearch.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.plugin.setPluginState(Me),this.registerRequestClient()}tearDown(){}resetPluginState(){this.plugin.setPluginState(Me)}async search(e){const{searchTerm:t}=this.plugin.getPluginState();if(!e||e!==t){this.setLoading(!0);try{const t=await this.provider.search(e);ze(this,Re)[Re](t,[])}catch(e){this.handleError(e)}finally{this.setLoading(!1)}}}clearSearch(){this.plugin.setPluginState({currentSelection:[],files:[],searchTerm:null})}async handleScroll(e){const t=this.nextPageQuery||null;if(this.shouldHandleScroll(e)&&t){this.isHandlingScroll=!0;try{const{files:e,searchTerm:i}=this.plugin.getPluginState(),n=await this.provider.search(i,t);ze(this,Re)[Re](n,e)}catch(e){this.handleError(e)}finally{this.isHandlingScroll=!1}}}donePicking(){const{currentSelection:e}=this.plugin.getPluginState();this.plugin.uppy.log("Adding remote search provider files"),this.plugin.uppy.addFiles(e.map((e=>this.getTagFile(e)))),this.resetPluginState()}render(e,t){var i=this;void 0===t&&(t={});const{didFirstRender:r,isInputMode:s,searchTerm:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy;r||this.preFirstRender();const l={...this.opts,...t},{files:h,folders:c,filterInput:u,loading:p,currentSelection:d}=this.plugin.getPluginState(),{isChecked:f,filterItems:m,recordShiftKeyPress:g}=this,v=""!==u,y={isChecked:f,toggleCheckbox:this.toggleCheckbox.bind(this),recordShiftKeyPress:g,currentSelection:d,files:v?m(h):h,folders:v?m(c):c,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,showSearchFilter:l.showFilter,search:this.search,clearSearch:this.clearSearch,searchTerm:o,searchOnInput:!1,searchInputLabel:a("search"),clearSearchLabel:a("resetSearch"),noResultsLabel:a("noSearchResults"),title:this.plugin.title,viewType:l.viewType,showTitles:l.showTitles,showFilter:l.showFilter,isLoading:p,showBreadcrumbs:l.showBreadcrumbs,pluginIcon:this.plugin.icon,i18n:a,uppyFiles:this.plugin.uppy.getFiles(),validateRestrictions:function(){return i.plugin.uppy.validateRestrictions(...arguments)}};return s?(0,n.h)(me,{onUnmount:this.resetPluginState},(0,n.h)("div",{className:"uppy-SearchProvider"},(0,n.h)(ne,{search:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),inputClassName:"uppy-c-textInput uppy-SearchProvider-input",buttonCSSClassName:"uppy-SearchProvider-searchButton",showButton:!0}))):(0,n.h)(me,{onUnmount:this.resetPluginState},(0,n.h)(fe,y))}}).VERSION="3.11.0"},4414:function(e,t,i){"use strict";var n=i(5181);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},r.apply(this,arguments)}const s={position:"relative",width:"100%",minHeight:"100%"},o={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};class a extends n.uA{constructor(e){super(e),this.handleScroll=()=>{this.setState({offset:this.base.scrollTop})},this.handleResize=()=>{this.resize()},this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement&&this.focusElement.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}resize(){const{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render(e){let{data:t,rowHeight:i,renderRow:a,overscanCount:l=10,...h}=e;const{offset:c,height:u}=this.state;let p=Math.floor(c/i),d=Math.floor(u/i);l&&(p=Math.max(0,p-p%l),d+=l);const f=p+d+4,m=t.slice(p,f),g={...s,height:t.length*i},v={...o,top:p*i};return(0,n.h)("div",r({onScroll:this.handleScroll},h),(0,n.h)("div",{role:"presentation",style:g},(0,n.h)("div",{role:"presentation",style:v},m.map(a))))}}t.A=a},5417:function(e,t,i){"use strict";i.d(t,{N:function(){return s}});var n=i(7623);function r(e){let t="";return e.replace(/[^A-Z0-9]/gi,(e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/")))+t}function s(e){if(function(e){return!(!e.isRemote||!e.remote)&&new Set(["box","dropbox","drive","facebook","unsplash"]).has(e.remote.provider)}(e))return e.id;const t=(0,n.A)(e);return function(e){let t="uppy";return"string"==typeof e.name&&(t+=`-${r(e.name.toLowerCase())}`),void 0!==e.type&&(t+=`-${e.type}`),e.meta&&"string"==typeof e.meta.relativePath&&(t+=`-${r(e.meta.relativePath.toLowerCase())}`),void 0!==e.data.size&&(t+=`-${e.data.size}`),void 0!==e.data.lastModified&&(t+=`-${e.data.lastModified}`),t}({...e,type:t})}},6506:function(e,t,i){"use strict";function n(e){const t=e.lastIndexOf(".");return-1===t||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}}i.d(t,{A:function(){return n}})},7623:function(e,t,i){"use strict";i.d(t,{A:function(){return s}});var n=i(6506),r=i(7544);function s(e){var t;if(e.type)return e.type;const i=e.name?null==(t=(0,n.A)(e.name).extension)?void 0:t.toLowerCase():null;return i&&i in r.A?r.A[i]:"application/octet-stream"}},8311:function(e,t,i){"use strict";function n(e){return!!e&&/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(e)}i.d(t,{A:function(){return n}})},590:function(e,t,i){"use strict";i.d(t,{A:function(){return n}});let n=(e=21)=>{let t="",i=e;for(;i--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}}}]);