@emailmaker/filemanager 0.10.101 → 0.10.102

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.
@@ -0,0 +1,10 @@
1
+ import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import*as r from"react";import n,{useState as i,useEffect as a,createContext as l,useContext as s,useCallback as d,useRef as c,useMemo as u,createElement as f,memo as h,forwardRef as m,useImperativeHandle as p,useLayoutEffect as g}from"react";import{createRoot as v}from"react-dom/client";import{theme as y,ConfigProvider as w,Form as b,App as C,Input as I,Typography as F,Select as A,Tooltip as _,Button as S,Space as E,Segmented as x,Checkbox as P,Dropdown as R,Image as k,Col as N,Card as O,Row as T,Table as L,Empty as M,Spin as U,Pagination as j,Tree as D,Modal as B,Progress as z,Menu as q,Divider as V,List as W,Avatar as H,Layout as $,Radio as G,Tag as K,Carousel as Q,Alert as J}from"antd";import Y,{LoadingOutlined as Z,BarsOutlined as X,AppstoreOutlined as ee,DownOutlined as te,RightOutlined as oe,LinkOutlined as re,UploadOutlined as ne,FileOutlined as ie,FolderAddOutlined as ae,FolderOpenOutlined as le,FolderOutlined as se,EyeOutlined as de,CloseOutlined as ce,HistoryOutlined as ue,ExclamationCircleOutlined as fe,FileImageOutlined as he,CheckCircleOutlined as me,ArrowRightOutlined as pe,ArrowLeftOutlined as ge,CheckOutlined as ve}from"@ant-design/icons";import{StyleProvider as ye}from"@ant-design/cssinjs";import{createPortal as we}from"react-dom";import{ThumbsUp as be,FolderSearch as Ce,FolderMinus as Ie,FolderPlus as Fe,SearchMd as Ae,Scale01 as _e,Crop02 as Se,FolderDownload as Ee,Copy04 as xe,TextInput as Pe,Trash03 as Re,ChevronDown as ke,Grid01 as Ne,List as Oe,DotsVertical as Te,Trash04 as Le,Lock01 as Me,Image03 as Ue,PlaySquare as je,Colors as De,QrCode02 as Be,Stars02 as ze,PlusCircle as qe,Link01 as Ve,RefreshCw05 as We}from"@untitledui/icons";import He from"browser-image-compression";import{Pixie as $e}from"pixie";const Ge=()=>e(Z,{style:{fontSize:48,height:"100%"},spin:!0}),Ke={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};function Qe(e,t){return t}function Je(e,t){return e.filter(e=>void 0!==e)}var Ye;function Ze(e){return"object"!=typeof e||null===e?0:Array.isArray(e)?2:function(e){if(!tt.includes(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(void 0===t)return!0;const o=t.prototype;if(null===o||"object"!=typeof o||!tt.includes(Object.prototype.toString.call(o)))return!1;if(!o.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)?1:e instanceof Set?3:e instanceof Map?4:5}function Xe(e,t){return"object"==typeof e&&Object.prototype.propertyIsEnumerable.call(e,t)}function et(e){let t=0,o=e[0]?.[Symbol.iterator]();return{[Symbol.iterator]:()=>({next(){for(;;){if(void 0===o)return{done:!0,value:void 0};const r=o.next();if(!0!==r.done)return{done:!1,value:r.value};t+=1,o=e[t]?.[Symbol.iterator]()}}})}}!function(e){e[e.NOT=0]="NOT",e[e.RECORD=1]="RECORD",e[e.ARRAY=2]="ARRAY",e[e.SET=3]="SET",e[e.MAP=4]="MAP",e[e.OTHER=5]="OTHER"}(Ye||(Ye={}));const tt=["[object Object]","[object Module]"];const ot={mergeRecords:function(e,t,o){const r={};for(const n of function(e){const t=new Set;for(const o of e)for(const e of[...Object.keys(o),...Object.getOwnPropertySymbols(o)])t.add(e);return t}(e)){const i=[];for(const t of e)Xe(t,n)&&i.push(t[n]);if(0===i.length)continue;const a=t.metaDataUpdater(o,{key:n,parents:e}),l=nt(i,t,a);l!==Ke.skip&&("__proto__"===n?Object.defineProperty(r,n,{value:l,configurable:!0,enumerable:!0,writable:!0}):r[n]=l)}return r},mergeArrays:function(e){return e.flat()},mergeSets:function(e){return new Set(et(e))},mergeMaps:function(e){return new Map(et(e))},mergeOthers:function(e){return e.at(-1)}};function rt(...e){return function(e,t){const o=function(e,t){return{defaultMergeFunctions:ot,mergeFunctions:{...ot,...Object.fromEntries(Object.entries(e).filter(([e,t])=>Object.hasOwn(ot,e)).map(([e,t])=>!1===t?[e,ot.mergeOthers]:[e,t]))},metaDataUpdater:e.metaDataUpdater??Qe,deepmerge:t,useImplicitDefaultMerging:e.enableImplicitDefaultMerging??!1,filterValues:!1===e.filterValues?void 0:e.filterValues??Je,actions:Ke}}(e,r);function r(...e){return nt(e,o,t)}return r}({})(...e)}function nt(e,t,o){const r=t.filterValues?.(e,o)??e;if(0===r.length)return;if(1===r.length)return it(r,t,o);const n=Ze(r[0]);if(0!==n&&5!==n)for(let e=1;e<r.length;e++)if(Ze(r[e])!==n)return it(r,t,o);switch(n){case 1:return function(e,t,o){const r=t.mergeFunctions.mergeRecords(e,t,o);if(r===Ke.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords)return t.defaultMergeFunctions.mergeRecords(e,t,o);return r}(r,t,o);case 2:return function(e,t,o){const r=t.mergeFunctions.mergeArrays(e,t,o);if(r===Ke.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays)return t.defaultMergeFunctions.mergeArrays(e);return r}(r,t,o);case 3:return function(e,t,o){const r=t.mergeFunctions.mergeSets(e,t,o);if(r===Ke.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets)return t.defaultMergeFunctions.mergeSets(e);return r}(r,t,o);case 4:return function(e,t,o){const r=t.mergeFunctions.mergeMaps(e,t,o);if(r===Ke.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps)return t.defaultMergeFunctions.mergeMaps(e);return r}(r,t,o);default:return it(r,t,o)}}function it(e,t,o){const r=t.mergeFunctions.mergeOthers(e,t,o);return r===Ke.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):r}const at="my_files",lt="gif",st="stock_images",dt="icons",ct="ai",ut="image_codes",ft="editor",ht="Trash",mt="light",pt="dark",gt="system",vt="(prefers-color-scheme: dark)",yt=!1,wt="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiBmaWxsPSIjRjVGNUY1Ii8+CjxwYXRoIGQ9Ik0yNCAzMkw0MCA0OEw1NiAzMkw2NCA0MEw2NCA2NEgyNFYzMloiIGZpbGw9IiNEOUQ5RDkiLz4KPC9zdmc+",bt=["jpg","jpeg","png","bmp","webp","svg","ico","tiff","tif"],Ct=["jpg","jpeg","png","bmp","webp","svg","ico","tiff","tif","gif"],It={keywords:"",color:"",orientation:""},Ft={hashed:!1,algorithm:y.defaultAlgorithm,token:{colorLink:"#1677ff",colorInfo:"#722ed1",colorTextBase:"#000000",colorBgLayout:"#f0f2f5",borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,colorDarken1:"rgba(0, 0, 0, 0.08)",colorFillSecondaryDarken:"rgba(0, 0, 0, 0.1)",formControlHeight:34,controlHeight:34,borderWidth:1,lineWidth:1,borderColorHover:"#C5C5C5",formItemMarginBottomMD:20,formItemMarginBottomXS:8,colorSecondaryH:265.03,colorSecondaryS:"63.92%",colorSecondaryL:"50%",colorSecondaryBgH:273,colorSecondaryBgS:"100%",colorSecondaryBgL:"93%",appZoom:1},components:{Progress:{remainingColor:"#ffffff"},Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}},At={hashed:!1,algorithm:y.darkAlgorithm,token:{colorBgBase:"#1F1F1F",colorInfo:"#9254de",colorLink:"#1890ff",colorLinkHover:"#69c0ff",wireframe:!1,borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,borderWidth:1,lineWidth:1,colorDarken1:"rgba(0, 0, 0, 0.9)",colorFillSecondaryDarken:"rgba(255, 255, 255, 0.16)",formControlHeight:34,controlHeight:34,borderColorHover:"rgba(255, 255, 255, 0.3)",formItemMarginBottomMD:20,formItemMarginBottomXS:8,appZoom:1},components:{Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}},_t=({externalTheme:t=mt,children:o,customThemeToken:r})=>{const n=matchMedia(vt).matches?pt:mt,l=t===gt?n:t,[s,d]=i(l),[c,u]=i("light"===s?Ft:At);return a(()=>{d(l)},[l]),a(()=>{const e="light"===s?Ft:At,t=r?rt(e.token,r):e.token;u(Object.assign(Object.assign({},e),{token:t}))},[u,s,r]),e(w,{theme:c,spin:{indicator:e(Ge,{})},modal:{mask:{blur:!1}},drawer:{mask:{blur:!1}},children:e(ye,{transformers:[],children:o})})},St={fileManager:{locale:"en_US",mode:"fileManager",theme:"light",enabledTabs:["editor"]},imageCenter:{locale:"en_US",mode:"imageCenter",theme:"light",enabledTabs:["stock","gif","editor"]},plugin:{locale:"en_US",mode:"plugin",theme:"light",enabledTabs:["editor","stock","gif","ai"]}},Et=(e="fileManager",t)=>"imageCenter"===e&&t?t:Object.assign({},St[e]);let xt=!1;const Pt=()=>{if(xt)return;window.addEventListener("error",e=>!(!e.message||!e.message.includes("ResizeObserver loop completed with undelivered notifications"))&&(e.stopImmediatePropagation(),e.preventDefault(),!0),!0);const e=window.onerror;window.onerror=(t,o,r,n,i)=>!("string"!=typeof t||!t.includes("ResizeObserver loop completed with undelivered notifications"))||!!e&&e(t,o,r,n,i),window.addEventListener("unhandledrejection",e=>{var t,o;(null===(o=null===(t=e.reason)||void 0===t?void 0:t.message)||void 0===o?void 0:o.includes("ResizeObserver loop completed with undelivered notifications"))&&e.preventDefault()});const t=console.error;if(console.error=(...e)=>{var o;((null===(o=e[0])||void 0===o?void 0:o.toString())||"").includes("ResizeObserver loop completed with undelivered notifications")||t.apply(console,e)},"undefined"!=typeof window){const e=()=>{try{["webpackHotUpdate","__webpack_require__","__webpack_hash__"].forEach(e=>{if(window[e]){const e=window.__webpack_require__;e&&"object"==typeof e&&null!==e&&"cache"in e&&console.warn("✅ Webpack detected, additional protection from ResizeObserver errors activated")}})}catch(e){console.warn("Error when searching for webpack objects:",e)}};e(),setTimeout(e,1e3)}xt=!0},Rt=()=>{xt=!1},kt=e=>{if(!e)return"image/png";const t=e.toLowerCase();return t.includes("jpeg")||t.includes("jpg")||t.includes("pjpeg")?"image/jpeg":t.includes("png")?"image/png":t.includes("gif")?"image/gif":t.includes("webp")?"image/webp":t.includes("svg")?"image/svg+xml":"image/png"},Nt=e=>{if(!e.startsWith("data:"))return null;const t=e.match(/^data:([^;,]+)/);return t?t[1]:null},Ot=(e,t="image/png")=>{let o=t;if("string"==typeof e&&e.startsWith("data:")){const t=Nt(e);t&&t.startsWith("image/")&&(o=t)}return kt(o)},Tt=e=>{const t=kt(e).split("/")[1];return"svg+xml"===t?"svg":t||"png"};function Lt(e){var t;switch(null===(t=e.trim().split(".").pop())||void 0===t?void 0:t.toLowerCase()){case"svg":return"image/svg+xml";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"webp":return"image/webp";default:return}}function Mt(e){var t,o,r,n;if(null===(o=null===(t=e.type)||void 0===t?void 0:t.startsWith)||void 0===o?void 0:o.call(t,"image/"))return!0;const i=(null!==(r=e.name)&&void 0!==r?r:"").trim();if(Lt(i))return!0;const a=(null!==(n=e.type)&&void 0!==n?n:"").toLowerCase();return!!a.includes("svg")||("text/xml"===a||"application/xml"===a||"text/plain"===a)&&i.toLowerCase().endsWith(".svg")}const Ut=/^data:(.+?);base64,(.+)$/i,jt=e=>{const t=(e=>{if("function"!=typeof globalThis.atob)throw new Error("Base64 decoding is not supported in the current environment.");return globalThis.atob(e)})(e),o=t.length,r=new Uint8Array(o);for(let e=0;e<o;e++)r[e]=t.charCodeAt(e);return r},Dt=(e,t)=>{const o=e.replace(/\s/g,""),r=jt(o),n=new ArrayBuffer(r.length);return new Uint8Array(n).set(r),new Blob([n],{type:t})},Bt=(e,t="application/octet-stream")=>{if(e instanceof Blob)return e;if("string"==typeof e){const o=e.trim(),r=o.match(Ut);if(r){const[,e,t]=r;return Dt(t,e)}return Dt(o,t)}throw new Error("Unsupported data type. Expected Blob or base64 string.")},zt={"а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"y","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"ts","ч":"ch","ш":"sh","щ":"sch","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"Y","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"Ts","Ч":"Ch","Ш":"Sh","Щ":"Sch","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya"},qt=/[<>:"/\\|?*()#\x00-\x1f]/g,Vt=/[\u2010-\u2015\u2212\uFE63\uFF0D]/g,Wt=/[\u00D7\u2715\u2716\u2A2F]/g,Ht=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,$t=/[\u00AD\u200B-\u200D\u2060\uFEFF]/g,Gt=/[\u2018\u2019\u201A\u201B\u00AB\u00BB\u201C\u201D\u201E\u201F'"`]/g,Kt=/[\u2022\u2044]/g;const Qt={transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0};function Jt(e,t){let o=e;return t.transliterate&&(o=o.normalize("NFC").split("").map(e=>{var t;return null!==(t=zt[e])&&void 0!==t?t:e}).join("")),o=o.normalize("NFKC"),o=function(e){return e.replace(/\u2026/g,"...").replace(Vt,"-").replace(Wt,"x").replace(Ht," ").replace($t,"").replace(Gt,"").replace(Kt,"-").replace(/\u00B7/g,"-").replace(/\u00A9/g,"c").replace(/\u00AE/g,"r").replace(/\u2122/g,"tm").replace(/\./g,"-")}(o),t.removeForbiddenChars&&(o=o.replace(qt,"_")),t.replaceSpaces&&(o=o.replace(/\s+/g,"_")),t.toLowerCase&&(o=o.toLowerCase()),o=o.replace(/_{2,}/g,"_"),o=o.replace(/^_+|_+$/g,""),o.length>255&&(o=o.substring(0,255)),o}function Yt(e,t){const o=Object.assign(Object.assign({},Qt),null==t?void 0:t.fileNameProcessing),r=e.lastIndexOf(".");let n,i;r>0?(n=e.substring(0,r),i=e.substring(r).toLowerCase()):(n=e,i="");return(Jt(n,o)||"unnamed_file")+i}function Zt(e,t){return Jt(e,Object.assign(Object.assign({},Qt),null==t?void 0:t.folderNameProcessing))||"unnamed_folder"}function Xt(e){return!0===(null==e?void 0:e.dedupeUploadNamesOnClient)}const eo=e=>"string"==typeof e,to=()=>{let e,t;const o=new Promise((o,r)=>{e=o,t=r});return o.resolve=e,o.reject=t,o},oo=e=>null==e?"":""+e,ro=/###/g,no=e=>e&&e.indexOf("###")>-1?e.replace(ro,"."):e,io=e=>!e||eo(e),ao=(e,t,o)=>{const r=eo(t)?t.split("."):t;let n=0;for(;n<r.length-1;){if(io(e))return{};const t=no(r[n]);!e[t]&&o&&(e[t]=new o),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++n}return io(e)?{}:{obj:e,k:no(r[n])}},lo=(e,t,o)=>{const{obj:r,k:n}=ao(e,t,Object);if(void 0!==r||1===t.length)return void(r[n]=o);let i=t[t.length-1],a=t.slice(0,t.length-1),l=ao(e,a,Object);for(;void 0===l.obj&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=ao(e,a,Object),l?.obj&&void 0!==l.obj[`${l.k}.${i}`]&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=o},so=(e,t)=>{const{obj:o,k:r}=ao(e,t);if(o&&Object.prototype.hasOwnProperty.call(o,r))return o[r]},co=(e,t,o)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?eo(e[r])||e[r]instanceof String||eo(t[r])||t[r]instanceof String?o&&(e[r]=t[r]):co(e[r],t[r],o):e[r]=t[r]);return e},uo=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var fo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const ho=e=>eo(e)?e.replace(/[&<>"'\/]/g,e=>fo[e]):e;const mo=[" ",",","?","!",";"],po=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const o=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,o),this.regExpQueue.push(e),o}}(20),go=(e,t,o=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const r=t.split(o);let n=e;for(let e=0;e<r.length;){if(!n||"object"!=typeof n)return;let t,i="";for(let a=e;a<r.length;++a)if(a!==e&&(i+=o),i+=r[a],t=n[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&a<r.length-1)continue;e+=a-e+1;break}n=t}return n},vo=e=>e?.replace("_","-"),yo={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class wo{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||yo,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,o,r){return r&&!this.debug?null:(eo(e[0])&&(e[0]=`${o}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new wo(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new wo(this.logger,e)}}var bo=new wo;class Co{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const o=this.observers[e].get(t)||0;this.observers[e].set(t,o+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,o])=>{for(let r=0;r<o;r++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([o,r])=>{for(let n=0;n<r;n++)o.apply(o,[e,...t])})}}}class Io extends Co{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,o,r={}){const n=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],o&&(Array.isArray(o)?a.push(...o):eo(o)&&n?a.push(...o.split(n)):a.push(o)));const l=so(this.data,a);return!l&&!t&&!o&&e.indexOf(".")>-1&&(e=a[0],t=a[1],o=a.slice(2).join(".")),!l&&i&&eo(o)?go(this.data?.[e]?.[t],o,n):l}addResource(e,t,o,r,n={silent:!1}){const i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator;let a=[e,t];o&&(a=a.concat(i?o.split(i):o)),e.indexOf(".")>-1&&(a=e.split("."),r=t,t=a[1]),this.addNamespaces(t),lo(this.data,a,r),n.silent||this.emit("added",e,t,o,r)}addResources(e,t,o,r={silent:!1}){for(const r in o)(eo(o[r])||Array.isArray(o[r]))&&this.addResource(e,t,r,o[r],{silent:!0});r.silent||this.emit("added",e,t,o)}addResourceBundle(e,t,o,r,n,i={silent:!1,skipCopy:!1}){let a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),r=o,o=t,t=a[1]),this.addNamespaces(t);let l=so(this.data,a)||{};i.skipCopy||(o=JSON.parse(JSON.stringify(o))),r?co(l,o,n):l={...l,...o},lo(this.data,a,l),i.silent||this.emit("added",e,t,o)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var Fo={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,o,r,n){return e.forEach(e=>{t=this.processors[e]?.process(t,o,r,n)??t}),t}};const Ao=Symbol("i18next/PATH_KEY");function _o(e,t){const{[Ao]:o}=e(function(){const e=[],t=Object.create(null);let o;return t.get=(r,n)=>(o?.revoke?.(),n===Ao?e:(e.push(n),o=Proxy.revocable(r,t),o.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return o.join(t?.keySeparator??".")}const So={},Eo=e=>!eo(e)&&"boolean"!=typeof e&&"number"!=typeof e;class xo extends Co{constructor(e,t={}){var o,r;super(),o=e,r=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{o[e]&&(r[e]=o[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=bo.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const o={...t};if(null==e)return!1;const r=this.resolve(e,o);return void 0!==r?.res}extractFromKey(e,t){let o=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===o&&(o=":");const r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const i=o&&e.indexOf(o)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,o)=>{t=t||"",o=o||"";const r=mo.filter(e=>t.indexOf(e)<0&&o.indexOf(e)<0);if(0===r.length)return!0;const n=po.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`);let i=!n.test(e);if(!i){const t=e.indexOf(o);t>0&&!n.test(e.substring(0,t))&&(i=!0)}return i})(e,o,r));if(i&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:eo(n)?[n]:n};const i=e.split(o);(o!==r||o===r&&this.options.ns.indexOf(i[0])>-1)&&(n=i.shift()),e=i.join(r)}return{key:e,namespaces:eo(n)?[n]:n}}translate(e,t,o){let r="object"==typeof t?{...t}:t;if("object"!=typeof r&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof r&&(r={...r}),r||(r={}),null==e)return"";"function"==typeof e&&(e=_o(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]);const n=void 0!==r.returnDetails?r.returnDetails:this.options.returnDetails,i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],r),s=l[l.length-1];let d=void 0!==r.nsSeparator?r.nsSeparator:this.options.nsSeparator;void 0===d&&(d=":");const c=r.lng||this.language,u=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===c?.toLowerCase())return u?n?{res:`${s}${d}${a}`,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(r)}:`${s}${d}${a}`:n?{res:a,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(r)}:a;const f=this.resolve(e,r);let h=f?.res;const m=f?.usedKey||a,p=f?.exactUsedKey||a,g=void 0!==r.joinArrays?r.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==r.count&&!eo(r.count),w=xo.hasDefaultValue(r),b=y?this.pluralResolver.getSuffix(c,r.count,r):"",C=r.ordinal&&y?this.pluralResolver.getSuffix(c,r.count,{ordinal:!1}):"",I=y&&!r.ordinal&&0===r.count,F=I&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${b}`]||r[`defaultValue${C}`]||r.defaultValue;let A=h;v&&!h&&w&&(A=F);const _=Eo(A),S=Object.prototype.toString.apply(A);if(!(v&&A&&_&&["[object Number]","[object Function]","[object RegExp]"].indexOf(S)<0)||eo(g)&&Array.isArray(A))if(v&&eo(g)&&Array.isArray(h))h=h.join(g),h&&(h=this.extendTranslation(h,e,r,o));else{let t=!1,n=!1;!this.isValidLookup(h)&&w&&(t=!0,h=F),this.isValidLookup(h)||(n=!0,h=a);const l=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:h,u=w&&F!==h&&this.options.updateMissing;if(n||t||u){if(this.logger.log(u?"updateKey":"missingKey",c,s,a,u?F:h),i){const e=this.resolve(a,{...r,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let o=0;o<t.length;o++)e.push(t[o]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(r.lng||this.language):e.push(r.lng||this.language);const o=(e,t,o)=>{const n=w&&o!==h?o:l;this.options.missingKeyHandler?this.options.missingKeyHandler(e,s,t,n,u,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,s,t,n,u,r),this.emit("missingKey",e,s,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,r);I&&r[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{o([e],a+t,r[`defaultValue${t}`]||F)})}):o(e,a,F))}h=this.extendTranslation(h,e,r,f,o),n&&h===a&&this.options.appendNamespaceToMissingKey&&(h=`${s}${d}${a}`),(n||t)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}${d}${a}`:a,t?h:void 0,r))}else{if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,A,{...r,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return n?(f.res=e,f.usedParams=this.getUsedParamsDetails(r),f):e}if(i){const e=Array.isArray(A),t=e?[]:{},o=e?p:m;for(const e in A)if(Object.prototype.hasOwnProperty.call(A,e)){const n=`${o}${i}${e}`;t[e]=w&&!h?this.translate(n,{...r,defaultValue:Eo(F)?F[e]:void 0,joinArrays:!1,ns:l}):this.translate(n,{...r,joinArrays:!1,ns:l}),t[e]===n&&(t[e]=A[e])}h=t}}return n?(f.res=h,f.usedParams=this.getUsedParamsDetails(r),f):h}extendTranslation(e,t,o,r,n){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const i=eo(e)&&(void 0!==o?.interpolation?.skipOnVariables?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(i){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let l=o.replace&&!eo(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,o.lng||this.language||r.usedLng,o),i){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(o.nest=!1)}!o.lng&&r&&r.res&&(o.lng=this.language||r.usedLng),!1!==o.nest&&(e=this.interpolator.nest(e,(...e)=>n?.[0]!==e[0]||o.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),o)),o.interpolation&&this.interpolator.reset()}const i=o.postProcess||this.options.postProcess,a=eo(i)?[i]:i;return null!=e&&a?.length&&!1!==o.applyPostProcessor&&(e=Fo.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),e}resolve(e,t={}){let o,r,n,i,a;return eo(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(o))return;const l=this.extractFromKey(e,t),s=l.key;r=s;let d=l.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const c=void 0!==t.count&&!eo(t.count),u=c&&!t.ordinal&&0===t.count,f=void 0!==t.context&&(eo(t.context)||"number"==typeof t.context)&&""!==t.context,h=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);d.forEach(e=>{this.isValidLookup(o)||(a=e,So[`${h[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(a)||(So[`${h[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${h.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach(r=>{if(this.isValidLookup(o))return;i=r;const a=[s];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(a,s,r,e,t);else{let e;c&&(e=this.pluralResolver.getSuffix(r,t.count,t));const o=`${this.options.pluralSeparator}zero`,n=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(t.ordinal&&0===e.indexOf(n)&&a.push(s+e.replace(n,this.options.pluralSeparator)),a.push(s+e),u&&a.push(s+o)),f){const r=`${s}${this.options.contextSeparator||"_"}${t.context}`;a.push(r),c&&(t.ordinal&&0===e.indexOf(n)&&a.push(r+e.replace(n,this.options.pluralSeparator)),a.push(r+e),u&&a.push(r+o))}}let l;for(;l=a.pop();)this.isValidLookup(o)||(n=l,o=this.getResource(r,e,l,t))}))})}),{res:o,usedKey:r,exactUsedKey:n,usedLng:i,usedNS:a}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,o,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,o,r):this.resourceStore.getResource(e,t,o,r)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=e.replace&&!eo(e.replace);let r=o?e.replace:e;if(o&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!o){r={...r};for(const e of t)delete r[e]}return r}static hasDefaultValue(e){const t="defaultValue";for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&t===o.substring(0,12)&&void 0!==e[o])return!0;return!1}}class Po{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=bo.create("languageUtils")}getScriptPartFromCode(e){if(!(e=vo(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=vo(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(eo(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const o=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(o)||(t=o)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const o=this.getScriptPartFromCode(e);if(this.isSupportedCode(o))return t=o;const r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?e:e.indexOf("-")<0&&r.indexOf("-")<0?void 0:e.indexOf("-")>0&&r.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===r||0===e.indexOf(r)&&r.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),eo(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let o=e[t];return o||(o=e[this.getScriptPartFromCode(t)]),o||(o=e[this.formatLanguageCode(t)]),o||(o=e[this.getLanguagePartFromCode(t)]),o||(o=e.default),o||[]}toResolveHierarchy(e,t){const o=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),r=[],n=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return eo(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&n(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&n(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&n(this.getLanguagePartFromCode(e))):eo(e)&&n(this.formatLanguageCode(e)),o.forEach(e=>{r.indexOf(e)<0&&n(this.formatLanguageCode(e))}),r}}const Ro={zero:0,one:1,two:2,few:3,many:4,other:5},ko={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class No{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=bo.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const o=vo("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:o,type:r});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let i;try{i=new Intl.PluralRules(o,{type:r})}catch(o){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),ko;if(!e.match(/-|_/))return ko;const r=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(r,t)}return this.pluralRulesCache[n]=i,i}needsPlural(e,t={}){let o=this.getRule(e,t);return o||(o=this.getRule("dev",t)),o?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,o={}){return this.getSuffixes(e,o).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let o=this.getRule(e,t);return o||(o=this.getRule("dev",t)),o?o.resolvedOptions().pluralCategories.sort((e,t)=>Ro[e]-Ro[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,o={}){const r=this.getRule(e,o);return r?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,o))}}const Oo=(e,t,o,r=".",n=!0)=>{let i=((e,t,o)=>{const r=so(e,o);return void 0!==r?r:so(t,o)})(e,t,o);return!i&&n&&eo(o)&&(i=go(e,o,r),void 0===i&&(i=go(t,o,r))),i},To=e=>e.replace(/\$/g,"$$$$");class Lo{constructor(e={}){this.logger=bo.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:o,useRawValueToEscape:r,prefix:n,prefixEscaped:i,suffix:a,suffixEscaped:l,formatSeparator:s,unescapeSuffix:d,unescapePrefix:c,nestingPrefix:u,nestingPrefixEscaped:f,nestingSuffix:h,nestingSuffixEscaped:m,nestingOptionsSeparator:p,maxReplaces:g,alwaysFormat:v}=e.interpolation;this.escape=void 0!==t?t:ho,this.escapeValue=void 0===o||o,this.useRawValueToEscape=void 0!==r&&r,this.prefix=n?uo(n):i||"{{",this.suffix=a?uo(a):l||"}}",this.formatSeparator=s||",",this.unescapePrefix=d?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=u?uo(u):f||uo("$t("),this.nestingSuffix=h?uo(h):m||uo(")"),this.nestingOptionsSeparator=p||",",this.maxReplaces=g||1e3,this.alwaysFormat=void 0!==v&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,o,r){let n,i,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},s=e=>{if(e.indexOf(this.formatSeparator)<0){const n=Oo(t,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(n,void 0,o,{...r,...t,interpolationkey:e}):n}const n=e.split(this.formatSeparator),i=n.shift().trim(),a=n.join(this.formatSeparator).trim();return this.format(Oo(t,l,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,o,{...r,...t,interpolationkey:i})};this.resetRegExp();const d=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,c=void 0!==r?.interpolation?.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>To(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?To(this.escape(e)):To(e)}].forEach(t=>{for(a=0;n=t.regex.exec(e);){const o=n[1].trim();if(i=s(o),void 0===i)if("function"==typeof d){const t=d(e,n,r);i=eo(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,o))i="";else{if(c){i=n[0];continue}this.logger.warn(`missed to pass in variable ${o} for interpolating ${e}`),i=""}else eo(i)||this.useRawValueToEscape||(i=oo(i));const l=t.safeValue(i);if(e=e.replace(n[0],l),c?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=n[0].length):t.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,o={}){let r,n,i;const a=(e,t)=>{const o=this.nestingOptionsSeparator;if(e.indexOf(o)<0)return e;const r=e.split(new RegExp(`${o}[ ]*{`));let n=`{${r[1]}`;e=r[0],n=this.interpolate(n,i);const a=n.match(/'/g),l=n.match(/"/g);((a?.length??0)%2==0&&!l||l.length%2!=0)&&(n=n.replace(/'/g,'"'));try{i=JSON.parse(n),t&&(i={...t,...i})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${o}${n}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let l=[];i={...o},i=i.replace&&!eo(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const s=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(-1!==s&&(l=r[1].slice(s).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,s)),n=t(a.call(this,r[1].trim(),i),i),n&&r[0]===e&&!eo(n))return n;eo(n)||(n=oo(n)),n||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),n=""),l.length&&(n=l.reduce((e,t)=>this.format(e,t,o.lng,{...o,interpolationkey:r[1].trim()}),n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}const Mo=e=>{const t={};return(o,r,n)=>{let i=n;n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]&&(i={...i,[n.interpolationkey]:void 0});const a=r+JSON.stringify(i);let l=t[a];return l||(l=e(vo(r),n),t[a]=l),l(o)}},Uo=e=>(t,o,r)=>e(vo(o),r)(t);class jo{constructor(e={}){this.logger=bo.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const o=t.cacheInBuiltFormats?Mo:Uo;this.formats={number:o((e,t)=>{const o=new Intl.NumberFormat(e,{...t});return e=>o.format(e)}),currency:o((e,t)=>{const o=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>o.format(e)}),datetime:o((e,t)=>{const o=new Intl.DateTimeFormat(e,{...t});return e=>o.format(e)}),relativetime:o((e,t)=>{const o=new Intl.RelativeTimeFormat(e,{...t});return e=>o.format(e,t.range||"day")}),list:o((e,t)=>{const o=new Intl.ListFormat(e,{...t});return e=>o.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Mo(t)}format(e,t,o,r={}){const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(e=>e.indexOf(")")>-1)){const e=n.findIndex(e=>e.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,e)].join(this.formatSeparator)}const i=n.reduce((e,t)=>{const{formatName:n,formatOptions:i}=(e=>{let t=e.toLowerCase().trim();const o={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const n=r[1].substring(0,r[1].length-1);"currency"===t&&n.indexOf(":")<0?o.currency||(o.currency=n.trim()):"relativetime"===t&&n.indexOf(":")<0?o.range||(o.range=n.trim()):n.split(";").forEach(e=>{if(e){const[t,...r]=e.split(":"),n=r.join(":").trim().replace(/^'+|'+$/g,""),i=t.trim();o[i]||(o[i]=n),"false"===n&&(o[i]=!1),"true"===n&&(o[i]=!0),isNaN(n)||(o[i]=parseInt(n,10))}})}return{formatName:t,formatOptions:o}})(t);if(this.formats[n]){let t=e;try{const a=r?.formatParams?.[r.interpolationkey]||{},l=a.locale||a.lng||r.locale||r.lng||o;t=this.formats[n](e,l,{...i,...r,...a})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${n}`),e},e);return i}}class Do extends Co{constructor(e,t,o,r={}){super(),this.backend=e,this.store=t,this.services=o,this.languageUtils=o.languageUtils,this.options=r,this.logger=bo.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(o,r.backend,r)}queueLoad(e,t,o,r){const n={},i={},a={},l={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const a=`${e}|${t}`;!o.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,r=!1,void 0===i[a]&&(i[a]=!0),void 0===n[a]&&(n[a]=!0),void 0===l[t]&&(l[t]=!0)))}),r||(a[e]=!0)}),(Object.keys(n).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(n),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,o){const r=e.split("|"),n=r[0],i=r[1];t&&this.emit("failedLoading",n,i,t),!t&&o&&this.store.addResourceBundle(n,i,o,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&o&&(this.state[e]=0);const a={};this.queue.forEach(o=>{((e,t,o)=>{const{obj:r,k:n}=ao(e,t,Object);r[n]=r[n]||[],r[n].push(o)})(o.loaded,[n],i),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(o,e),t&&o.errors.push(t),0!==o.pendingCount||o.done||(Object.keys(o.loaded).forEach(e=>{a[e]||(a[e]={});const t=o.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),o.done=!0,o.errors.length?o.callback(o.errors):o.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,o,r=0,n=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:o,tried:r,wait:n,callback:i});this.readingCalls++;const a=(a,l)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}a&&l&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,o,r+1,2*n,i)},n):i(a,l)},l=this.backend[o].bind(this.backend);if(2!==l.length)return l(e,t,a);try{const o=l(e,t);o&&"function"==typeof o.then?o.then(e=>a(null,e)).catch(a):a(null,o)}catch(e){a(e)}}prepareLoading(e,t,o={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();eo(e)&&(e=this.languageUtils.toResolveHierarchy(e)),eo(t)&&(t=[t]);const n=this.queueLoad(e,t,o,r);if(!n.toLoad.length)return n.pending.length||r(),null;n.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,o){this.prepareLoading(e,t,{},o)}reload(e,t,o){this.prepareLoading(e,t,{reload:!0},o)}loadOne(e,t=""){const o=e.split("|"),r=o[0],n=o[1];this.read(r,n,"read",void 0,void 0,(o,i)=>{o&&this.logger.warn(`${t}loading namespace ${n} for language ${r} failed`,o),!o&&i&&this.logger.log(`${t}loaded namespace ${n} for language ${r}`,i),this.loaded(e,o,i)})}saveMissing(e,t,o,r,n,i={},a=()=>{}){if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=o&&""!==o){if(this.backend?.create){const l={...i,isUpdate:n},s=this.backend.create.bind(this.backend);if(s.length<6)try{let n;n=5===s.length?s(e,t,o,r,l):s(e,t,o,r),n&&"function"==typeof n.then?n.then(e=>a(null,e)).catch(a):a(null,n)}catch(e){a(e)}else s(e,t,o,r,a,l)}e&&e[0]&&this.store.addResource(e[0],t,o,r)}}else this.logger.warn(`did not save key "${o}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const Bo=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),eo(e[1])&&(t.defaultValue=e[1]),eo(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const o=e[3]||e[2];Object.keys(o).forEach(e=>{t[e]=o[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),zo=e=>(eo(e.ns)&&(e.ns=[e.ns]),eo(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),eo(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),qo=()=>{};class Vo extends Co{constructor(e={},t){var o;if(super(),this.options=zo(e),this.services={},this.logger=bo,this.modules={external:[]},o=this,Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach(e=>{"function"==typeof o[e]&&(o[e]=o[e].bind(o))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(eo(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const o=Bo();this.options={...o,...this.options,...zo(e)},this.options.interpolation={...o.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);const r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?bo.init(r(this.modules.logger),this.options):bo.init(null,this.options),e=this.modules.formatter?this.modules.formatter:jo;const t=new Po(this.options);this.store=new Io(this.options.resources,this.options);const n=this.services;n.logger=bo,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new No(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!e||this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format||(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new Lo(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Do(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new xo(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=qo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const n=to(),i=()=>{const e=(e,o)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),n.resolve(o),t(e,o)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?i():setTimeout(i,0),n}loadResources(e,t=qo){let o=t;const r=eo(e)?e:this.language;if("function"==typeof e&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===r?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return o();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(r)t(r);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),o(e)})}else o(null)}reloadResources(e,t,o){const r=to();return"function"==typeof e&&(o=e,e=void 0),"function"==typeof t&&(o=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),o||(o=qo),this.services.backendConnector.reload(e,t,e=>{r.resolve(),o(e)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Fo.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const o=to();this.emit("languageChanging",e);const r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},n=(n,i)=>{i?this.isLanguageChangingTo===e&&(r(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,o.resolve((...e)=>this.t(...e)),t&&t(n,(...e)=>this.t(...e))},i=t=>{e||t||!this.services.languageDetector||(t=[]);const o=eo(t)?t:t&&t[0],i=this.store.hasLanguageSomeTranslations(o)?o:this.services.languageUtils.getBestMatchFromCodes(eo(t)?[t]:t);i&&(this.language||r(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,e=>{n(e,i)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),o}getFixedT(e,t,o){const r=(e,t,...n)=>{let i;i="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(n)):{...t},i.lng=i.lng||r.lng,i.lngs=i.lngs||r.lngs,i.ns=i.ns||r.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||o||r.keyPrefix);const a=this.options.keySeparator||".";let l;return i.keyPrefix&&Array.isArray(e)?l=e.map(e=>("function"==typeof e&&(e=_o(e,{...this.options,...t})),`${i.keyPrefix}${a}${e}`)):("function"==typeof e&&(e=_o(e,{...this.options,...t})),l=i.keyPrefix?`${i.keyPrefix}${a}${e}`:e),this.t(l,i)};return eo(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=o,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===o.toLowerCase())return!0;const i=(e,t)=>{const o=this.services.backendConnector.state[`${e}|${t}`];return-1===o||0===o||2===o};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(o,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(o,e)||r&&!i(n,e)))}loadNamespaces(e,t){const o=to();return this.options.ns?(eo(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{o.resolve(),t&&t(e)}),o):(t&&t(),Promise.resolve())}loadLanguages(e,t){const o=to();eo(e)&&(e=[e]);const r=this.options.preload||[],n=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return n.length?(this.options.preload=r.concat(n),this.loadResources(e=>{o.resolve(),t&&t(e)}),o):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}const t=this.services?.languageUtils||new Po(Bo());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new Vo(e,t)}cloneInstance(e={},t=qo){const o=e.forkResourceStore;o&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},n=new Vo(r);void 0===e.debug&&void 0===e.prefix||(n.logger=n.logger.clone(e));if(["store","services","language"].forEach(e=>{n[e]=this[e]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},o){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((o,r)=>(o[r]={...e[t][r]},o),e[t]),e),{});n.store=new Io(e,r),n.services.resourceStore=n.store}return n.translator=new xo(n.services,r),n.translator.on("*",(e,...t)=>{n.emit(e,...t)}),n.init(r,t),n.translator.options=r,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Wo=Vo.createInstance();Wo.createInstance=Vo.createInstance,Wo.createInstance,Wo.dir,Wo.init,Wo.loadResources,Wo.reloadResources,Wo.use,Wo.changeLanguage,Wo.getFixedT,Wo.t,Wo.exists,Wo.setDefaultNamespace,Wo.hasLoadedNamespace,Wo.loadNamespaces,Wo.loadLanguages;var Ho="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Go(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var o=function e(){var o=!1;try{o=this instanceof e}catch{}return o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};o.prototype=t.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),o}const Ko={},Qo=(e,t,o,r)=>{Xo(o)&&Ko[o]||(Xo(o)&&(Ko[o]=new Date),((e,t,o,r)=>{const n=[o,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(n,"warn","react-i18next::",!0);Xo(n[0])&&(n[0]=`react-i18next:: ${n[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...n):console?.warn&&console.warn(...n)})(e,t,o,r))},Jo=(e,t)=>()=>{if(e.isInitialized)t();else{const o=()=>{setTimeout(()=>{e.off("initialized",o)},0),t()};e.on("initialized",o)}},Yo=(e,t,o)=>{e.loadNamespaces(t,Jo(e,o))},Zo=(e,t,o,r)=>{if(Xo(o)&&(o=[o]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Yo(e,o,r);o.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,Jo(e,r))},Xo=e=>"string"==typeof e,er=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,tr={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},or=e=>tr[e];let rr={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(er,or)};let nr;const ir={type:"3rdParty",init(e){((e={})=>{rr={...rr,...e}})(e.options.react),(e=>{nr=e})(e)}},ar=l();class lr{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const sr=(e,t,o,r)=>e.getFixedT(t,o,r),dr=(e,t={})=>{const{i18n:o}=t,{i18n:r,defaultNS:n}=s(ar)||{},l=o||r||nr;if(l&&!l.reportNamespaces&&(l.reportNamespaces=new lr),!l){Qo(l,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const e=(e,t)=>{return Xo(t)?t:"object"==typeof(o=t)&&null!==o&&Xo(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e;var o},t=[e,{},!1];return t.t=e,t.i18n={},t.ready=!1,t}l.options.react?.wait&&Qo(l,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const u={...rr,...l.options.react,...t},{useSuspense:f,keyPrefix:h}=u;let m=n||l.options?.defaultNS;m=Xo(m)?[m]:m||["translation"],l.reportNamespaces.addUsedNamespaces?.(m);const p=(l.isInitialized||l.initializedStoreOnce)&&m.every(e=>((e,t,o={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:o.lng,precheck:(t,r)=>{if(o.bindI18n&&o.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):(Qo(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,l,u)),g=((e,t,o,r)=>d(sr(e,t,o,r),[e,t,o,r]))(l,t.lng||null,"fallback"===u.nsMode?m:m[0],h),v=()=>g,y=()=>sr(l,t.lng||null,"fallback"===u.nsMode?m:m[0],h),[w,b]=i(v);let C=m.join();t.lng&&(C=`${t.lng}${C}`);const I=((e,t)=>{const o=c();return a(()=>{o.current=e},[e,t]),o.current})(C),F=c(!0);a(()=>{const{bindI18n:e,bindI18nStore:o}=u;F.current=!0,p||f||(t.lng?Zo(l,t.lng,m,()=>{F.current&&b(y)}):Yo(l,m,()=>{F.current&&b(y)})),p&&I&&I!==C&&F.current&&b(y);const r=()=>{F.current&&b(y)};return e&&l?.on(e,r),o&&l?.store.on(o,r),()=>{F.current=!1,l&&e&&e?.split(" ").forEach(e=>l.off(e,r)),o&&l&&o.split(" ").forEach(e=>l.store.off(e,r))}},[l,C]),a(()=>{F.current&&p&&b(v)},[l,h,p]);const A=[w,l,p];if(A.t=w,A.i18n=l,A.ready=p,p)return A;if(!p&&!f)return A;throw new Promise(e=>{t.lng?Zo(l,t.lng,m,()=>e()):Yo(l,m,()=>e())})};function cr({i18n:e,defaultNS:t,children:o}){const r=u(()=>({i18n:e,defaultNS:t}),[e,t]);return f(ar.Provider,{value:r},o)}var ur={};function fr(e){return fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fr(e)}function hr(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mr(r.key),r)}}function mr(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function pr(e,t){return function(e,t){if(t.get)return t.get.call(e);return t.value}(e,vr(e,t,"get"))}function gr(e,t,o){return function(e,t,o){if(t.set)t.set.call(e,o);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=o}}(e,vr(e,t,"set"),o),o}function vr(e,t,o){if(!t.has(e))throw new TypeError("attempted to "+o+" private field on non-instance");return t.get(e)}function yr(e,t,o){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,o)}var wr=function(e){if(!e)return[];Array.isArray(e)||(e=[e]);for(var t={},o=0;o<e.length;++o){var r,n=e[o];if(n&&"object"===fr(n)&&(n=String(n)),"string"!=typeof n){var i="Locales should be strings, ".concat(JSON.stringify(n)," isn't.");throw new TypeError(i)}var a=n.split("-");if(!a.every(function(e){return/[a-z0-9]+/i.test(e)})){var l=JSON.stringify(n),s="The locale ".concat(l," is not a structurally valid BCP 47 language tag.");throw new RangeError(s)}var d=a[0].toLowerCase();a[0]=null!==(r={in:"id",iw:"he",ji:"yi"}[d])&&void 0!==r?r:d,t[a.join("-")]=!0}return Object.keys(t)};function br(e){switch(fr(e)){case"number":return e;case"bigint":throw new TypeError("Cannot convert a BigInt value to a number");default:return Number(e)}}var Cr,Ir,Fr,Ar=Object.freeze({__proto__:null,default:function(e,t,o,r){var n=function(e){do{if(t(e))return e;e=e.replace(/-?[^-]*$/,"")}while(e);return null},i=new WeakMap,a=new WeakMap,l=new WeakMap,s=new WeakMap,d=new WeakMap,c=function(){function c(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),yr(this,i,{writable:!0,value:void 0}),yr(this,a,{writable:!0,value:void 0}),yr(this,l,{writable:!0,value:void 0}),yr(this,s,{writable:!0,value:void 0}),yr(this,d,{writable:!0,value:void 0}),gr(this,i,function(t){for(var o=wr(t),r=0;r<o.length;++r){var i=n(o[r]);if(i)return i}var a=(new e).resolvedOptions().locale;return n(a)}(o)),gr(this,l,t(pr(this,i))),gr(this,a,r(pr(this,i))),gr(this,s,function(e){var t=Object.prototype.hasOwnProperty.call(e,"type")&&e.type;if(!t)return"cardinal";if("cardinal"===t||"ordinal"===t)return t;throw new RangeError("Not a valid plural type: "+JSON.stringify(t))}(u)),gr(this,d,new e("en",u))}var u,f,h;return u=c,h=[{key:"supportedLocalesOf",value:function(e){return wr(e).filter(n)}}],(f=[{key:"resolvedOptions",value:function(){var e=pr(this,d).resolvedOptions(),t=e.minimumIntegerDigits,r=e.minimumFractionDigits,n=e.maximumFractionDigits,a=e.minimumSignificantDigits,l=e.maximumSignificantDigits,c=e.roundingPriority,u={locale:pr(this,i),type:pr(this,s),minimumIntegerDigits:t,minimumFractionDigits:r,maximumFractionDigits:n};return"number"==typeof a&&(u.minimumSignificantDigits=a,u.maximumSignificantDigits=l),u.pluralCategories=o(pr(this,i),"ordinal"===pr(this,s)).slice(0),u.roundingPriority=c||"auto",u}},{key:"select",value:function(e){if(!(this instanceof c))throw new TypeError("select() called on incompatible ".concat(this));if("number"!=typeof e&&(e=Number(e)),!isFinite(e))return"other";var t=pr(this,d).format(Math.abs(e));return pr(this,l).call(this,t,"ordinal"===pr(this,s))}},{key:"selectRange",value:function(e,t){if(!(this instanceof c))throw new TypeError("selectRange() called on incompatible ".concat(this));if(void 0===e)throw new TypeError("start is undefined");if(void 0===t)throw new TypeError("end is undefined");var o=br(e),r=br(t);if(!isFinite(o))throw new RangeError("start must be finite");if(!isFinite(r))throw new RangeError("end must be finite");return pr(this,a).call(this,this.select(o),this.select(r))}}])&&hr(u.prototype,f),h&&hr(u,h),Object.defineProperty(u,"prototype",{writable:!1}),c}();return"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(c.prototype,Symbol.toStringTag,{value:"Intl.PluralRules",writable:!1,configurable:!0}),Object.defineProperty(c,"prototype",{writable:!1}),c}}),_r=Go(Ar);!function(){if(Fr)return ur;Fr=1;var e=function(){if(Ir)return Cr;function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(o){if("default"!==o&&!(o in e)){var r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:function(){return t[o]}})}})}),Object.freeze(e)}Ir=1;var o=e(_r);function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==Ho||"undefined"!=typeof self&&self;var n,i,a,l,s,d,c,u={exports:{}};n=u,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),n.exports=t}(0,{af:i=function(e,t){return t?"other":1==e?"one":"other"},ak:a=function(e,t){return t?"other":0==e||1==e?"one":"other"},am:l=function(e,t){return t?"other":e>=0&&e<=1?"one":"other"},an:i,ar:function(e,t){var o=String(e).split("."),r=Number(o[0])==e&&o[0].slice(-2);return t?"other":0==e?"zero":1==e?"one":2==e?"two":r>=3&&r<=10?"few":r>=11&&r<=99?"many":"other"},ars:function(e,t){var o=String(e).split("."),r=Number(o[0])==e&&o[0].slice(-2);return t?"other":0==e?"zero":1==e?"one":2==e?"two":r>=3&&r<=10?"few":r>=11&&r<=99?"many":"other"},as:function(e,t){return t?1==e||5==e||7==e||8==e||9==e||10==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},asa:i,ast:s=function(e,t){var o=!String(e).split(".")[1];return t?"other":1==e&&o?"one":"other"},az:function(e,t){var o=String(e).split(".")[0],r=o.slice(-1),n=o.slice(-2),i=o.slice(-3);return t?1==r||2==r||5==r||7==r||8==r||20==n||50==n||70==n||80==n?"one":3==r||4==r||100==i||200==i||300==i||400==i||500==i||600==i||700==i||800==i||900==i?"few":0==o||6==r||40==n||60==n||90==n?"many":"other":1==e?"one":"other"},bal:function(e,t){return 1==e?"one":"other"},be:function(e,t){var o=String(e).split("."),r=Number(o[0])==e,n=r&&o[0].slice(-1),i=r&&o[0].slice(-2);return t?2!=n&&3!=n||12==i||13==i?"other":"few":1==n&&11!=i?"one":n>=2&&n<=4&&(i<12||i>14)?"few":r&&0==n||n>=5&&n<=9||i>=11&&i<=14?"many":"other"},bem:i,bez:i,bg:i,bho:a,bm:d=function(e,t){return"other"},bn:function(e,t){return t?1==e||5==e||7==e||8==e||9==e||10==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},bo:d,br:function(e,t){var o=String(e).split("."),r=Number(o[0])==e,n=r&&o[0].slice(-1),i=r&&o[0].slice(-2),a=r&&o[0].slice(-6);return t?"other":1==n&&11!=i&&71!=i&&91!=i?"one":2==n&&12!=i&&72!=i&&92!=i?"two":(3==n||4==n||9==n)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":0!=e&&r&&0==a?"many":"other"},brx:i,bs:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-1),l=r.slice(-2),s=n.slice(-1),d=n.slice(-2);return t?"other":i&&1==a&&11!=l||1==s&&11!=d?"one":i&&a>=2&&a<=4&&(l<12||l>14)||s>=2&&s<=4&&(d<12||d>14)?"few":"other"},ca:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-6);return t?1==e||3==e?"one":2==e?"two":4==e?"few":"other":1==e&&n?"one":0!=r&&0==i&&n?"many":"other"},ce:i,ceb:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-1),l=n.slice(-1);return t?"other":i&&(1==r||2==r||3==r)||i&&4!=a&&6!=a&&9!=a||!i&&4!=l&&6!=l&&9!=l?"one":"other"},cgg:i,chr:i,ckb:i,cs:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1];return t?"other":1==e&&n?"one":r>=2&&r<=4&&n?"few":n?"other":"many"},cy:function(e,t){return t?0==e||7==e||8==e||9==e?"zero":1==e?"one":2==e?"two":3==e||4==e?"few":5==e||6==e?"many":"other":0==e?"zero":1==e?"one":2==e?"two":3==e?"few":6==e?"many":"other"},da:function(e,t){var o=String(e).split("."),r=o[0],n=Number(o[0])==e;return t||1!=e&&(n||0!=r&&1!=r)?"other":"one"},de:s,doi:l,dsb:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-2),l=n.slice(-2);return t?"other":i&&1==a||1==l?"one":i&&2==a||2==l?"two":i&&(3==a||4==a)||3==l||4==l?"few":"other"},dv:i,dz:d,ee:i,el:i,en:function(e,t){var o=String(e).split("."),r=!o[1],n=Number(o[0])==e,i=n&&o[0].slice(-1),a=n&&o[0].slice(-2);return t?1==i&&11!=a?"one":2==i&&12!=a?"two":3==i&&13!=a?"few":"other":1==e&&r?"one":"other"},eo:i,es:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-6);return t?"other":1==e?"one":0!=r&&0==i&&n?"many":"other"},et:s,eu:i,fa:l,ff:function(e,t){return t?"other":e>=0&&e<2?"one":"other"},fi:s,fil:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-1),l=n.slice(-1);return t?1==e?"one":"other":i&&(1==r||2==r||3==r)||i&&4!=a&&6!=a&&9!=a||!i&&4!=l&&6!=l&&9!=l?"one":"other"},fo:i,fr:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-6);return t?1==e?"one":"other":e>=0&&e<2?"one":0!=r&&0==i&&n?"many":"other"},fur:i,fy:s,ga:function(e,t){var o=String(e).split("."),r=Number(o[0])==e;return t?1==e?"one":"other":1==e?"one":2==e?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"},gd:function(e,t){var o=String(e).split("."),r=Number(o[0])==e;return t?1==e||11==e?"one":2==e||12==e?"two":3==e||13==e?"few":"other":1==e||11==e?"one":2==e||12==e?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"},gl:s,gsw:i,gu:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},guw:a,gv:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-1),a=r.slice(-2);return t?"other":n&&1==i?"one":n&&2==i?"two":!n||0!=a&&20!=a&&40!=a&&60!=a&&80!=a?n?"other":"many":"few"},ha:i,haw:i,he:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1];return t?"other":1==r&&n||0==r&&!n?"one":2==r&&n?"two":"other"},hi:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},hnj:d,hr:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-1),l=r.slice(-2),s=n.slice(-1),d=n.slice(-2);return t?"other":i&&1==a&&11!=l||1==s&&11!=d?"one":i&&a>=2&&a<=4&&(l<12||l>14)||s>=2&&s<=4&&(d<12||d>14)?"few":"other"},hsb:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-2),l=n.slice(-2);return t?"other":i&&1==a||1==l?"one":i&&2==a||2==l?"two":i&&(3==a||4==a)||3==l||4==l?"few":"other"},hu:function(e,t){return t?1==e||5==e?"one":"other":1==e?"one":"other"},hy:function(e,t){return t?1==e?"one":"other":e>=0&&e<2?"one":"other"},ia:s,id:d,ig:d,ii:d,io:s,is:function(e,t){var o=String(e).split("."),r=o[0],n=(o[1]||"").replace(/0+$/,""),i=Number(o[0])==e,a=r.slice(-1),l=r.slice(-2);return t?"other":i&&1==a&&11!=l||n%10==1&&n%100!=11?"one":"other"},it:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-6);return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&n?"one":0!=r&&0==i&&n?"many":"other"},iu:c=function(e,t){return t?"other":1==e?"one":2==e?"two":"other"},ja:d,jbo:d,jgo:i,jmc:i,jv:d,jw:d,ka:function(e,t){var o=String(e).split(".")[0],r=o.slice(-2);return t?1==o?"one":0==o||r>=2&&r<=20||40==r||60==r||80==r?"many":"other":1==e?"one":"other"},kab:function(e,t){return t?"other":e>=0&&e<2?"one":"other"},kaj:i,kcg:i,kde:d,kea:d,kk:function(e,t){var o=String(e).split("."),r=Number(o[0])==e,n=r&&o[0].slice(-1);return t?6==n||9==n||r&&0==n&&0!=e?"many":"other":1==e?"one":"other"},kkj:i,kl:i,km:d,kn:l,ko:d,ks:i,ksb:i,ksh:function(e,t){return t?"other":0==e?"zero":1==e?"one":"other"},ku:i,kw:function(e,t){var o=String(e).split("."),r=Number(o[0])==e,n=r&&o[0].slice(-2),i=r&&o[0].slice(-3),a=r&&o[0].slice(-5),l=r&&o[0].slice(-6);return t?r&&e>=1&&e<=4||n>=1&&n<=4||n>=21&&n<=24||n>=41&&n<=44||n>=61&&n<=64||n>=81&&n<=84?"one":5==e||5==n?"many":"other":0==e?"zero":1==e?"one":2==n||22==n||42==n||62==n||82==n||r&&0==i&&(a>=1e3&&a<=2e4||4e4==a||6e4==a||8e4==a)||0!=e&&1e5==l?"two":3==n||23==n||43==n||63==n||83==n?"few":1==e||1!=n&&21!=n&&41!=n&&61!=n&&81!=n?"other":"many"},ky:i,lag:function(e,t){var o=String(e).split(".")[0];return t?"other":0==e?"zero":0!=o&&1!=o||0==e?"other":"one"},lb:i,lg:i,lij:function(e,t){var o=String(e).split("."),r=!o[1],n=Number(o[0])==e;return t?11==e||8==e||n&&e>=80&&e<=89||n&&e>=800&&e<=899?"many":"other":1==e&&r?"one":"other"},lkt:d,ln:a,lo:function(e,t){return t&&1==e?"one":"other"},lt:function(e,t){var o=String(e).split("."),r=o[1]||"",n=Number(o[0])==e,i=n&&o[0].slice(-1),a=n&&o[0].slice(-2);return t?"other":1==i&&(a<11||a>19)?"one":i>=2&&i<=9&&(a<11||a>19)?"few":0!=r?"many":"other"},lv:function(e,t){var o=String(e).split("."),r=o[1]||"",n=r.length,i=Number(o[0])==e,a=i&&o[0].slice(-1),l=i&&o[0].slice(-2),s=r.slice(-2),d=r.slice(-1);return t?"other":i&&0==a||l>=11&&l<=19||2==n&&s>=11&&s<=19?"zero":1==a&&11!=l||2==n&&1==d&&11!=s||2!=n&&1==d?"one":"other"},mas:i,mg:a,mgo:i,mk:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-1),l=r.slice(-2),s=n.slice(-1),d=n.slice(-2);return t?1==a&&11!=l?"one":2==a&&12!=l?"two":7!=a&&8!=a||17==l||18==l?"other":"many":i&&1==a&&11!=l||1==s&&11!=d?"one":"other"},ml:i,mn:i,mo:function(e,t){var o=String(e).split("."),r=!o[1],n=Number(o[0])==e&&o[0].slice(-2);return t?1==e?"one":"other":1==e&&r?"one":!r||0==e||1!=e&&n>=1&&n<=19?"few":"other"},mr:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":"other":1==e?"one":"other"},ms:function(e,t){return t&&1==e?"one":"other"},mt:function(e,t){var o=String(e).split("."),r=Number(o[0])==e&&o[0].slice(-2);return t?"other":1==e?"one":2==e?"two":0==e||r>=3&&r<=10?"few":r>=11&&r<=19?"many":"other"},my:d,nah:i,naq:c,nb:i,nd:i,ne:function(e,t){var o=String(e).split("."),r=Number(o[0])==e;return t?r&&e>=1&&e<=4?"one":"other":1==e?"one":"other"},nl:s,nn:i,nnh:i,no:i,nqo:d,nr:i,nso:a,ny:i,nyn:i,om:i,or:function(e,t){var o=String(e).split("."),r=Number(o[0])==e;return t?1==e||5==e||r&&e>=7&&e<=9?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":1==e?"one":"other"},os:i,osa:d,pa:a,pap:i,pcm:l,pl:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-1),a=r.slice(-2);return t?"other":1==e&&n?"one":n&&i>=2&&i<=4&&(a<12||a>14)?"few":n&&1!=r&&(0==i||1==i)||n&&i>=5&&i<=9||n&&a>=12&&a<=14?"many":"other"},prg:function(e,t){var o=String(e).split("."),r=o[1]||"",n=r.length,i=Number(o[0])==e,a=i&&o[0].slice(-1),l=i&&o[0].slice(-2),s=r.slice(-2),d=r.slice(-1);return t?"other":i&&0==a||l>=11&&l<=19||2==n&&s>=11&&s<=19?"zero":1==a&&11!=l||2==n&&1==d&&11!=s||2!=n&&1==d?"one":"other"},ps:i,pt:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-6);return t?"other":0==r||1==r?"one":0!=r&&0==i&&n?"many":"other"},pt_PT:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-6);return t?"other":1==e&&n?"one":0!=r&&0==i&&n?"many":"other"},rm:i,ro:function(e,t){var o=String(e).split("."),r=!o[1],n=Number(o[0])==e&&o[0].slice(-2);return t?1==e?"one":"other":1==e&&r?"one":!r||0==e||1!=e&&n>=1&&n<=19?"few":"other"},rof:i,ru:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-1),a=r.slice(-2);return t?"other":n&&1==i&&11!=a?"one":n&&i>=2&&i<=4&&(a<12||a>14)?"few":n&&0==i||n&&i>=5&&i<=9||n&&a>=11&&a<=14?"many":"other"},rwk:i,sah:d,saq:i,sat:c,sc:function(e,t){var o=!String(e).split(".")[1];return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&o?"one":"other"},scn:function(e,t){var o=!String(e).split(".")[1];return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&o?"one":"other"},sd:i,sdh:i,se:c,seh:i,ses:d,sg:d,sh:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-1),l=r.slice(-2),s=n.slice(-1),d=n.slice(-2);return t?"other":i&&1==a&&11!=l||1==s&&11!=d?"one":i&&a>=2&&a<=4&&(l<12||l>14)||s>=2&&s<=4&&(d<12||d>14)?"few":"other"},shi:function(e,t){var o=String(e).split("."),r=Number(o[0])==e;return t?"other":e>=0&&e<=1?"one":r&&e>=2&&e<=10?"few":"other"},si:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"";return t?"other":0==e||1==e||0==r&&1==n?"one":"other"},sk:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1];return t?"other":1==e&&n?"one":r>=2&&r<=4&&n?"few":n?"other":"many"},sl:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-2);return t?"other":n&&1==i?"one":n&&2==i?"two":n&&(3==i||4==i)||!n?"few":"other"},sma:c,smi:c,smj:c,smn:c,sms:c,sn:i,so:i,sq:function(e,t){var o=String(e).split("."),r=Number(o[0])==e,n=r&&o[0].slice(-1),i=r&&o[0].slice(-2);return t?1==e?"one":4==n&&14!=i?"many":"other":1==e?"one":"other"},sr:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-1),l=r.slice(-2),s=n.slice(-1),d=n.slice(-2);return t?"other":i&&1==a&&11!=l||1==s&&11!=d?"one":i&&a>=2&&a<=4&&(l<12||l>14)||s>=2&&s<=4&&(d<12||d>14)?"few":"other"},ss:i,ssy:i,st:i,su:d,sv:function(e,t){var o=String(e).split("."),r=!o[1],n=Number(o[0])==e,i=n&&o[0].slice(-1),a=n&&o[0].slice(-2);return t?1!=i&&2!=i||11==a||12==a?"other":"one":1==e&&r?"one":"other"},sw:s,syr:i,ta:i,te:i,teo:i,th:d,ti:a,tig:i,tk:function(e,t){var o=String(e).split("."),r=Number(o[0])==e&&o[0].slice(-1);return t?6==r||9==r||10==e?"few":"other":1==e?"one":"other"},tl:function(e,t){var o=String(e).split("."),r=o[0],n=o[1]||"",i=!o[1],a=r.slice(-1),l=n.slice(-1);return t?1==e?"one":"other":i&&(1==r||2==r||3==r)||i&&4!=a&&6!=a&&9!=a||!i&&4!=l&&6!=l&&9!=l?"one":"other"},tn:i,to:d,tpi:d,tr:i,ts:i,tzm:function(e,t){var o=String(e).split("."),r=Number(o[0])==e;return t?"other":0==e||1==e||r&&e>=11&&e<=99?"one":"other"},ug:i,uk:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=Number(o[0])==e,a=i&&o[0].slice(-1),l=i&&o[0].slice(-2),s=r.slice(-1),d=r.slice(-2);return t?3==a&&13!=l?"few":"other":n&&1==s&&11!=d?"one":n&&s>=2&&s<=4&&(d<12||d>14)?"few":n&&0==s||n&&s>=5&&s<=9||n&&d>=11&&d<=14?"many":"other"},und:d,ur:s,uz:i,ve:i,vec:function(e,t){var o=String(e).split("."),r=o[0],n=!o[1],i=r.slice(-6);return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&n?"one":0!=r&&0==i&&n?"many":"other"},vi:function(e,t){return t&&1==e?"one":"other"},vo:i,vun:i,wa:a,wae:i,wo:d,xh:i,xog:i,yi:s,yo:d,yue:d,zh:d,zu:l});var f=r(u.exports),h=t({__proto__:null,default:f},[u.exports]),m={exports:{}};!function(e){var t="zero",o="one",r="two",n="few",i="many",a="other",l={cardinal:[o,a],ordinal:[a]},s={cardinal:[o,a],ordinal:[o,a]},d={cardinal:[a],ordinal:[a]},c={cardinal:[o,r,a],ordinal:[a]};!function(t,o){Object.defineProperty(o,"__esModule",{value:!0}),e.exports=o}(0,{af:l,ak:l,am:l,an:l,ar:{cardinal:[t,o,r,n,i,a],ordinal:[a]},ars:{cardinal:[t,o,r,n,i,a],ordinal:[a]},as:{cardinal:[o,a],ordinal:[o,r,n,i,a]},asa:l,ast:l,az:{cardinal:[o,a],ordinal:[o,n,i,a]},bal:s,be:{cardinal:[o,n,i,a],ordinal:[n,a]},bem:l,bez:l,bg:l,bho:l,bm:d,bn:{cardinal:[o,a],ordinal:[o,r,n,i,a]},bo:d,br:{cardinal:[o,r,n,i,a],ordinal:[a]},brx:l,bs:{cardinal:[o,n,a],ordinal:[a]},ca:{cardinal:[o,i,a],ordinal:[o,r,n,a]},ce:l,ceb:l,cgg:l,chr:l,ckb:l,cs:{cardinal:[o,n,i,a],ordinal:[a]},cy:{cardinal:[t,o,r,n,i,a],ordinal:[t,o,r,n,i,a]},da:l,de:l,doi:l,dsb:{cardinal:[o,r,n,a],ordinal:[a]},dv:l,dz:d,ee:l,el:l,en:{cardinal:[o,a],ordinal:[o,r,n,a]},eo:l,es:{cardinal:[o,i,a],ordinal:[a]},et:l,eu:l,fa:l,ff:l,fi:l,fil:s,fo:l,fr:{cardinal:[o,i,a],ordinal:[o,a]},fur:l,fy:l,ga:{cardinal:[o,r,n,i,a],ordinal:[o,a]},gd:{cardinal:[o,r,n,a],ordinal:[o,r,n,a]},gl:l,gsw:l,gu:{cardinal:[o,a],ordinal:[o,r,n,i,a]},guw:l,gv:{cardinal:[o,r,n,i,a],ordinal:[a]},ha:l,haw:l,he:c,hi:{cardinal:[o,a],ordinal:[o,r,n,i,a]},hnj:d,hr:{cardinal:[o,n,a],ordinal:[a]},hsb:{cardinal:[o,r,n,a],ordinal:[a]},hu:s,hy:s,ia:l,id:d,ig:d,ii:d,io:l,is:l,it:{cardinal:[o,i,a],ordinal:[i,a]},iu:c,ja:d,jbo:d,jgo:l,jmc:l,jv:d,jw:d,ka:{cardinal:[o,a],ordinal:[o,i,a]},kab:l,kaj:l,kcg:l,kde:d,kea:d,kk:{cardinal:[o,a],ordinal:[i,a]},kkj:l,kl:l,km:d,kn:l,ko:d,ks:l,ksb:l,ksh:{cardinal:[t,o,a],ordinal:[a]},ku:l,kw:{cardinal:[t,o,r,n,i,a],ordinal:[o,i,a]},ky:l,lag:{cardinal:[t,o,a],ordinal:[a]},lb:l,lg:l,lij:{cardinal:[o,a],ordinal:[i,a]},lkt:d,ln:l,lo:{cardinal:[a],ordinal:[o,a]},lt:{cardinal:[o,n,i,a],ordinal:[a]},lv:{cardinal:[t,o,a],ordinal:[a]},mas:l,mg:l,mgo:l,mk:{cardinal:[o,a],ordinal:[o,r,i,a]},ml:l,mn:l,mo:{cardinal:[o,n,a],ordinal:[o,a]},mr:{cardinal:[o,a],ordinal:[o,r,n,a]},ms:{cardinal:[a],ordinal:[o,a]},mt:{cardinal:[o,r,n,i,a],ordinal:[a]},my:d,nah:l,naq:c,nb:l,nd:l,ne:s,nl:l,nn:l,nnh:l,no:l,nqo:d,nr:l,nso:l,ny:l,nyn:l,om:l,or:{cardinal:[o,a],ordinal:[o,r,n,i,a]},os:l,osa:d,pa:l,pap:l,pcm:l,pl:{cardinal:[o,n,i,a],ordinal:[a]},prg:{cardinal:[t,o,a],ordinal:[a]},ps:l,pt:{cardinal:[o,i,a],ordinal:[a]},pt_PT:{cardinal:[o,i,a],ordinal:[a]},rm:l,ro:{cardinal:[o,n,a],ordinal:[o,a]},rof:l,ru:{cardinal:[o,n,i,a],ordinal:[a]},rwk:l,sah:d,saq:l,sat:c,sc:{cardinal:[o,a],ordinal:[i,a]},scn:{cardinal:[o,a],ordinal:[i,a]},sd:l,sdh:l,se:c,seh:l,ses:d,sg:d,sh:{cardinal:[o,n,a],ordinal:[a]},shi:{cardinal:[o,n,a],ordinal:[a]},si:l,sk:{cardinal:[o,n,i,a],ordinal:[a]},sl:{cardinal:[o,r,n,a],ordinal:[a]},sma:c,smi:c,smj:c,smn:c,sms:c,sn:l,so:l,sq:{cardinal:[o,a],ordinal:[o,i,a]},sr:{cardinal:[o,n,a],ordinal:[a]},ss:l,ssy:l,st:l,su:d,sv:s,sw:l,syr:l,ta:l,te:l,teo:l,th:d,ti:l,tig:l,tk:{cardinal:[o,a],ordinal:[n,a]},tl:s,tn:l,to:d,tpi:d,tr:l,ts:l,tzm:l,ug:l,uk:{cardinal:[o,n,i,a],ordinal:[n,a]},und:d,ur:l,uz:l,ve:l,vec:{cardinal:[o,i,a],ordinal:[i,a]},vi:{cardinal:[a],ordinal:[o,a]},vo:l,vun:l,wa:l,wae:l,wo:d,xh:l,xog:l,yi:l,yo:d,yue:d,zh:d,zu:l})}(m);var p=r(m.exports),g=t({__proto__:null,default:p},[m.exports]),v={exports:{}};!function(e){var t,o=function(e,t){return"other"},r=function(e,t){return"other"===e&&"one"===t?"one":"other"},n=function(e,t){return t||"other"};t={af:o,ak:r,am:n,an:o,ar:function(e,t){return"few"===t?"few":"many"===t?"many":"zero"===e&&"one"===t||"zero"===e&&"two"===t?"zero":"other"},as:n,az:n,be:n,bg:o,bn:n,bs:n,ca:o,cs:n,cy:n,da:n,de:n,el:n,en:o,es:o,et:o,eu:o,fa:r,fi:o,fil:n,fr:n,ga:n,gl:n,gsw:n,gu:n,he:o,hi:n,hr:n,hu:n,hy:n,ia:o,id:o,io:o,is:n,it:n,ja:o,ka:function(e,t){return e||"other"},kk:n,km:o,kn:n,ko:o,ky:n,lij:n,lo:o,lt:n,lv:function(e,t){return"one"===t?"one":"other"},mk:o,ml:n,mn:n,mr:n,ms:o,my:o,nb:o,ne:n,nl:n,no:o,or:r,pa:n,pcm:o,pl:n,ps:n,pt:n,ro:function(e,t){return"few"===t||"one"===t?"few":"other"},ru:n,sc:n,scn:n,sd:r,si:function(e,t){return"one"===e&&"one"===t?"one":"other"},sk:n,sl:function(e,t){return"few"===t||"one"===t?"few":"two"===t?"two":"other"},sq:n,sr:n,sv:o,sw:n,ta:n,te:n,th:o,tk:n,tr:n,ug:n,uk:n,ur:o,uz:n,vi:o,yue:o,zh:o,zu:n},Object.defineProperty(t,"__esModule",{value:!0}),e.exports=t}(v);var y=r(v.exports),w=f||h,b=p||g,C=y||t({__proto__:null,default:y},[v.exports]),I=function(e){return"pt-PT"===e?"pt_PT":e},F=o.default(Intl.NumberFormat,function(e){return w[I(e)]},function(e,t){return b[I(e)][t?"ordinal":"cardinal"]},function(e){return C[I(e)]});return Cr=F}();function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(e);if("undefined"==typeof Intl)void 0!==Ho?Ho.Intl={PluralRules:o.default}:"undefined"!=typeof window?window.Intl={PluralRules:o.default}:ur.Intl={PluralRules:o.default},o.default.polyfill=!0;else if(Intl.PluralRules&&Intl.PluralRules.prototype.selectRange){var r=["en","es","ru","zh"];Intl.PluralRules.supportedLocalesOf(r).length<r.length&&(Intl.PluralRules=o.default,o.default.polyfill=!0)}else Intl.PluralRules=o.default,o.default.polyfill=!0}();var Sr={Folder:"Folder",Folders:"Folders",Files:"Files",File:"File","Select the destination folder":"Select the destination folder","Filter by type":"Filter by type","All types":"All types","File name":"File name",Size:"Size",Date:"Date",Actions:"Actions",Delete:"Delete",Move:"Move",Copy:"Copy",Refresh:"Refresh","Add folder":"Add folder","Add file":"Add file","Add file by URL":"Add file by URL","Please select an image file":"Please select an image file","File deleted":"File deleted","Error when deleting a file":"Error when deleting a file","Folder deleted":"Folder deleted","Error when deleting a folder":"Error when deleting a folder","Delete folder":"Delete folder","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Are you sure you want to delete this folder? This action will also delete all files and subfolders.","File moved":"File moved","Error when moving a file":"Error when moving a file","has been successfully uploaded":"has been successfully uploaded","Failed to download file":"Failed to download file","Failed to load JSON data":"Failed to load JSON data","Invalid file URL":"Invalid file URL","Unable to validate file URL":"Unable to validate file URL","Error when uploading a file":"Error when uploading a file","successfully uploaded":"successfully uploaded","Error when downloading a file by URL":"Error when downloading a file by URL","Error loading files":"Error loading files","File Manager not configured":"File Manager not configured","Type to search...":"Type to search...","Failed to create folder":"Failed to create folder",Cancel:"Cancel",Submit:"Submit",months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},files:"files","No available folders":"No available folders","My files":"My files",GIF:"GIF","Stock images":"Stock images","QR & Barcode":"QR & Barcode","QR code":"QR code",Barcode:"Barcode","Text or URL":"Text or URL","Code color":"Code color","Background color":"Background color","Add to My files":"Add to My files","Transparent background":"Transparent background","Barcode generation failed":"Could not generate this barcode. Use characters supported by CODE128.","Validation error":"Validation error","Enter text or URL to preview":"Enter text or a URL to encode.",Preview:"Preview","QR transparent background hint":"A transparent PNG may blend into dark email themes; a white background is often easier for scanners.","QR image size px":"QR image size","Barcode bar height px":"Barcode bar height",Icons:"Icons",AI:"AI","AI image generation":"AI image generation","Search GIFs":"Search GIFs","That`s all we could find.":"That`s all we could find.","Search image":"Search image",All:"All",Landscape:"Landscape",Portrait:"Portrait",Squarish:"Squarish",Black:"Black","Black and White":"Black and White",White:"White",Orange:"Orange",Red:"Red",Purple:"Purple",Magenta:"Magenta",Green:"Green",Teal:"Teal",Blue:"Blue","Photo by":"Photo by",on:"on",selected:"selected",Deselected:"Deselected","Select all":"Select all",Rename:"Rename","Rename file":"Rename file {{currentFileName}}","Selected files":"Selected files: {{count}}",selected_files_one:"Selected {{count}} file",selected_files_other:"Selected {{count}} files",Edit:"Edit","Move to":"Move to","New folder":"New folder","Image search...":"Image search...","Search icons":"Search icons","By name":"By name","By size":"By size","By date":"By date",List:"List",Grid:"Grid",Main:"Main","total pages":"Total {{total}} items",Name:"Name",Untitled:"Untitled",Dimensions:"Dimensions",error:"error",created:"created","API-endpoint for file upload is not configured":"API-endpoint for file upload is not configured","The URL must point to an image":"The URL must point to an image","Image upload...":"Image upload...",Unknown:"Unknown","Error downloading file by URL":"Error downloading file by URL","File not found":"File not found","File renamed to":"File renamed to ","Failed to rename the file":"Failed to rename the file","Folder renamed to":"Folder renamed to","Rename folder":"Rename folder","New folder name":"New folder name","Enter a new folder name":"Enter a new folder name","Please drag and drop image files only":"Please drag and drop image files only","Upload file by URL":"Upload file by URL","Upload file":"Upload file","Creating a new folder":"Creating a new folder",Create:"Create","Folder name":"Folder name","Enter the name of the folder":"Enter the name of the folder","Enter the name":"Enter the name","A folder will be created inside:":"A folder will be created inside:","selected folder":"selected folder","The folder will be created in the root directory":"The folder will be created in the root directory","Failed to load folders":"Failed to load folders","Folder name cannot be empty":"Folder name cannot be empty","Folder creation provider is not configured":"Folder creation provider is not configured","Folder created":"Folder created","Folder rename is disabled by config":"Folder rename is disabled by config","Folder rename provider is not configured":"Folder rename provider is not configured","Unexpected response when renaming folder":"Unexpected response when renaming folder","Folder renamed":"Folder renamed","Failed to rename folder":"Failed to rename folder","Failed to load folder items count":"Failed to load folder items count","Failed to load subfolders":"Failed to load subfolders",Download:"Download","image URL":"image URL","Enter the URL of the image":"Enter the URL of the image","URL too long":"URL is too long","Only http and https URLs are supported":"Only http and https URLs are supported","Private and local URLs are not allowed":"Private and local URLs are not allowed","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"New file name","Enter a new file name":"Enter a new file name","Copy to folder":"Copy to folder",Added:"Added {{date}}","File uploaded successfully":"File {{fileName}} uploaded successfully","Successfully uploaded":"Successfully uploaded {{successCount}} of {{count}} file","Successfully uploaded files":"Successfully uploaded {{successCount}} of {{count}} files",Uploaded:"Uploaded: {{names}}",uploads_success_summary:"Uploaded {{successCount}} of {{totalCount}} files",Failed:"Failed: {{names}}",uploads_fail_summary:"Failed to upload {{failCount}} of {{totalCount}} files","File with this name already exists.":"File with this name already exists.","File not found or no longer available.":"File not found or no longer available.","You don't have permission to access this file.":"You don't have permission to access this file.","File is too large to upload.":"File is too large to upload.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}","This file type is not allowed.":"This file type is not allowed.","File name is not valid.":"File name is not valid.","File name is not valid. Allowed characters: {{allowedChars}}":"File name is not valid. Allowed characters: {{allowedChars}}","Failed to read the file.":"Failed to read the file.","Failed to write the file.":"Failed to write the file.","The file appears to be corrupted.":"The file appears to be corrupted.","File integrity check failed.":"File integrity check failed.","Folder not found or no longer available.":"Folder not found or no longer available.","Folder with this name already exists.":"Folder with this name already exists.","A folder with that name already exists. Please enter a different folder name.":"A folder with that name already exists. Please enter a different folder name.","You don't have permission to access this folder.":"You don't have permission to access this folder.","Folder name is not valid.":"Folder name is not valid.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Folder name is not valid. Allowed characters: {{allowedChars}}","Failed to read the folder contents.":"Failed to read the folder contents.","Failed to write to the folder.":"Failed to write to the folder.","Folder storage quota exceeded.":"Folder storage quota exceeded.","Folder is not empty.":"Folder is not empty.","Server error while processing the folder.":"Server error while processing the folder.","Folder operation took too long.":"Folder operation took too long.","Network error. Please check your connection and try again.":"Network error. Please check your connection and try again.","The operation took too long. Please try again.":"The operation took too long. Please try again.","Server error. Please try again later.":"Server error. Please try again later.","Service is temporarily unavailable. Please try again later.":"Service is temporarily unavailable. Please try again later.","Too many requests. Please try again a bit later.":"Too many requests. Please try again a bit later.","Authentication failed. Please sign in again.":"Authentication failed. Please sign in again.","You are not allowed to perform this action.":"You are not allowed to perform this action.","Some of the provided data is invalid.":"Some of the provided data is invalid.","This operation is not supported.":"This operation is not supported.","Request payload is too large.":"Request payload is too large.","This media type is not supported.":"This media type is not supported.","You have exceeded the upload quota.":"You have exceeded the upload quota.","Network error while uploading the file.":"Network error while uploading the file.","File upload took too long.":"File upload took too long.","Server error while uploading the file.":"Server error while uploading the file.","The specified URL is not valid.":"The specified URL is not valid.","The specified URL is not reachable.":"The specified URL is not reachable.","Content type at the URL is not allowed.":"Content type at the URL is not allowed.","Failed to download file from the URL.":"Failed to download file from the URL.","Network error while downloading the file.":"Network error while downloading the file.","File download took too long.":"File download took too long.","Server error while downloading the file.":"Server error while downloading the file.","Some items could not be processed.":"Some items could not be processed.","Failed to process all items in the batch.":"Failed to process all items in the batch.","Some items in the batch are in a conflicting state.":"Some items in the batch are in a conflicting state.","Some items in the batch did not pass validation.":"Some items in the batch did not pass validation.","AI service returned an invalid response.":"AI service returned an invalid response.","Failed to generate image using AI.":"Failed to generate image using AI.","You have reached the AI image generation limit.":"You have reached the AI image generation limit.","Error in external integration.":"Error in external integration.","Error in a third-party service.":"Error in a third-party service.","An unknown error occurred.":"An unknown error occurred.","Renaming is not allowed for this item.":"Renaming is not allowed for this item.","Moving is not allowed for this item.":"Moving is not allowed for this item.","Copying is not allowed for this item.":"Copying is not allowed for this item.","Deleting is not allowed for this item.":"Deleting is not allowed for this item.","Cannot move an item into itself.":"Cannot move an item into itself.","Cannot move an item into its descendant folder.":"Cannot move an item into its descendant folder.","Cannot copy an item into itself.":"Cannot copy an item into itself.","Configuration error occurred.":"Configuration error occurred.","Storage quota exceeded. Please free up space.":"Storage quota exceeded. Please free up space.","File is locked by another process or user.":"File is locked by another process or user.","File version conflict. Please refresh and try again.":"File version conflict. Please refresh and try again.","Batch operation exceeds the maximum number of items allowed.":"Batch operation exceeds the maximum number of items allowed.",Moved:"Moved: {{names}}",move_success_summary:"Moved {{successCount}} of {{totalCount}} items",move_fail_summary:"Failed to move {{failCount}} of {{totalCount}} items",Copied:"Copied: {{names}}",copy_success_summary:"Copied {{successCount}} of {{totalCount}} items",copy_fail_summary:"Failed to copy {{failCount}} of {{totalCount}} items","Failed to upload":"Failed to upload {{failCount}} of {{count}} file","Failed to upload files":"Failed to upload {{failCount}} of {{count}} files","No folders yet":"No folders yet","Drag files to upload":"Drag files to upload","Drop files here to upload":"Drop files here to upload","Newest first":"Newest first","Oldest first":"Oldest first","Largest first":"Largest first","Smallest first":"Smallest first","A-Z":"A-Z","Z-A":"Z-A","By type":"By type","Evaluating the task":"Evaluating the task","Something went wrong, please try again":"Something went wrong, please try again","Sort by":"Sort by","preview text":"The image preview is trying to load ...","Use this variant":"Use this variant","Confirm deletion":"Confirm deletion","Are you sure you want to delete the selected items?":"Are you sure you want to delete the selected items?","Move to Trash":"Move to Trash","Are you sure you want to move the selected items to the Trash?":"Are you sure you want to move the selected items to the Trash?","Permanently delete":"Permanently delete","Delete permanently":"Delete permanently","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Are you sure you want to permanently delete the selected items? This action cannot be undone.",Clear:"Clear","Clear Trash":"Clear Trash","Are you sure you want to permanently delete all items from Trash?":"Are you sure you want to permanently delete all items from Trash?","Trash cleared successfully":"Trash cleared successfully","{{count}} items permanently deleted":"{{count}} items permanently deleted","Trash partially cleared":"Trash partially cleared","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} items deleted, {{failed}} items failed","Failed to clear trash":"Failed to clear trash","Error clearing trash":"Error clearing trash","Deleting items...":"Deleting items...",delete_files_permanent_one:"This action will permanently delete {{count}} file",delete_files_permanent_other:"This action will permanently delete {{count}} files",delete_folder_permanent:"This action will permanently delete the folder '{{name}}' and all its contents, including {{count}} items.",delete_mixed_permanent:"This action will permanently delete {{total}} selected items, including {{folders}} folders and all {{images}} images within them.",permanent_delete_warning:"Deleting files that were used in emails will cause problems with displaying images in old emails. Are you sure you want to permanently delete the selection?",move_files_to_trash_one:"This will move {{count}} file to the Trash.",move_files_to_trash_other:"This will move {{count}} files to the Trash.",move_folder_to_trash:"This will move the folder '{{name}}' and all its contents ({{count}} items) to the Trash.",move_mixed_to_trash:"This will move {{total}} selected items to the Trash, including {{folders}} folders and {{images}} images.",delete_count_confirm_trash_one:"Move {{count}} file to Trash?",delete_count_confirm_trash_other:"Move {{count}} files to Trash?",delete_count_confirm_permanent_one:"Permanently delete {{count}} file?",delete_count_confirm_permanent_other:"Permanently delete {{count}} files?",delete_count_confirm_one:"Delete {{count}} file?",delete_count_confirm_other:"Delete {{count}} files?",item:"item",items:"items",Trash:"Deleted",Choose:"Choose",Stock:"Stock","Select an image from our library":"Select an image from our library","AI generation":"AI generation","Creating an image on demand":"Creating an image on demand","Search file or folder":"Search file or folder","Click here to select a file":"Click here to select a file","Create folder":"Create folder",Done:"Done","Move here":"Move here","Copy here":"Copy here","File URL":"File URL","There's nothing here":"There's nothing here","Try using a different search query.":"Try using a different search query.","Millions of free stock images":"Millions of free stock images","Enter a search query and we'll find the perfect image for you":"Enter a search query and we'll find the perfect image for you","Millions of icons":"Millions of icons","Lucide icons":"Lucide icons","Thousands of icons":"Thousands of icons","Enter a search query and we'll find the perfect icon for you":"Enter a search query and we'll find the perfect icon for you","Enter your query and we will find the right one for you":"Enter your query and we will find the right one for you","Over 350,000 live images":"Over 350,000 live images","The folder will be created in the root directory.":"The folder will be created in the root directory.",undo:"UNDO",moved_to_trash_one:"Moved {{count}} item to Trash",moved_to_trash_other:"Moved {{count}} items to Trash",restored_items_one:"Restored {{count}} item",restored_items_other:"Restored {{count}} items",Type:"Type","Generate image":"Generate image","For example:":"For example:","A beautiful image of a sunset over a calm ocean.":"A beautiful image of a sunset over a calm ocean.",Insert:"Insert",Error:"Error","Upload progress":"Upload {{completed}}/{{total}}","Uploading files":"Uploading {{completed}}/{{total}} files","Uploaded files":"Uploaded {{success}} of {{total}} files","Upload error files":"Upload error {{errorCount}} files","Applies to all {{count}} files":"(applies to all {{count}} files)","Some files failed to upload":"Some files failed to upload. Please check file size and format.",upload_error_hint_invalid_name:"Rename the file: use only letters, numbers, hyphens and underscores.",upload_error_hint_size:"Reduce the file size or choose a different file.",upload_error_hint_format:"Use an allowed format: JPG, PNG, or GIF.",upload_error_hint_exists:"A file with this name already exists in the folder. Rename the file.","Images generated successfully":"Images generated successfully","Trash is empty":"Trash is empty","Deleted files will be displayed here":"Deleted files will be displayed here","Supported files:":"Supported files:","Stroke width":"Stroke thickness",Color1:"Color",Color2:"Color2",Color3:"Color3","Global search":"Global search","Family search":"Family search","Choose for template":"Choose for template",Back:"Back","Editing: {{name}}":"Editing: {{name}}","Editing image":"Editing image",Save:"Save","Loading editor...":"Loading editor...","Error loading image":"Error loading image","Error saving image":"Error saving image","Error initializing editor":"Error initializing editor","Close File Manager":"Close File Manager","Are you sure you want to close? Unsaved changes will be lost.":"Are you sure you want to close? Unsaved changes will be lost.","Are you sure you want to close the file manager?":"Are you sure you want to close the file manager?",Close:"Close",KB:"KB","No files":"No files","Folder is empty or files not found":"Folder is empty or files not found","Search files...":"Search files...",Success:"Success","Image updated successfully":"Image updated successfully","Failed to save changes":"Failed to save changes: {{error}}","Unknown error":"Unknown error","Select destination folder":"Select destination folder","Error moving":"Error moving","Error deleting":"Error deleting","Error copying":"Error copying","Error renaming":"Error renaming","Failed to refresh folder tree":"Failed to refresh folder tree","Failed to refresh file list":"Failed to refresh file list","Errors occurred while moving":"Errors occurred while moving","Errors occurred while copying":"Errors occurred while copying","(error)":"(error)","(circular reference)":"(circular reference)","File too large. Maximum size: {{size}}":"File too large. Maximum size: {{size}}","File too small. Minimum size: {{size}}":"File too small. Minimum size: {{size}}","Unsupported file type":"Unsupported file type","Unsupported file type: {{type}}":"Unsupported file type: {{type}}",unknown:"unknown","Failed to load files":"Failed to load files","Failed to load files in folder":"Could not load folder contents ({{folderName}})","Failed to load subfolders in folder":'Could not load subfolders in "{{folderName}}"',"Failed to load folder items count in folder":'Could not get item count for "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider for folder deletion is not configured","DataProvider for file upload is not configured":"DataProvider for file upload is not configured","Error uploading file {{fileName}}":"Error uploading file {{fileName}}","Error uploading file":"Error uploading file","Cannot upload files to Trash":"Cannot upload files to Trash","Please fill in all fields":"Please fill in all fields","Upload by URL is not supported":"Upload by URL is not supported","File name is too long. Maximum {{max}} characters":"File name is too long. Maximum {{max}} characters","File name contains invalid characters":"File name contains invalid characters","Large file may take a long time to upload":"Large file may take a long time to upload","File unavailable: {{status}} {{statusText}}":"File unavailable: {{status}} {{statusText}}","File too large: {{size}}":"File too large: {{size}}","Unsupported file type: {{contentType}}":"Unsupported file type: {{contentType}}","Invalid server response: folder ID is missing":"Invalid server response: folder ID is missing","Error: folder cannot be its own parent":"Error: folder cannot be its own parent","Upload to Trash is forbidden":"Upload to Trash is forbidden","renameFolder is not implemented in dataProviders":"renameFolder is not implemented in dataProviders","renameFile is not implemented in dataProviders":"renameFile is not implemented in dataProviders",Deleted:"Deleted",Clean:"Clean","Circular dependency detected: folder cannot be its own parent":"Circular dependency detected: folder cannot be its own parent","Save as copy and choose":"Save as copy and choose","Save and choose":"Save and choose",pixie:{"added drawing":"Added Drawing","added frame":"Added Frame","added image":"Added Image","added shape":"Added Shape","added sticker":"Added Sticker","added text":"Added Text","applied filters":"Applied Filters",apply:"Apply",background:"Background","background color":"Background color",beach:"Beach","brush color":"Brush Color","brush size":"Brush Size","brush type":"Brush Type",bubbles:"Bubbles",Cancel:"Cancel","changed style":"Changed Style","Circle Brush":"Circle Brush",close:"Close",color:"Color",corners:"Corners",crop:"Crop",Custom:"Custom","deleted object":"Deleted object","Diamond Brush":"Diamond Brush",doodles:"Doodles",draw:"Draw",emoticons:"Emoticons","Eraser Brush":"Eraser Brush",filter:"Filter",font:"Font","font size":"Font Size",frame:"Frame",gradient:"Gradient",height:"Height",history:"History","H Line Brush":"H Line Brush",image:"Image",initial:"Initial",landmarks:"Landmarks","loaded state":"Loaded State","loading canvas":"Loading Canvas","loading image":"Loading Image","loading state":"Loading State","maintain aspect ratio":"Maintain aspect ratio",merge:"Merge","merged objects":"Merged Objects","new text":"New Text",objects:"Objects",opacity:"Opacity",outline:"Outline","outline color":"Outline Color","Pencil Brush":"Pencil Brush","processing image":"Processing Image",quality:"Quality",radius:"Radius","replace image":"Replace Image","replaced background image":"Replaced Background Image",resize:"Resize","resized image":"Resized Image","rounded corner":"Rounded Corner",save:"Save",shadow:"Shadow","shadow color":"Shadow Color",shapes:"Shapes","Spray Brush":"Spray Brush",square:"Square","Square Brush":"Square Brush",stickers:"Stickers",text:"Text",texture:"Texture",transportation:"Transportation","V Line Brush":"V Line Brush",width:"Width",grayscale:"Grayscale","black & White":"Black & White",sharpen:"Sharpen",invert:"Invert",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Brownie",sepia:"Sepia","remove Color":"Remove Color",brightness:"Brightness",gamma:"Gamma",noise:"Noise",pixelate:"Pixelate",blur:"Blur",emboss:"Emboss","blend Color":"Blend Color",distance:"Distance",red:"Red",green:"Green",blue:"Blue",blocksize:"Blocksize",alpha:"Alpha",add:"Add",multiply:"Multiply",subtract:"Subtract",diff:"Diff",screen:"Screen",lighten:"Lighten",darken:"Darken","select an option...":"Select an option..."}},Er={Files:"Файлы",selected:"выбрано",Deselected:"Отменить выбор",Refresh:"Обновить","Select all":"Выбрать все",Rename:"Переименовать","Rename file":"Переименовать файл {{currentFileName}}","Select the destination folder":"Выберите папку назначения","Selected files:":"Выбрано файлов:","Selected files":"Выбрано файлов: {{count}}",selected_files_one:"Выбран {{count}} файл",selected_files_few:"Выбрано {{count}} файла",selected_files_many:"Выбрано {{count}} файлов",selected_files_other:"Выбрано {{count}} файлов",Copy:"Дублировать",Edit:"Изменить",Move:"Переместить","Move to":"Переместить",Delete:"Удалить","New folder":"Новая папка","Image search...":"Поиск изображений...","Search icons":"Найти иконки","By name":"По имени","By size":"По размеру","By date":"По дате",List:"Список",Grid:"Плитки",Main:"Главная",Folders:"Папки","total pages":"Всего {{total}} элементов",Name:"Имя",Untitled:"Без названия",Size:"Размер",Dimensions:"Размер",Date:"Дата",error:"ошибка",Folder:"Папка",created:"создана","Failed to create folder":"Не удалось создать папку","File deleted":"Файл удален","Files deleted":"Файлы удалены","Error when deleting a file":"Ошибка при удалении файла","Folder deleted":"Папка удалена","Error when deleting a folder":"Ошибка при удалении папки","Delete folder":"Удалить папку","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Вы уверены, что хотите удалить эту папку? Это действие также удалит все файлы и подпапки.","API-endpoint for file upload is not configured":"API-endpoint для загрузки файлов не настроен","Please select an image file":"Пожалуйста, выберите файл изображения",File:"Файл","has been successfully uploaded":"успешно загружен","The URL must point to an image":"URL должен указывать на изображение","Image upload...":"Загрузка изображения...",Unknown:"Неизвестно","Error downloading file by URL":"Ошибка загрузки файла по URL","successfully uploaded":"успешно загружен","Error when downloading a file by URL":"Ошибка при загрузке файла по URL","Error when uploading a file":"Ошибка при загрузке файла","Error loading files":"Ошибка загрузки файлов","File not found":"Файл не найден","File renamed to":"Файл переименован на ","Failed to rename the file":"Не удалось переименовать файл","Folder renamed to":"Папка переименована на","Rename folder":"Переименовать папку","New folder name":"Новое название папки","Enter a new folder name":"Введите новое название папки","Please drag and drop image files only":"Пожалуйста, перетащите только файлы изображений","Upload file by URL":"Загрузить файл по URL","Upload file":"Загрузить файл","Creating a new folder":"Создание новой папки",Create:"Создать",Cancel:"Отмена","Folder name":"Название папки","Enter the name of the folder":"Введите название папки","Enter the name":"Введите название","A folder will be created inside:":"Папка будет создана внутри:","selected folder":"выбранной папки","The folder will be created in the root directory":"Папка будет создана в корневом каталоге","Failed to load folders":"Не удалось загрузить папки","Folder name cannot be empty":"Название папки не может быть пустым","Folder creation provider is not configured":"Провайдер создания папок не настроен","Folder created":"Папка создана","Folder rename is disabled by config":"Переименование папок отключено конфигурацией","Folder rename provider is not configured":"Провайдер переименования папок не настроен","Unexpected response when renaming folder":"Неожиданный ответ при переименовании папки","Folder renamed":"Папка переименована","Failed to rename folder":"Не удалось переименовать папку","Failed to load folder items count":"Не удалось получить количество файлов в папке","Failed to load subfolders":"Не удалось загрузить подпапки",Download:"Загрузить","image URL":"URL изображения","Enter the URL of the image":"Введите URL изображения","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Поддерживаемые форматы: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Новое имя файла","Enter a new file name":"Введите новое имя файла","Copy to folder":"Копировать в папку",Added:"Добавлено {{date}}","File uploaded successfully":"Файл {{fileName}} успешно загружен","Successfully uploaded":"Успешно загружено {{successCount}} из {{count}} файла","Successfully uploaded files":"Успешно загружено {{successCount}} из {{count}} файлов",uploads_success_summary:"Загружено {{successCount}} из {{totalCount}} файлов",uploads_fail_summary:"Не удалось загрузить {{failCount}} из {{totalCount}} файлов","File with this name already exists.":"Файл с таким именем уже существует.","File not found or no longer available.":"Файл не найден или уже был удалён.","You don't have permission to access this file.":"У вас нет прав доступа к этому файлу.","File is too large to upload.":"Файл слишком большой для загрузки.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"Файл слишком большой ({{fileSize}}). Максимально допустимый размер — {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Превышено максимальное количество файлов. Допустимо: {{allowed}}, выбрано: {{received}}","This file type is not allowed.":"Этот тип файла не поддерживается.","File name is not valid.":"Недопустимое имя файла.","File name is not valid. Allowed characters: {{allowedChars}}":"Недопустимое имя файла. Допустимые символы: {{allowedChars}}","Failed to read the file.":"Не удалось прочитать файл.","Failed to write the file.":"Не удалось записать файл.","The file appears to be corrupted.":"Файл повреждён или имеет неверный формат.","File integrity check failed.":"Проверка целостности файла завершилась неудачно.","Folder not found or no longer available.":"Папка не найдена или уже была удалена.","Folder with this name already exists.":"Папка с таким именем уже существует.","A folder with that name already exists. Please enter a different folder name.":"Папка с таким именем уже существует. Введите другое имя папки.","You don't have permission to access this folder.":"У вас нет прав доступа к этой папке.","Folder name is not valid.":"Недопустимое имя папки.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Не удалось создать папку. Допустимые символы в названии папки: {{allowedChars}}","Failed to read the folder contents.":"Не удалось прочитать содержимое папки.","Failed to write to the folder.":"Не удалось выполнить операцию с папкой.","Folder storage quota exceeded.":"Превышена квота хранения для папки.","Folder is not empty.":"Папка не пуста.","Server error while processing the folder.":"Ошибка сервера при обработке папки.","Folder operation took too long.":"Операция с папкой выполнялась слишком долго.","Network error. Please check your connection and try again.":"Ошибка сети. Проверьте подключение к интернету и повторите попытку.","The operation took too long. Please try again.":"Операция выполнялась слишком долго. Попробуйте ещё раз.","Server error. Please try again later.":"Ошибка на сервере. Повторите попытку позже.","Service is temporarily unavailable. Please try again later.":"Сервис временно недоступен. Повторите попытку позже.","Too many requests. Please try again a bit later.":"Слишком много запросов. Попробуйте ещё раз немного позже.","Authentication failed. Please sign in again.":"Не удалось пройти аутентификацию. Пожалуйста, войдите снова.","You are not allowed to perform this action.":"У вас нет прав для выполнения этого действия.","Some of the provided data is invalid.":"Некоторые из переданных данных некорректны.","This operation is not supported.":"Эта операция не поддерживается.","Request payload is too large.":"Тело запроса слишком большое.","This media type is not supported.":"Этот тип данных не поддерживается.","You have exceeded the upload quota.":"Превышена квота на загрузку файлов.","Network error while uploading the file.":"Сетевая ошибка при загрузке файла.","File upload took too long.":"Загрузка файла выполнялась слишком долго.","Server error while uploading the file.":"Ошибка сервера при загрузке файла.","The specified URL is not valid.":"Указан некорректный URL.","The specified URL is not reachable.":"Указанный URL недоступен.","Content type at the URL is not allowed.":"Тип содержимого по указанному URL не поддерживается.","Failed to download file from the URL.":"Не удалось скачать файл по указанному URL.","Network error while downloading the file.":"Сетевая ошибка при скачивании файла.","File download took too long.":"Скачивание файла выполнялось слишком долго.","Server error while downloading the file.":"Ошибка сервера при скачивании файла.","Some items could not be processed.":"Не все элементы были обработаны успешно.","Failed to process all items in the batch.":"Не удалось обработать ни один элемент в пакетной операции.","Some items in the batch are in a conflicting state.":"Некоторые элементы в пакетной операции находятся в конфликтующем состоянии.","Some items in the batch did not pass validation.":"Некоторые элементы в пакетной операции не прошли валидацию.","AI service returned an invalid response.":"Сервис AI вернул некорректный ответ.","Failed to generate image using AI.":"Не удалось создать изображение с помощью AI.","You have reached the AI image generation limit.":"Достигнут лимит генерации изображений AI.","Error in external integration.":"Ошибка во внешней интеграции.","Error in a third-party service.":"Ошибка во внешнем сервисе.","An unknown error occurred.":"Произошла неизвестная ошибка.","Renaming is not allowed for this item.":"Переименование не разрешено для этого элемента.","Moving is not allowed for this item.":"Перемещение не разрешено для этого элемента.","Copying is not allowed for this item.":"Копирование не разрешено для этого элемента.","Deleting is not allowed for this item.":"Удаление не разрешено для этого элемента.","Cannot move an item into itself.":"Нельзя переместить элемент в самого себя.","Cannot move an item into its descendant folder.":"Нельзя переместить элемент в дочернюю папку.","Cannot copy an item into itself.":"Нельзя скопировать элемент в самого себя.","Configuration error occurred.":"Произошла ошибка конфигурации.","Storage quota exceeded. Please free up space.":"Превышена квота хранилища. Освободите место.","File is locked by another process or user.":"Файл заблокирован другим процессом или пользователем.","File version conflict. Please refresh and try again.":"Конфликт версий файла. Обновите страницу и попробуйте снова.","Batch operation exceeds the maximum number of items allowed.":"Пакетная операция превышает максимально допустимое количество элементов.",Moved:"Перемещены: {{names}}",move_success_summary:"Перемещено {{successCount}} из {{totalCount}} объектов",move_fail_summary:"Не удалось переместить {{failCount}} из {{totalCount}} объектов",Copied:"Скопированы: {{names}}",copy_success_summary:"Скопировано {{successCount}} из {{totalCount}} объектов",copy_fail_summary:"Не удалось скопировать {{failCount}} из {{totalCount}} объектов",Uploaded:"Загружены: {{names}}",Failed:"Не удалось: {{names}}","Failed to upload":"Не удалось загрузить {{failCount}} из {{count}} файла","Failed to upload files":"Не удалось загрузить {{failCount}} из {{count}} файлов",months:{january:"января",february:"февраля",march:"марта",april:"апреля",may:"мая",june:"июня",july:"июля",august:"августа",september:"сентября",october:"октября",november:"ноября",december:"декабря"},files:"файлов","No available folders":"Нет доступных папок","My files":"Мои файлы",GIF:"GIF","Stock images":"Стоковые изображения","QR & Barcode":"QR и штрихкод","QR code":"QR-код",Barcode:"Штрихкод","Text or URL":"Текст или ссылка","Code color":"Цвет кода","Background color":"Цвет фона","Add to My files":"Добавить в Мои файлы","Transparent background":"Прозрачный фон","Barcode generation failed":"Не удалось построить штрихкод. Используйте символы, поддерживаемые CODE128.","Validation error":"Ошибка валидации","Enter text or URL to preview":"Введите текст или URL для предпросмотра.",Preview:"Предпросмотр","QR transparent background hint":"Прозрачный PNG может сливаться с тёмной темой письма; белый фон часто надёжнее для сканеров.","QR image size px":"Размер QR","Barcode bar height px":"Высота штрихов",Icons:"Иконки",AI:"AI","AI image generation":"AI генерация изображений","Search GIFs":"Найти GIF","That`s all we could find.":"Это все, что мы смогли найти.","Search image":"Найти изображение",All:"Все",Landscape:"Горизонтальные",Portrait:"Вертикальные",Squarish:"Квадратные",Black:"Черный","Black and White":"Черно-белый",White:"Белый",Orange:"Оранжевый",Red:"Красный",Purple:"Фиолетовый",Magenta:"Пурпурный",Green:"Зеленый",Teal:"Бирюзовый",Blue:"Синий","Photo by":"Фото",on:"на","File Manager":"Файловый менеджер","File Manager not configured":"Файловый менеджер не настроен","Filter by type":"Фильтр по типу","All types":"Все типы","File name":"Имя файла",Actions:"Действия","Add file":"Добавить файл","Add folder":"Добавить папку","Add file by URL":"Добавить файл по URL","File moved":"Файл перемещён","Files moved":"Файлы перемещены","Error when moving a file":"Ошибка при перемещении файла","Files copied":"Файлы скопированы","Failed to download file":"Не удалось скачать файл","Failed to load JSON data":"Не удалось загрузить данные JSON","Invalid file URL":"Некорректный URL файла","Unable to validate file URL":"Не удалось проверить файл по URL","Type to search...":"Введите для поиска...",Submit:"Отправить","No folders yet":"Папок пока нет","Drag files to upload":"Перетащите файлы для загрузки","Drop files here to upload":"Отпустите файлы здесь, чтобы загрузить их","Newest first":"Сначала новые","Oldest first":"Сначала старые","Largest first":"Сначала большие","Smallest first":"Сначала маленькие","A-Z":"По алфавиту А-Я","Z-A":"По алфавиту Я-А","By type":"По типу","Evaluating the task":"Оценка задания","Something went wrong, please try again":"Что-то пошло не так, пожалуйста, попробуйте еще раз","Sort by":"Сортировать по","preview text":"Изображение загружается ...","Use this variant":"Использовать этот вариант","Confirm deletion":"Подтвердить удаление","Are you sure you want to delete the selected items?":"Вы уверены, что хотите удалить выбранные элементы?","Move to Trash":"Переместить в корзину","Are you sure you want to move the selected items to the Trash?":"Вы уверены, что хотите переместить выбранные элементы в корзину?","Permanently delete":"Полное удаление","Delete permanently":"Удалить безвозвратно","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Вы уверены, что хотите безвозвратно удалить выбранные элементы? Это действие нельзя отменить.",Clear:"Очистить","Clear Trash":"Очистить корзину","Are you sure you want to permanently delete all items from Trash?":"Вы уверены, что хотите безвозвратно удалить все элементы из корзины?","Trash cleared successfully":"Корзина успешно очищена","{{count}} items permanently deleted":"{{count}} элементов безвозвратно удалено","Trash partially cleared":"Корзина частично очищена","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} элементов удалено, {{failed}} не удалось удалить","Failed to clear trash":"Не удалось очистить корзину","Error clearing trash":"Ошибка при очистке корзины","Deleting items...":"Удаление элементов...",delete_files_permanent_one:"Это действие безвозвратно удалит {{count}} файл",delete_files_permanent_few:"Это действие безвозвратно удалит {{count}} файла",delete_files_permanent_many:"Это действие безвозвратно удалит {{count}} файлов",delete_files_permanent_other:"Это действие безвозвратно удалит {{count}} файлов",delete_folder_permanent:"Это действие безвозвратно удалит папку «{{name}}» и всё её содержимое, включая {{count}} элементов.",delete_mixed_permanent:"Это действие безвозвратно удалит {{total}} выбранных элементов, включая {{folders}} папок и все {{images}} изображений внутри них.",permanent_delete_warning:"Удаление файлов, которые были использованы в письмах, приведет к проблемам с отображением картинок в старых письмах. Вы уверены, что хотите полностью удалить выбранное?",move_files_to_trash_one:"Это действие переместит в корзину {{count}} файл.",move_files_to_trash_few:"Это действие переместит в корзину {{count}} файла.",move_files_to_trash_many:"Это действие переместит в корзину {{count}} файлов.",move_files_to_trash_other:"Это действие переместит в корзину {{count}} файлов.",move_folder_to_trash:"Это действие переместит в корзину папку «{{name}}» и всё её содержимое ({{count}} элементов).",move_mixed_to_trash:"Это действие переместит в корзину {{total}} выбранных элементов, включая {{folders}} папок и {{images}} изображений.",delete_count_confirm_trash_one:"Переместить в корзину {{count}} файл?",delete_count_confirm_trash_few:"Переместить в корзину {{count}} файла?",delete_count_confirm_trash_many:"Переместить в корзину {{count}} файлов?",delete_count_confirm_trash_other:"Переместить в корзину {{count}} файлов?",delete_count_confirm_permanent_one:"Удалить навсегда {{count}} файл?",delete_count_confirm_permanent_few:"Удалить навсегда {{count}} файла?",delete_count_confirm_permanent_many:"Удалить навсегда {{count}} файлов?",delete_count_confirm_permanent_other:"Удалить навсегда {{count}} файлов?",delete_count_confirm_one:"Удалить {{count}} файл?",delete_count_confirm_few:"Удалить {{count}} файла?",delete_count_confirm_many:"Удалить {{count}} файлов?",delete_count_confirm_other:"Удалить {{count}} файлов?",item:"файл",items:"файлов",Trash:"Корзина",Choose:"Выбрать",Stock:"Фотосток","Select an image from our library":"Выберите изображение из нашей библиотеки","AI generation":"AI генерация","Creating an image on demand":"Создание изображения по запросу","Search file or folder":"Найти файл или папку","Click here to select a file":"Нажмите здесь, чтобы выбрать файл","Supported files:":"Поддерживаемые файлы:","Create folder":"Создать папку",Done:"Готово","Move here":"Переместить сюда","Copy here":"Копировать сюда","File URL":"URL файла","There's nothing here":"Здесь ничего нет","Try using a different search query.":"Попробуйте использовать другой поисковый запрос.","Millions of free stock images":"Миллионы бесплатных стоковых изображений","Enter a search query and we'll find the perfect image for you":"Введите поисковый запрос, и мы найдем для вас идеальное изображение","Millions of icons":"Миллионы иконок","Lucide icons":"Иконки Lucide","Thousands of icons":"Тысячи иконок","Enter a search query and we'll find the perfect icon for you":"Введите поисковый запрос, и мы найдем для вас идеальную иконку","Enter your query and we will find the right one for you":"Введите запрос и мы найдем для вас подходящее","Over 350,000 live images":"Более 350 000 живых изображений","The folder will be created in the root directory.":"Папка будет создана в корневом каталоге.",undo:"ОТМЕНА",moved_to_trash_one:"Перемещён {{count}} элемент в корзину",moved_to_trash_few:"Перемещено {{count}} элемента в корзину",moved_to_trash_many:"Перемещено {{count}} элементов в корзину",moved_to_trash_other:"Перемещено {{count}} элементов в корзину",restored_items_one:"Восстановлён {{count}} элемент",restored_items_few:"Восстановлено {{count}} элемента",restored_items_many:"Восстановлено {{count}} элементов",restored_items_other:"Восстановлено {{count}} элементов",Type:"Тип","Generate image":"Cгенерировать изображение","A beautiful image of a sunset over a calm ocean.":"Красивое изображение заката над спокойным океаном.","For example:":"Например:",Insert:"Вставить",Error:"Ошибка","Upload progress":"Загрузка {{completed}}/{{total}}","Uploading files":"Загрузка {{completed}}/{{total}} файлов","Uploaded files":"Загружено {{success}} из {{total}} файлов","Upload error files":"Ошибка загрузки {{errorCount}} файлов","Applies to all {{count}} files":"(применительно ко всем {{count}} файлам)","Some files failed to upload":"Некоторые файлы не удалось загрузить. Проверьте размер и формат файлов.",upload_error_hint_invalid_name:"Переименуйте файл: используйте только буквы, цифры, дефис и подчёркивание.",upload_error_hint_size:"Уменьшите размер файла или выберите другой.",upload_error_hint_format:"Используйте допустимый формат: JPG, PNG или GIF.",upload_error_hint_exists:"Файл с таким именем уже есть в папке. Переименуйте файл.","Images generated successfully":"Изображения успешно сгенерированы","Trash is empty":"Корзина пуста","Deleted files will be displayed here":"Здесь будут отображаться удаленные файлы","Stroke width":"Толщина",Style:"Стиль",Color1:"Цвет",Color2:"Цвет 2",Color3:"Цвет 3","Global search":"Глобальный поиск","Family search":"Поиск по семейству","Choose for template":"Выбрать для загрузки в шаблон",Back:"Назад","Editing: {{name}}":"Редактирование: {{name}}","Editing image":"Редактирование изображения",Save:"Сохранить","Loading editor...":"Загрузка редактора…","Error loading image":"Ошибка загрузки изображения","Error saving image":"Ошибка при сохранении изображения","Error initializing editor":"Ошибка инициализации редактора","Close File Manager":"Закрыть файловый менеджер","Are you sure you want to close? Unsaved changes will be lost.":"Вы уверены, что хотите закрыть? Несохраненные изменения будут потеряны.","Are you sure you want to close the file manager?":"Вы уверены, что хотите закрыть файловый менеджер?",Close:"Закрыть",KB:"КБ","No files":"Нет файлов","Folder is empty or files not found":"Папка пуста или файлы не найдены","Search files...":"Поиск файлов...",Success:"Успех","Image updated successfully":"Изображение успешно обновлено","Failed to save changes":"Не удалось сохранить изменения: {{error}}","Unknown error":"Неизвестная ошибка","Select destination folder":"Выберите папку назначения","Error moving":"Ошибка при перемещении","Error deleting":"Ошибка при удалении","Error copying":"Ошибка при копировании","Error renaming":"Ошибка при переименовании","Failed to refresh folder tree":"Не удалось обновить дерево папок","Failed to refresh file list":"Не удалось обновить список файлов","Errors occurred while moving":"При перемещении произошли ошибки","Errors occurred while copying":"При копировании произошли ошибки","(error)":"(ошибка)","(circular reference)":"(циклическая ссылка)","File too large. Maximum size: {{size}}":"Файл слишком большой. Максимальный размер: {{size}}","File too small. Minimum size: {{size}}":"Файл слишком маленький. Минимальный размер: {{size}}","Unsupported file type":"Неподдерживаемый тип файла","Unsupported file type: {{type}}":"Неподдерживаемый тип файла: {{type}}",unknown:"неизвестный","Failed to load files":"Не удалось загрузить файлы","Failed to load files in folder":"Не удалось загрузить содержимое папки «{{folderName}}»","Failed to load subfolders in folder":"Не удалось загрузить подпапки в «{{folderName}}»","Failed to load folder items count in folder":"Не удалось получить число элементов в «{{folderName}}»","DataProvider for folder deletion is not configured":"DataProvider для удаления папок не настроен","DataProvider for file upload is not configured":"DataProvider для загрузки файлов не настроен","Error uploading file {{fileName}}":"Ошибка при загрузке файла {{fileName}}","Error uploading file":"Ошибка при загрузке файла","Cannot upload files to Trash":"Нельзя загружать файлы в корзину","Please fill in all fields":"Заполните все поля","URL too long":"URL слишком длинный","Only http and https URLs are supported":"Поддерживаются только URL с протоколом http и https","Private and local URLs are not allowed":"Локальные и приватные URL запрещены","Upload by URL is not supported":"Загрузка по URL не поддерживается","File name is too long. Maximum {{max}} characters":"Имя файла слишком длинное. Максимум {{max}} символов","File name contains invalid characters":"Имя файла содержит недопустимые символы","Large file may take a long time to upload":"Большой файл может загружаться долго","File unavailable: {{status}} {{statusText}}":"Файл недоступен: {{status}} {{statusText}}","File too large: {{size}}":"Файл слишком большой: {{size}}","Unsupported file type: {{contentType}}":"Неподдерживаемый тип файла: {{contentType}}","Invalid server response: folder ID is missing":"Некорректный ответ от сервера: отсутствует ID папки","Error: folder cannot be its own parent":"Ошибка: папка не может быть родителем самой себя","Upload to Trash is forbidden":"Загрузка в корзину запрещена","renameFolder is not implemented in dataProviders":"renameFolder не реализован в dataProviders","renameFile is not implemented in dataProviders":"renameFile не реализован в dataProviders",Deleted:"Удаленные файлы",Clean:"Очистить","Circular dependency detected: folder cannot be its own parent":"Обнаружена циклическая зависимость: папка не может быть родителем самой себя","Save as copy and choose":"Сохранить как копию и выбрать","Save and choose":"Сохранить и выбрать",pixie:{"added drawing":"Добавление рисунка","added frame":"Добавление рамки","added image":"Добавление изображения","added shape":"Добавление фигуры","added sticker":"Добавление стикера","added text":"Добавление текста","applied filters":"Применение фильтр",apply:"Применить",background:"Фон","background color":"Фоновый цвет",beach:"Пляж","brush color":"Цвет кисти","brush size":"Размер кисти","brush type":"Тип кисти",bubbles:"Пузырьки",Cancel:"Отмена","changed style":"Изменение стиля","Circle Brush":"Круги",close:"Закрыть",color:"Цвет",corners:"Углы",crop:"Обрезать",Custom:"Пользовательский","deleted object":"Удаление объекта","Diamond Brush":"Алмаз",doodles:"Цветные",draw:"Рисунок",emoticons:"Смайлики","Eraser Brush":"Ластик",filter:"Фильтр",font:"Шрифт","font size":"Размер шрифта",frame:"Рамка",gradient:"Градиент",height:"Высота",history:"История","H Line Brush":"Н-образная",image:"Изображение",initial:"Начальный",landmarks:"Достопримечательности","loaded state":"Загрузка состояния","loading canvas":"Загрузка","loading image":"Загрузка","loading state":"Загрузка","maintain aspect ratio":"Maintain aspect ratio",merge:"Объединение","merged objects":"Объединение объектов","new text":"Новая надпись",objects:"Объект",opacity:"Прозрачность",outline:"Контур","outline color":"Цвет контура","Pencil Brush":"Карандаш","processing image":"Загрузка",quality:"Качество",radius:"Радиус","replace image":"Replace Image","replaced background image":"Удаление фонового изображения",resize:"Размер","resized image":"Изменение размера","rounded corner":"Загругление углов",save:"Сохранить",shadow:"Тень","shadow color":"Цвет тени",shapes:"Фигуры","Spray Brush":"Спрей",square:"Квардрат","Square Brush":"Квардрат",stickers:"Стикеры",text:"Надпись",texture:"Текстура",transportation:"Транспорт","V Line Brush":"V-образная",width:"Ширина",grayscale:"Оттенки серого","black & White":"Черно-белый",sharpen:"Резкость",invert:"Инверсия",vintage:"Винтаж",polaroid:"Полароид",kodachrome:"Кодахром",technicolor:"Техниколор",brownie:"Коричневый",sepia:"Сепия","remove Color":"Удалить цвет",brightness:"Яркость",gamma:"Гамма",noise:"Шум",pixelate:"Пиксельизация",blur:"Размытие",emboss:"Тиснение","blend Color":"Смешать цвет",distance:"Расстояние",red:"Красный",green:"Зеленый",blue:"Синий",blocksize:"Размер блока",alpha:"Альфа",add:"Добавить",multiply:"Умножить",subtract:"Вычесть",diff:"Разница",screen:"Экран",lighten:"Осветлить",darken:"Затемнить","select an option...":"Выберите опцию..."}},xr={Files:"Файли",selected:"обрано",Deselected:"Скасувати вибір",Refresh:"Оновити","Select all":"Вибрати все",Rename:"Перейменувати","Rename file":"Перейменувати файл {{currentFileName}}","Select the destination folder":"Виберіть папку призначення","Selected files:":"Обрано файлів:","Selected files":"Обрано файлів: {{count}}",selected_files_one:"Обрано {{count}} файл",selected_files_few:"Обрано {{count}} файли",selected_files_many:"Обрано {{count}} файлів",selected_files_other:"Обрано {{count}} файлів",Copy:"Дублювати",Edit:"Змінити",Move:"Перемістити","Move to":"Перемістити",Delete:"Видалити","New folder":"Нова папка","Image search...":"Пошук зображень...","Search icons":"Знайти іконки","By name":"За назвою","By size":"За розміром","By date":"За датою",List:"Список",Grid:"Плитки",Main:"Головна",Folders:"Папки","total pages":"Всього {{total}} елементів",Name:"Назва",Untitled:"Без назви",Size:"Розмір","Stroke width":"Товщина обведення",Dimensions:"Розмір",Date:"Дата",error:"помилка",Folder:"Папка",created:"створена","Failed to create folder":"Не вдалося створити папку","File deleted":"Файл видалено","Error when deleting a file":"Помилка при видаленні файлу","Folder deleted":"Папку видалено","Error when deleting a folder":"Помилка при видаленні папки","Delete folder":"Видалити папку","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Ви впевнені, що хочете видалити цю папку? Ця дія також видалить усі файли та підпапки.","API-endpoint for file upload is not configured":"API-endpoint для завантаження файлів не налаштовано","Please select an image file":"Будь ласка, виберіть файл зображення",File:"Файл","has been successfully uploaded":"успішно завантажено","The URL must point to an image":"URL повинен вказувати на зображення","Image upload...":"Завантаження зображення...",Unknown:"Невідомо","Error downloading file by URL":"Помилка завантаження файлу за URL","successfully uploaded":"успішно завантажено","Error when downloading a file by URL":"Помилка при завантаженні файлу за URL","Error when uploading a file":"Помилка при завантаженні файлу","Error loading files":"Помилка завантаження файлів","File not found":"Файл не знайдено","File renamed to":"Файл перейменовано на ","Failed to rename the file":"Не вдалося перейменувати файл","Folder renamed to":"Папку перейменовано на","Rename folder":"Перейменувати папку","New folder name":"Нова назва папки","Enter a new folder name":"Введіть нову назву папки","Please drag and drop image files only":"Будь ласка, перетягуйте лише файли зображень","Upload file by URL":"Завантажити файл за URL","Upload file":"Завантажити файл","Creating a new folder":"Створення нової папки",Create:"Створити",Cancel:"Скасувати","Folder name":"Назва папки","Enter the name of the folder":"Введіть назву папки","Enter the name":"Введіть назву","A folder will be created inside:":"Папка буде створена всередині:","selected folder":"обраної папки","The folder will be created in the root directory":"Папка буде створена в кореневому каталозі","Failed to load folders":"Не вдалося завантажити папки","Folder name cannot be empty":"Назва папки не може бути порожньою","Folder creation provider is not configured":"Постачальник створення папок не налаштований","Folder created":"Папку створено","Folder rename is disabled by config":"Перейменування папок вимкнено в налаштуваннях","Folder rename provider is not configured":"Постачальник перейменування папок не налаштований","Unexpected response when renaming folder":"Неочікувана відповідь під час перейменування папки","Folder renamed":"Папку перейменовано","Failed to rename folder":"Не вдалося перейменувати папку","Failed to load folder items count":"Не вдалося отримати кількість елементів у папці","Failed to load subfolders":"Не вдалося завантажити підпапки",Download:"Завантажити","image URL":"URL зображення","Enter the URL of the image":"Введіть URL зображення","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Підтримувані формати: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Нова назва файлу","Enter a new file name":"Введіть нову назву файлу","Copy to folder":"Копіювати в папку",Added:"Додано {{date}}","File uploaded successfully":"Файл {{fileName}} успішно завантажено","Successfully uploaded":"Успішно завантажено {{successCount}} з {{count}} файлу","Successfully uploaded files":"Успішно завантажено {{successCount}} з {{count}} файлів",uploads_success_summary:"Завантажено {{successCount}} з {{totalCount}} файлів",uploads_fail_summary:"Не вдалося завантажити {{failCount}} з {{totalCount}} файлів","File with this name already exists.":"Файл з такою назвою вже існує.","File not found or no longer available.":"Файл не знайдено або його вже видалено.","You don't have permission to access this file.":"У вас немає прав доступу до цього файлу.","File is too large to upload.":"Файл занадто великий для завантаження.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"Файл занадто великий ({{fileSize}}). Дозволений максимальний розмір — {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Перевищено максимальну кількість файлів. Дозволено: {{allowed}}, обрано: {{received}}","This file type is not allowed.":"Цей тип файлу не підтримується.","File name is not valid.":"Неприпустима назва файлу.","File name is not valid. Allowed characters: {{allowedChars}}":"Неприпустима назва файлу. Допустимі символи: {{allowedChars}}","Failed to read the file.":"Не вдалося прочитати файл.","Failed to write the file.":"Не вдалося записати файл.","The file appears to be corrupted.":"Файл пошкоджений або має неправильний формат.","File integrity check failed.":"Перевірка цілісності файлу завершилась невдало.","Folder not found or no longer available.":"Папку не знайдено або її вже видалено.","Folder with this name already exists.":"Папка з такою назвою вже існує.","A folder with that name already exists. Please enter a different folder name.":"Папка з такою назвою вже існує. Введіть інше ім'я папки.","You don't have permission to access this folder.":"У вас немає прав доступу до цієї папки.","Folder name is not valid.":"Неприпустима назва папки.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Не вдалося створити папку. Допустимі символи в назві папки: {{allowedChars}}","Failed to read the folder contents.":"Не вдалося прочитати вміст папки.","Failed to write to the folder.":"Не вдалося виконати операцію з папкою.","Folder storage quota exceeded.":"Перевищено квоту зберігання для папки.","Folder is not empty.":"Папка не порожня.","Server error while processing the folder.":"Помилка сервера під час обробки папки.","Folder operation took too long.":"Операція з папкою зайняла надто багато часу.","Network error. Please check your connection and try again.":"Помилка мережі. Перевірте підключення до інтернету та повторіть спробу.","The operation took too long. Please try again.":"Операція виконувалася надто довго. Спробуйте ще раз.","Server error. Please try again later.":"Помилка на сервері. Повторіть спробу пізніше.","Service is temporarily unavailable. Please try again later.":"Сервіс тимчасово недоступний. Повторіть спробу пізніше.","Too many requests. Please try again a bit later.":"Занадто багато запитів. Спробуйте ще раз пізніше.","Authentication failed. Please sign in again.":"Не вдалося пройти автентифікацію. Будь ласка, увійдіть знову.","You are not allowed to perform this action.":"У вас немає прав для виконання цієї дії.","Some of the provided data is invalid.":"Деякі з переданих даних є некоректними.","This operation is not supported.":"Ця операція не підтримується.","Request payload is too large.":"Тіло запиту занадто велике.","This media type is not supported.":"Цей тип даних не підтримується.","You have exceeded the upload quota.":"Перевищено квоту на завантаження файлів.","Network error while uploading the file.":"Помилка мережі під час завантаження файлу.","File upload took too long.":"Завантаження файлу тривало надто довго.","Server error while uploading the file.":"Помилка сервера під час завантаження файлу.","The specified URL is not valid.":"Вказано некоректну URL-адресу.","The specified URL is not reachable.":"Вказана URL-адреса недоступна.","Content type at the URL is not allowed.":"Тип вмісту за вказаною URL-адресою не підтримується.","Failed to download file from the URL.":"Не вдалося завантажити файл за вказаною URL-адресою.","Network error while downloading the file.":"Помилка мережі під час завантаження файлу.","File download took too long.":"Завантаження файлу тривало надто довго.","Server error while downloading the file.":"Помилка сервера під час завантаження файлу.","Some items could not be processed.":"Не всі елементи були оброблені успішно.","Failed to process all items in the batch.":"Не вдалося обробити жоден елемент у пакетній операції.","Some items in the batch are in a conflicting state.":"Деякі елементи в пакетній операції перебувають у конфліктному стані.","Some items in the batch did not pass validation.":"Деякі елементи в пакетній операції не пройшли валідацію.","AI service returned an invalid response.":"Сервіс ШІ повернув некоректну відповідь.","Failed to generate image using AI.":"Не вдалося створити зображення за допомогою ШІ.","You have reached the AI image generation limit.":"Досягнуто ліміту генерації зображень ШІ.","Error in external integration.":"Помилка у зовнішній інтеграції.","Error in a third-party service.":"Помилка у зовнішньому сервісі.","An unknown error occurred.":"Сталася невідома помилка.","Renaming is not allowed for this item.":"Перейменування не дозволено для цього елемента.","Moving is not allowed for this item.":"Переміщення не дозволено для цього елемента.","Copying is not allowed for this item.":"Копіювання не дозволено для цього елемента.","Deleting is not allowed for this item.":"Видалення не дозволено для цього елемента.","Cannot move an item into itself.":"Не можна перемістити елемент у самого себе.","Cannot move an item into its descendant folder.":"Не можна перемістити елемент у дочірню папку.","Cannot copy an item into itself.":"Не можна скопіювати елемент у самого себе.","Configuration error occurred.":"Сталася помилка конфігурації.","Storage quota exceeded. Please free up space.":"Перевищено квоту сховища. Звільніть місце.","File is locked by another process or user.":"Файл заблоковано іншим процесом або користувачем.","File version conflict. Please refresh and try again.":"Конфлікт версій файлу. Оновіть сторінку та спробуйте ще раз.","Batch operation exceeds the maximum number of items allowed.":"Пакетна операція перевищує максимально допустиму кількість елементів.",Moved:"Переміщено: {{names}}",move_success_summary:"Переміщено {{successCount}} з {{totalCount}} елементів",move_fail_summary:"Не вдалося перемістити {{failCount}} з {{totalCount}} елементів",Copied:"Скопійовано: {{names}}",copy_success_summary:"Скопійовано {{successCount}} з {{totalCount}} елементів",copy_fail_summary:"Не вдалося скопіювати {{failCount}} з {{totalCount}} елементів",Uploaded:"Завантажено: {{names}}",Failed:"Не вдалося завантажити: {{names}}","Failed to upload":"Не вдалося завантажити {{failCount}} з {{count}} файлу","Failed to upload files":"Не вдалося завантажити {{failCount}} з {{count}} файлів",months:{january:"січня",february:"лютого",march:"березня",april:"квітня",may:"травня",june:"червня",july:"липня",august:"серпня",september:"вересня",october:"жовтня",november:"листопада",december:"грудня"},files:"файлів","No available folders":"Немає доступних папок","My files":"Мої файли",GIF:"GIF","Stock images":"Стокові зображення","QR & Barcode":"QR та штрихкод","QR code":"QR-код",Barcode:"Штрихкод","Text or URL":"Текст або посилання","Code color":"Колір коду","Background color":"Колір фону","Add to My files":"Додати в Мої файли","Transparent background":"Прозорий фон","Barcode generation failed":"Не вдалося побудувати штрихкод. Використовуйте символи, підтримувані CODE128.","Validation error":"Помилка валідації","Enter text or URL to preview":"Введіть текст або URL для попереднього перегляду.",Preview:"Попередній перегляд","QR transparent background hint":"Прозорий PNG може зливатися з темною темою листа; білий фон частіше надійніший для сканерів.","QR image size px":"Розмір QR","Barcode bar height px":"Висота штрихів",AI:"AI","AI image generation":"AI генерація зображень","Search GIFs":"Знайти GIF","That`s all we could find.":"Це все, що ми змогли знайти.","Search image":"Знайти зображення",All:"Всі",Landscape:"Горизонтальні",Portrait:"Вертикальні",Squarish:"Квадратні",Black:"Чорний","Black and White":"Чорно-білий",White:"Білий",Orange:"Помаранчевий",Red:"Червоний",Purple:"Фіолетовий",Magenta:"Пурпурний",Green:"Зелений",Teal:"Бірюзовий",Blue:"Синій","Photo by":"Фото",on:"на","File Manager":"Файловий менеджер","File Manager not configured":"Файловий менеджер не налаштовано","Filter by type":"Фільтр за типом","All types":"Всі типи","File name":"Назва файлу",Actions:"Дії","Add file":"Додати файл","Add folder":"Додати папку","Add file by URL":"Додати файл за URL","File moved":"Файл переміщено","Error when moving a file":"Помилка при переміщенні файлу","Failed to download file":"Не вдалося завантажити файл","Failed to load JSON data":"Не вдалося завантажити дані JSON","Invalid file URL":"Некоректний URL файлу","Unable to validate file URL":"Не вдалося перевірити файл за URL","Type to search...":"Введіть для пошуку...",Submit:"Надіслати","No folders yet":"Папок поки немає","Drag files to upload":"Перетягніть файли для завантаження","Drop files here to upload":"Відпустіть файли тут, щоб завантажити їх","Newest first":"Спочатку нові","Oldest first":"Спочатку старі","Largest first":"Спочатку великі","Smallest first":"Спочатку маленькі","A-Z":"За алфавітом А-Я","Z-A":"За алфавітом Я-А","By type":"За типом","Evaluating the task":"Оцінка завдання","Something went wrong, please try again":"Щось пішло не так, будь ласка, спробуйте ще раз","Sort by":"Сортувати за","preview text":"Зображення завантажується ...","Use this variant":"Використати цей варіант","Confirm deletion":"Підтвердити видалення","Are you sure you want to delete the selected items?":"Ви впевнені, що хочете видалити обрані елементи?","Move to Trash":"Перемістити в кошик","Are you sure you want to move the selected items to the Trash?":"Ви впевнені, що хочете перемістити обрані елементи в кошик?","Permanently delete":"Повне видалення","Delete permanently":"Видалити безповоротно","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Ви впевнені, що хочете безповоротно видалити обрані елементи? Цю дію не можна скасувати.",Clear:"Очистити","Clear Trash":"Очистити кошик","Are you sure you want to permanently delete all items from Trash?":"Ви впевнені, що хочете безповоротно видалити всі елементи з кошика?","Trash cleared successfully":"Кошик успішно очищено","{{count}} items permanently deleted":"{{count}} елементів безповоротно видалено","Trash partially cleared":"Кошик частково очищено","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} елементів видалено, {{failed}} не вдалося видалити","Failed to clear trash":"Не вдалося очистити кошик","Error clearing trash":"Помилка при очищенні кошика","Deleting items...":"Видалення елементів...",delete_files_permanent_one:"Ця дія безповоротно видалить {{count}} файл",delete_files_permanent_few:"Ця дія безповоротно видалить {{count}} файли",delete_files_permanent_many:"Ця дія безповоротно видалить {{count}} файлів",delete_files_permanent_other:"Ця дія безповоротно видалить {{count}} файлів",delete_folder_permanent:"Ця дія безповоротно видалить папку «{{name}}» і все її вміст, включаючи {{count}} елементів.",delete_mixed_permanent:"Ця дія безповоротно видалить {{total}} обраних елементів, включаючи {{folders}} папок і всі {{images}} зображень всередині них.",permanent_delete_warning:"Видалення файлів, які були використані в листах, призведе до проблем з відображенням зображень у старих листах. Ви впевнені, що хочете повністю видалити обране?",move_files_to_trash_one:"Ця дія перемістить у кошик {{count}} файл.",move_files_to_trash_few:"Ця дія перемістить у кошик {{count}} файли.",move_files_to_trash_many:"Ця дія перемістить у кошик {{count}} файлів.",move_files_to_trash_other:"Ця дія перемістить у кошик {{count}} файлів.",move_folder_to_trash:"Ця дія перемістить у кошик папку «{{name}}» і все її вміст ({{count}} елементів).",move_mixed_to_trash:"Ця дія перемістить у кошик {{total}} обраних елементів, включаючи {{folders}} папок і {{images}} зображень.",delete_count_confirm_trash_one:"Перемістити в кошик {{count}} файл?",delete_count_confirm_trash_few:"Перемістити в кошик {{count}} файли?",delete_count_confirm_trash_many:"Перемістити в кошик {{count}} файлів?",delete_count_confirm_trash_other:"Перемістити в кошик {{count}} файлів?",delete_count_confirm_permanent_one:"Видалити назавжди {{count}} файл?",delete_count_confirm_permanent_few:"Видалити назавжди {{count}} файли?",delete_count_confirm_permanent_many:"Видалити назавжди {{count}} файлів?",delete_count_confirm_permanent_other:"Видалити назавжди {{count}} файлів?",delete_count_confirm_one:"Видалити {{count}} файл?",delete_count_confirm_few:"Видалити {{count}} файли?",delete_count_confirm_many:"Видалити {{count}} файлів?",delete_count_confirm_other:"Видалити {{count}} файлів?",item:"файл",items:"файлів",Trash:"Видалені",Choose:"Обрати",Stock:"Фотосток","Select an image from our library":"Виберіть зображення з нашої бібліотеки","AI generation":"AI генерація","Creating an image on demand":"Створення зображення на замовлення","Search file or folder":"Знайти файл або папку","Click here to select a file":"Натисніть тут, щоб вибрати файл","Supported files:":"Підтримувані файли:","Create folder":"Створити папку",Done:"Готово","Move here":"Перемістити сюди","Copy here":"Копіювати сюди","File URL":"URL файлу","There's nothing here":"Тут нічого немає","Try using a different search query.":"Спробуйте використовувати інший пошуковий запит.","Millions of free stock images":"Мільйони безкоштовних стокових зображень","Enter a search query and we'll find the perfect image for you":"Введіть пошуковий запит, і ми знайдемо для вас ідеальне зображення","Millions of icons":"Мільйони іконок","Lucide icons":"Іконки Lucide","Thousands of icons":"Тисячі іконок","Enter a search query and we'll find the perfect icon for you":"Введіть пошуковий запит, і ми знайдемо для вас ідеальну іконку","Enter your query and we will find the right one for you":"Введіть запит і ми знайдемо для вас відповідне","Over 350,000 live images":"Понад 350 000 живих зображень","The folder will be created in the root directory.":"Папка буде створена в кореневому каталозі.",undo:"СКАСУВАТИ",moved_to_trash_one:"Переміщено {{count}} елемент у кошик",moved_to_trash_few:"Переміщено {{count}} елементи у кошик",moved_to_trash_many:"Переміщено {{count}} елементів у кошик",moved_to_trash_other:"Переміщено {{count}} елементів у кошик",restored_items_one:"Відновлено {{count}} елемент",restored_items_few:"Відновлено {{count}} елементи",restored_items_many:"Відновлено {{count}} елементів",restored_items_other:"Відновлено {{count}} елементів",Type:"Тип","Generate image":"Створити зображення","A beautiful image of a sunset over a calm ocean.":"Красиве зображення заходу сонця над спокійним океаном.","For example:":"Наприклад:",Insert:"Вставити",Error:"Помилка","Upload progress":"Завантаження {{completed}}/{{total}}","Uploading files":"Завантаження {{completed}}/{{total}} файлів","Uploaded files":"Завантажено {{success}} з {{total}} файлів","Upload error files":"Помилка завантаження {{errorCount}} файлів","Applies to all {{count}} files":"(стосується всіх {{count}} файлів)","Some files failed to upload":"Деякі файли не вдалося завантажити. Перевірте розмір та формат файлів.",upload_error_hint_invalid_name:"Перейменуйте файл: використовуйте лише літери, цифри, дефіс та підкреслення.",upload_error_hint_size:"Зменшіть розмір файлу або оберіть інший.",upload_error_hint_format:"Оберіть дозволений формат: JPG, PNG або GIF.",upload_error_hint_exists:"Файл з такою назвою вже є в папці. Перейменуйте файл.","Images generated successfully":"Зображення успішно створено","Choose for template":"Вибрати для завантаження в шаблон","Trash is empty":"Кошик порожній","Deleted files will be displayed here":"Тут будуть відображатися видалені файли","Editing: {{name}}":"Редагування: {{name}}","Editing image":"Редагування зображення",Save:"Зберегти","Loading editor...":"Завантаження редактора…","Error loading image":"Помилка завантаження зображення","Error saving image":"Помилка при збереженні зображення","Error initializing editor":"Помилка ініціалізації редактора","Close File Manager":"Закрити файловий менеджер","Are you sure you want to close? Unsaved changes will be lost.":"Ви впевнені, що хочете закрити? Незбережені зміни будуть втрачені.","Are you sure you want to close the file manager?":"Ви впевнені, що хочете закрити файловий менеджер?",Close:"Закрити",KB:"КБ","No files":"Немає файлів","Folder is empty or files not found":"Папка порожня або файли не знайдені","Search files...":"Пошук файлів...",Success:"Успіх","Image updated successfully":"Зображення успішно оновлено","Failed to save changes":"Не вдалося зберегти зміни: {{error}}","Unknown error":"Невідома помилка","Select destination folder":"Виберіть папку призначення","Error moving":"Помилка при переміщенні","Error deleting":"Помилка при видаленні","Error copying":"Помилка при копіюванні","Error renaming":"Помилка при перейменуванні","Failed to refresh folder tree":"Не вдалося оновити дерево папок","Failed to refresh file list":"Не вдалося оновити список файлів","Errors occurred while moving":"Під час переміщення виникли помилки","Errors occurred while copying":"Під час копіювання виникли помилки","(error)":"(помилка)","(circular reference)":"(циклічне посилання)","File too large. Maximum size: {{size}}":"Файл занадто великий. Максимальний розмір: {{size}}","File too small. Minimum size: {{size}}":"Файл занадто маленький. Мінімальний розмір: {{size}}","Unsupported file type":"Непідтримуваний тип файлу","Unsupported file type: {{type}}":"Непідтримуваний тип файлу: {{type}}",unknown:"невідомий","Failed to load files":"Не вдалося завантажити файли","Failed to load files in folder":"Не вдалося завантажити вміст папки «{{folderName}}»","Failed to load subfolders in folder":"Не вдалося завантажити підпапки в «{{folderName}}»","Failed to load folder items count in folder":"Не вдалося отримати кількість елементів у «{{folderName}}»","DataProvider for folder deletion is not configured":"DataProvider для видалення папок не налаштовано","DataProvider for file upload is not configured":"DataProvider для завантаження файлів не налаштовано","Error uploading file {{fileName}}":"Помилка при завантаженні файлу {{fileName}}","Error uploading file":"Помилка при завантаженні файлу","Cannot upload files to Trash":"Не можна завантажувати файли в кошик","Please fill in all fields":"Заповніть усі поля","URL too long":"URL занадто довгий","Only http and https URLs are supported":"Підтримуються лише URL з протоколом http та https","Private and local URLs are not allowed":"Локальні та приватні URL заборонені","Upload by URL is not supported":"Завантаження за URL не підтримується","File name is too long. Maximum {{max}} characters":"Ім'я файлу занадто довге. Максимум {{max}} символів","File name contains invalid characters":"Ім'я файлу містить неприпустимі символи","Large file may take a long time to upload":"Великий файл може завантажуватися довго","File unavailable: {{status}} {{statusText}}":"Файл недоступний: {{status}} {{statusText}}","File too large: {{size}}":"Файл занадто великий: {{size}}","Unsupported file type: {{contentType}}":"Непідтримуваний тип файлу: {{contentType}}","Invalid server response: folder ID is missing":"Некорректна відповідь сервера: відсутній ID папки","Error: folder cannot be its own parent":"Помилка: папка не може бути батьком самої себе","Upload to Trash is forbidden":"Завантаження в кошик заборонено","renameFolder is not implemented in dataProviders":"renameFolder не реалізовано в dataProviders","renameFile is not implemented in dataProviders":"renameFile не реалізовано в dataProviders",Clean:"Очистити","Circular dependency detected: folder cannot be its own parent":"Виявлено циклічну залежність: папка не може бути батьком самої себе","Save as copy and choose":"Зберегти як копію і вибрати","Save and choose":"Зберегти і вибрати",pixie:{"added drawing":"Додавання малюнка","added frame":"Додавання рамки","added image":"Додавання зображення","added shape":"Додавання фігури","added sticker":"Додавання стікера","added text":"Додавання тексту","applied filters":"Застосування фільтр",apply:"Застосувати",background:"Фон","background color":"Фоновий колір",beach:"Пляж","brush color":"Колір кисті","brush size":"Розмір кисті","brush type":"Тип кисті",bubbles:"Пузирці",Cancel:"Скасувати","changed style":"Зміна стилю","Circle Brush":"Кола",close:"Закрити",color:"Колір",corners:"Кути",crop:"Обрізати",Custom:"Користувацький","deleted object":"Видалення об'єкта","Diamond Brush":"Алмаз",doodles:"Кольорові",draw:"Малюнок",emoticons:"Смайлики","Eraser Brush":"Гумка",filter:"Фільтр",font:"Шрифт","font size":"Розмір шрифту",frame:"Рамка",gradient:"Градієнт",height:"Висота",history:"Історія","H Line Brush":"Н-подібна",image:"Зображення",initial:"Початковий",landmarks:"Пам'ятки","loaded state":"Завантаження стану","loading canvas":"Завантаження","loading image":"Завантаження","loading state":"Завантаження","maintain aspect ratio":"Maintain aspect ratio",merge:"Об'єднання","merged objects":"Об'єднання об'єктів","new text":"Новий напис",objects:"Об'єкт",opacity:"Прозорість",outline:"Контур","outline color":"Колір контуру","Pencil Brush":"Олівець","processing image":"Завантаження",quality:"Якість",radius:"Радіус","replace image":"Replace Image","replaced background image":"Видалення фонового зображення",resize:"Розмір","resized image":"Зміна розміру","rounded corner":"Заокруглення кутів",save:"Зберегти",shadow:"Тінь","shadow color":"Колір тіні",shapes:"Фігури","Spray Brush":"Спрей",square:"Квадрат","Square Brush":"Квадрат",stickers:"Стікери",text:"Напис",texture:"Текстура",transportation:"Транспорт","V Line Brush":"V-подібна",width:"Ширина",grayscale:"Відтінки сірого","black & White":"Чорно-білий",sharpen:"Різкість",invert:"Інверсія",vintage:"Вінтаж",polaroid:"Полароїд",kodachrome:"Кодахром",technicolor:"Техніколор",brownie:"Коричневий",sepia:"Сепія","remove Color":"Видалити колір",brightness:"Яскравість",gamma:"Гамма",noise:"Шум",pixelate:"Пікселізація",blur:"Розмиття",emboss:"Тиснення","blend Color":"Змішати колір",distance:"Відстань",red:"Червоний",green:"Зелений",blue:"Синій",blocksize:"Розмір блоку",alpha:"Альфа",add:"Додати",multiply:"Помножити",subtract:"Відняти",diff:"Різниця",screen:"Екран",lighten:"Освітлити",darken:"Затемнити","select an option...":"Виберіть опцію..."}},Pr={Files:"Arquivos",selected:"selecionado(s)",Deselected:"Desmarcar",Refresh:"Atualizar","Select all":"Selecionar tudo",Rename:"Renomear","Rename file":"Renomear arquivo {{currentFileName}}","Select the destination folder":"Selecionar a pasta de destino","Selected files:":"Arquivos selecionados:","Selected files":"Arquivos selecionados: {{count}}",selected_files_one:"{{count}} arquivo selecionado",selected_files_few:"{{count}} arquivos selecionados",selected_files_many:"{{count}} arquivos selecionados",selected_files_other:"{{count}} arquivos selecionados",Copy:"Duplicar",Edit:"Editar",Move:"Mover","Move to":"Mover para",Delete:"Excluir","New folder":"Nova pasta","Image search...":"Busca de imagens...","Search icons":"Encontrar ícones","By name":"Por nome","By size":"Por tamanho","By date":"Por data",List:"Lista",Grid:"Grade",Main:"Principal",Folders:"Pastas","total pages":"Total de {{total}} itens",Name:"Nome",Untitled:"Sem título",Size:"Tamanho","Stroke width":"Espessura do traço",Dimensions:"Dimensões",Date:"Data",error:"erro",Folder:"Pasta",created:"criada","Failed to create folder":"Falha ao criar pasta","File deleted":"Arquivo excluído","Error when deleting a file":"Erro ao excluir arquivo","Folder deleted":"Pasta excluída","Error when deleting a folder":"Erro ao excluir pasta","Delete folder":"Excluir pasta","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Tem certeza que deseja excluir esta pasta? Esta ação também excluirá todos os arquivos e subpastas.","API-endpoint for file upload is not configured":"Endpoint da API para upload de arquivos não está configurado","Please select an image file":"Por favor, selecione um arquivo de imagem",File:"Arquivo","has been successfully uploaded":"foi carregado com sucesso","The URL must point to an image":"A URL deve apontar para uma imagem","Image upload...":"Carregando imagem...",Unknown:"Desconhecido","Error downloading file by URL":"Erro ao baixar arquivo por URL","successfully uploaded":"carregado com sucesso","Error when downloading a file by URL":"Erro ao baixar arquivo por URL","Error when uploading a file":"Erro ao enviar arquivo","Error loading files":"Erro ao carregar arquivos","File not found":"Arquivo não encontrado","File renamed to":"Arquivo renomeado para","Failed to rename the file":"Falha ao renomear o arquivo","Folder renamed to":"Pasta renomeada para","Rename folder":"Renomear pasta","New folder name":"Novo nome da pasta","Enter a new folder name":"Digite um novo nome para a pasta","Please drag and drop image files only":"Por favor, arraste e solte apenas arquivos de imagem","Upload file by URL":"Carregar arquivo por URL","Upload file":"Carregar arquivo","Creating a new folder":"Criando uma nova pasta",Create:"Criar",Cancel:"Cancelar","Folder name":"Nome da pasta","Enter the name of the folder":"Digite o nome da pasta","Enter the name":"Digite o nome","A folder will be created inside:":"A pasta será criada dentro de:","selected folder":"pasta selecionada","The folder will be created in the root directory":"A pasta será criada no diretório raiz","Failed to load folders":"Não foi possível carregar as pastas","Folder name cannot be empty":"O nome da pasta não pode estar vazio","Folder creation provider is not configured":"O provedor de criação de pastas não está configurado","Folder created":"Pasta criada","Folder rename is disabled by config":"Renomear pastas está desabilitado pela configuração","Folder rename provider is not configured":"O provedor de renomeação de pastas não está configurado","Unexpected response when renaming folder":"Resposta inesperada ao renomear a pasta","Folder renamed":"Pasta renomeada","Failed to rename folder":"Não foi possível renomear a pasta","Failed to load folder items count":"Não foi possível obter a contagem de itens da pasta","Failed to load subfolders":"Não foi possível carregar as subpastas",Download:"Baixar","image URL":"URL da imagem","Enter the URL of the image":"Digite a URL da imagem","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Formatos suportados: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Novo nome do arquivo","Enter a new file name":"Digite um novo nome para o arquivo","Copy to folder":"Copiar para pasta",Added:"Adicionado em {{date}}","File uploaded successfully":"Arquivo {{fileName}} carregado com sucesso","Successfully uploaded":"{{successCount}} de {{count}} arquivo carregado com sucesso","Successfully uploaded files":"{{successCount}} de {{count}} arquivos carregados com sucesso",uploads_success_summary:"Enviados {{successCount}} de {{totalCount}} arquivos",uploads_fail_summary:"Falhou ao enviar {{failCount}} de {{totalCount}} arquivos","File with this name already exists.":"Já existe um arquivo com esse nome.","File not found or no longer available.":"O arquivo não foi encontrado ou já foi excluído.","You don't have permission to access this file.":"Você não tem permissão para acessar este arquivo.","File is too large to upload.":"O arquivo é grande demais para ser enviado.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"O arquivo é grande demais ({{fileSize}}). Tamanho máximo permitido: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Número máximo de arquivos excedido. Permitido: {{allowed}}, recebido: {{received}}","This file type is not allowed.":"Este tipo de arquivo não é permitido.","File name is not valid.":"O nome do arquivo não é válido.","File name is not valid. Allowed characters: {{allowedChars}}":"O nome do arquivo não é válido. Caracteres permitidos: {{allowedChars}}","Failed to read the file.":"Não foi possível ler o arquivo.","Failed to write the file.":"Não foi possível gravar o arquivo.","The file appears to be corrupted.":"O arquivo parece estar corrompido.","File integrity check failed.":"A verificação de integridade do arquivo falhou.","Folder not found or no longer available.":"A pasta não foi encontrada ou já foi excluída.","Folder with this name already exists.":"Já existe uma pasta com esse nome.","A folder with that name already exists. Please enter a different folder name.":"Já existe uma pasta com esse nome. Digite um nome diferente para a pasta.","You don't have permission to access this folder.":"Você não tem permissão para acessar esta pasta.","Folder name is not valid.":"O nome da pasta não é válido.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Não foi possível criar a pasta. Caracteres permitidos no nome: {{allowedChars}}","Failed to read the folder contents.":"Não foi possível ler o conteúdo da pasta.","Failed to write to the folder.":"Não foi possível gravar na pasta.","Folder storage quota exceeded.":"A cota de armazenamento da pasta foi excedida.","Folder is not empty.":"A pasta não está vazia.","Server error while processing the folder.":"Erro do servidor ao processar a pasta.","Folder operation took too long.":"A operação com a pasta demorou demais.","Network error. Please check your connection and try again.":"Erro de rede. Verifique sua conexão e tente novamente.","The operation took too long. Please try again.":"A operação demorou demais. Tente novamente.","Server error. Please try again later.":"Erro no servidor. Tente novamente mais tarde.","Service is temporarily unavailable. Please try again later.":"O serviço está temporariamente indisponível. Tente novamente mais tarde.","Too many requests. Please try again a bit later.":"Muitas solicitações. Tente novamente mais tarde.","Authentication failed. Please sign in again.":"Falha na autenticação. Faça login novamente.","You are not allowed to perform this action.":"Você não tem permissão para executar esta ação.","Some of the provided data is invalid.":"Alguns dos dados fornecidos são inválidos.","This operation is not supported.":"Esta operação não é suportada.","Request payload is too large.":"O corpo da requisição é grande demais.","This media type is not supported.":"Este tipo de mídia não é suportado.","You have exceeded the upload quota.":"Você excedeu a cota de upload de arquivos.","Network error while uploading the file.":"Erro de rede ao enviar o arquivo.","File upload took too long.":"O envio do arquivo demorou demais.","Server error while uploading the file.":"Erro do servidor ao enviar o arquivo.","The specified URL is not valid.":"A URL especificada não é válida.","The specified URL is not reachable.":"A URL especificada não está acessível.","Content type at the URL is not allowed.":"O tipo de conteúdo na URL não é permitido.","Failed to download file from the URL.":"Não foi possível baixar o arquivo da URL.","Network error while downloading the file.":"Erro de rede ao baixar o arquivo.","File download took too long.":"O download do arquivo demorou demais.","Server error while downloading the file.":"Erro do servidor ao baixar o arquivo.","Some items could not be processed.":"Nem todos os itens foram processados com sucesso.","Failed to process all items in the batch.":"Nenhum item do lote pôde ser processado.","Some items in the batch are in a conflicting state.":"Alguns itens do lote estão em estado de conflito.","Some items in the batch did not pass validation.":"Alguns itens do lote não passaram na validação.","AI service returned an invalid response.":"O serviço de IA retornou uma resposta inválida.","Failed to generate image using AI.":"Falha ao gerar imagem usando IA.","You have reached the AI image generation limit.":"Você atingiu o limite de geração de imagens por IA.","Error in external integration.":"Erro em uma integração externa.","Error in a third-party service.":"Erro em um serviço de terceiros.","An unknown error occurred.":"Ocorreu um erro desconhecido.","Renaming is not allowed for this item.":"Renomear não é permitido para este item.","Moving is not allowed for this item.":"Mover não é permitido para este item.","Copying is not allowed for this item.":"Copiar não é permitido para este item.","Deleting is not allowed for this item.":"Excluir não é permitido para este item.","Cannot move an item into itself.":"Não é possível mover um item para dentro de si mesmo.","Cannot move an item into its descendant folder.":"Não é possível mover um item para sua pasta descendente.","Cannot copy an item into itself.":"Não é possível copiar um item para dentro de si mesmo.","Configuration error occurred.":"Ocorreu um erro de configuração.","Storage quota exceeded. Please free up space.":"Cota de armazenamento excedida. Libere espaço.","File is locked by another process or user.":"O arquivo está bloqueado por outro processo ou usuário.","File version conflict. Please refresh and try again.":"Conflito de versão do arquivo. Atualize a página e tente novamente.","Batch operation exceeds the maximum number of items allowed.":"A operação em lote excede o número máximo de itens permitidos.",Moved:"Movidos: {{names}}",move_success_summary:"Movidos {{successCount}} de {{totalCount}} itens",move_fail_summary:"Falhou ao mover {{failCount}} de {{totalCount}} itens",Copied:"Copiados: {{names}}",copy_success_summary:"Copiados {{successCount}} de {{totalCount}} itens",copy_fail_summary:"Falhou ao copiar {{failCount}} de {{totalCount}} itens",Uploaded:"Arquivos enviados: {{names}}",Failed:"Falha ao enviar: {{names}}","Failed to upload":"Falha ao carregar {{failCount}} de {{count}} arquivo","Failed to upload files":"Falha ao carregar {{failCount}} de {{count}} arquivos",months:{january:"janeiro",february:"fevereiro",march:"março",april:"abril",may:"maio",june:"junho",july:"julho",august:"agosto",september:"setembro",october:"outubro",november:"novembro",december:"dezembro"},files:"arquivos","No available folders":"Nenhuma pasta disponível","My files":"Meus arquivos",GIF:"GIF","Stock images":"Imagens de stock","QR & Barcode":"QR e código de barras","QR code":"Código QR",Barcode:"Código de barras","Text or URL":"Texto ou URL","Code color":"Cor do código","Background color":"Cor de fundo","Add to My files":"Adicionar aos Meus arquivos","Transparent background":"Fundo transparente","Barcode generation failed":"Não foi possível gerar o código de barras. Use caracteres compatíveis com CODE128.","Validation error":"Erro de validação","Enter text or URL to preview":"Digite texto ou um URL para pré-visualizar.",Preview:"Pré-visualização","QR transparent background hint":"PNG transparente pode se misturar a temas escuros do e-mail; fundo branco costuma ser mais confiável para leitores.","QR image size px":"Tamanho do QR","Barcode bar height px":"Altura das barras",AI:"IA","AI image generation":"Geração de imagens por IA","Search GIFs":"Buscar GIFs","That`s all we could find.":"Isso é tudo que conseguimos encontrar.","Search image":"Buscar imagem",All:"Todos",Landscape:"Paisagem",Portrait:"Retrato",Squarish:"Quadrados",Black:"Preto","Black and White":"Preto e branco",White:"Branco",Orange:"Laranja",Red:"Vermelho",Purple:"Roxo",Magenta:"Magenta",Green:"Verde",Teal:"Verde-azulado",Blue:"Azul","Photo by":"Foto por",on:"em","File Manager":"Gerenciador de arquivos","File Manager not configured":"Gerenciador de arquivos não configurado","Filter by type":"Filtrar por tipo","All types":"Todos os tipos","File name":"Nome do arquivo",Actions:"Ações","Add file":"Adicionar arquivo","Add folder":"Adicionar pasta","Add file by URL":"Adicionar arquivo por URL","File moved":"Arquivo movido","Error when moving a file":"Erro ao mover arquivo","Failed to download file":"Não foi possível baixar o arquivo","Failed to load JSON data":"Não foi possível carregar os dados JSON","Invalid file URL":"URL de arquivo inválida","Unable to validate file URL":"Não foi possível validar a URL do arquivo","Type to search...":"Digite para buscar...",Submit:"Enviar","No folders yet":"Nenhuma pasta ainda","Drag files to upload":"Arraste arquivos para carregar","Drop files here to upload":"Solte os arquivos aqui para carregá-los","Newest first":"Mais recentes primeiro","Oldest first":"Mais antigos primeiro","Largest first":"Maiores primeiro","Smallest first":"Menores primeiro","A-Z":"A-Z","Z-A":"Z-A","By type":"Por tipo","Evaluating the task":"Avaliando a tarefa","Something went wrong, please try again":"Algo deu errado, por favor tente novamente","Sort by":"Ordenar por","preview text":"Carregando imagem...","Use this variant":"Usar esta variante","Confirm deletion":"Confirmar exclusão","Are you sure you want to delete the selected items?":"Tem certeza que deseja excluir os itens selecionados?","Move to Trash":"Mover para lixeira","Are you sure you want to move the selected items to the Trash?":"Tem certeza que deseja mover os itens selecionados para a lixeira?","Permanently delete":"Exclusão permanente","Delete permanently":"Excluir permanentemente","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Tem certeza que deseja excluir permanentemente os itens selecionados? Esta ação não pode ser desfeita.",Clear:"Limpar","Clear Trash":"Limpar lixeira","Are you sure you want to permanently delete all items from Trash?":"Tem certeza que deseja excluir permanentemente todos os itens da lixeira?","Trash cleared successfully":"Lixeira limpa com sucesso","{{count}} items permanently deleted":"{{count}} itens excluídos permanentemente","Trash partially cleared":"Lixeira parcialmente limpa","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} itens excluídos, {{failed}} falharam","Failed to clear trash":"Falha ao limpar lixeira","Error clearing trash":"Erro ao limpar lixeira","Deleting items...":"Excluindo itens...",delete_files_permanent_one:"Esta ação excluirá permanentemente {{count}} arquivo",delete_files_permanent_few:"Esta ação excluirá permanentemente {{count}} arquivos",delete_files_permanent_many:"Esta ação excluirá permanentemente {{count}} arquivos",delete_files_permanent_other:"Esta ação excluirá permanentemente {{count}} arquivos",delete_folder_permanent:"Esta ação excluirá permanentemente a pasta «{{name}}» e todo seu conteúdo, incluindo {{count}} itens.",delete_mixed_permanent:"Esta ação excluirá permanentemente {{total}} itens selecionados, incluindo {{folders}} pastas e todas as {{images}} imagens dentro delas.",permanent_delete_warning:"Excluir arquivos que foram usados em e-mails causará problemas na exibição de imagens em e-mails antigos. Tem certeza de que deseja excluir permanentemente a seleção?",move_files_to_trash_one:"Esta ação moverá {{count}} arquivo para a lixeira.",move_files_to_trash_few:"Esta ação moverá {{count}} arquivos para a lixeira.",move_files_to_trash_many:"Esta ação moverá {{count}} arquivos para a lixeira.",move_files_to_trash_other:"Esta ação moverá {{count}} arquivos para a lixeira.",move_folder_to_trash:"Esta ação moverá a pasta «{{name}}» e todo seu conteúdo ({{count}} itens) para a lixeira.",move_mixed_to_trash:"Esta ação moverá {{total}} itens selecionados para a lixeira, incluindo {{folders}} pastas e {{images}} imagens.",delete_count_confirm_trash_one:"Mover {{count}} arquivo para a lixeira?",delete_count_confirm_trash_few:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_trash_many:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_trash_other:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_permanent_one:"Excluir permanentemente {{count}} arquivo?",delete_count_confirm_permanent_few:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_permanent_many:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_permanent_other:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_one:"Excluir {{count}} arquivo?",delete_count_confirm_few:"Excluir {{count}} arquivos?",delete_count_confirm_many:"Excluir {{count}} arquivos?",delete_count_confirm_other:"Excluir {{count}} arquivos?",item:"arquivo",items:"arquivos",Trash:"Lixeira",Choose:"Escolher",Stock:"Banco de imagens","Select an image from our library":"Selecione uma imagem da nossa biblioteca","AI generation":"Geração por IA","Creating an image on demand":"Criando uma imagem sob demanda","Search file or folder":"Buscar arquivo ou pasta","Click here to select a file":"Clique aqui para selecionar um arquivo","Supported files:":"Arquivos suportados:","Create folder":"Criar pasta",Done:"Concluído","Move here":"Mover aqui","Copy here":"Copiar aqui","File URL":"URL do arquivo","There's nothing here":"Não há nada aqui","Try using a different search query.":"Tente usar uma consulta de pesquisa diferente.","Millions of free stock images":"Milhões de imagens de stock gratuitas","Enter a search query and we'll find the perfect image for you":"Digite uma consulta de busca e encontraremos a imagem perfeita para você","Millions of icons":"Milhões de ícones","Lucide icons":"Ícones Lucide","Thousands of icons":"Milhares de ícones","Enter a search query and we'll find the perfect icon for you":"Digite uma consulta de busca e encontraremos o ícone perfeito para você","Enter your query and we will find the right one for you":"Digite sua consulta e nós encontraremos a ideal para você","Over 350,000 live images":"Mais de 350.000 imagens ao vivo","The folder will be created in the root directory.":"A pasta será criada no diretório raiz.",undo:"DESFAZER",moved_to_trash_one:"{{count}} item movido para a lixeira",moved_to_trash_few:"{{count}} itens movidos para a lixeira",moved_to_trash_many:"{{count}} itens movidos para a lixeira",moved_to_trash_other:"{{count}} itens movidos para a lixeira",restored_items_one:"{{count}} item restaurado",restored_items_few:"{{count}} itens restaurados",restored_items_many:"{{count}} itens restaurados",restored_items_other:"{{count}} itens restaurados",Type:"Tipo","Generate image":"Gerar imagem","A beautiful image of a sunset over a calm ocean.":"Uma imagem bonita de um pôr do sol sobre um oceano tranquilo.","For example:":"Por exemplo:",Insert:"Inserir",Error:"Erro","Upload progress":"Enviando {{completed}}/{{total}}","Uploading files":"Enviando {{completed}}/{{total}} arquivos","Uploaded files":"Enviados {{success}} de {{total}} arquivos","Upload error files":"Erro ao enviar {{errorCount}} arquivos","Applies to all {{count}} files":"(aplica-se a todos os {{count}} arquivos)","Some files failed to upload":"Alguns arquivos não puderam ser enviados. Verifique o tamanho e o formato dos arquivos.",upload_error_hint_invalid_name:"Renomeie o arquivo: use apenas letras, números, hífens e sublinhados.",upload_error_hint_size:"Reduza o tamanho do arquivo ou escolha outro.",upload_error_hint_format:"Use um formato permitido: JPG, PNG ou GIF.",upload_error_hint_exists:"Já existe um arquivo com este nome na pasta. Renomeie o arquivo.","Images generated successfully":"Imagens geradas com sucesso","Choose for template":"Selecionar para carregar no modelo","Trash is empty":"A lixeira está vazia","Deleted files will be displayed here":"Os arquivos excluídos serão exibidos aqui","Editing: {{name}}":"Editando: {{name}}","Editing image":"Editando imagem",Save:"Salvar","Loading editor...":"Carregando editor...","Error loading image":"Erro ao carregar a imagem","Error saving image":"Erro ao salvar a imagem","Error initializing editor":"Erro ao inicializar o editor","Close File Manager":"Fechar gerenciador de arquivos","Are you sure you want to close? Unsaved changes will be lost.":"Tem certeza de que deseja fechar? As alterações não salvas serão perdidas.","Are you sure you want to close the file manager?":"Tem certeza de que deseja fechar o gerenciador de arquivos?",Close:"Fechar",KB:"KB","No files":"Nenhum arquivo","Folder is empty or files not found":"A pasta está vazia ou os arquivos não foram encontrados","Search files...":"Buscar arquivos...",Success:"Sucesso","Image updated successfully":"Imagem atualizada com sucesso","Failed to save changes":"Falha ao salvar alterações: {{error}}","Unknown error":"Erro desconhecido","Select destination folder":"Selecione a pasta de destino","Error moving":"Erro ao mover","Error deleting":"Erro ao excluir","Error copying":"Erro ao copiar","Error renaming":"Erro ao renomear","Failed to refresh folder tree":"Falha ao atualizar a árvore de pastas","Failed to refresh file list":"Falha ao atualizar a lista de arquivos","Errors occurred while moving":"Ocorreram erros ao mover","Errors occurred while copying":"Ocorreram erros ao copiar","(error)":"(erro)","(circular reference)":"(referência circular)","File too large. Maximum size: {{size}}":"Arquivo muito grande. Tamanho máximo: {{size}}","File too small. Minimum size: {{size}}":"Arquivo muito pequeno. Tamanho mínimo: {{size}}","Unsupported file type":"Tipo de arquivo não suportado","Unsupported file type: {{type}}":"Tipo de arquivo não suportado: {{type}}",unknown:"desconhecido","Failed to load files":"Falha ao carregar arquivos","Failed to load files in folder":"Não foi possível carregar o conteúdo da pasta ({{folderName}})","Failed to load subfolders in folder":'Não foi possível carregar subpastas em "{{folderName}}"',"Failed to load folder items count in folder":'Não foi possível obter a contagem de itens em "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider para exclusão de pastas não está configurado","DataProvider for file upload is not configured":"DataProvider para upload de arquivos não está configurado","Error uploading file {{fileName}}":"Erro ao carregar o arquivo {{fileName}}","Error uploading file":"Erro ao carregar o arquivo","Cannot upload files to Trash":"Não é possível carregar arquivos para a lixeira","Please fill in all fields":"Por favor, preencha todos os campos","URL too long":"URL muito longa","Only http and https URLs are supported":"Apenas URLs com protocolo http e https são suportadas","Private and local URLs are not allowed":"URLs locais e privadas não são permitidas","Upload by URL is not supported":"Upload por URL não é suportado","File name is too long. Maximum {{max}} characters":"O nome do arquivo é muito longo. Máximo de {{max}} caracteres","File name contains invalid characters":"O nome do arquivo contém caracteres inválidos","Large file may take a long time to upload":"Um arquivo grande pode demorar muito para ser carregado","File unavailable: {{status}} {{statusText}}":"Arquivo indisponível: {{status}} {{statusText}}","File too large: {{size}}":"Arquivo muito grande: {{size}}","Unsupported file type: {{contentType}}":"Tipo de arquivo não suportado: {{contentType}}","Invalid server response: folder ID is missing":"Resposta do servidor inválida: ID da pasta ausente","Error: folder cannot be its own parent":"Erro: a pasta não pode ser seu próprio pai","Upload to Trash is forbidden":"Enviar para a lixeira é proibido","renameFolder is not implemented in dataProviders":"renameFolder não está implementado em dataProviders","renameFile is not implemented in dataProviders":"renameFile não está implementado em dataProviders",Clean:"Limpar","Circular dependency detected: folder cannot be its own parent":"Dependência circular detectada: a pasta não pode ser seu próprio pai","Save as copy and choose":"Salvar como cópia e escolher","Save and choose":"Salvar e escolher",pixie:{"added drawing":"Desenho adicionado","added frame":"Moldura adicionada","added image":"Imagem adicionada","added shape":"Forma adicionada","added sticker":"Adesivo adicionado","added text":"Texto adicionado","applied filters":"Filtros aplicados",apply:"Aplicar",background:"Fundo","background color":"Cor de fundo",beach:"Praia","brush color":"Cor do pincel","brush size":"Tamanho do pincel","brush type":"Tipo de pincel",bubbles:"Bolhas",Cancel:"Cancelar","changed style":"Estilo alterado","Circle Brush":"Círculo",close:"Fechar",color:"Cor",corners:"Cantos",crop:"Cortar",Custom:"Personalizado","deleted object":"Objeto excluído","Diamond Brush":"Diamante",doodles:"Rabiscos",draw:"Desenhar",emoticons:"Emoticons","Eraser Brush":"Borracha",filter:"Filtro",font:"Fonte","font size":"Tamanho da fonte",frame:"Moldura",gradient:"Gradiente",height:"Altura",history:"Histórico","H Line Brush":"Linha H",image:"Imagem",initial:"Inicial",landmarks:"Pontos turísticos","loaded state":"Estado carregado","loading canvas":"Carregando tela","loading image":"Carregando imagem","loading state":"Carregando estado","maintain aspect ratio":"Manter proporção",merge:"Mesclar","merged objects":"Objetos mesclados","new text":"Novo texto",objects:"Objetos",opacity:"Opacidade",outline:"Contorno","outline color":"Cor do contorno","Pencil Brush":"Lápis","processing image":"Processando imagem",quality:"Qualidade",radius:"Raio","replace image":"Substituir imagem","replaced background image":"Imagem de fundo substituída",resize:"Redimensionar","resized image":"Imagem redimensionada","rounded corner":"Canto arredondado",save:"Salvar",shadow:"Sombra","shadow color":"Cor da sombra",shapes:"Formas","Spray Brush":"Spray",square:"Quadrado","Square Brush":"Quadrado",stickers:"Adesivos",text:"Texto",texture:"Textura",transportation:"Transporte","V Line Brush":"Linha V",width:"Largura",grayscale:"Tons de cinza","black & White":"Preto e branco",sharpen:"Nitidez",invert:"Inverter",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Sépia quente",sepia:"Sépia","remove Color":"Remover cor",brightness:"Brilho",gamma:"Gamma",noise:"Ruído",pixelate:"Pixelar",blur:"Desfocar",emboss:"Relevo","blend Color":"Misturar cor",distance:"Distância",red:"Vermelho",green:"Verde",blue:"Azul",blocksize:"Tamanho do bloco",alpha:"Alfa",add:"Adicionar",multiply:"Multiplicar",subtract:"Subtrair",diff:"Diferença",screen:"Tela",lighten:"Clarear",darken:"Escurecer","select an option...":"Selecione uma opção..."}};const Rr={en:{translation:Sr},ru:{translation:Er},es:{translation:{Files:"Archivos",selected:"seleccionado(s)",Deselected:"Deseleccionar",Refresh:"Actualizar","Select all":"Seleccionar todo",Rename:"Renombrar","Rename file":"Renombrar archivo {{currentFileName}}","Select the destination folder":"Seleccionar la carpeta de destino","Selected files:":"Archivos seleccionados:","Selected files":"Archivos seleccionados: {{count}}",selected_files_one:"{{count}} archivo seleccionado",selected_files_few:"{{count}} archivos seleccionados",selected_files_many:"{{count}} archivos seleccionados",selected_files_other:"{{count}} archivos seleccionados",Copy:"Duplicar",Edit:"Editar",Move:"Mover","Move to":"Mover a",Delete:"Eliminar","New folder":"Nueva carpeta","Image search...":"Búsqueda de imágenes...","Search icons":"Buscar iconos","By name":"Por nombre","By size":"Por tamaño","By date":"Por fecha",List:"Lista",Grid:"Cuadrícula",Main:"Principal",Folders:"Carpetas","total pages":"{{total}} elementos en total",Name:"Nombre",Untitled:"Sin título",Size:"Tamaño","Stroke width":"Grosor del trazo",Dimensions:"Dimensiones",Date:"Fecha",error:"error",Folder:"Carpeta",created:"creada","Failed to create folder":"Error al crear la carpeta","File deleted":"Archivo eliminado","Error when deleting a file":"Error al eliminar el archivo","Folder deleted":"Carpeta eliminada","Error when deleting a folder":"Error al eliminar la carpeta","Delete folder":"Eliminar carpeta","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"¿Está seguro de que desea eliminar esta carpeta? Esta acción también eliminará todos los archivos y subcarpetas.","API-endpoint for file upload is not configured":"El endpoint API para la carga de archivos no está configurado","Please select an image file":"Por favor, seleccione un archivo de imagen",File:"Archivo","has been successfully uploaded":"se ha cargado exitosamente","The URL must point to an image":"La URL debe apuntar a una imagen","Image upload...":"Cargando imagen...",Unknown:"Desconocido","Error downloading file by URL":"Error al descargar el archivo por URL","successfully uploaded":"cargado exitosamente","Error when downloading a file by URL":"Error al descargar un archivo por URL","Error when uploading a file":"Error al cargar el archivo","Error loading files":"Error al cargar archivos","File not found":"Archivo no encontrado","File renamed to":"Archivo renombrado a","Failed to rename the file":"Error al renombrar el archivo","Folder renamed to":"Carpeta renombrada a","Rename folder":"Renombrar carpeta","New folder name":"Nuevo nombre de la carpeta","Enter a new folder name":"Ingrese un nuevo nombre para la carpeta","Please drag and drop image files only":"Por favor, arrastre y suelte solo archivos de imagen","Upload file by URL":"Cargar archivo por URL","Upload file":"Cargar archivo","Creating a new folder":"Creando una nueva carpeta",Create:"Crear",Cancel:"Cancelar","Folder name":"Nombre de la carpeta","Enter the name of the folder":"Ingrese el nombre de la carpeta","Enter the name":"Ingrese el nombre","A folder will be created inside:":"La carpeta se creará dentro de:","selected folder":"carpeta seleccionada","The folder will be created in the root directory":"La carpeta se creará en el directorio raíz","Failed to load folders":"No se pudieron cargar las carpetas","Folder name cannot be empty":"El nombre de la carpeta no puede estar vacío","Folder creation provider is not configured":"El proveedor de creación de carpetas no está configurado","Folder created":"Carpeta creada","Folder rename is disabled by config":"El renombrado de carpetas está deshabilitado por la configuración","Folder rename provider is not configured":"El proveedor para renombrar carpetas no está configurado","Unexpected response when renaming folder":"Respuesta inesperada al renombrar la carpeta","Folder renamed":"Carpeta renombrada","Failed to rename folder":"No se pudo renombrar la carpeta","Failed to load folder items count":"No se pudo obtener la cantidad de elementos de la carpeta","Failed to load subfolders":"No se pudieron cargar las subcarpetas",Download:"Descargar","image URL":"URL de la imagen","Enter the URL of the image":"Ingrese la URL de la imagen","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Formatos admitidos: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Nuevo nombre del archivo","Enter a new file name":"Ingrese un nuevo nombre para el archivo","Copy to folder":"Copiar a carpeta",Added:"Añadido el {{date}}","File uploaded successfully":"Archivo {{fileName}} cargado exitosamente","Successfully uploaded":"{{successCount}} de {{count}} archivo cargado exitosamente","Successfully uploaded files":"{{successCount}} de {{count}} archivos cargados exitosamente",uploads_success_summary:"Se cargaron {{successCount}} de {{totalCount}} archivos",uploads_fail_summary:"No se pudieron cargar {{failCount}} de {{totalCount}} archivos","File with this name already exists.":"Ya existe un archivo con este nombre.","File not found or no longer available.":"El archivo no se encontró o ya fue eliminado.","You don't have permission to access this file.":"No tiene permisos para acceder a este archivo.","File is too large to upload.":"El archivo es demasiado grande para subir.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"El archivo es demasiado grande ({{fileSize}}). Tamaño máximo permitido: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Se ha superado el número máximo de archivos. Permitido: {{allowed}}, recibido: {{received}}","This file type is not allowed.":"Este tipo de archivo no está permitido.","File name is not valid.":"El nombre del archivo no es válido.","File name is not valid. Allowed characters: {{allowedChars}}":"El nombre del archivo no es válido. Caracteres permitidos: {{allowedChars}}","Failed to read the file.":"No se pudo leer el archivo.","Failed to write the file.":"No se pudo escribir el archivo.","The file appears to be corrupted.":"El archivo parece estar dañado.","File integrity check failed.":"La verificación de integridad del archivo falló.","Folder not found or no longer available.":"La carpeta no se encontró o ya fue eliminada.","Folder with this name already exists.":"Ya existe una carpeta con este nombre.","A folder with that name already exists. Please enter a different folder name.":"Ya existe una carpeta con ese nombre. Introduzca un nombre de carpeta diferente.","You don't have permission to access this folder.":"No tiene permisos para acceder a esta carpeta.","Folder name is not valid.":"El nombre de la carpeta no es válido.","Folder name is not valid. Allowed characters: {{allowedChars}}":"No se pudo crear la carpeta. Caracteres permitidos en el nombre: {{allowedChars}}","Failed to read the folder contents.":"No se pudo leer el contenido de la carpeta.","Failed to write to the folder.":"No se pudo escribir en la carpeta.","Folder storage quota exceeded.":"Se superó la cuota de almacenamiento de la carpeta.","Folder is not empty.":"La carpeta no está vacía.","Server error while processing the folder.":"Error del servidor al procesar la carpeta.","Folder operation took too long.":"La operación con la carpeta tardó demasiado.","Network error. Please check your connection and try again.":"Error de red. Compruebe su conexión e inténtelo de nuevo.","The operation took too long. Please try again.":"La operación tardó demasiado. Inténtelo de nuevo.","Server error. Please try again later.":"Error del servidor. Inténtelo de nuevo más tarde.","Service is temporarily unavailable. Please try again later.":"El servicio no está disponible temporalmente. Inténtelo de nuevo más tarde.","Too many requests. Please try again a bit later.":"Demasiadas solicitudes. Inténtelo de nuevo más tarde.","Authentication failed. Please sign in again.":"Error de autenticación. Inicie sesión de nuevo.","You are not allowed to perform this action.":"No tiene permisos para realizar esta acción.","Some of the provided data is invalid.":"Algunos de los datos proporcionados no son válidos.","This operation is not supported.":"Esta operación no está soportada.","Request payload is too large.":"El cuerpo de la solicitud es demasiado grande.","This media type is not supported.":"Este tipo de contenido no está soportado.","You have exceeded the upload quota.":"Se ha superado la cuota de subida de archivos.","Network error while uploading the file.":"Error de red al subir el archivo.","File upload took too long.":"La subida del archivo tardó demasiado.","Server error while uploading the file.":"Error del servidor al subir el archivo.","The specified URL is not valid.":"La URL especificada no es válida.","The specified URL is not reachable.":"La URL especificada no es accesible.","Content type at the URL is not allowed.":"El tipo de contenido en la URL no está permitido.","Failed to download file from the URL.":"No se pudo descargar el archivo desde la URL.","Network error while downloading the file.":"Error de red al descargar el archivo.","File download took too long.":"La descarga del archivo tardó demasiado.","Server error while downloading the file.":"Error del servidor al descargar el archivo.","Some items could not be processed.":"No todos los elementos se procesaron correctamente.","Failed to process all items in the batch.":"No se pudo procesar ningún elemento del lote.","Some items in the batch are in a conflicting state.":"Algunos elementos del lote están en estado de conflicto.","Some items in the batch did not pass validation.":"Algunos elementos del lote no pasaron la validación.","AI service returned an invalid response.":"El servicio de IA devolvió una respuesta no válida.","Failed to generate image using AI.":"No se pudo generar la imagen usando IA.","You have reached the AI image generation limit.":"Se alcanzó el límite de generación de imágenes con IA.","Error in external integration.":"Error en la integración externa.","Error in a third-party service.":"Error en un servicio de terceros.","An unknown error occurred.":"Se ha producido un error desconocido.","Renaming is not allowed for this item.":"No se permite renombrar este elemento.","Moving is not allowed for this item.":"No se permite mover este elemento.","Copying is not allowed for this item.":"No se permite copiar este elemento.","Deleting is not allowed for this item.":"No se permite eliminar este elemento.","Cannot move an item into itself.":"No se puede mover un elemento dentro de sí mismo.","Cannot move an item into its descendant folder.":"No se puede mover un elemento a su carpeta descendiente.","Cannot copy an item into itself.":"No se puede copiar un elemento dentro de sí mismo.","Configuration error occurred.":"Se produjo un error de configuración.","Storage quota exceeded. Please free up space.":"Se superó la cuota de almacenamiento. Libere espacio.","File is locked by another process or user.":"El archivo está bloqueado por otro proceso o usuario.","File version conflict. Please refresh and try again.":"Conflicto de versión del archivo. Actualice la página e inténtelo de nuevo.","Batch operation exceeds the maximum number of items allowed.":"La operación por lotes excede el número máximo de elementos permitidos.",Moved:"Movidos: {{names}}",move_success_summary:"Se movieron {{successCount}} de {{totalCount}} elementos",move_fail_summary:"No se pudieron mover {{failCount}} de {{totalCount}} elementos",Copied:"Copiados: {{names}}",copy_success_summary:"Se copiaron {{successCount}} de {{totalCount}} elementos",copy_fail_summary:"No se pudieron copiar {{failCount}} de {{totalCount}} elementos",Uploaded:"Archivos cargados: {{names}}",Failed:"No se pudieron cargar: {{names}}","Failed to upload":"Error al cargar {{failCount}} de {{count}} archivo","Failed to upload files":"Error al cargar {{failCount}} de {{count}} archivos",months:{january:"enero",february:"febrero",march:"marzo",april:"abril",may:"mayo",june:"junio",july:"julio",august:"agosto",september:"septiembre",october:"octubre",november:"noviembre",december:"diciembre"},files:"archivos","No available folders":"No hay carpetas disponibles","My files":"Mis archivos",GIF:"GIF","Stock images":"Imágenes de stock","QR & Barcode":"QR y código de barras","QR code":"Código QR",Barcode:"Código de barras","Text or URL":"Texto o URL","Code color":"Color del código","Background color":"Color de fondo","Add to My files":"Añadir a Mis archivos","Transparent background":"Fondo transparente","Barcode generation failed":"No se pudo generar el código de barras. Use caracteres compatibles con CODE128.","Validation error":"Error de validación","Enter text or URL to preview":"Introduzca texto o una URL para la vista previa.",Preview:"Vista previa","QR transparent background hint":"Un PNG transparente puede fundirse con temas oscuros del correo; un fondo blanco suele escanearse mejor.","QR image size px":"Tamaño del QR","Barcode bar height px":"Altura de barras",AI:"IA","AI image generation":"Generación de imágenes con IA","Search GIFs":"Buscar GIFs","That`s all we could find.":"Es todo lo que pudimos encontrar.","Search image":"Buscar imagen",All:"Todos",Landscape:"Horizontal",Portrait:"Vertical",Squarish:"Cuadrado",Black:"Negro","Black and White":"Blanco y negro",White:"Blanco",Orange:"Naranja",Red:"Rojo",Purple:"Morado",Magenta:"Magenta",Green:"Verde",Teal:"Verde azulado",Blue:"Azul","Photo by":"Foto de",on:"en","File Manager":"Administrador de archivos","File Manager not configured":"Administrador de archivos no configurado","Filter by type":"Filtrar por tipo","All types":"Todos los tipos","File name":"Nombre del archivo",Actions:"Acciones","Add file":"Añadir archivo","Add folder":"Añadir carpeta","Add file by URL":"Añadir archivo por URL","File moved":"Archivo movido","Error when moving a file":"Error al mover el archivo","Failed to download file":"No se pudo descargar el archivo","Failed to load JSON data":"No se pudieron cargar los datos JSON","Invalid file URL":"URL de archivo inválida","Unable to validate file URL":"No se pudo validar la URL del archivo","Type to search...":"Escriba para buscar...",Submit:"Enviar","No folders yet":"Aún no hay carpetas","Drag files to upload":"Arrastre archivos para cargarlos","Drop files here to upload":"Suelte los archivos aquí para cargarlos","Newest first":"Los más nuevos primero","Oldest first":"Los más antiguos primero","Largest first":"Los más grandes primero","Smallest first":"Los más pequeños primero","A-Z":"A-Z","Z-A":"Z-A","By type":"Por tipo","Evaluating the task":"Evaluando la tarea","Something went wrong, please try again":"Algo salió mal, por favor intente nuevamente","Sort by":"Ordenar por","preview text":"Cargando imagen...","Use this variant":"Usar esta variante","Confirm deletion":"Confirmar eliminación","Are you sure you want to delete the selected items?":"¿Está seguro de que desea eliminar los elementos seleccionados?","Move to Trash":"Mover a la papelera","Are you sure you want to move the selected items to the Trash?":"¿Está seguro de que desea mover los elementos seleccionados a la papelera?","Permanently delete":"Eliminación permanente","Delete permanently":"Eliminar permanentemente","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"¿Está seguro de que desea eliminar permanentemente los elementos seleccionados? Esta acción no se puede deshacer.",Clear:"Limpiar","Clear Trash":"Vaciar papelera","Are you sure you want to permanently delete all items from Trash?":"¿Está seguro de que desea eliminar permanentemente todos los elementos de la papelera?","Trash cleared successfully":"Papelera vaciada con éxito","{{count}} items permanently deleted":"{{count}} elementos eliminados permanentemente","Trash partially cleared":"Papelera parcialmente vaciada","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} elementos eliminados, {{failed}} fallaron","Failed to clear trash":"Error al vaciar papelera","Error clearing trash":"Error al vaciar papelera","Deleting items...":"Eliminando elementos...",delete_files_permanent_one:"Esta acción eliminará permanentemente {{count}} archivo",delete_files_permanent_few:"Esta acción eliminará permanentemente {{count}} archivos",delete_files_permanent_many:"Esta acción eliminará permanentemente {{count}} archivos",delete_files_permanent_other:"Esta acción eliminará permanentemente {{count}} archivos",delete_folder_permanent:"Esta acción eliminará permanentemente la carpeta «{{name}}» y todo su contenido, incluyendo {{count}} elementos.",delete_mixed_permanent:"Esta acción eliminará permanentemente {{total}} elementos seleccionados, incluyendo {{folders}} carpetas y todas las {{images}} imágenes dentro de ellas.",permanent_delete_warning:"Eliminar archivos que se usaron en correos provocará problemas para mostrar imágenes en correos antiguos. ¿Está seguro de que desea eliminar permanentemente la selección?",move_files_to_trash_one:"Esta acción moverá {{count}} archivo a la papelera.",move_files_to_trash_few:"Esta acción moverá {{count}} archivos a la papelera.",move_files_to_trash_many:"Esta acción moverá {{count}} archivos a la papelera.",move_files_to_trash_other:"Esta acción moverá {{count}} archivos a la papelera.",move_folder_to_trash:"Esta acción moverá la carpeta «{{name}}» y todo su contenido ({{count}} elementos) a la papelera.",move_mixed_to_trash:"Esta acción moverá {{total}} elementos seleccionados a la papelera, incluyendo {{folders}} carpetas y {{images}} imágenes.",delete_count_confirm_trash_one:"¿Mover {{count}} archivo a la papelera?",delete_count_confirm_trash_few:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_trash_many:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_trash_other:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_permanent_one:"¿Eliminar permanentemente {{count}} archivo?",delete_count_confirm_permanent_few:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_permanent_many:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_permanent_other:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_one:"¿Eliminar {{count}} archivo?",delete_count_confirm_few:"¿Eliminar {{count}} archivos?",delete_count_confirm_many:"¿Eliminar {{count}} archivos?",delete_count_confirm_other:"¿Eliminar {{count}} archivos?",item:"archivo",items:"archivos",Trash:"Papelera",Choose:"Elegir",Stock:"Banco de imágenes","Select an image from our library":"Seleccione una imagen de nuestra biblioteca","AI generation":"Generación con IA","Creating an image on demand":"Creando una imagen bajo demanda","Search file or folder":"Buscar archivo o carpeta","Click here to select a file":"Haz clic aquí para seleccionar un archivo","Supported files:":"Archivos admitidos:","Create folder":"Crear carpeta",Done:"Hecho","Move here":"Mover aquí","Copy here":"Copiar aquí","File URL":"URL del archivo","There's nothing here":"Aquí no hay nada","Try using a different search query.":"Prueba a utilizar una consulta de búsqueda diferente.","Millions of free stock images":"Millones de imágenes de stock gratuitas","Enter a search query and we'll find the perfect image for you":"Ingrese una consulta de búsqueda y encontraremos la imagen perfecta para usted","Millions of icons":"Millones de iconos","Lucide icons":"Iconos Lucide","Thousands of icons":"Miles de iconos","Enter a search query and we'll find the perfect icon for you":"Ingrese una consulta de búsqueda y encontraremos el ícono perfecto para usted","Enter your query and we will find the right one for you":"Ingrese su consulta y nosotros encontraremos la adecuada para usted","Over 350,000 live images":"Más de 350,000 imágenes en vivo","The folder will be created in the root directory.":"La carpeta se creará en el directorio raíz.",undo:"DESHACER",moved_to_trash_one:"{{count}} elemento movido a la papelera",moved_to_trash_few:"{{count}} elementos movidos a la papelera",moved_to_trash_many:"{{count}} elementos movidos a la papelera",moved_to_trash_other:"{{count}} elementos movidos a la papelera",restored_items_one:"{{count}} elemento restaurado",restored_items_few:"{{count}} elementos restaurados",restored_items_many:"{{count}} elementos restaurados",restored_items_other:"{{count}} elementos restaurados",Type:"Tipo","Generate image":"Generar imagen","A beautiful image of a sunset over a calm ocean.":"Una imagen hermosa de un atardecer sobre un océano tranquilo.","For example:":"Por ejemplo:",Insert:"Insertar",Error:"Error","Upload progress":"Cargando {{completed}}/{{total}}","Uploading files":"Cargando {{completed}}/{{total}} archivos","Uploaded files":"Cargados {{success}} de {{total}} archivos","Upload error files":"Error al cargar {{errorCount}} archivos","Applies to all {{count}} files":"(se aplica a todos los {{count}} archivos)","Some files failed to upload":"Algunos archivos no se pudieron cargar. Verifique el tamaño y el formato de los archivos.",upload_error_hint_invalid_name:"Renombre el archivo: use solo letras, números, guiones y guiones bajos.",upload_error_hint_size:"Reduzca el tamaño del archivo o elija otro.",upload_error_hint_format:"Use un formato permitido: JPG, PNG o GIF.",upload_error_hint_exists:"Ya existe un archivo con este nombre en la carpeta. Renombre el archivo.","Images generated successfully":"Imágenes generadas correctamente","Choose for template":"Seleccionar para cargar en la plantilla","Trash is empty":"La papelera está vacía","Deleted files will be displayed here":"Los archivos eliminados se mostrarán aquí","Editing: {{name}}":"Editando: {{name}}","Editing image":"Editando imagen",Save:"Guardar","Loading editor...":"Cargando editor...","Error loading image":"Error al cargar la imagen","Error saving image":"Error al guardar la imagen","Error initializing editor":"Error al inicializar el editor","Close File Manager":"Cerrar administrador de archivos","Are you sure you want to close? Unsaved changes will be lost.":"¿Está seguro de que desea cerrar? Los cambios no guardados se perderán.","Are you sure you want to close the file manager?":"¿Está seguro de que desea cerrar el administrador de archivos?",Close:"Cerrar",KB:"KB","No files":"No hay archivos","Folder is empty or files not found":"La carpeta está vacía o no se encontraron archivos","Search files...":"Buscar archivos...",Success:"Éxito","Image updated successfully":"Imagen actualizada exitosamente","Failed to save changes":"Error al guardar los cambios: {{error}}","Unknown error":"Error desconocido","Select destination folder":"Seleccione la carpeta de destino","Error moving":"Error al mover","Error deleting":"Error al eliminar","Error copying":"Error al copiar","Error renaming":"Error al renombrar","Failed to refresh folder tree":"Error al actualizar el árbol de carpetas","Failed to refresh file list":"Error al actualizar la lista de archivos","Errors occurred while moving":"Ocurrieron errores al mover","Errors occurred while copying":"Ocurrieron errores al copiar","(error)":"(error)","(circular reference)":"(referencia circular)","File too large. Maximum size: {{size}}":"El archivo es demasiado grande. Tamaño máximo: {{size}}","File too small. Minimum size: {{size}}":"El archivo es demasiado pequeño. Tamaño mínimo: {{size}}","Unsupported file type":"Tipo de archivo no admitido","Unsupported file type: {{type}}":"Tipo de archivo no admitido: {{type}}",unknown:"desconocido","Failed to load files":"Error al cargar archivos","Failed to load files in folder":"No se pudo cargar el contenido de la carpeta ({{folderName}})","Failed to load subfolders in folder":'No se pudieron cargar las subcarpetas en "{{folderName}}"',"Failed to load folder items count in folder":'No se pudo obtener el recuento de elementos en "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider para eliminar carpetas no está configurado","DataProvider for file upload is not configured":"DataProvider para cargar archivos no está configurado","Error uploading file {{fileName}}":"Error al cargar el archivo {{fileName}}","Error uploading file":"Error al cargar el archivo","Cannot upload files to Trash":"No se pueden cargar archivos a la papelera","Please fill in all fields":"Por favor, complete todos los campos","URL too long":"La URL es demasiado larga","Only http and https URLs are supported":"Solo se admiten URLs con protocolo http y https","Private and local URLs are not allowed":"No se permiten URLs locales ni privadas","Upload by URL is not supported":"La carga por URL no está admitida","File name is too long. Maximum {{max}} characters":"El nombre del archivo es demasiado largo. Máximo {{max}} caracteres","File name contains invalid characters":"El nombre del archivo contiene caracteres no válidos","Large file may take a long time to upload":"Un archivo grande puede tardar mucho en cargarse","File unavailable: {{status}} {{statusText}}":"Archivo no disponible: {{status}} {{statusText}}","File too large: {{size}}":"Archivo demasiado grande: {{size}}","Unsupported file type: {{contentType}}":"Tipo de archivo no admitido: {{contentType}}","Invalid server response: folder ID is missing":"Respuesta del servidor inválida: falta el ID de la carpeta","Error: folder cannot be its own parent":"Error: la carpeta no puede ser su propio padre","Upload to Trash is forbidden":"Cargar a la papelera está prohibido","renameFolder is not implemented in dataProviders":"renameFolder no está implementado en dataProviders","renameFile is not implemented in dataProviders":"renameFile no está implementado en dataProviders",Clean:"Limpiar","Circular dependency detected: folder cannot be its own parent":"Dependencia circular detectada: la carpeta no puede ser su propio padre","Save as copy and choose":"Guardar como copia y elegir","Save and choose":"Guardar y elegir",pixie:{"added drawing":"Dibujo añadido","added frame":"Marco añadido","added image":"Imagen añadida","added shape":"Forma añadida","added sticker":"Pegatina añadida","added text":"Texto añadido","applied filters":"Filtros aplicados",apply:"Aplicar",background:"Fondo","background color":"Color de fondo",beach:"Playa","brush color":"Color del pincel","brush size":"Tamaño del pincel","brush type":"Tipo de pincel",bubbles:"Burbujas",Cancel:"Cancelar","changed style":"Estilo cambiado","Circle Brush":"Círculo",close:"Cerrar",color:"Color",corners:"Esquinas",crop:"Recortar",Custom:"Personalizado","deleted object":"Objeto eliminado","Diamond Brush":"Diamante",doodles:"Garabatos",draw:"Dibujar",emoticons:"Emoticonos","Eraser Brush":"Borrador",filter:"Filtro",font:"Fuente","font size":"Tamaño de fuente",frame:"Marco",gradient:"Gradiente",height:"Alto",history:"Historial","H Line Brush":"Línea H",image:"Imagen",initial:"Inicial",landmarks:"Monumentos","loaded state":"Estado cargado","loading canvas":"Cargando lienzo","loading image":"Cargando imagen","loading state":"Cargando estado","maintain aspect ratio":"Mantener proporción",merge:"Fusionar","merged objects":"Objetos fusionados","new text":"Nuevo texto",objects:"Objetos",opacity:"Opacidad",outline:"Contorno","outline color":"Color del contorno","Pencil Brush":"Lápiz","processing image":"Procesando imagen",quality:"Calidad",radius:"Radio","replace image":"Reemplazar imagen","replaced background image":"Imagen de fondo reemplazada",resize:"Redimensionar","resized image":"Imagen redimensionada","rounded corner":"Esquina redondeada",save:"Guardar",shadow:"Sombra","shadow color":"Color de la sombra",shapes:"Formas","Spray Brush":"Spray",square:"Cuadrado","Square Brush":"Cuadrado",stickers:"Pegatinas",text:"Texto",texture:"Textura",transportation:"Transporte","V Line Brush":"Línea V",width:"Ancho",grayscale:"Escala de grises","black & White":"Blanco y negro",sharpen:"Enfocar",invert:"Invertir",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Sepia cálido",sepia:"Sepia","remove Color":"Eliminar color",brightness:"Brillo",gamma:"Gamma",noise:"Ruido",pixelate:"Pixelar",blur:"Desenfocar",emboss:"Relieve","blend Color":"Mezclar color",distance:"Distancia",red:"Rojo",green:"Verde",blue:"Azul",blocksize:"Tamaño de bloque",alpha:"Alfa",add:"Añadir",multiply:"Multiplicar",subtract:"Restar",diff:"Diferencia",screen:"Pantalla",lighten:"Aclarar",darken:"Oscurecer","select an option...":"Seleccione una opción..."}}},uk:{translation:xr},"pt-br":{translation:Pr},pt:{translation:Pr},br:{translation:Pr},"pt-BR":{translation:Pr}};Wo.use(ir).init({resources:Rr,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});Object.values({images:["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"],documents:["application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],archives:["application/zip","application/x-rar-compressed","application/x-7z-compressed"],videos:["video/mp4","video/avi","video/quicktime","video/x-msvideo"],audio:["audio/mpeg","audio/wav","audio/ogg"]}).flat();const kr=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB"][t]},Nr=e=>{if(!e||e<=0)return"";const t=1048576;if(e<t){return`${Math.round(e/1024)} Kb`}return`${(e/t).toFixed(2)} Mb`},Or=e=>{if(null==e)return"";if("number"==typeof e)return Nr(e);const t=String(e).trim();if(!t)return"";const o=Number(t);return Number.isNaN(o)?t:Nr(o)},Tr=(e,t)=>{const o=t.filter(e=>"string"==typeof e),r=new Set(o.map(e=>e.toLowerCase())),n="string"==typeof e?e:String(null!=e?e:"");if(!r.has(n.toLowerCase()))return n;const i=n.lastIndexOf("."),a=i>0?n.slice(0,i):n,l=i>0?n.slice(i):"";let s,d=1;do{s=`${a}_${d}${l}`,d++}while(r.has(s.toLowerCase()));return s};async function Lr(e,t,o,r,n){if(!n||!(null==e?void 0:e.getFiles))return t;try{let n=[];const{files:i}=await e.getFiles({folderId:r?void 0:null!=o?o:void 0,noFolder:r,itemType:"all",page:1,limit:1e4});if(n=(i||[]).map(e=>e.name).filter(e=>!!e),!r&&(null==e?void 0:e.getFolders)){const t=(await e.getFolders({parentId:null!=o?o:null,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);n=[...n,...t]}return Tr(t,n)}catch(e){return console.warn("Could not fetch files for duplicate check:",e),t}}const Mr=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"mixed-view",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M1 1h2v2H1V1zm0 4h2v2H1V5zm0 4h2v2H1V9zm4-8h2v2H5V1zm0 4h2v2H5V5zm0 4h2v2H5V9zm4-8h2v2H9V1zm0 4h2v2H9V5zm0 4h2v2H9V9z"})}),Ur=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"landscape-view",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M1 3h10v6H1V3zm1 1v4h8V4H2z"})}),jr=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"portrait-view",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M3 1h6v10H3V1zm1 1v8h4V2H4z"})}),Dr=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"square-view",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M1 1h10v10H1V1zm1 1v8h8V2H2z"})}),Br=()=>t("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"ai-icon",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:[e("path",{d:"M2.45454 11.7273C2.45454 11.7273 2.16994 10.446 1.66154 9.88113C1.15314 9.31625 0 9 0 9C0 9 1.15314 8.68374 1.66154 8.11887C2.16994 7.554 2.45454 6.27273 2.45454 6.27273C2.45454 6.27273 2.73915 7.554 3.24755 8.11887C3.75594 8.68374 4.90909 9 4.90909 9C4.90909 9 3.75594 9.31625 3.24755 9.88113C2.73915 10.446 2.45454 11.7273 2.45454 11.7273Z"}),e("path",{d:"M7.63636 9C7.63636 9 7.1304 6.94996 6.22658 6.04614C5.32276 5.14233 3.27273 4.63636 3.27273 4.63636C3.27273 4.63636 5.32276 4.1304 6.22658 3.22657C7.1304 2.32275 7.63636 0.272728 7.63636 0.272728C7.63636 0.272728 8.14233 2.32275 9.04615 3.22657C9.94996 4.1304 12 4.63636 12 4.63636C12 4.63636 9.94996 5.14233 9.04615 6.04614C8.14233 6.94996 7.63636 9 7.63636 9Z"}),e("path",{d:"M1.63636 4.09091C1.63636 4.09091 1.44663 3.19402 1.10769 2.7986C0.768758 2.40318 0 2.18182 0 2.18182C0 2.18182 0.768758 1.96046 1.10769 1.56503C1.44663 1.16961 1.63636 0.272728 1.63636 0.272728C1.63636 0.272728 1.8261 1.16961 2.16503 1.56503C2.50397 1.96046 3.27273 2.18182 3.27273 2.18182C3.27273 2.18182 2.50397 2.40318 2.16503 2.7986C1.8261 3.19402 1.63636 4.09091 1.63636 4.09091Z"}),e("path",{d:"M10.6364 11.7273C10.6364 11.7273 10.4782 11.0866 10.1958 10.8042C9.91336 10.5218 9.27273 10.3636 9.27273 10.3636C9.27273 10.3636 9.91336 10.2055 10.1958 9.92307C10.4782 9.64064 10.6364 9 10.6364 9C10.6364 9 10.7945 9.64064 11.0769 9.92307C11.3594 10.2055 12 10.3636 12 10.3636C12 10.3636 11.3594 10.5218 11.0769 10.8042C10.7945 11.0866 10.6364 11.7273 10.6364 11.7273Z"})]}),zr=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"light-mode",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M6 7.81819C6.50303 7.81819 6.93182 7.64092 7.28637 7.28637C7.64092 6.93182 7.81819 6.50303 7.81819 6C7.81819 5.49697 7.64092 5.06818 7.28637 4.71363C6.93182 4.35908 6.50303 4.18181 6 4.18181C5.49697 4.18181 5.06818 4.35908 4.71363 4.71363C4.35908 5.06818 4.18181 5.49697 4.18181 6C4.18181 6.50303 4.35908 6.93182 4.71363 7.28637C5.06818 7.64092 5.49697 7.81819 6 7.81819ZM6 8.72727C5.24545 8.72727 4.60227 8.46136 4.07045 7.92955C3.53864 7.39773 3.27273 6.75455 3.27273 6C3.27273 5.24545 3.53864 4.60227 4.07045 4.07045C4.60227 3.53864 5.24545 3.27273 6 3.27273C6.75455 3.27273 7.39773 3.53864 7.92955 4.07045C8.46136 4.60227 8.72727 5.24545 8.72727 6C8.72727 6.75455 8.46136 7.39773 7.92955 7.92955C7.39773 8.46136 6.75455 8.72727 6 8.72727ZM2.18182 6.45454H0V5.54546H2.18182V6.45454ZM12 6.45454H9.81818V5.54546H12V6.45454ZM5.54546 2.18182V0H6.45454V2.18182H5.54546ZM5.54546 12V9.81818H6.45454V12H5.54546ZM3 3.6091L1.63182 2.28637L2.28181 1.61819L3.5909 2.98182L3 3.6091ZM9.72727 10.3727L8.39546 9.00454L9.0091 8.38182L10.3682 9.71363L9.72727 10.3727ZM8.38182 2.9909L9.71363 1.63182L10.3818 2.27273L9.02727 3.6L8.38182 2.9909ZM1.62727 9.71819L2.98636 8.38636L3.61818 9.0091L2.28637 10.3682L1.62727 9.71819Z"})}),qr=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"dark-mode",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M6 11C4.61111 11 3.43056 10.5139 2.45833 9.54167C1.48611 8.56944 1 7.38889 1 6C1 4.61111 1.48611 3.43056 2.45833 2.45833C3.43056 1.48611 4.61111 1 6 1C6.09259 1 6.1875 1.00309 6.28472 1.00926C6.38194 1.01543 6.49382 1.02469 6.62036 1.03704C6.2716 1.32408 5.99769 1.68442 5.79861 2.11806C5.59954 2.55169 5.5 3.01234 5.5 3.5C5.5 4.33333 5.79167 5.04167 6.375 5.625C6.95833 6.20833 7.66667 6.5 8.5 6.5C8.99074 6.5 9.45216 6.40509 9.88426 6.21528C10.3164 6.02546 10.6759 5.76544 10.963 5.43519C10.9753 5.54939 10.9846 5.65047 10.9907 5.73843C10.9969 5.82639 11 5.91358 11 6C11 7.38889 10.5139 8.56944 9.54167 9.54167C8.56944 10.5139 7.38889 11 6 11ZM6 10.0741C6.94444 10.0741 7.77469 9.7909 8.49075 9.22454C9.20681 8.65818 9.67594 7.97376 9.89815 7.17129C9.68211 7.25463 9.45474 7.3179 9.21606 7.36111C8.97737 7.40431 8.73869 7.42592 8.5 7.42592C7.41242 7.42592 6.4862 7.0435 5.72135 6.27865C4.9565 5.5138 4.57408 4.58758 4.57408 3.5C4.57408 3.29012 4.59414 3.06944 4.63426 2.83796C4.67438 2.60648 4.74229 2.35185 4.83797 2.07407C3.99229 2.3395 3.29552 2.83487 2.74768 3.56018C2.19984 4.28549 1.92592 5.09876 1.92592 6C1.92592 7.12963 2.32252 8.09105 3.11574 8.88426C3.90895 9.67748 4.87037 10.0741 6 10.0741Z"})}),Vr=()=>t("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{opacity:"0.5",d:"M6 19H49C54.5229 19 59 23.4772 59 29V46C59 51.5228 54.5228 56 49 56H14C9.58172 56 6 52.4183 6 48V19Z",fill:"#91CAFF"}),e("path",{d:"M6 19L34.866 18.5L30.7172 11.0737C29.6569 9.17588 27.6531 8 25.4792 8H10C7.79086 8 6 9.79086 6 12V19Z",fill:"#2884FF"}),e("path",{d:"M34.6663 18.6667L31.6916 12.7171C30.8354 11.0048 30.4073 10.1486 29.7687 9.5231C29.2039 8.96995 28.5232 8.54926 27.7759 8.29149C26.9308 8 25.9736 8 24.0591 8H13.8663C10.8794 8 9.38592 8 8.24506 8.5813C7.24153 9.09262 6.42563 9.90852 5.91431 10.9121C5.33301 12.0529 5.33301 13.5464 5.33301 16.5333V18.6667M5.33301 18.6667H45.8663C50.3468 18.6667 52.587 18.6667 54.2983 19.5386C55.8036 20.3056 57.0274 21.5294 57.7944 23.0347C58.6663 24.746 58.6663 26.9862 58.6663 31.4667V43.2C58.6663 47.6804 58.6663 49.9206 57.7944 51.6319C57.0274 53.1372 55.8036 54.3611 54.2983 55.1281C52.587 56 50.3468 56 45.8663 56H18.133C13.6526 56 11.4124 56 9.70108 55.1281C8.19579 54.3611 6.97194 53.1372 6.20496 51.6319C5.33301 49.9206 5.33301 47.6804 5.33301 43.2V18.6667Z",stroke:"#2884FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Wr=()=>t("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{opacity:"0.5",d:"M6 19H49C54.5229 19 59 23.4772 59 29V46C59 51.5228 54.5228 56 49 56H14C9.58172 56 6 52.4183 6 48V19Z",fill:"#91CAFF"}),e("path",{d:"M6 19L34.866 18.5L30.7172 11.0737C29.6569 9.17588 27.6531 8 25.4792 8H10C7.79086 8 6 9.79086 6 12V19Z",stroke:"currentColor"}),e("path",{d:"M34.6663 18.6667L31.6916 12.7171C30.8354 11.0048 30.4073 10.1486 29.7687 9.5231C29.2039 8.96995 28.5232 8.54926 27.7759 8.29149C26.9308 8 25.9736 8 24.0591 8H13.8663C10.8794 8 9.38592 8 8.24506 8.5813C7.24153 9.09262 6.42563 9.90852 5.91431 10.9121C5.33301 12.0529 5.33301 13.5464 5.33301 16.5333V18.6667M5.33301 18.6667H45.8663C50.3468 18.6667 52.587 18.6667 54.2983 19.5386C55.8036 20.3056 57.0274 21.5294 57.7944 23.0347C58.6663 24.746 58.6663 26.9862 58.6663 31.4667V43.2C58.6663 47.6804 58.6663 49.9206 57.7944 51.6319C57.0274 53.1372 55.8036 54.3611 54.2983 55.1281C52.587 56 50.3468 56 45.8663 56H18.133C13.6526 56 11.4124 56 9.70108 55.1281C8.19579 54.3611 6.97194 53.1372 6.20496 51.6319C5.33301 49.9206 5.33301 47.6804 5.33301 43.2V18.6667Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Hr=()=>e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M10.8337 5.83333L9.90404 3.9741C9.6365 3.439 9.50271 3.17144 9.30313 2.97597C9.12664 2.80311 8.91393 2.67164 8.68039 2.59109C8.4163 2.5 8.11716 2.5 7.5189 2.5H4.33366C3.40024 2.5 2.93353 2.5 2.57701 2.68166C2.2634 2.84144 2.00844 3.09641 1.84865 3.41002C1.66699 3.76654 1.66699 4.23325 1.66699 5.16667V5.83333M1.66699 5.83333H14.3337C15.7338 5.83333 16.4339 5.83333 16.9686 6.10582C17.439 6.3455 17.8215 6.72795 18.0612 7.19836C18.3337 7.73314 18.3337 8.4332 18.3337 9.83333V13.5C18.3337 14.9001 18.3337 15.6002 18.0612 16.135C17.8215 16.6054 17.439 16.9878 16.9686 17.2275C16.4339 17.5 15.7338 17.5 14.3337 17.5H5.66699C4.26686 17.5 3.5668 17.5 3.03202 17.2275C2.56161 16.9878 2.17916 16.6054 1.93948 16.135C1.66699 15.6002 1.66699 14.9001 1.66699 13.5V5.83333Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),$r=()=>e("svg",{width:"48",height:"49",viewBox:"0 0 48 49",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M32 24.5L24 16.5M24 16.5L16 24.5M24 16.5V34.9C24 37.6814 24 39.0721 25.101 40.6292C25.8326 41.6638 27.9388 42.9406 29.1944 43.1108C31.0842 43.3668 31.8019 42.9924 33.2371 42.2437C39.6333 38.9071 44 32.2135 44 24.5C44 13.4543 35.0457 4.5 24 4.5C12.9543 4.5 4 13.4543 4 24.5C4 31.9028 8.02199 38.3663 14 41.8244",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})}),Gr=()=>t("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("rect",{width:"56",height:"56",rx:"24",fill:"#8946FB"}),e("path",{d:"M28 36.4722C29.0615 37.4223 30.4633 38 32 38C35.3137 38 38 35.3137 38 32C38 29.2331 36.1271 26.9036 33.5798 26.2102M22.4202 26.2102C19.8729 26.9036 18 29.2331 18 32C18 35.3137 20.6863 38 24 38C27.3137 38 30 35.3137 30 32C30 31.2195 29.851 30.4738 29.5798 29.7898M34 24C34 27.3137 31.3137 30 28 30C24.6863 30 22 27.3137 22 24C22 20.6863 24.6863 18 28 18C31.3137 18 34 20.6863 34 24Z",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Kr=()=>t("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("rect",{width:"56",height:"56",rx:"24",fill:"#7ED846"}),e("path",{d:"M20.5 38V33M20.5 23V18M18 20.5H23M18 35.5H23M29 19L27.2658 23.5089C26.9838 24.2421 26.8428 24.6087 26.6235 24.9171C26.4292 25.1904 26.1904 25.4292 25.9171 25.6235C25.6087 25.8428 25.2421 25.9838 24.5089 26.2658L20 28L24.5089 29.7342C25.2421 30.0162 25.6087 30.1572 25.9171 30.3765C26.1904 30.5708 26.4292 30.8096 26.6235 31.0829C26.8428 31.3913 26.9838 31.7579 27.2658 32.4911L29 37L30.7342 32.4911C31.0162 31.7579 31.1572 31.3913 31.3765 31.0829C31.5708 30.8096 31.8096 30.5708 32.0829 30.3765C32.3913 30.1572 32.7579 30.0162 33.4911 29.7342L38 28L33.4911 26.2658C32.7579 25.9838 32.3913 25.8428 32.0829 25.6235C31.8096 25.4292 31.5708 25.1904 31.3765 24.9171C31.1572 24.6087 31.0162 24.2421 30.7342 23.5089L29 19Z",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Qr=()=>t("svg",{width:"48",height:"49",viewBox:"0 0 48 49",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M19 18.4307C19 17.4761 19 16.9988 19.1995 16.7324C19.3733 16.5001 19.6394 16.3549 19.9288 16.3342C20.2608 16.3105 20.6622 16.5686 21.4652 17.0848L30.9064 23.1541C31.6032 23.602 31.9516 23.826 32.0719 24.1108C32.177 24.3596 32.177 24.6404 32.0719 24.8892C31.9516 25.174 31.6032 25.398 30.9064 25.8459L21.4652 31.9152C20.6622 32.4314 20.2608 32.6895 19.9288 32.6658C19.6394 32.6451 19.3733 32.4998 19.1995 32.2676C19 32.0012 19 31.5239 19 30.5693V18.4307Z",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M6 16.1C6 12.7397 6 11.0595 6.65396 9.77606C7.2292 8.64708 8.14708 7.7292 9.27606 7.15396C10.5595 6.5 12.2397 6.5 15.6 6.5H32.4C35.7603 6.5 37.4405 6.5 38.7239 7.15396C39.8529 7.7292 40.7708 8.64708 41.346 9.77606C42 11.0595 42 12.7397 42 16.1V32.9C42 36.2603 42 37.9405 41.346 39.2239C40.7708 40.3529 39.8529 41.2708 38.7239 41.846C37.4405 42.5 35.7603 42.5 32.4 42.5H15.6C12.2397 42.5 10.5595 42.5 9.27606 41.846C8.14708 41.2708 7.2292 40.3529 6.65396 39.2239C6 37.9405 6 36.2603 6 32.9V16.1Z",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),Jr=()=>e("svg",{width:"48",height:"49",viewBox:"0 0 48 49",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M24 41.4444C26.123 43.3446 28.9266 44.5 32 44.5C38.6274 44.5 44 39.1274 44 32.5C44 26.9662 40.2541 22.3072 35.1596 20.9203M12.8404 20.9203C7.74587 22.3072 4 26.9661 4 32.5C4 39.1274 9.37258 44.5 16 44.5C22.6274 44.5 28 39.1274 28 32.5C28 30.939 27.7019 29.4476 27.1596 28.0797M36 16.5C36 23.1274 30.6274 28.5 24 28.5C17.3726 28.5 12 23.1274 12 16.5C12 9.87258 17.3726 4.5 24 4.5C30.6274 4.5 36 9.87258 36 16.5Z",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})}),Yr=t=>e(Y,Object.assign({component:Mr},t)),Zr=t=>e(Y,Object.assign({component:Ur},t)),Xr=t=>e(Y,Object.assign({component:jr},t)),en=t=>e(Y,Object.assign({component:Dr},t)),tn=t=>e(Y,Object.assign({component:Br},t)),on=t=>e(Y,Object.assign({component:zr},t)),rn=t=>e(Y,Object.assign({component:qr},t)),nn=t=>e(Y,Object.assign({component:Vr},t)),an=t=>e(Y,Object.assign({component:Wr},t)),ln=t=>e(Y,Object.assign({component:Hr},t)),sn=t=>e(Y,Object.assign({component:$r},t)),dn=t=>e(Y,Object.assign({component:Gr},t)),cn=t=>e(Y,Object.assign({component:Kr},t)),un=t=>e(Y,Object.assign({component:Qr},t)),fn=t=>e(Y,Object.assign({component:Jr},t));function hn(e,t){var o;return Boolean(null===(o=null==t?void 0:t.lockedTabs)||void 0===o?void 0:o.includes(e))}const mn=l({state:{},actions:{},options:{}}),pn=()=>s(mn),gn=({children:t,options:o})=>{var r,n,l,s;const[c,f]=i([]),[h,m]=i([]),[p,g]=i(null),[v,y]=i(o.searchQuery||""),[w,C]=i(o.sortBySize||"name"),{config:I}=o,F=d(e=>{var t,o,r,n;if(e===lt){const e=!1!==(null===(t=null==I?void 0:I.features)||void 0===t?void 0:t.enableGif),o=!(null==I?void 0:I.enabledTabs)||I.enabledTabs.includes("gif");return e&&o}if(e===st){const e=!1!==(null===(o=null==I?void 0:I.features)||void 0===o?void 0:o.enableStockImages),t=!(null==I?void 0:I.enabledTabs)||I.enabledTabs.includes("stock");return e&&t}if(e===dt){const e=!1!==(null===(r=null==I?void 0:I.features)||void 0===r?void 0:r.enableIconStock),t=!(null==I?void 0:I.enabledTabs)||I.enabledTabs.includes("icons");return e&&t}if(e===ut){const e=!1!==(null===(n=null==I?void 0:I.features)||void 0===n?void 0:n.enableQrBarcodeTab),t=!(null==I?void 0:I.enabledTabs)||I.enabledTabs.includes("codes");return e&&t}return!0},[null==I?void 0:I.enabledTabs,null===(r=null==I?void 0:I.features)||void 0===r?void 0:r.enableGif,null===(n=null==I?void 0:I.features)||void 0===n?void 0:n.enableIconStock,null===(l=null==I?void 0:I.features)||void 0===l?void 0:l.enableStockImages,null===(s=null==I?void 0:I.features)||void 0===s?void 0:s.enableQrBarcodeTab]),[A,_]=i("date"),[S,E]=i("desc"),[x,P]=i([{id:"folders",name:"Папки"}]),[R,k]=i(""),[N,O]=i(!1),[T,L]=i(at),M=d(e=>F(e)&&!hn(e,I),[I,F]);a(()=>{(null==I?void 0:I.activeLibraryItem)&&L&&L(M(I.activeLibraryItem)?I.activeLibraryItem:at)},[null==I?void 0:I.activeLibraryItem,M,L]),a(()=>{M(T)||L(at)},[T,M]);const[U,j]=i({current:1,pageSize:20,total:0}),[D]=b.useForm(),[B]=b.useForm(),[z]=b.useForm(),[q]=b.useForm(),[V]=b.useForm(),[W]=b.useForm(),[H,$]=i(!1),[G,K]=i(!1),[Q,J]=i(!1),[Y,Z]=i(!1),[X,ee]=i(!1),[te,oe]=i(!1),[re,ne]=i(!1),[ie,ae]=i(null),[le,se]=i(null),[de,ce]=i(null),ue=(e,t)=>{P(o=>o.map(o=>o.id===e?Object.assign(Object.assign({},o),{name:t}):o))},fe=d(e=>{j(t=>Object.assign(Object.assign({},t),e))},[j]),he=u(()=>{var e;return{folders:c,files:h,selectedFolder:p,searchTerm:v,sortField:w,sortBy:A,sortOrder:S,pathHistory:x,currentMenuFile:R,loading:N,pagination:U,isModalVisible:H,isUrlModalVisible:G,isRenameModalVisible:Q,isMoveModalVisible:Y,isRenameFolderModalVisible:X,isCopyModalVisible:te,isDeleteConfirmVisible:re,form:D,urlForm:B,renameForm:z,moveForm:q,renameFolderForm:V,copyForm:W,fileToRename:ie,folderToRename:le,activeLibraryItem:T,multiSelect:null===(e=null==I?void 0:I.multiSelect)||void 0===e||e,undoDeletion:de}},[T,null==I?void 0:I.multiSelect,W,R,ie,h,c,D,te,re,H,Y,X,Q,G,N,q,U,x,V,z,v,p,A,w,S,de,B,le]),me=u(()=>({setFolders:f,setFiles:m,setSelectedFolder:g,setSearchTerm:y,setSortField:C,setSortBy:_,setSortOrder:E,setPathHistory:P,setLoading:O,setPagination:fe,setIsModalVisible:$,setIsUrlModalVisible:K,setIsRenameModalVisible:J,setIsMoveModalVisible:Z,setIsRenameFolderModalVisible:ee,setIsCopyModalVisible:oe,setIsDeleteConfirmVisible:ne,setFileToRename:ae,setFolderToRename:se,setUndoDeletion:ce,updatePathHistoryOnFolderRename:ue,setActiveLibraryItem:e=>L(F(e)?e:at),setCurrentMenuFile:k}),[fe,F]),pe=u(()=>({state:he,actions:me,options:o}),[me,o,he]);return e(mn.Provider,{value:pe,children:t})},vn=()=>{const{options:e}=pn(),{customIcons:t}=e,o=n.useCallback((e,o,r)=>{const i=null==t?void 0:t[e];return i?n.createElement(i,r):n.createElement(o,r)},[t]);return n.useMemo(()=>({RootFolderIcon:e=>o("rootFolder",se,e),FolderIcon:e=>o("folder",nn,e),FolderOpenIcon:e=>o("folderOpen",le,e),AddFolderIcon:e=>o("addFolder",ae,e),FileIcon:e=>o("file",ie,e),UploadIcon:e=>o("upload",ne,e),UploadByUrlIcon:e=>o("uploadByUrl",re,e),ExpandArrowIcon:e=>o("expandArrow",oe,e),CollapseArrowIcon:e=>o("collapseArrow",te,e),ExpandFolderIcon:e=>o("expandArrow",Fe,e),CollapseFolderIcon:e=>o("collapseArrow",Ie,e),FolderPreviewIcon:e=>o("folderPreview",an,e),EmptyFolderIcon:e=>o("folderPreview",ln,e),GridViewIcon:e=>o("gridView",ee,e),ListViewIcon:e=>o("listView",X,e),DropZoneFileIcon:e=>o("folderPreview",sn,e),BigStockIcon:e=>o("folderPreview",dn,e),BigAIIcon:e=>o("folderPreview",cn,e),GifPlayIcon:e=>o("folderPreview",un,e),StockBigIcon:e=>o("folderPreview",fn,e),MixedViewIcon:e=>o("mixedView",Yr,e),LandscapeViewIcon:e=>o("landscapeView",Zr,e),PortraitViewIcon:e=>o("portraitView",Xr,e),SquareViewIcon:e=>o("squareView",en,e),LightModeIcon:e=>o("lightMode",on,e),DarkModeIcon:e=>o("darkMode",rn,e),AiIcon_2:e=>o("aiIcon_2",tn,e),NoFilesIcon:e=>o("noFiles",Ce,e),ThumbsUpIcon:e=>o("thumbsUp",be,e),getCustomIcon:o}),[o])};var yn="noFilesContainer",wn="noFilesImage",bn="noFilesTitle",Cn="noFilesDescription";const In=()=>{const{t:o}=dr(),{NoFilesIcon:r}=vn();return t("div",{className:yn,children:[e(r,{className:wn,size:48,strokeWidth:1.4}),e("h2",{className:bn,children:o("There's nothing here")}),e("div",{className:Cn,children:o("Try using a different search query.")})]})};var Fn,An={exports:{}};
2
+ /**
3
+ * @license
4
+ * Lodash <https://lodash.com/>
5
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
6
+ * Released under MIT license <https://lodash.com/license>
7
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9
+ */var _n,Sn,En=(Fn||(Fn=1,_n=An,Sn=An.exports,function(){var e,t="Expected a function",o="__lodash_hash_undefined__",r="__lodash_placeholder__",n=32,i=128,a=256,l=1/0,s=9007199254740991,d=NaN,c=4294967295,u=[["ary",i],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",n],["partialRight",64],["rearg",a]],f="[object Arguments]",h="[object Array]",m="[object Boolean]",p="[object Date]",g="[object Error]",v="[object Function]",y="[object GeneratorFunction]",w="[object Map]",b="[object Number]",C="[object Object]",I="[object Promise]",F="[object RegExp]",A="[object Set]",_="[object String]",S="[object Symbol]",E="[object WeakMap]",x="[object ArrayBuffer]",P="[object DataView]",R="[object Float32Array]",k="[object Float64Array]",N="[object Int8Array]",O="[object Int16Array]",T="[object Int32Array]",L="[object Uint8Array]",M="[object Uint8ClampedArray]",U="[object Uint16Array]",j="[object Uint32Array]",D=/\b__p \+= '';/g,B=/\b(__p \+=) '' \+/g,z=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,V=/[&<>"']/g,W=RegExp(q.source),H=RegExp(V.source),$=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,Y=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,X=RegExp(Z.source),ee=/^\s+/,te=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,re=/\{\n\/\* \[wrapped with (.+)\] \*/,ne=/,? & /,ie=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ae=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,se=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,ce=/^[-+]0x[0-9a-f]+$/i,ue=/^0b[01]+$/i,fe=/^\[object .+?Constructor\]$/,he=/^0o[0-7]+$/i,me=/^(?:0|[1-9]\d*)$/,pe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ge=/($^)/,ve=/['\n\r\u2028\u2029\\]/g,ye="\\ud800-\\udfff",we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="\\u2700-\\u27bf",Ce="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",Fe="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",_e="['’]",Se="["+ye+"]",Ee="["+Ae+"]",xe="["+we+"]",Pe="\\d+",Re="["+be+"]",ke="["+Ce+"]",Ne="[^"+ye+Ae+Pe+be+Ce+Ie+"]",Oe="\\ud83c[\\udffb-\\udfff]",Te="[^"+ye+"]",Le="(?:\\ud83c[\\udde6-\\uddff]){2}",Me="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+Ie+"]",je="\\u200d",De="(?:"+ke+"|"+Ne+")",Be="(?:"+Ue+"|"+Ne+")",ze="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+xe+"|"+Oe+")?",We="["+Fe+"]?",He=We+Ve+"(?:"+je+"(?:"+[Te,Le,Me].join("|")+")"+We+Ve+")*",$e="(?:"+[Re,Le,Me].join("|")+")"+He,Ge="(?:"+[Te+xe+"?",xe,Le,Me,Se].join("|")+")",Ke=RegExp(_e,"g"),Qe=RegExp(xe,"g"),Je=RegExp(Oe+"(?="+Oe+")|"+Ge+He,"g"),Ye=RegExp([Ue+"?"+ke+"+"+ze+"(?="+[Ee,Ue,"$"].join("|")+")",Be+"+"+qe+"(?="+[Ee,Ue+De,"$"].join("|")+")",Ue+"?"+De+"+"+ze,Ue+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pe,$e].join("|"),"g"),Ze=RegExp("["+je+ye+we+Fe+"]"),Xe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,et=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],tt=-1,ot={};ot[R]=ot[k]=ot[N]=ot[O]=ot[T]=ot[L]=ot[M]=ot[U]=ot[j]=!0,ot[f]=ot[h]=ot[x]=ot[m]=ot[P]=ot[p]=ot[g]=ot[v]=ot[w]=ot[b]=ot[C]=ot[F]=ot[A]=ot[_]=ot[E]=!1;var rt={};rt[f]=rt[h]=rt[x]=rt[P]=rt[m]=rt[p]=rt[R]=rt[k]=rt[N]=rt[O]=rt[T]=rt[w]=rt[b]=rt[C]=rt[F]=rt[A]=rt[_]=rt[S]=rt[L]=rt[M]=rt[U]=rt[j]=!0,rt[g]=rt[v]=rt[E]=!1;var nt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},it=parseFloat,at=parseInt,lt="object"==typeof Ho&&Ho&&Ho.Object===Object&&Ho,st="object"==typeof self&&self&&self.Object===Object&&self,dt=lt||st||Function("return this")(),ct=Sn&&!Sn.nodeType&&Sn,ut=ct&&_n&&!_n.nodeType&&_n,ft=ut&&ut.exports===ct,ht=ft&&lt.process,mt=function(){try{var e=ut&&ut.require&&ut.require("util").types;return e||ht&&ht.binding&&ht.binding("util")}catch(e){}}(),pt=mt&&mt.isArrayBuffer,gt=mt&&mt.isDate,vt=mt&&mt.isMap,yt=mt&&mt.isRegExp,wt=mt&&mt.isSet,bt=mt&&mt.isTypedArray;function Ct(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}function It(e,t,o,r){for(var n=-1,i=null==e?0:e.length;++n<i;){var a=e[n];t(r,a,o(a),e)}return r}function Ft(e,t){for(var o=-1,r=null==e?0:e.length;++o<r&&!1!==t(e[o],o,e););return e}function At(e,t){for(var o=null==e?0:e.length;o--&&!1!==t(e[o],o,e););return e}function _t(e,t){for(var o=-1,r=null==e?0:e.length;++o<r;)if(!t(e[o],o,e))return!1;return!0}function St(e,t){for(var o=-1,r=null==e?0:e.length,n=0,i=[];++o<r;){var a=e[o];t(a,o,e)&&(i[n++]=a)}return i}function Et(e,t){return!(null==e||!e.length)&&Ut(e,t,0)>-1}function xt(e,t,o){for(var r=-1,n=null==e?0:e.length;++r<n;)if(o(t,e[r]))return!0;return!1}function Pt(e,t){for(var o=-1,r=null==e?0:e.length,n=Array(r);++o<r;)n[o]=t(e[o],o,e);return n}function Rt(e,t){for(var o=-1,r=t.length,n=e.length;++o<r;)e[n+o]=t[o];return e}function kt(e,t,o,r){var n=-1,i=null==e?0:e.length;for(r&&i&&(o=e[++n]);++n<i;)o=t(o,e[n],n,e);return o}function Nt(e,t,o,r){var n=null==e?0:e.length;for(r&&n&&(o=e[--n]);n--;)o=t(o,e[n],n,e);return o}function Ot(e,t){for(var o=-1,r=null==e?0:e.length;++o<r;)if(t(e[o],o,e))return!0;return!1}var Tt=zt("length");function Lt(e,t,o){var r;return o(e,function(e,o,n){if(t(e,o,n))return r=o,!1}),r}function Mt(e,t,o,r){for(var n=e.length,i=o+(r?1:-1);r?i--:++i<n;)if(t(e[i],i,e))return i;return-1}function Ut(e,t,o){return t==t?function(e,t,o){for(var r=o-1,n=e.length;++r<n;)if(e[r]===t)return r;return-1}(e,t,o):Mt(e,Dt,o)}function jt(e,t,o,r){for(var n=o-1,i=e.length;++n<i;)if(r(e[n],t))return n;return-1}function Dt(e){return e!=e}function Bt(e,t){var o=null==e?0:e.length;return o?Wt(e,t)/o:d}function zt(t){return function(o){return null==o?e:o[t]}}function qt(t){return function(o){return null==t?e:t[o]}}function Vt(e,t,o,r,n){return n(e,function(e,n,i){o=r?(r=!1,e):t(o,e,n,i)}),o}function Wt(t,o){for(var r,n=-1,i=t.length;++n<i;){var a=o(t[n]);a!==e&&(r=r===e?a:r+a)}return r}function Ht(e,t){for(var o=-1,r=Array(e);++o<e;)r[o]=t(o);return r}function $t(e){return e?e.slice(0,co(e)+1).replace(ee,""):e}function Gt(e){return function(t){return e(t)}}function Kt(e,t){return Pt(t,function(t){return e[t]})}function Qt(e,t){return e.has(t)}function Jt(e,t){for(var o=-1,r=e.length;++o<r&&Ut(t,e[o],0)>-1;);return o}function Yt(e,t){for(var o=e.length;o--&&Ut(t,e[o],0)>-1;);return o}var Zt=qt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Xt=qt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function eo(e){return"\\"+nt[e]}function to(e){return Ze.test(e)}function oo(e){var t=-1,o=Array(e.size);return e.forEach(function(e,r){o[++t]=[r,e]}),o}function ro(e,t){return function(o){return e(t(o))}}function no(e,t){for(var o=-1,n=e.length,i=0,a=[];++o<n;){var l=e[o];l!==t&&l!==r||(e[o]=r,a[i++]=o)}return a}function io(e){var t=-1,o=Array(e.size);return e.forEach(function(e){o[++t]=e}),o}function ao(e){var t=-1,o=Array(e.size);return e.forEach(function(e){o[++t]=[e,e]}),o}function lo(e){return to(e)?function(e){for(var t=Je.lastIndex=0;Je.test(e);)++t;return t}(e):Tt(e)}function so(e){return to(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.split("")}(e)}function co(e){for(var t=e.length;t--&&te.test(e.charAt(t)););return t}var uo=qt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fo=function te(ye){var we,be=(ye=null==ye?dt:fo.defaults(dt.Object(),ye,fo.pick(dt,et))).Array,Ce=ye.Date,Ie=ye.Error,Fe=ye.Function,Ae=ye.Math,_e=ye.Object,Se=ye.RegExp,Ee=ye.String,xe=ye.TypeError,Pe=be.prototype,Re=Fe.prototype,ke=_e.prototype,Ne=ye["__core-js_shared__"],Oe=Re.toString,Te=ke.hasOwnProperty,Le=0,Me=(we=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||""))?"Symbol(src)_1."+we:"",Ue=ke.toString,je=Oe.call(_e),De=dt._,Be=Se("^"+Oe.call(Te).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ze=ft?ye.Buffer:e,qe=ye.Symbol,Ve=ye.Uint8Array,We=ze?ze.allocUnsafe:e,He=ro(_e.getPrototypeOf,_e),$e=_e.create,Ge=ke.propertyIsEnumerable,Je=Pe.splice,Ze=qe?qe.isConcatSpreadable:e,nt=qe?qe.iterator:e,lt=qe?qe.toStringTag:e,st=function(){try{var e=ui(_e,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=ye.clearTimeout!==dt.clearTimeout&&ye.clearTimeout,ut=Ce&&Ce.now!==dt.Date.now&&Ce.now,ht=ye.setTimeout!==dt.setTimeout&&ye.setTimeout,mt=Ae.ceil,Tt=Ae.floor,qt=_e.getOwnPropertySymbols,ho=ze?ze.isBuffer:e,mo=ye.isFinite,po=Pe.join,go=ro(_e.keys,_e),vo=Ae.max,yo=Ae.min,wo=Ce.now,bo=ye.parseInt,Co=Ae.random,Io=Pe.reverse,Fo=ui(ye,"DataView"),Ao=ui(ye,"Map"),_o=ui(ye,"Promise"),So=ui(ye,"Set"),Eo=ui(ye,"WeakMap"),xo=ui(_e,"create"),Po=Eo&&new Eo,Ro={},ko=Ui(Fo),No=Ui(Ao),Oo=Ui(_o),To=Ui(So),Lo=Ui(Eo),Mo=qe?qe.prototype:e,Uo=Mo?Mo.valueOf:e,jo=Mo?Mo.toString:e;function Do(e){if(el(e)&&!Va(e)&&!(e instanceof Vo)){if(e instanceof qo)return e;if(Te.call(e,"__wrapped__"))return ji(e)}return new qo(e)}var Bo=function(){function t(){}return function(o){if(!Xa(o))return{};if($e)return $e(o);t.prototype=o;var r=new t;return t.prototype=e,r}}();function zo(){}function qo(t,o){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=e}function Vo(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=c,this.__views__=[]}function Wo(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}function Ho(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}function $o(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}function Go(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new $o;++t<o;)this.add(e[t])}function Ko(e){var t=this.__data__=new Ho(e);this.size=t.size}function Qo(e,t){var o=Va(e),r=!o&&qa(e),n=!o&&!r&&Ga(e),i=!o&&!r&&!n&&sl(e),a=o||r||n||i,l=a?Ht(e.length,Ee):[],s=l.length;for(var d in e)!t&&!Te.call(e,d)||a&&("length"==d||n&&("offset"==d||"parent"==d)||i&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||yi(d,s))||l.push(d);return l}function Jo(t){var o=t.length;return o?t[Gr(0,o-1)]:e}function Yo(e,t){return Ti(Pn(e),ar(t,0,e.length))}function Zo(e){return Ti(Pn(e))}function Xo(t,o,r){(r!==e&&!Da(t[o],r)||r===e&&!(o in t))&&nr(t,o,r)}function er(t,o,r){var n=t[o];Te.call(t,o)&&Da(n,r)&&(r!==e||o in t)||nr(t,o,r)}function tr(e,t){for(var o=e.length;o--;)if(Da(e[o][0],t))return o;return-1}function or(e,t,o,r){return ur(e,function(e,n,i){t(r,e,o(e),i)}),r}function rr(e,t){return e&&Rn(t,Rl(t),e)}function nr(e,t,o){"__proto__"==t&&st?st(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}function ir(t,o){for(var r=-1,n=o.length,i=be(n),a=null==t;++r<n;)i[r]=a?e:_l(t,o[r]);return i}function ar(t,o,r){return t==t&&(r!==e&&(t=t<=r?t:r),o!==e&&(t=t>=o?t:o)),t}function lr(t,o,r,n,i,a){var l,s=1&o,d=2&o,c=4&o;if(r&&(l=i?r(t,n,i,a):r(t)),l!==e)return l;if(!Xa(t))return t;var u=Va(t);if(u){if(l=function(e){var t=e.length,o=new e.constructor(t);return t&&"string"==typeof e[0]&&Te.call(e,"index")&&(o.index=e.index,o.input=e.input),o}(t),!s)return Pn(t,l)}else{var h=mi(t),g=h==v||h==y;if(Ga(t))return Fn(t,s);if(h==C||h==f||g&&!i){if(l=d||g?{}:gi(t),!s)return d?function(e,t){return Rn(e,hi(e),t)}(t,function(e,t){return e&&Rn(t,kl(t),e)}(l,t)):function(e,t){return Rn(e,fi(e),t)}(t,rr(l,t))}else{if(!rt[h])return i?t:{};l=function(e,t,o){var r,n=e.constructor;switch(t){case x:return An(e);case m:case p:return new n(+e);case P:return function(e,t){var o=t?An(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}(e,o);case R:case k:case N:case O:case T:case L:case M:case U:case j:return _n(e,o);case w:return new n;case b:case _:return new n(e);case F:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new n;case S:return r=e,Uo?_e(Uo.call(r)):{}}}(t,h,s)}}a||(a=new Ko);var I=a.get(t);if(I)return I;a.set(t,l),il(t)?t.forEach(function(e){l.add(lr(e,o,r,e,t,a))}):tl(t)&&t.forEach(function(e,n){l.set(n,lr(e,o,r,n,t,a))});var E=u?e:(c?d?ni:ri:d?kl:Rl)(t);return Ft(E||t,function(e,n){E&&(e=t[n=e]),er(l,n,lr(e,o,r,n,t,a))}),l}function sr(t,o,r){var n=r.length;if(null==t)return!n;for(t=_e(t);n--;){var i=r[n],a=o[i],l=t[i];if(l===e&&!(i in t)||!a(l))return!1}return!0}function dr(o,r,n){if("function"!=typeof o)throw new xe(t);return Ri(function(){o.apply(e,n)},r)}function cr(e,t,o,r){var n=-1,i=Et,a=!0,l=e.length,s=[],d=t.length;if(!l)return s;o&&(t=Pt(t,Gt(o))),r?(i=xt,a=!1):t.length>=200&&(i=Qt,a=!1,t=new Go(t));e:for(;++n<l;){var c=e[n],u=null==o?c:o(c);if(c=r||0!==c?c:0,a&&u==u){for(var f=d;f--;)if(t[f]===u)continue e;s.push(c)}else i(t,u,r)||s.push(c)}return s}Do.templateSettings={escape:$,evaluate:G,interpolate:K,variable:"",imports:{_:Do}},Do.prototype=zo.prototype,Do.prototype.constructor=Do,qo.prototype=Bo(zo.prototype),qo.prototype.constructor=qo,Vo.prototype=Bo(zo.prototype),Vo.prototype.constructor=Vo,Wo.prototype.clear=function(){this.__data__=xo?xo(null):{},this.size=0},Wo.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Wo.prototype.get=function(t){var r=this.__data__;if(xo){var n=r[t];return n===o?e:n}return Te.call(r,t)?r[t]:e},Wo.prototype.has=function(t){var o=this.__data__;return xo?o[t]!==e:Te.call(o,t)},Wo.prototype.set=function(t,r){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=xo&&r===e?o:r,this},Ho.prototype.clear=function(){this.__data__=[],this.size=0},Ho.prototype.delete=function(e){var t=this.__data__,o=tr(t,e);return!(o<0||(o==t.length-1?t.pop():Je.call(t,o,1),--this.size,0))},Ho.prototype.get=function(t){var o=this.__data__,r=tr(o,t);return r<0?e:o[r][1]},Ho.prototype.has=function(e){return tr(this.__data__,e)>-1},Ho.prototype.set=function(e,t){var o=this.__data__,r=tr(o,e);return r<0?(++this.size,o.push([e,t])):o[r][1]=t,this},$o.prototype.clear=function(){this.size=0,this.__data__={hash:new Wo,map:new(Ao||Ho),string:new Wo}},$o.prototype.delete=function(e){var t=di(this,e).delete(e);return this.size-=t?1:0,t},$o.prototype.get=function(e){return di(this,e).get(e)},$o.prototype.has=function(e){return di(this,e).has(e)},$o.prototype.set=function(e,t){var o=di(this,e),r=o.size;return o.set(e,t),this.size+=o.size==r?0:1,this},Go.prototype.add=Go.prototype.push=function(e){return this.__data__.set(e,o),this},Go.prototype.has=function(e){return this.__data__.has(e)},Ko.prototype.clear=function(){this.__data__=new Ho,this.size=0},Ko.prototype.delete=function(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o},Ko.prototype.get=function(e){return this.__data__.get(e)},Ko.prototype.has=function(e){return this.__data__.has(e)},Ko.prototype.set=function(e,t){var o=this.__data__;if(o instanceof Ho){var r=o.__data__;if(!Ao||r.length<199)return r.push([e,t]),this.size=++o.size,this;o=this.__data__=new $o(r)}return o.set(e,t),this.size=o.size,this};var ur=On(wr),fr=On(br,!0);function hr(e,t){var o=!0;return ur(e,function(e,r,n){return o=!!t(e,r,n)}),o}function mr(t,o,r){for(var n=-1,i=t.length;++n<i;){var a=t[n],l=o(a);if(null!=l&&(s===e?l==l&&!ll(l):r(l,s)))var s=l,d=a}return d}function pr(e,t){var o=[];return ur(e,function(e,r,n){t(e,r,n)&&o.push(e)}),o}function gr(e,t,o,r,n){var i=-1,a=e.length;for(o||(o=vi),n||(n=[]);++i<a;){var l=e[i];t>0&&o(l)?t>1?gr(l,t-1,o,r,n):Rt(n,l):r||(n[n.length]=l)}return n}var vr=Tn(),yr=Tn(!0);function wr(e,t){return e&&vr(e,t,Rl)}function br(e,t){return e&&yr(e,t,Rl)}function Cr(e,t){return St(t,function(t){return Ja(e[t])})}function Ir(t,o){for(var r=0,n=(o=wn(o,t)).length;null!=t&&r<n;)t=t[Mi(o[r++])];return r&&r==n?t:e}function Fr(e,t,o){var r=t(e);return Va(e)?r:Rt(r,o(e))}function Ar(t){return null==t?t===e?"[object Undefined]":"[object Null]":lt&&lt in _e(t)?function(t){var o=Te.call(t,lt),r=t[lt];try{t[lt]=e;var n=!0}catch(e){}var i=Ue.call(t);return n&&(o?t[lt]=r:delete t[lt]),i}(t):function(e){return Ue.call(e)}(t)}function _r(e,t){return e>t}function Sr(e,t){return null!=e&&Te.call(e,t)}function Er(e,t){return null!=e&&t in _e(e)}function xr(t,o,r){for(var n=r?xt:Et,i=t[0].length,a=t.length,l=a,s=be(a),d=1/0,c=[];l--;){var u=t[l];l&&o&&(u=Pt(u,Gt(o))),d=yo(u.length,d),s[l]=!r&&(o||i>=120&&u.length>=120)?new Go(l&&u):e}u=t[0];var f=-1,h=s[0];e:for(;++f<i&&c.length<d;){var m=u[f],p=o?o(m):m;if(m=r||0!==m?m:0,!(h?Qt(h,p):n(c,p,r))){for(l=a;--l;){var g=s[l];if(!(g?Qt(g,p):n(t[l],p,r)))continue e}h&&h.push(p),c.push(m)}}return c}function Pr(t,o,r){var n=null==(t=Ei(t,o=wn(o,t)))?t:t[Mi(Qi(o))];return null==n?e:Ct(n,t,r)}function Rr(e){return el(e)&&Ar(e)==f}function kr(t,o,r,n,i){return t===o||(null==t||null==o||!el(t)&&!el(o)?t!=t&&o!=o:function(t,o,r,n,i,a){var l=Va(t),s=Va(o),d=l?h:mi(t),c=s?h:mi(o),u=(d=d==f?C:d)==C,v=(c=c==f?C:c)==C,y=d==c;if(y&&Ga(t)){if(!Ga(o))return!1;l=!0,u=!1}if(y&&!u)return a||(a=new Ko),l||sl(t)?ti(t,o,r,n,i,a):function(e,t,o,r,n,i,a){switch(o){case P:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case m:case p:case b:return Da(+e,+t);case g:return e.name==t.name&&e.message==t.message;case F:case _:return e==t+"";case w:var l=oo;case A:var s=1&r;if(l||(l=io),e.size!=t.size&&!s)return!1;var d=a.get(e);if(d)return d==t;r|=2,a.set(e,t);var c=ti(l(e),l(t),r,n,i,a);return a.delete(e),c;case S:if(Uo)return Uo.call(e)==Uo.call(t)}return!1}(t,o,d,r,n,i,a);if(!(1&r)){var I=u&&Te.call(t,"__wrapped__"),E=v&&Te.call(o,"__wrapped__");if(I||E){var R=I?t.value():t,k=E?o.value():o;return a||(a=new Ko),i(R,k,r,n,a)}}return!!y&&(a||(a=new Ko),function(t,o,r,n,i,a){var l=1&r,s=ri(t),d=s.length,c=ri(o),u=c.length;if(d!=u&&!l)return!1;for(var f=d;f--;){var h=s[f];if(!(l?h in o:Te.call(o,h)))return!1}var m=a.get(t),p=a.get(o);if(m&&p)return m==o&&p==t;var g=!0;a.set(t,o),a.set(o,t);for(var v=l;++f<d;){var y=t[h=s[f]],w=o[h];if(n)var b=l?n(w,y,h,o,t,a):n(y,w,h,t,o,a);if(!(b===e?y===w||i(y,w,r,n,a):b)){g=!1;break}v||(v="constructor"==h)}if(g&&!v){var C=t.constructor,I=o.constructor;C==I||!("constructor"in t)||!("constructor"in o)||"function"==typeof C&&C instanceof C&&"function"==typeof I&&I instanceof I||(g=!1)}return a.delete(t),a.delete(o),g}(t,o,r,n,i,a))}(t,o,r,n,kr,i))}function Nr(t,o,r,n){var i=r.length,a=i,l=!n;if(null==t)return!a;for(t=_e(t);i--;){var s=r[i];if(l&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<a;){var d=(s=r[i])[0],c=t[d],u=s[1];if(l&&s[2]){if(c===e&&!(d in t))return!1}else{var f=new Ko;if(n)var h=n(c,u,d,t,o,f);if(!(h===e?kr(u,c,3,n,f):h))return!1}}return!0}function Or(e){return!(!Xa(e)||(t=e,Me&&Me in t))&&(Ja(e)?Be:fe).test(Ui(e));var t}function Tr(e){return"function"==typeof e?e:null==e?os:"object"==typeof e?Va(e)?Br(e[0],e[1]):Dr(e):us(e)}function Lr(e){if(!Fi(e))return go(e);var t=[];for(var o in _e(e))Te.call(e,o)&&"constructor"!=o&&t.push(o);return t}function Mr(e){if(!Xa(e))return function(e){var t=[];if(null!=e)for(var o in _e(e))t.push(o);return t}(e);var t=Fi(e),o=[];for(var r in e)("constructor"!=r||!t&&Te.call(e,r))&&o.push(r);return o}function Ur(e,t){return e<t}function jr(e,t){var o=-1,r=Ha(e)?be(e.length):[];return ur(e,function(e,n,i){r[++o]=t(e,n,i)}),r}function Dr(e){var t=ci(e);return 1==t.length&&t[0][2]?_i(t[0][0],t[0][1]):function(o){return o===e||Nr(o,e,t)}}function Br(t,o){return bi(t)&&Ai(o)?_i(Mi(t),o):function(r){var n=_l(r,t);return n===e&&n===o?Sl(r,t):kr(o,n,3)}}function zr(t,o,r,n,i){t!==o&&vr(o,function(a,l){if(i||(i=new Ko),Xa(a))!function(t,o,r,n,i,a,l){var s=xi(t,r),d=xi(o,r),c=l.get(d);if(c)Xo(t,r,c);else{var u=a?a(s,d,r+"",t,o,l):e,f=u===e;if(f){var h=Va(d),m=!h&&Ga(d),p=!h&&!m&&sl(d);u=d,h||m||p?Va(s)?u=s:$a(s)?u=Pn(s):m?(f=!1,u=Fn(d,!0)):p?(f=!1,u=_n(d,!0)):u=[]:rl(d)||qa(d)?(u=s,qa(s)?u=gl(s):Xa(s)&&!Ja(s)||(u=gi(d))):f=!1}f&&(l.set(d,u),i(u,d,n,a,l),l.delete(d)),Xo(t,r,u)}}(t,o,l,r,zr,n,i);else{var s=n?n(xi(t,l),a,l+"",t,o,i):e;s===e&&(s=a),Xo(t,l,s)}},kl)}function qr(t,o){var r=t.length;if(r)return yi(o+=o<0?r:0,r)?t[o]:e}function Vr(e,t,o){t=t.length?Pt(t,function(e){return Va(e)?function(t){return Ir(t,1===e.length?e[0]:e)}:e}):[os];var r=-1;t=Pt(t,Gt(si()));var n=jr(e,function(e,o,n){var i=Pt(t,function(t){return t(e)});return{criteria:i,index:++r,value:e}});return function(e,t){var o=e.length;for(e.sort(t);o--;)e[o]=e[o].value;return e}(n,function(e,t){return function(e,t,o){for(var r=-1,n=e.criteria,i=t.criteria,a=n.length,l=o.length;++r<a;){var s=Sn(n[r],i[r]);if(s)return r>=l?s:s*("desc"==o[r]?-1:1)}return e.index-t.index}(e,t,o)})}function Wr(e,t,o){for(var r=-1,n=t.length,i={};++r<n;){var a=t[r],l=Ir(e,a);o(l,a)&&Zr(i,wn(a,e),l)}return i}function Hr(e,t,o,r){var n=r?jt:Ut,i=-1,a=t.length,l=e;for(e===t&&(t=Pn(t)),o&&(l=Pt(e,Gt(o)));++i<a;)for(var s=0,d=t[i],c=o?o(d):d;(s=n(l,c,s,r))>-1;)l!==e&&Je.call(l,s,1),Je.call(e,s,1);return e}function $r(e,t){for(var o=e?t.length:0,r=o-1;o--;){var n=t[o];if(o==r||n!==i){var i=n;yi(n)?Je.call(e,n,1):un(e,n)}}return e}function Gr(e,t){return e+Tt(Co()*(t-e+1))}function Kr(e,t){var o="";if(!e||t<1||t>s)return o;do{t%2&&(o+=e),(t=Tt(t/2))&&(e+=e)}while(t);return o}function Qr(e,t){return ki(Si(e,t,os),e+"")}function Jr(e){return Jo(Dl(e))}function Yr(e,t){var o=Dl(e);return Ti(o,ar(t,0,o.length))}function Zr(t,o,r,n){if(!Xa(t))return t;for(var i=-1,a=(o=wn(o,t)).length,l=a-1,s=t;null!=s&&++i<a;){var d=Mi(o[i]),c=r;if("__proto__"===d||"constructor"===d||"prototype"===d)return t;if(i!=l){var u=s[d];(c=n?n(u,d,s):e)===e&&(c=Xa(u)?u:yi(o[i+1])?[]:{})}er(s,d,c),s=s[d]}return t}var Xr=Po?function(e,t){return Po.set(e,t),e}:os,en=st?function(e,t){return st(e,"toString",{configurable:!0,enumerable:!1,value:Xl(t),writable:!0})}:os;function tn(e){return Ti(Dl(e))}function on(e,t,o){var r=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(o=o>n?n:o)<0&&(o+=n),n=t>o?0:o-t>>>0,t>>>=0;for(var i=be(n);++r<n;)i[r]=e[r+t];return i}function rn(e,t){var o;return ur(e,function(e,r,n){return!(o=t(e,r,n))}),!!o}function nn(e,t,o){var r=0,n=null==e?r:e.length;if("number"==typeof t&&t==t&&n<=2147483647){for(;r<n;){var i=r+n>>>1,a=e[i];null!==a&&!ll(a)&&(o?a<=t:a<t)?r=i+1:n=i}return n}return an(e,t,os,o)}function an(t,o,r,n){var i=0,a=null==t?0:t.length;if(0===a)return 0;for(var l=(o=r(o))!=o,s=null===o,d=ll(o),c=o===e;i<a;){var u=Tt((i+a)/2),f=r(t[u]),h=f!==e,m=null===f,p=f==f,g=ll(f);if(l)var v=n||p;else v=c?p&&(n||h):s?p&&h&&(n||!m):d?p&&h&&!m&&(n||!g):!m&&!g&&(n?f<=o:f<o);v?i=u+1:a=u}return yo(a,4294967294)}function ln(e,t){for(var o=-1,r=e.length,n=0,i=[];++o<r;){var a=e[o],l=t?t(a):a;if(!o||!Da(l,s)){var s=l;i[n++]=0===a?0:a}}return i}function sn(e){return"number"==typeof e?e:ll(e)?d:+e}function dn(e){if("string"==typeof e)return e;if(Va(e))return Pt(e,dn)+"";if(ll(e))return jo?jo.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function cn(e,t,o){var r=-1,n=Et,i=e.length,a=!0,l=[],s=l;if(o)a=!1,n=xt;else if(i>=200){var d=t?null:Qn(e);if(d)return io(d);a=!1,n=Qt,s=new Go}else s=t?[]:l;e:for(;++r<i;){var c=e[r],u=t?t(c):c;if(c=o||0!==c?c:0,a&&u==u){for(var f=s.length;f--;)if(s[f]===u)continue e;t&&s.push(u),l.push(c)}else n(s,u,o)||(s!==l&&s.push(u),l.push(c))}return l}function un(e,t){return null==(e=Ei(e,t=wn(t,e)))||delete e[Mi(Qi(t))]}function fn(e,t,o,r){return Zr(e,t,o(Ir(e,t)),r)}function hn(e,t,o,r){for(var n=e.length,i=r?n:-1;(r?i--:++i<n)&&t(e[i],i,e););return o?on(e,r?0:i,r?i+1:n):on(e,r?i+1:0,r?n:i)}function mn(e,t){var o=e;return o instanceof Vo&&(o=o.value()),kt(t,function(e,t){return t.func.apply(t.thisArg,Rt([e],t.args))},o)}function pn(e,t,o){var r=e.length;if(r<2)return r?cn(e[0]):[];for(var n=-1,i=be(r);++n<r;)for(var a=e[n],l=-1;++l<r;)l!=n&&(i[n]=cr(i[n]||a,e[l],t,o));return cn(gr(i,1),t,o)}function gn(t,o,r){for(var n=-1,i=t.length,a=o.length,l={};++n<i;){var s=n<a?o[n]:e;r(l,t[n],s)}return l}function vn(e){return $a(e)?e:[]}function yn(e){return"function"==typeof e?e:os}function wn(e,t){return Va(e)?e:bi(e,t)?[e]:Li(vl(e))}var bn=Qr;function Cn(t,o,r){var n=t.length;return r=r===e?n:r,!o&&r>=n?t:on(t,o,r)}var In=ct||function(e){return dt.clearTimeout(e)};function Fn(e,t){if(t)return e.slice();var o=e.length,r=We?We(o):new e.constructor(o);return e.copy(r),r}function An(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function _n(e,t){var o=t?An(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function Sn(t,o){if(t!==o){var r=t!==e,n=null===t,i=t==t,a=ll(t),l=o!==e,s=null===o,d=o==o,c=ll(o);if(!s&&!c&&!a&&t>o||a&&l&&d&&!s&&!c||n&&l&&d||!r&&d||!i)return 1;if(!n&&!a&&!c&&t<o||c&&r&&i&&!n&&!a||s&&r&&i||!l&&i||!d)return-1}return 0}function En(e,t,o,r){for(var n=-1,i=e.length,a=o.length,l=-1,s=t.length,d=vo(i-a,0),c=be(s+d),u=!r;++l<s;)c[l]=t[l];for(;++n<a;)(u||n<i)&&(c[o[n]]=e[n]);for(;d--;)c[l++]=e[n++];return c}function xn(e,t,o,r){for(var n=-1,i=e.length,a=-1,l=o.length,s=-1,d=t.length,c=vo(i-l,0),u=be(c+d),f=!r;++n<c;)u[n]=e[n];for(var h=n;++s<d;)u[h+s]=t[s];for(;++a<l;)(f||n<i)&&(u[h+o[a]]=e[n++]);return u}function Pn(e,t){var o=-1,r=e.length;for(t||(t=be(r));++o<r;)t[o]=e[o];return t}function Rn(t,o,r,n){var i=!r;r||(r={});for(var a=-1,l=o.length;++a<l;){var s=o[a],d=n?n(r[s],t[s],s,r,t):e;d===e&&(d=t[s]),i?nr(r,s,d):er(r,s,d)}return r}function kn(e,t){return function(o,r){var n=Va(o)?It:or,i=t?t():{};return n(o,e,si(r,2),i)}}function Nn(t){return Qr(function(o,r){var n=-1,i=r.length,a=i>1?r[i-1]:e,l=i>2?r[2]:e;for(a=t.length>3&&"function"==typeof a?(i--,a):e,l&&wi(r[0],r[1],l)&&(a=i<3?e:a,i=1),o=_e(o);++n<i;){var s=r[n];s&&t(o,s,n,a)}return o})}function On(e,t){return function(o,r){if(null==o)return o;if(!Ha(o))return e(o,r);for(var n=o.length,i=t?n:-1,a=_e(o);(t?i--:++i<n)&&!1!==r(a[i],i,a););return o}}function Tn(e){return function(t,o,r){for(var n=-1,i=_e(t),a=r(t),l=a.length;l--;){var s=a[e?l:++n];if(!1===o(i[s],s,i))break}return t}}function Ln(t){return function(o){var r=to(o=vl(o))?so(o):e,n=r?r[0]:o.charAt(0),i=r?Cn(r,1).join(""):o.slice(1);return n[t]()+i}}function Mn(e){return function(t){return kt(Jl(ql(t).replace(Ke,"")),e,"")}}function Un(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var o=Bo(e.prototype),r=e.apply(o,t);return Xa(r)?r:o}}function jn(t){return function(o,r,n){var i=_e(o);if(!Ha(o)){var a=si(r,3);o=Rl(o),r=function(e){return a(i[e],e,i)}}var l=t(o,r,n);return l>-1?i[a?o[l]:l]:e}}function Dn(o){return oi(function(r){var n=r.length,i=n,a=qo.prototype.thru;for(o&&r.reverse();i--;){var l=r[i];if("function"!=typeof l)throw new xe(t);if(a&&!s&&"wrapper"==ai(l))var s=new qo([],!0)}for(i=s?i:n;++i<n;){var d=ai(l=r[i]),c="wrapper"==d?ii(l):e;s=c&&Ci(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?s[ai(c[0])].apply(s,c[3]):1==l.length&&Ci(l)?s[d]():s.thru(l)}return function(){var e=arguments,t=e[0];if(s&&1==e.length&&Va(t))return s.plant(t).value();for(var o=0,i=n?r[o].apply(this,e):t;++o<n;)i=r[o].call(this,i);return i}})}function Bn(t,o,r,n,a,l,s,d,c,u){var f=o&i,h=1&o,m=2&o,p=24&o,g=512&o,v=m?e:Un(t);return function i(){for(var y=arguments.length,w=be(y),b=y;b--;)w[b]=arguments[b];if(p)var C=li(i),I=function(e,t){for(var o=e.length,r=0;o--;)e[o]===t&&++r;return r}(w,C);if(n&&(w=En(w,n,a,p)),l&&(w=xn(w,l,s,p)),y-=I,p&&y<u){var F=no(w,C);return Gn(t,o,Bn,i.placeholder,r,w,F,d,c,u-y)}var A=h?r:this,_=m?A[t]:t;return y=w.length,d?w=function(t,o){for(var r=t.length,n=yo(o.length,r),i=Pn(t);n--;){var a=o[n];t[n]=yi(a,r)?i[a]:e}return t}(w,d):g&&y>1&&w.reverse(),f&&c<y&&(w.length=c),this&&this!==dt&&this instanceof i&&(_=v||Un(_)),_.apply(A,w)}}function zn(e,t){return function(o,r){return function(e,t,o,r){return wr(e,function(e,n,i){t(r,o(e),n,i)}),r}(o,e,t(r),{})}}function qn(t,o){return function(r,n){var i;if(r===e&&n===e)return o;if(r!==e&&(i=r),n!==e){if(i===e)return n;"string"==typeof r||"string"==typeof n?(r=dn(r),n=dn(n)):(r=sn(r),n=sn(n)),i=t(r,n)}return i}}function Vn(e){return oi(function(t){return t=Pt(t,Gt(si())),Qr(function(o){var r=this;return e(t,function(e){return Ct(e,r,o)})})})}function Wn(t,o){var r=(o=o===e?" ":dn(o)).length;if(r<2)return r?Kr(o,t):o;var n=Kr(o,mt(t/lo(o)));return to(o)?Cn(so(n),0,t).join(""):n.slice(0,t)}function Hn(t){return function(o,r,n){return n&&"number"!=typeof n&&wi(o,r,n)&&(r=n=e),o=fl(o),r===e?(r=o,o=0):r=fl(r),function(e,t,o,r){for(var n=-1,i=vo(mt((t-e)/(o||1)),0),a=be(i);i--;)a[r?i:++n]=e,e+=o;return a}(o,r,n=n===e?o<r?1:-1:fl(n),t)}}function $n(e){return function(t,o){return"string"==typeof t&&"string"==typeof o||(t=pl(t),o=pl(o)),e(t,o)}}function Gn(t,o,r,i,a,l,s,d,c,u){var f=8&o;o|=f?n:64,4&(o&=~(f?64:n))||(o&=-4);var h=[t,o,a,f?l:e,f?s:e,f?e:l,f?e:s,d,c,u],m=r.apply(e,h);return Ci(t)&&Pi(m,h),m.placeholder=i,Ni(m,t,o)}function Kn(e){var t=Ae[e];return function(e,o){if(e=pl(e),(o=null==o?0:yo(hl(o),292))&&mo(e)){var r=(vl(e)+"e").split("e");return+((r=(vl(t(r[0]+"e"+(+r[1]+o)))+"e").split("e"))[0]+"e"+(+r[1]-o))}return t(e)}}var Qn=So&&1/io(new So([,-0]))[1]==l?function(e){return new So(e)}:ls;function Jn(e){return function(t){var o=mi(t);return o==w?oo(t):o==A?ao(t):function(e,t){return Pt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Yn(o,l,s,d,c,u,f,h){var m=2&l;if(!m&&"function"!=typeof o)throw new xe(t);var p=d?d.length:0;if(p||(l&=-97,d=c=e),f=f===e?f:vo(hl(f),0),h=h===e?h:hl(h),p-=c?c.length:0,64&l){var g=d,v=c;d=c=e}var y=m?e:ii(o),w=[o,l,s,d,c,g,v,u,f,h];if(y&&function(e,t){var o=e[1],n=t[1],l=o|n,s=l<131,d=n==i&&8==o||n==i&&o==a&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==o;if(!s&&!d)return e;1&n&&(e[2]=t[2],l|=1&o?0:4);var c=t[3];if(c){var u=e[3];e[3]=u?En(u,c,t[4]):c,e[4]=u?no(e[3],r):t[4]}(c=t[5])&&(u=e[5],e[5]=u?xn(u,c,t[6]):c,e[6]=u?no(e[5],r):t[6]),(c=t[7])&&(e[7]=c),n&i&&(e[8]=null==e[8]?t[8]:yo(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=l}(w,y),o=w[0],l=w[1],s=w[2],d=w[3],c=w[4],!(h=w[9]=w[9]===e?m?0:o.length:vo(w[9]-p,0))&&24&l&&(l&=-25),l&&1!=l)b=8==l||16==l?function(t,o,r){var n=Un(t);return function i(){for(var a=arguments.length,l=be(a),s=a,d=li(i);s--;)l[s]=arguments[s];var c=a<3&&l[0]!==d&&l[a-1]!==d?[]:no(l,d);return(a-=c.length)<r?Gn(t,o,Bn,i.placeholder,e,l,c,e,e,r-a):Ct(this&&this!==dt&&this instanceof i?n:t,this,l)}}(o,l,h):l!=n&&33!=l||c.length?Bn.apply(e,w):function(e,t,o,r){var n=1&t,i=Un(e);return function t(){for(var a=-1,l=arguments.length,s=-1,d=r.length,c=be(d+l),u=this&&this!==dt&&this instanceof t?i:e;++s<d;)c[s]=r[s];for(;l--;)c[s++]=arguments[++a];return Ct(u,n?o:this,c)}}(o,l,s,d);else var b=function(e,t,o){var r=1&t,n=Un(e);return function t(){return(this&&this!==dt&&this instanceof t?n:e).apply(r?o:this,arguments)}}(o,l,s);return Ni((y?Xr:Pi)(b,w),o,l)}function Zn(t,o,r,n){return t===e||Da(t,ke[r])&&!Te.call(n,r)?o:t}function Xn(t,o,r,n,i,a){return Xa(t)&&Xa(o)&&(a.set(o,t),zr(t,o,e,Xn,a),a.delete(o)),t}function ei(t){return rl(t)?e:t}function ti(t,o,r,n,i,a){var l=1&r,s=t.length,d=o.length;if(s!=d&&!(l&&d>s))return!1;var c=a.get(t),u=a.get(o);if(c&&u)return c==o&&u==t;var f=-1,h=!0,m=2&r?new Go:e;for(a.set(t,o),a.set(o,t);++f<s;){var p=t[f],g=o[f];if(n)var v=l?n(g,p,f,o,t,a):n(p,g,f,t,o,a);if(v!==e){if(v)continue;h=!1;break}if(m){if(!Ot(o,function(e,t){if(!Qt(m,t)&&(p===e||i(p,e,r,n,a)))return m.push(t)})){h=!1;break}}else if(p!==g&&!i(p,g,r,n,a)){h=!1;break}}return a.delete(t),a.delete(o),h}function oi(t){return ki(Si(t,e,Wi),t+"")}function ri(e){return Fr(e,Rl,fi)}function ni(e){return Fr(e,kl,hi)}var ii=Po?function(e){return Po.get(e)}:ls;function ai(e){for(var t=e.name+"",o=Ro[t],r=Te.call(Ro,t)?o.length:0;r--;){var n=o[r],i=n.func;if(null==i||i==e)return n.name}return t}function li(e){return(Te.call(Do,"placeholder")?Do:e).placeholder}function si(){var e=Do.iteratee||rs;return e=e===rs?Tr:e,arguments.length?e(arguments[0],arguments[1]):e}function di(e,t){var o,r,n=e.__data__;return("string"==(r=typeof(o=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==o:null===o)?n["string"==typeof t?"string":"hash"]:n.map}function ci(e){for(var t=Rl(e),o=t.length;o--;){var r=t[o],n=e[r];t[o]=[r,n,Ai(n)]}return t}function ui(t,o){var r=function(t,o){return null==t?e:t[o]}(t,o);return Or(r)?r:e}var fi=qt?function(e){return null==e?[]:(e=_e(e),St(qt(e),function(t){return Ge.call(e,t)}))}:ms,hi=qt?function(e){for(var t=[];e;)Rt(t,fi(e)),e=He(e);return t}:ms,mi=Ar;function pi(e,t,o){for(var r=-1,n=(t=wn(t,e)).length,i=!1;++r<n;){var a=Mi(t[r]);if(!(i=null!=e&&o(e,a)))break;e=e[a]}return i||++r!=n?i:!!(n=null==e?0:e.length)&&Za(n)&&yi(a,n)&&(Va(e)||qa(e))}function gi(e){return"function"!=typeof e.constructor||Fi(e)?{}:Bo(He(e))}function vi(e){return Va(e)||qa(e)||!!(Ze&&e&&e[Ze])}function yi(e,t){var o=typeof e;return!!(t=null==t?s:t)&&("number"==o||"symbol"!=o&&me.test(e))&&e>-1&&e%1==0&&e<t}function wi(e,t,o){if(!Xa(o))return!1;var r=typeof t;return!!("number"==r?Ha(o)&&yi(t,o.length):"string"==r&&t in o)&&Da(o[t],e)}function bi(e,t){if(Va(e))return!1;var o=typeof e;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=e&&!ll(e))||J.test(e)||!Q.test(e)||null!=t&&e in _e(t)}function Ci(e){var t=ai(e),o=Do[t];if("function"!=typeof o||!(t in Vo.prototype))return!1;if(e===o)return!0;var r=ii(o);return!!r&&e===r[0]}(Fo&&mi(new Fo(new ArrayBuffer(1)))!=P||Ao&&mi(new Ao)!=w||_o&&mi(_o.resolve())!=I||So&&mi(new So)!=A||Eo&&mi(new Eo)!=E)&&(mi=function(t){var o=Ar(t),r=o==C?t.constructor:e,n=r?Ui(r):"";if(n)switch(n){case ko:return P;case No:return w;case Oo:return I;case To:return A;case Lo:return E}return o});var Ii=Ne?Ja:ps;function Fi(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ke)}function Ai(e){return e==e&&!Xa(e)}function _i(t,o){return function(r){return null!=r&&r[t]===o&&(o!==e||t in _e(r))}}function Si(t,o,r){return o=vo(o===e?t.length-1:o,0),function(){for(var e=arguments,n=-1,i=vo(e.length-o,0),a=be(i);++n<i;)a[n]=e[o+n];n=-1;for(var l=be(o+1);++n<o;)l[n]=e[n];return l[o]=r(a),Ct(t,this,l)}}function Ei(e,t){return t.length<2?e:Ir(e,on(t,0,-1))}function xi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Pi=Oi(Xr),Ri=ht||function(e,t){return dt.setTimeout(e,t)},ki=Oi(en);function Ni(e,t,o){var r=t+"";return ki(e,function(e,t){var o=t.length;if(!o)return e;var r=o-1;return t[r]=(o>1?"& ":"")+t[r],t=t.join(o>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ft(u,function(o){var r="_."+o[0];t&o[1]&&!Et(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(re);return t?t[1].split(ne):[]}(r),o)))}function Oi(t){var o=0,r=0;return function(){var n=wo(),i=16-(n-r);if(r=n,i>0){if(++o>=800)return arguments[0]}else o=0;return t.apply(e,arguments)}}function Ti(t,o){var r=-1,n=t.length,i=n-1;for(o=o===e?n:o;++r<o;){var a=Gr(r,i),l=t[a];t[a]=t[r],t[r]=l}return t.length=o,t}var Li=function(e){var t=Oa(e,function(e){return 500===o.size&&o.clear(),e}),o=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Y,function(e,o,r,n){t.push(r?n.replace(le,"$1"):o||e)}),t});function Mi(e){if("string"==typeof e||ll(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ui(e){if(null!=e){try{return Oe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function ji(e){if(e instanceof Vo)return e.clone();var t=new qo(e.__wrapped__,e.__chain__);return t.__actions__=Pn(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Di=Qr(function(e,t){return $a(e)?cr(e,gr(t,1,$a,!0)):[]}),Bi=Qr(function(t,o){var r=Qi(o);return $a(r)&&(r=e),$a(t)?cr(t,gr(o,1,$a,!0),si(r,2)):[]}),zi=Qr(function(t,o){var r=Qi(o);return $a(r)&&(r=e),$a(t)?cr(t,gr(o,1,$a,!0),e,r):[]});function qi(e,t,o){var r=null==e?0:e.length;if(!r)return-1;var n=null==o?0:hl(o);return n<0&&(n=vo(r+n,0)),Mt(e,si(t,3),n)}function Vi(t,o,r){var n=null==t?0:t.length;if(!n)return-1;var i=n-1;return r!==e&&(i=hl(r),i=r<0?vo(n+i,0):yo(i,n-1)),Mt(t,si(o,3),i,!0)}function Wi(e){return null!=e&&e.length?gr(e,1):[]}function Hi(t){return t&&t.length?t[0]:e}var $i=Qr(function(e){var t=Pt(e,vn);return t.length&&t[0]===e[0]?xr(t):[]}),Gi=Qr(function(t){var o=Qi(t),r=Pt(t,vn);return o===Qi(r)?o=e:r.pop(),r.length&&r[0]===t[0]?xr(r,si(o,2)):[]}),Ki=Qr(function(t){var o=Qi(t),r=Pt(t,vn);return(o="function"==typeof o?o:e)&&r.pop(),r.length&&r[0]===t[0]?xr(r,e,o):[]});function Qi(t){var o=null==t?0:t.length;return o?t[o-1]:e}var Ji=Qr(Yi);function Yi(e,t){return e&&e.length&&t&&t.length?Hr(e,t):e}var Zi=oi(function(e,t){var o=null==e?0:e.length,r=ir(e,t);return $r(e,Pt(t,function(e){return yi(e,o)?+e:e}).sort(Sn)),r});function Xi(e){return null==e?e:Io.call(e)}var ea=Qr(function(e){return cn(gr(e,1,$a,!0))}),ta=Qr(function(t){var o=Qi(t);return $a(o)&&(o=e),cn(gr(t,1,$a,!0),si(o,2))}),oa=Qr(function(t){var o=Qi(t);return o="function"==typeof o?o:e,cn(gr(t,1,$a,!0),e,o)});function ra(e){if(!e||!e.length)return[];var t=0;return e=St(e,function(e){if($a(e))return t=vo(e.length,t),!0}),Ht(t,function(t){return Pt(e,zt(t))})}function na(t,o){if(!t||!t.length)return[];var r=ra(t);return null==o?r:Pt(r,function(t){return Ct(o,e,t)})}var ia=Qr(function(e,t){return $a(e)?cr(e,t):[]}),aa=Qr(function(e){return pn(St(e,$a))}),la=Qr(function(t){var o=Qi(t);return $a(o)&&(o=e),pn(St(t,$a),si(o,2))}),sa=Qr(function(t){var o=Qi(t);return o="function"==typeof o?o:e,pn(St(t,$a),e,o)}),da=Qr(ra),ca=Qr(function(t){var o=t.length,r=o>1?t[o-1]:e;return r="function"==typeof r?(t.pop(),r):e,na(t,r)});function ua(e){var t=Do(e);return t.__chain__=!0,t}function fa(e,t){return t(e)}var ha=oi(function(t){var o=t.length,r=o?t[0]:0,n=this.__wrapped__,i=function(e){return ir(e,t)};return!(o>1||this.__actions__.length)&&n instanceof Vo&&yi(r)?((n=n.slice(r,+r+(o?1:0))).__actions__.push({func:fa,args:[i],thisArg:e}),new qo(n,this.__chain__).thru(function(t){return o&&!t.length&&t.push(e),t})):this.thru(i)}),ma=kn(function(e,t,o){Te.call(e,o)?++e[o]:nr(e,o,1)}),pa=jn(qi),ga=jn(Vi);function va(e,t){return(Va(e)?Ft:ur)(e,si(t,3))}function ya(e,t){return(Va(e)?At:fr)(e,si(t,3))}var wa=kn(function(e,t,o){Te.call(e,o)?e[o].push(t):nr(e,o,[t])}),ba=Qr(function(e,t,o){var r=-1,n="function"==typeof t,i=Ha(e)?be(e.length):[];return ur(e,function(e){i[++r]=n?Ct(t,e,o):Pr(e,t,o)}),i}),Ca=kn(function(e,t,o){nr(e,o,t)});function Ia(e,t){return(Va(e)?Pt:jr)(e,si(t,3))}var Fa=kn(function(e,t,o){e[o?0:1].push(t)},function(){return[[],[]]}),Aa=Qr(function(e,t){if(null==e)return[];var o=t.length;return o>1&&wi(e,t[0],t[1])?t=[]:o>2&&wi(t[0],t[1],t[2])&&(t=[t[0]]),Vr(e,gr(t,1),[])}),_a=ut||function(){return dt.Date.now()};function Sa(t,o,r){return o=r?e:o,o=t&&null==o?t.length:o,Yn(t,i,e,e,e,e,o)}function Ea(o,r){var n;if("function"!=typeof r)throw new xe(t);return o=hl(o),function(){return--o>0&&(n=r.apply(this,arguments)),o<=1&&(r=e),n}}var xa=Qr(function(e,t,o){var r=1;if(o.length){var i=no(o,li(xa));r|=n}return Yn(e,r,t,o,i)}),Pa=Qr(function(e,t,o){var r=3;if(o.length){var i=no(o,li(Pa));r|=n}return Yn(t,r,e,o,i)});function Ra(o,r,n){var i,a,l,s,d,c,u=0,f=!1,h=!1,m=!0;if("function"!=typeof o)throw new xe(t);function p(t){var r=i,n=a;return i=a=e,u=t,s=o.apply(n,r)}function g(t){var o=t-c;return c===e||o>=r||o<0||h&&t-u>=l}function v(){var e=_a();if(g(e))return y(e);d=Ri(v,function(e){var t=r-(e-c);return h?yo(t,l-(e-u)):t}(e))}function y(t){return d=e,m&&i?p(t):(i=a=e,s)}function w(){var t=_a(),o=g(t);if(i=arguments,a=this,c=t,o){if(d===e)return function(e){return u=e,d=Ri(v,r),f?p(e):s}(c);if(h)return In(d),d=Ri(v,r),p(c)}return d===e&&(d=Ri(v,r)),s}return r=pl(r)||0,Xa(n)&&(f=!!n.leading,l=(h="maxWait"in n)?vo(pl(n.maxWait)||0,r):l,m="trailing"in n?!!n.trailing:m),w.cancel=function(){d!==e&&In(d),u=0,i=c=a=d=e},w.flush=function(){return d===e?s:y(_a())},w}var ka=Qr(function(e,t){return dr(e,1,t)}),Na=Qr(function(e,t,o){return dr(e,pl(t)||0,o)});function Oa(e,o){if("function"!=typeof e||null!=o&&"function"!=typeof o)throw new xe(t);var r=function(){var t=arguments,n=o?o.apply(this,t):t[0],i=r.cache;if(i.has(n))return i.get(n);var a=e.apply(this,t);return r.cache=i.set(n,a)||i,a};return r.cache=new(Oa.Cache||$o),r}function Ta(e){if("function"!=typeof e)throw new xe(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Oa.Cache=$o;var La=bn(function(e,t){var o=(t=1==t.length&&Va(t[0])?Pt(t[0],Gt(si())):Pt(gr(t,1),Gt(si()))).length;return Qr(function(r){for(var n=-1,i=yo(r.length,o);++n<i;)r[n]=t[n].call(this,r[n]);return Ct(e,this,r)})}),Ma=Qr(function(t,o){var r=no(o,li(Ma));return Yn(t,n,e,o,r)}),Ua=Qr(function(t,o){var r=no(o,li(Ua));return Yn(t,64,e,o,r)}),ja=oi(function(t,o){return Yn(t,a,e,e,e,o)});function Da(e,t){return e===t||e!=e&&t!=t}var Ba=$n(_r),za=$n(function(e,t){return e>=t}),qa=Rr(function(){return arguments}())?Rr:function(e){return el(e)&&Te.call(e,"callee")&&!Ge.call(e,"callee")},Va=be.isArray,Wa=pt?Gt(pt):function(e){return el(e)&&Ar(e)==x};function Ha(e){return null!=e&&Za(e.length)&&!Ja(e)}function $a(e){return el(e)&&Ha(e)}var Ga=ho||ps,Ka=gt?Gt(gt):function(e){return el(e)&&Ar(e)==p};function Qa(e){if(!el(e))return!1;var t=Ar(e);return t==g||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rl(e)}function Ja(e){if(!Xa(e))return!1;var t=Ar(e);return t==v||t==y||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ya(e){return"number"==typeof e&&e==hl(e)}function Za(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}function Xa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function el(e){return null!=e&&"object"==typeof e}var tl=vt?Gt(vt):function(e){return el(e)&&mi(e)==w};function ol(e){return"number"==typeof e||el(e)&&Ar(e)==b}function rl(e){if(!el(e)||Ar(e)!=C)return!1;var t=He(e);if(null===t)return!0;var o=Te.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&Oe.call(o)==je}var nl=yt?Gt(yt):function(e){return el(e)&&Ar(e)==F},il=wt?Gt(wt):function(e){return el(e)&&mi(e)==A};function al(e){return"string"==typeof e||!Va(e)&&el(e)&&Ar(e)==_}function ll(e){return"symbol"==typeof e||el(e)&&Ar(e)==S}var sl=bt?Gt(bt):function(e){return el(e)&&Za(e.length)&&!!ot[Ar(e)]},dl=$n(Ur),cl=$n(function(e,t){return e<=t});function ul(e){if(!e)return[];if(Ha(e))return al(e)?so(e):Pn(e);if(nt&&e[nt])return function(e){for(var t,o=[];!(t=e.next()).done;)o.push(t.value);return o}(e[nt]());var t=mi(e);return(t==w?oo:t==A?io:Dl)(e)}function fl(e){return e?(e=pl(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hl(e){var t=fl(e),o=t%1;return t==t?o?t-o:t:0}function ml(e){return e?ar(hl(e),0,c):0}function pl(e){if("number"==typeof e)return e;if(ll(e))return d;if(Xa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=$t(e);var o=ue.test(e);return o||he.test(e)?at(e.slice(2),o?2:8):ce.test(e)?d:+e}function gl(e){return Rn(e,kl(e))}function vl(e){return null==e?"":dn(e)}var yl=Nn(function(e,t){if(Fi(t)||Ha(t))Rn(t,Rl(t),e);else for(var o in t)Te.call(t,o)&&er(e,o,t[o])}),wl=Nn(function(e,t){Rn(t,kl(t),e)}),bl=Nn(function(e,t,o,r){Rn(t,kl(t),e,r)}),Cl=Nn(function(e,t,o,r){Rn(t,Rl(t),e,r)}),Il=oi(ir),Fl=Qr(function(t,o){t=_e(t);var r=-1,n=o.length,i=n>2?o[2]:e;for(i&&wi(o[0],o[1],i)&&(n=1);++r<n;)for(var a=o[r],l=kl(a),s=-1,d=l.length;++s<d;){var c=l[s],u=t[c];(u===e||Da(u,ke[c])&&!Te.call(t,c))&&(t[c]=a[c])}return t}),Al=Qr(function(t){return t.push(e,Xn),Ct(Ol,e,t)});function _l(t,o,r){var n=null==t?e:Ir(t,o);return n===e?r:n}function Sl(e,t){return null!=e&&pi(e,t,Er)}var El=zn(function(e,t,o){null!=t&&"function"!=typeof t.toString&&(t=Ue.call(t)),e[t]=o},Xl(os)),xl=zn(function(e,t,o){null!=t&&"function"!=typeof t.toString&&(t=Ue.call(t)),Te.call(e,t)?e[t].push(o):e[t]=[o]},si),Pl=Qr(Pr);function Rl(e){return Ha(e)?Qo(e):Lr(e)}function kl(e){return Ha(e)?Qo(e,!0):Mr(e)}var Nl=Nn(function(e,t,o){zr(e,t,o)}),Ol=Nn(function(e,t,o,r){zr(e,t,o,r)}),Tl=oi(function(e,t){var o={};if(null==e)return o;var r=!1;t=Pt(t,function(t){return t=wn(t,e),r||(r=t.length>1),t}),Rn(e,ni(e),o),r&&(o=lr(o,7,ei));for(var n=t.length;n--;)un(o,t[n]);return o}),Ll=oi(function(e,t){return null==e?{}:function(e,t){return Wr(e,t,function(t,o){return Sl(e,o)})}(e,t)});function Ml(e,t){if(null==e)return{};var o=Pt(ni(e),function(e){return[e]});return t=si(t),Wr(e,o,function(e,o){return t(e,o[0])})}var Ul=Jn(Rl),jl=Jn(kl);function Dl(e){return null==e?[]:Kt(e,Rl(e))}var Bl=Mn(function(e,t,o){return t=t.toLowerCase(),e+(o?zl(t):t)});function zl(e){return Ql(vl(e).toLowerCase())}function ql(e){return(e=vl(e))&&e.replace(pe,Zt).replace(Qe,"")}var Vl=Mn(function(e,t,o){return e+(o?"-":"")+t.toLowerCase()}),Wl=Mn(function(e,t,o){return e+(o?" ":"")+t.toLowerCase()}),Hl=Ln("toLowerCase"),$l=Mn(function(e,t,o){return e+(o?"_":"")+t.toLowerCase()}),Gl=Mn(function(e,t,o){return e+(o?" ":"")+Ql(t)}),Kl=Mn(function(e,t,o){return e+(o?" ":"")+t.toUpperCase()}),Ql=Ln("toUpperCase");function Jl(t,o,r){return t=vl(t),(o=r?e:o)===e?function(e){return Xe.test(e)}(t)?function(e){return e.match(Ye)||[]}(t):function(e){return e.match(ie)||[]}(t):t.match(o)||[]}var Yl=Qr(function(t,o){try{return Ct(t,e,o)}catch(e){return Qa(e)?e:new Ie(e)}}),Zl=oi(function(e,t){return Ft(t,function(t){t=Mi(t),nr(e,t,xa(e[t],e))}),e});function Xl(e){return function(){return e}}var es=Dn(),ts=Dn(!0);function os(e){return e}function rs(e){return Tr("function"==typeof e?e:lr(e,1))}var ns=Qr(function(e,t){return function(o){return Pr(o,e,t)}}),is=Qr(function(e,t){return function(o){return Pr(e,o,t)}});function as(e,t,o){var r=Rl(t),n=Cr(t,r);null!=o||Xa(t)&&(n.length||!r.length)||(o=t,t=e,e=this,n=Cr(t,Rl(t)));var i=!(Xa(o)&&"chain"in o&&!o.chain),a=Ja(e);return Ft(n,function(o){var r=t[o];e[o]=r,a&&(e.prototype[o]=function(){var t=this.__chain__;if(i||t){var o=e(this.__wrapped__);return(o.__actions__=Pn(this.__actions__)).push({func:r,args:arguments,thisArg:e}),o.__chain__=t,o}return r.apply(e,Rt([this.value()],arguments))})}),e}function ls(){}var ss=Vn(Pt),ds=Vn(_t),cs=Vn(Ot);function us(e){return bi(e)?zt(Mi(e)):function(e){return function(t){return Ir(t,e)}}(e)}var fs=Hn(),hs=Hn(!0);function ms(){return[]}function ps(){return!1}var gs,vs=qn(function(e,t){return e+t},0),ys=Kn("ceil"),ws=qn(function(e,t){return e/t},1),bs=Kn("floor"),Cs=qn(function(e,t){return e*t},1),Is=Kn("round"),Fs=qn(function(e,t){return e-t},0);return Do.after=function(e,o){if("function"!=typeof o)throw new xe(t);return e=hl(e),function(){if(--e<1)return o.apply(this,arguments)}},Do.ary=Sa,Do.assign=yl,Do.assignIn=wl,Do.assignInWith=bl,Do.assignWith=Cl,Do.at=Il,Do.before=Ea,Do.bind=xa,Do.bindAll=Zl,Do.bindKey=Pa,Do.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Va(e)?e:[e]},Do.chain=ua,Do.chunk=function(t,o,r){o=(r?wi(t,o,r):o===e)?1:vo(hl(o),0);var n=null==t?0:t.length;if(!n||o<1)return[];for(var i=0,a=0,l=be(mt(n/o));i<n;)l[a++]=on(t,i,i+=o);return l},Do.compact=function(e){for(var t=-1,o=null==e?0:e.length,r=0,n=[];++t<o;){var i=e[t];i&&(n[r++]=i)}return n},Do.concat=function(){var e=arguments.length;if(!e)return[];for(var t=be(e-1),o=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Rt(Va(o)?Pn(o):[o],gr(t,1))},Do.cond=function(e){var o=null==e?0:e.length,r=si();return e=o?Pt(e,function(e){if("function"!=typeof e[1])throw new xe(t);return[r(e[0]),e[1]]}):[],Qr(function(t){for(var r=-1;++r<o;){var n=e[r];if(Ct(n[0],this,t))return Ct(n[1],this,t)}})},Do.conforms=function(e){return function(e){var t=Rl(e);return function(o){return sr(o,e,t)}}(lr(e,1))},Do.constant=Xl,Do.countBy=ma,Do.create=function(e,t){var o=Bo(e);return null==t?o:rr(o,t)},Do.curry=function t(o,r,n){var i=Yn(o,8,e,e,e,e,e,r=n?e:r);return i.placeholder=t.placeholder,i},Do.curryRight=function t(o,r,n){var i=Yn(o,16,e,e,e,e,e,r=n?e:r);return i.placeholder=t.placeholder,i},Do.debounce=Ra,Do.defaults=Fl,Do.defaultsDeep=Al,Do.defer=ka,Do.delay=Na,Do.difference=Di,Do.differenceBy=Bi,Do.differenceWith=zi,Do.drop=function(t,o,r){var n=null==t?0:t.length;return n?on(t,(o=r||o===e?1:hl(o))<0?0:o,n):[]},Do.dropRight=function(t,o,r){var n=null==t?0:t.length;return n?on(t,0,(o=n-(o=r||o===e?1:hl(o)))<0?0:o):[]},Do.dropRightWhile=function(e,t){return e&&e.length?hn(e,si(t,3),!0,!0):[]},Do.dropWhile=function(e,t){return e&&e.length?hn(e,si(t,3),!0):[]},Do.fill=function(t,o,r,n){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&wi(t,o,r)&&(r=0,n=i),function(t,o,r,n){var i=t.length;for((r=hl(r))<0&&(r=-r>i?0:i+r),(n=n===e||n>i?i:hl(n))<0&&(n+=i),n=r>n?0:ml(n);r<n;)t[r++]=o;return t}(t,o,r,n)):[]},Do.filter=function(e,t){return(Va(e)?St:pr)(e,si(t,3))},Do.flatMap=function(e,t){return gr(Ia(e,t),1)},Do.flatMapDeep=function(e,t){return gr(Ia(e,t),l)},Do.flatMapDepth=function(t,o,r){return r=r===e?1:hl(r),gr(Ia(t,o),r)},Do.flatten=Wi,Do.flattenDeep=function(e){return null!=e&&e.length?gr(e,l):[]},Do.flattenDepth=function(t,o){return null!=t&&t.length?gr(t,o=o===e?1:hl(o)):[]},Do.flip=function(e){return Yn(e,512)},Do.flow=es,Do.flowRight=ts,Do.fromPairs=function(e){for(var t=-1,o=null==e?0:e.length,r={};++t<o;){var n=e[t];r[n[0]]=n[1]}return r},Do.functions=function(e){return null==e?[]:Cr(e,Rl(e))},Do.functionsIn=function(e){return null==e?[]:Cr(e,kl(e))},Do.groupBy=wa,Do.initial=function(e){return null!=e&&e.length?on(e,0,-1):[]},Do.intersection=$i,Do.intersectionBy=Gi,Do.intersectionWith=Ki,Do.invert=El,Do.invertBy=xl,Do.invokeMap=ba,Do.iteratee=rs,Do.keyBy=Ca,Do.keys=Rl,Do.keysIn=kl,Do.map=Ia,Do.mapKeys=function(e,t){var o={};return t=si(t,3),wr(e,function(e,r,n){nr(o,t(e,r,n),e)}),o},Do.mapValues=function(e,t){var o={};return t=si(t,3),wr(e,function(e,r,n){nr(o,r,t(e,r,n))}),o},Do.matches=function(e){return Dr(lr(e,1))},Do.matchesProperty=function(e,t){return Br(e,lr(t,1))},Do.memoize=Oa,Do.merge=Nl,Do.mergeWith=Ol,Do.method=ns,Do.methodOf=is,Do.mixin=as,Do.negate=Ta,Do.nthArg=function(e){return e=hl(e),Qr(function(t){return qr(t,e)})},Do.omit=Tl,Do.omitBy=function(e,t){return Ml(e,Ta(si(t)))},Do.once=function(e){return Ea(2,e)},Do.orderBy=function(t,o,r,n){return null==t?[]:(Va(o)||(o=null==o?[]:[o]),Va(r=n?e:r)||(r=null==r?[]:[r]),Vr(t,o,r))},Do.over=ss,Do.overArgs=La,Do.overEvery=ds,Do.overSome=cs,Do.partial=Ma,Do.partialRight=Ua,Do.partition=Fa,Do.pick=Ll,Do.pickBy=Ml,Do.property=us,Do.propertyOf=function(t){return function(o){return null==t?e:Ir(t,o)}},Do.pull=Ji,Do.pullAll=Yi,Do.pullAllBy=function(e,t,o){return e&&e.length&&t&&t.length?Hr(e,t,si(o,2)):e},Do.pullAllWith=function(t,o,r){return t&&t.length&&o&&o.length?Hr(t,o,e,r):t},Do.pullAt=Zi,Do.range=fs,Do.rangeRight=hs,Do.rearg=ja,Do.reject=function(e,t){return(Va(e)?St:pr)(e,Ta(si(t,3)))},Do.remove=function(e,t){var o=[];if(!e||!e.length)return o;var r=-1,n=[],i=e.length;for(t=si(t,3);++r<i;){var a=e[r];t(a,r,e)&&(o.push(a),n.push(r))}return $r(e,n),o},Do.rest=function(o,r){if("function"!=typeof o)throw new xe(t);return Qr(o,r=r===e?r:hl(r))},Do.reverse=Xi,Do.sampleSize=function(t,o,r){return o=(r?wi(t,o,r):o===e)?1:hl(o),(Va(t)?Yo:Yr)(t,o)},Do.set=function(e,t,o){return null==e?e:Zr(e,t,o)},Do.setWith=function(t,o,r,n){return n="function"==typeof n?n:e,null==t?t:Zr(t,o,r,n)},Do.shuffle=function(e){return(Va(e)?Zo:tn)(e)},Do.slice=function(t,o,r){var n=null==t?0:t.length;return n?(r&&"number"!=typeof r&&wi(t,o,r)?(o=0,r=n):(o=null==o?0:hl(o),r=r===e?n:hl(r)),on(t,o,r)):[]},Do.sortBy=Aa,Do.sortedUniq=function(e){return e&&e.length?ln(e):[]},Do.sortedUniqBy=function(e,t){return e&&e.length?ln(e,si(t,2)):[]},Do.split=function(t,o,r){return r&&"number"!=typeof r&&wi(t,o,r)&&(o=r=e),(r=r===e?c:r>>>0)?(t=vl(t))&&("string"==typeof o||null!=o&&!nl(o))&&!(o=dn(o))&&to(t)?Cn(so(t),0,r):t.split(o,r):[]},Do.spread=function(e,o){if("function"!=typeof e)throw new xe(t);return o=null==o?0:vo(hl(o),0),Qr(function(t){var r=t[o],n=Cn(t,0,o);return r&&Rt(n,r),Ct(e,this,n)})},Do.tail=function(e){var t=null==e?0:e.length;return t?on(e,1,t):[]},Do.take=function(t,o,r){return t&&t.length?on(t,0,(o=r||o===e?1:hl(o))<0?0:o):[]},Do.takeRight=function(t,o,r){var n=null==t?0:t.length;return n?on(t,(o=n-(o=r||o===e?1:hl(o)))<0?0:o,n):[]},Do.takeRightWhile=function(e,t){return e&&e.length?hn(e,si(t,3),!1,!0):[]},Do.takeWhile=function(e,t){return e&&e.length?hn(e,si(t,3)):[]},Do.tap=function(e,t){return t(e),e},Do.throttle=function(e,o,r){var n=!0,i=!0;if("function"!=typeof e)throw new xe(t);return Xa(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Ra(e,o,{leading:n,maxWait:o,trailing:i})},Do.thru=fa,Do.toArray=ul,Do.toPairs=Ul,Do.toPairsIn=jl,Do.toPath=function(e){return Va(e)?Pt(e,Mi):ll(e)?[e]:Pn(Li(vl(e)))},Do.toPlainObject=gl,Do.transform=function(e,t,o){var r=Va(e),n=r||Ga(e)||sl(e);if(t=si(t,4),null==o){var i=e&&e.constructor;o=n?r?new i:[]:Xa(e)&&Ja(i)?Bo(He(e)):{}}return(n?Ft:wr)(e,function(e,r,n){return t(o,e,r,n)}),o},Do.unary=function(e){return Sa(e,1)},Do.union=ea,Do.unionBy=ta,Do.unionWith=oa,Do.uniq=function(e){return e&&e.length?cn(e):[]},Do.uniqBy=function(e,t){return e&&e.length?cn(e,si(t,2)):[]},Do.uniqWith=function(t,o){return o="function"==typeof o?o:e,t&&t.length?cn(t,e,o):[]},Do.unset=function(e,t){return null==e||un(e,t)},Do.unzip=ra,Do.unzipWith=na,Do.update=function(e,t,o){return null==e?e:fn(e,t,yn(o))},Do.updateWith=function(t,o,r,n){return n="function"==typeof n?n:e,null==t?t:fn(t,o,yn(r),n)},Do.values=Dl,Do.valuesIn=function(e){return null==e?[]:Kt(e,kl(e))},Do.without=ia,Do.words=Jl,Do.wrap=function(e,t){return Ma(yn(t),e)},Do.xor=aa,Do.xorBy=la,Do.xorWith=sa,Do.zip=da,Do.zipObject=function(e,t){return gn(e||[],t||[],er)},Do.zipObjectDeep=function(e,t){return gn(e||[],t||[],Zr)},Do.zipWith=ca,Do.entries=Ul,Do.entriesIn=jl,Do.extend=wl,Do.extendWith=bl,as(Do,Do),Do.add=vs,Do.attempt=Yl,Do.camelCase=Bl,Do.capitalize=zl,Do.ceil=ys,Do.clamp=function(t,o,r){return r===e&&(r=o,o=e),r!==e&&(r=(r=pl(r))==r?r:0),o!==e&&(o=(o=pl(o))==o?o:0),ar(pl(t),o,r)},Do.clone=function(e){return lr(e,4)},Do.cloneDeep=function(e){return lr(e,5)},Do.cloneDeepWith=function(t,o){return lr(t,5,o="function"==typeof o?o:e)},Do.cloneWith=function(t,o){return lr(t,4,o="function"==typeof o?o:e)},Do.conformsTo=function(e,t){return null==t||sr(e,t,Rl(t))},Do.deburr=ql,Do.defaultTo=function(e,t){return null==e||e!=e?t:e},Do.divide=ws,Do.endsWith=function(t,o,r){t=vl(t),o=dn(o);var n=t.length,i=r=r===e?n:ar(hl(r),0,n);return(r-=o.length)>=0&&t.slice(r,i)==o},Do.eq=Da,Do.escape=function(e){return(e=vl(e))&&H.test(e)?e.replace(V,Xt):e},Do.escapeRegExp=function(e){return(e=vl(e))&&X.test(e)?e.replace(Z,"\\$&"):e},Do.every=function(t,o,r){var n=Va(t)?_t:hr;return r&&wi(t,o,r)&&(o=e),n(t,si(o,3))},Do.find=pa,Do.findIndex=qi,Do.findKey=function(e,t){return Lt(e,si(t,3),wr)},Do.findLast=ga,Do.findLastIndex=Vi,Do.findLastKey=function(e,t){return Lt(e,si(t,3),br)},Do.floor=bs,Do.forEach=va,Do.forEachRight=ya,Do.forIn=function(e,t){return null==e?e:vr(e,si(t,3),kl)},Do.forInRight=function(e,t){return null==e?e:yr(e,si(t,3),kl)},Do.forOwn=function(e,t){return e&&wr(e,si(t,3))},Do.forOwnRight=function(e,t){return e&&br(e,si(t,3))},Do.get=_l,Do.gt=Ba,Do.gte=za,Do.has=function(e,t){return null!=e&&pi(e,t,Sr)},Do.hasIn=Sl,Do.head=Hi,Do.identity=os,Do.includes=function(e,t,o,r){e=Ha(e)?e:Dl(e),o=o&&!r?hl(o):0;var n=e.length;return o<0&&(o=vo(n+o,0)),al(e)?o<=n&&e.indexOf(t,o)>-1:!!n&&Ut(e,t,o)>-1},Do.indexOf=function(e,t,o){var r=null==e?0:e.length;if(!r)return-1;var n=null==o?0:hl(o);return n<0&&(n=vo(r+n,0)),Ut(e,t,n)},Do.inRange=function(t,o,r){return o=fl(o),r===e?(r=o,o=0):r=fl(r),function(e,t,o){return e>=yo(t,o)&&e<vo(t,o)}(t=pl(t),o,r)},Do.invoke=Pl,Do.isArguments=qa,Do.isArray=Va,Do.isArrayBuffer=Wa,Do.isArrayLike=Ha,Do.isArrayLikeObject=$a,Do.isBoolean=function(e){return!0===e||!1===e||el(e)&&Ar(e)==m},Do.isBuffer=Ga,Do.isDate=Ka,Do.isElement=function(e){return el(e)&&1===e.nodeType&&!rl(e)},Do.isEmpty=function(e){if(null==e)return!0;if(Ha(e)&&(Va(e)||"string"==typeof e||"function"==typeof e.splice||Ga(e)||sl(e)||qa(e)))return!e.length;var t=mi(e);if(t==w||t==A)return!e.size;if(Fi(e))return!Lr(e).length;for(var o in e)if(Te.call(e,o))return!1;return!0},Do.isEqual=function(e,t){return kr(e,t)},Do.isEqualWith=function(t,o,r){var n=(r="function"==typeof r?r:e)?r(t,o):e;return n===e?kr(t,o,e,r):!!n},Do.isError=Qa,Do.isFinite=function(e){return"number"==typeof e&&mo(e)},Do.isFunction=Ja,Do.isInteger=Ya,Do.isLength=Za,Do.isMap=tl,Do.isMatch=function(e,t){return e===t||Nr(e,t,ci(t))},Do.isMatchWith=function(t,o,r){return r="function"==typeof r?r:e,Nr(t,o,ci(o),r)},Do.isNaN=function(e){return ol(e)&&e!=+e},Do.isNative=function(e){if(Ii(e))throw new Ie("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Or(e)},Do.isNil=function(e){return null==e},Do.isNull=function(e){return null===e},Do.isNumber=ol,Do.isObject=Xa,Do.isObjectLike=el,Do.isPlainObject=rl,Do.isRegExp=nl,Do.isSafeInteger=function(e){return Ya(e)&&e>=-9007199254740991&&e<=s},Do.isSet=il,Do.isString=al,Do.isSymbol=ll,Do.isTypedArray=sl,Do.isUndefined=function(t){return t===e},Do.isWeakMap=function(e){return el(e)&&mi(e)==E},Do.isWeakSet=function(e){return el(e)&&"[object WeakSet]"==Ar(e)},Do.join=function(e,t){return null==e?"":po.call(e,t)},Do.kebabCase=Vl,Do.last=Qi,Do.lastIndexOf=function(t,o,r){var n=null==t?0:t.length;if(!n)return-1;var i=n;return r!==e&&(i=(i=hl(r))<0?vo(n+i,0):yo(i,n-1)),o==o?function(e,t,o){for(var r=o+1;r--;)if(e[r]===t)return r;return r}(t,o,i):Mt(t,Dt,i,!0)},Do.lowerCase=Wl,Do.lowerFirst=Hl,Do.lt=dl,Do.lte=cl,Do.max=function(t){return t&&t.length?mr(t,os,_r):e},Do.maxBy=function(t,o){return t&&t.length?mr(t,si(o,2),_r):e},Do.mean=function(e){return Bt(e,os)},Do.meanBy=function(e,t){return Bt(e,si(t,2))},Do.min=function(t){return t&&t.length?mr(t,os,Ur):e},Do.minBy=function(t,o){return t&&t.length?mr(t,si(o,2),Ur):e},Do.stubArray=ms,Do.stubFalse=ps,Do.stubObject=function(){return{}},Do.stubString=function(){return""},Do.stubTrue=function(){return!0},Do.multiply=Cs,Do.nth=function(t,o){return t&&t.length?qr(t,hl(o)):e},Do.noConflict=function(){return dt._===this&&(dt._=De),this},Do.noop=ls,Do.now=_a,Do.pad=function(e,t,o){e=vl(e);var r=(t=hl(t))?lo(e):0;if(!t||r>=t)return e;var n=(t-r)/2;return Wn(Tt(n),o)+e+Wn(mt(n),o)},Do.padEnd=function(e,t,o){e=vl(e);var r=(t=hl(t))?lo(e):0;return t&&r<t?e+Wn(t-r,o):e},Do.padStart=function(e,t,o){e=vl(e);var r=(t=hl(t))?lo(e):0;return t&&r<t?Wn(t-r,o)+e:e},Do.parseInt=function(e,t,o){return o||null==t?t=0:t&&(t=+t),bo(vl(e).replace(ee,""),t||0)},Do.random=function(t,o,r){if(r&&"boolean"!=typeof r&&wi(t,o,r)&&(o=r=e),r===e&&("boolean"==typeof o?(r=o,o=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&o===e?(t=0,o=1):(t=fl(t),o===e?(o=t,t=0):o=fl(o)),t>o){var n=t;t=o,o=n}if(r||t%1||o%1){var i=Co();return yo(t+i*(o-t+it("1e-"+((i+"").length-1))),o)}return Gr(t,o)},Do.reduce=function(e,t,o){var r=Va(e)?kt:Vt,n=arguments.length<3;return r(e,si(t,4),o,n,ur)},Do.reduceRight=function(e,t,o){var r=Va(e)?Nt:Vt,n=arguments.length<3;return r(e,si(t,4),o,n,fr)},Do.repeat=function(t,o,r){return o=(r?wi(t,o,r):o===e)?1:hl(o),Kr(vl(t),o)},Do.replace=function(){var e=arguments,t=vl(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Do.result=function(t,o,r){var n=-1,i=(o=wn(o,t)).length;for(i||(i=1,t=e);++n<i;){var a=null==t?e:t[Mi(o[n])];a===e&&(n=i,a=r),t=Ja(a)?a.call(t):a}return t},Do.round=Is,Do.runInContext=te,Do.sample=function(e){return(Va(e)?Jo:Jr)(e)},Do.size=function(e){if(null==e)return 0;if(Ha(e))return al(e)?lo(e):e.length;var t=mi(e);return t==w||t==A?e.size:Lr(e).length},Do.snakeCase=$l,Do.some=function(t,o,r){var n=Va(t)?Ot:rn;return r&&wi(t,o,r)&&(o=e),n(t,si(o,3))},Do.sortedIndex=function(e,t){return nn(e,t)},Do.sortedIndexBy=function(e,t,o){return an(e,t,si(o,2))},Do.sortedIndexOf=function(e,t){var o=null==e?0:e.length;if(o){var r=nn(e,t);if(r<o&&Da(e[r],t))return r}return-1},Do.sortedLastIndex=function(e,t){return nn(e,t,!0)},Do.sortedLastIndexBy=function(e,t,o){return an(e,t,si(o,2),!0)},Do.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var o=nn(e,t,!0)-1;if(Da(e[o],t))return o}return-1},Do.startCase=Gl,Do.startsWith=function(e,t,o){return e=vl(e),o=null==o?0:ar(hl(o),0,e.length),t=dn(t),e.slice(o,o+t.length)==t},Do.subtract=Fs,Do.sum=function(e){return e&&e.length?Wt(e,os):0},Do.sumBy=function(e,t){return e&&e.length?Wt(e,si(t,2)):0},Do.template=function(t,o,r){var n=Do.templateSettings;r&&wi(t,o,r)&&(o=e),t=vl(t),o=bl({},o,n,Zn);var i,a,l=bl({},o.imports,n.imports,Zn),s=Rl(l),d=Kt(l,s),c=0,u=o.interpolate||ge,f="__p += '",h=Se((o.escape||ge).source+"|"+u.source+"|"+(u===K?se:ge).source+"|"+(o.evaluate||ge).source+"|$","g"),m="//# sourceURL="+(Te.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++tt+"]")+"\n";t.replace(h,function(e,o,r,n,l,s){return r||(r=n),f+=t.slice(c,s).replace(ve,eo),o&&(i=!0,f+="' +\n__e("+o+") +\n'"),l&&(a=!0,f+="';\n"+l+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=s+e.length,e}),f+="';\n";var p=Te.call(o,"variable")&&o.variable;if(p){if(ae.test(p))throw new Ie("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(a?f.replace(D,""):f).replace(B,"$1").replace(z,"$1;"),f="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var g=Yl(function(){return Fe(s,m+"return "+f).apply(e,d)});if(g.source=f,Qa(g))throw g;return g},Do.times=function(e,t){if((e=hl(e))<1||e>s)return[];var o=c,r=yo(e,c);t=si(t),e-=c;for(var n=Ht(r,t);++o<e;)t(o);return n},Do.toFinite=fl,Do.toInteger=hl,Do.toLength=ml,Do.toLower=function(e){return vl(e).toLowerCase()},Do.toNumber=pl,Do.toSafeInteger=function(e){return e?ar(hl(e),-9007199254740991,s):0===e?e:0},Do.toString=vl,Do.toUpper=function(e){return vl(e).toUpperCase()},Do.trim=function(t,o,r){if((t=vl(t))&&(r||o===e))return $t(t);if(!t||!(o=dn(o)))return t;var n=so(t),i=so(o);return Cn(n,Jt(n,i),Yt(n,i)+1).join("")},Do.trimEnd=function(t,o,r){if((t=vl(t))&&(r||o===e))return t.slice(0,co(t)+1);if(!t||!(o=dn(o)))return t;var n=so(t);return Cn(n,0,Yt(n,so(o))+1).join("")},Do.trimStart=function(t,o,r){if((t=vl(t))&&(r||o===e))return t.replace(ee,"");if(!t||!(o=dn(o)))return t;var n=so(t);return Cn(n,Jt(n,so(o))).join("")},Do.truncate=function(t,o){var r=30,n="...";if(Xa(o)){var i="separator"in o?o.separator:i;r="length"in o?hl(o.length):r,n="omission"in o?dn(o.omission):n}var a=(t=vl(t)).length;if(to(t)){var l=so(t);a=l.length}if(r>=a)return t;var s=r-lo(n);if(s<1)return n;var d=l?Cn(l,0,s).join(""):t.slice(0,s);if(i===e)return d+n;if(l&&(s+=d.length-s),nl(i)){if(t.slice(s).search(i)){var c,u=d;for(i.global||(i=Se(i.source,vl(de.exec(i))+"g")),i.lastIndex=0;c=i.exec(u);)var f=c.index;d=d.slice(0,f===e?s:f)}}else if(t.indexOf(dn(i),s)!=s){var h=d.lastIndexOf(i);h>-1&&(d=d.slice(0,h))}return d+n},Do.unescape=function(e){return(e=vl(e))&&W.test(e)?e.replace(q,uo):e},Do.uniqueId=function(e){var t=++Le;return vl(e)+t},Do.upperCase=Kl,Do.upperFirst=Ql,Do.each=va,Do.eachRight=ya,Do.first=Hi,as(Do,(gs={},wr(Do,function(e,t){Te.call(Do.prototype,t)||(gs[t]=e)}),gs),{chain:!1}),Do.VERSION="4.17.21",Ft(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Do[e].placeholder=Do}),Ft(["drop","take"],function(t,o){Vo.prototype[t]=function(r){r=r===e?1:vo(hl(r),0);var n=this.__filtered__&&!o?new Vo(this):this.clone();return n.__filtered__?n.__takeCount__=yo(r,n.__takeCount__):n.__views__.push({size:yo(r,c),type:t+(n.__dir__<0?"Right":"")}),n},Vo.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ft(["filter","map","takeWhile"],function(e,t){var o=t+1,r=1==o||3==o;Vo.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:si(e,3),type:o}),t.__filtered__=t.__filtered__||r,t}}),Ft(["head","last"],function(e,t){var o="take"+(t?"Right":"");Vo.prototype[e]=function(){return this[o](1).value()[0]}}),Ft(["initial","tail"],function(e,t){var o="drop"+(t?"":"Right");Vo.prototype[e]=function(){return this.__filtered__?new Vo(this):this[o](1)}}),Vo.prototype.compact=function(){return this.filter(os)},Vo.prototype.find=function(e){return this.filter(e).head()},Vo.prototype.findLast=function(e){return this.reverse().find(e)},Vo.prototype.invokeMap=Qr(function(e,t){return"function"==typeof e?new Vo(this):this.map(function(o){return Pr(o,e,t)})}),Vo.prototype.reject=function(e){return this.filter(Ta(si(e)))},Vo.prototype.slice=function(t,o){t=hl(t);var r=this;return r.__filtered__&&(t>0||o<0)?new Vo(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),o!==e&&(r=(o=hl(o))<0?r.dropRight(-o):r.take(o-t)),r)},Vo.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vo.prototype.toArray=function(){return this.take(c)},wr(Vo.prototype,function(t,o){var r=/^(?:filter|find|map|reject)|While$/.test(o),n=/^(?:head|last)$/.test(o),i=Do[n?"take"+("last"==o?"Right":""):o],a=n||/^find/.test(o);i&&(Do.prototype[o]=function(){var o=this.__wrapped__,l=n?[1]:arguments,s=o instanceof Vo,d=l[0],c=s||Va(o),u=function(e){var t=i.apply(Do,Rt([e],l));return n&&f?t[0]:t};c&&r&&"function"==typeof d&&1!=d.length&&(s=c=!1);var f=this.__chain__,h=!!this.__actions__.length,m=a&&!f,p=s&&!h;if(!a&&c){o=p?o:new Vo(this);var g=t.apply(o,l);return g.__actions__.push({func:fa,args:[u],thisArg:e}),new qo(g,f)}return m&&p?t.apply(this,l):(g=this.thru(u),m?n?g.value()[0]:g.value():g)})}),Ft(["pop","push","shift","sort","splice","unshift"],function(e){var t=Pe[e],o=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Do.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var n=this.value();return t.apply(Va(n)?n:[],e)}return this[o](function(o){return t.apply(Va(o)?o:[],e)})}}),wr(Vo.prototype,function(e,t){var o=Do[t];if(o){var r=o.name+"";Te.call(Ro,r)||(Ro[r]=[]),Ro[r].push({name:t,func:o})}}),Ro[Bn(e,2).name]=[{name:"wrapper",func:e}],Vo.prototype.clone=function(){var e=new Vo(this.__wrapped__);return e.__actions__=Pn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Pn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Pn(this.__views__),e},Vo.prototype.reverse=function(){if(this.__filtered__){var e=new Vo(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vo.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,o=Va(e),r=t<0,n=o?e.length:0,i=function(e,t,o){for(var r=-1,n=o.length;++r<n;){var i=o[r],a=i.size;switch(i.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=yo(t,e+a);break;case"takeRight":e=vo(e,t-a)}}return{start:e,end:t}}(0,n,this.__views__),a=i.start,l=i.end,s=l-a,d=r?l:a-1,c=this.__iteratees__,u=c.length,f=0,h=yo(s,this.__takeCount__);if(!o||!r&&n==s&&h==s)return mn(e,this.__actions__);var m=[];e:for(;s--&&f<h;){for(var p=-1,g=e[d+=t];++p<u;){var v=c[p],y=v.iteratee,w=v.type,b=y(g);if(2==w)g=b;else if(!b){if(1==w)continue e;break e}}m[f++]=g}return m},Do.prototype.at=ha,Do.prototype.chain=function(){return ua(this)},Do.prototype.commit=function(){return new qo(this.value(),this.__chain__)},Do.prototype.next=function(){this.__values__===e&&(this.__values__=ul(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},Do.prototype.plant=function(t){for(var o,r=this;r instanceof zo;){var n=ji(r);n.__index__=0,n.__values__=e,o?i.__wrapped__=n:o=n;var i=n;r=r.__wrapped__}return i.__wrapped__=t,o},Do.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Vo){var o=t;return this.__actions__.length&&(o=new Vo(this)),(o=o.reverse()).__actions__.push({func:fa,args:[Xi],thisArg:e}),new qo(o,this.__chain__)}return this.thru(Xi)},Do.prototype.toJSON=Do.prototype.valueOf=Do.prototype.value=function(){return mn(this.__wrapped__,this.__actions__)},Do.prototype.first=Do.prototype.head,nt&&(Do.prototype[nt]=function(){return this}),Do}();ut?((ut.exports=fo)._=fo,ct._=fo):dt._=fo}.call(An.exports)),An.exports);const xn=e=>null===e.parentId||"null"===e.parentId||!e.parentId,Pn=async(e,t,o)=>{var r;if("file"===(null==t?void 0:t.itemType))return e;let n=[];if(!o)return e;{const e=await o({parentId:t.folderId});n=Array.isArray(e)?e:[]}let i=((e,t)=>{const o=Array.isArray(e)?e:[];return(r=t.folderId)&&"root"!==r&&"folders"!==r&&"null"!==r&&null!==r?o.filter(e=>e.parentId===t.folderId):o.filter(xn);var r})(n,t);if(null===(r=null==t?void 0:t.search)||void 0===r?void 0:r.trim()){const e=t.search.trim().toLowerCase();i=i.filter(t=>{var o;return null===(o=t.name)||void 0===o?void 0:o.toLowerCase().includes(e)})}if(0===i.length)return e;const a=i.map(e=>({id:e.id,name:e.name,size:void 0,date:"-",isFolder:!0,folderId:e.parentId||"",type:"",selected:!1,extension:"",childCount:e.childCount}));if("folder"===(null==t?void 0:t.itemType))return a;const l=e.filter(e=>!e.isFolder);return[...a,...l]},Rn=e=>{var t,o,r,n;const{state:i,actions:l,options:s}=pn(),{searchTerm:u,sortBy:f,sortOrder:h,selectedFolder:m,pagination:p,pathHistory:g}=i,{setSearchTerm:v,setSortBy:y,setSortOrder:w,setPagination:b}=l,C=e||l.fetchFiles,I=c(null),F=c(En.debounce(e=>{const t=JSON.stringify(e);I.current!==t&&(I.current=t,null==C||C(e))},150)).current,A=d(()=>{const e=m||"";if(!e)return;const t=[...Array.isArray(g)?g:[]].reverse().find(t=>t.id===e);return null==t?void 0:t.name},[m,g]),_=d(()=>{var e;const t=null===(e=null==s?void 0:s.config)||void 0===e?void 0:e.disablePagination;return{folderId:m||"",folderName:A(),search:(null==u?void 0:u.trim())||void 0,page:t?void 0:p.current,limit:t?void 0:p.pageSize,sortBy:f,sortOrder:h,itemType:"all"}},[m,A,u,p.current,p.pageSize,f,h,null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.disablePagination]),S=d(e=>{var t,o;if(v&&v(e),b&&b({current:1,pageSize:p.pageSize,total:0}),C){const r={folderId:m||"",folderName:A(),search:(null==e?void 0:e.trim())||void 0,page:(null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.disablePagination)?void 0:1,limit:(null===(o=null==s?void 0:s.config)||void 0===o?void 0:o.disablePagination)?void 0:p.pageSize,sortBy:f,sortOrder:h,itemType:"all"};C(r)}else console.error("🔎 useSortAndFilter: fetchFiles НЕ ОПРЕДЕЛЕНА!")},[v,b,p.pageSize,C,m,A,f,h,null===(o=null==s?void 0:s.config)||void 0===o?void 0:o.disablePagination]),E=d((e,t)=>{var o,r;null==y||y(e),null==w||w(t),C&&F({folderId:m||"",folderName:A(),search:(null==u?void 0:u.trim())||void 0,page:(null===(o=null==s?void 0:s.config)||void 0===o?void 0:o.disablePagination)?void 0:p.current,limit:(null===(r=null==s?void 0:s.config)||void 0===r?void 0:r.disablePagination)?void 0:p.pageSize,sortBy:e,sortOrder:t,itemType:"all"})},[y,w,F,m,A,u,p.current,p.pageSize,null===(r=null==s?void 0:s.config)||void 0===r?void 0:r.disablePagination]),x=d((e,t)=>{var o;(null===(o=null==s?void 0:s.config)||void 0===o?void 0:o.disablePagination)||(b&&b({current:e,pageSize:t||p.pageSize,total:p.total}),C&&F({folderId:m||"",folderName:A(),search:(null==u?void 0:u.trim())||void 0,page:e,limit:t||p.pageSize,sortBy:f,sortOrder:h,itemType:"all"}))},[b,p.pageSize,p.total,F,m,A,u,f,h,null===(n=null==s?void 0:s.config)||void 0===n?void 0:n.disablePagination]);return a(()=>{if(C){const e=_();F(Object.assign(Object.assign({},e),{page:1}))}},[m]),a(()=>{C&&F(_())},[]),a(()=>()=>{var e;null===(e=F.cancel)||void 0===e||e.call(F)},[F]),{state:{searchTerm:u||"",sortBy:f||"name",sortOrder:h||"asc"},actions:{setSearchTerm:v||(()=>{}),setSortBy:y||(()=>{}),setSortOrder:w||(()=>{}),handleSearch:S,handleSort:E,handlePaginationChange:x,getCurrentQueryParams:_}}};function kn(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o}"function"==typeof SuppressedError&&SuppressedError;const Nn=new Map;function On(e){const t="id"in e&&void 0!==e.id?String(e.id):"unknown",o="data"in e?e.data:void 0;return`${e.type}:${t}:${function(e){if(null==e)return"";try{return JSON.stringify(e,Object.keys(e).sort())}catch(t){return String(e)}}(o)}`}const Tn=()=>{var e,t;const{notification:o}=C.useApp(),r=pn(),{options:n}=r,i=d(async e=>{let t;if(n.handleNotify){try{t=await n.handleNotify(e)}catch(e){console.error(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("error"===e.type&&n.handleError){try{t=await n.handleError(e)}catch(e){console.error(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("success"===e.type&&n.handleSuccess){try{t=await n.handleSuccess(e)}catch(e){console.error(e)}if(t)return!1}return t},[n]),a=d(async function(e,t=!1){var r,a,l,s,d;try{void 0===e.visibility&&(e.visibility=!t);const c=await i(e);"object"==typeof c&&(e=c);const u=null!==(a=null===(r=n.config)||void 0===r?void 0:r.notificationDedupeTtlMs)&&void 0!==a?a:12e3,f="error"===e.type&&!0===e.notificationDedupe;f&&function(e,t){if(t<=0)return;const o=On(e),r=Date.now(),n=Nn.get(o);void 0!==n&&r-n<t&&(e.visibility=!1)}(e,u);if(!(!1!==e.visibility&&!1!==c&&!1!==(null===(l=n.config)||void 0===l?void 0:l.showNotifications)))return e;const h=o[e.type];if("function"==typeof h){const t=e,{message:o,btn:r}=t,n=kn(t,["message","btn"]);h(Object.assign(Object.assign(Object.assign({},n),{title:null!==(s=n.title)&&void 0!==s?s:o}),void 0!==r?{actions:r}:{})),f&&(d=e,u<=0||Nn.set(On(d),Date.now()))}else console.warn(`Unknown notification type: ${e.type}`,e)}catch(e){console.error(e)}return e},[o,i,null===(e=n.config)||void 0===e?void 0:e.notificationDedupeTtlMs,null===(t=n.config)||void 0===t?void 0:t.showNotifications]);return u(()=>({error:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"error"}),t),success:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"success"}),t),warning:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"warning"}),t),notify:a}),[a])},Ln=()=>C.useApp().message,Mn={FileNotFound:"File not found or no longer available.",FileAlreadyExists:"File with this name already exists.",FileInvalidName:"File name is not valid. Allowed characters: {{allowedChars}}",FileAccessDenied:"You don't have permission to access this file.",FileReadError:"Failed to read the file.",FileWriteError:"Failed to write the file.",FileTooLarge:"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.",FileTypeNotAllowed:"This file type is not allowed.",FileCorrupted:"The file appears to be corrupted.",FileChecksumMismatch:"File integrity check failed.",FileStorageQuotaExceeded:"Storage quota exceeded. Please free up space.",FileLocked:"File is locked by another process or user.",FileVersionConflict:"File version conflict. Please refresh and try again.",FolderNotFound:"Folder not found or no longer available.",FolderAlreadyExists:"Folder with this name already exists.",FolderInvalidName:"Folder name is not valid. Allowed characters: {{allowedChars}}",FolderAccessDenied:"You don't have permission to access this folder.",FolderReadError:"Failed to read the folder contents.",FolderWriteError:"Failed to write to the folder.",FolderQuotaExceeded:"Folder storage quota exceeded.",FolderNotEmpty:"Folder is not empty.",FolderBackendError:"Server error while processing the folder.",FolderTimeout:"Folder operation took too long.",RenameNotAllowed:"Renaming is not allowed for this item.",MoveNotAllowed:"Moving is not allowed for this item.",CopyNotAllowed:"Copying is not allowed for this item.",DeleteNotAllowed:"Deleting is not allowed for this item.",MoveIntoSelf:"Cannot move an item into itself.",MoveIntoDescendant:"Cannot move an item into its descendant folder.",CopyIntoSelf:"Cannot copy an item into itself.",UnsupportedOperation:"This operation is not supported.",ConfigError:"Configuration error occurred.",FileUploadQuotaExceeded:"You have exceeded the upload quota.",FileUploadNetworkError:"Network error while uploading the file.",FileUploadTimeout:"File upload took too long.",FileUploadBackendError:"Server error while uploading the file.",UploadUrlInvalid:"The specified URL is not valid.",UploadUrlNotReachable:"The specified URL is not reachable.",UploadUrlContentTypeNotAllowed:"Content type at the URL is not allowed.",UploadUrlDownloadFailed:"Failed to download file from the URL.",FileLookupFailed:"Failed to find existing file by URL.",FileProxyFailed:"Failed to load file through proxy.",FileProxyNotConfigured:"File proxy is not configured.",FileDownloadNetworkError:"Network error while downloading the file.",FileDownloadTimeout:"File download took too long.",FileDownloadBackendError:"Server error while downloading the file.",BatchPartialFailure:"Some items could not be processed.",BatchAllFailed:"Failed to process all items in the batch.",BatchConflict:"Some items in the batch are in a conflicting state.",BatchValidationFailed:"Some items in the batch did not pass validation.",BatchItemLimitExceeded:"Batch operation exceeds the maximum number of items allowed.",ValidationError:"Some of the provided data is invalid.",PayloadTooLarge:"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.",UnsupportedMediaType:"This media type is not supported.",NetworkError:"Network error. Please check your connection and try again.",BackendError:"Server error. Please try again later.",Timeout:"The operation took too long. Please try again.",AuthenticationFailed:"Authentication failed. Please sign in again.",AuthorizationFailed:"You are not allowed to perform this action.",RateLimitExceeded:"Too many requests. Please try again a bit later.",ServiceUnavailable:"Service is temporarily unavailable. Please try again later.",AIResponseInvalid:"AI service returned an invalid response.",AIImageGenerationFailed:"Failed to generate image using AI.",AIImageGenerationLimitExceeded:"You have reached the AI image generation limit.",IntegrationError:"Error in external integration.",ThirdPartyError:"Error in a third-party service.",UnknownError:"An unknown error occurred."},Un={FileTooLarge:"File is too large to upload.",PayloadTooLarge:"File is too large to upload."},jn=(e,t,o)=>{var r,n,i;if(!e)return;const a=Mn[e];if(!a)return;const l=null!==(r=null==o?void 0:o.fileSize)&&void 0!==r?r:"",s=null!==(n=null==o?void 0:o.maxSize)&&void 0!==n?n:"";if(("FileTooLarge"===e||"PayloadTooLarge"===e)&&!(!!l&&!!s)){const o=Un[e];return o?t(o):t(a,{fileSize:"?",maxSize:"?"})}return t(a,{allowedChars:null!==(i=null==o?void 0:o.allowedChars)&&void 0!==i?i:"a-z A-Z 0-9 . _ -",fileSize:l,maxSize:s})},Dn=e=>{if(!e||"string"!=typeof e)return;const t=e.toLowerCase();return(t.includes("maximum number of files")||t.includes("number of files exceeded"))&&(t.includes("allowed")||t.includes("received"))?"BatchItemLimitExceeded":t.includes("exceeds")||t.includes("maximum")||t.includes("too large")||t.includes("size limit")||t.includes("object size")||t.includes("размер")||t.includes("превышен")?"PayloadTooLarge":t.includes("403")||t.includes("forbidden")||t.includes("access denied")||t.includes("доступ запрещён")?"AuthorizationFailed":t.includes("404")||t.includes("not found")||t.includes("не найден")?"UploadUrlNotReachable":t.includes("already exists")||t.includes("уже существует")||t.includes("дубликат")?"FileAlreadyExists":t.includes("invalid")&&(t.includes("name")||t.includes("имя")||t.includes("назва"))?"FileInvalidName":t.includes("type")&&(t.includes("not allowed")||t.includes("не поддерживается"))?"FileTypeNotAllowed":void 0},Bn=e=>{var t,o,r,n,i,a,l,s,d,c,u,f,h,m,p,g,v,y;if(!e)return{message:"Unknown error",raw:e};if("string"==typeof e)return{message:e};if(e instanceof Error){const i=e;return{message:null!==(t=i.message)&&void 0!==t?t:e.message,code:i.code,status:null!==(o=i.status)&&void 0!==o?o:i.httpStatus,stack:null!==(r=i.stack)&&void 0!==r?r:e.stack,raw:null!==(n=i.raw)&&void 0!==n?n:e}}if("object"==typeof e){const t=e,o=null!==(i=t.data)&&void 0!==i?i:t,r=null!==(a=null==o?void 0:o.data)&&void 0!==a?a:o,n=null!==(d=null!==(s=null!==(l=t.message)&&void 0!==l?l:null==o?void 0:o.message)&&void 0!==s?s:t.error)&&void 0!==d?d:t.reason,w=null!==(f=null!==(u=null!==(c=t.status)&&void 0!==c?c:t.httpStatus)&&void 0!==u?u:null==r?void 0:r.status)&&void 0!==f?f:null==o?void 0:o.status,b=null!==(h=t.code)&&void 0!==h?h:null==o?void 0:o.code,C=t.stack,I=null!==(m=t.raw)&&void 0!==m?m:e,F=null!==(g=null!==(p=t.fileSize)&&void 0!==p?p:null==r?void 0:r.fileSize)&&void 0!==g?g:null==o?void 0:o.fileSize,A=null!==(y=null!==(v=t.maxSize)&&void 0!==v?v:null==r?void 0:r.maxSize)&&void 0!==y?y:null==o?void 0:o.maxSize;if(n||b||w||C||I)return Object.assign(Object.assign({message:n,code:b,status:w,stack:C,raw:I},null!=F&&{fileSize:F}),null!=A&&{maxSize:A})}return{message:String(e),raw:e}};const zn=(e,t,o)=>{const r=Bn(e),n=null==r?void 0:r.code;if("FileTooLarge"===n&&null!=(null==o?void 0:o.fileSize)&&null!=(null==o?void 0:o.maxSize))return t("File too large ({{size}}). Maximum allowed size: {{maxSize}}",{size:kr(o.fileSize),maxSize:kr(o.maxSize)});if(("BatchItemLimitExceeded"===n||"exceeded_max_files"===n)&&(null==r?void 0:r.message)){const{allowed:e,received:o}=function(e){const t=e.match(/Allowed:\s*(\d+)/i),o=e.match(/received:\s*(\d+)/i);return{allowed:t?parseInt(t[1],10):void 0,received:o?parseInt(o[1],10):void 0}}(r.message);if(null!=e&&null!=o)return t("Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}",{allowed:e,received:o})}if((null==r?void 0:r.message)&&"Unknown error"!==r.message)return r.message;const i=null!=(null==o?void 0:o.fileSize)&&null!=(null==o?void 0:o.maxSize)?{fileSize:kr(o.fileSize),maxSize:kr(o.maxSize)}:void 0,a=jn(n,t,i);return null!=a?a:t("Error uploading file")},qn=e=>{const t=Bn(e);return"path_folder_not_found"===(null==t?void 0:t.code)},Vn=["file_get_contents","open stream","failed to open stream","http request failed","curl_error"];const Wn=(e,t,o)=>{var r;if(!e)return t("Error when downloading a file by URL");const n=null!==(r=(e=>{const t=Dn(e);if("AuthorizationFailed"===t){const t=(e||"").toLowerCase();if(t.includes("download")||t.includes("url")||t.includes("file_get_contents")||t.includes("failed to download"))return"UploadUrlNotReachable"}return t})(null==e?void 0:e.message))&&void 0!==r?r:null==e?void 0:e.code,i=jn(n,t,o);if(i)return i;const a=(null==e?void 0:e.message)&&"string"==typeof e.message?e.message.trim():null;return a&&function(e){if(!e||e.length>200)return!1;const t=e.toLowerCase();return!Vn.some(e=>t.includes(e))}(a)?a:t("Failed to download file from the URL.")},Hn=e=>Array.isArray(e)?e.filter(e=>(null==e?void 0:e.id)&&"folders"!==e.id).map(e=>e.name).filter(Boolean).join("/"):"",$n=e=>{const t=e.trim();if(!t)return"";const o=t.toLowerCase(),r=[o.indexOf(" and "),o.indexOf(" or "),t.indexOf(","),t.indexOf(";"),o.indexOf(". ")].filter(e=>e>=0);if(0===r.length)return t;const n=Math.min(...r);return t.slice(0,n).trim()||t},Gn=(e,t)=>{const o=(e=>{var t,o,r,n;if(e&&"object"==typeof e){const i=e,a=null!==(r=null===(o=null===(t=i.data)||void 0===t?void 0:t.data)||void 0===o?void 0:o.path_folder)&&void 0!==r?r:null===(n=i.data)||void 0===n?void 0:n.path_folder;if("string"==typeof a&&a.trim())return $n(a)||null}const i=Bn(e),a=null==i?void 0:i.message;if(!a)return null;const l=a.toLowerCase(),s=["не существует:","not exists:","not exist:","not found:"];for(const e of s){const t=l.indexOf(e);if(t>=0){const o=a.slice(t+e.length).trim();return $n(o)||null}}const d=["not exists ","not exist ","not found "];for(const e of d){const t=l.indexOf(e);if(t>=0){const o=a.slice(t+e.length).trim();return $n(o)||null}}return null})(e);return o?(e=>{const t=e.split("/").filter(Boolean);return t.length<=1?"":(t.pop(),t.join("/"))})(o):Hn(t)},Kn=async e=>{var t;const{options:o,pathFolder:r,dataProviders:n}=e;if(null==n?void 0:n.clearCache)return void await n.clearCache(r||null);const i=null===(t=null==o?void 0:o.apiEndpoints)||void 0===t?void 0:t.clearCache;if(!i)return;const a=i.includes("?");let l=i;r&&r.length>0&&(l=`${i}${a?"&":"?"}path_folder=${encodeURIComponent(r)}`);const s=await fetch(l,{method:"POST"});if(!s.ok)throw new Error(`Cache clear failed: ${s.status}`)};const Qn=()=>{var e,t;const{state:o,actions:n,options:i}=pn(),{t:a}=dr(),l=Tn(),{folders:s,selectedFolder:c,pathHistory:u,form:f,loading:h,isModalVisible:m}=o,{setFolders:p,setLoading:g,setIsModalVisible:v}=n,{dataProviders:y,config:w}=i,b=d(e=>(Array.isArray(e)?e:[]).filter(e=>e&&e.id&&e.name).map(e=>({id:e.id,name:e.name,parentId:e.folderId?e.folderId:null})),[]),C=d(async(e=!1)=>{null==g||g(!0);try{let e=[];const t="lazy"===(null==w?void 0:w.folderTreeLoading);if(!(null==y?void 0:y.getFolders)){if(null==y?void 0:y.getFiles){const e=async o=>{const{files:r}=await y.getFiles({itemType:"folder",folderId:null!=o?o:void 0}),n=b(r);if(t)return n;const i=await Promise.all(n.map(t=>e(t.id)));return[...n,...i.flat()]},o=await e(null);return void(p&&p(e=>{const r=Array.isArray(e)?e:[];if(!t){const e=o,t=e.filter(e=>e.id===e.parentId);return t.length>0&&console.warn("Folders with cyclic dependencies detected:",t),e}const n=function(e,t){const o=new Set(t.map(e=>e.id));return[...e.filter(e=>e.parentId&&!o.has(e.id)),...t]}(r,o),i=n.filter(e=>e.id===e.parentId);return i.length>0&&console.warn("Folders with cyclic dependencies detected:",i),n}))}return void console.error("DataProvider for folders is not defined")}{const o=!t;e=await y.getFolders({parentId:null,deep:o})}const o=Array.isArray(e)?e:[];null==p||p(o);const r=o.filter(e=>e.id===e.parentId);r.length>0&&console.warn("Folders with cyclic dependencies detected:",r)}catch(t){console.error("Error loading folders:",t);const o=Bn(t);if(!e&&(404===(null==o?void 0:o.status)||"FileNotFound"===(null==o?void 0:o.code))){const e=Gn(t,u||[]);try{return await Kn({options:i,pathFolder:e,dataProviders:null==i?void 0:i.dataProviders}),void await C(!0)}catch(e){console.error("Cache clear failed:",e)}}const r=jn(null==o?void 0:o.code,a);l.error({id:"FOLDERS_FETCH_FAILED",message:null!=r?r:a("Failed to load folders"),description:a("Folders"),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{reason:t instanceof Error?t.message:String(t),folderId:null,folderName:a("Folders")}})}finally{null==g||g(!1)}},[null==y?void 0:y.getFiles,null==y?void 0:y.getFolders,p,g,null==w?void 0:w.folderTreeLoading,b,l,a,u,i]),I=d(()=>C(),[C]),F=d(async e=>{try{let t,o;if(null==y?void 0:y.getFolders){t=await y.getFolders({parentId:e,deep:!1});const r=Array.isArray(s)?s:[],n=new Set(t.map(e=>e.id)),i=r.filter(t=>t.parentId!==e||n.has(t.id));o=[...i,...t.filter(e=>!i.some(t=>t.id===e.id))]}else{if(!(null==y?void 0:y.getFiles))return[];{const{files:r}=await y.getFiles({itemType:"folder",folderId:null!=e?e:void 0});t=b(r);const n=Array.isArray(s)?s:[],i=new Set(t.map(e=>e.id)),a=n.filter(t=>t.parentId!==e||i.has(t.id));o=[...a,...t.filter(e=>!a.some(t=>t.id===e.id))]}}let r=o,n=0;for(;n!==r.length;){n=r.length;const e=new Set(r.map(e=>e.id));r=r.filter(t=>!t.parentId||e.has(t.parentId))}return null==p||p(r),t}catch(e){return console.error("Error loading child folders:",e),[]}},[y,s,p,b]),A=d(()=>{var e;const t=null!==(e=null==w?void 0:w.defaultFolderName)&&void 0!==e?e:a("New folder");f.setFieldsValue({folderName:t}),null==v||v(!0)},[f,v,a,null==w?void 0:w.defaultFolderName]),_=d(async(e,t)=>{const o=[...(Array.isArray(s)?s:[]).filter(t=>t.id!==e.id),e];if(null==p||p(o),e.parentId&&(await F(e.parentId),await new Promise(e=>setTimeout(e,50))),!(null==t?void 0:t.preserveSelection)&&n.setSelectedFolder&&n.setSelectedFolder(e.id),!(null==t?void 0:t.preserveSelection)&&n.setPathHistory){const t=Array.isArray(o)?o:[],r=(e,o=new Set)=>{if(o.has(e))return console.warn(`Cycle detected in the path to the folder with id=${e}`),[];const n=t.find(t=>t.id===e);if(!n)return[];const i=new Set(o);return i.add(e),n.parentId?[...r(n.parentId,i),{id:n.id,name:n.name}]:[{id:n.id,name:n.name}]},i=r(e.id),l=[{id:"folders",name:a("Folders")},...i];n.setPathHistory(l)}},[s,p,n,o.pathHistory,F,a]),S=d(async e=>{try{if(null==y?void 0:y.getFolders){const t=await y.getFolders(),o=Array.isArray(t)?t:[];return o.some(t=>t.id===e)}if(null==y?void 0:y.getFiles){const t=new Set,o=async r=>{const{files:n}=await y.getFiles({itemType:"folder",folderId:null!=r?r:void 0}),i=b(n);for(const r of i){if(t.has(r.id))continue;if(t.add(r.id),r.id===e)return!0;if(await o(r.id))return!0}return!1};return await o(null)}}catch(e){console.warn("⚠️ Error checking the folder:",e)}return!1},[null==y?void 0:y.getFolders,null==y?void 0:y.getFiles,b]),E=d(async e=>{var t;let o,r,n=null;try{const i=await(e?e.validateFields():f.validateFields());if(o=i.folderName.trim(),!o){const e=i.targetFolder||(c&&"folders"!==c?c:null);return void l.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:a("Folder name cannot be empty"),placement:"bottomRight",data:{folderName:o,folderId:null!=e?e:null,reason:"emptyName",is_force_create:!!i.is_force_create}})}r=Zt(o,w);const d=i.targetFolder;if(d)n="folders"!==d?d:null;else if(c&&"folders"!==c)n=c;else if(Array.isArray(u)&&u.length>1){const e=u[u.length-1];n=(null==e?void 0:e.id)&&"folders"!==e.id?e.id:null}if(Xt(w)&&(null==y?void 0:y.getFolders))try{const e=(await y.getFolders({parentId:n,deep:!1})||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean);if(e.includes(o.trim().toLowerCase()))return void l.error({id:"FOLDER_ALREADY_EXISTS",message:a("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:o,folderId:n}})}catch(e){}let h;if(!(null==y?void 0:y.createFolder))return void l.error({id:"FOLDER_CREATE_PROVIDER_NOT_CONFIGURED",message:a("Folder creation provider is not configured"),placement:"bottomRight",data:{folderName:r,folderId:null!=n?n:null,is_force_create:!!i.is_force_create}});h=await y.createFolder({name:r,parentId:n,is_force_create:!!i.is_force_create}),(e=>{if(!e||!e.id)throw new Error(a("Invalid server response: folder ID is missing"));if(e.id===e.parentId&&e.parentId)throw console.error("Circular dependency detected: folder cannot be its own parent"),new Error(a("Error: folder cannot be its own parent"))})(h);const m={id:h.id,name:h.name,parentId:null!=n?n:null,childCount:h.childCount},g=[...(Array.isArray(s)?s:[]).filter(e=>e.id!==m.id),m];if(null==p||p(g),l.success({id:"FOLDER_CREATE_SUCCESS",message:a("Folder created"),placement:"bottomRight",data:{itemIds:[m.id],folderId:null!==(t=m.parentId)&&void 0!==t?t:null,folderName:m.name}}),e||null==v||v(!1),(async()=>{try{await _(m,{preserveSelection:Boolean(e)}),await I(),await new Promise(e=>setTimeout(e,200));await S(h.id)||console.warn("⚠️ Could not confirm the creation of the folder on the server, but continuing...")}catch(e){console.error("Error performing background operations after creating the folder:",e)}})(),e)return h}catch(e){console.error("❌ Error creating the folder:",e);const t=Bn(e),i=jn(null==t?void 0:t.code,a);l.error({id:"FOLDER_CREATE_FAILED",message:null!=i?i:a("Failed to create folder"),placement:"bottomRight",innerException:e,data:{folderName:r||o,folderId:null!=n?n:null,reason:e instanceof Error?e.message:String(e)}})}},[f,c,y,_,I,S,v,l,a,s,p,w,u]),x=d(()=>{null==v||v(!1)},[v]),P=d((e,t=new Set)=>{const o=Array.isArray(s)?s:[];return e.map(e=>{if(t.has(e.id))return console.warn(`Cycle detected in the folder structure with id=${e.id}. Skipping child elements processing.`),{key:e.id,label:e.name+" "+a("(error)"),icon:r.createElement(se,{style:{color:"red"}})};const n=new Set(t);n.add(e.id);const i=o.filter(t=>t.parentId===e.id&&t.id!==e.id);return{key:e.id,label:e.name,children:i.length>0?P(i,n):void 0}})},[s]),R=d(()=>{const e=Array.isArray(s)?s:[],t={key:"folders",label:a("Folders"),children:[]},o=e.filter(e=>null===e.parentId||!e.parentId);return t.children=P(o),[t]},[s,a,P]),k=d(async(e,t)=>{var o,r,d,c;let u;try{const f=t.trim(),h=null==s?void 0:s.find(t=>t.id===e);if(!f)return void l.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:a("Folder name cannot be empty"),placement:"bottomRight",data:{folderId:e,folderName:t,reason:"emptyName"}});u=Zt(f,w);if(!(!1!==(null===(o=null==w?void 0:w.features)||void 0===o?void 0:o.enableRenameFolder)))return void l.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:a("Folder rename is disabled by config"),placement:"bottomRight",data:{itemId:e,itemName:null!==(r=null==h?void 0:h.name)&&void 0!==r?r:u}});if(!(null===(d=i.dataProviders)||void 0===d?void 0:d.renameFolder))return void l.error({id:"FOLDER_RENAME_FAILED",message:a("Folder rename provider is not configured"),placement:"bottomRight",data:{itemId:e,itemName:u,error:{message:"providerNotConfigured"}}});const m=await i.dataProviders.renameFolder(e,u);if(!(null==m?void 0:m.id))return void l.error({id:"FOLDER_RENAME_FAILED",message:a("Unexpected response when renaming folder"),placement:"bottomRight",data:{itemId:e,itemName:u,error:{message:"invalidResponse"}}});await I(),e!==m.id&&n.setSelectedFolder&&n.setSelectedFolder(m.id),l.success({id:"FOLDER_RENAME_SUCCESS",message:a("Folder renamed"),placement:"bottomRight",data:{itemId:m.id,itemName:m.name,folderId:null!==(c=m.parentId)&&void 0!==c?c:null}})}catch(o){console.error("Error renaming the folder:",o),l.error({id:"FOLDER_RENAME_FAILED",message:a("Failed to rename folder"),placement:"bottomRight",innerException:o,data:{itemId:e,itemName:u||t,error:{message:o instanceof Error?o.message:String(o)}}})}},[I,s,null===(e=i.dataProviders)||void 0===e?void 0:e.renameFolder,null===(t=null==w?void 0:w.features)||void 0===t?void 0:t.enableRenameFolder,w,n.setSelectedFolder,l,a]);return{state:{folders:s,isCreatingFolder:m,loading:h},actions:{fetchFolders:I,fetchChildFolders:F,handleCreateFolder:A,handleModalOk:E,handleModalCancel:x,generateMenuItems:R,renameFolder:k}}},Jn=()=>{const{options:e,actions:t}=pn(),{dataProviders:o,config:r}=e,{setUndoDeletion:n}=t,{t:i}=dr(),a=Tn(),l=d(async({items:e,selectedFolder:t,getItemNameById:l,showNotifications:s=!1})=>{let d=0,c=0;const u=[],f=async t=>{if(null==o?void 0:o.deleteItems)try{const r=await o.deleteItems(e.map(e=>e.id),{permanent:t}),n=r.detailed;if(n){const e=n.filter(e=>e.success),t=n.filter(e=>!e.success),o=t.filter(e=>{var t;const o=null!==(t=e.innerException)&&void 0!==t?t:e.error;return qn(o)}),r=t.filter(e=>{var t;const o=null!==(t=e.innerException)&&void 0!==t?t:e.error;return!qn(o)});return d+=e.length+o.length,c+=r.length,void r.forEach(e=>{var t;const o=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),r=null!==(t=e.innerException)&&void 0!==t?t:e.error,n=Bn(r);u.push({itemId:o,itemName:l(o),error:n})})}if(r.success)d+=e.length;else{const t=r.error;if(qn(t))d+=e.length;else if(t){c+=e.length;const o=Bn(t);u.push({error:o})}else c+=e.length}return}catch(o){if(qn(o))d+=e.length;else{const r=t?"Ошибка при удалении":"Ошибка при перемещении в корзину";console.error(r,o),c+=e.length;const n=Bn(o);u.push({error:n})}}const r=t?"DataProvider для удаления файлов не настроен":"DataProvider для перемещения не настроен";console.warn(r)},h=(null==r?void 0:r.enableTrashFolder)&&"Trash"===t;return(null==r?void 0:r.enableTrashFolder)&&!h?await f(!1):await f(!0),d>0&&(null==r?void 0:r.enableTrashFolder)&&!h&&(null==n||n({itemIds:e.map(e=>e.id),sourceFolderId:t||"folders"})),s&&(d>0&&a.success({id:"FILES_DELETE_SUCCESS",message:i("Files deleted"),placement:"bottomRight",data:{successCount:d,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:t||null}}),c>0&&a.error({id:"FILES_DELETE_ERROR",message:i("Error when deleting a file"),placement:"bottomRight",data:{failCount:c,totalCount:e.length,itemIds:e.map(e=>e.id),itemNames:e.map(e=>l(e.id)),folderId:t||null,errors:u}})),{successCount:d,failCount:c,errorDetails:u}},[o,r,n,i,a]);return{deleteItems:l}};class Yn extends Error{constructor(e,t,o,r){super(e),this.code=t,this.status=o,this.details=r,this.name="FileManagerApiError",Error.captureStackTrace&&Error.captureStackTrace(this,Yn)}}const Zn=/^(localhost|127\.0\.0\.1|0\.0\.0\.0|::1)$/i,Xn=/^(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.)/;function ei(e,t){const o=e.trim();if(!o)throw new Yn(t("Enter the URL of the image"),"UploadUrlInvalid");if(o.length>8192)throw new Yn(t("URL too long"),"UploadUrlInvalid");let r;try{r=new URL(o)}catch(e){throw new Yn(t("The specified URL is not valid."),"UploadUrlInvalid")}const n=r.protocol.toLowerCase();if("http:"!==n&&"https:"!==n)throw new Yn(t("Only http and https URLs are supported"),"UploadUrlInvalid");const i=r.hostname.toLowerCase();if(Zn.test(i)&&("undefined"==typeof window||!Zn.test(window.location.hostname.toLowerCase())))throw new Yn(t("Private and local URLs are not allowed"),"UploadUrlInvalid");if(Xn.test(i))throw new Yn(t("Private and local URLs are not allowed"),"UploadUrlInvalid")}function ti(e,t){var o;if(null==e?void 0:e.extension){const t=e.extension.toLowerCase(),o={jpg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},jpeg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},png:{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},gif:{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},webp:{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},svg:{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(o[t])return o[t]}if(null==e?void 0:e.type){const t=kt(e.type),o={"image/jpeg":{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},"image/png":{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},"image/gif":{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},"image/webp":{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},"image/svg+xml":{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(o[t])return o[t]}if(null==e?void 0:e.name){const t=null===(o=e.name.split(".").pop())||void 0===o?void 0:o.toLowerCase();if(t){const e={jpg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},jpeg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},png:{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},gif:{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},webp:{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},svg:{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(e[t])return e[t]}}if(t){const e=kt(t),o=Tt(e);let r="jpeg";return"png"===o?r="png":"svg"===o?r="svg":"jpeg"===o&&(r="jpeg"),{extension:o,mimeType:e,format:o,pixieFormat:r}}return{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"}}const oi={MAX_SIZE_MB:.48,MAX_WIDTH_OR_HEIGHT:2e3,QUALITY:.8},ri=["gif","svg"];function ni(e,t){var o;if(0===(null==e?void 0:e.compressMaxSize)||0===(null==e?void 0:e.compressMaxWidthOrHeight))return!1;const r=null!==(o=null==t?void 0:t.trim())&&void 0!==o?o:"";return r.startsWith("image/")&&"image/gif"!==r}function ii(e,t){const{colorHex:o,colorHex2:r,colorHex3:n}=t,i=[`--icon-grad-1: ${o}`,`--icon-grad-2: ${r}`,`--icon-stroke-1: ${o}`,`--icon-stroke-2: ${r}`,`--icon-stroke-3: ${n}`,`--icon-fill-1: ${o}`,`--icon-fill-2: ${r}`,`--icon-fill-3: ${n}`,`color: ${o}`].join(";");let a=e.replace(/<svg([^>]*)>/i,(e,t)=>{let o=t;return/style="/i.test(o)?o=o.replace(/style="([^"]*)"/i,(e,t)=>`style="${t};${i}"`):o+=` style="${i}"`,`<svg${o}>`});return a=a.replace(/var\(--icon-color-1\)/g,o).replace(/var\(--icon-color-2\)/g,r).replace(/var\(--icon-color-3\)/g,n).replace(/var\(--icon-fill-1\)/g,o).replace(/var\(--icon-fill-2\)/g,r).replace(/var\(--icon-fill-3\)/g,n).replace(/var\(--icon-stroke-1\)/g,o).replace(/var\(--icon-stroke-2\)/g,r).replace(/var\(--icon-stroke-3\)/g,n).replace(/var\(--icon-grad-1\)/g,o).replace(/var\(--icon-grad-2\)/g,r).replace(/currentColor/g,o),a}function ai(e,t){const o=e.match(/\swidth="([0-9.]+)(px)?"/i),r=e.match(/\sheight="([0-9.]+)(px)?"/i);if(o&&r){const e=parseFloat(o[1]),n=parseFloat(r[1]);if(Number.isFinite(e)&&Number.isFinite(n)&&e>0&&n>0){const o=e/n;return o>=1?{width:t,height:Math.max(1,Math.round(t/o))}:{width:Math.max(1,Math.round(t*o)),height:t}}}const n=e.match(/viewBox="([^"]+)"/i);if(n){const e=n[1].trim().split(/\s+/);if(4===e.length){const o=parseFloat(e[2]),r=parseFloat(e[3]);if(Number.isFinite(o)&&Number.isFinite(r)&&o>0&&r>0){const e=o/r;return e>=1?{width:t,height:Math.max(1,Math.round(t/e))}:{width:Math.max(1,Math.round(t*e)),height:t}}}}return{width:t,height:t}}function li(e){if(!e)return null;const t=e.trim();if(t.endsWith("%"))return null;const o=parseFloat(t.replace(/px$/i,""));return Number.isFinite(o)&&o>0?o:null}function si(e,t=2,o=4096){const{width:r,height:n}=function(e){var t,o,r,n,i;const a=null!==(o=null===(t=e.match(/<\s*svg\b[\s\S]*?>/i))||void 0===t?void 0:t[0])&&void 0!==o?o:"",l=null===(r=a.match(/\bwidth\s*=\s*["']([^"']*)["']/i))||void 0===r?void 0:r[1],s=null===(n=a.match(/\bheight\s*=\s*["']([^"']*)["']/i))||void 0===n?void 0:n[1],d=li(l),c=li(s);if(null!=d&&null!=c)return{width:d,height:c};const u=null===(i=e.match(/viewBox\s*=\s*["']([^"']+)["']/i))||void 0===i?void 0:i[1];if(u){const e=u.trim().split(/[\s,]+/);if(4===e.length){const t=parseFloat(e[2]),o=parseFloat(e[3]);if(Number.isFinite(t)&&Number.isFinite(o)&&t>0&&o>0)return{width:t,height:o}}}return null!=d?{width:d,height:d}:null!=c?{width:c,height:c}:{width:300,height:300}}(e);let i=Math.max(1,Math.round(r*t)),a=Math.max(1,Math.round(n*t));const l=Math.max(64,o),s=Math.max(i,a);if(s>l){const e=l/s;i=Math.max(1,Math.round(i*e)),a=Math.max(1,Math.round(a*e))}return{width:i,height:a}}async function di(e,t,o,r,n){var i;const a=null!==(i=null==n?void 0:n.canvasScale)&&void 0!==i?i:2,l=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),s=URL.createObjectURL(l);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error("Failed to load SVG image")),e.src=s});const r=document.createElement("canvas"),n=Math.max(1,Math.round(t*a)),i=Math.max(1,Math.round(o*a));r.width=n,r.height=i;const l=r.getContext("2d");if(!l)throw new Error("Canvas 2D context is not available");return l.clearRect(0,0,n,i),l.drawImage(e,0,0,n,i),function(e){return new Promise((t,o)=>{e.toBlob(e=>{e?t(e):o(new Error("canvas.toBlob returned null"))},"image/png")})}(r)}finally{URL.revokeObjectURL(s)}}async function ci(e,t,o,r,n){const i=await di(e,t,o,0,n);return a=i,new Promise((e,t)=>{const o=new FileReader;o.onload=()=>e(o.result),o.onerror=()=>{var e;return t(null!==(e=o.error)&&void 0!==e?e:new Error("readAsDataURL failed"))},o.readAsDataURL(a)});var a}function ui(e,t,o,r){return new File([e],t,{type:o,lastModified:r})}function fi(e,t){return t&&t!==e.name?ui(e,t,e.type,e.lastModified):e}async function hi(e,t={}){const{maxSizeMB:o=oi.MAX_SIZE_MB,maxWidthOrHeight:r=oi.MAX_WIDTH_OR_HEIGHT,mimeType:n,fileName:i,libURL:a,enableCompression:l=!0,convertSvgToPng:s=!1}=t;if(!(e&&e instanceof File))return e;let d=e,c=!1;if(s){const t=(d.type||"").toLowerCase(),o=/\.svg$/i.test(d.name.trim()),n=t.includes("svg");let a=!1;if(!n&&!o)try{const e=await async function(e,t=24e3){const o=Math.min(t,Math.max(0,e.size));return e.slice(0,o).text()}(d);a=function(e){const t=e.trimStart().replace(/^\uFEFF/,"");return!!t.startsWith("<")&&/<\s*svg[\s>/]/i.test(t)}(e)}catch(e){a=!1}if(n||o||a)try{d=await async function(e,t={}){var o,r,n;const i=null!==(o=t.pixelScale)&&void 0!==o?o:2,a=null!==(r=t.maxLongEdge)&&void 0!==r?r:4096,l=await e.text(),{width:s,height:d}=si(l,i,a),c=await di(l,s,d,0,{canvasScale:1}),u=null!==(n=t.outputFileName)&&void 0!==n?n:e.name,f=/\.svg$/i.test(u)?u.replace(/\.svg$/i,".png"):`${u}.png`;return new File([c],f,{type:"image/png",lastModified:e.lastModified})}(d,{maxLongEdge:r,outputFileName:null!=i?i:d.name}),c=!0}catch(t){console.warn("prepareImageForUpload: SVG to PNG conversion failed, using original",t),d=e}}if(c)return d;const u=(d.type&&""!==d.type.trim()?d.type:Lt(d.name))||n||"image/jpeg",f=kt(u);if(!f.startsWith("image/"))return fi(d,i);const h="image/webp"===(m=f)?"image/jpeg":m;var m;const p=Tt(f),g=Tt(h),v=h!==f?function(e,t){const o=t.startsWith(".")?t.slice(1):t,r=e.lastIndexOf(".");return r>0?`${e.substring(0,r)}.${o}`:`${e}.${o}`}(null!=i?i:d.name,g):null!=i?i:d.name,y=l&&(w=p,!ri.includes(w));var w;if(!y&&!(h!==f))return fi(d,v);try{const t={libURL:a,useWebWorker:!0,fileType:h};y?(t.maxSizeMB=o,t.maxWidthOrHeight=r):(t.maxSizeMB=Math.max(e.size/1048576+1,1),t.initialQuality=1,t.alwaysKeepResolution=!0);const n=await He(d,t);return function(e,t,o,r){const n=null!=r?r:t.name;return e instanceof File?e.type!==o||e.lastModified!==t.lastModified||e.name!==n?ui(e,n,o,t.lastModified):e:ui(e,n,o,t.lastModified)}(n,d,kt(n.type||h),v)}catch(e){console.error("prepareImageForUpload failed",e);try{return fi(d,v)}catch(e){return console.error("Failed to create File with normalized name after image preparation error",e),d}}}async function mi(e){const{folderId:t,dataProviders:o,folders:r,pathHistory:n,t:i}=e,a=null==t?"":String(t);if(!a||"folders"===a)return i("Folders");if("Trash"===a)return i("Trash");const l=n||[],s=l[l.length-1];if((null==s?void 0:s.id)===a&&s.name)return s.name;const d=[...l].reverse().find(e=>e.id===a);if(null==d?void 0:d.name)return d.name;const c=null==o?void 0:o.getItem;if(c)try{const e=await Promise.resolve(c(a));if(null==e?void 0:e.name)return e.name}catch(e){}const u=null==r?void 0:r.find(e=>e.id===a);return(null==u?void 0:u.name)?u.name:a}const pi=/^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;function gi(e){const t=new URL(e.trim());t.hash="",t.hostname=t.hostname.toLowerCase(),("https:"===t.protocol&&"443"===t.port||"http:"===t.protocol&&"80"===t.port)&&(t.port="");const o=Array.from(t.searchParams.entries()).filter(([e])=>!pi.test(e)).sort(([e,t],[o,r])=>{const n=e.localeCompare(o);return 0!==n?n:t.localeCompare(r)});return t.search="",o.forEach(([e,o])=>t.searchParams.append(e,o)),t.toString()}function vi(e){if(function(e){return"object"==typeof e&&null!==e&&("name"in e&&"DirectResourceFetchError"===e.name?!("final"in e)||!1!==e.final:"final"in e&&!0===e.final)}(e)||e instanceof Yn)throw e}async function yi(e,t,o,r,n){const{fetchWithProxy:i,handleFileProxy:a,handleProxyUrl:l}=t,s=Object.assign({mode:"cors"},null==n?void 0:n.fetchInit);let d;if(a)try{const t=await Promise.resolve(a(e));if(t)return r(t)}catch(e){vi(e),d=e,console.warn("handleFileProxy failed, falling back to next strategy",e)}if(l)try{const t=await Promise.resolve(l(e));if(t&&t!==e){return r(await o(t))}}catch(e){vi(e),d=e,console.warn("handleProxyUrl fetch failed, falling back to next strategy",e)}if(i)try{const t=await Promise.resolve(i(e,s,{intent:"downloadBlob"}));if(!t.ok)throw new Error(`HTTP ${t.status}`);return r(await t.blob())}catch(e){vi(e),d=e,console.warn("fetchWithProxy failed",e)}if(!i)try{return r(await o(e))}catch(e){vi(e),d=e}throw d instanceof Error?d:new Error("Failed to download file from the URL")}async function wi(e,t,o){if(0===e.length)return[];const r=new Array(e.length);let n=0;const i=Math.max(1,Math.min(t,e.length));return await Promise.all(Array.from({length:i},()=>(async()=>{for(;;){const t=n++;if(t>=e.length)return;r[t]=await o(e[t],t)}})())),r}function bi(e,t){if(t===e.name)return e;try{return new File([e],t,{type:e.type,lastModified:e.lastModified})}catch(t){return console.warn("Failed to create normalized File:",t),e}}function Ci(e){return new Promise((t,o)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>{var e;return o(null!==(e=r.error)&&void 0!==e?e:new Error("Failed to read proxied file"))},r.readAsDataURL(e)})}function Ii(e){try{const t=new URL(e).pathname.split("/").pop();return t?decodeURIComponent(t):void 0}catch(e){return}}function Fi(e){return null==e||""===e||"folders"===e?null:e}async function Ai(e){const t=await fetch(e,{mode:"cors"});if(!t.ok)throw new Yn(`HTTP ${t.status}`,"UploadUrlDownloadFailed",t.status);return t.blob()}function _i(e,t){var o,r;if(!(e instanceof Blob)||0===e.size)throw new Yn(t("Failed to download file from the URL."),"UploadUrlDownloadFailed");const n=(null===(r=null===(o=e.type)||void 0===o?void 0:o.split(";")[0])||void 0===r?void 0:r.trim())||"image/png";if(!n.startsWith("image/"))throw new Yn(t("Content type at the URL is not allowed."),"UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:n}}const Si=()=>{var e,t,o,r;const{state:i,actions:a,options:l}=pn(),s=Rn(),{sortBy:c,sortOrder:u}=s.state,{actions:{fetchFolders:f}}=Qn(),{t:h}=dr(),m=Tn(),{deleteItems:p}=Jn(),{selectedFolder:g,urlForm:v,pagination:y,files:w,pathHistory:b,folders:C}=i,I=n.useRef(null),F=n.useRef([]);I.current=y,F.current=Array.isArray(w)?w:[];const A=n.useRef(null),{setFiles:_,setLoading:S,setIsUrlModalVisible:E,setActiveLibraryItem:x,setPagination:P,setSelectedFolder:R,setPathHistory:k}=a,{dataProviders:N}=l,O=d(async e=>{var t,o,r,n,i;if(!(null==N?void 0:N.getFiles))return[];const a=null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.disablePagination,s=a?void 0:null!==(o=null==e?void 0:e.page)&&void 0!==o?o:1,d=a?void 0:null!==(r=null==e?void 0:e.limit)&&void 0!==r?r:20,{files:c,pagination:u}=await N.getFiles({folderId:"folders"!==(null==e?void 0:e.folderId)?null==e?void 0:e.folderId:void 0,noFolder:null==e?void 0:e.noFolder,search:(null===(n=null==e?void 0:e.search)||void 0===n?void 0:n.trim())||void 0,sortBy:null==e?void 0:e.sortBy,sortOrder:null==e?void 0:e.sortOrder,page:s,limit:d,itemType:(null==e?void 0:e.itemType)||"all"});return P&&((null===(i=null==l?void 0:l.config)||void 0===i?void 0:i.disablePagination)?P({current:1,pageSize:c.length||1,total:c.length||0}):u&&P({current:u.page,pageSize:u.limit,total:u.total})),c},[N,null===(e=null==l?void 0:l.config)||void 0===e?void 0:e.disablePagination,P]),T=d(async(e,t,o)=>Lr(N,e,t,o,Xt(null==l?void 0:l.config)),[N,null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient]),L=d(async(e,t=!1)=>{var o,r,n,i,a;try{null==S||S(!0);let t=[];if(!(null==N?void 0:N.getFiles))return void console.error("DataProvider for getting files is not defined");t=await O(e);const o=null!=e?e:{folderId:g||"",itemType:"all"};"file"!==o.itemType&&(t=await Pn(t,o,null==N?void 0:N.getFolders)),"Trash"!==(g||"")&&(t=t.filter(e=>!(e.isFolder&&"Trash"===e.id))),null==_||_(t);const r=Fi(o.folderId);if(r===Fi(g)){const e=Array.isArray(b)?b:[];A.current={selectedFolder:null!=g?g:null,pathHistory:e.map(e=>Object.assign({},e))}}}catch(s){if("StaleLoad"===(null==s?void 0:s.name))return;const d=Bn(s),c=404===(null==d?void 0:d.status)||"FileNotFound"===(null==d?void 0:d.code)||"path_folder_not_found"===(null==d?void 0:d.code);if(c||console.error("Error loading files:",s),!t&&c){const t=Gn(s,b||[]);try{return await Kn({options:l,pathFolder:t,dataProviders:null==l?void 0:l.dataProviders}),void await L(e,!0)}catch(e){console.error("Cache clear failed:",e)}}if(c&&R&&k){const t=Array.isArray(b)?b:[];if(t.length>1){const r=t.slice(0,-1),n=r[r.length-1],i=null!==(o=null==n?void 0:n.id)&&void 0!==o?o:"folders";return k(r),R(i),await f(),m.success({id:"FOLDER_NOT_FOUND_NAVIGATE",message:h("Folder not found"),description:h("Navigated to parent folder"),placement:"bottomRight"}),void await L(Object.assign(Object.assign({},e),{folderId:i}),!1)}return k([{id:"folders",name:h("Folders")}]),R("folders"),await f(),m.success({id:"FOLDER_NOT_FOUND_NAVIGATE",message:h("Folder not found"),description:h("Navigated to root folder"),placement:"bottomRight"}),void await L(Object.assign(Object.assign({},e),{folderId:"folders"}),!1)}const u=A.current;if(u&&R&&k){const e=Array.isArray(b)?b:[],t=(null!==(r=u.selectedFolder)&&void 0!==r?r:null)===(null!=g?g:null),o=(i=u.pathHistory,a=e,i.length===a.length&&i.every((e,t)=>{var o;return e.id===(null===(o=a[t])||void 0===o?void 0:o.id)}));t&&o||(R(u.selectedFolder),k(u.pathHistory.map(e=>Object.assign({},e))),l.onPathChange&&l.onPathChange(u.pathHistory.map(e=>e.name)))}const p=jn(null==d?void 0:d.code,h),v=null!=e?e:{folderId:g||"",itemType:"all"},y=void 0!==v.folderId&&""!==v.folderId?v.folderId:g||"",w=Array.isArray(b)?b.map(e=>Object.assign({},e)):[],I=null===(n=v.folderName)||void 0===n?void 0:n.trim(),F=I&&I.length>0?I:await mi({folderId:y,dataProviders:N,folders:Array.isArray(C)?C:[],pathHistory:w,t:h}),_=h("Failed to load files"),S=h("Failed to load files in folder",{folderName:F}),E=p&&p!==_?p:void 0;m.error({id:"FILES_FETCH_FAILED",message:S,description:E,placement:"bottomRight",innerException:s,notificationDedupe:!0,data:{params:Object.assign(Object.assign({},v),{folderName:F}),folderName:F}})}finally{null==S||S(!1)}},[N,_,S,R,k,O,f,g,C,m,h,b,l]),M=d(e=>L(e),[L]),U=d(async(e,t)=>{var o;if(!(null==N?void 0:N.findFileByUrl))return null;const r=gi(e);try{return null!==(o=await N.findFileByUrl(r))&&void 0!==o?o:null}catch(e){return console.warn("findFileByUrl failed, falling back to direct loading",e),null}},[N]),j=d(async(e,t)=>{var o,r,n;ei(e,h);const i=gi(e),a=await U(i,t);if(a)return{kind:"existing",file:a,normalizedUrl:i};let s,d;try{const e=await yi(i,{fetchWithProxy:null===(o=null==l?void 0:l.config)||void 0===o?void 0:o.fetchWithProxy,handleFileProxy:null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.handleFileProxy,handleProxyUrl:null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.handleProxyUrl},Ai,e=>_i(e,h));s=e.blob,d=e.mimeType}catch(e){if(e instanceof Yn)throw e;throw e instanceof Error?e:new Yn(h("Failed to download file from the URL."),"UploadUrlDownloadFailed")}const c=Tt(d),u=Ii(i)||"uploaded-file",f=u.replace(/\.[^.]+$/,"")||"uploaded-file";return{kind:"blob",blob:s,normalizedUrl:i,mimeType:d,extension:c,fileName:Yt(u.includes(".")?u:`${f}.${c}`,null==l?void 0:l.config)}},[U,null==l?void 0:l.config,h]),D=d(async(e,t)=>{var o,r,n,i;ei(e,h);const a=gi(e);try{const e=await j(a,t);if("existing"===e.kind)return e.file;return{thumbnail:await Ci(e.blob),name:e.fileName,type:e.mimeType,extension:e.extension,size:e.blob.size,sourceUrl:e.normalizedUrl,saveWithoutFolder:!0}}catch(e){let c=e;if(null==N?void 0:N.uploadFileByUrl)try{const e=null!=g?g:"",t=Yt(Ii(a)||"uploaded-file",null==l?void 0:l.config),n=await T(t,e,!1),i=await N.uploadFileByUrl({url:a,folderId:e,name:n,eventSource:"pixie"}),s=_i(null!==(o=(null==i?void 0:i.id)&&N.getFileData?await N.getFileData(i.id):void 0)&&void 0!==o?o:(null==i?void 0:i.url)?await Ai(i.url):(null==i?void 0:i.thumbnailUrl)?await Ai(i.thumbnailUrl):(null==i?void 0:i.sourceUrl)?await Ai(i.sourceUrl):void 0,h),d=await Ci(s.blob);return Object.assign(Object.assign({},i),{thumbnail:d,type:i.type||s.mimeType,extension:i.extension||Tt(s.mimeType),size:null!==(r=i.size)&&void 0!==r?r:s.blob.size,sourceUrl:i.sourceUrl||a})}catch(e){c=e,console.warn("Failed to prepare file for Pixie via uploadByUrl fallback",e)}const u=Bn(c),f=(s=null==u?void 0:u.code,d="UploadUrlDownloadFailed","string"==typeof s?s:d),p=c instanceof Yn?c:new Yn(null!==(i=null!==(n=jn(f,h))&&void 0!==n?n:null==u?void 0:u.message)&&void 0!==i?i:h("Failed to download file from the URL."),f,null==u?void 0:u.status);throw p.notificationShown=!0,await m.error({id:"EDITOR_PROXY_FILE_FAILED",message:p.message,placement:"bottomRight",data:{url:a,folderId:g||null,error:u,eventSource:"pixie"},innerException:c},t),p}var s,d},[N,m,null==l?void 0:l.config,j,T,g,h]),B=d(async e=>{const t=I.current;try{const o=F.current.find(t=>t.id===e),r=e=>{if(!e)return;const t=w.find(t=>t.id===e);return null==t?void 0:t.name};await p({items:[{id:e,isFolder:null==o?void 0:o.isFolder}],selectedFolder:g,getItemNameById:r,showNotifications:!0});const n=Object.assign({},t);let i=t.current;1===w.length&&(i=n.current>1?n.current-1:1),await M({folderId:g||"",page:i,limit:t.pageSize,sortBy:c,sortOrder:u})}catch(t){console.error("ОError when deleting a file:",t);const o=t;(null==o?void 0:o.notificationShown)||m.error({id:"FILES_DELETE_ERROR",message:h("Error when deleting a file"),placement:"bottomRight",innerException:t,data:{failCount:1,totalCount:1,itemIds:[e],folderId:g||null,errors:[{itemId:e,error:Bn(t)}]}})}},[p,M,g,h,m,w,c,u]),z=d(async e=>{try{const t=I.current;if(!(null==N?void 0:N.deleteFolder))return void m.error({id:"FOLDER_DELETE_ERROR",message:h("DataProvider for folder deletion is not configured"),placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e}});if(!await N.deleteFolder(e)){const e=new Error("Не удалось удалить папку");throw e.notificationShown=!1,e}m.success({id:"FOLDER_DELETE_SUCCESS",message:h("Folder deleted"),placement:"bottomRight",data:{successCount:1,totalCount:1,itemIds:[e],folderId:e}});g===e?await M({page:t.current,limit:t.pageSize,sortBy:c,sortOrder:u}):await M({folderId:g||"",sortBy:c,sortOrder:u,page:t.current,limit:t.pageSize})}catch(t){console.error("Error when deleting a folder:",t);const o=t;(null==o?void 0:o.notificationShown)||m.error({id:"FOLDER_DELETE_ERROR",message:h("Error when deleting a folder"),innerException:t,placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e,errors:[{itemId:e,error:Bn(t)}]}})}},[N,g,m,h,M,c,u]),q=d(async(e,t)=>{var o,r;try{if(null==N?void 0:N.getFileData){const t=await N.getFileData(e);if(t)return t;throw new Error(h("Failed to download file"))}{const t=await fetch(`/api/files/${e}/content`);if(!t.ok)throw new Error(h("Error loading image"));return await t.blob()}}catch(n){console.error("Error when loading a file:",n);const i=F.current.find(t=>t.id===e);t||m.error({id:"FILE_DOWNLOAD_FAILED",message:h("Failed to download file"),placement:"bottomRight",description:(null==i?void 0:i.name)||e,innerException:n,notificationDedupe:!1,data:{itemId:e,itemName:(null==i?void 0:i.name)||e,folderId:null!==(o=null==i?void 0:i.folderId)&&void 0!==o?o:null,thumbnail:null!==(r=null==i?void 0:i.thumbnail)&&void 0!==r?r:null}},t)}},[N,m,h]),V=d(async(e,t,o,r)=>{var n,a,s,d,c,u,f,p,v,y,w,b,C,I,F;if("Trash"===(r?"":null!=t?t:g||""))throw new Error(h("Upload to Trash is forbidden"));const A=Yt(e.name,null==l?void 0:l.config),_=A.split(".").pop()||"",S=r?"":null!=t?t:g||"";let E=e;try{if(Mt(e)){const t=null!==(a=null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.compressMaxSize)&&void 0!==a?a:oi.MAX_SIZE_MB,o=null!==(d=null===(s=null==l?void 0:l.config)||void 0===s?void 0:s.compressMaxWidthOrHeight)&&void 0!==d?d:2e3,r=null!==(u=null===(c=null==l?void 0:l.config)||void 0===c?void 0:c.compessorUrl)&&void 0!==u?u:null===(f=null==l?void 0:l.config)||void 0===f?void 0:f.compressorUrl,i=(null===(p=e.type)||void 0===p?void 0:p.trim())||Lt(e.name)||e.type;E=await hi(e,{maxSizeMB:t,maxWidthOrHeight:o,mimeType:i,fileName:A,libURL:r,enableCompression:ni(null==l?void 0:l.config,i),convertSvgToPng:!0})}else E=bi(e,A)}catch(t){console.warn("Image preparation failed, uploading original file",t),E=bi(e,A)}let P=E.name;const R=Xt(null==l?void 0:l.config);R&&(P=await T(P,S,r)),R&&(E=bi(E,P));try{if(null==N?void 0:N.uploadFiles)try{const t=await N.uploadFiles({items:[{name:P,size:E.size,type:E.type||e.type,folderId:S,data:E,extension:_,noFolder:r}],folderId:S});if(t.success&&t.detailed&&t.detailed.length>0){const n=t.detailed[0];if(!n.success||!n.data){if(!o){const e=(null==n?void 0:n.error)?String(n.error):h("Failed to upload file");m.error({id:"FILE_UPLOAD_ITEM_FAILED",message:e,placement:"bottomRight",description:A,innerException:null==n?void 0:n.error,data:{itemName:A,folderId:S||null,eventSource:"upload"}})}return void(x&&x(at))}{const t=n.data;if(t.id){const o=(null!==(v=t.folderId)&&void 0!==v?v:S)||void 0,n=null!==(y=null!=o?o:g)&&void 0!==y?y:"";await M({folderId:n,noFolder:r});let a=i.files.find(e=>e.id===t.id);if(!a)try{a=(await O({folderId:o,noFolder:r,itemType:"all"})).find(e=>e.id===t.id)}catch(e){console.warn("uploadFileWithProvider: не удалось получить свежий список файлов",e)}return x&&x(at),a||Object.assign(Object.assign({},t),{id:t.id,name:t.name||A,folderId:null!==(b=null!==(w=t.folderId)&&void 0!==w?w:S)&&void 0!==b?b:null,type:E.type||e.type,size:E.size,extension:_||A.split(".").pop()||"",thumbnail:null!==(C=t.thumbnail)&&void 0!==C?C:void 0,url:null!==(I=t.url)&&void 0!==I?I:void 0,thumbnailUrl:null!==(F=t.thumbnailUrl)&&void 0!==F?F:void 0,isFolder:!1,selected:!1})}}}else if(!t.success){if(!o){const e=t.error?String(t.error):h("Failed to upload file");m.error({id:"FILE_UPLOAD_ITEM_FAILED",message:e,placement:"bottomRight",description:A,innerException:t.error,data:{itemName:A,folderId:S||null,eventSource:"upload"}})}return void(x&&x(at))}return void(x&&x(at))}catch(e){throw e}if(null==N?void 0:N.uploadFile){const t=await N.uploadFile({name:P,size:E.size,type:E.type||e.type,folderId:S,noFolder:r,data:E,extension:_});return x&&x(at),t}return void(o||m.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:h("DataProvider for file upload is not configured"),placement:"bottomRight"}))}catch(e){const t=Bn(e),r=jn(null==t?void 0:t.code,h);return o?void 0:void m.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!=r?r:h("Failed to upload file"),placement:"bottomRight",description:A,innerException:e,data:{itemName:A,folderId:S||null,error:Bn(e),eventSource:"upload"}})}},[N,g,x,i.files,M,O,m,h,null==l?void 0:l.config]),W=d(async(e,t)=>{var o;if(!(null==N?void 0:N.getFolders)||!(null==N?void 0:N.createFolder))return e||"";try{const r=await N.getFolders(),n=Array.isArray(r)?r:[],i=(e,t)=>n.find(o=>{var r;return(null!==(r=o.parentId)&&void 0!==r?r:null)===(null!=e?e:null)&&o.name===t});let a=null!=e?e:"";for(const e of t){if(!e)continue;let t=i(a,e);if(!t){const o=await N.createFolder({name:e,parentId:null!=a?a:null});n.push(o),t=o}a=t.id}return null!==(o=a)&&void 0!==o?o:e||""}catch(t){return console.warn("ensureFolderPath: unable to guarantee the path",t),e||""}},[N]),H=d(async(e,t)=>{var o,r,n,i;if(!(null===(r=null===(o=e.type)||void 0===o?void 0:o.startsWith)||void 0===r?void 0:r.call(o,"image/")))return null!=t?t:null;const a=null==e?void 0:e.webkitRelativePath;let l=t||"";if(a&&a.includes("/")){const e=a.split("/");e.pop();const o=e.filter(Boolean);o.length&&(l=await W(t||"",o)||t||"")}return null!==(i=null!==(n=l)&&void 0!==n?n:t)&&void 0!==i?i:null},[W]);d(async e=>{var t,o,r,n,i,a,l,s,d,c,u,f;const{file:h,selectedFolderId:m,uploadFn:p,progressCallbacks:g}=e;if(!(null===(o=null===(t=h.type)||void 0===t?void 0:t.startsWith)||void 0===o?void 0:o.call(t,"image/")))return{success:!0,fileName:h.name,folderId:null!=m?m:null};const v=null!==(n=null!==(r=await H(h,m))&&void 0!==r?r:m)&&void 0!==n?n:null,y=null!==(i=null!=v?v:m)&&void 0!==i?i:null;let w;null===(a=null==g?void 0:g.onStart)||void 0===a||a.call(g,h);try{if(null==g?void 0:g.onProgress){let e=0;w=window.setInterval(()=>{var t;e=Math.min(e+10+Math.floor(Date.now()%10),90),null===(t=null==g?void 0:g.onProgress)||void 0===t||t.call(g,h.name,e)},200)}const e=await p(h,null!=y?y:void 0);return(null==g?void 0:g.onProgress)&&(null===(l=null==g?void 0:g.onProgress)||void 0===l||l.call(g,h.name,100)),null===(s=null==g?void 0:g.onComplete)||void 0===s||s.call(g,h.name),{success:!0,fileName:h.name,fileId:null==e?void 0:e.id,folderId:null!==(c=null!==(d=null==e?void 0:e.folderId)&&void 0!==d?d:y)&&void 0!==c?c:null}}catch(e){const t=e instanceof Error?e.message:String(e);return null===(u=null==g?void 0:g.onError)||void 0===u||u.call(g,h.name,t),{success:!1,fileName:h.name,folderId:null!==(f=null!=y?y:m)&&void 0!==f?f:null,error:t}}finally{void 0!==w&&clearInterval(w)}},[H]);const $=d(async(e,t)=>{var o,r,n,i,a,s,d,c,u,f,p,v,y,w,b,C,I,F,A,_,S,E,P,R,k;if(0===e.length)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};null===(o=null==t?void 0:t.onStartBatch)||void 0===o||o.call(t,e);const O=e=>{const t=e.filter(Boolean);return t.length>0&&t.length<=5?t.join(", "):null},T=await wi(e,4,async(e,o)=>{var r,n,i,a,s,d,c,u,f,p;if(!Mt(e)){const o=await m.warning({id:"FILES_UPLOAD_UNSUPPORTED_TYPE",message:h("Unsupported file type"),placement:"bottomRight",data:{itemName:e.name,fileType:e.type,folderId:g||null}});return null===(r=null==t?void 0:t.onError)||void 0===r||r.call(t,e.name,o.message),null}const v=Yt(e.name,null==l?void 0:l.config);let y=e;try{const t=null!==(i=null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.compressMaxSize)&&void 0!==i?i:oi.MAX_SIZE_MB,o=null!==(s=null===(a=null==l?void 0:l.config)||void 0===a?void 0:a.compressMaxWidthOrHeight)&&void 0!==s?s:2e3,r=null!==(c=null===(d=null==l?void 0:l.config)||void 0===d?void 0:d.compessorUrl)&&void 0!==c?c:null===(u=null==l?void 0:l.config)||void 0===u?void 0:u.compressorUrl,h=(null===(f=e.type)||void 0===f?void 0:f.trim())||Lt(e.name)||e.type;y=await hi(e,{maxSizeMB:t,maxWidthOrHeight:o,mimeType:h,fileName:v,libURL:r,enableCompression:ni(null==l?void 0:l.config,h),convertSvgToPng:!0})}catch(t){console.warn("Image preparation failed, uploading original file",t),y=bi(e,v)}const w=`${Date.now()}-${o}-${Math.random().toString(36).slice(2,8)}`,b=await H(y,g);return null===(p=null==t?void 0:t.onStart)||void 0===p||p.call(t,y),{file:y,targetFolderId:b,requestId:w,originalFileName:e.name,originalIndex:o}}),L=T.filter(e=>null!==e),M=L.length;if(0===M)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};const U=Xt(null==l?void 0:l.config),j=new Map;if(U&&(null==N?void 0:N.getFiles)){const e=[...new Set(L.map(e=>{var t,o;return null!==(o=null!==(t=e.targetFolderId)&&void 0!==t?t:g)&&void 0!==o?o:""}).filter(e=>null!=e))];for(const t of e)try{const{files:e}=await N.getFiles({folderId:""===t?"":null!=t?t:void 0,itemType:"all",page:1,limit:1e4});let o=(e||[]).map(e=>e.name).filter(e=>!!e);if(null==N?void 0:N.getFolders){const e=(await N.getFolders({parentId:t||null,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);o=[...o,...e]}j.set(t,o)}catch(e){console.warn("Could not fetch files for duplicate check:",e)}}const D=new Map,B=L.map(e=>{const t=U?((e,t)=>{const o=null!=e?e:"";let r=j.get(o)||[],n=D.get(o);n||(n=new Set(r.map(e=>e.toLowerCase())),D.set(o,n));const i=Tr(t,Array.from(n));return n.add(i.toLowerCase()),i})(e.targetFolderId,e.file.name):e.file.name,o=U?bi(e.file,t):e.file;return Object.assign(Object.assign({},e),{resolvedUploadName:t,uploadFile:o})}),z=!t,q=1===M&&z,V=[],W=[],$=[],G=[],K=new Map;let Q=0,J=0;const Y=null!==(n=null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.maxFileSize)&&void 0!==n?n:52428800,Z=async(e,o,r,n)=>{var i,a;const{emitProgress:l=!0,emitNotification:s=!0}=null!=n?n:{};Q++,V.push(e),W.push(null!=r?r:e),await((e,t,o,r)=>{var n;return m.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${h("File")} ${e} ${h("has been successfully uploaded")}`,placement:"bottomRight",data:{itemId:o,itemName:e,folderId:null!==(n=null!=t?t:g)&&void 0!==n?n:null,eventSource:"upload"}},r||!z)})(e,o,r,!s),l&&(null===(i=null==t?void 0:t.onProgress)||void 0===i||i.call(t,e,100),null===(a=null==t?void 0:t.onComplete)||void 0===a||a.call(t,e))},X=async(e,o,r,n)=>{var i;const{emitProgress:a=!0,emitNotification:l=!0,fileSize:s,progressCallbackName:d,progressCallbackIndex:c}=null!=n?n:{};J++;const u=null!=s?{fileSize:s,maxSize:Y}:void 0,f=await((e,t,o,r,n)=>{var i,a,l,s,d,c,u;const f=Bn(o),p=null!==(i=null==n?void 0:n.fileSize)&&void 0!==i?i:null==f?void 0:f.fileSize,v=null!==(l=null!==(a=null==n?void 0:n.maxSize)&&void 0!==a?a:null==f?void 0:f.maxSize)&&void 0!==l?l:Y,y={allowedChars:"a-z A-Z 0-9 . _ -",fileSize:null!=p?kr(Number(p)):void 0,maxSize:null!=v?kr(Number(v)):void 0},w=null==f?void 0:f.code,b="BatchItemLimitExceeded"===w||"exceeded_max_files"===w?w:null!==(s=Dn(null==f?void 0:f.message))&&void 0!==s?s:w,C="BatchItemLimitExceeded"===b||"exceeded_max_files"===b?zn(o,h):jn(b,h,y),I=(null==f?void 0:f.message)&&"string"==typeof f.message&&f.message.length>0?f.message:null,F=o instanceof Error?o.message:"string"==typeof o?o:null,A=F&&"[object Object]"!==F?F:null;return m.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!==(c=null!==(d=null!=I?I:C)&&void 0!==d?d:A)&&void 0!==c?c:h("Error uploading file {{fileName}}",{fileName:e}),placement:"bottomRight",data:{itemName:e,folderId:null!==(u=null!=t?t:g)&&void 0!==u?u:null,error:Bn(o),eventSource:"upload"},innerException:o},r||!z)})(e,o,r,!l,u);a&&(null===(i=null==t?void 0:t.onError)||void 0===i||i.call(t,null!=d?d:e,f.message,c)),G.push({itemId:void 0,itemName:e,error:Bn(r)}),$.push({fileName:e,error:f.message})};let ee;if(!(null==N?void 0:N.uploadFiles))return m.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:h("DataProvider for file upload is not configured"),placement:"bottomRight"}),{successCount:0,failCount:M,successes:[],errors:[],totalCount:M};{const e=[];try{(null==t?void 0:t.onProgress)&&L.forEach(o=>{let r=0;const n=window.setInterval(()=>{var e;r=Math.min(r+10+Math.floor(Date.now()%10),90),null===(e=null==t?void 0:t.onProgress)||void 0===e||e.call(t,o.file.name,r)},200);e.push(n)}),ee=await N.uploadFiles({items:B.map(e=>{var t,o;return{requestId:e.requestId,name:e.resolvedUploadName,size:e.uploadFile.size,type:e.uploadFile.type,folderId:null!==(o=null!==(t=e.targetFolderId)&&void 0!==t?t:g)&&void 0!==o?o:null,data:e.uploadFile,extension:e.uploadFile.name.split(".").pop()||""}}),folderId:null!=g?g:null}),e.forEach(e=>window.clearInterval(e)),e.length=0;const o=null!==(i=ee.detailed)&&void 0!==i?i:[],r=new Map(o.filter(e=>e.requestId).map(e=>[e.requestId,e]));if(o.length>0)for(let e=0;e<B.length;e++){const t=B[e],n=null!==(a=t.requestId?r.get(t.requestId):void 0)&&void 0!==a?a:o[e];if(n&&n.success){const e=n.data,o=null!==(s=null==e?void 0:e.name)&&void 0!==s?s:t.resolvedUploadName,r=null!==(u=null!==(c=null!==(d=null==e?void 0:e.folderId)&&void 0!==d?d:t.targetFolderId)&&void 0!==c?c:g)&&void 0!==u?u:null,i=null==e?void 0:e.id;K.set(o,{id:i,name:o,folderId:r,size:null==e?void 0:e.size,originalFileName:t.originalFileName,originalIndex:t.originalIndex}),await Z(o,r,i,{emitNotification:q})}else{const e=null==n?void 0:n.data,o=null!==(f=null==e?void 0:e.name)&&void 0!==f?f:t.resolvedUploadName,r=null!==(y=null!==(v=null!==(p=null==e?void 0:e.folderId)&&void 0!==p?p:t.targetFolderId)&&void 0!==v?v:g)&&void 0!==y?y:null;await X(o,r,null!==(w=null==n?void 0:n.error)&&void 0!==w?w:new Error(h("Error uploading file")),{emitNotification:q,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}else if(ee.success)for(const e of B){const t=e.resolvedUploadName,o=null!==(C=null!==(b=e.targetFolderId)&&void 0!==b?b:g)&&void 0!==C?C:null;await Z(t,o,void 0,{emitNotification:q})}else{const e=null!==(I=ee.error)&&void 0!==I?I:new Error(h("Error uploading file"));for(const t of B){const o=t.resolvedUploadName,r=null!==(A=null!==(F=t.targetFolderId)&&void 0!==F?F:g)&&void 0!==A?A:null;await X(o,r,e,{emitNotification:q,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}}catch(e){for(const t of B){const o=t.resolvedUploadName,r=null!==(S=null!==(_=t.targetFolderId)&&void 0!==_?_:g)&&void 0!==S?S:null;await X(o,r,null!=e?e:new Error(h("Error uploading file")),{emitNotification:q,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}finally{e.forEach(e=>window.clearInterval(e))}}if(Q>0&&(x&&x(at),M>1&&z)){const e=O(V),t=e?h("Uploaded",{names:e}):h("uploads_success_summary",{successCount:Q,totalCount:M});m.success({id:"FILES_UPLOAD_BATCH_SUCCESS",message:t,placement:"bottomRight",data:{successCount:Q,totalCount:M,itemIds:W,itemNames:V,folderId:null!=g?g:null,eventSource:"upload"}})}if(J>0&&z&&!q)if(M>1){const e=$.map(e=>e.fileName),t=O(e),o=t?h("Failed",{names:t}):h("uploads_fail_summary",{failCount:J,totalCount:M});m.error({id:"FILES_UPLOAD_BATCH_FAILED",message:o,placement:"bottomRight",data:{failCount:J,totalCount:M,itemNames:e,folderId:null!=g?g:null,errors:G,eventSource:"upload"}})}else if(1===M&&G.length>0&&(null===(E=G[0].error)||void 0===E?void 0:E.code)){const e=jn(null===(P=G[0].error)||void 0===P?void 0:P.code,h),t=null!==(k=null===(R=$[0])||void 0===R?void 0:R.fileName)&&void 0!==k?k:"",o=null!=e?e:t?`${h("Failed to upload files")}: ${t}`:h("Failed to upload files");m.error({id:"FILES_UPLOAD_BATCH_FAILED",message:o,placement:"bottomRight",data:{failCount:J,totalCount:M,itemNames:[t],folderId:null!=g?g:null,errors:G,eventSource:"upload"}})}return{successCount:Q,failCount:J,successes:V,errors:$,totalCount:M,uploadedFiles:K.size>0?K:void 0}},[N,null===(o=null==l?void 0:l.config)||void 0===o?void 0:o.dedupeUploadNamesOnClient,m,H,g,x,h,null==l?void 0:l.config]),G=d(async e=>{var t;if(!(null==N?void 0:N.uploadFiles))return void m.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:h("DataProvider for file upload is not configured"),placement:"bottomRight"});if("Trash"===g)return void m.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:h("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:g||null,reason:"Upload to Trash is not allowed"}});const o=I.current,r=document.createElement("input");r.type="file",r.accept="image/*",r.multiple=!0;try{!(!(null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.features)||!l.config.features.enableDirectoryUpload)&&(r.webkitdirectory=!0)}catch(e){}r.onchange=async t=>{var r;const n=t.target.files;if(!n||0===n.length)return;const i=Array.from(n);try{null==S||S(!0);const{successes:t,errors:n,uploadedFiles:a}=await $(i,e);null===(r=null==e?void 0:e.onBatchComplete)||void 0===r||r.call(e,{files:i,successes:t,errors:n,uploadedFiles:a}),await f(),await M({folderId:g||"",sortBy:c,sortOrder:u,page:o.current,limit:o.pageSize})}catch(e){console.error("Error when loading files:",e)}finally{null==S||S(!1)}},r.click()},[null==N?void 0:N.uploadFiles,g,m,h,S,M,f,c,u,$,null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.features]),K=d(async(e,t,o,r="uploadByUrl")=>{const n=I.current,i=Boolean(e&&String(e).trim());let a,s=null!=e?e:null;try{if(!t&&"Trash"===g)throw o||m.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:h("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:g||null,reason:"Upload to Trash is not allowed"}}),new Yn(h("Cannot upload files to Trash"),"UploadUrlDownloadFailed");let e,d;if(!s&&v&&(e=await v.validateFields(),s=null==e?void 0:e.fileUrl),!s)throw o||m.error({id:"FILES_UPLOAD_URL_VALIDATION_FAILED",message:h("Please fill in all fields"),placement:"bottomRight",data:{url:null!=s?s:null,folderId:g||null,eventSource:r}}),new Yn(h("Please fill in all fields"),"UploadUrlInvalid");if(ei(s,h),s=gi(s),null==S||S(!0),s){const e=s.split("?")[0].split("#")[0].split("/");d=e[e.length-1]||"uploaded-file",d=Yt(d,null==l?void 0:l.config)}const f=t?"":g||"",p=Boolean((null==N?void 0:N.uploadFiles)||(null==N?void 0:N.uploadFile)),y=Boolean(null==N?void 0:N.uploadFileByUrl);let w=d;w&&y&&(w=await T(w,f,t));try{const e=await j(s,o);if("existing"===e.kind)a=e.file;else if(p){const o=new File([e.blob],e.fileName,{type:e.mimeType,lastModified:Date.now()});try{a=await V(o,f,!0,t)}catch(e){throw e.uploadUrlStage="binaryUpload",e}if(!a){const e=new Yn(h("Failed to upload file"),"FileUploadBackendError");throw e.uploadUrlStage="binaryUpload",e}}else{if(!y)throw o||m.error({id:"FILES_UPLOAD_URL_NOT_SUPPORTED",message:h("Upload by URL is not supported"),placement:"bottomRight",data:{url:s,folderId:g||null,eventSource:r}}),new Yn(h("Upload by URL is not supported"),"UploadUrlDownloadFailed");a=await N.uploadFileByUrl({url:s,folderId:g||"",noFolder:t,name:w,eventSource:r})}}catch(e){const o=e;if("binaryUpload"===(null==o?void 0:o.uploadUrlStage)||!y)throw e;console.warn("Failed to fetch file by URL locally, falling back to uploadByUrl",e),a=await N.uploadFileByUrl({url:s,folderId:g||"",noFolder:t,name:w,eventSource:r})}const b=(null==e?void 0:e.name)||(null==a?void 0:a.name)||"unnamed file";return a&&m.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${h("File")} ${b} ${h("successfully uploaded")}`,placement:"bottomRight",data:{itemName:b,itemId:null==a?void 0:a.id,folderId:g||null,eventSource:r}},o),(e||i)&&(null==E||E(!1),null==v||v.resetFields()),x&&x(at),await M({folderId:g||"",noFolder:t,sortBy:c,sortOrder:u,page:n.current,limit:n.pageSize}),a}catch(e){if(console.error("Error when loading a file by URL:",e),!o){const t=Bn(e),o=t,n=e,i=Number(null==o?void 0:o.fileSize),a=Number(null==o?void 0:o.maxSize),l=Number.isFinite(i)&&Number.isFinite(a)?{fileSize:i,maxSize:a}:void 0,d="binaryUpload"===(null==n?void 0:n.uploadUrlStage)?zn(t,h,l):Wn(t,h);m.error({id:"FILES_UPLOAD_BY_URL_FAILED",message:d,placement:"bottomRight",data:{url:null!=s?s:null,folderId:g||null,error:t,eventSource:r},innerException:e})}throw e}finally{null==S||S(!1)}},[v,S,N,m,h,E,x,M,g,c,u,T,j,V,null==l?void 0:l.config]),Q=d(async e=>{if(!e.length)return;const t=I.current;"Trash"!==g?(await $(e),await M({folderId:g||"",sortBy:c,sortOrder:u,page:t.current,limit:t.pageSize})):m.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:h("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:g||null,reason:"Upload to Trash is not allowed"}})},[M,g,c,u,$,m,h]);return{fetchFiles:M,handleDeleteFile:B,handleDeleteFolder:z,handleAddFile:G,handleAddFileByUrl:K,handleDroppedFiles:Q,getFileData:q,findFileByUrl:U,resolveFileForEditByUrl:D,uploadFileWithProvider:V}},Ei=e=>{let t;const o=new Set,r=(e,r)=>{const n="function"==typeof e?e(t):e;if(!Object.is(n,t)){const e=t;t=(null!=r?r:"object"!=typeof n||null===n)?n:Object.assign({},t,n),o.forEach(o=>o(t,e))}},n=()=>t,i={setState:r,getState:n,getInitialState:()=>a,subscribe:e=>(o.add(e),()=>o.delete(e))},a=t=e(r,n,i);return i},xi=e=>e;const Pi=e=>{const t=(e=>e?Ei(e):Ei)(e),o=e=>function(e,t=xi){const o=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(o),o}(t,e);return Object.assign(o,t),o};function Ri(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const ki=(Ni=e=>({selectedFiles:new Set,visibleFileIds:[],anchorId:null,multiSelect:!0,setMultiSelect:t=>{e(e=>{var o;if(e.multiSelect===t)return e;if(t)return{multiSelect:!0};const r=null!==(o=Array.from(e.selectedFiles)[0])&&void 0!==o?o:null;return{multiSelect:!1,selectedFiles:r?new Set([r]):new Set,anchorId:r}})},syncVisibleFiles:t=>{const o=Array.isArray(t)?t.map(e=>e.id):[];e(e=>{const t=new Set(o),r=new Set(Array.from(e.selectedFiles).filter(e=>t.has(e))),n=e.anchorId&&t.has(e.anchorId)?e.anchorId:null,i=function(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}(e.visibleFileIds,o),a=Ri(e.selectedFiles,r),l=e.anchorId===n;return i&&a&&l?e:{visibleFileIds:o,selectedFiles:r,anchorId:n}})},setSelectedFiles:t=>{e(e=>{var o;const r=new Set(e.visibleFileIds),n=new Set(Array.from(t).filter(e=>r.has(e)));return Ri(e.selectedFiles,n)?e:{selectedFiles:n,anchorId:null!==(o=Array.from(n)[0])&&void 0!==o?o:null}})},clearSelection:()=>{e(e=>0===e.selectedFiles.size&&null===e.anchorId?e:{selectedFiles:new Set,anchorId:null})},selectAllVisible:()=>{e(e=>{var t;const o=new Set(e.visibleFileIds),r=null!==(t=e.visibleFileIds[0])&&void 0!==t?t:null;return Ri(e.selectedFiles,o)&&e.anchorId===r?e:{selectedFiles:o,anchorId:r}})},toggleFileSelection:(t,o)=>{e(e=>{const r=!1!==e.multiSelect,n=Boolean(null==o?void 0:o.shiftKey)&&r,i=Boolean(null==o?void 0:o.metaKey)||Boolean(null==o?void 0:o.ctrlKey)||Boolean(null==o?void 0:o.forceToggle),a=e.visibleFileIds,l=new Set(a);if(a.length>0&&!l.has(t))return e;if(!r){const o=new Set([t]);return Ri(e.selectedFiles,o)&&e.anchorId===t?e:{selectedFiles:o,anchorId:t}}if(n&&e.anchorId&&l.has(e.anchorId)){const o=a.indexOf(e.anchorId),r=a.indexOf(t);if(-1===o||-1===r)return e;const[n,l]=o<r?[o,r]:[r,o],s=a.slice(n,l+1),d=i?new Set(e.selectedFiles):new Set;return s.forEach(e=>{d.add(e)}),Ri(e.selectedFiles,d)?e:{selectedFiles:d}}if(n&&!e.anchorId){const o=new Set([t]);return Ri(e.selectedFiles,o)&&e.anchorId===t?e:{selectedFiles:o,anchorId:t}}if(i){const o=new Set(e.selectedFiles);return o.has(t)?o.delete(t):o.add(t),Ri(e.selectedFiles,o)&&e.anchorId===t?e:{selectedFiles:o,anchorId:t}}const s=new Set([t]);return Ri(e.selectedFiles,s)&&e.anchorId===t?e:{selectedFiles:s,anchorId:t}})}}),Ni?Pi(Ni):Pi);var Ni;const Oi=e=>{var t,o,r,n;const{state:i,actions:a,options:l}=pn(),{t:s}=dr(),c=Qn(),u=Tn(),{fetchFolders:f}=c.actions,{renameItem:h}=(()=>{const{options:e}=pn(),{dataProviders:t}=e,{t:o}=dr(),r=d(async({itemId:r,newName:n,isFolder:i})=>{var a,l,s,d,c,u,f,h;try{if(i){if(!(null==t?void 0:t.renameFolder))throw new Error(o("renameFolder is not implemented in dataProviders"));const i=Zt(n.trim(),e.config),d=await t.renameFolder(r,i);return{success:!0,renamedItem:{id:d.id,name:null!==(a=d.name)&&void 0!==a?a:i,parentId:null!==(l=d.parentId)&&void 0!==l?l:null,folderId:null!==(s=d.parentId)&&void 0!==s?s:null}}}if(!(null==t?void 0:t.renameFile))throw new Error(o("renameFile is not implemented in dataProviders"));const m=Yt(n,e.config),p=await t.renameFile(r,m);return{success:!0,renamedItem:{id:null!==(d=null==p?void 0:p.id)&&void 0!==d?d:r,name:null!==(c=null==p?void 0:p.name)&&void 0!==c?c:m,folderId:null!==(u=null==p?void 0:p.folderId)&&void 0!==u?u:null,parentId:null!==(h=null!==(f=null==p?void 0:p.parentId)&&void 0!==f?f:null==p?void 0:p.folderId)&&void 0!==h?h:null}}}catch(e){return{success:!1,error:Bn(e)}}},[t,o,e.config]);return{renameItem:r}})(),{files:m,selectedFolder:p,fileToRename:g,renameForm:v,isRenameModalVisible:y,pagination:w}=i,{setFileToRename:b,setIsRenameModalVisible:C}=a,{dataProviders:I,config:F}=l,A=e=>{var t,o;if(!e)return null;const r=e;return null!==(o=null!==(t=r.folderId)&&void 0!==t?t:r.parentId)&&void 0!==o?o:null},_=(e,t)=>{var o;return{itemId:null!==(o=null==e?void 0:e.id)&&void 0!==o?o:t,itemName:null==e?void 0:e.name,folderId:A(e)}},S=d(e=>{var t,o;const r=null==m?void 0:m.find(t=>t.id===e);if((null==r?void 0:r.isFolder)||e.startsWith("folder_")){if(!(!1!==(null===(t=null==F?void 0:F.features)||void 0===t?void 0:t.enableRenameFolder)))return void u.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:s("Folder rename is disabled by config"),placement:"bottomRight",data:_(r,e)});if(!(null==I?void 0:I.renameFolder))throw new Error(s("renameFolder is not implemented in dataProviders"))}else{if(!(!1!==(null===(o=null==F?void 0:F.features)||void 0===o?void 0:o.enableRenameFile)))return void u.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:s("File rename is disabled by config"),placement:"bottomRight",data:_(r,e)});if(!(null==I?void 0:I.renameFile))throw new Error(s("renameFile is not implemented in dataProviders"))}null==b||b(e),null==C||C(!0),r&&v&&v.setFieldsValue({newFileName:r.name})},[m,b,C,v,null===(t=null==F?void 0:F.features)||void 0===t?void 0:t.enableRenameFolder,null===(o=null==F?void 0:F.features)||void 0===o?void 0:o.enableRenameFile,null==I?void 0:I.renameFolder,null==I?void 0:I.renameFile,u,s]),E=d(()=>{null==C||C(!1),null==b||b(null),null==v||v.resetFields()},[C,b,v]),x=d(async()=>{var t,o,r,n,i,l,d,c,y,b,C,I;if(!g||!v)return;const A=null==m?void 0:m.find(e=>e.id===g);try{const m=await v.validateFields();if(!(null==m?void 0:m.newFileName))return;const S=(null==A?void 0:A.isFolder)||g.startsWith("folder_");if(S){if(!(!1!==(null===(t=null==F?void 0:F.features)||void 0===t?void 0:t.enableRenameFolder)))return void u.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:s("Folder rename is disabled by config"),placement:"bottomRight",data:_(A,g)})}else{if(!(!1!==(null===(o=null==F?void 0:F.features)||void 0===o?void 0:o.enableRenameFile)))return void u.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:s("File rename is disabled by config"),placement:"bottomRight",data:_(A,g)})}const x=await h({itemId:g,newName:m.newFileName,isFolder:S});if(!x.success){const e=jn(null===(r=x.error)||void 0===r?void 0:r.code,s);return void u.error({id:"ITEM_RENAME_FAILED",message:null!==(i=null!=e?e:null===(n=x.error)||void 0===n?void 0:n.message)&&void 0!==i?i:s("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},_(A,g)),{error:x.error}),innerException:x.error})}const P=x.renamedItem;S?(u.success({id:"FOLDER_RENAME_SUCCESS",message:s(`${s("Folder renamed to")} ${null!==(l=null==P?void 0:P.name)&&void 0!==l?l:m.newFileName}`),placement:"bottomRight",data:{itemId:null!==(d=null==P?void 0:P.id)&&void 0!==d?d:g,itemName:null!==(c=null==P?void 0:P.name)&&void 0!==c?c:m.newFileName,folderId:null!==(b=null!==(y=null==P?void 0:P.parentId)&&void 0!==y?y:null==P?void 0:P.folderId)&&void 0!==b?b:null}}),await f(),(null==P?void 0:P.id)&&P.id!==g&&a.setSelectedFolder&&a.setSelectedFolder(P.id)):u.success({id:"FILE_RENAME_SUCCESS",message:`${s("File renamed to")} ${null!==(C=null==P?void 0:P.name)&&void 0!==C?C:m.newFileName}`,placement:"bottomRight",data:Object.assign(Object.assign({},_(A,g)),{itemName:null!==(I=null==P?void 0:P.name)&&void 0!==I?I:m.newFileName})}),E(),await e({folderId:p||"",page:w.current,limit:w.pageSize})}catch(e){console.error("Error when renaming:",e);const t=Bn(e),o=jn(null==t?void 0:t.code,s);u.error({id:"ITEM_RENAME_FAILED",message:null!=o?o:e instanceof Error?e.message:s("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},_(A,g)),{error:t}),innerException:e})}},[g,v,m,a,E,e,p,s,w,null===(r=null==F?void 0:F.features)||void 0===r?void 0:r.enableRenameFolder,null===(n=null==F?void 0:F.features)||void 0===n?void 0:n.enableRenameFile,u,f,h]);return{state:{isRenamingFile:y||!1,fileToRename:g},actions:{showRenameModal:S,handleRenameCancel:E,handleRenameOk:x}}},Ti=e=>{const t=t=>{if(!t)return;const o=e.find(e=>e.id===t);return null==o?void 0:o.name};return{getItemNameById:t,getItemNamesByIds:e=>e.map(t).filter(e=>Boolean(e)),getNamesPreview:e=>e.length>0&&e.length<=5?e.join(", "):null}},Li=(e,t,o,r,n)=>({itemIds:e,itemNames:n&&n.length?n:void 0,successCount:t,totalCount:o,folderId:null!=r?r:null}),Mi=(e,t,o,r,n,i)=>({itemIds:e,itemNames:i&&i.length?i:void 0,failCount:t,totalCount:o,folderId:null!=r?r:null,errors:n}),Ui=()=>{const e=Tn(),{t:t}=dr(),{state:o,options:r}=pn(),{folders:n,pathHistory:i}=o,{dataProviders:a}=r,{actions:{fetchFolders:l,fetchChildFolders:s}}=Qn();return{refreshFolders:d(async({parentIds:o,selectedFolder:r})=>{try{if(await l(),o&&s)for(const e of o)e&&await s(e)}catch(o){console.error("Error when updating the folder tree:",o);const r=t("Folders");e.error({id:"FOLDERS_FETCH_FAILED",message:t("Failed to refresh folder tree"),description:r,placement:"bottomRight",innerException:o,notificationDedupe:!0,data:{folderId:null,folderName:r,reason:o instanceof Error?o.message:String(o)}})}},[e,t,l,s]),refreshFiles:d(async({fetchFiles:o,selectedFolder:r,page:l,limit:s})=>{try{await o({folderId:r||"",page:l,limit:s})}catch(o){console.error("Ошибка при обновлении списка файлов:",o);const d=await mi({folderId:r||"",dataProviders:a,folders:Array.isArray(n)?n:[],pathHistory:i,t:t}),c=t("Failed to load files"),u=o instanceof Error?o.message:String(o);e.error({id:"FILES_FETCH_FAILED",message:t("Failed to load files in folder",{folderName:d}),description:u&&u!==c?u:void 0,placement:"bottomRight",innerException:o,notificationDedupe:!0,data:{params:{folderId:r||void 0,page:l,limit:s,folderName:d},folderName:d}})}},[e,t,a,n,i])}},ji=e=>{var t;const{state:o,actions:r,options:n}=pn(),{t:i}=dr(),a=Tn(),l=ki(e=>e.selectedFiles),s=ki(e=>e.clearSelection),{files:c,selectedFolder:u,moveForm:f,pagination:h,currentMenuFile:m}=o,{setIsMoveModalVisible:p,setPagination:g}=r,{dataProviders:v}=n,{moveItems:y}=(()=>{const{options:e}=pn(),{dataProviders:t}=e,{t:o}=dr(),r=Tn(),n=d(async({items:e,targetFolderId:n,getItemNameById:i,showNotifications:a=!1})=>{let l=0,s=0;const d=[];if(null==t?void 0:t.moveItems)try{const o=await t.moveItems("folders"===n?"":n,e.map(e=>e.id)),r=o.detailed;if(r){const e=r.filter(e=>e.success),t=r.filter(e=>!e.success);l+=e.length,s+=t.length,t.forEach(e=>{const t=null!==(r=(o=e).requestId)&&void 0!==r?r:o.id;var o,r;const n=e.error,a=Bn(n);d.push({itemId:t,itemName:i(t),error:a})})}else if(o.success)l+=e.length;else{const t=o.error;if(t){s+=e.length;const o=Bn(t);d.push({error:o})}else s+=e.length}}catch(t){s+=e.length;const o=Bn(t);d.push({error:o})}else s+=e.length,d.push({error:{message:"Move provider is not configured"}});return a&&(l>0&&r.success({id:"FILES_MOVE_SUCCESS",message:o("Files moved"),placement:"bottomRight",data:{successCount:l,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===n?null:n}}),s>0&&r.error({id:"FILES_MOVE_ERROR",message:o("Errors occurred while moving"),placement:"bottomRight",innerException:d.length?d:void 0,data:{failCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),errors:d.length?d:void 0}})),{successCount:l,failCount:s,errorDetails:d}},[t,r,o]);return{moveItems:n}})(),{refreshFolders:w,refreshFiles:b}=Ui(),{getItemNameById:C,getItemNamesByIds:I,getNamesPreview:F}=Ti(c),A=d(()=>{null==p||p(!0)},[p]),_=d(()=>{null==p||p(!1),null==f||f.resetFields()},[p,f]),S=d(async t=>{var o,r,d,p,A,S,E,x;if(!((null==m?void 0:m.length)||l&&0!==l.size))return;const P=c.length,R=Object.assign({},h),k=Array.from((null==m?void 0:m.length)?[m]:l),N=k.length;let O=0,T=0;const L=[],M=k.map(e=>c.find(t=>t.id===e)).filter(e=>Boolean(e)),U=M.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let l=t;if(!t){const e=await f.validateFields();l=null==e?void 0:e.targetFolder}if(!l)return void a.error({id:"FILES_MOVE_DIRECTORY_NOT_SELECTED",message:i("Select destination folder"),placement:"bottomRight"});const c="folders"===l?null:l,h=null!=c?c:u,m=!0===(null===(o=null==n?void 0:n.config)||void 0===o?void 0:o.dedupeUploadNamesOnClient);if(m&&(null==v?void 0:v.getFolders))try{const e=await v.getFolders({parentId:c,deep:!1}),t=new Set((e||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean));for(const e of M){if(!e.isFolder&&!(null===(d=(r=e.id).startsWith)||void 0===d?void 0:d.call(r,"folder_")))continue;const o=e.name||C(e.id)||"";if(o&&t.has(o.toLowerCase()))return void a.error({id:"FOLDER_ALREADY_EXISTS_MOVE",message:i("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:o,targetFolderId:l}})}}catch(e){console.warn("Could not check folder duplicates for move:",e)}if(m&&(null==v?void 0:v.getFiles)&&(null==v?void 0:v.renameFile))try{let e=[];if(null==v?void 0:v.getFiles){const{files:t}=await v.getFiles({folderId:null!=c?c:void 0,itemType:"all",page:1,limit:1e4});e=(t||[]).map(e=>e.name).filter(e=>!!e)}if(null==v?void 0:v.getFolders){const t=(await v.getFolders({parentId:c,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);e=[...e,...t]}const t=new Set(e.map(e=>null==e?void 0:e.toLowerCase()).filter(Boolean));for(const e of M){if(e.isFolder||(null===(A=(p=e.id).startsWith)||void 0===A?void 0:A.call(p,"folder_")))continue;const o=e.name||C(e.id)||"";if(!o||!t.has(o.toLowerCase())){t.add(o.toLowerCase());continue}const r=Tr(o,Array.from(t));await v.renameFile(e.id,r),t.add(r.toLowerCase())}}catch(e){console.warn("Could not check duplicates for move:",e)}const j=await y({items:M,targetFolderId:l,getItemNameById:C,showNotifications:!1});if(O=j.successCount,T=j.failCount,L.push(...j.errorDetails),O>0){const e=I(k),t=F(e),o=t?i("Moved",{names:t}):i("move_success_summary",{successCount:O,totalCount:N});a.success({id:"FILES_MOVE_SUCCESS",message:o,placement:"bottomRight",data:Li(k,O,N,c,e)})}if(T>0){const e=I(k),t=F(e);let o;if(1===N&&L.length>0&&(null===(S=L[0].error)||void 0===S?void 0:S.code)){const e=jn(null===(E=L[0].error)||void 0===E?void 0:E.code,i);o=null!=e?e:t?i("Failed",{names:t}):i("move_fail_summary",{failCount:T,totalCount:N})}else o=t?i("Failed",{names:t}):i("move_fail_summary",{failCount:T,totalCount:N});a.error({id:"FILES_MOVE_ERROR",message:o,placement:"bottomRight",innerException:L.length?L:void 0,data:Mi(k,T,N,c,L.length?L:void 0,e)})}_(),s();let D=R.current;if(O>0&&P>0&&O>=P&&R.current>1&&(D=R.current-1),O>0&&R.total>=O){const e=Math.max(0,(null!==(x=R.total)&&void 0!==x?x:0)-O);null==g||g({current:D,pageSize:R.pageSize,total:e})}U&&await w({parentIds:void 0,selectedFolder:h}),await b({fetchFiles:e,selectedFolder:u,page:D,limit:R.pageSize})}catch(e){console.error("Error when moving:",e);const t=jn(Bn(e).code,i);a.error({id:"FILES_MOVE_ERROR",innerException:e,message:null!=t?t:i("Error moving"),placement:"bottomRight",data:Mi(k,N,N,u||null,[{error:Bn(e)}],I(k))})}},[m,l,f,e,u,h,c,a,g,i,y,s,p,null===(t=null==n?void 0:n.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient,null==v?void 0:v.getFiles,null==v?void 0:v.renameFile,C]);return{actions:{showMoveModal:A,handleMoveCancel:_,handleMoveOk:S}}},Di=e=>{var t;const{state:o,actions:r,options:n}=pn(),{t:i}=dr(),a=Tn(),l=ki(e=>e.selectedFiles),s=ki(e=>e.clearSelection),{files:c,selectedFolder:u,copyForm:f,pagination:h,currentMenuFile:m}=o,{setIsCopyModalVisible:p}=r,{dataProviders:g}=n,{copyItems:v}=(()=>{const{options:e}=pn(),{dataProviders:t}=e,{t:o}=dr(),r=Tn(),n=d(async({items:e,targetFolderId:n,getItemNameById:i,showNotifications:a=!1})=>{let l=0,s=0;const d=[],c="folders"===n?"":n;if(null==t?void 0:t.copyItems)try{const o=await t.copyItems(c,e.map(e=>({id:e.id,newName:e.newName}))),r=o.detailed;if(r){const e=r.filter(e=>e.success),t=r.filter(e=>!e.success);l+=e.length,s+=t.length,t.forEach(e=>{const t=null!==(r=(o=e).requestId)&&void 0!==r?r:o.id;var o,r;const n=e.error,a=Bn(n);d.push({itemId:t,itemName:i(t),error:a})})}else if(o.success)l+=e.length;else{const t=o.error;if(t){s+=e.length;const o=Bn(t);d.push({error:o})}else s+=e.length}}catch(t){s+=e.length;const o=Bn(t);d.push({error:o})}else if(null==t?void 0:t.copyItem)for(const o of e)try{const e=(null==o?void 0:o.isFolder)||o.id.startsWith("folder_");await t.copyItem({itemId:o.id,targetFolderId:c,isFolder:e,newName:o.newName})?l++:s++}catch(e){s++;const t=Bn(e);d.push({itemId:o.id,itemName:i(o.id),error:t})}else s+=e.length,d.push({error:{message:"Copy provider is not configured"}});return a&&(l>0&&r.success({id:"FILES_COPY_SUCCESS",message:o("Files copied"),placement:"bottomRight",data:{successCount:l,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===n?null:n}}),s>0&&r.error({id:"FILES_COPY_ERROR",message:o("Errors occurred while copying"),placement:"bottomRight",innerException:d.length?d:void 0,data:{failCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),errors:d.length?d:void 0}})),{successCount:l,failCount:s,errorDetails:d}},[t,r,o]);return{copyItems:n}})(),{refreshFolders:y,refreshFiles:w}=Ui(),{getItemNameById:b,getItemNamesByIds:C,getNamesPreview:I}=Ti(c),F=d(()=>{null==p||p(!0)},[p]),A=d(()=>{null==p||p(!1),null==f||f.resetFields()},[p,f]),_=d(async t=>{var o,r,d,p,F;if(!((null==m?void 0:m.length)||l&&0!==l.size))return;const _=Array.from((null==m?void 0:m.length)?[m]:l),S=_.length;let E=0,x=0;const P=[],R=_.map(e=>c.find(t=>t.id===e)).filter(e=>Boolean(e)),k=R.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let l=t;if(!t){const e=await f.validateFields();l=null==e?void 0:e.targetFolder}if(!l)return void a.error({id:"FILES_COPY_DIRECTORY_NOT_SELECTED",message:i("Select destination folder"),placement:"bottomRight"});const c="folders"===l?null:l,m=null!=c?c:u;let N=R.map(e=>({id:e.id,isFolder:(null==e?void 0:e.isFolder)||e.id.startsWith("folder_")}));const O=!0===(null===(o=null==n?void 0:n.config)||void 0===o?void 0:o.dedupeUploadNamesOnClient);if(O&&(null==g?void 0:g.getFolders))try{const e=await g.getFolders({parentId:c,deep:!1}),t=new Set((e||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean));for(const e of R){if(!e.isFolder&&!(null===(d=(r=e.id).startsWith)||void 0===d?void 0:d.call(r,"folder_")))continue;const o=e.name||b(e.id)||"";if(o&&t.has(o.toLowerCase()))return void a.error({id:"FOLDER_ALREADY_EXISTS_COPY",message:i("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:o,targetFolderId:l}})}}catch(e){console.warn("Could not check folder duplicates for copy:",e)}if(O&&(null==g?void 0:g.getFiles))try{let e=[];const{files:t}=await g.getFiles({folderId:null!=c?c:void 0,itemType:"all",page:1,limit:1e4});if(e=(t||[]).map(e=>e.name).filter(e=>!!e),null==g?void 0:g.getFolders){const t=(await g.getFolders({parentId:c,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);e=[...e,...t]}const o=[...e];N=R.map(e=>{var t,r;if(e.isFolder||(null===(r=(t=e.id).startsWith)||void 0===r?void 0:r.call(t,"folder_")))return{id:e.id,isFolder:!0};const n=R.find(t=>t.id===e.id),i=(null==n?void 0:n.name)||b(e.id)||"",a=Tr(i,o);return o.push(a),{id:e.id,isFolder:!1,newName:a!==i?a:void 0}})}catch(e){console.warn("Could not check duplicates for copy:",e)}else N=R.map(e=>({id:e.id,isFolder:(null==e?void 0:e.isFolder)||e.id.startsWith("folder_")}));const T=await v({items:N,targetFolderId:l,getItemNameById:b,showNotifications:!1});if(E=T.successCount,x=T.failCount,P.push(...T.errorDetails),E>0){const e=C(_),t=I(e),o=t?i("Copied",{names:t}):i("copy_success_summary",{successCount:E,totalCount:S});a.success({id:"FILES_COPY_SUCCESS",message:o,placement:"bottomRight",data:Li(_,E,S,c,e)})}if(x>0){const e=C(_),t=I(e);let o;if(1===S&&P.length>0&&(null===(p=P[0].error)||void 0===p?void 0:p.code)){const e=jn(null===(F=P[0].error)||void 0===F?void 0:F.code,i);o=null!=e?e:t?i("Failed",{names:t}):i("copy_fail_summary",{failCount:x,totalCount:S})}else o=t?i("Failed",{names:t}):i("copy_fail_summary",{failCount:x,totalCount:S});a.error({id:"FILES_COPY_ERROR",message:o,placement:"bottomRight",innerException:P.length?P:void 0,data:Mi(_,x,S,c,P.length?P:void 0,e)})}A(),s(),k&&await y({parentIds:void 0,selectedFolder:m}),await w({fetchFiles:e,selectedFolder:u,page:h.current,limit:h.pageSize})}catch(e){console.error("Error when copying:",e);const t=jn(Bn(e).code,i);a.error({id:"FILES_COPY_ERROR",message:null!=t?t:i("Error copying"),innerException:e,placement:"bottomRight",data:Mi(_,S,S,u||null,[{error:Bn(e)}],C(_))})}},[m,l,f,e,u,h,c,a,i,v,s,p,null===(t=null==n?void 0:n.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient,null==g?void 0:g.getFiles,b]);return{actions:{showCopyModal:F,handleCopyCancel:A,handleCopyOk:_}}},Bi=e=>{const t=Oi(e),o=ji(e),r=Di(e),n=(e=>{const{state:t,actions:o,options:r}=pn(),{t:n}=dr(),i=Tn(),a=ki(e=>e.selectedFiles),l=ki(e=>e.clearSelection),{files:s,selectedFolder:c,pagination:u,currentMenuFile:f}=t,{setIsDeleteConfirmVisible:h,setUndoDeletion:m,setPagination:p}=o,{config:g}=r,{deleteItems:v}=Jn(),{refreshFolders:y,refreshFiles:w}=Ui(),{getItemNameById:b,getItemNamesByIds:C,getNamesPreview:I}=Ti(s),F=d(()=>{null==h||h(!0)},[h]),A=d(()=>{null==h||h(!1)},[h]),_=d(async()=>{var t,o,r;if(!((null==f?void 0:f.length)||a&&0!==a.size))return void(null==h||h(!1));const d=s.length,F=Object.assign({},u),A=Array.from(f?[f]:a),_=A.map(e=>s.find(t=>t.id===e)).filter(e=>Boolean(e)),S=new Set;_.forEach(e=>{(null==e?void 0:e.isFolder)&&S.add((e=>{var t,o;if(!e)return null;const r=e;return null!==(o=null!==(t=r.folderId)&&void 0!==t?t:r.parentId)&&void 0!==o?o:null})(e))});let E=0,x=0;const P=[];try{const a=await v({items:_,selectedFolder:c,getItemNameById:b,showNotifications:!1});E=a.successCount,x=a.failCount,P.push(...a.errorDetails);const s=(null==g?void 0:g.enableTrashFolder)&&"Trash"===c;if(E>0&&(null==g?void 0:g.enableTrashFolder)&&!s&&(null==m||m({itemIds:A,sourceFolderId:c||"folders"})),E>0){const e=A.length;(null==g?void 0:g.enableTrashFolder)&&!s?await i.success({id:"FILES_DELETE_SUCCESS",message:n("moved_to_trash",{count:E}),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:A,folderId:c||null}}):await i.success({id:"FILES_DELETE_SUCCESS",message:n("Files deleted"),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:A,folderId:c||null}})}if(x>0){const e=C(A),r=I(e),a=A.length,l=1===a&&P.length>0&&(null===(t=P[0].error)||void 0===t?void 0:t.code),d=(null==g?void 0:g.enableTrashFolder)&&!s,c=n(d?"При перемещении в корзину произошли ошибки":"При удалении произошли ошибки"),u=l?jn(null===(o=P[0].error)||void 0===o?void 0:o.code,n):void 0,f=null!=u?u:r?n("Failed",{names:r}):c;i.error({id:"FILES_DELETE_ERROR",message:f,placement:"bottomRight",innerException:P.length?P:void 0,data:{failCount:x,isTrashMove:d,totalCount:a,itemNames:e,errors:P.length?P:void 0}})}l(),null==h||h(!1),await y({parentIds:Array.from(S),selectedFolder:c});let u=F.current;if(E>0&&d>0&&E>=d&&F.current>1&&(u=F.current-1),E>0&&F.total>=E){const e=Math.max(0,(null!==(r=F.total)&&void 0!==r?r:0)-E);null==p||p({current:u,pageSize:F.pageSize,total:e})}await w({fetchFiles:e,selectedFolder:c,page:u,limit:F.pageSize})}catch(e){console.error("Error when deleting:",e),i.error({id:"FILES_DELETE_ERROR",message:n("Error deleting"),placement:"bottomRight",innerException:e,data:{failCount:x,totalCount:_.length}})}},[f,a,h,e,c,u,m,p,s,n,i,v,l,null==g?void 0:g.enableTrashFolder]);return{actions:{showDeleteConfirm:F,handleDeleteConfirmCancel:A,handleDeleteConfirmOk:_}}})(e);return{state:t.state,actions:Object.assign(Object.assign(Object.assign(Object.assign({},t.actions),o.actions),r.actions),n.actions)}},zi=()=>{const{state:e}=pn(),{files:t,loading:o,isUrlModalVisible:r}=e,n=Si(),i=(()=>{const{state:e}=pn(),t=e.multiSelect,o=ki(e=>e.selectedFiles),r=ki(e=>e.toggleFileSelection),n=ki(e=>e.setMultiSelect);return a(()=>{n(!1!==t)},[t,n]),{state:{selectedFiles:o},actions:{toggleFileSelection:r}}})(),l=Bi(n.fetchFiles);return{state:{files:t||[],selectedFiles:i.state.selectedFiles,loading:o||!1,isAddingFileByUrl:r||!1,isRenamingFile:l.state.isRenamingFile,fileToRename:l.state.fileToRename},actions:{fetchFiles:n.fetchFiles,handleDeleteFile:n.handleDeleteFile,handleDeleteFolder:n.handleDeleteFolder,handleAddFile:n.handleAddFile,handleAddFileByUrl:n.handleAddFileByUrl,handleDroppedFiles:n.handleDroppedFiles,uploadFileWithProvider:n.uploadFileWithProvider,toggleFileSelection:i.actions.toggleFileSelection,showRenameModal:l.actions.showRenameModal,handleRenameCancel:l.actions.handleRenameCancel,handleRenameOk:l.actions.handleRenameOk,showMoveModal:l.actions.showMoveModal,handleMoveCancel:l.actions.handleMoveCancel,handleMoveOk:l.actions.handleMoveOk,showCopyModal:l.actions.showCopyModal,handleCopyCancel:l.actions.handleCopyCancel,handleCopyOk:l.actions.handleCopyOk,showDeleteConfirm:l.actions.showDeleteConfirm,handleDeleteConfirmCancel:l.actions.handleDeleteConfirmCancel,handleDeleteConfirmOk:l.actions.handleDeleteConfirmOk}}};function qi({maxConcurrent:e=6}={}){const t=c(new Map),o=c([]),r=c(0),n=u(()=>{const n=e=>({status:e.status,shouldLoad:"loading"===e.status||"loaded"===e.status||"error"===e.status}),i=e=>{const t=n(e);e.listeners.forEach(e=>e(t))},a=e=>{0!==o.current.length&&(o.current=o.current.filter(t=>t!==e))},l=(e,o)=>{const r=t.current.get(e);if(!r){const r={id:e,src:o,status:"idle",listeners:new Set,active:!1};return t.current.set(e,r),r}return r.src!==o&&(a(e),r.src=o,r.status="idle"),r},s=()=>{for(;r.current<e&&o.current.length>0;){const e=o.current.shift();if(!e)break;const n=t.current.get(e);n&&n.active&&"queued"===n.status&&(n.status="loading",r.current+=1,i(n))}},d=(e,t)=>{"loading"===e.status&&(e.status=t,r.current=Math.max(0,r.current-1),i(e),s())};return{getSnapshot:(e,t)=>n(l(e,t)),subscribe:(e,o,r)=>{const i=l(e,o);return i.listeners.add(r),r(n(i)),()=>{const o=t.current.get(e);o&&(o.listeners.delete(r),o.active||0!==o.listeners.size||"loading"===o.status||t.current.delete(e))}},setActive:(e,t,n)=>{const d=l(e,t);d.active=n,n?"loaded"!==d.status&&"loading"!==d.status&&"queued"!==d.status?(d.status="queued",i(d),o.current.includes(e)||o.current.push(e),s()):i(d):"queued"===d.status?(a(e),d.status="idle",i(d)):"loading"===d.status&&(r.current=Math.max(0,r.current-1),d.status="idle",i(d),s())},markLoaded:e=>{const o=t.current.get(e);o&&d(o,"loaded")},markError:e=>{const o=t.current.get(e);o&&d(o,"error")},release:e=>{const o=t.current.get(e);o&&(o.active=!1,"queued"===o.status?(a(e),o.status="idle"):"loading"===o.status&&(r.current=Math.max(0,r.current-1),o.status="idle",s()),0===o.listeners.size&&t.current.delete(e))}}},[e]);return a(()=>()=>{o.current=[],t.current.clear(),r.current=0},[]),n}function Vi(e){var t;if(e&&"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQABLAEsAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAAEsAAAAAQAAASwAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAQOgAwAEAAAAAQAAAMoAAAAA/+EJ2Wh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8APD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6c3RvY2s6Mzk2MmU4NTQtNjA1NC00MGZmLWEwYzMtYjJkNjcwMzQ2OWFhIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmE5M2NiZTgyLWI5NjEtNGUzNS1iYmQ0LWJjZWE1Zjc1YTQwZiIvPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/eHBhY2tldCBlbmQ9InciPz4A/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAMoBAwMBIgACEQADEQD/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/3QAEABH/2gAMAwEAAhEDEQA/APsuiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoqG7uIbWB55nCooyTS208VxCssLh0boRQBLRRRQAUUUUAFFFFAH/9D7LooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAqG7uIrWBppnCoo5Jou7iK1gaaZwqKM5NcRq2oXOsXqxQq2wnEcYPX3NABq2oXOr3qwxK3l5xHGO/ua6nw7pzadZ7ZJGaR+WBPA9hUfh7R49Pi82TDXDDkkfd9hWxQAUUUUAFFFFABRRRQB//9H7LooooAKKKKACiiuOv/EOpQX88KNDsSQqMp6H60AdjRXD/wDCTapn70P/AH7/APr0f8JPqn96H/v3/wDXoA7iiuH/AOEn1T+9D/37/wDr0f8ACT6p/eh/79//AF6AO4orh/8AhJ9U/vQ/9+//AK9H/CT6p/eh/wC/f/16AO4orh/+En1T+9D/AN+//r0f8JPqn96H/v3/APXoA7iiuH/4SfVP70P/AH7/APr0f8JPqn96H/v3/wDXoA7iiuH/AOEn1T+9D/37/wDr0f8ACT6p/eh/79//AF6AO4orh/8AhJ9U/vQ/9+//AK9H/CT6p/eh/wC/f/16AO4orh/+En1T+9D/AN+//r0f8JPqn96H/v3/APXoA7iobq4itYHmncIijJJrE0jUdQlt2v8AUJIYrNVyMJgv9Oaw9X1C51e8WGJWMecRxr39zQAatqNzq94kUasELYjjB6/Wul8P6NHp8Qlkw1ww5P8Ad9hWRmDw9bfwTajIv4Riqw8Tap6wf98f/XoA7elrh/8AhJtU/vQ/9+//AK9avhnWL3UL94bgx7BGWG1cdwPX3oA6OiiigAooooAKKKKAP//S+y6KKKACiiigArgHAbxSVYAg3mCD3+eu/rgT/wAjV/2+f+z0Adt9jtMf8esH/fsUfY7T/n1g/wC/Yqeh2CIWY4AGSaAK7WlmqktbQADkkxr/AIVUe50JJPLZ7EN6YWuX17WJr+dkRylurYVQfve5rKJoA9Ghh0+Zd0MVtIvqqKaf9jtP+fWD/v2K89sry4sphLbyFD3HY/Wu+0e9TULFLhQATww9DQBJ9jtP+fWD/v2KattZM7ILe3LL94bF4p99cx2lpJcS/dRc/X2rjdG1eSLWmuZ2Oy4bEnoPQ/hQB2P2O0/59YP+/Yo+x2n/AD6wf9+xU4IPSloAr/Y7T/n1g/79ij7Haf8APrB/37FWKKAK/wBjtP8An1g/79ij7Haf8+sH/fsVYooAr/Y7T/n1g/79ioruPTrWBppoLdUUckxj/Cp7u4itYGnmcKijJJriNX1C61i9EUKtsziOMHr7mgBNVv7jVrxYII/3YOIYl/ma6bw9o8enxCSTD3DDkn+H2FHh/R49Pi8yTDXDDkkfd9hWxQBC9rbOxZ7eJmPUlATTfsdp/wA+sH/fsVYooAztXtbVdLumW3hBELkEIOPlNc74H/5Csv8A1xP8xXUaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5igDs6KKKACiiigAooooA//0/suiiigAooooAK4E/8AI1f9vn/s9d9XAn/kav8At8/9noA72s/xI7R6HdMpwdmPzODWhUN/ALqymt26SIVoA816UlS3ML207wSrtdCQai+lAC11HgN2xdx4+XKH6Hn/AArl++K6jSv+JN4flvJhiWfBRe/Tj+ZNAEHjLUfOnFjEw2R/NJju3Yfl/Oudp0jtJIzucsxJJ96bQB2/hLUftdkLeRh50OF+q9jW3XnOkXrWF/HcDJUHDjPUV6HDIssSSIQVYAg0APooooAKhu7iK1gaeZwqKM5NF3cQ2sDTTOFRRk5riNW1C51i9WKJW8vOI4x39zQAavqF1rF6IYVbZnEcYPX3NdL4e0ePT4hLIA1w45JH3fYUeHtHj0+LzJcNcMOTj7vsK2KACiiigAooooAqaz/yCbz/AK4v/wCgmuX8D/8AIWl/64n+YrqNZ/5BN5/1xf8A9BNcv4H/AOQtL/1xP8xQB2dFFFABRRRQAUUUUAf/1PsuiiigAooooAK4E/8AI1f9vn/s9d9XAn/kav8At8/9noA72lpKWgDO1bSLXUQDKCsg6OvX/wCvWFJ4Tn3fJdxFc8FkOa66igDC0zw3a2riadzPIOeRhR+FYXinUPtl+Yoz+5h+VcdCe5/p+FdH4n1H7DYFYziaX5U9vU1wn40AFFFFABXW+DNR3xtp8x+ZPmjyeo7j/PrXJVNZzva3UdxG2HjbP/1qAPTKhu7iK2gaaZwqKOSahTULf+zFv3bZEybsmuP1XULnV70QxK3l7sRxr39zQAmrahc6xerFEreXnEcY7+5rpfD2jx6fF5suGuGHJx932FHh7R49PiEkuGuGHJ/u+wrYoAKKKKACiiigAooooAqaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5iuo1n/AJBN5/1xf/0E1y/gf/kLS/8AXE/zFAHZ0UUUAFFFFABRRRQB/9X7LooooAKKKKACuBP/ACNX/b5/7PXfVwJ/5Gr/ALfP/Z6AO9paSloAKazBVZicBRkmnVz3jHUfs9qLOJsSy/ex2XvQBzuu351DUXlDfu1+WMewqhRRQAUUUv40AFbGi6ZG8TahqB8uzTkA9ZP/AK1Gi6ZG8TajqJ2WcfIB/wCWn/1qi1W+uNWu0hhQiIHbFEv86ADU7+fVbpIIU2xZ2xRL/M103h7R00+LzZcPcMOTj7vsKyCYfD9sQNsupSr+EY/z+ddDot8uoWCTj7/Rx6N3oAvUUUUAFZ17rFta6jDZydZPvNnhPTNSaxqEWn2bTv8AM3RF9TXntxLJPK8sp3O5yx9TQB6dmlrA8Kar9qg+yzt+/jHBP8QrfoAKKKKAKms/8gm8/wCuL/8AoJrl/A//ACFpf+uJ/mK6jWf+QTef9cX/APQTXL+B/wDkLS/9cT/MUAdnRRRQAUUUUAFFFFAH/9b7LooooAKKKKACuBP/ACNX/b5/7PXfVwJ/5Gr/ALfP/Z6AO9paSloAjuZo7eB5pThEGSa851G6e9vJLl+rngeg7Ct/xpqOWXT4m6fNLj9B/X8q5mgBKKKO9AADzWzoumRvEdQ1A7LOPkA/8tP/AK1JoulxvE2oagQlnHyAf+Wn/wBaotVv59WukhhjIizthiX+dABql/catdJBDGRHnbDEv86vkweH7bHyy6jKv4Rj/P8An0UmDw/bEfLLqMq/hGP8/n/Ln5JHlkaSRi7scsx70AEkjySNLIxd2OWY961fCuo/Y78RSNiGY7T7Hsax6WgD1EGmyuscbSOwVVBJPoKy/DGofbrABzmaLCvk9fQ1k+MNU3MdPgY4X/WkevpQBla7qLajel84iTiMe3rWdS0lAEtrPJbXMdxC2HQ5HvXoWlXsd/ZpPGevDD0PevOK0/D2pHTr0FiTBJgOP60Ad/RTUYOoZSCCMg06gCprP/IJvP8Ari//AKCa5fwP/wAhaX/rif5iuo1n/kE3n/XF/wD0E1y/gf8A5C0v/XE/zFAHZ0UUUAFFFFABRRRQB//X+y6KKKACiiigArgT/wAjV/2+f+z131cCf+Rq/wC3z/2egDvarapeJY2Mlw/8I+UZ6nsKs1xni7UftN39ljb91Eecd2/z/WgDFnlknmeaRsu5JJqOigdeKAFrX0XS43iOoagQlnHyAf8Alp/9al0XTI3ibUNQISzj5Ab/AJaf/WqHVb+41a6SGGMrEDtiiX+dAC6rfT6tdJBChEWdsMS/zq+TB4ftj92XUZV/CMf5/P8AkhMPh+2x8suoyr+EY/z+f8sCSR5ZGlkYu7HLMe9ABJI8sjSSMXdjlmPemUUUAFLSUUAWtOvp7CZ5YD8zIVOenNVmJZixJJPUmkooAKKKKAClFJRQB1Pg/VOBp87Dj/VEn9K6jPFeYRs0bh0JDqQQR2Nd7oGpJqNkGJxKnEg/rQBY1n/kE3n/AFxf/wBBNcv4H/5C0v8A1xP8xXUaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5igDs6KKKACiiigAooooA//0PsuiiigAooooAK4E/8AI1f9vn/s9d8a89u5RB4hlnYEiO5LkDvhs0Adtq808Ni7W0TyTEbUCjkE964c6TqhJJspyTySVroB4stsY+xzf99Cj/hK7X/nzl/76FAHPnSdTx/x4z/981d0zRvL33eqr5NtFztbq5/wro7PVo5rF72SB7eBfutIcbvpXLatqFzq94IokYpnEca859zQAmq31xq12sEEZEQOIol/nWxBYzaPZeZBavc30oxlVyIxUVsbLw6i+epuL1wCyp/AP6VY/wCEstv+fSb/AL6FAGBLpmrSyNJJZ3DuxyzFetN/sjU/+fGf/vmug/4Su1/585f++hR/wldr/wA+cv8A30KAOf8A7I1P/nxn/wC+aP7I1P8A58Z/++a6D/hK7X/nzl/76FH/AAldr/z5y/8AfQoA5/8AsjU/+fGf/vmj+yNT/wCfGf8A75roP+Ertf8Anzl/76FH/CV2v/PnL/30KAOf/sjU/wDnxn/75o/sjU/+fGf/AL5roP8AhK7X/nzl/wC+hR/wldr/AM+cv/fQoA5/+yNT/wCfGf8A75o/sjU/+fGf/vmug/4Su1/585f++hR/wldr/wA+cv8A30KAOf8A7I1P/nxn/wC+aP7I1P8A58Z/++a6D/hK7X/nzl/76FH/AAldr/z5y/8AfQoA5/8AsjU/+fGf/vmrmkW+r6ferOllPtzh12n5hWp/wldr/wA+cv8A30KP+Ertf+fOX/voUAa+rNu0a6bBGYGOD1HymuZ8D/8AIWl/64n+YqzfeJre4spoBayqZI2UEkcZGKreB/8AkKyn/pif5igDs6KKKACiiigAooooA//R+y6KKKACiiigArHn8OadPO80nm73YscNjknNbFFAGJ/wjGmf9N/+/lRXGg6NZxG4nMnlpyQ0mQfatq7uIrWBppnCoozk1xGrajdaxeLFCh2E4jjHf3NACapfT6tdpBDGfKU4hjUfrXTeH9HTT4vNkw1yw5JH3fYUeHtHj0+LzZMNcMOSR932FbFAGNL4b0+WRpJXuHdjks0nJNN/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTPSf/v5VrTNGs9PnM1v5m4qVO5s8ZB/pWjRQAUUUUAFFFFABRRRQB//0vsuiiigAooooAKhu7mK1t2nmYKijkmpq5fxda6jNcReXukgYgBVHQ+9AGVq2oXOsXqxRK2zdiNB39zXS+H9Hj0+ISSYa4Ycn+77Cjw/o8enxebLhrhhySPu+wrYoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/9P7LooooAKKKKACkxS0UAFFFFABRRTW6D6igB1FN7n8KQE+YRQA+iiigAopsnEZI64pR90UALRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAH//2Q=="!==e){if(e.startsWith("data:image/")){const t=e.split(",")[1];return t&&t.length>20?e:void 0}return e.startsWith("blob:")?e:e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?null!==(t=(e=>{if(e&&"string"==typeof e){if(e.startsWith("data:")||e.startsWith("blob:"))return e;try{if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")){const t=new URL(e.startsWith("/")?`https://x${e}`:e),o=e.startsWith("/")?"":`${t.protocol}//${t.host}`,r=t.pathname.split("/").map(e=>{if(!e)return"";try{return encodeURIComponent(decodeURIComponent(e))}catch(t){return encodeURIComponent(e)}}).join("/");return e.startsWith("/")?r+(t.search||"")+(t.hash||""):`${o}${r}${t.search}${t.hash}`}}catch(e){}return e}})(e))&&void 0!==t?t:e:void 0}}function Wi(e,t){var o;if(!e)return null;const r=Vi(null!==(o=e.src)&&void 0!==o?o:void 0);return e.exhausted?Object.assign(Object.assign({},e),{src:null}):r?Object.assign(Object.assign({},e),{src:r}):Object.assign(Object.assign({},e),{src:null!=t?t:null,changed:!1,reason:"unchanged"})}function Hi(e){var t;const{options:o}=pn(),r=null===(t=o.config)||void 0===t?void 0:t.getProxiedUrl,n=c([]),l=c(!1),s=c(0),f=c(null),[h,m]=i(!1),p=u(()=>{const t=e.map(e=>Vi(e)).filter((e,t,o)=>Boolean(e)&&o.indexOf(e)===t);return(o=n.current)===(r=t)||o.length===r.length&&o.every((e,t)=>e===r[t])?n.current:(n.current=t,t);var o,r},[e]),[g,v]=i([]),[y,w]=i(0);a(()=>{let e=!1;if(w(0),l.current=!1,s.current=0,f.current=null,m(!1),0!==p.length)return(async()=>{const t=await Promise.all(p.map(async e=>{if(!r||!(t=e).startsWith("http://")&&!t.startsWith("https://"))return[{originalSrc:e,src:e}];var t;try{const t=await Promise.resolve(r(e)),o=Vi(null==t?void 0:t.src);return o?[{originalSrc:e,src:o,stabilityKey:t.stabilityKey,handleChangeSrc:t.handleChangeSrc,handleSuccess:t.handleSuccess,handleError:t.handleError,subscribeToSrcChange:t.subscribeToSrcChange}]:[{originalSrc:e,src:e}]}catch(t){return[{originalSrc:e,src:e}]}}));if(!e){const e=function(e){const t=new Set;return e.filter(e=>!(!e.src||t.has(e.src)||(t.add(e.src),0)))}(t.flat());v(t=>function(e,t){return e===t||e.length===t.length&&e.every((e,o)=>{const r=t[o];return e.originalSrc===r.originalSrc&&e.src===r.src&&e.stabilityKey===r.stabilityKey})}(t,e)?t:e)}})(),()=>{e=!0};v(e=>0===e.length?e:[])},[r,p]);const b=g[y];a(()=>{if(!(null==b?void 0:b.subscribeToSrcChange))return;let e,t=!1;return Promise.resolve(b.subscribeToSrcChange(e=>{if(t||l.current)return;const o=Wi(e,b.src);(null==o?void 0:o.changed)&&o.src&&!t&&v(e=>e.map((e,t)=>t===y?Object.assign(Object.assign({},e),{src:o.src}):e))})).then(o=>{t?null==o||o():e=o}),()=>{t=!0,null==e||e()}},[b,y]),a(()=>{var e;if(!(null==b?void 0:b.handleChangeSrc))return;if(l.current)return;const t=`${b.originalSrc}::${null!==(e=b.stabilityKey)&&void 0!==e?e:""}::${y}`;if(f.current===t)return;f.current=t;let o=!1;return Promise.resolve(b.handleChangeSrc()).then(e=>{const t=Wi(e,b.src);(null==t?void 0:t.changed)&&t.src&&!o&&v(e=>e.map((e,o)=>o===y?Object.assign(Object.assign({},e),{src:t.src}):e))}),()=>{o=!0}},[b,y]);const C=d(async()=>{var e;if(!(null==b?void 0:b.handleChangeSrc))return{src:null!==(e=null==b?void 0:b.src)&&void 0!==e?e:null,changed:!1,exhausted:!1,reason:"unchanged"};if(l.current)return{src:null,changed:!1,exhausted:!0,reason:"exhausted"};const t=Wi(await Promise.resolve(b.handleChangeSrc()),b.src);return(null==t?void 0:t.changed)&&t.src&&t.src!==b.src?(v(e=>e.map((e,o)=>o===y?Object.assign(Object.assign({},e),{src:t.src}):e)),t):null!=t?t:{src:b.src,changed:!1,exhausted:!1,reason:"unchanged"}},[b,y]),I=d(async()=>{var e,t;if(l.current)return{src:null,changed:!1,exhausted:!0,reason:"exhausted"};if(!b)return l.current=!0,m(!0),{src:null,changed:!1,exhausted:!0,reason:"exhausted"};const o=(r=g.length,Math.max(8,6*r));var r;if(s.current>=o)return l.current=!0,m(!0),{src:null,changed:!1,exhausted:!0,reason:"exhausted"};s.current+=1;const n=b.handleError?Wi(await Promise.resolve(b.handleError()),b.src):null;return(null==n?void 0:n.exhausted)?(l.current=!0,m(!0),n):(null==n?void 0:n.changed)&&n.src&&n.src!==b.src?(v(e=>e.map((e,t)=>t===y?Object.assign(Object.assign({},e),{src:n.src}):e)),n):y+1>=g.length?(l.current=!0,m(!0),null!=n?n:{src:null,changed:!1,exhausted:!0,reason:"exhausted"}):(w(e=>e+1),{src:null!==(t=null===(e=g[y+1])||void 0===e?void 0:e.src)&&void 0!==t?t:null,changed:!0,exhausted:!1,reason:"candidate-fallback"})},[b,y,g]),F=d(()=>{var e;l.current||b&&(s.current=0,null===(e=b.handleSuccess)||void 0===e||e.call(b))},[b]);return{src:h||null==b?void 0:b.src,hasNextCandidate:y+1<g.length,handleError:I,handleLoad:F,handleChangeSrc:C}}const $i=/(auto|scroll|overlay)/;function Gi(e,t){const o=Math.max(0,null!=t?t:e.clientWidth);return Math.max(1,Math.round(o-function(e){if("undefined"==typeof window)return 0;const t=window.getComputedStyle(e);return(Number.parseFloat(t.paddingLeft||"0")||0)+(Number.parseFloat(t.paddingRight||"0")||0)}(e)))}function Ki(e){if("undefined"==typeof window)return!1;const t=window.getComputedStyle(e);return $i.test(t.overflowY)||$i.test(t.overflow)||$i.test(t.overflowX)}function Qi(e){if("undefined"==typeof window)return e;let t=e;for(;t;){if(Ki(t))return t;t=t.parentElement}return null}function Ji(e){if("undefined"==typeof window)return[e];const t=Qi(e);return t?t===e?[window,e]:[window,t]:[window]}function Yi(e,t,o){Math.max(0,e.clientHeight),Math.max(0,Math.round(e.getBoundingClientRect().height));return Math.max(1,t)}function Zi(e,t){if(e===t){const o=function(e){var t;if("undefined"==typeof window)return Math.max(1,e.clientHeight);const o=e.getBoundingClientRect(),r=window.innerHeight||(null===(t=document.documentElement)||void 0===t?void 0:t.clientHeight)||0,n=Math.max(0,o.top),i=Math.min(r,o.bottom);return Math.max(0,Math.round(i-n))}(t);return{scrollTop:t.scrollTop,viewportHeight:Yi(e,Math.min(t.clientHeight,o||t.clientHeight)),viewportWidth:Gi(t),scrollHeight:e.scrollHeight}}const o=t.getBoundingClientRect(),r=e.getBoundingClientRect(),n=Math.max(o.top,r.top),i=Math.min(o.bottom,r.bottom),a=Math.max(o.left,r.left),l=Math.min(o.right,r.right),s=Math.max(0,Math.round(i-n)),d=Math.max(0,Math.round(l-a));return{scrollTop:Math.max(0,Math.round(n-r.top)),viewportHeight:Yi(e,s),viewportWidth:Gi(e,d||t.clientWidth||e.clientWidth),scrollHeight:e.scrollHeight}}function Xi(e){if("undefined"==typeof window)return{scrollTop:e.scrollTop,viewportHeight:Math.max(1,e.clientHeight),viewportWidth:Gi(e),scrollHeight:e.scrollHeight};const t=Qi(e);return t&&function(e){return e.scrollHeight-e.clientHeight>1}(t)?Zi(e,t):function(e){var t,o;const r=e.getBoundingClientRect(),n=window.innerHeight||(null===(t=document.documentElement)||void 0===t?void 0:t.clientHeight)||0,i=window.innerWidth||(null===(o=document.documentElement)||void 0===o?void 0:o.clientWidth)||r.width,a=Math.max(0,r.top),l=Math.min(n,r.bottom),s=Math.max(0,Math.round(l-a));return{scrollTop:Math.max(0,Math.round(-r.top)),viewportHeight:Yi(e,s),viewportWidth:Gi(e,Math.min(Math.round(r.width),i)),scrollHeight:e.scrollHeight}}(e)}function ea(e,t){const o=c(null),r=d(t=>{e(Xi(t))},[e]);return a(()=>{o.current&&r(o.current)},[r,...t]),a(()=>{if(!o.current||"undefined"==typeof ResizeObserver)return;const e=o.current,t=new ResizeObserver(()=>{r(e)});return t.observe(e),()=>t.disconnect()},[r]),a(()=>{const e=o.current;if(!e)return;const t=()=>{r(e)},n=Ji(e);return n.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{n.forEach(e=>{e.removeEventListener("scroll",t)})}},[r,...t]),o}const ta=({onSearch:t,placeholder:o,className:r})=>{const{t:n}=dr(),[l,s]=i(""),d=c(null),{options:u}=pn(),{config:f}=u,h=o||n("Search files...");a(()=>(d.current=En.debounce(e=>{t(e)},500),()=>{var e;null===(e=d.current)||void 0===e||e.cancel()}),[t]);return e(I,{value:l,onChange:e=>{var t;const o=e.target.value;s(o),null===(t=d.current)||void 0===t||t.call(d,o)},placeholder:h,prefix:e(Ae,{size:16,strokeWidth:null==f?void 0:f.iconStrokeWidth}),className:r,allowClear:!0,onClear:()=>{s(""),t("")}})},oa=[{value:"date-desc",labelKey:"Newest first"},{value:"date-asc",labelKey:"Oldest first"},{value:"size-desc",labelKey:"Largest first"},{value:"size-asc",labelKey:"Smallest first"},{value:"name-asc",labelKey:"A-Z"},{value:"name-desc",labelKey:"Z-A"},{value:"type-asc",labelKey:"By type"}];var ra={contentLayout:"contentLayout",headerContainer:"headerContainer",actionsContainer:"actionsContainer",filesContainer:"filesContainer",filesLoadingOverlay:"filesLoadingOverlay",emptyStateWrapper:"emptyStateWrapper",paginationContainer:"paginationContainer",uploadIcon:"uploadIcon",tableContainer:"tableContainer",tableLoadingWrapper:"tableLoadingWrapper",imagePreview:"imagePreview",fileManagerTableFolder:"fileManagerTableFolder",fileManagerTableFolderInner:"fileManagerTableFolderInner",sortSelect:"sortSelect",fileNameCol:"fileNameCol",fileItemCount:"fileItemCount",fileSize:"fileSize",fileDate:"fileDate",tableMenu:"tableMenu",tableImagePreview:"tableImagePreview",tableFolderIcon:"tableFolderIcon",buttonDeselected:"buttonDeselected",buttonSelectAll:"buttonSelectAll",gridRow:"gridRow",gridCard:"gridCard",selectedRow:"selectedRow",gridCardSelected:"gridCardSelected",gridCheckbox:"gridCheckbox",gridCardContent:"gridCardContent",gridPreviewContainer:"gridPreviewContainer",gridPreviewContainerFolder:"gridPreviewContainerFolder",gridFolderIcon:"gridFolderIcon",gridFolderIconImage:"gridFolderIconImage",gridFileName:"gridFileName",gridFileInfo:"gridFileInfo",gridFileMenu:"gridFileMenu",gridFileMenuButton:"gridFileMenuButton",actionsBox:"actionsBox",uploadContainer:"uploadContainer",uploadArea:"uploadArea",blockText:"blockText",textTitle:"textTitle",textDescription:"textDescription",buttons:"buttons",btnAi:"btnAi",btnPhoto:"btnPhoto",dragOverlay:"dragOverlay",dragOverlayInner:"dragOverlayInner",dragCaptureLayer:"dragCaptureLayer",dragOverlayGlobal:"dragOverlayGlobal",noFiles:"noFiles",noFilesIcon:"noFilesIcon",textTitle_trash:"textTitle_trash",textDescription_trash:"textDescription_trash"};const{Text:na}=F,{Option:ia}=A;const aa=n.memo(({files:o,filesById:r,currentSortOption:n,isSmallScreen:i,iconStrokeWidth:a,multiSelectEnabled:l=!0,features:s,viewMode:d,setViewMode:c,handleSearch:f,handleSortOptionChange:h,sortOptions:m,onClearSelection:p,onRename:g,onDelete:v,onCopy:y,onMove:w,onEdit:b,t:C})=>{const I=u(()=>(null==m?void 0:m.length)?oa.filter(e=>m.includes(e.value)):oa,[m]),F=u(()=>I.map(e=>e.value).join("|")||"all",[I]),P=ki(e=>e.selectedFiles),R=ki(e=>e.selectedFiles.size),k=ki(e=>e.selectAllVisible),N=o.length>0&&R===o.length,O=u(()=>Array.from(P)[0],[P]),T=u(()=>O?r.get(O):void 0,[r,O]),L=(null==T?void 0:T.isFolder)?!1!==(null==s?void 0:s.enableRenameFolder):!1!==(null==s?void 0:s.enableRenameFile),M=u(()=>Array.from(P).every(e=>{const t=r.get(e);return!!t&&(t.isFolder?!1!==(null==s?void 0:s.enableMoveFolder):!1!==(null==s?void 0:s.enableMoveItem))}),[s,r,P]),U=u(()=>Array.from(P).every(e=>{const t=r.get(e);return!!t&&(t.isFolder?!1!==(null==s?void 0:s.enableCopyFolder):!1!==(null==s?void 0:s.enableCopyItem))}),[s,r,P]),j=u(()=>1===R&&function(e){var t,o,r;if(!e||e.isFolder)return!1;const n=e.extension||(e.name&&e.name.includes(".")?e.name.split(".").pop():void 0)||((null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))?null===(r=null===(o=e.type.split("/")[1])||void 0===o?void 0:o.split(";")[0])||void 0===r?void 0:r.trim():void 0);return Boolean(n&&bt.includes(n.toLowerCase()))}(T),[R,T]);return t("div",R>0?{className:`header-container ${ra.headerContainer}`,children:[t(na,{type:"secondary",className:"selected-text",children:[t("div",{children:[R," ",C("selected")]}),l&&e(_,{title:i?C("Select all"):null,children:e(S,{className:ra.buttonSelectAll,onClick:k,disabled:N||0===o.length,children:C("Select all")})}),e(_,{title:i?C("Deselected"):null,children:e(S,{className:ra.buttonDeselected,icon:e(_e,{size:16,strokeWidth:a}),onClick:p,children:C("Deselected")})})]}),t(E,{children:[j&&!1!==(null==s?void 0:s.enableEdit)&&e(_,{title:i?C("Edit"):null,children:e(S,{icon:e(Se,{size:16,strokeWidth:a}),onClick:()=>b(T),disabled:!j,children:C("Edit")})}),M&&e(_,{title:i?C("Move to"):null,children:e(S,{icon:e(Ee,{size:16,strokeWidth:a}),onClick:w,children:C("Move to")})}),U&&e(_,{title:i?C("Copy"):null,children:e(S,{icon:e(xe,{size:16,strokeWidth:a}),onClick:y,children:C("Copy")})}),1===R&&L&&e(_,{title:i?C("Rename"):null,children:e(S,{icon:e(Pe,{size:16,strokeWidth:a}),onClick:()=>g(),disabled:1!==R||!L,children:C("Rename")})}),!1!==(null==s?void 0:s.enableDelete)&&e(_,{title:i?C("Delete"):null,children:e(S,{danger:!0,icon:e(Re,{size:16,strokeWidth:a}),onClick:e=>{e.stopPropagation(),e.preventDefault(),v()},children:C("Delete")})})]})]}:{className:ra.headerContainer,children:[e("div",{className:"search-container",children:e(ta,{placeholder:C("Search file or folder"),onSearch:f,className:ra.searchInput})}),t("div",{className:ra.actionsBox,children:[e("div",{className:"sort-container",children:e(A,{value:n,onChange:h,className:ra.sortSelect,popupMatchSelectWidth:!1,suffixIcon:e(ke,{size:16,strokeWidth:a}),children:I.map(({value:t,labelKey:o})=>e(ia,{value:t,children:C(o)},t))},F)}),e("div",{className:ra.actionsContainer,children:e(x,{options:[{value:"grid",icon:e(Ne,{size:16,strokeWidth:a})},{value:"table",icon:e(Oe,{size:20,strokeWidth:a})}],value:d,onChange:e=>c(e)})})]})]})});aa.displayName="FileContentHeader";const la=n.memo(({fileId:t,style:o})=>{const r=ki(e=>e.selectedFiles.has(t)),n=ki(e=>e.toggleFileSelection);return e(P,{checked:r,style:o,onClick:e=>{e.stopPropagation()},onChange:e=>{const o=e.nativeEvent;n(t,{metaKey:o.metaKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,forceToggle:!0})}})});la.displayName="FileSelectionCheckbox";const sa=n.memo(t=>{var{className:o}=t,r=kn(t,["className"]);const n=r["data-row-key"],i=null==n?"":String(n),a=[o,ki(e=>!!i&&e.selectedFiles.has(i))?ra.selectedRow:""].filter(Boolean).join(" ");return e("tr",Object.assign({},r,{className:a}))});sa.displayName="SelectableTableRow";const da=n.memo(({item:t,variant:o="table",t:r,iconStrokeWidth:n,setCurrentMenuFile:a,showMoveModal:l,showCopyModal:s,showRenameModal:c,showDeleteConfirm:f,onEdit:h})=>{const[m,p]=i(!1),g=u(()=>{if(!m)return[];const o=[];return t.canEdit&&o.push({key:"edit",label:r("Edit"),icon:e(Se,{size:16,strokeWidth:n})}),t.canMove&&o.push({key:"move",label:r("Move to"),icon:e(Ee,{size:16,strokeWidth:n})}),t.canCopy&&o.push({key:"copy",label:r("Copy"),icon:e(xe,{size:16,strokeWidth:n})}),t.canRename&&o.push({key:"rename",label:r("Rename"),icon:e(Pe,{size:16,strokeWidth:n})}),t.canDelete&&o.push({key:"delete",label:r("Delete"),icon:e(Re,{size:16,strokeWidth:n}),style:{color:"#ff4d4f"}}),o},[n,m,t.canCopy,t.canDelete,t.canEdit,t.canMove,t.canRename,r]),v=d(({key:e})=>{switch(t.id&&(null==a||a(t.id)),e){case"edit":h(t.file);break;case"move":l();break;case"copy":s();break;case"rename":c(t.id);break;case"delete":null==f||f();break;default:null==a||a("")}},[t,h,a,s,f,l,c]),y=u(()=>({items:g,onClick:v}),[v,g]);return e(R,{arrow:!0,placement:"bottom",menu:y,trigger:["hover"],onOpenChange:p,children:"grid"===o?e(S,{type:"default",className:`${ra.gridFileMenuButton} gridFileMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(Te,{size:16,strokeWidth:n})}):e("span",{className:`${ra.tableMenu} tableMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(Te,{size:16,strokeWidth:n})})})});da.displayName="FileItemActionsDropdown";const ca=({thumbnailSrc:t,previewSrc:o,lightboxSrc:r,alt:i,className:l,width:s,height:f,preview:h=!1})=>{var m,p;const g=u(()=>[t,o],[t,o]),v=u(()=>[r,o,t],[r,o,t]),y=Hi(g),w=Hi(v),{handleError:b,handleLoad:C}=w,I=null!==(m=y.src)&&void 0!==m?m:wt,F=null!==(p=w.src)&&void 0!==p?p:y.src,A=c(!1);a(()=>{A.current=!1},[F]);const _=d(e=>n.cloneElement(e,{key:null!=F?F:wt,src:null!=F?F:wt,fallback:void 0,onError:()=>{A.current||(A.current=!0,b().finally(()=>{A.current=!1}).catch(()=>{}))},onLoad:()=>{C()}}),[F,b,C]),S=u(()=>!(!h||!F)&&{src:F,actionsRender:()=>null,destroyOnHidden:!0,cover:e(de,{style:{fontSize:"20px"}}),imageRender:_},[h,F,_]);return e(k,{className:l,src:I,alt:i,width:s,height:f,preview:S,onLoad:y.handleLoad,onError:()=>{y.handleError().catch(()=>{})},fallback:wt})},ua=n.memo(({item:t,variant:o="table",FolderIcon:r,getFileData:n,className:i,width:a,height:l})=>t.isFolder?e("div","grid"===o?{className:ra.gridFolderIcon,children:e(r,{className:ra.gridFolderIconImage})}:{className:ra.fileManagerTableFolder,children:e("div",{className:ra.fileManagerTableFolderInner,children:e(r,{className:ra.tableFolderIcon,style:{width:null!=a?a:40,height:null!=l?l:40}})})}):t.thumbnailSrc||t.previewSrc?e(ca,{className:i,thumbnailSrc:t.thumbnailSrc,previewSrc:t.previewSrc,lightboxSrc:t.lightboxSrc,alt:t.file.name,width:a,height:l,preview:!0,file:t.file,getFileData:n}):null);ua.displayName="FileItemPreview";const fa=[".ant-image",".ant-image-preview-root",".ant-image-preview-wrap",".ant-image-preview-mask",".ant-image-preview-close",".ant-image-preview-operations"].join(","),ha=e=>Boolean(e.closest(fa));function ma(e){var t,o,r;if(e.isFolder)return!1;const n="string"==typeof e.name?e.name:"",i=n?null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase():void 0,a=null!==(r=null===(o=e.extension)||void 0===o?void 0:o.toLowerCase())&&void 0!==r?r:i;return"string"==typeof e.type&&e.type.startsWith("image/")||"string"==typeof a&&Ct.includes(a)}const pa=n.memo(({item:o,t:r,iconStrokeWidth:n,FolderIcon:i,handleItemClick:a,setCurrentMenuFile:l,showMoveModal:s,showCopyModal:c,showRenameModal:u,showDeleteConfirm:f,onEdit:h,onEditorOk:m,getFileData:p,showSelectionCheckbox:g=!0})=>{const v=ki(e=>e.selectedFiles.has(o.id)),y=d(e=>{const t=e.target;t.closest(".gridFileMenuButton")||t.closest(".ant-dropdown-menu")||ha(t)||1===e.detail&&(o.isFolder?a(o.file):m&&ma(o.file)&&m(o.file))},[a,o.file,o.isFolder,m]);return e(N,{className:ra.gridCard_col,style:{padding:0},children:t(O,{hoverable:!0,cover:e("div",{className:o.isFolder?ra.gridPreviewContainerFolder:ra.gridPreviewContainer,onClick:e=>{e.stopPropagation(),y(e)},children:e(ua,{item:o,variant:"grid",FolderIcon:i,getFileData:p,className:ra.gridImagePreview})}),className:`${ra.gridCard} ${v?ra.gridCardSelected:""}`,onClick:e=>{e.stopPropagation(),e.preventDefault(),y(e)},children:[t("div",{className:ra.gridCardContent,onClick:e=>{e.stopPropagation(),e.preventDefault(),y(e)},children:[e("div",{className:ra.gridFileName,children:o.nameText||r("Untitled")}),e("div",{className:ra.gridFileInfo,children:o.gridInfoText})]}),e("div",{className:ra.gridFileMenu,onClick:e=>{e.stopPropagation()},children:e(da,{item:o,variant:"grid",t:r,iconStrokeWidth:n,setCurrentMenuFile:l,showMoveModal:s,showCopyModal:c,showRenameModal:u,showDeleteConfirm:f,onEdit:h})}),g?e("div",{onClick:e=>{e.stopPropagation()},className:ra.gridCheckbox,children:e(la,{fileId:o.id,style:{height:20}})}):null]})})});pa.displayName="FileGridItem";const ga=n.memo(({rows:t,topOffset:r=0,bottomOffset:n=0,t:i,iconStrokeWidth:a,FolderIcon:l,handleItemClick:s,setCurrentMenuFile:d,showMoveModal:c,showCopyModal:u,showRenameModal:f,showDeleteConfirm:h,onEdit:m,onEditorOk:p,getFileData:g,showSelectionCheckbox:v=!0})=>e(o,{children:e("div",{style:{paddingTop:r,paddingBottom:n},children:e(T,{gutter:[16,16],className:ra.gridRow,style:{gap:20,padding:"0 24px 24px",margin:0},children:t.map(t=>e(pa,{item:t,handleItemClick:s,iconStrokeWidth:a,t:i,FolderIcon:l,setCurrentMenuFile:d,showMoveModal:c,showCopyModal:u,showRenameModal:f,showDeleteConfirm:h,onEdit:m,onEditorOk:p,getFileData:g,showSelectionCheckbox:v},t.id))})})}));ga.displayName="FileGridView";const va=n.memo(({rows:t,columns:r,topOffset:n=0,bottomOffset:i=0,onRow:a,components:l})=>{const s=u(()=>e("div",{style:{paddingTop:n,paddingBottom:i},children:e(w,{renderEmpty:()=>e(M,{image:e(o,{}),description:""}),children:e(L,{dataSource:t,columns:r,rowKey:"id",pagination:!1,tableLayout:"fixed",onRow:a,components:l,showHeader:!1})})}),[i,r,l,a,t,n]);return e("div",{className:ra.tableLoadingWrapper,children:s})});va.displayName="FileTableView";const ya=n.memo(({item:t})=>t.dateText?e(_,{title:t.dateText,placement:"bottom",className:ra.fileDate,children:t.dateText}):null);ya.displayName="FileItemDate";const wa=n.memo(({item:o})=>t("div",{className:ra.fileName,children:[o.nameText,o.isFolder&&e("div",{className:ra.fileItemCount,children:o.folderItemsText})]}));wa.displayName="FileItemName";const ba="filemanager_view_mode";class Ca{constructor(){this.rowsById=new Map}reconcile(e,t,o){const r=new Map,n=[];for(const i of e){const e=t.getId(i),a=t.buildSignature(i,o),l=this.rowsById.get(e);if(l&&l.signature===a){r.set(e,l),n.push(l);continue}const s=t.buildRowModel(i,o,{id:e,signature:a});r.set(e,s),n.push(s)}return this.rowsById=r,n}}class Ia{createRenderWindow(e,t){var o,r,n,i,a,l,s,d,c,u,f,h,m,p,g,v,y,w,b,C,I,F,A,_,S;const E=null!==(o=null==t?void 0:t.renderStrategy)&&void 0!==o?o:"full";if("windowed"!==E){if("positioned"===E){const o=null!==(n=null===(r=null==t?void 0:t.positioned)||void 0===r?void 0:r.layout)&&void 0!==n?n:[],v=null!==(a=null===(i=null==t?void 0:t.positioned)||void 0===i?void 0:i.viewportTop)&&void 0!==a?a:0,y=null!==(s=null===(l=null==t?void 0:t.positioned)||void 0===l?void 0:l.viewportBottom)&&void 0!==s?s:Number.MAX_SAFE_INTEGER,w=Math.max(0,null!==(c=null===(d=null==t?void 0:t.positioned)||void 0===d?void 0:d.overscanPx)&&void 0!==c?c:0),b=Math.max(0,null!==(f=null===(u=null==t?void 0:t.positioned)||void 0===u?void 0:u.containerHeight)&&void 0!==f?f:0),C=o.filter(e=>e.bottom>=v-w&&e.top<=y+w).map(t=>({row:e[t.index],layout:t})).filter(e=>Boolean(e.row)),I=null!==(m=null===(h=C[0])||void 0===h?void 0:h.layout.index)&&void 0!==m?m:-1,F=null!==(g=null===(p=C[C.length-1])||void 0===p?void 0:p.layout.index)&&void 0!==g?g:-1;return{rows:C.map(e=>e.row),startIndex:I,endIndex:F,topOffset:0,bottomOffset:0,totalCount:e.length,containerHeight:b,positionedItems:C}}return{rows:e,startIndex:0,endIndex:e.length>0?e.length-1:-1,topOffset:0,bottomOffset:0,totalCount:e.length}}const x=Math.max(0,null!==(y=null===(v=null==t?void 0:t.windowed)||void 0===v?void 0:v.startIndex)&&void 0!==y?y:0),P=null!==(b=null===(w=null==t?void 0:t.windowed)||void 0===w?void 0:w.endIndex)&&void 0!==b?b:e.length-1,R=Math.max(0,null!==(I=null===(C=null==t?void 0:t.windowed)||void 0===C?void 0:C.overscan)&&void 0!==I?I:0),k=Math.max(1,null!==(A=null===(F=null==t?void 0:t.windowed)||void 0===F?void 0:F.estimatedItemSize)&&void 0!==A?A:1),N=Math.max(1,null!==(S=null===(_=null==t?void 0:t.windowed)||void 0===_?void 0:_.itemsPerLane)&&void 0!==S?S:1),O=Math.ceil(e.length/N),T=Math.min(e.length-1,P),L=Math.floor(x/N),M=Math.floor(Math.max(x,T)/N),U=Math.max(0,L-R),j=Math.min(O-1,M+R),D=U*N,B=Math.min(e.length-1,(j+1)*N-1),z=Math.max(0,O-j-1);return{rows:e.slice(D,B+1),startIndex:D,endIndex:B,topOffset:U*k,bottomOffset:z*k,totalCount:e.length}}}function Fa({items:e,context:t,adapter:o,options:r}){const n=c(null),i=c(null);n.current||(n.current=new Ca),i.current||(i.current=new Ia);const a=u(()=>n.current.reconcile(e,o,t),[o,t,e]),l=u(()=>i.current.createRenderWindow(a,r),[r,a]);return{rowModels:a,renderWindow:l}}function Aa({totalCount:e,plan:t}){const[o,r]=i(null);return{engineOptions:u(()=>{var r,n;if(!t.enabled)return{renderStrategy:"full"};const i=function(e,t){var o;return Math.max(1,null!==(o=null==e?void 0:e.viewportHeight)&&void 0!==o?o:t)}(o,null!==(r=t.fallbackViewportHeight)&&void 0!==r?r:800),a=Math.max(1,Math.ceil(i/t.estimatedItemSize)),l=Math.max(1,Math.ceil(e/t.itemsPerLane)),s=Math.min(l-1,Math.max(0,Math.floor((null!==(n=null==o?void 0:o.scrollTop)&&void 0!==n?n:0)/t.estimatedItemSize))),d=s+a-1;return{renderStrategy:"windowed",windowed:{startIndex:s*t.itemsPerLane,endIndex:Math.min(e-1,(d+1)*t.itemsPerLane-1),overscan:t.overscan,estimatedItemSize:t.estimatedItemSize,itemsPerLane:t.itemsPerLane}}},[t.enabled,t.estimatedItemSize,t.fallbackViewportHeight,t.itemsPerLane,t.overscan,e,o]),handleViewportChange:d(e=>{r(t=>(null==t?void 0:t.viewportHeight)===e.viewportHeight&&(null==t?void 0:t.viewportWidth)===e.viewportWidth&&(null==t?void 0:t.scrollHeight)===e.scrollHeight&&(null==t?void 0:t.scrollTop)===e.scrollTop?t:e)},[])}}function _a(e,t){if("number"==typeof e.childCount)return e.childCount;const o=t[e.id];return null===o?null:null!=o?o:0}function Sa(e){var t,o,r;const n=e.extension||(e.name&&e.name.includes(".")?e.name.split(".").pop():void 0)||((null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))?null===(r=null===(o=e.type.split("/")[1])||void 0===o?void 0:o.split(";")[0])||void 0===r?void 0:r.trim():void 0);return Boolean(n&&bt.includes(n.toLowerCase()))}function Ea(e,t){if(!1!==t.previewFallbackToFileUrl)return e.url&&Sa(e)?e.url:void 0}function xa(e,t){if(!e)return"";const o=new Date(e);if(Number.isNaN(o.getTime()))return"";const r=[t("months.january"),t("months.february"),t("months.march"),t("months.april"),t("months.may"),t("months.june"),t("months.july"),t("months.august"),t("months.september"),t("months.october"),t("months.november"),t("months.december")];return t("Added",{date:`${o.getDate()} ${r[o.getMonth()]} ${o.getFullYear()}`})}const Pa={getId:e=>e.id,buildSignature:(e,t)=>function(e,t){var o,r,n,i,a,l,s,d,c;const u=Boolean(e.isFolder),f=u?_a(e,t.folderFileCounts):null,h=u?null===f?"u":String(f):"0",m=xa(e.date,t.t),p=!u&&e.size?String(e.size):"",g=e.thumbnailUrl||e.thumbnail,v=e.url&&Sa(e)?e.url:"",y=null!==(o=Ea(e,t))&&void 0!==o?o:"",w=[!1!==(null===(r=t.features)||void 0===r?void 0:r.enableEdit),!1!==(null===(n=t.features)||void 0===n?void 0:n.enableMoveFolder),!1!==(null===(i=t.features)||void 0===i?void 0:i.enableMoveItem),!1!==(null===(a=t.features)||void 0===a?void 0:a.enableCopyFolder),!1!==(null===(l=t.features)||void 0===l?void 0:l.enableCopyItem),!1!==(null===(s=t.features)||void 0===s?void 0:s.enableRenameFolder),!1!==(null===(d=t.features)||void 0===d?void 0:d.enableRenameFile),!1!==(null===(c=t.features)||void 0===c?void 0:c.enableDelete)].join("|"),b=[g||"",y,v].join("::");return[e.id,e.name,e.folderId,e.type||"",e.extension||"",b,b,e.dimensions||"",p,m,u?"1":"0",h,w].join("::")}(e,t),buildRowModel:(e,t,o)=>{var r,n,i,a,l,s,d,c;const u=Boolean(e.isFolder),f=u?_a(e,t.folderFileCounts):null,h=u&&null===f?"—":u?`${f} ${1===f?t.t("item"):t.t("items")}`:"",m=e.dimensions||"",p=!u&&e.size?Or(e.size):"",g=u?t.t("Folder"):function(e){var t,o,r;return e.extension||(null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase())||(e.url?null===(r=null===(o=e.url.split("?")[0].split("/").pop())||void 0===o?void 0:o.split(".").pop())||void 0===r?void 0:r.toLowerCase():"")||""}(e),v=xa(e.date,t.t),y=u?h:[m,p,g].filter(Boolean).join(" • "),w=e.thumbnailUrl||e.thumbnail,b=e.url&&Sa(e)?e.url:void 0,C=Ea(e,t);return{id:o.id,signature:o.signature,item:e,file:e,isFolder:u,nameText:e.name||t.t("No name"),folderItemsText:h,dimensionsText:m,sizeText:p,typeText:g,dateText:v,gridInfoText:y,thumbnailSrc:w,previewSrc:C,lightboxSrc:b,canEdit:!u&&!1!==(null===(r=t.features)||void 0===r?void 0:r.enableEdit)&&Sa(e),canMove:u?!1!==(null===(n=t.features)||void 0===n?void 0:n.enableMoveFolder):!1!==(null===(i=t.features)||void 0===i?void 0:i.enableMoveItem),canCopy:u?!1!==(null===(a=t.features)||void 0===a?void 0:a.enableCopyFolder):!1!==(null===(l=t.features)||void 0===l?void 0:l.enableCopyItem),canRename:u?!1!==(null===(s=t.features)||void 0===s?void 0:s.enableRenameFolder):!1!==(null===(d=t.features)||void 0===d?void 0:d.enableRenameFile),canDelete:!1!==(null===(c=t.features)||void 0===c?void 0:c.enableDelete)}}};const Ra=n.memo(({files:o,searchTerm:r,handleSearch:n,sortBy:l,sortOrder:s,handleSortOptionChange:f,pagination:h,setPagination:m,loading:p,handleItemClick:g,onClearSelection:v,onRename:y,onDelete:w,onCopy:b,onMove:C,showRenameModal:I,showDeleteConfirm:F,showCopyModal:A,showMoveModal:_,onEdit:S,getFileData:E,handleAddFile:x})=>{var P;const{t:R}=dr(),k=Tn(),{DropZoneFileIcon:N,BigStockIcon:O,BigAIIcon:T,FolderIcon:L}=vn(),{options:M,actions:D,state:B}=pn(),{dataProviders:z,config:q}=M,V=null==q?void 0:q.disablePagination,{setCurrentMenuFile:W,setActiveLibraryItem:H}=D,$="Trash"===(null==B?void 0:B.selectedFolder),G=!1!==(null==B?void 0:B.multiSelect),{viewMode:K,setViewMode:Q}=(()=>{const[e,t]=i(()=>{try{return localStorage.getItem(ba)||"table"}catch(e){return"table"}}),o=d(e=>{t(e);try{localStorage.setItem(ba,e)}catch(e){console.warn("Не удалось сохранить режим отображения:",e)}},[]),r=d(()=>{o("table"===e?"grid":"table")},[e,o]);return{viewMode:e,setViewMode:o,toggleViewMode:r}})(),[J,Y]=i({}),[Z,X]=i(!1),ee=c(0),te=c(null);a(()=>{const e=window.matchMedia("(max-width: 1199px)"),t=e=>{X(e.matches)};t(e);const o=e=>t(e);return"function"==typeof e.addEventListener?(e.addEventListener("change",o),()=>e.removeEventListener("change",o)):(e.addListener(o),()=>e.removeListener(o))},[]);const oe=u(()=>(null==q?void 0:q.features)||{},[null==q?void 0:q.features]),re=null==q?void 0:q.iconStrokeWidth,ne=null==q?void 0:q.sortOptions,ie=u(()=>(null==ne?void 0:ne.length)?new Set(ne):null,[ne]),ae=`${l}-${s}`;a(()=>{var e;if(ie&&!ie.has(ae)){const t=null===(e=oa.find(e=>ie.has(e.value)))||void 0===e?void 0:e.value;t&&f(t)}},[ie,ae,f]);const le=u(()=>new Map(o.map(e=>[e.id,e])),[o]),{renderRows:se,renderWindow:de,hasAnyValidDate:ce,handleViewportChange:ue}=function({files:e,folderFileCounts:t,features:o,t:r,viewMode:n,previewFallbackToFileUrl:a}){const l=u(()=>({folderFileCounts:t,features:o,t:r,previewFallbackToFileUrl:a}),[o,t,r,a]),[s,c]=i(()=>Math.max(1,Math.floor(5))),f=u(()=>{const t=e.length>150;return"table"===n?{enabled:t,estimatedItemSize:56,overscan:10,itemsPerLane:1,fallbackViewportHeight:800}:{enabled:t,estimatedItemSize:320,overscan:2,itemsPerLane:s,fallbackViewportHeight:800}},[e.length,s,n]),{engineOptions:h,handleViewportChange:m}=Aa({totalCount:e.length,plan:f}),{rowModels:p,renderWindow:g}=Fa({items:e,context:l,adapter:Pa,options:h}),v=u(()=>p.some(e=>Boolean(e.dateText)),[p]),y=d(e=>{if("grid"===n){const t=Math.max(1,Math.floor(e.viewportWidth/240));c(e=>e===t?e:t)}m(e)},[m,n]);return{rowModels:p,renderRows:g.rows,renderWindow:g,hasAnyValidDate:v,handleViewportChange:y}}({files:o,folderFileCounts:J,features:oe,t:R,viewMode:K,previewFallbackToFileUrl:null==q?void 0:q.previewFallbackToFileUrl}),fe=d(async e=>{var t,o,r,n;try{if(null==z?void 0:z.getChildrenCount)return await z.getChildrenCount("folders"===e?void 0:e);if(null==z?void 0:z.getFiles){const{files:o,pagination:r}=await z.getFiles({folderId:"folders"===e?void 0:e,itemType:"all",page:V?void 0:1,limit:V?void 0:1});return V?Array.isArray(o)?o.length:0:null!==(t=null==r?void 0:r.total)&&void 0!==t?t:Array.isArray(o)?o.length:0}return 0}catch(t){if("StaleLoad"===(null==t?void 0:t.name))return 0;const i=t;if(404===(null==i?void 0:i.status)||"FileNotFound"===(null==i?void 0:i.code)||"path_folder_not_found"===(null==i?void 0:i.code)||"path_folder_not_found"===(null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.code)||404===(null===(n=null===(r=null==i?void 0:i.data)||void 0===r?void 0:r.data)||void 0===n?void 0:n.status))return 0;console.error(`Error getting the number of files for the folder ${e}:`,t);const a=await mi({folderId:e,dataProviders:z,folders:Array.isArray(B.folders)?B.folders:[],pathHistory:B.pathHistory,t:R});return k.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:R("Failed to load folder items count in folder",{folderName:a}),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{folderId:"folders"===e?null:e,folderName:a,reason:t instanceof Error?t.message:String(t)}}),null}},[z,V,k,B.folders,B.pathHistory,R]),he=d(async()=>{const e=ee.current+1;ee.current=e;const t=o.filter(e=>e.isFolder);if(0===t.length)return void Y(e=>0===Object.keys(e).length?e:{});const r={},n=t.map(async e=>{"number"!=typeof e.childCount?r[e.id]=await fe(e.id):r[e.id]=e.childCount});await Promise.all(n),ee.current===e&&Y(e=>{const t=Object.keys(e),o=Object.keys(r);return t.length===o.length&&t.every(t=>e[t]===r[t])?e:r})},[o,fe]);a(()=>{he()},[he]),a(()=>{te.current&&ue(Xi(te.current))},[o.length,ue,K]),a(()=>{if(!te.current||"undefined"==typeof ResizeObserver)return;const e=te.current,t=new ResizeObserver(()=>{ue(Xi(e))});return t.observe(e),()=>{t.disconnect()}},[ue]);const me=d(e=>{const t=Xi(e);ue(t)},[ue]);a(()=>{const e=te.current;if(!e)return;const t=()=>{me(e)},o=Ji(e);return o.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{o.forEach(e=>{e.removeEventListener("scroll",t)})}},[o.length,me,K]);const pe=d((e,t)=>e!==t,[]),ge=u(()=>[...G?[{key:"selection",width:46,shouldCellUpdate:pe,render:(t,o)=>e(la,{fileId:o.id})}]:[],{key:"preview",width:60,shouldCellUpdate:pe,render:(t,o)=>e(ua,{item:o,variant:"table",FolderIcon:L,getFileData:E,className:`${ra.imagePreview} ${ra.tableImagePreview}`,width:40,height:40})},{title:R("Name"),width:"calc(100% - 430px)",dataIndex:"nameText",key:"name",className:ra.fileNameCol,shouldCellUpdate:pe,render:(t,o)=>e(wa,{item:o})},{title:R("Dimensions"),key:"dimensions",width:100,shouldCellUpdate:pe,render:(t,o)=>o.dimensionsText&&e("div",{className:ra.fileSize,children:o.dimensionsText})},{title:R("Size"),key:"size",width:90,shouldCellUpdate:pe,render:(t,o)=>o.sizeText?e("div",{className:ra.fileSize,children:o.sizeText}):null},{title:R("Type"),key:"type",width:90,shouldCellUpdate:pe,render:(t,o)=>e("div",{className:ra.fileSize,children:o.typeText})},...ce?[{title:R("Date"),dataIndex:"dateText",key:"date",width:200,shouldCellUpdate:pe,render:(t,o)=>e(ya,{item:o})}]:[],{width:40,title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),shouldCellUpdate:pe,render:(t,o)=>e(da,{item:o,variant:"table",t:R,iconStrokeWidth:re,setCurrentMenuFile:W,showMoveModal:_,showCopyModal:A,showRenameModal:I,showDeleteConfirm:F,onEdit:S})}],[L,E,ce,re,G,S,W,pe,A,F,_,I,R]),ve=u(()=>({body:{row:sa}}),[]),ye=d(e=>({onClick:t=>{if(t.stopPropagation(),t.preventDefault(),1!==t.detail)return;const o=t.target,r=Boolean(o.closest(".ant-checkbox-wrapper")),n=Boolean(o.closest(".tableMenuButton")),i=Boolean(o.closest(".ant-dropdown-menu"));r||ha(o)||n||i||(e.isFolder?g(e.file):M.onEditorOk&&ma(e.file)&&M.onEditorOk(e.file))}}),[g,M]);let we="table"===K?e(va,{rows:se,columns:ge,topOffset:de.topOffset,bottomOffset:de.bottomOffset,onRow:ye,components:ve}):e(ga,{rows:se,topOffset:de.topOffset,bottomOffset:de.bottomOffset,t:R,iconStrokeWidth:re,FolderIcon:L,handleItemClick:g,setCurrentMenuFile:W,showMoveModal:_,showCopyModal:A,showRenameModal:I,showDeleteConfirm:F,onEdit:S,onEditorOk:M.onEditorOk,getFileData:E,showSelectionCheckbox:G});r&&!o.length&&(we=e(In,{}));const be=null===(P=null==q?void 0:q.availableImageExtensions)||void 0===P?void 0:P.map(e=>"."+e).join(", "),Ce=t("div",$?{className:`${ra.noFiles} ant-layout-sider-light`,children:[e(Le,{size:48,className:ra.noFilesIcon}),e("div",{className:`${ra.textTitle_trash} ant-menu-submenu-title`,children:R("Trash is empty")}),e("div",{className:`${ra.textDescription_trash} ant-menu-submenu-title`,children:R("Deleted files will be displayed here")})]}:{className:ra.uploadContainer,children:[t("div",{className:`${ra.uploadArea} `,onClick:x,children:[e("div",{className:ra.uploadIcon,children:e(N,{})}),e("div",{className:ra.textTitle,children:R("Click here to select a file")}),e("div",{className:ra.textDescription,children:R("Supported files:")+" "+(be||"jpeg, .svg, .png")})]}),t("div",{className:ra.buttons,children:[t("button",{className:ra.btnPhoto,onClick:()=>{H&&H(st)},children:[e("div",{className:ra.icon,children:e(O,{})}),t("div",{className:ra.blockText,children:[e("div",{className:ra.textTitle,children:R("Stock")}),e("div",{className:ra.textDescription,children:R("Select an image from our library")})]})]}),t("button",{className:ra.btnAi,onClick:()=>{H&&H(ct)},children:[e("div",{className:ra.icon,children:e(T,{})}),t("div",{className:ra.blockText,children:[e("div",{className:ra.textTitle,children:R("AI generation")}),e("div",{className:ra.textDescription,children:R("Creating an image on demand")})]})]})]})]});return e("div",{className:`content-layout ${ra.contentLayout}`,children:p||0!==(null==o?void 0:o.length)||r?t("div",{className:ra.tableContainer,children:[e(aa,{files:o,filesById:le,currentSortOption:ae,isSmallScreen:Z,iconStrokeWidth:re,multiSelectEnabled:G,features:oe,viewMode:K,setViewMode:Q,handleSearch:n,handleSortOptionChange:f,sortOptions:ne,onClearSelection:v,onRename:y,onDelete:w,onCopy:b,onMove:C,onEdit:S,t:R}),t("div",{ref:te,className:ra.filesContainer,children:[we,p?e("div",{className:ra.filesLoadingOverlay,"aria-busy":"true","aria-live":"polite",children:e(U,{size:"large"})}):null]}),!V&&h.total>h.pageSize&&e("div",{className:ra.paginationContainer,children:e(j,{current:h.current,pageSize:h.pageSize,total:h.total,onChange:(e,t)=>m({current:e,pageSize:t,total:h.total}),showSizeChanger:!0,showTotal:e=>R("total pages",{total:e})})})]}):e("div",{className:ra.emptyStateWrapper,children:Ce})})});Ra.displayName="FileContent";var ka="folderTree",Na="emptyFolderContainer",Oa="folderItemContainer",Ta="folderLabel",La="folderLabelItem",Ma="fileCount",Ua="foldersTitle",ja="foldersTitleItem",Da="folderMenu";const Ba=({selectedFolder:o,onSelect:r,onExpand:n,generateMenuItems:l,fetchChildFolders:s,disabledFolders:c=[],showFileCounts:f=!1,folderFileCounts:h={},className:m="",expandedKeys:p,setExpandedKeys:g,showTrashFolder:v=!1,mode:y="navigation",defaultExpandAll:w=!1})=>{const{t:b}=dr(),{options:C}=pn(),{config:I}=C,{ExpandArrowIcon:F,CollapseArrowIcon:A,CollapseFolderIcon:_,ExpandFolderIcon:S,EmptyFolderIcon:E}=vn(),x=d(e=>{const t=[],o=e=>{e.forEach(e=>{t.push(e.key),e.children&&o(e.children)})};return o(e),t},[]),[P,R]=i(()=>{if(w||"selection"===y&&w){const e=l();return x(e)}return[]}),k=void 0!==p?p:P,N=void 0!==g?g:R;a(()=>{if(w||"selection"===y&&w){const e=l(),t=x(e);void 0===p&&R(t)}},[w,y,l,x,p]);const O=d(e=>{const t=e[0];t&&"empty"!==t&&!t.endsWith("_input")&&(null==r||r(e))},[r]),T=d(async(e,t)=>{var o;N(e),null==n||n(e,t);if(!("lazy"===(null==I?void 0:I.folderTreeLoading)))return;const r=(null===(o=null==t?void 0:t.node)||void 0===o?void 0:o.key)||void 0;if(r&&"folders"!==r)try{await(null==s?void 0:s(r))}catch(e){console.warn("Failed to load child folders for",r,e)}},[null==I?void 0:I.folderTreeLoading,s,n,N]),L=d(()=>{var r,n;const i=l(),a=e=>e.filter(e=>"Trash"!==e.key).map(e=>Object.assign(Object.assign({},e),{children:e.children?a(e.children):void 0})),s=v?a(i):i,d=e=>{"selection"!==y?(k.includes(e)&&o===e?N(k.filter(t=>t!==e)):k.includes(e)||N([...k,e]),O([e])):O([e])},u=0===s.length||1===s.length&&(!s[0].children||0===s[0].children.length),m=o=>{var r;const n=f?h[o.key]:void 0,i=f&&null===n?null:f&&null!=n?n:0,a=k.includes(o.key),l=c.includes(o.key),s=(()=>{var t;return(null===(t=o.children)||void 0===t?void 0:t.length)?e(a?_:S,{size:20,strokeWidth:null==I?void 0:I.iconStrokeWidth}):e(E,{size:20,strokeWidth:null==I?void 0:I.iconStrokeWidth})})(),u=t("div",{className:`${Oa} folder-item-container`,onClick:e=>{e.stopPropagation(),l||d(o.key)},style:{opacity:l?.5:1,cursor:l?"not-allowed":"pointer"},children:[t("div",{className:Ta,children:[void 0!==o.icon?o.icon:s,e("span",{className:La,children:o.label})]}),f&&e("div",{className:Ma,title:null===i?void 0:`${i} ${b(1===i?"item":"items")}`,children:null===i?"—":i})]});return{key:o.key,title:u,children:null===(r=o.children)||void 0===r?void 0:r.map(m),disabled:l}},p=k.includes("folders"),g=e("div",{className:Ua,onClick:e=>{e.stopPropagation(),d("folders")},children:t("div",{className:ja,children:[e(p?_:S,{size:20,strokeWidth:null==I?void 0:I.iconStrokeWidth}),e("span",{className:`${La} folder-label-item`,children:"folders"===(null===(r=s[0])||void 0===r?void 0:r.key)?s[0].label:b("Folders")})]})}),w=()=>({key:"Trash",title:e("div",{className:Ua,onClick:e=>{e.stopPropagation(),d("Trash")},children:t("div",{className:ja,children:[e(Re,{size:20,strokeWidth:null==I?void 0:I.iconStrokeWidth}),e("span",{className:La,children:b("Trash")})]})}),children:void 0});if(u){if(!v)return[{key:"empty",title:e("div",{className:Na,children:b("No folders yet")}),disabled:!0}];const t=[];return s.length>0&&"folders"===s[0].key&&t.push({key:"folders",title:g,children:[]}),t.push(w()),t}if(s.length>0&&"folders"===s[0].key){const e=[{key:"folders",title:g,children:null===(n=s[0].children)||void 0===n?void 0:n.map(m)}];return v&&e.push(w()),e}return s.map(m)},[l,k,_,null==I?void 0:I.iconStrokeWidth,S,b,o,O,f,h,E,c,v,y,N]),M=u(()=>L(),[L]);return e(D,{className:`${ka} ${Da} ${m}`,selectedKeys:o?[o]:[],expandedKeys:k,onSelect:O,onExpand:T,treeData:M,switcherIcon:({expanded:t})=>e(t?A:F,{}),showLine:!1,focusable:"selection"!==y})},za=({style:t={},wrap:o=!1})=>{const r=Object.assign({width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},t);return e(E,{size:"large",style:r,wrap:o,children:e(U,{})})};var qa={formFooter:"formFooter",folderButton:"folderButton",foldersWrapper:"foldersWrapper",formItem:"formItem",folderToolsField:"folderToolsField",inputButtonOk:"inputButtonOk",permanentDeleteWarning:"permanentDeleteWarning",clearTrashProgress:"clearTrashProgress",progressText:"progressText",closeIcon:"closeIcon",modalContentWithLoader:"modalContentWithLoader",modalLoaderOverlay:"modalLoaderOverlay"};const Va=({folderId:r,activeFormField:n,EmptyFolderIcon:i,targetForm:a,handleModalOk:l,onComplete:s,setIsLoading:d,t:c})=>e(b.Item,{className:"form-item form-item-moveto "+(n===r?"form-item_active":""),name:"folderName",rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(c("Enter the name of the folder"))):Promise.resolve()}],children:e(I,{className:"form-input",autoFocus:!0,onFocus:e=>e.stopPropagation(),prefix:e(i,{style:{marginRight:6}}),suffix:t(o,{children:[e(_,{placement:"top",title:"Clean",children:e(S,{icon:e(ce,{style:{fontSize:10}}),className:qa.inputButtonClose,type:"text",onClick:()=>{a.setFieldsValue({folderName:""})}})}),e(S,{className:qa.inputButtonOk,type:"text",onClick:()=>{d(!0),l(a).then(e=>{const t=null==e?void 0:e.id;s(t)}).finally(()=>d(!1))},children:c("Create")})]})})});function Wa({folders:r,selectedFolder:i,EmptyFolderIcon:a,handleCreateFolderModalOk:l,setIsLoading:s,t:d}){const[c,u]=n.useState(""),f=n.useCallback((t,o)=>r=>e(Va,{folderId:r,activeFormField:c,EmptyFolderIcon:a,targetForm:t,handleModalOk:l,onComplete:o,setIsLoading:s,t:d},r),[a,c,l,s,d]),h=n.useCallback(e=>{const{folderId:t,targetForm:o,onTreeSelect:r,onComplete:n}=e;return{handleAddFolder:e=>{e.preventDefault(),e.stopPropagation(),u(t),o.setFieldsValue({folderName:d("New folder"),targetFolder:t})},handleSelectFolder:e=>{e.preventDefault(),e.stopPropagation(),r([t]).then(()=>n(t))}}},[d]),m=n.useCallback(n=>{const{targetForm:a,onTreeSelect:l,onComplete:s,actionButtonText:u}=n,m=f(a,s),p=Array.isArray(r)?r:[],g=(r=null,n=new Set)=>p.filter(e=>{const t=null===r&&!e.parentId,o=e.parentId===r;return t||o}).map(r=>{if(n.has(r.id))return{key:r.id,label:`${r.name} (циклическая ссылка)`};const d=new Set(n);d.add(r.id);const f=g(r.id,d),{handleAddFolder:p,handleSelectFolder:v}=h({folderId:r.id,targetForm:a,onTreeSelect:l,onComplete:s}),y=c===r.id?[{key:`${r.id}_input`,label:m(r.id),icon:null},...f]:f;return{key:r.id,label:t(o,{children:[r.name,i!==r.id&&t("div",{className:`${qa.folderToolsField} folder-tools-field`,children:[e(S,{onClick:p,children:"+"}),e(S,{onClick:v,children:u})]})]}),children:y}}),v=g(),{handleAddFolder:y,handleSelectFolder:w}=h({folderId:"folders",targetForm:a,onTreeSelect:l,onComplete:s}),b="folders"===c?[{key:"folders_input",label:m("folders"),icon:null},...v]:v;return[{key:"folders",label:t(o,{children:[d("Folders"),"folders"!==i&&null!==i&&t("div",{className:`${qa.folderToolsField} folder-tools-field`,children:[e(S,{onClick:y,children:"+"}),e(S,{onClick:w,children:u})]})]}),children:b}]},[c,f,h,r,i,d]);return{activeFormField:c,setActiveFormField:u,generateMenuItemsFromFolders:m}}const Ha=h(({folderId:t,activeFormField:o,EmptyFolderIcon:r,targetForm:n,handleModalOk:i,onComplete:a,t:l,setIsLoading:s,defaultFolderName:c})=>{const u=d(()=>{s(!0),i(n).then(e=>a(null==e?void 0:e.id)).finally(()=>s(!1))},[i,n,a,s]);return e(b.Item,{className:"form-item form-item-moveto "+(o===t?"form-item_active":""),name:"folderName",initialValue:c,rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(l("Enter the name of the folder"))):Promise.resolve()}],children:e(I,{className:"form-input",autoFocus:!0,prefix:e(r,{style:{marginRight:6}}),suffix:e(S,{className:qa.inputButtonOk,type:"text",onClick:()=>{s(!0),u()},children:l("Create")})})})});Ha.displayName="CustomFolderInput";const $a=({isModalVisible:r,handleModalOk:n,handleModalCancel:l,form:s,selectedFolder:c,folders:f,isUrlModalVisible:h,setIsUrlModalVisible:m,handleAddFileByUrl:p,urlForm:g,isRenameModalVisible:v,handleRenameOk:y,handleRenameCancel:w,renameForm:C,fileToRename:F,files:A,isMoveModalVisible:_,handleMoveOk:E,handleMoveCancel:x,moveForm:P,selectedFiles:R,isRenameFolderModalVisible:k,handleRenameFolderOk:N,handleRenameFolderCancel:O,renameFolderForm:T,folderToRename:L,isCopyModalVisible:M,handleCopyOk:U,handleCopyCancel:j,copyForm:D,isDeleteConfirmVisible:q,handleDeleteConfirmOk:V,handleDeleteConfirmCancel:W,isClearTrashConfirmVisible:H,handleClearTrashConfirm:$,handleClearTrashCancel:G,fetchChildFolders:K})=>{var Q,J,Y;const{t:Z}=dr(),{state:X,actions:ee,options:te}=pn(),{setCurrentMenuFile:oe}=ee,{config:re,getModalContainer:ne}=te,{currentMenuFile:ie}=X,ae=b.useWatch("folderName",s),{EmptyFolderIcon:le}=vn(),[se,de]=i(!1),ue=u(()=>{var e;return(null===(e=null==re?void 0:re.defaultFolderName)||void 0===e?void 0:e.trim())||Z("New folder")},[null==re?void 0:re.defaultFolderName,Z]),fe=!ae||0===String(ae).trim().length,he=u(()=>Array.isArray(A)?A:[],[A]),me=F?null===(Q=he.find(e=>e.id===F))||void 0===Q?void 0:Q.name:"",pe=Array.isArray(f)?f:[],ge=L?null===(J=pe.find(e=>e.id===L))||void 0===J?void 0:J.name:"",{activeFormField:ve,setActiveFormField:ye,generateMenuItemsFromFolders:we}=Wa({folders:pe,selectedFolder:c,EmptyFolderIcon:le,handleCreateFolderModalOk:n,setIsLoading:e=>de(Boolean(e)),t:Z});a(()=>{if(q){const e=setTimeout(()=>{const e=document.querySelector(".deleteModal");if(e){const t=e.querySelector(".ant-modal-footer");if(t){const e=t.querySelector(".ant-btn-primary");e&&e.focus()}}},100);return()=>clearTimeout(e)}},[q]);const be=F?he.find(e=>e.id===F):null,Ce=(null==be?void 0:be.isFolder)||(null==F?void 0:F.startsWith("folder_")),Ie=d(async e=>{e.length>0&&(P.setFieldsValue({targetFolder:e[0]}),ve!==e[0].toString()&&ye(""))},[P,ve,ye]),Ae=d(async e=>{e.length>0&&(D.setFieldsValue({targetFolder:e[0]}),ve!==e[0].toString()&&ye(""))},[ve,D,ye]),_e=d(async e=>{de(!0);try{await E(e)}finally{de(!1)}},[E]),Se=d(async e=>{de(!0);try{await U(e)}finally{de(!1)}},[U]),Ee=u(()=>{const e=Array.from(R).filter(e=>{const t=he.find(t=>t.id===e);return(null==t?void 0:t.isFolder)||f.some(t=>t.id===e)});return c&&"folders"!==c?e.push(c):c&&"folders"!==c||e.push("folders"),e},[R,he,f,c]);return t(o,{children:[e(B,{title:e("div",{className:"modal-title",children:Z("Creating a new folder")}),open:r,onOk:()=>n(),onCancel:l,okText:Z("Create"),cancelText:Z("Cancel"),okButtonProps:{disabled:fe,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>de(!1),centered:!0,getContainer:ne,children:t(b,{form:s,layout:"vertical",children:[e(b.Item,{name:"folderName",label:e("div",{className:"form-label",children:Z("Folder name")}),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Z("Enter the name of the folder"))):Promise.resolve()}],initialValue:ue,className:"form-item",style:{marginBottom:5},children:e(I,{autoFocus:!0,className:"form-input",disabled:se,placeholder:Z("Enter the name"),onPressEnter:async()=>{de(!0);try{await s.validateFields(),fe||await n()}catch(e){de(!1)}}})}),e("div",{children:c&&"folders"!==c?t("p",{className:"fm-note",children:[Z("A folder will be created inside:")," ",(null===(Y=pe.find(e=>e.id===c))||void 0===Y?void 0:Y.name)||Z("selected folder"),"."]}):e("p",{className:"fm-note",children:Z("The folder will be created in the root directory.")})})]})}),e(B,{title:e("div",{className:"modal-title",children:Z("Upload file by URL")}),open:h,onOk:async()=>{var e;de(!0);try{const t=await g.validateFields(),o=String(null!==(e=t.fileUrl)&&void 0!==e?e:"").trim();await p(o,void 0,void 0,"uploadByUrl")}catch(e){}finally{de(!1)}},onCancel:()=>m(!1),okText:Z("Download"),okButtonProps:{loading:se},cancelText:Z("Cancel"),cancelButtonProps:{disabled:se},afterClose:()=>de(!1),centered:!0,getContainer:ne,children:e(b,{form:g,layout:"vertical",children:e(b.Item,{name:"fileUrl",label:e("div",{className:"form-label",children:Z("File URL")}),rules:[{required:!0,message:Z("Enter the URL of the image")},{validator:(e,t)=>{if(!t||!String(t).trim())return Promise.resolve();try{return ei(String(t),Z),Promise.resolve()}catch(e){return Promise.reject(new Error(e instanceof Error?e.message:Z("The specified URL is not valid.")))}}}],validateTrigger:"onBlur",className:"form-item",children:e(I,{className:"form-input",placeholder:"https://example.com/image.jpg",autoFocus:!0,disabled:se,onPressEnter:async()=>{var e;de(!0);try{const t=await g.validateFields(),o=String(null!==(e=t.fileUrl)&&void 0!==e?e:"").trim();await p(o,void 0,void 0,"uploadByUrl")}catch(e){}finally{de(!1)}}})})})}),e(B,{title:e("div",{className:"modal-title",children:Ce?`${Z("Rename folder")} ${me}`:Z("Rename file",{currentFileName:me})}),open:v,onOk:y,okText:Z("Rename"),okButtonProps:{loading:se},onCancel:w,cancelText:Z("Cancel"),cancelButtonProps:{disabled:se},afterClose:()=>{de(!1),oe&&oe("")},centered:!0,getContainer:ne,children:e(b,{form:C,layout:"vertical",children:e(b.Item,{name:"newFileName",label:e("div",{className:"form-label",children:Z(Ce?"New folder name":"New file name")}),rules:[{required:!0,message:Z(Ce?"Enter a new folder name":"Enter a new file name")}],className:"form-item",children:e(I,{autoFocus:!0,className:"form-input",disabled:se,onPressEnter:async()=>{de(!0);try{await C.validateFields(),y()}catch(e){de(!1)}}})})})}),e(B,{title:e("div",{className:"modal-title",children:Z("Move to")}),open:_,onCancel:x,footer:t("div",{className:qa.formFooter,children:[t(S,{className:qa.folderButton,onClick:()=>{const e=null!=c?c:"folders";ye(e),P.setFieldsValue({folderName:ue,targetFolder:e})},loading:se,children:[e(Fe,{size:18,strokeWidth:null==re?void 0:re.iconStrokeWidth}),Z("Create folder")]}),e(S,{type:"primary",className:qa.folderButton,onClick:x,loading:se,children:Z("Done")})]}),afterClose:()=>{oe&&oe(""),ye(""),de(!1)},loading:se,centered:!0,getContainer:ne,children:t("div",{className:qa.modalContentWithLoader,children:[se&&e("div",{className:qa.modalLoaderOverlay,children:e(za,{})}),e(b,{form:P,layout:"vertical",initialValues:{targetFolder:"folders",folderName:ue,is_force_create:!1},children:t("div",{className:qa.foldersWrapper,children:[e(b.Item,{name:"targetFolder",rules:[{required:!0,message:Z("Select the destination folder")}],className:qa.formItem,children:e(Ba,{onSelect:Ie,generateMenuItems:()=>we({targetForm:P,onTreeSelect:Ie,onComplete:_e,actionButtonText:Z("Move here")}),fetchChildFolders:K,disabledFolders:Ee,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(b.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Z("Enter the name of the folder"))):Promise.resolve()}],children:e(I,{})}),e(b.Item,{name:"is_force_create",style:{display:"none"},children:e(I,{})})]})})]})}),e(B,{title:e("div",{className:"modal-title",children:Z("Copy to folder")}),open:M,onCancel:j,footer:t("div",{className:qa.formFooter,children:[t(S,{className:qa.folderButton,onClick:()=>{const e=null!=c?c:"folders";ye(e),D.setFieldsValue({folderName:ue,targetFolder:e})},loading:se,children:[e(Fe,{size:18,strokeWidth:null==re?void 0:re.iconStrokeWidth}),Z("Create folder")]}),e(S,{type:"primary",className:qa.folderButton,onClick:j,loading:se,children:Z("Done")})]}),afterClose:()=>{oe&&oe(""),ye(""),de(!1)},loading:se,centered:!0,getContainer:ne,children:t("div",{className:qa.modalContentWithLoader,children:[se&&e("div",{className:qa.modalLoaderOverlay,children:e(za,{})}),e(b,{form:D,layout:"vertical",initialValues:{targetFolder:"folders",folderName:ue,is_force_create:!1},children:t("div",{className:qa.foldersWrapper,children:[e(b.Item,{name:"targetFolder",rules:[{required:!0,message:Z("Select the destination folder")}],className:qa.formItem,children:e(Ba,{onSelect:Ae,generateMenuItems:()=>we({targetForm:D,onTreeSelect:Ae,onComplete:Se,actionButtonText:Z("Copy here")}),fetchChildFolders:K,disabledFolders:Ee,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(b.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Z("Enter the name of the folder"))):Promise.resolve()}],children:e(I,{})}),e(b.Item,{name:"is_force_create",style:{display:"none"},children:e(I,{})})]})})]})}),e(B,{title:t("div",{className:"modal-title",children:[Z("Rename folder")," ",ge]}),open:k,onOk:N,onCancel:O,okText:Z("Rename"),cancelText:Z("Cancel"),okButtonProps:{loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{de(!1),oe&&oe("")},centered:!0,getContainer:ne,children:e(b,{form:T,layout:"vertical",children:e(b.Item,{name:"newFolderName",label:e("div",{className:"form-label",children:Z("New folder name")}),rules:[{required:!0,message:Z("Enter a new folder name")}],className:"form-item",children:e(I,{autoFocus:!0,className:"form-input",disabled:se,onPressEnter:async()=>{de(!0);try{await T.validateFields(),N()}catch(e){de(!1)}}})})})}),e(B,{className:`${qa.deleteModal} deleteModal`,title:(()=>{const t=!!(null==re?void 0:re.enableTrashFolder)&&"Trash"===c||!(null==re?void 0:re.enableTrashFolder),o=Z(t?"Permanently delete":"Move to Trash");return e("div",{className:"modal-title",children:o})})(),open:!!q,onOk:()=>{de(!0);try{V&&V()}catch(e){console.error(e),de(!1)}},onCancel:()=>W&&W(),okText:(null==re?void 0:re.enableTrashFolder)&&"Trash"===c?Z("Delete permanently"):(null==re?void 0:re.enableTrashFolder)?Z("Move to Trash"):Z("Delete"),cancelText:Z("Cancel"),okButtonProps:{danger:!(null==re?void 0:re.enableTrashFolder)||"Trash"===c,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{de(!1),oe&&oe("")},closeIcon:e(ce,{className:qa.closeIcon}),centered:!0,getContainer:ne,children:(()=>{var o,r;const n=(ie?[ie]:Array.from(R||[])).map(e=>he.find(t=>t.id===e)).filter(e=>!!e),i=n.filter(e=>e.isFolder||e.id.startsWith("folder_")),a=n.filter(e=>!(e.isFolder||e.id.startsWith("folder_"))),l=n.length,s=i.length,d=a.length,u=!!(null==re?void 0:re.enableTrashFolder);if(!u||u&&"Trash"===c){let r;if(1===l&&1===s){const e=i[0],t=(null==e?void 0:e.name)||"",n=null!==(o=null==e?void 0:e.childCount)&&void 0!==o?o:0;r=Z("delete_folder_permanent",{name:t,count:n})}else r=0===s&&d>0?Z("delete_files_permanent",{count:d}):Z("delete_mixed_permanent",{total:l,folders:s,images:d});return t("div",{children:[e("div",{children:r}),e("p",{className:qa.permanentDeleteWarning,children:Z("permanent_delete_warning")})]})}if(1===l&&1===s){const t=i[0],o=(null==t?void 0:t.name)||"",n=null!==(r=null==t?void 0:t.childCount)&&void 0!==r?r:0;return e("div",{children:Z("move_folder_to_trash",{name:o,count:n})})}return e("div",0===s&&d>0?{children:Z("move_files_to_trash",{count:d})}:{children:Z("move_mixed_to_trash",{total:l,folders:s,images:d})})})()}),t(B,{className:`${qa.deleteModal} deleteModal`,title:e("div",{className:"modal-title",children:Z("Clear Trash")}),open:!!H,onOk:async()=>{de(!0),$&&await $(),de(!1)},onCancel:()=>G&&G(),okText:Z("Delete permanently"),cancelText:Z("Cancel"),okButtonProps:{danger:!0,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{de(!1)},closeIcon:e(ce,{className:qa.closeIcon}),centered:!0,getContainer:ne,children:[e("div",{children:Z("Are you sure you want to permanently delete all items from Trash?")}),se&&t("div",{className:qa.clearTrashProgress,children:[e(z,{percent:99,status:"active",showInfo:!1}),e("div",{className:qa.progressText,children:Z("Deleting items...")})]})]})]})};var Ga={button:"button",folderActions:"folderActions",uploadButton:"uploadButton",foldersContainer:"foldersContainer",buttonWrapper:"buttonWrapper",uploadButtonTitle:"uploadButtonTitle",lockedTabIcon:"lockedTabIcon",lockedTabLock:"lockedTabLock",lockedTabLabel:"lockedTabLabel"};const Ka=h(m(({selectedFolder:o,generateMenuItems:r,onFolderSelect:n,folders:l,fetchChildFolders:s,handleAddFile:f,setIsUrlModalVisible:h,handleCreateFolder:m,activeLibraryItem:g,setActiveLibraryItem:v},y)=>{var w,b,C,I;const F=u(()=>Array.isArray(l)?l:[],[l]),{t:A}=dr(),_=Tn(),[E,x]=i({}),{options:P,state:R}=pn(),{dataProviders:k,config:N}=P,O=R.pathHistory,T=!1!==(null===(w=null==N?void 0:N.features)||void 0===w?void 0:w.enableGif)&&(!(null==N?void 0:N.enabledTabs)||N.enabledTabs.includes("gif")),L=!1!==(null===(b=null==N?void 0:N.features)||void 0===b?void 0:b.enableStockImages)&&(!(null==N?void 0:N.enabledTabs)||N.enabledTabs.includes("stock")),M=!1!==(null===(C=null==N?void 0:N.features)||void 0===C?void 0:C.enableIconStock)&&(!(null==N?void 0:N.enabledTabs)||N.enabledTabs.includes("icons")),U=!1!==(null===(I=null==N?void 0:N.features)||void 0===I?void 0:I.enableQrBarcodeTab)&&(!(null==N?void 0:N.enabledTabs)||N.enabledTabs.includes("codes")),j=d((o,r)=>hn(r,N)?t("span",{className:Ga.lockedTabIcon,children:[o,e(Me,{size:12,strokeWidth:2.5,className:Ga.lockedTabLock})]}):o,[N]),D=d((t,o)=>hn(o,N)?e("span",{className:Ga.lockedTabLabel,children:t}):t,[N]),B=d(e=>{const t=[],o=e=>{e.forEach(e=>{t.push(e.key),e.children&&o(e.children)})};return o(e),t},[]),[z,W]=i(()=>{if(!0===(null==N?void 0:N.expandAllFoldersOnInit)&&"lazy"!==(null==N?void 0:N.folderTreeLoading)){const e=r();return B(e)}return!0===(null==N?void 0:N.expandRootFolderOnInit)?["folders"]:[]}),H=c(!1),$=c(!1);a(()=>{if(H.current)return;"lazy"===(null==N?void 0:N.folderTreeLoading)&&!0===(null==N?void 0:N.expandRootFolderOnInit)&&(H.current=!0,(async()=>{try{await(null==s?void 0:s(null))}catch(e){console.warn("Could not load the root child folders during initialization",e)}})())},[null==N?void 0:N.folderTreeLoading,null==N?void 0:N.expandRootFolderOnInit,s]),a(()=>{!0===(null==N?void 0:N.expandRootFolderOnInit)&&Array.isArray(F)&&F.length>0&&($.current||z&&0!==z.length||($.current=!0,W(["folders"])))},[null==N?void 0:N.expandRootFolderOnInit,F,z]),a(()=>{if(!0===(null==N?void 0:N.expandAllFoldersOnInit)&&"lazy"!==(null==N?void 0:N.folderTreeLoading)){const e=r(),t=B(e);return void W(t)}!0===(null==N?void 0:N.expandRootFolderOnInit)&&W(e=>e&&e.length>0?[...e]:["folders"])},[F,r,B,null==N?void 0:N.expandAllFoldersOnInit,null==N?void 0:N.folderTreeLoading,null==N?void 0:N.expandRootFolderOnInit]);const G=null==N?void 0:N.disablePagination,K=d(async e=>{var t,o,r,n;try{if(null==k?void 0:k.getChildrenCount)return await k.getChildrenCount("folders"===e?void 0:e);if(null==k?void 0:k.getFiles){const{files:o,pagination:r}=await k.getFiles({folderId:"folders"===e?void 0:e,itemType:"all",page:G?void 0:1,limit:G?void 0:1});return G?Array.isArray(o)?o.length:0:null!==(t=null==r?void 0:r.total)&&void 0!==t?t:Array.isArray(o)?o.length:0}return 0}catch(t){if("StaleLoad"===(null==t?void 0:t.name))return 0;const i=t;if(404===(null==i?void 0:i.status)||"FileNotFound"===(null==i?void 0:i.code)||"path_folder_not_found"===(null==i?void 0:i.code)||"path_folder_not_found"===(null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.code)||404===(null===(n=null===(r=null==i?void 0:i.data)||void 0===r?void 0:r.data)||void 0===n?void 0:n.status))return 0;console.error(`Error getting the number of files for the folder ${e}:`,t);const a=await mi({folderId:e,dataProviders:k,folders:F,pathHistory:O,t:A});return _.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:A("Failed to load folder items count in folder",{folderName:a}),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{folderId:"folders"===e?null:e,folderName:a,reason:t instanceof Error?t.message:String(t)}}),null}},[k,G,_,O,F,A]),Q=d(async()=>{if(0===F.length)return;const e={};e.folders=await K("folders");const t=F.map(async t=>{"number"!=typeof t.childCount?e[t.id]=await K(t.id):e[t.id]=t.childCount});await Promise.all(t),x(e)},[F,K]),J=d(async e=>{const t=await K(e);x(o=>Object.assign(Object.assign({},o),{[e]:t}))},[K]);p(y,()=>({refreshFileCounts:Q}),[Q]),a(()=>{Q()},[Q]),a(()=>{if(!o||"folders"===o)return;const e=(t,o=new Set)=>{if(o.has(t))return console.warn(`Cycle detected in the path to the folder with id=${t}`),[];const r=F.find(e=>e.id===t);if(!r)return[];if(!r.parentId)return[];const n=new Set(o);n.add(t);return[...e(r.parentId,n),r.parentId]},t=e(o);t.length>0?W(e=>{const o=new Set(e);return t.forEach(e=>o.add(e)),o.add("folders"),Array.from(o)}):W(e=>e.includes("folders")?e:[...e,"folders"])},[o,F]);const Y=d(async()=>{await f(),o?await J(o):await J("folders")},[f,o,J]),Z=[{key:at,label:D(A("My files"),at),icon:j(e(Ue,{size:20,strokeWidth:null==N?void 0:N.iconStrokeWidth}),at)},{key:lt,label:D(A("GIF"),lt),icon:j(e(je,{size:20,strokeWidth:null==N?void 0:N.iconStrokeWidth}),lt),disabled:!T},{key:st,label:D(A("Stock images"),st),icon:j(e(De,{size:20,strokeWidth:null==N?void 0:N.iconStrokeWidth}),st),disabled:!L},{key:dt,label:D(A("Icons"),dt),icon:j(e(be,{size:20,strokeWidth:null==N?void 0:N.iconStrokeWidth}),dt),disabled:!M},{key:ut,label:D(A("QR & Barcode"),ut),icon:j(e(Be,{size:20,strokeWidth:null==N?void 0:N.iconStrokeWidth}),ut),disabled:!U},{key:ct,label:D(A("AI"),ct),icon:j(e(ze,{size:20,strokeWidth:null==N?void 0:N.iconStrokeWidth}),ct),disabled:!(null==N?void 0:N.sseQuery)}].filter(e=>!e.disabled),X=d(async e=>{const t=e[0];t&&"empty"!==t&&(g!==at&&v(at),null==n||n(t),await(null==s?void 0:s("folders"===t?null:t)))},[n,g,v,s]),ee=d(({key:e})=>{var t;hn(e,N)?null===(t=null==N?void 0:N.onLockedTabClick)||void 0===t||t.call(N,e):v(e)},[N,v]),te=d(async(e,t)=>{var o;W(e);if(!("lazy"===(null==N?void 0:N.folderTreeLoading)))return;const r=(null===(o=null==t?void 0:t.node)||void 0===o?void 0:o.key)||void 0;if(r&&"folders"!==r)try{await(null==s?void 0:s(r))}catch(e){console.warn("Could not load the child folders for",r,e);const t=await mi({folderId:r,dataProviders:k,folders:F,pathHistory:O,t:A});_.error({id:"FOLDER_CHILDREN_FETCH_FAILED",message:A("Failed to load subfolders in folder",{folderName:t}),placement:"bottomRight",innerException:e,notificationDedupe:!0,data:{folderId:r,folderName:t,reason:e instanceof Error?e.message:String(e)}})}},[null==N?void 0:N.folderTreeLoading,k,s,_,O,F,A]);return t("div",{className:"sidebar-container",children:[t("div",{className:Ga.buttonWrapper,children:[e(S,{type:"primary",size:"large",icon:e(qe,{size:24,strokeWidth:null==N?void 0:N.iconStrokeWidth}),onClick:Y,className:Ga.uploadButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===o,children:e("span",{className:Ga.uploadButtonTitle,children:A("Upload file")})}),e(S,{type:"primary",size:"large",icon:e(Ve,{size:24,strokeWidth:null==N?void 0:N.iconStrokeWidth}),onClick:()=>null==h?void 0:h(!0),className:Ga.uploadByURLButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===o})]}),e(q,{className:"folder-menu",items:Z,defaultSelectedKeys:[at],onSelect:({key:e})=>ee({key:e}),selectedKeys:[g]}),e(V,{className:Ga.divider}),t("div",{className:Ga.foldersContainer,children:[e(Ba,{selectedFolder:o,onSelect:X,onExpand:te,generateMenuItems:r,fetchChildFolders:s,showFileCounts:!0,folderFileCounts:E,expandedKeys:z,setExpandedKeys:W,showTrashFolder:null==N?void 0:N.enableTrashFolder}),e("div",{className:Ga.folderActions,children:e(S,{onClick:e=>{e.stopPropagation(),m()},className:Ga.button,icon:e(Fe,{size:18,strokeWidth:null==N?void 0:N.iconStrokeWidth}),size:"middle"})})]})]})}));function Qa(e){if(!this.backgroundColor)return;const t=this._getNonTransformedDimensions(),o=-t.x/2,r=-t.y/2,n=t.x,i=t.y,a=this.backgroundColor;if("string"==typeof a||a instanceof CanvasGradient||a instanceof CanvasPattern)e.fillStyle=a,e.fillRect(o,r,n,i);else if("object"!=typeof a||!("type"in a)||"linear"!==a.type&&"radial"!==a.type){if("source"in a&&(a.source instanceof HTMLImageElement||a.source instanceof HTMLCanvasElement))if(a.repeat){const t=e.createPattern(a.source,a.repeat);t&&(e.fillStyle=t,e.fillRect(o,r,n,i))}else e.drawImage(a.source,o,r,n,i)}else{const t=function(e,t,o,r){var n,i;if("linear"===t.type){const n=e.createLinearGradient(o+t.coords.x1,r+t.coords.y1,o+t.coords.x2,r+t.coords.y2);return t.colorStops.forEach(e=>n.addColorStop(e.offset,e.color)),n}if("radial"===t.type){const a=e.createRadialGradient(o+t.coords.x1,r+t.coords.y1,null!==(n=t.coords.r1)&&void 0!==n?n:0,o+t.coords.x2,r+t.coords.y2,null!==(i=t.coords.r2)&&void 0!==i?i:0);return t.colorStops.forEach(e=>a.addColorStop(e.offset,e.color)),a}throw new Error("Unknown gradient type")}(e,a,o,r);e.fillStyle=t,e.fillRect(o,r,n,i)}this._removeShadow(e)}Ka.displayName="FolderSidebar";const Ja="fm-pixie-editor";const Ya=new class{constructor(){this._container=document.createElement("div"),this._instance=null,this._container.classList.add(Ja),this._container.style.width="100%",this._container.style.height="85vh",this._container.style.minHeight="400px"}get className(){return`.${Ja}`}get canvas(){var e,t;return null===(t=null===(e=this._instance)||void 0===e?void 0:e.state.canvasRef)||void 0===t?void 0:t.current}get tools(){var e;return null===(e=this._instance)||void 0===e?void 0:e.tools}isLoaded(){return!!this._instance}async _setConfig(e){var t;this._instance?await this._instance.resetEditor(e):this._instance=await $e.init(Object.assign(Object.assign({},e),{selector:this.className})),(t=this._instance).fabric?t.fabric.on("object:added",e=>{const t=e.target;t&&"text"===t.name&&(t._renderBackground=Qa)}):console.warn("Pixie fabric instance is not available")}async show(e,t,o=t.firstChild){t.insertBefore(this._container,o),await this._setConfig(e),this._instance.open()}close(){var e;null===(e=this._container.parentNode)||void 0===e||e.removeChild(this._container)}};function Za(e,t){if(!e)return t;if(!t)return e;return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function Xa(e){const t="undefined"!=typeof __webpack_public_path__?__webpack_public_path__:"";if(e&&/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(e))return e;let o=Za(t,e||"");return!o||o.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(o)||(o="/"+o),o}function el(e,t){if(/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(t))return t;const o=Za(Xa(e),t||"");return!o||o.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(o)?o:"/"+o}var tl,ol;!function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(tl||(tl={})),function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(ol||(ol={}));const rl=(e,t="image/png")=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());function nl(e){return new Promise((t,o)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>{var e;return o(null!==(e=r.error)&&void 0!==e?e:new Error("Failed to convert blob to data URL"))},r.readAsDataURL(e)})}const il=({visible:o,onClose:r,file:i,onSave:a,onSaveCopy:l})=>{var s;const{t:d}=dr(),c=n.useRef(null),u=Tn(),f=Si(),{options:h,actions:m}=pn(),{i18n:p}=dr(),{config:g}=h,{setCurrentMenuFile:v}=m,{getFileData:y,resolveFileForEditByUrl:w}=f,[b,C]=n.useState(!1),[I,F]=n.useState(null),[A,_]=n.useState(""),[E,x]=n.useState(!1),[P,R]=n.useState(!1),[k,N]=n.useState(null),O=n.useRef(!1),T=n.useRef(void 0),L=n.useRef(void 0),M=n.useRef("saveCopy"),U=n.useRef(void 0);T.current=a,L.current=l,n.useEffect(()=>{i&&!O.current&&(async()=>{if(U.current!==i)if("object"!=typeof i){U.current=i,C(!0);try{if(i.startsWith("data:"))N({thumbnail:i,saveWithoutFolder:!0});else{const e=await w(i);U.current===i&&N(e)}}catch(e){console.error("Failed to load file for editor:",e),U.current===i&&(U.current=null),null==r||r()}finally{C(!1)}}else N(i)})()},[i,r,w]);const j=n.useCallback(async e=>{try{if("string"==typeof e.thumbnail&&e.thumbnail.startsWith("data:"))return e.thumbnail;const t=await y(e.id,!0);if(!t)throw new Error(d("Error loading image"));return new Promise(e=>{const o=new FileReader;o.onload=()=>e(o.result),o.readAsDataURL(t)})}catch(e){throw console.error("Error getting the image data:",e),e}},[y,d]);n.useEffect(()=>{if(!I&&o&&k){let e=!1;const t=async()=>{var t,o,n;C(!0);try{const t=await j(k);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid image data: empty or null");if(!t.startsWith("data:"))throw new Error("Invalid image data: not a valid data URL");const o=t.match(/^data:([^;]+);base64,(.+)$/);if(!o)throw new Error("Invalid image data: malformed data URL format");const[,r,n]=o;if(!r.startsWith("image/"))throw new Error(`Invalid image data: unsupported MIME type ${r}`);if(n.length<10)throw new Error("Invalid image data: base64 content too short");if(!/^[A-Za-z0-9+/]+=*$/.test(n))throw new Error("Invalid image data: corrupted base64 content");if(!e){F(t);const e=ti(k,"image/png");_(e.mimeType)}}catch(i){e||(u.error({id:"IMAGE_DOWNLOAD_FAILED",innerException:i,message:d("Error loading image"),placement:"bottomRight",data:{itemId:null!==(t=null==k?void 0:k.id)&&void 0!==t?t:void 0,itemName:null!==(o=null==k?void 0:k.name)&&void 0!==o?o:void 0,folderId:null!==(n=null==k?void 0:k.folderId)&&void 0!==n?n:null,thumbnail:null==k?void 0:k.thumbnail}}),null==r||r())}finally{C(!1)}};return t(),()=>{e=!0}}},[k,j,I,r,d,o]);const D=n.useCallback(async(e,t,o)=>{var r;let n=await function(e,t){if("json"===e)return new Blob([t],{type:"application/json"});if("svg"===e)return new Blob([t],{type:"image/svg+xml"});let o=`image/${e}`;if(t.startsWith("data:")){const e=Nt(t);e&&e.startsWith("image/")&&(o=e);const r=t.replace(/data:image\/[^;]+;base64,/,"");return rl(r,kt(o))}return rl(t,kt(o))}(o,e),i=kt(n.type||`image/${o}`);const a=null!==(r=null==g?void 0:g.compessorUrl)&&void 0!==r?r:null==g?void 0:g.compressorUrl;if(i.startsWith("image/"))try{const e=new File([n],t,{type:i}),o=await hi(e,{maxSizeMB:null==g?void 0:g.compressMaxSize,maxWidthOrHeight:null==g?void 0:g.compressMaxWidthOrHeight,mimeType:i,fileName:t,libURL:a,enableCompression:ni(g,i)});n=o,i=o.type}catch(e){console.warn("Image preparation failed, using original:",e)}return{blob:n,mimeType:i,thumbnailDataUrl:await nl(n)}},[g]),z=n.useCallback(async(e,t,o,r)=>{var n,i,a,l,s,c;const f="save"===r?T.current:L.current;if(!k||!f)return;const h="object"==typeof k&&null!==k?k:null;let m=null;try{C(!0);const{blob:i,mimeType:a,thumbnailDataUrl:l}=await D(e,t,o),s=Object.assign(Object.assign({},k),{thumbnail:l,size:i.size,date:(new Date).toISOString().split("T")[0],type:a,folderId:k.folderId||"",name:k.name||t,extension:k.extension||(null===(n=(k.name||t).split(".").pop())||void 0===n?void 0:n.toLowerCase())||""});m=s;const c={blob:i,mimeType:a,thumbnail:l,mode:r},u=await f(s,c);if(u)return C(!1),u;throw new Error(d("saveCopy"===r?"Failed to save image copy":"Failed to save changes"))}catch(e){console.error("Error saving:",e);const o=null!=m?m:h,n=e;if(!(null==n?void 0:n.notificationShown)){const n=Bn(e),f=null!==(a=null!==(i=jn(null==n?void 0:n.code,d))&&void 0!==i?i:null==n?void 0:n.message)&&void 0!==a?a:d("saveCopy"===r?"Failed to save image copy":"Error saving image");u.error({id:"saveCopy"===r?"IMAGE_SAVE_COPY_FAILED":"IMAGE_SAVE_FAILED",message:f,placement:"bottomRight",data:{itemId:null!==(l=null==o?void 0:o.id)&&void 0!==l?l:void 0,itemName:null!==(s=null==o?void 0:o.name)&&void 0!==s?s:t,folderId:null!==(c=null==o?void 0:o.folderId)&&void 0!==c?c:null,thumbnail:null==o?void 0:o.thumbnail},innerException:e})}C(!1)}},[k,u,D,d]),q=n.useCallback(async e=>{var t;if(!Ya.isLoaded()||!k)return void console.error("❌ Pixie instance or file is missing");M.current=e;const o=k.name||"edited-image",r=ti(k,A);try{await(null===(t=Ya.tools)||void 0===t?void 0:t.export.save(o.replace(/\.[^/.]+$/,""),r.pixieFormat,oi.QUALITY))}catch(t){console.error("🎨 Error saving through the button:",t);try{const t=Ya.canvas,n=t?t.toDataURL(r.mimeType):null;n&&await z(n,o,r.extension,e)}catch(e){console.error("🎨 Alternative method also did not work:",e)}}},[k,A,z]),V=n.useCallback(async()=>{var t;if(I&&o&&E&&!O.current)try{O.current=!0;const o=c.current;let n=0;for(;n<20&&(0===o.clientWidth||0===o.clientHeight);)await new Promise(e=>setTimeout(e,50)),n++;const i=(null==g?void 0:g.locale)?null==g?void 0:g.locale.replace("_","-"):"en",a=matchMedia(vt).matches?pt:mt,l=(null==g?void 0:g.theme)===gt?a:null==g?void 0:g.theme,s=((null==g?void 0:g.locale)||p.language||"en").split("-")[0].split("_")[0],d=(p.getResourceBundle(s,"translation")||{}).pixie||{},u=e=>e.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),f={};Object.entries(d).forEach(([e,t])=>{const o=u(e);f[o]=t,f[e]=t});const h={[i]:f},m=ti(k,A),v={selector:"#pixie-editor",baseUrl:el((null==g?void 0:g.baseUrl)||"",(null==g?void 0:g.assetsUrl)||"assets/image-editor"),image:I,activeLanguage:i,languages:h,ui:{activeTheme:l,mode:"inline",forceOverlayModeOnMobile:!1,visible:!0,menubar:{replaceDefaultItems:!0,position:tl.TOP,items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",align:"right",desktopOnly:!0,icon:()=>e(ue,{style:{fontSize:20}}),action:e=>{e.togglePanel("history")}},{type:"button",icon:()=>e(ce,{style:{fontSize:20}}),align:"right",desktopOnly:!0,action:r}]},nav:{position:ol.TOP}},tools:{export:{defaultFormat:m.pixieFormat,defaultQuality:oi.QUALITY,defaultName:(null===(t=null==k?void 0:k.name)||void 0===t?void 0:t.replace(/\.[^/.]+$/,""))||"image"},text:{replaceDefaultItems:!0,defaultText:"Handwriting",items:[{family:"Inter",src:"fonts/inter-v20-cyrillic_latin-regular.woff2"},{family:"Commissioner",src:"fonts/commissioner-v24-cyrillic_latin-regular.woff2"},{family:"Montserrat Light",src:"fonts/Montserrat-Light.woff2"},{family:"Montserrat Regular",src:"fonts/Montserrat-Regular.woff2"},{family:"Montserrat Bold",src:"fonts/Montserrat-Bold.woff2"},{family:"Montserrat Black",src:"fonts/Montserrat-Black.woff2"},{family:"Roboto Light",src:"fonts/Roboto-Light.woff2"},{family:"Roboto Regular",src:"fonts/Roboto-Regular.woff2"},{family:"Roboto Bold",src:"fonts/Roboto-Bold.woff2"},{family:"Roboto Black",src:"fonts/Roboto-Black.woff2"},{family:"Lato Light",src:"fonts/Lato-Light.woff2"},{family:"Lato Regular",src:"fonts/Lato-Regular.woff2"},{family:"Lato Bold",src:"fonts/Lato-Bold.woff2"},{family:"Lato Black",src:"fonts/Lato-Black.woff2"},{family:"Rubik Light",src:"fonts/Rubik-Light.woff2"},{family:"Rubik Regular",src:"fonts/Rubik-Regular.woff2"},{family:"Rubik Bold",src:"fonts/Rubik-Bold.woff2"},{family:"Rubik Black",src:"fonts/Rubik-Black.woff2"},{family:"Bebas Neue Light",src:"fonts/BebasNeueLight.woff2"},{family:"Bebas Neue Regular",src:"fonts/BebasNeueRegular.woff2"},{family:"Bebas Neue Book",src:"fonts/BebasNeueBook.woff2"},{family:"Bebas Neue Bold",src:"fonts/BebasNeueBold.woff2"},{family:"Fira Sans",src:"fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"},{family:"Lobster",src:"fonts/Lobster.woff2"},{family:"Pacifico",src:"fonts/pacifico-v23-cyrillic_latin-regular.woff2"},{family:"Playfair Display",src:"fonts/playfair-display-v40-cyrillic_latin-regular.woff2"},{family:"Oswald",src:"fonts/oswald-v57-cyrillic_latin-regular.woff2"},{family:"Caveat",src:"fonts/caveat-v23-cyrillic_latin-regular.woff2"}]}},onSave:async function(e,t,o){try{C(!0);return await z(e,t,o,M.current)}catch(e){throw console.error("🎨 PIXIE onSave ERROR:",e),C(!1),e}}};try{R(!1),await Ya.show(v,c.current);const e=Ya.canvas;e&&e.focus(),R(!0),C(!1)}catch(e){console.error("init pixie failed:",e)}}catch(e){console.error("Error initializing Pixie:",e),u.error({id:"EDITOR_INIT_FAILED",message:d("Error initializing editor"),placement:"bottomRight",innerException:e}),O.current=!1,null==r||r()}},[k,A,I,o,E,null==g?void 0:g.locale,null==g?void 0:g.theme,null==g?void 0:g.baseUrl,null==g?void 0:g.assetsUrl,r,z,u,p,d]);n.useEffect(()=>{o&&I&&E&&V()},[o,I,E,V]),n.useEffect(()=>{if(!o){try{Ya.close()}catch(e){console.warn("Error closing Pixie:",e)}C(!1),F(null),_(""),O.current=!1,x(!1),R(!1)}return()=>{try{Ya.close()}catch(e){console.warn("Error closing Pixie when unmounting:",e)}}},[o]);const W=Boolean(null==k?void 0:k.id)&&!1!==(null===(s=null==g?void 0:g.features)||void 0===s?void 0:s.enableUpdateFile);return e(B,{title:(null==k?void 0:k.name)?d("Editing: {{name}}",{name:k.name}):d("Editing image"),open:o,closeIcon:null,onCancel:r,afterOpenChange:e=>x(e),forceRender:!0,width:"100vw",getContainer:h.getModalContainer,style:{top:0,height:"100vh",maxWidth:"none",padding:10},styles:{body:{height:"85vh",padding:0}},footer:[e(S,{onClick:r,disabled:!E||b,children:d("Cancel")},"cancel"),e(S,{type:"primary",onClick:()=>q("saveCopy"),loading:b,children:d("Save as copy and choose")},"save-copy"),...W?[e(S,{type:"primary",onClick:()=>q("save"),loading:b,children:d("Save and choose")},"save")]:[]],mask:{closable:!1},destroyOnHidden:!1,afterClose:()=>{v&&v("")},children:t("div",{ref:c,style:{position:"relative",width:"100%",height:"100%"},children:[o&&!P?e("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.45)",backdropFilter:"blur(1px)",pointerEvents:"all",zIndex:10},children:e("span",{style:{fontSize:14,color:"#555"},children:d("Loading editor...")})}):null,b&&P&&e(za,{style:{position:"absolute",top:0,background:"var(--colorBgLayout)",zIndex:100,opacity:.7}})]})})};var al="uploadProgress",ll="uploadProgress__card",sl="uploadProgress__header",dl="uploadProgress__header-title",cl="uploadProgress__header-buttons",ul="uploadProgress__header-button",fl="uploadProgress__close-icon",hl="uploadProgress__body",ml="uploadProgress__common-error",pl="uploadProgress__common-error-row",gl="uploadProgress__common-error-hint",vl="uploadProgress__list-wrapper",yl="uploadProgress__status-icon",wl="uploadProgress__file-item",bl="uploadProgress__file-item--error",Cl="uploadProgress__body--error",Il="uploadProgress__error-item",Fl="uploadProgress__error-message",Al="uploadProgress__error-hint",_l="uploadProgress__file-avatar",Sl="uploadProgress__file-info",El="uploadProgress__file-name",xl="uploadProgress__file-size",Pl="uploadProgress__progress-bar",Rl="uploadProgress__minimized",kl="uploadProgress__minimized-button",Nl="uploadProgress__file-list";const{Text:Ol}=F,Tl=({visible:o,files:r,totalFiles:n,completedFiles:i,onClose:a,onMinimize:l,onInsert:s,minimized:d=!1})=>{var c;const{token:u}=y.useToken(),{t:f}=dr();if(!o)return null;const h=t=>{switch(t){case"success":return e("div",{className:yl,children:e(me,{style:{color:u.colorSuccess}})});case"error":return e(fe,{style:{color:u.colorError}});default:return e(he,{style:{color:"#1890ff"}})}},m=t=>"success"===t.status?[e(S,{type:"primary",size:"small",onClick:()=>s(t),children:f("Insert")},"insert")]:[];if(d)return e("div",{className:Rl,children:e(S,{type:"primary",size:"small",onClick:l,className:kl,children:f("Upload progress",{completed:i,total:n})})});const p=r.filter(e=>"uploading"===e.status).length,g=r.filter(e=>"success"===e.status).length,v=r.filter(e=>"error"===e.status).length,w=r.filter(e=>"error"===e.status),b=w.length>1&&w.every(e=>{var t;return e.error&&e.error===(null===(t=w[0])||void 0===t?void 0:t.error)}),C=b?null===(c=w[0])||void 0===c?void 0:c.error:null;return e("div",{className:al+" fm-upload-progress",children:t("div",{className:ll,children:[t("div",{className:sl,children:[e(Ol,{strong:!0,className:dl,children:p>0?f("Uploading files",{completed:i,total:n}):g>0?f("Uploaded files",{success:g,total:n}):f("Upload error files",{errorCount:v})}),e("div",{className:cl,children:e(S,{type:"text",size:"small",icon:e(ce,{className:fl}),onClick:a,className:ul})})]}),t("div",{className:`${hl} ${r.some(e=>"error"===e.status)?Cl:""}`,children:[e("div",{className:vl,children:e(W,{className:Nl,size:"small",dataSource:r,renderItem:o=>{const r="error"===o.status,n=r?(e=>{if(!e)return null;const t=e.toLowerCase();return t.includes("type")||t.includes("format")||t.includes("формат")||t.includes("тип")||t.includes("not allowed")||t.includes("дозволен")||t.includes("name")||t.includes("invalid")||t.includes("назва")||t.includes("неприпустим")||t.includes("allowed characters")?null:t.includes("large")||t.includes("size")||t.includes("розмір")||t.includes("размер")?f("upload_error_hint_size"):t.includes("exists")||t.includes("вже існує")||t.includes("уже существует")?f("upload_error_hint_exists"):null})(o.error):null;return e(W.Item,{className:`${wl} ${r?bl:""}`,actions:m(o),children:e(W.Item.Meta,{avatar:e(H,{size:"small",icon:h(o.status),className:_l}),title:t("div",{className:Sl,children:[e(Ol,{ellipsis:!0,className:El,children:o.name}),e(Ol,{type:"secondary",className:xl,children:void 0!==o.size?Or(o.size):""})]}),description:"uploading"===o.status?e(z,{percent:o.progress,size:"small",status:"active",showInfo:!1,className:Pl}):r?b?null:t("div",{className:Il,children:[e(Ol,{type:"danger",className:Fl,children:o.error||f("Error")}),n&&e(Ol,{type:"secondary",className:Al,children:n})]}):null})})}})}),C&&t("div",{className:ml,children:[t("div",{className:pl,children:[e(fe,{style:{color:u.colorError,marginRight:8,flexShrink:0}}),e(Ol,{type:"danger",children:C})]}),e(Ol,{type:"secondary",className:gl,children:f("Applies to all {{count}} files",{count:w.length})})]})]})]})})},{Header:Ll}=$,{Title:Ml}=F,Ul=({activeLibraryItem:o,selectedFolder:n,isTrashFolder:i,onClearTrash:a,files:l,loading:s,onRefresh:d,refreshDisabled:c,showRefresh:u=!1})=>{const{t:f}=dr(),h=o===at&&(null!=i?i:n===ht),[m,p]=r.useState(!1),g={[at]:f("My files"),[lt]:f("GIF"),[st]:f("Stock images"),[dt]:f("Icons"),[ut]:f("QR & Barcode"),[ct]:f("AI image generation")};let v;return r.useEffect(()=>{const e=setTimeout(()=>{p(h&&l.length>0&&!s)},200);return()=>clearTimeout(e)},[h,l.length,s]),v=o===at?h?f("Trash"):n:g[o],e(Ll,{className:"actions-header",children:t("div",{className:"header-title-container",children:[e(Ml,{level:5,className:"header-title",children:v}),m&&a&&e(S,{type:"default",onClick:a,className:"clear-trash-button","aria-label":f("Clear Trash"),children:f("Clear")}),o===at&&u&&d&&e(_,{title:f("Refresh"),children:e(S,{type:"text",className:"folder-refresh-button",icon:e(We,{size:16}),onClick:d,disabled:c})})]})})};function jl(e,t){return!e||!t||e<=0||t<=0?1:e/t}const Dl=1200;function Bl({items:e,getId:t,getPreviewSrc:o,getAltText:r,getWidth:n,getHeight:a,layoutMode:l="masonry",minColumnWidth:s=240,estimatedItemHeight:d=240,gap:c=20,overscanPx:f=800,prefetchThresholdPx:h=1200,resolveColumnCount:m,virtualizationThreshold:p=40}){var g,v;const[y,w]=i({scrollTop:0,viewportHeight:800,viewportWidth:Dl,scrollHeight:0}),b=u(()=>function(e){return{getId:e,buildSignature:(t,o)=>{var r,n;const i=o.getPreviewSrc(t)||"",a=o.getAltText(t),l=null===(r=o.getWidth)||void 0===r?void 0:r.call(o,t),s=null===(n=o.getHeight)||void 0===n?void 0:n.call(o,t);return[e(t),i,a,null!=l?l:"",null!=s?s:""].join("::")},buildRowModel:(e,t,o)=>{var r,n;const i=null===(r=t.getWidth)||void 0===r?void 0:r.call(t,e),a=null===(n=t.getHeight)||void 0===n?void 0:n.call(t,e);return{id:o.id,signature:o.signature,item:e,previewSrc:t.getPreviewSrc(e),altText:t.getAltText(e),width:i,height:a,aspectRatio:jl(i,a)}}}}(t),[t]),C=u(()=>({getPreviewSrc:o,getAltText:r,getWidth:n,getHeight:a}),[r,a,o,n]),I=u(()=>{const e=Math.max(1,y.viewportWidth||Dl);return m?Math.max(1,m(e)):Math.max(1,Math.floor((e+c)/(s+c)))},[c,s,m,y.viewportWidth]),F=u(()=>{const e=Math.max(1,y.viewportWidth||Dl);return Math.max(1,(e-c*Math.max(0,I-1))/I)},[I,c,y.viewportWidth]),A=u(()=>{const t=new Array(I).fill(0),o=[];e:for(let r=0;r<e.length;r+=1){const i=e[r],s=null==n?void 0:n(i),u=null==a?void 0:a(i),f=s&&u&&s>0&&u>0?s/u:void 0,h=f?F/f:d;if("grid"===l){const e=Math.floor(r/I)*(h+c),t=r%I*(F+c);o.push({index:r,top:e,left:t,width:F,height:h,bottom:e+h});continue e}let m=0;for(let e=1;e<t.length;e+=1)t[e]<t[m]&&(m=e);const p=t[m],g=m*(F+c);t[m]=p+h+c,o.push({index:r,top:p,left:g,width:F,height:h,bottom:p+h})}const r=0===o.length?0:"grid"===l?Math.max(...o.map(e=>e.bottom)):Math.max(0,...t.map(e=>e-c));return{positionedItems:o,containerHeight:r}},[I,F,d,c,a,n,e,l]),_=u(()=>e.length<=p?{renderStrategy:"full"}:{renderStrategy:"positioned",positioned:{layout:A.positionedItems,viewportTop:y.scrollTop,viewportBottom:y.scrollTop+y.viewportHeight,overscanPx:f,containerHeight:A.containerHeight}},[e.length,A.containerHeight,A.positionedItems,f,y.scrollTop,y.viewportHeight,p]),{rowModels:S,renderWindow:E}=Fa({items:e,context:C,adapter:b,options:_}),x=null!==(g=E.positionedItems)&&void 0!==g?g:S.map((e,t)=>{var o;return{row:e,layout:null!==(o=A.positionedItems[t])&&void 0!==o?o:{index:t,top:0,left:0,width:F,height:d,bottom:d}}}),P=null!==(v=E.containerHeight)&&void 0!==v?v:A.containerHeight,R=P>0&&y.scrollTop+y.viewportHeight>=P-h;return{rowModels:S,renderRows:E.rows,renderWindow:E,positionedItems:x,containerHeight:P,isNearEnd:R,viewportMetrics:y,handleViewportChange:e=>{w(t=>t.scrollTop===e.scrollTop&&t.viewportHeight===e.viewportHeight&&t.viewportWidth===e.viewportWidth&&t.scrollHeight===e.scrollHeight?t:e)}}}const zl=t=>{var o,{imageId:r,sourceUrl:n,shouldLoad:l=!0,loader:s,onLoad:d}=t,f=kn(t,["imageId","sourceUrl","shouldLoad","loader","onLoad"]);const h=Hi(u(()=>[n],[n])),[m,p]=i(()=>s.getSnapshot(r,n)),g=c(null);return a(()=>(p(s.getSnapshot(r,n)),s.subscribe(r,n,p)),[r,s,n]),a(()=>(s.setActive(r,n,l),()=>{s.setActive(r,n,!1),s.release(r)}),[r,s,l,n]),m.shouldLoad&&h.src?e("img",Object.assign({},f,{ref:g,src:h.src,loading:null!==(o=f.loading)&&void 0!==o?o:"lazy",onLoad:e=>{h.handleLoad(),s.markLoaded(r),null==d||d(e)},onError:async e=>{var t;(await h.handleError()).exhausted&&s.markError(r),null===(t=f.onError)||void 0===t||t.call(f,e)}})):null};var ql={gifTab:"gifTab",scrollableDiv:"scrollableDiv",gifSearchInput:"gifSearchInput",search:"search",searchResults:"searchResults",virtualCanvas:"virtualCanvas",listItem:"listItem",loaded:"loaded",loadedImage:"loadedImage",searchOutputWrapper:"searchOutputWrapper",divider:"divider",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle"};const Vl=e=>{const t="undefined"!=typeof window?window.innerWidth:e;return t<=700?1:t<=1100?2:t<=1600?3:4},Wl=e=>e.images.downsized.url,Hl=({setImageGifList:r,imageGifList:n=[],currentReqGif:l,setCurrentReqGif:s,inputRef:u,customRequest:f})=>{const{t:h}=dr(),{GifPlayIcon:m}=vn(),{options:p}=pn(),{config:g}=p,v=qi({maxConcurrent:6}),[y,w]=i(null),[C,F]=i(new Set),[A,_]=i(!1),[S,E]=i(!1),[x,P]=i(!1),[R]=b.useForm(),k=c(l),N=c(null),O=c(null),T=c(null),L=c(0),M=c(0),j=c(new Set);a(()=>{k.current=l},[l]),a(()=>{R.setFieldsValue({keywords:l.keywords})},[]);const D=null==g?void 0:g.handleProxyUrl,B=null==g?void 0:g.fetchWithProxy,z=async e=>{if(!D)return e;const t=await Promise.resolve(D(e));return null!=t?t:e},q=d(async e=>B?Promise.resolve(B(e,void 0,{intent:"metadata"})):fetch(await z(e)),[B,z]),V=async function({query:e,page:t}){var o;const r=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const e=`https://api.giphy.com/v1/gifs/search?api_key=${null!==(o=null==g?void 0:g.REACT_APP_GIPHY_KEY)&&void 0!==o?o:"Nh77eBlPeMn1ed9MBAvL542NUGeNO26F"}&q=${encodeURIComponent(r)}&limit=50&offset=${t}&lang=en`,n=await q(e);return{data:await n.json()}}catch(e){console.warn(e)}},{positionedItems:W,containerHeight:H,isNearEnd:$,viewportMetrics:G,handleViewportChange:K}=Bl({items:n,getId:e=>e.id,getPreviewSrc:Wl,getAltText:e=>e.title,getWidth:e=>e.images.downsized.width?Number(e.images.downsized.width):void 0,getHeight:e=>e.images.downsized.height?Number(e.images.downsized.height):void 0,layoutMode:"masonry",minColumnWidth:240,estimatedItemHeight:220,prefetchThresholdPx:320,resolveColumnCount:Vl}),Q=ea(K,[n.length]),J=()=>{N.current&&(clearTimeout(N.current),N.current=null)},Y=e=>!j.current.has(e)&&(j.current.add(e),!0),Z=e=>{j.current.delete(e)},X=d(async()=>{var e,t,o;const n=null===(e=k.current.keywords)||void 0===e?void 0:e.trim();if(!n||A||S||!x)return;const i=`gif:${n}:${M.current}`;if(!Y(i))return;const a=L.current;E(!0);try{const e=await V({query:k.current,page:M.current});if(a!==L.current)return;const n=null!==(o=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.data)&&void 0!==o?o:[];if(!Array.isArray(n)||0===n.length)return void P(!1);const i=n;if(a!==L.current)return;r(e=>{const t=new Set(e.map(e=>e.id)),o=i.filter(e=>!t.has(e.id));return o.length>0?[...e,...o]:e}),M.current+=n.length,P(50===n.length)}finally{Z(i),a===L.current&&E(!1)}},[x,A,S,r]),ee=async()=>{var e,t;J();const o=null===(e=k.current.keywords)||void 0===e?void 0:e.trim();if(!o)return O.current=null,T.current=null,L.current+=1,M.current=0,r([]),F(new Set),P(!1),void E(!1);if(T.current===o)return;if(O.current===o||A&&O.current===o)return;const n=`gif:${o}:0`;if(!Y(n))return;const i=L.current+1;L.current=i,O.current=o,M.current=0,r([]),F(new Set),P(!1),E(!1),_(!0);try{const e=await V({query:k.current,page:0});if(i!==L.current)return;const n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.data;if(Array.isArray(n)&&n.length>0){const e=n;if(i!==L.current)return;r(e),M.current=n.length,P(50===n.length)}else r([]),P(!1);T.current=o}catch(e){P(!1)}finally{Z(n),O.current===o&&(O.current=null),_(!1)}};return a(()=>()=>{J()},[]),a(()=>{!A&&!S&&x&&n.length>0&&$&&X()},[x,n.length,$,X,A,S]),e("div",{className:ql.gifTab,children:e("div",{className:ql.searchOutputWrapper,children:t("div",{id:"scrollableDiv",ref:Q,className:ql.scrollableDiv,children:[t(b,{form:R,onValuesChange:e=>{if(void 0!==e.keywords){const t=Object.assign(Object.assign({},k.current),{keywords:e.keywords});s(t),k.current=t,J(),N.current=setTimeout(ee,800)}},className:n.length>0?ql.searchResults:ql.search,children:[e(b.Item,{name:"keywords",className:ql.gifSearchInput,children:e(I,{onPressEnter:()=>{ee()},allowClear:!0,placeholder:h("Search GIFs"),ref:u,spellCheck:"false",prefix:e(Ae,{size:16,strokeWidth:null==g?void 0:g.iconStrokeWidth,onClick:()=>{ee()}})})}),n.length>0&&!A&&e("div",{className:`ant-divider ${ql.divider}`,role:"separator"})]}),!n.length&&!A&&e(o,{children:l.keywords?e(In,{}):t("div",{className:ql.resultsContainer,children:[e("div",{className:ql.videoIcon,children:e(m,{className:ql.playButton})}),e("h1",{className:ql.title,children:h("Over 350,000 live images")}),e("p",{className:ql.subtitle,children:h("Enter a search query and we'll find the perfect image for you")})]})}),!n.length&&A&&e(za,{}),n.length>0&&t(o,{children:[e("div",{className:ql.virtualCanvas,style:{height:H},children:W.map(({row:o,layout:r})=>{const n=o.item,i=C.has(n.id),a=Wl(n),l=r.bottom>=G.scrollTop-240&&r.top<=G.scrollTop+G.viewportHeight+240;return t("div",{className:`${ql.listItem} ${i?ql.loaded:""}`,onClick:()=>(async(e,t)=>{var o;w(t),setTimeout(()=>{w(null)},2e3);let r=e.split("?")[0].split("#")[0].split("/"),n=r[r.length-1]||"uploaded-file";n.includes(".")&&(null===(o=n.split(".").pop())||void 0===o?void 0:o.length)&&n.split(".").pop().length<=5||(n+=".gif"),f(e,n)})(n.images.downsized.url,n.id,n.title),style:{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height,minHeight:r.height,maxHeight:"none",marginBottom:0},children:[e(zl,{imageId:n.id,sourceUrl:a,shouldLoad:l,loader:v,className:y===n.id?ql.loadedImage:"",width:"100%",height:"100%",alt:n.title,decoding:"async",onLoad:()=>{F(e=>{if(e.has(n.id))return e;const t=new Set(e);return t.add(n.id),t})}}),e("a",{rel:"noreferrer",href:"https://giphy.com/",target:"_blank",onClick:e=>e.stopPropagation()}),y===n.id&&e(U,{className:ql.antSpin})]},n.id)})}),S&&e(za,{})]})]})})})};var $l={stockTab:"stockTab",stockSearchInput:"stockSearchInput",searchOutputWrapper:"searchOutputWrapper",divider:"divider",search:"search",searchResults:"searchResults",virtualCanvas:"virtualCanvas",scrollableDiv:"scrollableDiv",listItem:"listItem",loaded:"loaded",loadedImage:"loadedImage",creatorInfo:"creatorInfo",stockColorFilter:"stockColorFilter",allColors:"allColors",blackColor:"blackColor",bwColor:"bwColor",whiteColor:"whiteColor",orangeColor:"orangeColor",redColor:"redColor",purpleColor:"purpleColor",magentaColor:"magentaColor",greenColor:"greenColor",tealColor:"tealColor",blueColor:"blueColor",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle"};const Gl=e=>{const t="undefined"!=typeof window?window.innerWidth:e;return t<=650?1:t<=1e3?2:t<=1450?3:4},Kl=(e,t)=>{const o=new URL(e);return o.searchParams.set("w",t.toString()),o.toString()},Ql=({imageStockList:r,setImageStockList:n,currentReq:l,setCurrentReq:s,inputRef:u,customRequest:f})=>{var h,m;const{t:p}=dr(),{StockBigIcon:g,MixedViewIcon:v,LandscapeViewIcon:y,PortraitViewIcon:w,SquareViewIcon:C}=vn(),{options:F}=pn(),{config:A}=F,S=qi({maxConcurrent:6}),[E,x]=i(!1),[P,R]=i(!1),[k,O]=i(!1),[L,M]=i(null),[j,D]=i(new Set),[B]=b.useForm(),z=null==A?void 0:A.fetchWithProxy,q=null==A?void 0:A.handleProxyUrl,V=null!==(h=null==A?void 0:A.UNSPLASH_KEY)&&void 0!==h?h:"HX2_qqq3F3ljmtYtfmb9P6h0dn2u9mnnOl36IdV8el0",W=(null===(m=null==A?void 0:A.locale)||void 0===m?void 0:m.slice(0,2))||"ru",H=c(l),$=c(null),K=c(null),Q=c(0),J=c(1),Y=c(new Set),Z=async e=>{if(!q)return e;const t=await Promise.resolve(q(e));return null!=t?t:e},X=d(async e=>z?Promise.resolve(z(e,void 0,{intent:"metadata"})):fetch(await Z(e)),[z,Z]),ee=()=>{$.current&&(clearTimeout($.current),$.current=null)},te=e=>!Y.current.has(e)&&(Y.current.add(e),!0),oe=e=>{Y.current.delete(e)},re=e=>e.map(e=>Object.assign(Object.assign({},e),{urls:{raw:Kl(e.urls.raw,1200),small:Kl(e.urls.raw,540)}}));a(()=>{H.current=l},[l]),a(()=>{0===r.length&&B.setFieldsValue({color:"",orientation:""})},[r,B]),a(()=>{B.setFieldsValue({keywords:l.keywords,color:l.color,orientation:l.orientation})},[]);const ne=async function({query:e,page:t}){const o=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{let r=`https://api.unsplash.com/search/photos?client_id=${V}&lang=${W}&per_page=30&query=${encodeURIComponent(o)}&page=${t}`;""!==e.color&&(r+=`&color=${e.color}`),""!==e.orientation&&(r+=`&orientation=${e.orientation}`);const n=await X(r);return{data:await n.json()}}catch(e){console.warn(e)}},{positionedItems:ie,containerHeight:ae,isNearEnd:le,viewportMetrics:se,handleViewportChange:de}=Bl({items:r,getId:e=>e.id,getPreviewSrc:e=>e.urls.small,getAltText:e=>e.description||e.user.name,getWidth:e=>e.width,getHeight:e=>e.height,layoutMode:"masonry",minColumnWidth:240,estimatedItemHeight:220,prefetchThresholdPx:320,resolveColumnCount:Gl}),ce=ea(de,[r.length]),ue=d(async()=>{var e,t;if(E||P||!k||!H.current.keywords.trim())return;const o=Q.current,r=J.current,i=`stock:${`${H.current.keywords.trim()}|${H.current.color}|${H.current.orientation}`}:${r}`;if(te(i)){R(!0);try{const i=await ne({query:H.current,page:r});if(o!==Q.current)return;const a=null!==(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[];if(0===a.length)return void O(!1);const l=re(a);if(o!==Q.current)return;n(e=>{const t=new Set(e.map(e=>e.id)),o=l.filter(e=>!t.has(e.id));return o.length>0?[...e,...o]:e}),J.current=r+1,O(30===a.length)}finally{oe(i),o===Q.current&&R(!1)}}},[k,E,P,n]),fe=async()=>{var e,t;ee();const o=`${H.current.keywords.trim()}|${H.current.color}|${H.current.orientation}`;if(!H.current.keywords.trim())return void(K.current=null);if(K.current===o)return;const r=`stock:${o}:1`;if(!te(r))return;const i=Q.current+1;Q.current=i,x(!0),R(!1),O(!1),J.current=1,n([]),D(new Set);try{const r=await ne({query:H.current,page:1});if(i!==Q.current)return;const a=null!==(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[];if(a.length>0){const e=re(a);if(i!==Q.current)return;n(e),J.current=2,O(30===a.length)}else O(!1);K.current=o}finally{oe(r),x(!1)}};a(()=>()=>{ee()},[]),a(()=>{!E&&!P&&k&&r.length>0&&le&&ue()},[k,r.length,le,ue,E,P]);const he=async(e,t,o,r)=>{var n;!async function(e){try{const t=`${e}${e.includes("?")?"&":"?"}client_id=${V}`,o=await X(t);return{data:await o.json()}}catch(e){console.warn(e)}}(t.download_location),M(o),setTimeout(()=>M(null),2e3);const i=e.raw,a=i.split("?")[0].split("#")[0].split("/");let l=a[a.length-1]||"uploaded-file";l.includes(".")&&(null===(n=l.split(".").pop())||void 0===n?void 0:n.length)&&l.split(".").pop().length<=5||(l+=".jpg"),f(i,l)};return e("div",{className:$l.stockTab,children:e("div",{className:$l.searchOutputWrapper,children:t("div",{className:$l.scrollableDiv,id:"scrollableDiv",ref:ce,children:[t(b,{form:B,initialValues:It,onValuesChange:(e,t)=>{const o=Object.assign(Object.assign({},It),t);s(o),H.current=o,ee(),""!==o.keywords?$.current=setTimeout(fe,800):(K.current=null,Q.current+=1,J.current=1,n([]),D(new Set),O(!1),R(!1),s(Object.assign({},It)),H.current=It,B.resetFields())},className:r.length>0?$l.searchResults:$l.search,children:[t(T,{gutter:24,children:[e(N,{span:r.length>0?void 0:24,children:e(b.Item,{name:"keywords",className:$l.stockSearchInput,children:e(I,{allowClear:!0,placeholder:p("Search image"),ref:u,spellCheck:"false",prefix:e(Ae,{size:16,strokeWidth:null==A?void 0:A.iconStrokeWidth})})})}),!!r.length&&t(o,{children:[e(N,{children:e(b.Item,{name:"orientation",children:t(G.Group,{onChange:e=>s(t=>Object.assign(Object.assign({},t),{orientation:e.target.value})),children:[e(_,{title:p("All"),placement:"top",children:e(G.Button,{value:"",children:e(v,{})})}),e(_,{title:p("Landscape"),placement:"top",children:e(G.Button,{value:"landscape",children:e(y,{})})}),e(_,{title:p("Portrait"),placement:"top",children:e(G.Button,{value:"portrait",children:e(w,{})})}),e(_,{title:p("Squarish"),placement:"top",children:e(G.Button,{value:"squarish",children:e(C,{})})})]})})}),e(N,{children:e(b.Item,{name:"color",children:t(G.Group,{className:$l.stockColorFilter,onChange:e=>s(t=>Object.assign(Object.assign({},t),{color:e.target.value})),children:[e(_,{title:p("All"),placement:"top",children:e(G.Button,{className:$l.allColors,value:"",children:"All"})}),e(_,{title:p("Black"),placement:"top",children:e(G.Button,{className:$l.blackColor,value:"black",children:"B"})}),e(_,{title:p("Black and White"),placement:"top",children:e(G.Button,{className:$l.bwColor,value:"black_and_white",children:"B&W"})}),e(_,{title:p("White"),placement:"top",children:e(G.Button,{className:$l.whiteColor,value:"white",children:"W"})}),e(_,{title:p("Orange"),placement:"top",children:e(G.Button,{className:$l.orangeColor,value:"orange",children:"O"})}),e(_,{title:p("Red"),placement:"top",children:e(G.Button,{className:$l.redColor,value:"red",children:"R"})}),e(_,{title:p("Purple"),placement:"top",children:e(G.Button,{className:$l.purpleColor,value:"purple",children:"P"})}),e(_,{title:p("Magenta"),placement:"top",children:e(G.Button,{className:$l.magentaColor,value:"magenta",children:"M"})}),e(_,{title:p("Green"),placement:"top",children:e(G.Button,{className:$l.greenColor,value:"green",children:"G"})}),e(_,{title:p("Teal"),placement:"top",children:e(G.Button,{className:$l.tealColor,value:"teal",children:"T"})}),e(_,{title:p("Blue"),placement:"top",children:e(G.Button,{className:$l.blueColor,value:"blue",children:"B"})})]})})})]})]}),r.length>0&&!E&&e("div",{className:`ant-divider ${$l.divider}`,role:"separator"})]}),!r.length&&!E&&e(o,{children:l.keywords?e(In,{}):t("div",{className:$l.resultsContainer,children:[e("div",{className:$l.videoIcon,children:e(g,{className:$l.playButton})}),e("h1",{className:$l.title,children:p("Millions of free stock images")}),e("p",{className:$l.subtitle,children:p("Enter a search query and we'll find the perfect image for you")})]})}),!r.length&&E&&e(za,{}),r.length>0&&t(o,{children:[e("div",{className:$l.virtualCanvas,style:{height:ae},children:ie.map(({row:o,layout:r})=>{const n=o.item,i=j.has(n.id),a=r.bottom>=se.scrollTop-240&&r.top<=se.scrollTop+se.viewportHeight+240;return t("div",{className:`${$l.listItem} ${i?$l.loaded:""}`,onClick:()=>he(n.urls,n.links,n.id,n.description),style:{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height,minHeight:r.height,maxHeight:"none",marginBottom:0},children:[e(zl,{imageId:n.id,sourceUrl:n.urls.small,shouldLoad:a,loader:S,className:L===n.id?$l.loadedImage:"",width:"100%",height:"100%",alt:n.description,decoding:"async",onLoad:()=>{D(e=>{if(e.has(n.id))return e;const t=new Set(e);return t.add(n.id),t})}}),t("p",{className:$l.creatorInfo,onClick:e=>e.stopPropagation(),children:[p("Photo by")," ",e("a",{target:"_blank",href:`${n.user.links.html}?utm_source=${null==A?void 0:A.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:n.user.name})," ",p("on")," ",e("a",{target:"_blank",href:`https://unsplash.com/?utm_source=${null==A?void 0:A.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:"Unsplash"})]}),L===n.id&&e(U,{className:$l.antSpin})]},n.id)})}),P&&e(za,{})]})]})})})},Jl=()=>{const{options:e}=pn(),t=e.config;return d((e,o)=>{!1!==(null==t?void 0:t.pushToGTM)&&((e,t)=>{const o=()=>{try{const t=Object.assign(Object.assign({},e),{appLabel:"blocks_app"});window.dataLayer&&"function"==typeof window.dataLayer.push&&window.dataLayer.push(t)}catch(e){console.error("Ошибка при вызове GTM:",e)}};t?setTimeout(o,t):o()})(e,o)},[null==t?void 0:t.pushToGTM])};function Yl(e){const t=e.trim();return/^(https?:)?\/\//i.test(t)||/^data:/i.test(t)}function Zl(e){const t=e.trim();return Yl(t)?t:`data:image/jpeg;base64, ${e}`}var Xl="slideshowContainer",es="slideshowImage";const ts=({images:t,transitionDuration:o=1e3,frameHeight:r})=>{const[n,l]=i([]),[s,d]=i(r);a(()=>{const e=()=>{if("undefined"==typeof window)return void d(r);const e=window.innerHeight,t=Math.max(e-260,130);if("number"==typeof r){const e=Math.min(r,t);d(e)}else d(t)};if(e(),"undefined"!=typeof window)return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r]);const c=()=>{l(e=>e.map((t,o)=>o===e.length-1?Object.assign(Object.assign({},t),{opacity:1}):t))};return a(()=>{if(t.length>0){const e=t[t.length-1];l(t=>[...t,{src:e,opacity:0}]),setTimeout(c,1e3)}else l([])},[t]),e("div",{className:Xl,style:{height:s,minHeight:130},children:n.map((t,r)=>e("img",{src:Zl(t.src),alt:`Slide ${r+1}`,className:es,style:{opacity:t.opacity,transition:`opacity ${o}ms linear`,display:"block"}},r))})},os=t=>{var{className:o,style:r,color:n,text:i,variant:a}=t,l=kn(t,["className","style","color","text","variant"]);const s=i||"";return e(K,Object.assign({style:r,color:n,variant:a,className:o},l,{children:s}))},rs=({text:o,counter:r,limits:n,wrapperStyles:i})=>{const{t:a}=dr(),{options:l}=pn(),s=l.config,{token:d}=y.useToken(),c=+n>0,u=!c||r<+n,f=(null==s?void 0:s.billingPageUrl)||"/billing",h=r+" "+a("of")+" "+(c?n:"∞")+" "+(o||a("tests",{count:n}))+" "+a("was used",{count:r});return t("div",{className:"limits-couter-wrapper",style:i,children:[e(os,{variant:"filled",text:h,className:"limit-counter",style:{color:u?d.colorText:"white"},color:u?d.colorFillSecondary:"rgb(255, 77, 79)"}),c&&e("div",{style:{fontSize:14,textDecoration:"underline",cursor:"pointer"},onClick:()=>window.location.assign(f),children:a("Need more?")})]})};var ns={imageAi:"imageAi",imageAiExample:"imageAiExample",imageItem:"imageItem",textAreaInputHybrid:"textAreaInputHybrid",loading:"loading",carousel:"carousel",arrow:"arrow",arrowNext:"arrowNext",arrowPrev:"arrowPrev",arrowBtn:"arrowBtn",arrowBtnNext:"arrowBtnNext",arrowBtnPrev:"arrowBtnPrev",row:"row",inputAffixWrapper:"inputAffixWrapper",textarea:"textarea",inputIcon:"inputIcon"};const is=h(({className:t,onClick:o})=>e("div",{className:`${ns.arrow} ${ns.arrowNext} ${t||""}`,onClick:o,children:e(S,{className:`${ns.arrowBtn} ${ns.arrowBtnNext}`,size:"large",icon:e(pe,{})})}));is.displayName="SampleNextArrow";const as=h(({className:t,onClick:o})=>e("div",{className:`${ns.arrow} ${ns.arrowPrev} ${t||""}`,onClick:o,children:e(S,{className:`${ns.arrowBtn} ${ns.arrowBtnPrev}`,size:"large",icon:e(ge,{})})}));as.displayName="SamplePrevArrow";const ls=({customRequest:o,inputAiRef:r,isImageUploaded:l,setIsImageUploaded:s,aiImageRequest:f,setAiImageRequest:h,imageAiList:m,setImageAiList:p,isLoadingAi:g,setIsLoadingAi:v})=>{const{t:y}=dr(),{AiIcon_2:w}=vn(),C=n.useRef(null),[F,A]=i("auto"),{aiImageCounter:_,currentAiImgLimits:E,loadingDuringGeneration:x,requestStatus:P,handleGenerate:R,convertBase64ToFile:k,isShiftPressed:O,setIsShiftPressed:L,limitsInPlugin:M}=function({setFrameHeight:e,customRequest:t,aiTabRef:o,isImageUploaded:r,setIsImageUploaded:n,aiImageRequest:l,imageAiList:s,setImageAiList:f,isLoadingAi:h,setIsLoadingAi:m}){const{t:p}=dr(),{options:g}=pn(),v=g.config,y=Tn(),w=Jl(),{messages:b}=g.config,[C,I]=i([]),[F,A]=i(0),[_,S]=i(null),[E,x]=i(!1),[P,R]=i(p("Evaluating the task")),[k,N]=i(!1),O=c(new Set),T=c(new Set),L=c(new Set);a(()=>{I(b)},[b]),a(()=>{s.length||_||(I([]),O.current.clear(),T.current.clear(),L.current.clear(),j.current=-1)},[s,_]);const M=u(()=>v&&"function"==typeof(null==v?void 0:v.sendAIImageRequest)?null==v?void 0:v.sendAIImageRequest:()=>Promise.resolve({}),[v]),U=d(e=>{const t=`${_}-${e.progress}-${JSON.stringify(e.images||e.data)}`;if(!L.current.has(t))if(L.current.add(t),"error"!==e.status&&"Canceled"!==e.status){if(e.images){if(R(String(e.status)),100===e.progress){m(!1),f(e.images);const t=_,o=Array.isArray(e.images)?e.images:[];o.length>0&&t&&!O.current.has(t)&&(O.current.add(t),y.success({id:"AI_IMAGE_GENERERATION_SUCCESS",message:p("Images generated successfully"),placement:"bottomRight",data:{request:l,taskId:t,images:o}})),S(null),N(!1)}}else if(e.data&&(f([String(e.data)]),100===e.progress)){m(!1);const t=_,o=e.data?[String(e.data)]:[];o.length>0&&t&&!O.current.has(t)&&(O.current.add(t),y.success({id:"AI_IMAGE_GENERERATION_SUCCESS",message:p("Images generated successfully"),placement:"bottomRight",data:{request:l,taskId:t,images:o}})),S(null),N(!1)}}else m(!1),N(!1),_&&!T.current.has(_)&&(T.current.add(_),y.error({id:"AI_RESPONSE_INVALID",message:p("Something went wrong, please try again"),placement:"bottomRight",description:String(_)||void 0,data:{requestId:_,request:l,response:e},innerException:e}))},[l,f,R,p,m,_,y,N]),j=c(-1);a(()=>{if(C.length>0){const e=C.length-1;e>j.current&&(j.current=e,U(C[e]))}},[U,C]);const D=u(()=>{if(v&&"function"==typeof(null==v?void 0:v.sseQuery)){const e=null==v?void 0:v.sseQuery;return t=>e(t)}return e=>{}},[v]),B=u(()=>v&&"object"==typeof(null==v?void 0:v.handleLimitUsageEmitter)?null==v?void 0:v.handleLimitUsageEmitter:{fire:()=>{}},[v]),z=null==v?void 0:v.elementId,{projectId:q}=v,{limits:V}=(null==v?void 0:v.limits)?v:{limits:{ai_img_limit:0}},{ai_img_limit:W}=V,H=W>0&&F>=W,$=!(!(null==v?void 0:v.limits)||!v.counters)&&yt,G=d(()=>{B.fire({name:"AiImgCount",count:F+1})},[B,F]),K=u(()=>!H&&!$,[H,$,F,W]),Q=d(async()=>{R(p("Evaluating the task")),""===l||h||(m(!0),N(!0),f([]),I([]),w({event:"submit_form",action:"ai_image_generation",entity_id:z,project_id:q}),M({body:{project_id:q,request:"create-image",connection:"midjourney",message:l}}).then(e=>{var t,o,r,n,i,a,s,d,c;const{data:u,error:h}=e||{};if(h)throw h;const g=u;if(401===(null==g?void 0:g.status)||401===(null===(t=null==g?void 0:g.data)||void 0===t?void 0:t.status))throw new Error("ERROR");const v=null!==(o=null==g?void 0:g.data)&&void 0!==o?o:g;if((null==v?void 0:v._eventResult)&&Array.isArray(null===(r=v.task)||void 0===r?void 0:r.images)&&(null!==(i=null===(n=v.task.images)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0){const e=v.task.images;return f(e),m(!1),N(!1),void S(null)}const w=(null==g?void 0:g.task)||(null===(a=null==g?void 0:g.data)||void 0===a?void 0:a.task),b=null!==(d=null!==(s=null==w?void 0:w.id)&&void 0!==s?s:_)&&void 0!==d?d:void 0;200===(null==g?void 0:g.status)||200===(null===(c=null==g?void 0:g.data)||void 0===c?void 0:c.status)?((null==w?void 0:w.id)&&(R(w.message),S(w.id)),(null==g?void 0:g.message)&&y.success({id:"AI_IMAGE_GENERATION_STARTED",message:g.message,placement:"bottomRight",data:{request:l,taskId:b,response:null==g?void 0:g.data}}),D({task_id:null==w?void 0:w.id,entity_id:z})):(m(!1),N(!1),b&&!T.current.has(b)&&(T.current.add(b),y.error({id:"AI_IMAGE_GENERATION_FAILED",message:(null==g?void 0:g.message)||p("Something went wrong, please try again"),placement:"bottomRight",description:l,data:{request:l,taskId:b,response:g},innerException:g})))}).catch(e=>{m(!1),N(!1);const t=e;return((null==t?void 0:t.error)||(null==t?void 0:t.data))&&_&&!T.current.has(_)&&(T.current.add(_),null==y||y.error({id:"AI_IMAGE_GENERATION_FAILED",message:p("Something went wrong, please try again"),placement:"bottomRight",description:l,innerException:e,data:{request:l,taskId:_,response:null==t?void 0:t.data,error:Bn(null==t?void 0:t.error)}})),t}))},[l,h,m,N,f,w,z,q,M,y,D,p,_]),J=d(()=>{K&&Q()},[K,$,A,G,Q,y,p]);a(()=>{},[v,$]);const Y=d(async e=>{if(r)return;let o;try{if(Yl(e)){const t=await fetch(e);o=await t.blob()}else{const t=atob(e),r=new Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);o=new Blob([new Uint8Array(r)],{type:"image/jpeg"})}}catch(e){return void console.error("FM AI: convertBase64ToFile decode error",e)}const i=new File([o],"image.jpeg",{type:o.type||"image/jpeg",lastModified:Date.now()});n(!0);try{"function"==typeof t&&await Promise.resolve(t({file:i}))}catch(e){console.error("FM AI: customRequest error",e)}finally{n(!1)}},[r,n,t]);return a(()=>{(h||s.length>0)&&setTimeout(()=>{var t,r;let n=350;if(o.current){const e=null===(t=o.current)||void 0===t?void 0:t.firstChild;e&&e instanceof HTMLElement&&(n=(null===(r=o.current.getBoundingClientRect())||void 0===r?void 0:r.height)-48-e.clientHeight)}e(n)},0)},[o,s.length,h,e]),{aiImageCounter:F,setAiImageCounter:A,currentAiImgLimits:W,isFieldsDisabled:H,canGenerateImage:K,aiImageRequest:l,imageAiList:s,setImageAiList:f,isLoadingAi:h,setIsLoadingAi:m,loadingDuringGeneration:k,setLoadingDuringGeneration:N,requestStatus:P,setRequestStatus:R,handleGenerate:J,handleLimitAiImgCount:G,convertBase64ToFile:Y,isShiftPressed:E,setIsShiftPressed:x,currentReqId:_,setCurrentReqId:S,limitsInPlugin:$}}({setFrameHeight:A,customRequest:o,aiTabRef:C,isImageUploaded:l,setIsImageUploaded:s,aiImageRequest:f,imageAiList:m,setImageAiList:p,isLoadingAi:g,setIsLoadingAi:v});a(()=>{},[l]);const[U,j]=i(!1),D=d(()=>j(!0),[]),B=d(()=>j(!1),[]),z=d(e=>h(e.target.value),[h]),q=d(e=>{"Shift"===e.key?L(!0):"Enter"!==e.key||O||(e.preventDefault(),R())},[O,R,L]),V=d(e=>{"Shift"===e.key&&L(!1)},[L]);return t("div",{className:ns.imageAi,ref:C,children:[M&&e(rs,{text:"images",counter:_,limits:E,wrapperStyles:{marginTop:-25}}),e(T,{gutter:24,className:ns.row,children:t(N,{span:24,children:[e(b.Item,{children:t("span",{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg ${ns.inputAffixWrapper}${U?" ant-input-affix-wrapper-focused":""}`,children:[e(I.TextArea,{ref:r,onKeyDown:q,onKeyUp:V,onFocus:D,onBlur:B,autoSize:!0,allowClear:!0,className:`${ns.textAreaInputHybrid} ${ns.textarea}`,placeholder:y("Generate image"),value:f,onChange:z,spellCheck:"false"}),e("span",{className:`ant-input-suffix ${ns.inputSuffix}`,children:g||x?e(Z,{className:`${ns.inputIcon} input-icon`,spin:!0}):e(w,{className:`${ns.inputIcon} input-icon`,onClick:R})})]})}),t("div",{className:ns.imageAiExample,children:[e("span",{children:y("For example:")})," ",y("A beautiful image of a sunset over a calm ocean.")]})]})}),(g||m.length>0)&&t(Q,{dotPlacement:"top",arrows:!0,nextArrow:e(is,{}),prevArrow:e(as,{}),className:ns.carousel,infinite:!1,children:[g&&!m.length&&e("div",{className:ns.loading,children:t("div",{className:"spin",children:[e(Z,{style:{fontSize:48},spin:!0}),e("p",{className:"status",children:P})]})}),m.length>0&&m.map((o,r)=>t("div",{className:ns.imageItem,children:[e(ts,{images:m,frameHeight:F}),e("div",{className:"buttons",children:m.length>0&&!g&&e(S,{onClick:()=>k(o),loading:l,icon:e(ve,{}),children:y("Use this variant")})})]},r))]})]})},ss=e=>{(null==e?void 0:e.customTheme)&&((e={})=>{const t=document.querySelector("head");if(!t)return;const o=document.createElement("style");if(o.type="text/css",o.dataset.themeVariablesFm="true",o.setAttribute("data-file-manager","true"),Object.entries(e).length){let r="";Object.entries(e).forEach(([e,t])=>{"object"!=typeof t&&(r+=`\t--${e}: ${t};\n`)}),r=`.em-filemanager {\n${r}}`,o.appendChild(document.createTextNode(r));const n=t.querySelector('[data-theme-variables-fm="true"]');n?t.replaceChild(o,n):t.insertBefore(o,t.firstChild)}})(null==e?void 0:e.customTheme)},{Sider:ds,Content:cs}=$,us=n.lazy(()=>import("./file-manager-IconsTab-DoB38f7f.js")),fs=n.lazy(()=>import("./file-manager-ImageCodeGenerator-CqcxlFj4.js")),hs={keywords:""},ms=()=>{var l,s,u;const f=Qn(),h=zi(),m=(()=>{var e,t;const{state:o,actions:r,options:n}=pn(),{selectedFolder:i,pathHistory:a,folders:l}=o,{t:s}=dr(),{setSelectedFolder:c,setPathHistory:u}=r,f=d(()=>{var e;return`em_fm:lastFolder:${(null===(e=null==n?void 0:n.config)||void 0===e?void 0:e.projectId)||"default"}`},[null===(e=null==n?void 0:n.config)||void 0===e?void 0:e.projectId]),h=d((e,t=new Set)=>{if(t.has(e))return console.warn(`Cycle detected in the path to the folder with id=${e}`),[];const o=(Array.isArray(l)?l:[]).find(t=>t.id===e);if(!o)return[];const r=new Set(t);return r.add(e),o.parentId?o.parentId===o.id?(console.warn(`Cycle detected: folder ${o.id} is a parent of itself`),[{id:o.id,name:o.name+" (ошибка)"}]):[...h(o.parentId,r),{id:o.id,name:o.name}]:[{id:o.id,name:o.name}]},[l]),m=d(e=>{var t;if("undefined"==typeof window)return;const o=!0===(null===(t=null==n?void 0:n.config)||void 0===t?void 0:t.rememberLastFolder),r=f();try{if(!o)return void localStorage.removeItem(r);e?localStorage.setItem(r,e):localStorage.removeItem(r)}catch(e){}},[f,null===(t=null==n?void 0:n.config)||void 0===t?void 0:t.rememberLastFolder]),p=d(e=>{if("folders"===e){const e=[{id:"folders",name:s("Folders")}];return null==u||u(e),void(n.onPathChange&&n.onPathChange([]))}if(!(Array.isArray(l)?l:[]).find(t=>t.id===e))return void console.warn("⚠️ Folder not found:",e);const t=h(e),o=[{id:"folders",name:s("Folders")},...t];null==u||u(o),n.onPathChange&&n.onPathChange(o.map(e=>e.name))},[l,h,u,n,s]),g=d(e=>{const t="folders"===e?null:e;t!==i&&(null==c||c(t),m(t),p(e))},[m,i,c,p]),v=d(e=>{if(-1===e)null==c||c(null),null==u||u([{id:"folders",name:s("Folders")}]),n.onPathChange&&n.onPathChange([]);else{const t=a.slice(0,e+1),o=t[t.length-1],r="folders"===o.id?void 0:o.id;null==c||c(r||null),null==u||u(t),n.onPathChange&&n.onPathChange(t.map(e=>e.name))}},[n,a,u,c,s]),y=d(e=>{if(!e.isFolder)return;null==c||c(e.id);const t={id:e.id,name:e.name};if(u){const e=[...a,t];u(e)}if(n.onPathChange){const t=[...a.map(e=>e.name),e.name];n.onPathChange(t)}},[n,a,u,c]);return{state:{selectedFolder:i,pathHistory:a},actions:{handleFolderSelect:g,handleBreadcrumbClick:v,handleItemClick:y},selectedFolder:i,pathHistory:a,handleFolderSelect:g,handleBreadcrumbClick:v,handleItemClick:y}})(),p=(()=>{const{state:e,actions:t}=pn(),{pagination:o}=e,{setPagination:r}=t,n=d((e,t)=>{const n=t||o.pageSize;null==r||r({current:e,pageSize:n,total:o.total})},[o.pageSize,o.total,r]);return{state:{pagination:o},actions:{handlePaginationChange:n}}})(),v=(()=>{const[e,t]=i([]),[o,r]=i(!1),[n,a]=i(!1),l=c(0),s=c(new Map),u=d(()=>(l.current+=1,`upload_${l.current}_${Date.now()}`),[]),f=d(e=>Or(e.size),[]),h=d((e,o)=>{const n=o.map(t=>({id:u(),folderId:e,name:t.name,size:f(t),status:"uploading",progress:0}));return t(n),r(!0),a(!1),n.map(e=>e.id)},[u,f]),m=d((e,o)=>{const n={id:u(),folderId:e,name:o,size:void 0,status:"uploading",progress:0};return t(e=>[...e,n]),r(!0),a(!1),n.id},[u]),p=d((e,o)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{progress:Math.min(100,Math.max(0,o))}):t))},[]),g=d((e,o)=>{o&&s.current.set(e,o),t(t=>t.map(t=>{if(t.id===e){const e=Object.assign(Object.assign({},t),{status:"success",progress:100});return(null==o?void 0:o.name)&&(e.name=o.name),(null==o?void 0:o.size)&&void 0===t.size&&(e.size=Or(o.size)),e}return t}))},[]),v=d((e,o)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{status:"error",error:o}):t))},[]),y=d(()=>{r(!1),a(!1),setTimeout(()=>{t([]),s.current.clear()},300)},[]),w=d(()=>{a(e=>!e)},[]),b=d(e=>s.current.get(e),[]),C=e.length,I=e.filter(e=>"success"===e.status||"error"===e.status).length;return{uploadFiles:e,isUploadVisible:o,isUploadMinimized:n,totalFiles:C,completedFiles:I,startUpload:h,startUploadByUrl:m,updateProgress:p,markAsSuccess:g,markAsError:v,getUploadedFile:b,closeUpload:y,minimizeUpload:w}})(),y=Si(),{deleteItems:w}=Jn(),b=Tn(),{t:C}=dr(),{options:I,state:F,actions:A}=pn(),_=I,S=null==_?void 0:_.onChangeSelection,E=F,x=null==_?void 0:_.config,{dataProviders:P}=_,{form:R,urlForm:k,renameForm:N,moveForm:O,renameFolderForm:T,copyForm:L,isModalVisible:M,isUrlModalVisible:j,isMoveModalVisible:D,isRenameFolderModalVisible:B,isCopyModalVisible:z,isDeleteConfirmVisible:q,folderToRename:W,activeLibraryItem:H}=F,{setIsUrlModalVisible:G,setActiveLibraryItem:K}=A,{config:Q}=I,{DropZoneFileIcon:J}=vn(),[Y,Z]=i(!1),[X,ee]=i(!1),[te,oe]=i(!1),re=c(0),ne=c(!1);ne.current=X;const ie=n.useRef(null),ae=n.useRef([]),[le,se]=i(!1),[de,ce]=i(!1),ue=ki(e=>e.selectedFiles),fe=ki(e=>e.clearSelection),he=ki(e=>e.syncVisibleFiles),{folders:me,loading:pe}=f.state,{fetchFolders:ge,fetchChildFolders:ve,handleCreateFolder:ye,handleModalOk:be,handleModalCancel:Ce,generateMenuItems:Ie}=f.actions,Fe=(e=>{var t;const{state:o,actions:r,options:n}=pn(),{t:i}=dr(),a=Tn(),{folders:l,folderToRename:s,renameFolderForm:c,isRenameFolderModalVisible:u}=o,{setFolderToRename:f,setIsRenameFolderModalVisible:h}=r,{apiEndpoints:m,dataProviders:p,config:g}=n,v=d(e=>{null==f||f(e),null==h||h(!0);const t=null==l?void 0:l.find(t=>t.id===e);t&&c&&c.setFieldsValue({newFolderName:t.name})},[f,h,l,c]),y=d(()=>{null==h||h(!1),null==f||f(null),null==c||c.resetFields()},[h,f,c]),w=d(async()=>{var t,o;if(s&&c)try{const n=await c.validateFields();if(!(null==n?void 0:n.newFolderName))return void a.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:i("Folder name cannot be empty"),placement:"bottomRight",data:{folderId:s,folderName:null==n?void 0:n.newFolderName,reason:"emptyName"}});if(!1===(null===(t=null==g?void 0:g.features)||void 0===t?void 0:t.enableRenameFolder))return void a.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:i("Folder rename is disabled by config"),placement:"bottomRight",data:{itemId:null!=s?s:void 0,itemName:null==n?void 0:n.newFolderName}});if(!(null==p?void 0:p.renameFolder))throw new Error(i("renameFolder is not implemented in dataProviders"));const l=await p.renameFolder(s,n.newFolderName.trim());if(!(null==l?void 0:l.id))return void a.error({id:"FOLDER_RENAME_FAILED",message:i("Unexpected response when renaming folder"),placement:"bottomRight",data:{itemId:null!=s?s:void 0,itemName:n.newFolderName,error:{message:"invalidResponse"}}});a.success({id:"FOLDER_RENAME_SUCCESS",message:i("Folder renamed"),placement:"bottomRight",data:{itemId:l.id,itemName:l.name,folderId:null!==(o=l.parentId)&&void 0!==o?o:null}}),y(),await e(),s!==l.id&&r.setSelectedFolder&&r.setSelectedFolder(l.id)}catch(e){console.error("Ошибка при переименовании папки:",e),a.error({id:"FOLDER_RENAME_FAILED",message:i("Failed to rename folder"),placement:"bottomRight",innerException:e,data:{itemId:null!=s?s:void 0,itemName:null==c?void 0:c.getFieldValue("newFolderName"),error:{message:e instanceof Error?e.message:String(e)}}})}},[s,c,m,y,e,i,null===(t=null==g?void 0:g.features)||void 0===t?void 0:t.enableRenameFolder,a]);return{state:{isRenamingFolder:u||!1,folderToRename:s},actions:{showRenameFolderModal:v,handleRenameFolderCancel:y,handleRenameFolderOk:w}}})(ge),{files:Ae,loading:_e,isRenamingFile:Se,fileToRename:Ee}=h.state,{fetchFiles:xe,handleDeleteFile:Pe,handleDeleteFolder:Re,handleAddFile:ke,handleAddFileByUrl:Ne,showRenameModal:Oe,handleRenameCancel:Te,handleRenameOk:Le,handleDroppedFiles:Me,showMoveModal:Ue,handleMoveCancel:je,handleMoveOk:De,handleCopyOk:Be,handleCopyCancel:ze,showDeleteConfirm:qe,handleDeleteConfirmCancel:Ve,handleDeleteConfirmOk:We}=h.actions,{selectedFolder:He,pathHistory:$e}=m.state,{handleFolderSelect:Ge,handleItemClick:Ke}=m.actions,{pagination:Qe}=p.state,Je=Rn(xe),{searchTerm:Ye,sortBy:Ze,sortOrder:Xe}=Je.state,{handleSearch:et,handleSort:tt,handlePaginationChange:ot}=Je.actions,rt=d(async()=>{const e=(e=>Hn(e))($e||[]);try{await Kn({options:_,pathFolder:e,dataProviders:null==_?void 0:_.dataProviders})}catch(e){console.error("Cache clear failed:",e)}await ge(),await xe({folderId:He||"",page:Qe.current,limit:Qe.pageSize,search:Ye,sortBy:Ze,sortOrder:Xe,itemType:"all"})},[xe,ge,_,Qe,$e,Ye,He,Ze,Xe]),nt=(({files:e,fetchFiles:t,selectedFolder:o})=>{var n;const{t:i}=dr(),a=Tn(),{options:l,actions:s,state:d}=r.useContext(mn),{setActiveLibraryItem:c}=s,{activeLibraryItem:u}=d,f=Si(),[h,m]=r.useState(!1),[p,g]=r.useState(null),v=r.useCallback(e=>{var t;if(e.type&&e.type.startsWith("image/"))return!0;if(e.extension){const t=e.extension.toLowerCase();return bt.includes(t)}const o=null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();return!!o&&bt.includes(o)},[]),y=r.useCallback(async(e,t)=>{var o,r;const{dataProviders:n}=l;if(!1===(null===(r=null===(o=l.config)||void 0===o?void 0:o.features)||void 0===r?void 0:r.enableUpdateFile))throw new Yn(i("Updating files is disabled by configuration"),"UnsupportedOperation");if(!e.id||!e.thumbnail||!(null==n?void 0:n.updateFile))throw new Yn(i("Failed to save changes"),"UnsupportedOperation");const a=(null==t?void 0:t.mimeType)||Ot(e.thumbnail,e.type),s=Tt(a),d=e.name.lastIndexOf("."),c=`${d>0?e.name.substring(0,d):e.name}.${s}`,u=(null==t?void 0:t.blob)||Bt(e.thumbnail,a);return n.updateFile(e.id,{name:c,type:a,data:u})},[l,i]),w=r.useCallback(async(e,t)=>{var o,r,n;if(!e.thumbnail)throw new Yn(i("Failed to save changes"),"ValidationError");const a=!(!0===(null===(o=l.config)||void 0===o?void 0:o.saveCopyToCurrentFolder))||(null!==(r=e.saveWithoutFolder)&&void 0!==r?r:!e.id),s=a?void 0:null!==(n=e.folderId)&&void 0!==n?n:void 0,d=(null==t?void 0:t.mimeType)||Ot(e.thumbnail,e.type),c=(null==t?void 0:t.blob)||Bt(e.thumbnail,d),u=new File([c],e.name,{type:d,lastModified:Date.now()}),h=await f.uploadFileWithProvider(u,s,void 0,a);if(!h)throw new Yn(i("Failed to save image copy"),"FileWriteError");return h},[f,null===(n=l.config)||void 0===n?void 0:n.saveCopyToCurrentFolder,i]),b=r.useCallback(t=>{let o;if(t)o=t;else{const t=ki.getState().selectedFiles;if(1!==t.size)return;const r=Array.from(t)[0];if(o=e.find(e=>e.id===r),!o||o.isFolder||!v(o))return}c&&c(ft),g(o),m(!0)},[e,v,m,c]),C=r.useCallback(()=>{c&&u===ft&&c(at),m(!1),g(null)},[u,c]),I=r.useCallback(async(e,r)=>{var n,s,d,c,u,f;try{const d=await y(e,r);return a.success({id:"IMAGE_UPDATE_SUCCESS",message:i("Success"),description:i("Image updated successfully"),placement:"bottomRight",data:{itemId:null!==(n=null==d?void 0:d.id)&&void 0!==n?n:void 0,itemName:null==d?void 0:d.name,folderId:null!==(s=null==d?void 0:d.folderId)&&void 0!==s?s:null,thumbnail:null==d?void 0:d.thumbnail}}),d&&l.onEditorOk&&l.onEditorOk(d,{mode:r.mode}),await t({folderId:o||""}),C(),null!=d?d:void 0}catch(t){const o=Bn(t),r=null!==(c=null!==(d=jn(null==o?void 0:o.code,i))&&void 0!==d?d:null==o?void 0:o.message)&&void 0!==c?c:i("Failed to save changes");throw a.error({id:"IMAGE_SAVE_FAILED",message:r,innerException:t,placement:"bottomRight",data:{itemId:null!==(u=e.id)&&void 0!==u?u:void 0,itemName:e.name,folderId:null!==(f=e.folderId)&&void 0!==f?f:null,thumbnail:e.thumbnail}}),t.notificationShown=!0,t}},[y,l,t,o,a,C,i]),F=r.useCallback(async(e,r)=>{var n,s,d,c,u,f;try{const d=await w(e,r);return a.success({id:"IMAGE_SAVE_COPY_SUCCESS",message:i("Success"),description:i("Image copy saved successfully"),placement:"bottomRight",data:{itemId:null!==(n=null==d?void 0:d.id)&&void 0!==n?n:void 0,itemName:null==d?void 0:d.name,folderId:null!==(s=null==d?void 0:d.folderId)&&void 0!==s?s:null,thumbnail:null==d?void 0:d.thumbnail}}),d&&l.onEditorOk&&l.onEditorOk(d,{mode:r.mode}),await t({folderId:o||""}),C(),null!=d?d:void 0}catch(t){const o=Bn(t),r=null!==(c=null!==(d=jn(null==o?void 0:o.code,i))&&void 0!==d?d:null==o?void 0:o.message)&&void 0!==c?c:i("Failed to save image copy");throw a.error({id:"IMAGE_SAVE_COPY_FAILED",message:r,innerException:t,placement:"bottomRight",data:{itemId:null!==(u=e.id)&&void 0!==u?u:void 0,itemName:e.name,folderId:null!==(f=e.folderId)&&void 0!==f?f:null,thumbnail:e.thumbnail}}),t.notificationShown=!0,t}},[w,l,t,o,a,C,i]);return{isPixieEditorVisible:h,editingFile:p,handleEdit:b,handlePixieEditorSave:I,handlePixieEditorSaveCopy:F,handlePixieEditorClose:C}})({files:Ae||[],fetchFiles:xe,selectedFolder:He||null}),[it,mt]=i(!1),pt=d(e=>{if(e.preventDefault(),e.stopPropagation(),!e.dataTransfer||!e.dataTransfer.types||!e.dataTransfer.types.includes("Files"))return;e.dataTransfer.dropEffect="copy";const t=e.relatedTarget,o=e.currentTarget;t&&o.contains(t)||(re.current+=1,re.current>0&&Z(!0))},[]),gt=d(e=>{e.preventDefault(),e.stopPropagation();const t=e.relatedTarget,o=e.currentTarget;if(t&&!o.contains(t))re.current=Math.max(0,re.current-1),re.current<=0&&Z(!1);else if(t){const e=t.closest('[class*="dragOverlay"]');if(e&&o.contains(e))return}},[]),vt=d(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},[]),yt=d(e=>{e.preventDefault(),e.stopPropagation(),Z(!1),re.current=0;const t=(()=>{var t;const o=e.dataTransfer;if(!o)return[];if(null===(t=o.files)||void 0===t?void 0:t.length)return Array.from(o.files);const r=[];if(o.items)for(let e=0;e<o.items.length;e++){const t=o.items[e].getAsFile();t&&r.push(t)}return r})();t.length&&(mt(!0),Me(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error("Ошибка при загрузке файлов:",e)}).finally(()=>{mt(!1)}))},[Me]),wt=d(()=>{Z(!1),re.current=0,document.body.removeAttribute("data-fm-dragging"),oe(!1),ee(!1)},[]);n.useEffect(()=>{ae.current=Ae||[]},[Ae]);const Ct=null==E?void 0:E.activeLibraryItem;a(()=>{const e=e=>{e?document.body.setAttribute("data-fm-dragging","true"):document.body.removeAttribute("data-fm-dragging")};let t=!1;const o=o=>{var r,n;!t&&(null===(n=null===(r=o.dataTransfer)||void 0===r?void 0:r.types)||void 0===n?void 0:n.includes("Files"))&&(t=!0,oe(!0),e(!0),Ct===at&&ee(!0))},r=o=>{const r=o.relatedTarget;(!r||!document.documentElement.contains(r))&&t&&(t=!1,oe(!1),ee(!1),e(!1))};return window.addEventListener("dragenter",o,!0),window.addEventListener("dragleave",r,!0),()=>{window.removeEventListener("dragenter",o,!0),window.removeEventListener("dragleave",r,!0),document.body.removeAttribute("data-fm-dragging")}},[Ct]),a(()=>{const e=e=>{var t,o;if(document.body.removeAttribute("data-fm-dragging"),oe(!1),!(null===(o=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===o?void 0:o.includes("Files")))return;e.preventDefault();const r=(e=>{var t;if(!e)return[];if(null===(t=e.files)||void 0===t?void 0:t.length)return Array.from(e.files);const o=[];if(e.items)for(let t=0;t<e.items.length;t++){const r=e.items[t].getAsFile();r&&o.push(r)}return o})(e.dataTransfer);if(!r.length)return;const n=e.target,i=n.closest(`.${ra.filesContainer.replace(/\s+/g,".")}`)||n.closest("[data-files-container]"),a=n.closest(".em-filemanager")||n.closest(".file-manager__layout")||n.closest("[data-drop-overlay]")||n.closest("[data-drag-capture]");(ne.current||Y||i||a)&&(e.preventDefault(),e.stopPropagation(),ee(!1),Z(!1),re.current=0,mt(!0),Me(r).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error("Ошибка при загрузке файлов:",e)}).finally(()=>mt(!1)))},t=e=>{var t,o;(null===(o=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===o?void 0:o.includes("Files"))&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",document.body.hasAttribute("data-fm-dragging")||(document.body.setAttribute("data-fm-dragging","true"),oe(!0)),Ct!==at||ne.current||ee(!0))},o=e=>{var t,o;(null===(o=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===o?void 0:o.includes("Files"))&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",document.body.setAttribute("data-fm-dragging","true"),oe(!0))},r={capture:!0,passive:!1};return window.addEventListener("drop",e,r),window.addEventListener("dragover",t,r),window.addEventListener("dragenter",o,r),()=>{window.removeEventListener("drop",e,r),window.removeEventListener("dragover",t,r),window.removeEventListener("dragenter",o,r)}},[Y,Me,Ct]),a(()=>{const e=e=>{Y&&wt(),ee(!1),oe(!1),document.body.removeAttribute("data-fm-dragging")};return window.addEventListener("dragend",e,!0),()=>window.removeEventListener("dragend",e,!0)},[Y,wt]),a(()=>{let e=null;const t=t=>{Y&&(e=setTimeout(()=>{Y&&wt()},200))};return document.addEventListener("mouseup",t,!0),()=>{document.removeEventListener("mouseup",t,!0),e&&clearTimeout(e)}},[Y,wt]),a(()=>{const e=e=>{"Escape"===e.key&&Y&&wt()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[Y,wt]),a(()=>{const e=e=>{Y&&setTimeout(()=>{Y&&wt()},100)};return document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}},[Y,wt]);const Ft=n.useCallback(async()=>{await We(),await ge(),He===ht&&ve&&await ve(ht),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var e,t;return null===(t=null===(e=ie.current)||void 0===e?void 0:e.refreshFileCounts)||void 0===t?void 0:t.call(e)})})},[ge,ve,We,He]),At=n.useCallback(()=>{ce(!0)},[]),_t=n.useCallback(async()=>{var e,t;if(He!==ht)return console.error("Clear trash called outside of trash folder"),void ce(!1);try{if(null==P?void 0:P.cleanTrash){const t=await P.cleanTrash();await xe({folderId:ht}),await(null===(e=ie.current)||void 0===e?void 0:e.refreshFileCounts()),t.success?b.success({id:"TRASH_CLEARED_SUCCESS",message:C("Trash cleared successfully"),description:C("{{count}} items permanently deleted",{count:t.deletedCount||0}),placement:"bottomRight"}):b.error({id:"TRASH_CLEAR_FAILED",message:C("Failed to clear trash"),placement:"bottomRight"})}else{const e=ae.current||[];if(0===e.length)return void ce(!1);const o=e.map(e=>({id:e.id,isFolder:e.isFolder})),r=await w({items:o,selectedFolder:ht,getItemNameById:t=>{var o;return(null===(o=e.find(e=>e.id===t))||void 0===o?void 0:o.name)||t||""},showNotifications:!1});await xe({folderId:ht}),await(null===(t=ie.current)||void 0===t?void 0:t.refreshFileCounts());const{successCount:n,failCount:i}=r;0===i?b.success({id:"TRASH_CLEARED_SUCCESS",message:C("Trash cleared successfully"),description:C("{{count}} items permanently deleted",{count:n}),placement:"bottomRight"}):n>0?b.warning({id:"TRASH_CLEARED_PARTIAL",message:C("Trash partially cleared"),description:C("{{succeeded}} items deleted, {{failed}} items failed",{succeeded:n,failed:i}),placement:"bottomRight"}):b.error({id:"TRASH_CLEAR_FAILED",message:C("Failed to clear trash"),placement:"bottomRight"})}ce(!1)}catch(e){console.error("Error clearing trash:",e),b.error({id:"TRASH_CLEAR_ERROR",message:C("Error clearing trash"),placement:"bottomRight"}),ce(!1)}},[He,P,xe,b,C,w]),St=n.useCallback(()=>{ce(!1)},[]),Et=n.useCallback(async e=>{var t;await De(e),await(null===(t=ie.current)||void 0===t?void 0:t.refreshFileCounts())},[De]),xt=n.useCallback(async e=>{var t;await Be(e),await(null===(t=ie.current)||void 0===t?void 0:t.refreshFileCounts())},[Be]),Rt=n.useCallback(async()=>{let e=[],t=new Map;const o=null==_?void 0:_.config;await ke({onStartBatch:r=>{e=v.startUpload(He||void 0,r),t=new Map,r.forEach((r,n)=>{const i=e[n];i&&(t.set(r.name,i),t.set(Yt(r.name,o),i))})},onStart:r=>{if(0===e.length){e=v.startUpload(He||void 0,[r]);const n=e[0];n&&(t.set(r.name,n),t.set(Yt(r.name,o),n))}},onProgress:(e,o)=>{const r=t.get(e);r&&v.updateProgress(r,o)},onComplete:async e=>{var o;const r=t.get(e);if(r){await new Promise(e=>setTimeout(e,100));const t=null==Ae?void 0:Ae.find(t=>t.name===e&&!t.isFolder);v.markAsSuccess(r,t)}await(null===(o=ie.current)||void 0===o?void 0:o.refreshFileCounts())},onError:(o,r,n)=>{var i;const a=null!==(i=t.get(o))&&void 0!==i?i:null!=n&&n<e.length?e[n]:void 0;a&&v.markAsError(a,r)},onBatchComplete:async o=>{var r,n,i,a,l,s,d,c;for(let c=0;c<o.successes.length;c++){const u=o.successes[c],f=null===(r=o.uploadedFiles)||void 0===r?void 0:r.get(u),h=null!==(a=null!==(i=null!==(n=t.get(u))&&void 0!==n?n:(null==f?void 0:f.originalFileName)?t.get(f.originalFileName):void 0)&&void 0!==i?i:null!=(null==f?void 0:f.originalIndex)&&f.originalIndex<e.length?e[f.originalIndex]:void 0)&&void 0!==a?a:c<e.length?e[c]:void 0;if(h){let e;if(null==f?void 0:f.id){const t=f;e={id:t.id,name:null!==(l=t.name)&&void 0!==l?l:u,folderId:null!==(d=null!==(s=t.folderId)&&void 0!==s?s:He)&&void 0!==d?d:null,isFolder:!1,size:t.size}}else await new Promise(e=>setTimeout(e,100)),e=null==Ae?void 0:Ae.find(e=>e.name===u&&!e.isFolder);v.updateProgress(h,100),v.markAsSuccess(h,e)}}o.errors.forEach(({fileName:e,error:o})=>{const r=t.get(e);r&&v.markAsError(r,o)}),await(null===(c=ie.current)||void 0===c?void 0:c.refreshFileCounts())}})},[ke,v,Ae,He,null==_?void 0:_.config]),kt=n.useCallback(async(e,t,o,r)=>{var n,i;try{se(!0);let a=o||"uploaded-file";if(!o&&e){const t=e.split("?")[0].split("#")[0].split("/");a=t[t.length-1]||"uploaded-file";a.includes(".")&&(null===(n=a.split(".").pop())||void 0===n?void 0:n.length)&&a.split(".").pop().length<=5||(a+=".jpg")}const l=v.startUploadByUrl(He||void 0,a);try{const o=await Ne(e,t,!0,null!=r?r:"uploadByUrl");if(v.updateProgress(l,100),o){await new Promise(e=>setTimeout(e,100));const e=(null==Ae?void 0:Ae.find(e=>e.id===o.id&&!e.isFolder))||o;v.markAsSuccess(l,e)}else v.markAsSuccess(l);await(null===(i=ie.current)||void 0===i?void 0:i.refreshFileCounts())}catch(e){const t=Bn(e),o=Wn(t,C);v.markAsError(l,o)}}finally{se(!1)}},[Ne,v,He,Ae,C]),Nt=n.useCallback(async({file:e})=>{var t;const o=v.startUpload(He||void 0,[e])[0];let r=0;const n=setInterval(()=>{r=Math.min(r+10+Math.floor(Date.now()%10),90),v.updateProgress(o,r)},200);try{const r=await y.uploadFileWithProvider(e,void 0,!0);if(clearInterval(n),v.updateProgress(o,100),r){await new Promise(e=>setTimeout(e,100));const e=(null==Ae?void 0:Ae.find(e=>e.id===r.id&&!e.isFolder))||r;v.markAsSuccess(o,e)}else v.markAsSuccess(o);const i=r&&r.folderId||He||null;return Ge&&Ge(i&&"folders"!==i?i:"folders"),await(null===(t=ie.current)||void 0===t?void 0:t.refreshFileCounts()),r}catch(e){clearInterval(n);const t=e instanceof Error?e.message:String(e);throw v.markAsError(o,t),e}},[y,v,He,Ae,Ge]),Lt=n.useCallback(async e=>{var t;if(Me){const o=v.startUpload(He||void 0,e);e.forEach(async(e,t)=>{const r=o[t];if(!r)return;let n=0;const i=setInterval(()=>{n=Math.min(n+10+Math.floor(Date.now()%10),85),v.updateProgress(r,n)},200);setTimeout(()=>{clearInterval(i)},2e3)}),await Me(e),o.forEach(e=>{v.updateProgress(e,100),v.markAsSuccess(e)}),await(null===(t=ie.current)||void 0===t?void 0:t.refreshFileCounts())}},[Me,v,He]),Mt=n.useCallback(async e=>{var t;await Re(e),await ge(),await(null===(t=ie.current)||void 0===t?void 0:t.refreshFileCounts())},[Re,ge]),Ut=(({files:e,clearSelection:t,showRenameModal:o,showMoveModal:n,showCopyModal:i,handleDeleteFile:a,handleDeleteFolder:l,showDeleteConfirm:s,onEdit:d})=>{const c=r.useCallback(()=>{t()},[t]),u=r.useCallback(e=>{const t=ki.getState().selectedFiles;if(t&&1===t.size||e){const r=e||Array.from(t)[0];o(r)}},[o]),f=r.useCallback(t=>{const o=ki.getState().selectedFiles;if(o&&o.size>0||(null==t?void 0:t.id)){if(s)return void s();(t?[t.id]:o).forEach(t=>{const o=e.find(e=>e.id===t);o?o.isFolder?l(t):a(t):console.warn(`Объект с ID ${t} не найден в списке файлов`)})}},[e,a,l,s]);return{handleClearSelection:c,handleRename:u,handleDeleteSelected:f,handleCopy:r.useCallback(()=>{i()},[i]),handleMove:r.useCallback(()=>{n()},[n]),handleEdit:r.useCallback(()=>{d()},[d])}})({files:Ae||[],clearSelection:fe,showRenameModal:Oe,showMoveModal:Ue,showCopyModal:h.actions.showCopyModal||(()=>{}),handleDeleteFile:Pe,handleDeleteFolder:Mt,showDeleteConfirm:qe,onEdit:nt.handleEdit}),jt=pe||_e||it;a(()=>{Pt()},[]),g(()=>{H!==at?fe():he(Ae||[])},[H,Ae,he,fe]),a(()=>{if(!S||H!==at)return;if(!vo.current)return void(vo.current=!0);const e=(Array.isArray(Ae)?Ae:[]).filter(e=>ue.has(e.id));S(e)},[H,Ae,ue,S]),n.useEffect(()=>{if(!Ge||0===me.length)return;const e=!1!==(null==x?void 0:x.rememberLastFolder),t=`em_fm:lastFolder:${(null==x?void 0:x.projectId)||"default"}`;if(e&&"undefined"!=typeof window)try{const e=localStorage.getItem(t);if(e&&me.some(t=>t.id===e))return void Ge(e)}catch(e){}He||Ge("folders")},[He,Ge,me,null==x?void 0:x.rememberLastFolder,null==x?void 0:x.projectId]);const{handleRenameFolderCancel:Dt,handleRenameFolderOk:zt}=Fe.actions;a(()=>{const e=async e=>{if(H!==at)return;const t=document.activeElement;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||"true"===(null==t?void 0:t.getAttribute("contenteditable")))return;const o=e.clipboardData;if(!o)return;const r=Array.from(o.items),n=r.filter(e=>e.type.startsWith("image/"));if(n.length>0){const t=n.map(e=>e.getAsFile()).filter(e=>null!==e);return void(t.length>0&&(e.preventDefault(),await Lt(t)))}const i=r.find(e=>"text/plain"===e.type);i&&i.getAsString(async t=>{const o=t.trim();if(o.startsWith("http://")||o.startsWith("https://"))e.preventDefault(),await kt(o);else if(o.includes("<meta")||o.includes("http")){const t=o.match(/https?:\/\/[^\s"']+/);t&&(e.preventDefault(),await kt(t[0]))}})};return document.addEventListener("paste",e),()=>{document.removeEventListener("paste",e)}},[H,kt,Lt]);const qt=c(Qe);a(()=>{qt.current=Qe},[Qe]);const Vt=d(e=>{ot(e.current||qt.current.current,e.pageSize||qt.current.pageSize)},[ot]),Wt=d(e=>{null==Ke||Ke(e)},[Ke]),Ht=n.useCallback(e=>{const{sortBy:t,sortOrder:o}=(e=>{const[t,o]=e.split("-");return{sortBy:t,sortOrder:o}})(e);tt(t,o)},[tt]),[$t,Gt]=i(hs),[Kt,Qt]=i([]),Jt=c(null),[Zt,Xt]=i(It),[eo,to]=i([]),oo=c(null),[ro,no]=i(""),io=c(null),[ao,lo]=i(""),[so,co]=i([]),uo=n.useRef(void 0),[fo,ho]=i(!1),[mo,po]=i(!1),go=n.useRef(null),vo=n.useRef(!1),[yo,wo]=i({mode:"qr",rawText:"",foregroundHex:"#000000",backgroundHex:"#ffffff",transparentBackground:!1,qrSidePx:200,barcodeBarHeightPx:60}),bo=n.useRef(H),Co=n.useCallback(e=>{const t=e.indexOf(",");if(-1===t)return null;const o=e.substring(0,t),r=o.match(/^data:([^;]+)/),n=r&&r[1]||"image/svg+xml";let i,a="svg";if(n.includes("png")?a="png":(n.includes("jpeg")||n.includes("jpg"))&&(a="jpg"),/;base64/i.test(o)){const o=e.substring(t+1),r=atob(o),a=new Uint8Array(r.length);for(let e=0;e<r.length;e+=1)a[e]=r.charCodeAt(e);i=new Blob([a],{type:n})}else{const o=decodeURIComponent(e.substring(t+1));i=new Blob([o],{type:n})}return new File([i],`icon_${Date.now()}.${a}`,{type:n})},[]),Io=n.useCallback(async e=>{var t;const o=v.startUpload(He||void 0,[e])[0];let r=0;const n=setInterval(()=>{r=Math.min(r+10+Math.floor(Date.now()%10),90),v.updateProgress(o,r)},200);try{const r=await y.uploadFileWithProvider(e,void 0,!0);if(clearInterval(n),v.updateProgress(o,100),r){await new Promise(e=>setTimeout(e,100));const e=(null==Ae?void 0:Ae.find(e=>e.id===r.id&&!e.isFolder))||r;v.markAsSuccess(o,e)}else v.markAsSuccess(o);await(null===(t=ie.current)||void 0===t?void 0:t.refreshFileCounts())}catch(e){clearInterval(n);const t=e instanceof Error?e.message:String(e);throw v.markAsError(o,t),e}},[v,Ae,y,He]),Fo=d(async e=>{if(Boolean(e&&e.startsWith("data:"))){const t=Co(e);if(!t)return;return void await Io(t)}e&&await kt(e,void 0,void 0,"iconStock")},[Co,kt,Io]),Ao=d(async()=>{const e=null==Q?void 0:Q.fileForEdit;if(uo.current===e)return;if(H===ft&&e&&!nt.editingFile){uo.current=e;try{if("string"==typeof e){if(e.startsWith("data:"))return void(null==nt||nt.handleEdit({thumbnail:e,saveWithoutFolder:!0}));const t=await y.resolveFileForEditByUrl(e);uo.current===e&&(null==nt||nt.handleEdit(t))}}catch(t){uo.current===e&&(uo.current=null),console.error("Failed to open file in editor:",t),null==nt||nt.handlePixieEditorClose()}}},[null==Q?void 0:Q.fileForEdit,H,nt,y]);a(()=>{Ao()},[Ao]),a(()=>{var e,t,o,r;const n=bo.current;bo.current=H,H===at?(Qt([]),Gt(hs),to([]),Xt(It),co([]),lo(""),po(!1),ho(!1),n===at||n!==st&&n!==lt&&n!==ct||et("")):H===ct?null===(e=go.current)||void 0===e||e.focus():H===lt?null===(t=Jt.current)||void 0===t||t.focus():H===st?null===(o=oo.current)||void 0===o||o.focus():H===dt&&(null===(r=io.current)||void 0===r||r.focus())},[H,et]);const _o=n.useCallback(async()=>{var e;await zt(),await(null===(e=ie.current)||void 0===e?void 0:e.refreshFileCounts())},[zt]),So=d(e=>{var t;return e?(null===(t=e.files)||void 0===t?void 0:t.length)?Array.from(e.files):e.items?Array.from(e.items).map(e=>e.getAsFile()).filter(e=>Boolean(e)):[]:[]},[]);return t(o,{children:[te&&Ct===at&&we(e("div",{className:ra.dragCaptureLayer,"data-drag-capture":"true",onDragOver:e=>{var t,o;e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),(null===(o=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===o?void 0:o.includes("Files"))&&!ne.current&&ee(!0)},onDragEnter:e=>{var t,o;e.preventDefault(),e.stopPropagation(),(null===(o=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===o?void 0:o.includes("Files"))&&ee(!0)},onDragLeave:e=>{const t=e.relatedTarget;t&&document.documentElement.contains(t)||(ee(!1),oe(!1),document.body.removeAttribute("data-fm-dragging"))},onDrop:e=>{e.preventDefault(),e.stopPropagation(),oe(!1),ee(!1),document.body.removeAttribute("data-fm-dragging");const t=So(e.dataTransfer);t.length&&(mt(!0),Me(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error(e)}).finally(()=>mt(!1)))},"aria-hidden":"true"}),document.body),X&&we(e("div",{className:ra.dragOverlayGlobal,"data-drop-overlay":"true",onDragOver:e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},onDragEnter:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),e.stopPropagation(),ee(!1),oe(!1),document.body.removeAttribute("data-fm-dragging");const t=So(e.dataTransfer);t.length&&(mt(!0),Me(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error(e)}).finally(()=>mt(!1)))},"aria-hidden":"true",children:t("div",{className:ra.dragOverlayInner,children:[e("div",{className:ra.uploadIcon,children:e(J,{})}),e("div",{className:ra.textTitle,children:C("Drop files here to upload")}),e("div",{className:ra.textDescription,children:C("Supported files:")+" .jpg, .jpeg, .svg, .png"})]})}),document.body),e($,{className:"file-manager__layout",children:t("div",{className:ra.filesContainer,"data-files-container":"true",onDragOver:vt,onDragLeave:gt,onDragEnter:pt,onDrop:yt,children:[Y&&e("div",{className:ra.dragOverlay,children:t("div",{className:ra.dragOverlayInner,children:[e("div",{className:ra.uploadIcon,children:e(J,{})}),e("div",{className:ra.textTitle,children:C("Drop files here to upload")}),e("div",{className:ra.textDescription,children:C("Supported files:")+" .jpg, .jpeg, .svg, .png"})]})}),t($,{className:"file-manager__content",children:[e(ds,{width:320,theme:"light",className:"file-manager-sider",children:e(Ka,{ref:ie,selectedFolder:He||"folders",generateMenuItems:Ie,onFolderSelect:e=>null==Ge?void 0:Ge(e),folders:me||[],fetchFolders:ge,fetchChildFolders:ve,handleAddFile:Rt,setIsUrlModalVisible:e=>null==G?void 0:G(e),handleDeleteFolder:Mt,handleCreateFolder:ye,activeLibraryItem:H,setActiveLibraryItem:e=>null==K?void 0:K(e)})}),t($,{className:"file-manager__main-content",children:[it&&e(za,{style:{position:"absolute",width:"100%",height:"100%",top:0,left:0,zIndex:100,background:"var(--colorBgLayout)"}}),t(cs,{className:"main-content",children:[e(Ul,{activeLibraryItem:H,selectedFolder:(null===(l=null==me?void 0:me.find(e=>(null==e?void 0:e.id)===He))||void 0===l?void 0:l.name)||C("Folders"),isTrashFolder:"Trash"===He,onClearTrash:At,files:Ae||[],loading:jt,onRefresh:rt,refreshDisabled:_e||pe,showRefresh:!(!(null===(s=null==_?void 0:_.apiEndpoints)||void 0===s?void 0:s.clearCache)&&!(null===(u=null==_?void 0:_.dataProviders)||void 0===u?void 0:u.clearCache))}),e(V,{className:"zero-divider"}),H===at&&e(Ra,{searchTerm:Ye,handleAddFile:Rt,files:Ae||[],handleSearch:et,sortBy:Ze,sortOrder:Xe,handleSortOptionChange:Ht,pagination:Qe,setPagination:Vt,loading:jt,handleItemClick:Wt,onClearSelection:Ut.handleClearSelection,onRename:Ut.handleRename,onCopy:Ut.handleCopy,onMove:Ut.handleMove,onDelete:Ut.handleDeleteSelected,showRenameModal:Oe,showDeleteConfirm:qe,showCopyModal:h.actions.showCopyModal||(()=>{}),showMoveModal:Ue,onEdit:nt.handleEdit,getFileData:y.getFileData}),H===lt&&e(Hl,{imageGifList:Kt,setImageGifList:Qt,currentReqGif:$t,setCurrentReqGif:Gt,inputRef:Jt,customRequest:(e,t)=>kt(e,void 0,t,"gif")}),H===st&&e(Ql,{imageStockList:eo,setImageStockList:to,currentReq:Zt,setCurrentReq:Xt,inputRef:oo,customRequest:(e,t)=>kt(e,void 0,t,"imageStock")}),H===dt&&e(n.Suspense,{fallback:e("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e(U,{size:"large"})}),children:e(us,{customRequest:Fo,query:ro,setQuery:no,inputRef:io})}),H===ut&&e(n.Suspense,{fallback:e("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e(U,{size:"large"})}),children:e(fs,{customRequest:Nt,state:yo,setState:wo})}),H===ct&&!!(null==Q?void 0:Q.sseQuery)&&e(ls,{imageAiList:so,setImageAiList:co,aiImageRequest:ao,setAiImageRequest:lo,inputAiRef:go,customRequest:Nt,isLoadingAi:fo,setIsLoadingAi:ho,isImageUploaded:mo,setIsImageUploaded:po}),H===ft&&e(o,{})]})]})]}),le&&!v.isUploadVisible&&e("div",{style:{position:"fixed",inset:0,zIndex:1500,backgroundColor:"rgba(255, 255, 255, 0.5)",pointerEvents:"all",display:"flex",alignItems:"center",justifyContent:"center"},children:e(U,{size:"large"})}),e($a,{isModalVisible:M,handleModalOk:be,handleModalCancel:Ce,form:R,selectedFolder:He||null,folders:me||[],isUrlModalVisible:j,setIsUrlModalVisible:e=>null==G?void 0:G(e),handleAddFileByUrl:kt,urlForm:k,isRenameModalVisible:Se,handleRenameOk:()=>null==Le?void 0:Le(),handleRenameCancel:()=>null==Te?void 0:Te(),renameForm:N,fileToRename:Ee,files:Ae||[],isMoveModalVisible:D,handleMoveOk:Et,handleMoveCancel:je,moveForm:O,selectedFiles:ue||new Set,isRenameFolderModalVisible:B,handleRenameFolderOk:_o,handleRenameFolderCancel:Dt,renameFolderForm:T,folderToRename:W,isCopyModalVisible:z,handleCopyOk:xt,handleCopyCancel:ze,copyForm:L,isDeleteConfirmVisible:q,handleDeleteConfirmOk:Ft,handleDeleteConfirmCancel:()=>null==Ve?void 0:Ve(),isClearTrashConfirmVisible:de,handleClearTrashConfirm:_t,handleClearTrashCancel:St,fetchChildFolders:ve}),e(il,{visible:nt.isPixieEditorVisible,onClose:nt.handlePixieEditorClose,file:nt.editingFile,onSave:nt.handlePixieEditorSave,onSaveCopy:nt.handlePixieEditorSaveCopy}),e(Tl,{files:v.uploadFiles,visible:v.isUploadVisible,minimized:v.isUploadMinimized,totalFiles:v.totalFiles,completedFiles:v.completedFiles,onClose:v.closeUpload,onMinimize:v.minimizeUpload,onInsert:e=>{var t;const o=v.getUploadedFile(e.id)||e;null===(t=I.onEditorOk)||void 0===t||t.call(I,o)}})]})})]})},ps=h(({config:r={},onPathChange:i,onChangeSelection:l,onEditorOk:s,searchQuery:u="",sortBySize:f="name",apiEndpoints:h={},customIcons:m,dragDropIcon:p,dataProviders:g,handleNotify:v,handleError:y,handleSuccess:b})=>{const I=n.useMemo(()=>Object.assign({folderTreeLoading:"lazy",expandAllFoldersOnInit:!1,expandRootFolderOnInit:!1,iconStrokeWidth:1.4,availableImageExtensions:["jpg","jpeg","png","gif"],fileNameProcessing:Object.assign(Object.assign({},{transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0}),r.fileNameProcessing),folderNameProcessing:Object.assign(Object.assign({},{transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0}),r.folderNameProcessing)},r),[r]);n.useEffect(()=>{I.theme&&(e=>{if("system"===e){const t=matchMedia(vt).matches?pt:mt;e=e===gt?t:e}document.documentElement.setAttribute("data-theme",e)})(I.theme),ss(I)},[I]),a(()=>{I.locale&&I.locale!==Wo.language&&Wo.changeLanguage(I.locale),I.customLocale&&I.locale&&Wo.addResourceBundle(I.locale,"translation",I.customLocale,!0,!0)},[I.locale,I.customLocale]);const F=c(null),A=d(()=>{var e;return null!==(e=F.current)&&void 0!==e?e:document.body},[]),_=n.useMemo(()=>({apiEndpoints:h,searchQuery:u,sortBySize:f,onPathChange:i,onChangeSelection:l,onEditorOk:s,config:I,customIcons:m,dragDropIcon:p,dataProviders:g,handleNotify:v,handleError:y,handleSuccess:b,getModalContainer:A}),[h,u,f,i,l,s,I,m,p,g,v,y,b,A]);return e(C,{className:"em-filemanager",children:t(o,{children:[e(w,{getPopupContainer:()=>F.current||document.body,children:e(gn,{options:_,children:e(ms,{})})}),e("div",{ref:F,className:"file-manager-modal-root"})]})})});ps.displayName="FileManagerApp";const gs=J.ErrorBoundary,vs=t=>{var o,r,n;return e(cr,{i18n:Wo,children:e(_t,{externalTheme:null!==(r=null===(o=t.config)||void 0===o?void 0:o.theme)&&void 0!==r?r:"light",customThemeToken:null===(n=t.config)||void 0===n?void 0:n.customTheme,children:e(gs,{children:e(ps,Object.assign({},t))})})})},ys=new Map,ws=(t,o)=>{var r;let n;Pt();let i={};const a=e=>{const t=!e||"fileManager"!==e.mode&&"imageCenter"!==e.mode&&"plugin"!==e.mode?void 0:e.mode;return"imageCenter"===t?Et("imageCenter",e):Et(t)};if(t instanceof HTMLElement){n=t;i={config:a(o),apiEndpoints:null==o?void 0:o.apiEndpoints}}else{n=t.element;const e=a(t.config),o=Object.assign(Object.assign({},null===(r=t.config)||void 0===r?void 0:r.apiEndpoints),t.apiEndpoints);i={config:e,currentPath:t.currentPath,onPathChange:t.onPathChange,onChangeSelection:t.onChangeSelection,searchQuery:t.searchQuery,sortBySize:t.sortBySize,apiEndpoints:o,dataProviders:t.dataProviders,customIcons:t.customIcons,dragDropIcon:t.dragDropIcon,handleNotify:t.handleNotify,handleError:t.handleError,handleSuccess:t.handleSuccess}}const l=v(n);l.render(e(vs,Object.assign({},i))),ys.set(n.id||`container_${Date.now()}`,l)},bs=e=>{const t=e.id||Object.keys(ys).find(e=>e.startsWith("container_"));if(t&&ys.has(t)){const e=ys.get(t);null==e||e.unmount(),ys.delete(t)}else{console.warn("Couldn t find the root to unmount");try{v(e).unmount()}catch(e){console.error("Error unmounting the component:",e)}}},Cs=new Map,Is=r=>{const{onClose:i,onSave:l,dataProviders:s,theme:u,locale:f,hasPagination:h,disablePagination:m,paginationAvailable:p,dedupeUploadNamesOnClient:g,saveCopyToCurrentFolder:v}=r,y=n.useMemo(()=>{var e,t;return{theme:null!=u?u:"light",locale:f,baseUrl:r.baseUrl,assetsUrl:r.assetsUrl,compressMaxSize:r.compressMaxSize,compressMaxWidthOrHeight:r.compressMaxWidthOrHeight,compessorUrl:null!==(e=r.compessorUrl)&&void 0!==e?e:r.compressorUrl,compressorUrl:null!==(t=r.compressorUrl)&&void 0!==t?t:r.compessorUrl,showNotifications:r.showNotifications,fetchWithProxy:r.fetchWithProxy,handleFileProxy:r.handleFileProxy,hasPagination:h,disablePagination:m,paginationAvailable:p,dedupeUploadNamesOnClient:g,saveCopyToCurrentFolder:v}},[u,f,r.baseUrl,r.assetsUrl,r.compressMaxSize,r.compressMaxWidthOrHeight,r.compessorUrl,r.compressorUrl,r.showNotifications,r.fetchWithProxy,r.handleFileProxy,h,m,p,g,v]),b=n.useCallback(async(e,t,o,r)=>{if(!e&&!t||!(null==s?void 0:s.getFiles))return null;try{const n=await s.getFiles({folderId:r?void 0:null!=o?o:void 0,noFolder:r,search:t||void 0,itemType:"file",page:1,limit:1}),[i]=n.files;return i?e&&i.id!==e?null:i:null}catch(e){return console.warn("Standalone Pixie: failed to resolve uploaded file from provider",e),null}},[s]),I=n.useCallback(async e=>{var t;if(!e||"function"!=typeof(null==s?void 0:s.getFileById))return null;try{return null!==(t=await s.getFileById(e))&&void 0!==t?t:null}catch(e){return console.warn("Standalone Pixie: failed to resolve uploaded file by id",e),null}},[s]),F=n.useMemo(()=>{if(r.file)return r.file;const e=r.name||"edited-image",t=r.extension||(r.type?r.type.split("/")[1]:"png"),o=r.type||`image/${t}`;return{thumbnail:r.imageDataUrl||"",name:e,id:void 0,type:o,extension:t,saveWithoutFolder:!0}},[r.file,r.imageDataUrl,r.name,r.extension,r.type]),A=n.useCallback(async(e,t)=>{if((null==s?void 0:s.updateFile)&&e.thumbnail)try{const o=(null==t?void 0:t.mimeType)||Ot(e.thumbnail,e.type),r=Tt(o),n=e.name.substring(0,e.name.lastIndexOf("."))+"."+r,i=(null==t?void 0:t.blob)||Bt(e.thumbnail,o);return await s.updateFile(e.id,{name:n,type:o,data:i})}catch(e){return console.error("Error updating the file through updateFile:",e),null}return console.warn("DataProvider for updating files is not configured"),null},[s]),_=n.useCallback(async(e,t)=>{var o,r,n,i,a;if(!e.thumbnail)return null;try{const l=!0!==y.saveCopyToCurrentFolder||(null!==(o=e.saveWithoutFolder)&&void 0!==o?o:!e.id),d=l?"":e.folderId||"",c=(null==t?void 0:t.mimeType)||Ot(e.thumbnail,e.type),u=(null==t?void 0:t.blob)||Bt(e.thumbnail,c),f=Yt(e.name,y),h=await Lr(s,f,d,l,Xt(y)),m=new File([u],h,{type:c,lastModified:Date.now()});if(null==s?void 0:s.uploadFiles){const t=await s.uploadFiles({items:[{name:m.name,size:m.size,type:m.type,folderId:d,noFolder:l,data:m,extension:Tt(c)}],folderId:d}),o=null===(r=t.detailed)||void 0===r?void 0:r[0];if(t.success&&(null==o?void 0:o.success)&&o.data){const t=o.data;if(t.url||t.thumbnailUrl||t.thumbnail)return{id:t.id||e.id||"",name:t.name||e.name,folderId:null!==(n=t.folderId)&&void 0!==n?n:d,type:t.type||m.type,size:null!==(i=t.size)&&void 0!==i?i:m.size,extension:t.extension||Tt(c),url:t.url,thumbnailUrl:t.thumbnailUrl,thumbnail:t.thumbnail,date:t.date,dimensions:t.dimensions,aspectRatio:t.aspectRatio,sourceUrl:t.sourceUrl,isFolder:!1,selected:!1};const r=await b(o.data.id,o.data.name||m.name,null!==(a=o.data.folderId)&&void 0!==a?a:d,l);if(r)return r;const s=await I(o.data.id);return s||null}}if(null==s?void 0:s.uploadFile){const e=await s.uploadFile({name:m.name,size:m.size,type:m.type,folderId:d,noFolder:l,data:m,extension:Tt(c)});if(!e)return null;if(e.url||e.thumbnailUrl||e.thumbnail)return e;const t=await I(e.id);return t||null}return null}catch(e){return console.error("Error saving file copy:",e),null}},[s,b,I,y]),S=n.useCallback(async(e,t)=>{if((null==s?void 0:s.updateFile)&&e.id&&e.thumbnail)try{const o=await A(e,t);o&&(e=o)}catch(e){console.error("Standalone Pixie: saveFileToServer error",e)}return l&&await l(e,t),i&&i(),e},[s,l,i,A]),E=n.useCallback(async(e,t)=>{if(e.thumbnail)try{const o=await _(e,t);if(!o)return;return l&&await l(o,t),i&&i(),o}catch(e){return void console.error("Standalone Pixie: saveFileCopyToServer error",e)}},[i,l,_]),x=c(null),P=d(()=>{var e;return null!==(e=x.current)&&void 0!==e?e:document.body},[]);return a(()=>{f&&f!==Wo.language&&Wo.changeLanguage(f)},[f]),e(C,{className:"em-filemanager",children:t(o,{children:[e(w,{getPopupContainer:()=>x.current||document.body,children:e(cr,{i18n:Wo,children:e(_t,{externalTheme:null!=u?u:"light",children:e(gs,{children:e(gn,{options:{dataProviders:s,handleNotify:r.handleNotify,handleError:r.handleError,handleSuccess:r.handleSuccess,config:y,getModalContainer:P},children:e(il,{visible:!0,onClose:i,file:F,onSave:S,onSaveCopy:E})})})})})}),e("div",{ref:x,className:"file-manager-modal-root"})]})})},Fs=t=>{Pt();const o=t.element,r=v(o);r.render(e(Is,Object.assign({},t))),Cs.set(o.id||`pixie_container_${Date.now()}`,r)},As=e=>{const t=Array.from(Cs.keys()).find(e=>e.startsWith("pixie_container_")),o=e.id||t;if(o&&Cs.has(o)){const e=Cs.get(o);null==e||e.unmount(),Cs.delete(o)}else{console.warn("Couldn t find the root to unmount Pixie");try{v(e).unmount()}catch(e){console.error("Error unmounting Pixie:",e)}}},_s=e=>{var t,o;const{mode:r,element:n,fileManager:i,pixieEditor:a,theme:l,dataProviders:s}=e;let d,c;const u={unmount:()=>{d&&bs(d),c&&As(c)},unmountFileManager:void 0,unmountPixieEditor:void 0};switch(r){case"fileManager":d=n,ws(n,Object.assign(Object.assign({},null==i?void 0:i.config),{theme:l||(null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.theme),apiEndpoints:null==i?void 0:i.apiEndpoints})),u.unmountFileManager=()=>bs(d);break;case"pixieEditor":c=n,Fs(Object.assign({element:n,theme:l||(null==a?void 0:a.theme),dataProviders:s||(null==a?void 0:a.dataProviders)},a)),u.unmountPixieEditor=()=>As(c);break;case"both":{const e=document.createElement("div");e.id="file-manager-container",e.style.cssText="height: 50%; border-bottom: 1px solid #d9d9d9;";const t=document.createElement("div");t.id="pixie-editor-container",t.style.cssText="height: 50%;",n.appendChild(e),n.appendChild(t),d=e,c=t,ws(d,Object.assign(Object.assign({},null==i?void 0:i.config),{theme:l||(null===(o=null==i?void 0:i.config)||void 0===o?void 0:o.theme),apiEndpoints:null==i?void 0:i.apiEndpoints})),Fs(Object.assign({element:c,theme:l||(null==a?void 0:a.theme),dataProviders:s||(null==a?void 0:a.dataProviders)},a)),u.unmountFileManager=()=>bs(d),u.unmountPixieEditor=()=>As(c);break}}return u};function Ss(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}const Es="";class xs{constructor(){this.map=new Map}static childrenViewKey(e,t){return`v${Es}${e}${Es}${t}`}static childrenCountKey(e){return`c${Es}${e}`}getFreshError(e,t){const o=this.map.get(e);return o?t!==1/0&&Date.now()-o.updatedAt>t?(this.map.delete(e),null):o.error:null}setError(e,t){this.map.set(e,{error:t,updatedAt:Date.now()})}delete(e){this.map.delete(e)}clearChildrenViewErrorsForParent(e){const t=`v${Es}${e}${Es}`;for(const e of[...this.map.keys()])e.startsWith(t)&&this.map.delete(e)}clearAll(){this.map.clear()}}class Ps{constructor(){this.deletingIds=new Set}beginDeleting(e){for(const t of e)t&&this.deletingIds.add(t)}endDeleting(e){for(const t of e)t&&this.deletingIds.delete(t)}isDeleting(e){return!!e&&this.deletingIds.has(e)}}function Rs(e){var t;return{sortBy:null!==(t=null==e?void 0:e.sortBy)&&void 0!==t?t:"name",sortOrder:null!=(null==e?void 0:e.sortOrder)?"desc"===e.sortOrder?"desc":"asc":null!=(null==e?void 0:e.sortBy)&&""!==e.sortBy?"desc":"asc"}}function ks(e,t,o){const{sortBy:r,sortOrder:n}=Rs(o);let i=0;switch(r){case"name":default:i=(e.name||"").localeCompare(t.name||"");break;case"date":i=new Date(e.date||0).getTime()-new Date(t.date||0).getTime();break;case"size":i=(Number(e.size)||0)-(Number(t.size)||0);break;case"type":i=(e.extension||e.type||"").toLowerCase().localeCompare((t.extension||t.type||"").toLowerCase())}return"desc"===n?-i:i}function Ns(e){return null!=e&&""!==String(e).trim()}function Os(e,t){const{sortBy:o}=Rs(t);switch(o){case"date":return!!Ns(e.date)&&!Number.isNaN(new Date(e.date).getTime());case"size":return null!=e.size&&Number.isFinite(Number(e.size));case"type":return Ns(e.extension)||Ns(e.type);default:return Ns(e.name)}}function Ts(e,t){var o,r,n,i,a,l;const s="string"==typeof(null==t?void 0:t.search)?t.search.trim():"";if(!s)return!0;const d=s.toLowerCase();return null!==(r=null===(o=e.name)||void 0===o?void 0:o.toLowerCase().includes(d))&&void 0!==r&&r||null!==(i=null===(n=e.type)||void 0===n?void 0:n.toLowerCase().includes(d))&&void 0!==i&&i||null!==(l=null===(a=e.extension)||void 0===a?void 0:a.toLowerCase().includes(d))&&void 0!==l&&l}const Ls=ks,Ms=Ts,Us=Os;function js(e={}){var t,o,r;return Object.assign(Object.assign({},e),{comparator:null!==(t=e.comparator)&&void 0!==t?t:Ls,filterMatch:null!==(o=e.filterMatch)&&void 0!==o?o:Ms,hasSortValue:null!==(r=e.hasSortValue)&&void 0!==r?r:Us})}const Ds="Trash";function Bs(e){return e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}function zs(e,t,o=Ds){const r=Bs(e);if(!r)return[];const n=[e,r];if(r===Bs(t)){n.push(t);const e=Bs(t);e===Ds||e.toLowerCase()===Ds.toLowerCase()?n.push(o,Ds,Ds.toLowerCase()):o!==Ds&&Bs(o)!==e&&n.push(o)}return Array.from(new Set(n.map(Bs).filter(Boolean)))}function qs(e){const t=new Map;for(const[o,r]of Object.entries(e))r.id&&t.set(Bs(o),r);return e=>{var o,r;const n=t.get(Bs(e));if(n)return{id:n.id,name:null!==(o=n.name)&&void 0!==o?o:n.id,folderId:null!==(r=n.folderId)&&void 0!==r?r:null,isFolder:!0}}}const Vs=18e5;function Ws(e){return null==e||""===e?"":e}function Hs(e){if(null==e)return 1/0;const t=Number(e);return Number.isFinite(t)&&t>=0?t:1/0}function $s(e){if(!e)return null;const t=e.folderId;return null==t?null:String(t)}function Gs(e){return!!e&&!!e.isFolder}function Ks(){var e;if("function"==typeof(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.crypto)||void 0===e?void 0:e.randomUUID))return globalThis.crypto.randomUUID();try{const e=globalThis.crypto||globalThis.msCrypto;if(e&&"function"==typeof e.getRandomValues){const t=new Uint8Array(16);e.getRandomValues(t);let o="";for(let e=0;e<t.length;e++)o+=t[e].toString(16).padStart(2,"0");return`id_${o}`}}catch(e){}return`id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(36).slice(0,8)}`}function Qs(e){var t,o,r,n;if(!e||"object"!=typeof e)return!1;const i=e;return"path_folder_not_found"===i.code||"folder_not_found"===i.code||"FolderNotFound"===i.code||"path_folder_not_found"===(null===(t=i.data)||void 0===t?void 0:t.code)||"folder_not_found"===(null===(o=i.data)||void 0===o?void 0:o.code)||404===i.status||404===(null===(n=null===(r=i.data)||void 0===r?void 0:r.data)||void 0===n?void 0:n.status)}function Js(e){if(!e||"object"!=typeof e)return String(null!=e?e:"");const t=e,o=[],r={},n=["page","pageSize","sortBy","sortOrder","search","itemType","limit"];for(const e of Object.keys(t).sort()){const i=t[e];n.includes(e)?o.push(`${e}=${String(null!=i?i:"")}`):r[e]=i}const i=Object.keys(r).length?JSON.stringify(r):"",a=o.join("|"),l=i?function(e){let t=2166136261;for(let o=0;o<e.length;o++)t^=e.charCodeAt(o),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}(i):"";return`${a}${l?`|${l}`:""}`}class Ys{constructor(){this.entities=new Map,this.childrenByParent=new Map,this.maxCacheSize=1e4}now(){return Date.now()}checkCacheSize(){if(this.entities.size>this.maxCacheSize){const e=Array.from(this.entities.entries()).sort((e,t)=>e[1].updatedAt-t[1].updatedAt),t=Math.floor(.1*this.maxCacheSize);for(let o=0;o<t&&o<e.length;o++){const[t,r]=e[o];this.deleteEntityById(t)}}}getEntity(e){var t;return null===(t=this.entities.get(e))||void 0===t?void 0:t.value}getRecord(e){return this.entities.get(e)}getFileSystemItem(e){const t=this.getEntity(e);return t&&!Gs(t)?t:void 0}getFolder(e){const t=this.getEntity(e);return t&&Gs(t)?t:void 0}getChildrenIds(e,t={}){const o=Ws(e),r=this.childrenByParent.get(o);return r?t.onlyFileSystemItems?Array.from(r.files):t.onlyFolders?Array.from(r.folders):[...Array.from(r.folders),...Array.from(r.files)]:[]}searchByUrl(e){for(const t of this.entities.values())if(t.value.url===e)return t.value;return null}upsertEntity(e){var t;const o=null!==(t=this.entities.get(e.id))&&void 0!==t?t:null,r=o?o.value:null,n=r?$s(r):null,i=$s(e),a=!!r&&Gs(r),l=Gs(e);let s;if(r&&Gs(r)&&l){const t=r.childrenCount,o=e.childrenCount;void 0!==t&&void 0===o&&(s=t)}if(r&&(n!==i||a!==l)){const t=Ws(n),o=this.childrenByParent.get(t);o&&(a?o.folders.delete(e.id):o.files.delete(e.id),0===o.files.size&&0===o.folders.size&&this.childrenByParent.delete(t))}let d=e;void 0!==s&&(d=Object.assign(Object.assign({},e),{childrenCount:s})),this.entities.set(e.id,{value:Object.assign({},d),updatedAt:this.now()}),this.checkCacheSize();const c=Ws(i);let u=this.childrenByParent.get(c);u||(u={files:new Set,folders:new Set},this.childrenByParent.set(c,u)),l?u.folders.add(e.id):u.files.add(e.id)}updateServerChildrenCount(e,t){if(null==e||null==t||Number.isNaN(t))return;const o=this.entities.get(e);if(!o||!Gs(o.value))return;const r=Object.assign(Object.assign({},o.value),{childrenCount:t});this.entities.set(e,{value:r,updatedAt:this.now()})}deleteEntityById(e){var t;const o=null!==(t=this.entities.get(e))&&void 0!==t?t:null;if(!o)return{entity:null,parentId:null};const r=o.value,n=$s(r),i=Ws(n),a=this.childrenByParent.get(i);return a&&(Gs(r)?a.folders.delete(e):a.files.delete(e),0===a.files.size&&0===a.folders.size&&this.childrenByParent.delete(i)),this.entities.delete(e),{entity:Object.assign({},r),parentId:n}}deleteFolderRecursive(e){const t=this.entities.get(e);if(!t||!Gs(t.value))return{deletedFolderRecords:[],deletedFileSystemItemRecords:[]};const o=[{id:e,parentId:$s(t.value)}],r=[],n=[];for(;o.length;){const e=o.shift();r.push(e);const t=this.childrenByParent.get(Ws(e.id));if(t){for(const e of Array.from(t.folders)){const t=this.entities.get(e);t&&o.push({id:e,parentId:$s(t.value)})}for(const e of Array.from(t.files))n.push(e)}}const i=[];for(const e of n){const t=this.entities.get(e);if(!t)continue;const o=t.value,r=Ws($s(o)),n=this.childrenByParent.get(r);n&&(n.files.delete(e),0===n.files.size&&0===n.folders.size&&this.childrenByParent.delete(r)),this.entities.delete(e),i.push(Object.assign({},o))}const a=[];for(let e=r.length-1;e>=0;e--){const{id:t,parentId:o}=r[e],n=this.entities.get(t);if(!n)continue;const i=n.value,l=Ws(i.id);this.childrenByParent.delete(l);const s=Ws(o),d=this.childrenByParent.get(s);d&&(d.folders.delete(t),0===d.files.size&&0===d.folders.size&&this.childrenByParent.delete(s)),this.entities.delete(t),a.push(Object.assign({},i))}return{deletedFolderRecords:a,deletedFileSystemItemRecords:i}}moveEntityById(e,t){var o;const r=null!==(o=this.entities.get(e))&&void 0!==o?o:null;if(!r)return null;const n=r.value,i=Ws($s(n)),a=this.childrenByParent.get(i);a&&(Gs(n)?a.folders.delete(e):a.files.delete(e),0===a.files.size&&0===a.folders.size&&this.childrenByParent.delete(i));const l=Object.assign(Object.assign({},n),{folderId:t});if(Gs(n)&&Gs(l)){const e=n.childrenCount;void 0!==e&&(l.childrenCount=e)}this.entities.set(e,{value:l,updatedAt:this.now()});const s=Ws(t);let d=this.childrenByParent.get(s);return d||(d={files:new Set,folders:new Set},this.childrenByParent.set(s,d)),Gs(l)?d.folders.add(e):d.files.add(e),Object.assign({},l)}copyFileSystemItem(e,t,o){var r;const n=null!==(r=this.entities.get(e))&&void 0!==r?r:null;if(!n||Gs(n.value))return null;const i=n.value,a=Object.assign(Object.assign({},i),{id:t,folderId:o});return this.upsertEntity(a),Object.assign({},a)}copyFolderShallow(e,t,o){var r;const n=null!==(r=this.entities.get(e))&&void 0!==r?r:null;if(!n||!Gs(n.value))return null;const i=n.value,a=Object.assign(Object.assign({},i),{id:t,folderId:o});return this.upsertEntity(a),Object.assign({},a)}isEntityStale(e,t){var o;const r=null!==(o=this.entities.get(e))&&void 0!==o?o:null;return!r||t!==1/0&&this.now()-r.updatedAt>t}touch(e,t){const o=this.entities.get(e);o&&(o.updatedAt=null!=t?t:this.now())}getEntitiesByIds(e){return e.map(e=>{var t,o;return null!==(o=null===(t=this.entities.get(e))||void 0===t?void 0:t.value)&&void 0!==o?o:null})}searchByName(e,t){var o,r,n,i,a;if(!e||""===e.trim())return[];const l=null==t?void 0:t.parentId,s=null!==(o=null==t?void 0:t.recursive)&&void 0!==o&&o,d=null!==(r=null==t?void 0:t.itemType)&&void 0!==r?r:"all",c=null!==(n=null==t?void 0:t.caseSensitive)&&void 0!==n&&n,u=null!==(i=null==t?void 0:t.limit)&&void 0!==i?i:1/0,f=c?e.trim():e.trim().toLowerCase(),h=[];let m=null;if(void 0!==l){m=new Set;const e=Ws(l);if(m.add(e),s){const t=[e],o=new Set;for(;t.length>0;){const e=t.shift();if(o.has(e))continue;o.add(e);const r=this.childrenByParent.get(e);if(r)for(const e of r.folders)m.add(e),t.push(e)}}}for(const[,e]of this.entities){if(h.length>=u)break;const t=e.value;if(null!==m){const e=Ws($s(t));if(!m.has(e))continue}if("file"===d&&Gs(t))continue;if("folder"===d&&!Gs(t))continue;const o=null!==(a=t.name)&&void 0!==a?a:"";(c?o:o.toLowerCase()).includes(f)&&h.push(Object.assign({},t))}return h}toJSON(){return{entities:Array.from(this.entities.entries()),childrenByParent:Array.from(this.childrenByParent.entries()).map(([e,t])=>[e,{files:Array.from(t.files),folders:Array.from(t.folders)}])}}static fromJSON(e){var t,o;const r=new Ys;for(const[o,n]of null!==(t=e.entities)&&void 0!==t?t:[])r.entities.set(o,{value:n.value,updatedAt:n.updatedAt});for(const[t,n]of null!==(o=e.childrenByParent)&&void 0!==o?o:[])r.childrenByParent.set(t,{files:new Set(n.files),folders:new Set(n.folders)});return r}}class Zs{constructor(e={},t=18e5,o,r,n=new xs,i=Qs){var a,l,s,d,c;this.views=new Map,this.maxViewsPerParent=50;const u=js(e);this.strategy={allowSortedInsert:null===(a=u.allowSortedInsert)||void 0===a||a,allowSearchInsert:null===(l=u.allowSearchInsert)||void 0===l||l,invalidateOnPaginationFull:null===(s=u.invalidateOnPaginationFull)||void 0===s||s,preloadPagesBefore:null!==(d=u.preloadPagesBefore)&&void 0!==d?d:0,preloadPagesAfter:null!==(c=u.preloadPagesAfter)&&void 0!==c?c:1,comparator:u.comparator,filterMatch:u.filterMatch,hasSortValue:u.hasSortValue},this.ttl=t,this.errorTtl=null!=o?o:t,this.entityTtl=null!=r?r:t,this.failedRequests=n,this.isFolderNotFoundError=i}setServerChildrenCountHandler(e){this.serverChildrenCountHandler=e}setChildrenCountInvalidator(e){this.childrenCountInvalidator=e}now(){return Date.now()}parentKey(e){return Ws(null!=e?e:null)}isExpired(e){return null==e||this.ttl!==1/0&&this.now()-e>this.ttl}areEntitiesStale(e,t){return!e||e.some(e=>!t.getEntity(e)||t.isEntityStale(e,this.entityTtl))}isEntityTypeCompatible(e,t){return!t||"all"===t||("file"===t&&!Gs(e)||!("folder"!==t||!Gs(e)))}markViewStaleForReload(e){var t;e.view.meta=Object.assign(Object.assign({},null!==(t=e.view.meta)&&void 0!==t?t:{}),{stale:!0}),e.view.updatedAt=this.now(),e.view.loadId=Ks(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}cleanupOldViews(e){if(e.size<=this.maxViewsPerParent)return;const t=Array.from(e.entries()).sort((e,t)=>(t[1].view.updatedAt||0)-(e[1].view.updatedAt||0));for(;e.size>this.maxViewsPerParent&&t.length>0;){const[o]=t.pop();e.delete(o)}}async getOrCreateChildren(e,t,o,r){var n,i,a;const l=this.parentKey(e),s=Js(null!=t?t:{});let d=this.views.get(l);d||(d=new Map,this.views.set(l,d));const c=xs.childrenViewKey(l,s);let u=d.get(s);if(!u){u={params:t,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},d.set(s,u),this.cleanupOldViews(d)}const f=this.failedRequests.getFreshError(c,this.errorTtl);if(null!=f)throw f;if(u.view.value&&!this.isExpired(u.view.updatedAt)&&!this.areEntitiesStale(u.view.value,r)&&!(null===(n=u.view.meta)||void 0===n?void 0:n.stale)){const e=u.view.value.map(e=>r.getEntity(e)).filter(Boolean),t=(null===(i=u.params)||void 0===i?void 0:i.itemType)||"all",o=e.filter(e=>this.isEntityTypeCompatible(e,t));return Object.assign({items:o},null!==(a=u.view.meta)&&void 0!==a?a:{})}if(u.view.promise)return u.view.promise;const h=Ks();u.view.loadId=h;const m=(async()=>{var n,i,a,s;try{const d=await o(e,t),f=function(e){return!!e&&"string"==typeof e.search&&e.search.trim().length>0}(t),m=f?Object.assign(Object.assign({},d),{total:void 0}):d,p=null===(n=this.views.get(l))||void 0===n?void 0:n.get(Js(t));if(!p||p.view.loadId!==h){const e=new Error("StaleLoad");throw e.name="StaleLoad",e}for(const e of m.items)r.upsertEntity(e);u.view.value=m.items.map(e=>e.id);const{items:g}=m,v=kn(m,["items"]),y=Object.assign({},v);u.view.meta=y,u.view.meta&&(u.view.meta.stale=!1),this.failedRequests.delete(c),u.view.updatedAt=this.now(),f||"number"!=typeof y.total||(this.serverChildrenCountHandler?this.serverChildrenCountHandler(null!=e?e:null,y.total,r):r.updateServerChildrenCount(e,y.total));const w=null!==(i=this.strategy.preloadPagesAfter)&&void 0!==i?i:0,b=null!==(a=this.strategy.preloadPagesBefore)&&void 0!==a?a:0,C=Hs(null==t?void 0:t.pageSize),I=Number.isFinite(C);if((w>0||b>0)&&I){const n=e,i=Object.assign({},t),a="number"==typeof y.totalPages?y.totalPages:1,l=null!==(s=null==t?void 0:t.page)&&void 0!==s?s:1,d=C,c=o,u=h;setTimeout(()=>{this.preloadPagesAsync(n,i,l,a,d,w,b,r,y,c,u)},0)}return m}catch(e){if("StaleLoad"===(null==e?void 0:e.name))throw this.failedRequests.delete(c),u.view.value=void 0,u.view.updatedAt=this.now(),e;if(this.isFolderNotFoundError(e))return this.failedRequests.delete(c),u.view.value=[],u.view.meta={total:0,totalPages:0},u.view.updatedAt=this.now(),{items:[],total:0,totalPages:0};throw this.failedRequests.setError(c,e),u.view.value=void 0,u.view.updatedAt=this.now(),e}finally{u.view.promise=null}})();return u.view.promise=m,m}async preloadPagesAsync(e,t,o,r,n,i,a,l,s,d,c){try{const n=this.parentKey(e),s=this.views.get(n);if(!s)return;const u=s.get(Js(t));if(!u)return;if(null!=c&&u.view.loadId!==c)return;const f=s.get(Js(t));if(!(null==f?void 0:f.view.meta))return;const h="number"==typeof f.view.meta.totalPages?f.view.meta.totalPages:1;if(h!==r)return;const m=async o=>{const r=Object.assign(Object.assign({},t),{page:o});try{const i=await d(e,r),a=this.views.get(n);if(!a)return;const s=a.get(Js(t));if(!s)return;if(null!=c&&s.view.loadId!==c)return;if(s.view.loadId!==c)return;for(const e of i.items)l.upsertEntity(e);const u=Js(r);let f=a.get(u);if(!f){f={params:r,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:s.view.loadId}},a.set(u,f),this.cleanupOldViews(a)}if(!f.view.value||this.isExpired(f.view.updatedAt)){f.view.value=i.items.map(e=>e.id);const{items:e}=i,t=kn(i,["items"]);f.view.meta=Object.assign(Object.assign({},t),{page:o,totalPages:h}),f.view.updatedAt=this.now()}}catch(e){console.debug("Preload failed silently:",e)}};if(i>0&&o<h)for(let e=1;e<=Math.min(i,h-o);e++){const r=o+e,n=Js(Object.assign(Object.assign({},t),{page:r})),i=s.get(n);(null==i?void 0:i.view.value)&&!this.isExpired(i.view.updatedAt)||m(r)}if(a>0&&o>1)for(let e=1;e<=Math.min(a,o-1);e++){const r=o-e,n=Js(Object.assign(Object.assign({},t),{page:r})),i=s.get(n);(null==i?void 0:i.view.value)&&!this.isExpired(i.view.updatedAt)||m(r)}}catch(e){console.debug("Preload process failed:",e)}}removeEmptyPageIfNeeded(e,t,o,r,n){if(t.view.value&&0===t.view.value.length&&o<r){const t=Js(Object.assign(Object.assign({},n),{page:o}));e.delete(t)}}updateTotalPagesForAllViews(e,t){for(const[,o]of e)o.view.meta&&(o.view.meta.totalPages=t)}isParamsSame(e,t){const o=Object.keys(null!=e?e:{}).filter(e=>"page"!==e).sort(),r=Object.keys(null!=t?t:{}).filter(e=>"page"!==e).sort();if(o.length!==r.length)return!1;for(let n=0;n<o.length;n++){const i=o[n];if(i!==r[n])return!1;if(e[i]!==t[i])return!1}return!0}syncTotalsInSameViews(e,t){var o,r,n;const i=t.view.meta;if(!i||"number"!=typeof i.total)return;const a=Number(i.total),l=Hs(null===(o=t.params)||void 0===o?void 0:o.pageSize),s=Number.isFinite(l)&&l>0?Math.max(1,Math.ceil(a/l)):void 0;for(const[,o]of e)this.isParamsSame(null!==(r=o.params)&&void 0!==r?r:{},null!==(n=t.params)&&void 0!==n?n:{})&&(o.view.meta||(o.view.meta={}),o.view.meta.total=a,void 0!==s&&(o.view.meta.totalPages=s))}cascadeShiftPages(e,t,o,r,n,i,a){var l,s,d;let c=t,u=o,f=!1;let h=0;for(;c.view.value&&c.view.value.length<r&&u<n&&h<100;){h++;const t=Js(Object.assign(Object.assign({},a),{page:u+1})),o=e.get(t);if(!(null==o?void 0:o.view.value)||this.isExpired(o.view.updatedAt)){c.view.meta=Object.assign(Object.assign({},null!==(l=c.view.meta)&&void 0!==l?l:{}),{stale:!0});break}const n=r-c.view.value.length,d=o.view.value.slice(0,n).filter(e=>i.getEntity(e));if(0===d.length){c.view.meta=Object.assign(Object.assign({},null!==(s=c.view.meta)&&void 0!==s?s:{}),{stale:!0});break}if(c.view.value=[...c.view.value,...d],c.view.updatedAt=Date.now(),o.view.value=o.view.value.slice(d.length),o.view.updatedAt=Date.now(),0===o.view.value.length){const t=u+1,r=o.view.meta;if(t<(r&&"number"==typeof r.totalPages?r.totalPages:1)){const o=Js(Object.assign(Object.assign({},a),{page:t}));e.delete(o),f=!0}break}c=o,u++}return(!c.view.value||c.view.value.length<r)&&u>=n&&(c.view.meta=Object.assign(Object.assign({},null!==(d=c.view.meta)&&void 0!==d?d:{}),{stale:!0})),f}cascadeShiftToNextPage(e,t,o,r,n,i,a){var l,s,d;if(!t.view.value||t.view.value.length<=r)return!1;if(o-(a.page||1)>=10)return t.view.meta=Object.assign(Object.assign({},null!==(l=t.view.meta)&&void 0!==l?l:{}),{stale:!0}),!1;const c=Object.assign(Object.assign({},a),{page:o+1}),u=Js(c);let f=e.get(u),h=!1;if(!(null==f?void 0:f.view.value)||this.isExpired(f.view.updatedAt)){if(!(o>=n))return t.view.meta=Object.assign(Object.assign({},null!==(s=t.view.meta)&&void 0!==s?s:{}),{stale:!0}),!1;{f={params:c,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},e.set(u,f),this.cleanupOldViews(e);const r=t.view.meta;r&&(f.view.meta=Object.assign(Object.assign({},r),{page:o+1})),h=!0}}const m=t.view.value.slice(r).filter(e=>i.getEntity(e));if(0===m.length)return h&&e.delete(u),!1;t.view.value=t.view.value.slice(0,r),t.view.updatedAt=Date.now(),f.view.value=[...m,...null!==(d=f.view.value)&&void 0!==d?d:[]],f.view.updatedAt=Date.now();const p=f.view.meta&&"number"==typeof f.view.meta.totalPages?f.view.meta.totalPages:n;if(!h){if(this.cascadeShiftToNextPage(e,f,o+1,r,p,i,a))return!0}if(!f.view.value||0===f.view.value.length){const t=o+1,r=f.view.meta,n=r&&"number"==typeof r.totalPages?r.totalPages:1;this.removeEmptyPageIfNeeded(e,f,t,n,a)}return h}canCompareInSortedView(e,t){var o;const r=null!==(o=e.params)&&void 0!==o?o:{};return!r.sortBy&&!r.sortOrder||(!this.strategy.hasSortValue||this.strategy.hasSortValue(t,e.params))}tryInsertSorted(e,t,o){var r,n;const i=this.strategy.comparator;if(!i)return!1;if(!e.view.value)return!1;const a=(null===(r=e.params)||void 0===r?void 0:r.itemType)||"all";if(!this.isEntityTypeCompatible(t,a))return!1;if(!this.canCompareInSortedView(e,t))return!1;const l=e.view.value.map(e=>o.getEntity(e));if(l.some(e=>!e))return!1;if(0===l.length){const o=null!==(n=e.params)&&void 0!==n?n:{};if(o.sortBy||o.sortOrder){const o=i(t,t,e.params);if("number"!=typeof o||Number.isNaN(o))return!1}return e.view.value.includes(t.id)?(e.view.updatedAt=this.now(),!0):(e.view.value=[t.id],e.view.updatedAt=this.now(),!0)}let s=0,d=l.length;for(;s<d;){const o=Math.floor((s+d)/2),r=i(t,l[o],e.params);if("number"!=typeof r||Number.isNaN(r))return!1;r>=0?s=o+1:d=o}return e.view.value.includes(t.id)?(e.view.updatedAt=this.now(),!0):(e.view.value=[...e.view.value.slice(0,s),t.id,...e.view.value.slice(s)],e.view.updatedAt=this.now(),!0)}updateChildrenCountForOperation(e,t,o,r){var n,i,a,l;const s=$s(t);switch(e){case"delete":this.adjustChildrenCount(r,s,-1),null===(n=this.childrenCountInvalidator)||void 0===n||n.call(this,s);break;case"insert":case"copy":this.adjustChildrenCount(r,s,1),null===(i=this.childrenCountInvalidator)||void 0===i||i.call(this,s);break;case"move":this.adjustChildrenCount(r,null!=o?o:null,-1),this.adjustChildrenCount(r,s,1),null===(a=this.childrenCountInvalidator)||void 0===a||a.call(this,null!=o?o:null),null===(l=this.childrenCountInvalidator)||void 0===l||l.call(this,s)}}adjustChildrenCount(e,t,o){if(!t)return;const r=e.getFolder(t);if(r&&"number"==typeof r.childrenCount){const n=Math.max(0,r.childrenCount+o);e.updateServerChildrenCount(t,n)}}smartInvalidateChildrenViews(e,t,o,r,n,i){var a,l,s;if(!t)return;this.updateChildrenCountForOperation(o,t,n,r);const d=this.parentKey(e),c=this.views.get(d);if(c)for(const[,e]of c){const i=null!==(a=e.params)&&void 0!==a?a:{},d=null!==(l=null==i?void 0:i.page)&&void 0!==l?l:1,u=Hs(null==i?void 0:i.pageSize),f=Number.isFinite(u),h=!(!(null==i?void 0:i.sortBy)&&!(null==i?void 0:i.sortOrder)),m=!!(null==i?void 0:i.search),p=(null==i?void 0:i.itemType)||"all";if(!this.isEntityTypeCompatible(t,p))continue;if(m&&this.strategy.filterMatch&&!this.strategy.filterMatch(t,e.params)){(null===(s=e.view.value)||void 0===s?void 0:s.includes(t.id))&&(e.view.value=e.view.value.filter(e=>e!==t.id),e.view.meta&&"number"==typeof e.view.meta.total&&(e.view.meta.total=Math.max(0,e.view.meta.total-1)),this.markViewStaleForReload(e));continue}if(!e.view.value){e.view.meta&&(e.view.meta.stale=!0),e.view.loadId=Ks(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0);continue}e.view.value.includes(t.id);if(this.shouldInvalidateCompletely(e,o,t,h,f,d))this.markViewStaleForReload(e);else switch(o){case"delete":this.handleDelete(c,e,d,u,f,t,r);break;case"insert":case"copy":this.handleInsert(c,e,d,u,f,h,t,r);break;case"update":this.handleUpdate(c,e,d,u,f,h,m,t,r);break;case"move":this.handleMove(c,e,d,u,f,h,t,n,r)}}}shouldInvalidateCompletely(e,t,o,r,n,i){return!(!(n&&i>1)||"insert"!==t&&"delete"!==t&&"move"!==t)||!!this.isExpired(e.view.updatedAt)}tryReinsertEntity(e,t,o,r,n){var i,a;const l=(null===(i=e.params)||void 0===i?void 0:i.itemType)||"all";if(!this.isEntityTypeCompatible(t,l))return!1;const s=null!==(a=e.params)&&void 0!==a?a:{};if(!this.strategy.filterMatch(t,s))return!1;return!!this.tryInsertSorted(e,t,o)||!s.sortBy&&!s.sortOrder&&((!r||e.view.value.length<n)&&(e.view.value.push(t.id),!0))}handleDelete(e,t,o,r,n,i,a){var l;const s=t.view.value.includes(i.id);if(s&&(t.view.value=t.view.value.filter(e=>e!==i.id)),t.view.meta&&"number"==typeof t.view.meta.total){if(t.view.meta.total=Math.max(0,t.view.meta.total-1),n&&Number.isFinite(r)&&"number"==typeof t.view.meta.total){const e=r;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}if(t.view.updatedAt=Date.now(),s&&n&&t.view.value.length<r&&a){const n=t.view.meta,i=n&&"number"==typeof n.totalPages?n.totalPages:1;if(this.cascadeShiftPages(e,t,o,r,i,a,null!==(l=t.params)&&void 0!==l?l:{})&&t.view.meta&&"number"==typeof t.view.meta.totalPages){const o=Math.max(1,t.view.meta.totalPages-1);t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}t.view.loadId=Ks(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}handleInsert(e,t,o,r,n,i,a,l){var s,d,c;if(!t.view.value.includes(a.id)){if(i&&this.strategy.allowSortedInsert&&this.strategy.comparator&&l){if(this.tryInsertSorted(t,a,l)){if(t.view.meta&&"number"==typeof t.view.meta.total){if(t.view.meta.total+=1,n&&Number.isFinite(r)){const e=r;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}if(t.view.updatedAt=Date.now(),n&&(null!==(d=null===(s=t.view.value)||void 0===s?void 0:s.length)&&void 0!==d?d:0)>r&&l){const n=t.view.meta,i=n&&"number"==typeof n.totalPages?n.totalPages:1;if(this.cascadeShiftToNextPage(e,t,o,r,i,l,null!==(c=t.params)&&void 0!==c?c:{})&&t.view.meta&&"number"==typeof t.view.meta.totalPages){const o=t.view.meta.totalPages+1;t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}}else this.markViewStaleForReload(t)}else if(!n||t.view.value.length<r){if(t.view.value.push(a.id),t.view.meta&&"number"==typeof t.view.meta.total){if(t.view.meta.total+=1,n&&Number.isFinite(r)){const e=r;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}t.view.updatedAt=Date.now()}else this.markViewStaleForReload(t);t.view.loadId=Ks(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}}handleUpdate(e,t,o,r,n,i,a,l,s){var d,c;const u=t.view.value.includes(l.id),f=this.isEntityTypeCompatible(l,(null===(d=t.params)||void 0===d?void 0:d.itemType)||"all");if(u&&!f){if(t.view.value=t.view.value.filter(e=>e!==l.id),t.view.meta&&"number"==typeof t.view.meta.total&&(t.view.meta.total=Math.max(0,t.view.meta.total-1),n&&Number.isFinite(r)&&"number"==typeof t.view.meta.total)){const e=r;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}if(t.view.updatedAt=Date.now(),n&&t.view.value.length<r&&s){const n=t.view.meta,i=n&&"number"==typeof n.totalPages?n.totalPages:1;if(this.cascadeShiftPages(e,t,o,r,i,s,null!==(c=t.params)&&void 0!==c?c:{})&&t.view.meta&&"number"==typeof t.view.meta.totalPages){const o=Math.max(1,t.view.meta.totalPages-1);t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}return t.view.loadId=Ks(),void(t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0))}if(u&&(i||a)){t.view.value=t.view.value.filter(e=>e!==l.id);return void(this.tryReinsertEntity(t,l,s,n,r)?(t.view.updatedAt=Date.now(),t.view.loadId=Ks(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)):this.markViewStaleForReload(t))}if(u)return t.view.updatedAt=Date.now(),t.view.loadId=Ks(),void(t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0));if(f&&!a){if(i&&this.strategy.allowSortedInsert&&this.strategy.comparator&&s){if(this.tryInsertSorted(t,l,s)){if(t.view.meta&&"number"==typeof t.view.meta.total){if(t.view.meta.total+=1,n&&Number.isFinite(r)){const e=r;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}t.view.updatedAt=Date.now()}else this.markViewStaleForReload(t)}else if(!n||t.view.value.length<r){if(t.view.value.push(l.id),t.view.meta&&"number"==typeof t.view.meta.total){if(t.view.meta.total+=1,n&&Number.isFinite(r)){const e=r;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}t.view.updatedAt=Date.now()}else this.markViewStaleForReload(t);t.view.loadId=Ks(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}}handleMove(e,t,o,r,n,i,a,l,s){var d;if(t.view.value.includes(a.id)){if(t.view.value=t.view.value.filter(e=>e!==a.id),t.view.meta&&"number"==typeof t.view.meta.total&&(t.view.meta.total=Math.max(0,t.view.meta.total-1),n&&Number.isFinite(r)&&"number"==typeof t.view.meta.total)){const e=r;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}if(t.view.updatedAt=Date.now(),n&&t.view.value.length<r&&s){const n=t.view.meta,i=n&&"number"==typeof n.totalPages?n.totalPages:1;if(this.cascadeShiftPages(e,t,o,r,i,s,null!==(d=t.params)&&void 0!==d?d:{})&&t.view.meta&&"number"==typeof t.view.meta.totalPages){const o=Math.max(1,t.view.meta.totalPages-1);t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}this.syncTotalsInSameViews(e,t)}t.view.loadId=Ks(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}forceInvalidateChildrenViews(e){const t=this.parentKey(null!=e?e:null);this.failedRequests.clearChildrenViewErrorsForParent(t);const o=this.views.get(t);if(o)for(const[,e]of o)e.view.value=void 0,e.view.meta=void 0,e.view.promise=null,e.view.updatedAt=0,e.view.loadId=Ks(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}getKnownTotal(e){var t,o;const r=this.parentKey(null!=e?e:null),n=this.views.get(r);if(!n)return;let i=null;for(const[,e]of n){const r=e.view.meta;r&&"number"==typeof r.total&&(!i||(null!==(t=e.view.updatedAt)&&void 0!==t?t:0)>i.updatedAt)&&(i={total:Number(r.total),updatedAt:null!==(o=e.view.updatedAt)&&void 0!==o?o:0})}return i?i.total:void 0}toJSON(){return{views:Array.from(this.views.entries()).map(([e,t])=>[e,Array.from(t.entries())]),ttl:this.ttl,errorTtl:this.errorTtl,entityTtl:this.entityTtl,strategy:{allowSortedInsert:this.strategy.allowSortedInsert,allowSearchInsert:this.strategy.allowSearchInsert,invalidateOnPaginationFull:this.strategy.invalidateOnPaginationFull,preloadPagesBefore:this.strategy.preloadPagesBefore,preloadPagesAfter:this.strategy.preloadPagesAfter}}}static fromJSON(e,t){var o,r,n,i,a,l;const s=null!==(r=null!==(o=null==t?void 0:t.ttl)&&void 0!==o?o:null==e?void 0:e.ttl)&&void 0!==r?r:Vs,d=null!==(i=null!==(n=null==t?void 0:t.errorTtl)&&void 0!==n?n:null==e?void 0:e.errorTtl)&&void 0!==i?i:s,c=null!==(a=null==t?void 0:t.failedRequests)&&void 0!==a?a:new xs,u=new Zs({},s,d,void 0,c,null==t?void 0:t.isFolderNotFoundError);for(const[t,o]of null!==(l=e.views)&&void 0!==l?l:[]){const e=new Map;for(const[t,r]of o){const o=r;(null==o?void 0:o.view)&&"error"in o.view&&delete o.view.error,e.set(t,o)}u.views.set(t,e)}return u}}class Xs{invalidateChildrenCountCache(e){const t=Ws(null!=e?e:"");this.childrenCountPromises.delete(t),this.failedRequests.delete(xs.childrenCountKey(t))}constructor(e={},t=18e5,o,r){var n,i,a,l;this.childrenCountPromises=new Map,this.isFolderNotFoundError=null!==(n=null==r?void 0:r.isFolderNotFoundError)&&void 0!==n?n:Qs,this.failedRequests=new xs,this.ttl=null!==(i=null==r?void 0:r.ttl)&&void 0!==i?i:t,this.errorTtl=null!==(l=null!==(a=null==r?void 0:r.errorTtl)&&void 0!==a?a:o)&&void 0!==l?l:this.ttl,this.entities=new Ys,this.views=new Zs(e,this.ttl,this.errorTtl,void 0,this.failedRequests,this.isFolderNotFoundError),this.views.setServerChildrenCountHandler((e,t,o)=>{this.handleServerReportedChildrenCount(e,t,null!=o?o:this.entities)}),this.views.setChildrenCountInvalidator(e=>{this.invalidateChildrenCountCache(e)})}getEntity(e){var t;return null!==(t=this.entities.getEntity(e))&&void 0!==t?t:null}getFileSystemItem(e){var t;return null!==(t=this.entities.getFileSystemItem(e))&&void 0!==t?t:null}getFolder(e){var t;return null!==(t=this.entities.getFolder(e))&&void 0!==t?t:null}async getOrCreateChildren(e,t,o){return this.views.getOrCreateChildren(e,t,o,this.entities)}upsertEntity(e){const t=this.entities.getEntity(e.id),o=t?$s(t):null,r=$s(e),n=!!t&&Gs(t),i=Gs(e);if(this.entities.upsertEntity(e),t){if(o!==r||n!==i)return this.views.smartInvalidateChildrenViews(o,t,"delete",this.entities),void this.views.smartInvalidateChildrenViews(r,e,"insert",this.entities);this.views.smartInvalidateChildrenViews(r,e,"update",this.entities,void 0,t)}else this.views.smartInvalidateChildrenViews(r,e,"insert",this.entities)}isAncestor(e,t){let o=t;const r=new Set;for(;o&&!r.has(o);){r.add(o);if(Ws(o)===Ws(e))return!0;const t=this.entities.getEntity(o);if(!t)break;o=$s(t),null===o&&(o="")}return!1}moveEntity(e,t){const o=this.entities.getEntity(e);if(!o)return null;if(Gs(o)&&null!==t&&this.isAncestor(e,t))return null;const r=$s(o),n=this.entities.moveEntityById(e,t);return n?(this.views.smartInvalidateChildrenViews(r,o,"delete",this.entities),this.views.smartInvalidateChildrenViews(t,n,"insert",this.entities),n):null}copyEntity(e,t,o,r){var n,i,a,l,s;const d=this.entities.getEntity(e);if(!d)return null;let c=null;if(Gs(d)){const o=[e],n=[];for(;o.length;){const e=o.shift();n.push(e);const t=this.entities.getChildrenIds(e,{onlyFolders:!0});for(const e of t)o.push(e)}const i=new Map;for(const e of n)i.set(e,Ks());for(const o of n){const n=this.entities.getFolder(o),s=i.get(o),d=$s(n),c=null===d?t:null!==(a=i.get(d))&&void 0!==a?a:null,u=Object.assign(Object.assign(Object.assign({},n),o===e?r:void 0),{id:s,folderId:null!==(l=o===e?null==r?void 0:r.folderId:void 0)&&void 0!==l?l:c});this.entities.upsertEntity(u)}for(const e of n){const t=i.get(e),o=this.entities.getChildrenIds(e,{onlyFileSystemItems:!0});for(const e of o){const o=this.entities.getFileSystemItem(e);if(!o)continue;const r=Ks(),n=Object.assign(Object.assign({},o),{id:r,folderId:t});this.entities.upsertEntity(n)}}c=null!==(s=this.entities.getEntity(i.get(e)))&&void 0!==s?s:null}else{const a=null!=o?o:Ks();if(c=this.entities.copyFileSystemItem(e,a,null!=t?t:null),c&&r){const e=Object.assign(Object.assign(Object.assign({},c),r),{id:a,folderId:null!==(i=null!==(n=r.folderId)&&void 0!==n?n:t)&&void 0!==i?i:null});this.entities.upsertEntity(e),c=e}}return c&&this.views.smartInvalidateChildrenViews(t,c,"copy",this.entities),c}searchByUrl(e){var t;return null!==(t=this.entities.searchByUrl(e))&&void 0!==t?t:null}deleteEntity(e){const t=this.entities.getEntity(e);if(!t)return null;if(Gs(t)){const{deletedFolderRecords:o,deletedFileSystemItemRecords:r}=this.entities.deleteFolderRecursive(e);for(const e of r)this.views.smartInvalidateChildrenViews(e.folderId,e,"delete",this.entities);for(const e of o)this.views.smartInvalidateChildrenViews(e.folderId,e,"delete",this.entities);for(const e of o)this.views.forceInvalidateChildrenViews(e.id);return t}{const{entity:t,parentId:o}=this.entities.deleteEntityById(e);return t&&this.views.smartInvalidateChildrenViews(o,t,"delete",this.entities),t}}deleteFolderRecursive(e){const{deletedFolderRecords:t,deletedFileSystemItemRecords:o}=this.entities.deleteFolderRecursive(e);for(const e of o)this.views.smartInvalidateChildrenViews(e.folderId,e,"delete",this.entities);for(const e of t)this.views.smartInvalidateChildrenViews(e.folderId,e,"delete",this.entities);for(const e of t)this.views.forceInvalidateChildrenViews(e.id);return{deletedFileSystemItemIds:o.map(e=>e.id),deletedFolderIds:t.map(e=>e.id)}}forceInvalidate(e){var t;const o=this.entities.getEntity(e);if(!o)return this.views.forceInvalidateChildrenViews(null!=e?e:null),void this.invalidateChildrenCountCache(e);const r=new Set;if(Gs(o)){const t=[e];for(;t.length;){const e=t.pop();if(r.has(e))continue;r.add(e),this.views.forceInvalidateChildrenViews(e),this.invalidateChildrenCountCache(e);const o=this.entities.getChildrenIds(e,{onlyFolders:!0});for(const e of o)t.push(e)}}else{const e=null!==(t=o.folderId)&&void 0!==t?t:null;this.views.forceInvalidateChildrenViews(e),this.invalidateChildrenCountCache(e)}}invalidateListingViews(e){this.views.forceInvalidateChildrenViews(null!=e?e:null)}getChildrenIds(e){return this.entities.getChildrenIds(e)}searchByName(e,t){return this.entities.searchByName(e,t)}async getChildrenCount(e="",t){const o=Ws(e),r=xs.childrenCountKey(o),n=this.failedRequests.getFreshError(r,this.errorTtl);if(null!=n)return Promise.reject(n);const i=this.childrenCountPromises.get(o);if(i)return i;const a=(async()=>{try{const o=this.entities.getFolder(e);if(o&&"number"==typeof o.childrenCount)return this.failedRequests.delete(r),o.childrenCount;const n=this.views.getKnownTotal(e);if("number"==typeof n)return o&&this.handleServerReportedChildrenCount(e,n,this.entities),this.failedRequests.delete(r),n;if(t){const o=await t(e);return this.entities.getFolder(e)&&this.handleServerReportedChildrenCount(e,o,this.entities),this.failedRequests.delete(r),o}return this.failedRequests.delete(r),this.entities.getChildrenIds(e).length}catch(e){if(this.childrenCountPromises.delete(o),this.isFolderNotFoundError(e))return this.failedRequests.delete(r),0;throw this.failedRequests.setError(r,e),e}finally{this.childrenCountPromises.delete(o)}})();return this.childrenCountPromises.set(o,a),a}toJSON(){return{entities:this.entities.toJSON(),views:this.views.toJSON(),ttl:this.ttl,errorTtl:this.errorTtl}}static fromJSON(e,t,o){var r,n,i,a,l,s,d,c,u,f,h;const m=null!==(n=null!==(r=null==o?void 0:o.ttl)&&void 0!==r?r:null==e?void 0:e.ttl)&&void 0!==n?n:Vs,p=null!==(a=null!==(i=null==o?void 0:o.errorTtl)&&void 0!==i?i:null==e?void 0:e.errorTtl)&&void 0!==a?a:m,g=new Xs(null!=t?t:{},m,p,o),v=Ys.fromJSON(null!==(l=null==e?void 0:e.entities)&&void 0!==l?l:{}),y=Zs.fromJSON(null!==(s=null==e?void 0:e.views)&&void 0!==s?s:{},{failedRequests:g.failedRequests,ttl:m,errorTtl:p,isFolderNotFoundError:null==o?void 0:o.isFolderNotFoundError});if(t){const e=js(t);y.strategy={allowSortedInsert:null===(d=e.allowSortedInsert)||void 0===d||d,allowSearchInsert:null===(c=e.allowSearchInsert)||void 0===c||c,invalidateOnPaginationFull:null===(u=e.invalidateOnPaginationFull)||void 0===u||u,preloadPagesBefore:null!==(f=e.preloadPagesBefore)&&void 0!==f?f:0,preloadPagesAfter:null!==(h=e.preloadPagesAfter)&&void 0!==h?h:1,comparator:e.comparator,filterMatch:e.filterMatch}}return g.entities=v,g.views=y,y.setServerChildrenCountHandler((e,t,o)=>{g.handleServerReportedChildrenCount(e,t,null!=o?o:v)}),y.setChildrenCountInvalidator(e=>{g.invalidateChildrenCountCache(e)}),g}handleServerReportedChildrenCount(e,t,o){this.checkAndResolveChildrenCountConflict(e,t,o),this.invalidateChildrenCountCache(e)}checkAndResolveChildrenCountConflict(e,t,o){if(!o||void 0===t)return;const r=null!=e?e:null;if(!r)return void o.updateServerChildrenCount(r,t);const n=o.getFolder(r),i=null==n?void 0:n.childrenCount;void 0!==i&&i!==t&&(console.warn(`Conflict: folder "${r}" has childrenCount=${i} but server says total=${t}`),this.views.forceInvalidateChildrenViews(r)),o.updateServerChildrenCount(r,t)}}function ed(e,t){const o=null!=e?e:{},r=Array.isArray(o.detailed)?o.detailed.map(e=>{var o;return{requestId:null!==(o=e.requestId)&&void 0!==o?o:e.id,success:!!e.success,data:t(e.data),error:e.error}}):void 0;return{success:!!o.success,error:o.error,detailed:r}}function td(e){return null==e?"":String(e)}function od(e){return Object.assign(Object.assign({},e),{name:td(e.name)})}function rd(e){return e&&"object"==typeof e&&"name"in e?Object.assign(Object.assign({},e),{name:td(e.name)}):e}class nd{_getTrashPath(){return this._pathOptions.trashPath||"Trash"}_getPathLookupCandidates(e){return zs(e,this._getTrashPath(),Ds)}_folderFromResolvedPath(e,t){var o;if(!0!==e.isFolder){const o=!1===e.isFolder?"Path '%s' resolves to a file, not a folder".replace("%s",t):"Path '%s' resolved to an item that is not marked as a folder".replace("%s",t);throw new Yn(o,"ValidationError")}if(!e.id){const e="Path '%s' resolved to a folder without id".replace("%s",t);throw new Yn(e,"ValidationError")}const r={id:e.id,name:e.name||e.id,parentId:e.folderId};return this._cache.upsertEntity(od({id:r.id,name:r.name,folderId:null!==(o=r.parentId)&&void 0!==o?o:null,isFolder:!0})),r}async _resolveFolderByPath(e){if("function"==typeof this._dataProvider.findItemByPath)for(const t of this._getPathLookupCandidates(e)){const e=await this._dataProvider.findItemByPath(t);if(e)return this._folderFromResolvedPath(e,t)}}async _findOrCreateFolderByPath(e){const t=(o=e)?o.replaceAll("\\","/").split("/").filter(Boolean):[];var o;if(t.length>10){const e="Path depth exceeds maximum limit of %s".replace("%s",String(10));throw new Yn(e,"ValidationError")}const r=await this._resolveFolderByPath(e);if(r)return r;let n;for(const o of t){const{files:t}=await this.getFiles({folderId:(null==n?void 0:n.id)||"",itemType:"folder"}),r=t.find(e=>e.name===o);if(r){if(!r.isFolder){const t="Path component '%s' in '%s' is not a folder".replace("%s",o).replace("%s",e);throw new Yn(t,"ValidationError")}n={id:r.id,name:r.name,parentId:r.folderId}}else{if("function"!=typeof this._dataProvider.createFolder)throw new Yn("Create folder operation is not supported by data provider","UnsupportedOperation");n=await this.createFolder({name:o,parentId:null==n?void 0:n.id})}}return n}async getTrashFolder(){const e=await this._findOrCreateFolderByPath(this._getTrashPath());if(!e){const e="Trash folder path '%s' could not be resolved".replace("%s",this._getTrashPath());throw new Yn(e,"FolderNotFound")}return e}async getTempFolder(){var e;const t=null!==(e=this._pathOptions.tempPath)&&void 0!==e?e:"Edited";if(t)try{return await this._findOrCreateFolderByPath(t)}catch(e){if(e instanceof Yn&&"ValidationError"===e.code)throw e;return void console.warn("getTempFolder: temp folder unavailable, falling back to root",e)}}constructor(e,t={},o,r={}){var n,i;this._dataProvider=e,this._options=t,this._pathOptions=o,this._blobFetchForceReloadOnceIds=new Set,this._mutationRegistry=new Ps,this._mapItem=async e=>{var{childrenCount:t}=e;const o=od(kn(e,["childrenCount"]));if(o.isFolder)return Object.assign(Object.assign({},o),{childCount:t,url:"",thumbnailUrl:""});const[r,n]=await Promise.all([this._getUrl(o),this._getThumbnailUrl(o)]);return Object.assign(Object.assign({},o),{childCount:0,url:r,thumbnailUrl:n})},this._config=r,this._useSoftDelete=this._pathOptions.useSoftDelete,this._rootId=this._pathOptions.rootId||"",this._enableTrash=void 0===this._options.enableTrash||this._options.enableTrash,this._validateDuplicates=this._dataProvider.validateDuplicates,this._cache=new Xs(t.cacheStrategy||{},null===(n=t.cacheStrategy)||void 0===n?void 0:n.ttl,null===(i=t.cacheStrategy)||void 0===i?void 0:i.errorTtl),this.setController({invalidateItemCache:e=>{this._cache.forceInvalidate(e)},getCachedItem:e=>this._cache.getEntity(e)});const a=Object.getPrototypeOf(this);for(const e of Object.getOwnPropertyNames(a)){const t=Object.getOwnPropertyDescriptor(a,e);"constructor"!==e&&"function"==typeof(null==t?void 0:t.value)&&(this[e]=t.value.bind(this))}}setController(e){"function"==typeof this._dataProvider.setController&&this._dataProvider.setController(e)}async clearCache(e){const t=null!=e?e:this._rootId;this._cache.forceInvalidate(t),this._cache.invalidateListingViews(t),"function"==typeof this._dataProvider.clearCache&&await this._dataProvider.clearCache(e)}markNextFileBlobFetchBypassHttpCache(e){this._blobFetchForceReloadOnceIds.add(this.normalizeId(e))}normalizeId(e){return e?"root"===e||"folders"===e?this._rootId:e:this._rootId}_isDeletingId(e){return this._mutationRegistry.isDeleting(this.normalizeId(e))}_collectDeletingIds(e){const t=this.normalizeId(e),o=new Set([t]),r=this._cache.getEntity(t);if(!(null==r?void 0:r.isFolder))return Array.from(o);const n=[t];for(;n.length>0;){const e=n.pop(),t=this._cache.getChildrenIds(e);for(const e of t){if(o.has(e))continue;o.add(e);const t=this._cache.getEntity(e);(null==t?void 0:t.isFolder)&&n.push(e)}}return Array.from(o)}_emptyFilesResult(e,t){return{files:[],pagination:Object.assign(Object.assign(Object.assign({},"number"==typeof e?{page:e}:{}),"number"==typeof t?{limit:t}:{}),{total:0,totalPages:1,hasNext:!1,hasPrev:!1})}}_validateName(e,t=!1){if(!e||0===e.trim().length){throw new Yn(t?"Folder name cannot be empty":"File name cannot be empty",t?"FolderInvalidName":"FileInvalidName")}if(/[\/\\:*?"<>|]/.test(e)){const o=t?"FolderInvalidName":"FileInvalidName",r=t?"Folder name contains invalid characters: %s".replace("%s",e):"File name contains invalid characters: %s".replace("%s",e);throw new Yn(r,o)}}_validateTargetFolderType(e){const t=this.normalizeId(e);if(t===this._rootId)return;const o=this._cache.getEntity(t);if(o&&!o.isFolder){const t="Target item with id '%s' is not a folder".replace("%s",e);throw new Yn(t,"ValidationError")}}_checkNameExistsInCache(e,t,o,r){const n=this.normalizeId(e),i=this._cache.getChildrenIds(n);for(const e of i){const n=this._cache.getEntity(e);if(n&&n.name===t&&!!n.isFolder===o&&(!r||n.id!==r))return!0}return!1}async _getUrl(e){var t;if(e){if(e.url)return e.url;try{return"function"==typeof(null===(t=this._dataProvider)||void 0===t?void 0:t.getUrl)&&this._dataProvider.getUrl(e)||void 0}catch(e){console.log(e)}}}async _getThumbnailUrl(e){var t;if(e){if(e.thumbnailUrl)return e.thumbnailUrl;try{return"function"==typeof(null===(t=this._dataProvider)||void 0===t?void 0:t.getThumbnailUrl)&&this._dataProvider.getThumbnailUrl(e)||void 0}catch(e){console.log(e)}}}_isAncestor(e,t){if(!t)return!1;const o=this.normalizeId(t),r=this.normalizeId(e);if(o===r)return!0;let n=this._cache.getEntity(o);const i=new Set;for(;n&&n.folderId&&!i.has(n.id);){i.add(n.id);const e=this.normalizeId(n.folderId);if(e===r)return!0;if(n=this._cache.getEntity(e),!n||!n.isFolder)break}return!1}async getFile(e,t){return this._isDeletingId(e)?null:this._cache.searchByName(t,{parentId:this.normalizeId(e),caseSensitive:!0,recursive:!1,itemType:"file"})[0]||(await this.getFiles({folderId:e,itemType:"file",search:t})).files[0]}async getFileById(e){const t=this.normalizeId(e);if(this._isDeletingId(t))return null;const o=this._cache.getFileSystemItem(t);if(o&&!o.isFolder)return await this._mapItem(o);if(!this._dataProvider.pathMode)return null;const r=await this._getFileByPathStyleId(t);if(r&&!r.isFolder){const e=od(r);return this._cache.upsertEntity(e),await this._mapItem(e)}return null}async _getFileByPathStyleId(e){const t=e.replace(/\\/g,"/").replace(/^\/+/,""),o=t.lastIndexOf("/"),r=o<0?"":t.slice(0,o),n=o<0?t:t.slice(o+1);return n?this.getFile(r,n):null}async getFileUrl(e,t){const o=await this.getFile(null!=e?e:"",t);if(o)return await this._getUrl(o)||await this._getThumbnailUrl(o)||o.thumbnail}async getFiles({folderId:e,search:t,sortBy:o,sortOrder:r,page:n,limit:i,itemType:a="all",noFolder:l=!1}){var s,d;l&&(e=null===(s=await this.getTempFolder())||void 0===s?void 0:s.id);const c=this.normalizeId(null!=e?e:this._rootId),u=!1===this._options.enablePagination,f=u?1:n,h=u?1e4:i,m=this._options.clientSideFilter,p=this._options.clientSideSorting,g=this._options.clientSidePaging,v=g?Math.max(1,null!=n?n:1):void 0,y=g?"number"==typeof i&&Number.isFinite(i)&&i>0?i:25:void 0,w=this._emptyFilesResult(g?v:f,g?y:h);if(this._isDeletingId(c))return w;const b=!1!==this._options.unifiedCatalogFetch&&u&&("folder"===a||"file"===a),C=b?"all":a,I={};m||(I.search=t),p||(I.sortBy=null!=o?o:"folder"!==C?"date":void 0,I.sortOrder=null!=r?r:"folder"!==C?"desc":void 0),g||(I.page=f,I.limit=b?1e4:h);const F=b?1e4:g?void 0:h,A={folderId:c,itemType:C,search:m?void 0:t,sortBy:p?void 0:I.sortBy,sortOrder:p?void 0:I.sortOrder,page:g?void 0:f,pageSize:F};let _;try{_=await this._cache.getOrCreateChildren(c,A,async(e,t)=>{var o;const r=t.pageSize,n=null!=r&&Number.isFinite(Number(r))?Number(r):1e4,i=await this._dataProvider.getItems(Object.assign(Object.assign({},t),{folderId:e,limit:n})),a=function(e){return(null!=e?e:[]).map(od)}(i.items);return g?{items:a,total:"number"==typeof(null===(o=i.pagination)||void 0===o?void 0:o.total)?i.pagination.total:a.length}:Object.assign({items:a},i.pagination)})}catch(e){if(this._isDeletingId(c))return w;throw e}let S,E=_.items;if(b&&("folder"===a?E=E.filter(e=>e.isFolder):"file"===a&&(E=E.filter(e=>!e.isFolder))),m)if("function"==typeof this._options.clientSideFilter)E=this._options.clientSideFilter(E,t);else if(t){const e=t.toLowerCase();E=E.filter(t=>{var o;return null===(o=t.name)||void 0===o?void 0:o.toLowerCase().includes(e)})}p&&(E="function"==typeof this._options.clientSideSorting?this._options.clientSideSorting(E,o,r):this._defaultClientSideSort(E,o,r)),S=g||m||b?E.length:null!==(d=_.total)&&void 0!==d?d:E.length;let x=E;if(g)if("function"==typeof this._options.clientSidePaging)x=this._options.clientSidePaging(E,v,y);else{const e=(v-1)*y,t=e+y;x=E.slice(e,t)}if("function"==typeof this._dataProvider.getUrl||"function"==typeof this._dataProvider.getThumbnailUrl){const e=x.map(async e=>{if(e.isFolder)return e;const[t,o]=await Promise.all([e.url?Promise.resolve(e.url):"function"==typeof this._dataProvider.getUrl?this._dataProvider.getUrl(e):Promise.resolve(void 0),e.thumbnailUrl?Promise.resolve(e.thumbnailUrl):"function"==typeof this._dataProvider.getThumbnailUrl?this._dataProvider.getThumbnailUrl(e):Promise.resolve(void 0)]);return Object.assign(Object.assign({},e),{url:t,thumbnailUrl:o})});x=await Promise.all(e)}const P=g?{page:v,limit:y,total:S,totalPages:Math.max(1,Math.ceil(S/y)),hasNext:v*y<S,hasPrev:v>1}:Object.assign(Object.assign({page:f,limit:h,total:S},!g&&_.totalPages&&{totalPages:_.totalPages}),!g&&_.hasNextPage&&{hasNextPage:_.hasNextPage});return{files:await Promise.all(x.map(this._mapItem)),pagination:P}}_defaultClientSideSort(e,t,o){return e.sort((e,r)=>ks(e,r,{sortBy:t,sortOrder:o}))}async getFileData(e,t){var o;const r=this.normalizeId("string"==typeof e?e:e.id);let n=t;this._blobFetchForceReloadOnceIds.delete(r)&&(n=Object.assign(Object.assign({},t),{forceReload:!0}));const i=this._cache.getEntity(r)||("string"==typeof e?{id:r,name:"",folderId:this._rootId,isFolder:!1}:Object.assign(Object.assign({},e),{childrenCount:e.childCount}));if("function"==typeof this._dataProvider.getFileData)return await this._dataProvider.getFileData(i,n);if(!i.url&&"function"!=typeof this._dataProvider.getUrl)throw new Yn("Cannot read file","FileReadError");const a=i.url||("function"==typeof this._dataProvider.getUrl?await this._dataProvider.getUrl(i):"");if(a){const e=null!==(o=this._config.fetchWithProxy)&&void 0!==o?o:fetch;return(await e(a,(null==n?void 0:n.forceReload)?{cache:"no-store"}:void 0)).blob()}throw new Yn("Unable to get file data","FileReadError")}async findFileByUrl(e){const t=this._cache.searchByUrl(e);if(t)return t;if("function"==typeof this._dataProvider.findFileByUrl)try{const t=await this._dataProvider.findFileByUrl(e);if(t){const e=od(t);return this._cache.upsertEntity(e),e}}catch(e){console.log(e)}return null}async getChildrenCount(e){if(!e)return 0;const t=this.normalizeId(null!=e?e:this._rootId);return this._isDeletingId(t)?0:this._cache.getChildrenCount(t,async()=>{var e;try{if(this._options.clientSidePaging){const o=await this.getFiles({folderId:t,itemType:"all",page:1,limit:25});return null!==(e=o.pagination.total)&&void 0!==e?e:o.files.length}const o=await this._dataProvider.getItems({folderId:t,limit:0,itemType:"all"});return void 0!==o.pagination?o.pagination.total||0:!1===this._options.enablePagination?o.items.length:0}catch(e){if(this._isDeletingId(t))return 0;if(this._isPathFolderNotFoundError(e))return 0;throw e}})}_isPathFolderNotFoundError(e){var t,o,r;if(!e||"object"!=typeof e)return!1;const n=e;return"path_folder_not_found"===n.code||"path_folder_not_found"===(null===(t=n.data)||void 0===t?void 0:t.code)||404===n.status||404===(null===(r=null===(o=n.data)||void 0===o?void 0:o.data)||void 0===r?void 0:r.status)}async _uploadFile(e){var t,o;const r=this.normalizeId(null!==(t=e.folderId)&&void 0!==t?t:this._rootId);if("function"!=typeof this._dataProvider.uploadFile)throw new Yn("Upload file operation is not supported by data provider","UnsupportedOperation");if(this._validateName(e.name,!1),this._validateDuplicates){if(this._checkNameExistsInCache(r,e.name,!1)){const t="File '%s' already exists in target folder".replace("%s",e.name);throw new Yn(t,"FileAlreadyExists")}}const n=await this._dataProvider.uploadFile(Object.assign(Object.assign({},e),{folderId:r})),i=od(Object.assign(Object.assign({name:e.name,size:e.size},n),{folderId:null!==(o=n.folderId)&&void 0!==o?o:r}));return this._cache.upsertEntity(i),i}async uploadFiles(e){var t,o,r,n,i,a,l;const s=e.items.some(e=>e.noFolder)?await this.getTempFolder():null;e=Object.assign(Object.assign({},e),{items:null===(t=e.items)||void 0===t?void 0:t.map(e=>Object.assign(Object.assign({},e),{folderId:e.noFolder?null==s?void 0:s.id:e.folderId}))});for(const t of e.items)t.folderId&&(e.folderId=t.folderId);const d=e.items||[],c=null!==(o=e.folderId)&&void 0!==o?o:this._rootId,u=this.normalizeId(c);if(this._validateDuplicates)for(const e of d)if(e.name){this._validateName(e.name,!1);const t=this.normalizeId(null!==(r=e.folderId)&&void 0!==r?r:u);if(this._checkNameExistsInCache(t,e.name,!1)){const t="File '%s' already exists in target folder".replace("%s",e.name);throw new Yn(t,"FileAlreadyExists")}}let f={detailed:new Array(d.length),success:!0};if("function"==typeof this._dataProvider.uploadFiles){const e=d.map(e=>{var t;return Object.assign(Object.assign({},e),{folderId:this.normalizeId(null!==(t=e.folderId)&&void 0!==t?t:u)})}),t=await this._dataProvider.uploadFiles({folderId:u,items:e});f=ed(t,e=>{if(e)return{id:e.id,name:td(e.name),folderId:e.folderId,url:e.url,thumbnailUrl:e.thumbnailUrl,thumbnail:e.thumbnail}});const o=null==t?void 0:t.detailed;if(f.detailed&&f.detailed.length){for(let e=0;e<f.detailed.length;e++){const t=f.detailed[e];if(t&&t.success){const r=t.data,s=null!==(n=null==r?void 0:r.id)&&void 0!==n?n:t.requestId,d=null===(i=null==o?void 0:o[e])||void 0===i?void 0:i.data,c=od(Object.assign(Object.assign(Object.assign({},d),r),{id:s,folderId:null!==(l=null!==(a=null==r?void 0:r.folderId)&&void 0!==a?a:null==d?void 0:d.folderId)&&void 0!==l?l:u,isFolder:!1}));this._cache.upsertEntity(c),t.requestId=s}}void 0===f.success&&(f.success=!f.detailed.some(e=>!e.success))}else f.success=!f.error&&!!f.success}else{if("function"!=typeof this._dataProvider.uploadFile)throw new Yn("Upload files is not supported by data provider","UnsupportedOperation");f.detailed=await Promise.all(d.map(async e=>{var t;const o=this.normalizeId(null!==(t=e.folderId)&&void 0!==t?t:u);try{const t=await this._uploadFile(Object.assign(Object.assign({},e),{folderId:o}));return{requestId:t.id,data:t,success:!0}}catch(t){return{requestId:null==e?void 0:e.id,success:!1,error:t}}})),f.success=!f.detailed.some(e=>!e.success)}if(f.success&&this._enableTrash)try{this._cache.forceInvalidate(u)}catch(e){}return f}async deleteFile(e){const t=this.normalizeId(e),o=[t];this._mutationRegistry.beginDeleting(o);try{if(this._useSoftDelete&&this._enableTrash){const e=await this.getTrashFolder();return await this.moveItem({itemId:t,targetFolderId:e.id,isFolder:!1})}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(o)}}async deleteItems(e,t){const o=Array.from(new Set(e.flatMap(e=>this._collectDeletingIds(this.normalizeId(e)))));this._mutationRegistry.beginDeleting(o);try{if(this._useSoftDelete&&this._enableTrash&&!0!==t.permanent){const t=await this.getTrashFolder();return await this.moveItems(t.id,e)}return await this.hardDeleteItems(e,t)}finally{this._mutationRegistry.endDeleting(o)}}async hardDeleteItems(e,t){let o={success:!0,detailed:[]};const r=t.permanent?null:await this.getTrashFolder();if("function"==typeof this._dataProvider.deleteItems){if(o=ed(await this._dataProvider.deleteItems(e.map(e=>this._cache.getEntity(e)),t),e=>e),o.success){const t=o.detailed||e.map(e=>({requestId:e,success:!0,error:void 0}));for(const e of t)e.success&&(r?this._cache.moveEntity(e.requestId,r.id):this._cache.deleteEntity(e.requestId))}}else"function"==typeof this._dataProvider.deleteItem&&(o.detailed=await Promise.all(e.map(async e=>{const o=this._cache.getEntity(e);if(!o){const t="FileNotFound",o="Item with id '%s' not found".replace("%s",e);return{requestId:e,success:!1,error:new Yn(o,t)}}try{return await this._dataProvider.deleteItem(o,t),r?this._cache.moveEntity(e,r.id):this._cache.deleteEntity(e),{requestId:e,success:!0}}catch(t){return{requestId:e,error:t,success:!1}}})),o.success=!o.detailed.some(e=>!e.success));if(o.success&&r)try{this._cache.forceInvalidate(r.id)}catch(e){}return o}async hardDeleteItem(e){const t=this._cache.getEntity(e);if(!t){const t="Item with id '%s' not found in cache".replace("%s",e);throw new Yn(t,"FileNotFound")}if("function"!=typeof this._dataProvider.deleteItem)throw new Yn("Delete item operation is not supported by data provider","DeleteNotAllowed");if(await this._dataProvider.deleteItem(t,{permanent:!0}),this._cache.deleteEntity(e),this._enableTrash)try{const e=await this.getTrashFolder();e&&this._cache.forceInvalidate(e.id)}catch(e){}return!0}async cleanTrash(){if(!this._enableTrash)throw new Yn("Trash is not enabled","UnsupportedOperation");if("function"==typeof this._dataProvider.cleanTrash){const e=await this._dataProvider.cleanTrash();try{const e=await this.getTrashFolder();e&&this._cache.forceInvalidate(e.id)}catch(e){}return e}throw new Yn("Clean trash is not supported by data provider","UnsupportedOperation")}async createFolder({name:e,parentId:t,is_force_create:o}){const r=this.normalizeId(null!=t?t:this._rootId);if(this._validateName(e,!0),this._validateDuplicates){if(this._checkNameExistsInCache(r,e,!0)){const t="Folder '%s' already exists in parent folder".replace("%s",e);throw new Yn(t,"FolderAlreadyExists")}}const n=await this._dataProvider.createFolder(e,r,o),i=od({id:n.id,folderId:r,name:n.name,isFolder:!0,childrenCount:n.childrenCount});return this._cache.upsertEntity(i),Object.assign(Object.assign({},n),{name:i.name})}async deleteFolder(e){const t=this.normalizeId(e),o=this._collectDeletingIds(t);this._mutationRegistry.beginDeleting(o);try{if(this._useSoftDelete&&this._enableTrash)try{const e=await this.getTrashFolder();return!!await this.moveItem({itemId:t,targetFolderId:e.id,isFolder:!0})&&(this._cache.deleteFolderRecursive(t),!0)}catch(e){return console.error("Error moving folder to trash:",e),await this.hardDeleteItem(t)}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(o)}}async renameFolder(e,t){if("function"!=typeof this._dataProvider.renameItem)throw new Yn("Rename folder is not supported","RenameNotAllowed");const o=this.normalizeId(e),r=this._cache.getEntity(o);if(!r){const t="Folder with id '%s' not found in cache".replace("%s",e);throw new Yn(t,"FolderNotFound")}if(this._validateName(t,!0),this._validateDuplicates){const e=this.normalizeId(r.folderId);if(this._checkNameExistsInCache(e,t,!0,o)){const e="Folder '%s' already exists in parent folder".replace("%s",t);throw new Yn(e,"FolderAlreadyExists")}}const n=rd(await this._dataProvider.renameItem(r,t));return this._cache.upsertEntity(od(Object.assign(Object.assign({},this._cache.getEntity(n.id)),n))),this._cache.getEntity(n.id)}async renameFile(e,t){if("function"!=typeof this._dataProvider.renameItem)throw new Yn("Rename file is not supported","RenameNotAllowed");const o=this._cache.getEntity(e);if(!o){const t="File with id '%s' not found in cache".replace("%s",e);throw new Yn(t,"FileNotFound")}const r=this.normalizeId(e);if(this._validateName(t,!1),this._validateDuplicates){const e=this.normalizeId(o.folderId);if(this._checkNameExistsInCache(e,t,!1,r)){const e="File '%s' already exists in parent folder".replace("%s",t);throw new Yn(e,"FileAlreadyExists")}}const n=rd(await this._dataProvider.renameItem(o,t));return n&&this._cache.upsertEntity(od(Object.assign(Object.assign({},this._cache.getEntity(r)),n))),this._cache.getEntity(r)}async moveItem({itemId:e,targetFolderId:t,isFolder:o}){if("function"!=typeof this._dataProvider.moveItem)throw new Yn("Move item operation is not supported by data provider","MoveNotAllowed");const r=this.normalizeId(t);this._validateTargetFolderType(t);const n=this._cache.getEntity(e);if(!n){const t=rd(await this._dataProvider.moveItem({id:e,folderId:r,isFolder:o},r));if(t.id===e)this._cache.upsertEntity(od(Object.assign(Object.assign({},t),{folderId:r})));else{try{this._cache.deleteEntity(e)}catch(e){}this._cache.upsertEntity(od(Object.assign(Object.assign({},t),{folderId:r})))}return!0}if(n.isFolder){if(e===r)throw new Yn("Cannot move folder into itself","MoveIntoSelf");if(this._isAncestor(e,r))throw new Yn("Cannot move folder into its descendant","MoveIntoDescendant")}if(this._validateDuplicates){if(r!==this.normalizeId(n.folderId)&&n.name){if(this._checkNameExistsInCache(r,n.name,!!n.isFolder,e)){const e=n.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new Yn(`${n.isFolder?"Folder":"File"} '${n.name}' already exists in target folder`,e)}}}const i=rd(await this._dataProvider.moveItem(n,r));if(i.id===e){const t=this._cache.moveEntity(e,r);return this._cache.upsertEntity(od(Object.assign(Object.assign({},t),i))),!0}{const t=this._cache.deleteEntity(e);return this._cache.upsertEntity(od(Object.assign(Object.assign(Object.assign({},t),i),{folderId:r}))),!0}}async moveItems(e,t){const o=this.normalizeId(e);this._validateTargetFolderType(e);const r=t.map(e=>this._cache.getEntity(e));for(const e of r)if(e){if(e.isFolder){if(e.id===o){const t="Cannot move folder '%s' into itself".replace("%s",e.name);throw new Yn(t,"MoveIntoSelf")}if(this._isAncestor(e.id,o)){const t="Cannot move folder '%s' into its descendant".replace("%s",e.name);throw new Yn(t,"MoveIntoDescendant")}}if(this._validateDuplicates){const t=this.normalizeId(e.folderId);if(o!==t&&e.name){if(this._checkNameExistsInCache(o,e.name,!!e.isFolder,e.id)){const t=e.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new Yn(`${e.isFolder?"Folder":"File"} '${e.name}' already exists in target folder`,t)}}}}let n={detailed:new Array(r.length),success:!0};if("function"==typeof this._dataProvider.moveItems){n=ed(await this._dataProvider.moveItems(r,o),e=>e)}else{if("function"!=typeof this._dataProvider.moveItem)throw new Yn("Move items is not supported","MoveNotAllowed");n.detailed=await Promise.all(t.map(async(e,t)=>{const n=r[t]||{id:e,folderId:null,isFolder:!1,name:e};try{return{requestId:e,data:rd(await this._dataProvider.moveItem(n,o)),success:!0}}catch(t){return{requestId:e,success:!1,error:t}}}))}if(n.success){const e=n.detailed||t.map(e=>({requestId:e,success:!0,data:void 0}));for(const t of e)if(t.success)if(t.data&&t.data.id!==t.requestId){const e=this._cache.deleteEntity(t.requestId);this._cache.upsertEntity(od(Object.assign(Object.assign(Object.assign({},e),t.data),{folderId:o})))}else this._cache.moveEntity(t.requestId,o),t.data&&this._cache.upsertEntity(od(Object.assign(Object.assign(Object.assign({},this._cache.getEntity(t.requestId)),t.data),{folderId:o})));return n}return{success:!1,error:n.error||new Yn("Move items failed","MoveNotAllowed")}}async copyItem({itemId:e,targetFolderId:t}){if("function"!=typeof this._dataProvider.copyItem)throw new Yn("Copy item is not supported","CopyNotAllowed");const o=this.normalizeId(t);this._validateTargetFolderType(t);const r=this._cache.getEntity(e);if(!r){const t=rd(await this._dataProvider.copyItem({id:e,folderId:o},o));return this._cache.copyEntity(e,o,t.id),this._cache.upsertEntity(od(Object.assign(Object.assign({},t),{folderId:o}))),!0}if(this._validateDuplicates&&r.name){const t=o===this.normalizeId(r.folderId)?e:void 0;if(this._checkNameExistsInCache(o,r.name,!!r.isFolder,t)){const e=r.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new Yn(`${r.isFolder?"Folder":"File"} '${r.name}' already exists in target folder`,e)}}const n=rd(await this._dataProvider.copyItem(r,o));return this._cache.copyEntity(e,o,n.id,Object.assign(Object.assign({},n),{folderId:o}))||this._cache.upsertEntity(od(Object.assign(Object.assign({},n),{folderId:o}))),!0}async copyItems(e,t){var o;const r=this.normalizeId(e);this._validateTargetFolderType(e);const n=t.map(e=>"string"==typeof e?{id:e}:e),i=n.map(e=>e.id),a=i.map((e,t)=>{var o;const r=this._cache.getEntity(e),i=null===(o=n[t])||void 0===o?void 0:o.newName;return r?i?Object.assign(Object.assign({},r),{name:i}):r:void 0});if(this._validateDuplicates)for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.name){const o=this.normalizeId(t.folderId),n=r===o?i[e]:void 0;if(this._checkNameExistsInCache(r,t.name,!!t.isFolder,n)){const e=t.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new Yn(`${t.isFolder?"Folder":"File"} '${t.name}' already exists in target folder`,e)}}}let l={detailed:new Array(a.length),success:!0};if("function"==typeof this._dataProvider.copyItems){l=ed(await this._dataProvider.copyItems(a,r),e=>e)}else{if("function"!=typeof this._dataProvider.copyItem)throw new Yn("Copy items is not supported","CopyNotAllowed");l.detailed=await Promise.all(i.map(async(e,t)=>{const o=a[t]||{id:e,folderId:null,isFolder:!1};try{return{requestId:e,data:rd(await this._dataProvider.copyItem(o,r)),success:!0}}catch(t){return{requestId:e,success:!1,error:t}}}))}if(l.success&&l.detailed)for(let e=0,t=l.detailed.length;e<t;e++){const t=l.detailed[e];if(t.success)if(null===(o=t.data)||void 0===o?void 0:o.id){const e=t.data.folderId||r;!this._cache.copyEntity(t.requestId,e,t.data.id,Object.assign(Object.assign({},t.data),{folderId:e}))&&t.data&&this._cache.upsertEntity(od(Object.assign(Object.assign({},t.data),{folderId:e})))}else console.error("batchResult in copy method must have ids")}else if(!l.detailed)throw new Yn("batchResult in copy method must have detailed results","ValidationError");return l}async uploadFileByUrl(e){var t;if(e.noFolder){const t=await this.getTempFolder();e=Object.assign(Object.assign({},e),{folderId:null==t?void 0:t.id})}const o=this.normalizeId(null!==(t=e.folderId)&&void 0!==t?t:this._rootId);try{const t=await this._dataProvider.uploadFileByUrl(e.url,o,{eventSource:e.eventSource}),r=od(Object.assign(Object.assign({},t),{folderId:o}));return this._cache.upsertEntity(r),r}catch(e){throw console.error("uploadFileByUrl error:",e),e}}async updateFile(e,t){if("function"!=typeof this._dataProvider.updateFile)throw new Yn("Update file is not supported","UnsupportedOperation");const o=this.normalizeId(e),r=this._cache.getEntity(o);if(!r){const t="File with id '%s' not found in cache".replace("%s",e);throw new Yn(t,"FileNotFound")}if(t.name&&t.name!==r.name&&this._validateName(t.name,!1),this._validateDuplicates&&t.name&&t.name!==r.name){const e=this.normalizeId(r.folderId);if(this._checkNameExistsInCache(e,t.name,!1,o)){const e="File '%s' already exists in parent folder".replace("%s",t.name);throw new Yn(e,"FileAlreadyExists")}}const n=rd(await this._dataProvider.updateFile(r,Object.assign({},t)));return this._cache.upsertEntity(od(Object.assign(Object.assign(Object.assign({},this._cache.getEntity(o)),n),t))),this._cache.getEntity(o)}}var id,ad=new Uint8Array(16);function ld(){if(!id&&!(id="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return id(ad)}var sd=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var dd=[],cd=0;cd<256;++cd)dd.push((cd+256).toString(16).substr(1));function ud(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=(dd[e[t+0]]+dd[e[t+1]]+dd[e[t+2]]+dd[e[t+3]]+"-"+dd[e[t+4]]+dd[e[t+5]]+"-"+dd[e[t+6]]+dd[e[t+7]]+"-"+dd[e[t+8]]+dd[e[t+9]]+"-"+dd[e[t+10]]+dd[e[t+11]]+dd[e[t+12]]+dd[e[t+13]]+dd[e[t+14]]+dd[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&sd.test(e)}(o))throw TypeError("Stringified UUID is invalid");return o}function fd(e,t,o){var r=(e=e||{}).random||(e.rng||ld)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,ud(r)}class hd{constructor(e,t="",o=Ds,r="Trash",n=!0){var i;this._inner=e,this.rootPath=t,this.trashId=o,this.trashPath=r,this.ensureFolderTrailingSlash=n,this._pathToId=new Map,this._idToPath=new Map,this.validateDuplicates=null!==(i=this._inner.validateDuplicates)&&void 0!==i&&i,"function"==typeof e.getUrl&&(this.getUrl=t=>e.getUrl(Object.assign(Object.assign({},t),{id:this.pathForId(t.id,!1),folderId:t.folderId?this.pathForId(t.folderId,!0):this.rootPath}))),"function"==typeof e.getThumbnailUrl&&(this.getThumbnailUrl=t=>e.getThumbnailUrl(Object.assign(Object.assign({},t),{id:this.pathForId(t.id,!1),folderId:t.folderId?this.pathForId(t.folderId,!0):this.rootPath})));const a=this;"function"!=typeof this._inner.deleteItems&&(a.deleteItems=void 0),"function"!=typeof this._inner.deleteItem&&(a.deleteItem=void 0),"function"!=typeof this._inner.moveItems?a.moveItems=void 0:a.moveItem=void 0,"function"!=typeof this._inner.copyItems?a.copyItems=void 0:a.copyItem=void 0,"function"!=typeof this._inner.uploadFiles?a.uploadFiles=void 0:a.uploadFile=void 0,"function"!=typeof this._inner.clearCache&&(a.clearCache=void 0),this._getOrGenerateId(this.rootPath)}setController(e){"function"==typeof this._inner.setController&&this._inner.setController({invalidateItemCache:t=>{const o=t.replace(/^\/+|\/+$/g,""),r=this._pathToId.get(o);r&&e.invalidateItemCache(r)},getCachedItem:t=>{var o,r,n;const i=t.replace(/^\/+|\/+$/g,""),a=this._pathToId.get(i);if(a){const t=e.getCachedItem(a);if(t)return Object.assign(Object.assign({},t),{id:this.pathForId(t.id,null!==(o=t.isFolder)&&void 0!==o&&o),folderId:this.pathForId(null!==(r=t.folderId)&&void 0!==r?r:"",null!==(n=t.isFolder)&&void 0!==n&&n)})}}})}clearCache(e){if("function"==typeof this._inner.clearCache)return this._inner.clearCache(e)}findItemByPath(e){if("function"!=typeof this._inner.findItemByPath)return;const t=(e,t,o)=>{if(!e)return;if(!0!==e.isFolder)return e;const r=Bs(o),n=Bs(this.trashPath),i=Bs(r===n?this.trashPath:t),a=null!=e.folderId&&""!==e.folderId?Bs(e.folderId):this.rootPath;return Object.assign(Object.assign({},e),{id:this._getOrGenerateId(i),name:e.name,folderId:a===Bs(this.rootPath)?this.rootPath||"":this._getOrGenerateId(a),isFolder:!0})},o=zs(e,this.trashPath,this.trashId);return(async()=>{for(const r of o){const o=await Promise.resolve(this._inner.findItemByPath(r)),n=t(o,r,e);if(n)return n}})()}_getOrGenerateId(e){if(e===this.rootPath)return"";const t=Bs(e);if(t===Bs(this.trashPath))return this.trashId;if(this._pathToId.has(t))return this._pathToId.get(t);const o=fd();return this._pathToId.set(t,o),this._idToPath.set(o,t),o}pathForId(e,t,o){if(""===e||void 0===e)return this.rootPath;if(e===this.trashId)return this.trashPath;let r=this._idToPath.get(e);if(!r){if(o)return`unknown folder ${e}`;throw new Yn(`Path for id '${e}' not found in mapping`,"FileNotFound")}let n=0;for(;n<this.rootPath.length&&"/"===this.rootPath[n];)n++;if(n){let e=0;for(;e<r.length&&"/"===r[e];)e++;const t=r.slice(e);r="/".repeat(n)+t}return t&&this.ensureFolderTrailingSlash&&!r.endsWith("/")&&(r+="/"),r}_updateIdMapping(e,t){const o=t.replace(/^\/+|\/+$/g,""),r=this._idToPath.get(e);r&&this._pathToId.delete(r),this._idToPath.set(e,o),this._pathToId.set(o,e)}async getItems(e){const t=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,o=await this._inner.getItems(Object.assign(Object.assign({},e),{folderId:t})),r=o.items.map(e=>{const t=this._getOrGenerateId(e.id),o=e.folderId?this._getOrGenerateId(e.folderId):this._getOrGenerateId(this.rootPath);return Object.assign(Object.assign({},e),{id:t,folderId:o})});return Object.assign(Object.assign({},o),{items:r})}async createFolder(e,t,o){const r=t?this.pathForId(t,!0):this.rootPath,n=await this._inner.createFolder(e,r,o),i=this._getOrGenerateId(n.id),a=n.folderId?this._getOrGenerateId(n.folderId):this._getOrGenerateId(this.rootPath);return Object.assign(Object.assign({},n),{id:i,folderId:a})}async renameItem(e,t){var o,r;if("function"!=typeof this._inner.renameItem){throw new Yn("Rename item is not supported by inner storage","RenameNotAllowed")}const n=this.pathForId(e.id,null!==(o=e.isFolder)&&void 0!==o&&o),i=n;let a=kn(await this._inner.renameItem(Object.assign(Object.assign({},e),{id:n,folderId:this.pathForId(null!==(r=e.folderId)&&void 0!==r?r:"",!0)}),t),[]);return this._updateIdMapping(e.id,a.id),e.isFolder&&this.remapCachedFolderContents(e.id,i,a.id),a.folderId&&(a=Object.assign(Object.assign({},a),{folderId:this._getOrGenerateId(a.folderId)})),Object.assign(Object.assign({},a),{id:this._getOrGenerateId(a.id)})}async deleteItem(e,t){var o,r;if("function"!=typeof this._inner.deleteItem){throw new Yn("Delete item is not supported by inner storage","DeleteNotAllowed")}const n=this.pathForId(e.id,null!==(o=e.isFolder)&&void 0!==o&&o);await this._inner.deleteItem(Object.assign(Object.assign({},e),{id:n,folderId:this.pathForId(null!==(r=e.folderId)&&void 0!==r?r:"",!0)}),t),this.recursivelyRemoveMappings(e.id,n)}async uploadFile(e){if("function"!=typeof this._inner.uploadFile){throw new Yn("Upload file is not supported by inner storage","UnsupportedOperation")}const t=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,o=await this._inner.uploadFile(Object.assign(Object.assign({},e),{folderId:t})),r=this._getOrGenerateId(o.id),n=o.folderId?this._getOrGenerateId(o.folderId):this._getOrGenerateId(this.rootPath);return Object.assign(Object.assign({},o),{id:r,folderId:n})}async uploadFiles(e){var t,o,r,n,i;const a=e.folderId,l=null!==(o=null===(t=e.items)||void 0===t?void 0:t.map(e=>e.folderId))&&void 0!==o?o:[],s=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,d=Object.assign(Object.assign({},e),{folderId:s,items:null!==(n=null===(r=e.items)||void 0===r?void 0:r.map(e=>{var t;return Object.assign(Object.assign({},e),{folderId:e.folderId?this.pathForId(null!==(t=e.folderId)&&void 0!==t?t:"",!0):s})}))&&void 0!==n?n:[]}),c=await this._inner.uploadFiles(d);return Object.assign(Object.assign({},c),{detailed:null===(i=c.detailed)||void 0===i?void 0:i.map((e,t)=>{var o,r;if(!(null==e?void 0:e.data))return e;const n=e.data.id?this._getOrGenerateId(e.data.id):"",i=e.data.folderId?this._getOrGenerateId(e.data.folderId):null!==(r=null!==(o=l[t])&&void 0!==o?o:a)&&void 0!==r?r:this._getOrGenerateId(this.rootPath);return Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{id:n,folderId:i})})})})}async findFileByUrl(e,t){const o=t?this.pathForId(t,!0):this.rootPath;if("function"==typeof this._inner.findFileByUrl){const t=await this._inner.findFileByUrl(e,o);if(!t)return;const r=this._getOrGenerateId(t.id),n=t.folderId?this._getOrGenerateId(t.folderId):this._getOrGenerateId(this.rootPath);return Object.assign(Object.assign({},t),{id:r,folderId:n})}}async uploadFileByUrl(e,t,o){const r=t?this.pathForId(t,!0):this.rootPath,n=await this._inner.uploadFileByUrl(e,r,o),i=this._getOrGenerateId(n.id),a=n.folderId?this._getOrGenerateId(n.folderId):this._getOrGenerateId(this.rootPath);return Object.assign(Object.assign({},n),{id:i,folderId:a})}async moveItem(e,t){var o,r;if("function"!=typeof this._inner.moveItem){throw new Yn("Move item is not supported by inner storage","MoveNotAllowed")}const n=this.pathForId(e.id,null!==(o=e.isFolder)&&void 0!==o&&o),i=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.moveItem(Object.assign(Object.assign({},e),{id:n,folderId:this.pathForId(null!==(r=e.folderId)&&void 0!==r?r:"",!0)}),i);this._updateIdMapping(e.id,a.id),e.isFolder&&this.remapCachedFolderContents(e.id,n,a.id);const l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):t;return Object.assign(Object.assign({},a),{id:l,folderId:s})}async moveItems(e,t){var o;if("function"!=typeof this._inner.moveItems){throw new Yn("Move items is not supported by inner storage","MoveNotAllowed")}const r=t?this.pathForId(t,!0):this.rootPath,n=e.map(e=>{var t,o;return Object.assign(Object.assign({},e),{id:this.pathForId(e.id,null!==(t=e.isFolder)&&void 0!==t&&t),folderId:e.folderId?this.pathForId(null!==(o=e.folderId)&&void 0!==o?o:"",!0):this.rootPath})}),i=await this._inner.moveItems(n,r),a=[];if(i.detailed&&i.detailed.length>0){const r=new Map;for(let t=0;t<i.detailed.length;t++){const o=i.detailed[t],n=o.requestId||(t<e.length?e[t].id:void 0);n&&r.set(n,o)}for(const n of e){const l=r.get(n.id)||(i.detailed.length===e.length?i.detailed[e.indexOf(n)]:void 0);if((null==l?void 0:l.success)&&l.data){if(this._updateIdMapping(n.id,l.data.id),n.isFolder){const e=this.pathForId(n.id,null!==(o=n.isFolder)&&void 0!==o&&o);this.remapCachedFolderContents(n.id,e,l.data.id)}a.push({requestId:n.id,success:!0,data:Object.assign(Object.assign({},l.data),{id:this._getOrGenerateId(l.data.id),folderId:l.data.folderId?this._getOrGenerateId(l.data.folderId):t||this._getOrGenerateId(this.rootPath)})})}else{const e="Move operation failed - no detailed result";a.push({requestId:n.id,success:!1,error:(null==l?void 0:l.error)||{message:e,code:"MoveNotAllowed"}})}}}else for(const t of e){const e="Move operation failed - no detailed results";a.push({requestId:t.id,success:!1,error:{message:e,code:"MoveNotAllowed"}})}return{success:i.success,detailed:a,error:i.error}}async copyItems(e,t){var o;if("function"!=typeof this._inner.copyItems){throw new Yn("Copy items is not supported by inner storage","CopyNotAllowed")}const r=t?this.pathForId(t,!0):this.rootPath,n=e.map(e=>{var t,o;return Object.assign(Object.assign({},e),{id:this.pathForId(e.id,null!==(t=e.isFolder)&&void 0!==t&&t),folderId:e.folderId?this.pathForId(null!==(o=e.folderId)&&void 0!==o?o:"",!0):this.rootPath})}),i=await this._inner.copyItems(n,r),a=[];if(i.detailed&&i.detailed.length>0){const r=new Map;for(let t=0;t<i.detailed.length;t++){const o=i.detailed[t],n=o.requestId||(t<e.length?e[t].id:void 0);n&&r.set(n,o)}for(const n of e){const l=r.get(n.id)||(i.detailed.length===e.length?i.detailed[e.indexOf(n)]:void 0);if((null==l?void 0:l.success)&&(null===(o=l.data)||void 0===o?void 0:o.id)){const e=this._getOrGenerateId(l.data.id);a.push({requestId:n.id,success:!0,data:Object.assign(Object.assign({},l.data),{id:e,folderId:l.data.folderId?this._getOrGenerateId(l.data.folderId):t||this._getOrGenerateId(this.rootPath)})})}else{const e=l?l.success?l.data?l.data.id?{message:"Unknown copy error",code:"CopyNotAllowed"}:{message:"No ID in copied item data",code:"CopyNotAllowed"}:{message:"No data returned from copy operation",code:"CopyNotAllowed"}:l.error||{message:"Copy operation failed",code:"CopyNotAllowed"}:{message:"No detailed result from copy operation",code:"CopyNotAllowed"};a.push({requestId:n.id,success:!1,error:e})}}}else for(const t of e){const e="No detailed results from copy operation";a.push({requestId:t.id,success:!1,error:{message:e,code:"CopyNotAllowed"}})}const l=a.every(e=>e.success);return{success:l,detailed:a,error:l?void 0:i.error||{message:"Copy operation completed with errors",code:"CopyNotAllowed"}}}async deleteItems(e,t){var o,r,n,i;if("function"!=typeof this._inner.deleteItems){throw new Yn("Delete items is not supported by inner storage","DeleteNotAllowed")}const a=e.map(e=>{var t,o;return Object.assign(Object.assign({},e),{id:this.pathForId(e.id,null!==(t=e.isFolder)&&void 0!==t&&t),folderId:e.folderId?this.pathForId(null!==(o=e.folderId)&&void 0!==o?o:"",!0):this.rootPath})}),l=await this._inner.deleteItems(a,t),s=[];if(l.detailed&&l.detailed.length>0){const n=new Map;for(let t=0;t<l.detailed.length;t++){const o=l.detailed[t],r=o.requestId||(t<e.length?e[t].id:void 0);r&&n.set(r,o)}for(const i of e){const a=n.get(i.id)||(l.detailed.length===e.length?l.detailed[e.indexOf(i)]:void 0);if(null==a?void 0:a.success){const e=this.pathForId(i.id,null!==(o=i.isFolder)&&void 0!==o&&o);if(t.permanent)this.recursivelyRemoveMappings(i.id,e);else if(this._updateIdMapping(i.id,this.trashPath+"/"+e+(i.isFolder?"/":"")),i.isFolder){const t=this.pathForId(i.id,null!==(r=i.isFolder)&&void 0!==r&&r);this.remapCachedFolderContents(i.id,t,this.trashPath+"/"+e+(i.isFolder?"/":""))}s.push({requestId:i.id,success:!0})}else{const e="Delete operation failed";s.push({requestId:i.id,success:!1,error:(null==a?void 0:a.error)||{message:e,code:"DeleteNotAllowed"}})}}}else for(const o of e)if(l.success){const e=this.pathForId(o.id,null!==(n=o.isFolder)&&void 0!==n&&n);if(t.permanent)this.recursivelyRemoveMappings(o.id,e);else if(this._updateIdMapping(o.id,this.trashPath+"/"+e+(o.isFolder?"/":"")),o.isFolder){const t=this.pathForId(o.id,null!==(i=o.isFolder)&&void 0!==i&&i);this.remapCachedFolderContents(o.id,t,this.trashPath+"/"+e+(o.isFolder?"/":""))}s.push({requestId:o.id,success:!0})}else{const e="Delete operation failed";s.push({requestId:o.id,success:!1,error:l.error||{message:e,code:"DeleteNotAllowed"}})}const d=s.every(e=>e.success);return{success:d,detailed:s,error:d?void 0:l.error||{message:"Some items failed to delete",code:"DeleteNotAllowed"}}}remapCachedFolderContents(e,t,o){const r=t.replace(/\/+$/,""),n=o.replace(/\/+$/,""),i=[];for(const[e,t]of this._idToPath.entries()){const o=t.replace(/\/+$/,"");o!==r&&o.startsWith(r+"/")&&i.push({id:e,oldPath:o})}for(const{id:e,oldPath:t}of i){const o=n+t.substring(r.length);this._updateIdMapping(e,o)}}recursivelyRemoveMappings(e,t){const o=t.replace(/\/+$/,""),r=[],n=[];for(const[e,t]of this._idToPath.entries()){const i=t.replace(/\/+$/,"");(i===o||i.startsWith(o+"/"))&&(r.push(e),n.push(i))}for(let e=0;e<r.length;e++)this._idToPath.delete(r[e]),this._pathToId.delete(n[e])}async copyItem(e,t){var o,r;if("function"!=typeof this._inner.copyItem){throw new Yn("Copy item is not supported by inner storage","CopyNotAllowed")}const n=this.pathForId(e.id,null!==(o=e.isFolder)&&void 0!==o&&o),i=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.copyItem(Object.assign(Object.assign({},e),{id:n,folderId:this.pathForId(null!==(r=e.folderId)&&void 0!==r?r:"",!0)}),i),l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):null!=t?t:"";return Object.assign(Object.assign({},a),{id:l,folderId:s})}async updateFile(e,t){var o;if("function"!=typeof this._inner.updateFile){throw new Yn("Update file is not supported by inner storage","UnsupportedOperation")}const r=this.pathForId(e.id,!1);let n=kn(await this._inner.updateFile(Object.assign(Object.assign({},e),{id:r,folderId:this.pathForId(null!==(o=e.folderId)&&void 0!==o?o:"",!0)}),t),[]);return this._updateIdMapping(e.id,n.id),n.folderId&&(n=Object.assign(Object.assign({},n),{folderId:this._getOrGenerateId(n.folderId)})),Object.assign(Object.assign({},n),{id:this._getOrGenerateId(n.id)})}async getFileData(e,t){var o;const r=this.pathForId(e.id,!1);if("function"==typeof this._inner.getFileData)return this._inner.getFileData(Object.assign(Object.assign({},e),{id:r,folderId:this.pathForId(null!==(o=e.folderId)&&void 0!==o?o:"",!0)}),t);const n=e.url||("function"==typeof this.getUrl?await this.getUrl(e):void 0);if(!n){throw new Yn("Cannot get file data: no url and no inner.getFileData","FileReadError")}return fetch(n,(null==t?void 0:t.forceReload)?{cache:"no-store"}:void 0).then(e=>e.blob())}async cleanTrash(){if("function"!=typeof this._inner.cleanTrash){throw new Yn("Clean trash is not supported by inner storage","UnsupportedOperation")}return await this._inner.cleanTrash()}}var md={init:ws,unmount:bs,initPixieEditor:Fs,unmountPixieEditor:As,initFileManager:_s};export{Xs as $,Ra as A,$a as B,Ka as C,Pt as D,Rt as E,Ba as F,Yn as G,Ss as H,el as I,Za as J,Xa as K,xs as L,Ps as M,In as N,ks as O,Is as P,Ms as Q,Ls as R,Us as S,Os as T,Ts as U,Rs as V,js as W,Ds as X,qs as Y,zs as Z,Bs as _,pn as a,Zs as a0,Vs as a1,Qs as a2,nd as a3,hd as a4,yi as a5,vn as b,Bl as c,ea as d,Tn as e,Qn as f,Wa as g,Ln as h,Xt as i,ii as j,ai as k,ci as l,qa as m,Yt as n,En as o,$o as p,ws as q,Lr as r,bs as s,vs as t,dr as u,Fs as v,As as w,_s as x,md as y,ps as z};
10
+ //# sourceMappingURL=file-manager-index-CVN64GK6.js.map