export const __webpack_esm_id__=71609;export const __webpack_esm_ids__=[2998,71609];export const __webpack_esm_modules__={2998(e,t,s){s.d(t,{I:()=>i});const i={NONE:"NONE",UPLOADING:"UPLOADING",UPLOAD_ERROR:"UPLOAD_ERROR",UPLOADED:"UPLOADED",PENDING:"PENDING",IMPORTING:"IMPORTING",DONE:"DONE",ERROR:"ERROR",INTERRUPTING:"INTERRUPTING"}},71609(e,t,s){s.d(t,{k:()=>o});var i=s(2998),r=s(22723);class o{constructor(){this.importResource=void 0,this.parent=void 0,this.partialSelected=!1,this.indent=0,this.isImportable=!1,this.hasOngoingImport=!1,this.hasStatusInfo=!1,this.canResetStatus=!1,this.name="",this.shortenedName="",this.path="",this.shortenedContext="",this.selected=!1,this.directories=[],this.files=[],this.isImportedBiggerThanModified=!1,this.isModifiedBiggerThanImported=!1,this.isEditable=!1,this.iconClass="",this.shortenedMessage=""}addResource(e){if(e.isFile())this.files.push(e);else{if(!e.isDirectory())throw new Error("Unsupported resource type!");this.directories.push(e)}}removeResource(e){e.isFile()?this.files=this.files.filter(t=>e.importResource.name!==t.importResource.name):this.directories=this.directories.filter(t=>e.importResource.name!==t.importResource.name)}remove(){this.isRoot()||this.parent.removeResource(this)}getOrCreateDirectory(e){let t=this.directories.find(t=>t.name===e);return t||(t=new o,t.name=e,this.directories.push(t)),t}getRoot(){return this.isRoot()?this:this.parent.getRoot()}isRoot(){return void 0===this.parent}isDirectory(){return this.importResource.isDirectory()}isFile(){return!this.isRoot()&&this.importResource.isFile()}isEmpty(){return 0===this.directories.length&&0===this.files.length}toList(){const e=[];return this.parent&&e.push(this),this.directories.forEach(t=>{e.push(...t.toList())}),e.push(...this.files),e}setSelection(e,t=!0){this.selected=e,this.files.forEach(t=>t.setSelection(e,!1)),this.directories.forEach(t=>t.setSelection(e,!1)),t&&this.getRoot().updateSelectionState()}updateSelectionState(){if(this.directories.forEach(e=>e.updateSelectionState()),this.parent&&this.isDirectory()){const e=this.hasUnselectedChildren(),t=this.hasSelectedChildren();this.selected=t&&!e,this.partialSelected=t&&e}}hasUnselectedChildren(){return this.files.some(e=>!e.selected)||this.directories.some(e=>!e.selected||e.hasUnselectedChildren())}hasSelectedChildren(){return this.files.some(e=>e.selected)||this.directories.some(e=>e.selected||e.hasSelectedChildren())}selectAllWithStatus(e){this.importResource&&e.indexOf(this.importResource.status)>-1&&(this.selected=!0),this.files.forEach(t=>t.selectAllWithStatus(e)),this.directories.forEach(t=>t.selectAllWithStatus(e))}getAllSelectedForImport(){const e=[],t=this.isRoot();return!t&&this.selected&&e.push(this),(t||this.isDirectory()&&!this.selected)&&(this.files.forEach(t=>e.push(...t.getAllSelectedForImport())),this.directories.forEach(t=>e.push(...t.getAllSelectedForImport()))),(0,r.cloneDeep)(e)}getAllSelected(){const e=[];return!this.isRoot()&&this.selected&&e.push(this),this.files.forEach(t=>e.push(...t.getAllSelected())),this.directories.forEach(t=>e.push(...t.getAllSelected())),(0,r.cloneDeep)(e)}getSelectedImportedResources(){return this.getAllSelected().some(e=>e.importResource.status===i.I.DONE)}deselectAll(){this.files.forEach(e=>e.deselectAll()),this.directories.forEach(e=>e.deselectAll()),this.selected=!1,this.partialSelected=!1}getAllSelectedFiles(){const e=[];return!this.isRoot()&&this.selected&&e.push(this.importResource),this.files.forEach(t=>e.push(...t.getAllSelectedFiles())),this.directories.forEach(t=>e.push(...t.getAllSelectedFiles())),e}getAllSelectedFilesNames(){return this.getAllSelectedFiles().map(e=>e.name)}getResourceByName(e){if(this.importResource&&this.importResource.name===e)return this;const t=this.files.find(t=>t.importResource.name===e);if(t)return t;for(const t of this.directories){const s=t.getResourceByName(e);if(s)return s}return null}hasTextInResourcesName(e){return!!this.importResource.name.toLowerCase().includes(e.toLowerCase())||!!this.files.some(t=>t.importResource.name.toLowerCase().includes(e.toLowerCase()))||this.directories.some(t=>t.hasTextInDirectoriesName(e))}hasTextInDirectoriesName(e){return!(!this.isDirectory()||!this.name.toLowerCase().includes(e.toLowerCase()))||this.directories.some(t=>t.hasTextInDirectoriesName(e))}hasTextInFilesName(e){return!(!this.isFile()||!this.name.toLowerCase().includes(e.toLowerCase()))||!!this.files.some(t=>t.importResource.name.toLowerCase().includes(e.toLowerCase()))||this.directories.some(t=>t.hasTextInFilesName(e))}sort(e){this.directories.sort(e),this.files.sort(e),this.directories.forEach(t=>t.sort(e))}getSize(){return this.toList().length}}}};
//# sourceMappingURL=71609.694cbf516f49f9f5f35a.bundle.js.map