@micromag/viewer-build 0.3.446 → 0.3.447

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 (47) hide show
  1. package/build/asset-manifest.json +23 -23
  2. package/build/index.html +1 -1
  3. package/build/static/js/127.62d3ad58.chunk.js +1 -0
  4. package/build/static/js/175.22f3c6d5.chunk.js +1 -0
  5. package/build/static/js/224.a93d4351.chunk.js +1 -0
  6. package/build/static/js/278.7ce2d1fd.chunk.js +1 -0
  7. package/build/static/js/310.232aaeef.chunk.js +1 -0
  8. package/build/static/js/348.2f3ae826.chunk.js +1 -0
  9. package/build/static/js/399.8df2833f.chunk.js +1 -0
  10. package/build/static/js/466.b2545363.chunk.js +1 -0
  11. package/build/static/js/50.8b4607c9.chunk.js +2 -0
  12. package/build/static/js/525.1f6a8715.chunk.js +1 -0
  13. package/build/static/js/536.bf000a63.chunk.js +1 -0
  14. package/build/static/js/610.48218718.js +2 -0
  15. package/build/static/js/{458.754925ee.js.LICENSE.txt → 610.48218718.js.LICENSE.txt} +0 -9
  16. package/build/static/js/645.df9a2aa9.chunk.js +2 -0
  17. package/build/static/js/690.6d43fefc.chunk.js +1 -0
  18. package/build/static/js/838.bf67a5f2.chunk.js +1 -0
  19. package/build/static/js/910.6bdc0d76.chunk.js +1 -0
  20. package/build/static/js/955.2e663733.chunk.js +1 -0
  21. package/build/static/js/969.2db36558.chunk.js +1 -0
  22. package/build/static/js/main.5b0c425d.js +2 -0
  23. package/build/static/js/runtime~main.569a9d1b.js +1 -0
  24. package/package.json +6 -7
  25. package/build/static/js/127.ecee243c.chunk.js +0 -1
  26. package/build/static/js/175.43cc18cc.chunk.js +0 -1
  27. package/build/static/js/224.a7ff47c0.chunk.js +0 -1
  28. package/build/static/js/278.104cc999.chunk.js +0 -1
  29. package/build/static/js/310.57bc752b.chunk.js +0 -1
  30. package/build/static/js/348.46e5aa48.chunk.js +0 -1
  31. package/build/static/js/399.a996319d.chunk.js +0 -1
  32. package/build/static/js/458.754925ee.js +0 -2
  33. package/build/static/js/466.fed09323.chunk.js +0 -1
  34. package/build/static/js/50.30a13049.chunk.js +0 -2
  35. package/build/static/js/525.af68af36.chunk.js +0 -1
  36. package/build/static/js/536.9840925e.chunk.js +0 -1
  37. package/build/static/js/645.00ab18b4.chunk.js +0 -2
  38. package/build/static/js/690.2b6d4b51.chunk.js +0 -1
  39. package/build/static/js/838.bb614050.chunk.js +0 -1
  40. package/build/static/js/910.bde92f36.chunk.js +0 -1
  41. package/build/static/js/955.22d55535.chunk.js +0 -1
  42. package/build/static/js/969.1f600cdd.chunk.js +0 -1
  43. package/build/static/js/main.c218bb22.js +0 -2
  44. package/build/static/js/runtime~main.72b91df2.js +0 -1
  45. /package/build/static/js/{50.30a13049.chunk.js.LICENSE.txt → 50.8b4607c9.chunk.js.LICENSE.txt} +0 -0
  46. /package/build/static/js/{645.00ab18b4.chunk.js.LICENSE.txt → 645.df9a2aa9.chunk.js.LICENSE.txt} +0 -0
  47. /package/build/static/js/{main.c218bb22.js.LICENSE.txt → main.5b0c425d.js.LICENSE.txt} +0 -0
@@ -38,15 +38,6 @@ object-assign
38
38
 
39
39
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
40
40
 
41
- /**
42
- * @license
43
- * Lodash <https://lodash.com/>
44
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
45
- * Released under MIT license <https://lodash.com/license>
46
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
47
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
48
- */
49
-
50
41
  /**
51
42
  * @license React
52
43
  * react-dom.production.min.js
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 645.df9a2aa9.chunk.js.LICENSE.txt */
2
+ (self.webpackChunk_micromag_viewer_build=self.webpackChunk_micromag_viewer_build||[]).push([[645],{8357:function(t,n,e){var r="Expected a function",i=NaN,o="[object Symbol]",s=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,f="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g,p="object"==typeof self&&self&&self.Object===Object&&self,h=f||p||Function("return this")(),g=Object.prototype.toString,d=Math.max,y=Math.min,v=function(){return h.Date.now()};function b(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function m(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&g.call(t)==o}(t))return i;if(b(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=b(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(s,"");var e=a.test(t);return e||c.test(t)?l(t.slice(2),e?2:8):u.test(t)?i:+t}t.exports=function(t,n,e){var i=!0,o=!0;if("function"!=typeof t)throw new TypeError(r);return b(e)&&(i="leading"in e?!!e.leading:i,o="trailing"in e?!!e.trailing:o),function(t,n,e){var i,o,s,u,a,c,l=0,f=!1,p=!1,h=!0;if("function"!=typeof t)throw new TypeError(r);function g(n){var e=i,r=o;return i=o=void 0,l=n,u=t.apply(r,e)}function w(t){var e=t-c;return void 0===c||e>=n||e<0||p&&t-l>=s}function _(){var t=v();if(w(t))return j(t);a=setTimeout(_,function(t){var e=n-(t-c);return p?y(e,s-(t-l)):e}(t))}function j(t){return a=void 0,h&&i?g(t):(i=o=void 0,u)}function O(){var t=v(),e=w(t);if(i=arguments,o=this,c=t,e){if(void 0===a)return function(t){return l=t,a=setTimeout(_,n),f?g(t):u}(c);if(p)return a=setTimeout(_,n),g(c)}return void 0===a&&(a=setTimeout(_,n)),u}return n=m(n)||0,b(e)&&(f=!!e.leading,s=(p="maxWait"in e)?d(m(e.maxWait)||0,n):s,h="trailing"in e?!!e.trailing:h),O.cancel=function(){void 0!==a&&clearTimeout(a),l=0,i=c=o=a=void 0},O.flush=function(){return void 0===a?u:j(v())},O}(t,n,{leading:i,maxWait:n,trailing:o})}},5450:function(t){t.exports=function(){var t={},n=t._fns={};return t.emit=function(t,e,r,i,o,s,u){var a=function(t){for(var e=n[t]?n[t]:[],r=t.indexOf(":"),i=-1===r?[t]:[t.substring(0,r),t.substring(r+1)],o=Object.keys(n),s=0,u=o.length;s<u;s++){var a=o[s];if("*"===a&&(e=e.concat(n[a])),2===i.length&&i[0]===a){e=e.concat(n[a]);break}}return e}(t);a.length&&function(t,n,e){for(var r=0,i=n.length;r<i&&n[r];r++)n[r].event=t,n[r].apply(n[r],e)}(t,a,[e,r,i,o,s,u])},t.on=function(t,e){n[t]||(n[t]=[]),n[t].push(e)},t.once=function(n,e){this.on(n,(function r(){e.apply(this,arguments),t.off(n,r)}))},t.off=function(t,n){var e=[];if(t&&n)for(var r=this._fns[t],i=0,o=r?r.length:0;i<o;i++)r[i]!==n&&e.push(r[i]);e.length?this._fns[t]=e:delete this._fns[t]},t}},1515:function(t,n,e){"use strict";const r=e(8052);t.exports=class{constructor(t,n){void 0===n&&(n={}),this.uppy=t,this.opts=n}getPluginState(){const{plugins:t}=this.uppy.getState();return t[this.id]||{}}setPluginState(t){const{plugins:n}=this.uppy.getState();this.uppy.setState({plugins:{...n,[this.id]:{...n[this.id],...t}}})}setOptions(t){this.opts={...this.opts,...t},this.setPluginState(),this.i18nInit()}i18nInit(){const t=new r([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.setPluginState()}addTarget(){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}render(){throw new Error("Extend the render method to add your plugin to a DOM element")}update(){}afterUpdate(){}}},8052:function(t,n,e){"use strict";function r(t,n){if(!Object.prototype.hasOwnProperty.call(t,n))throw new TypeError("attempted to use private field on non-instance");return t}var i=0;function o(t){return"__private_"+i+++"_"+t}const s=e(8410);function u(t,n,e){const r=[];return t.forEach((t=>"string"!=typeof t?r.push(t):n[Symbol.split](t).forEach(((t,n,i)=>{""!==t&&r.push(t),n<i.length-1&&r.push(e)})))),r}function a(t,n){const e=/\$/g;let r=[t];if(null==n)return r;for(const t of Object.keys(n))if("_"!==t){let i=n[t];"string"==typeof i&&(i=e[Symbol.replace](i,"$$$$")),r=u(r,new RegExp(`%\\{${t}\\}`,"g"),i)}return r}var c=o("apply");function l(t){if(null==t||!t.strings)return;const n=this.locale;this.locale={...n,strings:{...n.strings,...t.strings}},this.locale.pluralize=t.pluralize||n.pluralize}t.exports=class{constructor(t){Object.defineProperty(this,c,{value:l}),this.locale={strings:{},pluralize(t){return 1===t?0:1}},Array.isArray(t)?t.forEach(r(this,c)[c],this):r(this,c)[c](t)}translate(t,n){return this.translateArray(t,n).join("")}translateArray(t,n){if(!s(this.locale.strings,t))throw new Error(`missing string: ${t}`);const e=this.locale.strings[t];if("object"==typeof e){if(n&&void 0!==n.smart_count)return a(e[this.locale.pluralize(n.smart_count)],n);throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}return a(e,n)}}},8410:function(t){"use strict";t.exports=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_micromag_viewer_build=self.webpackChunk_micromag_viewer_build||[]).push([[690],{4690:function(e){const r={pluralize(e){return 1===e?0:1},strings:{addBulkFilesFailed:{0:"L'ajout de %{smart_count} fichier a échoué",1:"L'ajout de %{smart_count} fichiers a échoué"},addMore:"Ajouter d'autres",addMoreFiles:"Ajouter d'autres fichiers",addingMoreFiles:"En train d'ajouter des fichiers",allFilesFromFolderNamed:"Tous les fichiers du dossier %{name}",allowAccessDescription:"Pour prendre des photos ou enregistrer une vidéo avec votre caméra, veuillez autoriser l'accès à votre caméra pour ce site.",allowAccessTitle:"Veuillez autoriser l'accès à votre caméra",authAborted:"Authentification interrompue",authenticateWith:"Se connecter à %{pluginName}",authenticateWithTitle:"Veuillez vous authentifier avec %{pluginName} pour sélectionner les fichiers",back:"Retour",browse:"naviguer",browseFiles:"naviguer",cancel:"Annuler",cancelUpload:"Annuler téléchargement",chooseFiles:"Choisir des fichiers",closeModal:"Fermer Fenêtre",companionError:"Connexion à Companion a échoué",companionUnauthorizeHint:"Pour vous déconnecter de votre compte %{provider}, veuillez aller à %{url}",complete:"Terminé",compressedX:"%{size} économisé(s) par la compression",compressingImages:"Compression des images...",connectedToInternet:"Connecté à Internet",copyLink:"Copier lien",copyLinkToClipboardFallback:"Copier le lien ci-dessous",copyLinkToClipboardSuccess:"Lien copié",creatingAssembly:"Préparation du téléchargement...",creatingAssemblyFailed:"Transloadit: Impossible de créer Assembly",dashboardTitle:"Téléchargeur de fichier",dashboardWindowTitle:"Fenêtre de téléchargeur de fichier (Appuyez sur echap pour fermer)",dataUploadedOfTotal:"%{complete} sur %{total}",done:"Terminé",dropHereOr:"Déposer les fichiers ici ou %{browse}",dropHint:"Déposez vos fichiers ici",dropPasteBoth:"Déposer les fichiers ici, coller ou %{browse}",dropPasteFiles:"Déposer les fichiers ici, coller ou %{browse}",dropPasteFolders:"Déposer les fichiers ici, coller ou %{browse}",dropPasteImportBoth:"Déposer les fichiers ici, coller, %{browse} ou importer de",dropPasteImportFiles:"Déposer les fichiers ici, coller, %{browse} ou importer de",dropPasteImportFolders:"Déposer les fichiers ici, coller, %{browse} ou importer de",editFile:"Modifier le fichier",editFileWithFilename:"Modifier le fichier %{file}",editing:"Modification en cours de %{file}",emptyFolderAdded:"Aucun fichier n'a été ajouté depuis un dossier vide",encoding:"Traitement...",enterCorrectUrl:"Lien incorrect: Assurez-vous que vous entrez un lien direct vers le fichier",enterUrlToImport:"Entrez le lien pour importer un fichier",exceedsSize:"Ce fichier dépasse la taille maximale autorisée de %{size}",failedToFetch:"Companion a échoué à récupérer ce lien, assurez-vous qu'il est correct",failedToUpload:"Le téléchargement de %{file} a échoué",fileSource:"Fichier source: %{name}",filesUploadedOfTotal:{0:"%{complete} sur %{smart_count} fichier téléchargé",1:"%{complete} sur %{smart_count} fichiers téléchargés",2:"%{complete} sur %{smart_count} fichiers téléchargés"},filter:"Filtrer",finishEditingFile:"Terminer l'édition du fichier",folderAdded:{0:"%{smart_count} fichier ajouté de %{folder}",1:"%{smart_count} fichiers ajoutés de %{folder}",2:"%{smart_count} fichiers ajoutés de %{folder}"},generatingThumbnails:"Generating thumbnails...",import:"Importer",importFrom:"Importer de %{name}",loading:"Chargement...",logOut:"Déconnexion",micDisabled:"Accès au micro refusé par l'utilisateur",myDevice:"Mon Appareil",noDuplicates:'Impossible d\'ajouter le fichier "%{fileName}", il existe déjà',noFilesFound:"Vous n'avez aucun fichier ou dossier ici",noInternetConnection:"Pas de connexion à Internet",noMoreFilesAllowed:"Impossible d'ajouter de nouveaux fichiers: en cours de chargement ",openFolderNamed:"Ouvrir %{name}",pause:"Pause",pauseUpload:"Mettre en pause le téléchargement",paused:"En pause",poweredBy:"Propulsé par %{uppy}",processingXFiles:{0:"Traitement de %{smart_count} fichier",1:"Traitement de %{smart_count} fichiers",2:"Traitement de %{smart_count} fichiers"},recording:"Enregistrement",recordingLength:"Durée d'enregistrement %{recording_length}",recordingStoppedMaxSize:"L'enregistrement s'est arrété car la taille du fichier dépasse la limite",removeFile:"Effacer le fichier %{file}",resetFilter:"Réinitialiser filtre",resume:"Reprendre",resumeUpload:"Reprendre le téléchargement",retry:"Réessayer",retryUpload:"Réessayer le téléchargement",save:"Sauvegarder",saveChanges:"Sauvegarder les modifications",selectFileNamed:"Sélectionner le fichier %{name}",selectX:{0:"Sélectionner %{smart_count}",1:"Sélectionner %{smart_count}",2:"Sélectionner %{smart_count}"},smile:"Souriez !",startRecording:"Commencer l'enregistrement vidéo",stopRecording:"Arrêter l'enregistrement vidéo",streamActive:"Stream actif",streamPassive:"Stream passif",submitRecordedFile:"Envoyer la vidéo enregistrée",takePicture:"Prendre une photo",timedOut:"Téléchargement bloqué durant %{seconds} secondes, annulation.",unselectFileNamed:"Désélectionner le fichier %{name}",upload:"Télécharger",uploadComplete:"Téléchargement terminé",uploadFailed:"Le téléchargement a échoué",uploadPaused:"Téléchargement mis en pause",uploadXFiles:{0:"Télécharger %{smart_count} fichier",1:"Télécharger %{smart_count} fichiers",2:"Télécharger %{smart_count} fichiers"},uploadXNewFiles:{0:"Télécharger +%{smart_count} fichier",1:"Télécharger +%{smart_count} fichiers",2:"Télécharger +%{smart_count} fichiers"},uploading:"Téléchargement en cours",uploadingXFiles:{0:"Téléchargement de %{smart_count} fichier",1:"Téléchargement de %{smart_count} fichiers",2:"Téléchargement de %{smart_count} fichiers"},xFilesSelected:{0:"%{smart_count} fichier sélectionné",1:"%{smart_count} fichiers sélectionnés",2:"%{smart_count} fichiers sélectionnés"},xMoreFilesAdded:{0:"%{smart_count} autre fichier ajouté",1:"%{smart_count} autres fichiers ajoutés",2:"%{smart_count} autres fichiers ajoutés"},xTimeLeft:"%{time} restantes",youCanOnlyUploadFileTypes:"Vous pouvez seulement télécharger: %{types}",youCanOnlyUploadX:{0:"Vous pouvez seulement télécharger %{smart_count} fichier",1:"Vous pouvez seulement télécharger %{smart_count} fichiers",2:"Vous pouvez seulement télécharger %{smart_count} fichiers"},youHaveToAtLeastSelectX:{0:"Vous devez sélectionner au moins %{smart_count} fichier",1:"Vous devez sélectionner au moins %{smart_count} fichiers",2:"Vous devez sélectionner au moins %{smart_count} fichiers"}}};"undefined"!=typeof Uppy&&(globalThis.Uppy.locales.fr_FR=r),e.exports=r}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_micromag_viewer_build=self.webpackChunk_micromag_viewer_build||[]).push([[838],{886:function(e){class t extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}e.exports=t},1415:function(e,t,i){var r=i(8816);const s=i(167);e.exports=class extends s{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||this.id.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" "),this.pluginId=this.opts.pluginId,this.tokenKey=`companion-${this.pluginId}-auth-token`,this.companionKeysParams=this.opts.companionKeysParams,this.preAuthToken=null}headers(){return Promise.all([super.headers(),this.getAuthToken()]).then((e=>{let[t,i]=e;const r={};return i&&(r["uppy-auth-token"]=i),this.companionKeysParams&&(r["uppy-credentials-params"]=btoa(JSON.stringify({params:this.companionKeysParams}))),{...t,...r}}))}onReceiveResponse(e){e=super.onReceiveResponse(e);const t=this.uppy.getPlugin(this.pluginId),i=t.getPluginState().authenticated?401!==e.status:e.status<400;return t.setPluginState({authenticated:i}),e}setAuthToken(e){return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey,e)}getAuthToken(){return this.uppy.getPlugin(this.pluginId).storage.getItem(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.")}authUrl(e){void 0===e&&(e={});const t=new URLSearchParams(e);return this.preAuthToken&&t.set("uppyPreAuthToken",this.preAuthToken),`${this.hostname}/${this.id}/connect?${t}`}fileUrl(e){return`${this.hostname}/${this.id}/get/${e}`}async fetchPreAuthToken(){if(this.companionKeysParams)try{const e=await this.post(`${this.id}/preauth/`,{params:this.companionKeysParams});this.preAuthToken=e.token}catch(e){this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${e}`,"warning")}}list(e){return this.get(`${this.id}/list/${e||""}`)}logout(){return this.get(`${this.id}/logout`).then((e=>Promise.all([e,this.uppy.getPlugin(this.pluginId).storage.removeItem(this.tokenKey)]))).then((e=>{let[t]=e;return t}))}static initPlugin(e,t,i){if(e.type="acquirer",e.files=[],i&&(e.opts={...i,...t}),t.serverUrl||t.serverPattern)throw new Error("`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`");if(t.companionAllowedHosts){const i=t.companionAllowedHosts;if(!("string"==typeof i||Array.isArray(i)||i instanceof RegExp))throw new TypeError(`${e.id}: the option "companionAllowedHosts" must be one of string, Array, RegExp`);e.opts.companionAllowedHosts=i}else/^(?!https?:\/\/).*$/i.test(t.companionUrl)?e.opts.companionAllowedHosts=`https://${t.companionUrl.replace(/^\/\//,"")}`:e.opts.companionAllowedHosts=new URL(t.companionUrl).origin;e.storage=e.opts.storage||r}}},167:function(e,t,i){let r;function s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var n=0;function o(e){return"__private_"+n+++"_"+e}const l=i(9286),a=i(3411),h=i(886);async function c(e){if(401===e.status)throw new h;const t=e.json();if(e.status<200||e.status>300){let i=`Failed request with status: ${e.status}. ${e.statusText}`;try{const e=await t;i=e.message?`${i} message: ${e.message}`:i,i=e.requestId?`${i} request-Id: ${e.requestId}`:i}finally{throw new Error(i)}}return t}var u=o("companionHeaders"),p=o("getPostResponseFunc"),d=o("getUrl"),g=o("errorHandler");r=Symbol.for("uppy test: getCompanionHeaders");class m{constructor(e,t){Object.defineProperty(this,g,{value:f}),Object.defineProperty(this,d,{value:y}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:e=>t=>e?t:this.onReceiveResponse(t)}),this.uppy=e,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),this.allowedHeaders=["accept","content-type","uppy-auth-token"],this.preflightDone=!1,s(this,u)[u]=null==t?void 0:t.companionHeaders}setCompanionHeaders(e){s(this,u)[u]=e}[r](){return s(this,u)[u]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return(e&&e[t]?e[t]:t).replace(/\/$/,"")}headers(){return Promise.resolve({...m.defaultHeaders,...s(this,u)[u]})}onReceiveResponse(e){const t=this.uppy.getState().companion||{},i=this.opts.companionUrl,{headers:r}=e;return r.has("i-am")&&r.get("i-am")!==t[i]&&this.uppy.setState({companion:{...t,[i]:r.get("i-am")}}),e}preflight(e){return this.preflightDone?Promise.resolve(this.allowedHeaders.slice()):fetch(s(this,d)[d](e),{method:"OPTIONS"}).then((e=>(e.headers.has("access-control-allow-headers")&&(this.allowedHeaders=e.headers.get("access-control-allow-headers").split(",").map((e=>e.trim().toLowerCase()))),this.preflightDone=!0,this.allowedHeaders.slice()))).catch((e=>(this.uppy.log(`[CompanionClient] unable to make preflight request ${e}`,"warning"),this.preflightDone=!0,this.allowedHeaders.slice())))}preflightAndHeaders(e){return Promise.all([this.preflight(e),this.headers()]).then((e=>{let[t,i]=e;return Object.keys(i).forEach((e=>{t.includes(e.toLowerCase())||(this.uppy.log(`[CompanionClient] excluding disallowed header ${e}`),delete i[e])})),i}))}get(e,t){return this.preflightAndHeaders(e).then((t=>l(s(this,d)[d](e),{method:"get",headers:t,credentials:this.opts.companionCookiesRule||"same-origin"}))).then(s(this,p)[p](t)).then(c).catch(s(this,g)[g]("get",e))}post(e,t,i){const r="post";return this.preflightAndHeaders(e).then((i=>l(s(this,d)[d](e),{method:r,headers:i,credentials:this.opts.companionCookiesRule||"same-origin",body:JSON.stringify(t)}))).then(s(this,p)[p](i)).then(c).catch(s(this,g)[g](r,e))}delete(e,t,i){const r="delete";return this.preflightAndHeaders(e).then((i=>l(`${this.hostname}/${e}`,{method:r,headers:i,credentials:this.opts.companionCookiesRule||"same-origin",body:t?JSON.stringify(t):null}))).then(s(this,p)[p](i)).then(c).catch(s(this,g)[g](r,e))}}function y(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}function f(e,t){return i=>{var r;return null!=(r=i)&&r.isAuthError||(i=new a(`Could not ${e} ${s(this,d)[d](t)}`,{cause:i})),Promise.reject(i)}}m.VERSION="2.2.2",m.defaultHeaders={Accept:"application/json","Content-Type":"application/json","Uppy-Versions":`@uppy/companion-client=${m.VERSION}`},e.exports=m},7655:function(e,t,i){const r=i(167);e.exports=class extends r{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||this.id.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" "),this.pluginId=this.opts.pluginId}fileUrl(e){return`${this.hostname}/search/${this.id}/get/${e}`}search(e,t){return this.get(`search/${this.id}/list?q=${encodeURIComponent(e)}${t?`&${t}`:""}`)}}},2797:function(e,t,i){let r,s;function n(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var o=0;function l(e){return"__private_"+o+++"_"+e}const a=i(5450);var h=l("queued"),c=l("emitter"),u=l("isOpen"),p=l("socket"),d=l("handleMessage");r=Symbol.for("uppy test: getSocket"),s=Symbol.for("uppy test: getQueued"),e.exports=class{constructor(e){Object.defineProperty(this,h,{writable:!0,value:[]}),Object.defineProperty(this,c,{writable:!0,value:a()}),Object.defineProperty(this,u,{writable:!0,value:!1}),Object.defineProperty(this,p,{writable:!0,value:void 0}),Object.defineProperty(this,d,{writable:!0,value:e=>{try{const t=JSON.parse(e.data);this.emit(t.action,t.payload)}catch(e){console.log(e)}}}),this.opts=e,e&&!1===e.autoOpen||this.open()}get isOpen(){return n(this,u)[u]}[r](){return n(this,p)[p]}[s](){return n(this,h)[h]}open(){n(this,p)[p]=new WebSocket(this.opts.target),n(this,p)[p].onopen=()=>{for(n(this,u)[u]=!0;n(this,h)[h].length>0&&n(this,u)[u];){const e=n(this,h)[h].shift();this.send(e.action,e.payload)}},n(this,p)[p].onclose=()=>{n(this,u)[u]=!1},n(this,p)[p].onmessage=n(this,d)[d]}close(){var e;null==(e=n(this,p)[p])||e.close()}send(e,t){n(this,u)[u]?n(this,p)[p].send(JSON.stringify({action:e,payload:t})):n(this,h)[h].push({action:e,payload:t})}on(e,t){n(this,c)[c].on(e,t)}emit(e,t){n(this,c)[c].emit(e,t)}once(e,t){n(this,c)[c].once(e,t)}}},8729:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Socket=t.SearchProvider=t.RequestClient=t.Provider=void 0;const r=i(167);t.RequestClient=r;const s=i(1415);t.Provider=s;const n=i(7655);t.SearchProvider=n;const o=i(2797);t.Socket=o},8816:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getItem=function(e){return Promise.resolve(localStorage.getItem(e))},t.removeItem=function(e){return new Promise((t=>{localStorage.removeItem(e),t()}))},t.setItem=function(e,t){return new Promise((i=>{localStorage.setItem(e,t),i()}))}},2146:function(e,t,i){var r=i(3847);const s=e=>{const{getFolder:t,title:i,isLast:s}=e;return(0,r.h)(r.Fragment,null,(0,r.h)("button",{type:"button",className:"uppy-u-reset",onClick:t},i),s?"":" / ")};e.exports=e=>{const{getFolder:t,title:i,breadcrumbsIcon:n,directories:o}=e;return(0,r.h)("div",{className:"uppy-Provider-breadcrumbs"},(0,r.h)("div",{className:"uppy-Provider-breadcrumbsIcon"},n),o.map(((e,n)=>(0,r.h)(s,{key:e.id,getFolder:()=>t(e.id),title:0===n?i:e.title,isLast:n+1===o.length}))))}},3762:function(e,t,i){var r=i(3847);const s=i(2779),n=i(8027),o=i(2282),l=i(8736),a=i(4195);e.exports=function(e){const{currentSelection:t,folders:i,files:h,uppyFiles:c,viewType:u,headerComponent:p,showBreadcrumbs:d,isChecked:g,toggleCheckbox:m,recordShiftKeyPress:y,handleScroll:f,showTitles:v,i18n:P,validateRestrictions:w,showFilter:b,filterQuery:S,filterInput:k,getNextFolder:I,cancel:x,done:F,columns:C}=e,N=t.length;return(0,r.h)("div",{className:s("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${u}`)},(0,r.h)("div",{className:"uppy-ProviderBrowser-header"},(0,r.h)("div",{className:s("uppy-ProviderBrowser-headerBar",!d&&"uppy-ProviderBrowser-headerBar--simple")},p)),b&&(0,r.h)(o,{i18n:P,filterQuery:S,filterInput:k}),i.length||h.length?(0,r.h)("div",{className:"uppy-ProviderBrowser-body"},(0,r.h)("ul",{className:"uppy-ProviderBrowser-list",onScroll:f,role:"listbox",tabIndex:"-1"},i.map((e=>{var t;return a({columns:C,showTitles:v,viewType:u,i18n:P,id:e.id,title:e.name,getItemIcon:()=>e.icon,isChecked:g(e),toggleCheckbox:t=>m(t,e),recordShiftKeyPress:y,type:"folder",isDisabled:null==(t=g(e))?void 0:t.loading,isCheckboxDisabled:"shared-with-me"===e.id,handleFolderClick:()=>I(e)})})),h.map((e=>{const i=w(n(e),[...c,...t]);return a({id:e.id,title:e.name,author:e.author,getItemIcon:()=>e.icon,isChecked:g(e),toggleCheckbox:t=>m(t,e),recordShiftKeyPress:y,columns:C,showTitles:v,viewType:u,i18n:P,type:"file",isDisabled:!i.result&&!g(e),restrictionReason:i.reason})})))):(0,r.h)("div",{className:"uppy-Provider-empty"},P("noFilesFound")),N>0&&(0,r.h)(l,{selected:N,done:F,cancel:x,i18n:P}))}},7194:function(e,t,i){var r=i(3847);class s extends r.Component{componentWillUnmount(){const{onUnmount:e}=this.props;e()}render(){const{children:e}=this.props;return(0,r.toChildArray)(e)[0]}}e.exports=s},2282:function(e,t,i){var r=i(3847);class s extends r.Component{constructor(e){super(e),this.preventEnterPress=this.preventEnterPress.bind(this)}preventEnterPress(e){13===e.keyCode&&(e.stopPropagation(),e.preventDefault())}render(){const{i18n:e,filterInput:t,filterQuery:i}=this.props;return(0,r.h)("div",{className:"uppy-ProviderBrowser-filter"},(0,r.h)("input",{className:"uppy-u-reset uppy-ProviderBrowser-filterInput",type:"text",placeholder:e("filter"),"aria-label":e("filter"),onKeyUp:this.preventEnterPress,onKeyDown:this.preventEnterPress,onKeyPress:this.preventEnterPress,onInput:e=>i(e),value:t}),(0,r.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-filterIcon",width:"12",height:"12",viewBox:"0 0 12 12"},(0,r.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"})),t&&(0,r.h)("button",{className:"uppy-u-reset uppy-ProviderBrowser-filterClose",type:"button","aria-label":e("resetFilter"),title:e("resetFilter"),onClick:i},(0,r.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19"},(0,r.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"}))))}}e.exports=s},8736:function(e,t,i){var r=i(3847);e.exports=e=>{let{cancel:t,done:i,i18n:s,selected:n}=e;return(0,r.h)("div",{className:"uppy-ProviderBrowser-footer"},(0,r.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",onClick:i,type:"button"},s("selectX",{smart_count:n})),(0,r.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:t,type:"button"},s("cancel")))}},9492:function(e,t,i){var r=i(3847);e.exports=function(e){const{className:t,isDisabled:i,restrictionReason:s,isChecked:n,title:o,itemIconEl:l,showTitles:a,toggleCheckbox:h,recordShiftKeyPress:c,id:u,children:p}=e;return(0,r.h)("li",{className:t,title:i?s:null},(0,r.h)("input",{type:"checkbox",className:`uppy-u-reset uppy-ProviderBrowserItem-checkbox ${n?"uppy-ProviderBrowserItem-checkbox--is-checked":""} uppy-ProviderBrowserItem-checkbox--grid`,onChange:h,onKeyDown:c,name:"listitem",id:u,checked:n,disabled:i,"data-uppy-super-focusable":!0}),(0,r.h)("label",{htmlFor:u,"aria-label":o,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},(0,r.h)("span",{className:"uppy-ProviderBrowserItem-inner-relative"},l,a&&o,p)))}},6087:function(e,t,i){var r=i(3847);function s(){return(0,r.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58"},(0,r.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 n(){return(0,r.h)("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157"},(0,r.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 o(){return(0,r.h)("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58"},(0,r.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,r.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"}))}e.exports=e=>{const{itemIconString:t}=e;if(null!==t)switch(t){case"file":return(0,r.h)(s,null);case"folder":return(0,r.h)(n,null);case"video":return(0,r.h)(o,null);default:{const{alt:i}=e;return(0,r.h)("img",{src:t,alt:i})}}}},3274:function(e,t,i){var r=i(3847);e.exports=function(e){const{className:t,isDisabled:i,restrictionReason:s,isCheckboxDisabled:n,isChecked:o,toggleCheckbox:l,recordShiftKeyPress:a,type:h,id:c,itemIconEl:u,title:p,handleFolderClick:d,showTitles:g,i18n:m}=e;return(0,r.h)("li",{className:t,title:i?s:null},n?null:(0,r.h)("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox "+(o?"uppy-ProviderBrowserItem-checkbox--is-checked":""),onChange:l,onKeyDown:a,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,r.h)("label",{htmlFor:c,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},(0,r.h)("div",{className:"uppy-ProviderBrowserItem-iconWrap"},u),g&&p):(0,r.h)("button",{type:"button",className:"uppy-u-reset uppy-ProviderBrowserItem-inner",onClick:d,"aria-label":m("openFolderNamed",{name:p})},(0,r.h)("div",{className:"uppy-ProviderBrowserItem-iconWrap"},u),g&&(0,r.h)("span",null,p)))}},4195:function(e,t,i){var r=i(3847);function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},s.apply(this,arguments)}const n=i(2779),o=i(6087),l=i(9492),a=i(3274);e.exports=e=>{const{author:t,getItemIcon:i,isChecked:h,isDisabled:c,viewType:u}=e,p=i(),d=n("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--selected":h},{"uppy-ProviderBrowserItem--disabled":c},{"uppy-ProviderBrowserItem--noPreview":"video"===p}),g=(0,r.h)(o,{itemIconString:p});switch(u){case"grid":return(0,r.h)(l,s({},e,{className:d,itemIconEl:g}));case"list":return(0,r.h)(a,s({},e,{className:d,itemIconEl:g}));case"unsplash":return(0,r.h)(l,s({},e,{className:d,itemIconEl:g}),(0,r.h)("a",{href:`${t.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author"},t.name));default:throw new Error(`There is no such type ${u}`)}}},5657:function(e,t,i){var r=i(3847);e.exports=e=>{let{i18n:t}=e;return(0,r.h)("div",{className:"uppy-Provider-loading"},(0,r.h)("span",null,t("loading")))}},6137:function(e,t,i){var r=i(3847);function s(){return(0,r.h)("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("g",{fill:"none","fill-rule":"evenodd"},(0,r.h)("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),(0,r.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,r.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,r.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,r.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,r.h)("path",{d:"M4 4h18v18H4z"})))}e.exports=function(e){const{pluginName:t,pluginIcon:i,i18nArray:n,handleAuth:o}=e,l="Google Drive"===t,a=(0,r.h)("span",{className:"uppy-Provider-authTitleName"},t,(0,r.h)("br",null));return(0,r.h)("div",{className:"uppy-Provider-auth"},(0,r.h)("div",{className:"uppy-Provider-authIcon"},i()),(0,r.h)("div",{className:"uppy-Provider-authTitle"},n("authenticateWithTitle",{pluginName:a})),l?(0,r.h)("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google",onClick:o,"data-uppy-super-focusable":!0},(0,r.h)(s,null),n("signInWithGoogle")):(0,r.h)("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn",onClick:o,"data-uppy-super-focusable":!0},n("authenticateWith",{pluginName:t})))}},9986:function(e,t,i){const r=i(4312),s=i(2146);e.exports=e=>{const t=[];return e.showBreadcrumbs&&t.push(s({getFolder:e.getFolder,directories:e.directories,breadcrumbsIcon:e.pluginIcon&&e.pluginIcon(),title:e.title})),t.push(r({logout:e.logout,username:e.username,i18n:e.i18n})),t}},4291:function(e,t,i){var r=i(3847);function s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var n=0;function o(e){return"__private_"+n+++"_"+e}const l=i(6137),a=i(9986),h=i(3762),c=i(5657),u=i(7194),p=i(2791);function d(e){return"string"==typeof e?new RegExp(`^${e}$`):e instanceof RegExp?e:void 0}var g=o("updateFilesAndFolders");class m extends p{constructor(e,t){super(e,t),Object.defineProperty(this,g,{value:y}),this.opts={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,...t},this.filterQuery=this.filterQuery.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.listAllFiles=this.listAllFiles.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.plugin.setPluginState({authenticated:!1,files:[],folders:[],directories:[],filterInput:"",isSearchVisible:!1,currentSelection:[]})}tearDown(){}getFolder(e,t){return this.sharedHandler.loaderWrapper(this.provider.list(e),(i=>{let r;const n=this.plugin.getPluginState(),o=n.directories.findIndex((t=>e===t.id));r=-1!==o?n.directories.slice(0,o+1):n.directories.concat([{id:e,title:t}]),this.username=i.username||this.username,s(this,g)[g](i,[],[]),this.plugin.setPluginState({directories:r})}),this.handleError)}getNextFolder(e){this.getFolder(e.requestPath,e.name),this.lastCheckbox=void 0}logout(){this.provider.logout().then((e=>{if(e.ok){if(!e.revoked){const t=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:e.manual_revoke_url});this.plugin.uppy.info(t,"info",7e3)}const t={authenticated:!1,files:[],folders:[],directories:[]};this.plugin.setPluginState(t)}})).catch(this.handleError)}filterQuery(e){const t=this.plugin.getPluginState();this.plugin.setPluginState({...t,filterInput:e?e.target.value:""})}addFolder(e){const t=this.providerFileToId(e),i={...this.plugin.getPluginState().selectedFolders};if(!(t in i)||!i[t].loading)return i[t]={loading:!0,files:[]},this.plugin.setPluginState({selectedFolders:{...i}}),this.listAllFiles(e.requestPath).then((r=>{let s=0;r.forEach((e=>{const t=this.providerFileToId(e);this.plugin.uppy.checkIfFileAlreadyExists(t)||s++})),s>0&&r.forEach((e=>this.addFile(e)));const n=r.map(this.providerFileToId);let o;i[t]={loading:!1,files:n},this.plugin.setPluginState({selectedFolders:i}),o=0===s?this.plugin.uppy.i18n("folderAlreadyAdded",{folder:e.name}):r.length?this.plugin.uppy.i18n("folderAdded",{smart_count:s,folder:e.name}):this.plugin.uppy.i18n("emptyFolderAdded"),this.plugin.uppy.info(o)})).catch((e=>{const i={...this.plugin.getPluginState().selectedFolders};delete i[t],this.plugin.setPluginState({selectedFolders:i}),this.handleError(e)}))}async handleAuth(){await this.provider.ensurePreAuth();const e=btoa(JSON.stringify({origin:location.origin})),t=`@uppy/provider-views=${m.VERSION}`,i=this.provider.authUrl({state:e,uppyVersions:t}),r=window.open(i,"_blank"),s=e=>{if(e.source!==r)return void this.plugin.uppy.log("rejecting event from unknown source");var t,i;t=e.origin,i=this.plugin.opts.companionAllowedHosts,(Array.isArray(i)?i.map(d):[d(i)]).some((e=>(null==e?void 0:e.test(t))||(null==e?void 0:e.test(`${t}/`))))&&e.source===r||this.plugin.uppy.log(`rejecting event from ${e.origin} vs allowed pattern ${this.plugin.opts.companionAllowedHosts}`);const n="string"==typeof e.data?JSON.parse(e.data):e.data;if(n.error){this.plugin.uppy.log("auth aborted","warning");const{uppy:e}=this.plugin,t=e.i18n("authAborted");e.info({message:t},"warning",5e3)}else n.token?(r.close(),window.removeEventListener("message",s),this.provider.setAuthToken(n.token),this.preFirstRender()):this.plugin.uppy.log("did not receive token from auth window","error")};window.addEventListener("message",s)}async handleScroll(e){const t=this.nextPagePath||null;if(this.shouldHandleScroll(e)&&t){this.isHandlingScroll=!0;try{const e=await this.provider.list(t),{files:i,folders:r}=this.plugin.getPluginState();s(this,g)[g](e,i,r)}catch(e){this.handleError(e)}finally{this.isHandlingScroll=!1}}}async listAllFiles(e,t){void 0===t&&(t=null),t=t||[];const i=await this.provider.list(e);i.items.forEach((e=>{e.isFolder?this.addFolder(e):t.push(e)}));const r=i.nextPagePath;return r?this.listAllFiles(r,t):t}donePicking(){const{currentSelection:e}=this.plugin.getPluginState(),t=e.map((e=>e.isFolder?this.addFolder(e):this.addFile(e)));this.sharedHandler.loaderWrapper(Promise.all(t),(()=>{this.clearSelection()}),(()=>{}))}render(e,t){var i=this;void 0===t&&(t={});const{authenticated:s,didFirstRender:n}=this.plugin.getPluginState();n||this.preFirstRender();const o={...this.opts,...t},{files:p,folders:d,filterInput:g,loading:m,currentSelection:y}=this.plugin.getPluginState(),{isChecked:f,toggleCheckbox:v,recordShiftKeyPress:P,filterItems:w}=this.sharedHandler,b=""!==g,S={showBreadcrumbs:o.showBreadcrumbs,getFolder:this.getFolder,directories:this.plugin.getPluginState().directories,pluginIcon:this.plugin.icon,title:this.plugin.title,logout:this.logout,username:this.username,i18n:this.plugin.uppy.i18n},k={isChecked:f,toggleCheckbox:v,recordShiftKeyPress:P,currentSelection:y,files:b?w(p):p,folders:b?w(d):d,username:this.username,getNextFolder:this.getNextFolder,getFolder:this.getFolder,filterItems:this.sharedHandler.filterItems,filterQuery:this.filterQuery,logout:this.logout,handleScroll:this.handleScroll,listAllFiles:this.listAllFiles,done:this.donePicking,cancel:this.cancelPicking,headerComponent:a(S),title:this.plugin.title,viewType:o.viewType,showTitles:o.showTitles,showFilter:o.showFilter,showBreadcrumbs:o.showBreadcrumbs,pluginIcon:this.plugin.icon,i18n:this.plugin.uppy.i18n,uppyFiles:this.plugin.uppy.getFiles(),validateRestrictions:function(){return i.plugin.uppy.validateRestrictions(...arguments)}};return m?(0,r.h)(u,{onUnmount:this.clearSelection},(0,r.h)(c,{i18n:this.plugin.uppy.i18n})):s?(0,r.h)(u,{onUnmount:this.clearSelection},(0,r.h)(h,k)):(0,r.h)(u,{onUnmount:this.clearSelection},(0,r.h)(l,{pluginName:this.plugin.title,pluginIcon:this.plugin.icon,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,i18nArray:this.plugin.uppy.i18nArray}))}}function y(e,t,i){this.nextPagePath=e.nextPagePath,e.items.forEach((e=>{e.isFolder?i.push(e):t.push(e)})),this.plugin.setPluginState({folders:i,files:t})}m.VERSION="2.1.3",e.exports=m},4312:function(e,t,i){var r=i(3847);e.exports=e=>{let{i18n:t,logout:i,username:s}=e;return[(0,r.h)("span",{className:"uppy-ProviderBrowser-user",key:"username"},s),(0,r.h)("button",{type:"button",onClick:i,className:"uppy-u-reset uppy-ProviderBrowser-userLogout",key:"logout"},t("logOut"))]}},8376:function(e,t,i){e.exports=i(4291)},5232:function(e,t,i){var r=i(3847);e.exports=e=>{const{searchTerm:t,i18n:i,search:s}=e;return(0,r.h)("div",{class:"uppy-ProviderBrowser-search"},(0,r.h)("input",{class:"uppy-u-reset uppy-ProviderBrowser-searchInput",type:"text",placeholder:i("search"),"aria-label":i("search"),value:t,onKeyUp:e=>{13===e.keyCode&&(e.stopPropagation(),e.preventDefault(),s(e.target.value))},"data-uppy-super-focusable":!0}),(0,r.h)("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon uppy-ProviderBrowser-searchIcon",width:"12",height:"12",viewBox:"0 0 12 12"},(0,r.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"})))}},4817:function(e,t,i){var r=i(3847);e.exports=e=>{let t,{i18n:i,search:s}=e;const n=()=>{t.value&&s(t.value)};return(0,r.h)("div",{className:"uppy-SearchProvider"},(0,r.h)("input",{className:"uppy-u-reset uppy-c-textInput uppy-SearchProvider-input",type:"search","aria-label":i("enterTextToSearch"),placeholder:i("enterTextToSearch"),onKeyUp:e=>{13===e.keyCode&&n()},ref:e=>{t=e},"data-uppy-super-focusable":!0}),(0,r.h)("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-SearchProvider-searchButton",type:"button",onClick:n},i("searchImages")))}},2771:function(e,t,i){var r=i(3847);function s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var n=0;function o(e){return"__private_"+n+++"_"+e}const l=i(4817),a=i(3762),h=i(5657),c=i(5232),u=i(7194),p=i(2791);var d=o("updateFilesAndInputMode");class g extends p{constructor(e,t){super(e,t),Object.defineProperty(this,d,{value:m}),this.opts={viewType:"grid",showTitles:!1,showFilter:!1,showBreadcrumbs:!1,...t},this.search=this.search.bind(this),this.triggerSearchInput=this.triggerSearchInput.bind(this),this.addFile=this.addFile.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.plugin.setPluginState({isInputMode:!0,files:[],folders:[],directories:[],filterInput:"",currentSelection:[],searchTerm:null})}tearDown(){}clearSelection(){this.plugin.setPluginState({currentSelection:[],isInputMode:!0,files:[],searchTerm:null})}search(e){const{searchTerm:t}=this.plugin.getPluginState();if(!e||e!==t)return this.sharedHandler.loaderWrapper(this.provider.search(e),(e=>{s(this,d)[d](e,[])}),this.handleError)}triggerSearchInput(){this.plugin.setPluginState({isInputMode:!0})}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(),r=await this.provider.search(i,t);s(this,d)[d](r,e)}catch(e){this.handleError(e)}finally{this.isHandlingScroll=!1}}}donePicking(){const{currentSelection:e}=this.plugin.getPluginState(),t=e.map((e=>this.addFile(e)));this.sharedHandler.loaderWrapper(Promise.all(t),(()=>{this.clearSelection()}),(()=>{}))}render(e,t){var i=this;void 0===t&&(t={});const{didFirstRender:s,isInputMode:n,searchTerm:o}=this.plugin.getPluginState();s||this.preFirstRender();const p={...this.opts,...t},{files:d,folders:g,filterInput:m,loading:y,currentSelection:f}=this.plugin.getPluginState(),{isChecked:v,toggleCheckbox:P,filterItems:w}=this.sharedHandler,b=""!==m,S={isChecked:v,toggleCheckbox:P,currentSelection:f,files:b?w(d):d,folders:b?w(g):g,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,headerComponent:c({search:this.search,i18n:this.plugin.uppy.i18n,searchTerm:o}),title:this.plugin.title,viewType:p.viewType,showTitles:p.showTitles,showFilter:p.showFilter,showBreadcrumbs:p.showBreadcrumbs,pluginIcon:this.plugin.icon,i18n:this.plugin.uppy.i18n,uppyFiles:this.plugin.uppy.getFiles(),validateRestrictions:function(){return i.plugin.uppy.validateRestrictions(...arguments)}};return y?(0,r.h)(u,{onUnmount:this.clearSelection},(0,r.h)(h,{i18n:this.plugin.uppy.i18n})):n?(0,r.h)(u,{onUnmount:this.clearSelection},(0,r.h)(l,{search:this.search,i18n:this.plugin.uppy.i18n})):(0,r.h)(u,{onUnmount:this.clearSelection},(0,r.h)(a,S))}}function m(e,t){this.nextPageQuery=e.nextPageQuery,e.items.forEach((e=>{t.push(e)})),this.plugin.setPluginState({isInputMode:!1,files:t,searchTerm:e.searchedFor})}g.VERSION="2.1.3",e.exports=g},8847:function(e,t,i){e.exports=i(2771)},8309:function(e,t,i){const r=i(8027);e.exports=class{constructor(e){this.plugin=e,this.filterItems=this.filterItems.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.recordShiftKeyPress=this.recordShiftKeyPress.bind(this),this.isChecked=this.isChecked.bind(this),this.loaderWrapper=this.loaderWrapper.bind(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}recordShiftKeyPress(e){this.isShiftKeyPressed=e.shiftKey}toggleCheckbox(e,t){e.stopPropagation(),e.preventDefault(),e.currentTarget.focus();const{folders:i,files:s}=this.plugin.getPluginState(),n=this.filterItems(i.concat(s));if(this.lastCheckbox&&this.isShiftKeyPressed){const e=n.indexOf(this.lastCheckbox),i=n.indexOf(t),s=e<i?n.slice(e,i+1):n.slice(i,e+1),o=[];for(const e of s){const{uppy:t}=this.plugin,i=t.validateRestrictions(r(e),[...t.getFiles(),...o]);i.result?o.push(e):t.info({message:i.reason},"error",t.opts.infoTimeout)}return void this.plugin.setPluginState({currentSelection:o})}this.lastCheckbox=t;const{currentSelection:o}=this.plugin.getPluginState();this.isChecked(t)?this.plugin.setPluginState({currentSelection:o.filter((e=>e.id!==t.id))}):this.plugin.setPluginState({currentSelection:o.concat([t])})}isChecked(e){const{currentSelection:t}=this.plugin.getPluginState();return t.some((t=>t.id===e.id))}loaderWrapper(e,t,i){e.then((e=>{this.plugin.setPluginState({loading:!1}),t(e)})).catch((e=>{this.plugin.setPluginState({loading:!1}),i(e)})),this.plugin.setPluginState({loading:!0})}}},2791:function(e,t,i){const r=i(573),s=i(4958),n=i(9246),o=i(8309);e.exports=class{constructor(e,t){this.plugin=e,this.provider=t.provider,this.sharedHandler=new o(e),this.isHandlingScroll=!1,this.preFirstRender=this.preFirstRender.bind(this),this.handleError=this.handleError.bind(this),this.addFile=this.addFile.bind(this),this.clearSelection=this.clearSelection.bind(this),this.cancelPicking=this.cancelPicking.bind(this)}providerFileToId(e){return n({data:e,name:e.name||e.id,type:e.mimetype})}preFirstRender(){this.plugin.setPluginState({didFirstRender:!0}),this.plugin.onFirstRender()}shouldHandleScroll(e){const{scrollHeight:t,scrollTop:i,offsetHeight:r}=e.target;return t-(i+r)<50&&!this.isHandlingScroll}clearSelection(){this.plugin.setPluginState({currentSelection:[]})}cancelPicking(){this.clearSelection();const e=this.plugin.uppy.getPlugin("Dashboard");e&&e.hideAllPanels()}handleError(e){const{uppy:t}=this.plugin,i=t.i18n("companionError");t.log(e.toString()),e.isAuthError||t.info({message:i,details:e.toString()},"error",5e3)}addFile(e){const t={id:this.providerFileToId(e),source:this.plugin.id,data:e,name:e.name||e.id,type:e.mimeType,isRemote:!0,meta:{},body:{fileId:e.id},remote:{companionUrl:this.plugin.opts.companionUrl,url:`${this.provider.fileUrl(e.requestPath)}`,body:{fileId:e.id},providerOptions:this.provider.opts,providerName:this.provider.name}},i=r(t);i&&s(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)),this.plugin.uppy.log("Adding remote file");try{return this.plugin.uppy.addFile(t),!0}catch(e){return e.isRestriction||this.plugin.uppy.log(e),!1}}}},516:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.SearchProviderViews=t.ProviderViews=void 0;const r=i(8376);t.ProviderViews=r;const s=i(8847);t.SearchProviderViews=s},3411:function(e,t,i){const r=i(8410);class s extends Error{constructor(e,t){void 0===t&&(t={}),super(e),this.cause=t.cause,this.cause&&r(this.cause,"isNetworkError")&&(this.isNetworkError=this.cause.isNetworkError)}}e.exports=s},5018:function(e){class t extends Error{constructor(e,t){void 0===t&&(t=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}}e.exports=t},9286:function(e,t,i){const r=i(5018);e.exports=function(){return fetch(...arguments).catch((e=>{throw"AbortError"===e.name?e:new r(e)}))}},4958:function(e){e.exports=function(e){return!!e&&/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(e)}},8027:function(e,t,i){const r=i(3734);e.exports=function(e){return{...e,type:e.mimeType,extension:e.name?r(e.name).extension:null}}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_micromag_viewer_build=self.webpackChunk_micromag_viewer_build||[]).push([[910],{7711:function(e){"use strict";function t(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var s=0;function o(e){return"__private_"+s+++"_"+e}var r=o("aliveTimer"),i=o("isDone"),a=o("onTimedOut"),n=o("timeout");e.exports=class{constructor(e,s){Object.defineProperty(this,r,{writable:!0,value:void 0}),Object.defineProperty(this,i,{writable:!0,value:!1}),Object.defineProperty(this,a,{writable:!0,value:void 0}),Object.defineProperty(this,n,{writable:!0,value:void 0}),t(this,n)[n]=e,t(this,a)[a]=s}progress(){t(this,i)[i]||t(this,n)[n]>0&&(clearTimeout(t(this,r)[r]),t(this,r)[r]=setTimeout(t(this,a)[a],t(this,n)[n]))}done(){t(this,i)[i]||(clearTimeout(t(this,r)[r]),t(this,r)[r]=null,t(this,i)[i]=!0)}}},6910:function(e,t,s){"use strict";var o=s(8864),r=s(8729),i=s(1539);const a=s(1515),n=s(862),p=s(2746),d=s(6148),l=s(4574),u=s(7711),h=s(5018),c=s(1625),m=s(562);function y(e,t){let s=t;return s||(s=new Error("Upload error")),"string"==typeof s&&(s=new Error(s)),s instanceof Error||(s=Object.assign(new Error("Upload error"),{data:s})),c(e)?(s=new h(s,e),s):(s.request=e,s)}function f(e){return e.data.slice(0,e.data.size,e.meta.type)}class g extends a{constructor(e,t){super(e,t),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.title="XHRUpload",this.defaultLocale=m;const s={formData:!0,fieldName:t.bundle?"files[]":"file",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},timeout:3e4,limit:5,withCredentials:!1,responseType:"",getResponseData(t){let s={};try{s=JSON.parse(t)}catch(t){e.log(t)}return s},getResponseError(e,t){let s=new Error("Upload error");return c(t)&&(s=new h(s,t)),s},validateStatus(e){return e>=200&&e<300}};if(this.opts={...s,...t},this.i18nInit(),this.handleUpload=this.handleUpload.bind(this),i.internalRateLimitedQueue in this.opts?this.requests=this.opts[i.internalRateLimitedQueue]:this.requests=new i.RateLimitedQueue(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");this.uploaderEvents=Object.create(null)}getOptions(e){const t=this.uppy.getState().xhrUpload,{headers:s}=this.opts,o={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return"function"==typeof s?o.headers=s(e):Object.assign(o.headers,this.opts.headers),t&&Object.assign(o.headers,t.headers),e.xhrUpload&&Object.assign(o.headers,e.xhrUpload.headers),o}addMetadata(e,t,s){(Array.isArray(s.metaFields)?s.metaFields:Object.keys(t)).forEach((s=>{e.append(s,t[s])}))}createFormDataUpload(e,t){const s=new FormData;this.addMetadata(s,e.meta,t);const o=f(e);return e.name?s.append(t.fieldName,o,e.meta.name):s.append(t.fieldName,o),s}createBundledUpload(e,t){const s=new FormData,{meta:o}=this.uppy.getState();return this.addMetadata(s,o,t),e.forEach((e=>{const t=this.getOptions(e),o=f(e);e.name?s.append(t.fieldName,o,e.name):s.append(t.fieldName,o)})),s}upload(e,t,s){const r=this.getOptions(e);return this.uppy.log(`uploading ${t} of ${s}`),new Promise(((t,s)=>{this.uppy.emit("upload-started",e);const i=r.formData?this.createFormDataUpload(e,r):e.data,a=new XMLHttpRequest;let n;this.uploaderEvents[e.id]=new l(this.uppy);const p=new u(r.timeout,(()=>{a.abort(),n.done();const t=new Error(this.i18n("timedOut",{seconds:Math.ceil(r.timeout/1e3)}));this.uppy.emit("upload-error",e,t),s(t)})),d=(0,o.nanoid)();a.upload.addEventListener("loadstart",(()=>{this.uppy.log(`[XHRUpload] ${d} started`)})),a.upload.addEventListener("progress",(t=>{this.uppy.log(`[XHRUpload] ${d} progress: ${t.loaded} / ${t.total}`),p.progress(),t.lengthComputable&&this.uppy.emit("upload-progress",e,{uploader:this,bytesUploaded:t.loaded,bytesTotal:t.total})})),a.addEventListener("load",(()=>{if(this.uppy.log(`[XHRUpload] ${d} finished`),p.done(),n.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),r.validateStatus(a.status,a.responseText,a)){const s=r.getResponseData(a.responseText,a),o=s[r.responseUrlFieldName],i={status:a.status,body:s,uploadURL:o};return this.uppy.emit("upload-success",e,i),o&&this.uppy.log(`Download ${e.name} from ${o}`),t(e)}const o=r.getResponseData(a.responseText,a),i=y(a,r.getResponseError(a.responseText,a)),l={status:a.status,body:o};return this.uppy.emit("upload-error",e,i,l),s(i)})),a.addEventListener("error",(()=>{this.uppy.log(`[XHRUpload] ${d} errored`),p.done(),n.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null);const t=y(a,r.getResponseError(a.responseText,a));return this.uppy.emit("upload-error",e,t),s(t)})),a.open(r.method.toUpperCase(),r.endpoint,!0),a.withCredentials=r.withCredentials,""!==r.responseType&&(a.responseType=r.responseType),n=this.requests.run((()=>{this.uppy.emit("upload-started",e);const t=this.getOptions(e);return Object.keys(t.headers).forEach((e=>{a.setRequestHeader(e,t.headers[e])})),a.send(i),()=>{p.done(),a.abort()}})),this.onFileRemove(e.id,(()=>{n.abort(),s(new Error("File removed"))})),this.onCancelAll(e.id,(e=>{let{reason:t}=e;"user"===t&&n.abort(),s(new Error("Upload cancelled"))}))}))}uploadRemote(e){const t=this.getOptions(e);return new Promise(((s,o)=>{this.uppy.emit("upload-started",e);const i={};(Array.isArray(t.metaFields)?t.metaFields:Object.keys(e.meta)).forEach((t=>{i[t]=e.meta[t]})),new(e.remote.providerOptions.provider?r.Provider:r.RequestClient)(this.uppy,e.remote.providerOptions).post(e.remote.url,{...e.remote.body,endpoint:t.endpoint,size:e.data.size,fieldname:t.fieldName,metadata:i,httpMethod:t.method,useFormData:t.formData,headers:t.headers}).then((i=>{const{token:a}=i,d=p(e.remote.companionUrl),u=new r.Socket({target:`${d}/api/${a}`,autoOpen:!1});let h;this.uploaderEvents[e.id]=new l(this.uppy),this.onFileRemove(e.id,(()=>{u.send("cancel",{}),h.abort(),s(`upload ${e.id} was removed`)})),this.onCancelAll(e.id,(function(t){let{reason:o}=void 0===t?{}:t;"user"===o&&(u.send("cancel",{}),h.abort()),s(`upload ${e.id} was canceled`)})),this.onRetry(e.id,(()=>{u.send("pause",{}),u.send("resume",{})})),this.onRetryAll(e.id,(()=>{u.send("pause",{}),u.send("resume",{})})),u.on("progress",(t=>n(this,t,e))),u.on("success",(o=>{const r=t.getResponseData(o.response.responseText,o.response),i=r[t.responseUrlFieldName],a={status:o.response.status,body:r,uploadURL:i};return this.uppy.emit("upload-success",e,a),h.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),s()})),u.on("error",(s=>{const r=s.response,i=r?t.getResponseError(r.responseText,r):Object.assign(new Error(s.error.message),{cause:s.error});this.uppy.emit("upload-error",e,i),h.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),o(i)})),h=this.requests.run((()=>(u.open(),e.isPaused&&u.send("pause",{}),()=>u.close())))})).catch((t=>{this.uppy.emit("upload-error",e,t),o(t)}))}))}uploadBundle(e){return new Promise(((t,s)=>{const{endpoint:o}=this.opts,{method:r}=this.opts,i=this.uppy.getState().xhrUpload,a=this.createBundledUpload(e,{...this.opts,...i||{}}),n=new XMLHttpRequest,p=t=>{e.forEach((e=>{this.uppy.emit("upload-error",e,t)}))},d=new u(this.opts.timeout,(()=>{n.abort();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(this.opts.timeout/1e3)}));p(e),s(e)}));n.upload.addEventListener("loadstart",(()=>{this.uppy.log("[XHRUpload] started uploading bundle"),d.progress()})),n.upload.addEventListener("progress",(t=>{d.progress(),t.lengthComputable&&e.forEach((e=>{this.uppy.emit("upload-progress",e,{uploader:this,bytesUploaded:t.loaded/t.total*e.size,bytesTotal:e.size})}))})),n.addEventListener("load",(o=>{if(d.done(),this.opts.validateStatus(o.target.status,n.responseText,n)){const s=this.opts.getResponseData(n.responseText,n),r={status:o.target.status,body:s};return e.forEach((e=>{this.uppy.emit("upload-success",e,r)})),t()}const r=this.opts.getResponseError(n.responseText,n)||new Error("Upload error");return r.request=n,p(r),s(r)})),n.addEventListener("error",(()=>{d.done();const e=this.opts.getResponseError(n.responseText,n)||new Error("Upload error");return p(e),s(e)})),this.uppy.on("cancel-all",(function(e){let{reason:t}=void 0===e?{}:e;"user"===t&&(d.done(),n.abort())})),n.open(r.toUpperCase(),o,!0),n.withCredentials=this.opts.withCredentials,""!==this.opts.responseType&&(n.responseType=this.opts.responseType),Object.keys(this.opts.headers).forEach((e=>{n.setRequestHeader(e,this.opts.headers[e])})),n.send(a),e.forEach((e=>{this.uppy.emit("upload-started",e)}))}))}uploadFiles(e){const t=e.map(((t,s)=>{const o=parseInt(s,10)+1,r=e.length;return t.error?Promise.reject(new Error(t.error)):t.isRemote?this.uploadRemote(t,o,r):this.upload(t,o,r)}));return d(t)}onFileRemove(e,t){this.uploaderEvents[e].on("file-removed",(s=>{e===s.id&&t(s.id)}))}onRetry(e,t){this.uploaderEvents[e].on("upload-retry",(s=>{e===s&&t()}))}onRetryAll(e,t){this.uploaderEvents[e].on("retry-all",(()=>{this.uppy.getFile(e)&&t()}))}onCancelAll(e,t){var s=this;this.uploaderEvents[e].on("cancel-all",(function(){s.uppy.getFile(e)&&t(...arguments)}))}handleUpload(e){if(0===e.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();0!==this.opts.limit||this.opts[i.internalRateLimitedQueue]||this.uppy.log("[XHRUpload] 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/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");const t=e.map((e=>this.uppy.getFile(e)));if(this.opts.bundle){if(t.some((e=>e.isRemote)))throw new Error("Can’t upload remote files when the `bundle: true` option is set");if("function"==typeof this.opts.headers)throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");return this.uploadBundle(t)}return this.uploadFiles(t).then((()=>null))}install(){if(this.opts.bundle){const{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(this.handleUpload)}uninstall(){if(this.opts.bundle){const{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(this.handleUpload)}}g.VERSION="2.1.3",e.exports=g},562:function(e){"use strict";e.exports={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}}},8864:function(e){e.exports={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(s=t)=>{let o="",r=s;for(;r--;)o+=e[Math.random()*e.length|0];return o}}}}]);