PageSourceSearch

https://www.homify.ae/assets/webpack/1191.4f683e2d70c2c2e48ba8.js

js homify.ae collected 2026-09-26 16:22:51 UTC 29,482 bytes, 1 lines download raw bytes

1(self.webpackChunkhomify_de=self.webpackChunkhomify_de||[]).push([[1191],{7350:function(e,t,s){var i=s(8221),o=s(3805);e.exports=function(e,t,s){var r=!0,l=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return o(s)&&(r="leading"in s?!!s.leading:r,l="trailing"in s?!!s.trailing:l),i(e,t,{leading:r,maxWait:t,trailing:l})}},7057:function(e,t,s){var i=s(7163),o=/[\/\+\.]/;e.exports=function(e,t){function s(t){var s=i(t,e,o);return s&&s.length>=2}return t?s(t.split(";")[0]):s}},3835:function(e){e.exports=function(){var e={},t=e._fns={};return e.emit=function(e,s,i,o,r,l,n){var a=function(e){for(var s=t[e]?t[e]:[],i=e.indexOf(":"),o=-1===i?[e]:[e.substring(0,i),e.substring(i+1)],r=Object.keys(t),l=0,n=r.length;l<n;l++){var a=r[l];if("*"===a&&(s=s.concat(t[a])),2===o.length&&o[0]===a){s=s.concat(t[a]);break}}return s}(e);a.length&&function(e,t,s){for(var i=0,o=t.length;i<o&&t[i];i++)t[i].event=e,t[i].apply(t[i],s)}(e,a,[s,i,o,r,l,n])},e.on=function(e,s){t[e]||(t[e]=[]),t[e].push(s)},e.once=function(t,s){this.on(t,function i(){s.apply(this,arguments),e.off(t,i)})},e.off=function(e,t){var s=[];if(e&&t)for(var i=this._fns[e],o=0,r=i?i.length:0;o<r;o++)i[o]!==t&&s.push(i[o]);s.length?this._fns[e]=s:delete this._fns[e]},e}},7163:function(e){"use strict";function t(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}t.prototype.match=function(e){var t,s,i=!0,o=this.parts,r=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(s=(e||"").split(this.separator),t=0;i&&t<r;t++)"*"!==o[t]&&(i=t<s.length&&o[t]===s[t]);i=i&&s}else i=!1;else if("function"==typeof e.splice)for(i=[],t=e.length;t--;)this.match(e[t])&&(i[i.length]=e[t]);else if("object"==typeof e)for(var l in i={},e)this.match(l)&&(i[l]=e[l]);return i},e.exports=function(e,s,i){var o=new t(e,i||/[\/\.]/);return void 0!==s?o.match(s):o}},9729:function(e,t,s){"use strict";s.d(t,{A:function(){return i}});class i{#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(const[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(s,i)=>{e===s?.id&&t(i)})}onFileRemove(e,t){this.on("file-removed",s=>{e===s.id&&t(s.id)})}onPause(e,t){this.on("upload-pause",(s,i)=>{e===s?.id&&t(i)})}onRetry(e,t){this.on("upload-retry",s=>{e===s?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...s)=>{this.#e.getFile(e)&&t(...s)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}}},1191:function(e,t,s){"use strict";s.r(t),s.d(t,{BasePlugin:function(){return i.A},EventManager:function(){return o.A},RestrictionError:function(){return c},UIPlugin:function(){return g.A},Uppy:function(){return T},debugLogger:function(){return a},default:function(){return T}});var i=s(2656),o=s(9729);function r(e){return e<10?`0${e}`:e.toString()}function l(){const e=new Date;return`${r(e.getHours())}:${r(e.getMinutes())}:${r(e.getSeconds())}`}const n={debug:()=>{},warn:()=>{},error:(...e)=>console.error(`[Uppy] [${l()}]`,...e)},a={debug:(...e)=>console.debug(`[Uppy] [${l()}]`,...e),warn:(...e)=>console.warn(`[Uppy] [${l()}]`,...e),error:(...e)=>console.error(`[Uppy] [${l()}]`,...e)};var d=s(8505),h=s(7057);const u={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class c extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0}class p{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{const t=e();if(null!=t.restrictions?.allowedFileTypes&&!Array.isArray(t.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return t}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:s,maxNumberOfFiles:i}=this.getOpts().restrictions;if(i&&e.filter(e=>!e.isGhost).length+t.length>i)throw new c(`${this.getI18n()("youCanOnlyUploadX",{smart_count:i})}`);if(s){const i=[...e,...t].reduce((e,t)=>
1e+(t.size??0),0);if(i>s)throw new c(this.getI18n()("aggregateExceedsSize",{sizeAllowed:d(s),size:d(i)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:s,allowedFileTypes:i}=this.getOpts().restrictions;if(i&&!i.some(t=>t.includes("/")?!!e.type&&h(e.type.replace(/;.*?$/,""),t):!("."!==t[0]||!e.extension)&&e.extension.toLowerCase()===t.slice(1).toLowerCase())){const t=i.join(", ");throw new c(this.getI18n()("youCanOnlyUploadFileTypes",{types:t}),{file:e})}if(t&&null!=e.size&&e.size>t)throw new c(this.getI18n()("exceedsSize",{size:d(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(s&&null!=e.size&&e.size<s)throw new c(this.getI18n()("inferiorSize",{size:d(s)}),{file:e})}validate(e,t){t.forEach(e=>{this.validateSingleFile(e)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new c(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new c(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:s}=this.getOpts().restrictions,i=[];for(const t of s)Object.hasOwn(e.meta,t)&&""!==e.meta[t]||i.push(t);return{missingFields:i,error:t}}}var g=s(2200),f=class{static VERSION="5.0.0";state={};#s=new Set;getState(){return this.state}setState(e){const t={...this.state},s={...this.state,...e};this.state=s,this.#i(t,s,e)}subscribe(e){return this.#s.add(e),()=>{this.#s.delete(e)}}#i(...e){this.#s.forEach(t=>{t(...e)})}},m=s(720),y=s(2910),w=s(8287),F=s(1734),S=s(7350),v=s(3835),b=s(8423),U={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};function A(e){if(null==e&&"undefined"!=typeof navigator&&(e=navigator.userAgent),!e)return!0;const t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;const s=t[1].split(".",2),i=parseInt(s[0],10),o=parseInt(s[1],10);return i<15||15===i&&o<15063||i>18||18===i&&o>=18218}const P={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};class O{static VERSION="5.2.0";#o=Object.create(null);#r;#l;#n=v();#a=new Set;#d=new Set;#h=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=U;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:u,meta:{},onBeforeFileAdded:(e,t)=>!Object.hasOwn(t,e.id),onBeforeUpload:e=>e,store:new f,logger:n,infoTimeout:5e3},s={...t,...e};this.opts={...s,restrictions:{...t.restrictions,...e?.restrictions}},e?.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e?.debug&&(this.opts.logger=a),this.log(`Using Core v${O.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...P,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:A(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#r=new p(()=>this.opts,()=>this.i18n),this.#l=this.store.subscribe((e,t,s)=>
1{this.emit("state-update",e,t,s),this.updateAll(t)}),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),this.#u()}emit(e,...t){this.#n.emit(e,...t)}on(e,t){return this.#n.on(e,t),this}once(e,t){return this.#n.once(e,t),this}off(e,t){return this.#n.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){const t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([e,s])=>[e,{...t[e],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){const e=new m.A([this.defaultLocale,this.opts.locale],{onMissingKey:e=>this.log(`Missing i18n string: ${e}`,"error")});this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.locale=e.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){const e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},s=Object.create(null);Object.keys(t).forEach(i=>{s[i]={...t[i],progress:{...t[i].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:s,...P})}clear(){const{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...P,files:{}})}addPreProcessor(e){this.#a.add(e)}removePreProcessor(e){return this.#a.delete(e)}addPostProcessor(e){this.#h.add(e)}removePostProcessor(e){return this.#h.delete(e)}addUploader(e){this.#d.add(e)}removeUploader(e){return this.#d.delete(e)}setMeta(e){const t={...this.getState().meta,...e},s={...this.getState().files};Object.keys(s).forEach(t=>{s[t]={...s[t],meta:{...s[t].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:s})}setFileMeta(e,t){const s={...this.getState().files};if(!s[e])return void this.log(`Was trying to set metadata for a file that has been removed: ${e}`);const i={...s[e].meta,...t};s[e]={...s[e],meta:i},this.setState({files:s})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(e=>this.getFile(e))}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:s}=this.getState(),i=Object.values(e),o=[],r=[],l=[],n=[],a=[],d=[],h=[],u=[],c=[];for(const e of i){const{progress:t}=e;!t.uploadComplete&&t.uploadStarted&&(o.push(e),e.isPaused||u.push(e)),t.uploadStarted||r.push(e),(t.uploadStarted||t.preprocess||t.postprocess)&&l.push(e),t.uploadStarted&&n.push(e),e.isPaused&&a.push(e),t.uploadComplete&&d.push(e),e.error&&h.push(e),(t.preprocess||t.postprocess)&&c.push(e)}return{newFiles:r,startedFiles:l,uploadStartedFiles:n,pausedFiles:a,completeFiles:d,erroredFiles:h,inProgressFiles:o,inProgressNotPausedFiles:u,processingFiles:c,isUploadStarted:n.length>0,isAllComplete:100===t&&d.length===i.length&&0===c.length,isAllErrored:!!s&&h.length===i.length,isAllPaused:0!==o.length&&a.length===o.length,isUploadInProgress:o.length>0,isSomeGhost:i.some(e=>e.isGhost)}}#c(e){for(const t of e)t.isRestriction?this.emit("restriction-failed",t.file,t):this.emit("error",t,t.file),this.log(t,"warning");const t=e.filter(e=>e.isUserFacing),s=t.slice(0,4),i=t.slice(4);s.forEach(({message:e,details:t=""})=>{this.info({message:e,details:t},"error",this.opts.infoTimeout)}),i.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:i.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#r.validate(t,[e])}catch(e){return e}return null}validateSingleFile(e){try{this.#r.validateSingleFile(e)}catch(e){return e.message}return null}validateAggregateRestrictions(e){const t=this.getFiles();try{this.#r.validateAggregateRestrictions(t,e)}catch(e){return e.message}return null}#p(e){const{missingFields:t,error:s}=this.#r.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:s.message}
1),this.log(s.message),this.emit("restriction-failed",e,s),!1):(0===t.length&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#g(e){let t=!0;for(const s of Object.values(e))this.#p(s)||(t=!1);return t}#f(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new c(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#c([t]),t}}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}#m(e){const t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e,meta:{},isRemote:!1,source:void 0,preview:void 0}:e,s=(0,y.A)(t),i=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}(s,t),o=(0,w.A)(i).extension,r=(0,F.N)(t,this.getID()),l={...t.meta,name:i,type:s},n=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:r,name:i,extension:o||"",meta:{...this.getState().meta,...l},type:s,progress:{percentage:0,bytesUploaded:!1,bytesTotal:n,uploadComplete:!1,uploadStarted:null},size:n,isGhost:!1,...t.isRemote?{isRemote:!0,remote:t.remote,data:t.data}:{isRemote:!1,data:t.data},preview:t.preview}}#y(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}#w(e){let{files:t}=this.getState(),s={...t};const i=[],o=[];for(const r of e)try{let e=this.#m(r);this.#f(e);const o=t[e.id],l=o?.isGhost;if(l&&!e.isRemote){if(null==e.data)throw new Error("File data is missing");e={...o,isGhost:!1,data:e.data},this.log(`Replaced the blob in the restored ghost file: ${e.name}, ${e.id}`)}const n=this.opts.onBeforeFileAdded(e,s);if(t=this.getState().files,s={...t,...s},!n&&this.checkIfFileAlreadyExists(e.id))throw new c(this.i18n("noDuplicates",{fileName:e.name??this.i18n("unnamed")}),{file:e});if(!1===n&&!l)throw new c("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:e});"object"==typeof n&&null!==n&&(e=n),this.#r.validateSingleFile(e),s[e.id]=e,i.push(e)}catch(e){o.push(e)}try{this.#r.validateAggregateRestrictions(Object.values(t),i)}catch(e){return o.push(e),{nextFilesState:t,validFilesToAdd:[],errors:o}}return{nextFilesState:s,validFilesToAdd:i,errors:o}}addFile(e){const{nextFilesState:t,validFilesToAdd:s,errors:i}=this.#w([e]),o=i.filter(e=>e.isRestriction);if(this.#c(o),i.length>0)throw i[0];this.setState({files:t});const[r]=s;return this.emit("file-added",r),this.emit("files-added",s),this.log(`Added file: ${r.name}, ${r.id}, mime type: ${r.type}`),this.#y(),r.id}addFiles(e){const{nextFilesState:t,validFilesToAdd:s,errors:i}=this.#w(e),o=i.filter(e=>e.isRestriction);this.#c(o);const r=i.filter(e=>!e.isRestriction);if(r.length>0){let e="Multiple errors occurred while adding files:\n";if(r.forEach(t=>{e+=`\n * ${t.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:r.length}),details:e},"error",this.opts.infoTimeout),"function"==typeof AggregateError)throw new AggregateError(r,e);{const t=new Error(e);throw t.errors=r,t}}this.setState({files:t}
1),s.forEach(e=>{this.emit("file-added",e)}),this.emit("files-added",s),s.length>5?this.log(`Added batch of ${s.length} files`):Object.values(s).forEach(e=>{this.log(`Added file: ${e.name}\n id: ${e.id}\n type: ${e.type}`)}),s.length>0&&this.#y()}removeFiles(e){const{files:t,currentUploads:s}=this.getState(),i={...t},o={...s},r=Object.create(null);function l(e){return void 0===r[e]}e.forEach(e=>{t[e]&&(r[e]=t[e],delete i[e])}),Object.keys(o).forEach(e=>{const t=s[e].fileIDs.filter(l);if(0===t.length)return void delete o[e];const{capabilities:i}=this.getState();if(t.length!==s[e].fileIDs.length&&!i.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");o[e]={...s[e],fileIDs:t}});const n={currentUploads:o,files:i};0===Object.keys(i).length&&(n.allowNewUpload=!0,n.error=null,n.recoveredState=null),this.setState(n),this.#F();const a=Object.keys(r);a.forEach(e=>{this.emit("file-removed",r[e])}),a.length>5?this.log(`Removed ${a.length} files`):this.log(`Removed files: ${a.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;const t=this.getFile(e),s=!t.isPaused;return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const s={...e[t],isPaused:!0};e[t]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const s={...e[t],isPaused:!1,error:null};e[t]=s}),this.setState({files:e}),this.emit("resume-all")}#S(){const{files:e}=this.getState();return Object.keys(e).filter(t=>{const s=e[t];return s.error&&(!s.missingRequiredMetaFields||0===s.missingRequiredMetaFields.length)})}async#v(){const e=this.#S(),t={...this.getState().files};if(e.forEach(e=>{t[e]={...t[e],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(e)),0===e.length)return{successful:[],failed:[]};const s=this.#b(e,{forceAllowNewUpload:!0});return this.#U(s)}async retryAll(){const e=await this.#v();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");const{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(P)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));const t=this.#b([e],{forceAllowNewUpload:!0});return this.#U(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#A=(e,t)=>{const s=e?this.getFile(e.id):void 0;if(null==e||!s)return void this.log(`Not setting progress for a file that has been removed: ${e?.id}`);if(100===s.progress.percentage)return void this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);const i={bytesTotal:t.bytesTotal,percentage:null!=t.bytesTotal&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};null!=s.progress.uploadStarted?this.setFileState(e.id,{progress:{...s.progress,...i,bytesUploaded:t.bytesUploaded}}):this.setFileState(e.id,{progress:{...s.progress,...i}}),this.#F()};#P(){const e=this.#O();let t=null;null!=e&&(t=Math.round(100*e),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})}#F=S(()=>this.#P(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#P()}#O(){const e=this.getFiles().filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess);if(0===e.length)return 0;if(e.every(e=>e.progress.uploadComplete))return 1;const t=e=>null!=e.progress.bytesTotal&&0!==e.progress.bytesTotal,s=e.filter(t),i=e.filter(e=>!t(e));if(s.every(e=>e.progress.uploadComplete)&&i.length>0&&!i.every(e=>e.progress.uploadComplete))return null;const o=s.reduce((e,t)=>e+(t.progress.bytesTotal??0),0),r=s.reduce((e,t)=>e+(t.progress.bytesUploaded||0),0);return 0===o?0:r/o}#u(){const e=(e,t,s)=>{let i=e.message||"Unknown error";e.details&&(i+=` ${e.details}`),this.setState({error:i}
1),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:i,response:s})};this.on("error",e),this.on("upload-error",(t,s,i)=>{if(e(s,t,i),"object"==typeof s&&s.message){this.log(s.message,"error");const e=new Error(this.i18n("failedToUpload",{file:t?.name??""}));e.isUserFacing=!0,e.details=s.message,s.details&&(e.details+=` ${s.details}`),this.#c([e])}else this.#c([s])});let t=null;this.on("upload-stalled",(e,s)=>{const{message:i}=e,o=s.map(e=>e.meta.name).join(", ");t||(this.info({message:i,details:o},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${i} ${o}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})}),this.on("upload-start",e=>{const t=e.filter(e=>{const t=null!=e&&this.getFile(e.id);return t||this.log(`Not setting progress for a file that has been removed: ${e?.id}`),t}),s=Object.fromEntries(t.map(e=>[e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:e.size}}]));this.patchFilesState(s)}),this.on("upload-progress",this.#A),this.on("upload-success",(e,t)=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${e?.id}`);const s=this.getFile(e.id).progress,i=this.#h.size>0;this.setFileState(e.id,{progress:{...s,postprocess:i?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!i&&{complete:!0},percentage:100,bytesUploaded:s.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||s.bytesTotal}),this.#F()}),this.on("preprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,preprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${e?.id}`)}),this.on("preprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${e?.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.preprocess,this.setState({files:t})}),this.on("postprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getState().files[e.id].progress,postprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${e?.id}`)}),this.on("postprocess-complete",e=>{const t=e&&this.getFile(e.id);if(null==t)return void this.log(`Not setting progress for a file that has been removed: ${e?.id}`);const{postprocess:s,...i}=t.progress;this.patchFilesState({[t.id]:{progress:{...i,complete:!0}}})}),this.on("restored",()=>{this.#F()}),this.on("dashboard:file-edit-complete",e=>{e&&this.#p(e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",this.#T),window.addEventListener("offline",this.#T),setTimeout(this.#T,3e3))}updateOnlineStatus(){window.navigator.onLine??1?(this.emit("is-online"),this.wasOffline&&(this.emit
1("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}#T=this.updateOnlineStatus.bind(this);getID(){return this.opts.id}use(e,...t){if("function"!=typeof e)throw new TypeError(`Expected a plugin class, but got ${null===e?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`);const s=new e(this,...t),i=s.id;if(!i)throw new Error("Your plugin must have an id");if(!s.type)throw new Error("Your plugin must have a type");const o=this.getPlugin(i);if(o){const e=`Already found a plugin named '${o.id}'. Tried to use: '${i}'.\nUppy plugins must have unique \`id\` options.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${i} v${e.VERSION}`),s.type in this.#o?this.#o[s.type].push(s):this.#o[s.type]=[s],s.install(),this.emit("plugin-added",s),this}getPlugin(e){for(const t of Object.values(this.#o)){const s=t.find(t=>t.id===e);if(null!=s)return s}}[Symbol.for("uppy test: getPlugins")](e){return this.#o[e]}iteratePlugins(e){Object.values(this.#o).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=this.#o[e.type],s=t.findIndex(t=>t.id===e.id);-1!==s&&t.splice(s,1);const i={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(i)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#l(),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",this.#T),window.removeEventListener("offline",this.#T))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",s=3e3){const i="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:i?e.message:e,details:i?e.details:null}]}),setTimeout(()=>this.hideInfo(),s),this.emit("info-visible")}log(e,t){const{logger:s}=this.opts;switch(t){case"error":s.error(e);break;case"warning":s.warn(e);break;default:s.debug(e)}}#E=new Map;registerRequestClient(e,t){this.#E.set(e,t)}
1getRequestClientForFile(e){if(!("remote"in e)||!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=this.#E.get(e.remote.requestClientId);if(null==t)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}async restore(e){this.log(`Core: Running restored upload "${e}"`);const t=await this.#U(e);return this.emit("complete",t),t}#b(e,t={}){const{forceAllowNewUpload:s=!1}=t,{allowNewUpload:i,currentUploads:o}=this.getState();if(!i&&!s)throw new Error("Cannot create a new upload: already uploading.");const r=(0,b.A)();return this.emit("upload",r,this.getFilesByIds(e)),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...o,[r]:{fileIDs:e,step:0,result:{}}}}),r}[Symbol.for("uppy test: createUpload")](...e){return this.#b(...e)}#R(e){const{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#R(e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:s}=this.getState(),i={...s[e],result:{...s[e].result,...t}};this.setState({currentUploads:{...s,[e]:i}})}#I(e){const{[e]:t,...s}=this.getState().currentUploads;this.setState({currentUploads:s})}async#U(e){const t=()=>{const{currentUploads:t}=this.getState();return t[e]};let s=t();if(!s)throw new Error("Nonexistent upload");const i=[...this.#a,...this.#d,...this.#h];try{for(let o=s.step||0;o<i.length;o++){const r=i[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...s,step:o}}});const{fileIDs:l}=s;if(await r(l,e),s=t(),!s)break}}catch(t){throw this.#I(e),t}if(s){s.fileIDs.forEach(e=>{const t=this.getFile(e);t?.progress.postprocess&&this.emit("postprocess-complete",t)});const i=s.fileIDs.map(e=>this.getFile(e)),o=i.filter(e=>!e.error),r=i.filter(e=>e.error);this.addResultData(e,{successful:o,failed:r,uploadID:e}),s=t()}let o;return s&&(o=s.result,this.#I(e)),null==o&&(this.log(`Not setting result for an upload that has been removed: ${e}`),o={successful:[],failed:[],uploadID:e}),o}async upload(){this.#o.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#S().length>0){const t=await this.#v();if(!(this.getFiles().filter(e=>null==e.progress.uploadStarted).length>0))return this.emit("complete",t),t;({files:e}=this.getState())}const t=this.opts.onBeforeUpload(e);if(!1===t)throw new Error("Not starting the upload because onBeforeUpload returned false");t&&"object"==typeof t&&(e=t,this.setState({files:e}));try{if(this.#r.validateMinNumberOfFiles(e),!this.#g(e))throw new c(this.i18n("missingRequiredMetaField"));const{currentUploads:t}=this.getState(),s=Object.values(t).flatMap(e=>e.fileIDs),i=Object.keys(e).filter(e=>{const t=this.getFile(e);return t&&!t.progress.uploadStarted&&!s.includes(e)}),o=this.#b(i),r=await this.#U(o);return this.emit("complete",r),r}catch(e){throw this.#c([e]),e}}}var T=O}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.