@emailmaker/filemanager 0.10.34 → 0.10.35

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.
@@ -6,7 +6,7 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from
6
6
  * Released under MIT license <https://lodash.com/license>
7
7
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8
8
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9
- */var mi=(fi||(fi=1,function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",o="__lodash_placeholder__",a=32,s=128,l=256,c=1/0,u=9007199254740991,d=NaN,h=4294967295,f=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",l]],p="[object Arguments]",g="[object Array]",m="[object Boolean]",v="[object Date]",y="[object Error]",b="[object Function]",w="[object GeneratorFunction]",x="[object Map]",C="[object Number]",_="[object Object]",S="[object Promise]",k="[object RegExp]",A="[object Set]",E="[object String]",I="[object Symbol]",T="[object WeakMap]",F="[object ArrayBuffer]",O="[object DataView]",P="[object Float32Array]",M="[object Float64Array]",R="[object Int8Array]",L="[object Int16Array]",j="[object Int32Array]",D="[object Uint8Array]",N="[object Uint8ClampedArray]",z="[object Uint16Array]",B="[object Uint32Array]",U=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,q=RegExp(W.source),G=RegExp(H.source),Y=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,pe=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,me=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,be=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ce="\\u2700-\\u27bf",_e="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",ke="\\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",Ee="['’]",Ie="["+we+"]",Te="["+Ae+"]",Fe="["+xe+"]",Oe="\\d+",Pe="["+Ce+"]",Me="["+_e+"]",Re="[^"+we+Ae+Oe+Ce+_e+Se+"]",Le="\\ud83c[\\udffb-\\udfff]",je="[^"+we+"]",De="(?:\\ud83c[\\udde6-\\uddff]){2}",Ne="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Ue="(?:"+Me+"|"+Re+")",Ve="(?:"+ze+"|"+Re+")",$e="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Fe+"|"+Le+")?",qe="["+ke+"]?",Ge=qe+He+"(?:"+Be+"(?:"+[je,De,Ne].join("|")+")"+qe+He+")*",Ye="(?:"+[Pe,De,Ne].join("|")+")"+Ge,Xe="(?:"+[je+Fe+"?",Fe,De,Ne,Ie].join("|")+")",Ke=RegExp(Ee,"g"),Ze=RegExp(Fe,"g"),Je=RegExp(Le+"(?="+Le+")|"+Xe+Ge,"g"),Qe=RegExp([ze+"?"+Me+"+"+$e+"(?="+[Te,ze,"$"].join("|")+")",Ve+"+"+We+"(?="+[Te,ze+Ue,"$"].join("|")+")",ze+"?"+Ue+"+"+$e,ze+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oe,Ye].join("|"),"g"),et=RegExp("["+Be+we+xe+ke+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["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"],rt=-1,it={};it[P]=it[M]=it[R]=it[L]=it[j]=it[D]=it[N]=it[z]=it[B]=!0,it[p]=it[g]=it[F]=it[m]=it[O]=it[v]=it[y]=it[b]=it[x]=it[C]=it[_]=it[k]=it[A]=it[E]=it[T]=!1;var ot={};ot[p]=ot[g]=ot[F]=ot[O]=ot[m]=ot[v]=ot[P]=ot[M]=ot[R]=ot[L]=ot[j]=ot[x]=ot[C]=ot[_]=ot[k]=ot[A]=ot[E]=ot[I]=ot[D]=ot[N]=ot[z]=ot[B]=!0,ot[y]=ot[b]=ot[T]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,lt=parseInt,ct="object"==typeof En&&En&&En.Object===Object&&En,ut="object"==typeof self&&self&&self.Object===Object&&self,dt=ct||ut||Function("return this")(),ht=t&&!t.nodeType&&t,ft=ht&&e&&!e.nodeType&&e,pt=ft&&ft.exports===ht,gt=pt&&ct.process,mt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||gt&&gt.binding&&gt.binding("util")}catch(e){}}(),vt=mt&&mt.isArrayBuffer,yt=mt&&mt.isDate,bt=mt&&mt.isMap,wt=mt&&mt.isRegExp,xt=mt&&mt.isSet,Ct=mt&&mt.isTypedArray;function _t(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function St(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function kt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function At(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Et(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function It(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function Tt(e,t){return!(null==e||!e.length)&&zt(e,t,0)>-1}function Ft(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Ot(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Pt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Mt(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function Rt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var jt=$t("length");function Dt(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Nt(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function zt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Nt(e,Ut,n)}function Bt(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Ut(e){return e!=e}function Vt(e,t){var n=null==e?0:e.length;return n?qt(e,t)/n:d}function $t(e){return function(t){return null==t?n:t[e]}}function Wt(e){return function(t){return null==e?n:e[t]}}function Ht(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function qt(e,t){for(var r,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==n&&(r=r===n?a:r+a)}return r}function Gt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Yt(e){return e?e.slice(0,hn(e)+1).replace(ne,""):e}function Xt(e){return function(t){return e(t)}}function Kt(e,t){return Ot(t,function(t){return e[t]})}function Zt(e,t){return e.has(t)}function Jt(e,t){for(var n=-1,r=e.length;++n<r&&zt(t,e[n],0)>-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=Wt({"À":"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"}),tn=Wt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function an(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n];s!==t&&s!==o||(e[n]=o,a[i++]=n)}return a}function ln(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function un(e){return rn(e)?function(e){for(var t=Je.lastIndex=0;Je.test(e);)++t;return t}(e):jt(e)}function dn(e){return rn(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.split("")}(e)}function hn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var fn=Wt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),pn=function e(t){var re,we=(t=null==t?dt:pn.defaults(dt.Object(),t,pn.pick(dt,nt))).Array,xe=t.Date,Ce=t.Error,_e=t.Function,Se=t.Math,ke=t.Object,Ae=t.RegExp,Ee=t.String,Ie=t.TypeError,Te=we.prototype,Fe=_e.prototype,Oe=ke.prototype,Pe=t["__core-js_shared__"],Me=Fe.toString,Re=Oe.hasOwnProperty,Le=0,je=(re=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"",De=Oe.toString,Ne=Me.call(ke),ze=dt._,Be=Ae("^"+Me.call(Re).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=pt?t.Buffer:n,Ve=t.Symbol,$e=t.Uint8Array,We=Ue?Ue.allocUnsafe:n,He=an(ke.getPrototypeOf,ke),qe=ke.create,Ge=Oe.propertyIsEnumerable,Ye=Te.splice,Xe=Ve?Ve.isConcatSpreadable:n,Je=Ve?Ve.iterator:n,et=Ve?Ve.toStringTag:n,at=function(){try{var e=uo(ke,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ut=xe&&xe.now!==dt.Date.now&&xe.now,ht=t.setTimeout!==dt.setTimeout&&t.setTimeout,ft=Se.ceil,gt=Se.floor,mt=ke.getOwnPropertySymbols,jt=Ue?Ue.isBuffer:n,Wt=t.isFinite,gn=Te.join,mn=an(ke.keys,ke),vn=Se.max,yn=Se.min,bn=xe.now,wn=t.parseInt,xn=Se.random,Cn=Te.reverse,_n=uo(t,"DataView"),Sn=uo(t,"Map"),kn=uo(t,"Promise"),An=uo(t,"Set"),En=uo(t,"WeakMap"),In=uo(ke,"create"),Tn=En&&new En,Fn={},On=Do(_n),Pn=Do(Sn),Mn=Do(kn),Rn=Do(An),Ln=Do(En),jn=Ve?Ve.prototype:n,Dn=jn?jn.valueOf:n,Nn=jn?jn.toString:n;function zn(e){if(es(e)&&!$a(e)&&!(e instanceof $n)){if(e instanceof Vn)return e;if(Re.call(e,"__wrapped__"))return No(e)}return new Vn(e)}var Bn=function(){function e(){}return function(t){if(!Qa(t))return{};if(qe)return qe(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Un(){}function Vn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function $n(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new Hn(e);this.size=t.size}function Xn(e,t){var n=$a(e),r=!n&&Va(e),i=!n&&!r&&Ga(e),o=!n&&!r&&!i&&ls(e),a=n||r||i||o,s=a?Gt(e.length,Ee):[],l=s.length;for(var c in e)!t&&!Re.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yo(c,l))||s.push(c);return s}function Kn(e){var t=e.length;return t?e[Gr(0,t-1)]:n}function Zn(e,t){return Ro(Ii(e),ar(t,0,e.length))}function Jn(e){return Ro(Ii(e))}function Qn(e,t,r){(r!==n&&!za(e[t],r)||r===n&&!(t in e))&&ir(e,t,r)}function er(e,t,r){var i=e[t];Re.call(e,t)&&za(i,r)&&(r!==n||t in e)||ir(e,t,r)}function tr(e,t){for(var n=e.length;n--;)if(za(e[n][0],t))return n;return-1}function nr(e,t,n,r){return dr(e,function(e,i,o){t(r,e,n(e),o)}),r}function rr(e,t){return e&&Ti(t,Fs(t),e)}function ir(e,t,n){"__proto__"==t&&at?at(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function or(e,t){for(var r=-1,i=t.length,o=we(i),a=null==e;++r<i;)o[r]=a?n:ks(e,t[r]);return o}function ar(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function sr(e,t,r,i,o,a){var s,l=1&t,c=2&t,u=4&t;if(r&&(s=o?r(e,i,o,a):r(e)),s!==n)return s;if(!Qa(e))return e;var d=$a(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ii(e,s)}else{var h=po(e),f=h==b||h==w;if(Ga(e))return Ci(e,l);if(h==_||h==p||f&&!o){if(s=c||f?{}:mo(e),!l)return c?function(e,t){return Ti(e,fo(e),t)}(e,function(e,t){return e&&Ti(t,Os(t),e)}(s,e)):function(e,t){return Ti(e,ho(e),t)}(e,rr(s,e))}else{if(!ot[h])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case F:return _i(e);case m:case v:return new i(+e);case O:return function(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case P:case M:case R:case L:case j:case D:case N:case z:case B:return Si(e,n);case x:return new i;case C:case E:return new i(e);case k:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new i;case I:return r=e,Dn?ke(Dn.call(r)):{}}}(e,h,l)}}a||(a=new Yn);var g=a.get(e);if(g)return g;a.set(e,s),os(e)?e.forEach(function(n){s.add(sr(n,t,r,n,e,a))}):ts(e)&&e.forEach(function(n,i){s.set(i,sr(n,t,r,i,e,a))});var y=d?n:(u?c?ro:no:c?Os:Fs)(e);return kt(y||e,function(n,i){y&&(n=e[i=n]),er(s,i,sr(n,t,r,i,e,a))}),s}function lr(e,t,r){var i=r.length;if(null==e)return!i;for(e=ke(e);i--;){var o=r[i],a=t[o],s=e[o];if(s===n&&!(o in e)||!a(s))return!1}return!0}function cr(e,t,i){if("function"!=typeof e)throw new Ie(r);return Fo(function(){e.apply(n,i)},t)}function ur(e,t,n,r){var i=-1,o=Tt,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;n&&(t=Ot(t,Xt(n))),r?(o=Ft,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i<s;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,a&&d==d){for(var h=c;h--;)if(t[h]===d)continue e;l.push(u)}else o(t,d,r)||l.push(u)}return l}zn.templateSettings={escape:Y,evaluate:X,interpolate:K,variable:"",imports:{_:zn}},zn.prototype=Un.prototype,zn.prototype.constructor=zn,Vn.prototype=Bn(Un.prototype),Vn.prototype.constructor=Vn,$n.prototype=Bn(Un.prototype),$n.prototype.constructor=$n,Wn.prototype.clear=function(){this.__data__=In?In(null):{},this.size=0},Wn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Wn.prototype.get=function(e){var t=this.__data__;if(In){var r=t[e];return r===i?n:r}return Re.call(t,e)?t[e]:n},Wn.prototype.has=function(e){var t=this.__data__;return In?t[e]!==n:Re.call(t,e)},Wn.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=In&&t===n?i:t,this},Hn.prototype.clear=function(){this.__data__=[],this.size=0},Hn.prototype.delete=function(e){var t=this.__data__,n=tr(t,e);return!(n<0||(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,0))},Hn.prototype.get=function(e){var t=this.__data__,r=tr(t,e);return r<0?n:t[r][1]},Hn.prototype.has=function(e){return tr(this.__data__,e)>-1},Hn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Sn||Hn),string:new Wn}},qn.prototype.delete=function(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return lo(this,e).get(e)},qn.prototype.has=function(e){return lo(this,e).has(e)},qn.prototype.set=function(e,t){var n=lo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,i),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Hn,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Hn){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var dr=Pi(br),hr=Pi(wr,!0);function fr(e,t){var n=!0;return dr(e,function(e,r,i){return n=!!t(e,r,i)}),n}function pr(e,t,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(l===n?s==s&&!ss(s):r(s,l)))var l=s,c=a}return c}function gr(e,t){var n=[];return dr(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function mr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=vo),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?mr(s,t-1,n,r,i):Pt(i,s):r||(i[i.length]=s)}return i}var vr=Mi(),yr=Mi(!0);function br(e,t){return e&&vr(e,t,Fs)}function wr(e,t){return e&&yr(e,t,Fs)}function xr(e,t){return It(t,function(t){return Ka(e[t])})}function Cr(e,t){for(var r=0,i=(t=yi(t,e)).length;null!=e&&r<i;)e=e[jo(t[r++])];return r&&r==i?e:n}function _r(e,t,n){var r=t(e);return $a(e)?r:Pt(r,n(e))}function Sr(e){return null==e?e===n?"[object Undefined]":"[object Null]":et&&et in ke(e)?function(e){var t=Re.call(e,et),r=e[et];try{e[et]=n;var i=!0}catch(e){}var o=De.call(e);return i&&(t?e[et]=r:delete e[et]),o}(e):function(e){return De.call(e)}(e)}function kr(e,t){return e>t}function Ar(e,t){return null!=e&&Re.call(e,t)}function Er(e,t){return null!=e&&t in ke(e)}function Ir(e,t,r){for(var i=r?Ft:Tt,o=e[0].length,a=e.length,s=a,l=we(a),c=1/0,u=[];s--;){var d=e[s];s&&t&&(d=Ot(d,Xt(t))),c=yn(d.length,c),l[s]=!r&&(t||o>=120&&d.length>=120)?new Gn(s&&d):n}d=e[0];var h=-1,f=l[0];e:for(;++h<o&&u.length<c;){var p=d[h],g=t?t(p):p;if(p=r||0!==p?p:0,!(f?Zt(f,g):i(u,g,r))){for(s=a;--s;){var m=l[s];if(!(m?Zt(m,g):i(e[s],g,r)))continue e}f&&f.push(g),u.push(p)}}return u}function Tr(e,t,r){var i=null==(e=Eo(e,t=yi(t,e)))?e:e[jo(Xo(t))];return null==i?n:_t(i,e,r)}function Fr(e){return es(e)&&Sr(e)==p}function Or(e,t,r,i,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,r,i,o,a){var s=$a(e),l=$a(t),c=s?g:po(e),u=l?g:po(t),d=(c=c==p?_:c)==_,h=(u=u==p?_:u)==_,f=c==u;if(f&&Ga(e)){if(!Ga(t))return!1;s=!0,d=!1}if(f&&!d)return a||(a=new Yn),s||ls(e)?eo(e,t,r,i,o,a):function(e,t,n,r,i,o,a){switch(n){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case F:return!(e.byteLength!=t.byteLength||!o(new $e(e),new $e(t)));case m:case v:case C:return za(+e,+t);case y:return e.name==t.name&&e.message==t.message;case k:case E:return e==t+"";case x:var s=on;case A:var l=1&r;if(s||(s=ln),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;r|=2,a.set(e,t);var u=eo(s(e),s(t),r,i,o,a);return a.delete(e),u;case I:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,c,r,i,o,a);if(!(1&r)){var b=d&&Re.call(e,"__wrapped__"),w=h&&Re.call(t,"__wrapped__");if(b||w){var S=b?e.value():e,T=w?t.value():t;return a||(a=new Yn),o(S,T,r,i,a)}}return!!f&&(a||(a=new Yn),function(e,t,r,i,o,a){var s=1&r,l=no(e),c=l.length,u=no(t),d=u.length;if(c!=d&&!s)return!1;for(var h=c;h--;){var f=l[h];if(!(s?f in t:Re.call(t,f)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);for(var v=s;++h<c;){var y=e[f=l[h]],b=t[f];if(i)var w=s?i(b,y,f,t,e,a):i(y,b,f,e,t,a);if(!(w===n?y===b||o(y,b,r,i,a):w)){m=!1;break}v||(v="constructor"==f)}if(m&&!v){var x=e.constructor,C=t.constructor;x==C||!("constructor"in e)||!("constructor"in t)||"function"==typeof x&&x instanceof x&&"function"==typeof C&&C instanceof C||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,r,i,o,a))}(e,t,r,i,Or,o))}function Pr(e,t,r,i){var o=r.length,a=o,s=!i;if(null==e)return!a;for(e=ke(e);o--;){var l=r[o];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var c=(l=r[o])[0],u=e[c],d=l[1];if(s&&l[2]){if(u===n&&!(c in e))return!1}else{var h=new Yn;if(i)var f=i(u,d,c,e,t,h);if(!(f===n?Or(d,u,3,i,h):f))return!1}}return!0}function Mr(e){return!(!Qa(e)||(t=e,je&&je in t))&&(Ka(e)?Be:pe).test(Do(e));var t}function Rr(e){return"function"==typeof e?e:null==e?nl:"object"==typeof e?$a(e)?Br(e[0],e[1]):zr(e):dl(e)}function Lr(e){if(!_o(e))return mn(e);var t=[];for(var n in ke(e))Re.call(e,n)&&"constructor"!=n&&t.push(n);return t}function jr(e){if(!Qa(e))return function(e){var t=[];if(null!=e)for(var n in ke(e))t.push(n);return t}(e);var t=_o(e),n=[];for(var r in e)("constructor"!=r||!t&&Re.call(e,r))&&n.push(r);return n}function Dr(e,t){return e<t}function Nr(e,t){var n=-1,r=Ha(e)?we(e.length):[];return dr(e,function(e,i,o){r[++n]=t(e,i,o)}),r}function zr(e){var t=co(e);return 1==t.length&&t[0][2]?ko(t[0][0],t[0][1]):function(n){return n===e||Pr(n,e,t)}}function Br(e,t){return wo(e)&&So(t)?ko(jo(e),t):function(r){var i=ks(r,e);return i===n&&i===t?As(r,e):Or(t,i,3)}}function Ur(e,t,r,i,o){e!==t&&vr(t,function(a,s){if(o||(o=new Yn),Qa(a))!function(e,t,r,i,o,a,s){var l=Io(e,r),c=Io(t,r),u=s.get(c);if(u)Qn(e,r,u);else{var d=a?a(l,c,r+"",e,t,s):n,h=d===n;if(h){var f=$a(c),p=!f&&Ga(c),g=!f&&!p&&ls(c);d=c,f||p||g?$a(l)?d=l:qa(l)?d=Ii(l):p?(h=!1,d=Ci(c,!0)):g?(h=!1,d=Si(c,!0)):d=[]:rs(c)||Va(c)?(d=l,Va(l)?d=ms(l):Qa(l)&&!Ka(l)||(d=mo(c))):h=!1}h&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Qn(e,r,d)}}(e,t,s,r,Ur,i,o);else{var l=i?i(Io(e,s),a,s+"",e,t,o):n;l===n&&(l=a),Qn(e,s,l)}},Os)}function Vr(e,t){var r=e.length;if(r)return yo(t+=t<0?r:0,r)?e[t]:n}function $r(e,t,n){t=t.length?Ot(t,function(e){return $a(e)?function(t){return Cr(t,1===e.length?e[0]:e)}:e}):[nl];var r=-1;t=Ot(t,Xt(so()));var i=Nr(e,function(e,n,i){var o=Ot(t,function(t){return t(e)});return{criteria:o,index:++r,value:e}});return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var l=ki(i[r],o[r]);if(l)return r>=s?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)})}function Wr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=Cr(e,a);n(s,a)&&Jr(o,yi(a,e),s)}return o}function Hr(e,t,n,r){var i=r?Bt:zt,o=-1,a=t.length,s=e;for(e===t&&(t=Ii(t)),n&&(s=Ot(e,Xt(n)));++o<a;)for(var l=0,c=t[o],u=n?n(c):c;(l=i(s,u,l,r))>-1;)s!==e&&Ye.call(s,l,1),Ye.call(e,l,1);return e}function qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;yo(i)?Ye.call(e,i,1):ui(e,i)}}return e}function Gr(e,t){return e+gt(xn()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>u)return n;do{t%2&&(n+=e),(t=gt(t/2))&&(e+=e)}while(t);return n}function Xr(e,t){return Oo(Ao(e,t,nl),e+"")}function Kr(e){return Kn(zs(e))}function Zr(e,t){var n=zs(e);return Ro(n,ar(t,0,n.length))}function Jr(e,t,r,i){if(!Qa(e))return e;for(var o=-1,a=(t=yi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var c=jo(t[o]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=s){var d=l[c];(u=i?i(d,c,l):n)===n&&(u=Qa(d)?d:yo(t[o+1])?[]:{})}er(l,c,u),l=l[c]}return e}var Qr=Tn?function(e,t){return Tn.set(e,t),e}:nl,ei=at?function(e,t){return at(e,"toString",{configurable:!0,enumerable:!1,value:Qs(t),writable:!0})}:nl;function ti(e){return Ro(zs(e))}function ni(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=we(i);++r<i;)o[r]=e[r+t];return o}function ri(e,t){var n;return dr(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function ii(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!ss(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return oi(e,t,nl,n)}function oi(e,t,r,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=r(t))!=t,l=null===t,c=ss(t),u=t===n;o<a;){var d=gt((o+a)/2),h=r(e[d]),f=h!==n,p=null===h,g=h==h,m=ss(h);if(s)var v=i||g;else v=u?g&&(i||f):l?g&&f&&(i||!p):c?g&&f&&!p&&(i||!m):!p&&!m&&(i?h<=t:h<t);v?o=d+1:a=d}return yn(a,4294967294)}function ai(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!za(s,l)){var l=s;o[i++]=0===a?0:a}}return o}function si(e){return"number"==typeof e?e:ss(e)?d:+e}function li(e){if("string"==typeof e)return e;if($a(e))return Ot(e,li)+"";if(ss(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,n){var r=-1,i=Tt,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=Ft;else if(o>=200){var c=t?null:Yi(e);if(c)return ln(c);a=!1,i=Zt,l=new Gn}else l=t?[]:s;e:for(;++r<o;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,a&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue e;t&&l.push(d),s.push(u)}else i(l,d,n)||(l!==s&&l.push(d),s.push(u))}return s}function ui(e,t){return null==(e=Eo(e,t=yi(t,e)))||delete e[jo(Xo(t))]}function di(e,t,n,r){return Jr(e,t,n(Cr(e,t)),r)}function hi(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ni(e,r?0:o,r?o+1:i):ni(e,r?o+1:0,r?i:o)}function fi(e,t){var n=e;return n instanceof $n&&(n=n.value()),Mt(t,function(e,t){return t.func.apply(t.thisArg,Pt([e],t.args))},n)}function pi(e,t,n){var r=e.length;if(r<2)return r?ci(e[0]):[];for(var i=-1,o=we(r);++i<r;)for(var a=e[i],s=-1;++s<r;)s!=i&&(o[i]=ur(o[i]||a,e[s],t,n));return ci(mr(o,1),t,n)}function gi(e,t,r){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var l=i<a?t[i]:n;r(s,e[i],l)}return s}function mi(e){return qa(e)?e:[]}function vi(e){return"function"==typeof e?e:nl}function yi(e,t){return $a(e)?e:wo(e,t)?[e]:Lo(vs(e))}var bi=Xr;function wi(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ni(e,t,r)}var xi=ct||function(e){return dt.clearTimeout(e)};function Ci(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function _i(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function Si(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ki(e,t){if(e!==t){var r=e!==n,i=null===e,o=e==e,a=ss(e),s=t!==n,l=null===t,c=t==t,u=ss(t);if(!l&&!u&&!a&&e>t||a&&s&&c&&!l&&!u||i&&s&&c||!r&&c||!o)return 1;if(!i&&!a&&!u&&e<t||u&&r&&o&&!i&&!a||l&&r&&o||!s&&o||!c)return-1}return 0}function Ai(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,l=t.length,c=vn(o-a,0),u=we(l+c),d=!r;++s<l;)u[s]=t[s];for(;++i<a;)(d||i<o)&&(u[n[i]]=e[i]);for(;c--;)u[s++]=e[i++];return u}function Ei(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,l=-1,c=t.length,u=vn(o-s,0),d=we(u+c),h=!r;++i<u;)d[i]=e[i];for(var f=i;++l<c;)d[f+l]=t[l];for(;++a<s;)(h||i<o)&&(d[f+n[a]]=e[i++]);return d}function Ii(e,t){var n=-1,r=e.length;for(t||(t=we(r));++n<r;)t[n]=e[n];return t}function Ti(e,t,r,i){var o=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var l=t[a],c=i?i(r[l],e[l],l,r,e):n;c===n&&(c=e[l]),o?ir(r,l,c):er(r,l,c)}return r}function Fi(e,t){return function(n,r){var i=$a(n)?St:nr,o=t?t():{};return i(n,e,so(r,2),o)}}function Oi(e){return Xr(function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:n,s=o>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(o--,a):n,s&&bo(r[0],r[1],s)&&(a=o<3?n:a,o=1),t=ke(t);++i<o;){var l=r[i];l&&e(t,l,i,a)}return t})}function Pi(e,t){return function(n,r){if(null==n)return n;if(!Ha(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=ke(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Mi(e){return function(t,n,r){for(var i=-1,o=ke(t),a=r(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===n(o[l],l,o))break}return t}}function Ri(e){return function(t){var r=rn(t=vs(t))?dn(t):n,i=r?r[0]:t.charAt(0),o=r?wi(r,1).join(""):t.slice(1);return i[e]()+o}}function Li(e){return function(t){return Mt(Ks(Vs(t).replace(Ke,"")),e,"")}}function ji(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 n=Bn(e.prototype),r=e.apply(n,t);return Qa(r)?r:n}}function Di(e){return function(t,r,i){var o=ke(t);if(!Ha(t)){var a=so(r,3);t=Fs(t),r=function(e){return a(o[e],e,o)}}var s=e(t,r,i);return s>-1?o[a?t[s]:s]:n}}function Ni(e){return to(function(t){var i=t.length,o=i,a=Vn.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Ie(r);if(a&&!l&&"wrapper"==oo(s))var l=new Vn([],!0)}for(o=l?o:i;++o<i;){var c=oo(s=t[o]),u="wrapper"==c?io(s):n;l=u&&xo(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[oo(u[0])].apply(l,u[3]):1==s.length&&xo(s)?l[c]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&$a(n))return l.plant(n).value();for(var r=0,o=i?t[r].apply(this,e):n;++r<i;)o=t[r].call(this,o);return o}})}function zi(e,t,r,i,o,a,l,c,u,d){var h=t&s,f=1&t,p=2&t,g=24&t,m=512&t,v=p?n:ji(e);return function s(){for(var y=arguments.length,b=we(y),w=y;w--;)b[w]=arguments[w];if(g)var x=ao(s),C=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(b,x);if(i&&(b=Ai(b,i,o,g)),a&&(b=Ei(b,a,l,g)),y-=C,g&&y<d){var _=sn(b,x);return qi(e,t,zi,s.placeholder,r,b,_,c,u,d-y)}var S=f?r:this,k=p?S[e]:e;return y=b.length,c?b=function(e,t){for(var r=e.length,i=yn(t.length,r),o=Ii(e);i--;){var a=t[i];e[i]=yo(a,r)?o[a]:n}return e}(b,c):m&&y>1&&b.reverse(),h&&u<y&&(b.length=u),this&&this!==dt&&this instanceof s&&(k=v||ji(k)),k.apply(S,b)}}function Bi(e,t){return function(n,r){return function(e,t,n,r){return br(e,function(e,i,o){t(r,n(e),i,o)}),r}(n,e,t(r),{})}}function Ui(e,t){return function(r,i){var o;if(r===n&&i===n)return t;if(r!==n&&(o=r),i!==n){if(o===n)return i;"string"==typeof r||"string"==typeof i?(r=li(r),i=li(i)):(r=si(r),i=si(i)),o=e(r,i)}return o}}function Vi(e){return to(function(t){return t=Ot(t,Xt(so())),Xr(function(n){var r=this;return e(t,function(e){return _t(e,r,n)})})})}function $i(e,t){var r=(t=t===n?" ":li(t)).length;if(r<2)return r?Yr(t,e):t;var i=Yr(t,ft(e/un(t)));return rn(t)?wi(dn(i),0,e).join(""):i.slice(0,e)}function Wi(e){return function(t,r,i){return i&&"number"!=typeof i&&bo(t,r,i)&&(r=i=n),t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n,r){for(var i=-1,o=vn(ft((t-e)/(n||1)),0),a=we(o);o--;)a[r?o:++i]=e,e+=n;return a}(t,r,i=i===n?t<r?1:-1:hs(i),e)}}function Hi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=gs(t),n=gs(n)),e(t,n)}}function qi(e,t,r,i,o,s,l,c,u,d){var h=8&t;t|=h?a:64,4&(t&=~(h?64:a))||(t&=-4);var f=[e,t,o,h?s:n,h?l:n,h?n:s,h?n:l,c,u,d],p=r.apply(n,f);return xo(e)&&To(p,f),p.placeholder=i,Po(p,e,t)}function Gi(e){var t=Se[e];return function(e,n){if(e=gs(e),(n=null==n?0:yn(fs(n),292))&&Wt(e)){var r=(vs(e)+"e").split("e");return+((r=(vs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yi=An&&1/ln(new An([,-0]))[1]==c?function(e){return new An(e)}:sl;function Xi(e){return function(t){var n=po(t);return n==x?on(t):n==A?cn(t):function(e,t){return Ot(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ki(e,t,i,c,u,d,h,f){var p=2&t;if(!p&&"function"!=typeof e)throw new Ie(r);var g=c?c.length:0;if(g||(t&=-97,c=u=n),h=h===n?h:vn(fs(h),0),f=f===n?f:fs(f),g-=u?u.length:0,64&t){var m=c,v=u;c=u=n}var y=p?n:io(e),b=[e,t,i,c,u,m,v,d,h,f];if(y&&function(e,t){var n=e[1],r=t[1],i=n|r,a=i<131,c=r==s&&8==n||r==s&&n==l&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!a&&!c)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?Ai(d,u,t[4]):u,e[4]=d?sn(e[3],o):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ei(d,u,t[6]):u,e[6]=d?sn(e[5],o):t[6]),(u=t[7])&&(e[7]=u),r&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(b,y),e=b[0],t=b[1],i=b[2],c=b[3],u=b[4],!(f=b[9]=b[9]===n?p?0:e.length:vn(b[9]-g,0))&&24&t&&(t&=-25),t&&1!=t)w=8==t||16==t?function(e,t,r){var i=ji(e);return function o(){for(var a=arguments.length,s=we(a),l=a,c=ao(o);l--;)s[l]=arguments[l];var u=a<3&&s[0]!==c&&s[a-1]!==c?[]:sn(s,c);return(a-=u.length)<r?qi(e,t,zi,o.placeholder,n,s,u,n,n,r-a):_t(this&&this!==dt&&this instanceof o?i:e,this,s)}}(e,t,f):t!=a&&33!=t||u.length?zi.apply(n,b):function(e,t,n,r){var i=1&t,o=ji(e);return function t(){for(var a=-1,s=arguments.length,l=-1,c=r.length,u=we(c+s),d=this&&this!==dt&&this instanceof t?o:e;++l<c;)u[l]=r[l];for(;s--;)u[l++]=arguments[++a];return _t(d,i?n:this,u)}}(e,t,i,c);else var w=function(e,t,n){var r=1&t,i=ji(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return Po((y?Qr:To)(w,b),e,t)}function Zi(e,t,r,i){return e===n||za(e,Oe[r])&&!Re.call(i,r)?t:e}function Ji(e,t,r,i,o,a){return Qa(e)&&Qa(t)&&(a.set(t,e),Ur(e,t,n,Ji,a),a.delete(t)),e}function Qi(e){return rs(e)?n:e}function eo(e,t,r,i,o,a){var s=1&r,l=e.length,c=t.length;if(l!=c&&!(s&&c>l))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var h=-1,f=!0,p=2&r?new Gn:n;for(a.set(e,t),a.set(t,e);++h<l;){var g=e[h],m=t[h];if(i)var v=s?i(m,g,h,t,e,a):i(g,m,h,e,t,a);if(v!==n){if(v)continue;f=!1;break}if(p){if(!Lt(t,function(e,t){if(!Zt(p,t)&&(g===e||o(g,e,r,i,a)))return p.push(t)})){f=!1;break}}else if(g!==m&&!o(g,m,r,i,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function to(e){return Oo(Ao(e,n,Wo),e+"")}function no(e){return _r(e,Fs,ho)}function ro(e){return _r(e,Os,fo)}var io=Tn?function(e){return Tn.get(e)}:sl;function oo(e){for(var t=e.name+"",n=Fn[t],r=Re.call(Fn,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function ao(e){return(Re.call(zn,"placeholder")?zn:e).placeholder}function so(){var e=zn.iteratee||rl;return e=e===rl?Rr:e,arguments.length?e(arguments[0],arguments[1]):e}function lo(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function co(e){for(var t=Fs(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,So(i)]}return t}function uo(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Mr(r)?r:n}var ho=mt?function(e){return null==e?[]:(e=ke(e),It(mt(e),function(t){return Ge.call(e,t)}))}:pl,fo=mt?function(e){for(var t=[];e;)Pt(t,ho(e)),e=He(e);return t}:pl,po=Sr;function go(e,t,n){for(var r=-1,i=(t=yi(t,e)).length,o=!1;++r<i;){var a=jo(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Ja(i)&&yo(a,i)&&($a(e)||Va(e))}function mo(e){return"function"!=typeof e.constructor||_o(e)?{}:Bn(He(e))}function vo(e){return $a(e)||Va(e)||!!(Xe&&e&&e[Xe])}function yo(e,t){var n=typeof e;return!!(t=null==t?u:t)&&("number"==n||"symbol"!=n&&me.test(e))&&e>-1&&e%1==0&&e<t}function bo(e,t,n){if(!Qa(n))return!1;var r=typeof t;return!!("number"==r?Ha(n)&&yo(t,n.length):"string"==r&&t in n)&&za(n[t],e)}function wo(e,t){if($a(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ss(e))||J.test(e)||!Z.test(e)||null!=t&&e in ke(t)}function xo(e){var t=oo(e),n=zn[t];if("function"!=typeof n||!(t in $n.prototype))return!1;if(e===n)return!0;var r=io(n);return!!r&&e===r[0]}(_n&&po(new _n(new ArrayBuffer(1)))!=O||Sn&&po(new Sn)!=x||kn&&po(kn.resolve())!=S||An&&po(new An)!=A||En&&po(new En)!=T)&&(po=function(e){var t=Sr(e),r=t==_?e.constructor:n,i=r?Do(r):"";if(i)switch(i){case On:return O;case Pn:return x;case Mn:return S;case Rn:return A;case Ln:return T}return t});var Co=Pe?Ka:gl;function _o(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Oe)}function So(e){return e==e&&!Qa(e)}function ko(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in ke(r))}}function Ao(e,t,r){return t=vn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=vn(n.length-t,0),a=we(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=we(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),_t(e,this,s)}}function Eo(e,t){return t.length<2?e:Cr(e,ni(t,0,-1))}function Io(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var To=Mo(Qr),Fo=ht||function(e,t){return dt.setTimeout(e,t)},Oo=Mo(ei);function Po(e,t,n){var r=t+"";return Oo(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return kt(f,function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(r),n)))}function Mo(e){var t=0,r=0;return function(){var i=bn(),o=16-(i-r);if(r=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Ro(e,t){var r=-1,i=e.length,o=i-1;for(t=t===n?i:t;++r<t;){var a=Gr(r,o),s=e[a];e[a]=e[r],e[r]=s}return e.length=t,e}var Lo=function(e){var t=Ma(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Q,function(e,n,r,i){t.push(r?i.replace(ce,"$1"):n||e)}),t});function jo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Do(e){if(null!=e){try{return Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function No(e){if(e instanceof $n)return e.clone();var t=new Vn(e.__wrapped__,e.__chain__);return t.__actions__=Ii(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var zo=Xr(function(e,t){return qa(e)?ur(e,mr(t,1,qa,!0)):[]}),Bo=Xr(function(e,t){var r=Xo(t);return qa(r)&&(r=n),qa(e)?ur(e,mr(t,1,qa,!0),so(r,2)):[]}),Uo=Xr(function(e,t){var r=Xo(t);return qa(r)&&(r=n),qa(e)?ur(e,mr(t,1,qa,!0),n,r):[]});function Vo(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fs(n);return i<0&&(i=vn(r+i,0)),Nt(e,so(t,3),i)}function $o(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return r!==n&&(o=fs(r),o=r<0?vn(i+o,0):yn(o,i-1)),Nt(e,so(t,3),o,!0)}function Wo(e){return null!=e&&e.length?mr(e,1):[]}function Ho(e){return e&&e.length?e[0]:n}var qo=Xr(function(e){var t=Ot(e,mi);return t.length&&t[0]===e[0]?Ir(t):[]}),Go=Xr(function(e){var t=Xo(e),r=Ot(e,mi);return t===Xo(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Ir(r,so(t,2)):[]}),Yo=Xr(function(e){var t=Xo(e),r=Ot(e,mi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Ir(r,n,t):[]});function Xo(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Ko=Xr(Zo);function Zo(e,t){return e&&e.length&&t&&t.length?Hr(e,t):e}var Jo=to(function(e,t){var n=null==e?0:e.length,r=or(e,t);return qr(e,Ot(t,function(e){return yo(e,n)?+e:e}).sort(ki)),r});function Qo(e){return null==e?e:Cn.call(e)}var ea=Xr(function(e){return ci(mr(e,1,qa,!0))}),ta=Xr(function(e){var t=Xo(e);return qa(t)&&(t=n),ci(mr(e,1,qa,!0),so(t,2))}),na=Xr(function(e){var t=Xo(e);return t="function"==typeof t?t:n,ci(mr(e,1,qa,!0),n,t)});function ra(e){if(!e||!e.length)return[];var t=0;return e=It(e,function(e){if(qa(e))return t=vn(e.length,t),!0}),Gt(t,function(t){return Ot(e,$t(t))})}function ia(e,t){if(!e||!e.length)return[];var r=ra(e);return null==t?r:Ot(r,function(e){return _t(t,n,e)})}var oa=Xr(function(e,t){return qa(e)?ur(e,t):[]}),aa=Xr(function(e){return pi(It(e,qa))}),sa=Xr(function(e){var t=Xo(e);return qa(t)&&(t=n),pi(It(e,qa),so(t,2))}),la=Xr(function(e){var t=Xo(e);return t="function"==typeof t?t:n,pi(It(e,qa),n,t)}),ca=Xr(ra),ua=Xr(function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ia(e,r)});function da(e){var t=zn(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var fa=to(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(t){return or(t,e)};return!(t>1||this.__actions__.length)&&i instanceof $n&&yo(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:n}),new Vn(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e})):this.thru(o)}),pa=Fi(function(e,t,n){Re.call(e,n)?++e[n]:ir(e,n,1)}),ga=Di(Vo),ma=Di($o);function va(e,t){return($a(e)?kt:dr)(e,so(t,3))}function ya(e,t){return($a(e)?At:hr)(e,so(t,3))}var ba=Fi(function(e,t,n){Re.call(e,n)?e[n].push(t):ir(e,n,[t])}),wa=Xr(function(e,t,n){var r=-1,i="function"==typeof t,o=Ha(e)?we(e.length):[];return dr(e,function(e){o[++r]=i?_t(t,e,n):Tr(e,t,n)}),o}),xa=Fi(function(e,t,n){ir(e,n,t)});function Ca(e,t){return($a(e)?Ot:Nr)(e,so(t,3))}var _a=Fi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Sa=Xr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&bo(e,t[0],t[1])?t=[]:n>2&&bo(t[0],t[1],t[2])&&(t=[t[0]]),$r(e,mr(t,1),[])}),ka=ut||function(){return dt.Date.now()};function Aa(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Ki(e,s,n,n,n,n,t)}function Ea(e,t){var i;if("function"!=typeof t)throw new Ie(r);return e=fs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Ia=Xr(function(e,t,n){var r=1;if(n.length){var i=sn(n,ao(Ia));r|=a}return Ki(e,r,t,n,i)}),Ta=Xr(function(e,t,n){var r=3;if(n.length){var i=sn(n,ao(Ta));r|=a}return Ki(t,r,e,n,i)});function Fa(e,t,i){var o,a,s,l,c,u,d=0,h=!1,f=!1,p=!0;if("function"!=typeof e)throw new Ie(r);function g(t){var r=o,i=a;return o=a=n,d=t,l=e.apply(i,r)}function m(e){var r=e-u;return u===n||r>=t||r<0||f&&e-d>=s}function v(){var e=ka();if(m(e))return y(e);c=Fo(v,function(e){var n=t-(e-u);return f?yn(n,s-(e-d)):n}(e))}function y(e){return c=n,p&&o?g(e):(o=a=n,l)}function b(){var e=ka(),r=m(e);if(o=arguments,a=this,u=e,r){if(c===n)return function(e){return d=e,c=Fo(v,t),h?g(e):l}(u);if(f)return xi(c),c=Fo(v,t),g(u)}return c===n&&(c=Fo(v,t)),l}return t=gs(t)||0,Qa(i)&&(h=!!i.leading,s=(f="maxWait"in i)?vn(gs(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),b.cancel=function(){c!==n&&xi(c),d=0,o=u=a=c=n},b.flush=function(){return c===n?l:y(ka())},b}var Oa=Xr(function(e,t){return cr(e,1,t)}),Pa=Xr(function(e,t,n){return cr(e,gs(t)||0,n)});function Ma(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ie(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Ma.Cache||qn),n}function Ra(e){if("function"!=typeof e)throw new Ie(r);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)}}Ma.Cache=qn;var La=bi(function(e,t){var n=(t=1==t.length&&$a(t[0])?Ot(t[0],Xt(so())):Ot(mr(t,1),Xt(so()))).length;return Xr(function(r){for(var i=-1,o=yn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return _t(e,this,r)})}),ja=Xr(function(e,t){var r=sn(t,ao(ja));return Ki(e,a,n,t,r)}),Da=Xr(function(e,t){var r=sn(t,ao(Da));return Ki(e,64,n,t,r)}),Na=to(function(e,t){return Ki(e,l,n,n,n,t)});function za(e,t){return e===t||e!=e&&t!=t}var Ba=Hi(kr),Ua=Hi(function(e,t){return e>=t}),Va=Fr(function(){return arguments}())?Fr:function(e){return es(e)&&Re.call(e,"callee")&&!Ge.call(e,"callee")},$a=we.isArray,Wa=vt?Xt(vt):function(e){return es(e)&&Sr(e)==F};function Ha(e){return null!=e&&Ja(e.length)&&!Ka(e)}function qa(e){return es(e)&&Ha(e)}var Ga=jt||gl,Ya=yt?Xt(yt):function(e){return es(e)&&Sr(e)==v};function Xa(e){if(!es(e))return!1;var t=Sr(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Ka(e){if(!Qa(e))return!1;var t=Sr(e);return t==b||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==fs(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=bt?Xt(bt):function(e){return es(e)&&po(e)==x};function ns(e){return"number"==typeof e||es(e)&&Sr(e)==C}function rs(e){if(!es(e)||Sr(e)!=_)return!1;var t=He(e);if(null===t)return!0;var n=Re.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Me.call(n)==Ne}var is=wt?Xt(wt):function(e){return es(e)&&Sr(e)==k},os=xt?Xt(xt):function(e){return es(e)&&po(e)==A};function as(e){return"string"==typeof e||!$a(e)&&es(e)&&Sr(e)==E}function ss(e){return"symbol"==typeof e||es(e)&&Sr(e)==I}var ls=Ct?Xt(Ct):function(e){return es(e)&&Ja(e.length)&&!!it[Sr(e)]},cs=Hi(Dr),us=Hi(function(e,t){return e<=t});function ds(e){if(!e)return[];if(Ha(e))return as(e)?dn(e):Ii(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());var t=po(e);return(t==x?on:t==A?ln:zs)(e)}function hs(e){return e?(e=gs(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function fs(e){var t=hs(e),n=t%1;return t==t?n?t-n:t:0}function ps(e){return e?ar(fs(e),0,h):0}function gs(e){if("number"==typeof e)return e;if(ss(e))return d;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var n=fe.test(e);return n||ge.test(e)?lt(e.slice(2),n?2:8):he.test(e)?d:+e}function ms(e){return Ti(e,Os(e))}function vs(e){return null==e?"":li(e)}var ys=Oi(function(e,t){if(_o(t)||Ha(t))Ti(t,Fs(t),e);else for(var n in t)Re.call(t,n)&&er(e,n,t[n])}),bs=Oi(function(e,t){Ti(t,Os(t),e)}),ws=Oi(function(e,t,n,r){Ti(t,Os(t),e,r)}),xs=Oi(function(e,t,n,r){Ti(t,Fs(t),e,r)}),Cs=to(or),_s=Xr(function(e,t){e=ke(e);var r=-1,i=t.length,o=i>2?t[2]:n;for(o&&bo(t[0],t[1],o)&&(i=1);++r<i;)for(var a=t[r],s=Os(a),l=-1,c=s.length;++l<c;){var u=s[l],d=e[u];(d===n||za(d,Oe[u])&&!Re.call(e,u))&&(e[u]=a[u])}return e}),Ss=Xr(function(e){return e.push(n,Ji),_t(Ms,n,e)});function ks(e,t,r){var i=null==e?n:Cr(e,t);return i===n?r:i}function As(e,t){return null!=e&&go(e,t,Er)}var Es=Bi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=n},Qs(nl)),Is=Bi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),Re.call(e,t)?e[t].push(n):e[t]=[n]},so),Ts=Xr(Tr);function Fs(e){return Ha(e)?Xn(e):Lr(e)}function Os(e){return Ha(e)?Xn(e,!0):jr(e)}var Ps=Oi(function(e,t,n){Ur(e,t,n)}),Ms=Oi(function(e,t,n,r){Ur(e,t,n,r)}),Rs=to(function(e,t){var n={};if(null==e)return n;var r=!1;t=Ot(t,function(t){return t=yi(t,e),r||(r=t.length>1),t}),Ti(e,ro(e),n),r&&(n=sr(n,7,Qi));for(var i=t.length;i--;)ui(n,t[i]);return n}),Ls=to(function(e,t){return null==e?{}:function(e,t){return Wr(e,t,function(t,n){return As(e,n)})}(e,t)});function js(e,t){if(null==e)return{};var n=Ot(ro(e),function(e){return[e]});return t=so(t),Wr(e,n,function(e,n){return t(e,n[0])})}var Ds=Xi(Fs),Ns=Xi(Os);function zs(e){return null==e?[]:Kt(e,Fs(e))}var Bs=Li(function(e,t,n){return t=t.toLowerCase(),e+(n?Us(t):t)});function Us(e){return Xs(vs(e).toLowerCase())}function Vs(e){return(e=vs(e))&&e.replace(ve,en).replace(Ze,"")}var $s=Li(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Ws=Li(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Hs=Ri("toLowerCase"),qs=Li(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Gs=Li(function(e,t,n){return e+(n?" ":"")+Xs(t)}),Ys=Li(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Xs=Ri("toUpperCase");function Ks(e,t,r){return e=vs(e),(t=r?n:t)===n?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zs=Xr(function(e,t){try{return _t(e,n,t)}catch(e){return Xa(e)?e:new Ce(e)}}),Js=to(function(e,t){return kt(t,function(t){t=jo(t),ir(e,t,Ia(e[t],e))}),e});function Qs(e){return function(){return e}}var el=Ni(),tl=Ni(!0);function nl(e){return e}function rl(e){return Rr("function"==typeof e?e:sr(e,1))}var il=Xr(function(e,t){return function(n){return Tr(n,e,t)}}),ol=Xr(function(e,t){return function(n){return Tr(e,n,t)}});function al(e,t,n){var r=Fs(t),i=xr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=xr(t,Fs(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ka(e);return kt(i,function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ii(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Pt([this.value()],arguments))})}),e}function sl(){}var ll=Vi(Ot),cl=Vi(Et),ul=Vi(Lt);function dl(e){return wo(e)?$t(jo(e)):function(e){return function(t){return Cr(t,e)}}(e)}var hl=Wi(),fl=Wi(!0);function pl(){return[]}function gl(){return!1}var ml,vl=Ui(function(e,t){return e+t},0),yl=Gi("ceil"),bl=Ui(function(e,t){return e/t},1),wl=Gi("floor"),xl=Ui(function(e,t){return e*t},1),Cl=Gi("round"),_l=Ui(function(e,t){return e-t},0);return zn.after=function(e,t){if("function"!=typeof t)throw new Ie(r);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},zn.ary=Aa,zn.assign=ys,zn.assignIn=bs,zn.assignInWith=ws,zn.assignWith=xs,zn.at=Cs,zn.before=Ea,zn.bind=Ia,zn.bindAll=Js,zn.bindKey=Ta,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return $a(e)?e:[e]},zn.chain=da,zn.chunk=function(e,t,r){t=(r?bo(e,t,r):t===n)?1:vn(fs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=we(ft(i/t));o<i;)s[a++]=ni(e,o,o+=t);return s},zn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},zn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=we(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Pt($a(n)?Ii(n):[n],mr(t,1))},zn.cond=function(e){var t=null==e?0:e.length,n=so();return e=t?Ot(e,function(e){if("function"!=typeof e[1])throw new Ie(r);return[n(e[0]),e[1]]}):[],Xr(function(n){for(var r=-1;++r<t;){var i=e[r];if(_t(i[0],this,n))return _t(i[1],this,n)}})},zn.conforms=function(e){return function(e){var t=Fs(e);return function(n){return lr(n,e,t)}}(sr(e,1))},zn.constant=Qs,zn.countBy=pa,zn.create=function(e,t){var n=Bn(e);return null==t?n:rr(n,t)},zn.curry=function e(t,r,i){var o=Ki(t,8,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},zn.curryRight=function e(t,r,i){var o=Ki(t,16,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},zn.debounce=Fa,zn.defaults=_s,zn.defaultsDeep=Ss,zn.defer=Oa,zn.delay=Pa,zn.difference=zo,zn.differenceBy=Bo,zn.differenceWith=Uo,zn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ni(e,(t=r||t===n?1:fs(t))<0?0:t,i):[]},zn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ni(e,0,(t=i-(t=r||t===n?1:fs(t)))<0?0:t):[]},zn.dropRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!0,!0):[]},zn.dropWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!0):[]},zn.fill=function(e,t,r,i){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&bo(e,t,r)&&(r=0,i=o),function(e,t,r,i){var o=e.length;for((r=fs(r))<0&&(r=-r>o?0:o+r),(i=i===n||i>o?o:fs(i))<0&&(i+=o),i=r>i?0:ps(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},zn.filter=function(e,t){return($a(e)?It:gr)(e,so(t,3))},zn.flatMap=function(e,t){return mr(Ca(e,t),1)},zn.flatMapDeep=function(e,t){return mr(Ca(e,t),c)},zn.flatMapDepth=function(e,t,r){return r=r===n?1:fs(r),mr(Ca(e,t),r)},zn.flatten=Wo,zn.flattenDeep=function(e){return null!=e&&e.length?mr(e,c):[]},zn.flattenDepth=function(e,t){return null!=e&&e.length?mr(e,t=t===n?1:fs(t)):[]},zn.flip=function(e){return Ki(e,512)},zn.flow=el,zn.flowRight=tl,zn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},zn.functions=function(e){return null==e?[]:xr(e,Fs(e))},zn.functionsIn=function(e){return null==e?[]:xr(e,Os(e))},zn.groupBy=ba,zn.initial=function(e){return null!=e&&e.length?ni(e,0,-1):[]},zn.intersection=qo,zn.intersectionBy=Go,zn.intersectionWith=Yo,zn.invert=Es,zn.invertBy=Is,zn.invokeMap=wa,zn.iteratee=rl,zn.keyBy=xa,zn.keys=Fs,zn.keysIn=Os,zn.map=Ca,zn.mapKeys=function(e,t){var n={};return t=so(t,3),br(e,function(e,r,i){ir(n,t(e,r,i),e)}),n},zn.mapValues=function(e,t){var n={};return t=so(t,3),br(e,function(e,r,i){ir(n,r,t(e,r,i))}),n},zn.matches=function(e){return zr(sr(e,1))},zn.matchesProperty=function(e,t){return Br(e,sr(t,1))},zn.memoize=Ma,zn.merge=Ps,zn.mergeWith=Ms,zn.method=il,zn.methodOf=ol,zn.mixin=al,zn.negate=Ra,zn.nthArg=function(e){return e=fs(e),Xr(function(t){return Vr(t,e)})},zn.omit=Rs,zn.omitBy=function(e,t){return js(e,Ra(so(t)))},zn.once=function(e){return Ea(2,e)},zn.orderBy=function(e,t,r,i){return null==e?[]:($a(t)||(t=null==t?[]:[t]),$a(r=i?n:r)||(r=null==r?[]:[r]),$r(e,t,r))},zn.over=ll,zn.overArgs=La,zn.overEvery=cl,zn.overSome=ul,zn.partial=ja,zn.partialRight=Da,zn.partition=_a,zn.pick=Ls,zn.pickBy=js,zn.property=dl,zn.propertyOf=function(e){return function(t){return null==e?n:Cr(e,t)}},zn.pull=Ko,zn.pullAll=Zo,zn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Hr(e,t,so(n,2)):e},zn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Hr(e,t,n,r):e},zn.pullAt=Jo,zn.range=hl,zn.rangeRight=fl,zn.rearg=Na,zn.reject=function(e,t){return($a(e)?It:gr)(e,Ra(so(t,3)))},zn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=so(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return qr(e,i),n},zn.rest=function(e,t){if("function"!=typeof e)throw new Ie(r);return Xr(e,t=t===n?t:fs(t))},zn.reverse=Qo,zn.sampleSize=function(e,t,r){return t=(r?bo(e,t,r):t===n)?1:fs(t),($a(e)?Zn:Zr)(e,t)},zn.set=function(e,t,n){return null==e?e:Jr(e,t,n)},zn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Jr(e,t,r,i)},zn.shuffle=function(e){return($a(e)?Jn:ti)(e)},zn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&bo(e,t,r)?(t=0,r=i):(t=null==t?0:fs(t),r=r===n?i:fs(r)),ni(e,t,r)):[]},zn.sortBy=Sa,zn.sortedUniq=function(e){return e&&e.length?ai(e):[]},zn.sortedUniqBy=function(e,t){return e&&e.length?ai(e,so(t,2)):[]},zn.split=function(e,t,r){return r&&"number"!=typeof r&&bo(e,t,r)&&(t=r=n),(r=r===n?h:r>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=li(t))&&rn(e)?wi(dn(e),0,r):e.split(t,r):[]},zn.spread=function(e,t){if("function"!=typeof e)throw new Ie(r);return t=null==t?0:vn(fs(t),0),Xr(function(n){var r=n[t],i=wi(n,0,t);return r&&Pt(i,r),_t(e,this,i)})},zn.tail=function(e){var t=null==e?0:e.length;return t?ni(e,1,t):[]},zn.take=function(e,t,r){return e&&e.length?ni(e,0,(t=r||t===n?1:fs(t))<0?0:t):[]},zn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ni(e,(t=i-(t=r||t===n?1:fs(t)))<0?0:t,i):[]},zn.takeRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?hi(e,so(t,3)):[]},zn.tap=function(e,t){return t(e),e},zn.throttle=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new Ie(r);return Qa(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Fa(e,t,{leading:i,maxWait:t,trailing:o})},zn.thru=ha,zn.toArray=ds,zn.toPairs=Ds,zn.toPairsIn=Ns,zn.toPath=function(e){return $a(e)?Ot(e,jo):ss(e)?[e]:Ii(Lo(vs(e)))},zn.toPlainObject=ms,zn.transform=function(e,t,n){var r=$a(e),i=r||Ga(e)||ls(e);if(t=so(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ka(o)?Bn(He(e)):{}}return(i?kt:br)(e,function(e,r,i){return t(n,e,r,i)}),n},zn.unary=function(e){return Aa(e,1)},zn.union=ea,zn.unionBy=ta,zn.unionWith=na,zn.uniq=function(e){return e&&e.length?ci(e):[]},zn.uniqBy=function(e,t){return e&&e.length?ci(e,so(t,2)):[]},zn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?ci(e,n,t):[]},zn.unset=function(e,t){return null==e||ui(e,t)},zn.unzip=ra,zn.unzipWith=ia,zn.update=function(e,t,n){return null==e?e:di(e,t,vi(n))},zn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:di(e,t,vi(r),i)},zn.values=zs,zn.valuesIn=function(e){return null==e?[]:Kt(e,Os(e))},zn.without=oa,zn.words=Ks,zn.wrap=function(e,t){return ja(vi(t),e)},zn.xor=aa,zn.xorBy=sa,zn.xorWith=la,zn.zip=ca,zn.zipObject=function(e,t){return gi(e||[],t||[],er)},zn.zipObjectDeep=function(e,t){return gi(e||[],t||[],Jr)},zn.zipWith=ua,zn.entries=Ds,zn.entriesIn=Ns,zn.extend=bs,zn.extendWith=ws,al(zn,zn),zn.add=vl,zn.attempt=Zs,zn.camelCase=Bs,zn.capitalize=Us,zn.ceil=yl,zn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=gs(r))==r?r:0),t!==n&&(t=(t=gs(t))==t?t:0),ar(gs(e),t,r)},zn.clone=function(e){return sr(e,4)},zn.cloneDeep=function(e){return sr(e,5)},zn.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:n)},zn.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:n)},zn.conformsTo=function(e,t){return null==t||lr(e,t,Fs(t))},zn.deburr=Vs,zn.defaultTo=function(e,t){return null==e||e!=e?t:e},zn.divide=bl,zn.endsWith=function(e,t,r){e=vs(e),t=li(t);var i=e.length,o=r=r===n?i:ar(fs(r),0,i);return(r-=t.length)>=0&&e.slice(r,o)==t},zn.eq=za,zn.escape=function(e){return(e=vs(e))&&G.test(e)?e.replace(H,tn):e},zn.escapeRegExp=function(e){return(e=vs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},zn.every=function(e,t,r){var i=$a(e)?Et:fr;return r&&bo(e,t,r)&&(t=n),i(e,so(t,3))},zn.find=ga,zn.findIndex=Vo,zn.findKey=function(e,t){return Dt(e,so(t,3),br)},zn.findLast=ma,zn.findLastIndex=$o,zn.findLastKey=function(e,t){return Dt(e,so(t,3),wr)},zn.floor=wl,zn.forEach=va,zn.forEachRight=ya,zn.forIn=function(e,t){return null==e?e:vr(e,so(t,3),Os)},zn.forInRight=function(e,t){return null==e?e:yr(e,so(t,3),Os)},zn.forOwn=function(e,t){return e&&br(e,so(t,3))},zn.forOwnRight=function(e,t){return e&&wr(e,so(t,3))},zn.get=ks,zn.gt=Ba,zn.gte=Ua,zn.has=function(e,t){return null!=e&&go(e,t,Ar)},zn.hasIn=As,zn.head=Ho,zn.identity=nl,zn.includes=function(e,t,n,r){e=Ha(e)?e:zs(e),n=n&&!r?fs(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},zn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fs(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},zn.inRange=function(e,t,r){return t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n){return e>=yn(t,n)&&e<vn(t,n)}(e=gs(e),t,r)},zn.invoke=Ts,zn.isArguments=Va,zn.isArray=$a,zn.isArrayBuffer=Wa,zn.isArrayLike=Ha,zn.isArrayLikeObject=qa,zn.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sr(e)==m},zn.isBuffer=Ga,zn.isDate=Ya,zn.isElement=function(e){return es(e)&&1===e.nodeType&&!rs(e)},zn.isEmpty=function(e){if(null==e)return!0;if(Ha(e)&&($a(e)||"string"==typeof e||"function"==typeof e.splice||Ga(e)||ls(e)||Va(e)))return!e.length;var t=po(e);if(t==x||t==A)return!e.size;if(_o(e))return!Lr(e).length;for(var n in e)if(Re.call(e,n))return!1;return!0},zn.isEqual=function(e,t){return Or(e,t)},zn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?Or(e,t,n,r):!!i},zn.isError=Xa,zn.isFinite=function(e){return"number"==typeof e&&Wt(e)},zn.isFunction=Ka,zn.isInteger=Za,zn.isLength=Ja,zn.isMap=ts,zn.isMatch=function(e,t){return e===t||Pr(e,t,co(t))},zn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Pr(e,t,co(t),r)},zn.isNaN=function(e){return ns(e)&&e!=+e},zn.isNative=function(e){if(Co(e))throw new Ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(e)},zn.isNil=function(e){return null==e},zn.isNull=function(e){return null===e},zn.isNumber=ns,zn.isObject=Qa,zn.isObjectLike=es,zn.isPlainObject=rs,zn.isRegExp=is,zn.isSafeInteger=function(e){return Za(e)&&e>=-9007199254740991&&e<=u},zn.isSet=os,zn.isString=as,zn.isSymbol=ss,zn.isTypedArray=ls,zn.isUndefined=function(e){return e===n},zn.isWeakMap=function(e){return es(e)&&po(e)==T},zn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Sr(e)},zn.join=function(e,t){return null==e?"":gn.call(e,t)},zn.kebabCase=$s,zn.last=Xo,zn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=fs(r))<0?vn(i+o,0):yn(o,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Nt(e,Ut,o,!0)},zn.lowerCase=Ws,zn.lowerFirst=Hs,zn.lt=cs,zn.lte=us,zn.max=function(e){return e&&e.length?pr(e,nl,kr):n},zn.maxBy=function(e,t){return e&&e.length?pr(e,so(t,2),kr):n},zn.mean=function(e){return Vt(e,nl)},zn.meanBy=function(e,t){return Vt(e,so(t,2))},zn.min=function(e){return e&&e.length?pr(e,nl,Dr):n},zn.minBy=function(e,t){return e&&e.length?pr(e,so(t,2),Dr):n},zn.stubArray=pl,zn.stubFalse=gl,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=xl,zn.nth=function(e,t){return e&&e.length?Vr(e,fs(t)):n},zn.noConflict=function(){return dt._===this&&(dt._=ze),this},zn.noop=sl,zn.now=ka,zn.pad=function(e,t,n){e=vs(e);var r=(t=fs(t))?un(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return $i(gt(i),n)+e+$i(ft(i),n)},zn.padEnd=function(e,t,n){e=vs(e);var r=(t=fs(t))?un(e):0;return t&&r<t?e+$i(t-r,n):e},zn.padStart=function(e,t,n){e=vs(e);var r=(t=fs(t))?un(e):0;return t&&r<t?$i(t-r,n)+e:e},zn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),wn(vs(e).replace(ne,""),t||0)},zn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&bo(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=hs(e),t===n?(t=e,e=0):t=hs(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var o=xn();return yn(e+o*(t-e+st("1e-"+((o+"").length-1))),t)}return Gr(e,t)},zn.reduce=function(e,t,n){var r=$a(e)?Mt:Ht,i=arguments.length<3;return r(e,so(t,4),n,i,dr)},zn.reduceRight=function(e,t,n){var r=$a(e)?Rt:Ht,i=arguments.length<3;return r(e,so(t,4),n,i,hr)},zn.repeat=function(e,t,r){return t=(r?bo(e,t,r):t===n)?1:fs(t),Yr(vs(e),t)},zn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zn.result=function(e,t,r){var i=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=n);++i<o;){var a=null==e?n:e[jo(t[i])];a===n&&(i=o,a=r),e=Ka(a)?a.call(e):a}return e},zn.round=Cl,zn.runInContext=e,zn.sample=function(e){return($a(e)?Kn:Kr)(e)},zn.size=function(e){if(null==e)return 0;if(Ha(e))return as(e)?un(e):e.length;var t=po(e);return t==x||t==A?e.size:Lr(e).length},zn.snakeCase=qs,zn.some=function(e,t,r){var i=$a(e)?Lt:ri;return r&&bo(e,t,r)&&(t=n),i(e,so(t,3))},zn.sortedIndex=function(e,t){return ii(e,t)},zn.sortedIndexBy=function(e,t,n){return oi(e,t,so(n,2))},zn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ii(e,t);if(r<n&&za(e[r],t))return r}return-1},zn.sortedLastIndex=function(e,t){return ii(e,t,!0)},zn.sortedLastIndexBy=function(e,t,n){return oi(e,t,so(n,2),!0)},zn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ii(e,t,!0)-1;if(za(e[n],t))return n}return-1},zn.startCase=Gs,zn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:ar(fs(n),0,e.length),t=li(t),e.slice(n,n+t.length)==t},zn.subtract=_l,zn.sum=function(e){return e&&e.length?qt(e,nl):0},zn.sumBy=function(e,t){return e&&e.length?qt(e,so(t,2)):0},zn.template=function(e,t,r){var i=zn.templateSettings;r&&bo(e,t,r)&&(t=n),e=vs(e),t=ws({},t,i,Zi);var o,a,s=ws({},t.imports,i.imports,Zi),l=Fs(s),c=Kt(s,l),u=0,d=t.interpolate||ye,h="__p += '",f=Ae((t.escape||ye).source+"|"+d.source+"|"+(d===K?ue:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),p="//# sourceURL="+(Re.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++rt+"]")+"\n";e.replace(f,function(t,n,r,i,s,l){return r||(r=i),h+=e.slice(u,l).replace(be,nn),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+t.length,t}),h+="';\n";var g=Re.call(t,"variable")&&t.variable;if(g){if(le.test(g))throw new Ce("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(U,""):h).replace(V,"$1").replace($,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var m=Zs(function(){return _e(l,p+"return "+h).apply(n,c)});if(m.source=h,Xa(m))throw m;return m},zn.times=function(e,t){if((e=fs(e))<1||e>u)return[];var n=h,r=yn(e,h);t=so(t),e-=h;for(var i=Gt(r,t);++n<e;)t(n);return i},zn.toFinite=hs,zn.toInteger=fs,zn.toLength=ps,zn.toLower=function(e){return vs(e).toLowerCase()},zn.toNumber=gs,zn.toSafeInteger=function(e){return e?ar(fs(e),-9007199254740991,u):0===e?e:0},zn.toString=vs,zn.toUpper=function(e){return vs(e).toUpperCase()},zn.trim=function(e,t,r){if((e=vs(e))&&(r||t===n))return Yt(e);if(!e||!(t=li(t)))return e;var i=dn(e),o=dn(t);return wi(i,Jt(i,o),Qt(i,o)+1).join("")},zn.trimEnd=function(e,t,r){if((e=vs(e))&&(r||t===n))return e.slice(0,hn(e)+1);if(!e||!(t=li(t)))return e;var i=dn(e);return wi(i,0,Qt(i,dn(t))+1).join("")},zn.trimStart=function(e,t,r){if((e=vs(e))&&(r||t===n))return e.replace(ne,"");if(!e||!(t=li(t)))return e;var i=dn(e);return wi(i,Jt(i,dn(t))).join("")},zn.truncate=function(e,t){var r=30,i="...";if(Qa(t)){var o="separator"in t?t.separator:o;r="length"in t?fs(t.length):r,i="omission"in t?li(t.omission):i}var a=(e=vs(e)).length;if(rn(e)){var s=dn(e);a=s.length}if(r>=a)return e;var l=r-un(i);if(l<1)return i;var c=s?wi(s,0,l).join(""):e.slice(0,l);if(o===n)return c+i;if(s&&(l+=c.length-l),is(o)){if(e.slice(l).search(o)){var u,d=c;for(o.global||(o=Ae(o.source,vs(de.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var h=u.index;c=c.slice(0,h===n?l:h)}}else if(e.indexOf(li(o),l)!=l){var f=c.lastIndexOf(o);f>-1&&(c=c.slice(0,f))}return c+i},zn.unescape=function(e){return(e=vs(e))&&q.test(e)?e.replace(W,fn):e},zn.uniqueId=function(e){var t=++Le;return vs(e)+t},zn.upperCase=Ys,zn.upperFirst=Xs,zn.each=va,zn.eachRight=ya,zn.first=Ho,al(zn,(ml={},br(zn,function(e,t){Re.call(zn.prototype,t)||(ml[t]=e)}),ml),{chain:!1}),zn.VERSION="4.17.21",kt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){zn[e].placeholder=zn}),kt(["drop","take"],function(e,t){$n.prototype[e]=function(r){r=r===n?1:vn(fs(r),0);var i=this.__filtered__&&!t?new $n(this):this.clone();return i.__filtered__?i.__takeCount__=yn(r,i.__takeCount__):i.__views__.push({size:yn(r,h),type:e+(i.__dir__<0?"Right":"")}),i},$n.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),kt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;$n.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:so(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),kt(["head","last"],function(e,t){var n="take"+(t?"Right":"");$n.prototype[e]=function(){return this[n](1).value()[0]}}),kt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");$n.prototype[e]=function(){return this.__filtered__?new $n(this):this[n](1)}}),$n.prototype.compact=function(){return this.filter(nl)},$n.prototype.find=function(e){return this.filter(e).head()},$n.prototype.findLast=function(e){return this.reverse().find(e)},$n.prototype.invokeMap=Xr(function(e,t){return"function"==typeof e?new $n(this):this.map(function(n){return Tr(n,e,t)})}),$n.prototype.reject=function(e){return this.filter(Ra(so(e)))},$n.prototype.slice=function(e,t){e=fs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new $n(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=fs(t))<0?r.dropRight(-t):r.take(t-e)),r)},$n.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},$n.prototype.toArray=function(){return this.take(h)},br($n.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=zn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(zn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,l=t instanceof $n,c=s[0],u=l||$a(t),d=function(e){var t=o.apply(zn,Pt([e],s));return i&&h?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,f=!!this.__actions__.length,p=a&&!h,g=l&&!f;if(!a&&u){t=g?t:new $n(this);var m=e.apply(t,s);return m.__actions__.push({func:ha,args:[d],thisArg:n}),new Vn(m,h)}return p&&g?e.apply(this,s):(m=this.thru(d),p?i?m.value()[0]:m.value():m)})}),kt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);zn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply($a(i)?i:[],e)}return this[n](function(n){return t.apply($a(n)?n:[],e)})}}),br($n.prototype,function(e,t){var n=zn[t];if(n){var r=n.name+"";Re.call(Fn,r)||(Fn[r]=[]),Fn[r].push({name:t,func:n})}}),Fn[zi(n,2).name]=[{name:"wrapper",func:n}],$n.prototype.clone=function(){var e=new $n(this.__wrapped__);return e.__actions__=Ii(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ii(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ii(this.__views__),e},$n.prototype.reverse=function(){if(this.__filtered__){var e=new $n(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},$n.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=$a(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=yn(t,e+a);break;case"takeRight":e=vn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,c=r?s:a-1,u=this.__iteratees__,d=u.length,h=0,f=yn(l,this.__takeCount__);if(!n||!r&&i==l&&f==l)return fi(e,this.__actions__);var p=[];e:for(;l--&&h<f;){for(var g=-1,m=e[c+=t];++g<d;){var v=u[g],y=v.iteratee,b=v.type,w=y(m);if(2==b)m=w;else if(!w){if(1==b)continue e;break e}}p[h++]=m}return p},zn.prototype.at=fa,zn.prototype.chain=function(){return da(this)},zn.prototype.commit=function(){return new Vn(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===n&&(this.__values__=ds(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},zn.prototype.plant=function(e){for(var t,r=this;r instanceof Un;){var i=No(r);i.__index__=0,i.__values__=n,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t},zn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof $n){var t=e;return this.__actions__.length&&(t=new $n(this)),(t=t.reverse()).__actions__.push({func:ha,args:[Qo],thisArg:n}),new Vn(t,this.__chain__)}return this.thru(Qo)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,Je&&(zn.prototype[Je]=function(){return this}),zn}();ft?((ft.exports=pn)._=pn,ht._=pn):dt._=pn}).call(gi)}(pi,pi.exports)),pi.exports);const vi=s({state:{},actions:{},options:{}}),yi=()=>l(vi),bi=({children:t,options:n})=>{var r;const[s,l]=o([]),[u,d]=o([]),[h,f]=o(null),[p,g]=o(n.searchQuery||""),[m,v]=o(n.sortBySize||"name"),{config:y}=n,[b,w]=o("date"),[x,C]=o("desc"),[_,S]=o([{id:"folders",name:"Папки"}]),[k,A]=o(new Set),[E,I]=o("");i.useEffect(()=>{A(new Set)},[]);const F=i.useRef(null);i.useEffect(()=>{if(n.onChangeSelection&&F.current!==k){if(null!==F.current){const e=(Array.isArray(u)?u:[]).filter(e=>k.has(e.id));n.onChangeSelection(e)}F.current=k}},[u,k,n.onChangeSelection,n]);const[O,P]=o(!1),[M,R]=o(Qt);a(()=>{(null==y?void 0:y.activeLibraryItem)&&R&&R(null==y?void 0:y.activeLibraryItem)},[null==y?void 0:y.activeLibraryItem,R]);const[L,j]=o({current:1,pageSize:12,total:0}),[D]=T.useForm(),[N]=T.useForm(),[z]=T.useForm(),[B]=T.useForm(),[U]=T.useForm(),[V]=T.useForm(),[$,W]=o(!1),[H,q]=o(!1),[G,Y]=o(!1),[X,K]=o(!1),[Z,J]=o(!1),[Q,ee]=o(!1),[te,ne]=o(!1),[re,ie]=o(null),[oe,ae]=o(null),[se,le]=o(null),ce=c(e=>{j(t=>Object.assign(Object.assign({},t),e))},[j]),ue=c(e=>{A(null!=e?e:new Set)},[A]);a(()=>{ue()},[M,ue]);const de={folders:s,files:u,selectedFolder:h,searchTerm:p,sortField:m,sortBy:b,sortOrder:x,pathHistory:_,selectedFiles:k,currentMenuFile:E,loading:O,pagination:L,isModalVisible:$,isUrlModalVisible:H,isRenameModalVisible:G,isMoveModalVisible:X,isRenameFolderModalVisible:Z,isCopyModalVisible:Q,isDeleteConfirmVisible:te,form:D,urlForm:N,renameForm:z,moveForm:B,renameFolderForm:U,copyForm:V,fileToRename:re,folderToRename:oe,activeLibraryItem:M,multiSelect:null===(r=null==y?void 0:y.multiSelect)||void 0===r||r,undoDeletion:se},he={setFolders:l,setFiles:d,setSelectedFolder:f,setSearchTerm:g,setSortField:v,setSortBy:w,setSortOrder:C,setPathHistory:S,setSelectedFiles:ue,setLoading:P,setPagination:ce,setIsModalVisible:W,setIsUrlModalVisible:q,setIsRenameModalVisible:Y,setIsMoveModalVisible:K,setIsRenameFolderModalVisible:J,setIsCopyModalVisible:ee,setIsDeleteConfirmVisible:ne,setFileToRename:ie,setFolderToRename:ae,setUndoDeletion:le,updatePathHistoryOnFolderRename:(e,t)=>{S(n=>n.map(n=>n.id===e?Object.assign(Object.assign({},n),{name:t}):n))},setActiveLibraryItem:R,setCurrentMenuFile:I},fe={state:de,actions:he,options:n};return e(vi.Provider,{value:fe,children:t})},wi=e=>null===e.parentId||"null"===e.parentId||!e.parentId,xi=async(e,t,n)=>{var r;if(console.log("📁 addSubfoldersToFiles: params:",JSON.stringify(t,null,2)),"file"===(null==t?void 0:t.itemType))return e;let i=[];if(!n)return console.warn("🔍 getFolders не доступен!"),e;{const e=await n({parentId:t.folderId});i=Array.isArray(e)?e:[],console.log("📁 Получено папок от dataProvider:",i.length,"тип данных:",typeof e,"данные:",e)}let o=((e,t)=>{const n=Array.isArray(e)?e:[];return(r=t.folderId)&&"root"!==r&&"folders"!==r&&"null"!==r&&null!==r?n.filter(e=>e.parentId===t.folderId):n.filter(wi);var r})(i,t);if(null===(r=null==t?void 0:t.search)||void 0===r?void 0:r.trim()){const e=t.search.trim().toLowerCase();o=o.filter(t=>{var n;return null===(n=t.name)||void 0===n?void 0:n.toLowerCase().includes(e)})}if(console.log("📁 Найдено подпапок для добавления:",o.length),0===o.length)return e;const a=o.map(e=>({id:e.id,name:e.name,size:void 0,date:"-",isFolder:!0,folderId:e.parentId||"",type:"",selected:!1,extension:""}));if("folder"===(null==t?void 0:t.itemType))return a;const s=[...a,...e];return console.log("📁 РЕЗУЛЬТАТ: папок:",a.length,"файлов:",e.length,"всего:",s.length),s},Ci=e=>{var t,n,r,i;const{state:o,actions:s,options:l}=yi(),{searchTerm:d,sortBy:h,sortOrder:f,selectedFolder:p,pagination:g}=o,{setSearchTerm:m,setSortBy:v,setSortOrder:y,setPagination:b}=s,w=e||s.fetchFiles,x=u(null),C=u(mi.debounce(e=>{const t=JSON.stringify(e);x.current!==t?(x.current=t,console.log("✅ Выполняется запрос:",e),null==w||w(e)):console.log("🚫 Дублированный запрос пропущен:",e)},150)).current,_=c(()=>{var e;const t=null===(e=null==l?void 0:l.config)||void 0===e?void 0:e.disablePagination;return{folderId:p||"",search:(null==d?void 0:d.trim())||void 0,page:t?void 0:g.current,limit:t?void 0:g.pageSize,sortBy:h,sortOrder:f,itemType:"all"}},[p,d,g.current,g.pageSize,h,f,null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.disablePagination]),S=c(e=>{var t,n;if(console.log("🔎 useSortAndFilter: handleSearch вызван с:",e),m&&(console.log("🔎 useSortAndFilter: Обновляем searchTerm в стейте"),m(e)),b&&(console.log("🔎 useSortAndFilter: Сбрасываем пагинацию"),b({current:1,pageSize:g.pageSize,total:0})),console.log("🔎 useSortAndFilter: Проверяем fetchFiles:",!!w),w){console.log("🔎 useSortAndFilter: Вызываем fetchFiles с параметрами поиска");const r={folderId:p||"",search:(null==e?void 0:e.trim())||void 0,page:(null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.disablePagination)?void 0:1,limit:(null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination)?void 0:g.pageSize,sortBy:h,sortOrder:f,itemType:"all"};console.log("🔎 useSortAndFilter: Параметры запроса:",r),w(r),console.log("🔎 useSortAndFilter: fetchFiles вызван!")}else console.error("🔎 useSortAndFilter: fetchFiles НЕ ОПРЕДЕЛЕНА!")},[m,b,g.pageSize,w,p,h,f,null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination]),k=c((e,t)=>{var n,r;null==v||v(e),null==y||y(t),w&&C({folderId:p||"",search:(null==d?void 0:d.trim())||void 0,page:(null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination)?void 0:g.current,limit:(null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination)?void 0:g.pageSize,sortBy:e,sortOrder:t,itemType:"all"})},[v,y,C,p,d,g.current,g.pageSize,null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination]),A=c((e,t)=>{var n;(null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination)||(b&&b({current:e,pageSize:t||g.pageSize,total:g.total}),w&&C({folderId:p||"",search:(null==d?void 0:d.trim())||void 0,page:e,limit:t||g.pageSize,sortBy:h,sortOrder:f,itemType:"all"}))},[b,g.pageSize,g.total,C,p,d,h,f,null===(i=null==l?void 0:l.config)||void 0===i?void 0:i.disablePagination]);return a(()=>{if(w){console.log("🔄 useSortAndFilter: изменение selectedFolder, загрузка файлов для папки:",p);const e=_();C(Object.assign(Object.assign({},e),{page:1}))}},[p]),a(()=>{w&&(console.log("🔄 useSortAndFilter: начальная загрузка файлов, selectedFolder:",p),C(_()))},[]),a(()=>()=>{var e;null===(e=C.cancel)||void 0===e||e.call(C)},[C]),{state:{searchTerm:d||"",sortBy:h||"name",sortOrder:f||"asc"},actions:{setSearchTerm:m||(()=>{}),setSortBy:v||(()=>{}),setSortOrder:y||(()=>{}),handleSearch:S,handleSort:k,handlePaginationChange:A,getCurrentQueryParams:_}}},_i=()=>{var e;const{notification:t}=I.useApp(),n=yi(),{options:r}=n,i=c(async e=>{let t;if(r.handleNotify){try{t=await r.handleNotify(e)}catch(e){console.log(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("error"===e.type&&r.handleError){try{t=await r.handleError(e)}catch(e){console.log(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("success"===e.type&&r.handleSuccess){try{t=await r.handleSuccess(e)}catch(e){console.log(e)}if(t)return!1}return t},[r]),o=c(async function(e,n=!1){var o;try{void 0===e.visibility&&(e.visibility=!n);const a=await i(e);"object"==typeof a&&(e=a);if(!(!1!==e.visibility&&!1!==a&&!1!==(null===(o=r.config)||void 0===o?void 0:o.showNotifications)))return e;const s=t[e.type];"function"==typeof s?s(e):console.warn(`Unknown notification type: ${e.type}`,e)}catch(e){console.log(e)}return e},[t,i,null===(e=r.config)||void 0===e?void 0:e.showNotifications]);return d(()=>({error:(e,t=!1)=>o(Object.assign(Object.assign({},e),{type:"error"}),t),success:(e,t=!1)=>o(Object.assign(Object.assign({},e),{type:"success"}),t),warning:(e,t=!1)=>o(Object.assign(Object.assign({},e),{type:"warning"}),t),notify:o}),[o])},Si={FileNotFound:"File not found or no longer available.",FileAlreadyExists:"File with this name already exists.",FileInvalidName:"File name is not valid.",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 to upload.",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.",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.",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:"Request payload is too large.",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."},ki=(e,t)=>{if(!e)return;const n=Si[e];return n?t(n):void 0},Ai=e=>{var t,n,r,i,o,a,s,l;if(!e)return{message:"Unknown error",raw:e};if("string"==typeof e)return{message:e};if(e instanceof Error){const o=e;return{message:null!==(t=o.message)&&void 0!==t?t:e.message,code:o.code,status:null!==(n=o.status)&&void 0!==n?n:o.httpStatus,stack:null!==(r=o.stack)&&void 0!==r?r:e.stack,raw:null!==(i=o.raw)&&void 0!==i?i:e}}if("object"==typeof e){const t=e,n=null!==(a=null!==(o=t.message)&&void 0!==o?o:t.error)&&void 0!==a?a:t.reason,r=null!==(s=t.status)&&void 0!==s?s:t.httpStatus,i=t.code,c=t.stack,u=null!==(l=t.raw)&&void 0!==l?l:e;if(n||i||r||c||u)return{message:n,code:i,status:r,stack:c,raw:u}}return{message:String(e),raw:e}},Ei=()=>{var e,t;const{state:n,actions:i,options:o}=yi(),{t:a}=$n(),s=_i(),{folders:l,selectedFolder:u,pathHistory:d,form:h,loading:f,isModalVisible:p}=n,{setFolders:g,setLoading:m,setIsModalVisible:v}=i,{dataProviders:y,config:b}=o,w=c(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})),[]),x=c(async()=>{console.log("Запрос папок (через getFiles itemType=folder)..."),null==m||m(!0);try{let e=[];const t="lazy"===(null==b?void 0:b.folderTreeLoading);if(!(null==y?void 0:y.getFolders)){if(null==y?void 0:y.getFiles){const e=async n=>{const{files:r}=await y.getFiles({itemType:"folder",folderId:n||void 0}),i=w(r);if(t)return i;const o=await Promise.all(i.map(t=>e(t.id)));return[...i,...o.flat()]},n=await e(null);return void(g&&g(e=>{const r=Array.isArray(e)?e:[];if(!t){const e=n,t=e.filter(e=>e.id===e.parentId);return t.length>0&&console.warn("Обнаружены папки с циклическими зависимостями:",t),console.log("Полученные папки (full replace):",e),e}new Set(n.map(e=>e.id));const i=[...r.filter(e=>e.parentId),...n],o=i.filter(e=>e.id===e.parentId);return o.length>0&&console.warn("Обнаружены папки с циклическими зависимостями:",o),console.log("Полученные папки (lazy merge корня):",i),i}))}return void console.error("DataProvider для папок не определен")}{const n=!t;e=await y.getFolders({parentId:null,deep:n})}console.log("Полученные папки:",e);const n=Array.isArray(e)?e:[];null==g||g(n);const r=n.filter(e=>e.id===e.parentId);r.length>0&&console.warn("Обнаружены папки с циклическими зависимостями:",r)}catch(e){console.error("Ошибка при загрузке папок:",e);const t=Ai(e),n=ki(null==t?void 0:t.code,a);s.error({id:"FOLDERS_FETCH_FAILED",message:null!=n?n:a("Failed to load folders"),placement:"bottomRight",innerException:e,data:{reason:e instanceof Error?e.message:String(e)}})}finally{null==m||m(!1)}},[null==y?void 0:y.getFiles,null==y?void 0:y.getFolders,g,m,null==b?void 0:b.folderTreeLoading,w,s,a]),C=c(async e=>{try{if(null==y?void 0:y.getFolders){const t=await y.getFolders({parentId:e,deep:!1}),n=Array.isArray(l)?l:[],r=new Set(t.map(e=>e.id)),i=n.filter(t=>t.parentId!==e||r.has(t.id)),o=[...i,...t.filter(e=>!i.some(t=>t.id===e.id))];return null==g||g(o),t}if(null==y?void 0:y.getFiles){const{files:t}=await y.getFiles({itemType:"folder",folderId:e||void 0}),n=w(t),r=Array.isArray(l)?l:[],i=new Set(n.map(e=>e.id)),o=r.filter(t=>t.parentId!==e||i.has(t.id)),a=[...o,...n.filter(e=>!o.some(t=>t.id===e.id))];return null==g||g(a),n}return[]}catch(e){return console.error("Ошибка при загрузке дочерних папок:",e),[]}},[y,l,g,w]),_=c(()=>{var e;const t=null!==(e=null==b?void 0:b.defaultFolderName)&&void 0!==e?e:a("Новая папка");h.setFieldsValue({folderName:t}),null==v||v(!0)},[h,v,a,null==b?void 0:b.defaultFolderName]),S=c(async e=>{const t=[...(Array.isArray(l)?l:[]).filter(t=>t.id!==e.id),e];if(null==g||g(t),console.log("📂 Обновлен список папок, новая папка:",e),e.parentId&&(await C(e.parentId),await new Promise(e=>setTimeout(e,50))),i.setSelectedFolder&&(i.setSelectedFolder(e.id),console.log("🎯 Выбрана созданная папка как активная:",e.id)),i.setPathHistory){const n=Array.isArray(t)?t:[],r=(e,t=new Set)=>{if(t.has(e))return console.warn(`Обнаружен цикл в пути к папке с id=${e}`),[];const i=n.find(t=>t.id===e);if(!i)return[];const o=new Set(t);return o.add(e),i.parentId?[...r(i.parentId,o),{id:i.id,name:i.name}]:[{id:i.id,name:i.name}]},o=r(e.id),s=[{id:"folders",name:a("Folders")},...o];i.setPathHistory(s),console.log("🧭 Обновлен путь навигации до созданной папки:",s)}},[l,g,i,n.pathHistory,C,a]),k=c(async e=>{try{if(null==y?void 0:y.getFolders){const t=await y.getFolders(),n=(Array.isArray(t)?t:[]).some(t=>t.id===e);return console.log(n?"✅ Папка найдена:":"❌ Папка не найдена:",e),n}if(null==y?void 0:y.getFiles){const t=new Set,n=async r=>{const{files:i}=await y.getFiles({itemType:"folder",folderId:r||void 0}),o=w(i);for(const r of o){if(t.has(r.id))continue;if(t.add(r.id),r.id===e)return!0;if(await n(r.id))return!0}return!1},r=await n(null);return console.log(r?"✅ Папка найдена:":"❌ Папка не найдена:",e),r}}catch(e){console.warn("⚠️ Ошибка проверки папки:",e)}return!1},[null==y?void 0:y.getFolders,null==y?void 0:y.getFiles,w]),A=c(async e=>{var t;let n,r=null;try{const i=await(e?e.validateFields():h.validateFields());if(console.log("handleModalOk: values",i),n=i.folderName.trim(),console.log("folderName",n),!n){const e=i.targetFolder||(u&&"folders"!==u?u:null);return void s.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:a("Folder name cannot be empty"),placement:"bottomRight",data:{folderName:n,folderId:null!=e?e:null,reason:"emptyName",is_force_create:!!i.is_force_create}})}const o=i.targetFolder;if(o)r="folders"!==o?o:null;else if(u&&"folders"!==u)r=u;else if(Array.isArray(d)&&d.length>1){const e=d[d.length-1];r=(null==e?void 0:e.id)&&"folders"!==e.id?e.id:null}let c;if(console.log("🆕 Создание новой папки:",{folderName:n,parentId:r,selectedFolder:u,pathHistory:d}),!(null==y?void 0:y.createFolder))return void s.error({id:"FOLDER_CREATE_PROVIDER_NOT_CONFIGURED",message:a("Folder creation provider is not configured"),placement:"bottomRight",data:{folderName:n,folderId:null!=r?r:null,is_force_create:!!i.is_force_create}});c=await y.createFolder({name:n,parentId:r,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("Обнаружена циклическая зависимость: папка является родителем сама для себя"),new Error(a("Error: folder cannot be its own parent"))})(c);const f={id:c.id,name:c.name,parentId:null!=r?r:null,childCount:c.childCount},p=[...(Array.isArray(l)?l:[]).filter(e=>e.id!==f.id),f];if(null==g||g(p),s.success({id:"FOLDER_CREATE_SUCCESS",message:a("Folder created"),placement:"bottomRight",data:{itemIds:[f.id],folderId:null!==(t=f.parentId)&&void 0!==t?t:null,folderName:f.name}}),e||null==v||v(!1),(async()=>{try{await S(f),await x(),await new Promise(e=>setTimeout(e,200));await k(c.id)||console.warn("⚠️ Не удалось подтвердить создание папки на сервере, но продолжаем...")}catch(e){console.error("Ошибка при выполнении фоновых операций после создания папки:",e)}})(),e)return c}catch(e){console.error("❌ Ошибка при создании папки:",e);const t=Ai(e),i=ki(null==t?void 0:t.code,a);s.error({id:"FOLDER_CREATE_FAILED",message:null!=i?i:a("Failed to create folder"),placement:"bottomRight",innerException:e,data:{folderName:n,folderId:null!=r?r:null,reason:e instanceof Error?e.message:String(e)}})}},[h,u,y,S,x,k,v,s,a,l,g]),E=c(()=>{null==v||v(!1)},[v]),I=c((e,t=new Set)=>{const n=Array.isArray(l)?l:[];return e.map(e=>{if(t.has(e.id))return console.warn(`Обнаружен цикл в структуре папок с id=${e.id}. Пропускаем обработку дочерних элементов.`),{key:e.id,label:e.name+" "+a("(error)"),icon:r.createElement(ae,{style:{color:"red"}})};const i=new Set(t);i.add(e.id);const o=n.filter(t=>t.parentId===e.id&&t.id!==e.id);return{key:e.id,label:e.name,children:o.length>0?I(o,i):void 0}})},[l]),T=c(()=>{const e=Array.isArray(l)?l:[],t={key:"folders",label:a("Folders"),children:[]},n=e.filter(e=>null===e.parentId||!e.parentId);return t.children=I(n),[t]},[l,a,I]),F=c(async(e,t)=>{var n,r,c,u;console.log("renameFolder");try{const d=t.trim(),h=null==l?void 0:l.find(t=>t.id===e);if(!d)return void s.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:a("Folder name cannot be empty"),placement:"bottomRight",data:{folderId:e,folderName:t,reason:"emptyName"}});if(!(!1!==(null===(n=null==b?void 0:b.features)||void 0===n?void 0:n.enableRenameFolder)))return void s.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:d}});if(!(null===(c=o.dataProviders)||void 0===c?void 0:c.renameFolder))return void s.error({id:"FOLDER_RENAME_FAILED",message:a("Folder rename provider is not configured"),placement:"bottomRight",data:{itemId:e,itemName:d,error:{message:"providerNotConfigured"}}});const f=await o.dataProviders.renameFolder(e,d);if(!(null==f?void 0:f.id))return void s.error({id:"FOLDER_RENAME_FAILED",message:a("Unexpected response when renaming folder"),placement:"bottomRight",data:{itemId:e,itemName:d,error:{message:"invalidResponse"}}});await x(),e!==f.id&&i.setSelectedFolder&&i.setSelectedFolder(f.id),s.success({id:"FOLDER_RENAME_SUCCESS",message:a("Folder renamed"),placement:"bottomRight",data:{itemId:f.id,itemName:f.name,folderId:null!==(u=f.parentId)&&void 0!==u?u:null}})}catch(n){console.error("Ошибка при переименовании папки:",n),s.error({id:"FOLDER_RENAME_FAILED",message:a("Failed to rename folder"),placement:"bottomRight",innerException:n,data:{itemId:e,itemName:t,error:{message:n instanceof Error?n.message:String(n)}}})}},[x,l,null===(e=o.dataProviders)||void 0===e?void 0:e.renameFolder,null===(t=null==b?void 0:b.features)||void 0===t?void 0:t.enableRenameFolder,i.setSelectedFolder,s,a]);return{state:{folders:l,isCreatingFolder:p,loading:f},actions:{fetchFolders:x,fetchChildFolders:C,handleCreateFolder:_,handleModalOk:A,handleModalCancel:E,generateMenuItems:T,renameFolder:F}}},Ii=()=>{const{options:e,actions:t}=yi(),{dataProviders:n,config:r}=e,{setUndoDeletion:i}=t,{t:o}=$n(),a=_i(),s=c(async({items:e,selectedFolder:t,getItemNameById:s,showNotifications:l=!1})=>{let c=0,u=0;const d=[],h=async t=>{if(null==n?void 0:n.deleteItems)try{const r=await n.deleteItems(e.map(e=>e.id),{permanent:t}),i=r.detailed;if(i){const e=i.filter(e=>e.success).length;c+=e;const t=i.filter(e=>!e.success);return u+=t.length,void t.forEach(e=>{var t;const n=(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,i=Ai(r);d.push({itemId:n,itemName:s(n),error:i})})}if(r.success)c+=e.length;else{const t=r.error;if(t){u+=e.length;const n=Ai(t);d.push({error:n})}else u+=e.length}return}catch(n){const r=t?"Ошибка при удалении":"Ошибка при перемещении в корзину";console.error(r,n),u+=e.length;const i=Ai(n);d.push({error:i})}const r=t?"DataProvider для удаления файлов не настроен":"DataProvider для перемещения не настроен";console.warn(r)},f=(null==r?void 0:r.enableTrashFolder)&&"Trash"===t;return(null==r?void 0:r.enableTrashFolder)&&!f?await h(!1):await h(!0),c>0&&(null==r?void 0:r.enableTrashFolder)&&!f&&(null==i||i({itemIds:e.map(e=>e.id),sourceFolderId:t||"folders"})),l&&(c>0&&a.success({id:"FILES_DELETE_SUCCESS",message:o("Files deleted"),placement:"bottomRight",data:{successCount:c,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:t||null}}),u>0&&a.error({id:"FILES_DELETE_ERROR",message:o("Error when deleting a file"),placement:"bottomRight",data:{failCount:u,totalCount:e.length,itemIds:e.map(e=>e.id),itemNames:e.map(e=>s(e.id)),folderId:t||null,errors:d}})),{successCount:c,failCount:u,errorDetails:d}},[n,r,i,o,a]);return{deleteItems:s}},Ti=()=>{var e,t;const{state:n,actions:r,options:o}=yi(),a=Ci(),{sortBy:s,sortOrder:l}=a.state,{actions:{fetchFolders:u}}=Ei(),{t:d}=$n(),h=_i(),{deleteItems:f}=Ii(),{selectedFolder:p,urlForm:g,pagination:m,files:v}=n,y=i.useRef(null);y.current=m;const{setFiles:b,setLoading:w,setIsUrlModalVisible:x,setSelectedFiles:C,setActiveLibraryItem:_,setPagination:S}=r,{dataProviders:k}=o,A=c(async e=>{var t,n,r;if(!(null==k?void 0:k.getFiles))return[];const i=null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.disablePagination,{files:a,pagination:s}=await k.getFiles({folderId:"folders"!==(null==e?void 0:e.folderId)?null==e?void 0:e.folderId:void 0,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:i||null==e?void 0:e.page,limit:i||null==e?void 0:e.limit,itemType:(null==e?void 0:e.itemType)||"all"});return console.warn("🔍 fetchFilesFromDataProvider результат:",a,"с параметрами сортировки:",{sortBy:null==e?void 0:e.sortBy,sortOrder:null==e?void 0:e.sortOrder}),S&&((null===(r=null==o?void 0:o.config)||void 0===r?void 0:r.disablePagination)?S({current:1,pageSize:a.length||1,total:a.length||0}):s&&S({current:s.page,pageSize:s.limit,total:s.total})),a},[k,null===(e=null==o?void 0:o.config)||void 0===e?void 0:e.disablePagination,S]),E=c(async e=>{try{null==w||w(!0),console.warn("fetchFiles вызван с параметрами:",e);let t=[];if(!(null==k?void 0:k.getFiles))return void console.error("DataProvider для получения файлов не определен");t=await A(e),console.warn("Получены файлы:",t);const n=null!=e?e:{folderId:p||"",itemType:"all"};"file"!==n.itemType&&(t=await xi(t,n,null==k?void 0:k.getFolders)),"Trash"!==(p||"")&&(t=t.filter(e=>!(e.isFolder&&"Trash"===e.id))),null==b||b(t),null==C||C(new Set)}catch(t){console.error("Ошибка при загрузке файлов:",t);const n=Ai(t),r=ki(null==n?void 0:n.code,d);h.error({id:"FILES_FETCH_FAILED",message:null!=r?r:d("Failed to load files"),placement:"bottomRight",innerException:t,data:{params:e}})}finally{null==w||w(!1)}},[k,b,w,C,A,p,h,d]),I=c(async e=>{const t=y.current;try{const n=v.find(t=>t.id===e),r=e=>{if(!e)return;const t=v.find(t=>t.id===e);return null==t?void 0:t.name};await f({items:[{id:e,isFolder:null==n?void 0:n.isFolder}],selectedFolder:p,getItemNameById:r,showNotifications:!0});const i=Object.assign({},t);let o=t.current;1===v.length&&(o=i.current>1?i.current-1:1),await E({folderId:p||"",page:o,limit:t.pageSize,sortBy:s,sortOrder:l})}catch(t){console.error("Ошибка при удалении файла:",t);const n=t;(null==n?void 0:n.notificationShown)||h.error({id:"FILES_DELETE_ERROR",message:d("Error when deleting a file"),placement:"bottomRight",innerException:t,data:{failCount:1,totalCount:1,itemIds:[e],folderId:p||null,errors:[{itemId:e,error:Ai(t)}]}})}},[f,E,p,d,h,v,s,l]),T=c(async e=>{try{const t=y.current;if(!(null==k?void 0:k.deleteFolder))return void h.error({id:"FOLDER_DELETE_ERROR",message:d("DataProvider for folder deletion is not configured"),placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e}});if(!await k.deleteFolder(e)){const e=new Error("Не удалось удалить папку");throw e.notificationShown=!1,e}h.success({id:"FOLDER_DELETE_SUCCESS",message:d("Folder deleted"),placement:"bottomRight",data:{successCount:1,totalCount:1,itemIds:[e],folderId:e}});p===e?await E({page:t.current,limit:t.pageSize,sortBy:s,sortOrder:l}):await E({folderId:p||"",sortBy:s,sortOrder:l,page:t.current,limit:t.pageSize})}catch(t){console.error("Ошибка при удалении папки:",t);const n=t;(null==n?void 0:n.notificationShown)||h.error({id:"FOLDER_DELETE_ERROR",message:d("Error when deleting a folder"),innerException:t,placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e,errors:[{itemId:e,error:Ai(t)}]}})}},[k,p,h,d,E,s,l]),F=c(async e=>{var t,n;try{if(null==k?void 0:k.getFileData){const t=await k.getFileData(e);if(t)return t;throw new Error(d("Failed to download file"))}{const t=await fetch(`/api/files/${e.id}/content`);if(!t.ok)throw new Error(d("Error loading image"));return await t.blob()}}catch(r){console.error("Ошибка при загрузке файла:",r),h.error({id:"FILE_DOWNLOAD_FAILED",message:d("Failed to download file"),placement:"bottomRight",description:e.name,innerException:r,data:{itemId:e.id,itemName:e.name,folderId:null!==(t=e.folderId)&&void 0!==t?t:null,thumbnail:null!==(n=e.thumbnail)&&void 0!==n?n:null}})}},[k,h,d]),O=c(async(e,t,r)=>{var i,o,a,s,l,c;if("Trash"===(null!=t?t:p||""))throw new Error(d("Upload to Trash is forbidden"));const u=e.name.split(".").pop()||"",f=null!=t?t:p||"";try{if(null==k?void 0:k.uploadFiles)try{const t=await k.uploadFiles({items:[{name:e.name,size:e.size,type:e.type,folderId:f,data:e,extension:u}],folderId:f});if(t.success&&t.detailed&&t.detailed.length>0){const p=t.detailed[0];if(!p.success||!p.data){if(!r){const t=(null==p?void 0:p.error)?String(p.error):d("Failed to upload file");h.error({id:"FILE_UPLOAD_ITEM_FAILED",message:t,placement:"bottomRight",description:e.name,innerException:null==p?void 0:p.error,data:{itemName:e.name,folderId:f||null}})}return void(_&&_(Qt))}{const t=p.data;if(t.id){const r=(null!==(i=t.folderId)&&void 0!==i?i:f)||void 0;await E({folderId:r});let d=n.files.find(e=>e.id===t.id);if(!d)try{d=(await A({folderId:r,itemType:"file"})).find(e=>e.id===t.id)}catch(e){console.warn("uploadFileWithProvider: не удалось получить свежий список файлов",e)}return _&&_(Qt),d||Object.assign(Object.assign({},t),{id:t.id,name:t.name||e.name,folderId:null!==(a=null!==(o=t.folderId)&&void 0!==o?o:f)&&void 0!==a?a:null,type:e.type,size:e.size,extension:u||e.name.split(".").pop()||"",thumbnail:null!==(s=t.thumbnail)&&void 0!==s?s:void 0,url:null!==(l=t.url)&&void 0!==l?l:void 0,thumbnailUrl:null!==(c=t.thumbnailUrl)&&void 0!==c?c:void 0,isFolder:!1,selected:!1})}}}else if(!t.success){if(!r){const n=t.error?String(t.error):d("Failed to upload file");h.error({id:"FILE_UPLOAD_ITEM_FAILED",message:n,placement:"bottomRight",description:e.name,innerException:t.error,data:{itemName:e.name,folderId:f||null}})}return void(_&&_(Qt))}return void(_&&_(Qt))}catch(e){throw console.warn("batchError",e),e}if(null==k?void 0:k.uploadFile){const t=await k.uploadFile({name:e.name,size:e.size,type:e.type,folderId:f,data:e,extension:u});return _&&_(Qt),t}return void(r||h.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:d("DataProvider for file upload is not configured"),placement:"bottomRight"}))}catch(t){const n=Ai(t),i=ki(null==n?void 0:n.code,d);return r?void 0:void h.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!=i?i:d("Failed to upload file"),placement:"bottomRight",description:e.name,innerException:t,data:{itemName:e.name,folderId:f||null,error:Ai(t)}})}},[k,p,_,n.files,E,A,h,d]),P=c(async(e,t)=>{var n;if(!(null==k?void 0:k.getFolders)||!(null==k?void 0:k.createFolder))return e||"";try{const r=await k.getFolders(),i=Array.isArray(r)?r:[],o=(e,t)=>i.find(n=>{var r;return(null!==(r=n.parentId)&&void 0!==r?r:null)===(null!=e?e:null)&&n.name===t});let a=null!=e?e:"";for(const e of t){if(!e)continue;let t=o(a,e);if(!t){const n=await k.createFolder({name:e,parentId:null!=a?a:null});i.push(n),t=n}a=t.id}return null!==(n=a)&&void 0!==n?n:e||""}catch(t){return console.warn("ensureFolderPath: не удалось гарантировать путь",t),e||""}},[k]),M=c(async(e,t)=>{var n,r,i,o;if(!(null===(r=null===(n=e.type)||void 0===n?void 0:n.startsWith)||void 0===r?void 0:r.call(n,"image/")))return null!=t?t:null;const a=null==e?void 0:e.webkitRelativePath;let s=t||"";if(a&&a.includes("/")){const e=a.split("/");e.pop();const n=e.filter(Boolean);n.length&&(s=await P(t||"",n)||t||"")}return null!==(o=null!==(i=s)&&void 0!==i?i:t)&&void 0!==o?o:null},[P]),R=c(async e=>{var t,n,r,i,o,a,s,l,c,u,d,h;const{file:f,selectedFolderId:p,uploadFn:g,progressCallbacks:m}=e;if(!(null===(n=null===(t=f.type)||void 0===t?void 0:t.startsWith)||void 0===n?void 0:n.call(t,"image/")))return{success:!0,fileName:f.name,folderId:null!=p?p:null};const v=null!==(i=null!==(r=await M(f,p))&&void 0!==r?r:p)&&void 0!==i?i:null,y=null!==(o=null!=v?v:p)&&void 0!==o?o:null;let b;null===(a=null==m?void 0:m.onStart)||void 0===a||a.call(m,f);try{if(null==m?void 0:m.onProgress){let e=0;b=window.setInterval(()=>{var t;e=Math.min(e+10+Math.floor(Date.now()%10),90),null===(t=null==m?void 0:m.onProgress)||void 0===t||t.call(m,f.name,e)},200)}const e=await g(f,null!=y?y:void 0);return(null==m?void 0:m.onProgress)&&(null===(s=null==m?void 0:m.onProgress)||void 0===s||s.call(m,f.name,100)),null===(l=null==m?void 0:m.onComplete)||void 0===l||l.call(m,f.name),{success:!0,fileName:f.name,fileId:null==e?void 0:e.id,folderId:null!==(u=null!==(c=null==e?void 0:e.folderId)&&void 0!==c?c:y)&&void 0!==u?u:null}}catch(e){const t=e instanceof Error?e.message:String(e);return null===(d=null==m?void 0:m.onError)||void 0===d||d.call(m,f.name,t),{success:!1,fileName:f.name,folderId:null!==(h=null!=y?y:p)&&void 0!==h?h:null,error:t}}finally{void 0!==b&&clearInterval(b)}},[M]),L=c(async(e,t)=>{var n,r,i,o,a,s,l,c,u,f,g,m,v,y,b,w,x,C,S,A,E,I,T;if(0===e.length)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};null===(n=null==t?void 0:t.onStartBatch)||void 0===n||n.call(t,e);const F=e=>{const t=e.filter(Boolean);return t.length>0&&t.length<=5?t.join(", "):null},O=[];for(let n=0;n<e.length;n++){const s=e[n];if(!(null===(i=null===(r=s.type)||void 0===r?void 0:r.startsWith)||void 0===i?void 0:i.call(r,"image/"))){const e=await h.warning({id:"FILES_UPLOAD_UNSUPPORTED_TYPE",message:"Unsupported file type",placement:"bottomRight",data:{itemName:s.name,fileType:s.type,folderId:p||null}});null===(o=null==t?void 0:t.onError)||void 0===o||o.call(t,s.name,e.message);continue}const l=`${Date.now()}-${n}-${Math.random().toString(36).slice(2,8)}`,c=await M(s,p);null===(a=null==t?void 0:t.onStart)||void 0===a||a.call(t,s),O.push({file:s,targetFolderId:c,requestId:l})}const P=O.length;if(0===P)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};const R=!t,L=1===P&&R,j=[],D=[],N=[],z=[];let B=0,U=0;const V=async(e,n,r,i)=>{var o,a;const{emitProgress:s=!0,emitNotification:l=!0}=null!=i?i:{};B++,j.push(e),D.push(null!=r?r:e),await((e,t,n,r)=>{var i;return h.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${d("File")} ${e} ${d("has been successfully uploaded")}`,placement:"bottomRight",data:{itemId:n,itemName:e,folderId:null!==(i=null!=t?t:p)&&void 0!==i?i:null}},r||!R)})(e,n,r,!l),s&&(null===(o=null==t?void 0:t.onProgress)||void 0===o||o.call(t,e,100),null===(a=null==t?void 0:t.onComplete)||void 0===a||a.call(t,e))},$=async(e,n,r,i,o)=>{var a;const{emitProgress:s=!0,emitNotification:l=!0}=null!=o?o:{};U++;const c=Ai(i),u=await((e,t,n,r,i)=>{var o;const a=Ai(r),s=ki(null==a?void 0:a.code,d);return h.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!=s?s:d("Error uploading file {{fileName}}",{fileName:e}),placement:"bottomRight",data:{itemName:e,folderId:null!==(o=null!=t?t:p)&&void 0!==o?o:null,error:a},innerException:r},i||!R)})(e,n,0,i,!l);s&&(null===(a=null==t?void 0:t.onError)||void 0===a||a.call(t,e,u.message)),z.push({itemId:void 0,itemName:e,error:c}),N.push({fileName:e,error:u.message})};if(!(null==k?void 0:k.uploadFiles))return h.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:d("DataProvider for file upload is not configured"),placement:"bottomRight"}),{successCount:0,failCount:P,successes:[],errors:[],totalCount:P};try{const e=await k.uploadFiles({items:O.map(e=>{var t,n;return{requestId:e.requestId,name:e.file.name,size:e.file.size,type:e.file.type,folderId:null!==(n=null!==(t=e.targetFolderId)&&void 0!==t?t:p)&&void 0!==n?n:null,data:e.file,extension:e.file.name.split(".").pop()||""}}),folderId:null!=p?p:null}),t=null!==(s=e.detailed)&&void 0!==s?s:[],n=new Map(t.filter(e=>e.requestId).map(e=>[e.requestId,e]));if(t.length>0)for(let e=0;e<O.length;e++){const r=O[e],i=null!==(l=r.requestId?n.get(r.requestId):void 0)&&void 0!==l?l:t[e];if(i&&i.success){const e=i.data,t=r.file.name,n=null!==(f=null!==(u=null!==(c=null==e?void 0:e.folderId)&&void 0!==c?c:r.targetFolderId)&&void 0!==u?u:p)&&void 0!==f?f:null,o=null==e?void 0:e.id;await V(t,n,o,{emitNotification:L})}else{(null==i?void 0:i.error)?String(i.error):d("Error uploading file");const e=null==i?void 0:i.data,t=r.file.name,n=null!==(v=null!==(m=null!==(g=null==e?void 0:e.folderId)&&void 0!==g?g:r.targetFolderId)&&void 0!==m?m:p)&&void 0!==v?v:null;await $(t,n,0,null==i?void 0:i.error,{emitNotification:L})}}else if(e.success)for(const e of O){const t=e.file.name,n=null!==(b=null!==(y=e.targetFolderId)&&void 0!==y?y:p)&&void 0!==b?b:null;await V(t,n,void 0,{emitNotification:L})}else{e.error?String(e.error):d("Error uploading file");for(const t of O){const n=t.file.name,r=null!==(x=null!==(w=t.targetFolderId)&&void 0!==w?w:p)&&void 0!==x?x:null;await $(n,r,0,e.error,{emitNotification:L})}}}catch(e){e instanceof Error?e.message:String(e);for(const t of O){const n=t.file.name,r=null!==(S=null!==(C=t.targetFolderId)&&void 0!==C?C:p)&&void 0!==S?S:null;await $(n,r,0,e,{emitNotification:L})}}if(B>0&&(_&&_(Qt),P>1&&R)){const e=F(j),t=e?d("Uploaded",{names:e}):d("uploads_success_summary",{successCount:B,totalCount:P});h.success({id:"FILES_UPLOAD_BATCH_SUCCESS",message:t,placement:"bottomRight",data:{successCount:B,totalCount:P,itemIds:D,itemNames:j,folderId:null!=p?p:null}})}if(U>0&&!L&&R)if(P>1){const e=N.map(e=>e.fileName),t=F(e),n=t?d("Failed",{names:t}):d("uploads_fail_summary",{failCount:U,totalCount:P});h.error({id:"FILES_UPLOAD_BATCH_FAILED",message:n,placement:"bottomRight",data:{failCount:U,totalCount:P,itemNames:e,folderId:null!=p?p:null,errors:z}})}else if(1===P&&z.length>0&&(null===(A=z[0].error)||void 0===A?void 0:A.code)){const e=ki(null===(E=z[0].error)||void 0===E?void 0:E.code,d),t=null!==(T=null===(I=N[0])||void 0===I?void 0:I.fileName)&&void 0!==T?T:"",n=null!=e?e:t?`${d("Failed to upload files")}: ${t}`:d("Failed to upload files");h.error({id:"FILES_UPLOAD_BATCH_FAILED",message:n,placement:"bottomRight",data:{failCount:U,totalCount:P,itemNames:[t],folderId:null!=p?p:null,errors:z}})}return{successCount:B,failCount:U,successes:j,errors:N,totalCount:P}},[k,null==k?void 0:k.uploadFiles,h,M,p,_,d,R,O]),j=c(async e=>{var t;if(!(null==k?void 0:k.uploadFiles))return void h.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:d("DataProvider for file upload is not configured"),placement:"bottomRight"});if("Trash"===p)return void h.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:d("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:p||null,reason:"Upload to Trash is not allowed"}});const n=y.current,r=document.createElement("input");r.type="file",r.accept="image/*",r.multiple=!0;try{!(!(null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.features)||!o.config.features.enableDirectoryUpload)&&(r.webkitdirectory=!0)}catch(e){}r.onchange=async t=>{var r;const i=t.target.files;if(!i||0===i.length)return;const o=Array.from(i);try{null==w||w(!0);const{successes:t,errors:i}=await L(o,e);null===(r=null==e?void 0:e.onBatchComplete)||void 0===r||r.call(e,{files:o,successes:t,errors:i}),await u(),await E({folderId:p||"",sortBy:s,sortOrder:l,page:n.current,limit:n.pageSize})}catch(e){console.error("Ошибка при загрузке файлов:",e)}finally{null==w||w(!1)}},r.click()},[null==k?void 0:k.uploadFile,null==k?void 0:k.uploadFiles,p,h,d,w,E,u,s,l,L,null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.features]),D=c(async(e,t)=>{const n=y.current;let r,i=null!=e?e:null;try{if(!t&&"Trash"===p)return void h.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:d("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:p||null,reason:"Upload to Trash is not allowed"}});let e;if(!i&&g&&(e=await g.validateFields(),i=null==e?void 0:e.fileUrl),!i)return void h.error({id:"FILES_UPLOAD_URL_VALIDATION_FAILED",message:d("Please fill in all fields"),placement:"bottomRight",data:{url:null!=i?i:null,folderId:p||null}});if(null==w||w(!0),!(null==k?void 0:k.uploadFileByUrl))return void h.error({id:"FILES_UPLOAD_URL_NOT_SUPPORTED",message:d("Upload by URL is not supported"),placement:"bottomRight",data:{url:i,folderId:p||null}});r=await k.uploadFileByUrl({url:i,folderId:p||"",noFolder:t});const o=(null==e?void 0:e.name)||(null==r?void 0:r.name)||"unnamed file";return h.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${d("File")} ${o} ${d("successfully uploaded")}`,placement:"bottomRight",data:{itemName:o,itemId:null==r?void 0:r.id,folderId:p||null}}),e&&(null==x||x(!1),null==g||g.resetFields()),_&&_(Qt),await E({folderId:p||"",sortBy:s,sortOrder:l,page:n.current,limit:n.pageSize}),r}catch(e){console.error("Ошибка при загрузке файла по URL:",e),h.error({id:"FILES_UPLOAD_BY_URL_FAILED",message:d("Error when downloading a file by URL"),placement:"bottomRight",data:{url:null!=i?i:null,folderId:p||null,error:Ai(e)},innerException:e})}finally{null==w||w(!1)}},[g,w,k,h,d,x,_,E,p,s,l]),N=c(async e=>{if(!e.length)return;const t=y.current;"Trash"!==p?(await L(e),await E({folderId:p||"",sortBy:s,sortOrder:l,page:t.current,limit:t.pageSize})):h.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:d("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:p||null,reason:"Upload to Trash is not allowed"}})},[E,p,s,l,L,h,d]);return{fetchFiles:E,handleDeleteFile:I,handleDeleteFolder:T,handleAddFile:j,handleAddFileByUrl:D,handleDroppedFiles:N,getFileData:F,uploadFileWithProvider:O}},Fi=e=>{var t,n,r,i;const{state:o,actions:a,options:s}=yi(),{t:l}=$n(),u=Ei(),d=_i(),{fetchFolders:h}=u.actions,{renameItem:f}=(()=>{const{options:e}=yi(),{dataProviders:t}=e,{t:n}=$n(),r=c(async({itemId:e,newName:r,isFolder:i})=>{var o,a,s,l,c,u,d,h;try{if(i){if(!(null==t?void 0:t.renameFolder))throw new Error(n("renameFolder is not implemented in dataProviders"));const i=await t.renameFolder(e,r.trim());return{success:!0,renamedItem:{id:i.id,name:null!==(o=i.name)&&void 0!==o?o:r,parentId:null!==(a=i.parentId)&&void 0!==a?a:null,folderId:null!==(s=i.parentId)&&void 0!==s?s:null}}}if(!(null==t?void 0:t.renameFile))throw new Error(n("renameFile is not implemented in dataProviders"));const f=await t.renameFile(e,r);return{success:!0,renamedItem:{id:null!==(l=null==f?void 0:f.id)&&void 0!==l?l:e,name:null!==(c=null==f?void 0:f.name)&&void 0!==c?c:r,folderId:null!==(u=null==f?void 0:f.folderId)&&void 0!==u?u:null,parentId:null!==(h=null!==(d=null==f?void 0:f.parentId)&&void 0!==d?d:null==f?void 0:f.folderId)&&void 0!==h?h:null}}}catch(e){return{success:!1,error:Ai(e)}}},[t,n]);return{renameItem:r}})(),{files:p,selectedFolder:g,fileToRename:m,renameForm:v,isRenameModalVisible:y,pagination:b}=o,{setFileToRename:w,setIsRenameModalVisible:x}=a,{dataProviders:C,config:_}=s,S=e=>{var t,n;if(!e)return null;const r=e;return null!==(n=null!==(t=r.folderId)&&void 0!==t?t:r.parentId)&&void 0!==n?n:null},k=(e,t)=>{var n;return{itemId:null!==(n=null==e?void 0:e.id)&&void 0!==n?n:t,itemName:null==e?void 0:e.name,folderId:S(e)}},A=c(e=>{var t,n;const r=null==p?void 0:p.find(t=>t.id===e);if((null==r?void 0:r.isFolder)||e.startsWith("folder_")){if(!(!1!==(null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder)))return void d.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:l("Folder rename is disabled by config"),placement:"bottomRight",data:k(r,e)});if(!(null==C?void 0:C.renameFolder))throw new Error(l("renameFolder is not implemented in dataProviders"))}else{if(!(!1!==(null===(n=null==_?void 0:_.features)||void 0===n?void 0:n.enableRenameFile)))return void d.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:l("File rename is disabled by config"),placement:"bottomRight",data:k(r,e)});if(!(null==C?void 0:C.renameFile))throw new Error(l("renameFile is not implemented in dataProviders"))}null==w||w(e),null==x||x(!0),r&&v&&v.setFieldsValue({newFileName:r.name})},[p,w,x,v,null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder,null===(n=null==_?void 0:_.features)||void 0===n?void 0:n.enableRenameFile,null==C?void 0:C.renameFolder,null==C?void 0:C.renameFile,d,l]),E=c(()=>{null==x||x(!1),null==w||w(null),null==v||v.resetFields()},[x,w,v]),I=c(async()=>{var t,n,r,i,o,s,c,u,y;if(!m||!v)return;const w=null==p?void 0:p.find(e=>e.id===m);try{const p=await v.validateFields();if(!(null==p?void 0:p.newFileName))return;const x=(null==w?void 0:w.isFolder)||m.startsWith("folder_");if(x){if(!(!1!==(null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder)))return void d.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:l("Folder rename is disabled by config"),placement:"bottomRight",data:k(w,m)})}else{if(!(!1!==(null===(n=null==_?void 0:_.features)||void 0===n?void 0:n.enableRenameFile)))return void d.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:l("File rename is disabled by config"),placement:"bottomRight",data:k(w,m)})}const C=await f({itemId:m,newName:p.newFileName,isFolder:x});if(!C.success){const e=ki(null===(r=C.error)||void 0===r?void 0:r.code,l);return void d.error({id:"ITEM_RENAME_FAILED",message:null!==(o=null!=e?e:null===(i=C.error)||void 0===i?void 0:i.message)&&void 0!==o?o:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},k(w,m)),{error:C.error}),innerException:C.error})}const S=C.renamedItem;x?(d.success({id:"FOLDER_RENAME_SUCCESS",message:l(`${l("Folder renamed to")} ${p.newFileName}`),placement:"bottomRight",data:{itemId:null!==(s=null==S?void 0:S.id)&&void 0!==s?s:m,itemName:null!==(c=null==S?void 0:S.name)&&void 0!==c?c:p.newFileName,folderId:null!==(y=null!==(u=null==S?void 0:S.parentId)&&void 0!==u?u:null==S?void 0:S.folderId)&&void 0!==y?y:null}}),await h(),(null==S?void 0:S.id)&&S.id!==m&&a.setSelectedFolder&&a.setSelectedFolder(S.id)):d.success({id:"FILE_RENAME_SUCCESS",message:`${l("File renamed to")} ${p.newFileName}`,placement:"bottomRight",data:Object.assign(Object.assign({},k(w,m)),{itemName:p.newFileName})}),E(),await e({folderId:g||"",page:b.current,limit:b.pageSize})}catch(e){console.error("Ошибка при переименовании:",e);const t=Ai(e),n=ki(null==t?void 0:t.code,l);d.error({id:"ITEM_RENAME_FAILED",message:null!=n?n:e instanceof Error?e.message:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},k(w,m)),{error:t}),innerException:e})}},[m,v,p,a,E,e,g,l,b,null===(r=null==_?void 0:_.features)||void 0===r?void 0:r.enableRenameFolder,null===(i=null==_?void 0:_.features)||void 0===i?void 0:i.enableRenameFile,d,h,f]);return{state:{isRenamingFile:y||!1,fileToRename:m},actions:{showRenameModal:A,handleRenameCancel:E,handleRenameOk:I}}},Oi=e=>{const t=t=>{if(!t)return;const n=e.find(e=>e.id===t);return null==n?void 0:n.name};return{getItemNameById:t,getItemNamesByIds:e=>e.map(t).filter(e=>Boolean(e)),getNamesPreview:e=>e.length>0&&e.length<=5?e.join(", "):null}},Pi=(e,t,n,r,i)=>({itemIds:e,itemNames:i&&i.length?i:void 0,successCount:t,totalCount:n,folderId:null!=r?r:null}),Mi=(e,t,n,r,i,o)=>({itemIds:e,itemNames:o&&o.length?o:void 0,failCount:t,totalCount:n,folderId:null!=r?r:null,errors:i}),Ri=()=>{const e=_i(),{t:t}=$n(),{actions:{fetchFolders:n,fetchChildFolders:r}}=Ei();return{refreshFolders:c(async({parentIds:i,selectedFolder:o})=>{try{if(await n(),i&&r)for(const e of i)e&&await r(e)}catch(n){console.error("Ошибка при обновлении дерева папок:",n),e.error({id:"FILES_FETCH_FAILED",message:t("Failed to refresh folder tree"),placement:"bottomRight",innerException:n,data:{params:{folderId:o||void 0}}})}},[e,t]),refreshFiles:c(async({fetchFiles:n,selectedFolder:r,page:i,limit:o})=>{try{await n({folderId:r||"",page:i,limit:o})}catch(n){console.error("Ошибка при обновлении списка файлов:",n),e.error({id:"FILES_FETCH_FAILED",message:t("Failed to refresh file list"),placement:"bottomRight",innerException:n,data:{params:{folderId:r||void 0,page:i,limit:o}}})}},[e,t])}},Li=e=>{const{state:t,actions:n}=yi(),{t:r}=$n(),i=_i(),{files:o,selectedFolder:a,selectedFiles:s,moveForm:l,pagination:u,currentMenuFile:d}=t,{setIsMoveModalVisible:h,setSelectedFiles:f,setPagination:p}=n,{moveItems:g}=(()=>{const{options:e}=yi(),{dataProviders:t}=e,{t:n}=$n(),r=_i(),i=c(async({items:e,targetFolderId:i,getItemNameById:o,showNotifications:a=!1})=>{let s=0,l=0;const c=[];if(null==t?void 0:t.moveItems)try{const n=await t.moveItems("folders"===i?"":i,e.map(e=>e.id)),r=n.detailed;if(r){const e=r.filter(e=>e.success),t=r.filter(e=>!e.success);s+=e.length,l+=t.length,t.forEach(e=>{const t=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),n=e.error,r=Ai(n);c.push({itemId:t,itemName:o(t),error:r})})}else if(n.success)s+=e.length;else{const t=n.error;if(t){l+=e.length;const n=Ai(t);c.push({error:n})}else l+=e.length}}catch(t){l+=e.length;const n=Ai(t);c.push({error:n})}else l+=e.length,c.push({error:{message:"Move provider is not configured"}});return a&&(s>0&&r.success({id:"FILES_MOVE_SUCCESS",message:n("Files moved"),placement:"bottomRight",data:{successCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===i?null:i}}),l>0&&r.error({id:"FILES_MOVE_ERROR",message:n("Errors occurred while moving"),placement:"bottomRight",innerException:c.length?c:void 0,data:{failCount:l,totalCount:e.length,itemIds:e.map(e=>e.id),errors:c.length?c:void 0}})),{successCount:s,failCount:l,errorDetails:c}},[t,r,n]);return{moveItems:i}})(),{refreshFolders:m,refreshFiles:v}=Ri(),{getItemNameById:y,getItemNamesByIds:b,getNamesPreview:w}=Oi(o),x=c(()=>{null==h||h(!0)},[h]),C=c(()=>{null==h||h(!1),null==l||l.resetFields()},[h,l]),_=c(async t=>{var n,c,h;if(!((null==d?void 0:d.length)||s&&0!==s.size))return;const x=o.length,_=Object.assign({},u),S=Array.from((null==d?void 0:d.length)?[d]:s),k=S.length;let A=0,E=0;const I=[],T=S.map(e=>o.find(t=>t.id===e)).filter(e=>Boolean(e)),F=T.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let o=t;if(!t){const e=await l.validateFields();o=null==e?void 0:e.targetFolder}if(!o)return void i.error({id:"FILES_MOVE_DIRECTORY_NOT_SELECTED",message:r("Select destination folder"),placement:"bottomRight"});const s="folders"===o?null:o,u=null!=s?s:a,d=await g({items:T,targetFolderId:o,getItemNameById:y,showNotifications:!1});if(A=d.successCount,E=d.failCount,I.push(...d.errorDetails),A>0){const e=b(S),t=w(e),n=t?r("Moved",{names:t}):r("move_success_summary",{successCount:A,totalCount:k});i.success({id:"FILES_MOVE_SUCCESS",message:n,placement:"bottomRight",data:Pi(S,A,k,s,e)})}if(E>0){const e=b(S),t=w(e);let o;if(1===k&&I.length>0&&(null===(n=I[0].error)||void 0===n?void 0:n.code)){const e=ki(null===(c=I[0].error)||void 0===c?void 0:c.code,r);o=null!=e?e:t?r("Failed",{names:t}):r("move_fail_summary",{failCount:E,totalCount:k})}else o=t?r("Failed",{names:t}):r("move_fail_summary",{failCount:E,totalCount:k});i.error({id:"FILES_MOVE_ERROR",message:o,placement:"bottomRight",innerException:I.length?I:void 0,data:Mi(S,E,k,s,I.length?I:void 0,e)})}C(),null==f||f(new Set);let O=_.current;if(A>0&&x>0&&A>=x&&_.current>1&&(O=_.current-1),A>0&&_.total>=A){const e=Math.max(0,(null!==(h=_.total)&&void 0!==h?h:0)-A);null==p||p({current:O,pageSize:_.pageSize,total:e})}F&&await m({parentIds:void 0,selectedFolder:u}),await v({fetchFiles:e,selectedFolder:u,page:O,limit:_.pageSize})}catch(e){console.error("Ошибка при перемещении:",e);const t=ki(Ai(e).code,r);i.error({id:"FILES_MOVE_ERROR",innerException:e,message:null!=t?t:r("Error moving"),placement:"bottomRight",data:Mi(S,k,k,a||null,[{error:Ai(e)}],b(S))})}},[d,s,l,f,e,a,u,o,i,p,r,g,h]);return{actions:{showMoveModal:x,handleMoveCancel:C,handleMoveOk:_}}},ji=e=>{const{state:t,actions:n}=yi(),{t:r}=$n(),i=_i(),{files:o,selectedFolder:a,selectedFiles:s,copyForm:l,pagination:u,currentMenuFile:d}=t,{setIsCopyModalVisible:h,setSelectedFiles:f}=n,{copyItems:p}=(()=>{const{options:e}=yi(),{dataProviders:t}=e,{t:n}=$n(),r=_i(),i=c(async({items:e,targetFolderId:i,getItemNameById:o,showNotifications:a=!1})=>{let s=0,l=0;const c=[],u="folders"===i?"":i;if(null==t?void 0:t.copyItems)try{const n=await t.copyItems(u,e.map(e=>e.id)),r=n.detailed;if(r){const e=r.filter(e=>e.success),t=r.filter(e=>!e.success);s+=e.length,l+=t.length,t.forEach(e=>{const t=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),n=e.error,r=Ai(n);c.push({itemId:t,itemName:o(t),error:r})})}else if(n.success)s+=e.length;else{const t=n.error;if(t){l+=e.length;const n=Ai(t);c.push({error:n})}else l+=e.length}}catch(t){l+=e.length;const n=Ai(t);c.push({error:n})}else if(null==t?void 0:t.copyItem)for(const n of e)try{const e=(null==n?void 0:n.isFolder)||n.id.startsWith("folder_");await t.copyItem({itemId:n.id,targetFolderId:u,isFolder:e})?s++:l++}catch(e){l++;const t=Ai(e);c.push({itemId:n.id,itemName:o(n.id),error:t})}else l+=e.length,c.push({error:{message:"Copy provider is not configured"}});return a&&(s>0&&r.success({id:"FILES_COPY_SUCCESS",message:n("Files copied"),placement:"bottomRight",data:{successCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===i?null:i}}),l>0&&r.error({id:"FILES_COPY_ERROR",message:n("Errors occurred while copying"),placement:"bottomRight",innerException:c.length?c:void 0,data:{failCount:l,totalCount:e.length,itemIds:e.map(e=>e.id),errors:c.length?c:void 0}})),{successCount:s,failCount:l,errorDetails:c}},[t,r,n]);return{copyItems:i}})(),{refreshFolders:g,refreshFiles:m}=Ri(),{getItemNameById:v,getItemNamesByIds:y,getNamesPreview:b}=Oi(o),w=c(()=>{null==h||h(!0)},[h]),x=c(()=>{null==h||h(!1),null==l||l.resetFields()},[h,l]),C=c(async t=>{var n,c;if(!((null==d?void 0:d.length)||s&&0!==s.size))return;const h=Array.from((null==d?void 0:d.length)?[d]:s),w=h.length;let C=0,_=0;const S=[],k=h.map(e=>o.find(t=>t.id===e)).filter(e=>Boolean(e)),A=k.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let o=t;if(!t){const e=await l.validateFields();o=null==e?void 0:e.targetFolder}if(!o)return void i.error({id:"FILES_COPY_DIRECTORY_NOT_SELECTED",message:r("Select destination folder"),placement:"bottomRight"});const s="folders"===o?null:o,d=null!=s?s:a,E=await p({items:k,targetFolderId:o,getItemNameById:v,showNotifications:!1});if(C=E.successCount,_=E.failCount,S.push(...E.errorDetails),C>0){const e=y(h),t=b(e),n=t?r("Copied",{names:t}):r("copy_success_summary",{successCount:C,totalCount:w});i.success({id:"FILES_COPY_SUCCESS",message:n,placement:"bottomRight",data:Pi(h,C,w,s,e)})}if(_>0){const e=y(h),t=b(e);let o;if(1===w&&S.length>0&&(null===(n=S[0].error)||void 0===n?void 0:n.code)){const e=ki(null===(c=S[0].error)||void 0===c?void 0:c.code,r);o=null!=e?e:t?r("Failed",{names:t}):r("copy_fail_summary",{failCount:_,totalCount:w})}else o=t?r("Failed",{names:t}):r("copy_fail_summary",{failCount:_,totalCount:w});i.error({id:"FILES_COPY_ERROR",message:o,placement:"bottomRight",innerException:S.length?S:void 0,data:Mi(h,_,w,s,S.length?S:void 0,e)})}x(),null==f||f(new Set),A&&await g({parentIds:void 0,selectedFolder:d}),await m({fetchFiles:e,selectedFolder:d,page:u.current,limit:u.pageSize})}catch(e){console.error("Ошибка при копировании:",e);const t=ki(Ai(e).code,r);i.error({id:"FILES_COPY_ERROR",message:null!=t?t:r("Error copying"),innerException:e,placement:"bottomRight",data:Mi(h,w,w,a||null,[{error:Ai(e)}],y(h))})}},[d,s,l,f,e,a,u,o,i,r,p,h]);return{actions:{showCopyModal:w,handleCopyCancel:x,handleCopyOk:C}}},Di=e=>{const t=Fi(e),n=Li(e),r=ji(e),i=(e=>{const{state:t,actions:n,options:r}=yi(),{t:i}=$n(),o=_i(),{files:a,selectedFolder:s,selectedFiles:l,pagination:u,currentMenuFile:d}=t,{setSelectedFiles:h,setIsDeleteConfirmVisible:f,setUndoDeletion:p,setPagination:g}=n,{config:m}=r,{deleteItems:v}=Ii(),{refreshFolders:y,refreshFiles:b}=Ri(),{getItemNameById:w,getItemNamesByIds:x,getNamesPreview:C}=Oi(a),_=c(()=>{null==f||f(!0)},[f]),S=c(()=>{null==f||f(!1)},[f]),k=c(async()=>{var t,n,r;if(!((null==d?void 0:d.length)||l&&0!==l.size))return void(null==f||f(!1));const c=a.length,_=Object.assign({},u),S=Array.from(d?[d]:l),k=S.map(e=>a.find(t=>t.id===e)).filter(e=>Boolean(e)),A=new Set;k.forEach(e=>{(null==e?void 0:e.isFolder)&&A.add((e=>{var t,n;if(!e)return null;const r=e;return null!==(n=null!==(t=r.folderId)&&void 0!==t?t:r.parentId)&&void 0!==n?n:null})(e))});let E=0,I=0;const T=[];try{const a=await v({items:k,selectedFolder:s,getItemNameById:w,showNotifications:!1});E=a.successCount,I=a.failCount,T.push(...a.errorDetails);const l=(null==m?void 0:m.enableTrashFolder)&&"Trash"===s;if(E>0&&(null==m?void 0:m.enableTrashFolder)&&!l&&(null==p||p({itemIds:S,sourceFolderId:s||"folders"})),E>0){const e=S.length;(null==m?void 0:m.enableTrashFolder)&&!l?await o.success({id:"FILES_DELETE_SUCCESS",message:i("moved_to_trash",{count:E}),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:S,folderId:s||null}}):await o.success({id:"FILES_DELETE_SUCCESS",message:i("Files deleted"),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:S,folderId:s||null}})}if(I>0){const e=x(S),r=C(e),a=S.length,s=1===a&&T.length>0&&(null===(t=T[0].error)||void 0===t?void 0:t.code),c=(null==m?void 0:m.enableTrashFolder)&&!l,u=i(c?"При перемещении в корзину произошли ошибки":"При удалении произошли ошибки"),d=s?ki(null===(n=T[0].error)||void 0===n?void 0:n.code,i):void 0,h=null!=d?d:r?i("Failed",{names:r}):u;o.error({id:"FILES_DELETE_ERROR",message:h,placement:"bottomRight",innerException:T.length?T:void 0,data:{failCount:I,isTrashMove:c,totalCount:a,itemNames:e,errors:T.length?T:void 0}})}null==h||h(new Set),null==f||f(!1),await y({parentIds:Array.from(A),selectedFolder:s});let u=_.current;if(E>0&&c>0&&E>=c&&_.current>1&&(u=_.current-1),E>0&&_.total>=E){const e=Math.max(0,(null!==(r=_.total)&&void 0!==r?r:0)-E);null==g||g({current:u,pageSize:_.pageSize,total:e})}await b({fetchFiles:e,selectedFolder:s,page:u,limit:_.pageSize})}catch(e){console.error("Ошибка при удалении:",e),o.error({id:"FILES_DELETE_ERROR",message:i("Error deleting"),placement:"bottomRight",innerException:e,data:{failCount:I,totalCount:k.length}})}},[d,l,f,e,s,u,p,g,a,i,o,v,null==m?void 0:m.enableTrashFolder]);return{actions:{showDeleteConfirm:_,handleDeleteConfirmCancel:S,handleDeleteConfirmOk:k}}})(e);return{state:t.state,actions:Object.assign(Object.assign(Object.assign(Object.assign({},t.actions),n.actions),r.actions),i.actions)}},Ni=()=>{const{state:e}=yi(),{files:t,loading:n,isUrlModalVisible:r}=e,i=Ti(),o=(()=>{const{state:e,actions:t}=yi(),{selectedFiles:n,files:r,multiSelect:i}=e,{setSelectedFiles:o}=t,a=u(null),s=c((e,t,n)=>{const i=Array.isArray(r)?r:[],o=i.findIndex(t=>t.id===e),a=i.findIndex(e=>e.id===t);if(-1===o||-1===a)return n;const[s,l]=o<a?[o,a]:[a,o],c=i.slice(s,l+1).map(e=>e.id),u=new Set(n);return c.forEach(e=>u.add(e)),u},[r]),l=c((e,t)=>{if(!n||!o)return;const r=!1!==i,l=!!(null==t?void 0:t.shiftKey)&&r&&a.current;let c=new Set(r?n:[]);l&&a.current?c=s(a.current,e,c):c.has(e)?c.delete(e):c.add(e),a.current=e,o(c)},[i,n,o,s]);return{state:{selectedFiles:n||new Set},actions:{toggleFileSelection:l}}})(),a=Di(i.fetchFiles);return{state:{files:t||[],selectedFiles:o.state.selectedFiles,loading:n||!1,isAddingFileByUrl:r||!1,isRenamingFile:a.state.isRenamingFile,fileToRename:a.state.fileToRename},actions:{fetchFiles:i.fetchFiles,handleDeleteFile:i.handleDeleteFile,handleDeleteFolder:i.handleDeleteFolder,handleAddFile:i.handleAddFile,handleAddFileByUrl:i.handleAddFileByUrl,handleDroppedFiles:i.handleDroppedFiles,uploadFileWithProvider:i.uploadFileWithProvider,toggleFileSelection:o.actions.toggleFileSelection,showRenameModal:a.actions.showRenameModal,handleRenameCancel:a.actions.handleRenameCancel,handleRenameOk:a.actions.handleRenameOk,showMoveModal:a.actions.showMoveModal,handleMoveCancel:a.actions.handleMoveCancel,handleMoveOk:a.actions.handleMoveOk,showCopyModal:a.actions.showCopyModal,handleCopyCancel:a.actions.handleCopyCancel,handleCopyOk:a.actions.handleCopyOk,showDeleteConfirm:a.actions.showDeleteConfirm,handleDeleteConfirmCancel:a.actions.handleDeleteConfirmCancel,handleDeleteConfirmOk:a.actions.handleDeleteConfirmOk}}},zi="filemanager_sidebar_width",Bi=({onSearch:t,placeholder:n,className:r})=>{const{t:i}=$n(),[s,l]=o(""),c=u(null),{options:d}=yi(),{config:h}=d,f=n||i("Search files...");a(()=>(c.current=mi.debounce(e=>{t(e)},500),()=>{var e;null===(e=c.current)||void 0===e||e.cancel()}),[t]);return e(F,{value:s,onChange:e=>{var t;const n=e.target.value;l(n),null===(t=c.current)||void 0===t||t.call(c,n)},placeholder:f,prefix:e(li,{size:16,strokeWidth:null==h?void 0:h.iconStrokeWidth}),className:r,allowClear:!0,onClear:()=>{l(""),t("")}})},Ui=new Map,Vi=(e,t)=>{Ui.set(e,t),console.log("Изображение сохранено в кеш:",e),Ui.size>350&&(Array.from(Ui.keys()).slice(0,50).forEach(e=>Ui.delete(e)),console.warn("Очищен кеш изображений. Удалено 50 самых старых записей."))},$i=e=>{if(e.type&&e.type.startsWith("image/"))return!0;if(e.name){const t=e.name.toLowerCase().split(".").pop();return un.includes(t||"")}return!1},Wi=({src:t,alt:n,className:r,width:i,height:s,preview:l=!1,file:u})=>{const{t:d}=$n(),h=Ti(),[f,p]=o(!1),[g,m]=o(t),[v,y]=o(!1),b=c(e=>{m(e),p(!1),y(!1)},[]),w=c(e=>{console.warn("Не удалось загрузить изображение:",e),m(void 0),p(!0),y(!1)},[]),x=c(()=>{m(dn),p(!0)},[]),C=c(e=>{m(e),p(!1)},[]),_=c(e=>{const t=e.split(",")[1];t&&t.length>20?m(e):(console.warn("Некорректные base64 данные:",e.substring(0,50)+"..."),x())},[x]),S=c(async e=>{if(console.log("loadImageFromFile",e.id),t=e.id,Ui.has(t))return console.log("Изображение найдено в кеше:",e.id),(e=>Ui.get(e))(e.id);var t;if(!e||!$i(e))return console.warn("Файл не является изображением:",null==e?void 0:e.name,null==e?void 0:e.type),x(),dn;try{const t=await h.getFileData(e);if(!t)throw new Error(d("Error loading image"));return new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const t=i.result;Vi(e.id,t),n(t)},i.onerror=()=>r(new Error("Ошибка чтения файла")),i.readAsDataURL(t)})}catch(e){throw console.error("Ошибка загрузки изображения:",e),e}},[u,x,h]),k=c(()=>{(null==u?void 0:u.id)&&$i(u)?S(u).then(b).catch(w):u&&!$i(u)&&(console.warn("Файл не является изображением, показываем fallback:",u.name,u.type),x())},[u,S,b,w,x]),A=c(e=>{console.log("HandleBlobSrc:",{blobSrc:e,file:u?{id:u.id,name:u.name,type:u.type,extension:u.extension,folderId:u.folderId}:null}),u&&$i(u)?(console.log("Blob файл является изображением, устанавливаем src:",u.name,u.type),m(e),p(!1)):(console.warn("Blob файл не является изображением, показываем fallback:",null==u?void 0:u.name,null==u?void 0:u.type),x())},[u,x,$i]),E=c(()=>{(null==u?void 0:u.id)&&$i(u)?(y(!0),S(u).then(b).catch(w)):u&&!$i(u)?(console.warn("Файл не является изображением, показываем fallback:",u.name,u.type),x()):(console.warn("Неподдерживаемый формат изображения:",t),m(void 0))},[u,t,S,b,w,x]);a(()=>{y(!1),t?t.startsWith("data:image/")?_(t):t.startsWith("blob:")?A(t):t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?C(t):E():k()},[t,k,_,A,C,E]);return e(O,{className:r,src:g,alt:n,width:i,height:s,preview:l&&!f&&{src:g,toolbarRender:()=>null,destroyOnHidden:!0,mask:e(se,{style:{fontSize:"20px"}})},onError:()=>{console.warn("Ошибка загрузки изображения:",(null==g?void 0:g.substring(0,50))+"..."),p(!0)},fallback:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiBmaWxsPSIjRjVGNUY1Ii8+CjxwYXRoIGQ9Ik0yNCAzMkw0MCA0OEw1NiAzMkw2NCA0MEw2NCA2NEgyNFYzMloiIGZpbGw9IiNEOUQ5RDkiLz4KPC9zdmc+",loading:v?"lazy":void 0})},Hi=()=>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"})}),qi=()=>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"})}),Gi=()=>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"})}),Yi=()=>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"})}),Xi=()=>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"})]}),Ki=()=>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"})}),Zi=()=>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"})}),Ji=()=>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","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),Qi=()=>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"})]}),eo=()=>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"})}),to=()=>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"})}),no=()=>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"})]}),ro=()=>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"})]}),io=()=>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"})]}),oo=()=>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"})}),ao=t=>e(ie,Object.assign({component:Hi},t)),so=t=>e(ie,Object.assign({component:qi},t)),lo=t=>e(ie,Object.assign({component:Gi},t)),co=t=>e(ie,Object.assign({component:Yi},t)),uo=t=>e(ie,Object.assign({component:Xi},t)),ho=t=>e(ie,Object.assign({component:Ki},t)),fo=t=>e(ie,Object.assign({component:Zi},t)),po=t=>e(ie,Object.assign({component:Ji},t)),go=t=>e(ie,Object.assign({component:Qi},t)),mo=t=>e(ie,Object.assign({component:eo},t)),vo=t=>e(ie,Object.assign({component:to},t)),yo=t=>e(ie,Object.assign({component:no},t)),bo=t=>e(ie,Object.assign({component:ro},t)),wo=t=>e(ie,Object.assign({component:io},t)),xo=t=>e(ie,Object.assign({component:oo},t)),Co=()=>{const{options:e}=yi(),{customIcons:t}=e,n=(e,n,r)=>{const o=null==t?void 0:t[e];return o?i.createElement(o,r):i.createElement(n,r)};return{RootFolderIcon:e=>n("rootFolder",ae,e),FolderIcon:e=>n("folder",po,e),FolderOpenIcon:e=>n("folderOpen",me,e),AddFolderIcon:e=>n("addFolder",ge,e),FileIcon:e=>n("file",pe,e),UploadIcon:e=>n("upload",fe,e),UploadByUrlIcon:e=>n("uploadByUrl",he,e),ExpandArrowIcon:e=>n("expandArrow",de,e),CollapseArrowIcon:e=>n("collapseArrow",ue,e),ExpandFolderIcon:e=>n("expandArrow",Qr,e),CollapseFolderIcon:e=>n("collapseArrow",Jr,e),FolderPreviewIcon:e=>n("folderPreview",go,e),EmptyFolderIcon:e=>n("folderPreview",mo,e),GridViewIcon:e=>n("gridView",ce,e),ListViewIcon:e=>n("listView",le,e),DropZoneFileIcon:e=>n("folderPreview",vo,e),BigStockIcon:e=>n("folderPreview",yo,e),BigAIIcon:e=>n("folderPreview",bo,e),GifPlayIcon:e=>n("folderPreview",wo,e),StockBigIcon:e=>n("folderPreview",xo,e),MixedViewIcon:e=>n("mixedView",ao,e),LandscapeViewIcon:e=>n("landscapeView",so,e),PortraitViewIcon:e=>n("portraitView",lo,e),SquareViewIcon:e=>n("squareView",co,e),LightModeIcon:e=>n("lightMode",ho,e),DarkModeIcon:e=>n("darkMode",fo,e),AiIcon_2:e=>n("aiIcon_2",uo,e),NoFilesIcon:e=>n("noFiles",ei,e),getCustomIcon:n}};var _o="noFilesContainer",So="noFilesImage",ko="noFilesTitle",Ao="noFilesDescription";const Eo=()=>{const{t:n}=$n(),{NoFilesIcon:r}=Co();return t("div",{className:_o,children:[e(r,{className:So,size:48,strokeWidth:1.4}),e("h2",{className:ko,children:n("There's nothing here")}),e("div",{className:Ao,children:n("Try using a different search query.")})]})},Io="filemanager_view_mode";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 To=e=>{if(!e||e<=0)return"";const t=1048576;if(e<t){return`${Math.round(e/1024)} Kb`}return`${(e/t).toFixed(2)} Mb`};var Fo={headerContainer:"headerContainer",actionsContainer:"actionsContainer",filesContainer:"filesContainer",noFiles:"noFiles",paginationContainer:"paginationContainer",uploadIcon:"uploadIcon",tableContainer:"tableContainer",imagePreview:"imagePreview",fileManagerTableFolder:"fileManagerTableFolder",fileManagerTableFolderInner:"fileManagerTableFolderInner",sortSelect:"sortSelect",fileNameCol:"fileNameCol",fileItemCount:"fileItemCount",fileSize:"fileSize",fileDate:"fileDate",tableMenu:"tableMenu",tableImagePreview:"tableImagePreview",tableFolderIcon:"tableFolderIcon",buttonDeselected:"buttonDeselected",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",active:"active",blockText:"blockText",textTitle:"textTitle",textDescription:"textDescription",buttons:"buttons",btnAi:"btnAi",btnPhoto:"btnPhoto",dragOverlay:"dragOverlay",dragOverlayInner:"dragOverlayInner",noFilesIcon:"noFilesIcon",textTitle_trash:"textTitle_trash",textDescription_trash:"textDescription_trash"};const{Text:Oo}=P,{Option:Po}=M,Mo=({files:r,searchTerm:s,handleSearch:l,handleSort:d,sortBy:h,sortOrder:f,handleSortOptionChange:p,pagination:g,setPagination:m,loading:v,handleItemClick:y,selectedFiles:b,toggleFileSelection:w,handleDroppedFiles:x,onRename:C,onDelete:_,onCopy:S,onMove:k,onEdit:A,fileUpload:I,handleAddFile:T})=>{var F;const{t:O}=$n(),{DropZoneFileIcon:P,BigStockIcon:q,BigAIIcon:G,FolderIcon:Y}=Co(),{options:X,actions:K,state:Z}=yi(),{dataProviders:J,config:Q}=X,ee=null==Q?void 0:Q.disablePagination,{setCurrentMenuFile:te,setSelectedFiles:ne,setActiveLibraryItem:re}=K,ie="Trash"===(null==Z?void 0:Z.selectedFolder),{viewMode:oe,setViewMode:ae}=(()=>{const[e,t]=o(()=>{try{return localStorage.getItem(Io)||"table"}catch(e){return"table"}}),n=c(e=>{t(e);try{localStorage.setItem(Io,e)}catch(e){console.warn("Не удалось сохранить режим отображения:",e)}},[]),r=c(()=>{n("table"===e?"grid":"table")},[e,n]);return{viewMode:e,setViewMode:n,toggleViewMode:r}})(),[se,le]=o(!1),[ce,ue]=o({}),[de,he]=o(null),[fe,pe]=o(!1),ge=u(0);a(()=>{const e=()=>{pe(window.innerWidth<1200)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const me=b.size,ve=(null==Q?void 0:Q.features)||{},ye=i.useMemo(()=>Array.from(b)[0],[b]),be=i.useMemo(()=>ye?r.find(e=>e.id===ye):void 0,[ye,r]),we=(null==be?void 0:be.isFolder)?!1!==(null==ve?void 0:ve.enableRenameFolder):!1!==(null==ve?void 0:ve.enableRenameFile),xe=null==Q?void 0:Q.iconStrokeWidth,Ce=e=>{const t=e.extension?e.extension:e.name&&e.name.includes(".")?e.name.split(".").pop():e.type?(e=>{var t,n;if(e&&e.startsWith("image/"))return null===(n=null===(t=e.split("/")[1])||void 0===t?void 0:t.split(";")[0])||void 0===n?void 0:n.trim()})(e.type):void 0,n=(e=>!!e&&un.includes(e.toLowerCase()))(t);return n},_e=i.useMemo(()=>!(1!==me||!be||be.isFolder)&&Ce(be),[me,be]),Se=`${h}-${f}`,ke=i.useMemo(()=>Array.isArray(r)&&r.some(e=>(e=>{if(!e)return!1;const t=new Date(e);return!Number.isNaN(t.getTime())})(e.date)),[r]),Ae=c(async e=>{try{if(null==J?void 0:J.getChildrenCount)return await J.getChildrenCount("folders"===e?void 0:e);if(null==J?void 0:J.getFiles){const{files:t,pagination:n}=await J.getFiles({folderId:"folders"===e?void 0:e,itemType:"all"});return(null==n?void 0:n.total)||t.filter(e=>!e.isFolder).length}return 0}catch(t){return console.error(`Ошибка при получении количества файлов для папки ${e}:`,t),0}},[J]),Ee=c(async()=>{const e=r.filter(e=>e.isFolder);if(0===e.length)return;const t={},n=e.map(async e=>{t[e.id]=await Ae(e.id)});await Promise.all(n),ue(t)},[r,Ae]);a(()=>{Ee()},[Ee]);const Ie=c(e=>{e.preventDefault(),e.stopPropagation(),ge.current+=1,e.dataTransfer.types&&e.dataTransfer.types.includes("Files")&&le(!0)},[]),Te=c(e=>{e.preventDefault(),e.stopPropagation(),ge.current-=1,0===ge.current&&le(!1)},[]),Fe=c(e=>{e.preventDefault(),e.stopPropagation()},[]),Oe=c(e=>{if(e.preventDefault(),e.stopPropagation(),le(!1),ge.current=0,e.dataTransfer.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);x(t).catch(e=>{console.error("Ошибка при загрузке файлов:",e)})}},[x]),Pe=c((e=()=>{})=>{if(de)return;const t=setTimeout(()=>{e(),he(null)},300);he(t)},[de]),Me=c(e=>{de&&(clearTimeout(de),he(null)),e()},[de]),Re=c(t=>{const n=[];!t.isFolder&&!1!==(null==ve?void 0:ve.enableEdit)&&Ce(t)&&n.push({key:"edit",label:O("Edit"),icon:e(Xr,{size:16,strokeWidth:xe})}),(t.isFolder?!1!==(null==ve?void 0:ve.enableMoveFolder):!1!==(null==ve?void 0:ve.enableMoveItem))&&n.push({key:"move",label:O("Move to"),icon:e(Zr,{size:16,strokeWidth:xe})}),(t.isFolder?!1!==(null==ve?void 0:ve.enableCopyFolder):!1!==(null==ve?void 0:ve.enableCopyItem))&&n.push({key:"copy",label:O("Copy"),icon:e(Yr,{size:16,strokeWidth:xe})});return(t.isFolder?!1!==(null==ve?void 0:ve.enableRenameFolder):!1!==(null==ve?void 0:ve.enableRenameFile))&&n.push({key:"rename",label:O("Rename"),icon:e(ui,{size:16,strokeWidth:xe})}),!1!==ve.enableDelete&&n.push({key:"delete",label:O("Delete"),icon:e(di,{size:16,strokeWidth:xe}),style:{color:"#ff4d4f"}}),n},[ve,O,xe]),Le=e=>({key:t})=>{const n=r.find(t=>t.id===e);switch(te&&(null==n?void 0:n.id)&&te(null==n?void 0:n.id),t){case"edit":A(n);break;case"move":k();break;case"copy":S();break;case"rename":C(e);break;case"delete":_(n);break;default:te&&te("")}},je=[{key:"selection",width:46,render:(t,n)=>e(R,{checked:b.has(n.id),onChange:()=>w(n.id)})},{key:"preview",width:60,render:(t,n)=>n.isFolder?e("div",{className:Fo.fileManagerTableFolder,children:e("div",{className:Fo.fileManagerTableFolderInner,children:e(Y,{className:Fo.tableFolderIcon,style:{width:40,height:40}})})}):e(Wi,{className:`${Fo.imagePreview} ${Fo.tableImagePreview}`,src:n.thumbnail||n.thumbnailUrl||n.url,alt:n.name,width:40,height:40,preview:!0,file:n})},{title:O("Name"),width:"calc(100% - 430px)",dataIndex:"name",key:"name",className:Fo.fileNameCol,render:(e,n)=>{const r=n.isFolder&&ce[n.id]||0,i=O(1===r?"item":"items");return t("div",{className:Fo.fileName,children:[e||O("No name"),n.isFolder&&t("div",{className:Fo.fileItemCount,children:[r," ",i]})]})}},{title:O("Dimensions"),key:"dimensions",width:100,render:(t,n)=>n.dimensions&&e("div",{className:Fo.fileSize,children:n.dimensions})},{title:O("Size"),key:"size",width:90,render:(t,n)=>!(null==n?void 0:n.size)||n.isFolder?null:e("div",{className:Fo.fileSize,children:To(n.size)})},{title:O("Type"),key:"type",width:90,render:(t,n)=>{var r,i,o;if(n.isFolder)return e("div",{className:Fo.fileSize,children:O("Folder")});const a=n.extension||(null===(r=n.name.split(".").pop())||void 0===r?void 0:r.toLowerCase())||(n.url?null===(o=null===(i=n.url.split("?")[0].split("/").pop())||void 0===i?void 0:i.split(".").pop())||void 0===o?void 0:o.toLowerCase():"")||"";return e("div",{className:Fo.fileSize,children:a})}},...ke?[{title:O("Date"),dataIndex:"date",key:"date",width:200,render:(t,n)=>{const r=n.date;if(!r)return null;const i=new Date(r);if(isNaN(i.getTime()))return null;const o=e=>`${e.getDate()} ${[O("months.january"),O("months.february"),O("months.march"),O("months.april"),O("months.may"),O("months.june"),O("months.july"),O("months.august"),O("months.september"),O("months.october"),O("months.november"),O("months.december")][e.getMonth()]} ${e.getFullYear()}`;return e(L,{title:O("Added",{date:o(i)}),placement:"bottom",className:Fo.fileDate,children:O("Added",{date:o(i)})})}}]:[],{width:40,title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),render:(t,n)=>e(j,{arrow:!0,placement:"bottom",menu:{items:Re(n),onClick:Le(n.id)},trigger:["hover"],children:e("span",{className:`${Fo.tableMenu} tableMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(Kr,{size:16,strokeWidth:xe})})})}],De="table"===oe?e(E,{renderEmpty:()=>e(V,{image:e(n,{}),description:""}),children:e(U,{dataSource:r,columns:je,rowKey:"id",pagination:!1,loading:v,rowClassName:e=>(null==b?void 0:b.has(e.id))?Fo.selectedRow:"",tableLayout:"fixed",onRow:e=>({onClick:t=>{const n=t.target;Pe(()=>{t.stopPropagation(),t.preventDefault();const r=!!n.closest(".ant-image")||!!n.closest(".ant-image-preview-wrap"),i=!!n.closest(".tableMenuButton"),o=!!n.closest(".ant-dropdown-menu");r||i||o||w(e.id,{metaKey:t.metaKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey})})},onDoubleClick:t=>{Me(()=>{t.stopPropagation(),t.preventDefault();const n=t.target;n.closest(".ant-checkbox-wrapper")||n.closest(".tableMenu")||(e.isFolder?y(e):n.closest(".ant-image")||n.closest(".ant-image-preview-wrap")||!X.onEditorOk||(console.warn("onEditorOk"),X.onEditorOk(e)))})}}),showHeader:!1})}):e($,{gutter:[16,16],className:Fo.gridRow,style:{gap:20,padding:"0 24px 24px",margin:0},children:r.map(r=>e(W,{className:Fo.gridCard_col,style:{padding:0},children:t(H,{hoverable:!0,cover:e("div",{className:r.isFolder?Fo.gridPreviewContainerFolder:Fo.gridPreviewContainer,onClick:e=>{e.stopPropagation(),r.isFolder&&Pe(()=>{w(r.id,{metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey})})},onDoubleClick:e=>{e.stopPropagation(),Me(()=>{r.isFolder&&y(r)})},children:r.isFolder?e("div",{className:Fo.gridFolderIcon,children:e(Y,{className:Fo.gridFolderIconImage})}):e(Wi,{src:r.thumbnail||r.thumbnailUrl||r.url,alt:r.name,className:Fo.gridImagePreview,preview:!0,file:r})}),className:`${Fo.gridCard} ${(null==b?void 0:b.has(r.id))?Fo.gridCardSelected:""}`,onClick:e=>{e.stopPropagation(),e.preventDefault();const t=e.target;t.closest(".gridFileMenuButton")||t.closest(".ant-dropdown-menu")||Pe(()=>w(r.id,{metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey}))},onDoubleClick:e=>{e.stopPropagation(),Me(()=>{r.isFolder&&y(r)})},children:[t("div",{className:Fo.gridCardContent,onDoubleClick:e=>{e.stopPropagation(),e.preventDefault(),Me(()=>{r.isFolder?y(r):X.onEditorOk&&X.onEditorOk(r)})},onClick:e=>{e.stopPropagation(),e.preventDefault();const t=e.target;t.closest(".gridFileMenuButton")||t.closest(".ant-dropdown-menu")||Pe(()=>w(r.id,{metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey}))},children:[e("div",{className:Fo.gridFileName,children:r.name||O("Untitled")}),e("div",{className:Fo.gridFileInfo,children:r.isFolder?(()=>{const e=ce[r.id]||0;return`${e} ${O(1===e?"item":"items")}`})():t(n,{children:[r.dimensions&&`${r.dimensions} • `,r.size&&`${To(r.size)} • `,r.extension&&`${r.extension}`]})})]}),e("div",{className:Fo.gridFileMenu,children:e(j,{menu:{items:Re(r),onClick:Le(r.id)},arrow:!0,placement:"bottom",trigger:["hover"],children:e(D,{type:"default",className:`${Fo.gridFileMenuButton} gridFileMenuButton`,onClick:()=>{},children:e(Kr,{size:16,strokeWidth:xe})})},r.id)}),e("div",{onClick:e=>{e.stopPropagation()},className:Fo.gridCheckbox,children:e(R,{checked:b.has(r.id),style:{height:20},onChange:e=>{e.stopPropagation(),w(r.id)}})})]})},r.id))}),Ne=null===(F=null==Q?void 0:Q.availableImageExtensions)||void 0===F?void 0:F.map(e=>"."+e).join(", "),ze=t("div",ie?{className:`${Fo.noFiles} ant-layout-sider-light`,children:[e(hi,{size:48,className:Fo.noFilesIcon}),e("div",{className:`${Fo.textTitle_trash} ant-menu-submenu-title`,children:O("Trash is empty")}),e("div",{className:`${Fo.textDescription_trash} ant-menu-submenu-title`,children:O("Deleted files will be displayed here")})]}:{className:Fo.uploadContainer,children:[t("div",{className:`${Fo.uploadArea} ${se?Fo.active:""}`,onClick:T,onDragOver:Fe,onDragLeave:Te,onDragEnter:Ie,onDrop:Oe,children:[e("div",{className:Fo.uploadIcon,children:e(P,{})}),e("div",{className:Fo.textTitle,children:O("Select a file or drag and drop it here")}),e("div",{className:Fo.textDescription,children:O("Supported files:")+" "+(Ne||"jpeg, .svg, .png")})]}),t("div",{className:Fo.buttons,children:[t("button",{className:Fo.btnPhoto,onClick:()=>{re&&re(tn)},children:[e("div",{className:Fo.icon,children:e(q,{})}),t("div",{className:Fo.blockText,children:[e("div",{className:Fo.textTitle,children:O("Stock")}),e("div",{className:Fo.textDescription,children:O("Select an image from our library")})]})]}),t("button",{className:Fo.btnAi,onClick:()=>{re&&re(nn)},children:[e("div",{className:Fo.icon,children:e(G,{})}),t("div",{className:Fo.blockText,children:[e("div",{className:Fo.textTitle,children:O("AI generation")}),e("div",{className:Fo.textDescription,children:O("Creating an image on demand")})]})]})]})]});return e("div",{className:"content-layout",children:t("div",{className:Fo.filesContainer,onDragOver:Fe,onDragLeave:Te,onDragEnter:Ie,onDrop:Oe,children:[se&&0!==(null==r?void 0:r.length)&&e("div",{className:Fo.dragOverlay,children:t("div",{className:Fo.dragOverlayInner,children:[e("div",{className:Fo.uploadIcon,children:e(P,{})}),e("div",{className:Fo.textTitle,children:O("Drop files to upload")}),e("div",{className:Fo.textDescription,children:O("Supported files:")+" "+(Ne||"jpeg, .svg, .png")})]})}),v||0!==(null==r?void 0:r.length)||s?t("div",{className:Fo.tableContainer,children:[t("div",me?{className:`header-container ${Fo.headerContainer}`,children:[t(Oo,{type:"secondary",className:"selected-text",children:[t("div",{children:[me," ",O("selected")]}),e(L,{title:fe?O("Deselected"):null,children:e(D,{className:Fo.buttonDeselected,icon:e(si,{size:16,strokeWidth:xe}),onClick:()=>ne&&ne(new Set),children:O("Deselected")})})]}),t(N,{children:[_e&&!1!==(null==ve?void 0:ve.enableEdit)&&e(L,{title:fe?O("Edit"):null,children:e(D,{icon:e(Xr,{size:16,strokeWidth:xe}),onClick:()=>{A(be)},disabled:!_e,children:O("Edit")})}),Array.from(b).every(e=>{const t=r.find(t=>t.id===e);return!!t&&(t.isFolder?!1!==(null==ve?void 0:ve.enableMoveFolder):!1!==(null==ve?void 0:ve.enableMoveItem))})&&e(L,{title:fe?O("Move to"):null,children:e(D,{icon:e(Zr,{size:16,strokeWidth:xe}),onClick:k,children:O("Move to")})}),Array.from(b).every(e=>{const t=r.find(t=>t.id===e);return!!t&&(t.isFolder?!1!==(null==ve?void 0:ve.enableCopyFolder):!1!==(null==ve?void 0:ve.enableCopyItem))})&&e(L,{title:fe?O("Copy"):null,children:e(D,{icon:e(Yr,{size:16,strokeWidth:xe}),onClick:S,children:O("Copy")})}),1===me&&we&&e(L,{title:fe?O("Rename"):null,children:e(D,{icon:e(ui,{size:16,strokeWidth:xe}),onClick:()=>C(),disabled:1!==me||!we,children:O("Rename")})}),!1!==(null==ve?void 0:ve.enableDelete)&&e(L,{title:fe?O("Delete"):null,children:e(D,{danger:!0,icon:e(di,{size:16,strokeWidth:xe}),onClick:e=>{e.stopPropagation(),e.preventDefault(),_()},children:O("Delete")})})]})]}:{className:Fo.headerContainer,children:[e("div",{className:"search-container",children:e(Bi,{placeholder:O("Search file or folder"),onSearch:l,className:Fo.searchInput})}),t("div",{className:Fo.actionsBox,children:[e("div",{className:"sort-container",children:t(M,{value:Se,onChange:p,className:Fo.sortSelect,popupMatchSelectWidth:!1,suffixIcon:e(qr,{size:16,strokeWidth:xe}),children:[e(Po,{value:"date-desc",children:O("Newest first")}),e(Po,{value:"date-asc",children:O("Oldest first")}),e(Po,{value:"size-desc",children:O("Largest first")}),e(Po,{value:"size-asc",children:O("Smallest first")}),e(Po,{value:"name-asc",children:O("A-Z")}),e(Po,{value:"name-desc",children:O("Z-A")}),e(Po,{value:"type-asc",children:O("By type")})]})}),e("div",{className:Fo.actionsContainer,children:e(z,{options:[{value:"grid",icon:e(ti,{size:16,strokeWidth:xe})},{value:"table",icon:e(ii,{size:20,strokeWidth:xe})}],value:oe,onChange:e=>ae(e)})})]})]}),s&&!r.length?e(Eo,{}):De,!ee&&g.total>g.pageSize&&e("div",{className:Fo.paginationContainer,children:e(B,{current:g.current,pageSize:g.pageSize,total:g.total,onChange:(e,t)=>m({current:e,pageSize:t,total:g.total}),showSizeChanger:!0,showTotal:e=>O("total pages",{total:e})})})]}):ze]})})};var Ro="folderTree",Lo="emptyFolderContainer",jo="folderItemContainer",Do="folderLabel",No="folderLabelItem",zo="fileCount",Bo="foldersTitle",Uo="foldersTitleItem",Vo="folderMenu";const $o=({selectedFolder:n,onSelect:r,onExpand:i,generateMenuItems:s,fetchChildFolders:l,disabledFolders:u=[],showFileCounts:h=!1,folderFileCounts:f={},className:p="",expandedKeys:g,setExpandedKeys:m,showTrashFolder:v=!1,mode:y="navigation",defaultExpandAll:b=!1})=>{const{t:w}=$n(),{options:x}=yi(),{config:C}=x,{ExpandArrowIcon:_,CollapseArrowIcon:S,CollapseFolderIcon:k,ExpandFolderIcon:A,EmptyFolderIcon:E}=Co(),I=c(e=>{const t=[],n=e=>{e.forEach(e=>{t.push(e.key),e.children&&n(e.children)})};return n(e),t},[]),[T,F]=o(()=>{if(b||"selection"===y&&b){const e=s();return I(e)}return[]}),O=void 0!==g?g:T,P=void 0!==m?m:F;a(()=>{if(b||"selection"===y&&b){const e=s(),t=I(e);void 0===g&&F(t)}},[b,y,s,I,g]);const M=c(async e=>{const t=e[0];t&&"empty"!==t&&!t.endsWith("_input")&&(null==r||r(e),await(null==l?void 0:l("folders"===t?null:t)))},[r,l]),R=c(async(e,t)=>{var n;P(e),null==i||i(e,t);if(!("lazy"===(null==C?void 0:C.folderTreeLoading)))return;const r=(null===(n=null==t?void 0:t.node)||void 0===n?void 0:n.key)||void 0;if(r&&"folders"!==r)try{await(null==l?void 0:l(r))}catch(e){console.warn("Failed to load child folders for",r,e)}},[null==C?void 0:C.folderTreeLoading,l,i,P]),L=c(()=>{var r,i;const o=s(),a=e=>e.filter(e=>"Trash"!==e.key).map(e=>Object.assign(Object.assign({},e),{children:e.children?a(e.children):void 0})),l=v?a(o):o,c=e=>{"selection"!==y?(O.includes(e)&&n===e?P(O.filter(t=>t!==e)):O.includes(e)||P([...O,e]),M([e])):M([e])},d=0===l.length||1===l.length&&(!l[0].children||0===l[0].children.length),p=n=>{var r;const i=h&&f[n.key]||0,o=O.includes(n.key),a=u.includes(n.key),s=(()=>{var t;return(null===(t=n.children)||void 0===t?void 0:t.length)?e(o?k:A,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}):e(E,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth})})(),l=t("div",{className:`${jo} folder-item-container`,onClick:()=>!a&&c(n.key),style:{opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},children:[t("div",{className:Do,children:[n.icon||s,e("span",{className:No,children:n.label})]}),h&&e("div",{className:zo,title:`${i} ${1===i?"file":"files"}`,children:i})]});return{key:n.key,title:l,children:null===(r=n.children)||void 0===r?void 0:r.map(p),disabled:a}},g=O.includes("folders"),m=e("div",{className:Bo,onClick:()=>c("folders"),children:t("div",{className:Uo,children:[e(g?k:A,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:`${No} folder-label-item`,children:"folders"===(null===(r=l[0])||void 0===r?void 0:r.key)?l[0].label:w("Folders")})]})}),b=()=>({key:"Trash",title:e("div",{className:Bo,onClick:()=>c("Trash"),children:t("div",{className:Uo,children:[e(di,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:No,children:w("Trash")})]})}),children:void 0});if(d){if(!v)return[{key:"empty",title:e("div",{className:Lo,children:w("No folders yet")}),disabled:!0}];const t=[];return l.length>0&&"folders"===l[0].key&&t.push({key:"folders",title:m,children:[]}),t.push(b()),t}if(l.length>0&&"folders"===l[0].key){const e=[{key:"folders",title:m,children:null===(i=l[0].children)||void 0===i?void 0:i.map(p)}];return v&&e.push(b()),e}return l.map(p)},[s,O,k,null==C?void 0:C.iconStrokeWidth,A,w,n,M,h,f,E,u,v,y,P]),j=d(()=>L(),[L]);return e(q,{className:`${Ro} ${Vo} ${p}`,selectedKeys:n?[n]:[],expandedKeys:O,onSelect:M,onExpand:R,treeData:j,switcherIcon:({expanded:t})=>e(t?S:_,{}),showLine:!1})};var Wo={formFooter:"formFooter",folderButton:"folderButton",foldersWrapper:"foldersWrapper",formItem:"formItem",folderToolsField:"folderToolsField",closeIcon:"closeIcon"};const Ho=f(({folderId:r,activeFormField:i,EmptyFolderIcon:o,targetForm:a,handleModalOk:s,onComplete:l,t:u,setIsLoading:d})=>{const h=c(()=>{a.setFieldsValue({folderName:""})},[a]),f=c(()=>{d(!0),s(a).then(e=>{l(null==e?void 0:e.id)}).finally(()=>d(!1))},[s,a,l,d]);return e(T.Item,{className:"form-item form-item-moveto "+(i===r?"form-item_active":""),name:"folderName",initialValue:u("New folder"),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(u("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{className:"form-input",autoFocus:!0,prefix:e(o,{style:{marginRight:6}}),suffix:t(n,{children:[e(L,{placement:"top",title:"Clean",children:e(D,{icon:e(ve,{style:{fontSize:10}}),className:Wo.inputButtonClose,type:"text",onClick:h})}),e(D,{className:Wo.inputButtonOk,type:"text",onClick:()=>{d(!0),f()},children:"Создать"})]})})})});Ho.displayName="CustomFolderInput";const qo=({isModalVisible:r,handleModalOk:i,handleModalCancel:s,form:l,selectedFolder:u,folders:h,isUrlModalVisible:f,setIsUrlModalVisible:p,handleAddFileByUrl:g,urlForm:m,isRenameModalVisible:v,handleRenameOk:y,handleRenameCancel:b,renameForm:w,fileToRename:x,files:C,isMoveModalVisible:_,handleMoveOk:S,handleMoveCancel:k,moveForm:A,selectedFiles:E,isRenameFolderModalVisible:I,handleRenameFolderOk:O,handleRenameFolderCancel:P,renameFolderForm:M,folderToRename:R,isCopyModalVisible:L,handleCopyOk:j,handleCopyCancel:N,copyForm:z,isDeleteConfirmVisible:B,handleDeleteConfirmOk:U,handleDeleteConfirmCancel:V,fetchChildFolders:$})=>{var W,H,q;const{t:Y}=$n(),{state:X,actions:K,options:Z}=yi(),{setCurrentMenuFile:J}=K,{config:Q}=Z,{currentMenuFile:ee}=X,te=T.useWatch("folderName",l),{EmptyFolderIcon:ne}=Co(),[re,ie]=o(""),[oe,ae]=o(!1),se=!te||0===String(te).trim().length,le=d(()=>Array.isArray(C)?C:[],[C]),ce=x?null===(W=le.find(e=>e.id===x))||void 0===W?void 0:W.name:"",ue=Array.isArray(h)?h:[],de=R?null===(H=ue.find(e=>e.id===R))||void 0===H?void 0:H.name:"";a(()=>{if(B){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)}},[B]);const he=x?le.find(e=>e.id===x):null,fe=(null==he?void 0:he.isFolder)||(null==x?void 0:x.startsWith("folder_")),pe=c(async e=>{e.length>0&&(A.setFieldsValue({targetFolder:e[0]}),re!==e[0].toString()&&ie(""))},[A,re]),ge=c(async e=>{e.length>0&&(z.setFieldsValue({targetFolder:e[0]}),re!==e[0].toString()&&ie(""))},[re,z]),me=d(()=>Array.from(E).filter(e=>{const t=le.find(t=>t.id===e);return(null==t?void 0:t.isFolder)||h.some(t=>t.id===e)}),[E,le,h]),ye=c((t,n)=>{const r=r=>e(Ho,{folderId:r,activeFormField:re,EmptyFolderIcon:ne,targetForm:t,handleModalOk:i,onComplete:n,setIsLoading:ae,t:Y},r);return r.displayName="CustomInputComponent",r},[ne,re,i,Y]),be=c(e=>{const{folderId:t,targetForm:n,onTreeSelect:r,onComplete:i}=e;return{handleAddFolder:e=>{e.preventDefault(),e.stopPropagation(),ie(t),n.setFieldsValue({folderName:Y("New folder"),targetFolder:t})},handleSelectFolder:e=>{e.preventDefault(),e.stopPropagation(),r([t]).then(()=>i(t))}}},[Y]),we=c(r=>{const{targetForm:i,onTreeSelect:o,onComplete:a,actionButtonText:s}=r,l=ye(i,a),c=(r=null,d=new Set)=>h.filter(e=>{if("Trash"===e.id)return!1;const t=null===r&&!e.parentId,n=e.parentId===r;return t||n}).map(r=>{if(d.has(r.id))return{key:r.id,label:`${r.name} ${Y("(circular reference)")}`};const h=new Set(d);h.add(r.id);const f=c(r.id,h),{handleAddFolder:p,handleSelectFolder:g}=be({folderId:r.id,targetForm:i,onTreeSelect:o,onComplete:a}),m=re===r.id?[{key:`${r.id}_input`,label:l(r.id),icon:null},...f]:f;return{key:r.id,label:t(n,{children:[r.name,u!==r.id&&t("div",{className:`${Wo.folderToolsField} folder-tools-field`,children:[e(D,{onClick:p,children:"+"}),e(D,{onClick:g,children:s})]})]}),children:m}}),d=c();console.log("treeNodes",d);const{handleAddFolder:f,handleSelectFolder:p}=be({folderId:"folders",targetForm:i,onTreeSelect:o,onComplete:a}),g="folders"===re?[{key:"folders_input",label:l("folders"),icon:null},...d]:d;return[{key:"folders",label:t(n,{children:[Y("Folders"),"folders"!==u&&t("div",{className:`${Wo.folderToolsField} folder-tools-field`,children:[e(D,{onClick:f,children:"+"}),e(D,{onClick:p,children:s})]})]}),children:g}]},[Y,u,re,h,ye,be]);return t(n,{children:[e(G,{title:e("div",{className:"modal-title",children:Y("Creating a new folder")}),open:r,onOk:()=>i(),onCancel:s,okText:Y("Create"),cancelText:Y("Cancel"),okButtonProps:{disabled:se,loading:oe},cancelButtonProps:{disabled:oe},afterClose:()=>ae(!1),children:t(T,{form:l,layout:"vertical",children:[e(T.Item,{name:"folderName",label:e("div",{className:"form-label",children:Y("Folder name")}),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Y("Enter the name of the folder"))):Promise.resolve()}],initialValue:Y("New folder"),className:"form-item",style:{marginBottom:5},children:e(F,{autoFocus:!0,className:"form-input",disabled:oe,onPressEnter:async()=>{ae(!0);try{await l.validateFields(),se||await i()}catch(e){console.warn("Validation failed"),ae(!1)}}})}),e("div",{children:u&&"folders"!==u?t("p",{className:"fm-note",children:[Y("A folder will be created inside:")," ",(null===(q=ue.find(e=>e.id===u))||void 0===q?void 0:q.name)||Y("selected folder"),"."]}):e("p",{className:"fm-note",children:Y("The folder will be created in the root directory.")})})]})}),e(G,{title:e("div",{className:"modal-title",children:Y("Upload file by URL")}),open:f,onOk:async()=>{ae(!0);try{await m.validateFields();await g(null)||ae(!1)}catch(e){console.warn("Validation failed"),ae(!1)}},onCancel:()=>p(!1),okText:Y("Download"),okButtonProps:{loading:oe},cancelText:Y("Cancel"),cancelButtonProps:{disabled:oe},afterClose:()=>ae(!1),children:e(T,{form:m,layout:"vertical",children:e(T.Item,{name:"fileUrl",label:e("div",{className:"form-label",children:Y("File URL")}),rules:[{required:!0,message:Y("Enter the URL of the image")}],className:"form-item",children:e(F,{className:"form-input",placeholder:"https://example.com/image.jpg",autoFocus:!0,disabled:oe,onPressEnter:async()=>{ae(!0);try{await m.validateFields();await g(null)||ae(!1)}catch(e){console.warn("Validation failed"),ae(!1)}}})})})}),e(G,{title:e("div",{className:"modal-title",children:fe?`${Y("Rename folder")} ${ce}`:Y("Rename file",{currentFileName:ce})}),open:v,onOk:y,okText:Y("Rename"),okButtonProps:{loading:oe},onCancel:b,cancelText:Y("Cancel"),cancelButtonProps:{disabled:oe},afterClose:()=>{ae(!1),J&&J("")},children:e(T,{form:w,layout:"vertical",children:e(T.Item,{name:"newFileName",label:e("div",{className:"form-label",children:Y(fe?"New folder name":"New file name")}),rules:[{required:!0,message:Y(fe?"Enter a new folder name":"Enter a new file name")}],className:"form-item",children:e(F,{autoFocus:!0,className:"form-input",disabled:oe,onPressEnter:async()=>{ae(!0);try{await w.validateFields(),y()}catch(e){console.warn("Validation failed"),ae(!1)}}})})})}),e(G,{title:e("div",{className:"modal-title",children:Y("Move to")}),open:_,onCancel:k,footer:t("div",{className:Wo.formFooter,children:[t(D,{className:Wo.folderButton,onClick:()=>{A.setFieldsValue({targetFolder:"folders",folderName:Y("New folder"),is_force_create:!0}),setTimeout(()=>{ae(!0),i(A).then(e=>{S(null==e?void 0:e.id)}).finally(()=>ae(!1))},0)},loading:oe,children:[e(Qr,{size:18,strokeWidth:null==Q?void 0:Q.iconStrokeWidth}),Y("Create folder")]}),e(D,{type:"primary",className:Wo.folderButton,onClick:k,loading:oe,children:Y("Done")})]}),afterClose:()=>{J&&J(""),ie(""),ae(!1)},loading:oe,children:e(T,{form:A,layout:"vertical",initialValues:{targetFolder:"folders",folderName:Y("New folder"),is_force_create:!1},children:t("div",{className:Wo.foldersWrapper,children:[e(T.Item,{name:"targetFolder",rules:[{required:!0,message:Y("Select the destination folder")}],className:Wo.formItem,children:e($o,{onSelect:pe,generateMenuItems:()=>we({targetForm:A,onTreeSelect:pe,onComplete:S,actionButtonText:Y("Move here")}),fetchChildFolders:$,disabledFolders:me,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(T.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Y("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{})}),e(T.Item,{name:"is_force_create",style:{display:"none"},children:e(F,{})})]})})}),e(G,{title:e("div",{className:"modal-title",children:Y("Copy to folder")}),open:L,onCancel:N,footer:t("div",{className:Wo.formFooter,children:[t(D,{className:Wo.folderButton,onClick:()=>{z.setFieldsValue({targetFolder:"folders",folderName:Y("New folder"),is_force_create:!0}),setTimeout(()=>{ae(!0),i(z).then(e=>{j(null==e?void 0:e.id)}).finally(()=>ae(!1))},0)},loading:oe,children:[e(Qr,{size:18,strokeWidth:null==Q?void 0:Q.iconStrokeWidth}),Y("Create folder")]}),e(D,{type:"primary",className:Wo.folderButton,onClick:N,loading:oe,children:Y("Done")})]}),afterClose:()=>{J&&J(""),ie(""),ae(!1)},loading:oe,children:e(T,{form:z,layout:"vertical",initialValues:{targetFolder:"folders",folderName:Y("New folder"),is_force_create:!1},children:t("div",{className:Wo.foldersWrapper,children:[e(T.Item,{name:"targetFolder",rules:[{required:!0,message:Y("Select the destination folder")}],className:Wo.formItem,children:e($o,{onSelect:ge,generateMenuItems:()=>we({targetForm:z,onTreeSelect:ge,onComplete:j,actionButtonText:Y("Copy here")}),fetchChildFolders:$,disabledFolders:me,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(T.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Y("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{})}),e(T.Item,{name:"is_force_create",style:{display:"none"},children:e(F,{})})]})})}),e(G,{title:t("div",{className:"modal-title",children:[Y("Rename folder")," ",de]}),open:I,onOk:O,onCancel:P,okText:Y("Rename"),cancelText:Y("Cancel"),okButtonProps:{loading:oe},cancelButtonProps:{disabled:oe},afterClose:()=>{ae(!1),J&&J("")},children:e(T,{form:M,layout:"vertical",children:e(T.Item,{name:"newFolderName",label:e("div",{className:"form-label",children:Y("New folder name")}),rules:[{required:!0,message:Y("Enter a new folder name")}],className:"form-item",children:e(F,{autoFocus:!0,className:"form-input",disabled:oe,onPressEnter:async()=>{ae(!0);try{await M.validateFields(),O()}catch(e){console.warn("Validation failed"),ae(!1)}}})})})}),e(G,{className:`${Wo.deleteModal} deleteModal`,title:(()=>{const t=!!(null==Q?void 0:Q.enableTrashFolder)&&"Trash"===u||!(null==Q?void 0:Q.enableTrashFolder),n=Y(t?"Permanently delete":"Move to Trash");return e("div",{className:"modal-title",children:n})})(),open:!!B,onOk:()=>{ae(!0);try{U&&U()}catch(e){console.error(e),ae(!1)}},onCancel:()=>V&&V(),okText:(null==Q?void 0:Q.enableTrashFolder)&&"Trash"===u?Y("Delete permanently"):(null==Q?void 0:Q.enableTrashFolder)?Y("Move to Trash"):Y("Delete"),cancelText:Y("Cancel"),okButtonProps:{danger:!(null==Q?void 0:Q.enableTrashFolder)||"Trash"===u,loading:oe},cancelButtonProps:{disabled:oe},afterClose:()=>{ae(!1),J&&J("")},closeIcon:e(ve,{className:Wo.closeIcon}),children:(()=>{var t,n;const r=(ee?[ee]:Array.from(E||[])).map(e=>le.find(t=>t.id===e)).filter(e=>!!e),i=r.filter(e=>e.isFolder||e.id.startsWith("folder_")),o=r.filter(e=>!(e.isFolder||e.id.startsWith("folder_"))),a=r.length,s=i.length,l=o.length,c=!!(null==Q?void 0:Q.enableTrashFolder);if(!c||c&&"Trash"===u){if(1===a&&1===s){const n=i[0],r=(null==n?void 0:n.name)||"",o=null!==(t=null==n?void 0:n.childCount)&&void 0!==t?t:0;return e("div",{children:Y("delete_folder_permanent",{name:r,count:o})})}return e("div",0===s&&l>0?{children:Y("delete_files_permanent",{count:l})}:{children:Y("delete_mixed_permanent",{total:a,folders:s,images:l})})}if(1===a&&1===s){const t=i[0],r=(null==t?void 0:t.name)||"",o=null!==(n=null==t?void 0:t.childCount)&&void 0!==n?n:0;return e("div",{children:Y("move_folder_to_trash",{name:r,count:o})})}return e("div",0===s&&l>0?{children:Y("move_files_to_trash",{count:l})}:{children:Y("move_mixed_to_trash",{total:a,folders:s,images:l})})})()})]})};var Go={button:"button",folderActions:"folderActions",uploadButton:"uploadButton",foldersContainer:"foldersContainer",buttonWrapper:"buttonWrapper",uploadButtonTitle:"uploadButtonTitle"};const Yo=f(p(({selectedFolder:n,generateMenuItems:r,onFolderSelect:i,folders:s,fetchChildFolders:l,handleAddFile:h,setIsUrlModalVisible:f,handleCreateFolder:p,activeLibraryItem:m,setActiveLibraryItem:v},y)=>{const b=d(()=>Array.isArray(s)?s:[],[s]),{t:w}=$n(),x=_i(),[C,_]=o({}),{options:S}=yi(),{dataProviders:k,config:A}=S,E=c(e=>{const t=[],n=e=>{e.forEach(e=>{t.push(e.key),e.children&&n(e.children)})};return n(e),t},[]),[I,T]=o(()=>{if(!0===(null==A?void 0:A.expandAllFoldersOnInit)&&"lazy"!==(null==A?void 0:A.folderTreeLoading)){const e=r();return E(e)}return!0===(null==A?void 0:A.expandRootFolderOnInit)?["folders"]:[]}),F=u(!1),O=u(!1);a(()=>{if(F.current)return;"lazy"===(null==A?void 0:A.folderTreeLoading)&&!0===(null==A?void 0:A.expandRootFolderOnInit)&&(F.current=!0,(async()=>{try{await(null==l?void 0:l(null))}catch(e){console.warn("Не удалось подгрузить дочерние папки корня при инициализации",e)}})())},[null==A?void 0:A.folderTreeLoading,null==A?void 0:A.expandRootFolderOnInit,l]),a(()=>{!0===(null==A?void 0:A.expandRootFolderOnInit)&&Array.isArray(b)&&b.length>0&&(O.current||I&&0!==I.length||(O.current=!0,T(["folders"])))},[null==A?void 0:A.expandRootFolderOnInit,b,I]),a(()=>{if(!0===(null==A?void 0:A.expandAllFoldersOnInit)&&"lazy"!==(null==A?void 0:A.folderTreeLoading)){const e=r(),t=E(e);return void T(t)}!0===(null==A?void 0:A.expandRootFolderOnInit)&&T(e=>e&&e.length>0?[...e]:["folders"])},[b,r,E,null==A?void 0:A.expandAllFoldersOnInit,null==A?void 0:A.folderTreeLoading,null==A?void 0:A.expandRootFolderOnInit]);const P=c(async e=>{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:t,pagination:n}=await k.getFiles({folderId:"folders"===e?void 0:e,itemType:"all"});return(null==n?void 0:n.total)||t.filter(e=>!e.isFolder).length}return 0}catch(t){return console.error(`Ошибка при получении количества файлов для папки ${e}:`,t),x.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:w("Failed to load folder items count"),placement:"bottomRight",innerException:t,data:{folderId:"folders"===e?null:e,reason:t instanceof Error?t.message:String(t)}}),0}},[k,x,w]),M=c(async()=>{if(0===b.length)return;const e={};e.folders=await P("folders");const t=b.map(async t=>{const n=await P(t.id);e[t.id]=n});await Promise.all(t),_(e)},[b,P]),R=c(async e=>{const t=await P(e);_(n=>Object.assign(Object.assign({},n),{[e]:t}))},[P]);g(y,()=>({refreshFileCounts:M}),[M]),a(()=>{M()},[M]),a(()=>{if(!n||"folders"===n)return;const e=(t,n=new Set)=>{if(n.has(t))return console.warn(`Обнаружен цикл в пути к папке с id=${t}`),[];const r=b.find(e=>e.id===t);if(!r)return[];if(!r.parentId)return[];const i=new Set(n);i.add(t);return[...e(r.parentId,i),r.parentId]},t=e(n);t.length>0?T(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n.add("folders"),Array.from(n)}):T(e=>e.includes("folders")?e:[...e,"folders"])},[n,b]);const L=c(async()=>{await h(),n?await R(n):await R("folders")},[h,n,R]),j=[{key:Qt,label:w("My files"),icon:e(ni,{size:20,strokeWidth:null==A?void 0:A.iconStrokeWidth})},{key:en,label:w("GIF"),icon:e(oi,{size:20,strokeWidth:null==A?void 0:A.iconStrokeWidth})},{key:tn,label:w("Stock images"),icon:e(Gr,{size:20,strokeWidth:null==A?void 0:A.iconStrokeWidth})},{key:nn,label:w("AI"),icon:e(ci,{size:20,strokeWidth:null==A?void 0:A.iconStrokeWidth}),disabled:!(null==A?void 0:A.sseQuery)}],N=c(async e=>{const t=e[0];t&&"empty"!==t&&(m!==Qt&&v(Qt),null==i||i(t),await(null==l?void 0:l(t)))},[i,m,v,l]),z=c(({key:e})=>{console.warn("key",e),v(e)},[v]),B=c(async(e,t)=>{var n;T(e);if(!("lazy"===(null==A?void 0:A.folderTreeLoading)))return;const r=(null===(n=null==t?void 0:t.node)||void 0===n?void 0:n.key)||void 0;if(r&&"folders"!==r)try{await(null==l?void 0:l(r))}catch(e){console.warn("Не удалось подгрузить дочерние папки для",r,e),x.error({id:"FOLDER_CHILDREN_FETCH_FAILED",message:w("Failed to load subfolders"),placement:"bottomRight",innerException:e,data:{folderId:r,reason:e instanceof Error?e.message:String(e)}})}},[null==A?void 0:A.folderTreeLoading,l,x,w]);return t("div",{className:"sidebar-container",children:[t("div",{className:Go.buttonWrapper,children:[e(D,{type:"primary",size:"large",icon:e(ai,{size:24,strokeWidth:null==A?void 0:A.iconStrokeWidth}),onClick:L,className:Go.uploadButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===n,children:e("span",{className:Go.uploadButtonTitle,children:w("Upload file")})}),e(D,{type:"primary",size:"large",icon:e(ri,{size:24,strokeWidth:null==A?void 0:A.iconStrokeWidth}),onClick:()=>null==f?void 0:f(!0),className:Go.uploadByURLButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===n})]}),e(Y,{className:"folder-menu",items:j,defaultSelectedKeys:[Qt],onSelect:({key:e})=>z({key:e}),selectedKeys:[m]}),e(X,{className:Go.divider}),t("div",{className:Go.foldersContainer,children:[e($o,{selectedFolder:n,onSelect:N,onExpand:B,generateMenuItems:r,fetchChildFolders:l,showFileCounts:!0,folderFileCounts:C,expandedKeys:I,setExpandedKeys:T,showTrashFolder:null==A?void 0:A.enableTrashFolder}),e("div",{className:Go.folderActions,children:e(D,{onClick:e=>{e.stopPropagation(),p()},className:Go.button,icon:e(Qr,{size:18,strokeWidth:null==A?void 0:A.iconStrokeWidth}),size:"middle"})})]})]})}));Yo.displayName="FolderSidebar";var Xo=Object.defineProperty,Ko=(e,t,n)=>(((e,t,n)=>{t in e?Xo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Zo(e,t){return void 0===t&&(t=15),+parseFloat(Number(e).toPrecision(t))}function Jo(e){var t=e.toString().split(/[eE]/),n=(t[0].split(".")[1]||"").length-+(t[1]||0);return n>0?n:0}function Qo(e){if(-1===e.toString().indexOf("e"))return Number(e.toString().replace(".",""));var t=Jo(e);return t>0?Zo(Number(e)*Math.pow(10,t)):Number(e)}function ea(e){aa&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&console.warn(e+" is beyond boundary when transfer to integer, the results may not be accurate")}function ta(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0];return t.slice(1).reduce(function(t,n){return e(t,n)},r)}}var na=ta(function(e,t){var n=Qo(e),r=Qo(t),i=Jo(e)+Jo(t),o=n*r;return ea(o),o/Math.pow(10,i)}),ra=ta(function(e,t){var n=Math.pow(10,Math.max(Jo(e),Jo(t)));return(na(e,n)+na(t,n))/n}),ia=ta(function(e,t){var n=Math.pow(10,Math.max(Jo(e),Jo(t)));return(na(e,n)-na(t,n))/n}),oa=ta(function(e,t){var n=Qo(e),r=Qo(t);return ea(n),ea(r),na(n/r,Zo(Math.pow(10,Jo(t)-Jo(e))))});var aa=!0;var sa={strip:Zo,plus:ra,minus:ia,times:na,divide:oa,round:function(e,t){var n=Math.pow(10,t),r=oa(Math.round(Math.abs(na(e,n))),n);return e<0&&0!==r&&(r=na(r,-1)),r},digitLength:Jo,float2Fixed:Qo,enableBoundaryChecking:function(e){void 0===e&&(e=!0),aa=e}};const la=Object.prototype.toString;function ca(e){switch(la.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return ba(e,Error)}}function ua(e,t){return la.call(e)===`[object ${t}]`}function da(e){return ua(e,"ErrorEvent")}function ha(e){return ua(e,"DOMError")}function fa(e){return ua(e,"String")}function pa(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function ga(e){return null===e||pa(e)||"object"!=typeof e&&"function"!=typeof e}function ma(e){return ua(e,"Object")}function va(e){return typeof Event<"u"&&ba(e,Event)}function ya(e){return!(!e||!e.then||"function"!=typeof e.then)}function ba(e,t){try{return e instanceof t}catch{return!1}}function wa(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}function xa(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Ca(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{wa(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function _a(e,t,n=!1){return!!fa(e)&&(function(e){return ua(e,"RegExp")}(t)?t.test(e):!!fa(t)&&(n?e===t:e.includes(t)))}function Sa(e,t=[],n=!1){return t.some(t=>_a(e,t,n))}function ka(e,t,n=250,r,i,o,a){if(!(o.exception&&o.exception.values&&a&&ba(a.originalException,Error)))return;const s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=function(e,t){return e.map(e=>(e.value&&(e.value=xa(e.value,t)),e))}(Aa(e,t,i,a.originalException,r,o.exception.values,s,0),n))}function Aa(e,t,n,r,i,o,a,s){if(o.length>=n+1)return o;let l=[...o];if(ba(r[i],Error)){Ea(a,s);const o=e(t,r[i]),c=l.length;Ia(o,i,c,s),l=Aa(e,t,n,r[i],i,[o,...l],o,c)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(ba(r,Error)){Ea(a,s);const c=e(t,r),u=l.length;Ia(c,`errors[${o}]`,u,s),l=Aa(e,t,n,r,i,[c,...l],c,u)}}),l}function Ea(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function Ia(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Ta(e){return e&&e.Math==Math?e:void 0}const Fa="object"==typeof globalThis&&Ta(globalThis)||"object"==typeof window&&Ta(window)||"object"==typeof self&&Ta(self)||"object"==typeof global&&Ta(global)||function(){return this}()||{};function Oa(){return Fa}function Pa(e,t,n){const r=n||Fa,i=r.__SENTRY__=r.__SENTRY__||{};return i[e]||(i[e]=t())}const Ma=Oa();function Ra(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,a=0;const s=" > ",l=s.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(c=La(n,u),!("html"===c||o>1&&a+i.length*l+c.length>=d));)i.push(c),a+=c.length,n=n.parentNode;return i.reverse().join(s)}catch{return"<unknown>"}}function La(e,t){const n=e,r=[];let i,o,a,s,l;if(!n||!n.tagName)return"";if(Ma.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());const c=t&&t.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(c&&c.length)c.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&fa(i))for(o=i.split(/\s+/),l=0;l<o.length;l++)r.push(`.${o[l]}`);const u=["aria-label","type","name","title","alt"];for(l=0;l<u.length;l++)a=u[l],s=n.getAttribute(a),s&&r.push(`[${a}="${s}"]`);return r.join("")}const ja=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Da=["debug","info","warn","error","log","assert","trace"],Na={};function za(e){if(!("console"in Fa))return e();const t=Fa.console,n={},r=Object.keys(Na);r.forEach(e=>{const r=Na[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}const Ba=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return ja?Da.forEach(n=>{t[n]=(...t)=>{e&&za(()=>{Fa.console[n](`Sentry Logger [${n}]:`,...t)})}}):Da.forEach(e=>{t[e]=()=>{}}),t}(),Ua=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Va(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${a}`}function $a(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Wa(e){const t="string"==typeof e?function(e){const t=Ua.exec(e);if(!t)return void za(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});const[n,r,i="",o,a="",s]=t.slice(1);let l="",c=s;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return $a({host:o,pass:i,path:l,projectId:c,port:a,protocol:n,publicKey:r})}(e):$a(e);if(t&&function(e){if(!ja)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(Ba.error(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Ba.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Ba.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Ba.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}class Ha extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}}function qa(e,t,n){if(!(t in e))return;const r=e[t],i=n(r);"function"==typeof i&&Ya(i,r),e[t]=i}function Ga(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{ja&&Ba.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ya(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Ga(e,"__sentry_original__",t)}catch{}}function Xa(e){return e.__sentry_original__}function Ka(e){if(ca(e))return{message:e.message,name:e.name,stack:e.stack,...Ja(e)};if(va(e)){const t={type:e.type,target:Za(e.target),currentTarget:Za(e.currentTarget),...Ja(e)};return typeof CustomEvent<"u"&&ba(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Za(e){try{return function(e){return typeof Element<"u"&&ba(e,Element)}(e)?Ra(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Ja(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function Qa(e){return es(e,new Map)}function es(e,t){if(function(e){if(!ma(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch{return!0}}(e)){const n=t.get(e);if(void 0!==n)return n;const r={};t.set(e,r);for(const n of Object.keys(e))typeof e[n]<"u"&&(r[n]=es(e[n],t));return r}if(Array.isArray(e)){const n=t.get(e);if(void 0!==n)return n;const r=[];return t.set(e,r),e.forEach(e=>{r.push(es(e,t))}),r}return e}const ts=/\(error: (.*)\)/,ns=/captureMessage|captureException/;function rs(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0)=>{const r=[],i=e.split("\n");for(let e=n;e<i.length;e++){const n=i[e];if(n.length>1024)continue;const o=ts.test(n)?n.replace(ts,"$1"):n;if(!o.match(/\S*Error: /)){for(const e of t){const t=e(o);if(t){r.push(t);break}}if(r.length>=50)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),ns.test(t[t.length-1].function||"")&&(t.pop(),ns.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||t[t.length-1].filename,function:e.function||"?"}))}(r)}}function is(e){return Array.isArray(e)?rs(...e):e}const os="<anonymous>";function as(e){try{return e&&"function"==typeof e&&e.name||os}catch{return os}}const ss={},ls={};function cs(e,t){ss[e]=ss[e]||[],ss[e].push(t)}function us(e,t){ls[e]||(t(),ls[e]=!0)}function ds(e,t){const n=e&&ss[e];if(n)for(const r of n)try{r(t)}catch(t){ja&&Ba.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${as(r)}\nError:`,t)}}function hs(){"console"in Fa&&Da.forEach(function(e){e in Fa.console&&qa(Fa.console,e,function(t){return Na[e]=t,function(...t){ds("console",{args:t,level:e});const n=Na[e];n&&n.apply(Fa.console,t)}})})}function fs(){const e=Fa,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,e=>(e^(15&n())>>e/4).toString(16))}function ps(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function gs(e){const{message:t,event_id:n}=e;if(t)return t;const r=ps(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ms(e,t,n){const r=e.exception=e.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type="Error")}function vs(e,t){const n=ps(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r&&r.data,...t.data};n.mechanism.data=e}}function ys(e){if(e&&e.__sentry_captured__)return!0;try{Ga(e,"__sentry_captured__",!0)}catch{}return!1}function bs(e){return Array.isArray(e)?e:[e]}const ws=Fa;let xs,Cs,_s;function Ss(){if(!ws.document)return;const e=ds.bind(null,"dom"),t=ks(e,!0);ws.document.addEventListener("click",t,!1),ws.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=ws[t]&&ws[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(qa(n,"addEventListener",function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this,o=r.__sentry_instrumentation_handlers__=r.__sentry_instrumentation_handlers__||{},a=o[n]=o[n]||{refCount:0};if(!a.handler){const r=ks(e);a.handler=r,t.call(this,n,r,i)}a.refCount++}catch{}return t.call(this,n,r,i)}}),qa(n,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this,i=n.__sentry_instrumentation_handlers__||{},o=i[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,r),o.handler=void 0,delete i[t]),0===Object.keys(i).length&&delete n.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}}))})}function ks(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return!("keypress"!==e||t&&t.tagName&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))}(n.type,r))return;Ga(n,"_sentryCaptured",!0),r&&!r._sentryId&&Ga(r,"_sentryId",fs());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==Cs)return!1;try{if(!e.target||e.target._sentryId!==_s)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),Cs=n.type,_s=r?r._sentryId:void 0),clearTimeout(xs),xs=ws.setTimeout(()=>{_s=void 0,Cs=void 0},1e3)}}const As=Oa();function Es(){if(!("fetch"in As))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Is(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Ts(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!Es())return!1;if(Is(As.fetch))return!0;let e=!1;const t=As.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=Is(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){ja&&Ba.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e})()&&qa(Fa,"fetch",function(e){return function(...t){const{method:n,url:r}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:Os(t),method:Fs(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:Os(t),method:Fs(t,"method")?String(t.method).toUpperCase():"GET"}}(t),i={args:t,fetchData:{method:n,url:r},startTimestamp:Date.now()};return ds("fetch",{...i}),e.apply(Fa,t).then(e=>(ds("fetch",{...i,endTimestamp:Date.now(),response:e}),e),e=>{throw ds("fetch",{...i,endTimestamp:Date.now(),error:e}),e})}})}function Fs(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Os(e){return"string"==typeof e?e:e?Fs(e,"url")?e.url:e.toString?e.toString():"":""}let Ps=null;function Ms(){Ps=Fa.onerror,Fa.onerror=function(e,t,n,r,i){return ds("error",{column:r,error:i,line:n,msg:e,url:t}),!(!Ps||Ps.__SENTRY_LOADER__)&&Ps.apply(this,arguments)},Fa.onerror.__SENTRY_INSTRUMENTED__=!0}let Rs=null;function Ls(){Rs=Fa.onunhandledrejection,Fa.onunhandledrejection=function(e){return ds("unhandledrejection",e),!(Rs&&!Rs.__SENTRY_LOADER__)||Rs.apply(this,arguments)},Fa.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const js=Oa();const Ds=Fa;let Ns;function zs(e){const t="history";cs(t,e),us(t,Bs)}function Bs(){if(!function(){const e=js.chrome,t=e&&e.app&&e.app.runtime,n="history"in js&&!!js.history.pushState&&!!js.history.replaceState;return!t&&n}())return;const e=Ds.onpopstate;function t(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const e=Ns,t=String(n);Ns=t,ds("history",{from:e,to:t})}return e.apply(this,t)}}Ds.onpopstate=function(...t){const n=Ds.location.href,r=Ns;if(Ns=n,ds("history",{from:r,to:n}),e)try{return e.apply(this,t)}catch{}},qa(Ds.history,"pushState",t),qa(Ds.history,"replaceState",t)}const Us=Fa,Vs="__sentry_xhr_v3__";function $s(){if(!Us.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;qa(e,"open",function(e){return function(...t){const n=Date.now(),r=fa(t[0])?t[0].toUpperCase():void 0,i=function(e){if(fa(e))return e;try{return e.toString()}catch{}}(t[1]);if(!r||!i)return e.apply(this,t);this[Vs]={method:r,url:i,request_headers:{}},"POST"===r&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const e=this[Vs];if(e&&4===this.readyState){try{e.status_code=this.status}catch{}ds("xhr",{args:[r,i],endTimestamp:Date.now(),startTimestamp:n,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?qa(this,"onreadystatechange",function(e){return function(...t){return o(),e.apply(this,t)}}):this.addEventListener("readystatechange",o),qa(this,"setRequestHeader",function(e){return function(...t){const[n,r]=t,i=this[Vs];return i&&fa(n)&&fa(r)&&(i.request_headers[n.toLowerCase()]=r),e.apply(this,t)}}),e.apply(this,t)}}),qa(e,"send",function(e){return function(...t){const n=this[Vs];if(!n)return e.apply(this,t);void 0!==t[0]&&(n.body=t[0]);return ds("xhr",{args:[n.method,n.url],startTimestamp:Date.now(),xhr:this}),e.apply(this,t)}})}function Ws(e,t=100,n=1/0){try{return qs("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Hs(e,t=3,n=102400){const r=Ws(e,t);return function(e){return function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(e))}(r)>n?Hs(e,t-1,n):r}function qs(e,t,n=1/0,r=1/0,i=function(){const e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(n){if(e)return!!t.has(n)||(t.add(n),!1);for(let e=0;e<t.length;e++)if(t[e]===n)return!0;return t.push(n),!1},function(n){if(e)t.delete(n);else for(let e=0;e<t.length;e++)if(t[e]===n){t.splice(e,1);break}}]}()){const[o,a]=i;if(null==t||["number","boolean","string"].includes(typeof t)&&!function(e){return"number"==typeof e&&e!=e}(t))return t;const s=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(wa(t))return"[VueViewModel]";if(function(e){return ma(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}(t))return"[SyntheticEvent]";if("number"==typeof t&&t!=t)return"[NaN]";if("function"==typeof t)return`[Function: ${as(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const n=function(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}(e,t);if(!s.startsWith("[object "))return s;if(t.__sentry_skip_normalization__)return t;const l="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===l)return s.replace("object ","");if(o(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return qs("",c.toJSON(),l-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=Ka(t);for(const e in h){if(!Object.prototype.hasOwnProperty.call(h,e))continue;if(d>=r){u[e]="[MaxProperties ~]";break}const t=h[e];u[e]=qs(e,t,l-1,r,i),d++}return a(t),u}var Gs;function Ys(e){return new Ks(t=>{t(e)})}function Xs(e){return new Ks((t,n)=>{n(e)})}!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(Gs||(Gs={}));class Ks{constructor(e){Ks.prototype.__init.call(this),Ks.prototype.__init2.call(this),Ks.prototype.__init3.call(this),Ks.prototype.__init4.call(this),this._state=Gs.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new Ks((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(e){return new Ks((t,n)=>{let r,i;return this.then(t=>{i=!1,r=t,e&&e()},t=>{i=!0,r=t,e&&e()}).then(()=>{i?n(r):t(r)})})}__init(){this._resolve=e=>{this._setResult(Gs.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Gs.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===Gs.PENDING){if(ya(t))return void t.then(this._resolve,this._reject);this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Gs.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||(this._state===Gs.RESOLVED&&e[1](this._value),this._state===Gs.REJECTED&&e[2](this._value),e[0]=!0)})}}}function Zs(e){const t=[];function n(e){return t.splice(t.indexOf(e),1)[0]}return{$:t,add:function(r){if(!(void 0===e||t.length<e))return Xs(new Ha("Not adding Promise because buffer limit was reached."));const i=r();return-1===t.indexOf(i)&&t.push(i),i.then(()=>n(i)).then(null,()=>n(i).then(null,()=>{})),i},drain:function(e){return new Ks((n,r)=>{let i=t.length;if(!i)return n(!0);const o=setTimeout(()=>{e&&e>0&&n(!1)},e);t.forEach(e=>{Ys(e).then(()=>{--i||(clearTimeout(o),n(!0))},r)})})}}}function Js(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}const Qs=["fatal","error","warning","log","info","debug"];function el(e){return"warn"===e?"warning":Qs.includes(e)?e:"log"}function tl(){return Date.now()/1e3}const nl=function(){const{performance:e}=Fa;if(!e||!e.now)return tl;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();function rl(e,t=[]){return[e,t]}function il(e,t){const[n,r]=e;return[n,[...r,t]]}function ol(e,t){const n=e[1];for(const e of n){if(t(e,e[0].type))return!0}return!1}function al(e,t){return(t||new TextEncoder).encode(e)}function sl(e,t){const[n,r]=e;let i=JSON.stringify(n);function o(e){"string"==typeof i?i="string"==typeof e?i+e:[al(i,t),e]:i.push("string"==typeof e?al(e,t):e)}for(const e of r){const[t,n]=e;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)o(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(Ws(n))}o(e)}}return"string"==typeof i?i:function(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(i)}function ll(e,t){const n="string"==typeof e.data?al(e.data,t):e.data;return[Qa({type:"attachment",length:n.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),n]}(()=>{const{performance:e}=Fa;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,o=i<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+n-r):t;(o||s<t)&&(i<=s&&e.timeOrigin)})();const cl={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function ul(e){return cl[e]}function dl(e){if(!e||!e.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function hl(e,{statusCode:t,headers:n},r=Date.now()){const i={...e},o=n&&n["x-sentry-rate-limits"],a=n&&n["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,n,,,o]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(n)for(const e of n.split(";"))"metric_bucket"===e?(!o||o.split(";").includes("custom"))&&(i[e]=r+s):i[e]=r+s;else i.all=r+s}else a?i.all=r+function(e,t=Date.now()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(a,r):429===t&&(i.all=r+6e4);return i}const fl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,pl="production";function gl(){return Pa("globalEventProcessors",()=>[])}function ml(e){gl().push(e)}function vl(e,t,n,r=0){return new Ks((i,o)=>{const a=e[r];if(null===t||"function"!=typeof a)i(t);else{const s=a({...t},n);fl&&a.id&&null===s&&Ba.log(`Event processor "${a.id}" dropped event`),ya(s)?s.then(t=>vl(e,t,n,r+1).then(i)).then(null,o):vl(e,s,n,r+1).then(i).then(null,o)}})}function yl(e){const t=nl(),n={sid:fs(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return Qa({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(n)};return e&&bl(n,e),n}function bl(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||nl(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:fs()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function wl(e,t){let n={};"ok"===e.status&&(n={status:"exited"}),bl(e,n)}function xl(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:o,status:a,tags:s,origin:l}=Cl(e);return Qa({data:r,op:i,parent_span_id:o,span_id:t,status:a,tags:s,trace_id:n,origin:l})}function Cl(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}function _l(e,t,n,r,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||n.event_id||fs(),timestamp:t.timestamp||tl()},c=n.integrations||e.integrations.map(e=>e.name);(function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o=250}=t;"environment"in e||(e.environment="environment"in t?n:pl),void 0===e.release&&void 0!==r&&(e.release=r),void 0===e.dist&&void 0!==i&&(e.dist=i),e.message&&(e.message=xa(e.message,o));const a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=xa(a.value,o));const s=e.request;s&&s.url&&(s.url=xa(s.url,o))})(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),void 0===t.type&&function(e,t){const n=Fa._sentryDebugIds;if(!n)return;let r;const i=Sl.get(t);i?r=i:(r=new Map,Sl.set(t,r));const o=Object.keys(n).reduce((e,i)=>{let o;const a=r.get(i);a?o=a:(o=t(i),r.set(i,o));for(let t=o.length-1;t>=0;t--){const r=o[t];if(r.filename){e[r.filename]=n[i];break}}return e},{});try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.filename&&(e.debug_id=o[e.filename])})})}catch{}}(l,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new Bl;return n.update(t),n}(r,n.captureContext);n.mechanism&&vs(l,n.mechanism);const d=i&&i.getEventProcessors?i.getEventProcessors():[],h=(zl||(zl=new Bl),zl).getScopeData();if(o){Dl(h,o.getScopeData())}if(u){Dl(h,u.getScopeData())}const f=[...n.attachments||[],...h.attachments];f.length&&(n.attachments=f),jl(l,h);return vl([...d,...gl(),...h.eventProcessors],l,n).then(e=>(e&&function(e){const t={};try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})})}catch{}if(0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.keys(t).forEach(e=>{n.push({type:"sourcemap",code_file:e,debug_id:t[e]})})}(e),"number"==typeof a&&a>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Ws(e.data,t,n)}}))},...e.user&&{user:Ws(e.user,t,n)},...e.contexts&&{contexts:Ws(e.contexts,t,n)},...e.extra&&{extra:Ws(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ws(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>{const r=Cl(e).data;return r&&(e.data=Ws(r,t,n)),e})),r}(e,a,s):e))}const Sl=new WeakMap;function kl(e,t){return Yl().captureEvent(e,t)}function Al(e,t){Yl().addBreadcrumb(e,t)}function El(){return Yl().getClient()}function Il(){return Yl().getScope()}function Tl(e){const t=El(),n=Xl(),r=Il(),{release:i,environment:o=pl}=t&&t.getOptions()||{},{userAgent:a}=Fa.navigator||{},s=yl({release:i,environment:o,user:r.getUser()||n.getUser(),...a&&{userAgent:a},...e}),l=n.getSession();return l&&"ok"===l.status&&bl(l,{status:"exited"}),Fl(),n.setSession(s),r.setSession(s),s}function Fl(){const e=Xl(),t=Il(),n=t.getSession()||e.getSession();n&&wl(n),Ol(),e.setSession(),t.setSession()}function Ol(){const e=Xl(),t=Il(),n=El(),r=t.getSession()||e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function Pl(e=!1){e?Fl():Ol()}function Ml(e){return e.transaction}function Rl(e,t,n){const r=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:o}=n&&n.getUser()||{},a=Qa({environment:r.environment||pl,release:r.release,user_segment:o,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",a),a}function Ll(e){const t=El();if(!t)return{};const n=Rl(Cl(e).trace_id||"",t,Il()),r=Ml(e);if(!r)return n;const i=r&&r._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:o,source:a}=r.metadata;null!=o&&(n.sample_rate=`${o}`);const s=Cl(r);return a&&"url"!==a&&(n.transaction=s.description),n.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return!!(1&t)}(r)),t.emit&&t.emit("createDsc",n),n}function jl(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;(function(e,t){const{extra:n,tags:r,user:i,contexts:o,level:a,transactionName:s}=t,l=Qa(n);l&&Object.keys(l).length&&(e.extra={...l,...e.extra});const c=Qa(r);c&&Object.keys(c).length&&(e.tags={...c,...e.tags});const u=Qa(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});const d=Qa(o);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),a&&(e.level=a),s&&(e.transaction=s)})(e,t),r&&function(e,t){e.contexts={trace:xl(t),...e.contexts};const n=Ml(t);if(n){e.sdkProcessingMetadata={dynamicSamplingContext:Ll(t),...e.sdkProcessingMetadata};const r=Cl(n).description;r&&(e.tags={transaction:r,...e.tags})}}(e,r),function(e,t){e.fingerprint=e.fingerprint?bs(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}function Dl(e,t){const{extra:n,tags:r,user:i,contexts:o,level:a,sdkProcessingMetadata:s,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:h,transactionName:f,span:p}=t;Nl(e,"extra",n),Nl(e,"tags",r),Nl(e,"user",i),Nl(e,"contexts",o),Nl(e,"sdkProcessingMetadata",s),a&&(e.level=a),f&&(e.transactionName=f),p&&(e.span=p),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),c.length&&(e.fingerprint=[...e.fingerprint,...c]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function Nl(e,t,n){if(n&&Object.keys(n).length){e[t]={...e[t]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[t][r]=n[r])}}let zl;class Bl{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Ul()}static clone(e){return e?e.clone():new Bl}clone(){const e=new Bl;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&bl(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e;if(t instanceof Bl){const e=t.getScopeData();this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&Object.keys(e.user).length&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint.length&&(this._fingerprint=e.fingerprint),t.getRequestSession()&&(this._requestSession=t.getRequestSession()),e.propagationContext&&(this._propagationContext=e.propagationContext)}else if(ma(t)){const t=e;this._tags={...this._tags,...t.tags},this._extra={...this._extra,...t.extra},this._contexts={...this._contexts,...t.contexts},t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession),t.propagationContext&&(this._propagationContext=t.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Ul(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:tl(),...e},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:t,_contexts:n,_tags:r,_extra:i,_user:o,_level:a,_fingerprint:s,_eventProcessors:l,_propagationContext:c,_sdkProcessingMetadata:u,_transactionName:d,_span:h}=this;return{breadcrumbs:e,attachments:t,contexts:n,tags:r,extra:i,user:o,level:a,fingerprint:s||[],eventProcessors:l,propagationContext:c,sdkProcessingMetadata:u,transactionName:d,span:h}}applyToEvent(e,t={},n=[]){jl(e,this.getScopeData());return vl([...n,...gl(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:fs();if(!this._client)return Ba.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:fs();if(!this._client)return Ba.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:fs();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Ba.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Ul(){return{traceId:fs(),spanId:fs().substring(16)}}const Vl="7.116.0",$l=parseFloat(Vl),Wl=100;class Hl{constructor(e,t,n,r=$l){let i,o;this._version=r,t?i=t:(i=new Bl,i.setClient(e)),n?o=n:(o=new Bl,o.setClient(e)),this._stack=[{scope:i}],e&&this.bindClient(e),this._isolationScope=o}isOlderThan(e){return this._version<e}bindClient(e){const t=this.getStackTop();t.client=e,t.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){const t=this.pushScope();let n;try{n=e(t)}catch(e){throw this.popScope(),e}return ya(n)?n.then(e=>(this.popScope(),e),e=>{throw this.popScope(),e}):(this.popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){const n=this._lastEventId=t&&t.event_id?t.event_id:fs(),r=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:r,...t,event_id:n}),n}captureMessage(e,t,n){const r=this._lastEventId=n&&n.event_id?n.event_id:fs(),i=new Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r}),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:fs();return e.type||(this._lastEventId=n),this.getScope().captureEvent(e,{...t,event_id:n}),n}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:n,client:r}=this.getStackTop();if(!r)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Wl}=r.getOptions&&r.getOptions()||{};if(o<=0)return;const a={timestamp:tl(),...e},s=i?za(()=>i(a,t)):a;null!==s&&(r.emit&&r.emit("beforeAddBreadcrumb",s,t),n.addBreadcrumb(s,o))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}configureScope(e){const{scope:t,client:n}=this.getStackTop();n&&e(t)}run(e){const t=Gl(this);try{e(this)}finally{Gl(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch{return fl&&Ba.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const n=this._callExtensionMethod("startTransaction",e,t);return fl&&!n&&(this.getClient()?Ba.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):Ba.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),n}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const e=this.getStackTop().scope,t=e.getSession();t&&wl(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:n}=this.getStackTop(),{release:r,environment:i=pl}=n&&n.getOptions()||{},{userAgent:o}=Fa.navigator||{},a=yl({release:r,environment:i,user:t.getUser(),...o&&{userAgent:o},...e}),s=t.getSession&&t.getSession();return s&&"ok"===s.status&&bl(s,{status:"exited"}),this.endSession(),t.setSession(a),a}shouldSendDefaultPii(){const e=this.getClient(),t=e&&e.getOptions();return!(!t||!t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop(),n=e.getSession();n&&t&&t.captureSession&&t.captureSession(n)}_callExtensionMethod(e,...t){const n=ql().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[e])return n.extensions[e].apply(this,t);fl&&Ba.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function ql(){return Fa.__SENTRY__=Fa.__SENTRY__||{extensions:{},hub:void 0},Fa}function Gl(e){const t=ql(),n=Kl(t);return Zl(t,e),n}function Yl(){const e=ql();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=ql()){return(!function(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}(e)||Kl(e).isOlderThan($l))&&Zl(e,new Hl),Kl(e)}(e)}function Xl(){return Yl().getIsolationScope()}function Kl(e){return Pa("hub",()=>new Hl,e)}function Zl(e,t){if(!e)return!1;return(e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0}function Jl(e,t,n,r){const i=dl(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]])}(e,n&&n.sdk);const a=function(e,t,n,r){const i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Va(r)},...i&&{trace:Qa({...i})}}}(e,i,r,t);return delete e.sdkProcessingMetadata,rl(a,[[{type:o},e]])}function Ql(e,t){return function(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}({sentry_key:e.publicKey,sentry_version:"7",...t&&{sentry_client:`${t.name}/${t.version}`}})}const ec=[];function tc(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;t.forEach(e=>{e.isDefaultInstance=!0}),r=Array.isArray(n)?[...t,...n]:"function"==typeof n?bs(n(t)):t;const i=function(e){const t={};return e.forEach(e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.keys(t).map(e=>t[e])}(r),o=function(e,t){for(let n=0;n<e.length;n++)if(!0===t(e[n]))return n;return-1}(i,e=>"Debug"===e.name);if(-1!==o){const[e]=i.splice(o,1);i.push(e)}return i}function nc(e,t){for(const n of t)n&&n.afterAllSetup&&n.afterAllSetup(e)}function rc(e,t,n){if(n[t.name])fl&&Ba.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===ec.indexOf(t.name)&&(t.setupOnce(ml,Yl),ec.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),e.on&&"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,r)=>n(t,r,e))}if(e.addEventProcessor&&"function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}fl&&Ba.log(`Integration installed: ${t.name}`)}}function ic(e,t){return Object.assign(function(...e){return t(...e)},{id:e})}function oc(e,t,n,r){const i={sent_at:(new Date).toISOString()};n&&n.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),r&&t&&(i.dsn=Va(t));const o=function(e){const t=function(e){let t="";for(const n of e){const e=Object.entries(n.tags),r=e.length>0?`|#${e.map(([e,t])=>`${e}:${t}`).join(",")}`:"";t+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${r}|T${n.timestamp}\n`}return t}(e);return[{type:"statsd",length:t.length},t]}(e);return rl(i,[o])}const ac="Not capturing exception because it's already been captured.";class sc{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Wa(e.dsn):fl&&Ba.warn("No DSN provided, client will not send events."),this._dsn){const t=function(e,t={}){const n="string"==typeof t?t:t.tunnel,r="string"!=typeof t&&t._metadata?t._metadata.sdk:void 0;return n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${Ql(e,r)}`}(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,n){if(ys(e))return void(fl&&Ba.log(ac));let r=t&&t.event_id;return this._process(this.eventFromException(e,t).then(e=>this._captureEvent(e,t,n)).then(e=>{r=e})),r}captureMessage(e,t,n,r){let i=n&&n.event_id;const o=pa(e)?e:String(e),a=ga(e)?this.eventFromMessage(o,t,n):this.eventFromException(e,n);return this._process(a.then(e=>this._captureEvent(e,n,r)).then(e=>{i=e})),i}captureEvent(e,t,n){if(t&&t.originalException&&ys(t.originalException))return void(fl&&Ba.log(ac));let r=t&&t.event_id;const i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,i||n).then(e=>{r=e})),r}captureSession(e){"string"!=typeof e.release?fl&&Ba.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),bl(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(e).then(n=>t.flush(e).then(e=>n&&e))):Ys(!0)}close(e){return this.flush(e).then(e=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(e){return this.getIntegrationByName(e)}getIntegrationByName(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch{return fl&&Ba.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];rc(this,e,this._integrations),t||nc(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=Jl(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])n=il(n,ll(e,this._options.transportOptions&&this._options.transportOptions.textEncoder));const r=this._sendEnvelope(n);r&&r.then(t=>this.emit("afterSendEvent",e,t),null)}sendSession(e){const t=function(e,t,n,r){const i=dl(n);return rl({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Va(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}recordDroppedEvent(e,t,n){if(this._options.sendClientReports){const n=`${e}:${t}`;fl&&Ba.log(`Adding outcome: "${n}"`),this._outcomes[n]=this._outcomes[n]+1||1}}captureAggregateMetrics(e){fl&&Ba.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=oc(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}on(e,t){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t)}emit(e,...t){this._hooks[e]&&this._hooks[e].forEach(e=>e(...t))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach(t=>{t&&rc(e,t,n)}),n}(this,e),nc(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let n=!1,r=!1;const i=t.exception&&t.exception.values;if(i){r=!0;for(const e of i){const t=e.mechanism;if(t&&!1===t.handled){n=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(bl(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Ks(t=>{let n=0;const r=setInterval(()=>{0==this._numProcessing?(clearInterval(r),t(!0)):(n+=1,e&&n>=e&&(clearInterval(r),t(!1)))},1)})}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,n,r=Xl()){const i=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o.length>0&&(t.integrations=o),this.emit("preprocessEvent",e,t),_l(i,e,t,n,this,r).then(e=>{if(null===e)return e;const t={...r.getPropagationContext(),...n?n.getPropagationContext():void 0};if((!e.contexts||!e.contexts.trace)&&t){const{traceId:r,spanId:i,parentSpanId:o,dsc:a}=t;e.contexts={trace:{trace_id:r,span_id:i,parent_span_id:o},...e.contexts};const s=a||Rl(r,this,n);e.sdkProcessingMetadata={dynamicSamplingContext:s,...e.sdkProcessingMetadata}}return e})}_captureEvent(e,t={},n){return this._processEvent(e,t,n).then(e=>e.event_id,e=>{if(fl){const t=e;"log"===t.logLevel?Ba.log(t.message):Ba.warn(t)}})}_processEvent(e,t,n){const r=this.getOptions(),{sampleRate:i}=r,o=cc(e),a=lc(e),s=e.type||"error",l=`before send for type \`${s}\``;if(a&&"number"==typeof i&&Math.random()>i)return this.recordDroppedEvent("sample_rate","error",e),Xs(new Ha(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const c="replay_event"===s?"replay":s,u=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,n,u).then(n=>{if(null===n)throw this.recordDroppedEvent("event_processor",c,e),new Ha("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return n;const i=function(e,t,n){const{beforeSend:r,beforeSendTransaction:i}=e;return lc(t)&&r?r(t,n):cc(t)&&i?i(t,n):t}(r,n,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(ya(e))return e.then(e=>{if(!ma(e)&&null!==e)throw new Ha(n);return e},e=>{throw new Ha(`${t} rejected with ${e}`)});if(!ma(e)&&null!==e)throw new Ha(n);return e}(i,l)}).then(r=>{if(null===r)throw this.recordDroppedEvent("before_send",c,e),new Ha(`${l} returned \`null\`, will not send event.`,"log");const i=n&&n.getSession();!o&&i&&this._updateSessionFromEvent(i,r);const a=r.transaction_info;if(o&&a&&r.transaction!==e.transaction){const e="custom";r.transaction_info={...a,source:e}}return this.sendEvent(r,t),r}).then(null,e=>{throw e instanceof Ha?e:(this.captureException(e,{data:{__sentry__:!0},originalException:e}),new Ha(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e){this._numProcessing++,e.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,e=>{fl&&Ba.error("Error while sending event:",e)});fl&&Ba.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map(t=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e[t]}})}}function lc(e){return void 0===e.type}function cc(e){return"transaction"===e.type}function uc(e,t){!0===t.debug&&(fl?Ba.enable():za(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Il().update(t.initialScope);const n=new e(t);(function(e){const t=Yl().getStackTop();t.client=e,t.scope.setClient(e)})(n),function(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}(n)}function dc(e,t,n=Zs(e.bufferSize||30)){let r={};function i(i){const o=[];if(ol(i,(t,n)=>{const i=ul(n);if(function(e,t,n=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,i)){const r=hc(t,n);e.recordDroppedEvent("ratelimit_backoff",i,r)}else o.push(t)}),0===o.length)return Ys();const a=rl(i[0],o),s=t=>{ol(a,(n,r)=>{const i=hc(n,r);e.recordDroppedEvent(t,ul(r),i)})};return n.add(()=>t({body:sl(a,e.textEncoder)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&fl&&Ba.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=hl(r,e),e),e=>{throw s("network_error"),e})).then(e=>e,e=>{if(e instanceof Ha)return fl&&Ba.error("Skipped sending event because buffer is full."),s("queue_overflow"),Ys();throw e})}return i.__sentry__baseTransport__=!0,{send:i,flush:e=>n.drain(e)}}function hc(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}function fc(e,t,n=[t],r="npm"){const i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:n.map(e=>({name:`${r}:@sentry/${e}`,version:Vl})),version:Vl}),e._metadata=i}const pc=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],gc=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],mc="InboundFilters",vc=(e={})=>({name:mc,setupOnce(){},processEvent(t,n,r){const i=r.getOptions(),o=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:pc],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:gc],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(e,i);return function(e,t){return t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch{}return!1}(e)?(fl&&Ba.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${gs(e)}`),!0):function(e,t){return!(e.type||!t||!t.length)&&function(e){const t=[];let n;e.message&&t.push(e.message);try{n=e.exception.values[e.exception.values.length-1]}catch{}return n&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`)),fl&&0===t.length&&Ba.error(`Could not extract message for event ${gs(e)}`),t}(e).some(e=>Sa(e,t))}(e,t.ignoreErrors)?(fl&&Ba.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${gs(e)}`),!0):function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const n=e.transaction;return!!n&&Sa(n,t)}(e,t.ignoreTransactions)?(fl&&Ba.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${gs(e)}`),!0):function(e,t){if(!t||!t.length)return!1;const n=yc(e);return!!n&&Sa(n,t)}(e,t.denyUrls)?(fl&&Ba.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${gs(e)}.\nUrl: ${yc(e)}`),!0):!function(e,t){if(!t||!t.length)return!0;const n=yc(e);return!n||Sa(n,t)}(e,t.allowUrls)&&(fl&&Ba.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${gs(e)}.\nUrl: ${yc(e)}`),!0)}(t,o)?null:t}});function yc(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(t):null}catch{return fl&&Ba.error(`Cannot extract url for event ${gs(e)}`),null}}let bc;ic(mc,vc);const wc="FunctionToString",xc=new WeakMap,Cc=()=>({name:wc,setupOnce(){bc=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Xa(this),n=xc.has(El())&&void 0!==t?t:this;return bc.apply(n,e)}}catch{}},setup(e){xc.set(e,!0)}});ic(wc,Cc);const _c=Fa;let Sc=0;function kc(){return Sc>0}function Ac(e,t={},n){if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return t;if(Xa(e))return e}catch{return e}const r=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const i=r.map(e=>Ac(e,t));return e.apply(this,i)}catch(e){throw Sc++,setTimeout(()=>{Sc--}),function(...e){const t=Yl();if(2===e.length){const[n,r]=e;return n?t.withScope(()=>(t.getStackTop().scope=n,r(n))):t.withScope(r)}t.withScope(e[0])}(n=>{n.addEventProcessor(e=>(t.mechanism&&(ms(e,void 0),vs(e,t.mechanism)),e.extra={...e.extra,arguments:r},e)),function(e){Yl().captureException(e,void 0)}(e)}),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch{}Ya(r,e),Ga(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>e.name})}catch{}return r}const Ec=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Ic(e,t){const n=Fc(e,t),r={type:t&&t.name,value:Pc(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Tc(e,t){return{exception:{values:[Ic(e,t)]}}}function Fc(e,t){const n=t.stacktrace||t.stack||"",r=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(Oc.test(e.message))return 1}return 0}(t);try{return e(n,r)}catch{}return[]}const Oc=/Minified React error #\d+;/i;function Pc(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function Mc(e,t,n,r,i){let o;if(da(t)&&t.error)return Tc(e,t.error);if(ha(t)||function(e){return ua(e,"DOMException")}(t)){const i=t;if("stack"in t)o=Tc(e,t);else{const t=i.name||(ha(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=Rc(e,a,n,r),ms(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return ca(t)?Tc(e,t):ma(t)||va(t)?(o=function(e,t,n,r){const i=El(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:va(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Lc(t,{isUnhandledRejection:r})}]},extra:{__serialized__:Hs(t,o)}};if(n){const t=Fc(e,n);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,n,i),vs(o,{synthetic:!0}),o):(o=Rc(e,t,n,r),ms(o,`${t}`),vs(o,{synthetic:!0}),o)}function Rc(e,t,n,r){const i={};if(r&&n){const r=Fc(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]})}if(pa(t)){const{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Lc(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(Ka(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return xa(n[0],t);for(let e=n.length;e>0;e--){const r=n.slice(0,e).join(", ");if(!(r.length>t))return e===n.length?r:xa(r,t)}return""}(e),r=t?"promise rejection":"exception";return da(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:va(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class jc extends sc{constructor(e){fc(e,"browser",["browser"],_c.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&_c.document&&_c.document.addEventListener("visibilitychange",()=>{"hidden"===_c.document.visibilityState&&this._flushOutcomes()})}eventFromException(e,t){return function(e,t,n,r){const i=Mc(e,t,n&&n.syntheticException||void 0,r);return vs(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),Ys(i)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=Rc(e,t,r&&r.syntheticException||void 0,i);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),Ys(o)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(Ec&&Ba.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:n,dsn:r}){const i={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:Va(r)}},o=function(e){return[{type:"user_report"},e]}(e);return rl(i,[o])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(Ec&&Ba.log("No outcomes to send"));if(!this._dsn)return void(Ec&&Ba.log("No dsn provided, will not send outcomes"));Ec&&Ba.log("Sending outcomes:",e);const t=function(e,t){return rl(t?{dsn:t}:{},[[{type:"client_report"},{timestamp:tl(),discarded_events:e}]])}(e,this._options.tunnel&&Va(this._dsn));this._sendEnvelope(t)}}let Dc;function Nc(e,t=function(){if(Dc)return Dc;if(Is(_c.fetch))return Dc=_c.fetch.bind(_c);const e=_c.document;let t=_c.fetch;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(t=r.fetch),e.head.removeChild(n)}catch(e){Ec&&Ba.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return Dc=t.bind(_c)}()){let n=0,r=0;return dc(e,function(i){const o=i.body.length;n+=o,r++;const a={body:i.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{return t(e.url,a).then(e=>(n-=o,r--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get("X-Sentry-Rate-Limits"),"retry-after":e.headers.get("Retry-After")}}))}catch(e){return Dc=void 0,n-=o,r--,Xs(e)}})}function zc(e){return dc(e,function(t){return new Ks((n,r)=>{const i=new XMLHttpRequest;i.onerror=r,i.onreadystatechange=()=>{4===i.readyState&&n({statusCode:i.status,headers:{"x-sentry-rate-limits":i.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":i.getResponseHeader("Retry-After")}})},i.open("POST",e.url);for(const t in e.headers)Object.prototype.hasOwnProperty.call(e.headers,t)&&i.setRequestHeader(t,e.headers[t]);i.send(t.body)})})}const Bc="?";function Uc(e,t,n,r){const i={filename:e,function:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Vc=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,$c=/\((\S*)(?::(\d+))(?::(\d+))\)/,Wc=[30,e=>{const t=Vc.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=$c.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,n]=Zc(t[1]||Bc,t[2]);return Uc(n,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],Hc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,qc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Gc=[50,e=>{const t=Hc.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=qc.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Bc;return[n,e]=Zc(n,e),Uc(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],Yc=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Xc=[40,e=>{const t=Yc.exec(e);return t?Uc(t[2],t[1]||Bc,+t[3],t[4]?+t[4]:void 0):void 0}],Kc=rs(...[Wc,Gc,Xc]),Zc=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Bc,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Jc=1024,Qc="Breadcrumbs",eu=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Qc,setupOnce(){},setup(e){t.console&&function(e){const t="console";cs(t,e),us(t,hs)}(function(e){return function(t){if(El()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:el(t.level),message:Ca(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Ca(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Al(n,{input:t.args,level:t.level})}}(e)),t.dom&&function(e){cs("dom",e),us("dom",Ss)}(function(e,t){return function(n){if(El()!==e)return;let r,i,o="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;a&&a>Jc&&(Ec&&Ba.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=Jc),"string"==typeof o&&(o=[o]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=Ra(t,{keyAttrs:o,maxStringLength:a}),i=function(e){if(!Ma.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}(t)}catch{r="<unknown>"}if(0===r.length)return;const s={category:`ui.${n.name}`,message:r};i&&(s.data={"ui.component_name":i}),Al(s,{event:n.event,name:n.name,global:n.global})}}(e,t.dom)),t.xhr&&function(e){cs("xhr",e),us("xhr",$s)}(function(e){return function(t){if(El()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Vs];if(!n||!r||!i)return;const{method:o,url:a,status_code:s,body:l}=i;Al({category:"xhr",data:{method:o,url:a,status_code:s},type:"http"},{xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r})}}(e)),t.fetch&&function(e){const t="fetch";cs(t,e),us(t,Ts)}(function(e){return function(t){if(El()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){Al({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:n,endTimestamp:r})}else{const e=t.response;Al({category:"fetch",data:{...t.fetchData,status_code:e&&e.status},type:"http"},{input:t.args,response:e,startTimestamp:n,endTimestamp:r})}}}(e)),t.history&&zs(function(e){return function(t){if(El()!==e)return;let n=t.from,r=t.to;const i=Js(_c.location.href);let o=n?Js(n):void 0;const a=Js(r);(!o||!o.path)&&(o=i),i.protocol===a.protocol&&i.host===a.host&&(r=a.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),Al({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){El()===e&&Al({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:gs(t)},{event:t})}}(e))}}};ic(Qc,eu);const tu="Dedupe",nu=()=>{let e;return{name:tu,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&!(!function(e,t){const n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!iu(e,t)||!ru(e,t))}(e,t)&&!function(e,t){const n=ou(t),r=ou(e);return!!(n&&r&&n.type===r.type&&n.value===r.value&&iu(e,t)&&ru(e,t))}(e,t))}(t,e))return Ec&&Ba.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function ru(e,t){let n=au(e),r=au(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function iu(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return n.join("")===r.join("")}catch{return!1}}function ou(e){return e.exception&&e.exception.values&&e.exception.values[0]}function au(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}ic(tu,nu);const su="GlobalHandlers",lu=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:su,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(e){const t="error";cs(t,e),us(t,Ms)}(t=>{const{stackParser:n,attachStacktrace:r}=du();if(El()!==e||kc())return;const{msg:i,url:o,line:a,column:s,error:l}=t,c=void 0===l&&fa(i)?function(e,t,n,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=da(e)?e.message:e,a="Error";const s=o.match(i);return s&&(a=s[1],o=s[2]),cu({exception:{values:[{type:a,value:o}]}},t,n,r)}(i,o,a,s):cu(Mc(n,l||i,void 0,r,!1),o,a,s);c.level="error",kl(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}(e),uu("onerror")),t.onunhandledrejection&&(function(e){!function(e){const t="unhandledrejection";cs(t,e),us(t,Ls)}(t=>{const{stackParser:n,attachStacktrace:r}=du();if(El()!==e||kc())return;const i=function(e){if(ga(e))return e;const t=e;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return e}(t),o=ga(i)?function(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}(i):Mc(n,i,void 0,r,!0);o.level="error",kl(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(e),uu("onunhandledrejection"))}}};function cu(e,t,n,r){const i=e.exception=e.exception||{},o=i.values=i.values||[],a=o[0]=o[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[],c=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,d=fa(t)&&t.length>0?t:function(){try{return Ma.document.location.href}catch{return""}}();return 0===l.length&&l.push({colno:c,filename:d,function:"?",in_app:!0,lineno:u}),e}function uu(e){Ec&&Ba.log(`Global Handler attached: ${e}`)}function du(){const e=El();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}ic(su,lu);const hu="HttpContext",fu=()=>({name:hu,setupOnce(){},preprocessEvent(e){if(!_c.navigator&&!_c.location&&!_c.document)return;const t=e.request&&e.request.url||_c.location&&_c.location.href,{referrer:n}=_c.document||{},{userAgent:r}=_c.navigator||{},i={...e.request&&e.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...e.request,...t&&{url:t},headers:i};e.request=o}});ic(hu,fu);const pu="LinkedErrors",gu=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:pu,setupOnce(){},preprocessEvent(e,r,i){const o=i.getOptions();ka(Ic,o.stackParser,o.maxValueLength,n,t,e,r)}}};ic(pu,gu);const mu=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],vu="TryCatch",yu=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:vu,setupOnce(){t.setTimeout&&qa(_c,"setTimeout",bu),t.setInterval&&qa(_c,"setInterval",bu),t.requestAnimationFrame&&qa(_c,"requestAnimationFrame",wu),t.XMLHttpRequest&&"XMLHttpRequest"in _c&&qa(XMLHttpRequest.prototype,"send",xu);const e=t.eventTarget;e&&(Array.isArray(e)?e:mu).forEach(Cu)}}};function bu(e){return function(...t){const n=t[0];return t[0]=Ac(n,{mechanism:{data:{function:as(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function wu(e){return function(t){return e.apply(this,[Ac(t,{mechanism:{data:{function:"requestAnimationFrame",handler:as(e)},handled:!1,type:"instrument"}})])}}function xu(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&qa(n,e,function(t){const n={mechanism:{data:{function:e,handler:as(t)},handled:!1,type:"instrument"}},r=Xa(t);return r&&(n.mechanism.data.handler=as(r)),Ac(t,n)})}),e.apply(this,t)}}function Cu(e){const t=_c,n=t[e]&&t[e].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(qa(n,"addEventListener",function(t){return function(n,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=Ac(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:as(r),target:e},handled:!1,type:"instrument"}}))}catch{}return t.apply(this,[n,Ac(r,{mechanism:{data:{function:"addEventListener",handler:as(r),target:e},handled:!1,type:"instrument"}}),i])}}),qa(n,"removeEventListener",function(e){return function(t,n,r){const i=n;try{const n=i&&i.__sentry_wrapped__;n&&e.call(this,t,n,r)}catch{}return e.call(this,t,i,r)}}))}ic(vu,yu);const _u=[vc(),Cc(),yu(),eu(),lu(),gu(),nu(),fu()];function Su(e={}){void 0===e.defaultIntegrations&&(e.defaultIntegrations=[..._u]),void 0===e.release&&("string"==typeof __SENTRY_RELEASE__&&(e.release=__SENTRY_RELEASE__),_c.SENTRY_RELEASE&&_c.SENTRY_RELEASE.id&&(e.release=_c.SENTRY_RELEASE.id)),void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0);const t={...e,stackParser:is(e.stackParser||Kc),integrations:tc(e),transport:e.transport||(Es()?Nc:zc)};uc(jc,t),e.autoSessionTracking&&function(){if(typeof _c.document>"u")return void(Ec&&Ba.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));Tl({ignoreDuration:!0}),Pl(),zs(({from:e,to:t})=>{void 0!==e&&e!==t&&(Tl({ignoreDuration:!0}),Pl())})}()}var ku=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Au(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Eu(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Iu=(e=>(e.INLINE="inline",e.OVERLAY="overlay",e))(Iu||{}),Tu=(e=>(e.TOP="top",e.BOTTOM="bottom",e.HIDDEN="",e))(Tu||{});function Fu(e,t){return{...t,message:e}}const Ou=[{name:"emoticons",list:["afro-1","afro","agent","alien-1","alien","angel","angry-1","angry-2","angry-3","angry-4","angry-5","angry","arguing","arrogant","asian-1","asian","avatar","baby-1","baby-2","baby","bully","burglar","businessman","cheeky-1","cheeky","clown","confused-1","confused-2","confused-3","confused","creepy","crying-1","crying-2","crying-3","crying","dazed-1","dazed-2","dazed-3","dazed","dead-1","dead-2","dead-3","dead-4","dead-5","dead-6","dead","desperate-1","desperate","detective","dissapointment","doctor","drunk","dumb","emo-1","emo-2","emo","emoticon","evil","faint-1","faint","flirt-1","flirt-2","flirt","flirty","gangster","geek-1","geek","gentleman-1","gentleman-2","gentleman-3","gentleman-4","gentleman","ginger","girl-1","girl","goofy-1","goofy-2","goofy-3","goofy-4","goofy","grubby-1","grubby","happy-1","happy-10","happy-11","happy-12","happy-13","happy-14","happy-15","happy-16","happy-2","happy-3","happy-4","happy-5","happy-6","happy-7","happy-8","happy-9","happy","harry-potter","heisenberg","hipster-1","hipster-2","hipster","in-love-1","in-love-2","in-love-3","in-love-4","in-love-5","in-love-6","in-love","japan","jew","joyful-1","joyful-2","joyful","kiss-1","kiss-2","kiss-3","kiss-4","kiss","laughing-1","laughing-2","laughing-3","laughing","listening","love","manly","miserly-1","miserly","nerd-1","nerd-2","nerd-3","nerd-4","nerd","ninja","pirate-1","pirate-2","pirate","punk-1","punk-2","punk","rapper","relieved","rich-1","rich-2","rich","rockstar","sad-1","sad-2","sad-3","sad-4","sad-5","sad-6","sad","scared-1","scared-2","scared-3","scared","sceptic-1","sceptic-2","sceptic-3","sceptic-4","sceptic-5","sceptic-6","sceptic-7","sceptic","secret","shocked-1","shocked-2","shocked-3","shocked","sick-1","sick-2","sick-3","sick-4","sick","silent","skeleton","smile","smiling-1","smiling","smoked","smug-1","smug-2","smug-3","smug-4","smug-5","smug-6","smug","sporty","stunned","superhero-1","superhero-2","superhero-3","superhero-4","superhero","surprised-1","surprised","thinking","tired-1","tired-2","tired-3","tired","tough-1","tough","trendy","vampire-1","vampire","wink-1","wink-2","wink","winking-1","winking","yawning-1","yawning-2","yawning-3","yawning","yelling","zombie"],type:"svg",thumbnailUrl:"images/stickers/categories/emoticon.svg"},{name:"doodles",items:100,type:"svg",thumbnailUrl:"images/stickers/categories/doodles.svg"},{name:"landmarks",items:100,type:"svg",thumbnailUrl:"images/stickers/categories/landmark.svg",invertPreview:!0},{name:"bubbles",items:104,type:"png",thumbnailUrl:"images/stickers/categories/speech-bubble.svg"},{name:"transportation",items:22,type:"svg",thumbnailUrl:"images/stickers/categories/transportation.svg",invertPreview:!0},{name:"beach",items:22,type:"svg",thumbnailUrl:"images/stickers/categories/beach.svg",invertPreview:!0}],Pu={emoticons:Fu("Emoticons"),doodles:Fu("Doodles"),landmarks:Fu("Landmarks"),bubbles:Fu("Bubbles"),transportation:Fu("Transportation"),beach:Fu("Beach")},Mu={fill:"#1565C0",opacity:1,backgroundColor:null,strokeWidth:.05,stroke:"#000"},Ru=[1,8,15,20,25];var Lu=(e=>(e.DARK="dark",e.LIGHT="light",e))(Lu||{});const ju=[{name:Lu.LIGHT,colors:{"--be-foreground-base":"0 0 0","--be-primary-light":"191 219 254","--be-primary":"59 130 246","--be-primary-dark":"37 99 235","--be-on-primary":"255 255 255","--be-danger":"179 38 30","--be-on-danger":"255 255 255","--be-background":"255 255 255","--be-background-alt":"250 250 250","--be-paper":"255 255 255","--be-disabled-bg-opacity":"12%","--be-disabled-fg-opacity":"26%","--be-hover-opacity":"4%","--be-focus-opacity":"12%","--be-selected-opacity":"8%","--be-text-main-opacity":"87%","--be-text-muted-opacity":"60%","--be-divider-opacity":"12%"}},{name:Lu.DARK,isDark:!0,colors:{"--be-foreground-base":"255 255 255","--be-primary-light":"239 246 255","--be-primary":"191 219 254","--be-primary-dark":"147 197 253","--be-on-primary":"56 30 114","--be-danger":"242 184 181","--be-on-danger":"96 20 16","--be-background":"20 21 23","--be-background-alt":"26 27 30","--be-paper":"44 46 51","--be-disabled-bg-opacity":"12%","--be-disabled-fg-opacity":"30%","--be-hover-opacity":"8%","--be-focus-opacity":"12%","--be-selected-opacity":"16%","--be-text-main-opacity":"100%","--be-text-muted-opacity":"70%","--be-divider-opacity":"12%"}}];var Du=(e=>(e.FILTER="filter",e.RESIZE="resize",e.CROP="crop",e.DRAW="draw",e.TEXT="text",e.SHAPES="shapes",e.STICKERS="stickers",e.FRAME="frame",e.CORNERS="corners",e.MERGE="merge",e))(Du||{});function Nu(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function zu(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nu(e))&&(r&&(r+=" "),r+=t);return r}const Bu=p((n,r)=>{const{attr:i,size:o,title:a,className:s,color:l,style:c,children:u,viewBox:d,width:h,height:f,...p}=n;return t("svg",{"aria-hidden":!a,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:d||"0 0 24 24",...i,...p,className:zu("svg-icon",s,Uu(o)),style:{color:l,...c},ref:r,height:f||"1em",width:h||"1em",children:[a&&e("title",{children:a}),u]})});function Uu(e){switch(e){case"2xs":return"icon-2xs";case"xs":return"icon-xs";case"sm":return"icon-sm";case"md":return"icon-md";case"lg":return"icon-lg";case"xl":return"icon-xl";default:return e}}function Vu(t,n="",r){return i.memo(i.forwardRef((i,o)=>e(Bu,{"data-testid":`${n}Icon`,ref:o,viewBox:r,...i,size:i.size||"md",children:t})))}function $u(e,t=""){return Vu(Wu(e),t)}function Wu(e){return(null==e?void 0:e.map)&&e.map((e,t)=>i.createElement(e.tag,{key:t,...e.attr},Wu(e.child)))}const Hu=Vu(e("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined"),qu=Vu(e("path",{d:"M21 15h2v2h-2v-2zm0-4h2v2h-2v-2zm2 8h-2v2c1 0 2-1 2-2zM13 3h2v2h-2V3zm8 4h2v2h-2V7zm0-4v2h2c0-1-1-2-2-2zM1 7h2v2H1V7zm16-4h2v2h-2V3zm0 16h2v2h-2v-2zM3 3C2 3 1 4 1 5h2V3zm6 0h2v2H9V3zM5 3h2v2H5V3zm-4 8v8c0 1.1.9 2 2 2h12V11H1zm2 8 2.5-3.21 1.79 2.15 2.5-3.22L13 19H3z"}),"PhotoSizeSelectLargeOutlined"),Gu=Vu(e("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"}),"CropOutlined"),Yu=Vu(e("path",{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}),"TextFieldsOutlined"),Xu=Vu(e("path",{d:"M10.5 4.5c.28 0 .5.22.5.5v2h6v6h2c.28 0 .5.22.5.5s-.22.5-.5.5h-2v6h-2.12c-.68-1.75-2.39-3-4.38-3s-3.7 1.25-4.38 3H4v-2.12c1.75-.68 3-2.39 3-4.38 0-1.99-1.24-3.7-2.99-4.38L4 7h6V5c0-.28.22-.5.5-.5m0-2C9.12 2.5 8 3.62 8 5H4c-1.1 0-1.99.9-1.99 2v3.8h.29c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-.3c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7v.3H17c1.1 0 2-.9 2-2v-4c1.38 0 2.5-1.12 2.5-2.5S20.38 11 19 11V7c0-1.1-.9-2-2-2h-4c0-1.38-1.12-2.5-2.5-2.5z"}),"ExtensionOutlined"),Ku=Vu(e("path",{d:"M10.25 13c0 .69-.56 1.25-1.25 1.25S7.75 13.69 7.75 13s.56-1.25 1.25-1.25 1.25.56 1.25 1.25zM15 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm7 .25c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10zM10.66 4.12C12.06 6.44 14.6 8 17.5 8c.46 0 .91-.05 1.34-.12C17.44 5.56 14.9 4 12 4c-.46 0-.91.05-1.34.12zM4.42 9.47c1.71-.97 3.03-2.55 3.66-4.44C6.37 6 5.05 7.58 4.42 9.47zM20 12c0-.78-.12-1.53-.33-2.24-.7.15-1.42.24-2.17.24-3.13 0-5.92-1.44-7.76-3.69C8.69 8.87 6.6 10.88 4 11.86c.01.04 0 .09 0 .14 0 4.41 3.59 8 8 8s8-3.59 8-8z"}),"FaceOutlined"),Zu=Vu(e("path",{d:"M20 4h-4l-4-4-4 4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H4V6h4.52l3.52-3.5L15.52 6H20v14zM6 18h12V8H6v10zm2-8h8v6H8v-6z"}),"FilterFramesOutlined"),Ju=Vu(e("path",{d:"M6.41 21 5 19.59l4.83-4.83c.75-.75 1.17-1.77 1.17-2.83v-5.1L9.41 8.41 8 7l4-4 4 4-1.41 1.41L13 6.83v5.1c0 1.06.42 2.08 1.17 2.83L19 19.59 17.59 21 12 15.41 6.41 21z"}),"MergeOutlined"),Qu=Vu(e("path",{d:"M19 19h2v2h-2v-2zm0-2h2v-2h-2v2zM3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm0-4h2V3H3v2zm4 0h2V3H7v2zm8 16h2v-2h-2v2zm-4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm-8 0h2v-2H7v2zm-4 0h2v-2H3v2zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2V8z"}),"RoundedCornerOutlined"),ed=Vu(e("path",{d:"M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67 1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}),"PhotoLibraryOutlined"),td=Vu(e("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z"}),"HistoryOutlined"),nd=Vu([e("path",{d:"m2.53 19.65 1.34.56v-9.03l-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61zm19.5-3.7L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zm-9.2 3.8L7.87 7.79l7.35-3.04h.01l4.95 11.95-7.35 3.05z"},"0"),e("circle",{cx:"11",cy:"9",r:"1"},"1"),e("path",{d:"M5.88 19.75c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z"},"2")],"StyleOutlined"),rd=Vu(e("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}),"DeleteOutlined"),id=Vu(e("path",{d:"M18.85,10.39l1.06-1.06c0.78-0.78,0.78-2.05,0-2.83L18.5,5.09c-0.78-0.78-2.05-0.78-2.83,0l-1.06,1.06L18.85,10.39z M14.61,11.81L7.41,19H6v-1.41l7.19-7.19L14.61,11.81z M13.19,7.56L4,16.76V21h4.24l9.19-9.19L13.19,7.56L13.19,7.56z M19,17.5 c0,2.19-2.54,3.5-5,3.5c-0.55,0-1-0.45-1-1s0.45-1,1-1c1.54,0,3-0.73,3-1.5c0-0.47-0.48-0.87-1.23-1.2l1.48-1.48 C18.32,15.45,19,16.29,19,17.5z M4.58,13.35C3.61,12.79,3,12.06,3,11c0-1.8,1.89-2.63,3.56-3.36C7.59,7.18,9,6.56,9,6 c0-0.41-0.78-1-2-1C5.74,5,5.2,5.61,5.17,5.64C4.82,6.05,4.19,6.1,3.77,5.76C3.36,5.42,3.28,4.81,3.62,4.38C3.73,4.24,4.76,3,7,3 c2.24,0,4,1.32,4,3c0,1.87-1.93,2.72-3.64,3.47C6.42,9.88,5,10.5,5,11c0,0.31,0.43,0.6,1.07,0.86L4.58,13.35z"}),"Draw"),od=Vu(e("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}),"HomeOutlined"),ad={[Du.FILTER]:{name:Fu("Applied Filters"),icon:Hu},[Du.RESIZE]:{name:Fu("Resized Image"),icon:qu},[Du.CROP]:{name:Fu("Cropped Image"),icon:Gu},[Du.DRAW]:{name:Fu("Added Drawing"),icon:id},[Du.TEXT]:{name:Fu("Added Text"),icon:Yu},[Du.SHAPES]:{name:Fu("Added Shape"),icon:Xu},[Du.STICKERS]:{name:Fu("Added Sticker"),icon:Ku},[Du.FRAME]:{name:Fu("Added Frame"),icon:Zu},[Du.MERGE]:{name:Fu("Merged Objects"),icon:Ju},[Du.CORNERS]:{name:Fu("Rounded Corner"),icon:Qu},bgImage:{name:Fu("Replaced Background Image"),icon:ed},overlayImage:{name:Fu("Added Image"),icon:ed},initial:{name:Fu("Initial"),icon:od},loadedState:{name:Fu("Loaded State"),icon:td},objectStyle:{name:Fu("Changed Style"),icon:nd},deletedObject:{name:Fu("Deleted object"),icon:rd}},sd=Object.values(Du).map(e=>({name:e,icon:ad[e].icon,action:e===Du.MERGE?e=>{e.tools.merge.apply()}:e})),ld={filter:Fu("filter"),resize:Fu("resize"),crop:Fu("crop"),draw:Fu("draw"),text:Fu("text"),shapes:Fu("shapes"),stickers:Fu("stickers"),frame:Fu("frame"),corners:Fu("corners"),merge:Fu("merge")},cd=Vu(e("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}),"FileDownloadOutlined"),ud="3.0.5",dd={selector:"pixie-editor",textureSize:4096,activeLanguage:"en",ui:{visible:!0,mode:Iu.INLINE,forceOverlayModeOnMobile:!0,activeTheme:Lu.LIGHT,themes:ju,allowEditorClose:!0,menubar:{items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",icon:td,align:"right",desktopOnly:!0,action:e=>{e.togglePanel("history")}},{type:"button",icon:cd,label:Fu("Done"),align:"right",action:e=>{var t;null!=(t=e.state.config.ui)&&t.showExportPanel?e.state.togglePanel("export",!0):e.tools.export.save()}}]},nav:{position:Tu.BOTTOM,items:[...sd]},openImageDialog:{show:!0,sampleImages:[{url:"images/samples/sample1.jpg",thumbnail:"images/samples/sample1_thumbnail.jpg"},{url:"images/samples/sample2.jpg",thumbnail:"images/samples/sample2_thumbnail.jpg"},{url:"images/samples/sample3.jpg",thumbnail:"images/samples/sample3_thumbnail.jpg"}]},colorPresets:{items:["rgb(0,0,0)","rgb(255, 255, 255)","rgb(242, 38, 19)","rgb(249, 105, 14)","rgb(253, 227, 167)","rgb(4, 147, 114)","rgb(30, 139, 195)","rgb(142, 68, 173)"]}},objectDefaults:{global:{...Mu},sticker:{fill:void 0},text:{textAlign:"initial",underline:!1,linethrough:!1,fontStyle:"normal",fontFamily:"Times New Roman",fontWeight:"normal",stroke:void 0,fontSize:40}},tools:{filter:{items:["grayscale","blackWhite","sharpen","invert","vintage","polaroid","kodachrome","technicolor","brownie","sepia","removeColor","brightness","gamma","noise","pixelate","blur","emboss","blendColor"]},zoom:{allowUserZoom:!0,fitImageToScreen:!0},crop:{allowCustomRatio:!0,defaultRatio:"1:1",presets:[{ratio:null,name:"Custom"},{ratio:"1:1",name:"Square"},{ratio:"4:3"},{ratio:"16:9"},{ratio:"5:3"},{ratio:"5:4"},{ratio:"6:4"},{ratio:"7:5"},{ratio:"10:8"}]},text:{defaultText:"Double click to edit",controlsPadding:6,items:[{family:"Roboto",src:"fonts/open-sans-v27-latin-ext_latin-regular.woff2"},{family:"Fuzzy Bubbles",src:"fonts/fuzzy-bubbles-v3-latin-700.woff2",descriptors:{weight:"700"}},{family:"Aleo Bold",src:"fonts/aleo-v4-latin-ext_latin-700.woff2",descriptors:{weight:"700"}},{family:"Amatic SC",src:"fonts/amatic-sc-v16-latin-ext_latin-regular.woff2"},{family:"Corinthia Bold",src:"fonts/corinthia-v7-latin-ext_latin-700.woff2"},{family:"Bungee Inline",src:"fonts/bungee-inline-v6-latin-ext_latin-regular.woff2"},{family:"Robot Slab Bold",src:"fonts/roboto-slab-v16-latin-ext_latin-500.woff2"},{family:"Carter One",src:"fonts/carter-one-v12-latin-regular.woff2"},{family:"Cody Star",src:"fonts/codystar-v10-latin-ext_latin-regular.woff2"},{family:"Fira Sans",src:"fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"},{family:"Krona One",src:"fonts/krona-one-v9-latin-ext_latin-regular.woff2"},{family:"Kumar One Outline",src:"fonts/kumar-one-outline-v8-latin-ext_latin-regular.woff2"},{family:"Lobster Two",src:"fonts/lobster-two-v13-latin-regular.woff2"},{family:"Molle Italic",src:"fonts/molle-v11-latin-ext_latin-italic.woff2"},{family:"Monoton",src:"fonts/monoton-v10-latin-regular.woff2"},{family:"Nixie One",src:"fonts/nixie-one-v11-latin-regular.woff2"},{family:"Permanent Marker",src:"fonts/permanent-marker-v10-latin-regular.woff2"},{family:"Sancreek",src:"fonts/sancreek-v13-latin-ext_latin-regular.woff2"},{family:"Stint Ultra Expanded",src:"fonts/stint-ultra-expanded-v10-latin-regular.woff2"},{family:"VT323",src:"fonts/vt323-v12-latin-ext_latin-regular.woff2"},{family:"Trash Hand",src:"fonts/TrashHand.ttf"}]},draw:{brushSizes:Ru,brushTypes:["PencilBrush","EraserBrush","SprayBrush","CircleBrush","DiamondBrush","VLineBrush","HLineBrush","SquareBrush"]},shapes:{items:[{name:"circle",type:"Circle"},{name:"square",type:"Rect",options:{lockUniScaling:!1}},{name:"triangle",type:"Triangle"},{name:"ellipse",type:"Ellipse",options:{lockUniScaling:!1}},{name:"Arrow #1",type:"Path",options:{path:"M 294.9 16.4 l 15.7 42.2 c -171.4 70.3 -294 242.3 -289.1 437.4 l 14.7 -1 c 9.1 -0.6 18.1 -1.2 27.1 -1.9 l 14.7 -1 c -4.3 -170.1 102.5 -320 252 -381.3 l 15.7 42.2 c 34.7 -40.5 83.1 -76.6 144.8 -99.8 c -58.1 -26.2 -124.9 -39.6 -195.6 -36.8 z"}},{name:"Arrow #2",type:"Path",options:{path:"M 16 248.4 v 14.9 h 447.5 l -93.2 82.5 l 11.9 10.5 l 113.8 -100.2 l -113.6 -100.4 l -11.8 10.5 l 92.9 82.2 z"}},{name:"Arrow #3",type:"Path",options:{path:"M 496 256 l -118.6 -66 v 40.8 h -361.4 v 50.4 h 361.4 v 40.8 l 118.6 -66 z"}},{name:"Line",type:"Path",options:{path:"M 16 256 h 480",strokeWidth:10,stroke:"#000",padding:10}},{name:"Star",type:"Path",options:{path:"M 256 406.3 l 148.3 78 l -28.3 -165.2 l 120 -117 l -165.8 -24.1 l -74.2 -150.3 l -74.2 150.3 l -165.8 24.1 l 120 117 l -28.3 165.2 z"}},{name:"Polygon",type:"Path",options:{path:"M 256 19.6 l 156.6 57.1 l 83.4 144.3 l -28.9 164.2 l -127.7 107.2 h -166.8 l -127.7 -107.2 l -28.9 -164.2 l 83.4 -144.3 z"}},{name:"Badge",type:"Path",options:{path:"M 257.3 16.2 s -148 58.2 -204.4 81.4 c 0 75.7 -16.8 303.5 204.4 398.2 c 218.7 -94.6 201.9 -322.4 201.9 -398.2 c -62.1 -23.6 -201.9 -81.4 -201.9 -81.4 z"}}].slice()},stickers:{items:Ou},import:{validImgExtensions:["png","jpg","jpeg","svg","gif"],fitOverlayToScreen:!0,openDroppedImageAsBackground:!1},export:{defaultFormat:"png",defaultQuality:.8,defaultName:"image"},frame:{items:[{name:"basic",mode:"basic",size:{min:1,max:35,default:10}},{name:"pine",mode:"stretch",size:{min:1,max:35,default:15}},{name:"oak",mode:"stretch",size:{min:1,max:35,default:15}},{name:"rainbow",mode:"stretch",size:{min:1,max:35,default:15}},{name:"grunge1",display_name:"grunge #1",mode:"stretch",size:{min:1,max:35,default:15}},{name:"grunge2",display_name:"grunge #2",mode:"stretch",size:{min:1,max:35,default:20}},{name:"ebony",mode:"stretch",size:{min:1,max:35,default:15}},{name:"art1",display_name:"Art #1",mode:"repeat",size:{min:10,max:70,default:55}},{name:"art2",display_name:"Art #2",mode:"repeat",size:{min:10,max:70,default:55}}]}}},hd=e=>{let t;const n=new Set,r=(e,r)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=r??("object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},a=t=e(r,i,o);return o};var fd={exports:{}},pd={},gd={exports:{}},md={},vd=i;
9
+ */var mi=(fi||(fi=1,function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",o="__lodash_placeholder__",a=32,s=128,l=256,c=1/0,u=9007199254740991,d=NaN,h=4294967295,f=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",l]],p="[object Arguments]",g="[object Array]",m="[object Boolean]",v="[object Date]",y="[object Error]",b="[object Function]",w="[object GeneratorFunction]",x="[object Map]",C="[object Number]",_="[object Object]",S="[object Promise]",k="[object RegExp]",A="[object Set]",E="[object String]",I="[object Symbol]",T="[object WeakMap]",F="[object ArrayBuffer]",O="[object DataView]",P="[object Float32Array]",M="[object Float64Array]",R="[object Int8Array]",L="[object Int16Array]",j="[object Int32Array]",D="[object Uint8Array]",N="[object Uint8ClampedArray]",z="[object Uint16Array]",B="[object Uint32Array]",U=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,q=RegExp(W.source),G=RegExp(H.source),Y=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,pe=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,me=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,be=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ce="\\u2700-\\u27bf",_e="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",ke="\\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",Ee="['’]",Ie="["+we+"]",Te="["+Ae+"]",Fe="["+xe+"]",Oe="\\d+",Pe="["+Ce+"]",Me="["+_e+"]",Re="[^"+we+Ae+Oe+Ce+_e+Se+"]",Le="\\ud83c[\\udffb-\\udfff]",je="[^"+we+"]",De="(?:\\ud83c[\\udde6-\\uddff]){2}",Ne="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Ue="(?:"+Me+"|"+Re+")",Ve="(?:"+ze+"|"+Re+")",$e="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Fe+"|"+Le+")?",qe="["+ke+"]?",Ge=qe+He+"(?:"+Be+"(?:"+[je,De,Ne].join("|")+")"+qe+He+")*",Ye="(?:"+[Pe,De,Ne].join("|")+")"+Ge,Xe="(?:"+[je+Fe+"?",Fe,De,Ne,Ie].join("|")+")",Ke=RegExp(Ee,"g"),Ze=RegExp(Fe,"g"),Je=RegExp(Le+"(?="+Le+")|"+Xe+Ge,"g"),Qe=RegExp([ze+"?"+Me+"+"+$e+"(?="+[Te,ze,"$"].join("|")+")",Ve+"+"+We+"(?="+[Te,ze+Ue,"$"].join("|")+")",ze+"?"+Ue+"+"+$e,ze+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oe,Ye].join("|"),"g"),et=RegExp("["+Be+we+xe+ke+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["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"],rt=-1,it={};it[P]=it[M]=it[R]=it[L]=it[j]=it[D]=it[N]=it[z]=it[B]=!0,it[p]=it[g]=it[F]=it[m]=it[O]=it[v]=it[y]=it[b]=it[x]=it[C]=it[_]=it[k]=it[A]=it[E]=it[T]=!1;var ot={};ot[p]=ot[g]=ot[F]=ot[O]=ot[m]=ot[v]=ot[P]=ot[M]=ot[R]=ot[L]=ot[j]=ot[x]=ot[C]=ot[_]=ot[k]=ot[A]=ot[E]=ot[I]=ot[D]=ot[N]=ot[z]=ot[B]=!0,ot[y]=ot[b]=ot[T]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,lt=parseInt,ct="object"==typeof En&&En&&En.Object===Object&&En,ut="object"==typeof self&&self&&self.Object===Object&&self,dt=ct||ut||Function("return this")(),ht=t&&!t.nodeType&&t,ft=ht&&e&&!e.nodeType&&e,pt=ft&&ft.exports===ht,gt=pt&&ct.process,mt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||gt&&gt.binding&&gt.binding("util")}catch(e){}}(),vt=mt&&mt.isArrayBuffer,yt=mt&&mt.isDate,bt=mt&&mt.isMap,wt=mt&&mt.isRegExp,xt=mt&&mt.isSet,Ct=mt&&mt.isTypedArray;function _t(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function St(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function kt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function At(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Et(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function It(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function Tt(e,t){return!(null==e||!e.length)&&zt(e,t,0)>-1}function Ft(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Ot(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Pt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Mt(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function Rt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var jt=$t("length");function Dt(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Nt(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function zt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Nt(e,Ut,n)}function Bt(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Ut(e){return e!=e}function Vt(e,t){var n=null==e?0:e.length;return n?qt(e,t)/n:d}function $t(e){return function(t){return null==t?n:t[e]}}function Wt(e){return function(t){return null==e?n:e[t]}}function Ht(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function qt(e,t){for(var r,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==n&&(r=r===n?a:r+a)}return r}function Gt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Yt(e){return e?e.slice(0,hn(e)+1).replace(ne,""):e}function Xt(e){return function(t){return e(t)}}function Kt(e,t){return Ot(t,function(t){return e[t]})}function Zt(e,t){return e.has(t)}function Jt(e,t){for(var n=-1,r=e.length;++n<r&&zt(t,e[n],0)>-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=Wt({"À":"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"}),tn=Wt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function an(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n];s!==t&&s!==o||(e[n]=o,a[i++]=n)}return a}function ln(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function un(e){return rn(e)?function(e){for(var t=Je.lastIndex=0;Je.test(e);)++t;return t}(e):jt(e)}function dn(e){return rn(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.split("")}(e)}function hn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var fn=Wt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),pn=function e(t){var re,we=(t=null==t?dt:pn.defaults(dt.Object(),t,pn.pick(dt,nt))).Array,xe=t.Date,Ce=t.Error,_e=t.Function,Se=t.Math,ke=t.Object,Ae=t.RegExp,Ee=t.String,Ie=t.TypeError,Te=we.prototype,Fe=_e.prototype,Oe=ke.prototype,Pe=t["__core-js_shared__"],Me=Fe.toString,Re=Oe.hasOwnProperty,Le=0,je=(re=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"",De=Oe.toString,Ne=Me.call(ke),ze=dt._,Be=Ae("^"+Me.call(Re).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=pt?t.Buffer:n,Ve=t.Symbol,$e=t.Uint8Array,We=Ue?Ue.allocUnsafe:n,He=an(ke.getPrototypeOf,ke),qe=ke.create,Ge=Oe.propertyIsEnumerable,Ye=Te.splice,Xe=Ve?Ve.isConcatSpreadable:n,Je=Ve?Ve.iterator:n,et=Ve?Ve.toStringTag:n,at=function(){try{var e=uo(ke,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ut=xe&&xe.now!==dt.Date.now&&xe.now,ht=t.setTimeout!==dt.setTimeout&&t.setTimeout,ft=Se.ceil,gt=Se.floor,mt=ke.getOwnPropertySymbols,jt=Ue?Ue.isBuffer:n,Wt=t.isFinite,gn=Te.join,mn=an(ke.keys,ke),vn=Se.max,yn=Se.min,bn=xe.now,wn=t.parseInt,xn=Se.random,Cn=Te.reverse,_n=uo(t,"DataView"),Sn=uo(t,"Map"),kn=uo(t,"Promise"),An=uo(t,"Set"),En=uo(t,"WeakMap"),In=uo(ke,"create"),Tn=En&&new En,Fn={},On=Do(_n),Pn=Do(Sn),Mn=Do(kn),Rn=Do(An),Ln=Do(En),jn=Ve?Ve.prototype:n,Dn=jn?jn.valueOf:n,Nn=jn?jn.toString:n;function zn(e){if(es(e)&&!$a(e)&&!(e instanceof $n)){if(e instanceof Vn)return e;if(Re.call(e,"__wrapped__"))return No(e)}return new Vn(e)}var Bn=function(){function e(){}return function(t){if(!Qa(t))return{};if(qe)return qe(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Un(){}function Vn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function $n(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new Hn(e);this.size=t.size}function Xn(e,t){var n=$a(e),r=!n&&Va(e),i=!n&&!r&&Ga(e),o=!n&&!r&&!i&&ls(e),a=n||r||i||o,s=a?Gt(e.length,Ee):[],l=s.length;for(var c in e)!t&&!Re.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yo(c,l))||s.push(c);return s}function Kn(e){var t=e.length;return t?e[Gr(0,t-1)]:n}function Zn(e,t){return Ro(Ii(e),ar(t,0,e.length))}function Jn(e){return Ro(Ii(e))}function Qn(e,t,r){(r!==n&&!za(e[t],r)||r===n&&!(t in e))&&ir(e,t,r)}function er(e,t,r){var i=e[t];Re.call(e,t)&&za(i,r)&&(r!==n||t in e)||ir(e,t,r)}function tr(e,t){for(var n=e.length;n--;)if(za(e[n][0],t))return n;return-1}function nr(e,t,n,r){return dr(e,function(e,i,o){t(r,e,n(e),o)}),r}function rr(e,t){return e&&Ti(t,Fs(t),e)}function ir(e,t,n){"__proto__"==t&&at?at(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function or(e,t){for(var r=-1,i=t.length,o=we(i),a=null==e;++r<i;)o[r]=a?n:ks(e,t[r]);return o}function ar(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function sr(e,t,r,i,o,a){var s,l=1&t,c=2&t,u=4&t;if(r&&(s=o?r(e,i,o,a):r(e)),s!==n)return s;if(!Qa(e))return e;var d=$a(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ii(e,s)}else{var h=po(e),f=h==b||h==w;if(Ga(e))return Ci(e,l);if(h==_||h==p||f&&!o){if(s=c||f?{}:mo(e),!l)return c?function(e,t){return Ti(e,fo(e),t)}(e,function(e,t){return e&&Ti(t,Os(t),e)}(s,e)):function(e,t){return Ti(e,ho(e),t)}(e,rr(s,e))}else{if(!ot[h])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case F:return _i(e);case m:case v:return new i(+e);case O:return function(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case P:case M:case R:case L:case j:case D:case N:case z:case B:return Si(e,n);case x:return new i;case C:case E:return new i(e);case k:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new i;case I:return r=e,Dn?ke(Dn.call(r)):{}}}(e,h,l)}}a||(a=new Yn);var g=a.get(e);if(g)return g;a.set(e,s),os(e)?e.forEach(function(n){s.add(sr(n,t,r,n,e,a))}):ts(e)&&e.forEach(function(n,i){s.set(i,sr(n,t,r,i,e,a))});var y=d?n:(u?c?ro:no:c?Os:Fs)(e);return kt(y||e,function(n,i){y&&(n=e[i=n]),er(s,i,sr(n,t,r,i,e,a))}),s}function lr(e,t,r){var i=r.length;if(null==e)return!i;for(e=ke(e);i--;){var o=r[i],a=t[o],s=e[o];if(s===n&&!(o in e)||!a(s))return!1}return!0}function cr(e,t,i){if("function"!=typeof e)throw new Ie(r);return Fo(function(){e.apply(n,i)},t)}function ur(e,t,n,r){var i=-1,o=Tt,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;n&&(t=Ot(t,Xt(n))),r?(o=Ft,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i<s;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,a&&d==d){for(var h=c;h--;)if(t[h]===d)continue e;l.push(u)}else o(t,d,r)||l.push(u)}return l}zn.templateSettings={escape:Y,evaluate:X,interpolate:K,variable:"",imports:{_:zn}},zn.prototype=Un.prototype,zn.prototype.constructor=zn,Vn.prototype=Bn(Un.prototype),Vn.prototype.constructor=Vn,$n.prototype=Bn(Un.prototype),$n.prototype.constructor=$n,Wn.prototype.clear=function(){this.__data__=In?In(null):{},this.size=0},Wn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Wn.prototype.get=function(e){var t=this.__data__;if(In){var r=t[e];return r===i?n:r}return Re.call(t,e)?t[e]:n},Wn.prototype.has=function(e){var t=this.__data__;return In?t[e]!==n:Re.call(t,e)},Wn.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=In&&t===n?i:t,this},Hn.prototype.clear=function(){this.__data__=[],this.size=0},Hn.prototype.delete=function(e){var t=this.__data__,n=tr(t,e);return!(n<0||(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,0))},Hn.prototype.get=function(e){var t=this.__data__,r=tr(t,e);return r<0?n:t[r][1]},Hn.prototype.has=function(e){return tr(this.__data__,e)>-1},Hn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Sn||Hn),string:new Wn}},qn.prototype.delete=function(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return lo(this,e).get(e)},qn.prototype.has=function(e){return lo(this,e).has(e)},qn.prototype.set=function(e,t){var n=lo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,i),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Hn,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Hn){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var dr=Pi(br),hr=Pi(wr,!0);function fr(e,t){var n=!0;return dr(e,function(e,r,i){return n=!!t(e,r,i)}),n}function pr(e,t,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(l===n?s==s&&!ss(s):r(s,l)))var l=s,c=a}return c}function gr(e,t){var n=[];return dr(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function mr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=vo),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?mr(s,t-1,n,r,i):Pt(i,s):r||(i[i.length]=s)}return i}var vr=Mi(),yr=Mi(!0);function br(e,t){return e&&vr(e,t,Fs)}function wr(e,t){return e&&yr(e,t,Fs)}function xr(e,t){return It(t,function(t){return Ka(e[t])})}function Cr(e,t){for(var r=0,i=(t=yi(t,e)).length;null!=e&&r<i;)e=e[jo(t[r++])];return r&&r==i?e:n}function _r(e,t,n){var r=t(e);return $a(e)?r:Pt(r,n(e))}function Sr(e){return null==e?e===n?"[object Undefined]":"[object Null]":et&&et in ke(e)?function(e){var t=Re.call(e,et),r=e[et];try{e[et]=n;var i=!0}catch(e){}var o=De.call(e);return i&&(t?e[et]=r:delete e[et]),o}(e):function(e){return De.call(e)}(e)}function kr(e,t){return e>t}function Ar(e,t){return null!=e&&Re.call(e,t)}function Er(e,t){return null!=e&&t in ke(e)}function Ir(e,t,r){for(var i=r?Ft:Tt,o=e[0].length,a=e.length,s=a,l=we(a),c=1/0,u=[];s--;){var d=e[s];s&&t&&(d=Ot(d,Xt(t))),c=yn(d.length,c),l[s]=!r&&(t||o>=120&&d.length>=120)?new Gn(s&&d):n}d=e[0];var h=-1,f=l[0];e:for(;++h<o&&u.length<c;){var p=d[h],g=t?t(p):p;if(p=r||0!==p?p:0,!(f?Zt(f,g):i(u,g,r))){for(s=a;--s;){var m=l[s];if(!(m?Zt(m,g):i(e[s],g,r)))continue e}f&&f.push(g),u.push(p)}}return u}function Tr(e,t,r){var i=null==(e=Eo(e,t=yi(t,e)))?e:e[jo(Xo(t))];return null==i?n:_t(i,e,r)}function Fr(e){return es(e)&&Sr(e)==p}function Or(e,t,r,i,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,r,i,o,a){var s=$a(e),l=$a(t),c=s?g:po(e),u=l?g:po(t),d=(c=c==p?_:c)==_,h=(u=u==p?_:u)==_,f=c==u;if(f&&Ga(e)){if(!Ga(t))return!1;s=!0,d=!1}if(f&&!d)return a||(a=new Yn),s||ls(e)?eo(e,t,r,i,o,a):function(e,t,n,r,i,o,a){switch(n){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case F:return!(e.byteLength!=t.byteLength||!o(new $e(e),new $e(t)));case m:case v:case C:return za(+e,+t);case y:return e.name==t.name&&e.message==t.message;case k:case E:return e==t+"";case x:var s=on;case A:var l=1&r;if(s||(s=ln),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;r|=2,a.set(e,t);var u=eo(s(e),s(t),r,i,o,a);return a.delete(e),u;case I:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,c,r,i,o,a);if(!(1&r)){var b=d&&Re.call(e,"__wrapped__"),w=h&&Re.call(t,"__wrapped__");if(b||w){var S=b?e.value():e,T=w?t.value():t;return a||(a=new Yn),o(S,T,r,i,a)}}return!!f&&(a||(a=new Yn),function(e,t,r,i,o,a){var s=1&r,l=no(e),c=l.length,u=no(t),d=u.length;if(c!=d&&!s)return!1;for(var h=c;h--;){var f=l[h];if(!(s?f in t:Re.call(t,f)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);for(var v=s;++h<c;){var y=e[f=l[h]],b=t[f];if(i)var w=s?i(b,y,f,t,e,a):i(y,b,f,e,t,a);if(!(w===n?y===b||o(y,b,r,i,a):w)){m=!1;break}v||(v="constructor"==f)}if(m&&!v){var x=e.constructor,C=t.constructor;x==C||!("constructor"in e)||!("constructor"in t)||"function"==typeof x&&x instanceof x&&"function"==typeof C&&C instanceof C||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,r,i,o,a))}(e,t,r,i,Or,o))}function Pr(e,t,r,i){var o=r.length,a=o,s=!i;if(null==e)return!a;for(e=ke(e);o--;){var l=r[o];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var c=(l=r[o])[0],u=e[c],d=l[1];if(s&&l[2]){if(u===n&&!(c in e))return!1}else{var h=new Yn;if(i)var f=i(u,d,c,e,t,h);if(!(f===n?Or(d,u,3,i,h):f))return!1}}return!0}function Mr(e){return!(!Qa(e)||(t=e,je&&je in t))&&(Ka(e)?Be:pe).test(Do(e));var t}function Rr(e){return"function"==typeof e?e:null==e?nl:"object"==typeof e?$a(e)?Br(e[0],e[1]):zr(e):dl(e)}function Lr(e){if(!_o(e))return mn(e);var t=[];for(var n in ke(e))Re.call(e,n)&&"constructor"!=n&&t.push(n);return t}function jr(e){if(!Qa(e))return function(e){var t=[];if(null!=e)for(var n in ke(e))t.push(n);return t}(e);var t=_o(e),n=[];for(var r in e)("constructor"!=r||!t&&Re.call(e,r))&&n.push(r);return n}function Dr(e,t){return e<t}function Nr(e,t){var n=-1,r=Ha(e)?we(e.length):[];return dr(e,function(e,i,o){r[++n]=t(e,i,o)}),r}function zr(e){var t=co(e);return 1==t.length&&t[0][2]?ko(t[0][0],t[0][1]):function(n){return n===e||Pr(n,e,t)}}function Br(e,t){return wo(e)&&So(t)?ko(jo(e),t):function(r){var i=ks(r,e);return i===n&&i===t?As(r,e):Or(t,i,3)}}function Ur(e,t,r,i,o){e!==t&&vr(t,function(a,s){if(o||(o=new Yn),Qa(a))!function(e,t,r,i,o,a,s){var l=Io(e,r),c=Io(t,r),u=s.get(c);if(u)Qn(e,r,u);else{var d=a?a(l,c,r+"",e,t,s):n,h=d===n;if(h){var f=$a(c),p=!f&&Ga(c),g=!f&&!p&&ls(c);d=c,f||p||g?$a(l)?d=l:qa(l)?d=Ii(l):p?(h=!1,d=Ci(c,!0)):g?(h=!1,d=Si(c,!0)):d=[]:rs(c)||Va(c)?(d=l,Va(l)?d=ms(l):Qa(l)&&!Ka(l)||(d=mo(c))):h=!1}h&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Qn(e,r,d)}}(e,t,s,r,Ur,i,o);else{var l=i?i(Io(e,s),a,s+"",e,t,o):n;l===n&&(l=a),Qn(e,s,l)}},Os)}function Vr(e,t){var r=e.length;if(r)return yo(t+=t<0?r:0,r)?e[t]:n}function $r(e,t,n){t=t.length?Ot(t,function(e){return $a(e)?function(t){return Cr(t,1===e.length?e[0]:e)}:e}):[nl];var r=-1;t=Ot(t,Xt(so()));var i=Nr(e,function(e,n,i){var o=Ot(t,function(t){return t(e)});return{criteria:o,index:++r,value:e}});return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var l=ki(i[r],o[r]);if(l)return r>=s?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)})}function Wr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=Cr(e,a);n(s,a)&&Jr(o,yi(a,e),s)}return o}function Hr(e,t,n,r){var i=r?Bt:zt,o=-1,a=t.length,s=e;for(e===t&&(t=Ii(t)),n&&(s=Ot(e,Xt(n)));++o<a;)for(var l=0,c=t[o],u=n?n(c):c;(l=i(s,u,l,r))>-1;)s!==e&&Ye.call(s,l,1),Ye.call(e,l,1);return e}function qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;yo(i)?Ye.call(e,i,1):ui(e,i)}}return e}function Gr(e,t){return e+gt(xn()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>u)return n;do{t%2&&(n+=e),(t=gt(t/2))&&(e+=e)}while(t);return n}function Xr(e,t){return Oo(Ao(e,t,nl),e+"")}function Kr(e){return Kn(zs(e))}function Zr(e,t){var n=zs(e);return Ro(n,ar(t,0,n.length))}function Jr(e,t,r,i){if(!Qa(e))return e;for(var o=-1,a=(t=yi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var c=jo(t[o]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=s){var d=l[c];(u=i?i(d,c,l):n)===n&&(u=Qa(d)?d:yo(t[o+1])?[]:{})}er(l,c,u),l=l[c]}return e}var Qr=Tn?function(e,t){return Tn.set(e,t),e}:nl,ei=at?function(e,t){return at(e,"toString",{configurable:!0,enumerable:!1,value:Qs(t),writable:!0})}:nl;function ti(e){return Ro(zs(e))}function ni(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=we(i);++r<i;)o[r]=e[r+t];return o}function ri(e,t){var n;return dr(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function ii(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!ss(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return oi(e,t,nl,n)}function oi(e,t,r,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=r(t))!=t,l=null===t,c=ss(t),u=t===n;o<a;){var d=gt((o+a)/2),h=r(e[d]),f=h!==n,p=null===h,g=h==h,m=ss(h);if(s)var v=i||g;else v=u?g&&(i||f):l?g&&f&&(i||!p):c?g&&f&&!p&&(i||!m):!p&&!m&&(i?h<=t:h<t);v?o=d+1:a=d}return yn(a,4294967294)}function ai(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!za(s,l)){var l=s;o[i++]=0===a?0:a}}return o}function si(e){return"number"==typeof e?e:ss(e)?d:+e}function li(e){if("string"==typeof e)return e;if($a(e))return Ot(e,li)+"";if(ss(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,n){var r=-1,i=Tt,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=Ft;else if(o>=200){var c=t?null:Yi(e);if(c)return ln(c);a=!1,i=Zt,l=new Gn}else l=t?[]:s;e:for(;++r<o;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,a&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue e;t&&l.push(d),s.push(u)}else i(l,d,n)||(l!==s&&l.push(d),s.push(u))}return s}function ui(e,t){return null==(e=Eo(e,t=yi(t,e)))||delete e[jo(Xo(t))]}function di(e,t,n,r){return Jr(e,t,n(Cr(e,t)),r)}function hi(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ni(e,r?0:o,r?o+1:i):ni(e,r?o+1:0,r?i:o)}function fi(e,t){var n=e;return n instanceof $n&&(n=n.value()),Mt(t,function(e,t){return t.func.apply(t.thisArg,Pt([e],t.args))},n)}function pi(e,t,n){var r=e.length;if(r<2)return r?ci(e[0]):[];for(var i=-1,o=we(r);++i<r;)for(var a=e[i],s=-1;++s<r;)s!=i&&(o[i]=ur(o[i]||a,e[s],t,n));return ci(mr(o,1),t,n)}function gi(e,t,r){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var l=i<a?t[i]:n;r(s,e[i],l)}return s}function mi(e){return qa(e)?e:[]}function vi(e){return"function"==typeof e?e:nl}function yi(e,t){return $a(e)?e:wo(e,t)?[e]:Lo(vs(e))}var bi=Xr;function wi(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ni(e,t,r)}var xi=ct||function(e){return dt.clearTimeout(e)};function Ci(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function _i(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function Si(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ki(e,t){if(e!==t){var r=e!==n,i=null===e,o=e==e,a=ss(e),s=t!==n,l=null===t,c=t==t,u=ss(t);if(!l&&!u&&!a&&e>t||a&&s&&c&&!l&&!u||i&&s&&c||!r&&c||!o)return 1;if(!i&&!a&&!u&&e<t||u&&r&&o&&!i&&!a||l&&r&&o||!s&&o||!c)return-1}return 0}function Ai(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,l=t.length,c=vn(o-a,0),u=we(l+c),d=!r;++s<l;)u[s]=t[s];for(;++i<a;)(d||i<o)&&(u[n[i]]=e[i]);for(;c--;)u[s++]=e[i++];return u}function Ei(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,l=-1,c=t.length,u=vn(o-s,0),d=we(u+c),h=!r;++i<u;)d[i]=e[i];for(var f=i;++l<c;)d[f+l]=t[l];for(;++a<s;)(h||i<o)&&(d[f+n[a]]=e[i++]);return d}function Ii(e,t){var n=-1,r=e.length;for(t||(t=we(r));++n<r;)t[n]=e[n];return t}function Ti(e,t,r,i){var o=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var l=t[a],c=i?i(r[l],e[l],l,r,e):n;c===n&&(c=e[l]),o?ir(r,l,c):er(r,l,c)}return r}function Fi(e,t){return function(n,r){var i=$a(n)?St:nr,o=t?t():{};return i(n,e,so(r,2),o)}}function Oi(e){return Xr(function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:n,s=o>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(o--,a):n,s&&bo(r[0],r[1],s)&&(a=o<3?n:a,o=1),t=ke(t);++i<o;){var l=r[i];l&&e(t,l,i,a)}return t})}function Pi(e,t){return function(n,r){if(null==n)return n;if(!Ha(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=ke(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Mi(e){return function(t,n,r){for(var i=-1,o=ke(t),a=r(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===n(o[l],l,o))break}return t}}function Ri(e){return function(t){var r=rn(t=vs(t))?dn(t):n,i=r?r[0]:t.charAt(0),o=r?wi(r,1).join(""):t.slice(1);return i[e]()+o}}function Li(e){return function(t){return Mt(Ks(Vs(t).replace(Ke,"")),e,"")}}function ji(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 n=Bn(e.prototype),r=e.apply(n,t);return Qa(r)?r:n}}function Di(e){return function(t,r,i){var o=ke(t);if(!Ha(t)){var a=so(r,3);t=Fs(t),r=function(e){return a(o[e],e,o)}}var s=e(t,r,i);return s>-1?o[a?t[s]:s]:n}}function Ni(e){return to(function(t){var i=t.length,o=i,a=Vn.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Ie(r);if(a&&!l&&"wrapper"==oo(s))var l=new Vn([],!0)}for(o=l?o:i;++o<i;){var c=oo(s=t[o]),u="wrapper"==c?io(s):n;l=u&&xo(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[oo(u[0])].apply(l,u[3]):1==s.length&&xo(s)?l[c]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&$a(n))return l.plant(n).value();for(var r=0,o=i?t[r].apply(this,e):n;++r<i;)o=t[r].call(this,o);return o}})}function zi(e,t,r,i,o,a,l,c,u,d){var h=t&s,f=1&t,p=2&t,g=24&t,m=512&t,v=p?n:ji(e);return function s(){for(var y=arguments.length,b=we(y),w=y;w--;)b[w]=arguments[w];if(g)var x=ao(s),C=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(b,x);if(i&&(b=Ai(b,i,o,g)),a&&(b=Ei(b,a,l,g)),y-=C,g&&y<d){var _=sn(b,x);return qi(e,t,zi,s.placeholder,r,b,_,c,u,d-y)}var S=f?r:this,k=p?S[e]:e;return y=b.length,c?b=function(e,t){for(var r=e.length,i=yn(t.length,r),o=Ii(e);i--;){var a=t[i];e[i]=yo(a,r)?o[a]:n}return e}(b,c):m&&y>1&&b.reverse(),h&&u<y&&(b.length=u),this&&this!==dt&&this instanceof s&&(k=v||ji(k)),k.apply(S,b)}}function Bi(e,t){return function(n,r){return function(e,t,n,r){return br(e,function(e,i,o){t(r,n(e),i,o)}),r}(n,e,t(r),{})}}function Ui(e,t){return function(r,i){var o;if(r===n&&i===n)return t;if(r!==n&&(o=r),i!==n){if(o===n)return i;"string"==typeof r||"string"==typeof i?(r=li(r),i=li(i)):(r=si(r),i=si(i)),o=e(r,i)}return o}}function Vi(e){return to(function(t){return t=Ot(t,Xt(so())),Xr(function(n){var r=this;return e(t,function(e){return _t(e,r,n)})})})}function $i(e,t){var r=(t=t===n?" ":li(t)).length;if(r<2)return r?Yr(t,e):t;var i=Yr(t,ft(e/un(t)));return rn(t)?wi(dn(i),0,e).join(""):i.slice(0,e)}function Wi(e){return function(t,r,i){return i&&"number"!=typeof i&&bo(t,r,i)&&(r=i=n),t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n,r){for(var i=-1,o=vn(ft((t-e)/(n||1)),0),a=we(o);o--;)a[r?o:++i]=e,e+=n;return a}(t,r,i=i===n?t<r?1:-1:hs(i),e)}}function Hi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=gs(t),n=gs(n)),e(t,n)}}function qi(e,t,r,i,o,s,l,c,u,d){var h=8&t;t|=h?a:64,4&(t&=~(h?64:a))||(t&=-4);var f=[e,t,o,h?s:n,h?l:n,h?n:s,h?n:l,c,u,d],p=r.apply(n,f);return xo(e)&&To(p,f),p.placeholder=i,Po(p,e,t)}function Gi(e){var t=Se[e];return function(e,n){if(e=gs(e),(n=null==n?0:yn(fs(n),292))&&Wt(e)){var r=(vs(e)+"e").split("e");return+((r=(vs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yi=An&&1/ln(new An([,-0]))[1]==c?function(e){return new An(e)}:sl;function Xi(e){return function(t){var n=po(t);return n==x?on(t):n==A?cn(t):function(e,t){return Ot(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ki(e,t,i,c,u,d,h,f){var p=2&t;if(!p&&"function"!=typeof e)throw new Ie(r);var g=c?c.length:0;if(g||(t&=-97,c=u=n),h=h===n?h:vn(fs(h),0),f=f===n?f:fs(f),g-=u?u.length:0,64&t){var m=c,v=u;c=u=n}var y=p?n:io(e),b=[e,t,i,c,u,m,v,d,h,f];if(y&&function(e,t){var n=e[1],r=t[1],i=n|r,a=i<131,c=r==s&&8==n||r==s&&n==l&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!a&&!c)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?Ai(d,u,t[4]):u,e[4]=d?sn(e[3],o):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ei(d,u,t[6]):u,e[6]=d?sn(e[5],o):t[6]),(u=t[7])&&(e[7]=u),r&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(b,y),e=b[0],t=b[1],i=b[2],c=b[3],u=b[4],!(f=b[9]=b[9]===n?p?0:e.length:vn(b[9]-g,0))&&24&t&&(t&=-25),t&&1!=t)w=8==t||16==t?function(e,t,r){var i=ji(e);return function o(){for(var a=arguments.length,s=we(a),l=a,c=ao(o);l--;)s[l]=arguments[l];var u=a<3&&s[0]!==c&&s[a-1]!==c?[]:sn(s,c);return(a-=u.length)<r?qi(e,t,zi,o.placeholder,n,s,u,n,n,r-a):_t(this&&this!==dt&&this instanceof o?i:e,this,s)}}(e,t,f):t!=a&&33!=t||u.length?zi.apply(n,b):function(e,t,n,r){var i=1&t,o=ji(e);return function t(){for(var a=-1,s=arguments.length,l=-1,c=r.length,u=we(c+s),d=this&&this!==dt&&this instanceof t?o:e;++l<c;)u[l]=r[l];for(;s--;)u[l++]=arguments[++a];return _t(d,i?n:this,u)}}(e,t,i,c);else var w=function(e,t,n){var r=1&t,i=ji(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return Po((y?Qr:To)(w,b),e,t)}function Zi(e,t,r,i){return e===n||za(e,Oe[r])&&!Re.call(i,r)?t:e}function Ji(e,t,r,i,o,a){return Qa(e)&&Qa(t)&&(a.set(t,e),Ur(e,t,n,Ji,a),a.delete(t)),e}function Qi(e){return rs(e)?n:e}function eo(e,t,r,i,o,a){var s=1&r,l=e.length,c=t.length;if(l!=c&&!(s&&c>l))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var h=-1,f=!0,p=2&r?new Gn:n;for(a.set(e,t),a.set(t,e);++h<l;){var g=e[h],m=t[h];if(i)var v=s?i(m,g,h,t,e,a):i(g,m,h,e,t,a);if(v!==n){if(v)continue;f=!1;break}if(p){if(!Lt(t,function(e,t){if(!Zt(p,t)&&(g===e||o(g,e,r,i,a)))return p.push(t)})){f=!1;break}}else if(g!==m&&!o(g,m,r,i,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function to(e){return Oo(Ao(e,n,Wo),e+"")}function no(e){return _r(e,Fs,ho)}function ro(e){return _r(e,Os,fo)}var io=Tn?function(e){return Tn.get(e)}:sl;function oo(e){for(var t=e.name+"",n=Fn[t],r=Re.call(Fn,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function ao(e){return(Re.call(zn,"placeholder")?zn:e).placeholder}function so(){var e=zn.iteratee||rl;return e=e===rl?Rr:e,arguments.length?e(arguments[0],arguments[1]):e}function lo(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function co(e){for(var t=Fs(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,So(i)]}return t}function uo(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Mr(r)?r:n}var ho=mt?function(e){return null==e?[]:(e=ke(e),It(mt(e),function(t){return Ge.call(e,t)}))}:pl,fo=mt?function(e){for(var t=[];e;)Pt(t,ho(e)),e=He(e);return t}:pl,po=Sr;function go(e,t,n){for(var r=-1,i=(t=yi(t,e)).length,o=!1;++r<i;){var a=jo(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Ja(i)&&yo(a,i)&&($a(e)||Va(e))}function mo(e){return"function"!=typeof e.constructor||_o(e)?{}:Bn(He(e))}function vo(e){return $a(e)||Va(e)||!!(Xe&&e&&e[Xe])}function yo(e,t){var n=typeof e;return!!(t=null==t?u:t)&&("number"==n||"symbol"!=n&&me.test(e))&&e>-1&&e%1==0&&e<t}function bo(e,t,n){if(!Qa(n))return!1;var r=typeof t;return!!("number"==r?Ha(n)&&yo(t,n.length):"string"==r&&t in n)&&za(n[t],e)}function wo(e,t){if($a(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ss(e))||J.test(e)||!Z.test(e)||null!=t&&e in ke(t)}function xo(e){var t=oo(e),n=zn[t];if("function"!=typeof n||!(t in $n.prototype))return!1;if(e===n)return!0;var r=io(n);return!!r&&e===r[0]}(_n&&po(new _n(new ArrayBuffer(1)))!=O||Sn&&po(new Sn)!=x||kn&&po(kn.resolve())!=S||An&&po(new An)!=A||En&&po(new En)!=T)&&(po=function(e){var t=Sr(e),r=t==_?e.constructor:n,i=r?Do(r):"";if(i)switch(i){case On:return O;case Pn:return x;case Mn:return S;case Rn:return A;case Ln:return T}return t});var Co=Pe?Ka:gl;function _o(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Oe)}function So(e){return e==e&&!Qa(e)}function ko(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in ke(r))}}function Ao(e,t,r){return t=vn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=vn(n.length-t,0),a=we(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=we(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),_t(e,this,s)}}function Eo(e,t){return t.length<2?e:Cr(e,ni(t,0,-1))}function Io(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var To=Mo(Qr),Fo=ht||function(e,t){return dt.setTimeout(e,t)},Oo=Mo(ei);function Po(e,t,n){var r=t+"";return Oo(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return kt(f,function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(r),n)))}function Mo(e){var t=0,r=0;return function(){var i=bn(),o=16-(i-r);if(r=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Ro(e,t){var r=-1,i=e.length,o=i-1;for(t=t===n?i:t;++r<t;){var a=Gr(r,o),s=e[a];e[a]=e[r],e[r]=s}return e.length=t,e}var Lo=function(e){var t=Ma(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Q,function(e,n,r,i){t.push(r?i.replace(ce,"$1"):n||e)}),t});function jo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Do(e){if(null!=e){try{return Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function No(e){if(e instanceof $n)return e.clone();var t=new Vn(e.__wrapped__,e.__chain__);return t.__actions__=Ii(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var zo=Xr(function(e,t){return qa(e)?ur(e,mr(t,1,qa,!0)):[]}),Bo=Xr(function(e,t){var r=Xo(t);return qa(r)&&(r=n),qa(e)?ur(e,mr(t,1,qa,!0),so(r,2)):[]}),Uo=Xr(function(e,t){var r=Xo(t);return qa(r)&&(r=n),qa(e)?ur(e,mr(t,1,qa,!0),n,r):[]});function Vo(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fs(n);return i<0&&(i=vn(r+i,0)),Nt(e,so(t,3),i)}function $o(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return r!==n&&(o=fs(r),o=r<0?vn(i+o,0):yn(o,i-1)),Nt(e,so(t,3),o,!0)}function Wo(e){return null!=e&&e.length?mr(e,1):[]}function Ho(e){return e&&e.length?e[0]:n}var qo=Xr(function(e){var t=Ot(e,mi);return t.length&&t[0]===e[0]?Ir(t):[]}),Go=Xr(function(e){var t=Xo(e),r=Ot(e,mi);return t===Xo(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Ir(r,so(t,2)):[]}),Yo=Xr(function(e){var t=Xo(e),r=Ot(e,mi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Ir(r,n,t):[]});function Xo(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Ko=Xr(Zo);function Zo(e,t){return e&&e.length&&t&&t.length?Hr(e,t):e}var Jo=to(function(e,t){var n=null==e?0:e.length,r=or(e,t);return qr(e,Ot(t,function(e){return yo(e,n)?+e:e}).sort(ki)),r});function Qo(e){return null==e?e:Cn.call(e)}var ea=Xr(function(e){return ci(mr(e,1,qa,!0))}),ta=Xr(function(e){var t=Xo(e);return qa(t)&&(t=n),ci(mr(e,1,qa,!0),so(t,2))}),na=Xr(function(e){var t=Xo(e);return t="function"==typeof t?t:n,ci(mr(e,1,qa,!0),n,t)});function ra(e){if(!e||!e.length)return[];var t=0;return e=It(e,function(e){if(qa(e))return t=vn(e.length,t),!0}),Gt(t,function(t){return Ot(e,$t(t))})}function ia(e,t){if(!e||!e.length)return[];var r=ra(e);return null==t?r:Ot(r,function(e){return _t(t,n,e)})}var oa=Xr(function(e,t){return qa(e)?ur(e,t):[]}),aa=Xr(function(e){return pi(It(e,qa))}),sa=Xr(function(e){var t=Xo(e);return qa(t)&&(t=n),pi(It(e,qa),so(t,2))}),la=Xr(function(e){var t=Xo(e);return t="function"==typeof t?t:n,pi(It(e,qa),n,t)}),ca=Xr(ra),ua=Xr(function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ia(e,r)});function da(e){var t=zn(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var fa=to(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(t){return or(t,e)};return!(t>1||this.__actions__.length)&&i instanceof $n&&yo(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:n}),new Vn(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e})):this.thru(o)}),pa=Fi(function(e,t,n){Re.call(e,n)?++e[n]:ir(e,n,1)}),ga=Di(Vo),ma=Di($o);function va(e,t){return($a(e)?kt:dr)(e,so(t,3))}function ya(e,t){return($a(e)?At:hr)(e,so(t,3))}var ba=Fi(function(e,t,n){Re.call(e,n)?e[n].push(t):ir(e,n,[t])}),wa=Xr(function(e,t,n){var r=-1,i="function"==typeof t,o=Ha(e)?we(e.length):[];return dr(e,function(e){o[++r]=i?_t(t,e,n):Tr(e,t,n)}),o}),xa=Fi(function(e,t,n){ir(e,n,t)});function Ca(e,t){return($a(e)?Ot:Nr)(e,so(t,3))}var _a=Fi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Sa=Xr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&bo(e,t[0],t[1])?t=[]:n>2&&bo(t[0],t[1],t[2])&&(t=[t[0]]),$r(e,mr(t,1),[])}),ka=ut||function(){return dt.Date.now()};function Aa(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Ki(e,s,n,n,n,n,t)}function Ea(e,t){var i;if("function"!=typeof t)throw new Ie(r);return e=fs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Ia=Xr(function(e,t,n){var r=1;if(n.length){var i=sn(n,ao(Ia));r|=a}return Ki(e,r,t,n,i)}),Ta=Xr(function(e,t,n){var r=3;if(n.length){var i=sn(n,ao(Ta));r|=a}return Ki(t,r,e,n,i)});function Fa(e,t,i){var o,a,s,l,c,u,d=0,h=!1,f=!1,p=!0;if("function"!=typeof e)throw new Ie(r);function g(t){var r=o,i=a;return o=a=n,d=t,l=e.apply(i,r)}function m(e){var r=e-u;return u===n||r>=t||r<0||f&&e-d>=s}function v(){var e=ka();if(m(e))return y(e);c=Fo(v,function(e){var n=t-(e-u);return f?yn(n,s-(e-d)):n}(e))}function y(e){return c=n,p&&o?g(e):(o=a=n,l)}function b(){var e=ka(),r=m(e);if(o=arguments,a=this,u=e,r){if(c===n)return function(e){return d=e,c=Fo(v,t),h?g(e):l}(u);if(f)return xi(c),c=Fo(v,t),g(u)}return c===n&&(c=Fo(v,t)),l}return t=gs(t)||0,Qa(i)&&(h=!!i.leading,s=(f="maxWait"in i)?vn(gs(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),b.cancel=function(){c!==n&&xi(c),d=0,o=u=a=c=n},b.flush=function(){return c===n?l:y(ka())},b}var Oa=Xr(function(e,t){return cr(e,1,t)}),Pa=Xr(function(e,t,n){return cr(e,gs(t)||0,n)});function Ma(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ie(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Ma.Cache||qn),n}function Ra(e){if("function"!=typeof e)throw new Ie(r);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)}}Ma.Cache=qn;var La=bi(function(e,t){var n=(t=1==t.length&&$a(t[0])?Ot(t[0],Xt(so())):Ot(mr(t,1),Xt(so()))).length;return Xr(function(r){for(var i=-1,o=yn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return _t(e,this,r)})}),ja=Xr(function(e,t){var r=sn(t,ao(ja));return Ki(e,a,n,t,r)}),Da=Xr(function(e,t){var r=sn(t,ao(Da));return Ki(e,64,n,t,r)}),Na=to(function(e,t){return Ki(e,l,n,n,n,t)});function za(e,t){return e===t||e!=e&&t!=t}var Ba=Hi(kr),Ua=Hi(function(e,t){return e>=t}),Va=Fr(function(){return arguments}())?Fr:function(e){return es(e)&&Re.call(e,"callee")&&!Ge.call(e,"callee")},$a=we.isArray,Wa=vt?Xt(vt):function(e){return es(e)&&Sr(e)==F};function Ha(e){return null!=e&&Ja(e.length)&&!Ka(e)}function qa(e){return es(e)&&Ha(e)}var Ga=jt||gl,Ya=yt?Xt(yt):function(e){return es(e)&&Sr(e)==v};function Xa(e){if(!es(e))return!1;var t=Sr(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Ka(e){if(!Qa(e))return!1;var t=Sr(e);return t==b||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==fs(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=bt?Xt(bt):function(e){return es(e)&&po(e)==x};function ns(e){return"number"==typeof e||es(e)&&Sr(e)==C}function rs(e){if(!es(e)||Sr(e)!=_)return!1;var t=He(e);if(null===t)return!0;var n=Re.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Me.call(n)==Ne}var is=wt?Xt(wt):function(e){return es(e)&&Sr(e)==k},os=xt?Xt(xt):function(e){return es(e)&&po(e)==A};function as(e){return"string"==typeof e||!$a(e)&&es(e)&&Sr(e)==E}function ss(e){return"symbol"==typeof e||es(e)&&Sr(e)==I}var ls=Ct?Xt(Ct):function(e){return es(e)&&Ja(e.length)&&!!it[Sr(e)]},cs=Hi(Dr),us=Hi(function(e,t){return e<=t});function ds(e){if(!e)return[];if(Ha(e))return as(e)?dn(e):Ii(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());var t=po(e);return(t==x?on:t==A?ln:zs)(e)}function hs(e){return e?(e=gs(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function fs(e){var t=hs(e),n=t%1;return t==t?n?t-n:t:0}function ps(e){return e?ar(fs(e),0,h):0}function gs(e){if("number"==typeof e)return e;if(ss(e))return d;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var n=fe.test(e);return n||ge.test(e)?lt(e.slice(2),n?2:8):he.test(e)?d:+e}function ms(e){return Ti(e,Os(e))}function vs(e){return null==e?"":li(e)}var ys=Oi(function(e,t){if(_o(t)||Ha(t))Ti(t,Fs(t),e);else for(var n in t)Re.call(t,n)&&er(e,n,t[n])}),bs=Oi(function(e,t){Ti(t,Os(t),e)}),ws=Oi(function(e,t,n,r){Ti(t,Os(t),e,r)}),xs=Oi(function(e,t,n,r){Ti(t,Fs(t),e,r)}),Cs=to(or),_s=Xr(function(e,t){e=ke(e);var r=-1,i=t.length,o=i>2?t[2]:n;for(o&&bo(t[0],t[1],o)&&(i=1);++r<i;)for(var a=t[r],s=Os(a),l=-1,c=s.length;++l<c;){var u=s[l],d=e[u];(d===n||za(d,Oe[u])&&!Re.call(e,u))&&(e[u]=a[u])}return e}),Ss=Xr(function(e){return e.push(n,Ji),_t(Ms,n,e)});function ks(e,t,r){var i=null==e?n:Cr(e,t);return i===n?r:i}function As(e,t){return null!=e&&go(e,t,Er)}var Es=Bi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=n},Qs(nl)),Is=Bi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),Re.call(e,t)?e[t].push(n):e[t]=[n]},so),Ts=Xr(Tr);function Fs(e){return Ha(e)?Xn(e):Lr(e)}function Os(e){return Ha(e)?Xn(e,!0):jr(e)}var Ps=Oi(function(e,t,n){Ur(e,t,n)}),Ms=Oi(function(e,t,n,r){Ur(e,t,n,r)}),Rs=to(function(e,t){var n={};if(null==e)return n;var r=!1;t=Ot(t,function(t){return t=yi(t,e),r||(r=t.length>1),t}),Ti(e,ro(e),n),r&&(n=sr(n,7,Qi));for(var i=t.length;i--;)ui(n,t[i]);return n}),Ls=to(function(e,t){return null==e?{}:function(e,t){return Wr(e,t,function(t,n){return As(e,n)})}(e,t)});function js(e,t){if(null==e)return{};var n=Ot(ro(e),function(e){return[e]});return t=so(t),Wr(e,n,function(e,n){return t(e,n[0])})}var Ds=Xi(Fs),Ns=Xi(Os);function zs(e){return null==e?[]:Kt(e,Fs(e))}var Bs=Li(function(e,t,n){return t=t.toLowerCase(),e+(n?Us(t):t)});function Us(e){return Xs(vs(e).toLowerCase())}function Vs(e){return(e=vs(e))&&e.replace(ve,en).replace(Ze,"")}var $s=Li(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Ws=Li(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Hs=Ri("toLowerCase"),qs=Li(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Gs=Li(function(e,t,n){return e+(n?" ":"")+Xs(t)}),Ys=Li(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Xs=Ri("toUpperCase");function Ks(e,t,r){return e=vs(e),(t=r?n:t)===n?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zs=Xr(function(e,t){try{return _t(e,n,t)}catch(e){return Xa(e)?e:new Ce(e)}}),Js=to(function(e,t){return kt(t,function(t){t=jo(t),ir(e,t,Ia(e[t],e))}),e});function Qs(e){return function(){return e}}var el=Ni(),tl=Ni(!0);function nl(e){return e}function rl(e){return Rr("function"==typeof e?e:sr(e,1))}var il=Xr(function(e,t){return function(n){return Tr(n,e,t)}}),ol=Xr(function(e,t){return function(n){return Tr(e,n,t)}});function al(e,t,n){var r=Fs(t),i=xr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=xr(t,Fs(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ka(e);return kt(i,function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ii(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Pt([this.value()],arguments))})}),e}function sl(){}var ll=Vi(Ot),cl=Vi(Et),ul=Vi(Lt);function dl(e){return wo(e)?$t(jo(e)):function(e){return function(t){return Cr(t,e)}}(e)}var hl=Wi(),fl=Wi(!0);function pl(){return[]}function gl(){return!1}var ml,vl=Ui(function(e,t){return e+t},0),yl=Gi("ceil"),bl=Ui(function(e,t){return e/t},1),wl=Gi("floor"),xl=Ui(function(e,t){return e*t},1),Cl=Gi("round"),_l=Ui(function(e,t){return e-t},0);return zn.after=function(e,t){if("function"!=typeof t)throw new Ie(r);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},zn.ary=Aa,zn.assign=ys,zn.assignIn=bs,zn.assignInWith=ws,zn.assignWith=xs,zn.at=Cs,zn.before=Ea,zn.bind=Ia,zn.bindAll=Js,zn.bindKey=Ta,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return $a(e)?e:[e]},zn.chain=da,zn.chunk=function(e,t,r){t=(r?bo(e,t,r):t===n)?1:vn(fs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=we(ft(i/t));o<i;)s[a++]=ni(e,o,o+=t);return s},zn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},zn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=we(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Pt($a(n)?Ii(n):[n],mr(t,1))},zn.cond=function(e){var t=null==e?0:e.length,n=so();return e=t?Ot(e,function(e){if("function"!=typeof e[1])throw new Ie(r);return[n(e[0]),e[1]]}):[],Xr(function(n){for(var r=-1;++r<t;){var i=e[r];if(_t(i[0],this,n))return _t(i[1],this,n)}})},zn.conforms=function(e){return function(e){var t=Fs(e);return function(n){return lr(n,e,t)}}(sr(e,1))},zn.constant=Qs,zn.countBy=pa,zn.create=function(e,t){var n=Bn(e);return null==t?n:rr(n,t)},zn.curry=function e(t,r,i){var o=Ki(t,8,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},zn.curryRight=function e(t,r,i){var o=Ki(t,16,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},zn.debounce=Fa,zn.defaults=_s,zn.defaultsDeep=Ss,zn.defer=Oa,zn.delay=Pa,zn.difference=zo,zn.differenceBy=Bo,zn.differenceWith=Uo,zn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ni(e,(t=r||t===n?1:fs(t))<0?0:t,i):[]},zn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ni(e,0,(t=i-(t=r||t===n?1:fs(t)))<0?0:t):[]},zn.dropRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!0,!0):[]},zn.dropWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!0):[]},zn.fill=function(e,t,r,i){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&bo(e,t,r)&&(r=0,i=o),function(e,t,r,i){var o=e.length;for((r=fs(r))<0&&(r=-r>o?0:o+r),(i=i===n||i>o?o:fs(i))<0&&(i+=o),i=r>i?0:ps(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},zn.filter=function(e,t){return($a(e)?It:gr)(e,so(t,3))},zn.flatMap=function(e,t){return mr(Ca(e,t),1)},zn.flatMapDeep=function(e,t){return mr(Ca(e,t),c)},zn.flatMapDepth=function(e,t,r){return r=r===n?1:fs(r),mr(Ca(e,t),r)},zn.flatten=Wo,zn.flattenDeep=function(e){return null!=e&&e.length?mr(e,c):[]},zn.flattenDepth=function(e,t){return null!=e&&e.length?mr(e,t=t===n?1:fs(t)):[]},zn.flip=function(e){return Ki(e,512)},zn.flow=el,zn.flowRight=tl,zn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},zn.functions=function(e){return null==e?[]:xr(e,Fs(e))},zn.functionsIn=function(e){return null==e?[]:xr(e,Os(e))},zn.groupBy=ba,zn.initial=function(e){return null!=e&&e.length?ni(e,0,-1):[]},zn.intersection=qo,zn.intersectionBy=Go,zn.intersectionWith=Yo,zn.invert=Es,zn.invertBy=Is,zn.invokeMap=wa,zn.iteratee=rl,zn.keyBy=xa,zn.keys=Fs,zn.keysIn=Os,zn.map=Ca,zn.mapKeys=function(e,t){var n={};return t=so(t,3),br(e,function(e,r,i){ir(n,t(e,r,i),e)}),n},zn.mapValues=function(e,t){var n={};return t=so(t,3),br(e,function(e,r,i){ir(n,r,t(e,r,i))}),n},zn.matches=function(e){return zr(sr(e,1))},zn.matchesProperty=function(e,t){return Br(e,sr(t,1))},zn.memoize=Ma,zn.merge=Ps,zn.mergeWith=Ms,zn.method=il,zn.methodOf=ol,zn.mixin=al,zn.negate=Ra,zn.nthArg=function(e){return e=fs(e),Xr(function(t){return Vr(t,e)})},zn.omit=Rs,zn.omitBy=function(e,t){return js(e,Ra(so(t)))},zn.once=function(e){return Ea(2,e)},zn.orderBy=function(e,t,r,i){return null==e?[]:($a(t)||(t=null==t?[]:[t]),$a(r=i?n:r)||(r=null==r?[]:[r]),$r(e,t,r))},zn.over=ll,zn.overArgs=La,zn.overEvery=cl,zn.overSome=ul,zn.partial=ja,zn.partialRight=Da,zn.partition=_a,zn.pick=Ls,zn.pickBy=js,zn.property=dl,zn.propertyOf=function(e){return function(t){return null==e?n:Cr(e,t)}},zn.pull=Ko,zn.pullAll=Zo,zn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Hr(e,t,so(n,2)):e},zn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Hr(e,t,n,r):e},zn.pullAt=Jo,zn.range=hl,zn.rangeRight=fl,zn.rearg=Na,zn.reject=function(e,t){return($a(e)?It:gr)(e,Ra(so(t,3)))},zn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=so(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return qr(e,i),n},zn.rest=function(e,t){if("function"!=typeof e)throw new Ie(r);return Xr(e,t=t===n?t:fs(t))},zn.reverse=Qo,zn.sampleSize=function(e,t,r){return t=(r?bo(e,t,r):t===n)?1:fs(t),($a(e)?Zn:Zr)(e,t)},zn.set=function(e,t,n){return null==e?e:Jr(e,t,n)},zn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Jr(e,t,r,i)},zn.shuffle=function(e){return($a(e)?Jn:ti)(e)},zn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&bo(e,t,r)?(t=0,r=i):(t=null==t?0:fs(t),r=r===n?i:fs(r)),ni(e,t,r)):[]},zn.sortBy=Sa,zn.sortedUniq=function(e){return e&&e.length?ai(e):[]},zn.sortedUniqBy=function(e,t){return e&&e.length?ai(e,so(t,2)):[]},zn.split=function(e,t,r){return r&&"number"!=typeof r&&bo(e,t,r)&&(t=r=n),(r=r===n?h:r>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=li(t))&&rn(e)?wi(dn(e),0,r):e.split(t,r):[]},zn.spread=function(e,t){if("function"!=typeof e)throw new Ie(r);return t=null==t?0:vn(fs(t),0),Xr(function(n){var r=n[t],i=wi(n,0,t);return r&&Pt(i,r),_t(e,this,i)})},zn.tail=function(e){var t=null==e?0:e.length;return t?ni(e,1,t):[]},zn.take=function(e,t,r){return e&&e.length?ni(e,0,(t=r||t===n?1:fs(t))<0?0:t):[]},zn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ni(e,(t=i-(t=r||t===n?1:fs(t)))<0?0:t,i):[]},zn.takeRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?hi(e,so(t,3)):[]},zn.tap=function(e,t){return t(e),e},zn.throttle=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new Ie(r);return Qa(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Fa(e,t,{leading:i,maxWait:t,trailing:o})},zn.thru=ha,zn.toArray=ds,zn.toPairs=Ds,zn.toPairsIn=Ns,zn.toPath=function(e){return $a(e)?Ot(e,jo):ss(e)?[e]:Ii(Lo(vs(e)))},zn.toPlainObject=ms,zn.transform=function(e,t,n){var r=$a(e),i=r||Ga(e)||ls(e);if(t=so(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ka(o)?Bn(He(e)):{}}return(i?kt:br)(e,function(e,r,i){return t(n,e,r,i)}),n},zn.unary=function(e){return Aa(e,1)},zn.union=ea,zn.unionBy=ta,zn.unionWith=na,zn.uniq=function(e){return e&&e.length?ci(e):[]},zn.uniqBy=function(e,t){return e&&e.length?ci(e,so(t,2)):[]},zn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?ci(e,n,t):[]},zn.unset=function(e,t){return null==e||ui(e,t)},zn.unzip=ra,zn.unzipWith=ia,zn.update=function(e,t,n){return null==e?e:di(e,t,vi(n))},zn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:di(e,t,vi(r),i)},zn.values=zs,zn.valuesIn=function(e){return null==e?[]:Kt(e,Os(e))},zn.without=oa,zn.words=Ks,zn.wrap=function(e,t){return ja(vi(t),e)},zn.xor=aa,zn.xorBy=sa,zn.xorWith=la,zn.zip=ca,zn.zipObject=function(e,t){return gi(e||[],t||[],er)},zn.zipObjectDeep=function(e,t){return gi(e||[],t||[],Jr)},zn.zipWith=ua,zn.entries=Ds,zn.entriesIn=Ns,zn.extend=bs,zn.extendWith=ws,al(zn,zn),zn.add=vl,zn.attempt=Zs,zn.camelCase=Bs,zn.capitalize=Us,zn.ceil=yl,zn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=gs(r))==r?r:0),t!==n&&(t=(t=gs(t))==t?t:0),ar(gs(e),t,r)},zn.clone=function(e){return sr(e,4)},zn.cloneDeep=function(e){return sr(e,5)},zn.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:n)},zn.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:n)},zn.conformsTo=function(e,t){return null==t||lr(e,t,Fs(t))},zn.deburr=Vs,zn.defaultTo=function(e,t){return null==e||e!=e?t:e},zn.divide=bl,zn.endsWith=function(e,t,r){e=vs(e),t=li(t);var i=e.length,o=r=r===n?i:ar(fs(r),0,i);return(r-=t.length)>=0&&e.slice(r,o)==t},zn.eq=za,zn.escape=function(e){return(e=vs(e))&&G.test(e)?e.replace(H,tn):e},zn.escapeRegExp=function(e){return(e=vs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},zn.every=function(e,t,r){var i=$a(e)?Et:fr;return r&&bo(e,t,r)&&(t=n),i(e,so(t,3))},zn.find=ga,zn.findIndex=Vo,zn.findKey=function(e,t){return Dt(e,so(t,3),br)},zn.findLast=ma,zn.findLastIndex=$o,zn.findLastKey=function(e,t){return Dt(e,so(t,3),wr)},zn.floor=wl,zn.forEach=va,zn.forEachRight=ya,zn.forIn=function(e,t){return null==e?e:vr(e,so(t,3),Os)},zn.forInRight=function(e,t){return null==e?e:yr(e,so(t,3),Os)},zn.forOwn=function(e,t){return e&&br(e,so(t,3))},zn.forOwnRight=function(e,t){return e&&wr(e,so(t,3))},zn.get=ks,zn.gt=Ba,zn.gte=Ua,zn.has=function(e,t){return null!=e&&go(e,t,Ar)},zn.hasIn=As,zn.head=Ho,zn.identity=nl,zn.includes=function(e,t,n,r){e=Ha(e)?e:zs(e),n=n&&!r?fs(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},zn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fs(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},zn.inRange=function(e,t,r){return t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n){return e>=yn(t,n)&&e<vn(t,n)}(e=gs(e),t,r)},zn.invoke=Ts,zn.isArguments=Va,zn.isArray=$a,zn.isArrayBuffer=Wa,zn.isArrayLike=Ha,zn.isArrayLikeObject=qa,zn.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sr(e)==m},zn.isBuffer=Ga,zn.isDate=Ya,zn.isElement=function(e){return es(e)&&1===e.nodeType&&!rs(e)},zn.isEmpty=function(e){if(null==e)return!0;if(Ha(e)&&($a(e)||"string"==typeof e||"function"==typeof e.splice||Ga(e)||ls(e)||Va(e)))return!e.length;var t=po(e);if(t==x||t==A)return!e.size;if(_o(e))return!Lr(e).length;for(var n in e)if(Re.call(e,n))return!1;return!0},zn.isEqual=function(e,t){return Or(e,t)},zn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?Or(e,t,n,r):!!i},zn.isError=Xa,zn.isFinite=function(e){return"number"==typeof e&&Wt(e)},zn.isFunction=Ka,zn.isInteger=Za,zn.isLength=Ja,zn.isMap=ts,zn.isMatch=function(e,t){return e===t||Pr(e,t,co(t))},zn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Pr(e,t,co(t),r)},zn.isNaN=function(e){return ns(e)&&e!=+e},zn.isNative=function(e){if(Co(e))throw new Ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(e)},zn.isNil=function(e){return null==e},zn.isNull=function(e){return null===e},zn.isNumber=ns,zn.isObject=Qa,zn.isObjectLike=es,zn.isPlainObject=rs,zn.isRegExp=is,zn.isSafeInteger=function(e){return Za(e)&&e>=-9007199254740991&&e<=u},zn.isSet=os,zn.isString=as,zn.isSymbol=ss,zn.isTypedArray=ls,zn.isUndefined=function(e){return e===n},zn.isWeakMap=function(e){return es(e)&&po(e)==T},zn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Sr(e)},zn.join=function(e,t){return null==e?"":gn.call(e,t)},zn.kebabCase=$s,zn.last=Xo,zn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=fs(r))<0?vn(i+o,0):yn(o,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Nt(e,Ut,o,!0)},zn.lowerCase=Ws,zn.lowerFirst=Hs,zn.lt=cs,zn.lte=us,zn.max=function(e){return e&&e.length?pr(e,nl,kr):n},zn.maxBy=function(e,t){return e&&e.length?pr(e,so(t,2),kr):n},zn.mean=function(e){return Vt(e,nl)},zn.meanBy=function(e,t){return Vt(e,so(t,2))},zn.min=function(e){return e&&e.length?pr(e,nl,Dr):n},zn.minBy=function(e,t){return e&&e.length?pr(e,so(t,2),Dr):n},zn.stubArray=pl,zn.stubFalse=gl,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=xl,zn.nth=function(e,t){return e&&e.length?Vr(e,fs(t)):n},zn.noConflict=function(){return dt._===this&&(dt._=ze),this},zn.noop=sl,zn.now=ka,zn.pad=function(e,t,n){e=vs(e);var r=(t=fs(t))?un(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return $i(gt(i),n)+e+$i(ft(i),n)},zn.padEnd=function(e,t,n){e=vs(e);var r=(t=fs(t))?un(e):0;return t&&r<t?e+$i(t-r,n):e},zn.padStart=function(e,t,n){e=vs(e);var r=(t=fs(t))?un(e):0;return t&&r<t?$i(t-r,n)+e:e},zn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),wn(vs(e).replace(ne,""),t||0)},zn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&bo(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=hs(e),t===n?(t=e,e=0):t=hs(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var o=xn();return yn(e+o*(t-e+st("1e-"+((o+"").length-1))),t)}return Gr(e,t)},zn.reduce=function(e,t,n){var r=$a(e)?Mt:Ht,i=arguments.length<3;return r(e,so(t,4),n,i,dr)},zn.reduceRight=function(e,t,n){var r=$a(e)?Rt:Ht,i=arguments.length<3;return r(e,so(t,4),n,i,hr)},zn.repeat=function(e,t,r){return t=(r?bo(e,t,r):t===n)?1:fs(t),Yr(vs(e),t)},zn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zn.result=function(e,t,r){var i=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=n);++i<o;){var a=null==e?n:e[jo(t[i])];a===n&&(i=o,a=r),e=Ka(a)?a.call(e):a}return e},zn.round=Cl,zn.runInContext=e,zn.sample=function(e){return($a(e)?Kn:Kr)(e)},zn.size=function(e){if(null==e)return 0;if(Ha(e))return as(e)?un(e):e.length;var t=po(e);return t==x||t==A?e.size:Lr(e).length},zn.snakeCase=qs,zn.some=function(e,t,r){var i=$a(e)?Lt:ri;return r&&bo(e,t,r)&&(t=n),i(e,so(t,3))},zn.sortedIndex=function(e,t){return ii(e,t)},zn.sortedIndexBy=function(e,t,n){return oi(e,t,so(n,2))},zn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ii(e,t);if(r<n&&za(e[r],t))return r}return-1},zn.sortedLastIndex=function(e,t){return ii(e,t,!0)},zn.sortedLastIndexBy=function(e,t,n){return oi(e,t,so(n,2),!0)},zn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ii(e,t,!0)-1;if(za(e[n],t))return n}return-1},zn.startCase=Gs,zn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:ar(fs(n),0,e.length),t=li(t),e.slice(n,n+t.length)==t},zn.subtract=_l,zn.sum=function(e){return e&&e.length?qt(e,nl):0},zn.sumBy=function(e,t){return e&&e.length?qt(e,so(t,2)):0},zn.template=function(e,t,r){var i=zn.templateSettings;r&&bo(e,t,r)&&(t=n),e=vs(e),t=ws({},t,i,Zi);var o,a,s=ws({},t.imports,i.imports,Zi),l=Fs(s),c=Kt(s,l),u=0,d=t.interpolate||ye,h="__p += '",f=Ae((t.escape||ye).source+"|"+d.source+"|"+(d===K?ue:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),p="//# sourceURL="+(Re.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++rt+"]")+"\n";e.replace(f,function(t,n,r,i,s,l){return r||(r=i),h+=e.slice(u,l).replace(be,nn),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+t.length,t}),h+="';\n";var g=Re.call(t,"variable")&&t.variable;if(g){if(le.test(g))throw new Ce("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(U,""):h).replace(V,"$1").replace($,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var m=Zs(function(){return _e(l,p+"return "+h).apply(n,c)});if(m.source=h,Xa(m))throw m;return m},zn.times=function(e,t){if((e=fs(e))<1||e>u)return[];var n=h,r=yn(e,h);t=so(t),e-=h;for(var i=Gt(r,t);++n<e;)t(n);return i},zn.toFinite=hs,zn.toInteger=fs,zn.toLength=ps,zn.toLower=function(e){return vs(e).toLowerCase()},zn.toNumber=gs,zn.toSafeInteger=function(e){return e?ar(fs(e),-9007199254740991,u):0===e?e:0},zn.toString=vs,zn.toUpper=function(e){return vs(e).toUpperCase()},zn.trim=function(e,t,r){if((e=vs(e))&&(r||t===n))return Yt(e);if(!e||!(t=li(t)))return e;var i=dn(e),o=dn(t);return wi(i,Jt(i,o),Qt(i,o)+1).join("")},zn.trimEnd=function(e,t,r){if((e=vs(e))&&(r||t===n))return e.slice(0,hn(e)+1);if(!e||!(t=li(t)))return e;var i=dn(e);return wi(i,0,Qt(i,dn(t))+1).join("")},zn.trimStart=function(e,t,r){if((e=vs(e))&&(r||t===n))return e.replace(ne,"");if(!e||!(t=li(t)))return e;var i=dn(e);return wi(i,Jt(i,dn(t))).join("")},zn.truncate=function(e,t){var r=30,i="...";if(Qa(t)){var o="separator"in t?t.separator:o;r="length"in t?fs(t.length):r,i="omission"in t?li(t.omission):i}var a=(e=vs(e)).length;if(rn(e)){var s=dn(e);a=s.length}if(r>=a)return e;var l=r-un(i);if(l<1)return i;var c=s?wi(s,0,l).join(""):e.slice(0,l);if(o===n)return c+i;if(s&&(l+=c.length-l),is(o)){if(e.slice(l).search(o)){var u,d=c;for(o.global||(o=Ae(o.source,vs(de.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var h=u.index;c=c.slice(0,h===n?l:h)}}else if(e.indexOf(li(o),l)!=l){var f=c.lastIndexOf(o);f>-1&&(c=c.slice(0,f))}return c+i},zn.unescape=function(e){return(e=vs(e))&&q.test(e)?e.replace(W,fn):e},zn.uniqueId=function(e){var t=++Le;return vs(e)+t},zn.upperCase=Ys,zn.upperFirst=Xs,zn.each=va,zn.eachRight=ya,zn.first=Ho,al(zn,(ml={},br(zn,function(e,t){Re.call(zn.prototype,t)||(ml[t]=e)}),ml),{chain:!1}),zn.VERSION="4.17.21",kt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){zn[e].placeholder=zn}),kt(["drop","take"],function(e,t){$n.prototype[e]=function(r){r=r===n?1:vn(fs(r),0);var i=this.__filtered__&&!t?new $n(this):this.clone();return i.__filtered__?i.__takeCount__=yn(r,i.__takeCount__):i.__views__.push({size:yn(r,h),type:e+(i.__dir__<0?"Right":"")}),i},$n.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),kt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;$n.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:so(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),kt(["head","last"],function(e,t){var n="take"+(t?"Right":"");$n.prototype[e]=function(){return this[n](1).value()[0]}}),kt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");$n.prototype[e]=function(){return this.__filtered__?new $n(this):this[n](1)}}),$n.prototype.compact=function(){return this.filter(nl)},$n.prototype.find=function(e){return this.filter(e).head()},$n.prototype.findLast=function(e){return this.reverse().find(e)},$n.prototype.invokeMap=Xr(function(e,t){return"function"==typeof e?new $n(this):this.map(function(n){return Tr(n,e,t)})}),$n.prototype.reject=function(e){return this.filter(Ra(so(e)))},$n.prototype.slice=function(e,t){e=fs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new $n(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=fs(t))<0?r.dropRight(-t):r.take(t-e)),r)},$n.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},$n.prototype.toArray=function(){return this.take(h)},br($n.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=zn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(zn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,l=t instanceof $n,c=s[0],u=l||$a(t),d=function(e){var t=o.apply(zn,Pt([e],s));return i&&h?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,f=!!this.__actions__.length,p=a&&!h,g=l&&!f;if(!a&&u){t=g?t:new $n(this);var m=e.apply(t,s);return m.__actions__.push({func:ha,args:[d],thisArg:n}),new Vn(m,h)}return p&&g?e.apply(this,s):(m=this.thru(d),p?i?m.value()[0]:m.value():m)})}),kt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);zn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply($a(i)?i:[],e)}return this[n](function(n){return t.apply($a(n)?n:[],e)})}}),br($n.prototype,function(e,t){var n=zn[t];if(n){var r=n.name+"";Re.call(Fn,r)||(Fn[r]=[]),Fn[r].push({name:t,func:n})}}),Fn[zi(n,2).name]=[{name:"wrapper",func:n}],$n.prototype.clone=function(){var e=new $n(this.__wrapped__);return e.__actions__=Ii(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ii(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ii(this.__views__),e},$n.prototype.reverse=function(){if(this.__filtered__){var e=new $n(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},$n.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=$a(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=yn(t,e+a);break;case"takeRight":e=vn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,c=r?s:a-1,u=this.__iteratees__,d=u.length,h=0,f=yn(l,this.__takeCount__);if(!n||!r&&i==l&&f==l)return fi(e,this.__actions__);var p=[];e:for(;l--&&h<f;){for(var g=-1,m=e[c+=t];++g<d;){var v=u[g],y=v.iteratee,b=v.type,w=y(m);if(2==b)m=w;else if(!w){if(1==b)continue e;break e}}p[h++]=m}return p},zn.prototype.at=fa,zn.prototype.chain=function(){return da(this)},zn.prototype.commit=function(){return new Vn(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===n&&(this.__values__=ds(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},zn.prototype.plant=function(e){for(var t,r=this;r instanceof Un;){var i=No(r);i.__index__=0,i.__values__=n,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t},zn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof $n){var t=e;return this.__actions__.length&&(t=new $n(this)),(t=t.reverse()).__actions__.push({func:ha,args:[Qo],thisArg:n}),new Vn(t,this.__chain__)}return this.thru(Qo)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,Je&&(zn.prototype[Je]=function(){return this}),zn}();ft?((ft.exports=pn)._=pn,ht._=pn):dt._=pn}).call(gi)}(pi,pi.exports)),pi.exports);const vi=s({state:{},actions:{},options:{}}),yi=()=>l(vi),bi=({children:t,options:n})=>{var r;const[s,l]=o([]),[u,d]=o([]),[h,f]=o(null),[p,g]=o(n.searchQuery||""),[m,v]=o(n.sortBySize||"name"),{config:y}=n,[b,w]=o("date"),[x,C]=o("desc"),[_,S]=o([{id:"folders",name:"Папки"}]),[k,A]=o(new Set),[E,I]=o("");i.useEffect(()=>{A(new Set)},[]);const F=i.useRef(null);i.useEffect(()=>{if(n.onChangeSelection&&F.current!==k){if(null!==F.current){const e=(Array.isArray(u)?u:[]).filter(e=>k.has(e.id));n.onChangeSelection(e)}F.current=k}},[u,k,n.onChangeSelection,n]);const[O,P]=o(!1),[M,R]=o(Qt);a(()=>{(null==y?void 0:y.activeLibraryItem)&&R&&R(null==y?void 0:y.activeLibraryItem)},[null==y?void 0:y.activeLibraryItem,R]);const[L,j]=o({current:1,pageSize:12,total:0}),[D]=T.useForm(),[N]=T.useForm(),[z]=T.useForm(),[B]=T.useForm(),[U]=T.useForm(),[V]=T.useForm(),[$,W]=o(!1),[H,q]=o(!1),[G,Y]=o(!1),[X,K]=o(!1),[Z,J]=o(!1),[Q,ee]=o(!1),[te,ne]=o(!1),[re,ie]=o(null),[oe,ae]=o(null),[se,le]=o(null),ce=c(e=>{j(t=>Object.assign(Object.assign({},t),e))},[j]),ue=c(e=>{A(null!=e?e:new Set)},[A]);a(()=>{ue()},[M,ue]);const de={folders:s,files:u,selectedFolder:h,searchTerm:p,sortField:m,sortBy:b,sortOrder:x,pathHistory:_,selectedFiles:k,currentMenuFile:E,loading:O,pagination:L,isModalVisible:$,isUrlModalVisible:H,isRenameModalVisible:G,isMoveModalVisible:X,isRenameFolderModalVisible:Z,isCopyModalVisible:Q,isDeleteConfirmVisible:te,form:D,urlForm:N,renameForm:z,moveForm:B,renameFolderForm:U,copyForm:V,fileToRename:re,folderToRename:oe,activeLibraryItem:M,multiSelect:null===(r=null==y?void 0:y.multiSelect)||void 0===r||r,undoDeletion:se},he={setFolders:l,setFiles:d,setSelectedFolder:f,setSearchTerm:g,setSortField:v,setSortBy:w,setSortOrder:C,setPathHistory:S,setSelectedFiles:ue,setLoading:P,setPagination:ce,setIsModalVisible:W,setIsUrlModalVisible:q,setIsRenameModalVisible:Y,setIsMoveModalVisible:K,setIsRenameFolderModalVisible:J,setIsCopyModalVisible:ee,setIsDeleteConfirmVisible:ne,setFileToRename:ie,setFolderToRename:ae,setUndoDeletion:le,updatePathHistoryOnFolderRename:(e,t)=>{S(n=>n.map(n=>n.id===e?Object.assign(Object.assign({},n),{name:t}):n))},setActiveLibraryItem:R,setCurrentMenuFile:I},fe={state:de,actions:he,options:n};return e(vi.Provider,{value:fe,children:t})},wi=e=>null===e.parentId||"null"===e.parentId||!e.parentId,xi=async(e,t,n)=>{var r;if(console.log("📁 addSubfoldersToFiles: params:",JSON.stringify(t,null,2)),"file"===(null==t?void 0:t.itemType))return e;let i=[];if(!n)return console.warn("🔍 getFolders не доступен!"),e;{const e=await n({parentId:t.folderId});i=Array.isArray(e)?e:[],console.log("📁 Получено папок от dataProvider:",i.length,"тип данных:",typeof e,"данные:",e)}let o=((e,t)=>{const n=Array.isArray(e)?e:[];return(r=t.folderId)&&"root"!==r&&"folders"!==r&&"null"!==r&&null!==r?n.filter(e=>e.parentId===t.folderId):n.filter(wi);var r})(i,t);if(null===(r=null==t?void 0:t.search)||void 0===r?void 0:r.trim()){const e=t.search.trim().toLowerCase();o=o.filter(t=>{var n;return null===(n=t.name)||void 0===n?void 0:n.toLowerCase().includes(e)})}if(console.log("📁 Найдено подпапок для добавления:",o.length),0===o.length)return e;const a=o.map(e=>({id:e.id,name:e.name,size:void 0,date:"-",isFolder:!0,folderId:e.parentId||"",type:"",selected:!1,extension:""}));if("folder"===(null==t?void 0:t.itemType))return a;const s=[...a,...e];return console.log("📁 РЕЗУЛЬТАТ: папок:",a.length,"файлов:",e.length,"всего:",s.length),s},Ci=e=>{var t,n,r,i;const{state:o,actions:s,options:l}=yi(),{searchTerm:d,sortBy:h,sortOrder:f,selectedFolder:p,pagination:g}=o,{setSearchTerm:m,setSortBy:v,setSortOrder:y,setPagination:b}=s,w=e||s.fetchFiles,x=u(null),C=u(mi.debounce(e=>{const t=JSON.stringify(e);x.current!==t?(x.current=t,console.log("✅ Выполняется запрос:",e),null==w||w(e)):console.log("🚫 Дублированный запрос пропущен:",e)},150)).current,_=c(()=>{var e;const t=null===(e=null==l?void 0:l.config)||void 0===e?void 0:e.disablePagination;return{folderId:p||"",search:(null==d?void 0:d.trim())||void 0,page:t?void 0:g.current,limit:t?void 0:g.pageSize,sortBy:h,sortOrder:f,itemType:"all"}},[p,d,g.current,g.pageSize,h,f,null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.disablePagination]),S=c(e=>{var t,n;if(console.log("🔎 useSortAndFilter: handleSearch вызван с:",e),m&&(console.log("🔎 useSortAndFilter: Обновляем searchTerm в стейте"),m(e)),b&&(console.log("🔎 useSortAndFilter: Сбрасываем пагинацию"),b({current:1,pageSize:g.pageSize,total:0})),console.log("🔎 useSortAndFilter: Проверяем fetchFiles:",!!w),w){console.log("🔎 useSortAndFilter: Вызываем fetchFiles с параметрами поиска");const r={folderId:p||"",search:(null==e?void 0:e.trim())||void 0,page:(null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.disablePagination)?void 0:1,limit:(null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination)?void 0:g.pageSize,sortBy:h,sortOrder:f,itemType:"all"};console.log("🔎 useSortAndFilter: Параметры запроса:",r),w(r),console.log("🔎 useSortAndFilter: fetchFiles вызван!")}else console.error("🔎 useSortAndFilter: fetchFiles НЕ ОПРЕДЕЛЕНА!")},[m,b,g.pageSize,w,p,h,f,null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination]),k=c((e,t)=>{var n,r;null==v||v(e),null==y||y(t),w&&C({folderId:p||"",search:(null==d?void 0:d.trim())||void 0,page:(null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination)?void 0:g.current,limit:(null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination)?void 0:g.pageSize,sortBy:e,sortOrder:t,itemType:"all"})},[v,y,C,p,d,g.current,g.pageSize,null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination]),A=c((e,t)=>{var n;(null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination)||(b&&b({current:e,pageSize:t||g.pageSize,total:g.total}),w&&C({folderId:p||"",search:(null==d?void 0:d.trim())||void 0,page:e,limit:t||g.pageSize,sortBy:h,sortOrder:f,itemType:"all"}))},[b,g.pageSize,g.total,C,p,d,h,f,null===(i=null==l?void 0:l.config)||void 0===i?void 0:i.disablePagination]);return a(()=>{if(w){console.log("🔄 useSortAndFilter: изменение selectedFolder, загрузка файлов для папки:",p);const e=_();C(Object.assign(Object.assign({},e),{page:1}))}},[p]),a(()=>{w&&(console.log("🔄 useSortAndFilter: начальная загрузка файлов, selectedFolder:",p),C(_()))},[]),a(()=>()=>{var e;null===(e=C.cancel)||void 0===e||e.call(C)},[C]),{state:{searchTerm:d||"",sortBy:h||"name",sortOrder:f||"asc"},actions:{setSearchTerm:m||(()=>{}),setSortBy:v||(()=>{}),setSortOrder:y||(()=>{}),handleSearch:S,handleSort:k,handlePaginationChange:A,getCurrentQueryParams:_}}},_i=()=>{var e;const{notification:t}=I.useApp(),n=yi(),{options:r}=n,i=c(async e=>{let t;if(r.handleNotify){try{t=await r.handleNotify(e)}catch(e){console.log(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("error"===e.type&&r.handleError){try{t=await r.handleError(e)}catch(e){console.log(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("success"===e.type&&r.handleSuccess){try{t=await r.handleSuccess(e)}catch(e){console.log(e)}if(t)return!1}return t},[r]),o=c(async function(e,n=!1){var o;try{void 0===e.visibility&&(e.visibility=!n);const a=await i(e);"object"==typeof a&&(e=a);if(!(!1!==e.visibility&&!1!==a&&!1!==(null===(o=r.config)||void 0===o?void 0:o.showNotifications)))return e;const s=t[e.type];"function"==typeof s?s(e):console.warn(`Unknown notification type: ${e.type}`,e)}catch(e){console.log(e)}return e},[t,i,null===(e=r.config)||void 0===e?void 0:e.showNotifications]);return d(()=>({error:(e,t=!1)=>o(Object.assign(Object.assign({},e),{type:"error"}),t),success:(e,t=!1)=>o(Object.assign(Object.assign({},e),{type:"success"}),t),warning:(e,t=!1)=>o(Object.assign(Object.assign({},e),{type:"warning"}),t),notify:o}),[o])},Si={FileNotFound:"File not found or no longer available.",FileAlreadyExists:"File with this name already exists.",FileInvalidName:"File name is not valid.",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 to upload.",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.",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.",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:"Request payload is too large.",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."},ki=(e,t)=>{if(!e)return;const n=Si[e];return n?t(n):void 0},Ai=e=>{var t,n,r,i,o,a,s,l;if(!e)return{message:"Unknown error",raw:e};if("string"==typeof e)return{message:e};if(e instanceof Error){const o=e;return{message:null!==(t=o.message)&&void 0!==t?t:e.message,code:o.code,status:null!==(n=o.status)&&void 0!==n?n:o.httpStatus,stack:null!==(r=o.stack)&&void 0!==r?r:e.stack,raw:null!==(i=o.raw)&&void 0!==i?i:e}}if("object"==typeof e){const t=e,n=null!==(a=null!==(o=t.message)&&void 0!==o?o:t.error)&&void 0!==a?a:t.reason,r=null!==(s=t.status)&&void 0!==s?s:t.httpStatus,i=t.code,c=t.stack,u=null!==(l=t.raw)&&void 0!==l?l:e;if(n||i||r||c||u)return{message:n,code:i,status:r,stack:c,raw:u}}return{message:String(e),raw:e}},Ei=()=>{var e,t;const{state:n,actions:i,options:o}=yi(),{t:a}=$n(),s=_i(),{folders:l,selectedFolder:u,pathHistory:d,form:h,loading:f,isModalVisible:p}=n,{setFolders:g,setLoading:m,setIsModalVisible:v}=i,{dataProviders:y,config:b}=o,w=c(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})),[]),x=c(async()=>{console.log("Запрос папок (через getFiles itemType=folder)..."),null==m||m(!0);try{let e=[];const t="lazy"===(null==b?void 0:b.folderTreeLoading);if(!(null==y?void 0:y.getFolders)){if(null==y?void 0:y.getFiles){const e=async n=>{const{files:r}=await y.getFiles({itemType:"folder",folderId:n||void 0}),i=w(r);if(t)return i;const o=await Promise.all(i.map(t=>e(t.id)));return[...i,...o.flat()]},n=await e(null);return void(g&&g(e=>{const r=Array.isArray(e)?e:[];if(!t){const e=n,t=e.filter(e=>e.id===e.parentId);return t.length>0&&console.warn("Обнаружены папки с циклическими зависимостями:",t),console.log("Полученные папки (full replace):",e),e}new Set(n.map(e=>e.id));const i=[...r.filter(e=>e.parentId),...n],o=i.filter(e=>e.id===e.parentId);return o.length>0&&console.warn("Обнаружены папки с циклическими зависимостями:",o),console.log("Полученные папки (lazy merge корня):",i),i}))}return void console.error("DataProvider для папок не определен")}{const n=!t;e=await y.getFolders({parentId:null,deep:n})}console.log("Полученные папки:",e);const n=Array.isArray(e)?e:[];null==g||g(n);const r=n.filter(e=>e.id===e.parentId);r.length>0&&console.warn("Обнаружены папки с циклическими зависимостями:",r)}catch(e){console.error("Ошибка при загрузке папок:",e);const t=Ai(e),n=ki(null==t?void 0:t.code,a);s.error({id:"FOLDERS_FETCH_FAILED",message:null!=n?n:a("Failed to load folders"),placement:"bottomRight",innerException:e,data:{reason:e instanceof Error?e.message:String(e)}})}finally{null==m||m(!1)}},[null==y?void 0:y.getFiles,null==y?void 0:y.getFolders,g,m,null==b?void 0:b.folderTreeLoading,w,s,a]),C=c(async e=>{try{if(null==y?void 0:y.getFolders){const t=await y.getFolders({parentId:e,deep:!1}),n=Array.isArray(l)?l:[],r=new Set(t.map(e=>e.id)),i=n.filter(t=>t.parentId!==e||r.has(t.id)),o=[...i,...t.filter(e=>!i.some(t=>t.id===e.id))];return null==g||g(o),t}if(null==y?void 0:y.getFiles){const{files:t}=await y.getFiles({itemType:"folder",folderId:e||void 0}),n=w(t),r=Array.isArray(l)?l:[],i=new Set(n.map(e=>e.id)),o=r.filter(t=>t.parentId!==e||i.has(t.id)),a=[...o,...n.filter(e=>!o.some(t=>t.id===e.id))];return null==g||g(a),n}return[]}catch(e){return console.error("Ошибка при загрузке дочерних папок:",e),[]}},[y,l,g,w]),_=c(()=>{var e;const t=null!==(e=null==b?void 0:b.defaultFolderName)&&void 0!==e?e:a("Новая папка");h.setFieldsValue({folderName:t}),null==v||v(!0)},[h,v,a,null==b?void 0:b.defaultFolderName]),S=c(async e=>{const t=[...(Array.isArray(l)?l:[]).filter(t=>t.id!==e.id),e];if(null==g||g(t),console.log("📂 Обновлен список папок, новая папка:",e),e.parentId&&(await C(e.parentId),await new Promise(e=>setTimeout(e,50))),i.setSelectedFolder&&(i.setSelectedFolder(e.id),console.log("🎯 Выбрана созданная папка как активная:",e.id)),i.setPathHistory){const n=Array.isArray(t)?t:[],r=(e,t=new Set)=>{if(t.has(e))return console.warn(`Обнаружен цикл в пути к папке с id=${e}`),[];const i=n.find(t=>t.id===e);if(!i)return[];const o=new Set(t);return o.add(e),i.parentId?[...r(i.parentId,o),{id:i.id,name:i.name}]:[{id:i.id,name:i.name}]},o=r(e.id),s=[{id:"folders",name:a("Folders")},...o];i.setPathHistory(s),console.log("🧭 Обновлен путь навигации до созданной папки:",s)}},[l,g,i,n.pathHistory,C,a]),k=c(async e=>{try{if(null==y?void 0:y.getFolders){const t=await y.getFolders(),n=(Array.isArray(t)?t:[]).some(t=>t.id===e);return console.log(n?"✅ Папка найдена:":"❌ Папка не найдена:",e),n}if(null==y?void 0:y.getFiles){const t=new Set,n=async r=>{const{files:i}=await y.getFiles({itemType:"folder",folderId:r||void 0}),o=w(i);for(const r of o){if(t.has(r.id))continue;if(t.add(r.id),r.id===e)return!0;if(await n(r.id))return!0}return!1},r=await n(null);return console.log(r?"✅ Папка найдена:":"❌ Папка не найдена:",e),r}}catch(e){console.warn("⚠️ Ошибка проверки папки:",e)}return!1},[null==y?void 0:y.getFolders,null==y?void 0:y.getFiles,w]),A=c(async e=>{var t;let n,r=null;try{const i=await(e?e.validateFields():h.validateFields());if(console.log("handleModalOk: values",i),n=i.folderName.trim(),console.log("folderName",n),!n){const e=i.targetFolder||(u&&"folders"!==u?u:null);return void s.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:a("Folder name cannot be empty"),placement:"bottomRight",data:{folderName:n,folderId:null!=e?e:null,reason:"emptyName",is_force_create:!!i.is_force_create}})}const o=i.targetFolder;if(o)r="folders"!==o?o:null;else if(u&&"folders"!==u)r=u;else if(Array.isArray(d)&&d.length>1){const e=d[d.length-1];r=(null==e?void 0:e.id)&&"folders"!==e.id?e.id:null}let c;if(console.log("🆕 Создание новой папки:",{folderName:n,parentId:r,selectedFolder:u,pathHistory:d}),!(null==y?void 0:y.createFolder))return void s.error({id:"FOLDER_CREATE_PROVIDER_NOT_CONFIGURED",message:a("Folder creation provider is not configured"),placement:"bottomRight",data:{folderName:n,folderId:null!=r?r:null,is_force_create:!!i.is_force_create}});c=await y.createFolder({name:n,parentId:r,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("Обнаружена циклическая зависимость: папка является родителем сама для себя"),new Error(a("Error: folder cannot be its own parent"))})(c);const f={id:c.id,name:c.name,parentId:null!=r?r:null,childCount:c.childCount},p=[...(Array.isArray(l)?l:[]).filter(e=>e.id!==f.id),f];if(null==g||g(p),s.success({id:"FOLDER_CREATE_SUCCESS",message:a("Folder created"),placement:"bottomRight",data:{itemIds:[f.id],folderId:null!==(t=f.parentId)&&void 0!==t?t:null,folderName:f.name}}),e||null==v||v(!1),(async()=>{try{await S(f),await x(),await new Promise(e=>setTimeout(e,200));await k(c.id)||console.warn("⚠️ Не удалось подтвердить создание папки на сервере, но продолжаем...")}catch(e){console.error("Ошибка при выполнении фоновых операций после создания папки:",e)}})(),e)return c}catch(e){console.error("❌ Ошибка при создании папки:",e);const t=Ai(e),i=ki(null==t?void 0:t.code,a);s.error({id:"FOLDER_CREATE_FAILED",message:null!=i?i:a("Failed to create folder"),placement:"bottomRight",innerException:e,data:{folderName:n,folderId:null!=r?r:null,reason:e instanceof Error?e.message:String(e)}})}},[h,u,y,S,x,k,v,s,a,l,g]),E=c(()=>{null==v||v(!1)},[v]),I=c((e,t=new Set)=>{const n=Array.isArray(l)?l:[];return e.map(e=>{if(t.has(e.id))return console.warn(`Обнаружен цикл в структуре папок с id=${e.id}. Пропускаем обработку дочерних элементов.`),{key:e.id,label:e.name+" "+a("(error)"),icon:r.createElement(ae,{style:{color:"red"}})};const i=new Set(t);i.add(e.id);const o=n.filter(t=>t.parentId===e.id&&t.id!==e.id);return{key:e.id,label:e.name,children:o.length>0?I(o,i):void 0}})},[l]),T=c(()=>{const e=Array.isArray(l)?l:[],t={key:"folders",label:a("Folders"),children:[]},n=e.filter(e=>null===e.parentId||!e.parentId);return t.children=I(n),[t]},[l,a,I]),F=c(async(e,t)=>{var n,r,c,u;console.log("renameFolder");try{const d=t.trim(),h=null==l?void 0:l.find(t=>t.id===e);if(!d)return void s.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:a("Folder name cannot be empty"),placement:"bottomRight",data:{folderId:e,folderName:t,reason:"emptyName"}});if(!(!1!==(null===(n=null==b?void 0:b.features)||void 0===n?void 0:n.enableRenameFolder)))return void s.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:d}});if(!(null===(c=o.dataProviders)||void 0===c?void 0:c.renameFolder))return void s.error({id:"FOLDER_RENAME_FAILED",message:a("Folder rename provider is not configured"),placement:"bottomRight",data:{itemId:e,itemName:d,error:{message:"providerNotConfigured"}}});const f=await o.dataProviders.renameFolder(e,d);if(!(null==f?void 0:f.id))return void s.error({id:"FOLDER_RENAME_FAILED",message:a("Unexpected response when renaming folder"),placement:"bottomRight",data:{itemId:e,itemName:d,error:{message:"invalidResponse"}}});await x(),e!==f.id&&i.setSelectedFolder&&i.setSelectedFolder(f.id),s.success({id:"FOLDER_RENAME_SUCCESS",message:a("Folder renamed"),placement:"bottomRight",data:{itemId:f.id,itemName:f.name,folderId:null!==(u=f.parentId)&&void 0!==u?u:null}})}catch(n){console.error("Ошибка при переименовании папки:",n),s.error({id:"FOLDER_RENAME_FAILED",message:a("Failed to rename folder"),placement:"bottomRight",innerException:n,data:{itemId:e,itemName:t,error:{message:n instanceof Error?n.message:String(n)}}})}},[x,l,null===(e=o.dataProviders)||void 0===e?void 0:e.renameFolder,null===(t=null==b?void 0:b.features)||void 0===t?void 0:t.enableRenameFolder,i.setSelectedFolder,s,a]);return{state:{folders:l,isCreatingFolder:p,loading:f},actions:{fetchFolders:x,fetchChildFolders:C,handleCreateFolder:_,handleModalOk:A,handleModalCancel:E,generateMenuItems:T,renameFolder:F}}},Ii=()=>{const{options:e,actions:t}=yi(),{dataProviders:n,config:r}=e,{setUndoDeletion:i}=t,{t:o}=$n(),a=_i(),s=c(async({items:e,selectedFolder:t,getItemNameById:s,showNotifications:l=!1})=>{let c=0,u=0;const d=[],h=async t=>{if(null==n?void 0:n.deleteItems)try{const r=await n.deleteItems(e.map(e=>e.id),{permanent:t}),i=r.detailed;if(i){const e=i.filter(e=>e.success).length;c+=e;const t=i.filter(e=>!e.success);return u+=t.length,void t.forEach(e=>{var t;const n=(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,i=Ai(r);d.push({itemId:n,itemName:s(n),error:i})})}if(r.success)c+=e.length;else{const t=r.error;if(t){u+=e.length;const n=Ai(t);d.push({error:n})}else u+=e.length}return}catch(n){const r=t?"Ошибка при удалении":"Ошибка при перемещении в корзину";console.error(r,n),u+=e.length;const i=Ai(n);d.push({error:i})}const r=t?"DataProvider для удаления файлов не настроен":"DataProvider для перемещения не настроен";console.warn(r)},f=(null==r?void 0:r.enableTrashFolder)&&"Trash"===t;return(null==r?void 0:r.enableTrashFolder)&&!f?await h(!1):await h(!0),c>0&&(null==r?void 0:r.enableTrashFolder)&&!f&&(null==i||i({itemIds:e.map(e=>e.id),sourceFolderId:t||"folders"})),l&&(c>0&&a.success({id:"FILES_DELETE_SUCCESS",message:o("Files deleted"),placement:"bottomRight",data:{successCount:c,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:t||null}}),u>0&&a.error({id:"FILES_DELETE_ERROR",message:o("Error when deleting a file"),placement:"bottomRight",data:{failCount:u,totalCount:e.length,itemIds:e.map(e=>e.id),itemNames:e.map(e=>s(e.id)),folderId:t||null,errors:d}})),{successCount:c,failCount:u,errorDetails:d}},[n,r,i,o,a]);return{deleteItems:s}},Ti=()=>{var e,t;const{state:n,actions:r,options:o}=yi(),a=Ci(),{sortBy:s,sortOrder:l}=a.state,{actions:{fetchFolders:u}}=Ei(),{t:d}=$n(),h=_i(),{deleteItems:f}=Ii(),{selectedFolder:p,urlForm:g,pagination:m,files:v}=n,y=i.useRef(null);y.current=m;const{setFiles:b,setLoading:w,setIsUrlModalVisible:x,setSelectedFiles:C,setActiveLibraryItem:_,setPagination:S}=r,{dataProviders:k}=o,A=c(async e=>{var t,n,r;if(!(null==k?void 0:k.getFiles))return[];const i=null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.disablePagination,{files:a,pagination:s}=await k.getFiles({folderId:"folders"!==(null==e?void 0:e.folderId)?null==e?void 0:e.folderId:void 0,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:i||null==e?void 0:e.page,limit:i||null==e?void 0:e.limit,itemType:(null==e?void 0:e.itemType)||"all"});return console.warn("🔍 fetchFilesFromDataProvider результат:",a,"с параметрами сортировки:",{sortBy:null==e?void 0:e.sortBy,sortOrder:null==e?void 0:e.sortOrder}),S&&((null===(r=null==o?void 0:o.config)||void 0===r?void 0:r.disablePagination)?S({current:1,pageSize:a.length||1,total:a.length||0}):s&&S({current:s.page,pageSize:s.limit,total:s.total})),a},[k,null===(e=null==o?void 0:o.config)||void 0===e?void 0:e.disablePagination,S]),E=c(async e=>{try{null==w||w(!0),console.warn("fetchFiles вызван с параметрами:",e);let t=[];if(!(null==k?void 0:k.getFiles))return void console.error("DataProvider для получения файлов не определен");t=await A(e),console.warn("Получены файлы:",t);const n=null!=e?e:{folderId:p||"",itemType:"all"};"file"!==n.itemType&&(t=await xi(t,n,null==k?void 0:k.getFolders)),"Trash"!==(p||"")&&(t=t.filter(e=>!(e.isFolder&&"Trash"===e.id))),null==b||b(t),null==C||C(new Set)}catch(t){console.error("Ошибка при загрузке файлов:",t);const n=Ai(t),r=ki(null==n?void 0:n.code,d);h.error({id:"FILES_FETCH_FAILED",message:null!=r?r:d("Failed to load files"),placement:"bottomRight",innerException:t,data:{params:e}})}finally{null==w||w(!1)}},[k,b,w,C,A,p,h,d]),I=c(async e=>{const t=y.current;try{const n=v.find(t=>t.id===e),r=e=>{if(!e)return;const t=v.find(t=>t.id===e);return null==t?void 0:t.name};await f({items:[{id:e,isFolder:null==n?void 0:n.isFolder}],selectedFolder:p,getItemNameById:r,showNotifications:!0});const i=Object.assign({},t);let o=t.current;1===v.length&&(o=i.current>1?i.current-1:1),await E({folderId:p||"",page:o,limit:t.pageSize,sortBy:s,sortOrder:l})}catch(t){console.error("Ошибка при удалении файла:",t);const n=t;(null==n?void 0:n.notificationShown)||h.error({id:"FILES_DELETE_ERROR",message:d("Error when deleting a file"),placement:"bottomRight",innerException:t,data:{failCount:1,totalCount:1,itemIds:[e],folderId:p||null,errors:[{itemId:e,error:Ai(t)}]}})}},[f,E,p,d,h,v,s,l]),T=c(async e=>{try{const t=y.current;if(!(null==k?void 0:k.deleteFolder))return void h.error({id:"FOLDER_DELETE_ERROR",message:d("DataProvider for folder deletion is not configured"),placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e}});if(!await k.deleteFolder(e)){const e=new Error("Не удалось удалить папку");throw e.notificationShown=!1,e}h.success({id:"FOLDER_DELETE_SUCCESS",message:d("Folder deleted"),placement:"bottomRight",data:{successCount:1,totalCount:1,itemIds:[e],folderId:e}});p===e?await E({page:t.current,limit:t.pageSize,sortBy:s,sortOrder:l}):await E({folderId:p||"",sortBy:s,sortOrder:l,page:t.current,limit:t.pageSize})}catch(t){console.error("Ошибка при удалении папки:",t);const n=t;(null==n?void 0:n.notificationShown)||h.error({id:"FOLDER_DELETE_ERROR",message:d("Error when deleting a folder"),innerException:t,placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e,errors:[{itemId:e,error:Ai(t)}]}})}},[k,p,h,d,E,s,l]),F=c(async e=>{var t,n;try{if(null==k?void 0:k.getFileData){const t=await k.getFileData(e);if(t)return t;throw new Error(d("Failed to download file"))}{const t=await fetch(`/api/files/${e.id}/content`);if(!t.ok)throw new Error(d("Error loading image"));return await t.blob()}}catch(r){console.error("Ошибка при загрузке файла:",r),h.error({id:"FILE_DOWNLOAD_FAILED",message:d("Failed to download file"),placement:"bottomRight",description:e.name,innerException:r,data:{itemId:e.id,itemName:e.name,folderId:null!==(t=e.folderId)&&void 0!==t?t:null,thumbnail:null!==(n=e.thumbnail)&&void 0!==n?n:null}})}},[k,h,d]),O=c(async(e,t,r)=>{var i,o,a,s,l,c;if("Trash"===(null!=t?t:p||""))throw new Error(d("Upload to Trash is forbidden"));const u=e.name.split(".").pop()||"",f=null!=t?t:p||"";try{if(null==k?void 0:k.uploadFiles)try{const t=await k.uploadFiles({items:[{name:e.name,size:e.size,type:e.type,folderId:f,data:e,extension:u}],folderId:f});if(t.success&&t.detailed&&t.detailed.length>0){const p=t.detailed[0];if(!p.success||!p.data){if(!r){const t=(null==p?void 0:p.error)?String(p.error):d("Failed to upload file");h.error({id:"FILE_UPLOAD_ITEM_FAILED",message:t,placement:"bottomRight",description:e.name,innerException:null==p?void 0:p.error,data:{itemName:e.name,folderId:f||null}})}return void(_&&_(Qt))}{const t=p.data;if(t.id){const r=(null!==(i=t.folderId)&&void 0!==i?i:f)||void 0;await E({folderId:r});let d=n.files.find(e=>e.id===t.id);if(!d)try{d=(await A({folderId:r,itemType:"file"})).find(e=>e.id===t.id)}catch(e){console.warn("uploadFileWithProvider: не удалось получить свежий список файлов",e)}return _&&_(Qt),d||Object.assign(Object.assign({},t),{id:t.id,name:t.name||e.name,folderId:null!==(a=null!==(o=t.folderId)&&void 0!==o?o:f)&&void 0!==a?a:null,type:e.type,size:e.size,extension:u||e.name.split(".").pop()||"",thumbnail:null!==(s=t.thumbnail)&&void 0!==s?s:void 0,url:null!==(l=t.url)&&void 0!==l?l:void 0,thumbnailUrl:null!==(c=t.thumbnailUrl)&&void 0!==c?c:void 0,isFolder:!1,selected:!1})}}}else if(!t.success){if(!r){const n=t.error?String(t.error):d("Failed to upload file");h.error({id:"FILE_UPLOAD_ITEM_FAILED",message:n,placement:"bottomRight",description:e.name,innerException:t.error,data:{itemName:e.name,folderId:f||null}})}return void(_&&_(Qt))}return void(_&&_(Qt))}catch(e){throw console.warn("batchError",e),e}if(null==k?void 0:k.uploadFile){const t=await k.uploadFile({name:e.name,size:e.size,type:e.type,folderId:f,data:e,extension:u});return _&&_(Qt),t}return void(r||h.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:d("DataProvider for file upload is not configured"),placement:"bottomRight"}))}catch(t){const n=Ai(t),i=ki(null==n?void 0:n.code,d);return r?void 0:void h.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!=i?i:d("Failed to upload file"),placement:"bottomRight",description:e.name,innerException:t,data:{itemName:e.name,folderId:f||null,error:Ai(t)}})}},[k,p,_,n.files,E,A,h,d]),P=c(async(e,t)=>{var n;if(!(null==k?void 0:k.getFolders)||!(null==k?void 0:k.createFolder))return e||"";try{const r=await k.getFolders(),i=Array.isArray(r)?r:[],o=(e,t)=>i.find(n=>{var r;return(null!==(r=n.parentId)&&void 0!==r?r:null)===(null!=e?e:null)&&n.name===t});let a=null!=e?e:"";for(const e of t){if(!e)continue;let t=o(a,e);if(!t){const n=await k.createFolder({name:e,parentId:null!=a?a:null});i.push(n),t=n}a=t.id}return null!==(n=a)&&void 0!==n?n:e||""}catch(t){return console.warn("ensureFolderPath: не удалось гарантировать путь",t),e||""}},[k]),M=c(async(e,t)=>{var n,r,i,o;if(!(null===(r=null===(n=e.type)||void 0===n?void 0:n.startsWith)||void 0===r?void 0:r.call(n,"image/")))return null!=t?t:null;const a=null==e?void 0:e.webkitRelativePath;let s=t||"";if(a&&a.includes("/")){const e=a.split("/");e.pop();const n=e.filter(Boolean);n.length&&(s=await P(t||"",n)||t||"")}return null!==(o=null!==(i=s)&&void 0!==i?i:t)&&void 0!==o?o:null},[P]),R=c(async e=>{var t,n,r,i,o,a,s,l,c,u,d,h;const{file:f,selectedFolderId:p,uploadFn:g,progressCallbacks:m}=e;if(!(null===(n=null===(t=f.type)||void 0===t?void 0:t.startsWith)||void 0===n?void 0:n.call(t,"image/")))return{success:!0,fileName:f.name,folderId:null!=p?p:null};const v=null!==(i=null!==(r=await M(f,p))&&void 0!==r?r:p)&&void 0!==i?i:null,y=null!==(o=null!=v?v:p)&&void 0!==o?o:null;let b;null===(a=null==m?void 0:m.onStart)||void 0===a||a.call(m,f);try{if(null==m?void 0:m.onProgress){let e=0;b=window.setInterval(()=>{var t;e=Math.min(e+10+Math.floor(Date.now()%10),90),null===(t=null==m?void 0:m.onProgress)||void 0===t||t.call(m,f.name,e)},200)}const e=await g(f,null!=y?y:void 0);return(null==m?void 0:m.onProgress)&&(null===(s=null==m?void 0:m.onProgress)||void 0===s||s.call(m,f.name,100)),null===(l=null==m?void 0:m.onComplete)||void 0===l||l.call(m,f.name),{success:!0,fileName:f.name,fileId:null==e?void 0:e.id,folderId:null!==(u=null!==(c=null==e?void 0:e.folderId)&&void 0!==c?c:y)&&void 0!==u?u:null}}catch(e){const t=e instanceof Error?e.message:String(e);return null===(d=null==m?void 0:m.onError)||void 0===d||d.call(m,f.name,t),{success:!1,fileName:f.name,folderId:null!==(h=null!=y?y:p)&&void 0!==h?h:null,error:t}}finally{void 0!==b&&clearInterval(b)}},[M]),L=c(async(e,t)=>{var n,r,i,o,a,s,l,c,u,f,g,m,v,y,b,w,x,C,S,A,E,I,T;if(0===e.length)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};null===(n=null==t?void 0:t.onStartBatch)||void 0===n||n.call(t,e);const F=e=>{const t=e.filter(Boolean);return t.length>0&&t.length<=5?t.join(", "):null},O=[];for(let n=0;n<e.length;n++){const s=e[n];if(!(null===(i=null===(r=s.type)||void 0===r?void 0:r.startsWith)||void 0===i?void 0:i.call(r,"image/"))){const e=await h.warning({id:"FILES_UPLOAD_UNSUPPORTED_TYPE",message:"Unsupported file type",placement:"bottomRight",data:{itemName:s.name,fileType:s.type,folderId:p||null}});null===(o=null==t?void 0:t.onError)||void 0===o||o.call(t,s.name,e.message);continue}const l=`${Date.now()}-${n}-${Math.random().toString(36).slice(2,8)}`,c=await M(s,p);null===(a=null==t?void 0:t.onStart)||void 0===a||a.call(t,s),O.push({file:s,targetFolderId:c,requestId:l})}const P=O.length;if(0===P)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};const R=!t,L=1===P&&R,j=[],D=[],N=[],z=[];let B=0,U=0;const V=async(e,n,r,i)=>{var o,a;const{emitProgress:s=!0,emitNotification:l=!0}=null!=i?i:{};B++,j.push(e),D.push(null!=r?r:e),await((e,t,n,r)=>{var i;return h.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${d("File")} ${e} ${d("has been successfully uploaded")}`,placement:"bottomRight",data:{itemId:n,itemName:e,folderId:null!==(i=null!=t?t:p)&&void 0!==i?i:null}},r||!R)})(e,n,r,!l),s&&(null===(o=null==t?void 0:t.onProgress)||void 0===o||o.call(t,e,100),null===(a=null==t?void 0:t.onComplete)||void 0===a||a.call(t,e))},$=async(e,n,r,i,o)=>{var a;const{emitProgress:s=!0,emitNotification:l=!0}=null!=o?o:{};U++;const c=Ai(i),u=await((e,t,n,r,i)=>{var o;const a=Ai(r),s=ki(null==a?void 0:a.code,d);return h.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!=s?s:d("Error uploading file {{fileName}}",{fileName:e}),placement:"bottomRight",data:{itemName:e,folderId:null!==(o=null!=t?t:p)&&void 0!==o?o:null,error:a},innerException:r},i||!R)})(e,n,0,i,!l);s&&(null===(a=null==t?void 0:t.onError)||void 0===a||a.call(t,e,u.message)),z.push({itemId:void 0,itemName:e,error:c}),N.push({fileName:e,error:u.message})};if(!(null==k?void 0:k.uploadFiles))return h.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:d("DataProvider for file upload is not configured"),placement:"bottomRight"}),{successCount:0,failCount:P,successes:[],errors:[],totalCount:P};try{const e=await k.uploadFiles({items:O.map(e=>{var t,n;return{requestId:e.requestId,name:e.file.name,size:e.file.size,type:e.file.type,folderId:null!==(n=null!==(t=e.targetFolderId)&&void 0!==t?t:p)&&void 0!==n?n:null,data:e.file,extension:e.file.name.split(".").pop()||""}}),folderId:null!=p?p:null}),t=null!==(s=e.detailed)&&void 0!==s?s:[],n=new Map(t.filter(e=>e.requestId).map(e=>[e.requestId,e]));if(t.length>0)for(let e=0;e<O.length;e++){const r=O[e],i=null!==(l=r.requestId?n.get(r.requestId):void 0)&&void 0!==l?l:t[e];if(i&&i.success){const e=i.data,t=r.file.name,n=null!==(f=null!==(u=null!==(c=null==e?void 0:e.folderId)&&void 0!==c?c:r.targetFolderId)&&void 0!==u?u:p)&&void 0!==f?f:null,o=null==e?void 0:e.id;await V(t,n,o,{emitNotification:L})}else{(null==i?void 0:i.error)?String(i.error):d("Error uploading file");const e=null==i?void 0:i.data,t=r.file.name,n=null!==(v=null!==(m=null!==(g=null==e?void 0:e.folderId)&&void 0!==g?g:r.targetFolderId)&&void 0!==m?m:p)&&void 0!==v?v:null;await $(t,n,0,null==i?void 0:i.error,{emitNotification:L})}}else if(e.success)for(const e of O){const t=e.file.name,n=null!==(b=null!==(y=e.targetFolderId)&&void 0!==y?y:p)&&void 0!==b?b:null;await V(t,n,void 0,{emitNotification:L})}else{e.error?String(e.error):d("Error uploading file");for(const t of O){const n=t.file.name,r=null!==(x=null!==(w=t.targetFolderId)&&void 0!==w?w:p)&&void 0!==x?x:null;await $(n,r,0,e.error,{emitNotification:L})}}}catch(e){e instanceof Error?e.message:String(e);for(const t of O){const n=t.file.name,r=null!==(S=null!==(C=t.targetFolderId)&&void 0!==C?C:p)&&void 0!==S?S:null;await $(n,r,0,e,{emitNotification:L})}}if(B>0&&(_&&_(Qt),P>1&&R)){const e=F(j),t=e?d("Uploaded",{names:e}):d("uploads_success_summary",{successCount:B,totalCount:P});h.success({id:"FILES_UPLOAD_BATCH_SUCCESS",message:t,placement:"bottomRight",data:{successCount:B,totalCount:P,itemIds:D,itemNames:j,folderId:null!=p?p:null}})}if(U>0&&!L&&R)if(P>1){const e=N.map(e=>e.fileName),t=F(e),n=t?d("Failed",{names:t}):d("uploads_fail_summary",{failCount:U,totalCount:P});h.error({id:"FILES_UPLOAD_BATCH_FAILED",message:n,placement:"bottomRight",data:{failCount:U,totalCount:P,itemNames:e,folderId:null!=p?p:null,errors:z}})}else if(1===P&&z.length>0&&(null===(A=z[0].error)||void 0===A?void 0:A.code)){const e=ki(null===(E=z[0].error)||void 0===E?void 0:E.code,d),t=null!==(T=null===(I=N[0])||void 0===I?void 0:I.fileName)&&void 0!==T?T:"",n=null!=e?e:t?`${d("Failed to upload files")}: ${t}`:d("Failed to upload files");h.error({id:"FILES_UPLOAD_BATCH_FAILED",message:n,placement:"bottomRight",data:{failCount:U,totalCount:P,itemNames:[t],folderId:null!=p?p:null,errors:z}})}return{successCount:B,failCount:U,successes:j,errors:N,totalCount:P}},[k,null==k?void 0:k.uploadFiles,h,M,p,_,d,R,O]),j=c(async e=>{var t;if(!(null==k?void 0:k.uploadFiles))return void h.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:d("DataProvider for file upload is not configured"),placement:"bottomRight"});if("Trash"===p)return void h.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:d("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:p||null,reason:"Upload to Trash is not allowed"}});const n=y.current,r=document.createElement("input");r.type="file",r.accept="image/*",r.multiple=!0;try{!(!(null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.features)||!o.config.features.enableDirectoryUpload)&&(r.webkitdirectory=!0)}catch(e){}r.onchange=async t=>{var r;const i=t.target.files;if(!i||0===i.length)return;const o=Array.from(i);try{null==w||w(!0);const{successes:t,errors:i}=await L(o,e);null===(r=null==e?void 0:e.onBatchComplete)||void 0===r||r.call(e,{files:o,successes:t,errors:i}),await u(),await E({folderId:p||"",sortBy:s,sortOrder:l,page:n.current,limit:n.pageSize})}catch(e){console.error("Ошибка при загрузке файлов:",e)}finally{null==w||w(!1)}},r.click()},[null==k?void 0:k.uploadFile,null==k?void 0:k.uploadFiles,p,h,d,w,E,u,s,l,L,null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.features]),D=c(async(e,t)=>{const n=y.current;let r,i=null!=e?e:null;try{if(!t&&"Trash"===p)return void h.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:d("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:p||null,reason:"Upload to Trash is not allowed"}});let e;if(!i&&g&&(e=await g.validateFields(),i=null==e?void 0:e.fileUrl),!i)return void h.error({id:"FILES_UPLOAD_URL_VALIDATION_FAILED",message:d("Please fill in all fields"),placement:"bottomRight",data:{url:null!=i?i:null,folderId:p||null}});if(null==w||w(!0),!(null==k?void 0:k.uploadFileByUrl))return void h.error({id:"FILES_UPLOAD_URL_NOT_SUPPORTED",message:d("Upload by URL is not supported"),placement:"bottomRight",data:{url:i,folderId:p||null}});r=await k.uploadFileByUrl({url:i,folderId:p||"",noFolder:t});const o=(null==e?void 0:e.name)||(null==r?void 0:r.name)||"unnamed file";return h.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${d("File")} ${o} ${d("successfully uploaded")}`,placement:"bottomRight",data:{itemName:o,itemId:null==r?void 0:r.id,folderId:p||null}}),e&&(null==x||x(!1),null==g||g.resetFields()),_&&_(Qt),await E({folderId:p||"",sortBy:s,sortOrder:l,page:n.current,limit:n.pageSize}),r}catch(e){console.error("Ошибка при загрузке файла по URL:",e),h.error({id:"FILES_UPLOAD_BY_URL_FAILED",message:d("Error when downloading a file by URL"),placement:"bottomRight",data:{url:null!=i?i:null,folderId:p||null,error:Ai(e)},innerException:e})}finally{null==w||w(!1)}},[g,w,k,h,d,x,_,E,p,s,l]),N=c(async e=>{if(!e.length)return;const t=y.current;"Trash"!==p?(await L(e),await E({folderId:p||"",sortBy:s,sortOrder:l,page:t.current,limit:t.pageSize})):h.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:d("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:p||null,reason:"Upload to Trash is not allowed"}})},[E,p,s,l,L,h,d]);return{fetchFiles:E,handleDeleteFile:I,handleDeleteFolder:T,handleAddFile:j,handleAddFileByUrl:D,handleDroppedFiles:N,getFileData:F,uploadFileWithProvider:O}},Fi=e=>{var t,n,r,i;const{state:o,actions:a,options:s}=yi(),{t:l}=$n(),u=Ei(),d=_i(),{fetchFolders:h}=u.actions,{renameItem:f}=(()=>{const{options:e}=yi(),{dataProviders:t}=e,{t:n}=$n(),r=c(async({itemId:e,newName:r,isFolder:i})=>{var o,a,s,l,c,u,d,h;try{if(i){if(!(null==t?void 0:t.renameFolder))throw new Error(n("renameFolder is not implemented in dataProviders"));const i=await t.renameFolder(e,r.trim());return{success:!0,renamedItem:{id:i.id,name:null!==(o=i.name)&&void 0!==o?o:r,parentId:null!==(a=i.parentId)&&void 0!==a?a:null,folderId:null!==(s=i.parentId)&&void 0!==s?s:null}}}if(!(null==t?void 0:t.renameFile))throw new Error(n("renameFile is not implemented in dataProviders"));const f=await t.renameFile(e,r);return{success:!0,renamedItem:{id:null!==(l=null==f?void 0:f.id)&&void 0!==l?l:e,name:null!==(c=null==f?void 0:f.name)&&void 0!==c?c:r,folderId:null!==(u=null==f?void 0:f.folderId)&&void 0!==u?u:null,parentId:null!==(h=null!==(d=null==f?void 0:f.parentId)&&void 0!==d?d:null==f?void 0:f.folderId)&&void 0!==h?h:null}}}catch(e){return{success:!1,error:Ai(e)}}},[t,n]);return{renameItem:r}})(),{files:p,selectedFolder:g,fileToRename:m,renameForm:v,isRenameModalVisible:y,pagination:b}=o,{setFileToRename:w,setIsRenameModalVisible:x}=a,{dataProviders:C,config:_}=s,S=e=>{var t,n;if(!e)return null;const r=e;return null!==(n=null!==(t=r.folderId)&&void 0!==t?t:r.parentId)&&void 0!==n?n:null},k=(e,t)=>{var n;return{itemId:null!==(n=null==e?void 0:e.id)&&void 0!==n?n:t,itemName:null==e?void 0:e.name,folderId:S(e)}},A=c(e=>{var t,n;const r=null==p?void 0:p.find(t=>t.id===e);if((null==r?void 0:r.isFolder)||e.startsWith("folder_")){if(!(!1!==(null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder)))return void d.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:l("Folder rename is disabled by config"),placement:"bottomRight",data:k(r,e)});if(!(null==C?void 0:C.renameFolder))throw new Error(l("renameFolder is not implemented in dataProviders"))}else{if(!(!1!==(null===(n=null==_?void 0:_.features)||void 0===n?void 0:n.enableRenameFile)))return void d.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:l("File rename is disabled by config"),placement:"bottomRight",data:k(r,e)});if(!(null==C?void 0:C.renameFile))throw new Error(l("renameFile is not implemented in dataProviders"))}null==w||w(e),null==x||x(!0),r&&v&&v.setFieldsValue({newFileName:r.name})},[p,w,x,v,null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder,null===(n=null==_?void 0:_.features)||void 0===n?void 0:n.enableRenameFile,null==C?void 0:C.renameFolder,null==C?void 0:C.renameFile,d,l]),E=c(()=>{null==x||x(!1),null==w||w(null),null==v||v.resetFields()},[x,w,v]),I=c(async()=>{var t,n,r,i,o,s,c,u,y;if(!m||!v)return;const w=null==p?void 0:p.find(e=>e.id===m);try{const p=await v.validateFields();if(!(null==p?void 0:p.newFileName))return;const x=(null==w?void 0:w.isFolder)||m.startsWith("folder_");if(x){if(!(!1!==(null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder)))return void d.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:l("Folder rename is disabled by config"),placement:"bottomRight",data:k(w,m)})}else{if(!(!1!==(null===(n=null==_?void 0:_.features)||void 0===n?void 0:n.enableRenameFile)))return void d.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:l("File rename is disabled by config"),placement:"bottomRight",data:k(w,m)})}const C=await f({itemId:m,newName:p.newFileName,isFolder:x});if(!C.success){const e=ki(null===(r=C.error)||void 0===r?void 0:r.code,l);return void d.error({id:"ITEM_RENAME_FAILED",message:null!==(o=null!=e?e:null===(i=C.error)||void 0===i?void 0:i.message)&&void 0!==o?o:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},k(w,m)),{error:C.error}),innerException:C.error})}const S=C.renamedItem;x?(d.success({id:"FOLDER_RENAME_SUCCESS",message:l(`${l("Folder renamed to")} ${p.newFileName}`),placement:"bottomRight",data:{itemId:null!==(s=null==S?void 0:S.id)&&void 0!==s?s:m,itemName:null!==(c=null==S?void 0:S.name)&&void 0!==c?c:p.newFileName,folderId:null!==(y=null!==(u=null==S?void 0:S.parentId)&&void 0!==u?u:null==S?void 0:S.folderId)&&void 0!==y?y:null}}),await h(),(null==S?void 0:S.id)&&S.id!==m&&a.setSelectedFolder&&a.setSelectedFolder(S.id)):d.success({id:"FILE_RENAME_SUCCESS",message:`${l("File renamed to")} ${p.newFileName}`,placement:"bottomRight",data:Object.assign(Object.assign({},k(w,m)),{itemName:p.newFileName})}),E(),await e({folderId:g||"",page:b.current,limit:b.pageSize})}catch(e){console.error("Ошибка при переименовании:",e);const t=Ai(e),n=ki(null==t?void 0:t.code,l);d.error({id:"ITEM_RENAME_FAILED",message:null!=n?n:e instanceof Error?e.message:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},k(w,m)),{error:t}),innerException:e})}},[m,v,p,a,E,e,g,l,b,null===(r=null==_?void 0:_.features)||void 0===r?void 0:r.enableRenameFolder,null===(i=null==_?void 0:_.features)||void 0===i?void 0:i.enableRenameFile,d,h,f]);return{state:{isRenamingFile:y||!1,fileToRename:m},actions:{showRenameModal:A,handleRenameCancel:E,handleRenameOk:I}}},Oi=e=>{const t=t=>{if(!t)return;const n=e.find(e=>e.id===t);return null==n?void 0:n.name};return{getItemNameById:t,getItemNamesByIds:e=>e.map(t).filter(e=>Boolean(e)),getNamesPreview:e=>e.length>0&&e.length<=5?e.join(", "):null}},Pi=(e,t,n,r,i)=>({itemIds:e,itemNames:i&&i.length?i:void 0,successCount:t,totalCount:n,folderId:null!=r?r:null}),Mi=(e,t,n,r,i,o)=>({itemIds:e,itemNames:o&&o.length?o:void 0,failCount:t,totalCount:n,folderId:null!=r?r:null,errors:i}),Ri=()=>{const e=_i(),{t:t}=$n(),{actions:{fetchFolders:n,fetchChildFolders:r}}=Ei();return{refreshFolders:c(async({parentIds:i,selectedFolder:o})=>{try{if(await n(),i&&r)for(const e of i)e&&await r(e)}catch(n){console.error("Ошибка при обновлении дерева папок:",n),e.error({id:"FILES_FETCH_FAILED",message:t("Failed to refresh folder tree"),placement:"bottomRight",innerException:n,data:{params:{folderId:o||void 0}}})}},[e,t]),refreshFiles:c(async({fetchFiles:n,selectedFolder:r,page:i,limit:o})=>{try{await n({folderId:r||"",page:i,limit:o})}catch(n){console.error("Ошибка при обновлении списка файлов:",n),e.error({id:"FILES_FETCH_FAILED",message:t("Failed to refresh file list"),placement:"bottomRight",innerException:n,data:{params:{folderId:r||void 0,page:i,limit:o}}})}},[e,t])}},Li=e=>{const{state:t,actions:n}=yi(),{t:r}=$n(),i=_i(),{files:o,selectedFolder:a,selectedFiles:s,moveForm:l,pagination:u,currentMenuFile:d}=t,{setIsMoveModalVisible:h,setSelectedFiles:f,setPagination:p}=n,{moveItems:g}=(()=>{const{options:e}=yi(),{dataProviders:t}=e,{t:n}=$n(),r=_i(),i=c(async({items:e,targetFolderId:i,getItemNameById:o,showNotifications:a=!1})=>{let s=0,l=0;const c=[];if(null==t?void 0:t.moveItems)try{const n=await t.moveItems("folders"===i?"":i,e.map(e=>e.id)),r=n.detailed;if(r){const e=r.filter(e=>e.success),t=r.filter(e=>!e.success);s+=e.length,l+=t.length,t.forEach(e=>{const t=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),n=e.error,r=Ai(n);c.push({itemId:t,itemName:o(t),error:r})})}else if(n.success)s+=e.length;else{const t=n.error;if(t){l+=e.length;const n=Ai(t);c.push({error:n})}else l+=e.length}}catch(t){l+=e.length;const n=Ai(t);c.push({error:n})}else l+=e.length,c.push({error:{message:"Move provider is not configured"}});return a&&(s>0&&r.success({id:"FILES_MOVE_SUCCESS",message:n("Files moved"),placement:"bottomRight",data:{successCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===i?null:i}}),l>0&&r.error({id:"FILES_MOVE_ERROR",message:n("Errors occurred while moving"),placement:"bottomRight",innerException:c.length?c:void 0,data:{failCount:l,totalCount:e.length,itemIds:e.map(e=>e.id),errors:c.length?c:void 0}})),{successCount:s,failCount:l,errorDetails:c}},[t,r,n]);return{moveItems:i}})(),{refreshFolders:m,refreshFiles:v}=Ri(),{getItemNameById:y,getItemNamesByIds:b,getNamesPreview:w}=Oi(o),x=c(()=>{null==h||h(!0)},[h]),C=c(()=>{null==h||h(!1),null==l||l.resetFields()},[h,l]),_=c(async t=>{var n,c,h;if(!((null==d?void 0:d.length)||s&&0!==s.size))return;const x=o.length,_=Object.assign({},u),S=Array.from((null==d?void 0:d.length)?[d]:s),k=S.length;let A=0,E=0;const I=[],T=S.map(e=>o.find(t=>t.id===e)).filter(e=>Boolean(e)),F=T.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let o=t;if(!t){const e=await l.validateFields();o=null==e?void 0:e.targetFolder}if(!o)return void i.error({id:"FILES_MOVE_DIRECTORY_NOT_SELECTED",message:r("Select destination folder"),placement:"bottomRight"});const s="folders"===o?null:o,u=null!=s?s:a,d=await g({items:T,targetFolderId:o,getItemNameById:y,showNotifications:!1});if(A=d.successCount,E=d.failCount,I.push(...d.errorDetails),A>0){const e=b(S),t=w(e),n=t?r("Moved",{names:t}):r("move_success_summary",{successCount:A,totalCount:k});i.success({id:"FILES_MOVE_SUCCESS",message:n,placement:"bottomRight",data:Pi(S,A,k,s,e)})}if(E>0){const e=b(S),t=w(e);let o;if(1===k&&I.length>0&&(null===(n=I[0].error)||void 0===n?void 0:n.code)){const e=ki(null===(c=I[0].error)||void 0===c?void 0:c.code,r);o=null!=e?e:t?r("Failed",{names:t}):r("move_fail_summary",{failCount:E,totalCount:k})}else o=t?r("Failed",{names:t}):r("move_fail_summary",{failCount:E,totalCount:k});i.error({id:"FILES_MOVE_ERROR",message:o,placement:"bottomRight",innerException:I.length?I:void 0,data:Mi(S,E,k,s,I.length?I:void 0,e)})}C(),null==f||f(new Set);let O=_.current;if(A>0&&x>0&&A>=x&&_.current>1&&(O=_.current-1),A>0&&_.total>=A){const e=Math.max(0,(null!==(h=_.total)&&void 0!==h?h:0)-A);null==p||p({current:O,pageSize:_.pageSize,total:e})}F&&await m({parentIds:void 0,selectedFolder:u}),await v({fetchFiles:e,selectedFolder:u,page:O,limit:_.pageSize})}catch(e){console.error("Ошибка при перемещении:",e);const t=ki(Ai(e).code,r);i.error({id:"FILES_MOVE_ERROR",innerException:e,message:null!=t?t:r("Error moving"),placement:"bottomRight",data:Mi(S,k,k,a||null,[{error:Ai(e)}],b(S))})}},[d,s,l,f,e,a,u,o,i,p,r,g,h]);return{actions:{showMoveModal:x,handleMoveCancel:C,handleMoveOk:_}}},ji=e=>{const{state:t,actions:n}=yi(),{t:r}=$n(),i=_i(),{files:o,selectedFolder:a,selectedFiles:s,copyForm:l,pagination:u,currentMenuFile:d}=t,{setIsCopyModalVisible:h,setSelectedFiles:f}=n,{copyItems:p}=(()=>{const{options:e}=yi(),{dataProviders:t}=e,{t:n}=$n(),r=_i(),i=c(async({items:e,targetFolderId:i,getItemNameById:o,showNotifications:a=!1})=>{let s=0,l=0;const c=[],u="folders"===i?"":i;if(null==t?void 0:t.copyItems)try{const n=await t.copyItems(u,e.map(e=>e.id)),r=n.detailed;if(r){const e=r.filter(e=>e.success),t=r.filter(e=>!e.success);s+=e.length,l+=t.length,t.forEach(e=>{const t=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),n=e.error,r=Ai(n);c.push({itemId:t,itemName:o(t),error:r})})}else if(n.success)s+=e.length;else{const t=n.error;if(t){l+=e.length;const n=Ai(t);c.push({error:n})}else l+=e.length}}catch(t){l+=e.length;const n=Ai(t);c.push({error:n})}else if(null==t?void 0:t.copyItem)for(const n of e)try{const e=(null==n?void 0:n.isFolder)||n.id.startsWith("folder_");await t.copyItem({itemId:n.id,targetFolderId:u,isFolder:e})?s++:l++}catch(e){l++;const t=Ai(e);c.push({itemId:n.id,itemName:o(n.id),error:t})}else l+=e.length,c.push({error:{message:"Copy provider is not configured"}});return a&&(s>0&&r.success({id:"FILES_COPY_SUCCESS",message:n("Files copied"),placement:"bottomRight",data:{successCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===i?null:i}}),l>0&&r.error({id:"FILES_COPY_ERROR",message:n("Errors occurred while copying"),placement:"bottomRight",innerException:c.length?c:void 0,data:{failCount:l,totalCount:e.length,itemIds:e.map(e=>e.id),errors:c.length?c:void 0}})),{successCount:s,failCount:l,errorDetails:c}},[t,r,n]);return{copyItems:i}})(),{refreshFolders:g,refreshFiles:m}=Ri(),{getItemNameById:v,getItemNamesByIds:y,getNamesPreview:b}=Oi(o),w=c(()=>{null==h||h(!0)},[h]),x=c(()=>{null==h||h(!1),null==l||l.resetFields()},[h,l]),C=c(async t=>{var n,c;if(!((null==d?void 0:d.length)||s&&0!==s.size))return;const h=Array.from((null==d?void 0:d.length)?[d]:s),w=h.length;let C=0,_=0;const S=[],k=h.map(e=>o.find(t=>t.id===e)).filter(e=>Boolean(e)),A=k.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let o=t;if(!t){const e=await l.validateFields();o=null==e?void 0:e.targetFolder}if(!o)return void i.error({id:"FILES_COPY_DIRECTORY_NOT_SELECTED",message:r("Select destination folder"),placement:"bottomRight"});const s="folders"===o?null:o,d=null!=s?s:a,E=await p({items:k,targetFolderId:o,getItemNameById:v,showNotifications:!1});if(C=E.successCount,_=E.failCount,S.push(...E.errorDetails),C>0){const e=y(h),t=b(e),n=t?r("Copied",{names:t}):r("copy_success_summary",{successCount:C,totalCount:w});i.success({id:"FILES_COPY_SUCCESS",message:n,placement:"bottomRight",data:Pi(h,C,w,s,e)})}if(_>0){const e=y(h),t=b(e);let o;if(1===w&&S.length>0&&(null===(n=S[0].error)||void 0===n?void 0:n.code)){const e=ki(null===(c=S[0].error)||void 0===c?void 0:c.code,r);o=null!=e?e:t?r("Failed",{names:t}):r("copy_fail_summary",{failCount:_,totalCount:w})}else o=t?r("Failed",{names:t}):r("copy_fail_summary",{failCount:_,totalCount:w});i.error({id:"FILES_COPY_ERROR",message:o,placement:"bottomRight",innerException:S.length?S:void 0,data:Mi(h,_,w,s,S.length?S:void 0,e)})}x(),null==f||f(new Set),A&&await g({parentIds:void 0,selectedFolder:d}),await m({fetchFiles:e,selectedFolder:d,page:u.current,limit:u.pageSize})}catch(e){console.error("Ошибка при копировании:",e);const t=ki(Ai(e).code,r);i.error({id:"FILES_COPY_ERROR",message:null!=t?t:r("Error copying"),innerException:e,placement:"bottomRight",data:Mi(h,w,w,a||null,[{error:Ai(e)}],y(h))})}},[d,s,l,f,e,a,u,o,i,r,p,h]);return{actions:{showCopyModal:w,handleCopyCancel:x,handleCopyOk:C}}},Di=e=>{const t=Fi(e),n=Li(e),r=ji(e),i=(e=>{const{state:t,actions:n,options:r}=yi(),{t:i}=$n(),o=_i(),{files:a,selectedFolder:s,selectedFiles:l,pagination:u,currentMenuFile:d}=t,{setSelectedFiles:h,setIsDeleteConfirmVisible:f,setUndoDeletion:p,setPagination:g}=n,{config:m}=r,{deleteItems:v}=Ii(),{refreshFolders:y,refreshFiles:b}=Ri(),{getItemNameById:w,getItemNamesByIds:x,getNamesPreview:C}=Oi(a),_=c(()=>{null==f||f(!0)},[f]),S=c(()=>{null==f||f(!1)},[f]),k=c(async()=>{var t,n,r;if(!((null==d?void 0:d.length)||l&&0!==l.size))return void(null==f||f(!1));const c=a.length,_=Object.assign({},u),S=Array.from(d?[d]:l),k=S.map(e=>a.find(t=>t.id===e)).filter(e=>Boolean(e)),A=new Set;k.forEach(e=>{(null==e?void 0:e.isFolder)&&A.add((e=>{var t,n;if(!e)return null;const r=e;return null!==(n=null!==(t=r.folderId)&&void 0!==t?t:r.parentId)&&void 0!==n?n:null})(e))});let E=0,I=0;const T=[];try{const a=await v({items:k,selectedFolder:s,getItemNameById:w,showNotifications:!1});E=a.successCount,I=a.failCount,T.push(...a.errorDetails);const l=(null==m?void 0:m.enableTrashFolder)&&"Trash"===s;if(E>0&&(null==m?void 0:m.enableTrashFolder)&&!l&&(null==p||p({itemIds:S,sourceFolderId:s||"folders"})),E>0){const e=S.length;(null==m?void 0:m.enableTrashFolder)&&!l?await o.success({id:"FILES_DELETE_SUCCESS",message:i("moved_to_trash",{count:E}),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:S,folderId:s||null}}):await o.success({id:"FILES_DELETE_SUCCESS",message:i("Files deleted"),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:S,folderId:s||null}})}if(I>0){const e=x(S),r=C(e),a=S.length,s=1===a&&T.length>0&&(null===(t=T[0].error)||void 0===t?void 0:t.code),c=(null==m?void 0:m.enableTrashFolder)&&!l,u=i(c?"При перемещении в корзину произошли ошибки":"При удалении произошли ошибки"),d=s?ki(null===(n=T[0].error)||void 0===n?void 0:n.code,i):void 0,h=null!=d?d:r?i("Failed",{names:r}):u;o.error({id:"FILES_DELETE_ERROR",message:h,placement:"bottomRight",innerException:T.length?T:void 0,data:{failCount:I,isTrashMove:c,totalCount:a,itemNames:e,errors:T.length?T:void 0}})}null==h||h(new Set),null==f||f(!1),await y({parentIds:Array.from(A),selectedFolder:s});let u=_.current;if(E>0&&c>0&&E>=c&&_.current>1&&(u=_.current-1),E>0&&_.total>=E){const e=Math.max(0,(null!==(r=_.total)&&void 0!==r?r:0)-E);null==g||g({current:u,pageSize:_.pageSize,total:e})}await b({fetchFiles:e,selectedFolder:s,page:u,limit:_.pageSize})}catch(e){console.error("Ошибка при удалении:",e),o.error({id:"FILES_DELETE_ERROR",message:i("Error deleting"),placement:"bottomRight",innerException:e,data:{failCount:I,totalCount:k.length}})}},[d,l,f,e,s,u,p,g,a,i,o,v,null==m?void 0:m.enableTrashFolder]);return{actions:{showDeleteConfirm:_,handleDeleteConfirmCancel:S,handleDeleteConfirmOk:k}}})(e);return{state:t.state,actions:Object.assign(Object.assign(Object.assign(Object.assign({},t.actions),n.actions),r.actions),i.actions)}},Ni=()=>{const{state:e}=yi(),{files:t,loading:n,isUrlModalVisible:r}=e,i=Ti(),o=(()=>{const{state:e,actions:t}=yi(),{selectedFiles:n,files:r,multiSelect:i}=e,{setSelectedFiles:o}=t,a=u(null),s=c((e,t,n)=>{const i=Array.isArray(r)?r:[],o=i.findIndex(t=>t.id===e),a=i.findIndex(e=>e.id===t);if(-1===o||-1===a)return n;const[s,l]=o<a?[o,a]:[a,o],c=i.slice(s,l+1).map(e=>e.id),u=new Set(n);return c.forEach(e=>u.add(e)),u},[r]),l=c((e,t)=>{if(!n||!o)return;const r=!1!==i,l=!!(null==t?void 0:t.shiftKey)&&r&&a.current;let c=new Set(r?n:[]);l&&a.current?c=s(a.current,e,c):c.has(e)?c.delete(e):c.add(e),a.current=e,o(c)},[i,n,o,s]);return{state:{selectedFiles:n||new Set},actions:{toggleFileSelection:l}}})(),a=Di(i.fetchFiles);return{state:{files:t||[],selectedFiles:o.state.selectedFiles,loading:n||!1,isAddingFileByUrl:r||!1,isRenamingFile:a.state.isRenamingFile,fileToRename:a.state.fileToRename},actions:{fetchFiles:i.fetchFiles,handleDeleteFile:i.handleDeleteFile,handleDeleteFolder:i.handleDeleteFolder,handleAddFile:i.handleAddFile,handleAddFileByUrl:i.handleAddFileByUrl,handleDroppedFiles:i.handleDroppedFiles,uploadFileWithProvider:i.uploadFileWithProvider,toggleFileSelection:o.actions.toggleFileSelection,showRenameModal:a.actions.showRenameModal,handleRenameCancel:a.actions.handleRenameCancel,handleRenameOk:a.actions.handleRenameOk,showMoveModal:a.actions.showMoveModal,handleMoveCancel:a.actions.handleMoveCancel,handleMoveOk:a.actions.handleMoveOk,showCopyModal:a.actions.showCopyModal,handleCopyCancel:a.actions.handleCopyCancel,handleCopyOk:a.actions.handleCopyOk,showDeleteConfirm:a.actions.showDeleteConfirm,handleDeleteConfirmCancel:a.actions.handleDeleteConfirmCancel,handleDeleteConfirmOk:a.actions.handleDeleteConfirmOk}}},zi="filemanager_sidebar_width",Bi=({onSearch:t,placeholder:n,className:r})=>{const{t:i}=$n(),[s,l]=o(""),c=u(null),{options:d}=yi(),{config:h}=d,f=n||i("Search files...");a(()=>(c.current=mi.debounce(e=>{t(e)},500),()=>{var e;null===(e=c.current)||void 0===e||e.cancel()}),[t]);return e(F,{value:s,onChange:e=>{var t;const n=e.target.value;l(n),null===(t=c.current)||void 0===t||t.call(c,n)},placeholder:f,prefix:e(li,{size:16,strokeWidth:null==h?void 0:h.iconStrokeWidth}),className:r,allowClear:!0,onClear:()=>{l(""),t("")}})},Ui=new Map,Vi=(e,t)=>{Ui.set(e,t),console.log("Изображение сохранено в кеш:",e),Ui.size>350&&(Array.from(Ui.keys()).slice(0,50).forEach(e=>Ui.delete(e)),console.warn("Очищен кеш изображений. Удалено 50 самых старых записей."))},$i=e=>{if(e.type&&e.type.startsWith("image/"))return!0;if(e.name){const t=e.name.toLowerCase().split(".").pop();return un.includes(t||"")}return!1},Wi=({src:t,alt:n,className:r,width:i,height:s,preview:l=!1,file:u})=>{const{t:d}=$n(),h=Ti(),[f,p]=o(!1),[g,m]=o(t),[v,y]=o(!1),b=c(e=>{m(e),p(!1),y(!1)},[]),w=c(e=>{console.warn("Не удалось загрузить изображение:",e),m(void 0),p(!0),y(!1)},[]),x=c(()=>{m(dn),p(!0)},[]),C=c(e=>{m(e),p(!1)},[]),_=c(e=>{const t=e.split(",")[1];t&&t.length>20?m(e):(console.warn("Некорректные base64 данные:",e.substring(0,50)+"..."),x())},[x]),S=c(async e=>{if(console.log("loadImageFromFile",e.id),t=e.id,Ui.has(t))return console.log("Изображение найдено в кеше:",e.id),(e=>Ui.get(e))(e.id);var t;if(!e||!$i(e))return console.warn("Файл не является изображением:",null==e?void 0:e.name,null==e?void 0:e.type),x(),dn;try{const t=await h.getFileData(e);if(!t)throw new Error(d("Error loading image"));return new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const t=i.result;Vi(e.id,t),n(t)},i.onerror=()=>r(new Error("Ошибка чтения файла")),i.readAsDataURL(t)})}catch(e){throw console.error("Ошибка загрузки изображения:",e),e}},[u,x,h]),k=c(()=>{(null==u?void 0:u.id)&&$i(u)?S(u).then(b).catch(w):u&&!$i(u)&&(console.warn("Файл не является изображением, показываем fallback:",u.name,u.type),x())},[u,S,b,w,x]),A=c(e=>{console.log("HandleBlobSrc:",{blobSrc:e,file:u?{id:u.id,name:u.name,type:u.type,extension:u.extension,folderId:u.folderId}:null}),u&&$i(u)?(console.log("Blob файл является изображением, устанавливаем src:",u.name,u.type),m(e),p(!1)):(console.warn("Blob файл не является изображением, показываем fallback:",null==u?void 0:u.name,null==u?void 0:u.type),x())},[u,x,$i]),E=c(()=>{(null==u?void 0:u.id)&&$i(u)?(y(!0),S(u).then(b).catch(w)):u&&!$i(u)?(console.warn("Файл не является изображением, показываем fallback:",u.name,u.type),x()):(console.warn("Неподдерживаемый формат изображения:",t),m(void 0))},[u,t,S,b,w,x]);a(()=>{y(!1),t?t.startsWith("data:image/")?_(t):t.startsWith("blob:")?A(t):t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?C(t):E():k()},[t,k,_,A,C,E]);return e(O,{className:r,src:g,alt:n,width:i,height:s,preview:l&&!f&&{src:g,toolbarRender:()=>null,destroyOnHidden:!0,mask:e(se,{style:{fontSize:"20px"}})},onError:()=>{console.warn("Ошибка загрузки изображения:",(null==g?void 0:g.substring(0,50))+"..."),p(!0)},fallback:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiBmaWxsPSIjRjVGNUY1Ii8+CjxwYXRoIGQ9Ik0yNCAzMkw0MCA0OEw1NiAzMkw2NCA0MEw2NCA2NEgyNFYzMloiIGZpbGw9IiNEOUQ5RDkiLz4KPC9zdmc+",loading:v?"lazy":void 0})},Hi=()=>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"})}),qi=()=>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"})}),Gi=()=>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"})}),Yi=()=>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"})}),Xi=()=>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"})]}),Ki=()=>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"})}),Zi=()=>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"})}),Ji=()=>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"})]}),Qi=()=>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"})]}),eo=()=>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"})}),to=()=>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"})}),no=()=>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"})]}),ro=()=>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"})]}),io=()=>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"})]}),oo=()=>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"})}),ao=t=>e(ie,Object.assign({component:Hi},t)),so=t=>e(ie,Object.assign({component:qi},t)),lo=t=>e(ie,Object.assign({component:Gi},t)),co=t=>e(ie,Object.assign({component:Yi},t)),uo=t=>e(ie,Object.assign({component:Xi},t)),ho=t=>e(ie,Object.assign({component:Ki},t)),fo=t=>e(ie,Object.assign({component:Zi},t)),po=t=>e(ie,Object.assign({component:Ji},t)),go=t=>e(ie,Object.assign({component:Qi},t)),mo=t=>e(ie,Object.assign({component:eo},t)),vo=t=>e(ie,Object.assign({component:to},t)),yo=t=>e(ie,Object.assign({component:no},t)),bo=t=>e(ie,Object.assign({component:ro},t)),wo=t=>e(ie,Object.assign({component:io},t)),xo=t=>e(ie,Object.assign({component:oo},t)),Co=()=>{const{options:e}=yi(),{customIcons:t}=e,n=(e,n,r)=>{const o=null==t?void 0:t[e];return o?i.createElement(o,r):i.createElement(n,r)};return{RootFolderIcon:e=>n("rootFolder",ae,e),FolderIcon:e=>n("folder",po,e),FolderOpenIcon:e=>n("folderOpen",me,e),AddFolderIcon:e=>n("addFolder",ge,e),FileIcon:e=>n("file",pe,e),UploadIcon:e=>n("upload",fe,e),UploadByUrlIcon:e=>n("uploadByUrl",he,e),ExpandArrowIcon:e=>n("expandArrow",de,e),CollapseArrowIcon:e=>n("collapseArrow",ue,e),ExpandFolderIcon:e=>n("expandArrow",Qr,e),CollapseFolderIcon:e=>n("collapseArrow",Jr,e),FolderPreviewIcon:e=>n("folderPreview",go,e),EmptyFolderIcon:e=>n("folderPreview",mo,e),GridViewIcon:e=>n("gridView",ce,e),ListViewIcon:e=>n("listView",le,e),DropZoneFileIcon:e=>n("folderPreview",vo,e),BigStockIcon:e=>n("folderPreview",yo,e),BigAIIcon:e=>n("folderPreview",bo,e),GifPlayIcon:e=>n("folderPreview",wo,e),StockBigIcon:e=>n("folderPreview",xo,e),MixedViewIcon:e=>n("mixedView",ao,e),LandscapeViewIcon:e=>n("landscapeView",so,e),PortraitViewIcon:e=>n("portraitView",lo,e),SquareViewIcon:e=>n("squareView",co,e),LightModeIcon:e=>n("lightMode",ho,e),DarkModeIcon:e=>n("darkMode",fo,e),AiIcon_2:e=>n("aiIcon_2",uo,e),NoFilesIcon:e=>n("noFiles",ei,e),getCustomIcon:n}};var _o="noFilesContainer",So="noFilesImage",ko="noFilesTitle",Ao="noFilesDescription";const Eo=()=>{const{t:n}=$n(),{NoFilesIcon:r}=Co();return t("div",{className:_o,children:[e(r,{className:So,size:48,strokeWidth:1.4}),e("h2",{className:ko,children:n("There's nothing here")}),e("div",{className:Ao,children:n("Try using a different search query.")})]})},Io="filemanager_view_mode";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 To=e=>{if(!e||e<=0)return"";const t=1048576;if(e<t){return`${Math.round(e/1024)} Kb`}return`${(e/t).toFixed(2)} Mb`};var Fo={headerContainer:"headerContainer",actionsContainer:"actionsContainer",filesContainer:"filesContainer",noFiles:"noFiles",paginationContainer:"paginationContainer",uploadIcon:"uploadIcon",tableContainer:"tableContainer",imagePreview:"imagePreview",fileManagerTableFolder:"fileManagerTableFolder",fileManagerTableFolderInner:"fileManagerTableFolderInner",sortSelect:"sortSelect",fileNameCol:"fileNameCol",fileItemCount:"fileItemCount",fileSize:"fileSize",fileDate:"fileDate",tableMenu:"tableMenu",tableImagePreview:"tableImagePreview",tableFolderIcon:"tableFolderIcon",buttonDeselected:"buttonDeselected",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",active:"active",blockText:"blockText",textTitle:"textTitle",textDescription:"textDescription",buttons:"buttons",btnAi:"btnAi",btnPhoto:"btnPhoto",dragOverlay:"dragOverlay",dragOverlayInner:"dragOverlayInner",noFilesIcon:"noFilesIcon",textTitle_trash:"textTitle_trash",textDescription_trash:"textDescription_trash"};const{Text:Oo}=P,{Option:Po}=M,Mo=({files:r,searchTerm:s,handleSearch:l,handleSort:d,sortBy:h,sortOrder:f,handleSortOptionChange:p,pagination:g,setPagination:m,loading:v,handleItemClick:y,selectedFiles:b,toggleFileSelection:w,handleDroppedFiles:x,onRename:C,onDelete:_,onCopy:S,onMove:k,onEdit:A,fileUpload:I,handleAddFile:T})=>{var F;const{t:O}=$n(),{DropZoneFileIcon:P,BigStockIcon:q,BigAIIcon:G,FolderIcon:Y}=Co(),{options:X,actions:K,state:Z}=yi(),{dataProviders:J,config:Q}=X,ee=null==Q?void 0:Q.disablePagination,{setCurrentMenuFile:te,setSelectedFiles:ne,setActiveLibraryItem:re}=K,ie="Trash"===(null==Z?void 0:Z.selectedFolder),{viewMode:oe,setViewMode:ae}=(()=>{const[e,t]=o(()=>{try{return localStorage.getItem(Io)||"table"}catch(e){return"table"}}),n=c(e=>{t(e);try{localStorage.setItem(Io,e)}catch(e){console.warn("Не удалось сохранить режим отображения:",e)}},[]),r=c(()=>{n("table"===e?"grid":"table")},[e,n]);return{viewMode:e,setViewMode:n,toggleViewMode:r}})(),[se,le]=o(!1),[ce,ue]=o({}),[de,he]=o(null),[fe,pe]=o(!1),ge=u(0);a(()=>{const e=()=>{pe(window.innerWidth<1200)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const me=b.size,ve=(null==Q?void 0:Q.features)||{},ye=i.useMemo(()=>Array.from(b)[0],[b]),be=i.useMemo(()=>ye?r.find(e=>e.id===ye):void 0,[ye,r]),we=(null==be?void 0:be.isFolder)?!1!==(null==ve?void 0:ve.enableRenameFolder):!1!==(null==ve?void 0:ve.enableRenameFile),xe=null==Q?void 0:Q.iconStrokeWidth,Ce=e=>{const t=e.extension?e.extension:e.name&&e.name.includes(".")?e.name.split(".").pop():e.type?(e=>{var t,n;if(e&&e.startsWith("image/"))return null===(n=null===(t=e.split("/")[1])||void 0===t?void 0:t.split(";")[0])||void 0===n?void 0:n.trim()})(e.type):void 0,n=(e=>!!e&&un.includes(e.toLowerCase()))(t);return n},_e=i.useMemo(()=>!(1!==me||!be||be.isFolder)&&Ce(be),[me,be]),Se=`${h}-${f}`,ke=i.useMemo(()=>Array.isArray(r)&&r.some(e=>(e=>{if(!e)return!1;const t=new Date(e);return!Number.isNaN(t.getTime())})(e.date)),[r]),Ae=c(async e=>{try{if(null==J?void 0:J.getChildrenCount)return await J.getChildrenCount("folders"===e?void 0:e);if(null==J?void 0:J.getFiles){const{files:t,pagination:n}=await J.getFiles({folderId:"folders"===e?void 0:e,itemType:"all"});return(null==n?void 0:n.total)||t.filter(e=>!e.isFolder).length}return 0}catch(t){return console.error(`Ошибка при получении количества файлов для папки ${e}:`,t),0}},[J]),Ee=c(async()=>{const e=r.filter(e=>e.isFolder);if(0===e.length)return;const t={},n=e.map(async e=>{t[e.id]=await Ae(e.id)});await Promise.all(n),ue(t)},[r,Ae]);a(()=>{Ee()},[Ee]);const Ie=c(e=>{e.preventDefault(),e.stopPropagation(),ge.current+=1,e.dataTransfer.types&&e.dataTransfer.types.includes("Files")&&le(!0)},[]),Te=c(e=>{e.preventDefault(),e.stopPropagation(),ge.current-=1,0===ge.current&&le(!1)},[]),Fe=c(e=>{e.preventDefault(),e.stopPropagation()},[]),Oe=c(e=>{if(e.preventDefault(),e.stopPropagation(),le(!1),ge.current=0,e.dataTransfer.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);x(t).catch(e=>{console.error("Ошибка при загрузке файлов:",e)})}},[x]),Pe=c((e=()=>{})=>{if(de)return;const t=setTimeout(()=>{e(),he(null)},300);he(t)},[de]),Me=c(e=>{de&&(clearTimeout(de),he(null)),e()},[de]),Re=c(t=>{const n=[];!t.isFolder&&!1!==(null==ve?void 0:ve.enableEdit)&&Ce(t)&&n.push({key:"edit",label:O("Edit"),icon:e(Xr,{size:16,strokeWidth:xe})}),(t.isFolder?!1!==(null==ve?void 0:ve.enableMoveFolder):!1!==(null==ve?void 0:ve.enableMoveItem))&&n.push({key:"move",label:O("Move to"),icon:e(Zr,{size:16,strokeWidth:xe})}),(t.isFolder?!1!==(null==ve?void 0:ve.enableCopyFolder):!1!==(null==ve?void 0:ve.enableCopyItem))&&n.push({key:"copy",label:O("Copy"),icon:e(Yr,{size:16,strokeWidth:xe})});return(t.isFolder?!1!==(null==ve?void 0:ve.enableRenameFolder):!1!==(null==ve?void 0:ve.enableRenameFile))&&n.push({key:"rename",label:O("Rename"),icon:e(ui,{size:16,strokeWidth:xe})}),!1!==ve.enableDelete&&n.push({key:"delete",label:O("Delete"),icon:e(di,{size:16,strokeWidth:xe}),style:{color:"#ff4d4f"}}),n},[ve,O,xe]),Le=e=>({key:t})=>{const n=r.find(t=>t.id===e);switch(te&&(null==n?void 0:n.id)&&te(null==n?void 0:n.id),t){case"edit":A(n);break;case"move":k();break;case"copy":S();break;case"rename":C(e);break;case"delete":_(n);break;default:te&&te("")}},je=[{key:"selection",width:46,render:(t,n)=>e(R,{checked:b.has(n.id),onChange:()=>w(n.id)})},{key:"preview",width:60,render:(t,n)=>n.isFolder?e("div",{className:Fo.fileManagerTableFolder,children:e("div",{className:Fo.fileManagerTableFolderInner,children:e(Y,{className:Fo.tableFolderIcon,style:{width:40,height:40}})})}):e(Wi,{className:`${Fo.imagePreview} ${Fo.tableImagePreview}`,src:n.thumbnail||n.thumbnailUrl||n.url,alt:n.name,width:40,height:40,preview:!0,file:n})},{title:O("Name"),width:"calc(100% - 430px)",dataIndex:"name",key:"name",className:Fo.fileNameCol,render:(e,n)=>{const r=n.isFolder&&ce[n.id]||0,i=O(1===r?"item":"items");return t("div",{className:Fo.fileName,children:[e||O("No name"),n.isFolder&&t("div",{className:Fo.fileItemCount,children:[r," ",i]})]})}},{title:O("Dimensions"),key:"dimensions",width:100,render:(t,n)=>n.dimensions&&e("div",{className:Fo.fileSize,children:n.dimensions})},{title:O("Size"),key:"size",width:90,render:(t,n)=>!(null==n?void 0:n.size)||n.isFolder?null:e("div",{className:Fo.fileSize,children:To(n.size)})},{title:O("Type"),key:"type",width:90,render:(t,n)=>{var r,i,o;if(n.isFolder)return e("div",{className:Fo.fileSize,children:O("Folder")});const a=n.extension||(null===(r=n.name.split(".").pop())||void 0===r?void 0:r.toLowerCase())||(n.url?null===(o=null===(i=n.url.split("?")[0].split("/").pop())||void 0===i?void 0:i.split(".").pop())||void 0===o?void 0:o.toLowerCase():"")||"";return e("div",{className:Fo.fileSize,children:a})}},...ke?[{title:O("Date"),dataIndex:"date",key:"date",width:200,render:(t,n)=>{const r=n.date;if(!r)return null;const i=new Date(r);if(isNaN(i.getTime()))return null;const o=e=>`${e.getDate()} ${[O("months.january"),O("months.february"),O("months.march"),O("months.april"),O("months.may"),O("months.june"),O("months.july"),O("months.august"),O("months.september"),O("months.october"),O("months.november"),O("months.december")][e.getMonth()]} ${e.getFullYear()}`;return e(L,{title:O("Added",{date:o(i)}),placement:"bottom",className:Fo.fileDate,children:O("Added",{date:o(i)})})}}]:[],{width:40,title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),render:(t,n)=>e(j,{arrow:!0,placement:"bottom",menu:{items:Re(n),onClick:Le(n.id)},trigger:["hover"],children:e("span",{className:`${Fo.tableMenu} tableMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(Kr,{size:16,strokeWidth:xe})})})}],De="table"===oe?e(E,{renderEmpty:()=>e(V,{image:e(n,{}),description:""}),children:e(U,{dataSource:r,columns:je,rowKey:"id",pagination:!1,loading:v,rowClassName:e=>(null==b?void 0:b.has(e.id))?Fo.selectedRow:"",tableLayout:"fixed",onRow:e=>({onClick:t=>{const n=t.target;Pe(()=>{t.stopPropagation(),t.preventDefault();const r=!!n.closest(".ant-image")||!!n.closest(".ant-image-preview-wrap"),i=!!n.closest(".tableMenuButton"),o=!!n.closest(".ant-dropdown-menu");r||i||o||w(e.id,{metaKey:t.metaKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey})})},onDoubleClick:t=>{Me(()=>{t.stopPropagation(),t.preventDefault();const n=t.target;n.closest(".ant-checkbox-wrapper")||n.closest(".tableMenu")||(e.isFolder?y(e):n.closest(".ant-image")||n.closest(".ant-image-preview-wrap")||!X.onEditorOk||(console.warn("onEditorOk"),X.onEditorOk(e)))})}}),showHeader:!1})}):e($,{gutter:[16,16],className:Fo.gridRow,style:{gap:20,padding:"0 24px 24px",margin:0},children:r.map(r=>e(W,{className:Fo.gridCard_col,style:{padding:0},children:t(H,{hoverable:!0,cover:e("div",{className:r.isFolder?Fo.gridPreviewContainerFolder:Fo.gridPreviewContainer,onClick:e=>{e.stopPropagation(),r.isFolder&&Pe(()=>{w(r.id,{metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey})})},onDoubleClick:e=>{e.stopPropagation(),Me(()=>{r.isFolder&&y(r)})},children:r.isFolder?e("div",{className:Fo.gridFolderIcon,children:e(Y,{className:Fo.gridFolderIconImage})}):e(Wi,{src:r.thumbnail||r.thumbnailUrl||r.url,alt:r.name,className:Fo.gridImagePreview,preview:!0,file:r})}),className:`${Fo.gridCard} ${(null==b?void 0:b.has(r.id))?Fo.gridCardSelected:""}`,onClick:e=>{e.stopPropagation(),e.preventDefault();const t=e.target;t.closest(".gridFileMenuButton")||t.closest(".ant-dropdown-menu")||Pe(()=>w(r.id,{metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey}))},onDoubleClick:e=>{e.stopPropagation(),Me(()=>{r.isFolder&&y(r)})},children:[t("div",{className:Fo.gridCardContent,onDoubleClick:e=>{e.stopPropagation(),e.preventDefault(),Me(()=>{r.isFolder?y(r):X.onEditorOk&&X.onEditorOk(r)})},onClick:e=>{e.stopPropagation(),e.preventDefault();const t=e.target;t.closest(".gridFileMenuButton")||t.closest(".ant-dropdown-menu")||Pe(()=>w(r.id,{metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey}))},children:[e("div",{className:Fo.gridFileName,children:r.name||O("Untitled")}),e("div",{className:Fo.gridFileInfo,children:r.isFolder?(()=>{const e=ce[r.id]||0;return`${e} ${O(1===e?"item":"items")}`})():t(n,{children:[r.dimensions&&`${r.dimensions} • `,r.size&&`${To(r.size)} • `,r.extension&&`${r.extension}`]})})]}),e("div",{className:Fo.gridFileMenu,children:e(j,{menu:{items:Re(r),onClick:Le(r.id)},arrow:!0,placement:"bottom",trigger:["hover"],children:e(D,{type:"default",className:`${Fo.gridFileMenuButton} gridFileMenuButton`,onClick:()=>{},children:e(Kr,{size:16,strokeWidth:xe})})},r.id)}),e("div",{onClick:e=>{e.stopPropagation()},className:Fo.gridCheckbox,children:e(R,{checked:b.has(r.id),style:{height:20},onChange:e=>{e.stopPropagation(),w(r.id)}})})]})},r.id))}),Ne=null===(F=null==Q?void 0:Q.availableImageExtensions)||void 0===F?void 0:F.map(e=>"."+e).join(", "),ze=t("div",ie?{className:`${Fo.noFiles} ant-layout-sider-light`,children:[e(hi,{size:48,className:Fo.noFilesIcon}),e("div",{className:`${Fo.textTitle_trash} ant-menu-submenu-title`,children:O("Trash is empty")}),e("div",{className:`${Fo.textDescription_trash} ant-menu-submenu-title`,children:O("Deleted files will be displayed here")})]}:{className:Fo.uploadContainer,children:[t("div",{className:`${Fo.uploadArea} ${se?Fo.active:""}`,onClick:T,onDragOver:Fe,onDragLeave:Te,onDragEnter:Ie,onDrop:Oe,children:[e("div",{className:Fo.uploadIcon,children:e(P,{})}),e("div",{className:Fo.textTitle,children:O("Select a file or drag and drop it here")}),e("div",{className:Fo.textDescription,children:O("Supported files:")+" "+(Ne||"jpeg, .svg, .png")})]}),t("div",{className:Fo.buttons,children:[t("button",{className:Fo.btnPhoto,onClick:()=>{re&&re(tn)},children:[e("div",{className:Fo.icon,children:e(q,{})}),t("div",{className:Fo.blockText,children:[e("div",{className:Fo.textTitle,children:O("Stock")}),e("div",{className:Fo.textDescription,children:O("Select an image from our library")})]})]}),t("button",{className:Fo.btnAi,onClick:()=>{re&&re(nn)},children:[e("div",{className:Fo.icon,children:e(G,{})}),t("div",{className:Fo.blockText,children:[e("div",{className:Fo.textTitle,children:O("AI generation")}),e("div",{className:Fo.textDescription,children:O("Creating an image on demand")})]})]})]})]});return e("div",{className:"content-layout",children:t("div",{className:Fo.filesContainer,onDragOver:Fe,onDragLeave:Te,onDragEnter:Ie,onDrop:Oe,children:[se&&0!==(null==r?void 0:r.length)&&e("div",{className:Fo.dragOverlay,children:t("div",{className:Fo.dragOverlayInner,children:[e("div",{className:Fo.uploadIcon,children:e(P,{})}),e("div",{className:Fo.textTitle,children:O("Drop files to upload")}),e("div",{className:Fo.textDescription,children:O("Supported files:")+" "+(Ne||"jpeg, .svg, .png")})]})}),v||0!==(null==r?void 0:r.length)||s?t("div",{className:Fo.tableContainer,children:[t("div",me?{className:`header-container ${Fo.headerContainer}`,children:[t(Oo,{type:"secondary",className:"selected-text",children:[t("div",{children:[me," ",O("selected")]}),e(L,{title:fe?O("Deselected"):null,children:e(D,{className:Fo.buttonDeselected,icon:e(si,{size:16,strokeWidth:xe}),onClick:()=>ne&&ne(new Set),children:O("Deselected")})})]}),t(N,{children:[_e&&!1!==(null==ve?void 0:ve.enableEdit)&&e(L,{title:fe?O("Edit"):null,children:e(D,{icon:e(Xr,{size:16,strokeWidth:xe}),onClick:()=>{A(be)},disabled:!_e,children:O("Edit")})}),Array.from(b).every(e=>{const t=r.find(t=>t.id===e);return!!t&&(t.isFolder?!1!==(null==ve?void 0:ve.enableMoveFolder):!1!==(null==ve?void 0:ve.enableMoveItem))})&&e(L,{title:fe?O("Move to"):null,children:e(D,{icon:e(Zr,{size:16,strokeWidth:xe}),onClick:k,children:O("Move to")})}),Array.from(b).every(e=>{const t=r.find(t=>t.id===e);return!!t&&(t.isFolder?!1!==(null==ve?void 0:ve.enableCopyFolder):!1!==(null==ve?void 0:ve.enableCopyItem))})&&e(L,{title:fe?O("Copy"):null,children:e(D,{icon:e(Yr,{size:16,strokeWidth:xe}),onClick:S,children:O("Copy")})}),1===me&&we&&e(L,{title:fe?O("Rename"):null,children:e(D,{icon:e(ui,{size:16,strokeWidth:xe}),onClick:()=>C(),disabled:1!==me||!we,children:O("Rename")})}),!1!==(null==ve?void 0:ve.enableDelete)&&e(L,{title:fe?O("Delete"):null,children:e(D,{danger:!0,icon:e(di,{size:16,strokeWidth:xe}),onClick:e=>{e.stopPropagation(),e.preventDefault(),_()},children:O("Delete")})})]})]}:{className:Fo.headerContainer,children:[e("div",{className:"search-container",children:e(Bi,{placeholder:O("Search file or folder"),onSearch:l,className:Fo.searchInput})}),t("div",{className:Fo.actionsBox,children:[e("div",{className:"sort-container",children:t(M,{value:Se,onChange:p,className:Fo.sortSelect,popupMatchSelectWidth:!1,suffixIcon:e(qr,{size:16,strokeWidth:xe}),children:[e(Po,{value:"date-desc",children:O("Newest first")}),e(Po,{value:"date-asc",children:O("Oldest first")}),e(Po,{value:"size-desc",children:O("Largest first")}),e(Po,{value:"size-asc",children:O("Smallest first")}),e(Po,{value:"name-asc",children:O("A-Z")}),e(Po,{value:"name-desc",children:O("Z-A")}),e(Po,{value:"type-asc",children:O("By type")})]})}),e("div",{className:Fo.actionsContainer,children:e(z,{options:[{value:"grid",icon:e(ti,{size:16,strokeWidth:xe})},{value:"table",icon:e(ii,{size:20,strokeWidth:xe})}],value:oe,onChange:e=>ae(e)})})]})]}),s&&!r.length?e(Eo,{}):De,!ee&&g.total>g.pageSize&&e("div",{className:Fo.paginationContainer,children:e(B,{current:g.current,pageSize:g.pageSize,total:g.total,onChange:(e,t)=>m({current:e,pageSize:t,total:g.total}),showSizeChanger:!0,showTotal:e=>O("total pages",{total:e})})})]}):ze]})})};var Ro="folderTree",Lo="emptyFolderContainer",jo="folderItemContainer",Do="folderLabel",No="folderLabelItem",zo="fileCount",Bo="foldersTitle",Uo="foldersTitleItem",Vo="folderMenu";const $o=({selectedFolder:n,onSelect:r,onExpand:i,generateMenuItems:s,fetchChildFolders:l,disabledFolders:u=[],showFileCounts:h=!1,folderFileCounts:f={},className:p="",expandedKeys:g,setExpandedKeys:m,showTrashFolder:v=!1,mode:y="navigation",defaultExpandAll:b=!1})=>{const{t:w}=$n(),{options:x}=yi(),{config:C}=x,{ExpandArrowIcon:_,CollapseArrowIcon:S,CollapseFolderIcon:k,ExpandFolderIcon:A,EmptyFolderIcon:E}=Co(),I=c(e=>{const t=[],n=e=>{e.forEach(e=>{t.push(e.key),e.children&&n(e.children)})};return n(e),t},[]),[T,F]=o(()=>{if(b||"selection"===y&&b){const e=s();return I(e)}return[]}),O=void 0!==g?g:T,P=void 0!==m?m:F;a(()=>{if(b||"selection"===y&&b){const e=s(),t=I(e);void 0===g&&F(t)}},[b,y,s,I,g]);const M=c(async e=>{const t=e[0];t&&"empty"!==t&&!t.endsWith("_input")&&(null==r||r(e),await(null==l?void 0:l("folders"===t?null:t)))},[r,l]),R=c(async(e,t)=>{var n;P(e),null==i||i(e,t);if(!("lazy"===(null==C?void 0:C.folderTreeLoading)))return;const r=(null===(n=null==t?void 0:t.node)||void 0===n?void 0:n.key)||void 0;if(r&&"folders"!==r)try{await(null==l?void 0:l(r))}catch(e){console.warn("Failed to load child folders for",r,e)}},[null==C?void 0:C.folderTreeLoading,l,i,P]),L=c(()=>{var r,i;const o=s(),a=e=>e.filter(e=>"Trash"!==e.key).map(e=>Object.assign(Object.assign({},e),{children:e.children?a(e.children):void 0})),l=v?a(o):o,c=e=>{"selection"!==y?(O.includes(e)&&n===e?P(O.filter(t=>t!==e)):O.includes(e)||P([...O,e]),M([e])):M([e])},d=0===l.length||1===l.length&&(!l[0].children||0===l[0].children.length),p=n=>{var r;const i=h&&f[n.key]||0,o=O.includes(n.key),a=u.includes(n.key),s=(()=>{var t;return(null===(t=n.children)||void 0===t?void 0:t.length)?e(o?k:A,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}):e(E,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth})})(),l=t("div",{className:`${jo} folder-item-container`,onClick:()=>!a&&c(n.key),style:{opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},children:[t("div",{className:Do,children:[n.icon||s,e("span",{className:No,children:n.label})]}),h&&e("div",{className:zo,title:`${i} ${1===i?"file":"files"}`,children:i})]});return{key:n.key,title:l,children:null===(r=n.children)||void 0===r?void 0:r.map(p),disabled:a}},g=O.includes("folders"),m=e("div",{className:Bo,onClick:()=>c("folders"),children:t("div",{className:Uo,children:[e(g?k:A,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:`${No} folder-label-item`,children:"folders"===(null===(r=l[0])||void 0===r?void 0:r.key)?l[0].label:w("Folders")})]})}),b=()=>({key:"Trash",title:e("div",{className:Bo,onClick:()=>c("Trash"),children:t("div",{className:Uo,children:[e(di,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:No,children:w("Trash")})]})}),children:void 0});if(d){if(!v)return[{key:"empty",title:e("div",{className:Lo,children:w("No folders yet")}),disabled:!0}];const t=[];return l.length>0&&"folders"===l[0].key&&t.push({key:"folders",title:m,children:[]}),t.push(b()),t}if(l.length>0&&"folders"===l[0].key){const e=[{key:"folders",title:m,children:null===(i=l[0].children)||void 0===i?void 0:i.map(p)}];return v&&e.push(b()),e}return l.map(p)},[s,O,k,null==C?void 0:C.iconStrokeWidth,A,w,n,M,h,f,E,u,v,y,P]),j=d(()=>L(),[L]);return e(q,{className:`${Ro} ${Vo} ${p}`,selectedKeys:n?[n]:[],expandedKeys:O,onSelect:M,onExpand:R,treeData:j,switcherIcon:({expanded:t})=>e(t?S:_,{}),showLine:!1})};var Wo={formFooter:"formFooter",folderButton:"folderButton",foldersWrapper:"foldersWrapper",formItem:"formItem",folderToolsField:"folderToolsField",closeIcon:"closeIcon"};const Ho=f(({folderId:r,activeFormField:i,EmptyFolderIcon:o,targetForm:a,handleModalOk:s,onComplete:l,t:u,setIsLoading:d})=>{const h=c(()=>{a.setFieldsValue({folderName:""})},[a]),f=c(()=>{d(!0),s(a).then(e=>{l(null==e?void 0:e.id)}).finally(()=>d(!1))},[s,a,l,d]);return e(T.Item,{className:"form-item form-item-moveto "+(i===r?"form-item_active":""),name:"folderName",initialValue:u("New folder"),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(u("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{className:"form-input",autoFocus:!0,prefix:e(o,{style:{marginRight:6}}),suffix:t(n,{children:[e(L,{placement:"top",title:"Clean",children:e(D,{icon:e(ve,{style:{fontSize:10}}),className:Wo.inputButtonClose,type:"text",onClick:h})}),e(D,{className:Wo.inputButtonOk,type:"text",onClick:()=>{d(!0),f()},children:"Создать"})]})})})});Ho.displayName="CustomFolderInput";const qo=({isModalVisible:r,handleModalOk:i,handleModalCancel:s,form:l,selectedFolder:u,folders:h,isUrlModalVisible:f,setIsUrlModalVisible:p,handleAddFileByUrl:g,urlForm:m,isRenameModalVisible:v,handleRenameOk:y,handleRenameCancel:b,renameForm:w,fileToRename:x,files:C,isMoveModalVisible:_,handleMoveOk:S,handleMoveCancel:k,moveForm:A,selectedFiles:E,isRenameFolderModalVisible:I,handleRenameFolderOk:O,handleRenameFolderCancel:P,renameFolderForm:M,folderToRename:R,isCopyModalVisible:L,handleCopyOk:j,handleCopyCancel:N,copyForm:z,isDeleteConfirmVisible:B,handleDeleteConfirmOk:U,handleDeleteConfirmCancel:V,fetchChildFolders:$})=>{var W,H,q;const{t:Y}=$n(),{state:X,actions:K,options:Z}=yi(),{setCurrentMenuFile:J}=K,{config:Q}=Z,{currentMenuFile:ee}=X,te=T.useWatch("folderName",l),{EmptyFolderIcon:ne}=Co(),[re,ie]=o(""),[oe,ae]=o(!1),se=!te||0===String(te).trim().length,le=d(()=>Array.isArray(C)?C:[],[C]),ce=x?null===(W=le.find(e=>e.id===x))||void 0===W?void 0:W.name:"",ue=Array.isArray(h)?h:[],de=R?null===(H=ue.find(e=>e.id===R))||void 0===H?void 0:H.name:"";a(()=>{if(B){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)}},[B]);const he=x?le.find(e=>e.id===x):null,fe=(null==he?void 0:he.isFolder)||(null==x?void 0:x.startsWith("folder_")),pe=c(async e=>{e.length>0&&(A.setFieldsValue({targetFolder:e[0]}),re!==e[0].toString()&&ie(""))},[A,re]),ge=c(async e=>{e.length>0&&(z.setFieldsValue({targetFolder:e[0]}),re!==e[0].toString()&&ie(""))},[re,z]),me=d(()=>Array.from(E).filter(e=>{const t=le.find(t=>t.id===e);return(null==t?void 0:t.isFolder)||h.some(t=>t.id===e)}),[E,le,h]),ye=c((t,n)=>{const r=r=>e(Ho,{folderId:r,activeFormField:re,EmptyFolderIcon:ne,targetForm:t,handleModalOk:i,onComplete:n,setIsLoading:ae,t:Y},r);return r.displayName="CustomInputComponent",r},[ne,re,i,Y]),be=c(e=>{const{folderId:t,targetForm:n,onTreeSelect:r,onComplete:i}=e;return{handleAddFolder:e=>{e.preventDefault(),e.stopPropagation(),ie(t),n.setFieldsValue({folderName:Y("New folder"),targetFolder:t})},handleSelectFolder:e=>{e.preventDefault(),e.stopPropagation(),r([t]).then(()=>i(t))}}},[Y]),we=c(r=>{const{targetForm:i,onTreeSelect:o,onComplete:a,actionButtonText:s}=r,l=ye(i,a),c=(r=null,d=new Set)=>h.filter(e=>{if("Trash"===e.id)return!1;const t=null===r&&!e.parentId,n=e.parentId===r;return t||n}).map(r=>{if(d.has(r.id))return{key:r.id,label:`${r.name} ${Y("(circular reference)")}`};const h=new Set(d);h.add(r.id);const f=c(r.id,h),{handleAddFolder:p,handleSelectFolder:g}=be({folderId:r.id,targetForm:i,onTreeSelect:o,onComplete:a}),m=re===r.id?[{key:`${r.id}_input`,label:l(r.id),icon:null},...f]:f;return{key:r.id,label:t(n,{children:[r.name,u!==r.id&&t("div",{className:`${Wo.folderToolsField} folder-tools-field`,children:[e(D,{onClick:p,children:"+"}),e(D,{onClick:g,children:s})]})]}),children:m}}),d=c();console.log("treeNodes",d);const{handleAddFolder:f,handleSelectFolder:p}=be({folderId:"folders",targetForm:i,onTreeSelect:o,onComplete:a}),g="folders"===re?[{key:"folders_input",label:l("folders"),icon:null},...d]:d;return[{key:"folders",label:t(n,{children:[Y("Folders"),"folders"!==u&&t("div",{className:`${Wo.folderToolsField} folder-tools-field`,children:[e(D,{onClick:f,children:"+"}),e(D,{onClick:p,children:s})]})]}),children:g}]},[Y,u,re,h,ye,be]);return t(n,{children:[e(G,{title:e("div",{className:"modal-title",children:Y("Creating a new folder")}),open:r,onOk:()=>i(),onCancel:s,okText:Y("Create"),cancelText:Y("Cancel"),okButtonProps:{disabled:se,loading:oe},cancelButtonProps:{disabled:oe},afterClose:()=>ae(!1),children:t(T,{form:l,layout:"vertical",children:[e(T.Item,{name:"folderName",label:e("div",{className:"form-label",children:Y("Folder name")}),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Y("Enter the name of the folder"))):Promise.resolve()}],initialValue:Y("New folder"),className:"form-item",style:{marginBottom:5},children:e(F,{autoFocus:!0,className:"form-input",disabled:oe,onPressEnter:async()=>{ae(!0);try{await l.validateFields(),se||await i()}catch(e){console.warn("Validation failed"),ae(!1)}}})}),e("div",{children:u&&"folders"!==u?t("p",{className:"fm-note",children:[Y("A folder will be created inside:")," ",(null===(q=ue.find(e=>e.id===u))||void 0===q?void 0:q.name)||Y("selected folder"),"."]}):e("p",{className:"fm-note",children:Y("The folder will be created in the root directory.")})})]})}),e(G,{title:e("div",{className:"modal-title",children:Y("Upload file by URL")}),open:f,onOk:async()=>{ae(!0);try{await m.validateFields();await g(null)||ae(!1)}catch(e){console.warn("Validation failed"),ae(!1)}},onCancel:()=>p(!1),okText:Y("Download"),okButtonProps:{loading:oe},cancelText:Y("Cancel"),cancelButtonProps:{disabled:oe},afterClose:()=>ae(!1),children:e(T,{form:m,layout:"vertical",children:e(T.Item,{name:"fileUrl",label:e("div",{className:"form-label",children:Y("File URL")}),rules:[{required:!0,message:Y("Enter the URL of the image")}],className:"form-item",children:e(F,{className:"form-input",placeholder:"https://example.com/image.jpg",autoFocus:!0,disabled:oe,onPressEnter:async()=>{ae(!0);try{await m.validateFields();await g(null)||ae(!1)}catch(e){console.warn("Validation failed"),ae(!1)}}})})})}),e(G,{title:e("div",{className:"modal-title",children:fe?`${Y("Rename folder")} ${ce}`:Y("Rename file",{currentFileName:ce})}),open:v,onOk:y,okText:Y("Rename"),okButtonProps:{loading:oe},onCancel:b,cancelText:Y("Cancel"),cancelButtonProps:{disabled:oe},afterClose:()=>{ae(!1),J&&J("")},children:e(T,{form:w,layout:"vertical",children:e(T.Item,{name:"newFileName",label:e("div",{className:"form-label",children:Y(fe?"New folder name":"New file name")}),rules:[{required:!0,message:Y(fe?"Enter a new folder name":"Enter a new file name")}],className:"form-item",children:e(F,{autoFocus:!0,className:"form-input",disabled:oe,onPressEnter:async()=>{ae(!0);try{await w.validateFields(),y()}catch(e){console.warn("Validation failed"),ae(!1)}}})})})}),e(G,{title:e("div",{className:"modal-title",children:Y("Move to")}),open:_,onCancel:k,footer:t("div",{className:Wo.formFooter,children:[t(D,{className:Wo.folderButton,onClick:()=>{A.setFieldsValue({targetFolder:"folders",folderName:Y("New folder"),is_force_create:!0}),setTimeout(()=>{ae(!0),i(A).then(e=>{S(null==e?void 0:e.id)}).finally(()=>ae(!1))},0)},loading:oe,children:[e(Qr,{size:18,strokeWidth:null==Q?void 0:Q.iconStrokeWidth}),Y("Create folder")]}),e(D,{type:"primary",className:Wo.folderButton,onClick:k,loading:oe,children:Y("Done")})]}),afterClose:()=>{J&&J(""),ie(""),ae(!1)},loading:oe,children:e(T,{form:A,layout:"vertical",initialValues:{targetFolder:"folders",folderName:Y("New folder"),is_force_create:!1},children:t("div",{className:Wo.foldersWrapper,children:[e(T.Item,{name:"targetFolder",rules:[{required:!0,message:Y("Select the destination folder")}],className:Wo.formItem,children:e($o,{onSelect:pe,generateMenuItems:()=>we({targetForm:A,onTreeSelect:pe,onComplete:S,actionButtonText:Y("Move here")}),fetchChildFolders:$,disabledFolders:me,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(T.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Y("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{})}),e(T.Item,{name:"is_force_create",style:{display:"none"},children:e(F,{})})]})})}),e(G,{title:e("div",{className:"modal-title",children:Y("Copy to folder")}),open:L,onCancel:N,footer:t("div",{className:Wo.formFooter,children:[t(D,{className:Wo.folderButton,onClick:()=>{z.setFieldsValue({targetFolder:"folders",folderName:Y("New folder"),is_force_create:!0}),setTimeout(()=>{ae(!0),i(z).then(e=>{j(null==e?void 0:e.id)}).finally(()=>ae(!1))},0)},loading:oe,children:[e(Qr,{size:18,strokeWidth:null==Q?void 0:Q.iconStrokeWidth}),Y("Create folder")]}),e(D,{type:"primary",className:Wo.folderButton,onClick:N,loading:oe,children:Y("Done")})]}),afterClose:()=>{J&&J(""),ie(""),ae(!1)},loading:oe,children:e(T,{form:z,layout:"vertical",initialValues:{targetFolder:"folders",folderName:Y("New folder"),is_force_create:!1},children:t("div",{className:Wo.foldersWrapper,children:[e(T.Item,{name:"targetFolder",rules:[{required:!0,message:Y("Select the destination folder")}],className:Wo.formItem,children:e($o,{onSelect:ge,generateMenuItems:()=>we({targetForm:z,onTreeSelect:ge,onComplete:j,actionButtonText:Y("Copy here")}),fetchChildFolders:$,disabledFolders:me,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(T.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Y("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{})}),e(T.Item,{name:"is_force_create",style:{display:"none"},children:e(F,{})})]})})}),e(G,{title:t("div",{className:"modal-title",children:[Y("Rename folder")," ",de]}),open:I,onOk:O,onCancel:P,okText:Y("Rename"),cancelText:Y("Cancel"),okButtonProps:{loading:oe},cancelButtonProps:{disabled:oe},afterClose:()=>{ae(!1),J&&J("")},children:e(T,{form:M,layout:"vertical",children:e(T.Item,{name:"newFolderName",label:e("div",{className:"form-label",children:Y("New folder name")}),rules:[{required:!0,message:Y("Enter a new folder name")}],className:"form-item",children:e(F,{autoFocus:!0,className:"form-input",disabled:oe,onPressEnter:async()=>{ae(!0);try{await M.validateFields(),O()}catch(e){console.warn("Validation failed"),ae(!1)}}})})})}),e(G,{className:`${Wo.deleteModal} deleteModal`,title:(()=>{const t=!!(null==Q?void 0:Q.enableTrashFolder)&&"Trash"===u||!(null==Q?void 0:Q.enableTrashFolder),n=Y(t?"Permanently delete":"Move to Trash");return e("div",{className:"modal-title",children:n})})(),open:!!B,onOk:()=>{ae(!0);try{U&&U()}catch(e){console.error(e),ae(!1)}},onCancel:()=>V&&V(),okText:(null==Q?void 0:Q.enableTrashFolder)&&"Trash"===u?Y("Delete permanently"):(null==Q?void 0:Q.enableTrashFolder)?Y("Move to Trash"):Y("Delete"),cancelText:Y("Cancel"),okButtonProps:{danger:!(null==Q?void 0:Q.enableTrashFolder)||"Trash"===u,loading:oe},cancelButtonProps:{disabled:oe},afterClose:()=>{ae(!1),J&&J("")},closeIcon:e(ve,{className:Wo.closeIcon}),children:(()=>{var t,n;const r=(ee?[ee]:Array.from(E||[])).map(e=>le.find(t=>t.id===e)).filter(e=>!!e),i=r.filter(e=>e.isFolder||e.id.startsWith("folder_")),o=r.filter(e=>!(e.isFolder||e.id.startsWith("folder_"))),a=r.length,s=i.length,l=o.length,c=!!(null==Q?void 0:Q.enableTrashFolder);if(!c||c&&"Trash"===u){if(1===a&&1===s){const n=i[0],r=(null==n?void 0:n.name)||"",o=null!==(t=null==n?void 0:n.childCount)&&void 0!==t?t:0;return e("div",{children:Y("delete_folder_permanent",{name:r,count:o})})}return e("div",0===s&&l>0?{children:Y("delete_files_permanent",{count:l})}:{children:Y("delete_mixed_permanent",{total:a,folders:s,images:l})})}if(1===a&&1===s){const t=i[0],r=(null==t?void 0:t.name)||"",o=null!==(n=null==t?void 0:t.childCount)&&void 0!==n?n:0;return e("div",{children:Y("move_folder_to_trash",{name:r,count:o})})}return e("div",0===s&&l>0?{children:Y("move_files_to_trash",{count:l})}:{children:Y("move_mixed_to_trash",{total:a,folders:s,images:l})})})()})]})};var Go={button:"button",folderActions:"folderActions",uploadButton:"uploadButton",foldersContainer:"foldersContainer",buttonWrapper:"buttonWrapper",uploadButtonTitle:"uploadButtonTitle"};const Yo=f(p(({selectedFolder:n,generateMenuItems:r,onFolderSelect:i,folders:s,fetchChildFolders:l,handleAddFile:h,setIsUrlModalVisible:f,handleCreateFolder:p,activeLibraryItem:m,setActiveLibraryItem:v},y)=>{const b=d(()=>Array.isArray(s)?s:[],[s]),{t:w}=$n(),x=_i(),[C,_]=o({}),{options:S}=yi(),{dataProviders:k,config:A}=S,E=c(e=>{const t=[],n=e=>{e.forEach(e=>{t.push(e.key),e.children&&n(e.children)})};return n(e),t},[]),[I,T]=o(()=>{if(!0===(null==A?void 0:A.expandAllFoldersOnInit)&&"lazy"!==(null==A?void 0:A.folderTreeLoading)){const e=r();return E(e)}return!0===(null==A?void 0:A.expandRootFolderOnInit)?["folders"]:[]}),F=u(!1),O=u(!1);a(()=>{if(F.current)return;"lazy"===(null==A?void 0:A.folderTreeLoading)&&!0===(null==A?void 0:A.expandRootFolderOnInit)&&(F.current=!0,(async()=>{try{await(null==l?void 0:l(null))}catch(e){console.warn("Не удалось подгрузить дочерние папки корня при инициализации",e)}})())},[null==A?void 0:A.folderTreeLoading,null==A?void 0:A.expandRootFolderOnInit,l]),a(()=>{!0===(null==A?void 0:A.expandRootFolderOnInit)&&Array.isArray(b)&&b.length>0&&(O.current||I&&0!==I.length||(O.current=!0,T(["folders"])))},[null==A?void 0:A.expandRootFolderOnInit,b,I]),a(()=>{if(!0===(null==A?void 0:A.expandAllFoldersOnInit)&&"lazy"!==(null==A?void 0:A.folderTreeLoading)){const e=r(),t=E(e);return void T(t)}!0===(null==A?void 0:A.expandRootFolderOnInit)&&T(e=>e&&e.length>0?[...e]:["folders"])},[b,r,E,null==A?void 0:A.expandAllFoldersOnInit,null==A?void 0:A.folderTreeLoading,null==A?void 0:A.expandRootFolderOnInit]);const P=c(async e=>{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:t,pagination:n}=await k.getFiles({folderId:"folders"===e?void 0:e,itemType:"all"});return(null==n?void 0:n.total)||t.filter(e=>!e.isFolder).length}return 0}catch(t){return console.error(`Ошибка при получении количества файлов для папки ${e}:`,t),x.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:w("Failed to load folder items count"),placement:"bottomRight",innerException:t,data:{folderId:"folders"===e?null:e,reason:t instanceof Error?t.message:String(t)}}),0}},[k,x,w]),M=c(async()=>{if(0===b.length)return;const e={};e.folders=await P("folders");const t=b.map(async t=>{const n=await P(t.id);e[t.id]=n});await Promise.all(t),_(e)},[b,P]),R=c(async e=>{const t=await P(e);_(n=>Object.assign(Object.assign({},n),{[e]:t}))},[P]);g(y,()=>({refreshFileCounts:M}),[M]),a(()=>{M()},[M]),a(()=>{if(!n||"folders"===n)return;const e=(t,n=new Set)=>{if(n.has(t))return console.warn(`Обнаружен цикл в пути к папке с id=${t}`),[];const r=b.find(e=>e.id===t);if(!r)return[];if(!r.parentId)return[];const i=new Set(n);i.add(t);return[...e(r.parentId,i),r.parentId]},t=e(n);t.length>0?T(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n.add("folders"),Array.from(n)}):T(e=>e.includes("folders")?e:[...e,"folders"])},[n,b]);const L=c(async()=>{await h(),n?await R(n):await R("folders")},[h,n,R]),j=[{key:Qt,label:w("My files"),icon:e(ni,{size:20,strokeWidth:null==A?void 0:A.iconStrokeWidth})},{key:en,label:w("GIF"),icon:e(oi,{size:20,strokeWidth:null==A?void 0:A.iconStrokeWidth})},{key:tn,label:w("Stock images"),icon:e(Gr,{size:20,strokeWidth:null==A?void 0:A.iconStrokeWidth})},{key:nn,label:w("AI"),icon:e(ci,{size:20,strokeWidth:null==A?void 0:A.iconStrokeWidth}),disabled:!(null==A?void 0:A.sseQuery)}],N=c(async e=>{const t=e[0];t&&"empty"!==t&&(m!==Qt&&v(Qt),null==i||i(t),await(null==l?void 0:l(t)))},[i,m,v,l]),z=c(({key:e})=>{console.warn("key",e),v(e)},[v]),B=c(async(e,t)=>{var n;T(e);if(!("lazy"===(null==A?void 0:A.folderTreeLoading)))return;const r=(null===(n=null==t?void 0:t.node)||void 0===n?void 0:n.key)||void 0;if(r&&"folders"!==r)try{await(null==l?void 0:l(r))}catch(e){console.warn("Не удалось подгрузить дочерние папки для",r,e),x.error({id:"FOLDER_CHILDREN_FETCH_FAILED",message:w("Failed to load subfolders"),placement:"bottomRight",innerException:e,data:{folderId:r,reason:e instanceof Error?e.message:String(e)}})}},[null==A?void 0:A.folderTreeLoading,l,x,w]);return t("div",{className:"sidebar-container",children:[t("div",{className:Go.buttonWrapper,children:[e(D,{type:"primary",size:"large",icon:e(ai,{size:24,strokeWidth:null==A?void 0:A.iconStrokeWidth}),onClick:L,className:Go.uploadButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===n,children:e("span",{className:Go.uploadButtonTitle,children:w("Upload file")})}),e(D,{type:"primary",size:"large",icon:e(ri,{size:24,strokeWidth:null==A?void 0:A.iconStrokeWidth}),onClick:()=>null==f?void 0:f(!0),className:Go.uploadByURLButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===n})]}),e(Y,{className:"folder-menu",items:j,defaultSelectedKeys:[Qt],onSelect:({key:e})=>z({key:e}),selectedKeys:[m]}),e(X,{className:Go.divider}),t("div",{className:Go.foldersContainer,children:[e($o,{selectedFolder:n,onSelect:N,onExpand:B,generateMenuItems:r,fetchChildFolders:l,showFileCounts:!0,folderFileCounts:C,expandedKeys:I,setExpandedKeys:T,showTrashFolder:null==A?void 0:A.enableTrashFolder}),e("div",{className:Go.folderActions,children:e(D,{onClick:e=>{e.stopPropagation(),p()},className:Go.button,icon:e(Qr,{size:18,strokeWidth:null==A?void 0:A.iconStrokeWidth}),size:"middle"})})]})]})}));Yo.displayName="FolderSidebar";var Xo=Object.defineProperty,Ko=(e,t,n)=>(((e,t,n)=>{t in e?Xo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Zo(e,t){return void 0===t&&(t=15),+parseFloat(Number(e).toPrecision(t))}function Jo(e){var t=e.toString().split(/[eE]/),n=(t[0].split(".")[1]||"").length-+(t[1]||0);return n>0?n:0}function Qo(e){if(-1===e.toString().indexOf("e"))return Number(e.toString().replace(".",""));var t=Jo(e);return t>0?Zo(Number(e)*Math.pow(10,t)):Number(e)}function ea(e){aa&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&console.warn(e+" is beyond boundary when transfer to integer, the results may not be accurate")}function ta(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0];return t.slice(1).reduce(function(t,n){return e(t,n)},r)}}var na=ta(function(e,t){var n=Qo(e),r=Qo(t),i=Jo(e)+Jo(t),o=n*r;return ea(o),o/Math.pow(10,i)}),ra=ta(function(e,t){var n=Math.pow(10,Math.max(Jo(e),Jo(t)));return(na(e,n)+na(t,n))/n}),ia=ta(function(e,t){var n=Math.pow(10,Math.max(Jo(e),Jo(t)));return(na(e,n)-na(t,n))/n}),oa=ta(function(e,t){var n=Qo(e),r=Qo(t);return ea(n),ea(r),na(n/r,Zo(Math.pow(10,Jo(t)-Jo(e))))});var aa=!0;var sa={strip:Zo,plus:ra,minus:ia,times:na,divide:oa,round:function(e,t){var n=Math.pow(10,t),r=oa(Math.round(Math.abs(na(e,n))),n);return e<0&&0!==r&&(r=na(r,-1)),r},digitLength:Jo,float2Fixed:Qo,enableBoundaryChecking:function(e){void 0===e&&(e=!0),aa=e}};const la=Object.prototype.toString;function ca(e){switch(la.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return ba(e,Error)}}function ua(e,t){return la.call(e)===`[object ${t}]`}function da(e){return ua(e,"ErrorEvent")}function ha(e){return ua(e,"DOMError")}function fa(e){return ua(e,"String")}function pa(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function ga(e){return null===e||pa(e)||"object"!=typeof e&&"function"!=typeof e}function ma(e){return ua(e,"Object")}function va(e){return typeof Event<"u"&&ba(e,Event)}function ya(e){return!(!e||!e.then||"function"!=typeof e.then)}function ba(e,t){try{return e instanceof t}catch{return!1}}function wa(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}function xa(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Ca(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{wa(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function _a(e,t,n=!1){return!!fa(e)&&(function(e){return ua(e,"RegExp")}(t)?t.test(e):!!fa(t)&&(n?e===t:e.includes(t)))}function Sa(e,t=[],n=!1){return t.some(t=>_a(e,t,n))}function ka(e,t,n=250,r,i,o,a){if(!(o.exception&&o.exception.values&&a&&ba(a.originalException,Error)))return;const s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=function(e,t){return e.map(e=>(e.value&&(e.value=xa(e.value,t)),e))}(Aa(e,t,i,a.originalException,r,o.exception.values,s,0),n))}function Aa(e,t,n,r,i,o,a,s){if(o.length>=n+1)return o;let l=[...o];if(ba(r[i],Error)){Ea(a,s);const o=e(t,r[i]),c=l.length;Ia(o,i,c,s),l=Aa(e,t,n,r[i],i,[o,...l],o,c)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(ba(r,Error)){Ea(a,s);const c=e(t,r),u=l.length;Ia(c,`errors[${o}]`,u,s),l=Aa(e,t,n,r,i,[c,...l],c,u)}}),l}function Ea(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function Ia(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Ta(e){return e&&e.Math==Math?e:void 0}const Fa="object"==typeof globalThis&&Ta(globalThis)||"object"==typeof window&&Ta(window)||"object"==typeof self&&Ta(self)||"object"==typeof global&&Ta(global)||function(){return this}()||{};function Oa(){return Fa}function Pa(e,t,n){const r=n||Fa,i=r.__SENTRY__=r.__SENTRY__||{};return i[e]||(i[e]=t())}const Ma=Oa();function Ra(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,a=0;const s=" > ",l=s.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(c=La(n,u),!("html"===c||o>1&&a+i.length*l+c.length>=d));)i.push(c),a+=c.length,n=n.parentNode;return i.reverse().join(s)}catch{return"<unknown>"}}function La(e,t){const n=e,r=[];let i,o,a,s,l;if(!n||!n.tagName)return"";if(Ma.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());const c=t&&t.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(c&&c.length)c.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&fa(i))for(o=i.split(/\s+/),l=0;l<o.length;l++)r.push(`.${o[l]}`);const u=["aria-label","type","name","title","alt"];for(l=0;l<u.length;l++)a=u[l],s=n.getAttribute(a),s&&r.push(`[${a}="${s}"]`);return r.join("")}const ja=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Da=["debug","info","warn","error","log","assert","trace"],Na={};function za(e){if(!("console"in Fa))return e();const t=Fa.console,n={},r=Object.keys(Na);r.forEach(e=>{const r=Na[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}const Ba=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return ja?Da.forEach(n=>{t[n]=(...t)=>{e&&za(()=>{Fa.console[n](`Sentry Logger [${n}]:`,...t)})}}):Da.forEach(e=>{t[e]=()=>{}}),t}(),Ua=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Va(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${a}`}function $a(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Wa(e){const t="string"==typeof e?function(e){const t=Ua.exec(e);if(!t)return void za(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});const[n,r,i="",o,a="",s]=t.slice(1);let l="",c=s;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return $a({host:o,pass:i,path:l,projectId:c,port:a,protocol:n,publicKey:r})}(e):$a(e);if(t&&function(e){if(!ja)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(Ba.error(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Ba.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Ba.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Ba.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}class Ha extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}}function qa(e,t,n){if(!(t in e))return;const r=e[t],i=n(r);"function"==typeof i&&Ya(i,r),e[t]=i}function Ga(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{ja&&Ba.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ya(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Ga(e,"__sentry_original__",t)}catch{}}function Xa(e){return e.__sentry_original__}function Ka(e){if(ca(e))return{message:e.message,name:e.name,stack:e.stack,...Ja(e)};if(va(e)){const t={type:e.type,target:Za(e.target),currentTarget:Za(e.currentTarget),...Ja(e)};return typeof CustomEvent<"u"&&ba(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Za(e){try{return function(e){return typeof Element<"u"&&ba(e,Element)}(e)?Ra(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Ja(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function Qa(e){return es(e,new Map)}function es(e,t){if(function(e){if(!ma(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch{return!0}}(e)){const n=t.get(e);if(void 0!==n)return n;const r={};t.set(e,r);for(const n of Object.keys(e))typeof e[n]<"u"&&(r[n]=es(e[n],t));return r}if(Array.isArray(e)){const n=t.get(e);if(void 0!==n)return n;const r=[];return t.set(e,r),e.forEach(e=>{r.push(es(e,t))}),r}return e}const ts=/\(error: (.*)\)/,ns=/captureMessage|captureException/;function rs(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0)=>{const r=[],i=e.split("\n");for(let e=n;e<i.length;e++){const n=i[e];if(n.length>1024)continue;const o=ts.test(n)?n.replace(ts,"$1"):n;if(!o.match(/\S*Error: /)){for(const e of t){const t=e(o);if(t){r.push(t);break}}if(r.length>=50)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),ns.test(t[t.length-1].function||"")&&(t.pop(),ns.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||t[t.length-1].filename,function:e.function||"?"}))}(r)}}function is(e){return Array.isArray(e)?rs(...e):e}const os="<anonymous>";function as(e){try{return e&&"function"==typeof e&&e.name||os}catch{return os}}const ss={},ls={};function cs(e,t){ss[e]=ss[e]||[],ss[e].push(t)}function us(e,t){ls[e]||(t(),ls[e]=!0)}function ds(e,t){const n=e&&ss[e];if(n)for(const r of n)try{r(t)}catch(t){ja&&Ba.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${as(r)}\nError:`,t)}}function hs(){"console"in Fa&&Da.forEach(function(e){e in Fa.console&&qa(Fa.console,e,function(t){return Na[e]=t,function(...t){ds("console",{args:t,level:e});const n=Na[e];n&&n.apply(Fa.console,t)}})})}function fs(){const e=Fa,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,e=>(e^(15&n())>>e/4).toString(16))}function ps(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function gs(e){const{message:t,event_id:n}=e;if(t)return t;const r=ps(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ms(e,t,n){const r=e.exception=e.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type="Error")}function vs(e,t){const n=ps(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r&&r.data,...t.data};n.mechanism.data=e}}function ys(e){if(e&&e.__sentry_captured__)return!0;try{Ga(e,"__sentry_captured__",!0)}catch{}return!1}function bs(e){return Array.isArray(e)?e:[e]}const ws=Fa;let xs,Cs,_s;function Ss(){if(!ws.document)return;const e=ds.bind(null,"dom"),t=ks(e,!0);ws.document.addEventListener("click",t,!1),ws.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=ws[t]&&ws[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(qa(n,"addEventListener",function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this,o=r.__sentry_instrumentation_handlers__=r.__sentry_instrumentation_handlers__||{},a=o[n]=o[n]||{refCount:0};if(!a.handler){const r=ks(e);a.handler=r,t.call(this,n,r,i)}a.refCount++}catch{}return t.call(this,n,r,i)}}),qa(n,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this,i=n.__sentry_instrumentation_handlers__||{},o=i[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,r),o.handler=void 0,delete i[t]),0===Object.keys(i).length&&delete n.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}}))})}function ks(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return!("keypress"!==e||t&&t.tagName&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))}(n.type,r))return;Ga(n,"_sentryCaptured",!0),r&&!r._sentryId&&Ga(r,"_sentryId",fs());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==Cs)return!1;try{if(!e.target||e.target._sentryId!==_s)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),Cs=n.type,_s=r?r._sentryId:void 0),clearTimeout(xs),xs=ws.setTimeout(()=>{_s=void 0,Cs=void 0},1e3)}}const As=Oa();function Es(){if(!("fetch"in As))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Is(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Ts(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!Es())return!1;if(Is(As.fetch))return!0;let e=!1;const t=As.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=Is(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){ja&&Ba.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e})()&&qa(Fa,"fetch",function(e){return function(...t){const{method:n,url:r}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:Os(t),method:Fs(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:Os(t),method:Fs(t,"method")?String(t.method).toUpperCase():"GET"}}(t),i={args:t,fetchData:{method:n,url:r},startTimestamp:Date.now()};return ds("fetch",{...i}),e.apply(Fa,t).then(e=>(ds("fetch",{...i,endTimestamp:Date.now(),response:e}),e),e=>{throw ds("fetch",{...i,endTimestamp:Date.now(),error:e}),e})}})}function Fs(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Os(e){return"string"==typeof e?e:e?Fs(e,"url")?e.url:e.toString?e.toString():"":""}let Ps=null;function Ms(){Ps=Fa.onerror,Fa.onerror=function(e,t,n,r,i){return ds("error",{column:r,error:i,line:n,msg:e,url:t}),!(!Ps||Ps.__SENTRY_LOADER__)&&Ps.apply(this,arguments)},Fa.onerror.__SENTRY_INSTRUMENTED__=!0}let Rs=null;function Ls(){Rs=Fa.onunhandledrejection,Fa.onunhandledrejection=function(e){return ds("unhandledrejection",e),!(Rs&&!Rs.__SENTRY_LOADER__)||Rs.apply(this,arguments)},Fa.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const js=Oa();const Ds=Fa;let Ns;function zs(e){const t="history";cs(t,e),us(t,Bs)}function Bs(){if(!function(){const e=js.chrome,t=e&&e.app&&e.app.runtime,n="history"in js&&!!js.history.pushState&&!!js.history.replaceState;return!t&&n}())return;const e=Ds.onpopstate;function t(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const e=Ns,t=String(n);Ns=t,ds("history",{from:e,to:t})}return e.apply(this,t)}}Ds.onpopstate=function(...t){const n=Ds.location.href,r=Ns;if(Ns=n,ds("history",{from:r,to:n}),e)try{return e.apply(this,t)}catch{}},qa(Ds.history,"pushState",t),qa(Ds.history,"replaceState",t)}const Us=Fa,Vs="__sentry_xhr_v3__";function $s(){if(!Us.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;qa(e,"open",function(e){return function(...t){const n=Date.now(),r=fa(t[0])?t[0].toUpperCase():void 0,i=function(e){if(fa(e))return e;try{return e.toString()}catch{}}(t[1]);if(!r||!i)return e.apply(this,t);this[Vs]={method:r,url:i,request_headers:{}},"POST"===r&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const e=this[Vs];if(e&&4===this.readyState){try{e.status_code=this.status}catch{}ds("xhr",{args:[r,i],endTimestamp:Date.now(),startTimestamp:n,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?qa(this,"onreadystatechange",function(e){return function(...t){return o(),e.apply(this,t)}}):this.addEventListener("readystatechange",o),qa(this,"setRequestHeader",function(e){return function(...t){const[n,r]=t,i=this[Vs];return i&&fa(n)&&fa(r)&&(i.request_headers[n.toLowerCase()]=r),e.apply(this,t)}}),e.apply(this,t)}}),qa(e,"send",function(e){return function(...t){const n=this[Vs];if(!n)return e.apply(this,t);void 0!==t[0]&&(n.body=t[0]);return ds("xhr",{args:[n.method,n.url],startTimestamp:Date.now(),xhr:this}),e.apply(this,t)}})}function Ws(e,t=100,n=1/0){try{return qs("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Hs(e,t=3,n=102400){const r=Ws(e,t);return function(e){return function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(e))}(r)>n?Hs(e,t-1,n):r}function qs(e,t,n=1/0,r=1/0,i=function(){const e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(n){if(e)return!!t.has(n)||(t.add(n),!1);for(let e=0;e<t.length;e++)if(t[e]===n)return!0;return t.push(n),!1},function(n){if(e)t.delete(n);else for(let e=0;e<t.length;e++)if(t[e]===n){t.splice(e,1);break}}]}()){const[o,a]=i;if(null==t||["number","boolean","string"].includes(typeof t)&&!function(e){return"number"==typeof e&&e!=e}(t))return t;const s=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(wa(t))return"[VueViewModel]";if(function(e){return ma(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}(t))return"[SyntheticEvent]";if("number"==typeof t&&t!=t)return"[NaN]";if("function"==typeof t)return`[Function: ${as(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const n=function(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}(e,t);if(!s.startsWith("[object "))return s;if(t.__sentry_skip_normalization__)return t;const l="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===l)return s.replace("object ","");if(o(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return qs("",c.toJSON(),l-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=Ka(t);for(const e in h){if(!Object.prototype.hasOwnProperty.call(h,e))continue;if(d>=r){u[e]="[MaxProperties ~]";break}const t=h[e];u[e]=qs(e,t,l-1,r,i),d++}return a(t),u}var Gs;function Ys(e){return new Ks(t=>{t(e)})}function Xs(e){return new Ks((t,n)=>{n(e)})}!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(Gs||(Gs={}));class Ks{constructor(e){Ks.prototype.__init.call(this),Ks.prototype.__init2.call(this),Ks.prototype.__init3.call(this),Ks.prototype.__init4.call(this),this._state=Gs.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new Ks((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(e){return new Ks((t,n)=>{let r,i;return this.then(t=>{i=!1,r=t,e&&e()},t=>{i=!0,r=t,e&&e()}).then(()=>{i?n(r):t(r)})})}__init(){this._resolve=e=>{this._setResult(Gs.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Gs.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===Gs.PENDING){if(ya(t))return void t.then(this._resolve,this._reject);this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Gs.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||(this._state===Gs.RESOLVED&&e[1](this._value),this._state===Gs.REJECTED&&e[2](this._value),e[0]=!0)})}}}function Zs(e){const t=[];function n(e){return t.splice(t.indexOf(e),1)[0]}return{$:t,add:function(r){if(!(void 0===e||t.length<e))return Xs(new Ha("Not adding Promise because buffer limit was reached."));const i=r();return-1===t.indexOf(i)&&t.push(i),i.then(()=>n(i)).then(null,()=>n(i).then(null,()=>{})),i},drain:function(e){return new Ks((n,r)=>{let i=t.length;if(!i)return n(!0);const o=setTimeout(()=>{e&&e>0&&n(!1)},e);t.forEach(e=>{Ys(e).then(()=>{--i||(clearTimeout(o),n(!0))},r)})})}}}function Js(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}const Qs=["fatal","error","warning","log","info","debug"];function el(e){return"warn"===e?"warning":Qs.includes(e)?e:"log"}function tl(){return Date.now()/1e3}const nl=function(){const{performance:e}=Fa;if(!e||!e.now)return tl;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();function rl(e,t=[]){return[e,t]}function il(e,t){const[n,r]=e;return[n,[...r,t]]}function ol(e,t){const n=e[1];for(const e of n){if(t(e,e[0].type))return!0}return!1}function al(e,t){return(t||new TextEncoder).encode(e)}function sl(e,t){const[n,r]=e;let i=JSON.stringify(n);function o(e){"string"==typeof i?i="string"==typeof e?i+e:[al(i,t),e]:i.push("string"==typeof e?al(e,t):e)}for(const e of r){const[t,n]=e;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)o(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(Ws(n))}o(e)}}return"string"==typeof i?i:function(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(i)}function ll(e,t){const n="string"==typeof e.data?al(e.data,t):e.data;return[Qa({type:"attachment",length:n.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),n]}(()=>{const{performance:e}=Fa;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,o=i<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+n-r):t;(o||s<t)&&(i<=s&&e.timeOrigin)})();const cl={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function ul(e){return cl[e]}function dl(e){if(!e||!e.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function hl(e,{statusCode:t,headers:n},r=Date.now()){const i={...e},o=n&&n["x-sentry-rate-limits"],a=n&&n["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,n,,,o]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(n)for(const e of n.split(";"))"metric_bucket"===e?(!o||o.split(";").includes("custom"))&&(i[e]=r+s):i[e]=r+s;else i.all=r+s}else a?i.all=r+function(e,t=Date.now()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(a,r):429===t&&(i.all=r+6e4);return i}const fl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,pl="production";function gl(){return Pa("globalEventProcessors",()=>[])}function ml(e){gl().push(e)}function vl(e,t,n,r=0){return new Ks((i,o)=>{const a=e[r];if(null===t||"function"!=typeof a)i(t);else{const s=a({...t},n);fl&&a.id&&null===s&&Ba.log(`Event processor "${a.id}" dropped event`),ya(s)?s.then(t=>vl(e,t,n,r+1).then(i)).then(null,o):vl(e,s,n,r+1).then(i).then(null,o)}})}function yl(e){const t=nl(),n={sid:fs(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return Qa({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(n)};return e&&bl(n,e),n}function bl(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||nl(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:fs()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function wl(e,t){let n={};"ok"===e.status&&(n={status:"exited"}),bl(e,n)}function xl(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:o,status:a,tags:s,origin:l}=Cl(e);return Qa({data:r,op:i,parent_span_id:o,span_id:t,status:a,tags:s,trace_id:n,origin:l})}function Cl(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}function _l(e,t,n,r,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||n.event_id||fs(),timestamp:t.timestamp||tl()},c=n.integrations||e.integrations.map(e=>e.name);(function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o=250}=t;"environment"in e||(e.environment="environment"in t?n:pl),void 0===e.release&&void 0!==r&&(e.release=r),void 0===e.dist&&void 0!==i&&(e.dist=i),e.message&&(e.message=xa(e.message,o));const a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=xa(a.value,o));const s=e.request;s&&s.url&&(s.url=xa(s.url,o))})(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),void 0===t.type&&function(e,t){const n=Fa._sentryDebugIds;if(!n)return;let r;const i=Sl.get(t);i?r=i:(r=new Map,Sl.set(t,r));const o=Object.keys(n).reduce((e,i)=>{let o;const a=r.get(i);a?o=a:(o=t(i),r.set(i,o));for(let t=o.length-1;t>=0;t--){const r=o[t];if(r.filename){e[r.filename]=n[i];break}}return e},{});try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.filename&&(e.debug_id=o[e.filename])})})}catch{}}(l,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new Bl;return n.update(t),n}(r,n.captureContext);n.mechanism&&vs(l,n.mechanism);const d=i&&i.getEventProcessors?i.getEventProcessors():[],h=(zl||(zl=new Bl),zl).getScopeData();if(o){Dl(h,o.getScopeData())}if(u){Dl(h,u.getScopeData())}const f=[...n.attachments||[],...h.attachments];f.length&&(n.attachments=f),jl(l,h);return vl([...d,...gl(),...h.eventProcessors],l,n).then(e=>(e&&function(e){const t={};try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})})}catch{}if(0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.keys(t).forEach(e=>{n.push({type:"sourcemap",code_file:e,debug_id:t[e]})})}(e),"number"==typeof a&&a>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Ws(e.data,t,n)}}))},...e.user&&{user:Ws(e.user,t,n)},...e.contexts&&{contexts:Ws(e.contexts,t,n)},...e.extra&&{extra:Ws(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ws(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>{const r=Cl(e).data;return r&&(e.data=Ws(r,t,n)),e})),r}(e,a,s):e))}const Sl=new WeakMap;function kl(e,t){return Yl().captureEvent(e,t)}function Al(e,t){Yl().addBreadcrumb(e,t)}function El(){return Yl().getClient()}function Il(){return Yl().getScope()}function Tl(e){const t=El(),n=Xl(),r=Il(),{release:i,environment:o=pl}=t&&t.getOptions()||{},{userAgent:a}=Fa.navigator||{},s=yl({release:i,environment:o,user:r.getUser()||n.getUser(),...a&&{userAgent:a},...e}),l=n.getSession();return l&&"ok"===l.status&&bl(l,{status:"exited"}),Fl(),n.setSession(s),r.setSession(s),s}function Fl(){const e=Xl(),t=Il(),n=t.getSession()||e.getSession();n&&wl(n),Ol(),e.setSession(),t.setSession()}function Ol(){const e=Xl(),t=Il(),n=El(),r=t.getSession()||e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function Pl(e=!1){e?Fl():Ol()}function Ml(e){return e.transaction}function Rl(e,t,n){const r=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:o}=n&&n.getUser()||{},a=Qa({environment:r.environment||pl,release:r.release,user_segment:o,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",a),a}function Ll(e){const t=El();if(!t)return{};const n=Rl(Cl(e).trace_id||"",t,Il()),r=Ml(e);if(!r)return n;const i=r&&r._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:o,source:a}=r.metadata;null!=o&&(n.sample_rate=`${o}`);const s=Cl(r);return a&&"url"!==a&&(n.transaction=s.description),n.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return!!(1&t)}(r)),t.emit&&t.emit("createDsc",n),n}function jl(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;(function(e,t){const{extra:n,tags:r,user:i,contexts:o,level:a,transactionName:s}=t,l=Qa(n);l&&Object.keys(l).length&&(e.extra={...l,...e.extra});const c=Qa(r);c&&Object.keys(c).length&&(e.tags={...c,...e.tags});const u=Qa(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});const d=Qa(o);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),a&&(e.level=a),s&&(e.transaction=s)})(e,t),r&&function(e,t){e.contexts={trace:xl(t),...e.contexts};const n=Ml(t);if(n){e.sdkProcessingMetadata={dynamicSamplingContext:Ll(t),...e.sdkProcessingMetadata};const r=Cl(n).description;r&&(e.tags={transaction:r,...e.tags})}}(e,r),function(e,t){e.fingerprint=e.fingerprint?bs(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}function Dl(e,t){const{extra:n,tags:r,user:i,contexts:o,level:a,sdkProcessingMetadata:s,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:h,transactionName:f,span:p}=t;Nl(e,"extra",n),Nl(e,"tags",r),Nl(e,"user",i),Nl(e,"contexts",o),Nl(e,"sdkProcessingMetadata",s),a&&(e.level=a),f&&(e.transactionName=f),p&&(e.span=p),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),c.length&&(e.fingerprint=[...e.fingerprint,...c]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function Nl(e,t,n){if(n&&Object.keys(n).length){e[t]={...e[t]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[t][r]=n[r])}}let zl;class Bl{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Ul()}static clone(e){return e?e.clone():new Bl}clone(){const e=new Bl;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&bl(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e;if(t instanceof Bl){const e=t.getScopeData();this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&Object.keys(e.user).length&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint.length&&(this._fingerprint=e.fingerprint),t.getRequestSession()&&(this._requestSession=t.getRequestSession()),e.propagationContext&&(this._propagationContext=e.propagationContext)}else if(ma(t)){const t=e;this._tags={...this._tags,...t.tags},this._extra={...this._extra,...t.extra},this._contexts={...this._contexts,...t.contexts},t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession),t.propagationContext&&(this._propagationContext=t.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Ul(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:tl(),...e},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:t,_contexts:n,_tags:r,_extra:i,_user:o,_level:a,_fingerprint:s,_eventProcessors:l,_propagationContext:c,_sdkProcessingMetadata:u,_transactionName:d,_span:h}=this;return{breadcrumbs:e,attachments:t,contexts:n,tags:r,extra:i,user:o,level:a,fingerprint:s||[],eventProcessors:l,propagationContext:c,sdkProcessingMetadata:u,transactionName:d,span:h}}applyToEvent(e,t={},n=[]){jl(e,this.getScopeData());return vl([...n,...gl(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:fs();if(!this._client)return Ba.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:fs();if(!this._client)return Ba.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:fs();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Ba.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Ul(){return{traceId:fs(),spanId:fs().substring(16)}}const Vl="7.116.0",$l=parseFloat(Vl),Wl=100;class Hl{constructor(e,t,n,r=$l){let i,o;this._version=r,t?i=t:(i=new Bl,i.setClient(e)),n?o=n:(o=new Bl,o.setClient(e)),this._stack=[{scope:i}],e&&this.bindClient(e),this._isolationScope=o}isOlderThan(e){return this._version<e}bindClient(e){const t=this.getStackTop();t.client=e,t.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){const t=this.pushScope();let n;try{n=e(t)}catch(e){throw this.popScope(),e}return ya(n)?n.then(e=>(this.popScope(),e),e=>{throw this.popScope(),e}):(this.popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){const n=this._lastEventId=t&&t.event_id?t.event_id:fs(),r=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:r,...t,event_id:n}),n}captureMessage(e,t,n){const r=this._lastEventId=n&&n.event_id?n.event_id:fs(),i=new Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r}),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:fs();return e.type||(this._lastEventId=n),this.getScope().captureEvent(e,{...t,event_id:n}),n}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:n,client:r}=this.getStackTop();if(!r)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Wl}=r.getOptions&&r.getOptions()||{};if(o<=0)return;const a={timestamp:tl(),...e},s=i?za(()=>i(a,t)):a;null!==s&&(r.emit&&r.emit("beforeAddBreadcrumb",s,t),n.addBreadcrumb(s,o))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}configureScope(e){const{scope:t,client:n}=this.getStackTop();n&&e(t)}run(e){const t=Gl(this);try{e(this)}finally{Gl(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch{return fl&&Ba.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const n=this._callExtensionMethod("startTransaction",e,t);return fl&&!n&&(this.getClient()?Ba.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):Ba.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),n}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const e=this.getStackTop().scope,t=e.getSession();t&&wl(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:n}=this.getStackTop(),{release:r,environment:i=pl}=n&&n.getOptions()||{},{userAgent:o}=Fa.navigator||{},a=yl({release:r,environment:i,user:t.getUser(),...o&&{userAgent:o},...e}),s=t.getSession&&t.getSession();return s&&"ok"===s.status&&bl(s,{status:"exited"}),this.endSession(),t.setSession(a),a}shouldSendDefaultPii(){const e=this.getClient(),t=e&&e.getOptions();return!(!t||!t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop(),n=e.getSession();n&&t&&t.captureSession&&t.captureSession(n)}_callExtensionMethod(e,...t){const n=ql().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[e])return n.extensions[e].apply(this,t);fl&&Ba.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function ql(){return Fa.__SENTRY__=Fa.__SENTRY__||{extensions:{},hub:void 0},Fa}function Gl(e){const t=ql(),n=Kl(t);return Zl(t,e),n}function Yl(){const e=ql();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=ql()){return(!function(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}(e)||Kl(e).isOlderThan($l))&&Zl(e,new Hl),Kl(e)}(e)}function Xl(){return Yl().getIsolationScope()}function Kl(e){return Pa("hub",()=>new Hl,e)}function Zl(e,t){if(!e)return!1;return(e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0}function Jl(e,t,n,r){const i=dl(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]])}(e,n&&n.sdk);const a=function(e,t,n,r){const i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Va(r)},...i&&{trace:Qa({...i})}}}(e,i,r,t);return delete e.sdkProcessingMetadata,rl(a,[[{type:o},e]])}function Ql(e,t){return function(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}({sentry_key:e.publicKey,sentry_version:"7",...t&&{sentry_client:`${t.name}/${t.version}`}})}const ec=[];function tc(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;t.forEach(e=>{e.isDefaultInstance=!0}),r=Array.isArray(n)?[...t,...n]:"function"==typeof n?bs(n(t)):t;const i=function(e){const t={};return e.forEach(e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.keys(t).map(e=>t[e])}(r),o=function(e,t){for(let n=0;n<e.length;n++)if(!0===t(e[n]))return n;return-1}(i,e=>"Debug"===e.name);if(-1!==o){const[e]=i.splice(o,1);i.push(e)}return i}function nc(e,t){for(const n of t)n&&n.afterAllSetup&&n.afterAllSetup(e)}function rc(e,t,n){if(n[t.name])fl&&Ba.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===ec.indexOf(t.name)&&(t.setupOnce(ml,Yl),ec.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),e.on&&"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,r)=>n(t,r,e))}if(e.addEventProcessor&&"function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}fl&&Ba.log(`Integration installed: ${t.name}`)}}function ic(e,t){return Object.assign(function(...e){return t(...e)},{id:e})}function oc(e,t,n,r){const i={sent_at:(new Date).toISOString()};n&&n.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),r&&t&&(i.dsn=Va(t));const o=function(e){const t=function(e){let t="";for(const n of e){const e=Object.entries(n.tags),r=e.length>0?`|#${e.map(([e,t])=>`${e}:${t}`).join(",")}`:"";t+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${r}|T${n.timestamp}\n`}return t}(e);return[{type:"statsd",length:t.length},t]}(e);return rl(i,[o])}const ac="Not capturing exception because it's already been captured.";class sc{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Wa(e.dsn):fl&&Ba.warn("No DSN provided, client will not send events."),this._dsn){const t=function(e,t={}){const n="string"==typeof t?t:t.tunnel,r="string"!=typeof t&&t._metadata?t._metadata.sdk:void 0;return n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${Ql(e,r)}`}(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,n){if(ys(e))return void(fl&&Ba.log(ac));let r=t&&t.event_id;return this._process(this.eventFromException(e,t).then(e=>this._captureEvent(e,t,n)).then(e=>{r=e})),r}captureMessage(e,t,n,r){let i=n&&n.event_id;const o=pa(e)?e:String(e),a=ga(e)?this.eventFromMessage(o,t,n):this.eventFromException(e,n);return this._process(a.then(e=>this._captureEvent(e,n,r)).then(e=>{i=e})),i}captureEvent(e,t,n){if(t&&t.originalException&&ys(t.originalException))return void(fl&&Ba.log(ac));let r=t&&t.event_id;const i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,i||n).then(e=>{r=e})),r}captureSession(e){"string"!=typeof e.release?fl&&Ba.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),bl(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(e).then(n=>t.flush(e).then(e=>n&&e))):Ys(!0)}close(e){return this.flush(e).then(e=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(e){return this.getIntegrationByName(e)}getIntegrationByName(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch{return fl&&Ba.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];rc(this,e,this._integrations),t||nc(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=Jl(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])n=il(n,ll(e,this._options.transportOptions&&this._options.transportOptions.textEncoder));const r=this._sendEnvelope(n);r&&r.then(t=>this.emit("afterSendEvent",e,t),null)}sendSession(e){const t=function(e,t,n,r){const i=dl(n);return rl({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Va(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}recordDroppedEvent(e,t,n){if(this._options.sendClientReports){const n=`${e}:${t}`;fl&&Ba.log(`Adding outcome: "${n}"`),this._outcomes[n]=this._outcomes[n]+1||1}}captureAggregateMetrics(e){fl&&Ba.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=oc(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}on(e,t){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t)}emit(e,...t){this._hooks[e]&&this._hooks[e].forEach(e=>e(...t))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach(t=>{t&&rc(e,t,n)}),n}(this,e),nc(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let n=!1,r=!1;const i=t.exception&&t.exception.values;if(i){r=!0;for(const e of i){const t=e.mechanism;if(t&&!1===t.handled){n=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(bl(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Ks(t=>{let n=0;const r=setInterval(()=>{0==this._numProcessing?(clearInterval(r),t(!0)):(n+=1,e&&n>=e&&(clearInterval(r),t(!1)))},1)})}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,n,r=Xl()){const i=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o.length>0&&(t.integrations=o),this.emit("preprocessEvent",e,t),_l(i,e,t,n,this,r).then(e=>{if(null===e)return e;const t={...r.getPropagationContext(),...n?n.getPropagationContext():void 0};if((!e.contexts||!e.contexts.trace)&&t){const{traceId:r,spanId:i,parentSpanId:o,dsc:a}=t;e.contexts={trace:{trace_id:r,span_id:i,parent_span_id:o},...e.contexts};const s=a||Rl(r,this,n);e.sdkProcessingMetadata={dynamicSamplingContext:s,...e.sdkProcessingMetadata}}return e})}_captureEvent(e,t={},n){return this._processEvent(e,t,n).then(e=>e.event_id,e=>{if(fl){const t=e;"log"===t.logLevel?Ba.log(t.message):Ba.warn(t)}})}_processEvent(e,t,n){const r=this.getOptions(),{sampleRate:i}=r,o=cc(e),a=lc(e),s=e.type||"error",l=`before send for type \`${s}\``;if(a&&"number"==typeof i&&Math.random()>i)return this.recordDroppedEvent("sample_rate","error",e),Xs(new Ha(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const c="replay_event"===s?"replay":s,u=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,n,u).then(n=>{if(null===n)throw this.recordDroppedEvent("event_processor",c,e),new Ha("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return n;const i=function(e,t,n){const{beforeSend:r,beforeSendTransaction:i}=e;return lc(t)&&r?r(t,n):cc(t)&&i?i(t,n):t}(r,n,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(ya(e))return e.then(e=>{if(!ma(e)&&null!==e)throw new Ha(n);return e},e=>{throw new Ha(`${t} rejected with ${e}`)});if(!ma(e)&&null!==e)throw new Ha(n);return e}(i,l)}).then(r=>{if(null===r)throw this.recordDroppedEvent("before_send",c,e),new Ha(`${l} returned \`null\`, will not send event.`,"log");const i=n&&n.getSession();!o&&i&&this._updateSessionFromEvent(i,r);const a=r.transaction_info;if(o&&a&&r.transaction!==e.transaction){const e="custom";r.transaction_info={...a,source:e}}return this.sendEvent(r,t),r}).then(null,e=>{throw e instanceof Ha?e:(this.captureException(e,{data:{__sentry__:!0},originalException:e}),new Ha(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e){this._numProcessing++,e.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,e=>{fl&&Ba.error("Error while sending event:",e)});fl&&Ba.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map(t=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e[t]}})}}function lc(e){return void 0===e.type}function cc(e){return"transaction"===e.type}function uc(e,t){!0===t.debug&&(fl?Ba.enable():za(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Il().update(t.initialScope);const n=new e(t);(function(e){const t=Yl().getStackTop();t.client=e,t.scope.setClient(e)})(n),function(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}(n)}function dc(e,t,n=Zs(e.bufferSize||30)){let r={};function i(i){const o=[];if(ol(i,(t,n)=>{const i=ul(n);if(function(e,t,n=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,i)){const r=hc(t,n);e.recordDroppedEvent("ratelimit_backoff",i,r)}else o.push(t)}),0===o.length)return Ys();const a=rl(i[0],o),s=t=>{ol(a,(n,r)=>{const i=hc(n,r);e.recordDroppedEvent(t,ul(r),i)})};return n.add(()=>t({body:sl(a,e.textEncoder)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&fl&&Ba.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=hl(r,e),e),e=>{throw s("network_error"),e})).then(e=>e,e=>{if(e instanceof Ha)return fl&&Ba.error("Skipped sending event because buffer is full."),s("queue_overflow"),Ys();throw e})}return i.__sentry__baseTransport__=!0,{send:i,flush:e=>n.drain(e)}}function hc(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}function fc(e,t,n=[t],r="npm"){const i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:n.map(e=>({name:`${r}:@sentry/${e}`,version:Vl})),version:Vl}),e._metadata=i}const pc=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],gc=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],mc="InboundFilters",vc=(e={})=>({name:mc,setupOnce(){},processEvent(t,n,r){const i=r.getOptions(),o=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:pc],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:gc],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(e,i);return function(e,t){return t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch{}return!1}(e)?(fl&&Ba.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${gs(e)}`),!0):function(e,t){return!(e.type||!t||!t.length)&&function(e){const t=[];let n;e.message&&t.push(e.message);try{n=e.exception.values[e.exception.values.length-1]}catch{}return n&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`)),fl&&0===t.length&&Ba.error(`Could not extract message for event ${gs(e)}`),t}(e).some(e=>Sa(e,t))}(e,t.ignoreErrors)?(fl&&Ba.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${gs(e)}`),!0):function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const n=e.transaction;return!!n&&Sa(n,t)}(e,t.ignoreTransactions)?(fl&&Ba.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${gs(e)}`),!0):function(e,t){if(!t||!t.length)return!1;const n=yc(e);return!!n&&Sa(n,t)}(e,t.denyUrls)?(fl&&Ba.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${gs(e)}.\nUrl: ${yc(e)}`),!0):!function(e,t){if(!t||!t.length)return!0;const n=yc(e);return!n||Sa(n,t)}(e,t.allowUrls)&&(fl&&Ba.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${gs(e)}.\nUrl: ${yc(e)}`),!0)}(t,o)?null:t}});function yc(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(t):null}catch{return fl&&Ba.error(`Cannot extract url for event ${gs(e)}`),null}}let bc;ic(mc,vc);const wc="FunctionToString",xc=new WeakMap,Cc=()=>({name:wc,setupOnce(){bc=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Xa(this),n=xc.has(El())&&void 0!==t?t:this;return bc.apply(n,e)}}catch{}},setup(e){xc.set(e,!0)}});ic(wc,Cc);const _c=Fa;let Sc=0;function kc(){return Sc>0}function Ac(e,t={},n){if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return t;if(Xa(e))return e}catch{return e}const r=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const i=r.map(e=>Ac(e,t));return e.apply(this,i)}catch(e){throw Sc++,setTimeout(()=>{Sc--}),function(...e){const t=Yl();if(2===e.length){const[n,r]=e;return n?t.withScope(()=>(t.getStackTop().scope=n,r(n))):t.withScope(r)}t.withScope(e[0])}(n=>{n.addEventProcessor(e=>(t.mechanism&&(ms(e,void 0),vs(e,t.mechanism)),e.extra={...e.extra,arguments:r},e)),function(e){Yl().captureException(e,void 0)}(e)}),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch{}Ya(r,e),Ga(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>e.name})}catch{}return r}const Ec=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Ic(e,t){const n=Fc(e,t),r={type:t&&t.name,value:Pc(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Tc(e,t){return{exception:{values:[Ic(e,t)]}}}function Fc(e,t){const n=t.stacktrace||t.stack||"",r=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(Oc.test(e.message))return 1}return 0}(t);try{return e(n,r)}catch{}return[]}const Oc=/Minified React error #\d+;/i;function Pc(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function Mc(e,t,n,r,i){let o;if(da(t)&&t.error)return Tc(e,t.error);if(ha(t)||function(e){return ua(e,"DOMException")}(t)){const i=t;if("stack"in t)o=Tc(e,t);else{const t=i.name||(ha(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=Rc(e,a,n,r),ms(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return ca(t)?Tc(e,t):ma(t)||va(t)?(o=function(e,t,n,r){const i=El(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:va(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Lc(t,{isUnhandledRejection:r})}]},extra:{__serialized__:Hs(t,o)}};if(n){const t=Fc(e,n);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,n,i),vs(o,{synthetic:!0}),o):(o=Rc(e,t,n,r),ms(o,`${t}`),vs(o,{synthetic:!0}),o)}function Rc(e,t,n,r){const i={};if(r&&n){const r=Fc(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]})}if(pa(t)){const{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Lc(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(Ka(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return xa(n[0],t);for(let e=n.length;e>0;e--){const r=n.slice(0,e).join(", ");if(!(r.length>t))return e===n.length?r:xa(r,t)}return""}(e),r=t?"promise rejection":"exception";return da(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:va(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class jc extends sc{constructor(e){fc(e,"browser",["browser"],_c.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&_c.document&&_c.document.addEventListener("visibilitychange",()=>{"hidden"===_c.document.visibilityState&&this._flushOutcomes()})}eventFromException(e,t){return function(e,t,n,r){const i=Mc(e,t,n&&n.syntheticException||void 0,r);return vs(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),Ys(i)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=Rc(e,t,r&&r.syntheticException||void 0,i);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),Ys(o)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(Ec&&Ba.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:n,dsn:r}){const i={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:Va(r)}},o=function(e){return[{type:"user_report"},e]}(e);return rl(i,[o])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(Ec&&Ba.log("No outcomes to send"));if(!this._dsn)return void(Ec&&Ba.log("No dsn provided, will not send outcomes"));Ec&&Ba.log("Sending outcomes:",e);const t=function(e,t){return rl(t?{dsn:t}:{},[[{type:"client_report"},{timestamp:tl(),discarded_events:e}]])}(e,this._options.tunnel&&Va(this._dsn));this._sendEnvelope(t)}}let Dc;function Nc(e,t=function(){if(Dc)return Dc;if(Is(_c.fetch))return Dc=_c.fetch.bind(_c);const e=_c.document;let t=_c.fetch;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(t=r.fetch),e.head.removeChild(n)}catch(e){Ec&&Ba.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return Dc=t.bind(_c)}()){let n=0,r=0;return dc(e,function(i){const o=i.body.length;n+=o,r++;const a={body:i.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{return t(e.url,a).then(e=>(n-=o,r--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get("X-Sentry-Rate-Limits"),"retry-after":e.headers.get("Retry-After")}}))}catch(e){return Dc=void 0,n-=o,r--,Xs(e)}})}function zc(e){return dc(e,function(t){return new Ks((n,r)=>{const i=new XMLHttpRequest;i.onerror=r,i.onreadystatechange=()=>{4===i.readyState&&n({statusCode:i.status,headers:{"x-sentry-rate-limits":i.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":i.getResponseHeader("Retry-After")}})},i.open("POST",e.url);for(const t in e.headers)Object.prototype.hasOwnProperty.call(e.headers,t)&&i.setRequestHeader(t,e.headers[t]);i.send(t.body)})})}const Bc="?";function Uc(e,t,n,r){const i={filename:e,function:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Vc=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,$c=/\((\S*)(?::(\d+))(?::(\d+))\)/,Wc=[30,e=>{const t=Vc.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=$c.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,n]=Zc(t[1]||Bc,t[2]);return Uc(n,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],Hc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,qc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Gc=[50,e=>{const t=Hc.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=qc.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Bc;return[n,e]=Zc(n,e),Uc(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],Yc=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Xc=[40,e=>{const t=Yc.exec(e);return t?Uc(t[2],t[1]||Bc,+t[3],t[4]?+t[4]:void 0):void 0}],Kc=rs(...[Wc,Gc,Xc]),Zc=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Bc,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Jc=1024,Qc="Breadcrumbs",eu=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Qc,setupOnce(){},setup(e){t.console&&function(e){const t="console";cs(t,e),us(t,hs)}(function(e){return function(t){if(El()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:el(t.level),message:Ca(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Ca(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Al(n,{input:t.args,level:t.level})}}(e)),t.dom&&function(e){cs("dom",e),us("dom",Ss)}(function(e,t){return function(n){if(El()!==e)return;let r,i,o="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;a&&a>Jc&&(Ec&&Ba.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=Jc),"string"==typeof o&&(o=[o]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=Ra(t,{keyAttrs:o,maxStringLength:a}),i=function(e){if(!Ma.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}(t)}catch{r="<unknown>"}if(0===r.length)return;const s={category:`ui.${n.name}`,message:r};i&&(s.data={"ui.component_name":i}),Al(s,{event:n.event,name:n.name,global:n.global})}}(e,t.dom)),t.xhr&&function(e){cs("xhr",e),us("xhr",$s)}(function(e){return function(t){if(El()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Vs];if(!n||!r||!i)return;const{method:o,url:a,status_code:s,body:l}=i;Al({category:"xhr",data:{method:o,url:a,status_code:s},type:"http"},{xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r})}}(e)),t.fetch&&function(e){const t="fetch";cs(t,e),us(t,Ts)}(function(e){return function(t){if(El()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){Al({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:n,endTimestamp:r})}else{const e=t.response;Al({category:"fetch",data:{...t.fetchData,status_code:e&&e.status},type:"http"},{input:t.args,response:e,startTimestamp:n,endTimestamp:r})}}}(e)),t.history&&zs(function(e){return function(t){if(El()!==e)return;let n=t.from,r=t.to;const i=Js(_c.location.href);let o=n?Js(n):void 0;const a=Js(r);(!o||!o.path)&&(o=i),i.protocol===a.protocol&&i.host===a.host&&(r=a.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),Al({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){El()===e&&Al({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:gs(t)},{event:t})}}(e))}}};ic(Qc,eu);const tu="Dedupe",nu=()=>{let e;return{name:tu,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&!(!function(e,t){const n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!iu(e,t)||!ru(e,t))}(e,t)&&!function(e,t){const n=ou(t),r=ou(e);return!!(n&&r&&n.type===r.type&&n.value===r.value&&iu(e,t)&&ru(e,t))}(e,t))}(t,e))return Ec&&Ba.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function ru(e,t){let n=au(e),r=au(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function iu(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return n.join("")===r.join("")}catch{return!1}}function ou(e){return e.exception&&e.exception.values&&e.exception.values[0]}function au(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}ic(tu,nu);const su="GlobalHandlers",lu=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:su,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(e){const t="error";cs(t,e),us(t,Ms)}(t=>{const{stackParser:n,attachStacktrace:r}=du();if(El()!==e||kc())return;const{msg:i,url:o,line:a,column:s,error:l}=t,c=void 0===l&&fa(i)?function(e,t,n,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=da(e)?e.message:e,a="Error";const s=o.match(i);return s&&(a=s[1],o=s[2]),cu({exception:{values:[{type:a,value:o}]}},t,n,r)}(i,o,a,s):cu(Mc(n,l||i,void 0,r,!1),o,a,s);c.level="error",kl(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}(e),uu("onerror")),t.onunhandledrejection&&(function(e){!function(e){const t="unhandledrejection";cs(t,e),us(t,Ls)}(t=>{const{stackParser:n,attachStacktrace:r}=du();if(El()!==e||kc())return;const i=function(e){if(ga(e))return e;const t=e;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return e}(t),o=ga(i)?function(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}(i):Mc(n,i,void 0,r,!0);o.level="error",kl(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(e),uu("onunhandledrejection"))}}};function cu(e,t,n,r){const i=e.exception=e.exception||{},o=i.values=i.values||[],a=o[0]=o[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[],c=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,d=fa(t)&&t.length>0?t:function(){try{return Ma.document.location.href}catch{return""}}();return 0===l.length&&l.push({colno:c,filename:d,function:"?",in_app:!0,lineno:u}),e}function uu(e){Ec&&Ba.log(`Global Handler attached: ${e}`)}function du(){const e=El();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}ic(su,lu);const hu="HttpContext",fu=()=>({name:hu,setupOnce(){},preprocessEvent(e){if(!_c.navigator&&!_c.location&&!_c.document)return;const t=e.request&&e.request.url||_c.location&&_c.location.href,{referrer:n}=_c.document||{},{userAgent:r}=_c.navigator||{},i={...e.request&&e.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...e.request,...t&&{url:t},headers:i};e.request=o}});ic(hu,fu);const pu="LinkedErrors",gu=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:pu,setupOnce(){},preprocessEvent(e,r,i){const o=i.getOptions();ka(Ic,o.stackParser,o.maxValueLength,n,t,e,r)}}};ic(pu,gu);const mu=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],vu="TryCatch",yu=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:vu,setupOnce(){t.setTimeout&&qa(_c,"setTimeout",bu),t.setInterval&&qa(_c,"setInterval",bu),t.requestAnimationFrame&&qa(_c,"requestAnimationFrame",wu),t.XMLHttpRequest&&"XMLHttpRequest"in _c&&qa(XMLHttpRequest.prototype,"send",xu);const e=t.eventTarget;e&&(Array.isArray(e)?e:mu).forEach(Cu)}}};function bu(e){return function(...t){const n=t[0];return t[0]=Ac(n,{mechanism:{data:{function:as(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function wu(e){return function(t){return e.apply(this,[Ac(t,{mechanism:{data:{function:"requestAnimationFrame",handler:as(e)},handled:!1,type:"instrument"}})])}}function xu(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&qa(n,e,function(t){const n={mechanism:{data:{function:e,handler:as(t)},handled:!1,type:"instrument"}},r=Xa(t);return r&&(n.mechanism.data.handler=as(r)),Ac(t,n)})}),e.apply(this,t)}}function Cu(e){const t=_c,n=t[e]&&t[e].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(qa(n,"addEventListener",function(t){return function(n,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=Ac(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:as(r),target:e},handled:!1,type:"instrument"}}))}catch{}return t.apply(this,[n,Ac(r,{mechanism:{data:{function:"addEventListener",handler:as(r),target:e},handled:!1,type:"instrument"}}),i])}}),qa(n,"removeEventListener",function(e){return function(t,n,r){const i=n;try{const n=i&&i.__sentry_wrapped__;n&&e.call(this,t,n,r)}catch{}return e.call(this,t,i,r)}}))}ic(vu,yu);const _u=[vc(),Cc(),yu(),eu(),lu(),gu(),nu(),fu()];function Su(e={}){void 0===e.defaultIntegrations&&(e.defaultIntegrations=[..._u]),void 0===e.release&&("string"==typeof __SENTRY_RELEASE__&&(e.release=__SENTRY_RELEASE__),_c.SENTRY_RELEASE&&_c.SENTRY_RELEASE.id&&(e.release=_c.SENTRY_RELEASE.id)),void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0);const t={...e,stackParser:is(e.stackParser||Kc),integrations:tc(e),transport:e.transport||(Es()?Nc:zc)};uc(jc,t),e.autoSessionTracking&&function(){if(typeof _c.document>"u")return void(Ec&&Ba.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));Tl({ignoreDuration:!0}),Pl(),zs(({from:e,to:t})=>{void 0!==e&&e!==t&&(Tl({ignoreDuration:!0}),Pl())})}()}var ku=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Au(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Eu(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Iu=(e=>(e.INLINE="inline",e.OVERLAY="overlay",e))(Iu||{}),Tu=(e=>(e.TOP="top",e.BOTTOM="bottom",e.HIDDEN="",e))(Tu||{});function Fu(e,t){return{...t,message:e}}const Ou=[{name:"emoticons",list:["afro-1","afro","agent","alien-1","alien","angel","angry-1","angry-2","angry-3","angry-4","angry-5","angry","arguing","arrogant","asian-1","asian","avatar","baby-1","baby-2","baby","bully","burglar","businessman","cheeky-1","cheeky","clown","confused-1","confused-2","confused-3","confused","creepy","crying-1","crying-2","crying-3","crying","dazed-1","dazed-2","dazed-3","dazed","dead-1","dead-2","dead-3","dead-4","dead-5","dead-6","dead","desperate-1","desperate","detective","dissapointment","doctor","drunk","dumb","emo-1","emo-2","emo","emoticon","evil","faint-1","faint","flirt-1","flirt-2","flirt","flirty","gangster","geek-1","geek","gentleman-1","gentleman-2","gentleman-3","gentleman-4","gentleman","ginger","girl-1","girl","goofy-1","goofy-2","goofy-3","goofy-4","goofy","grubby-1","grubby","happy-1","happy-10","happy-11","happy-12","happy-13","happy-14","happy-15","happy-16","happy-2","happy-3","happy-4","happy-5","happy-6","happy-7","happy-8","happy-9","happy","harry-potter","heisenberg","hipster-1","hipster-2","hipster","in-love-1","in-love-2","in-love-3","in-love-4","in-love-5","in-love-6","in-love","japan","jew","joyful-1","joyful-2","joyful","kiss-1","kiss-2","kiss-3","kiss-4","kiss","laughing-1","laughing-2","laughing-3","laughing","listening","love","manly","miserly-1","miserly","nerd-1","nerd-2","nerd-3","nerd-4","nerd","ninja","pirate-1","pirate-2","pirate","punk-1","punk-2","punk","rapper","relieved","rich-1","rich-2","rich","rockstar","sad-1","sad-2","sad-3","sad-4","sad-5","sad-6","sad","scared-1","scared-2","scared-3","scared","sceptic-1","sceptic-2","sceptic-3","sceptic-4","sceptic-5","sceptic-6","sceptic-7","sceptic","secret","shocked-1","shocked-2","shocked-3","shocked","sick-1","sick-2","sick-3","sick-4","sick","silent","skeleton","smile","smiling-1","smiling","smoked","smug-1","smug-2","smug-3","smug-4","smug-5","smug-6","smug","sporty","stunned","superhero-1","superhero-2","superhero-3","superhero-4","superhero","surprised-1","surprised","thinking","tired-1","tired-2","tired-3","tired","tough-1","tough","trendy","vampire-1","vampire","wink-1","wink-2","wink","winking-1","winking","yawning-1","yawning-2","yawning-3","yawning","yelling","zombie"],type:"svg",thumbnailUrl:"images/stickers/categories/emoticon.svg"},{name:"doodles",items:100,type:"svg",thumbnailUrl:"images/stickers/categories/doodles.svg"},{name:"landmarks",items:100,type:"svg",thumbnailUrl:"images/stickers/categories/landmark.svg",invertPreview:!0},{name:"bubbles",items:104,type:"png",thumbnailUrl:"images/stickers/categories/speech-bubble.svg"},{name:"transportation",items:22,type:"svg",thumbnailUrl:"images/stickers/categories/transportation.svg",invertPreview:!0},{name:"beach",items:22,type:"svg",thumbnailUrl:"images/stickers/categories/beach.svg",invertPreview:!0}],Pu={emoticons:Fu("Emoticons"),doodles:Fu("Doodles"),landmarks:Fu("Landmarks"),bubbles:Fu("Bubbles"),transportation:Fu("Transportation"),beach:Fu("Beach")},Mu={fill:"#1565C0",opacity:1,backgroundColor:null,strokeWidth:.05,stroke:"#000"},Ru=[1,8,15,20,25];var Lu=(e=>(e.DARK="dark",e.LIGHT="light",e))(Lu||{});const ju=[{name:Lu.LIGHT,colors:{"--be-foreground-base":"0 0 0","--be-primary-light":"191 219 254","--be-primary":"59 130 246","--be-primary-dark":"37 99 235","--be-on-primary":"255 255 255","--be-danger":"179 38 30","--be-on-danger":"255 255 255","--be-background":"255 255 255","--be-background-alt":"250 250 250","--be-paper":"255 255 255","--be-disabled-bg-opacity":"12%","--be-disabled-fg-opacity":"26%","--be-hover-opacity":"4%","--be-focus-opacity":"12%","--be-selected-opacity":"8%","--be-text-main-opacity":"87%","--be-text-muted-opacity":"60%","--be-divider-opacity":"12%"}},{name:Lu.DARK,isDark:!0,colors:{"--be-foreground-base":"255 255 255","--be-primary-light":"239 246 255","--be-primary":"191 219 254","--be-primary-dark":"147 197 253","--be-on-primary":"56 30 114","--be-danger":"242 184 181","--be-on-danger":"96 20 16","--be-background":"20 21 23","--be-background-alt":"26 27 30","--be-paper":"44 46 51","--be-disabled-bg-opacity":"12%","--be-disabled-fg-opacity":"30%","--be-hover-opacity":"8%","--be-focus-opacity":"12%","--be-selected-opacity":"16%","--be-text-main-opacity":"100%","--be-text-muted-opacity":"70%","--be-divider-opacity":"12%"}}];var Du=(e=>(e.FILTER="filter",e.RESIZE="resize",e.CROP="crop",e.DRAW="draw",e.TEXT="text",e.SHAPES="shapes",e.STICKERS="stickers",e.FRAME="frame",e.CORNERS="corners",e.MERGE="merge",e))(Du||{});function Nu(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function zu(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nu(e))&&(r&&(r+=" "),r+=t);return r}const Bu=p((n,r)=>{const{attr:i,size:o,title:a,className:s,color:l,style:c,children:u,viewBox:d,width:h,height:f,...p}=n;return t("svg",{"aria-hidden":!a,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:d||"0 0 24 24",...i,...p,className:zu("svg-icon",s,Uu(o)),style:{color:l,...c},ref:r,height:f||"1em",width:h||"1em",children:[a&&e("title",{children:a}),u]})});function Uu(e){switch(e){case"2xs":return"icon-2xs";case"xs":return"icon-xs";case"sm":return"icon-sm";case"md":return"icon-md";case"lg":return"icon-lg";case"xl":return"icon-xl";default:return e}}function Vu(t,n="",r){return i.memo(i.forwardRef((i,o)=>e(Bu,{"data-testid":`${n}Icon`,ref:o,viewBox:r,...i,size:i.size||"md",children:t})))}function $u(e,t=""){return Vu(Wu(e),t)}function Wu(e){return(null==e?void 0:e.map)&&e.map((e,t)=>i.createElement(e.tag,{key:t,...e.attr},Wu(e.child)))}const Hu=Vu(e("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined"),qu=Vu(e("path",{d:"M21 15h2v2h-2v-2zm0-4h2v2h-2v-2zm2 8h-2v2c1 0 2-1 2-2zM13 3h2v2h-2V3zm8 4h2v2h-2V7zm0-4v2h2c0-1-1-2-2-2zM1 7h2v2H1V7zm16-4h2v2h-2V3zm0 16h2v2h-2v-2zM3 3C2 3 1 4 1 5h2V3zm6 0h2v2H9V3zM5 3h2v2H5V3zm-4 8v8c0 1.1.9 2 2 2h12V11H1zm2 8 2.5-3.21 1.79 2.15 2.5-3.22L13 19H3z"}),"PhotoSizeSelectLargeOutlined"),Gu=Vu(e("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"}),"CropOutlined"),Yu=Vu(e("path",{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}),"TextFieldsOutlined"),Xu=Vu(e("path",{d:"M10.5 4.5c.28 0 .5.22.5.5v2h6v6h2c.28 0 .5.22.5.5s-.22.5-.5.5h-2v6h-2.12c-.68-1.75-2.39-3-4.38-3s-3.7 1.25-4.38 3H4v-2.12c1.75-.68 3-2.39 3-4.38 0-1.99-1.24-3.7-2.99-4.38L4 7h6V5c0-.28.22-.5.5-.5m0-2C9.12 2.5 8 3.62 8 5H4c-1.1 0-1.99.9-1.99 2v3.8h.29c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-.3c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7v.3H17c1.1 0 2-.9 2-2v-4c1.38 0 2.5-1.12 2.5-2.5S20.38 11 19 11V7c0-1.1-.9-2-2-2h-4c0-1.38-1.12-2.5-2.5-2.5z"}),"ExtensionOutlined"),Ku=Vu(e("path",{d:"M10.25 13c0 .69-.56 1.25-1.25 1.25S7.75 13.69 7.75 13s.56-1.25 1.25-1.25 1.25.56 1.25 1.25zM15 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm7 .25c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10zM10.66 4.12C12.06 6.44 14.6 8 17.5 8c.46 0 .91-.05 1.34-.12C17.44 5.56 14.9 4 12 4c-.46 0-.91.05-1.34.12zM4.42 9.47c1.71-.97 3.03-2.55 3.66-4.44C6.37 6 5.05 7.58 4.42 9.47zM20 12c0-.78-.12-1.53-.33-2.24-.7.15-1.42.24-2.17.24-3.13 0-5.92-1.44-7.76-3.69C8.69 8.87 6.6 10.88 4 11.86c.01.04 0 .09 0 .14 0 4.41 3.59 8 8 8s8-3.59 8-8z"}),"FaceOutlined"),Zu=Vu(e("path",{d:"M20 4h-4l-4-4-4 4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H4V6h4.52l3.52-3.5L15.52 6H20v14zM6 18h12V8H6v10zm2-8h8v6H8v-6z"}),"FilterFramesOutlined"),Ju=Vu(e("path",{d:"M6.41 21 5 19.59l4.83-4.83c.75-.75 1.17-1.77 1.17-2.83v-5.1L9.41 8.41 8 7l4-4 4 4-1.41 1.41L13 6.83v5.1c0 1.06.42 2.08 1.17 2.83L19 19.59 17.59 21 12 15.41 6.41 21z"}),"MergeOutlined"),Qu=Vu(e("path",{d:"M19 19h2v2h-2v-2zm0-2h2v-2h-2v2zM3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm0-4h2V3H3v2zm4 0h2V3H7v2zm8 16h2v-2h-2v2zm-4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm-8 0h2v-2H7v2zm-4 0h2v-2H3v2zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2V8z"}),"RoundedCornerOutlined"),ed=Vu(e("path",{d:"M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67 1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}),"PhotoLibraryOutlined"),td=Vu(e("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z"}),"HistoryOutlined"),nd=Vu([e("path",{d:"m2.53 19.65 1.34.56v-9.03l-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61zm19.5-3.7L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zm-9.2 3.8L7.87 7.79l7.35-3.04h.01l4.95 11.95-7.35 3.05z"},"0"),e("circle",{cx:"11",cy:"9",r:"1"},"1"),e("path",{d:"M5.88 19.75c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z"},"2")],"StyleOutlined"),rd=Vu(e("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}),"DeleteOutlined"),id=Vu(e("path",{d:"M18.85,10.39l1.06-1.06c0.78-0.78,0.78-2.05,0-2.83L18.5,5.09c-0.78-0.78-2.05-0.78-2.83,0l-1.06,1.06L18.85,10.39z M14.61,11.81L7.41,19H6v-1.41l7.19-7.19L14.61,11.81z M13.19,7.56L4,16.76V21h4.24l9.19-9.19L13.19,7.56L13.19,7.56z M19,17.5 c0,2.19-2.54,3.5-5,3.5c-0.55,0-1-0.45-1-1s0.45-1,1-1c1.54,0,3-0.73,3-1.5c0-0.47-0.48-0.87-1.23-1.2l1.48-1.48 C18.32,15.45,19,16.29,19,17.5z M4.58,13.35C3.61,12.79,3,12.06,3,11c0-1.8,1.89-2.63,3.56-3.36C7.59,7.18,9,6.56,9,6 c0-0.41-0.78-1-2-1C5.74,5,5.2,5.61,5.17,5.64C4.82,6.05,4.19,6.1,3.77,5.76C3.36,5.42,3.28,4.81,3.62,4.38C3.73,4.24,4.76,3,7,3 c2.24,0,4,1.32,4,3c0,1.87-1.93,2.72-3.64,3.47C6.42,9.88,5,10.5,5,11c0,0.31,0.43,0.6,1.07,0.86L4.58,13.35z"}),"Draw"),od=Vu(e("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}),"HomeOutlined"),ad={[Du.FILTER]:{name:Fu("Applied Filters"),icon:Hu},[Du.RESIZE]:{name:Fu("Resized Image"),icon:qu},[Du.CROP]:{name:Fu("Cropped Image"),icon:Gu},[Du.DRAW]:{name:Fu("Added Drawing"),icon:id},[Du.TEXT]:{name:Fu("Added Text"),icon:Yu},[Du.SHAPES]:{name:Fu("Added Shape"),icon:Xu},[Du.STICKERS]:{name:Fu("Added Sticker"),icon:Ku},[Du.FRAME]:{name:Fu("Added Frame"),icon:Zu},[Du.MERGE]:{name:Fu("Merged Objects"),icon:Ju},[Du.CORNERS]:{name:Fu("Rounded Corner"),icon:Qu},bgImage:{name:Fu("Replaced Background Image"),icon:ed},overlayImage:{name:Fu("Added Image"),icon:ed},initial:{name:Fu("Initial"),icon:od},loadedState:{name:Fu("Loaded State"),icon:td},objectStyle:{name:Fu("Changed Style"),icon:nd},deletedObject:{name:Fu("Deleted object"),icon:rd}},sd=Object.values(Du).map(e=>({name:e,icon:ad[e].icon,action:e===Du.MERGE?e=>{e.tools.merge.apply()}:e})),ld={filter:Fu("filter"),resize:Fu("resize"),crop:Fu("crop"),draw:Fu("draw"),text:Fu("text"),shapes:Fu("shapes"),stickers:Fu("stickers"),frame:Fu("frame"),corners:Fu("corners"),merge:Fu("merge")},cd=Vu(e("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}),"FileDownloadOutlined"),ud="3.0.5",dd={selector:"pixie-editor",textureSize:4096,activeLanguage:"en",ui:{visible:!0,mode:Iu.INLINE,forceOverlayModeOnMobile:!0,activeTheme:Lu.LIGHT,themes:ju,allowEditorClose:!0,menubar:{items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",icon:td,align:"right",desktopOnly:!0,action:e=>{e.togglePanel("history")}},{type:"button",icon:cd,label:Fu("Done"),align:"right",action:e=>{var t;null!=(t=e.state.config.ui)&&t.showExportPanel?e.state.togglePanel("export",!0):e.tools.export.save()}}]},nav:{position:Tu.BOTTOM,items:[...sd]},openImageDialog:{show:!0,sampleImages:[{url:"images/samples/sample1.jpg",thumbnail:"images/samples/sample1_thumbnail.jpg"},{url:"images/samples/sample2.jpg",thumbnail:"images/samples/sample2_thumbnail.jpg"},{url:"images/samples/sample3.jpg",thumbnail:"images/samples/sample3_thumbnail.jpg"}]},colorPresets:{items:["rgb(0,0,0)","rgb(255, 255, 255)","rgb(242, 38, 19)","rgb(249, 105, 14)","rgb(253, 227, 167)","rgb(4, 147, 114)","rgb(30, 139, 195)","rgb(142, 68, 173)"]}},objectDefaults:{global:{...Mu},sticker:{fill:void 0},text:{textAlign:"initial",underline:!1,linethrough:!1,fontStyle:"normal",fontFamily:"Times New Roman",fontWeight:"normal",stroke:void 0,fontSize:40}},tools:{filter:{items:["grayscale","blackWhite","sharpen","invert","vintage","polaroid","kodachrome","technicolor","brownie","sepia","removeColor","brightness","gamma","noise","pixelate","blur","emboss","blendColor"]},zoom:{allowUserZoom:!0,fitImageToScreen:!0},crop:{allowCustomRatio:!0,defaultRatio:"1:1",presets:[{ratio:null,name:"Custom"},{ratio:"1:1",name:"Square"},{ratio:"4:3"},{ratio:"16:9"},{ratio:"5:3"},{ratio:"5:4"},{ratio:"6:4"},{ratio:"7:5"},{ratio:"10:8"}]},text:{defaultText:"Double click to edit",controlsPadding:6,items:[{family:"Roboto",src:"fonts/open-sans-v27-latin-ext_latin-regular.woff2"},{family:"Fuzzy Bubbles",src:"fonts/fuzzy-bubbles-v3-latin-700.woff2",descriptors:{weight:"700"}},{family:"Aleo Bold",src:"fonts/aleo-v4-latin-ext_latin-700.woff2",descriptors:{weight:"700"}},{family:"Amatic SC",src:"fonts/amatic-sc-v16-latin-ext_latin-regular.woff2"},{family:"Corinthia Bold",src:"fonts/corinthia-v7-latin-ext_latin-700.woff2"},{family:"Bungee Inline",src:"fonts/bungee-inline-v6-latin-ext_latin-regular.woff2"},{family:"Robot Slab Bold",src:"fonts/roboto-slab-v16-latin-ext_latin-500.woff2"},{family:"Carter One",src:"fonts/carter-one-v12-latin-regular.woff2"},{family:"Cody Star",src:"fonts/codystar-v10-latin-ext_latin-regular.woff2"},{family:"Fira Sans",src:"fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"},{family:"Krona One",src:"fonts/krona-one-v9-latin-ext_latin-regular.woff2"},{family:"Kumar One Outline",src:"fonts/kumar-one-outline-v8-latin-ext_latin-regular.woff2"},{family:"Lobster Two",src:"fonts/lobster-two-v13-latin-regular.woff2"},{family:"Molle Italic",src:"fonts/molle-v11-latin-ext_latin-italic.woff2"},{family:"Monoton",src:"fonts/monoton-v10-latin-regular.woff2"},{family:"Nixie One",src:"fonts/nixie-one-v11-latin-regular.woff2"},{family:"Permanent Marker",src:"fonts/permanent-marker-v10-latin-regular.woff2"},{family:"Sancreek",src:"fonts/sancreek-v13-latin-ext_latin-regular.woff2"},{family:"Stint Ultra Expanded",src:"fonts/stint-ultra-expanded-v10-latin-regular.woff2"},{family:"VT323",src:"fonts/vt323-v12-latin-ext_latin-regular.woff2"},{family:"Trash Hand",src:"fonts/TrashHand.ttf"}]},draw:{brushSizes:Ru,brushTypes:["PencilBrush","EraserBrush","SprayBrush","CircleBrush","DiamondBrush","VLineBrush","HLineBrush","SquareBrush"]},shapes:{items:[{name:"circle",type:"Circle"},{name:"square",type:"Rect",options:{lockUniScaling:!1}},{name:"triangle",type:"Triangle"},{name:"ellipse",type:"Ellipse",options:{lockUniScaling:!1}},{name:"Arrow #1",type:"Path",options:{path:"M 294.9 16.4 l 15.7 42.2 c -171.4 70.3 -294 242.3 -289.1 437.4 l 14.7 -1 c 9.1 -0.6 18.1 -1.2 27.1 -1.9 l 14.7 -1 c -4.3 -170.1 102.5 -320 252 -381.3 l 15.7 42.2 c 34.7 -40.5 83.1 -76.6 144.8 -99.8 c -58.1 -26.2 -124.9 -39.6 -195.6 -36.8 z"}},{name:"Arrow #2",type:"Path",options:{path:"M 16 248.4 v 14.9 h 447.5 l -93.2 82.5 l 11.9 10.5 l 113.8 -100.2 l -113.6 -100.4 l -11.8 10.5 l 92.9 82.2 z"}},{name:"Arrow #3",type:"Path",options:{path:"M 496 256 l -118.6 -66 v 40.8 h -361.4 v 50.4 h 361.4 v 40.8 l 118.6 -66 z"}},{name:"Line",type:"Path",options:{path:"M 16 256 h 480",strokeWidth:10,stroke:"#000",padding:10}},{name:"Star",type:"Path",options:{path:"M 256 406.3 l 148.3 78 l -28.3 -165.2 l 120 -117 l -165.8 -24.1 l -74.2 -150.3 l -74.2 150.3 l -165.8 24.1 l 120 117 l -28.3 165.2 z"}},{name:"Polygon",type:"Path",options:{path:"M 256 19.6 l 156.6 57.1 l 83.4 144.3 l -28.9 164.2 l -127.7 107.2 h -166.8 l -127.7 -107.2 l -28.9 -164.2 l 83.4 -144.3 z"}},{name:"Badge",type:"Path",options:{path:"M 257.3 16.2 s -148 58.2 -204.4 81.4 c 0 75.7 -16.8 303.5 204.4 398.2 c 218.7 -94.6 201.9 -322.4 201.9 -398.2 c -62.1 -23.6 -201.9 -81.4 -201.9 -81.4 z"}}].slice()},stickers:{items:Ou},import:{validImgExtensions:["png","jpg","jpeg","svg","gif"],fitOverlayToScreen:!0,openDroppedImageAsBackground:!1},export:{defaultFormat:"png",defaultQuality:.8,defaultName:"image"},frame:{items:[{name:"basic",mode:"basic",size:{min:1,max:35,default:10}},{name:"pine",mode:"stretch",size:{min:1,max:35,default:15}},{name:"oak",mode:"stretch",size:{min:1,max:35,default:15}},{name:"rainbow",mode:"stretch",size:{min:1,max:35,default:15}},{name:"grunge1",display_name:"grunge #1",mode:"stretch",size:{min:1,max:35,default:15}},{name:"grunge2",display_name:"grunge #2",mode:"stretch",size:{min:1,max:35,default:20}},{name:"ebony",mode:"stretch",size:{min:1,max:35,default:15}},{name:"art1",display_name:"Art #1",mode:"repeat",size:{min:10,max:70,default:55}},{name:"art2",display_name:"Art #2",mode:"repeat",size:{min:10,max:70,default:55}}]}}},hd=e=>{let t;const n=new Set,r=(e,r)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=r??("object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},a=t=e(r,i,o);return o};var fd={exports:{}},pd={},gd={exports:{}},md={},vd=i;
10
10
  /**
11
11
  * @license React
12
12
  * use-sync-external-store-shim.production.min.js
@@ -58,7 +58,7 @@ function OO(){return OO=Object.assign?Object.assign.bind():function(e){for(var t
58
58
  *
59
59
  * @license MIT
60
60
  */
61
- function WO(){return WO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},WO.apply(this,arguments)}new Promise(()=>{});const HO=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="6"}catch{}const qO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",GO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,YO=r.forwardRef(function(e,t){let n,{onClick:i,relative:o,reloadDocument:a,replace:s,state:l,target:c,to:u,preventScrollReset:d,unstable_viewTransition:h}=e,f=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&(i[n]=e[n]);return i}(e,HO),{basename:p}=r.useContext(MO),g=!1;if("string"==typeof u&&GO.test(u)&&(n=u,qO))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=function(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}(t.pathname,p);t.origin===e.origin&&null!=n?u=n+t.search+t.hash:g=!0}catch{}let m=function(e,t){let{relative:n}=void 0===t?{}:t;jO()||bO(!1);let{basename:i,navigator:o}=r.useContext(MO),{hash:a,pathname:s,search:l}=BO(e,{relative:n}),c=s;return"/"!==i&&(c="/"===s?i:AO([i,s])),o.createHref({pathname:c,search:l,hash:a})}(u,{relative:o}),v=function(e,t){let{target:n,replace:i,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:l}=void 0===t?{}:t,c=zO(),u=DO(),d=BO(e,{relative:s});return r.useCallback(t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==i?i:wO(u)===wO(d);c(e,{replace:n,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:l})}},[u,c,d,i,o,n,e,a,s,l])}(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:o,unstable_viewTransition:h});return r.createElement("a",WO({},f,{href:n||m,onClick:g||a?i:function(e){i&&i(e),e.defaultPrevented||v(e)},ref:t,target:c}))});var XO,KO;!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"}(XO||(XO={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(KO||(KO={}));const ZO=Vu(e("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutlineOutlined"),JO=Vu(e("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),QO={opacity:0,y:50,scale:.3},eP={opacity:1,y:0,scale:1},tP={opacity:0,scale:.5};function nP(){const n=pp(e=>e.toasts);return e("div",{className:"pointer-events-none relative",children:e(db,{initial:!1,children:n.map(n=>e("div",{className:zu("fixed z-toast mx-auto p-20","bottom-center"===n.position?"bottom-0 left-0 right-0":"bottom-0 right-0"),children:t(ib.div,{initial:n.disableEnterAnimation?void 0:QO,animate:n.disableEnterAnimation?void 0:eP,exit:n.disableExitAnimation?void 0:tP,className:zu("pointer-events-auto mx-auto flex max-h-100 min-h-50 w-min min-w-288 max-w-500 items-center gap-10 rounded-lg border bg-paper bg-paper py-6 pl-16 pr-6 text-sm text-main shadow-lg"),onPointerEnter:()=>{var e;return null==(e=n.timer)?void 0:e.pause()},onPointerLeave:()=>{var e;return null==(e=n.timer)?void 0:e.resume()},role:"alert","aria-live":"danger"===n.type?"assertive":"polite",children:["danger"===n.type&&e(ZO,{className:"flex-shrink-0 text-danger",size:"md"}),"loading"===n.type&&e(qI,{size:"sm",className:"flex-shrink-0",isIndeterminate:!0}),"positive"===n.type&&e(JO,{className:"flex-shrink-0 text-positive",size:"md"}),e("div",{className:"mr-auto w-max overflow-hidden overflow-ellipsis","data-testid":"toast-message",children:e(LS,{value:n.message})}),n.action&&e(wx,{variant:"text",color:"primary",size:"sm",className:"flex-shrink-0",onFocus:()=>{var e;return null==(e=n.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=n.timer)?void 0:e.resume()},onClick:()=>gp().remove(n.id),elementType:YO,to:n.action.action,children:e(LS,{value:n.action.label})}),"loading"!==n.type&&e(MS,{onFocus:()=>{var e;return null==(e=n.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=n.timer)?void 0:e.resume()},type:"button",className:"flex-shrink-0",onClick:()=>{gp().remove(n.id)},size:"sm",children:e(YS,{})})]})},n.id))})})}function rP(e){return Tb()?e.metaKey:e.ctrlKey}function iP(e){switch(e.key){case"z":rP(e)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?ip().history.redo():ip().history.undo());break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),ip().objects.move("up");break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),ip().objects.move("right");break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),ip().objects.move("down");break;case"ArrowLeft":e.preventDefault(),e.stopPropagation(),ip().objects.move("left");break;case"Delete":e.preventDefault(),e.stopPropagation(),ip().objects.delete();break;case"v":rP(e)&&(e.preventDefault(),e.stopPropagation(),async function(){try{const e=await navigator.clipboard.read();for(const t of e)for(const e of t.types)if(e.startsWith("image/")){const n=await t.getType(e),r=new FileReader;return r.onload=e=>{var t;null!=(t=e.target)&&t.result&&ip().import.addImageFromData(e.target.result)},void r.readAsDataURL(n)}}catch(e){console.error(e)}}())}}const oP=new Map,aP=new Map,sP={};async function*lP(e){const t=e.createReader();let n;do{n=await new Promise((e,n)=>{t.readEntries(e,n)});for(const e of n)if(e.isFile){if(".DS_Store"===e.name)continue;const t=await cP(e);yield new qw(t,e.fullPath)}else e.isDirectory&&(yield*lP(e))}while(n.length>0)}function cP(e){return new Promise((t,n)=>e.file(t,n))}function uP(e){return null!=sP.dragTargetId?oP.get(sP.dragTargetId):e.dataTransfer.types.includes("Files")?{type:"nativeFile",el:null,ref:null,getData:()=>async function(e){const t=[];for await(const n of e)t.push(n);return t}(async function*(e){const t=[];for(const n of e.items)if("file"===n.kind){const e=n.webkitGetAsEntry();e&&t.push(e)}for(const e of t)if(e.isFile){if(".DS_Store"===e.name)continue;const t=await cP(e);yield new qw(t,e.fullPath)}else e.isDirectory&&(yield*lP(e))}(e.dataTransfer))}:void 0}function dP(){const n=np(e=>{var t;return null==(t=e.config.ui)?void 0:t.visible})??!0,r=np(e=>{var t,n;return null==(n=null==(t=e.config.ui)?void 0:t.nav)?void 0:n.position})??"bottom",i=np(e=>{var t,n;return null==(n=null==(t=e.config.ui)?void 0:t.menubar)?void 0:n.position})??"top",o=np(e=>{var t;return null==(t=e.config.ui)?void 0:t.allowEditorClose})??!0,s=u(null),l=u(null),{isModal:d,isMobile:h}=XS(),f=c(async e=>{var t,n;if(rp().activeTool||rp().dirty||"nativeFile"!==e.type)return;const r=await e.getData();ip().import.fileIsValid(r[0])&&((null==(n=null==(t=rp().config.tools)?void 0:t.import)?void 0:n.openDroppedImageAsBackground)?await ip().import.openBackgroundImage(r[0]):await ip().import.openUploadedFile(r[0]))},[]),{droppableProps:p}=function({id:e,disabled:t,ref:n,...r}){const i=u({dragOverElements:new Set,dropActivateTimer:void 0}).current,o=u(r);o.current=r,x(()=>(aP.set(e,{...aP.get(e),disabled:t,id:e,ref:n}),()=>{aP.delete(e)}),[e,o,t,n]);const a=e=>{var t;const r=o.current,i=r.allowDragEventsFromItself||n.current!==(null==(t=e.ref)?void 0:t.current);return!(!(null!=e&&e.type&&i&&r.types.includes(e.type))||r.acceptsDrop&&!r.acceptsDrop(e))},s=e=>{var t,n;const r=uP(e);r&&(null==(n=(t=o.current).onDragLeave)||n.call(t,r))};return{droppableProps:t?{}:{onDragOver:e=>{var t,n;e.preventDefault(),e.stopPropagation();const r=uP(e);r&&a(r)&&(null==(n=(t=o.current).onDragOver)||n.call(t,r,e))},onDragEnter:e=>{var t,n;if(e.stopPropagation(),i.dragOverElements.add(e.target),i.dragOverElements.size>1)return;const r=uP(e);r&&a(r)&&(null==(n=(t=o.current).onDragEnter)||n.call(t,r),clearTimeout(i.dropActivateTimer),"function"==typeof o.current.onDropActivate&&(i.dropActivateTimer=setTimeout(()=>{var e,t;r&&(null==(t=(e=o.current).onDropActivate)||t.call(e,r))},400)))},onDragLeave:e=>{e.stopPropagation(),i.dragOverElements.delete(e.target);for(const t of i.dragOverElements)e.currentTarget.contains(t)||i.dragOverElements.delete(t);if(i.dragOverElements.size>0)return;const t=uP(e);t&&a(t)&&(s(e),clearTimeout(i.dropActivateTimer))},onDrop:async e=>{var t,n,r,l;e.preventDefault(),e.stopPropagation(),i.dragOverElements.clear(),s(e),clearTimeout(i.dropActivateTimer);const c=uP(e);c&&(null==(n=(t=o.current).onDragLeave)||n.call(t,c),a(c)&&(null==(l=(r=o.current).onDrop)||l.call(r,c)))}}}}({id:"pixie-root",ref:l,types:["nativeFile"],onDrop:f});a(()=>{var e,t;rp().fabric||(np.setState({canvasRef:s}),dx(s.current),null!=(e=rp().config.ui)&&e.defaultTool&&rp().setActiveTool(null==(t=rp().config.ui)?void 0:t.defaultTool,null),ip().canvas.loadInitialContent().then(()=>{var e,t;null==(t=(e=rp().config).onLoad)||t.call(e,rp().editor)}));const n=hx(l,()=>{rp().setStageSize(fx(l.current))}),r=hx(s,()=>{rp().setCanvasSize(fx(s.current))});return()=>{n(),r()}},[l]);const g=zu("pixie-root flex flex-col overflow-hidden bg-background text-main no-tap-highlight w-full h-full",{relative:!d,"fixed inset-0 w-full h-full z-20":d,"shadow-lg border rounded-md m-auto max-h-[calc(100vh-90px)] max-w-[calc(100vw-90px)]":d&&!h});return t(hb,{features:pb,strict:!0,children:[d&&n&&!h&&o&&e(MS,{className:"z-20 fixed right-2 top-2 text-white",size:"lg",onClick:()=>{rp().editor.close()},children:e(YS,{})}),d&&n&&e(j_,{position:"fixed",disableInitialTransition:!0}),t(ib.div,{initial:!1,variants:{visible:{opacity:1,scale:1,display:"flex"},hidden:{opacity:0,transitionEnd:{display:"none"}}},animate:n?"visible":"hidden",className:g,children:["top"===i&&e(nk,{}),"top"===r&&e(ZF,{className:"pt-14"}),t("main",{className:"relative flex-auto my-20 overflow-hidden outline-none",tabIndex:-1,...Ab(p,{onKeyDownCapture:iP}),ref:l,children:[e(ik,{}),e(jA,{ref:s})]}),e(BT,{}),"bottom"===r&&e(ZF,{}),"bottom"===i&&e(nk,{}),e(gO,{}),e(nP,{})]})]})}!function(){fabric.Object.ENLIVEN_PROPS.push("eraser");var e=fabric.Object.prototype._drawClipPath,t=fabric.Object.prototype.needsItsOwnCache,n=fabric.Object.prototype.toObject,r=fabric.Object.prototype.getSvgCommons,i=fabric.Object.prototype._createBaseClipPathSVGMarkup,o=fabric.Object.prototype._createBaseSVGMarkup;fabric.Object.prototype.cacheProperties.push("eraser"),fabric.Object.prototype.stateProperties.push("eraser"),fabric.util.object.extend(fabric.Object.prototype,{erasable:!0,eraser:void 0,needsItsOwnCache:function(){return t.call(this)||!!this.eraser},_drawClipPath:function(t,n){if(e.call(this,t,n),this.eraser){var r=this._getNonTransformedDimensions();this.eraser.isType("eraser")&&this.eraser.set({width:r.x,height:r.y}),e.call(this,t,this.eraser)}},toObject:function(e){var t=n.call(this,["erasable"].concat(e));return this.eraser&&!this.eraser.excludeFromExport&&(t.eraser=this.eraser.toObject(e)),t},getSvgCommons:function(){return r.call(this)+(this.eraser?'mask="url(#'+this.eraser.clipPathId+')" ':"")},_createEraserSVGMarkup:function(e){return this.eraser?(this.eraser.clipPathId="MASK_"+fabric.Object.__uid++,['<mask id="',this.eraser.clipPathId,'" >',this.eraser.toSVG(e),"</mask>","\n"].join("")):""},_createBaseClipPathSVGMarkup:function(e,t){return[this._createEraserSVGMarkup(t&&t.reviver),i.call(this,e,t)].join("")},_createBaseSVGMarkup:function(e,t){return[this._createEraserSVGMarkup(t&&t.reviver),o.call(this,e,t)].join("")}});var a=fabric.Group.prototype._restoreObjectsState;fabric.util.object.extend(fabric.Group.prototype,{_addEraserPathToObjects:function(e){this._objects.forEach(function(t){fabric.EraserBrush.prototype._addPathToObjectEraser.call(fabric.EraserBrush.prototype,t,e)})},applyEraserToObjects:function(){var e=this,t=this.eraser;if(t){delete this.eraser;var n=e.calcTransformMatrix();t.clone(function(t){var r=e.clipPath;t.getObjects("path").forEach(function(t){var i=fabric.util.multiplyTransformMatrices(n,t.calcTransformMatrix());fabric.util.applyTransformToObject(t,i),r?r.clone(function(r){var i=fabric.EraserBrush.prototype.applyClipPathToPath.call(fabric.EraserBrush.prototype,t,r,n);e._addEraserPathToObjects(i)},["absolutePositioned","inverted"]):e._addEraserPathToObjects(t)})})}},_restoreObjectsState:function(){return!0===this.erasable&&this.applyEraserToObjects(),a.call(this)}}),fabric.Eraser=fabric.util.createClass(fabric.Group,{type:"eraser",originX:"center",originY:"center",drawObject:function(e){e.save(),e.fillStyle="black",e.fillRect(-this.width/2,-this.height/2,this.width,this.height),e.restore(),this.callSuper("drawObject",e)},_getBounds:function(){},_toSVG:function(e){var t=["<g ","COMMON_PARTS"," >\n"],n=["<rect ",'fill="white" ','x="',-this.width/2,'" y="',-this.height/2,'" width="',this.width,'" height="',this.height,'" />\n'].join("");t.push("\t\t",n);for(var r=0,i=this._objects.length;r<i;r++)t.push("\t\t",this._objects[r].toSVG(e));return t.push("</g>\n"),t}}),fabric.Eraser.fromObject=function(e,t){var n=e.objects;fabric.util.enlivenObjects(n,function(n){var r=fabric.util.object.clone(e,!0);delete r.objects,fabric.util.enlivenObjectEnlivables(e,r,function(){t&&t(new fabric.Eraser(n,r,!0))})})};var s=fabric.Canvas.prototype._renderOverlay;fabric.util.object.extend(fabric.Canvas.prototype,{isErasing:function(){return this.isDrawingMode&&this.freeDrawingBrush&&"eraser"===this.freeDrawingBrush.type&&this.freeDrawingBrush._isErasing},_renderOverlay:function(e){s.call(this,e),this.isErasing()&&!this.freeDrawingBrush.inverted&&this.freeDrawingBrush._render()}}),fabric.EraserBrush=fabric.util.createClass(fabric.PencilBrush,{type:"eraser",inverted:!1,_isErasing:!1,_isErasable:function(e){return!1!==e.erasable},_prepareCollectionTraversal:function(e,t,n){e.forEachObject(function(r){r.forEachObject&&"deep"===r.erasable?this._prepareCollectionTraversal(r,t,n):!this.inverted&&r.erasable&&r.visible?(r.visible=!1,e.dirty=!0,n.visibility.push(r),n.collection.push(e)):this.inverted&&r.visible&&(r.erasable&&r.eraser?(r.eraser.inverted=!0,r.dirty=!0,e.dirty=!0,n.eraser.push(r),n.collection.push(e)):(r.visible=!1,e.dirty=!0,n.visibility.push(r),n.collection.push(e)))},this)},preparePattern:function(){this._patternCanvas||(this._patternCanvas=fabric.util.createCanvasElement());var e=this._patternCanvas;e.width=this.canvas.width,e.height=this.canvas.height;var t=e.getContext("2d");if(this.canvas._isRetinaScaling()){var n=this.canvas.getRetinaScaling();this.canvas.__initRetinaScaling(n,e,t)}var r=this.canvas.backgroundImage,i=r&&this._isErasable(r),o=this.canvas.overlayImage,a=o&&this._isErasable(o);if(!this.inverted&&(r&&!i||this.canvas.backgroundColor))i&&(this.canvas.backgroundImage=void 0),this.canvas._renderBackground(t),i&&(this.canvas.backgroundImage=r);else if(this.inverted&&r&&i){var l=this.canvas.backgroundColor;this.canvas.backgroundColor=void 0,this.canvas._renderBackground(t),this.canvas.backgroundColor=l}t.save(),t.transform.apply(t,this.canvas.viewportTransform);var c={visibility:[],eraser:[],collection:[]};if(this._prepareCollectionTraversal(this.canvas,t,c),this.canvas._renderObjects(t,this.canvas._objects),c.visibility.forEach(function(e){e.visible=!0}),c.eraser.forEach(function(e){e.eraser.inverted=!1,e.dirty=!0}),c.collection.forEach(function(e){e.dirty=!0}),t.restore(),!this.inverted&&(o&&!a||this.canvas.overlayColor))a&&(this.canvas.overlayImage=void 0),s.call(this.canvas,t),a&&(this.canvas.overlayImage=o);else if(this.inverted&&o&&a){l=this.canvas.overlayColor;this.canvas.overlayColor=void 0,s.call(this.canvas,t),this.canvas.overlayColor=l}},_setBrushStyles:function(e){this.callSuper("_setBrushStyles",e),e.strokeStyle="black"},_saveAndTransform:function(e){this.callSuper("_saveAndTransform",e),this._setBrushStyles(e),e.globalCompositeOperation=e===this.canvas.getContext()?"destination-out":"source-over"},needsFullRender:function(){return!0},onMouseDown:function(e,t){this.canvas._isMainEvent(t.e)&&(this._prepareForDrawing(e),this._captureDrawingPath(e),this.preparePattern(),this._isErasing=!0,this.canvas.fire("erasing:start"),this._render())},_render:function(){var e;this.inverted||(e=this.canvas.getContext(),this.callSuper("_render",e)),e=this.canvas.contextTop,this.canvas.clearContext(e),this.callSuper("_render",e),e.save();var t=1/this.canvas.getRetinaScaling();e.scale(t,t),e.globalCompositeOperation="source-in",e.drawImage(this._patternCanvas,0,0),e.restore()},createPath:function(e){var t=this.callSuper("createPath",e);return t.globalCompositeOperation=this.inverted?"source-over":"destination-out",t.stroke=this.inverted?"white":"black",t},applyClipPathToPath:function(e,t,n){var r=fabric.util.invertTransform(e.calcTransformMatrix()),i=t.calcTransformMatrix(),o=t.absolutePositioned?r:fabric.util.multiplyTransformMatrices(r,n);return t.absolutePositioned=!1,fabric.util.applyTransformToObject(t,fabric.util.multiplyTransformMatrices(o,i)),e.clipPath=e.clipPath?fabric.util.mergeClipPaths(t,e.clipPath):t,e},clonePathWithClipPath:function(e,t,n){var r=t.calcTransformMatrix(),i=t.clipPath,o=this;e.clone(function(e){i.clone(function(t){n(o.applyClipPathToPath(e,t,r))},["absolutePositioned","inverted"])})},_addPathToObjectEraser:function(e,t){var n=this;if(e.forEachObject&&"deep"===e.erasable){var r=e._objects.filter(function(e){return e.erasable});r.length>0&&e.clipPath?this.clonePathWithClipPath(t,e,function(e){r.forEach(function(t){n._addPathToObjectEraser(t,e)})}):r.length>0&&r.forEach(function(e){n._addPathToObjectEraser(e,t)})}else{var i=e.eraser;i||(i=new fabric.Eraser,e.eraser=i),t.clone(function(t){var r=fabric.util.multiplyTransformMatrices(fabric.util.invertTransform(e.calcTransformMatrix()),t.calcTransformMatrix());fabric.util.applyTransformToObject(t,r),i.addWithUpdate(t),e.set("dirty",!0),e.fire("erasing:end",{path:t}),e.group&&Array.isArray(n.__subTargets)&&n.__subTargets.push(e)})}},applyEraserToCanvas:function(e){var t=this.canvas,n={};return["backgroundImage","overlayImage"].forEach(function(r){var i=t[r];i&&i.erasable&&(this._addPathToObjectEraser(i,e),n[r]=i)},this),n},_finalizeAndAddPath:function(){var e=this.canvas.contextTop,t=this.canvas;e.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate)),t.clearContext(t.contextTop),this._isErasing=!1;var n=this._points&&this._points.length>1?this.convertPointsToSVGPath(this._points):null;if(!n||this._isEmptySVGPath(n))return t.fire("erasing:end"),void t.requestRenderAll();var r=this.createPath(n);r.setCoords(),t.fire("before:path:created",{path:r});var i=this.applyEraserToCanvas(r),o=this;this.__subTargets=[];var a=[];t.forEachObject(function(e){e.erasable&&e.intersectsWithObject(r,!0,!0)&&(o._addPathToObjectEraser(e,r),a.push(e))}),t.fire("erasing:end",{path:r,targets:a,subTargets:this.__subTargets,drawables:i}),delete this.__subTargets,t.requestRenderAll(),this._resetShadow(),t.fire("path:created",{path:r})}})}(),sa.enableBoundaryChecking(!1);const hP=class t{constructor(t){if(Ko(this,"tools",{}),Ko(this,"fabric",null),t.sentryDsn&&function(e){const t={...e};fc(t,"react"),Su(t)}({dsn:t.sentryDsn}),function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}('/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/.pi *,.pi :after,.pi :before{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity));border-style:solid;border-width:0;box-sizing:border-box}.pi :after,.pi :before{--tw-content:""}.pi hr{border-top-width:1px;color:inherit;height:0}.pi abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6{font-size:inherit;font-weight:inherit}.pi a{color:inherit;text-decoration:inherit}.pi b,.pi strong{font-weight:bolder}.pi code,.pi kbd,.pi pre,.pi samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.pi small{font-size:80%}.pi sub,.pi sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.pi sub{bottom:-.25em}.pi sup{top:-.5em}.pi table{border-collapse:collapse;border-color:inherit;text-indent:0}.pi button,.pi input,.pi optgroup,.pi select,.pi textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}.pi button,.pi select{text-transform:none}.pi [type=button],.pi [type=reset],.pi [type=submit],.pi button{-webkit-appearance:button;background-color:transparent;background-image:none}.pi :-moz-focusring{outline:auto}.pi :-moz-ui-invalid{box-shadow:none}.pi progress{vertical-align:baseline}.pi ::-webkit-inner-spin-button,.pi ::-webkit-outer-spin-button{height:auto}.pi [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.pi ::-webkit-search-decoration{-webkit-appearance:none}.pi ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.pi summary{display:list-item}.pi blockquote,.pi dd,.pi dl,.pi figure,.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6,.pi hr,.pi p,.pi pre{margin:0}.pi fieldset{margin:0;padding:0}.pi legend{padding:0}.pi menu,.pi ol,.pi ul{list-style:none;margin:0;padding:0}.pi textarea{resize:vertical}.pi input::-moz-placeholder,.pi textarea::-moz-placeholder{color:#9ca3af;opacity:1}.pi input::placeholder,.pi textarea::placeholder{color:#9ca3af;opacity:1}.pi [role=button],.pi button{cursor:pointer}.pi :disabled{cursor:default}.pi audio,.pi canvas,.pi embed,.pi iframe,.pi img,.pi object,.pi svg,.pi video{display:block;vertical-align:middle}.pi img,.pi video{height:auto;max-width:100%}.pi [hidden]{display:none}.pi *,.pi :after,.pi :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi ::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi .\\!container{width:100%!important}.pi .container{width:100%}@media (min-width:640px){.pi .\\!container{max-width:640px!important}.pi .container{max-width:640px}}@media (min-width:768px){.pi .\\!container{max-width:768px!important}.pi .container{max-width:768px}}@media (min-width:1024px){.pi .\\!container{max-width:1024px!important}.pi .container{max-width:1024px}}@media (min-width:1280px){.pi .\\!container{max-width:1280px!important}.pi .container{max-width:1280px}}@media (min-width:1536px){.pi .\\!container{max-width:1536px!important}.pi .container{max-width:1536px}}.pi .sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pi .pointer-events-none{pointer-events:none}.pi .pointer-events-auto{pointer-events:auto}.pi .\\!visible{visibility:visible!important}.pi .visible{visibility:visible}.pi .invisible{visibility:hidden}.pi .collapse{visibility:collapse}.pi .static{position:static}.pi .fixed{position:fixed}.pi .absolute{position:absolute}.pi .relative{position:relative}.pi .inset-0{top:0;right:0;bottom:0;left:0}.pi .inset-x-0{left:0;right:0}.pi .-bottom-10{bottom:-10px}.pi .-bottom-20{bottom:-20px}.pi .-bottom-5{bottom:-5px}.pi .-left-5{left:-5px}.pi .-left-8{left:-8px}.pi .-left-80{left:-80px}.pi .-right-5{right:-5px}.pi .-top-144{top:-144px}.pi .-top-40{top:-40px}.pi .-top-5{top:-5px}.pi .bottom-0{bottom:0}.pi .bottom-20{bottom:20px}.pi .left-0{left:0}.pi .left-1\\/2{left:50%}.pi .left-20{left:20px}.pi .right-0{right:0}.pi .right-16{right:16px}.pi .right-2{right:2px}.pi .right-20{right:20px}.pi .right-4{right:4px}.pi .top-0{top:0}.pi .top-1\\/2{top:50%}.pi .top-2{top:2px}.pi .isolate{isolation:isolate}.pi .z-10{z-index:10}.pi .z-20{z-index:20}.pi .z-50{z-index:50}.pi .z-cropzone{z-index:10}.pi .z-loading-indicator{z-index:50}.pi .z-modal{z-index:110}.pi .z-navbar{z-index:40}.pi .z-obj-box{z-index:20}.pi .z-popover{z-index:130}.pi .z-toast{z-index:160}.pi .z-tool-overlay{z-index:30}.pi .z-tooltip{z-index:150}.pi .z-tray{z-index:120}.pi .m-auto{margin:auto}.pi .mx-20{margin-left:20px;margin-right:20px}.pi .mx-8{margin-left:8px;margin-right:8px}.pi .mx-auto{margin-left:auto;margin-right:auto}.pi .my-20{margin-bottom:20px;margin-top:20px}.pi .my-4{margin-bottom:4px;margin-top:4px}.pi .my-6{margin-bottom:6px;margin-top:6px}.pi .my-8{margin-bottom:8px;margin-top:8px}.pi .my-auto{margin-bottom:auto;margin-top:auto}.pi .-ml-1{margin-left:-1px}.pi .-ml-10{margin-left:-10px}.pi .-ml-12{margin-left:-12px}.pi .-ml-3{margin-left:-3px}.pi .-ml-4{margin-left:-4px}.pi .-ml-6{margin-left:-6px}.pi .-mr-4{margin-right:-4px}.pi .-mr-8{margin-right:-8px}.pi .mb-1{margin-bottom:1px}.pi .mb-10{margin-bottom:10px}.pi .mb-16{margin-bottom:16px}.pi .mb-2{margin-bottom:2px}.pi .mb-20{margin-bottom:20px}.pi .mb-24{margin-bottom:24px}.pi .mb-4{margin-bottom:4px}.pi .mb-6{margin-bottom:6px}.pi .mb-8{margin-bottom:8px}.pi .ml-10{margin-left:10px}.pi .ml-12{margin-left:12px}.pi .ml-4{margin-left:4px}.pi .ml-6{margin-left:6px}.pi .ml-8{margin-left:8px}.pi .ml-auto{margin-left:auto}.pi .mr-10{margin-right:10px}.pi .mr-16{margin-right:16px}.pi .mr-20{margin-right:20px}.pi .mr-4{margin-right:4px}.pi .mr-5{margin-right:5px}.pi .mr-6{margin-right:6px}.pi .mr-8{margin-right:8px}.pi .mr-auto{margin-right:auto}.pi .mt-0{margin-top:0}.pi .mt-10{margin-top:10px}.pi .mt-14{margin-top:14px}.pi .mt-20{margin-top:20px}.pi .mt-24{margin-top:24px}.pi .mt-4{margin-top:4px}.pi .mt-6{margin-top:6px}.pi .box-content{box-sizing:content-box}.pi .block{display:block}.pi .inline-block{display:inline-block}.pi .inline{display:inline}.pi .flex{display:flex}.pi .inline-flex{display:inline-flex}.pi .grid{display:grid}.pi .contents{display:contents}.pi .hidden{display:none}.pi .aspect-square{aspect-ratio:1/1}.pi .h-1{height:1px}.pi .h-12{height:12px}.pi .h-128{height:128px}.pi .h-14{height:14px}.pi .h-16{height:16px}.pi .h-18{height:18px}.pi .h-2{height:2px}.pi .h-2\\/4{height:50%}.pi .h-20{height:20px}.pi .h-22{height:22px}.pi .h-24{height:24px}.pi .h-26{height:26px}.pi .h-28{height:28px}.pi .h-3{height:3px}.pi .h-30{height:30px}.pi .h-32{height:32px}.pi .h-36{height:36px}.pi .h-38{height:2.375rem}.pi .h-4{height:4px}.pi .h-40{height:40px}.pi .h-42{height:42px}.pi .h-48{height:48px}.pi .h-50{height:50px}.pi .h-56{height:56px}.pi .h-6{height:6px}.pi .h-60{height:60px}.pi .h-64{height:64px}.pi .h-68{height:68px}.pi .h-8{height:8px}.pi .h-80{height:80px}.pi .h-84{height:84px}.pi .h-92{height:92px}.pi .h-\\[54px\\]{height:54px}.pi .h-font{height:1em}.pi .h-full{height:100%}.pi .h-px{height:1px}.pi .h-screen{height:100dvh}.pi .max-h-100{max-height:6.25rem}.pi .max-h-\\[calc\\(100\\%-40px\\)\\]{max-height:calc(100% - 40px)}.pi .max-h-\\[calc\\(100vh-90px\\)\\]{max-height:calc(100vh - 90px)}.pi .max-h-dialog{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-full{max-height:100%}.pi .max-h-inherit{max-height:inherit}.pi .max-h-tray{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .min-h-24{min-height:24px}.pi .min-h-30{min-height:30px}.pi .min-h-36{min-height:36px}.pi .min-h-42{min-height:42px}.pi .min-h-50{min-height:50px}.pi .min-h-60{min-height:60px}.pi .min-h-86{min-height:86px}.pi .\\!w-auto{width:auto!important}.pi .w-1\\/2{width:50%}.pi .w-110{width:110px}.pi .w-12{width:12px}.pi .w-1280{width:80rem}.pi .w-14{width:14px}.pi .w-144{width:144px}.pi .w-16{width:16px}.pi .w-18{width:18px}.pi .w-2{width:2px}.pi .w-20{width:20px}.pi .w-22{width:22px}.pi .w-224{width:224px}.pi .w-24{width:24px}.pi .w-256{width:256px}.pi .w-26{width:26px}.pi .w-28{width:28px}.pi .w-280{width:17.5rem}.pi .w-30{width:30px}.pi .w-32{width:32px}.pi .w-320{width:320px}.pi .w-36{width:36px}.pi .w-38{width:2.375rem}.pi .w-384{width:384px}.pi .w-40{width:40px}.pi .w-42{width:42px}.pi .w-440{width:27.5rem}.pi .w-46{width:2.875rem}.pi .w-50{width:50px}.pi .w-56{width:56px}.pi .w-60{width:60px}.pi .w-620{width:38.75rem}.pi .w-64{width:64px}.pi .w-68{width:68px}.pi .w-780{width:48.75rem}.pi .w-8{width:8px}.pi .w-80{width:80px}.pi .w-850{width:53.125rem}.pi .w-96{width:96px}.pi .w-\\[4ch\\]{width:4ch}.pi .w-auto{width:auto}.pi .w-font{width:1em}.pi .w-full{width:100%}.pi .w-max{width:-moz-max-content;width:max-content}.pi .w-min{width:-moz-min-content;width:min-content}.pi .w-px{width:1px}.pi .w-screen{width:100vw}.pi .min-w-0{min-width:0}.pi .min-w-128{min-width:128px}.pi .min-w-180{min-width:11.25rem}.pi .min-w-192{min-width:192px}.pi .min-w-288{min-width:288px}.pi .min-w-30{min-width:30px}.pi .min-w-4{min-width:4px}.pi .min-w-42{min-width:42px}.pi .min-w-92{min-width:92px}.pi .min-w-min{min-width:-moz-min-content;min-width:min-content}.pi .max-w-112{max-width:112px}.pi .max-w-240{max-width:240px}.pi .max-w-288{max-width:288px}.pi .max-w-320{max-width:320px}.pi .max-w-375{max-width:375px}.pi .max-w-500{max-width:31.25rem}.pi .max-w-\\[90\\%\\]{max-width:90%}.pi .max-w-\\[calc\\(100\\%-40px\\)\\]{max-width:calc(100% - 40px)}.pi .max-w-\\[calc\\(100vw-90px\\)\\]{max-width:calc(100vw - 90px)}.pi .max-w-dialog{max-width:calc(var(--be-viewport-width, 100vw)*.9)}.pi .max-w-full{max-width:100%}.pi .max-w-max{max-width:-moz-max-content;max-width:max-content}.pi .flex-\\[1_1_60px\\]{flex:1 1 60px}.pi .flex-auto{flex:1 1 auto}.pi .flex-shrink-0,.pi .shrink-0{flex-shrink:0}.pi .origin-\\[0_55\\%\\]{transform-origin:0 55%}.pi .origin-\\[100\\%\\]{transform-origin:100%}.pi .-translate-x-1\\/2{--tw-translate-x:-50%}.pi .-translate-x-1\\/2,.pi .-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .-translate-y-1\\/2{--tw-translate-y:-50%}.pi .rotate-0{--tw-rotate:0deg}.pi .rotate-0,.pi .rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-180{--tw-rotate:180deg}.pi .rotate-45{--tw-rotate:45deg}.pi .rotate-45,.pi .rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-90{--tw-rotate:90deg}.pi .scale-y-\\[0\\.6\\]{--tw-scale-y:.6}.pi .scale-y-\\[0\\.6\\],.pi .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .cursor-default{cursor:default}.pi .cursor-move{cursor:move}.pi .cursor-nesw-resize{cursor:nesw-resize}.pi .cursor-not-allowed{cursor:not-allowed}.pi .cursor-nwse-resize{cursor:nwse-resize}.pi .cursor-pointer{cursor:pointer}.pi .cursor-se-resize{cursor:se-resize}.pi .cursor-sw-resize{cursor:sw-resize}.pi .touch-none{touch-action:none}.pi .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pi .resize{resize:both}.pi .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.pi .grid-cols-5-min-content{grid-template-columns:repeat(5,min-content)}.pi .flex-row{flex-direction:row}.pi .flex-col{flex-direction:column}.pi .flex-col-reverse{flex-direction:column-reverse}.pi .flex-wrap{flex-wrap:wrap}.pi .flex-nowrap{flex-wrap:nowrap}.pi .items-start{align-items:flex-start}.pi .items-end{align-items:flex-end}.pi .items-center{align-items:center}.pi .items-stretch{align-items:stretch}.pi .justify-start{justify-content:flex-start}.pi .justify-center{justify-content:center}.pi .justify-between{justify-content:space-between}.pi .gap-10{gap:10px}.pi .gap-14{gap:14px}.pi .gap-16{gap:16px}.pi .gap-18{gap:18px}.pi .gap-20{gap:20px}.pi .gap-36{gap:36px}.pi .gap-4{gap:4px}.pi .gap-40{gap:40px}.pi .gap-6{gap:6px}.pi .gap-8{gap:8px}.pi .space-y-10>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(10px*var(--tw-space-y-reverse));margin-top:calc(10px*(1 - var(--tw-space-y-reverse)))}.pi .overflow-auto{overflow:auto}.pi .overflow-hidden{overflow:hidden}.pi .overflow-x-auto{overflow-x:auto}.pi .overflow-y-auto{overflow-y:auto}.pi .overflow-x-hidden{overflow-x:hidden}.pi .overflow-y-hidden{overflow-y:hidden}.pi .overscroll-contain{overscroll-behavior:contain}.pi .truncate{overflow:hidden;white-space:nowrap}.pi .overflow-ellipsis,.pi .text-ellipsis,.pi .truncate{text-overflow:ellipsis}.pi .whitespace-normal{white-space:normal}.pi .whitespace-nowrap{white-space:nowrap}.pi .break-words{overflow-wrap:break-word}.pi .rounded{border-radius:4px}.pi .rounded-2xl{border-radius:16px}.pi .rounded-3xl{border-radius:24px}.pi .rounded-button{border-radius:var(--be-button-radius,.25rem)}.pi .rounded-full{border-radius:9999px}.pi .rounded-input{border-radius:var(--be-input-radius,.25rem)}.pi .rounded-lg{border-radius:8px}.pi .rounded-md{border-radius:6px}.pi .rounded-none{border-radius:0}.pi .rounded-panel{border-radius:var(--be-panel-radius,.25rem)}.pi .rounded-xl{border-radius:12px}.pi .rounded-l{border-bottom-left-radius:4px;border-top-left-radius:4px}.pi .rounded-l-full{border-bottom-left-radius:9999px;border-top-left-radius:9999px}.pi .rounded-l-input{border-bottom-left-radius:var(--be-input-radius,.25rem);border-top-left-radius:var(--be-input-radius,.25rem)}.pi .rounded-l-none{border-bottom-left-radius:0;border-top-left-radius:0}.pi .rounded-r-full{border-bottom-right-radius:9999px;border-top-right-radius:9999px}.pi .rounded-r-input{border-bottom-right-radius:var(--be-input-radius,.25rem);border-top-right-radius:var(--be-input-radius,.25rem)}.pi .rounded-r-none{border-bottom-right-radius:0;border-top-right-radius:0}.pi .rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.pi .rounded-bl-none{border-bottom-left-radius:0}.pi .rounded-br-none{border-bottom-right-radius:0}.pi .rounded-tl-none{border-top-left-radius:0}.pi .rounded-tr-none{border-top-right-radius:0}.pi .border{border-width:1px}.pi .border-2{border-width:2px}.pi .border-4{border-width:4px}.pi .border-\\[3px\\]{border-width:3px}.pi .border-y{border-top-width:1px}.pi .border-b,.pi .border-y{border-bottom-width:1px}.pi .border-b-4{border-bottom-width:4px}.pi .border-l{border-left-width:1px}.pi .border-l-4{border-left-width:4px}.pi .border-r{border-right-width:1px}.pi .border-r-4{border-right-width:4px}.pi .border-t{border-top-width:1px}.pi .border-t-4{border-top-width:4px}.pi .border-dotted{border-style:dotted}.pi .border-none{border-style:none}.pi .border-background{--tw-border-opacity:1;border-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-bg-alt{--tw-border-opacity:1;border-color:rgb(var(--be-background-alt)/var(--tw-border-opacity))}.pi .border-chip{--tw-border-opacity:1;border-color:rgb(var(--be-background-chip)/var(--tw-border-opacity))}.pi .border-danger{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-danger\\/50{border-color:#ef444480}.pi .border-divider{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .border-paper{--tw-border-opacity:1;border-color:rgb(var(--be-paper)/var(--tw-border-opacity))}.pi .border-positive\\/50{border-color:#22c55e80}.pi .border-primary{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-primary\\/50{border-color:rgb(var(--be-primary)/.5)}.pi .border-text-muted{border-color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .border-transparent{border-color:transparent}.pi .border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .border-white\\/50{border-color:#ffffff80}.pi .border-b-bg{--tw-border-opacity:1;border-bottom-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-b-transparent{border-bottom-color:transparent}.pi .border-r-transparent{border-right-color:transparent}.pi .bg{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-alt{--tw-bg-opacity:1;background-color:rgb(var(--be-background-alt)/var(--tw-bg-opacity))}.pi .bg-background{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-background\\/70{background-color:rgb(var(--be-background)/.7)}.pi .bg-background\\/80{background-color:rgb(var(--be-background)/.8)}.pi .bg-black\\/50{background-color:#00000080}.pi .bg-black\\/80{background-color:#000c}.pi .bg-chip{--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi .bg-controls{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-danger{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .bg-danger-lighter{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.pi .bg-divider{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .bg-fg-base\\/4{background-color:rgb(var(--be-foreground-base)/4%)}.pi .bg-focus{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .bg-inherit{background-color:inherit}.pi .bg-paper{--tw-bg-opacity:1;background-color:rgb(var(--be-paper)/var(--tw-bg-opacity))}.pi .bg-positive{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.pi .bg-positive-lighter{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.pi .bg-primary{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .bg-primary-dark{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .bg-primary-light{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-light)/var(--tw-bg-opacity))}.pi .bg-primary\\/focus{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .bg-primary\\/selected{background-color:rgb(var(--be-primary)/var(--be-selected-opacity))}.pi .bg-slider-disabled{--tw-bg-opacity:1;background-color:rgb(189 189 189/var(--tw-bg-opacity))}.pi .bg-slider-disabled\\/60{background-color:#bdbdbd99}.pi .bg-toast{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-transparent{background-color:transparent}.pi .bg-warning{--tw-bg-opacity:1;background-color:rgb(243 164 50/var(--tw-bg-opacity))}.pi .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .bg-white\\/50{background-color:#ffffff80}.pi .bg-opacity-95{--tw-bg-opacity:.95}.pi .bg-no-repeat{background-repeat:no-repeat}.pi .fill-current{fill:currentColor}.pi .fill-transparent{fill:transparent}.pi .stroke-current{stroke:currentColor}.pi .object-contain{-o-object-fit:contain;object-fit:contain}.pi .object-cover{-o-object-fit:cover;object-fit:cover}.pi .p-0{padding:0}.pi .p-10{padding:10px}.pi .p-14{padding:14px}.pi .p-16{padding:16px}.pi .p-18{padding:18px}.pi .p-2{padding:2px}.pi .p-20{padding:20px}.pi .p-4{padding:4px}.pi .p-40{padding:40px}.pi .p-6{padding:6px}.pi .p-8{padding:8px}.pi .px-10{padding-left:10px;padding-right:10px}.pi .px-12{padding-left:12px;padding-right:12px}.pi .px-14{padding-left:14px;padding-right:14px}.pi .px-16{padding-left:16px;padding-right:16px}.pi .px-18{padding-left:18px;padding-right:18px}.pi .px-20{padding-left:20px;padding-right:20px}.pi .px-22{padding-left:22px;padding-right:22px}.pi .px-24{padding-left:24px;padding-right:24px}.pi .px-26{padding-left:26px;padding-right:26px}.pi .px-32{padding-left:32px;padding-right:32px}.pi .px-4{padding-left:4px;padding-right:4px}.pi .px-5vw{padding-left:5vw;padding-right:5vw}.pi .px-6{padding-left:6px;padding-right:6px}.pi .px-8{padding-left:8px;padding-right:8px}.pi .py-10{padding-bottom:10px;padding-top:10px}.pi .py-12{padding-bottom:12px;padding-top:12px}.pi .py-14{padding-bottom:14px;padding-top:14px}.pi .py-2{padding-bottom:2px;padding-top:2px}.pi .py-20{padding-bottom:20px;padding-top:20px}.pi .py-3{padding-bottom:3px;padding-top:3px}.pi .py-4{padding-bottom:4px;padding-top:4px}.pi .py-5{padding-bottom:5px;padding-top:5px}.pi .py-6{padding-bottom:6px;padding-top:6px}.pi .py-8{padding-bottom:8px;padding-top:8px}.pi .py-\\[9px\\]{padding-bottom:9px;padding-top:9px}.pi .pb-10{padding-bottom:10px}.pi .pb-12{padding-bottom:12px}.pi .pb-14{padding-bottom:14px}.pi .pb-16{padding-bottom:16px}.pi .pb-18{padding-bottom:18px}.pi .pb-20{padding-bottom:20px}.pi .pb-4{padding-bottom:4px}.pi .pb-8{padding-bottom:8px}.pi .pb-safe-area{padding-bottom:env(safe-area-inset-bottom)}.pi .pl-10{padding-left:10px}.pi .pl-12{padding-left:12px}.pi .pl-14{padding-left:14px}.pi .pl-16{padding-left:16px}.pi .pl-18{padding-left:18px}.pi .pl-28{padding-left:28px}.pi .pl-46{padding-left:2.875rem}.pi .pl-54{padding-left:3.375rem}.pi .pl-8{padding-left:8px}.pi .pr-10{padding-right:10px}.pi .pr-12{padding-right:12px}.pi .pr-18{padding-right:18px}.pi .pr-24{padding-right:24px}.pi .pr-28{padding-right:28px}.pi .pr-46{padding-right:2.875rem}.pi .pr-54{padding-right:3.375rem}.pi .pr-6{padding-right:6px}.pi .pr-8{padding-right:8px}.pi .pt-10{padding-top:10px}.pi .pt-12{padding-top:12px}.pi .pt-14{padding-top:14px}.pi .pt-16{padding-top:16px}.pi .pt-20{padding-top:20px}.pi .pt-24{padding-top:24px}.pi .pt-4{padding-top:4px}.pi .pt-40{padding-top:40px}.pi .pt-6{padding-top:6px}.pi .text-left{text-align:left}.pi .text-center{text-align:center}.pi .text-right{text-align:right}.pi .align-middle{vertical-align:middle}.pi .text-base{font-size:16px;line-height:24px}.pi .text-lg{font-size:18px;line-height:28px}.pi .text-sm{font-size:14px;line-height:20px}.pi .text-xl{font-size:20px;line-height:28px}.pi .text-xs{font-size:12px;line-height:16px}.pi .font-bold{font-weight:700}.pi .font-medium{font-weight:500}.pi .font-semibold{font-weight:600}.pi .uppercase{text-transform:uppercase}.pi .capitalize{text-transform:capitalize}.pi .italic{font-style:italic}.pi .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.pi .leading-5{line-height:1.25rem}.pi .leading-none{line-height:1}.pi .tracking-wide{letter-spacing:.025em}.pi .\\!text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))!important}.pi .text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.pi .text-black\\/30{color:#0000004d}.pi .text-danger{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.pi .text-danger-darker{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.pi .text-disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .text-link{--tw-text-opacity:1;color:rgb(var(--be-link-color,var(--be-primary))/var(--tw-text-opacity))}.pi .text-main{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-muted{color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .text-on-primary{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .text-positive{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.pi .text-positive-darker{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.pi .text-primary{--tw-text-opacity:1;color:rgb(var(--be-primary)/var(--tw-text-opacity))}.pi .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.pi .underline{text-decoration-line:underline}.pi .no-underline{text-decoration-line:none}.pi .caret-transparent{caret-color:transparent}.pi .opacity-0{opacity:0}.pi .opacity-100{opacity:1}.pi .opacity-70{opacity:.7}.pi .opacity-80{opacity:.8}.pi .opacity-90{opacity:.9}.pi .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.pi .shadow,.pi .shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.pi .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.pi .shadow-lg,.pi .shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.pi .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.pi .shadow-sm,.pi .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.pi .outline-none{outline:2px solid transparent;outline-offset:2px}.pi .outline{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .ring-inset{--tw-ring-inset:inset}.pi .blur{--tw-blur:blur(8px)}.pi .blur,.pi .grayscale{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .grayscale{--tw-grayscale:grayscale(100%)}.pi .invert{--tw-invert:invert(100%)}.pi .invert,.pi .sepia{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .sepia{--tw-sepia:sepia(100%)}.pi .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.pi .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-button{transition-duration:.15s;transition-property:background-color,box-shadow,border-color,color;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-shadow{transition-duration:.15s;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-width{transition-duration:.15s;transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .duration-100{transition-duration:.1s}.pi .duration-200{transition-duration:.2s}.pi .will-change-transform{will-change:transform}.pi .icon-2xs{font-size:.75rem}.pi .icon-xs{font-size:1rem}.pi .icon-sm{font-size:1.25rem}.pi .icon-md{font-size:1.5rem}.pi .icon-lg{font-size:2.1875rem}.pi .icon-xl{font-size:2.6875rem}.pi .no-tap-highlight{-webkit-tap-highlight-color:transparent}@media only screen and (min-device-width:768px){.pi .tiny-scrollbar{scrollbar-color:rgba(0,0,0,.2) transparent;scrollbar-width:thin}.pi .tiny-scrollbar::-webkit-scrollbar{background-color:transparent;height:6px;width:6px}.pi .tiny-scrollbar::-webkit-scrollbar-thumb{background-color:rgb(var(--be-foreground-base)/.2);border-radius:10px}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:start{background:transparent}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:end{background:transparent}}.pi .hide-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.pi .hide-scrollbar::-webkit-scrollbar{background:transparent;display:none;height:0;width:0}.pi .svg-icon{display:inline-block;flex-shrink:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;fill:currentColor;transition-duration:.15s;transition-property:transform,fill;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .cropzone:not(.moving) .cropzone-transition{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .first-letter\\:capitalize:first-letter{text-transform:capitalize}.pi .file\\:mr-10::file-selector-button{margin-right:10px}.pi .file\\:h-24::file-selector-button{height:24px}.pi .file\\:rounded::file-selector-button{border-radius:4px}.pi .file\\:border-none::file-selector-button{border-style:none}.pi .file\\:bg-primary::file-selector-button{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .file\\:px-10::file-selector-button{padding-left:10px;padding-right:10px}.pi .file\\:text-sm::file-selector-button{font-size:14px;line-height:20px}.pi .file\\:font-semibold::file-selector-button{font-weight:600}.pi .file\\:text-on-primary::file-selector-button{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .before\\:z-10:before{content:var(--tw-content);z-index:10}.pi .before\\:block:before{content:var(--tw-content);display:block}.pi .before\\:h-12:before{content:var(--tw-content);height:12px}.pi .before\\:h-14:before{content:var(--tw-content);height:14px}.pi .before\\:h-18:before{content:var(--tw-content);height:18px}.pi .before\\:h-22:before{content:var(--tw-content);height:22px}.pi .before\\:h-28:before{content:var(--tw-content);height:28px}.pi .before\\:h-full:before{content:var(--tw-content);height:100%}.pi .before\\:w-12:before{content:var(--tw-content);width:12px}.pi .before\\:w-14:before{content:var(--tw-content);width:14px}.pi .before\\:w-18:before{content:var(--tw-content);width:18px}.pi .before\\:w-22:before{content:var(--tw-content);width:22px}.pi .before\\:w-28:before{content:var(--tw-content);width:28px}.pi .before\\:w-full:before{content:var(--tw-content);width:100%}.pi .before\\:translate-x-2:before{--tw-translate-x:2px}.pi .before\\:scale-10:before,.pi .before\\:translate-x-2:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .before\\:scale-10:before{--tw-scale-x:.1;--tw-scale-y:.1}.pi .before\\:rounded-3xl:before{border-radius:24px;content:var(--tw-content)}.pi .before\\:rounded-full:before{border-radius:9999px;content:var(--tw-content)}.pi .before\\:border:before{border-width:1px;content:var(--tw-content)}.pi .before\\:bg-primary:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .before\\:bg-white:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .before\\:opacity-0:before{content:var(--tw-content);opacity:0}.pi .before\\:transition:before{content:var(--tw-content);transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:transition-transform:before{content:var(--tw-content);transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:duration-200:before{content:var(--tw-content);transition-duration:.2s}.pi .after\\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.pi .after\\:absolute:after{content:var(--tw-content);position:absolute}.pi .after\\:inset-0:after{content:var(--tw-content);top:0;right:0;bottom:0;left:0}.pi .checked\\:border-danger:checked{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .checked\\:border-primary:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .checked\\:bg-danger:checked{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .checked\\:bg-primary:checked{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .checked\\:before\\:translate-x-14:checked:before{--tw-translate-x:14px}.pi .checked\\:before\\:translate-x-14:checked:before,.pi .checked\\:before\\:translate-x-20:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-20:checked:before{--tw-translate-x:20px}.pi .checked\\:before\\:translate-x-24:checked:before{--tw-translate-x:24px}.pi .checked\\:before\\:translate-x-24:checked:before,.pi .checked\\:before\\:translate-x-30:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-30:checked:before{--tw-translate-x:30px}.pi .checked\\:before\\:translate-x-36:checked:before{--tw-translate-x:36px}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before,.pi .checked\\:before\\:translate-x-36:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before{--tw-scale-x:.65;--tw-scale-y:.65}.pi .checked\\:before\\:border-white:checked:before{content:var(--tw-content);--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .checked\\:before\\:opacity-100:checked:before{content:var(--tw-content);opacity:1}.pi .focus-within\\:border-primary\\/60:focus-within{border-color:rgb(var(--be-primary)/.6)}.pi .focus-within\\:ring:focus-within{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-within\\:ring-primary\\/focus:focus-within{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .hover\\:border-chip\\/90:hover{border-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:border-danger:hover{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .hover\\:border-danger\\/90:hover{border-color:#ef4444e6}.pi .hover\\:border-paper\\/90:hover{border-color:rgb(var(--be-paper)/.9)}.pi .hover\\:border-positive:hover{--tw-border-opacity:1;border-color:rgb(34 197 94/var(--tw-border-opacity))}.pi .hover\\:border-primary:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .hover\\:border-primary-dark:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .hover\\:bg-chip\\/90:hover{background-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-danger\\/4:hover{background-color:#ef44440a}.pi .hover\\:bg-danger\\/90:hover{background-color:#ef4444e6}.pi .hover\\:bg-fg-base\\/15:hover{background-color:rgb(var(--be-foreground-base)/15%)}.pi .hover\\:bg-hover:hover{background-color:rgb(var(--be-foreground-base)/var(--be-hover-opacity))}.pi .hover\\:bg-paper\\/90:hover{background-color:rgb(var(--be-paper)/.9)}.pi .hover\\:bg-positive\\/4:hover{background-color:#22c55e0a}.pi .hover\\:bg-primary-dark:hover{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:bg-primary\\/4:hover{background-color:rgb(var(--be-primary)/4%)}.pi .hover\\:bg-primary\\/focus:hover{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:bg-primary\\/hover:hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .hover\\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .hover\\:bg-white\\/20:hover{background-color:#fff3}.pi .hover\\:bg-white\\/hover:hover{background-color:rgb(255 255 255/var(--be-hover-opacity))}.pi .hover\\:text-main:hover{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .hover\\:text-primary-dark:hover{--tw-text-opacity:1;color:rgb(var(--be-primary-dark)/var(--tw-text-opacity))}.pi .hover\\:underline:hover{text-decoration-line:underline}.pi .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .before\\:hover\\:bg-primary-dark:hover:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:after\\:bg-black\\/5:hover:after{background-color:#0000000d;content:var(--tw-content)}.pi .checked\\:hover\\:border-primary-dark:hover:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .focus\\:border-danger\\/60:focus{border-color:#ef444499}.pi .focus\\:border-primary\\/60:focus{border-color:rgb(var(--be-primary)/.6)}.pi .focus\\:bg-primary:focus{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .focus\\:text-on-primary:focus{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.pi .focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus\\:ring-danger\\/focus:focus{--tw-ring-color:rgb(239 68 68/var(--be-focus-opacity))}.pi .focus\\:ring-primary\\/focus:focus{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus\\:after\\:bg-black\\/10:focus:after{background-color:#0000001a;content:var(--tw-content)}.pi .focus-visible\\:bg-primary\\/focus:focus-visible{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus-visible\\:outline:focus-visible{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .focus-visible\\:outline-primary-light:focus-visible{outline-color:rgb(var(--be-primary-light)/1)}.pi .focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.pi .disabled\\:pointer-events-none:disabled{pointer-events:none}.pi .disabled\\:cursor-default:disabled{cursor:default}.pi .disabled\\:border-disabled-bg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:border-disabled-fg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:border-transparent:disabled{border-color:transparent}.pi .disabled\\:border-white\\/70:disabled{border-color:#ffffffb3}.pi .disabled\\:border-r-transparent:disabled{border-right-color:transparent}.pi .disabled\\:bg-disabled:disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:bg-transparent:disabled{background-color:transparent}.pi .disabled\\:text-disabled:disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:text-white\\/70:disabled{color:#ffffffb3}.pi .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .disabled\\:before\\:bg-disabled-fg:disabled:before{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity));content:var(--tw-content)}.pi :is(.dark .dark\\:bg-chip){--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi :is(.dark .dark\\:text-white\\/50){color:#ffffff80}.pi :is(.dark .dark\\:checked\\:border-primary-dark:checked){--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi :is(.dark .dark\\:checked\\:bg-primary-dark:checked){--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}@media (min-width:640px){.pi .sm\\:text-sm{font-size:14px;line-height:20px}}@media (min-width:768px){.pi .md\\:text-lg{font-size:18px;line-height:28px}}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-2:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-inset:focus-visible>.tree-label{--tw-ring-inset:inset}\n'),!t.selector)throw new Error('Pixie required "selector" option.');const n=document.querySelector(t.selector);n&&(n.classList.add("pi"),function(e){Xf=e,Kf=e}(n),this.setConfig(t),np.setState({editor:this}),S(n).render(e(i.StrictMode,{children:e(dP,{})})))}get state(){return rp()}get defaultConfig(){return t.defaultConfig}open(e={}){return new Promise(async t=>{var n;Object.keys(e).length?await this.resetEditor({...Nh(e,{ui:{visible:!0},image:e.image||rp().config.image,state:e.state||rp().config.state,blankCanvasSize:e.blankCanvasSize||rp().config.blankCanvasSize})}):null!=(n=rp().config.ui)&&n.visible||rp().setConfig({ui:{visible:!0}}),t()})}close(){var e,t,n;null!=(e=rp().config.ui)&&e.visible&&(this.setConfig({ui:{visible:!1}}),null==(n=(t=rp().config).onClose)||n.call(t))}setConfig(e){rp().setConfig(e)}uploadAndAddImage(){return ip().import.uploadAndAddImage()}uploadAndReplaceMainImage(){return ip().import.uploadAndReplaceMainImage()}uploadAndOpenStateFile(){return ip().import.uploadAndOpenStateFile()}newCanvas(e,t,n){return ip().canvas.openNew(e,t,n)}getState(e){return JSON.stringify(cp(e))}setState(e){return ip().import.loadState(e)}async setStateFromUrl(e){const t=await sp(e);return ip().import.loadState(t)}openTool(e){up(e)}applyChanges(){rp().applyChanges()}cancelChanges(){rp().cancelChanges()}async resetEditor(e){await ap(e),await ip().canvas.loadInitialContent()}togglePanel(e,t){"objects"===e&&rp().togglePanel("history",!1),"history"===e&&rp().togglePanel("objects",!1),rp().togglePanel(e,t)}on(e,t){var n;null==(n=this.fabric)||n.on(e,t)}isDirty(){return rp().dirty}get(e){return this.tools[e]}notify(e){return mp(e)}static init(e){return new Promise(t=>{const n=e.onLoad;e.onLoad=e=>{null==n||n(e),t(e)},new this(e)})}};Ko(hP,"defaultConfig",dd),Ko(hP,"version",ud);let fP=hP;function pP(e){if(!this.backgroundColor)return;const t=this._getNonTransformedDimensions(),n=-t.x/2,r=-t.y/2,i=t.x,o=t.y,a=this.backgroundColor;if("string"==typeof a||a instanceof CanvasGradient||a instanceof CanvasPattern)e.fillStyle=a,e.fillRect(n,r,i,o);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(n,r,i,o))}else e.drawImage(a.source,n,r,i,o)}else{const t=function(e,t,n,r){var i,o;if("linear"===t.type){const i=e.createLinearGradient(n+t.coords.x1,r+t.coords.y1,n+t.coords.x2,r+t.coords.y2);return t.colorStops.forEach(e=>i.addColorStop(e.offset,e.color)),i}if("radial"===t.type){const a=e.createRadialGradient(n+t.coords.x1,r+t.coords.y1,null!==(i=t.coords.r1)&&void 0!==i?i:0,n+t.coords.x2,r+t.coords.y2,null!==(o=t.coords.r2)&&void 0!==o?o:0);return t.colorStops.forEach(e=>a.addColorStop(e.offset,e.color)),a}throw new Error("Unknown gradient type")}(e,a,n,r);e.fillStyle=t,e.fillRect(n,r,i,o)}this._removeShadow(e)}const gP="fm-pixie-editor";const mP=new class{constructor(){this._container=document.createElement("div"),this._instance=null,this._container.classList.add(gP),this._container.style.width="100%",this._container.style.height="85vh",this._container.style.minHeight="400px"}get className(){return`.${gP}`}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 fP.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=pP)}):console.warn("Pixie fabric instance is not available")}async show(e,t,n=t.firstChild){t.insertBefore(this._container,n),await this._setConfig(e),this._instance.open()}close(){var e;null===(e=this._container.parentNode)||void 0===e||e.removeChild(this._container)}},vP=({small:t=!1,style:n={},wrap:r=!1})=>{const i=Object.assign({width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},n);return e(N,{size:"large",style:i,wrap:r,children:e(k,{})})};function yP(e,t){if(!e)return t;if(!t)return e;return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function bP(e,t){if(/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(t))return t;const n=function(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 n=yP(t,e||"");return!n||n.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(n)||(n="/"+n),n}(e),r=yP(n,t);return!r||r.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(r)?r:"/"+r}var wP,xP;!function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(wP||(wP={})),function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(xP||(xP={}));const CP=(e,t="image/png")=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());const _P=({visible:n,onClose:r,file:o,onSave:s})=>{const{t:l}=$n(),c=i.useRef(null),u=_i(),d=Ti(),{options:h,actions:f,state:p}=yi(),{config:g}=h,{setCurrentMenuFile:m,setLoading:v}=f,{loading:y}=p,{handleAddFileByUrl:b,getFileData:w}=d,[x,C]=i.useState(null),[_,S]=i.useState(""),[k,A]=i.useState(!1),[E,I]=i.useState(!1),[T,F]=i.useState(null),O=i.useRef(!1),P=i.useRef(),M=i.useRef(void 0);P.current=s,i.useEffect(()=>{o&&!O.current&&(v&&!y&&v(!0),(async()=>{if(M.current!==o)if("object"!=typeof o)try{if(M.current=o,o.startsWith("data:"))F({thumbnail:o});else{const e=await b(o,!0);if(!e)throw new Error(l("Failed to download file"));M.current===o&&F(e)}}finally{M.current===o&&(M.current=null,v&&v(!1))}else F(o)})())},[o,b,y,F,v]);const R=i.useCallback(async e=>{try{if(e.thumbnail&&e.thumbnail.startsWith("data:"))return e.thumbnail;const t=await w(e);if(!t)throw new Error(l("Error loading image"));return new Promise(e=>{const n=new FileReader;n.onload=()=>e(n.result),n.readAsDataURL(t)})}catch(e){throw console.error("Ошибка получения данных изображения:",e),e}},[w]);i.useEffect(()=>{if(!x&&n){const e=async()=>{var e,t,n;null==v||v(!0);try{const e=T?await R(T):null;C(e);const t=T?T.type:"";S(t||"image/png")}catch(i){console.error("🎨 Ошибка загрузки изображения:",i),u.error({id:"IMAGE_DOWNLOAD_FAILED",innerException:i,message:l("Error loading image"),placement:"bottomRight",data:{itemId:null!==(e=null==T?void 0:T.id)&&void 0!==e?e:void 0,itemName:null!==(t=null==T?void 0:T.name)&&void 0!==t?t:void 0,folderId:null!==(n=null==T?void 0:T.folderId)&&void 0!==n?n:null,thumbnail:null==T?void 0:T.thumbnail}}),null==r||r()}};e()}},[T,R,x,y,u,r,v,n]);const L=i.useCallback(async(e,t,n)=>{var i,o,a;if(!T||!P.current)return;const s="object"==typeof T&&null!==T?T:null;let c=null;try{null==v||v(!0);const t=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 n=`image/${e}`;if("jpg"===e&&(n="image/jpeg"),t.startsWith("data:")){const e=t.match(/^data:([^;]+)/);e&&e[1].startsWith("image/")&&(n=e[1]);const r=t.replace(/data:image\/[^;]+;base64,/,"");return CP(r,n)}return CP(t,n)}(n,e);let i=t.type||`image/${n}`;"jpg"===n&&(i="image/jpeg");const o=e.startsWith("data:")?e:`data:${i};base64,${e}`,a=Object.assign(Object.assign({},T),{thumbnail:o,size:t.size,date:(new Date).toISOString().split("T")[0],type:i,folderId:T.folderId||"",name:T.name,extension:T.extension||T.name.split(".").pop()||""});c=a;const s=await P.current(a);if(s)return h.onEditorOk&&h.onEditorOk(s),null==v||v(!1),s;null==v||v(!1),null==r||r()}catch(e){console.error("Ошибка сохранения:",e);const n=null!=c?c:s;u.error({id:"IMAGE_SAVE_FAILED",message:l("Error saving image"),placement:"bottomRight",data:{itemId:null!==(i=null==n?void 0:n.id)&&void 0!==i?i:void 0,itemName:null!==(o=null==n?void 0:n.name)&&void 0!==o?o:t,folderId:null!==(a=null==n?void 0:n.folderId)&&void 0!==a?a:null,thumbnail:null==n?void 0:n.thumbnail},innerException:e}),null==v||v(!1)}},[T,u,r,h,v]),j=i.useCallback(async()=>{var e;if(!mP.isLoaded()||!T)return void console.error("❌ Pixie instance или file отсутствует");const t=T.name||"edited-image",n=T.extension||_.split("/")[1]||"png";try{let r;r="jpg"===n?"jpeg":["png","jpeg","json","svg"].includes(n)?n:"jpeg",await(null===(e=mP.tools)||void 0===e?void 0:e.export.save(t.replace(/\.[^/.]+$/,""),r,.8))}catch(e){console.error("🎨 Ошибка при сохранении через кнопку:",e);try{const e=mP.canvas,r=e?e.toDataURL(`image/${n}`):null;r&&await L(r,t,n)}catch(e){console.error("🎨 Альтернативный способ тоже не сработал:",e)}}},[T,_,L]),N=i.useCallback(async()=>{if(x&&n&&k&&!O.current)try{O.current=!0;const t=c.current;let n=0;for(;n<20&&(0===t.clientWidth||0===t.clientHeight);)await new Promise(e=>setTimeout(e,50)),n++;const i=(null==g?void 0:g.locale)?null==g?void 0:g.locale.replace("_","-"):"ru-RU",o=matchMedia(ln).matches?an:on,a=(null==g?void 0:g.theme)===sn?o:null==g?void 0:g.theme,s={selector:"#pixie-editor",baseUrl:bP((null==g?void 0:g.baseUrl)||"",(null==g?void 0:g.assetsUrl)||"assets/image-editor"),image:x,activeLanguage:i,ui:{activeTheme:a,mode:"inline",forceOverlayModeOnMobile:!1,visible:!0,menubar:{replaceDefaultItems:!0,position:wP.TOP,items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",align:"right",desktopOnly:!0,icon:()=>e(ye,{style:{fontSize:20}}),action:e=>{e.togglePanel("history")}},{type:"button",icon:()=>e(ve,{style:{fontSize:20}}),align:"right",desktopOnly:!0,action:r}]},nav:{position:xP.TOP}},onSave:async function(e,t,n){try{null==v||v(!0);return await L(e,t,n)}catch(e){throw console.error("🎨 PIXIE onSave ERROR:",e),null==v||v(!1),e}}};try{I(!1),await mP.show(s,c.current);const e=mP.canvas;e&&e.focus(),I(!0),v&&v(!1)}catch(e){console.error("init pixie failed:",e)}}catch(e){console.error("Ошибка инициализации Pixie:",e),u.error({id:"EDITOR_INIT_FAILED",message:l("Error initializing editor"),placement:"bottomRight",innerException:e}),O.current=!1,null==r||r()}},[x,n,k,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,v,L,u,l]);return i.useEffect(()=>{n&&x&&k&&N()},[n,x,k,N]),i.useEffect(()=>{if(!n){try{mP.close()}catch(e){console.warn("Ошибка при закрытии Pixie:",e)}C(null),S(""),O.current=!1,A(!1),I(!1)}return()=>{try{mP.close()}catch(e){console.warn("Ошибка при закрытии Pixie при размонтировании:",e)}}},[n]),a(()=>{E&&v&&v(!1)},[E,v]),e(G,{title:(null==T?void 0:T.name)?l("Editing: {{name}}",{name:T.name}):l("Editing image"),open:n,closeIcon:null,onCancel:r,afterOpenChange:e=>A(e),forceRender:!0,width:"100vw",style:{top:0,height:"100vh",maxWidth:"none",padding:10},styles:{body:{height:"85vh",padding:0}},footer:[e(D,{onClick:r,disabled:!k||y,children:l("Cancel")},"cancel"),e(D,{type:"primary",onClick:j,loading:y,children:l("Save")},"save")],maskClosable:!1,destroyOnHidden:!1,afterClose:()=>{m&&m("")},children:t("div",{ref:c,style:{position:"relative",width:"100%",height:"100%"},children:[n&&!E?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:l("Loading editor...")})}):null,y&&e(vP,{style:{position:"absolute",top:0,background:"var(--colorBgLayout)",zIndex:100,opacity:.7}})]})})};var SP="uploadProgress",kP="uploadProgress__card",AP="uploadProgress__header",EP="uploadProgress__header-title",IP="uploadProgress__header-buttons",TP="uploadProgress__header-button",FP="uploadProgress__close-icon",OP="uploadProgress__body",PP="uploadProgress__list-wrapper",MP="uploadProgress__status-icon",RP="uploadProgress__file-item",LP="uploadProgress__body--error",jP="uploadProgress__file-avatar",DP="uploadProgress__file-info",NP="uploadProgress__file-name",zP="uploadProgress__file-size",BP="uploadProgress__progress-bar",UP="uploadProgress__error-note",VP="uploadProgress__minimized",$P="uploadProgress__minimized-button",WP="uploadProgress__file-list";const{Text:HP}=P,qP=({visible:n,files:r,totalFiles:i,completedFiles:o,onClose:a,onMinimize:s,onInsert:l,minimized:c=!1})=>{const{token:u}=A.useToken(),{t:d}=$n();if(!n)return null;const h=t=>{switch(t){case"success":return e("div",{className:MP,children:e(xe,{style:{color:u.colorSuccess}})});case"error":return e(we,{style:{color:u.colorError}});default:return e(be,{style:{color:"#1890ff"}})}},f=e=>{if(e.includes(d("KB"))||e.includes("MB")||e.includes("GB"))return e;const t=parseInt(e);return isNaN(t)?e:`${(t/1024).toFixed(2)} ${d("KB")}`},p=t=>"success"===t.status?[e(D,{type:"primary",size:"small",onClick:()=>l(t.id),children:d("Insert")},"insert")]:"error"===t.status?[e(HP,{type:"danger",style:{fontSize:"12px"},children:t.error||d("Error")},"error")]:[];if(c)return e("div",{className:VP,children:e(D,{type:"primary",size:"small",onClick:s,className:$P,children:d("Upload progress",{completed:o,total:i})})});const g=r.filter(e=>"uploading"===e.status).length,m=r.filter(e=>"success"===e.status).length,v=r.filter(e=>"error"===e.status).length;return e("div",{className:SP+" fm-upload-progress",children:t("div",{className:kP,children:[t("div",{className:AP,children:[e(HP,{strong:!0,className:EP,children:g>0?d("Uploading files",{completed:o,total:i}):m>0?d("Uploaded files",{success:m,total:i}):d("Upload error files",{errorCount:v})}),e("div",{className:IP,children:e(D,{type:"text",size:"small",icon:e(ve,{className:FP}),onClick:a,className:TP})})]}),t("div",{className:`${OP} ${r.some(e=>"error"===e.status)?LP:""}`,children:[e("div",{className:PP,children:e(K,{className:WP,size:"small",dataSource:r,renderItem:n=>e(K.Item,{className:RP,actions:p(n),children:e(K.Item.Meta,{avatar:e(J,{size:"small",icon:h(n.status),className:jP}),title:t("div",{className:DP,children:[e(HP,{ellipsis:!0,className:NP,children:n.name}),e(HP,{type:"secondary",className:zP,children:f(n.size)})]}),description:"uploading"===n.status&&e(Z,{percent:n.progress,size:"small",status:"active",showInfo:!1,className:BP})})})})}),r.some(e=>"error"===e.status)&&e("div",{className:UP,children:e(HP,{type:"danger",style:{fontSize:"12px"},children:d("Some files failed to upload")})})]})]})})},{Header:GP}=Q,{Title:YP}=P,XP=({activeLibraryItem:t,selectedFolder:n})=>{const{t:r}=$n(),i={[Qt]:r("My files"),[en]:r("GIF"),[tn]:r("Stock images"),[nn]:r("AI image generation")};return e(GP,{className:"actions-header",children:e("div",{className:"header-title-container",children:e(YP,{level:5,className:"header-title",children:t===Qt?n:i[t]})})})};
61
+ function WO(){return WO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},WO.apply(this,arguments)}new Promise(()=>{});const HO=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="6"}catch{}const qO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",GO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,YO=r.forwardRef(function(e,t){let n,{onClick:i,relative:o,reloadDocument:a,replace:s,state:l,target:c,to:u,preventScrollReset:d,unstable_viewTransition:h}=e,f=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&(i[n]=e[n]);return i}(e,HO),{basename:p}=r.useContext(MO),g=!1;if("string"==typeof u&&GO.test(u)&&(n=u,qO))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=function(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}(t.pathname,p);t.origin===e.origin&&null!=n?u=n+t.search+t.hash:g=!0}catch{}let m=function(e,t){let{relative:n}=void 0===t?{}:t;jO()||bO(!1);let{basename:i,navigator:o}=r.useContext(MO),{hash:a,pathname:s,search:l}=BO(e,{relative:n}),c=s;return"/"!==i&&(c="/"===s?i:AO([i,s])),o.createHref({pathname:c,search:l,hash:a})}(u,{relative:o}),v=function(e,t){let{target:n,replace:i,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:l}=void 0===t?{}:t,c=zO(),u=DO(),d=BO(e,{relative:s});return r.useCallback(t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==i?i:wO(u)===wO(d);c(e,{replace:n,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:l})}},[u,c,d,i,o,n,e,a,s,l])}(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:o,unstable_viewTransition:h});return r.createElement("a",WO({},f,{href:n||m,onClick:g||a?i:function(e){i&&i(e),e.defaultPrevented||v(e)},ref:t,target:c}))});var XO,KO;!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"}(XO||(XO={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(KO||(KO={}));const ZO=Vu(e("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutlineOutlined"),JO=Vu(e("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),QO={opacity:0,y:50,scale:.3},eP={opacity:1,y:0,scale:1},tP={opacity:0,scale:.5};function nP(){const n=pp(e=>e.toasts);return e("div",{className:"pointer-events-none relative",children:e(db,{initial:!1,children:n.map(n=>e("div",{className:zu("fixed z-toast mx-auto p-20","bottom-center"===n.position?"bottom-0 left-0 right-0":"bottom-0 right-0"),children:t(ib.div,{initial:n.disableEnterAnimation?void 0:QO,animate:n.disableEnterAnimation?void 0:eP,exit:n.disableExitAnimation?void 0:tP,className:zu("pointer-events-auto mx-auto flex max-h-100 min-h-50 w-min min-w-288 max-w-500 items-center gap-10 rounded-lg border bg-paper bg-paper py-6 pl-16 pr-6 text-sm text-main shadow-lg"),onPointerEnter:()=>{var e;return null==(e=n.timer)?void 0:e.pause()},onPointerLeave:()=>{var e;return null==(e=n.timer)?void 0:e.resume()},role:"alert","aria-live":"danger"===n.type?"assertive":"polite",children:["danger"===n.type&&e(ZO,{className:"flex-shrink-0 text-danger",size:"md"}),"loading"===n.type&&e(qI,{size:"sm",className:"flex-shrink-0",isIndeterminate:!0}),"positive"===n.type&&e(JO,{className:"flex-shrink-0 text-positive",size:"md"}),e("div",{className:"mr-auto w-max overflow-hidden overflow-ellipsis","data-testid":"toast-message",children:e(LS,{value:n.message})}),n.action&&e(wx,{variant:"text",color:"primary",size:"sm",className:"flex-shrink-0",onFocus:()=>{var e;return null==(e=n.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=n.timer)?void 0:e.resume()},onClick:()=>gp().remove(n.id),elementType:YO,to:n.action.action,children:e(LS,{value:n.action.label})}),"loading"!==n.type&&e(MS,{onFocus:()=>{var e;return null==(e=n.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=n.timer)?void 0:e.resume()},type:"button",className:"flex-shrink-0",onClick:()=>{gp().remove(n.id)},size:"sm",children:e(YS,{})})]})},n.id))})})}function rP(e){return Tb()?e.metaKey:e.ctrlKey}function iP(e){switch(e.key){case"z":rP(e)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?ip().history.redo():ip().history.undo());break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),ip().objects.move("up");break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),ip().objects.move("right");break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),ip().objects.move("down");break;case"ArrowLeft":e.preventDefault(),e.stopPropagation(),ip().objects.move("left");break;case"Delete":e.preventDefault(),e.stopPropagation(),ip().objects.delete();break;case"v":rP(e)&&(e.preventDefault(),e.stopPropagation(),async function(){try{const e=await navigator.clipboard.read();for(const t of e)for(const e of t.types)if(e.startsWith("image/")){const n=await t.getType(e),r=new FileReader;return r.onload=e=>{var t;null!=(t=e.target)&&t.result&&ip().import.addImageFromData(e.target.result)},void r.readAsDataURL(n)}}catch(e){console.error(e)}}())}}const oP=new Map,aP=new Map,sP={};async function*lP(e){const t=e.createReader();let n;do{n=await new Promise((e,n)=>{t.readEntries(e,n)});for(const e of n)if(e.isFile){if(".DS_Store"===e.name)continue;const t=await cP(e);yield new qw(t,e.fullPath)}else e.isDirectory&&(yield*lP(e))}while(n.length>0)}function cP(e){return new Promise((t,n)=>e.file(t,n))}function uP(e){return null!=sP.dragTargetId?oP.get(sP.dragTargetId):e.dataTransfer.types.includes("Files")?{type:"nativeFile",el:null,ref:null,getData:()=>async function(e){const t=[];for await(const n of e)t.push(n);return t}(async function*(e){const t=[];for(const n of e.items)if("file"===n.kind){const e=n.webkitGetAsEntry();e&&t.push(e)}for(const e of t)if(e.isFile){if(".DS_Store"===e.name)continue;const t=await cP(e);yield new qw(t,e.fullPath)}else e.isDirectory&&(yield*lP(e))}(e.dataTransfer))}:void 0}function dP(){const n=np(e=>{var t;return null==(t=e.config.ui)?void 0:t.visible})??!0,r=np(e=>{var t,n;return null==(n=null==(t=e.config.ui)?void 0:t.nav)?void 0:n.position})??"bottom",i=np(e=>{var t,n;return null==(n=null==(t=e.config.ui)?void 0:t.menubar)?void 0:n.position})??"top",o=np(e=>{var t;return null==(t=e.config.ui)?void 0:t.allowEditorClose})??!0,s=u(null),l=u(null),{isModal:d,isMobile:h}=XS(),f=c(async e=>{var t,n;if(rp().activeTool||rp().dirty||"nativeFile"!==e.type)return;const r=await e.getData();ip().import.fileIsValid(r[0])&&((null==(n=null==(t=rp().config.tools)?void 0:t.import)?void 0:n.openDroppedImageAsBackground)?await ip().import.openBackgroundImage(r[0]):await ip().import.openUploadedFile(r[0]))},[]),{droppableProps:p}=function({id:e,disabled:t,ref:n,...r}){const i=u({dragOverElements:new Set,dropActivateTimer:void 0}).current,o=u(r);o.current=r,x(()=>(aP.set(e,{...aP.get(e),disabled:t,id:e,ref:n}),()=>{aP.delete(e)}),[e,o,t,n]);const a=e=>{var t;const r=o.current,i=r.allowDragEventsFromItself||n.current!==(null==(t=e.ref)?void 0:t.current);return!(!(null!=e&&e.type&&i&&r.types.includes(e.type))||r.acceptsDrop&&!r.acceptsDrop(e))},s=e=>{var t,n;const r=uP(e);r&&(null==(n=(t=o.current).onDragLeave)||n.call(t,r))};return{droppableProps:t?{}:{onDragOver:e=>{var t,n;e.preventDefault(),e.stopPropagation();const r=uP(e);r&&a(r)&&(null==(n=(t=o.current).onDragOver)||n.call(t,r,e))},onDragEnter:e=>{var t,n;if(e.stopPropagation(),i.dragOverElements.add(e.target),i.dragOverElements.size>1)return;const r=uP(e);r&&a(r)&&(null==(n=(t=o.current).onDragEnter)||n.call(t,r),clearTimeout(i.dropActivateTimer),"function"==typeof o.current.onDropActivate&&(i.dropActivateTimer=setTimeout(()=>{var e,t;r&&(null==(t=(e=o.current).onDropActivate)||t.call(e,r))},400)))},onDragLeave:e=>{e.stopPropagation(),i.dragOverElements.delete(e.target);for(const t of i.dragOverElements)e.currentTarget.contains(t)||i.dragOverElements.delete(t);if(i.dragOverElements.size>0)return;const t=uP(e);t&&a(t)&&(s(e),clearTimeout(i.dropActivateTimer))},onDrop:async e=>{var t,n,r,l;e.preventDefault(),e.stopPropagation(),i.dragOverElements.clear(),s(e),clearTimeout(i.dropActivateTimer);const c=uP(e);c&&(null==(n=(t=o.current).onDragLeave)||n.call(t,c),a(c)&&(null==(l=(r=o.current).onDrop)||l.call(r,c)))}}}}({id:"pixie-root",ref:l,types:["nativeFile"],onDrop:f});a(()=>{var e,t;rp().fabric||(np.setState({canvasRef:s}),dx(s.current),null!=(e=rp().config.ui)&&e.defaultTool&&rp().setActiveTool(null==(t=rp().config.ui)?void 0:t.defaultTool,null),ip().canvas.loadInitialContent().then(()=>{var e,t;null==(t=(e=rp().config).onLoad)||t.call(e,rp().editor)}));const n=hx(l,()=>{rp().setStageSize(fx(l.current))}),r=hx(s,()=>{rp().setCanvasSize(fx(s.current))});return()=>{n(),r()}},[l]);const g=zu("pixie-root flex flex-col overflow-hidden bg-background text-main no-tap-highlight w-full h-full",{relative:!d,"fixed inset-0 w-full h-full z-20":d,"shadow-lg border rounded-md m-auto max-h-[calc(100vh-90px)] max-w-[calc(100vw-90px)]":d&&!h});return t(hb,{features:pb,strict:!0,children:[d&&n&&!h&&o&&e(MS,{className:"z-20 fixed right-2 top-2 text-white",size:"lg",onClick:()=>{rp().editor.close()},children:e(YS,{})}),d&&n&&e(j_,{position:"fixed",disableInitialTransition:!0}),t(ib.div,{initial:!1,variants:{visible:{opacity:1,scale:1,display:"flex"},hidden:{opacity:0,transitionEnd:{display:"none"}}},animate:n?"visible":"hidden",className:g,children:["top"===i&&e(nk,{}),"top"===r&&e(ZF,{className:"pt-14"}),t("main",{className:"relative flex-auto my-20 overflow-hidden outline-none",tabIndex:-1,...Ab(p,{onKeyDownCapture:iP}),ref:l,children:[e(ik,{}),e(jA,{ref:s})]}),e(BT,{}),"bottom"===r&&e(ZF,{}),"bottom"===i&&e(nk,{}),e(gO,{}),e(nP,{})]})]})}!function(){fabric.Object.ENLIVEN_PROPS.push("eraser");var e=fabric.Object.prototype._drawClipPath,t=fabric.Object.prototype.needsItsOwnCache,n=fabric.Object.prototype.toObject,r=fabric.Object.prototype.getSvgCommons,i=fabric.Object.prototype._createBaseClipPathSVGMarkup,o=fabric.Object.prototype._createBaseSVGMarkup;fabric.Object.prototype.cacheProperties.push("eraser"),fabric.Object.prototype.stateProperties.push("eraser"),fabric.util.object.extend(fabric.Object.prototype,{erasable:!0,eraser:void 0,needsItsOwnCache:function(){return t.call(this)||!!this.eraser},_drawClipPath:function(t,n){if(e.call(this,t,n),this.eraser){var r=this._getNonTransformedDimensions();this.eraser.isType("eraser")&&this.eraser.set({width:r.x,height:r.y}),e.call(this,t,this.eraser)}},toObject:function(e){var t=n.call(this,["erasable"].concat(e));return this.eraser&&!this.eraser.excludeFromExport&&(t.eraser=this.eraser.toObject(e)),t},getSvgCommons:function(){return r.call(this)+(this.eraser?'mask="url(#'+this.eraser.clipPathId+')" ':"")},_createEraserSVGMarkup:function(e){return this.eraser?(this.eraser.clipPathId="MASK_"+fabric.Object.__uid++,['<mask id="',this.eraser.clipPathId,'" >',this.eraser.toSVG(e),"</mask>","\n"].join("")):""},_createBaseClipPathSVGMarkup:function(e,t){return[this._createEraserSVGMarkup(t&&t.reviver),i.call(this,e,t)].join("")},_createBaseSVGMarkup:function(e,t){return[this._createEraserSVGMarkup(t&&t.reviver),o.call(this,e,t)].join("")}});var a=fabric.Group.prototype._restoreObjectsState;fabric.util.object.extend(fabric.Group.prototype,{_addEraserPathToObjects:function(e){this._objects.forEach(function(t){fabric.EraserBrush.prototype._addPathToObjectEraser.call(fabric.EraserBrush.prototype,t,e)})},applyEraserToObjects:function(){var e=this,t=this.eraser;if(t){delete this.eraser;var n=e.calcTransformMatrix();t.clone(function(t){var r=e.clipPath;t.getObjects("path").forEach(function(t){var i=fabric.util.multiplyTransformMatrices(n,t.calcTransformMatrix());fabric.util.applyTransformToObject(t,i),r?r.clone(function(r){var i=fabric.EraserBrush.prototype.applyClipPathToPath.call(fabric.EraserBrush.prototype,t,r,n);e._addEraserPathToObjects(i)},["absolutePositioned","inverted"]):e._addEraserPathToObjects(t)})})}},_restoreObjectsState:function(){return!0===this.erasable&&this.applyEraserToObjects(),a.call(this)}}),fabric.Eraser=fabric.util.createClass(fabric.Group,{type:"eraser",originX:"center",originY:"center",drawObject:function(e){e.save(),e.fillStyle="black",e.fillRect(-this.width/2,-this.height/2,this.width,this.height),e.restore(),this.callSuper("drawObject",e)},_getBounds:function(){},_toSVG:function(e){var t=["<g ","COMMON_PARTS"," >\n"],n=["<rect ",'fill="white" ','x="',-this.width/2,'" y="',-this.height/2,'" width="',this.width,'" height="',this.height,'" />\n'].join("");t.push("\t\t",n);for(var r=0,i=this._objects.length;r<i;r++)t.push("\t\t",this._objects[r].toSVG(e));return t.push("</g>\n"),t}}),fabric.Eraser.fromObject=function(e,t){var n=e.objects;fabric.util.enlivenObjects(n,function(n){var r=fabric.util.object.clone(e,!0);delete r.objects,fabric.util.enlivenObjectEnlivables(e,r,function(){t&&t(new fabric.Eraser(n,r,!0))})})};var s=fabric.Canvas.prototype._renderOverlay;fabric.util.object.extend(fabric.Canvas.prototype,{isErasing:function(){return this.isDrawingMode&&this.freeDrawingBrush&&"eraser"===this.freeDrawingBrush.type&&this.freeDrawingBrush._isErasing},_renderOverlay:function(e){s.call(this,e),this.isErasing()&&!this.freeDrawingBrush.inverted&&this.freeDrawingBrush._render()}}),fabric.EraserBrush=fabric.util.createClass(fabric.PencilBrush,{type:"eraser",inverted:!1,_isErasing:!1,_isErasable:function(e){return!1!==e.erasable},_prepareCollectionTraversal:function(e,t,n){e.forEachObject(function(r){r.forEachObject&&"deep"===r.erasable?this._prepareCollectionTraversal(r,t,n):!this.inverted&&r.erasable&&r.visible?(r.visible=!1,e.dirty=!0,n.visibility.push(r),n.collection.push(e)):this.inverted&&r.visible&&(r.erasable&&r.eraser?(r.eraser.inverted=!0,r.dirty=!0,e.dirty=!0,n.eraser.push(r),n.collection.push(e)):(r.visible=!1,e.dirty=!0,n.visibility.push(r),n.collection.push(e)))},this)},preparePattern:function(){this._patternCanvas||(this._patternCanvas=fabric.util.createCanvasElement());var e=this._patternCanvas;e.width=this.canvas.width,e.height=this.canvas.height;var t=e.getContext("2d");if(this.canvas._isRetinaScaling()){var n=this.canvas.getRetinaScaling();this.canvas.__initRetinaScaling(n,e,t)}var r=this.canvas.backgroundImage,i=r&&this._isErasable(r),o=this.canvas.overlayImage,a=o&&this._isErasable(o);if(!this.inverted&&(r&&!i||this.canvas.backgroundColor))i&&(this.canvas.backgroundImage=void 0),this.canvas._renderBackground(t),i&&(this.canvas.backgroundImage=r);else if(this.inverted&&r&&i){var l=this.canvas.backgroundColor;this.canvas.backgroundColor=void 0,this.canvas._renderBackground(t),this.canvas.backgroundColor=l}t.save(),t.transform.apply(t,this.canvas.viewportTransform);var c={visibility:[],eraser:[],collection:[]};if(this._prepareCollectionTraversal(this.canvas,t,c),this.canvas._renderObjects(t,this.canvas._objects),c.visibility.forEach(function(e){e.visible=!0}),c.eraser.forEach(function(e){e.eraser.inverted=!1,e.dirty=!0}),c.collection.forEach(function(e){e.dirty=!0}),t.restore(),!this.inverted&&(o&&!a||this.canvas.overlayColor))a&&(this.canvas.overlayImage=void 0),s.call(this.canvas,t),a&&(this.canvas.overlayImage=o);else if(this.inverted&&o&&a){l=this.canvas.overlayColor;this.canvas.overlayColor=void 0,s.call(this.canvas,t),this.canvas.overlayColor=l}},_setBrushStyles:function(e){this.callSuper("_setBrushStyles",e),e.strokeStyle="black"},_saveAndTransform:function(e){this.callSuper("_saveAndTransform",e),this._setBrushStyles(e),e.globalCompositeOperation=e===this.canvas.getContext()?"destination-out":"source-over"},needsFullRender:function(){return!0},onMouseDown:function(e,t){this.canvas._isMainEvent(t.e)&&(this._prepareForDrawing(e),this._captureDrawingPath(e),this.preparePattern(),this._isErasing=!0,this.canvas.fire("erasing:start"),this._render())},_render:function(){var e;this.inverted||(e=this.canvas.getContext(),this.callSuper("_render",e)),e=this.canvas.contextTop,this.canvas.clearContext(e),this.callSuper("_render",e),e.save();var t=1/this.canvas.getRetinaScaling();e.scale(t,t),e.globalCompositeOperation="source-in",e.drawImage(this._patternCanvas,0,0),e.restore()},createPath:function(e){var t=this.callSuper("createPath",e);return t.globalCompositeOperation=this.inverted?"source-over":"destination-out",t.stroke=this.inverted?"white":"black",t},applyClipPathToPath:function(e,t,n){var r=fabric.util.invertTransform(e.calcTransformMatrix()),i=t.calcTransformMatrix(),o=t.absolutePositioned?r:fabric.util.multiplyTransformMatrices(r,n);return t.absolutePositioned=!1,fabric.util.applyTransformToObject(t,fabric.util.multiplyTransformMatrices(o,i)),e.clipPath=e.clipPath?fabric.util.mergeClipPaths(t,e.clipPath):t,e},clonePathWithClipPath:function(e,t,n){var r=t.calcTransformMatrix(),i=t.clipPath,o=this;e.clone(function(e){i.clone(function(t){n(o.applyClipPathToPath(e,t,r))},["absolutePositioned","inverted"])})},_addPathToObjectEraser:function(e,t){var n=this;if(e.forEachObject&&"deep"===e.erasable){var r=e._objects.filter(function(e){return e.erasable});r.length>0&&e.clipPath?this.clonePathWithClipPath(t,e,function(e){r.forEach(function(t){n._addPathToObjectEraser(t,e)})}):r.length>0&&r.forEach(function(e){n._addPathToObjectEraser(e,t)})}else{var i=e.eraser;i||(i=new fabric.Eraser,e.eraser=i),t.clone(function(t){var r=fabric.util.multiplyTransformMatrices(fabric.util.invertTransform(e.calcTransformMatrix()),t.calcTransformMatrix());fabric.util.applyTransformToObject(t,r),i.addWithUpdate(t),e.set("dirty",!0),e.fire("erasing:end",{path:t}),e.group&&Array.isArray(n.__subTargets)&&n.__subTargets.push(e)})}},applyEraserToCanvas:function(e){var t=this.canvas,n={};return["backgroundImage","overlayImage"].forEach(function(r){var i=t[r];i&&i.erasable&&(this._addPathToObjectEraser(i,e),n[r]=i)},this),n},_finalizeAndAddPath:function(){var e=this.canvas.contextTop,t=this.canvas;e.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate)),t.clearContext(t.contextTop),this._isErasing=!1;var n=this._points&&this._points.length>1?this.convertPointsToSVGPath(this._points):null;if(!n||this._isEmptySVGPath(n))return t.fire("erasing:end"),void t.requestRenderAll();var r=this.createPath(n);r.setCoords(),t.fire("before:path:created",{path:r});var i=this.applyEraserToCanvas(r),o=this;this.__subTargets=[];var a=[];t.forEachObject(function(e){e.erasable&&e.intersectsWithObject(r,!0,!0)&&(o._addPathToObjectEraser(e,r),a.push(e))}),t.fire("erasing:end",{path:r,targets:a,subTargets:this.__subTargets,drawables:i}),delete this.__subTargets,t.requestRenderAll(),this._resetShadow(),t.fire("path:created",{path:r})}})}(),sa.enableBoundaryChecking(!1);const hP=class t{constructor(t){if(Ko(this,"tools",{}),Ko(this,"fabric",null),t.sentryDsn&&function(e){const t={...e};fc(t,"react"),Su(t)}({dsn:t.sentryDsn}),function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}('/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/.pi *,.pi :after,.pi :before{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity));border-style:solid;border-width:0;box-sizing:border-box}.pi :after,.pi :before{--tw-content:""}.pi hr{border-top-width:1px;color:inherit;height:0}.pi abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6{font-size:inherit;font-weight:inherit}.pi a{color:inherit;text-decoration:inherit}.pi b,.pi strong{font-weight:bolder}.pi code,.pi kbd,.pi pre,.pi samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.pi small{font-size:80%}.pi sub,.pi sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.pi sub{bottom:-.25em}.pi sup{top:-.5em}.pi table{border-collapse:collapse;border-color:inherit;text-indent:0}.pi button,.pi input,.pi optgroup,.pi select,.pi textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}.pi button,.pi select{text-transform:none}.pi [type=button],.pi [type=reset],.pi [type=submit],.pi button{-webkit-appearance:button;background-color:transparent;background-image:none}.pi :-moz-focusring{outline:auto}.pi :-moz-ui-invalid{box-shadow:none}.pi progress{vertical-align:baseline}.pi ::-webkit-inner-spin-button,.pi ::-webkit-outer-spin-button{height:auto}.pi [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.pi ::-webkit-search-decoration{-webkit-appearance:none}.pi ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.pi summary{display:list-item}.pi blockquote,.pi dd,.pi dl,.pi figure,.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6,.pi hr,.pi p,.pi pre{margin:0}.pi fieldset{margin:0;padding:0}.pi legend{padding:0}.pi menu,.pi ol,.pi ul{list-style:none;margin:0;padding:0}.pi textarea{resize:vertical}.pi input::-moz-placeholder,.pi textarea::-moz-placeholder{color:#9ca3af;opacity:1}.pi input::placeholder,.pi textarea::placeholder{color:#9ca3af;opacity:1}.pi [role=button],.pi button{cursor:pointer}.pi :disabled{cursor:default}.pi audio,.pi canvas,.pi embed,.pi iframe,.pi img,.pi object,.pi svg,.pi video{display:block;vertical-align:middle}.pi img,.pi video{height:auto;max-width:100%}.pi [hidden]{display:none}.pi *,.pi :after,.pi :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi ::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi .\\!container{width:100%!important}.pi .container{width:100%}@media (min-width:640px){.pi .\\!container{max-width:640px!important}.pi .container{max-width:640px}}@media (min-width:768px){.pi .\\!container{max-width:768px!important}.pi .container{max-width:768px}}@media (min-width:1024px){.pi .\\!container{max-width:1024px!important}.pi .container{max-width:1024px}}@media (min-width:1280px){.pi .\\!container{max-width:1280px!important}.pi .container{max-width:1280px}}@media (min-width:1536px){.pi .\\!container{max-width:1536px!important}.pi .container{max-width:1536px}}.pi .sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pi .pointer-events-none{pointer-events:none}.pi .pointer-events-auto{pointer-events:auto}.pi .\\!visible{visibility:visible!important}.pi .visible{visibility:visible}.pi .invisible{visibility:hidden}.pi .collapse{visibility:collapse}.pi .static{position:static}.pi .fixed{position:fixed}.pi .absolute{position:absolute}.pi .relative{position:relative}.pi .inset-0{top:0;right:0;bottom:0;left:0}.pi .inset-x-0{left:0;right:0}.pi .-bottom-10{bottom:-10px}.pi .-bottom-20{bottom:-20px}.pi .-bottom-5{bottom:-5px}.pi .-left-5{left:-5px}.pi .-left-8{left:-8px}.pi .-left-80{left:-80px}.pi .-right-5{right:-5px}.pi .-top-144{top:-144px}.pi .-top-40{top:-40px}.pi .-top-5{top:-5px}.pi .bottom-0{bottom:0}.pi .bottom-20{bottom:20px}.pi .left-0{left:0}.pi .left-1\\/2{left:50%}.pi .left-20{left:20px}.pi .right-0{right:0}.pi .right-16{right:16px}.pi .right-2{right:2px}.pi .right-20{right:20px}.pi .right-4{right:4px}.pi .top-0{top:0}.pi .top-1\\/2{top:50%}.pi .top-2{top:2px}.pi .isolate{isolation:isolate}.pi .z-10{z-index:10}.pi .z-20{z-index:20}.pi .z-50{z-index:50}.pi .z-cropzone{z-index:10}.pi .z-loading-indicator{z-index:50}.pi .z-modal{z-index:110}.pi .z-navbar{z-index:40}.pi .z-obj-box{z-index:20}.pi .z-popover{z-index:130}.pi .z-toast{z-index:160}.pi .z-tool-overlay{z-index:30}.pi .z-tooltip{z-index:150}.pi .z-tray{z-index:120}.pi .m-auto{margin:auto}.pi .mx-20{margin-left:20px;margin-right:20px}.pi .mx-8{margin-left:8px;margin-right:8px}.pi .mx-auto{margin-left:auto;margin-right:auto}.pi .my-20{margin-bottom:20px;margin-top:20px}.pi .my-4{margin-bottom:4px;margin-top:4px}.pi .my-6{margin-bottom:6px;margin-top:6px}.pi .my-8{margin-bottom:8px;margin-top:8px}.pi .my-auto{margin-bottom:auto;margin-top:auto}.pi .-ml-1{margin-left:-1px}.pi .-ml-10{margin-left:-10px}.pi .-ml-12{margin-left:-12px}.pi .-ml-3{margin-left:-3px}.pi .-ml-4{margin-left:-4px}.pi .-ml-6{margin-left:-6px}.pi .-mr-4{margin-right:-4px}.pi .-mr-8{margin-right:-8px}.pi .mb-1{margin-bottom:1px}.pi .mb-10{margin-bottom:10px}.pi .mb-16{margin-bottom:16px}.pi .mb-2{margin-bottom:2px}.pi .mb-20{margin-bottom:20px}.pi .mb-24{margin-bottom:24px}.pi .mb-4{margin-bottom:4px}.pi .mb-6{margin-bottom:6px}.pi .mb-8{margin-bottom:8px}.pi .ml-10{margin-left:10px}.pi .ml-12{margin-left:12px}.pi .ml-4{margin-left:4px}.pi .ml-6{margin-left:6px}.pi .ml-8{margin-left:8px}.pi .ml-auto{margin-left:auto}.pi .mr-10{margin-right:10px}.pi .mr-16{margin-right:16px}.pi .mr-20{margin-right:20px}.pi .mr-4{margin-right:4px}.pi .mr-5{margin-right:5px}.pi .mr-6{margin-right:6px}.pi .mr-8{margin-right:8px}.pi .mr-auto{margin-right:auto}.pi .mt-0{margin-top:0}.pi .mt-10{margin-top:10px}.pi .mt-14{margin-top:14px}.pi .mt-20{margin-top:20px}.pi .mt-24{margin-top:24px}.pi .mt-4{margin-top:4px}.pi .mt-6{margin-top:6px}.pi .box-content{box-sizing:content-box}.pi .block{display:block}.pi .inline-block{display:inline-block}.pi .inline{display:inline}.pi .flex{display:flex}.pi .inline-flex{display:inline-flex}.pi .grid{display:grid}.pi .contents{display:contents}.pi .hidden{display:none}.pi .aspect-square{aspect-ratio:1/1}.pi .h-1{height:1px}.pi .h-12{height:12px}.pi .h-128{height:128px}.pi .h-14{height:14px}.pi .h-16{height:16px}.pi .h-18{height:18px}.pi .h-2{height:2px}.pi .h-2\\/4{height:50%}.pi .h-20{height:20px}.pi .h-22{height:22px}.pi .h-24{height:24px}.pi .h-26{height:26px}.pi .h-28{height:28px}.pi .h-3{height:3px}.pi .h-30{height:30px}.pi .h-32{height:32px}.pi .h-36{height:36px}.pi .h-38{height:2.375rem}.pi .h-4{height:4px}.pi .h-40{height:40px}.pi .h-42{height:42px}.pi .h-48{height:48px}.pi .h-50{height:50px}.pi .h-56{height:56px}.pi .h-6{height:6px}.pi .h-60{height:60px}.pi .h-64{height:64px}.pi .h-68{height:68px}.pi .h-8{height:8px}.pi .h-80{height:80px}.pi .h-84{height:84px}.pi .h-92{height:92px}.pi .h-\\[54px\\]{height:54px}.pi .h-font{height:1em}.pi .h-full{height:100%}.pi .h-px{height:1px}.pi .h-screen{height:100dvh}.pi .max-h-100{max-height:6.25rem}.pi .max-h-\\[calc\\(100\\%-40px\\)\\]{max-height:calc(100% - 40px)}.pi .max-h-\\[calc\\(100vh-90px\\)\\]{max-height:calc(100vh - 90px)}.pi .max-h-dialog{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-full{max-height:100%}.pi .max-h-inherit{max-height:inherit}.pi .max-h-tray{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .min-h-24{min-height:24px}.pi .min-h-30{min-height:30px}.pi .min-h-36{min-height:36px}.pi .min-h-42{min-height:42px}.pi .min-h-50{min-height:50px}.pi .min-h-60{min-height:60px}.pi .min-h-86{min-height:86px}.pi .\\!w-auto{width:auto!important}.pi .w-1\\/2{width:50%}.pi .w-110{width:110px}.pi .w-12{width:12px}.pi .w-1280{width:80rem}.pi .w-14{width:14px}.pi .w-144{width:144px}.pi .w-16{width:16px}.pi .w-18{width:18px}.pi .w-2{width:2px}.pi .w-20{width:20px}.pi .w-22{width:22px}.pi .w-224{width:224px}.pi .w-24{width:24px}.pi .w-256{width:256px}.pi .w-26{width:26px}.pi .w-28{width:28px}.pi .w-280{width:17.5rem}.pi .w-30{width:30px}.pi .w-32{width:32px}.pi .w-320{width:320px}.pi .w-36{width:36px}.pi .w-38{width:2.375rem}.pi .w-384{width:384px}.pi .w-40{width:40px}.pi .w-42{width:42px}.pi .w-440{width:27.5rem}.pi .w-46{width:2.875rem}.pi .w-50{width:50px}.pi .w-56{width:56px}.pi .w-60{width:60px}.pi .w-620{width:38.75rem}.pi .w-64{width:64px}.pi .w-68{width:68px}.pi .w-780{width:48.75rem}.pi .w-8{width:8px}.pi .w-80{width:80px}.pi .w-850{width:53.125rem}.pi .w-96{width:96px}.pi .w-\\[4ch\\]{width:4ch}.pi .w-auto{width:auto}.pi .w-font{width:1em}.pi .w-full{width:100%}.pi .w-max{width:-moz-max-content;width:max-content}.pi .w-min{width:-moz-min-content;width:min-content}.pi .w-px{width:1px}.pi .w-screen{width:100vw}.pi .min-w-0{min-width:0}.pi .min-w-128{min-width:128px}.pi .min-w-180{min-width:11.25rem}.pi .min-w-192{min-width:192px}.pi .min-w-288{min-width:288px}.pi .min-w-30{min-width:30px}.pi .min-w-4{min-width:4px}.pi .min-w-42{min-width:42px}.pi .min-w-92{min-width:92px}.pi .min-w-min{min-width:-moz-min-content;min-width:min-content}.pi .max-w-112{max-width:112px}.pi .max-w-240{max-width:240px}.pi .max-w-288{max-width:288px}.pi .max-w-320{max-width:320px}.pi .max-w-375{max-width:375px}.pi .max-w-500{max-width:31.25rem}.pi .max-w-\\[90\\%\\]{max-width:90%}.pi .max-w-\\[calc\\(100\\%-40px\\)\\]{max-width:calc(100% - 40px)}.pi .max-w-\\[calc\\(100vw-90px\\)\\]{max-width:calc(100vw - 90px)}.pi .max-w-dialog{max-width:calc(var(--be-viewport-width, 100vw)*.9)}.pi .max-w-full{max-width:100%}.pi .max-w-max{max-width:-moz-max-content;max-width:max-content}.pi .flex-\\[1_1_60px\\]{flex:1 1 60px}.pi .flex-auto{flex:1 1 auto}.pi .flex-shrink-0,.pi .shrink-0{flex-shrink:0}.pi .origin-\\[0_55\\%\\]{transform-origin:0 55%}.pi .origin-\\[100\\%\\]{transform-origin:100%}.pi .-translate-x-1\\/2{--tw-translate-x:-50%}.pi .-translate-x-1\\/2,.pi .-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .-translate-y-1\\/2{--tw-translate-y:-50%}.pi .rotate-0{--tw-rotate:0deg}.pi .rotate-0,.pi .rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-180{--tw-rotate:180deg}.pi .rotate-45{--tw-rotate:45deg}.pi .rotate-45,.pi .rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-90{--tw-rotate:90deg}.pi .scale-y-\\[0\\.6\\]{--tw-scale-y:.6}.pi .scale-y-\\[0\\.6\\],.pi .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .cursor-default{cursor:default}.pi .cursor-move{cursor:move}.pi .cursor-nesw-resize{cursor:nesw-resize}.pi .cursor-not-allowed{cursor:not-allowed}.pi .cursor-nwse-resize{cursor:nwse-resize}.pi .cursor-pointer{cursor:pointer}.pi .cursor-se-resize{cursor:se-resize}.pi .cursor-sw-resize{cursor:sw-resize}.pi .touch-none{touch-action:none}.pi .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pi .resize{resize:both}.pi .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.pi .grid-cols-5-min-content{grid-template-columns:repeat(5,min-content)}.pi .flex-row{flex-direction:row}.pi .flex-col{flex-direction:column}.pi .flex-col-reverse{flex-direction:column-reverse}.pi .flex-wrap{flex-wrap:wrap}.pi .flex-nowrap{flex-wrap:nowrap}.pi .items-start{align-items:flex-start}.pi .items-end{align-items:flex-end}.pi .items-center{align-items:center}.pi .items-stretch{align-items:stretch}.pi .justify-start{justify-content:flex-start}.pi .justify-center{justify-content:center}.pi .justify-between{justify-content:space-between}.pi .gap-10{gap:10px}.pi .gap-14{gap:14px}.pi .gap-16{gap:16px}.pi .gap-18{gap:18px}.pi .gap-20{gap:20px}.pi .gap-36{gap:36px}.pi .gap-4{gap:4px}.pi .gap-40{gap:40px}.pi .gap-6{gap:6px}.pi .gap-8{gap:8px}.pi .space-y-10>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(10px*var(--tw-space-y-reverse));margin-top:calc(10px*(1 - var(--tw-space-y-reverse)))}.pi .overflow-auto{overflow:auto}.pi .overflow-hidden{overflow:hidden}.pi .overflow-x-auto{overflow-x:auto}.pi .overflow-y-auto{overflow-y:auto}.pi .overflow-x-hidden{overflow-x:hidden}.pi .overflow-y-hidden{overflow-y:hidden}.pi .overscroll-contain{overscroll-behavior:contain}.pi .truncate{overflow:hidden;white-space:nowrap}.pi .overflow-ellipsis,.pi .text-ellipsis,.pi .truncate{text-overflow:ellipsis}.pi .whitespace-normal{white-space:normal}.pi .whitespace-nowrap{white-space:nowrap}.pi .break-words{overflow-wrap:break-word}.pi .rounded{border-radius:4px}.pi .rounded-2xl{border-radius:16px}.pi .rounded-3xl{border-radius:24px}.pi .rounded-button{border-radius:var(--be-button-radius,.25rem)}.pi .rounded-full{border-radius:9999px}.pi .rounded-input{border-radius:var(--be-input-radius,.25rem)}.pi .rounded-lg{border-radius:8px}.pi .rounded-md{border-radius:6px}.pi .rounded-none{border-radius:0}.pi .rounded-panel{border-radius:var(--be-panel-radius,.25rem)}.pi .rounded-xl{border-radius:12px}.pi .rounded-l{border-bottom-left-radius:4px;border-top-left-radius:4px}.pi .rounded-l-full{border-bottom-left-radius:9999px;border-top-left-radius:9999px}.pi .rounded-l-input{border-bottom-left-radius:var(--be-input-radius,.25rem);border-top-left-radius:var(--be-input-radius,.25rem)}.pi .rounded-l-none{border-bottom-left-radius:0;border-top-left-radius:0}.pi .rounded-r-full{border-bottom-right-radius:9999px;border-top-right-radius:9999px}.pi .rounded-r-input{border-bottom-right-radius:var(--be-input-radius,.25rem);border-top-right-radius:var(--be-input-radius,.25rem)}.pi .rounded-r-none{border-bottom-right-radius:0;border-top-right-radius:0}.pi .rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.pi .rounded-bl-none{border-bottom-left-radius:0}.pi .rounded-br-none{border-bottom-right-radius:0}.pi .rounded-tl-none{border-top-left-radius:0}.pi .rounded-tr-none{border-top-right-radius:0}.pi .border{border-width:1px}.pi .border-2{border-width:2px}.pi .border-4{border-width:4px}.pi .border-\\[3px\\]{border-width:3px}.pi .border-y{border-top-width:1px}.pi .border-b,.pi .border-y{border-bottom-width:1px}.pi .border-b-4{border-bottom-width:4px}.pi .border-l{border-left-width:1px}.pi .border-l-4{border-left-width:4px}.pi .border-r{border-right-width:1px}.pi .border-r-4{border-right-width:4px}.pi .border-t{border-top-width:1px}.pi .border-t-4{border-top-width:4px}.pi .border-dotted{border-style:dotted}.pi .border-none{border-style:none}.pi .border-background{--tw-border-opacity:1;border-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-bg-alt{--tw-border-opacity:1;border-color:rgb(var(--be-background-alt)/var(--tw-border-opacity))}.pi .border-chip{--tw-border-opacity:1;border-color:rgb(var(--be-background-chip)/var(--tw-border-opacity))}.pi .border-danger{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-danger\\/50{border-color:#ef444480}.pi .border-divider{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .border-paper{--tw-border-opacity:1;border-color:rgb(var(--be-paper)/var(--tw-border-opacity))}.pi .border-positive\\/50{border-color:#22c55e80}.pi .border-primary{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-primary\\/50{border-color:rgb(var(--be-primary)/.5)}.pi .border-text-muted{border-color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .border-transparent{border-color:transparent}.pi .border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .border-white\\/50{border-color:#ffffff80}.pi .border-b-bg{--tw-border-opacity:1;border-bottom-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-b-transparent{border-bottom-color:transparent}.pi .border-r-transparent{border-right-color:transparent}.pi .bg{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-alt{--tw-bg-opacity:1;background-color:rgb(var(--be-background-alt)/var(--tw-bg-opacity))}.pi .bg-background{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-background\\/70{background-color:rgb(var(--be-background)/.7)}.pi .bg-background\\/80{background-color:rgb(var(--be-background)/.8)}.pi .bg-black\\/50{background-color:#00000080}.pi .bg-black\\/80{background-color:#000c}.pi .bg-chip{--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi .bg-controls{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-danger{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .bg-danger-lighter{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.pi .bg-divider{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .bg-fg-base\\/4{background-color:rgb(var(--be-foreground-base)/4%)}.pi .bg-focus{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .bg-inherit{background-color:inherit}.pi .bg-paper{--tw-bg-opacity:1;background-color:rgb(var(--be-paper)/var(--tw-bg-opacity))}.pi .bg-positive{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.pi .bg-positive-lighter{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.pi .bg-primary{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .bg-primary-dark{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .bg-primary-light{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-light)/var(--tw-bg-opacity))}.pi .bg-primary\\/focus{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .bg-primary\\/selected{background-color:rgb(var(--be-primary)/var(--be-selected-opacity))}.pi .bg-slider-disabled{--tw-bg-opacity:1;background-color:rgb(189 189 189/var(--tw-bg-opacity))}.pi .bg-slider-disabled\\/60{background-color:#bdbdbd99}.pi .bg-toast{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-transparent{background-color:transparent}.pi .bg-warning{--tw-bg-opacity:1;background-color:rgb(243 164 50/var(--tw-bg-opacity))}.pi .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .bg-white\\/50{background-color:#ffffff80}.pi .bg-opacity-95{--tw-bg-opacity:.95}.pi .bg-no-repeat{background-repeat:no-repeat}.pi .fill-current{fill:currentColor}.pi .fill-transparent{fill:transparent}.pi .stroke-current{stroke:currentColor}.pi .object-contain{-o-object-fit:contain;object-fit:contain}.pi .object-cover{-o-object-fit:cover;object-fit:cover}.pi .p-0{padding:0}.pi .p-10{padding:10px}.pi .p-14{padding:14px}.pi .p-16{padding:16px}.pi .p-18{padding:18px}.pi .p-2{padding:2px}.pi .p-20{padding:20px}.pi .p-4{padding:4px}.pi .p-40{padding:40px}.pi .p-6{padding:6px}.pi .p-8{padding:8px}.pi .px-10{padding-left:10px;padding-right:10px}.pi .px-12{padding-left:12px;padding-right:12px}.pi .px-14{padding-left:14px;padding-right:14px}.pi .px-16{padding-left:16px;padding-right:16px}.pi .px-18{padding-left:18px;padding-right:18px}.pi .px-20{padding-left:20px;padding-right:20px}.pi .px-22{padding-left:22px;padding-right:22px}.pi .px-24{padding-left:24px;padding-right:24px}.pi .px-26{padding-left:26px;padding-right:26px}.pi .px-32{padding-left:32px;padding-right:32px}.pi .px-4{padding-left:4px;padding-right:4px}.pi .px-5vw{padding-left:5vw;padding-right:5vw}.pi .px-6{padding-left:6px;padding-right:6px}.pi .px-8{padding-left:8px;padding-right:8px}.pi .py-10{padding-bottom:10px;padding-top:10px}.pi .py-12{padding-bottom:12px;padding-top:12px}.pi .py-14{padding-bottom:14px;padding-top:14px}.pi .py-2{padding-bottom:2px;padding-top:2px}.pi .py-20{padding-bottom:20px;padding-top:20px}.pi .py-3{padding-bottom:3px;padding-top:3px}.pi .py-4{padding-bottom:4px;padding-top:4px}.pi .py-5{padding-bottom:5px;padding-top:5px}.pi .py-6{padding-bottom:6px;padding-top:6px}.pi .py-8{padding-bottom:8px;padding-top:8px}.pi .py-\\[9px\\]{padding-bottom:9px;padding-top:9px}.pi .pb-10{padding-bottom:10px}.pi .pb-12{padding-bottom:12px}.pi .pb-14{padding-bottom:14px}.pi .pb-16{padding-bottom:16px}.pi .pb-18{padding-bottom:18px}.pi .pb-20{padding-bottom:20px}.pi .pb-4{padding-bottom:4px}.pi .pb-8{padding-bottom:8px}.pi .pb-safe-area{padding-bottom:env(safe-area-inset-bottom)}.pi .pl-10{padding-left:10px}.pi .pl-12{padding-left:12px}.pi .pl-14{padding-left:14px}.pi .pl-16{padding-left:16px}.pi .pl-18{padding-left:18px}.pi .pl-28{padding-left:28px}.pi .pl-46{padding-left:2.875rem}.pi .pl-54{padding-left:3.375rem}.pi .pl-8{padding-left:8px}.pi .pr-10{padding-right:10px}.pi .pr-12{padding-right:12px}.pi .pr-18{padding-right:18px}.pi .pr-24{padding-right:24px}.pi .pr-28{padding-right:28px}.pi .pr-46{padding-right:2.875rem}.pi .pr-54{padding-right:3.375rem}.pi .pr-6{padding-right:6px}.pi .pr-8{padding-right:8px}.pi .pt-10{padding-top:10px}.pi .pt-12{padding-top:12px}.pi .pt-14{padding-top:14px}.pi .pt-16{padding-top:16px}.pi .pt-20{padding-top:20px}.pi .pt-24{padding-top:24px}.pi .pt-4{padding-top:4px}.pi .pt-40{padding-top:40px}.pi .pt-6{padding-top:6px}.pi .text-left{text-align:left}.pi .text-center{text-align:center}.pi .text-right{text-align:right}.pi .align-middle{vertical-align:middle}.pi .text-base{font-size:16px;line-height:24px}.pi .text-lg{font-size:18px;line-height:28px}.pi .text-sm{font-size:14px;line-height:20px}.pi .text-xl{font-size:20px;line-height:28px}.pi .text-xs{font-size:12px;line-height:16px}.pi .font-bold{font-weight:700}.pi .font-medium{font-weight:500}.pi .font-semibold{font-weight:600}.pi .uppercase{text-transform:uppercase}.pi .capitalize{text-transform:capitalize}.pi .italic{font-style:italic}.pi .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.pi .leading-5{line-height:1.25rem}.pi .leading-none{line-height:1}.pi .tracking-wide{letter-spacing:.025em}.pi .\\!text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))!important}.pi .text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.pi .text-black\\/30{color:#0000004d}.pi .text-danger{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.pi .text-danger-darker{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.pi .text-disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .text-link{--tw-text-opacity:1;color:rgb(var(--be-link-color,var(--be-primary))/var(--tw-text-opacity))}.pi .text-main{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-muted{color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .text-on-primary{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .text-positive{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.pi .text-positive-darker{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.pi .text-primary{--tw-text-opacity:1;color:rgb(var(--be-primary)/var(--tw-text-opacity))}.pi .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.pi .underline{text-decoration-line:underline}.pi .no-underline{text-decoration-line:none}.pi .caret-transparent{caret-color:transparent}.pi .opacity-0{opacity:0}.pi .opacity-100{opacity:1}.pi .opacity-70{opacity:.7}.pi .opacity-80{opacity:.8}.pi .opacity-90{opacity:.9}.pi .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.pi .shadow,.pi .shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.pi .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.pi .shadow-lg,.pi .shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.pi .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.pi .shadow-sm,.pi .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.pi .outline-none{outline:2px solid transparent;outline-offset:2px}.pi .outline{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .ring-inset{--tw-ring-inset:inset}.pi .blur{--tw-blur:blur(8px)}.pi .blur,.pi .grayscale{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .grayscale{--tw-grayscale:grayscale(100%)}.pi .invert{--tw-invert:invert(100%)}.pi .invert,.pi .sepia{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .sepia{--tw-sepia:sepia(100%)}.pi .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.pi .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-button{transition-duration:.15s;transition-property:background-color,box-shadow,border-color,color;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-shadow{transition-duration:.15s;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-width{transition-duration:.15s;transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .duration-100{transition-duration:.1s}.pi .duration-200{transition-duration:.2s}.pi .will-change-transform{will-change:transform}.pi .icon-2xs{font-size:.75rem}.pi .icon-xs{font-size:1rem}.pi .icon-sm{font-size:1.25rem}.pi .icon-md{font-size:1.5rem}.pi .icon-lg{font-size:2.1875rem}.pi .icon-xl{font-size:2.6875rem}.pi .no-tap-highlight{-webkit-tap-highlight-color:transparent}@media only screen and (min-device-width:768px){.pi .tiny-scrollbar{scrollbar-color:rgba(0,0,0,.2) transparent;scrollbar-width:thin}.pi .tiny-scrollbar::-webkit-scrollbar{background-color:transparent;height:6px;width:6px}.pi .tiny-scrollbar::-webkit-scrollbar-thumb{background-color:rgb(var(--be-foreground-base)/.2);border-radius:10px}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:start{background:transparent}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:end{background:transparent}}.pi .hide-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.pi .hide-scrollbar::-webkit-scrollbar{background:transparent;display:none;height:0;width:0}.pi .svg-icon{display:inline-block;flex-shrink:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;fill:currentColor;transition-duration:.15s;transition-property:transform,fill;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .cropzone:not(.moving) .cropzone-transition{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .first-letter\\:capitalize:first-letter{text-transform:capitalize}.pi .file\\:mr-10::file-selector-button{margin-right:10px}.pi .file\\:h-24::file-selector-button{height:24px}.pi .file\\:rounded::file-selector-button{border-radius:4px}.pi .file\\:border-none::file-selector-button{border-style:none}.pi .file\\:bg-primary::file-selector-button{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .file\\:px-10::file-selector-button{padding-left:10px;padding-right:10px}.pi .file\\:text-sm::file-selector-button{font-size:14px;line-height:20px}.pi .file\\:font-semibold::file-selector-button{font-weight:600}.pi .file\\:text-on-primary::file-selector-button{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .before\\:z-10:before{content:var(--tw-content);z-index:10}.pi .before\\:block:before{content:var(--tw-content);display:block}.pi .before\\:h-12:before{content:var(--tw-content);height:12px}.pi .before\\:h-14:before{content:var(--tw-content);height:14px}.pi .before\\:h-18:before{content:var(--tw-content);height:18px}.pi .before\\:h-22:before{content:var(--tw-content);height:22px}.pi .before\\:h-28:before{content:var(--tw-content);height:28px}.pi .before\\:h-full:before{content:var(--tw-content);height:100%}.pi .before\\:w-12:before{content:var(--tw-content);width:12px}.pi .before\\:w-14:before{content:var(--tw-content);width:14px}.pi .before\\:w-18:before{content:var(--tw-content);width:18px}.pi .before\\:w-22:before{content:var(--tw-content);width:22px}.pi .before\\:w-28:before{content:var(--tw-content);width:28px}.pi .before\\:w-full:before{content:var(--tw-content);width:100%}.pi .before\\:translate-x-2:before{--tw-translate-x:2px}.pi .before\\:scale-10:before,.pi .before\\:translate-x-2:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .before\\:scale-10:before{--tw-scale-x:.1;--tw-scale-y:.1}.pi .before\\:rounded-3xl:before{border-radius:24px;content:var(--tw-content)}.pi .before\\:rounded-full:before{border-radius:9999px;content:var(--tw-content)}.pi .before\\:border:before{border-width:1px;content:var(--tw-content)}.pi .before\\:bg-primary:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .before\\:bg-white:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .before\\:opacity-0:before{content:var(--tw-content);opacity:0}.pi .before\\:transition:before{content:var(--tw-content);transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:transition-transform:before{content:var(--tw-content);transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:duration-200:before{content:var(--tw-content);transition-duration:.2s}.pi .after\\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.pi .after\\:absolute:after{content:var(--tw-content);position:absolute}.pi .after\\:inset-0:after{content:var(--tw-content);top:0;right:0;bottom:0;left:0}.pi .checked\\:border-danger:checked{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .checked\\:border-primary:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .checked\\:bg-danger:checked{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .checked\\:bg-primary:checked{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .checked\\:before\\:translate-x-14:checked:before{--tw-translate-x:14px}.pi .checked\\:before\\:translate-x-14:checked:before,.pi .checked\\:before\\:translate-x-20:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-20:checked:before{--tw-translate-x:20px}.pi .checked\\:before\\:translate-x-24:checked:before{--tw-translate-x:24px}.pi .checked\\:before\\:translate-x-24:checked:before,.pi .checked\\:before\\:translate-x-30:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-30:checked:before{--tw-translate-x:30px}.pi .checked\\:before\\:translate-x-36:checked:before{--tw-translate-x:36px}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before,.pi .checked\\:before\\:translate-x-36:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before{--tw-scale-x:.65;--tw-scale-y:.65}.pi .checked\\:before\\:border-white:checked:before{content:var(--tw-content);--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .checked\\:before\\:opacity-100:checked:before{content:var(--tw-content);opacity:1}.pi .focus-within\\:border-primary\\/60:focus-within{border-color:rgb(var(--be-primary)/.6)}.pi .focus-within\\:ring:focus-within{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-within\\:ring-primary\\/focus:focus-within{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .hover\\:border-chip\\/90:hover{border-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:border-danger:hover{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .hover\\:border-danger\\/90:hover{border-color:#ef4444e6}.pi .hover\\:border-paper\\/90:hover{border-color:rgb(var(--be-paper)/.9)}.pi .hover\\:border-positive:hover{--tw-border-opacity:1;border-color:rgb(34 197 94/var(--tw-border-opacity))}.pi .hover\\:border-primary:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .hover\\:border-primary-dark:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .hover\\:bg-chip\\/90:hover{background-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-danger\\/4:hover{background-color:#ef44440a}.pi .hover\\:bg-danger\\/90:hover{background-color:#ef4444e6}.pi .hover\\:bg-fg-base\\/15:hover{background-color:rgb(var(--be-foreground-base)/15%)}.pi .hover\\:bg-hover:hover{background-color:rgb(var(--be-foreground-base)/var(--be-hover-opacity))}.pi .hover\\:bg-paper\\/90:hover{background-color:rgb(var(--be-paper)/.9)}.pi .hover\\:bg-positive\\/4:hover{background-color:#22c55e0a}.pi .hover\\:bg-primary-dark:hover{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:bg-primary\\/4:hover{background-color:rgb(var(--be-primary)/4%)}.pi .hover\\:bg-primary\\/focus:hover{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:bg-primary\\/hover:hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .hover\\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .hover\\:bg-white\\/20:hover{background-color:#fff3}.pi .hover\\:bg-white\\/hover:hover{background-color:rgb(255 255 255/var(--be-hover-opacity))}.pi .hover\\:text-main:hover{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .hover\\:text-primary-dark:hover{--tw-text-opacity:1;color:rgb(var(--be-primary-dark)/var(--tw-text-opacity))}.pi .hover\\:underline:hover{text-decoration-line:underline}.pi .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .before\\:hover\\:bg-primary-dark:hover:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:after\\:bg-black\\/5:hover:after{background-color:#0000000d;content:var(--tw-content)}.pi .checked\\:hover\\:border-primary-dark:hover:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .focus\\:border-danger\\/60:focus{border-color:#ef444499}.pi .focus\\:border-primary\\/60:focus{border-color:rgb(var(--be-primary)/.6)}.pi .focus\\:bg-primary:focus{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .focus\\:text-on-primary:focus{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.pi .focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus\\:ring-danger\\/focus:focus{--tw-ring-color:rgb(239 68 68/var(--be-focus-opacity))}.pi .focus\\:ring-primary\\/focus:focus{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus\\:after\\:bg-black\\/10:focus:after{background-color:#0000001a;content:var(--tw-content)}.pi .focus-visible\\:bg-primary\\/focus:focus-visible{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus-visible\\:outline:focus-visible{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .focus-visible\\:outline-primary-light:focus-visible{outline-color:rgb(var(--be-primary-light)/1)}.pi .focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.pi .disabled\\:pointer-events-none:disabled{pointer-events:none}.pi .disabled\\:cursor-default:disabled{cursor:default}.pi .disabled\\:border-disabled-bg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:border-disabled-fg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:border-transparent:disabled{border-color:transparent}.pi .disabled\\:border-white\\/70:disabled{border-color:#ffffffb3}.pi .disabled\\:border-r-transparent:disabled{border-right-color:transparent}.pi .disabled\\:bg-disabled:disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:bg-transparent:disabled{background-color:transparent}.pi .disabled\\:text-disabled:disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:text-white\\/70:disabled{color:#ffffffb3}.pi .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .disabled\\:before\\:bg-disabled-fg:disabled:before{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity));content:var(--tw-content)}.pi :is(.dark .dark\\:bg-chip){--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi :is(.dark .dark\\:text-white\\/50){color:#ffffff80}.pi :is(.dark .dark\\:checked\\:border-primary-dark:checked){--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi :is(.dark .dark\\:checked\\:bg-primary-dark:checked){--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}@media (min-width:640px){.pi .sm\\:text-sm{font-size:14px;line-height:20px}}@media (min-width:768px){.pi .md\\:text-lg{font-size:18px;line-height:28px}}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-2:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-inset:focus-visible>.tree-label{--tw-ring-inset:inset}\n'),!t.selector)throw new Error('Pixie required "selector" option.');const n=document.querySelector(t.selector);n&&(n.classList.add("pi"),function(e){Xf=e,Kf=e}(n),this.setConfig(t),np.setState({editor:this}),S(n).render(e(i.StrictMode,{children:e(dP,{})})))}get state(){return rp()}get defaultConfig(){return t.defaultConfig}open(e={}){return new Promise(async t=>{var n;Object.keys(e).length?await this.resetEditor({...Nh(e,{ui:{visible:!0},image:e.image||rp().config.image,state:e.state||rp().config.state,blankCanvasSize:e.blankCanvasSize||rp().config.blankCanvasSize})}):null!=(n=rp().config.ui)&&n.visible||rp().setConfig({ui:{visible:!0}}),t()})}close(){var e,t,n;null!=(e=rp().config.ui)&&e.visible&&(this.setConfig({ui:{visible:!1}}),null==(n=(t=rp().config).onClose)||n.call(t))}setConfig(e){rp().setConfig(e)}uploadAndAddImage(){return ip().import.uploadAndAddImage()}uploadAndReplaceMainImage(){return ip().import.uploadAndReplaceMainImage()}uploadAndOpenStateFile(){return ip().import.uploadAndOpenStateFile()}newCanvas(e,t,n){return ip().canvas.openNew(e,t,n)}getState(e){return JSON.stringify(cp(e))}setState(e){return ip().import.loadState(e)}async setStateFromUrl(e){const t=await sp(e);return ip().import.loadState(t)}openTool(e){up(e)}applyChanges(){rp().applyChanges()}cancelChanges(){rp().cancelChanges()}async resetEditor(e){await ap(e),await ip().canvas.loadInitialContent()}togglePanel(e,t){"objects"===e&&rp().togglePanel("history",!1),"history"===e&&rp().togglePanel("objects",!1),rp().togglePanel(e,t)}on(e,t){var n;null==(n=this.fabric)||n.on(e,t)}isDirty(){return rp().dirty}get(e){return this.tools[e]}notify(e){return mp(e)}static init(e){return new Promise(t=>{const n=e.onLoad;e.onLoad=e=>{null==n||n(e),t(e)},new this(e)})}};Ko(hP,"defaultConfig",dd),Ko(hP,"version",ud);let fP=hP;function pP(e){if(!this.backgroundColor)return;const t=this._getNonTransformedDimensions(),n=-t.x/2,r=-t.y/2,i=t.x,o=t.y,a=this.backgroundColor;if("string"==typeof a||a instanceof CanvasGradient||a instanceof CanvasPattern)e.fillStyle=a,e.fillRect(n,r,i,o);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(n,r,i,o))}else e.drawImage(a.source,n,r,i,o)}else{const t=function(e,t,n,r){var i,o;if("linear"===t.type){const i=e.createLinearGradient(n+t.coords.x1,r+t.coords.y1,n+t.coords.x2,r+t.coords.y2);return t.colorStops.forEach(e=>i.addColorStop(e.offset,e.color)),i}if("radial"===t.type){const a=e.createRadialGradient(n+t.coords.x1,r+t.coords.y1,null!==(i=t.coords.r1)&&void 0!==i?i:0,n+t.coords.x2,r+t.coords.y2,null!==(o=t.coords.r2)&&void 0!==o?o:0);return t.colorStops.forEach(e=>a.addColorStop(e.offset,e.color)),a}throw new Error("Unknown gradient type")}(e,a,n,r);e.fillStyle=t,e.fillRect(n,r,i,o)}this._removeShadow(e)}const gP="fm-pixie-editor";const mP=new class{constructor(){this._container=document.createElement("div"),this._instance=null,this._container.classList.add(gP),this._container.style.width="100%",this._container.style.height="85vh",this._container.style.minHeight="400px"}get className(){return`.${gP}`}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 fP.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=pP)}):console.warn("Pixie fabric instance is not available")}async show(e,t,n=t.firstChild){t.insertBefore(this._container,n),await this._setConfig(e),this._instance.open()}close(){var e;null===(e=this._container.parentNode)||void 0===e||e.removeChild(this._container)}},vP=({small:t=!1,style:n={},wrap:r=!1})=>{const i=Object.assign({width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},n);return e(N,{size:"large",style:i,wrap:r,children:e(k,{})})};function yP(e,t){if(!e)return t;if(!t)return e;return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function bP(e,t){if(/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(t))return t;const n=function(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 n=yP(t,e||"");return!n||n.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(n)||(n="/"+n),n}(e),r=yP(n,t);return!r||r.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(r)?r:"/"+r}var wP,xP;!function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(wP||(wP={})),function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(xP||(xP={}));const CP=(e,t="image/png")=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());const _P=({visible:n,onClose:r,file:o,onSave:s})=>{const{t:l}=$n(),c=i.useRef(null),u=_i(),d=Ti(),{options:h,actions:f,state:p}=yi(),{config:g}=h,{setCurrentMenuFile:m,setLoading:v}=f,{loading:y}=p,{handleAddFileByUrl:b,getFileData:w}=d,[x,C]=i.useState(null),[_,S]=i.useState(""),[k,A]=i.useState(!1),[E,I]=i.useState(!1),[T,F]=i.useState(null),O=i.useRef(!1),P=i.useRef(),M=i.useRef(void 0);P.current=s,i.useEffect(()=>{o&&!O.current&&(v&&!y&&v(!0),(async()=>{if(M.current!==o)if("object"!=typeof o)try{if(M.current=o,o.startsWith("data:"))F({thumbnail:o});else{const e=await b(o,!0);if(!e)throw new Error(l("Failed to download file"));M.current===o&&F(e)}}finally{M.current===o&&(M.current=null,v&&v(!1))}else F(o)})())},[o,b,y,F,v]);const R=i.useCallback(async e=>{try{if(e.thumbnail&&e.thumbnail.startsWith("data:"))return e.thumbnail;const t=await w(e);if(!t)throw new Error(l("Error loading image"));return new Promise(e=>{const n=new FileReader;n.onload=()=>e(n.result),n.readAsDataURL(t)})}catch(e){throw console.error("Ошибка получения данных изображения:",e),e}},[w]);i.useEffect(()=>{if(!x&&n){const e=async()=>{var e,t,n;null==v||v(!0);try{const e=T?await R(T):null;C(e);const t=T?T.type:"";S(t||"image/png")}catch(i){console.error("🎨 Ошибка загрузки изображения:",i),u.error({id:"IMAGE_DOWNLOAD_FAILED",innerException:i,message:l("Error loading image"),placement:"bottomRight",data:{itemId:null!==(e=null==T?void 0:T.id)&&void 0!==e?e:void 0,itemName:null!==(t=null==T?void 0:T.name)&&void 0!==t?t:void 0,folderId:null!==(n=null==T?void 0:T.folderId)&&void 0!==n?n:null,thumbnail:null==T?void 0:T.thumbnail}}),null==r||r()}};e()}},[T,R,x,y,u,r,v,n]);const L=i.useCallback(async(e,t,n)=>{var i,o,a;if(!T||!P.current)return;const s="object"==typeof T&&null!==T?T:null;let c=null;try{null==v||v(!0);const t=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 n=`image/${e}`;if("jpg"===e&&(n="image/jpeg"),t.startsWith("data:")){const e=t.match(/^data:([^;]+)/);e&&e[1].startsWith("image/")&&(n=e[1]);const r=t.replace(/data:image\/[^;]+;base64,/,"");return CP(r,n)}return CP(t,n)}(n,e);let i=t.type||`image/${n}`;"jpg"===n&&(i="image/jpeg");const o=e.startsWith("data:")?e:`data:${i};base64,${e}`,a=Object.assign(Object.assign({},T),{thumbnail:o,size:t.size,date:(new Date).toISOString().split("T")[0],type:i,folderId:T.folderId||"",name:T.name,extension:T.extension||T.name.split(".").pop()||""});c=a;const s=await P.current(a);if(s)return h.onEditorOk&&h.onEditorOk(s),null==v||v(!1),s;null==v||v(!1),null==r||r()}catch(e){console.error("Ошибка сохранения:",e);const n=null!=c?c:s;u.error({id:"IMAGE_SAVE_FAILED",message:l("Error saving image"),placement:"bottomRight",data:{itemId:null!==(i=null==n?void 0:n.id)&&void 0!==i?i:void 0,itemName:null!==(o=null==n?void 0:n.name)&&void 0!==o?o:t,folderId:null!==(a=null==n?void 0:n.folderId)&&void 0!==a?a:null,thumbnail:null==n?void 0:n.thumbnail},innerException:e}),null==v||v(!1)}},[T,u,r,h,v]),j=i.useCallback(async()=>{var e;if(!mP.isLoaded()||!T)return void console.error("❌ Pixie instance или file отсутствует");const t=T.name||"edited-image",n=T.extension||_.split("/")[1]||"png";try{let r;r="jpg"===n?"jpeg":["png","jpeg","json","svg"].includes(n)?n:"jpeg",await(null===(e=mP.tools)||void 0===e?void 0:e.export.save(t.replace(/\.[^/.]+$/,""),r,.8))}catch(e){console.error("🎨 Ошибка при сохранении через кнопку:",e);try{const e=mP.canvas,r=e?e.toDataURL(`image/${n}`):null;r&&await L(r,t,n)}catch(e){console.error("🎨 Альтернативный способ тоже не сработал:",e)}}},[T,_,L]),N=i.useCallback(async()=>{if(x&&n&&k&&!O.current)try{O.current=!0;const t=c.current;let n=0;for(;n<20&&(0===t.clientWidth||0===t.clientHeight);)await new Promise(e=>setTimeout(e,50)),n++;const i=(null==g?void 0:g.locale)?null==g?void 0:g.locale.replace("_","-"):"ru-RU",o=matchMedia(ln).matches?an:on,a=(null==g?void 0:g.theme)===sn?o:null==g?void 0:g.theme,s={selector:"#pixie-editor",baseUrl:bP((null==g?void 0:g.baseUrl)||"",(null==g?void 0:g.assetsUrl)||"assets/image-editor"),image:x,activeLanguage:i,ui:{activeTheme:a,mode:"inline",forceOverlayModeOnMobile:!1,visible:!0,menubar:{replaceDefaultItems:!0,position:wP.TOP,items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",align:"right",desktopOnly:!0,icon:()=>e(ye,{style:{fontSize:20}}),action:e=>{e.togglePanel("history")}},{type:"button",icon:()=>e(ve,{style:{fontSize:20}}),align:"right",desktopOnly:!0,action:r}]},nav:{position:xP.TOP}},onSave:async function(e,t,n){try{null==v||v(!0);return await L(e,t,n)}catch(e){throw console.error("🎨 PIXIE onSave ERROR:",e),null==v||v(!1),e}}};try{I(!1),await mP.show(s,c.current);const e=mP.canvas;e&&e.focus(),I(!0),v&&v(!1)}catch(e){console.error("init pixie failed:",e)}}catch(e){console.error("Ошибка инициализации Pixie:",e),u.error({id:"EDITOR_INIT_FAILED",message:l("Error initializing editor"),placement:"bottomRight",innerException:e}),O.current=!1,null==r||r()}},[x,n,k,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,v,L,u,l]);return i.useEffect(()=>{n&&x&&k&&N()},[n,x,k,N]),i.useEffect(()=>{if(!n){try{mP.close()}catch(e){console.warn("Ошибка при закрытии Pixie:",e)}C(null),S(""),O.current=!1,A(!1),I(!1)}return()=>{try{mP.close()}catch(e){console.warn("Ошибка при закрытии Pixie при размонтировании:",e)}}},[n]),a(()=>{E&&v&&v(!1)},[E,v]),e(G,{title:(null==T?void 0:T.name)?l("Editing: {{name}}",{name:T.name}):l("Editing image"),open:n,closeIcon:null,onCancel:r,afterOpenChange:e=>A(e),forceRender:!0,width:"100vw",style:{top:0,height:"100vh",maxWidth:"none",padding:10},styles:{body:{height:"85vh",padding:0}},footer:[e(D,{onClick:r,disabled:!k||y,children:l("Cancel")},"cancel"),e(D,{type:"primary",onClick:j,loading:y,children:l("Save")},"save")],maskClosable:!1,destroyOnHidden:!1,afterClose:()=>{m&&m("")},children:t("div",{ref:c,style:{position:"relative",width:"100%",height:"100%"},children:[n&&!E?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:l("Loading editor...")})}):null,y&&e(vP,{style:{position:"absolute",top:0,background:"var(--colorBgLayout)",zIndex:100,opacity:.7}})]})})};var SP="uploadProgress",kP="uploadProgress__card",AP="uploadProgress__header",EP="uploadProgress__header-title",IP="uploadProgress__header-buttons",TP="uploadProgress__header-button",FP="uploadProgress__close-icon",OP="uploadProgress__body",PP="uploadProgress__list-wrapper",MP="uploadProgress__status-icon",RP="uploadProgress__file-item",LP="uploadProgress__body--error",jP="uploadProgress__file-avatar",DP="uploadProgress__file-info",NP="uploadProgress__file-name",zP="uploadProgress__file-size",BP="uploadProgress__progress-bar",UP="uploadProgress__error-note",VP="uploadProgress__minimized",$P="uploadProgress__minimized-button",WP="uploadProgress__file-list";const{Text:HP}=P,qP=({visible:n,files:r,totalFiles:i,completedFiles:o,onClose:a,onMinimize:s,onInsert:l,minimized:c=!1})=>{const{token:u}=A.useToken(),{t:d}=$n();if(!n)return null;const h=t=>{switch(t){case"success":return e("div",{className:MP,children:e(xe,{style:{color:u.colorSuccess}})});case"error":return e(we,{style:{color:u.colorError}});default:return e(be,{style:{color:"#1890ff"}})}},f=e=>{if(e.includes(d("KB"))||e.includes("MB")||e.includes("GB"))return e;const t=parseInt(e);return isNaN(t)?e:`${(t/1024).toFixed(2)} ${d("KB")}`},p=t=>"success"===t.status?[e(D,{type:"primary",size:"small",onClick:()=>l(t),children:d("Insert")},"insert")]:"error"===t.status?[e(HP,{type:"danger",style:{fontSize:"12px"},children:t.error||d("Error")},"error")]:[];if(c)return e("div",{className:VP,children:e(D,{type:"primary",size:"small",onClick:s,className:$P,children:d("Upload progress",{completed:o,total:i})})});const g=r.filter(e=>"uploading"===e.status).length,m=r.filter(e=>"success"===e.status).length,v=r.filter(e=>"error"===e.status).length;return e("div",{className:SP+" fm-upload-progress",children:t("div",{className:kP,children:[t("div",{className:AP,children:[e(HP,{strong:!0,className:EP,children:g>0?d("Uploading files",{completed:o,total:i}):m>0?d("Uploaded files",{success:m,total:i}):d("Upload error files",{errorCount:v})}),e("div",{className:IP,children:e(D,{type:"text",size:"small",icon:e(ve,{className:FP}),onClick:a,className:TP})})]}),t("div",{className:`${OP} ${r.some(e=>"error"===e.status)?LP:""}`,children:[e("div",{className:PP,children:e(K,{className:WP,size:"small",dataSource:r,renderItem:n=>e(K.Item,{className:RP,actions:p(n),children:e(K.Item.Meta,{avatar:e(J,{size:"small",icon:h(n.status),className:jP}),title:t("div",{className:DP,children:[e(HP,{ellipsis:!0,className:NP,children:n.name}),e(HP,{type:"secondary",className:zP,children:f(n.size)})]}),description:"uploading"===n.status&&e(Z,{percent:n.progress,size:"small",status:"active",showInfo:!1,className:BP})})})})}),r.some(e=>"error"===e.status)&&e("div",{className:UP,children:e(HP,{type:"danger",style:{fontSize:"12px"},children:d("Some files failed to upload")})})]})]})})},{Header:GP}=Q,{Title:YP}=P,XP=({activeLibraryItem:t,selectedFolder:n})=>{const{t:r}=$n(),i={[Qt]:r("My files"),[en]:r("GIF"),[tn]:r("Stock images"),[nn]:r("AI image generation")};return e(GP,{className:"actions-header",children:e("div",{className:"header-title-container",children:e(YP,{level:5,className:"header-title",children:t===Qt?n:i[t]})})})};
62
62
  /*! *****************************************************************************
63
63
  Copyright (c) Microsoft Corporation. All rights reserved.
64
64
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
@@ -73,5 +73,5 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
73
73
  See the Apache Version 2.0 License for specific language governing permissions
74
74
  and limitations under the License.
75
75
  ***************************************************************************** */
76
- var KP=function(e,t){return KP=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},KP(e,t)};var ZP=function(){return ZP=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ZP.apply(this,arguments)};var JP="Pixel",QP="Percent",eM={unit:QP,value:.8};function tM(e){return"number"==typeof e?{unit:QP,value:100*e}:"string"==typeof e?e.match(/^(\d*(\.\d+)?)px$/)?{unit:JP,value:parseFloat(e)}:e.match(/^(\d*(\.\d+)?)%$/)?{unit:QP,value:parseFloat(e)}:(console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...'),eM):(console.warn("scrollThreshold should be string or number"),eM)}var nM=function(e){function t(t){var n=e.call(this,t)||this;return n.lastScrollTop=0,n.actionTriggered=!1,n.startY=0,n.currentY=0,n.dragging=!1,n.maxPullDownDistance=0,n.getScrollableTarget=function(){return n.props.scrollableTarget instanceof HTMLElement?n.props.scrollableTarget:"string"==typeof n.props.scrollableTarget?document.getElementById(n.props.scrollableTarget):(null===n.props.scrollableTarget&&console.warn("You are trying to pass scrollableTarget but it is null. This might\n happen because the element may not have been added to DOM yet.\n See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.\n "),null)},n.onStart=function(e){n.lastScrollTop||(n.dragging=!0,e instanceof MouseEvent?n.startY=e.pageY:e instanceof TouchEvent&&(n.startY=e.touches[0].pageY),n.currentY=n.startY,n._infScroll&&(n._infScroll.style.willChange="transform",n._infScroll.style.transition="transform 0.2s cubic-bezier(0,0,0.31,1)"))},n.onMove=function(e){n.dragging&&(e instanceof MouseEvent?n.currentY=e.pageY:e instanceof TouchEvent&&(n.currentY=e.touches[0].pageY),n.currentY<n.startY||(n.currentY-n.startY>=Number(n.props.pullDownToRefreshThreshold)&&n.setState({pullToRefreshThresholdBreached:!0}),n.currentY-n.startY>1.5*n.maxPullDownDistance||n._infScroll&&(n._infScroll.style.overflow="visible",n._infScroll.style.transform="translate3d(0px, "+(n.currentY-n.startY)+"px, 0px)")))},n.onEnd=function(){n.startY=0,n.currentY=0,n.dragging=!1,n.state.pullToRefreshThresholdBreached&&(n.props.refreshFunction&&n.props.refreshFunction(),n.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){n._infScroll&&(n._infScroll.style.overflow="auto",n._infScroll.style.transform="none",n._infScroll.style.willChange="unset")})},n.onScrollListener=function(e){"function"==typeof n.props.onScroll&&setTimeout(function(){return n.props.onScroll&&n.props.onScroll(e)},0);var t=n.props.height||n._scrollableNode?e.target:document.documentElement.scrollTop?document.documentElement:document.body;n.actionTriggered||((n.props.inverse?n.isElementAtTop(t,n.props.scrollThreshold):n.isElementAtBottom(t,n.props.scrollThreshold))&&n.props.hasMore&&(n.actionTriggered=!0,n.setState({showLoader:!0}),n.props.next&&n.props.next()),n.lastScrollTop=t.scrollTop)},n.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:t.dataLength},n.throttledOnScrollListener=function(e,t,n,r){var i,o=!1,a=0;function s(){i&&clearTimeout(i)}function l(){var l=this,c=Date.now()-a,u=arguments;function d(){a=Date.now(),n.apply(l,u)}o||(r&&!i&&d(),s(),void 0===r&&c>e?d():!0!==t&&(i=setTimeout(r?function(){i=void 0}:d,void 0===r?e-c:e)))}return"boolean"!=typeof t&&(r=n,n=t,t=void 0),l.cancel=function(){s(),o=!0},l}(150,n.onScrollListener).bind(n),n.onStart=n.onStart.bind(n),n.onMove=n.onMove.bind(n),n.onEnd=n.onEnd.bind(n),n}return function(e,t){function n(){this.constructor=e}KP(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){if(void 0===this.props.dataLength)throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener("scroll",this.throttledOnScrollListener),"number"==typeof this.props.initialScrollY&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener("touchstart",this.onStart),this.el.addEventListener("touchmove",this.onMove),this.el.addEventListener("touchend",this.onEnd),this.el.addEventListener("mousedown",this.onStart),this.el.addEventListener("mousemove",this.onMove),this.el.addEventListener("mouseup",this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),"function"!=typeof this.props.refreshFunction))throw new Error('Mandatory prop "refreshFunction" missing.\n Pull Down To Refresh functionality will not work\n as expected. Check README.md for usage\'')},t.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener("scroll",this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener("touchstart",this.onStart),this.el.removeEventListener("touchmove",this.onMove),this.el.removeEventListener("touchend",this.onEnd),this.el.removeEventListener("mousedown",this.onStart),this.el.removeEventListener("mousemove",this.onMove),this.el.removeEventListener("mouseup",this.onEnd)))},t.prototype.componentDidUpdate=function(e){this.props.dataLength!==e.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},t.getDerivedStateFromProps=function(e,t){return e.dataLength!==t.prevDataLength?ZP(ZP({},t),{prevDataLength:e.dataLength}):null},t.prototype.isElementAtTop=function(e,t){void 0===t&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=tM(t);return r.unit===JP?e.scrollTop<=r.value+n-e.scrollHeight+1:e.scrollTop<=r.value/100+n-e.scrollHeight+1},t.prototype.isElementAtBottom=function(e,t){void 0===t&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=tM(t);return r.unit===JP?e.scrollTop+n>=e.scrollHeight-r.value:e.scrollTop+n>=r.value/100*e.scrollHeight},t.prototype.render=function(){var e=this,t=ZP({height:this.props.height||"auto",overflow:"auto",WebkitOverflowScrolling:"touch"},this.props.style),n=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),r=this.props.pullDownToRefresh&&this.props.height?{overflow:"auto"}:{};return i.createElement("div",{style:r,className:"infinite-scroll-component__outerdiv"},i.createElement("div",{className:"infinite-scroll-component "+(this.props.className||""),ref:function(t){return e._infScroll=t},style:t},this.props.pullDownToRefresh&&i.createElement("div",{style:{position:"relative"},ref:function(t){return e._pullDown=t}},i.createElement("div",{style:{position:"absolute",left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!n&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},t}(_);function rM(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function iM(){return iM=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iM.apply(this,arguments)}function oM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oM(Object(n),!0).forEach(function(t){sM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const lM={breakpointCols:void 0,className:void 0,columnClassName:void 0,children:void 0,columnAttrs:void 0,column:void 0};class cM extends i.Component{constructor(e){let t;super(e),this.reCalculateColumnCount=this.reCalculateColumnCount.bind(this),this.reCalculateColumnCountDebounce=this.reCalculateColumnCountDebounce.bind(this),t=this.props.breakpointCols&&this.props.breakpointCols.default?this.props.breakpointCols.default:parseInt(this.props.breakpointCols)||2,this.state={columnCount:t}}componentDidMount(){this.reCalculateColumnCount(),window&&window.addEventListener("resize",this.reCalculateColumnCountDebounce)}componentDidUpdate(){this.reCalculateColumnCount()}componentWillUnmount(){window&&window.removeEventListener("resize",this.reCalculateColumnCountDebounce)}reCalculateColumnCountDebounce(){window&&window.requestAnimationFrame?(window.cancelAnimationFrame&&window.cancelAnimationFrame(this._lastRecalculateAnimationFrame),this._lastRecalculateAnimationFrame=window.requestAnimationFrame(()=>{this.reCalculateColumnCount()})):this.reCalculateColumnCount()}reCalculateColumnCount(){const e=window&&window.innerWidth||1/0;let t=this.props.breakpointCols;"object"!=typeof t&&(t={default:parseInt(t)||2});let n=1/0,r=t.default||2;for(let i in t){const o=parseInt(i);o>0&&e<=o&&o<n&&(n=o,r=t[i])}r=Math.max(1,parseInt(r)||1),this.state.columnCount!==r&&this.setState({columnCount:r})}itemsInColumns(){const e=this.state.columnCount,t=new Array(e),n=i.Children.toArray(this.props.children);for(let r=0;r<n.length;r++){const i=r%e;t[i]||(t[i]=[]),t[i].push(n[r])}return t}renderColumns(){const{column:e,columnAttrs:t={},columnClassName:n}=this.props,r=this.itemsInColumns(),o=100/r.length+"%";let a=n;a&&"string"!=typeof a&&(this.logDeprecated('The property "columnClassName" requires a string'),void 0===a&&(a="my-masonry-grid_column"));const s=aM(aM(aM({},e),t),{},{style:aM(aM({},t.style),{},{width:o}),className:a});return r.map((e,t)=>i.createElement("div",iM({},s,{key:t}),e))}logDeprecated(e){console.error("[Masonry]",e)}render(){const e=this.props,{children:t,breakpointCols:n,columnClassName:r,columnAttrs:o,column:a,className:s}=e,l=rM(e,["children","breakpointCols","columnClassName","columnAttrs","column","className"]);let c=s;return"string"!=typeof s&&(this.logDeprecated('The property "className" requires a string'),void 0===s&&(c="my-masonry-grid")),i.createElement("div",iM({},l,{className:c}),this.renderColumns())}}cM.defaultProps=lM;var uM={gifTab:"gifTab",scrollableDiv:"scrollableDiv",gifSearchInput:"gifSearchInput",search:"search",searchResults:"searchResults",myMasonryGrid:"myMasonryGrid",myMasonryGridColumn:"myMasonryGridColumn",listItem:"listItem",loaded:"loaded",loadedImage:"loadedImage",searchOutputWrapper:"searchOutputWrapper",divider:"divider",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle"};const dM={default:4,1600:3,1100:2,700:1},hM=({setImageGifList:r,imageGifList:i=[],currentReqGif:s,setCurrentReqGif:l,inputRef:c,customRequest:u})=>{const{t:d}=$n(),{GifPlayIcon:h}=Co(),{options:f}=yi(),{config:p}=f,[g,m]=o(null),[v,y]=o(!1),[b,w]=o(25),[x,C]=o(null),_=async function({query:e,page:t}){const n=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const e=`https://api.giphy.com/v1/gifs/search?api_key=${null==p?void 0:p.REACT_APP_GIPHY_KEY}&q=${n}&limit=25&offset=${t}&lang=en`,r=await fetch(e);return{data:await r.json()}}catch(e){console.warn(e)}},S=async()=>{var e,t;const n=await _({query:s,page:0});(null===(t=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.data)||void 0===t?void 0:t.length)&&n.data.data.length>0&&r(n.data.data)};return a(()=>()=>{x&&clearTimeout(x)},[x]),e("div",{className:uM.gifTab,children:e("div",{className:uM.searchOutputWrapper,children:t("div",{id:"scrollableDiv",className:uM.scrollableDiv,children:[t(T,{onValuesChange:e=>{if(void 0!==e.keywords){l(t=>Object.assign(Object.assign({},t),{keywords:e.keywords})),x&&clearTimeout(x);const t=setTimeout(S,800);C(t)}},className:i.length>0?uM.searchResults:uM.search,children:[e(T.Item,{name:"keywords",className:uM.gifSearchInput,children:e(F,{onKeyDown:e=>"Space"===e.code&&S(),onPressEnter:e=>S(),allowClear:!0,placeholder:d("Search GIFs"),ref:c,spellCheck:"false",prefix:e(li,{size:16,strokeWidth:null==p?void 0:p.iconStrokeWidth,onClick:S})})}),i.length>0&&!v&&e("div",{className:`ant-divider ${uM.divider}`,role:"separator"})]}),!i.length&&!v&&e(n,{children:s.keywords?e(Eo,{}):t("div",{className:uM.resultsContainer,children:[e("div",{className:uM.videoIcon,children:e(h,{className:uM.playButton})}),e("h1",{className:uM.title,children:d("Over 350,000 live images")}),e("p",{className:uM.subtitle,children:d("Enter a search query and we'll find the perfect image for you")})]})}),!i.length&&v&&e(vP,{}),i.length>0&&e(nM,{dataLength:i&&i.length,next:async()=>{v||(y(!0),_({query:s,page:b}).then(e=>{e&&e.data&&e.data.data&&r(t=>[...t,...e.data.data]),y(!1),w(e=>e+25)}).catch(()=>{y(!1)}))},hasMore:!!i,endMessage:t(X,{plain:!0,children:[d("That`s all we could find.")," 🤐"]}),scrollableTarget:"scrollableDiv",style:{overflow:"visible"},loader:e(vP,{}),children:e(cM,{breakpointCols:dM,className:uM.myMasonryGrid,columnClassName:uM.myMasonryGridColumn,children:i.map((n,r)=>t("div",{className:uM.listItem,onClick:()=>((e,t)=>{m(t),setTimeout(()=>{m(null)},2e3),u(e)})(n.images.downsized.url,n.id),children:[e("img",{className:g===n.id?uM.loadedImage:"",width:"100%",src:`${n.images.downsized.url}`,alt:n.title,onLoad:e=>{const t=e.target.parentNode;t&&t instanceof HTMLElement&&t.classList.add(uM.loaded)}}),e("a",{rel:"noreferrer",href:"https://giphy.com/",target:"_blank",onClick:e=>e.stopPropagation()}),g===n.id&&e(k,{className:uM.antSpin})]},n.id+r))})})]})})})};var fM={stockTab:"stockTab",stockSearchInput:"stockSearchInput",searchOutputWrapper:"searchOutputWrapper",divider:"divider",search:"search",searchResults:"searchResults",scrollableDiv:"scrollableDiv",myMasonryGrid:"myMasonryGrid",myMasonryGridColumn:"myMasonryGridColumn",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 pM={default:4,1600:3,1100:2,700:1},gM=({imageStockList:r,setImageStockList:i,currentReq:s,setCurrentReq:l,inputRef:c,customRequest:d})=>{var h;const{t:f}=$n(),{StockBigIcon:p,MixedViewIcon:g,LandscapeViewIcon:m,PortraitViewIcon:v,SquareViewIcon:y}=Co(),{options:b}=yi(),{config:w}=b,[x,C]=o(!1),[_,S]=o(2),[A,E]=o(null),[I,O]=o(null),[P,M]=o(!0),[R]=T.useForm(),j=u(s),D=(e,t,n)=>{try{const r=new URL(e),i=r.pathname.split("/").filter(Boolean),o=i.pop()||"",a=i.join("/"),s=`https://${r.host}${a?"/"+a:""}`,l=`https://px0.useblocks.io/${o}`,c=r.search?r.search.slice(1):"",u=c?`${c}&w=${t}&q=${n}`:`w=${t}&q=${n}`;return`${l}?${`${u}&proxy_url=${s}`}`}catch(t){return e}};a(()=>{j.current=s},[s]),a(()=>{0===r.length&&R.setFieldsValue({color:"",orientation:""})},[r,R]);const N=async function({query:e,page:t}){const n=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{let r=`https://px0.useblocks.io/photos?client_id=${null==w?void 0:w.UNSPLASH_KEY}&lang=ru&per_page=18&query=${n}&page=${t}&proxy_url=https://api.unsplash.com/search`;""!==e.color&&(r+=`&color=${e.color}`),""!==e.orientation&&(r+=`&orientation=${e.orientation}`);const i=await fetch(r);return{data:await i.json()}}catch(e){console.warn(e)}finally{C(!1)}},z=async()=>{var e,t,n;C(!0);const r=await N({query:j.current,page:1});(null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.results)&&(i(r.data.results),M(18===r.data.results.length),(null===(n=null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.results)||void 0===n?void 0:n.length)&&r.data.results.length>0&&S(2))};a(()=>()=>{I&&clearTimeout(I)},[I]);const B=(e,t,n)=>{!async function(e){try{const t=await fetch(`${e}&client_id=${null==w?void 0:w.UNSPLASH_KEY}`);return{data:await t.json()}}catch(e){console.warn(e)}}(t.download_location),E(n),setTimeout(()=>E(null),2e3);const r=D(e.raw,1200,96);d(r)};return e("div",{className:fM.stockTab,children:e("div",{className:fM.searchOutputWrapper,children:t("div",{className:fM.scrollableDiv,id:"scrollableDiv",children:[t(T,{form:R,initialValues:hn,onValuesChange:(e,t)=>{if(l(Object.assign(Object.assign({},hn),t)),I&&clearTimeout(I),""!==t.keywords){const e=setTimeout(z,800);O(e)}else r.length||(l(Object.assign({},hn)),R.resetFields())},className:r.length>0?fM.searchResults:fM.search,children:[t($,{gutter:24,children:[e(W,{span:r.length>0?void 0:24,children:e(T.Item,{name:"keywords",className:fM.stockSearchInput,children:e(F,{allowClear:!0,placeholder:f("Search image"),ref:c,spellCheck:"false",prefix:e(li,{size:16,strokeWidth:null==w?void 0:w.iconStrokeWidth})})})}),!!r.length&&t(n,{children:[e(W,{children:e(T.Item,{name:"orientation",children:t(ee.Group,{onChange:e=>l(t=>Object.assign(Object.assign({},t),{orientation:e.target.value})),children:[e(L,{title:f("All"),placement:"top",children:e(ee.Button,{value:"",children:e(g,{})})}),e(L,{title:f("Landscape"),placement:"top",children:e(ee.Button,{value:"landscape",children:e(m,{})})}),e(L,{title:f("Portrait"),placement:"top",children:e(ee.Button,{value:"portrait",children:e(v,{})})}),e(L,{title:f("Squarish"),placement:"top",children:e(ee.Button,{value:"squarish",children:e(y,{})})})]})})}),e(W,{children:e(T.Item,{name:"color",children:t(ee.Group,{className:fM.stockColorFilter,onChange:e=>l(t=>Object.assign(Object.assign({},t),{color:e.target.value})),children:[e(L,{title:f("All"),placement:"top",children:e(ee.Button,{className:fM.allColors,value:"",children:"All"})}),e(L,{title:f("Black"),placement:"top",children:e(ee.Button,{className:fM.blackColor,value:"black",children:"B"})}),e(L,{title:f("Black and White"),placement:"top",children:e(ee.Button,{className:fM.bwColor,value:"black_and_white",children:"B&W"})}),e(L,{title:f("White"),placement:"top",children:e(ee.Button,{className:fM.whiteColor,value:"white",children:"W"})}),e(L,{title:f("Orange"),placement:"top",children:e(ee.Button,{className:fM.orangeColor,value:"orange",children:"O"})}),e(L,{title:f("Red"),placement:"top",children:e(ee.Button,{className:fM.redColor,value:"red",children:"R"})}),e(L,{title:f("Purple"),placement:"top",children:e(ee.Button,{className:fM.purpleColor,value:"purple",children:"P"})}),e(L,{title:f("Magenta"),placement:"top",children:e(ee.Button,{className:fM.magentaColor,value:"magenta",children:"M"})}),e(L,{title:f("Green"),placement:"top",children:e(ee.Button,{className:fM.greenColor,value:"green",children:"G"})}),e(L,{title:f("Teal"),placement:"top",children:e(ee.Button,{className:fM.tealColor,value:"teal",children:"T"})}),e(L,{title:f("Blue"),placement:"top",children:e(ee.Button,{className:fM.blueColor,value:"blue",children:"B"})})]})})})]})]}),r.length>0&&!x&&e("div",{className:`ant-divider ${fM.divider}`,role:"separator"})]}),!r.length&&!x&&e(n,{children:s.keywords?e(Eo,{}):t("div",{className:fM.resultsContainer,children:[e("div",{className:fM.videoIcon,children:e(p,{className:fM.playButton})}),e("h1",{className:fM.title,children:f("Millions of free stock images")}),e("p",{className:fM.subtitle,children:f("Enter a search query and we'll find the perfect image for you")})]})}),!r.length&&x&&e(vP,{}),r.length>0&&e(nM,{dataLength:r&&r.length,next:async()=>{if(x||""===j.current.keywords)return C(!1),void(""===j.current.keywords&&M(!1));C(!0),N({query:j.current,page:_}).then(e=>{e&&e.data&&e.data.results&&(i(t=>[...t,...e.data.results]),M(18===e.data.results.length)),S(e=>e+1)}).catch(e=>{console.warn("catch",e)}).finally(()=>{C(!1)})},hasMore:P&&""!==(null===(h=j.current)||void 0===h?void 0:h.keywords),endMessage:t(X,{plain:!0,children:[f("That`s all we could find.")," 🤐"]}),scrollableTarget:"scrollableDiv",style:{overflow:"visible"},loader:e(vP,{}),children:e(cM,{breakpointCols:pM,className:fM.myMasonryGrid,columnClassName:fM.myMasonryGridColumn,children:r.map((n,r)=>t("div",{className:fM.listItem,onClick:()=>B(n.urls,n.links,n.id),children:[e("img",{className:A===n.id?fM.loadedImage:"",width:"100%",src:D(n.urls.raw,644,96),alt:n.description,onLoad:e=>{const t=e.target.parentNode;t&&t instanceof HTMLElement&&t.classList.add(fM.loaded)}}),t("p",{className:fM.creatorInfo,onClick:e=>e.stopPropagation(),children:[f("Photo by")," ",e("a",{target:"_blank",href:`${n.user.links.html}?utm_source=${null==w?void 0:w.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:n.user.name})," ",f("on")," ",e("a",{target:"_blank",href:`https://unsplash.com/?utm_source=${null==w?void 0:w.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:"Unsplash"})]}),A===n.id&&e(k,{className:fM.antSpin})]},n.id+r))})})]})})})},mM=()=>{const{options:e}=yi(),t=e.config;return c((e,n)=>{!1!==(null==t?void 0:t.pushToGTM)&&((e,t)=>{const n=()=>{try{const t=Object.assign(Object.assign({},e),{appLabel:"blocks_app"});window.dataLayer&&"function"==typeof window.dataLayer.push?window.dataLayer.push(t):console.log("Attempting to add to the dataLayer:",e)}catch(e){console.error("Ошибка при вызове GTM:",e)}};t?setTimeout(n,t):n()})(e,n)},[null==t?void 0:t.pushToGTM])};var vM="slideshowContainer",yM="slideshowImage";const bM=({images:t,transitionDuration:n=1e3,frameHeight:r})=>{const[i,s]=o([]),[l,c]=o(r);a(()=>{const e=()=>{if("undefined"==typeof window)return void c(r);const e=window.innerHeight,t=Math.max(e-260,130);if("number"==typeof r){const e=Math.min(r,t);c(e)}else c(t)};if(e(),"undefined"!=typeof window)return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r]);const u=()=>{s(e=>e.map((t,n)=>n===e.length-1?Object.assign(Object.assign({},t),{opacity:1}):t))};return a(()=>{if(t.length>0){const e=t[t.length-1];s(t=>[...t,{src:e,opacity:0}]),setTimeout(u,1e3)}else s([])},[t]),e("div",{className:vM,style:{height:l,minHeight:130},children:i.map((t,r)=>e("img",{src:`data:image/jpeg;base64, ${t.src}`,alt:`Slide ${r+1}`,className:yM,style:{opacity:t.opacity,transition:`opacity ${n}ms linear`,display:"block"}},r))})};"function"==typeof SuppressedError&&SuppressedError;const wM=t=>{var{className:n,style:r,color:i,text:o,bordered:a}=t,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["className","style","color","text","bordered"]);const l=o||"";return e(te,Object.assign({style:r,color:i,bordered:a,className:n},s,{children:l}))},xM=({text:n,counter:r,limits:i,wrapperStyles:o})=>{const{t:a}=$n(),{options:s}=yi(),l=s.config,{token:c}=A.useToken(),u=+i>0,d=!u||r<+i,h=(null==l?void 0:l.billingPageUrl)||"/billing",f=r+" "+a("of")+" "+(u?i:"∞")+" "+(n||a("tests",{count:i}))+" "+a("was used",{count:r});return t("div",{className:"limits-couter-wrapper",style:o,children:[e(wM,{bordered:!1,text:f,className:"limit-counter",style:{color:d?c.colorText:"white"},color:d?c.colorFillSecondary:"rgb(255, 77, 79)"}),u&&e("div",{style:{fontSize:14,textDecoration:"underline",cursor:"pointer"},onClick:()=>window.location.assign(h),children:a("Need more?")})]})};var CM={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 _M=f(({className:t,onClick:n})=>e("div",{className:`${CM.arrow} ${CM.arrowNext} ${t||""}`,onClick:n,children:e(D,{className:`${CM.arrowBtn} ${CM.arrowBtnNext}`,size:"large",icon:e(Ce,{})})}));_M.displayName="SampleNextArrow";const SM=f(({className:t,onClick:n})=>e("div",{className:`${CM.arrow} ${CM.arrowPrev} ${t||""}`,onClick:n,children:e(D,{className:`${CM.arrowBtn} ${CM.arrowBtnPrev}`,size:"large",icon:e(_e,{})})}));SM.displayName="SamplePrevArrow";const kM=({customRequest:n,inputAiRef:r,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,setAiImageRequest:f,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v})=>{const{t:y}=$n(),{AiIcon_2:b}=Co(),w=i.useRef(null),[x,C]=o("auto"),{aiImageCounter:_,currentAiImgLimits:S,loadingDuringGeneration:k,requestStatus:A,handleGenerate:E,convertBase64ToFile:I,isShiftPressed:O,setIsShiftPressed:P,limitsInPlugin:M}=function({setFrameHeight:e,customRequest:t,aiTabRef:n,isImageUploaded:r,setIsImageUploaded:i,aiImageRequest:s,imageAiList:l,setImageAiList:h,isLoadingAi:f,setIsLoadingAi:p}){const{t:g}=$n(),{options:m}=yi(),v=m.config,y=_i(),b=mM(),{messages:w}=m.config,[x,C]=o([]),[_,S]=o(0),[k,A]=o(null),[E,I]=o(!1),[T,F]=o(g("Evaluating the task")),[O,P]=o(!1),M=u(new Set),R=u(new Set),L=u(new Set);a(()=>{C(w)},[w]),a(()=>{l.length||k||(C([]),M.current.clear(),R.current.clear(),L.current.clear(),N.current=-1)},[l,k]);const j=d(()=>v&&"function"==typeof(null==v?void 0:v.sendAIImageRequest)?null==v?void 0:v.sendAIImageRequest:()=>Promise.resolve({}),[v]),D=c(e=>{const t=`${k}-${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(F(String(e.status)),100===e.progress){p(!1),h(e.images);const t=k,n=Array.isArray(e.images)?e.images:[];n.length>0&&t&&!M.current.has(t)&&(M.current.add(t),y.success({id:"AI_IMAGE_GENERERATION_SUCCESS",message:g("Images generated successfully"),placement:"bottomRight",data:{request:s,taskId:t,images:n}})),A(null),P(!1)}}else if(e.data&&(h([String(e.data)]),100===e.progress)){p(!1);const t=k,n=e.data?[String(e.data)]:[];n.length>0&&t&&!M.current.has(t)&&(M.current.add(t),y.success({id:"AI_IMAGE_GENERERATION_SUCCESS",message:g("Images generated successfully"),placement:"bottomRight",data:{request:s,taskId:t,images:n}})),A(null),P(!1)}}else p(!1),P(!1),k&&!R.current.has(k)&&(R.current.add(k),y.error({id:"AI_RESPONSE_INVALID",message:g("Something went wrong, please try again"),placement:"bottomRight",description:String(k)||void 0,data:{requestId:k,request:s,response:e},innerException:e}))},[s,h,F,g,p,k,y,P]),N=u(-1);a(()=>{if(x.length>0){const e=x.length-1;e>N.current&&(N.current=e,D(x[e]))}},[D,x]);const z=d(()=>{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=d(()=>v&&"object"==typeof(null==v?void 0:v.handleLimitUsageEmitter)?null==v?void 0:v.handleLimitUsageEmitter:{fire:()=>{}},[v]),U=null==v?void 0:v.elementId,{projectId:V}=v,{limits:$}=(null==v?void 0:v.limits)?v:{limits:{ai_img_limit:0}},{ai_img_limit:W}=$,H=W>0&&_>=W,q=!(!(null==v?void 0:v.limits)||!v.counters)&&cn,G=c(()=>{B.fire({name:"AiImgCount",count:_+1})},[B,_]),Y=d(()=>!H&&!q,[H,q,_,W]),X=c(async()=>{F(g("Evaluating the task")),""===s||f||(p(!0),P(!0),h([]),C([]),b({event:"submit_form",action:"ai_image_generation",entity_id:U,project_id:V}),j({body:{project_id:V,request:"create-image",connection:"midjourney",message:s}}).then(e=>{var t,n,r,i,o;const{data:a,error:l}=e||{};if(l)throw l;const c=a;if(401===(null==c?void 0:c.status)||401===(null===(t=null==c?void 0:c.data)||void 0===t?void 0:t.status))throw new Error("ERROR");const u=(null==c?void 0:c.task)||(null===(n=null==c?void 0:c.data)||void 0===n?void 0:n.task),d=null!==(i=null!==(r=null==u?void 0:u.id)&&void 0!==r?r:k)&&void 0!==i?i:void 0;200===(null==c?void 0:c.status)||200===(null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.status)?((null==u?void 0:u.id)&&(F(u.message),A(u.id)),(null==c?void 0:c.message)&&y.success({id:"AI_IMAGE_GENERATION_STARTED",message:c.message,placement:"bottomRight",data:{request:s,taskId:d,response:null==c?void 0:c.data}}),z({task_id:null==u?void 0:u.id,entity_id:U})):(p(!1),P(!1),d&&!R.current.has(d)&&(R.current.add(d),y.error({id:"AI_IMAGE_GENERATION_FAILED",message:(null==c?void 0:c.message)||g("Something went wrong, please try again"),placement:"bottomRight",description:s,data:{request:s,taskId:d,response:c},innerException:c})))}).catch(e=>{p(!1),P(!1);const t=e;return((null==t?void 0:t.error)||(null==t?void 0:t.data))&&k&&!R.current.has(k)&&(R.current.add(k),null==y||y.error({id:"AI_IMAGE_GENERATION_FAILED",message:g("Something went wrong, please try again"),placement:"bottomRight",description:s,innerException:e,data:{request:s,taskId:k,response:null==t?void 0:t.data,error:Ai(null==t?void 0:t.error)}})),t}))},[s,f,p,P,h,b,U,V,j,y,z,g,k]),K=c(()=>{Y&&X()},[Y,q,S,G,X,y,g]);a(()=>{},[v,q]);const Z=c(e=>{if(console.warn("FM AI: convertBase64ToFile start",{isImageUploaded:r,hasCustomRequest:"function"==typeof t,base64Sample:null==e?void 0:e.slice(0,30)}),r)return;const n=e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);if(!n)return void console.warn("FM AI: convertBase64ToFile no matches for base64");const o=n[1],a=n[2],s=atob(a),l=new Array(s.length);for(let e=0;e<s.length;e++)l[e]=s.charCodeAt(e);const c=new Uint8Array(l),u=new Blob([c],{type:`image/${o}`}),d=new File([u],"image.jpeg",{type:u.type,lastModified:Date.now()});i(!0),(async()=>{try{"function"==typeof t&&await Promise.resolve(t({file:d}))}catch(e){console.warn("FM AI: customRequest error",e)}finally{i(!1)}})()},[r,i,t]);return a(()=>{(f||l.length>0)&&setTimeout(()=>{var t,r;let i=350;if(n.current){const e=null===(t=n.current)||void 0===t?void 0:t.firstChild;e&&e instanceof HTMLElement&&(i=(null===(r=n.current.getBoundingClientRect())||void 0===r?void 0:r.height)-48-e.clientHeight)}e(i)},0)},[n,l.length,f,e]),{aiImageCounter:_,setAiImageCounter:S,currentAiImgLimits:W,isFieldsDisabled:H,canGenerateImage:Y,aiImageRequest:s,imageAiList:l,setImageAiList:h,isLoadingAi:f,setIsLoadingAi:p,loadingDuringGeneration:O,setLoadingDuringGeneration:P,requestStatus:T,setRequestStatus:F,handleGenerate:K,handleLimitAiImgCount:G,convertBase64ToFile:Z,isShiftPressed:E,setIsShiftPressed:I,currentReqId:k,setCurrentReqId:A,limitsInPlugin:q}}({setFrameHeight:C,customRequest:n,aiTabRef:w,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v});a(()=>{console.log("isImageUploaded",s)},[s]);const[R,L]=o(!1),j=c(()=>L(!0),[]),N=c(()=>L(!1),[]),z=c(e=>f(e.target.value),[f]),B=c(e=>{"Shift"===e.key?P(!0):"Enter"!==e.key||O||(e.preventDefault(),E())},[O,E,P]),U=c(e=>{"Shift"===e.key&&P(!1)},[P]);return t("div",{className:CM.imageAi,ref:w,children:[M&&e(xM,{text:"images",counter:_,limits:S,wrapperStyles:{marginTop:-25}}),e($,{gutter:24,className:CM.row,children:t(W,{span:24,children:[e(T.Item,{children:t("span",{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg ${CM.inputAffixWrapper}${R?" ant-input-affix-wrapper-focused":""}`,children:[e(F.TextArea,{ref:r,onKeyDown:B,onKeyUp:U,onFocus:j,onBlur:N,autoSize:!0,allowClear:!0,className:`${CM.textAreaInputHybrid} ${CM.textarea}`,placeholder:y("Generate image"),value:h,onChange:z,spellCheck:"false"}),e("span",{className:`ant-input-suffix ${CM.inputSuffix}`,children:m||k?e(oe,{className:`${CM.inputIcon} input-icon`,spin:!0}):e(b,{className:`${CM.inputIcon} input-icon`,onClick:E})})]})}),t("div",{className:CM.imageAiExample,children:[e("span",{children:y("For example:")})," ",y("A beautiful image of a sunset over a calm ocean.")]})]})}),(m||p.length>0)&&t(ne,{dotPosition:"top",arrows:!0,nextArrow:e(_M,{}),prevArrow:e(SM,{}),className:CM.carousel,infinite:!1,children:[m&&!p.length&&e("div",{className:CM.loading,children:t("div",{className:"spin",children:[e(oe,{style:{fontSize:48},spin:!0}),e("p",{className:"status",children:A})]})}),p.length>0&&p.map((n,r)=>t("div",{className:CM.imageItem,children:[e(bM,{images:p,frameHeight:x}),e("div",{className:"buttons",children:p.length>0&&!m&&e(D,{onClick:()=>I(`data:image/jpeg;base64, ${n}`),loading:s,icon:e(Se,{}),children:y("Use this variant")})})]},r))]})]})},AM=e=>{(null==e?void 0:e.customTheme)&&((e={})=>{const t=document.querySelector("head");if(!t)return;const n=document.createElement("style");if(n.type="text/css",n.dataset.themeVariablesFm="true",n.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}}`,n.appendChild(document.createTextNode(r));const i=t.querySelector('[data-theme-variables-fm="true"]');i?t.replaceChild(n,i):t.insertBefore(n,t.firstChild)}})(null==e?void 0:e.customTheme)},{Sider:EM,Content:IM}=Q,TM={keywords:""},FM=()=>{var s;const l=Ei(),d=Ni(),h=(()=>{var e,t;const{state:n,actions:r,options:i}=yi(),{selectedFolder:o,pathHistory:a,folders:s}=n,{t:l}=$n(),{setSelectedFolder:u,setPathHistory:d}=r,h=c(()=>{var e;return`em_fm:lastFolder:${(null===(e=null==i?void 0:i.config)||void 0===e?void 0:e.projectId)||"default"}`},[null===(e=null==i?void 0:i.config)||void 0===e?void 0:e.projectId]),f=c((e,t=new Set)=>{if(t.has(e))return console.warn(`Обнаружен цикл в пути к папке с id=${e}`),[];const n=(Array.isArray(s)?s:[]).find(t=>t.id===e);if(!n)return[];const r=new Set(t);return r.add(e),n.parentId?n.parentId===n.id?(console.warn(`Обнаружена циклическая зависимость: папка ${n.id} является родителем самой себя`),[{id:n.id,name:n.name+" (ошибка)"}]):[...f(n.parentId,r),{id:n.id,name:n.name}]:[{id:n.id,name:n.name}]},[s]),p=c(e=>{var t;if("undefined"==typeof window)return;const n=!0===(null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.rememberLastFolder),r=h();try{if(!n)return void localStorage.removeItem(r);e?localStorage.setItem(r,e):localStorage.removeItem(r)}catch(e){}},[h,null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.rememberLastFolder]),g=c(e=>{if("folders"===e){const e=[{id:"folders",name:l("Folders")}];return null==d||d(e),void(i.onPathChange&&i.onPathChange([]))}if(!(Array.isArray(s)?s:[]).find(t=>t.id===e))return void console.warn("⚠️ Папка не найдена:",e);const t=f(e),n=[{id:"folders",name:l("Folders")},...t];null==d||d(n),i.onPathChange&&i.onPathChange(n.map(e=>e.name))},[s,f,d,i,l]),m=c(e=>{const t="folders"===e?null:e;t!==o&&(null==u||u(t),p(t),g(e))},[p,o,u,g]),v=c(e=>{if(-1===e)null==u||u(null),null==d||d([{id:"folders",name:l("Folders")}]),i.onPathChange&&i.onPathChange([]);else{const t=a.slice(0,e+1),n=t[t.length-1],r="folders"===n.id?void 0:n.id;null==u||u(r||null),null==d||d(t),i.onPathChange&&i.onPathChange(t.map(e=>e.name))}},[i,a,d,u,l]),y=c(e=>{if(!e.isFolder)return;null==u||u(e.id);const t={id:e.id,name:e.name};if(d){const e=[...a,t];d(e)}if(i.onPathChange){const t=[...a.map(e=>e.name),e.name];i.onPathChange(t)}},[i,a,d,u]);return{state:{selectedFolder:o,pathHistory:a},actions:{handleFolderSelect:m,handleBreadcrumbClick:v,handleItemClick:y},selectedFolder:o,pathHistory:a,handleFolderSelect:m,handleBreadcrumbClick:v,handleItemClick:y}})(),f=(()=>{const{state:e,actions:t}=yi(),{pagination:n}=e,{setPagination:r}=t,i=c((e,t)=>{const i=t||n.pageSize;null==r||r({current:e,pageSize:i,total:n.total})},[n.pageSize,n.total,r]);return{state:{pagination:n},actions:{handlePaginationChange:i}}})(),p=(()=>{const[e,t]=r.useState(()=>{const e=localStorage.getItem(zi);return e?Math.max(290,parseInt(e,10)):298}),[n,i]=r.useState(!1),[o,a]=r.useState(!1),[s,l]=r.useState(0),c=r.useCallback(()=>{console.log("Double click: Resetting to default width"),t(298),localStorage.setItem(zi,298..toString())},[]),u=r.useCallback(n=>{n.preventDefault(),n.stopPropagation(),i(!0),document.body.classList.add("resizing");const r=n.clientX,o=e;let s=o;const c=e=>{e.preventDefault();const n=Math.max(Math.min(o+e.clientX-r,600),290);s=n,t(n),l(e.clientX),a(!0)},u=()=>{i(!1),document.body.classList.remove("resizing"),a(!1),localStorage.setItem(zi,s.toString()),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",u)},[e]);return r.useEffect(()=>()=>{document.body.classList.remove("resizing")},[]),{sidebarWidth:e,isResizing:n,showResizeGuide:o,resizeGuidePosition:s,handleResizeStart:u,handleDoubleClick:c}})(),g=(()=>{const[e,t]=o([]),[n,r]=o(!1),[i,a]=o(!1),s=u(0),l=u(new Map),{state:{files:d}}=yi(),h=c(()=>(s.current+=1,`upload_${s.current}_${Date.now()}`),[]),f=c(e=>`${(e.size/1024).toFixed(2)} КБ`,[]),p=c(e=>{const n=e.map(e=>({id:h(),name:e.name,size:f(e),status:"uploading",progress:0}));return t(n),r(!0),a(!1),n.map(e=>e.id)},[h,f]),g=c((e,n)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{progress:Math.min(100,Math.max(0,n))}):t))},[]),m=c((e,n)=>{n&&l.current.set(e,n),t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{status:"success",progress:100}):t))},[]),v=c((e,n)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{status:"error",error:n}):t))},[]),y=c(()=>{r(!1),a(!1),setTimeout(()=>{t([]),l.current.clear()},300)},[]),b=c(()=>{a(e=>!e)},[]),w=c((n,i)=>{let o=l.current.get(n);if(!o){const t=e.find(e=>e.id===n);if(t&&Array.isArray(d)){const e=d.find(e=>!e.isFolder&&e.name===t.name);e&&(o=e)}}o&&i&&i(o),l.current.delete(n),t(e=>{const t=e.filter(e=>e.id!==n);return 0===t.length&&setTimeout(()=>{r(!1),a(!1)},100),t})},[d,e]),x=e.length,C=e.filter(e=>"success"===e.status||"error"===e.status).length;return{uploadFiles:e,isUploadVisible:n,isUploadMinimized:i,totalFiles:x,completedFiles:C,startUpload:p,updateProgress:g,markAsSuccess:m,markAsError:v,closeUpload:y,minimizeUpload:b,insertFile:w}})(),m=Ti(),{t:v}=$n(),{options:y}=i.useContext(vi),b=null==y?void 0:y.config,w=i.useRef(null),[x,C]=o(!1),{folders:_,loading:S}=l.state,{fetchFolders:A,fetchChildFolders:E,handleCreateFolder:I,handleModalOk:T,handleModalCancel:F,generateMenuItems:O}=l.actions,P=(e=>{var t;const{state:n,actions:r,options:i}=yi(),{t:o}=$n(),a=_i(),{folders:s,folderToRename:l,renameFolderForm:u,isRenameFolderModalVisible:d}=n,{setFolderToRename:h,setIsRenameFolderModalVisible:f}=r,{apiEndpoints:p,dataProviders:g,config:m}=i,v=c(e=>{null==h||h(e),null==f||f(!0);const t=null==s?void 0:s.find(t=>t.id===e);t&&u&&u.setFieldsValue({newFolderName:t.name})},[h,f,s,u]),y=c(()=>{null==f||f(!1),null==h||h(null),null==u||u.resetFields()},[f,h,u]),b=c(async()=>{var t,n;if(l&&u)try{const i=await u.validateFields();if(!(null==i?void 0:i.newFolderName))return void a.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:o("Folder name cannot be empty"),placement:"bottomRight",data:{folderId:l,folderName:null==i?void 0:i.newFolderName,reason:"emptyName"}});if(!1===(null===(t=null==m?void 0:m.features)||void 0===t?void 0:t.enableRenameFolder))return void a.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:o("Folder rename is disabled by config"),placement:"bottomRight",data:{itemId:null!=l?l:void 0,itemName:null==i?void 0:i.newFolderName}});if(!(null==g?void 0:g.renameFolder))throw new Error(o("renameFolder is not implemented in dataProviders"));const s=await g.renameFolder(l,i.newFolderName.trim());if(!(null==s?void 0:s.id))return void a.error({id:"FOLDER_RENAME_FAILED",message:o("Unexpected response when renaming folder"),placement:"bottomRight",data:{itemId:null!=l?l:void 0,itemName:i.newFolderName,error:{message:"invalidResponse"}}});a.success({id:"FOLDER_RENAME_SUCCESS",message:o("Folder renamed"),placement:"bottomRight",data:{itemId:s.id,itemName:s.name,folderId:null!==(n=s.parentId)&&void 0!==n?n:null}}),y(),await e(),l!==s.id&&r.setSelectedFolder&&r.setSelectedFolder(s.id)}catch(e){console.error("Ошибка при переименовании папки:",e),a.error({id:"FOLDER_RENAME_FAILED",message:o("Failed to rename folder"),placement:"bottomRight",innerException:e,data:{itemId:null!=l?l:void 0,itemName:null==u?void 0:u.getFieldValue("newFolderName"),error:{message:e instanceof Error?e.message:String(e)}}})}},[l,u,p,y,e,o,null===(t=null==m?void 0:m.features)||void 0===t?void 0:t.enableRenameFolder,a]);return{state:{isRenamingFolder:d||!1,folderToRename:l},actions:{showRenameFolderModal:v,handleRenameFolderCancel:y,handleRenameFolderOk:b}}})(A),{files:M,selectedFiles:R,loading:L,isRenamingFile:j,fileToRename:N}=d.state,{fetchFiles:z,handleDeleteFile:B,handleDeleteFolder:U,handleAddFile:V,handleAddFileByUrl:$,uploadFileWithProvider:W,toggleFileSelection:H,showRenameModal:q,handleRenameCancel:G,handleRenameOk:Y,handleDroppedFiles:K,showMoveModal:Z,handleMoveCancel:J,handleMoveOk:ee,handleCopyOk:te,handleCopyCancel:ne,showDeleteConfirm:re,handleDeleteConfirmCancel:ie,handleDeleteConfirmOk:oe}=d.actions,{selectedFolder:ae,pathHistory:se}=h.state,{handleFolderSelect:le,handleBreadcrumbClick:ce,handleItemClick:ue}=h.actions,{pagination:de}=f.state,he=Ci(z),{searchTerm:fe,sortBy:pe,sortOrder:ge}=he.state,{handleSearch:me,handleSort:ve,handlePaginationChange:ye}=he.actions,be=(({files:e,selectedFiles:t,fetchFiles:n,selectedFolder:i})=>{const{t:o}=$n(),a=_i(),{options:s,actions:l,state:c}=r.useContext(vi),{setActiveLibraryItem:u}=l,{activeLibraryItem:d}=c,h=Ti(),[f,p]=r.useState(!1),[g,m]=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 un.includes(t)}const n=null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();return!!n&&un.includes(n)},[]),y=r.useCallback(async e=>{var t,n,r,i;const{dataProviders:o}=s;if(console.log("🔧 saveFileToServer: dataProviders доступны:",{hasUpdateFile:!!(null==o?void 0:o.updateFile),hasUploadFile:!!(null==o?void 0:o.uploadFile),hasThumbnail:!!e.thumbnail,fileId:e.id}),!1!==(null===(n=null===(t=s.config)||void 0===t?void 0:t.features)||void 0===n?void 0:n.enableUpdateFile)&&(null==o?void 0:o.updateFile)&&e.thumbnail)try{const t=xn(e.thumbnail,e.type),n=Cn(t),r=e.name.substring(0,e.name.lastIndexOf("."))+"."+n,i=An(e.thumbnail,t);return await o.updateFile(e.id,{name:r,type:t,data:i})}catch(e){return console.error("Ошибка при обновлении файла через updateFile:",e),null}else if(e.thumbnail)try{const t=xn(e.thumbnail,e.type),n=An(e.thumbnail,t),r=new File([n],e.name,{type:t,lastModified:Date.now()});return await h.uploadFileWithProvider(r,e.folderId||void 0)||null}catch(e){return console.error("Ошибка при сохранении файла:",e),null}else if(!1!==(null===(i=null===(r=s.config)||void 0===r?void 0:r.features)||void 0===i?void 0:i.enableRenameFile)&&(null==o?void 0:o.renameFile))try{return await o.renameFile(e.id,e.name)}catch(e){return console.error("Ошибка при переименовании файла:",e),null}return console.warn("DataProvider для обновления файлов не настроен"),null},[s,h]),b=r.useCallback(n=>{let r;if(console.log("🎨 handleEdit ВЫЗВАНА!",{fileForEdit:n,selectedFilesSize:t.size}),n)console.log("fileForEdit",n),r=n;else{if(1!==t.size)return;const n=Array.from(t)[0];if(r=e.find(e=>e.id===n),!r||r.isFolder||!v(r))return}console.log("🎨 usePixieEditor: Открываем редактор для файла:",r),u&&u(rn),console.log("🎨 usePixieEditor: Устанавливаем editingFile"),m(r),console.log("🎨 usePixieEditor: Устанавливаем isPixieEditorVisible = true"),p(!0),console.log("🎨 usePixieEditor: Редактор должен открыться")},[t,e,v,p,u]),w=r.useCallback(()=>{console.log("🎨 usePixieEditor: Закрываем редактор"),u&&d===rn&&u(Qt),p(!1),m(null),console.log("🎨 usePixieEditor: Редактор закрыт")},[d,u]),x=r.useCallback(async e=>{var t,r,l,c;console.log("Файл обновляется:",e);try{const l=await y(e);if(l)return a.success({id:"IMAGE_UPDATE_SUCCESS",message:o("Success"),description:o("Image updated successfully"),placement:"bottomRight",data:{itemId:null!==(t=l.id)&&void 0!==t?t:void 0,itemName:l.name,folderId:null!==(r=l.folderId)&&void 0!==r?r:null,thumbnail:l.thumbnail}}),s.onEditorOk&&s.onEditorOk(l),await n({folderId:i||""}),w(),l}catch(t){console.error("Ошибка при сохранении файла:",t);const n=t instanceof Error?t.message:o("Unknown error");a.error({id:"IMAGE_SAVE_FAILED",message:o("Error"),description:o("Failed to save changes",{error:n}),innerException:t,placement:"bottomRight",data:{itemId:null!==(l=e.id)&&void 0!==l?l:void 0,itemName:e.name,folderId:null!==(c=e.folderId)&&void 0!==c?c:null,thumbnail:e.thumbnail}})}},[y,s,n,i,a,w]);return{isPixieEditorVisible:f,editingFile:g,handleEdit:b,handlePixieEditorSave:x,handlePixieEditorClose:w}})({files:M||[],selectedFiles:R||new Set,fetchFiles:z,selectedFolder:ae||null}),we=i.useCallback(async()=>{var e;await oe(),await A(),await(null===(e=w.current)||void 0===e?void 0:e.refreshFileCounts())},[A,oe]),xe=i.useCallback(async e=>{var t;await ee(e),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())},[ee]),Ce=i.useCallback(async e=>{var t;await te(e),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())},[te]),_e=i.useCallback(async()=>{let e=[],t=new Map;await V({onStartBatch:n=>{e=g.startUpload(n),t=new Map(n.map((t,n)=>[t.name,e[n]])),console.warn("🚀 onStartBatch: файлы запущены",{count:n.length,currentIds:e})},onStart:n=>{0===e.length&&(e=g.startUpload([n]),t.set(n.name,e[0]))},onProgress:(e,n)=>{const r=t.get(e);r&&g.updateProgress(r,n)},onComplete:async e=>{var n;const r=t.get(e);if(r){await new Promise(e=>setTimeout(e,100));const t=null==M?void 0:M.find(t=>t.name===e&&!t.isFolder);g.markAsSuccess(r,t)}await(null===(n=w.current)||void 0===n?void 0:n.refreshFileCounts())},onError:(e,n)=>{const r=t.get(e);r&&g.markAsError(r,n)},onBatchComplete:async e=>{var n;e.successes.forEach(e=>{const n=t.get(e);n&&(g.updateProgress(n,100),g.markAsSuccess(n))}),e.errors.forEach(({fileName:e,error:n})=>{const r=t.get(e);r&&g.markAsError(r,n)}),await(null===(n=w.current)||void 0===n?void 0:n.refreshFileCounts())}})},[V,g,M]),Se=i.useCallback(async(e,t)=>{var n;try{C(!0);const r=await $(e,t);await(null===(n=w.current)||void 0===n?void 0:n.refreshFileCounts()),r&&(null==y?void 0:y.onEditorOk)&&y.onEditorOk(r)}finally{C(!1)}},[$,y]),ke=i.useCallback(async({file:e})=>{var t;console.warn("FM AI: customRequest start",{hasInitOptions:!!y,hasOnEditorOk:"function"==typeof(null==y?void 0:y.onEditorOk),selectedFolder:ae,fileName:null==e?void 0:e.name,fileType:null==e?void 0:e.type});const n=await W(e);console.warn("FM AI: uploadFileWithProvider result",{uploaded:n,hasUploaded:!!n,uploadedId:null==n?void 0:n.id,uploadedName:null==n?void 0:n.name,uploadedFolderId:null==n?void 0:n.folderId});const r=n&&n.folderId||ae||null;return le&&le(r&&"folders"!==r?r:"folders"),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts()),n&&(null==y?void 0:y.onEditorOk)&&(console.warn("AI upload completed in FileManagerApp with onEditorOk",{uploadedId:n.id,uploadedName:n.name,uploadedFolderId:n.folderId}),y.onEditorOk(n)),n},[W,le,ae,y]),Ae=i.useCallback(async e=>{var t;await B(e),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())},[B]),Ee=i.useCallback(async e=>{var t;if(K){const n=g.startUpload(e);console.warn("🚀 Drag&Drop: файлы запущены",{fileCount:e.length,fileIds:n}),e.forEach(async(e,t)=>{const r=n[t];if(!r)return;let i=0;const o=setInterval(()=>{i=Math.min(i+10+Math.floor(Date.now()%10),85),g.updateProgress(r,i)},200);setTimeout(()=>{clearInterval(o)},2e3)}),await K(e),n.forEach(e=>{g.updateProgress(e,100),g.markAsSuccess(e)}),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())}},[K,g]),Ie=i.useCallback(async e=>{var t;await U(e),await A(),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())},[U,A]),Te=(({files:e,selectedFiles:t,toggleFileSelection:n,showRenameModal:i,showMoveModal:o,showCopyModal:a,handleDeleteFile:s,handleDeleteFolder:l,showDeleteConfirm:c,onEdit:u})=>{const d=r.useCallback(()=>{t&&t.size>0&&t.forEach(e=>{n(e)})},[t,n]),h=r.useCallback(e=>{if(t&&1===t.size||e){const n=e||Array.from(t)[0];i(n)}},[t,i]),f=r.useCallback(n=>{if(t&&t.size>0||(null==n?void 0:n.id)){if(c)return void c();(n?[n.id]:t).forEach(t=>{const n=e.find(e=>e.id===t);console.log("item",n),n?n.isFolder?l(t):s(t):console.warn(`Объект с ID ${t} не найден в списке файлов`)})}},[t,e,s,l,c]);return{handleClearSelection:d,handleRename:h,handleDeleteSelected:f,handleCopy:r.useCallback(()=>{a()},[a]),handleMove:r.useCallback(()=>{o()},[o]),handleEdit:r.useCallback(()=>{console.log("onEdit"),u()},[u])}})({files:M||[],selectedFiles:R||new Set,toggleFileSelection:H,showRenameModal:q,showMoveModal:Z,showCopyModal:d.actions.showCopyModal||(()=>{}),handleDeleteFile:B,handleDeleteFolder:Ie,showDeleteConfirm:re,onEdit:be.handleEdit}),Fe=S||L;a(()=>{bn()},[]),i.useEffect(()=>{if(!le||0===_.length)return;const e=!1!==(null==b?void 0:b.rememberLastFolder),t=`em_fm:lastFolder:${(null==b?void 0:b.projectId)||"default"}`;if(e&&"undefined"!=typeof window)try{const e=localStorage.getItem(t);if(e&&_.some(t=>t.id===e))return void le(e)}catch(e){}ae||le("folders")},[ae,le,_,null==b?void 0:b.rememberLastFolder,null==b?void 0:b.projectId]);const{state:Oe,actions:Pe,options:Me}=i.useContext(vi),{form:Re,urlForm:Le,renameForm:je,moveForm:De,renameFolderForm:Ne,copyForm:ze,isModalVisible:Be,isUrlModalVisible:Ue,isMoveModalVisible:Ve,isRenameFolderModalVisible:$e,isCopyModalVisible:We,isDeleteConfirmVisible:He,folderToRename:qe,activeLibraryItem:Ge}=Oe,{setIsUrlModalVisible:Ye,setSortField:Xe,setActiveLibraryItem:Ke}=Pe,{config:Ze}=Me,{handleRenameFolderCancel:Je,handleRenameFolderOk:Qe}=P.actions,et=c(e=>{ye(e.current||de.current,e.pageSize||de.pageSize)},[ye,de]),tt=i.useCallback(e=>{const{sortBy:t,sortOrder:n}=(e=>{const[t,n]=e.split("-");return{sortBy:t,sortOrder:n}})(e);ve(t,n)},[ve]),[nt,rt]=o(TM),[it,ot]=o([]),at=u(null),[st,lt]=o(hn),[ct,ut]=o([]),dt=u(null),[ht,ft]=o(""),[pt,gt]=o([]),mt=i.useRef(void 0),[vt,yt]=o(!1),[bt,wt]=o(!1),xt=i.useRef(null),Ct=c(async()=>{const e=null==Ze?void 0:Ze.fileForEdit;if(mt.current!==e){mt.current=e;try{if(!(Ge===rn&&e&&!be.editingFile))return;if("string"==typeof e){if(e.startsWith("data:"))return void(null==be||be.handleEdit({thumbnail:e}));const t=await m.handleAddFileByUrl(e,!0);if(!t)throw new Error(v("Failed to download file"));mt.current===e&&(null==be||be.handleEdit(t))}}finally{mt.current===e&&(mt.current=null)}}},[null==Ze?void 0:Ze.fileForEdit,Ge,be,m]);a(()=>{Ct()},[Ct]),a(()=>{var e,t,n;Ge===Qt?(console.warn("reset requests"),ot([]),rt(TM),ut([]),lt(hn),gt([]),ft(""),wt(!1),yt(!1)):Ge===nn?null===(e=xt.current)||void 0===e||e.focus():Ge===en?null===(t=at.current)||void 0===t||t.focus():Ge===tn&&(null===(n=dt.current)||void 0===n||n.focus())},[Ge]);const _t=i.useCallback(async()=>{var e;await Qe(),await(null===(e=w.current)||void 0===e?void 0:e.refreshFileCounts())},[Qe]),St=R.size,kt=i.useMemo(()=>{var e,t,n;if(1!==St)return!1;const[r]=Array.from(R),i=M.find(e=>e.id===r);if(!i||i.isFolder)return!1;const o="string"==typeof i.name?i.name:"",a=o?null===(e=o.split(".").pop())||void 0===e?void 0:e.toLowerCase():void 0,s=null!==(n=null===(t=i.extension)||void 0===t?void 0:t.toLowerCase())&&void 0!==n?n:a;return"string"==typeof i.type&&i.type.startsWith("image/")||"string"==typeof s&&un.includes(s)},[St,R,M]);return t(Q,{className:"file-manager__layout",children:[p.showResizeGuide&&e("div",{className:"resize-guide",style:{left:`${p.resizeGuidePosition}px`}}),t(Q,{className:"file-manager__content",children:[t(EM,{width:320,theme:"light",className:"file-manager-sider",children:[e(Yo,{ref:w,selectedFolder:ae||"folders",generateMenuItems:O,onFolderSelect:e=>null==le?void 0:le(e),folders:_||[],fetchFolders:A,fetchChildFolders:E,handleAddFile:_e,setIsUrlModalVisible:e=>null==Ye?void 0:Ye(e),handleDeleteFolder:Ie,handleCreateFolder:I,activeLibraryItem:Ge,setActiveLibraryItem:e=>null==Ke?void 0:Ke(e)}),e("div",{className:"sidebar-resizer "+(p.isResizing?"resizing":""),onMouseDown:p.handleResizeStart,onDoubleClick:p.handleDoubleClick,children:e("div",{className:"sidebar-resizer-indicator"})})]}),e(Q,{className:"file-manager__main-content",children:t(IM,{className:"main-content",children:[e(XP,{activeLibraryItem:Ge,selectedFolder:(null===(s=null==_?void 0:_.find(e=>(null==e?void 0:e.id)===ae))||void 0===s?void 0:s.name)||v("Folders")}),e(X,{className:"zero-divider"}),Ge===Qt&&e(Mo,{searchTerm:fe,sortField:Oe.sortField||"name",setSortField:e=>null==Xe?void 0:Xe(e),pathHistory:se||[],handleBreadcrumbClick:e=>null==ce?void 0:ce(e),handleAddFile:_e,setIsUrlModalVisible:e=>null==Ye?void 0:Ye(e),files:M||[],handleSearch:me,handleSort:ve,sortBy:pe,sortOrder:ge,handleSortOptionChange:tt,pagination:de,setPagination:et,loading:Fe,handleItemClick:e=>null==ue?void 0:ue(e),handleDeleteFile:Ae,selectedFiles:R||new Set,toggleFileSelection:e=>null==H?void 0:H(e),handleDroppedFiles:Ee,fileUpload:g,onClearSelection:Te.handleClearSelection,onRename:Te.handleRename,onCopy:Te.handleCopy,onMove:Te.handleMove,onDelete:Te.handleDeleteSelected,onEdit:be.handleEdit}),Ge===en&&e(hM,{imageGifList:it,setImageGifList:ot,currentReqGif:nt,setCurrentReqGif:rt,inputRef:at,customRequest:Se}),Ge===tn&&e(gM,{imageStockList:ct,setImageStockList:ut,currentReq:st,setCurrentReq:lt,inputRef:dt,customRequest:Se}),Ge===nn&&!!(null==Ze?void 0:Ze.sseQuery)&&e(kM,{imageAiList:pt,setImageAiList:gt,aiImageRequest:ht,setAiImageRequest:ft,inputAiRef:xt,customRequest:ke,isLoadingAi:vt,setIsLoadingAi:yt,isImageUploaded:bt,setIsImageUploaded:wt}),Ge===rn&&e(n,{}),e("div",{children:kt&&t(n,{children:[e(X,{className:"zero-divider"}),e("div",{style:{display:"flex",justifyContent:"right",padding:"17px 24px",alignItems:"center"},children:e(D,{size:"large",type:"primary",style:{height:40},onClick:()=>{if(Me.onEditorOk){const e=Array.from(R)[0],t=M.find(t=>t.id===e);t&&Me.onEditorOk(t)}},children:v("Choose")})})]})})]})})]}),x&&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(k,{size:"large"})}),e(qo,{isModalVisible:Be,handleModalOk:T,handleModalCancel:F,form:Re,selectedFolder:ae||null,folders:_||[],isUrlModalVisible:Ue,setIsUrlModalVisible:e=>null==Ye?void 0:Ye(e),handleAddFileByUrl:Se,urlForm:Le,isRenameModalVisible:j,handleRenameOk:()=>null==Y?void 0:Y(),handleRenameCancel:()=>null==G?void 0:G(),renameForm:je,fileToRename:N,files:M||[],isMoveModalVisible:Ve,handleMoveOk:xe,handleMoveCancel:J,moveForm:De,selectedFiles:R||new Set,isRenameFolderModalVisible:$e,handleRenameFolderOk:_t,handleRenameFolderCancel:Je,renameFolderForm:Ne,folderToRename:qe,isCopyModalVisible:We,handleCopyOk:Ce,handleCopyCancel:ne,copyForm:ze,isDeleteConfirmVisible:He,handleDeleteConfirmOk:we,handleDeleteConfirmCancel:()=>null==ie?void 0:ie(),fetchChildFolders:E}),e(_P,{visible:be.isPixieEditorVisible,onClose:be.handlePixieEditorClose,file:be.editingFile,onSave:be.handlePixieEditorSave}),e(qP,{files:g.uploadFiles,visible:g.isUploadVisible,minimized:g.isUploadMinimized,totalFiles:g.totalFiles,completedFiles:g.completedFiles,onClose:g.closeUpload,onMinimize:g.minimizeUpload,onInsert:e=>g.insertFile(e,Me.onEditorOk)})]})},OM=f(({config:r={},onPathChange:o,onChangeSelection:s,onEditorOk:l,searchQuery:c="",sortBySize:d="name",apiEndpoints:h={},customIcons:f,dragDropIcon:p,dataProviders:g,handleNotify:m,handleError:v,handleSuccess:y})=>{const b=i.useMemo(()=>Object.assign({folderTreeLoading:"lazy",expandAllFoldersOnInit:!1,expandRootFolderOnInit:!1,iconStrokeWidth:1.4,availableImageExtensions:["jpg","jpeg","png","gif"]},r),[r]);i.useEffect(()=>{b.theme&&(e=>{if("system"===e){const t=matchMedia(ln).matches?an:on;e=e===sn?t:e}document.documentElement.setAttribute("data-theme",e)})(b.theme),AM(b)},[b]),a(()=>{b.locale&&b.locale!==Rr.language&&(console.warn("FileManagerApp: меняем локаль с",Rr.language,"на",b.locale),Rr.changeLanguage(b.locale)),b.customLocale&&b.locale&&Rr.addResourceBundle(b.locale,"translation",b.customLocale,!0,!0)},[b.locale,b.customLocale]);const w=u(null);return e(I,{className:"em-filemanager",children:t(n,{children:[e(E,{getPopupContainer:()=>w.current||document.body,children:e(bi,{options:{apiEndpoints:h,searchQuery:c,sortBySize:d,onPathChange:o,onChangeSelection:s,onEditorOk:l,config:b,customIcons:f,dragDropIcon:p,dataProviders:g,handleNotify:m,handleError:v,handleSuccess:y},children:e(FM,{})})}),e("div",{ref:w,className:"file-manager-modal-root"})]})})});OM.displayName="FileManagerApp";const PM=t=>{var n,r,i;return e(Wn,{i18n:Rr,children:e(gn,{externalTheme:null!==(r=null===(n=t.config)||void 0===n?void 0:n.theme)&&void 0!==r?r:"light",customThemeToken:null===(i=t.config)||void 0===i?void 0:i.customTheme,children:e(re,{children:e(OM,Object.assign({},t))})})})},MM=new Map,RM=(t,n)=>{var r;let i;bn();let o={};const a=e=>{const t=!e||"fileManager"!==e.mode&&"imageCenter"!==e.mode&&"plugin"!==e.mode?void 0:e.mode;return"imageCenter"===t?vn("imageCenter",e):vn(t)};if(t instanceof HTMLElement){i=t;o={config:a(n),apiEndpoints:null==n?void 0:n.apiEndpoints}}else{i=t.element;const e=a(t.config),n=Object.assign(Object.assign({},null===(r=t.config)||void 0===r?void 0:r.apiEndpoints),t.apiEndpoints);o={config:e,currentPath:t.currentPath,onPathChange:t.onPathChange,onChangeSelection:t.onChangeSelection,searchQuery:t.searchQuery,sortBySize:t.sortBySize,apiEndpoints:n,dataProviders:t.dataProviders,customIcons:t.customIcons,dragDropIcon:t.dragDropIcon,handleNotify:t.handleNotify,handleError:t.handleError,handleSuccess:t.handleSuccess}}const s=S(i);s.render(e(PM,Object.assign({},o))),MM.set(i.id||`container_${Date.now()}`,s)},LM=e=>{const t=e.id||Object.keys(MM).find(e=>e.startsWith("container_"));if(t&&MM.has(t)){const e=MM.get(t);null==e||e.unmount(),MM.delete(t)}else{console.warn("Не удалось найти корень для размонтирования");try{S(e).unmount()}catch(e){console.error("Ошибка при размонтировании компонента:",e)}}},jM=new Map,DM=r=>{const{onClose:o,onSave:a,dataProviders:s,theme:l}=r,c=i.useMemo(()=>{if(r.file)return r.file;const e=r.name||"edited-image",t=r.extension||(r.type?r.type.split("/")[1]:"png"),n=r.type||`image/${t}`;return{thumbnail:r.imageDataUrl||"",name:e,id:void 0,type:n,extension:t}},[r.file,r.imageDataUrl,r.name,r.extension,r.type]),d=i.useCallback(async e=>{if(console.log("🔧 saveFileToServer: dataProviders доступны:",{hasUpdateFile:!!(null==s?void 0:s.updateFile),hasThumbnail:!!e.thumbnail,fileId:e.id}),(null==s?void 0:s.updateFile)&&e.thumbnail)try{const t=xn(e.thumbnail,e.type),n=Cn(t),r=e.name.substring(0,e.name.lastIndexOf("."))+"."+n,i=An(e.thumbnail,t);return await s.updateFile(e.id,{name:r,type:t,data:i})}catch(e){return console.error("Ошибка при обновлении файла через updateFile:",e),null}return console.warn("DataProvider для обновления файлов не настроен"),null},[s]),h=i.useCallback(async e=>{if((null==s?void 0:s.updateFile)&&e.id&&e.thumbnail)try{const t=await d(e);t&&(e=t)}catch(e){console.error("Standalone Pixie: saveFileToServer error",e)}return a&&await a(e),o&&o(),e},[s,a,o,d]),f=u(null);return e(I,{className:"em-filemanager",children:t(n,{children:[e(E,{getPopupContainer:()=>f.current||document.body,children:e(Wn,{i18n:Rr,children:e(gn,{externalTheme:null!=l?l:"light",children:e(re,{children:e(bi,{options:{dataProviders:s,handleNotify:r.handleNotify,handleError:r.handleError,handleSuccess:r.handleSuccess,config:{theme:null!=l?l:"light",locale:r.locale,baseUrl:r.baseUrl,assetsUrl:r.assetsUrl,showNotifications:r.showNotifications}},children:e(_P,{visible:!0,onClose:o,file:c,onSave:h})})})})})}),e("div",{ref:f,className:"file-manager-modal-root"})]})})},NM=t=>{bn();const n=t.element,r=S(n);r.render(e(DM,Object.assign({},t))),jM.set(n.id||`pixie_container_${Date.now()}`,r)},zM=e=>{const t=Array.from(jM.keys()).find(e=>e.startsWith("pixie_container_")),n=e.id||t;if(n&&jM.has(n)){const e=jM.get(n);null==e||e.unmount(),jM.delete(n)}else{console.warn("Не удалось найти корень Pixie для размонтирования");try{S(e).unmount()}catch(e){console.error("Ошибка при размонтировании Pixie:",e)}}},BM=e=>{var t,n;const{mode:r,element:i,fileManager:o,pixieEditor:a,theme:s,dataProviders:l}=e;let c,u;const d={unmount:()=>{c&&LM(c),u&&zM(u)},unmountFileManager:void 0,unmountPixieEditor:void 0};switch(r){case"fileManager":c=i,RM(i,Object.assign(Object.assign({},null==o?void 0:o.config),{theme:s||(null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.theme),apiEndpoints:null==o?void 0:o.apiEndpoints})),d.unmountFileManager=()=>LM(c);break;case"pixieEditor":u=i,NM(Object.assign({element:i,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountPixieEditor=()=>zM(u);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%;",i.appendChild(e),i.appendChild(t),c=e,u=t,RM(c,Object.assign(Object.assign({},null==o?void 0:o.config),{theme:s||(null===(n=null==o?void 0:o.config)||void 0===n?void 0:n.theme),apiEndpoints:null==o?void 0:o.apiEndpoints})),NM(Object.assign({element:u,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountFileManager=()=>LM(c),d.unmountPixieEditor=()=>zM(u);break}}return d};class UM extends Error{constructor(e,t,n,r){super(e),this.code=t,this.status=n,this.details=r,this.name="FileManagerApiError",Error.captureStackTrace&&Error.captureStackTrace(this,UM)}}function VM(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}}var $M={init:RM,unmount:LM,initPixieEditor:NM,unmountPixieEditor:zM,initFileManager:BM};export{Mo as FileContent,UM as FileManagerApiError,OM as FileManagerApp,PM as FileManagerAppWithContext,qo as FileModals,Yo as FolderSidebar,DM as PixieOnlyApp,$M as default,RM as init,BM as initFileManager,NM as initPixieEditor,bn as installResizeObserverErrorHandler,VM as mapHttpStatusToErrorCode,wn as uninstallResizeObserverErrorHandler,LM as unmount,zM as unmountPixieEditor};
76
+ var KP=function(e,t){return KP=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},KP(e,t)};var ZP=function(){return ZP=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ZP.apply(this,arguments)};var JP="Pixel",QP="Percent",eM={unit:QP,value:.8};function tM(e){return"number"==typeof e?{unit:QP,value:100*e}:"string"==typeof e?e.match(/^(\d*(\.\d+)?)px$/)?{unit:JP,value:parseFloat(e)}:e.match(/^(\d*(\.\d+)?)%$/)?{unit:QP,value:parseFloat(e)}:(console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...'),eM):(console.warn("scrollThreshold should be string or number"),eM)}var nM=function(e){function t(t){var n=e.call(this,t)||this;return n.lastScrollTop=0,n.actionTriggered=!1,n.startY=0,n.currentY=0,n.dragging=!1,n.maxPullDownDistance=0,n.getScrollableTarget=function(){return n.props.scrollableTarget instanceof HTMLElement?n.props.scrollableTarget:"string"==typeof n.props.scrollableTarget?document.getElementById(n.props.scrollableTarget):(null===n.props.scrollableTarget&&console.warn("You are trying to pass scrollableTarget but it is null. This might\n happen because the element may not have been added to DOM yet.\n See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.\n "),null)},n.onStart=function(e){n.lastScrollTop||(n.dragging=!0,e instanceof MouseEvent?n.startY=e.pageY:e instanceof TouchEvent&&(n.startY=e.touches[0].pageY),n.currentY=n.startY,n._infScroll&&(n._infScroll.style.willChange="transform",n._infScroll.style.transition="transform 0.2s cubic-bezier(0,0,0.31,1)"))},n.onMove=function(e){n.dragging&&(e instanceof MouseEvent?n.currentY=e.pageY:e instanceof TouchEvent&&(n.currentY=e.touches[0].pageY),n.currentY<n.startY||(n.currentY-n.startY>=Number(n.props.pullDownToRefreshThreshold)&&n.setState({pullToRefreshThresholdBreached:!0}),n.currentY-n.startY>1.5*n.maxPullDownDistance||n._infScroll&&(n._infScroll.style.overflow="visible",n._infScroll.style.transform="translate3d(0px, "+(n.currentY-n.startY)+"px, 0px)")))},n.onEnd=function(){n.startY=0,n.currentY=0,n.dragging=!1,n.state.pullToRefreshThresholdBreached&&(n.props.refreshFunction&&n.props.refreshFunction(),n.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){n._infScroll&&(n._infScroll.style.overflow="auto",n._infScroll.style.transform="none",n._infScroll.style.willChange="unset")})},n.onScrollListener=function(e){"function"==typeof n.props.onScroll&&setTimeout(function(){return n.props.onScroll&&n.props.onScroll(e)},0);var t=n.props.height||n._scrollableNode?e.target:document.documentElement.scrollTop?document.documentElement:document.body;n.actionTriggered||((n.props.inverse?n.isElementAtTop(t,n.props.scrollThreshold):n.isElementAtBottom(t,n.props.scrollThreshold))&&n.props.hasMore&&(n.actionTriggered=!0,n.setState({showLoader:!0}),n.props.next&&n.props.next()),n.lastScrollTop=t.scrollTop)},n.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:t.dataLength},n.throttledOnScrollListener=function(e,t,n,r){var i,o=!1,a=0;function s(){i&&clearTimeout(i)}function l(){var l=this,c=Date.now()-a,u=arguments;function d(){a=Date.now(),n.apply(l,u)}o||(r&&!i&&d(),s(),void 0===r&&c>e?d():!0!==t&&(i=setTimeout(r?function(){i=void 0}:d,void 0===r?e-c:e)))}return"boolean"!=typeof t&&(r=n,n=t,t=void 0),l.cancel=function(){s(),o=!0},l}(150,n.onScrollListener).bind(n),n.onStart=n.onStart.bind(n),n.onMove=n.onMove.bind(n),n.onEnd=n.onEnd.bind(n),n}return function(e,t){function n(){this.constructor=e}KP(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){if(void 0===this.props.dataLength)throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener("scroll",this.throttledOnScrollListener),"number"==typeof this.props.initialScrollY&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener("touchstart",this.onStart),this.el.addEventListener("touchmove",this.onMove),this.el.addEventListener("touchend",this.onEnd),this.el.addEventListener("mousedown",this.onStart),this.el.addEventListener("mousemove",this.onMove),this.el.addEventListener("mouseup",this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),"function"!=typeof this.props.refreshFunction))throw new Error('Mandatory prop "refreshFunction" missing.\n Pull Down To Refresh functionality will not work\n as expected. Check README.md for usage\'')},t.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener("scroll",this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener("touchstart",this.onStart),this.el.removeEventListener("touchmove",this.onMove),this.el.removeEventListener("touchend",this.onEnd),this.el.removeEventListener("mousedown",this.onStart),this.el.removeEventListener("mousemove",this.onMove),this.el.removeEventListener("mouseup",this.onEnd)))},t.prototype.componentDidUpdate=function(e){this.props.dataLength!==e.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},t.getDerivedStateFromProps=function(e,t){return e.dataLength!==t.prevDataLength?ZP(ZP({},t),{prevDataLength:e.dataLength}):null},t.prototype.isElementAtTop=function(e,t){void 0===t&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=tM(t);return r.unit===JP?e.scrollTop<=r.value+n-e.scrollHeight+1:e.scrollTop<=r.value/100+n-e.scrollHeight+1},t.prototype.isElementAtBottom=function(e,t){void 0===t&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=tM(t);return r.unit===JP?e.scrollTop+n>=e.scrollHeight-r.value:e.scrollTop+n>=r.value/100*e.scrollHeight},t.prototype.render=function(){var e=this,t=ZP({height:this.props.height||"auto",overflow:"auto",WebkitOverflowScrolling:"touch"},this.props.style),n=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),r=this.props.pullDownToRefresh&&this.props.height?{overflow:"auto"}:{};return i.createElement("div",{style:r,className:"infinite-scroll-component__outerdiv"},i.createElement("div",{className:"infinite-scroll-component "+(this.props.className||""),ref:function(t){return e._infScroll=t},style:t},this.props.pullDownToRefresh&&i.createElement("div",{style:{position:"relative"},ref:function(t){return e._pullDown=t}},i.createElement("div",{style:{position:"absolute",left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!n&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},t}(_);function rM(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function iM(){return iM=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iM.apply(this,arguments)}function oM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oM(Object(n),!0).forEach(function(t){sM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const lM={breakpointCols:void 0,className:void 0,columnClassName:void 0,children:void 0,columnAttrs:void 0,column:void 0};class cM extends i.Component{constructor(e){let t;super(e),this.reCalculateColumnCount=this.reCalculateColumnCount.bind(this),this.reCalculateColumnCountDebounce=this.reCalculateColumnCountDebounce.bind(this),t=this.props.breakpointCols&&this.props.breakpointCols.default?this.props.breakpointCols.default:parseInt(this.props.breakpointCols)||2,this.state={columnCount:t}}componentDidMount(){this.reCalculateColumnCount(),window&&window.addEventListener("resize",this.reCalculateColumnCountDebounce)}componentDidUpdate(){this.reCalculateColumnCount()}componentWillUnmount(){window&&window.removeEventListener("resize",this.reCalculateColumnCountDebounce)}reCalculateColumnCountDebounce(){window&&window.requestAnimationFrame?(window.cancelAnimationFrame&&window.cancelAnimationFrame(this._lastRecalculateAnimationFrame),this._lastRecalculateAnimationFrame=window.requestAnimationFrame(()=>{this.reCalculateColumnCount()})):this.reCalculateColumnCount()}reCalculateColumnCount(){const e=window&&window.innerWidth||1/0;let t=this.props.breakpointCols;"object"!=typeof t&&(t={default:parseInt(t)||2});let n=1/0,r=t.default||2;for(let i in t){const o=parseInt(i);o>0&&e<=o&&o<n&&(n=o,r=t[i])}r=Math.max(1,parseInt(r)||1),this.state.columnCount!==r&&this.setState({columnCount:r})}itemsInColumns(){const e=this.state.columnCount,t=new Array(e),n=i.Children.toArray(this.props.children);for(let r=0;r<n.length;r++){const i=r%e;t[i]||(t[i]=[]),t[i].push(n[r])}return t}renderColumns(){const{column:e,columnAttrs:t={},columnClassName:n}=this.props,r=this.itemsInColumns(),o=100/r.length+"%";let a=n;a&&"string"!=typeof a&&(this.logDeprecated('The property "columnClassName" requires a string'),void 0===a&&(a="my-masonry-grid_column"));const s=aM(aM(aM({},e),t),{},{style:aM(aM({},t.style),{},{width:o}),className:a});return r.map((e,t)=>i.createElement("div",iM({},s,{key:t}),e))}logDeprecated(e){console.error("[Masonry]",e)}render(){const e=this.props,{children:t,breakpointCols:n,columnClassName:r,columnAttrs:o,column:a,className:s}=e,l=rM(e,["children","breakpointCols","columnClassName","columnAttrs","column","className"]);let c=s;return"string"!=typeof s&&(this.logDeprecated('The property "className" requires a string'),void 0===s&&(c="my-masonry-grid")),i.createElement("div",iM({},l,{className:c}),this.renderColumns())}}cM.defaultProps=lM;var uM={gifTab:"gifTab",scrollableDiv:"scrollableDiv",gifSearchInput:"gifSearchInput",search:"search",searchResults:"searchResults",myMasonryGrid:"myMasonryGrid",myMasonryGridColumn:"myMasonryGridColumn",listItem:"listItem",loaded:"loaded",loadedImage:"loadedImage",searchOutputWrapper:"searchOutputWrapper",divider:"divider",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle"};const dM={default:4,1600:3,1100:2,700:1},hM=({setImageGifList:r,imageGifList:i=[],currentReqGif:s,setCurrentReqGif:l,inputRef:c,customRequest:u})=>{const{t:d}=$n(),{GifPlayIcon:h}=Co(),{options:f}=yi(),{config:p}=f,[g,m]=o(null),[v,y]=o(!1),[b,w]=o(25),[x,C]=o(null),_=async function({query:e,page:t}){const n=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const e=`https://api.giphy.com/v1/gifs/search?api_key=${null==p?void 0:p.REACT_APP_GIPHY_KEY}&q=${n}&limit=25&offset=${t}&lang=en`,r=await fetch(e);return{data:await r.json()}}catch(e){console.warn(e)}},S=async()=>{var e,t;const n=await _({query:s,page:0});(null===(t=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.data)||void 0===t?void 0:t.length)&&n.data.data.length>0&&r(n.data.data)};return a(()=>()=>{x&&clearTimeout(x)},[x]),e("div",{className:uM.gifTab,children:e("div",{className:uM.searchOutputWrapper,children:t("div",{id:"scrollableDiv",className:uM.scrollableDiv,children:[t(T,{onValuesChange:e=>{if(void 0!==e.keywords){l(t=>Object.assign(Object.assign({},t),{keywords:e.keywords})),x&&clearTimeout(x);const t=setTimeout(S,800);C(t)}},className:i.length>0?uM.searchResults:uM.search,children:[e(T.Item,{name:"keywords",className:uM.gifSearchInput,children:e(F,{onKeyDown:e=>"Space"===e.code&&S(),onPressEnter:e=>S(),allowClear:!0,placeholder:d("Search GIFs"),ref:c,spellCheck:"false",prefix:e(li,{size:16,strokeWidth:null==p?void 0:p.iconStrokeWidth,onClick:S})})}),i.length>0&&!v&&e("div",{className:`ant-divider ${uM.divider}`,role:"separator"})]}),!i.length&&!v&&e(n,{children:s.keywords?e(Eo,{}):t("div",{className:uM.resultsContainer,children:[e("div",{className:uM.videoIcon,children:e(h,{className:uM.playButton})}),e("h1",{className:uM.title,children:d("Over 350,000 live images")}),e("p",{className:uM.subtitle,children:d("Enter a search query and we'll find the perfect image for you")})]})}),!i.length&&v&&e(vP,{}),i.length>0&&e(nM,{dataLength:i&&i.length,next:async()=>{v||(y(!0),_({query:s,page:b}).then(e=>{e&&e.data&&e.data.data&&r(t=>[...t,...e.data.data]),y(!1),w(e=>e+25)}).catch(()=>{y(!1)}))},hasMore:!!i,endMessage:t(X,{plain:!0,children:[d("That`s all we could find.")," 🤐"]}),scrollableTarget:"scrollableDiv",style:{overflow:"visible"},loader:e(vP,{}),children:e(cM,{breakpointCols:dM,className:uM.myMasonryGrid,columnClassName:uM.myMasonryGridColumn,children:i.map((n,r)=>t("div",{className:uM.listItem,onClick:()=>((e,t)=>{m(t),setTimeout(()=>{m(null)},2e3),u(e)})(n.images.downsized.url,n.id),children:[e("img",{className:g===n.id?uM.loadedImage:"",width:"100%",src:`${n.images.downsized.url}`,alt:n.title,onLoad:e=>{const t=e.target.parentNode;t&&t instanceof HTMLElement&&t.classList.add(uM.loaded)}}),e("a",{rel:"noreferrer",href:"https://giphy.com/",target:"_blank",onClick:e=>e.stopPropagation()}),g===n.id&&e(k,{className:uM.antSpin})]},n.id+r))})})]})})})};var fM={stockTab:"stockTab",stockSearchInput:"stockSearchInput",searchOutputWrapper:"searchOutputWrapper",divider:"divider",search:"search",searchResults:"searchResults",scrollableDiv:"scrollableDiv",myMasonryGrid:"myMasonryGrid",myMasonryGridColumn:"myMasonryGridColumn",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 pM={default:4,1600:3,1100:2,700:1},gM=({imageStockList:r,setImageStockList:i,currentReq:s,setCurrentReq:l,inputRef:c,customRequest:d})=>{var h;const{t:f}=$n(),{StockBigIcon:p,MixedViewIcon:g,LandscapeViewIcon:m,PortraitViewIcon:v,SquareViewIcon:y}=Co(),{options:b}=yi(),{config:w}=b,[x,C]=o(!1),[_,S]=o(2),[A,E]=o(null),[I,O]=o(null),[P,M]=o(!0),[R]=T.useForm(),j=u(s),D=(e,t,n)=>{try{const r=new URL(e),i=r.pathname.split("/").filter(Boolean),o=i.pop()||"",a=i.join("/"),s=`https://${r.host}${a?"/"+a:""}`,l=`https://px0.useblocks.io/${o}`,c=r.search?r.search.slice(1):"",u=c?`${c}&w=${t}&q=${n}`:`w=${t}&q=${n}`;return`${l}?${`${u}&proxy_url=${s}`}`}catch(t){return e}};a(()=>{j.current=s},[s]),a(()=>{0===r.length&&R.setFieldsValue({color:"",orientation:""})},[r,R]);const N=async function({query:e,page:t}){const n=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{let r=`https://px0.useblocks.io/photos?client_id=${null==w?void 0:w.UNSPLASH_KEY}&lang=ru&per_page=18&query=${n}&page=${t}&proxy_url=https://api.unsplash.com/search`;""!==e.color&&(r+=`&color=${e.color}`),""!==e.orientation&&(r+=`&orientation=${e.orientation}`);const i=await fetch(r);return{data:await i.json()}}catch(e){console.warn(e)}finally{C(!1)}},z=async()=>{var e,t,n;C(!0);const r=await N({query:j.current,page:1});(null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.results)&&(i(r.data.results),M(18===r.data.results.length),(null===(n=null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.results)||void 0===n?void 0:n.length)&&r.data.results.length>0&&S(2))};a(()=>()=>{I&&clearTimeout(I)},[I]);const B=(e,t,n)=>{!async function(e){try{const t=await fetch(`${e}&client_id=${null==w?void 0:w.UNSPLASH_KEY}`);return{data:await t.json()}}catch(e){console.warn(e)}}(t.download_location),E(n),setTimeout(()=>E(null),2e3);const r=D(e.raw,1200,96);d(r)};return e("div",{className:fM.stockTab,children:e("div",{className:fM.searchOutputWrapper,children:t("div",{className:fM.scrollableDiv,id:"scrollableDiv",children:[t(T,{form:R,initialValues:hn,onValuesChange:(e,t)=>{if(l(Object.assign(Object.assign({},hn),t)),I&&clearTimeout(I),""!==t.keywords){const e=setTimeout(z,800);O(e)}else r.length||(l(Object.assign({},hn)),R.resetFields())},className:r.length>0?fM.searchResults:fM.search,children:[t($,{gutter:24,children:[e(W,{span:r.length>0?void 0:24,children:e(T.Item,{name:"keywords",className:fM.stockSearchInput,children:e(F,{allowClear:!0,placeholder:f("Search image"),ref:c,spellCheck:"false",prefix:e(li,{size:16,strokeWidth:null==w?void 0:w.iconStrokeWidth})})})}),!!r.length&&t(n,{children:[e(W,{children:e(T.Item,{name:"orientation",children:t(ee.Group,{onChange:e=>l(t=>Object.assign(Object.assign({},t),{orientation:e.target.value})),children:[e(L,{title:f("All"),placement:"top",children:e(ee.Button,{value:"",children:e(g,{})})}),e(L,{title:f("Landscape"),placement:"top",children:e(ee.Button,{value:"landscape",children:e(m,{})})}),e(L,{title:f("Portrait"),placement:"top",children:e(ee.Button,{value:"portrait",children:e(v,{})})}),e(L,{title:f("Squarish"),placement:"top",children:e(ee.Button,{value:"squarish",children:e(y,{})})})]})})}),e(W,{children:e(T.Item,{name:"color",children:t(ee.Group,{className:fM.stockColorFilter,onChange:e=>l(t=>Object.assign(Object.assign({},t),{color:e.target.value})),children:[e(L,{title:f("All"),placement:"top",children:e(ee.Button,{className:fM.allColors,value:"",children:"All"})}),e(L,{title:f("Black"),placement:"top",children:e(ee.Button,{className:fM.blackColor,value:"black",children:"B"})}),e(L,{title:f("Black and White"),placement:"top",children:e(ee.Button,{className:fM.bwColor,value:"black_and_white",children:"B&W"})}),e(L,{title:f("White"),placement:"top",children:e(ee.Button,{className:fM.whiteColor,value:"white",children:"W"})}),e(L,{title:f("Orange"),placement:"top",children:e(ee.Button,{className:fM.orangeColor,value:"orange",children:"O"})}),e(L,{title:f("Red"),placement:"top",children:e(ee.Button,{className:fM.redColor,value:"red",children:"R"})}),e(L,{title:f("Purple"),placement:"top",children:e(ee.Button,{className:fM.purpleColor,value:"purple",children:"P"})}),e(L,{title:f("Magenta"),placement:"top",children:e(ee.Button,{className:fM.magentaColor,value:"magenta",children:"M"})}),e(L,{title:f("Green"),placement:"top",children:e(ee.Button,{className:fM.greenColor,value:"green",children:"G"})}),e(L,{title:f("Teal"),placement:"top",children:e(ee.Button,{className:fM.tealColor,value:"teal",children:"T"})}),e(L,{title:f("Blue"),placement:"top",children:e(ee.Button,{className:fM.blueColor,value:"blue",children:"B"})})]})})})]})]}),r.length>0&&!x&&e("div",{className:`ant-divider ${fM.divider}`,role:"separator"})]}),!r.length&&!x&&e(n,{children:s.keywords?e(Eo,{}):t("div",{className:fM.resultsContainer,children:[e("div",{className:fM.videoIcon,children:e(p,{className:fM.playButton})}),e("h1",{className:fM.title,children:f("Millions of free stock images")}),e("p",{className:fM.subtitle,children:f("Enter a search query and we'll find the perfect image for you")})]})}),!r.length&&x&&e(vP,{}),r.length>0&&e(nM,{dataLength:r&&r.length,next:async()=>{if(x||""===j.current.keywords)return C(!1),void(""===j.current.keywords&&M(!1));C(!0),N({query:j.current,page:_}).then(e=>{e&&e.data&&e.data.results&&(i(t=>[...t,...e.data.results]),M(18===e.data.results.length)),S(e=>e+1)}).catch(e=>{console.warn("catch",e)}).finally(()=>{C(!1)})},hasMore:P&&""!==(null===(h=j.current)||void 0===h?void 0:h.keywords),endMessage:t(X,{plain:!0,children:[f("That`s all we could find.")," 🤐"]}),scrollableTarget:"scrollableDiv",style:{overflow:"visible"},loader:e(vP,{}),children:e(cM,{breakpointCols:pM,className:fM.myMasonryGrid,columnClassName:fM.myMasonryGridColumn,children:r.map((n,r)=>t("div",{className:fM.listItem,onClick:()=>B(n.urls,n.links,n.id),children:[e("img",{className:A===n.id?fM.loadedImage:"",width:"100%",src:D(n.urls.raw,644,96),alt:n.description,onLoad:e=>{const t=e.target.parentNode;t&&t instanceof HTMLElement&&t.classList.add(fM.loaded)}}),t("p",{className:fM.creatorInfo,onClick:e=>e.stopPropagation(),children:[f("Photo by")," ",e("a",{target:"_blank",href:`${n.user.links.html}?utm_source=${null==w?void 0:w.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:n.user.name})," ",f("on")," ",e("a",{target:"_blank",href:`https://unsplash.com/?utm_source=${null==w?void 0:w.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:"Unsplash"})]}),A===n.id&&e(k,{className:fM.antSpin})]},n.id+r))})})]})})})},mM=()=>{const{options:e}=yi(),t=e.config;return c((e,n)=>{!1!==(null==t?void 0:t.pushToGTM)&&((e,t)=>{const n=()=>{try{const t=Object.assign(Object.assign({},e),{appLabel:"blocks_app"});window.dataLayer&&"function"==typeof window.dataLayer.push?window.dataLayer.push(t):console.log("Attempting to add to the dataLayer:",e)}catch(e){console.error("Ошибка при вызове GTM:",e)}};t?setTimeout(n,t):n()})(e,n)},[null==t?void 0:t.pushToGTM])};var vM="slideshowContainer",yM="slideshowImage";const bM=({images:t,transitionDuration:n=1e3,frameHeight:r})=>{const[i,s]=o([]),[l,c]=o(r);a(()=>{const e=()=>{if("undefined"==typeof window)return void c(r);const e=window.innerHeight,t=Math.max(e-260,130);if("number"==typeof r){const e=Math.min(r,t);c(e)}else c(t)};if(e(),"undefined"!=typeof window)return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r]);const u=()=>{s(e=>e.map((t,n)=>n===e.length-1?Object.assign(Object.assign({},t),{opacity:1}):t))};return a(()=>{if(t.length>0){const e=t[t.length-1];s(t=>[...t,{src:e,opacity:0}]),setTimeout(u,1e3)}else s([])},[t]),e("div",{className:vM,style:{height:l,minHeight:130},children:i.map((t,r)=>e("img",{src:`data:image/jpeg;base64, ${t.src}`,alt:`Slide ${r+1}`,className:yM,style:{opacity:t.opacity,transition:`opacity ${n}ms linear`,display:"block"}},r))})};"function"==typeof SuppressedError&&SuppressedError;const wM=t=>{var{className:n,style:r,color:i,text:o,bordered:a}=t,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["className","style","color","text","bordered"]);const l=o||"";return e(te,Object.assign({style:r,color:i,bordered:a,className:n},s,{children:l}))},xM=({text:n,counter:r,limits:i,wrapperStyles:o})=>{const{t:a}=$n(),{options:s}=yi(),l=s.config,{token:c}=A.useToken(),u=+i>0,d=!u||r<+i,h=(null==l?void 0:l.billingPageUrl)||"/billing",f=r+" "+a("of")+" "+(u?i:"∞")+" "+(n||a("tests",{count:i}))+" "+a("was used",{count:r});return t("div",{className:"limits-couter-wrapper",style:o,children:[e(wM,{bordered:!1,text:f,className:"limit-counter",style:{color:d?c.colorText:"white"},color:d?c.colorFillSecondary:"rgb(255, 77, 79)"}),u&&e("div",{style:{fontSize:14,textDecoration:"underline",cursor:"pointer"},onClick:()=>window.location.assign(h),children:a("Need more?")})]})};var CM={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 _M=f(({className:t,onClick:n})=>e("div",{className:`${CM.arrow} ${CM.arrowNext} ${t||""}`,onClick:n,children:e(D,{className:`${CM.arrowBtn} ${CM.arrowBtnNext}`,size:"large",icon:e(Ce,{})})}));_M.displayName="SampleNextArrow";const SM=f(({className:t,onClick:n})=>e("div",{className:`${CM.arrow} ${CM.arrowPrev} ${t||""}`,onClick:n,children:e(D,{className:`${CM.arrowBtn} ${CM.arrowBtnPrev}`,size:"large",icon:e(_e,{})})}));SM.displayName="SamplePrevArrow";const kM=({customRequest:n,inputAiRef:r,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,setAiImageRequest:f,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v})=>{const{t:y}=$n(),{AiIcon_2:b}=Co(),w=i.useRef(null),[x,C]=o("auto"),{aiImageCounter:_,currentAiImgLimits:S,loadingDuringGeneration:k,requestStatus:A,handleGenerate:E,convertBase64ToFile:I,isShiftPressed:O,setIsShiftPressed:P,limitsInPlugin:M}=function({setFrameHeight:e,customRequest:t,aiTabRef:n,isImageUploaded:r,setIsImageUploaded:i,aiImageRequest:s,imageAiList:l,setImageAiList:h,isLoadingAi:f,setIsLoadingAi:p}){const{t:g}=$n(),{options:m}=yi(),v=m.config,y=_i(),b=mM(),{messages:w}=m.config,[x,C]=o([]),[_,S]=o(0),[k,A]=o(null),[E,I]=o(!1),[T,F]=o(g("Evaluating the task")),[O,P]=o(!1),M=u(new Set),R=u(new Set),L=u(new Set);a(()=>{C(w)},[w]),a(()=>{l.length||k||(C([]),M.current.clear(),R.current.clear(),L.current.clear(),N.current=-1)},[l,k]);const j=d(()=>v&&"function"==typeof(null==v?void 0:v.sendAIImageRequest)?null==v?void 0:v.sendAIImageRequest:()=>Promise.resolve({}),[v]),D=c(e=>{const t=`${k}-${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(F(String(e.status)),100===e.progress){p(!1),h(e.images);const t=k,n=Array.isArray(e.images)?e.images:[];n.length>0&&t&&!M.current.has(t)&&(M.current.add(t),y.success({id:"AI_IMAGE_GENERERATION_SUCCESS",message:g("Images generated successfully"),placement:"bottomRight",data:{request:s,taskId:t,images:n}})),A(null),P(!1)}}else if(e.data&&(h([String(e.data)]),100===e.progress)){p(!1);const t=k,n=e.data?[String(e.data)]:[];n.length>0&&t&&!M.current.has(t)&&(M.current.add(t),y.success({id:"AI_IMAGE_GENERERATION_SUCCESS",message:g("Images generated successfully"),placement:"bottomRight",data:{request:s,taskId:t,images:n}})),A(null),P(!1)}}else p(!1),P(!1),k&&!R.current.has(k)&&(R.current.add(k),y.error({id:"AI_RESPONSE_INVALID",message:g("Something went wrong, please try again"),placement:"bottomRight",description:String(k)||void 0,data:{requestId:k,request:s,response:e},innerException:e}))},[s,h,F,g,p,k,y,P]),N=u(-1);a(()=>{if(x.length>0){const e=x.length-1;e>N.current&&(N.current=e,D(x[e]))}},[D,x]);const z=d(()=>{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=d(()=>v&&"object"==typeof(null==v?void 0:v.handleLimitUsageEmitter)?null==v?void 0:v.handleLimitUsageEmitter:{fire:()=>{}},[v]),U=null==v?void 0:v.elementId,{projectId:V}=v,{limits:$}=(null==v?void 0:v.limits)?v:{limits:{ai_img_limit:0}},{ai_img_limit:W}=$,H=W>0&&_>=W,q=!(!(null==v?void 0:v.limits)||!v.counters)&&cn,G=c(()=>{B.fire({name:"AiImgCount",count:_+1})},[B,_]),Y=d(()=>!H&&!q,[H,q,_,W]),X=c(async()=>{F(g("Evaluating the task")),""===s||f||(p(!0),P(!0),h([]),C([]),b({event:"submit_form",action:"ai_image_generation",entity_id:U,project_id:V}),j({body:{project_id:V,request:"create-image",connection:"midjourney",message:s}}).then(e=>{var t,n,r,i,o;const{data:a,error:l}=e||{};if(l)throw l;const c=a;if(401===(null==c?void 0:c.status)||401===(null===(t=null==c?void 0:c.data)||void 0===t?void 0:t.status))throw new Error("ERROR");const u=(null==c?void 0:c.task)||(null===(n=null==c?void 0:c.data)||void 0===n?void 0:n.task),d=null!==(i=null!==(r=null==u?void 0:u.id)&&void 0!==r?r:k)&&void 0!==i?i:void 0;200===(null==c?void 0:c.status)||200===(null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.status)?((null==u?void 0:u.id)&&(F(u.message),A(u.id)),(null==c?void 0:c.message)&&y.success({id:"AI_IMAGE_GENERATION_STARTED",message:c.message,placement:"bottomRight",data:{request:s,taskId:d,response:null==c?void 0:c.data}}),z({task_id:null==u?void 0:u.id,entity_id:U})):(p(!1),P(!1),d&&!R.current.has(d)&&(R.current.add(d),y.error({id:"AI_IMAGE_GENERATION_FAILED",message:(null==c?void 0:c.message)||g("Something went wrong, please try again"),placement:"bottomRight",description:s,data:{request:s,taskId:d,response:c},innerException:c})))}).catch(e=>{p(!1),P(!1);const t=e;return((null==t?void 0:t.error)||(null==t?void 0:t.data))&&k&&!R.current.has(k)&&(R.current.add(k),null==y||y.error({id:"AI_IMAGE_GENERATION_FAILED",message:g("Something went wrong, please try again"),placement:"bottomRight",description:s,innerException:e,data:{request:s,taskId:k,response:null==t?void 0:t.data,error:Ai(null==t?void 0:t.error)}})),t}))},[s,f,p,P,h,b,U,V,j,y,z,g,k]),K=c(()=>{Y&&X()},[Y,q,S,G,X,y,g]);a(()=>{},[v,q]);const Z=c(e=>{if(console.warn("FM AI: convertBase64ToFile start",{isImageUploaded:r,hasCustomRequest:"function"==typeof t,base64Sample:null==e?void 0:e.slice(0,30)}),r)return;const n=e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);if(!n)return void console.warn("FM AI: convertBase64ToFile no matches for base64");const o=n[1],a=n[2],s=atob(a),l=new Array(s.length);for(let e=0;e<s.length;e++)l[e]=s.charCodeAt(e);const c=new Uint8Array(l),u=new Blob([c],{type:`image/${o}`}),d=new File([u],"image.jpeg",{type:u.type,lastModified:Date.now()});i(!0),(async()=>{try{"function"==typeof t&&await Promise.resolve(t({file:d}))}catch(e){console.warn("FM AI: customRequest error",e)}finally{i(!1)}})()},[r,i,t]);return a(()=>{(f||l.length>0)&&setTimeout(()=>{var t,r;let i=350;if(n.current){const e=null===(t=n.current)||void 0===t?void 0:t.firstChild;e&&e instanceof HTMLElement&&(i=(null===(r=n.current.getBoundingClientRect())||void 0===r?void 0:r.height)-48-e.clientHeight)}e(i)},0)},[n,l.length,f,e]),{aiImageCounter:_,setAiImageCounter:S,currentAiImgLimits:W,isFieldsDisabled:H,canGenerateImage:Y,aiImageRequest:s,imageAiList:l,setImageAiList:h,isLoadingAi:f,setIsLoadingAi:p,loadingDuringGeneration:O,setLoadingDuringGeneration:P,requestStatus:T,setRequestStatus:F,handleGenerate:K,handleLimitAiImgCount:G,convertBase64ToFile:Z,isShiftPressed:E,setIsShiftPressed:I,currentReqId:k,setCurrentReqId:A,limitsInPlugin:q}}({setFrameHeight:C,customRequest:n,aiTabRef:w,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v});a(()=>{console.log("isImageUploaded",s)},[s]);const[R,L]=o(!1),j=c(()=>L(!0),[]),N=c(()=>L(!1),[]),z=c(e=>f(e.target.value),[f]),B=c(e=>{"Shift"===e.key?P(!0):"Enter"!==e.key||O||(e.preventDefault(),E())},[O,E,P]),U=c(e=>{"Shift"===e.key&&P(!1)},[P]);return t("div",{className:CM.imageAi,ref:w,children:[M&&e(xM,{text:"images",counter:_,limits:S,wrapperStyles:{marginTop:-25}}),e($,{gutter:24,className:CM.row,children:t(W,{span:24,children:[e(T.Item,{children:t("span",{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg ${CM.inputAffixWrapper}${R?" ant-input-affix-wrapper-focused":""}`,children:[e(F.TextArea,{ref:r,onKeyDown:B,onKeyUp:U,onFocus:j,onBlur:N,autoSize:!0,allowClear:!0,className:`${CM.textAreaInputHybrid} ${CM.textarea}`,placeholder:y("Generate image"),value:h,onChange:z,spellCheck:"false"}),e("span",{className:`ant-input-suffix ${CM.inputSuffix}`,children:m||k?e(oe,{className:`${CM.inputIcon} input-icon`,spin:!0}):e(b,{className:`${CM.inputIcon} input-icon`,onClick:E})})]})}),t("div",{className:CM.imageAiExample,children:[e("span",{children:y("For example:")})," ",y("A beautiful image of a sunset over a calm ocean.")]})]})}),(m||p.length>0)&&t(ne,{dotPosition:"top",arrows:!0,nextArrow:e(_M,{}),prevArrow:e(SM,{}),className:CM.carousel,infinite:!1,children:[m&&!p.length&&e("div",{className:CM.loading,children:t("div",{className:"spin",children:[e(oe,{style:{fontSize:48},spin:!0}),e("p",{className:"status",children:A})]})}),p.length>0&&p.map((n,r)=>t("div",{className:CM.imageItem,children:[e(bM,{images:p,frameHeight:x}),e("div",{className:"buttons",children:p.length>0&&!m&&e(D,{onClick:()=>I(`data:image/jpeg;base64, ${n}`),loading:s,icon:e(Se,{}),children:y("Use this variant")})})]},r))]})]})},AM=e=>{(null==e?void 0:e.customTheme)&&((e={})=>{const t=document.querySelector("head");if(!t)return;const n=document.createElement("style");if(n.type="text/css",n.dataset.themeVariablesFm="true",n.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}}`,n.appendChild(document.createTextNode(r));const i=t.querySelector('[data-theme-variables-fm="true"]');i?t.replaceChild(n,i):t.insertBefore(n,t.firstChild)}})(null==e?void 0:e.customTheme)},{Sider:EM,Content:IM}=Q,TM={keywords:""},FM=()=>{var s;const l=Ei(),d=Ni(),h=(()=>{var e,t;const{state:n,actions:r,options:i}=yi(),{selectedFolder:o,pathHistory:a,folders:s}=n,{t:l}=$n(),{setSelectedFolder:u,setPathHistory:d}=r,h=c(()=>{var e;return`em_fm:lastFolder:${(null===(e=null==i?void 0:i.config)||void 0===e?void 0:e.projectId)||"default"}`},[null===(e=null==i?void 0:i.config)||void 0===e?void 0:e.projectId]),f=c((e,t=new Set)=>{if(t.has(e))return console.warn(`Обнаружен цикл в пути к папке с id=${e}`),[];const n=(Array.isArray(s)?s:[]).find(t=>t.id===e);if(!n)return[];const r=new Set(t);return r.add(e),n.parentId?n.parentId===n.id?(console.warn(`Обнаружена циклическая зависимость: папка ${n.id} является родителем самой себя`),[{id:n.id,name:n.name+" (ошибка)"}]):[...f(n.parentId,r),{id:n.id,name:n.name}]:[{id:n.id,name:n.name}]},[s]),p=c(e=>{var t;if("undefined"==typeof window)return;const n=!0===(null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.rememberLastFolder),r=h();try{if(!n)return void localStorage.removeItem(r);e?localStorage.setItem(r,e):localStorage.removeItem(r)}catch(e){}},[h,null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.rememberLastFolder]),g=c(e=>{if("folders"===e){const e=[{id:"folders",name:l("Folders")}];return null==d||d(e),void(i.onPathChange&&i.onPathChange([]))}if(!(Array.isArray(s)?s:[]).find(t=>t.id===e))return void console.warn("⚠️ Папка не найдена:",e);const t=f(e),n=[{id:"folders",name:l("Folders")},...t];null==d||d(n),i.onPathChange&&i.onPathChange(n.map(e=>e.name))},[s,f,d,i,l]),m=c(e=>{const t="folders"===e?null:e;t!==o&&(null==u||u(t),p(t),g(e))},[p,o,u,g]),v=c(e=>{if(-1===e)null==u||u(null),null==d||d([{id:"folders",name:l("Folders")}]),i.onPathChange&&i.onPathChange([]);else{const t=a.slice(0,e+1),n=t[t.length-1],r="folders"===n.id?void 0:n.id;null==u||u(r||null),null==d||d(t),i.onPathChange&&i.onPathChange(t.map(e=>e.name))}},[i,a,d,u,l]),y=c(e=>{if(!e.isFolder)return;null==u||u(e.id);const t={id:e.id,name:e.name};if(d){const e=[...a,t];d(e)}if(i.onPathChange){const t=[...a.map(e=>e.name),e.name];i.onPathChange(t)}},[i,a,d,u]);return{state:{selectedFolder:o,pathHistory:a},actions:{handleFolderSelect:m,handleBreadcrumbClick:v,handleItemClick:y},selectedFolder:o,pathHistory:a,handleFolderSelect:m,handleBreadcrumbClick:v,handleItemClick:y}})(),f=(()=>{const{state:e,actions:t}=yi(),{pagination:n}=e,{setPagination:r}=t,i=c((e,t)=>{const i=t||n.pageSize;null==r||r({current:e,pageSize:i,total:n.total})},[n.pageSize,n.total,r]);return{state:{pagination:n},actions:{handlePaginationChange:i}}})(),p=(()=>{const[e,t]=r.useState(()=>{const e=localStorage.getItem(zi);return e?Math.max(290,parseInt(e,10)):298}),[n,i]=r.useState(!1),[o,a]=r.useState(!1),[s,l]=r.useState(0),c=r.useCallback(()=>{console.log("Double click: Resetting to default width"),t(298),localStorage.setItem(zi,298..toString())},[]),u=r.useCallback(n=>{n.preventDefault(),n.stopPropagation(),i(!0),document.body.classList.add("resizing");const r=n.clientX,o=e;let s=o;const c=e=>{e.preventDefault();const n=Math.max(Math.min(o+e.clientX-r,600),290);s=n,t(n),l(e.clientX),a(!0)},u=()=>{i(!1),document.body.classList.remove("resizing"),a(!1),localStorage.setItem(zi,s.toString()),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",u)},[e]);return r.useEffect(()=>()=>{document.body.classList.remove("resizing")},[]),{sidebarWidth:e,isResizing:n,showResizeGuide:o,resizeGuidePosition:s,handleResizeStart:u,handleDoubleClick:c}})(),g=(()=>{const[e,t]=o([]),[n,r]=o(!1),[i,a]=o(!1),s=u(0),l=u(new Map),d=c(()=>(s.current+=1,`upload_${s.current}_${Date.now()}`),[]),h=c(e=>`${(e.size/1024).toFixed(2)} КБ`,[]),f=c(e=>{const n=e.map(e=>({id:d(),name:e.name,size:h(e),status:"uploading",progress:0}));return t(n),r(!0),a(!1),n.map(e=>e.id)},[d,h]),p=c((e,n)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{progress:Math.min(100,Math.max(0,n))}):t))},[]),g=c((e,n)=>{n&&l.current.set(e,n),t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{status:"success",progress:100}):t))},[]),m=c((e,n)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{status:"error",error:n}):t))},[]),v=c(()=>{r(!1),a(!1),setTimeout(()=>{t([]),l.current.clear()},300)},[]),y=c(()=>{a(e=>!e)},[]),b=e.length,w=e.filter(e=>"success"===e.status||"error"===e.status).length;return{uploadFiles:e,isUploadVisible:n,isUploadMinimized:i,totalFiles:b,completedFiles:w,startUpload:f,updateProgress:p,markAsSuccess:g,markAsError:m,closeUpload:v,minimizeUpload:y}})(),m=Ti(),{t:v}=$n(),{options:y}=i.useContext(vi),b=null==y?void 0:y.config,w=i.useRef(null),[x,C]=o(!1),{folders:_,loading:S}=l.state,{fetchFolders:A,fetchChildFolders:E,handleCreateFolder:I,handleModalOk:T,handleModalCancel:F,generateMenuItems:O}=l.actions,P=(e=>{var t;const{state:n,actions:r,options:i}=yi(),{t:o}=$n(),a=_i(),{folders:s,folderToRename:l,renameFolderForm:u,isRenameFolderModalVisible:d}=n,{setFolderToRename:h,setIsRenameFolderModalVisible:f}=r,{apiEndpoints:p,dataProviders:g,config:m}=i,v=c(e=>{null==h||h(e),null==f||f(!0);const t=null==s?void 0:s.find(t=>t.id===e);t&&u&&u.setFieldsValue({newFolderName:t.name})},[h,f,s,u]),y=c(()=>{null==f||f(!1),null==h||h(null),null==u||u.resetFields()},[f,h,u]),b=c(async()=>{var t,n;if(l&&u)try{const i=await u.validateFields();if(!(null==i?void 0:i.newFolderName))return void a.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:o("Folder name cannot be empty"),placement:"bottomRight",data:{folderId:l,folderName:null==i?void 0:i.newFolderName,reason:"emptyName"}});if(!1===(null===(t=null==m?void 0:m.features)||void 0===t?void 0:t.enableRenameFolder))return void a.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:o("Folder rename is disabled by config"),placement:"bottomRight",data:{itemId:null!=l?l:void 0,itemName:null==i?void 0:i.newFolderName}});if(!(null==g?void 0:g.renameFolder))throw new Error(o("renameFolder is not implemented in dataProviders"));const s=await g.renameFolder(l,i.newFolderName.trim());if(!(null==s?void 0:s.id))return void a.error({id:"FOLDER_RENAME_FAILED",message:o("Unexpected response when renaming folder"),placement:"bottomRight",data:{itemId:null!=l?l:void 0,itemName:i.newFolderName,error:{message:"invalidResponse"}}});a.success({id:"FOLDER_RENAME_SUCCESS",message:o("Folder renamed"),placement:"bottomRight",data:{itemId:s.id,itemName:s.name,folderId:null!==(n=s.parentId)&&void 0!==n?n:null}}),y(),await e(),l!==s.id&&r.setSelectedFolder&&r.setSelectedFolder(s.id)}catch(e){console.error("Ошибка при переименовании папки:",e),a.error({id:"FOLDER_RENAME_FAILED",message:o("Failed to rename folder"),placement:"bottomRight",innerException:e,data:{itemId:null!=l?l:void 0,itemName:null==u?void 0:u.getFieldValue("newFolderName"),error:{message:e instanceof Error?e.message:String(e)}}})}},[l,u,p,y,e,o,null===(t=null==m?void 0:m.features)||void 0===t?void 0:t.enableRenameFolder,a]);return{state:{isRenamingFolder:d||!1,folderToRename:l},actions:{showRenameFolderModal:v,handleRenameFolderCancel:y,handleRenameFolderOk:b}}})(A),{files:M,selectedFiles:R,loading:L,isRenamingFile:j,fileToRename:N}=d.state,{fetchFiles:z,handleDeleteFile:B,handleDeleteFolder:U,handleAddFile:V,handleAddFileByUrl:$,uploadFileWithProvider:W,toggleFileSelection:H,showRenameModal:q,handleRenameCancel:G,handleRenameOk:Y,handleDroppedFiles:K,showMoveModal:Z,handleMoveCancel:J,handleMoveOk:ee,handleCopyOk:te,handleCopyCancel:ne,showDeleteConfirm:re,handleDeleteConfirmCancel:ie,handleDeleteConfirmOk:oe}=d.actions,{selectedFolder:ae,pathHistory:se}=h.state,{handleFolderSelect:le,handleBreadcrumbClick:ce,handleItemClick:ue}=h.actions,{pagination:de}=f.state,he=Ci(z),{searchTerm:fe,sortBy:pe,sortOrder:ge}=he.state,{handleSearch:me,handleSort:ve,handlePaginationChange:ye}=he.actions,be=(({files:e,selectedFiles:t,fetchFiles:n,selectedFolder:i})=>{const{t:o}=$n(),a=_i(),{options:s,actions:l,state:c}=r.useContext(vi),{setActiveLibraryItem:u}=l,{activeLibraryItem:d}=c,h=Ti(),[f,p]=r.useState(!1),[g,m]=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 un.includes(t)}const n=null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();return!!n&&un.includes(n)},[]),y=r.useCallback(async e=>{var t,n,r,i;const{dataProviders:o}=s;if(console.log("🔧 saveFileToServer: dataProviders доступны:",{hasUpdateFile:!!(null==o?void 0:o.updateFile),hasUploadFile:!!(null==o?void 0:o.uploadFile),hasThumbnail:!!e.thumbnail,fileId:e.id}),!1!==(null===(n=null===(t=s.config)||void 0===t?void 0:t.features)||void 0===n?void 0:n.enableUpdateFile)&&(null==o?void 0:o.updateFile)&&e.thumbnail)try{const t=xn(e.thumbnail,e.type),n=Cn(t),r=e.name.substring(0,e.name.lastIndexOf("."))+"."+n,i=An(e.thumbnail,t);return await o.updateFile(e.id,{name:r,type:t,data:i})}catch(e){return console.error("Ошибка при обновлении файла через updateFile:",e),null}else if(e.thumbnail)try{const t=xn(e.thumbnail,e.type),n=An(e.thumbnail,t),r=new File([n],e.name,{type:t,lastModified:Date.now()});return await h.uploadFileWithProvider(r,e.folderId||void 0)||null}catch(e){return console.error("Ошибка при сохранении файла:",e),null}else if(!1!==(null===(i=null===(r=s.config)||void 0===r?void 0:r.features)||void 0===i?void 0:i.enableRenameFile)&&(null==o?void 0:o.renameFile))try{return await o.renameFile(e.id,e.name)}catch(e){return console.error("Ошибка при переименовании файла:",e),null}return console.warn("DataProvider для обновления файлов не настроен"),null},[s,h]),b=r.useCallback(n=>{let r;if(console.log("🎨 handleEdit ВЫЗВАНА!",{fileForEdit:n,selectedFilesSize:t.size}),n)console.log("fileForEdit",n),r=n;else{if(1!==t.size)return;const n=Array.from(t)[0];if(r=e.find(e=>e.id===n),!r||r.isFolder||!v(r))return}console.log("🎨 usePixieEditor: Открываем редактор для файла:",r),u&&u(rn),console.log("🎨 usePixieEditor: Устанавливаем editingFile"),m(r),console.log("🎨 usePixieEditor: Устанавливаем isPixieEditorVisible = true"),p(!0),console.log("🎨 usePixieEditor: Редактор должен открыться")},[t,e,v,p,u]),w=r.useCallback(()=>{console.log("🎨 usePixieEditor: Закрываем редактор"),u&&d===rn&&u(Qt),p(!1),m(null),console.log("🎨 usePixieEditor: Редактор закрыт")},[d,u]),x=r.useCallback(async e=>{var t,r,l,c;console.log("Файл обновляется:",e);try{const l=await y(e);if(l)return a.success({id:"IMAGE_UPDATE_SUCCESS",message:o("Success"),description:o("Image updated successfully"),placement:"bottomRight",data:{itemId:null!==(t=l.id)&&void 0!==t?t:void 0,itemName:l.name,folderId:null!==(r=l.folderId)&&void 0!==r?r:null,thumbnail:l.thumbnail}}),s.onEditorOk&&s.onEditorOk(l),await n({folderId:i||""}),w(),l}catch(t){console.error("Ошибка при сохранении файла:",t);const n=t instanceof Error?t.message:o("Unknown error");a.error({id:"IMAGE_SAVE_FAILED",message:o("Error"),description:o("Failed to save changes",{error:n}),innerException:t,placement:"bottomRight",data:{itemId:null!==(l=e.id)&&void 0!==l?l:void 0,itemName:e.name,folderId:null!==(c=e.folderId)&&void 0!==c?c:null,thumbnail:e.thumbnail}})}},[y,s,n,i,a,w]);return{isPixieEditorVisible:f,editingFile:g,handleEdit:b,handlePixieEditorSave:x,handlePixieEditorClose:w}})({files:M||[],selectedFiles:R||new Set,fetchFiles:z,selectedFolder:ae||null}),we=i.useCallback(async()=>{var e;await oe(),await A(),await(null===(e=w.current)||void 0===e?void 0:e.refreshFileCounts())},[A,oe]),xe=i.useCallback(async e=>{var t;await ee(e),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())},[ee]),Ce=i.useCallback(async e=>{var t;await te(e),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())},[te]),_e=i.useCallback(async()=>{let e=[],t=new Map;await V({onStartBatch:n=>{e=g.startUpload(n),t=new Map(n.map((t,n)=>[t.name,e[n]])),console.warn("🚀 onStartBatch: файлы запущены",{count:n.length,currentIds:e})},onStart:n=>{0===e.length&&(e=g.startUpload([n]),t.set(n.name,e[0]))},onProgress:(e,n)=>{const r=t.get(e);r&&g.updateProgress(r,n)},onComplete:async e=>{var n;const r=t.get(e);if(r){await new Promise(e=>setTimeout(e,100));const t=null==M?void 0:M.find(t=>t.name===e&&!t.isFolder);g.markAsSuccess(r,t)}await(null===(n=w.current)||void 0===n?void 0:n.refreshFileCounts())},onError:(e,n)=>{const r=t.get(e);r&&g.markAsError(r,n)},onBatchComplete:async e=>{var n;e.successes.forEach(e=>{const n=t.get(e);n&&(g.updateProgress(n,100),g.markAsSuccess(n))}),e.errors.forEach(({fileName:e,error:n})=>{const r=t.get(e);r&&g.markAsError(r,n)}),await(null===(n=w.current)||void 0===n?void 0:n.refreshFileCounts())}})},[V,g,M]),Se=i.useCallback(async(e,t)=>{var n;try{C(!0);const r=await $(e,t);await(null===(n=w.current)||void 0===n?void 0:n.refreshFileCounts()),r&&(null==y?void 0:y.onEditorOk)&&y.onEditorOk(r)}finally{C(!1)}},[$,y]),ke=i.useCallback(async({file:e})=>{var t;console.warn("FM AI: customRequest start",{hasInitOptions:!!y,hasOnEditorOk:"function"==typeof(null==y?void 0:y.onEditorOk),selectedFolder:ae,fileName:null==e?void 0:e.name,fileType:null==e?void 0:e.type});const n=await W(e);console.warn("FM AI: uploadFileWithProvider result",{uploaded:n,hasUploaded:!!n,uploadedId:null==n?void 0:n.id,uploadedName:null==n?void 0:n.name,uploadedFolderId:null==n?void 0:n.folderId});const r=n&&n.folderId||ae||null;return le&&le(r&&"folders"!==r?r:"folders"),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts()),n&&(null==y?void 0:y.onEditorOk)&&(console.warn("AI upload completed in FileManagerApp with onEditorOk",{uploadedId:n.id,uploadedName:n.name,uploadedFolderId:n.folderId}),y.onEditorOk(n)),n},[W,le,ae,y]),Ae=i.useCallback(async e=>{var t;await B(e),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())},[B]),Ee=i.useCallback(async e=>{var t;if(K){const n=g.startUpload(e);console.warn("🚀 Drag&Drop: файлы запущены",{fileCount:e.length,fileIds:n}),e.forEach(async(e,t)=>{const r=n[t];if(!r)return;let i=0;const o=setInterval(()=>{i=Math.min(i+10+Math.floor(Date.now()%10),85),g.updateProgress(r,i)},200);setTimeout(()=>{clearInterval(o)},2e3)}),await K(e),n.forEach(e=>{g.updateProgress(e,100),g.markAsSuccess(e)}),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())}},[K,g]),Ie=i.useCallback(async e=>{var t;await U(e),await A(),await(null===(t=w.current)||void 0===t?void 0:t.refreshFileCounts())},[U,A]),Te=(({files:e,selectedFiles:t,toggleFileSelection:n,showRenameModal:i,showMoveModal:o,showCopyModal:a,handleDeleteFile:s,handleDeleteFolder:l,showDeleteConfirm:c,onEdit:u})=>{const d=r.useCallback(()=>{t&&t.size>0&&t.forEach(e=>{n(e)})},[t,n]),h=r.useCallback(e=>{if(t&&1===t.size||e){const n=e||Array.from(t)[0];i(n)}},[t,i]),f=r.useCallback(n=>{if(t&&t.size>0||(null==n?void 0:n.id)){if(c)return void c();(n?[n.id]:t).forEach(t=>{const n=e.find(e=>e.id===t);console.log("item",n),n?n.isFolder?l(t):s(t):console.warn(`Объект с ID ${t} не найден в списке файлов`)})}},[t,e,s,l,c]);return{handleClearSelection:d,handleRename:h,handleDeleteSelected:f,handleCopy:r.useCallback(()=>{a()},[a]),handleMove:r.useCallback(()=>{o()},[o]),handleEdit:r.useCallback(()=>{console.log("onEdit"),u()},[u])}})({files:M||[],selectedFiles:R||new Set,toggleFileSelection:H,showRenameModal:q,showMoveModal:Z,showCopyModal:d.actions.showCopyModal||(()=>{}),handleDeleteFile:B,handleDeleteFolder:Ie,showDeleteConfirm:re,onEdit:be.handleEdit}),Fe=S||L;a(()=>{bn()},[]),i.useEffect(()=>{if(!le||0===_.length)return;const e=!1!==(null==b?void 0:b.rememberLastFolder),t=`em_fm:lastFolder:${(null==b?void 0:b.projectId)||"default"}`;if(e&&"undefined"!=typeof window)try{const e=localStorage.getItem(t);if(e&&_.some(t=>t.id===e))return void le(e)}catch(e){}ae||le("folders")},[ae,le,_,null==b?void 0:b.rememberLastFolder,null==b?void 0:b.projectId]);const{state:Oe,actions:Pe,options:Me}=i.useContext(vi),{form:Re,urlForm:Le,renameForm:je,moveForm:De,renameFolderForm:Ne,copyForm:ze,isModalVisible:Be,isUrlModalVisible:Ue,isMoveModalVisible:Ve,isRenameFolderModalVisible:$e,isCopyModalVisible:We,isDeleteConfirmVisible:He,folderToRename:qe,activeLibraryItem:Ge}=Oe,{setIsUrlModalVisible:Ye,setSortField:Xe,setActiveLibraryItem:Ke}=Pe,{config:Ze}=Me,{handleRenameFolderCancel:Je,handleRenameFolderOk:Qe}=P.actions,et=c(e=>{ye(e.current||de.current,e.pageSize||de.pageSize)},[ye,de]),tt=i.useCallback(e=>{const{sortBy:t,sortOrder:n}=(e=>{const[t,n]=e.split("-");return{sortBy:t,sortOrder:n}})(e);ve(t,n)},[ve]),[nt,rt]=o(TM),[it,ot]=o([]),at=u(null),[st,lt]=o(hn),[ct,ut]=o([]),dt=u(null),[ht,ft]=o(""),[pt,gt]=o([]),mt=i.useRef(void 0),[vt,yt]=o(!1),[bt,wt]=o(!1),xt=i.useRef(null),Ct=c(async()=>{const e=null==Ze?void 0:Ze.fileForEdit;if(mt.current!==e){mt.current=e;try{if(!(Ge===rn&&e&&!be.editingFile))return;if("string"==typeof e){if(e.startsWith("data:"))return void(null==be||be.handleEdit({thumbnail:e}));const t=await m.handleAddFileByUrl(e,!0);if(!t)throw new Error(v("Failed to download file"));mt.current===e&&(null==be||be.handleEdit(t))}}finally{mt.current===e&&(mt.current=null)}}},[null==Ze?void 0:Ze.fileForEdit,Ge,be,m]);a(()=>{Ct()},[Ct]),a(()=>{var e,t,n;Ge===Qt?(console.warn("reset requests"),ot([]),rt(TM),ut([]),lt(hn),gt([]),ft(""),wt(!1),yt(!1)):Ge===nn?null===(e=xt.current)||void 0===e||e.focus():Ge===en?null===(t=at.current)||void 0===t||t.focus():Ge===tn&&(null===(n=dt.current)||void 0===n||n.focus())},[Ge]);const _t=i.useCallback(async()=>{var e;await Qe(),await(null===(e=w.current)||void 0===e?void 0:e.refreshFileCounts())},[Qe]),St=R.size,kt=i.useMemo(()=>{var e,t,n;if(1!==St)return!1;const[r]=Array.from(R),i=M.find(e=>e.id===r);if(!i||i.isFolder)return!1;const o="string"==typeof i.name?i.name:"",a=o?null===(e=o.split(".").pop())||void 0===e?void 0:e.toLowerCase():void 0,s=null!==(n=null===(t=i.extension)||void 0===t?void 0:t.toLowerCase())&&void 0!==n?n:a;return"string"==typeof i.type&&i.type.startsWith("image/")||"string"==typeof s&&un.includes(s)},[St,R,M]);return t(Q,{className:"file-manager__layout",children:[p.showResizeGuide&&e("div",{className:"resize-guide",style:{left:`${p.resizeGuidePosition}px`}}),t(Q,{className:"file-manager__content",children:[t(EM,{width:320,theme:"light",className:"file-manager-sider",children:[e(Yo,{ref:w,selectedFolder:ae||"folders",generateMenuItems:O,onFolderSelect:e=>null==le?void 0:le(e),folders:_||[],fetchFolders:A,fetchChildFolders:E,handleAddFile:_e,setIsUrlModalVisible:e=>null==Ye?void 0:Ye(e),handleDeleteFolder:Ie,handleCreateFolder:I,activeLibraryItem:Ge,setActiveLibraryItem:e=>null==Ke?void 0:Ke(e)}),e("div",{className:"sidebar-resizer "+(p.isResizing?"resizing":""),onMouseDown:p.handleResizeStart,onDoubleClick:p.handleDoubleClick,children:e("div",{className:"sidebar-resizer-indicator"})})]}),e(Q,{className:"file-manager__main-content",children:t(IM,{className:"main-content",children:[e(XP,{activeLibraryItem:Ge,selectedFolder:(null===(s=null==_?void 0:_.find(e=>(null==e?void 0:e.id)===ae))||void 0===s?void 0:s.name)||v("Folders")}),e(X,{className:"zero-divider"}),Ge===Qt&&e(Mo,{searchTerm:fe,sortField:Oe.sortField||"name",setSortField:e=>null==Xe?void 0:Xe(e),pathHistory:se||[],handleBreadcrumbClick:e=>null==ce?void 0:ce(e),handleAddFile:_e,setIsUrlModalVisible:e=>null==Ye?void 0:Ye(e),files:M||[],handleSearch:me,handleSort:ve,sortBy:pe,sortOrder:ge,handleSortOptionChange:tt,pagination:de,setPagination:et,loading:Fe,handleItemClick:e=>null==ue?void 0:ue(e),handleDeleteFile:Ae,selectedFiles:R||new Set,toggleFileSelection:e=>null==H?void 0:H(e),handleDroppedFiles:Ee,fileUpload:g,onClearSelection:Te.handleClearSelection,onRename:Te.handleRename,onCopy:Te.handleCopy,onMove:Te.handleMove,onDelete:Te.handleDeleteSelected,onEdit:be.handleEdit}),Ge===en&&e(hM,{imageGifList:it,setImageGifList:ot,currentReqGif:nt,setCurrentReqGif:rt,inputRef:at,customRequest:Se}),Ge===tn&&e(gM,{imageStockList:ct,setImageStockList:ut,currentReq:st,setCurrentReq:lt,inputRef:dt,customRequest:Se}),Ge===nn&&!!(null==Ze?void 0:Ze.sseQuery)&&e(kM,{imageAiList:pt,setImageAiList:gt,aiImageRequest:ht,setAiImageRequest:ft,inputAiRef:xt,customRequest:ke,isLoadingAi:vt,setIsLoadingAi:yt,isImageUploaded:bt,setIsImageUploaded:wt}),Ge===rn&&e(n,{}),e("div",{children:kt&&t(n,{children:[e(X,{className:"zero-divider"}),e("div",{style:{display:"flex",justifyContent:"right",padding:"17px 24px",alignItems:"center"},children:e(D,{size:"large",type:"primary",style:{height:40},onClick:()=>{if(Me.onEditorOk){const e=Array.from(R)[0],t=M.find(t=>t.id===e);t&&Me.onEditorOk(t)}},children:v("Choose")})})]})})]})})]}),x&&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(k,{size:"large"})}),e(qo,{isModalVisible:Be,handleModalOk:T,handleModalCancel:F,form:Re,selectedFolder:ae||null,folders:_||[],isUrlModalVisible:Ue,setIsUrlModalVisible:e=>null==Ye?void 0:Ye(e),handleAddFileByUrl:Se,urlForm:Le,isRenameModalVisible:j,handleRenameOk:()=>null==Y?void 0:Y(),handleRenameCancel:()=>null==G?void 0:G(),renameForm:je,fileToRename:N,files:M||[],isMoveModalVisible:Ve,handleMoveOk:xe,handleMoveCancel:J,moveForm:De,selectedFiles:R||new Set,isRenameFolderModalVisible:$e,handleRenameFolderOk:_t,handleRenameFolderCancel:Je,renameFolderForm:Ne,folderToRename:qe,isCopyModalVisible:We,handleCopyOk:Ce,handleCopyCancel:ne,copyForm:ze,isDeleteConfirmVisible:He,handleDeleteConfirmOk:we,handleDeleteConfirmCancel:()=>null==ie?void 0:ie(),fetchChildFolders:E}),e(_P,{visible:be.isPixieEditorVisible,onClose:be.handlePixieEditorClose,file:be.editingFile,onSave:be.handlePixieEditorSave}),e(qP,{files:g.uploadFiles,visible:g.isUploadVisible,minimized:g.isUploadMinimized,totalFiles:g.totalFiles,completedFiles:g.completedFiles,onClose:g.closeUpload,onMinimize:g.minimizeUpload,onInsert:e=>{var t;const n=Array.isArray(M)?M:[],r=n.filter(t=>!t.isFolder&&t.name===e.name)[0]||n.find(e=>!e.isFolder);r&&(null===(t=Me.onEditorOk)||void 0===t||t.call(Me,r))}})]})},OM=f(({config:r={},onPathChange:o,onChangeSelection:s,onEditorOk:l,searchQuery:c="",sortBySize:d="name",apiEndpoints:h={},customIcons:f,dragDropIcon:p,dataProviders:g,handleNotify:m,handleError:v,handleSuccess:y})=>{const b=i.useMemo(()=>Object.assign({folderTreeLoading:"lazy",expandAllFoldersOnInit:!1,expandRootFolderOnInit:!1,iconStrokeWidth:1.4,availableImageExtensions:["jpg","jpeg","png","gif"]},r),[r]);i.useEffect(()=>{b.theme&&(e=>{if("system"===e){const t=matchMedia(ln).matches?an:on;e=e===sn?t:e}document.documentElement.setAttribute("data-theme",e)})(b.theme),AM(b)},[b]),a(()=>{b.locale&&b.locale!==Rr.language&&(console.warn("FileManagerApp: меняем локаль с",Rr.language,"на",b.locale),Rr.changeLanguage(b.locale)),b.customLocale&&b.locale&&Rr.addResourceBundle(b.locale,"translation",b.customLocale,!0,!0)},[b.locale,b.customLocale]);const w=u(null);return e(I,{className:"em-filemanager",children:t(n,{children:[e(E,{getPopupContainer:()=>w.current||document.body,children:e(bi,{options:{apiEndpoints:h,searchQuery:c,sortBySize:d,onPathChange:o,onChangeSelection:s,onEditorOk:l,config:b,customIcons:f,dragDropIcon:p,dataProviders:g,handleNotify:m,handleError:v,handleSuccess:y},children:e(FM,{})})}),e("div",{ref:w,className:"file-manager-modal-root"})]})})});OM.displayName="FileManagerApp";const PM=t=>{var n,r,i;return e(Wn,{i18n:Rr,children:e(gn,{externalTheme:null!==(r=null===(n=t.config)||void 0===n?void 0:n.theme)&&void 0!==r?r:"light",customThemeToken:null===(i=t.config)||void 0===i?void 0:i.customTheme,children:e(re,{children:e(OM,Object.assign({},t))})})})},MM=new Map,RM=(t,n)=>{var r;let i;bn();let o={};const a=e=>{const t=!e||"fileManager"!==e.mode&&"imageCenter"!==e.mode&&"plugin"!==e.mode?void 0:e.mode;return"imageCenter"===t?vn("imageCenter",e):vn(t)};if(t instanceof HTMLElement){i=t;o={config:a(n),apiEndpoints:null==n?void 0:n.apiEndpoints}}else{i=t.element;const e=a(t.config),n=Object.assign(Object.assign({},null===(r=t.config)||void 0===r?void 0:r.apiEndpoints),t.apiEndpoints);o={config:e,currentPath:t.currentPath,onPathChange:t.onPathChange,onChangeSelection:t.onChangeSelection,searchQuery:t.searchQuery,sortBySize:t.sortBySize,apiEndpoints:n,dataProviders:t.dataProviders,customIcons:t.customIcons,dragDropIcon:t.dragDropIcon,handleNotify:t.handleNotify,handleError:t.handleError,handleSuccess:t.handleSuccess}}const s=S(i);s.render(e(PM,Object.assign({},o))),MM.set(i.id||`container_${Date.now()}`,s)},LM=e=>{const t=e.id||Object.keys(MM).find(e=>e.startsWith("container_"));if(t&&MM.has(t)){const e=MM.get(t);null==e||e.unmount(),MM.delete(t)}else{console.warn("Не удалось найти корень для размонтирования");try{S(e).unmount()}catch(e){console.error("Ошибка при размонтировании компонента:",e)}}},jM=new Map,DM=r=>{const{onClose:o,onSave:a,dataProviders:s,theme:l}=r,c=i.useMemo(()=>{if(r.file)return r.file;const e=r.name||"edited-image",t=r.extension||(r.type?r.type.split("/")[1]:"png"),n=r.type||`image/${t}`;return{thumbnail:r.imageDataUrl||"",name:e,id:void 0,type:n,extension:t}},[r.file,r.imageDataUrl,r.name,r.extension,r.type]),d=i.useCallback(async e=>{if(console.log("🔧 saveFileToServer: dataProviders доступны:",{hasUpdateFile:!!(null==s?void 0:s.updateFile),hasThumbnail:!!e.thumbnail,fileId:e.id}),(null==s?void 0:s.updateFile)&&e.thumbnail)try{const t=xn(e.thumbnail,e.type),n=Cn(t),r=e.name.substring(0,e.name.lastIndexOf("."))+"."+n,i=An(e.thumbnail,t);return await s.updateFile(e.id,{name:r,type:t,data:i})}catch(e){return console.error("Ошибка при обновлении файла через updateFile:",e),null}return console.warn("DataProvider для обновления файлов не настроен"),null},[s]),h=i.useCallback(async e=>{if((null==s?void 0:s.updateFile)&&e.id&&e.thumbnail)try{const t=await d(e);t&&(e=t)}catch(e){console.error("Standalone Pixie: saveFileToServer error",e)}return a&&await a(e),o&&o(),e},[s,a,o,d]),f=u(null);return e(I,{className:"em-filemanager",children:t(n,{children:[e(E,{getPopupContainer:()=>f.current||document.body,children:e(Wn,{i18n:Rr,children:e(gn,{externalTheme:null!=l?l:"light",children:e(re,{children:e(bi,{options:{dataProviders:s,handleNotify:r.handleNotify,handleError:r.handleError,handleSuccess:r.handleSuccess,config:{theme:null!=l?l:"light",locale:r.locale,baseUrl:r.baseUrl,assetsUrl:r.assetsUrl,showNotifications:r.showNotifications}},children:e(_P,{visible:!0,onClose:o,file:c,onSave:h})})})})})}),e("div",{ref:f,className:"file-manager-modal-root"})]})})},NM=t=>{bn();const n=t.element,r=S(n);r.render(e(DM,Object.assign({},t))),jM.set(n.id||`pixie_container_${Date.now()}`,r)},zM=e=>{const t=Array.from(jM.keys()).find(e=>e.startsWith("pixie_container_")),n=e.id||t;if(n&&jM.has(n)){const e=jM.get(n);null==e||e.unmount(),jM.delete(n)}else{console.warn("Не удалось найти корень Pixie для размонтирования");try{S(e).unmount()}catch(e){console.error("Ошибка при размонтировании Pixie:",e)}}},BM=e=>{var t,n;const{mode:r,element:i,fileManager:o,pixieEditor:a,theme:s,dataProviders:l}=e;let c,u;const d={unmount:()=>{c&&LM(c),u&&zM(u)},unmountFileManager:void 0,unmountPixieEditor:void 0};switch(r){case"fileManager":c=i,RM(i,Object.assign(Object.assign({},null==o?void 0:o.config),{theme:s||(null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.theme),apiEndpoints:null==o?void 0:o.apiEndpoints})),d.unmountFileManager=()=>LM(c);break;case"pixieEditor":u=i,NM(Object.assign({element:i,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountPixieEditor=()=>zM(u);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%;",i.appendChild(e),i.appendChild(t),c=e,u=t,RM(c,Object.assign(Object.assign({},null==o?void 0:o.config),{theme:s||(null===(n=null==o?void 0:o.config)||void 0===n?void 0:n.theme),apiEndpoints:null==o?void 0:o.apiEndpoints})),NM(Object.assign({element:u,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountFileManager=()=>LM(c),d.unmountPixieEditor=()=>zM(u);break}}return d};class UM extends Error{constructor(e,t,n,r){super(e),this.code=t,this.status=n,this.details=r,this.name="FileManagerApiError",Error.captureStackTrace&&Error.captureStackTrace(this,UM)}}function VM(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}}var $M={init:RM,unmount:LM,initPixieEditor:NM,unmountPixieEditor:zM,initFileManager:BM};export{Mo as FileContent,UM as FileManagerApiError,OM as FileManagerApp,PM as FileManagerAppWithContext,qo as FileModals,Yo as FolderSidebar,DM as PixieOnlyApp,$M as default,RM as init,BM as initFileManager,NM as initPixieEditor,bn as installResizeObserverErrorHandler,VM as mapHttpStatusToErrorCode,wn as uninstallResizeObserverErrorHandler,LM as unmount,zM as unmountPixieEditor};
77
77
  //# sourceMappingURL=file-manager.esm.js.map