@emailmaker/filemanager 0.10.88 → 0.10.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/{129.533eb7b36d92578d2ead.js → 129.1f7048a0e93daec2ca44.js} +27 -27
  2. package/adapters/DataSourceProxyBase.d.ts +225 -0
  3. package/adapters/FailedRequestCache.d.ts +20 -0
  4. package/adapters/MutationRegistry.d.ts +6 -0
  5. package/adapters/PathAwareStorageAdapter.d.ts +70 -0
  6. package/adapters/TreeCache.d.ts +181 -0
  7. package/components/FileContent/renderers/FileTableView.d.ts +1 -1
  8. package/components/FileModals/FileModals.d.ts +1 -1
  9. package/components/Tag/index.d.ts +1 -1
  10. package/file-manager-IconsTab-CgBriMBe.js +2 -0
  11. package/file-manager-ImageCodeGenerator-BoVEEDJM.js +2 -0
  12. package/file-manager-JsBarcode-rSv58QnO.js +2 -0
  13. package/file-manager-browser-Bk6AOO-_.js +2 -0
  14. package/file-manager-index-B3Ea-yTf.js +10 -0
  15. package/file-manager.css +176 -160
  16. package/file-manager.esm.js +1 -1
  17. package/file-manager.js +10171 -61172
  18. package/{fm-icons-tab.d9174776dd6a2cd3d05e.js → fm-icons-tab.9fb59ff579663a515590.js} +19 -21
  19. package/{fm-image-code-generator.078531875a31b8f35911.js → fm-image-code-generator.50fded261e49f2abdf2b.js} +46 -47
  20. package/helpers/urls.d.ts +1 -0
  21. package/hooks/core/types.d.ts +1 -1
  22. package/hooks/core/useFolders.d.ts +1 -1
  23. package/hooks/notifications/index.d.ts +1 -1
  24. package/hooks/notifications/useNotificationsBase.d.ts +9 -0
  25. package/hooks/useFolderSelectionMenu.d.ts +1 -1
  26. package/index.d.ts +8 -0
  27. package/notification.d.ts +7 -1
  28. package/package.json +8 -2
  29. package/types/storage.d.ts +411 -0
  30. package/types.d.ts +12 -4
  31. package/utils/directResourceFetchError.d.ts +5 -0
  32. package/utils/directResourceFetchError.test.d.ts +1 -0
  33. package/utils/remoteFileFetchPipeline.d.ts +25 -0
  34. package/utils/remoteFileFetchPipeline.test.d.ts +1 -0
  35. package/file-manager-IconsTab-ChxfMtuF.js +0 -2
  36. package/file-manager-ImageCodeGenerator-BxCMOvUC.js +0 -2
  37. package/file-manager-JsBarcode-BGham96n.js +0 -2
  38. package/file-manager-browser-B1zFCvQ7.js +0 -2
  39. package/file-manager-index-DL8wzCQG.js +0 -62
@@ -1,62 +0,0 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import i,{useState as o,useEffect as a,createContext as s,useContext as l,useCallback as c,useRef as u,useMemo as d,createElement as h,memo as f,forwardRef as p,useImperativeHandle as g,Children as m,isValidElement as v,Fragment as y,useId as b,cloneElement as w,useLayoutEffect as x,useInsertionEffect as C}from"react";import{createRoot as _}from"react-dom/client";import{Spin as S,theme as A,ConfigProvider as k,App as E,Form as I,Input as T,Typography as F,Select as O,Tooltip as P,Button as M,Space as R,Segmented as L,Checkbox as N,Dropdown as j,Image as D,Col as z,Card as B,Row as U,Table as V,Empty as H,Pagination as W,Tree as $,Modal as q,Progress as G,Menu as Y,Divider as X,List as K,Avatar as Z,Layout as Q,Radio as J,Tag as ee,Carousel as te}from"antd";import re from"antd/es/alert/ErrorBoundary";import ne,{LoadingOutlined as ie,BarsOutlined as oe,AppstoreOutlined as ae,DownOutlined as se,RightOutlined as le,LinkOutlined as ce,UploadOutlined as ue,FileOutlined as de,FolderAddOutlined as he,FolderOpenOutlined as fe,FolderOutlined as pe,EyeOutlined as ge,CloseOutlined as me,LikeOutlined as ve,HistoryOutlined as ye,ExclamationCircleOutlined as be,FileImageOutlined as we,CheckCircleOutlined as xe,ArrowRightOutlined as Ce,ArrowLeftOutlined as _e,CheckOutlined as Se}from"@ant-design/icons";import*as Ae from"react-dom";import{createPortal as ke,flushSync as Ee}from"react-dom";function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Te(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ie(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ie(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fe(e){return Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fe(e)}function Oe(e){var t=function(e,t){if("object"!=Fe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=Fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Fe(t)?t:t+""}function Pe(e,t,r){return(t=Oe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Me(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(r),!0).forEach(function(t){Pe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Me(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Le={},Ne=[];function je(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console){var r=Ne.reduce(function(e,t){return t(null!=e?e:"","warning")},t);r&&console.error("Warning: ".concat(r))}}function De(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console){var r=Ne.reduce(function(e,t){return t(null!=e?e:"","note")},t);r&&console.warn("Note: ".concat(r))}}function ze(e,t,r){t||Le[r]||(e(!1,r),Le[r]=!0)}function Be(e,t){ze(je,e,t)}function Ue(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=new Set;return function e(t,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=n.has(t);if(Be(!a,"Warning: There may be circular references"),a)return!1;if(t===i)return!0;if(r&&o>1)return!1;n.add(t);var s=o+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(var l=0;l<t.length;l++)if(!e(t[l],i[l],s))return!1;return!0}if(t&&i&&"object"===Fe(t)&&"object"===Fe(i)){var c=Object.keys(t);return c.length===Object.keys(i).length&&c.every(function(r){return e(t[r],i[r],s)})}return!1}(e,t)}function Ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function He(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Oe(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Be.preMessage=function(e){Ne.push(e)},Be.resetWarned=function(){Le={}},Be.noteOnce=function(e,t){ze(De,e,t)};function We(e){return e.join("%")}var $e=function(){function e(t){Ve(this,e),Pe(this,"instanceId",void 0),Pe(this,"cache",new Map),Pe(this,"extracted",new Set),this.instanceId=t}return He(e,[{key:"get",value:function(e){return this.opGet(We(e))}},{key:"opGet",value:function(e){return this.cache.get(e)||null}},{key:"update",value:function(e,t){return this.opUpdate(We(e),t)}},{key:"opUpdate",value:function(e,t){var r=t(this.cache.get(e));null===r?this.cache.delete(e):this.cache.set(e,r)}}]),e}(),qe=["children"],Ge="data-css-hash",Ye="__cssinjs_instance__";function Xe(){var e=Math.random().toString(12).slice(2);if("undefined"!=typeof document&&document.head&&document.body){var t=document.body.querySelectorAll("style[".concat(Ge,"]"))||[],r=document.head.firstChild;Array.from(t).forEach(function(t){t[Ye]=t[Ye]||e,t[Ye]===e&&document.head.insertBefore(t,r)});var n={};Array.from(document.querySelectorAll("style[".concat(Ge,"]"))).forEach(function(t){var r,i=t.getAttribute(Ge);n[i]?t[Ye]===e&&(null===(r=t.parentNode)||void 0===r||r.removeChild(t)):n[i]=!0})}return new $e(e)}var Ke=n.createContext({hashPriority:"low",cache:Xe(),defaultCache:!0}),Ze=function(e){var t,r,i,o,a=e.children,s=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,qe),l=n.useContext(Ke),c=(t=function(){var e=Re({},l);Object.keys(s).forEach(function(t){var r=s[t];void 0!==s[t]&&(e[t]=r)});var t=s.cache;return e.cache=e.cache||Xe(),e.defaultCache=!t&&l.defaultCache,e},r=[l,s],i=function(e,t){return!Ue(e[0],t[0],!0)||!Ue(e[1],t[1],!0)},"value"in(o=n.useRef({})).current&&!i(o.current.condition,r)||(o.current.value=t(),o.current.condition=r),o.current.value);return n.createElement(Ke.Provider,{value:c},a)};var Qe=function(){function e(){Ve(this,e),Pe(this,"cache",void 0),Pe(this,"keys",void 0),Pe(this,"cacheCallTimes",void 0),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return He(e,[{key:"size",value:function(){return this.keys.length}},{key:"internalGet",value:function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i={map:this.cache};return e.forEach(function(e){var t;i?i=null===(t=i)||void 0===t||null===(t=t.map)||void 0===t?void 0:t.get(e):i=void 0}),null!==(t=i)&&void 0!==t&&t.value&&n&&(i.value[1]=this.cacheCallTimes++),null===(r=i)||void 0===r?void 0:r.value}},{key:"get",value:function(e){var t;return null===(t=this.internalGet(e,!0))||void 0===t?void 0:t[0]}},{key:"has",value:function(e){return!!this.internalGet(e)}},{key:"set",value:function(t,r){var n=this;if(!this.has(t)){if(this.size()+1>e.MAX_CACHE_SIZE+e.MAX_CACHE_OFFSET){var i=this.keys.reduce(function(e,t){var r=Te(e,2)[1];return n.internalGet(t)[1]<r?[t,n.internalGet(t)[1]]:e},[this.keys[0],this.cacheCallTimes]),o=Te(i,1)[0];this.delete(o)}this.keys.push(t)}var a=this.cache;t.forEach(function(e,i){if(i===t.length-1)a.set(e,{value:[r,n.cacheCallTimes++]});else{var o=a.get(e);o?o.map||(o.map=new Map):a.set(e,{map:new Map}),a=a.get(e).map}})}},{key:"deleteByPath",value:function(e,t){var r,n=e.get(t[0]);if(1===t.length)return n.map?e.set(t[0],{map:n.map}):e.delete(t[0]),null===(r=n.value)||void 0===r?void 0:r[0];var i=this.deleteByPath(n.map,t.slice(1));return n.map&&0!==n.map.size||n.value||e.delete(t[0]),i}},{key:"delete",value:function(e){if(this.has(e))return this.keys=this.keys.filter(function(t){return!function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(t,e)}),this.deleteByPath(this.cache,e)}}]),e}();function Je(e,t,r){if(arguments.length>4&&void 0!==arguments[4]&&arguments[4])return e;var n=Re(Re({},arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}),{},Pe(Pe({},"data-token-hash",t),Ge,r)),i=Object.keys(n).map(function(e){var t=n[e];return t?"".concat(e,'="').concat(t,'"'):null}).filter(function(e){return e}).join(" ");return"<style ".concat(i,">").concat(e,"</style>")}Pe(Qe,"MAX_CACHE_SIZE",20),Pe(Qe,"MAX_CACHE_OFFSET",5),new Qe,"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,Re({},n).useInsertionEffect,Re({},n).useInsertionEffect;if(process.env.NODE_ENV,"production"!==process.env.NODE_ENV&&"undefined"!=typeof module&&module&&module.hot&&"undefined"!=typeof window){var et="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:null;if(et&&"function"==typeof et.webpackHotUpdate){var tt=et.webpackHotUpdate;et.webpackHotUpdate=function(){return setTimeout(function(){0},0),tt.apply(void 0,arguments)}}}process.env.NODE_ENV;var rt="comm",nt="rule",it="decl",ot=Math.abs,at=String.fromCharCode;function st(e){return e.trim()}function lt(e,t,r){return e.replace(t,r)}function ct(e,t,r){return e.indexOf(t,r)}function ut(e,t){return 0|e.charCodeAt(t)}function dt(e,t,r){return e.slice(t,r)}function ht(e){return e.length}function ft(e,t){return t.push(e),e}var pt=1,gt=1,mt=0,vt=0,yt=0,bt="";function wt(e,t,r,n,i,o,a,s){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:pt,column:gt,length:a,return:"",siblings:s}}function xt(){return yt=vt>0?ut(bt,--vt):0,gt--,10===yt&&(gt=1,pt--),yt}function Ct(){return yt=vt<mt?ut(bt,vt++):0,gt++,10===yt&&(gt=1,pt++),yt}function _t(){return ut(bt,vt)}function St(){return vt}function At(e,t){return dt(bt,e,t)}function kt(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Et(e){return st(At(vt-1,Ft(91===e?e+2:40===e?e+1:e)))}function It(e){for(;(yt=_t())&&yt<33;)Ct();return kt(e)>2||kt(yt)>3?"":" "}function Tt(e,t){for(;--t&&Ct()&&!(yt<48||yt>102||yt>57&&yt<65||yt>70&&yt<97););return At(e,St()+(t<6&&32==_t()&&32==Ct()))}function Ft(e){for(;Ct();)switch(yt){case e:return vt;case 34:case 39:34!==e&&39!==e&&Ft(yt);break;case 40:41===e&&Ft(e);break;case 92:Ct()}return vt}function Ot(e,t){for(;Ct()&&e+yt!==57&&(e+yt!==84||47!==_t()););return"/*"+At(t,vt-1)+"*"+at(47===e?e:Ct())}function Pt(e){for(;!kt(_t());)Ct();return At(e,vt)}function Mt(e){return function(e){return bt="",e}(Rt("",null,null,null,[""],e=function(e){return pt=gt=1,mt=ht(bt=e),vt=0,[]}(e),0,[0],e))}function Rt(e,t,r,n,i,o,a,s,l){for(var c=0,u=0,d=a,h=0,f=0,p=0,g=1,m=1,v=1,y=0,b="",w=i,x=o,C=n,_=b;m;)switch(p=y,y=Ct()){case 40:if(108!=p&&58==ut(_,d-1)){-1!=ct(_+=lt(Et(y),"&","&\f"),"&\f",ot(c?s[c-1]:0))&&(v=-1);break}case 34:case 39:case 91:_+=Et(y);break;case 9:case 10:case 13:case 32:_+=It(p);break;case 92:_+=Tt(St()-1,7);continue;case 47:switch(_t()){case 42:case 47:ft(Nt(Ot(Ct(),St()),t,r,l),l),5!=kt(p||1)&&5!=kt(_t()||1)||!ht(_)||" "===dt(_,-1,void 0)||(_+=" ");break;default:_+="/"}break;case 123*g:s[c++]=ht(_)*v;case 125*g:case 59:case 0:switch(y){case 0:case 125:m=0;case 59+u:-1==v&&(_=lt(_,/\f/g,"")),f>0&&(ht(_)-d||0===g&&47===p)&&ft(f>32?jt(_+";",n,r,d-1,l):jt(lt(_," ","")+";",n,r,d-2,l),l);break;case 59:_+=";";default:if(ft(C=Lt(_,t,r,c,u,i,s,b,w=[],x=[],d,o),o),123===y)if(0===u)Rt(_,t,C,C,w,o,d,s,x);else{switch(h){case 99:if(110===ut(_,3))break;case 108:if(97===ut(_,2))break;default:u=0;case 100:case 109:case 115:}u?Rt(e,C,C,n&&ft(Lt(e,C,C,0,0,i,s,b,i,w=[],d,x),x),i,x,d,s,n?w:x):Rt(_,C,C,C,[""],x,0,s,x)}}c=u=f=0,g=v=1,b=_="",d=a;break;case 58:d=1+ht(_),f=p;default:if(g<1)if(123==y)--g;else if(125==y&&0==g++&&125==xt())continue;switch(_+=at(y),y*g){case 38:v=u>0?1:(_+="\f",-1);break;case 44:s[c++]=(ht(_)-1)*v,v=1;break;case 64:45===_t()&&(_+=Et(Ct())),h=_t(),u=d=ht(b=_+=Pt(St())),y++;break;case 45:45===p&&2==ht(_)&&(g=0)}}return o}function Lt(e,t,r,n,i,o,a,s,l,c,u,d){for(var h=i-1,f=0===i?o:[""],p=function(e){return e.length}(f),g=0,m=0,v=0;g<n;++g)for(var y=0,b=dt(e,h+1,h=ot(m=a[g])),w=e;y<p;++y)(w=st(m>0?f[y]+" "+b:lt(b,/&\f/g,f[y])))&&(l[v++]=w);return wt(e,t,r,0===i?nt:s,l,c,u,d)}function Nt(e,t,r,n){return wt(e,t,r,rt,at(yt),dt(e,2,-2),0,n)}function jt(e,t,r,n,i){return wt(e,t,r,it,dt(e,0,n),dt(e,n+1,-1),n,i)}function Dt(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function zt(e,t,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case"@namespace":case it:return e.return=e.return||e.value;case rt:return"";case"@keyframes":return e.return=e.value+"{"+Dt(e.children,n)+"}";case nt:if(!ht(e.value=e.props.join(",")))return""}return ht(r=Dt(e.children,n))?e.return=e.value+"{"+r+"}":""}function Bt(e){return e.notSplit=!0,e}Pe(Pe(Pe({},"style",function(e,t,r){var n=Te(e,6),i=n[0],o=n[1],a=n[2],s=n[3],l=n[4],c=n[5],u=(r||{}).plain;if(l)return null;var d=i,h={"data-rc-order":"prependQueue","data-rc-priority":"".concat(c)};return d=Je(i,o,a,h,u),s&&Object.keys(s).forEach(function(e){if(!t[e]){t[e]=!0;var r=function(e){return Dt(Mt(e),zt).replace(/\{%%%\:[^;];}/g,";")}(s[e]),n=Je(r,o,"_effect-".concat(e),h,u);e.startsWith("@layer")?d=n+d:d+=n}}),[c,a,d]}),"token",function(e,t,r){var n=Te(e,5),i=n[2],o=n[3],a=n[4],s=(r||{}).plain;if(!o)return null;var l=i._tokenKey;return[-999,l,Je(o,a,l,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},s)]}),"cssVar",function(e,t,r){var n=Te(e,4),i=n[1],o=n[2],a=n[3],s=(r||{}).plain;if(!i)return null;return[-999,o,Je(i,a,o,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},s)]}),Bt(["borderTop","borderBottom"]),Bt(["borderTop"]),Bt(["borderBottom"]),Bt(["borderLeft","borderRight"]),Bt(["borderLeft"]),Bt(["borderRight"]);const Ut={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};function Vt(e,t){return t}function Ht(e,t){return e.filter(e=>void 0!==e)}var Wt;function $t(e){return"object"!=typeof e||null===e?0:Array.isArray(e)?2:function(e){if(!Yt.includes(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(void 0===t)return!0;const r=t.prototype;if(null===r||"object"!=typeof r||!Yt.includes(Object.prototype.toString.call(r)))return!1;if(!r.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)?1:e instanceof Set?3:e instanceof Map?4:5}function qt(e,t){return"object"==typeof e&&Object.prototype.propertyIsEnumerable.call(e,t)}function Gt(e){let t=0,r=e[0]?.[Symbol.iterator]();return{[Symbol.iterator]:()=>({next(){for(;;){if(void 0===r)return{done:!0,value:void 0};const n=r.next();if(!0!==n.done)return{done:!1,value:n.value};t+=1,r=e[t]?.[Symbol.iterator]()}}})}}!function(e){e[e.NOT=0]="NOT",e[e.RECORD=1]="RECORD",e[e.ARRAY=2]="ARRAY",e[e.SET=3]="SET",e[e.MAP=4]="MAP",e[e.OTHER=5]="OTHER"}(Wt||(Wt={}));const Yt=["[object Object]","[object Module]"];const Xt={mergeRecords:function(e,t,r){const n={};for(const i of function(e){const t=new Set;for(const r of e)for(const e of[...Object.keys(r),...Object.getOwnPropertySymbols(r)])t.add(e);return t}(e)){const o=[];for(const t of e)qt(t,i)&&o.push(t[i]);if(0===o.length)continue;const a=t.metaDataUpdater(r,{key:i,parents:e}),s=Zt(o,t,a);s!==Ut.skip&&("__proto__"===i?Object.defineProperty(n,i,{value:s,configurable:!0,enumerable:!0,writable:!0}):n[i]=s)}return n},mergeArrays:function(e){return e.flat()},mergeSets:function(e){return new Set(Gt(e))},mergeMaps:function(e){return new Map(Gt(e))},mergeOthers:function(e){return e.at(-1)}};function Kt(...e){return function(e,t){const r=function(e,t){return{defaultMergeFunctions:Xt,mergeFunctions:{...Xt,...Object.fromEntries(Object.entries(e).filter(([e,t])=>Object.hasOwn(Xt,e)).map(([e,t])=>!1===t?[e,Xt.mergeOthers]:[e,t]))},metaDataUpdater:e.metaDataUpdater??Vt,deepmerge:t,useImplicitDefaultMerging:e.enableImplicitDefaultMerging??!1,filterValues:!1===e.filterValues?void 0:e.filterValues??Ht,actions:Ut}}(e,n);function n(...e){return Zt(e,r,t)}return n}({})(...e)}function Zt(e,t,r){const n=t.filterValues?.(e,r)??e;if(0===n.length)return;if(1===n.length)return Qt(n,t,r);const i=$t(n[0]);if(0!==i&&5!==i)for(let e=1;e<n.length;e++)if($t(n[e])!==i)return Qt(n,t,r);switch(i){case 1:return function(e,t,r){const n=t.mergeFunctions.mergeRecords(e,t,r);if(n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords)return t.defaultMergeFunctions.mergeRecords(e,t,r);return n}(n,t,r);case 2:return function(e,t,r){const n=t.mergeFunctions.mergeArrays(e,t,r);if(n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays)return t.defaultMergeFunctions.mergeArrays(e);return n}(n,t,r);case 3:return function(e,t,r){const n=t.mergeFunctions.mergeSets(e,t,r);if(n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets)return t.defaultMergeFunctions.mergeSets(e);return n}(n,t,r);case 4:return function(e,t,r){const n=t.mergeFunctions.mergeMaps(e,t,r);if(n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps)return t.defaultMergeFunctions.mergeMaps(e);return n}(n,t,r);default:return Qt(n,t,r)}}function Qt(e,t,r){const n=t.mergeFunctions.mergeOthers(e,t,r);return n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):n}const Jt="my_files",er="gif",tr="stock_images",rr="icons",nr="ai",ir="image_codes",or="editor",ar="Trash",sr="light",lr="dark",cr="system",ur="(prefers-color-scheme: dark)",dr=!1,hr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiBmaWxsPSIjRjVGNUY1Ii8+CjxwYXRoIGQ9Ik0yNCAzMkw0MCA0OEw1NiAzMkw2NCA0MEw2NCA2NEgyNFYzMloiIGZpbGw9IiNEOUQ5RDkiLz4KPC9zdmc+",fr=["jpg","jpeg","png","bmp","webp","svg","ico","tiff","tif"],pr=["jpg","jpeg","png","bmp","webp","svg","ico","tiff","tif","gif"],gr={keywords:"",color:"",orientation:""};S.setDefaultIndicator(e(()=>e(ie,{style:{fontSize:48,height:"100%"},spin:!0}),{}));const mr={hashed:!1,algorithm:A.defaultAlgorithm,token:{colorLink:"#1677ff",colorInfo:"#722ed1",colorTextBase:"#000000",colorBgLayout:"#f0f2f5",borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,colorDarken1:"rgba(0, 0, 0, 0.08)",colorFillSecondaryDarken:"rgba(0, 0, 0, 0.1)",formControlHeight:34,borderWidth:1,borderColorHover:"#C5C5C5",formItemMarginBottomMD:20,formItemMarginBottomXS:8,colorSecondaryH:265.03,colorSecondaryS:"63.92%",colorSecondaryL:"50%",colorSecondaryBgH:273,colorSecondaryBgS:"100%",colorSecondaryBgL:"93%",appZoom:1},components:{Progress:{colorFillSecondary:"#ffffff"},Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}},vr={hashed:!1,algorithm:A.darkAlgorithm,token:{colorBgBase:"#1F1F1F",colorInfo:"#9254de",colorLink:"#1890ff",colorLinkHover:"#69c0ff",wireframe:!1,borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,borderWidth:1,colorDarken1:"rgba(0, 0, 0, 0.9)",colorFillSecondaryDarken:"rgba(255, 255, 255, 0.16)",formControlHeight:34,borderColorHover:"rgba(255, 255, 255, 0.3)",formItemMarginBottomMD:20,formItemMarginBottomXS:8,appZoom:1},components:{Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}},yr=({externalTheme:t=sr,children:r,customThemeToken:n})=>{const i=matchMedia(ur).matches?lr:sr,s=t===cr?i:t,[l,c]=o(s),[u,d]=o("light"===l?mr:vr);return a(()=>{c(s)},[s]),a(()=>{const e="light"===l?mr:vr,t=n?Kt(e.token,n):e.token;d(Object.assign(Object.assign({},e),{token:t}))},[d,l,n]),e("div",{id:"file-manager-element-id",style:{height:"100%"},children:e(k,{theme:u,children:e(Ze,{transformers:[],children:e(E,{style:{height:"100%"},children:r})})})})},br={fileManager:{locale:"en_US",mode:"fileManager",theme:"light",enabledTabs:["editor"]},imageCenter:{locale:"en_US",mode:"imageCenter",theme:"light",enabledTabs:["stock","gif","editor"]},plugin:{locale:"en_US",mode:"plugin",theme:"light",enabledTabs:["editor","stock","gif","ai"]}},wr=(e="fileManager",t)=>"imageCenter"===e&&t?t:Object.assign({},br[e]);let xr=!1;const Cr=()=>{if(xr)return;window.addEventListener("error",e=>!(!e.message||!e.message.includes("ResizeObserver loop completed with undelivered notifications"))&&(e.stopImmediatePropagation(),e.preventDefault(),!0),!0);const e=window.onerror;window.onerror=(t,r,n,i,o)=>!("string"!=typeof t||!t.includes("ResizeObserver loop completed with undelivered notifications"))||!!e&&e(t,r,n,i,o),window.addEventListener("unhandledrejection",e=>{var t,r;(null===(r=null===(t=e.reason)||void 0===t?void 0:t.message)||void 0===r?void 0:r.includes("ResizeObserver loop completed with undelivered notifications"))&&e.preventDefault()});const t=console.error;if(console.error=(...e)=>{var r;((null===(r=e[0])||void 0===r?void 0:r.toString())||"").includes("ResizeObserver loop completed with undelivered notifications")||t.apply(console,e)},"undefined"!=typeof window){const e=()=>{try{["webpackHotUpdate","__webpack_require__","__webpack_hash__"].forEach(e=>{if(window[e]){const e=window.__webpack_require__;e&&"object"==typeof e&&null!==e&&"cache"in e&&console.warn("✅ Webpack detected, additional protection from ResizeObserver errors activated")}})}catch(e){console.warn("Error when searching for webpack objects:",e)}};e(),setTimeout(e,1e3)}xr=!0},_r=()=>{xr=!1},Sr=e=>{if(!e)return"image/png";const t=e.toLowerCase();return t.includes("jpeg")||t.includes("jpg")||t.includes("pjpeg")?"image/jpeg":t.includes("png")?"image/png":t.includes("gif")?"image/gif":t.includes("webp")?"image/webp":t.includes("svg")?"image/svg+xml":"image/png"},Ar=e=>{if(!e.startsWith("data:"))return null;const t=e.match(/^data:([^;,]+)/);return t?t[1]:null},kr=(e,t="image/png")=>{let r=t;if("string"==typeof e&&e.startsWith("data:")){const t=Ar(e);t&&t.startsWith("image/")&&(r=t)}return Sr(r)},Er=e=>{const t=Sr(e).split("/")[1];return"svg+xml"===t?"svg":t||"png"};function Ir(e){var t;switch(null===(t=e.trim().split(".").pop())||void 0===t?void 0:t.toLowerCase()){case"svg":return"image/svg+xml";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"webp":return"image/webp";default:return}}function Tr(e){var t,r,n,i;if(null===(r=null===(t=e.type)||void 0===t?void 0:t.startsWith)||void 0===r?void 0:r.call(t,"image/"))return!0;const o=(null!==(n=e.name)&&void 0!==n?n:"").trim();if(Ir(o))return!0;const a=(null!==(i=e.type)&&void 0!==i?i:"").toLowerCase();return!!a.includes("svg")||("text/xml"===a||"application/xml"===a||"text/plain"===a)&&o.toLowerCase().endsWith(".svg")}const Fr=/^data:(.+?);base64,(.+)$/i,Or=e=>{const t=(e=>{if("function"!=typeof globalThis.atob)throw new Error("Base64 decoding is not supported in the current environment.");return globalThis.atob(e)})(e),r=t.length,n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n},Pr=(e,t)=>{const r=e.replace(/\s/g,""),n=Or(r),i=new ArrayBuffer(n.length);return new Uint8Array(i).set(n),new Blob([i],{type:t})},Mr=(e,t="application/octet-stream")=>{if(e instanceof Blob)return e;if("string"==typeof e){const r=e.trim(),n=r.match(Fr);if(n){const[,e,t]=n;return Pr(t,e)}return Pr(r,t)}throw new Error("Unsupported data type. Expected Blob or base64 string.")},Rr={"а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"y","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"ts","ч":"ch","ш":"sh","щ":"sch","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"Y","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"Ts","Ч":"Ch","Ш":"Sh","Щ":"Sch","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya"},Lr=/[<>:"/\\|?*()#\x00-\x1f]/g,Nr=/[\u2010-\u2015\u2212\uFE63\uFF0D]/g,jr=/[\u00D7\u2715\u2716\u2A2F]/g,Dr=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,zr=/[\u00AD\u200B-\u200D\u2060\uFEFF]/g,Br=/[\u2018\u2019\u201A\u201B\u00AB\u00BB\u201C\u201D\u201E\u201F'"`]/g,Ur=/[\u2022\u2044]/g;const Vr={transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0};function Hr(e,t){let r=e;return t.transliterate&&(r=r.normalize("NFC").split("").map(e=>{var t;return null!==(t=Rr[e])&&void 0!==t?t:e}).join("")),r=r.normalize("NFKC"),r=function(e){return e.replace(/\u2026/g,"...").replace(Nr,"-").replace(jr,"x").replace(Dr," ").replace(zr,"").replace(Br,"").replace(Ur,"-").replace(/\u00B7/g,"-").replace(/\u00A9/g,"c").replace(/\u00AE/g,"r").replace(/\u2122/g,"tm").replace(/\./g,"-")}(r),t.removeForbiddenChars&&(r=r.replace(Lr,"_")),t.replaceSpaces&&(r=r.replace(/\s+/g,"_")),t.toLowerCase&&(r=r.toLowerCase()),r=r.replace(/_{2,}/g,"_"),r=r.replace(/^_+|_+$/g,""),r.length>255&&(r=r.substring(0,255)),r}function Wr(e,t){const r=Object.assign(Object.assign({},Vr),null==t?void 0:t.fileNameProcessing),n=e.lastIndexOf(".");let i,o;n>0?(i=e.substring(0,n),o=e.substring(n).toLowerCase()):(i=e,o="");return(Hr(i,r)||"unnamed_file")+o}function $r(e,t){return Hr(e,Object.assign(Object.assign({},Vr),null==t?void 0:t.folderNameProcessing))||"unnamed_folder"}function qr(e){return!0===(null==e?void 0:e.dedupeUploadNamesOnClient)}const Gr=e=>"string"==typeof e,Yr=()=>{let e,t;const r=new Promise((r,n)=>{e=r,t=n});return r.resolve=e,r.reject=t,r},Xr=e=>null==e?"":""+e,Kr=/###/g,Zr=e=>e&&e.indexOf("###")>-1?e.replace(Kr,"."):e,Qr=e=>!e||Gr(e),Jr=(e,t,r)=>{const n=Gr(t)?t.split("."):t;let i=0;for(;i<n.length-1;){if(Qr(e))return{};const t=Zr(n[i]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return Qr(e)?{}:{obj:e,k:Zr(n[i])}},en=(e,t,r)=>{const{obj:n,k:i}=Jr(e,t,Object);if(void 0!==n||1===t.length)return void(n[i]=r);let o=t[t.length-1],a=t.slice(0,t.length-1),s=Jr(e,a,Object);for(;void 0===s.obj&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),s=Jr(e,a,Object),s?.obj&&void 0!==s.obj[`${s.k}.${o}`]&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=r},tn=(e,t)=>{const{obj:r,k:n}=Jr(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},rn=(e,t,r)=>{for(const n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?Gr(e[n])||e[n]instanceof String||Gr(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):rn(e[n],t[n],r):e[n]=t[n]);return e},nn=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var on={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const an=e=>Gr(e)?e.replace(/[&<>"'\/]/g,e=>on[e]):e;const sn=[" ",",","?","!",";"],ln=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}(20),cn=(e,t,r=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const n=t.split(r);let i=e;for(let e=0;e<n.length;){if(!i||"object"!=typeof i)return;let t,o="";for(let a=e;a<n.length;++a)if(a!==e&&(o+=r),o+=n[a],t=i[o],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&a<n.length-1)continue;e+=a-e+1;break}i=t}return i},un=e=>e?.replace("_","-"),dn={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class hn{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||dn,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,r,n){return n&&!this.debug?null:(Gr(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new hn(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new hn(this.logger,e)}}var fn=new hn;class pn{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const r=this.observers[e].get(t)||0;this.observers[e].set(t,r+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,r])=>{for(let n=0;n<r;n++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([r,n])=>{for(let i=0;i<n;i++)r.apply(r,[e,...t])})}}}class gn extends pn{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,r,n={}){const i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,o=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],r&&(Array.isArray(r)?a.push(...r):Gr(r)&&i?a.push(...r.split(i)):a.push(r)));const s=tn(this.data,a);return!s&&!t&&!r&&e.indexOf(".")>-1&&(e=a[0],t=a[1],r=a.slice(2).join(".")),!s&&o&&Gr(r)?cn(this.data?.[e]?.[t],r,i):s}addResource(e,t,r,n,i={silent:!1}){const o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator;let a=[e,t];r&&(a=a.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(a=e.split("."),n=t,t=a[1]),this.addNamespaces(t),en(this.data,a,n),i.silent||this.emit("added",e,t,r,n)}addResources(e,t,r,n={silent:!1}){for(const n in r)(Gr(r[n])||Array.isArray(r[n]))&&this.addResource(e,t,n,r[n],{silent:!0});n.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,n,i,o={silent:!1,skipCopy:!1}){let a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),n=r,r=t,t=a[1]),this.addNamespaces(t);let s=tn(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),n?rn(s,r,i):s={...s,...r},en(this.data,a,s),o.silent||this.emit("added",e,t,r)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var mn={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(e=>{t=this.processors[e]?.process(t,r,n,i)??t}),t}};const vn=Symbol("i18next/PATH_KEY");function yn(e,t){const{[vn]:r}=e(function(){const e=[],t=Object.create(null);let r;return t.get=(n,i)=>(r?.revoke?.(),i===vn?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return r.join(t?.keySeparator??".")}const bn={},wn=e=>!Gr(e)&&"boolean"!=typeof e&&"number"!=typeof e;class xn extends pn{constructor(e,t={}){super(),((e,t,r)=>{e.forEach(e=>{t[e]&&(r[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=fn.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const r={...t};if(null==e)return!1;const n=this.resolve(e,r);return void 0!==n?.res}extractFromKey(e,t){let r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");const n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let i=t.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,r)=>{t=t||"",r=r||"";const n=sn.filter(e=>t.indexOf(e)<0&&r.indexOf(e)<0);if(0===n.length)return!0;const i=ln.getRegExp(`(${n.map(e=>"?"===e?"\\?":e).join("|")})`);let o=!i.test(e);if(!o){const t=e.indexOf(r);t>0&&!i.test(e.substring(0,t))&&(o=!0)}return o})(e,r,n));if(o&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Gr(i)?[i]:i};const o=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(o[0])>-1)&&(i=o.shift()),e=o.join(n)}return{key:e,namespaces:Gr(i)?[i]:i}}translate(e,t,r){let n="object"==typeof t?{...t}:t;if("object"!=typeof n&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof n&&(n={...n}),n||(n={}),null==e)return"";"function"==typeof e&&(e=yn(e,{...this.options,...n})),Array.isArray(e)||(e=[String(e)]);const i=void 0!==n.returnDetails?n.returnDetails:this.options.returnDetails,o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(e[e.length-1],n),l=s[s.length-1];let c=void 0!==n.nsSeparator?n.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===u?.toLowerCase())return d?i?{res:`${l}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${c}${a}`:i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:a;const h=this.resolve(e,n);let f=h?.res;const p=h?.usedKey||a,g=h?.exactUsedKey||a,m=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==n.count&&!Gr(n.count),b=xn.hasDefaultValue(n),w=y?this.pluralResolver.getSuffix(u,n.count,n):"",x=n.ordinal&&y?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",C=y&&!n.ordinal&&0===n.count,_=C&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${w}`]||n[`defaultValue${x}`]||n.defaultValue;let S=f;v&&!f&&b&&(S=_);const A=wn(S),k=Object.prototype.toString.apply(S);if(!(v&&S&&A&&["[object Number]","[object Function]","[object RegExp]"].indexOf(k)<0)||Gr(m)&&Array.isArray(S))if(v&&Gr(m)&&Array.isArray(f))f=f.join(m),f&&(f=this.extendTranslation(f,e,n,r));else{let t=!1,i=!1;!this.isValidLookup(f)&&b&&(t=!0,f=_),this.isValidLookup(f)||(i=!0,f=a);const s=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&i?void 0:f,d=b&&_!==f&&this.options.updateMissing;if(i||t||d){if(this.logger.log(d?"updateKey":"missingKey",u,l,a,d?_:f),o){const e=this.resolve(a,{...n,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let r=0;r<t.length;r++)e.push(t[r]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(n.lng||this.language):e.push(n.lng||this.language);const r=(e,t,r)=>{const i=b&&r!==f?r:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,i,d,n):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,i,d,n),this.emit("missingKey",e,l,t,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,n);C&&n[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{r([e],a+t,n[`defaultValue${t}`]||_)})}):r(e,a,_))}f=this.extendTranslation(f,e,n,h,r),i&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}${c}${a}`),(i||t)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${a}`:a,t?f:void 0,n))}else{if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,S,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(h.res=e,h.usedParams=this.getUsedParamsDetails(n),h):e}if(o){const e=Array.isArray(S),t=e?[]:{},r=e?g:p;for(const e in S)if(Object.prototype.hasOwnProperty.call(S,e)){const i=`${r}${o}${e}`;t[e]=b&&!f?this.translate(i,{...n,defaultValue:wn(_)?_[e]:void 0,joinArrays:!1,ns:s}):this.translate(i,{...n,joinArrays:!1,ns:s}),t[e]===i&&(t[e]=S[e])}f=t}}return i?(h.res=f,h.usedParams=this.getUsedParamsDetails(n),h):f}extendTranslation(e,t,r,n,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const o=Gr(e)&&(void 0!==r?.interpolation?.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(o){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let s=r.replace&&!Gr(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,r.lng||this.language||n.usedLng,r),o){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(r.nest=!1)}!r.lng&&n&&n.res&&(r.lng=this.language||n.usedLng),!1!==r.nest&&(e=this.interpolator.nest(e,(...e)=>i?.[0]!==e[0]||r.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,a=Gr(o)?[o]:o;return null!=e&&a?.length&&!1!==r.applyPostProcessor&&(e=mn.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,t={}){let r,n,i,o,a;return Gr(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(r))return;const s=this.extractFromKey(e,t),l=s.key;n=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const u=void 0!==t.count&&!Gr(t.count),d=u&&!t.ordinal&&0===t.count,h=void 0!==t.context&&(Gr(t.context)||"number"==typeof t.context)&&""!==t.context,f=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{this.isValidLookup(r)||(a=e,bn[`${f[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(a)||(bn[`${f[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${f.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach(n=>{if(this.isValidLookup(r))return;o=n;const a=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(a,l,n,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(n,t.count,t));const r=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&0===e.indexOf(i)&&a.push(l+e.replace(i,this.options.pluralSeparator)),a.push(l+e),d&&a.push(l+r)),h){const n=`${l}${this.options.contextSeparator||"_"}${t.context}`;a.push(n),u&&(t.ordinal&&0===e.indexOf(i)&&a.push(n+e.replace(i,this.options.pluralSeparator)),a.push(n+e),d&&a.push(n+r))}}let s;for(;s=a.pop();)this.isValidLookup(r)||(i=s,r=this.getResource(n,e,s,t))}))})}),{res:r,usedKey:n,exactUsedKey:i,usedLng:o,usedNS:a}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,r,n={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!Gr(e.replace);let n=r?e.replace:e;if(r&&void 0!==e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!r){n={...n};for(const e of t)delete n[e]}return n}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,12)&&void 0!==e[r])return!0;return!1}}class Cn{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=fn.create("languageUtils")}getScriptPartFromCode(e){if(!(e=un(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=un(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Gr(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const r=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(r)||(t=r)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const r=this.getScriptPartFromCode(e);if(this.isSupportedCode(r))return t=r;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Gr(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),n=[],i=e=>{e&&(this.isSupportedCode(e)?n.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Gr(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):Gr(e)&&i(this.formatLanguageCode(e)),r.forEach(e=>{n.indexOf(e)<0&&i(this.formatLanguageCode(e))}),n}}const _n={zero:0,one:1,two:2,few:3,many:4,other:5},Sn={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class An{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=fn.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const r=un("dev"===e?"en":e),n=t.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:n});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(r,{type:n})}catch(r){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Sn;if(!e.match(/-|_/))return Sn;const n=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(n,t)}return this.pluralRulesCache[i]=o,o}needsPlural(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,r={}){return this.getSuffixes(e,r).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?r.resolvedOptions().pluralCategories.sort((e,t)=>_n[e]-_n[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,r={}){const n=this.getRule(e,r);return n?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,r))}}const kn=(e,t,r,n=".",i=!0)=>{let o=((e,t,r)=>{const n=tn(e,r);return void 0!==n?n:tn(t,r)})(e,t,r);return!o&&i&&Gr(r)&&(o=cn(e,r,n),void 0===o&&(o=cn(t,r,n))),o},En=e=>e.replace(/\$/g,"$$$$");class In{constructor(e={}){this.logger=fn.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:r,useRawValueToEscape:n,prefix:i,prefixEscaped:o,suffix:a,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:f,nestingSuffixEscaped:p,nestingOptionsSeparator:g,maxReplaces:m,alwaysFormat:v}=e.interpolation;this.escape=void 0!==t?t:an,this.escapeValue=void 0===r||r,this.useRawValueToEscape=void 0!==n&&n,this.prefix=i?nn(i):o||"{{",this.suffix=a?nn(a):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?nn(d):h||nn("$t("),this.nestingSuffix=f?nn(f):p||nn(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=m||1e3,this.alwaysFormat=void 0!==v&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,r,n){let i,o,a;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const i=kn(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,r,{...n,...t,interpolationkey:e}):i}const i=e.split(this.formatSeparator),o=i.shift().trim(),a=i.join(this.formatSeparator).trim();return this.format(kn(t,s,o,this.options.keySeparator,this.options.ignoreJSONStructure),a,r,{...n,...t,interpolationkey:o})};this.resetRegExp();const c=n?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=void 0!==n?.interpolation?.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>En(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?En(this.escape(e)):En(e)}].forEach(t=>{for(a=0;i=t.regex.exec(e);){const r=i[1].trim();if(o=l(r),void 0===o)if("function"==typeof c){const t=c(e,i,n);o=Gr(t)?t:""}else if(n&&Object.prototype.hasOwnProperty.call(n,r))o="";else{if(u){o=i[0];continue}this.logger.warn(`missed to pass in variable ${r} for interpolating ${e}`),o=""}else Gr(o)||this.useRawValueToEscape||(o=Xr(o));const s=t.safeValue(o);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,r={}){let n,i,o;const a=(e,t)=>{const r=this.nestingOptionsSeparator;if(e.indexOf(r)<0)return e;const n=e.split(new RegExp(`${r}[ ]*{`));let i=`{${n[1]}`;e=n[0],i=this.interpolate(i,o);const a=i.match(/'/g),s=i.match(/"/g);((a?.length??0)%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${r}${i}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let s=[];o={...r},o=o.replace&&!Gr(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const l=/{.*}/.test(n[1])?n[1].lastIndexOf("}")+1:n[1].indexOf(this.formatSeparator);if(-1!==l&&(s=n[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),n[1]=n[1].slice(0,l)),i=t(a.call(this,n[1].trim(),o),o),i&&n[0]===e&&!Gr(i))return i;Gr(i)||(i=Xr(i)),i||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),i=""),s.length&&(i=s.reduce((e,t)=>this.format(e,t,r.lng,{...r,interpolationkey:n[1].trim()}),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}const Tn=e=>{const t={};return(r,n,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});const a=n+JSON.stringify(o);let s=t[a];return s||(s=e(un(n),i),t[a]=s),s(r)}},Fn=e=>(t,r,n)=>e(un(r),n)(t);class On{constructor(e={}){this.logger=fn.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const r=t.cacheInBuiltFormats?Tn:Fn;this.formats={number:r((e,t)=>{const r=new Intl.NumberFormat(e,{...t});return e=>r.format(e)}),currency:r((e,t)=>{const r=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>r.format(e)}),datetime:r((e,t)=>{const r=new Intl.DateTimeFormat(e,{...t});return e=>r.format(e)}),relativetime:r((e,t)=>{const r=new Intl.RelativeTimeFormat(e,{...t});return e=>r.format(e,t.range||"day")}),list:r((e,t)=>{const r=new Intl.ListFormat(e,{...t});return e=>r.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Tn(t)}format(e,t,r,n={}){const i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(e=>e.indexOf(")")>-1)){const e=i.findIndex(e=>e.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}const o=i.reduce((e,t)=>{const{formatName:i,formatOptions:o}=(e=>{let t=e.toLowerCase().trim();const r={};if(e.indexOf("(")>-1){const n=e.split("(");t=n[0].toLowerCase().trim();const i=n[1].substring(0,n[1].length-1);"currency"===t&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(e=>{if(e){const[t,...n]=e.split(":"),i=n.join(":").trim().replace(/^'+|'+$/g,""),o=t.trim();r[o]||(r[o]=i),"false"===i&&(r[o]=!1),"true"===i&&(r[o]=!0),isNaN(i)||(r[o]=parseInt(i,10))}})}return{formatName:t,formatOptions:r}})(t);if(this.formats[i]){let t=e;try{const a=n?.formatParams?.[n.interpolationkey]||{},s=a.locale||a.lng||n.locale||n.lng||r;t=this.formats[i](e,s,{...o,...n,...a})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e);return o}}class Pn extends pn{constructor(e,t,r,n={}){super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=n,this.logger=fn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,n.backend,n)}queueLoad(e,t,r,n){const i={},o={},a={},s={};return e.forEach(e=>{let n=!0;t.forEach(t=>{const a=`${e}|${t}`;!r.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===o[a]&&(o[a]=!0):(this.state[a]=1,n=!1,void 0===o[a]&&(o[a]=!0),void 0===i[a]&&(i[a]=!0),void 0===s[t]&&(s[t]=!0)))}),n||(a[e]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(e,t,r){const n=e.split("|"),i=n[0],o=n[1];t&&this.emit("failedLoading",i,o,t),!t&&r&&this.store.addResourceBundle(i,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&r&&(this.state[e]=0);const a={};this.queue.forEach(r=>{((e,t,r)=>{const{obj:n,k:i}=Jr(e,t,Object);n[i]=n[i]||[],n[i].push(r)})(r.loaded,[i],o),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(r,e),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach(e=>{a[e]||(a[e]={});const t=r.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,r,n=0,i=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:r,tried:n,wait:i,callback:o});this.readingCalls++;const a=(a,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}a&&s&&n<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,r,n+1,2*i,o)},i):o(a,s)},s=this.backend[r].bind(this.backend);if(2!==s.length)return s(e,t,a);try{const r=s(e,t);r&&"function"==typeof r.then?r.then(e=>a(null,e)).catch(a):a(null,r)}catch(e){a(e)}}prepareLoading(e,t,r={},n){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();Gr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Gr(t)&&(t=[t]);const i=this.queueLoad(e,t,r,n);if(!i.toLoad.length)return i.pending.length||n(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e,t=""){const r=e.split("|"),n=r[0],i=r[1];this.read(n,i,"read",void 0,void 0,(r,o)=>{r&&this.logger.warn(`${t}loading namespace ${i} for language ${n} failed`,r),!r&&o&&this.logger.log(`${t}loaded namespace ${i} for language ${n}`,o),this.loaded(e,r,o)})}saveMissing(e,t,r,n,i,o={},a=()=>{}){if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=r&&""!==r){if(this.backend?.create){const s={...o,isUpdate:i},l=this.backend.create.bind(this.backend);if(l.length<6)try{let i;i=5===l.length?l(e,t,r,n,s):l(e,t,r,n),i&&"function"==typeof i.then?i.then(e=>a(null,e)).catch(a):a(null,i)}catch(e){a(e)}else l(e,t,r,n,a,s)}e&&e[0]&&this.store.addResource(e[0],t,r,n)}}else this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const Mn=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Gr(e[1])&&(t.defaultValue=e[1]),Gr(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const r=e[3]||e[2];Object.keys(r).forEach(e=>{t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Rn=e=>(Gr(e.ns)&&(e.ns=[e.ns]),Gr(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Gr(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),Ln=()=>{};class Nn extends pn{constructor(e={},t){var r;if(super(),this.options=Rn(e),this.services={},this.logger=fn,this.modules={external:[]},r=this,Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(e=>{"function"==typeof r[e]&&(r[e]=r[e].bind(r))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(Gr(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=Mn();this.options={...r,...this.options,...Rn(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);const n=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?fn.init(n(this.modules.logger),this.options):fn.init(null,this.options),e=this.modules.formatter?this.modules.formatter:On;const t=new Cn(this.options);this.store=new gn(this.options.resources,this.options);const i=this.services;i.logger=fn,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new An(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!e||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=n(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new In(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Pn(n(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=n(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=n(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new xn(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=Ln),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const i=Yr(),o=()=>{const e=(e,r)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(r),t(e,r)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?o():setTimeout(o,0),i}loadResources(e,t=Ln){let r=t;const n=Gr(e)?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===n?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return r();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(n)t(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),r(e)})}else r(null)}reloadResources(e,t,r){const n=Yr();return"function"==typeof e&&(r=e,e=void 0),"function"==typeof t&&(r=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),r||(r=Ln),this.services.backendConnector.reload(e,t,e=>{n.resolve(),r(e)}),n}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&mn.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const r=Yr();this.emit("languageChanging",e);const n=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,o)=>{o?this.isLanguageChangingTo===e&&(n(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,r.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},o=t=>{e||t||!this.services.languageDetector||(t=[]);const r=Gr(t)?t:t&&t[0],o=this.store.hasLanguageSomeTranslations(r)?r:this.services.languageUtils.getBestMatchFromCodes(Gr(t)?[t]:t);o&&(this.language||n(o),this.translator.language||this.translator.changeLanguage(o),this.services.languageDetector?.cacheUserLanguage?.(o)),this.loadResources(o,e=>{i(e,o)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}getFixedT(e,t,r){const n=(e,t,...i)=>{let o;o="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(i)):{...t},o.lng=o.lng||n.lng,o.lngs=o.lngs||n.lngs,o.ns=o.ns||n.ns,""!==o.keyPrefix&&(o.keyPrefix=o.keyPrefix||r||n.keyPrefix);const a=this.options.keySeparator||".";let s;return o.keyPrefix&&Array.isArray(e)?s=e.map(e=>("function"==typeof e&&(e=yn(e,{...this.options,...t})),`${o.keyPrefix}${a}${e}`)):("function"==typeof e&&(e=yn(e,{...this.options,...t})),s=o.keyPrefix?`${o.keyPrefix}${a}${e}`:e),this.t(s,o)};return Gr(e)?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=r,n}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=t.lng||this.resolvedLanguage||this.languages[0],n=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;const o=(e,t)=>{const r=this.services.backendConnector.state[`${e}|${t}`];return-1===r||0===r||2===r};if(t.precheck){const e=t.precheck(this,o);if(void 0!==e)return e}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(r,e)||n&&!o(i,e)))}loadNamespaces(e,t){const r=Yr();return this.options.ns?(Gr(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=Yr();Gr(e)&&(e=[e]);const n=this.options.preload||[],i=e.filter(e=>n.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=n.concat(i),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}const t=this.services?.languageUtils||new Cn(Mn());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new Nn(e,t)}cloneInstance(e={},t=Ln){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},i=new Nn(n);void 0===e.debug&&void 0===e.prefix||(i.logger=i.logger.clone(e));if(["store","services","language"].forEach(e=>{i[e]=this[e]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((r,n)=>(r[n]={...e[t][n]},r),e[t]),e),{});i.store=new gn(e,n),i.services.resourceStore=i.store}return i.translator=new xn(i.services,n),i.translator.on("*",(e,...t)=>{i.emit(e,...t)}),i.init(n,t),i.translator.options=n,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const jn=Nn.createInstance();jn.createInstance=Nn.createInstance,jn.createInstance,jn.dir,jn.init,jn.loadResources,jn.reloadResources,jn.use,jn.changeLanguage,jn.getFixedT,jn.t,jn.exists,jn.setDefaultNamespace,jn.hasLoadedNamespace,jn.loadNamespaces,jn.loadLanguages;var Dn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function zn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Bn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){var r=!1;try{r=this instanceof e}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}const Un={},Vn=(e,t,r,n)=>{qn(r)&&Un[r]||(qn(r)&&(Un[r]=new Date),((e,t,r,n)=>{const i=[r,{code:t,...n||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,"warn","react-i18next::",!0);qn(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)})(e,t,r,n))},Hn=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},Wn=(e,t,r)=>{e.loadNamespaces(t,Hn(e,r))},$n=(e,t,r,n)=>{if(qn(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Wn(e,r,n);r.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,Hn(e,n))},qn=e=>"string"==typeof e,Gn=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Yn={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Xn=e=>Yn[e];let Kn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(Gn,Xn)};let Zn;const Qn={type:"3rdParty",init(e){((e={})=>{Kn={...Kn,...e}})(e.options.react),(e=>{Zn=e})(e)}},Jn=s();class ei{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const ti=(e,t,r,n)=>e.getFixedT(t,r,n),ri=(e,t={})=>{const{i18n:r}=t,{i18n:n,defaultNS:i}=l(Jn)||{},s=r||n||Zn;if(s&&!s.reportNamespaces&&(s.reportNamespaces=new ei),!s){Vn(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const e=(e,t)=>{return qn(t)?t:"object"==typeof(r=t)&&null!==r&&qn(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e;var r},t=[e,{},!1];return t.t=e,t.i18n={},t.ready=!1,t}s.options.react?.wait&&Vn(s,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...Kn,...s.options.react,...t},{useSuspense:h,keyPrefix:f}=d;let p=i||s.options?.defaultNS;p=qn(p)?[p]:p||["translation"],s.reportNamespaces.addUsedNamespaces?.(p);const g=(s.isInitialized||s.initializedStoreOnce)&&p.every(e=>((e,t,r={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:r.lng,precheck:(t,n)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(Vn(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,s,d)),m=((e,t,r,n)=>c(ti(e,t,r,n),[e,t,r,n]))(s,t.lng||null,"fallback"===d.nsMode?p:p[0],f),v=()=>m,y=()=>ti(s,t.lng||null,"fallback"===d.nsMode?p:p[0],f),[b,w]=o(v);let x=p.join();t.lng&&(x=`${t.lng}${x}`);const C=((e,t)=>{const r=u();return a(()=>{r.current=e},[e,t]),r.current})(x),_=u(!0);a(()=>{const{bindI18n:e,bindI18nStore:r}=d;_.current=!0,g||h||(t.lng?$n(s,t.lng,p,()=>{_.current&&w(y)}):Wn(s,p,()=>{_.current&&w(y)})),g&&C&&C!==x&&_.current&&w(y);const n=()=>{_.current&&w(y)};return e&&s?.on(e,n),r&&s?.store.on(r,n),()=>{_.current=!1,s&&e&&e?.split(" ").forEach(e=>s.off(e,n)),r&&s&&r.split(" ").forEach(e=>s.store.off(e,n))}},[s,x]),a(()=>{_.current&&g&&w(v)},[s,f,g]);const S=[b,s,g];if(S.t=b,S.i18n=s,S.ready=g,g)return S;if(!g&&!h)return S;throw new Promise(e=>{t.lng?$n(s,t.lng,p,()=>e()):Wn(s,p,()=>e())})};function ni({i18n:e,defaultNS:t,children:r}){const n=d(()=>({i18n:e,defaultNS:t}),[e,t]);return h(Jn.Provider,{value:n},r)}var ii={};function oi(e){return oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oi(e)}function ai(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,si(n.key),n)}}function si(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function li(e,t){return function(e,t){if(t.get)return t.get.call(e);return t.value}(e,ui(e,t,"get"))}function ci(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,ui(e,t,"set"),r),r}function ui(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function di(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var hi=function(e){if(!e)return[];Array.isArray(e)||(e=[e]);for(var t={},r=0;r<e.length;++r){var n,i=e[r];if(i&&"object"===oi(i)&&(i=String(i)),"string"!=typeof i){var o="Locales should be strings, ".concat(JSON.stringify(i)," isn't.");throw new TypeError(o)}var a=i.split("-");if(!a.every(function(e){return/[a-z0-9]+/i.test(e)})){var s=JSON.stringify(i),l="The locale ".concat(s," is not a structurally valid BCP 47 language tag.");throw new RangeError(l)}var c=a[0].toLowerCase();a[0]=null!==(n={in:"id",iw:"he",ji:"yi"}[c])&&void 0!==n?n:c,t[a.join("-")]=!0}return Object.keys(t)};function fi(e){switch(oi(e)){case"number":return e;case"bigint":throw new TypeError("Cannot convert a BigInt value to a number");default:return Number(e)}}var pi,gi,mi,vi=Object.freeze({__proto__:null,default:function(e,t,r,n){var i=function(e){do{if(t(e))return e;e=e.replace(/-?[^-]*$/,"")}while(e);return null},o=new WeakMap,a=new WeakMap,s=new WeakMap,l=new WeakMap,c=new WeakMap,u=function(){function u(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),di(this,o,{writable:!0,value:void 0}),di(this,a,{writable:!0,value:void 0}),di(this,s,{writable:!0,value:void 0}),di(this,l,{writable:!0,value:void 0}),di(this,c,{writable:!0,value:void 0}),ci(this,o,function(t){for(var r=hi(t),n=0;n<r.length;++n){var o=i(r[n]);if(o)return o}var a=(new e).resolvedOptions().locale;return i(a)}(r)),ci(this,s,t(li(this,o))),ci(this,a,n(li(this,o))),ci(this,l,function(e){var t=Object.prototype.hasOwnProperty.call(e,"type")&&e.type;if(!t)return"cardinal";if("cardinal"===t||"ordinal"===t)return t;throw new RangeError("Not a valid plural type: "+JSON.stringify(t))}(d)),ci(this,c,new e("en",d))}var d,h,f;return d=u,f=[{key:"supportedLocalesOf",value:function(e){return hi(e).filter(i)}}],(h=[{key:"resolvedOptions",value:function(){var e=li(this,c).resolvedOptions(),t=e.minimumIntegerDigits,n=e.minimumFractionDigits,i=e.maximumFractionDigits,a=e.minimumSignificantDigits,s=e.maximumSignificantDigits,u=e.roundingPriority,d={locale:li(this,o),type:li(this,l),minimumIntegerDigits:t,minimumFractionDigits:n,maximumFractionDigits:i};return"number"==typeof a&&(d.minimumSignificantDigits=a,d.maximumSignificantDigits=s),d.pluralCategories=r(li(this,o),"ordinal"===li(this,l)).slice(0),d.roundingPriority=u||"auto",d}},{key:"select",value:function(e){if(!(this instanceof u))throw new TypeError("select() called on incompatible ".concat(this));if("number"!=typeof e&&(e=Number(e)),!isFinite(e))return"other";var t=li(this,c).format(Math.abs(e));return li(this,s).call(this,t,"ordinal"===li(this,l))}},{key:"selectRange",value:function(e,t){if(!(this instanceof u))throw new TypeError("selectRange() called on incompatible ".concat(this));if(void 0===e)throw new TypeError("start is undefined");if(void 0===t)throw new TypeError("end is undefined");var r=fi(e),n=fi(t);if(!isFinite(r))throw new RangeError("start must be finite");if(!isFinite(n))throw new RangeError("end must be finite");return li(this,a).call(this,this.select(r),this.select(n))}}])&&ai(d.prototype,h),f&&ai(d,f),Object.defineProperty(d,"prototype",{writable:!1}),u}();return"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(u.prototype,Symbol.toStringTag,{value:"Intl.PluralRules",writable:!1,configurable:!0}),Object.defineProperty(u,"prototype",{writable:!1}),u}}),yi=Bn(vi);!function(){if(mi)return ii;mi=1;var e=function(){if(gi)return pi;function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}gi=1;var r=e(yi);function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==Dn||"undefined"!=typeof self&&self;var i={exports:{}};!function(e){var t=function(e,t){return t?"other":1==e?"one":"other"},r=function(e,t){return t?"other":0==e||1==e?"one":"other"},n=function(e,t){return t?"other":e>=0&&e<=1?"one":"other"},i=function(e,t){var r=!String(e).split(".")[1];return t?"other":1==e&&r?"one":"other"},o=function(e,t){return"other"},a=function(e,t){return t?"other":1==e?"one":2==e?"two":"other"};!function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),e.exports=r}(0,{af:t,ak:r,am:n,an:t,ar:function(e,t){var r=String(e).split("."),n=Number(r[0])==e&&r[0].slice(-2);return t?"other":0==e?"zero":1==e?"one":2==e?"two":n>=3&&n<=10?"few":n>=11&&n<=99?"many":"other"},ars:function(e,t){var r=String(e).split("."),n=Number(r[0])==e&&r[0].slice(-2);return t?"other":0==e?"zero":1==e?"one":2==e?"two":n>=3&&n<=10?"few":n>=11&&n<=99?"many":"other"},as:function(e,t){return t?1==e||5==e||7==e||8==e||9==e||10==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},asa:t,ast:i,az:function(e,t){var r=String(e).split(".")[0],n=r.slice(-1),i=r.slice(-2),o=r.slice(-3);return t?1==n||2==n||5==n||7==n||8==n||20==i||50==i||70==i||80==i?"one":3==n||4==n||100==o||200==o||300==o||400==o||500==o||600==o||700==o||800==o||900==o?"few":0==r||6==n||40==i||60==i||90==i?"many":"other":1==e?"one":"other"},bal:function(e,t){return 1==e?"one":"other"},be:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-1),o=n&&r[0].slice(-2);return t?2!=i&&3!=i||12==o||13==o?"other":"few":1==i&&11!=o?"one":i>=2&&i<=4&&(o<12||o>14)?"few":n&&0==i||i>=5&&i<=9||o>=11&&o<=14?"many":"other"},bem:t,bez:t,bg:t,bho:r,bm:o,bn:function(e,t){return t?1==e||5==e||7==e||8==e||9==e||10==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},bo:o,br:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-1),o=n&&r[0].slice(-2),a=n&&r[0].slice(-6);return t?"other":1==i&&11!=o&&71!=o&&91!=o?"one":2==i&&12!=o&&72!=o&&92!=o?"two":(3==i||4==i||9==i)&&(o<10||o>19)&&(o<70||o>79)&&(o<90||o>99)?"few":0!=e&&n&&0==a?"many":"other"},brx:t,bs:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?"other":o&&1==a&&11!=s||1==l&&11!=c?"one":o&&a>=2&&a<=4&&(s<12||s>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"},ca:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?1==e||3==e?"one":2==e?"two":4==e?"few":"other":1==e&&i?"one":0!=n&&0==o&&i?"many":"other"},ce:t,ceb:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=i.slice(-1);return t?"other":o&&(1==n||2==n||3==n)||o&&4!=a&&6!=a&&9!=a||!o&&4!=s&&6!=s&&9!=s?"one":"other"},cgg:t,chr:t,ckb:t,cs:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1];return t?"other":1==e&&i?"one":n>=2&&n<=4&&i?"few":i?"other":"many"},cy:function(e,t){return t?0==e||7==e||8==e||9==e?"zero":1==e?"one":2==e?"two":3==e||4==e?"few":5==e||6==e?"many":"other":0==e?"zero":1==e?"one":2==e?"two":3==e?"few":6==e?"many":"other"},da:function(e,t){var r=String(e).split("."),n=r[0],i=Number(r[0])==e;return t||1!=e&&(i||0!=n&&1!=n)?"other":"one"},de:i,doi:n,dsb:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-2),s=i.slice(-2);return t?"other":o&&1==a||1==s?"one":o&&2==a||2==s?"two":o&&(3==a||4==a)||3==s||4==s?"few":"other"},dv:t,dz:o,ee:t,el:t,en:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e,o=i&&r[0].slice(-1),a=i&&r[0].slice(-2);return t?1==o&&11!=a?"one":2==o&&12!=a?"two":3==o&&13!=a?"few":"other":1==e&&n?"one":"other"},eo:t,es:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?"other":1==e?"one":0!=n&&0==o&&i?"many":"other"},et:i,eu:t,fa:n,ff:function(e,t){return t?"other":e>=0&&e<2?"one":"other"},fi:i,fil:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=i.slice(-1);return t?1==e?"one":"other":o&&(1==n||2==n||3==n)||o&&4!=a&&6!=a&&9!=a||!o&&4!=s&&6!=s&&9!=s?"one":"other"},fo:t,fr:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?1==e?"one":"other":e>=0&&e<2?"one":0!=n&&0==o&&i?"many":"other"},fur:t,fy:i,ga:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?1==e?"one":"other":1==e?"one":2==e?"two":n&&e>=3&&e<=6?"few":n&&e>=7&&e<=10?"many":"other"},gd:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?1==e||11==e?"one":2==e||12==e?"two":3==e||13==e?"few":"other":1==e||11==e?"one":2==e||12==e?"two":n&&e>=3&&e<=10||n&&e>=13&&e<=19?"few":"other"},gl:i,gsw:t,gu:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},guw:r,gv:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-1),a=n.slice(-2);return t?"other":i&&1==o?"one":i&&2==o?"two":!i||0!=a&&20!=a&&40!=a&&60!=a&&80!=a?i?"other":"many":"few"},ha:t,haw:t,he:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1];return t?"other":1==n&&i||0==n&&!i?"one":2==n&&i?"two":"other"},hi:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},hnj:o,hr:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?"other":o&&1==a&&11!=s||1==l&&11!=c?"one":o&&a>=2&&a<=4&&(s<12||s>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"},hsb:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-2),s=i.slice(-2);return t?"other":o&&1==a||1==s?"one":o&&2==a||2==s?"two":o&&(3==a||4==a)||3==s||4==s?"few":"other"},hu:function(e,t){return t?1==e||5==e?"one":"other":1==e?"one":"other"},hy:function(e,t){return t?1==e?"one":"other":e>=0&&e<2?"one":"other"},ia:i,id:o,ig:o,ii:o,io:i,is:function(e,t){var r=String(e).split("."),n=r[0],i=(r[1]||"").replace(/0+$/,""),o=Number(r[0])==e,a=n.slice(-1),s=n.slice(-2);return t?"other":o&&1==a&&11!=s||i%10==1&&i%100!=11?"one":"other"},it:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&i?"one":0!=n&&0==o&&i?"many":"other"},iu:a,ja:o,jbo:o,jgo:t,jmc:t,jv:o,jw:o,ka:function(e,t){var r=String(e).split(".")[0],n=r.slice(-2);return t?1==r?"one":0==r||n>=2&&n<=20||40==n||60==n||80==n?"many":"other":1==e?"one":"other"},kab:function(e,t){return t?"other":e>=0&&e<2?"one":"other"},kaj:t,kcg:t,kde:o,kea:o,kk:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-1);return t?6==i||9==i||n&&0==i&&0!=e?"many":"other":1==e?"one":"other"},kkj:t,kl:t,km:o,kn:n,ko:o,ks:t,ksb:t,ksh:function(e,t){return t?"other":0==e?"zero":1==e?"one":"other"},ku:t,kw:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-2),o=n&&r[0].slice(-3),a=n&&r[0].slice(-5),s=n&&r[0].slice(-6);return t?n&&e>=1&&e<=4||i>=1&&i<=4||i>=21&&i<=24||i>=41&&i<=44||i>=61&&i<=64||i>=81&&i<=84?"one":5==e||5==i?"many":"other":0==e?"zero":1==e?"one":2==i||22==i||42==i||62==i||82==i||n&&0==o&&(a>=1e3&&a<=2e4||4e4==a||6e4==a||8e4==a)||0!=e&&1e5==s?"two":3==i||23==i||43==i||63==i||83==i?"few":1==e||1!=i&&21!=i&&41!=i&&61!=i&&81!=i?"other":"many"},ky:t,lag:function(e,t){var r=String(e).split(".")[0];return t?"other":0==e?"zero":0!=r&&1!=r||0==e?"other":"one"},lb:t,lg:t,lij:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e;return t?11==e||8==e||i&&e>=80&&e<=89||i&&e>=800&&e<=899?"many":"other":1==e&&n?"one":"other"},lkt:o,ln:r,lo:function(e,t){return t&&1==e?"one":"other"},lt:function(e,t){var r=String(e).split("."),n=r[1]||"",i=Number(r[0])==e,o=i&&r[0].slice(-1),a=i&&r[0].slice(-2);return t?"other":1==o&&(a<11||a>19)?"one":o>=2&&o<=9&&(a<11||a>19)?"few":0!=n?"many":"other"},lv:function(e,t){var r=String(e).split("."),n=r[1]||"",i=n.length,o=Number(r[0])==e,a=o&&r[0].slice(-1),s=o&&r[0].slice(-2),l=n.slice(-2),c=n.slice(-1);return t?"other":o&&0==a||s>=11&&s<=19||2==i&&l>=11&&l<=19?"zero":1==a&&11!=s||2==i&&1==c&&11!=l||2!=i&&1==c?"one":"other"},mas:t,mg:r,mgo:t,mk:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?1==a&&11!=s?"one":2==a&&12!=s?"two":7!=a&&8!=a||17==s||18==s?"other":"many":o&&1==a&&11!=s||1==l&&11!=c?"one":"other"},ml:t,mn:t,mo:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e&&r[0].slice(-2);return t?1==e?"one":"other":1==e&&n?"one":!n||0==e||1!=e&&i>=1&&i<=19?"few":"other"},mr:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":"other":1==e?"one":"other"},ms:function(e,t){return t&&1==e?"one":"other"},mt:function(e,t){var r=String(e).split("."),n=Number(r[0])==e&&r[0].slice(-2);return t?"other":1==e?"one":2==e?"two":0==e||n>=3&&n<=10?"few":n>=11&&n<=19?"many":"other"},my:o,nah:t,naq:a,nb:t,nd:t,ne:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?n&&e>=1&&e<=4?"one":"other":1==e?"one":"other"},nl:i,nn:t,nnh:t,no:t,nqo:o,nr:t,nso:r,ny:t,nyn:t,om:t,or:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?1==e||5==e||n&&e>=7&&e<=9?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":1==e?"one":"other"},os:t,osa:o,pa:r,pap:t,pcm:n,pl:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-1),a=n.slice(-2);return t?"other":1==e&&i?"one":i&&o>=2&&o<=4&&(a<12||a>14)?"few":i&&1!=n&&(0==o||1==o)||i&&o>=5&&o<=9||i&&a>=12&&a<=14?"many":"other"},prg:function(e,t){var r=String(e).split("."),n=r[1]||"",i=n.length,o=Number(r[0])==e,a=o&&r[0].slice(-1),s=o&&r[0].slice(-2),l=n.slice(-2),c=n.slice(-1);return t?"other":o&&0==a||s>=11&&s<=19||2==i&&l>=11&&l<=19?"zero":1==a&&11!=s||2==i&&1==c&&11!=l||2!=i&&1==c?"one":"other"},ps:t,pt:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?"other":0==n||1==n?"one":0!=n&&0==o&&i?"many":"other"},pt_PT:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?"other":1==e&&i?"one":0!=n&&0==o&&i?"many":"other"},rm:t,ro:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e&&r[0].slice(-2);return t?1==e?"one":"other":1==e&&n?"one":!n||0==e||1!=e&&i>=1&&i<=19?"few":"other"},rof:t,ru:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-1),a=n.slice(-2);return t?"other":i&&1==o&&11!=a?"one":i&&o>=2&&o<=4&&(a<12||a>14)?"few":i&&0==o||i&&o>=5&&o<=9||i&&a>=11&&a<=14?"many":"other"},rwk:t,sah:o,saq:t,sat:a,sc:function(e,t){var r=!String(e).split(".")[1];return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&r?"one":"other"},scn:function(e,t){var r=!String(e).split(".")[1];return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&r?"one":"other"},sd:t,sdh:t,se:a,seh:t,ses:o,sg:o,sh:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?"other":o&&1==a&&11!=s||1==l&&11!=c?"one":o&&a>=2&&a<=4&&(s<12||s>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"},shi:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?"other":e>=0&&e<=1?"one":n&&e>=2&&e<=10?"few":"other"},si:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"";return t?"other":0==e||1==e||0==n&&1==i?"one":"other"},sk:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1];return t?"other":1==e&&i?"one":n>=2&&n<=4&&i?"few":i?"other":"many"},sl:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-2);return t?"other":i&&1==o?"one":i&&2==o?"two":i&&(3==o||4==o)||!i?"few":"other"},sma:a,smi:a,smj:a,smn:a,sms:a,sn:t,so:t,sq:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-1),o=n&&r[0].slice(-2);return t?1==e?"one":4==i&&14!=o?"many":"other":1==e?"one":"other"},sr:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?"other":o&&1==a&&11!=s||1==l&&11!=c?"one":o&&a>=2&&a<=4&&(s<12||s>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"},ss:t,ssy:t,st:t,su:o,sv:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e,o=i&&r[0].slice(-1),a=i&&r[0].slice(-2);return t?1!=o&&2!=o||11==a||12==a?"other":"one":1==e&&n?"one":"other"},sw:i,syr:t,ta:t,te:t,teo:t,th:o,ti:r,tig:t,tk:function(e,t){var r=String(e).split("."),n=Number(r[0])==e&&r[0].slice(-1);return t?6==n||9==n||10==e?"few":"other":1==e?"one":"other"},tl:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=i.slice(-1);return t?1==e?"one":"other":o&&(1==n||2==n||3==n)||o&&4!=a&&6!=a&&9!=a||!o&&4!=s&&6!=s&&9!=s?"one":"other"},tn:t,to:o,tpi:o,tr:t,ts:t,tzm:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?"other":0==e||1==e||n&&e>=11&&e<=99?"one":"other"},ug:t,uk:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=Number(r[0])==e,a=o&&r[0].slice(-1),s=o&&r[0].slice(-2),l=n.slice(-1),c=n.slice(-2);return t?3==a&&13!=s?"few":"other":i&&1==l&&11!=c?"one":i&&l>=2&&l<=4&&(c<12||c>14)?"few":i&&0==l||i&&l>=5&&l<=9||i&&c>=11&&c<=14?"many":"other"},und:o,ur:i,uz:t,ve:t,vec:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&i?"one":0!=n&&0==o&&i?"many":"other"},vi:function(e,t){return t&&1==e?"one":"other"},vo:t,vun:t,wa:r,wae:t,wo:o,xh:t,xog:t,yi:i,yo:o,yue:o,zh:o,zu:n})}(i);var o=n(i.exports),a=t({__proto__:null,default:o},[i.exports]),s={exports:{}};!function(e){var t="zero",r="one",n="two",i="few",o="many",a="other",s={cardinal:[r,a],ordinal:[a]},l={cardinal:[r,a],ordinal:[r,a]},c={cardinal:[a],ordinal:[a]},u={cardinal:[r,n,a],ordinal:[a]};!function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),e.exports=r}(0,{af:s,ak:s,am:s,an:s,ar:{cardinal:[t,r,n,i,o,a],ordinal:[a]},ars:{cardinal:[t,r,n,i,o,a],ordinal:[a]},as:{cardinal:[r,a],ordinal:[r,n,i,o,a]},asa:s,ast:s,az:{cardinal:[r,a],ordinal:[r,i,o,a]},bal:l,be:{cardinal:[r,i,o,a],ordinal:[i,a]},bem:s,bez:s,bg:s,bho:s,bm:c,bn:{cardinal:[r,a],ordinal:[r,n,i,o,a]},bo:c,br:{cardinal:[r,n,i,o,a],ordinal:[a]},brx:s,bs:{cardinal:[r,i,a],ordinal:[a]},ca:{cardinal:[r,o,a],ordinal:[r,n,i,a]},ce:s,ceb:s,cgg:s,chr:s,ckb:s,cs:{cardinal:[r,i,o,a],ordinal:[a]},cy:{cardinal:[t,r,n,i,o,a],ordinal:[t,r,n,i,o,a]},da:s,de:s,doi:s,dsb:{cardinal:[r,n,i,a],ordinal:[a]},dv:s,dz:c,ee:s,el:s,en:{cardinal:[r,a],ordinal:[r,n,i,a]},eo:s,es:{cardinal:[r,o,a],ordinal:[a]},et:s,eu:s,fa:s,ff:s,fi:s,fil:l,fo:s,fr:{cardinal:[r,o,a],ordinal:[r,a]},fur:s,fy:s,ga:{cardinal:[r,n,i,o,a],ordinal:[r,a]},gd:{cardinal:[r,n,i,a],ordinal:[r,n,i,a]},gl:s,gsw:s,gu:{cardinal:[r,a],ordinal:[r,n,i,o,a]},guw:s,gv:{cardinal:[r,n,i,o,a],ordinal:[a]},ha:s,haw:s,he:u,hi:{cardinal:[r,a],ordinal:[r,n,i,o,a]},hnj:c,hr:{cardinal:[r,i,a],ordinal:[a]},hsb:{cardinal:[r,n,i,a],ordinal:[a]},hu:l,hy:l,ia:s,id:c,ig:c,ii:c,io:s,is:s,it:{cardinal:[r,o,a],ordinal:[o,a]},iu:u,ja:c,jbo:c,jgo:s,jmc:s,jv:c,jw:c,ka:{cardinal:[r,a],ordinal:[r,o,a]},kab:s,kaj:s,kcg:s,kde:c,kea:c,kk:{cardinal:[r,a],ordinal:[o,a]},kkj:s,kl:s,km:c,kn:s,ko:c,ks:s,ksb:s,ksh:{cardinal:[t,r,a],ordinal:[a]},ku:s,kw:{cardinal:[t,r,n,i,o,a],ordinal:[r,o,a]},ky:s,lag:{cardinal:[t,r,a],ordinal:[a]},lb:s,lg:s,lij:{cardinal:[r,a],ordinal:[o,a]},lkt:c,ln:s,lo:{cardinal:[a],ordinal:[r,a]},lt:{cardinal:[r,i,o,a],ordinal:[a]},lv:{cardinal:[t,r,a],ordinal:[a]},mas:s,mg:s,mgo:s,mk:{cardinal:[r,a],ordinal:[r,n,o,a]},ml:s,mn:s,mo:{cardinal:[r,i,a],ordinal:[r,a]},mr:{cardinal:[r,a],ordinal:[r,n,i,a]},ms:{cardinal:[a],ordinal:[r,a]},mt:{cardinal:[r,n,i,o,a],ordinal:[a]},my:c,nah:s,naq:u,nb:s,nd:s,ne:l,nl:s,nn:s,nnh:s,no:s,nqo:c,nr:s,nso:s,ny:s,nyn:s,om:s,or:{cardinal:[r,a],ordinal:[r,n,i,o,a]},os:s,osa:c,pa:s,pap:s,pcm:s,pl:{cardinal:[r,i,o,a],ordinal:[a]},prg:{cardinal:[t,r,a],ordinal:[a]},ps:s,pt:{cardinal:[r,o,a],ordinal:[a]},pt_PT:{cardinal:[r,o,a],ordinal:[a]},rm:s,ro:{cardinal:[r,i,a],ordinal:[r,a]},rof:s,ru:{cardinal:[r,i,o,a],ordinal:[a]},rwk:s,sah:c,saq:s,sat:u,sc:{cardinal:[r,a],ordinal:[o,a]},scn:{cardinal:[r,a],ordinal:[o,a]},sd:s,sdh:s,se:u,seh:s,ses:c,sg:c,sh:{cardinal:[r,i,a],ordinal:[a]},shi:{cardinal:[r,i,a],ordinal:[a]},si:s,sk:{cardinal:[r,i,o,a],ordinal:[a]},sl:{cardinal:[r,n,i,a],ordinal:[a]},sma:u,smi:u,smj:u,smn:u,sms:u,sn:s,so:s,sq:{cardinal:[r,a],ordinal:[r,o,a]},sr:{cardinal:[r,i,a],ordinal:[a]},ss:s,ssy:s,st:s,su:c,sv:l,sw:s,syr:s,ta:s,te:s,teo:s,th:c,ti:s,tig:s,tk:{cardinal:[r,a],ordinal:[i,a]},tl:l,tn:s,to:c,tpi:c,tr:s,ts:s,tzm:s,ug:s,uk:{cardinal:[r,i,o,a],ordinal:[i,a]},und:c,ur:s,uz:s,ve:s,vec:{cardinal:[r,o,a],ordinal:[o,a]},vi:{cardinal:[a],ordinal:[r,a]},vo:s,vun:s,wa:s,wae:s,wo:c,xh:s,xog:s,yi:s,yo:c,yue:c,zh:c,zu:s})}(s);var l=n(s.exports),c=t({__proto__:null,default:l},[s.exports]),u={exports:{}};!function(e){var t,r=function(e,t){return"other"},n=function(e,t){return"other"===e&&"one"===t?"one":"other"},i=function(e,t){return t||"other"};t={af:r,ak:n,am:i,an:r,ar:function(e,t){return"few"===t?"few":"many"===t?"many":"zero"===e&&"one"===t||"zero"===e&&"two"===t?"zero":"other"},as:i,az:i,be:i,bg:r,bn:i,bs:i,ca:r,cs:i,cy:i,da:i,de:i,el:i,en:r,es:r,et:r,eu:r,fa:n,fi:r,fil:i,fr:i,ga:i,gl:i,gsw:i,gu:i,he:r,hi:i,hr:i,hu:i,hy:i,ia:r,id:r,io:r,is:i,it:i,ja:r,ka:function(e,t){return e||"other"},kk:i,km:r,kn:i,ko:r,ky:i,lij:i,lo:r,lt:i,lv:function(e,t){return"one"===t?"one":"other"},mk:r,ml:i,mn:i,mr:i,ms:r,my:r,nb:r,ne:i,nl:i,no:r,or:n,pa:i,pcm:r,pl:i,ps:i,pt:i,ro:function(e,t){return"few"===t||"one"===t?"few":"other"},ru:i,sc:i,scn:i,sd:n,si:function(e,t){return"one"===e&&"one"===t?"one":"other"},sk:i,sl:function(e,t){return"few"===t||"one"===t?"few":"two"===t?"two":"other"},sq:i,sr:i,sv:r,sw:i,ta:i,te:i,th:r,tk:i,tr:i,ug:i,uk:i,ur:r,uz:i,vi:r,yue:r,zh:r,zu:i},Object.defineProperty(t,"__esModule",{value:!0}),e.exports=t}(u);var d=n(u.exports),h=o||a,f=l||c,p=d||t({__proto__:null,default:d},[u.exports]),g=function(e){return"pt-PT"===e?"pt_PT":e},m=r.default(Intl.NumberFormat,function(e){return h[g(e)]},function(e,t){return f[g(e)][t?"ordinal":"cardinal"]},function(e){return p[g(e)]});return pi=m}();function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e);if("undefined"==typeof Intl)void 0!==Dn?Dn.Intl={PluralRules:r.default}:"undefined"!=typeof window?window.Intl={PluralRules:r.default}:ii.Intl={PluralRules:r.default},r.default.polyfill=!0;else if(Intl.PluralRules&&Intl.PluralRules.prototype.selectRange){var n=["en","es","ru","zh"];Intl.PluralRules.supportedLocalesOf(n).length<n.length&&(Intl.PluralRules=r.default,r.default.polyfill=!0)}else Intl.PluralRules=r.default,r.default.polyfill=!0}();var bi={Folder:"Folder",Folders:"Folders",Files:"Files",File:"File","Select the destination folder":"Select the destination folder","Filter by type":"Filter by type","All types":"All types","File name":"File name",Size:"Size",Date:"Date",Actions:"Actions",Delete:"Delete",Move:"Move",Copy:"Copy",Refresh:"Refresh","Add folder":"Add folder","Add file":"Add file","Add file by URL":"Add file by URL","Please select an image file":"Please select an image file","File deleted":"File deleted","Error when deleting a file":"Error when deleting a file","Folder deleted":"Folder deleted","Error when deleting a folder":"Error when deleting a folder","Delete folder":"Delete folder","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Are you sure you want to delete this folder? This action will also delete all files and subfolders.","File moved":"File moved","Error when moving a file":"Error when moving a file","has been successfully uploaded":"has been successfully uploaded","Failed to download file":"Failed to download file","Failed to load JSON data":"Failed to load JSON data","Invalid file URL":"Invalid file URL","Unable to validate file URL":"Unable to validate file URL","Error when uploading a file":"Error when uploading a file","successfully uploaded":"successfully uploaded","Error when downloading a file by URL":"Error when downloading a file by URL","Error loading files":"Error loading files","File Manager not configured":"File Manager not configured","Type to search...":"Type to search...","Failed to create folder":"Failed to create folder",Cancel:"Cancel",Submit:"Submit",months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},files:"files","No available folders":"No available folders","My files":"My files",GIF:"GIF","Stock images":"Stock images","QR & Barcode":"QR & Barcode","QR code":"QR code",Barcode:"Barcode","Text or URL":"Text or URL","Code color":"Code color","Background color":"Background color","Add to My files":"Add to My files","Transparent background":"Transparent background","Barcode generation failed":"Could not generate this barcode. Use characters supported by CODE128.","Validation error":"Validation error","Enter text or URL to preview":"Enter text or a URL to encode.",Preview:"Preview","QR transparent background hint":"A transparent PNG may blend into dark email themes; a white background is often easier for scanners.","QR image size px":"QR image size","Barcode bar height px":"Barcode bar height",Icons:"Icons",AI:"AI","AI image generation":"AI image generation","Search GIFs":"Search GIFs","That`s all we could find.":"That`s all we could find.","Search image":"Search image",All:"All",Landscape:"Landscape",Portrait:"Portrait",Squarish:"Squarish",Black:"Black","Black and White":"Black and White",White:"White",Orange:"Orange",Red:"Red",Purple:"Purple",Magenta:"Magenta",Green:"Green",Teal:"Teal",Blue:"Blue","Photo by":"Photo by",on:"on",selected:"selected",Deselected:"Deselected","Select all":"Select all",Rename:"Rename","Rename file":"Rename file {{currentFileName}}","Selected files":"Selected files: {{count}}",selected_files_one:"Selected {{count}} file",selected_files_other:"Selected {{count}} files",Edit:"Edit","Move to":"Move to","New folder":"New folder","Image search...":"Image search...","Search icons":"Search icons","By name":"By name","By size":"By size","By date":"By date",List:"List",Grid:"Grid",Main:"Main","total pages":"Total {{total}} items",Name:"Name",Untitled:"Untitled",Dimensions:"Dimensions",error:"error",created:"created","API-endpoint for file upload is not configured":"API-endpoint for file upload is not configured","The URL must point to an image":"The URL must point to an image","Image upload...":"Image upload...",Unknown:"Unknown","Error downloading file by URL":"Error downloading file by URL","File not found":"File not found","File renamed to":"File renamed to ","Failed to rename the file":"Failed to rename the file","Folder renamed to":"Folder renamed to","Rename folder":"Rename folder","New folder name":"New folder name","Enter a new folder name":"Enter a new folder name","Please drag and drop image files only":"Please drag and drop image files only","Upload file by URL":"Upload file by URL","Upload file":"Upload file","Creating a new folder":"Creating a new folder",Create:"Create","Folder name":"Folder name","Enter the name of the folder":"Enter the name of the folder","Enter the name":"Enter the name","A folder will be created inside:":"A folder will be created inside:","selected folder":"selected folder","The folder will be created in the root directory":"The folder will be created in the root directory","Failed to load folders":"Failed to load folders","Folder name cannot be empty":"Folder name cannot be empty","Folder creation provider is not configured":"Folder creation provider is not configured","Folder created":"Folder created","Folder rename is disabled by config":"Folder rename is disabled by config","Folder rename provider is not configured":"Folder rename provider is not configured","Unexpected response when renaming folder":"Unexpected response when renaming folder","Folder renamed":"Folder renamed","Failed to rename folder":"Failed to rename folder","Failed to load folder items count":"Failed to load folder items count","Failed to load subfolders":"Failed to load subfolders",Download:"Download","image URL":"image URL","Enter the URL of the image":"Enter the URL of the image","URL too long":"URL is too long","Only http and https URLs are supported":"Only http and https URLs are supported","Private and local URLs are not allowed":"Private and local URLs are not allowed","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"New file name","Enter a new file name":"Enter a new file name","Copy to folder":"Copy to folder",Added:"Added {{date}}","File uploaded successfully":"File {{fileName}} uploaded successfully","Successfully uploaded":"Successfully uploaded {{successCount}} of {{count}} file","Successfully uploaded files":"Successfully uploaded {{successCount}} of {{count}} files",Uploaded:"Uploaded: {{names}}",uploads_success_summary:"Uploaded {{successCount}} of {{totalCount}} files",Failed:"Failed: {{names}}",uploads_fail_summary:"Failed to upload {{failCount}} of {{totalCount}} files","File with this name already exists.":"File with this name already exists.","File not found or no longer available.":"File not found or no longer available.","You don't have permission to access this file.":"You don't have permission to access this file.","File is too large to upload.":"File is too large to upload.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}","This file type is not allowed.":"This file type is not allowed.","File name is not valid.":"File name is not valid.","File name is not valid. Allowed characters: {{allowedChars}}":"File name is not valid. Allowed characters: {{allowedChars}}","Failed to read the file.":"Failed to read the file.","Failed to write the file.":"Failed to write the file.","The file appears to be corrupted.":"The file appears to be corrupted.","File integrity check failed.":"File integrity check failed.","Folder not found or no longer available.":"Folder not found or no longer available.","Folder with this name already exists.":"Folder with this name already exists.","A folder with that name already exists. Please enter a different folder name.":"A folder with that name already exists. Please enter a different folder name.","You don't have permission to access this folder.":"You don't have permission to access this folder.","Folder name is not valid.":"Folder name is not valid.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Folder name is not valid. Allowed characters: {{allowedChars}}","Failed to read the folder contents.":"Failed to read the folder contents.","Failed to write to the folder.":"Failed to write to the folder.","Folder storage quota exceeded.":"Folder storage quota exceeded.","Folder is not empty.":"Folder is not empty.","Server error while processing the folder.":"Server error while processing the folder.","Folder operation took too long.":"Folder operation took too long.","Network error. Please check your connection and try again.":"Network error. Please check your connection and try again.","The operation took too long. Please try again.":"The operation took too long. Please try again.","Server error. Please try again later.":"Server error. Please try again later.","Service is temporarily unavailable. Please try again later.":"Service is temporarily unavailable. Please try again later.","Too many requests. Please try again a bit later.":"Too many requests. Please try again a bit later.","Authentication failed. Please sign in again.":"Authentication failed. Please sign in again.","You are not allowed to perform this action.":"You are not allowed to perform this action.","Some of the provided data is invalid.":"Some of the provided data is invalid.","This operation is not supported.":"This operation is not supported.","Request payload is too large.":"Request payload is too large.","This media type is not supported.":"This media type is not supported.","You have exceeded the upload quota.":"You have exceeded the upload quota.","Network error while uploading the file.":"Network error while uploading the file.","File upload took too long.":"File upload took too long.","Server error while uploading the file.":"Server error while uploading the file.","The specified URL is not valid.":"The specified URL is not valid.","The specified URL is not reachable.":"The specified URL is not reachable.","Content type at the URL is not allowed.":"Content type at the URL is not allowed.","Failed to download file from the URL.":"Failed to download file from the URL.","Network error while downloading the file.":"Network error while downloading the file.","File download took too long.":"File download took too long.","Server error while downloading the file.":"Server error while downloading the file.","Some items could not be processed.":"Some items could not be processed.","Failed to process all items in the batch.":"Failed to process all items in the batch.","Some items in the batch are in a conflicting state.":"Some items in the batch are in a conflicting state.","Some items in the batch did not pass validation.":"Some items in the batch did not pass validation.","AI service returned an invalid response.":"AI service returned an invalid response.","Failed to generate image using AI.":"Failed to generate image using AI.","You have reached the AI image generation limit.":"You have reached the AI image generation limit.","Error in external integration.":"Error in external integration.","Error in a third-party service.":"Error in a third-party service.","An unknown error occurred.":"An unknown error occurred.","Renaming is not allowed for this item.":"Renaming is not allowed for this item.","Moving is not allowed for this item.":"Moving is not allowed for this item.","Copying is not allowed for this item.":"Copying is not allowed for this item.","Deleting is not allowed for this item.":"Deleting is not allowed for this item.","Cannot move an item into itself.":"Cannot move an item into itself.","Cannot move an item into its descendant folder.":"Cannot move an item into its descendant folder.","Cannot copy an item into itself.":"Cannot copy an item into itself.","Configuration error occurred.":"Configuration error occurred.","Storage quota exceeded. Please free up space.":"Storage quota exceeded. Please free up space.","File is locked by another process or user.":"File is locked by another process or user.","File version conflict. Please refresh and try again.":"File version conflict. Please refresh and try again.","Batch operation exceeds the maximum number of items allowed.":"Batch operation exceeds the maximum number of items allowed.",Moved:"Moved: {{names}}",move_success_summary:"Moved {{successCount}} of {{totalCount}} items",move_fail_summary:"Failed to move {{failCount}} of {{totalCount}} items",Copied:"Copied: {{names}}",copy_success_summary:"Copied {{successCount}} of {{totalCount}} items",copy_fail_summary:"Failed to copy {{failCount}} of {{totalCount}} items","Failed to upload":"Failed to upload {{failCount}} of {{count}} file","Failed to upload files":"Failed to upload {{failCount}} of {{count}} files","No folders yet":"No folders yet","Drag files to upload":"Drag files to upload","Drop files here to upload":"Drop files here to upload","Newest first":"Newest first","Oldest first":"Oldest first","Largest first":"Largest first","Smallest first":"Smallest first","A-Z":"A-Z","Z-A":"Z-A","By type":"By type","Evaluating the task":"Evaluating the task","Something went wrong, please try again":"Something went wrong, please try again","Sort by":"Sort by","preview text":"The image preview is trying to load ...","Use this variant":"Use this variant","Confirm deletion":"Confirm deletion","Are you sure you want to delete the selected items?":"Are you sure you want to delete the selected items?","Move to Trash":"Move to Trash","Are you sure you want to move the selected items to the Trash?":"Are you sure you want to move the selected items to the Trash?","Permanently delete":"Permanently delete","Delete permanently":"Delete permanently","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Are you sure you want to permanently delete the selected items? This action cannot be undone.",Clear:"Clear","Clear Trash":"Clear Trash","Are you sure you want to permanently delete all items from Trash?":"Are you sure you want to permanently delete all items from Trash?","Trash cleared successfully":"Trash cleared successfully","{{count}} items permanently deleted":"{{count}} items permanently deleted","Trash partially cleared":"Trash partially cleared","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} items deleted, {{failed}} items failed","Failed to clear trash":"Failed to clear trash","Error clearing trash":"Error clearing trash","Deleting items...":"Deleting items...",delete_files_permanent_one:"This action will permanently delete {{count}} file",delete_files_permanent_other:"This action will permanently delete {{count}} files",delete_folder_permanent:"This action will permanently delete the folder '{{name}}' and all its contents, including {{count}} items.",delete_mixed_permanent:"This action will permanently delete {{total}} selected items, including {{folders}} folders and all {{images}} images within them.",permanent_delete_warning:"Deleting files that were used in emails will cause problems with displaying images in old emails. Are you sure you want to permanently delete the selection?",move_files_to_trash_one:"This will move {{count}} file to the Trash.",move_files_to_trash_other:"This will move {{count}} files to the Trash.",move_folder_to_trash:"This will move the folder '{{name}}' and all its contents ({{count}} items) to the Trash.",move_mixed_to_trash:"This will move {{total}} selected items to the Trash, including {{folders}} folders and {{images}} images.",delete_count_confirm_trash_one:"Move {{count}} file to Trash?",delete_count_confirm_trash_other:"Move {{count}} files to Trash?",delete_count_confirm_permanent_one:"Permanently delete {{count}} file?",delete_count_confirm_permanent_other:"Permanently delete {{count}} files?",delete_count_confirm_one:"Delete {{count}} file?",delete_count_confirm_other:"Delete {{count}} files?",item:"item",items:"items",Trash:"Deleted",Choose:"Choose",Stock:"Stock","Select an image from our library":"Select an image from our library","AI generation":"AI generation","Creating an image on demand":"Creating an image on demand","Search file or folder":"Search file or folder","Click here to select a file":"Click here to select a file","Create folder":"Create folder",Done:"Done","Move here":"Move here","Copy here":"Copy here","File URL":"File URL","There's nothing here":"There's nothing here","Try using a different search query.":"Try using a different search query.","Millions of free stock images":"Millions of free stock images","Enter a search query and we'll find the perfect image for you":"Enter a search query and we'll find the perfect image for you","Millions of icons":"Millions of icons","Lucide icons":"Lucide icons","Thousands of icons":"Thousands of icons","Enter a search query and we'll find the perfect icon for you":"Enter a search query and we'll find the perfect icon for you","Enter your query and we will find the right one for you":"Enter your query and we will find the right one for you","Over 350,000 live images":"Over 350,000 live images","The folder will be created in the root directory.":"The folder will be created in the root directory.",undo:"UNDO",moved_to_trash_one:"Moved {{count}} item to Trash",moved_to_trash_other:"Moved {{count}} items to Trash",restored_items_one:"Restored {{count}} item",restored_items_other:"Restored {{count}} items",Type:"Type","Generate image":"Generate image","For example:":"For example:","A beautiful image of a sunset over a calm ocean.":"A beautiful image of a sunset over a calm ocean.",Insert:"Insert",Error:"Error","Upload progress":"Upload {{completed}}/{{total}}","Uploading files":"Uploading {{completed}}/{{total}} files","Uploaded files":"Uploaded {{success}} of {{total}} files","Upload error files":"Upload error {{errorCount}} files","Applies to all {{count}} files":"(applies to all {{count}} files)","Some files failed to upload":"Some files failed to upload. Please check file size and format.",upload_error_hint_invalid_name:"Rename the file: use only letters, numbers, hyphens and underscores.",upload_error_hint_size:"Reduce the file size or choose a different file.",upload_error_hint_format:"Use an allowed format: JPG, PNG, or GIF.",upload_error_hint_exists:"A file with this name already exists in the folder. Rename the file.","Images generated successfully":"Images generated successfully","Trash is empty":"Trash is empty","Deleted files will be displayed here":"Deleted files will be displayed here","Supported files:":"Supported files:","Stroke width":"Stroke thickness",Color1:"Color",Color2:"Color2",Color3:"Color3","Global search":"Global search","Family search":"Family search","Choose for template":"Choose for template",Back:"Back","Editing: {{name}}":"Editing: {{name}}","Editing image":"Editing image",Save:"Save","Loading editor...":"Loading editor...","Error loading image":"Error loading image","Error saving image":"Error saving image","Error initializing editor":"Error initializing editor","Close File Manager":"Close File Manager","Are you sure you want to close? Unsaved changes will be lost.":"Are you sure you want to close? Unsaved changes will be lost.","Are you sure you want to close the file manager?":"Are you sure you want to close the file manager?",Close:"Close",KB:"KB","No files":"No files","Folder is empty or files not found":"Folder is empty or files not found","Search files...":"Search files...",Success:"Success","Image updated successfully":"Image updated successfully","Failed to save changes":"Failed to save changes: {{error}}","Unknown error":"Unknown error","Select destination folder":"Select destination folder","Error moving":"Error moving","Error deleting":"Error deleting","Error copying":"Error copying","Error renaming":"Error renaming","Failed to refresh folder tree":"Failed to refresh folder tree","Failed to refresh file list":"Failed to refresh file list","Errors occurred while moving":"Errors occurred while moving","Errors occurred while copying":"Errors occurred while copying","(error)":"(error)","(circular reference)":"(circular reference)","File too large. Maximum size: {{size}}":"File too large. Maximum size: {{size}}","File too small. Minimum size: {{size}}":"File too small. Minimum size: {{size}}","Unsupported file type":"Unsupported file type","Unsupported file type: {{type}}":"Unsupported file type: {{type}}",unknown:"unknown","Failed to load files":"Failed to load files","Failed to load files in folder":"Could not load folder contents ({{folderName}})","Failed to load subfolders in folder":'Could not load subfolders in "{{folderName}}"',"Failed to load folder items count in folder":'Could not get item count for "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider for folder deletion is not configured","DataProvider for file upload is not configured":"DataProvider for file upload is not configured","Error uploading file {{fileName}}":"Error uploading file {{fileName}}","Error uploading file":"Error uploading file","Cannot upload files to Trash":"Cannot upload files to Trash","Please fill in all fields":"Please fill in all fields","Upload by URL is not supported":"Upload by URL is not supported","File name is too long. Maximum {{max}} characters":"File name is too long. Maximum {{max}} characters","File name contains invalid characters":"File name contains invalid characters","Large file may take a long time to upload":"Large file may take a long time to upload","File unavailable: {{status}} {{statusText}}":"File unavailable: {{status}} {{statusText}}","File too large: {{size}}":"File too large: {{size}}","Unsupported file type: {{contentType}}":"Unsupported file type: {{contentType}}","Invalid server response: folder ID is missing":"Invalid server response: folder ID is missing","Error: folder cannot be its own parent":"Error: folder cannot be its own parent","Upload to Trash is forbidden":"Upload to Trash is forbidden","renameFolder is not implemented in dataProviders":"renameFolder is not implemented in dataProviders","renameFile is not implemented in dataProviders":"renameFile is not implemented in dataProviders",Deleted:"Deleted",Clean:"Clean","Circular dependency detected: folder cannot be its own parent":"Circular dependency detected: folder cannot be its own parent","Save as copy and choose":"Save as copy and choose","Save and choose":"Save and choose",pixie:{"added drawing":"Added Drawing","added frame":"Added Frame","added image":"Added Image","added shape":"Added Shape","added sticker":"Added Sticker","added text":"Added Text","applied filters":"Applied Filters",apply:"Apply",background:"Background","background color":"Background color",beach:"Beach","brush color":"Brush Color","brush size":"Brush Size","brush type":"Brush Type",bubbles:"Bubbles",Cancel:"Cancel","changed style":"Changed Style","Circle Brush":"Circle Brush",close:"Close",color:"Color",corners:"Corners",crop:"Crop",Custom:"Custom","deleted object":"Deleted object","Diamond Brush":"Diamond Brush",doodles:"Doodles",draw:"Draw",emoticons:"Emoticons","Eraser Brush":"Eraser Brush",filter:"Filter",font:"Font","font size":"Font Size",frame:"Frame",gradient:"Gradient",height:"Height",history:"History","H Line Brush":"H Line Brush",image:"Image",initial:"Initial",landmarks:"Landmarks","loaded state":"Loaded State","loading canvas":"Loading Canvas","loading image":"Loading Image","loading state":"Loading State","maintain aspect ratio":"Maintain aspect ratio",merge:"Merge","merged objects":"Merged Objects","new text":"New Text",objects:"Objects",opacity:"Opacity",outline:"Outline","outline color":"Outline Color","Pencil Brush":"Pencil Brush","processing image":"Processing Image",quality:"Quality",radius:"Radius","replace image":"Replace Image","replaced background image":"Replaced Background Image",resize:"Resize","resized image":"Resized Image","rounded corner":"Rounded Corner",save:"Save",shadow:"Shadow","shadow color":"Shadow Color",shapes:"Shapes","Spray Brush":"Spray Brush",square:"Square","Square Brush":"Square Brush",stickers:"Stickers",text:"Text",texture:"Texture",transportation:"Transportation","V Line Brush":"V Line Brush",width:"Width",grayscale:"Grayscale","black & White":"Black & White",sharpen:"Sharpen",invert:"Invert",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Brownie",sepia:"Sepia","remove Color":"Remove Color",brightness:"Brightness",gamma:"Gamma",noise:"Noise",pixelate:"Pixelate",blur:"Blur",emboss:"Emboss","blend Color":"Blend Color",distance:"Distance",red:"Red",green:"Green",blue:"Blue",blocksize:"Blocksize",alpha:"Alpha",add:"Add",multiply:"Multiply",subtract:"Subtract",diff:"Diff",screen:"Screen",lighten:"Lighten",darken:"Darken","select an option...":"Select an option..."}},wi={Files:"Файлы",selected:"выбрано",Deselected:"Отменить выбор",Refresh:"Обновить","Select all":"Выбрать все",Rename:"Переименовать","Rename file":"Переименовать файл {{currentFileName}}","Select the destination folder":"Выберите папку назначения","Selected files:":"Выбрано файлов:","Selected files":"Выбрано файлов: {{count}}",selected_files_one:"Выбран {{count}} файл",selected_files_few:"Выбрано {{count}} файла",selected_files_many:"Выбрано {{count}} файлов",selected_files_other:"Выбрано {{count}} файлов",Copy:"Дублировать",Edit:"Изменить",Move:"Переместить","Move to":"Переместить",Delete:"Удалить","New folder":"Новая папка","Image search...":"Поиск изображений...","Search icons":"Найти иконки","By name":"По имени","By size":"По размеру","By date":"По дате",List:"Список",Grid:"Плитки",Main:"Главная",Folders:"Папки","total pages":"Всего {{total}} элементов",Name:"Имя",Untitled:"Без названия",Size:"Размер",Dimensions:"Размер",Date:"Дата",error:"ошибка",Folder:"Папка",created:"создана","Failed to create folder":"Не удалось создать папку","File deleted":"Файл удален","Files deleted":"Файлы удалены","Error when deleting a file":"Ошибка при удалении файла","Folder deleted":"Папка удалена","Error when deleting a folder":"Ошибка при удалении папки","Delete folder":"Удалить папку","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Вы уверены, что хотите удалить эту папку? Это действие также удалит все файлы и подпапки.","API-endpoint for file upload is not configured":"API-endpoint для загрузки файлов не настроен","Please select an image file":"Пожалуйста, выберите файл изображения",File:"Файл","has been successfully uploaded":"успешно загружен","The URL must point to an image":"URL должен указывать на изображение","Image upload...":"Загрузка изображения...",Unknown:"Неизвестно","Error downloading file by URL":"Ошибка загрузки файла по URL","successfully uploaded":"успешно загружен","Error when downloading a file by URL":"Ошибка при загрузке файла по URL","Error when uploading a file":"Ошибка при загрузке файла","Error loading files":"Ошибка загрузки файлов","File not found":"Файл не найден","File renamed to":"Файл переименован на ","Failed to rename the file":"Не удалось переименовать файл","Folder renamed to":"Папка переименована на","Rename folder":"Переименовать папку","New folder name":"Новое название папки","Enter a new folder name":"Введите новое название папки","Please drag and drop image files only":"Пожалуйста, перетащите только файлы изображений","Upload file by URL":"Загрузить файл по URL","Upload file":"Загрузить файл","Creating a new folder":"Создание новой папки",Create:"Создать",Cancel:"Отмена","Folder name":"Название папки","Enter the name of the folder":"Введите название папки","Enter the name":"Введите название","A folder will be created inside:":"Папка будет создана внутри:","selected folder":"выбранной папки","The folder will be created in the root directory":"Папка будет создана в корневом каталоге","Failed to load folders":"Не удалось загрузить папки","Folder name cannot be empty":"Название папки не может быть пустым","Folder creation provider is not configured":"Провайдер создания папок не настроен","Folder created":"Папка создана","Folder rename is disabled by config":"Переименование папок отключено конфигурацией","Folder rename provider is not configured":"Провайдер переименования папок не настроен","Unexpected response when renaming folder":"Неожиданный ответ при переименовании папки","Folder renamed":"Папка переименована","Failed to rename folder":"Не удалось переименовать папку","Failed to load folder items count":"Не удалось получить количество файлов в папке","Failed to load subfolders":"Не удалось загрузить подпапки",Download:"Загрузить","image URL":"URL изображения","Enter the URL of the image":"Введите URL изображения","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Поддерживаемые форматы: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Новое имя файла","Enter a new file name":"Введите новое имя файла","Copy to folder":"Копировать в папку",Added:"Добавлено {{date}}","File uploaded successfully":"Файл {{fileName}} успешно загружен","Successfully uploaded":"Успешно загружено {{successCount}} из {{count}} файла","Successfully uploaded files":"Успешно загружено {{successCount}} из {{count}} файлов",uploads_success_summary:"Загружено {{successCount}} из {{totalCount}} файлов",uploads_fail_summary:"Не удалось загрузить {{failCount}} из {{totalCount}} файлов","File with this name already exists.":"Файл с таким именем уже существует.","File not found or no longer available.":"Файл не найден или уже был удалён.","You don't have permission to access this file.":"У вас нет прав доступа к этому файлу.","File is too large to upload.":"Файл слишком большой для загрузки.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"Файл слишком большой ({{fileSize}}). Максимально допустимый размер — {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Превышено максимальное количество файлов. Допустимо: {{allowed}}, выбрано: {{received}}","This file type is not allowed.":"Этот тип файла не поддерживается.","File name is not valid.":"Недопустимое имя файла.","File name is not valid. Allowed characters: {{allowedChars}}":"Недопустимое имя файла. Допустимые символы: {{allowedChars}}","Failed to read the file.":"Не удалось прочитать файл.","Failed to write the file.":"Не удалось записать файл.","The file appears to be corrupted.":"Файл повреждён или имеет неверный формат.","File integrity check failed.":"Проверка целостности файла завершилась неудачно.","Folder not found or no longer available.":"Папка не найдена или уже была удалена.","Folder with this name already exists.":"Папка с таким именем уже существует.","A folder with that name already exists. Please enter a different folder name.":"Папка с таким именем уже существует. Введите другое имя папки.","You don't have permission to access this folder.":"У вас нет прав доступа к этой папке.","Folder name is not valid.":"Недопустимое имя папки.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Не удалось создать папку. Допустимые символы в названии папки: {{allowedChars}}","Failed to read the folder contents.":"Не удалось прочитать содержимое папки.","Failed to write to the folder.":"Не удалось выполнить операцию с папкой.","Folder storage quota exceeded.":"Превышена квота хранения для папки.","Folder is not empty.":"Папка не пуста.","Server error while processing the folder.":"Ошибка сервера при обработке папки.","Folder operation took too long.":"Операция с папкой выполнялась слишком долго.","Network error. Please check your connection and try again.":"Ошибка сети. Проверьте подключение к интернету и повторите попытку.","The operation took too long. Please try again.":"Операция выполнялась слишком долго. Попробуйте ещё раз.","Server error. Please try again later.":"Ошибка на сервере. Повторите попытку позже.","Service is temporarily unavailable. Please try again later.":"Сервис временно недоступен. Повторите попытку позже.","Too many requests. Please try again a bit later.":"Слишком много запросов. Попробуйте ещё раз немного позже.","Authentication failed. Please sign in again.":"Не удалось пройти аутентификацию. Пожалуйста, войдите снова.","You are not allowed to perform this action.":"У вас нет прав для выполнения этого действия.","Some of the provided data is invalid.":"Некоторые из переданных данных некорректны.","This operation is not supported.":"Эта операция не поддерживается.","Request payload is too large.":"Тело запроса слишком большое.","This media type is not supported.":"Этот тип данных не поддерживается.","You have exceeded the upload quota.":"Превышена квота на загрузку файлов.","Network error while uploading the file.":"Сетевая ошибка при загрузке файла.","File upload took too long.":"Загрузка файла выполнялась слишком долго.","Server error while uploading the file.":"Ошибка сервера при загрузке файла.","The specified URL is not valid.":"Указан некорректный URL.","The specified URL is not reachable.":"Указанный URL недоступен.","Content type at the URL is not allowed.":"Тип содержимого по указанному URL не поддерживается.","Failed to download file from the URL.":"Не удалось скачать файл по указанному URL.","Network error while downloading the file.":"Сетевая ошибка при скачивании файла.","File download took too long.":"Скачивание файла выполнялось слишком долго.","Server error while downloading the file.":"Ошибка сервера при скачивании файла.","Some items could not be processed.":"Не все элементы были обработаны успешно.","Failed to process all items in the batch.":"Не удалось обработать ни один элемент в пакетной операции.","Some items in the batch are in a conflicting state.":"Некоторые элементы в пакетной операции находятся в конфликтующем состоянии.","Some items in the batch did not pass validation.":"Некоторые элементы в пакетной операции не прошли валидацию.","AI service returned an invalid response.":"Сервис AI вернул некорректный ответ.","Failed to generate image using AI.":"Не удалось создать изображение с помощью AI.","You have reached the AI image generation limit.":"Достигнут лимит генерации изображений AI.","Error in external integration.":"Ошибка во внешней интеграции.","Error in a third-party service.":"Ошибка во внешнем сервисе.","An unknown error occurred.":"Произошла неизвестная ошибка.","Renaming is not allowed for this item.":"Переименование не разрешено для этого элемента.","Moving is not allowed for this item.":"Перемещение не разрешено для этого элемента.","Copying is not allowed for this item.":"Копирование не разрешено для этого элемента.","Deleting is not allowed for this item.":"Удаление не разрешено для этого элемента.","Cannot move an item into itself.":"Нельзя переместить элемент в самого себя.","Cannot move an item into its descendant folder.":"Нельзя переместить элемент в дочернюю папку.","Cannot copy an item into itself.":"Нельзя скопировать элемент в самого себя.","Configuration error occurred.":"Произошла ошибка конфигурации.","Storage quota exceeded. Please free up space.":"Превышена квота хранилища. Освободите место.","File is locked by another process or user.":"Файл заблокирован другим процессом или пользователем.","File version conflict. Please refresh and try again.":"Конфликт версий файла. Обновите страницу и попробуйте снова.","Batch operation exceeds the maximum number of items allowed.":"Пакетная операция превышает максимально допустимое количество элементов.",Moved:"Перемещены: {{names}}",move_success_summary:"Перемещено {{successCount}} из {{totalCount}} объектов",move_fail_summary:"Не удалось переместить {{failCount}} из {{totalCount}} объектов",Copied:"Скопированы: {{names}}",copy_success_summary:"Скопировано {{successCount}} из {{totalCount}} объектов",copy_fail_summary:"Не удалось скопировать {{failCount}} из {{totalCount}} объектов",Uploaded:"Загружены: {{names}}",Failed:"Не удалось: {{names}}","Failed to upload":"Не удалось загрузить {{failCount}} из {{count}} файла","Failed to upload files":"Не удалось загрузить {{failCount}} из {{count}} файлов",months:{january:"января",february:"февраля",march:"марта",april:"апреля",may:"мая",june:"июня",july:"июля",august:"августа",september:"сентября",october:"октября",november:"ноября",december:"декабря"},files:"файлов","No available folders":"Нет доступных папок","My files":"Мои файлы",GIF:"GIF","Stock images":"Стоковые изображения","QR & Barcode":"QR и штрихкод","QR code":"QR-код",Barcode:"Штрихкод","Text or URL":"Текст или ссылка","Code color":"Цвет кода","Background color":"Цвет фона","Add to My files":"Добавить в Мои файлы","Transparent background":"Прозрачный фон","Barcode generation failed":"Не удалось построить штрихкод. Используйте символы, поддерживаемые CODE128.","Validation error":"Ошибка валидации","Enter text or URL to preview":"Введите текст или URL для предпросмотра.",Preview:"Предпросмотр","QR transparent background hint":"Прозрачный PNG может сливаться с тёмной темой письма; белый фон часто надёжнее для сканеров.","QR image size px":"Размер QR","Barcode bar height px":"Высота штрихов",Icons:"Иконки",AI:"AI","AI image generation":"AI генерация изображений","Search GIFs":"Найти GIF","That`s all we could find.":"Это все, что мы смогли найти.","Search image":"Найти изображение",All:"Все",Landscape:"Горизонтальные",Portrait:"Вертикальные",Squarish:"Квадратные",Black:"Черный","Black and White":"Черно-белый",White:"Белый",Orange:"Оранжевый",Red:"Красный",Purple:"Фиолетовый",Magenta:"Пурпурный",Green:"Зеленый",Teal:"Бирюзовый",Blue:"Синий","Photo by":"Фото",on:"на","File Manager":"Файловый менеджер","File Manager not configured":"Файловый менеджер не настроен","Filter by type":"Фильтр по типу","All types":"Все типы","File name":"Имя файла",Actions:"Действия","Add file":"Добавить файл","Add folder":"Добавить папку","Add file by URL":"Добавить файл по URL","File moved":"Файл перемещён","Files moved":"Файлы перемещены","Error when moving a file":"Ошибка при перемещении файла","Files copied":"Файлы скопированы","Failed to download file":"Не удалось скачать файл","Failed to load JSON data":"Не удалось загрузить данные JSON","Invalid file URL":"Некорректный URL файла","Unable to validate file URL":"Не удалось проверить файл по URL","Type to search...":"Введите для поиска...",Submit:"Отправить","No folders yet":"Папок пока нет","Drag files to upload":"Перетащите файлы для загрузки","Drop files here to upload":"Отпустите файлы здесь, чтобы загрузить их","Newest first":"Сначала новые","Oldest first":"Сначала старые","Largest first":"Сначала большие","Smallest first":"Сначала маленькие","A-Z":"По алфавиту А-Я","Z-A":"По алфавиту Я-А","By type":"По типу","Evaluating the task":"Оценка задания","Something went wrong, please try again":"Что-то пошло не так, пожалуйста, попробуйте еще раз","Sort by":"Сортировать по","preview text":"Изображение загружается ...","Use this variant":"Использовать этот вариант","Confirm deletion":"Подтвердить удаление","Are you sure you want to delete the selected items?":"Вы уверены, что хотите удалить выбранные элементы?","Move to Trash":"Переместить в корзину","Are you sure you want to move the selected items to the Trash?":"Вы уверены, что хотите переместить выбранные элементы в корзину?","Permanently delete":"Полное удаление","Delete permanently":"Удалить безвозвратно","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Вы уверены, что хотите безвозвратно удалить выбранные элементы? Это действие нельзя отменить.",Clear:"Очистить","Clear Trash":"Очистить корзину","Are you sure you want to permanently delete all items from Trash?":"Вы уверены, что хотите безвозвратно удалить все элементы из корзины?","Trash cleared successfully":"Корзина успешно очищена","{{count}} items permanently deleted":"{{count}} элементов безвозвратно удалено","Trash partially cleared":"Корзина частично очищена","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} элементов удалено, {{failed}} не удалось удалить","Failed to clear trash":"Не удалось очистить корзину","Error clearing trash":"Ошибка при очистке корзины","Deleting items...":"Удаление элементов...",delete_files_permanent_one:"Это действие безвозвратно удалит {{count}} файл",delete_files_permanent_few:"Это действие безвозвратно удалит {{count}} файла",delete_files_permanent_many:"Это действие безвозвратно удалит {{count}} файлов",delete_files_permanent_other:"Это действие безвозвратно удалит {{count}} файлов",delete_folder_permanent:"Это действие безвозвратно удалит папку «{{name}}» и всё её содержимое, включая {{count}} элементов.",delete_mixed_permanent:"Это действие безвозвратно удалит {{total}} выбранных элементов, включая {{folders}} папок и все {{images}} изображений внутри них.",permanent_delete_warning:"Удаление файлов, которые были использованы в письмах, приведет к проблемам с отображением картинок в старых письмах. Вы уверены, что хотите полностью удалить выбранное?",move_files_to_trash_one:"Это действие переместит в корзину {{count}} файл.",move_files_to_trash_few:"Это действие переместит в корзину {{count}} файла.",move_files_to_trash_many:"Это действие переместит в корзину {{count}} файлов.",move_files_to_trash_other:"Это действие переместит в корзину {{count}} файлов.",move_folder_to_trash:"Это действие переместит в корзину папку «{{name}}» и всё её содержимое ({{count}} элементов).",move_mixed_to_trash:"Это действие переместит в корзину {{total}} выбранных элементов, включая {{folders}} папок и {{images}} изображений.",delete_count_confirm_trash_one:"Переместить в корзину {{count}} файл?",delete_count_confirm_trash_few:"Переместить в корзину {{count}} файла?",delete_count_confirm_trash_many:"Переместить в корзину {{count}} файлов?",delete_count_confirm_trash_other:"Переместить в корзину {{count}} файлов?",delete_count_confirm_permanent_one:"Удалить навсегда {{count}} файл?",delete_count_confirm_permanent_few:"Удалить навсегда {{count}} файла?",delete_count_confirm_permanent_many:"Удалить навсегда {{count}} файлов?",delete_count_confirm_permanent_other:"Удалить навсегда {{count}} файлов?",delete_count_confirm_one:"Удалить {{count}} файл?",delete_count_confirm_few:"Удалить {{count}} файла?",delete_count_confirm_many:"Удалить {{count}} файлов?",delete_count_confirm_other:"Удалить {{count}} файлов?",item:"файл",items:"файлов",Trash:"Корзина",Choose:"Выбрать",Stock:"Фотосток","Select an image from our library":"Выберите изображение из нашей библиотеки","AI generation":"AI генерация","Creating an image on demand":"Создание изображения по запросу","Search file or folder":"Найти файл или папку","Click here to select a file":"Нажмите здесь, чтобы выбрать файл","Supported files:":"Поддерживаемые файлы:","Create folder":"Создать папку",Done:"Готово","Move here":"Переместить сюда","Copy here":"Копировать сюда","File URL":"URL файла","There's nothing here":"Здесь ничего нет","Try using a different search query.":"Попробуйте использовать другой поисковый запрос.","Millions of free stock images":"Миллионы бесплатных стоковых изображений","Enter a search query and we'll find the perfect image for you":"Введите поисковый запрос, и мы найдем для вас идеальное изображение","Millions of icons":"Миллионы иконок","Lucide icons":"Иконки Lucide","Thousands of icons":"Тысячи иконок","Enter a search query and we'll find the perfect icon for you":"Введите поисковый запрос, и мы найдем для вас идеальную иконку","Enter your query and we will find the right one for you":"Введите запрос и мы найдем для вас подходящее","Over 350,000 live images":"Более 350 000 живых изображений","The folder will be created in the root directory.":"Папка будет создана в корневом каталоге.",undo:"ОТМЕНА",moved_to_trash_one:"Перемещён {{count}} элемент в корзину",moved_to_trash_few:"Перемещено {{count}} элемента в корзину",moved_to_trash_many:"Перемещено {{count}} элементов в корзину",moved_to_trash_other:"Перемещено {{count}} элементов в корзину",restored_items_one:"Восстановлён {{count}} элемент",restored_items_few:"Восстановлено {{count}} элемента",restored_items_many:"Восстановлено {{count}} элементов",restored_items_other:"Восстановлено {{count}} элементов",Type:"Тип","Generate image":"Cгенерировать изображение","A beautiful image of a sunset over a calm ocean.":"Красивое изображение заката над спокойным океаном.","For example:":"Например:",Insert:"Вставить",Error:"Ошибка","Upload progress":"Загрузка {{completed}}/{{total}}","Uploading files":"Загрузка {{completed}}/{{total}} файлов","Uploaded files":"Загружено {{success}} из {{total}} файлов","Upload error files":"Ошибка загрузки {{errorCount}} файлов","Applies to all {{count}} files":"(применительно ко всем {{count}} файлам)","Some files failed to upload":"Некоторые файлы не удалось загрузить. Проверьте размер и формат файлов.",upload_error_hint_invalid_name:"Переименуйте файл: используйте только буквы, цифры, дефис и подчёркивание.",upload_error_hint_size:"Уменьшите размер файла или выберите другой.",upload_error_hint_format:"Используйте допустимый формат: JPG, PNG или GIF.",upload_error_hint_exists:"Файл с таким именем уже есть в папке. Переименуйте файл.","Images generated successfully":"Изображения успешно сгенерированы","Trash is empty":"Корзина пуста","Deleted files will be displayed here":"Здесь будут отображаться удаленные файлы","Stroke width":"Толщина",Style:"Стиль",Color1:"Цвет",Color2:"Цвет 2",Color3:"Цвет 3","Global search":"Глобальный поиск","Family search":"Поиск по семейству","Choose for template":"Выбрать для загрузки в шаблон",Back:"Назад","Editing: {{name}}":"Редактирование: {{name}}","Editing image":"Редактирование изображения",Save:"Сохранить","Loading editor...":"Загрузка редактора…","Error loading image":"Ошибка загрузки изображения","Error saving image":"Ошибка при сохранении изображения","Error initializing editor":"Ошибка инициализации редактора","Close File Manager":"Закрыть файловый менеджер","Are you sure you want to close? Unsaved changes will be lost.":"Вы уверены, что хотите закрыть? Несохраненные изменения будут потеряны.","Are you sure you want to close the file manager?":"Вы уверены, что хотите закрыть файловый менеджер?",Close:"Закрыть",KB:"КБ","No files":"Нет файлов","Folder is empty or files not found":"Папка пуста или файлы не найдены","Search files...":"Поиск файлов...",Success:"Успех","Image updated successfully":"Изображение успешно обновлено","Failed to save changes":"Не удалось сохранить изменения: {{error}}","Unknown error":"Неизвестная ошибка","Select destination folder":"Выберите папку назначения","Error moving":"Ошибка при перемещении","Error deleting":"Ошибка при удалении","Error copying":"Ошибка при копировании","Error renaming":"Ошибка при переименовании","Failed to refresh folder tree":"Не удалось обновить дерево папок","Failed to refresh file list":"Не удалось обновить список файлов","Errors occurred while moving":"При перемещении произошли ошибки","Errors occurred while copying":"При копировании произошли ошибки","(error)":"(ошибка)","(circular reference)":"(циклическая ссылка)","File too large. Maximum size: {{size}}":"Файл слишком большой. Максимальный размер: {{size}}","File too small. Minimum size: {{size}}":"Файл слишком маленький. Минимальный размер: {{size}}","Unsupported file type":"Неподдерживаемый тип файла","Unsupported file type: {{type}}":"Неподдерживаемый тип файла: {{type}}",unknown:"неизвестный","Failed to load files":"Не удалось загрузить файлы","Failed to load files in folder":"Не удалось загрузить содержимое папки «{{folderName}}»","Failed to load subfolders in folder":"Не удалось загрузить подпапки в «{{folderName}}»","Failed to load folder items count in folder":"Не удалось получить число элементов в «{{folderName}}»","DataProvider for folder deletion is not configured":"DataProvider для удаления папок не настроен","DataProvider for file upload is not configured":"DataProvider для загрузки файлов не настроен","Error uploading file {{fileName}}":"Ошибка при загрузке файла {{fileName}}","Error uploading file":"Ошибка при загрузке файла","Cannot upload files to Trash":"Нельзя загружать файлы в корзину","Please fill in all fields":"Заполните все поля","URL too long":"URL слишком длинный","Only http and https URLs are supported":"Поддерживаются только URL с протоколом http и https","Private and local URLs are not allowed":"Локальные и приватные URL запрещены","Upload by URL is not supported":"Загрузка по URL не поддерживается","File name is too long. Maximum {{max}} characters":"Имя файла слишком длинное. Максимум {{max}} символов","File name contains invalid characters":"Имя файла содержит недопустимые символы","Large file may take a long time to upload":"Большой файл может загружаться долго","File unavailable: {{status}} {{statusText}}":"Файл недоступен: {{status}} {{statusText}}","File too large: {{size}}":"Файл слишком большой: {{size}}","Unsupported file type: {{contentType}}":"Неподдерживаемый тип файла: {{contentType}}","Invalid server response: folder ID is missing":"Некорректный ответ от сервера: отсутствует ID папки","Error: folder cannot be its own parent":"Ошибка: папка не может быть родителем самой себя","Upload to Trash is forbidden":"Загрузка в корзину запрещена","renameFolder is not implemented in dataProviders":"renameFolder не реализован в dataProviders","renameFile is not implemented in dataProviders":"renameFile не реализован в dataProviders",Deleted:"Удаленные файлы",Clean:"Очистить","Circular dependency detected: folder cannot be its own parent":"Обнаружена циклическая зависимость: папка не может быть родителем самой себя","Save as copy and choose":"Сохранить как копию и выбрать","Save and choose":"Сохранить и выбрать",pixie:{"added drawing":"Добавление рисунка","added frame":"Добавление рамки","added image":"Добавление изображения","added shape":"Добавление фигуры","added sticker":"Добавление стикера","added text":"Добавление текста","applied filters":"Применение фильтр",apply:"Применить",background:"Фон","background color":"Фоновый цвет",beach:"Пляж","brush color":"Цвет кисти","brush size":"Размер кисти","brush type":"Тип кисти",bubbles:"Пузырьки",Cancel:"Отмена","changed style":"Изменение стиля","Circle Brush":"Круги",close:"Закрыть",color:"Цвет",corners:"Углы",crop:"Обрезать",Custom:"Пользовательский","deleted object":"Удаление объекта","Diamond Brush":"Алмаз",doodles:"Цветные",draw:"Рисунок",emoticons:"Смайлики","Eraser Brush":"Ластик",filter:"Фильтр",font:"Шрифт","font size":"Размер шрифта",frame:"Рамка",gradient:"Градиент",height:"Высота",history:"История","H Line Brush":"Н-образная",image:"Изображение",initial:"Начальный",landmarks:"Достопримечательности","loaded state":"Загрузка состояния","loading canvas":"Загрузка","loading image":"Загрузка","loading state":"Загрузка","maintain aspect ratio":"Maintain aspect ratio",merge:"Объединение","merged objects":"Объединение объектов","new text":"Новая надпись",objects:"Объект",opacity:"Прозрачность",outline:"Контур","outline color":"Цвет контура","Pencil Brush":"Карандаш","processing image":"Загрузка",quality:"Качество",radius:"Радиус","replace image":"Replace Image","replaced background image":"Удаление фонового изображения",resize:"Размер","resized image":"Изменение размера","rounded corner":"Загругление углов",save:"Сохранить",shadow:"Тень","shadow color":"Цвет тени",shapes:"Фигуры","Spray Brush":"Спрей",square:"Квардрат","Square Brush":"Квардрат",stickers:"Стикеры",text:"Надпись",texture:"Текстура",transportation:"Транспорт","V Line Brush":"V-образная",width:"Ширина",grayscale:"Оттенки серого","black & White":"Черно-белый",sharpen:"Резкость",invert:"Инверсия",vintage:"Винтаж",polaroid:"Полароид",kodachrome:"Кодахром",technicolor:"Техниколор",brownie:"Коричневый",sepia:"Сепия","remove Color":"Удалить цвет",brightness:"Яркость",gamma:"Гамма",noise:"Шум",pixelate:"Пиксельизация",blur:"Размытие",emboss:"Тиснение","blend Color":"Смешать цвет",distance:"Расстояние",red:"Красный",green:"Зеленый",blue:"Синий",blocksize:"Размер блока",alpha:"Альфа",add:"Добавить",multiply:"Умножить",subtract:"Вычесть",diff:"Разница",screen:"Экран",lighten:"Осветлить",darken:"Затемнить","select an option...":"Выберите опцию..."}},xi={Files:"Файли",selected:"обрано",Deselected:"Скасувати вибір",Refresh:"Оновити","Select all":"Вибрати все",Rename:"Перейменувати","Rename file":"Перейменувати файл {{currentFileName}}","Select the destination folder":"Виберіть папку призначення","Selected files:":"Обрано файлів:","Selected files":"Обрано файлів: {{count}}",selected_files_one:"Обрано {{count}} файл",selected_files_few:"Обрано {{count}} файли",selected_files_many:"Обрано {{count}} файлів",selected_files_other:"Обрано {{count}} файлів",Copy:"Дублювати",Edit:"Змінити",Move:"Перемістити","Move to":"Перемістити",Delete:"Видалити","New folder":"Нова папка","Image search...":"Пошук зображень...","Search icons":"Знайти іконки","By name":"За назвою","By size":"За розміром","By date":"За датою",List:"Список",Grid:"Плитки",Main:"Головна",Folders:"Папки","total pages":"Всього {{total}} елементів",Name:"Назва",Untitled:"Без назви",Size:"Розмір","Stroke width":"Товщина обведення",Dimensions:"Розмір",Date:"Дата",error:"помилка",Folder:"Папка",created:"створена","Failed to create folder":"Не вдалося створити папку","File deleted":"Файл видалено","Error when deleting a file":"Помилка при видаленні файлу","Folder deleted":"Папку видалено","Error when deleting a folder":"Помилка при видаленні папки","Delete folder":"Видалити папку","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Ви впевнені, що хочете видалити цю папку? Ця дія також видалить усі файли та підпапки.","API-endpoint for file upload is not configured":"API-endpoint для завантаження файлів не налаштовано","Please select an image file":"Будь ласка, виберіть файл зображення",File:"Файл","has been successfully uploaded":"успішно завантажено","The URL must point to an image":"URL повинен вказувати на зображення","Image upload...":"Завантаження зображення...",Unknown:"Невідомо","Error downloading file by URL":"Помилка завантаження файлу за URL","successfully uploaded":"успішно завантажено","Error when downloading a file by URL":"Помилка при завантаженні файлу за URL","Error when uploading a file":"Помилка при завантаженні файлу","Error loading files":"Помилка завантаження файлів","File not found":"Файл не знайдено","File renamed to":"Файл перейменовано на ","Failed to rename the file":"Не вдалося перейменувати файл","Folder renamed to":"Папку перейменовано на","Rename folder":"Перейменувати папку","New folder name":"Нова назва папки","Enter a new folder name":"Введіть нову назву папки","Please drag and drop image files only":"Будь ласка, перетягуйте лише файли зображень","Upload file by URL":"Завантажити файл за URL","Upload file":"Завантажити файл","Creating a new folder":"Створення нової папки",Create:"Створити",Cancel:"Скасувати","Folder name":"Назва папки","Enter the name of the folder":"Введіть назву папки","Enter the name":"Введіть назву","A folder will be created inside:":"Папка буде створена всередині:","selected folder":"обраної папки","The folder will be created in the root directory":"Папка буде створена в кореневому каталозі","Failed to load folders":"Не вдалося завантажити папки","Folder name cannot be empty":"Назва папки не може бути порожньою","Folder creation provider is not configured":"Постачальник створення папок не налаштований","Folder created":"Папку створено","Folder rename is disabled by config":"Перейменування папок вимкнено в налаштуваннях","Folder rename provider is not configured":"Постачальник перейменування папок не налаштований","Unexpected response when renaming folder":"Неочікувана відповідь під час перейменування папки","Folder renamed":"Папку перейменовано","Failed to rename folder":"Не вдалося перейменувати папку","Failed to load folder items count":"Не вдалося отримати кількість елементів у папці","Failed to load subfolders":"Не вдалося завантажити підпапки",Download:"Завантажити","image URL":"URL зображення","Enter the URL of the image":"Введіть URL зображення","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Підтримувані формати: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Нова назва файлу","Enter a new file name":"Введіть нову назву файлу","Copy to folder":"Копіювати в папку",Added:"Додано {{date}}","File uploaded successfully":"Файл {{fileName}} успішно завантажено","Successfully uploaded":"Успішно завантажено {{successCount}} з {{count}} файлу","Successfully uploaded files":"Успішно завантажено {{successCount}} з {{count}} файлів",uploads_success_summary:"Завантажено {{successCount}} з {{totalCount}} файлів",uploads_fail_summary:"Не вдалося завантажити {{failCount}} з {{totalCount}} файлів","File with this name already exists.":"Файл з такою назвою вже існує.","File not found or no longer available.":"Файл не знайдено або його вже видалено.","You don't have permission to access this file.":"У вас немає прав доступу до цього файлу.","File is too large to upload.":"Файл занадто великий для завантаження.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"Файл занадто великий ({{fileSize}}). Дозволений максимальний розмір — {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Перевищено максимальну кількість файлів. Дозволено: {{allowed}}, обрано: {{received}}","This file type is not allowed.":"Цей тип файлу не підтримується.","File name is not valid.":"Неприпустима назва файлу.","File name is not valid. Allowed characters: {{allowedChars}}":"Неприпустима назва файлу. Допустимі символи: {{allowedChars}}","Failed to read the file.":"Не вдалося прочитати файл.","Failed to write the file.":"Не вдалося записати файл.","The file appears to be corrupted.":"Файл пошкоджений або має неправильний формат.","File integrity check failed.":"Перевірка цілісності файлу завершилась невдало.","Folder not found or no longer available.":"Папку не знайдено або її вже видалено.","Folder with this name already exists.":"Папка з такою назвою вже існує.","A folder with that name already exists. Please enter a different folder name.":"Папка з такою назвою вже існує. Введіть інше ім'я папки.","You don't have permission to access this folder.":"У вас немає прав доступу до цієї папки.","Folder name is not valid.":"Неприпустима назва папки.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Не вдалося створити папку. Допустимі символи в назві папки: {{allowedChars}}","Failed to read the folder contents.":"Не вдалося прочитати вміст папки.","Failed to write to the folder.":"Не вдалося виконати операцію з папкою.","Folder storage quota exceeded.":"Перевищено квоту зберігання для папки.","Folder is not empty.":"Папка не порожня.","Server error while processing the folder.":"Помилка сервера під час обробки папки.","Folder operation took too long.":"Операція з папкою зайняла надто багато часу.","Network error. Please check your connection and try again.":"Помилка мережі. Перевірте підключення до інтернету та повторіть спробу.","The operation took too long. Please try again.":"Операція виконувалася надто довго. Спробуйте ще раз.","Server error. Please try again later.":"Помилка на сервері. Повторіть спробу пізніше.","Service is temporarily unavailable. Please try again later.":"Сервіс тимчасово недоступний. Повторіть спробу пізніше.","Too many requests. Please try again a bit later.":"Занадто багато запитів. Спробуйте ще раз пізніше.","Authentication failed. Please sign in again.":"Не вдалося пройти автентифікацію. Будь ласка, увійдіть знову.","You are not allowed to perform this action.":"У вас немає прав для виконання цієї дії.","Some of the provided data is invalid.":"Деякі з переданих даних є некоректними.","This operation is not supported.":"Ця операція не підтримується.","Request payload is too large.":"Тіло запиту занадто велике.","This media type is not supported.":"Цей тип даних не підтримується.","You have exceeded the upload quota.":"Перевищено квоту на завантаження файлів.","Network error while uploading the file.":"Помилка мережі під час завантаження файлу.","File upload took too long.":"Завантаження файлу тривало надто довго.","Server error while uploading the file.":"Помилка сервера під час завантаження файлу.","The specified URL is not valid.":"Вказано некоректну URL-адресу.","The specified URL is not reachable.":"Вказана URL-адреса недоступна.","Content type at the URL is not allowed.":"Тип вмісту за вказаною URL-адресою не підтримується.","Failed to download file from the URL.":"Не вдалося завантажити файл за вказаною URL-адресою.","Network error while downloading the file.":"Помилка мережі під час завантаження файлу.","File download took too long.":"Завантаження файлу тривало надто довго.","Server error while downloading the file.":"Помилка сервера під час завантаження файлу.","Some items could not be processed.":"Не всі елементи були оброблені успішно.","Failed to process all items in the batch.":"Не вдалося обробити жоден елемент у пакетній операції.","Some items in the batch are in a conflicting state.":"Деякі елементи в пакетній операції перебувають у конфліктному стані.","Some items in the batch did not pass validation.":"Деякі елементи в пакетній операції не пройшли валідацію.","AI service returned an invalid response.":"Сервіс ШІ повернув некоректну відповідь.","Failed to generate image using AI.":"Не вдалося створити зображення за допомогою ШІ.","You have reached the AI image generation limit.":"Досягнуто ліміту генерації зображень ШІ.","Error in external integration.":"Помилка у зовнішній інтеграції.","Error in a third-party service.":"Помилка у зовнішньому сервісі.","An unknown error occurred.":"Сталася невідома помилка.","Renaming is not allowed for this item.":"Перейменування не дозволено для цього елемента.","Moving is not allowed for this item.":"Переміщення не дозволено для цього елемента.","Copying is not allowed for this item.":"Копіювання не дозволено для цього елемента.","Deleting is not allowed for this item.":"Видалення не дозволено для цього елемента.","Cannot move an item into itself.":"Не можна перемістити елемент у самого себе.","Cannot move an item into its descendant folder.":"Не можна перемістити елемент у дочірню папку.","Cannot copy an item into itself.":"Не можна скопіювати елемент у самого себе.","Configuration error occurred.":"Сталася помилка конфігурації.","Storage quota exceeded. Please free up space.":"Перевищено квоту сховища. Звільніть місце.","File is locked by another process or user.":"Файл заблоковано іншим процесом або користувачем.","File version conflict. Please refresh and try again.":"Конфлікт версій файлу. Оновіть сторінку та спробуйте ще раз.","Batch operation exceeds the maximum number of items allowed.":"Пакетна операція перевищує максимально допустиму кількість елементів.",Moved:"Переміщено: {{names}}",move_success_summary:"Переміщено {{successCount}} з {{totalCount}} елементів",move_fail_summary:"Не вдалося перемістити {{failCount}} з {{totalCount}} елементів",Copied:"Скопійовано: {{names}}",copy_success_summary:"Скопійовано {{successCount}} з {{totalCount}} елементів",copy_fail_summary:"Не вдалося скопіювати {{failCount}} з {{totalCount}} елементів",Uploaded:"Завантажено: {{names}}",Failed:"Не вдалося завантажити: {{names}}","Failed to upload":"Не вдалося завантажити {{failCount}} з {{count}} файлу","Failed to upload files":"Не вдалося завантажити {{failCount}} з {{count}} файлів",months:{january:"січня",february:"лютого",march:"березня",april:"квітня",may:"травня",june:"червня",july:"липня",august:"серпня",september:"вересня",october:"жовтня",november:"листопада",december:"грудня"},files:"файлів","No available folders":"Немає доступних папок","My files":"Мої файли",GIF:"GIF","Stock images":"Стокові зображення","QR & Barcode":"QR та штрихкод","QR code":"QR-код",Barcode:"Штрихкод","Text or URL":"Текст або посилання","Code color":"Колір коду","Background color":"Колір фону","Add to My files":"Додати в Мої файли","Transparent background":"Прозорий фон","Barcode generation failed":"Не вдалося побудувати штрихкод. Використовуйте символи, підтримувані CODE128.","Validation error":"Помилка валідації","Enter text or URL to preview":"Введіть текст або URL для попереднього перегляду.",Preview:"Попередній перегляд","QR transparent background hint":"Прозорий PNG може зливатися з темною темою листа; білий фон частіше надійніший для сканерів.","QR image size px":"Розмір QR","Barcode bar height px":"Висота штрихів",AI:"AI","AI image generation":"AI генерація зображень","Search GIFs":"Знайти GIF","That`s all we could find.":"Це все, що ми змогли знайти.","Search image":"Знайти зображення",All:"Всі",Landscape:"Горизонтальні",Portrait:"Вертикальні",Squarish:"Квадратні",Black:"Чорний","Black and White":"Чорно-білий",White:"Білий",Orange:"Помаранчевий",Red:"Червоний",Purple:"Фіолетовий",Magenta:"Пурпурний",Green:"Зелений",Teal:"Бірюзовий",Blue:"Синій","Photo by":"Фото",on:"на","File Manager":"Файловий менеджер","File Manager not configured":"Файловий менеджер не налаштовано","Filter by type":"Фільтр за типом","All types":"Всі типи","File name":"Назва файлу",Actions:"Дії","Add file":"Додати файл","Add folder":"Додати папку","Add file by URL":"Додати файл за URL","File moved":"Файл переміщено","Error when moving a file":"Помилка при переміщенні файлу","Failed to download file":"Не вдалося завантажити файл","Failed to load JSON data":"Не вдалося завантажити дані JSON","Invalid file URL":"Некоректний URL файлу","Unable to validate file URL":"Не вдалося перевірити файл за URL","Type to search...":"Введіть для пошуку...",Submit:"Надіслати","No folders yet":"Папок поки немає","Drag files to upload":"Перетягніть файли для завантаження","Drop files here to upload":"Відпустіть файли тут, щоб завантажити їх","Newest first":"Спочатку нові","Oldest first":"Спочатку старі","Largest first":"Спочатку великі","Smallest first":"Спочатку маленькі","A-Z":"За алфавітом А-Я","Z-A":"За алфавітом Я-А","By type":"За типом","Evaluating the task":"Оцінка завдання","Something went wrong, please try again":"Щось пішло не так, будь ласка, спробуйте ще раз","Sort by":"Сортувати за","preview text":"Зображення завантажується ...","Use this variant":"Використати цей варіант","Confirm deletion":"Підтвердити видалення","Are you sure you want to delete the selected items?":"Ви впевнені, що хочете видалити обрані елементи?","Move to Trash":"Перемістити в кошик","Are you sure you want to move the selected items to the Trash?":"Ви впевнені, що хочете перемістити обрані елементи в кошик?","Permanently delete":"Повне видалення","Delete permanently":"Видалити безповоротно","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Ви впевнені, що хочете безповоротно видалити обрані елементи? Цю дію не можна скасувати.",Clear:"Очистити","Clear Trash":"Очистити кошик","Are you sure you want to permanently delete all items from Trash?":"Ви впевнені, що хочете безповоротно видалити всі елементи з кошика?","Trash cleared successfully":"Кошик успішно очищено","{{count}} items permanently deleted":"{{count}} елементів безповоротно видалено","Trash partially cleared":"Кошик частково очищено","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} елементів видалено, {{failed}} не вдалося видалити","Failed to clear trash":"Не вдалося очистити кошик","Error clearing trash":"Помилка при очищенні кошика","Deleting items...":"Видалення елементів...",delete_files_permanent_one:"Ця дія безповоротно видалить {{count}} файл",delete_files_permanent_few:"Ця дія безповоротно видалить {{count}} файли",delete_files_permanent_many:"Ця дія безповоротно видалить {{count}} файлів",delete_files_permanent_other:"Ця дія безповоротно видалить {{count}} файлів",delete_folder_permanent:"Ця дія безповоротно видалить папку «{{name}}» і все її вміст, включаючи {{count}} елементів.",delete_mixed_permanent:"Ця дія безповоротно видалить {{total}} обраних елементів, включаючи {{folders}} папок і всі {{images}} зображень всередині них.",permanent_delete_warning:"Видалення файлів, які були використані в листах, призведе до проблем з відображенням зображень у старих листах. Ви впевнені, що хочете повністю видалити обране?",move_files_to_trash_one:"Ця дія перемістить у кошик {{count}} файл.",move_files_to_trash_few:"Ця дія перемістить у кошик {{count}} файли.",move_files_to_trash_many:"Ця дія перемістить у кошик {{count}} файлів.",move_files_to_trash_other:"Ця дія перемістить у кошик {{count}} файлів.",move_folder_to_trash:"Ця дія перемістить у кошик папку «{{name}}» і все її вміст ({{count}} елементів).",move_mixed_to_trash:"Ця дія перемістить у кошик {{total}} обраних елементів, включаючи {{folders}} папок і {{images}} зображень.",delete_count_confirm_trash_one:"Перемістити в кошик {{count}} файл?",delete_count_confirm_trash_few:"Перемістити в кошик {{count}} файли?",delete_count_confirm_trash_many:"Перемістити в кошик {{count}} файлів?",delete_count_confirm_trash_other:"Перемістити в кошик {{count}} файлів?",delete_count_confirm_permanent_one:"Видалити назавжди {{count}} файл?",delete_count_confirm_permanent_few:"Видалити назавжди {{count}} файли?",delete_count_confirm_permanent_many:"Видалити назавжди {{count}} файлів?",delete_count_confirm_permanent_other:"Видалити назавжди {{count}} файлів?",delete_count_confirm_one:"Видалити {{count}} файл?",delete_count_confirm_few:"Видалити {{count}} файли?",delete_count_confirm_many:"Видалити {{count}} файлів?",delete_count_confirm_other:"Видалити {{count}} файлів?",item:"файл",items:"файлів",Trash:"Видалені",Choose:"Обрати",Stock:"Фотосток","Select an image from our library":"Виберіть зображення з нашої бібліотеки","AI generation":"AI генерація","Creating an image on demand":"Створення зображення на замовлення","Search file or folder":"Знайти файл або папку","Click here to select a file":"Натисніть тут, щоб вибрати файл","Supported files:":"Підтримувані файли:","Create folder":"Створити папку",Done:"Готово","Move here":"Перемістити сюди","Copy here":"Копіювати сюди","File URL":"URL файлу","There's nothing here":"Тут нічого немає","Try using a different search query.":"Спробуйте використовувати інший пошуковий запит.","Millions of free stock images":"Мільйони безкоштовних стокових зображень","Enter a search query and we'll find the perfect image for you":"Введіть пошуковий запит, і ми знайдемо для вас ідеальне зображення","Millions of icons":"Мільйони іконок","Lucide icons":"Іконки Lucide","Thousands of icons":"Тисячі іконок","Enter a search query and we'll find the perfect icon for you":"Введіть пошуковий запит, і ми знайдемо для вас ідеальну іконку","Enter your query and we will find the right one for you":"Введіть запит і ми знайдемо для вас відповідне","Over 350,000 live images":"Понад 350 000 живих зображень","The folder will be created in the root directory.":"Папка буде створена в кореневому каталозі.",undo:"СКАСУВАТИ",moved_to_trash_one:"Переміщено {{count}} елемент у кошик",moved_to_trash_few:"Переміщено {{count}} елементи у кошик",moved_to_trash_many:"Переміщено {{count}} елементів у кошик",moved_to_trash_other:"Переміщено {{count}} елементів у кошик",restored_items_one:"Відновлено {{count}} елемент",restored_items_few:"Відновлено {{count}} елементи",restored_items_many:"Відновлено {{count}} елементів",restored_items_other:"Відновлено {{count}} елементів",Type:"Тип","Generate image":"Створити зображення","A beautiful image of a sunset over a calm ocean.":"Красиве зображення заходу сонця над спокійним океаном.","For example:":"Наприклад:",Insert:"Вставити",Error:"Помилка","Upload progress":"Завантаження {{completed}}/{{total}}","Uploading files":"Завантаження {{completed}}/{{total}} файлів","Uploaded files":"Завантажено {{success}} з {{total}} файлів","Upload error files":"Помилка завантаження {{errorCount}} файлів","Applies to all {{count}} files":"(стосується всіх {{count}} файлів)","Some files failed to upload":"Деякі файли не вдалося завантажити. Перевірте розмір та формат файлів.",upload_error_hint_invalid_name:"Перейменуйте файл: використовуйте лише літери, цифри, дефіс та підкреслення.",upload_error_hint_size:"Зменшіть розмір файлу або оберіть інший.",upload_error_hint_format:"Оберіть дозволений формат: JPG, PNG або GIF.",upload_error_hint_exists:"Файл з такою назвою вже є в папці. Перейменуйте файл.","Images generated successfully":"Зображення успішно створено","Choose for template":"Вибрати для завантаження в шаблон","Trash is empty":"Кошик порожній","Deleted files will be displayed here":"Тут будуть відображатися видалені файли","Editing: {{name}}":"Редагування: {{name}}","Editing image":"Редагування зображення",Save:"Зберегти","Loading editor...":"Завантаження редактора…","Error loading image":"Помилка завантаження зображення","Error saving image":"Помилка при збереженні зображення","Error initializing editor":"Помилка ініціалізації редактора","Close File Manager":"Закрити файловий менеджер","Are you sure you want to close? Unsaved changes will be lost.":"Ви впевнені, що хочете закрити? Незбережені зміни будуть втрачені.","Are you sure you want to close the file manager?":"Ви впевнені, що хочете закрити файловий менеджер?",Close:"Закрити",KB:"КБ","No files":"Немає файлів","Folder is empty or files not found":"Папка порожня або файли не знайдені","Search files...":"Пошук файлів...",Success:"Успіх","Image updated successfully":"Зображення успішно оновлено","Failed to save changes":"Не вдалося зберегти зміни: {{error}}","Unknown error":"Невідома помилка","Select destination folder":"Виберіть папку призначення","Error moving":"Помилка при переміщенні","Error deleting":"Помилка при видаленні","Error copying":"Помилка при копіюванні","Error renaming":"Помилка при перейменуванні","Failed to refresh folder tree":"Не вдалося оновити дерево папок","Failed to refresh file list":"Не вдалося оновити список файлів","Errors occurred while moving":"Під час переміщення виникли помилки","Errors occurred while copying":"Під час копіювання виникли помилки","(error)":"(помилка)","(circular reference)":"(циклічне посилання)","File too large. Maximum size: {{size}}":"Файл занадто великий. Максимальний розмір: {{size}}","File too small. Minimum size: {{size}}":"Файл занадто маленький. Мінімальний розмір: {{size}}","Unsupported file type":"Непідтримуваний тип файлу","Unsupported file type: {{type}}":"Непідтримуваний тип файлу: {{type}}",unknown:"невідомий","Failed to load files":"Не вдалося завантажити файли","Failed to load files in folder":"Не вдалося завантажити вміст папки «{{folderName}}»","Failed to load subfolders in folder":"Не вдалося завантажити підпапки в «{{folderName}}»","Failed to load folder items count in folder":"Не вдалося отримати кількість елементів у «{{folderName}}»","DataProvider for folder deletion is not configured":"DataProvider для видалення папок не налаштовано","DataProvider for file upload is not configured":"DataProvider для завантаження файлів не налаштовано","Error uploading file {{fileName}}":"Помилка при завантаженні файлу {{fileName}}","Error uploading file":"Помилка при завантаженні файлу","Cannot upload files to Trash":"Не можна завантажувати файли в кошик","Please fill in all fields":"Заповніть усі поля","URL too long":"URL занадто довгий","Only http and https URLs are supported":"Підтримуються лише URL з протоколом http та https","Private and local URLs are not allowed":"Локальні та приватні URL заборонені","Upload by URL is not supported":"Завантаження за URL не підтримується","File name is too long. Maximum {{max}} characters":"Ім'я файлу занадто довге. Максимум {{max}} символів","File name contains invalid characters":"Ім'я файлу містить неприпустимі символи","Large file may take a long time to upload":"Великий файл може завантажуватися довго","File unavailable: {{status}} {{statusText}}":"Файл недоступний: {{status}} {{statusText}}","File too large: {{size}}":"Файл занадто великий: {{size}}","Unsupported file type: {{contentType}}":"Непідтримуваний тип файлу: {{contentType}}","Invalid server response: folder ID is missing":"Некорректна відповідь сервера: відсутній ID папки","Error: folder cannot be its own parent":"Помилка: папка не може бути батьком самої себе","Upload to Trash is forbidden":"Завантаження в кошик заборонено","renameFolder is not implemented in dataProviders":"renameFolder не реалізовано в dataProviders","renameFile is not implemented in dataProviders":"renameFile не реалізовано в dataProviders",Clean:"Очистити","Circular dependency detected: folder cannot be its own parent":"Виявлено циклічну залежність: папка не може бути батьком самої себе","Save as copy and choose":"Зберегти як копію і вибрати","Save and choose":"Зберегти і вибрати",pixie:{"added drawing":"Додавання малюнка","added frame":"Додавання рамки","added image":"Додавання зображення","added shape":"Додавання фігури","added sticker":"Додавання стікера","added text":"Додавання тексту","applied filters":"Застосування фільтр",apply:"Застосувати",background:"Фон","background color":"Фоновий колір",beach:"Пляж","brush color":"Колір кисті","brush size":"Розмір кисті","brush type":"Тип кисті",bubbles:"Пузирці",Cancel:"Скасувати","changed style":"Зміна стилю","Circle Brush":"Кола",close:"Закрити",color:"Колір",corners:"Кути",crop:"Обрізати",Custom:"Користувацький","deleted object":"Видалення об'єкта","Diamond Brush":"Алмаз",doodles:"Кольорові",draw:"Малюнок",emoticons:"Смайлики","Eraser Brush":"Гумка",filter:"Фільтр",font:"Шрифт","font size":"Розмір шрифту",frame:"Рамка",gradient:"Градієнт",height:"Висота",history:"Історія","H Line Brush":"Н-подібна",image:"Зображення",initial:"Початковий",landmarks:"Пам'ятки","loaded state":"Завантаження стану","loading canvas":"Завантаження","loading image":"Завантаження","loading state":"Завантаження","maintain aspect ratio":"Maintain aspect ratio",merge:"Об'єднання","merged objects":"Об'єднання об'єктів","new text":"Новий напис",objects:"Об'єкт",opacity:"Прозорість",outline:"Контур","outline color":"Колір контуру","Pencil Brush":"Олівець","processing image":"Завантаження",quality:"Якість",radius:"Радіус","replace image":"Replace Image","replaced background image":"Видалення фонового зображення",resize:"Розмір","resized image":"Зміна розміру","rounded corner":"Заокруглення кутів",save:"Зберегти",shadow:"Тінь","shadow color":"Колір тіні",shapes:"Фігури","Spray Brush":"Спрей",square:"Квадрат","Square Brush":"Квадрат",stickers:"Стікери",text:"Напис",texture:"Текстура",transportation:"Транспорт","V Line Brush":"V-подібна",width:"Ширина",grayscale:"Відтінки сірого","black & White":"Чорно-білий",sharpen:"Різкість",invert:"Інверсія",vintage:"Вінтаж",polaroid:"Полароїд",kodachrome:"Кодахром",technicolor:"Техніколор",brownie:"Коричневий",sepia:"Сепія","remove Color":"Видалити колір",brightness:"Яскравість",gamma:"Гамма",noise:"Шум",pixelate:"Пікселізація",blur:"Розмиття",emboss:"Тиснення","blend Color":"Змішати колір",distance:"Відстань",red:"Червоний",green:"Зелений",blue:"Синій",blocksize:"Розмір блоку",alpha:"Альфа",add:"Додати",multiply:"Помножити",subtract:"Відняти",diff:"Різниця",screen:"Екран",lighten:"Освітлити",darken:"Затемнити","select an option...":"Виберіть опцію..."}},Ci={Files:"Arquivos",selected:"selecionado(s)",Deselected:"Desmarcar",Refresh:"Atualizar","Select all":"Selecionar tudo",Rename:"Renomear","Rename file":"Renomear arquivo {{currentFileName}}","Select the destination folder":"Selecionar a pasta de destino","Selected files:":"Arquivos selecionados:","Selected files":"Arquivos selecionados: {{count}}",selected_files_one:"{{count}} arquivo selecionado",selected_files_few:"{{count}} arquivos selecionados",selected_files_many:"{{count}} arquivos selecionados",selected_files_other:"{{count}} arquivos selecionados",Copy:"Duplicar",Edit:"Editar",Move:"Mover","Move to":"Mover para",Delete:"Excluir","New folder":"Nova pasta","Image search...":"Busca de imagens...","Search icons":"Encontrar ícones","By name":"Por nome","By size":"Por tamanho","By date":"Por data",List:"Lista",Grid:"Grade",Main:"Principal",Folders:"Pastas","total pages":"Total de {{total}} itens",Name:"Nome",Untitled:"Sem título",Size:"Tamanho","Stroke width":"Espessura do traço",Dimensions:"Dimensões",Date:"Data",error:"erro",Folder:"Pasta",created:"criada","Failed to create folder":"Falha ao criar pasta","File deleted":"Arquivo excluído","Error when deleting a file":"Erro ao excluir arquivo","Folder deleted":"Pasta excluída","Error when deleting a folder":"Erro ao excluir pasta","Delete folder":"Excluir pasta","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Tem certeza que deseja excluir esta pasta? Esta ação também excluirá todos os arquivos e subpastas.","API-endpoint for file upload is not configured":"Endpoint da API para upload de arquivos não está configurado","Please select an image file":"Por favor, selecione um arquivo de imagem",File:"Arquivo","has been successfully uploaded":"foi carregado com sucesso","The URL must point to an image":"A URL deve apontar para uma imagem","Image upload...":"Carregando imagem...",Unknown:"Desconhecido","Error downloading file by URL":"Erro ao baixar arquivo por URL","successfully uploaded":"carregado com sucesso","Error when downloading a file by URL":"Erro ao baixar arquivo por URL","Error when uploading a file":"Erro ao enviar arquivo","Error loading files":"Erro ao carregar arquivos","File not found":"Arquivo não encontrado","File renamed to":"Arquivo renomeado para","Failed to rename the file":"Falha ao renomear o arquivo","Folder renamed to":"Pasta renomeada para","Rename folder":"Renomear pasta","New folder name":"Novo nome da pasta","Enter a new folder name":"Digite um novo nome para a pasta","Please drag and drop image files only":"Por favor, arraste e solte apenas arquivos de imagem","Upload file by URL":"Carregar arquivo por URL","Upload file":"Carregar arquivo","Creating a new folder":"Criando uma nova pasta",Create:"Criar",Cancel:"Cancelar","Folder name":"Nome da pasta","Enter the name of the folder":"Digite o nome da pasta","Enter the name":"Digite o nome","A folder will be created inside:":"A pasta será criada dentro de:","selected folder":"pasta selecionada","The folder will be created in the root directory":"A pasta será criada no diretório raiz","Failed to load folders":"Não foi possível carregar as pastas","Folder name cannot be empty":"O nome da pasta não pode estar vazio","Folder creation provider is not configured":"O provedor de criação de pastas não está configurado","Folder created":"Pasta criada","Folder rename is disabled by config":"Renomear pastas está desabilitado pela configuração","Folder rename provider is not configured":"O provedor de renomeação de pastas não está configurado","Unexpected response when renaming folder":"Resposta inesperada ao renomear a pasta","Folder renamed":"Pasta renomeada","Failed to rename folder":"Não foi possível renomear a pasta","Failed to load folder items count":"Não foi possível obter a contagem de itens da pasta","Failed to load subfolders":"Não foi possível carregar as subpastas",Download:"Baixar","image URL":"URL da imagem","Enter the URL of the image":"Digite a URL da imagem","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Formatos suportados: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Novo nome do arquivo","Enter a new file name":"Digite um novo nome para o arquivo","Copy to folder":"Copiar para pasta",Added:"Adicionado em {{date}}","File uploaded successfully":"Arquivo {{fileName}} carregado com sucesso","Successfully uploaded":"{{successCount}} de {{count}} arquivo carregado com sucesso","Successfully uploaded files":"{{successCount}} de {{count}} arquivos carregados com sucesso",uploads_success_summary:"Enviados {{successCount}} de {{totalCount}} arquivos",uploads_fail_summary:"Falhou ao enviar {{failCount}} de {{totalCount}} arquivos","File with this name already exists.":"Já existe um arquivo com esse nome.","File not found or no longer available.":"O arquivo não foi encontrado ou já foi excluído.","You don't have permission to access this file.":"Você não tem permissão para acessar este arquivo.","File is too large to upload.":"O arquivo é grande demais para ser enviado.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"O arquivo é grande demais ({{fileSize}}). Tamanho máximo permitido: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Número máximo de arquivos excedido. Permitido: {{allowed}}, recebido: {{received}}","This file type is not allowed.":"Este tipo de arquivo não é permitido.","File name is not valid.":"O nome do arquivo não é válido.","File name is not valid. Allowed characters: {{allowedChars}}":"O nome do arquivo não é válido. Caracteres permitidos: {{allowedChars}}","Failed to read the file.":"Não foi possível ler o arquivo.","Failed to write the file.":"Não foi possível gravar o arquivo.","The file appears to be corrupted.":"O arquivo parece estar corrompido.","File integrity check failed.":"A verificação de integridade do arquivo falhou.","Folder not found or no longer available.":"A pasta não foi encontrada ou já foi excluída.","Folder with this name already exists.":"Já existe uma pasta com esse nome.","A folder with that name already exists. Please enter a different folder name.":"Já existe uma pasta com esse nome. Digite um nome diferente para a pasta.","You don't have permission to access this folder.":"Você não tem permissão para acessar esta pasta.","Folder name is not valid.":"O nome da pasta não é válido.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Não foi possível criar a pasta. Caracteres permitidos no nome: {{allowedChars}}","Failed to read the folder contents.":"Não foi possível ler o conteúdo da pasta.","Failed to write to the folder.":"Não foi possível gravar na pasta.","Folder storage quota exceeded.":"A cota de armazenamento da pasta foi excedida.","Folder is not empty.":"A pasta não está vazia.","Server error while processing the folder.":"Erro do servidor ao processar a pasta.","Folder operation took too long.":"A operação com a pasta demorou demais.","Network error. Please check your connection and try again.":"Erro de rede. Verifique sua conexão e tente novamente.","The operation took too long. Please try again.":"A operação demorou demais. Tente novamente.","Server error. Please try again later.":"Erro no servidor. Tente novamente mais tarde.","Service is temporarily unavailable. Please try again later.":"O serviço está temporariamente indisponível. Tente novamente mais tarde.","Too many requests. Please try again a bit later.":"Muitas solicitações. Tente novamente mais tarde.","Authentication failed. Please sign in again.":"Falha na autenticação. Faça login novamente.","You are not allowed to perform this action.":"Você não tem permissão para executar esta ação.","Some of the provided data is invalid.":"Alguns dos dados fornecidos são inválidos.","This operation is not supported.":"Esta operação não é suportada.","Request payload is too large.":"O corpo da requisição é grande demais.","This media type is not supported.":"Este tipo de mídia não é suportado.","You have exceeded the upload quota.":"Você excedeu a cota de upload de arquivos.","Network error while uploading the file.":"Erro de rede ao enviar o arquivo.","File upload took too long.":"O envio do arquivo demorou demais.","Server error while uploading the file.":"Erro do servidor ao enviar o arquivo.","The specified URL is not valid.":"A URL especificada não é válida.","The specified URL is not reachable.":"A URL especificada não está acessível.","Content type at the URL is not allowed.":"O tipo de conteúdo na URL não é permitido.","Failed to download file from the URL.":"Não foi possível baixar o arquivo da URL.","Network error while downloading the file.":"Erro de rede ao baixar o arquivo.","File download took too long.":"O download do arquivo demorou demais.","Server error while downloading the file.":"Erro do servidor ao baixar o arquivo.","Some items could not be processed.":"Nem todos os itens foram processados com sucesso.","Failed to process all items in the batch.":"Nenhum item do lote pôde ser processado.","Some items in the batch are in a conflicting state.":"Alguns itens do lote estão em estado de conflito.","Some items in the batch did not pass validation.":"Alguns itens do lote não passaram na validação.","AI service returned an invalid response.":"O serviço de IA retornou uma resposta inválida.","Failed to generate image using AI.":"Falha ao gerar imagem usando IA.","You have reached the AI image generation limit.":"Você atingiu o limite de geração de imagens por IA.","Error in external integration.":"Erro em uma integração externa.","Error in a third-party service.":"Erro em um serviço de terceiros.","An unknown error occurred.":"Ocorreu um erro desconhecido.","Renaming is not allowed for this item.":"Renomear não é permitido para este item.","Moving is not allowed for this item.":"Mover não é permitido para este item.","Copying is not allowed for this item.":"Copiar não é permitido para este item.","Deleting is not allowed for this item.":"Excluir não é permitido para este item.","Cannot move an item into itself.":"Não é possível mover um item para dentro de si mesmo.","Cannot move an item into its descendant folder.":"Não é possível mover um item para sua pasta descendente.","Cannot copy an item into itself.":"Não é possível copiar um item para dentro de si mesmo.","Configuration error occurred.":"Ocorreu um erro de configuração.","Storage quota exceeded. Please free up space.":"Cota de armazenamento excedida. Libere espaço.","File is locked by another process or user.":"O arquivo está bloqueado por outro processo ou usuário.","File version conflict. Please refresh and try again.":"Conflito de versão do arquivo. Atualize a página e tente novamente.","Batch operation exceeds the maximum number of items allowed.":"A operação em lote excede o número máximo de itens permitidos.",Moved:"Movidos: {{names}}",move_success_summary:"Movidos {{successCount}} de {{totalCount}} itens",move_fail_summary:"Falhou ao mover {{failCount}} de {{totalCount}} itens",Copied:"Copiados: {{names}}",copy_success_summary:"Copiados {{successCount}} de {{totalCount}} itens",copy_fail_summary:"Falhou ao copiar {{failCount}} de {{totalCount}} itens",Uploaded:"Arquivos enviados: {{names}}",Failed:"Falha ao enviar: {{names}}","Failed to upload":"Falha ao carregar {{failCount}} de {{count}} arquivo","Failed to upload files":"Falha ao carregar {{failCount}} de {{count}} arquivos",months:{january:"janeiro",february:"fevereiro",march:"março",april:"abril",may:"maio",june:"junho",july:"julho",august:"agosto",september:"setembro",october:"outubro",november:"novembro",december:"dezembro"},files:"arquivos","No available folders":"Nenhuma pasta disponível","My files":"Meus arquivos",GIF:"GIF","Stock images":"Imagens de stock","QR & Barcode":"QR e código de barras","QR code":"Código QR",Barcode:"Código de barras","Text or URL":"Texto ou URL","Code color":"Cor do código","Background color":"Cor de fundo","Add to My files":"Adicionar aos Meus arquivos","Transparent background":"Fundo transparente","Barcode generation failed":"Não foi possível gerar o código de barras. Use caracteres compatíveis com CODE128.","Validation error":"Erro de validação","Enter text or URL to preview":"Digite texto ou um URL para pré-visualizar.",Preview:"Pré-visualização","QR transparent background hint":"PNG transparente pode se misturar a temas escuros do e-mail; fundo branco costuma ser mais confiável para leitores.","QR image size px":"Tamanho do QR","Barcode bar height px":"Altura das barras",AI:"IA","AI image generation":"Geração de imagens por IA","Search GIFs":"Buscar GIFs","That`s all we could find.":"Isso é tudo que conseguimos encontrar.","Search image":"Buscar imagem",All:"Todos",Landscape:"Paisagem",Portrait:"Retrato",Squarish:"Quadrados",Black:"Preto","Black and White":"Preto e branco",White:"Branco",Orange:"Laranja",Red:"Vermelho",Purple:"Roxo",Magenta:"Magenta",Green:"Verde",Teal:"Verde-azulado",Blue:"Azul","Photo by":"Foto por",on:"em","File Manager":"Gerenciador de arquivos","File Manager not configured":"Gerenciador de arquivos não configurado","Filter by type":"Filtrar por tipo","All types":"Todos os tipos","File name":"Nome do arquivo",Actions:"Ações","Add file":"Adicionar arquivo","Add folder":"Adicionar pasta","Add file by URL":"Adicionar arquivo por URL","File moved":"Arquivo movido","Error when moving a file":"Erro ao mover arquivo","Failed to download file":"Não foi possível baixar o arquivo","Failed to load JSON data":"Não foi possível carregar os dados JSON","Invalid file URL":"URL de arquivo inválida","Unable to validate file URL":"Não foi possível validar a URL do arquivo","Type to search...":"Digite para buscar...",Submit:"Enviar","No folders yet":"Nenhuma pasta ainda","Drag files to upload":"Arraste arquivos para carregar","Drop files here to upload":"Solte os arquivos aqui para carregá-los","Newest first":"Mais recentes primeiro","Oldest first":"Mais antigos primeiro","Largest first":"Maiores primeiro","Smallest first":"Menores primeiro","A-Z":"A-Z","Z-A":"Z-A","By type":"Por tipo","Evaluating the task":"Avaliando a tarefa","Something went wrong, please try again":"Algo deu errado, por favor tente novamente","Sort by":"Ordenar por","preview text":"Carregando imagem...","Use this variant":"Usar esta variante","Confirm deletion":"Confirmar exclusão","Are you sure you want to delete the selected items?":"Tem certeza que deseja excluir os itens selecionados?","Move to Trash":"Mover para lixeira","Are you sure you want to move the selected items to the Trash?":"Tem certeza que deseja mover os itens selecionados para a lixeira?","Permanently delete":"Exclusão permanente","Delete permanently":"Excluir permanentemente","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Tem certeza que deseja excluir permanentemente os itens selecionados? Esta ação não pode ser desfeita.",Clear:"Limpar","Clear Trash":"Limpar lixeira","Are you sure you want to permanently delete all items from Trash?":"Tem certeza que deseja excluir permanentemente todos os itens da lixeira?","Trash cleared successfully":"Lixeira limpa com sucesso","{{count}} items permanently deleted":"{{count}} itens excluídos permanentemente","Trash partially cleared":"Lixeira parcialmente limpa","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} itens excluídos, {{failed}} falharam","Failed to clear trash":"Falha ao limpar lixeira","Error clearing trash":"Erro ao limpar lixeira","Deleting items...":"Excluindo itens...",delete_files_permanent_one:"Esta ação excluirá permanentemente {{count}} arquivo",delete_files_permanent_few:"Esta ação excluirá permanentemente {{count}} arquivos",delete_files_permanent_many:"Esta ação excluirá permanentemente {{count}} arquivos",delete_files_permanent_other:"Esta ação excluirá permanentemente {{count}} arquivos",delete_folder_permanent:"Esta ação excluirá permanentemente a pasta «{{name}}» e todo seu conteúdo, incluindo {{count}} itens.",delete_mixed_permanent:"Esta ação excluirá permanentemente {{total}} itens selecionados, incluindo {{folders}} pastas e todas as {{images}} imagens dentro delas.",permanent_delete_warning:"Excluir arquivos que foram usados em e-mails causará problemas na exibição de imagens em e-mails antigos. Tem certeza de que deseja excluir permanentemente a seleção?",move_files_to_trash_one:"Esta ação moverá {{count}} arquivo para a lixeira.",move_files_to_trash_few:"Esta ação moverá {{count}} arquivos para a lixeira.",move_files_to_trash_many:"Esta ação moverá {{count}} arquivos para a lixeira.",move_files_to_trash_other:"Esta ação moverá {{count}} arquivos para a lixeira.",move_folder_to_trash:"Esta ação moverá a pasta «{{name}}» e todo seu conteúdo ({{count}} itens) para a lixeira.",move_mixed_to_trash:"Esta ação moverá {{total}} itens selecionados para a lixeira, incluindo {{folders}} pastas e {{images}} imagens.",delete_count_confirm_trash_one:"Mover {{count}} arquivo para a lixeira?",delete_count_confirm_trash_few:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_trash_many:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_trash_other:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_permanent_one:"Excluir permanentemente {{count}} arquivo?",delete_count_confirm_permanent_few:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_permanent_many:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_permanent_other:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_one:"Excluir {{count}} arquivo?",delete_count_confirm_few:"Excluir {{count}} arquivos?",delete_count_confirm_many:"Excluir {{count}} arquivos?",delete_count_confirm_other:"Excluir {{count}} arquivos?",item:"arquivo",items:"arquivos",Trash:"Lixeira",Choose:"Escolher",Stock:"Banco de imagens","Select an image from our library":"Selecione uma imagem da nossa biblioteca","AI generation":"Geração por IA","Creating an image on demand":"Criando uma imagem sob demanda","Search file or folder":"Buscar arquivo ou pasta","Click here to select a file":"Clique aqui para selecionar um arquivo","Supported files:":"Arquivos suportados:","Create folder":"Criar pasta",Done:"Concluído","Move here":"Mover aqui","Copy here":"Copiar aqui","File URL":"URL do arquivo","There's nothing here":"Não há nada aqui","Try using a different search query.":"Tente usar uma consulta de pesquisa diferente.","Millions of free stock images":"Milhões de imagens de stock gratuitas","Enter a search query and we'll find the perfect image for you":"Digite uma consulta de busca e encontraremos a imagem perfeita para você","Millions of icons":"Milhões de ícones","Lucide icons":"Ícones Lucide","Thousands of icons":"Milhares de ícones","Enter a search query and we'll find the perfect icon for you":"Digite uma consulta de busca e encontraremos o ícone perfeito para você","Enter your query and we will find the right one for you":"Digite sua consulta e nós encontraremos a ideal para você","Over 350,000 live images":"Mais de 350.000 imagens ao vivo","The folder will be created in the root directory.":"A pasta será criada no diretório raiz.",undo:"DESFAZER",moved_to_trash_one:"{{count}} item movido para a lixeira",moved_to_trash_few:"{{count}} itens movidos para a lixeira",moved_to_trash_many:"{{count}} itens movidos para a lixeira",moved_to_trash_other:"{{count}} itens movidos para a lixeira",restored_items_one:"{{count}} item restaurado",restored_items_few:"{{count}} itens restaurados",restored_items_many:"{{count}} itens restaurados",restored_items_other:"{{count}} itens restaurados",Type:"Tipo","Generate image":"Gerar imagem","A beautiful image of a sunset over a calm ocean.":"Uma imagem bonita de um pôr do sol sobre um oceano tranquilo.","For example:":"Por exemplo:",Insert:"Inserir",Error:"Erro","Upload progress":"Enviando {{completed}}/{{total}}","Uploading files":"Enviando {{completed}}/{{total}} arquivos","Uploaded files":"Enviados {{success}} de {{total}} arquivos","Upload error files":"Erro ao enviar {{errorCount}} arquivos","Applies to all {{count}} files":"(aplica-se a todos os {{count}} arquivos)","Some files failed to upload":"Alguns arquivos não puderam ser enviados. Verifique o tamanho e o formato dos arquivos.",upload_error_hint_invalid_name:"Renomeie o arquivo: use apenas letras, números, hífens e sublinhados.",upload_error_hint_size:"Reduza o tamanho do arquivo ou escolha outro.",upload_error_hint_format:"Use um formato permitido: JPG, PNG ou GIF.",upload_error_hint_exists:"Já existe um arquivo com este nome na pasta. Renomeie o arquivo.","Images generated successfully":"Imagens geradas com sucesso","Choose for template":"Selecionar para carregar no modelo","Trash is empty":"A lixeira está vazia","Deleted files will be displayed here":"Os arquivos excluídos serão exibidos aqui","Editing: {{name}}":"Editando: {{name}}","Editing image":"Editando imagem",Save:"Salvar","Loading editor...":"Carregando editor...","Error loading image":"Erro ao carregar a imagem","Error saving image":"Erro ao salvar a imagem","Error initializing editor":"Erro ao inicializar o editor","Close File Manager":"Fechar gerenciador de arquivos","Are you sure you want to close? Unsaved changes will be lost.":"Tem certeza de que deseja fechar? As alterações não salvas serão perdidas.","Are you sure you want to close the file manager?":"Tem certeza de que deseja fechar o gerenciador de arquivos?",Close:"Fechar",KB:"KB","No files":"Nenhum arquivo","Folder is empty or files not found":"A pasta está vazia ou os arquivos não foram encontrados","Search files...":"Buscar arquivos...",Success:"Sucesso","Image updated successfully":"Imagem atualizada com sucesso","Failed to save changes":"Falha ao salvar alterações: {{error}}","Unknown error":"Erro desconhecido","Select destination folder":"Selecione a pasta de destino","Error moving":"Erro ao mover","Error deleting":"Erro ao excluir","Error copying":"Erro ao copiar","Error renaming":"Erro ao renomear","Failed to refresh folder tree":"Falha ao atualizar a árvore de pastas","Failed to refresh file list":"Falha ao atualizar a lista de arquivos","Errors occurred while moving":"Ocorreram erros ao mover","Errors occurred while copying":"Ocorreram erros ao copiar","(error)":"(erro)","(circular reference)":"(referência circular)","File too large. Maximum size: {{size}}":"Arquivo muito grande. Tamanho máximo: {{size}}","File too small. Minimum size: {{size}}":"Arquivo muito pequeno. Tamanho mínimo: {{size}}","Unsupported file type":"Tipo de arquivo não suportado","Unsupported file type: {{type}}":"Tipo de arquivo não suportado: {{type}}",unknown:"desconhecido","Failed to load files":"Falha ao carregar arquivos","Failed to load files in folder":"Não foi possível carregar o conteúdo da pasta ({{folderName}})","Failed to load subfolders in folder":'Não foi possível carregar subpastas em "{{folderName}}"',"Failed to load folder items count in folder":'Não foi possível obter a contagem de itens em "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider para exclusão de pastas não está configurado","DataProvider for file upload is not configured":"DataProvider para upload de arquivos não está configurado","Error uploading file {{fileName}}":"Erro ao carregar o arquivo {{fileName}}","Error uploading file":"Erro ao carregar o arquivo","Cannot upload files to Trash":"Não é possível carregar arquivos para a lixeira","Please fill in all fields":"Por favor, preencha todos os campos","URL too long":"URL muito longa","Only http and https URLs are supported":"Apenas URLs com protocolo http e https são suportadas","Private and local URLs are not allowed":"URLs locais e privadas não são permitidas","Upload by URL is not supported":"Upload por URL não é suportado","File name is too long. Maximum {{max}} characters":"O nome do arquivo é muito longo. Máximo de {{max}} caracteres","File name contains invalid characters":"O nome do arquivo contém caracteres inválidos","Large file may take a long time to upload":"Um arquivo grande pode demorar muito para ser carregado","File unavailable: {{status}} {{statusText}}":"Arquivo indisponível: {{status}} {{statusText}}","File too large: {{size}}":"Arquivo muito grande: {{size}}","Unsupported file type: {{contentType}}":"Tipo de arquivo não suportado: {{contentType}}","Invalid server response: folder ID is missing":"Resposta do servidor inválida: ID da pasta ausente","Error: folder cannot be its own parent":"Erro: a pasta não pode ser seu próprio pai","Upload to Trash is forbidden":"Enviar para a lixeira é proibido","renameFolder is not implemented in dataProviders":"renameFolder não está implementado em dataProviders","renameFile is not implemented in dataProviders":"renameFile não está implementado em dataProviders",Clean:"Limpar","Circular dependency detected: folder cannot be its own parent":"Dependência circular detectada: a pasta não pode ser seu próprio pai","Save as copy and choose":"Salvar como cópia e escolher","Save and choose":"Salvar e escolher",pixie:{"added drawing":"Desenho adicionado","added frame":"Moldura adicionada","added image":"Imagem adicionada","added shape":"Forma adicionada","added sticker":"Adesivo adicionado","added text":"Texto adicionado","applied filters":"Filtros aplicados",apply:"Aplicar",background:"Fundo","background color":"Cor de fundo",beach:"Praia","brush color":"Cor do pincel","brush size":"Tamanho do pincel","brush type":"Tipo de pincel",bubbles:"Bolhas",Cancel:"Cancelar","changed style":"Estilo alterado","Circle Brush":"Círculo",close:"Fechar",color:"Cor",corners:"Cantos",crop:"Cortar",Custom:"Personalizado","deleted object":"Objeto excluído","Diamond Brush":"Diamante",doodles:"Rabiscos",draw:"Desenhar",emoticons:"Emoticons","Eraser Brush":"Borracha",filter:"Filtro",font:"Fonte","font size":"Tamanho da fonte",frame:"Moldura",gradient:"Gradiente",height:"Altura",history:"Histórico","H Line Brush":"Linha H",image:"Imagem",initial:"Inicial",landmarks:"Pontos turísticos","loaded state":"Estado carregado","loading canvas":"Carregando tela","loading image":"Carregando imagem","loading state":"Carregando estado","maintain aspect ratio":"Manter proporção",merge:"Mesclar","merged objects":"Objetos mesclados","new text":"Novo texto",objects:"Objetos",opacity:"Opacidade",outline:"Contorno","outline color":"Cor do contorno","Pencil Brush":"Lápis","processing image":"Processando imagem",quality:"Qualidade",radius:"Raio","replace image":"Substituir imagem","replaced background image":"Imagem de fundo substituída",resize:"Redimensionar","resized image":"Imagem redimensionada","rounded corner":"Canto arredondado",save:"Salvar",shadow:"Sombra","shadow color":"Cor da sombra",shapes:"Formas","Spray Brush":"Spray",square:"Quadrado","Square Brush":"Quadrado",stickers:"Adesivos",text:"Texto",texture:"Textura",transportation:"Transporte","V Line Brush":"Linha V",width:"Largura",grayscale:"Tons de cinza","black & White":"Preto e branco",sharpen:"Nitidez",invert:"Inverter",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Sépia quente",sepia:"Sépia","remove Color":"Remover cor",brightness:"Brilho",gamma:"Gamma",noise:"Ruído",pixelate:"Pixelar",blur:"Desfocar",emboss:"Relevo","blend Color":"Misturar cor",distance:"Distância",red:"Vermelho",green:"Verde",blue:"Azul",blocksize:"Tamanho do bloco",alpha:"Alfa",add:"Adicionar",multiply:"Multiplicar",subtract:"Subtrair",diff:"Diferença",screen:"Tela",lighten:"Clarear",darken:"Escurecer","select an option...":"Selecione uma opção..."}};const _i={en:{translation:bi},ru:{translation:wi},es:{translation:{Files:"Archivos",selected:"seleccionado(s)",Deselected:"Deseleccionar",Refresh:"Actualizar","Select all":"Seleccionar todo",Rename:"Renombrar","Rename file":"Renombrar archivo {{currentFileName}}","Select the destination folder":"Seleccionar la carpeta de destino","Selected files:":"Archivos seleccionados:","Selected files":"Archivos seleccionados: {{count}}",selected_files_one:"{{count}} archivo seleccionado",selected_files_few:"{{count}} archivos seleccionados",selected_files_many:"{{count}} archivos seleccionados",selected_files_other:"{{count}} archivos seleccionados",Copy:"Duplicar",Edit:"Editar",Move:"Mover","Move to":"Mover a",Delete:"Eliminar","New folder":"Nueva carpeta","Image search...":"Búsqueda de imágenes...","Search icons":"Buscar iconos","By name":"Por nombre","By size":"Por tamaño","By date":"Por fecha",List:"Lista",Grid:"Cuadrícula",Main:"Principal",Folders:"Carpetas","total pages":"{{total}} elementos en total",Name:"Nombre",Untitled:"Sin título",Size:"Tamaño","Stroke width":"Grosor del trazo",Dimensions:"Dimensiones",Date:"Fecha",error:"error",Folder:"Carpeta",created:"creada","Failed to create folder":"Error al crear la carpeta","File deleted":"Archivo eliminado","Error when deleting a file":"Error al eliminar el archivo","Folder deleted":"Carpeta eliminada","Error when deleting a folder":"Error al eliminar la carpeta","Delete folder":"Eliminar carpeta","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"¿Está seguro de que desea eliminar esta carpeta? Esta acción también eliminará todos los archivos y subcarpetas.","API-endpoint for file upload is not configured":"El endpoint API para la carga de archivos no está configurado","Please select an image file":"Por favor, seleccione un archivo de imagen",File:"Archivo","has been successfully uploaded":"se ha cargado exitosamente","The URL must point to an image":"La URL debe apuntar a una imagen","Image upload...":"Cargando imagen...",Unknown:"Desconocido","Error downloading file by URL":"Error al descargar el archivo por URL","successfully uploaded":"cargado exitosamente","Error when downloading a file by URL":"Error al descargar un archivo por URL","Error when uploading a file":"Error al cargar el archivo","Error loading files":"Error al cargar archivos","File not found":"Archivo no encontrado","File renamed to":"Archivo renombrado a","Failed to rename the file":"Error al renombrar el archivo","Folder renamed to":"Carpeta renombrada a","Rename folder":"Renombrar carpeta","New folder name":"Nuevo nombre de la carpeta","Enter a new folder name":"Ingrese un nuevo nombre para la carpeta","Please drag and drop image files only":"Por favor, arrastre y suelte solo archivos de imagen","Upload file by URL":"Cargar archivo por URL","Upload file":"Cargar archivo","Creating a new folder":"Creando una nueva carpeta",Create:"Crear",Cancel:"Cancelar","Folder name":"Nombre de la carpeta","Enter the name of the folder":"Ingrese el nombre de la carpeta","Enter the name":"Ingrese el nombre","A folder will be created inside:":"La carpeta se creará dentro de:","selected folder":"carpeta seleccionada","The folder will be created in the root directory":"La carpeta se creará en el directorio raíz","Failed to load folders":"No se pudieron cargar las carpetas","Folder name cannot be empty":"El nombre de la carpeta no puede estar vacío","Folder creation provider is not configured":"El proveedor de creación de carpetas no está configurado","Folder created":"Carpeta creada","Folder rename is disabled by config":"El renombrado de carpetas está deshabilitado por la configuración","Folder rename provider is not configured":"El proveedor para renombrar carpetas no está configurado","Unexpected response when renaming folder":"Respuesta inesperada al renombrar la carpeta","Folder renamed":"Carpeta renombrada","Failed to rename folder":"No se pudo renombrar la carpeta","Failed to load folder items count":"No se pudo obtener la cantidad de elementos de la carpeta","Failed to load subfolders":"No se pudieron cargar las subcarpetas",Download:"Descargar","image URL":"URL de la imagen","Enter the URL of the image":"Ingrese la URL de la imagen","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Formatos admitidos: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Nuevo nombre del archivo","Enter a new file name":"Ingrese un nuevo nombre para el archivo","Copy to folder":"Copiar a carpeta",Added:"Añadido el {{date}}","File uploaded successfully":"Archivo {{fileName}} cargado exitosamente","Successfully uploaded":"{{successCount}} de {{count}} archivo cargado exitosamente","Successfully uploaded files":"{{successCount}} de {{count}} archivos cargados exitosamente",uploads_success_summary:"Se cargaron {{successCount}} de {{totalCount}} archivos",uploads_fail_summary:"No se pudieron cargar {{failCount}} de {{totalCount}} archivos","File with this name already exists.":"Ya existe un archivo con este nombre.","File not found or no longer available.":"El archivo no se encontró o ya fue eliminado.","You don't have permission to access this file.":"No tiene permisos para acceder a este archivo.","File is too large to upload.":"El archivo es demasiado grande para subir.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"El archivo es demasiado grande ({{fileSize}}). Tamaño máximo permitido: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Se ha superado el número máximo de archivos. Permitido: {{allowed}}, recibido: {{received}}","This file type is not allowed.":"Este tipo de archivo no está permitido.","File name is not valid.":"El nombre del archivo no es válido.","File name is not valid. Allowed characters: {{allowedChars}}":"El nombre del archivo no es válido. Caracteres permitidos: {{allowedChars}}","Failed to read the file.":"No se pudo leer el archivo.","Failed to write the file.":"No se pudo escribir el archivo.","The file appears to be corrupted.":"El archivo parece estar dañado.","File integrity check failed.":"La verificación de integridad del archivo falló.","Folder not found or no longer available.":"La carpeta no se encontró o ya fue eliminada.","Folder with this name already exists.":"Ya existe una carpeta con este nombre.","A folder with that name already exists. Please enter a different folder name.":"Ya existe una carpeta con ese nombre. Introduzca un nombre de carpeta diferente.","You don't have permission to access this folder.":"No tiene permisos para acceder a esta carpeta.","Folder name is not valid.":"El nombre de la carpeta no es válido.","Folder name is not valid. Allowed characters: {{allowedChars}}":"No se pudo crear la carpeta. Caracteres permitidos en el nombre: {{allowedChars}}","Failed to read the folder contents.":"No se pudo leer el contenido de la carpeta.","Failed to write to the folder.":"No se pudo escribir en la carpeta.","Folder storage quota exceeded.":"Se superó la cuota de almacenamiento de la carpeta.","Folder is not empty.":"La carpeta no está vacía.","Server error while processing the folder.":"Error del servidor al procesar la carpeta.","Folder operation took too long.":"La operación con la carpeta tardó demasiado.","Network error. Please check your connection and try again.":"Error de red. Compruebe su conexión e inténtelo de nuevo.","The operation took too long. Please try again.":"La operación tardó demasiado. Inténtelo de nuevo.","Server error. Please try again later.":"Error del servidor. Inténtelo de nuevo más tarde.","Service is temporarily unavailable. Please try again later.":"El servicio no está disponible temporalmente. Inténtelo de nuevo más tarde.","Too many requests. Please try again a bit later.":"Demasiadas solicitudes. Inténtelo de nuevo más tarde.","Authentication failed. Please sign in again.":"Error de autenticación. Inicie sesión de nuevo.","You are not allowed to perform this action.":"No tiene permisos para realizar esta acción.","Some of the provided data is invalid.":"Algunos de los datos proporcionados no son válidos.","This operation is not supported.":"Esta operación no está soportada.","Request payload is too large.":"El cuerpo de la solicitud es demasiado grande.","This media type is not supported.":"Este tipo de contenido no está soportado.","You have exceeded the upload quota.":"Se ha superado la cuota de subida de archivos.","Network error while uploading the file.":"Error de red al subir el archivo.","File upload took too long.":"La subida del archivo tardó demasiado.","Server error while uploading the file.":"Error del servidor al subir el archivo.","The specified URL is not valid.":"La URL especificada no es válida.","The specified URL is not reachable.":"La URL especificada no es accesible.","Content type at the URL is not allowed.":"El tipo de contenido en la URL no está permitido.","Failed to download file from the URL.":"No se pudo descargar el archivo desde la URL.","Network error while downloading the file.":"Error de red al descargar el archivo.","File download took too long.":"La descarga del archivo tardó demasiado.","Server error while downloading the file.":"Error del servidor al descargar el archivo.","Some items could not be processed.":"No todos los elementos se procesaron correctamente.","Failed to process all items in the batch.":"No se pudo procesar ningún elemento del lote.","Some items in the batch are in a conflicting state.":"Algunos elementos del lote están en estado de conflicto.","Some items in the batch did not pass validation.":"Algunos elementos del lote no pasaron la validación.","AI service returned an invalid response.":"El servicio de IA devolvió una respuesta no válida.","Failed to generate image using AI.":"No se pudo generar la imagen usando IA.","You have reached the AI image generation limit.":"Se alcanzó el límite de generación de imágenes con IA.","Error in external integration.":"Error en la integración externa.","Error in a third-party service.":"Error en un servicio de terceros.","An unknown error occurred.":"Se ha producido un error desconocido.","Renaming is not allowed for this item.":"No se permite renombrar este elemento.","Moving is not allowed for this item.":"No se permite mover este elemento.","Copying is not allowed for this item.":"No se permite copiar este elemento.","Deleting is not allowed for this item.":"No se permite eliminar este elemento.","Cannot move an item into itself.":"No se puede mover un elemento dentro de sí mismo.","Cannot move an item into its descendant folder.":"No se puede mover un elemento a su carpeta descendiente.","Cannot copy an item into itself.":"No se puede copiar un elemento dentro de sí mismo.","Configuration error occurred.":"Se produjo un error de configuración.","Storage quota exceeded. Please free up space.":"Se superó la cuota de almacenamiento. Libere espacio.","File is locked by another process or user.":"El archivo está bloqueado por otro proceso o usuario.","File version conflict. Please refresh and try again.":"Conflicto de versión del archivo. Actualice la página e inténtelo de nuevo.","Batch operation exceeds the maximum number of items allowed.":"La operación por lotes excede el número máximo de elementos permitidos.",Moved:"Movidos: {{names}}",move_success_summary:"Se movieron {{successCount}} de {{totalCount}} elementos",move_fail_summary:"No se pudieron mover {{failCount}} de {{totalCount}} elementos",Copied:"Copiados: {{names}}",copy_success_summary:"Se copiaron {{successCount}} de {{totalCount}} elementos",copy_fail_summary:"No se pudieron copiar {{failCount}} de {{totalCount}} elementos",Uploaded:"Archivos cargados: {{names}}",Failed:"No se pudieron cargar: {{names}}","Failed to upload":"Error al cargar {{failCount}} de {{count}} archivo","Failed to upload files":"Error al cargar {{failCount}} de {{count}} archivos",months:{january:"enero",february:"febrero",march:"marzo",april:"abril",may:"mayo",june:"junio",july:"julio",august:"agosto",september:"septiembre",october:"octubre",november:"noviembre",december:"diciembre"},files:"archivos","No available folders":"No hay carpetas disponibles","My files":"Mis archivos",GIF:"GIF","Stock images":"Imágenes de stock","QR & Barcode":"QR y código de barras","QR code":"Código QR",Barcode:"Código de barras","Text or URL":"Texto o URL","Code color":"Color del código","Background color":"Color de fondo","Add to My files":"Añadir a Mis archivos","Transparent background":"Fondo transparente","Barcode generation failed":"No se pudo generar el código de barras. Use caracteres compatibles con CODE128.","Validation error":"Error de validación","Enter text or URL to preview":"Introduzca texto o una URL para la vista previa.",Preview:"Vista previa","QR transparent background hint":"Un PNG transparente puede fundirse con temas oscuros del correo; un fondo blanco suele escanearse mejor.","QR image size px":"Tamaño del QR","Barcode bar height px":"Altura de barras",AI:"IA","AI image generation":"Generación de imágenes con IA","Search GIFs":"Buscar GIFs","That`s all we could find.":"Es todo lo que pudimos encontrar.","Search image":"Buscar imagen",All:"Todos",Landscape:"Horizontal",Portrait:"Vertical",Squarish:"Cuadrado",Black:"Negro","Black and White":"Blanco y negro",White:"Blanco",Orange:"Naranja",Red:"Rojo",Purple:"Morado",Magenta:"Magenta",Green:"Verde",Teal:"Verde azulado",Blue:"Azul","Photo by":"Foto de",on:"en","File Manager":"Administrador de archivos","File Manager not configured":"Administrador de archivos no configurado","Filter by type":"Filtrar por tipo","All types":"Todos los tipos","File name":"Nombre del archivo",Actions:"Acciones","Add file":"Añadir archivo","Add folder":"Añadir carpeta","Add file by URL":"Añadir archivo por URL","File moved":"Archivo movido","Error when moving a file":"Error al mover el archivo","Failed to download file":"No se pudo descargar el archivo","Failed to load JSON data":"No se pudieron cargar los datos JSON","Invalid file URL":"URL de archivo inválida","Unable to validate file URL":"No se pudo validar la URL del archivo","Type to search...":"Escriba para buscar...",Submit:"Enviar","No folders yet":"Aún no hay carpetas","Drag files to upload":"Arrastre archivos para cargarlos","Drop files here to upload":"Suelte los archivos aquí para cargarlos","Newest first":"Los más nuevos primero","Oldest first":"Los más antiguos primero","Largest first":"Los más grandes primero","Smallest first":"Los más pequeños primero","A-Z":"A-Z","Z-A":"Z-A","By type":"Por tipo","Evaluating the task":"Evaluando la tarea","Something went wrong, please try again":"Algo salió mal, por favor intente nuevamente","Sort by":"Ordenar por","preview text":"Cargando imagen...","Use this variant":"Usar esta variante","Confirm deletion":"Confirmar eliminación","Are you sure you want to delete the selected items?":"¿Está seguro de que desea eliminar los elementos seleccionados?","Move to Trash":"Mover a la papelera","Are you sure you want to move the selected items to the Trash?":"¿Está seguro de que desea mover los elementos seleccionados a la papelera?","Permanently delete":"Eliminación permanente","Delete permanently":"Eliminar permanentemente","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"¿Está seguro de que desea eliminar permanentemente los elementos seleccionados? Esta acción no se puede deshacer.",Clear:"Limpiar","Clear Trash":"Vaciar papelera","Are you sure you want to permanently delete all items from Trash?":"¿Está seguro de que desea eliminar permanentemente todos los elementos de la papelera?","Trash cleared successfully":"Papelera vaciada con éxito","{{count}} items permanently deleted":"{{count}} elementos eliminados permanentemente","Trash partially cleared":"Papelera parcialmente vaciada","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} elementos eliminados, {{failed}} fallaron","Failed to clear trash":"Error al vaciar papelera","Error clearing trash":"Error al vaciar papelera","Deleting items...":"Eliminando elementos...",delete_files_permanent_one:"Esta acción eliminará permanentemente {{count}} archivo",delete_files_permanent_few:"Esta acción eliminará permanentemente {{count}} archivos",delete_files_permanent_many:"Esta acción eliminará permanentemente {{count}} archivos",delete_files_permanent_other:"Esta acción eliminará permanentemente {{count}} archivos",delete_folder_permanent:"Esta acción eliminará permanentemente la carpeta «{{name}}» y todo su contenido, incluyendo {{count}} elementos.",delete_mixed_permanent:"Esta acción eliminará permanentemente {{total}} elementos seleccionados, incluyendo {{folders}} carpetas y todas las {{images}} imágenes dentro de ellas.",permanent_delete_warning:"Eliminar archivos que se usaron en correos provocará problemas para mostrar imágenes en correos antiguos. ¿Está seguro de que desea eliminar permanentemente la selección?",move_files_to_trash_one:"Esta acción moverá {{count}} archivo a la papelera.",move_files_to_trash_few:"Esta acción moverá {{count}} archivos a la papelera.",move_files_to_trash_many:"Esta acción moverá {{count}} archivos a la papelera.",move_files_to_trash_other:"Esta acción moverá {{count}} archivos a la papelera.",move_folder_to_trash:"Esta acción moverá la carpeta «{{name}}» y todo su contenido ({{count}} elementos) a la papelera.",move_mixed_to_trash:"Esta acción moverá {{total}} elementos seleccionados a la papelera, incluyendo {{folders}} carpetas y {{images}} imágenes.",delete_count_confirm_trash_one:"¿Mover {{count}} archivo a la papelera?",delete_count_confirm_trash_few:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_trash_many:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_trash_other:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_permanent_one:"¿Eliminar permanentemente {{count}} archivo?",delete_count_confirm_permanent_few:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_permanent_many:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_permanent_other:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_one:"¿Eliminar {{count}} archivo?",delete_count_confirm_few:"¿Eliminar {{count}} archivos?",delete_count_confirm_many:"¿Eliminar {{count}} archivos?",delete_count_confirm_other:"¿Eliminar {{count}} archivos?",item:"archivo",items:"archivos",Trash:"Papelera",Choose:"Elegir",Stock:"Banco de imágenes","Select an image from our library":"Seleccione una imagen de nuestra biblioteca","AI generation":"Generación con IA","Creating an image on demand":"Creando una imagen bajo demanda","Search file or folder":"Buscar archivo o carpeta","Click here to select a file":"Haz clic aquí para seleccionar un archivo","Supported files:":"Archivos admitidos:","Create folder":"Crear carpeta",Done:"Hecho","Move here":"Mover aquí","Copy here":"Copiar aquí","File URL":"URL del archivo","There's nothing here":"Aquí no hay nada","Try using a different search query.":"Prueba a utilizar una consulta de búsqueda diferente.","Millions of free stock images":"Millones de imágenes de stock gratuitas","Enter a search query and we'll find the perfect image for you":"Ingrese una consulta de búsqueda y encontraremos la imagen perfecta para usted","Millions of icons":"Millones de iconos","Lucide icons":"Iconos Lucide","Thousands of icons":"Miles de iconos","Enter a search query and we'll find the perfect icon for you":"Ingrese una consulta de búsqueda y encontraremos el ícono perfecto para usted","Enter your query and we will find the right one for you":"Ingrese su consulta y nosotros encontraremos la adecuada para usted","Over 350,000 live images":"Más de 350,000 imágenes en vivo","The folder will be created in the root directory.":"La carpeta se creará en el directorio raíz.",undo:"DESHACER",moved_to_trash_one:"{{count}} elemento movido a la papelera",moved_to_trash_few:"{{count}} elementos movidos a la papelera",moved_to_trash_many:"{{count}} elementos movidos a la papelera",moved_to_trash_other:"{{count}} elementos movidos a la papelera",restored_items_one:"{{count}} elemento restaurado",restored_items_few:"{{count}} elementos restaurados",restored_items_many:"{{count}} elementos restaurados",restored_items_other:"{{count}} elementos restaurados",Type:"Tipo","Generate image":"Generar imagen","A beautiful image of a sunset over a calm ocean.":"Una imagen hermosa de un atardecer sobre un océano tranquilo.","For example:":"Por ejemplo:",Insert:"Insertar",Error:"Error","Upload progress":"Cargando {{completed}}/{{total}}","Uploading files":"Cargando {{completed}}/{{total}} archivos","Uploaded files":"Cargados {{success}} de {{total}} archivos","Upload error files":"Error al cargar {{errorCount}} archivos","Applies to all {{count}} files":"(se aplica a todos los {{count}} archivos)","Some files failed to upload":"Algunos archivos no se pudieron cargar. Verifique el tamaño y el formato de los archivos.",upload_error_hint_invalid_name:"Renombre el archivo: use solo letras, números, guiones y guiones bajos.",upload_error_hint_size:"Reduzca el tamaño del archivo o elija otro.",upload_error_hint_format:"Use un formato permitido: JPG, PNG o GIF.",upload_error_hint_exists:"Ya existe un archivo con este nombre en la carpeta. Renombre el archivo.","Images generated successfully":"Imágenes generadas correctamente","Choose for template":"Seleccionar para cargar en la plantilla","Trash is empty":"La papelera está vacía","Deleted files will be displayed here":"Los archivos eliminados se mostrarán aquí","Editing: {{name}}":"Editando: {{name}}","Editing image":"Editando imagen",Save:"Guardar","Loading editor...":"Cargando editor...","Error loading image":"Error al cargar la imagen","Error saving image":"Error al guardar la imagen","Error initializing editor":"Error al inicializar el editor","Close File Manager":"Cerrar administrador de archivos","Are you sure you want to close? Unsaved changes will be lost.":"¿Está seguro de que desea cerrar? Los cambios no guardados se perderán.","Are you sure you want to close the file manager?":"¿Está seguro de que desea cerrar el administrador de archivos?",Close:"Cerrar",KB:"KB","No files":"No hay archivos","Folder is empty or files not found":"La carpeta está vacía o no se encontraron archivos","Search files...":"Buscar archivos...",Success:"Éxito","Image updated successfully":"Imagen actualizada exitosamente","Failed to save changes":"Error al guardar los cambios: {{error}}","Unknown error":"Error desconocido","Select destination folder":"Seleccione la carpeta de destino","Error moving":"Error al mover","Error deleting":"Error al eliminar","Error copying":"Error al copiar","Error renaming":"Error al renombrar","Failed to refresh folder tree":"Error al actualizar el árbol de carpetas","Failed to refresh file list":"Error al actualizar la lista de archivos","Errors occurred while moving":"Ocurrieron errores al mover","Errors occurred while copying":"Ocurrieron errores al copiar","(error)":"(error)","(circular reference)":"(referencia circular)","File too large. Maximum size: {{size}}":"El archivo es demasiado grande. Tamaño máximo: {{size}}","File too small. Minimum size: {{size}}":"El archivo es demasiado pequeño. Tamaño mínimo: {{size}}","Unsupported file type":"Tipo de archivo no admitido","Unsupported file type: {{type}}":"Tipo de archivo no admitido: {{type}}",unknown:"desconocido","Failed to load files":"Error al cargar archivos","Failed to load files in folder":"No se pudo cargar el contenido de la carpeta ({{folderName}})","Failed to load subfolders in folder":'No se pudieron cargar las subcarpetas en "{{folderName}}"',"Failed to load folder items count in folder":'No se pudo obtener el recuento de elementos en "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider para eliminar carpetas no está configurado","DataProvider for file upload is not configured":"DataProvider para cargar archivos no está configurado","Error uploading file {{fileName}}":"Error al cargar el archivo {{fileName}}","Error uploading file":"Error al cargar el archivo","Cannot upload files to Trash":"No se pueden cargar archivos a la papelera","Please fill in all fields":"Por favor, complete todos los campos","URL too long":"La URL es demasiado larga","Only http and https URLs are supported":"Solo se admiten URLs con protocolo http y https","Private and local URLs are not allowed":"No se permiten URLs locales ni privadas","Upload by URL is not supported":"La carga por URL no está admitida","File name is too long. Maximum {{max}} characters":"El nombre del archivo es demasiado largo. Máximo {{max}} caracteres","File name contains invalid characters":"El nombre del archivo contiene caracteres no válidos","Large file may take a long time to upload":"Un archivo grande puede tardar mucho en cargarse","File unavailable: {{status}} {{statusText}}":"Archivo no disponible: {{status}} {{statusText}}","File too large: {{size}}":"Archivo demasiado grande: {{size}}","Unsupported file type: {{contentType}}":"Tipo de archivo no admitido: {{contentType}}","Invalid server response: folder ID is missing":"Respuesta del servidor inválida: falta el ID de la carpeta","Error: folder cannot be its own parent":"Error: la carpeta no puede ser su propio padre","Upload to Trash is forbidden":"Cargar a la papelera está prohibido","renameFolder is not implemented in dataProviders":"renameFolder no está implementado en dataProviders","renameFile is not implemented in dataProviders":"renameFile no está implementado en dataProviders",Clean:"Limpiar","Circular dependency detected: folder cannot be its own parent":"Dependencia circular detectada: la carpeta no puede ser su propio padre","Save as copy and choose":"Guardar como copia y elegir","Save and choose":"Guardar y elegir",pixie:{"added drawing":"Dibujo añadido","added frame":"Marco añadido","added image":"Imagen añadida","added shape":"Forma añadida","added sticker":"Pegatina añadida","added text":"Texto añadido","applied filters":"Filtros aplicados",apply:"Aplicar",background:"Fondo","background color":"Color de fondo",beach:"Playa","brush color":"Color del pincel","brush size":"Tamaño del pincel","brush type":"Tipo de pincel",bubbles:"Burbujas",Cancel:"Cancelar","changed style":"Estilo cambiado","Circle Brush":"Círculo",close:"Cerrar",color:"Color",corners:"Esquinas",crop:"Recortar",Custom:"Personalizado","deleted object":"Objeto eliminado","Diamond Brush":"Diamante",doodles:"Garabatos",draw:"Dibujar",emoticons:"Emoticonos","Eraser Brush":"Borrador",filter:"Filtro",font:"Fuente","font size":"Tamaño de fuente",frame:"Marco",gradient:"Gradiente",height:"Alto",history:"Historial","H Line Brush":"Línea H",image:"Imagen",initial:"Inicial",landmarks:"Monumentos","loaded state":"Estado cargado","loading canvas":"Cargando lienzo","loading image":"Cargando imagen","loading state":"Cargando estado","maintain aspect ratio":"Mantener proporción",merge:"Fusionar","merged objects":"Objetos fusionados","new text":"Nuevo texto",objects:"Objetos",opacity:"Opacidad",outline:"Contorno","outline color":"Color del contorno","Pencil Brush":"Lápiz","processing image":"Procesando imagen",quality:"Calidad",radius:"Radio","replace image":"Reemplazar imagen","replaced background image":"Imagen de fondo reemplazada",resize:"Redimensionar","resized image":"Imagen redimensionada","rounded corner":"Esquina redondeada",save:"Guardar",shadow:"Sombra","shadow color":"Color de la sombra",shapes:"Formas","Spray Brush":"Spray",square:"Cuadrado","Square Brush":"Cuadrado",stickers:"Pegatinas",text:"Texto",texture:"Textura",transportation:"Transporte","V Line Brush":"Línea V",width:"Ancho",grayscale:"Escala de grises","black & White":"Blanco y negro",sharpen:"Enfocar",invert:"Invertir",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Sepia cálido",sepia:"Sepia","remove Color":"Eliminar color",brightness:"Brillo",gamma:"Gamma",noise:"Ruido",pixelate:"Pixelar",blur:"Desenfocar",emboss:"Relieve","blend Color":"Mezclar color",distance:"Distancia",red:"Rojo",green:"Verde",blue:"Azul",blocksize:"Tamaño de bloque",alpha:"Alfa",add:"Añadir",multiply:"Multiplicar",subtract:"Restar",diff:"Diferencia",screen:"Pantalla",lighten:"Aclarar",darken:"Oscurecer","select an option...":"Seleccione una opción..."}}},uk:{translation:xi},"pt-br":{translation:Ci},pt:{translation:Ci},br:{translation:Ci},"pt-BR":{translation:Ci}};jn.use(Qn).init({resources:_i,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});Object.values({images:["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"],documents:["application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],archives:["application/zip","application/x-rar-compressed","application/x-7z-compressed"],videos:["video/mp4","video/avi","video/quicktime","video/x-msvideo"],audio:["audio/mpeg","audio/wav","audio/ogg"]}).flat();const Si=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB"][t]},Ai=e=>{if(!e||e<=0)return"";const t=1048576;if(e<t){return`${Math.round(e/1024)} Kb`}return`${(e/t).toFixed(2)} Mb`},ki=e=>{if(null==e)return"";if("number"==typeof e)return Ai(e);const t=String(e).trim();if(!t)return"";const r=Number(t);return Number.isNaN(r)?t:Ai(r)},Ei=(e,t)=>{const r=t.filter(e=>"string"==typeof e),n=new Set(r.map(e=>e.toLowerCase())),i="string"==typeof e?e:String(null!=e?e:"");if(!n.has(i.toLowerCase()))return i;const o=i.lastIndexOf("."),a=o>0?i.slice(0,o):i,s=o>0?i.slice(o):"";let l,c=1;do{l=`${a}_${c}${s}`,c++}while(n.has(l.toLowerCase()));return l};async function Ii(e,t,r,n,i){if(!i||!(null==e?void 0:e.getFiles))return t;try{let i=[];const{files:o}=await e.getFiles({folderId:n?void 0:null!=r?r:void 0,noFolder:n,itemType:"all",page:1,limit:1e4});if(i=(o||[]).map(e=>e.name).filter(e=>!!e),!n&&(null==e?void 0:e.getFolders)){const t=(await e.getFolders({parentId:null!=r?r:null,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);i=[...i,...t]}return Ei(t,i)}catch(e){return console.warn("Could not fetch files for duplicate check:",e),t}}const Ti=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m6 9 6 6 6-6"}));Ti.displayName="ChevronDown";const Fi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M12 20.472a6 6 0 1 0 5.58-10.262m-11.16 0a6 6 0 1 0 7.16 3.58M18 8A6 6 0 1 1 6 8a6 6 0 0 1 12 0Z"}));Fi.displayName="Colors";const Oi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M16 16v2.8c0 1.12 0 1.68-.218 2.108a2 2 0 0 1-.874.874C14.48 22 13.92 22 12.8 22H5.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C2 20.48 2 19.92 2 18.8v-7.6c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C3.52 8 4.08 8 5.2 8H8m3.2 8h7.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 14.48 22 13.92 22 12.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 2 19.92 2 18.8 2h-7.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C8 3.52 8 4.08 8 5.2v7.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C9.52 16 10.08 16 11.2 16Z"}));Oi.displayName="Copy04";const Pi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M10 6h4.8c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C18 7.52 18 8.08 18 9.2V14M2 6h4m12 12v4m4-4H9.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C6 16.48 6 15.92 6 14.8V2"}));Pi.displayName="Crop02";const Mi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0-7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"}));Mi.displayName="DotsVertical";const Ri=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm7 7 3 3m0 0 3-3m-3 3v-6"}));Ri.displayName="FolderDownload";const Li=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm7 7h6"}));Li.displayName="FolderMinus";const Ni=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm10 10v-6m-3 3h6"}));Ni.displayName="FolderPlus";const ji=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm13.5 10.5L14 16m1-2.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z"}));ji.displayName="FolderSearch";const Di=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M8.4 3H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 3.76 3 4.04 3 4.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 10 4.04 10 4.6 10h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C10 9.24 10 8.96 10 8.4V4.6c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C9.24 3 8.96 3 8.4 3Zm11 0h-3.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C14 3.76 14 4.04 14 4.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 10 15.04 10 15.6 10h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C21 9.24 21 8.96 21 8.4V4.6c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C20.24 3 19.96 3 19.4 3Zm0 11h-3.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C14 14.76 14 15.04 14 15.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 21 15.04 21 15.6 21h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C21 20.24 21 19.96 21 19.4v-3.8c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C20.24 14 19.96 14 19.4 14Zm-11 0H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 14.76 3 15.04 3 15.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C10 20.24 10 19.96 10 19.4v-3.8c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C9.24 14 8.96 14 8.4 14Z"}));Di.displayName="Grid01";const zi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m4.272 20.728 6.597-6.597c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668l6.553 6.553M14 15l2.869-2.869c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668L22 15M10 9a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM6.8 21h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 18.72 22 17.88 22 16.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 3 18.88 3 17.2 3H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 5.28 2 6.12 2 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 21 5.12 21 6.8 21Z"}));zi.displayName="Image03";const Bi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7"}));Bi.displayName="Link01";const Ui=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M21 12H9m12-6H9m12 12H9m-4-6a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm0-6a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm0 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));Ui.displayName="List";const Vi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M9.5 8.965c0-.477 0-.716.1-.849a.5.5 0 0 1 .364-.199c.166-.012.367.117.769.375l4.72 3.035c.349.224.523.336.583.478a.5.5 0 0 1 0 .39c-.06.142-.234.254-.583.478l-4.72 3.035c-.402.258-.603.387-.769.375a.5.5 0 0 1-.364-.2c-.1-.132-.1-.371-.1-.848v-6.07Z"}),n.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));Vi.displayName="PlaySquare";const Hi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M12 8v8m-4-4h8m6 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Hi.displayName="PlusCircle";const Wi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M6.5 6.5h.01m10.99 0h.01M6.5 17.5h.01M13 13h.01m4.49 4.5h.01M17 21h4v-4m-7-.5V21m7-7h-4.5m-.9-4h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C21 9.24 21 8.96 21 8.4V4.6c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C20.24 3 19.96 3 19.4 3h-3.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C14 3.76 14 4.04 14 4.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 10 15.04 10 15.6 10Zm-11 0h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C10 9.24 10 8.96 10 8.4V4.6c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C9.24 3 8.96 3 8.4 3H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 3.76 3 4.04 3 4.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 10 4.04 10 4.6 10Zm0 11h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C10 20.24 10 19.96 10 19.4v-3.8c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C9.24 14 8.96 14 8.4 14H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 14.76 3 15.04 3 15.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21Z"}));Wi.displayName="QrCode02";const $i=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M20.453 12.893A8.5 8.5 0 0 1 4.638 16.25l-.25-.433m-.842-4.71A8.5 8.5 0 0 1 19.361 7.75l.25.433M3.493 18.066l.732-2.732 2.732.732m10.085-8.132 2.732.732.732-2.732"}));$i.displayName="RefreshCw05";const qi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M14 22H6.8m0 0c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 19.72 2 18.88 2 17.2M6.8 22h.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C12 19.72 12 18.88 12 17.2v-.4c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C9.72 12 8.88 12 7.2 12h-.4c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 14.28 2 15.12 2 16.8v.4m0 0V10m8-8h4m8 8v4m-4 8c.93 0 1.395 0 1.776-.102a3 3 0 0 0 2.122-2.122C22 19.395 22 18.93 22 18m0-12c0-.93 0-1.395-.102-1.776a3 3 0 0 0-2.122-2.122C19.395 2 18.93 2 18 2M6 2c-.93 0-1.395 0-1.776.102a3 3 0 0 0-2.122 2.122C2 4.605 2 5.07 2 6"}));qi.displayName="Scale01";const Gi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m21 21-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"}));Gi.displayName="SearchMd";const Yi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M4.5 22v-5m0-10V2M2 4.5h5m-5 15h5M13 3l-1.734 4.509c-.282.733-.423 1.1-.643 1.408a3 3 0 0 1-.706.707c-.308.219-.675.36-1.408.642L4 12l4.509 1.734c.733.282 1.1.423 1.408.643.273.194.512.433.707.706.219.308.36.675.642 1.408L13 21l1.734-4.509c.282-.733.423-1.1.643-1.408.194-.273.433-.512.706-.707.308-.219.675-.36 1.408-.642L22 12l-4.509-1.734c-.733-.282-1.1-.423-1.408-.642a3 3 0 0 1-.706-.707c-.22-.308-.36-.675-.643-1.408L13 3Z"}));Yi.displayName="Stars02";const Xi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M13 7H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 8.52 2 9.08 2 10.2v3.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 17 4.08 17 5.2 17H13m4-10h1.8c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 8.52 22 9.08 22 10.2v3.6c0 1.12 0 1.68-.218 2.108a2 2 0 0 1-.874.874C20.48 17 19.92 17 18.8 17H17m0 4V3m2.5 0h-5m5 18h-5"}));Xi.displayName="TextInput";const Ki=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M7 22V11m-5 2v7a2 2 0 0 0 2 2h13.426a3 3 0 0 0 2.965-2.544l1.077-7A3 3 0 0 0 18.503 9H15a1 1 0 0 1-1-1V4.466A2.466 2.466 0 0 0 11.534 2a.822.822 0 0 0-.75.488l-3.52 7.918A1 1 0 0 1 6.35 11H4a2 2 0 0 0-2 2Z"}));Ki.displayName="ThumbsUp";const Zi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M9 3h6M3 6h18m-2 0-.701 10.52c-.105 1.578-.158 2.367-.499 2.965a3 3 0 0 1-1.298 1.215c-.62.3-1.41.3-2.993.3h-3.018c-1.582 0-2.373 0-2.993-.3A3 3 0 0 1 6.2 19.485c-.34-.598-.394-1.387-.499-2.966L5 6m5 4.5v5m4-5v5"}));Zi.displayName="Trash03";const Qi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M9 3h6M3 6h18m-2 0-.701 10.52c-.105 1.578-.158 2.367-.499 2.965a3 3 0 0 1-1.298 1.215c-.62.3-1.41.3-2.993.3h-3.018c-1.582 0-2.373 0-2.993-.3A3 3 0 0 1 6.2 19.485c-.34-.598-.394-1.387-.499-2.966L5 6"}));Qi.displayName="Trash04";const Ji=()=>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"})}),eo=()=>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"})}),to=()=>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"})}),ro=()=>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"})}),no=()=>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"})]}),io=()=>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"})}),oo=()=>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"})}),ao=()=>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"})]}),so=()=>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"})]}),lo=()=>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"})}),co=()=>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"})}),uo=()=>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"})]}),ho=()=>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"})]}),fo=()=>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"})]}),po=()=>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"})}),go=t=>e(ne,Object.assign({component:Ji},t)),mo=t=>e(ne,Object.assign({component:eo},t)),vo=t=>e(ne,Object.assign({component:to},t)),yo=t=>e(ne,Object.assign({component:ro},t)),bo=t=>e(ne,Object.assign({component:no},t)),wo=t=>e(ne,Object.assign({component:io},t)),xo=t=>e(ne,Object.assign({component:oo},t)),Co=t=>e(ne,Object.assign({component:ao},t)),_o=t=>e(ne,Object.assign({component:so},t)),So=t=>e(ne,Object.assign({component:lo},t)),Ao=t=>e(ne,Object.assign({component:co},t)),ko=t=>e(ne,Object.assign({component:uo},t)),Eo=t=>e(ne,Object.assign({component:ho},t)),Io=t=>e(ne,Object.assign({component:fo},t)),To=t=>e(ne,Object.assign({component:po},t)),Fo=s({state:{},actions:{},options:{}}),Oo=()=>l(Fo),Po=({children:t,options:r})=>{var n,i,s,l;const[u,h]=o([]),[f,p]=o([]),[g,m]=o(null),[v,y]=o(r.searchQuery||""),[b,w]=o(r.sortBySize||"name"),{config:x}=r,C=c(e=>{var t,r,n,i;if(e===er){const e=!1!==(null===(t=null==x?void 0:x.features)||void 0===t?void 0:t.enableGif),r=!(null==x?void 0:x.enabledTabs)||x.enabledTabs.includes("gif");return e&&r}if(e===tr){const e=!1!==(null===(r=null==x?void 0:x.features)||void 0===r?void 0:r.enableStockImages),t=!(null==x?void 0:x.enabledTabs)||x.enabledTabs.includes("stock");return e&&t}if(e===rr){const e=!1!==(null===(n=null==x?void 0:x.features)||void 0===n?void 0:n.enableIconStock),t=!(null==x?void 0:x.enabledTabs)||x.enabledTabs.includes("icons");return e&&t}if(e===ir){const e=!1!==(null===(i=null==x?void 0:x.features)||void 0===i?void 0:i.enableQrBarcodeTab),t=!(null==x?void 0:x.enabledTabs)||x.enabledTabs.includes("codes");return e&&t}return!0},[null==x?void 0:x.enabledTabs,null===(n=null==x?void 0:x.features)||void 0===n?void 0:n.enableGif,null===(i=null==x?void 0:x.features)||void 0===i?void 0:i.enableIconStock,null===(s=null==x?void 0:x.features)||void 0===s?void 0:s.enableStockImages,null===(l=null==x?void 0:x.features)||void 0===l?void 0:l.enableQrBarcodeTab]),[_,S]=o("date"),[A,k]=o("desc"),[E,T]=o([{id:"folders",name:"Папки"}]),[F,O]=o(""),[P,M]=o(!1),[R,L]=o(Jt);a(()=>{(null==x?void 0:x.activeLibraryItem)&&L&&L(C(x.activeLibraryItem)?x.activeLibraryItem:Jt)},[null==x?void 0:x.activeLibraryItem,C,L]),a(()=>{C(R)||L(Jt)},[R,C]);const[N,j]=o({current:1,pageSize:20,total:0}),[D]=I.useForm(),[z]=I.useForm(),[B]=I.useForm(),[U]=I.useForm(),[V]=I.useForm(),[H]=I.useForm(),[W,$]=o(!1),[q,G]=o(!1),[Y,X]=o(!1),[K,Z]=o(!1),[Q,J]=o(!1),[ee,te]=o(!1),[re,ne]=o(!1),[ie,oe]=o(null),[ae,se]=o(null),[le,ce]=o(null),ue=(e,t)=>{T(r=>r.map(r=>r.id===e?Object.assign(Object.assign({},r),{name:t}):r))},de=c(e=>{j(t=>Object.assign(Object.assign({},t),e))},[j]),he=d(()=>{var e;return{folders:u,files:f,selectedFolder:g,searchTerm:v,sortField:b,sortBy:_,sortOrder:A,pathHistory:E,currentMenuFile:F,loading:P,pagination:N,isModalVisible:W,isUrlModalVisible:q,isRenameModalVisible:Y,isMoveModalVisible:K,isRenameFolderModalVisible:Q,isCopyModalVisible:ee,isDeleteConfirmVisible:re,form:D,urlForm:z,renameForm:B,moveForm:U,renameFolderForm:V,copyForm:H,fileToRename:ie,folderToRename:ae,activeLibraryItem:R,multiSelect:null===(e=null==x?void 0:x.multiSelect)||void 0===e||e,undoDeletion:le}},[R,null==x?void 0:x.multiSelect,H,F,ie,f,u,D,ee,re,W,K,Q,Y,q,P,U,N,E,V,B,v,g,_,b,A,le,z,ae]),fe=d(()=>({setFolders:h,setFiles:p,setSelectedFolder:m,setSearchTerm:y,setSortField:w,setSortBy:S,setSortOrder:k,setPathHistory:T,setLoading:M,setPagination:de,setIsModalVisible:$,setIsUrlModalVisible:G,setIsRenameModalVisible:X,setIsMoveModalVisible:Z,setIsRenameFolderModalVisible:J,setIsCopyModalVisible:te,setIsDeleteConfirmVisible:ne,setFileToRename:oe,setFolderToRename:se,setUndoDeletion:ce,updatePathHistoryOnFolderRename:ue,setActiveLibraryItem:e=>L(C(e)?e:Jt),setCurrentMenuFile:O}),[de,C]),pe=d(()=>({state:he,actions:fe,options:r}),[fe,r,he]);return e(Fo.Provider,{value:pe,children:t})},Mo=()=>{const{options:e}=Oo(),{customIcons:t}=e,r=i.useCallback((e,r,n)=>{const o=null==t?void 0:t[e];return o?i.createElement(o,n):i.createElement(r,n)},[t]);return i.useMemo(()=>({RootFolderIcon:e=>r("rootFolder",pe,e),FolderIcon:e=>r("folder",Co,e),FolderOpenIcon:e=>r("folderOpen",fe,e),AddFolderIcon:e=>r("addFolder",he,e),FileIcon:e=>r("file",de,e),UploadIcon:e=>r("upload",ue,e),UploadByUrlIcon:e=>r("uploadByUrl",ce,e),ExpandArrowIcon:e=>r("expandArrow",le,e),CollapseArrowIcon:e=>r("collapseArrow",se,e),ExpandFolderIcon:e=>r("expandArrow",Ni,e),CollapseFolderIcon:e=>r("collapseArrow",Li,e),FolderPreviewIcon:e=>r("folderPreview",_o,e),EmptyFolderIcon:e=>r("folderPreview",So,e),GridViewIcon:e=>r("gridView",ae,e),ListViewIcon:e=>r("listView",oe,e),DropZoneFileIcon:e=>r("folderPreview",Ao,e),BigStockIcon:e=>r("folderPreview",ko,e),BigAIIcon:e=>r("folderPreview",Eo,e),GifPlayIcon:e=>r("folderPreview",Io,e),StockBigIcon:e=>r("folderPreview",To,e),MixedViewIcon:e=>r("mixedView",go,e),LandscapeViewIcon:e=>r("landscapeView",mo,e),PortraitViewIcon:e=>r("portraitView",vo,e),SquareViewIcon:e=>r("squareView",yo,e),LightModeIcon:e=>r("lightMode",wo,e),DarkModeIcon:e=>r("darkMode",xo,e),AiIcon_2:e=>r("aiIcon_2",bo,e),NoFilesIcon:e=>r("noFiles",ji,e),ThumbsUpIcon:e=>r("thumbsUp",Ki,e),getCustomIcon:r}),[r])};var Ro="noFilesContainer",Lo="noFilesImage",No="noFilesTitle",jo="noFilesDescription";const Do=()=>{const{t:r}=ri(),{NoFilesIcon:n}=Mo();return t("div",{className:Ro,children:[e(n,{className:Lo,size:48,strokeWidth:1.4}),e("h2",{className:No,children:r("There's nothing here")}),e("div",{className:jo,children:r("Try using a different search query.")})]})};var zo,Bo={exports:{}},Uo=Bo.exports;
2
- /**
3
- * @license
4
- * Lodash <https://lodash.com/>
5
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
6
- * Released under MIT license <https://lodash.com/license>
7
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9
- */var Vo=(zo||(zo=1,function(e,t){(function(){var r,n="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]",A="[object RegExp]",k="[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]",N="[object Int32Array]",j="[object Uint8Array]",D="[object Uint8ClampedArray]",z="[object Uint16Array]",B="[object Uint32Array]",U=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,$=/[&<>"']/g,q=RegExp(W.source),G=RegExp($.source),Y=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,J=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),re=/^\s+/,ne=/\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",Ae="\\ufe0e\\ufe0f",ke="\\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="["+ke+"]",Fe="["+xe+"]",Oe="\\d+",Pe="["+Ce+"]",Me="["+_e+"]",Re="[^"+we+ke+Oe+Ce+_e+Se+"]",Le="\\ud83c[\\udffb-\\udfff]",Ne="[^"+we+"]",je="(?:\\ud83c[\\udde6-\\uddff]){2}",De="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Ue="(?:"+Me+"|"+Re+")",Ve="(?:"+ze+"|"+Re+")",He="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",$e="(?:"+Fe+"|"+Le+")?",qe="["+Ae+"]?",Ge=qe+$e+"(?:"+Be+"(?:"+[Ne,je,De].join("|")+")"+qe+$e+")*",Ye="(?:"+[Pe,je,De].join("|")+")"+Ge,Xe="(?:"+[Ne+Fe+"?",Fe,je,De,Ie].join("|")+")",Ke=RegExp(Ee,"g"),Ze=RegExp(Fe,"g"),Qe=RegExp(Le+"(?="+Le+")|"+Xe+Ge,"g"),Je=RegExp([ze+"?"+Me+"+"+He+"(?="+[Te,ze,"$"].join("|")+")",Ve+"+"+We+"(?="+[Te,ze+Ue,"$"].join("|")+")",ze+"?"+Ue+"+"+He,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+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["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"],nt=-1,it={};it[P]=it[M]=it[R]=it[L]=it[N]=it[j]=it[D]=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[A]=it[k]=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[N]=ot[x]=ot[C]=ot[_]=ot[A]=ot[k]=ot[E]=ot[I]=ot[j]=ot[D]=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 Dn&&Dn&&Dn.Object===Object&&Dn,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,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function St(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(n,a,r(a),e)}return n}function At(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function kt(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Et(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function It(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}function Tt(e,t){return!(null==e||!e.length)&&zt(e,t,0)>-1}function Ft(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Ot(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Pt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Mt(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Rt(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Lt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Nt=Ht("length");function jt(e,t,r){var n;return r(e,function(e,r,i){if(t(e,r,i))return n=r,!1}),n}function Dt(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function zt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):Dt(e,Ut,r)}function Bt(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function Ut(e){return e!=e}function Vt(e,t){var r=null==e?0:e.length;return r?qt(e,t)/r:d}function Ht(e){return function(t){return null==t?r:t[e]}}function Wt(e){return function(t){return null==e?r:e[t]}}function $t(e,t,r,n,i){return i(e,function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)}),r}function qt(e,t){for(var n,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==r&&(n=n===r?a:n+a)}return n}function Gt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Yt(e){return e?e.slice(0,dr(e)+1).replace(re,""):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 Qt(e,t){for(var r=-1,n=e.length;++r<n&&zt(t,e[r],0)>-1;);return r}function Jt(e,t){for(var r=e.length;r--&&zt(t,e[r],0)>-1;);return r}var er=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"}),tr=Wt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function rr(e){return"\\"+at[e]}function nr(e){return et.test(e)}function ir(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function or(e,t){return function(r){return e(t(r))}}function ar(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var s=e[r];s!==t&&s!==o||(e[r]=o,a[i++]=r)}return a}function sr(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function lr(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=[e,e]}),r}function cr(e){return nr(e)?function(e){for(var t=Qe.lastIndex=0;Qe.test(e);)++t;return t}(e):Nt(e)}function ur(e){return nr(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.split("")}(e)}function dr(e){for(var t=e.length;t--&&ne.test(e.charAt(t)););return t}var hr=Wt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fr=function e(t){var ne,we=(t=null==t?dt:fr.defaults(dt.Object(),t,fr.pick(dt,rt))).Array,xe=t.Date,Ce=t.Error,_e=t.Function,Se=t.Math,Ae=t.Object,ke=t.RegExp,Ee=t.String,Ie=t.TypeError,Te=we.prototype,Fe=_e.prototype,Oe=Ae.prototype,Pe=t["__core-js_shared__"],Me=Fe.toString,Re=Oe.hasOwnProperty,Le=0,Ne=(ne=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||""))?"Symbol(src)_1."+ne:"",je=Oe.toString,De=Me.call(Ae),ze=dt._,Be=ke("^"+Me.call(Re).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=pt?t.Buffer:r,Ve=t.Symbol,He=t.Uint8Array,We=Ue?Ue.allocUnsafe:r,$e=or(Ae.getPrototypeOf,Ae),qe=Ae.create,Ge=Oe.propertyIsEnumerable,Ye=Te.splice,Xe=Ve?Ve.isConcatSpreadable:r,Qe=Ve?Ve.iterator:r,et=Ve?Ve.toStringTag:r,at=function(){try{var e=uo(Ae,"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=Ae.getOwnPropertySymbols,Nt=Ue?Ue.isBuffer:r,Wt=t.isFinite,pr=Te.join,gr=or(Ae.keys,Ae),mr=Se.max,vr=Se.min,yr=xe.now,br=t.parseInt,wr=Se.random,xr=Te.reverse,Cr=uo(t,"DataView"),_r=uo(t,"Map"),Sr=uo(t,"Promise"),Ar=uo(t,"Set"),kr=uo(t,"WeakMap"),Er=uo(Ae,"create"),Ir=kr&&new kr,Tr={},Fr=jo(Cr),Or=jo(_r),Pr=jo(Sr),Mr=jo(Ar),Rr=jo(kr),Lr=Ve?Ve.prototype:r,Nr=Lr?Lr.valueOf:r,jr=Lr?Lr.toString:r;function Dr(e){if(es(e)&&!Ha(e)&&!(e instanceof Vr)){if(e instanceof Ur)return e;if(Re.call(e,"__wrapped__"))return Do(e)}return new Ur(e)}var zr=function(){function e(){}return function(t){if(!Ja(t))return{};if(qe)return qe(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function Br(){}function Ur(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Vr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Hr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Wr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function $r(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function qr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new $r;++t<r;)this.add(e[t])}function Gr(e){var t=this.__data__=new Wr(e);this.size=t.size}function Yr(e,t){var r=Ha(e),n=!r&&Va(e),i=!r&&!n&&Ga(e),o=!r&&!n&&!i&&ls(e),a=r||n||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 Xr(e){var t=e.length;return t?e[Gn(0,t-1)]:r}function Kr(e,t){return Ro(Ii(e),an(t,0,e.length))}function Zr(e){return Ro(Ii(e))}function Qr(e,t,n){(n!==r&&!za(e[t],n)||n===r&&!(t in e))&&nn(e,t,n)}function Jr(e,t,n){var i=e[t];Re.call(e,t)&&za(i,n)&&(n!==r||t in e)||nn(e,t,n)}function en(e,t){for(var r=e.length;r--;)if(za(e[r][0],t))return r;return-1}function tn(e,t,r,n){return dn(e,function(e,i,o){t(n,e,r(e),o)}),n}function rn(e,t){return e&&Ti(t,Fs(t),e)}function nn(e,t,r){"__proto__"==t&&at?at(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function on(e,t){for(var n=-1,i=t.length,o=we(i),a=null==e;++n<i;)o[n]=a?r:As(e,t[n]);return o}function an(e,t,n){return e==e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function sn(e,t,n,i,o,a){var s,l=1&t,c=2&t,u=4&t;if(n&&(s=o?n(e,i,o,a):n(e)),s!==r)return s;if(!Ja(e))return e;var d=Ha(e);if(d){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(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,rn(s,e))}else{if(!ot[h])return o?e:{};s=function(e,t,r){var n,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 r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case P:case M:case R:case L:case N:case j:case D:case z:case B:return Si(e,r);case x:return new i;case C:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case k:return new i;case I:return n=e,Nr?Ae(Nr.call(n)):{}}}(e,h,l)}}a||(a=new Gr);var g=a.get(e);if(g)return g;a.set(e,s),os(e)?e.forEach(function(r){s.add(sn(r,t,n,r,e,a))}):ts(e)&&e.forEach(function(r,i){s.set(i,sn(r,t,n,i,e,a))});var y=d?r:(u?c?no:ro:c?Os:Fs)(e);return At(y||e,function(r,i){y&&(r=e[i=r]),Jr(s,i,sn(r,t,n,i,e,a))}),s}function ln(e,t,n){var i=n.length;if(null==e)return!i;for(e=Ae(e);i--;){var o=n[i],a=t[o],s=e[o];if(s===r&&!(o in e)||!a(s))return!1}return!0}function cn(e,t,i){if("function"!=typeof e)throw new Ie(n);return Fo(function(){e.apply(r,i)},t)}function un(e,t,r,n){var i=-1,o=Tt,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;r&&(t=Ot(t,Xt(r))),n?(o=Ft,a=!1):t.length>=200&&(o=Zt,a=!1,t=new qr(t));e:for(;++i<s;){var u=e[i],d=null==r?u:r(u);if(u=n||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,n)||l.push(u)}return l}Dr.templateSettings={escape:Y,evaluate:X,interpolate:K,variable:"",imports:{_:Dr}},Dr.prototype=Br.prototype,Dr.prototype.constructor=Dr,Ur.prototype=zr(Br.prototype),Ur.prototype.constructor=Ur,Vr.prototype=zr(Br.prototype),Vr.prototype.constructor=Vr,Hr.prototype.clear=function(){this.__data__=Er?Er(null):{},this.size=0},Hr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hr.prototype.get=function(e){var t=this.__data__;if(Er){var n=t[e];return n===i?r:n}return Re.call(t,e)?t[e]:r},Hr.prototype.has=function(e){var t=this.__data__;return Er?t[e]!==r:Re.call(t,e)},Hr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Er&&t===r?i:t,this},Wr.prototype.clear=function(){this.__data__=[],this.size=0},Wr.prototype.delete=function(e){var t=this.__data__,r=en(t,e);return!(r<0||(r==t.length-1?t.pop():Ye.call(t,r,1),--this.size,0))},Wr.prototype.get=function(e){var t=this.__data__,n=en(t,e);return n<0?r:t[n][1]},Wr.prototype.has=function(e){return en(this.__data__,e)>-1},Wr.prototype.set=function(e,t){var r=this.__data__,n=en(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},$r.prototype.clear=function(){this.size=0,this.__data__={hash:new Hr,map:new(_r||Wr),string:new Hr}},$r.prototype.delete=function(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t},$r.prototype.get=function(e){return lo(this,e).get(e)},$r.prototype.has=function(e){return lo(this,e).has(e)},$r.prototype.set=function(e,t){var r=lo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},qr.prototype.add=qr.prototype.push=function(e){return this.__data__.set(e,i),this},qr.prototype.has=function(e){return this.__data__.has(e)},Gr.prototype.clear=function(){this.__data__=new Wr,this.size=0},Gr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Gr.prototype.get=function(e){return this.__data__.get(e)},Gr.prototype.has=function(e){return this.__data__.has(e)},Gr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Wr){var n=r.__data__;if(!_r||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new $r(n)}return r.set(e,t),this.size=r.size,this};var dn=Pi(bn),hn=Pi(wn,!0);function fn(e,t){var r=!0;return dn(e,function(e,n,i){return r=!!t(e,n,i)}),r}function pn(e,t,n){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(l===r?s==s&&!ss(s):n(s,l)))var l=s,c=a}return c}function gn(e,t){var r=[];return dn(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function mn(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=vo),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?mn(s,t-1,r,n,i):Pt(i,s):n||(i[i.length]=s)}return i}var vn=Mi(),yn=Mi(!0);function bn(e,t){return e&&vn(e,t,Fs)}function wn(e,t){return e&&yn(e,t,Fs)}function xn(e,t){return It(t,function(t){return Ka(e[t])})}function Cn(e,t){for(var n=0,i=(t=yi(t,e)).length;null!=e&&n<i;)e=e[No(t[n++])];return n&&n==i?e:r}function _n(e,t,r){var n=t(e);return Ha(e)?n:Pt(n,r(e))}function Sn(e){return null==e?e===r?"[object Undefined]":"[object Null]":et&&et in Ae(e)?function(e){var t=Re.call(e,et),n=e[et];try{e[et]=r;var i=!0}catch(e){}var o=je.call(e);return i&&(t?e[et]=n:delete e[et]),o}(e):function(e){return je.call(e)}(e)}function An(e,t){return e>t}function kn(e,t){return null!=e&&Re.call(e,t)}function En(e,t){return null!=e&&t in Ae(e)}function In(e,t,n){for(var i=n?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=vr(d.length,c),l[s]=!n&&(t||o>=120&&d.length>=120)?new qr(s&&d):r}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=n||0!==p?p:0,!(f?Zt(f,g):i(u,g,n))){for(s=a;--s;){var m=l[s];if(!(m?Zt(m,g):i(e[s],g,n)))continue e}f&&f.push(g),u.push(p)}}return u}function Tn(e,t,n){var i=null==(e=Eo(e,t=yi(t,e)))?e:e[No(Xo(t))];return null==i?r:_t(i,e,n)}function Fn(e){return es(e)&&Sn(e)==p}function On(e,t,n,i,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,n,i,o,a){var s=Ha(e),l=Ha(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 Gr),s||ls(e)?eo(e,t,n,i,o,a):function(e,t,r,n,i,o,a){switch(r){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 He(e),new He(t)));case m:case v:case C:return za(+e,+t);case y:return e.name==t.name&&e.message==t.message;case A:case E:return e==t+"";case x:var s=ir;case k:var l=1&n;if(s||(s=sr),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;n|=2,a.set(e,t);var u=eo(s(e),s(t),n,i,o,a);return a.delete(e),u;case I:if(Nr)return Nr.call(e)==Nr.call(t)}return!1}(e,t,c,n,i,o,a);if(!(1&n)){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 Gr),o(S,T,n,i,a)}}return!!f&&(a||(a=new Gr),function(e,t,n,i,o,a){var s=1&n,l=ro(e),c=l.length,u=ro(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===r?y===b||o(y,b,n,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,n,i,o,a))}(e,t,n,i,On,o))}function Pn(e,t,n,i){var o=n.length,a=o,s=!i;if(null==e)return!a;for(e=Ae(e);o--;){var l=n[o];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var c=(l=n[o])[0],u=e[c],d=l[1];if(s&&l[2]){if(u===r&&!(c in e))return!1}else{var h=new Gr;if(i)var f=i(u,d,c,e,t,h);if(!(f===r?On(d,u,3,i,h):f))return!1}}return!0}function Mn(e){return!(!Ja(e)||(t=e,Ne&&Ne in t))&&(Ka(e)?Be:pe).test(jo(e));var t}function Rn(e){return"function"==typeof e?e:null==e?rl:"object"==typeof e?Ha(e)?Bn(e[0],e[1]):zn(e):dl(e)}function Ln(e){if(!_o(e))return gr(e);var t=[];for(var r in Ae(e))Re.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Nn(e){if(!Ja(e))return function(e){var t=[];if(null!=e)for(var r in Ae(e))t.push(r);return t}(e);var t=_o(e),r=[];for(var n in e)("constructor"!=n||!t&&Re.call(e,n))&&r.push(n);return r}function jn(e,t){return e<t}function Dn(e,t){var r=-1,n=$a(e)?we(e.length):[];return dn(e,function(e,i,o){n[++r]=t(e,i,o)}),n}function zn(e){var t=co(e);return 1==t.length&&t[0][2]?Ao(t[0][0],t[0][1]):function(r){return r===e||Pn(r,e,t)}}function Bn(e,t){return wo(e)&&So(t)?Ao(No(e),t):function(n){var i=As(n,e);return i===r&&i===t?ks(n,e):On(t,i,3)}}function Un(e,t,n,i,o){e!==t&&vn(t,function(a,s){if(o||(o=new Gr),Ja(a))!function(e,t,n,i,o,a,s){var l=Io(e,n),c=Io(t,n),u=s.get(c);if(u)Qr(e,n,u);else{var d=a?a(l,c,n+"",e,t,s):r,h=d===r;if(h){var f=Ha(c),p=!f&&Ga(c),g=!f&&!p&&ls(c);d=c,f||p||g?Ha(l)?d=l:qa(l)?d=Ii(l):p?(h=!1,d=Ci(c,!0)):g?(h=!1,d=Si(c,!0)):d=[]:ns(c)||Va(c)?(d=l,Va(l)?d=ms(l):Ja(l)&&!Ka(l)||(d=mo(c))):h=!1}h&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Qr(e,n,d)}}(e,t,s,n,Un,i,o);else{var l=i?i(Io(e,s),a,s+"",e,t,o):r;l===r&&(l=a),Qr(e,s,l)}},Os)}function Vn(e,t){var n=e.length;if(n)return yo(t+=t<0?n:0,n)?e[t]:r}function Hn(e,t,r){t=t.length?Ot(t,function(e){return Ha(e)?function(t){return Cn(t,1===e.length?e[0]:e)}:e}):[rl];var n=-1;t=Ot(t,Xt(so()));var i=Dn(e,function(e,r,i){var o=Ot(t,function(t){return t(e)});return{criteria:o,index:++n,value:e}});return function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(i,function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,a=i.length,s=r.length;++n<a;){var l=Ai(i[n],o[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)})}function Wn(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Cn(e,a);r(s,a)&&Qn(o,yi(a,e),s)}return o}function $n(e,t,r,n){var i=n?Bt:zt,o=-1,a=t.length,s=e;for(e===t&&(t=Ii(t)),r&&(s=Ot(e,Xt(r)));++o<a;)for(var l=0,c=t[o],u=r?r(c):c;(l=i(s,u,l,n))>-1;)s!==e&&Ye.call(s,l,1),Ye.call(e,l,1);return e}function qn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;yo(i)?Ye.call(e,i,1):ui(e,i)}}return e}function Gn(e,t){return e+gt(wr()*(t-e+1))}function Yn(e,t){var r="";if(!e||t<1||t>u)return r;do{t%2&&(r+=e),(t=gt(t/2))&&(e+=e)}while(t);return r}function Xn(e,t){return Oo(ko(e,t,rl),e+"")}function Kn(e){return Xr(zs(e))}function Zn(e,t){var r=zs(e);return Ro(r,an(t,0,r.length))}function Qn(e,t,n,i){if(!Ja(e))return e;for(var o=-1,a=(t=yi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var c=No(t[o]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=s){var d=l[c];(u=i?i(d,c,l):r)===r&&(u=Ja(d)?d:yo(t[o+1])?[]:{})}Jr(l,c,u),l=l[c]}return e}var Jn=Ir?function(e,t){return Ir.set(e,t),e}:rl,ei=at?function(e,t){return at(e,"toString",{configurable:!0,enumerable:!1,value:Js(t),writable:!0})}:rl;function ti(e){return Ro(zs(e))}function ri(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=we(i);++n<i;)o[n]=e[n+t];return o}function ni(e,t){var r;return dn(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function ii(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var o=n+i>>>1,a=e[o];null!==a&&!ss(a)&&(r?a<=t:a<t)?n=o+1:i=o}return i}return oi(e,t,rl,r)}function oi(e,t,n,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,l=null===t,c=ss(t),u=t===r;o<a;){var d=gt((o+a)/2),h=n(e[d]),f=h!==r,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 vr(a,4294967294)}function ai(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r],s=t?t(a):a;if(!r||!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(Ha(e))return Ot(e,li)+"";if(ss(e))return jr?jr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,r){var n=-1,i=Tt,o=e.length,a=!0,s=[],l=s;if(r)a=!1,i=Ft;else if(o>=200){var c=t?null:Yi(e);if(c)return sr(c);a=!1,i=Zt,l=new qr}else l=t?[]:s;e:for(;++n<o;){var u=e[n],d=t?t(u):u;if(u=r||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,r)||(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[No(Xo(t))]}function di(e,t,r,n){return Qn(e,t,r(Cn(e,t)),n)}function hi(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?ri(e,n?0:o,n?o+1:i):ri(e,n?o+1:0,n?i:o)}function fi(e,t){var r=e;return r instanceof Vr&&(r=r.value()),Mt(t,function(e,t){return t.func.apply(t.thisArg,Pt([e],t.args))},r)}function pi(e,t,r){var n=e.length;if(n<2)return n?ci(e[0]):[];for(var i=-1,o=we(n);++i<n;)for(var a=e[i],s=-1;++s<n;)s!=i&&(o[i]=un(o[i]||a,e[s],t,r));return ci(mn(o,1),t,r)}function gi(e,t,n){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var l=i<a?t[i]:r;n(s,e[i],l)}return s}function mi(e){return qa(e)?e:[]}function vi(e){return"function"==typeof e?e:rl}function yi(e,t){return Ha(e)?e:wo(e,t)?[e]:Lo(vs(e))}var bi=Xn;function wi(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ri(e,t,n)}var xi=ct||function(e){return dt.clearTimeout(e)};function Ci(e,t){if(t)return e.slice();var r=e.length,n=We?We(r):new e.constructor(r);return e.copy(n),n}function _i(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function Si(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Ai(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=ss(e),s=t!==r,l=null===t,c=t==t,u=ss(t);if(!l&&!u&&!a&&e>t||a&&s&&c&&!l&&!u||i&&s&&c||!n&&c||!o)return 1;if(!i&&!a&&!u&&e<t||u&&n&&o&&!i&&!a||l&&n&&o||!s&&o||!c)return-1}return 0}function ki(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,l=t.length,c=mr(o-a,0),u=we(l+c),d=!n;++s<l;)u[s]=t[s];for(;++i<a;)(d||i<o)&&(u[r[i]]=e[i]);for(;c--;)u[s++]=e[i++];return u}function Ei(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,l=-1,c=t.length,u=mr(o-s,0),d=we(u+c),h=!n;++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+r[a]]=e[i++]);return d}function Ii(e,t){var r=-1,n=e.length;for(t||(t=we(n));++r<n;)t[r]=e[r];return t}function Ti(e,t,n,i){var o=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var l=t[a],c=i?i(n[l],e[l],l,n,e):r;c===r&&(c=e[l]),o?nn(n,l,c):Jr(n,l,c)}return n}function Fi(e,t){return function(r,n){var i=Ha(r)?St:tn,o=t?t():{};return i(r,e,so(n,2),o)}}function Oi(e){return Xn(function(t,n){var i=-1,o=n.length,a=o>1?n[o-1]:r,s=o>2?n[2]:r;for(a=e.length>3&&"function"==typeof a?(o--,a):r,s&&bo(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=Ae(t);++i<o;){var l=n[i];l&&e(t,l,i,a)}return t})}function Pi(e,t){return function(r,n){if(null==r)return r;if(!$a(r))return e(r,n);for(var i=r.length,o=t?i:-1,a=Ae(r);(t?o--:++o<i)&&!1!==n(a[o],o,a););return r}}function Mi(e){return function(t,r,n){for(var i=-1,o=Ae(t),a=n(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===r(o[l],l,o))break}return t}}function Ri(e){return function(t){var n=nr(t=vs(t))?ur(t):r,i=n?n[0]:t.charAt(0),o=n?wi(n,1).join(""):t.slice(1);return i[e]()+o}}function Li(e){return function(t){return Mt(Ks(Vs(t).replace(Ke,"")),e,"")}}function Ni(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 r=zr(e.prototype),n=e.apply(r,t);return Ja(n)?n:r}}function ji(e){return function(t,n,i){var o=Ae(t);if(!$a(t)){var a=so(n,3);t=Fs(t),n=function(e){return a(o[e],e,o)}}var s=e(t,n,i);return s>-1?o[a?t[s]:s]:r}}function Di(e){return to(function(t){var i=t.length,o=i,a=Ur.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Ie(n);if(a&&!l&&"wrapper"==oo(s))var l=new Ur([],!0)}for(o=l?o:i;++o<i;){var c=oo(s=t[o]),u="wrapper"==c?io(s):r;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,r=e[0];if(l&&1==e.length&&Ha(r))return l.plant(r).value();for(var n=0,o=i?t[n].apply(this,e):r;++n<i;)o=t[n].call(this,o);return o}})}function zi(e,t,n,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?r:Ni(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 r=e.length,n=0;r--;)e[r]===t&&++n;return n}(b,x);if(i&&(b=ki(b,i,o,g)),a&&(b=Ei(b,a,l,g)),y-=C,g&&y<d){var _=ar(b,x);return qi(e,t,zi,s.placeholder,n,b,_,c,u,d-y)}var S=f?n:this,A=p?S[e]:e;return y=b.length,c?b=function(e,t){for(var n=e.length,i=vr(t.length,n),o=Ii(e);i--;){var a=t[i];e[i]=yo(a,n)?o[a]:r}return e}(b,c):m&&y>1&&b.reverse(),h&&u<y&&(b.length=u),this&&this!==dt&&this instanceof s&&(A=v||Ni(A)),A.apply(S,b)}}function Bi(e,t){return function(r,n){return function(e,t,r,n){return bn(e,function(e,i,o){t(n,r(e),i,o)}),n}(r,e,t(n),{})}}function Ui(e,t){return function(n,i){var o;if(n===r&&i===r)return t;if(n!==r&&(o=n),i!==r){if(o===r)return i;"string"==typeof n||"string"==typeof i?(n=li(n),i=li(i)):(n=si(n),i=si(i)),o=e(n,i)}return o}}function Vi(e){return to(function(t){return t=Ot(t,Xt(so())),Xn(function(r){var n=this;return e(t,function(e){return _t(e,n,r)})})})}function Hi(e,t){var n=(t=t===r?" ":li(t)).length;if(n<2)return n?Yn(t,e):t;var i=Yn(t,ft(e/cr(t)));return nr(t)?wi(ur(i),0,e).join(""):i.slice(0,e)}function Wi(e){return function(t,n,i){return i&&"number"!=typeof i&&bo(t,n,i)&&(n=i=r),t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,r,n){for(var i=-1,o=mr(ft((t-e)/(r||1)),0),a=we(o);o--;)a[n?o:++i]=e,e+=r;return a}(t,n,i=i===r?t<n?1:-1:hs(i),e)}}function $i(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=gs(t),r=gs(r)),e(t,r)}}function qi(e,t,n,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:r,h?l:r,h?r:s,h?r:l,c,u,d],p=n.apply(r,f);return xo(e)&&To(p,f),p.placeholder=i,Po(p,e,t)}function Gi(e){var t=Se[e];return function(e,r){if(e=gs(e),(r=null==r?0:vr(fs(r),292))&&Wt(e)){var n=(vs(e)+"e").split("e");return+((n=(vs(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Yi=Ar&&1/sr(new Ar([,-0]))[1]==c?function(e){return new Ar(e)}:sl;function Xi(e){return function(t){var r=po(t);return r==x?ir(t):r==k?lr(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(n);var g=c?c.length:0;if(g||(t&=-97,c=u=r),h=h===r?h:mr(fs(h),0),f=f===r?f:fs(f),g-=u?u.length:0,64&t){var m=c,v=u;c=u=r}var y=p?r:io(e),b=[e,t,i,c,u,m,v,d,h,f];if(y&&function(e,t){var r=e[1],n=t[1],i=r|n,a=i<131,c=n==s&&8==r||n==s&&r==l&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!a&&!c)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?ki(d,u,t[4]):u,e[4]=d?ar(e[3],o):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ei(d,u,t[6]):u,e[6]=d?ar(e[5],o):t[6]),(u=t[7])&&(e[7]=u),n&s&&(e[8]=null==e[8]?t[8]:vr(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]===r?p?0:e.length:mr(b[9]-g,0))&&24&t&&(t&=-25),t&&1!=t)w=8==t||16==t?function(e,t,n){var i=Ni(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?[]:ar(s,c);return(a-=u.length)<n?qi(e,t,zi,o.placeholder,r,s,u,r,r,n-a):_t(this&&this!==dt&&this instanceof o?i:e,this,s)}}(e,t,f):t!=a&&33!=t||u.length?zi.apply(r,b):function(e,t,r,n){var i=1&t,o=Ni(e);return function t(){for(var a=-1,s=arguments.length,l=-1,c=n.length,u=we(c+s),d=this&&this!==dt&&this instanceof t?o:e;++l<c;)u[l]=n[l];for(;s--;)u[l++]=arguments[++a];return _t(d,i?r:this,u)}}(e,t,i,c);else var w=function(e,t,r){var n=1&t,i=Ni(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,i);return Po((y?Jn:To)(w,b),e,t)}function Zi(e,t,n,i){return e===r||za(e,Oe[n])&&!Re.call(i,n)?t:e}function Qi(e,t,n,i,o,a){return Ja(e)&&Ja(t)&&(a.set(t,e),Un(e,t,r,Qi,a),a.delete(t)),e}function Ji(e){return ns(e)?r:e}function eo(e,t,n,i,o,a){var s=1&n,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&n?new qr:r;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!==r){if(v)continue;f=!1;break}if(p){if(!Lt(t,function(e,t){if(!Zt(p,t)&&(g===e||o(g,e,n,i,a)))return p.push(t)})){f=!1;break}}else if(g!==m&&!o(g,m,n,i,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function to(e){return Oo(ko(e,r,Wo),e+"")}function ro(e){return _n(e,Fs,ho)}function no(e){return _n(e,Os,fo)}var io=Ir?function(e){return Ir.get(e)}:sl;function oo(e){for(var t=e.name+"",r=Tr[t],n=Re.call(Tr,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function ao(e){return(Re.call(Dr,"placeholder")?Dr:e).placeholder}function so(){var e=Dr.iteratee||nl;return e=e===nl?Rn:e,arguments.length?e(arguments[0],arguments[1]):e}function lo(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function co(e){for(var t=Fs(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,So(i)]}return t}function uo(e,t){var n=function(e,t){return null==e?r:e[t]}(e,t);return Mn(n)?n:r}var ho=mt?function(e){return null==e?[]:(e=Ae(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=$e(e);return t}:pl,po=Sn;function go(e,t,r){for(var n=-1,i=(t=yi(t,e)).length,o=!1;++n<i;){var a=No(t[n]);if(!(o=null!=e&&r(e,a)))break;e=e[a]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&Qa(i)&&yo(a,i)&&(Ha(e)||Va(e))}function mo(e){return"function"!=typeof e.constructor||_o(e)?{}:zr($e(e))}function vo(e){return Ha(e)||Va(e)||!!(Xe&&e&&e[Xe])}function yo(e,t){var r=typeof e;return!!(t=null==t?u:t)&&("number"==r||"symbol"!=r&&me.test(e))&&e>-1&&e%1==0&&e<t}function bo(e,t,r){if(!Ja(r))return!1;var n=typeof t;return!!("number"==n?$a(r)&&yo(t,r.length):"string"==n&&t in r)&&za(r[t],e)}function wo(e,t){if(Ha(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ss(e))||Q.test(e)||!Z.test(e)||null!=t&&e in Ae(t)}function xo(e){var t=oo(e),r=Dr[t];if("function"!=typeof r||!(t in Vr.prototype))return!1;if(e===r)return!0;var n=io(r);return!!n&&e===n[0]}(Cr&&po(new Cr(new ArrayBuffer(1)))!=O||_r&&po(new _r)!=x||Sr&&po(Sr.resolve())!=S||Ar&&po(new Ar)!=k||kr&&po(new kr)!=T)&&(po=function(e){var t=Sn(e),n=t==_?e.constructor:r,i=n?jo(n):"";if(i)switch(i){case Fr:return O;case Or:return x;case Pr:return S;case Mr:return k;case Rr: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&&!Ja(e)}function Ao(e,t){return function(n){return null!=n&&n[e]===t&&(t!==r||e in Ae(n))}}function ko(e,t,n){return t=mr(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=mr(r.length-t,0),a=we(o);++i<o;)a[i]=r[t+i];i=-1;for(var s=we(t+1);++i<t;)s[i]=r[i];return s[t]=n(a),_t(e,this,s)}}function Eo(e,t){return t.length<2?e:Cn(e,ri(t,0,-1))}function Io(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var To=Mo(Jn),Fo=ht||function(e,t){return dt.setTimeout(e,t)},Oo=Mo(ei);function Po(e,t,r){var n=t+"";return Oo(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return At(f,function(r){var n="_."+r[0];t&r[1]&&!Tt(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(n),r)))}function Mo(e){var t=0,n=0;return function(){var i=yr(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Ro(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n<t;){var a=Gn(n,o),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var Lo=function(e){var t=Ma(e,function(e){return 500===r.size&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(J,function(e,r,n,i){t.push(n?i.replace(ce,"$1"):r||e)}),t});function No(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function jo(e){if(null!=e){try{return Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Do(e){if(e instanceof Vr)return e.clone();var t=new Ur(e.__wrapped__,e.__chain__);return t.__actions__=Ii(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var zo=Xn(function(e,t){return qa(e)?un(e,mn(t,1,qa,!0)):[]}),Bo=Xn(function(e,t){var n=Xo(t);return qa(n)&&(n=r),qa(e)?un(e,mn(t,1,qa,!0),so(n,2)):[]}),Uo=Xn(function(e,t){var n=Xo(t);return qa(n)&&(n=r),qa(e)?un(e,mn(t,1,qa,!0),r,n):[]});function Vo(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:fs(r);return i<0&&(i=mr(n+i,0)),Dt(e,so(t,3),i)}function Ho(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return n!==r&&(o=fs(n),o=n<0?mr(i+o,0):vr(o,i-1)),Dt(e,so(t,3),o,!0)}function Wo(e){return null!=e&&e.length?mn(e,1):[]}function $o(e){return e&&e.length?e[0]:r}var qo=Xn(function(e){var t=Ot(e,mi);return t.length&&t[0]===e[0]?In(t):[]}),Go=Xn(function(e){var t=Xo(e),n=Ot(e,mi);return t===Xo(n)?t=r:n.pop(),n.length&&n[0]===e[0]?In(n,so(t,2)):[]}),Yo=Xn(function(e){var t=Xo(e),n=Ot(e,mi);return(t="function"==typeof t?t:r)&&n.pop(),n.length&&n[0]===e[0]?In(n,r,t):[]});function Xo(e){var t=null==e?0:e.length;return t?e[t-1]:r}var Ko=Xn(Zo);function Zo(e,t){return e&&e.length&&t&&t.length?$n(e,t):e}var Qo=to(function(e,t){var r=null==e?0:e.length,n=on(e,t);return qn(e,Ot(t,function(e){return yo(e,r)?+e:e}).sort(Ai)),n});function Jo(e){return null==e?e:xr.call(e)}var ea=Xn(function(e){return ci(mn(e,1,qa,!0))}),ta=Xn(function(e){var t=Xo(e);return qa(t)&&(t=r),ci(mn(e,1,qa,!0),so(t,2))}),ra=Xn(function(e){var t=Xo(e);return t="function"==typeof t?t:r,ci(mn(e,1,qa,!0),r,t)});function na(e){if(!e||!e.length)return[];var t=0;return e=It(e,function(e){if(qa(e))return t=mr(e.length,t),!0}),Gt(t,function(t){return Ot(e,Ht(t))})}function ia(e,t){if(!e||!e.length)return[];var n=na(e);return null==t?n:Ot(n,function(e){return _t(t,r,e)})}var oa=Xn(function(e,t){return qa(e)?un(e,t):[]}),aa=Xn(function(e){return pi(It(e,qa))}),sa=Xn(function(e){var t=Xo(e);return qa(t)&&(t=r),pi(It(e,qa),so(t,2))}),la=Xn(function(e){var t=Xo(e);return t="function"==typeof t?t:r,pi(It(e,qa),r,t)}),ca=Xn(na),ua=Xn(function(e){var t=e.length,n=t>1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,ia(e,n)});function da(e){var t=Dr(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var fa=to(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return on(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Vr&&yo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:r}),new Ur(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(o)}),pa=Fi(function(e,t,r){Re.call(e,r)?++e[r]:nn(e,r,1)}),ga=ji(Vo),ma=ji(Ho);function va(e,t){return(Ha(e)?At:dn)(e,so(t,3))}function ya(e,t){return(Ha(e)?kt:hn)(e,so(t,3))}var ba=Fi(function(e,t,r){Re.call(e,r)?e[r].push(t):nn(e,r,[t])}),wa=Xn(function(e,t,r){var n=-1,i="function"==typeof t,o=$a(e)?we(e.length):[];return dn(e,function(e){o[++n]=i?_t(t,e,r):Tn(e,t,r)}),o}),xa=Fi(function(e,t,r){nn(e,r,t)});function Ca(e,t){return(Ha(e)?Ot:Dn)(e,so(t,3))}var _a=Fi(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]}),Sa=Xn(function(e,t){if(null==e)return[];var r=t.length;return r>1&&bo(e,t[0],t[1])?t=[]:r>2&&bo(t[0],t[1],t[2])&&(t=[t[0]]),Hn(e,mn(t,1),[])}),Aa=ut||function(){return dt.Date.now()};function ka(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Ki(e,s,r,r,r,r,t)}function Ea(e,t){var i;if("function"!=typeof t)throw new Ie(n);return e=fs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Ia=Xn(function(e,t,r){var n=1;if(r.length){var i=ar(r,ao(Ia));n|=a}return Ki(e,n,t,r,i)}),Ta=Xn(function(e,t,r){var n=3;if(r.length){var i=ar(r,ao(Ta));n|=a}return Ki(t,n,e,r,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(n);function g(t){var n=o,i=a;return o=a=r,d=t,l=e.apply(i,n)}function m(e){var n=e-u;return u===r||n>=t||n<0||f&&e-d>=s}function v(){var e=Aa();if(m(e))return y(e);c=Fo(v,function(e){var r=t-(e-u);return f?vr(r,s-(e-d)):r}(e))}function y(e){return c=r,p&&o?g(e):(o=a=r,l)}function b(){var e=Aa(),n=m(e);if(o=arguments,a=this,u=e,n){if(c===r)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===r&&(c=Fo(v,t)),l}return t=gs(t)||0,Ja(i)&&(h=!!i.leading,s=(f="maxWait"in i)?mr(gs(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),b.cancel=function(){c!==r&&xi(c),d=0,o=u=a=c=r},b.flush=function(){return c===r?l:y(Aa())},b}var Oa=Xn(function(e,t){return cn(e,1,t)}),Pa=Xn(function(e,t,r){return cn(e,gs(t)||0,r)});function Ma(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ie(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Ma.Cache||$r),r}function Ra(e){if("function"!=typeof e)throw new Ie(n);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=$r;var La=bi(function(e,t){var r=(t=1==t.length&&Ha(t[0])?Ot(t[0],Xt(so())):Ot(mn(t,1),Xt(so()))).length;return Xn(function(n){for(var i=-1,o=vr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return _t(e,this,n)})}),Na=Xn(function(e,t){var n=ar(t,ao(Na));return Ki(e,a,r,t,n)}),ja=Xn(function(e,t){var n=ar(t,ao(ja));return Ki(e,64,r,t,n)}),Da=to(function(e,t){return Ki(e,l,r,r,r,t)});function za(e,t){return e===t||e!=e&&t!=t}var Ba=$i(An),Ua=$i(function(e,t){return e>=t}),Va=Fn(function(){return arguments}())?Fn:function(e){return es(e)&&Re.call(e,"callee")&&!Ge.call(e,"callee")},Ha=we.isArray,Wa=vt?Xt(vt):function(e){return es(e)&&Sn(e)==F};function $a(e){return null!=e&&Qa(e.length)&&!Ka(e)}function qa(e){return es(e)&&$a(e)}var Ga=Nt||gl,Ya=yt?Xt(yt):function(e){return es(e)&&Sn(e)==v};function Xa(e){if(!es(e))return!1;var t=Sn(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ns(e)}function Ka(e){if(!Ja(e))return!1;var t=Sn(e);return t==b||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==fs(e)}function Qa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Ja(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 rs(e){return"number"==typeof e||es(e)&&Sn(e)==C}function ns(e){if(!es(e)||Sn(e)!=_)return!1;var t=$e(e);if(null===t)return!0;var r=Re.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Me.call(r)==De}var is=wt?Xt(wt):function(e){return es(e)&&Sn(e)==A},os=xt?Xt(xt):function(e){return es(e)&&po(e)==k};function as(e){return"string"==typeof e||!Ha(e)&&es(e)&&Sn(e)==E}function ss(e){return"symbol"==typeof e||es(e)&&Sn(e)==I}var ls=Ct?Xt(Ct):function(e){return es(e)&&Qa(e.length)&&!!it[Sn(e)]},cs=$i(jn),us=$i(function(e,t){return e<=t});function ds(e){if(!e)return[];if($a(e))return as(e)?ur(e):Ii(e);if(Qe&&e[Qe])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Qe]());var t=po(e);return(t==x?ir:t==k?sr: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),r=t%1;return t==t?r?t-r:t:0}function ps(e){return e?an(fs(e),0,h):0}function gs(e){if("number"==typeof e)return e;if(ss(e))return d;if(Ja(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ja(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var r=fe.test(e);return r||ge.test(e)?lt(e.slice(2),r?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)||$a(t))Ti(t,Fs(t),e);else for(var r in t)Re.call(t,r)&&Jr(e,r,t[r])}),bs=Oi(function(e,t){Ti(t,Os(t),e)}),ws=Oi(function(e,t,r,n){Ti(t,Os(t),e,n)}),xs=Oi(function(e,t,r,n){Ti(t,Fs(t),e,n)}),Cs=to(on),_s=Xn(function(e,t){e=Ae(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&bo(t[0],t[1],o)&&(i=1);++n<i;)for(var a=t[n],s=Os(a),l=-1,c=s.length;++l<c;){var u=s[l],d=e[u];(d===r||za(d,Oe[u])&&!Re.call(e,u))&&(e[u]=a[u])}return e}),Ss=Xn(function(e){return e.push(r,Qi),_t(Ms,r,e)});function As(e,t,n){var i=null==e?r:Cn(e,t);return i===r?n:i}function ks(e,t){return null!=e&&go(e,t,En)}var Es=Bi(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=r},Js(rl)),Is=Bi(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),Re.call(e,t)?e[t].push(r):e[t]=[r]},so),Ts=Xn(Tn);function Fs(e){return $a(e)?Yr(e):Ln(e)}function Os(e){return $a(e)?Yr(e,!0):Nn(e)}var Ps=Oi(function(e,t,r){Un(e,t,r)}),Ms=Oi(function(e,t,r,n){Un(e,t,r,n)}),Rs=to(function(e,t){var r={};if(null==e)return r;var n=!1;t=Ot(t,function(t){return t=yi(t,e),n||(n=t.length>1),t}),Ti(e,no(e),r),n&&(r=sn(r,7,Ji));for(var i=t.length;i--;)ui(r,t[i]);return r}),Ls=to(function(e,t){return null==e?{}:function(e,t){return Wn(e,t,function(t,r){return ks(e,r)})}(e,t)});function Ns(e,t){if(null==e)return{};var r=Ot(no(e),function(e){return[e]});return t=so(t),Wn(e,r,function(e,r){return t(e,r[0])})}var js=Xi(Fs),Ds=Xi(Os);function zs(e){return null==e?[]:Kt(e,Fs(e))}var Bs=Li(function(e,t,r){return t=t.toLowerCase(),e+(r?Us(t):t)});function Us(e){return Xs(vs(e).toLowerCase())}function Vs(e){return(e=vs(e))&&e.replace(ve,er).replace(Ze,"")}var Hs=Li(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),Ws=Li(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),$s=Ri("toLowerCase"),qs=Li(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Gs=Li(function(e,t,r){return e+(r?" ":"")+Xs(t)}),Ys=Li(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),Xs=Ri("toUpperCase");function Ks(e,t,n){return e=vs(e),(t=n?r:t)===r?function(e){return tt.test(e)}(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zs=Xn(function(e,t){try{return _t(e,r,t)}catch(e){return Xa(e)?e:new Ce(e)}}),Qs=to(function(e,t){return At(t,function(t){t=No(t),nn(e,t,Ia(e[t],e))}),e});function Js(e){return function(){return e}}var el=Di(),tl=Di(!0);function rl(e){return e}function nl(e){return Rn("function"==typeof e?e:sn(e,1))}var il=Xn(function(e,t){return function(r){return Tn(r,e,t)}}),ol=Xn(function(e,t){return function(r){return Tn(e,r,t)}});function al(e,t,r){var n=Fs(t),i=xn(t,n);null!=r||Ja(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=xn(t,Fs(t)));var o=!(Ja(r)&&"chain"in r&&!r.chain),a=Ka(e);return At(i,function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ii(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.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)?Ht(No(e)):function(e){return function(t){return Cn(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 Dr.after=function(e,t){if("function"!=typeof t)throw new Ie(n);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Dr.ary=ka,Dr.assign=ys,Dr.assignIn=bs,Dr.assignInWith=ws,Dr.assignWith=xs,Dr.at=Cs,Dr.before=Ea,Dr.bind=Ia,Dr.bindAll=Qs,Dr.bindKey=Ta,Dr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ha(e)?e:[e]},Dr.chain=da,Dr.chunk=function(e,t,n){t=(n?bo(e,t,n):t===r)?1:mr(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++]=ri(e,o,o+=t);return s},Dr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i},Dr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=we(e-1),r=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Pt(Ha(r)?Ii(r):[r],mn(t,1))},Dr.cond=function(e){var t=null==e?0:e.length,r=so();return e=t?Ot(e,function(e){if("function"!=typeof e[1])throw new Ie(n);return[r(e[0]),e[1]]}):[],Xn(function(r){for(var n=-1;++n<t;){var i=e[n];if(_t(i[0],this,r))return _t(i[1],this,r)}})},Dr.conforms=function(e){return function(e){var t=Fs(e);return function(r){return ln(r,e,t)}}(sn(e,1))},Dr.constant=Js,Dr.countBy=pa,Dr.create=function(e,t){var r=zr(e);return null==t?r:rn(r,t)},Dr.curry=function e(t,n,i){var o=Ki(t,8,r,r,r,r,r,n=i?r:n);return o.placeholder=e.placeholder,o},Dr.curryRight=function e(t,n,i){var o=Ki(t,16,r,r,r,r,r,n=i?r:n);return o.placeholder=e.placeholder,o},Dr.debounce=Fa,Dr.defaults=_s,Dr.defaultsDeep=Ss,Dr.defer=Oa,Dr.delay=Pa,Dr.difference=zo,Dr.differenceBy=Bo,Dr.differenceWith=Uo,Dr.drop=function(e,t,n){var i=null==e?0:e.length;return i?ri(e,(t=n||t===r?1:fs(t))<0?0:t,i):[]},Dr.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ri(e,0,(t=i-(t=n||t===r?1:fs(t)))<0?0:t):[]},Dr.dropRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!0,!0):[]},Dr.dropWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!0):[]},Dr.fill=function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&bo(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.length;for((n=fs(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:fs(i))<0&&(i+=o),i=n>i?0:ps(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Dr.filter=function(e,t){return(Ha(e)?It:gn)(e,so(t,3))},Dr.flatMap=function(e,t){return mn(Ca(e,t),1)},Dr.flatMapDeep=function(e,t){return mn(Ca(e,t),c)},Dr.flatMapDepth=function(e,t,n){return n=n===r?1:fs(n),mn(Ca(e,t),n)},Dr.flatten=Wo,Dr.flattenDeep=function(e){return null!=e&&e.length?mn(e,c):[]},Dr.flattenDepth=function(e,t){return null!=e&&e.length?mn(e,t=t===r?1:fs(t)):[]},Dr.flip=function(e){return Ki(e,512)},Dr.flow=el,Dr.flowRight=tl,Dr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Dr.functions=function(e){return null==e?[]:xn(e,Fs(e))},Dr.functionsIn=function(e){return null==e?[]:xn(e,Os(e))},Dr.groupBy=ba,Dr.initial=function(e){return null!=e&&e.length?ri(e,0,-1):[]},Dr.intersection=qo,Dr.intersectionBy=Go,Dr.intersectionWith=Yo,Dr.invert=Es,Dr.invertBy=Is,Dr.invokeMap=wa,Dr.iteratee=nl,Dr.keyBy=xa,Dr.keys=Fs,Dr.keysIn=Os,Dr.map=Ca,Dr.mapKeys=function(e,t){var r={};return t=so(t,3),bn(e,function(e,n,i){nn(r,t(e,n,i),e)}),r},Dr.mapValues=function(e,t){var r={};return t=so(t,3),bn(e,function(e,n,i){nn(r,n,t(e,n,i))}),r},Dr.matches=function(e){return zn(sn(e,1))},Dr.matchesProperty=function(e,t){return Bn(e,sn(t,1))},Dr.memoize=Ma,Dr.merge=Ps,Dr.mergeWith=Ms,Dr.method=il,Dr.methodOf=ol,Dr.mixin=al,Dr.negate=Ra,Dr.nthArg=function(e){return e=fs(e),Xn(function(t){return Vn(t,e)})},Dr.omit=Rs,Dr.omitBy=function(e,t){return Ns(e,Ra(so(t)))},Dr.once=function(e){return Ea(2,e)},Dr.orderBy=function(e,t,n,i){return null==e?[]:(Ha(t)||(t=null==t?[]:[t]),Ha(n=i?r:n)||(n=null==n?[]:[n]),Hn(e,t,n))},Dr.over=ll,Dr.overArgs=La,Dr.overEvery=cl,Dr.overSome=ul,Dr.partial=Na,Dr.partialRight=ja,Dr.partition=_a,Dr.pick=Ls,Dr.pickBy=Ns,Dr.property=dl,Dr.propertyOf=function(e){return function(t){return null==e?r:Cn(e,t)}},Dr.pull=Ko,Dr.pullAll=Zo,Dr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?$n(e,t,so(r,2)):e},Dr.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?$n(e,t,r,n):e},Dr.pullAt=Qo,Dr.range=hl,Dr.rangeRight=fl,Dr.rearg=Da,Dr.reject=function(e,t){return(Ha(e)?It:gn)(e,Ra(so(t,3)))},Dr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=so(t,3);++n<o;){var a=e[n];t(a,n,e)&&(r.push(a),i.push(n))}return qn(e,i),r},Dr.rest=function(e,t){if("function"!=typeof e)throw new Ie(n);return Xn(e,t=t===r?t:fs(t))},Dr.reverse=Jo,Dr.sampleSize=function(e,t,n){return t=(n?bo(e,t,n):t===r)?1:fs(t),(Ha(e)?Kr:Zn)(e,t)},Dr.set=function(e,t,r){return null==e?e:Qn(e,t,r)},Dr.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Qn(e,t,n,i)},Dr.shuffle=function(e){return(Ha(e)?Zr:ti)(e)},Dr.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&bo(e,t,n)?(t=0,n=i):(t=null==t?0:fs(t),n=n===r?i:fs(n)),ri(e,t,n)):[]},Dr.sortBy=Sa,Dr.sortedUniq=function(e){return e&&e.length?ai(e):[]},Dr.sortedUniqBy=function(e,t){return e&&e.length?ai(e,so(t,2)):[]},Dr.split=function(e,t,n){return n&&"number"!=typeof n&&bo(e,t,n)&&(t=n=r),(n=n===r?h:n>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=li(t))&&nr(e)?wi(ur(e),0,n):e.split(t,n):[]},Dr.spread=function(e,t){if("function"!=typeof e)throw new Ie(n);return t=null==t?0:mr(fs(t),0),Xn(function(r){var n=r[t],i=wi(r,0,t);return n&&Pt(i,n),_t(e,this,i)})},Dr.tail=function(e){var t=null==e?0:e.length;return t?ri(e,1,t):[]},Dr.take=function(e,t,n){return e&&e.length?ri(e,0,(t=n||t===r?1:fs(t))<0?0:t):[]},Dr.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ri(e,(t=i-(t=n||t===r?1:fs(t)))<0?0:t,i):[]},Dr.takeRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!1,!0):[]},Dr.takeWhile=function(e,t){return e&&e.length?hi(e,so(t,3)):[]},Dr.tap=function(e,t){return t(e),e},Dr.throttle=function(e,t,r){var i=!0,o=!0;if("function"!=typeof e)throw new Ie(n);return Ja(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Fa(e,t,{leading:i,maxWait:t,trailing:o})},Dr.thru=ha,Dr.toArray=ds,Dr.toPairs=js,Dr.toPairsIn=Ds,Dr.toPath=function(e){return Ha(e)?Ot(e,No):ss(e)?[e]:Ii(Lo(vs(e)))},Dr.toPlainObject=ms,Dr.transform=function(e,t,r){var n=Ha(e),i=n||Ga(e)||ls(e);if(t=so(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Ja(e)&&Ka(o)?zr($e(e)):{}}return(i?At:bn)(e,function(e,n,i){return t(r,e,n,i)}),r},Dr.unary=function(e){return ka(e,1)},Dr.union=ea,Dr.unionBy=ta,Dr.unionWith=ra,Dr.uniq=function(e){return e&&e.length?ci(e):[]},Dr.uniqBy=function(e,t){return e&&e.length?ci(e,so(t,2)):[]},Dr.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?ci(e,r,t):[]},Dr.unset=function(e,t){return null==e||ui(e,t)},Dr.unzip=na,Dr.unzipWith=ia,Dr.update=function(e,t,r){return null==e?e:di(e,t,vi(r))},Dr.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:di(e,t,vi(n),i)},Dr.values=zs,Dr.valuesIn=function(e){return null==e?[]:Kt(e,Os(e))},Dr.without=oa,Dr.words=Ks,Dr.wrap=function(e,t){return Na(vi(t),e)},Dr.xor=aa,Dr.xorBy=sa,Dr.xorWith=la,Dr.zip=ca,Dr.zipObject=function(e,t){return gi(e||[],t||[],Jr)},Dr.zipObjectDeep=function(e,t){return gi(e||[],t||[],Qn)},Dr.zipWith=ua,Dr.entries=js,Dr.entriesIn=Ds,Dr.extend=bs,Dr.extendWith=ws,al(Dr,Dr),Dr.add=vl,Dr.attempt=Zs,Dr.camelCase=Bs,Dr.capitalize=Us,Dr.ceil=yl,Dr.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=gs(n))==n?n:0),t!==r&&(t=(t=gs(t))==t?t:0),an(gs(e),t,n)},Dr.clone=function(e){return sn(e,4)},Dr.cloneDeep=function(e){return sn(e,5)},Dr.cloneDeepWith=function(e,t){return sn(e,5,t="function"==typeof t?t:r)},Dr.cloneWith=function(e,t){return sn(e,4,t="function"==typeof t?t:r)},Dr.conformsTo=function(e,t){return null==t||ln(e,t,Fs(t))},Dr.deburr=Vs,Dr.defaultTo=function(e,t){return null==e||e!=e?t:e},Dr.divide=bl,Dr.endsWith=function(e,t,n){e=vs(e),t=li(t);var i=e.length,o=n=n===r?i:an(fs(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},Dr.eq=za,Dr.escape=function(e){return(e=vs(e))&&G.test(e)?e.replace($,tr):e},Dr.escapeRegExp=function(e){return(e=vs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Dr.every=function(e,t,n){var i=Ha(e)?Et:fn;return n&&bo(e,t,n)&&(t=r),i(e,so(t,3))},Dr.find=ga,Dr.findIndex=Vo,Dr.findKey=function(e,t){return jt(e,so(t,3),bn)},Dr.findLast=ma,Dr.findLastIndex=Ho,Dr.findLastKey=function(e,t){return jt(e,so(t,3),wn)},Dr.floor=wl,Dr.forEach=va,Dr.forEachRight=ya,Dr.forIn=function(e,t){return null==e?e:vn(e,so(t,3),Os)},Dr.forInRight=function(e,t){return null==e?e:yn(e,so(t,3),Os)},Dr.forOwn=function(e,t){return e&&bn(e,so(t,3))},Dr.forOwnRight=function(e,t){return e&&wn(e,so(t,3))},Dr.get=As,Dr.gt=Ba,Dr.gte=Ua,Dr.has=function(e,t){return null!=e&&go(e,t,kn)},Dr.hasIn=ks,Dr.head=$o,Dr.identity=rl,Dr.includes=function(e,t,r,n){e=$a(e)?e:zs(e),r=r&&!n?fs(r):0;var i=e.length;return r<0&&(r=mr(i+r,0)),as(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&zt(e,t,r)>-1},Dr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:fs(r);return i<0&&(i=mr(n+i,0)),zt(e,t,i)},Dr.inRange=function(e,t,n){return t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,r){return e>=vr(t,r)&&e<mr(t,r)}(e=gs(e),t,n)},Dr.invoke=Ts,Dr.isArguments=Va,Dr.isArray=Ha,Dr.isArrayBuffer=Wa,Dr.isArrayLike=$a,Dr.isArrayLikeObject=qa,Dr.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sn(e)==m},Dr.isBuffer=Ga,Dr.isDate=Ya,Dr.isElement=function(e){return es(e)&&1===e.nodeType&&!ns(e)},Dr.isEmpty=function(e){if(null==e)return!0;if($a(e)&&(Ha(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==k)return!e.size;if(_o(e))return!Ln(e).length;for(var r in e)if(Re.call(e,r))return!1;return!0},Dr.isEqual=function(e,t){return On(e,t)},Dr.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?On(e,t,r,n):!!i},Dr.isError=Xa,Dr.isFinite=function(e){return"number"==typeof e&&Wt(e)},Dr.isFunction=Ka,Dr.isInteger=Za,Dr.isLength=Qa,Dr.isMap=ts,Dr.isMatch=function(e,t){return e===t||Pn(e,t,co(t))},Dr.isMatchWith=function(e,t,n){return n="function"==typeof n?n:r,Pn(e,t,co(t),n)},Dr.isNaN=function(e){return rs(e)&&e!=+e},Dr.isNative=function(e){if(Co(e))throw new Ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mn(e)},Dr.isNil=function(e){return null==e},Dr.isNull=function(e){return null===e},Dr.isNumber=rs,Dr.isObject=Ja,Dr.isObjectLike=es,Dr.isPlainObject=ns,Dr.isRegExp=is,Dr.isSafeInteger=function(e){return Za(e)&&e>=-9007199254740991&&e<=u},Dr.isSet=os,Dr.isString=as,Dr.isSymbol=ss,Dr.isTypedArray=ls,Dr.isUndefined=function(e){return e===r},Dr.isWeakMap=function(e){return es(e)&&po(e)==T},Dr.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Sn(e)},Dr.join=function(e,t){return null==e?"":pr.call(e,t)},Dr.kebabCase=Hs,Dr.last=Xo,Dr.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=fs(n))<0?mr(i+o,0):vr(o,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):Dt(e,Ut,o,!0)},Dr.lowerCase=Ws,Dr.lowerFirst=$s,Dr.lt=cs,Dr.lte=us,Dr.max=function(e){return e&&e.length?pn(e,rl,An):r},Dr.maxBy=function(e,t){return e&&e.length?pn(e,so(t,2),An):r},Dr.mean=function(e){return Vt(e,rl)},Dr.meanBy=function(e,t){return Vt(e,so(t,2))},Dr.min=function(e){return e&&e.length?pn(e,rl,jn):r},Dr.minBy=function(e,t){return e&&e.length?pn(e,so(t,2),jn):r},Dr.stubArray=pl,Dr.stubFalse=gl,Dr.stubObject=function(){return{}},Dr.stubString=function(){return""},Dr.stubTrue=function(){return!0},Dr.multiply=xl,Dr.nth=function(e,t){return e&&e.length?Vn(e,fs(t)):r},Dr.noConflict=function(){return dt._===this&&(dt._=ze),this},Dr.noop=sl,Dr.now=Aa,Dr.pad=function(e,t,r){e=vs(e);var n=(t=fs(t))?cr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Hi(gt(i),r)+e+Hi(ft(i),r)},Dr.padEnd=function(e,t,r){e=vs(e);var n=(t=fs(t))?cr(e):0;return t&&n<t?e+Hi(t-n,r):e},Dr.padStart=function(e,t,r){e=vs(e);var n=(t=fs(t))?cr(e):0;return t&&n<t?Hi(t-n,r)+e:e},Dr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),br(vs(e).replace(re,""),t||0)},Dr.random=function(e,t,n){if(n&&"boolean"!=typeof n&&bo(e,t,n)&&(t=n=r),n===r&&("boolean"==typeof t?(n=t,t=r):"boolean"==typeof e&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=hs(e),t===r?(t=e,e=0):t=hs(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=wr();return vr(e+o*(t-e+st("1e-"+((o+"").length-1))),t)}return Gn(e,t)},Dr.reduce=function(e,t,r){var n=Ha(e)?Mt:$t,i=arguments.length<3;return n(e,so(t,4),r,i,dn)},Dr.reduceRight=function(e,t,r){var n=Ha(e)?Rt:$t,i=arguments.length<3;return n(e,so(t,4),r,i,hn)},Dr.repeat=function(e,t,n){return t=(n?bo(e,t,n):t===r)?1:fs(t),Yn(vs(e),t)},Dr.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Dr.result=function(e,t,n){var i=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=r);++i<o;){var a=null==e?r:e[No(t[i])];a===r&&(i=o,a=n),e=Ka(a)?a.call(e):a}return e},Dr.round=Cl,Dr.runInContext=e,Dr.sample=function(e){return(Ha(e)?Xr:Kn)(e)},Dr.size=function(e){if(null==e)return 0;if($a(e))return as(e)?cr(e):e.length;var t=po(e);return t==x||t==k?e.size:Ln(e).length},Dr.snakeCase=qs,Dr.some=function(e,t,n){var i=Ha(e)?Lt:ni;return n&&bo(e,t,n)&&(t=r),i(e,so(t,3))},Dr.sortedIndex=function(e,t){return ii(e,t)},Dr.sortedIndexBy=function(e,t,r){return oi(e,t,so(r,2))},Dr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ii(e,t);if(n<r&&za(e[n],t))return n}return-1},Dr.sortedLastIndex=function(e,t){return ii(e,t,!0)},Dr.sortedLastIndexBy=function(e,t,r){return oi(e,t,so(r,2),!0)},Dr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ii(e,t,!0)-1;if(za(e[r],t))return r}return-1},Dr.startCase=Gs,Dr.startsWith=function(e,t,r){return e=vs(e),r=null==r?0:an(fs(r),0,e.length),t=li(t),e.slice(r,r+t.length)==t},Dr.subtract=_l,Dr.sum=function(e){return e&&e.length?qt(e,rl):0},Dr.sumBy=function(e,t){return e&&e.length?qt(e,so(t,2)):0},Dr.template=function(e,t,n){var i=Dr.templateSettings;n&&bo(e,t,n)&&(t=r),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=ke((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["+ ++nt+"]")+"\n";e.replace(f,function(t,r,n,i,s,l){return n||(n=i),h+=e.slice(u,l).replace(be,rr),r&&(o=!0,h+="' +\n__e("+r+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),n&&(h+="' +\n((__t = ("+n+")) == 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(H,"$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(r,c)});if(m.source=h,Xa(m))throw m;return m},Dr.times=function(e,t){if((e=fs(e))<1||e>u)return[];var r=h,n=vr(e,h);t=so(t),e-=h;for(var i=Gt(n,t);++r<e;)t(r);return i},Dr.toFinite=hs,Dr.toInteger=fs,Dr.toLength=ps,Dr.toLower=function(e){return vs(e).toLowerCase()},Dr.toNumber=gs,Dr.toSafeInteger=function(e){return e?an(fs(e),-9007199254740991,u):0===e?e:0},Dr.toString=vs,Dr.toUpper=function(e){return vs(e).toUpperCase()},Dr.trim=function(e,t,n){if((e=vs(e))&&(n||t===r))return Yt(e);if(!e||!(t=li(t)))return e;var i=ur(e),o=ur(t);return wi(i,Qt(i,o),Jt(i,o)+1).join("")},Dr.trimEnd=function(e,t,n){if((e=vs(e))&&(n||t===r))return e.slice(0,dr(e)+1);if(!e||!(t=li(t)))return e;var i=ur(e);return wi(i,0,Jt(i,ur(t))+1).join("")},Dr.trimStart=function(e,t,n){if((e=vs(e))&&(n||t===r))return e.replace(re,"");if(!e||!(t=li(t)))return e;var i=ur(e);return wi(i,Qt(i,ur(t))).join("")},Dr.truncate=function(e,t){var n=30,i="...";if(Ja(t)){var o="separator"in t?t.separator:o;n="length"in t?fs(t.length):n,i="omission"in t?li(t.omission):i}var a=(e=vs(e)).length;if(nr(e)){var s=ur(e);a=s.length}if(n>=a)return e;var l=n-cr(i);if(l<1)return i;var c=s?wi(s,0,l).join(""):e.slice(0,l);if(o===r)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=ke(o.source,vs(de.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var h=u.index;c=c.slice(0,h===r?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},Dr.unescape=function(e){return(e=vs(e))&&q.test(e)?e.replace(W,hr):e},Dr.uniqueId=function(e){var t=++Le;return vs(e)+t},Dr.upperCase=Ys,Dr.upperFirst=Xs,Dr.each=va,Dr.eachRight=ya,Dr.first=$o,al(Dr,(ml={},bn(Dr,function(e,t){Re.call(Dr.prototype,t)||(ml[t]=e)}),ml),{chain:!1}),Dr.VERSION="4.17.21",At(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Dr[e].placeholder=Dr}),At(["drop","take"],function(e,t){Vr.prototype[e]=function(n){n=n===r?1:mr(fs(n),0);var i=this.__filtered__&&!t?new Vr(this):this.clone();return i.__filtered__?i.__takeCount__=vr(n,i.__takeCount__):i.__views__.push({size:vr(n,h),type:e+(i.__dir__<0?"Right":"")}),i},Vr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),At(["filter","map","takeWhile"],function(e,t){var r=t+1,n=1==r||3==r;Vr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:so(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),At(["head","last"],function(e,t){var r="take"+(t?"Right":"");Vr.prototype[e]=function(){return this[r](1).value()[0]}}),At(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");Vr.prototype[e]=function(){return this.__filtered__?new Vr(this):this[r](1)}}),Vr.prototype.compact=function(){return this.filter(rl)},Vr.prototype.find=function(e){return this.filter(e).head()},Vr.prototype.findLast=function(e){return this.reverse().find(e)},Vr.prototype.invokeMap=Xn(function(e,t){return"function"==typeof e?new Vr(this):this.map(function(r){return Tn(r,e,t)})}),Vr.prototype.reject=function(e){return this.filter(Ra(so(e)))},Vr.prototype.slice=function(e,t){e=fs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=fs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vr.prototype.toArray=function(){return this.take(h)},bn(Vr.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Dr[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Dr.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,l=t instanceof Vr,c=s[0],u=l||Ha(t),d=function(e){var t=o.apply(Dr,Pt([e],s));return i&&h?t[0]:t};u&&n&&"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 Vr(this);var m=e.apply(t,s);return m.__actions__.push({func:ha,args:[d],thisArg:r}),new Ur(m,h)}return p&&g?e.apply(this,s):(m=this.thru(d),p?i?m.value()[0]:m.value():m)})}),At(["pop","push","shift","sort","splice","unshift"],function(e){var t=Te[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Dr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Ha(i)?i:[],e)}return this[r](function(r){return t.apply(Ha(r)?r:[],e)})}}),bn(Vr.prototype,function(e,t){var r=Dr[t];if(r){var n=r.name+"";Re.call(Tr,n)||(Tr[n]=[]),Tr[n].push({name:t,func:r})}}),Tr[zi(r,2).name]=[{name:"wrapper",func:r}],Vr.prototype.clone=function(){var e=new Vr(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},Vr.prototype.reverse=function(){if(this.__filtered__){var e=new Vr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Ha(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=vr(t,e+a);break;case"takeRight":e=mr(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,c=n?s:a-1,u=this.__iteratees__,d=u.length,h=0,f=vr(l,this.__takeCount__);if(!r||!n&&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},Dr.prototype.at=fa,Dr.prototype.chain=function(){return da(this)},Dr.prototype.commit=function(){return new Ur(this.value(),this.__chain__)},Dr.prototype.next=function(){this.__values__===r&&(this.__values__=ds(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},Dr.prototype.plant=function(e){for(var t,n=this;n instanceof Br;){var i=Do(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},Dr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vr){var t=e;return this.__actions__.length&&(t=new Vr(this)),(t=t.reverse()).__actions__.push({func:ha,args:[Jo],thisArg:r}),new Ur(t,this.__chain__)}return this.thru(Jo)},Dr.prototype.toJSON=Dr.prototype.valueOf=Dr.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Dr.prototype.first=Dr.prototype.head,Qe&&(Dr.prototype[Qe]=function(){return this}),Dr}();ft?((ft.exports=fr)._=fr,ht._=fr):dt._=fr}).call(Uo)}(Bo,Bo.exports)),Bo.exports);const Ho=e=>null===e.parentId||"null"===e.parentId||!e.parentId,Wo=async(e,t,r)=>{var n;if("file"===(null==t?void 0:t.itemType))return e;let i=[];if(!r)return e;{const e=await r({parentId:t.folderId});i=Array.isArray(e)?e:[]}let o=((e,t)=>{const r=Array.isArray(e)?e:[];return(n=t.folderId)&&"root"!==n&&"folders"!==n&&"null"!==n&&null!==n?r.filter(e=>e.parentId===t.folderId):r.filter(Ho);var n})(i,t);if(null===(n=null==t?void 0:t.search)||void 0===n?void 0:n.trim()){const e=t.search.trim().toLowerCase();o=o.filter(t=>{var r;return null===(r=t.name)||void 0===r?void 0:r.toLowerCase().includes(e)})}if(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:"",childCount:e.childCount}));if("folder"===(null==t?void 0:t.itemType))return a;const s=e.filter(e=>!e.isFolder);return[...a,...s]},$o=e=>{var t,r,n,i;const{state:o,actions:s,options:l}=Oo(),{searchTerm:d,sortBy:h,sortOrder:f,selectedFolder:p,pagination:g,pathHistory:m}=o,{setSearchTerm:v,setSortBy:y,setSortOrder:b,setPagination:w}=s,x=e||s.fetchFiles,C=u(null),_=u(Vo.debounce(e=>{const t=JSON.stringify(e);C.current!==t&&(C.current=t,null==x||x(e))},150)).current,S=c(()=>{const e=p||"";if(!e)return;const t=[...Array.isArray(m)?m:[]].reverse().find(t=>t.id===e);return null==t?void 0:t.name},[p,m]),A=c(()=>{var e;const t=null===(e=null==l?void 0:l.config)||void 0===e?void 0:e.disablePagination;return{folderId:p||"",folderName:S(),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,S,d,g.current,g.pageSize,h,f,null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.disablePagination]),k=c(e=>{var t,r;if(v&&v(e),w&&w({current:1,pageSize:g.pageSize,total:0}),x){const n={folderId:p||"",folderName:S(),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===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination)?void 0:g.pageSize,sortBy:h,sortOrder:f,itemType:"all"};x(n)}else console.error("🔎 useSortAndFilter: fetchFiles НЕ ОПРЕДЕЛЕНА!")},[v,w,g.pageSize,x,p,S,h,f,null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination]),E=c((e,t)=>{var r,n;null==y||y(e),null==b||b(t),x&&_({folderId:p||"",folderName:S(),search:(null==d?void 0:d.trim())||void 0,page:(null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination)?void 0:g.current,limit:(null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination)?void 0:g.pageSize,sortBy:e,sortOrder:t,itemType:"all"})},[y,b,_,p,S,d,g.current,g.pageSize,null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination]),I=c((e,t)=>{var r;(null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination)||(w&&w({current:e,pageSize:t||g.pageSize,total:g.total}),x&&_({folderId:p||"",folderName:S(),search:(null==d?void 0:d.trim())||void 0,page:e,limit:t||g.pageSize,sortBy:h,sortOrder:f,itemType:"all"}))},[w,g.pageSize,g.total,_,p,S,d,h,f,null===(i=null==l?void 0:l.config)||void 0===i?void 0:i.disablePagination]);return a(()=>{if(x){const e=A();_(Object.assign(Object.assign({},e),{page:1}))}},[p]),a(()=>{x&&_(A())},[]),a(()=>()=>{var e;null===(e=_.cancel)||void 0===e||e.call(_)},[_]),{state:{searchTerm:d||"",sortBy:h||"name",sortOrder:f||"asc"},actions:{setSearchTerm:v||(()=>{}),setSortBy:y||(()=>{}),setSortOrder:b||(()=>{}),handleSearch:k,handleSort:E,handlePaginationChange:I,getCurrentQueryParams:A}}},qo=new Map;function Go(e){const t="id"in e&&void 0!==e.id?String(e.id):"unknown",r="data"in e?e.data:void 0;return`${e.type}:${t}:${function(e){if(null==e)return"";try{return JSON.stringify(e,Object.keys(e).sort())}catch(t){return String(e)}}(r)}`}const Yo=()=>{var e,t;const{notification:r}=E.useApp(),n=Oo(),{options:i}=n,o=c(async e=>{let t;if(i.handleNotify){try{t=await i.handleNotify(e)}catch(e){console.error(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("error"===e.type&&i.handleError){try{t=await i.handleError(e)}catch(e){console.error(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("success"===e.type&&i.handleSuccess){try{t=await i.handleSuccess(e)}catch(e){console.error(e)}if(t)return!1}return t},[i]),a=c(async function(e,t=!1){var n,a,s,l;try{void 0===e.visibility&&(e.visibility=!t);const c=await o(e);"object"==typeof c&&(e=c);const u=null!==(a=null===(n=i.config)||void 0===n?void 0:n.notificationDedupeTtlMs)&&void 0!==a?a:12e3,d="error"===e.type&&!0===e.notificationDedupe;d&&function(e,t){if(t<=0)return;const r=Go(e),n=Date.now(),i=qo.get(r);void 0!==i&&n-i<t&&(e.visibility=!1)}(e,u);if(!(!1!==e.visibility&&!1!==c&&!1!==(null===(s=i.config)||void 0===s?void 0:s.showNotifications)))return e;const h=r[e.type];"function"==typeof h?(h(e),d&&(l=e,u<=0||qo.set(Go(l),Date.now()))):console.warn(`Unknown notification type: ${e.type}`,e)}catch(e){console.error(e)}return e},[r,o,null===(e=i.config)||void 0===e?void 0:e.notificationDedupeTtlMs,null===(t=i.config)||void 0===t?void 0:t.showNotifications]);return d(()=>({error:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"error"}),t),success:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"success"}),t),warning:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"warning"}),t),notify:a}),[a])},Xo={FileNotFound:"File not found or no longer available.",FileAlreadyExists:"File with this name already exists.",FileInvalidName:"File name is not valid. Allowed characters: {{allowedChars}}",FileAccessDenied:"You don't have permission to access this file.",FileReadError:"Failed to read the file.",FileWriteError:"Failed to write the file.",FileTooLarge:"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.",FileTypeNotAllowed:"This file type is not allowed.",FileCorrupted:"The file appears to be corrupted.",FileChecksumMismatch:"File integrity check failed.",FileStorageQuotaExceeded:"Storage quota exceeded. Please free up space.",FileLocked:"File is locked by another process or user.",FileVersionConflict:"File version conflict. Please refresh and try again.",FolderNotFound:"Folder not found or no longer available.",FolderAlreadyExists:"Folder with this name already exists.",FolderInvalidName:"Folder name is not valid. Allowed characters: {{allowedChars}}",FolderAccessDenied:"You don't have permission to access this folder.",FolderReadError:"Failed to read the folder contents.",FolderWriteError:"Failed to write to the folder.",FolderQuotaExceeded:"Folder storage quota exceeded.",FolderNotEmpty:"Folder is not empty.",FolderBackendError:"Server error while processing the folder.",FolderTimeout:"Folder operation took too long.",RenameNotAllowed:"Renaming is not allowed for this item.",MoveNotAllowed:"Moving is not allowed for this item.",CopyNotAllowed:"Copying is not allowed for this item.",DeleteNotAllowed:"Deleting is not allowed for this item.",MoveIntoSelf:"Cannot move an item into itself.",MoveIntoDescendant:"Cannot move an item into its descendant folder.",CopyIntoSelf:"Cannot copy an item into itself.",UnsupportedOperation:"This operation is not supported.",ConfigError:"Configuration error occurred.",FileUploadQuotaExceeded:"You have exceeded the upload quota.",FileUploadNetworkError:"Network error while uploading the file.",FileUploadTimeout:"File upload took too long.",FileUploadBackendError:"Server error while uploading the file.",UploadUrlInvalid:"The specified URL is not valid.",UploadUrlNotReachable:"The specified URL is not reachable.",UploadUrlContentTypeNotAllowed:"Content type at the URL is not allowed.",UploadUrlDownloadFailed:"Failed to download file from the URL.",FileLookupFailed:"Failed to find existing file by URL.",FileProxyFailed:"Failed to load file through proxy.",FileProxyNotConfigured:"File proxy is not configured.",FileDownloadNetworkError:"Network error while downloading the file.",FileDownloadTimeout:"File download took too long.",FileDownloadBackendError:"Server error while downloading the file.",BatchPartialFailure:"Some items could not be processed.",BatchAllFailed:"Failed to process all items in the batch.",BatchConflict:"Some items in the batch are in a conflicting state.",BatchValidationFailed:"Some items in the batch did not pass validation.",BatchItemLimitExceeded:"Batch operation exceeds the maximum number of items allowed.",ValidationError:"Some of the provided data is invalid.",PayloadTooLarge:"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.",UnsupportedMediaType:"This media type is not supported.",NetworkError:"Network error. Please check your connection and try again.",BackendError:"Server error. Please try again later.",Timeout:"The operation took too long. Please try again.",AuthenticationFailed:"Authentication failed. Please sign in again.",AuthorizationFailed:"You are not allowed to perform this action.",RateLimitExceeded:"Too many requests. Please try again a bit later.",ServiceUnavailable:"Service is temporarily unavailable. Please try again later.",AIResponseInvalid:"AI service returned an invalid response.",AIImageGenerationFailed:"Failed to generate image using AI.",AIImageGenerationLimitExceeded:"You have reached the AI image generation limit.",IntegrationError:"Error in external integration.",ThirdPartyError:"Error in a third-party service.",UnknownError:"An unknown error occurred."},Ko={FileTooLarge:"File is too large to upload.",PayloadTooLarge:"File is too large to upload."},Zo=(e,t,r)=>{var n,i,o;if(!e)return;const a=Xo[e];if(!a)return;const s=null!==(n=null==r?void 0:r.fileSize)&&void 0!==n?n:"",l=null!==(i=null==r?void 0:r.maxSize)&&void 0!==i?i:"";if(("FileTooLarge"===e||"PayloadTooLarge"===e)&&!(!!s&&!!l)){const r=Ko[e];return r?t(r):t(a,{fileSize:"?",maxSize:"?"})}return t(a,{allowedChars:null!==(o=null==r?void 0:r.allowedChars)&&void 0!==o?o:"a-z A-Z 0-9 . _ -",fileSize:s,maxSize:l})},Qo=e=>{if(!e||"string"!=typeof e)return;const t=e.toLowerCase();return(t.includes("maximum number of files")||t.includes("number of files exceeded"))&&(t.includes("allowed")||t.includes("received"))?"BatchItemLimitExceeded":t.includes("exceeds")||t.includes("maximum")||t.includes("too large")||t.includes("size limit")||t.includes("object size")||t.includes("размер")||t.includes("превышен")?"PayloadTooLarge":t.includes("403")||t.includes("forbidden")||t.includes("access denied")||t.includes("доступ запрещён")?"AuthorizationFailed":t.includes("404")||t.includes("not found")||t.includes("не найден")?"UploadUrlNotReachable":t.includes("already exists")||t.includes("уже существует")||t.includes("дубликат")?"FileAlreadyExists":t.includes("invalid")&&(t.includes("name")||t.includes("имя")||t.includes("назва"))?"FileInvalidName":t.includes("type")&&(t.includes("not allowed")||t.includes("не поддерживается"))?"FileTypeNotAllowed":void 0},Jo=e=>{var t,r,n,i,o,a,s,l,c,u,d,h,f,p,g,m,v,y;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!==(r=o.status)&&void 0!==r?r:o.httpStatus,stack:null!==(n=o.stack)&&void 0!==n?n:e.stack,raw:null!==(i=o.raw)&&void 0!==i?i:e}}if("object"==typeof e){const t=e,r=null!==(o=t.data)&&void 0!==o?o:t,n=null!==(a=null==r?void 0:r.data)&&void 0!==a?a:r,i=null!==(c=null!==(l=null!==(s=t.message)&&void 0!==s?s:null==r?void 0:r.message)&&void 0!==l?l:t.error)&&void 0!==c?c:t.reason,b=null!==(h=null!==(d=null!==(u=t.status)&&void 0!==u?u:t.httpStatus)&&void 0!==d?d:null==n?void 0:n.status)&&void 0!==h?h:null==r?void 0:r.status,w=null!==(f=t.code)&&void 0!==f?f:null==r?void 0:r.code,x=t.stack,C=null!==(p=t.raw)&&void 0!==p?p:e,_=null!==(m=null!==(g=t.fileSize)&&void 0!==g?g:null==n?void 0:n.fileSize)&&void 0!==m?m:null==r?void 0:r.fileSize,S=null!==(y=null!==(v=t.maxSize)&&void 0!==v?v:null==n?void 0:n.maxSize)&&void 0!==y?y:null==r?void 0:r.maxSize;if(i||w||b||x||C)return Object.assign(Object.assign({message:i,code:w,status:b,stack:x,raw:C},null!=_&&{fileSize:_}),null!=S&&{maxSize:S})}return{message:String(e),raw:e}};const ea=(e,t,r)=>{const n=Jo(e),i=null==n?void 0:n.code;if("FileTooLarge"===i&&null!=(null==r?void 0:r.fileSize)&&null!=(null==r?void 0:r.maxSize))return t("File too large ({{size}}). Maximum allowed size: {{maxSize}}",{size:Si(r.fileSize),maxSize:Si(r.maxSize)});if(("BatchItemLimitExceeded"===i||"exceeded_max_files"===i)&&(null==n?void 0:n.message)){const{allowed:e,received:r}=function(e){const t=e.match(/Allowed:\s*(\d+)/i),r=e.match(/received:\s*(\d+)/i);return{allowed:t?parseInt(t[1],10):void 0,received:r?parseInt(r[1],10):void 0}}(n.message);if(null!=e&&null!=r)return t("Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}",{allowed:e,received:r})}if((null==n?void 0:n.message)&&"Unknown error"!==n.message)return n.message;const o=null!=(null==r?void 0:r.fileSize)&&null!=(null==r?void 0:r.maxSize)?{fileSize:Si(r.fileSize),maxSize:Si(r.maxSize)}:void 0,a=Zo(i,t,o);return null!=a?a:t("Error uploading file")},ta=e=>{const t=Jo(e);return"path_folder_not_found"===(null==t?void 0:t.code)},ra=["file_get_contents","open stream","failed to open stream","http request failed","curl_error"];const na=(e,t,r)=>{var n;if(!e)return t("Error when downloading a file by URL");const i=null!==(n=(e=>{const t=Qo(e);if("AuthorizationFailed"===t){const t=(e||"").toLowerCase();if(t.includes("download")||t.includes("url")||t.includes("file_get_contents")||t.includes("failed to download"))return"UploadUrlNotReachable"}return t})(null==e?void 0:e.message))&&void 0!==n?n:null==e?void 0:e.code,o=Zo(i,t,r);if(o)return o;const a=(null==e?void 0:e.message)&&"string"==typeof e.message?e.message.trim():null;return a&&function(e){if(!e||e.length>200)return!1;const t=e.toLowerCase();return!ra.some(e=>t.includes(e))}(a)?a:t("Failed to download file from the URL.")},ia=e=>Array.isArray(e)?e.filter(e=>(null==e?void 0:e.id)&&"folders"!==e.id).map(e=>e.name).filter(Boolean).join("/"):"",oa=e=>{const t=e.trim();if(!t)return"";const r=t.toLowerCase(),n=[r.indexOf(" and "),r.indexOf(" or "),t.indexOf(","),t.indexOf(";"),r.indexOf(". ")].filter(e=>e>=0);if(0===n.length)return t;const i=Math.min(...n);return t.slice(0,i).trim()||t},aa=(e,t)=>{const r=(e=>{var t,r,n,i;if(e&&"object"==typeof e){const o=e,a=null!==(n=null===(r=null===(t=o.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.path_folder)&&void 0!==n?n:null===(i=o.data)||void 0===i?void 0:i.path_folder;if("string"==typeof a&&a.trim())return oa(a)||null}const o=Jo(e),a=null==o?void 0:o.message;if(!a)return null;const s=a.toLowerCase(),l=["не существует:","not exists:","not exist:","not found:"];for(const e of l){const t=s.indexOf(e);if(t>=0){const r=a.slice(t+e.length).trim();return oa(r)||null}}const c=["not exists ","not exist ","not found "];for(const e of c){const t=s.indexOf(e);if(t>=0){const r=a.slice(t+e.length).trim();return oa(r)||null}}return null})(e);return r?(e=>{const t=e.split("/").filter(Boolean);return t.length<=1?"":(t.pop(),t.join("/"))})(r):ia(t)},sa=async e=>{var t;const{options:r,pathFolder:n,dataProviders:i}=e;if(null==i?void 0:i.clearCache)return void await i.clearCache(n||null);const o=null===(t=null==r?void 0:r.apiEndpoints)||void 0===t?void 0:t.clearCache;if(!o)return;const a=o.includes("?");let s=o;n&&n.length>0&&(s=`${o}${a?"&":"?"}path_folder=${encodeURIComponent(n)}`);const l=await fetch(s,{method:"POST"});if(!l.ok)throw new Error(`Cache clear failed: ${l.status}`)},la=()=>{var e,t;const{state:r,actions:i,options:o}=Oo(),{t:a}=ri(),s=Yo(),{folders:l,selectedFolder:u,pathHistory:d,form:h,loading:f,isModalVisible:p}=r,{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(e=!1)=>{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 r=>{const{files:n}=await y.getFiles({itemType:"folder",folderId:null!=r?r:void 0}),i=w(n);if(t)return i;const o=await Promise.all(i.map(t=>e(t.id)));return[...i,...o.flat()]},r=await e(null);return void(g&&g(e=>{const n=Array.isArray(e)?e:[];if(!t){const e=r,t=e.filter(e=>e.id===e.parentId);return t.length>0&&console.warn("Folders with cyclic dependencies detected:",t),e}const i=n.filter(e=>e.parentId),o=[...i,...r],a=o.filter(e=>e.id===e.parentId);return a.length>0&&console.warn("Folders with cyclic dependencies detected:",a),o}))}return void console.error("DataProvider for folders is not defined")}{const r=!t;e=await y.getFolders({parentId:null,deep:r})}const r=Array.isArray(e)?e:[];null==g||g(r);const n=r.filter(e=>e.id===e.parentId);n.length>0&&console.warn("Folders with cyclic dependencies detected:",n)}catch(t){console.error("Error loading folders:",t);const r=Jo(t);if(!e&&(404===(null==r?void 0:r.status)||"FileNotFound"===(null==r?void 0:r.code))){const e=aa(t,d||[]);try{return await sa({options:o,pathFolder:e,dataProviders:null==o?void 0:o.dataProviders}),void await x(!0)}catch(e){console.error("Cache clear failed:",e)}}const n=Zo(null==r?void 0:r.code,a);s.error({id:"FOLDERS_FETCH_FAILED",message:null!=n?n:a("Failed to load folders"),description:a("Folders"),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{reason:t instanceof Error?t.message:String(t),folderId:null,folderName:a("Folders")}})}finally{null==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,d,o]),C=c(()=>x(),[x]),_=c(async e=>{try{let t,r;if(null==y?void 0:y.getFolders){t=await y.getFolders({parentId:e,deep:!1});const n=Array.isArray(l)?l:[],i=new Set(t.map(e=>e.id)),o=n.filter(t=>t.parentId!==e||i.has(t.id));r=[...o,...t.filter(e=>!o.some(t=>t.id===e.id))]}else{if(!(null==y?void 0:y.getFiles))return[];{const{files:n}=await y.getFiles({itemType:"folder",folderId:null!=e?e:void 0});t=w(n);const i=Array.isArray(l)?l:[],o=new Set(t.map(e=>e.id)),a=i.filter(t=>t.parentId!==e||o.has(t.id));r=[...a,...t.filter(e=>!a.some(t=>t.id===e.id))]}}let n=r,i=0;for(;i!==n.length;){i=n.length;const e=new Set(n.map(e=>e.id));n=n.filter(t=>!t.parentId||e.has(t.parentId))}return null==g||g(n),t}catch(e){return console.error("Error loading child folders:",e),[]}},[y,l,g,w]),S=c(()=>{var e;const t=null!==(e=null==b?void 0:b.defaultFolderName)&&void 0!==e?e:a("New folder");h.setFieldsValue({folderName:t}),null==v||v(!0)},[h,v,a,null==b?void 0:b.defaultFolderName]),A=c(async(e,t)=>{const r=[...(Array.isArray(l)?l:[]).filter(t=>t.id!==e.id),e];if(null==g||g(r),e.parentId&&(await _(e.parentId),await new Promise(e=>setTimeout(e,50))),!(null==t?void 0:t.preserveSelection)&&i.setSelectedFolder&&i.setSelectedFolder(e.id),!(null==t?void 0:t.preserveSelection)&&i.setPathHistory){const t=Array.isArray(r)?r:[],n=(e,r=new Set)=>{if(r.has(e))return console.warn(`Cycle detected in the path to the folder with id=${e}`),[];const i=t.find(t=>t.id===e);if(!i)return[];const o=new Set(r);return o.add(e),i.parentId?[...n(i.parentId,o),{id:i.id,name:i.name}]:[{id:i.id,name:i.name}]},o=n(e.id),s=[{id:"folders",name:a("Folders")},...o];i.setPathHistory(s)}},[l,g,i,r.pathHistory,_,a]),k=c(async e=>{try{if(null==y?void 0:y.getFolders){const t=await y.getFolders(),r=Array.isArray(t)?t:[];return r.some(t=>t.id===e)}if(null==y?void 0:y.getFiles){const t=new Set,r=async n=>{const{files:i}=await y.getFiles({itemType:"folder",folderId:null!=n?n:void 0}),o=w(i);for(const n of o){if(t.has(n.id))continue;if(t.add(n.id),n.id===e)return!0;if(await r(n.id))return!0}return!1};return await r(null)}}catch(e){console.warn("⚠️ Error checking the folder:",e)}return!1},[null==y?void 0:y.getFolders,null==y?void 0:y.getFiles,w]),E=c(async e=>{var t;let r,n,i=null;try{const o=await(e?e.validateFields():h.validateFields());if(r=o.folderName.trim(),!r){const e=o.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:r,folderId:null!=e?e:null,reason:"emptyName",is_force_create:!!o.is_force_create}})}n=$r(r,b);const c=o.targetFolder;if(c)i="folders"!==c?c:null;else if(u&&"folders"!==u)i=u;else if(Array.isArray(d)&&d.length>1){const e=d[d.length-1];i=(null==e?void 0:e.id)&&"folders"!==e.id?e.id:null}if(qr(b)&&(null==y?void 0:y.getFolders))try{const e=(await y.getFolders({parentId:i,deep:!1})||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean);if(e.includes(r.trim().toLowerCase()))return void s.error({id:"FOLDER_ALREADY_EXISTS",message:a("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:r,folderId:i}})}catch(e){}let f;if(!(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!=i?i:null,is_force_create:!!o.is_force_create}});f=await y.createFolder({name:n,parentId:i,is_force_create:!!o.is_force_create}),(e=>{if(!e||!e.id)throw new Error(a("Invalid server response: folder ID is missing"));if(e.id===e.parentId&&e.parentId)throw console.error("Circular dependency detected: folder cannot be its own parent"),new Error(a("Error: folder cannot be its own parent"))})(f);const p={id:f.id,name:f.name,parentId:null!=i?i:null,childCount:f.childCount},m=[...(Array.isArray(l)?l:[]).filter(e=>e.id!==p.id),p];if(null==g||g(m),s.success({id:"FOLDER_CREATE_SUCCESS",message:a("Folder created"),placement:"bottomRight",data:{itemIds:[p.id],folderId:null!==(t=p.parentId)&&void 0!==t?t:null,folderName:p.name}}),e||null==v||v(!1),(async()=>{try{await A(p,{preserveSelection:Boolean(e)}),await C(),await new Promise(e=>setTimeout(e,200));await k(f.id)||console.warn("⚠️ Could not confirm the creation of the folder on the server, but continuing...")}catch(e){console.error("Error performing background operations after creating the folder:",e)}})(),e)return f}catch(e){console.error("❌ Error creating the folder:",e);const t=Jo(e),o=Zo(null==t?void 0:t.code,a);s.error({id:"FOLDER_CREATE_FAILED",message:null!=o?o:a("Failed to create folder"),placement:"bottomRight",innerException:e,data:{folderName:n||r,folderId:null!=i?i:null,reason:e instanceof Error?e.message:String(e)}})}},[h,u,y,A,C,k,v,s,a,l,g,b,d]),I=c(()=>{null==v||v(!1)},[v]),T=c((e,t=new Set)=>{const r=Array.isArray(l)?l:[];return e.map(e=>{if(t.has(e.id))return console.warn(`Cycle detected in the folder structure with id=${e.id}. Skipping child elements processing.`),{key:e.id,label:e.name+" "+a("(error)"),icon:n.createElement(pe,{style:{color:"red"}})};const i=new Set(t);i.add(e.id);const o=r.filter(t=>t.parentId===e.id&&t.id!==e.id);return{key:e.id,label:e.name,children:o.length>0?T(o,i):void 0}})},[l]),F=c(()=>{const e=Array.isArray(l)?l:[],t={key:"folders",label:a("Folders"),children:[]},r=e.filter(e=>null===e.parentId||!e.parentId);return t.children=T(r),[t]},[l,a,T]),O=c(async(e,t)=>{var r,n,c,u;let d;try{const h=t.trim(),f=null==l?void 0:l.find(t=>t.id===e);if(!h)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"}});d=$r(h,b);if(!(!1!==(null===(r=null==b?void 0:b.features)||void 0===r?void 0:r.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!==(n=null==f?void 0:f.name)&&void 0!==n?n: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 p=await o.dataProviders.renameFolder(e,d);if(!(null==p?void 0:p.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 C(),e!==p.id&&i.setSelectedFolder&&i.setSelectedFolder(p.id),s.success({id:"FOLDER_RENAME_SUCCESS",message:a("Folder renamed"),placement:"bottomRight",data:{itemId:p.id,itemName:p.name,folderId:null!==(u=p.parentId)&&void 0!==u?u:null}})}catch(r){console.error("Error renaming the folder:",r),s.error({id:"FOLDER_RENAME_FAILED",message:a("Failed to rename folder"),placement:"bottomRight",innerException:r,data:{itemId:e,itemName:d||t,error:{message:r instanceof Error?r.message:String(r)}}})}},[C,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,b,i.setSelectedFolder,s,a]);return{state:{folders:l,isCreatingFolder:p,loading:f},actions:{fetchFolders:C,fetchChildFolders:_,handleCreateFolder:S,handleModalOk:E,handleModalCancel:I,generateMenuItems:F,renameFolder:O}}},ca=()=>{const{options:e,actions:t}=Oo(),{dataProviders:r,config:n}=e,{setUndoDeletion:i}=t,{t:o}=ri(),a=Yo(),s=c(async({items:e,selectedFolder:t,getItemNameById:s,showNotifications:l=!1})=>{let c=0,u=0;const d=[],h=async t=>{if(null==r?void 0:r.deleteItems)try{const n=await r.deleteItems(e.map(e=>e.id),{permanent:t}),i=n.detailed;if(i){const e=i.filter(e=>e.success),t=i.filter(e=>!e.success),r=t.filter(e=>{var t;const r=null!==(t=e.innerException)&&void 0!==t?t:e.error;return ta(r)}),n=t.filter(e=>{var t;const r=null!==(t=e.innerException)&&void 0!==t?t:e.error;return!ta(r)});return c+=e.length+r.length,u+=n.length,void n.forEach(e=>{var t;const r=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),n=null!==(t=e.innerException)&&void 0!==t?t:e.error,i=Jo(n);d.push({itemId:r,itemName:s(r),error:i})})}if(n.success)c+=e.length;else{const t=n.error;if(ta(t))c+=e.length;else if(t){u+=e.length;const r=Jo(t);d.push({error:r})}else u+=e.length}return}catch(r){if(ta(r))c+=e.length;else{const n=t?"Ошибка при удалении":"Ошибка при перемещении в корзину";console.error(n,r),u+=e.length;const i=Jo(r);d.push({error:i})}}const n=t?"DataProvider для удаления файлов не настроен":"DataProvider для перемещения не настроен";console.warn(n)},f=(null==n?void 0:n.enableTrashFolder)&&"Trash"===t;return(null==n?void 0:n.enableTrashFolder)&&!f?await h(!1):await h(!0),c>0&&(null==n?void 0:n.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}},[r,n,i,o,a]);return{deleteItems:s}};class ua extends Error{constructor(e,t,r,n){super(e),this.code=t,this.status=r,this.details=n,this.name="FileManagerApiError",Error.captureStackTrace&&Error.captureStackTrace(this,ua)}}const da=/^(localhost|127\.0\.0\.1|0\.0\.0\.0|::1)$/i,ha=/^(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.)/;function fa(e,t){const r=e.trim();if(!r)throw new ua(t("Enter the URL of the image"),"UploadUrlInvalid");if(r.length>8192)throw new ua(t("URL too long"),"UploadUrlInvalid");let n;try{n=new URL(r)}catch(e){throw new ua(t("The specified URL is not valid."),"UploadUrlInvalid")}const i=n.protocol.toLowerCase();if("http:"!==i&&"https:"!==i)throw new ua(t("Only http and https URLs are supported"),"UploadUrlInvalid");const o=n.hostname.toLowerCase();if(da.test(o)&&("undefined"==typeof window||!da.test(window.location.hostname.toLowerCase())))throw new ua(t("Private and local URLs are not allowed"),"UploadUrlInvalid");if(ha.test(o))throw new ua(t("Private and local URLs are not allowed"),"UploadUrlInvalid")}function pa(e,t){return new Promise(function(r,n){let i;return ga(e).then(function(e){try{return i=e,r(new Blob([t.slice(0,2),i,t.slice(2)],{type:"image/jpeg"}))}catch(e){return n(e)}},n)})}const ga=e=>new Promise((t,r)=>{const n=new FileReader;n.addEventListener("load",({target:{result:e}})=>{const n=new DataView(e);let i=0;if(65496!==n.getUint16(i))return r("not a valid JPEG");for(i+=2;;){const o=n.getUint16(i);if(65498===o)break;const a=n.getUint16(i+2);if(65505===o&&1165519206===n.getUint32(i+4)){const o=i+10;let s;switch(n.getUint16(o)){case 18761:s=!0;break;case 19789:s=!1;break;default:return r("TIFF header contains invalid endian")}if(42!==n.getUint16(o+2,s))return r("TIFF header contains invalid version");const l=n.getUint32(o+4,s),c=o+l+2+12*n.getUint16(o+l,s);for(let e=o+l+2;e<c;e+=12)if(274==n.getUint16(e,s)){if(3!==n.getUint16(e+2,s))return r("Orientation data type is invalid");if(1!==n.getUint32(e+4,s))return r("Orientation data count is invalid");n.setUint16(e+8,1,s);break}return t(e.slice(i,i+2+a))}i+=2+a}return t(new Blob)}),n.readAsArrayBuffer(e)});var ma={},va={get exports(){return ma},set exports(e){ma=e}};!function(){var e,t,r={};va.exports=r,r.parse=function(e,t){for(var n=r.bin.readUshort,i=r.bin.readUint,o=0,a={},s=new Uint8Array(e),l=s.length-4;101010256!=i(s,l);)l--;o=l,o+=4;var c=n(s,o+=4);n(s,o+=2);var u=i(s,o+=2),d=i(s,o+=4);o+=4,o=d;for(var h=0;h<c;h++){i(s,o),o+=4,o+=4,o+=4,i(s,o+=4),u=i(s,o+=4);var f=i(s,o+=4),p=n(s,o+=4),g=n(s,o+2),m=n(s,o+4);o+=6;var v=i(s,o+=8);o+=4,o+=p+g+m,r._readLocal(s,v,a,u,f,t)}return a},r._readLocal=function(e,t,n,i,o,a){var s=r.bin.readUshort,l=r.bin.readUint;l(e,t),s(e,t+=4),s(e,t+=2);var c=s(e,t+=2);l(e,t+=2),l(e,t+=4),t+=4;var u=s(e,t+=8),d=s(e,t+=2);t+=2;var h=r.bin.readUTF8(e,t,u);if(t+=u,t+=d,a)n[h]={size:o,csize:i};else{var f=new Uint8Array(e.buffer,t);if(0==c)n[h]=new Uint8Array(f.buffer.slice(t,t+i));else{if(8!=c)throw"unknown compression method: "+c;var p=new Uint8Array(o);r.inflateRaw(f,p),n[h]=p}}},r.inflateRaw=function(e,t){return r.F.inflate(e,t)},r.inflate=function(e,t){return e[0],e[1],r.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},r.deflate=function(e,t){null==t&&(t={level:6});var n=0,i=new Uint8Array(50+Math.floor(1.1*e.length));i[n]=120,i[n+1]=156,n+=2,n=r.F.deflateRaw(e,i,n,t.level);var o=r.adler(e,0,e.length);return i[n+0]=o>>>24&255,i[n+1]=o>>>16&255,i[n+2]=o>>>8&255,i[n+3]=o>>>0&255,new Uint8Array(i.buffer,0,n+4)},r.deflateRaw=function(e,t){null==t&&(t={level:6});var n=new Uint8Array(50+Math.floor(1.1*e.length)),i=r.F.deflateRaw(e,n,i,t.level);return new Uint8Array(n.buffer,0,i)},r.encode=function(e,t){null==t&&(t=!1);var n=0,i=r.bin.writeUint,o=r.bin.writeUshort,a={};for(var s in e){var l=!r._noNeed(s)&&!t,c=e[s],u=r.crc.crc(c,0,c.length);a[s]={cpr:l,usize:c.length,crc:u,file:l?r.deflateRaw(c):c}}for(var s in a)n+=a[s].file.length+30+46+2*r.bin.sizeUTF8(s);n+=22;var d=new Uint8Array(n),h=0,f=[];for(var s in a){var p=a[s];f.push(h),h=r._writeHeader(d,h,s,p,0)}var g=0,m=h;for(var s in a)p=a[s],f.push(h),h=r._writeHeader(d,h,s,p,1,f[g++]);var v=h-m;return i(d,h,101010256),h+=4,o(d,h+=4,g),o(d,h+=2,g),i(d,h+=2,v),i(d,h+=4,m),h+=4,h+=2,d.buffer},r._noNeed=function(e){var t=e.split(".").pop().toLowerCase();return-1!="png,jpg,jpeg,zip".indexOf(t)},r._writeHeader=function(e,t,n,i,o,a){var s=r.bin.writeUint,l=r.bin.writeUshort,c=i.file;return s(e,t,0==o?67324752:33639248),t+=4,1==o&&(t+=2),l(e,t,20),l(e,t+=2,0),l(e,t+=2,i.cpr?8:0),s(e,t+=2,0),s(e,t+=4,i.crc),s(e,t+=4,c.length),s(e,t+=4,i.usize),l(e,t+=4,r.bin.sizeUTF8(n)),l(e,t+=2,0),t+=2,1==o&&(t+=2,t+=2,s(e,t+=6,a),t+=4),t+=r.bin.writeUTF8(e,t,n),0==o&&(e.set(c,t),t+=c.length),t},r.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var r=t,n=0;n<8;n++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r}return e}(),update:function(e,t,n,i){for(var o=0;o<i;o++)e=r.crc.table[255&(e^t[n+o])]^e>>>8;return e},crc:function(e,t,n){return 4294967295^r.crc.update(4294967295,e,t,n)}},r.adler=function(e,t,r){for(var n=1,i=0,o=t,a=t+r;o<a;){for(var s=Math.min(o+5552,a);o<s;)i+=n+=e[o++];n%=65521,i%=65521}return i<<16|n},r.bin={readUshort:function(e,t){return e[t]|e[t+1]<<8},writeUshort:function(e,t,r){e[t]=255&r,e[t+1]=r>>8&255},readUint:function(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])},writeUint:function(e,t,r){e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255},readASCII:function(e,t,r){for(var n="",i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n},writeASCII:function(e,t,r){for(var n=0;n<r.length;n++)e[t+n]=r.charCodeAt(n)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,n){for(var i,o="",a=0;a<n;a++)o+="%"+r.bin.pad(e[t+a].toString(16));try{i=decodeURIComponent(o)}catch(i){return r.bin.readASCII(e,t,n)}return i},writeUTF8:function(e,t,r){for(var n=r.length,i=0,o=0;o<n;o++){var a=r.charCodeAt(o);if(4294967168&a)if(4294965248&a)if(4294901760&a){if(4292870144&a)throw"e";e[t+i]=240|a>>18,e[t+i+1]=128|a>>12&63,e[t+i+2]=128|a>>6&63,e[t+i+3]=128|63&a,i+=4}else e[t+i]=224|a>>12,e[t+i+1]=128|a>>6&63,e[t+i+2]=128|63&a,i+=3;else e[t+i]=192|a>>6,e[t+i+1]=128|63&a,i+=2;else e[t+i]=a,i++}return i},sizeUTF8:function(e){for(var t=e.length,r=0,n=0;n<t;n++){var i=e.charCodeAt(n);if(4294967168&i)if(4294965248&i)if(4294901760&i){if(4292870144&i)throw"e";r+=4}else r+=3;else r+=2;else r++}return r}},r.F={},r.F.deflateRaw=function(e,t,n,i){var o=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],a=r.F.U,s=r.F._goodIndex;r.F._hash;var l=r.F._putsE,c=0,u=n<<3,d=0,h=e.length;if(0==i){for(;c<h;)l(t,u,c+(S=Math.min(65535,h-c))==h?1:0),u=r.F._copyExact(e,c,S,t,u+8),c+=S;return u>>>3}var f=a.lits,p=a.strt,g=a.prev,m=0,v=0,y=0,b=0,w=0,x=0;for(h>2&&(p[x=r.F._hash(e,0)]=0),c=0;c<h;c++){if(w=x,c+1<h-2){x=r.F._hash(e,c+1);var C=c+1&32767;g[C]=p[x],p[x]=C}if(d<=c){(m>14e3||v>26697)&&h-c>100&&(d<c&&(f[m]=c-d,m+=2,d=c),u=r.F._writeBlock(c==h-1||d==h?1:0,f,m,b,e,y,c-y,t,u),m=v=b=0,y=c);var _=0;c<h-2&&(_=r.F._bestMatch(e,c,g,w,Math.min(o[2],h-c),o[3]));var S=_>>>16,A=65535&_;if(0!=_){A=65535&_;var k=s(S=_>>>16,a.of0);a.lhst[257+k]++;var E=s(A,a.df0);a.dhst[E]++,b+=a.exb[k]+a.dxb[E],f[m]=S<<23|c-d,f[m+1]=A<<16|k<<8|E,m+=2,d=c+S}else a.lhst[e[c]]++;v++}}for(y==c&&0!=e.length||(d<c&&(f[m]=c-d,m+=2,d=c),u=r.F._writeBlock(1,f,m,b,e,y,c-y,t,u),m=0,v=0,m=v=b=0,y=c);7&u;)u++;return u>>>3},r.F._bestMatch=function(e,t,n,i,o,a){var s=32767&t,l=n[s],c=s-l+32768&32767;if(l==s||i!=r.F._hash(e,t-c))return 0;for(var u=0,d=0,h=Math.min(32767,t);c<=h&&0!=--a&&l!=s;){if(0==u||e[t+u]==e[t+u-c]){var f=r.F._howLong(e,t,c);if(f>u){if(d=c,(u=f)>=o)break;c+2<f&&(f=c+2);for(var p=0,g=0;g<f-2;g++){var m=t-c+g+32768&32767,v=m-n[m]+32768&32767;v>p&&(p=v,l=m)}}}c+=(s=l)-(l=n[s])+32768&32767}return u<<16|d},r.F._howLong=function(e,t,r){if(e[t]!=e[t-r]||e[t+1]!=e[t+1-r]||e[t+2]!=e[t+2-r])return 0;var n=t,i=Math.min(e.length,t+258);for(t+=3;t<i&&e[t]==e[t-r];)t++;return t-n},r.F._hash=function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(e,t,n,i,o,a,s,l,c){var u,d,h,f,p,g,m,v,y,b=r.F.U,w=r.F._putsF,x=r.F._putsE;b.lhst[256]++,d=(u=r.F.getTrees())[0],h=u[1],f=u[2],p=u[3],g=u[4],m=u[5],v=u[6],y=u[7];var C=32+(c+3&7?8-(c+3&7):0)+(s<<3),_=i+r.F.contSize(b.fltree,b.lhst)+r.F.contSize(b.fdtree,b.dhst),S=i+r.F.contSize(b.ltree,b.lhst)+r.F.contSize(b.dtree,b.dhst);S+=14+3*m+r.F.contSize(b.itree,b.ihst)+(2*b.ihst[16]+3*b.ihst[17]+7*b.ihst[18]);for(var A=0;A<286;A++)b.lhst[A]=0;for(A=0;A<30;A++)b.dhst[A]=0;for(A=0;A<19;A++)b.ihst[A]=0;var k=C<_&&C<S?0:_<S?1:2;if(w(l,c,e),w(l,c+1,k),c+=3,0==k){for(;7&c;)c++;c=r.F._copyExact(o,a,s,l,c)}else{var E,I;if(1==k&&(E=b.fltree,I=b.fdtree),2==k){r.F.makeCodes(b.ltree,d),r.F.revCodes(b.ltree,d),r.F.makeCodes(b.dtree,h),r.F.revCodes(b.dtree,h),r.F.makeCodes(b.itree,f),r.F.revCodes(b.itree,f),E=b.ltree,I=b.dtree,x(l,c,p-257),x(l,c+=5,g-1),x(l,c+=5,m-4),c+=4;for(var T=0;T<m;T++)x(l,c+3*T,b.itree[1+(b.ordr[T]<<1)]);c+=3*m,c=r.F._codeTiny(v,b.itree,l,c),c=r.F._codeTiny(y,b.itree,l,c)}for(var F=a,O=0;O<n;O+=2){for(var P=t[O],M=P>>>23,R=F+(8388607&P);F<R;)c=r.F._writeLit(o[F++],E,l,c);if(0!=M){var L=t[O+1],N=L>>16,j=L>>8&255,D=255&L;x(l,c=r.F._writeLit(257+j,E,l,c),M-b.of0[j]),c+=b.exb[j],w(l,c=r.F._writeLit(D,I,l,c),N-b.df0[D]),c+=b.dxb[D],F+=M}}c=r.F._writeLit(256,E,l,c)}return c},r.F._copyExact=function(e,t,r,n,i){var o=i>>>3;return n[o]=r,n[o+1]=r>>>8,n[o+2]=255-n[o],n[o+3]=255-n[o+1],o+=4,n.set(new Uint8Array(e.buffer,t,r),o),i+(r+4<<3)},r.F.getTrees=function(){for(var e=r.F.U,t=r.F._hufTree(e.lhst,e.ltree,15),n=r.F._hufTree(e.dhst,e.dtree,15),i=[],o=r.F._lenCodes(e.ltree,i),a=[],s=r.F._lenCodes(e.dtree,a),l=0;l<i.length;l+=2)e.ihst[i[l]]++;for(l=0;l<a.length;l+=2)e.ihst[a[l]]++;for(var c=r.F._hufTree(e.ihst,e.itree,7),u=19;u>4&&0==e.itree[1+(e.ordr[u-1]<<1)];)u--;return[t,n,c,o,s,u,i,a]},r.F.getSecond=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(e[r+1]);return t},r.F.nonZero=function(e){for(var t="",r=0;r<e.length;r+=2)0!=e[r+1]&&(t+=(r>>1)+",");return t},r.F.contSize=function(e,t){for(var r=0,n=0;n<t.length;n++)r+=t[n]*e[1+(n<<1)];return r},r.F._codeTiny=function(e,t,n,i){for(var o=0;o<e.length;o+=2){var a=e[o],s=e[o+1];i=r.F._writeLit(a,t,n,i);var l=16==a?2:17==a?3:7;a>15&&(r.F._putsE(n,i,s,l),i+=l)}return i},r.F._lenCodes=function(e,t){for(var r=e.length;2!=r&&0==e[r-1];)r-=2;for(var n=0;n<r;n+=2){var i=e[n+1],o=n+3<r?e[n+3]:-1,a=n+5<r?e[n+5]:-1,s=0==n?-1:e[n-1];if(0==i&&o==i&&a==i){for(var l=n+5;l+2<r&&e[l+2]==i;)l+=2;(c=Math.min(l+1-n>>>1,138))<11?t.push(17,c-3):t.push(18,c-11),n+=2*c-2}else if(i==s&&o==i&&a==i){for(l=n+5;l+2<r&&e[l+2]==i;)l+=2;var c=Math.min(l+1-n>>>1,6);t.push(16,c-3),n+=2*c-2}else t.push(i,0)}return r>>>1},r.F._hufTree=function(e,t,n){var i=[],o=e.length,a=t.length,s=0;for(s=0;s<a;s+=2)t[s]=0,t[s+1]=0;for(s=0;s<o;s++)0!=e[s]&&i.push({lit:s,f:e[s]});var l=i.length,c=i.slice(0);if(0==l)return 0;if(1==l){var u=i[0].lit;return c=0==u?1:0,t[1+(u<<1)]=1,t[1+(c<<1)]=1,1}i.sort(function(e,t){return e.f-t.f});var d=i[0],h=i[1],f=0,p=1,g=2;for(i[0]={lit:-1,f:d.f+h.f,l:d,r:h,d:0};p!=l-1;)d=f!=p&&(g==l||i[f].f<i[g].f)?i[f++]:i[g++],h=f!=p&&(g==l||i[f].f<i[g].f)?i[f++]:i[g++],i[p++]={lit:-1,f:d.f+h.f,l:d,r:h};var m=r.F.setDepth(i[p-1],0);for(m>n&&(r.F.restrictDepth(c,n,m),m=n),s=0;s<l;s++)t[1+(c[s].lit<<1)]=c[s].d;return m},r.F.setDepth=function(e,t){return-1!=e.lit?(e.d=t,t):Math.max(r.F.setDepth(e.l,t+1),r.F.setDepth(e.r,t+1))},r.F.restrictDepth=function(e,t,r){var n=0,i=1<<r-t,o=0;for(e.sort(function(e,t){return t.d==e.d?e.f-t.f:t.d-e.d}),n=0;n<e.length&&e[n].d>t;n++){var a=e[n].d;e[n].d=t,o+=i-(1<<r-a)}for(o>>>=r-t;o>0;)(a=e[n].d)<t?(e[n].d++,o-=1<<t-a-1):n++;for(;n>=0;n--)e[n].d==t&&o<0&&(e[n].d--,o++);0!=o&&console.log("debt left")},r.F._goodIndex=function(e,t){var r=0;return t[16|r]<=e&&(r|=16),t[8|r]<=e&&(r|=8),t[4|r]<=e&&(r|=4),t[2|r]<=e&&(r|=2),t[1|r]<=e&&(r|=1),r},r.F._writeLit=function(e,t,n,i){return r.F._putsF(n,i,t[e<<1]),i+t[1+(e<<1)]},r.F.inflate=function(e,t){var n=Uint8Array;if(3==e[0]&&0==e[1])return t||new n(0);var i=r.F,o=i._bitsF,a=i._bitsE,s=i._decodeTiny,l=i.makeCodes,c=i.codes2map,u=i._get17,d=i.U,h=null==t;h&&(t=new n(e.length>>>2<<3));for(var f,p,g=0,m=0,v=0,y=0,b=0,w=0,x=0,C=0,_=0;0==g;)if(g=o(e,_,1),m=o(e,_+1,2),_+=3,0!=m){if(h&&(t=r.F._check(t,C+(1<<17))),1==m&&(f=d.flmap,p=d.fdmap,w=511,x=31),2==m){v=a(e,_,5)+257,y=a(e,_+5,5)+1,b=a(e,_+10,4)+4,_+=14;for(var S=0;S<38;S+=2)d.itree[S]=0,d.itree[S+1]=0;var A=1;for(S=0;S<b;S++){var k=a(e,_+3*S,3);d.itree[1+(d.ordr[S]<<1)]=k,k>A&&(A=k)}_+=3*b,l(d.itree,A),c(d.itree,A,d.imap),f=d.lmap,p=d.dmap,_=s(d.imap,(1<<A)-1,v+y,e,_,d.ttree);var E=i._copyOut(d.ttree,0,v,d.ltree);w=(1<<E)-1;var I=i._copyOut(d.ttree,v,y,d.dtree);x=(1<<I)-1,l(d.ltree,E),c(d.ltree,E,f),l(d.dtree,I),c(d.dtree,I,p)}for(;;){var T=f[u(e,_)&w];_+=15&T;var F=T>>>4;if(F>>>8==0)t[C++]=F;else{if(256==F)break;var O=C+F-254;if(F>264){var P=d.ldef[F-257];O=C+(P>>>3)+a(e,_,7&P),_+=7&P}var M=p[u(e,_)&x];_+=15&M;var R=M>>>4,L=d.ddef[R],N=(L>>>4)+o(e,_,15&L);for(_+=15&L,h&&(t=r.F._check(t,C+(1<<17)));C<O;)t[C]=t[C++-N],t[C]=t[C++-N],t[C]=t[C++-N],t[C]=t[C++-N];C=O}}}else{7&_&&(_+=8-(7&_));var j=4+(_>>>3),D=e[j-4]|e[j-3]<<8;h&&(t=r.F._check(t,C+D)),t.set(new n(e.buffer,e.byteOffset+j,D),C),_=j+D<<3,C+=D}return t.length==C?t:t.slice(0,C)},r.F._check=function(e,t){var r=e.length;if(t<=r)return e;var n=new Uint8Array(Math.max(r<<1,t));return n.set(e,0),n},r.F._decodeTiny=function(e,t,n,i,o,a){for(var s=r.F._bitsE,l=r.F._get17,c=0;c<n;){var u=e[l(i,o)&t];o+=15&u;var d=u>>>4;if(d<=15)a[c]=d,c++;else{var h=0,f=0;16==d?(f=3+s(i,o,2),o+=2,h=a[c-1]):17==d?(f=3+s(i,o,3),o+=3):18==d&&(f=11+s(i,o,7),o+=7);for(var p=c+f;c<p;)a[c]=h,c++}}return o},r.F._copyOut=function(e,t,r,n){for(var i=0,o=0,a=n.length>>>1;o<r;){var s=e[o+t];n[o<<1]=0,n[1+(o<<1)]=s,s>i&&(i=s),o++}for(;o<a;)n[o<<1]=0,n[1+(o<<1)]=0,o++;return i},r.F.makeCodes=function(e,t){for(var n,i,o,a,s=r.F.U,l=e.length,c=s.bl_count,u=0;u<=t;u++)c[u]=0;for(u=1;u<l;u+=2)c[e[u]]++;var d=s.next_code;for(n=0,c[0]=0,i=1;i<=t;i++)n=n+c[i-1]<<1,d[i]=n;for(o=0;o<l;o+=2)0!=(a=e[o+1])&&(e[o]=d[a],d[a]++)},r.F.codes2map=function(e,t,n){for(var i=e.length,o=r.F.U.rev15,a=0;a<i;a+=2)if(0!=e[a+1])for(var s=a>>1,l=e[a+1],c=s<<4|l,u=t-l,d=e[a]<<u,h=d+(1<<u);d!=h;)n[o[d]>>>15-t]=c,d++},r.F.revCodes=function(e,t){for(var n=r.F.U.rev15,i=15-t,o=0;o<e.length;o+=2){var a=e[o]<<t-e[o+1];e[o]=n[a]>>>i}},r.F._putsE=function(e,t,r){r<<=7&t;var n=t>>>3;e[n]|=r,e[n+1]|=r>>>8},r.F._putsF=function(e,t,r){r<<=7&t;var n=t>>>3;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},r.F._bitsE=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1},r.F._bitsF=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1},r.F._get17=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},r.F._get25=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},r.F.U=(e=Uint16Array,t=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new t(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new e(65536),prev:new e(32768)}),function(){for(var e=r.F.U,t=0;t<32768;t++){var n=t;n=(4278255360&(n=(4042322160&(n=(3435973836&(n=(2863311530&n)>>>1|(1431655765&n)<<1))>>>2|(858993459&n)<<2))>>>4|(252645135&n)<<4))>>>8|(16711935&n)<<8,e.rev15[t]=(n>>>16|n<<16)>>>17}function i(e,t,r){for(;0!=t--;)e.push(0,r)}for(t=0;t<32;t++)e.ldef[t]=e.of0[t]<<3|e.exb[t],e.ddef[t]=e.df0[t]<<4|e.dxb[t];i(e.fltree,144,8),i(e.fltree,112,9),i(e.fltree,24,7),i(e.fltree,8,8),r.F.makeCodes(e.fltree,9),r.F.codes2map(e.fltree,9,e.flmap),r.F.revCodes(e.fltree,9),i(e.fdtree,32,5),r.F.makeCodes(e.fdtree,5),r.F.codes2map(e.fdtree,5,e.fdmap),r.F.revCodes(e.fdtree,5),i(e.itree,19,0),i(e.ltree,286,0),i(e.dtree,30,0),i(e.ttree,320,0)}()}();var ya=function(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}({__proto__:null,default:ma},[ma]);const ba=function(){var e={nextZero(e,t){for(;0!=e[t];)t++;return t},readUshort:(e,t)=>e[t]<<8|e[t+1],writeUshort(e,t,r){e[t]=r>>8&255,e[t+1]=255&r},readUint:(e,t)=>16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3]),writeUint(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},readASCII(e,t,r){let n="";for(let i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n},writeASCII(e,t,r){for(let n=0;n<r.length;n++)e[t+n]=r.charCodeAt(n)},readBytes(e,t,r){const n=[];for(let i=0;i<r;i++)n.push(e[t+i]);return n},pad:e=>e.length<2?`0${e}`:e,readUTF8(t,r,n){let i,o="";for(let i=0;i<n;i++)o+=`%${e.pad(t[r+i].toString(16))}`;try{i=decodeURIComponent(o)}catch(i){return e.readASCII(t,r,n)}return i}};function t(t,r,n,i){const a=r*n,s=o(i),l=Math.ceil(r*s/8),c=new Uint8Array(4*a),u=new Uint32Array(c.buffer),{ctype:d}=i,{depth:h}=i,f=e.readUshort;if(6==d){const e=a<<2;if(8==h)for(var p=0;p<e;p+=4)c[p]=t[p],c[p+1]=t[p+1],c[p+2]=t[p+2],c[p+3]=t[p+3];if(16==h)for(p=0;p<e;p++)c[p]=t[p<<1]}else if(2==d){const e=i.tabs.tRNS;if(null==e){if(8==h)for(p=0;p<a;p++){var g=3*p;u[p]=255<<24|t[g+2]<<16|t[g+1]<<8|t[g]}if(16==h)for(p=0;p<a;p++)g=6*p,u[p]=255<<24|t[g+4]<<16|t[g+2]<<8|t[g]}else{var m=e[0];const r=e[1],n=e[2];if(8==h)for(p=0;p<a;p++){var v=p<<2;g=3*p,u[p]=255<<24|t[g+2]<<16|t[g+1]<<8|t[g],t[g]==m&&t[g+1]==r&&t[g+2]==n&&(c[v+3]=0)}if(16==h)for(p=0;p<a;p++)v=p<<2,g=6*p,u[p]=255<<24|t[g+4]<<16|t[g+2]<<8|t[g],f(t,g)==m&&f(t,g+2)==r&&f(t,g+4)==n&&(c[v+3]=0)}}else if(3==d){const e=i.tabs.PLTE,o=i.tabs.tRNS,s=o?o.length:0;if(1==h)for(var y=0;y<n;y++){var b=y*l,w=y*r;for(p=0;p<r;p++){v=w+p<<2;var x=3*(C=t[b+(p>>3)]>>7-(7&p)&1);c[v]=e[x],c[v+1]=e[x+1],c[v+2]=e[x+2],c[v+3]=C<s?o[C]:255}}if(2==h)for(y=0;y<n;y++)for(b=y*l,w=y*r,p=0;p<r;p++)v=w+p<<2,x=3*(C=t[b+(p>>2)]>>6-((3&p)<<1)&3),c[v]=e[x],c[v+1]=e[x+1],c[v+2]=e[x+2],c[v+3]=C<s?o[C]:255;if(4==h)for(y=0;y<n;y++)for(b=y*l,w=y*r,p=0;p<r;p++)v=w+p<<2,x=3*(C=t[b+(p>>1)]>>4-((1&p)<<2)&15),c[v]=e[x],c[v+1]=e[x+1],c[v+2]=e[x+2],c[v+3]=C<s?o[C]:255;if(8==h)for(p=0;p<a;p++){var C;v=p<<2,x=3*(C=t[p]),c[v]=e[x],c[v+1]=e[x+1],c[v+2]=e[x+2],c[v+3]=C<s?o[C]:255}}else if(4==d){if(8==h)for(p=0;p<a;p++){v=p<<2;var _=t[S=p<<1];c[v]=_,c[v+1]=_,c[v+2]=_,c[v+3]=t[S+1]}if(16==h)for(p=0;p<a;p++){var S;v=p<<2,_=t[S=p<<2],c[v]=_,c[v+1]=_,c[v+2]=_,c[v+3]=t[S+2]}}else if(0==d)for(m=i.tabs.tRNS?i.tabs.tRNS:-1,y=0;y<n;y++){const e=y*l,n=y*r;if(1==h)for(var A=0;A<r;A++){var k=(_=255*(t[e+(A>>>3)]>>>7-(7&A)&1))==255*m?0:255;u[n+A]=k<<24|_<<16|_<<8|_}else if(2==h)for(A=0;A<r;A++)k=(_=85*(t[e+(A>>>2)]>>>6-((3&A)<<1)&3))==85*m?0:255,u[n+A]=k<<24|_<<16|_<<8|_;else if(4==h)for(A=0;A<r;A++)k=(_=17*(t[e+(A>>>1)]>>>4-((1&A)<<2)&15))==17*m?0:255,u[n+A]=k<<24|_<<16|_<<8|_;else if(8==h)for(A=0;A<r;A++)k=(_=t[e+A])==m?0:255,u[n+A]=k<<24|_<<16|_<<8|_;else if(16==h)for(A=0;A<r;A++)_=t[e+(A<<1)],k=f(t,e+(A<<1))==m?0:255,u[n+A]=k<<24|_<<16|_<<8|_}return c}function r(e,t,r,s){const l=o(e),c=Math.ceil(r*l/8),u=new Uint8Array((c+1+e.interlace)*s);return t=e.tabs.CgBI?i(t,u):n(t,u),0==e.interlace?t=a(t,e,0,r,s):1==e.interlace&&(t=function(e,t){const r=t.width,n=t.height,i=o(t),s=i>>3,l=Math.ceil(r*i/8),c=new Uint8Array(n*l);let u=0;const d=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],f=[8,8,8,4,4,2,2],p=[8,8,4,4,2,2,1];let g=0;for(;g<7;){const o=f[g],v=p[g];let y=0,b=0,w=d[g];for(;w<n;)w+=o,b++;let x=h[g];for(;x<r;)x+=v,y++;const C=Math.ceil(y*i/8);a(e,t,u,y,b);let _=0,S=d[g];for(;S<n;){let t=h[g],n=u+_*C<<3;for(;t<r;){var m;if(1==i&&(m=(m=e[n>>3])>>7-(7&n)&1,c[S*l+(t>>3)]|=m<<7-(7&t)),2==i&&(m=(m=e[n>>3])>>6-(7&n)&3,c[S*l+(t>>2)]|=m<<6-((3&t)<<1)),4==i&&(m=(m=e[n>>3])>>4-(7&n)&15,c[S*l+(t>>1)]|=m<<4-((1&t)<<2)),i>=8){const r=S*l+t*s;for(let t=0;t<s;t++)c[r+t]=e[(n>>3)+t]}n+=i,t+=v}_++,S+=o}y*b!=0&&(u+=b*(1+C)),g+=1}return c}(t,e)),t}function n(e,t){return i(new Uint8Array(e.buffer,2,e.length-6),t)}var i=function(){const e={H:{}};return e.H.N=function(t,r){const n=Uint8Array;let i,o,a=0,s=0,l=0,c=0,u=0,d=0,h=0,f=0,p=0;if(3==t[0]&&0==t[1])return r||new n(0);const g=e.H,m=g.b,v=g.e,y=g.R,b=g.n,w=g.A,x=g.Z,C=g.m,_=null==r;for(_&&(r=new n(t.length>>>2<<5));0==a;)if(a=m(t,p,1),s=m(t,p+1,2),p+=3,0!=s){if(_&&(r=e.H.W(r,f+(1<<17))),1==s&&(i=C.J,o=C.h,d=511,h=31),2==s){l=v(t,p,5)+257,c=v(t,p+5,5)+1,u=v(t,p+10,4)+4,p+=14;let e=1;for(var S=0;S<38;S+=2)C.Q[S]=0,C.Q[S+1]=0;for(S=0;S<u;S++){const r=v(t,p+3*S,3);C.Q[1+(C.X[S]<<1)]=r,r>e&&(e=r)}p+=3*u,b(C.Q,e),w(C.Q,e,C.u),i=C.w,o=C.d,p=y(C.u,(1<<e)-1,l+c,t,p,C.v);const r=g.V(C.v,0,l,C.C);d=(1<<r)-1;const n=g.V(C.v,l,c,C.D);h=(1<<n)-1,b(C.C,r),w(C.C,r,i),b(C.D,n),w(C.D,n,o)}for(;;){const e=i[x(t,p)&d];p+=15&e;const n=e>>>4;if(n>>>8==0)r[f++]=n;else{if(256==n)break;{let e=f+n-254;if(n>264){const r=C.q[n-257];e=f+(r>>>3)+v(t,p,7&r),p+=7&r}const i=o[x(t,p)&h];p+=15&i;const a=i>>>4,s=C.c[a],l=(s>>>4)+m(t,p,15&s);for(p+=15&s;f<e;)r[f]=r[f++-l],r[f]=r[f++-l],r[f]=r[f++-l],r[f]=r[f++-l];f=e}}}}else{7&p&&(p+=8-(7&p));const i=4+(p>>>3),o=t[i-4]|t[i-3]<<8;_&&(r=e.H.W(r,f+o)),r.set(new n(t.buffer,t.byteOffset+i,o),f),p=i+o<<3,f+=o}return r.length==f?r:r.slice(0,f)},e.H.W=function(e,t){const r=e.length;if(t<=r)return e;const n=new Uint8Array(r<<1);return n.set(e,0),n},e.H.R=function(t,r,n,i,o,a){const s=e.H.e,l=e.H.Z;let c=0;for(;c<n;){const e=t[l(i,o)&r];o+=15&e;const n=e>>>4;if(n<=15)a[c]=n,c++;else{let e=0,t=0;16==n?(t=3+s(i,o,2),o+=2,e=a[c-1]):17==n?(t=3+s(i,o,3),o+=3):18==n&&(t=11+s(i,o,7),o+=7);const r=c+t;for(;c<r;)a[c]=e,c++}}return o},e.H.V=function(e,t,r,n){let i=0,o=0;const a=n.length>>>1;for(;o<r;){const r=e[o+t];n[o<<1]=0,n[1+(o<<1)]=r,r>i&&(i=r),o++}for(;o<a;)n[o<<1]=0,n[1+(o<<1)]=0,o++;return i},e.H.n=function(t,r){const n=e.H.m,i=t.length;let o,a,s,l;const c=n.j;for(var u=0;u<=r;u++)c[u]=0;for(u=1;u<i;u+=2)c[t[u]]++;const d=n.K;for(o=0,c[0]=0,a=1;a<=r;a++)o=o+c[a-1]<<1,d[a]=o;for(s=0;s<i;s+=2)l=t[s+1],0!=l&&(t[s]=d[l],d[l]++)},e.H.A=function(t,r,n){const i=t.length,o=e.H.m.r;for(let e=0;e<i;e+=2)if(0!=t[e+1]){const i=e>>1,a=t[e+1],s=i<<4|a,l=r-a;let c=t[e]<<l;const u=c+(1<<l);for(;c!=u;)n[o[c]>>>15-r]=s,c++}},e.H.l=function(t,r){const n=e.H.m.r,i=15-r;for(let e=0;e<t.length;e+=2){const o=t[e]<<r-t[e+1];t[e]=n[o]>>>i}},e.H.M=function(e,t,r){r<<=7&t;const n=t>>>3;e[n]|=r,e[n+1]|=r>>>8},e.H.I=function(e,t,r){r<<=7&t;const n=t>>>3;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},e.H.e=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1},e.H.b=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1},e.H.Z=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},e.H.i=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},e.H.m=function(){const e=Uint16Array,t=Uint32Array;return{K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)}}(),function(){const t=e.H.m;for(var r=0;r<32768;r++){let e=r;e=(2863311530&e)>>>1|(1431655765&e)<<1,e=(3435973836&e)>>>2|(858993459&e)<<2,e=(4042322160&e)>>>4|(252645135&e)<<4,e=(4278255360&e)>>>8|(16711935&e)<<8,t.r[r]=(e>>>16|e<<16)>>>17}function n(e,t,r){for(;0!=t--;)e.push(0,r)}for(r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];n(t._,144,8),n(t._,112,9),n(t._,24,7),n(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),n(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),n(t.Q,19,0),n(t.C,286,0),n(t.D,30,0),n(t.v,320,0)}(),e.H.N}();function o(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth}function a(e,t,r,n,i){let a=o(t);const l=Math.ceil(n*a/8);let c,u;a=Math.ceil(a/8);let d=e[r],h=0;if(d>1&&(e[r]=[0,0,1][d-2]),3==d)for(h=a;h<l;h++)e[h+1]=e[h+1]+(e[h+1-a]>>>1)&255;for(let t=0;t<i;t++)if(c=r+t*l,u=c+t+1,d=e[u-1],h=0,0==d)for(;h<l;h++)e[c+h]=e[u+h];else if(1==d){for(;h<a;h++)e[c+h]=e[u+h];for(;h<l;h++)e[c+h]=e[u+h]+e[c+h-a]}else if(2==d)for(;h<l;h++)e[c+h]=e[u+h]+e[c+h-l];else if(3==d){for(;h<a;h++)e[c+h]=e[u+h]+(e[c+h-l]>>>1);for(;h<l;h++)e[c+h]=e[u+h]+(e[c+h-l]+e[c+h-a]>>>1)}else{for(;h<a;h++)e[c+h]=e[u+h]+s(0,e[c+h-l],0);for(;h<l;h++)e[c+h]=e[u+h]+s(e[c+h-a],e[c+h-l],e[c+h-a-l])}return e}function s(e,t,r){const n=e+t-r,i=n-e,o=n-t,a=n-r;return i*i<=o*o&&i*i<=a*a?e:o*o<=a*a?t:r}function l(t,r,n){n.width=e.readUint(t,r),r+=4,n.height=e.readUint(t,r),r+=4,n.depth=t[r],r++,n.ctype=t[r],r++,n.compress=t[r],r++,n.filter=t[r],r++,n.interlace=t[r],r++}function c(e,t,r,n,i,o,a,s,l){const c=Math.min(t,i),u=Math.min(r,o);let d=0,h=0;for(let r=0;r<u;r++)for(let o=0;o<c;o++)if(a>=0&&s>=0?(d=r*t+o<<2,h=(s+r)*i+a+o<<2):(d=(-s+r)*t-a+o<<2,h=r*i+o<<2),0==l)n[h]=e[d],n[h+1]=e[d+1],n[h+2]=e[d+2],n[h+3]=e[d+3];else if(1==l){var f=e[d+3]*(1/255),p=e[d]*f,g=e[d+1]*f,m=e[d+2]*f,v=n[h+3]*(1/255),y=n[h]*v,b=n[h+1]*v,w=n[h+2]*v;const t=1-f,r=f+v*t,i=0==r?0:1/r;n[h+3]=255*r,n[h+0]=(p+y*t)*i,n[h+1]=(g+b*t)*i,n[h+2]=(m+w*t)*i}else if(2==l)f=e[d+3],p=e[d],g=e[d+1],m=e[d+2],v=n[h+3],y=n[h],b=n[h+1],w=n[h+2],f==v&&p==y&&g==b&&m==w?(n[h]=0,n[h+1]=0,n[h+2]=0,n[h+3]=0):(n[h]=p,n[h+1]=g,n[h+2]=m,n[h+3]=f);else if(3==l){if(f=e[d+3],p=e[d],g=e[d+1],m=e[d+2],v=n[h+3],y=n[h],b=n[h+1],w=n[h+2],f==v&&p==y&&g==b&&m==w)continue;if(f<220&&v>20)return!1}return!0}return{decode:function(t){const o=new Uint8Array(t);let a=8;const s=e,c=s.readUshort,u=s.readUint,d={tabs:{},frames:[]},h=new Uint8Array(o.length);let f,p=0,g=0;const m=[137,80,78,71,13,10,26,10];for(var v=0;v<8;v++)if(o[v]!=m[v])throw"The input is not a PNG file!";for(;a<o.length;){const e=s.readUint(o,a);a+=4;const t=s.readASCII(o,a,4);if(a+=4,"IHDR"==t)l(o,a,d);else if("iCCP"==t){for(var y=a;0!=o[y];)y++;s.readASCII(o,a,y-a),o[y+1];const r=o.slice(y+2,a+e);let l=null;try{l=n(r)}catch(e){l=i(r)}d.tabs[t]=l}else if("CgBI"==t)d.tabs[t]=o.slice(a,a+4);else if("IDAT"==t){for(v=0;v<e;v++)h[p+v]=o[a+v];p+=e}else if("acTL"==t)d.tabs[t]={num_frames:u(o,a),num_plays:u(o,a+4)},f=new Uint8Array(o.length);else if("fcTL"==t){0!=g&&((S=d.frames[d.frames.length-1]).data=r(d,f.slice(0,g),S.rect.width,S.rect.height),g=0);const e={x:u(o,a+12),y:u(o,a+16),width:u(o,a+4),height:u(o,a+8)};let t=c(o,a+22);t=c(o,a+20)/(0==t?100:t);const n={rect:e,delay:Math.round(1e3*t),dispose:o[a+24],blend:o[a+25]};d.frames.push(n)}else if("fdAT"==t){for(v=0;v<e-4;v++)f[g+v]=o[a+v+4];g+=e-4}else if("pHYs"==t)d.tabs[t]=[s.readUint(o,a),s.readUint(o,a+4),o[a+8]];else if("cHRM"==t)for(d.tabs[t]=[],v=0;v<8;v++)d.tabs[t].push(s.readUint(o,a+4*v));else if("tEXt"==t||"zTXt"==t){null==d.tabs[t]&&(d.tabs[t]={});var b=s.nextZero(o,a),w=s.readASCII(o,a,b-a),x=a+e-b-1;if("tEXt"==t)_=s.readASCII(o,b+1,x);else{var C=n(o.slice(b+2,b+2+x));_=s.readUTF8(C,0,C.length)}d.tabs[t][w]=_}else if("iTXt"==t){null==d.tabs[t]&&(d.tabs[t]={}),b=0,y=a,b=s.nextZero(o,y),w=s.readASCII(o,y,b-y);const r=o[y=b+1];var _;o[y+1],y+=2,b=s.nextZero(o,y),s.readASCII(o,y,b-y),y=b+1,b=s.nextZero(o,y),s.readUTF8(o,y,b-y),x=e-((y=b+1)-a),0==r?_=s.readUTF8(o,y,x):(C=n(o.slice(y,y+x)),_=s.readUTF8(C,0,C.length)),d.tabs[t][w]=_}else if("PLTE"==t)d.tabs[t]=s.readBytes(o,a,e);else if("hIST"==t){const e=d.tabs.PLTE.length/3;for(d.tabs[t]=[],v=0;v<e;v++)d.tabs[t].push(c(o,a+2*v))}else if("tRNS"==t)3==d.ctype?d.tabs[t]=s.readBytes(o,a,e):0==d.ctype?d.tabs[t]=c(o,a):2==d.ctype&&(d.tabs[t]=[c(o,a),c(o,a+2),c(o,a+4)]);else if("gAMA"==t)d.tabs[t]=s.readUint(o,a)/1e5;else if("sRGB"==t)d.tabs[t]=o[a];else if("bKGD"==t)0==d.ctype||4==d.ctype?d.tabs[t]=[c(o,a)]:2==d.ctype||6==d.ctype?d.tabs[t]=[c(o,a),c(o,a+2),c(o,a+4)]:3==d.ctype&&(d.tabs[t]=o[a]);else if("IEND"==t)break;a+=e,s.readUint(o,a),a+=4}var S;return 0!=g&&((S=d.frames[d.frames.length-1]).data=r(d,f.slice(0,g),S.rect.width,S.rect.height)),d.data=r(d,h,d.width,d.height),delete d.compress,delete d.interlace,delete d.filter,d},toRGBA8:function(e){const r=e.width,n=e.height;if(null==e.tabs.acTL)return[t(e.data,r,n,e).buffer];const i=[];null==e.frames[0].data&&(e.frames[0].data=e.data);const o=r*n*4,a=new Uint8Array(o),s=new Uint8Array(o),l=new Uint8Array(o);for(let d=0;d<e.frames.length;d++){const h=e.frames[d],f=h.rect.x,p=h.rect.y,g=h.rect.width,m=h.rect.height,v=t(h.data,g,m,e);if(0!=d)for(var u=0;u<o;u++)l[u]=a[u];if(0==h.blend?c(v,g,m,a,r,n,f,p,0):1==h.blend&&c(v,g,m,a,r,n,f,p,1),i.push(a.buffer.slice(0)),0==h.dispose);else if(1==h.dispose)c(s,g,m,a,r,n,f,p,0);else if(2==h.dispose)for(u=0;u<o;u++)a[u]=l[u]}return i},_paeth:s,_copyTile:c,_bin:e}}();!function(){const{_copyTile:e}=ba,{_bin:t}=ba,r=ba._paeth;var n={table:function(){const e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t;for(let e=0;e<8;e++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r}return e}(),update(e,t,r,i){for(let o=0;o<i;o++)e=n.table[255&(e^t[r+o])]^e>>>8;return e},crc:(e,t,r)=>4294967295^n.update(4294967295,e,t,r)};function i(e,t,r,n){t[r]+=e[0]*n>>4,t[r+1]+=e[1]*n>>4,t[r+2]+=e[2]*n>>4,t[r+3]+=e[3]*n>>4}function o(e){return Math.max(0,Math.min(255,e))}function a(e,t){const r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function s(e,t,r,n,s,l,c){null==c&&(c=1);const u=n.length,d=[];for(var h=0;h<u;h++){const e=n[h];d.push([e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255])}for(h=0;h<u;h++){let e=4294967295;for(var f=0,p=0;p<u;p++){var g=a(d[h],d[p]);p!=h&&g<e&&(e=g,f=p)}}const m=new Uint32Array(s.buffer),v=new Int16Array(t*r*4),y=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(h=0;h<y.length;h++)y[h]=255*((y[h]+.5)/16-.5);for(let s=0;s<r;s++)for(let w=0;w<t;w++){var b;h=4*(s*t+w),2!=c?b=[o(e[h]+v[h]),o(e[h+1]+v[h+1]),o(e[h+2]+v[h+2]),o(e[h+3]+v[h+3])]:(g=y[4*(3&s)+(3&w)],b=[o(e[h]+g),o(e[h+1]+g),o(e[h+2]+g),o(e[h+3]+g)]),f=0;let x=16777215;for(p=0;p<u;p++){const e=a(b,d[p]);e<x&&(x=e,f=p)}const C=d[f],_=[b[0]-C[0],b[1]-C[1],b[2]-C[2],b[3]-C[3]];1==c&&(w!=t-1&&i(_,v,h+4,7),s!=r-1&&(0!=w&&i(_,v,h+4*t-4,3),i(_,v,h+4*t,5),w!=t-1&&i(_,v,h+4*t+4,1))),l[h>>2]=f,m[h>>2]=n[f]}}function l(e,r,i,o,a){null==a&&(a={});const{crc:s}=n,l=t.writeUint,c=t.writeUshort,u=t.writeASCII;let d=8;const h=e.frames.length>1;let f,p=!1,g=33+(h?20:0);if(null!=a.sRGB&&(g+=13),null!=a.pHYs&&(g+=21),null!=a.iCCP&&(f=pako.deflate(a.iCCP),g+=21+f.length+4),3==e.ctype){for(var m=e.plte.length,v=0;v<m;v++)e.plte[v]>>>24!=255&&(p=!0);g+=8+3*m+4+(p?8+1*m+4:0)}for(var y=0;y<e.frames.length;y++)h&&(g+=38),g+=(C=e.frames[y]).cimg.length+12,0!=y&&(g+=4);g+=12;const b=new Uint8Array(g),w=[137,80,78,71,13,10,26,10];for(v=0;v<8;v++)b[v]=w[v];if(l(b,d,13),d+=4,u(b,d,"IHDR"),d+=4,l(b,d,r),d+=4,l(b,d,i),d+=4,b[d]=e.depth,d++,b[d]=e.ctype,d++,b[d]=0,d++,b[d]=0,d++,b[d]=0,d++,l(b,d,s(b,d-17,17)),d+=4,null!=a.sRGB&&(l(b,d,1),d+=4,u(b,d,"sRGB"),d+=4,b[d]=a.sRGB,d++,l(b,d,s(b,d-5,5)),d+=4),null!=a.iCCP){const e=13+f.length;l(b,d,e),d+=4,u(b,d,"iCCP"),d+=4,u(b,d,"ICC profile"),d+=11,d+=2,b.set(f,d),d+=f.length,l(b,d,s(b,d-(e+4),e+4)),d+=4}if(null!=a.pHYs&&(l(b,d,9),d+=4,u(b,d,"pHYs"),d+=4,l(b,d,a.pHYs[0]),d+=4,l(b,d,a.pHYs[1]),d+=4,b[d]=a.pHYs[2],d++,l(b,d,s(b,d-13,13)),d+=4),h&&(l(b,d,8),d+=4,u(b,d,"acTL"),d+=4,l(b,d,e.frames.length),d+=4,l(b,d,null!=a.loop?a.loop:0),d+=4,l(b,d,s(b,d-12,12)),d+=4),3==e.ctype){for(l(b,d,3*(m=e.plte.length)),d+=4,u(b,d,"PLTE"),d+=4,v=0;v<m;v++){const t=3*v,r=e.plte[v],n=255&r,i=r>>>8&255,o=r>>>16&255;b[d+t+0]=n,b[d+t+1]=i,b[d+t+2]=o}if(d+=3*m,l(b,d,s(b,d-3*m-4,3*m+4)),d+=4,p){for(l(b,d,m),d+=4,u(b,d,"tRNS"),d+=4,v=0;v<m;v++)b[d+v]=e.plte[v]>>>24&255;d+=m,l(b,d,s(b,d-m-4,m+4)),d+=4}}let x=0;for(y=0;y<e.frames.length;y++){var C=e.frames[y];h&&(l(b,d,26),d+=4,u(b,d,"fcTL"),d+=4,l(b,d,x++),d+=4,l(b,d,C.rect.width),d+=4,l(b,d,C.rect.height),d+=4,l(b,d,C.rect.x),d+=4,l(b,d,C.rect.y),d+=4,c(b,d,o[y]),d+=2,c(b,d,1e3),d+=2,b[d]=C.dispose,d++,b[d]=C.blend,d++,l(b,d,s(b,d-30,30)),d+=4);const t=C.cimg;l(b,d,(m=t.length)+(0==y?0:4)),d+=4;const r=d;u(b,d,0==y?"IDAT":"fdAT"),d+=4,0!=y&&(l(b,d,x++),d+=4),b.set(t,d),d+=m,l(b,d,s(b,r,d-r)),d+=4}return l(b,d,0),d+=4,u(b,d,"IEND"),d+=4,l(b,d,s(b,d-4,4)),d+=4,b.buffer}function c(e,t,r){for(let n=0;n<e.frames.length;n++){const i=e.frames[n];i.rect.width;const o=i.rect.height,a=new Uint8Array(o*i.bpl+o);i.cimg=f(i.img,o,i.bpp,i.bpl,a,t,r)}}function u(t,r,n,i,o){const a=o[0],l=o[1],c=o[2],u=o[3],f=o[4],p=o[5];let m=6,v=8,y=255;for(var b=0;b<t.length;b++){const e=new Uint8Array(t[b]);for(var w=e.length,x=0;x<w;x+=4)y&=e[x+3]}const C=255!=y,_=function(t,r,n,i,o,a){const s=[];for(var l=0;l<t.length;l++){const d=new Uint8Array(t[l]),f=new Uint32Array(d.buffer);var c;let g=0,m=0,v=r,y=n,b=i?1:0;if(0!=l){const w=a||i||1==l||0!=s[l-2].dispose?1:2;let x=0,C=1e9;for(let e=0;e<w;e++){var u=new Uint8Array(t[l-1-e]);const i=new Uint32Array(t[l-1-e]);let a=r,s=n,c=-1,d=-1;for(let e=0;e<n;e++)for(let t=0;t<r;t++)f[p=e*r+t]!=i[p]&&(t<a&&(a=t),t>c&&(c=t),e<s&&(s=e),e>d&&(d=e));-1==c&&(a=s=c=d=0),o&&(!(1&~a)&&a--,!(1&~s)&&s--);const h=(c-a+1)*(d-s+1);h<C&&(C=h,x=e,g=a,m=s,v=c-a+1,y=d-s+1)}u=new Uint8Array(t[l-1-x]),1==x&&(s[l-1].dispose=2),c=new Uint8Array(v*y*4),e(u,r,n,c,v,y,-g,-m,0),b=e(d,r,n,c,v,y,-g,-m,3)?1:0,1==b?h(d,r,n,c,{x:g,y:m,width:v,height:y}):e(d,r,n,c,v,y,-g,-m,0)}else c=d.slice(0);s.push({rect:{x:g,y:m,width:v,height:y},img:c,blend:b,dispose:0})}if(i)for(l=0;l<s.length;l++){if(1==(g=s[l]).blend)continue;const e=g.rect,i=s[l-1].rect,a=Math.min(e.x,i.x),c=Math.min(e.y,i.y),u={x:a,y:c,width:Math.max(e.x+e.width,i.x+i.width)-a,height:Math.max(e.y+e.height,i.y+i.height)-c};s[l-1].dispose=1,l-1!=0&&d(t,r,n,s,l-1,u,o),d(t,r,n,s,l,u,o)}let f=0;if(1!=t.length)for(var p=0;p<s.length;p++){var g;f+=(g=s[p]).rect.width*g.rect.height}return s}(t,r,n,a,l,c),S={},A=[],k=[];if(0!=i){const e=[];for(x=0;x<_.length;x++)e.push(_[x].img.buffer);const t=function(e){let t=0;for(var r=0;r<e.length;r++)t+=e[r].byteLength;const n=new Uint8Array(t);let i=0;for(r=0;r<e.length;r++){const t=new Uint8Array(e[r]),o=t.length;for(let e=0;e<o;e+=4){let r=t[e],o=t[e+1],a=t[e+2];const s=t[e+3];0==s&&(r=o=a=0),n[i+e]=r,n[i+e+1]=o,n[i+e+2]=a,n[i+e+3]=s}i+=o}return n.buffer}(e),r=g(t,i);for(x=0;x<r.plte.length;x++)A.push(r.plte[x].est.rgba);let n=0;for(x=0;x<_.length;x++){const e=(I=_[x]).img.length;var E=new Uint8Array(r.inds.buffer,n>>2,e>>2);k.push(E);const t=new Uint8Array(r.abuf,n,e);p&&s(I.img,I.rect.width,I.rect.height,A,t,E),I.img.set(t),n+=e}}else for(b=0;b<_.length;b++){var I=_[b];const e=new Uint32Array(I.img.buffer);var T=I.rect.width;for(w=e.length,E=new Uint8Array(w),k.push(E),x=0;x<w;x++){const t=e[x];if(0!=x&&t==e[x-1])E[x]=E[x-1];else if(x>T&&t==e[x-T])E[x]=E[x-T];else{let e=S[t];if(null==e&&(S[t]=e=A.length,A.push(t),A.length>=300))break;E[x]=e}}}const F=A.length;for(F<=256&&0==f&&(v=F<=2?1:F<=4?2:F<=16?4:8,v=Math.max(v,u)),b=0;b<_.length;b++){(I=_[b]).rect.x,I.rect.y,T=I.rect.width;const e=I.rect.height;let t=I.img;new Uint32Array(t.buffer);let r=4*T,n=4;if(F<=256&&0==f){r=Math.ceil(v*T/8);var O=new Uint8Array(r*e);const i=k[b];for(let t=0;t<e;t++){x=t*r;const e=t*T;if(8==v)for(var P=0;P<T;P++)O[x+P]=i[e+P];else if(4==v)for(P=0;P<T;P++)O[x+(P>>1)]|=i[e+P]<<4-4*(1&P);else if(2==v)for(P=0;P<T;P++)O[x+(P>>2)]|=i[e+P]<<6-2*(3&P);else if(1==v)for(P=0;P<T;P++)O[x+(P>>3)]|=i[e+P]<<7-1*(7&P)}t=O,m=3,n=1}else if(0==C&&1==_.length){O=new Uint8Array(T*e*3);const i=T*e;for(x=0;x<i;x++){const e=3*x,r=4*x;O[e]=t[r],O[e+1]=t[r+1],O[e+2]=t[r+2]}t=O,m=2,n=3,r=3*T}I.img=t,I.bpl=r,I.bpp=n}return{ctype:m,depth:v,plte:A,frames:_}}function d(t,r,n,i,o,a,s){const l=Uint8Array,c=Uint32Array,u=new l(t[o-1]),d=new c(t[o-1]),f=o+1<t.length?new l(t[o+1]):null,p=new l(t[o]),g=new c(p.buffer);let m=r,v=n,y=-1,b=-1;for(let e=0;e<a.height;e++)for(let t=0;t<a.width;t++){const n=a.x+t,s=a.y+e,l=s*r+n,c=g[l];0==c||0==i[o-1].dispose&&d[l]==c&&(null==f||0!=f[4*l+3])||(n<m&&(m=n),n>y&&(y=n),s<v&&(v=s),s>b&&(b=s))}-1==y&&(m=v=y=b=0),s&&(!(1&~m)&&m--,!(1&~v)&&v--),a={x:m,y:v,width:y-m+1,height:b-v+1};const w=i[o];w.rect=a,w.blend=1,w.img=new Uint8Array(a.width*a.height*4),0==i[o-1].dispose?(e(u,r,n,w.img,a.width,a.height,-a.x,-a.y,0),h(p,r,n,w.img,a)):e(p,r,n,w.img,a.width,a.height,-a.x,-a.y,0)}function h(t,r,n,i,o){e(t,r,n,i,o.width,o.height,-o.x,-o.y,2)}function f(e,t,r,n,i,o,a){const s=[];let l,c=[0,1,2,3,4];-1!=o?c=[o]:(t*n>5e5||1==r)&&(c=[0]),a&&(l={level:0});const u=ya;for(var d=0;d<c.length;d++){for(let o=0;o<t;o++)p(i,e,o,n,r,c[d]);s.push(u.deflate(i,l))}let h,f=1e9;for(d=0;d<s.length;d++)s[d].length<f&&(h=d,f=s[d].length);return s[h]}function p(e,t,n,i,o,a){const s=n*i;let l=s+n;if(e[l]=a,l++,0==a)if(i<500)for(var c=0;c<i;c++)e[l+c]=t[s+c];else e.set(new Uint8Array(t.buffer,s,i),l);else if(1==a){for(c=0;c<o;c++)e[l+c]=t[s+c];for(c=o;c<i;c++)e[l+c]=t[s+c]-t[s+c-o]+256&255}else if(0==n){for(c=0;c<o;c++)e[l+c]=t[s+c];if(2==a)for(c=o;c<i;c++)e[l+c]=t[s+c];if(3==a)for(c=o;c<i;c++)e[l+c]=t[s+c]-(t[s+c-o]>>1)+256&255;if(4==a)for(c=o;c<i;c++)e[l+c]=t[s+c]-r(t[s+c-o],0,0)+256&255}else{if(2==a)for(c=0;c<i;c++)e[l+c]=t[s+c]+256-t[s+c-i]&255;if(3==a){for(c=0;c<o;c++)e[l+c]=t[s+c]+256-(t[s+c-i]>>1)&255;for(c=o;c<i;c++)e[l+c]=t[s+c]+256-(t[s+c-i]+t[s+c-o]>>1)&255}if(4==a){for(c=0;c<o;c++)e[l+c]=t[s+c]+256-r(0,t[s+c-i],0)&255;for(c=o;c<i;c++)e[l+c]=t[s+c]+256-r(t[s+c-o],t[s+c-i],t[s+c-o-i])&255}}}function g(e,t){const r=new Uint8Array(e),n=r.slice(0),i=new Uint32Array(n.buffer),o=m(n,t),a=o[0],s=o[1],l=r.length,c=new Uint8Array(l>>2);let u;if(r.length<2e7)for(var d=0;d<l;d+=4)u=v(a,h=r[d]*(1/255),f=r[d+1]*(1/255),p=r[d+2]*(1/255),g=r[d+3]*(1/255)),c[d>>2]=u.ind,i[d>>2]=u.est.rgba;else for(d=0;d<l;d+=4){var h=r[d]*(1/255),f=r[d+1]*(1/255),p=r[d+2]*(1/255),g=r[d+3]*(1/255);for(u=a;u.left;)u=y(u.est,h,f,p,g)<=0?u.left:u.right;c[d>>2]=u.ind,i[d>>2]=u.est.rgba}return{abuf:n.buffer,inds:c,plte:s}}function m(e,t,r){null==r&&(r=1e-4);const n=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=x(e,i.i0,i.i1),i.est=C(i.bst);const o=[i];for(;o.length<t;){let t=0,i=0;for(var a=0;a<o.length;a++)o[a].est.L>t&&(t=o[a].est.L,i=a);if(t<r)break;const s=o[i],l=b(e,n,s.i0,s.i1,s.est.e,s.est.eMq255);if(s.i0>=l||s.i1<=l){s.est.L=0;continue}const c={i0:s.i0,i1:l,bst:null,est:null,tdst:0,left:null,right:null};c.bst=x(e,c.i0,c.i1),c.est=C(c.bst);const u={i0:l,i1:s.i1,bst:null,est:null,tdst:0,left:null,right:null};for(u.bst={R:[],m:[],N:s.bst.N-c.bst.N},a=0;a<16;a++)u.bst.R[a]=s.bst.R[a]-c.bst.R[a];for(a=0;a<4;a++)u.bst.m[a]=s.bst.m[a]-c.bst.m[a];u.est=C(u.bst),s.left=c,s.right=u,o[i]=c,o.push(u)}for(o.sort((e,t)=>t.bst.N-e.bst.N),a=0;a<o.length;a++)o[a].ind=a;return[i,o]}function v(e,t,r,n,i){if(null==e.left)return e.tdst=function(e,t,r,n,i){const o=t-e[0],a=r-e[1],s=n-e[2],l=i-e[3];return o*o+a*a+s*s+l*l}(e.est.q,t,r,n,i),e;const o=y(e.est,t,r,n,i);let a=e.left,s=e.right;o>0&&(a=e.right,s=e.left);const l=v(a,t,r,n,i);if(l.tdst<=o*o)return l;const c=v(s,t,r,n,i);return c.tdst<l.tdst?c:l}function y(e,t,r,n,i){const{e:o}=e;return o[0]*t+o[1]*r+o[2]*n+o[3]*i-e.eMq}function b(e,t,r,n,i,o){for(n-=4;r<n;){for(;w(e,r,i)<=o;)r+=4;for(;w(e,n,i)>o;)n-=4;if(r>=n)break;const a=t[r>>2];t[r>>2]=t[n>>2],t[n>>2]=a,r+=4,n-=4}for(;w(e,r,i)>o;)r-=4;return r+4}function w(e,t,r){return e[t]*r[0]+e[t+1]*r[1]+e[t+2]*r[2]+e[t+3]*r[3]}function x(e,t,r){const n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],o=r-t>>2;for(let o=t;o<r;o+=4){const t=e[o]*(1/255),r=e[o+1]*(1/255),a=e[o+2]*(1/255),s=e[o+3]*(1/255);i[0]+=t,i[1]+=r,i[2]+=a,i[3]+=s,n[0]+=t*t,n[1]+=t*r,n[2]+=t*a,n[3]+=t*s,n[5]+=r*r,n[6]+=r*a,n[7]+=r*s,n[10]+=a*a,n[11]+=a*s,n[15]+=s*s}return n[4]=n[1],n[8]=n[2],n[9]=n[6],n[12]=n[3],n[13]=n[7],n[14]=n[11],{R:n,m:i,N:o}}function C(e){const{R:t}=e,{m:r}=e,{N:n}=e,i=r[0],o=r[1],a=r[2],s=r[3],l=0==n?0:1/n,c=[t[0]-i*i*l,t[1]-i*o*l,t[2]-i*a*l,t[3]-i*s*l,t[4]-o*i*l,t[5]-o*o*l,t[6]-o*a*l,t[7]-o*s*l,t[8]-a*i*l,t[9]-a*o*l,t[10]-a*a*l,t[11]-a*s*l,t[12]-s*i*l,t[13]-s*o*l,t[14]-s*a*l,t[15]-s*s*l],u=c,d=_;let h=[Math.random(),Math.random(),Math.random(),Math.random()],f=0,p=0;if(0!=n)for(let e=0;e<16&&(h=d.multVec(u,h),p=Math.sqrt(d.dot(h,h)),h=d.sml(1/p,h),!(0!=e&&Math.abs(p-f)<1e-9));e++)f=p;const g=[i*l,o*l,a*l,s*l];return{Cov:c,q:g,e:h,L:f,eMq255:d.dot(d.sml(255,g),h),eMq:d.dot(h,g),rgba:(Math.round(255*g[3])<<24|Math.round(255*g[2])<<16|Math.round(255*g[1])<<8|Math.round(255*g[0]))>>>0}}var _={multVec:(e,t)=>[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]],dot:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],sml:(e,t)=>[e*t[0],e*t[1],e*t[2],e*t[3]]};ba.encode=function(e,t,r,n,i,o,a){null==n&&(n=0),null==a&&(a=!1);const s=u(e,t,r,n,[!1,!1,!1,0,a,!1]);return c(s,-1),l(s,t,r,i,o)},ba.encodeLL=function(e,t,r,n,i,o,a,s){const u={ctype:0+(1==n?0:2)+(0==i?0:4),depth:o,frames:[]},d=(n+i)*o,h=d*t;for(let n=0;n<e.length;n++)u.frames.push({rect:{x:0,y:0,width:t,height:r},img:new Uint8Array(e[n]),blend:0,dispose:1,bpp:Math.ceil(d/8),bpl:Math.ceil(h/8)});return c(u,0,!0),l(u,t,r,a,s)},ba.encode.compress=u,ba.encode.dither=s,ba.quantize=g,ba.quantize.getKDtree=m,ba.quantize.getNearest=v}();const wa={toArrayBuffer(e,t){const r=e.width,n=e.height,i=r<<2,o=e.getContext("2d").getImageData(0,0,r,n),a=new Uint32Array(o.data.buffer),s=(32*r+31)/32<<2,l=s*n,c=122+l,u=new ArrayBuffer(c),d=new DataView(u),h=1<<20;let f,p,g,m,v=h,y=0,b=0,w=0;function x(e){d.setUint16(b,e,!0),b+=2}function C(e){d.setUint32(b,e,!0),b+=4}function _(e){b+=e}x(19778),C(c),_(4),C(122),C(108),C(r),C(-n>>>0),x(1),x(32),C(3),C(l),C(2835),C(2835),_(8),C(16711680),C(65280),C(255),C(4278190080),C(1466527264),function e(){for(;y<n&&v>0;){for(m=122+y*s,f=0;f<i;)v--,p=a[w++],g=p>>>24,d.setUint32(m+f,p<<8|g),f+=4;y++}w<a.length?(v=h,setTimeout(e,wa._dly)):t(u)}()},toBlob(e,t){this.toArrayBuffer(e,e=>{t(new Blob([e],{type:"image/bmp"}))})},_dly:9};var xa={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Ca={[xa.CHROME]:16384,[xa.FIREFOX]:11180,[xa.DESKTOP_SAFARI]:16384,[xa.IE]:8192,[xa.IOS]:4096,[xa.ETC]:8192};const _a="undefined"!=typeof window,Sa="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,Aa=_a&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),ka=(_a||Sa)&&(Aa&&Aa.getOriginalSymbol(window,"File")||"undefined"!=typeof File&&File),Ea=(_a||Sa)&&(Aa&&Aa.getOriginalSymbol(window,"FileReader")||"undefined"!=typeof FileReader&&FileReader);function Ia(e,t,r=Date.now()){return new Promise(n=>{const i=e.split(","),o=i[0].match(/:(.*?);/)[1],a=globalThis.atob(i[1]);let s=a.length;const l=new Uint8Array(s);for(;s--;)l[s]=a.charCodeAt(s);const c=new Blob([l],{type:o});c.name=t,c.lastModified=r,n(c)})}function Ta(e){return new Promise((t,r)=>{const n=new Ea;n.onload=()=>t(n.result),n.onerror=e=>r(e),n.readAsDataURL(e)})}function Fa(e){return new Promise((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=e=>r(e),n.src=e})}function Oa(){if(void 0!==Oa.cachedResult)return Oa.cachedResult;let e=xa.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=xa.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=xa.IOS:/Safari/i.test(t)?e=xa.DESKTOP_SAFARI:/Firefox/i.test(t)?e=xa.FIREFOX:(/MSIE/i.test(t)||1==!!document.documentMode)&&(e=xa.IE),Oa.cachedResult=e,Oa.cachedResult}function Pa(e,t){const r=Oa(),n=Ca[r];let i=e,o=t,a=i*o;const s=i>o?o/i:i/o;for(;a>n*n;){const e=(n+i)/2,t=(n+o)/2;e<t?(o=t,i=t*s):(o=e*s,i=e),a=i*o}return{width:i,height:o}}function Ma(e,t){let r,n;try{if(r=new OffscreenCanvas(e,t),n=r.getContext("2d"),null===n)throw new Error("getContext of OffscreenCanvas returns null")}catch(e){r=document.createElement("canvas"),n=r.getContext("2d")}return r.width=e,r.height=t,[r,n]}function Ra(e,t){const{width:r,height:n}=Pa(e.width,e.height),[i,o]=Ma(r,n);return t&&/jpe?g/.test(t)&&(o.fillStyle="white",o.fillRect(0,0,i.width,i.height)),o.drawImage(e,0,0,i.width,i.height),i}function La(){return void 0!==La.cachedResult||(La.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"undefined"!=typeof document&&"ontouchend"in document),La.cachedResult}function Na(e,t={}){return new Promise(function(r,n){let i,o;var a=function(){try{return o=Ra(i,t.fileType||e.type),r([i,o])}catch(e){return n(e)}},s=function(t){try{var r=function(e){try{throw e}catch(e){return n(e)}};try{let t;return Ta(e).then(function(e){try{return t=e,Fa(t).then(function(e){try{return i=e,function(){try{return a()}catch(e){return n(e)}}()}catch(e){return r(e)}},r)}catch(e){return r(e)}},r)}catch(e){r(e)}}catch(e){return n(e)}};try{if(La()||[xa.DESKTOP_SAFARI,xa.MOBILE_SAFARI].includes(Oa()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then(function(e){try{return i=e,a()}catch(e){return s()}},s)}catch(e){s()}})}function ja(e,t,r,n,i=1){return new Promise(function(o,a){let s;if("image/png"===t){let c,u,d;return c=e.getContext("2d"),({data:u}=c.getImageData(0,0,e.width,e.height)),d=ba.encode([u.buffer],e.width,e.height,4096*i),s=new Blob([d],{type:t}),s.name=r,s.lastModified=n,l.call(this)}{if("image/bmp"===t)return new Promise(t=>wa.toBlob(e,t)).then(function(e){try{return s=e,s.name=r,s.lastModified=n,h.call(this)}catch(e){return a(e)}}.bind(this),a);{if("function"==typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:i}).then(function(e){try{return s=e,s.name=r,s.lastModified=n,f.call(this)}catch(e){return a(e)}}.bind(this),a);{let p;return p=e.toDataURL(t,i),Ia(p,r,n).then(function(e){try{return s=e,f.call(this)}catch(e){return a(e)}}.bind(this),a)}function f(){return h.call(this)}}function h(){return l.call(this)}}function l(){return o(s)}})}function Da(e){e.width=0,e.height=0}function za(){return new Promise(function(e,t){let r,n,i,o;return void 0!==za.cachedResult?e(za.cachedResult):Ia("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(a){try{return r=a,Na(r).then(function(a){try{return n=a[1],ja(n,r.type,r.name,r.lastModified).then(function(r){try{return i=r,Da(n),Na(i).then(function(r){try{return o=r[0],za.cachedResult=1===o.width&&2===o.height,e(za.cachedResult)}catch(e){return t(e)}},t)}catch(e){return t(e)}},t)}catch(e){return t(e)}},t)}catch(e){return t(e)}},t)})}function Ba(e){return new Promise((t,r)=>{const n=new Ea;n.onload=e=>{const r=new DataView(e.target.result);if(65496!=r.getUint16(0,!1))return t(-2);const n=r.byteLength;let i=2;for(;i<n;){if(r.getUint16(i+2,!1)<=8)return t(-1);const e=r.getUint16(i,!1);if(i+=2,65505==e){if(1165519206!=r.getUint32(i+=2,!1))return t(-1);const e=18761==r.getUint16(i+=6,!1);i+=r.getUint32(i+4,e);const n=r.getUint16(i,e);i+=2;for(let o=0;o<n;o++)if(274==r.getUint16(i+12*o,e))return t(r.getUint16(i+12*o+8,e))}else{if(65280&~e)break;i+=r.getUint16(i,!1)}}return t(-1)},n.onerror=e=>r(e),n.readAsArrayBuffer(e)})}function Ua(e,t){const{width:r}=e,{height:n}=e,{maxWidthOrHeight:i}=t;let o,a=e;return isFinite(i)&&(r>i||n>i)&&([a,o]=Ma(r,n),r>n?(a.width=i,a.height=n/r*i):(a.width=r/n*i,a.height=i),o.drawImage(e,0,0,a.width,a.height),Da(e)),a}function Va(e,t){const{width:r}=e,{height:n}=e,[i,o]=Ma(r,n);switch(t>4&&t<9?(i.width=n,i.height=r):(i.width=r,i.height=n),t){case 2:o.transform(-1,0,0,1,r,0);break;case 3:o.transform(-1,0,0,-1,r,n);break;case 4:o.transform(1,0,0,-1,0,n);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,n,0);break;case 7:o.transform(0,-1,-1,0,n,r);break;case 8:o.transform(0,-1,1,0,0,r)}return o.drawImage(e,0,0,r,n),Da(e),i}function Ha(e,t,r=0){return new Promise(function(n,i){let o,a,s,l,c,u,d,h,f,p,g,m,v,y,b,w,x,C,_,S;function A(e=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=e,t.onProgress(Math.min(o,100))}function k(e){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(e,o),100),t.onProgress(o)}return o=r,a=t.maxIteration||10,s=1024*t.maxSizeMB*1024,A(),Na(e,t).then(function(r){try{return[,l]=r,A(),c=Ua(l,t),A(),new Promise(function(r,n){var i;if(!(i=t.exifOrientation))return Ba(e).then(function(e){try{return i=e,o.call(this)}catch(e){return n(e)}}.bind(this),n);function o(){return r(i)}return o.call(this)}).then(function(r){try{return u=r,A(),za().then(function(r){try{return d=r?c:Va(c,u),A(),h=t.initialQuality||1,f=t.fileType||e.type,ja(d,f,e.name,e.lastModified,h).then(function(r){try{{if(p=r,A(),g=p.size>s,m=p.size>e.size,!g&&!m)return k(100),n(p);var o;function u(){if(a--&&(b>s||b>v)){let t,r;return t=S?.95*_.width:_.width,r=S?.95*_.height:_.height,[x,C]=Ma(t,r),C.drawImage(_,0,0,t,r),h*="image/png"===f?.85:.95,ja(x,f,e.name,e.lastModified,h).then(function(e){try{return w=e,Da(_),_=x,b=w.size,k(Math.min(99,Math.floor((y-b)/(y-s)*100))),u}catch(e){return i(e)}},i)}return[1]}return v=e.size,y=p.size,b=y,_=d,S=!t.alwaysKeepResolution&&g,(o=function(e){for(;e;){if(e.then)return void e.then(o,i);try{if(e.pop){if(e.length)return e.pop()?E.call(this):e;e=u}else e=e.call(this)}catch(e){return i(e)}}}.bind(this))(u);function E(){return Da(_),Da(x),Da(c),Da(d),Da(l),k(100),n(w)}}}catch(I){return i(I)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)})}let Wa;function $a(e,t){return new Promise((r,n)=>{Wa||(Wa=function(e){const t=[];return t.push(e),URL.createObjectURL(new Blob(t))}("\nlet scriptImported = false\nself.addEventListener('message', async (e) => {\n const { file, id, imageCompressionLibUrl, options } = e.data\n options.onProgress = (progress) => self.postMessage({ progress, id })\n try {\n if (!scriptImported) {\n // console.log('[worker] importScripts', imageCompressionLibUrl)\n self.importScripts(imageCompressionLibUrl)\n scriptImported = true\n }\n // console.log('[worker] self', self)\n const compressedFile = await imageCompression(file, options)\n self.postMessage({ file: compressedFile, id })\n } catch (e) {\n // console.error('[worker] error', e)\n self.postMessage({ error: e.message + '\\n' + e.stack, id })\n }\n})\n"));const i=new Worker(Wa);i.addEventListener("message",function(e){if(t.signal&&t.signal.aborted)i.terminate();else if(void 0===e.data.progress){if(e.data.error)return n(new Error(e.data.error)),void i.terminate();r(e.data.file),i.terminate()}else t.onProgress(e.data.progress)}),i.addEventListener("error",n),t.signal&&t.signal.addEventListener("abort",()=>{n(t.signal.reason),i.terminate()}),i.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})})}function qa(e,t){return new Promise(function(r,n){let i,o,a,s,l,c;if(i={...t},a=0,({onProgress:s}=i),i.maxSizeMB=i.maxSizeMB||Number.POSITIVE_INFINITY,l="boolean"!=typeof i.useWebWorker||i.useWebWorker,delete i.useWebWorker,i.onProgress=e=>{a=e,"function"==typeof s&&s(a)},!(e instanceof Blob||e instanceof ka))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return n(new Error("The file given is not an image"));if(c="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,!l||"function"!=typeof Worker||c)return Ha(e,i).then(function(e){try{return o=e,h.call(this)}catch(e){return n(e)}}.bind(this),n);var u=function(){try{return h.call(this)}catch(e){return n(e)}}.bind(this),d=function(t){try{return Ha(e,i).then(function(e){try{return o=e,u()}catch(e){return n(e)}},n)}catch(e){return n(e)}};try{return i.libURL=i.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",$a(e,i).then(function(e){try{return o=e,u()}catch(e){return d()}},d)}catch(e){d()}function h(){try{o.name=e.name,o.lastModified=e.lastModified}catch(e){}try{i.preserveExif&&"image/jpeg"===e.type&&(!i.fileType||i.fileType&&i.fileType===e.type)&&(o=pa(e,o))}catch(e){}return r(o)}})}function Ga(e,t){var r;if(null==e?void 0:e.extension){const t=e.extension.toLowerCase(),r={jpg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},jpeg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},png:{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},gif:{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},webp:{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},svg:{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(r[t])return r[t]}if(null==e?void 0:e.type){const t=Sr(e.type),r={"image/jpeg":{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},"image/png":{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},"image/gif":{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},"image/webp":{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},"image/svg+xml":{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(r[t])return r[t]}if(null==e?void 0:e.name){const t=null===(r=e.name.split(".").pop())||void 0===r?void 0:r.toLowerCase();if(t){const e={jpg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},jpeg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},png:{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},gif:{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},webp:{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},svg:{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(e[t])return e[t]}}if(t){const e=Sr(t),r=Er(e);let n="jpeg";return"png"===r?n="png":"svg"===r?n="svg":"jpeg"===r&&(n="jpeg"),{extension:r,mimeType:e,format:r,pixieFormat:n}}return{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"}}qa.getDataUrlFromFile=Ta,qa.getFilefromDataUrl=Ia,qa.loadImage=Fa,qa.drawImageInCanvas=Ra,qa.drawFileInCanvas=Na,qa.canvasToFile=ja,qa.getExifOrientation=Ba,qa.handleMaxWidthOrHeight=Ua,qa.followExifOrientation=Va,qa.cleanupCanvasMemory=Da,qa.isAutoOrientationInBrowser=za,qa.approximateBelowMaximumCanvasSizeOfBrowser=Pa,qa.copyExifWithoutOrientation=pa,qa.getBrowserName=Oa,qa.version="2.0.2";const Ya={MAX_SIZE_MB:.48,MAX_WIDTH_OR_HEIGHT:2e3,QUALITY:.8},Xa=["gif","svg"];function Ka(e,t){const{colorHex:r,colorHex2:n,colorHex3:i}=t,o=[`--icon-grad-1: ${r}`,`--icon-grad-2: ${n}`,`--icon-stroke-1: ${r}`,`--icon-stroke-2: ${n}`,`--icon-stroke-3: ${i}`,`--icon-fill-1: ${r}`,`--icon-fill-2: ${n}`,`--icon-fill-3: ${i}`,`color: ${r}`].join(";");let a=e.replace(/<svg([^>]*)>/i,(e,t)=>{let r=t;return/style="/i.test(r)?r=r.replace(/style="([^"]*)"/i,(e,t)=>`style="${t};${o}"`):r+=` style="${o}"`,`<svg${r}>`});return a=a.replace(/var\(--icon-color-1\)/g,r).replace(/var\(--icon-color-2\)/g,n).replace(/var\(--icon-color-3\)/g,i).replace(/var\(--icon-fill-1\)/g,r).replace(/var\(--icon-fill-2\)/g,n).replace(/var\(--icon-fill-3\)/g,i).replace(/var\(--icon-stroke-1\)/g,r).replace(/var\(--icon-stroke-2\)/g,n).replace(/var\(--icon-stroke-3\)/g,i).replace(/var\(--icon-grad-1\)/g,r).replace(/var\(--icon-grad-2\)/g,n).replace(/currentColor/g,r),a}function Za(e,t){const r=e.match(/\swidth="([0-9.]+)(px)?"/i),n=e.match(/\sheight="([0-9.]+)(px)?"/i);if(r&&n){const e=parseFloat(r[1]),i=parseFloat(n[1]);if(Number.isFinite(e)&&Number.isFinite(i)&&e>0&&i>0){const r=e/i;return r>=1?{width:t,height:Math.max(1,Math.round(t/r))}:{width:Math.max(1,Math.round(t*r)),height:t}}}const i=e.match(/viewBox="([^"]+)"/i);if(i){const e=i[1].trim().split(/\s+/);if(4===e.length){const r=parseFloat(e[2]),n=parseFloat(e[3]);if(Number.isFinite(r)&&Number.isFinite(n)&&r>0&&n>0){const e=r/n;return e>=1?{width:t,height:Math.max(1,Math.round(t/e))}:{width:Math.max(1,Math.round(t*e)),height:t}}}}return{width:t,height:t}}function Qa(e){if(!e)return null;const t=e.trim();if(t.endsWith("%"))return null;const r=parseFloat(t.replace(/px$/i,""));return Number.isFinite(r)&&r>0?r:null}function Ja(e,t=2,r=4096){const{width:n,height:i}=function(e){var t,r,n,i,o;const a=null!==(r=null===(t=e.match(/<\s*svg\b[\s\S]*?>/i))||void 0===t?void 0:t[0])&&void 0!==r?r:"",s=null===(n=a.match(/\bwidth\s*=\s*["']([^"']*)["']/i))||void 0===n?void 0:n[1],l=null===(i=a.match(/\bheight\s*=\s*["']([^"']*)["']/i))||void 0===i?void 0:i[1],c=Qa(s),u=Qa(l);if(null!=c&&null!=u)return{width:c,height:u};const d=null===(o=e.match(/viewBox\s*=\s*["']([^"']+)["']/i))||void 0===o?void 0:o[1];if(d){const e=d.trim().split(/[\s,]+/);if(4===e.length){const t=parseFloat(e[2]),r=parseFloat(e[3]);if(Number.isFinite(t)&&Number.isFinite(r)&&t>0&&r>0)return{width:t,height:r}}}return null!=c?{width:c,height:c}:null!=u?{width:u,height:u}:{width:300,height:300}}(e);let o=Math.max(1,Math.round(n*t)),a=Math.max(1,Math.round(i*t));const s=Math.max(64,r),l=Math.max(o,a);if(l>s){const e=s/l;o=Math.max(1,Math.round(o*e)),a=Math.max(1,Math.round(a*e))}return{width:o,height:a}}async function es(e,t,r,n,i){var o;const a=null!==(o=null==i?void 0:i.canvasScale)&&void 0!==o?o:2,s=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(s);try{const e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=()=>r(new Error("Failed to load SVG image")),e.src=l});const n=document.createElement("canvas"),i=Math.max(1,Math.round(t*a)),o=Math.max(1,Math.round(r*a));n.width=i,n.height=o;const s=n.getContext("2d");if(!s)throw new Error("Canvas 2D context is not available");return s.clearRect(0,0,i,o),s.drawImage(e,0,0,i,o),function(e){return new Promise((t,r)=>{e.toBlob(e=>{e?t(e):r(new Error("canvas.toBlob returned null"))},"image/png")})}(n)}finally{URL.revokeObjectURL(l)}}async function ts(e,t,r,n,i){const o=await es(e,t,r,0,i);return a=o,new Promise((e,t)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>{var e;return t(null!==(e=r.error)&&void 0!==e?e:new Error("readAsDataURL failed"))},r.readAsDataURL(a)});var a}function rs(e,t,r,n){return new File([e],t,{type:r,lastModified:n})}function ns(e,t){return t&&t!==e.name?rs(e,t,e.type,e.lastModified):e}async function is(e,t={}){const{maxSizeMB:r=Ya.MAX_SIZE_MB,maxWidthOrHeight:n=Ya.MAX_WIDTH_OR_HEIGHT,mimeType:i,fileName:o,libURL:a,enableCompression:s=!0,convertSvgToPng:l=!1}=t;if(!(e&&e instanceof File))return e;let c=e,u=!1;if(l){const t=(c.type||"").toLowerCase(),r=/\.svg$/i.test(c.name.trim()),i=t.includes("svg");let a=!1;if(!i&&!r)try{const e=await async function(e,t=24e3){const r=Math.min(t,Math.max(0,e.size));return e.slice(0,r).text()}(c);a=function(e){const t=e.trimStart().replace(/^\uFEFF/,"");return!!t.startsWith("<")&&/<\s*svg[\s>/]/i.test(t)}(e)}catch(e){a=!1}if(i||r||a)try{c=await async function(e,t={}){var r,n,i;const o=null!==(r=t.pixelScale)&&void 0!==r?r:2,a=null!==(n=t.maxLongEdge)&&void 0!==n?n:4096,s=await e.text(),{width:l,height:c}=Ja(s,o,a),u=await es(s,l,c,0,{canvasScale:1}),d=null!==(i=t.outputFileName)&&void 0!==i?i:e.name,h=/\.svg$/i.test(d)?d.replace(/\.svg$/i,".png"):`${d}.png`;return new File([u],h,{type:"image/png",lastModified:e.lastModified})}(c,{maxLongEdge:n,outputFileName:null!=o?o:c.name}),u=!0}catch(t){console.warn("prepareImageForUpload: SVG to PNG conversion failed, using original",t),c=e}}if(u)return c;const d=(c.type&&""!==c.type.trim()?c.type:Ir(c.name))||i||"image/jpeg",h=Sr(d);if(!h.startsWith("image/"))return ns(c,o);const f="image/webp"===(p=h)?"image/jpeg":p;var p;const g=Er(h),m=Er(f),v=f!==h?function(e,t){const r=t.startsWith(".")?t.slice(1):t,n=e.lastIndexOf(".");return n>0?`${e.substring(0,n)}.${r}`:`${e}.${r}`}(null!=o?o:c.name,m):null!=o?o:c.name,y=s&&(b=g,!Xa.includes(b));var b;if(!y&&!(f!==h))return ns(c,v);try{const t={libURL:a,useWebWorker:!0,fileType:f};y?(t.maxSizeMB=r,t.maxWidthOrHeight=n):(t.maxSizeMB=Math.max(e.size/1048576+1,1),t.initialQuality=1,t.alwaysKeepResolution=!0);const i=await qa(c,t);return function(e,t,r,n){const i=null!=n?n:t.name;return e instanceof File?e.type!==r||e.lastModified!==t.lastModified||e.name!==i?rs(e,i,r,t.lastModified):e:rs(e,i,r,t.lastModified)}(i,c,Sr(i.type||f),v)}catch(e){console.error("prepareImageForUpload failed",e);try{return ns(c,v)}catch(e){return console.error("Failed to create File with normalized name after image preparation error",e),c}}}async function os(e){const{folderId:t,dataProviders:r,folders:n,pathHistory:i,t:o}=e,a=null==t?"":String(t);if(!a||"folders"===a)return o("Folders");if("Trash"===a)return o("Trash");const s=i||[],l=s[s.length-1];if((null==l?void 0:l.id)===a&&l.name)return l.name;const c=[...s].reverse().find(e=>e.id===a);if(null==c?void 0:c.name)return c.name;const u=null==r?void 0:r.getItem;if(u)try{const e=await Promise.resolve(u(a));if(null==e?void 0:e.name)return e.name}catch(e){}const d=null==n?void 0:n.find(e=>e.id===a);return(null==d?void 0:d.name)?d.name:a}const as=/^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;function ss(e){const t=new URL(e.trim());t.hash="",t.hostname=t.hostname.toLowerCase(),("https:"===t.protocol&&"443"===t.port||"http:"===t.protocol&&"80"===t.port)&&(t.port="");const r=Array.from(t.searchParams.entries()).filter(([e])=>!as.test(e)).sort(([e,t],[r,n])=>{const i=e.localeCompare(r);return 0!==i?i:t.localeCompare(n)});return t.search="",r.forEach(([e,r])=>t.searchParams.append(e,r)),t.toString()}function ls(e){return!!(null==e?void 0:e.startsWith("image/"))&&"image/gif"!==e}function cs(e,t){if(t===e.name)return e;try{return new File([e],t,{type:e.type,lastModified:e.lastModified})}catch(t){return console.warn("Failed to create normalized File:",t),e}}function us(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>{var e;return r(null!==(e=n.error)&&void 0!==e?e:new Error("Failed to read proxied file"))},n.readAsDataURL(e)})}function ds(e){try{const t=new URL(e).pathname.split("/").pop();return t?decodeURIComponent(t):void 0}catch(e){return}}function hs(e){return null==e||""===e||"folders"===e?null:e}async function fs(e){const t=await fetch(e,{mode:"cors"});if(!t.ok)throw new ua(`HTTP ${t.status}`,"UploadUrlDownloadFailed",t.status);return t.blob()}function ps(e,t){var r,n;if(!(e instanceof Blob)||0===e.size)throw new ua(t("Failed to download file from the URL."),"UploadUrlDownloadFailed");const i=(null===(n=null===(r=e.type)||void 0===r?void 0:r.split(";")[0])||void 0===n?void 0:n.trim())||"image/png";if(!i.startsWith("image/"))throw new ua(t("Content type at the URL is not allowed."),"UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:i}}const gs=()=>{var e,t,r,n;const{state:o,actions:a,options:s}=Oo(),l=$o(),{sortBy:u,sortOrder:d}=l.state,{actions:{fetchFolders:h}}=la(),{t:f}=ri(),p=Yo(),{deleteItems:g}=ca(),{selectedFolder:m,urlForm:v,pagination:y,files:b,pathHistory:w,folders:x}=o,C=i.useRef(null),_=i.useRef([]);C.current=y,_.current=Array.isArray(b)?b:[];const S=i.useRef(null),{setFiles:A,setLoading:k,setIsUrlModalVisible:E,setActiveLibraryItem:I,setPagination:T,setSelectedFolder:F,setPathHistory:O}=a,{dataProviders:P}=s,M=c(async e=>{var t,r,n,i,o;if(!(null==P?void 0:P.getFiles))return[];const a=null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.disablePagination,l=a?void 0:null!==(r=null==e?void 0:e.page)&&void 0!==r?r:1,c=a?void 0:null!==(n=null==e?void 0:e.limit)&&void 0!==n?n:20,{files:u,pagination:d}=await P.getFiles({folderId:"folders"!==(null==e?void 0:e.folderId)?null==e?void 0:e.folderId:void 0,noFolder:null==e?void 0:e.noFolder,search:(null===(i=null==e?void 0:e.search)||void 0===i?void 0:i.trim())||void 0,sortBy:null==e?void 0:e.sortBy,sortOrder:null==e?void 0:e.sortOrder,page:l,limit:c,itemType:(null==e?void 0:e.itemType)||"all"});return T&&((null===(o=null==s?void 0:s.config)||void 0===o?void 0:o.disablePagination)?T({current:1,pageSize:u.length||1,total:u.length||0}):d&&T({current:d.page,pageSize:d.limit,total:d.total})),u},[P,null===(e=null==s?void 0:s.config)||void 0===e?void 0:e.disablePagination,T]),R=c(async(e,t,r)=>Ii(P,e,t,r,qr(null==s?void 0:s.config)),[P,null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient]),L=c(async(e,t=!1)=>{var r,n,i;try{null==k||k(!0);let t=[];if(!(null==P?void 0:P.getFiles))return void console.error("DataProvider for getting files is not defined");t=await M(e);const r=null!=e?e:{folderId:m||"",itemType:"all"};"file"!==r.itemType&&(t=await Wo(t,r,null==P?void 0:P.getFolders)),"Trash"!==(m||"")&&(t=t.filter(e=>!(e.isFolder&&"Trash"===e.id))),null==A||A(t);const n=hs(r.folderId);if(n===hs(m)){const e=Array.isArray(w)?w:[];S.current={selectedFolder:null!=m?m:null,pathHistory:e.map(e=>Object.assign({},e))}}}catch(o){if("StaleLoad"===(null==o?void 0:o.name))return;const a=Jo(o),l=404===(null==a?void 0:a.status)||"FileNotFound"===(null==a?void 0:a.code)||"path_folder_not_found"===(null==a?void 0:a.code);if(l||console.error("Error loading files:",o),!t&&l){const t=aa(o,w||[]);try{return await sa({options:s,pathFolder:t,dataProviders:null==s?void 0:s.dataProviders}),void await L(e,!0)}catch(e){console.error("Cache clear failed:",e)}}if(l&&F&&O){const t=Array.isArray(w)?w:[];if(t.length>1){const n=t.slice(0,-1),i=n[n.length-1],o=null!==(r=null==i?void 0:i.id)&&void 0!==r?r:"folders";return O(n),F(o),await h(),p.success({id:"FOLDER_NOT_FOUND_NAVIGATE",message:f("Folder not found"),description:f("Navigated to parent folder"),placement:"bottomRight"}),void await L(Object.assign(Object.assign({},e),{folderId:o}),!1)}return O([{id:"folders",name:f("Folders")}]),F("folders"),await h(),p.success({id:"FOLDER_NOT_FOUND_NAVIGATE",message:f("Folder not found"),description:f("Navigated to root folder"),placement:"bottomRight"}),void await L(Object.assign(Object.assign({},e),{folderId:"folders"}),!1)}const c=S.current;if(c&&F&&O){const e=Array.isArray(w)?w:[],t=(null!==(n=c.selectedFolder)&&void 0!==n?n:null)===(null!=m?m:null),r=function(e,t){return e.length===t.length&&e.every((e,r)=>{var n;return e.id===(null===(n=t[r])||void 0===n?void 0:n.id)})}(c.pathHistory,e);t&&r||(F(c.selectedFolder),O(c.pathHistory.map(e=>Object.assign({},e))),s.onPathChange&&s.onPathChange(c.pathHistory.map(e=>e.name)))}const u=Zo(null==a?void 0:a.code,f),d=null!=e?e:{folderId:m||"",itemType:"all"},g=void 0!==d.folderId&&""!==d.folderId?d.folderId:m||"",v=Array.isArray(w)?w.map(e=>Object.assign({},e)):[],y=null===(i=d.folderName)||void 0===i?void 0:i.trim(),b=y&&y.length>0?y:await os({folderId:g,dataProviders:P,folders:Array.isArray(x)?x:[],pathHistory:v,t:f}),C=f("Failed to load files"),_=f("Failed to load files in folder",{folderName:b}),A=u&&u!==C?u:void 0;p.error({id:"FILES_FETCH_FAILED",message:_,description:A,placement:"bottomRight",innerException:o,notificationDedupe:!0,data:{params:Object.assign(Object.assign({},d),{folderName:b}),folderName:b}})}finally{null==k||k(!1)}},[P,A,k,F,O,M,h,m,x,p,f,w,s]),N=c(e=>L(e),[L]),j=c(async(e,t)=>{var r;if(!(null==P?void 0:P.findFileByUrl))return null;const n=ss(e);try{return null!==(r=await P.findFileByUrl(n))&&void 0!==r?r:null}catch(e){return console.warn("findFileByUrl failed, falling back to direct loading",e),null}},[P]),D=c(async(e,t)=>{var r,n,i;fa(e,f);const o=ss(e),a=await j(o,t);if(a)return{kind:"existing",file:a,normalizedUrl:o};let l,c,u;const d=null===(r=null==s?void 0:s.config)||void 0===r?void 0:r.fetchWithProxy,h=null===(n=null==s?void 0:s.config)||void 0===n?void 0:n.handleFileProxy,p=null===(i=null==s?void 0:s.config)||void 0===i?void 0:i.handleProxyUrl,g=function(e){if("undefined"==typeof window)return!1;try{return new URL(e).origin===window.location.origin}catch(e){return!1}}(o);if(!g&&d)try{const e=await Promise.resolve(d(o,{mode:"cors"},{intent:"downloadBlob"}));if(!e.ok)throw new ua(`HTTP ${e.status}`,"UploadUrlDownloadFailed",e.status);const t=ps(await e.blob(),f);l=t.blob,c=t.mimeType}catch(e){u=e,console.warn("fetchWithProxy failed or returned a non-image blob, falling back to next strategy",e)}if(!g&&!l&&h)try{const e=ps(await Promise.resolve(h(o)),f);l=e.blob,c=e.mimeType}catch(e){u=e,console.warn("handleFileProxy failed or returned a non-image blob, falling back to next strategy",e)}if(!g&&!l&&p)try{const e=await Promise.resolve(p(o)),t=ps(await fs(e),f);l=t.blob,c=t.mimeType}catch(e){u=e,console.warn("handleProxyUrl fetch failed or returned a non-image blob, falling back to direct fetch",e)}if(!l)try{const e=ps(await fs(o),f);l=e.blob,c=e.mimeType}catch(e){u=e}if(!l||!c)throw u instanceof Error?u:new ua(f("Failed to download file from the URL."),"UploadUrlDownloadFailed");const m=Er(c),v=ds(o)||"uploaded-file",y=v.replace(/\.[^.]+$/,"")||"uploaded-file";return{kind:"blob",blob:l,normalizedUrl:o,mimeType:c,extension:m,fileName:Wr(v.includes(".")?v:`${y}.${m}`,null==s?void 0:s.config)}},[j,null==s?void 0:s.config,f]),z=c(async(e,t)=>{var r,n,i,o;fa(e,f);const a=ss(e);try{const e=await D(a,t);if("existing"===e.kind)return e.file;return{thumbnail:await us(e.blob),name:e.fileName,type:e.mimeType,extension:e.extension,size:e.blob.size,sourceUrl:e.normalizedUrl,saveWithoutFolder:!0}}catch(e){let u=e;if(null==P?void 0:P.uploadFileByUrl)try{const e=null!=m?m:"",t=Wr(ds(a)||"uploaded-file",null==s?void 0:s.config),i=await R(t,e,!1),o=await P.uploadFileByUrl({url:a,folderId:e,name:i,eventSource:"pixie"}),l=ps(null!==(r=(null==o?void 0:o.id)&&P.getFileData?await P.getFileData(o.id):void 0)&&void 0!==r?r:(null==o?void 0:o.url)?await fs(o.url):(null==o?void 0:o.thumbnailUrl)?await fs(o.thumbnailUrl):(null==o?void 0:o.sourceUrl)?await fs(o.sourceUrl):void 0,f),c=await us(l.blob);return Object.assign(Object.assign({},o),{thumbnail:c,type:o.type||l.mimeType,extension:o.extension||Er(l.mimeType),size:null!==(n=o.size)&&void 0!==n?n:l.blob.size,sourceUrl:o.sourceUrl||a})}catch(e){u=e,console.warn("Failed to prepare file for Pixie via uploadByUrl fallback",e)}const d=Jo(u),h=(l=null==d?void 0:d.code,c="UploadUrlDownloadFailed","string"==typeof l?l:c),g=u instanceof ua?u:new ua(null!==(o=null!==(i=Zo(h,f))&&void 0!==i?i:null==d?void 0:d.message)&&void 0!==o?o:f("Failed to download file from the URL."),h,null==d?void 0:d.status);throw g.notificationShown=!0,await p.error({id:"EDITOR_PROXY_FILE_FAILED",message:g.message,placement:"bottomRight",data:{url:a,folderId:m||null,error:d,eventSource:"pixie"},innerException:u},t),g}var l,c},[P,p,null==s?void 0:s.config,D,R,m,f]),B=c(async e=>{const t=C.current;try{const r=_.current.find(t=>t.id===e),n=e=>{if(!e)return;const t=b.find(t=>t.id===e);return null==t?void 0:t.name};await g({items:[{id:e,isFolder:null==r?void 0:r.isFolder}],selectedFolder:m,getItemNameById:n,showNotifications:!0});const i=Object.assign({},t);let o=t.current;1===b.length&&(o=i.current>1?i.current-1:1),await N({folderId:m||"",page:o,limit:t.pageSize,sortBy:u,sortOrder:d})}catch(t){console.error("ОError when deleting a file:",t);const r=t;(null==r?void 0:r.notificationShown)||p.error({id:"FILES_DELETE_ERROR",message:f("Error when deleting a file"),placement:"bottomRight",innerException:t,data:{failCount:1,totalCount:1,itemIds:[e],folderId:m||null,errors:[{itemId:e,error:Jo(t)}]}})}},[g,N,m,f,p,b,u,d]),U=c(async e=>{try{const t=C.current;if(!(null==P?void 0:P.deleteFolder))return void p.error({id:"FOLDER_DELETE_ERROR",message:f("DataProvider for folder deletion is not configured"),placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e}});if(!await P.deleteFolder(e)){const e=new Error("Не удалось удалить папку");throw e.notificationShown=!1,e}p.success({id:"FOLDER_DELETE_SUCCESS",message:f("Folder deleted"),placement:"bottomRight",data:{successCount:1,totalCount:1,itemIds:[e],folderId:e}});m===e?await N({page:t.current,limit:t.pageSize,sortBy:u,sortOrder:d}):await N({folderId:m||"",sortBy:u,sortOrder:d,page:t.current,limit:t.pageSize})}catch(t){console.error("Error when deleting a folder:",t);const r=t;(null==r?void 0:r.notificationShown)||p.error({id:"FOLDER_DELETE_ERROR",message:f("Error when deleting a folder"),innerException:t,placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e,errors:[{itemId:e,error:Jo(t)}]}})}},[P,m,p,f,N,u,d]),V=c(async(e,t)=>{var r,n;try{if(null==P?void 0:P.getFileData){const t=await P.getFileData(e);if(t)return t;throw new Error(f("Failed to download file"))}{const t=await fetch(`/api/files/${e}/content`);if(!t.ok)throw new Error(f("Error loading image"));return await t.blob()}}catch(i){console.error("Error when loading a file:",i);const o=_.current.find(t=>t.id===e);t||p.error({id:"FILE_DOWNLOAD_FAILED",message:f("Failed to download file"),placement:"bottomRight",description:(null==o?void 0:o.name)||e,innerException:i,notificationDedupe:!1,data:{itemId:e,itemName:(null==o?void 0:o.name)||e,folderId:null!==(r=null==o?void 0:o.folderId)&&void 0!==r?r:null,thumbnail:null!==(n=null==o?void 0:o.thumbnail)&&void 0!==n?n:null}},t)}},[P,p,f]),H=c(async(e,t,r,n)=>{var i,a,l,c,u,d,h,g,v,y,b,w,x,C,_;if("Trash"===(n?"":null!=t?t:m||""))throw new Error(f("Upload to Trash is forbidden"));const S=Wr(e.name,null==s?void 0:s.config),A=S.split(".").pop()||"",k=n?"":null!=t?t:m||"";let E=e;try{if(Tr(e)){const t=null!==(a=null===(i=null==s?void 0:s.config)||void 0===i?void 0:i.compressMaxSize)&&void 0!==a?a:Ya.MAX_SIZE_MB,r=null!==(c=null===(l=null==s?void 0:s.config)||void 0===l?void 0:l.compressMaxWidthOrHeight)&&void 0!==c?c:2e3,n=null!==(d=null===(u=null==s?void 0:s.config)||void 0===u?void 0:u.compessorUrl)&&void 0!==d?d:null===(h=null==s?void 0:s.config)||void 0===h?void 0:h.compressorUrl,o=(null===(g=e.type)||void 0===g?void 0:g.trim())||Ir(e.name)||e.type;E=await is(e,{maxSizeMB:t,maxWidthOrHeight:r,mimeType:o,fileName:S,libURL:n,enableCompression:ls(o),convertSvgToPng:!0})}else E=cs(e,S)}catch(t){console.warn("Image preparation failed, uploading original file",t),E=cs(e,S)}let T=E.name;const F=qr(null==s?void 0:s.config);F&&(T=await R(T,k,n)),F&&(E=cs(E,T));try{if(null==P?void 0:P.uploadFiles)try{const t=await P.uploadFiles({items:[{name:T,size:E.size,type:E.type||e.type,folderId:k,data:E,extension:A,noFolder:n}],folderId:k});if(t.success&&t.detailed&&t.detailed.length>0){const i=t.detailed[0];if(!i.success||!i.data){if(!r){const e=(null==i?void 0:i.error)?String(i.error):f("Failed to upload file");p.error({id:"FILE_UPLOAD_ITEM_FAILED",message:e,placement:"bottomRight",description:S,innerException:null==i?void 0:i.error,data:{itemName:S,folderId:k||null,eventSource:"upload"}})}return void(I&&I(Jt))}{const t=i.data;if(t.id){const r=(null!==(v=t.folderId)&&void 0!==v?v:k)||void 0,i=null!==(y=null!=r?r:m)&&void 0!==y?y:"";await N({folderId:i,noFolder:n});let a=o.files.find(e=>e.id===t.id);if(!a)try{a=(await M({folderId:r,noFolder:n,itemType:"all"})).find(e=>e.id===t.id)}catch(e){console.warn("uploadFileWithProvider: не удалось получить свежий список файлов",e)}return I&&I(Jt),a||Object.assign(Object.assign({},t),{id:t.id,name:t.name||S,folderId:null!==(w=null!==(b=t.folderId)&&void 0!==b?b:k)&&void 0!==w?w:null,type:E.type||e.type,size:E.size,extension:A||S.split(".").pop()||"",thumbnail:null!==(x=t.thumbnail)&&void 0!==x?x:void 0,url:null!==(C=t.url)&&void 0!==C?C:void 0,thumbnailUrl:null!==(_=t.thumbnailUrl)&&void 0!==_?_:void 0,isFolder:!1,selected:!1})}}}else if(!t.success){if(!r){const e=t.error?String(t.error):f("Failed to upload file");p.error({id:"FILE_UPLOAD_ITEM_FAILED",message:e,placement:"bottomRight",description:S,innerException:t.error,data:{itemName:S,folderId:k||null,eventSource:"upload"}})}return void(I&&I(Jt))}return void(I&&I(Jt))}catch(e){throw e}if(null==P?void 0:P.uploadFile){const t=await P.uploadFile({name:T,size:E.size,type:E.type||e.type,folderId:k,noFolder:n,data:E,extension:A});return I&&I(Jt),t}return void(r||p.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:f("DataProvider for file upload is not configured"),placement:"bottomRight"}))}catch(e){const t=Jo(e),n=Zo(null==t?void 0:t.code,f);return r?void 0:void p.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!=n?n:f("Failed to upload file"),placement:"bottomRight",description:S,innerException:e,data:{itemName:S,folderId:k||null,error:Jo(e),eventSource:"upload"}})}},[P,m,I,o.files,N,M,p,f,null==s?void 0:s.config]),W=c(async(e,t)=>{var r;if(!(null==P?void 0:P.getFolders)||!(null==P?void 0:P.createFolder))return e||"";try{const n=await P.getFolders(),i=Array.isArray(n)?n:[],o=(e,t)=>i.find(r=>{var n;return(null!==(n=r.parentId)&&void 0!==n?n:null)===(null!=e?e:null)&&r.name===t});let a=null!=e?e:"";for(const e of t){if(!e)continue;let t=o(a,e);if(!t){const r=await P.createFolder({name:e,parentId:null!=a?a:null});i.push(r),t=r}a=t.id}return null!==(r=a)&&void 0!==r?r:e||""}catch(t){return console.warn("ensureFolderPath: unable to guarantee the path",t),e||""}},[P]),$=c(async(e,t)=>{var r,n,i,o;if(!(null===(n=null===(r=e.type)||void 0===r?void 0:r.startsWith)||void 0===n?void 0:n.call(r,"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 r=e.filter(Boolean);r.length&&(s=await W(t||"",r)||t||"")}return null!==(o=null!==(i=s)&&void 0!==i?i:t)&&void 0!==o?o:null},[W]);c(async e=>{var t,r,n,i,o,a,s,l,c,u,d,h;const{file:f,selectedFolderId:p,uploadFn:g,progressCallbacks:m}=e;if(!(null===(r=null===(t=f.type)||void 0===t?void 0:t.startsWith)||void 0===r?void 0:r.call(t,"image/")))return{success:!0,fileName:f.name,folderId:null!=p?p:null};const v=null!==(i=null!==(n=await $(f,p))&&void 0!==n?n: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)}},[$]);const q=c(async(e,t)=>{var r,n,i,o,a,l,c,u,d,h,g,v,y,b,w,x,C,_,S,A,k,E,T,F,O,M,R,L,N,j,D,z,B,U,V;if(0===e.length)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};null===(r=null==t?void 0:t.onStartBatch)||void 0===r||r.call(t,e);const H=e=>{const t=e.filter(Boolean);return t.length>0&&t.length<=5?t.join(", "):null},W=[];for(let r=0;r<e.length;r++){const v=e[r];if(!Tr(v)){const e=await p.warning({id:"FILES_UPLOAD_UNSUPPORTED_TYPE",message:f("Unsupported file type"),placement:"bottomRight",data:{itemName:v.name,fileType:v.type,folderId:m||null}});null===(n=null==t?void 0:t.onError)||void 0===n||n.call(t,v.name,e.message);continue}const y=Wr(v.name,null==s?void 0:s.config);let b=v;try{if(Tr(v)){const e=null!==(o=null===(i=null==s?void 0:s.config)||void 0===i?void 0:i.compressMaxSize)&&void 0!==o?o:Ya.MAX_SIZE_MB,t=null!==(l=null===(a=null==s?void 0:s.config)||void 0===a?void 0:a.compressMaxWidthOrHeight)&&void 0!==l?l:2e3,r=null!==(u=null===(c=null==s?void 0:s.config)||void 0===c?void 0:c.compessorUrl)&&void 0!==u?u:null===(d=null==s?void 0:s.config)||void 0===d?void 0:d.compressorUrl,n=(null===(h=v.type)||void 0===h?void 0:h.trim())||Ir(v.name)||v.type;b=await is(v,{maxSizeMB:e,maxWidthOrHeight:t,mimeType:n,fileName:y,libURL:r,enableCompression:ls(n),convertSvgToPng:!0})}else b=cs(v,y)}catch(e){console.warn("Image preparation failed, uploading original file",e),b=cs(v,y)}const w=`${Date.now()}-${r}-${Math.random().toString(36).slice(2,8)}`,x=await $(b,m);null===(g=null==t?void 0:t.onStart)||void 0===g||g.call(t,b),W.push({file:b,targetFolderId:x,requestId:w,originalFileName:v.name,originalIndex:r})}const q=W.length;if(0===q)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};const G=qr(null==s?void 0:s.config),Y=new Map;if(G&&(null==P?void 0:P.getFiles)){const e=[...new Set(W.map(e=>{var t,r;return null!==(r=null!==(t=e.targetFolderId)&&void 0!==t?t:m)&&void 0!==r?r:""}).filter(e=>null!=e))];for(const t of e)try{const{files:e}=await P.getFiles({folderId:""===t?"":null!=t?t:void 0,itemType:"all",page:1,limit:1e4});let r=(e||[]).map(e=>e.name).filter(e=>!!e);if(null==P?void 0:P.getFolders){const e=(await P.getFolders({parentId:t||null,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);r=[...r,...e]}Y.set(t,r)}catch(e){console.warn("Could not fetch files for duplicate check:",e)}}const X=new Map,K=W.map(e=>{const t=G?((e,t)=>{const r=null!=e?e:"";let n=Y.get(r)||[],i=X.get(r);i||(i=new Set(n.map(e=>e.toLowerCase())),X.set(r,i));const o=Ei(t,Array.from(i));return i.add(o.toLowerCase()),o})(e.targetFolderId,e.file.name):e.file.name,r=G?cs(e.file,t):e.file;return Object.assign(Object.assign({},e),{resolvedUploadName:t,uploadFile:r})}),Z=!t,Q=1===q&&Z,J=[],ee=[],te=[],re=[],ne=new Map;let ie=0,oe=0;const ae=null!==(y=null===(v=null==s?void 0:s.config)||void 0===v?void 0:v.maxFileSize)&&void 0!==y?y:52428800,se=async(e,r,n,i)=>{var o,a;const{emitProgress:s=!0,emitNotification:l=!0}=null!=i?i:{};ie++,J.push(e),ee.push(null!=n?n:e),await((e,t,r,n)=>{var i;return p.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${f("File")} ${e} ${f("has been successfully uploaded")}`,placement:"bottomRight",data:{itemId:r,itemName:e,folderId:null!==(i=null!=t?t:m)&&void 0!==i?i:null,eventSource:"upload"}},n||!Z)})(e,r,n,!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))},le=async(e,r,n,i)=>{var o;const{emitProgress:a=!0,emitNotification:s=!0,fileSize:l,progressCallbackName:c,progressCallbackIndex:u}=null!=i?i:{};oe++;const d=null!=l?{fileSize:l,maxSize:ae}:void 0,h=await((e,t,r,n,i)=>{var o,a,s,l,c,u,d;const h=Jo(r),g=null!==(o=null==i?void 0:i.fileSize)&&void 0!==o?o:null==h?void 0:h.fileSize,v=null!==(s=null!==(a=null==i?void 0:i.maxSize)&&void 0!==a?a:null==h?void 0:h.maxSize)&&void 0!==s?s:ae,y={allowedChars:"a-z A-Z 0-9 . _ -",fileSize:null!=g?Si(Number(g)):void 0,maxSize:null!=v?Si(Number(v)):void 0},b=null==h?void 0:h.code,w="BatchItemLimitExceeded"===b||"exceeded_max_files"===b?b:null!==(l=Qo(null==h?void 0:h.message))&&void 0!==l?l:b,x="BatchItemLimitExceeded"===w||"exceeded_max_files"===w?ea(r,f):Zo(w,f,y),C=(null==h?void 0:h.message)&&"string"==typeof h.message&&h.message.length>0?h.message:null,_=r instanceof Error?r.message:"string"==typeof r?r:null,S=_&&"[object Object]"!==_?_:null;return p.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!==(u=null!==(c=null!=C?C:x)&&void 0!==c?c:S)&&void 0!==u?u:f("Error uploading file {{fileName}}",{fileName:e}),placement:"bottomRight",data:{itemName:e,folderId:null!==(d=null!=t?t:m)&&void 0!==d?d:null,error:Jo(r),eventSource:"upload"},innerException:r},n||!Z)})(e,r,n,!s,d);a&&(null===(o=null==t?void 0:t.onError)||void 0===o||o.call(t,null!=c?c:e,h.message,u)),re.push({itemId:void 0,itemName:e,error:Jo(n)}),te.push({fileName:e,error:h.message})};let ce;if(!(null==P?void 0:P.uploadFiles))return p.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:f("DataProvider for file upload is not configured"),placement:"bottomRight"}),{successCount:0,failCount:q,successes:[],errors:[],totalCount:q};{const e=[];try{(null==t?void 0:t.onProgress)&&W.forEach(r=>{let n=0;const i=window.setInterval(()=>{var e;n=Math.min(n+10+Math.floor(Date.now()%10),90),null===(e=null==t?void 0:t.onProgress)||void 0===e||e.call(t,r.file.name,n)},200);e.push(i)}),ce=await P.uploadFiles({items:K.map(e=>{var t,r;return{requestId:e.requestId,name:e.resolvedUploadName,size:e.uploadFile.size,type:e.uploadFile.type,folderId:null!==(r=null!==(t=e.targetFolderId)&&void 0!==t?t:m)&&void 0!==r?r:null,data:e.uploadFile,extension:e.uploadFile.name.split(".").pop()||""}}),folderId:null!=m?m:null}),e.forEach(e=>window.clearInterval(e)),e.length=0;const r=null!==(b=ce.detailed)&&void 0!==b?b:[],n=new Map(r.filter(e=>e.requestId).map(e=>[e.requestId,e]));if(r.length>0)for(let e=0;e<K.length;e++){const t=K[e],i=null!==(w=t.requestId?n.get(t.requestId):void 0)&&void 0!==w?w:r[e];if(i&&i.success){const e=i.data,r=null!==(x=null==e?void 0:e.name)&&void 0!==x?x:t.resolvedUploadName,n=null!==(S=null!==(_=null!==(C=null==e?void 0:e.folderId)&&void 0!==C?C:t.targetFolderId)&&void 0!==_?_:m)&&void 0!==S?S:null,o=null==e?void 0:e.id;ne.set(r,{id:o,name:r,folderId:n,size:null==e?void 0:e.size,originalFileName:t.originalFileName,originalIndex:t.originalIndex}),await se(r,n,o,{emitNotification:Q})}else{const e=null==i?void 0:i.data,r=null!==(A=null==e?void 0:e.name)&&void 0!==A?A:t.resolvedUploadName,n=null!==(T=null!==(E=null!==(k=null==e?void 0:e.folderId)&&void 0!==k?k:t.targetFolderId)&&void 0!==E?E:m)&&void 0!==T?T:null;await le(r,n,null!==(F=null==i?void 0:i.error)&&void 0!==F?F:new Error(f("Error uploading file")),{emitNotification:Q,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}else if(ce.success)for(const e of K){const t=e.resolvedUploadName,r=null!==(M=null!==(O=e.targetFolderId)&&void 0!==O?O:m)&&void 0!==M?M:null;await se(t,r,void 0,{emitNotification:Q})}else{const e=null!==(R=ce.error)&&void 0!==R?R:new Error(f("Error uploading file"));for(const t of K){const r=t.resolvedUploadName,n=null!==(N=null!==(L=t.targetFolderId)&&void 0!==L?L:m)&&void 0!==N?N:null;await le(r,n,e,{emitNotification:Q,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}}catch(e){for(const t of K){const r=t.resolvedUploadName,n=null!==(D=null!==(j=t.targetFolderId)&&void 0!==j?j:m)&&void 0!==D?D:null;await le(r,n,null!=e?e:new Error(f("Error uploading file")),{emitNotification:Q,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}finally{e.forEach(e=>window.clearInterval(e))}}if(ie>0&&(I&&I(Jt),q>1&&Z)){const e=H(J),t=e?f("Uploaded",{names:e}):f("uploads_success_summary",{successCount:ie,totalCount:q});p.success({id:"FILES_UPLOAD_BATCH_SUCCESS",message:t,placement:"bottomRight",data:{successCount:ie,totalCount:q,itemIds:ee,itemNames:J,folderId:null!=m?m:null,eventSource:"upload"}})}if(oe>0&&Z&&!Q)if(q>1){const e=te.map(e=>e.fileName),t=H(e),r=t?f("Failed",{names:t}):f("uploads_fail_summary",{failCount:oe,totalCount:q});p.error({id:"FILES_UPLOAD_BATCH_FAILED",message:r,placement:"bottomRight",data:{failCount:oe,totalCount:q,itemNames:e,folderId:null!=m?m:null,errors:re,eventSource:"upload"}})}else if(1===q&&re.length>0&&(null===(z=re[0].error)||void 0===z?void 0:z.code)){const e=Zo(null===(B=re[0].error)||void 0===B?void 0:B.code,f),t=null!==(V=null===(U=te[0])||void 0===U?void 0:U.fileName)&&void 0!==V?V:"",r=null!=e?e:t?`${f("Failed to upload files")}: ${t}`:f("Failed to upload files");p.error({id:"FILES_UPLOAD_BATCH_FAILED",message:r,placement:"bottomRight",data:{failCount:oe,totalCount:q,itemNames:[t],folderId:null!=m?m:null,errors:re,eventSource:"upload"}})}return{successCount:ie,failCount:oe,successes:J,errors:te,totalCount:q,uploadedFiles:ne.size>0?ne:void 0}},[P,null===(r=null==s?void 0:s.config)||void 0===r?void 0:r.dedupeUploadNamesOnClient,p,$,m,I,f,null==s?void 0:s.config]),G=c(async e=>{var t;if(!(null==P?void 0:P.uploadFiles))return void p.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:f("DataProvider for file upload is not configured"),placement:"bottomRight"});if("Trash"===m)return void p.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:f("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:m||null,reason:"Upload to Trash is not allowed"}});const r=C.current,n=document.createElement("input");n.type="file",n.accept="image/*",n.multiple=!0;try{!(!(null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.features)||!s.config.features.enableDirectoryUpload)&&(n.webkitdirectory=!0)}catch(e){}n.onchange=async t=>{var n;const i=t.target.files;if(!i||0===i.length)return;const o=Array.from(i);try{null==k||k(!0);const{successes:t,errors:i,uploadedFiles:a}=await q(o,e);null===(n=null==e?void 0:e.onBatchComplete)||void 0===n||n.call(e,{files:o,successes:t,errors:i,uploadedFiles:a}),await h(),await N({folderId:m||"",sortBy:u,sortOrder:d,page:r.current,limit:r.pageSize})}catch(e){console.error("Error when loading files:",e)}finally{null==k||k(!1)}},n.click()},[null==P?void 0:P.uploadFiles,m,p,f,k,N,h,u,d,q,null===(n=null==s?void 0:s.config)||void 0===n?void 0:n.features]),Y=c(async(e,t,r,n="uploadByUrl")=>{const i=C.current,o=Boolean(e&&String(e).trim());let a,l=null!=e?e:null;try{if(!t&&"Trash"===m)throw r||p.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:f("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:m||null,reason:"Upload to Trash is not allowed"}}),new ua(f("Cannot upload files to Trash"),"UploadUrlDownloadFailed");let e,c;if(!l&&v&&(e=await v.validateFields(),l=null==e?void 0:e.fileUrl),!l)throw r||p.error({id:"FILES_UPLOAD_URL_VALIDATION_FAILED",message:f("Please fill in all fields"),placement:"bottomRight",data:{url:null!=l?l:null,folderId:m||null,eventSource:n}}),new ua(f("Please fill in all fields"),"UploadUrlInvalid");if(fa(l,f),l=ss(l),null==k||k(!0),l){const e=l.split("?")[0].split("#")[0].split("/");c=e[e.length-1]||"uploaded-file",c=Wr(c,null==s?void 0:s.config)}const h=t?"":m||"",g=Boolean((null==P?void 0:P.uploadFiles)||(null==P?void 0:P.uploadFile)),y=Boolean(null==P?void 0:P.uploadFileByUrl);let b=c;b&&y&&(b=await R(b,h,t));try{const e=await D(l,r);if("existing"===e.kind)a=e.file;else if(g){const r=new File([e.blob],e.fileName,{type:e.mimeType,lastModified:Date.now()});try{a=await H(r,h,!0,t)}catch(e){throw e.uploadUrlStage="binaryUpload",e}if(!a){const e=new ua(f("Failed to upload file"),"FileUploadBackendError");throw e.uploadUrlStage="binaryUpload",e}}else{if(!y)throw r||p.error({id:"FILES_UPLOAD_URL_NOT_SUPPORTED",message:f("Upload by URL is not supported"),placement:"bottomRight",data:{url:l,folderId:m||null,eventSource:n}}),new ua(f("Upload by URL is not supported"),"UploadUrlDownloadFailed");a=await P.uploadFileByUrl({url:l,folderId:m||"",noFolder:t,name:b,eventSource:n})}}catch(e){const r=e;if("binaryUpload"===(null==r?void 0:r.uploadUrlStage)||!y)throw e;console.warn("Failed to fetch file by URL locally, falling back to uploadByUrl",e),a=await P.uploadFileByUrl({url:l,folderId:m||"",noFolder:t,name:b,eventSource:n})}const w=(null==e?void 0:e.name)||(null==a?void 0:a.name)||"unnamed file";return a&&p.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${f("File")} ${w} ${f("successfully uploaded")}`,placement:"bottomRight",data:{itemName:w,itemId:null==a?void 0:a.id,folderId:m||null,eventSource:n}},r),(e||o)&&(null==E||E(!1),null==v||v.resetFields()),I&&I(Jt),await N({folderId:m||"",noFolder:t,sortBy:u,sortOrder:d,page:i.current,limit:i.pageSize}),a}catch(e){if(console.error("Error when loading a file by URL:",e),!r){const t=Jo(e),r=t,i=e,o=Number(null==r?void 0:r.fileSize),a=Number(null==r?void 0:r.maxSize),s=Number.isFinite(o)&&Number.isFinite(a)?{fileSize:o,maxSize:a}:void 0,c="binaryUpload"===(null==i?void 0:i.uploadUrlStage)?ea(t,f,s):na(t,f);p.error({id:"FILES_UPLOAD_BY_URL_FAILED",message:c,placement:"bottomRight",data:{url:null!=l?l:null,folderId:m||null,error:t,eventSource:n},innerException:e})}throw e}finally{null==k||k(!1)}},[v,k,P,p,f,E,I,N,m,u,d,R,D,H,null==s?void 0:s.config]),X=c(async e=>{if(!e.length)return;const t=C.current;"Trash"!==m?(await q(e),await N({folderId:m||"",sortBy:u,sortOrder:d,page:t.current,limit:t.pageSize})):p.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:f("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:m||null,reason:"Upload to Trash is not allowed"}})},[N,m,u,d,q,p,f]);return{fetchFiles:N,handleDeleteFile:B,handleDeleteFolder:U,handleAddFile:G,handleAddFileByUrl:Y,handleDroppedFiles:X,getFileData:V,findFileByUrl:j,resolveFileForEditByUrl:z,uploadFileWithProvider:H}},ms=e=>{let t;const r=new Set,n=(e,n)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:n,getState:i,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(n,i,o);return o},vs=e=>e;const ys=e=>{const t=(e=>e?ms(e):ms)(e),r=e=>function(e,t=vs){const r=i.useSyncExternalStore(e.subscribe,i.useCallback(()=>t(e.getState()),[e,t]),i.useCallback(()=>t(e.getInitialState()),[e,t]));return i.useDebugValue(r),r}(t,e);return Object.assign(r,t),r};function bs(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const ws=(xs=e=>({selectedFiles:new Set,visibleFileIds:[],anchorId:null,multiSelect:!0,setMultiSelect:t=>{e(e=>{var r;if(e.multiSelect===t)return e;if(t)return{multiSelect:!0};const n=null!==(r=Array.from(e.selectedFiles)[0])&&void 0!==r?r:null;return{multiSelect:!1,selectedFiles:n?new Set([n]):new Set,anchorId:n}})},syncVisibleFiles:t=>{const r=Array.isArray(t)?t.map(e=>e.id):[];e(e=>{const t=new Set(r),n=new Set(Array.from(e.selectedFiles).filter(e=>t.has(e))),i=e.anchorId&&t.has(e.anchorId)?e.anchorId:null,o=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r])return!1;return!0}(e.visibleFileIds,r),a=bs(e.selectedFiles,n),s=e.anchorId===i;return o&&a&&s?e:{visibleFileIds:r,selectedFiles:n,anchorId:i}})},setSelectedFiles:t=>{e(e=>{var r;const n=new Set(e.visibleFileIds),i=new Set(Array.from(t).filter(e=>n.has(e)));return bs(e.selectedFiles,i)?e:{selectedFiles:i,anchorId:null!==(r=Array.from(i)[0])&&void 0!==r?r:null}})},clearSelection:()=>{e(e=>0===e.selectedFiles.size&&null===e.anchorId?e:{selectedFiles:new Set,anchorId:null})},selectAllVisible:()=>{e(e=>{var t;const r=new Set(e.visibleFileIds),n=null!==(t=e.visibleFileIds[0])&&void 0!==t?t:null;return bs(e.selectedFiles,r)&&e.anchorId===n?e:{selectedFiles:r,anchorId:n}})},toggleFileSelection:(t,r)=>{e(e=>{const n=!1!==e.multiSelect,i=Boolean(null==r?void 0:r.shiftKey)&&n,o=Boolean(null==r?void 0:r.metaKey)||Boolean(null==r?void 0:r.ctrlKey)||Boolean(null==r?void 0:r.forceToggle),a=e.visibleFileIds,s=new Set(a);if(a.length>0&&!s.has(t))return e;if(!n){const r=new Set([t]);return bs(e.selectedFiles,r)&&e.anchorId===t?e:{selectedFiles:r,anchorId:t}}if(i&&e.anchorId&&s.has(e.anchorId)){const r=a.indexOf(e.anchorId),n=a.indexOf(t);if(-1===r||-1===n)return e;const[i,s]=r<n?[r,n]:[n,r],l=a.slice(i,s+1),c=o?new Set(e.selectedFiles):new Set;return l.forEach(e=>{c.add(e)}),bs(e.selectedFiles,c)?e:{selectedFiles:c}}if(i&&!e.anchorId){const r=new Set([t]);return bs(e.selectedFiles,r)&&e.anchorId===t?e:{selectedFiles:r,anchorId:t}}if(o){const r=new Set(e.selectedFiles);return r.has(t)?r.delete(t):r.add(t),bs(e.selectedFiles,r)&&e.anchorId===t?e:{selectedFiles:r,anchorId:t}}const l=new Set([t]);return bs(e.selectedFiles,l)&&e.anchorId===t?e:{selectedFiles:l,anchorId:t}})}}),xs?ys(xs):ys);var xs;const Cs=e=>{var t,r,n,i;const{state:o,actions:a,options:s}=Oo(),{t:l}=ri(),u=la(),d=Yo(),{fetchFolders:h}=u.actions,{renameItem:f}=(()=>{const{options:e}=Oo(),{dataProviders:t}=e,{t:r}=ri(),n=c(async({itemId:n,newName:i,isFolder:o})=>{var a,s,l,c,u,d,h,f;try{if(o){if(!(null==t?void 0:t.renameFolder))throw new Error(r("renameFolder is not implemented in dataProviders"));const o=$r(i.trim(),e.config),c=await t.renameFolder(n,o);return{success:!0,renamedItem:{id:c.id,name:null!==(a=c.name)&&void 0!==a?a:o,parentId:null!==(s=c.parentId)&&void 0!==s?s:null,folderId:null!==(l=c.parentId)&&void 0!==l?l:null}}}if(!(null==t?void 0:t.renameFile))throw new Error(r("renameFile is not implemented in dataProviders"));const p=Wr(i,e.config),g=await t.renameFile(n,p);return{success:!0,renamedItem:{id:null!==(c=null==g?void 0:g.id)&&void 0!==c?c:n,name:null!==(u=null==g?void 0:g.name)&&void 0!==u?u:p,folderId:null!==(d=null==g?void 0:g.folderId)&&void 0!==d?d:null,parentId:null!==(f=null!==(h=null==g?void 0:g.parentId)&&void 0!==h?h:null==g?void 0:g.folderId)&&void 0!==f?f:null}}}catch(e){return{success:!1,error:Jo(e)}}},[t,r,e.config]);return{renameItem:n}})(),{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,r;if(!e)return null;const n=e;return null!==(r=null!==(t=n.folderId)&&void 0!==t?t:n.parentId)&&void 0!==r?r:null},A=(e,t)=>{var r;return{itemId:null!==(r=null==e?void 0:e.id)&&void 0!==r?r:t,itemName:null==e?void 0:e.name,folderId:S(e)}},k=c(e=>{var t,r;const n=null==p?void 0:p.find(t=>t.id===e);if((null==n?void 0:n.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:A(n,e)});if(!(null==C?void 0:C.renameFolder))throw new Error(l("renameFolder is not implemented in dataProviders"))}else{if(!(!1!==(null===(r=null==_?void 0:_.features)||void 0===r?void 0:r.enableRenameFile)))return void d.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:l("File rename is disabled by config"),placement:"bottomRight",data:A(n,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),n&&v&&v.setFieldsValue({newFileName:n.name})},[p,w,x,v,null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder,null===(r=null==_?void 0:_.features)||void 0===r?void 0:r.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,r,n,i,o,s,c,u,y,w,x,C;if(!m||!v)return;const S=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 k=(null==S?void 0:S.isFolder)||m.startsWith("folder_");if(k){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:A(S,m)})}else{if(!(!1!==(null===(r=null==_?void 0:_.features)||void 0===r?void 0:r.enableRenameFile)))return void d.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:l("File rename is disabled by config"),placement:"bottomRight",data:A(S,m)})}const I=await f({itemId:m,newName:p.newFileName,isFolder:k});if(!I.success){const e=Zo(null===(n=I.error)||void 0===n?void 0:n.code,l);return void d.error({id:"ITEM_RENAME_FAILED",message:null!==(o=null!=e?e:null===(i=I.error)||void 0===i?void 0:i.message)&&void 0!==o?o:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},A(S,m)),{error:I.error}),innerException:I.error})}const T=I.renamedItem;k?(d.success({id:"FOLDER_RENAME_SUCCESS",message:l(`${l("Folder renamed to")} ${null!==(s=null==T?void 0:T.name)&&void 0!==s?s:p.newFileName}`),placement:"bottomRight",data:{itemId:null!==(c=null==T?void 0:T.id)&&void 0!==c?c:m,itemName:null!==(u=null==T?void 0:T.name)&&void 0!==u?u:p.newFileName,folderId:null!==(w=null!==(y=null==T?void 0:T.parentId)&&void 0!==y?y:null==T?void 0:T.folderId)&&void 0!==w?w:null}}),await h(),(null==T?void 0:T.id)&&T.id!==m&&a.setSelectedFolder&&a.setSelectedFolder(T.id)):d.success({id:"FILE_RENAME_SUCCESS",message:`${l("File renamed to")} ${null!==(x=null==T?void 0:T.name)&&void 0!==x?x:p.newFileName}`,placement:"bottomRight",data:Object.assign(Object.assign({},A(S,m)),{itemName:null!==(C=null==T?void 0:T.name)&&void 0!==C?C:p.newFileName})}),E(),await e({folderId:g||"",page:b.current,limit:b.pageSize})}catch(e){console.error("Error when renaming:",e);const t=Jo(e),r=Zo(null==t?void 0:t.code,l);d.error({id:"ITEM_RENAME_FAILED",message:null!=r?r:e instanceof Error?e.message:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},A(S,m)),{error:t}),innerException:e})}},[m,v,p,a,E,e,g,l,b,null===(n=null==_?void 0:_.features)||void 0===n?void 0:n.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:k,handleRenameCancel:E,handleRenameOk:I}}},_s=e=>{const t=t=>{if(!t)return;const r=e.find(e=>e.id===t);return null==r?void 0:r.name};return{getItemNameById:t,getItemNamesByIds:e=>e.map(t).filter(e=>Boolean(e)),getNamesPreview:e=>e.length>0&&e.length<=5?e.join(", "):null}},Ss=(e,t,r,n,i)=>({itemIds:e,itemNames:i&&i.length?i:void 0,successCount:t,totalCount:r,folderId:null!=n?n:null}),As=(e,t,r,n,i,o)=>({itemIds:e,itemNames:o&&o.length?o:void 0,failCount:t,totalCount:r,folderId:null!=n?n:null,errors:i}),ks=()=>{const e=Yo(),{t:t}=ri(),{state:r,options:n}=Oo(),{folders:i,pathHistory:o}=r,{dataProviders:a}=n,{actions:{fetchFolders:s,fetchChildFolders:l}}=la();return{refreshFolders:c(async({parentIds:r,selectedFolder:n})=>{try{if(await s(),r&&l)for(const e of r)e&&await l(e)}catch(r){console.error("Error when updating the folder tree:",r);const n=t("Folders");e.error({id:"FOLDERS_FETCH_FAILED",message:t("Failed to refresh folder tree"),description:n,placement:"bottomRight",innerException:r,notificationDedupe:!0,data:{folderId:null,folderName:n,reason:r instanceof Error?r.message:String(r)}})}},[e,t,s,l]),refreshFiles:c(async({fetchFiles:r,selectedFolder:n,page:s,limit:l})=>{try{await r({folderId:n||"",page:s,limit:l})}catch(r){console.error("Ошибка при обновлении списка файлов:",r);const c=await os({folderId:n||"",dataProviders:a,folders:Array.isArray(i)?i:[],pathHistory:o,t:t}),u=t("Failed to load files"),d=r instanceof Error?r.message:String(r);e.error({id:"FILES_FETCH_FAILED",message:t("Failed to load files in folder",{folderName:c}),description:d&&d!==u?d:void 0,placement:"bottomRight",innerException:r,notificationDedupe:!0,data:{params:{folderId:n||void 0,page:s,limit:l,folderName:c},folderName:c}})}},[e,t,a,i,o])}},Es=e=>{var t;const{state:r,actions:n,options:i}=Oo(),{t:o}=ri(),a=Yo(),s=ws(e=>e.selectedFiles),l=ws(e=>e.clearSelection),{files:u,selectedFolder:d,moveForm:h,pagination:f,currentMenuFile:p}=r,{setIsMoveModalVisible:g,setPagination:m}=n,{dataProviders:v}=i,{moveItems:y}=(()=>{const{options:e}=Oo(),{dataProviders:t}=e,{t:r}=ri(),n=Yo(),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 r=await t.moveItems("folders"===i?"":i,e.map(e=>e.id)),n=r.detailed;if(n){const e=n.filter(e=>e.success),t=n.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),r=e.error,n=Jo(r);c.push({itemId:t,itemName:o(t),error:n})})}else if(r.success)s+=e.length;else{const t=r.error;if(t){l+=e.length;const r=Jo(t);c.push({error:r})}else l+=e.length}}catch(t){l+=e.length;const r=Jo(t);c.push({error:r})}else l+=e.length,c.push({error:{message:"Move provider is not configured"}});return a&&(s>0&&n.success({id:"FILES_MOVE_SUCCESS",message:r("Files moved"),placement:"bottomRight",data:{successCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===i?null:i}}),l>0&&n.error({id:"FILES_MOVE_ERROR",message:r("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,n,r]);return{moveItems:i}})(),{refreshFolders:b,refreshFiles:w}=ks(),{getItemNameById:x,getItemNamesByIds:C,getNamesPreview:_}=_s(u),S=c(()=>{null==g||g(!0)},[g]),A=c(()=>{null==g||g(!1),null==h||h.resetFields()},[g,h]),k=c(async t=>{var r,n,c,g,S,k,E,I;if(!((null==p?void 0:p.length)||s&&0!==s.size))return;const T=u.length,F=Object.assign({},f),O=Array.from((null==p?void 0:p.length)?[p]:s),P=O.length;let M=0,R=0;const L=[],N=O.map(e=>u.find(t=>t.id===e)).filter(e=>Boolean(e)),j=N.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let s=t;if(!t){const e=await h.validateFields();s=null==e?void 0:e.targetFolder}if(!s)return void a.error({id:"FILES_MOVE_DIRECTORY_NOT_SELECTED",message:o("Select destination folder"),placement:"bottomRight"});const u="folders"===s?null:s,f=null!=u?u:d,p=!0===(null===(r=null==i?void 0:i.config)||void 0===r?void 0:r.dedupeUploadNamesOnClient);if(p&&(null==v?void 0:v.getFolders))try{const e=await v.getFolders({parentId:u,deep:!1}),t=new Set((e||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean));for(const e of N){if(!e.isFolder&&!(null===(c=(n=e.id).startsWith)||void 0===c?void 0:c.call(n,"folder_")))continue;const r=e.name||x(e.id)||"";if(r&&t.has(r.toLowerCase()))return void a.error({id:"FOLDER_ALREADY_EXISTS_MOVE",message:o("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:r,targetFolderId:s}})}}catch(e){console.warn("Could not check folder duplicates for move:",e)}if(p&&(null==v?void 0:v.getFiles)&&(null==v?void 0:v.renameFile))try{let e=[];if(null==v?void 0:v.getFiles){const{files:t}=await v.getFiles({folderId:null!=u?u:void 0,itemType:"all",page:1,limit:1e4});e=(t||[]).map(e=>e.name).filter(e=>!!e)}if(null==v?void 0:v.getFolders){const t=(await v.getFolders({parentId:u,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);e=[...e,...t]}const t=new Set(e.map(e=>null==e?void 0:e.toLowerCase()).filter(Boolean));for(const e of N){if(e.isFolder||(null===(S=(g=e.id).startsWith)||void 0===S?void 0:S.call(g,"folder_")))continue;const r=e.name||x(e.id)||"";if(!r||!t.has(r.toLowerCase())){t.add(r.toLowerCase());continue}const n=Ei(r,Array.from(t));await v.renameFile(e.id,n),t.add(n.toLowerCase())}}catch(e){console.warn("Could not check duplicates for move:",e)}const D=await y({items:N,targetFolderId:s,getItemNameById:x,showNotifications:!1});if(M=D.successCount,R=D.failCount,L.push(...D.errorDetails),M>0){const e=C(O),t=_(e),r=t?o("Moved",{names:t}):o("move_success_summary",{successCount:M,totalCount:P});a.success({id:"FILES_MOVE_SUCCESS",message:r,placement:"bottomRight",data:Ss(O,M,P,u,e)})}if(R>0){const e=C(O),t=_(e);let r;if(1===P&&L.length>0&&(null===(k=L[0].error)||void 0===k?void 0:k.code)){const e=Zo(null===(E=L[0].error)||void 0===E?void 0:E.code,o);r=null!=e?e:t?o("Failed",{names:t}):o("move_fail_summary",{failCount:R,totalCount:P})}else r=t?o("Failed",{names:t}):o("move_fail_summary",{failCount:R,totalCount:P});a.error({id:"FILES_MOVE_ERROR",message:r,placement:"bottomRight",innerException:L.length?L:void 0,data:As(O,R,P,u,L.length?L:void 0,e)})}A(),l();let z=F.current;if(M>0&&T>0&&M>=T&&F.current>1&&(z=F.current-1),M>0&&F.total>=M){const e=Math.max(0,(null!==(I=F.total)&&void 0!==I?I:0)-M);null==m||m({current:z,pageSize:F.pageSize,total:e})}j&&await b({parentIds:void 0,selectedFolder:f}),await w({fetchFiles:e,selectedFolder:d,page:z,limit:F.pageSize})}catch(e){console.error("Error when moving:",e);const t=Zo(Jo(e).code,o);a.error({id:"FILES_MOVE_ERROR",innerException:e,message:null!=t?t:o("Error moving"),placement:"bottomRight",data:As(O,P,P,d||null,[{error:Jo(e)}],C(O))})}},[p,s,h,e,d,f,u,a,m,o,y,l,g,null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient,null==v?void 0:v.getFiles,null==v?void 0:v.renameFile,x]);return{actions:{showMoveModal:S,handleMoveCancel:A,handleMoveOk:k}}},Is=e=>{var t;const{state:r,actions:n,options:i}=Oo(),{t:o}=ri(),a=Yo(),s=ws(e=>e.selectedFiles),l=ws(e=>e.clearSelection),{files:u,selectedFolder:d,copyForm:h,pagination:f,currentMenuFile:p}=r,{setIsCopyModalVisible:g}=n,{dataProviders:m}=i,{copyItems:v}=(()=>{const{options:e}=Oo(),{dataProviders:t}=e,{t:r}=ri(),n=Yo(),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 r=await t.copyItems(u,e.map(e=>({id:e.id,newName:e.newName}))),n=r.detailed;if(n){const e=n.filter(e=>e.success),t=n.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),r=e.error,n=Jo(r);c.push({itemId:t,itemName:o(t),error:n})})}else if(r.success)s+=e.length;else{const t=r.error;if(t){l+=e.length;const r=Jo(t);c.push({error:r})}else l+=e.length}}catch(t){l+=e.length;const r=Jo(t);c.push({error:r})}else if(null==t?void 0:t.copyItem)for(const r of e)try{const e=(null==r?void 0:r.isFolder)||r.id.startsWith("folder_");await t.copyItem({itemId:r.id,targetFolderId:u,isFolder:e,newName:r.newName})?s++:l++}catch(e){l++;const t=Jo(e);c.push({itemId:r.id,itemName:o(r.id),error:t})}else l+=e.length,c.push({error:{message:"Copy provider is not configured"}});return a&&(s>0&&n.success({id:"FILES_COPY_SUCCESS",message:r("Files copied"),placement:"bottomRight",data:{successCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===i?null:i}}),l>0&&n.error({id:"FILES_COPY_ERROR",message:r("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,n,r]);return{copyItems:i}})(),{refreshFolders:y,refreshFiles:b}=ks(),{getItemNameById:w,getItemNamesByIds:x,getNamesPreview:C}=_s(u),_=c(()=>{null==g||g(!0)},[g]),S=c(()=>{null==g||g(!1),null==h||h.resetFields()},[g,h]),A=c(async t=>{var r,n,c,g,_;if(!((null==p?void 0:p.length)||s&&0!==s.size))return;const A=Array.from((null==p?void 0:p.length)?[p]:s),k=A.length;let E=0,I=0;const T=[],F=A.map(e=>u.find(t=>t.id===e)).filter(e=>Boolean(e)),O=F.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let s=t;if(!t){const e=await h.validateFields();s=null==e?void 0:e.targetFolder}if(!s)return void a.error({id:"FILES_COPY_DIRECTORY_NOT_SELECTED",message:o("Select destination folder"),placement:"bottomRight"});const u="folders"===s?null:s,p=null!=u?u:d;let P=F.map(e=>({id:e.id,isFolder:(null==e?void 0:e.isFolder)||e.id.startsWith("folder_")}));const M=!0===(null===(r=null==i?void 0:i.config)||void 0===r?void 0:r.dedupeUploadNamesOnClient);if(M&&(null==m?void 0:m.getFolders))try{const e=await m.getFolders({parentId:u,deep:!1}),t=new Set((e||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean));for(const e of F){if(!e.isFolder&&!(null===(c=(n=e.id).startsWith)||void 0===c?void 0:c.call(n,"folder_")))continue;const r=e.name||w(e.id)||"";if(r&&t.has(r.toLowerCase()))return void a.error({id:"FOLDER_ALREADY_EXISTS_COPY",message:o("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:r,targetFolderId:s}})}}catch(e){console.warn("Could not check folder duplicates for copy:",e)}if(M&&(null==m?void 0:m.getFiles))try{let e=[];const{files:t}=await m.getFiles({folderId:null!=u?u:void 0,itemType:"all",page:1,limit:1e4});if(e=(t||[]).map(e=>e.name).filter(e=>!!e),null==m?void 0:m.getFolders){const t=(await m.getFolders({parentId:u,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);e=[...e,...t]}const r=[...e];P=F.map(e=>{var t,n;if(e.isFolder||(null===(n=(t=e.id).startsWith)||void 0===n?void 0:n.call(t,"folder_")))return{id:e.id,isFolder:!0};const i=F.find(t=>t.id===e.id),o=(null==i?void 0:i.name)||w(e.id)||"",a=Ei(o,r);return r.push(a),{id:e.id,isFolder:!1,newName:a!==o?a:void 0}})}catch(e){console.warn("Could not check duplicates for copy:",e)}else P=F.map(e=>({id:e.id,isFolder:(null==e?void 0:e.isFolder)||e.id.startsWith("folder_")}));const R=await v({items:P,targetFolderId:s,getItemNameById:w,showNotifications:!1});if(E=R.successCount,I=R.failCount,T.push(...R.errorDetails),E>0){const e=x(A),t=C(e),r=t?o("Copied",{names:t}):o("copy_success_summary",{successCount:E,totalCount:k});a.success({id:"FILES_COPY_SUCCESS",message:r,placement:"bottomRight",data:Ss(A,E,k,u,e)})}if(I>0){const e=x(A),t=C(e);let r;if(1===k&&T.length>0&&(null===(g=T[0].error)||void 0===g?void 0:g.code)){const e=Zo(null===(_=T[0].error)||void 0===_?void 0:_.code,o);r=null!=e?e:t?o("Failed",{names:t}):o("copy_fail_summary",{failCount:I,totalCount:k})}else r=t?o("Failed",{names:t}):o("copy_fail_summary",{failCount:I,totalCount:k});a.error({id:"FILES_COPY_ERROR",message:r,placement:"bottomRight",innerException:T.length?T:void 0,data:As(A,I,k,u,T.length?T:void 0,e)})}S(),l(),O&&await y({parentIds:void 0,selectedFolder:p}),await b({fetchFiles:e,selectedFolder:d,page:f.current,limit:f.pageSize})}catch(e){console.error("Error when copying:",e);const t=Zo(Jo(e).code,o);a.error({id:"FILES_COPY_ERROR",message:null!=t?t:o("Error copying"),innerException:e,placement:"bottomRight",data:As(A,k,k,d||null,[{error:Jo(e)}],x(A))})}},[p,s,h,e,d,f,u,a,o,v,l,g,null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient,null==m?void 0:m.getFiles,w]);return{actions:{showCopyModal:_,handleCopyCancel:S,handleCopyOk:A}}},Ts=e=>{const t=Cs(e),r=Es(e),n=Is(e),i=(e=>{const{state:t,actions:r,options:n}=Oo(),{t:i}=ri(),o=Yo(),a=ws(e=>e.selectedFiles),s=ws(e=>e.clearSelection),{files:l,selectedFolder:u,pagination:d,currentMenuFile:h}=t,{setIsDeleteConfirmVisible:f,setUndoDeletion:p,setPagination:g}=r,{config:m}=n,{deleteItems:v}=ca(),{refreshFolders:y,refreshFiles:b}=ks(),{getItemNameById:w,getItemNamesByIds:x,getNamesPreview:C}=_s(l),_=c(()=>{null==f||f(!0)},[f]),S=c(()=>{null==f||f(!1)},[f]),A=c(async()=>{var t,r,n;if(!((null==h?void 0:h.length)||a&&0!==a.size))return void(null==f||f(!1));const c=l.length,_=Object.assign({},d),S=Array.from(h?[h]:a),A=S.map(e=>l.find(t=>t.id===e)).filter(e=>Boolean(e)),k=new Set;A.forEach(e=>{(null==e?void 0:e.isFolder)&&k.add((e=>{var t,r;if(!e)return null;const n=e;return null!==(r=null!==(t=n.folderId)&&void 0!==t?t:n.parentId)&&void 0!==r?r:null})(e))});let E=0,I=0;const T=[];try{const a=await v({items:A,selectedFolder:u,getItemNameById:w,showNotifications:!1});E=a.successCount,I=a.failCount,T.push(...a.errorDetails);const l=(null==m?void 0:m.enableTrashFolder)&&"Trash"===u;if(E>0&&(null==m?void 0:m.enableTrashFolder)&&!l&&(null==p||p({itemIds:S,sourceFolderId:u||"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:u||null}}):await o.success({id:"FILES_DELETE_SUCCESS",message:i("Files deleted"),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:S,folderId:u||null}})}if(I>0){const e=x(S),n=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?Zo(null===(r=T[0].error)||void 0===r?void 0:r.code,i):void 0,h=null!=d?d:n?i("Failed",{names:n}):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}})}s(),null==f||f(!1),await y({parentIds:Array.from(k),selectedFolder:u});let d=_.current;if(E>0&&c>0&&E>=c&&_.current>1&&(d=_.current-1),E>0&&_.total>=E){const e=Math.max(0,(null!==(n=_.total)&&void 0!==n?n:0)-E);null==g||g({current:d,pageSize:_.pageSize,total:e})}await b({fetchFiles:e,selectedFolder:u,page:d,limit:_.pageSize})}catch(e){console.error("Error when deleting:",e),o.error({id:"FILES_DELETE_ERROR",message:i("Error deleting"),placement:"bottomRight",innerException:e,data:{failCount:I,totalCount:A.length}})}},[h,a,f,e,u,d,p,g,l,i,o,v,s,null==m?void 0:m.enableTrashFolder]);return{actions:{showDeleteConfirm:_,handleDeleteConfirmCancel:S,handleDeleteConfirmOk:A}}})(e);return{state:t.state,actions:Object.assign(Object.assign(Object.assign(Object.assign({},t.actions),r.actions),n.actions),i.actions)}},Fs=()=>{const{state:e}=Oo(),{files:t,loading:r,isUrlModalVisible:n}=e,i=gs(),o=(()=>{const{state:e}=Oo(),t=e.multiSelect,r=ws(e=>e.selectedFiles),n=ws(e=>e.toggleFileSelection),i=ws(e=>e.setMultiSelect);return a(()=>{i(!1!==t)},[t,i]),{state:{selectedFiles:r},actions:{toggleFileSelection:n}}})(),s=Ts(i.fetchFiles);return{state:{files:t||[],selectedFiles:o.state.selectedFiles,loading:r||!1,isAddingFileByUrl:n||!1,isRenamingFile:s.state.isRenamingFile,fileToRename:s.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:s.actions.showRenameModal,handleRenameCancel:s.actions.handleRenameCancel,handleRenameOk:s.actions.handleRenameOk,showMoveModal:s.actions.showMoveModal,handleMoveCancel:s.actions.handleMoveCancel,handleMoveOk:s.actions.handleMoveOk,showCopyModal:s.actions.showCopyModal,handleCopyCancel:s.actions.handleCopyCancel,handleCopyOk:s.actions.handleCopyOk,showDeleteConfirm:s.actions.showDeleteConfirm,handleDeleteConfirmCancel:s.actions.handleDeleteConfirmCancel,handleDeleteConfirmOk:s.actions.handleDeleteConfirmOk}}};function Os({maxConcurrent:e=6}={}){const t=u(new Map),r=u([]),n=u(0),i=d(()=>{const i=e=>({status:e.status,shouldLoad:"loading"===e.status||"loaded"===e.status||"error"===e.status}),o=e=>{const t=i(e);e.listeners.forEach(e=>e(t))},a=e=>{0!==r.current.length&&(r.current=r.current.filter(t=>t!==e))},s=(e,r)=>{const n=t.current.get(e);if(!n){const n={id:e,src:r,status:"idle",listeners:new Set,active:!1};return t.current.set(e,n),n}return n.src!==r&&(a(e),n.src=r,n.status="idle"),n},l=()=>{for(;n.current<e&&r.current.length>0;){const e=r.current.shift();if(!e)break;const i=t.current.get(e);i&&i.active&&"queued"===i.status&&(i.status="loading",n.current+=1,o(i))}},c=(e,t)=>{"loading"===e.status&&(e.status=t,n.current=Math.max(0,n.current-1),o(e),l())};return{getSnapshot:(e,t)=>i(s(e,t)),subscribe:(e,r,n)=>{const o=s(e,r);return o.listeners.add(n),n(i(o)),()=>{const r=t.current.get(e);r&&(r.listeners.delete(n),r.active||0!==r.listeners.size||"loading"===r.status||t.current.delete(e))}},setActive:(e,t,i)=>{const c=s(e,t);c.active=i,i?"loaded"!==c.status&&"loading"!==c.status&&"queued"!==c.status?(c.status="queued",o(c),r.current.includes(e)||r.current.push(e),l()):o(c):"queued"===c.status?(a(e),c.status="idle",o(c)):"loading"===c.status&&(n.current=Math.max(0,n.current-1),c.status="idle",o(c),l())},markLoaded:e=>{const r=t.current.get(e);r&&c(r,"loaded")},markError:e=>{const r=t.current.get(e);r&&c(r,"error")},release:e=>{const r=t.current.get(e);r&&(r.active=!1,"queued"===r.status?(a(e),r.status="idle"):"loading"===r.status&&(n.current=Math.max(0,n.current-1),r.status="idle",l()),0===r.listeners.size&&t.current.delete(e))}}},[e]);return a(()=>()=>{r.current=[],t.current.clear(),n.current=0},[]),i}function Ps(e){var t;if(e&&"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQABLAEsAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAAEsAAAAAQAAASwAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAQOgAwAEAAAAAQAAAMoAAAAA/+EJ2Wh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8APD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6c3RvY2s6Mzk2MmU4NTQtNjA1NC00MGZmLWEwYzMtYjJkNjcwMzQ2OWFhIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmE5M2NiZTgyLWI5NjEtNGUzNS1iYmQ0LWJjZWE1Zjc1YTQwZiIvPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/eHBhY2tldCBlbmQ9InciPz4A/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAMoBAwMBIgACEQADEQD/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/3QAEABH/2gAMAwEAAhEDEQA/APsuiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoqG7uIbWB55nCooyTS208VxCssLh0boRQBLRRRQAUUUUAFFFFAH/9D7LooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAqG7uIrWBppnCoo5Jou7iK1gaaZwqKM5NcRq2oXOsXqxQq2wnEcYPX3NABq2oXOr3qwxK3l5xHGO/ua6nw7pzadZ7ZJGaR+WBPA9hUfh7R49Pi82TDXDDkkfd9hWxQAUUUUAFFFFABRRRQB//9H7LooooAKKKKACiiuOv/EOpQX88KNDsSQqMp6H60AdjRXD/wDCTapn70P/AH7/APr0f8JPqn96H/v3/wDXoA7iiuH/AOEn1T+9D/37/wDr0f8ACT6p/eh/79//AF6AO4orh/8AhJ9U/vQ/9+//AK9H/CT6p/eh/wC/f/16AO4orh/+En1T+9D/AN+//r0f8JPqn96H/v3/APXoA7iiuH/4SfVP70P/AH7/APr0f8JPqn96H/v3/wDXoA7iiuH/AOEn1T+9D/37/wDr0f8ACT6p/eh/79//AF6AO4orh/8AhJ9U/vQ/9+//AK9H/CT6p/eh/wC/f/16AO4orh/+En1T+9D/AN+//r0f8JPqn96H/v3/APXoA7iobq4itYHmncIijJJrE0jUdQlt2v8AUJIYrNVyMJgv9Oaw9X1C51e8WGJWMecRxr39zQAatqNzq94kUasELYjjB6/Wul8P6NHp8Qlkw1ww5P8Ad9hWRmDw9bfwTajIv4Riqw8Tap6wf98f/XoA7elrh/8AhJtU/vQ/9+//AK9avhnWL3UL94bgx7BGWG1cdwPX3oA6OiiigAooooAKKKKAP//S+y6KKKACiiigArgHAbxSVYAg3mCD3+eu/rgT/wAjV/2+f+z0Adt9jtMf8esH/fsUfY7T/n1g/wC/Yqeh2CIWY4AGSaAK7WlmqktbQADkkxr/AIVUe50JJPLZ7EN6YWuX17WJr+dkRylurYVQfve5rKJoA9Ghh0+Zd0MVtIvqqKaf9jtP+fWD/v2K89sry4sphLbyFD3HY/Wu+0e9TULFLhQATww9DQBJ9jtP+fWD/v2KattZM7ILe3LL94bF4p99cx2lpJcS/dRc/X2rjdG1eSLWmuZ2Oy4bEnoPQ/hQB2P2O0/59YP+/Yo+x2n/AD6wf9+xU4IPSloAr/Y7T/n1g/79ij7Haf8APrB/37FWKKAK/wBjtP8An1g/79ij7Haf8+sH/fsVYooAr/Y7T/n1g/79ioruPTrWBppoLdUUckxj/Cp7u4itYGnmcKijJJriNX1C61i9EUKtsziOMHr7mgBNVv7jVrxYII/3YOIYl/ma6bw9o8enxCSTD3DDkn+H2FHh/R49Pi8yTDXDDkkfd9hWxQBC9rbOxZ7eJmPUlATTfsdp/wA+sH/fsVYooAztXtbVdLumW3hBELkEIOPlNc74H/5Csv8A1xP8xXUaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5igDs6KKKACiiigAooooA//0/suiiigAooooAK4E/8AI1f9vn/s9d9XAn/kav8At8/9noA72s/xI7R6HdMpwdmPzODWhUN/ALqymt26SIVoA816UlS3ML207wSrtdCQai+lAC11HgN2xdx4+XKH6Hn/AArl++K6jSv+JN4flvJhiWfBRe/Tj+ZNAEHjLUfOnFjEw2R/NJju3Yfl/Oudp0jtJIzucsxJJ96bQB2/hLUftdkLeRh50OF+q9jW3XnOkXrWF/HcDJUHDjPUV6HDIssSSIQVYAg0APooooAKhu7iK1gaeZwqKM5NF3cQ2sDTTOFRRk5riNW1C51i9WKJW8vOI4x39zQAavqF1rF6IYVbZnEcYPX3NdL4e0ePT4hLIA1w45JH3fYUeHtHj0+LzJcNcMOTj7vsK2KACiiigAooooAqaz/yCbz/AK4v/wCgmuX8D/8AIWl/64n+YrqNZ/5BN5/1xf8A9BNcv4H/AOQtL/1xP8xQB2dFFFABRRRQAUUUUAf/1PsuiiigAooooAK4E/8AI1f9vn/s9d9XAn/kav8At8/9noA72lpKWgDO1bSLXUQDKCsg6OvX/wCvWFJ4Tn3fJdxFc8FkOa66igDC0zw3a2riadzPIOeRhR+FYXinUPtl+Yoz+5h+VcdCe5/p+FdH4n1H7DYFYziaX5U9vU1wn40AFFFFABXW+DNR3xtp8x+ZPmjyeo7j/PrXJVNZzva3UdxG2HjbP/1qAPTKhu7iK2gaaZwqKOSahTULf+zFv3bZEybsmuP1XULnV70QxK3l7sRxr39zQAmrahc6xerFEreXnEcY7+5rpfD2jx6fF5suGuGHJx932FHh7R49PiEkuGuGHJ/u+wrYoAKKKKACiiigAooooAqaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5iuo1n/AJBN5/1xf/0E1y/gf/kLS/8AXE/zFAHZ0UUUAFFFFABRRRQB/9X7LooooAKKKKACuBP/ACNX/b5/7PXfVwJ/5Gr/ALfP/Z6AO9paSloAKazBVZicBRkmnVz3jHUfs9qLOJsSy/ex2XvQBzuu351DUXlDfu1+WMewqhRRQAUUUv40AFbGi6ZG8TahqB8uzTkA9ZP/AK1Gi6ZG8TajqJ2WcfIB/wCWn/1qi1W+uNWu0hhQiIHbFEv86ADU7+fVbpIIU2xZ2xRL/M103h7R00+LzZcPcMOTj7vsKyCYfD9sQNsupSr+EY/z+ddDot8uoWCTj7/Rx6N3oAvUUUUAFZ17rFta6jDZydZPvNnhPTNSaxqEWn2bTv8AM3RF9TXntxLJPK8sp3O5yx9TQB6dmlrA8Kar9qg+yzt+/jHBP8QrfoAKKKKAKms/8gm8/wCuL/8AoJrl/A//ACFpf+uJ/mK6jWf+QTef9cX/APQTXL+B/wDkLS/9cT/MUAdnRRRQAUUUUAFFFFAH/9b7LooooAKKKKACuBP/ACNX/b5/7PXfVwJ/5Gr/ALfP/Z6AO9paSloAjuZo7eB5pThEGSa851G6e9vJLl+rngeg7Ct/xpqOWXT4m6fNLj9B/X8q5mgBKKKO9AADzWzoumRvEdQ1A7LOPkA/8tP/AK1JoulxvE2oagQlnHyAf+Wn/wBaotVv59WukhhjIizthiX+dABql/catdJBDGRHnbDEv86vkweH7bHyy6jKv4Rj/P8An0UmDw/bEfLLqMq/hGP8/n/Ln5JHlkaSRi7scsx70AEkjySNLIxd2OWY961fCuo/Y78RSNiGY7T7Hsax6WgD1EGmyuscbSOwVVBJPoKy/DGofbrABzmaLCvk9fQ1k+MNU3MdPgY4X/WkevpQBla7qLajel84iTiMe3rWdS0lAEtrPJbXMdxC2HQ5HvXoWlXsd/ZpPGevDD0PevOK0/D2pHTr0FiTBJgOP60Ad/RTUYOoZSCCMg06gCprP/IJvP8Ari//AKCa5fwP/wAhaX/rif5iuo1n/kE3n/XF/wD0E1y/gf8A5C0v/XE/zFAHZ0UUUAFFFFABRRRQB//X+y6KKKACiiigArgT/wAjV/2+f+z131cCf+Rq/wC3z/2egDvarapeJY2Mlw/8I+UZ6nsKs1xni7UftN39ljb91Eecd2/z/WgDFnlknmeaRsu5JJqOigdeKAFrX0XS43iOoagQlnHyAf8Alp/9al0XTI3ibUNQISzj5Ab/AJaf/WqHVb+41a6SGGMrEDtiiX+dAC6rfT6tdJBChEWdsMS/zq+TB4ftj92XUZV/CMf5/P8AkhMPh+2x8suoyr+EY/z+f8sCSR5ZGlkYu7HLMe9ABJI8sjSSMXdjlmPemUUUAFLSUUAWtOvp7CZ5YD8zIVOenNVmJZixJJPUmkooAKKKKAClFJRQB1Pg/VOBp87Dj/VEn9K6jPFeYRs0bh0JDqQQR2Nd7oGpJqNkGJxKnEg/rQBY1n/kE3n/AFxf/wBBNcv4H/5C0v8A1xP8xXUaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5igDs6KKKACiiigAooooA//0PsuiiigAooooAK4E/8AI1f9vn/s9d8a89u5RB4hlnYEiO5LkDvhs0Adtq808Ni7W0TyTEbUCjkE964c6TqhJJspyTySVroB4stsY+xzf99Cj/hK7X/nzl/76FAHPnSdTx/x4z/981d0zRvL33eqr5NtFztbq5/wro7PVo5rF72SB7eBfutIcbvpXLatqFzq94IokYpnEca859zQAmq31xq12sEEZEQOIol/nWxBYzaPZeZBavc30oxlVyIxUVsbLw6i+epuL1wCyp/AP6VY/wCEstv+fSb/AL6FAGBLpmrSyNJJZ3DuxyzFetN/sjU/+fGf/vmug/4Su1/585f++hR/wldr/wA+cv8A30KAOf8A7I1P/nxn/wC+aP7I1P8A58Z/++a6D/hK7X/nzl/76FH/AAldr/z5y/8AfQoA5/8AsjU/+fGf/vmj+yNT/wCfGf8A75roP+Ertf8Anzl/76FH/CV2v/PnL/30KAOf/sjU/wDnxn/75o/sjU/+fGf/AL5roP8AhK7X/nzl/wC+hR/wldr/AM+cv/fQoA5/+yNT/wCfGf8A75o/sjU/+fGf/vmug/4Su1/585f++hR/wldr/wA+cv8A30KAOf8A7I1P/nxn/wC+aP7I1P8A58Z/++a6D/hK7X/nzl/76FH/AAldr/z5y/8AfQoA5/8AsjU/+fGf/vmrmkW+r6ferOllPtzh12n5hWp/wldr/wA+cv8A30KP+Ertf+fOX/voUAa+rNu0a6bBGYGOD1HymuZ8D/8AIWl/64n+YqzfeJre4spoBayqZI2UEkcZGKreB/8AkKyn/pif5igDs6KKKACiiigAooooA//R+y6KKKACiiigArHn8OadPO80nm73YscNjknNbFFAGJ/wjGmf9N/+/lRXGg6NZxG4nMnlpyQ0mQfatq7uIrWBppnCoozk1xGrajdaxeLFCh2E4jjHf3NACapfT6tdpBDGfKU4hjUfrXTeH9HTT4vNkw1yw5JH3fYUeHtHj0+LzZMNcMOSR932FbFAGNL4b0+WRpJXuHdjks0nJNN/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTPSf/v5VrTNGs9PnM1v5m4qVO5s8ZB/pWjRQAUUUUAFFFFABRRRQB//0vsuiiigAooooAKhu7mK1t2nmYKijkmpq5fxda6jNcReXukgYgBVHQ+9AGVq2oXOsXqxRK2zdiNB39zXS+H9Hj0+ISSYa4Ycn+77Cjw/o8enxebLhrhhySPu+wrYoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/9P7LooooAKKKKACkxS0UAFFFFABRRTW6D6igB1FN7n8KQE+YRQA+iiigAopsnEZI64pR90UALRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAH//2Q=="!==e){if(e.startsWith("data:image/")){const t=e.split(",")[1];return t&&t.length>20?e:void 0}return e.startsWith("blob:")?e:e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?null!==(t=(e=>{if(e&&"string"==typeof e){if(e.startsWith("data:")||e.startsWith("blob:"))return e;try{if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")){const t=new URL(e.startsWith("/")?`https://x${e}`:e),r=e.startsWith("/")?"":`${t.protocol}//${t.host}`,n=t.pathname.split("/").map(e=>{if(!e)return"";try{return encodeURIComponent(decodeURIComponent(e))}catch(t){return encodeURIComponent(e)}}).join("/");return e.startsWith("/")?n+(t.search||"")+(t.hash||""):`${r}${n}${t.search}${t.hash}`}}catch(e){}return e}})(e))&&void 0!==t?t:e:void 0}}function Ms(e,t){var r;if(!e)return null;const n=Ps(null!==(r=e.src)&&void 0!==r?r:void 0);return e.exhausted?Object.assign(Object.assign({},e),{src:null}):n?Object.assign(Object.assign({},e),{src:n}):Object.assign(Object.assign({},e),{src:null!=t?t:null,changed:!1,reason:"unchanged"})}function Rs(e){var t;const{options:r}=Oo(),n=null===(t=r.config)||void 0===t?void 0:t.getProxiedUrl,i=u([]),s=u(!1),l=u(0),h=u(null),[f,p]=o(!1),g=d(()=>{const t=e.map(e=>Ps(e)).filter((e,t,r)=>Boolean(e)&&r.indexOf(e)===t);return function(e,t){return e===t||e.length===t.length&&e.every((e,r)=>e===t[r])}(i.current,t)?i.current:(i.current=t,t)},[e]),[m,v]=o([]),[y,b]=o(0);a(()=>{let e=!1;if(b(0),s.current=!1,l.current=0,h.current=null,p(!1),0!==g.length)return(async()=>{const t=await Promise.all(g.map(async e=>{if(!n||!(t=e).startsWith("http://")&&!t.startsWith("https://"))return[{originalSrc:e,src:e}];var t;try{const t=await Promise.resolve(n(e)),r=Ps(null==t?void 0:t.src);return r?[{originalSrc:e,src:r,stabilityKey:t.stabilityKey,handleChangeSrc:t.handleChangeSrc,handleSuccess:t.handleSuccess,handleError:t.handleError,subscribeToSrcChange:t.subscribeToSrcChange}]:[{originalSrc:e,src:e}]}catch(t){return[{originalSrc:e,src:e}]}}));if(!e){const e=function(e){const t=new Set;return e.filter(e=>!(!e.src||t.has(e.src)||(t.add(e.src),0)))}(t.flat());v(t=>function(e,t){return e===t||e.length===t.length&&e.every((e,r)=>{const n=t[r];return e.originalSrc===n.originalSrc&&e.src===n.src&&e.stabilityKey===n.stabilityKey})}(t,e)?t:e)}})(),()=>{e=!0};v(e=>0===e.length?e:[])},[n,g]);const w=m[y];a(()=>{if(!(null==w?void 0:w.subscribeToSrcChange))return;let e,t=!1;return Promise.resolve(w.subscribeToSrcChange(e=>{if(t||s.current)return;const r=Ms(e,w.src);(null==r?void 0:r.changed)&&r.src&&!t&&v(e=>e.map((e,t)=>t===y?Object.assign(Object.assign({},e),{src:r.src}):e))})).then(r=>{t?null==r||r():e=r}),()=>{t=!0,null==e||e()}},[w,y]),a(()=>{var e;if(!(null==w?void 0:w.handleChangeSrc))return;if(s.current)return;const t=`${w.originalSrc}::${null!==(e=w.stabilityKey)&&void 0!==e?e:""}::${y}`;if(h.current===t)return;h.current=t;let r=!1;return Promise.resolve(w.handleChangeSrc()).then(e=>{const t=Ms(e,w.src);(null==t?void 0:t.changed)&&t.src&&!r&&v(e=>e.map((e,r)=>r===y?Object.assign(Object.assign({},e),{src:t.src}):e))}),()=>{r=!0}},[w,y]);const x=c(async()=>{var e;if(!(null==w?void 0:w.handleChangeSrc))return{src:null!==(e=null==w?void 0:w.src)&&void 0!==e?e:null,changed:!1,exhausted:!1,reason:"unchanged"};if(s.current)return{src:null,changed:!1,exhausted:!0,reason:"exhausted"};const t=Ms(await Promise.resolve(w.handleChangeSrc()),w.src);return(null==t?void 0:t.changed)&&t.src&&t.src!==w.src?(v(e=>e.map((e,r)=>r===y?Object.assign(Object.assign({},e),{src:t.src}):e)),t):null!=t?t:{src:w.src,changed:!1,exhausted:!1,reason:"unchanged"}},[w,y]),C=c(async()=>{var e,t;if(s.current)return{src:null,changed:!1,exhausted:!0,reason:"exhausted"};if(!w)return s.current=!0,p(!0),{src:null,changed:!1,exhausted:!0,reason:"exhausted"};const r=(n=m.length,Math.max(8,6*n));var n;if(l.current>=r)return s.current=!0,p(!0),{src:null,changed:!1,exhausted:!0,reason:"exhausted"};l.current+=1;const i=w.handleError?Ms(await Promise.resolve(w.handleError()),w.src):null;return(null==i?void 0:i.exhausted)?(s.current=!0,p(!0),i):(null==i?void 0:i.changed)&&i.src&&i.src!==w.src?(v(e=>e.map((e,t)=>t===y?Object.assign(Object.assign({},e),{src:i.src}):e)),i):y+1>=m.length?(s.current=!0,p(!0),null!=i?i:{src:null,changed:!1,exhausted:!0,reason:"exhausted"}):(b(e=>e+1),{src:null!==(t=null===(e=m[y+1])||void 0===e?void 0:e.src)&&void 0!==t?t:null,changed:!0,exhausted:!1,reason:"candidate-fallback"})},[w,y,m]),_=c(()=>{var e;s.current||w&&(l.current=0,null===(e=w.handleSuccess)||void 0===e||e.call(w))},[w]);return{src:f||null==w?void 0:w.src,hasNextCandidate:y+1<m.length,handleError:C,handleLoad:_,handleChangeSrc:x}}const Ls=/(auto|scroll|overlay)/;function Ns(e,t){const r=Math.max(0,null!=t?t:e.clientWidth);return Math.max(1,Math.round(r-function(e){if("undefined"==typeof window)return 0;const t=window.getComputedStyle(e);return(Number.parseFloat(t.paddingLeft||"0")||0)+(Number.parseFloat(t.paddingRight||"0")||0)}(e)))}function js(e){if("undefined"==typeof window)return!1;const t=window.getComputedStyle(e);return Ls.test(t.overflowY)||Ls.test(t.overflow)||Ls.test(t.overflowX)}function Ds(e){if("undefined"==typeof window)return e;let t=e;for(;t;){if(js(t))return t;t=t.parentElement}return null}function zs(e){if("undefined"==typeof window)return[e];const t=Ds(e);return t?t===e?[window,e]:[window,t]:[window]}function Bs(e,t,r){Math.max(0,e.clientHeight),Math.max(0,Math.round(e.getBoundingClientRect().height));return Math.max(1,t)}function Us(e,t){if(e===t){const r=function(e){var t;if("undefined"==typeof window)return Math.max(1,e.clientHeight);const r=e.getBoundingClientRect(),n=window.innerHeight||(null===(t=document.documentElement)||void 0===t?void 0:t.clientHeight)||0,i=Math.max(0,r.top),o=Math.min(n,r.bottom);return Math.max(0,Math.round(o-i))}(t);return{scrollTop:t.scrollTop,viewportHeight:Bs(e,Math.min(t.clientHeight,r||t.clientHeight)),viewportWidth:Ns(t),scrollHeight:e.scrollHeight}}const r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=Math.max(r.top,n.top),o=Math.min(r.bottom,n.bottom),a=Math.max(r.left,n.left),s=Math.min(r.right,n.right),l=Math.max(0,Math.round(o-i)),c=Math.max(0,Math.round(s-a));return{scrollTop:Math.max(0,Math.round(i-n.top)),viewportHeight:Bs(e,l),viewportWidth:Ns(e,c||t.clientWidth||e.clientWidth),scrollHeight:e.scrollHeight}}function Vs(e){if("undefined"==typeof window)return{scrollTop:e.scrollTop,viewportHeight:Math.max(1,e.clientHeight),viewportWidth:Ns(e),scrollHeight:e.scrollHeight};const t=Ds(e);return t&&function(e){return e.scrollHeight-e.clientHeight>1}(t)?Us(e,t):function(e){var t,r;const n=e.getBoundingClientRect(),i=window.innerHeight||(null===(t=document.documentElement)||void 0===t?void 0:t.clientHeight)||0,o=window.innerWidth||(null===(r=document.documentElement)||void 0===r?void 0:r.clientWidth)||n.width,a=Math.max(0,n.top),s=Math.min(i,n.bottom),l=Math.max(0,Math.round(s-a));return{scrollTop:Math.max(0,Math.round(-n.top)),viewportHeight:Bs(e,l),viewportWidth:Ns(e,Math.min(Math.round(n.width),o)),scrollHeight:e.scrollHeight}}(e)}function Hs(e,t){const r=u(null),n=c(t=>{e(Vs(t))},[e]);return a(()=>{r.current&&n(r.current)},[n,...t]),a(()=>{if(!r.current||"undefined"==typeof ResizeObserver)return;const e=r.current,t=new ResizeObserver(()=>{n(e)});return t.observe(e),()=>t.disconnect()},[n]),a(()=>{const e=r.current;if(!e)return;const t=()=>{n(e)},i=zs(e);return i.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{i.forEach(e=>{e.removeEventListener("scroll",t)})}},[n,...t]),r}const Ws=({onSearch:t,placeholder:r,className:n})=>{const{t:i}=ri(),[s,l]=o(""),c=u(null),{options:d}=Oo(),{config:h}=d,f=r||i("Search files...");a(()=>(c.current=Vo.debounce(e=>{t(e)},500),()=>{var e;null===(e=c.current)||void 0===e||e.cancel()}),[t]);return e(T,{value:s,onChange:e=>{var t;const r=e.target.value;l(r),null===(t=c.current)||void 0===t||t.call(c,r)},placeholder:f,prefix:e(Gi,{size:16,strokeWidth:null==h?void 0:h.iconStrokeWidth}),className:n,allowClear:!0,onClear:()=>{l(""),t("")}})},$s=[{value:"date-desc",labelKey:"Newest first"},{value:"date-asc",labelKey:"Oldest first"},{value:"size-desc",labelKey:"Largest first"},{value:"size-asc",labelKey:"Smallest first"},{value:"name-asc",labelKey:"A-Z"},{value:"name-desc",labelKey:"Z-A"},{value:"type-asc",labelKey:"By type"}];var qs={contentLayout:"contentLayout",headerContainer:"headerContainer",actionsContainer:"actionsContainer",filesContainer:"filesContainer",filesLoadingOverlay:"filesLoadingOverlay",emptyStateWrapper:"emptyStateWrapper",paginationContainer:"paginationContainer",uploadIcon:"uploadIcon",tableContainer:"tableContainer",tableLoadingWrapper:"tableLoadingWrapper",imagePreview:"imagePreview",fileManagerTableFolder:"fileManagerTableFolder",fileManagerTableFolderInner:"fileManagerTableFolderInner",sortSelect:"sortSelect",fileNameCol:"fileNameCol",fileItemCount:"fileItemCount",fileSize:"fileSize",fileDate:"fileDate",tableMenu:"tableMenu",tableImagePreview:"tableImagePreview",tableFolderIcon:"tableFolderIcon",buttonDeselected:"buttonDeselected",buttonSelectAll:"buttonSelectAll",gridRow:"gridRow",gridCard:"gridCard",selectedRow:"selectedRow",gridCardSelected:"gridCardSelected",gridCheckbox:"gridCheckbox",gridCardContent:"gridCardContent",gridPreviewContainer:"gridPreviewContainer",gridPreviewContainerFolder:"gridPreviewContainerFolder",gridFolderIcon:"gridFolderIcon",gridFolderIconImage:"gridFolderIconImage",gridFileName:"gridFileName",gridFileInfo:"gridFileInfo",gridFileMenu:"gridFileMenu",gridFileMenuButton:"gridFileMenuButton",actionsBox:"actionsBox",uploadContainer:"uploadContainer",uploadArea:"uploadArea",blockText:"blockText",textTitle:"textTitle",textDescription:"textDescription",buttons:"buttons",btnAi:"btnAi",btnPhoto:"btnPhoto",dragOverlay:"dragOverlay",dragOverlayInner:"dragOverlayInner",dragCaptureLayer:"dragCaptureLayer",dragOverlayGlobal:"dragOverlayGlobal",noFiles:"noFiles",noFilesIcon:"noFilesIcon",textTitle_trash:"textTitle_trash",textDescription_trash:"textDescription_trash"};const{Text:Gs}=F,{Option:Ys}=O;const Xs=i.memo(({files:r,filesById:n,currentSortOption:i,isSmallScreen:o,iconStrokeWidth:a,multiSelectEnabled:s=!0,features:l,viewMode:c,setViewMode:u,handleSearch:h,handleSortOptionChange:f,sortOptions:p,onClearSelection:g,onRename:m,onDelete:v,onCopy:y,onMove:b,onEdit:w,t:x})=>{const C=d(()=>(null==p?void 0:p.length)?$s.filter(e=>p.includes(e.value)):$s,[p]),_=d(()=>C.map(e=>e.value).join("|")||"all",[C]),S=ws(e=>e.selectedFiles),A=ws(e=>e.selectedFiles.size),k=ws(e=>e.selectAllVisible),E=r.length>0&&A===r.length,I=d(()=>Array.from(S)[0],[S]),T=d(()=>I?n.get(I):void 0,[n,I]),F=(null==T?void 0:T.isFolder)?!1!==(null==l?void 0:l.enableRenameFolder):!1!==(null==l?void 0:l.enableRenameFile),N=d(()=>Array.from(S).every(e=>{const t=n.get(e);return!!t&&(t.isFolder?!1!==(null==l?void 0:l.enableMoveFolder):!1!==(null==l?void 0:l.enableMoveItem))}),[l,n,S]),j=d(()=>Array.from(S).every(e=>{const t=n.get(e);return!!t&&(t.isFolder?!1!==(null==l?void 0:l.enableCopyFolder):!1!==(null==l?void 0:l.enableCopyItem))}),[l,n,S]),D=d(()=>1===A&&function(e){var t,r,n;if(!e||e.isFolder)return!1;const i=e.extension||(e.name&&e.name.includes(".")?e.name.split(".").pop():void 0)||((null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))?null===(n=null===(r=e.type.split("/")[1])||void 0===r?void 0:r.split(";")[0])||void 0===n?void 0:n.trim():void 0);return Boolean(i&&fr.includes(i.toLowerCase()))}(T),[A,T]);return t("div",A>0?{className:`header-container ${qs.headerContainer}`,children:[t(Gs,{type:"secondary",className:"selected-text",children:[t("div",{children:[A," ",x("selected")]}),s&&e(P,{title:o?x("Select all"):null,children:e(M,{className:qs.buttonSelectAll,onClick:k,disabled:E||0===r.length,children:x("Select all")})}),e(P,{title:o?x("Deselected"):null,children:e(M,{className:qs.buttonDeselected,icon:e(qi,{size:16,strokeWidth:a}),onClick:g,children:x("Deselected")})})]}),t(R,{children:[D&&!1!==(null==l?void 0:l.enableEdit)&&e(P,{title:o?x("Edit"):null,children:e(M,{icon:e(Pi,{size:16,strokeWidth:a}),onClick:()=>w(T),disabled:!D,children:x("Edit")})}),N&&e(P,{title:o?x("Move to"):null,children:e(M,{icon:e(Ri,{size:16,strokeWidth:a}),onClick:b,children:x("Move to")})}),j&&e(P,{title:o?x("Copy"):null,children:e(M,{icon:e(Oi,{size:16,strokeWidth:a}),onClick:y,children:x("Copy")})}),1===A&&F&&e(P,{title:o?x("Rename"):null,children:e(M,{icon:e(Xi,{size:16,strokeWidth:a}),onClick:()=>m(),disabled:1!==A||!F,children:x("Rename")})}),!1!==(null==l?void 0:l.enableDelete)&&e(P,{title:o?x("Delete"):null,children:e(M,{danger:!0,icon:e(Zi,{size:16,strokeWidth:a}),onClick:e=>{e.stopPropagation(),e.preventDefault(),v()},children:x("Delete")})})]})]}:{className:qs.headerContainer,children:[e("div",{className:"search-container",children:e(Ws,{placeholder:x("Search file or folder"),onSearch:h,className:qs.searchInput})}),t("div",{className:qs.actionsBox,children:[e("div",{className:"sort-container",children:e(O,{value:i,onChange:f,className:qs.sortSelect,popupMatchSelectWidth:!1,suffixIcon:e(Ti,{size:16,strokeWidth:a}),children:C.map(({value:t,labelKey:r})=>e(Ys,{value:t,children:x(r)},t))},_)}),e("div",{className:qs.actionsContainer,children:e(L,{options:[{value:"grid",icon:e(Di,{size:16,strokeWidth:a})},{value:"table",icon:e(Ui,{size:20,strokeWidth:a})}],value:c,onChange:e=>u(e)})})]})]})});Xs.displayName="FileContentHeader";const Ks=i.memo(({fileId:t,style:r})=>{const n=ws(e=>e.selectedFiles.has(t)),i=ws(e=>e.toggleFileSelection);return e(N,{checked:n,style:r,onClick:e=>{e.stopPropagation()},onChange:e=>{const r=e.nativeEvent;i(t,{metaKey:r.metaKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,forceToggle:!0})}})});function Zs(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}Ks.displayName="FileSelectionCheckbox","function"==typeof SuppressedError&&SuppressedError;const Qs=i.memo(t=>{var{className:r}=t,n=Zs(t,["className"]);const i=n["data-row-key"],o=null==i?"":String(i),a=[r,ws(e=>!!o&&e.selectedFiles.has(o))?qs.selectedRow:""].filter(Boolean).join(" ");return e("tr",Object.assign({},n,{className:a}))});Qs.displayName="SelectableTableRow";const Js=i.memo(({item:t,variant:r="table",t:n,iconStrokeWidth:i,setCurrentMenuFile:a,showMoveModal:s,showCopyModal:l,showRenameModal:u,showDeleteConfirm:h,onEdit:f})=>{const[p,g]=o(!1),m=d(()=>{if(!p)return[];const r=[];return t.canEdit&&r.push({key:"edit",label:n("Edit"),icon:e(Pi,{size:16,strokeWidth:i})}),t.canMove&&r.push({key:"move",label:n("Move to"),icon:e(Ri,{size:16,strokeWidth:i})}),t.canCopy&&r.push({key:"copy",label:n("Copy"),icon:e(Oi,{size:16,strokeWidth:i})}),t.canRename&&r.push({key:"rename",label:n("Rename"),icon:e(Xi,{size:16,strokeWidth:i})}),t.canDelete&&r.push({key:"delete",label:n("Delete"),icon:e(Zi,{size:16,strokeWidth:i}),style:{color:"#ff4d4f"}}),r},[i,p,t.canCopy,t.canDelete,t.canEdit,t.canMove,t.canRename,n]),v=c(({key:e})=>{switch(t.id&&(null==a||a(t.id)),e){case"edit":f(t.file);break;case"move":s();break;case"copy":l();break;case"rename":u(t.id);break;case"delete":null==h||h();break;default:null==a||a("")}},[t,f,a,l,h,s,u]),y=d(()=>({items:m,onClick:v}),[v,m]);return e(j,{arrow:!0,placement:"bottom",menu:y,trigger:["hover"],onOpenChange:g,children:"grid"===r?e(M,{type:"default",className:`${qs.gridFileMenuButton} gridFileMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(Mi,{size:16,strokeWidth:i})}):e("span",{className:`${qs.tableMenu} tableMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(Mi,{size:16,strokeWidth:i})})})});Js.displayName="FileItemActionsDropdown";const el=({thumbnailSrc:t,previewSrc:r,lightboxSrc:n,alt:o,className:s,width:l,height:h,preview:f=!1})=>{var p,g;const m=d(()=>[t,r],[t,r]),v=d(()=>[n,r,t],[n,r,t]),y=Rs(m),b=Rs(v),{handleError:w,handleLoad:x}=b,C=null!==(p=y.src)&&void 0!==p?p:hr,_=null!==(g=b.src)&&void 0!==g?g:y.src,S=u(!1);a(()=>{S.current=!1},[_]);const A=c(e=>i.cloneElement(e,{key:null!=_?_:hr,src:null!=_?_:hr,fallback:void 0,onError:()=>{S.current||(S.current=!0,w().finally(()=>{S.current=!1}).catch(()=>{}))},onLoad:()=>{x()}}),[_,w,x]),k=d(()=>!(!f||!_)&&{src:_,toolbarRender:()=>null,destroyOnHidden:!0,mask:e(ge,{style:{fontSize:"20px"}}),imageRender:A},[f,_,A]);return e(D,{className:s,src:C,alt:o,width:l,height:h,preview:k,onLoad:y.handleLoad,onError:()=>{y.handleError().catch(()=>{})},fallback:hr})},tl=i.memo(({item:t,variant:r="table",FolderIcon:n,getFileData:i,className:o,width:a,height:s})=>t.isFolder?e("div","grid"===r?{className:qs.gridFolderIcon,children:e(n,{className:qs.gridFolderIconImage})}:{className:qs.fileManagerTableFolder,children:e("div",{className:qs.fileManagerTableFolderInner,children:e(n,{className:qs.tableFolderIcon,style:{width:null!=a?a:40,height:null!=s?s:40}})})}):t.thumbnailSrc||t.previewSrc?e(el,{className:o,thumbnailSrc:t.thumbnailSrc,previewSrc:t.previewSrc,lightboxSrc:t.lightboxSrc,alt:t.file.name,width:a,height:s,preview:!0,file:t.file,getFileData:i}):null);tl.displayName="FileItemPreview";const rl=[".ant-image",".ant-image-preview-root",".ant-image-preview-wrap",".ant-image-preview-mask",".ant-image-preview-close",".ant-image-preview-operations"].join(","),nl=e=>Boolean(e.closest(rl));function il(e){var t,r,n;if(e.isFolder)return!1;const i="string"==typeof e.name?e.name:"",o=i?null===(t=i.split(".").pop())||void 0===t?void 0:t.toLowerCase():void 0,a=null!==(n=null===(r=e.extension)||void 0===r?void 0:r.toLowerCase())&&void 0!==n?n:o;return"string"==typeof e.type&&e.type.startsWith("image/")||"string"==typeof a&&pr.includes(a)}const ol=i.memo(({item:r,t:n,iconStrokeWidth:i,FolderIcon:o,handleItemClick:a,setCurrentMenuFile:s,showMoveModal:l,showCopyModal:u,showRenameModal:d,showDeleteConfirm:h,onEdit:f,onEditorOk:p,getFileData:g,showSelectionCheckbox:m=!0})=>{const v=ws(e=>e.selectedFiles.has(r.id)),y=c(e=>{const t=e.target;t.closest(".gridFileMenuButton")||t.closest(".ant-dropdown-menu")||nl(t)||1===e.detail&&(r.isFolder?a(r.file):p&&il(r.file)&&p(r.file))},[a,r.file,r.isFolder,p]);return e(z,{className:qs.gridCard_col,style:{padding:0},children:t(B,{hoverable:!0,cover:e("div",{className:r.isFolder?qs.gridPreviewContainerFolder:qs.gridPreviewContainer,onClick:e=>{e.stopPropagation(),y(e)},children:e(tl,{item:r,variant:"grid",FolderIcon:o,getFileData:g,className:qs.gridImagePreview})}),className:`${qs.gridCard} ${v?qs.gridCardSelected:""}`,onClick:e=>{e.stopPropagation(),e.preventDefault(),y(e)},children:[t("div",{className:qs.gridCardContent,onClick:e=>{e.stopPropagation(),e.preventDefault(),y(e)},children:[e("div",{className:qs.gridFileName,children:r.nameText||n("Untitled")}),e("div",{className:qs.gridFileInfo,children:r.gridInfoText})]}),e("div",{className:qs.gridFileMenu,onClick:e=>{e.stopPropagation()},children:e(Js,{item:r,variant:"grid",t:n,iconStrokeWidth:i,setCurrentMenuFile:s,showMoveModal:l,showCopyModal:u,showRenameModal:d,showDeleteConfirm:h,onEdit:f})}),m?e("div",{onClick:e=>{e.stopPropagation()},className:qs.gridCheckbox,children:e(Ks,{fileId:r.id,style:{height:20}})}):null]})})});ol.displayName="FileGridItem";const al=i.memo(({rows:t,topOffset:n=0,bottomOffset:i=0,t:o,iconStrokeWidth:a,FolderIcon:s,handleItemClick:l,setCurrentMenuFile:c,showMoveModal:u,showCopyModal:d,showRenameModal:h,showDeleteConfirm:f,onEdit:p,onEditorOk:g,getFileData:m,showSelectionCheckbox:v=!0})=>e(r,{children:e("div",{style:{paddingTop:n,paddingBottom:i},children:e(U,{gutter:[16,16],className:qs.gridRow,style:{gap:20,padding:"0 24px 24px",margin:0},children:t.map(t=>e(ol,{item:t,handleItemClick:l,iconStrokeWidth:a,t:o,FolderIcon:s,setCurrentMenuFile:c,showMoveModal:u,showCopyModal:d,showRenameModal:h,showDeleteConfirm:f,onEdit:p,onEditorOk:g,getFileData:m,showSelectionCheckbox:v},t.id))})})}));al.displayName="FileGridView";const sl=i.memo(({rows:t,columns:n,topOffset:i=0,bottomOffset:o=0,onRow:a,components:s})=>{const l=d(()=>e("div",{style:{paddingTop:i,paddingBottom:o},children:e(k,{renderEmpty:()=>e(H,{image:e(r,{}),description:""}),children:e(V,{dataSource:t,columns:n,rowKey:"id",pagination:!1,tableLayout:"fixed",onRow:a,components:s,showHeader:!1})})}),[o,n,s,a,t,i]);return e("div",{className:qs.tableLoadingWrapper,children:l})});sl.displayName="FileTableView";const ll=i.memo(({item:t})=>t.dateText?e(P,{title:t.dateText,placement:"bottom",className:qs.fileDate,children:t.dateText}):null);ll.displayName="FileItemDate";const cl=i.memo(({item:r})=>t("div",{className:qs.fileName,children:[r.nameText,r.isFolder&&e("div",{className:qs.fileItemCount,children:r.folderItemsText})]}));cl.displayName="FileItemName";const ul="filemanager_view_mode";class dl{constructor(){this.rowsById=new Map}reconcile(e,t,r){const n=new Map,i=[];for(const o of e){const e=t.getId(o),a=t.buildSignature(o,r),s=this.rowsById.get(e);if(s&&s.signature===a){n.set(e,s),i.push(s);continue}const l=t.buildRowModel(o,r,{id:e,signature:a});n.set(e,l),i.push(l)}return this.rowsById=n,i}}class hl{createRenderWindow(e,t){var r,n,i,o,a,s,l,c,u,d,h,f,p,g,m,v,y,b,w,x,C,_,S,A,k;const E=null!==(r=null==t?void 0:t.renderStrategy)&&void 0!==r?r:"full";if("windowed"!==E){if("positioned"===E){const r=null!==(i=null===(n=null==t?void 0:t.positioned)||void 0===n?void 0:n.layout)&&void 0!==i?i:[],v=null!==(a=null===(o=null==t?void 0:t.positioned)||void 0===o?void 0:o.viewportTop)&&void 0!==a?a:0,y=null!==(l=null===(s=null==t?void 0:t.positioned)||void 0===s?void 0:s.viewportBottom)&&void 0!==l?l:Number.MAX_SAFE_INTEGER,b=Math.max(0,null!==(u=null===(c=null==t?void 0:t.positioned)||void 0===c?void 0:c.overscanPx)&&void 0!==u?u:0),w=Math.max(0,null!==(h=null===(d=null==t?void 0:t.positioned)||void 0===d?void 0:d.containerHeight)&&void 0!==h?h:0),x=r.filter(e=>e.bottom>=v-b&&e.top<=y+b).map(t=>({row:e[t.index],layout:t})).filter(e=>Boolean(e.row)),C=null!==(p=null===(f=x[0])||void 0===f?void 0:f.layout.index)&&void 0!==p?p:-1,_=null!==(m=null===(g=x[x.length-1])||void 0===g?void 0:g.layout.index)&&void 0!==m?m:-1;return{rows:x.map(e=>e.row),startIndex:C,endIndex:_,topOffset:0,bottomOffset:0,totalCount:e.length,containerHeight:w,positionedItems:x}}return{rows:e,startIndex:0,endIndex:e.length>0?e.length-1:-1,topOffset:0,bottomOffset:0,totalCount:e.length}}const I=Math.max(0,null!==(y=null===(v=null==t?void 0:t.windowed)||void 0===v?void 0:v.startIndex)&&void 0!==y?y:0),T=null!==(w=null===(b=null==t?void 0:t.windowed)||void 0===b?void 0:b.endIndex)&&void 0!==w?w:e.length-1,F=Math.max(0,null!==(C=null===(x=null==t?void 0:t.windowed)||void 0===x?void 0:x.overscan)&&void 0!==C?C:0),O=Math.max(1,null!==(S=null===(_=null==t?void 0:t.windowed)||void 0===_?void 0:_.estimatedItemSize)&&void 0!==S?S:1),P=Math.max(1,null!==(k=null===(A=null==t?void 0:t.windowed)||void 0===A?void 0:A.itemsPerLane)&&void 0!==k?k:1),M=Math.ceil(e.length/P),R=Math.min(e.length-1,T),L=Math.floor(I/P),N=Math.floor(Math.max(I,R)/P),j=Math.max(0,L-F),D=Math.min(M-1,N+F),z=j*P,B=Math.min(e.length-1,(D+1)*P-1),U=Math.max(0,M-D-1);return{rows:e.slice(z,B+1),startIndex:z,endIndex:B,topOffset:j*O,bottomOffset:U*O,totalCount:e.length}}}function fl({items:e,context:t,adapter:r,options:n}){const i=u(null),o=u(null);i.current||(i.current=new dl),o.current||(o.current=new hl);const a=d(()=>i.current.reconcile(e,r,t),[r,t,e]),s=d(()=>o.current.createRenderWindow(a,n),[n,a]);return{rowModels:a,renderWindow:s}}function pl({totalCount:e,plan:t}){const[r,n]=o(null),i=d(()=>{var n,i;if(!t.enabled)return{renderStrategy:"full"};const o=function(e,t){var r;return Math.max(1,null!==(r=null==e?void 0:e.viewportHeight)&&void 0!==r?r:t)}(r,null!==(n=t.fallbackViewportHeight)&&void 0!==n?n:800),a=Math.max(1,Math.ceil(o/t.estimatedItemSize)),s=Math.max(1,Math.ceil(e/t.itemsPerLane)),l=Math.min(s-1,Math.max(0,Math.floor((null!==(i=null==r?void 0:r.scrollTop)&&void 0!==i?i:0)/t.estimatedItemSize))),c=l+a-1;return{renderStrategy:"windowed",windowed:{startIndex:l*t.itemsPerLane,endIndex:Math.min(e-1,(c+1)*t.itemsPerLane-1),overscan:t.overscan,estimatedItemSize:t.estimatedItemSize,itemsPerLane:t.itemsPerLane}}},[t.enabled,t.estimatedItemSize,t.fallbackViewportHeight,t.itemsPerLane,t.overscan,e,r]);return{engineOptions:i,handleViewportChange:c(e=>{n(t=>(null==t?void 0:t.viewportHeight)===e.viewportHeight&&(null==t?void 0:t.viewportWidth)===e.viewportWidth&&(null==t?void 0:t.scrollHeight)===e.scrollHeight&&(null==t?void 0:t.scrollTop)===e.scrollTop?t:e)},[])}}function gl(e,t){if("number"==typeof e.childCount)return e.childCount;const r=t[e.id];return null===r?null:null!=r?r:0}function ml(e){var t,r,n;const i=e.extension||(e.name&&e.name.includes(".")?e.name.split(".").pop():void 0)||((null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))?null===(n=null===(r=e.type.split("/")[1])||void 0===r?void 0:r.split(";")[0])||void 0===n?void 0:n.trim():void 0);return Boolean(i&&fr.includes(i.toLowerCase()))}function vl(e,t){if(!e)return"";const r=new Date(e);if(Number.isNaN(r.getTime()))return"";const n=[t("months.january"),t("months.february"),t("months.march"),t("months.april"),t("months.may"),t("months.june"),t("months.july"),t("months.august"),t("months.september"),t("months.october"),t("months.november"),t("months.december")];return t("Added",{date:`${r.getDate()} ${n[r.getMonth()]} ${r.getFullYear()}`})}const yl={getId:e=>e.id,buildSignature:(e,t)=>function(e,t){var r,n,i,o,a,s,l,c;const u=Boolean(e.isFolder),d=u?gl(e,t.folderFileCounts):null,h=u?null===d?"u":String(d):"0",f=vl(e.date,t.t),p=!u&&e.size?String(e.size):"",g=e.thumbnailUrl||e.thumbnail,m=e.url&&ml(e)?e.url:"",v=t.previewFallbackToFileUrl?m:"",y=[!1!==(null===(r=t.features)||void 0===r?void 0:r.enableEdit),!1!==(null===(n=t.features)||void 0===n?void 0:n.enableMoveFolder),!1!==(null===(i=t.features)||void 0===i?void 0:i.enableMoveItem),!1!==(null===(o=t.features)||void 0===o?void 0:o.enableCopyFolder),!1!==(null===(a=t.features)||void 0===a?void 0:a.enableCopyItem),!1!==(null===(s=t.features)||void 0===s?void 0:s.enableRenameFolder),!1!==(null===(l=t.features)||void 0===l?void 0:l.enableRenameFile),!1!==(null===(c=t.features)||void 0===c?void 0:c.enableDelete)].join("|"),b=[g||"",v,m].join("::");return[e.id,e.name,e.folderId,e.type||"",e.extension||"",b,b,e.dimensions||"",p,f,u?"1":"0",h,y].join("::")}(e,t),buildRowModel:(e,t,r)=>{var n,i,o,a,s,l,c,u;const d=Boolean(e.isFolder),h=d?gl(e,t.folderFileCounts):null,f=d&&null===h?"—":d?`${h} ${1===h?t.t("item"):t.t("items")}`:"",p=e.dimensions||"",g=!d&&e.size?ki(e.size):"",m=d?t.t("Folder"):function(e){var t,r,n;return e.extension||(null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase())||(e.url?null===(n=null===(r=e.url.split("?")[0].split("/").pop())||void 0===r?void 0:r.split(".").pop())||void 0===n?void 0:n.toLowerCase():"")||""}(e),v=vl(e.date,t.t),y=d?f:[p,g,m].filter(Boolean).join(" • "),b=e.thumbnailUrl||e.thumbnail,w=e.url&&ml(e)?e.url:void 0,x=t.previewFallbackToFileUrl?w:void 0;return{id:r.id,signature:r.signature,item:e,file:e,isFolder:d,nameText:e.name||t.t("No name"),folderItemsText:f,dimensionsText:p,sizeText:g,typeText:m,dateText:v,gridInfoText:y,thumbnailSrc:b,previewSrc:x,lightboxSrc:w,canEdit:!d&&!1!==(null===(n=t.features)||void 0===n?void 0:n.enableEdit)&&ml(e),canMove:d?!1!==(null===(i=t.features)||void 0===i?void 0:i.enableMoveFolder):!1!==(null===(o=t.features)||void 0===o?void 0:o.enableMoveItem),canCopy:d?!1!==(null===(a=t.features)||void 0===a?void 0:a.enableCopyFolder):!1!==(null===(s=t.features)||void 0===s?void 0:s.enableCopyItem),canRename:d?!1!==(null===(l=t.features)||void 0===l?void 0:l.enableRenameFolder):!1!==(null===(c=t.features)||void 0===c?void 0:c.enableRenameFile),canDelete:!1!==(null===(u=t.features)||void 0===u?void 0:u.enableDelete)}}};const bl=i.memo(({files:r,searchTerm:n,handleSearch:i,sortBy:s,sortOrder:l,handleSortOptionChange:h,pagination:f,setPagination:p,loading:g,handleItemClick:m,onClearSelection:v,onRename:y,onDelete:b,onCopy:w,onMove:x,showRenameModal:C,showDeleteConfirm:_,showCopyModal:A,showMoveModal:k,onEdit:E,getFileData:I,handleAddFile:T})=>{var F;const{t:O}=ri(),P=Yo(),{DropZoneFileIcon:M,BigStockIcon:R,BigAIIcon:L,FolderIcon:N}=Mo(),{options:j,actions:D,state:z}=Oo(),{dataProviders:B,config:U}=j,V=null==U?void 0:U.disablePagination,{setCurrentMenuFile:H,setActiveLibraryItem:$}=D,q="Trash"===(null==z?void 0:z.selectedFolder),G=!1!==(null==z?void 0:z.multiSelect),{viewMode:Y,setViewMode:X}=(()=>{const[e,t]=o(()=>{try{return localStorage.getItem(ul)||"table"}catch(e){return"table"}}),r=c(e=>{t(e);try{localStorage.setItem(ul,e)}catch(e){console.warn("Не удалось сохранить режим отображения:",e)}},[]),n=c(()=>{r("table"===e?"grid":"table")},[e,r]);return{viewMode:e,setViewMode:r,toggleViewMode:n}})(),[K,Z]=o({}),[Q,J]=o(!1),ee=u(0),te=u(null);a(()=>{const e=window.matchMedia("(max-width: 1199px)"),t=e=>{J(e.matches)};t(e);const r=e=>t(e);return"function"==typeof e.addEventListener?(e.addEventListener("change",r),()=>e.removeEventListener("change",r)):(e.addListener(r),()=>e.removeListener(r))},[]);const re=d(()=>(null==U?void 0:U.features)||{},[null==U?void 0:U.features]),ne=null==U?void 0:U.iconStrokeWidth,ie=null==U?void 0:U.sortOptions,oe=d(()=>(null==ie?void 0:ie.length)?new Set(ie):null,[ie]),ae=`${s}-${l}`;a(()=>{var e;if(oe&&!oe.has(ae)){const t=null===(e=$s.find(e=>oe.has(e.value)))||void 0===e?void 0:e.value;t&&h(t)}},[oe,ae,h]);const se=d(()=>new Map(r.map(e=>[e.id,e])),[r]),{renderRows:le,renderWindow:ce,hasAnyValidDate:ue,handleViewportChange:de}=function({files:e,folderFileCounts:t,features:r,t:n,viewMode:i,previewFallbackToFileUrl:a}){const s=d(()=>({folderFileCounts:t,features:r,t:n,previewFallbackToFileUrl:a}),[r,t,n,a]),[l,u]=o(()=>Math.max(1,Math.floor(5))),h=d(()=>{const t=e.length>150;return"table"===i?{enabled:t,estimatedItemSize:56,overscan:10,itemsPerLane:1,fallbackViewportHeight:800}:{enabled:t,estimatedItemSize:320,overscan:2,itemsPerLane:l,fallbackViewportHeight:800}},[e.length,l,i]),{engineOptions:f,handleViewportChange:p}=pl({totalCount:e.length,plan:h}),{rowModels:g,renderWindow:m}=fl({items:e,context:s,adapter:yl,options:f}),v=d(()=>g.some(e=>Boolean(e.dateText)),[g]),y=c(e=>{if("grid"===i){const t=Math.max(1,Math.floor(e.viewportWidth/240));u(e=>e===t?e:t)}p(e)},[p,i]);return{rowModels:g,renderRows:m.rows,renderWindow:m,hasAnyValidDate:v,handleViewportChange:y}}({files:r,folderFileCounts:K,features:re,t:O,viewMode:Y,previewFallbackToFileUrl:null==U?void 0:U.previewFallbackToFileUrl}),he=c(async e=>{var t,r,n,i;try{if(null==B?void 0:B.getChildrenCount)return await B.getChildrenCount("folders"===e?void 0:e);if(null==B?void 0:B.getFiles){const{files:r,pagination:n}=await B.getFiles({folderId:"folders"===e?void 0:e,itemType:"all",page:V?void 0:1,limit:V?void 0:1});return V?Array.isArray(r)?r.length:0:null!==(t=null==n?void 0:n.total)&&void 0!==t?t:Array.isArray(r)?r.length:0}return 0}catch(t){if("StaleLoad"===(null==t?void 0:t.name))return 0;const o=t;if(404===(null==o?void 0:o.status)||"FileNotFound"===(null==o?void 0:o.code)||"path_folder_not_found"===(null==o?void 0:o.code)||"path_folder_not_found"===(null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.code)||404===(null===(i=null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.data)||void 0===i?void 0:i.status))return 0;console.error(`Error getting the number of files for the folder ${e}:`,t);const a=await os({folderId:e,dataProviders:B,folders:Array.isArray(z.folders)?z.folders:[],pathHistory:z.pathHistory,t:O});return P.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:O("Failed to load folder items count in folder",{folderName:a}),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{folderId:"folders"===e?null:e,folderName:a,reason:t instanceof Error?t.message:String(t)}}),null}},[B,V,P,z.folders,z.pathHistory,O]),fe=c(async()=>{const e=ee.current+1;ee.current=e;const t=r.filter(e=>e.isFolder);if(0===t.length)return void Z(e=>0===Object.keys(e).length?e:{});const n={},i=t.map(async e=>{"number"!=typeof e.childCount?n[e.id]=await he(e.id):n[e.id]=e.childCount});await Promise.all(i),ee.current===e&&Z(e=>{const t=Object.keys(e),r=Object.keys(n);return t.length===r.length&&t.every(t=>e[t]===n[t])?e:n})},[r,he]);a(()=>{fe()},[fe]),a(()=>{te.current&&de(Vs(te.current))},[r.length,de,Y]),a(()=>{if(!te.current||"undefined"==typeof ResizeObserver)return;const e=te.current,t=new ResizeObserver(()=>{de(Vs(e))});return t.observe(e),()=>{t.disconnect()}},[de]);const pe=c(e=>{const t=Vs(e);de(t)},[de]);a(()=>{const e=te.current;if(!e)return;const t=()=>{pe(e)},r=zs(e);return r.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{r.forEach(e=>{e.removeEventListener("scroll",t)})}},[r.length,pe,Y]);const ge=c((e,t)=>e!==t,[]),me=d(()=>[...G?[{key:"selection",width:46,shouldCellUpdate:ge,render:(t,r)=>e(Ks,{fileId:r.id})}]:[],{key:"preview",width:60,shouldCellUpdate:ge,render:(t,r)=>e(tl,{item:r,variant:"table",FolderIcon:N,getFileData:I,className:`${qs.imagePreview} ${qs.tableImagePreview}`,width:40,height:40})},{title:O("Name"),width:"calc(100% - 430px)",dataIndex:"nameText",key:"name",className:qs.fileNameCol,shouldCellUpdate:ge,render:(t,r)=>e(cl,{item:r})},{title:O("Dimensions"),key:"dimensions",width:100,shouldCellUpdate:ge,render:(t,r)=>r.dimensionsText&&e("div",{className:qs.fileSize,children:r.dimensionsText})},{title:O("Size"),key:"size",width:90,shouldCellUpdate:ge,render:(t,r)=>r.sizeText?e("div",{className:qs.fileSize,children:r.sizeText}):null},{title:O("Type"),key:"type",width:90,shouldCellUpdate:ge,render:(t,r)=>e("div",{className:qs.fileSize,children:r.typeText})},...ue?[{title:O("Date"),dataIndex:"dateText",key:"date",width:200,shouldCellUpdate:ge,render:(t,r)=>e(ll,{item:r})}]:[],{width:40,title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),shouldCellUpdate:ge,render:(t,r)=>e(Js,{item:r,variant:"table",t:O,iconStrokeWidth:ne,setCurrentMenuFile:H,showMoveModal:k,showCopyModal:A,showRenameModal:C,showDeleteConfirm:_,onEdit:E})}],[N,I,ue,ne,G,E,H,ge,A,_,k,C,O]),ve=d(()=>({body:{row:Qs}}),[]),ye=c(e=>({onClick:t=>{if(t.stopPropagation(),t.preventDefault(),1!==t.detail)return;const r=t.target,n=Boolean(r.closest(".ant-checkbox-wrapper")),i=Boolean(r.closest(".tableMenuButton")),o=Boolean(r.closest(".ant-dropdown-menu"));n||nl(r)||i||o||(e.isFolder?m(e.file):j.onEditorOk&&il(e.file)&&j.onEditorOk(e.file))}}),[m,j]);let be="table"===Y?e(sl,{rows:le,columns:me,topOffset:ce.topOffset,bottomOffset:ce.bottomOffset,onRow:ye,components:ve}):e(al,{rows:le,topOffset:ce.topOffset,bottomOffset:ce.bottomOffset,t:O,iconStrokeWidth:ne,FolderIcon:N,handleItemClick:m,setCurrentMenuFile:H,showMoveModal:k,showCopyModal:A,showRenameModal:C,showDeleteConfirm:_,onEdit:E,onEditorOk:j.onEditorOk,getFileData:I,showSelectionCheckbox:G});n&&!r.length&&(be=e(Do,{}));const we=null===(F=null==U?void 0:U.availableImageExtensions)||void 0===F?void 0:F.map(e=>"."+e).join(", "),xe=t("div",q?{className:`${qs.noFiles} ant-layout-sider-light`,children:[e(Qi,{size:48,className:qs.noFilesIcon}),e("div",{className:`${qs.textTitle_trash} ant-menu-submenu-title`,children:O("Trash is empty")}),e("div",{className:`${qs.textDescription_trash} ant-menu-submenu-title`,children:O("Deleted files will be displayed here")})]}:{className:qs.uploadContainer,children:[t("div",{className:`${qs.uploadArea} `,onClick:T,children:[e("div",{className:qs.uploadIcon,children:e(M,{})}),e("div",{className:qs.textTitle,children:O("Click here to select a file")}),e("div",{className:qs.textDescription,children:O("Supported files:")+" "+(we||"jpeg, .svg, .png")})]}),t("div",{className:qs.buttons,children:[t("button",{className:qs.btnPhoto,onClick:()=>{$&&$(tr)},children:[e("div",{className:qs.icon,children:e(R,{})}),t("div",{className:qs.blockText,children:[e("div",{className:qs.textTitle,children:O("Stock")}),e("div",{className:qs.textDescription,children:O("Select an image from our library")})]})]}),t("button",{className:qs.btnAi,onClick:()=>{$&&$(nr)},children:[e("div",{className:qs.icon,children:e(L,{})}),t("div",{className:qs.blockText,children:[e("div",{className:qs.textTitle,children:O("AI generation")}),e("div",{className:qs.textDescription,children:O("Creating an image on demand")})]})]})]})]});return e("div",{className:`content-layout ${qs.contentLayout}`,children:g||0!==(null==r?void 0:r.length)||n?t("div",{className:qs.tableContainer,children:[e(Xs,{files:r,filesById:se,currentSortOption:ae,isSmallScreen:Q,iconStrokeWidth:ne,multiSelectEnabled:G,features:re,viewMode:Y,setViewMode:X,handleSearch:i,handleSortOptionChange:h,sortOptions:ie,onClearSelection:v,onRename:y,onDelete:b,onCopy:w,onMove:x,onEdit:E,t:O}),t("div",{ref:te,className:qs.filesContainer,children:[be,g?e("div",{className:qs.filesLoadingOverlay,"aria-busy":"true","aria-live":"polite",children:e(S,{size:"large"})}):null]}),!V&&f.total>f.pageSize&&e("div",{className:qs.paginationContainer,children:e(W,{current:f.current,pageSize:f.pageSize,total:f.total,onChange:(e,t)=>p({current:e,pageSize:t,total:f.total}),showSizeChanger:!0,showTotal:e=>O("total pages",{total:e})})})]}):e("div",{className:qs.emptyStateWrapper,children:xe})})});bl.displayName="FileContent";var wl="folderTree",xl="emptyFolderContainer",Cl="folderItemContainer",_l="folderLabel",Sl="folderLabelItem",Al="fileCount",kl="foldersTitle",El="foldersTitleItem",Il="folderMenu";const Tl=({selectedFolder:r,onSelect:n,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}=ri(),{options:x}=Oo(),{config:C}=x,{ExpandArrowIcon:_,CollapseArrowIcon:S,CollapseFolderIcon:A,ExpandFolderIcon:k,EmptyFolderIcon:E}=Mo(),I=c(e=>{const t=[],r=e=>{e.forEach(e=>{t.push(e.key),e.children&&r(e.children)})};return r(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==n||n(e),await(null==l?void 0:l("folders"===t?null:t)))},[n,l]),R=c(async(e,t)=>{var r;P(e),null==i||i(e,t);if(!("lazy"===(null==C?void 0:C.folderTreeLoading)))return;const n=(null===(r=null==t?void 0:t.node)||void 0===r?void 0:r.key)||void 0;if(n&&"folders"!==n)try{await(null==l?void 0:l(n))}catch(e){console.warn("Failed to load child folders for",n,e)}},[null==C?void 0:C.folderTreeLoading,l,i,P]),L=c(()=>{var n,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)&&r===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=r=>{var n;const i=h?f[r.key]:void 0,o=h&&null===i?null:h&&null!=i?i:0,a=O.includes(r.key),s=u.includes(r.key),l=(()=>{var t;return(null===(t=r.children)||void 0===t?void 0:t.length)?e(a?A:k,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}):e(E,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth})})(),d=t("div",{className:`${Cl} folder-item-container`,onClick:()=>!s&&c(r.key),style:{opacity:s?.5:1,cursor:s?"not-allowed":"pointer"},children:[t("div",{className:_l,children:[void 0!==r.icon?r.icon:l,e("span",{className:Sl,children:r.label})]}),h&&e("div",{className:Al,title:null===o?void 0:`${o} ${w(1===o?"item":"items")}`,children:null===o?"—":o})]});return{key:r.key,title:d,children:null===(n=r.children)||void 0===n?void 0:n.map(p),disabled:s}},g=O.includes("folders"),m=e("div",{className:kl,onClick:()=>c("folders"),children:t("div",{className:El,children:[e(g?A:k,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:`${Sl} folder-label-item`,children:"folders"===(null===(n=l[0])||void 0===n?void 0:n.key)?l[0].label:w("Folders")})]})}),b=()=>({key:"Trash",title:e("div",{className:kl,onClick:()=>c("Trash"),children:t("div",{className:El,children:[e(Zi,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:Sl,children:w("Trash")})]})}),children:void 0});if(d){if(!v)return[{key:"empty",title:e("div",{className:xl,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,A,null==C?void 0:C.iconStrokeWidth,k,w,r,M,h,f,E,u,v,y,P]),N=d(()=>L(),[L]);return e($,{className:`${wl} ${Il} ${p}`,selectedKeys:r?[r]:[],expandedKeys:O,onSelect:M,onExpand:R,treeData:N,switcherIcon:({expanded:t})=>e(t?S:_,{}),showLine:!1})},Fl=({style:t={},wrap:r=!1})=>{const n=Object.assign({width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},t);return e(R,{size:"large",style:n,wrap:r,children:e(S,{})})};var Ol={formFooter:"formFooter",folderButton:"folderButton",foldersWrapper:"foldersWrapper",formItem:"formItem",folderToolsField:"folderToolsField",inputButtonOk:"inputButtonOk",permanentDeleteWarning:"permanentDeleteWarning",clearTrashProgress:"clearTrashProgress",progressText:"progressText",closeIcon:"closeIcon",modalContentWithLoader:"modalContentWithLoader",modalLoaderOverlay:"modalLoaderOverlay"};const Pl=({folderId:n,activeFormField:i,EmptyFolderIcon:o,targetForm:a,handleModalOk:s,onComplete:l,setIsLoading:c,t:u})=>e(I.Item,{className:"form-item form-item-moveto "+(i===n?"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(T,{className:"form-input",autoFocus:!0,prefix:e(o,{style:{marginRight:6}}),suffix:t(r,{children:[e(P,{placement:"top",title:"Clean",children:e(M,{icon:e(me,{style:{fontSize:10}}),className:Ol.inputButtonClose,type:"text",onClick:()=>{a.setFieldsValue({folderName:""})}})}),e(M,{className:Ol.inputButtonOk,type:"text",onClick:()=>{c(!0),s(a).then(e=>{const t=null==e?void 0:e.id;l(t)}).finally(()=>c(!1))},children:u("Create")})]})})});function Ml({folders:n,selectedFolder:o,EmptyFolderIcon:a,handleCreateFolderModalOk:s,setIsLoading:l,t:c}){const[u,d]=i.useState(""),h=i.useCallback((t,r)=>n=>e(Pl,{folderId:n,activeFormField:u,EmptyFolderIcon:a,targetForm:t,handleModalOk:s,onComplete:r,setIsLoading:l,t:c},n),[a,u,s,l,c]),f=i.useCallback(e=>{const{folderId:t,targetForm:r,onTreeSelect:n,onComplete:i}=e;return{handleAddFolder:e=>{e.preventDefault(),e.stopPropagation(),d(t),r.setFieldsValue({folderName:c("New folder"),targetFolder:t})},handleSelectFolder:e=>{e.preventDefault(),e.stopPropagation(),n([t]).then(()=>i(t))}}},[c]),p=i.useCallback(i=>{const{targetForm:a,onTreeSelect:s,onComplete:l,actionButtonText:d}=i,p=h(a,l),g=Array.isArray(n)?n:[],m=(n=null,i=new Set)=>g.filter(e=>{const t=null===n&&!e.parentId,r=e.parentId===n;return t||r}).map(n=>{if(i.has(n.id))return{key:n.id,label:`${n.name} (циклическая ссылка)`};const c=new Set(i);c.add(n.id);const h=m(n.id,c),{handleAddFolder:g,handleSelectFolder:v}=f({folderId:n.id,targetForm:a,onTreeSelect:s,onComplete:l}),y=u===n.id?[{key:`${n.id}_input`,label:p(n.id),icon:null},...h]:h;return{key:n.id,label:t(r,{children:[n.name,o!==n.id&&t("div",{className:`${Ol.folderToolsField} folder-tools-field`,children:[e(M,{onClick:g,children:"+"}),e(M,{onClick:v,children:d})]})]}),children:y}}),v=m(),{handleAddFolder:y,handleSelectFolder:b}=f({folderId:"folders",targetForm:a,onTreeSelect:s,onComplete:l}),w="folders"===u?[{key:"folders_input",label:p("folders"),icon:null},...v]:v;return[{key:"folders",label:t(r,{children:[c("Folders"),"folders"!==o&&null!==o&&t("div",{className:`${Ol.folderToolsField} folder-tools-field`,children:[e(M,{onClick:y,children:"+"}),e(M,{onClick:b,children:d})]})]}),children:w}]},[u,h,f,n,o,c]);return{activeFormField:u,setActiveFormField:d,generateMenuItemsFromFolders:p}}const Rl=f(({folderId:t,activeFormField:r,EmptyFolderIcon:n,targetForm:i,handleModalOk:o,onComplete:a,t:s,setIsLoading:l,defaultFolderName:u})=>{const d=c(()=>{l(!0),o(i).then(e=>a(null==e?void 0:e.id)).finally(()=>l(!1))},[o,i,a,l]);return e(I.Item,{className:"form-item form-item-moveto "+(r===t?"form-item_active":""),name:"folderName",initialValue:u,rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(s("Enter the name of the folder"))):Promise.resolve()}],children:e(T,{className:"form-input",autoFocus:!0,prefix:e(n,{style:{marginRight:6}}),suffix:e(M,{className:Ol.inputButtonOk,type:"text",onClick:()=>{l(!0),d()},children:s("Create")})})})});Rl.displayName="CustomFolderInput";const Ll=({isModalVisible:n,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:A,moveForm:k,selectedFiles:E,isRenameFolderModalVisible:F,handleRenameFolderOk:O,handleRenameFolderCancel:P,renameFolderForm:R,folderToRename:L,isCopyModalVisible:N,handleCopyOk:j,handleCopyCancel:D,copyForm:z,isDeleteConfirmVisible:B,handleDeleteConfirmOk:U,handleDeleteConfirmCancel:V,isClearTrashConfirmVisible:H,handleClearTrashConfirm:W,handleClearTrashCancel:$,fetchChildFolders:Y})=>{var X,K,Z;const{t:Q}=ri(),{state:J,actions:ee,options:te}=Oo(),{setCurrentMenuFile:re}=ee,{config:ne}=te,{currentMenuFile:ie}=J,oe=I.useWatch("folderName",l),{EmptyFolderIcon:ae}=Mo(),[se,le]=o(!1),ce=d(()=>{var e;return(null===(e=null==ne?void 0:ne.defaultFolderName)||void 0===e?void 0:e.trim())||Q("New folder")},[null==ne?void 0:ne.defaultFolderName,Q]),ue=!oe||0===String(oe).trim().length,de=d(()=>Array.isArray(C)?C:[],[C]),he=x?null===(X=de.find(e=>e.id===x))||void 0===X?void 0:X.name:"",fe=Array.isArray(h)?h:[],pe=L?null===(K=fe.find(e=>e.id===L))||void 0===K?void 0:K.name:"",{activeFormField:ge,setActiveFormField:ve,generateMenuItemsFromFolders:ye}=Ml({folders:fe,selectedFolder:u,EmptyFolderIcon:ae,handleCreateFolderModalOk:i,setIsLoading:e=>le(Boolean(e)),t:Q});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 be=x?de.find(e=>e.id===x):null,we=(null==be?void 0:be.isFolder)||(null==x?void 0:x.startsWith("folder_")),xe=c(async e=>{e.length>0&&(k.setFieldsValue({targetFolder:e[0]}),ge!==e[0].toString()&&ve(""))},[k,ge,ve]),Ce=c(async e=>{e.length>0&&(z.setFieldsValue({targetFolder:e[0]}),ge!==e[0].toString()&&ve(""))},[ge,z,ve]),_e=c(async e=>{le(!0);try{await S(e)}finally{le(!1)}},[S]),Se=c(async e=>{le(!0);try{await j(e)}finally{le(!1)}},[j]),Ae=d(()=>{const e=Array.from(E).filter(e=>{const t=de.find(t=>t.id===e);return(null==t?void 0:t.isFolder)||h.some(t=>t.id===e)});return u&&"folders"!==u?e.push(u):u&&"folders"!==u||e.push("folders"),e},[E,de,h,u]);return t(r,{children:[e(q,{title:e("div",{className:"modal-title",children:Q("Creating a new folder")}),open:n,onOk:()=>i(),onCancel:s,okText:Q("Create"),cancelText:Q("Cancel"),okButtonProps:{disabled:ue,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>le(!1),children:t(I,{form:l,layout:"vertical",children:[e(I.Item,{name:"folderName",label:e("div",{className:"form-label",children:Q("Folder name")}),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Q("Enter the name of the folder"))):Promise.resolve()}],initialValue:ce,className:"form-item",style:{marginBottom:5},children:e(T,{autoFocus:!0,className:"form-input",disabled:se,placeholder:Q("Enter the name"),onPressEnter:async()=>{le(!0);try{await l.validateFields(),ue||await i()}catch(e){le(!1)}}})}),e("div",{children:u&&"folders"!==u?t("p",{className:"fm-note",children:[Q("A folder will be created inside:")," ",(null===(Z=fe.find(e=>e.id===u))||void 0===Z?void 0:Z.name)||Q("selected folder"),"."]}):e("p",{className:"fm-note",children:Q("The folder will be created in the root directory.")})})]})}),e(q,{title:e("div",{className:"modal-title",children:Q("Upload file by URL")}),open:f,onOk:async()=>{var e;le(!0);try{const t=await m.validateFields(),r=String(null!==(e=t.fileUrl)&&void 0!==e?e:"").trim();await g(r,void 0,void 0,"uploadByUrl")}catch(e){}finally{le(!1)}},onCancel:()=>p(!1),okText:Q("Download"),okButtonProps:{loading:se},cancelText:Q("Cancel"),cancelButtonProps:{disabled:se},afterClose:()=>le(!1),children:e(I,{form:m,layout:"vertical",children:e(I.Item,{name:"fileUrl",label:e("div",{className:"form-label",children:Q("File URL")}),rules:[{required:!0,message:Q("Enter the URL of the image")},{validator:(e,t)=>{if(!t||!String(t).trim())return Promise.resolve();try{return fa(String(t),Q),Promise.resolve()}catch(e){return Promise.reject(new Error(e instanceof Error?e.message:Q("The specified URL is not valid.")))}}}],validateTrigger:"onBlur",className:"form-item",children:e(T,{className:"form-input",placeholder:"https://example.com/image.jpg",autoFocus:!0,disabled:se,onPressEnter:async()=>{var e;le(!0);try{const t=await m.validateFields(),r=String(null!==(e=t.fileUrl)&&void 0!==e?e:"").trim();await g(r,void 0,void 0,"uploadByUrl")}catch(e){}finally{le(!1)}}})})})}),e(q,{title:e("div",{className:"modal-title",children:we?`${Q("Rename folder")} ${he}`:Q("Rename file",{currentFileName:he})}),open:v,onOk:y,okText:Q("Rename"),okButtonProps:{loading:se},onCancel:b,cancelText:Q("Cancel"),cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},children:e(I,{form:w,layout:"vertical",children:e(I.Item,{name:"newFileName",label:e("div",{className:"form-label",children:Q(we?"New folder name":"New file name")}),rules:[{required:!0,message:Q(we?"Enter a new folder name":"Enter a new file name")}],className:"form-item",children:e(T,{autoFocus:!0,className:"form-input",disabled:se,onPressEnter:async()=>{le(!0);try{await w.validateFields(),y()}catch(e){le(!1)}}})})})}),e(q,{title:e("div",{className:"modal-title",children:Q("Move to")}),open:_,onCancel:A,footer:t("div",{className:Ol.formFooter,children:[t(M,{className:Ol.folderButton,onClick:()=>{const e=null!=u?u:"folders";ve(e),k.setFieldsValue({folderName:ce,targetFolder:e})},loading:se,children:[e(Ni,{size:18,strokeWidth:null==ne?void 0:ne.iconStrokeWidth}),Q("Create folder")]}),e(M,{type:"primary",className:Ol.folderButton,onClick:A,loading:se,children:Q("Done")})]}),afterClose:()=>{re&&re(""),ve(""),le(!1)},loading:se,children:t("div",{className:Ol.modalContentWithLoader,children:[se&&e("div",{className:Ol.modalLoaderOverlay,children:e(Fl,{})}),e(I,{form:k,layout:"vertical",initialValues:{targetFolder:"folders",folderName:ce,is_force_create:!1},children:t("div",{className:Ol.foldersWrapper,children:[e(I.Item,{name:"targetFolder",rules:[{required:!0,message:Q("Select the destination folder")}],className:Ol.formItem,children:e(Tl,{onSelect:xe,generateMenuItems:()=>ye({targetForm:k,onTreeSelect:xe,onComplete:_e,actionButtonText:Q("Move here")}),fetchChildFolders:Y,disabledFolders:Ae,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(I.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Q("Enter the name of the folder"))):Promise.resolve()}],children:e(T,{})}),e(I.Item,{name:"is_force_create",style:{display:"none"},children:e(T,{})})]})})]})}),e(q,{title:e("div",{className:"modal-title",children:Q("Copy to folder")}),open:N,onCancel:D,footer:t("div",{className:Ol.formFooter,children:[t(M,{className:Ol.folderButton,onClick:()=>{const e=null!=u?u:"folders";ve(e),z.setFieldsValue({folderName:ce,targetFolder:e})},loading:se,children:[e(Ni,{size:18,strokeWidth:null==ne?void 0:ne.iconStrokeWidth}),Q("Create folder")]}),e(M,{type:"primary",className:Ol.folderButton,onClick:D,loading:se,children:Q("Done")})]}),afterClose:()=>{re&&re(""),ve(""),le(!1)},loading:se,children:t("div",{className:Ol.modalContentWithLoader,children:[se&&e("div",{className:Ol.modalLoaderOverlay,children:e(Fl,{})}),e(I,{form:z,layout:"vertical",initialValues:{targetFolder:"folders",folderName:ce,is_force_create:!1},children:t("div",{className:Ol.foldersWrapper,children:[e(I.Item,{name:"targetFolder",rules:[{required:!0,message:Q("Select the destination folder")}],className:Ol.formItem,children:e(Tl,{onSelect:Ce,generateMenuItems:()=>ye({targetForm:z,onTreeSelect:Ce,onComplete:Se,actionButtonText:Q("Copy here")}),fetchChildFolders:Y,disabledFolders:Ae,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(I.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(Q("Enter the name of the folder"))):Promise.resolve()}],children:e(T,{})}),e(I.Item,{name:"is_force_create",style:{display:"none"},children:e(T,{})})]})})]})}),e(q,{title:t("div",{className:"modal-title",children:[Q("Rename folder")," ",pe]}),open:F,onOk:O,onCancel:P,okText:Q("Rename"),cancelText:Q("Cancel"),okButtonProps:{loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},children:e(I,{form:R,layout:"vertical",children:e(I.Item,{name:"newFolderName",label:e("div",{className:"form-label",children:Q("New folder name")}),rules:[{required:!0,message:Q("Enter a new folder name")}],className:"form-item",children:e(T,{autoFocus:!0,className:"form-input",disabled:se,onPressEnter:async()=>{le(!0);try{await R.validateFields(),O()}catch(e){le(!1)}}})})})}),e(q,{className:`${Ol.deleteModal} deleteModal`,title:(()=>{const t=!!(null==ne?void 0:ne.enableTrashFolder)&&"Trash"===u||!(null==ne?void 0:ne.enableTrashFolder),r=Q(t?"Permanently delete":"Move to Trash");return e("div",{className:"modal-title",children:r})})(),open:!!B,onOk:()=>{le(!0);try{U&&U()}catch(e){console.error(e),le(!1)}},onCancel:()=>V&&V(),okText:(null==ne?void 0:ne.enableTrashFolder)&&"Trash"===u?Q("Delete permanently"):(null==ne?void 0:ne.enableTrashFolder)?Q("Move to Trash"):Q("Delete"),cancelText:Q("Cancel"),okButtonProps:{danger:!(null==ne?void 0:ne.enableTrashFolder)||"Trash"===u,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},closeIcon:e(me,{className:Ol.closeIcon}),children:(()=>{var r,n;const i=(ie?[ie]:Array.from(E||[])).map(e=>de.find(t=>t.id===e)).filter(e=>!!e),o=i.filter(e=>e.isFolder||e.id.startsWith("folder_")),a=i.filter(e=>!(e.isFolder||e.id.startsWith("folder_"))),s=i.length,l=o.length,c=a.length,d=!!(null==ne?void 0:ne.enableTrashFolder);if(!d||d&&"Trash"===u){let n;if(1===s&&1===l){const e=o[0],t=(null==e?void 0:e.name)||"",i=null!==(r=null==e?void 0:e.childCount)&&void 0!==r?r:0;n=Q("delete_folder_permanent",{name:t,count:i})}else n=0===l&&c>0?Q("delete_files_permanent",{count:c}):Q("delete_mixed_permanent",{total:s,folders:l,images:c});return t("div",{children:[e("div",{children:n}),e("p",{className:Ol.permanentDeleteWarning,children:Q("permanent_delete_warning")})]})}if(1===s&&1===l){const t=o[0],r=(null==t?void 0:t.name)||"",i=null!==(n=null==t?void 0:t.childCount)&&void 0!==n?n:0;return e("div",{children:Q("move_folder_to_trash",{name:r,count:i})})}return e("div",0===l&&c>0?{children:Q("move_files_to_trash",{count:c})}:{children:Q("move_mixed_to_trash",{total:s,folders:l,images:c})})})()}),t(q,{className:`${Ol.deleteModal} deleteModal`,title:e("div",{className:"modal-title",children:Q("Clear Trash")}),open:!!H,onOk:async()=>{le(!0),W&&await W(),le(!1)},onCancel:()=>$&&$(),okText:Q("Delete permanently"),cancelText:Q("Cancel"),okButtonProps:{danger:!0,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1)},closeIcon:e(me,{className:Ol.closeIcon}),children:[e("div",{children:Q("Are you sure you want to permanently delete all items from Trash?")}),se&&t("div",{className:Ol.clearTrashProgress,children:[e(G,{percent:99,status:"active",showInfo:!1}),e("div",{className:Ol.progressText,children:Q("Deleting items...")})]})]})]})};var Nl={button:"button",folderActions:"folderActions",uploadButton:"uploadButton",foldersContainer:"foldersContainer",buttonWrapper:"buttonWrapper",uploadButtonTitle:"uploadButtonTitle"};const jl=f(p(({selectedFolder:r,generateMenuItems:n,onFolderSelect:i,folders:s,fetchChildFolders:l,handleAddFile:h,setIsUrlModalVisible:f,handleCreateFolder:p,activeLibraryItem:m,setActiveLibraryItem:v},y)=>{var b,w,x,C;const _=d(()=>Array.isArray(s)?s:[],[s]),{t:S}=ri(),A=Yo(),[k,E]=o({}),{options:I,state:T}=Oo(),{dataProviders:F,config:O}=I,P=T.pathHistory,R=!1!==(null===(b=null==O?void 0:O.features)||void 0===b?void 0:b.enableGif)&&(!(null==O?void 0:O.enabledTabs)||O.enabledTabs.includes("gif")),L=!1!==(null===(w=null==O?void 0:O.features)||void 0===w?void 0:w.enableStockImages)&&(!(null==O?void 0:O.enabledTabs)||O.enabledTabs.includes("stock")),N=!1!==(null===(x=null==O?void 0:O.features)||void 0===x?void 0:x.enableIconStock)&&(!(null==O?void 0:O.enabledTabs)||O.enabledTabs.includes("icons")),j=!1!==(null===(C=null==O?void 0:O.features)||void 0===C?void 0:C.enableQrBarcodeTab)&&(!(null==O?void 0:O.enabledTabs)||O.enabledTabs.includes("codes")),D=c(e=>{const t=[],r=e=>{e.forEach(e=>{t.push(e.key),e.children&&r(e.children)})};return r(e),t},[]),[z,B]=o(()=>{if(!0===(null==O?void 0:O.expandAllFoldersOnInit)&&"lazy"!==(null==O?void 0:O.folderTreeLoading)){const e=n();return D(e)}return!0===(null==O?void 0:O.expandRootFolderOnInit)?["folders"]:[]}),U=u(!1),V=u(!1);a(()=>{if(U.current)return;"lazy"===(null==O?void 0:O.folderTreeLoading)&&!0===(null==O?void 0:O.expandRootFolderOnInit)&&(U.current=!0,(async()=>{try{await(null==l?void 0:l(null))}catch(e){console.warn("Could not load the root child folders during initialization",e)}})())},[null==O?void 0:O.folderTreeLoading,null==O?void 0:O.expandRootFolderOnInit,l]),a(()=>{!0===(null==O?void 0:O.expandRootFolderOnInit)&&Array.isArray(_)&&_.length>0&&(V.current||z&&0!==z.length||(V.current=!0,B(["folders"])))},[null==O?void 0:O.expandRootFolderOnInit,_,z]),a(()=>{if(!0===(null==O?void 0:O.expandAllFoldersOnInit)&&"lazy"!==(null==O?void 0:O.folderTreeLoading)){const e=n(),t=D(e);return void B(t)}!0===(null==O?void 0:O.expandRootFolderOnInit)&&B(e=>e&&e.length>0?[...e]:["folders"])},[_,n,D,null==O?void 0:O.expandAllFoldersOnInit,null==O?void 0:O.folderTreeLoading,null==O?void 0:O.expandRootFolderOnInit]);const H=null==O?void 0:O.disablePagination,W=c(async e=>{var t,r,n,i;try{if(null==F?void 0:F.getChildrenCount)return await F.getChildrenCount("folders"===e?void 0:e);if(null==F?void 0:F.getFiles){const{files:r,pagination:n}=await F.getFiles({folderId:"folders"===e?void 0:e,itemType:"all",page:H?void 0:1,limit:H?void 0:1});return H?Array.isArray(r)?r.length:0:null!==(t=null==n?void 0:n.total)&&void 0!==t?t:Array.isArray(r)?r.length:0}return 0}catch(t){if("StaleLoad"===(null==t?void 0:t.name))return 0;const o=t;if(404===(null==o?void 0:o.status)||"FileNotFound"===(null==o?void 0:o.code)||"path_folder_not_found"===(null==o?void 0:o.code)||"path_folder_not_found"===(null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.code)||404===(null===(i=null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.data)||void 0===i?void 0:i.status))return 0;console.error(`Error getting the number of files for the folder ${e}:`,t);const a=await os({folderId:e,dataProviders:F,folders:_,pathHistory:P,t:S});return A.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:S("Failed to load folder items count in folder",{folderName:a}),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{folderId:"folders"===e?null:e,folderName:a,reason:t instanceof Error?t.message:String(t)}}),null}},[F,H,A,P,_,S]),$=c(async()=>{if(0===_.length)return;const e={};e.folders=await W("folders");const t=_.map(async t=>{"number"!=typeof t.childCount?e[t.id]=await W(t.id):e[t.id]=t.childCount});await Promise.all(t),E(e)},[_,W]),q=c(async e=>{const t=await W(e);E(r=>Object.assign(Object.assign({},r),{[e]:t}))},[W]);g(y,()=>({refreshFileCounts:$}),[$]),a(()=>{$()},[$]),a(()=>{if(!r||"folders"===r)return;const e=(t,r=new Set)=>{if(r.has(t))return console.warn(`Cycle detected in the path to the folder with id=${t}`),[];const n=_.find(e=>e.id===t);if(!n)return[];if(!n.parentId)return[];const i=new Set(r);i.add(t);return[...e(n.parentId,i),n.parentId]},t=e(r);t.length>0?B(e=>{const r=new Set(e);return t.forEach(e=>r.add(e)),r.add("folders"),Array.from(r)}):B(e=>e.includes("folders")?e:[...e,"folders"])},[r,_]);const G=c(async()=>{await h(),r?await q(r):await q("folders")},[h,r,q]),K=[{key:Jt,label:S("My files"),icon:e(zi,{size:20,strokeWidth:null==O?void 0:O.iconStrokeWidth})},{key:er,label:S("GIF"),icon:e(Vi,{size:20,strokeWidth:null==O?void 0:O.iconStrokeWidth}),disabled:!R},{key:tr,label:S("Stock images"),icon:e(Fi,{size:20,strokeWidth:null==O?void 0:O.iconStrokeWidth}),disabled:!L},{key:rr,label:S("Icons"),icon:e(ve,{size:20}),disabled:!N},{key:ir,label:S("QR & Barcode"),icon:e(Wi,{size:20,strokeWidth:null==O?void 0:O.iconStrokeWidth}),disabled:!j},{key:nr,label:S("AI"),icon:e(Yi,{size:20,strokeWidth:null==O?void 0:O.iconStrokeWidth}),disabled:!(null==O?void 0:O.sseQuery)}].filter(e=>!e.disabled),Z=c(async e=>{const t=e[0];t&&"empty"!==t&&(m!==Jt&&v(Jt),null==i||i(t),await(null==l?void 0:l(t)))},[i,m,v,l]),Q=c(({key:e})=>{v(e)},[v]),J=c(async(e,t)=>{var r;B(e);if(!("lazy"===(null==O?void 0:O.folderTreeLoading)))return;const n=(null===(r=null==t?void 0:t.node)||void 0===r?void 0:r.key)||void 0;if(n&&"folders"!==n)try{await(null==l?void 0:l(n))}catch(e){console.warn("Could not load the child folders for",n,e);const t=await os({folderId:n,dataProviders:F,folders:_,pathHistory:P,t:S});A.error({id:"FOLDER_CHILDREN_FETCH_FAILED",message:S("Failed to load subfolders in folder",{folderName:t}),placement:"bottomRight",innerException:e,notificationDedupe:!0,data:{folderId:n,folderName:t,reason:e instanceof Error?e.message:String(e)}})}},[null==O?void 0:O.folderTreeLoading,F,l,A,P,_,S]);return t("div",{className:"sidebar-container",children:[t("div",{className:Nl.buttonWrapper,children:[e(M,{type:"primary",size:"large",icon:e(Hi,{size:24,strokeWidth:null==O?void 0:O.iconStrokeWidth}),onClick:G,className:Nl.uploadButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===r,children:e("span",{className:Nl.uploadButtonTitle,children:S("Upload file")})}),e(M,{type:"primary",size:"large",icon:e(Bi,{size:24,strokeWidth:null==O?void 0:O.iconStrokeWidth}),onClick:()=>null==f?void 0:f(!0),className:Nl.uploadByURLButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===r})]}),e(Y,{className:"folder-menu",items:K,defaultSelectedKeys:[Jt],onSelect:({key:e})=>Q({key:e}),selectedKeys:[m]}),e(X,{className:Nl.divider}),t("div",{className:Nl.foldersContainer,children:[e(Tl,{selectedFolder:r,onSelect:Z,onExpand:J,generateMenuItems:n,fetchChildFolders:l,showFileCounts:!0,folderFileCounts:k,expandedKeys:z,setExpandedKeys:B,showTrashFolder:null==O?void 0:O.enableTrashFolder}),e("div",{className:Nl.folderActions,children:e(M,{onClick:e=>{e.stopPropagation(),p()},className:Nl.button,icon:e(Ni,{size:18,strokeWidth:null==O?void 0:O.iconStrokeWidth}),size:"middle"})})]})]})}));jl.displayName="FolderSidebar";var Dl=Object.defineProperty,zl=(e,t,r)=>(((e,t,r)=>{t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);function Bl(e,t){return void 0===t&&(t=15),+parseFloat(Number(e).toPrecision(t))}function Ul(e){var t=e.toString().split(/[eE]/),r=(t[0].split(".")[1]||"").length-+(t[1]||0);return r>0?r:0}function Vl(e){if(-1===e.toString().indexOf("e"))return Number(e.toString().replace(".",""));var t=Ul(e);return t>0?Bl(Number(e)*Math.pow(10,t)):Number(e)}function Hl(e){Xl&&(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 Wl(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t[0];return t.slice(1).reduce(function(t,r){return e(t,r)},n)}}var $l=Wl(function(e,t){var r=Vl(e),n=Vl(t),i=Ul(e)+Ul(t),o=r*n;return Hl(o),o/Math.pow(10,i)}),ql=Wl(function(e,t){var r=Math.pow(10,Math.max(Ul(e),Ul(t)));return($l(e,r)+$l(t,r))/r}),Gl=Wl(function(e,t){var r=Math.pow(10,Math.max(Ul(e),Ul(t)));return($l(e,r)-$l(t,r))/r}),Yl=Wl(function(e,t){var r=Vl(e),n=Vl(t);return Hl(r),Hl(n),$l(r/n,Bl(Math.pow(10,Ul(t)-Ul(e))))});var Xl=!0;var Kl={strip:Bl,plus:ql,minus:Gl,times:$l,divide:Yl,round:function(e,t){var r=Math.pow(10,t),n=Yl(Math.round(Math.abs($l(e,r))),r);return e<0&&0!==n&&(n=$l(n,-1)),n},digitLength:Ul,float2Fixed:Vl,enableBoundaryChecking:function(e){void 0===e&&(e=!0),Xl=e}};const Zl=Object.prototype.toString;function Ql(e){switch(Zl.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return lc(e,Error)}}function Jl(e,t){return Zl.call(e)===`[object ${t}]`}function ec(e){return Jl(e,"ErrorEvent")}function tc(e){return Jl(e,"DOMError")}function rc(e){return Jl(e,"String")}function nc(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function ic(e){return null===e||nc(e)||"object"!=typeof e&&"function"!=typeof e}function oc(e){return Jl(e,"Object")}function ac(e){return typeof Event<"u"&&lc(e,Event)}function sc(e){return!(!e||!e.then||"function"!=typeof e.then)}function lc(e,t){try{return e instanceof t}catch{return!1}}function cc(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}function uc(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function dc(e,t){if(!Array.isArray(e))return"";const r=[];for(let t=0;t<e.length;t++){const n=e[t];try{cc(n)?r.push("[VueViewModel]"):r.push(String(n))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function hc(e,t,r=!1){return!!rc(e)&&(function(e){return Jl(e,"RegExp")}(t)?t.test(e):!!rc(t)&&(r?e===t:e.includes(t)))}function fc(e,t=[],r=!1){return t.some(t=>hc(e,t,r))}function pc(e,t,r=250,n,i,o,a){if(!(o.exception&&o.exception.values&&a&&lc(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=uc(e.value,t)),e))}(gc(e,t,i,a.originalException,n,o.exception.values,s,0),r))}function gc(e,t,r,n,i,o,a,s){if(o.length>=r+1)return o;let l=[...o];if(lc(n[i],Error)){mc(a,s);const o=e(t,n[i]),c=l.length;vc(o,i,c,s),l=gc(e,t,r,n[i],i,[o,...l],o,c)}return Array.isArray(n.errors)&&n.errors.forEach((n,o)=>{if(lc(n,Error)){mc(a,s);const c=e(t,n),u=l.length;vc(c,`errors[${o}]`,u,s),l=gc(e,t,r,n,i,[c,...l],c,u)}}),l}function mc(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 vc(e,t,r,n){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:n}}function yc(e){return e&&e.Math==Math?e:void 0}const bc="object"==typeof globalThis&&yc(globalThis)||"object"==typeof window&&yc(window)||"object"==typeof self&&yc(self)||"object"==typeof global&&yc(global)||function(){return this}()||{};function wc(){return bc}function xc(e,t,r){const n=r||bc,i=n.__SENTRY__=n.__SENTRY__||{};return i[e]||(i[e]=t())}const Cc=wc();function _c(e,t={}){if(!e)return"<unknown>";try{let r=e;const n=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(;r&&o++<n&&(c=Sc(r,u),!("html"===c||o>1&&a+i.length*l+c.length>=d));)i.push(c),a+=c.length,r=r.parentNode;return i.reverse().join(s)}catch{return"<unknown>"}}function Sc(e,t){const r=e,n=[];let i,o,a,s,l;if(!r||!r.tagName)return"";if(Cc.HTMLElement&&r instanceof HTMLElement&&r.dataset&&r.dataset.sentryComponent)return r.dataset.sentryComponent;n.push(r.tagName.toLowerCase());const c=t&&t.length?t.filter(e=>r.getAttribute(e)).map(e=>[e,r.getAttribute(e)]):null;if(c&&c.length)c.forEach(e=>{n.push(`[${e[0]}="${e[1]}"]`)});else if(r.id&&n.push(`#${r.id}`),i=r.className,i&&rc(i))for(o=i.split(/\s+/),l=0;l<o.length;l++)n.push(`.${o[l]}`);const u=["aria-label","type","name","title","alt"];for(l=0;l<u.length;l++)a=u[l],s=r.getAttribute(a),s&&n.push(`[${a}="${s}"]`);return n.join("")}const Ac=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,kc=["debug","info","warn","error","log","assert","trace"],Ec={};function Ic(e){if(!("console"in bc))return e();const t=bc.console,r={},n=Object.keys(Ec);n.forEach(e=>{const n=Ec[e];r[e]=t[e],t[e]=n});try{return e()}finally{n.forEach(e=>{t[e]=r[e]})}}const Tc=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return Ac?kc.forEach(r=>{t[r]=(...t)=>{e&&Ic(()=>{bc.console[r](`Sentry Logger [${r}]:`,...t)})}}):kc.forEach(e=>{t[e]=()=>{}}),t}(),Fc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Oc(e,t=!1){const{host:r,path:n,pass:i,port:o,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${a}`}function Pc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Mc(e){const t="string"==typeof e?function(e){const t=Fc.exec(e);if(!t)return void Ic(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});const[r,n,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 Pc({host:o,pass:i,path:l,projectId:c,port:a,protocol:r,publicKey:n})}(e):Pc(e);if(t&&function(e){if(!Ac)return!0;const{port:t,projectId:r,protocol:n}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(Tc.error(`Invalid Sentry Dsn: ${t} missing`),!0))||(r.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(n)?t&&isNaN(parseInt(t,10))&&(Tc.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Tc.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),1):(Tc.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),1)))}(t))return t}class Rc 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 Lc(e,t,r){if(!(t in e))return;const n=e[t],i=r(n);"function"==typeof i&&jc(i,n),e[t]=i}function Nc(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{Ac&&Tc.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function jc(e,t){try{const r=t.prototype||{};e.prototype=t.prototype=r,Nc(e,"__sentry_original__",t)}catch{}}function Dc(e){return e.__sentry_original__}function zc(e){if(Ql(e))return{message:e.message,name:e.name,stack:e.stack,...Uc(e)};if(ac(e)){const t={type:e.type,target:Bc(e.target),currentTarget:Bc(e.currentTarget),...Uc(e)};return typeof CustomEvent<"u"&&lc(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Bc(e){try{return function(e){return typeof Element<"u"&&lc(e,Element)}(e)?_c(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Uc(e){if("object"==typeof e&&null!==e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}return{}}function Vc(e){return Hc(e,new Map)}function Hc(e,t){if(function(e){if(!oc(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch{return!0}}(e)){const r=t.get(e);if(void 0!==r)return r;const n={};t.set(e,n);for(const r of Object.keys(e))typeof e[r]<"u"&&(n[r]=Hc(e[r],t));return n}if(Array.isArray(e)){const r=t.get(e);if(void 0!==r)return r;const n=[];return t.set(e,n),e.forEach(e=>{n.push(Hc(e,t))}),n}return e}const Wc=/\(error: (.*)\)/,$c=/captureMessage|captureException/;function qc(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,r=0)=>{const n=[],i=e.split("\n");for(let e=r;e<i.length;e++){const r=i[e];if(r.length>1024)continue;const o=Wc.test(r)?r.replace(Wc,"$1"):r;if(!o.match(/\S*Error: /)){for(const e of t){const t=e(o);if(t){n.push(t);break}}if(n.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(),$c.test(t[t.length-1].function||"")&&(t.pop(),$c.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||"?"}))}(n)}}function Gc(e){return Array.isArray(e)?qc(...e):e}const Yc="<anonymous>";function Xc(e){try{return e&&"function"==typeof e&&e.name||Yc}catch{return Yc}}const Kc={},Zc={};function Qc(e,t){Kc[e]=Kc[e]||[],Kc[e].push(t)}function Jc(e,t){Zc[e]||(t(),Zc[e]=!0)}function eu(e,t){const r=e&&Kc[e];if(r)for(const n of r)try{n(t)}catch(t){Ac&&Tc.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Xc(n)}\nError:`,t)}}function tu(){"console"in bc&&kc.forEach(function(e){e in bc.console&&Lc(bc.console,e,function(t){return Ec[e]=t,function(...t){eu("console",{args:t,level:e});const r=Ec[e];r&&r.apply(bc.console,t)}})})}function ru(){const e=bc,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,e=>(e^(15&r())>>e/4).toString(16))}function nu(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function iu(e){const{message:t,event_id:r}=e;if(t)return t;const n=nu(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function ou(e,t,r){const n=e.exception=e.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type="Error")}function au(e,t){const r=nu(e);if(!r)return;const n=r.mechanism;if(r.mechanism={type:"generic",handled:!0,...n,...t},t&&"data"in t){const e={...n&&n.data,...t.data};r.mechanism.data=e}}function su(e){if(e&&e.__sentry_captured__)return!0;try{Nc(e,"__sentry_captured__",!0)}catch{}return!1}function lu(e){return Array.isArray(e)?e:[e]}const cu=bc;let uu,du,hu;function fu(){if(!cu.document)return;const e=eu.bind(null,"dom"),t=pu(e,!0);cu.document.addEventListener("click",t,!1),cu.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const r=cu[t]&&cu[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Lc(r,"addEventListener",function(t){return function(r,n,i){if("click"===r||"keypress"==r)try{const n=this,o=n.__sentry_instrumentation_handlers__=n.__sentry_instrumentation_handlers__||{},a=o[r]=o[r]||{refCount:0};if(!a.handler){const n=pu(e);a.handler=n,t.call(this,r,n,i)}a.refCount++}catch{}return t.call(this,r,n,i)}}),Lc(r,"removeEventListener",function(e){return function(t,r,n){if("click"===t||"keypress"==t)try{const r=this,i=r.__sentry_instrumentation_handlers__||{},o=i[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,n),o.handler=void 0,delete i[t]),0===Object.keys(i).length&&delete r.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,r,n)}}))})}function pu(e,t=!1){return r=>{if(!r||r._sentryCaptured)return;const n=function(e){try{return e.target}catch{return null}}(r);if(function(e,t){return!("keypress"!==e||t&&t.tagName&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))}(r.type,n))return;Nc(r,"_sentryCaptured",!0),n&&!n._sentryId&&Nc(n,"_sentryId",ru());const i="keypress"===r.type?"input":r.type;(function(e){if(e.type!==du)return!1;try{if(!e.target||e.target._sentryId!==hu)return!1}catch{}return!0})(r)||(e({event:r,name:i,global:t}),du=r.type,hu=n?n._sentryId:void 0),clearTimeout(uu),uu=cu.setTimeout(()=>{hu=void 0,du=void 0},1e3)}}const gu=wc();function mu(){if(!("fetch"in gu))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function vu(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function yu(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!mu())return!1;if(vu(gu.fetch))return!0;let e=!1;const t=gu.document;if(t&&"function"==typeof t.createElement)try{const r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(e=vu(r.contentWindow.fetch)),t.head.removeChild(r)}catch(e){Ac&&Tc.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e})()&&Lc(bc,"fetch",function(e){return function(...t){const{method:r,url:n}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,r]=e;return{url:wu(t),method:bu(r,"method")?String(r.method).toUpperCase():"GET"}}const t=e[0];return{url:wu(t),method:bu(t,"method")?String(t.method).toUpperCase():"GET"}}(t),i={args:t,fetchData:{method:r,url:n},startTimestamp:Date.now()};return eu("fetch",{...i}),e.apply(bc,t).then(e=>(eu("fetch",{...i,endTimestamp:Date.now(),response:e}),e),e=>{throw eu("fetch",{...i,endTimestamp:Date.now(),error:e}),e})}})}function bu(e,t){return!!e&&"object"==typeof e&&!!e[t]}function wu(e){return"string"==typeof e?e:e?bu(e,"url")?e.url:e.toString?e.toString():"":""}let xu=null;function Cu(){xu=bc.onerror,bc.onerror=function(e,t,r,n,i){return eu("error",{column:n,error:i,line:r,msg:e,url:t}),!(!xu||xu.__SENTRY_LOADER__)&&xu.apply(this,arguments)},bc.onerror.__SENTRY_INSTRUMENTED__=!0}let _u=null;function Su(){_u=bc.onunhandledrejection,bc.onunhandledrejection=function(e){return eu("unhandledrejection",e),!(_u&&!_u.__SENTRY_LOADER__)||_u.apply(this,arguments)},bc.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Au=wc();const ku=bc;let Eu;function Iu(e){const t="history";Qc(t,e),Jc(t,Tu)}function Tu(){if(!function(){const e=Au.chrome,t=e&&e.app&&e.app.runtime,r="history"in Au&&!!Au.history.pushState&&!!Au.history.replaceState;return!t&&r}())return;const e=ku.onpopstate;function t(e){return function(...t){const r=t.length>2?t[2]:void 0;if(r){const e=Eu,t=String(r);Eu=t,eu("history",{from:e,to:t})}return e.apply(this,t)}}ku.onpopstate=function(...t){const r=ku.location.href,n=Eu;if(Eu=r,eu("history",{from:n,to:r}),e)try{return e.apply(this,t)}catch{}},Lc(ku.history,"pushState",t),Lc(ku.history,"replaceState",t)}const Fu=bc,Ou="__sentry_xhr_v3__";function Pu(){if(!Fu.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;Lc(e,"open",function(e){return function(...t){const r=Date.now(),n=rc(t[0])?t[0].toUpperCase():void 0,i=function(e){if(rc(e))return e;try{return e.toString()}catch{}}(t[1]);if(!n||!i)return e.apply(this,t);this[Ou]={method:n,url:i,request_headers:{}},"POST"===n&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const e=this[Ou];if(e&&4===this.readyState){try{e.status_code=this.status}catch{}eu("xhr",{args:[n,i],endTimestamp:Date.now(),startTimestamp:r,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?Lc(this,"onreadystatechange",function(e){return function(...t){return o(),e.apply(this,t)}}):this.addEventListener("readystatechange",o),Lc(this,"setRequestHeader",function(e){return function(...t){const[r,n]=t,i=this[Ou];return i&&rc(r)&&rc(n)&&(i.request_headers[r.toLowerCase()]=n),e.apply(this,t)}}),e.apply(this,t)}}),Lc(e,"send",function(e){return function(...t){const r=this[Ou];if(!r)return e.apply(this,t);void 0!==t[0]&&(r.body=t[0]);return eu("xhr",{args:[r.method,r.url],startTimestamp:Date.now(),xhr:this}),e.apply(this,t)}})}function Mu(e,t=100,r=1/0){try{return Lu("",e,t,r)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Ru(e,t=3,r=102400){const n=Mu(e,t);return function(e){return function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(e))}(n)>r?Ru(e,t-1,r):n}function Lu(e,t,r=1/0,n=1/0,i=function(){const e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(r){if(e)return!!t.has(r)||(t.add(r),!1);for(let e=0;e<t.length;e++)if(t[e]===r)return!0;return t.push(r),!1},function(r){if(e)t.delete(r);else for(let e=0;e<t.length;e++)if(t[e]===r){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(cc(t))return"[VueViewModel]";if(function(e){return oc(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: ${Xc(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}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__:r;if(0===l)return s.replace("object ","");if(o(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return Lu("",c.toJSON(),l-1,n,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=zc(t);for(const e in h){if(!Object.prototype.hasOwnProperty.call(h,e))continue;if(d>=n){u[e]="[MaxProperties ~]";break}const t=h[e];u[e]=Lu(e,t,l-1,n,i),d++}return a(t),u}var Nu;function ju(e){return new zu(t=>{t(e)})}function Du(e){return new zu((t,r)=>{r(e)})}!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(Nu||(Nu={}));class zu{constructor(e){zu.prototype.__init.call(this),zu.prototype.__init2.call(this),zu.prototype.__init3.call(this),zu.prototype.__init4.call(this),this._state=Nu.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new zu((r,n)=>{this._handlers.push([!1,t=>{if(e)try{r(e(t))}catch(e){n(e)}else r(t)},e=>{if(t)try{r(t(e))}catch(e){n(e)}else n(e)}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(e){return new zu((t,r)=>{let n,i;return this.then(t=>{i=!1,n=t,e&&e()},t=>{i=!0,n=t,e&&e()}).then(()=>{i?r(n):t(n)})})}__init(){this._resolve=e=>{this._setResult(Nu.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Nu.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===Nu.PENDING){if(sc(t))return void t.then(this._resolve,this._reject);this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Nu.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||(this._state===Nu.RESOLVED&&e[1](this._value),this._state===Nu.REJECTED&&e[2](this._value),e[0]=!0)})}}}function Bu(e){const t=[];function r(e){return t.splice(t.indexOf(e),1)[0]}return{$:t,add:function(n){if(!(void 0===e||t.length<e))return Du(new Rc("Not adding Promise because buffer limit was reached."));const i=n();return-1===t.indexOf(i)&&t.push(i),i.then(()=>r(i)).then(null,()=>r(i).then(null,()=>{})),i},drain:function(e){return new zu((r,n)=>{let i=t.length;if(!i)return r(!0);const o=setTimeout(()=>{e&&e>0&&r(!1)},e);t.forEach(e=>{ju(e).then(()=>{--i||(clearTimeout(o),r(!0))},n)})})}}}function Uu(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const r=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:n,relative:t[5]+r+n}}const Vu=["fatal","error","warning","log","info","debug"];function Hu(e){return"warn"===e?"warning":Vu.includes(e)?e:"log"}function Wu(){return Date.now()/1e3}const $u=function(){const{performance:e}=bc;if(!e||!e.now)return Wu;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/1e3}();function qu(e,t=[]){return[e,t]}function Gu(e,t){const[r,n]=e;return[r,[...n,t]]}function Yu(e,t){const r=e[1];for(const e of r){if(t(e,e[0].type))return!0}return!1}function Xu(e,t){return(t||new TextEncoder).encode(e)}function Ku(e,t){const[r,n]=e;let i=JSON.stringify(r);function o(e){"string"==typeof i?i="string"==typeof e?i+e:[Xu(i,t),e]:i.push("string"==typeof e?Xu(e,t):e)}for(const e of n){const[t,r]=e;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof r||r instanceof Uint8Array)o(r);else{let e;try{e=JSON.stringify(r)}catch{e=JSON.stringify(Mu(r))}o(e)}}return"string"==typeof i?i:function(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(i)}function Zu(e,t){const r="string"==typeof e.data?Xu(e.data,t):e.data;return[Vc({type:"attachment",length:r.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),r]}(()=>{const{performance:e}=bc;if(!e||!e.now)return;const t=36e5,r=e.now(),n=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,o=i<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+r-n):t;(o||s<t)&&(i<=s&&e.timeOrigin)})();const Qu={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 Ju(e){return Qu[e]}function ed(e){if(!e||!e.sdk)return;const{name:t,version:r}=e.sdk;return{name:t,version:r}}function td(e,{statusCode:t,headers:r},n=Date.now()){const i={...e},o=r&&r["x-sentry-rate-limits"],a=r&&r["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,r,,,o]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(r)for(const e of r.split(";"))"metric_bucket"===e?(!o||o.split(";").includes("custom"))&&(i[e]=n+s):i[e]=n+s;else i.all=n+s}else a?i.all=n+function(e,t=Date.now()){const r=parseInt(`${e}`,10);if(!isNaN(r))return 1e3*r;const n=Date.parse(`${e}`);return isNaN(n)?6e4:n-t}(a,n):429===t&&(i.all=n+6e4);return i}const rd=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nd="production";function id(){return xc("globalEventProcessors",()=>[])}function od(e){id().push(e)}function ad(e,t,r,n=0){return new zu((i,o)=>{const a=e[n];if(null===t||"function"!=typeof a)i(t);else{const s=a({...t},r);rd&&a.id&&null===s&&Tc.log(`Event processor "${a.id}" dropped event`),sc(s)?s.then(t=>ad(e,t,r,n+1).then(i)).then(null,o):ad(e,s,r,n+1).then(i).then(null,o)}})}function sd(e){const t=$u(),r={sid:ru(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return Vc({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}})}(r)};return e&&ld(r,e),r}function ld(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||$u(),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:ru()),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 cd(e,t){let r={};"ok"===e.status&&(r={status:"exited"}),ld(e,r)}function ud(e){const{spanId:t,traceId:r}=e.spanContext(),{data:n,op:i,parent_span_id:o,status:a,tags:s,origin:l}=dd(e);return Vc({data:n,op:i,parent_span_id:o,span_id:t,status:a,tags:s,trace_id:r,origin:l})}function dd(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}function hd(e,t,r,n,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||r.event_id||ru(),timestamp:t.timestamp||Wu()},c=r.integrations||e.integrations.map(e=>e.name);(function(e,t){const{environment:r,release:n,dist:i,maxValueLength:o=250}=t;"environment"in e||(e.environment="environment"in t?r:nd),void 0===e.release&&void 0!==n&&(e.release=n),void 0===e.dist&&void 0!==i&&(e.dist=i),e.message&&(e.message=uc(e.message,o));const a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=uc(a.value,o));const s=e.request;s&&s.url&&(s.url=uc(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 r=bc._sentryDebugIds;if(!r)return;let n;const i=fd.get(t);i?n=i:(n=new Map,fd.set(t,n));const o=Object.keys(r).reduce((e,i)=>{let o;const a=n.get(i);a?o=a:(o=t(i),n.set(i,o));for(let t=o.length-1;t>=0;t--){const n=o[t];if(n.filename){e[n.filename]=r[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 r=e?e.clone():new Td;return r.update(t),r}(n,r.captureContext);r.mechanism&&au(l,r.mechanism);const d=i&&i.getEventProcessors?i.getEventProcessors():[],h=(Id||(Id=new Td),Id).getScopeData();if(o){kd(h,o.getScopeData())}if(u){kd(h,u.getScopeData())}const f=[...r.attachments||[],...h.attachments];f.length&&(r.attachments=f),Ad(l,h);return ad([...d,...id(),...h.eventProcessors],l,r).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 r=e.debug_meta.images;Object.keys(t).forEach(e=>{r.push({type:"sourcemap",code_file:e,debug_id:t[e]})})}(e),"number"==typeof a&&a>0?function(e,t,r){if(!e)return null;const n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Mu(e.data,t,r)}}))},...e.user&&{user:Mu(e.user,t,r)},...e.contexts&&{contexts:Mu(e.contexts,t,r)},...e.extra&&{extra:Mu(e.extra,t,r)}};return e.contexts&&e.contexts.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=Mu(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(e=>{const n=dd(e).data;return n&&(e.data=Mu(n,t,r)),e})),n}(e,a,s):e))}const fd=new WeakMap;function pd(e,t){return jd().captureEvent(e,t)}function gd(e,t){jd().addBreadcrumb(e,t)}function md(){return jd().getClient()}function vd(){return jd().getScope()}function yd(e){const t=md(),r=Dd(),n=vd(),{release:i,environment:o=nd}=t&&t.getOptions()||{},{userAgent:a}=bc.navigator||{},s=sd({release:i,environment:o,user:n.getUser()||r.getUser(),...a&&{userAgent:a},...e}),l=r.getSession();return l&&"ok"===l.status&&ld(l,{status:"exited"}),bd(),r.setSession(s),n.setSession(s),s}function bd(){const e=Dd(),t=vd(),r=t.getSession()||e.getSession();r&&cd(r),wd(),e.setSession(),t.setSession()}function wd(){const e=Dd(),t=vd(),r=md(),n=t.getSession()||e.getSession();n&&r&&r.captureSession&&r.captureSession(n)}function xd(e=!1){e?bd():wd()}function Cd(e){return e.transaction}function _d(e,t,r){const n=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:o}=r&&r.getUser()||{},a=Vc({environment:n.environment||nd,release:n.release,user_segment:o,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",a),a}function Sd(e){const t=md();if(!t)return{};const r=_d(dd(e).trace_id||"",t,vd()),n=Cd(e);if(!n)return r;const i=n&&n._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:o,source:a}=n.metadata;null!=o&&(r.sample_rate=`${o}`);const s=dd(n);return a&&"url"!==a&&(r.transaction=s.description),r.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return!!(1&t)}(n)),t.emit&&t.emit("createDsc",r),r}function Ad(e,t){const{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=t;(function(e,t){const{extra:r,tags:n,user:i,contexts:o,level:a,transactionName:s}=t,l=Vc(r);l&&Object.keys(l).length&&(e.extra={...l,...e.extra});const c=Vc(n);c&&Object.keys(c).length&&(e.tags={...c,...e.tags});const u=Vc(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});const d=Vc(o);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),a&&(e.level=a),s&&(e.transaction=s)})(e,t),n&&function(e,t){e.contexts={trace:ud(t),...e.contexts};const r=Cd(t);if(r){e.sdkProcessingMetadata={dynamicSamplingContext:Sd(t),...e.sdkProcessingMetadata};const n=dd(r).description;n&&(e.tags={transaction:n,...e.tags})}}(e,n),function(e,t){e.fingerprint=e.fingerprint?lu(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}(e,r),function(e,t){const r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}function kd(e,t){const{extra:r,tags:n,user:i,contexts:o,level:a,sdkProcessingMetadata:s,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:h,transactionName:f,span:p}=t;Ed(e,"extra",r),Ed(e,"tags",n),Ed(e,"user",i),Ed(e,"contexts",o),Ed(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 Ed(e,t,r){if(r&&Object.keys(r).length){e[t]={...e[t]};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[t][n]=r[n])}}let Id;class Td{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Fd()}static clone(e){return e?e.clone():new Td}clone(){const e=new Td;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&&ld(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 Td){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(oc(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=Fd(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:100;if(r<=0)return this;const n={timestamp:Wu(),...e},i=this._breadcrumbs;return i.push(n),this._breadcrumbs=i.length>r?i.slice(-r):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:r,_tags:n,_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:r,tags:n,extra:i,user:o,level:a,fingerprint:s||[],eventProcessors:l,propagationContext:c,sdkProcessingMetadata:u,transactionName:d,span:h}}applyToEvent(e,t={},r=[]){Ad(e,this.getScopeData());return ad([...r,...id(),...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 r=t&&t.event_id?t.event_id:ru();if(!this._client)return Tc.warn("No client configured on scope - will not capture exception!"),r;const n=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},this),r}captureMessage(e,t,r){const n=r&&r.event_id?r.event_id:ru();if(!this._client)return Tc.warn("No client configured on scope - will not capture message!"),n;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n},this),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:ru();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(Tc.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Fd(){return{traceId:ru(),spanId:ru().substring(16)}}const Od="7.116.0",Pd=parseFloat(Od),Md=100;class Rd{constructor(e,t,r,n=Pd){let i,o;this._version=n,t?i=t:(i=new Td,i.setClient(e)),r?o=r:(o=new Td,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 r;try{r=e(t)}catch(e){throw this.popScope(),e}return sc(r)?r.then(e=>(this.popScope(),e),e=>{throw this.popScope(),e}):(this.popScope(),r)}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 r=this._lastEventId=t&&t.event_id?t.event_id:ru(),n=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:n,...t,event_id:r}),r}captureMessage(e,t,r){const n=this._lastEventId=r&&r.event_id?r.event_id:ru(),i=new Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n}),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:ru();return e.type||(this._lastEventId=r),this.getScope().captureEvent(e,{...t,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:r,client:n}=this.getStackTop();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Md}=n.getOptions&&n.getOptions()||{};if(o<=0)return;const a={timestamp:Wu(),...e},s=i?Ic(()=>i(a,t)):a;null!==s&&(n.emit&&n.emit("beforeAddBreadcrumb",s,t),r.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:r}=this.getStackTop();r&&e(t)}run(e){const t=Nd(this);try{e(this)}finally{Nd(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch{return rd&&Tc.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const r=this._callExtensionMethod("startTransaction",e,t);return rd&&!r&&(this.getClient()?Tc.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):Tc.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}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&&cd(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:r}=this.getStackTop(),{release:n,environment:i=nd}=r&&r.getOptions()||{},{userAgent:o}=bc.navigator||{},a=sd({release:n,environment:i,user:t.getUser(),...o&&{userAgent:o},...e}),s=t.getSession&&t.getSession();return s&&"ok"===s.status&&ld(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(),r=e.getSession();r&&t&&t.captureSession&&t.captureSession(r)}_callExtensionMethod(e,...t){const r=Ld().__SENTRY__;if(r&&r.extensions&&"function"==typeof r.extensions[e])return r.extensions[e].apply(this,t);rd&&Tc.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function Ld(){return bc.__SENTRY__=bc.__SENTRY__||{extensions:{},hub:void 0},bc}function Nd(e){const t=Ld(),r=zd(t);return Bd(t,e),r}function jd(){const e=Ld();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=Ld()){return(!function(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}(e)||zd(e).isOlderThan(Pd))&&Bd(e,new Rd),zd(e)}(e)}function Dd(){return jd().getIsolationScope()}function zd(e){return xc("hub",()=>new Rd,e)}function Bd(e,t){if(!e)return!1;return(e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0}function Ud(e,t,r,n){const i=ed(r),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,r&&r.sdk);const a=function(e,t,r,n){const i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!r&&n&&{dsn:Oc(n)},...i&&{trace:Vc({...i})}}}(e,i,n,t);return delete e.sdkProcessingMetadata,qu(a,[[{type:o},e]])}function Vd(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 Hd=[];function Wd(e){const t=e.defaultIntegrations||[],r=e.integrations;let n;t.forEach(e=>{e.isDefaultInstance=!0}),n=Array.isArray(r)?[...t,...r]:"function"==typeof r?lu(r(t)):t;const i=function(e){const t={};return e.forEach(e=>{const{name:r}=e,n=t[r];n&&!n.isDefaultInstance&&e.isDefaultInstance||(t[r]=e)}),Object.keys(t).map(e=>t[e])}(n),o=function(e,t){for(let r=0;r<e.length;r++)if(!0===t(e[r]))return r;return-1}(i,e=>"Debug"===e.name);if(-1!==o){const[e]=i.splice(o,1);i.push(e)}return i}function $d(e,t){for(const r of t)r&&r.afterAllSetup&&r.afterAllSetup(e)}function qd(e,t,r){if(r[t.name])rd&&Tc.log(`Integration skipped because it was already installed: ${t.name}`);else{if(r[t.name]=t,-1===Hd.indexOf(t.name)&&(t.setupOnce(od,jd),Hd.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),e.on&&"function"==typeof t.preprocessEvent){const r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,n)=>r(t,n,e))}if(e.addEventProcessor&&"function"==typeof t.processEvent){const r=t.processEvent.bind(t),n=Object.assign((t,n)=>r(t,n,e),{id:t.name});e.addEventProcessor(n)}rd&&Tc.log(`Integration installed: ${t.name}`)}}function Gd(e,t){return Object.assign(function(...e){return t(...e)},{id:e})}function Yd(e,t,r,n){const i={sent_at:(new Date).toISOString()};r&&r.sdk&&(i.sdk={name:r.sdk.name,version:r.sdk.version}),n&&t&&(i.dsn=Oc(t));const o=function(e){const t=function(e){let t="";for(const r of e){const e=Object.entries(r.tags),n=e.length>0?`|#${e.map(([e,t])=>`${e}:${t}`).join(",")}`:"";t+=`${r.name}@${r.unit}:${r.metric}|${r.metricType}${n}|T${r.timestamp}\n`}return t}(e);return[{type:"statsd",length:t.length},t]}(e);return qu(i,[o])}const Xd="Not capturing exception because it's already been captured.";class Kd{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Mc(e.dsn):rd&&Tc.warn("No DSN provided, client will not send events."),this._dsn){const t=function(e,t={}){const r="string"==typeof t?t:t.tunnel,n="string"!=typeof t&&t._metadata?t._metadata.sdk:void 0;return r||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${Vd(e,n)}`}(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,r){if(su(e))return void(rd&&Tc.log(Xd));let n=t&&t.event_id;return this._process(this.eventFromException(e,t).then(e=>this._captureEvent(e,t,r)).then(e=>{n=e})),n}captureMessage(e,t,r,n){let i=r&&r.event_id;const o=nc(e)?e:String(e),a=ic(e)?this.eventFromMessage(o,t,r):this.eventFromException(e,r);return this._process(a.then(e=>this._captureEvent(e,r,n)).then(e=>{i=e})),i}captureEvent(e,t,r){if(t&&t.originalException&&su(t.originalException))return void(rd&&Tc.log(Xd));let n=t&&t.event_id;const i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,i||r).then(e=>{n=e})),n}captureSession(e){"string"!=typeof e.release?rd&&Tc.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),ld(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(r=>t.flush(e).then(e=>r&&e))):ju(!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 rd&&Tc.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];qd(this,e,this._integrations),t||$d(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let r=Ud(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])r=Gu(r,Zu(e,this._options.transportOptions&&this._options.transportOptions.textEncoder));const n=this._sendEnvelope(r);n&&n.then(t=>this.emit("afterSendEvent",e,t),null)}sendSession(e){const t=function(e,t,r,n){const i=ed(r);return qu({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!n&&t&&{dsn:Oc(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,r){if(this._options.sendClientReports){const r=`${e}:${t}`;rd&&Tc.log(`Adding outcome: "${r}"`),this._outcomes[r]=this._outcomes[r]+1||1}}captureAggregateMetrics(e){rd&&Tc.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=Yd(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 r={};return t.forEach(t=>{t&&qd(e,t,r)}),r}(this,e),$d(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let r=!1,n=!1;const i=t.exception&&t.exception.values;if(i){n=!0;for(const e of i){const t=e.mechanism;if(t&&!1===t.handled){r=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&r)&&(ld(e,{...r&&{status:"crashed"},errors:e.errors||Number(n||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new zu(t=>{let r=0;const n=setInterval(()=>{0==this._numProcessing?(clearInterval(n),t(!0)):(r+=1,e&&r>=e&&(clearInterval(n),t(!1)))},1)})}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,r,n=Dd()){const i=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o.length>0&&(t.integrations=o),this.emit("preprocessEvent",e,t),hd(i,e,t,r,this,n).then(e=>{if(null===e)return e;const t={...n.getPropagationContext(),...r?r.getPropagationContext():void 0};if((!e.contexts||!e.contexts.trace)&&t){const{traceId:n,spanId:i,parentSpanId:o,dsc:a}=t;e.contexts={trace:{trace_id:n,span_id:i,parent_span_id:o},...e.contexts};const s=a||_d(n,this,r);e.sdkProcessingMetadata={dynamicSamplingContext:s,...e.sdkProcessingMetadata}}return e})}_captureEvent(e,t={},r){return this._processEvent(e,t,r).then(e=>e.event_id,e=>{if(rd){const t=e;"log"===t.logLevel?Tc.log(t.message):Tc.warn(t)}})}_processEvent(e,t,r){const n=this.getOptions(),{sampleRate:i}=n,o=Qd(e),a=Zd(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),Du(new Rc(`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,r,u).then(r=>{if(null===r)throw this.recordDroppedEvent("event_processor",c,e),new Rc("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return r;const i=function(e,t,r){const{beforeSend:n,beforeSendTransaction:i}=e;return Zd(t)&&n?n(t,r):Qd(t)&&i?i(t,r):t}(n,r,t);return function(e,t){const r=`${t} must return \`null\` or a valid event.`;if(sc(e))return e.then(e=>{if(!oc(e)&&null!==e)throw new Rc(r);return e},e=>{throw new Rc(`${t} rejected with ${e}`)});if(!oc(e)&&null!==e)throw new Rc(r);return e}(i,l)}).then(n=>{if(null===n)throw this.recordDroppedEvent("before_send",c,e),new Rc(`${l} returned \`null\`, will not send event.`,"log");const i=r&&r.getSession();!o&&i&&this._updateSessionFromEvent(i,n);const a=n.transaction_info;if(o&&a&&n.transaction!==e.transaction){const e="custom";n.transaction_info={...a,source:e}}return this.sendEvent(n,t),n}).then(null,e=>{throw e instanceof Rc?e:(this.captureException(e,{data:{__sentry__:!0},originalException:e}),new Rc(`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=>{rd&&Tc.error("Error while sending event:",e)});rd&&Tc.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map(t=>{const[r,n]=t.split(":");return{reason:r,category:n,quantity:e[t]}})}}function Zd(e){return void 0===e.type}function Qd(e){return"transaction"===e.type}function Jd(e,t){!0===t.debug&&(rd?Tc.enable():Ic(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),vd().update(t.initialScope);const r=new e(t);(function(e){const t=jd().getStackTop();t.client=e,t.scope.setClient(e)})(r),function(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}(r)}function eh(e,t,r=Bu(e.bufferSize||30)){let n={};function i(i){const o=[];if(Yu(i,(t,r)=>{const i=Ju(r);if(function(e,t,r=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>r}(n,i)){const n=th(t,r);e.recordDroppedEvent("ratelimit_backoff",i,n)}else o.push(t)}),0===o.length)return ju();const a=qu(i[0],o),s=t=>{Yu(a,(r,n)=>{const i=th(r,n);e.recordDroppedEvent(t,Ju(n),i)})};return r.add(()=>t({body:Ku(a,e.textEncoder)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&rd&&Tc.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),n=td(n,e),e),e=>{throw s("network_error"),e})).then(e=>e,e=>{if(e instanceof Rc)return rd&&Tc.error("Skipped sending event because buffer is full."),s("queue_overflow"),ju();throw e})}return i.__sentry__baseTransport__=!0,{send:i,flush:e=>r.drain(e)}}function th(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}function rh(e,t,r=[t],n="npm"){const i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:r.map(e=>({name:`${n}:@sentry/${e}`,version:Od})),version:Od}),e._metadata=i}const nh=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],ih=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],oh="InboundFilters",ah=(e={})=>({name:oh,setupOnce(){},processEvent(t,r,n){const i=n.getOptions(),o=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:nh],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:ih],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)?(rd&&Tc.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${iu(e)}`),!0):function(e,t){return!(e.type||!t||!t.length)&&function(e){const t=[];let r;e.message&&t.push(e.message);try{r=e.exception.values[e.exception.values.length-1]}catch{}return r&&r.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`)),rd&&0===t.length&&Tc.error(`Could not extract message for event ${iu(e)}`),t}(e).some(e=>fc(e,t))}(e,t.ignoreErrors)?(rd&&Tc.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${iu(e)}`),!0):function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const r=e.transaction;return!!r&&fc(r,t)}(e,t.ignoreTransactions)?(rd&&Tc.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${iu(e)}`),!0):function(e,t){if(!t||!t.length)return!1;const r=sh(e);return!!r&&fc(r,t)}(e,t.denyUrls)?(rd&&Tc.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${iu(e)}.\nUrl: ${sh(e)}`),!0):!function(e,t){if(!t||!t.length)return!0;const r=sh(e);return!r||fc(r,t)}(e,t.allowUrls)&&(rd&&Tc.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${iu(e)}.\nUrl: ${sh(e)}`),!0)}(t,o)?null:t}});function sh(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 r=e[t];if(r&&"<anonymous>"!==r.filename&&"[native code]"!==r.filename)return r.filename||null}return null}(t):null}catch{return rd&&Tc.error(`Cannot extract url for event ${iu(e)}`),null}}let lh;Gd(oh,ah);const ch="FunctionToString",uh=new WeakMap,dh=()=>({name:ch,setupOnce(){lh=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Dc(this),r=uh.has(md())&&void 0!==t?t:this;return lh.apply(r,e)}}catch{}},setup(e){uh.set(e,!0)}});Gd(ch,dh);const hh=bc;let fh=0;function ph(){return fh>0}function gh(e,t={},r){if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return t;if(Dc(e))return e}catch{return e}const n=function(){const n=Array.prototype.slice.call(arguments);try{r&&"function"==typeof r&&r.apply(this,arguments);const i=n.map(e=>gh(e,t));return e.apply(this,i)}catch(e){throw fh++,setTimeout(()=>{fh--}),function(...e){const t=jd();if(2===e.length){const[r,n]=e;return r?t.withScope(()=>(t.getStackTop().scope=r,n(r))):t.withScope(n)}t.withScope(e[0])}(r=>{r.addEventProcessor(e=>(t.mechanism&&(ou(e,void 0),au(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),function(e){jd().captureException(e,void 0)}(e)}),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}jc(n,e),Nc(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}const mh=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function vh(e,t){const r=bh(e,t),n={type:t&&t.name,value:xh(t)};return r.length&&(n.stacktrace={frames:r}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function yh(e,t){return{exception:{values:[vh(e,t)]}}}function bh(e,t){const r=t.stacktrace||t.stack||"",n=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(wh.test(e.message))return 1}return 0}(t);try{return e(r,n)}catch{}return[]}const wh=/Minified React error #\d+;/i;function xh(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function Ch(e,t,r,n,i){let o;if(ec(t)&&t.error)return yh(e,t.error);if(tc(t)||function(e){return Jl(e,"DOMException")}(t)){const i=t;if("stack"in t)o=yh(e,t);else{const t=i.name||(tc(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=_h(e,a,r,n),ou(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Ql(t)?yh(e,t):oc(t)||ac(t)?(o=function(e,t,r,n){const i=md(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:ac(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:Sh(t,{isUnhandledRejection:n})}]},extra:{__serialized__:Ru(t,o)}};if(r){const t=bh(e,r);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,r,i),au(o,{synthetic:!0}),o):(o=_h(e,t,r,n),ou(o,`${t}`),au(o,{synthetic:!0}),o)}function _h(e,t,r,n){const i={};if(n&&r){const n=bh(e,r);n.length&&(i.exception={values:[{value:t,stacktrace:{frames:n}}]})}if(nc(t)){const{__sentry_template_string__:e,__sentry_template_values__:r}=t;return i.logentry={message:e,params:r},i}return i.message=t,i}function Sh(e,{isUnhandledRejection:t}){const r=function(e,t=40){const r=Object.keys(zc(e));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=t)return uc(r[0],t);for(let e=r.length;e>0;e--){const n=r.slice(0,e).join(", ");if(!(n.length>t))return e===r.length?n:uc(n,t)}return""}(e),n=t?"promise rejection":"exception";return ec(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:ac(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}class Ah extends Kd{constructor(e){rh(e,"browser",["browser"],hh.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&hh.document&&hh.document.addEventListener("visibilitychange",()=>{"hidden"===hh.document.visibilityState&&this._flushOutcomes()})}eventFromException(e,t){return function(e,t,r,n){const i=Ch(e,t,r&&r.syntheticException||void 0,n);return au(i),i.level="error",r&&r.event_id&&(i.event_id=r.event_id),ju(i)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return function(e,t,r="info",n,i){const o=_h(e,t,n&&n.syntheticException||void 0,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),ju(o)}(this._options.stackParser,e,t,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(mh&&Tc.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:r,dsn:n}){const i={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!r&&!!n&&{dsn:Oc(n)}},o=function(e){return[{type:"user_report"},e]}(e);return qu(i,[o])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,r)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(mh&&Tc.log("No outcomes to send"));if(!this._dsn)return void(mh&&Tc.log("No dsn provided, will not send outcomes"));mh&&Tc.log("Sending outcomes:",e);const t=function(e,t){return qu(t?{dsn:t}:{},[[{type:"client_report"},{timestamp:Wu(),discarded_events:e}]])}(e,this._options.tunnel&&Oc(this._dsn));this._sendEnvelope(t)}}let kh;function Eh(e,t=function(){if(kh)return kh;if(vu(hh.fetch))return kh=hh.fetch.bind(hh);const e=hh.document;let t=hh.fetch;if(e&&"function"==typeof e.createElement)try{const r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r);const n=r.contentWindow;n&&n.fetch&&(t=n.fetch),e.head.removeChild(r)}catch(e){mh&&Tc.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return kh=t.bind(hh)}()){let r=0,n=0;return eh(e,function(i){const o=i.body.length;r+=o,n++;const a={body:i.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:r<=6e4&&n<15,...e.fetchOptions};try{return t(e.url,a).then(e=>(r-=o,n--,{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 kh=void 0,r-=o,n--,Du(e)}})}function Ih(e){return eh(e,function(t){return new zu((r,n)=>{const i=new XMLHttpRequest;i.onerror=n,i.onreadystatechange=()=>{4===i.readyState&&r({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 Th="?";function Fh(e,t,r,n){const i={filename:e,function:t,in_app:!0};return void 0!==r&&(i.lineno=r),void 0!==n&&(i.colno=n),i}const Oh=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ph=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mh=[30,e=>{const t=Oh.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=Ph.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,r]=Bh(t[1]||Th,t[2]);return Fh(r,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],Rh=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Lh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Nh=[50,e=>{const t=Rh.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Lh.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],r=t[1]||Th;return[r,e]=Bh(r,e),Fh(e,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],jh=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Dh=[40,e=>{const t=jh.exec(e);return t?Fh(t[2],t[1]||Th,+t[3],t[4]?+t[4]:void 0):void 0}],zh=qc(...[Mh,Nh,Dh]),Bh=(e,t)=>{const r=-1!==e.indexOf("safari-extension"),n=-1!==e.indexOf("safari-web-extension");return r||n?[-1!==e.indexOf("@")?e.split("@")[0]:Th,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Uh=1024,Vh="Breadcrumbs",Hh=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Vh,setupOnce(){},setup(e){t.console&&function(e){const t="console";Qc(t,e),Jc(t,tu)}(function(e){return function(t){if(md()!==e)return;const r={category:"console",data:{arguments:t.args,logger:"console"},level:Hu(t.level),message:dc(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;r.message=`Assertion failed: ${dc(t.args.slice(1)," ")||"console.assert"}`,r.data.arguments=t.args.slice(1)}gd(r,{input:t.args,level:t.level})}}(e)),t.dom&&function(e){Qc("dom",e),Jc("dom",fu)}(function(e,t){return function(r){if(md()!==e)return;let n,i,o="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;a&&a>Uh&&(mh&&Tc.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=Uh),"string"==typeof o&&(o=[o]);try{const e=r.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;n=_c(t,{keyAttrs:o,maxStringLength:a}),i=function(e){if(!Cc.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{n="<unknown>"}if(0===n.length)return;const s={category:`ui.${r.name}`,message:n};i&&(s.data={"ui.component_name":i}),gd(s,{event:r.event,name:r.name,global:r.global})}}(e,t.dom)),t.xhr&&function(e){Qc("xhr",e),Jc("xhr",Pu)}(function(e){return function(t){if(md()!==e)return;const{startTimestamp:r,endTimestamp:n}=t,i=t.xhr[Ou];if(!r||!n||!i)return;const{method:o,url:a,status_code:s,body:l}=i;gd({category:"xhr",data:{method:o,url:a,status_code:s},type:"http"},{xhr:t.xhr,input:l,startTimestamp:r,endTimestamp:n})}}(e)),t.fetch&&function(e){const t="fetch";Qc(t,e),Jc(t,yu)}(function(e){return function(t){if(md()!==e)return;const{startTimestamp:r,endTimestamp:n}=t;if(n&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){gd({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:r,endTimestamp:n})}else{const e=t.response;gd({category:"fetch",data:{...t.fetchData,status_code:e&&e.status},type:"http"},{input:t.args,response:e,startTimestamp:r,endTimestamp:n})}}}(e)),t.history&&Iu(function(e){return function(t){if(md()!==e)return;let r=t.from,n=t.to;const i=Uu(hh.location.href);let o=r?Uu(r):void 0;const a=Uu(n);(!o||!o.path)&&(o=i),i.protocol===a.protocol&&i.host===a.host&&(n=a.relative),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),gd({category:"navigation",data:{from:r,to:n}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){md()===e&&gd({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:iu(t)},{event:t})}}(e))}}};Gd(Vh,Hh);const Wh="Dedupe",$h=()=>{let e;return{name:Wh,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&!(!function(e,t){const r=e.message,n=t.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Gh(e,t)||!qh(e,t))}(e,t)&&!function(e,t){const r=Yh(t),n=Yh(e);return!!(r&&n&&r.type===n.type&&r.value===n.value&&Gh(e,t)&&qh(e,t))}(e,t))}(t,e))return mh&&Tc.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function qh(e,t){let r=Xh(e),n=Xh(t);if(!r&&!n)return!0;if(r&&!n||!r&&n||n.length!==r.length)return!1;for(let e=0;e<n.length;e++){const t=n[e],i=r[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Gh(e,t){let r=e.fingerprint,n=t.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;try{return r.join("")===n.join("")}catch{return!1}}function Yh(e){return e.exception&&e.exception.values&&e.exception.values[0]}function Xh(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}Gd(Wh,$h);const Kh="GlobalHandlers",Zh=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:Kh,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(e){const t="error";Qc(t,e),Jc(t,Cu)}(t=>{const{stackParser:r,attachStacktrace:n}=ef();if(md()!==e||ph())return;const{msg:i,url:o,line:a,column:s,error:l}=t,c=void 0===l&&rc(i)?function(e,t,r,n){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=ec(e)?e.message:e,a="Error";const s=o.match(i);return s&&(a=s[1],o=s[2]),Qh({exception:{values:[{type:a,value:o}]}},t,r,n)}(i,o,a,s):Qh(Ch(r,l||i,void 0,n,!1),o,a,s);c.level="error",pd(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}(e),Jh("onerror")),t.onunhandledrejection&&(function(e){!function(e){const t="unhandledrejection";Qc(t,e),Jc(t,Su)}(t=>{const{stackParser:r,attachStacktrace:n}=ef();if(md()!==e||ph())return;const i=function(e){if(ic(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=ic(i)?function(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}(i):Ch(r,i,void 0,n,!0);o.level="error",pd(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(e),Jh("onunhandledrejection"))}}};function Qh(e,t,r,n){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(n,10))?void 0:n,u=isNaN(parseInt(r,10))?void 0:r,d=rc(t)&&t.length>0?t:function(){try{return Cc.document.location.href}catch{return""}}();return 0===l.length&&l.push({colno:c,filename:d,function:"?",in_app:!0,lineno:u}),e}function Jh(e){mh&&Tc.log(`Global Handler attached: ${e}`)}function ef(){const e=md();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}Gd(Kh,Zh);const tf="HttpContext",rf=()=>({name:tf,setupOnce(){},preprocessEvent(e){if(!hh.navigator&&!hh.location&&!hh.document)return;const t=e.request&&e.request.url||hh.location&&hh.location.href,{referrer:r}=hh.document||{},{userAgent:n}=hh.navigator||{},i={...e.request&&e.request.headers,...r&&{Referer:r},...n&&{"User-Agent":n}},o={...e.request,...t&&{url:t},headers:i};e.request=o}});Gd(tf,rf);const nf="LinkedErrors",of=(e={})=>{const t=e.limit||5,r=e.key||"cause";return{name:nf,setupOnce(){},preprocessEvent(e,n,i){const o=i.getOptions();pc(vh,o.stackParser,o.maxValueLength,r,t,e,n)}}};Gd(nf,of);const af=["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"],sf="TryCatch",lf=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:sf,setupOnce(){t.setTimeout&&Lc(hh,"setTimeout",cf),t.setInterval&&Lc(hh,"setInterval",cf),t.requestAnimationFrame&&Lc(hh,"requestAnimationFrame",uf),t.XMLHttpRequest&&"XMLHttpRequest"in hh&&Lc(XMLHttpRequest.prototype,"send",df);const e=t.eventTarget;e&&(Array.isArray(e)?e:af).forEach(hf)}}};function cf(e){return function(...t){const r=t[0];return t[0]=gh(r,{mechanism:{data:{function:Xc(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function uf(e){return function(t){return e.apply(this,[gh(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Xc(e)},handled:!1,type:"instrument"}})])}}function df(e){return function(...t){const r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in r&&"function"==typeof r[e]&&Lc(r,e,function(t){const r={mechanism:{data:{function:e,handler:Xc(t)},handled:!1,type:"instrument"}},n=Dc(t);return n&&(r.mechanism.data.handler=Xc(n)),gh(t,r)})}),e.apply(this,t)}}function hf(e){const t=hh,r=t[e]&&t[e].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Lc(r,"addEventListener",function(t){return function(r,n,i){try{"function"==typeof n.handleEvent&&(n.handleEvent=gh(n.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Xc(n),target:e},handled:!1,type:"instrument"}}))}catch{}return t.apply(this,[r,gh(n,{mechanism:{data:{function:"addEventListener",handler:Xc(n),target:e},handled:!1,type:"instrument"}}),i])}}),Lc(r,"removeEventListener",function(e){return function(t,r,n){const i=r;try{const r=i&&i.__sentry_wrapped__;r&&e.call(this,t,r,n)}catch{}return e.call(this,t,i,n)}}))}Gd(sf,lf);const ff=[ah(),dh(),lf(),Hh(),Zh(),of(),$h(),rf()];function pf(e={}){void 0===e.defaultIntegrations&&(e.defaultIntegrations=[...ff]),void 0===e.release&&("string"==typeof __SENTRY_RELEASE__&&(e.release=__SENTRY_RELEASE__),hh.SENTRY_RELEASE&&hh.SENTRY_RELEASE.id&&(e.release=hh.SENTRY_RELEASE.id)),void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0);const t={...e,stackParser:Gc(e.stackParser||zh),integrations:Wd(e),transport:e.transport||(mu()?Eh:Ih)};Jd(Ah,t),e.autoSessionTracking&&function(){if(typeof hh.document>"u")return void(mh&&Tc.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));yd({ignoreDuration:!0}),xd(),Iu(({from:e,to:t})=>{void 0!==e&&e!==t&&(yd({ignoreDuration:!0}),xd())})}()}var gf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function vf(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var yf=(e=>(e.INLINE="inline",e.OVERLAY="overlay",e))(yf||{}),bf=(e=>(e.TOP="top",e.BOTTOM="bottom",e.HIDDEN="",e))(bf||{});function wf(e,t){return{...t,message:e}}const xf=[{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}],Cf={emoticons:wf("Emoticons"),doodles:wf("Doodles"),landmarks:wf("Landmarks"),bubbles:wf("Bubbles"),transportation:wf("Transportation"),beach:wf("Beach")},_f={fill:"#1565C0",opacity:1,backgroundColor:null,strokeWidth:.05,stroke:"#000"},Sf=[1,8,15,20,25];var Af=(e=>(e.DARK="dark",e.LIGHT="light",e))(Af||{});const kf=[{name:Af.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:Af.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 Ef=(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))(Ef||{});function If(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=If(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Tf(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=If(e))&&(n&&(n+=" "),n+=t);return n}const Ff=p((r,n)=>{const{attr:i,size:o,title:a,className:s,color:l,style:c,children:u,viewBox:d,width:h,height:f,...p}=r;return t("svg",{"aria-hidden":!a,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:d||"0 0 24 24",...i,...p,className:Tf("svg-icon",s,Of(o)),style:{color:l,...c},ref:n,height:f||"1em",width:h||"1em",children:[a&&e("title",{children:a}),u]})});function Of(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 Pf(t,r="",n){return i.memo(i.forwardRef((i,o)=>e(Ff,{"data-testid":`${r}Icon`,ref:o,viewBox:n,...i,size:i.size||"md",children:t})))}function Mf(e,t=""){return Pf(Rf(e),t)}function Rf(e){return(null==e?void 0:e.map)&&e.map((e,t)=>i.createElement(e.tag,{key:t,...e.attr},Rf(e.child)))}const Lf=Pf(e("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined"),Nf=Pf(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"),jf=Pf(e("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"}),"CropOutlined"),Df=Pf(e("path",{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}),"TextFieldsOutlined"),zf=Pf(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"),Bf=Pf(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"),Uf=Pf(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"),Vf=Pf(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"),Hf=Pf(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"),Wf=Pf(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"),$f=Pf(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"),qf=Pf([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"),Gf=Pf(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"),Yf=Pf(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"),Xf=Pf(e("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}),"HomeOutlined"),Kf={[Ef.FILTER]:{name:wf("Applied Filters"),icon:Lf},[Ef.RESIZE]:{name:wf("Resized Image"),icon:Nf},[Ef.CROP]:{name:wf("Cropped Image"),icon:jf},[Ef.DRAW]:{name:wf("Added Drawing"),icon:Yf},[Ef.TEXT]:{name:wf("Added Text"),icon:Df},[Ef.SHAPES]:{name:wf("Added Shape"),icon:zf},[Ef.STICKERS]:{name:wf("Added Sticker"),icon:Bf},[Ef.FRAME]:{name:wf("Added Frame"),icon:Uf},[Ef.MERGE]:{name:wf("Merged Objects"),icon:Vf},[Ef.CORNERS]:{name:wf("Rounded Corner"),icon:Hf},bgImage:{name:wf("Replaced Background Image"),icon:Wf},overlayImage:{name:wf("Added Image"),icon:Wf},initial:{name:wf("Initial"),icon:Xf},loadedState:{name:wf("Loaded State"),icon:$f},objectStyle:{name:wf("Changed Style"),icon:qf},deletedObject:{name:wf("Deleted object"),icon:Gf}},Zf=Object.values(Ef).map(e=>({name:e,icon:Kf[e].icon,action:e===Ef.MERGE?e=>{e.tools.merge.apply()}:e})),Qf={filter:wf("filter"),resize:wf("resize"),crop:wf("crop"),draw:wf("draw"),text:wf("text"),shapes:wf("shapes"),stickers:wf("stickers"),frame:wf("frame"),corners:wf("corners"),merge:wf("merge")},Jf=Pf(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"),ep="3.0.5",tp={selector:"pixie-editor",textureSize:4096,activeLanguage:"en",ui:{visible:!0,mode:yf.INLINE,forceOverlayModeOnMobile:!0,activeTheme:Af.LIGHT,themes:kf,allowEditorClose:!0,menubar:{items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",icon:$f,align:"right",desktopOnly:!0,action:e=>{e.togglePanel("history")}},{type:"button",icon:Jf,label:wf("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:bf.BOTTOM,items:[...Zf]},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:{..._f},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:Sf,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:xf},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}}]}}},rp=e=>{let t;const r=new Set,n=(e,n)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=n??("object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:n,getState:i,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{r.clear()}},a=t=e(n,i,o);return o};var np={exports:{}},ip={},op={exports:{}},ap={},sp=i;
10
- /**
11
- * @license React
12
- * use-sync-external-store-shim.production.min.js
13
- *
14
- * Copyright (c) Facebook, Inc. and its affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var lp="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},cp=sp.useState,up=sp.useEffect,dp=sp.useLayoutEffect,hp=sp.useDebugValue;function fp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!lp(e,r)}catch{return!0}}var pp=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,t){var r=t(),n=cp({inst:{value:r,getSnapshot:t}}),i=n[0].inst,o=n[1];return dp(function(){i.value=r,i.getSnapshot=t,fp(i)&&o({inst:i})},[e,r,t]),up(function(){return fp(i)&&o({inst:i}),e(function(){fp(i)&&o({inst:i})})},[e]),hp(r),r};ap.useSyncExternalStore=void 0!==sp.useSyncExternalStore?sp.useSyncExternalStore:pp,op.exports=ap;var gp=op.exports,mp=i,vp=gp;
19
- /**
20
- * @license React
21
- * use-sync-external-store-shim/with-selector.production.min.js
22
- *
23
- * Copyright (c) Facebook, Inc. and its affiliates.
24
- *
25
- * This source code is licensed under the MIT license found in the
26
- * LICENSE file in the root directory of this source tree.
27
- */var yp="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},bp=vp.useSyncExternalStore,wp=mp.useRef,xp=mp.useEffect,Cp=mp.useMemo,_p=mp.useDebugValue;ip.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var o=wp(null);if(null===o.current){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=Cp(function(){function e(e){if(!l){if(l=!0,o=e,e=n(e),void 0!==i&&a.hasValue){var t=a.value;if(i(t,e))return s=t}return s=e}if(t=s,yp(o,e))return t;var r=n(e);return void 0!==i&&i(t,r)?t:(o=e,s=r)}var o,s,l=!1,c=void 0===r?null:r;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,r,n,i]);var s=bp(e,o[0],o[1]);return xp(function(){a.hasValue=!0,a.value=s},[s]),_p(s),s},np.exports=ip;const Sp=mf(np.exports),{useDebugValue:Ap}=i,{useSyncExternalStoreWithSelector:kp}=Sp,Ep=e=>e;const Ip=e=>{const t="function"==typeof e?(e=>e?rp(e):rp)(e):e,r=(e,r)=>function(e,t=Ep,r){const n=kp(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Ap(n),n}(t,e,r);return Object.assign(r,t),r},Tp=e=>Ip,Fp=e=>(t,r,n)=>{const i=n.subscribe;return n.subscribe=(e,t,r)=>{let o=e;if(t){const i=(null==r?void 0:r.equalityFn)||Object.is;let a=e(n.getState());o=r=>{const n=e(r);if(!i(a,n)){const e=a;t(a=n,e)}},null!=r&&r.fireImmediately&&t(a,a)}return i(o)},e(t,r,n)};var Op=Symbol.for("immer-nothing"),Pp=Symbol.for("immer-draftable"),Mp=Symbol.for("immer-state");function Rp(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Lp=Object.getPrototypeOf;function Np(e){return!!e&&!!e[Mp]}function jp(e){var t;return!!e&&(zp(e)||Array.isArray(e)||!!e[Pp]||!(null==(t=e.constructor)||!t[Pp])||Wp(e)||$p(e))}var Dp=Object.prototype.constructor.toString();function zp(e){if(!e||"object"!=typeof e)return!1;const t=Lp(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===Dp}function Bp(e,t){0===Up(e)?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function Up(e){const t=e[Mp];return t?t.type_:Array.isArray(e)?1:Wp(e)?2:$p(e)?3:0}function Vp(e,t){return 2===Up(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hp(e,t,r){const n=Up(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function Wp(e){return e instanceof Map}function $p(e){return e instanceof Set}function qp(e){return e.copy_||e.base_}function Gp(e,t){if(Wp(e))return new Map(e);if($p(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=zp(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[Mp];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const i=r[n],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Lp(e),t)}{const t=Lp(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function Yp(e,t=!1){return Kp(e)||Np(e)||!jp(e)||(Up(e)>1&&(e.set=e.add=e.clear=e.delete=Xp),Object.freeze(e),t&&Object.entries(e).forEach(([e,t])=>Yp(t,!0))),e}function Xp(){Rp(2)}function Kp(e){return Object.isFrozen(e)}var Zp,Qp={};function Jp(e){const t=Qp[e];return t||Rp(0),t}function eg(){return Zp}function tg(e,t){t&&(Jp("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function rg(e){ng(e),e.drafts_.forEach(og),e.drafts_=null}function ng(e){e===Zp&&(Zp=e.parent_)}function ig(e){return Zp=function(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(Zp,e)}function og(e){const t=e[Mp];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ag(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[Mp].modified_&&(rg(t),Rp(4)),jp(e)&&(e=sg(t,e),t.parent_||cg(t,e)),t.patches_&&Jp("Patches").generateReplacementPatches_(r[Mp].base_,e,t.patches_,t.inversePatches_)):e=sg(t,r,[]),rg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Op?e:void 0}function sg(e,t,r){if(Kp(t))return t;const n=t[Mp];if(!n)return Bp(t,(i,o)=>lg(e,n,t,i,o,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return cg(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let i=t,o=!1;3===n.type_&&(i=new Set(t),t.clear(),o=!0),Bp(i,(i,a)=>lg(e,n,t,i,a,r,o)),cg(e,t,!1),r&&e.patches_&&Jp("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function lg(e,t,r,n,i,o,a){if(Np(i)){const a=sg(e,i,o&&t&&3!==t.type_&&!Vp(t.assigned_,n)?o.concat(n):void 0);if(Hp(r,n,a),!Np(a))return;e.canAutoFreeze_=!1}else a&&r.add(i);if(jp(i)&&!Kp(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;sg(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&Object.prototype.propertyIsEnumerable.call(r,n)&&cg(e,i)}}function cg(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Yp(t,r)}var ug={get(e,t){if(t===Mp)return e;const r=qp(e);if(!Vp(r,t))return function(e,t,r){var n;const i=fg(t,r);return i?"value"in i?i.value:null==(n=i.get)?void 0:n.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!jp(n)?n:n===hg(e.base_,t)?(gg(e),e.copy_[t]=mg(n,e)):n},has:(e,t)=>t in qp(e),ownKeys:e=>Reflect.ownKeys(qp(e)),set(e,t,r){const n=fg(qp(e),t);if(null!=n&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=hg(qp(e),t),i=null==n?void 0:n[Mp];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,n)&&(void 0!==r||Vp(e.base_,t)))return!0;gg(e),pg(e)}return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==hg(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,gg(e),pg(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=qp(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}},defineProperty(){Rp(11)},getPrototypeOf:e=>Lp(e.base_),setPrototypeOf(){Rp(12)}},dg={};function hg(e,t){const r=e[Mp];return(r?qp(r):e)[t]}function fg(e,t){if(!(t in e))return;let r=Lp(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=Lp(r)}}function pg(e){e.modified_||(e.modified_=!0,e.parent_&&pg(e.parent_))}function gg(e){e.copy_||(e.copy_=Gp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Bp(ug,(e,t)=>{dg[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),dg.deleteProperty=function(e,t){return dg.set.call(this,e,t,void 0)},dg.set=function(e,t,r){return ug.set.call(this,e[0],t,r,e[0])};function mg(e,t){const r=Wp(e)?Jp("MapSet").proxyMap_(e,t):$p(e)?Jp("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:eg(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,o=ug;r&&(i=[n],o=dg);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return n.draft_=s,n.revoke_=a,s}(e,t);return(t?t.scope_:eg()).drafts_.push(r),r}function vg(e){if(!jp(e)||Kp(e))return e;const t=e[Mp];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Gp(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Gp(e,!0);return Bp(r,(e,t)=>{Hp(r,e,vg(t))}),t&&(t.finalized_=!1),r}var yg=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...i){return n.produce(e,e=>t.call(this,e,...i))}}let n;if("function"!=typeof t&&Rp(6),void 0!==r&&"function"!=typeof r&&Rp(7),jp(e)){const i=ig(this),o=mg(e,void 0);let a=!0;try{n=t(o),a=!1}finally{a?rg(i):ng(i)}return tg(i,r),ag(n,i)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===Op&&(n=void 0),this.autoFreeze_&&Yp(n,!0),r){const t=[],i=[];Jp("Patches").generateReplacementPatches_(e,n,t,i),r(t,i)}return n}Rp(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,t=>e(t,...r));let r,n;return[this.produce(e,t,(e,t)=>{r=e,n=t}),r,n]},"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof(null==e?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){jp(e)||Rp(8),Np(e)&&(e=function(e){return Np(e)||Rp(10),vg(e)}(e));const t=ig(this),r=mg(e,void 0);return r[Mp].isManual_=!0,ng(t),r}finishDraft(e,t){const r=e&&e[Mp];(!r||!r.isManual_)&&Rp(9);const{scope_:n}=r;return tg(n,t),ag(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=Jp("Patches").applyPatches_;return Np(e)?n(e,t):this.produce(e,e=>n(e,t))}},bg=yg.produce;yg.produceWithPatches.bind(yg),yg.setAutoFreeze.bind(yg),yg.setUseStrictShallowCopy.bind(yg),yg.applyPatches.bind(yg),yg.createDraft.bind(yg),yg.finishDraft.bind(yg);var wg=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===xg}(e)}(e)};var xg="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function Cg(e,t){return!1!==t.clone&&t.isMergeableObject(e)?Eg(function(e){return Array.isArray(e)?[]:{}}(e),e,t):e}function _g(e,t,r){return e.concat(t).map(function(e){return Cg(e,r)})}function Sg(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function Ag(e,t){try{return t in e}catch{return!1}}function kg(e,t,r){var n={};return r.isMergeableObject(e)&&Sg(e).forEach(function(t){n[t]=Cg(e[t],r)}),Sg(t).forEach(function(i){(function(e,t){return Ag(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(Ag(e,i)&&r.isMergeableObject(t[i])?n[i]=function(e,t){if(!t.customMerge)return Eg;var r=t.customMerge(e);return"function"==typeof r?r:Eg}(i,r)(e[i],t[i],r):n[i]=Cg(t[i],r))}),n}function Eg(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||_g,r.isMergeableObject=r.isMergeableObject||wg,r.cloneUnlessOtherwiseSpecified=Cg;var n=Array.isArray(t);return n===Array.isArray(e)?n?r.arrayMerge(e,t,r):kg(e,t,r):Cg(t,r)}Eg.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,r){return Eg(e,r,t)},{})};const Ig=mf(Eg);function Tg(e,t){return Fg(Ig(t,e),e)}function Fg(e,t){return Object.keys(e).forEach(r=>{if(r.startsWith("replaceDefault")&&e[r]){const n=function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(r.replace("replaceDefault","")||"items");e[n]=t?t[n]:[],delete e[r]}else"object"==typeof e[r]&&null!==e[r]&&Fg(e[r],null==t?void 0:t[r])}),e}const Og=(e,t)=>({history:{...Pg,updatePointerById:e=>{const r=t().history.items.findIndex(t=>t.id===e);t().history.update(r)},update:(t,r)=>{e(e=>{e.history.pointer=t,r&&(e.history.items=r),e.history.canUndo=e.history.pointer>0,e.history.canRedo=e.history.items.length>e.history.pointer+1})},reset:r=>{e({history:{...t().history,...r??Pg}})}}}),Pg={items:[],pointer:0,canUndo:!1,canRedo:!1};var Mg=(e=>(e.Filter="filter",e.Frame="frame",e.ActiveObject="activeObj",e.Text="text",e))(Mg||{});const Rg=(e,t)=>({filter:{...Lg,select(t,r=!1){e(e=>{e.filter.selected=t,e.activeToolOverlay=r?Mg.Filter:null,e.dirty=!0})},deselect(r){t().filter.selected===r&&e(e=>{e.filter.selected=null,e.activeToolOverlay=null,e.dirty=!0})},reset(){e({filter:{...t().filter,...Lg}})}}}),Lg={selected:null,applied:[]},Ng=(e,t)=>({crop:{...jg,setCropzoneRect:t=>{e(e=>{e.crop.zoneRect=t})},setAspectRatio:t=>{e(e=>{e.crop.selectedAspectRatio=t})},setTransformAngle:t=>{e(e=>{e.crop.straightenAngle=t})},apply:async()=>{const e=t().crop.zoneRect;if(e){const r={width:Math.ceil(e.width/t().zoom),height:Math.ceil(e.height/t().zoom),left:Math.ceil(e.left/t().zoom),top:Math.ceil(e.top/t().zoom)};await t().editor.tools.crop.apply(r)}},reset:()=>{e({crop:{...t().crop,...jg}})}}}),jg={zoneRect:null,selectedAspectRatio:null,straightenAngle:0};function Dg(e){return"i-text"===(null==e?void 0:e.type)}var zg=(e=>(e.Text="text",e.Shape="shape",e.Sticker="sticker",e.Drawing="drawing",e.Image="image",e.MainImage="mainImage",e.StraightenAnchor="straightenHelper",e))(zg||{});const Bg={text:{name:wf("Text"),icon:Kf.text.icon},shape:{name:wf("Shape"),icon:Kf.shapes.icon},sticker:{name:wf("Sticker"),icon:Kf.stickers.icon},drawing:{name:wf("Drawing"),icon:Kf.draw.icon},image:{name:wf("Image"),icon:Kf.overlayImage.icon},mainImage:{name:wf("Background Image"),icon:Kf.bgImage.icon}};const Ug={isMoving:!1,editableProps:{},id:null,isText:!1,isImage:!1,name:null};const Vg=(e,t)=>({objects:{...Hg,setActiveIsMoving:t=>{e(e=>{e.objects.active.isMoving=t})},setIsEditingText:t=>{e(e=>{e.objects.isEditingText=t})},setActive:r=>{e(r?e=>{e.objects.active.editableProps=function(e){if(!e)return{};const t={fill:e.fill,opacity:e.opacity,backgroundColor:e.backgroundColor,stroke:e.stroke,strokeWidth:e.strokeWidth},r=e.shadow;return r&&(t.shadow={color:r.color,blur:r.blur,offsetX:r.offsetX,offsetY:r.offsetY}),Dg(e)&&(t.textAlign=e.textAlign,t.underline=e.underline,t.linethrough=e.linethrough,t.fontStyle=e.fontStyle,t.fontFamily=e.fontFamily,t.fontWeight=e.fontWeight,t.fontSize=e.fontSize),t}(r),e.objects.active.id=r.data.id,e.objects.active.name=r.name??null,e.objects.active.isText=Dg(r),e.objects.active.isImage=function(e){return e.name===zg.Image}(r)}:e=>{var r,n,i,o,a;const s={...null==(r=t().config.objectDefaults)?void 0:r.global,fontFamily:null==(i=null==(n=t().config.objectDefaults)?void 0:n.text)?void 0:i.fontFamily,fontSize:null==(a=null==(o=t().config.objectDefaults)?void 0:o.text)?void 0:a.fontSize};e.objects.active={...Ug,editableProps:s}})},reset(){e({objects:{...t().objects,...Hg}})}}}),Hg={all:[],isEditingText:!1,active:Ug},Wg=(e,t)=>({frame:{...$g,select:r=>{e(e=>{e.frame.active=r}),t().frame.showOptionsPanel()},deselect:()=>{e(e=>{e.frame.active=null,e.activeToolOverlay=null})},showOptionsPanel:()=>{t().activeTool===Ef.FRAME&&e(e=>{e.activeToolOverlay=Mg.Frame})},reset(){e({frame:{...t().frame,...$g}})}}}),$g={active:null},qg=(e,t)=>({resize:{...Gg,setFormValue:t=>{e(e=>{Object.entries(t).forEach(([t,r])=>{e.resize.formValue[t]=r})})},apply(){const e=t().resize.formValue,r=t().original;if(e.width===r.width&&e.height===r.height)return!1;t().editor.tools.resize.apply(e)},reset(){e({resize:{...t().resize,...Gg}})}}}),Gg={formValue:{width:1,height:1,maintainAspect:!0,usePercentages:!1}},Yg=(e,t)=>({corners:{...Xg,setRadius:t=>{e(e=>{e.corners.radius=t})},apply:()=>t().editor.tools.corners.apply(t().corners.radius),reset(){e({corners:{...t().corners,...Xg}})}}}),Xg={radius:50},Kg=e=>(t,r,n)=>(n.setState=(e,r,...n)=>{const i="function"==typeof e?bg(e):e;return t(i,r,...n)},e(n.setState,r,n));var Zg={exports:{}},Qg={exports:{}},Jg=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))},em=Array.prototype.concat,tm=Array.prototype.slice,rm=Qg.exports=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];Jg(i)?t=em.call(t,tm.call(i)):t.push(i)}return t};rm.wrap=function(e){return function(){return e(rm(arguments))}};var nm=Qg.exports,im={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},om=nm,am=Object.hasOwnProperty,sm=Object.create(null);for(var lm in im)am.call(im,lm)&&(sm[im[lm]]=lm);var cm=Zg.exports={to:{},get:{}};function um(e,t,r){return Math.min(Math.max(t,e),r)}function dm(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}cm.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=cm.get.hsl(e),r="hsl";break;case"hwb":t=cm.get.hwb(e),r="hwb";break;default:t=cm.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},cm.get.rgb=function(e){if(!e)return null;var t,r,n,i=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(n=t[2],t=t[1],r=0;r<3;r++){var o=2*r;i[r]=parseInt(t.slice(o,o+2),16)}n&&(i[3]=parseInt(n,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(n=(t=t[1])[3],r=0;r<3;r++)i[r]=parseInt(t[r]+t[r],16);n&&(i[3]=parseInt(n+n,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)i[r]=parseInt(t[r+1],0);t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:am.call(im,t[1])?((i=im[t[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(t[r+1]));t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}for(r=0;r<3;r++)i[r]=um(i[r],0,255);return i[3]=um(i[3],0,1),i},cm.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,um(parseFloat(t[2]),0,100),um(parseFloat(t[3]),0,100),um(isNaN(r)?1:r,0,1)]}return null},cm.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,um(parseFloat(t[2]),0,100),um(parseFloat(t[3]),0,100),um(isNaN(r)?1:r,0,1)]}return null},cm.to.hex=function(){var e=om(arguments);return"#"+dm(e[0])+dm(e[1])+dm(e[2])+(e[3]<1?dm(Math.round(255*e[3])):"")},cm.to.rgb=function(){var e=om(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},cm.to.rgb.percent=function(){var e=om(arguments),t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"},cm.to.hsl=function(){var e=om(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},cm.to.hwb=function(){var e=om(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},cm.to.keyword=function(e){return sm[e.slice(0,3)]};var hm=Zg.exports;const fm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},pm={};for(const e of Object.keys(fm))pm[fm[e]]=e;const gm={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var mm=gm;for(const e of Object.keys(gm)){if(!("channels"in gm[e]))throw new Error("missing channels property: "+e);if(!("labels"in gm[e]))throw new Error("missing channel labels property: "+e);if(gm[e].labels.length!==gm[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:r}=gm[e];delete gm[e].channels,delete gm[e].labels,Object.defineProperty(gm[e],"channels",{value:t}),Object.defineProperty(gm[e],"labels",{value:r})}function vm(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}gm.rgb.hsl=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=o-i;let s,l;o===i?s=0:t===o?s=(r-n)/a:r===o?s=2+(n-t)/a:n===o&&(s=4+(t-r)/a),s=Math.min(60*s,360),s<0&&(s+=360);const c=(i+o)/2;return l=o===i?0:c<=.5?a/(o+i):a/(2-o-i),[s,100*l,100*c]},gm.rgb.hsv=function(e){let t,r,n,i,o;const a=e[0]/255,s=e[1]/255,l=e[2]/255,c=Math.max(a,s,l),u=c-Math.min(a,s,l),d=function(e){return(c-e)/6/u+.5};return 0===u?(i=0,o=0):(o=u/c,t=d(a),r=d(s),n=d(l),a===c?i=n-r:s===c?i=1/3+t-n:l===c&&(i=2/3+r-t),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*c]},gm.rgb.hwb=function(e){const t=e[0],r=e[1];let n=e[2];const i=gm.rgb.hsl(e)[0],o=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[i,100*o,100*n]},gm.rgb.cmyk=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(1-t,1-r,1-n);return[100*((1-t-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*((1-n-i)/(1-i)||0),100*i]},gm.rgb.keyword=function(e){const t=pm[e];if(t)return t;let r,n=1/0;for(const t of Object.keys(fm)){const i=vm(e,fm[t]);i<n&&(n=i,r=t)}return r},gm.keyword.rgb=function(e){return fm[e]},gm.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;return[100*(.4124*t+.3576*r+.1805*n),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},gm.rgb.lab=function(e){const t=gm.rgb.xyz(e);let r=t[0],n=t[1],i=t[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*n-16,500*(r-n),200*(n-i)]},gm.hsl.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;let i,o,a;if(0===r)return a=255*n,[a,a,a];i=n<.5?n*(1+r):n+r-n*r;const s=2*n-i,l=[0,0,0];for(let e=0;e<3;e++)o=t+1/3*-(e-1),o<0&&o++,o>1&&o--,a=6*o<1?s+6*(i-s)*o:2*o<1?i:3*o<2?s+(i-s)*(2/3-o)*6:s,l[e]=255*a;return l},gm.hsl.hsv=function(e){const t=e[0];let r=e[1]/100,n=e[2]/100,i=r;const o=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=o<=1?o:2-o;return[t,100*(0===n?2*i/(o+i):2*r/(n+r)),100*((n+r)/2)]},gm.hsv.rgb=function(e){const t=e[0]/60,r=e[1]/100;let n=e[2]/100;const i=Math.floor(t)%6,o=t-Math.floor(t),a=255*n*(1-r),s=255*n*(1-r*o),l=255*n*(1-r*(1-o));switch(n*=255,i){case 0:return[n,l,a];case 1:return[s,n,a];case 2:return[a,n,l];case 3:return[a,s,n];case 4:return[l,a,n];case 5:return[n,a,s]}},gm.hsv.hsl=function(e){const t=e[0],r=e[1]/100,n=e[2]/100,i=Math.max(n,.01);let o,a;a=(2-r)*n;const s=(2-r)*i;return o=r*i,o/=s<=1?s:2-s,o=o||0,a/=2,[t,100*o,100*a]},gm.hwb.rgb=function(e){const t=e[0]/360;let r=e[1]/100,n=e[2]/100;const i=r+n;let o;i>1&&(r/=i,n/=i);const a=Math.floor(6*t),s=1-n;o=6*t-a,1&a&&(o=1-o);const l=r+o*(s-r);let c,u,d;switch(a){default:case 6:case 0:c=s,u=l,d=r;break;case 1:c=l,u=s,d=r;break;case 2:c=r,u=s,d=l;break;case 3:c=r,u=l,d=s;break;case 4:c=l,u=r,d=s;break;case 5:c=s,u=r,d=l}return[255*c,255*u,255*d]},gm.cmyk.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,i=e[3]/100;return[255*(1-Math.min(1,t*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i))]},gm.xyz.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100;let i,o,a;return i=3.2406*t+-1.5372*r+-.4986*n,o=-.9689*t+1.8758*r+.0415*n,a=.0557*t+-.204*r+1.057*n,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,i=Math.min(Math.max(0,i),1),o=Math.min(Math.max(0,o),1),a=Math.min(Math.max(0,a),1),[255*i,255*o,255*a]},gm.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;return[116*r-16,500*(t-r),200*(r-n)]},gm.lab.xyz=function(e){let t,r,n;r=(e[0]+16)/116,t=e[1]/500+r,n=r-e[2]/200;const i=r**3,o=t**3,a=n**3;return r=i>.008856?i:(r-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,n=a>.008856?a:(n-16/116)/7.787,t*=95.047,r*=100,n*=108.883,[t,r,n]},gm.lab.lch=function(e){const t=e[0],r=e[1],n=e[2];let i;i=360*Math.atan2(n,r)/2/Math.PI,i<0&&(i+=360);return[t,Math.sqrt(r*r+n*n),i]},gm.lch.lab=function(e){const t=e[0],r=e[1],n=e[2]/360*2*Math.PI;return[t,r*Math.cos(n),r*Math.sin(n)]},gm.rgb.ansi16=function(e,t=null){const[r,n,i]=e;let o=null===t?gm.rgb.hsv(e)[2]:t;if(o=Math.round(o/50),0===o)return 30;let a=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===o&&(a+=60),a},gm.hsv.ansi16=function(e){return gm.rgb.ansi16(gm.hsv.rgb(e),e[2])},gm.rgb.ansi256=function(e){const t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},gm.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},gm.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},gm.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},gm.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];3===t[0].length&&(r=r.split("").map(e=>e+e).join(""));const n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},gm.rgb.hcg=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.max(Math.max(t,r),n),o=Math.min(Math.min(t,r),n),a=i-o;let s,l;return s=a<1?o/(1-a):0,l=a<=0?0:i===t?(r-n)/a%6:i===r?2+(n-t)/a:4+(t-r)/a,l/=6,l%=1,[360*l,100*a,100*s]},gm.hsl.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r);let i=0;return n<1&&(i=(r-.5*n)/(1-n)),[e[0],100*n,100*i]},gm.hsv.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=t*r;let i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},gm.hcg.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];const i=[0,0,0],o=t%1*6,a=o%1,s=1-a;let l=0;switch(Math.floor(o)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return l=(1-r)*n,[255*(r*i[0]+l),255*(r*i[1]+l),255*(r*i[2]+l)]},gm.hcg.hsv=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);let n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},gm.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},gm.hcg.hwb=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},gm.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,n=r-t;let i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},gm.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},gm.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},gm.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},gm.gray.hsl=function(e){return[0,0,e[0]]},gm.gray.hsv=gm.gray.hsl,gm.gray.hwb=function(e){return[0,100,e[0]]},gm.gray.cmyk=function(e){return[0,0,0,e[0]]},gm.gray.lab=function(e){return[e[0],0,0]},gm.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},gm.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const ym=mm;function bm(e){const t=function(){const e={},t=Object.keys(ym);for(let r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].distance=0;r.length;){const e=r.pop(),n=Object.keys(ym[e]);for(let i=n.length,o=0;o<i;o++){const i=n[o],a=t[i];-1===a.distance&&(a.distance=t[e].distance+1,a.parent=e,r.unshift(i))}}return t}function wm(e,t){return function(r){return t(e(r))}}function xm(e,t){const r=[t[e].parent,e];let n=ym[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)r.unshift(t[i].parent),n=wm(ym[t[i].parent][i],n),i=t[i].parent;return n.conversion=r,n}const Cm=mm,_m=function(e){const t=bm(e),r={},n=Object.keys(t);for(let e=n.length,i=0;i<e;i++){const e=n[i];null!==t[e].parent&&(r[e]=xm(e,t))}return r},Sm={};Object.keys(Cm).forEach(e=>{Sm[e]={},Object.defineProperty(Sm[e],"channels",{value:Cm[e].channels}),Object.defineProperty(Sm[e],"labels",{value:Cm[e].labels});const t=_m(e);Object.keys(t).forEach(r=>{const n=t[r];Sm[e][r]=function(e){const t=function(...t){const r=t[0];if(null==r)return r;r.length>1&&(t=r);const n=e(t);if("object"==typeof n)for(let e=n.length,t=0;t<e;t++)n[t]=Math.round(n[t]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}(n),Sm[e][r].raw=function(e){const t=function(...t){const r=t[0];return null==r?r:(r.length>1&&(t=r),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)})});const Am=hm,km=Sm,Em=["keyword","gray","hex"],Im={};for(const e of Object.keys(km))Im[[...km[e].labels].sort().join("")]=e;const Tm={};function Fm(e,t){if(!(this instanceof Fm))return new Fm(e,t);if(t&&t in Em&&(t=null),t&&!(t in km))throw new Error("Unknown model: "+t);let r,n;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof Fm)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if("string"==typeof e){const t=Am.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,n=km[this.model].channels,this.color=t.value.slice(0,n),this.valpha="number"==typeof t.value[n]?t.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=km[this.model].channels;const r=Array.prototype.slice.call(e,0,n);this.color=Lm(r,n),this.valpha="number"==typeof e[n]?e[n]:1}else if("number"==typeof e)this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;const t=Object.keys(e);"alpha"in e&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);const n=t.sort().join("");if(!(n in Im))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Im[n];const{labels:i}=km[this.model],o=[];for(r=0;r<i.length;r++)o.push(e[i[r]]);this.color=Lm(o)}if(Tm[this.model])for(n=km[this.model].channels,r=0;r<n;r++){const e=Tm[this.model][r];e&&(this.color[r]=e(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}Fm.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in Am.to?this:this.rgb();t=t.round("number"==typeof e?e:1);const r=1===t.valpha?t.color:[...t.color,this.valpha];return Am.to[t.model](r)},percentString(e){const t=this.rgb().round("number"==typeof e?e:1),r=1===t.valpha?t.color:[...t.color,this.valpha];return Am.to.rgb.percent(r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=km[this.model],{labels:r}=km[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];return 1!==this.valpha&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,1!==this.valpha&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,1!==this.valpha&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new Fm([...this.color.map(Om(e)),this.valpha],this.model)},alpha(e){return void 0!==e?new Fm([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:Pm("rgb",0,Mm(255)),green:Pm("rgb",1,Mm(255)),blue:Pm("rgb",2,Mm(255)),hue:Pm(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:Pm("hsl",1,Mm(100)),lightness:Pm("hsl",2,Mm(100)),saturationv:Pm("hsv",1,Mm(100)),value:Pm("hsv",2,Mm(100)),chroma:Pm("hcg",1,Mm(100)),gray:Pm("hcg",2,Mm(100)),white:Pm("hwb",1,Mm(100)),wblack:Pm("hwb",2,Mm(100)),cyan:Pm("cmyk",0,Mm(100)),magenta:Pm("cmyk",1,Mm(100)),yellow:Pm("cmyk",2,Mm(100)),black:Pm("cmyk",3,Mm(100)),x:Pm("xyz",0,Mm(95.047)),y:Pm("xyz",1,Mm(100)),z:Pm("xyz",2,Mm(108.833)),l:Pm("lab",0,Mm(100)),a:Pm("lab",1),b:Pm("lab",2),keyword(e){return void 0!==e?new Fm(e):km[this.model].keyword(this.color)},hex(e){return void 0!==e?new Fm(e):Am.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new Fm(e);const t=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),Am.to.hex(t)+r},rgbNumber(){const e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity(){const e=this.rgb().color,t=[];for(const[r,n]of e.entries()){const e=n/255;t[r]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(2126*e[0]+7152*e[1]+722*e[2])/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return Fm.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const r=e.rgb(),n=this.rgb(),i=void 0===t?.5:t,o=2*i-1,a=r.alpha()-n.alpha(),s=((o*a===-1?o:(o+a)/(1+o*a))+1)/2,l=1-s;return Fm.rgb(s*r.red()+l*n.red(),s*r.green()+l*n.green(),s*r.blue()+l*n.blue(),r.alpha()*i+n.alpha()*(1-i))}};for(const e of Object.keys(km)){if(Em.includes(e))continue;const{channels:t}=km[e];Fm.prototype[e]=function(...t){return this.model===e?new Fm(this):t.length>0?new Fm(t,e):new Fm([...Rm(km[this.model][e].raw(this.color)),this.valpha],e)},Fm[e]=function(...r){let n=r[0];return"number"==typeof n&&(n=Lm(r,t)),new Fm(n,e)}}function Om(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}function Pm(e,t,r){e=Array.isArray(e)?e:[e];for(const n of e)(Tm[n]||(Tm[n]=[]))[t]=r;return e=e[0],function(n){let i;return void 0!==n?(r&&(n=r(n)),i=this[e](),i.color[t]=n,i):(i=this[e]().color[t],r&&(i=r(i)),i)}}function Mm(e){return function(t){return Math.max(0,Math.min(e,t))}}function Rm(e){return Array.isArray(e)?e:[e]}function Lm(e,t){for(let r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}const Nm=mf(Fm);function jm(e){return e.endsWith("%")||3===e.split(" ").length?e:Nm(e).rgb().array().slice(0,3).join(" ")}let Dm=typeof document<"u"?document.getElementById("root")??document.body:void 0,zm=typeof document<"u"?document.documentElement:void 0;function Bm(e){Object.entries(e.values).forEach(([e,t])=>{!function(e,t){null==zm||zm.style.setProperty(e,t)}(e,t)}),e.is_dark?zm.classList.add("dark"):zm.classList.remove("dark")}const Um=Tp()(e=>({data:typeof window<"u"&&window.bootstrapData?Hm(window.bootstrapData):null,setData:t=>{const r="string"==typeof t?Hm(t):t;e({data:r})},mergeData:t=>{e(e=>({data:{...e.data,...t}}))}}));Um.getState().setData;const Vm=Um.getState().mergeData;function Hm(e){return"string"==typeof e?JSON.parse(e):e}const Wm={top:0,right:0,bottom:0,left:0,width:0,height:0},$m=Tp()(Fp(Kg((e,t)=>({editor:null,fabric:null,config:tp,zoom:1,dirty:!1,original:{width:1,height:1},stageSize:Wm,canvasSize:Wm,canvasRef:null,activeTool:null,activeToolOverlay:null,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1},...Og(e,t),...Vg(e,t),...Rg(e,t),...Ng(e,t),...Wg(e,t),...qg(e,t),...Yg(e,t),setZoom:t=>e(e=>{e.zoom=t}),setOriginal:(t,r)=>e(e=>{e.original={width:t,height:r}}),setDirty:t=>e(e=>{e.dirty=t}),toggleLoading:t=>e(e=>{e.loading=t}),setStageSize:t=>e(e=>{e.stageSize=t}),setCanvasSize:t=>e(e=>{e.canvasSize=t}),setActiveTool:(t,r)=>{e(e=>{e.activeTool=t,e.activeToolOverlay=r})},setConfig:r=>e(e=>{var n,i;const o=Tg(r,t().config);e.config=o;const a=o.activeLanguage||"en",s=null==(n=o.languages)?void 0:n[a],l=((null==(i=o.ui)?void 0:i.themes)||[]).map(e=>function(e){const t=e.isDark?kf.find(e=>e.isDark):kf.find(e=>!e.isDark),r={...t,...e,colors:{...null==t?void 0:t.colors,...e.colors}},n=Object.entries(r.colors).map(([e,t])=>[e,jm(t)]);return{id:r.name,name:r.name,values:Object.fromEntries(n),is_dark:r.isDark}}(e)),c=l.find(e=>{var t;return e.id===(null==(t=o.ui)?void 0:t.activeTheme)});c&&Bm(c),Vm({i18n:{language:a,name:a,id:0,lines:s},themes:{all:l}})}),togglePanel:(t,r)=>e(e=>{e.openPanels[t]=r??!e.openPanels[t]}),applyChanges:async()=>{var r;const n=t().activeTool;if(!n)return;const i=t()[n],o=await(null==(r=null==i?void 0:i.apply)?void 0:r.call(i));e(e=>{e.dirty=!1,e.activeTool=null,e.activeToolOverlay=null}),!1!==o&&t().editor.tools.history.addHistoryItem({name:n}),null==i||i.reset()},cancelChanges:async()=>{const r=t().activeTool;if(!r)return;const n=t().dirty;e(e=>{e.dirty=!1,e.activeTool=null,e.activeToolOverlay=null}),n&&await t().editor.tools.history.reload();const i=t()[r];null==i||i.reset()},reset:()=>{t().editor.tools.transform.resetStraightenAnchor(),e({activeTool:null,activeToolOverlay:null,zoom:1,dirty:!1,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1}}),t().history.reset(),t().objects.reset(),t().filter.reset(),t().crop.reset(),t().frame.reset(),t().resize.reset(),t().corners.reset()}}))));function qm(){return $m.getState()}function Gm(){return qm().editor.tools}function Ym(){return qm().fabric}function Xm(e){var t,r,n,i,o;Gm().canvas.clear(),Gm().frame.remove();const a=!(null!=(t=qm().config.ui)&&t.visible);return qm().setConfig({image:void 0,blankCanvasSize:void 0,...e}),qm().reset(),null!=(r=qm().config.ui)&&r.defaultTool&&qm().setActiveTool(null==(n=qm().config.ui)?void 0:n.defaultTool,null),a&&(null==(o=(i=qm().config).onOpen)||o.call(i)),new Promise(e=>setTimeout(e))}async function Km(e){return(await fetch(e)).json()}const Zm={selectable:!1,evented:!1,lockMovementX:!0,lockMovementY:!0,lockRotation:!0,lockScalingX:!0,lockScalingY:!0,lockUniScaling:!0,hasControls:!1,hasBorders:!1,hasRotatingPoint:!1,strokeWidth:0};function Qm(e=[]){var t;e=[...Object.keys(Zm),"crossOrigin","name","displayName","data",...e];const r=Ym().toJSON(e);r.objects=r.objects.filter(e=>!e.data.pixieInternal).map(e=>("image"===e.type&&qm().config.crossOrigin&&(e.crossOrigin="anonymous"),Dg(e)&&(e.selectable=!0,e.lockMovementX=!1,e.lockMovementY=!1,e.lockUniScaling=!1),{...e,data:e.data?{...e.data}:{}}));return{canvas:r,editor:{frame:Gm().frame.active.config?{name:Gm().frame.active.config.name,sizePercent:Gm().frame.active.currentSizeInPercent}:null,zoom:qm().zoom,activeObjectId:(null==(t=qm().objects.active)?void 0:t.id)||null},canvasWidth:qm().original.width,canvasHeight:qm().original.height}}function Jm(e=null){if(qm().dirty)return;Gm().zoom.fitToScreen();const[t,r]=ev(Ym().getActiveObject());e?qm().setActiveTool(e,t===e?r:null):qm().setActiveTool(t,r)}function ev(e){switch(null==e?void 0:e.name){case zg.Text:return[Ef.TEXT,Mg.Text];case zg.Sticker:return[Ef.STICKERS,Mg.ActiveObject];case zg.Image:return[null,Mg.ActiveObject];case zg.Shape:return[Ef.SHAPES,Mg.ActiveObject];default:return[null,null]}}let tv=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t};class rv{constructor(e,t){zl(this,"timerId"),zl(this,"createdAt",0),this.callback=e,this.remaining=t,this.resume()}pause(){clearTimeout(this.timerId),this.remaining-=Date.now()-this.createdAt}resume(){this.createdAt=Date.now(),this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout(this.callback,this.remaining)}clear(){clearTimeout(this.timerId)}}const nv=Tp()(Kg((e,t)=>({toasts:[],add:(r,n)=>{const i=t().toasts.length+1-1;i>0&&e(e=>{e.toasts.splice(0,i)});const o=(null==n?void 0:n.id)||tv(6),a=(null==n?void 0:n.type)||"positive",s=(null==n?void 0:n.duration)??function(e){switch(e){case"danger":return 8e3;case"loading":return 0;default:return 3e3}}(a),l={timer:s>0?new rv(()=>t().remove(o),s):null,message:r,...n,id:o,type:a,position:(null==n?void 0:n.position)||"bottom-center",duration:s,disableExitAnimation:null==n?void 0:n.disableExitAnimation,disableEnterAnimation:null==n?void 0:n.disableEnterAnimation},c=t().toasts.findIndex(e=>e.id===l.id);e(c>-1?e=>{e.toasts[c]=l}:e=>{e.toasts.push(l)})},remove:r=>{const n=t().toasts.filter(e=>{var t;return r!==e.id||(null==(t=e.timer)||t.clear(),!1)});e(e=>{e.toasts=n})}})));function iv(){return nv.getState()}function ov(e,t){iv().add(e,t)}ov.danger=(e,t)=>{iv().add(e,{...t,type:"danger"})},ov.positive=(e,t)=>{iv().add(e,{...t,type:"positive"})},ov.loading=(e,t)=>{iv().add(e,{...t,type:"loading"})};const av=s({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),sv=s({}),lv=s(null),cv=typeof document<"u",uv=cv?x:a,dv=s({strict:!1}),hv=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),fv="data-"+hv("framerAppearId");function pv(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function gv(e){return"string"==typeof e||Array.isArray(e)}function mv(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}const vv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...vv];function bv(e){return mv(e.animate)||yv.some(t=>gv(e[t]))}function wv(e){return!(!bv(e)&&!e.variants)}function xv(e){const{initial:t,animate:r}=function(e,t){if(bv(e)){const{initial:t,animate:r}=e;return{initial:!1===t||gv(t)?t:void 0,animate:gv(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,l(sv));return d(()=>({initial:t,animate:r}),[Cv(t),Cv(r)])}function Cv(e){return Array.isArray(e)?e.join(" "):e}const _v={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Sv={};for(const e in _v)Sv[e]={isEnabled:t=>_v[e].some(e=>!!t[e])};function Av(e){for(const t in e)Sv[t]={...Sv[t],...e[t]}}const kv=s({}),Ev=s({}),Iv=Symbol.for("motionComponentSymbol");function Tv({preloadedFeatures:e,createVisualElement:t,useRender:r,useVisualState:i,Component:o}){e&&Av(e);const s=p(function(s,d){let h;const f={...l(av),...s,layoutId:Fv(s)},{isStatic:p}=f,g=xv(s),m=i(s,p);if(!p&&cv){g.visualElement=function(e,t,r,n){const{visualElement:i}=l(sv),o=l(dv),s=l(lv),c=l(av).reducedMotion,d=u();n=n||o.renderer,!d.current&&n&&(d.current=n(e,{visualState:t,parent:i,props:r,presenceContext:s,blockInitialAnimation:!!s&&!1===s.initial,reducedMotionConfig:c}));const h=d.current;C(()=>{h&&h.update(r,s)});const f=u(!(!r[fv]||window.HandoffComplete));return uv(()=>{h&&(h.render(),f.current&&h.animationState&&h.animationState.animateChanges())}),a(()=>{h&&(h.updateFeatures(),!f.current&&h.animationState&&h.animationState.animateChanges(),f.current&&(f.current=!1,window.HandoffComplete=!0))}),h}(o,m,f,t);const r=l(Ev),n=l(dv).strict;g.visualElement&&(h=g.visualElement.loadFeatures(f,n,e,r))}return n.createElement(sv.Provider,{value:g},h&&g.visualElement?n.createElement(h,{visualElement:g.visualElement,...f}):null,r(o,s,function(e,t,r){return c(n=>{n&&e.mount&&e.mount(n),t&&(n?t.mount(n):t.unmount()),r&&("function"==typeof r?r(n):pv(r)&&(r.current=n))},[t])}(m,g.visualElement,d),m,p,g.visualElement))});return s[Iv]=o,s}function Fv({layoutId:e}){const t=l(kv).id;return t&&void 0!==e?t+"-"+e:e}const Ov=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Pv(e){return"string"==typeof e&&!e.includes("-")&&!!(Ov.indexOf(e)>-1||/[A-Z]/.test(e))}const Mv={},Rv=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Lv=new Set(Rv);function Nv(e,{layout:t,layoutId:r}){return Lv.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!Mv[e]||"opacity"===e)}const jv=e=>!(!e||!e.getVelocity),Dv={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},zv=Rv.length;const Bv=e=>t=>"string"==typeof t&&t.startsWith(e),Uv=Bv("--"),Vv=Bv("var(--"),Hv=(e,t)=>t&&"number"==typeof e?t.transform(e):e,Wv=(e,t,r)=>Math.min(Math.max(r,e),t),$v={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},qv={...$v,transform:e=>Wv(0,1,e)},Gv={...$v,default:1},Yv=e=>Math.round(1e5*e)/1e5,Xv=/(-)?([\d]*\.?[\d])+/g,Kv=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Zv=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Qv(e){return"string"==typeof e}const Jv=e=>({test:t=>Qv(t)&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),ey=Jv("deg"),ty=Jv("%"),ry=Jv("px"),ny=Jv("vh"),iy=Jv("vw"),oy={...ty,parse:e=>ty.parse(e)/100,transform:e=>ty.transform(100*e)},ay={...$v,transform:Math.round},sy={borderWidth:ry,borderTopWidth:ry,borderRightWidth:ry,borderBottomWidth:ry,borderLeftWidth:ry,borderRadius:ry,radius:ry,borderTopLeftRadius:ry,borderTopRightRadius:ry,borderBottomRightRadius:ry,borderBottomLeftRadius:ry,width:ry,maxWidth:ry,height:ry,maxHeight:ry,size:ry,top:ry,right:ry,bottom:ry,left:ry,padding:ry,paddingTop:ry,paddingRight:ry,paddingBottom:ry,paddingLeft:ry,margin:ry,marginTop:ry,marginRight:ry,marginBottom:ry,marginLeft:ry,rotate:ey,rotateX:ey,rotateY:ey,rotateZ:ey,scale:Gv,scaleX:Gv,scaleY:Gv,scaleZ:Gv,skew:ey,skewX:ey,skewY:ey,distance:ry,translateX:ry,translateY:ry,translateZ:ry,x:ry,y:ry,z:ry,perspective:ry,transformPerspective:ry,opacity:qv,originX:oy,originY:oy,originZ:ry,zIndex:ay,fillOpacity:qv,strokeOpacity:qv,numOctaves:ay};function ly(e,t,r,n){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,c=!1,u=!0;for(const e in t){const r=t[e];if(Uv(e)){o[e]=r;continue}const n=sy[e],d=Hv(r,n);if(Lv.has(e)){if(l=!0,a[e]=d,!u)continue;r!==(n.default||0)&&(u=!1)}else e.startsWith("origin")?(c=!0,s[e]=d):i[e]=d}if(t.transform||(l||n?i.transform=function(e,{enableHardwareAcceleration:t=!0,allowTransformNone:r=!0},n,i){let o="";for(let t=0;t<zv;t++){const r=Rv[t];void 0!==e[r]&&(o+=`${Dv[r]||r}(${e[r]}) `)}return t&&!e.z&&(o+="translateZ(0)"),o=o.trim(),i?o=i(e,n?"":o):r&&n&&(o="none"),o}(e.transform,r,u,n):i.transform&&(i.transform="none")),c){const{originX:e="50%",originY:t="50%",originZ:r=0}=s;i.transformOrigin=`${e} ${t} ${r}`}}const cy=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function uy(e,t,r){for(const n in t)!jv(t[n])&&!Nv(n,r)&&(e[n]=t[n])}function dy(e,t,r){const n={};return uy(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t,r){return d(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return ly(n,t,{enableHardwareAcceleration:!r},e),Object.assign({},n.vars,n.style)},[t])}(e,t,r)),e.transformValues?e.transformValues(n):n}function hy(e,t,r){const n={},i=dy(e,t,r);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}const fy=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function py(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||fy.has(e)}let gy=e=>!py(e);try{!function(e){e&&(gy=t=>t.startsWith("on")?!py(t):e(t))}(require("@emotion/is-prop-valid").default)}catch{}function my(e,t,r){const n={};for(const i in e)"values"===i&&"object"==typeof e.values||(gy(i)||!0===r&&py(i)||!t&&!py(i)||e.draggable&&i.startsWith("onDrag"))&&(n[i]=e[i]);return n}function vy(e,t,r){return"string"==typeof e?e:ry.transform(t+r*e)}const yy={offset:"stroke-dashoffset",array:"stroke-dasharray"},by={offset:"strokeDashoffset",array:"strokeDasharray"};function wy(e,{attrX:t,attrY:r,attrScale:n,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...c},u,d,h){if(ly(e,c,u,h),d)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:f,style:p,dimensions:g}=e;f.transform&&(g&&(p.transform=f.transform),delete f.transform),g&&(void 0!==i||void 0!==o||p.transform)&&(p.transformOrigin=function(e,t,r){return`${vy(t,e.x,e.width)} ${vy(r,e.y,e.height)}`}(g,void 0!==i?i:.5,void 0!==o?o:.5)),void 0!==t&&(f.x=t),void 0!==r&&(f.y=r),void 0!==n&&(f.scale=n),void 0!==a&&function(e,t,r=1,n=0,i=!0){e.pathLength=1;const o=i?yy:by;e[o.offset]=ry.transform(-n);const a=ry.transform(t),s=ry.transform(r);e[o.array]=`${a} ${s}`}(f,a,s,l,!1)}const xy=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}}),Cy=e=>"string"==typeof e&&"svg"===e.toLowerCase();function _y(e,t,r,n){const i=d(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return wy(r,t,{enableHardwareAcceleration:!1},Cy(n),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const t={};uy(t,e.style,e),i.style={...t,...i.style}}return i}function Sy(e=!1){return(t,r,n,{latestValues:i},o)=>{const a=(Pv(t)?_y:hy)(r,i,o,t),s={...my(r,"string"==typeof t,e),...a,ref:n},{children:l}=r,c=d(()=>jv(l)?l.get():l,[l]);return h(t,{...s,children:c})}}function Ay(e,{style:t,vars:r},n,i){Object.assign(e.style,t,i&&i.getProjectionStyles(n));for(const t in r)e.style.setProperty(t,r[t])}const ky=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Ey(e,t,r,n){Ay(e,t,void 0,n);for(const r in t.attrs)e.setAttribute(ky.has(r)?r:hv(r),t.attrs[r])}function Iy(e,t){const{style:r}=e,n={};for(const i in r)(jv(r[i])||t.style&&jv(t.style[i])||Nv(i,e))&&(n[i]=r[i]);return n}function Ty(e,t){const r=Iy(e,t);for(const n in e)if(jv(e[n])||jv(t[n])){r[-1!==Rv.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]}return r}function Fy(e,t,r,n={},i={}){return"function"==typeof t&&(t=t(void 0!==r?r:e.custom,n,i)),"string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t&&(t=t(void 0!==r?r:e.custom,n,i)),t}function Oy(e){const t=u(null);return null===t.current&&(t.current=e()),t.current}const Py=e=>Array.isArray(e),My=e=>Py(e)?e[e.length-1]||0:e;function Ry(e){const t=jv(e)?e.get():e;return(e=>!!(e&&"object"==typeof e&&e.mix&&e.toValue))(t)?t.toValue():t}const Ly=e=>(t,r)=>{const n=l(sv),i=l(lv),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:r},n,i,o){const a={latestValues:Ny(n,i,o,e),renderState:t()};return r&&(a.mount=e=>r(n,e,a)),a}(e,t,n,i);return r?o():Oy(o)};function Ny(e,t,r,n){const i={},o=n(e,{});for(const e in o)i[e]=Ry(o[e]);let{initial:a,animate:s}=e;const l=bv(e),c=wv(e);t&&c&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===s&&(s=t.animate));let u=!!r&&!1===r.initial;u=u||!1===a;const d=u?s:a;return d&&"boolean"!=typeof d&&!mv(d)&&(Array.isArray(d)?d:[d]).forEach(t=>{const r=Fy(e,t);if(!r)return;const{transitionEnd:n,transition:o,...a}=r;for(const e in a){let t=a[e];if(Array.isArray(t)){t=t[u?t.length-1:0]}null!==t&&(i[e]=t)}for(const e in n)i[e]=n[e]}),i}const jy=e=>e;class Dy{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const t=this.order.indexOf(e);-1!==t&&(this.order.splice(t,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}const zy=["prepare","read","update","preRender","render","postRender"];const{schedule:By,cancel:Uy,state:Vy}=function(e,t){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=zy.reduce((e,t)=>(e[t]=function(e){let t=new Dy,r=new Dy,n=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(e,o=!1,s=!1)=>{const l=s&&i,c=l?t:r;return o&&a.add(e),c.add(e)&&l&&i&&(n=t.order.length),e},cancel:e=>{r.remove(e),a.delete(e)},process:l=>{if(i)o=!0;else{if(i=!0,[t,r]=[r,t],r.clear(),n=t.order.length,n)for(let r=0;r<n;r++){const n=t.order[r];n(l),a.has(n)&&(s.schedule(n),e())}i=!1,o&&(o=!1,s.process(l))}}};return s}(()=>r=!0),e),{}),a=e=>o[e].process(i),s=()=>{const o=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(o-i.timestamp,40),1),i.timestamp=o,i.isProcessing=!0,zy.forEach(a),i.isProcessing=!1,r&&t&&(n=!1,e(s))};return{schedule:zy.reduce((t,a)=>{const l=o[a];return t[a]=(t,o=!1,a=!1)=>(r||(r=!0,n=!0,i.isProcessing||e(s)),l.schedule(t,o,a)),t},{}),cancel:e=>zy.forEach(t=>o[t].cancel(e)),state:i,steps:o}}(typeof requestAnimationFrame<"u"?requestAnimationFrame:jy,!0),Hy={useVisualState:Ly({scrapeMotionValuesFromProps:Ty,createRenderState:xy,onMount:(e,t,{renderState:r,latestValues:n})=>{By.read(()=>{try{r.dimensions="function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),By.render(()=>{wy(r,n,{enableHardwareAcceleration:!1},Cy(t.tagName),e.transformTemplate),Ey(t,r)})}})},Wy={useVisualState:Ly({scrapeMotionValuesFromProps:Iy,createRenderState:cy})};function $y(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}function qy(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}function Gy(e,t,r,n){return $y(e,t,(e=>t=>(e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary)(t)&&e(t,qy(t)))(r),n)}const Yy=(e,t)=>r=>t(e(r)),Xy=(...e)=>e.reduce(Yy);function Ky(e){let t=null;return()=>null===t&&(t=e,()=>{t=null})}const Zy=Ky("dragHorizontal"),Qy=Ky("dragVertical");function Jy(){const e=function(){let e=!1;{const t=Zy(),r=Qy();t&&r?e=()=>{t(),r()}:(t&&t(),r&&r())}return e}();return!e||(e(),!1)}class eb{constructor(e){this.isMounted=!1,this.node=e}update(){}}function tb(e,t){const r="pointer"+(t?"enter":"leave"),n="onHover"+(t?"Start":"End");return Gy(e.current,r,(r,i)=>{if("touch"===r.pointerType||Jy())return;const o=e.getProps();e.animationState&&o.whileHover&&e.animationState.setActive("whileHover",t),o[n]&&By.update(()=>o[n](r,i))},{passive:!e.getProps()[n]})}const rb=(e,t)=>!!t&&(e===t||rb(e,t.parentElement));function nb(e,t){if(!t)return;const r=new PointerEvent("pointer"+e);t(r,qy(r))}const ib=new WeakMap,ob=new WeakMap,ab=e=>{const t=ib.get(e.target);t&&t(e)},sb=e=>{e.forEach(ab)};function lb(e,t,r){const n=function({root:e,...t}){const r=e||document;ob.has(r)||ob.set(r,{});const n=ob.get(r),i=JSON.stringify(t);return n[i]||(n[i]=new IntersectionObserver(sb,{root:e,...t})),n[i]}(t);return ib.set(e,r),n.observe(e),()=>{ib.delete(e),n.unobserve(e)}}const cb={some:0,all:1};const ub={inView:{Feature:class extends eb{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:n="some",once:i}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:"number"==typeof n?n:cb[n]};return lb(this.node.current,o,e=>{const{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),o=t?r:n;o&&o(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends eb{constructor(){super(...arguments),this.removeStartListeners=jy,this.removeEndListeners=jy,this.removeAccessibleListeners=jy,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),n=Gy(window,"pointerup",(e,t)=>{if(!this.checkPressEnd())return;const{onTap:r,onTapCancel:n,globalTapTarget:i}=this.node.getProps();By.update(()=>{i||rb(this.node.current,e.target)?r&&r(e,t):n&&n(e,t)})},{passive:!(r.onTap||r.onPointerUp)}),i=Gy(window,"pointercancel",(e,t)=>this.cancelPress(e,t),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Xy(n,i),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=$y(this.node.current,"keydown",e=>{if("Enter"!==e.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=$y(this.node.current,"keyup",e=>{"Enter"!==e.key||!this.checkPressEnd()||nb("up",(e,t)=>{const{onTap:r}=this.node.getProps();r&&By.update(()=>r(e,t))})}),nb("down",(e,t)=>{this.startPress(e,t)})}),t=$y(this.node.current,"blur",()=>{this.isPressing&&nb("cancel",(e,t)=>this.cancelPress(e,t))});this.removeAccessibleListeners=Xy(e,t)}}startPress(e,t){this.isPressing=!0;const{onTapStart:r,whileTap:n}=this.node.getProps();n&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&By.update(()=>r(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Jy()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&By.update(()=>r(e,t))}mount(){const e=this.node.getProps(),t=Gy(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=$y(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Xy(t,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends eb{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xy($y(this.node.current,"focus",()=>this.onFocus()),$y(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends eb{mount(){this.unmount=Xy(tb(this.node,!0),tb(this.node,!1))}unmount(){}}}};function db(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function hb(e,t,r){const n=e.getProps();return Fy(n,t,void 0!==r?r:n.custom,function(e){const t={};return e.values.forEach((e,r)=>t[r]=e.get()),t}(e),function(e){const t={};return e.values.forEach((e,r)=>t[r]=e.getVelocity()),t}(e))}let fb=jy;const pb=e=>1e3*e,gb=e=>e/1e3,mb=!1,vb=e=>Array.isArray(e)&&"number"==typeof e[0];function yb(e){return!!(!e||"string"==typeof e&&wb[e]||vb(e)||Array.isArray(e)&&e.every(yb))}const bb=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,wb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:bb([0,.65,.55,1]),circOut:bb([.55,0,1,.45]),backIn:bb([.31,.01,.66,-.59]),backOut:bb([.33,1.53,.69,.99])};function xb(e){if(e)return vb(e)?bb(e):Array.isArray(e)?e.map(xb):wb[e]}const Cb=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function _b(e,t,r,n){if(e===t&&r===n)return jy;const i=t=>function(e,t,r,n,i){let o,a,s=0;do{a=t+(r-t)/2,o=Cb(a,n,i)-e,o>0?r=a:t=a}while(Math.abs(o)>1e-7&&++s<12);return a}(t,0,1,e,r);return e=>0===e||1===e?e:Cb(i(e),t,n)}const Sb=_b(.42,0,1,1),Ab=_b(0,0,.58,1),kb=_b(.42,0,.58,1),Eb=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ib=e=>t=>1-e(1-t),Tb=e=>1-Math.sin(Math.acos(e)),Fb=Ib(Tb),Ob=Eb(Tb),Pb=_b(.33,1.53,.69,.99),Mb=Ib(Pb),Rb=Eb(Mb),Lb={linear:jy,easeIn:Sb,easeInOut:kb,easeOut:Ab,circIn:Tb,circInOut:Ob,circOut:Fb,backIn:Mb,backInOut:Rb,backOut:Pb,anticipate:e=>(e*=2)<1?.5*Mb(e):.5*(2-Math.pow(2,-10*(e-1)))},Nb=e=>{if(Array.isArray(e)){fb(4===e.length);const[t,r,n,i]=e;return _b(t,r,n,i)}return"string"==typeof e?Lb[e]:e},jb=(e,t)=>r=>!!(Qv(r)&&Zv.test(r)&&r.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(r,t)),Db=(e,t,r)=>n=>{if(!Qv(n))return n;const[i,o,a,s]=n.match(Xv);return{[e]:parseFloat(i),[t]:parseFloat(o),[r]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},zb={...$v,transform:e=>Math.round((e=>Wv(0,255,e))(e))},Bb={test:jb("rgb","red"),parse:Db("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+zb.transform(e)+", "+zb.transform(t)+", "+zb.transform(r)+", "+Yv(qv.transform(n))+")"};const Ub={test:jb("#"),parse:function(e){let t="",r="",n="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:Bb.transform},Vb={test:jb("hsl","hue"),parse:Db("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+ty.transform(Yv(t))+", "+ty.transform(Yv(r))+", "+Yv(qv.transform(n))+")"},Hb={test:e=>Bb.test(e)||Ub.test(e)||Vb.test(e),parse:e=>Bb.test(e)?Bb.parse(e):Vb.test(e)?Vb.parse(e):Ub.parse(e),transform:e=>Qv(e)?e:e.hasOwnProperty("red")?Bb.transform(e):Vb.transform(e)},Wb=(e,t,r)=>-r*e+r*t+e;function $b(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}const qb=(e,t,r)=>{const n=e*e;return Math.sqrt(Math.max(0,r*(t*t-n)+n))},Gb=[Ub,Bb,Vb];function Yb(e){const t=(e=>Gb.find(t=>t.test(e)))(e);let r=t.parse(e);return t===Vb&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let i=0,o=0,a=0;if(t/=100){const n=r<.5?r*(1+t):r+t-r*t,s=2*r-n;i=$b(s,n,e+1/3),o=$b(s,n,e),a=$b(s,n,e-1/3)}else i=o=a=r;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*a),alpha:n}}(r)),r}const Xb=(e,t)=>{const r=Yb(e),n=Yb(t),i={...r};return e=>(i.red=qb(r.red,n.red,e),i.green=qb(r.green,n.green,e),i.blue=qb(r.blue,n.blue,e),i.alpha=Wb(r.alpha,n.alpha,e),Bb.transform(i))};const Kb={regex:/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,countKey:"Vars",token:"${v}",parse:jy},Zb={regex:Kv,countKey:"Colors",token:"${c}",parse:Hb.parse},Qb={regex:Xv,countKey:"Numbers",token:"${n}",parse:$v.parse};function Jb(e,{regex:t,countKey:r,token:n,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+r]=o.length,e.tokenised=e.tokenised.replace(t,n),e.values.push(...o.map(i)))}function ew(e){const t=e.toString(),r={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return r.value.includes("var(--")&&Jb(r,Kb),Jb(r,Zb),Jb(r,Qb),r}function tw(e){return ew(e).values}function rw(e){const{values:t,numColors:r,numVars:n,tokenised:i}=ew(e),o=t.length;return e=>{let t=i;for(let i=0;i<o;i++)t=i<n?t.replace(Kb.token,e[i]):i<n+r?t.replace(Zb.token,Hb.transform(e[i])):t.replace(Qb.token,Yv(e[i]));return t}}const nw=e=>"number"==typeof e?0:e;const iw={test:function(e){var t,r;return isNaN(e)&&Qv(e)&&((null===(t=e.match(Xv))||void 0===t?void 0:t.length)||0)+((null===(r=e.match(Kv))||void 0===r?void 0:r.length)||0)>0},parse:tw,createTransformer:rw,getAnimatableNone:function(e){const t=tw(e);return rw(e)(t.map(nw))}},ow=(e,t)=>r=>`${r>0?t:e}`;function aw(e,t){return"number"==typeof e?r=>Wb(e,t,r):Hb.test(e)?Xb(e,t):e.startsWith("var(")?ow(e,t):cw(e,t)}const sw=(e,t)=>{const r=[...e],n=r.length,i=e.map((e,r)=>aw(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=i[t](e);return r}},lw=(e,t)=>{const r={...e,...t},n={};for(const i in r)void 0!==e[i]&&void 0!==t[i]&&(n[i]=aw(e[i],t[i]));return e=>{for(const t in n)r[t]=n[t](e);return r}},cw=(e,t)=>{const r=iw.createTransformer(t),n=ew(e),i=ew(t);return n.numVars===i.numVars&&n.numColors===i.numColors&&n.numNumbers>=i.numNumbers?Xy(sw(n.values,i.values),r):ow(e,t)},uw=(e,t,r)=>{const n=t-e;return 0===n?1:(r-e)/n},dw=(e,t)=>r=>Wb(e,t,r);function hw(e,t,r){const n=[],i=r||function(e){return"number"==typeof e?dw:"string"==typeof e?Hb.test(e)?Xb:cw:Array.isArray(e)?sw:"object"==typeof e?lw:dw}(e[0]),o=e.length-1;for(let r=0;r<o;r++){let o=i(e[r],e[r+1]);if(t){const e=Array.isArray(t)?t[r]||jy:t;o=Xy(e,o)}n.push(o)}return n}function fw(e,t,{clamp:r=!0,ease:n,mixer:i}={}){const o=e.length;if(fb(o===t.length),1===o)return()=>t[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=hw(t,n,i),s=a.length,l=t=>{let r=0;if(s>1)for(;r<e.length-2&&!(t<e[r+1]);r++);const n=uw(e[r],e[r+1],t);return a[r](n)};return r?t=>l(Wv(e[0],e[o-1],t)):l}function pw(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const i=uw(0,t,n);e.push(Wb(r,1,i))}}(t,e.length-1),t}function gw(e,t){return e.map(()=>t||kb).splice(0,e.length-1)}function mw({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const i=(e=>Array.isArray(e)&&"number"!=typeof e[0])(n)?n.map(Nb):Nb(n),o={done:!1,value:t[0]},a=function(e,t){return e.map(e=>e*t)}(r&&r.length===t.length?r:pw(t),e),s=fw(a,t,{ease:Array.isArray(i)?i:gw(t,i)});return{calculatedDuration:e,next:t=>(o.value=s(t),o.done=t>=e,o)}}function vw(e,t){return t?e*(1e3/t):0}function yw(e,t,r){const n=Math.max(t-5,0);return vw(r-e(n),t-n)}const bw=.001;function ww({duration:e=800,bounce:t=.25,velocity:r=0,mass:n=1}){let i,o,a=1-t;a=Wv(.05,1,a),e=Wv(.01,10,gb(e)),a<1?(i=t=>{const n=t*a,i=n*e,o=n-r,s=Cw(t,a),l=Math.exp(-i);return bw-o/s*l},o=t=>{const n=t*a*e,o=n*r+r,s=Math.pow(a,2)*Math.pow(t,2)*e,l=Math.exp(-n),c=Cw(Math.pow(t,2),a);return(-i(t)+bw>0?-1:1)*((o-s)*l)/c}):(i=t=>Math.exp(-t*e)*((t-r)*e+1)-bw,o=t=>Math.exp(-t*e)*(e*e*(r-t)));const s=function(e,t,r){let n=r;for(let r=1;r<xw;r++)n-=e(n)/t(n);return n}(i,o,5/e);if(e=pb(e),isNaN(s))return{stiffness:100,damping:10,duration:e};{const t=Math.pow(s,2)*n;return{stiffness:t,damping:2*a*Math.sqrt(n*t),duration:e}}}const xw=12;function Cw(e,t){return e*Math.sqrt(1-t*t)}const _w=["duration","bounce"],Sw=["stiffness","damping","mass"];function Aw(e,t){return t.some(t=>void 0!==e[t])}function kw({keyframes:e,restDelta:t,restSpeed:r,...n}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:c,duration:u,velocity:d,isResolvedFromDuration:h}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Aw(e,Sw)&&Aw(e,_w)){const r=ww(e);t={...t,...r,mass:1},t.isResolvedFromDuration=!0}return t}({...n,velocity:-gb(n.velocity||0)}),f=d||0,p=l/(2*Math.sqrt(s*c)),g=o-i,m=gb(Math.sqrt(s/c)),v=Math.abs(g)<5;let y;if(r||(r=v?.01:2),t||(t=v?.005:.5),p<1){const e=Cw(m,p);y=t=>{const r=Math.exp(-p*m*t);return o-r*((f+p*m*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}}else if(1===p)y=e=>o-Math.exp(-m*e)*(g+(f+m*g)*e);else{const e=m*Math.sqrt(p*p-1);y=t=>{const r=Math.exp(-p*m*t),n=Math.min(e*t,300);return o-r*((f+p*m*g)*Math.sinh(n)+e*g*Math.cosh(n))/e}}return{calculatedDuration:h&&u||null,next:e=>{const n=y(e);if(h)a.done=e>=u;else{let i=f;0!==e&&(i=p<1?yw(y,e,n):0);const s=Math.abs(i)<=r,l=Math.abs(o-n)<=t;a.done=s&&l}return a.value=a.done?o:n,a}}}function Ew({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],h={done:!1,value:d},f=e=>void 0===s?l:void 0===l||Math.abs(s-e)<Math.abs(l-e)?s:l;let p=r*t;const g=d+p,m=void 0===a?g:a(g);m!==g&&(p=m-d);const v=e=>-p*Math.exp(-e/n),y=e=>m+v(e),b=e=>{const t=v(e),r=y(e);h.done=Math.abs(t)<=c,h.value=h.done?m:r};let w,x;const C=e=>{(e=>void 0!==s&&e<s||void 0!==l&&e>l)(h.value)&&(w=e,x=kw({keyframes:[h.value,f(h.value)],velocity:yw(y,e,h.value),damping:i,stiffness:o,restDelta:c,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&void 0===w&&(t=!0,b(e),C(e)),void 0!==w&&e>w?x.next(e-w):(!t&&b(e),h)}}}const Iw=e=>{const t=({timestamp:t})=>e(t);return{start:()=>By.update(t,!0),stop:()=>Uy(t),now:()=>Vy.isProcessing?Vy.timestamp:performance.now()}};function Tw(e){let t=0;let r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}const Fw={decay:Ew,inertia:Ew,tween:mw,keyframes:mw,spring:kw};function Ow({autoplay:e=!0,delay:t=0,driver:r=Iw,keyframes:n,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:c,onComplete:u,onUpdate:d,...h}){let f,p,g=1,m=!1;const v=()=>{p=new Promise(e=>{f=e})};let y;v();const b=Fw[i]||mw;let w;b!==mw&&"number"!=typeof n[0]&&(w=fw([0,100],n,{clamp:!1}),n=[0,100]);const x=b({...h,keyframes:n});let C;"mirror"===s&&(C=b({...h,keyframes:[...n].reverse(),velocity:-(h.velocity||0)}));let _="idle",S=null,A=null,k=null;null===x.calculatedDuration&&o&&(x.calculatedDuration=Tw(x));const{calculatedDuration:E}=x;let I=1/0,T=1/0;null!==E&&(I=E+a,T=I*(o+1)-a);let F=0;const O=e=>{if(null===A)return;g>0&&(A=Math.min(A,e)),g<0&&(A=Math.min(e-T/g,A)),F=null!==S?S:Math.round(e-A)*g;const r=F-t*(g>=0?1:-1),i=g>=0?r<0:r>T;F=Math.max(r,0),"finished"===_&&null===S&&(F=T);let l=F,c=x;if(o){const e=Math.min(F,T)/I;let t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,t=Math.min(t,o+1),!!(t%2)&&("reverse"===s?(r=1-r,a&&(r-=a/I)):"mirror"===s&&(c=C)),l=Wv(0,1,r)*I}const u=i?{done:!1,value:n[0]}:c.next(l);w&&(u.value=w(u.value));let{done:h}=u;!i&&null!==E&&(h=g>=0?F>=T:F<=0);const f=null===S&&("finished"===_||"running"===_&&h);return d&&d(u.value),f&&R(),u},P=()=>{y&&y.stop(),y=void 0},M=()=>{_="idle",P(),f(),v(),A=k=null},R=()=>{_="finished",u&&u(),P(),f()},L=()=>{if(m)return;y||(y=r(O));const e=y.now();l&&l(),null!==S?A=e-S:(!A||"finished"===_)&&(A=e),"finished"===_&&v(),k=A,S=null,_="running",y.start()};e&&L();const N={then:(e,t)=>p.then(e,t),get time(){return gb(F)},set time(e){e=pb(e),F=e,null===S&&y&&0!==g?A=y.now()-e/g:S=e},get duration(){const e=null===x.calculatedDuration?Tw(x):x.calculatedDuration;return gb(e)},get speed(){return g},set speed(e){e===g||!y||(g=e,N.time=gb(F))},get state(){return _},play:L,pause:()=>{_="paused",S=F},stop:()=>{m=!0,"idle"!==_&&(_="idle",c&&c(),M())},cancel:()=>{null!==k&&O(k),M()},complete:()=>{_="finished"},sample:e=>(A=0,O(e))};return N}const Pw=function(e){let t;return()=>(void 0===t&&(t=e()),t)}(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Mw=new Set(["opacity","clipPath","filter","transform","backgroundColor"]);function Rw(e,t,{onUpdate:r,onComplete:n,...i}){if(!Pw()||!Mw.has(t)||i.repeatDelay||"mirror"===i.repeatType||0===i.damping||"inertia"===i.type)return!1;let o,a,s=!1,l=!1;const c=()=>{a=new Promise(e=>{o=e})};c();let{keyframes:u,duration:d=300,ease:h,times:f}=i;if(((e,t)=>"spring"===t.type||"backgroundColor"===e||!yb(t.ease))(t,i)){const e=Ow({...i,repeat:0,delay:0});let t={done:!1,value:u[0]};const r=[];let n=0;for(;!t.done&&n<2e4;)t=e.sample(n),r.push(t.value),n+=10;f=void 0,u=r,d=n-10,h="linear"}const p=function(e,t,r,{delay:n=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const c={[t]:r};l&&(c.offset=l);const u=xb(s);return Array.isArray(u)&&(c.easing=u),e.animate(c,{delay:n,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===a?"alternate":"normal"})}(e.owner.current,t,u,{...i,duration:d,ease:h,times:f}),g=()=>{l=!1,p.cancel()},m=()=>{l=!0,By.update(g),o(),c()};return p.onfinish=()=>{l||(e.set(function(e,{repeat:t,repeatType:r="loop"}){return e[t&&"loop"!==r&&t%2==1?0:e.length-1]}(u,i)),n&&n(),m())},{then:(e,t)=>a.then(e,t),attachTimeline:e=>(p.timeline=e,p.onfinish=null,jy),get time(){return gb(p.currentTime||0)},set time(e){p.currentTime=pb(e)},get speed(){return p.playbackRate},set speed(e){p.playbackRate=e},get duration(){return gb(d)},play:()=>{s||(p.play(),Uy(g))},pause:()=>p.pause(),stop:()=>{if(s=!0,"idle"===p.playState)return;const{currentTime:t}=p;if(t){const r=Ow({...i,autoplay:!1});e.setWithVelocity(r.sample(t-10).value,r.sample(t).value,10)}m()},complete:()=>{l||p.finish()},cancel:m}}const Lw={type:"spring",stiffness:500,damping:25,restSpeed:10},Nw={type:"keyframes",duration:.8},jw={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Dw=(e,{keyframes:t})=>t.length>2?Nw:Lv.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):Lw:jw,zw=(e,t)=>"zIndex"!==e&&!("number"!=typeof t&&!Array.isArray(t)&&("string"!=typeof t||!iw.test(t)&&"0"!==t||t.startsWith("url("))),Bw=new Set(["brightness","contrast","saturate","opacity"]);function Uw(e){const[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=r.match(Xv)||[];if(!n)return e;const i=r.replace(n,"");let o=Bw.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+i+")"}const Vw=/([a-z-]*)\(.*?\)/g,Hw={...iw,getAnimatableNone:e=>{const t=e.match(Vw);return t?t.map(Uw).join(" "):e}},Ww={...sy,color:Hb,backgroundColor:Hb,outlineColor:Hb,fill:Hb,stroke:Hb,borderColor:Hb,borderTopColor:Hb,borderRightColor:Hb,borderBottomColor:Hb,borderLeftColor:Hb,filter:Hw,WebkitFilter:Hw},$w=e=>Ww[e];function qw(e,t){let r=$w(e);return r!==Hw&&(r=iw),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const Gw=e=>/^0[^.\s]+$/.test(e);function Yw(e){return"number"==typeof e?0===e:null!==e?"none"===e||"0"===e||Gw(e):void 0}function Xw(e,t){return e[t]||e.default||e}const Kw=!1,Zw=(e,t,r,n={})=>i=>{const o=Xw(n,e)||{},a=o.delay||n.delay||0;let{elapsed:s=0}=n;s-=pb(a);const l=function(e,t,r,n){const i=zw(t,r);let o;o=Array.isArray(r)?[...r]:[null,r];const a=void 0!==n.from?n.from:e.get();let s;const l=[];for(let e=0;e<o.length;e++)null===o[e]&&(o[e]=0===e?a:o[e-1]),Yw(o[e])&&l.push(e),"string"==typeof o[e]&&"none"!==o[e]&&"0"!==o[e]&&(s=o[e]);if(i&&l.length&&s)for(let e=0;e<l.length;e++)o[l[e]]=qw(t,s);return o}(t,e,r,o),c=l[0],u=l[l.length-1],d=zw(e,c),h=zw(e,u);let f={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(function({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:o,repeatType:a,repeatDelay:s,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(o)||(f={...f,...Dw(e,f)}),f.duration&&(f.duration=pb(f.duration)),f.repeatDelay&&(f.repeatDelay=pb(f.repeatDelay)),!d||!h||mb||!1===o.type||Kw)return function({keyframes:e,delay:t,onUpdate:r,onComplete:n}){const i=()=>(r&&r(e[e.length-1]),n&&n(),{time:0,speed:1,duration:0,play:jy,pause:jy,stop:jy,then:e=>(e(),Promise.resolve()),cancel:jy,complete:jy});return t?Ow({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}(f);if(!n.isHandoff&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const r=Rw(t,e,f);if(r)return r}return Ow(f)};function Qw(e){return!(!jv(e)||!e.add)}const Jw=e=>/^\-?\d*\.?\d+$/.test(e);class ex{constructor(){this.subscriptions=[]}add(e){return function(e,t){-1===e.indexOf(t)&&e.push(t)}(this.subscriptions,e),()=>function(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}(this.subscriptions,e)}notify(e,t,r){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let i=0;i<n;i++){const n=this.subscriptions[i];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class tx{constructor(e,t={}){this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(e,t=!0)=>{this.prev=this.current,this.current=e;const{delta:r,timestamp:n}=Vy;this.lastUpdated!==n&&(this.timeDelta=r,this.lastUpdated=n,By.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>By.postRender(this.velocityCheck),this.velocityCheck=({timestamp:e})=>{e!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=(e=>!isNaN(parseFloat(e)))(this.current),this.owner=t.owner}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new ex);const r=this.events[e].add(t);return"change"===e?()=>{r(),By.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){t&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,t)}setWithVelocity(e,t,r){this.set(t),this.prev=e,this.timeDelta=r}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?vw(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function rx(e,t){return new tx(e,t)}const nx=e=>t=>t.test(e),ix=[$v,ry,ty,ey,iy,ny,{test:e=>"auto"===e,parse:e=>e}],ox=e=>ix.find(nx(e)),ax=[...ix,Hb,iw],sx=e=>ax.find(nx(e));function lx(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,rx(r))}function cx(e,t){return t?(t[e]||t.default||t).from:void 0}function ux({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}function dx(e,t){const r=e.get();if(!Array.isArray(t))return r!==t;for(let e=0;e<t.length;e++)if(t[e]!==r)return!0}function hx(e,t,{delay:r=0,transitionOverride:n,type:i}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:a,...s}=e.makeTargetAnimatable(t);const l=e.getValue("willChange");n&&(o=n);const c=[],u=i&&e.animationState&&e.animationState.getState()[i];for(const t in s){const n=e.getValue(t),i=s[t];if(!n||void 0===i||u&&ux(u,t))continue;const a={delay:r,elapsed:0,...Xw(o||{},t)};if(window.HandoffAppearAnimations){const r=e.getProps()[fv];if(r){const e=window.HandoffAppearAnimations(r,t,n,By);null!==e&&(a.elapsed=e,a.isHandoff=!0)}}let d=!a.isHandoff&&!dx(n,i);if("spring"===a.type&&(n.getVelocity()||a.velocity)&&(d=!1),n.animation&&(d=!1),d)continue;n.start(Zw(t,n,i,e.shouldReduceMotion&&Lv.has(t)?{type:!1}:a));const h=n.animation;Qw(l)&&(l.add(t),h.then(()=>l.remove(t))),c.push(h)}return a&&Promise.all(c).then(()=>{a&&function(e,t){const r=hb(e,t);let{transitionEnd:n={},transition:i={},...o}=r?e.makeTargetAnimatable(r,!1):{};o={...o,...n};for(const t in o)lx(e,t,My(o[t]))}(e,a)}),c}function fx(e,t,r={}){const n=hb(e,t,r.custom);let{transition:i=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);const o=n?()=>Promise.all(hx(e,n,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(e,t,r=0,n=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*n,l=1===i?(e=0)=>e*n:(e=0)=>s-e*n;return Array.from(e.variantChildren).sort(px).forEach((e,n)=>{e.notify("AnimationStart",t),a.push(fx(e,t,{...o,delay:r+l(n)}).then(()=>e.notify("AnimationComplete",t)))}),Promise.all(a)}(e,t,o+n,a,s,r)}:()=>Promise.resolve(),{when:s}=i;if(s){const[e,t]="beforeChildren"===s?[o,a]:[a,o];return e().then(()=>t())}return Promise.all([o(),a(r.delay)])}function px(e,t){return e.sortNodePosition(t)}const gx=[...vv].reverse(),mx=vv.length;function vx(e){return t=>Promise.all(t.map(({animation:t,options:r})=>function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t)){const i=t.map(t=>fx(e,t,r));n=Promise.all(i)}else if("string"==typeof t)n=fx(e,t,r);else{const i="function"==typeof t?hb(e,t,r.custom):t;n=Promise.all(hx(e,i,r))}return n.then(()=>e.notify("AnimationComplete",t))}(e,t,r)))}function yx(e){let t=vx(e);const r={animate:wx(!0),whileInView:wx(),whileHover:wx(),whileTap:wx(),whileDrag:wx(),whileFocus:wx(),exit:wx()};let n=!0;const i=(t,r)=>{const n=hb(e,r);if(n){const{transition:e,transitionEnd:r,...i}=n;t={...t,...i,...r}}return t};function o(o,a){const s=e.getProps(),l=e.getVariantContext(!0)||{},c=[],u=new Set;let d={},h=1/0;for(let t=0;t<mx;t++){const f=gx[t],p=r[f],g=void 0!==s[f]?s[f]:l[f],m=gv(g),v=f===a?p.isActive:null;!1===v&&(h=t);let y=g===l[f]&&g!==s[f]&&m;if(y&&n&&e.manuallyAnimateOnMount&&(y=!1),p.protectedKeys={...d},!p.isActive&&null===v||!g&&!p.prevProp||mv(g)||"boolean"==typeof g)continue;let b=bx(p.prevProp,g)||f===a&&p.isActive&&!y&&m||t>h&&m,w=!1;const x=Array.isArray(g)?g:[g];let C=x.reduce(i,{});!1===v&&(C={});const{prevResolvedValues:_={}}=p,S={..._,...C},A=e=>{b=!0,u.has(e)&&(w=!0,u.delete(e)),p.needsAnimating[e]=!0};for(const e in S){const t=C[e],r=_[e];if(d.hasOwnProperty(e))continue;let n=!1;n=Py(t)&&Py(r)?!db(t,r):t!==r,n?void 0!==t?A(e):u.add(e):void 0!==t&&u.has(e)?A(e):p.protectedKeys[e]=!0}p.prevProp=g,p.prevResolvedValues=C,p.isActive&&(d={...d,...C}),n&&e.blockInitialAnimation&&(b=!1),b&&(!y||w)&&c.push(...x.map(e=>({animation:e,options:{type:f,...o}})))}if(u.size){const t={};u.forEach(r=>{const n=e.getBaseTarget(r);void 0!==n&&(t[r]=n)}),c.push({animation:t})}let f=!!c.length;return n&&(!1===s.initial||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(f=!1),n=!1,f?t(c):Promise.resolve()}return{animateChanges:o,setActive:function(t,n,i){var a;if(r[t].isActive===n)return Promise.resolve();null===(a=e.variantChildren)||void 0===a||a.forEach(e=>{var r;return null===(r=e.animationState)||void 0===r?void 0:r.setActive(t,n)}),r[t].isActive=n;const s=o(i,t);for(const e in r)r[e].protectedKeys={};return s},setAnimateFunction:function(r){t=r(e)},getState:()=>r}}function bx(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!db(t,e)}function wx(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}let xx=0;const Cx={animation:{Feature:class extends eb{constructor(e){super(e),e.animationState||(e.animationState=yx(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),mv(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){}}},exit:{Feature:class extends eb{constructor(){super(...arguments),this.id=xx++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t,custom:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e,{custom:r??this.node.getProps().custom});t&&!e&&i.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}};const _x=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Sx(e,t,r=1){const[n,i]=function(e){const t=_x.exec(e);if(!t)return[,];const[,r,n]=t;return[r,n]}(e);if(!n)return;const o=window.getComputedStyle(t).getPropertyValue(n);if(o){const e=o.trim();return Jw(e)?parseFloat(e):e}return Vv(i)?Sx(i,t,r+1):i}const Ax=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),kx=e=>Ax.has(e),Ex=e=>e===$v||e===ry,Ix=(e,t)=>parseFloat(e.split(", ")[t]),Tx=(e,t)=>(r,{transform:n})=>{if("none"===n||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/);if(i)return Ix(i[1],t);{const t=n.match(/^matrix\((.+)\)$/);return t?Ix(t[1],e):0}},Fx=new Set(["x","y","z"]),Ox=Rv.filter(e=>!Fx.has(e));const Px={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Tx(4,13),y:Tx(5,14)};Px.translateX=Px.x,Px.translateY=Px.y;const Mx=(e,t,r={},n={})=>{t={...t},n={...n};const i=Object.keys(t).filter(kx);let o=[],a=!1;const s=[];if(i.forEach(i=>{const l=e.getValue(i);if(!e.hasValue(i))return;let c=r[i],u=ox(c);const d=t[i];let h;if(Py(d)){const e=d.length,t=null===d[0]?1:0;c=d[t],u=ox(c);for(let r=t;r<e&&null!==d[r];r++)h?fb(ox(d[r])===h):h=ox(d[r])}else h=ox(d);if(u!==h)if(Ex(u)&&Ex(h)){const e=l.get();"string"==typeof e&&l.set(parseFloat(e)),"string"==typeof d?t[i]=parseFloat(d):Array.isArray(d)&&h===ry&&(t[i]=d.map(parseFloat))}else null!=u&&u.transform&&null!=h&&h.transform&&(0===c||0===d)?0===c?l.set(h.transform(c)):t[i]=u.transform(d):(a||(o=function(e){const t=[];return Ox.forEach(r=>{const n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t.length&&e.render(),t}(e),a=!0),s.push(i),n[i]=void 0!==n[i]?n[i]:t[i],l.jump(d))}),s.length){const r=s.indexOf("height")>=0?window.pageYOffset:null,i=((e,t,r)=>{const n=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};"none"===a&&t.setStaticValue("display",e.display||"block"),r.forEach(e=>{s[e]=Px[e](n,o)}),t.render();const l=t.measureViewportBox();return r.forEach(r=>{const n=t.getValue(r);n&&n.jump(s[r]),e[r]=Px[r](l,o)}),e})(t,e,s);return o.length&&o.forEach(([t,r])=>{e.getValue(t).set(r)}),e.render(),cv&&null!==r&&window.scrollTo({top:r}),{target:i,transitionEnd:n}}return{target:t,transitionEnd:n}};function Rx(e,t,r,n){return(e=>Object.keys(e).some(kx))(t)?Mx(e,t,r,n):{target:t,transitionEnd:n}}const Lx=(e,t,r,n)=>{const i=function(e,{...t},r){const n=e.current;if(!(n instanceof Element))return{target:t,transitionEnd:r};r&&(r={...r}),e.values.forEach(e=>{const t=e.get();if(!Vv(t))return;const r=Sx(t,n);r&&e.set(r)});for(const e in t){const i=t[e];if(!Vv(i))continue;const o=Sx(i,n);o&&(t[e]=o,r||(r={}),void 0===r[e]&&(r[e]=i))}return{target:t,transitionEnd:r}}(e,t,n);return Rx(e,t=i.target,r,n=i.transitionEnd)},Nx={current:null},jx={current:!1};const Dx=new WeakMap,zx=Object.keys(Sv),Bx=zx.length,Ux=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Vx=yv.length;class Hx{constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,visualState:i},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>By.render(this.render,!1,!0);const{latestValues:a,renderState:s}=i;this.latestValues=a,this.baseTarget={...a},this.initialValues=t.initial?{...a}:{},this.renderState=s,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.options=o,this.isControllingVariants=bv(t),this.isVariantNode=wv(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!(!e||!e.current);const{willChange:l,...c}=this.scrapeMotionValuesFromProps(t,{});for(const e in c){const t=c[e];void 0!==a[e]&&jv(t)&&(t.set(a[e],!1),Qw(l)&&l.add(e))}}scrapeMotionValuesFromProps(e,t){return{}}mount(e){this.current=e,Dx.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),jx.current||function(){if(jx.current=!0,cv)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Nx.current=e.matches;e.addListener(t),t()}else Nx.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Nx.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Dx.delete(this.current),this.projection&&this.projection.unmount(),Uy(this.notifyUpdate),Uy(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,t){const r=Lv.has(e),n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&By.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{n(),i()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}loadFeatures({children:e,...t},r,n,i){let o,a;for(let e=0;e<Bx;e++){const r=zx[e],{isEnabled:n,Feature:i,ProjectionNode:s,MeasureLayout:l}=Sv[r];s&&(o=s),n(t)&&(!this.features[r]&&i&&(this.features[r]=new i(this)),l&&(a=l))}if(("html"===this.type||"svg"===this.type)&&!this.projection&&o){this.projection=new o(this.latestValues,this.parent&&this.parent.projection);const{layoutId:e,layout:r,drag:n,dragConstraints:a,layoutScroll:s,layoutRoot:l}=t;this.projection.setOptions({layoutId:e,layout:r,alwaysMeasureLayout:!!n||a&&pv(a),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof r?r:"both",initialPromotionConfig:i,layoutScroll:s,layoutRoot:l})}return a}updateFeatures(){for(const e in this.features){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}makeTargetAnimatable(e,t=!0){return this.makeTargetAnimatableFromInstance(e,this.props,t)}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Ux.length;t++){const r=Ux[t];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const n=e["on"+r];n&&(this.propEventSubscriptions[r]=this.on(r,n))}this.prevMotionValues=function(e,t,r){const{willChange:n}=t;for(const i in t){const o=t[i],a=r[i];if(jv(o))e.addValue(i,o),Qw(n)&&n.add(i);else if(jv(a))e.addValue(i,rx(o,{owner:e})),Qw(n)&&n.remove(i);else if(a!==o)if(e.hasValue(i)){const t=e.getValue(i);!t.hasAnimated&&t.set(o)}else{const t=e.getStaticValue(i);e.addValue(i,rx(void 0!==t?t:o,{owner:e}))}}for(const n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const e=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(e.initial=this.props.initial),e}const t={};for(let e=0;e<Vx;e++){const r=yv[e],n=this.props[r];(gv(n)||!1===n)&&(t[r]=n)}return t}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){t!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,t)),this.values.set(e,t),this.latestValues[e]=t.get()}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=rx(t,{owner:this}),this.addValue(e,r)),r}readValue(e){var t;return void 0===this.latestValues[e]&&this.current?null!==(t=this.getBaseTargetFromProps(this.props,e))&&void 0!==t?t:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e]}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:r}=this.props,n="string"==typeof r||"object"==typeof r?null===(t=Fy(this.props,r))||void 0===t?void 0:t[e]:void 0;if(r&&void 0!==n)return n;const i=this.getBaseTargetFromProps(this.props,e);return void 0===i||jv(i)?void 0!==this.initialValues[e]&&void 0===n?void 0:this.baseTarget[e]:i}on(e,t){return this.events[e]||(this.events[e]=new ex),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class Wx extends Hx{sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:t,...r},{transformValues:n},i){let o=function(e,t,r){const n={};for(const i in e){const e=cx(i,t);if(void 0!==e)n[i]=e;else{const e=r.getValue(i);e&&(n[i]=e.get())}}return n}(r,e||{},this);if(n&&(t&&(t=n(t)),r&&(r=n(r)),o&&(o=n(o))),i){!function(e,t,r){var n,i;const o=Object.keys(t).filter(t=>!e.hasValue(t)),a=o.length;if(a)for(let s=0;s<a;s++){const a=o[s],l=t[a];let c=null;Array.isArray(l)&&(c=l[0]),null===c&&(c=null!==(i=null!==(n=r[a])&&void 0!==n?n:e.readValue(a))&&void 0!==i?i:t[a]),null!=c&&("string"==typeof c&&(Jw(c)||Gw(c))?c=parseFloat(c):!sx(c)&&iw.test(l)&&(c=qw(a,l)),e.addValue(a,rx(c,{owner:e})),void 0===r[a]&&(r[a]=c),null!==c&&e.setBaseTarget(a,c))}}(this,r,o);const e=Lx(this,r,o,t);t=e.transitionEnd,r=e.target}return{transition:e,transitionEnd:t,...r}}}class $x extends Wx{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,t){if(Lv.has(t)){const e=$w(t);return e&&e.default||0}{const r=function(e){return window.getComputedStyle(e)}(e),n=(Uv(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return function(e,t){return function({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}(function(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}(e,t)}build(e,t,r,n){ly(e,t,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,t){return Iy(e,t)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;jv(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}renderInstance(e,t,r,n){Ay(e,t,r,n)}}class qx extends Wx{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Lv.has(t)){const e=$w(t);return e&&e.default||0}return t=ky.has(t)?t:hv(t),e.getAttribute(t)}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(e,t){return Ty(e,t)}build(e,t,r,n){wy(e,t,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,r,n){Ey(e,t,0,n)}mount(e){this.isSVGTag=Cy(e.tagName),super.mount(e)}}const Gx=function(e){function t(t,r={}){return Tv(e(t,r))}if(typeof Proxy>"u")return t;const r=new Map;return new Proxy(t,{get:(e,n)=>(r.has(n)||r.set(n,t(n)),r.get(n))})}(function(e,{forwardMotionProps:t=!1},r,n){return{...Pv(e)?Hy:Wy,preloadedFeatures:r,useRender:Sy(t),createVisualElement:n,Component:e}});function Yx(){const e=u(!1);return uv(()=>(e.current=!0,()=>{e.current=!1}),[]),e}class Xx extends n.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Kx({children:e,isPresent:t}){const r=b(),i=u(null),o=u({width:0,height:0,top:0,left:0});return C(()=>{const{width:e,height:n,top:a,left:s}=o.current;if(t||!i.current||!e||!n)return;i.current.dataset.motionPopId=r;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(`\n [data-motion-pop-id="${r}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${n}px !important;\n top: ${a}px !important;\n left: ${s}px !important;\n }\n `),()=>{document.head.removeChild(l)}},[t]),n.createElement(Xx,{isPresent:t,childRef:i,sizeRef:o},n.cloneElement(e,{ref:i}))}const Zx=({children:e,initial:t,isPresent:r,onExitComplete:i,custom:o,presenceAffectsLayout:a,mode:s})=>{const l=Oy(Qx),c=b(),u=d(()=>({id:c,initial:t,isPresent:r,custom:o,onExitComplete:e=>{l.set(e,!0);for(const e of l.values())if(!e)return;i&&i()},register:e=>(l.set(e,!1),()=>l.delete(e))}),a?void 0:[r]);return d(()=>{l.forEach((e,t)=>l.set(t,!1))},[r]),n.useEffect(()=>{!r&&!l.size&&i&&i()},[r]),"popLayout"===s&&(e=n.createElement(Kx,{isPresent:r},e)),n.createElement(lv.Provider,{value:u},e)};function Qx(){return new Map}const Jx=e=>e.key||"";const eC=({children:e,custom:t,initial:r=!0,onExitComplete:i,exitBeforeEnter:s,presenceAffectsLayout:d=!0,mode:h="sync"})=>{const f=l(kv).forceRender||function(){const e=Yx(),[t,r]=o(0),n=c(()=>{e.current&&r(t+1)},[t]);return[c(()=>By.postRender(n),[n]),t]}()[0],p=Yx(),g=function(e){const t=[];return m.forEach(e,e=>{v(e)&&t.push(e)}),t}(e);let y=g;const b=u(new Map).current,x=u(y),C=u(new Map).current,_=u(!0);if(uv(()=>{_.current=!1,function(e,t){e.forEach(e=>{const r=Jx(e);t.set(r,e)})}(g,C),x.current=y}),function(e){a(()=>()=>e(),[])}(()=>{_.current=!0,C.clear(),b.clear()}),_.current)return n.createElement(n.Fragment,null,y.map(e=>n.createElement(Zx,{key:Jx(e),isPresent:!0,initial:!!r&&void 0,presenceAffectsLayout:d,mode:h},e)));y=[...y];const S=x.current.map(Jx),A=g.map(Jx),k=S.length;for(let e=0;e<k;e++){const t=S[e];-1===A.indexOf(t)&&!b.has(t)&&b.set(t,void 0)}return"wait"===h&&b.size&&(y=[]),b.forEach((e,r)=>{if(-1!==A.indexOf(r))return;const o=C.get(r);if(!o)return;const a=S.indexOf(r);let s=e;if(!s){const e=()=>{b.delete(r);const e=Array.from(C.keys()).filter(e=>!A.includes(e));if(e.forEach(e=>C.delete(e)),x.current=g.filter(t=>{const n=Jx(t);return n===r||e.includes(n)}),!b.size){if(!1===p.current)return;f(),i&&i()}};s=n.createElement(Zx,{key:Jx(o),isPresent:!1,onExitComplete:e,custom:t,presenceAffectsLayout:d,mode:h},o),b.set(r,s)}y.splice(a,0,s)}),y=y.map(e=>{const t=e.key;return b.has(t)?e:n.createElement(Zx,{key:Jx(e),isPresent:!0,presenceAffectsLayout:d,mode:h},e)}),n.createElement(n.Fragment,null,b.size?y:y.map(e=>w(e)))};function tC({children:e,features:t,strict:r=!1}){const[,i]=o(!rC(t)),s=u(void 0);if(!rC(t)){const{renderer:e,...r}=t;s.current=e,Av(r)}return a(()=>{rC(t)&&t().then(({renderer:e,...t})=>{Av(t),s.current=e,i(!0)})},[]),n.createElement(dv.Provider,{value:{renderer:s.current,strict:r}},e)}function rC(e){return"function"==typeof e}const nC={renderer:(e,t)=>Pv(e)?new qx(t,{enableHardwareAcceleration:!1}):new $x(t,{enableHardwareAcceleration:!0}),...Cx,...ub},iC=typeof document<"u"?i.useLayoutEffect:()=>{},oC=i.createContext(!1);function aC(){return!1}function sC(){return!0}function lC(e){return()=>{}}function cC(){return"function"==typeof i.useSyncExternalStore?i.useSyncExternalStore(lC,aC,sC):l(oC)}i.useId;let uC=new Map;function dC(e,t){if(e===t)return e;let r=uC.get(e);if(r)return r(t),t;let n=uC.get(t);return n?(n(e),e):t}function hC(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}const fC=e=>{var t;return null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document},pC=e=>e&&"window"in e&&e.window===e?e:fC(e).defaultView||window;function gC(...e){let t={...e[0]};for(let r=1;r<e.length;r++){let n=e[r];for(let e in n){let r=t[e],i=n[e];"function"==typeof r&&"function"==typeof i&&"o"===e[0]&&"n"===e[1]&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=hC(r,i):"className"!==e&&"UNSAFE_className"!==e||"string"!=typeof r||"string"!=typeof i?"id"===e&&r&&i?t.id=dC(r,i):t[e]=void 0!==i?i:r:t[e]=Tf(r,i)}}return t}function mC(e){if(function(){if(null==vC){vC=!1;try{document.createElement("div").focus({get preventScroll(){return vC=!0,!0}})}catch{}}return vC}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}(e);e.focus(),function(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}(t)}}let vC=null;function yC(){return function(e){var t;return typeof window<"u"&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}(/^Mac/i)}function bC(){return function(e){var t;return!(typeof window>"u"||null==window.navigator)&&((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands.some(t=>e.test(t.brand)))||e.test(window.navigator.userAgent))}(/Android/i)}let wC=new Map,xC=new Set;function CC(){if(typeof window>"u")return;function e(e){return"propertyName"in e}let t=r=>{if(!e(r)||!r.target)return;let n=wC.get(r.target);if(n&&(n.delete(r.propertyName),0===n.size&&(r.target.removeEventListener("transitioncancel",t),wC.delete(r.target)),0===wC.size)){for(let e of xC)e();xC.clear()}};document.body.addEventListener("transitionrun",r=>{if(!e(r)||!r.target)return;let n=wC.get(r.target);n||(n=new Set,wC.set(r.target,n),r.target.addEventListener("transitioncancel",t,{once:!0})),n.add(r.propertyName)}),document.body.addEventListener("transitionend",t)}function _C(){let e=u(new Map),t=c((t,r,n,i)=>{let o=null!=i&&i.once?(...t)=>{e.current.delete(n),n(...t)}:n;e.current.set(n,{type:r,eventTarget:t,fn:o,options:i}),t.addEventListener(r,n,i)},[]),r=c((t,r,n,i)=>{var o;let a=(null===(o=e.current.get(n))||void 0===o?void 0:o.fn)||n;t.removeEventListener(r,a,i),e.current.delete(n)},[]),n=c(()=>{e.current.forEach((e,t)=>{r(e.eventTarget,e.type,t,e.options)})},[r]);return a(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function SC(e){const t=u(null);return d(()=>({get current(){return t.current},set current(r){t.current=r,"function"==typeof e?e(r):e&&(e.current=r)}}),[e])}typeof document<"u"&&("loading"!==document.readyState?CC():document.addEventListener("DOMContentLoaded",CC));let AC=typeof document<"u"&&window.visualViewport;function kC(){return{width:AC&&(null==AC?void 0:AC.width)||window.innerWidth,height:AC&&(null==AC?void 0:AC.height)||window.innerHeight}}function EC(e,t,r){let[n,i]=o(e||t),s=u(void 0!==e),l=void 0!==e;a(()=>{let e=s.current;e!==l&&console.warn(`WARN: A component changed from ${e?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),s.current=l},[l]);let d=l?e:n,h=c((e,...t)=>{let n=(e,...t)=>{r&&(Object.is(d,e)||r(e,...t)),l||(d=e)};"function"==typeof e?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),i((r,...i)=>{let o=e(l?d:r,...i);return n(o,...t),l?r:o})):(l||i(e),n(e,...t))},[l,d,r]);return[d,h]}function IC(e,t=-1/0,r=1/0){return Math.min(Math.max(e,t),r)}function TC(e,t){let r=e,n=t.toString(),i=n.indexOf("."),o=i>=0?n.length-i:0;if(o>0){let e=Math.pow(10,o);r=Math.round(r*e)/e}return r}function FC(e,t,r=10){const n=Math.pow(r,t);return Math.round(e*n)/n}var OC={};const PC=vf(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));!function(e){
28
- /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
29
- var t=t||{version:"5.3.0"};if(e.fabric=t,typeof document<"u"&&typeof window<"u")document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?t.document=document:t.document=document.implementation.createHTMLDocument(""),t.window=window;else{var r=new PC.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;t.document=r.document,t.jsdomImplForWrapper=PC.implForWrapper,t.nodeCanvas=PC.Canvas,t.window=r,DOMParser=t.window.DOMParser}function n(e,t){var r=e.canvas,n=t.targetCanvas,i=n.getContext("2d");i.translate(0,n.height),i.scale(1,-1);var o=r.height-n.height;i.drawImage(r,0,o,n.width,n.height,0,0,n.width,n.height)}function i(e,t){var r=t.targetCanvas.getContext("2d"),n=t.destinationWidth,i=t.destinationHeight,o=n*i*4,a=new Uint8Array(this.imageBuffer,0,o),s=new Uint8ClampedArray(this.imageBuffer,0,o);e.readPixels(0,0,n,i,e.RGBA,e.UNSIGNED_BYTE,a);var l=new ImageData(s,n,i);r.putImageData(l,0,0)}t.isTouchSupported="ontouchstart"in t.window||"ontouchstart"in t.document||t.window&&t.window.navigator&&t.window.navigator.maxTouchPoints>0,t.isLikelyNode=typeof Buffer<"u"&&typeof window>"u",t.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],t.DPI=96,t.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",t.commaWsp="(?:\\s+,?\\s*|,\\s*)",t.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,t.reNonWord=/[ \n\.,;!\?\-]/,t.fontPaths={},t.iMatrix=[1,0,0,1,0,0],t.svgNS="http://www.w3.org/2000/svg",t.perfLimitSizeTotal=2097152,t.maxCacheSideLimit=4096,t.minCacheSideLimit=256,t.charWidthsCache={},t.textureSize=2048,t.disableStyleCopyPaste=!1,t.enableGLFiltering=!0,t.devicePixelRatio=t.window.devicePixelRatio||t.window.webkitDevicePixelRatio||t.window.mozDevicePixelRatio||1,t.browserShadowBlurConstant=1,t.arcToSegmentsCache={},t.boundsOfCurveCache={},t.cachesBoundsOfCurve=!0,t.forceGLPutImageData=!1,t.initFilterBackend=function(){return t.enableGLFiltering&&t.isWebglSupported&&t.isWebglSupported(t.textureSize)?(console.log("max texture size: "+t.maxTextureSize),new t.WebglFilterBackend({tileSize:t.textureSize})):t.Canvas2dFilterBackend?new t.Canvas2dFilterBackend:void 0},typeof document<"u"&&typeof window<"u"&&(window.fabric=t),function(){function e(e,r){if(this.__eventListeners[e]){var n=this.__eventListeners[e];r?n[n.indexOf(r)]=!1:t.util.array.fill(n,!1)}}function r(e,t){var r=function(){t.apply(this,arguments),this.off(e,r)}.bind(this);this.on(e,r)}t.Observable={fire:function(e,t){if(!this.__eventListeners)return this;var r=this.__eventListeners[e];if(!r)return this;for(var n=0,i=r.length;n<i;n++)r[n]&&r[n].call(this,t||{});return this.__eventListeners[e]=r.filter(function(e){return!1!==e}),this},on:function(e,t){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var r in e)this.on(r,e[r]);else this.__eventListeners[e]||(this.__eventListeners[e]=[]),this.__eventListeners[e].push(t);return this},once:function(e,t){if(1===arguments.length)for(var n in e)r.call(this,n,e[n]);else r.call(this,e,t);return this},off:function(t,r){if(!this.__eventListeners)return this;if(0===arguments.length)for(t in this.__eventListeners)e.call(this,t);else if(1===arguments.length&&"object"==typeof arguments[0])for(var n in t)e.call(this,n,t[n]);else e.call(this,t,r);return this}}}(),t.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var e=0,t=arguments.length;e<t;e++)this._onObjectAdded(arguments[e]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(e,t,r){var n=this._objects;return r?n[t]=e:n.splice(t,0,e),this._onObjectAdded&&this._onObjectAdded(e),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var e,t=this._objects,r=!1,n=0,i=arguments.length;n<i;n++)-1!==(e=t.indexOf(arguments[n]))&&(r=!0,t.splice(e,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[n]));return this.renderOnAddRemove&&r&&this.requestRenderAll(),this},forEachObject:function(e,t){for(var r=this.getObjects(),n=0,i=r.length;n<i;n++)e.call(t,r[n],n,r);return this},getObjects:function(e){return typeof e>"u"?this._objects.concat():this._objects.filter(function(t){return t.type===e})},item:function(e){return this._objects[e]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(e,t){return this._objects.indexOf(e)>-1||!!t&&this._objects.some(function(t){return"function"==typeof t.contains&&t.contains(e,!0)})},complexity:function(){return this._objects.reduce(function(e,t){return e+=t.complexity?t.complexity():0},0)}},t.CommonMethods={_setOptions:function(e){for(var t in e)this.set(t,e[t])},_initGradient:function(e,r){e&&e.colorStops&&!(e instanceof t.Gradient)&&this.set(r,new t.Gradient(e))},_initPattern:function(e,r,n){!e||!e.source||e instanceof t.Pattern?n&&n():this.set(r,new t.Pattern(e,n))},_setObject:function(e){for(var t in e)this._set(t,e[t])},set:function(e,t){return"object"==typeof e?this._setObject(e):this._set(e,t),this},_set:function(e,t){this[e]=t},toggle:function(e){var t=this.get(e);return"boolean"==typeof t&&this.set(e,!t),this},get:function(e){return this[e]}},function(e){var r=Math.sqrt,n=Math.atan2,i=Math.pow,o=Math.PI/180,a=Math.PI/2;t.util={cos:function(e){if(0===e)return 1;switch(e<0&&(e=-e),e/a){case 1:case 3:return 0;case 2:return-1}return Math.cos(e)},sin:function(e){if(0===e)return 0;var t=1;switch(e<0&&(t=-1),e/a){case 1:return t;case 2:return 0;case 3:return-t}return Math.sin(e)},removeFromArray:function(e,t){var r=e.indexOf(t);return-1!==r&&e.splice(r,1),e},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e+1))+e},degreesToRadians:function(e){return e*o},radiansToDegrees:function(e){return e/o},rotatePoint:function(e,r,n){var i=new t.Point(e.x-r.x,e.y-r.y),o=t.util.rotateVector(i,n);return new t.Point(o.x,o.y).addEquals(r)},rotateVector:function(e,r){var n=t.util.sin(r),i=t.util.cos(r);return{x:e.x*i-e.y*n,y:e.x*n+e.y*i}},createVector:function(e,r){return new t.Point(r.x-e.x,r.y-e.y)},calcAngleBetweenVectors:function(e,t){return Math.acos((e.x*t.x+e.y*t.y)/(Math.hypot(e.x,e.y)*Math.hypot(t.x,t.y)))},getHatVector:function(e){return new t.Point(e.x,e.y).multiply(1/Math.hypot(e.x,e.y))},getBisector:function(e,r,n){var i=t.util.createVector(e,r),o=t.util.createVector(e,n),a=t.util.calcAngleBetweenVectors(i,o),s=a*(0===t.util.calcAngleBetweenVectors(t.util.rotateVector(i,a),o)?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(i,s)),angle:a}},projectStrokeOnPoints:function(e,r,n){var i=[],o=r.strokeWidth/2,a=r.strokeUniform?new t.Point(1/r.scaleX,1/r.scaleY):new t.Point(1,1),s=function(e){var r=o/Math.hypot(e.x,e.y);return new t.Point(e.x*r*a.x,e.y*r*a.y)};return e.length<=1||e.forEach(function(l,c){var u,d,h=new t.Point(l.x,l.y);0===c?(d=e[c+1],u=n?s(t.util.createVector(d,h)).addEquals(h):e[e.length-1]):c===e.length-1?(u=e[c-1],d=n?s(t.util.createVector(u,h)).addEquals(h):e[0]):(u=e[c-1],d=e[c+1]);var f,p,g=t.util.getBisector(h,u,d),m=g.vector,v=g.angle;if("miter"===r.strokeLineJoin&&(f=-o/Math.sin(v/2),p=new t.Point(m.x*f*a.x,m.y*f*a.y),Math.hypot(p.x,p.y)/o<=r.strokeMiterLimit))return i.push(h.add(p)),void i.push(h.subtract(p));f=-o*Math.SQRT2,p=new t.Point(m.x*f*a.x,m.y*f*a.y),i.push(h.add(p)),i.push(h.subtract(p))}),i},transformPoint:function(e,r,n){return n?new t.Point(r[0]*e.x+r[2]*e.y,r[1]*e.x+r[3]*e.y):new t.Point(r[0]*e.x+r[2]*e.y+r[4],r[1]*e.x+r[3]*e.y+r[5])},makeBoundingBoxFromPoints:function(e,r){if(r)for(var n=0;n<e.length;n++)e[n]=t.util.transformPoint(e[n],r);var i=[e[0].x,e[1].x,e[2].x,e[3].x],o=t.util.array.min(i),a=t.util.array.max(i)-o,s=[e[0].y,e[1].y,e[2].y,e[3].y],l=t.util.array.min(s);return{left:o,top:l,width:a,height:t.util.array.max(s)-l}},invertTransform:function(e){var r=1/(e[0]*e[3]-e[1]*e[2]),n=[r*e[3],-r*e[1],-r*e[2],r*e[0]],i=t.util.transformPoint({x:e[4],y:e[5]},n,!0);return n[4]=-i.x,n[5]=-i.y,n},toFixed:function(e,t){return parseFloat(Number(e).toFixed(t))},parseUnit:function(e,r){var n=/\D{0,2}$/.exec(e),i=parseFloat(e);switch(r||(r=t.Text.DEFAULT_SVG_FONT_SIZE),n[0]){case"mm":return i*t.DPI/25.4;case"cm":return i*t.DPI/2.54;case"in":return i*t.DPI;case"pt":return i*t.DPI/72;case"pc":return i*t.DPI/72*12;case"em":return i*r;default:return i}},falseFunction:function(){return!1},getKlass:function(e,r){return e=t.util.string.camelize(e.charAt(0).toUpperCase()+e.slice(1)),t.util.resolveNamespace(r)[e]},getSvgAttributes:function(e){var t=["instantiated_by_use","style","id","class"];switch(e){case"linearGradient":t=t.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":t=t.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":t=t.concat(["offset","stop-color","stop-opacity"])}return t},resolveNamespace:function(r){if(!r)return t;var n,i=r.split("."),o=i.length,a=e||t.window;for(n=0;n<o;++n)a=a[i[n]];return a},loadImage:function(e,r,n,i){if(e){var o=t.util.createImage(),a=function(){r&&r.call(n,o,!1),o=o.onload=o.onerror=null};o.onload=a,o.onerror=function(){t.log("Error loading "+o.src),r&&r.call(n,null,!0),o=o.onload=o.onerror=null},0!==e.indexOf("data")&&null!=i&&(o.crossOrigin=i),"data:image/svg"===e.substring(0,14)&&(o.onload=null,t.util.loadImageInDom(o,a)),o.src=e}else r&&r.call(n,e)},loadImageInDom:function(e,r){var n=t.document.createElement("div");n.style.width=n.style.height="1px",n.style.left=n.style.top="-100%",n.style.position="absolute",n.appendChild(e),t.document.querySelector("body").appendChild(n),e.onload=function(){r(),n.parentNode.removeChild(n),n=null}},enlivenObjects:function(e,r,n,i){var o=[],a=0,s=(e=e||[]).length;function l(){++a===s&&r&&r(o.filter(function(e){return e}))}s?e.forEach(function(e,r){e&&e.type?t.util.getKlass(e.type,n).fromObject(e,function(t,n){n||(o[r]=t),i&&i(e,t,n),l()}):l()}):r&&r(o)},enlivenObjectEnlivables:function(e,r,n){var i=t.Object.ENLIVEN_PROPS.filter(function(t){return!!e[t]});t.util.enlivenObjects(i.map(function(t){return e[t]}),function(e){var t={};i.forEach(function(n,i){t[n]=e[i],r&&(r[n]=e[i])}),n&&n(t)})},enlivenPatterns:function(e,r){function n(){++o===a&&r&&r(i)}var i=[],o=0,a=(e=e||[]).length;a?e.forEach(function(e,r){e&&e.source?new t.Pattern(e,function(e){i[r]=e,n()}):(i[r]=e,n())}):r&&r(i)},groupSVGElements:function(e,r,n){var i;return e&&1===e.length?(typeof n<"u"&&(e[0].sourcePath=n),e[0]):(r&&(r.width&&r.height?r.centerPoint={x:r.width/2,y:r.height/2}:(delete r.width,delete r.height)),i=new t.Group(e,r),typeof n<"u"&&(i.sourcePath=n),i)},populateWithProperties:function(e,t,r){if(r&&Array.isArray(r))for(var n=0,i=r.length;n<i;n++)r[n]in e&&(t[r[n]]=e[r[n]])},createCanvasElement:function(){return t.document.createElement("canvas")},copyCanvasElement:function(e){var r=t.util.createCanvasElement();return r.width=e.width,r.height=e.height,r.getContext("2d").drawImage(e,0,0),r},toDataURL:function(e,t,r){return e.toDataURL("image/"+t,r)},createImage:function(){return t.document.createElement("img")},multiplyTransformMatrices:function(e,t,r){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],r?0:e[0]*t[4]+e[2]*t[5]+e[4],r?0:e[1]*t[4]+e[3]*t[5]+e[5]]},qrDecompose:function(e){var t=n(e[1],e[0]),a=i(e[0],2)+i(e[1],2),s=r(a),l=(e[0]*e[3]-e[2]*e[1])/s,c=n(e[0]*e[2]+e[1]*e[3],a);return{angle:t/o,scaleX:s,scaleY:l,skewX:c/o,skewY:0,translateX:e[4],translateY:e[5]}},calcRotateMatrix:function(e){if(!e.angle)return t.iMatrix.concat();var r=t.util.degreesToRadians(e.angle),n=t.util.cos(r),i=t.util.sin(r);return[n,i,-i,n,0,0]},calcDimensionsMatrix:function(e){var r=typeof e.scaleX>"u"?1:e.scaleX,n=typeof e.scaleY>"u"?1:e.scaleY,i=[e.flipX?-r:r,0,0,e.flipY?-n:n,0,0],o=t.util.multiplyTransformMatrices,a=t.util.degreesToRadians;return e.skewX&&(i=o(i,[1,0,Math.tan(a(e.skewX)),1],!0)),e.skewY&&(i=o(i,[1,Math.tan(a(e.skewY)),0,1],!0)),i},composeMatrix:function(e){var r=[1,0,0,1,e.translateX||0,e.translateY||0],n=t.util.multiplyTransformMatrices;return e.angle&&(r=n(r,t.util.calcRotateMatrix(e))),(1!==e.scaleX||1!==e.scaleY||e.skewX||e.skewY||e.flipX||e.flipY)&&(r=n(r,t.util.calcDimensionsMatrix(e))),r},resetObjectTransform:function(e){e.scaleX=1,e.scaleY=1,e.skewX=0,e.skewY=0,e.flipX=!1,e.flipY=!1,e.rotate(0)},saveObjectTransform:function(e){return{scaleX:e.scaleX,scaleY:e.scaleY,skewX:e.skewX,skewY:e.skewY,angle:e.angle,left:e.left,flipX:e.flipX,flipY:e.flipY,top:e.top}},isTransparent:function(e,t,r,n){n>0&&(t>n?t-=n:t=0,r>n?r-=n:r=0);var i,o=!0,a=e.getImageData(t,r,2*n||1,2*n||1),s=a.data.length;for(i=3;i<s&&!1!==(o=a.data[i]<=0);i+=4);return a=null,o},parsePreserveAspectRatioAttribute:function(e){var t,r="meet",n=e.split(" ");return n&&n.length&&("meet"!==(r=n.pop())&&"slice"!==r?(t=r,r="meet"):n.length&&(t=n.pop())),{meetOrSlice:r,alignX:"none"!==t?t.slice(1,4):"none",alignY:"none"!==t?t.slice(5,8):"none"}},clearFabricFontCache:function(e){(e=(e||"").toLowerCase())?t.charWidthsCache[e]&&delete t.charWidthsCache[e]:t.charWidthsCache={}},limitDimsByArea:function(e,t){var r=Math.sqrt(t*e),n=Math.floor(t/r);return{x:Math.floor(r),y:n}},capValue:function(e,t,r){return Math.max(e,Math.min(t,r))},findScaleToFit:function(e,t){return Math.min(t.width/e.width,t.height/e.height)},findScaleToCover:function(e,t){return Math.max(t.width/e.width,t.height/e.height)},matrixToSVG:function(e){return"matrix("+e.map(function(e){return t.util.toFixed(e,t.Object.NUM_FRACTION_DIGITS)}).join(" ")+")"},removeTransformFromObject:function(e,r){var n=t.util.invertTransform(r),i=t.util.multiplyTransformMatrices(n,e.calcOwnMatrix());t.util.applyTransformToObject(e,i)},addTransformToObject:function(e,r){t.util.applyTransformToObject(e,t.util.multiplyTransformMatrices(r,e.calcOwnMatrix()))},applyTransformToObject:function(e,r){var n=t.util.qrDecompose(r),i=new t.Point(n.translateX,n.translateY);e.flipX=!1,e.flipY=!1,e.set("scaleX",n.scaleX),e.set("scaleY",n.scaleY),e.skewX=n.skewX,e.skewY=n.skewY,e.angle=n.angle,e.setPositionByOrigin(i,"center","center")},sizeAfterTransform:function(e,r,n){var i=e/2,o=r/2,a=[{x:-i,y:-o},{x:i,y:-o},{x:-i,y:o},{x:i,y:o}],s=t.util.calcDimensionsMatrix(n),l=t.util.makeBoundingBoxFromPoints(a,s);return{x:l.width,y:l.height}},mergeClipPaths:function(e,r){var n=e,i=r;n.inverted&&!i.inverted&&(n=r,i=e),t.util.applyTransformToObject(i,t.util.multiplyTransformMatrices(t.util.invertTransform(n.calcTransformMatrix()),i.calcTransformMatrix()));var o=n.inverted&&i.inverted;return o&&(n.inverted=i.inverted=!1),new t.Group([n],{clipPath:i,inverted:o})},hasStyleChanged:function(e,t,r){return r=r||!1,e.fill!==t.fill||e.stroke!==t.stroke||e.strokeWidth!==t.strokeWidth||e.fontSize!==t.fontSize||e.fontFamily!==t.fontFamily||e.fontWeight!==t.fontWeight||e.fontStyle!==t.fontStyle||e.textBackgroundColor!==t.textBackgroundColor||e.deltaY!==t.deltaY||r&&(e.overline!==t.overline||e.underline!==t.underline||e.linethrough!==t.linethrough)},stylesToArray:function(e,r){e=t.util.object.clone(e,!0);for(var n=r.split("\n"),i=-1,o={},a=[],s=0;s<n.length;s++)if(e[s])for(var l=0;l<n[s].length;l++){i++;var c=e[s][l];if(c&&Object.keys(c).length>0)t.util.hasStyleChanged(o,c,!0)?a.push({start:i,end:i+1,style:c}):a[a.length-1].end++;o=c||{}}else i+=n[s].length;return a},stylesFromArray:function(e,t){if(!Array.isArray(e))return e;for(var r=t.split("\n"),n=-1,i=0,o={},a=0;a<r.length;a++)for(var s=0;s<r[a].length;s++)n++,e[i]&&e[i].start<=n&&n<e[i].end&&(o[a]=o[a]||{},o[a][s]=Object.assign({},e[i].style),n===e[i].end-1&&i++);return o}}}(e),function(){var e=Array.prototype.join,r={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},n={m:"l",M:"L"};function i(e,r,n,i,o,a,s,l,c,u,d){var h=t.util.cos(e),f=t.util.sin(e),p=t.util.cos(r),g=t.util.sin(r),m=n*o*p-i*a*g+s,v=i*o*p+n*a*g+l;return["C",u+c*(-n*o*f-i*a*h),d+c*(-i*o*f+n*a*h),m+c*(n*o*g+i*a*p),v+c*(i*o*g-n*a*p),m,v]}function o(e,t,r,n){var i=Math.atan2(t,e),o=Math.atan2(n,r);return o>=i?o-i:2*Math.PI-(i-o)}function a(e,r,n){for(var a=n[1],s=n[2],l=n[3],c=n[4],u=n[5],d=function(e,r,n,a,s,l,c){var u=Math.PI,d=c*u/180,h=t.util.sin(d),f=t.util.cos(d),p=0,g=0,m=-f*e*.5-h*r*.5,v=-f*r*.5+h*e*.5,y=(n=Math.abs(n))*n,b=(a=Math.abs(a))*a,w=v*v,x=m*m,C=y*b-y*w-b*x,_=0;if(C<0){var S=Math.sqrt(1-C/(y*b));n*=S,a*=S}else _=(s===l?-1:1)*Math.sqrt(C/(y*w+b*x));var A=_*n*v/a,k=-_*a*m/n,E=f*A-h*k+.5*e,I=h*A+f*k+.5*r,T=o(1,0,(m-A)/n,(v-k)/a),F=o((m-A)/n,(v-k)/a,(-m-A)/n,(-v-k)/a);0===l&&F>0?F-=2*u:1===l&&F<0&&(F+=2*u);for(var O=Math.ceil(Math.abs(F/u*2)),P=[],M=F/O,R=8/3*Math.sin(M/4)*Math.sin(M/4)/Math.sin(M/2),L=T+M,N=0;N<O;N++)P[N]=i(T,L,f,h,n,a,E,I,R,p,g),p=P[N][5],g=P[N][6],T=L,L+=M;return P}(n[6]-e,n[7]-r,a,s,c,u,l),h=0,f=d.length;h<f;h++)d[h][1]+=e,d[h][2]+=r,d[h][3]+=e,d[h][4]+=r,d[h][5]+=e,d[h][6]+=r;return d}function s(e,t,r,n){return Math.sqrt((r-e)*(r-e)+(n-t)*(n-t))}function l(e,t,r,n,i,o,a,s){return function(l){var c=function(e){return e*e*e}(l),u=function(e){return 3*e*e*(1-e)}(l),d=function(e){return 3*e*(1-e)*(1-e)}(l),h=function(e){return(1-e)*(1-e)*(1-e)}(l);return{x:a*c+i*u+r*d+e*h,y:s*c+o*u+n*d+t*h}}}function c(e,t,r,n,i,o,a,s){return function(l){var c=1-l,u=3*c*c*(r-e)+6*c*l*(i-r)+3*l*l*(a-i),d=3*c*c*(n-t)+6*c*l*(o-n)+3*l*l*(s-o);return Math.atan2(d,u)}}function u(e,t,r,n,i,o){return function(a){var s=function(e){return e*e}(a),l=function(e){return 2*e*(1-e)}(a),c=function(e){return(1-e)*(1-e)}(a);return{x:i*s+r*l+e*c,y:o*s+n*l+t*c}}}function d(e,t,r,n,i,o){return function(a){var s=1-a,l=2*s*(r-e)+2*a*(i-r),c=2*s*(n-t)+2*a*(o-n);return Math.atan2(c,l)}}function h(e,t,r){var n,i,o={x:t,y:r},a=0;for(i=1;i<=100;i+=1)n=e(i/100),a+=s(o.x,o.y,n.x,n.y),o=n;return a}function f(e,t){for(var r,n,i,o=0,a=0,l=e.iterator,c={x:e.x,y:e.y},u=.01,d=e.angleFinder;a<t&&u>1e-4;)r=l(o),i=o,(n=s(c.x,c.y,r.x,r.y))+a>t?(o-=u,u/=2):(c=r,o+=u,a+=n);return r.angle=d(i),r}function p(e){for(var t,r,n,i,o=0,a=e.length,f=0,p=0,g=0,m=0,v=[],y=0;y<a;y++){switch(n={x:f,y:p,command:(t=e[y])[0]},t[0]){case"M":n.length=0,g=f=t[1],m=p=t[2];break;case"L":n.length=s(f,p,t[1],t[2]),f=t[1],p=t[2];break;case"C":r=l(f,p,t[1],t[2],t[3],t[4],t[5],t[6]),i=c(f,p,t[1],t[2],t[3],t[4],t[5],t[6]),n.iterator=r,n.angleFinder=i,n.length=h(r,f,p),f=t[5],p=t[6];break;case"Q":r=u(f,p,t[1],t[2],t[3],t[4]),i=d(f,p,t[1],t[2],t[3],t[4]),n.iterator=r,n.angleFinder=i,n.length=h(r,f,p),f=t[3],p=t[4];break;case"Z":case"z":n.destX=g,n.destY=m,n.length=s(f,p,g,m),f=g,p=m}o+=n.length,v.push(n)}return v.push({length:o,x:f,y:p}),v}t.util.joinPath=function(e){return e.map(function(e){return e.join(" ")}).join(" ")},t.util.parsePath=function(e){var i,o,a,s,l,c=[],u=[],d=t.rePathCommand,h="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",f="("+h+")"+t.commaWsp,p="([01])"+t.commaWsp+"?",g=new RegExp(f+"?"+f+"?"+f+p+p+f+"?("+h+")","g");if(!e||!e.match)return c;for(var m,v=0,y=(l=e.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;v<y;v++){s=(i=l[v]).slice(1).trim(),u.length=0;var b=i.charAt(0);if(m=[b],"a"===b.toLowerCase())for(var w;w=g.exec(s);)for(var x=1;x<w.length;x++)u.push(w[x]);else for(;a=d.exec(s);)u.push(a[0]);x=0;for(var C=u.length;x<C;x++)o=parseFloat(u[x]),isNaN(o)||m.push(o);var _=r[b.toLowerCase()],S=n[b]||b;if(m.length-1>_)for(var A=1,k=m.length;A<k;A+=_)c.push([b].concat(m.slice(A,A+_))),b=S;else c.push(m)}return c},t.util.makePathSimpler=function(e){var t,r,n,i,o,s,l=0,c=0,u=e.length,d=0,h=0,f=[];for(r=0;r<u;++r){switch(n=!1,(t=e[r].slice(0))[0]){case"l":t[0]="L",t[1]+=l,t[2]+=c;case"L":l=t[1],c=t[2];break;case"h":t[1]+=l;case"H":t[0]="L",t[2]=c,l=t[1];break;case"v":t[1]+=c;case"V":t[0]="L",c=t[1],t[1]=l,t[2]=c;break;case"m":t[0]="M",t[1]+=l,t[2]+=c;case"M":l=t[1],c=t[2],d=t[1],h=t[2];break;case"c":t[0]="C",t[1]+=l,t[2]+=c,t[3]+=l,t[4]+=c,t[5]+=l,t[6]+=c;case"C":o=t[3],s=t[4],l=t[5],c=t[6];break;case"s":t[0]="S",t[1]+=l,t[2]+=c,t[3]+=l,t[4]+=c;case"S":"C"===i?(o=2*l-o,s=2*c-s):(o=l,s=c),l=t[3],c=t[4],t[0]="C",t[5]=t[3],t[6]=t[4],t[3]=t[1],t[4]=t[2],t[1]=o,t[2]=s,o=t[3],s=t[4];break;case"q":t[0]="Q",t[1]+=l,t[2]+=c,t[3]+=l,t[4]+=c;case"Q":o=t[1],s=t[2],l=t[3],c=t[4];break;case"t":t[0]="T",t[1]+=l,t[2]+=c;case"T":"Q"===i?(o=2*l-o,s=2*c-s):(o=l,s=c),t[0]="Q",l=t[1],c=t[2],t[1]=o,t[2]=s,t[3]=l,t[4]=c;break;case"a":t[0]="A",t[6]+=l,t[7]+=c;case"A":n=!0,f=f.concat(a(l,c,t)),l=t[6],c=t[7];break;case"z":case"Z":l=d,c=h}n||f.push(t),i=t[0]}return f},t.util.getSmoothPathFromPoints=function(e,r){var n,i=[],o=new t.Point(e[0].x,e[0].y),a=new t.Point(e[1].x,e[1].y),s=e.length,l=1,c=0,u=s>2;for(r=r||0,u&&(l=e[2].x<a.x?-1:e[2].x===a.x?0:1,c=e[2].y<a.y?-1:e[2].y===a.y?0:1),i.push(["M",o.x-l*r,o.y-c*r]),n=1;n<s;n++){if(!o.eq(a)){var d=o.midPointFrom(a);i.push(["Q",o.x,o.y,d.x,d.y])}o=e[n],n+1<e.length&&(a=e[n+1])}return u&&(l=o.x>e[n-2].x?1:o.x===e[n-2].x?0:-1,c=o.y>e[n-2].y?1:o.y===e[n-2].y?0:-1),i.push(["L",o.x+l*r,o.y+c*r]),i},t.util.getPathSegmentsInfo=p,t.util.getBoundsOfCurve=function(r,n,i,o,a,s,l,c){var u;if(t.cachesBoundsOfCurve&&(u=e.call(arguments),t.boundsOfCurveCache[u]))return t.boundsOfCurveCache[u];var d,h,f,p,g,m,v,y,b=Math.sqrt,w=Math.min,x=Math.max,C=Math.abs,_=[],S=[[],[]];h=6*r-12*i+6*a,d=-3*r+9*i-9*a+3*l,f=3*i-3*r;for(var A=0;A<2;++A)if(A>0&&(h=6*n-12*o+6*s,d=-3*n+9*o-9*s+3*c,f=3*o-3*n),C(d)<1e-12){if(C(h)<1e-12)continue;0<(p=-f/h)&&p<1&&_.push(p)}else!((v=h*h-4*f*d)<0)&&(0<(g=(-h+(y=b(v)))/(2*d))&&g<1&&_.push(g),0<(m=(-h-y)/(2*d))&&m<1&&_.push(m));for(var k,E,I,T=_.length,F=T;T--;)k=(I=1-(p=_[T]))*I*I*r+3*I*I*p*i+3*I*p*p*a+p*p*p*l,S[0][T]=k,E=I*I*I*n+3*I*I*p*o+3*I*p*p*s+p*p*p*c,S[1][T]=E;S[0][F]=r,S[1][F]=n,S[0][F+1]=l,S[1][F+1]=c;var O=[{x:w.apply(null,S[0]),y:w.apply(null,S[1])},{x:x.apply(null,S[0]),y:x.apply(null,S[1])}];return t.cachesBoundsOfCurve&&(t.boundsOfCurveCache[u]=O),O},t.util.getPointOnPath=function(e,r,n){n||(n=p(e));for(var i=0;r-n[i].length>0&&i<n.length-2;)r-=n[i].length,i++;var o,a=n[i],s=r/a.length,l=a.command,c=e[i];switch(l){case"M":return{x:a.x,y:a.y,angle:0};case"Z":case"z":return(o=new t.Point(a.x,a.y).lerp(new t.Point(a.destX,a.destY),s)).angle=Math.atan2(a.destY-a.y,a.destX-a.x),o;case"L":return(o=new t.Point(a.x,a.y).lerp(new t.Point(c[1],c[2]),s)).angle=Math.atan2(c[2]-a.y,c[1]-a.x),o;case"C":case"Q":return f(a,r)}},t.util.transformPath=function(e,r,n){return n&&(r=t.util.multiplyTransformMatrices(r,[1,0,0,1,-n.x,-n.y])),e.map(function(e){for(var n=e.slice(0),i={},o=1;o<e.length-1;o+=2)i.x=e[o],i.y=e[o+1],i=t.util.transformPoint(i,r),n[o]=i.x,n[o+1]=i.y;return n})}}(),function(){var e=Array.prototype.slice;function r(e,t,r){if(e&&0!==e.length){var n=e.length-1,i=t?e[n][t]:e[n];if(t)for(;n--;)r(e[n][t],i)&&(i=e[n][t]);else for(;n--;)r(e[n],i)&&(i=e[n]);return i}}t.util.array={fill:function(e,t){for(var r=e.length;r--;)e[r]=t;return e},invoke:function(t,r){for(var n=e.call(arguments,2),i=[],o=0,a=t.length;o<a;o++)i[o]=n.length?t[o][r].apply(t[o],n):t[o][r].call(t[o]);return i},min:function(e,t){return r(e,t,function(e,t){return e<t})},max:function(e,t){return r(e,t,function(e,t){return e>=t})}}}(),function(){function e(r,n,i){if(i)if(!t.isLikelyNode&&n instanceof Element)r=n;else if(n instanceof Array){r=[];for(var o=0,a=n.length;o<a;o++)r[o]=e({},n[o],i)}else if(n&&"object"==typeof n)for(var s in n)"canvas"===s||"group"===s?r[s]=null:n.hasOwnProperty(s)&&(r[s]=e({},n[s],i));else r=n;else for(var s in n)r[s]=n[s];return r}t.util.object={extend:e,clone:function(t,r){return e({},t,r)}},t.util.object.extend(t.util,t.Observable)}(),function(){function e(e,t){var r=e.charCodeAt(t);if(isNaN(r))return"";if(r<55296||r>57343)return e.charAt(t);if(55296<=r&&r<=56319){if(e.length<=t+1)throw"High surrogate without following low surrogate";var n=e.charCodeAt(t+1);if(56320>n||n>57343)throw"High surrogate without following low surrogate";return e.charAt(t)+e.charAt(t+1)}if(0===t)throw"Low surrogate without preceding high surrogate";var i=e.charCodeAt(t-1);if(55296>i||i>56319)throw"Low surrogate without preceding high surrogate";return!1}t.util.string={camelize:function(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():""})},capitalize:function(e,t){return e.charAt(0).toUpperCase()+(t?e.slice(1):e.slice(1).toLowerCase())},escapeXml:function(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},graphemeSplit:function(t){var r,n=0,i=[];for(n=0;n<t.length;n++)!1!==(r=e(t,n))&&i.push(r);return i}}}(),function(){var e=Array.prototype.slice,r=function(){},n=function(){for(var e in{toString:1})if("toString"===e)return!1;return!0}(),i=function(e,t,r){for(var i in t)i in e.prototype&&"function"==typeof e.prototype[i]&&(t[i]+"").indexOf("callSuper")>-1?e.prototype[i]=function(e){return function(){var n=this.constructor.superclass;this.constructor.superclass=r;var i=t[e].apply(this,arguments);if(this.constructor.superclass=n,"initialize"!==e)return i}}(i):e.prototype[i]=t[i],n&&(t.toString!==Object.prototype.toString&&(e.prototype.toString=t.toString),t.valueOf!==Object.prototype.valueOf&&(e.prototype.valueOf=t.valueOf))};function o(){}function a(t){for(var r=null,n=this;n.constructor.superclass;){var i=n.constructor.superclass.prototype[t];if(n[t]!==i){r=i;break}n=n.constructor.superclass.prototype}return r?arguments.length>1?r.apply(this,e.call(arguments,1)):r.call(this):console.log("tried to callSuper "+t+", method not found in prototype chain",this)}t.util.createClass=function(){var t=null,n=e.call(arguments,0);function s(){this.initialize.apply(this,arguments)}"function"==typeof n[0]&&(t=n.shift()),s.superclass=t,s.subclasses=[],t&&(o.prototype=t.prototype,s.prototype=new o,t.subclasses.push(s));for(var l=0,c=n.length;l<c;l++)i(s,n[l],t);return s.prototype.initialize||(s.prototype.initialize=r),s.prototype.constructor=s,s.prototype.callSuper=a,s}}(),function(){var e=!!t.document.createElement("div").attachEvent,r=["touchstart","touchmove","touchend"];t.util.addListener=function(t,r,n,i){t&&t.addEventListener(r,n,!e&&i)},t.util.removeListener=function(t,r,n,i){t&&t.removeEventListener(r,n,!e&&i)},t.util.getPointer=function(e){var r=e.target,n=t.util.getScrollLeftTop(r),i=function(e){var t=e.changedTouches;return t&&t[0]?t[0]:e}(e);return{x:i.clientX+n.left,y:i.clientY+n.top}},t.util.isTouchEvent=function(e){return r.indexOf(e.type)>-1||"touch"===e.pointerType}}(),function(){var e=t.document.createElement("div"),r="string"==typeof e.style.opacity,n="string"==typeof e.style.filter,i=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,o=function(e){return e};r?o=function(e,t){return e.style.opacity=t,e}:n&&(o=function(e,t){var r=e.style;return e.currentStyle&&!e.currentStyle.hasLayout&&(r.zoom=1),i.test(r.filter)?(t=t>=.9999?"":"alpha(opacity="+100*t+")",r.filter=r.filter.replace(i,t)):r.filter+=" alpha(opacity="+100*t+")",e}),t.util.setStyle=function(e,t){var r=e.style;if(!r)return e;if("string"==typeof t)return e.style.cssText+=";"+t,t.indexOf("opacity")>-1?o(e,t.match(/opacity:\s*(\d?\.?\d*)/)[1]):e;for(var n in t)if("opacity"===n)o(e,t[n]);else{var i="float"===n||"cssFloat"===n?typeof r.styleFloat>"u"?"cssFloat":"styleFloat":n;r.setProperty(i,t[n])}return e}}(),function(){var e=Array.prototype.slice;var r,n,i,o,a=function(t){return e.call(t,0)};try{r=a(t.document.childNodes)instanceof Array}catch{}function s(e,r){var n=t.document.createElement(e);for(var i in r)"class"===i?n.className=r[i]:"for"===i?n.htmlFor=r[i]:n.setAttribute(i,r[i]);return n}function l(e){for(var r=0,n=0,i=t.document.documentElement,o=t.document.body||{scrollLeft:0,scrollTop:0};e&&(e.parentNode||e.host)&&((e=e.parentNode||e.host)===t.document?(r=o.scrollLeft||i.scrollLeft||0,n=o.scrollTop||i.scrollTop||0):(r+=e.scrollLeft||0,n+=e.scrollTop||0),1!==e.nodeType||"fixed"!==e.style.position););return{left:r,top:n}}r||(a=function(e){for(var t=new Array(e.length),r=e.length;r--;)t[r]=e[r];return t}),n=t.document.defaultView&&t.document.defaultView.getComputedStyle?function(e,r){var n=t.document.defaultView.getComputedStyle(e,null);return n?n[r]:void 0}:function(e,t){var r=e.style[t];return!r&&e.currentStyle&&(r=e.currentStyle[t]),r},i=t.document.documentElement.style,o="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"",t.util.makeElementUnselectable=function(e){return typeof e.onselectstart<"u"&&(e.onselectstart=t.util.falseFunction),o?e.style[o]="none":"string"==typeof e.unselectable&&(e.unselectable="on"),e},t.util.makeElementSelectable=function(e){return typeof e.onselectstart<"u"&&(e.onselectstart=null),o?e.style[o]="":"string"==typeof e.unselectable&&(e.unselectable=""),e},t.util.setImageSmoothing=function(e,t){e.imageSmoothingEnabled=e.imageSmoothingEnabled||e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled||e.oImageSmoothingEnabled,e.imageSmoothingEnabled=t},t.util.getById=function(e){return"string"==typeof e?t.document.getElementById(e):e},t.util.toArray=a,t.util.addClass=function(e,t){e&&-1===(" "+e.className+" ").indexOf(" "+t+" ")&&(e.className+=(e.className?" ":"")+t)},t.util.makeElement=s,t.util.wrapElement=function(e,t,r){return"string"==typeof t&&(t=s(t,r)),e.parentNode&&e.parentNode.replaceChild(t,e),t.appendChild(e),t},t.util.getScrollLeftTop=l,t.util.getElementOffset=function(e){var t,r,i=e&&e.ownerDocument,o={left:0,top:0},a={left:0,top:0},s={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!i)return a;for(var c in s)a[s[c]]+=parseInt(n(e,c),10)||0;return t=i.documentElement,typeof e.getBoundingClientRect<"u"&&(o=e.getBoundingClientRect()),r=l(e),{left:o.left+r.left-(t.clientLeft||0)+a.left,top:o.top+r.top-(t.clientTop||0)+a.top}},t.util.getNodeCanvas=function(e){var r=t.jsdomImplForWrapper(e);return r._canvas||r._image},t.util.cleanUpJsdomNode=function(e){if(t.isLikelyNode){var r=t.jsdomImplForWrapper(e);r&&(r._image=null,r._canvas=null,r._currentSrc=null,r._attributes=null,r._classList=null)}}}(),function(){function e(){}t.util.request=function(r,n){n||(n={});var i=n.method?n.method.toUpperCase():"GET",o=n.onComplete||function(){},a=new t.window.XMLHttpRequest,s=n.body||n.parameters;return a.onreadystatechange=function(){4===a.readyState&&(o(a),a.onreadystatechange=e)},"GET"===i&&(s=null,"string"==typeof n.parameters&&(r=function(e,t){return e+(/\?/.test(e)?"&":"?")+t}(r,n.parameters))),a.open(i,r,!0),("POST"===i||"PUT"===i)&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(s),a}}(),t.log=console.log,t.warn=console.warn,function(){var e=t.util.object.extend,r=t.util.object.clone,n=[];function i(){return!1}function o(e,t,r,n){return-r*Math.cos(e/n*(Math.PI/2))+r+t}t.util.object.extend(n,{cancelAll:function(){var e=this.splice(0);return e.forEach(function(e){e.cancel()}),e},cancelByCanvas:function(e){if(!e)return[];var t=this.filter(function(t){return"object"==typeof t.target&&t.target.canvas===e});return t.forEach(function(e){e.cancel()}),t},cancelByTarget:function(e){var t=this.findAnimationsByTarget(e);return t.forEach(function(e){e.cancel()}),t},findAnimationIndex:function(e){return this.indexOf(this.findAnimation(e))},findAnimation:function(e){return this.find(function(t){return t.cancel===e})},findAnimationsByTarget:function(e){return e?this.filter(function(t){return t.target===e}):[]}});var a=t.window.requestAnimationFrame||t.window.webkitRequestAnimationFrame||t.window.mozRequestAnimationFrame||t.window.oRequestAnimationFrame||t.window.msRequestAnimationFrame||function(e){return t.window.setTimeout(e,1e3/60)},s=t.window.cancelAnimationFrame||t.window.clearTimeout;function l(){return a.apply(t.window,arguments)}t.util.animate=function(n){n||(n={});var a,s=!1,c=function(){var e=t.runningAnimations.indexOf(a);return e>-1&&t.runningAnimations.splice(e,1)[0]};return a=e(r(n),{cancel:function(){return s=!0,c()},currentValue:"startValue"in n?n.startValue:0,completionRate:0,durationRate:0}),t.runningAnimations.push(a),l(function(e){var t,r=e||+new Date,u=n.duration||500,d=r+u,h=n.onChange||i,f=n.abort||i,p=n.onComplete||i,g=n.easing||o,m="startValue"in n&&n.startValue.length>0,v="startValue"in n?n.startValue:0,y="endValue"in n?n.endValue:100,b=n.byValue||(m?v.map(function(e,t){return y[t]-v[t]}):y-v);n.onStart&&n.onStart(),function e(n){var i=(t=n||+new Date)>d?u:t-r,o=i/u,w=m?v.map(function(e,t){return g(i,v[t],b[t],u)}):g(i,v,b,u),x=Math.abs(m?(w[0]-v[0])/b[0]:(w-v)/b);if(a.currentValue=m?w.slice():w,a.completionRate=x,a.durationRate=o,!s){if(f(w,x,o))return void c();if(t>d)return a.currentValue=m?y.slice():y,a.completionRate=1,a.durationRate=1,h(m?y.slice():y,1,1),p(y,1,1),void c();h(w,x,o),l(e)}}(r)}),a.cancel},t.util.requestAnimFrame=l,t.util.cancelAnimFrame=function(){return s.apply(t.window,arguments)},t.runningAnimations=n}(),function(){function e(e,t,r){var n="rgba("+parseInt(e[0]+r*(t[0]-e[0]),10)+","+parseInt(e[1]+r*(t[1]-e[1]),10)+","+parseInt(e[2]+r*(t[2]-e[2]),10);return n+=","+(e&&t?parseFloat(e[3]+r*(t[3]-e[3])):1),n+=")"}t.util.animateColor=function(r,n,i,o){var a=new t.Color(r).getSource(),s=new t.Color(n).getSource(),l=o.onComplete,c=o.onChange;return o=o||{},t.util.animate(t.util.object.extend(o,{duration:i||500,startValue:a,endValue:s,byValue:s,easing:function(t,r,n,i){return e(r,n,o.colorEasing?o.colorEasing(t,i):1-Math.cos(t/i*(Math.PI/2)))},onComplete:function(t,r,n){if(l)return l(e(s,s,0),r,n)},onChange:function(t,r,n){if(c){if(Array.isArray(t))return c(e(t,t,0),r,n);c(t,r,n)}}}))}}(),function(){function e(e,t,r,n){return e<Math.abs(t)?(e=t,n=r/4):n=0===t&&0===e?r/(2*Math.PI)*Math.asin(1):r/(2*Math.PI)*Math.asin(t/e),{a:e,c:t,p:r,s:n}}function r(e,t,r){return e.a*Math.pow(2,10*(t-=1))*Math.sin((t*r-e.s)*(2*Math.PI)/e.p)}function n(e,t,r,n){return r-i(n-e,0,r,n)+t}function i(e,t,r,n){return(e/=n)<1/2.75?r*(7.5625*e*e)+t:e<2/2.75?r*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?r*(7.5625*(e-=2.25/2.75)*e+.9375)+t:r*(7.5625*(e-=2.625/2.75)*e+.984375)+t}t.util.ease={easeInQuad:function(e,t,r,n){return r*(e/=n)*e+t},easeOutQuad:function(e,t,r,n){return-r*(e/=n)*(e-2)+t},easeInOutQuad:function(e,t,r,n){return(e/=n/2)<1?r/2*e*e+t:-r/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,r,n){return r*(e/=n)*e*e+t},easeOutCubic:function(e,t,r,n){return r*((e=e/n-1)*e*e+1)+t},easeInOutCubic:function(e,t,r,n){return(e/=n/2)<1?r/2*e*e*e+t:r/2*((e-=2)*e*e+2)+t},easeInQuart:function(e,t,r,n){return r*(e/=n)*e*e*e+t},easeOutQuart:function(e,t,r,n){return-r*((e=e/n-1)*e*e*e-1)+t},easeInOutQuart:function(e,t,r,n){return(e/=n/2)<1?r/2*e*e*e*e+t:-r/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(e,t,r,n){return r*(e/=n)*e*e*e*e+t},easeOutQuint:function(e,t,r,n){return r*((e=e/n-1)*e*e*e*e+1)+t},easeInOutQuint:function(e,t,r,n){return(e/=n/2)<1?r/2*e*e*e*e*e+t:r/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(e,t,r,n){return-r*Math.cos(e/n*(Math.PI/2))+r+t},easeOutSine:function(e,t,r,n){return r*Math.sin(e/n*(Math.PI/2))+t},easeInOutSine:function(e,t,r,n){return-r/2*(Math.cos(Math.PI*e/n)-1)+t},easeInExpo:function(e,t,r,n){return 0===e?t:r*Math.pow(2,10*(e/n-1))+t},easeOutExpo:function(e,t,r,n){return e===n?t+r:r*(1-Math.pow(2,-10*e/n))+t},easeInOutExpo:function(e,t,r,n){return 0===e?t:e===n?t+r:(e/=n/2)<1?r/2*Math.pow(2,10*(e-1))+t:r/2*(2-Math.pow(2,-10*--e))+t},easeInCirc:function(e,t,r,n){return-r*(Math.sqrt(1-(e/=n)*e)-1)+t},easeOutCirc:function(e,t,r,n){return r*Math.sqrt(1-(e=e/n-1)*e)+t},easeInOutCirc:function(e,t,r,n){return(e/=n/2)<1?-r/2*(Math.sqrt(1-e*e)-1)+t:r/2*(Math.sqrt(1-(e-=2)*e)+1)+t},easeInElastic:function(t,n,i,o){var a=0;return 0===t?n:1===(t/=o)?n+i:(a||(a=.3*o),-r(e(i,i,a,1.70158),t,o)+n)},easeOutElastic:function(t,r,n,i){var o=0;if(0===t)return r;if(1===(t/=i))return r+n;o||(o=.3*i);var a=e(n,n,o,1.70158);return a.a*Math.pow(2,-10*t)*Math.sin((t*i-a.s)*(2*Math.PI)/a.p)+a.c+r},easeInOutElastic:function(t,n,i,o){var a=0;if(0===t)return n;if(2===(t/=o/2))return n+i;a||(a=o*(.3*1.5));var s=e(i,i,a,1.70158);return t<1?-.5*r(s,t,o)+n:s.a*Math.pow(2,-10*(t-=1))*Math.sin((t*o-s.s)*(2*Math.PI)/s.p)*.5+s.c+n},easeInBack:function(e,t,r,n,i){return void 0===i&&(i=1.70158),r*(e/=n)*e*((i+1)*e-i)+t},easeOutBack:function(e,t,r,n,i){return void 0===i&&(i=1.70158),r*((e=e/n-1)*e*((i+1)*e+i)+1)+t},easeInOutBack:function(e,t,r,n,i){return void 0===i&&(i=1.70158),(e/=n/2)<1?r/2*(e*e*((1+(i*=1.525))*e-i))+t:r/2*((e-=2)*e*((1+(i*=1.525))*e+i)+2)+t},easeInBounce:n,easeOutBounce:i,easeInOutBounce:function(e,t,r,o){return e<o/2?.5*n(2*e,0,r,o)+t:.5*i(2*e-o,0,r,o)+.5*r+t}}}(),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.util.object.clone,i=t.util.toFixed,o=t.util.parseUnit,a=t.util.multiplyTransformMatrices,s={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing"},l={stroke:"strokeOpacity",fill:"fillOpacity"},c="font-size",u="clip-path";function d(e){return e in s?s[e]:e}function h(e,r,n,i){var s,l=Array.isArray(r);if("fill"!==e&&"stroke"!==e||"none"!==r){if("strokeUniform"===e)return"non-scaling-stroke"===r;if("strokeDashArray"===e)r="none"===r?null:r.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===e)r=n&&n.transformMatrix?a(n.transformMatrix,t.parseTransformAttribute(r)):t.parseTransformAttribute(r);else if("visible"===e)r="none"!==r&&"hidden"!==r,n&&!1===n.visible&&(r=!1);else if("opacity"===e)r=parseFloat(r),n&&typeof n.opacity<"u"&&(r*=n.opacity);else if("textAnchor"===e)r="start"===r?"left":"end"===r?"right":"center";else if("charSpacing"===e)s=o(r,i)/i*1e3;else if("paintFirst"===e){var c=r.indexOf("fill"),u=r.indexOf("stroke");r="fill";(c>-1&&u>-1&&u<c||-1===c&&u>-1)&&(r="stroke")}else{if("href"===e||"xlink:href"===e||"font"===e)return r;if("imageSmoothing"===e)return"optimizeQuality"===r;s=l?r.map(o):o(r,i)}}else r="";return!l&&isNaN(s)?r:s}function f(e){return new RegExp("^("+e.join("|")+")\\b","i")}function p(e,t){var r,n,i,o,a=[];for(i=0,o=t.length;i<o;i++)r=t[i],n=e.getElementsByTagName(r),a=a.concat(Array.prototype.slice.call(n));return a}function g(e,t){var r,n=!0;return(r=m(e,t.pop()))&&t.length&&(n=function(e,t){for(var r,n=!0;e.parentNode&&1===e.parentNode.nodeType&&t.length;)n&&(r=t.pop()),e=e.parentNode,n=m(e,r);return 0===t.length}(e,t)),r&&n&&0===t.length}function m(e,t){var r,n,i=e.nodeName,o=e.getAttribute("class"),a=e.getAttribute("id");if(r=new RegExp("^"+i,"i"),t=t.replace(r,""),a&&t.length&&(r=new RegExp("#"+a+"(?![a-zA-Z\\-]+)","i"),t=t.replace(r,"")),o&&t.length)for(n=(o=o.split(" ")).length;n--;)r=new RegExp("\\."+o[n]+"(?![a-zA-Z\\-]+)","i"),t=t.replace(r,"");return 0===t.length}function v(e,t){var r;if(e.getElementById&&(r=e.getElementById(t)),r)return r;var n,i,o,a=e.getElementsByTagName("*");for(i=0,o=a.length;i<o;i++)if(t===(n=a[i]).getAttribute("id"))return n}t.svgValidTagNamesRegEx=f(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),t.svgViewBoxElementsRegEx=f(["symbol","image","marker","pattern","view","svg"]),t.svgInvalidAncestorsRegEx=f(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),t.svgValidParentsRegEx=f(["symbol","g","a","svg","clipPath","defs"]),t.cssRules={},t.gradientDefs={},t.clipPaths={},t.parseTransformAttribute=function(){function e(e,r,n){e[n]=Math.tan(t.util.degreesToRadians(r[0]))}var r=t.iMatrix,n=t.reNum,i=t.commaWsp,o="(?:"+("(?:(matrix)\\s*\\(\\s*("+n+")"+i+"("+n+")"+i+"("+n+")"+i+"("+n+")"+i+"("+n+")"+i+"("+n+")\\s*\\))")+"|"+("(?:(translate)\\s*\\(\\s*("+n+")(?:"+i+"("+n+"))?\\s*\\))")+"|"+("(?:(scale)\\s*\\(\\s*("+n+")(?:"+i+"("+n+"))?\\s*\\))")+"|"+("(?:(rotate)\\s*\\(\\s*("+n+")(?:"+i+"("+n+")"+i+"("+n+"))?\\s*\\))")+"|"+("(?:(skewX)\\s*\\(\\s*("+n+")\\s*\\))")+"|"+("(?:(skewY)\\s*\\(\\s*("+n+")\\s*\\))")+")",a=new RegExp("^\\s*(?:"+("(?:"+o+"(?:"+i+"*"+o+")*)")+"?)\\s*$"),s=new RegExp(o,"g");return function(n){var i=r.concat(),l=[];if(!n||n&&!a.test(n))return i;n.replace(s,function(n){var a=new RegExp(o).exec(n).filter(function(e){return!!e}),s=a[1],c=a.slice(2).map(parseFloat);switch(s){case"translate":!function(e,t){e[4]=t[0],2===t.length&&(e[5]=t[1])}(i,c);break;case"rotate":c[0]=t.util.degreesToRadians(c[0]),function(e,r){var n=t.util.cos(r[0]),i=t.util.sin(r[0]),o=0,a=0;3===r.length&&(o=r[1],a=r[2]),e[0]=n,e[1]=i,e[2]=-i,e[3]=n,e[4]=o-(n*o-i*a),e[5]=a-(i*o+n*a)}(i,c);break;case"scale":!function(e,t){var r=t[0],n=2===t.length?t[1]:t[0];e[0]=r,e[3]=n}(i,c);break;case"skewX":e(i,c,2);break;case"skewY":e(i,c,1);break;case"matrix":i=c}l.push(i.concat()),i=r.concat()});for(var c=l[0];l.length>1;)l.shift(),c=t.util.multiplyTransformMatrices(c,l[0]);return c}}();var y=new RegExp("^\\s*("+t.reNum+"+)\\s*,?\\s*("+t.reNum+"+)\\s*,?\\s*("+t.reNum+"+)\\s*,?\\s*("+t.reNum+"+)\\s*$");function b(e){if(!t.svgViewBoxElementsRegEx.test(e.nodeName))return{};var r,n,i,a,s,l,c=e.getAttribute("viewBox"),u=1,d=1,h=e.getAttribute("width"),f=e.getAttribute("height"),p=e.getAttribute("x")||0,g=e.getAttribute("y")||0,m=e.getAttribute("preserveAspectRatio")||"",v=!c||!(c=c.match(y)),b=!h||!f||"100%"===h||"100%"===f,w=v&&b,x={},C="",_=0,S=0;if(x.width=0,x.height=0,x.toBeParsed=w,v&&(p||g)&&e.parentNode&&"#document"!==e.parentNode.nodeName&&(C=" translate("+o(p)+" "+o(g)+") ",s=(e.getAttribute("transform")||"")+C,e.setAttribute("transform",s),e.removeAttribute("x"),e.removeAttribute("y")),w)return x;if(v)return x.width=o(h),x.height=o(f),x;if(r=-parseFloat(c[1]),n=-parseFloat(c[2]),i=parseFloat(c[3]),a=parseFloat(c[4]),x.minX=r,x.minY=n,x.viewBoxWidth=i,x.viewBoxHeight=a,b?(x.width=i,x.height=a):(x.width=o(h),x.height=o(f),u=x.width/i,d=x.height/a),"none"!==(m=t.util.parsePreserveAspectRatioAttribute(m)).alignX&&("meet"===m.meetOrSlice&&(d=u=u>d?d:u),"slice"===m.meetOrSlice&&(d=u=u>d?u:d),_=x.width-i*u,S=x.height-a*u,"Mid"===m.alignX&&(_/=2),"Mid"===m.alignY&&(S/=2),"Min"===m.alignX&&(_=0),"Min"===m.alignY&&(S=0)),1===u&&1===d&&0===r&&0===n&&0===p&&0===g)return x;if((p||g)&&"#document"!==e.parentNode.nodeName&&(C=" translate("+o(p)+" "+o(g)+") "),s=C+" matrix("+u+" 0 0 "+d+" "+(r*u+_)+" "+(n*d+S)+") ","svg"===e.nodeName){for(l=e.ownerDocument.createElementNS(t.svgNS,"g");e.firstChild;)l.appendChild(e.firstChild);e.appendChild(l)}else(l=e).removeAttribute("x"),l.removeAttribute("y"),s=l.getAttribute("transform")+s;return l.setAttribute("transform",s),x}function w(e,t){var r="xlink:href",n=v(e,t.getAttribute(r).slice(1));if(n&&n.getAttribute(r)&&w(e,n),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach(function(e){n&&!t.hasAttribute(e)&&n.hasAttribute(e)&&t.setAttribute(e,n.getAttribute(e))}),!t.children.length)for(var i=n.cloneNode(!0);i.firstChild;)t.appendChild(i.firstChild);t.removeAttribute(r)}t.parseSVGDocument=function(e,r,i,o){if(e){!function(e){for(var r=p(e,["use","svg:use"]),n=0;r.length&&n<r.length;){var i=r[n],o=i.getAttribute("xlink:href")||i.getAttribute("href");if(null===o)return;var a,s,l,c,u=o.slice(1),d=i.getAttribute("x")||0,h=i.getAttribute("y")||0,f=v(e,u).cloneNode(!0),g=(f.getAttribute("transform")||"")+" translate("+d+", "+h+")",m=r.length,y=t.svgNS;if(b(f),/^svg$/i.test(f.nodeName)){var w=f.ownerDocument.createElementNS(y,"g");for(s=0,c=(l=f.attributes).length;s<c;s++)a=l.item(s),w.setAttributeNS(y,a.nodeName,a.nodeValue);for(;f.firstChild;)w.appendChild(f.firstChild);f=w}for(s=0,c=(l=i.attributes).length;s<c;s++)"x"!==(a=l.item(s)).nodeName&&"y"!==a.nodeName&&"xlink:href"!==a.nodeName&&"href"!==a.nodeName&&("transform"===a.nodeName?g=a.nodeValue+" "+g:f.setAttribute(a.nodeName,a.nodeValue));f.setAttribute("transform",g),f.setAttribute("instantiated_by_use","1"),f.removeAttribute("id"),i.parentNode.replaceChild(f,i),r.length===m&&n++}}(e);var a,s,l=t.Object.__uid++,c=b(e),u=t.util.toArray(e.getElementsByTagName("*"));if(c.crossOrigin=o&&o.crossOrigin,c.svgUid=l,0===u.length&&t.isLikelyNode){var d=[];for(a=0,s=(u=e.selectNodes('//*[name(.)!="svg"]')).length;a<s;a++)d[a]=u[a];u=d}var h=u.filter(function(e){return b(e),t.svgValidTagNamesRegEx.test(e.nodeName.replace("svg:",""))&&!function(e,t){for(;e&&(e=e.parentNode);)if(e.nodeName&&t.test(e.nodeName.replace("svg:",""))&&!e.getAttribute("instantiated_by_use"))return!0;return!1}(e,t.svgInvalidAncestorsRegEx)});if(!h||h&&!h.length)return void(r&&r([],{}));var f={};u.filter(function(e){return"clipPath"===e.nodeName.replace("svg:","")}).forEach(function(e){var r=e.getAttribute("id");f[r]=t.util.toArray(e.getElementsByTagName("*")).filter(function(e){return t.svgValidTagNamesRegEx.test(e.nodeName.replace("svg:",""))})}),t.gradientDefs[l]=t.getGradientDefs(e),t.cssRules[l]=t.getCSSRules(e),t.clipPaths[l]=f,t.parseElements(h,function(e,n){r&&(r(e,c,n,u),delete t.gradientDefs[l],delete t.cssRules[l],delete t.clipPaths[l])},n(c),i,o)}};var x=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+t.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+t.reNum+"))?\\s+(.*)");r(t,{parseFontDeclaration:function(e,t){var r=e.match(x);if(r){var n=r[1],i=r[3],a=r[4],s=r[5],l=r[6];n&&(t.fontStyle=n),i&&(t.fontWeight=isNaN(parseFloat(i))?i:parseFloat(i)),a&&(t.fontSize=o(a)),l&&(t.fontFamily=l),s&&(t.lineHeight="normal"===s?1:s)}},getGradientDefs:function(e){var t,r=p(e,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),n=0,i={};for(n=r.length;n--;)(t=r[n]).getAttribute("xlink:href")&&w(e,t),i[t.getAttribute("id")]=t;return i},parseAttributes:function(e,n,a){if(e){var s,f,p,m={};typeof a>"u"&&(a=e.getAttribute("svgUid")),e.parentNode&&t.svgValidParentsRegEx.test(e.parentNode.nodeName)&&(m=t.parseAttributes(e.parentNode,n,a));var v=n.reduce(function(t,r){return(s=e.getAttribute(r))&&(t[r]=s),t},{}),y=r(function(e,r){var n={};for(var i in t.cssRules[r])if(g(e,i.split(" ")))for(var o in t.cssRules[r][i])n[o]=t.cssRules[r][i][o];return n}(e,a),t.parseStyleAttribute(e));v=r(v,y),y[u]&&e.setAttribute(u,y[u]),f=p=m.fontSize||t.Text.DEFAULT_SVG_FONT_SIZE,v[c]&&(v[c]=f=o(v[c],p));var b,w,x={};for(var C in v)w=h(b=d(C),v[C],m,f),x[b]=w;x&&x.font&&t.parseFontDeclaration(x.font,x);var _=r(m,x);return t.svgValidParentsRegEx.test(e.nodeName)?_:function(e){for(var r in l)if(!(typeof e[l[r]]>"u"||""===e[r])){if(typeof e[r]>"u"){if(!t.Object.prototype[r])continue;e[r]=t.Object.prototype[r]}if(0!==e[r].indexOf("url(")){var n=new t.Color(e[r]);e[r]=n.setAlpha(i(n.getAlpha()*e[l[r]],2)).toRgba()}}return e}(_)}},parseElements:function(e,r,n,i,o){new t.ElementsParser(e,r,n,i,o).parse()},parseStyleAttribute:function(e){var t={},r=e.getAttribute("style");return r&&("string"==typeof r?function(e,t){var r,n;e.replace(/;\s*$/,"").split(";").forEach(function(e){var i=e.split(":");r=i[0].trim().toLowerCase(),n=i[1].trim(),t[r]=n})}(r,t):function(e,t){var r,n;for(var i in e)typeof e[i]>"u"||(r=i.toLowerCase(),n=e[i],t[r]=n)}(r,t)),t},parsePointsAttribute:function(e){if(!e)return null;var t,r,n=[];for(t=0,r=(e=(e=e.replace(/,/g," ").trim()).split(/\s+/)).length;t<r;t+=2)n.push({x:parseFloat(e[t]),y:parseFloat(e[t+1])});return n},getCSSRules:function(e){var r,n,i=e.getElementsByTagName("style"),o={};for(r=0,n=i.length;r<n;r++){var a=i[r].textContent;""!==(a=a.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&a.split("}").filter(function(e){return e.trim()}).forEach(function(e){var i=e.split("{"),a={},s=i[1].trim().split(";").filter(function(e){return e.trim()});for(r=0,n=s.length;r<n;r++){var l=s[r].split(":"),c=l[0].trim(),u=l[1].trim();a[c]=u}(e=i[0].trim()).split(",").forEach(function(e){""!==(e=e.replace(/^svg/i,"").trim())&&(o[e]?t.util.object.extend(o[e],a):o[e]=t.util.object.clone(a))})})}return o},loadSVGFromURL:function(e,r,n,i){e=e.replace(/^\n\s*/,"").trim(),new t.util.request(e,{method:"get",onComplete:function(e){var o=e.responseXML;if(!o||!o.documentElement)return r&&r(null),!1;t.parseSVGDocument(o.documentElement,function(e,t,n,i){r&&r(e,t,n,i)},n,i)}})},loadSVGFromString:function(e,r,n,i){var o=(new t.window.DOMParser).parseFromString(e.trim(),"text/xml");t.parseSVGDocument(o.documentElement,function(e,t,n,i){r(e,t,n,i)},n,i)}})}(e),t.ElementsParser=function(e,t,r,n,i,o){this.elements=e,this.callback=t,this.options=r,this.reviver=n,this.svgUid=r&&r.svgUid||0,this.parsingOptions=i,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=o},function(e){e.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},e.createObjects=function(){var e=this;this.elements.forEach(function(t,r){t.setAttribute("svgUid",e.svgUid),e.createObject(t,r)})},e.findTag=function(e){return t[t.util.string.capitalize(e.tagName.replace("svg:",""))]},e.createObject=function(e,r){var n=this.findTag(e);if(n&&n.fromElement)try{n.fromElement(e,this.createCallback(r,e),this.options)}catch(e){t.log(e)}else this.checkIfDone()},e.createCallback=function(e,r){var n=this;return function(i){var o;n.resolveGradient(i,r,"fill"),n.resolveGradient(i,r,"stroke"),i instanceof t.Image&&i._originalElement&&(o=i.parsePreserveAspectRatioAttribute(r)),i._removeTransformMatrix(o),n.resolveClipPath(i,r),n.reviver&&n.reviver(r,i),n.instances[e]=i,n.checkIfDone()}},e.extractPropertyDefinition=function(e,r,n){var i=e[r],o=this.regexUrl;if(o.test(i)){o.lastIndex=0;var a=o.exec(i)[1];return o.lastIndex=0,t[n][this.svgUid][a]}},e.resolveGradient=function(e,r,n){var i=this.extractPropertyDefinition(e,n,"gradientDefs");if(i){var o=r.getAttribute(n+"-opacity"),a=t.Gradient.fromElement(i,e,o,this.options);e.set(n,a)}},e.createClipPathCallback=function(e,t){return function(e){e._removeTransformMatrix(),e.fillRule=e.clipRule,t.push(e)}},e.resolveClipPath=function(e,r){var n,i,o,a,s=this.extractPropertyDefinition(e,"clipPath","clipPaths");if(s){o=[],i=t.util.invertTransform(e.calcTransformMatrix());for(var l=s[0].parentNode,c=r;c.parentNode&&c.getAttribute("clip-path")!==e.clipPath;)c=c.parentNode;c.parentNode.appendChild(l);for(var u=0;u<s.length;u++)n=s[u],this.findTag(n).fromElement(n,this.createClipPathCallback(e,o),this.options);s=1===o.length?o[0]:new t.Group(o),a=t.util.multiplyTransformMatrices(i,s.calcTransformMatrix()),s.clipPath&&this.resolveClipPath(s,c);var d=t.util.qrDecompose(a);s.flipX=!1,s.flipY=!1,s.set("scaleX",d.scaleX),s.set("scaleY",d.scaleY),s.angle=d.angle,s.skewX=d.skewX,s.skewY=0,s.setPositionByOrigin({x:d.translateX,y:d.translateY},"center","center"),e.clipPath=s}else delete e.clipPath},e.checkIfDone=function(){0===--this.numElements&&(this.instances=this.instances.filter(function(e){return null!=e}),this.callback(this.instances,this.elements))}}(t.ElementsParser.prototype),function(e){var t=e.fabric||(e.fabric={});function r(e,t){this.x=e,this.y=t}t.Point?t.warn("fabric.Point is already defined"):(t.Point=r,r.prototype={type:"point",constructor:r,add:function(e){return new r(this.x+e.x,this.y+e.y)},addEquals:function(e){return this.x+=e.x,this.y+=e.y,this},scalarAdd:function(e){return new r(this.x+e,this.y+e)},scalarAddEquals:function(e){return this.x+=e,this.y+=e,this},subtract:function(e){return new r(this.x-e.x,this.y-e.y)},subtractEquals:function(e){return this.x-=e.x,this.y-=e.y,this},scalarSubtract:function(e){return new r(this.x-e,this.y-e)},scalarSubtractEquals:function(e){return this.x-=e,this.y-=e,this},multiply:function(e){return new r(this.x*e,this.y*e)},multiplyEquals:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return new r(this.x/e,this.y/e)},divideEquals:function(e){return this.x/=e,this.y/=e,this},eq:function(e){return this.x===e.x&&this.y===e.y},lt:function(e){return this.x<e.x&&this.y<e.y},lte:function(e){return this.x<=e.x&&this.y<=e.y},gt:function(e){return this.x>e.x&&this.y>e.y},gte:function(e){return this.x>=e.x&&this.y>=e.y},lerp:function(e,t){return typeof t>"u"&&(t=.5),t=Math.max(Math.min(1,t),0),new r(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t)},distanceFrom:function(e){var t=this.x-e.x,r=this.y-e.y;return Math.sqrt(t*t+r*r)},midPointFrom:function(e){return this.lerp(e)},min:function(e){return new r(Math.min(this.x,e.x),Math.min(this.y,e.y))},max:function(e){return new r(Math.max(this.x,e.x),Math.max(this.y,e.y))},toString:function(){return this.x+","+this.y},setXY:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setFromPoint:function(e){return this.x=e.x,this.y=e.y,this},swap:function(e){var t=this.x,r=this.y;this.x=e.x,this.y=e.y,e.x=t,e.y=r},clone:function(){return new r(this.x,this.y)}})}(e),function(e){var t=e.fabric||(e.fabric={});function r(e){this.status=e,this.points=[]}t.Intersection?t.warn("fabric.Intersection is already defined"):(t.Intersection=r,t.Intersection.prototype={constructor:r,appendPoint:function(e){return this.points.push(e),this},appendPoints:function(e){return this.points=this.points.concat(e),this}},t.Intersection.intersectLineLine=function(e,n,i,o){var a,s=(o.x-i.x)*(e.y-i.y)-(o.y-i.y)*(e.x-i.x),l=(n.x-e.x)*(e.y-i.y)-(n.y-e.y)*(e.x-i.x),c=(o.y-i.y)*(n.x-e.x)-(o.x-i.x)*(n.y-e.y);if(0!==c){var u=s/c,d=l/c;0<=u&&u<=1&&0<=d&&d<=1?(a=new r("Intersection")).appendPoint(new t.Point(e.x+u*(n.x-e.x),e.y+u*(n.y-e.y))):a=new r}else a=new r(0===s||0===l?"Coincident":"Parallel");return a},t.Intersection.intersectLinePolygon=function(e,t,n){var i,o,a,s,l=new r,c=n.length;for(s=0;s<c;s++)i=n[s],o=n[(s+1)%c],a=r.intersectLineLine(e,t,i,o),l.appendPoints(a.points);return l.points.length>0&&(l.status="Intersection"),l},t.Intersection.intersectPolygonPolygon=function(e,t){var n,i=new r,o=e.length;for(n=0;n<o;n++){var a=e[n],s=e[(n+1)%o],l=r.intersectLinePolygon(a,s,t);i.appendPoints(l.points)}return i.points.length>0&&(i.status="Intersection"),i},t.Intersection.intersectPolygonRectangle=function(e,n,i){var o=n.min(i),a=n.max(i),s=new t.Point(a.x,o.y),l=new t.Point(o.x,a.y),c=r.intersectLinePolygon(o,s,e),u=r.intersectLinePolygon(s,a,e),d=r.intersectLinePolygon(a,l,e),h=r.intersectLinePolygon(l,o,e),f=new r;return f.appendPoints(c.points),f.appendPoints(u.points),f.appendPoints(d.points),f.appendPoints(h.points),f.points.length>0&&(f.status="Intersection"),f})}(e),function(e){var t=e.fabric||(e.fabric={});function r(e){e?this._tryParsingColor(e):this.setSource([0,0,0,1])}function n(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}t.Color?t.warn("fabric.Color is already defined."):(t.Color=r,t.Color.prototype={_tryParsingColor:function(e){var t;e in r.colorNameMap&&(e=r.colorNameMap[e]),"transparent"===e&&(t=[255,255,255,0]),t||(t=r.sourceFromHex(e)),t||(t=r.sourceFromRgb(e)),t||(t=r.sourceFromHsl(e)),t||(t=[0,0,0,1]),t&&this.setSource(t)},_rgbToHsl:function(e,r,n){e/=255,r/=255,n/=255;var i,o,a,s=t.util.array.max([e,r,n]),l=t.util.array.min([e,r,n]);if(a=(s+l)/2,s===l)i=o=0;else{var c=s-l;switch(o=a>.5?c/(2-s-l):c/(s+l),s){case e:i=(r-n)/c+(r<n?6:0);break;case r:i=(n-e)/c+2;break;case n:i=(e-r)/c+4}i/=6}return[Math.round(360*i),Math.round(100*o),Math.round(100*a)]},getSource:function(){return this._source},setSource:function(e){this._source=e},toRgb:function(){var e=this.getSource();return"rgb("+e[0]+","+e[1]+","+e[2]+")"},toRgba:function(){var e=this.getSource();return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},toHsl:function(){var e=this.getSource(),t=this._rgbToHsl(e[0],e[1],e[2]);return"hsl("+t[0]+","+t[1]+"%,"+t[2]+"%)"},toHsla:function(){var e=this.getSource(),t=this._rgbToHsl(e[0],e[1],e[2]);return"hsla("+t[0]+","+t[1]+"%,"+t[2]+"%,"+e[3]+")"},toHex:function(){var e,t,r,n=this.getSource();return e=1===(e=n[0].toString(16)).length?"0"+e:e,t=1===(t=n[1].toString(16)).length?"0"+t:t,r=1===(r=n[2].toString(16)).length?"0"+r:r,e.toUpperCase()+t.toUpperCase()+r.toUpperCase()},toHexa:function(){var e,t=this.getSource();return e=1===(e=(e=Math.round(255*t[3])).toString(16)).length?"0"+e:e,this.toHex()+e.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(e){var t=this.getSource();return t[3]=e,this.setSource(t),this},toGrayscale:function(){var e=this.getSource(),t=parseInt((.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),10),r=e[3];return this.setSource([t,t,t,r]),this},toBlackWhite:function(e){var t=this.getSource(),r=(.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),n=t[3];return e=e||127,r=Number(r)<Number(e)?0:255,this.setSource([r,r,r,n]),this},overlayWith:function(e){e instanceof r||(e=new r(e));var t,n=[],i=this.getAlpha(),o=this.getSource(),a=e.getSource();for(t=0;t<3;t++)n.push(Math.round(.5*o[t]+.5*a[t]));return n[3]=i,this.setSource(n),this}},t.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i,t.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,t.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,t.Color.colorNameMap={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"},t.Color.fromRgb=function(e){return r.fromSource(r.sourceFromRgb(e))},t.Color.sourceFromRgb=function(e){var t=e.match(r.reRGBa);if(t){var n=parseInt(t[1],10)/(/%$/.test(t[1])?100:1)*(/%$/.test(t[1])?255:1),i=parseInt(t[2],10)/(/%$/.test(t[2])?100:1)*(/%$/.test(t[2])?255:1),o=parseInt(t[3],10)/(/%$/.test(t[3])?100:1)*(/%$/.test(t[3])?255:1);return[parseInt(n,10),parseInt(i,10),parseInt(o,10),t[4]?parseFloat(t[4]):1]}},t.Color.fromRgba=r.fromRgb,t.Color.fromHsl=function(e){return r.fromSource(r.sourceFromHsl(e))},t.Color.sourceFromHsl=function(e){var t=e.match(r.reHSLa);if(t){var i,o,a,s=(parseFloat(t[1])%360+360)%360/360,l=parseFloat(t[2])/(/%$/.test(t[2])?100:1),c=parseFloat(t[3])/(/%$/.test(t[3])?100:1);if(0===l)i=o=a=c;else{var u=c<=.5?c*(l+1):c+l-c*l,d=2*c-u;i=n(d,u,s+1/3),o=n(d,u,s),a=n(d,u,s-1/3)}return[Math.round(255*i),Math.round(255*o),Math.round(255*a),t[4]?parseFloat(t[4]):1]}},t.Color.fromHsla=r.fromHsl,t.Color.fromHex=function(e){return r.fromSource(r.sourceFromHex(e))},t.Color.sourceFromHex=function(e){if(e.match(r.reHex)){var t=e.slice(e.indexOf("#")+1),n=3===t.length||4===t.length,i=8===t.length||4===t.length,o=n?t.charAt(0)+t.charAt(0):t.substring(0,2),a=n?t.charAt(1)+t.charAt(1):t.substring(2,4),s=n?t.charAt(2)+t.charAt(2):t.substring(4,6),l=i?n?t.charAt(3)+t.charAt(3):t.substring(6,8):"FF";return[parseInt(o,16),parseInt(a,16),parseInt(s,16),parseFloat((parseInt(l,16)/255).toFixed(2))]}},t.Color.fromSource=function(e){var t=new r;return t.setSource(e),t})}(e),function(e){var t=e.fabric||(e.fabric={}),r=["e","se","s","sw","w","nw","n","ne","e"],n=["ns","nesw","ew","nwse"],i={},o="left",a="top",s="right",l="bottom",c="center",u={top:l,bottom:a,left:s,right:o,center:c},d=t.util.radiansToDegrees,h=Math.sign||function(e){return(e>0)-(e<0)||+e};function f(e,t){var r=e.angle+d(Math.atan2(t.y,t.x))+360;return Math.round(r%360/45)}function p(e,r){var n=r.transform.target,i=n.canvas,o=t.util.object.clone(r);o.target=n,i&&i.fire("object:"+e,o),n.fire(e,r)}function g(e,t){var r=t.canvas,n=e[r.uniScaleKey];return r.uniformScaling&&!n||!r.uniformScaling&&n}function m(e){return e.originX===c&&e.originY===c}function v(e,t,r){var n=e.lockScalingX,i=e.lockScalingY;return!!(n&&i||!t&&(n||i)&&r||n&&"x"===t||i&&"y"===t)}function y(e,t,r,n){return{e:e,transform:t,pointer:{x:r,y:n}}}function b(e){return function(t,r,n,i){var o=r.target,a=o.getCenterPoint(),s=o.translateToOriginPoint(a,r.originX,r.originY),l=e(t,r,n,i);return o.setPositionByOrigin(s,r.originX,r.originY),l}}function w(e,t){return function(r,n,i,o){var a=t(r,n,i,o);return a&&p(e,y(r,n,i,o)),a}}function x(e,r,n,i,o){var a=e.target,s=a.controls[e.corner],l=a.canvas.getZoom(),c=a.padding/l,u=a.toLocalPoint(new t.Point(i,o),r,n);return u.x>=c&&(u.x-=c),u.x<=-c&&(u.x+=c),u.y>=c&&(u.y-=c),u.y<=c&&(u.y+=c),u.x-=s.offsetX,u.y-=s.offsetY,u}function C(e){return e.flipX!==e.flipY}function _(e,t,r,n,i){if(0!==e[t]){var o=i/e._getTransformedDimensions()[n]*e[r];e.set(r,o)}}function S(e,t,r,n){var i,c=t.target,u=c._getTransformedDimensions(0,c.skewY),h=x(t,t.originX,t.originY,r,n),f=Math.abs(2*h.x)-u.x,p=c.skewX;f<2?i=0:(i=d(Math.atan2(f/c.scaleX,u.y/c.scaleY)),t.originX===o&&t.originY===l&&(i=-i),t.originX===s&&t.originY===a&&(i=-i),C(c)&&(i=-i));var g=p!==i;if(g){var m=c._getTransformedDimensions().y;c.set("skewX",i),_(c,"skewY","scaleY","y",m)}return g}function A(e,t,r,n){var i,c=t.target,u=c._getTransformedDimensions(c.skewX,0),h=x(t,t.originX,t.originY,r,n),f=Math.abs(2*h.y)-u.y,p=c.skewY;f<2?i=0:(i=d(Math.atan2(f/c.scaleY,u.x/c.scaleX)),t.originX===o&&t.originY===l&&(i=-i),t.originX===s&&t.originY===a&&(i=-i),C(c)&&(i=-i));var g=p!==i;if(g){var m=c._getTransformedDimensions().x;c.set("skewY",i),_(c,"skewX","scaleX","x",m)}return g}function k(e,t,r,n,i){i=i||{};var o,a,s,l,c,d,f=t.target,p=f.lockScalingX,y=f.lockScalingY,b=i.by,w=g(e,f),C=v(f,b,w),_=t.gestureScale;if(C)return!1;if(_)a=t.scaleX*_,s=t.scaleY*_;else{if(o=x(t,t.originX,t.originY,r,n),c="y"!==b?h(o.x):1,d="x"!==b?h(o.y):1,t.signX||(t.signX=c),t.signY||(t.signY=d),f.lockScalingFlip&&(t.signX!==c||t.signY!==d))return!1;if(l=f._getTransformedDimensions(),w&&!b){var S=Math.abs(o.x)+Math.abs(o.y),A=t.original,k=S/(Math.abs(l.x*A.scaleX/f.scaleX)+Math.abs(l.y*A.scaleY/f.scaleY));a=A.scaleX*k,s=A.scaleY*k}else a=Math.abs(o.x*f.scaleX/l.x),s=Math.abs(o.y*f.scaleY/l.y);m(t)&&(a*=2,s*=2),t.signX!==c&&"y"!==b&&(t.originX=u[t.originX],a*=-1,t.signX=c),t.signY!==d&&"x"!==b&&(t.originY=u[t.originY],s*=-1,t.signY=d)}var E=f.scaleX,I=f.scaleY;return b?("x"===b&&f.set("scaleX",a),"y"===b&&f.set("scaleY",s)):(!p&&f.set("scaleX",a),!y&&f.set("scaleY",s)),E!==f.scaleX||I!==f.scaleY}i.scaleCursorStyleHandler=function(e,t,n){var i=g(e,n),o="";if(0!==t.x&&0===t.y?o="x":0===t.x&&0!==t.y&&(o="y"),v(n,o,i))return"not-allowed";var a=f(n,t);return r[a]+"-resize"},i.skewCursorStyleHandler=function(e,t,r){if(0!==t.x&&r.lockSkewingY||0!==t.y&&r.lockSkewingX)return"not-allowed";var i=f(r,t)%4;return n[i]+"-resize"},i.scaleSkewCursorStyleHandler=function(e,t,r){return e[r.canvas.altActionKey]?i.skewCursorStyleHandler(e,t,r):i.scaleCursorStyleHandler(e,t,r)},i.rotationWithSnapping=w("rotating",b(function(e,t,r,n){var i=t,o=i.target,a=o.translateToOriginPoint(o.getCenterPoint(),i.originX,i.originY);if(o.lockRotation)return!1;var s,l=Math.atan2(i.ey-a.y,i.ex-a.x),c=Math.atan2(n-a.y,r-a.x),u=d(c-l+i.theta);if(o.snapAngle>0){var h=o.snapAngle,f=o.snapThreshold||h,p=Math.ceil(u/h)*h,g=Math.floor(u/h)*h;Math.abs(u-g)<f?u=g:Math.abs(u-p)<f&&(u=p)}return u<0&&(u=360+u),u%=360,s=o.angle!==u,o.angle=u,s})),i.scalingEqually=w("scaling",b(function(e,t,r,n){return k(e,t,r,n)})),i.scalingX=w("scaling",b(function(e,t,r,n){return k(e,t,r,n,{by:"x"})})),i.scalingY=w("scaling",b(function(e,t,r,n){return k(e,t,r,n,{by:"y"})})),i.scalingYOrSkewingX=function(e,t,r,n){return e[t.target.canvas.altActionKey]?i.skewHandlerX(e,t,r,n):i.scalingY(e,t,r,n)},i.scalingXOrSkewingY=function(e,t,r,n){return e[t.target.canvas.altActionKey]?i.skewHandlerY(e,t,r,n):i.scalingX(e,t,r,n)},i.changeWidth=w("resizing",b(function(e,t,r,n){var i=t.target,o=x(t,t.originX,t.originY,r,n),a=i.strokeWidth/(i.strokeUniform?i.scaleX:1),s=m(t)?2:1,l=i.width,c=Math.abs(o.x*s/i.scaleX)-a;return i.set("width",Math.max(c,0)),l!==c})),i.skewHandlerX=function(e,t,r,n){var i,l=t.target,u=l.skewX,d=t.originY;return!l.lockSkewingX&&(0===u?i=x(t,c,c,r,n).x>0?o:s:(u>0&&(i=d===a?o:s),u<0&&(i=d===a?s:o),C(l)&&(i=i===o?s:o)),t.originX=i,w("skewing",b(S))(e,t,r,n))},i.skewHandlerY=function(e,t,r,n){var i,s=t.target,u=s.skewY,d=t.originX;return!s.lockSkewingY&&(0===u?i=x(t,c,c,r,n).y>0?a:l:(u>0&&(i=d===o?a:l),u<0&&(i=d===o?l:a),C(s)&&(i=i===a?l:a)),t.originY=i,w("skewing",b(A))(e,t,r,n))},i.dragHandler=function(e,t,r,n){var i=t.target,o=r-t.offsetX,a=n-t.offsetY,s=!i.get("lockMovementX")&&i.left!==o,l=!i.get("lockMovementY")&&i.top!==a;return s&&i.set("left",o),l&&i.set("top",a),(s||l)&&p("moving",y(e,t,r,n)),s||l},i.scaleOrSkewActionName=function(e,t,r){var n=e[r.canvas.altActionKey];return 0===t.x?n?"skewX":"scaleY":0===t.y?n?"skewY":"scaleX":void 0},i.rotationStyleHandler=function(e,t,r){return r.lockRotation?"not-allowed":t.cursorStyle},i.fireEvent=p,i.wrapWithFixedAnchor=b,i.wrapWithFireEvent=w,i.getLocalPoint=x,t.controlsUtils=i}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.degreesToRadians,n=t.controlsUtils;n.renderCircleControl=function(e,t,r,n,i){n=n||{};var o,a=this.sizeX||n.cornerSize||i.cornerSize,s=this.sizeY||n.cornerSize||i.cornerSize,l=typeof n.transparentCorners<"u"?n.transparentCorners:i.transparentCorners,c=l?"stroke":"fill",u=!l&&(n.cornerStrokeColor||i.cornerStrokeColor),d=t,h=r;e.save(),e.fillStyle=n.cornerColor||i.cornerColor,e.strokeStyle=n.cornerStrokeColor||i.cornerStrokeColor,a>s?(o=a,e.scale(1,s/a),h=r*a/s):s>a?(o=s,e.scale(a/s,1),d=t*s/a):o=a,e.lineWidth=1,e.beginPath(),e.arc(d,h,o/2,0,2*Math.PI,!1),e[c](),u&&e.stroke(),e.restore()},n.renderSquareControl=function(e,t,n,i,o){i=i||{};var a=this.sizeX||i.cornerSize||o.cornerSize,s=this.sizeY||i.cornerSize||o.cornerSize,l=typeof i.transparentCorners<"u"?i.transparentCorners:o.transparentCorners,c=l?"stroke":"fill",u=!l&&(i.cornerStrokeColor||o.cornerStrokeColor),d=a/2,h=s/2;e.save(),e.fillStyle=i.cornerColor||o.cornerColor,e.strokeStyle=i.cornerStrokeColor||o.cornerStrokeColor,e.lineWidth=1,e.translate(t,n),e.rotate(r(o.angle)),e[c+"Rect"](-d,-h,a,s),u&&e.strokeRect(-d,-h,a,s),e.restore()}}(e),function(e){var t=e.fabric||(e.fabric={});t.Control=function(e){for(var t in e)this[t]=e[t]},t.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(e,t){return t.cursorStyle},getActionName:function(e,t){return t.actionName},getVisibility:function(e,t){var r=e._controlsVisibility;return r&&typeof r[t]<"u"?r[t]:this.visible},setVisibility:function(e){this.visible=e},positionHandler:function(e,r){return t.util.transformPoint({x:this.x*e.x+this.offsetX,y:this.y*e.y+this.offsetY},r)},calcCornerCoords:function(e,r,n,i,o){var a,s,l,c,u=o?this.touchSizeX:this.sizeX,d=o?this.touchSizeY:this.sizeY;if(u&&d&&u!==d){var h=Math.atan2(d,u),f=Math.sqrt(u*u+d*d)/2,p=h-t.util.degreesToRadians(e),g=Math.PI/2-h-t.util.degreesToRadians(e);a=f*t.util.cos(p),s=f*t.util.sin(p),l=f*t.util.cos(g),c=f*t.util.sin(g)}else{f=.7071067812*(u&&d?u:r);p=t.util.degreesToRadians(45-e);a=l=f*t.util.cos(p),s=c=f*t.util.sin(p)}return{tl:{x:n-c,y:i-l},tr:{x:n+a,y:i-s},bl:{x:n-a,y:i+s},br:{x:n+c,y:i+l}}},render:function(e,r,n,i,o){if("circle"===((i=i||{}).cornerStyle||o.cornerStyle))t.controlsUtils.renderCircleControl.call(this,e,r,n,i,o);else t.controlsUtils.renderSquareControl.call(this,e,r,n,i,o)}}}(e),function(){function e(e,r){var n,i,o,a,s=e.getAttribute("style"),l=e.getAttribute("offset")||0;if(l=(l=parseFloat(l)/(/%$/.test(l)?100:1))<0?0:l>1?1:l,s){var c=s.split(/\s*;\s*/);for(""===c[c.length-1]&&c.pop(),a=c.length;a--;){var u=c[a].split(/\s*:\s*/),d=u[0].trim(),h=u[1].trim();"stop-color"===d?n=h:"stop-opacity"===d&&(o=h)}}return n||(n=e.getAttribute("stop-color")||"rgb(0,0,0)"),o||(o=e.getAttribute("stop-opacity")),i=(n=new t.Color(n)).getAlpha(),o=isNaN(parseFloat(o))?1:parseFloat(o),o*=i*r,{offset:l,color:n.toRgb(),opacity:o}}var r=t.util.object.clone;t.Gradient=t.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(e){e||(e={}),e.coords||(e.coords={});var r,n=this;Object.keys(e).forEach(function(t){n[t]=e[t]}),this.id?this.id+="_"+t.Object.__uid++:this.id=t.Object.__uid++,r={x1:e.coords.x1||0,y1:e.coords.y1||0,x2:e.coords.x2||0,y2:e.coords.y2||0},"radial"===this.type&&(r.r1=e.coords.r1||0,r.r2=e.coords.r2||0),this.coords=r,this.colorStops=e.colorStops.slice()},addColorStop:function(e){for(var r in e){var n=new t.Color(e[r]);this.colorStops.push({offset:parseFloat(r),color:n.toRgb(),opacity:n.getAlpha()})}return this},toObject:function(e){var r={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return t.util.populateWithProperties(this,r,e),r},toSVG:function(e,n){var i,o,a,s,l=r(this.coords,!0),c=(n=n||{},r(this.colorStops,!0)),u=l.r1>l.r2,d=this.gradientTransform?this.gradientTransform.concat():t.iMatrix.concat(),h=-this.offsetX,f=-this.offsetY,p=!!n.additionalTransform,g="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(c.sort(function(e,t){return e.offset-t.offset}),"objectBoundingBox"===g?(h/=e.width,f/=e.height):(h+=e.width/2,f+=e.height/2),"path"===e.type&&"percentage"!==this.gradientUnits&&(h-=e.pathOffset.x,f-=e.pathOffset.y),d[4]-=h,d[5]-=f,s='id="SVGID_'+this.id+'" gradientUnits="'+g+'"',s+=' gradientTransform="'+(p?n.additionalTransform+" ":"")+t.util.matrixToSVG(d)+'" ',"linear"===this.type?a=["<linearGradient ",s,' x1="',l.x1,'" y1="',l.y1,'" x2="',l.x2,'" y2="',l.y2,'">\n']:"radial"===this.type&&(a=["<radialGradient ",s,' cx="',u?l.x1:l.x2,'" cy="',u?l.y1:l.y2,'" r="',u?l.r1:l.r2,'" fx="',u?l.x2:l.x1,'" fy="',u?l.y2:l.y1,'">\n']),"radial"===this.type){if(u)for((c=c.concat()).reverse(),i=0,o=c.length;i<o;i++)c[i].offset=1-c[i].offset;var m=Math.min(l.r1,l.r2);if(m>0){var v=m/Math.max(l.r1,l.r2);for(i=0,o=c.length;i<o;i++)c[i].offset+=v*(1-c[i].offset)}}for(i=0,o=c.length;i<o;i++){var y=c[i];a.push("<stop ",'offset="',100*y.offset+"%",'" style="stop-color:',y.color,typeof y.opacity<"u"?";stop-opacity: "+y.opacity:";",'"/>\n')}return a.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),a.join("")},toLive:function(e){var r,n,i,o=t.util.object.clone(this.coords);if(this.type){for("linear"===this.type?r=e.createLinearGradient(o.x1,o.y1,o.x2,o.y2):"radial"===this.type&&(r=e.createRadialGradient(o.x1,o.y1,o.r1,o.x2,o.y2,o.r2)),n=0,i=this.colorStops.length;n<i;n++){var a=this.colorStops[n].color,s=this.colorStops[n].opacity,l=this.colorStops[n].offset;typeof s<"u"&&(a=new t.Color(a).setAlpha(s).toRgba()),r.addColorStop(l,a)}return r}}}),t.util.object.extend(t.Gradient,{fromElement:function(r,n,i,o){var a=parseFloat(i)/(/%$/.test(i)?100:1);a=a<0?0:a>1?1:a,isNaN(a)&&(a=1);var s,l,c,u,d=r.getElementsByTagName("stop"),h="userSpaceOnUse"===r.getAttribute("gradientUnits")?"pixels":"percentage",f=r.getAttribute("gradientTransform")||"",p=[],g=0,m=0;for("linearGradient"===r.nodeName||"LINEARGRADIENT"===r.nodeName?(s="linear",l=function(e){return{x1:e.getAttribute("x1")||0,y1:e.getAttribute("y1")||0,x2:e.getAttribute("x2")||"100%",y2:e.getAttribute("y2")||0}}(r)):(s="radial",l=function(e){return{x1:e.getAttribute("fx")||e.getAttribute("cx")||"50%",y1:e.getAttribute("fy")||e.getAttribute("cy")||"50%",r1:0,x2:e.getAttribute("cx")||"50%",y2:e.getAttribute("cy")||"50%",r2:e.getAttribute("r")||"50%"}}(r)),c=d.length;c--;)p.push(e(d[c],a));return u=t.parseTransformAttribute(f),function(e,t,r,n){var i,o;Object.keys(t).forEach(function(e){"Infinity"===(i=t[e])?o=1:"-Infinity"===i?o=0:(o=parseFloat(t[e],10),"string"==typeof i&&/^(\d+\.\d+)%|(\d+)%$/.test(i)&&(o*=.01,"pixels"===n&&(("x1"===e||"x2"===e||"r2"===e)&&(o*=r.viewBoxWidth||r.width),("y1"===e||"y2"===e)&&(o*=r.viewBoxHeight||r.height)))),t[e]=o})}(0,l,o,h),"pixels"===h&&(g=-n.left,m=-n.top),new t.Gradient({id:r.getAttribute("id"),type:s,coords:l,colorStops:p,gradientUnits:h,gradientTransform:u,offsetX:g,offsetY:m})}})}(),function(){var e=t.util.toFixed;t.Pattern=t.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(e,r){if(e||(e={}),this.id=t.Object.__uid++,this.setOptions(e),!e.source||e.source&&"string"!=typeof e.source)r&&r(this);else{var n=this;this.source=t.util.createImage(),t.util.loadImage(e.source,function(e,t){n.source=e,r&&r(n,t)},null,this.crossOrigin)}},toObject:function(r){var n,i,o=t.Object.NUM_FRACTION_DIGITS;return"string"==typeof this.source.src?n=this.source.src:"object"==typeof this.source&&this.source.toDataURL&&(n=this.source.toDataURL()),i={type:"pattern",source:n,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:e(this.offsetX,o),offsetY:e(this.offsetY,o),patternTransform:this.patternTransform?this.patternTransform.concat():null},t.util.populateWithProperties(this,i,r),i},toSVG:function(e){var t="function"==typeof this.source?this.source():this.source,r=t.width/e.width,n=t.height/e.height,i=this.offsetX/e.width,o=this.offsetY/e.height,a="";return("repeat-x"===this.repeat||"no-repeat"===this.repeat)&&(n=1,o&&(n+=Math.abs(o))),("repeat-y"===this.repeat||"no-repeat"===this.repeat)&&(r=1,i&&(r+=Math.abs(i))),t.src?a=t.src:t.toDataURL&&(a=t.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+i+'" y="'+o+'" width="'+r+'" height="'+n+'">\n<image x="0" y="0" width="'+t.width+'" height="'+t.height+'" xlink:href="'+a+'"></image>\n</pattern>\n'},setOptions:function(e){for(var t in e)this[t]=e[t]},toLive:function(e){var t=this.source;return!t||typeof t.src<"u"&&(!t.complete||0===t.naturalWidth||0===t.naturalHeight)?"":e.createPattern(t,this.repeat)}})}(),function(e){var t=e.fabric||(e.fabric={}),r=t.util.toFixed;t.Shadow?t.warn("fabric.Shadow is already defined."):(t.Shadow=t.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(e){for(var r in"string"==typeof e&&(e=this._parseShadow(e)),e)this[r]=e[r];this.id=t.Object.__uid++},_parseShadow:function(e){var r=e.trim(),n=t.Shadow.reOffsetsAndBlur.exec(r)||[];return{color:(r.replace(t.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)").trim(),offsetX:parseFloat(n[1],10)||0,offsetY:parseFloat(n[2],10)||0,blur:parseFloat(n[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(e){var n=40,i=40,o=t.Object.NUM_FRACTION_DIGITS,a=t.util.rotateVector({x:this.offsetX,y:this.offsetY},t.util.degreesToRadians(-e.angle)),s=new t.Color(this.color);return e.width&&e.height&&(n=100*r((Math.abs(a.x)+this.blur)/e.width,o)+20,i=100*r((Math.abs(a.y)+this.blur)/e.height,o)+20),e.flipX&&(a.x*=-1),e.flipY&&(a.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+i+'%" height="'+(100+2*i)+'%" x="-'+n+'%" width="'+(100+2*n)+'%" >\n\t<feGaussianBlur in="SourceAlpha" stdDeviation="'+r(this.blur?this.blur/2:0,o)+'"></feGaussianBlur>\n\t<feOffset dx="'+r(a.x,o)+'" dy="'+r(a.y,o)+'" result="oBlur" ></feOffset>\n\t<feFlood flood-color="'+s.toRgb()+'" flood-opacity="'+s.getAlpha()+'"/>\n\t<feComposite in2="oBlur" operator="in" />\n\t<feMerge>\n\t\t<feMergeNode></feMergeNode>\n\t\t<feMergeNode in="SourceGraphic"></feMergeNode>\n\t</feMerge>\n</filter>\n'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var e={},r=t.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach(function(t){this[t]!==r[t]&&(e[t]=this[t])},this),e}}),t.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/)}(e),function(){if(t.StaticCanvas)t.warn("fabric.StaticCanvas is already defined.");else{var e=t.util.object.extend,r=t.util.getElementOffset,n=t.util.removeFromArray,i=t.util.toFixed,o=t.util.transformPoint,a=t.util.invertTransform,s=t.util.getNodeCanvas,l=t.util.createCanvasElement,c=new Error("Could not initialize `canvas` element");t.StaticCanvas=t.util.createClass(t.CommonMethods,{initialize:function(e,t){t||(t={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(e,t)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:t.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(e,t){var r=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(e),this._initOptions(t),this.interactive||this._initRetinaScaling(),t.overlayImage&&this.setOverlayImage(t.overlayImage,r),t.backgroundImage&&this.setBackgroundImage(t.backgroundImage,r),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor,r),t.overlayColor&&this.setOverlayColor(t.overlayColor,r),this.calcOffset()},_isRetinaScaling:function(){return t.devicePixelRatio>1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,t.devicePixelRatio):1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var e=t.devicePixelRatio;this.__initRetinaScaling(e,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(e,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(e,t,r){t.setAttribute("width",this.width*e),t.setAttribute("height",this.height*e),r.scale(e,e)},calcOffset:function(){return this._offset=r(this.lowerCanvasEl),this},setOverlayImage:function(e,t,r){return this.__setBgOverlayImage("overlayImage",e,t,r)},setBackgroundImage:function(e,t,r){return this.__setBgOverlayImage("backgroundImage",e,t,r)},setOverlayColor:function(e,t){return this.__setBgOverlayColor("overlayColor",e,t)},setBackgroundColor:function(e,t){return this.__setBgOverlayColor("backgroundColor",e,t)},__setBgOverlayImage:function(e,r,n,i){return"string"==typeof r?t.util.loadImage(r,function(r,o){if(r){var a=new t.Image(r,i);this[e]=a,a.canvas=this}n&&n(r,o)},this,i&&i.crossOrigin):(i&&r.setOptions(i),this[e]=r,r&&(r.canvas=this),n&&n(r,!1)),this},__setBgOverlayColor:function(e,t,r){return this[e]=t,this._initGradient(t,e),this._initPattern(t,e,r),this},_createCanvasElement:function(){var e=l();if(!e||(e.style||(e.style={}),typeof e.getContext>"u"))throw c;return e},_initOptions:function(e){var t=this.lowerCanvasEl;this._setOptions(e),this.width=this.width||parseInt(t.width,10)||0,this.height=this.height||parseInt(t.height,10)||0,this.lowerCanvasEl.style&&(t.width=this.width,t.height=this.height,t.style.width=this.width+"px",t.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(e){e&&e.getContext?this.lowerCanvasEl=e:this.lowerCanvasEl=t.util.getById(e)||this._createCanvasElement(),t.util.addClass(this.lowerCanvasEl,"lower-canvas"),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(e,t){return this.setDimensions({width:e},t)},setHeight:function(e,t){return this.setDimensions({height:e},t)},setDimensions:function(e,t){var r;for(var n in t=t||{},e)r=e[n],t.cssOnly||(this._setBackstoreDimension(n,e[n]),r+="px",this.hasLostContext=!0),t.backstoreOnly||this._setCssDimension(n,r);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop),this._initRetinaScaling(),this.calcOffset(),t.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(e,t){return this.lowerCanvasEl[e]=t,this.upperCanvasEl&&(this.upperCanvasEl[e]=t),this.cacheCanvasEl&&(this.cacheCanvasEl[e]=t),this[e]=t,this},_setCssDimension:function(e,t){return this.lowerCanvasEl.style[e]=t,this.upperCanvasEl&&(this.upperCanvasEl.style[e]=t),this.wrapperEl&&(this.wrapperEl.style[e]=t),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(e){var t,r,n,i=this._activeObject,o=this.backgroundImage,a=this.overlayImage;for(this.viewportTransform=e,r=0,n=this._objects.length;r<n;r++)(t=this._objects[r]).group||t.setCoords(!0);return i&&i.setCoords(),o&&o.setCoords(!0),a&&a.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(e,t){var r=e,n=this.viewportTransform.slice(0);e=o(e,a(this.viewportTransform)),n[0]=t,n[3]=t;var i=o(e,n);return n[4]+=r.x-i.x,n[5]+=r.y-i.y,this.setViewportTransform(n)},setZoom:function(e){return this.zoomToPoint(new t.Point(0,0),e),this},absolutePan:function(e){var t=this.viewportTransform.slice(0);return t[4]=-e.x,t[5]=-e.y,this.setViewportTransform(t)},relativePan:function(e){return this.absolutePan(new t.Point(-e.x-this.viewportTransform[4],-e.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(e){this.stateful&&e.setupState(),e._set("canvas",this),e.setCoords(),this.fire("object:added",{target:e}),e.fire("added")},_onObjectRemoved:function(e){this.fire("object:removed",{target:e}),e.fire("removed"),delete e.canvas},clearContext:function(e){return e.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var e=this.contextContainer;return this.renderCanvas(e,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=t.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var e={},r=this.width,n=this.height,i=a(this.viewportTransform);return e.tl=o({x:0,y:0},i),e.br=o({x:r,y:n},i),e.tr=new t.Point(e.br.x,e.tl.y),e.bl=new t.Point(e.tl.x,e.br.y),this.vptCoords=e,e},cancelRequestedRender:function(){this.isRendering&&(t.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(e,r){var n=this.viewportTransform,i=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(e),t.util.setImageSmoothing(e,this.imageSmoothingEnabled),this.fire("before:render",{ctx:e}),this._renderBackground(e),e.save(),e.transform(n[0],n[1],n[2],n[3],n[4],n[5]),this._renderObjects(e,r),e.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),i&&(i.canvas=this,i.shouldCache(),i._transformDone=!0,i.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(e)),this._renderOverlay(e),this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),this.fire("after:render",{ctx:e})},drawClipPathOnCanvas:function(e){var t=this.viewportTransform,r=this.clipPath;e.save(),e.transform(t[0],t[1],t[2],t[3],t[4],t[5]),e.globalCompositeOperation="destination-in",r.transform(e),e.scale(1/r.zoomX,1/r.zoomY),e.drawImage(r._cacheCanvas,-r.cacheTranslationX,-r.cacheTranslationY),e.restore()},_renderObjects:function(e,t){var r,n;for(r=0,n=t.length;r<n;++r)t[r]&&t[r].render(e)},_renderBackgroundOrOverlay:function(e,t){var r=this[t+"Color"],n=this[t+"Image"],i=this.viewportTransform,o=this[t+"Vpt"];if(r||n){if(r){e.save(),e.beginPath(),e.moveTo(0,0),e.lineTo(this.width,0),e.lineTo(this.width,this.height),e.lineTo(0,this.height),e.closePath(),e.fillStyle=r.toLive?r.toLive(e,this):r,o&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e.transform(1,0,0,1,r.offsetX||0,r.offsetY||0);var a=r.gradientTransform||r.patternTransform;a&&e.transform(a[0],a[1],a[2],a[3],a[4],a[5]),e.fill(),e.restore()}n&&(e.save(),o&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),n.render(e),e.restore())}},_renderBackground:function(e){this._renderBackgroundOrOverlay(e,"background")},_renderOverlay:function(e){this._renderBackgroundOrOverlay(e,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},getCenterPoint:function(){return new t.Point(this.width/2,this.height/2)},centerObjectH:function(e){return this._centerObject(e,new t.Point(this.getCenterPoint().x,e.getCenterPoint().y))},centerObjectV:function(e){return this._centerObject(e,new t.Point(e.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(e){var t=this.getCenterPoint();return this._centerObject(e,t)},viewportCenterObject:function(e){var t=this.getVpCenter();return this._centerObject(e,t)},viewportCenterObjectH:function(e){var r=this.getVpCenter();return this._centerObject(e,new t.Point(r.x,e.getCenterPoint().y)),this},viewportCenterObjectV:function(e){var r=this.getVpCenter();return this._centerObject(e,new t.Point(e.getCenterPoint().x,r.y))},getVpCenter:function(){var e=this.getCenterPoint(),t=a(this.viewportTransform);return o(e,t)},_centerObject:function(e,t){return e.setPositionByOrigin(t,"center","center"),e.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(e){return this.toDatalessObject(e)},toObject:function(e){return this._toObjectMethod("toObject",e)},toDatalessObject:function(e){return this._toObjectMethod("toDatalessObject",e)},_toObjectMethod:function(r,n){var i=this.clipPath,o={version:t.version,objects:this._toObjects(r,n)};return i&&!i.excludeFromExport&&(o.clipPath=this._toObject(this.clipPath,r,n)),e(o,this.__serializeBgOverlay(r,n)),t.util.populateWithProperties(this,o,n),o},_toObjects:function(e,t){return this._objects.filter(function(e){return!e.excludeFromExport}).map(function(r){return this._toObject(r,e,t)},this)},_toObject:function(e,t,r){var n;this.includeDefaultValues||(n=e.includeDefaultValues,e.includeDefaultValues=!1);var i=e[t](r);return this.includeDefaultValues||(e.includeDefaultValues=n),i},__serializeBgOverlay:function(e,t){var r={},n=this.backgroundImage,i=this.overlayImage,o=this.backgroundColor,a=this.overlayColor;return o&&o.toObject?o.excludeFromExport||(r.background=o.toObject(t)):o&&(r.background=o),a&&a.toObject?a.excludeFromExport||(r.overlay=a.toObject(t)):a&&(r.overlay=a),n&&!n.excludeFromExport&&(r.backgroundImage=this._toObject(n,e,t)),i&&!i.excludeFromExport&&(r.overlayImage=this._toObject(i,e,t)),r},svgViewportTransformation:!0,toSVG:function(e,t){e||(e={}),e.reviver=t;var r=[];return this._setSVGPreamble(r,e),this._setSVGHeader(r,e),this.clipPath&&r.push('<g clip-path="url(#'+this.clipPath.clipPathId+')" >\n'),this._setSVGBgOverlayColor(r,"background"),this._setSVGBgOverlayImage(r,"backgroundImage",t),this._setSVGObjects(r,t),this.clipPath&&r.push("</g>\n"),this._setSVGBgOverlayColor(r,"overlay"),this._setSVGBgOverlayImage(r,"overlayImage",t),r.push("</svg>"),r.join("")},_setSVGPreamble:function(e,t){t.suppressPreamble||e.push('<?xml version="1.0" encoding="',t.encoding||"UTF-8",'" standalone="no" ?>\n','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ','"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')},_setSVGHeader:function(e,r){var n,o=r.width||this.width,a=r.height||this.height,s='viewBox="0 0 '+this.width+" "+this.height+'" ',l=t.Object.NUM_FRACTION_DIGITS;r.viewBox?s='viewBox="'+r.viewBox.x+" "+r.viewBox.y+" "+r.viewBox.width+" "+r.viewBox.height+'" ':this.svgViewportTransformation&&(n=this.viewportTransform,s='viewBox="'+i(-n[4]/n[0],l)+" "+i(-n[5]/n[3],l)+" "+i(this.width/n[0],l)+" "+i(this.height/n[3],l)+'" '),e.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',o,'" ','height="',a,'" ',s,'xml:space="preserve">\n',"<desc>Created with Fabric.js ",t.version,"</desc>\n","<defs>\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(r),"</defs>\n")},createSVGClipPathMarkup:function(e){var r=this.clipPath;return r?(r.clipPathId="CLIPPATH_"+t.Object.__uid++,'<clipPath id="'+r.clipPathId+'" >\n'+this.clipPath.toClipPathSVG(e.reviver)+"</clipPath>\n"):""},createSVGRefElementsMarkup:function(){var e=this;return["background","overlay"].map(function(r){var n=e[r+"Color"];if(n&&n.toLive){var i=e[r+"Vpt"],o=e.viewportTransform,a={width:e.width/(i?o[0]:1),height:e.height/(i?o[3]:1)};return n.toSVG(a,{additionalTransform:i?t.util.matrixToSVG(o):""})}}).join("")},createSVGFontFacesMarkup:function(){var e,r,n,i,o,a,s,l,c="",u={},d=t.fontPaths,h=[];for(this._objects.forEach(function e(t){h.push(t),t._objects&&t._objects.forEach(e)}),s=0,l=h.length;s<l;s++)if(r=(e=h[s]).fontFamily,-1!==e.type.indexOf("text")&&!u[r]&&d[r]&&(u[r]=!0,e.styles))for(o in n=e.styles)for(a in i=n[o])!u[r=i[a].fontFamily]&&d[r]&&(u[r]=!0);for(var f in u)c+=["\t\t@font-face {\n","\t\t\tfont-family: '",f,"';\n","\t\t\tsrc: url('",d[f],"');\n","\t\t}\n"].join("");return c&&(c=['\t<style type="text/css">',"<![CDATA[\n",c,"]]>","</style>\n"].join("")),c},_setSVGObjects:function(e,t){var r,n,i,o=this._objects;for(n=0,i=o.length;n<i;n++)!(r=o[n]).excludeFromExport&&this._setSVGObject(e,r,t)},_setSVGObject:function(e,t,r){e.push(t.toSVG(r))},_setSVGBgOverlayImage:function(e,t,r){this[t]&&!this[t].excludeFromExport&&this[t].toSVG&&e.push(this[t].toSVG(r))},_setSVGBgOverlayColor:function(e,r){var n=this[r+"Color"],i=this.viewportTransform,o=this.width,a=this.height;if(n)if(n.toLive){var s=n.repeat,l=t.util.invertTransform(i),c=this[r+"Vpt"]?t.util.matrixToSVG(l):"";e.push('<rect transform="'+c+" translate(",o/2,",",a/2,')"',' x="',n.offsetX-o/2,'" y="',n.offsetY-a/2,'" ','width="',"repeat-y"===s||"no-repeat"===s?n.source.width:o,'" height="',"repeat-x"===s||"no-repeat"===s?n.source.height:a,'" fill="url(#SVGID_'+n.id+')"',"></rect>\n")}else e.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',n,'"',"></rect>\n")},sendToBack:function(e){if(!e)return this;var t,r,i,o=this._activeObject;if(e===o&&"activeSelection"===e.type)for(t=(i=o._objects).length;t--;)r=i[t],n(this._objects,r),this._objects.unshift(r);else n(this._objects,e),this._objects.unshift(e);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(e){if(!e)return this;var t,r,i,o=this._activeObject;if(e===o&&"activeSelection"===e.type)for(i=o._objects,t=0;t<i.length;t++)r=i[t],n(this._objects,r),this._objects.push(r);else n(this._objects,e),this._objects.push(e);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(e,t){if(!e)return this;var r,i,o,a,s,l=this._activeObject,c=0;if(e===l&&"activeSelection"===e.type)for(s=l._objects,r=0;r<s.length;r++)i=s[r],(o=this._objects.indexOf(i))>0+c&&(a=o-1,n(this._objects,i),this._objects.splice(a,0,i)),c++;else 0!==(o=this._objects.indexOf(e))&&(a=this._findNewLowerIndex(e,o,t),n(this._objects,e),this._objects.splice(a,0,e));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(e,t,r){var n,i;if(r)for(n=t,i=t-1;i>=0;--i){if(e.intersectsWithObject(this._objects[i])||e.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(e)){n=i;break}}else n=t-1;return n},bringForward:function(e,t){if(!e)return this;var r,i,o,a,s,l=this._activeObject,c=0;if(e===l&&"activeSelection"===e.type)for(r=(s=l._objects).length;r--;)i=s[r],(o=this._objects.indexOf(i))<this._objects.length-1-c&&(a=o+1,n(this._objects,i),this._objects.splice(a,0,i)),c++;else(o=this._objects.indexOf(e))!==this._objects.length-1&&(a=this._findNewUpperIndex(e,o,t),n(this._objects,e),this._objects.splice(a,0,e));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(e,t,r){var n,i,o;if(r)for(n=t,i=t+1,o=this._objects.length;i<o;++i){if(e.intersectsWithObject(this._objects[i])||e.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(e)){n=i;break}}else n=t+1;return n},moveTo:function(e,t){return n(this._objects,e),this._objects.splice(t,0,e),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(t.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject(function(e){e.dispose&&e.dispose()}),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove("lower-canvas"),t.util.setStyle(this.lowerCanvasEl,this._originalCanvasStyle),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),t.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),e(t.StaticCanvas.prototype,t.Observable),e(t.StaticCanvas.prototype,t.Collection),e(t.StaticCanvas.prototype,t.DataURLExporter),e(t.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(e){var t=l();if(!t||!t.getContext)return null;var r=t.getContext("2d");return r&&"setLineDash"===e?typeof r.setLineDash<"u":null}}),t.StaticCanvas.prototype.toJSON=t.StaticCanvas.prototype.toObject,t.isLikelyNode&&(t.StaticCanvas.prototype.createPNGStream=function(){var e=s(this.lowerCanvasEl);return e&&e.createPNGStream()},t.StaticCanvas.prototype.createJPEGStream=function(e){var t=s(this.lowerCanvasEl);return t&&t.createJPEGStream(e)})}}(),t.BaseBrush=t.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(e){e.strokeStyle=this.color,e.lineWidth=this.width,e.lineCap=this.strokeLineCap,e.miterLimit=this.strokeMiterLimit,e.lineJoin=this.strokeLineJoin,e.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(e){var t=this.canvas.viewportTransform;e.save(),e.transform(t[0],t[1],t[2],t[3],t[4],t[5])},_setShadow:function(){if(this.shadow){var e=this.canvas,r=this.shadow,n=e.contextTop,i=e.getZoom();e&&e._isRetinaScaling()&&(i*=t.devicePixelRatio),n.shadowColor=r.color,n.shadowBlur=r.blur*i,n.shadowOffsetX=r.offsetX*i,n.shadowOffsetY=r.offsetY*i}},needsFullRender:function(){return new t.Color(this.color).getAlpha()<1||!!this.shadow},_resetShadow:function(){var e=this.canvas.contextTop;e.shadowColor="",e.shadowBlur=e.shadowOffsetX=e.shadowOffsetY=0},_isOutSideCanvas:function(e){return e.x<0||e.x>this.canvas.getWidth()||e.y<0||e.y>this.canvas.getHeight()}}),t.PencilBrush=t.util.createClass(t.BaseBrush,{decimate:.4,drawStraightLine:!1,straightLineKey:"shiftKey",initialize:function(e){this.canvas=e,this._points=[]},needsFullRender:function(){return this.callSuper("needsFullRender")||this._hasStraightLine},_drawSegment:function(e,t,r){var n=t.midPointFrom(r);return e.quadraticCurveTo(t.x,t.y,n.x,n.y),n},onMouseDown:function(e,t){this.canvas._isMainEvent(t.e)&&(this.drawStraightLine=t.e[this.straightLineKey],this._prepareForDrawing(e),this._captureDrawingPath(e),this._render())},onMouseMove:function(e,t){if(this.canvas._isMainEvent(t.e)&&(this.drawStraightLine=t.e[this.straightLineKey],(!0!==this.limitedToCanvasSize||!this._isOutSideCanvas(e))&&this._captureDrawingPath(e)&&this._points.length>1))if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var r=this._points,n=r.length,i=this.canvas.contextTop;this._saveAndTransform(i),this.oldEnd&&(i.beginPath(),i.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(i,r[n-2],r[n-1],!0),i.stroke(),i.restore()}},onMouseUp:function(e){return!this.canvas._isMainEvent(e.e)||(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(e){var r=new t.Point(e.x,e.y);this._reset(),this._addPoint(r),this.canvas.contextTop.moveTo(r.x,r.y)},_addPoint:function(e){return!(this._points.length>1&&e.eq(this._points[this._points.length-1])||(this.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(e),0))},_reset:function(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1},_captureDrawingPath:function(e){var r=new t.Point(e.x,e.y);return this._addPoint(r)},_render:function(e){var r,n,i=this._points[0],o=this._points[1];if(e=e||this.canvas.contextTop,this._saveAndTransform(e),e.beginPath(),2===this._points.length&&i.x===o.x&&i.y===o.y){var a=this.width/1e3;i=new t.Point(i.x,i.y),o=new t.Point(o.x,o.y),i.x-=a,o.x+=a}for(e.moveTo(i.x,i.y),r=1,n=this._points.length;r<n;r++)this._drawSegment(e,i,o),i=this._points[r],o=this._points[r+1];e.lineTo(i.x,i.y),e.stroke(),e.restore()},convertPointsToSVGPath:function(e){var r=this.width/1e3;return t.util.getSmoothPathFromPoints(e,r)},_isEmptySVGPath:function(e){return"M 0 0 Q 0 0 0 0 L 0 0"===t.util.joinPath(e)},createPath:function(e){var r=new t.Path(e,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,r.shadow=new t.Shadow(this.shadow)),r},decimatePoints:function(e,t){if(e.length<=2)return e;var r,n=this.canvas.getZoom(),i=Math.pow(t/n,2),o=e.length-1,a=e[0],s=[a];for(r=1;r<o-1;r++)Math.pow(a.x-e[r].x,2)+Math.pow(a.y-e[r].y,2)>=i&&(a=e[r],s.push(a));return s.push(e[o]),s},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var e=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(e))this.canvas.requestRenderAll();else{var t=this.createPath(e);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:t}),this.canvas.add(t),this.canvas.requestRenderAll(),t.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:t})}}}),t.CircleBrush=t.util.createClass(t.BaseBrush,{width:10,initialize:function(e){this.canvas=e,this.points=[]},drawDot:function(e){var t=this.addPoint(e),r=this.canvas.contextTop;this._saveAndTransform(r),this.dot(r,t),r.restore()},dot:function(e,t){e.fillStyle=t.fill,e.beginPath(),e.arc(t.x,t.y,t.radius,0,2*Math.PI,!1),e.closePath(),e.fill()},onMouseDown:function(e){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(e)},_render:function(){var e,t,r=this.canvas.contextTop,n=this.points;for(this._saveAndTransform(r),e=0,t=n.length;e<t;e++)this.dot(r,n[e]);r.restore()},onMouseMove:function(e){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(e)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(e),this._render()):this.drawDot(e))},onMouseUp:function(){var e,r,n=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;var i=[];for(e=0,r=this.points.length;e<r;e++){var o=this.points[e],a=new t.Circle({radius:o.radius,left:o.x,top:o.y,originX:"center",originY:"center",fill:o.fill});this.shadow&&(a.shadow=new t.Shadow(this.shadow)),i.push(a)}var s=new t.Group(i);s.canvas=this.canvas,this.canvas.fire("before:path:created",{path:s}),this.canvas.add(s),this.canvas.fire("path:created",{path:s}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=n,this.canvas.requestRenderAll()},addPoint:function(e){var r=new t.Point(e.x,e.y),n=t.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,i=new t.Color(this.color).setAlpha(t.util.getRandomInt(0,100)/100).toRgba();return r.radius=n,r.fill=i,this.points.push(r),r}}),t.SprayBrush=t.util.createClass(t.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(e){this.canvas=e,this.sprayChunks=[]},onMouseDown:function(e){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(e),this.render(this.sprayChunkPoints)},onMouseMove:function(e){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(e)||(this.addSprayChunk(e),this.render(this.sprayChunkPoints))},onMouseUp:function(){var e=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var r=[],n=0,i=this.sprayChunks.length;n<i;n++)for(var o=this.sprayChunks[n],a=0,s=o.length;a<s;a++){var l=new t.Rect({width:o[a].width,height:o[a].width,left:o[a].x+1,top:o[a].y+1,originX:"center",originY:"center",fill:this.color});r.push(l)}this.optimizeOverlapping&&(r=this._getOptimizedRects(r));var c=new t.Group(r);this.shadow&&c.set("shadow",new t.Shadow(this.shadow)),this.canvas.fire("before:path:created",{path:c}),this.canvas.add(c),this.canvas.fire("path:created",{path:c}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=e,this.canvas.requestRenderAll()},_getOptimizedRects:function(e){var t,r,n,i={};for(r=0,n=e.length;r<n;r++)i[t=e[r].left+""+e[r].top]||(i[t]=e[r]);var o=[];for(t in i)o.push(i[t]);return o},render:function(e){var t,r,n=this.canvas.contextTop;for(n.fillStyle=this.color,this._saveAndTransform(n),t=0,r=e.length;t<r;t++){var i=e[t];typeof i.opacity<"u"&&(n.globalAlpha=i.opacity),n.fillRect(i.x,i.y,i.width,i.width)}n.restore()},_render:function(){var e,t,r=this.canvas.contextTop;for(r.fillStyle=this.color,this._saveAndTransform(r),e=0,t=this.sprayChunks.length;e<t;e++)this.render(this.sprayChunks[e]);r.restore()},addSprayChunk:function(e){this.sprayChunkPoints=[];var r,n,i,o,a=this.width/2;for(o=0;o<this.density;o++){r=t.util.getRandomInt(e.x-a,e.x+a),n=t.util.getRandomInt(e.y-a,e.y+a),i=this.dotWidthVariance?t.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var s=new t.Point(r,n);s.width=i,this.randomOpacity&&(s.opacity=t.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(s)}this.sprayChunks.push(this.sprayChunkPoints)}}),t.PatternBrush=t.util.createClass(t.PencilBrush,{getPatternSrc:function(){var e=t.util.createCanvasElement(),r=e.getContext("2d");return e.width=e.height=25,r.fillStyle=this.color,r.beginPath(),r.arc(10,10,10,0,2*Math.PI,!1),r.closePath(),r.fill(),e},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(e){return e.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(e){this.callSuper("_setBrushStyles",e),e.strokeStyle=this.getPattern(e)},createPath:function(e){var r=this.callSuper("createPath",e),n=r._getLeftTopCoords().scalarAdd(r.strokeWidth/2);return r.stroke=new t.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-n.x,offsetY:-n.y}),r}}),function(){var e=t.util.getPointer,r=t.util.degreesToRadians,n=t.util.isTouchEvent;for(var i in t.Canvas=t.util.createClass(t.StaticCanvas,{initialize:function(e,t){t||(t={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(e,t),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],enablePointerEvents:!1,_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=t.PencilBrush&&new t.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var e,t,r,n=this.getActiveObjects();if(n.length>0&&!this.preserveObjectStacking){t=[],r=[];for(var i=0,o=this._objects.length;i<o;i++)e=this._objects[i],-1===n.indexOf(e)?t.push(e):r.push(e);n.length>1&&(this._activeObject._objects=r),t.push.apply(t,r)}else t=this._objects;return t},renderAll:function(){this.contextTopDirty&&!this._groupSelector&&!this.isDrawingMode&&(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&(this.renderTopLayer(this.contextTop),this.hasLostContext=!1);var e=this.contextContainer;return this.renderCanvas(e,this._chooseObjectsToRender()),this},renderTopLayer:function(e){e.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(e),this.contextTopDirty=!0),e.restore()},renderTop:function(){var e=this.contextTop;return this.clearContext(e),this.renderTopLayer(e),this.fire("after:render"),this},_normalizePointer:function(e,r){var n=e.calcTransformMatrix(),i=t.util.invertTransform(n),o=this.restorePointerVpt(r);return t.util.transformPoint(o,i)},isTargetTransparent:function(e,r,n){if(e.shouldCache()&&e._cacheCanvas&&e!==this._activeObject){var i=this._normalizePointer(e,{x:r,y:n}),o=Math.max(e.cacheTranslationX+i.x*e.zoomX,0),a=Math.max(e.cacheTranslationY+i.y*e.zoomY,0);return t.util.isTransparent(e._cacheContext,Math.round(o),Math.round(a),this.targetFindTolerance)}var s=this.contextCache,l=e.selectionBackgroundColor,c=this.viewportTransform;return e.selectionBackgroundColor="",this.clearContext(s),s.save(),s.transform(c[0],c[1],c[2],c[3],c[4],c[5]),e.render(s),s.restore(),e.selectionBackgroundColor=l,t.util.isTransparent(s,r,n,this.targetFindTolerance)},_isSelectionKeyPressed:function(e){var t=!1;return t=Array.isArray(this.selectionKey)?!!this.selectionKey.find(function(t){return!0===e[t]}):e[this.selectionKey],t},_shouldClearSelection:function(e,t){var r=this.getActiveObjects(),n=this._activeObject;return!t||t&&n&&r.length>1&&-1===r.indexOf(t)&&n!==t&&!this._isSelectionKeyPressed(e)||t&&!t.evented||t&&!t.selectable&&n&&n!==t},_shouldCenterTransform:function(e,t,r){var n;if(e)return"scale"===t||"scaleX"===t||"scaleY"===t||"resizing"===t?n=this.centeredScaling||e.centeredScaling:"rotate"===t&&(n=this.centeredRotation||e.centeredRotation),n?!r:r},_getOriginFromCorner:function(e,t){var r={x:e.originX,y:e.originY};return"ml"===t||"tl"===t||"bl"===t?r.x="right":("mr"===t||"tr"===t||"br"===t)&&(r.x="left"),"tl"===t||"mt"===t||"tr"===t?r.y="bottom":("bl"===t||"mb"===t||"br"===t)&&(r.y="top"),r},_getActionFromCorner:function(e,t,r,n){if(!t||!e)return"drag";var i=n.controls[t];return i.getActionName(r,i,n)},_setupCurrentTransform:function(e,n,i){if(n){var o=this.getPointer(e),a=n.__corner,s=n.controls[a],l=i&&a?s.getActionHandler(e,n,s):t.controlsUtils.dragHandler,c=this._getActionFromCorner(i,a,e,n),u=this._getOriginFromCorner(n,a),d=e[this.centeredKey],h={target:n,action:c,actionHandler:l,corner:a,scaleX:n.scaleX,scaleY:n.scaleY,skewX:n.skewX,skewY:n.skewY,offsetX:o.x-n.left,offsetY:o.y-n.top,originX:u.x,originY:u.y,ex:o.x,ey:o.y,lastX:o.x,lastY:o.y,theta:r(n.angle),width:n.width*n.scaleX,shiftKey:e.shiftKey,altKey:d,original:t.util.saveObjectTransform(n)};this._shouldCenterTransform(n,c,d)&&(h.originX="center",h.originY="center"),h.original.originX=u.x,h.original.originY=u.y,this._currentTransform=h,this._beforeTransform(e)}},setCursor:function(e){this.upperCanvasEl.style.cursor=e},_drawSelection:function(e){var r=this._groupSelector,n=new t.Point(r.ex,r.ey),i=t.util.transformPoint(n,this.viewportTransform),o=new t.Point(r.ex+r.left,r.ey+r.top),a=t.util.transformPoint(o,this.viewportTransform),s=Math.min(i.x,a.x),l=Math.min(i.y,a.y),c=Math.max(i.x,a.x),u=Math.max(i.y,a.y),d=this.selectionLineWidth/2;this.selectionColor&&(e.fillStyle=this.selectionColor,e.fillRect(s,l,c-s,u-l)),this.selectionLineWidth&&this.selectionBorderColor&&(e.lineWidth=this.selectionLineWidth,e.strokeStyle=this.selectionBorderColor,s+=d,l+=d,c-=d,u-=d,t.Object.prototype._setLineDash.call(this,e,this.selectionDashArray),e.strokeRect(s,l,c-s,u-l))},findTarget:function(e,t){if(!this.skipTargetFind){var r,i,o=this.getPointer(e,!0),a=this._activeObject,s=this.getActiveObjects(),l=n(e),c=s.length>1&&!t||1===s.length;if(this.targets=[],c&&a._findTargetCorner(o,l)||s.length>1&&!t&&a===this._searchPossibleTargets([a],o))return a;if(1===s.length&&a===this._searchPossibleTargets([a],o)){if(!this.preserveObjectStacking)return a;r=a,i=this.targets,this.targets=[]}var u=this._searchPossibleTargets(this._objects,o);return e[this.altSelectionKey]&&u&&r&&u!==r&&(u=r,this.targets=i),u}},_checkTarget:function(e,t,r){if(t&&t.visible&&t.evented&&t.containsPoint(e)){if(!this.perPixelTargetFind&&!t.perPixelTargetFind||t.isEditing)return!0;if(!this.isTargetTransparent(t,r.x,r.y))return!0}},_searchPossibleTargets:function(e,r){for(var n,i,o=e.length;o--;){var a=e[o],s=a.group?this._normalizePointer(a.group,r):r;if(this._checkTarget(s,a,r)){(n=e[o]).subTargetCheck&&n instanceof t.Group&&((i=this._searchPossibleTargets(n._objects,r))&&this.targets.push(i));break}}return n},restorePointerVpt:function(e){return t.util.transformPoint(e,t.util.invertTransform(this.viewportTransform))},getPointer:function(t,r){if(this._absolutePointer&&!r)return this._absolutePointer;if(this._pointer&&r)return this._pointer;var n,i=e(t),o=this.upperCanvasEl,a=o.getBoundingClientRect(),s=a.width||0,l=a.height||0;(!s||!l)&&("top"in a&&"bottom"in a&&(l=Math.abs(a.top-a.bottom)),"right"in a&&"left"in a&&(s=Math.abs(a.right-a.left))),this.calcOffset(),i.x=i.x-this._offset.left,i.y=i.y-this._offset.top,r||(i=this.restorePointerVpt(i));var c=this.getRetinaScaling();return 1!==c&&(i.x/=c,i.y/=c),n=0===s||0===l?{width:1,height:1}:{width:o.width/s,height:o.height/l},{x:i.x*n.width,y:i.y*n.height}},_createUpperCanvas:function(){var e=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),r=this.lowerCanvasEl,n=this.upperCanvasEl;n?n.className="":(n=this._createCanvasElement(),this.upperCanvasEl=n),t.util.addClass(n,"upper-canvas "+e),this.wrapperEl.appendChild(n),this._copyCanvasStyle(r,n),this._applyCanvasStyle(n),this.contextTop=n.getContext("2d")},getTopContext:function(){return this.contextTop},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=t.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),t.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),t.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(e){var r=this.width||e.width,n=this.height||e.height;t.util.setStyle(e,{position:"absolute",width:r+"px",height:n+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),e.width=r,e.height=n,t.util.makeElementUnselectable(e)},_copyCanvasStyle:function(e,t){t.style.cssText=e.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var e=this._activeObject;return e?"activeSelection"===e.type&&e._objects?e._objects.slice(0):[e]:[]},_onObjectRemoved:function(e){e===this._activeObject&&(this.fire("before:selection:cleared",{target:e}),this._discardActiveObject(),this.fire("selection:cleared",{target:e}),e.fire("deselected")),e===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",e)},_fireSelectionEvents:function(e,t){var r=!1,n=this.getActiveObjects(),i=[],o=[];e.forEach(function(e){-1===n.indexOf(e)&&(r=!0,e.fire("deselected",{e:t,target:e}),o.push(e))}),n.forEach(function(n){-1===e.indexOf(n)&&(r=!0,n.fire("selected",{e:t,target:n}),i.push(n))}),e.length>0&&n.length>0?r&&this.fire("selection:updated",{e:t,selected:i,deselected:o}):n.length>0?this.fire("selection:created",{e:t,selected:i}):e.length>0&&this.fire("selection:cleared",{e:t,deselected:o})},setActiveObject:function(e,t){var r=this.getActiveObjects();return this._setActiveObject(e,t),this._fireSelectionEvents(r,t),this},_setActiveObject:function(e,t){return!(this._activeObject===e||!this._discardActiveObject(t,e)||e.onSelect({e:t}))&&(this._activeObject=e,!0)},_discardActiveObject:function(e,t){var r=this._activeObject;if(r){if(r.onDeselect({e:e,object:t}))return!1;this._activeObject=null}return!0},discardActiveObject:function(e){var t=this.getActiveObjects(),r=this.getActiveObject();return t.length&&this.fire("before:selection:cleared",{target:r,e:e}),this._discardActiveObject(e),this._fireSelectionEvents(t,e),this},dispose:function(){var e=this.wrapperEl;return this.removeListeners(),e.removeChild(this.upperCanvasEl),e.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(e){t.util.cleanUpJsdomNode(this[e]),this[e]=void 0}.bind(this)),e.parentNode&&e.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,t.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(e){var t=this._activeObject;t&&t._renderControls(e)},_toObject:function(e,t,r){var n=this._realizeGroupTransformOnObject(e),i=this.callSuper("_toObject",e,t,r);return this._unwindGroupTransformOnObject(e,n),i},_realizeGroupTransformOnObject:function(e){if(e.group&&"activeSelection"===e.group.type&&this._activeObject===e.group){var r={};return["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach(function(t){r[t]=e[t]}),t.util.addTransformToObject(e,this._activeObject.calcOwnMatrix()),r}return null},_unwindGroupTransformOnObject:function(e,t){t&&e.set(t)},_setSVGObject:function(e,t,r){var n=this._realizeGroupTransformOnObject(t);this.callSuper("_setSVGObject",e,t,r),this._unwindGroupTransformOnObject(t,n)},setViewportTransform:function(e){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),t.StaticCanvas.prototype.setViewportTransform.call(this,e)}}),t.StaticCanvas)"prototype"!==i&&(t.Canvas[i]=t.StaticCanvas[i])}(),function(){var e=t.util.addListener,r=t.util.removeListener,n={passive:!1};function i(e,t){return e.button&&e.button===t-1}t.util.object.extend(t.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(e,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(e,r){var i=this.upperCanvasEl,o=this._getEventPrefix();e(t.window,"resize",this._onResize),e(i,o+"down",this._onMouseDown),e(i,o+"move",this._onMouseMove,n),e(i,o+"out",this._onMouseOut),e(i,o+"enter",this._onMouseEnter),e(i,"wheel",this._onMouseWheel),e(i,"contextmenu",this._onContextMenu),e(i,"dblclick",this._onDoubleClick),e(i,"dragover",this._onDragOver),e(i,"dragenter",this._onDragEnter),e(i,"dragleave",this._onDragLeave),e(i,"drop",this._onDrop),this.enablePointerEvents||e(i,"touchstart",this._onTouchStart,n),typeof eventjs<"u"&&r in eventjs&&(eventjs[r](i,"gesture",this._onGesture),eventjs[r](i,"drag",this._onDrag),eventjs[r](i,"orientation",this._onOrientationChange),eventjs[r](i,"shake",this._onShake),eventjs[r](i,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(r,"remove");var e=this._getEventPrefix();r(t.document,e+"up",this._onMouseUp),r(t.document,"touchend",this._onTouchEnd,n),r(t.document,e+"move",this._onMouseMove,n),r(t.document,"touchmove",this._onMouseMove,n)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._onDrop.bind(this),this.eventsBound=!0)},_onGesture:function(e,t){this.__onTransformGesture&&this.__onTransformGesture(e,t)},_onDrag:function(e,t){this.__onDrag&&this.__onDrag(e,t)},_onMouseWheel:function(e){this.__onMouseWheel(e)},_onMouseOut:function(e){var t=this._hoveredTarget;this.fire("mouse:out",{target:t,e:e}),this._hoveredTarget=null,t&&t.fire("mouseout",{e:e});var r=this;this._hoveredTargets.forEach(function(n){r.fire("mouse:out",{target:t,e:e}),n&&t.fire("mouseout",{e:e})}),this._hoveredTargets=[]},_onMouseEnter:function(e){!this._currentTransform&&!this.findTarget(e)&&(this.fire("mouse:over",{target:null,e:e}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(e,t){this.__onOrientationChange&&this.__onOrientationChange(e,t)},_onShake:function(e,t){this.__onShake&&this.__onShake(e,t)},_onLongPress:function(e,t){this.__onLongPress&&this.__onLongPress(e,t)},_onDragOver:function(e){e.preventDefault();var t=this._simpleEventHandler("dragover",e);this._fireEnterLeaveEvents(t,e)},_onDrop:function(e){return this._simpleEventHandler("drop:before",e),this._simpleEventHandler("drop",e)},_onContextMenu:function(e){return this.stopContextMenu&&(e.stopPropagation(),e.preventDefault()),!1},_onDoubleClick:function(e){this._cacheTransformEventData(e),this._handleEvent(e,"dblclick"),this._resetTransformEventData(e)},getPointerId:function(e){var t=e.changedTouches;return t?t[0]&&t[0].identifier:this.enablePointerEvents?e.pointerId:-1},_isMainEvent:function(e){return!0===e.isPrimary||!1!==e.isPrimary&&("touchend"===e.type&&0===e.touches.length||(!e.changedTouches||e.changedTouches[0].identifier===this.mainTouchId))},_onTouchStart:function(i){i.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(i)),this.__onMouseDown(i),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();e(t.document,"touchend",this._onTouchEnd,n),e(t.document,"touchmove",this._onMouseMove,n),r(o,a+"down",this._onMouseDown)},_onMouseDown:function(i){this.__onMouseDown(i),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();r(o,a+"move",this._onMouseMove,n),e(t.document,a+"up",this._onMouseUp),e(t.document,a+"move",this._onMouseMove,n)},_onTouchEnd:function(i){if(!(i.touches.length>0)){this.__onMouseUp(i),this._resetTransformEventData(),this.mainTouchId=null;var o=this._getEventPrefix();r(t.document,"touchend",this._onTouchEnd,n),r(t.document,"touchmove",this._onMouseMove,n);var a=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(function(){e(a.upperCanvasEl,o+"down",a._onMouseDown),a._willAddMouseDown=0},400)}},_onMouseUp:function(i){this.__onMouseUp(i),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();this._isMainEvent(i)&&(r(t.document,a+"up",this._onMouseUp),r(t.document,a+"move",this._onMouseMove,n),e(o,a+"move",this._onMouseMove,n))},_onMouseMove:function(e){!this.allowTouchScrolling&&e.preventDefault&&e.preventDefault(),this.__onMouseMove(e)},_onResize:function(){this.calcOffset()},_shouldRender:function(e){var t=this._activeObject;return!!(!!t!=!!e||t&&e&&t!==e)||(t&&t.isEditing,!1)},__onMouseUp:function(e){var r,n=this._currentTransform,o=this._groupSelector,a=!1,s=!o||0===o.left&&0===o.top;if(this._cacheTransformEventData(e),r=this._target,this._handleEvent(e,"up:before"),i(e,3))this.fireRightClick&&this._handleEvent(e,"up",3,s);else{if(i(e,2))return this.fireMiddleClick&&this._handleEvent(e,"up",2,s),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(e);else if(this._isMainEvent(e)){if(n&&(this._finalizeCurrentTransform(e),a=n.actionPerformed),!s){var l=r===this._activeObject;this._maybeGroupObjects(e),a||(a=this._shouldRender(r)||!l&&r===this._activeObject)}var c,u;if(r){if(c=r._findTargetCorner(this.getPointer(e,!0),t.util.isTouchEvent(e)),r.selectable&&r!==this._activeObject&&"up"===r.activeOn)this.setActiveObject(r,e),a=!0;else{var d=r.controls[c],h=d&&d.getMouseUpHandler(e,r,d);h&&h(e,n,(u=this.getPointer(e)).x,u.y)}r.isMoving=!1}if(n&&(n.target!==r||n.corner!==c)){var f=n.target&&n.target.controls[n.corner],p=f&&f.getMouseUpHandler(e,r,d);u=u||this.getPointer(e),p&&p(e,n,u.x,u.y)}this._setCursorFromEvent(e,r),this._handleEvent(e,"up",1,s),this._groupSelector=null,this._currentTransform=null,r&&(r.__corner=0),a?this.requestRenderAll():s||this.renderTop()}}},_simpleEventHandler:function(e,t){var r=this.findTarget(t),n=this.targets,i={e:t,target:r,subTargets:n};if(this.fire(e,i),r&&r.fire(e,i),!n)return r;for(var o=0;o<n.length;o++)n[o].fire(e,i);return r},_handleEvent:function(e,t,r,n){var i=this._target,o=this.targets||[],a={e:e,target:i,subTargets:o,button:r||1,isClick:n||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};"up"===t&&(a.currentTarget=this.findTarget(e),a.currentSubTargets=this.targets),this.fire("mouse:"+t,a),i&&i.fire("mouse"+t,a);for(var s=0;s<o.length;s++)o[s].fire("mouse"+t,a)},_finalizeCurrentTransform:function(e){var t=this._currentTransform,r=t.target,n={e:e,target:r,transform:t,action:t.action};r._scaling&&(r._scaling=!1),r.setCoords(),(t.actionPerformed||this.stateful&&r.hasStateChanged())&&this._fire("modified",n)},_onMouseDownInDrawingMode:function(e){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(e).requestRenderAll();var t=this.getPointer(e);this.freeDrawingBrush.onMouseDown(t,{e:e,pointer:t}),this._handleEvent(e,"down")},_onMouseMoveInDrawingMode:function(e){if(this._isCurrentlyDrawing){var t=this.getPointer(e);this.freeDrawingBrush.onMouseMove(t,{e:e,pointer:t})}this.setCursor(this.freeDrawingCursor),this._handleEvent(e,"move")},_onMouseUpInDrawingMode:function(e){var t=this.getPointer(e);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:e,pointer:t}),this._handleEvent(e,"up")},__onMouseDown:function(e){this._cacheTransformEventData(e),this._handleEvent(e,"down:before");var r=this._target;if(i(e,3))this.fireRightClick&&this._handleEvent(e,"down",3);else if(i(e,2))this.fireMiddleClick&&this._handleEvent(e,"down",2);else if(this.isDrawingMode)this._onMouseDownInDrawingMode(e);else if(this._isMainEvent(e)&&!this._currentTransform){var n=this._pointer;this._previousPointer=n;var o=this._shouldRender(r),a=this._shouldGroup(e,r);if(this._shouldClearSelection(e,r)?this.discardActiveObject(e):a&&(this._handleGrouping(e,r),r=this._activeObject),this.selection&&(!r||!r.selectable&&!r.isEditing&&r!==this._activeObject)&&(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),r){var s=r===this._activeObject;r.selectable&&"down"===r.activeOn&&this.setActiveObject(r,e);var l=r._findTargetCorner(this.getPointer(e,!0),t.util.isTouchEvent(e));if(r.__corner=l,r===this._activeObject&&(l||!a)){this._setupCurrentTransform(e,r,s);var c=r.controls[l],u=(n=this.getPointer(e),c&&c.getMouseDownHandler(e,r,c));u&&u(e,this._currentTransform,n.x,n.y)}}this._handleEvent(e,"down"),(o||a)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(e){this._resetTransformEventData(),this._pointer=this.getPointer(e,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(e)||null},_beforeTransform:function(e){var t=this._currentTransform;this.stateful&&t.target.saveState(),this.fire("before:transform",{e:e,transform:t})},__onMouseMove:function(e){var t,r;if(this._handleEvent(e,"move:before"),this._cacheTransformEventData(e),this.isDrawingMode)this._onMouseMoveInDrawingMode(e);else if(this._isMainEvent(e)){var n=this._groupSelector;n?(r=this._absolutePointer,n.left=r.x-n.ex,n.top=r.y-n.ey,this.renderTop()):this._currentTransform?this._transformObject(e):(t=this.findTarget(e)||null,this._setCursorFromEvent(e,t),this._fireOverOutEvents(t,e)),this._handleEvent(e,"move"),this._resetTransformEventData()}},_fireOverOutEvents:function(e,t){var r=this._hoveredTarget,n=this._hoveredTargets,i=this.targets,o=Math.max(n.length,i.length);this.fireSyntheticInOutEvents(e,t,{oldTarget:r,evtOut:"mouseout",canvasEvtOut:"mouse:out",evtIn:"mouseover",canvasEvtIn:"mouse:over"});for(var a=0;a<o;a++)this.fireSyntheticInOutEvents(i[a],t,{oldTarget:n[a],evtOut:"mouseout",evtIn:"mouseover"});this._hoveredTarget=e,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(e,t){var r=this._draggedoverTarget,n=this._hoveredTargets,i=this.targets,o=Math.max(n.length,i.length);this.fireSyntheticInOutEvents(e,t,{oldTarget:r,evtOut:"dragleave",evtIn:"dragenter"});for(var a=0;a<o;a++)this.fireSyntheticInOutEvents(i[a],t,{oldTarget:n[a],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=e},fireSyntheticInOutEvents:function(e,t,r){var n,i,o,a=r.oldTarget,s=a!==e,l=r.canvasEvtIn,c=r.canvasEvtOut;s&&(n={e:t,target:e,previousTarget:a},i={e:t,target:a,nextTarget:e}),o=e&&s,a&&s&&(c&&this.fire(c,i),a.fire(r.evtOut,i)),o&&(l&&this.fire(l,n),e.fire(r.evtIn,n))},__onMouseWheel:function(e){this._cacheTransformEventData(e),this._handleEvent(e,"wheel"),this._resetTransformEventData()},_transformObject:function(e){var t=this.getPointer(e),r=this._currentTransform;r.reset=!1,r.shiftKey=e.shiftKey,r.altKey=e[this.centeredKey],this._performTransformAction(e,r,t),r.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(e,t,r){var n=r.x,i=r.y,o=t.action,a=!1,s=t.actionHandler;s&&(a=s(e,t,n,i)),"drag"===o&&a&&(t.target.isMoving=!0,this.setCursor(t.target.moveCursor||this.moveCursor)),t.actionPerformed=t.actionPerformed||a},_fire:t.controlsUtils.fireEvent,_setCursorFromEvent:function(e,t){if(!t)return this.setCursor(this.defaultCursor),!1;var r=t.hoverCursor||this.hoverCursor,n=this._activeObject&&"activeSelection"===this._activeObject.type?this._activeObject:null,i=(!n||!n.contains(t))&&t._findTargetCorner(this.getPointer(e,!0));i?this.setCursor(this.getCornerCursor(i,t,e)):(t.subTargetCheck&&this.targets.concat().reverse().map(function(e){r=e.hoverCursor||r}),this.setCursor(r))},getCornerCursor:function(e,t,r){var n=t.controls[e];return n.cursorStyleHandler(r,n,t)}})}(),function(){var e=Math.min,r=Math.max;t.util.object.extend(t.Canvas.prototype,{_shouldGroup:function(e,t){var r=this._activeObject;return r&&this._isSelectionKeyPressed(e)&&t&&t.selectable&&this.selection&&(r!==t||"activeSelection"===r.type)&&!t.onSelect({e:e})},_handleGrouping:function(e,t){var r=this._activeObject;r.__corner||t===r&&(!(t=this.findTarget(e,!0))||!t.selectable)||(r&&"activeSelection"===r.type?this._updateActiveSelection(t,e):this._createActiveSelection(t,e))},_updateActiveSelection:function(e,t){var r=this._activeObject,n=r._objects.slice(0);r.contains(e)?(r.removeWithUpdate(e),this._hoveredTarget=e,this._hoveredTargets=this.targets.concat(),1===r.size()&&this._setActiveObject(r.item(0),t)):(r.addWithUpdate(e),this._hoveredTarget=r,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(n,t)},_createActiveSelection:function(e,t){var r=this.getActiveObjects(),n=this._createGroup(e);this._hoveredTarget=n,this._setActiveObject(n,t),this._fireSelectionEvents(r,t)},_createGroup:function(e){var r=this._objects,n=r.indexOf(this._activeObject)<r.indexOf(e)?[this._activeObject,e]:[e,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new t.ActiveSelection(n,{canvas:this})},_groupSelectedObjects:function(e){var r,n=this._collectObjects(e);1===n.length?this.setActiveObject(n[0],e):n.length>1&&(r=new t.ActiveSelection(n.reverse(),{canvas:this}),this.setActiveObject(r,e))},_collectObjects:function(n){for(var i,o=[],a=this._groupSelector.ex,s=this._groupSelector.ey,l=a+this._groupSelector.left,c=s+this._groupSelector.top,u=new t.Point(e(a,l),e(s,c)),d=new t.Point(r(a,l),r(s,c)),h=!this.selectionFullyContained,f=a===l&&s===c,p=this._objects.length;p--&&!((i=this._objects[p])&&i.selectable&&i.visible&&(h&&i.intersectsWithRect(u,d,!0)||i.isContainedWithinRect(u,d,!0)||h&&i.containsPoint(u,null,!0)||h&&i.containsPoint(d,null,!0))&&(o.push(i),f)););return o.length>1&&(o=o.filter(function(e){return!e.onSelect({e:n})})),o},_maybeGroupObjects:function(e){this.selection&&this._groupSelector&&this._groupSelectedObjects(e),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),t.util.object.extend(t.StaticCanvas.prototype,{toDataURL:function(e){e||(e={});var r=e.format||"png",n=e.quality||1,i=(e.multiplier||1)*(e.enableRetinaScaling?this.getRetinaScaling():1),o=this.toCanvasElement(i,e);return t.util.toDataURL(o,r,n)},toCanvasElement:function(e,r){e=e||1;var n=((r=r||{}).width||this.width)*e,i=(r.height||this.height)*e,o=this.getZoom(),a=this.width,s=this.height,l=o*e,c=this.viewportTransform,u=(c[4]-(r.left||0))*e,d=(c[5]-(r.top||0))*e,h=this.interactive,f=[l,0,0,l,u,d],p=this.enableRetinaScaling,g=t.util.createCanvasElement(),m=this.contextTop;return g.width=n,g.height=i,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=f,this.width=n,this.height=i,this.calcViewportBoundaries(),this.renderCanvas(g.getContext("2d"),this._objects),this.viewportTransform=c,this.width=a,this.height=s,this.calcViewportBoundaries(),this.interactive=h,this.enableRetinaScaling=p,this.contextTop=m,g}}),t.util.object.extend(t.StaticCanvas.prototype,{loadFromJSON:function(e,r,n){if(e){var i="string"==typeof e?JSON.parse(e):t.util.object.clone(e),o=this,a=i.clipPath,s=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete i.clipPath,this._enlivenObjects(i.objects,function(e){o.clear(),o._setBgOverlay(i,function(){a?o._enlivenObjects([a],function(t){o.clipPath=t[0],o.__setupCanvas.call(o,i,e,s,r)}):o.__setupCanvas.call(o,i,e,s,r)})},n),this}},__setupCanvas:function(e,t,r,n){var i=this;t.forEach(function(e,t){i.insertAt(e,t)}),this.renderOnAddRemove=r,delete e.objects,delete e.backgroundImage,delete e.overlayImage,delete e.background,delete e.overlay,this._setOptions(e),this.renderAll(),n&&n()},_setBgOverlay:function(e,t){var r={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(e.backgroundImage||e.overlayImage||e.background||e.overlay){var n=function(){r.backgroundImage&&r.overlayImage&&r.backgroundColor&&r.overlayColor&&t&&t()};this.__setBgOverlay("backgroundImage",e.backgroundImage,r,n),this.__setBgOverlay("overlayImage",e.overlayImage,r,n),this.__setBgOverlay("backgroundColor",e.background,r,n),this.__setBgOverlay("overlayColor",e.overlay,r,n)}else t&&t()},__setBgOverlay:function(e,r,n,i){var o=this;if(!r)return n[e]=!0,void(i&&i());"backgroundImage"===e||"overlayImage"===e?t.util.enlivenObjects([r],function(t){o[e]=t[0],n[e]=!0,i&&i()}):this["set"+t.util.string.capitalize(e,!0)](r,function(){n[e]=!0,i&&i()})},_enlivenObjects:function(e,r,n){e&&0!==e.length?t.util.enlivenObjects(e,function(e){r&&r(e)},null,n):r&&r([])},_toDataURL:function(e,t){this.clone(function(r){t(r.toDataURL(e))})},_toDataURLWithMultiplier:function(e,t,r){this.clone(function(n){r(n.toDataURLWithMultiplier(e,t))})},clone:function(e,t){var r=JSON.stringify(this.toJSON(t));this.cloneWithoutData(function(t){t.loadFromJSON(r,function(){e&&e(t)})})},cloneWithoutData:function(e){var r=t.util.createCanvasElement();r.width=this.width,r.height=this.height;var n=new t.Canvas(r);this.backgroundImage?(n.setBackgroundImage(this.backgroundImage.src,function(){n.renderAll(),e&&e(n)}),n.backgroundImageOpacity=this.backgroundImageOpacity,n.backgroundImageStretch=this.backgroundImageStretch):e&&e(n)}}),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.util.object.clone,i=t.util.toFixed,o=t.util.string.capitalize,a=t.util.degreesToRadians,s=!t.isLikelyNode;t.Object||(t.Object=t.util.createClass(t.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgb(178,204,255)",borderDashArray:null,cornerColor:"rgb(178,204,255)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:s,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",activeOn:"down",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),colorProperties:"fill stroke backgroundColor".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(e){e&&this.setOptions(e)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=t.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(e){var r=t.perfLimitSizeTotal,n=e.width,i=e.height,o=t.maxCacheSideLimit,a=t.minCacheSideLimit;if(n<=o&&i<=o&&n*i<=r)return n<a&&(e.width=a),i<a&&(e.height=a),e;var s=n/i,l=t.util.limitDimsByArea(s,r),c=t.util.capValue,u=c(a,l.x,o),d=c(a,l.y,o);return n>u&&(e.zoomX/=n/u,e.width=u,e.capped=!0),i>d&&(e.zoomY/=i/d,e.height=d,e.capped=!0),e},_getCacheCanvasDimensions:function(){var e=this.getTotalObjectScaling(),t=this._getTransformedDimensions(0,0),r=t.x*e.scaleX/this.scaleX,n=t.y*e.scaleY/this.scaleY;return{width:r+2,height:n+2,zoomX:e.scaleX,zoomY:e.scaleY,x:r,y:n}},_updateCacheCanvas:function(){var e=this.canvas;if(this.noScaleCache&&e&&e._currentTransform){var r=e._currentTransform.target,n=e._currentTransform.action;if(this===r&&n.slice&&"scale"===n.slice(0,5))return!1}var i,o,a=this._cacheCanvas,s=this._limitCacheSize(this._getCacheCanvasDimensions()),l=t.minCacheSideLimit,c=s.width,u=s.height,d=s.zoomX,h=s.zoomY,f=c!==this.cacheWidth||u!==this.cacheHeight,p=this.zoomX!==d||this.zoomY!==h,g=f||p,m=0,v=0,y=!1;if(f){var b=this._cacheCanvas.width,w=this._cacheCanvas.height,x=c>b||u>w;y=x||(c<.9*b||u<.9*w)&&b>l&&w>l,x&&!s.capped&&(c>l||u>l)&&(m=.1*c,v=.1*u)}return this instanceof t.Text&&this.path&&(g=!0,y=!0,m+=this.getHeightOfLine(0)*this.zoomX,v+=this.getHeightOfLine(0)*this.zoomY),!!g&&(y?(a.width=Math.ceil(c+m),a.height=Math.ceil(u+v)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,a.width,a.height)),i=s.x/2,o=s.y/2,this.cacheTranslationX=Math.round(a.width/2-i)+i,this.cacheTranslationY=Math.round(a.height/2-o)+o,this.cacheWidth=c,this.cacheHeight=u,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(d,h),this.zoomX=d,this.zoomY=h,!0)},setOptions:function(e){this._setOptions(e),this._initGradient(e.fill,"fill"),this._initGradient(e.stroke,"stroke"),this._initPattern(e.fill,"fill"),this._initPattern(e.stroke,"stroke")},transform:function(e){var t=this.group&&!this.group._transformDone||this.group&&this.canvas&&e===this.canvas.contextTop,r=this.calcTransformMatrix(!t);e.transform(r[0],r[1],r[2],r[3],r[4],r[5])},toObject:function(e){var r=t.Object.NUM_FRACTION_DIGITS,n={type:this.type,version:t.version,originX:this.originX,originY:this.originY,left:i(this.left,r),top:i(this.top,r),width:i(this.width,r),height:i(this.height,r),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:i(this.strokeWidth,r),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:i(this.strokeMiterLimit,r),scaleX:i(this.scaleX,r),scaleY:i(this.scaleY,r),angle:i(this.angle,r),flipX:this.flipX,flipY:this.flipY,opacity:i(this.opacity,r),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:i(this.skewX,r),skewY:i(this.skewY,r)};return this.clipPath&&!this.clipPath.excludeFromExport&&(n.clipPath=this.clipPath.toObject(e),n.clipPath.inverted=this.clipPath.inverted,n.clipPath.absolutePositioned=this.clipPath.absolutePositioned),t.util.populateWithProperties(this,n,e),this.includeDefaultValues||(n=this._removeDefaultValues(n)),n},toDatalessObject:function(e){return this.toObject(e)},_removeDefaultValues:function(e){var r=t.util.getKlass(e.type).prototype;return r.stateProperties.forEach(function(t){"left"===t||"top"===t||(e[t]===r[t]&&delete e[t],Array.isArray(e[t])&&Array.isArray(r[t])&&0===e[t].length&&0===r[t].length&&delete e[t])}),e},toString:function(){return"#<fabric."+o(this.type)+">"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var e=t.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(e.scaleX),scaleY:Math.abs(e.scaleY)}},getTotalObjectScaling:function(){var e=this.getObjectScaling(),t=e.scaleX,r=e.scaleY;if(this.canvas){var n=this.canvas.getZoom(),i=this.canvas.getRetinaScaling();t*=n*i,r*=n*i}return{scaleX:t,scaleY:r}},getObjectOpacity:function(){var e=this.opacity;return this.group&&(e*=this.group.getObjectOpacity()),e},_set:function(e,r){var n="scaleX"===e||"scaleY"===e,i=this[e]!==r,o=!1;return n&&(r=this._constrainScale(r)),"scaleX"===e&&r<0?(this.flipX=!this.flipX,r*=-1):"scaleY"===e&&r<0?(this.flipY=!this.flipY,r*=-1):"shadow"!==e||!r||r instanceof t.Shadow?"dirty"===e&&this.group&&this.group.set("dirty",r):r=new t.Shadow(r),this[e]=r,i&&(o=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(e)>-1?(this.dirty=!0,o&&this.group.set("dirty",!0)):o&&this.stateProperties.indexOf(e)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:t.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||!this.width&&!this.height&&0===this.strokeWidth||!this.visible},render:function(e){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(e.save(),this._setupCompositeOperation(e),this.drawSelectionBackground(e),this.transform(e),this._setOpacity(e),this._setShadow(e,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(e)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(e),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),e.restore())},renderCache:function(e){e=e||{},(!this._cacheCanvas||!this._cacheContext)&&this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,e.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this._cacheContext=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&"transparent"!==this.stroke&&0!==this.strokeWidth},hasFill:function(){return this.fill&&"transparent"!==this.fill},needsItsOwnCache:function(){return!!("stroke"===this.paintFirst&&this.hasFill()&&this.hasStroke()&&"object"==typeof this.shadow||this.clipPath)},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(0!==this.shadow.offsetX||0!==this.shadow.offsetY)},drawClipPathOnCache:function(e,r){if(e.save(),r.inverted?e.globalCompositeOperation="destination-out":e.globalCompositeOperation="destination-in",r.absolutePositioned){var n=t.util.invertTransform(this.calcTransformMatrix());e.transform(n[0],n[1],n[2],n[3],n[4],n[5])}r.transform(e),e.scale(1/r.zoomX,1/r.zoomY),e.drawImage(r._cacheCanvas,-r.cacheTranslationX,-r.cacheTranslationY),e.restore()},drawObject:function(e,t){var r=this.fill,n=this.stroke;t?(this.fill="black",this.stroke="",this._setClippingProperties(e)):this._renderBackground(e),this._render(e),this._drawClipPath(e,this.clipPath),this.fill=r,this.stroke=n},_drawClipPath:function(e,t){t&&(t.canvas=this.canvas,t.shouldCache(),t._transformDone=!0,t.renderCache({forClipping:!0}),this.drawClipPathOnCache(e,t))},drawCacheOnCanvas:function(e){e.scale(1/this.zoomX,1/this.zoomY),e.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(e){if(this.isNotVisible())return!1;if(this._cacheCanvas&&this._cacheContext&&!e&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&this._cacheContext&&!e){var t=this.cacheWidth/this.zoomX,r=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-t/2,-r/2,t,r)}return!0}return!1},_renderBackground:function(e){if(this.backgroundColor){var t=this._getNonTransformedDimensions();e.fillStyle=this.backgroundColor,e.fillRect(-t.x/2,-t.y/2,t.x,t.y),this._removeShadow(e)}},_setOpacity:function(e){this.group&&!this.group._transformDone?e.globalAlpha=this.getObjectOpacity():e.globalAlpha*=this.opacity},_setStrokeStyles:function(e,t){var r=t.stroke;r&&(e.lineWidth=t.strokeWidth,e.lineCap=t.strokeLineCap,e.lineDashOffset=t.strokeDashOffset,e.lineJoin=t.strokeLineJoin,e.miterLimit=t.strokeMiterLimit,r.toLive?"percentage"===r.gradientUnits||r.gradientTransform||r.patternTransform?this._applyPatternForTransformedGradient(e,r):(e.strokeStyle=r.toLive(e,this),this._applyPatternGradientTransform(e,r)):e.strokeStyle=t.stroke)},_setFillStyles:function(e,t){var r=t.fill;r&&(r.toLive?(e.fillStyle=r.toLive(e,this),this._applyPatternGradientTransform(e,t.fill)):e.fillStyle=r)},_setClippingProperties:function(e){e.globalAlpha=1,e.strokeStyle="transparent",e.fillStyle="#000000"},_setLineDash:function(e,t){!t||0===t.length||(1&t.length&&t.push.apply(t,t),e.setLineDash(t))},_renderControls:function(e,r){var n,i,o,s=this.getViewportTransform(),l=this.calcTransformMatrix();i=typeof(r=r||{}).hasBorders<"u"?r.hasBorders:this.hasBorders,o=typeof r.hasControls<"u"?r.hasControls:this.hasControls,l=t.util.multiplyTransformMatrices(s,l),n=t.util.qrDecompose(l),e.save(),e.translate(n.translateX,n.translateY),e.lineWidth=1*this.borderScaleFactor,this.group||(e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(n.angle-=180),e.rotate(a(this.group?n.angle:this.angle)),r.forActiveSelection||this.group?i&&this.drawBordersInGroup(e,n,r):i&&this.drawBorders(e,r),o&&this.drawControls(e,r),e.restore()},_setShadow:function(e){if(this.shadow){var r,n=this.shadow,i=this.canvas,o=i&&i.viewportTransform[0]||1,a=i&&i.viewportTransform[3]||1;r=n.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),i&&i._isRetinaScaling()&&(o*=t.devicePixelRatio,a*=t.devicePixelRatio),e.shadowColor=n.color,e.shadowBlur=n.blur*t.browserShadowBlurConstant*(o+a)*(r.scaleX+r.scaleY)/4,e.shadowOffsetX=n.offsetX*o*r.scaleX,e.shadowOffsetY=n.offsetY*a*r.scaleY}},_removeShadow:function(e){this.shadow&&(e.shadowColor="",e.shadowBlur=e.shadowOffsetX=e.shadowOffsetY=0)},_applyPatternGradientTransform:function(e,t){if(!t||!t.toLive)return{offsetX:0,offsetY:0};var r=t.gradientTransform||t.patternTransform,n=-this.width/2+t.offsetX||0,i=-this.height/2+t.offsetY||0;return"percentage"===t.gradientUnits?e.transform(this.width,0,0,this.height,n,i):e.transform(1,0,0,1,n,i),r&&e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),{offsetX:n,offsetY:i}},_renderPaintInOrder:function(e){"stroke"===this.paintFirst?(this._renderStroke(e),this._renderFill(e)):(this._renderFill(e),this._renderStroke(e))},_render:function(){},_renderFill:function(e){this.fill&&(e.save(),this._setFillStyles(e,this),"evenodd"===this.fillRule?e.fill("evenodd"):e.fill(),e.restore())},_renderStroke:function(e){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(e),e.save(),this.strokeUniform&&this.group){var t=this.getObjectScaling();e.scale(1/t.scaleX,1/t.scaleY)}else this.strokeUniform&&e.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(e,this.strokeDashArray),this._setStrokeStyles(e,this),e.stroke(),e.restore()}},_applyPatternForTransformedGradient:function(e,r){var n,i=this._limitCacheSize(this._getCacheCanvasDimensions()),o=t.util.createCanvasElement(),a=this.canvas.getRetinaScaling(),s=i.x/this.scaleX/a,l=i.y/this.scaleY/a;o.width=s,o.height=l,(n=o.getContext("2d")).beginPath(),n.moveTo(0,0),n.lineTo(s,0),n.lineTo(s,l),n.lineTo(0,l),n.closePath(),n.translate(s/2,l/2),n.scale(i.zoomX/this.scaleX/a,i.zoomY/this.scaleY/a),this._applyPatternGradientTransform(n,r),n.fillStyle=r.toLive(e),n.fill(),e.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),e.scale(a*this.scaleX/i.zoomX,a*this.scaleY/i.zoomY),e.strokeStyle=n.createPattern(o,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var e=t.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",e.scaleX),this.set("scaleY",e.scaleY),this.angle=e.angle,this.skewX=e.skewX,this.skewY=0}},_removeTransformMatrix:function(e){var r=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),r=t.util.transformPoint(r,this.transformMatrix)),this.transformMatrix=null,e&&(this.scaleX*=e.scaleX,this.scaleY*=e.scaleY,this.cropX=e.cropX,this.cropY=e.cropY,r.x+=e.offsetLeft,r.y+=e.offsetTop,this.width=e.width,this.height=e.height),this.setPositionByOrigin(r,"center","center")},clone:function(e,r){var n=this.toObject(r);this.constructor.fromObject?this.constructor.fromObject(n,e):t.Object._fromObject("Object",n,e)},cloneAsImage:function(e,r){var n=this.toCanvasElement(r);return e&&e(new t.Image(n)),this},toCanvasElement:function(e){e||(e={});var r=t.util,n=r.saveObjectTransform(this),i=this.group,o=this.shadow,a=Math.abs,s=(e.multiplier||1)*(e.enableRetinaScaling?t.devicePixelRatio:1);delete this.group,e.withoutTransform&&r.resetObjectTransform(this),e.withoutShadow&&(this.shadow=null);var l,c,u,d,h=t.util.createCanvasElement(),f=this.getBoundingRect(!0,!0),p=this.shadow,g={x:0,y:0};p&&(c=p.blur,l=p.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),g.x=2*Math.round(a(p.offsetX)+c)*a(l.scaleX),g.y=2*Math.round(a(p.offsetY)+c)*a(l.scaleY)),u=f.width+g.x,d=f.height+g.y,h.width=Math.ceil(u),h.height=Math.ceil(d);var m=new t.StaticCanvas(h,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});"jpeg"===e.format&&(m.backgroundColor="#fff"),this.setPositionByOrigin(new t.Point(m.width/2,m.height/2),"center","center");var v=this.canvas;m.add(this);var y=m.toCanvasElement(s||1,e);return this.shadow=o,this.set("canvas",v),i&&(this.group=i),this.set(n).setCoords(),m._objects=[],m.dispose(),m=null,y},toDataURL:function(e){return e||(e={}),t.util.toDataURL(this.toCanvasElement(e),e.format||"png",e.quality||1)},isType:function(e){return arguments.length>1?Array.from(arguments).includes(this.type):this.type===e},complexity:function(){return 1},toJSON:function(e){return this.toObject(e)},rotate:function(e){var t=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return t&&this._setOriginToCenter(),this.set("angle",e),t&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(e,r){r=r||this.canvas.getPointer(e);var n=new t.Point(r.x,r.y),i=this._getLeftTopCoords();return this.angle&&(n=t.util.rotatePoint(n,i,a(-this.angle))),{x:n.x-i.x,y:n.y-i.y}},_setupCompositeOperation:function(e){this.globalCompositeOperation&&(e.globalCompositeOperation=this.globalCompositeOperation)},dispose:function(){t.runningAnimations&&t.runningAnimations.cancelByTarget(this)}}),t.util.createAccessors&&t.util.createAccessors(t.Object),r(t.Object.prototype,t.Observable),t.Object.NUM_FRACTION_DIGITS=2,t.Object.ENLIVEN_PROPS=["clipPath"],t.Object._fromObject=function(e,r,i,o){var a=t[e];r=n(r,!0),t.util.enlivenPatterns([r.fill,r.stroke],function(e){typeof e[0]<"u"&&(r.fill=e[0]),typeof e[1]<"u"&&(r.stroke=e[1]),t.util.enlivenObjectEnlivables(r,r,function(){var e=o?new a(r[o],r):new a(r);i&&i(e)})})},t.Object.__uid=0)}(e),function(){var e=t.util.degreesToRadians,r={left:-.5,center:0,right:.5},n={top:-.5,center:0,bottom:.5};t.util.object.extend(t.Object.prototype,{translateToGivenOrigin:function(e,i,o,a,s){var l,c,u,d=e.x,h=e.y;return"string"==typeof i?i=r[i]:i-=.5,"string"==typeof a?a=r[a]:a-=.5,"string"==typeof o?o=n[o]:o-=.5,"string"==typeof s?s=n[s]:s-=.5,c=s-o,((l=a-i)||c)&&(u=this._getTransformedDimensions(),d=e.x+l*u.x,h=e.y+c*u.y),new t.Point(d,h)},translateToCenterPoint:function(r,n,i){var o=this.translateToGivenOrigin(r,n,i,"center","center");return this.angle?t.util.rotatePoint(o,r,e(this.angle)):o},translateToOriginPoint:function(r,n,i){var o=this.translateToGivenOrigin(r,"center","center",n,i);return this.angle?t.util.rotatePoint(o,r,e(this.angle)):o},getCenterPoint:function(){var e=new t.Point(this.left,this.top);return this.translateToCenterPoint(e,this.originX,this.originY)},getPointByOrigin:function(e,t){var r=this.getCenterPoint();return this.translateToOriginPoint(r,e,t)},toLocalPoint:function(r,n,i){var o,a,s=this.getCenterPoint();return o=typeof n<"u"&&typeof i<"u"?this.translateToGivenOrigin(s,"center","center",n,i):new t.Point(this.left,this.top),a=new t.Point(r.x,r.y),this.angle&&(a=t.util.rotatePoint(a,s,-e(this.angle))),a.subtractEquals(o)},setPositionByOrigin:function(e,t,r){var n=this.translateToCenterPoint(e,t,r),i=this.translateToOriginPoint(n,this.originX,this.originY);this.set("left",i.x),this.set("top",i.y)},adjustPosition:function(n){var i,o,a=e(this.angle),s=this.getScaledWidth(),l=t.util.cos(a)*s,c=t.util.sin(a)*s;i="string"==typeof this.originX?r[this.originX]:this.originX-.5,o="string"==typeof n?r[n]:n-.5,this.left+=l*(o-i),this.top+=c*(o-i),this.setCoords(),this.originX=n},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var e=this.getCenterPoint();this.originX="center",this.originY="center",this.left=e.x,this.top=e.y},_resetOrigin:function(){var e=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=e.x,this.top=e.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){var e=t.util,r=e.degreesToRadians,n=e.multiplyTransformMatrices,i=e.transformPoint;e.object.extend(t.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(e,t){return t?e?this.calcACoords():this.calcLineCoords():((!this.aCoords||!this.lineCoords)&&this.setCoords(!0),e?this.aCoords:this.lineCoords)},getCoords:function(e,r){return function(e){return[new t.Point(e.tl.x,e.tl.y),new t.Point(e.tr.x,e.tr.y),new t.Point(e.br.x,e.br.y),new t.Point(e.bl.x,e.bl.y)]}(this._getCoords(e,r))},intersectsWithRect:function(e,r,n,i){var o=this.getCoords(n,i);return"Intersection"===t.Intersection.intersectPolygonRectangle(o,e,r).status},intersectsWithObject:function(e,r,n){return"Intersection"===t.Intersection.intersectPolygonPolygon(this.getCoords(r,n),e.getCoords(r,n)).status||e.isContainedWithinObject(this,r,n)||this.isContainedWithinObject(e,r,n)},isContainedWithinObject:function(e,t,r){for(var n=this.getCoords(t,r),i=t?e.aCoords:e.lineCoords,o=0,a=e._getImageLines(i);o<4;o++)if(!e.containsPoint(n[o],a))return!1;return!0},isContainedWithinRect:function(e,t,r,n){var i=this.getBoundingRect(r,n);return i.left>=e.x&&i.left+i.width<=t.x&&i.top>=e.y&&i.top+i.height<=t.y},containsPoint:function(e,t,r,n){var i=this._getCoords(r,n),o=(t=t||this._getImageLines(i),this._findCrossPoints(e,t));return 0!==o&&o%2==1},isOnScreen:function(e){if(!this.canvas)return!1;var t=this.canvas.vptCoords.tl,r=this.canvas.vptCoords.br;return!(!this.getCoords(!0,e).some(function(e){return e.x<=r.x&&e.x>=t.x&&e.y<=r.y&&e.y>=t.y})&&!this.intersectsWithRect(t,r,!0,e))||this._containsCenterOfCanvas(t,r,e)},_containsCenterOfCanvas:function(e,t,r){var n={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return!!this.containsPoint(n,null,!0,r)},isPartiallyOnScreen:function(e){if(!this.canvas)return!1;var t=this.canvas.vptCoords.tl,r=this.canvas.vptCoords.br;return!!this.intersectsWithRect(t,r,!0,e)||this.getCoords(!0,e).every(function(e){return(e.x>=r.x||e.x<=t.x)&&(e.y>=r.y||e.y<=t.y)})&&this._containsCenterOfCanvas(t,r,e)},_getImageLines:function(e){return{topline:{o:e.tl,d:e.tr},rightline:{o:e.tr,d:e.br},bottomline:{o:e.br,d:e.bl},leftline:{o:e.bl,d:e.tl}}},_findCrossPoints:function(e,t){var r,n,i,o,a,s=0;for(var l in t)if(!((a=t[l]).o.y<e.y&&a.d.y<e.y||a.o.y>=e.y&&a.d.y>=e.y||(a.o.x===a.d.x&&a.o.x>=e.x?o=a.o.x:(r=(a.d.y-a.o.y)/(a.d.x-a.o.x),n=e.y-0*e.x,i=a.o.y-r*a.o.x,o=-(n-i)/(0-r)),o>=e.x&&(s+=1),2!==s)))break;return s},getBoundingRect:function(t,r){var n=this.getCoords(t,r);return e.makeBoundingBoxFromPoints(n)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(e){return Math.abs(e)<this.minScaleLimit?e<0?-this.minScaleLimit:this.minScaleLimit:0===e?1e-4:e},scale:function(e){return this._set("scaleX",e),this._set("scaleY",e),this.setCoords()},scaleToWidth:function(e,t){var r=this.getBoundingRect(t).width/this.getScaledWidth();return this.scale(e/this.width/r)},scaleToHeight:function(e,t){var r=this.getBoundingRect(t).height/this.getScaledHeight();return this.scale(e/this.height/r)},calcLineCoords:function(){var t=this.getViewportTransform(),n=this.padding,o=r(this.angle),a=e.cos(o)*n,s=e.sin(o)*n,l=a+s,c=a-s,u=this.calcACoords(),d={tl:i(u.tl,t),tr:i(u.tr,t),bl:i(u.bl,t),br:i(u.br,t)};return n&&(d.tl.x-=c,d.tl.y-=l,d.tr.x+=l,d.tr.y-=c,d.bl.x-=l,d.bl.y+=c,d.br.x+=c,d.br.y+=l),d},calcOCoords:function(){var e=this._calcRotateMatrix(),t=this._calcTranslateMatrix(),r=this.getViewportTransform(),i=n(r,t),o=n(i,e),a=(o=n(o,[1/r[0],0,0,1/r[3],0,0]),this._calculateCurrentDimensions()),s={};return this.forEachControl(function(e,t,r){s[t]=e.positionHandler(a,o,r)}),s},calcACoords:function(){var e=this._calcRotateMatrix(),t=this._calcTranslateMatrix(),r=n(t,e),o=this._getTransformedDimensions(),a=o.x/2,s=o.y/2;return{tl:i({x:-a,y:-s},r),tr:i({x:a,y:-s},r),bl:i({x:-a,y:s},r),br:i({x:a,y:s},r)}},setCoords:function(e){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),e||(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords()),this},_calcRotateMatrix:function(){return e.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var e=this.getCenterPoint();return[1,0,0,1,e.x,e.y]},transformMatrixKey:function(e){var t="_",r="";return!e&&this.group&&(r=this.group.transformMatrixKey(e)+t),r+this.top+t+this.left+t+this.scaleX+t+this.scaleY+t+this.skewX+t+this.skewY+t+this.angle+t+this.originX+t+this.originY+t+this.width+t+this.height+t+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(e){var t=this.calcOwnMatrix();if(e||!this.group)return t;var r=this.transformMatrixKey(e),i=this.matrixCache||(this.matrixCache={});return i.key===r?i.value:(this.group&&(t=n(this.group.calcTransformMatrix(!1),t)),i.key=r,i.value=t,t)},calcOwnMatrix:function(){var t=this.transformMatrixKey(!0),r=this.ownMatrixCache||(this.ownMatrixCache={});if(r.key===t)return r.value;var n=this._calcTranslateMatrix(),i={angle:this.angle,translateX:n[4],translateY:n[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return r.key=t,r.value=e.composeMatrix(i),r.value},_getNonTransformedDimensions:function(){var e=this.strokeWidth;return{x:this.width+e,y:this.height+e}},_getTransformedDimensions:function(t,r){typeof t>"u"&&(t=this.skewX),typeof r>"u"&&(r=this.skewY);var n,i,o,a=0===t&&0===r;if(this.strokeUniform?(i=this.width,o=this.height):(i=(n=this._getNonTransformedDimensions()).x,o=n.y),a)return this._finalizeDimensions(i*this.scaleX,o*this.scaleY);var s=e.sizeAfterTransform(i,o,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:t,skewY:r});return this._finalizeDimensions(s.x,s.y)},_finalizeDimensions:function(e,t){return this.strokeUniform?{x:e+this.strokeWidth,y:t+this.strokeWidth}:{x:e,y:t}},_calculateCurrentDimensions:function(){var e=this.getViewportTransform(),t=this._getTransformedDimensions();return i(t,e,!0).scalarAdd(2*this.padding)}})}(),t.util.object.extend(t.Object.prototype,{sendToBack:function(){return this.group?t.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?t.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(e){return this.group?t.StaticCanvas.prototype.sendBackwards.call(this.group,this,e):this.canvas&&this.canvas.sendBackwards(this,e),this},bringForward:function(e){return this.group?t.StaticCanvas.prototype.bringForward.call(this.group,this,e):this.canvas&&this.canvas.bringForward(this,e),this},moveTo:function(e){return this.group&&"activeSelection"!==this.group.type?t.StaticCanvas.prototype.moveTo.call(this.group,this,e):this.canvas&&this.canvas.moveTo(this,e),this}}),function(){function e(e,r){if(r){if(r.toLive)return e+": url(#SVGID_"+r.id+"); ";var n=new t.Color(r),i=e+": "+n.toRgb()+"; ",o=n.getAlpha();return 1!==o&&(i+=e+"-opacity: "+o.toString()+"; "),i}return e+": none; "}var r=t.util.toFixed;t.util.object.extend(t.Object.prototype,{getSvgStyles:function(t){var r=this.fillRule?this.fillRule:"nonzero",n=this.strokeWidth?this.strokeWidth:"0",i=this.strokeDashArray?this.strokeDashArray.join(" "):"none",o=this.strokeDashOffset?this.strokeDashOffset:"0",a=this.strokeLineCap?this.strokeLineCap:"butt",s=this.strokeLineJoin?this.strokeLineJoin:"miter",l=this.strokeMiterLimit?this.strokeMiterLimit:"4",c=typeof this.opacity<"u"?this.opacity:"1",u=this.visible?"":" visibility: hidden;",d=t?"":this.getSvgFilter(),h=e("fill",this.fill);return[e("stroke",this.stroke),"stroke-width: ",n,"; ","stroke-dasharray: ",i,"; ","stroke-linecap: ",a,"; ","stroke-dashoffset: ",o,"; ","stroke-linejoin: ",s,"; ","stroke-miterlimit: ",l,"; ",h,"fill-rule: ",r,"; ","opacity: ",c,";",d,u].join("")},getSvgSpanStyles:function(t,r){var n="; ",i=t.fontFamily?"font-family: "+(-1===t.fontFamily.indexOf("'")&&-1===t.fontFamily.indexOf('"')?"'"+t.fontFamily+"'":t.fontFamily)+n:"",o=t.strokeWidth?"stroke-width: "+t.strokeWidth+n:"",a=(i=i,t.fontSize?"font-size: "+t.fontSize+"px"+n:""),s=t.fontStyle?"font-style: "+t.fontStyle+n:"",l=t.fontWeight?"font-weight: "+t.fontWeight+n:"",c=t.fill?e("fill",t.fill):"",u=t.stroke?e("stroke",t.stroke):"",d=this.getSvgTextDecoration(t);return d&&(d="text-decoration: "+d+n),[u,o,i,a,s,l,d,c,t.deltaY?"baseline-shift: "+-t.deltaY+"; ":"",r?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(e){return["overline","underline","line-through"].filter(function(t){return e[t.replace("-","")]}).join(" ")},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""},getSvgCommons:function(){return[this.id?'id="'+this.id+'" ':"",this.clipPath?'clip-path="url(#'+this.clipPath.clipPathId+')" ':""].join("")},getSvgTransform:function(e,r){var n=e?this.calcTransformMatrix():this.calcOwnMatrix();return'transform="'+t.util.matrixToSVG(n)+(r||"")+'" '},_setSVGBg:function(e){if(this.backgroundColor){var n=t.Object.NUM_FRACTION_DIGITS;e.push("\t\t<rect ",this._getFillAttributes(this.backgroundColor),' x="',r(-this.width/2,n),'" y="',r(-this.height/2,n),'" width="',r(this.width,n),'" height="',r(this.height,n),'"></rect>\n')}},toSVG:function(e){return this._createBaseSVGMarkup(this._toSVG(e),{reviver:e})},toClipPathSVG:function(e){return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(e),{reviver:e})},_createBaseClipPathSVGMarkup:function(e,t){var r=(t=t||{}).reviver,n=t.additionalTransform||"",i=[this.getSvgTransform(!0,n),this.getSvgCommons()].join(""),o=e.indexOf("COMMON_PARTS");return e[o]=i,r?r(e.join("")):e.join("")},_createBaseSVGMarkup:function(e,r){var n,i,o=(r=r||{}).noStyle,a=r.reviver,s=o?"":'style="'+this.getSvgStyles()+'" ',l=r.withShadow?'style="'+this.getSvgFilter()+'" ':"",c=this.clipPath,u=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",d=c&&c.absolutePositioned,h=this.stroke,f=this.fill,p=this.shadow,g=[],m=e.indexOf("COMMON_PARTS"),v=r.additionalTransform;return c&&(c.clipPathId="CLIPPATH_"+t.Object.__uid++,i='<clipPath id="'+c.clipPathId+'" >\n'+c.toClipPathSVG(a)+"</clipPath>\n"),d&&g.push("<g ",l,this.getSvgCommons()," >\n"),g.push("<g ",this.getSvgTransform(!1),d?"":l+this.getSvgCommons()," >\n"),n=[s,u,o?"":this.addPaintOrder()," ",v?'transform="'+v+'" ':""].join(""),e[m]=n,f&&f.toLive&&g.push(f.toSVG(this)),h&&h.toLive&&g.push(h.toSVG(this)),p&&g.push(p.toSVG(this)),c&&g.push(i),g.push(e.join("")),g.push("</g>\n"),d&&g.push("</g>\n"),a?a(g.join("")):g.join("")},addPaintOrder:function(){return"fill"!==this.paintFirst?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var e=t.util.object.extend,r="stateProperties";function n(t,r,n){var i={};n.forEach(function(e){i[e]=t[e]}),e(t[r],i,!0)}function i(e,t,r){if(e===t)return!0;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var n=0,o=e.length;n<o;n++)if(!i(e[n],t[n]))return!1;return!0}if(e&&"object"==typeof e){var a,s=Object.keys(e);if(!t||"object"!=typeof t||!r&&s.length!==Object.keys(t).length)return!1;for(n=0,o=s.length;n<o;n++)if("canvas"!==(a=s[n])&&"group"!==a&&!i(e[a],t[a]))return!1;return!0}}t.util.object.extend(t.Object.prototype,{hasStateChanged:function(e){var t="_"+(e=e||r);return Object.keys(this[t]).length<this[e].length||!i(this[t],this,!0)},saveState:function(e){var t=e&&e.propertySet||r,i="_"+t;return this[i]?(n(this,i,this[t]),e&&e.stateProperties&&n(this,i,e.stateProperties),this):this.setupState(e)},setupState:function(e){var t=(e=e||{}).propertySet||r;return e.propertySet=t,this["_"+t]={},this.saveState(e),this}})}(),function(){var e=t.util.degreesToRadians;t.util.object.extend(t.Object.prototype,{_findTargetCorner:function(e,t){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var r,n,i,o=e.x,a=e.y,s=Object.keys(this.oCoords),l=s.length-1;for(this.__corner=0;l>=0;l--)if(i=s[l],this.isControlVisible(i)&&(n=this._getImageLines(t?this.oCoords[i].touchCorner:this.oCoords[i].corner),0!==(r=this._findCrossPoints({x:o,y:a},n))&&r%2==1))return this.__corner=i,i;return!1},forEachControl:function(e){for(var t in this.controls)e(this.controls[t],t,this)},_setCornerCoords:function(){var e=this.oCoords;for(var t in e){var r=this.controls[t];e[t].corner=r.calcCornerCoords(this.angle,this.cornerSize,e[t].x,e[t].y,!1),e[t].touchCorner=r.calcCornerCoords(this.angle,this.touchCornerSize,e[t].x,e[t].y,!0)}},drawSelectionBackground:function(t){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;t.save();var r=this.getCenterPoint(),n=this._calculateCurrentDimensions(),i=this.canvas.viewportTransform;return t.translate(r.x,r.y),t.scale(1/i[0],1/i[3]),t.rotate(e(this.angle)),t.fillStyle=this.selectionBackgroundColor,t.fillRect(-n.x/2,-n.y/2,n.x,n.y),t.restore(),this},drawBorders:function(e,t){t=t||{};var r=this._calculateCurrentDimensions(),n=this.borderScaleFactor,i=r.x+n,o=r.y+n,a=typeof t.hasControls<"u"?t.hasControls:this.hasControls,s=!1;return e.save(),e.strokeStyle=t.borderColor||this.borderColor,this._setLineDash(e,t.borderDashArray||this.borderDashArray),e.strokeRect(-i/2,-o/2,i,o),a&&(e.beginPath(),this.forEachControl(function(t,r,n){t.withConnection&&t.getVisibility(n,r)&&(s=!0,e.moveTo(t.x*i,t.y*o),e.lineTo(t.x*i+t.offsetX,t.y*o+t.offsetY))}),s&&e.stroke()),e.restore(),this},drawBordersInGroup:function(e,r,n){n=n||{};var i=t.util.sizeAfterTransform(this.width,this.height,r),o=this.strokeWidth,a=this.strokeUniform,s=this.borderScaleFactor,l=i.x+o*(a?this.canvas.getZoom():r.scaleX)+s,c=i.y+o*(a?this.canvas.getZoom():r.scaleY)+s;return e.save(),this._setLineDash(e,n.borderDashArray||this.borderDashArray),e.strokeStyle=n.borderColor||this.borderColor,e.strokeRect(-l/2,-c/2,l,c),e.restore(),this},drawControls:function(e,r){r=r||{},e.save();var n,i,o=this.canvas.getRetinaScaling();return e.setTransform(o,0,0,o,0,0),e.strokeStyle=e.fillStyle=r.cornerColor||this.cornerColor,this.transparentCorners||(e.strokeStyle=r.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(e,r.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(n=this.group.calcTransformMatrix()),this.forEachControl(function(o,a,s){i=s.oCoords[a],o.getVisibility(s,a)&&(n&&(i=t.util.transformPoint(i,n)),o.render(e,i.x,i.y,r,s))}),e.restore(),this},isControlVisible:function(e){return this.controls[e]&&this.controls[e].getVisibility(this,e)},setControlVisible:function(e,t){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[e]=t,this},setControlsVisibility:function(e){for(var t in e||(e={}),e)this.setControlVisible(t,e[t]);return this},onDeselect:function(){},onSelect:function(){}})}(),t.util.object.extend(t.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(e,r){var n=function(){},i=(r=r||{}).onComplete||n,o=r.onChange||n,a=this;return t.util.animate({target:this,startValue:e.left,endValue:this.getCenterPoint().x,duration:this.FX_DURATION,onChange:function(t){e.set("left",t),a.requestRenderAll(),o()},onComplete:function(){e.setCoords(),i()}})},fxCenterObjectV:function(e,r){var n=function(){},i=(r=r||{}).onComplete||n,o=r.onChange||n,a=this;return t.util.animate({target:this,startValue:e.top,endValue:this.getCenterPoint().y,duration:this.FX_DURATION,onChange:function(t){e.set("top",t),a.requestRenderAll(),o()},onComplete:function(){e.setCoords(),i()}})},fxRemove:function(e,r){var n=function(){},i=(r=r||{}).onComplete||n,o=r.onChange||n,a=this;return t.util.animate({target:this,startValue:e.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(t){e.set("opacity",t),a.requestRenderAll(),o()},onComplete:function(){a.remove(e),i()}})}}),t.util.object.extend(t.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var e,t,r=[],n=[];for(e in arguments[0])r.push(e);for(var i=0,o=r.length;i<o;i++)e=r[i],t=i!==o-1,n.push(this._animate(e,arguments[0][e],arguments[1],t));return n}return this._animate.apply(this,arguments)},_animate:function(e,r,n,i){var o,a=this;r=r.toString(),n=n?t.util.object.clone(n):{},~e.indexOf(".")&&(o=e.split("."));var s=a.colorProperties.indexOf(e)>-1||o&&a.colorProperties.indexOf(o[1])>-1,l=o?this.get(o[0])[o[1]]:this.get(e);"from"in n||(n.from=l),s||(r=~r.indexOf("=")?l+parseFloat(r.replace("=","")):parseFloat(r));var c={target:this,startValue:n.from,endValue:r,byValue:n.by,easing:n.easing,duration:n.duration,abort:n.abort&&function(e,t,r){return n.abort.call(a,e,t,r)},onChange:function(t,r,s){o?a[o[0]][o[1]]=t:a.set(e,t),!i&&n.onChange&&n.onChange(t,r,s)},onComplete:function(e,t,r){i||(a.setCoords(),n.onComplete&&n.onComplete(e,t,r))}};return s?t.util.animateColor(c.startValue,c.endValue,c.duration,c):t.util.animate(c)}}),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.util.object.clone,i={x1:1,x2:1,y1:1,y2:1};function o(e,t){var r=e.origin,n=e.axis1,i=e.axis2,o=e.dimension,a=t.nearest,s=t.center,l=t.farthest;return function(){switch(this.get(r)){case a:return Math.min(this.get(n),this.get(i));case s:return Math.min(this.get(n),this.get(i))+.5*this.get(o);case l:return Math.max(this.get(n),this.get(i))}}}t.Line?t.warn("fabric.Line is already defined"):(t.Line=t.util.createClass(t.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:t.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(e,t){e||(e=[0,0,0,0]),this.callSuper("initialize",t),this.set("x1",e[0]),this.set("y1",e[1]),this.set("x2",e[2]),this.set("y2",e[3]),this._setWidthHeight(t)},_setWidthHeight:function(e){e||(e={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in e?e.left:this._getLeftToOriginX(),this.top="top"in e?e.top:this._getTopToOriginY()},_set:function(e,t){return this.callSuper("_set",e,t),typeof i[e]<"u"&&this._setWidthHeight(),this},_getLeftToOriginX:o({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:o({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(e){e.beginPath();var t=this.calcLinePoints();e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineWidth=this.strokeWidth;var r=e.strokeStyle;e.strokeStyle=this.stroke||e.fillStyle,this.stroke&&this._renderStroke(e),e.strokeStyle=r},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(e){return r(this.callSuper("toObject",e),this.calcLinePoints())},_getNonTransformedDimensions:function(){var e=this.callSuper("_getNonTransformedDimensions");return"butt"===this.strokeLineCap&&(0===this.width&&(e.y-=this.strokeWidth),0===this.height&&(e.x-=this.strokeWidth)),e},calcLinePoints:function(){var e=this.x1<=this.x2?-1:1,t=this.y1<=this.y2?-1:1,r=e*this.width*.5,n=t*this.height*.5;return{x1:r,x2:e*this.width*-.5,y1:n,y2:t*this.height*-.5}},_toSVG:function(){var e=this.calcLinePoints();return["<line ","COMMON_PARTS",'x1="',e.x1,'" y1="',e.y1,'" x2="',e.x2,'" y2="',e.y2,'" />\n']}}),t.Line.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),t.Line.fromElement=function(e,n,i){i=i||{};var o=t.parseAttributes(e,t.Line.ATTRIBUTE_NAMES),a=[o.x1||0,o.y1||0,o.x2||0,o.y2||0];n(new t.Line(a,r(o,i)))},t.Line.fromObject=function(e,r){var i=n(e,!0);i.points=[e.x1,e.y1,e.x2,e.y2],t.Object._fromObject("Line",i,function(e){delete e.points,r&&r(e)},"points")})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.degreesToRadians;t.Circle?t.warn("fabric.Circle is already defined."):(t.Circle=t.util.createClass(t.Object,{type:"circle",radius:0,startAngle:0,endAngle:360,cacheProperties:t.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set:function(e,t){return this.callSuper("_set",e,t),"radius"===e&&this.setRadius(t),this},toObject:function(e){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(e))},_toSVG:function(){var e,n=(this.endAngle-this.startAngle)%360;if(0===n)e=["<circle ","COMMON_PARTS",'cx="0" cy="0" ','r="',this.radius,'" />\n'];else{var i=r(this.startAngle),o=r(this.endAngle),a=this.radius;e=['<path d="M '+t.util.cos(i)*a+" "+t.util.sin(i)*a," A "+a+" "+a," 0 ",+(n>180?"1":"0")+" 1"," "+t.util.cos(o)*a+" "+t.util.sin(o)*a,'" ',"COMMON_PARTS"," />\n"]}return e},_render:function(e){e.beginPath(),e.arc(0,0,this.radius,r(this.startAngle),r(this.endAngle),!1),this._renderPaintInOrder(e)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(e){return this.radius=e,this.set("width",2*e).set("height",2*e)}}),t.Circle.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),t.Circle.fromElement=function(e,r){var n=t.parseAttributes(e,t.Circle.ATTRIBUTE_NAMES);if(!function(e){return"radius"in e&&e.radius>=0}(n))throw new Error("value of `r` attribute is required and can not be negative");n.left=(n.left||0)-n.radius,n.top=(n.top||0)-n.radius,r(new t.Circle(n))},t.Circle.fromObject=function(e,r){t.Object._fromObject("Circle",e,r)})}(e),function(e){var t=e.fabric||(e.fabric={});t.Triangle?t.warn("fabric.Triangle is already defined"):(t.Triangle=t.util.createClass(t.Object,{type:"triangle",width:100,height:100,_render:function(e){var t=this.width/2,r=this.height/2;e.beginPath(),e.moveTo(-t,r),e.lineTo(0,-r),e.lineTo(t,r),e.closePath(),this._renderPaintInOrder(e)},_toSVG:function(){var e=this.width/2,t=this.height/2;return["<polygon ","COMMON_PARTS",'points="',[-e+" "+t,"0 "+-t,e+" "+t].join(","),'" />']}}),t.Triangle.fromObject=function(e,r){return t.Object._fromObject("Triangle",e,r)})}(e),function(e){var t=e.fabric||(e.fabric={}),r=2*Math.PI;t.Ellipse?t.warn("fabric.Ellipse is already defined."):(t.Ellipse=t.util.createClass(t.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:t.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(e){this.callSuper("initialize",e),this.set("rx",e&&e.rx||0),this.set("ry",e&&e.ry||0)},_set:function(e,t){switch(this.callSuper("_set",e,t),e){case"rx":this.rx=t,this.set("width",2*t);break;case"ry":this.ry=t,this.set("height",2*t)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(e){return this.callSuper("toObject",["rx","ry"].concat(e))},_toSVG:function(){return["<ellipse ","COMMON_PARTS",'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,'" />\n']},_render:function(e){e.beginPath(),e.save(),e.transform(1,0,0,this.ry/this.rx,0,0),e.arc(0,0,this.rx,0,r,!1),e.restore(),this._renderPaintInOrder(e)}}),t.Ellipse.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),t.Ellipse.fromElement=function(e,r){var n=t.parseAttributes(e,t.Ellipse.ATTRIBUTE_NAMES);n.left=(n.left||0)-n.rx,n.top=(n.top||0)-n.ry,r(new t.Ellipse(n))},t.Ellipse.fromObject=function(e,r){t.Object._fromObject("Ellipse",e,r)})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend;t.Rect?t.warn("fabric.Rect is already defined"):(t.Rect=t.util.createClass(t.Object,{stateProperties:t.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:t.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(e){this.callSuper("initialize",e),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(e){var t=this.rx?Math.min(this.rx,this.width/2):0,r=this.ry?Math.min(this.ry,this.height/2):0,n=this.width,i=this.height,o=-this.width/2,a=-this.height/2,s=0!==t||0!==r,l=.4477152502;e.beginPath(),e.moveTo(o+t,a),e.lineTo(o+n-t,a),s&&e.bezierCurveTo(o+n-l*t,a,o+n,a+l*r,o+n,a+r),e.lineTo(o+n,a+i-r),s&&e.bezierCurveTo(o+n,a+i-l*r,o+n-l*t,a+i,o+n-t,a+i),e.lineTo(o+t,a+i),s&&e.bezierCurveTo(o+l*t,a+i,o,a+i-l*r,o,a+i-r),e.lineTo(o,a+r),s&&e.bezierCurveTo(o,a+l*r,o+l*t,a,o+t,a),e.closePath(),this._renderPaintInOrder(e)},toObject:function(e){return this.callSuper("toObject",["rx","ry"].concat(e))},_toSVG:function(){return["<rect ","COMMON_PARTS",'x="',-this.width/2,'" y="',-this.height/2,'" rx="',this.rx,'" ry="',this.ry,'" width="',this.width,'" height="',this.height,'" />\n']}}),t.Rect.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),t.Rect.fromElement=function(e,n,i){if(!e)return n(null);i=i||{};var o=t.parseAttributes(e,t.Rect.ATTRIBUTE_NAMES);o.left=o.left||0,o.top=o.top||0,o.height=o.height||0,o.width=o.width||0;var a=new t.Rect(r(i?t.util.object.clone(i):{},o));a.visible=a.visible&&a.width>0&&a.height>0,n(a)},t.Rect.fromObject=function(e,r){return t.Object._fromObject("Rect",e,r)})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.util.array.min,i=t.util.array.max,o=t.util.toFixed,a=t.util.projectStrokeOnPoints;t.Polyline?t.warn("fabric.Polyline is already defined"):(t.Polyline=t.util.createClass(t.Object,{type:"polyline",points:null,exactBoundingBox:!1,cacheProperties:t.Object.prototype.cacheProperties.concat("points"),initialize:function(e,t){t=t||{},this.points=e||[],this.callSuper("initialize",t),this._setPositionDimensions(t)},_projectStrokeOnPoints:function(){return a(this.points,this,!0)},_setPositionDimensions:function(e){var t,r=this._calcDimensions(e),n=this.exactBoundingBox?this.strokeWidth:0;this.width=r.width-n,this.height=r.height-n,e.fromSVG||(t=this.translateToGivenOrigin({x:r.left-this.strokeWidth/2+n/2,y:r.top-this.strokeWidth/2+n/2},"left","top",this.originX,this.originY)),typeof e.left>"u"&&(this.left=e.fromSVG?r.left:t.x),typeof e.top>"u"&&(this.top=e.fromSVG?r.top:t.y),this.pathOffset={x:r.left+this.width/2+n/2,y:r.top+this.height/2+n/2}},_calcDimensions:function(){var e=this.exactBoundingBox?this._projectStrokeOnPoints():this.points,t=n(e,"x")||0,r=n(e,"y")||0;return{left:t,top:r,width:(i(e,"x")||0)-t,height:(i(e,"y")||0)-r}},toObject:function(e){return r(this.callSuper("toObject",e),{points:this.points.concat()})},_toSVG:function(){for(var e=[],r=this.pathOffset.x,n=this.pathOffset.y,i=t.Object.NUM_FRACTION_DIGITS,a=0,s=this.points.length;a<s;a++)e.push(o(this.points[a].x-r,i),",",o(this.points[a].y-n,i)," ");return["<"+this.type+" ","COMMON_PARTS",'points="',e.join(""),'" />\n']},commonRender:function(e){var t,r=this.points.length,n=this.pathOffset.x,i=this.pathOffset.y;if(!r||isNaN(this.points[r-1].y))return!1;e.beginPath(),e.moveTo(this.points[0].x-n,this.points[0].y-i);for(var o=0;o<r;o++)t=this.points[o],e.lineTo(t.x-n,t.y-i);return!0},_render:function(e){this.commonRender(e)&&this._renderPaintInOrder(e)},complexity:function(){return this.get("points").length}}),t.Polyline.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(),t.Polyline.fromElementGenerator=function(e){return function(n,i,o){if(!n)return i(null);o||(o={});var a=t.parsePointsAttribute(n.getAttribute("points")),s=t.parseAttributes(n,t[e].ATTRIBUTE_NAMES);s.fromSVG=!0,i(new t[e](a,r(s,o)))}},t.Polyline.fromElement=t.Polyline.fromElementGenerator("Polyline"),t.Polyline.fromObject=function(e,r){return t.Object._fromObject("Polyline",e,r,"points")})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.projectStrokeOnPoints;t.Polygon?t.warn("fabric.Polygon is already defined"):(t.Polygon=t.util.createClass(t.Polyline,{type:"polygon",_projectStrokeOnPoints:function(){return r(this.points,this)},_render:function(e){this.commonRender(e)&&(e.closePath(),this._renderPaintInOrder(e))}}),t.Polygon.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(),t.Polygon.fromElement=t.Polyline.fromElementGenerator("Polygon"),t.Polygon.fromObject=function(e,r){t.Object._fromObject("Polygon",e,r,"points")})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.array.min,n=t.util.array.max,i=t.util.object.extend,o=t.util.object.clone,a=t.util.toFixed;t.Path?t.warn("fabric.Path is already defined"):(t.Path=t.util.createClass(t.Object,{type:"path",path:null,cacheProperties:t.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:t.Object.prototype.stateProperties.concat("path"),initialize:function(e,t){delete(t=o(t||{})).path,this.callSuper("initialize",t),this._setPath(e||[],t)},_setPath:function(e,r){this.path=t.util.makePathSimpler(Array.isArray(e)?e:t.util.parsePath(e)),t.Polyline.prototype._setPositionDimensions.call(this,r||{})},_renderPathCommands:function(e){var t,r=0,n=0,i=0,o=0,a=0,s=0,l=-this.pathOffset.x,c=-this.pathOffset.y;e.beginPath();for(var u=0,d=this.path.length;u<d;++u)switch(t=this.path[u],t[0]){case"L":i=t[1],o=t[2],e.lineTo(i+l,o+c);break;case"M":r=i=t[1],n=o=t[2],e.moveTo(i+l,o+c);break;case"C":i=t[5],o=t[6],a=t[3],s=t[4],e.bezierCurveTo(t[1]+l,t[2]+c,a+l,s+c,i+l,o+c);break;case"Q":e.quadraticCurveTo(t[1]+l,t[2]+c,t[3]+l,t[4]+c),i=t[3],o=t[4],a=t[1],s=t[2];break;case"z":case"Z":i=r,o=n,e.closePath()}},_render:function(e){this._renderPathCommands(e),this._renderPaintInOrder(e)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(e){return i(this.callSuper("toObject",e),{path:this.path.map(function(e){return e.slice()})})},toDatalessObject:function(e){var t=this.toObject(["sourcePath"].concat(e));return t.sourcePath&&delete t.path,t},_toSVG:function(){return["<path ","COMMON_PARTS",'d="',t.util.joinPath(this.path),'" stroke-linecap="round" ',"/>\n"]},_getOffsetTransform:function(){var e=t.Object.NUM_FRACTION_DIGITS;return" translate("+a(-this.pathOffset.x,e)+", "+a(-this.pathOffset.y,e)+")"},toClipPathSVG:function(e){var t=this._getOffsetTransform();return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:e,additionalTransform:t})},toSVG:function(e){var t=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:e,additionalTransform:t})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var e,i,o=[],a=[],s=0,l=0,c=0,u=0,d=0,h=this.path.length;d<h;++d){switch((e=this.path[d])[0]){case"L":c=e[1],u=e[2],i=[];break;case"M":s=c=e[1],l=u=e[2],i=[];break;case"C":i=t.util.getBoundsOfCurve(c,u,e[1],e[2],e[3],e[4],e[5],e[6]),c=e[5],u=e[6];break;case"Q":i=t.util.getBoundsOfCurve(c,u,e[1],e[2],e[1],e[2],e[3],e[4]),c=e[3],u=e[4];break;case"z":case"Z":c=s,u=l}i.forEach(function(e){o.push(e.x),a.push(e.y)}),o.push(c),a.push(u)}var f=r(o)||0,p=r(a)||0;return{left:f,top:p,width:(n(o)||0)-f,height:(n(a)||0)-p}}}),t.Path.fromObject=function(e,r){if("string"==typeof e.sourcePath){var n=e.sourcePath;t.loadSVGFromURL(n,function(n){var i=n[0];i.setOptions(e),e.clipPath?t.util.enlivenObjects([e.clipPath],function(e){i.clipPath=e[0],r&&r(i)}):r&&r(i)})}else t.Object._fromObject("Path",e,r,"path")},t.Path.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(["d"]),t.Path.fromElement=function(e,r,n){var o=t.parseAttributes(e,t.Path.ATTRIBUTE_NAMES);o.fromSVG=!0,r(new t.Path(o.d,i(o,n)))})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.array.min,n=t.util.array.max;t.Group||(t.Group=t.util.createClass(t.Object,t.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(e,t,r){t=t||{},this._objects=[],r&&this.callSuper("initialize",t),this._objects=e||[];for(var n=this._objects.length;n--;)this._objects[n].group=this;if(r)this._updateObjectsACoords();else{var i=t&&t.centerPoint;void 0!==t.originX&&(this.originX=t.originX),void 0!==t.originY&&(this.originY=t.originY),i||this._calcBounds(),this._updateObjectsCoords(i),delete t.centerPoint,this.callSuper("initialize",t)}this.setCoords()},_updateObjectsACoords:function(){for(var e=this._objects.length;e--;)this._objects[e].setCoords(true)},_updateObjectsCoords:function(e){e=e||this.getCenterPoint();for(var t=this._objects.length;t--;)this._updateObjectCoords(this._objects[t],e)},_updateObjectCoords:function(e,t){var r=e.left,n=e.top;e.set({left:r-t.x,top:n-t.y}),e.group=this,e.setCoords(!0)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(e){var r=!!this.group;return this._restoreObjectsState(),t.util.resetObjectTransform(this),e&&(r&&t.util.removeTransformFromObject(e,this.group.calcTransformMatrix()),this._objects.push(e),e.group=this,e._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,r?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(e){return this._restoreObjectsState(),t.util.resetObjectTransform(this),this.remove(e),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(e){this.dirty=!0,e.group=this,e._set("canvas",this.canvas)},_onObjectRemoved:function(e){this.dirty=!0,delete e.group},_set:function(e,r){var n=this._objects.length;if(this.useSetOnGroup)for(;n--;)this._objects[n].setOnGroup(e,r);if("canvas"===e)for(;n--;)this._objects[n]._set(e,r);t.Object.prototype._set.call(this,e,r)},toObject:function(e){var r=this.includeDefaultValues,n=this._objects.filter(function(e){return!e.excludeFromExport}).map(function(t){var n=t.includeDefaultValues;t.includeDefaultValues=r;var i=t.toObject(e);return t.includeDefaultValues=n,i}),i=t.Object.prototype.toObject.call(this,e);return i.objects=n,i},toDatalessObject:function(e){var r,n=this.sourcePath;if(n)r=n;else{var i=this.includeDefaultValues;r=this._objects.map(function(t){var r=t.includeDefaultValues;t.includeDefaultValues=i;var n=t.toDatalessObject(e);return t.includeDefaultValues=r,n})}var o=t.Object.prototype.toDatalessObject.call(this,e);return o.objects=r,o},render:function(e){this._transformDone=!0,this.callSuper("render",e),this._transformDone=!1},shouldCache:function(){var e=t.Object.prototype.shouldCache.call(this);if(e)for(var r=0,n=this._objects.length;r<n;r++)if(this._objects[r].willDrawShadow())return this.ownCaching=!1,!1;return e},willDrawShadow:function(){if(t.Object.prototype.willDrawShadow.call(this))return!0;for(var e=0,r=this._objects.length;e<r;e++)if(this._objects[e].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(e){for(var t=0,r=this._objects.length;t<r;t++)this._objects[t].render(e);this._drawClipPath(e,this.clipPath)},isCacheDirty:function(e){if(this.callSuper("isCacheDirty",e))return!0;if(!this.statefullCache)return!1;for(var t=0,r=this._objects.length;t<r;t++)if(this._objects[t].isCacheDirty(!0)){if(this._cacheCanvas){var n=this.cacheWidth/this.zoomX,i=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-n/2,-i/2,n,i)}return!0}return!1},_restoreObjectsState:function(){var e=this.calcOwnMatrix();return this._objects.forEach(function(r){t.util.addTransformToObject(r,e),delete r.group,r.setCoords()}),this},destroy:function(){return this._objects.forEach(function(e){e.set("dirty",!0)}),this._restoreObjectsState()},dispose:function(){this.callSuper("dispose"),this.forEachObject(function(e){e.dispose&&e.dispose()}),this._objects=[]},toActiveSelection:function(){if(this.canvas){var e=this._objects,r=this.canvas;this._objects=[];var n=this.toObject();delete n.objects;var i=new t.ActiveSelection([]);return i.set(n),i.type="activeSelection",r.remove(this),e.forEach(function(e){e.group=i,e.dirty=!0,r.add(e)}),i.canvas=r,i._objects=e,r._activeObject=i,i.setCoords(),i}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){return this.forEachObject(function(e){e.setCoords(true)}),this},_calcBounds:function(e){for(var t,r,n,i,o=[],a=[],s=["tr","br","bl","tl"],l=0,c=this._objects.length,u=s.length;l<c;++l){for(n=(t=this._objects[l]).calcACoords(),i=0;i<u;i++)r=s[i],o.push(n[r].x),a.push(n[r].y);t.aCoords=n}this._getBounds(o,a,e)},_getBounds:function(e,i,o){var a=new t.Point(r(e),r(i)),s=new t.Point(n(e),n(i)),l=a.y||0,c=a.x||0,u=s.x-a.x||0,d=s.y-a.y||0;this.width=u,this.height=d,o||this.setPositionByOrigin({x:c,y:l},"left","top")},_toSVG:function(e){for(var t=["<g ","COMMON_PARTS"," >\n"],r=0,n=this._objects.length;r<n;r++)t.push("\t\t",this._objects[r].toSVG(e));return t.push("</g>\n"),t},getSvgStyles:function(){var e=typeof this.opacity<"u"&&1!==this.opacity?"opacity: "+this.opacity+";":"",t=this.visible?"":" visibility: hidden;";return[e,this.getSvgFilter(),t].join("")},toClipPathSVG:function(e){for(var t=[],r=0,n=this._objects.length;r<n;r++)t.push("\t",this._objects[r].toClipPathSVG(e));return this._createBaseClipPathSVGMarkup(t,{reviver:e})}}),t.Group.fromObject=function(e,r){var n=e.objects,i=t.util.object.clone(e,!0);delete i.objects,"string"!=typeof n?t.util.enlivenObjects(n,function(n){t.util.enlivenObjectEnlivables(e,i,function(){r&&r(new t.Group(n,i,!0))})}):t.loadSVGFromURL(n,function(o){var a=t.util.groupSVGElements(o,e,n),s=i.clipPath;delete i.clipPath,a.set(i),s?t.util.enlivenObjects([s],function(e){a.clipPath=e[0],r&&r(a)}):r&&r(a)})})}(e),function(e){var t=e.fabric||(e.fabric={});t.ActiveSelection||(t.ActiveSelection=t.util.createClass(t.Group,{type:"activeSelection",initialize:function(e,r){r=r||{},this._objects=e||[];for(var n=this._objects.length;n--;)this._objects[n].group=this;r.originX&&(this.originX=r.originX),r.originY&&(this.originY=r.originY),this._calcBounds(),this._updateObjectsCoords(),t.Object.prototype.initialize.call(this,r),this.setCoords()},toGroup:function(){var e=this._objects.concat();this._objects=[];var r=t.Object.prototype.toObject.call(this),n=new t.Group([]);if(delete r.type,n.set(r),e.forEach(function(e){e.canvas.remove(e),e.group=n}),n._objects=e,!this.canvas)return n;var i=this.canvas;return i.add(n),i._activeObject=n,n.setCoords(),n},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(e,t,r){e.save(),e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",e,t),typeof(r=r||{}).hasControls>"u"&&(r.hasControls=!1),r.forActiveSelection=!0;for(var n=0,i=this._objects.length;n<i;n++)this._objects[n]._renderControls(e,r);e.restore()}}),t.ActiveSelection.fromObject=function(e,r){t.util.enlivenObjects(e.objects,function(n){delete e.objects,r&&r(new t.ActiveSelection(n,e,!0))})})}(e),function(e){var r=t.util.object.extend;e.fabric||(e.fabric={}),e.fabric.Image?t.warn("fabric.Image is already defined."):(t.Image=t.util.createClass(t.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:t.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:t.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(e,r){r||(r={}),this.filters=[],this.cacheKey="texture"+t.Object.__uid++,this.callSuper("initialize",r),this._initElement(e,r)},getElement:function(){return this._element||{}},setElement:function(e,t){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=e,this._originalElement=e,this._initConfig(t),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(e){var r=t.filterBackend;r&&r.evictCachesForKey&&r.evictCachesForKey(e)},dispose:function(){this.callSuper("dispose"),this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(e){t.util.cleanUpJsdomNode(this[e]),this[e]=void 0}.bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var e=this.getElement();return{width:e.naturalWidth||e.width,height:e.naturalHeight||e.height}},_stroke:function(e){if(this.stroke&&0!==this.strokeWidth){var t=this.width/2,r=this.height/2;e.beginPath(),e.moveTo(-t,-r),e.lineTo(t,-r),e.lineTo(t,r),e.lineTo(-t,r),e.lineTo(-t,-r),e.closePath()}},toObject:function(e){var t=[];this.filters.forEach(function(e){e&&t.push(e.toObject())});var n=r(this.callSuper("toObject",["cropX","cropY"].concat(e)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:t});return this.resizeFilter&&(n.resizeFilter=this.resizeFilter.toObject()),n},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var e,r=[],n=[],i=this._element,o=-this.width/2,a=-this.height/2,s="",l="";if(!i)return[];if(this.hasCrop()){var c=t.Object.__uid++;r.push('<clipPath id="imageCrop_'+c+'">\n','\t<rect x="'+o+'" y="'+a+'" width="'+this.width+'" height="'+this.height+'" />\n',"</clipPath>\n"),s=' clip-path="url(#imageCrop_'+c+')" '}if(this.imageSmoothing||(l='" image-rendering="optimizeSpeed'),n.push("\t<image ","COMMON_PARTS",'xlink:href="',this.getSvgSrc(!0),'" x="',o-this.cropX,'" y="',a-this.cropY,'" width="',i.width||i.naturalWidth,'" height="',i.height||i.height,l,'"',s,"></image>\n"),this.stroke||this.strokeDashArray){var u=this.fill;this.fill=null,e=["\t<rect ",'x="',o,'" y="',a,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'],this.fill=u}return r="fill"!==this.paintFirst?r.concat(e,n):r.concat(n,e)},getSrc:function(e){var t=e?this._element:this._originalElement;return t?t.toDataURL?t.toDataURL():this.srcFromAttribute?t.getAttribute("src"):t.src:this.src||""},setSrc:function(e,r,n){return t.util.loadImage(e,function(e,t){this.setElement(e,n),this._setWidthHeight(),r&&r(this,t)},this,n&&n.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var e=this.resizeFilter,r=this.minimumScaleTrigger,n=this.getTotalObjectScaling(),i=n.scaleX,o=n.scaleY,a=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!e||i>r&&o>r)return this._element=a,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=i,void(this._lastScaleY=o);t.filterBackend||(t.filterBackend=t.initFilterBackend());var s=t.util.createCanvasElement(),l=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,c=a.width,u=a.height;s.width=c,s.height=u,this._element=s,this._lastScaleX=e.scaleX=i,this._lastScaleY=e.scaleY=o,t.filterBackend.applyFilters([e],a,c,u,this._element,l),this._filterScalingX=s.width/this._originalElement.width,this._filterScalingY=s.height/this._originalElement.height},applyFilters:function(e){if(e=(e=e||this.filters||[]).filter(function(e){return e&&!e.isNeutralState()}),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),0===e.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var r=this._originalElement,n=r.naturalWidth||r.width,i=r.naturalHeight||r.height;if(this._element===this._originalElement){var o=t.util.createCanvasElement();o.width=n,o.height=i,this._element=o,this._filteredEl=o}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,n,i),this._lastScaleX=1,this._lastScaleY=1;return t.filterBackend||(t.filterBackend=t.initFilterBackend()),t.filterBackend.applyFilters(e,this._originalElement,n,i,this._element,this.cacheKey),(this._originalElement.width!==this._element.width||this._originalElement.height!==this._element.height)&&(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(e){t.util.setImageSmoothing(e,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(e),this._renderPaintInOrder(e)},drawCacheOnCanvas:function(e){t.util.setImageSmoothing(e,this.imageSmoothing),t.Object.prototype.drawCacheOnCanvas.call(this,e)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(e){var t=this._element;if(t){var r=this._filterScalingX,n=this._filterScalingY,i=this.width,o=this.height,a=Math.min,s=Math.max,l=s(this.cropX,0),c=s(this.cropY,0),u=t.naturalWidth||t.width,d=t.naturalHeight||t.height,h=l*r,f=c*n,p=a(i*r,u-h),g=a(o*n,d-f),m=-i/2,v=-o/2,y=a(i,u/r-l),b=a(o,d/n-c);t&&e.drawImage(t,h,f,p,g,m,v,y,b)}},_needsResize:function(){var e=this.getTotalObjectScaling();return e.scaleX!==this._lastScaleX||e.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(e,r){this.setElement(t.util.getById(e),r),t.util.addClass(this.getElement(),t.Image.CSS_CANVAS)},_initConfig:function(e){e||(e={}),this.setOptions(e),this._setWidthHeight(e)},_initFilters:function(e,r){e&&e.length?t.util.enlivenObjects(e,function(e){r&&r(e)},"fabric.Image.filters"):r&&r()},_setWidthHeight:function(e){e||(e={});var t=this.getElement();this.width=e.width||t.naturalWidth||t.width||0,this.height=e.height||t.naturalHeight||t.height||0},parsePreserveAspectRatioAttribute:function(){var e,r=t.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),n=this._element.width,i=this._element.height,o=1,a=1,s=0,l=0,c=0,u=0,d=this.width,h=this.height,f={width:d,height:h};return!r||"none"===r.alignX&&"none"===r.alignY?(o=d/n,a=h/i):("meet"===r.meetOrSlice&&(e=(d-n*(o=a=t.util.findScaleToFit(this._element,f)))/2,"Min"===r.alignX&&(s=-e),"Max"===r.alignX&&(s=e),e=(h-i*a)/2,"Min"===r.alignY&&(l=-e),"Max"===r.alignY&&(l=e)),"slice"===r.meetOrSlice&&(e=n-d/(o=a=t.util.findScaleToCover(this._element,f)),"Mid"===r.alignX&&(c=e/2),"Max"===r.alignX&&(c=e),e=i-h/a,"Mid"===r.alignY&&(u=e/2),"Max"===r.alignY&&(u=e),n=d/o,i=h/a)),{width:n,height:i,scaleX:o,scaleY:a,offsetLeft:s,offsetTop:l,cropX:c,cropY:u}}}),t.Image.CSS_CANVAS="canvas-img",t.Image.prototype.getSvgSrc=t.Image.prototype.getSrc,t.Image.fromObject=function(e,r){var n=t.util.object.clone(e);t.util.loadImage(n.src,function(e,i){i?r&&r(null,!0):t.Image.prototype._initFilters.call(n,n.filters,function(i){n.filters=i||[],t.Image.prototype._initFilters.call(n,[n.resizeFilter],function(i){n.resizeFilter=i[0],t.util.enlivenObjectEnlivables(n,n,function(){var i=new t.Image(e,n);r(i,!1)})})})},null,n.crossOrigin)},t.Image.fromURL=function(e,r,n){t.util.loadImage(e,function(e,i){r&&r(new t.Image(e,n),i)},null,n&&n.crossOrigin)},t.Image.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),t.Image.fromElement=function(e,n,i){var o=t.parseAttributes(e,t.Image.ATTRIBUTE_NAMES);t.Image.fromURL(o["xlink:href"],n,r(i?t.util.object.clone(i):{},o))})}(e),t.util.object.extend(t.Object.prototype,{_getAngleValueForStraighten:function(){var e=this.angle%360;return e>0?90*Math.round((e-1)/90):90*Math.round(e/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten())},fxStraighten:function(e){var r=function(){},n=(e=e||{}).onComplete||r,i=e.onChange||r,o=this;return t.util.animate({target:this,startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(e){o.rotate(e),i()},onComplete:function(){o.setCoords(),n()}})}}),t.util.object.extend(t.StaticCanvas.prototype,{straightenObject:function(e){return e.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(e){return e.fxStraighten({onChange:this.requestRenderAllBound})}}),function(){function e(e,t){var r="precision "+t+" float;\nvoid main(){}",n=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(n,r),e.compileShader(n),!!e.getShaderParameter(n,e.COMPILE_STATUS)}function r(e){e&&e.tileSize&&(this.tileSize=e.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}t.isWebglSupported=function(r){if(t.isLikelyNode)return!1;r=r||t.WebglFilterBackend.prototype.tileSize;var n=document.createElement("canvas"),i=n.getContext("webgl")||n.getContext("experimental-webgl"),o=!1;if(i){t.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),o=t.maxTextureSize>=r;for(var a=["highp","mediump","lowp"],s=0;s<3;s++)if(e(i,a[s])){t.webGlPrecision=a[s];break}}return this.isSupported=o,o},t.WebglFilterBackend=r,r.prototype={tileSize:2048,resources:{},setupGLContext:function(e,t){this.dispose(),this.createWebGLCanvas(e,t),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(e,t)},chooseFastestCopyGLTo2DMethod:function(e,r){var o,a=typeof window.performance<"u";try{new ImageData(1,1),o=!0}catch{o=!1}var s=typeof ArrayBuffer<"u",l=typeof Uint8ClampedArray<"u";if(a&&o&&s&&l){var c=t.util.createCanvasElement(),u=new ArrayBuffer(e*r*4);if(t.forceGLPutImageData)return this.imageBuffer=u,void(this.copyGLTo2D=i);var d,h,f={imageBuffer:u,destinationWidth:e,destinationHeight:r,targetCanvas:c};c.width=e,c.height=r,d=window.performance.now(),n.call(f,this.gl,f),h=window.performance.now()-d,d=window.performance.now(),i.call(f,this.gl,f),h>window.performance.now()-d?(this.imageBuffer=u,this.copyGLTo2D=i):this.copyGLTo2D=n}},createWebGLCanvas:function(e,r){var n=t.util.createCanvasElement();n.width=e,n.height=r;var i={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},o=n.getContext("webgl",i);o||(o=n.getContext("experimental-webgl",i)),o&&(o.clearColor(0,0,0,0),this.canvas=n,this.gl=o)},applyFilters:function(e,t,r,n,i,o){var a,s=this.gl;o&&(a=this.getCachedTexture(o,t));var l={originalWidth:t.width||t.originalWidth,originalHeight:t.height||t.originalHeight,sourceWidth:r,sourceHeight:n,destinationWidth:r,destinationHeight:n,context:s,sourceTexture:this.createTexture(s,r,n,!a&&t),targetTexture:this.createTexture(s,r,n),originalTexture:a||this.createTexture(s,r,n,!a&&t),passes:e.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:i},c=s.createFramebuffer();return s.bindFramebuffer(s.FRAMEBUFFER,c),e.forEach(function(e){e&&e.applyTo(l)}),function(e){var t=e.targetCanvas,r=t.width,n=t.height,i=e.destinationWidth,o=e.destinationHeight;(r!==i||n!==o)&&(t.width=i,t.height=o)}(l),this.copyGLTo2D(s,l),s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(l.sourceTexture),s.deleteTexture(l.targetTexture),s.deleteFramebuffer(c),i.getContext("2d").setTransform(1,0,0,1,0,0),l},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(e,t,r,n,i){var o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,i||e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,i||e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null),o},getCachedTexture:function(e,t){if(this.textureCache[e])return this.textureCache[e];var r=this.createTexture(this.gl,t.width,t.height,t);return this.textureCache[e]=r,r},evictCachesForKey:function(e){this.textureCache[e]&&(this.gl.deleteTexture(this.textureCache[e]),delete this.textureCache[e])},copyGLTo2D:n,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var e=this.gl,t={renderer:"",vendor:""};if(!e)return t;var r=e.getExtension("WEBGL_debug_renderer_info");if(r){var n=e.getParameter(r.UNMASKED_RENDERER_WEBGL),i=e.getParameter(r.UNMASKED_VENDOR_WEBGL);n&&(t.renderer=n.toLowerCase()),i&&(t.vendor=i.toLowerCase())}return this.gpuInfo=t,t}}}(),function(){var e=function(){};function r(){}t.Canvas2dFilterBackend=r,r.prototype={evictCachesForKey:e,dispose:e,clearWebGLCaches:e,resources:{},applyFilters:function(e,t,r,n,i){var o=i.getContext("2d");o.drawImage(t,0,0,r,n);var a={sourceWidth:r,sourceHeight:n,imageData:o.getImageData(0,0,r,n),originalEl:t,originalImageData:o.getImageData(0,0,r,n),canvasEl:i,ctx:o,filterBackend:this};return e.forEach(function(e){e.applyTo(a)}),(a.imageData.width!==r||a.imageData.height!==n)&&(i.width=a.imageData.width,i.height=a.imageData.height),o.putImageData(a.imageData,0,0),a}}}(),t.Image=t.Image||{},t.Image.filters=t.Image.filters||{},t.Image.filters.BaseFilter=t.util.createClass({type:"BaseFilter",vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvoid main() {\nvTexCoord = aPosition;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D uTexture;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\n}",initialize:function(e){e&&this.setOptions(e)},setOptions:function(e){for(var t in e)this[t]=e[t]},createProgram:function(e,r,n){r=r||this.fragmentSource,n=n||this.vertexSource,"highp"!==t.webGlPrecision&&(r=r.replace(/precision highp float/g,"precision "+t.webGlPrecision+" float"));var i=e.createShader(e.VERTEX_SHADER);if(e.shaderSource(i,n),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+e.getShaderInfoLog(i));var o=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(o,r),e.compileShader(o),!e.getShaderParameter(o,e.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+e.getShaderInfoLog(o));var a=e.createProgram();if(e.attachShader(a,i),e.attachShader(a,o),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+e.getProgramInfoLog(a));var s=this.getAttributeLocations(e,a),l=this.getUniformLocations(e,a)||{};return l.uStepW=e.getUniformLocation(a,"uStepW"),l.uStepH=e.getUniformLocation(a,"uStepH"),{program:a,attributeLocations:s,uniformLocations:l}},getAttributeLocations:function(e,t){return{aPosition:e.getAttribLocation(t,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(e,t,r){var n=t.aPosition,i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW)},_setupFrameBuffer:function(e){var t,r,n=e.context;e.passes>1?(t=e.destinationWidth,r=e.destinationHeight,(e.sourceWidth!==t||e.sourceHeight!==r)&&(n.deleteTexture(e.targetTexture),e.targetTexture=e.filterBackend.createTexture(n,t,r)),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e.targetTexture,0)):(n.bindFramebuffer(n.FRAMEBUFFER,null),n.finish())},_swapTextures:function(e){e.passes--,e.pass++;var t=e.targetTexture;e.targetTexture=e.sourceTexture,e.sourceTexture=t},isNeutralState:function(){var e=this.mainParameter,r=t.Image.filters[this.type].prototype;if(e){if(Array.isArray(r[e])){for(var n=r[e].length;n--;)if(this[e][n]!==r[e][n])return!1;return!0}return r[e]===this[e]}return!1},applyTo:function(e){e.webgl?(this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e)):this.applyTo2d(e)},retrieveShader:function(e){return e.programCache.hasOwnProperty(this.type)||(e.programCache[this.type]=this.createProgram(e.context)),e.programCache[this.type]},applyToWebGL:function(e){var t=e.context,r=this.retrieveShader(e);0===e.pass&&e.originalTexture?t.bindTexture(t.TEXTURE_2D,e.originalTexture):t.bindTexture(t.TEXTURE_2D,e.sourceTexture),t.useProgram(r.program),this.sendAttributeData(t,r.attributeLocations,e.aPosition),t.uniform1f(r.uniformLocations.uStepW,1/e.sourceWidth),t.uniform1f(r.uniformLocations.uStepH,1/e.sourceHeight),this.sendUniformData(t,r.uniformLocations),t.viewport(0,0,e.destinationWidth,e.destinationHeight),t.drawArrays(t.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(e,t,r){e.activeTexture(r),e.bindTexture(e.TEXTURE_2D,t),e.activeTexture(e.TEXTURE0)},unbindAdditionalTexture:function(e,t){e.activeTexture(t),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(e){this[this.mainParameter]=e},sendUniformData:function(){},createHelpLayer:function(e){if(!e.helpLayer){var t=document.createElement("canvas");t.width=e.sourceWidth,t.height=e.sourceHeight,e.helpLayer=t}},toObject:function(){var e={type:this.type},t=this.mainParameter;return t&&(e[t]=this[t]),e},toJSON:function(){return this.toObject()}}),t.Image.filters.BaseFilter.fromObject=function(e,r){var n=new t.Image.filters[e.type](e);return r&&r(n),n},function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.ColorMatrix=n(r.BaseFilter,{type:"ColorMatrix",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform mat4 uColorMatrix;\nuniform vec4 uConstants;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor *= uColorMatrix;\ncolor += uConstants;\ngl_FragColor = color;\n}",matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(e){this.callSuper("initialize",e),this.matrix=this.matrix.slice(0)},applyTo2d:function(e){var t,r,n,i,o,a=e.imageData.data,s=a.length,l=this.matrix,c=this.colorsOnly;for(o=0;o<s;o+=4)t=a[o],r=a[o+1],n=a[o+2],c?(a[o]=t*l[0]+r*l[1]+n*l[2]+255*l[4],a[o+1]=t*l[5]+r*l[6]+n*l[7]+255*l[9],a[o+2]=t*l[10]+r*l[11]+n*l[12]+255*l[14]):(i=a[o+3],a[o]=t*l[0]+r*l[1]+n*l[2]+i*l[3]+255*l[4],a[o+1]=t*l[5]+r*l[6]+n*l[7]+i*l[8]+255*l[9],a[o+2]=t*l[10]+r*l[11]+n*l[12]+i*l[13]+255*l[14],a[o+3]=t*l[15]+r*l[16]+n*l[17]+i*l[18]+255*l[19])},getUniformLocations:function(e,t){return{uColorMatrix:e.getUniformLocation(t,"uColorMatrix"),uConstants:e.getUniformLocation(t,"uConstants")}},sendUniformData:function(e,t){var r=this.matrix,n=[r[0],r[1],r[2],r[3],r[5],r[6],r[7],r[8],r[10],r[11],r[12],r[13],r[15],r[16],r[17],r[18]],i=[r[4],r[9],r[14],r[19]];e.uniformMatrix4fv(t.uColorMatrix,!1,n),e.uniform4fv(t.uConstants,i)}}),t.Image.filters.ColorMatrix.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Brightness=n(r.BaseFilter,{type:"Brightness",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBrightness;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += uBrightness;\ngl_FragColor = color;\n}",brightness:0,mainParameter:"brightness",applyTo2d:function(e){if(0!==this.brightness){var t,r=e.imageData.data,n=r.length,i=Math.round(255*this.brightness);for(t=0;t<n;t+=4)r[t]=r[t]+i,r[t+1]=r[t+1]+i,r[t+2]=r[t+2]+i}},getUniformLocations:function(e,t){return{uBrightness:e.getUniformLocation(t,"uBrightness")}},sendUniformData:function(e,t){e.uniform1f(t.uBrightness,this.brightness)}}),t.Image.filters.Brightness.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.Image.filters,i=t.util.createClass;n.Convolute=i(n.BaseFilter,{type:"Convolute",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_3_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_5_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_5_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_7_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_7_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_9_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_9_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}"},retrieveShader:function(e){var t=Math.sqrt(this.matrix.length),r=this.type+"_"+t+"_"+(this.opaque?1:0),n=this.fragmentSource[r];return e.programCache.hasOwnProperty(r)||(e.programCache[r]=this.createProgram(e.context,n)),e.programCache[r]},applyTo2d:function(e){var t,r,n,i,o,a,s,l,c,u,d,h,f,p=e.imageData,g=p.data,m=this.matrix,v=Math.round(Math.sqrt(m.length)),y=Math.floor(v/2),b=p.width,w=p.height,x=e.ctx.createImageData(b,w),C=x.data,_=this.opaque?1:0;for(d=0;d<w;d++)for(u=0;u<b;u++){for(o=4*(d*b+u),t=0,r=0,n=0,i=0,f=0;f<v;f++)for(h=0;h<v;h++)a=u+h-y,!((s=d+f-y)<0||s>=w||a<0||a>=b)&&(l=4*(s*b+a),c=m[f*v+h],t+=g[l]*c,r+=g[l+1]*c,n+=g[l+2]*c,_||(i+=g[l+3]*c));C[o]=t,C[o+1]=r,C[o+2]=n,C[o+3]=_?g[o+3]:i}e.imageData=x},getUniformLocations:function(e,t){return{uMatrix:e.getUniformLocation(t,"uMatrix"),uOpaque:e.getUniformLocation(t,"uOpaque"),uHalfSize:e.getUniformLocation(t,"uHalfSize"),uSize:e.getUniformLocation(t,"uSize")}},sendUniformData:function(e,t){e.uniform1fv(t.uMatrix,this.matrix)},toObject:function(){return r(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),t.Image.filters.Convolute.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Grayscale=n(r.BaseFilter,{type:"Grayscale",fragmentSource:{average:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat average = (color.r + color.b + color.g) / 3.0;\ngl_FragColor = vec4(average, average, average, color.a);\n}",lightness:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\ngl_FragColor = vec4(average, average, average, col.a);\n}",luminosity:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\ngl_FragColor = vec4(average, average, average, col.a);\n}"},mode:"average",mainParameter:"mode",applyTo2d:function(e){var t,r,n=e.imageData.data,i=n.length,o=this.mode;for(t=0;t<i;t+=4)"average"===o?r=(n[t]+n[t+1]+n[t+2])/3:"lightness"===o?r=(Math.min(n[t],n[t+1],n[t+2])+Math.max(n[t],n[t+1],n[t+2]))/2:"luminosity"===o&&(r=.21*n[t]+.72*n[t+1]+.07*n[t+2]),n[t]=r,n[t+1]=r,n[t+2]=r},retrieveShader:function(e){var t=this.type+"_"+this.mode;if(!e.programCache.hasOwnProperty(t)){var r=this.fragmentSource[this.mode];e.programCache[t]=this.createProgram(e.context,r)}return e.programCache[t]},getUniformLocations:function(e,t){return{uMode:e.getUniformLocation(t,"uMode")}},sendUniformData:function(e,t){e.uniform1i(t.uMode,1)},isNeutralState:function(){return!1}}),t.Image.filters.Grayscale.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Invert=n(r.BaseFilter,{type:"Invert",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uInvert;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nif (uInvert == 1) {\ngl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);\n} else {\ngl_FragColor = color;\n}\n}",invert:!0,mainParameter:"invert",applyTo2d:function(e){var t,r=e.imageData.data,n=r.length;for(t=0;t<n;t+=4)r[t]=255-r[t],r[t+1]=255-r[t+1],r[t+2]=255-r[t+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(e,t){return{uInvert:e.getUniformLocation(t,"uInvert")}},sendUniformData:function(e,t){e.uniform1i(t.uInvert,this.invert)}}),t.Image.filters.Invert.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.Image.filters,i=t.util.createClass;n.Noise=i(n.BaseFilter,{type:"Noise",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uStepH;\nuniform float uNoise;\nuniform float uSeed;\nvarying vec2 vTexCoord;\nfloat rand(vec2 co, float seed, float vScale) {\nreturn fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\n}\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\ngl_FragColor = color;\n}",mainParameter:"noise",noise:0,applyTo2d:function(e){if(0!==this.noise){var t,r,n=e.imageData.data,i=n.length,o=this.noise;for(t=0,i=n.length;t<i;t+=4)r=(.5-Math.random())*o,n[t]+=r,n[t+1]+=r,n[t+2]+=r}},getUniformLocations:function(e,t){return{uNoise:e.getUniformLocation(t,"uNoise"),uSeed:e.getUniformLocation(t,"uSeed")}},sendUniformData:function(e,t){e.uniform1f(t.uNoise,this.noise/255),e.uniform1f(t.uSeed,Math.random())},toObject:function(){return r(this.callSuper("toObject"),{noise:this.noise})}}),t.Image.filters.Noise.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Pixelate=n(r.BaseFilter,{type:"Pixelate",blocksize:4,mainParameter:"blocksize",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBlocksize;\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nfloat blockW = uBlocksize * uStepW;\nfloat blockH = uBlocksize * uStepW;\nint posX = int(vTexCoord.x / blockW);\nint posY = int(vTexCoord.y / blockH);\nfloat fposX = float(posX);\nfloat fposY = float(posY);\nvec2 squareCoords = vec2(fposX * blockW, fposY * blockH);\nvec4 color = texture2D(uTexture, squareCoords);\ngl_FragColor = color;\n}",applyTo2d:function(e){var t,r,n,i,o,a,s,l,c,u,d,h=e.imageData,f=h.data,p=h.height,g=h.width;for(r=0;r<p;r+=this.blocksize)for(n=0;n<g;n+=this.blocksize)for(i=f[t=4*r*g+4*n],o=f[t+1],a=f[t+2],s=f[t+3],u=Math.min(r+this.blocksize,p),d=Math.min(n+this.blocksize,g),l=r;l<u;l++)for(c=n;c<d;c++)f[t=4*l*g+4*c]=i,f[t+1]=o,f[t+2]=a,f[t+3]=s},isNeutralState:function(){return 1===this.blocksize},getUniformLocations:function(e,t){return{uBlocksize:e.getUniformLocation(t,"uBlocksize"),uStepW:e.getUniformLocation(t,"uStepW"),uStepH:e.getUniformLocation(t,"uStepH")}},sendUniformData:function(e,t){e.uniform1f(t.uBlocksize,this.blocksize)}}),t.Image.filters.Pixelate.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.Image.filters,i=t.util.createClass;n.RemoveColor=i(n.BaseFilter,{type:"RemoveColor",color:"#FFFFFF",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\nif(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\ngl_FragColor.a = 0.0;\n}\n}",distance:.02,useAlpha:!1,applyTo2d:function(e){var r,n,i,o,a=e.imageData.data,s=255*this.distance,l=new t.Color(this.color).getSource(),c=[l[0]-s,l[1]-s,l[2]-s],u=[l[0]+s,l[1]+s,l[2]+s];for(r=0;r<a.length;r+=4)n=a[r],i=a[r+1],o=a[r+2],n>c[0]&&i>c[1]&&o>c[2]&&n<u[0]&&i<u[1]&&o<u[2]&&(a[r+3]=0)},getUniformLocations:function(e,t){return{uLow:e.getUniformLocation(t,"uLow"),uHigh:e.getUniformLocation(t,"uHigh")}},sendUniformData:function(e,r){var n=new t.Color(this.color).getSource(),i=parseFloat(this.distance),o=[0+n[0]/255-i,0+n[1]/255-i,0+n[2]/255-i,1],a=[n[0]/255+i,n[1]/255+i,n[2]/255+i,1];e.uniform4fv(r.uLow,o),e.uniform4fv(r.uHigh,a)},toObject:function(){return r(this.callSuper("toObject"),{color:this.color,distance:this.distance})}}),t.Image.filters.RemoveColor.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass,i={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(var o in i)r[o]=n(r.ColorMatrix,{type:o,matrix:i[o],mainParameter:!1,colorsOnly:!0}),t.Image.filters[o].fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric,r=t.Image.filters,n=t.util.createClass;r.BlendColor=n(r.BaseFilter,{type:"BlendColor",color:"#F95C63",mode:"multiply",alpha:1,fragmentSource:{multiply:"gl_FragColor.rgb *= uColor.rgb;\n",screen:"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n",add:"gl_FragColor.rgb += uColor.rgb;\n",diff:"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n",subtract:"gl_FragColor.rgb -= uColor.rgb;\n",lighten:"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n",darken:"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n",exclusion:"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n",overlay:"if (uColor.r < 0.5) {\ngl_FragColor.r *= 2.0 * uColor.r;\n} else {\ngl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n}\nif (uColor.g < 0.5) {\ngl_FragColor.g *= 2.0 * uColor.g;\n} else {\ngl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n}\nif (uColor.b < 0.5) {\ngl_FragColor.b *= 2.0 * uColor.b;\n} else {\ngl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n}\n",tint:"gl_FragColor.rgb *= (1.0 - uColor.a);\ngl_FragColor.rgb += uColor.rgb;\n"},buildSource:function(e){return"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ngl_FragColor = color;\nif (color.a > 0.0) {\n"+this.fragmentSource[e]+"}\n}"},retrieveShader:function(e){var t,r=this.type+"_"+this.mode;return e.programCache.hasOwnProperty(r)||(t=this.buildSource(this.mode),e.programCache[r]=this.createProgram(e.context,t)),e.programCache[r]},applyTo2d:function(e){var r,n,i,o,a,s,l,c=e.imageData.data,u=c.length,d=1-this.alpha;r=(l=new t.Color(this.color).getSource())[0]*this.alpha,n=l[1]*this.alpha,i=l[2]*this.alpha;for(var h=0;h<u;h+=4)switch(o=c[h],a=c[h+1],s=c[h+2],this.mode){case"multiply":c[h]=o*r/255,c[h+1]=a*n/255,c[h+2]=s*i/255;break;case"screen":c[h]=255-(255-o)*(255-r)/255,c[h+1]=255-(255-a)*(255-n)/255,c[h+2]=255-(255-s)*(255-i)/255;break;case"add":c[h]=o+r,c[h+1]=a+n,c[h+2]=s+i;break;case"diff":case"difference":c[h]=Math.abs(o-r),c[h+1]=Math.abs(a-n),c[h+2]=Math.abs(s-i);break;case"subtract":c[h]=o-r,c[h+1]=a-n,c[h+2]=s-i;break;case"darken":c[h]=Math.min(o,r),c[h+1]=Math.min(a,n),c[h+2]=Math.min(s,i);break;case"lighten":c[h]=Math.max(o,r),c[h+1]=Math.max(a,n),c[h+2]=Math.max(s,i);break;case"overlay":c[h]=r<128?2*o*r/255:255-2*(255-o)*(255-r)/255,c[h+1]=n<128?2*a*n/255:255-2*(255-a)*(255-n)/255,c[h+2]=i<128?2*s*i/255:255-2*(255-s)*(255-i)/255;break;case"exclusion":c[h]=r+o-2*r*o/255,c[h+1]=n+a-2*n*a/255,c[h+2]=i+s-2*i*s/255;break;case"tint":c[h]=r+o*d,c[h+1]=n+a*d,c[h+2]=i+s*d}},getUniformLocations:function(e,t){return{uColor:e.getUniformLocation(t,"uColor")}},sendUniformData:function(e,r){var n=new t.Color(this.color).getSource();n[0]=this.alpha*n[0]/255,n[1]=this.alpha*n[1]/255,n[2]=this.alpha*n[2]/255,n[3]=this.alpha,e.uniform4fv(r.uColor,n)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),t.Image.filters.BlendColor.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric,r=t.Image.filters,n=t.util.createClass;r.BlendImage=n(r.BaseFilter,{type:"BlendImage",image:null,mode:"multiply",alpha:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:{multiply:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.rgba *= color2.rgba;\ngl_FragColor = color;\n}",mask:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.a = color2.a;\ngl_FragColor = color;\n}"},retrieveShader:function(e){var t=this.type+"_"+this.mode,r=this.fragmentSource[this.mode];return e.programCache.hasOwnProperty(t)||(e.programCache[t]=this.createProgram(e.context,r)),e.programCache[t]},applyToWebGL:function(e){var t=e.context,r=this.createTexture(e.filterBackend,this.image);this.bindAdditionalTexture(t,r,t.TEXTURE1),this.callSuper("applyToWebGL",e),this.unbindAdditionalTexture(t,t.TEXTURE1)},createTexture:function(e,t){return e.getCachedTexture(t.cacheKey,t._element)},calculateMatrix:function(){var e=this.image,t=e._element.width,r=e._element.height;return[1/e.scaleX,0,0,0,1/e.scaleY,0,-e.left/t,-e.top/r,1]},applyTo2d:function(e){var r,n,i,o,a,s,l,c,u,d,h,f=e.imageData,p=e.filterBackend.resources,g=f.data,m=g.length,v=f.width,y=f.height,b=this.image;p.blendImage||(p.blendImage=t.util.createCanvasElement()),d=(u=p.blendImage).getContext("2d"),u.width!==v||u.height!==y?(u.width=v,u.height=y):d.clearRect(0,0,v,y),d.setTransform(b.scaleX,0,0,b.scaleY,b.left,b.top),d.drawImage(b._element,0,0,v,y),h=d.getImageData(0,0,v,y).data;for(var w=0;w<m;w+=4)switch(a=g[w],s=g[w+1],l=g[w+2],c=g[w+3],r=h[w],n=h[w+1],i=h[w+2],o=h[w+3],this.mode){case"multiply":g[w]=a*r/255,g[w+1]=s*n/255,g[w+2]=l*i/255,g[w+3]=c*o/255;break;case"mask":g[w+3]=o}},getUniformLocations:function(e,t){return{uTransformMatrix:e.getUniformLocation(t,"uTransformMatrix"),uImage:e.getUniformLocation(t,"uImage")}},sendUniformData:function(e,t){var r=this.calculateMatrix();e.uniform1i(t.uImage,1),e.uniformMatrix3fv(t.uTransformMatrix,!1,r)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),t.Image.filters.BlendImage.fromObject=function(e,r){t.Image.fromObject(e.image,function(n){var i=t.util.object.clone(e);i.image=n,r(new t.Image.filters.BlendImage(i))})}}(e),function(e){var t=e.fabric||(e.fabric={}),r=Math.pow,n=Math.floor,i=Math.sqrt,o=Math.abs,a=Math.round,s=Math.sin,l=Math.ceil,c=t.Image.filters,u=t.util.createClass;c.Resize=u(c.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(e,t){return{uDelta:e.getUniformLocation(t,"uDelta"),uTaps:e.getUniformLocation(t,"uTaps")}},sendUniformData:function(e,t){e.uniform2fv(t.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),e.uniform1fv(t.uTaps,this.taps)},retrieveShader:function(e){var t=this.getFilterWindow(),r=this.type+"_"+t;if(!e.programCache.hasOwnProperty(r)){var n=this.generateShader(t);e.programCache[r]=this.createProgram(e.context,n)}return e.programCache[r]},getFilterWindow:function(){var e=this.tempScale;return Math.ceil(this.lanczosLobes/e)},getTaps:function(){for(var e=this.lanczosCreate(this.lanczosLobes),t=this.tempScale,r=this.getFilterWindow(),n=new Array(r),i=1;i<=r;i++)n[i-1]=e(i*t);return n},generateShader:function(e){for(var t=new Array(e),r=this.fragmentSourceTOP,n=1;n<=e;n++)t[n-1]=n+".0 * uDelta";return r+="uniform float uTaps["+e+"];\n",r+="void main() {\n",r+=" vec4 color = texture2D(uTexture, vTexCoord);\n",r+=" float sum = 1.0;\n",t.forEach(function(e,t){r+=" color += texture2D(uTexture, vTexCoord + "+e+") * uTaps["+t+"];\n",r+=" color += texture2D(uTexture, vTexCoord - "+e+") * uTaps["+t+"];\n",r+=" sum += 2.0 * uTaps["+t+"];\n"}),r+=" gl_FragColor = color / sum;\n",r+="}"},fragmentSourceTOP:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\n",applyTo:function(e){e.webgl?(e.passes++,this.width=e.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=e.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),e.destinationWidth=this.dW,this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e),e.sourceWidth=e.destinationWidth,this.height=e.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),e.destinationHeight=this.dH,this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e),e.sourceHeight=e.destinationHeight):this.applyTo2d(e)},isNeutralState:function(){return 1===this.scaleX&&1===this.scaleY},lanczosCreate:function(e){return function(t){if(t>=e||t<=-e)return 0;if(t<1.1920929e-7&&t>-1.1920929e-7)return 1;var r=(t*=Math.PI)/e;return s(t)/t*s(r)/r}},applyTo2d:function(e){var t=e.imageData,r=this.scaleX,n=this.scaleY;this.rcpScaleX=1/r,this.rcpScaleY=1/n;var i,o=t.width,s=t.height,l=a(o*r),c=a(s*n);"sliceHack"===this.resizeType?i=this.sliceByTwo(e,o,s,l,c):"hermite"===this.resizeType?i=this.hermiteFastResize(e,o,s,l,c):"bilinear"===this.resizeType?i=this.bilinearFiltering(e,o,s,l,c):"lanczos"===this.resizeType&&(i=this.lanczosResize(e,o,s,l,c)),e.imageData=i},sliceByTwo:function(e,r,i,o,a){var s,l,c=e.imageData,u=.5,d=!1,h=!1,f=r*u,p=i*u,g=t.filterBackend.resources,m=0,v=0,y=r,b=0;for(g.sliceByTwo||(g.sliceByTwo=document.createElement("canvas")),((s=g.sliceByTwo).width<1.5*r||s.height<i)&&(s.width=1.5*r,s.height=i),(l=s.getContext("2d")).clearRect(0,0,1.5*r,i),l.putImageData(c,0,0),o=n(o),a=n(a);!d||!h;)r=f,i=p,o<n(f*u)?f=n(f*u):(f=o,d=!0),a<n(p*u)?p=n(p*u):(p=a,h=!0),l.drawImage(s,m,v,r,i,y,b,f,p),m=y,v=b,b+=p;return l.getImageData(m,v,o,a)},lanczosResize:function(e,t,a,s,c){var u=e.imageData.data,d=e.ctx.createImageData(s,c),h=d.data,f=this.lanczosCreate(this.lanczosLobes),p=this.rcpScaleX,g=this.rcpScaleY,m=2/this.rcpScaleX,v=2/this.rcpScaleY,y=l(p*this.lanczosLobes/2),b=l(g*this.lanczosLobes/2),w={},x={},C={};return function e(l){var _,S,A,k,E,I,T,F,O,P,M;for(x.x=(l+.5)*p,C.x=n(x.x),_=0;_<c;_++){for(x.y=(_+.5)*g,C.y=n(x.y),E=0,I=0,T=0,F=0,O=0,S=C.x-y;S<=C.x+y;S++)if(!(S<0||S>=t)){P=n(1e3*o(S-x.x)),w[P]||(w[P]={});for(var R=C.y-b;R<=C.y+b;R++)R<0||R>=a||(M=n(1e3*o(R-x.y)),w[P][M]||(w[P][M]=f(i(r(P*m,2)+r(M*v,2))/1e3)),(A=w[P][M])>0&&(E+=A,I+=A*u[k=4*(R*t+S)],T+=A*u[k+1],F+=A*u[k+2],O+=A*u[k+3]))}h[k=4*(_*s+l)]=I/E,h[k+1]=T/E,h[k+2]=F/E,h[k+3]=O/E}return++l<s?e(l):d}(0)},bilinearFiltering:function(e,t,r,i,o){var a,s,l,c,u,d,h,f,p,g=0,m=this.rcpScaleX,v=this.rcpScaleY,y=4*(t-1),b=e.imageData.data,w=e.ctx.createImageData(i,o),x=w.data;for(l=0;l<o;l++)for(c=0;c<i;c++)for(u=m*c-(a=n(m*c)),d=v*l-(s=n(v*l)),p=4*(s*t+a),h=0;h<4;h++)f=b[p+h]*(1-u)*(1-d)+b[p+4+h]*u*(1-d)+b[p+y+h]*d*(1-u)+b[p+y+4+h]*u*d,x[g++]=f;return w},hermiteFastResize:function(e,t,r,a,s){for(var c=this.rcpScaleX,u=this.rcpScaleY,d=l(c/2),h=l(u/2),f=e.imageData.data,p=e.ctx.createImageData(a,s),g=p.data,m=0;m<s;m++)for(var v=0;v<a;v++){for(var y=4*(v+m*a),b=0,w=0,x=0,C=0,_=0,S=0,A=0,k=(m+.5)*u,E=n(m*u);E<(m+1)*u;E++)for(var I=o(k-(E+.5))/h,T=(v+.5)*c,F=I*I,O=n(v*c);O<(v+1)*c;O++){var P=o(T-(O+.5))/d,M=i(F+P*P);M>1&&M<-1||(b=2*M*M*M-3*M*M+1)>0&&(A+=b*f[(P=4*(O+E*t))+3],x+=b,f[P+3]<255&&(b=b*f[P+3]/250),C+=b*f[P],_+=b*f[P+1],S+=b*f[P+2],w+=b)}g[y]=C/w,g[y+1]=_/w,g[y+2]=S/w,g[y+3]=A/x}return p},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),t.Image.filters.Resize.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Contrast=n(r.BaseFilter,{type:"Contrast",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uContrast;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\ngl_FragColor = color;\n}",contrast:0,mainParameter:"contrast",applyTo2d:function(e){if(0!==this.contrast){var t,r=e.imageData.data,n=r.length,i=Math.floor(255*this.contrast),o=259*(i+255)/(255*(259-i));for(t=0;t<n;t+=4)r[t]=o*(r[t]-128)+128,r[t+1]=o*(r[t+1]-128)+128,r[t+2]=o*(r[t+2]-128)+128}},getUniformLocations:function(e,t){return{uContrast:e.getUniformLocation(t,"uContrast")}},sendUniformData:function(e,t){e.uniform1f(t.uContrast,this.contrast)}}),t.Image.filters.Contrast.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Saturation=n(r.BaseFilter,{type:"Saturation",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uSaturation;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat rgMax = max(color.r, color.g);\nfloat rgbMax = max(rgMax, color.b);\ncolor.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\ncolor.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\ncolor.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\ngl_FragColor = color;\n}",saturation:0,mainParameter:"saturation",applyTo2d:function(e){if(0!==this.saturation){var t,r,n=e.imageData.data,i=n.length,o=-this.saturation;for(t=0;t<i;t+=4)r=Math.max(n[t],n[t+1],n[t+2]),n[t]+=r!==n[t]?(r-n[t])*o:0,n[t+1]+=r!==n[t+1]?(r-n[t+1])*o:0,n[t+2]+=r!==n[t+2]?(r-n[t+2])*o:0}},getUniformLocations:function(e,t){return{uSaturation:e.getUniformLocation(t,"uSaturation")}},sendUniformData:function(e,t){e.uniform1f(t.uSaturation,-this.saturation)}}),t.Image.filters.Saturation.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Vibrance=n(r.BaseFilter,{type:"Vibrance",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uVibrance;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat max = max(color.r, max(color.g, color.b));\nfloat avg = (color.r + color.g + color.b) / 3.0;\nfloat amt = (abs(max - avg) * 2.0) * uVibrance;\ncolor.r += max != color.r ? (max - color.r) * amt : 0.00;\ncolor.g += max != color.g ? (max - color.g) * amt : 0.00;\ncolor.b += max != color.b ? (max - color.b) * amt : 0.00;\ngl_FragColor = color;\n}",vibrance:0,mainParameter:"vibrance",applyTo2d:function(e){if(0!==this.vibrance){var t,r,n,i,o=e.imageData.data,a=o.length,s=-this.vibrance;for(t=0;t<a;t+=4)r=Math.max(o[t],o[t+1],o[t+2]),n=(o[t]+o[t+1]+o[t+2])/3,i=2*Math.abs(r-n)/255*s,o[t]+=r!==o[t]?(r-o[t])*i:0,o[t+1]+=r!==o[t+1]?(r-o[t+1])*i:0,o[t+2]+=r!==o[t+2]?(r-o[t+2])*i:0}},getUniformLocations:function(e,t){return{uVibrance:e.getUniformLocation(t,"uVibrance")}},sendUniformData:function(e,t){e.uniform1f(t.uVibrance,-this.vibrance)}}),t.Image.filters.Vibrance.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Blur=n(r.BaseFilter,{type:"Blur",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(v3offset);\nfor (float t = -nSamples; t <= nSamples; t++) {\nfloat percent = (t + offset - 0.5) / nSamples;\nfloat weight = 1.0 - abs(percent);\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\ntotal += weight;\n}\ngl_FragColor = color / total;\n}",blur:0,mainParameter:"blur",applyTo:function(e){e.webgl?(this.aspectRatio=e.sourceWidth/e.sourceHeight,e.passes++,this._setupFrameBuffer(e),this.horizontal=!0,this.applyToWebGL(e),this._swapTextures(e),this._setupFrameBuffer(e),this.horizontal=!1,this.applyToWebGL(e),this._swapTextures(e)):this.applyTo2d(e)},applyTo2d:function(e){e.imageData=this.simpleBlur(e)},simpleBlur:function(e){var r,n,i=e.filterBackend.resources,o=e.imageData.width,a=e.imageData.height;i.blurLayer1||(i.blurLayer1=t.util.createCanvasElement(),i.blurLayer2=t.util.createCanvasElement()),r=i.blurLayer1,n=i.blurLayer2,(r.width!==o||r.height!==a)&&(n.width=r.width=o,n.height=r.height=a);var s,l,c,u,d=r.getContext("2d"),h=n.getContext("2d"),f=15,p=.06*this.blur*.5;for(d.putImageData(e.imageData,0,0),h.clearRect(0,0,o,a),u=-f;u<=f;u++)c=p*(l=u/f)*o+(s=(Math.random()-.5)/4),h.globalAlpha=1-Math.abs(l),h.drawImage(r,c,s),d.drawImage(n,0,0),h.globalAlpha=1,h.clearRect(0,0,n.width,n.height);for(u=-f;u<=f;u++)c=p*(l=u/f)*a+(s=(Math.random()-.5)/4),h.globalAlpha=1-Math.abs(l),h.drawImage(r,s,c),d.drawImage(n,0,0),h.globalAlpha=1,h.clearRect(0,0,n.width,n.height);e.ctx.drawImage(r,0,0);var g=e.ctx.getImageData(0,0,r.width,r.height);return d.globalAlpha=1,d.clearRect(0,0,r.width,r.height),g},getUniformLocations:function(e,t){return{delta:e.getUniformLocation(t,"uDelta")}},sendUniformData:function(e,t){var r=this.chooseRightDelta();e.uniform2fv(t.delta,r)},chooseRightDelta:function(){var e,t=1,r=[0,0];return this.horizontal?this.aspectRatio>1&&(t=1/this.aspectRatio):this.aspectRatio<1&&(t=this.aspectRatio),e=t*this.blur*.12,this.horizontal?r[0]=e:r[1]=e,r}}),r.Blur.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Gamma=n(r.BaseFilter,{type:"Gamma",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec3 uGamma;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec3 correction = (1.0 / uGamma);\ncolor.r = pow(color.r, correction.r);\ncolor.g = pow(color.g, correction.g);\ncolor.b = pow(color.b, correction.b);\ngl_FragColor = color;\ngl_FragColor.rgb *= color.a;\n}",gamma:[1,1,1],mainParameter:"gamma",initialize:function(e){this.gamma=[1,1,1],r.BaseFilter.prototype.initialize.call(this,e)},applyTo2d:function(e){var t,r=e.imageData.data,n=this.gamma,i=r.length,o=1/n[0],a=1/n[1],s=1/n[2];for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),t=0,i=256;t<i;t++)this.rVals[t]=255*Math.pow(t/255,o),this.gVals[t]=255*Math.pow(t/255,a),this.bVals[t]=255*Math.pow(t/255,s);for(t=0,i=r.length;t<i;t+=4)r[t]=this.rVals[r[t]],r[t+1]=this.gVals[r[t+1]],r[t+2]=this.bVals[r[t+2]]},getUniformLocations:function(e,t){return{uGamma:e.getUniformLocation(t,"uGamma")}},sendUniformData:function(e,t){e.uniform3fv(t.uGamma,this.gamma)}}),t.Image.filters.Gamma.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Composed=n(r.BaseFilter,{type:"Composed",subFilters:[],initialize:function(e){this.callSuper("initialize",e),this.subFilters=this.subFilters.slice(0)},applyTo:function(e){e.passes+=this.subFilters.length-1,this.subFilters.forEach(function(t){t.applyTo(e)})},toObject:function(){return t.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map(function(e){return e.toObject()})})},isNeutralState:function(){return!this.subFilters.some(function(e){return!e.isNeutralState()})}}),t.Image.filters.Composed.fromObject=function(e,r){var n=(e.subFilters||[]).map(function(e){return new t.Image.filters[e.type](e)}),i=new t.Image.filters.Composed({subFilters:n});return r&&r(i),i}}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.HueRotation=n(r.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var e=this.rotation*Math.PI,r=t.util.cos(e),n=t.util.sin(e),i=1/3,o=Math.sqrt(i)*n,a=1-r;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=r+a/3,this.matrix[1]=i*a-o,this.matrix[2]=i*a+o,this.matrix[5]=i*a+o,this.matrix[6]=r+i*a,this.matrix[7]=i*a-o,this.matrix[10]=i*a-o,this.matrix[11]=i*a+o,this.matrix[12]=r+i*a},isNeutralState:function(e){return this.calculateMatrix(),r.BaseFilter.prototype.isNeutralState.call(this,e)},applyTo:function(e){this.calculateMatrix(),r.BaseFilter.prototype.applyTo.call(this,e)}}),t.Image.filters.HueRotation.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.clone;if(t.Text)t.warn("fabric.Text is already defined");else{var n="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign".split(" ");t.Text=t.util.createClass(t.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide","pathAlign"],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:"left",fontStyle:"normal",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:"",stateProperties:t.Object.prototype.stateProperties.concat(n),cacheProperties:t.Object.prototype.cacheProperties.concat(n),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:"left",pathAlign:"baseline",_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:"ltr",_styleProperties:["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor"],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(e,t){this.styles=t&&t.styles||{},this.text=e,this.__skipDimension=!0,this.callSuper("initialize",t),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:"_dimensionAffectingProps"})},setPathInfo:function(){var e=this.path;e&&(e.segmentsInfo=t.util.getPathSegmentsInfo(e.path))},getMeasuringContext:function(){return t._measuringContext||(t._measuringContext=this.canvas&&this.canvas.contextCache||t.util.createCanvasElement().getContext("2d")),t._measuringContext},_splitText:function(){var e=this._splitTextIntoLines(this.text);return this.textLines=e.lines,this._textLines=e.graphemeLines,this._unwrappedTextLines=e._unwrappedLines,this._text=e.graphemeText,e},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.saveState({propertySet:"_dimensionAffectingProps"}))},enlargeSpaces:function(){for(var e,t,r,n,i,o,a,s=0,l=this._textLines.length;s<l;s++)if(("justify"===this.textAlign||s!==l-1&&!this.isEndOfWrapping(s))&&(n=0,i=this._textLines[s],(t=this.getLineWidth(s))<this.width&&(a=this.textLines[s].match(this._reSpacesAndTabs)))){r=a.length,e=(this.width-t)/r;for(var c=0,u=i.length;c<=u;c++)o=this.__charBounds[s][c],this._reSpaceAndTab.test(i[c])?(o.width+=e,o.kernedWidth+=e,o.left+=n,n+=e):o.left+=n}},isEndOfWrapping:function(e){return e===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var e=this.callSuper("_getCacheCanvasDimensions"),t=this.fontSize;return e.width+=t*e.zoomX,e.height+=t*e.zoomY,e},_render:function(e){var t=this.path;t&&!t.isNotVisible()&&t._render(e),this._setTextStyles(e),this._renderTextLinesBackground(e),this._renderTextDecoration(e,"underline"),this._renderText(e),this._renderTextDecoration(e,"overline"),this._renderTextDecoration(e,"linethrough")},_renderText:function(e){"stroke"===this.paintFirst?(this._renderTextStroke(e),this._renderTextFill(e)):(this._renderTextFill(e),this._renderTextStroke(e))},_setTextStyles:function(e,t,r){if(e.textBaseline="alphabetical",this.path)switch(this.pathAlign){case"center":e.textBaseline="middle";break;case"ascender":e.textBaseline="top";break;case"descender":e.textBaseline="bottom"}e.font=this._getFontDeclaration(t,r)},calcTextWidth:function(){for(var e=this.getLineWidth(0),t=1,r=this._textLines.length;t<r;t++){var n=this.getLineWidth(t);n>e&&(e=n)}return e},_renderTextLine:function(e,t,r,n,i,o){this._renderChars(e,t,r,n,i,o)},_renderTextLinesBackground:function(e){if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){for(var t,r,n,i,o,a,s,l=e.fillStyle,c=this._getLeftOffset(),u=this._getTopOffset(),d=0,h=0,f=this.path,p=0,g=this._textLines.length;p<g;p++)if(t=this.getHeightOfLine(p),this.textBackgroundColor||this.styleHas("textBackgroundColor",p)){n=this._textLines[p],r=this._getLineLeftOffset(p),h=0,d=0,i=this.getValueOfPropertyAt(p,0,"textBackgroundColor");for(var m=0,v=n.length;m<v;m++)o=this.__charBounds[p][m],a=this.getValueOfPropertyAt(p,m,"textBackgroundColor"),f?(e.save(),e.translate(o.renderLeft,o.renderTop),e.rotate(o.angle),e.fillStyle=a,a&&e.fillRect(-o.width/2,-t/this.lineHeight*(1-this._fontSizeFraction),o.width,t/this.lineHeight),e.restore()):a!==i?(s=c+r+d,"rtl"===this.direction&&(s=this.width-s-h),e.fillStyle=i,i&&e.fillRect(s,u,h,t/this.lineHeight),d=o.left,h=o.width,i=a):h+=o.kernedWidth;a&&!f&&(s=c+r+d,"rtl"===this.direction&&(s=this.width-s-h),e.fillStyle=a,e.fillRect(s,u,h,t/this.lineHeight)),u+=t}else u+=t;e.fillStyle=l,this._removeShadow(e)}},getFontCache:function(e){var r=e.fontFamily.toLowerCase();t.charWidthsCache[r]||(t.charWidthsCache[r]={});var n=t.charWidthsCache[r],i=e.fontStyle.toLowerCase()+"_"+(e.fontWeight+"").toLowerCase();return n[i]||(n[i]={}),n[i]},_measureChar:function(e,t,r,n){var i,o,a,s,l=this.getFontCache(t),c=r+e,u=this._getFontDeclaration(t)===this._getFontDeclaration(n),d=t.fontSize/this.CACHE_FONT_SIZE;if(r&&void 0!==l[r]&&(a=l[r]),void 0!==l[e]&&(s=i=l[e]),u&&void 0!==l[c]&&(s=(o=l[c])-a),void 0===i||void 0===a||void 0===o){var h=this.getMeasuringContext();this._setTextStyles(h,t,!0)}return void 0===i&&(s=i=h.measureText(e).width,l[e]=i),void 0===a&&u&&r&&(a=h.measureText(r).width,l[r]=a),u&&void 0===o&&(o=h.measureText(c).width,l[c]=o,s=o-a),{width:i*d,kernedWidth:s*d}},getHeightOfChar:function(e,t){return this.getValueOfPropertyAt(e,t,"fontSize")},measureLine:function(e){var t=this._measureLine(e);return 0!==this.charSpacing&&(t.width-=this._getWidthOfCharSpacing()),t.width<0&&(t.width=0),t},_measureLine:function(e){var r,n,i,o,a,s,l=0,c=this._textLines[e],u=new Array(c.length),d=0,h=this.path,f="right"===this.pathSide;for(this.__charBounds[e]=u,r=0;r<c.length;r++)n=c[r],o=this._getGraphemeBox(n,e,r,i),u[r]=o,l+=o.kernedWidth,i=n;if(u[r]={left:o?o.left+o.width:0,width:0,kernedWidth:0,height:this.fontSize},h){switch(s=h.segmentsInfo[h.segmentsInfo.length-1].length,(a=t.util.getPointOnPath(h.path,0,h.segmentsInfo)).x+=h.pathOffset.x,a.y+=h.pathOffset.y,this.textAlign){case"left":d=f?s-l:0;break;case"center":d=(s-l)/2;break;case"right":d=f?0:s-l}for(d+=this.pathStartOffset*(f?-1:1),r=f?c.length-1:0;f?r>=0:r<c.length;f?r--:r++)o=u[r],d>s?d%=s:d<0&&(d+=s),this._setGraphemeOnPath(d,o,a),d+=o.kernedWidth}return{width:l,numOfSpaces:0}},_setGraphemeOnPath:function(e,r,n){var i=e+r.kernedWidth/2,o=this.path,a=t.util.getPointOnPath(o.path,i,o.segmentsInfo);r.renderLeft=a.x-n.x,r.renderTop=a.y-n.y,r.angle=a.angle+("right"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(e,t,r,n,i){var o,a=this.getCompleteStyleDeclaration(t,r),s=n?this.getCompleteStyleDeclaration(t,r-1):{},l=this._measureChar(e,a,n,s),c=l.kernedWidth,u=l.width;0!==this.charSpacing&&(u+=o=this._getWidthOfCharSpacing(),c+=o);var d={width:u,left:0,height:a.fontSize,kernedWidth:c,deltaY:a.deltaY};if(r>0&&!i){var h=this.__charBounds[t][r-1];d.left=h.left+h.width+l.kernedWidth-l.width}return d},getHeightOfLine:function(e){if(this.__lineHeights[e])return this.__lineHeights[e];for(var t=this._textLines[e],r=this.getHeightOfChar(e,0),n=1,i=t.length;n<i;n++)r=Math.max(this.getHeightOfChar(e,n),r);return this.__lineHeights[e]=r*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var e,t=0,r=0,n=this._textLines.length;r<n;r++)e=this.getHeightOfLine(r),t+=r===n-1?e/this.lineHeight:e;return t},_getLeftOffset:function(){return"ltr"===this.direction?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(e,t){e.save();for(var r=0,n=this._getLeftOffset(),i=this._getTopOffset(),o=0,a=this._textLines.length;o<a;o++){var s=this.getHeightOfLine(o),l=s/this.lineHeight,c=this._getLineLeftOffset(o);this._renderTextLine(t,e,this._textLines[o],n+c,i+r+l,o),r+=s}e.restore()},_renderTextFill:function(e){!this.fill&&!this.styleHas("fill")||this._renderTextCommon(e,"fillText")},_renderTextStroke:function(e){(!this.stroke||0===this.strokeWidth)&&this.isEmptyStyles()||(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(e),e.save(),this._setLineDash(e,this.strokeDashArray),e.beginPath(),this._renderTextCommon(e,"strokeText"),e.closePath(),e.restore())},_renderChars:function(e,r,n,i,o,a){var s,l,c,u,d,h=this.getHeightOfLine(a),f=-1!==this.textAlign.indexOf("justify"),p="",g=0,m=this.path,v=!f&&0===this.charSpacing&&this.isEmptyStyles(a)&&!m,y="ltr"===this.direction,b="ltr"===this.direction?1:-1,w=r.canvas.getAttribute("dir");if(r.save(),w!==this.direction&&(r.canvas.setAttribute("dir",y?"ltr":"rtl"),r.direction=y?"ltr":"rtl",r.textAlign=y?"left":"right"),o-=h*this._fontSizeFraction/this.lineHeight,v)return this._renderChar(e,r,a,0,n.join(""),i,o,h),void r.restore();for(var x=0,C=n.length-1;x<=C;x++)u=x===C||this.charSpacing||m,p+=n[x],c=this.__charBounds[a][x],0===g?(i+=b*(c.kernedWidth-c.width),g+=c.width):g+=c.kernedWidth,f&&!u&&this._reSpaceAndTab.test(n[x])&&(u=!0),u||(s=s||this.getCompleteStyleDeclaration(a,x),l=this.getCompleteStyleDeclaration(a,x+1),u=t.util.hasStyleChanged(s,l,!1)),u&&(m?(r.save(),r.translate(c.renderLeft,c.renderTop),r.rotate(c.angle),this._renderChar(e,r,a,x,p,-g/2,0,h),r.restore()):(d=i,this._renderChar(e,r,a,x,p,d,o,h)),p="",s=l,i+=b*g,g=0);r.restore()},_applyPatternGradientTransformText:function(e){var r,n=t.util.createCanvasElement(),i=this.width+this.strokeWidth,o=this.height+this.strokeWidth;return n.width=i,n.height=o,(r=n.getContext("2d")).beginPath(),r.moveTo(0,0),r.lineTo(i,0),r.lineTo(i,o),r.lineTo(0,o),r.closePath(),r.translate(i/2,o/2),r.fillStyle=e.toLive(r),this._applyPatternGradientTransform(r,e),r.fill(),r.createPattern(n,"no-repeat")},handleFiller:function(e,t,r){var n,i;return r.toLive?"percentage"===r.gradientUnits||r.gradientTransform||r.patternTransform?(n=-this.width/2,i=-this.height/2,e.translate(n,i),e[t]=this._applyPatternGradientTransformText(r),{offsetX:n,offsetY:i}):(e[t]=r.toLive(e,this),this._applyPatternGradientTransform(e,r)):(e[t]=r,{offsetX:0,offsetY:0})},_setStrokeStyles:function(e,t){return e.lineWidth=t.strokeWidth,e.lineCap=this.strokeLineCap,e.lineDashOffset=this.strokeDashOffset,e.lineJoin=this.strokeLineJoin,e.miterLimit=this.strokeMiterLimit,this.handleFiller(e,"strokeStyle",t.stroke)},_setFillStyles:function(e,t){return this.handleFiller(e,"fillStyle",t.fill)},_renderChar:function(e,t,r,n,i,o,a){var s,l,c=this._getStyleDeclaration(r,n),u=this.getCompleteStyleDeclaration(r,n),d="fillText"===e&&u.fill,h="strokeText"===e&&u.stroke&&u.strokeWidth;!h&&!d||(t.save(),d&&(s=this._setFillStyles(t,u)),h&&(l=this._setStrokeStyles(t,u)),t.font=this._getFontDeclaration(u),c&&c.textBackgroundColor&&this._removeShadow(t),c&&c.deltaY&&(a+=c.deltaY),d&&t.fillText(i,o-s.offsetX,a-s.offsetY),h&&t.strokeText(i,o-l.offsetX,a-l.offsetY),t.restore())},setSuperscript:function(e,t){return this._setScript(e,t,this.superscript)},setSubscript:function(e,t){return this._setScript(e,t,this.subscript)},_setScript:function(e,t,r){var n=this.get2DCursorLocation(e,!0),i=this.getValueOfPropertyAt(n.lineIndex,n.charIndex,"fontSize"),o=this.getValueOfPropertyAt(n.lineIndex,n.charIndex,"deltaY"),a={fontSize:i*r.size,deltaY:o+i*r.baseline};return this.setSelectionStyles(a,e,t),this},_getLineLeftOffset:function(e){var t=this.getLineWidth(e),r=this.width-t,n=this.textAlign,i=this.direction,o=0,a=this.isEndOfWrapping(e);return"justify"===n||"justify-center"===n&&!a||"justify-right"===n&&!a||"justify-left"===n&&!a?0:("center"===n&&(o=r/2),"right"===n&&(o=r),"justify-center"===n&&(o=r/2),"justify-right"===n&&(o=r),"rtl"===i&&(o-=r),o)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var e=this._forceClearCache;return e||(e=this.hasStateChanged("_dimensionAffectingProps")),e&&(this.dirty=!0,this._forceClearCache=!1),e},getLineWidth:function(e){if(void 0!==this.__lineWidths[e])return this.__lineWidths[e];var t=this.measureLine(e).width;return this.__lineWidths[e]=t,t},_getWidthOfCharSpacing:function(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(e,t,r){var n=this._getStyleDeclaration(e,t);return n&&typeof n[r]<"u"?n[r]:this[r]},_renderTextDecoration:function(e,t){if(this[t]||this.styleHas(t)){for(var r,n,i,o,a,s,l,c,u,d,h,f,p,g,m,v,y=this._getLeftOffset(),b=this._getTopOffset(),w=this.path,x=this._getWidthOfCharSpacing(),C=this.offsets[t],_=0,S=this._textLines.length;_<S;_++)if(r=this.getHeightOfLine(_),this[t]||this.styleHas(t,_)){l=this._textLines[_],g=r/this.lineHeight,o=this._getLineLeftOffset(_),d=0,h=0,c=this.getValueOfPropertyAt(_,0,t),v=this.getValueOfPropertyAt(_,0,"fill"),u=b+g*(1-this._fontSizeFraction),n=this.getHeightOfChar(_,0),a=this.getValueOfPropertyAt(_,0,"deltaY");for(var A=0,k=l.length;A<k;A++)if(f=this.__charBounds[_][A],p=this.getValueOfPropertyAt(_,A,t),m=this.getValueOfPropertyAt(_,A,"fill"),i=this.getHeightOfChar(_,A),s=this.getValueOfPropertyAt(_,A,"deltaY"),w&&p&&m)e.save(),e.fillStyle=v,e.translate(f.renderLeft,f.renderTop),e.rotate(f.angle),e.fillRect(-f.kernedWidth/2,C*i+s,f.kernedWidth,this.fontSize/15),e.restore();else if((p!==c||m!==v||i!==n||s!==a)&&h>0){var E=y+o+d;"rtl"===this.direction&&(E=this.width-E-h),c&&v&&(e.fillStyle=v,e.fillRect(E,u+C*n+a,h,this.fontSize/15)),d=f.left,h=f.width,c=p,v=m,n=i,a=s}else h+=f.kernedWidth;E=y+o+d;"rtl"===this.direction&&(E=this.width-E-h),e.fillStyle=m,p&&m&&e.fillRect(E,u+C*n+a,h-x,this.fontSize/15),b+=r}else b+=r;this._removeShadow(e)}},_getFontDeclaration:function(e,r){var n=e||this,i=this.fontFamily,o=t.Text.genericFonts.indexOf(i.toLowerCase())>-1,a=void 0===i||i.indexOf("'")>-1||i.indexOf(",")>-1||i.indexOf('"')>-1||o?n.fontFamily:'"'+n.fontFamily+'"';return[t.isLikelyNode?n.fontWeight:n.fontStyle,t.isLikelyNode?n.fontStyle:n.fontWeight,r?this.CACHE_FONT_SIZE+"px":n.fontSize+"px",a].join(" ")},render:function(e){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",e)))},_splitTextIntoLines:function(e){for(var r=e.split(this._reNewline),n=new Array(r.length),i=["\n"],o=[],a=0;a<r.length;a++)n[a]=t.util.string.graphemeSplit(r[a]),o=o.concat(n[a],i);return o.pop(),{_unwrappedLines:n,lines:r,graphemeText:o,graphemeLines:n}},toObject:function(e){var r=n.concat(e),i=this.callSuper("toObject",r);return i.styles=t.util.stylesToArray(this.styles,this.text),i.path&&(i.path=this.path.toObject()),i},set:function(e,t){this.callSuper("set",e,t);var r=!1,n=!1;if("object"==typeof e)for(var i in e)"path"===i&&this.setPathInfo(),r=r||-1!==this._dimensionAffectingProps.indexOf(i),n=n||"path"===i;else r=-1!==this._dimensionAffectingProps.indexOf(e),n="path"===e;return n&&this.setPathInfo(),r&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),t.Text.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")),t.Text.DEFAULT_SVG_FONT_SIZE=16,t.Text.fromElement=function(e,n,i){if(!e)return n(null);var o=t.parseAttributes(e,t.Text.ATTRIBUTE_NAMES),a=o.textAnchor||"left";if((i=t.util.object.extend(i?r(i):{},o)).top=i.top||0,i.left=i.left||0,o.textDecoration){var s=o.textDecoration;-1!==s.indexOf("underline")&&(i.underline=!0),-1!==s.indexOf("overline")&&(i.overline=!0),-1!==s.indexOf("line-through")&&(i.linethrough=!0),delete i.textDecoration}"dx"in o&&(i.left+=o.dx),"dy"in o&&(i.top+=o.dy),"fontSize"in i||(i.fontSize=t.Text.DEFAULT_SVG_FONT_SIZE);var l="";"textContent"in e?l=e.textContent:"firstChild"in e&&null!==e.firstChild&&"data"in e.firstChild&&null!==e.firstChild.data&&(l=e.firstChild.data),l=l.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var c=i.strokeWidth;i.strokeWidth=0;var u=new t.Text(l,i),d=u.getScaledHeight()/u.height,h=((u.height+u.strokeWidth)*u.lineHeight-u.height)*d,f=u.getScaledHeight()+h,p=0;"center"===a&&(p=u.getScaledWidth()/2),"right"===a&&(p=u.getScaledWidth()),u.set({left:u.left-p,top:u.top-(f-u.fontSize*(.07+u._fontSizeFraction))/u.lineHeight,strokeWidth:typeof c<"u"?c:1}),n(u)},t.Text.fromObject=function(e,n){var i=r(e),o=e.path;return delete i.path,t.Object._fromObject("Text",i,function(r){r.styles=t.util.stylesFromArray(e.styles,e.text),o?t.Object._fromObject("Path",o,function(e){r.set("path",e),n(r)},"path"):n(r)},"text")},t.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],t.util.createAccessors&&t.util.createAccessors(t.Text)}}(e),t.util.object.extend(t.Text.prototype,{isEmptyStyles:function(e){if(!this.styles||typeof e<"u"&&!this.styles[e])return!0;var t=typeof e>"u"?this.styles:{line:this.styles[e]};for(var r in t)for(var n in t[r])for(var i in t[r][n])return!1;return!0},styleHas:function(e,t){if(!this.styles||!e||""===e||typeof t<"u"&&!this.styles[t])return!1;var r=typeof t>"u"?this.styles:{0:this.styles[t]};for(var n in r)for(var i in r[n])if(typeof r[n][i][e]<"u")return!0;return!1},cleanStyle:function(e){if(!this.styles||!e||""===e)return!1;var t,r,n=this.styles,i=0,o=!0,a=0;for(var s in n){for(var l in t=0,n[s]){var c;i++,(c=n[s][l]).hasOwnProperty(e)?(r?c[e]!==r&&(o=!1):r=c[e],c[e]===this[e]&&delete c[e]):o=!1,0!==Object.keys(c).length?t++:delete n[s][l]}0===t&&delete n[s]}for(var u=0;u<this._textLines.length;u++)a+=this._textLines[u].length;o&&i===a&&(this[e]=r,this.removeStyle(e))},removeStyle:function(e){if(this.styles&&e&&""!==e){var t,r,n,i=this.styles;for(r in i){for(n in t=i[r])delete t[n][e],0===Object.keys(t[n]).length&&delete t[n];0===Object.keys(t).length&&delete i[r]}}},_extendStyles:function(e,r){var n=this.get2DCursorLocation(e);this._getLineStyle(n.lineIndex)||this._setLineStyle(n.lineIndex),this._getStyleDeclaration(n.lineIndex,n.charIndex)||this._setStyleDeclaration(n.lineIndex,n.charIndex,{}),t.util.object.extend(this._getStyleDeclaration(n.lineIndex,n.charIndex),r)},get2DCursorLocation:function(e,t){typeof e>"u"&&(e=this.selectionStart);for(var r=t?this._unwrappedTextLines:this._textLines,n=r.length,i=0;i<n;i++){if(e<=r[i].length)return{lineIndex:i,charIndex:e};e-=r[i].length+this.missingNewlineOffset(i)}return{lineIndex:i-1,charIndex:r[i-1].length<e?r[i-1].length:e}},getSelectionStyles:function(e,t,r){typeof e>"u"&&(e=this.selectionStart||0),typeof t>"u"&&(t=this.selectionEnd||e);for(var n=[],i=e;i<t;i++)n.push(this.getStyleAtPosition(i,r));return n},getStyleAtPosition:function(e,t){var r=this.get2DCursorLocation(e);return(t?this.getCompleteStyleDeclaration(r.lineIndex,r.charIndex):this._getStyleDeclaration(r.lineIndex,r.charIndex))||{}},setSelectionStyles:function(e,t,r){typeof t>"u"&&(t=this.selectionStart||0),typeof r>"u"&&(r=this.selectionEnd||t);for(var n=t;n<r;n++)this._extendStyles(n,e);return this._forceClearCache=!0,this},_getStyleDeclaration:function(e,t){var r=this.styles&&this.styles[e];return r?r[t]:null},getCompleteStyleDeclaration:function(e,t){for(var r,n=this._getStyleDeclaration(e,t)||{},i={},o=0;o<this._styleProperties.length;o++)i[r=this._styleProperties[o]]=typeof n[r]>"u"?this[r]:n[r];return i},_setStyleDeclaration:function(e,t,r){this.styles[e][t]=r},_deleteStyleDeclaration:function(e,t){delete this.styles[e][t]},_getLineStyle:function(e){return!!this.styles[e]},_setLineStyle:function(e){this.styles[e]={}},_deleteLineStyle:function(e){delete this.styles[e]}}),function(){function e(e){e.textDecoration&&(e.textDecoration.indexOf("underline")>-1&&(e.underline=!0),e.textDecoration.indexOf("line-through")>-1&&(e.linethrough=!0),e.textDecoration.indexOf("overline")>-1&&(e.overline=!0),delete e.textDecoration)}t.IText=t.util.createClass(t.Text,t.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(e,t){this.callSuper("initialize",e,t),this.initBehavior()},setSelectionStart:function(e){e=Math.max(e,0),this._updateAndFire("selectionStart",e)},setSelectionEnd:function(e){e=Math.min(e,this.text.length),this._updateAndFire("selectionEnd",e)},_updateAndFire:function(e,t){this[e]!==t&&(this._fireSelectionChanged(),this[e]=t),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(e){this.clearContextTop(),this.callSuper("render",e),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(e){this.callSuper("_render",e)},clearContextTop:function(e){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this.canvas.contextTop,r=this.canvas.viewportTransform;t.save(),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this.transform(t),this._clearTextArea(t),e||t.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var e=this._getCursorBoundaries(),t=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(e,t):this.renderSelection(e,t),t.restore()}},_clearTextArea:function(e){var t=this.width+4,r=this.height+4;e.clearRect(-t/2,-r/2,t,r)},_getCursorBoundaries:function(e){typeof e>"u"&&(e=this.selectionStart);var t=this._getLeftOffset(),r=this._getTopOffset(),n=this._getCursorBoundariesOffsets(e);return{left:t,top:r,leftOffset:n.left,topOffset:n.top}},_getCursorBoundariesOffsets:function(e){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var t,r,n,i,o=0,a=0,s=this.get2DCursorLocation(e);n=s.charIndex,r=s.lineIndex;for(var l=0;l<r;l++)o+=this.getHeightOfLine(l);t=this._getLineLeftOffset(r);var c=this.__charBounds[r][n];return c&&(a=c.left),0!==this.charSpacing&&n===this._textLines[r].length&&(a-=this._getWidthOfCharSpacing()),i={top:o,left:t+(a>0?a:0)},"rtl"===this.direction&&(i.left*=-1),this.cursorOffsetCache=i,this.cursorOffsetCache},renderCursor:function(e,t){var r=this.get2DCursorLocation(),n=r.lineIndex,i=r.charIndex>0?r.charIndex-1:0,o=this.getValueOfPropertyAt(n,i,"fontSize"),a=this.scaleX*this.canvas.getZoom(),s=this.cursorWidth/a,l=e.topOffset,c=this.getValueOfPropertyAt(n,i,"deltaY");l+=(1-this._fontSizeFraction)*this.getHeightOfLine(n)/this.lineHeight-o*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(e,t),t.fillStyle=this.cursorColor||this.getValueOfPropertyAt(n,i,"fill"),t.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,t.fillRect(e.left+e.leftOffset-s/2,l+e.top+c,s,o)},renderSelection:function(e,t){for(var r=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,n=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,i=-1!==this.textAlign.indexOf("justify"),o=this.get2DCursorLocation(r),a=this.get2DCursorLocation(n),s=o.lineIndex,l=a.lineIndex,c=o.charIndex<0?0:o.charIndex,u=a.charIndex<0?0:a.charIndex,d=s;d<=l;d++){var h,f=this._getLineLeftOffset(d)||0,p=this.getHeightOfLine(d),g=0,m=0;if(d===s&&(g=this.__charBounds[s][c].left),d>=s&&d<l)m=i&&!this.isEndOfWrapping(d)?this.width:this.getLineWidth(d)||5;else if(d===l)if(0===u)m=this.__charBounds[l][u].left;else{var v=this._getWidthOfCharSpacing();m=this.__charBounds[l][u-1].left+this.__charBounds[l][u-1].width-v}h=p,(this.lineHeight<1||d===l&&this.lineHeight>1)&&(p/=this.lineHeight);var y=e.left+f+g,b=m-g,w=p,x=0;this.inCompositionMode?(t.fillStyle=this.compositionColor||"black",w=1,x=p):t.fillStyle=this.selectionColor,"rtl"===this.direction&&(y=this.width-y-b),t.fillRect(y,e.top+e.topOffset+x,b,w),e.topOffset+=h}},getCurrentCharFontSize:function(){var e=this._getCurrentCharIndex();return this.getValueOfPropertyAt(e.l,e.c,"fontSize")},getCurrentCharColor:function(){var e=this._getCurrentCharIndex();return this.getValueOfPropertyAt(e.l,e.c,"fill")},_getCurrentCharIndex:function(){var e=this.get2DCursorLocation(this.selectionStart,!0),t=e.charIndex>0?e.charIndex-1:0;return{l:e.lineIndex,c:t}}}),t.IText.fromObject=function(r,n){var i=t.util.stylesFromArray(r.styles,r.text),o=Object.assign({},r,{styles:i});if(e(o),o.styles)for(var a in o.styles)for(var s in o.styles[a])e(o.styles[a][s]);t.Object._fromObject("IText",o,n,"text")}}(),function(){var e=t.util.object.clone;t.util.object.extend(t.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var e=this;this.on("added",function(){var t=e.canvas;t&&(t._hasITextHandlers||(t._hasITextHandlers=!0,e._initCanvasHandlers(t)),t._iTextInstances=t._iTextInstances||[],t._iTextInstances.push(e))})},initRemovedHandler:function(){var e=this;this.on("removed",function(){var r=e.canvas;r&&(r._iTextInstances=r._iTextInstances||[],t.util.removeFromArray(r._iTextInstances,e),0===r._iTextInstances.length&&(r._hasITextHandlers=!1,e._removeCanvasHandlers(r)))})},_initCanvasHandlers:function(e){e._mouseUpITextHandler=function(){e._iTextInstances&&e._iTextInstances.forEach(function(e){e.__isMousedown=!1})},e.on("mouse:up",e._mouseUpITextHandler)},_removeCanvasHandlers:function(e){e.off("mouse:up",e._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(e,t,r,n){var i;return i={isAborted:!1,abort:function(){this.isAborted=!0}},e.animate("_currentCursorOpacity",t,{duration:r,onComplete:function(){i.isAborted||e[n]()},onChange:function(){e.canvas&&e.selectionStart===e.selectionEnd&&e.renderCursorOrSelection()},abort:function(){return i.isAborted}}),i},_onTickComplete:function(){var e=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){e._currentTickCompleteState=e._animateCursor(e,0,this.cursorDuration/2,"_tick")},100)},initDelayedCursor:function(e){var t=this,r=e?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout(function(){t._tick()},r)},abortCursorAnimation:function(){var e=this._currentTickState||this._currentTickCompleteState,t=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,e&&t&&t.clearContext(t.contextTop||t.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(e){var t=0,r=e-1;if(this._reSpace.test(this._text[r]))for(;this._reSpace.test(this._text[r]);)t++,r--;for(;/\S/.test(this._text[r])&&r>-1;)t++,r--;return e-t},findWordBoundaryRight:function(e){var t=0,r=e;if(this._reSpace.test(this._text[r]))for(;this._reSpace.test(this._text[r]);)t++,r++;for(;/\S/.test(this._text[r])&&r<this._text.length;)t++,r++;return e+t},findLineBoundaryLeft:function(e){for(var t=0,r=e-1;!/\n/.test(this._text[r])&&r>-1;)t++,r--;return e-t},findLineBoundaryRight:function(e){for(var t=0,r=e;!/\n/.test(this._text[r])&&r<this._text.length;)t++,r++;return e+t},searchWordBoundary:function(e,r){for(var n=this._text,i=this._reSpace.test(n[e])?e-1:e,o=n[i],a=t.reNonWord;!a.test(o)&&i>0&&i<n.length;)o=n[i+=r];return a.test(o)&&(i+=1===r?0:1),i},selectWord:function(e){e=e||this.selectionStart;var t=this.searchWordBoundary(e,-1),r=this.searchWordBoundary(e,1);this.selectionStart=t,this.selectionEnd=r,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(e){e=e||this.selectionStart;var t=this.findLineBoundaryLeft(e),r=this.findLineBoundaryRight(e);return this.selectionStart=t,this.selectionEnd=r,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(e){if(!this.isEditing&&this.editable)return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(e),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this._fireSelectionChanged(),this.canvas?(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll(),this):this},exitEditingOnOthers:function(e){e._iTextInstances&&e._iTextInstances.forEach(function(e){e.selected=!1,e.isEditing&&e.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(e){if(this.__isMousedown&&this.isEditing){document.activeElement!==this.hiddenTextarea&&this.hiddenTextarea.focus();var t=this.getSelectionStartFromPointer(e.e),r=this.selectionStart,n=this.selectionEnd;(t!==this.__selectionStartOnMouseDown||r===n)&&(r===t||n===t)||(t>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=t):(this.selectionStart=t,this.selectionEnd=this.__selectionStartOnMouseDown),(this.selectionStart!==r||this.selectionEnd!==n)&&(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(e,r,n){var i=n.slice(0,e),o=t.util.string.graphemeSplit(i).length;if(e===r)return{selectionStart:o,selectionEnd:o};var a=n.slice(e,r);return{selectionStart:o,selectionEnd:o+t.util.string.graphemeSplit(a).length}},fromGraphemeToStringSelection:function(e,t,r){var n=r.slice(0,e).join("").length;return e===t?{selectionStart:n,selectionEnd:n}:{selectionStart:n,selectionEnd:n+r.slice(e,t).join("").length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var e=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=e.selectionStart,this.hiddenTextarea.selectionEnd=e.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var e=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=e.selectionEnd,this.inCompositionMode||(this.selectionStart=e.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var e=this._calcTextareaPosition();this.hiddenTextarea.style.left=e.left,this.hiddenTextarea.style.top=e.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var e=this.inCompositionMode?this.compositionStart:this.selectionStart,r=this._getCursorBoundaries(e),n=this.get2DCursorLocation(e),i=n.lineIndex,o=n.charIndex,a=this.getValueOfPropertyAt(i,o,"fontSize")*this.lineHeight,s=r.leftOffset,l=this.calcTransformMatrix(),c={x:r.left+s,y:r.top+r.topOffset+a},u=this.canvas.getRetinaScaling(),d=this.canvas.upperCanvasEl,h=d.width/u,f=d.height/u,p=h-a,g=f-a,m=d.clientWidth/h,v=d.clientHeight/f;return c=t.util.transformPoint(c,l),(c=t.util.transformPoint(c,this.canvas.viewportTransform)).x*=m,c.y*=v,c.x<0&&(c.x=0),c.x>p&&(c.x=p),c.y<0&&(c.y=0),c.y>g&&(c.y=g),c.x+=this.canvas._offset.left,c.y+=this.canvas._offset.top,{left:c.x+"px",top:c.y+"px",fontSize:a+"px",charHeight:a}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var e=this._textBeforeEdit!==this.text,t=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,t&&(t.blur&&t.blur(),t.parentNode&&t.parentNode.removeChild(t)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),e&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),e&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var e in this.styles)this._textLines[e]||delete this.styles[e]},removeStyleFromTo:function(e,t){var r,n,i=this.get2DCursorLocation(e,!0),o=this.get2DCursorLocation(t,!0),a=i.lineIndex,s=i.charIndex,l=o.lineIndex,c=o.charIndex;if(a!==l){if(this.styles[a])for(r=s;r<this._unwrappedTextLines[a].length;r++)delete this.styles[a][r];if(this.styles[l])for(r=c;r<this._unwrappedTextLines[l].length;r++)(n=this.styles[l][r])&&(this.styles[a]||(this.styles[a]={}),this.styles[a][s+r-c]=n);for(r=a+1;r<=l;r++)delete this.styles[r];this.shiftLineStyles(l,a-l)}else if(this.styles[a]){n=this.styles[a];var u,d,h=c-s;for(r=s;r<c;r++)delete n[r];for(d in this.styles[a])(u=parseInt(d,10))>=c&&(n[u-h]=n[d],delete n[d])}},shiftLineStyles:function(t,r){var n=e(this.styles);for(var i in this.styles){var o=parseInt(i,10);o>t&&(this.styles[o+r]=n[o],n[o-r]||delete this.styles[o])}},restartCursorIfNeeded:function(){(!this._currentTickState||this._currentTickState.isAborted||!this._currentTickCompleteState||this._currentTickCompleteState.isAborted)&&this.initDelayedCursor()},insertNewlineStyleObject:function(t,r,n,i){var o,a={},s=!1,l=this._unwrappedTextLines[t].length===r;for(var c in n||(n=1),this.shiftLineStyles(t,n),this.styles[t]&&(o=this.styles[t][0===r?r:r-1]),this.styles[t]){var u=parseInt(c,10);u>=r&&(s=!0,a[u-r]=this.styles[t][c],l&&0===r||delete this.styles[t][c])}var d=!1;for(s&&!l&&(this.styles[t+n]=a,d=!0),d&&n--;n>0;)i&&i[n-1]?this.styles[t+n]={0:e(i[n-1])}:o?this.styles[t+n]={0:e(o)}:delete this.styles[t+n],n--;this._forceClearCache=!0},insertCharStyleObject:function(t,r,n,i){this.styles||(this.styles={});var o=this.styles[t],a=o?e(o):{};for(var s in n||(n=1),a){var l=parseInt(s,10);l>=r&&(o[l+n]=a[l],a[l-n]||delete o[l])}if(this._forceClearCache=!0,i)for(;n--;)Object.keys(i[n]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][r+n]=e(i[n]));else if(o)for(var c=o[r?r-1:1];c&&n--;)this.styles[t][r+n]=e(c)},insertNewStyleBlock:function(e,t,r){for(var n=this.get2DCursorLocation(t,!0),i=[0],o=0,a=0;a<e.length;a++)"\n"===e[a]?i[++o]=0:i[o]++;i[0]>0&&(this.insertCharStyleObject(n.lineIndex,n.charIndex,i[0],r),r=r&&r.slice(i[0]+1)),o&&this.insertNewlineStyleObject(n.lineIndex,n.charIndex+i[0],o);for(a=1;a<o;a++)i[a]>0?this.insertCharStyleObject(n.lineIndex+a,0,i[a],r):r&&this.styles[n.lineIndex+a]&&r[0]&&(this.styles[n.lineIndex+a][0]=r[0]),r=r&&r.slice(i[a]+1);i[a]>0&&this.insertCharStyleObject(n.lineIndex+a,0,i[a],r)},setSelectionStartEndWithShift:function(e,t,r){r<=e?(t===e?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=e),this.selectionStart=r):r>e&&r<t?"right"===this._selectionDirection?this.selectionEnd=r:this.selectionStart=r:(t===e?this._selectionDirection="right":"left"===this._selectionDirection&&(this._selectionDirection="right",this.selectionStart=t),this.selectionEnd=r)},setSelectionInBoundaries:function(){var e=this.text.length;this.selectionStart>e?this.selectionStart=e:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>e?this.selectionEnd=e:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),t.util.object.extend(t.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(e){if(this.canvas){this.__newClickTime=+new Date;var t=e.pointer;this.isTripleClick(t)&&(this.fire("tripleclick",e),this._stopEvent(e.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=t,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(e){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===e.x&&this.__lastPointer.y===e.y},_stopEvent:function(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(e){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(e.e))},tripleClickHandler:function(e){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(e.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(e){!this.canvas||!this.editable||e.e.button&&1!==e.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(e.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(e){!this.canvas||!this.editable||e.e.button&&1!==e.e.button||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(e){if(this.__isMousedown=!1,!(!this.editable||this.group||e.transform&&e.transform.actionPerformed||e.e.button&&1!==e.e.button)){if(this.canvas){var t=this.canvas._activeObject;if(t&&t!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(e.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(e){var t=this.getSelectionStartFromPointer(e),r=this.selectionStart,n=this.selectionEnd;e.shiftKey?this.setSelectionStartEndWithShift(r,n,t):(this.selectionStart=t,this.selectionEnd=t),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(e){for(var t,r=this.getLocalPointer(e),n=0,i=0,o=0,a=0,s=0,l=0,c=this._textLines.length;l<c&&o<=r.y;l++)o+=this.getHeightOfLine(l)*this.scaleY,s=l,l>0&&(a+=this._textLines[l-1].length+this.missingNewlineOffset(l-1));i=this._getLineLeftOffset(s)*this.scaleX,t=this._textLines[s],"rtl"===this.direction&&(r.x=this.width*this.scaleX-r.x+i);for(var u=0,d=t.length;u<d&&(n=i,(i+=this.__charBounds[s][u].kernedWidth*this.scaleX)<=r.x);u++)a++;return this._getNewSelectionStartFromOffset(r,n,i,a,d)},_getNewSelectionStartFromOffset:function(e,t,r,n,i){var o=e.x-t,a=r-e.x,s=n+(a>o||a<0?0:1);return this.flipX&&(s=i-s),s>this._text.length&&(s=this._text.length),s}}),t.util.object.extend(t.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=t.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var e=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+e.top+"; left: "+e.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: "+e.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):t.document.body.appendChild(this.hiddenTextarea),t.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),t.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),t.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),t.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(t.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(e){if(this.isEditing){var t="rtl"===this.direction?this.keysMapRtl:this.keysMap;if(e.keyCode in t)this[t[e.keyCode]](e);else{if(!(e.keyCode in this.ctrlKeysMapDown)||!e.ctrlKey&&!e.metaKey)return;this[this.ctrlKeysMapDown[e.keyCode]](e)}e.stopImmediatePropagation(),e.preventDefault(),e.keyCode>=33&&e.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(e){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:e.keyCode in this.ctrlKeysMapUp&&(e.ctrlKey||e.metaKey)&&(this[this.ctrlKeysMapUp[e.keyCode]](e),e.stopImmediatePropagation(),e.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(e){var r=this.fromPaste;if(this.fromPaste=!1,e&&e.stopPropagation(),this.isEditing){var n,i,o,a,s,l=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,c=this._text.length,u=l.length,d=u-c,h=this.selectionStart,f=this.selectionEnd,p=h!==f;if(""===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire("changed"),void(this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll()));var g=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),m=h>g.selectionStart;p?(n=this._text.slice(h,f),d+=f-h):u<c&&(n=m?this._text.slice(f+d,f):this._text.slice(h,h-d)),i=l.slice(g.selectionEnd-d,g.selectionEnd),n&&n.length&&(i.length&&(o=this.getSelectionStyles(h,h+1,!1),o=i.map(function(){return o[0]})),p?(a=h,s=f):m?(a=f-n.length,s=f):(a=f,s=f+n.length),this.removeStyleFromTo(a,s)),i.length&&(r&&i.join("")===t.copiedText&&!t.disableStyleCopyPaste&&(o=t.copiedTextStyle),this.insertNewStyleBlock(i,h,o)),this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(e){this.compositionStart=e.target.selectionStart,this.compositionEnd=e.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(t.copiedText=this.getSelectedText(),t.disableStyleCopyPaste?t.copiedTextStyle=null:t.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(e){return e&&e.clipboardData||t.window.clipboardData},_getWidthBeforeCursor:function(e,t){var r,n=this._getLineLeftOffset(e);return t>0&&(n+=(r=this.__charBounds[e][t-1]).left+r.width),n},getDownCursorOffset:function(e,t){var r=this._getSelectionForOffset(e,t),n=this.get2DCursorLocation(r),i=n.lineIndex;if(i===this._textLines.length-1||e.metaKey||34===e.keyCode)return this._text.length-r;var o=n.charIndex,a=this._getWidthBeforeCursor(i,o),s=this._getIndexOnLine(i+1,a);return this._textLines[i].slice(o).length+s+1+this.missingNewlineOffset(i)},_getSelectionForOffset:function(e,t){return e.shiftKey&&this.selectionStart!==this.selectionEnd&&t?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(e,t){var r=this._getSelectionForOffset(e,t),n=this.get2DCursorLocation(r),i=n.lineIndex;if(0===i||e.metaKey||33===e.keyCode)return-r;var o=n.charIndex,a=this._getWidthBeforeCursor(i,o),s=this._getIndexOnLine(i-1,a),l=this._textLines[i].slice(0,o),c=this.missingNewlineOffset(i-1);return-this._textLines[i-1].length+s-l.length+(1-c)},_getIndexOnLine:function(e,t){for(var r,n,i=this._textLines[e],o=this._getLineLeftOffset(e),a=0,s=0,l=i.length;s<l;s++)if((o+=r=this.__charBounds[e][s].width)>t){n=!0;var c=o-r,u=o,d=Math.abs(c-t);a=Math.abs(u-t)<d?s:s-1;break}return n||(a=i.length-1),a},moveCursorDown:function(e){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",e)},moveCursorUp:function(e){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",e)},_moveCursorUpOrDown:function(e,t){var r=this["get"+e+"CursorOffset"](t,"right"===this._selectionDirection);t.shiftKey?this.moveCursorWithShift(r):this.moveCursorWithoutShift(r),0!==r&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(e){var t="left"===this._selectionDirection?this.selectionStart+e:this.selectionEnd+e;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,t),0!==e},moveCursorWithoutShift:function(e){return e<0?(this.selectionStart+=e,this.selectionEnd=this.selectionStart):(this.selectionEnd+=e,this.selectionStart=this.selectionEnd),0!==e},moveCursorLeft:function(e){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",e)},_move:function(e,t,r){var n;if(e.altKey)n=this["findWordBoundary"+r](this[t]);else{if(!e.metaKey&&35!==e.keyCode&&36!==e.keyCode)return this[t]+="Left"===r?-1:1,!0;n=this["findLineBoundary"+r](this[t])}if(typeof n<"u"&&this[t]!==n)return this[t]=n,!0},_moveLeft:function(e,t){return this._move(e,t,"Left")},_moveRight:function(e,t){return this._move(e,t,"Right")},moveCursorLeftWithoutShift:function(e){var t=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(t=this._moveLeft(e,"selectionStart")),this.selectionEnd=this.selectionStart,t},moveCursorLeftWithShift:function(e){return"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(e,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection="left",this._moveLeft(e,"selectionStart")):void 0},moveCursorRight:function(e){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",e)},_moveCursorLeftOrRight:function(e,t){var r="moveCursor"+e+"With";this._currentCursorOpacity=1,t.shiftKey?r+="Shift":r+="outShift",this[r](t)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(e){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(e,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(e,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(e){var t=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(t=this._moveRight(e,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,t},removeChars:function(e,t){typeof t>"u"&&(t=e+1),this.removeStyleFromTo(e,t),this._text.splice(e,t-e),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(e,r,n,i){typeof i>"u"&&(i=n),i>n&&this.removeStyleFromTo(n,i);var o=t.util.string.graphemeSplit(e);this.insertNewStyleBlock(o,n,r),this._text=[].concat(this._text.slice(0,n),o,this._text.slice(i)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var e=t.util.toFixed,r=/ +/g;t.util.object.extend(t.Text.prototype,{_toSVG:function(){var e=this._getSVGLeftTopOffsets(),t=this._getSVGTextAndBg(e.textTop,e.textLeft);return this._wrapSVGTextAndBg(t)},toSVG:function(e){return this._createBaseSVGMarkup(this._toSVG(),{reviver:e,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(e){var t=this.getSvgTextDecoration(this);return[e.textBgRects.join(""),'\t\t<text xml:space="preserve" ',this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",t?'text-decoration="'+t+'" ':"",'style="',this.getSvgStyles(!0),'"',this.addPaintOrder()," >",e.textSpans.join(""),"</text>\n"]},_getSVGTextAndBg:function(e,t){var r,n=[],i=[],o=e;this._setSVGBg(i);for(var a=0,s=this._textLines.length;a<s;a++)r=this._getLineLeftOffset(a),(this.textBackgroundColor||this.styleHas("textBackgroundColor",a))&&this._setSVGTextLineBg(i,a,t+r,o),this._setSVGTextLineText(n,a,t+r,o),o+=this.getHeightOfLine(a);return{textSpans:n,textBgRects:i}},_createTextCharSpan:function(n,i,o,a){var s=n!==n.trim()||n.match(r),l=this.getSvgSpanStyles(i,s),c=l?'style="'+l+'"':"",u=i.deltaY,d="",h=t.Object.NUM_FRACTION_DIGITS;return u&&(d=' dy="'+e(u,h)+'" '),['<tspan x="',e(o,h),'" y="',e(a,h),'" ',d,c,">",t.util.string.escapeXml(n),"</tspan>"].join("")},_setSVGTextLineText:function(e,r,n,i){var o,a,s,l,c,u=this.getHeightOfLine(r),d=-1!==this.textAlign.indexOf("justify"),h="",f=0,p=this._textLines[r];i+=u*(1-this._fontSizeFraction)/this.lineHeight;for(var g=0,m=p.length-1;g<=m;g++)c=g===m||this.charSpacing,h+=p[g],s=this.__charBounds[r][g],0===f?(n+=s.kernedWidth-s.width,f+=s.width):f+=s.kernedWidth,d&&!c&&this._reSpaceAndTab.test(p[g])&&(c=!0),c||(o=o||this.getCompleteStyleDeclaration(r,g),a=this.getCompleteStyleDeclaration(r,g+1),c=t.util.hasStyleChanged(o,a,!0)),c&&(l=this._getStyleDeclaration(r,g)||{},e.push(this._createTextCharSpan(h,l,n,i)),h="",o=a,n+=f,f=0)},_pushTextBgRect:function(r,n,i,o,a,s){var l=t.Object.NUM_FRACTION_DIGITS;r.push("\t\t<rect ",this._getFillAttributes(n),' x="',e(i,l),'" y="',e(o,l),'" width="',e(a,l),'" height="',e(s,l),'"></rect>\n')},_setSVGTextLineBg:function(e,t,r,n){for(var i,o,a=this._textLines[t],s=this.getHeightOfLine(t)/this.lineHeight,l=0,c=0,u=this.getValueOfPropertyAt(t,0,"textBackgroundColor"),d=0,h=a.length;d<h;d++)i=this.__charBounds[t][d],(o=this.getValueOfPropertyAt(t,d,"textBackgroundColor"))!==u?(u&&this._pushTextBgRect(e,u,r+c,n,l,s),c=i.left,l=i.width,u=o):l+=i.kernedWidth;o&&this._pushTextBgRect(e,o,r+c,n,l,s)},_getFillAttributes:function(e){var r=e&&"string"==typeof e?new t.Color(e):"";return r&&r.getSource()&&1!==r.getAlpha()?'opacity="'+r.getAlpha()+'" fill="'+r.setAlpha(1).toRgb()+'"':'fill="'+e+'"'},_getSVGLineTopOffset:function(e){for(var t,r=0,n=0;n<e;n++)r+=this.getHeightOfLine(n);return t=this.getHeightOfLine(n),{lineTop:r,offset:(this._fontSizeMult-this._fontSizeFraction)*t/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(e){return t.Object.prototype.getSvgStyles.call(this,e)+" white-space: pre;"}})}(),function(e){var t=e.fabric||(e.fabric={});t.Textbox=t.util.createClass(t.IText,t.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:t.Text.prototype._dimensionAffectingProps.concat("width"),_wordJoiners:/[ \t\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(e){for(var t=0,r=0,n=0,i={},o=0;o<e.graphemeLines.length;o++)"\n"===e.graphemeText[n]&&o>0?(r=0,n++,t++):!this.splitByGrapheme&&this._reSpaceAndTab.test(e.graphemeText[n])&&o>0&&(r++,n++),i[o]={line:t,offset:r},n+=e.graphemeLines[o].length,r+=e.graphemeLines[o].length;return i},styleHas:function(e,r){if(this._styleMap&&!this.isWrapping){var n=this._styleMap[r];n&&(r=n.line)}return t.Text.prototype.styleHas.call(this,e,r)},isEmptyStyles:function(e){if(!this.styles)return!0;var t,r,n=0,i=!1,o=this._styleMap[e],a=this._styleMap[e+1];for(var s in o&&(e=o.line,n=o.offset),a&&(i=a.line===e,t=a.offset),r=typeof e>"u"?this.styles:{line:this.styles[e]})for(var l in r[s])if(l>=n&&(!i||l<t))for(var c in r[s][l])return!1;return!0},_getStyleDeclaration:function(e,t){if(this._styleMap&&!this.isWrapping){var r=this._styleMap[e];if(!r)return null;e=r.line,t=r.offset+t}return this.callSuper("_getStyleDeclaration",e,t)},_setStyleDeclaration:function(e,t,r){var n=this._styleMap[e];e=n.line,t=n.offset+t,this.styles[e][t]=r},_deleteStyleDeclaration:function(e,t){var r=this._styleMap[e];e=r.line,t=r.offset+t,delete this.styles[e][t]},_getLineStyle:function(e){var t=this._styleMap[e];return!!this.styles[t.line]},_setLineStyle:function(e){var t=this._styleMap[e];this.styles[t.line]={}},_wrapText:function(e,t){var r,n=[];for(this.isWrapping=!0,r=0;r<e.length;r++)n=n.concat(this._wrapLine(e[r],r,t));return this.isWrapping=!1,n},_measureWord:function(e,t,r){var n,i=0;r=r||0;for(var o=0,a=e.length;o<a;o++){i+=this._getGraphemeBox(e[o],t,o+r,n,true).kernedWidth,n=e[o]}return i},_wrapLine:function(e,r,n,i){var o=0,a=this.splitByGrapheme,s=[],l=[],c=a?t.util.string.graphemeSplit(e):e.split(this._wordJoiners),u="",d=0,h=a?"":" ",f=0,p=0,g=0,m=!0,v=this._getWidthOfCharSpacing();i=i||0;0===c.length&&c.push([]),n-=i;for(var y=0;y<c.length;y++)u=a?c[y]:t.util.string.graphemeSplit(c[y]),f=this._measureWord(u,r,d),d+=u.length,(o+=p+f-v)>n&&!m?(s.push(l),l=[],o=f,m=!0):o+=v,!m&&!a&&l.push(h),l=l.concat(u),p=a?0:this._measureWord([h],r,d),d++,m=!1,f>g&&(g=f);return y&&s.push(l),g+i>this.dynamicMinWidth&&(this.dynamicMinWidth=g-v+i),s},isEndOfWrapping:function(e){return!this._styleMap[e+1]||this._styleMap[e+1].line!==this._styleMap[e].line},missingNewlineOffset:function(e){return this.splitByGrapheme?this.isEndOfWrapping(e)?1:0:1},_splitTextIntoLines:function(e){for(var r=t.Text.prototype._splitTextIntoLines.call(this,e),n=this._wrapText(r.lines,this.width),i=new Array(n.length),o=0;o<n.length;o++)i[o]=n[o].join("");return r.lines=i,r.graphemeLines=n,r},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var e={};for(var t in this._styleMap)this._textLines[t]&&(e[this._styleMap[t].line]=1);for(var t in this.styles)e[t]||delete this.styles[t]},toObject:function(e){return this.callSuper("toObject",["minWidth","splitByGrapheme"].concat(e))}}),t.Textbox.fromObject=function(e,r){var n=t.util.stylesFromArray(e.styles,e.text),i=Object.assign({},e,{styles:n});return t.Object._fromObject("Textbox",i,r,"text")}}(e),function(){var e=t.controlsUtils,r=e.scaleSkewCursorStyleHandler,n=e.scaleCursorStyleHandler,i=e.scalingEqually,o=e.scalingYOrSkewingX,a=e.scalingXOrSkewingY,s=e.scaleOrSkewActionName,l=t.Object.prototype.controls;if(l.ml=new t.Control({x:-.5,y:0,cursorStyleHandler:r,actionHandler:a,getActionName:s}),l.mr=new t.Control({x:.5,y:0,cursorStyleHandler:r,actionHandler:a,getActionName:s}),l.mb=new t.Control({x:0,y:.5,cursorStyleHandler:r,actionHandler:o,getActionName:s}),l.mt=new t.Control({x:0,y:-.5,cursorStyleHandler:r,actionHandler:o,getActionName:s}),l.tl=new t.Control({x:-.5,y:-.5,cursorStyleHandler:n,actionHandler:i}),l.tr=new t.Control({x:.5,y:-.5,cursorStyleHandler:n,actionHandler:i}),l.bl=new t.Control({x:-.5,y:.5,cursorStyleHandler:n,actionHandler:i}),l.br=new t.Control({x:.5,y:.5,cursorStyleHandler:n,actionHandler:i}),l.mtr=new t.Control({x:0,y:-.5,actionHandler:e.rotationWithSnapping,cursorStyleHandler:e.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),t.Textbox){var c=t.Textbox.prototype.controls={};c.mtr=l.mtr,c.tr=l.tr,c.br=l.br,c.tl=l.tl,c.bl=l.bl,c.mt=l.mt,c.mb=l.mb,c.mr=new t.Control({x:.5,y:0,actionHandler:e.changeWidth,cursorStyleHandler:r,actionName:"resizing"}),c.ml=new t.Control({x:-.5,y:0,actionHandler:e.changeWidth,cursorStyleHandler:r,actionName:"resizing"})}}()}(OC);const MC={lockScalingFlip:!0,originY:"center",originX:"center",lockMovementX:!0,lockMovementY:!0,borderColor:"transparent"};function RC(e=36){let t="";const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<e;n+=1)t+=r.charAt(Math.floor(62*Math.random()));return t}let LC=null;function NC(e){LC=e}class jC{constructor(){zl(this,"maxZoom",2),zl(this,"minZoom",1),zl(this,"step",.05),this.allowUserZoom&&this.bindMouseWheel(),$m.subscribe(e=>e.stageSize,()=>{setTimeout(()=>{this.fitToScreen()},1)})}get allowUserZoom(){var e,t,r;return(null==(r=null==(t=null==(e=qm().config)?void 0:e.tools)?void 0:t.zoom)?void 0:r.allowUserZoom)??!0}get currentZoom(){return qm().zoom}zoomIn(e=this.step){this.set(this.currentZoom+e)}canZoomIn(e=this.step){return this.currentZoom+e<=this.maxZoom}canZoomOut(e=this.step){return this.currentZoom-e>=this.minZoom}zoomOut(e=this.step){this.set(this.currentZoom-e)}set(e,t=!0){if(e<this.minZoom||e>this.maxZoom)return;const r=Kl.round(qm().original.width*e,0),n=Kl.round(qm().original.height*e,0);Ym().setZoom(e),t&&Ym().setDimensions({width:r,height:n}),qm().setZoom(e)}fitToScreen(){var e,t;if(null==(t=null==(e=qm().config.tools)?void 0:e.zoom)||!t.fitImageToScreen)return;const{width:r,height:n}=qm().stageSize,i=Math.max(n,1),o=Math.max(r,1);if(qm().original.height>i||qm().original.width>o){const e=Math.min(i/qm().original.height,o/qm().original.width);this.minZoom=Math.min(e,1)}else this.minZoom=1;this.set(this.minZoom)}bindMouseWheel(){Ym().on("mouse:wheel",e=>{e.e.preventDefault(),e.e.stopPropagation(),null==LC&&(e.e.deltaY<0?this.zoomIn():this.zoomOut())})}}function DC(e){return new Promise(t=>{OC.fabric.util.loadImage(e,e=>t(new OC.fabric.Image(e)),null,qm().config.crossOrigin?"anonymous":void 0)})}function zC(){return!(qm().config.image||qm().config.blankCanvasSize||Ym()&&0!==Ym().getObjects().length)}class BC{constructor(){zl(this,"minWidth",50),zl(this,"minHeight",50)}resize(e,t,{applyZoom:r=!1,resizeHelper:n=!0}={}){const i=qm().zoom;Ym().setWidth(e*(r?i:1)),Ym().setHeight(t*(r?i:1)),qm().setOriginal(e,t),n&&Gm().transform.resetStraightenAnchor()}async addMainImage(e,t="mainImage"){var r,n;qm().toggleLoading(t);const i=await DC(e);if(i)return this.clear(),i.set(Zm),i.name=zg.MainImage,Ym().add(i),this.resize(i.width,i.height),i.center(),i.setCoords(),Gm().zoom.fitToScreen(),qm().toggleLoading(!1),null==(n=(r=qm().config).onMainImageLoaded)||n.call(r,i),i}openNew(e,t,r){return e=Math.max(this.minWidth,e),t=Math.max(this.minHeight,t),this.clear(),this.resize(e,t),Ym().backgroundColor=r,Gm().zoom.fitToScreen(),qm().toggleLoading("newCanvas"),requestAnimationFrame(()=>{qm().toggleLoading(!1)}),Promise.resolve({width:e,height:t})}getMainImage(){return Ym().getObjects().find(e=>e.name===zg.MainImage)}render(){Ym().requestRenderAll()}async loadInitialContent(){var e,t;const r=qm().config.image,n=qm().config.blankCanvasSize,i=qm().config.state;if(r&&r.endsWith("json")){const e=await Km(r);await Gm().import.loadState(e)}else r&&r.startsWith('{"canvas')?await Gm().import.loadState(r):r?await this.addMainImage(r):i?await Gm().import.loadState(i):n&&await this.openNew(n.width,n.height);return zC()&&null!=(t=null==(e=qm().config.ui)?void 0:e.openImageDialog)&&t.show&&qm().togglePanel("newImage",!0),new Promise(e=>{setTimeout(()=>{Gm().history.addInitial(),e()},10)})}clear(){Ym().clear(),Gm().frame.remove(),Gm().transform.resetStraightenAnchor()}}const UC=["fontSize","fontFamily","left","top","width","height","scaleX","scaleY","flipX","flipY","angle","src","strokeWidth"];function VC(e={}){Ym().fire("object:modified",function(e){return{values:e,sizeOrPositionChanged:HC(e)}}(e))}function HC(e){return Object.keys(e).some(e=>UC.includes(e))}function WC(e){var t,r;const[n]=ev(null==(t=e.selected)?void 0:t[0]),i=n===qm().activeTool;return!(!qm().dirty||null!=(r=e.selected)&&r[0]&&i)&&(e.deselected&&Gm().objects.select(e.deselected[0]),!0)}function $C(e){(null==e?void 0:e.data.id)!==qm().objects.active.id&&(qm().objects.setActive(e??null),qm().activeTool!==Ef.DRAW&&Jm())}class qC{constructor(){this.syncObjects(),qm().fabric.on("selection:created",e=>{var t;null!=(t=e.selected)&&t[0]&&!WC(e)&&$C(e.selected[0])}),qm().fabric.on("selection:updated",e=>{var t;WC(e)||$C(null==(t=e.selected)?void 0:t[0])}),qm().fabric.on("selection:cleared",()=>{$C()}),qm().fabric.on("text:editing:entered",()=>{qm().objects.setIsEditingText(!0)}),qm().fabric.on("text:editing:exited",()=>{qm().objects.setIsEditingText(!1)}),qm().fabric.on("object:added",()=>{this.syncObjects()}),qm().fabric.on("object:removed",()=>{this.syncObjects()})}getAll(){return Ym().getObjects().filter(e=>{var t;return!(null!=(t=null==e?void 0:e.data)&&t.pixieInternal)})}get(e){return this.getAll().find(t=>t.name===e)}getById(e){return this.getAll().find(t=>t.data.id===e)}isActive(e){var t;const r="string"==typeof e?e:e.data.id;return(null==(t=qm().objects.active)?void 0:t.id)===r}getActive(){return Ym().getActiveObject()}has(e){return this.getAll().findIndex(t=>t.name===e)>-1}select(e){const t="string"==typeof e?this.getById(e):e;t&&(Ym().setActiveObject(t),Ym().requestRenderAll())}deselectActive(){Ym().discardActiveObject(),Ym().requestRenderAll()}setValues(e,t){if(!(t=t||this.getActive()))return;let r=!1;(function(e){return e.name===zg.Sticker&&"forEachObject"in e})(t)&&e.fill&&e.fill!==t.fill&&t.forEachObject(t=>t.set("fill",e.fill)),Dg(t)?((e.fontFamily!==t.fontFamily||e.fontSize!==t.fontSize)&&(r=!0),t.selectionStart!==t.selectionEnd?t.setSelectionStyles(e):t.set(e)):t.set(e),r?setTimeout(()=>{Ym().requestRenderAll()},50):Ym().requestRenderAll(),qm().objects.setActive(t),VC(e)}move(e,t=1,r){(r=r||this.getActive())&&("up"===e?this.setValues({top:r.top-t}):"down"===e?this.setValues({top:r.top+t}):"left"===e?this.setValues({left:r.left-t}):"right"===e&&this.setValues({left:r.left+t}),Gm().canvas.render())}bringToFront(e){(e=e||this.getActive())&&(e.bringToFront(),Gm().canvas.render())}sendToBack(e){(e=e||this.getActive())&&(e.sendToBack(),Gm().canvas.render())}flipHorizontally(e){(e=e||this.getActive())&&(this.setValues({flipX:!e.flipX}),Gm().canvas.render())}duplicate(e){const t=e||this.getActive();t&&(this.deselectActive(),t.clone(e=>{e.set({left:t.left+40,top:t.top+40,data:{...t.data,id:RC(10)},name:t.name}),Ym().add(e),this.select(e),Gm().canvas.render()}))}delete(e){(e=e||this.getActive())&&(this.deselectActive(),Ym().remove(e),Ym().requestRenderAll(),Gm().history.addHistoryItem({name:"deletedObject"}))}syncObjects(){const e=this.getAll().map(e=>({name:e.name,selectable:e.selectable??!1,id:e.data.id}));$m.setState({objects:{...qm().objects,all:e}})}}const GC={frame:null,fonts:[]};function YC(e){return e.state||(e.state=Qm()),{...e.state||Qm(),name:e.name,id:RC(15)}}function XC(e){return!!e&&/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(e)}function KC(e){return e?XC(e)?e:`${qm().config.baseUrl?`${qm().config.baseUrl}/`:""}${e}`:""}function ZC(e,t){return t||btoa(e.split("/").pop())}const QC=new class{constructor(){zl(this,"loadedAssets",{})}loadAsset(e,t={type:"js"}){var r;e=e.startsWith("//")?`${window.location.protocol}${e}`:e;const n=null==(r=this.loadedAssets[e])?void 0:r.state;return"loaded"!==n||t.force?!n||this.loadedAssets[e].doc!==t.document||t.force&&"loaded"===n?(this.loadedAssets[e]={state:new Promise(r=>{const n={url:XC(e)?e:`assets/${e}`,id:ZC(e,t.id),resolve:r,parentEl:t.parentEl,document:t.document};"css"===t.type?this.loadStyleAsset(n):this.loadScriptAsset(n)}),doc:t.document},this.loadedAssets[e].state):this.loadedAssets[e].state:new Promise(e=>e())}isLoadingOrLoaded(e){return null!=this.loadedAssets[e]}loadStyleAsset(e){var t;const r=e.document||document,n=e.parentEl||r.head,i=r.createElement("link"),o=ZC(e.url,e.id);i.rel="stylesheet",i.id=o,i.href=e.url;try{n.querySelector(`#${o}`)&&(null==(t=n.querySelector(`#${o}`))||t.remove())}catch{}i.onload=()=>{this.loadedAssets[e.url].state="loaded",e.resolve()},n.appendChild(i)}loadScriptAsset(e){var t;const r=e.document||document,n=e.parentEl||r.body,i=r.createElement("script"),o=ZC(e.url,e.id);i.async=!0,i.id=o,i.src=e.url;try{n.querySelector(`#${o}`)&&(null==(t=n.querySelector(`#${o}`))||t.remove())}catch{}i.onload=()=>{this.loadedAssets[e.url].state="loaded",e.resolve()},(n||n).appendChild(i)}};function JC(e){return`be-fonts-${e}`}function e_(e,t){const r=t.document||document,n=[],i=[];let o=[];if(e.forEach(e=>{"google"in e&&e.google?n.push(e):"src"in e&&i.push(e)}),null!=n&&n.length){const n=t.weights||[400],i=e.map(e=>`${e.family}:${n.join(",")}`).join("|"),a=QC.loadAsset(`https://fonts.googleapis.com/css?family=${i}&display=swap`,{type:"css",id:JC(t.id),force:t.forceAssetLoad,document:r});o.push(a)}if(null!=i&&i.length){const e=i.map(async e=>{const n=Array.from(r.fonts.values()).find(t=>t.family===e.family);if(n)return n.loaded;const i=new FontFace(e.family,`url(${null!=t&&t.prefixSrc?t.prefixSrc(e.src):e.src})`,e.descriptors);return r.fonts.add(i),i.load()});o=o.concat(e)}return Promise.all(o)}class t_{async undo(){if(this.canUndo()){const e=qm().history.items[qm().history.pointer-1];await this.load(e)}}async redo(){if(this.canRedo()){const e=qm().history.items[qm().history.pointer+1];await this.load(e)}}canUndo(){return qm().history.canUndo}canRedo(){return qm().history.canRedo}reload(){return this.load(qm().history.items[qm().history.pointer])}replaceCurrent(){const e=qm().history.items[qm().history.pointer];[...qm().history.items][qm().history.pointer]=YC({name:e.name,state:e})}addHistoryItem(e){const t=YC(e),r=[...qm().history.items.slice(0,qm().history.pointer+1),t];qm().history.update(r.length-1,r)}load(e){return e={...e,editor:e.editor||GC},new Promise(t=>{e_(function(e){const t=[];return e.forEach(e=>{var r,n,i;if(!Dg(e))return;const o=null==(i=null==(n=null==(r=qm().config.tools)?void 0:r.text)?void 0:n.items)?void 0:i.find(t=>t.family===e.fontFamily);o&&t.push(o)}),t}(e.canvas.objects),{prefixSrc:KC,id:"pixie-fonts"}).finally(()=>{Ym().loadFromJSON(e.canvas,()=>{Gm().zoom.set(1),e.canvasWidth&&e.canvasHeight&&Gm().canvas.resize(e.canvasWidth,e.canvasHeight,{resizeHelper:!1,applyZoom:!1}),Gm().frame.remove(),e.editor.frame&&Gm().frame.add(e.editor.frame.name,e.editor.frame.sizePercent),Gm().objects.syncObjects(),Gm().objects.getAll().forEach(e=>{var t,r;if(!e.data.pixieInternal&&"left"===e.originX&&"top"===e.originY){const t=e.getPointByOrigin("center","center");e.set("left",t.x),e.set("top",t.y)}e.set({...MC}),"i-text"===e.type&&(e.padding=null==(r=null==(t=qm().config.tools)?void 0:t.text)?void 0:r.controlsPadding)}),Gm().canvas.render(),Ym().calcOffset(),Gm().zoom.fitToScreen(),qm().history.updatePointerById(e.id),Gm().transform.resetStraightenAnchor(),t()})})})}addInitial(e){!qm().history.items.find(e=>"initial"===e.name)&&(e||!zC())&&this.addHistoryItem({name:"initial",state:e})}}class r_{canMerge(){return Gm().objects.getAll().filter(e=>e.name!==zg.MainImage).length>0}async apply(){qm().toggleLoading("merge");const e=Gm().export.getDataUrl();e&&await Gm().canvas.addMainImage(e,"merge")}}const n_=[{name:"grayscale"},{name:"blackWhite",fabricType:"blackwhite"},{name:"sharpen",uses:"Convolute",matrix:[0,-1,0,-1,5,-1,0,-1,0]},{name:"invert"},{name:"vintage"},{name:"polaroid"},{name:"kodachrome"},{name:"technicolor"},{name:"brownie"},{name:"sepia"},{name:"removeColor",fabricType:"removecolor",options:{distance:{type:"slider",current:.1,min:0,max:1,step:.01},color:{current:"#fff",type:"colorPicker"}}},{name:"brightness",options:{brightness:{type:"slider",current:.1,min:-1,max:1,step:.1}}},{name:"gamma",options:{red:{type:"slider",current:.1,min:.2,max:2.2,step:.003921},green:{type:"slider",current:.1,min:.2,max:2.2,step:.003921},blue:{type:"slider",current:.1,min:.2,max:2.2,step:.003921}},apply:e=>{e.gamma=[e.red,e.green,e.blue]}},{name:"noise",options:{noise:{type:"slider",current:40,min:1,max:600}}},{name:"pixelate",options:{blocksize:{type:"slider",min:1,max:40,current:6}}},{name:"blur",uses:"Convolute",matrix:[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9]},{name:"emboss",uses:"Convolute",matrix:[1,1,1,1,.7,-1,-1,-1,-1]},{name:"blendColor",fabricType:"blendcolor",options:{alpha:{type:"slider",current:.5,min:.1,max:1,step:.1},mode:{current:"add",type:"select",available:[{key:"add"},{key:"multiply"},{key:"subtract"},{key:"diff"},{key:"screen"},{key:"lighten"},{key:"darken"}]},color:{type:"colorPicker",current:"#FF4081"}}}],i_={grayscale:wf("grayscale"),blackWhite:wf("Black & White"),sharpen:wf("Sharpen"),invert:wf("Invert"),vintage:wf("Vintage"),polaroid:wf("Polaroid"),kodachrome:wf("Kodachrome"),technicolor:wf("Technicolor"),brownie:wf("Brownie"),sepia:wf("Sepia"),removeColor:wf("Remove Color"),brightness:wf("Brightness"),gamma:wf("Gamma"),noise:wf("Noise"),pixelate:wf("Pixelate"),blur:wf("Blur"),emboss:wf("Emboss"),blendColor:wf("Blend Color")},o_={distance:wf("distance"),color:wf("color"),brightness:wf("brightness"),red:wf("red"),green:wf("green"),blue:wf("blue"),noise:wf("noise"),blocksize:wf("blocksize"),mode:wf("mode"),alpha:wf("alpha")};function a_(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}class s_{constructor(){$m.subscribe(e=>e.history.pointer,()=>{this.syncState()})}apply(e){qm().filter.select(e,this.hasOptions(e));const t=this.getByName(e);if(this.isApplied(t.name))return void this.remove(t.name);const r=this.create(t);this.getImages().forEach(e=>{var t;null==(t=e.filters)||t.push(r),e.applyFilters()}),this.syncState(),Gm().canvas.render()}remove(e){qm().filter.deselect(e);const t=this.getByName(e);this.getImages().forEach(e=>{var r;const n=this.findFilterIndex(t.name,e.filters);null==(r=e.filters)||r.splice(n,1),e.applyFilters()}),this.syncState(),Gm().canvas.render()}getAll(){return n_}getByName(e){return n_.find(t=>t.name===e)}isApplied(e){const t=Gm().canvas.getMainImage();return!!t&&this.findFilterIndex(e,t.filters)>-1}applyValue(e,t,r){const n=this.getByName(e);this.getImages().forEach(e=>{const i=(e.filters||[]).find(e=>e.type.toLowerCase()===n.name.toLowerCase());i&&(i[t]=r,n.apply&&n.apply(i,t,r),e.applyFilters())}),Gm().canvas.render()}addCustom(e,t,r,n){const i=OC.fabric.Image.filters;i[a_(e)]=OC.fabric.util.createClass(i.BaseFilter,t),i[a_(e)].fromObject=i.BaseFilter.fromObject,n_.push({name:e,options:r,initialConfig:n})}create(e){const t=e.initialConfig||{};let r;return e.uses?(t.matrix=e.matrix,r=new(OC.fabric.Image.filters[a_(e.uses)])(t)):(Object.entries(e.options||{}).forEach(([e,r])=>{t[e]=r.current}),r=new(OC.fabric.Image.filters[a_(e.name)])(t)),r.name=e.name,r}hasOptions(e){return!!this.getByName(e).options}findFilterIndex(e,t){if(null==t||!t.length)return-1;const r=this.getByName(e);return t.findIndex(e=>this.configMatchesFabricFilter(r,e))}syncState(){var e;const t=[];((null==(e=this.getImages()[0])?void 0:e.filters)||[]).forEach(e=>{const r=this.getByFabricFilter(e);r&&t.push(r.name)}),$m.setState({filter:{...qm().filter,applied:t}})}getByFabricFilter(e){return n_.find(t=>this.configMatchesFabricFilter(t,e))}configMatchesFabricFilter(e,t){const r=t.type.toLowerCase().replace(" ","");return r===e.fabricType||r===e.name||"convolute"===r&&this.matrixAreEqual(e.matrix,t.matrix)}matrixAreEqual(e,t){if(!e||!t||e.length!==t.length)return!1;for(let r=e.length;r--;)if(e[r]!==t[r])return!1;return!0}getImages(){return Gm().objects.getAll().filter(e=>e.name===zg.Image||e.name===zg.MainImage)}}function l_(e){var t,r;const n=(null==(r=null==(t=qm().config.tools)?void 0:t.resize)?void 0:r.minWidth)||50;return e?Math.ceil(100*n/qm().original.width):n}function c_(e){var t,r;const n=(null==(r=null==(t=qm().config.tools)?void 0:t.resize)?void 0:r.maxWidth)||2400;return e?Math.ceil(100*n/qm().original.width):n}function u_(e){var t,r;const n=(null==(r=null==(t=qm().config.tools)?void 0:t.resize)?void 0:r.minHeight)||50;return e?Math.ceil(100*n/qm().original.height):n}function d_(e){var t,r;const n=(null==(r=null==(t=qm().config.tools)?void 0:t.resize)?void 0:r.maxHeight)||2400;return e?Math.ceil(100*n/qm().original.height):n}function h_(e,t){if(t)return e;const r=qm().original.height/e;return Math.floor(qm().original.width/r)}function f_(e,t){if(t)return e;const r=qm().original.width/e;return Math.floor(qm().original.height/r)}class p_{apply(e){const{width:t,height:r,usePercentages:n}=function(e){return e.width<l_(e.usePercentages)&&(e.width=l_(e.usePercentages),e.maintainAspect&&(e.height=f_(e.width,e.usePercentages))),e.width>c_(e.usePercentages)&&(e.width=c_(e.usePercentages),e.maintainAspect&&(e.height=f_(e.width,e.usePercentages))),e.height<u_(e.usePercentages)&&(e.height=u_(e.usePercentages),e.maintainAspect&&(e.width=h_(e.height,e.usePercentages))),e.height>d_(e.usePercentages)&&(e.height=d_(e.usePercentages),e.maintainAspect&&(e.width=h_(e.height,e.usePercentages))),e}(e),i=Math.ceil(qm().original.width),o=Math.ceil(qm().original.height),a=Math.ceil(t),s=Math.ceil(r);let l,c;n?(l=t/100,c=r/100):(l=t/qm().original.width,c=r/qm().original.height),(i!==a||o!==s)&&this.resize(l,c)}resize(e,t){Gm().zoom.set(1,!1);const r=Math.round(qm().original.height*t),n=Math.round(qm().original.width*e);Gm().canvas.resize(n,r,{applyZoom:!1,resizeHelper:!0}),Gm().objects.getAll().forEach(r=>{const n=r.scaleX||1,i=r.scaleY||1,o=r.left||0,a=r.top||0,s=n*e,l=i*t,c=o*e,u=a*t;r.scaleX=s,r.scaleY=l,r.left=c,r.top=u,r.setCoords()}),Gm().zoom.fitToScreen(),Ym().requestRenderAll()}}function g_(e,t){null!==t.innerZone&&(function(e,t){t.innerZone.style.width=`${e.width}px`,t.innerZone.style.height=`${e.height}px`,t.innerZone.style.transform=`translate(${e.left}px, ${e.top}px)`}(e,t),function(e,t){const r=qm().canvasSize.width,n=qm().canvasSize.height;t.maskTop.style.height=`${e.top}px`,t.maskTop.style.width=`${r}px`,t.maskLeft.style.top=`${e.top}px`,t.maskLeft.style.height=`${e.height}px`,t.maskLeft.style.width=`${e.left}px`;const i=e.left+e.width;t.maskRight.style.left=`${i}px`,t.maskRight.style.top=`${e.top}px`,t.maskRight.style.height=`${e.height}px`,t.maskRight.style.width=r-i+"px",t.maskBottom.style.height=n-(e.top+e.height)+"px",t.maskBottom.style.width=`${r}px`}(e,t),function(e,t){const r=(e.width-2)/3;t.lineVer1.style.height=`${e.height}px`,t.lineVer1.style.transform=`translate(${r}px, 0)`,t.lineVer2.style.height=`${e.height}px`,t.lineVer2.style.transform=`translate(${2*r}px, 0)`;const n=(e.height-2)/3;t.lineHor1.style.width=`${e.width}px`,t.lineHor1.style.transform=`translate(0, ${n}px)`,t.lineHor2.style.width=`${e.width}px`,t.lineHor2.style.transform=`translate(0, ${2*n}px)`}(e,t))}function m_(e,t,r){let n=t,i=r;return e&&(r*e>t?i=t/e:n=r*e),{width:Math.floor(n),height:Math.floor(i)}}function v_(e){if(!e)return null;const t=e.split(":");return parseInt(t[0])/parseInt(t[1])}class y_{constructor(){zl(this,"refs",null)}apply(e){var t;const r=null==(t=Gm().frame.active.config)?void 0:t.name,n=Gm().frame.active.currentSizeInPercent;return Gm().frame.active.hide(),Gm().merge.apply().then(()=>{Gm().canvas.resize(Math.round(e.width),Math.round(e.height),{applyZoom:!0,resizeHelper:!0});const t=Gm().canvas.getMainImage();t.cropX=Math.round(e.left),t.cropY=Math.round(e.top),t.width=Math.round(e.width),t.height=Math.round(e.height),t.viewportCenter(),r&&Gm().frame.add(r,n),Gm().zoom.fitToScreen(),Gm().canvas.render()})}drawZone(e){var t;null!=(t=this.refs)&&t.current&&(qm().crop.setCropzoneRect(e),g_(e,this.refs.current))}resetCropzone(e){const t=qm().canvasSize,r=v_(e);if(!t)return;qm().crop.setAspectRatio(e);const n=function(e,t=null){const r={width:e.width,height:e.height,top:0,left:0,angle:0};if(t){const e=m_(t,r.width,r.height);r.width=e.width,r.height=e.height}return r.left=(e.width-r.width)/2,r.top=(e.height-r.height)/2,r}(t,r);this.drawZone(n)}registerRefs(e){this.refs=e}}class b_{getShapeByName(e){var t,r;const n=null==(r=null==(t=qm().config.tools)?void 0:t.shapes)?void 0:r.items;return(null==n?void 0:n.find(t=>t.name===e))||null}addBasicShape(e){var t;const r=this.getShapeByName(e);if(!r)return null;const{width:n,height:i,...o}=(null==(t=qm().config.objectDefaults)?void 0:t.shape)||{},a={...o,...r.options};let s;if("circle"===r.name)s=new OC.fabric.Circle({...a,radius:100});else if("ellipse"===r.name)s=new OC.fabric.Ellipse({...a,rx:100,ry:50});else if("Path"===r.type)s=new OC.fabric.Path(a.path,{displayName:r.name,...a});else{const e=r.type;s=new OC.fabric[e]({...a,width:150,height:150})}return this.addAndPositionShape(s,zg.Shape,{width:n,height:i}),s}addSticker(e,t){var r,n,i;const o=null==(i=null==(n=null==(r=qm().config.tools)?void 0:r.stickers)?void 0:n.items)?void 0:i.find(t=>t.name===e);if(!o)return Promise.resolve();if("svg"===o.type){const e=w_(o,t);return this.addSvgSticker(e)}return this.addRegularSticker(o,t)}addRegularSticker(e,t){return new Promise(r=>{OC.fabric.util.loadImage(w_(e,t),e=>{var t;const{width:n,height:i,...o}=(null==(t=qm().config.objectDefaults)?void 0:t.sticker)||{},a=new OC.fabric.Image(e,o);this.addAndPositionShape(a,zg.Sticker,{width:n,height:i}),r()})})}addSvgSticker(e,t=zg.Sticker){return new Promise(r=>{OC.fabric.loadSVGFromURL(e,(e,n)=>{var i;const{width:o,height:a,...s}=(null==(i=qm().config.objectDefaults)?void 0:i.sticker)||{},l=OC.fabric.util.groupSVGElements(e,n);l.set(s),this.addAndPositionShape(l,t,{width:o,height:a}),r()})})}addAndPositionShape(e,t,{width:r}){e.name=t,e.scaleX=1,e.scaleY=1,Ym().add(e);const n=r||qm().original.width*qm().zoom/4;e.scaleToWidth(Math.min(150,n)),e.viewportCenter(),e.setCoords(),Gm().canvas.render(),Ym().setActiveObject(e)}}function w_(e,t){return KC(`images/stickers/${e.name}/${t}.${e.type}`)}class x_{constructor(e){zl(this,"patternCache",[]),this.activeFrame=e}fillParts(e){this.patternCache.forEach(t=>{this.fillPartWithPattern(t,e)})}fillPartWithPattern(e,t){if(!this.activeFrame.parts)return;e.canvas=new OC.fabric.StaticCanvas(null),e.canvas.add(e.img);const r=new OC.fabric.Pattern({source:e.canvas.getElement(),repeat:"repeat"===t?"repeat":"no-repeat"});this.activeFrame.parts[e.name]&&this.activeFrame.parts[e.name].set("fill",r)}scale(e){if(!this.activeFrame.config||!this.patternCache)return;const t=this.activeFrame.config.mode;e/=Ym().getRetinaScaling(),this.patternCache.forEach(r=>{this.activeFrame.parts&&("top"===r.name||"bottom"===r.name?"stretch"===t?(this.scalePatternToWidth(r.img,this.activeFrame.parts.top.getScaledWidth()),this.scalePatternToHeight(r.img,e)):r.img.scaleToHeight(e):"left"===r.name||"right"===r.name?"stretch"===t?(this.scalePatternToWidth(r.img,e),this.scalePatternToHeight(r.img,this.activeFrame.parts.left.getScaledHeight())):r.img.scaleToWidth(e):"stretch"===t?(this.scalePatternToWidth(r.img,e),this.scalePatternToHeight(r.img,e)):r.img.scaleToWidth(e),r.canvas.setDimensions({width:r.img.getScaledWidth(),height:r.img.getScaledHeight()}))}),Gm().canvas.render()}scalePatternToWidth(e,t){if(!e.width)return;const r=e.getBoundingRect().width/e.getScaledWidth();e.set("scaleX",t/e.width/r),e.setCoords()}scalePatternToHeight(e,t){if(!e.height)return;const r=e.getBoundingRect().height/e.getScaledHeight();e.set("scaleY",t/e.height/r),e.setCoords()}load(e){const t=this.activeFrame.getPartNames().map(t=>new Promise(r=>{const n={...Zm,originX:"left",originY:"top"};qm().config.crossOrigin&&(n.crossOrigin="anonymous"),OC.fabric.Image.fromURL(this.getPartUrl(e,t),e=>{r({name:t,img:e})},n)}));return Promise.all(t).then(t=>{this.patternCache=t,this.fillParts(e.mode)})}getPartUrl(e,t){return KC(`images/frames/${e.name}/${t}.png`)}}class C_{constructor(e,t){this.activeFrame=e,this.patterns=t}get defaultColor(){var e,t;return null==(t=null==(e=qm().config.objectDefaults)?void 0:e.global)?void 0:t.fill}build(e,t){this.createParts(e),this.resize(t),this.activeFrame.config=e,"basic"!==e.mode?this.patterns.load(e).then(()=>{this.patterns.scale(t),Gm().canvas.render()}):Gm().canvas.render()}createParts(e){const t={};this.activeFrame.getPartNames().forEach(r=>{const n="basic"===e.mode?this.defaultColor:void 0;t[r]=new OC.fabric.Rect({...Zm,fill:n,originX:"left",originY:"top",name:`frame.rect.${r}`,objectCaching:!1,data:{pixieInternal:!0}}),Ym().add(t[r])}),this.activeFrame.parts=t}resize(e){const t=qm().original.width,r=qm().original.height,n=this.activeFrame,i=e;n.parts&&(n.parts.topLeft.set({width:i,height:i}),n.parts.topRight.set({left:t-n.parts.topLeft.getScaledWidth(),width:i,height:i}),n.parts.top.set({left:n.parts.topLeft.getScaledWidth()-1,width:t-n.parts.topLeft.getScaledWidth()-n.parts.topRight.getScaledWidth()+3,height:i}),n.parts.bottomLeft.set({top:r-n.parts.topLeft.getScaledHeight(),width:i,height:i}),n.parts.left.set({top:n.parts.topLeft.getScaledHeight()-1,width:i,height:r-n.parts.topLeft.getScaledHeight()-n.parts.bottomLeft.getScaledHeight()+3}),n.parts.bottomRight.set({left:t-n.parts.bottomLeft.getScaledWidth(),top:r-n.parts.topRight.getScaledWidth(),width:i,height:i}),n.parts.bottom.set({left:n.parts.top.left,top:r-n.parts.top.getScaledHeight(),width:n.parts.top.getScaledWidth(),height:i}),n.parts.right.set({left:t-n.parts.left.getScaledWidth(),top:n.parts.left.top,width:n.parts.left.width,height:n.parts.left.getScaledHeight()}))}}class __{constructor(){zl(this,"corners",["topLeft","topRight","bottomLeft","bottomRight"]),zl(this,"sides",["top","right","bottom","left"]),zl(this,"parts",null),zl(this,"config",null),zl(this,"currentSizeInPercent",100)}getPartNames(){return[...this.corners,...this.sides]}hide(){this.parts&&(Object.values(this.parts).forEach(e=>e.set({visible:!1})),Gm().canvas.render())}show(){this.parts&&(Object.values(this.parts).forEach(e=>e.set({visible:!0})),Gm().canvas.render())}remove(){this.parts&&(this.config=null,Object.values(this.parts).forEach(e=>{Ym().remove(e)}),this.parts=null,Gm().canvas.render())}is(e){return!!this.config&&this.config.name===e.name}changeColor(e){var t;"basic"!==(null==(t=this.config)?void 0:t.mode)||!this.parts||(Object.values(this.parts).forEach(t=>{t.set("fill",e)}),Gm().canvas.render())}getMinSize(){var e;return(null==(e=this.config)?void 0:e.size.min)??1}getMaxSize(){var e;return(null==(e=this.config)?void 0:e.size.max)??35}}class S_{constructor(){zl(this,"patterns"),zl(this,"builder"),zl(this,"active"),this.active=new __,this.patterns=new x_(this.active),this.builder=new C_(this.active,this.patterns),Ym().on("object:added",()=>{Object.values(this.active.parts||[]).forEach(e=>e.moveTo(98))})}add(e,t){const r=this.getByName(e);if(!r||this.active.is(r))return;this.active.remove(),this.active.currentSizeInPercent=t??r.size.default;const n=this.calcFrameSizeInPixels(this.active.currentSizeInPercent);this.builder.build(r,n),qm().frame.select(r)}resize(e){if(!this.active.parts||!this.active.config)return;e?this.active.currentSizeInPercent=e:e=this.active.currentSizeInPercent;const t=this.calcFrameSizeInPixels(e);this.builder.resize(t),this.patterns.scale(t),Gm().canvas.render()}changeColor(e){this.active.changeColor(e)}remove(){this.active.remove(),qm().frame.deselect()}getByName(e){var t,r;const n=null==(r=null==(t=qm().config.tools)?void 0:t.frame)?void 0:r.items;if(n)return n.find(t=>t.name===e)}getActiveFrameConfig(){return this.active.config}calcFrameSizeInPixels(e){const t=Math.min(qm().original.width,qm().original.height);return Math.ceil(e/100*t)}}class A_{constructor(){zl(this,"minWidth",250)}add(e,t={}){var r,n,i,o,a;if(!(e=e||(null==(n=null==(r=qm().config.tools)?void 0:r.text)?void 0:n.defaultText)))return;const s={...null==(i=qm().config.objectDefaults)?void 0:i.text,...t,name:zg.Text,padding:null==(a=null==(o=qm().config.tools)?void 0:o.text)?void 0:a.controlsPadding,editingBorderColor:_f.fill},l=new OC.fabric.IText(e,s);Ym().add(l),null==t.left&&null==t.top&&this.autoPositionText(l),Gm().objects.select(l)}autoPositionText(e){const t=Ym().getWidth(),r=Ym().getHeight(),n=Math.min(Ym().getWidth(),this.minWidth);e.scaleToWidth(Math.max(t/3,n)),e.getScaledHeight()>r&&e.scaleToHeight(r-e.getScaledHeight()-20),e.viewportCenter(),Ym().getObjects("i-text").forEach(t=>{if(t!==e&&t.intersectsWithObject(e)){const r=t.top-e.top+t.getScaledHeight();let n=e.top+r;n>qm().original.height-t.getScaledHeight()&&(n=0),e.set("top",n),e.setCoords()}})}selectOrAddText(e,t={}){if(qm().objects.active.isText)return!1;const r=Gm().objects.getAll().find(e=>Dg(e));return r?(Gm().objects.select(r),!1):(this.add(e,t),!0)}}const k_=e=>{const t=new OC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=OC.fabric.document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext("2d");return t.strokeStyle=this.color,t.lineWidth=5,t.beginPath(),t.moveTo(0,5),t.lineTo(10,5),t.closePath(),t.stroke(),e},t},E_=e=>{const t=new OC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext("2d");return t.strokeStyle=this.color,t.lineWidth=5,t.beginPath(),t.moveTo(5,0),t.lineTo(5,10),t.closePath(),t.stroke(),e},t},I_=e=>{const t=new OC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=this.width/2,t=document.createElement("canvas"),r=new OC.fabric.Rect({width:e,height:e,angle:45,fill:this.color}),n=r.getBoundingRect().width;t.width=n+5,t.height=n+5,r.set({left:n/2,top:n/2});const i=t.getContext("2d");return r.render(i),t},t},T_=e=>{const t=new OC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=document.createElement("canvas");e.width=12,e.height=12;const t=e.getContext("2d");return t.fillStyle=this.color,t.fillRect(0,0,10,10),e},t};var F_,O_;class P_{constructor(){zl(this,"customBrushes",{VLineBrush:k_,HLineBrush:E_,DiamondBrush:I_,SquareBrush:T_}),zl(this,"currentBrush",{type:"PencilBrush",color:null==(O_=null==(F_=qm().config.objectDefaults)?void 0:F_.global)?void 0:O_.fill,width:Sf[1]}),zl(this,"onPathCreated",e=>{e.path.name=zg.Drawing,e.path.set(function(){const e={...Zm};return delete e.strokeWidth,e}()),qm().setDirty(!0)})}enable(){Ym().on("path:created",this.onPathCreated),Ym().isDrawingMode=!0,this.setBrushType(this.currentBrush.type),this.setBrushSize(this.currentBrush.width)}disable(){Ym().off("path:created",this.onPathCreated),Ym().isDrawingMode=!1}getBrushType(){return this.currentBrush.type}setBrushType(e){this.currentBrush.type=e,Ym().freeDrawingBrush=e in OC.fabric?new OC.fabric[e](Ym()):this.customBrushes[e](Ym()),this.applyBrushStyles()}applyBrushStyles(){Object.keys(this.currentBrush).forEach(e=>{Ym().freeDrawingBrush[e]=this.currentBrush[e]});const e=Ym().freeDrawingBrush;e.getPatternSrc&&(e.source=e.getPatternSrc.call(e))}setBrushSize(e){this.currentBrush.width=e,this.applyBrushStyles()}getBrushSize(){return this.currentBrush.width}setBrushColor(e){this.currentBrush.color=e,this.applyBrushStyles()}getBrushColor(){return this.currentBrush.color}}async function M_(e,t=!0,r=!0){const n=await DC(e);if(n)return new Promise(e=>{n.name=zg.Image,n.opacity=0;const i=qm().original.width,o=qm().original.height;if(t&&(n.width>=i||n.height>=o)){const e=i-.1*i,t=o-.1*o,r=1/Math.min(t/n.getScaledHeight(),e/n.getScaledWidth());n.scaleX*=1/r,n.scaleY*=1/r}qm().fabric.add(n),r&&qm().fabric.setActiveObject(n),n.viewportCenter(),n.setCoords(),qm().fabric.requestRenderAll(),Gm().zoom.fitToScreen(),n.animate("opacity","1",{duration:425,onChange:()=>{qm().fabric.requestRenderAll()},onComplete:()=>{e(n)}})})}function R_(e){var t;return(null==(t=/(?:\.([^.]+))?$/.exec(e))?void 0:t[1])||""}class L_{constructor(e,t){zl(this,"id"),zl(this,"fingerprint"),zl(this,"name"),zl(this,"relativePath",""),zl(this,"size"),zl(this,"mime",""),zl(this,"extension",""),zl(this,"native"),zl(this,"lastModified"),zl(this,"cachedData"),this.id=tv(),this.name=e.name,this.size=e.size,this.mime=function(e){const t={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif",yaml:"text/yaml",yml:"text/yaml",log:"text/plain"},r=e.name?R_(e.name):null;return e.type?e.type:r&&r in t?t[r]:"application/octet-stream"}(e),this.lastModified=e.lastModified,this.extension=R_(e.name)||"bin",this.native=e,(t=(t=t||e.webkitRelativePath||"").replace(/^\/+/g,""))&&t.split("/").length>1&&(this.relativePath=t),this.fingerprint=function({name:e,mime:t,size:r,relativePath:n,lastModified:i}){let o="be";return"string"==typeof e&&(o+=`-${N_(e.toLowerCase())}`),t&&(o+=`-${t}`),"string"==typeof n&&(o+=`-${N_(n.toLowerCase())}`),void 0!==r&&(o+=`-${r}`),void 0!==i&&(o+=`-${i}`),o}({name:this.name,size:this.size,mime:this.mime,lastModified:this.lastModified})}get data(){return new Promise(e=>{this.cachedData&&e(this.cachedData);const t=new FileReader;t.addEventListener("load",()=>{this.cachedData=t.result,e(this.cachedData)}),"json"===this.extension?t.readAsText(this.native):t.readAsDataURL(this.native)})}}function N_(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}function j_(e={}){return new Promise(t=>{const r=function(e={}){const t=document.querySelector("#hidden-file-upload-input");t&&t.remove();const r=document.createElement("input");return r.type="file",r.multiple=e.multiple??!1,r.classList.add("hidden"),r.style.display="none",r.style.visibility="hidden",r.id="hidden-file-upload-input",r.accept=function({extensions:e=[],types:t=[]}){const r=[];return null!=e&&e.length&&(e=e.map(e=>e.startsWith(".")?e:`.${e}`),r.push(e.join(","))),null!=t&&t.length&&r.push(t.join(",")),r.join(",")}(e),e.directory&&(r.webkitdirectory=!0),document.body.appendChild(r),r}(e);r.onchange=e=>{const n=e.target.files;if(!n)return t([]);const i=Array.from(n).filter(e=>".DS_Store"!==e.name).map(e=>new L_(e));t(i),r.remove()},document.body.appendChild(r),r.click()})}var D_=(e=>(e.image="image/*",e.audio="audio/*",e.text="text/*",e.json="application/json",e.video="video/mp4,video/mpeg,video/x-m4v,video/*",e))(D_||{});function z_(e,t=1){if(null==e||Number.isNaN(e))return"";const r=e<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(r&&(e=-e),e<1)return(r?"-":"")+e+" B";const i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),n.length-1);e=Number(e/Math.pow(1024,i));const o=n[i];return e>=10||e%1==0?`${(r?"-":"")+e.toFixed(0)} ${o}`:`${(r?"-":"")+e.toFixed(t)} ${o}`}function B_(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}B_.prototype.match=function(e){var t,r,n=!0,i=this.parts,o=i.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(r=(e||"").split(this.separator),t=0;n&&t<o;t++)"*"!==i[t]&&(n=t<r.length&&i[t]===r[t]);n=n&&r}else n=!1;else if("function"==typeof e.splice)for(n=[],t=e.length;t--;)this.match(e[t])&&(n[n.length]=e[t]);else if("object"==typeof e)for(var a in n={},e)this.match(a)&&(n[a]=e[a]);return n};var U_=function(e,t,r){var n=new B_(e,r||/[\/\.]/);return typeof t<"u"?n.match(t):n},V_=/[\/\+\.]/,H_=function(e,t){function r(t){var r=U_(t,e,V_);return r&&r.length>=2}return t?r(t.split(";")[0]):r};const W_=mf(H_);function $_(e,t){return t.map(e=>e.split(",")).flat().some(t=>{if(t.includes("/"))return!!e.mime&&W_(e.mime.replace(/;.*?$/,""),t);const r=t.replace(".","").toLowerCase();return!(!r||!e.extension)&&e.extension.toLowerCase()===r})}class q_{async uploadAndAddImage(e=!0){const t=await this.openUploadWindow();await this.openUploadedFile(t,e)}async uploadAndReplaceMainImage(){const e=await this.openUploadWindow();e&&await this.openBackgroundImage(e)}async uploadAndOpenStateFile(){const e=await this.openUploadWindow(G_);e&&await this.loadState(await e.data)}async addImageFromUrl(e,t=!0){var r,n;await M_(e,(null==(n=null==(r=qm().config.tools)?void 0:r.import)?void 0:n.fitOverlayToScreen)??!0,t),Gm().history.addHistoryItem({name:"overlayImage"})}async addImageFromData(e,t=!0){var r,n;await M_(e,(null==(n=null==(r=qm().config.tools)?void 0:r.import)?void 0:n.fitOverlayToScreen)??!0,t),Gm().history.addHistoryItem({name:"overlayImage"})}async openUploadedFile(e,t=!0){if(!e)return;const r=await e.data;switch(e.extension){case"json":await this.loadState(r);break;case"svg":await Gm().shape.addSvgSticker(r,zg.Image),Gm().history.addHistoryItem({name:"overlayImage"});break;default:await this.addImageFromData(r,t)}}async loadState(e){let t;qm().toggleLoading("state"),await Xm(),t="string"==typeof e?e.endsWith(".json")?await Km(e):JSON.parse(e):e,t.history?qm().history.reset(t.history):await Gm().history.addInitial(t),await Gm().history.reload(),qm().toggleLoading(!1)}async openUploadWindow(e){var t,r;e=e||function(){var e,t;const r=null==(t=null==(e=qm().config.tools)?void 0:e.import)?void 0:t.validImgExtensions;return r?{extensions:r}:{types:[D_.image]}}();const n=(await j_(e))[0];return this.fileIsValid(n)?(null==(r=(t=qm().config).onFileOpen)||r.call(t,n),n):null}async openBackgroundImage(e){let t;await Xm(),t=e instanceof HTMLImageElement?e.src:e instanceof L_?await e.data:e;const r=await Gm().canvas.addMainImage(t);return await Gm().history.addInitial(),r}fileIsValid(e){var t,r,n,i;const o=(null==(r=null==(t=qm().config.tools)?void 0:t.import)?void 0:r.maxFileSize)??function(e,t){switch(t){case"KB":return 1024*e;case"MB":return 1048576*e;case"GB":return e*1024**3;case"TB":return e*1024**4;case"PB":return e*1024**5;default:return e}}(10,"MB"),a=function(e,t){if(!t)return;const{maxFileSize:r,allowedFileTypes:n,blockedFileTypes:i}=t;return r&&null!=e.size&&e.size>r?wf("`:file` exceeds maximum allowed size of :size",{values:{file:e.name,size:z_(r)}}):null!=n&&n.length&&!$_(e,n)||null!=i&&i.length&&$_(e,i)?wf("This file type is not allowed"):void 0}(e,{maxFileSize:o,allowedFileTypes:[...(null==(i=null==(n=qm().config.tools)?void 0:n.import)?void 0:i.validImgExtensions)??[],"json"]});return!a||(ov.danger(a),!1)}}const G_={types:[".json",D_.json]};class Y_{constructor(){zl(this,"watermark",null),zl(this,"lineStyle",{stroke:"rgba(255,255,255,0.3)",strokeWidth:5,strokeLineCap:"round",strokeLineJoin:"round"})}add(e){this.createGroup(),this.addText(e),this.addLines(),Ym().add(this.watermark),Gm().canvas.render()}remove(){this.watermark&&(Ym().remove(this.watermark),this.watermark=null,Gm().canvas.render())}createGroup(){this.watermark=new OC.fabric.Group(void 0,{...Zm,width:qm().original.width,height:qm().original.height,excludeFromExport:!0,top:0,left:0,originX:"left",originY:"top"})}addText(e){var t;const r=new OC.fabric.Text(e,{fill:"rgba(255,255,255,0.3)",strokeWidth:2,stroke:"rgba(255,255,255,0.4)",originX:"center",originY:"center",fontWeight:600,fontSize:150,fontFamily:"Courier New"});r.scaleToWidth(qm().original.width/2),null==(t=this.watermark)||t.add(r)}addLines(){var e;if(!this.watermark)return;const t=null==(e=this.watermark)?void 0:e.getObjects("text")[0],r=qm().original.width/2,n=qm().original.height/2,i=100,o=t.width/4,a=new OC.fabric.Line(void 0,this.lineStyle),s=new OC.fabric.Line(void 0,this.lineStyle),l=new OC.fabric.Line(void 0,this.lineStyle),c=new OC.fabric.Line(void 0,this.lineStyle);this.watermark.add(a,s,l,c),a.set({x1:o,y1:-i,x2:r,y2:-n}),s.set({x1:o,y1:i,x2:r,y2:n}),l.set({x1:-o,y1:-i,x2:-r,y2:-n}),c.set({x1:-o,y1:i,x2:-r,y2:n})}}var X_={exports:{}};!function(e){!function(){function t(e,t){return typeof t>"u"?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function r(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){s(n.response,t,r)},n.onerror=function(){console.error("could not download file")},n.send()}function n(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof gf&&gf.global===gf?gf:void 0,a=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(e,t,a){var s=o.URL||o.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?i(l):n(l.href)?r(e,t,a):i(l,l.target="_blank")):(l.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(l.href)},4e4),setTimeout(function(){i(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,o,a){if(o=o||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,a),o);else if(n(e))r(e,o,a);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){i(s)})}}:function(e,t,n,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return r(e,t,n);var s="application/octet-stream"===e.type,l=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||s&&l||a)&&typeof FileReader<"u"){var u=new FileReader;u.onloadend=function(){var e=u.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},u.readAsDataURL(e)}else{var d=o.URL||o.webkitURL,h=d.createObjectURL(e);i?i.location=h:location.href=h,i=null,setTimeout(function(){d.revokeObjectURL(h)},4e4)}});o.saveAs=s.saveAs=s,e.exports=s}()}(X_);var K_=X_.exports;class Z_{save(e,t,r){var n,i,o;const a=null==(n=qm().config.tools)?void 0:n.export;e=e||(null==a?void 0:a.defaultName),t=this.getFormat(t),r=this.getQuality(r);const s=`${e}.${t}`;this.applyWaterMark();const l="json"===t?this.getJsonState():this.getDataUrl(t,r);if(Gm().watermark.remove(),l)if(qm().config.saveUrl)fetch(qm().config.saveUrl,{method:"POST",body:JSON.stringify({data:l,filename:s,format:t})});else if(qm().config.onSave)null==(o=(i=qm().config).onSave)||o.call(i,l,s,t);else{const e=this.getCanvasBlob(t,l);K_.saveAs(e,s)}}getDataUrl(e,t){try{return"svg"===e?Ym().toSVG():Ym().toDataURL({format:this.getFormat(e),quality:this.getQuality(t),multiplier:Math.max(qm().original.width/Ym().width,qm().original.height/Ym().height)})}catch(e){e.message.toLowerCase().includes("tainted")&&ov.danger(wf("Could not export canvas with external image."))}return null}getCanvasBlob(e,t){if("json"===e)return new Blob([t],{type:"application/json"});if("svg"===e)return new Blob([t],{type:"image/svg+xml"});const r=`image/${e}`;return function(e,t,r){t=t||"",r=r||512;const n=atob(e),i=[];for(let e=0;e<n.length;e+=r){const t=n.slice(e,e+r),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);const a=new Uint8Array(o);i.push(a)}return new Blob(i,{type:t})}(t=t.replace(/data:image\/([a-z]*)?;base64,/,""),r)}getJsonState(){return JSON.stringify({...Qm(),history:qm().history})}applyWaterMark(){const e=qm().config.watermarkText;e&&Gm().watermark.add(e)}getFormat(e){var t;const r=null==(t=qm().config.tools)?void 0:t.export;return"jpg"===(e=e||(null==r?void 0:r.defaultFormat)||"png")&&(e="jpeg"),e}getQuality(e){var t;const r=null==(t=qm().config.tools)?void 0:t.export;return e=e||(null==r?void 0:r.defaultQuality)||.8}}class Q_{constructor(){zl(this,"previewRect",null)}async apply(e){this.previewRect||this.showPreview(),this.updatePreview(e),Ym().remove(this.previewRect),Ym().clipPath=this.previewRect;const t=Gm().export.getDataUrl();t&&Gm().canvas.clear(),this.hidePreview(),t&&await Gm().canvas.addMainImage(t),Ym().clipPath=void 0}getPreviewRadius(){var e;return(null==(e=this.previewRect)?void 0:e.rx)||0}updatePreview(e){this.previewRect&&(this.previewRect.set({rx:e,ry:e}),Gm().canvas.render())}showPreview(){const e=.04*qm().original.width;this.previewRect=new OC.fabric.Rect({width:qm().original.width,height:qm().original.height,rx:e,ry:e,objectCaching:!1,fill:"transparent",name:"round.rect",data:{pixieInternal:!0},stroke:"rgba(255,255,255,0.8)",strokeWidth:3,strokeDashArray:[4,4],selectable:!1,evented:!1}),Ym().add(this.previewRect),this.previewRect.moveTo(99),this.previewRect.viewportCenter(),Gm().canvas.render()}hidePreview(){this.previewRect&&(Ym().remove(this.previewRect),Gm().canvas.render(),this.previewRect=null)}}class J_{get straightenAnchor(){return Ym().getObjects().find(e=>e.name===zg.StraightenAnchor)}rotateLeft(){this.rotateFixed(-90)}rotateRight(){this.rotateFixed(90)}straighten(e){this.storeObjectsRelationToHelper(),Gm().objects.deselectActive();const t=(this.straightenAnchor.data.rotateAngle||0)+e,r=this.getImageScale(t,this.straightenAnchor);this.straightenAnchor.angle=t,this.straightenAnchor.scaleX=r,this.straightenAnchor.scaleY=r,this.straightenAnchor.data.straightenAngle=e,this.transformObjectsBasedOnHelper()}flip(e){const t="horizontal"===e?"flipY":"flipX";Gm().objects.getAll().forEach(e=>{e[t]=!e[t]}),Gm().canvas.render()}rotateFixed(e){Gm().zoom.set(1,!1),Gm().objects.deselectActive();const t=this.straightenAnchor.data.rotateAngle||0;e=90*Math.round(e/90);const r=t+(this.straightenAnchor.data.straightenAngle||0)+e;Gm().canvas.resize(qm().original.height,qm().original.width,{applyZoom:!1,resizeHelper:!1}),this.storeObjectsRelationToHelper(),this.straightenAnchor.rotate(r),this.straightenAnchor.data.rotateAngle=t+e,this.straightenAnchor.center(),this.transformObjectsBasedOnHelper(),Gm().frame.resize(Gm().frame.active.currentSizeInPercent),requestAnimationFrame(()=>{Gm().zoom.fitToScreen()})}getImageScale(e,t){e=OC.fabric.util.degreesToRadians(e);const r=qm().original.width/2,n=qm().original.height/2,i=t.width/2,o=t.height/2,a=Math.sqrt(r**2+n**2),s=Math.asin(n/a);let l=(e%(2*Math.PI)+4*Math.PI)%(2*Math.PI);l>Math.PI&&(l-=Math.PI),l>Math.PI/2&&l<=Math.PI&&(l=Math.PI/2-(l-Math.PI/2));const c=Math.PI/2-s-Math.abs(l),u=Math.abs(s-Math.abs(l)),d=Math.cos(c)*a,h=Math.cos(u)*a;return Math.max(h/i,d/o)}storeObjectsRelationToHelper(){Gm().objects.getAll().forEach(e=>{if(e!==this.straightenAnchor){const t=OC.fabric.util.multiplyTransformMatrices(OC.fabric.util.invertTransform(this.straightenAnchor.calcTransformMatrix()),e.calcTransformMatrix());e.data={...e.data,relationToCanvas:t}}})}transformObjectsBasedOnHelper(){Gm().objects.getAll().forEach(e=>{if(e.data.relationToCanvas){const t=OC.fabric.util.multiplyTransformMatrices(this.straightenAnchor.calcTransformMatrix(),e.data.relationToCanvas),r=OC.fabric.util.qrDecompose(t);e.set({flipX:!1,flipY:!1}),e.setPositionByOrigin({x:r.translateX,y:r.translateY},"center","center"),e.set(r),e.setCoords(),e.data.relationToCanvas=null}})}resetStraightenAnchor(){const e=this.straightenAnchor;e&&Ym().remove(e);const t=new OC.fabric.Rect({...Zm,name:zg.StraightenAnchor,visible:!1,width:qm().original.width,height:qm().original.height,data:{pixieInternal:!0,straightenAngle:0,rotateAngle:0}});Ym().add(t),t.viewportCenter()}}function eS(e){const t=function(e){var t;const r=new OC.fabric.Canvas(e,{width:1,height:1});r.preserveObjectStacking=!0,r.selection=!1,r.renderOnAddRemove=!1;const n=qm().config.textureSize;n&&(OC.fabric.textureSize=n);const i={...null==(t=qm().config.objectDefaults)?void 0:t.global,...MC};Object.keys(i).forEach(e=>{OC.fabric.Object.prototype[e]=i[e]}),r.on("object:added",e=>{var t,r;e.target&&(null==(r=null==(t=e.target)?void 0:t.data)||!r.id)&&(e.target.data||(e.target.data={}),e.target.data.id=RC(10))});const o=OC.fabric.Object.prototype.controls;return Object.keys(o).forEach(e=>{delete o[e]}),r}(e);qm().editor.fabric=t,$m.setState({fabric:t}),qm().editor.tools={canvas:new BC,objects:new qC,zoom:new jC,history:new t_,filter:new s_,resize:new p_,crop:new y_,merge:new r_,shape:new b_,frame:new S_,text:new A_,draw:new P_,transform:new J_,import:new q_,watermark:new Y_,export:new Z_,corners:new Q_}}function tS(e,t){const r=new ResizeObserver(e=>{const r=e[0].contentRect;t({width:r.width,height:r.height})});return e.current&&r.observe(e.current),()=>{e.current&&r.unobserve(e.current)}}function rS(e){const t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}const nS="flex flex-shrink-0 items-center justify-between px-12 py-[9px] w-full h-[54px]",iS={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:"absolute"},transition:{type:"tween",duration:.15}};function oS(e,{padding:t,equalWidth:r,variant:n}={}){switch(e){case"2xs":return"link"===n?"text-xs":`text-xs h-24 ${r?"w-24":t||"px-10"}`;case"xs":return"link"===n?"text-xs":`text-xs h-30 ${r?"w-30":t||"px-14"}`;case"sm":return"link"===n?"text-sm":`text-sm h-36 ${r?"w-36":t||"px-18"}`;case"md":return"link"===n?"text-base":`text-base h-42 ${r?"w-42":t||"px-22"}`;case"lg":return"link"===n?"text-lg":`text-base h-50 ${r?"w-50":t||"px-26"}`;case"xl":return"link"===n?"text-xl":`text-lg h-60 ${r?"w-60":t||"px-32"}`;default:return e||""}}function aS(e){const{variant:t,shadow:r,whitespace:n="whitespace-nowrap",display:i="inline-flex"}=e,o={...e,border:e.border||"border"};let a=[];return"outline"===t?a=function({color:e,border:t}){const r="disabled:text-disabled disabled:bg-transparent disabled:border-disabled-bg";switch(e){case"primary":return[`text-primary bg-transparent ${t} border-primary/50`,"hover:bg-primary/hover hover:border-primary",r];case"danger":return[`text-danger bg-transparent ${t} border-danger/50`,"hover:bg-danger/4 hover:border-danger",r];case"positive":return[`text-positive bg-transparent ${t} border-positive/50`,"hover:bg-positive/4 hover:border-positive",r];case"paper":return[`text bg-paper ${t}`,"hover:bg-hover",r];case"white":return["text-white bg-transparent border border-white","hover:bg-white/20","disabled:text-white/70 disabled:border-white/70 disabled:bg-transparent"];default:return[`bg-transparent ${t}`,"hover:bg-hover",r]}}(o):"text"===t?a=function({color:e}){const t="disabled:text-disabled disabled:bg-transparent";switch(e){case"primary":return["text-primary bg-transparent border-transparent","hover:bg-primary/4",t];case"danger":return["text-danger bg-transparent border-transparent","hover:bg-danger/4",t];case"positive":return["text-positive bg-transparent border-transparent","hover:bg-positive/4",t];case"white":return["text-white bg-transparent border-transparent","hover:bg-white/20","disabled:text-white/70 disabled:bg-transparent"];default:return["bg-transparent border-transparent","hover:bg-hover",t]}}(o):"flat"===t||"raised"===t?a=function({color:e,border:t}){const r="disabled:text-disabled disabled:bg-disabled disabled:border-transparent disabled:shadow-none";switch(e){case"primary":return[`text-on-primary bg-primary ${t} border-primary`,"hover:bg-primary-dark hover:border-primary-dark",r];case"danger":return[`text-white bg-danger ${t} border-danger`,"hover:bg-danger/90 hover:border-danger/90",r];case"chip":return[`text-main bg-chip ${t} border-chip`,"hover:bg-chip/90 hover:border-chip/90",r];case"paper":return[`text-main bg-paper ${t} border-paper`,"hover:bg-paper/90 hover:border-paper/90",r];case"white":return[`text-black bg-white ${t} border-white`,"hover:bg-white",r];default:return[`bg ${t} border-background`,"hover:bg-hover",r]}}(o):"link"===t&&(a=function({color:e}){switch(e){case"primary":return["text-primary","hover:underline","disabled:text-disabled"];case"danger":return["text-danger","hover:underline","disabled:text-disabled"];default:return["text-main","hover:underline","disabled:text-disabled"]}}(o)),[...a,r||"raised"===t&&"shadow-md",n,i,t&&"align-middle flex-shrink-0 items-center transition-button duration-200","select-none appearance-none no-underline outline-none disabled:pointer-events-none disabled:cursor-default"]}function sS(e){return e&&(t=>{t.currentTarget.contains(t.target)&&e(t)})}const lS=p((t,r)=>{const{children:n,color:i=null,variant:o,radius:a,shadow:s,whitespace:l,justify:c="justify-center",className:u,href:d,form:h,border:f,elementType:p,to:g,relative:m,replace:v,end:y,display:b,type:w="button",onClick:x,onPointerDown:C,onPointerUp:_,onKeyDown:S,...A}=t,k=p||(d?"a":"button"),E="a"===k;return e(k,{ref:r,form:E?void 0:h,href:d,to:g,relative:m,type:E?void 0:w,replace:v,end:y,onPointerDown:sS(C),onPointerUp:sS(_),onClick:sS(x),onKeyDown:sS(S),className:Tf("focus-visible:ring",aS({variant:o,color:i,border:f,whitespace:l,display:b}),a,c,u),...A,children:n})}),cS=i.forwardRef(({children:r,startIcon:n,endIcon:i,size:o="sm",sizeClassName:a,className:s,equalWidth:l=!1,radius:c="rounded-button",variant:u="text",disabled:d,elementType:h,to:f,replace:p,href:g,download:m,...v},y)=>{const b=Tf("font-semibold",a||oS(o,{equalWidth:l,variant:u}),s);return t(lS,{className:b,ref:y,radius:c,variant:u,disabled:d,to:d?void 0:f,href:d?void 0:g,download:d?void 0:m,elementType:d?void 0:h,replace:d?void 0:p,...v,children:[n&&e(uS,{position:"start",icon:n,size:o}),r,i&&e(uS,{position:"end",icon:i,size:o})]})});function uS({icon:e,position:t,size:r}){const n=Tf("m-auto",{"-ml-4 mr-8":"start"===t,"-mr-4 ml-8":"end"===t},e.props.className);return i.cloneElement(e,{className:n,size:r})}const dS=s(null);function hS(){return l(dS)}const fS=Pf(e("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"}),"CheckOutlined"),pS=i.forwardRef((r,n)=>{let{startIcon:i,capitalizeFirst:o,children:a,description:s,endIcon:l,endSection:c,isDisabled:u,isActive:d,isSelected:h,showCheckmark:f,elementType:p="div",radius:g,padding:m,...v}=r;!i&&f&&(i=e(fS,{size:"sm",className:Tf("text-primary",!h&&"invisible")}));const y=Tf("icon-sm rounded overflow-hidden flex-shrink-0",!u&&"text-muted"),b=Tf(!u&&"text-muted");return t(p,{...v,"aria-disabled":u,className:gS(r),ref:n,children:[i&&e("div",{className:y,children:i}),t("div",{className:Tf("min-w-auto mr-auto w-full overflow-hidden overflow-ellipsis",o&&"first-letter:capitalize"),children:[a,s&&e("div",{className:Tf("mt-4 whitespace-normal text-xs",u?"text-disabled":"text-muted"),children:s})]}),(l||c)&&e("div",{className:l?y:b,children:l||c})]})});function gS({className:e,isSelected:t,isActive:r,isDisabled:n,showCheckmark:i,endIcon:o,endSection:a,radius:s,padding:l}){let c,u="";return u=n?"text-disabled pointer-events-none":t?r?"bg-primary/focus":"bg-primary/selected hover:bg-primary/focus":r?"hover:bg-fg-base/15 bg-focus":"hover:bg-hover",c=l||(i?o||a?"pl-8 pr-8 py-8":"pl-8 pr-24 py-8":"px-20 py-8"),Tf("w-full select-none outline-none cursor-pointer","text-sm truncate flex items-center gap-10",!n&&"text-main",c,u,e,s)}function mS({children:t,value:r,startIcon:n,endIcon:i,endSection:o,description:a,capitalizeFirst:s,textLabel:l,isDisabled:c,onSelected:u,onClick:d,...h}){var f;const{collection:p,showCheckmark:g,virtualFocus:m,listboxId:v,role:y,listItemsRef:b,handleItemSelection:w,state:{selectedValues:x,activeIndex:C,setActiveIndex:_}}=hS(),S=x.includes(r),A=null==(f=p.get(r))?void 0:f.index,k=C===A;if(null==A)return null;return e(pS,{...h,onFocus:()=>{m||_(A)},onPointerEnter:e=>{_(A),m||e.currentTarget.focus()},onPointerDown:e=>{m&&e.preventDefault()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),w(r),null==u||u())},onClick:e=>{w(r),null==u||u(),null==d||d(e)},ref:e=>b.current[A]=e,id:`${v}-${A}`,role:"menu"===y?"menuitem":"option",tabIndex:m?void 0:k&&!c?-1:0,"aria-selected":k&&S,showCheckmark:g,isDisabled:c,isActive:k,isSelected:S,startIcon:n,description:a,endIcon:i,endSection:o,capitalizeFirst:s,"data-value":r,children:t})}var vS={exports:{}};!function(e){(function(){var t=Object.assign;function r(e,r){r||(r={});var n,i,o,a=r.vargs||function(e){var t=e+"",r=t.indexOf("...");return r>=0&&(r<t.indexOf(")")||t.indexOf("arguments")>=0)}(e),s=Object.create(null),l=[],c=[],u=new WeakMap,d=r.maxAge>0&&r.maxAge<1/0?function(e,t,n){return setTimeout(function(){if(n)return t.splice(e,1),void n.splice(e,1);t instanceof WeakMap?t.delete(e):delete t[e]},r.maxAge)}:0,h=r.equals?r.equals:function(e,t){return e===t},f=r.maxArgs,p=r.serializer;return 1!==e.length||r.equals||a?i=function(){var t=arguments.length;if(!t&&null!=n)return c[n];var r,i=f||t;for(r=l.length-1;r>=0;r--)if(f||l[r].length===i)for(var o=i-1;o>=0&&h(l[r][o],arguments[o]);o--)if(0===o)return c[r];return r=l.length-(r+1),!t&&null==n&&(n=r),!d||d(r,c,l),c[r]=e.apply(this,l[r]=arguments)}.bind(this):(i=function(t){var r,n=typeof t;if(!p&&("object"===n&&t||"function"===n))return u.get(t)||(!d||d(t,u),u.set(t,r=e.call(this,t)),r);var i="number"===n||"boolean"===n||null==t?t:"string"===n?JSON.stringify(t):p(t);return s[i]||(!d||d(i,s),s[i]=e.call(this,t))}.bind(this),o=1),i.clear=function(){u=new WeakMap,s=Object.create(null),l=[],c=[],n=void 0},i.keys=function(){return o?null:l.slice()},i.values=function(){return o?null:c.slice()},i.keyValues=function(){return o?{primitives:t({},s),objects:u}:null},i}"function"!=typeof t&&(t=function(){var e=arguments,t=arguments[0];if(null==t)throw new TypeError("Cannot convert undefined or null to object");t=Object(t);for(var r=1;r<e.length;r++)if(e[r]&&"object"==typeof e[r])for(var n in e[r])t[n]=e[r][n];return t}),e.exports=r,typeof window<"u"&&(window.nanomemoize=r)}).call(gf)}(vS);const yS=mf(vS.exports);function bS({children:r,label:n,index:i}){const o=b();return t("div",{role:"group",className:Tf(0!==i&&"border-t my-4"),"aria-labelledby":n?`be-select-${o}`:void 0,children:[n&&e("div",{className:"block uppercase text-muted text-xs px-16 py-10",role:"presentation",id:`be-select-${o}`,"aria-hidden":"true",children:n}),r]})}const wS=yS(({maxItems:e,children:t,items:r,inputValue:n})=>{let i=CS({children:t,items:r}),o=xS({collection:i,inputValue:n});return e&&(i=new Map([...i.entries()].slice(0,e)),o=new Map([...o.entries()].slice(0,e))),{collection:i,filteredCollection:o}}),xS=yS(({collection:e,inputValue:t})=>{let r=new Map;const n=t?`${t}`.toLowerCase().trim():"";if(n){let t=0;e.forEach((e,i)=>{(e.item?JSON.stringify(e.item):e.textLabel).toLowerCase().trim().includes(n)&&r.set(i,{...e,index:t++})})}else r=e;return r}),CS=yS(({children:e,items:t})=>{let r;r=t&&"function"==typeof e?t.map(t=>e(t)):e;const n=new Map;let i=0;const o=(e,r,o,a)=>{const s=i++,l=r?null==t?void 0:t[o].items[a]:null==t?void 0:t[s];n.set(e.props.value,{index:s,element:e,textLabel:_S(e),item:l,section:r,isDisabled:e.props.isDisabled,value:e.props.value})};return m.forEach(r,(e,t)=>{v(e)&&(e.type===bS?m.forEach(e.props.children,(r,n)=>{o(r,e,t,n)}):o(e))}),n});function _S(e){var t;const r=e.props.children;return e.props.textLabel?e.props.textLabel:null!=(t=null==r?void 0:r.props)&&t.message?r.props.message:`${r}`||""}const SS=Math.min,AS=Math.max,kS=Math.round,ES=Math.floor,IS=e=>({x:e,y:e}),TS={left:"right",right:"left",bottom:"top",top:"bottom"},FS={start:"end",end:"start"};function OS(e,t,r){return AS(e,SS(t,r))}function PS(e,t){return"function"==typeof e?e(t):e}function MS(e){return e.split("-")[0]}function RS(e){return e.split("-")[1]}function LS(e){return"x"===e?"y":"x"}function NS(e){return"y"===e?"height":"width"}function jS(e){return["top","bottom"].includes(MS(e))?"y":"x"}function DS(e){return LS(jS(e))}function zS(e){return e.replace(/start|end/g,e=>FS[e])}function BS(e){return e.replace(/left|right|bottom|top/g,e=>TS[e])}function US(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function VS(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function HS(e,t,r){let{reference:n,floating:i}=e;const o=jS(t),a=DS(t),s=NS(a),l=MS(t),c="y"===o,u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,h=n[s]/2-i[s]/2;let f;switch(l){case"top":f={x:u,y:n.y-i.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:d};break;case"left":f={x:n.x-i.width,y:d};break;default:f={x:n.x,y:n.y}}switch(RS(t)){case"start":f[a]-=h*(r&&c?-1:1);break;case"end":f[a]+=h*(r&&c?-1:1)}return f}async function WS(e,t){var r;void 0===t&&(t={});const{x:n,y:i,platform:o,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=PS(t,e),p=US(f),g=s[h?"floating"===d?"reference":"floating":d],m=VS(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(g)))||r?g:g.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:n,y:i,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),b=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},w=VS(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(m.top-w.top+p.top)/b.y,bottom:(w.bottom-m.bottom+p.bottom)/b.y,left:(m.left-w.left+p.left)/b.x,right:(w.right-m.right+p.right)/b.x}}function $S(e){return YS(e)?(e.nodeName||"").toLowerCase():"#document"}function qS(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function GS(e){var t;return null==(t=(YS(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function YS(e){return e instanceof Node||e instanceof qS(e).Node}function XS(e){return e instanceof Element||e instanceof qS(e).Element}function KS(e){return e instanceof HTMLElement||e instanceof qS(e).HTMLElement}function ZS(e){return!(typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof qS(e).ShadowRoot)}function QS(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=nA(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function JS(e){return["table","td","th"].includes($S(e))}function eA(e){const t=tA(),r=nA(e);return"none"!==r.transform||"none"!==r.perspective||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||["transform","perspective","filter"].some(e=>(r.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(r.contain||"").includes(e))}function tA(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function rA(e){return["html","body","#document"].includes($S(e))}function nA(e){return qS(e).getComputedStyle(e)}function iA(e){return XS(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function oA(e){if("html"===$S(e))return e;const t=e.assignedSlot||e.parentNode||ZS(e)&&e.host||GS(e);return ZS(t)?t.host:t}function aA(e){const t=oA(e);return rA(t)?e.ownerDocument?e.ownerDocument.body:e.body:KS(t)&&QS(t)?t:aA(t)}function sA(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const i=aA(e),o=i===(null==(n=e.ownerDocument)?void 0:n.body),a=qS(i);return o?t.concat(a,a.visualViewport||[],QS(i)?i:[],a.frameElement&&r?sA(a.frameElement):[]):t.concat(i,sA(i,[],r))}function lA(e){const t=nA(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=KS(e),o=i?e.offsetWidth:r,a=i?e.offsetHeight:n,s=kS(r)!==o||kS(n)!==a;return s&&(r=o,n=a),{width:r,height:n,$:s}}function cA(e){return XS(e)?e:e.contextElement}function uA(e){const t=cA(e);if(!KS(t))return IS(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=lA(t);let a=(o?kS(r.width):r.width)/n,s=(o?kS(r.height):r.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const dA=IS(0);function hA(e){const t=qS(e);return tA()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:dA}function fA(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const i=e.getBoundingClientRect(),o=cA(e);let a=IS(1);t&&(n?XS(n)&&(a=uA(n)):a=uA(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==qS(e))&&t}(o,r,n)?hA(o):IS(0);let l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,u=i.width/a.x,d=i.height/a.y;if(o){const e=qS(o),t=n&&XS(n)?qS(n):n;let r=e,i=r.frameElement;for(;i&&n&&t!==r;){const e=uA(i),t=i.getBoundingClientRect(),n=nA(i),o=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,a=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=o,c+=a,r=qS(i),i=r.frameElement}}return VS({width:u,height:d,x:l,y:c})}const pA=[":popover-open",":modal"];function gA(e){return pA.some(t=>{try{return e.matches(t)}catch{return!1}})}function mA(e){return fA(GS(e)).left+iA(e).scrollLeft}function vA(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=qS(e),n=GS(e),i=r.visualViewport;let o=n.clientWidth,a=n.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;const e=tA();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:o,height:a,x:s,y:l}}(e,r);else if("document"===t)n=function(e){const t=GS(e),r=iA(e),n=e.ownerDocument.body,i=AS(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=AS(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+mA(e);const s=-r.scrollTop;return"rtl"===nA(n).direction&&(a+=AS(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:a,y:s}}(GS(e));else if(XS(t))n=function(e,t){const r=fA(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=KS(e)?uA(e):IS(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:n*o.y}}(t,r);else{const r=hA(e);n={...t,x:t.x-r.x,y:t.y-r.y}}return VS(n)}function yA(e,t){const r=oA(e);return!(r===t||!XS(r)||rA(r))&&("fixed"===nA(r).position||yA(r,t))}function bA(e,t){const r=t.get(e);if(r)return r;let n=sA(e,[],!1).filter(e=>XS(e)&&"body"!==$S(e)),i=null;const o="fixed"===nA(e).position;let a=o?oA(e):e;for(;XS(a)&&!rA(a);){const t=nA(a),r=eA(a);!r&&"fixed"===t.position&&(i=null),(o?!r&&!i:!r&&"static"===t.position&&i&&["absolute","fixed"].includes(i.position)||QS(a)&&!r&&yA(e,a))?n=n.filter(e=>e!==a):i=t,a=oA(a)}return t.set(e,n),n}function wA(e,t,r){const n=KS(t),i=GS(t),o="fixed"===r,a=fA(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const l=IS(0);if(n||!n&&!o)if(("body"!==$S(t)||QS(i))&&(s=iA(t)),n){const e=fA(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=mA(i));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function xA(e){return"static"===nA(e).position}function CA(e,t){return KS(e)&&"fixed"!==nA(e).position?t?t(e):e.offsetParent:null}function _A(e,t){const r=qS(e);if(gA(e))return r;if(!KS(e)){let t=oA(e);for(;t&&!rA(t);){if(XS(t)&&!xA(t))return t;t=oA(t)}return r}let n=CA(e,t);for(;n&&JS(n)&&xA(n);)n=CA(n,t);return n&&rA(n)&&xA(n)&&!eA(n)?r:n||function(e){let t=oA(e);for(;KS(t)&&!rA(t);){if(eA(t))return t;t=oA(t)}return null}(e)||r}const SA={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o="fixed"===i,a=GS(n),s=!!t&&gA(t.floating);if(n===a||s&&o)return r;let l={scrollLeft:0,scrollTop:0},c=IS(1);const u=IS(0),d=KS(n);if((d||!d&&!o)&&(("body"!==$S(n)||QS(a))&&(l=iA(n)),KS(n))){const e=fA(n);c=uA(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+u.x,y:r.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:GS,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[..."clippingAncestors"===r?gA(t)?[]:bA(t,this._c):[].concat(r),n],a=o[0],s=o.reduce((e,r)=>{const n=vA(t,r,i);return e.top=AS(n.top,e.top),e.right=SS(n.right,e.right),e.bottom=SS(n.bottom,e.bottom),e.left=AS(n.left,e.left),e},vA(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:_A,getElementRects:async function(e){const t=this.getOffsetParent||_A,r=this.getDimensions,n=await r(e.floating);return{reference:wA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=lA(e);return{width:t,height:r}},getScale:uA,isElement:XS,isRTL:function(e){return"rtl"===nA(e).direction}};function AA(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=cA(e),u=i||o?[...c?sA(c):[],...sA(t)]:[];u.forEach(e=>{i&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const d=c&&s?function(e,t){let r,n=null;const i=GS(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),o();const{left:c,top:u,width:d,height:h}=e.getBoundingClientRect();if(s||t(),!d||!h)return;const f={rootMargin:-ES(u)+"px "+-ES(i.clientWidth-(c+d))+"px "+-ES(i.clientHeight-(u+h))+"px "+-ES(c)+"px",threshold:AS(0,SS(1,l))||1};let p=!0;function g(e){const t=e[0].intersectionRatio;if(t!==l){if(!p)return a();t?a(!1,t):r=setTimeout(()=>{a(!1,1e-7)},1e3)}p=!1}try{n=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch{n=new IntersectionObserver(g,f)}n.observe(e)}(!0),o}(c,r):null;let h=-1,f=null;a&&(f=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),r()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?fA(e):null;return l&&function t(){const n=fA(e);g&&(n.x!==g.x||n.y!==g.y||n.width!==g.width||n.height!==g.height)&&r(),g=n,p=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==d||d(),null==(e=f)||e.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const kA=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:o,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:r,platform:n,elements:i}=e,o=await(null==n.isRTL?void 0:n.isRTL(i.floating)),a=MS(r),s=RS(r),l="y"===jS(r),c=["left","top"].includes(a)?-1:1,u=o&&l?-1:1,d=PS(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof p&&(f="end"===s?-1*p:p),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}(t,e);return a===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:a}}}}},EA=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=PS(e,t),c={x:r,y:n},u=await WS(t,l),d=jS(MS(i)),h=LS(d);let f=c[h],p=c[d];if(o){const e="y"===h?"bottom":"right";f=OS(f+u["y"===h?"top":"left"],f,f-u[e])}if(a){const e="y"===d?"bottom":"right";p=OS(p+u["y"===d?"top":"left"],p,p-u[e])}const g=s.fn({...t,[h]:f,[d]:p});return{...g,data:{x:g.x-r,y:g.y-n}}}}},IA=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:o,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=PS(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=MS(i),y=MS(s)===s,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=h||(y||!g?[BS(s)]:function(e){const t=BS(e);return[zS(e),t,zS(t)]}(s));!h&&"none"!==p&&w.push(...function(e,t,r,n){const i=RS(e);let o=function(e,t,r){const n=["left","right"],i=["right","left"],o=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return r?t?i:n:t?n:i;case"left":case"right":return t?o:a;default:return[]}}(MS(e),"start"===r,n);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(zS)))),o}(s,g,p,b));const x=[s,...w],C=await WS(t,m),_=[];let S=(null==(n=o.flip)?void 0:n.overflows)||[];if(u&&_.push(C[v]),d){const e=function(e,t,r){void 0===r&&(r=!1);const n=RS(e),i=DS(e),o=NS(i);let a="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=BS(a)),[a,BS(a)]}(i,a,b);_.push(C[e[0]],C[e[1]])}if(S=[...S,{placement:i,overflows:_}],!_.every(e=>e<=0)){var A,k;const e=((null==(A=o.flip)?void 0:A.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let r=null==(k=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:k.placement;if(!r)switch(f){case"bestFit":{var E;const e=null==(E=S.map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:E[0];e&&(r=e);break}case"initialPlacement":r=s}if(i!==r)return{reset:{placement:r}}}return{}}}},TA=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:n,platform:i,elements:o}=t,{apply:a=()=>{},...s}=PS(e,t),l=await WS(t,s),c=MS(r),u=RS(r),d="y"===jS(r),{width:h,height:f}=n.floating;let p,g;"top"===c||"bottom"===c?(p=c,g=u===(await(null==i.isRTL?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=c,p="end"===u?"top":"bottom");const m=f-l.top-l.bottom,v=h-l.left-l.right,y=SS(f-l[p],m),b=SS(h-l[g],v),w=!t.middlewareData.shift;let x=y,C=b;if(d?C=u||w?SS(b,v):v:x=u||w?SS(y,m):m,w&&!u){const e=AS(l.left,0),t=AS(l.right,0),r=AS(l.top,0),n=AS(l.bottom,0);d?C=h-2*(0!==e||0!==t?e+t:AS(l.left,l.right)):x=f-2*(0!==r||0!==n?r+n:AS(l.top,l.bottom))}await a({...t,availableWidth:C,availableHeight:x});const _=await i.getDimensions(o.floating);return h!==_.width||f!==_.height?{reset:{rects:!0}}:{}}}},FA=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:o,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=PS(e,t)||{};if(null==c)return{};const d=US(u),h={x:r,y:n},f=DS(i),p=NS(f),g=await a.getDimensions(c),m="y"===f,v=m?"top":"left",y=m?"bottom":"right",b=m?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[f]-h[f]-o.floating[p],x=h[f]-o.reference[f],C=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let _=C?C[b]:0;(!_||!await(null==a.isElement?void 0:a.isElement(C)))&&(_=s.floating[b]||o.floating[p]);const S=w/2-x/2,A=_/2-g[p]/2-1,k=SS(d[v],A),E=SS(d[y],A),I=k,T=_-g[p]-E,F=_/2-g[p]/2+S,O=OS(I,F,T),P=!l.arrow&&null!=RS(i)&&F!==O&&o.reference[p]/2-(F<I?k:E)-g[p]/2<0,M=P?F<I?F-I:F-T:0;return{[f]:h[f]+M,data:{[f]:O,centerOffset:F-O-M,...P&&{alignmentOffset:M}},reset:P}}}),OA=(e,t,r)=>{const n=new Map,i={platform:SA,...r},o={...i.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:o=[],platform:a}=r,s=o.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=HS(c,n,l),h=n,f={},p=0;for(let r=0;r<s.length;r++){const{name:o,fn:g}=s[r],{x:m,y:v,data:y,reset:b}=await g({x:u,y:d,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=m??u,d=v??d,f={...f,[o]:{...f[o],...y}},b&&p<=50&&(p++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:i}):b.rects),({x:u,y:d}=HS(c,h,l))),r=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var PA=typeof document<"u"?x:a;function MA(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,i;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;0!==n--;)if(!MA(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;0!==n--;){const r=i[n];if(!("_owner"===r&&e.$$typeof||MA(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function RA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function LA(e,t){const r=RA(e);return Math.round(t*r)/r}function NA(e){const t=n.useRef(e);return PA(()=>{t.current=e}),t}function jA({floatingWidth:e,ref:t,disablePositioning:r=!1,placement:i="bottom",offset:o=2,showArrow:a=!1,maxHeight:s,shiftCrossAxis:l=!0,fallbackPlacements:c}){const h=u(null),f={placement:i,strategy:"fixed"};r||(f.whileElementsMounted=AA,f.middleware=[kA(o),EA({padding:16,crossAxis:l,mainAxis:!0}),IA({padding:16,fallbackPlacements:c}),TA({apply({rects:t,availableHeight:r,availableWidth:n,elements:i}){"matchTrigger"===e&&null!=s?Object.assign(i.floating.style,{width:`${t.reference.width}px`,maxWidth:`${n}`,maxHeight:`${Math.min(r,s)}px`}):null!=s&&Object.assign(i.floating.style,{maxHeight:`${Math.min(r,s)}px`})},padding:16})],a&&f.middleware.push((e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&function(e){return{}.hasOwnProperty.call(e,"current")}(r)?null!=r.current?FA({element:r.current,padding:n}).fn(t):{}:r?FA({element:r,padding:n}).fn(t):{}}}))({element:h})));const p=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:o,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,h]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=n.useState(i);MA(f,i)||p(i);const[g,m]=n.useState(null),[v,y]=n.useState(null),b=n.useCallback(e=>{e!=_.current&&(_.current=e,m(e))},[m]),w=n.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[y]),x=a||g,C=s||v,_=n.useRef(null),S=n.useRef(null),A=n.useRef(d),k=NA(c),E=NA(o),I=n.useCallback(()=>{if(!_.current||!S.current)return;const e={placement:t,strategy:r,middleware:f};E.current&&(e.platform=E.current),OA(_.current,S.current,e).then(e=>{const t={...e,isPositioned:!0};T.current&&!MA(A.current,t)&&(A.current=t,Ae.flushSync(()=>{h(t)}))})},[f,t,r,E]);PA(()=>{!1===u&&A.current.isPositioned&&(A.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[u]);const T=n.useRef(!1);PA(()=>(T.current=!0,()=>{T.current=!1}),[]),PA(()=>{if(x&&(_.current=x),C&&(S.current=C),x&&C){if(k.current)return k.current(x,C,I);I()}},[x,C,I,k]);const F=n.useMemo(()=>({reference:_,floating:S,setReference:b,setFloating:w}),[b,w]),O=n.useMemo(()=>({reference:x,floating:C}),[x,C]),P=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!O.floating)return e;const t=LA(O.floating,d.x),n=LA(O.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...RA(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,O.floating,d.x,d.y]);return n.useMemo(()=>({...d,update:I,refs:F,elements:O,floatingStyles:P}),[d,I,F,O,P])}(f),g=d(()=>function(e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}}([t,p.refs.setReference]),[p.refs.setReference,t]),{x:m,y:v}=p.middlewareData.arrow||{},y={top:"bottom",right:"left",bottom:"top",left:"right"}[p.placement.split("-")[0]],b={left:m,top:v,right:"",bottom:"",[y]:"-4px"};return{...p,reference:g,arrowRef:h,arrowStyle:b}}function DA(e,t){const{children:r,items:n,role:i="listbox",virtualFocus:a,focusLoopingMode:s="stay",autoFocusFirstItem:l=!0,onItemSelected:h,clearInputOnItemSelection:f,blurReferenceOnItemSelection:p,floatingWidth:g="matchTrigger",floatingMinWidth:m,floatingMaxHeight:v,offset:y,placement:w,showCheckmark:x,showEmptyMessage:C,maxItems:_,isAsync:S,allowCustomValue:A,clearSelectionOnInputClear:k}=e,E=e.selectionMode||"none",I=`${b()}-listbox`,[T,F]=EC(e.inputValue,e.defaultInputValue||"",e.onInputValueChange),[O,P]=o("all"),M=wS({children:r,items:n,inputValue:S?void 0:T,maxItems:_}),R="all"===O?M.collection:M.filteredCollection,L=u([]),N=d(()=>[...R.values()].map(e=>e.isDisabled?null:e.textLabel),[R]),{selectedValues:j,selectValues:D}=function(e){const{selectionMode:t,allowEmptySelection:r}=e,n="single"===t||"multiple"===t,[i,o]=EC(n?e.selectedValue:void 0,n?e.defaultSelectedValue:void 0,n?e.onSelectionChange:void 0),a=d(()=>typeof i>"u"?[]:Array.isArray(i)?i:[i],[i]),s=c(e=>{const n=Array.isArray(e)?e:[e];"single"===t?o(n[0]):n.forEach(e=>{const t=a.indexOf(e);-1===t?(a.push(e),o([...a])):(a.length>1||r)&&(a.splice(t,1),o([...a]))})},[r,a,t,o]);return{selectedValues:a,selectValues:s}}(e),[z,B]=EC(e.isOpen,e.defaultIsOpen,e.onOpenChange),[U,V]=o(null),H=jA({floatingWidth:g,ref:t,placement:w,offset:y,maxHeight:v??420,shiftCrossAxis:!a}),{refs:W,strategy:$,x:q,y:G}=H,Y="none"===E?void 0:R.get(j[0]),X="none"===E||null==Y?void 0:Y.index,K=c((e,t)=>{var r,n;const i=[...R.values()],o=!i.find(e=>!e.isDisabled),l=R.size-1;null==t||!R.size||t>l||t<0||o?V(null):(t=function(e,t,r,n){var i;const o=e.length-1;for(;null!=(i=e[t])&&i.isDisabled;)if("increment"===n){if(++t>=o){if("loop"!==r)return"stay"===r?t-1:null;t=0}}else if(--t<0){if("loop"!==r)return"stay"===r?t+1:null;t=o}return t}(i,t,s,e),V(t),null!=t&&(a?null==(r=L.current[t])||r.scrollIntoView({block:"nearest"}):null==(n=L.current[t])||n.focus()))},[R,a,s]);return{handleItemSelection:e=>{const t=W.reference.current;"none"!==E?D(e):t&&"focus"in t&&t.focus(),a&&(F(f?"":`${e}`),p&&t&&"blur"in t&&t.blur()),P("all"),B(!1),null==h||h(e),V(null)},onInputChange:c(e=>{F(e.target.value),P(e.target.value.trim()?"filtered":"all"),e.target.value?B(!0):k&&D(""),l&&null==U?K("increment",0):V(null)},[F,B,P,D,k,K,l,U]),focusLoopingMode:s,floatingWidth:g,floatingMinWidth:m,floatingMaxHeight:v,showCheckmark:x,collection:R,collections:M,virtualFocus:a,focusItem:K,showEmptyMessage:C&&!!T,allowCustomValue:A,refs:W,reference:H.reference,floating:W.setFloating,positionStyle:{position:$,top:G??"",left:q??""},listContent:N,listItemsRef:L,listboxId:I,role:i,state:{activeIndex:U,setActiveIndex:V,selectedIndex:X,setSelectedIndex:e=>{if("none"!==E){const t=[...R.values()][e];t&&D(t.value)}},selectionMode:E,selectedValues:j,selectValues:D,inputValue:T,setInputValue:F,isOpen:z,setIsOpen:B,setActiveCollection:P}}}function zA(){return cC()||typeof window>"u"?Um.getState().data.is_mobile_device??!1:window.screen.width<=768}let BA=null,UA=new Set,VA=new Map,HA=!1,WA=!1;function $A(e,t){for(let r of UA)r(e,t)}function qA(e){HA=!0,function(e){return!(e.metaKey||!yC()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(BA="keyboard",$A("keyboard",e))}function GA(e){BA="pointer",("mousedown"===e.type||"pointerdown"===e.type)&&(HA=!0,$A("pointer",e))}function YA(e){(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(bC()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)})(e)&&(HA=!0,BA="virtual")}function XA(e){e.target===window||e.target===document||(!HA&&!WA&&(BA="virtual",$A("virtual",e)),HA=!1,WA=!1)}function KA(){HA=!1,WA=!0}function ZA(e){if(typeof window>"u"||VA.get(pC(e)))return;const t=pC(e),r=fC(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){HA=!0,n.apply(this,arguments)},r.addEventListener("keydown",qA,!0),r.addEventListener("keyup",qA,!0),r.addEventListener("click",YA,!0),t.addEventListener("focus",XA,!0),t.addEventListener("blur",KA,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",GA,!0),r.addEventListener("pointermove",GA,!0),r.addEventListener("pointerup",GA,!0)):(r.addEventListener("mousedown",GA,!0),r.addEventListener("mousemove",GA,!0),r.addEventListener("mouseup",GA,!0)),t.addEventListener("beforeunload",()=>{QA(e)},{once:!0}),VA.set(t,{focus:n})}const QA=(e,t)=>{const r=pC(e),n=fC(e);t&&n.removeEventListener("DOMContentLoaded",t),VA.has(r)&&(r.HTMLElement.prototype.focus=VA.get(r).focus,n.removeEventListener("keydown",qA,!0),n.removeEventListener("keyup",qA,!0),n.removeEventListener("click",YA,!0),r.removeEventListener("focus",XA,!0),r.removeEventListener("blur",KA,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",GA,!0),n.removeEventListener("pointermove",GA,!0),n.removeEventListener("pointerup",GA,!0)):(n.removeEventListener("mousedown",GA,!0),n.removeEventListener("mousemove",GA,!0),n.removeEventListener("mouseup",GA,!0)),VA.delete(r))};function JA(e){const t=fC(e);if("virtual"===BA){let r=t.activeElement;!function(e){requestAnimationFrame(()=>{0===wC.size?e():xC.add(e)})}(()=>{t.activeElement===r&&e.isConnected&&mC(e)})}else mC(e)}function ek(e,t){return"#comment"!==e.nodeName&&function(e){const t=pC(e);if(!(e instanceof t.HTMLElement||e instanceof t.SVGElement))return!1;let{display:r,visibility:n}=e.style,i="none"!==r&&"hidden"!==n&&"collapse"!==n;if(i){const{getComputedStyle:t}=e.ownerDocument.defaultView;let{display:r,visibility:n}=t(e);i="none"!==r&&"hidden"!==n&&"collapse"!==n}return i}(e)&&function(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&("DETAILS"!==e.nodeName||!t||"SUMMARY"===t.nodeName||e.hasAttribute("open"))}(e,t)&&(!e.parentElement||ek(e.parentElement,e))}typeof document<"u"&&function(e){const t=fC(e);let r;"loading"!==t.readyState?ZA(e):(r=()=>{ZA(e)},t.addEventListener("DOMContentLoaded",r))}();const tk=i.createContext(null);let rk=null;function nk(e){let{children:t,contain:r,restoreFocus:n,autoFocus:o}=e,s=u(null),c=u(null),h=u([]),{parentNode:f}=l(tk)||{},p=d(()=>new vk({scopeRef:h}),[h]);iC(()=>{let e=f||yk.root;if(yk.getTreeNode(e.scopeRef)&&rk&&!hk(rk,e.scopeRef)){let t=yk.getTreeNode(rk);t&&(e=t)}e.addChild(p),yk.addNode(p)},[p,f]),iC(()=>{let e=yk.getTreeNode(h);e&&(e.contain=!!r)},[r]),iC(()=>{var e;let t=null===(e=s.current)||void 0===e?void 0:e.nextSibling,r=[];for(;t&&t!==c.current;)r.push(t),t=t.nextSibling;h.current=r},[t]),function(e,t,r){iC(()=>{if(t||r)return;let n=e.current;const i=fC(n?n[0]:void 0);let o=t=>{let r=t.target;uk(r,e.current)?rk=e:ck(r)||(rk=null)};return i.addEventListener("focusin",o,!1),null==n||n.forEach(e=>e.addEventListener("focusin",o,!1)),()=>{i.removeEventListener("focusin",o,!1),null==n||n.forEach(e=>e.removeEventListener("focusin",o,!1))}},[e,t,r])}(h,n,r),function(e,t){let r=u(),n=u();iC(()=>{let i=e.current;if(!t)return void(n.current&&(cancelAnimationFrame(n.current),n.current=void 0));const o=fC(i?i[0]:void 0);let a=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey||!lk(e)||t.isComposing)return;let r=o.activeElement,n=e.current;if(!n||!uk(r,n))return;let i=gk(sk(n),{tabbable:!0},n);if(!r)return;i.currentNode=r;let a=t.shiftKey?i.previousNode():i.nextNode();a||(i.currentNode=t.shiftKey?n[n.length-1].nextElementSibling:n[0].previousElementSibling,a=t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),a&&fk(a,!0)},s=t=>{rk&&!hk(rk,e)||!uk(t.target,e.current)?lk(e)&&!dk(t.target,e)?r.current?r.current.focus():rk&&rk.current&&pk(rk.current):lk(e)&&(r.current=t.target):(rk=e,r.current=t.target)},l=t=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{if(o.activeElement&&lk(e)&&!dk(o.activeElement,e))if(rk=e,o.body.contains(t.target)){var n;r.current=t.target,null===(n=r.current)||void 0===n||n.focus()}else rk.current&&pk(rk.current)})};return o.addEventListener("keydown",a,!1),o.addEventListener("focusin",s,!1),null==i||i.forEach(e=>e.addEventListener("focusin",s,!1)),null==i||i.forEach(e=>e.addEventListener("focusout",l,!1)),()=>{o.removeEventListener("keydown",a,!1),o.removeEventListener("focusin",s,!1),null==i||i.forEach(e=>e.removeEventListener("focusin",s,!1)),null==i||i.forEach(e=>e.removeEventListener("focusout",l,!1))}},[e,t]),iC(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}(h,r),function(e,t,r){const n=u(typeof document<"u"?fC(e.current?e.current[0]:void 0).activeElement:null);iC(()=>{let n=e.current;const i=fC(n?n[0]:void 0);if(!t||r)return;let o=()=>{(!rk||hk(rk,e))&&uk(i.activeElement,e.current)&&(rk=e)};return i.addEventListener("focusin",o,!1),null==n||n.forEach(e=>e.addEventListener("focusin",o,!1)),()=>{i.removeEventListener("focusin",o,!1),null==n||n.forEach(e=>e.removeEventListener("focusin",o,!1))}},[e,r]),iC(()=>{const n=fC(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey||!lk(e)||t.isComposing)return;let r=n.activeElement;if(!uk(r,e.current))return;let i=yk.getTreeNode(e);if(!i)return;let o=i.nodeToRestore,a=gk(n.body,{tabbable:!0});a.currentNode=r;let s=t.shiftKey?a.previousNode():a.nextNode();if((!o||!n.body.contains(o)||o===n.body)&&(o=void 0,i.nodeToRestore=void 0),(!s||!uk(s,e.current))&&o){a.currentNode=o;do{s=t.shiftKey?a.previousNode():a.nextNode()}while(uk(s,e.current));t.preventDefault(),t.stopPropagation(),s?fk(s,!0):ck(o)?fk(o,!0):r.blur()}};return r||n.addEventListener("keydown",i,!0),()=>{r||n.removeEventListener("keydown",i,!0)}},[e,t,r]),iC(()=>{const r=fC(e.current?e.current[0]:void 0);if(!t)return;let i=yk.getTreeNode(e);var o;return i?(i.nodeToRestore=null!==(o=n.current)&&void 0!==o?o:void 0,()=>{let n=yk.getTreeNode(e);if(!n)return;let i=n.nodeToRestore;if(t&&i&&(uk(r.activeElement,e.current)||r.activeElement===r.body&&function(e){let t=yk.getTreeNode(rk);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(null==t?void 0:t.scopeRef)===e}(e))){let t=yk.clone();requestAnimationFrame(()=>{if(r.activeElement===r.body){let r=t.getTreeNode(e);for(;r;){if(r.nodeToRestore&&r.nodeToRestore.isConnected)return void fk(r.nodeToRestore);r=r.parent}for(r=t.getTreeNode(e);r;){if(r.scopeRef&&r.scopeRef.current&&yk.getTreeNode(r.scopeRef))return void pk(r.scopeRef.current,!0);r=r.parent}}})}}):void 0},[e,t])}(h,n,r),function(e,t){const r=i.useRef(t);a(()=>{if(r.current){rk=e;!uk(fC(e.current?e.current[0]:void 0).activeElement,rk.current)&&e.current&&pk(e.current)}r.current=!1},[e])}(h,o),a(()=>{const e=fC(h.current?h.current[0]:void 0).activeElement;let t=null;if(uk(e,h.current)){for(let r of yk.traverse())r.scopeRef&&uk(e,r.scopeRef.current)&&(t=r);t===yk.getTreeNode(h)&&(rk=t.scopeRef)}},[h]),iC(()=>()=>{var e,t,r;let n=null!==(r=null===(t=yk.getTreeNode(h))||void 0===t||null===(e=t.parent)||void 0===e?void 0:e.scopeRef)&&void 0!==r?r:null;(h===rk||hk(h,rk))&&(!n||yk.getTreeNode(n))&&(rk=n),yk.removeTreeNode(h)},[h]);let g=d(()=>function(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:i,wrap:o,accept:a}=t,s=n||fC(r[0]).activeElement,l=r[0].previousElementSibling,c=gk(sk(r),{tabbable:i,accept:a},r);c.currentNode=uk(s,r)?s:l;let u=c.nextNode();return!u&&o&&(c.currentNode=l,u=c.nextNode()),u&&fk(u,!0),u},focusPrevious(t={}){let r=e.current,{from:n,tabbable:i,wrap:o,accept:a}=t,s=n||fC(r[0]).activeElement,l=r[r.length-1].nextElementSibling,c=gk(sk(r),{tabbable:i,accept:a},r);c.currentNode=uk(s,r)?s:l;let u=c.previousNode();return!u&&o&&(c.currentNode=l,u=c.previousNode()),u&&fk(u,!0),u},focusFirst(t={}){let r=e.current,{tabbable:n,accept:i}=t,o=gk(sk(r),{tabbable:n,accept:i},r);o.currentNode=r[0].previousElementSibling;let a=o.nextNode();return a&&fk(a,!0),a},focusLast(t={}){let r=e.current,{tabbable:n,accept:i}=t,o=gk(sk(r),{tabbable:n,accept:i},r);o.currentNode=r[r.length-1].nextElementSibling;let a=o.previousNode();return a&&fk(a,!0),a}}}(h),[]),m=d(()=>({focusManager:g,parentNode:p}),[p,g]);return i.createElement(tk.Provider,{value:m},i.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:s}),t,i.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:c}))}const ik=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],ok=ik.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";ik.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const ak=ik.join(':not([hidden]):not([tabindex="-1"]),');function sk(e){return e[0].parentElement}function lk(e){let t=yk.getTreeNode(rk);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function ck(e){return dk(e)}function uk(e,t){return!(!e||!t)&&t.some(t=>t.contains(e))}function dk(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of yk.traverse(yk.getTreeNode(t)))if(r&&uk(e,r.current))return!0;return!1}function hk(e,t){var r;let n=null===(r=yk.getTreeNode(t))||void 0===r?void 0:r.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function fk(e,t=!1){if(null==e||t){if(null!=e)try{e.focus()}catch{}}else try{JA(e)}catch{}}function pk(e,t=!0){let r=e[0].previousElementSibling,n=sk(e),i=gk(n,{tabbable:t},e);i.currentNode=r;let o=i.nextNode();t&&!o&&(n=sk(e),i=gk(n,{tabbable:!1},e),i.currentNode=r,o=i.nextNode()),fk(o)}function gk(e,t,r){let n=null!=t&&t.tabbable?ak:ok,i=fC(e).createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){var i;return null!=t&&null!==(i=t.from)&&void 0!==i&&i.contains(e)?NodeFilter.FILTER_REJECT:!e.matches(n)||!ek(e)||r&&!uk(e,r)||null!=t&&t.accept&&!t.accept(e)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});return null!=t&&t.from&&(i.currentNode=t.from),i}class mk{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,r){let n=this.fastMap.get(t??null);if(!n)return;let i=new vk({scopeRef:e});n.addChild(i),i.parent=n,this.fastMap.set(e,i),r&&(i.nodeToRestore=r)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(null===e)return;let t=this.fastMap.get(e);if(!t)return;let r=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&uk(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let n=t.children;r&&(r.removeChild(t),n.size>0&&n.forEach(e=>r&&r.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(null!=e.scopeRef&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){var e;let t=new mk;var r;for(let n of this.traverse())t.addTreeNode(n.scopeRef,null!==(r=null===(e=n.parent)||void 0===e?void 0:e.scopeRef)&&void 0!==r?r:null,n.nodeToRestore);return t}constructor(){this.fastMap=new Map,this.root=new vk({scopeRef:null}),this.fastMap.set(null,this.root)}}class vk{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}let yk=new mk;function bk(){const{width:e,height:t}=function(){let e=cC(),[t,r]=o(()=>e?{width:0,height:0}:kC());return a(()=>{let e=()=>{r(e=>{let t=kC();return t.width===e.width&&t.height===e.height?e:t})};return AC?AC.addEventListener("resize",e):window.addEventListener("resize",e),()=>{AC?AC.removeEventListener("resize",e):window.removeEventListener("resize",e)}},[]),t}();return{"--be-viewport-height":`${t}px`,"--be-viewport-width":`${e}px`}}const wk={initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:"tween",duration:.125}},xk=p(({children:t,style:r,autoFocus:n=!1,restoreFocus:i=!0,isDismissable:o,isContextMenu:s,isOpen:l,onClose:d,triggerRef:h,arrowRef:f,arrowStyle:p,onPointerLeave:g,onPointerEnter:m},v)=>{const y=bk(),b=SC(v),{domProps:w}=function({onClose:e,isDismissable:t=!0,triggerRef:r,isContextMenu:n=!1},i){const o=u({isPointerDown:!1,isContextMenu:n,onClose:e}),s=o.current;s.isContextMenu=n,s.onClose=e;const l=c(e=>{const t=e.target;if(t){const e=t.ownerDocument;if(!e||!e.documentElement.contains(t))return!1}return i.current&&!i.current.contains(t)},[i]),d=c(()=>Ck[Ck.length-1]===i,[i]),h=c(()=>{d()&&s.onClose()},[d,s]),f=c(e=>{var t,n;return!(!r.current||!("contains"in r.current))&&(null==(n=(t=r.current).contains)?void 0:n.call(t,e))},[r]),p=c(e=>{f(e.target)||d()&&(e.stopPropagation(),e.preventDefault())},[f,d]),g=c(e=>{f(e.target)||(d()&&(e.stopPropagation(),e.preventDefault()),(!s.isContextMenu||2!==e.button)&&h())},[f,h,s,d]);return a(()=>{Ck.push(i);const e=e=>{l(e)&&(p(e),o.current.isPointerDown=!0)},t=e=>{o.current.isPointerDown&&l(e)&&(o.current.isPointerDown=!1,g(e))},n=e=>{e.preventDefault(),l(e)&&h()},a=e=>{if(!r.current)return;const t=e.target;let n;r.current instanceof Node?n=r.current:"contextElement"in r.current&&(n=r.current.contextElement),(!(t instanceof Node)||!n||t.contains(n))&&s.onClose()};return document.addEventListener("pointerdown",e,!0),document.addEventListener("pointerup",t,!0),document.addEventListener("contextmenu",n,!0),document.addEventListener("scroll",a,!0),()=>{const r=Ck.indexOf(i);r>=0&&Ck.splice(r,1),document.removeEventListener("pointerdown",e,!0),document.removeEventListener("pointerup",t,!0),document.removeEventListener("contextmenu",n,!0),document.removeEventListener("scroll",a,!0)}},[i,l,s,g,p,r,f,h]),{domProps:{onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),e.preventDefault(),h())}}}}({isDismissable:o,onClose:d,triggerRef:h,isContextMenu:s},b);return e(Gx.div,{className:"isolate z-popover",role:"presentation",ref:b,style:{...y,...r,position:"fixed"},...wk,...gC(w,{onPointerLeave:g,onPointerEnter:m}),children:e(nk,{restoreFocus:i,autoFocus:n,contain:!1,children:t})})}),Ck=[];const _k={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2}};function Sk({position:t="absolute",className:r,isTransparent:n=!1,disableInitialTransition:i,...o}){return e(Gx.div,{...o,className:Tf(r,!n&&"bg-background/80","inset-0 z-10 h-full w-full",t,"backdrop-blur-sm"),"aria-hidden":!0,initial:i?void 0:{opacity:0},animate:{opacity:1},exit:{opacity:0},..._k,transition:{duration:.15}})}const Ak=p(({children:r,autoFocus:n=!1,restoreFocus:i=!0,isDismissable:o,isOpen:a,onClose:s},l)=>{const c=bk(),u=SC(l);return t("div",{className:"fixed inset-0 isolate z-tray",style:c,children:[e(Sk,{onClick:()=>{o&&s()}},"tray-underlay"),e(Gx.div,{ref:u,className:"absolute bottom-0 left-0 right-0 z-20 mx-auto max-h-tray w-full max-w-375 overflow-hidden rounded-t pb-safe-area",role:"presentation",initial:{opacity:0,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"100%"},transition:{type:"tween",duration:.2},children:e(nk,{restoreFocus:i,autoFocus:n,contain:!0,children:r})})]})});function kk(e,t){if(e===t)return!0;if(!e||!t)return!1;const r=Object.keys(e),n=Object.keys(t),i=r.length;if(n.length!==i)return!1;for(let n=0;n<i;n++){const i=r[n];if(e[i]!==t[i]||!Object.prototype.hasOwnProperty.call(t,i))return!1}return!0}function Ek(){const{i18n:e}=Um(e=>e.data);return{locale:e,localeCode:(null==e?void 0:e.language)||"en",lines:null==e?void 0:e.lines}}function Ik(e,{message:t,values:r}){const n=t.match(/\[(.+?)]/),i=null==r?void 0:r.count;if(n&&n[1]&&!Number.isNaN(i)){const[r,o]=n,a=o.split("|");if(!a.length)return t;const s=Tk(e).select(i);let l=a.find(e=>e.startsWith(s));l||(l=a[0]);const c=l.substring(l.indexOf(" ")+1);return t.replace(r,c)}return t}const Tk=yS(e=>new Intl.PluralRules(e));function Fk(e,t){return null!=e&&(void 0!==Object.hasOwn?Object.hasOwn(e,t):Object.hasOwnProperty(t))}const Ok=f(t=>{const{message:r,values:n}=t,{lines:i,localeCode:o}=Ek();let a;if(a=Fk(i,r)?null==i?void 0:i[r]:Fk(i,null==r?void 0:r.toLowerCase())?null==i?void 0:i[null==r?void 0:r.toLowerCase()]:r,!n||!a)return e(y,{children:a});a=Ik(o,{message:a,values:n});const s=[],l=[];if(Object.entries(n).forEach(([e,t])=>{"function"==typeof t?l.push(e):v(t)?s.push(e):null!=t&&(a=null==a?void 0:a.replace(`:${e}`,`${t}`))}),l.length||s.length){const t=[];if(l.length){const e=l.join("");t.push(`(<[${e}]>.+?<\\/[${e}]>)`)}if(s.length){const e=s.join("|");t.push(`(:(?:${e}))`)}const r=new RegExp(t.join("|"),"gm"),i=a.split(r).filter(Boolean).map((e,t)=>{if(e.startsWith("<")&&e.endsWith(">")){const r=e.match(/<([a-z]+)>(.+?)<\/([a-z]+)>/);if(r){const[,e,i]=r,o=null==n?void 0:n[e];if("function"==typeof o){const e=o(i);return w(e,{key:t})}}}if(e.startsWith(":")){const r=e.replace(":",""),i=null==n?void 0:n[r];if(v(i))return w(i,{key:t})}return e});return e(y,{children:i})}return e(y,{children:a})},function(e,t){const{values:r,...n}=e,{values:i,...o}=t;return kk(i,r)&&kk(n,o)});function Pk({listbox:r,children:n,isLoading:i,mobileOverlay:o=Ak,searchField:a,onClose:s,prepend:l,className:c,...u}){const h=zA(),{floatingWidth:f,floatingMinWidth:p="min-w-180",collection:g,showEmptyMessage:m,state:{isOpen:v,setIsOpen:y},positionStyle:b,floating:x,refs:C}=r,_=!l&&h?o:xk,S=Tf("text-base sm:text-sm outline-none bg max-h-inherit flex flex-col",!l&&"shadow-xl border py-4",c,_===xk&&"rounded-panel",_===xk&&"auto"===f?`max-w-288 ${p}`:""),A=d(()=>{let e=0;const t=[];return[...g.values()].reduce((r,n)=>{if(n.section){if(!t.includes(n.section)){const i=w(n.section,{key:n.section.key||e,index:e});r.push(i),t.push(n.section),e++}}else r.push(w(n.element,{key:n.element.key||n.element.props.value}));return r},[])},[g]),k=A.length>0||m&&!i,E=k?t("div",{className:S,role:"presentation",children:[a,e(Mk,{isLoading:i,...u,children:A})]}):null;return t(dS.Provider,{value:r,children:[n,l?E:Dm&&ke(e(eC,{children:v&&k&&e(_,{triggerRef:C.reference,restoreFocus:!0,isOpen:v,onClose:()=>{null==s||s(),y(!1)},isDismissable:!0,style:b,ref:x,children:E})}),Dm)]})}function Mk({className:t,children:r,isLoading:n,...i}){const{role:o,listboxId:s,virtualFocus:l,focusItem:c,state:{activeIndex:d,setActiveIndex:h,selectedIndex:f}}=hS(),p=u(!0),g=u(null);return a(()=>()=>h(null),[h]),a(()=>{if(p.current){const e=d??f;null!=e||l?null!=e&&requestAnimationFrame(()=>{c("increment",e)}):requestAnimationFrame(()=>{var e;null==(e=g.current)||e.focus({preventScroll:!0})})}p.current=!1},[d,f,c,l]),e("div",{tabIndex:l?void 0:-1,role:o,id:s,className:"flex-auto overflow-y-auto overscroll-contain outline-none",ref:g,...i,children:r.length?r:e(Rk,{})})}function Rk(){return e("div",{className:"px-8 py-4 text-sm italic text-muted",children:e(Ok,{message:"There are no items matching your query"})})}function Lk({state:{isOpen:e,setIsOpen:t,selectedIndex:r,activeIndex:n,setInputValue:i,setActiveIndex:o},focusLoopingMode:a,collection:s,focusItem:l,handleItemSelection:c,allowCustomValue:u}){const d=n=>{if(!e&&n.currentTarget.contains(n.target)){if("ArrowDown"===n.key)return n.preventDefault(),t(!0),l("increment",r??0),!0;if("ArrowUp"===n.key)return n.preventDefault(),t(!0),l("decrement",r??s.size-1),!0;if("Enter"===n.key||"Space"===n.key)return n.preventDefault(),t(!0),l("increment",r??0),!0}},h=r=>{const i=Math.max(0,s.size-1);if(e&&r.currentTarget.contains(r.target))switch(r.key){case"ArrowDown":return r.preventDefault(),null==n?l("increment",0):n>=i?"loop"===a?l("increment",0):"deselect"===a&&o(null):l("increment",n+1),!0;case"ArrowUp":return r.preventDefault(),null==n?l("decrement",i):n<=0?"loop"===a?l("decrement",i):"deselect"===a&&o(null):l("decrement",n-1),!0;case"Home":return r.preventDefault(),l("increment",0),!0;case"End":return r.preventDefault(),l("decrement",i),!0;case"Tab":return t(!1),!0}};return{handleTriggerKeyDown:d,handleListboxKeyboardNavigation:h,handleListboxSearchFieldKeydown:r=>{var o,a;if("Enter"===r.key&&null!=n&&s.size){r.preventDefault();const[e,t]=[...s.entries()][n];return void(e&&(c(e),null==(a=(o=t.element.props).onSelected)||a.call(o)))}"Escape"===r.key&&e&&(t(!1),u||i("")),d(r)||h(r)}}}const Nk=new Map;function jk(){const e=function(e){const{localeCode:t}=Ek(),r=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(Nk.has(r))return Nk.get(r);const n=new Intl.Collator(t,e);return Nk.set(r,n),n}({usage:"search",sensitivity:"base"}),t=u({search:"",timeout:void 0}).current,r=(r,n)=>{let i=n??0;for(;null!=i;){const n=r[i],o=null==n?void 0:n.slice(0,t.search.length);if(o&&0===e.compare(o,t.search))return i;if(!(i<r.length-1))return null;i++}return null};return{findMatchingItem:(e,n,i=0)=>{const o=function(e){return 1!==e.length&&/^[A-Z]/i.test(e)?"":e}(e.key);if(!o||e.ctrlKey||e.metaKey)return null;" "===o&&t.search.trim().length>0&&(e.preventDefault(),e.stopPropagation()),t.search+=o;let a=r(n,i);return null==a&&(a=r(n,0)),clearTimeout(t.timeout),t.timeout=setTimeout(()=>{t.search=""},500),a??null}}}function Dk(e){return function(e,{noSSR:t}={noSSR:!0}){const r=typeof window<"u"&&"function"==typeof window.matchMedia,[n,i]=o(t?()=>!!r&&window.matchMedia(e).matches:null);return a(()=>{if(!r)return;const n=window.matchMedia(e),o=()=>{i(n.matches)};return n.addEventListener("change",o),t||o(),()=>{n.removeEventListener("change",o)}},[r,e,t]),typeof window>"u"?null:n}("(max-width: 768px)",e)}const zk=Pf(e("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),"SearchOutlined");var Bk=e=>null==e;var Uk=e=>!Bk(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),Vk=e=>Uk(e)&&e.target?(e=>"checkbox"===e.type)(e.target)?e.target.checked:e.target.value:e,Hk=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Wk(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(Hk&&(e instanceof Blob||e instanceof FileList)||!r&&!Uk(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return Uk(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=Wk(e[r]));else t=e}return t}var $k=e=>Array.isArray(e)?e.filter(Boolean):[],qk=e=>void 0===e,Gk=(e,t,r)=>{if(!t||!Uk(e))return r;const n=$k(t.split(/[,[\].]+?/)).reduce((e,t)=>Bk(e)?e:e[t],e);return qk(n)||n===e?qk(e[t])?r:e[t]:n},Yk=e=>"boolean"==typeof e,Xk=(e,t,r)=>{let n=-1;const i=(e=>/^\w*$/.test(e))(t)?[t]:(e=>$k(e.replace(/["|']|\]/g,"").split(/\.|\[/)))(t),o=i.length,a=o-1;for(;++n<o;){const t=i[n];let o=r;if(n!==a){const r=e[t];o=Uk(r)||Array.isArray(r)?r:isNaN(+i[n+1])?{}:[]}if("__proto__"===t)return;e[t]=o,e=e[t]}return e};const Kk="blur",Zk="change",Qk="all",Jk=i.createContext(null),eE=()=>i.useContext(Jk);var tE=(e,t,r,n)=>{r(e);const{name:i,...o}=e;return(e=>Uk(e)&&!Object.keys(e).length)(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>!0===t[e])},rE=(e,t,r)=>!e||!t||e===t||(e=>Array.isArray(e)?e:[e])(e).some(e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e)));function nE(e){const t=i.useRef(e);t.current=e,i.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function iE(e){const t=eE(),{control:r=t.control,disabled:n,name:o,exact:a}=e||{},[s,l]=i.useState(r._formState),c=i.useRef(!0),u=i.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=i.useRef(o);return d.current=o,nE({disabled:n,next:e=>c.current&&rE(d.current,e.name,a)&&tE(e,u.current,r._updateFormState)&&l({...r._formState,...e}),subject:r._subjects.state}),i.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),((e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Qk&&(t._proxyFormState[i]=!n||Qk),r&&(r[i]=!0),e[i]}});return i})(s,r,u.current,!1)}function oE(e){const t=eE(),{control:r=t.control,name:n,defaultValue:o,disabled:a,exact:s}=e||{},l=i.useRef(n);l.current=n,nE({disabled:a,subject:r._subjects.values,next:e=>{rE(l.current,e.name,s)&&u(Wk(((e,t,r,n,i)=>(e=>"string"==typeof e)(e)?Gk(r,e,i):Array.isArray(e)?e.map(e=>Gk(r,e)):r)(l.current,r._names,e.values||r._formValues,0,o)))}});const[c,u]=i.useState(r._getWatch(n,o));return i.useEffect(()=>r._removeUnmounted()),c}function aE(e={}){const{size:t="md",startAppend:r,endAppend:n,className:i,labelPosition:o,labelDisplay:a="block",inputClassName:s,inputWrapperClassName:l,unstyled:c,invalid:u,disabled:d,background:h="bg-transparent",flexibleHeight:f,inputShadow:p="shadow-sm",descriptionPosition:g="bottom",inputRing:m,inputFontSize:v,labelSuffix:y}={...e};if(c)return{label:"",input:s||"",wrapper:i||"",inputWrapper:l||"",adornment:"",append:{size:"",radius:""},size:{font:"",height:""},description:"",error:""};const b=function({size:e,flexibleHeight:t}){switch(e){case"2xs":return{font:"text-xs",height:t?"min-h-24":"h-24"};case"xs":return{font:"text-xs",height:t?"min-h-30":"h-30"};case"sm":return{font:"text-sm",height:t?"min-h-36":"h-36"};case"lg":return{font:"text-md md:text-lg",height:t?"min-h-50":"h-50"};case"xl":return{font:"text-xl",height:t?"min-h-60":"h-60"};default:return{font:"text-sm",height:t?"min-h-42":"h-42"}}}({size:e.size,flexibleHeight:f});v&&(b.font=v);const w=r||n,x=m||"focus:ring "+(u?"focus:ring-danger/focus focus:border-danger/60":"focus:ring-primary/focus focus:border-primary/60"),C=function(e){const{startAppend:t,endAppend:r,inputRadius:n}=e,i=t||r;return"rounded-full"===n?{input:Tf(!i&&"rounded-full",t&&"rounded-r-full rounded-l-none",r&&"rounded-l-full rounded-r-none"),append:t?"rounded-l-full":"rounded-r-full"}:"rounded-none"===n?{input:"",append:""}:n?{input:n,append:n}:{input:Tf(!i&&"rounded-input",t&&"rounded-r-input rounded-l-none",r&&"rounded-l-input rounded-r-none"),append:t?"rounded-l-input":"rounded-r-input"}}(e);return{label:Tf(a,"first-letter:capitalize text-left whitespace-nowrap",d&&"text-disabled",b.font,y?"":"side"===o?"mr-16":"mb-4"),input:Tf("block text-left relative w-full appearance-none transition-shadow text",h,C.input,sE(e),!d&&`${x} focus:outline-none ${p}`,d&&"text-disabled cursor-not-allowed",s,b.font,b.height,lE(e)),adornment:cE(t),append:{size:oS(t),radius:C.append},wrapper:Tf(i,b.font,{"flex items-center":"side"===o}),inputWrapper:Tf("isolate relative",l,w&&"flex items-stretch"),size:b,description:`text-muted ${"bottom"===g?"pt-10":"pb-10"} text-xs`,error:"text-danger pt-10 text-xs"}}function sE({startAppend:e,endAppend:t,inputBorder:r,invalid:n}){if(r)return r;const i=n?"border-danger":"border-divider";return e||t?e?`${i} border-y border-r`:`${i} border-y border-l`:`${i} border`}function lE({startAdornment:e,endAdornment:t,inputRadius:r}){return"rounded-full"===r?Tf(e?"pl-54":"pl-28",t?"pr-54":"pr-28"):Tf(e?"pl-46":"pl-12",t?"pr-46":"pr-12")}function cE(e){switch(e){case"2xs":return"icon-2xs";case"xs":return"icon-xs";case"sm":case"md":return"icon-sm";case"lg":return"icon-lg";case"xl":return"icon-xl";default:return""}}function uE({children:t,direction:r,className:n,position:i=("start"===r?"left-0":"right-0")}){return t?e("div",{className:Tf("pointer-events-none absolute top-0 z-10 flex h-full min-w-42 items-center justify-center text-muted",i,n),children:t}):null}function dE(e,t){const r={...e};return Object.keys(r).forEach(e=>{const t=e;(null==r[t]||""===r[t])&&delete r[t]}),r}const hE=i.forwardRef((r,n)=>{const{children:i,description:o,errorMessage:a,descriptionProps:s={},errorMessageProps:l={},startAdornment:c,endAdornment:u,adornmentPosition:d,startAppend:h,endAppend:f,fieldClassNames:p,disabled:g,wrapperProps:m}=r;return t("div",{className:p.wrapper,ref:n,...m,children:[e(fE,{...r}),t("div",{className:p.inputWrapper,children:[e(uE,{direction:"start",className:p.adornment,position:d,children:c}),h&&e(pE,{style:p.append,disabled:g,children:h}),i,f&&e(pE,{style:p.append,disabled:g,children:f}),e(uE,{direction:"end",className:p.adornment,position:d,children:u})]}),o&&!a&&e("div",{className:p.description,...s,children:o}),a&&e("div",{className:p.error,...l,children:a})]})});function fE({labelElementType:r,fieldClassNames:n,labelProps:i,label:o,labelSuffix:a,labelSuffixPosition:s="spaced",required:l}){if(!o)return null;const c=t(r||"label",{className:n.label,...i,children:[o,l&&e("span",{className:"text-danger",children:" *"})]});return a?t("div",{className:Tf("mb-4 flex w-full gap-4","spaced"===s?"items-end":"items-center"),children:[c,e("div",{className:Tf("text-xs text-muted","spaced"===s?"ml-auto":""),children:a})]}):c}function pE({children:e,style:t,disabled:r}){return i.cloneElement(e,{...e.props,disabled:e.props.disabled||r,...dE(t)})}function gE({autoFocus:e,autoSelectText:t},r){const n=u(e);a(()=>{n.current&&r.current&&requestAnimationFrame(()=>{var e,n;null==(e=r.current)||e.focus(),t&&"input"===(null==(n=r.current)?void 0:n.nodeName.toLowerCase())&&r.current.select()}),n.current=!1},[r,t])}function mE(e){const{focusRef:t,labelElementType:r="label",label:n,labelSuffix:i,labelSuffixPosition:o,autoFocus:a,autoSelectText:s,labelPosition:l,descriptionPosition:c,size:u,errorMessage:d,description:h,flexibleHeight:f,startAdornment:p,endAdornment:g,startAppend:m,adornmentPosition:v,endAppend:y,className:w,inputClassName:x,inputWrapperClassName:C,unstyled:_,background:S,invalid:A,disabled:k,id:E,inputRadius:I,inputBorder:T,inputShadow:F,inputRing:O,inputFontSize:P,...M}=e;gE(e,t);const R=b(),L=E||R,N={id:`${L}-label`,htmlFor:"label"===r?L:void 0},j={id:`${L}-description`},D={id:`${L}-error`},z={"aria-label":e.label||e["aria-label"]||!e.placeholder?e["aria-label"]:e.placeholder,"aria-invalid":A||void 0,id:L,disabled:k,...M},B=[];n&&B.push(N.id),z["aria-labelledby"]&&B.push(z["aria-labelledby"]),z["aria-labelledby"]=B.length?B.join(" "):void 0;const U=[];return h&&U.push(j.id),d&&U.push(D.id),z["aria-describedby"]&&U.push(z["aria-describedby"]),z["aria-describedby"]=U.length?U.join(" "):void 0,{fieldProps:{errorMessageProps:D,descriptionProps:j,labelProps:N,disabled:k,label:n,labelSuffix:i,labelSuffixPosition:o,autoFocus:a,autoSelectText:s,labelPosition:l,descriptionPosition:c,size:u,errorMessage:d,description:h,flexibleHeight:f,startAdornment:p,endAdornment:g,startAppend:m,adornmentPosition:v,endAppend:y,className:w,inputClassName:x,inputWrapperClassName:C,unstyled:_,background:S,invalid:A},inputProps:z}}const vE=p(({inputElementType:t="input",flexibleHeight:r,inputRef:n,inputTestId:i,...o},a)=>{const s=SC(n),{fieldProps:l,inputProps:c}=mE({...o,focusRef:s}),u="textarea"===t,d=u?"textarea":"input",h=aE({...o,flexibleHeight:r||"textarea"===t});return"textarea"===t&&!o.unstyled&&(h.input=`${h.input} py-12`),e(hE,{ref:a,fieldClassNames:h,...l,children:e(d,{"data-testid":i,ref:s,...c,rows:u?c.rows||4:void 0,className:h.input})})});i.forwardRef(({name:t,...r},n)=>{const{field:{onChange:o,onBlur:a,value:s="",ref:l},fieldState:{invalid:c,error:u}}=function(e){const t=eE(),{name:r,disabled:n,control:o=t.control,shouldUnregister:a}=e,s=((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(o._names.array,r),l=oE({control:o,name:r,defaultValue:Gk(o._formValues,r,Gk(o._defaultValues,r,e.defaultValue)),exact:!0}),c=iE({control:o,name:r}),u=i.useRef(o.register(r,{...e.rules,value:l,...Yk(e.disabled)?{disabled:e.disabled}:{}}));return i.useEffect(()=>{const e=o._options.shouldUnregister||a,t=(e,t)=>{const r=Gk(o._fields,e);r&&(r._f.mount=t)};if(t(r,!0),e){const e=Wk(Gk(o._options.defaultValues,r));Xk(o._defaultValues,r,e),qk(Gk(o._formValues,r))&&Xk(o._formValues,r,e)}return()=>{(s?e&&!o._state.action:e)?o.unregister(r):t(r,!1)}},[r,o,s,a]),i.useEffect(()=>{Gk(o._fields,r)&&o._updateDisabledField({disabled:n,fields:o._fields,name:r,value:Gk(o._fields,r)._f.value})},[n,r,o]),{field:{name:r,value:l,...Yk(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:i.useCallback(e=>u.current.onChange({target:{value:Vk(e),name:r},type:Zk}),[r]),onBlur:i.useCallback(()=>u.current.onBlur({target:{value:Gk(o._formValues,r),name:r},type:Kk}),[r,o]),ref:e=>{const t=Gk(o._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Gk(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!Gk(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Gk(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Gk(c.validatingFields,r)},error:{enumerable:!0,get:()=>Gk(c.errors,r)}})}}({name:t}),d={onChange:o,onBlur:a,value:s??"",invalid:c,errorMessage:null==u?void 0:u.message,inputRef:l,name:t};return e(vE,{ref:n,...gC(d,r)})});const yE=p((t,r)=>{const{searchPlaceholder:n,showSearchField:i,children:[o,a],floatingWidth:s="auto",isLoading:l}=t,c=b(),u=Dk(),d=DA({...t,clearInputOnItemSelection:!0,showEmptyMessage:i,floatingWidth:u?"auto":s,virtualFocus:i,role:i?"listbox":"menu",focusLoopingMode:i?"stay":"loop",children:a.props.children},r),{state:{isOpen:h,setIsOpen:f,activeIndex:p,inputValue:g,setInputValue:m},listboxId:v,focusItem:y,listContent:x,reference:C,onInputChange:_}=d,{handleTriggerKeyDown:S,handleListboxKeyboardNavigation:A,handleListboxSearchFieldKeydown:k}=Lk(d),{findMatchingItem:E}=jk();return e(Pk,{onClick:e=>e.stopPropagation(),listbox:d,onKeyDownCapture:i?void 0:e=>{if(!h)return;const t=E(e,x,p);null!=t&&y("increment",t)},onKeyDown:A,onClose:i?()=>m(""):void 0,"aria-labelledby":c,isLoading:l,searchField:i?e(vE,{size:"sm",placeholder:n,startAdornment:e(zk,{}),className:"flex-shrink-0 px-8 pb-8 pt-4",autoFocus:!0,"aria-expanded":h?"true":"false","aria-haspopup":"listbox","aria-controls":h?v:void 0,"aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:"false",value:g,onChange:_,onKeyDown:e=>{k(e)}}):null,children:w(o,{id:c,"aria-expanded":h?"true":"false","aria-haspopup":"menu","aria-controls":h?v:void 0,ref:C,onKeyDown:S,onClick:sS(e=>{var t,r;null==(r=null==(t=o.props)?void 0:t.onClick)||r.call(t,e),f(!h)})})})});function bE({children:e}){return e}function wE({item:r,button:n}){return t(yE,{children:[n,e(bE,{children:(r.menuItems||[]).map(t=>e(mS,{value:t.label,onSelected:()=>{t.action(qm().editor)},children:t.label},t.label))})]})}const xE=p(({children:e,size:r="md",iconSize:n=(r&&r.length<=3?r:"md"),variant:i="text",radius:o="rounded-button",className:a,padding:s,equalWidth:l=!0,badge:c,...u},d)=>{const h=Tf(oS(r,{padding:s,equalWidth:l,variant:i}),a,c&&"relative");return t(lS,{...u,ref:d,radius:o,variant:i,className:h,children:[w(e,{size:n}),c]})});const CE=i.memo(function({icon:t,className:r,size:n}){let o;return o=i.isValidElement(t)?i.cloneElement(t,{className:"svg-iconEl"}):"string"==typeof t?e("img",{className:"w-font h-font",src:t,alt:""}):Array.isArray(t)?i.createElement(Mf(t),{size:n}):i.createElement(t,{size:n}),e("span",{className:Tf(r,"leading-none"),children:o})});function _E({value:t}){return t?e(Ok,"string"==typeof t?{message:t}:{...t}):null}function SE({item:t}){const r=t.label?e(kE,{item:t}):e(AE,{item:t});return t.menuItems?e(wE,{item:t,button:r}):i.cloneElement(r,{onClick:()=>{var e;null==(e=t.action)||e.call(t,qm().editor)}})}const AE=p(({item:t,...r},n)=>e(xE,{ref:n,radius:"rounded-full",size:"sm",...r,children:e(CE,{icon:t.icon})})),kE=p(({item:t,...r},n)=>e(cS,{ref:n,radius:"rounded-full",size:"xs",color:t.buttonColor||"primary",variant:t.buttonVariant||"flat",startIcon:t.icon&&e(CE,{icon:t.icon}),...r,children:e(_E,{value:t.label})}));function EE({children:t,color:r,variant:n,radius:o="rounded-button",size:a,className:s,value:l,onChange:c,multiple:u,disabled:d}){const h=i.Children.map(t,(e,s)=>{if(i.isValidElement(e)){const h=(e=>void 0!==l&&(u?l.includes(e):e===l))(e.props.value),f=h?"primary":r;return i.cloneElement(e,{color:h?"primary":r,variant:n,size:a,radius:null,disabled:e.props.disabled||d,...e.props,onClick:t=>{e.props.onClick&&e.props.onClick(t),c&&(u?null==c||c((e=>{const t=[...l],r=l.indexOf(e);return r>-1?t.splice(r,1):t.push(e),t})(e.props.value)):null==c||c(e.props.value))},className:Tf(e.props.className,h?"z-20":"z-10",IE(s,t,o,f))})}});return e("div",{className:Tf(o,"isolate inline-flex",s),children:h})}function IE(e,t,r,n){return 0===e?Tf(r,"rounded-tr-none rounded-br-none",!n&&"border-r-transparent disabled:border-r-transparent"):e===t.length-1?Tf(r,"rounded-tl-none rounded-bl-none -ml-1"):Tf("rounded-none -ml-1",!n&&"border-r-transparent disabled:border-r-transparent")}const TE=Pf(e("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"}),"UndoOutlined"),FE=Pf(e("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"}),"RedoOutlined");function OE(){const r=$m(e=>e.history.canUndo),n=$m(e=>e.history.canRedo);return t(EE,{variant:"outline",children:[e(xE,{equalWidth:!1,size:"xs",padding:"pl-12 pr-10",radius:"rounded-full",disabled:!r,onClick:()=>{Gm().history.undo()},children:e(TE,{})},"undo"),e(xE,{equalWidth:!1,padding:"pl-10 pr-12",size:"xs",radius:"rounded-full",disabled:!n,onClick:()=>{Gm().history.redo()},children:e(FE,{})},"redo")]})}const PE=Pf(e("path",{d:"M19 13H5v-2h14v2z"}),"RemoveOutlined"),ME=Pf(e("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"AddOutlined");function RE(){var r,n;const i=$m(e=>e.zoom)||1;return $m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.zoom)?void 0:r.allowUserZoom})??1?t("div",{className:"flex items-center select-none",children:[e(xE,{size:"sm",disabled:!(null!=(r=Gm().zoom)&&r.canZoomOut()),onClick:()=>{Gm().zoom.zoomOut(Gm().zoom.step)},children:e(PE,{})}),t("div",{className:"w-[4ch] text-sm text-center",children:[Math.round(100*i),"%"]}),e(xE,{size:"sm",disabled:!(null!=(n=Gm().zoom)&&n.canZoomIn()),onClick:()=>{Gm().zoom.zoomIn(Gm().zoom.step)},children:e(ME,{})})]}):null}function LE({item:t}){switch(t.type){case"undoWidget":return e(OE,{});case"zoomWidget":return e(RE,{});case"button":return e(SE,{item:t});case"image":return e("img",{className:"h-30 object-cover",src:KC(t.src),alt:""});default:return null}}const NE=Pf(e("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}),"CloseOutlined");function jE(){var e;let t=$m(e=>{var t;return(null==(t=e.config.ui)?void 0:t.mode)===yf.OVERLAY});const{width:r}=$m(e=>e.stageSize),n=r<=700;return n&&null!=(e=qm().config.ui)&&e.forceOverlayModeOnMobile&&(t=!0),{isModal:t,isMobile:n}}function DE(){const{isModal:r,isMobile:n}=jE(),i=$m(e=>{var t;return null==(t=e.config.ui)?void 0:t.allowEditorClose})??!0,o=$m(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.menubar)?void 0:r.items}),{left:a,center:s,right:l}=d(()=>function(e,t){const r={left:[],center:[],right:[]};(e||[]).filter(e=>!t&&!e.mobileOnly||t&&!e.desktopOnly).forEach(e=>{"left"===e.align?r.left.push({...e,position:e.position??1}):"right"===e.align?r.right.push({...e,position:e.position??1}):r.center.push({...e,position:e.position??1})});const n=Object.entries(r).map(([e,t])=>[e,t.sort((e,t)=>(e.position??0)-(t.position??0))]);return Object.fromEntries(n)}(o||[],n),[o,n]),c=r&&n&&i&&e(xE,{size:"sm",className:"ml-10",onClick:()=>{qm().editor.close()},children:e(NE,{})});return t(Gx.div,{className:nS,...iS,children:[e("div",{className:"mr-auto flex items-center gap-8",children:a.map((t,r)=>e(LE,{item:t},r))}),e("div",{className:"flex items-center gap-10",children:s.map((t,r)=>e(LE,{item:t},r))}),e("div",{className:"ml-auto flex items-center gap-8",children:l.map((t,r)=>e(LE,{item:t},r))}),c]})}function zE(){const t=$m(e=>{var t;return null==(t=e.crop.zoneRect)?void 0:t.width})||1,r=$m(e=>{var t;return null==(t=e.crop.zoneRect)?void 0:t.height})||1;return e("div",{className:"text-sm",children:`${t}x${r}`})}function BE(){const r=$m(e=>e.activeTool);return t(Gx.div,{className:nS,...iS,children:[e(UE,{}),VE(r),e(HE,{})]})}function UE(){const{isMobile:t}=jE(),r=$m(e=>e.dirty);return t?e(xE,{size:"sm",onClick:()=>{qm().cancelChanges()},children:e(NE,{})}):e(cS,{variant:"outline",size:"xs",startIcon:e(NE,{}),radius:"rounded-full",className:"min-w-92",onClick:()=>{qm().cancelChanges()},children:e(Ok,r?{message:"Cancel"}:{message:"Close"})})}function VE(t){var r,n;if(!t)return null;const i=e("div",{className:"capitalize text-sm",children:e(Ok,{message:t})});return t===Ef.CROP&&((null==(n=null==(r=qm().config.tools)?void 0:r.crop)?void 0:n.allowCustomRatio)??1)?e(zE,{}):i}function HE(){const{isMobile:t}=jE(),r=$m(e=>e.dirty);return t?e(xE,{size:"sm",disabled:!r,onClick:()=>{qm().applyChanges()},children:e(fS,{})}):e(cS,{variant:"flat",color:"primary",size:"xs",disabled:!r,startIcon:e(fS,{}),radius:"rounded-full",onClick:()=>{qm().applyChanges()},children:e(Ok,{message:"Apply"})})}function WE(){const t=$m(e=>e.activeTool);return e(eC,{initial:!1,children:t?e(BE,{},"activeToolbar"):e(DE,{},"mainToolbar")})}const $E={newCanvas:wf("Loading Canvas"),mainImage:wf("Loading Image"),state:wf("Loading State"),merge:wf("Processing Image")};function qE(){const[t,r]=o(!1);return a(()=>{$m.subscribe(e=>e.loading,e=>{e&&r(e)})},[]),e(eC,{children:t&&e(Gx.div,{initial:{y:"60%",opacity:0},animate:{y:0,opacity:1},exit:{y:"-60%",opacity:0},transition:{type:"tween",duration:.3},onAnimationComplete:()=>{setTimeout(()=>{r(!1)},400)},className:"absolute z-loading-indicator inset-0 m-auto p-6 w-144 h-32 text-center text-sm bg-paper rounded-full shadow-lg",children:e(Ok,{...$E[t]})})})}const GE={toVector:(e,t)=>(void 0===e&&(e=t),Array.isArray(e)?e:[e,e]),add:(e,t)=>[e[0]+t[0],e[1]+t[1]],sub:(e,t)=>[e[0]-t[0],e[1]-t[1]],addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function YE(e,t,r){return 0===t||Math.abs(t)===1/0?Math.pow(e,5*r):e*t*r/(t+r*e)}function XE(e,t,r,n=.15){return 0===n?function(e,t,r){return Math.max(t,Math.min(e,r))}(e,t,r):e<t?-YE(t-e,r-t,n)+t:e>r?+YE(e-r,r-t,n)+r:e}function KE(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function ZE(e,t,r){return(t=KE(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function QE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function JE(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?QE(Object(r),!0).forEach(function(t){ZE(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QE(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const eI={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function tI(e){return e?e[0].toUpperCase()+e.slice(1):""}const rI=["enter","leave"];function nI(e,t="",r=!1){const n=eI[e],i=n&&n[t]||t;return"on"+tI(e)+tI(i)+(function(e=!1,t){return e&&!rI.includes(t)}(r,i)?"Capture":"")}const iI=["gotpointercapture","lostpointercapture"];function oI(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const n=iI.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(n);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function aI(e){return"touches"in e}function sI(e){return aI(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function lI(e){return aI(e)?function(e){return"touchend"===e.type||"touchcancel"===e.type?e.changedTouches:e.targetTouches}(e)[0]:e}function cI(e,t){try{const r=t.clientX-e.clientX,n=t.clientY-e.clientY,i=(t.clientX+e.clientX)/2,o=(t.clientY+e.clientY)/2,a=Math.hypot(r,n);return{angle:-180*Math.atan2(r,n)/Math.PI,distance:a,origin:[i,o]}}catch{}return null}function uI(e){return function(e){return Array.from(e.touches).filter(t=>{var r,n;return t.target===e.currentTarget||(null===(r=e.currentTarget)||void 0===r||null===(n=r.contains)||void 0===n?void 0:n.call(r,t.target))})}(e).map(e=>e.identifier)}function dI(e,t){const[r,n]=Array.from(e.touches).filter(e=>t.includes(e.identifier));return cI(r,n)}function hI(e){const t=lI(e);return aI(e)?t.identifier:t.pointerId}function fI(e){const t=lI(e);return[t.clientX,t.clientY]}function pI(e){let{deltaX:t,deltaY:r,deltaMode:n}=e;return 1===n?(t*=40,r*=40):2===n&&(t*=800,r*=800),[t,r]}function gI(e,...t){return"function"==typeof e?e(...t):e}function mI(){}function vI(...e){return 0===e.length?mI:1===e.length?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function yI(e,t){return Object.assign({},t,e||{})}class bI{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:r,args:n}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?gI(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:r,shared:n}=this;t.args=this.args;let i=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,function(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:n,metaKey:i,ctrlKey:o}=e;Object.assign(t,{shiftKey:r,altKey:n,metaKey:i,ctrlKey:o})}return t}(e)),n.down=n.pressed=n.buttons%2==1||n.touches>0,i=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const e=t._delta.map(Math.abs);GE.addTo(t._distance,e)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[s,l]=r.threshold,{_step:c,values:u}=t;if(r.hasCustomTransform?(!1===c[0]&&(c[0]=Math.abs(o)>=s&&u[0]),!1===c[1]&&(c[1]=Math.abs(a)>=l&&u[1])):(!1===c[0]&&(c[0]=Math.abs(o)>=s&&Math.sign(o)*s),!1===c[1]&&(c[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=!1!==c[0]||!1!==c[1],!t.intentional)return;const d=[0,0];if(r.hasCustomTransform){const[e,t]=u;d[0]=!1!==c[0]?e-c[0]:0,d[1]=!1!==c[1]?t-c[1]:0}else d[0]=!1!==c[0]?o-c[0]:0,d[1]=!1!==c[1]?a-c[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(d);const h=t.offset,f=t._active&&!t._blocked||t.active;f&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=n[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=gI(r.bounds,t)),this.setup&&this.setup()),t.movement=d,this.computeOffset()));const[p,g]=t.offset,[[m,v],[y,b]]=t._bounds;t.overflow=[p<m?-1:p>v?1:0,g<y?-1:g>b?1:0],t._movementBound[0]=!!t.overflow[0]&&(!1===t._movementBound[0]?t._movement[0]:t._movementBound[0]),t._movementBound[1]=!!t.overflow[1]&&(!1===t._movementBound[1]?t._movement[1]:t._movementBound[1]);const w=t._active&&r.rubberband||[0,0];if(t.offset=function(e,[t,r],[n,i]){const[[o,a],[s,l]]=e;return[XE(t,o,a,n),XE(r,s,l,i)]}(t._bounds,t.offset,w),t.delta=GE.sub(t.offset,h),this.computeMovement(),f&&(!t.last||i>32)){t.delta=GE.sub(t.offset,h);const e=t.delta.map(Math.abs);GE.addTo(t.distance,e),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&i>0&&(t.velocity=[e[0]/i,e[1]/i],t.timeDelta=i)}}emit(){const e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(JE(JE(JE({},t),e),{},{[this.aliasKey]:e.values}));void 0!==n&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}class wI extends bI{constructor(...e){super(...e),ZE(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=GE.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=GE.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,r=this.config;if(!t.axis&&e){const n="object"==typeof r.axisThreshold?r.axisThreshold[sI(e)]:r.axisThreshold;t.axis=function([e,t],r){const n=Math.abs(e),i=Math.abs(t);return n>i&&n>r?"x":i>n&&i>r?"y":void 0}(t._movement,n)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0}}}const xI=e=>e,CI={enabled:(e=!0)=>e,eventOptions:(e,t,r)=>JE(JE({},r.shared.eventOptions),e),preventDefault:(e=!1)=>e,triggerAllEvents:(e=!1)=>e,rubberband(e=0){switch(e){case!0:return[.15,.15];case!1:return[0,0];default:return GE.toVector(e)}},from:e=>"function"==typeof e?e:null!=e?GE.toVector(e):void 0,transform(e,t,r){const n=e||r.shared.transform;return this.hasCustomTransform=!!n,n||xI},threshold:e=>GE.toVector(e,0)},_I=JE(JE({},CI),{},{axis(e,t,{axis:r}){if(this.lockDirection="lock"===r,!this.lockDirection)return r},axisThreshold:(e=0)=>e,bounds(e={}){if("function"==typeof e)return t=>_I.bounds(e(t));if("current"in e)return()=>e.current;if("function"==typeof HTMLElement&&e instanceof HTMLElement)return e;const{left:t=-1/0,right:r=1/0,top:n=-1/0,bottom:i=1/0}=e;return[[t,r],[n,i]]}}),SI={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]};const AI=typeof window<"u"&&window.document&&window.document.createElement;function kI(){return AI&&"ontouchstart"in window}const EI={isBrowser:AI,gesture:function(){try{return"constructor"in GestureEvent}catch{return!1}}(),touch:kI(),touchscreen:kI()||AI&&window.navigator.maxTouchPoints>1,pointer:AI&&"onpointerdown"in window,pointerLock:AI&&"exitPointerLock"in window.document},II={mouse:0,touch:0,pen:8},TI=JE(JE({},_I),{},{device(e,t,{pointer:{touch:r=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&EI.pointerLock,EI.touch&&r?"touch":this.pointerLock?"mouse":EI.pointer&&!i?"pointer":EI.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay="number"==typeof r?r:r||void 0===r&&e?250:void 0,EI.touchscreen&&!1!==r)return e||(void 0!==r?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&"pointer"===this.device&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:n=3,axis:i}){const o=GE.toVector(e,r?n:i?1:0);return this.filterTaps=r,this.tapsThreshold=n,o},swipe({velocity:e=.5,distance:t=50,duration:r=250}={}){return{velocity:this.transform(GE.toVector(e)),distance:this.transform(GE.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return 180;case!1:return 0;default:return e}},axisThreshold:e=>e?JE(JE({},II),e):II,keyboardDisplacement:(e=10)=>e});const FI=JE(JE({},CI),{},{device(e,t,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!EI.touch&&EI.gesture)return"gesture";if(EI.touch&&n)return"touch";if(EI.touchscreen){if(EI.pointer)return"pointer";if(EI.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:n={}}){const i=e=>{const t=yI(gI(r,e),{min:-1/0,max:1/0});return[t.min,t.max]},o=e=>{const t=yI(gI(n,e),{min:-1/0,max:1/0});return[t.min,t.max]};return"function"!=typeof r&&"function"!=typeof n?[i(),o()]:e=>[i(e),o(e)]},threshold(e,t,r){return this.lockDirection="lock"===r.axis,GE.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey:e=>void 0===e?"ctrlKey":e,pinchOnWheel:(e=!0)=>e});JE(JE({},_I),{},{mouseOnly:(e=!0)=>e}),JE(JE({},_I),{},{mouseOnly:(e=!0)=>e});const OI=new Map,PI=new Map;function MI(e){OI.set(e.key,e.engine),PI.set(e.key,e.resolver)}const RI={key:"drag",engine:class extends wI{constructor(...e){super(...e),ZE(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=_I.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,r=this.state;if(null!=e.buttons&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):-1!==t.pointerButtons&&t.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=hI(e),r._pointerActive=!0,this.computeValues(fI(e)),this.computeInitial(),t.preventScrollAxis&&"mouse"!==sI(e)?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,r=this.config;if(!t._pointerActive)return;const n=hI(e);if(void 0!==t._pointerId&&n!==t._pointerId)return;const i=fI(e);return document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=GE.sub(i,t._values),this.computeValues(i)),GE.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional?(this.timeoutStore.remove("dragDelay"),t.active=!1,void this.startPointerDrag(e)):r.preventScrollAxis&&!t._preventScroll?t.axis?t.axis===r.preventScrollAxis||"xy"===r.preventScrollAxis?(t._active=!1,void this.clean()):(this.timeoutStore.remove("startPointerDrag"),void this.startPointerDrag(e)):void 0:void this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;const n=hI(e);if(void 0!==t._pointerId&&n!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[i,o]=t._distance;if(t.tap=i<=r.tapsThreshold&&o<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{const[e,n]=t._delta,[i,o]=t._movement,[a,s]=r.swipe.velocity,[l,c]=r.swipe.distance,u=r.swipe.duration;if(t.elapsedTime<u){const r=Math.abs(e/t.timeDelta),u=Math.abs(n/t.timeDelta);r>a&&Math.abs(i)>l&&(t.swipe[0]=Math.sign(e)),u>s&&Math.abs(o)>c&&(t.swipe[1]=Math.sign(n))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,r=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,function(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=SI[e.key];if(t){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,n),r._keyboardActive=!0,GE.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in SI&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},resolver:TI},LI={key:"pinch",engine:class extends bI{constructor(...e){super(...e),ZE(this,"ingKey","pinching"),ZE(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:r}=this.state;this.state.offset="wheel"===e?GE.add(t,r):[(1+t[0])*r[0],t[1]+r[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,r]=e._movement;if(!e.axis){const n=30*Math.abs(t)-Math.abs(r);n<0?e.axis="angle":n>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&("scale"===this.state.axis?e[1]=0:"angle"===this.state.axis&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,r=this.ctrl.touchIds;if(t._active&&t._touchIds.every(e=>r.has(e))||r.size<2)return;this.start(e),t._touchIds=Array.from(r).slice(0,2);const n=dI(e,t._touchIds);n&&this.pinchStart(e,n)}pointerStart(e){if(null!=e.buttons&&e.buttons%2!=1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,r=t._pointerEvents,n=this.ctrl.pointerIds;if(t._active&&Array.from(r.keys()).every(e=>n.has(e))||(r.size<2&&r.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const i=cI(...Array.from(r.values()));i&&this.pinchStart(e,i)}pinchStart(e,t){this.state.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=dI(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const r=cI(...Array.from(t.values()));r&&this.pinchMove(e,r)}pinchMove(e,t){const r=this.state,n=r._values[1],i=t.angle-n;let o=0;Math.abs(i)>270&&(o+=Math.sign(i)),this.computeValues([t.distance,t.angle-360*o]),r.origin=t.origin,r.turns=o,r._movement=[r._values[0]/r._initial[0]-1,r._values[1]-r._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(e=>!this.ctrl.touchIds.has(e))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const r=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=GE.sub(t._movement,r),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(t=>e[t]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const t=this.state;t._delta=[-pI(e)[1]/100*t.offset[0],0],GE.addTo(t._movement,t._delta),function(e){const[t,r]=e.overflow,[n,i]=e._delta,[o,a]=e._direction;(t<0&&n>0&&o<0||t>0&&n<0&&o>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&i>0&&a<0||r>0&&i<0&&a>0)&&(e._movement[1]=e._movementBound[1])}(t),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}},resolver:FI};function NI(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}const jI={target(e){if(e)return()=>"current"in e?e.current:e},enabled:(e=!0)=>e,window:(e=(EI.isBrowser?window:void 0))=>e,eventOptions:({passive:e=!0,capture:t=!1}={})=>({passive:e,capture:t}),transform:e=>e},DI=["target","eventOptions","window","enabled","transform"];function zI(e={},t){const r={};for(const[n,i]of Object.entries(t))switch(typeof i){case"function":r[n]=i.call(r,e[n],n,e);break;case"object":r[n]=zI(e[n],i);break;case"boolean":i&&(r[n]=e[n])}return r}class BI{constructor(e,t){ZE(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,n,i){const o=this._listeners,a=function(e,t=""){const r=eI[e];return e+(r&&r[t]||t)}(t,r),s=JE(JE({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),i);e.addEventListener(a,n,s);const l=()=>{e.removeEventListener(a,n,s),o.delete(l)};return o.add(l),l}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class UI{constructor(){ZE(this,"_timeouts",new Map)}add(e,t,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...n))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class VI{constructor(e){ZE(this,"gestures",new Set),ZE(this,"_targetEventStore",new BI(this)),ZE(this,"gestureEventStores",{}),ZE(this,"gestureTimeoutStores",{}),ZE(this,"handlers",{}),ZE(this,"config",{}),ZE(this,"pointerIds",new Set),ZE(this,"touchIds",new Set),ZE(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(e,t){t.drag&&HI(e,"drag"),t.wheel&&HI(e,"wheel"),t.scroll&&HI(e,"scroll"),t.move&&HI(e,"move"),t.pinch&&HI(e,"pinch"),t.hover&&HI(e,"hover")}(this,e)}setEventIds(e){return aI(e)?(this.touchIds=new Set(uI(e)),this.touchIds):"pointerId"in e?("pointerup"===e.type||"pointercancel"===e.type?this.pointerIds.delete(e.pointerId):"pointerdown"===e.type&&this.pointerIds.add(e.pointerId),this.pointerIds):void 0}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=function(e,t,r={}){const n=e,{target:i,eventOptions:o,window:a,enabled:s,transform:l}=n,c=NI(n,DI);if(r.shared=zI({target:i,eventOptions:o,window:a,enabled:s,transform:l},jI),t){const e=PI.get(t);r[t]=zI(JE({shared:r.shared},c),e)}else for(const e in c){const t=PI.get(e);t&&(r[e]=zI(JE({shared:r.shared},c[e]),t))}return r}(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,r={};let n;if(!t.target||(n=t.target(),n)){if(t.enabled){for(const t of this.gestures){const i=this.config[t],o=WI(r,i.eventOptions,!!n);if(i.enabled){new(OI.get(t))(this,e,t).bind(o)}}const i=WI(r,t.eventOptions,!!n);for(const t in this.nativeHandlers)i(t,"",r=>this.nativeHandlers[t](JE(JE({},this.state.shared),{},{event:r,args:e})),void 0,!0)}for(const e in r)r[e]=vI(...r[e]);if(!n)return r;for(const e in r){const{device:t,capture:i,passive:o}=oI(e);this._targetEventStore.add(n,t,"",r[e],{capture:i,passive:o})}}}}function HI(e,t){e.gestures.add(t),e.gestureEventStores[t]=new BI(e,t),e.gestureTimeoutStores[t]=new UI}const WI=(e,t,r)=>(n,i,o,a={},s=!1)=>{var l,c;const u=null!==(l=a.capture)&&void 0!==l?l:t.capture,d=null!==(c=a.passive)&&void 0!==c?c:t.passive;let h=s?n:nI(n,i,u);r&&d&&(h+="Passive"),e[h]=e[h]||[],e[h].push(o)},$I=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function qI(e,t,r,n,i,o){if(!e.has(r)||!OI.has(n))return;const a=r+"Start",s=r+"End";i[n]=e=>{let n;return e.first&&a in t&&t[a](e),r in t&&(n=t[r](e)),e.last&&s in t&&t[s](e),n},o[n]=o[n]||{}}function GI(e,t){const[r,n,i]=function(e){const t={},r={},n=new Set;for(let i in e)$I.test(i)?(n.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,n]}(e),o={};return qI(i,r,"onDrag","drag",o,t),qI(i,r,"onWheel","wheel",o,t),qI(i,r,"onScroll","scroll",o,t),qI(i,r,"onPinch","pinch",o,t),qI(i,r,"onMove","move",o,t),qI(i,r,"onHover","hover",o,t),{handlers:o,config:t,nativeHandlers:n}}function YI({e:e,rect:t,deltaX:r,deltaY:n}){return{rect:t,x:e.clientX,y:e.clientY,deltaX:r??0,deltaY:n??0,nativeEvent:e}}function XI({onMoveStart:e,onMove:t,onMoveEnd:r,minimumMovement:n=0,preventDefault:i,stopPropagation:o=!0,onPress:a,onLongPress:s,...l}){const c=u({lastPosition:{x:0,y:0},started:!1,longPressTriggered:!1}).current,{addGlobalListener:d,removeGlobalListener:h}=_C(),f=r=>{if(r.pointerId===c.id){const i=r.clientX-c.lastPosition.x,o=r.clientY-c.lastPosition.y;(Math.abs(i)>=n||Math.abs(o)>=n)&&!c.started&&(t=>{!c.el||!1===(null==e?void 0:e(t,c.el))||(c.originalTouchAction=c.el.style.touchAction,c.el.style.touchAction="none",c.originalUserSelect=document.documentElement.style.userSelect,document.documentElement.style.userSelect="none",c.started=!0)})(r),c.started&&(null==t||t(r,i,o),c.lastPosition={x:r.clientX,y:r.clientY})}},p=e=>{var t;if(e.pointerId===c.id){c.longPressTimer&&clearTimeout(c.longPressTimer);const n=c.longPressTriggered;c.longPressTriggered=!1,c.started&&(null==r||r(e)),c.el&&("pointercancel"!==e.type&&(null==(t=l.onPointerUp)||t.call(l,e,c.el),e.target&&c.el.contains(e.target)&&(n?null==s||s(e,c.el):null==a||a(e,c.el))),document.documentElement.style.userSelect=c.originalUserSelect||"",c.el.style.touchAction=c.originalTouchAction||""),c.id=void 0,c.started=!1,h(window,"pointermove",f,!1),h(window,"pointerup",p,!1),h(window,"pointercancel",p,!1)}};return{domProps:{onPointerDown:sS(r=>{var n;if(0===r.button&&null==c.id){if(c.started=!1,!1===(null==(n=l.onPointerDown)?void 0:n.call(l,r)))return;o&&r.stopPropagation(),i&&r.preventDefault(),c.id=r.pointerId,c.el=r.currentTarget,c.lastPosition={x:r.clientX,y:r.clientY},s&&(c.longPressTimer=setTimeout(()=>{s(r,c.el),c.longPressTriggered=!0},400)),(e||t)&&d(window,"pointermove",f,!1),d(window,"pointerup",p,!1),d(window,"pointercancel",p,!1)}})}}}function KI(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}var ZI=(e=>(e.topLeft="topLeft",e.topRight="topRight",e.bottomLeft="bottomLeft",e.bottomRight="bottomRight",e))(ZI||{});let QI={};const JI=(e={})=>{NC(null),QI=e};function eT({aspectRatio:e,boundaryRef:t,boundaryRect:r,restrictWithinBoundary:n=!0,minWidth:i=50,minHeight:o=50,...a}){const s={onMoveStart:(e,n)=>{var i;const o=e.target;if(!o.dataset.resizeHandle||LC||(JI({currentRect:KI(n.getBoundingClientRect()),resizeDir:o.dataset.resizeHandle}),!QI.currentRect))return!1;NC("resize"),r?QI.boundaryRect=r:null!=t&&t.current&&(QI.boundaryRect=KI(t.current.getBoundingClientRect())),QI.currentRect&&QI.boundaryRect&&(QI.currentRect.left-=QI.boundaryRect.left,QI.currentRect.top-=QI.boundaryRect.top),QI.initialAspectRatio=QI.currentRect.width/QI.currentRect.height,null==(i=a.onResizeStart)||i.call(a,YI({rect:QI.currentRect,e:e}))},onMove:(t,r,n)=>{var s;if(!QI.resizeDir||!QI.currentRect)return;const l="initial"===e?QI.initialAspectRatio:e,c=function(e,t,r,n){const i={...e},o={...e};return"topRight"===QI.resizeDir?(o.width=Math.floor(o.width+t),o.height=n?Math.floor(o.width/n):Math.floor(o.height-r),o.top=Math.floor(o.top+(i.height-o.height))):"bottomRight"===QI.resizeDir?(o.width=Math.floor(o.width+t),o.height=n?Math.floor(o.width/n):Math.floor(o.height+r)):"topLeft"===QI.resizeDir?(o.width=Math.floor(o.width-t),o.height=n?Math.floor(o.width/n):Math.floor(o.height-r),o.left=Math.floor(o.left+(i.width-o.width)),o.top=Math.floor(o.top+(i.height-o.height))):"bottomLeft"===QI.resizeDir&&(o.width=Math.floor(o.width-t),o.height=n?Math.floor(o.width/n):Math.floor(o.height+r),o.left=Math.floor(o.left+t)),o}(QI.currentRect,r,n,l),u=function(e,t,r,n){const i="bottomLeft"===QI.resizeDir||"topLeft"===QI.resizeDir,o="topRight"===QI.resizeDir||"topLeft"===QI.resizeDir;let a={...e};a.width=Math.max(t,e.width),a.height=Math.max(r,e.height);const s=a.width-e.width;i&&s>0&&(a.left-=s);const l=a.height-e.height;if(o&&l>0&&(a.top-=l),QI.boundaryRect&&(a=function(e,t){const r={...e};r.left=Math.max(0,r.left);const n=r.left-e.left;n>0&&(r.width-=n),r.top=Math.max(0,r.top);const i=r.top-e.top;return i>0&&(r.height-=i),r.width=Math.min(r.width,t.width-r.left),r.height=Math.min(r.height,t.height-r.top),r}(a,QI.boundaryRect)),n){const e=a.width,t=a.height,r=m_(n,a.width,a.height);a.width=r.width,a.height=r.height,o&&(a.top+=t-a.height),i&&(a.left+=e-a.width)}return a}(c,i,o,l);null==(s=a.onResize)||s.call(a,YI({rect:u,e:t,deltaX:r,deltaY:n})),QI.currentRect=c},onMoveEnd:e=>{var t;QI.currentRect&&(null==(t=a.onResizeEnd)||t.call(a,YI({rect:QI.currentRect,e:e}))),JI()}},{domProps:l}=XI(s);return{resizeProps:l}}function tT({position:t,inset:r=!1}){const n=function(e,t){const r=t?"left-0":"-left-5",n=t?"top-0":"-top-5",i=t?"bottom-0":"-bottom-5",o=t?"right-0":"-right-5";switch(e){case ZI.topLeft:return`${r} ${n} border-l-4 border-t-4 cursor-nwse-resize`;case ZI.topRight:return`${o} ${n} border-r-4 border-t-4 cursor-nesw-resize`;case ZI.bottomRight:return`${o} ${i} border-r-4 border-b-4 cursor-se-resize`;case ZI.bottomLeft:return`${r} ${i} border-l-4 border-b-4 cursor-sw-resize`;default:return""}}(t,r);return e("div",{"data-resize-handle":t,className:`border-white absolute w-20 h-20 ${n}`})}var rT=(e=>(e.top="maskTop",e.right="maskRight",e.bottom="maskBottom",e.left="maskLeft",e))(rT||{});function nT({position:t,refs:r}){const n=function(e){switch(e){case"maskTop":return"left-0 top-0";case"maskBottom":return"bottom-0 left-0";default:return""}}(t);return e("div",{className:`cropzone-transition bg-black/50 bottom absolute ${n}`,ref:e=>r.current[t]=e})}function iT({name:t,refs:r}){const n=Tf("cropzone-transition pointer-events-none absolute left-0 top-0 bg-white/50",t.startsWith("lineHor")?"h-px":"w-px");return e("div",{className:n,ref:e=>{r.current[t]=e}})}function oT(e,t,r){return Math.min(Math.max(e,t),r)}let aT={};function sT({boundaryRef:e,boundaryRect:t,minimumMovement:r,restrictWithinBoundary:n=!0,...i}){const o={minimumMovement:r,onMoveStart:(r,n)=>{var o;if(LC)return!1;aT={currentRect:KI(n.getBoundingClientRect())},NC("move"),t?aT.boundaryRect=t:null!=e&&e.current&&(aT.boundaryRect=KI(e.current.getBoundingClientRect())),aT.currentRect&&aT.boundaryRect&&(aT.currentRect.left-=aT.boundaryRect.left,aT.currentRect.top-=aT.boundaryRect.top),null==(o=i.onMoveStart)||o.call(i,YI({rect:aT.currentRect,e:r}))},onMove:(e,t,r)=>{var o;if(!aT.currentRect)return;const a={...aT.currentRect,left:aT.currentRect.left+t,top:aT.currentRect.top+r},s={...a};aT.boundaryRect&&n&&(s.left=oT(a.left,0,aT.boundaryRect.width-a.width),s.top=oT(a.top,0,aT.boundaryRect.height-a.height)),null==(o=i.onMove)||o.call(i,YI({rect:s,e:e,deltaX:t,deltaY:r})),aT.currentRect=a},onMoveEnd:e=>{var t;aT.currentRect&&(null==(t=i.onMoveEnd)||t.call(i,YI({rect:aT.currentRect,e:e})),NC(null),aT={})}},{domProps:a}=XI(o);return{moveProps:a}}function lT(){const r=u({}),[n,i]=o(!0),a=$m(e=>e.canvasSize),s=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.crop)?void 0:r.cropzone}),l=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.crop)?void 0:r.defaultRatio})||null,c=$m(e=>e.crop.selectedAspectRatio)||null,{moveProps:d}=sT({boundaryRect:a,onMoveStart:()=>i(!0),onMove:e=>Gm().crop.drawZone(e.rect),onMoveEnd:()=>i(!1)}),{resizeProps:h}=eT({boundaryRect:a,minHeight:50,minWidth:50,aspectRatio:v_(c),onResizeStart:()=>i(!0),onResize:e=>Gm().crop.drawZone(e.rect),onResizeEnd:()=>i(!1)});x(()=>{Gm().crop.registerRefs(r),Gm().crop.resetCropzone(l)},[l,a]);const f=Tf("cropzone absolute z-cropzone isolate left-0 top-0 w-full h-full overflow-hidden",n&&"moving");return t("div",{className:f,onPointerDown:e=>{e.stopPropagation(),e.preventDefault()},children:[t("div",{className:"cropzone-transition border-white/50 absolute z-10 left-0 top-0 border",...gC(h,d),ref:e=>r.current.innerZone=e,children:[!(null!=s&&s.hideTopLeft)&&e(tT,{position:ZI.topLeft,inset:!0}),!(null!=s&&s.hideTopRight)&&e(tT,{position:ZI.topRight,inset:!0}),!(null!=s&&s.hideBottomLeft)&&e(tT,{position:ZI.bottomLeft,inset:!0}),!(null!=s&&s.hideBottomRight)&&e(tT,{position:ZI.bottomRight,inset:!0}),e(iT,{name:"lineVer1",refs:r}),e(iT,{name:"lineVer2",refs:r}),e(iT,{name:"lineHor1",refs:r}),e(iT,{name:"lineHor2",refs:r})]}),e(nT,{refs:r,position:rT.top}),e(nT,{refs:r,position:rT.left}),e(nT,{refs:r,position:rT.right}),e(nT,{refs:r,position:rT.bottom})]})}const cT=Pf(e("path",{d:"M 7 2 C 6.448 2 6 2.448 6 3 C 6 3.552 6.448 4 7 4 L 20 4 L 20 17 C 20 17.552 20.448 18 21 18 C 21.552 18 22 17.552 22 17 L 22 4 C 22 2.895 21.105 2 20 2 L 7 2 z M 4 6 C 2.895 6 2 6.895 2 8 L 2 20 C 2 21.105 2.895 22 4 22 L 16 22 C 17.105 22 18 21.105 18 20 L 18 8 C 18 6.895 17.105 6 16 6 L 4 6 z M 10 10 C 10.552 10 11 10.448 11 11 L 11 13 L 13 13 C 13.552 13 14 13.448 14 14 C 14 14.552 13.552 15 13 15 L 11 15 L 11 17 C 11 17.552 10.552 18 10 18 C 9.448 18 9 17.552 9 17 L 9 15 L 7 15 C 6.448 15 6 14.552 6 14 C 6 13.448 6.448 13 7 13 L 9 13 L 9 11 C 9 10.448 9.448 10 10 10 z"})),uT=Pf(e("path",{d:"M 11 3 L 2 21 L 11 21 L 11 3 z M 13 3 L 13 21 L 22 21 L 13 3 z M 9 11.472656 L 9 19 L 5.2363281 19 L 9 11.472656 z"})),dT=Pf(e("path",{d:"M 16.476562 2.4511719 C 16.392047 2.4657656 16.308531 2.5061719 16.238281 2.5761719 L 14.130859 4.6835938 C 13.956859 4.8575938 13.956859 5.1394531 14.130859 5.3144531 L 16.238281 7.4238281 C 16.519281 7.7048281 17 7.5054219 17 7.1074219 L 17 6 L 20 6 L 20 9 A 1.0001 1.0001 0 1 0 22 9 L 22 6 C 22 4.9069372 21.093063 4 20 4 L 17 4 L 17 2.8925781 C 17 2.5940781 16.730109 2.4073906 16.476562 2.4511719 z M 4 5 C 2.9069372 5 2 5.9069372 2 7 L 2 14 C 2 15.093063 2.9069372 16 4 16 L 7 16 L 7 19 C 7 20.105 7.895 21 9 21 L 16 21 C 17.105 21 18 20.105 18 19 L 18 12 C 18 10.895 17.105 10 16 10 L 13 10 L 13 7 C 13 5.9069372 12.093063 5 11 5 L 4 5 z M 4 7 L 11 7 L 11 14 L 4 14 L 4 7 z"})),hT=Pf(e("path",{d:"M 10 2 L 9 3 L 3 3 L 3 5 L 21 5 L 21 3 L 15 3 L 14 2 L 10 2 z M 4.3652344 7 L 5.8925781 20.263672 C 6.0245781 21.253672 6.877 22 7.875 22 L 16.123047 22 C 17.121047 22 17.974422 21.254859 18.107422 20.255859 L 19.634766 7 L 4.3652344 7 z"})),fT={width:120,height:30},pT=[{name:"Duplicate",icon:cT,onClick:()=>{Gm().objects.duplicate()}},{name:"Flip",icon:uT,onClick:()=>{Gm().objects.flipHorizontally()}},{name:"Bring to front",icon:dT,onClick:()=>{Gm().objects.bringToFront()}},{name:"Delete",icon:hT,onClick:()=>{Gm().objects.delete()}}],gT=i.forwardRef((t,r)=>{const n=$m(e=>e.objects.active.isMoving)?"opacity-0":"opacity-100";return e("div",{ref:r,className:`${n} absolute z-obj-box left-0 top-0 flex items-center text-white bg-controls rounded shadow transition-opacity overflow-hidden`,children:pT.map(t=>{const r=t.icon;return e(xE,{size:"sm",className:"w-30 h-30 hover:bg-white/hover",radius:"rounded-none",onClick:t.onClick,children:e(r,{})},t.name)})})});function mT(e,t){const r=Gm().objects.getActive();if(!r||!e.current)return;const n=e.current,i=OC.fabric.util.degreesToRadians(r.angle??0);let o=Math.round(r.getScaledWidth()*qm().zoom),a=Math.round(r.getScaledHeight()*qm().zoom),s=Math.round((r.left??0)*qm().zoom),l=Math.round((r.top??0)*qm().zoom);const c="center"===r.originX?o/2:0,u="center"===r.originY?a/2:0;r.padding&&(o+=2*r.padding,a+=2*r.padding,s-=r.padding,l-=r.padding),n.style.width=`${o}px`,n.style.height=`${a}px`,n.style.transform=`translate(${s-c}px, ${l-u}px) rotate(${i}rad)`,Gm().canvas.render(),function(e,t){if(!t)return;const r=e.angle||0,n=r>168&&r<188?-30:-15,i=qm().canvasSize,o=qm().stageSize,a=fT,s=i.top-o.top,l=i.left-o.left,c=o.width-(l+i.width),u=o.height-(s+i.height),d=-s,h=-(i.left-o.left),f=i.width-a.width+c,p=i.height-a.height+u,g=e.getBoundingRect();let m=g.top-a.height+n,v=g.left+g.width/2-a.width/2;m=Math.min(p,Math.max(d,m)),v=Math.min(f,Math.max(h,v)),t.style.transform=`translate(${v}px, ${m}px) rotate(0deg)`}(r,t.current)}function vT(){return e("div",{className:"absolute -bottom-20 left-1/2 w-2 h-20 bg-white cursor-default -translate-x-1/2",children:e("div",{"data-rotate-handle":!0,className:"w-18 h-18 absolute -bottom-10 -left-8 bg-white rounded-full cursor-move"})})}let yT={};function bT(e){const t=yT.centerX||0,r=yT.centerY||0;return Math.atan2(r-e.pageY,t-e.pageX)-(yT.startAngle||0)}const wT=(e={})=>{NC(null),yT=e};function xT(){const r=u(null),n=u(null),i=$m(e=>e.objects.active.id),o=$m(e=>e.objects.isEditingText),s=$m(e=>e.zoom),l=function(){const e=Gm().objects.getActive();if(!e||!e.name)return{};const t=qm().config.objectControls||{},r=e.name;return{...t.global,...t[r]}}(),d=u(null),h=c(()=>{d.current?(clearTimeout(d.current),d.current=null,function(){var e;const t=Gm().objects.getActive();Dg(t)&&(t.enterEditing(),null==(e=t.hiddenTextarea)||e.focus())}()):d.current=setTimeout(()=>{d.current=null},300)},[]);let{moveProps:f}=sT({boundaryRef:qm().canvasRef,restrictWithinBoundary:!1,onMoveEnd:()=>{qm().objects.setActiveIsMoving(!1)},onMove:e=>{qm().objects.setActiveIsMoving(!0),function(e){const t=e.rect.width/2,r=e.rect.height/2;Gm().objects.setValues({left:(e.rect.left+t)/qm().zoom,top:(e.rect.top+r)/qm().zoom})}(e)}});l.lockMovement&&(f={});const{resizeProps:p}=eT({minWidth:50,minHeight:50,aspectRatio:l.unlockAspectRatio?null:"initial",boundaryRef:l.containWithinCanvas?qm().canvasRef:void 0,restrictWithinBoundary:!1,onResizeEnd:()=>{qm().objects.setActiveIsMoving(!1)},onResize:e=>{qm().objects.setActiveIsMoving(!0),function(e){const t=Gm().objects.getActive();if(!t)return;const r={};Dg(t)?(e.deltaX>0||t.getScaledHeight()>=20&&t.getScaledWidth()>=20)&&(r.fontSize=(t.fontSize||1)+e.deltaX):(t.width&&(r.scaleX=e.rect.width/qm().zoom/t.width),t.height&&(r.scaleY=e.rect.height/qm().zoom/t.height)),Gm().objects.setValues(r)}(e)}}),{rotateProps:g}=function(e){const t={onMoveStart:(t,r)=>{var n,i;if(!t.target.dataset.rotateHandle||LC)return!1;const o=KI(r.getBoundingClientRect());if(!o)return!1;const a=null==(n=r.style.transform.match(/rotate\((.+?)\)/))?void 0:n[1],[s="0"]=a?a.split(","):[];wT({currentRect:o,centerX:o.left+o.width/2,centerY:o.top+o.height/2,startAngle:parseFloat(s)}),NC("rotate"),yT.startAngle=bT(t),null==(i=e.onRotateStart)||i.call(e,YI({rect:o,e:t}))},onMove:(t,r,n)=>{var i;if(!yT.currentRect)return;const o={...yT.currentRect};o.angle=bT(t),o.left+=r,o.top+=n,null==(i=e.onRotate)||i.call(e,YI({rect:o,e:t,deltaX:r,deltaY:n})),yT.currentRect=o},onMoveEnd:t=>{var r;yT.currentRect&&(null==(r=e.onRotateEnd)||r.call(e,YI({rect:yT.currentRect,e:t}))),wT()}},{domProps:r}=XI(t);return{rotateProps:r}}({boundaryRef:qm().canvasRef,onRotateEnd:()=>{qm().objects.setActiveIsMoving(!1)},onRotate:e=>{qm().objects.setActiveIsMoving(!0),function(e){const t=Gm().objects.getActive();if(!t||!e.rect.angle)return;const r=OC.fabric.util.radiansToDegrees(e.rect.angle);r!==t.angle&&Gm().objects.setValues({angle:r})}(e)}});return a(()=>{Ym()&&qm().editor.on("object:modified",e=>{e.sizeOrPositionChanged&&mT(r,n)})},[]),a(()=>{mT(r,n)},[i,s,o]),t("div",{className:i&&!o?"block":"hidden",children:[t("div",{ref:r,...gC(g,p,f),onClick:h,className:"absolute z-obj-box border-2 border-white shadow-md cursor-move",children:[!l.hideTopLeft&&e(tT,{position:ZI.topLeft}),!l.hideTopRight&&e(tT,{position:ZI.topRight}),!l.hideBottomLeft&&e(tT,{position:ZI.bottomLeft}),!l.hideBottomRight&&e(tT,{position:ZI.bottomRight}),!l.hideRotatingPoint&&e(vT,{})]}),e(gT,{ref:n})]})}function CT(){const r=$m(e=>e.activeTool===Ef.CROP),n=$m(e=>e.objects.active.id);return t("div",{children:[r&&e(lT,{}),n&&e(xT,{})]})}const _T=function(e){return e.forEach(MI),function(e,t){const{handlers:r,nativeHandlers:n,config:o}=GI(e,t||{});return function(e,t={},r,n){const o=i.useMemo(()=>new VI(e),[]);if(o.applyHandlers(e,n),o.applyConfig(t,r),i.useEffect(o.effect.bind(o)),i.useEffect(()=>o.clean.bind(o),[]),void 0===t.target)return o.bind.bind(o)}(r,o,void 0,n)}}([RI,LI]),ST=i.forwardRef((r,n)=>{const[i,s]=o(!1);a(()=>$m.subscribe(e=>e.loading,e=>{s(!e)}),[]);return e(AT,{children:t(Gx.div,{initial:{opacity:0},variants:{visible:{opacity:1,transition:{duration:.35,delay:.5}},hidden:{opacity:0,transition:{duration:0}}},animate:i?"visible":"hidden",className:"relative m-auto w-max",style:{backgroundImage:`url(${KC("images/empty-canvas-bg.png")})`},children:[e(CT,{}),e("canvas",{ref:n})]})})});function AT({children:t}){const r=u(null),n=_T({onPinch:e=>{if(!Gm().zoom.allowUserZoom||!kT(e))return e.cancel();1===e.direction[0]?Gm().zoom.zoomIn(.01):Gm().zoom.zoomOut(.01),e.event.stopPropagation(),e.event.preventDefault()},onDrag:e=>{if(e.pinching||!kT(e))return e.cancel();r.current.scrollLeft-=e.delta[0],r.current.scrollTop-=e.delta[1]}});return e("div",{ref:r,className:"w-full h-full overflow-hidden touch-none flex",...n(),children:t})}function kT(e){return!(Ym().findTarget(e.event,!1)||Ym().isDrawingMode)}function ET({actionBtn:r,children:n,className:i}){return t("div",{className:Tf(i,"flex gap-16 items-center h-full"),children:[r&&e("div",{className:"flex-shrink-0",children:r}),e("div",{className:"w-full flex-auto",children:n}),r&&e("div",{className:"w-96"})]})}function IT(){return(IT=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function TT(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}function FT(e){var t=u(e),r=u(function(e){t.current&&t.current(e)});return t.current=e,r.current}var OT=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e<t?t:e},PT=function(e){return"touches"in e},MT=function(e){return e&&e.ownerDocument.defaultView||self},RT=function(e,t,r){var n=e.getBoundingClientRect(),i=PT(t)?function(e,t){for(var r=0;r<e.length;r++)if(e[r].identifier===t)return e[r];return e[0]}(t.touches,r):t;return{left:OT((i.pageX-(n.left+MT(e).pageXOffset))/n.width),top:OT((i.pageY-(n.top+MT(e).pageYOffset))/n.height)}},LT=function(e){!PT(e)&&e.preventDefault()},NT=i.memo(function(e){var t=e.onMove,r=e.onKey,n=TT(e,["onMove","onKey"]),o=u(null),s=FT(t),l=FT(r),c=u(null),h=u(!1),f=d(function(){var e=function(e){LT(e),(PT(e)?e.touches.length>0:e.buttons>0)&&o.current?s(RT(o.current,e,c.current)):r(!1)},t=function(){return r(!1)};function r(r){var n=h.current,i=MT(o.current),a=r?i.addEventListener:i.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",t)}return[function(e){var t,n=e.nativeEvent,i=o.current;if(i&&(LT(n),t=n,(!h.current||PT(t))&&i)){if(PT(n)){h.current=!0;var a=n.changedTouches||[];a.length&&(c.current=a[0].identifier)}i.focus(),s(RT(i,n,c.current)),r(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),l({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},r]},[l,s]),p=f[0],g=f[1],m=f[2];return a(function(){return m},[m]),i.createElement("div",IT({},n,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:o,onKeyDown:g,tabIndex:0,role:"slider"}))}),jT=function(e){return e.filter(Boolean).join(" ")},DT=function(e){var t=e.color,r=e.left,n=e.top,o=void 0===n?.5:n,a=jT(["react-colorful__pointer",e.className]);return i.createElement("div",{className:a,style:{top:100*o+"%",left:100*r+"%"}},i.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},zT=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r},BT=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?zT(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?zT(parseInt(e.substring(6,8),16)/255,2):1}},UT=function(e){var t=function(e){var t=e.s,r=e.v,n=e.a,i=(200-t)*r/100;return{h:zT(e.h),s:zT(i>0&&i<200?t*r/100/(i<=100?i:200-i)*100:0),l:zT(i/2),a:zT(n,2)}}(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},VT=function(e){var t=e.h,r=e.s,n=e.v,i=e.a;t=t/360*6,r/=100,n/=100;var o=Math.floor(t),a=n*(1-r),s=n*(1-(t-o)*r),l=n*(1-(1-t+o)*r),c=o%6;return{r:zT(255*[n,s,a,a,l,n][c]),g:zT(255*[l,n,n,s,a,a][c]),b:zT(255*[a,a,l,n,n,s][c]),a:zT(i,2)}},HT=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},WT=function(e){var t=e.r,r=e.g,n=e.b,i=e.a,o=i<1?HT(zT(255*i)):"";return"#"+HT(t)+HT(r)+HT(n)+o},$T=function(e){var t=e.r,r=e.g,n=e.b,i=e.a,o=Math.max(t,r,n),a=o-Math.min(t,r,n),s=a?o===t?(r-n)/a:o===r?2+(n-t)/a:4+(t-r)/a:0;return{h:zT(60*(s<0?s+6:s)),s:zT(o?a/o*100:0),v:zT(o/255*100),a:i}},qT=i.memo(function(e){var t=e.hue,r=e.onChange,n=jT(["react-colorful__hue",e.className]);return i.createElement("div",{className:n},i.createElement(NT,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:OT(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":zT(t),"aria-valuemax":"360","aria-valuemin":"0"},i.createElement(DT,{className:"react-colorful__hue-pointer",left:t/360,color:UT({h:t,s:100,v:100,a:1})})))}),GT=i.memo(function(e){var t=e.hsva,r=e.onChange,n={backgroundColor:UT({h:t.h,s:100,v:100,a:1})};return i.createElement("div",{className:"react-colorful__saturation",style:n},i.createElement(NT,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:OT(t.s+100*e.left,0,100),v:OT(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+zT(t.s)+"%, Brightness "+zT(t.v)+"%"},i.createElement(DT,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:UT(t)})))}),YT=function(e,t){if(e===t)return!0;for(var r in e)if(e[r]!==t[r])return!1;return!0};var XT,KT=typeof window<"u"?x:a,ZT=new Map,QT=function(e){KT(function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!ZT.has(t)){var r=t.createElement("style");r.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',ZT.set(t,r);var n=typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0;n&&r.setAttribute("nonce",n),t.head.appendChild(r)}},[])},JT=function(e){var t=e.className,r=e.colorModel,n=e.color,s=void 0===n?r.defaultColor:n,l=e.onChange,d=TT(e,["className","colorModel","color","onChange"]),h=u(null);QT(h);var f=function(e,t,r){var n=FT(r),i=o(function(){return e.toHsva(t)}),s=i[0],l=i[1],d=u({color:t,hsva:s});a(function(){if(!e.equal(t,d.current.color)){var r=e.toHsva(t);d.current={hsva:r,color:t},l(r)}},[t,e]),a(function(){var t;YT(s,d.current.hsva)||e.equal(t=e.fromHsva(s),d.current.color)||(d.current={hsva:s,color:t},n(t))},[s,e,n]);var h=c(function(e){l(function(t){return Object.assign({},t,e)})},[]);return[s,h]}(r,s,l),p=f[0],g=f[1],m=jT(["react-colorful",t]);return i.createElement("div",IT({},d,{ref:h,className:m}),i.createElement(GT,{hsva:p,onChange:g}),i.createElement(qT,{hue:p.h,onChange:g,className:"react-colorful__last-control"}))},eF={defaultColor:"000",toHsva:function(e){return $T(BT(e))},fromHsva:function(e){return function(e){return WT(VT(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||YT(BT(e),BT(t))}},tF=function(e){return i.createElement(JT,IT({},e,{colorModel:eF}))},rF=/^#?([0-9A-F]{3,8})$/i,nF=function(e){var t=e.color,r=void 0===t?"":t,n=e.onChange,s=e.onBlur,l=e.escape,u=e.validate,d=e.format,h=e.process,f=TT(e,["color","onChange","onBlur","escape","validate","format","process"]),p=o(function(){return l(r)}),g=p[0],m=p[1],v=FT(n),y=FT(s),b=c(function(e){var t=l(e.target.value);m(t),u(t)&&v(h?h(t):t)},[l,h,u,v]),w=c(function(e){u(e.target.value)||m(l(r)),y(e)},[r,l,u,y]);return a(function(){m(l(r))},[r,l]),i.createElement("input",IT({},f,{value:d?d(g):g,spellCheck:"false",onChange:b,onBlur:w}))},iF=function(e){return"#"+e},oF=function(e){var t=e.prefixed,r=e.alpha,n=TT(e,["prefixed","alpha"]),o=c(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,r?8:6)},[r]),a=c(function(e){return function(e,t){var r=rF.exec(e),n=r?r[1].length:0;return 3===n||6===n||!!t&&4===n||!!t&&8===n}(e,r)},[r]);return i.createElement(nF,IT({},n,{escape:o,format:t?iF:void 0,process:iF,validate:a}))};XT={alpha:"ألفا",black:"أسود",blue:"أزرق","blue purple":"أرجواني مزرق",brightness:"السطوع",brown:"بني","brown yellow":"أصفر بني",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"سماوي","cyan blue":"أزرق سماوي",dark:"داكن",gray:"رمادي",grayish:"مائل للرمادي",green:"أخضر","green cyan":"سماوي مخضر",hue:"درجة اللون",light:"فاتح",lightness:"الإضاءة",magenta:"أرجواني","magenta pink":"أرجواني وردي",orange:"برتقالي","orange yellow":"أصفر برتقالي",pale:"باهت",pink:"وردي","pink red":"أحمر وردي",purple:"أرجواني","purple magenta":"بنفسجي",red:"أحمر","red orange":"برتقالي محمر",saturation:"التشبع",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} شفاف`,"very dark":"داكن جدًا","very light":"فاتح جدًا",vibrant:"ساطع",white:"أبيض",yellow:"أصفر","yellow green":"أخضر مصفر"};var aF;aF={alpha:"Алфа",black:"черно",blue:"Синьо","blue purple":"синьо лилаво",brightness:"Яркост",brown:"кафяво","brown yellow":"кафяво жълто",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"циан","cyan blue":"циан синьо",dark:"тъмно",gray:"сиво",grayish:"сивкав",green:"Зелено","green cyan":"зелен циан",hue:"Оттенък",light:"светло",lightness:"Лекота",magenta:"магента","magenta pink":"магента розово",orange:"оранжево","orange yellow":"оранжево жълто",pale:"бледо",pink:"розово","pink red":"розово червено",purple:"лилаво","purple magenta":"лилаво магента",red:"Червено","red orange":"червен портокал",saturation:"Наситеност",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} прозрачен`,"very dark":"много тъмно","very light":"много светло",vibrant:" ярко",white:"бяло",yellow:"жълто","yellow green":"жълто зелен"};var sF;sF={alpha:"Alfa",black:"černá",blue:"Modrá","blue purple":"modrofialová",brightness:"Jas",brown:"hnědá","brown yellow":"hnědožlutá",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"tyrkysová","cyan blue":"tyrkysovomodrá",dark:"tmavá",gray:"šedá",grayish:"našedlá",green:"Zelená","green cyan":"zelenotyrkysová",hue:"Odstín",light:"světlá",lightness:"Světlost",magenta:"purpurová","magenta pink":"purpurově růžová",orange:"oranžová","orange yellow":"oranžovožlutá",pale:"bledá",pink:"růžová","pink red":"růžovočervená",purple:"fialová","purple magenta":"fialově purpurová",red:"Červená","red orange":"červenooranžová",saturation:"Sytost",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} průhledné`,"very dark":"velmi tmavá","very light":"velmi světlá",vibrant:"zářivá",white:"bílá",yellow:"žlutá","yellow green":"žlutozelená"};var lF;lF={alpha:"Alfa",black:"sort",blue:"Blå","blue purple":"blålilla",brightness:"Lysstyrke",brown:"brun","brown yellow":"brungul",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyan","cyan blue":"cyan blå",dark:"mørk",gray:"grå",grayish:"grålig",green:"Grøn","green cyan":"grøn cyan",hue:"Tone",light:"lys",lightness:"Lyshed",magenta:"magenta","magenta pink":"magenta pink",orange:"orange","orange yellow":"orangegul",pale:"bleg",pink:"lyserød","pink red":"lyserødlig rød",purple:"lilla","purple magenta":"lilla magenta",red:"Rød","red orange":"rødorange",saturation:"Farvemætning",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} gennemsigtig`,"very dark":"meget mørk","very light":"meget lys",vibrant:"klar",white:"hvid",yellow:"gul","yellow green":"gulgrøn"};var cF;cF={alpha:"Alpha",black:"Schwarz",blue:"Blau","blue purple":"Blaulila",brightness:"Helligkeit",brown:"Braun","brown yellow":"Braungelb",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"Cyan","cyan blue":"Cyanblau",dark:"dunkles",gray:"Grau",grayish:"gräuliches",green:"Grün","green cyan":"Grüncyan",hue:"Farbton",light:"helles",lightness:"Leuchtkraft",magenta:"Magenta","magenta pink":"Magentarosa",orange:"Orange","orange yellow":"Orangegelb",pale:"blasses",pink:"Rosa","pink red":"Rosarot",purple:"Lila","purple magenta":"Lilamagenta",red:"Rot","red orange":"Rotorange",saturation:"Sättigung",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, zu ${e.percentTransparent} transparent`,"very dark":"sehr dunkles","very light":"sehr helles",vibrant:"lebhaftes",white:"Weiß",yellow:"Gelb","yellow green":"Gelbgrün"};var uF;uF={alpha:"Άλφα",black:"μαύρο",blue:"Μπλε","blue purple":"μπλε μωβ",brightness:"Φωτεινότητα",brown:"καφέ","brown yellow":"καφέ κίτρινο",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"κυανό","cyan blue":"κυανό μπλε",dark:"σκούρο",gray:"γκρι",grayish:"γκριζωπό",green:"Πράσινο","green cyan":"πράσινο κυανό",hue:"Τόνος",light:"ανοιχτό",lightness:"Φωτεινότητα",magenta:"ματζέντα","magenta pink":"ματζέντα ροζ",orange:"πορτοκαλί","orange yellow":"πορτοκαλί κίτρινο",pale:"ανοιχτό",pink:"ροζ","pink red":"ροζ κόκκινο",purple:"μωβ","purple magenta":"μωβ ματζέντα",red:"Κόκκινο","red orange":"κόκκινο πορτοκαλί",saturation:"Κορεσμός",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} διαφανές`,"very dark":"πολύ σκούρο","very light":"πολύ ανοιχτό",vibrant:"έντονο",white:"λευκό",yellow:"κίτρινο","yellow green":"κίτρινο πράσινο"};var dF;dF={hue:"Hue",saturation:"Saturation",lightness:"Lightness",brightness:"Brightness",red:"Red",green:"Green",blue:"Blue",alpha:"Alpha",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":"very dark",dark:"dark",light:"light","very light":"very light",pale:"pale",grayish:"grayish",vibrant:"vibrant",black:"black",white:"white",gray:"gray",pink:"pink","pink red":"pink red","red orange":"red orange",brown:"brown",orange:"orange","orange yellow":"orange yellow","brown yellow":"brown yellow",yellow:"yellow","yellow green":"yellow green","green cyan":"green cyan",cyan:"cyan","cyan blue":"cyan blue","blue purple":"blue purple",purple:"purple","purple magenta":"purple magenta",magenta:"magenta","magenta pink":"magenta pink"};var hF;hF={alpha:"Alpha",black:"negro",blue:"Azul","blue purple":"púrpura azulado",brightness:"Brillo",brown:"marrón","brown yellow":"amarillo amarronado",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cian","cyan blue":"azul cian",dark:"oscuro",gray:"gris",grayish:"grisáceo",green:"Verde","green cyan":"cian verdoso",hue:"Tono",light:"claro",lightness:"Luminosidad",magenta:"magenta","magenta pink":"rosa magenta",orange:"naranja","orange yellow":"amarillo anaranjado",pale:"pálido",pink:"rosa","pink red":"rojo rosado",purple:"morado","purple magenta":"magenta violáceo",red:"Rojo","red orange":"naranja rojizo",saturation:"Saturación",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":"muy oscuro","very light":"muy claro",vibrant:"intenso",white:"blanco",yellow:"amarillo","yellow green":"verde amarillento"};var fF;fF={alpha:"Alfa",black:"must",blue:"Sinine","blue purple":"sinakaslilla",brightness:"Heledus",brown:"pruun","brown yellow":"pruunikaskollane",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"tsüaan","cyan blue":"tsüaansinine",dark:"tume",gray:"hall",grayish:"hallikas",green:"Roheline","green cyan":"tsüaanroheline",hue:"Värv",light:"valgus",lightness:"Valgus",magenta:"magentapunane","magenta pink":"magentaroosa",orange:"oranž","orange yellow":"oranžikaskollane",pale:"kahvatu",pink:"roosa","pink red":"vaarikapunane",purple:"lilla","purple magenta":"purpurne magenta",red:"Punane","red orange":"punakasoranž",saturation:"Küllastus",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} läbipaistev`,"very dark":"väga tume","very light":"väga hele",vibrant:"ere",white:"valge",yellow:"kollane","yellow green":"kollakasroheline"};var pF;pF={alpha:"Alpha",black:"musta",blue:"Sininen","blue purple":"sinivioletti",brightness:"Kirkkaus",brown:"ruskea","brown yellow":"ruskeankeltainen",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"syaani","cyan blue":"syaaninsininen",dark:"tumma",gray:"harmaa",grayish:"harmahtava",green:"Vihreä","green cyan":"vihreänsyaani",hue:"Sävy",light:"vaalea",lightness:"Valomäärä",magenta:"magenta","magenta pink":"magentapinkki",orange:"oranssi","orange yellow":"oranssinkeltainen",pale:"vaalea",pink:"pinkki","pink red":"vaaleanpunainen",purple:"violetti","purple magenta":"violettimagenta",red:"Punainen","red orange":"punaoranssi",saturation:"Värikylläisyys",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} läpinäkyvä`,"very dark":"hyvin tumma","very light":"erittäin vaalea",vibrant:"eloisa",white:"valkea",yellow:"keltainen","yellow green":"keltavihreä"};var gF;gF={alpha:"Alpha",black:"Noir",blue:"Bleu","blue purple":"Violet bleu",brightness:"Luminosité",brown:"Brun","brown yellow":"Jaune brun",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"Cyan","cyan blue":"Bleu cyan",dark:"Sombre",gray:"Gris",grayish:"Grisâtre",green:"Vert","green cyan":"Cyan vert",hue:"Teinte",light:"Clair",lightness:"Luminosité",magenta:"Magenta","magenta pink":"Rose magenta",orange:"Orange","orange yellow":"Jaune orangé",pale:"Pâle",pink:"Rose","pink red":"Rouge rosé",purple:"Violet","purple magenta":"Magenta violet",red:"Rouge","red orange":"Orange rouge",saturation:"Saturation",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":"Très sombre","very light":"Très clair",vibrant:"Vif",white:"Blanc",yellow:"Jaune","yellow green":"Vert jaune"};var mF;mF={alpha:"אלפא",black:"שחור",blue:"כחול","blue purple":"כחול סגול",brightness:"בהירות",brown:"חום","brown yellow":"חום צהוב",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"טורקיז","cyan blue":"כחול ציאן",dark:"כהה",gray:"אפור",grayish:"אפרפר",green:"ירוק","green cyan":"ציאן ירוק",hue:"גוון",light:"אור",lightness:"כמות אור",magenta:"מג'נטה","magenta pink":"ורוד מג'נטה",orange:"כתום","orange yellow":"כתום צהוב",pale:"חיוור",pink:"ורוד","pink red":"ורוד אדום",purple:"סגול","purple magenta":"מג'נטה סגול",red:"אדום","red orange":"כתום אדום",saturation:"רוויה",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} שקוף`,"very dark":"כהה מאוד","very light":"בהיר מאוד",vibrant:"תוסס",white:"לבן",yellow:"צהוב","yellow green":"צהוב ירוק"};var vF;vF={alpha:"Alfa",black:"crno",blue:"Plava","blue purple":"plavo ljubičasta",brightness:"Svjetlina",brown:"smeđa","brown yellow":"smeđe žuta",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cijan","cyan blue":"cijan plava",dark:"tamno",gray:"siva",grayish:"sivkasto",green:"Zelena","green cyan":"zelena cijan",hue:"Nijansa",light:"svjetlo",lightness:"Osvijetljenost",magenta:"magenta","magenta pink":"magentno ružičasta",orange:"narančasta","orange yellow":"narančasto žuta",pale:"blijeda",pink:"ružičasta","pink red":"ružičasto crvena",purple:"ljubičasta","purple magenta":"ljubičasta magenta",red:"Crvena","red orange":"crveno narančasta",saturation:"Zasićenost",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozirnosti`,"very dark":"jako tamna","very light":"vrlo svijetlo",vibrant:"vibrantna",white:"bijela",yellow:"žuto","yellow green":"žuto zelena"};var yF;yF={alpha:"Alfa",black:"fekete",blue:"Kék","blue purple":"kék lila",brightness:"Fényesség",brown:"barna","brown yellow":"barna sárga",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"ciánkék","cyan blue":"ciánkék",dark:"sötét",gray:"szürke",grayish:"szürkés",green:"Zöld","green cyan":"zöld ciánkék",hue:"Színárnyalat",light:"világos",lightness:"Világosság",magenta:"bíbor","magenta pink":"bíbor rózsaszín",orange:"narancs","orange yellow":"narancssárga",pale:"halvány",pink:"rózsaszín","pink red":"rózsaszín piros",purple:"lila","purple magenta":"lila bíbor",red:"Piros","red orange":"piros narancs",saturation:"Telítettség",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} átlátszó`,"very dark":"nagyon sötét","very light":"nagyon világos",vibrant:"élénk",white:"fehér",yellow:"sárga","yellow green":"sárga zöld"};var bF;bF={alpha:"Alfa",black:"nero",blue:"Blu","blue purple":"blu viola",brightness:"Luminosità",brown:"marrone","brown yellow":"giallo bruno",colorName:e=>`${e.hue} ${e.chroma} ${e.lightness}`,cyan:"ciano","cyan blue":"blu ciano",dark:"scuro",gray:"grigio",grayish:"grigiastro",green:"Verde","green cyan":"verde ciano",hue:"Tonalità",light:"chiaro",lightness:"Luminosità",magenta:"magenta","magenta pink":"rosa magenta",orange:"arancio","orange yellow":"giallo arancio",pale:"tenue",pink:"rosa","pink red":"rosa rosso",purple:"viola","purple magenta":"viola magenta",red:"Rosso","red orange":"rosso arancio",saturation:"Saturazione",transparentColorName:e=>`${e.hue} ${e.chroma} ${e.lightness}, trasparenza ${e.percentTransparent}`,"very dark":"molto scuro","very light":"molto chiaro",vibrant:"vivace",white:"bianco",yellow:"giallo","yellow green":"giallo verde"};var wF;wF={alpha:"アルファ",black:"ブラック",blue:"青","blue purple":"ブルーパープル",brightness:"明るさ",brown:"ブラウン","brown yellow":"ブラウンイエロー",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"シアン","cyan blue":"シアンブルー",dark:"ダーク",gray:"グレー",grayish:"グレイッシュ",green:"緑","green cyan":"グリーンシアン",hue:"色相",light:"ライト",lightness:"明度",magenta:"マゼンタ","magenta pink":"マゼンタピンク",orange:"オレンジ","orange yellow":"オレンジイエロー",pale:"ペール",pink:"ピンク","pink red":"ピンクレッド",purple:"パープル","purple magenta":"パープルマゼンタ",red:"赤","red orange":"レッドオレンジ",saturation:"彩度",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":"最も暗い","very light":"ベリーライト",vibrant:"鮮やか",white:"ホワイト",yellow:"イエロー","yellow green":"イエローグリーン"};var xF;xF={alpha:"알파",black:"검은색",blue:"파랑","blue purple":"청자색",brightness:"명도",brown:"갈색","brown yellow":"황갈색",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"청록색","cyan blue":"청록색",dark:"다크",gray:"회색",grayish:"회갈색",green:"초록","green cyan":"청록색",hue:"색조",light:"라이트",lightness:"밝기",magenta:"자홍색","magenta pink":"마젠타 핑크",orange:"주황색","orange yellow":"불그스름한 노랑",pale:"흙색",pink:"분홍색","pink red":"핑크 레드",purple:"자주색","purple magenta":"보라빛 자홍색",red:"빨강","red orange":"붉은 주황색",saturation:"채도",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 투명도`,"very dark":"매우 어두운","very light":"매우 연함",vibrant:"강렬한",white:"흰색",yellow:"노란색","yellow green":"연두색"};var CF;CF={alpha:"Alfa",black:"juoda",blue:"Mėlyna","blue purple":"melsvai violetinė",brightness:"Ryškumas",brown:"ruda","brown yellow":"rusvai geltona",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"žalsvai mėlyna","cyan blue":"žalsvai mėlyna",dark:"tamsi",gray:"pilka",grayish:"pilkšva",green:"Žalia","green cyan":"žalsvai mėlyna",hue:"Atspalvis",light:"šviesi",lightness:"Šviesumas",magenta:"rausvai raudona","magenta pink":"purpurinė",orange:"oranžinė","orange yellow":"oranžinio atspalvio geltona",pale:"blyški",pink:"rožinė","pink red":"rožinė raudona",purple:"violetinė","purple magenta":"purpurinė rausvai raudona",red:"Raudona","red orange":"rausvai oranžinė",saturation:"Įsotinimas",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} skaidri`,"very dark":"labai tamsi","very light":"labai šviesi",vibrant:"ryški",white:"balta",yellow:"geltona","yellow green":"gelsvai žalia"};var _F;_F={alpha:"Alfa",black:"melns",blue:"Zila","blue purple":"zili violets",brightness:"Spilgtums",brown:"brūns","brown yellow":"brūni dzeltens",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"ciāns","cyan blue":"ciāna zils",dark:"tumšs",gray:"pelēks",grayish:"pelēcīgs",green:"Zaļa","green cyan":"zaļš ciāns",hue:"Nokrāsa",light:"gaišs",lightness:"Gaišums",magenta:"fuksiju","magenta pink":"fuksiju rozā",orange:"oranžs","orange yellow":"oranži dzeltens",pale:"bāls",pink:"rozā","pink red":"rozīgi sarkans",purple:"violets","purple magenta":"violets fuksiju",red:"Sarkana","red orange":"sarkanīgi oranžs",saturation:"Piesātinājums",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} caurspīdīgs`,"very dark":"ļoti tumšs","very light":"ļoti gaišs",vibrant:"košs",white:"balts",yellow:"dzeltens","yellow green":"dzelteni zaļš"};var SF;SF={alpha:"Alfa",black:"svart",blue:"Blå","blue purple":"blålilla",brightness:"Lysstyrke",brown:"brun","brown yellow":"brungul",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyan","cyan blue":"cyanblå",dark:"mørk",gray:"grå",grayish:"gråaktig",green:"Grønn","green cyan":"grønncyan",hue:"Fargetone",light:"lys",lightness:"Lyshet",magenta:"magenta","magenta pink":"magentarosa",orange:"oransje","orange yellow":"oransjegul",pale:"blek",pink:"rosa","pink red":"rosarød",purple:"lilla","purple magenta":"lillamagenta",red:"Rød","red orange":"rødoransje",saturation:"Metning",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} gjennomsiktig`,"very dark":"svært mørk","very light":"svært lys",vibrant:"levende",white:"hvit",yellow:"gul","yellow green":"gulgrønn"};var AF;AF={alpha:"Alfa",black:"zwart",blue:"Blauw","blue purple":"paarsblauw",brightness:"Helderheid",brown:"bruin","brown yellow":"bruingeel",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyaan","cyan blue":"cyaanblauw",dark:"donker",gray:"grijs",grayish:"grijsachtig",green:"Groen","green cyan":"cyaangroen",hue:"Kleurtoon",light:"licht",lightness:"Lichtsterkte",magenta:"magenta","magenta pink":"magentaroze",orange:"oranje","orange yellow":"oranjegeel",pale:"bleek",pink:"roze","pink red":"rozerood",purple:"paars","purple magenta":"magentapaars",red:"Rood","red orange":"roodoranje",saturation:"Verzadiging",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparant`,"very dark":"heel donker","very light":"heel licht",vibrant:"levendig",white:"wit",yellow:"geel","yellow green":"geelgroen"};var kF;kF={alpha:"Alfa",black:"czarny",blue:"Niebieski","blue purple":"niebiesko-fioletowy",brightness:"Jasność",brown:"brązowy","brown yellow":"brązowo-żółty",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyjanowy","cyan blue":"cyjanowo-niebieski",dark:"ciemny",gray:"szary",grayish:"szarawy",green:"Zielony","green cyan":"zielono-cyjanowy",hue:"Odcień",light:"jasny",lightness:"Jaskrawość",magenta:"purpurowy","magenta pink":"purpurowo-różowy",orange:"pomarańczowy","orange yellow":"pomarańczowo-żółty",pale:"blady",pink:"różowy","pink red":"różowo-czerwony",purple:"fioletowy","purple magenta":"fioletowo-purpurowy",red:"Czerwony","red orange":"czerwono-pomarańczowy",saturation:"Nasycenie",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} przezroczystości`,"very dark":"bardzo ciemny","very light":"bardzo jasny",vibrant:"intensywny",white:"biały",yellow:"żółty","yellow green":"żółto-zielony"};var EF;EF={alpha:"Alfa",black:"preto",blue:"Azul","blue purple":"roxo azulado",brightness:"Brilho",brown:"marrom","brown yellow":"marrom amarelado",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"ciano","cyan blue":"azul-ciano",dark:"escuro",gray:"cinza",grayish:"acinzentado",green:"Verde","green cyan":"verde-ciano",hue:"Matiz",light:"claro",lightness:"Luminosidade",magenta:"magenta","magenta pink":"rosa-magenta",orange:"laranja","orange yellow":"amarelo alaranjado",pale:"pálido",pink:"rosa","pink red":"rosa avermelhado",purple:"roxo","purple magenta":"roxo-magenta",red:"Vermelho","red orange":"laranja avermelhado",saturation:"Saturação",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":"muito escuro","very light":"muito claro",vibrant:"vibrante",white:"branco",yellow:"amarelo","yellow green":"verde amarelado"};var IF;IF={alpha:"Alfa",black:"preto",blue:"Azul","blue purple":"azul-púrpura",brightness:"Luminosidade",brown:"castanho","brown yellow":"amarelo-castanho",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"ciano","cyan blue":"azul-ciano",dark:"escuro",gray:"cinzento",grayish:"acinzentado",green:"Verde","green cyan":"verde-ciano",hue:"Tonalidade",light:"claro",lightness:"Claridade",magenta:"magenta","magenta pink":"rosa-magenta",orange:"laranja","orange yellow":"amarelo-laranja",pale:"pálido",pink:"cor-de-rosa","pink red":"vermelho-rosa",purple:"púrpura","purple magenta":"púrpura-magenta",red:"Vermelho","red orange":"laranja-vermelho",saturation:"Saturação",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":"muito escuro","very light":"muito claro",vibrant:"vibrante",white:"branco",yellow:"amarelo","yellow green":"verde-amarelo"};var TF;TF={alpha:"Alfa",black:"negru",blue:"Albastru","blue purple":"albastru-violet",brightness:"Luminozitate",brown:"maro","brown yellow":"galben maro",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"bleu","cyan blue":"albastru-bleu",dark:"închis",gray:"gri",grayish:"cenușiu",green:"Verde","green cyan":"verde bleu",hue:"Nuanță",light:"deschis",lightness:"Luminozitate",magenta:"fucsia","magenta pink":"roz-fucsia",orange:"portocaliu","orange yellow":"galben-portocaliu",pale:"pal",pink:"roz","pink red":"roz-roșu",purple:"violet","purple magenta":"violet-fucsia",red:"Roșu","red orange":"portocaliu-roșu",saturation:"Saturație",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":"foarte închis","very light":"foarte deschis",vibrant:"plin de viață",white:"alb",yellow:"galben","yellow green":"galben-verde"};var FF;FF={alpha:"Альфа",black:"черный",blue:"Синий","blue purple":"сине-фиолетовый",brightness:"Яркость",brown:"коричневый","brown yellow":"коричнево-желтый",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"голубой","cyan blue":"цвет морской волны",dark:"темный",gray:"серый",grayish:"сероватый",green:"Зеленый","green cyan":"сине-зеленый",hue:"Оттенок",light:"светлый",lightness:"Освещенность",magenta:"пурпурный","magenta pink":"пурпурно-розовый",orange:"оранжевый","orange yellow":"оранжево-желтый",pale:"бледный",pink:"розовый","pink red":"розово-красный",purple:"фиолетовый","purple magenta":"фиолетово-пурпурный",red:"Красный","red orange":"красно-оранжевый",saturation:"Насыщенность",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, прозрачный на ${e.percentTransparent}`,"very dark":"очень темный","very light":"очень светлый",vibrant:"яркий",white:"белый",yellow:"желтый","yellow green":"желто-зеленый"};var OF;OF={alpha:"Alfa",black:"čierna",blue:"Modrá","blue purple":"modrofialová",brightness:"Jas",brown:"hnedá","brown yellow":"hnedožltá",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"azúrová","cyan blue":"azúrová modrá",dark:"tmavá",gray:"sivá",grayish:"sivastá",green:"Zelená","green cyan":"zelená azúrová",hue:"Odtieň",light:"svetlá",lightness:"Svetlosť",magenta:"purpurová","magenta pink":"ružová purpurová",orange:"oranžová","orange yellow":"oranžovožltá",pale:"bledá",pink:"ružová","pink red":"ružovočervená",purple:"fialová","purple magenta":"fialová purpurová",red:"Červená","red orange":"červenooranžová",saturation:"Sýtosť",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} priehľadná`,"very dark":"veľmi tmavá","very light":"veľmi svetlá",vibrant:"energická",white:"biela",yellow:"žltá","yellow green":"žltozelená"};var PF;PF={alpha:"Alfa",black:"črna",blue:"Modra","blue purple":"modro vijolična",brightness:"Svetlost",brown:"rjava","brown yellow":"rjavo rumena",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cian","cyan blue":"cian modra",dark:"temna",gray:"siva",grayish:"sivkasta",green:"Zelena","green cyan":"zelena cian",hue:"Barva",light:"svetla",lightness:"Lahkost",magenta:"škrlatna","magenta pink":"škrlatno roza",orange:"oranžna","orange yellow":"oranžno rumena",pale:"bleda",pink:"roza","pink red":"roza rdeča",purple:"vijolična","purple magenta":"vijolično škrlatna",red:"Rdeča","red orange":"rdeče oranžna",saturation:"Nasičenost",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozorna`,"very dark":"zelo temna","very light":"zelo svetla",vibrant:"živahna",white:"bela",yellow:"rumena","yellow green":"rumeno zelena"};var MF;MF={alpha:"Alfa",black:"crno",blue:"Plava","blue purple":"plavoljubičasta",brightness:"Osvetljenost",brown:"smeđa","brown yellow":"smeđežuta",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cijan","cyan blue":"cijan plava",dark:"tamno",gray:"siva",grayish:"sivkasta",green:"Zelena","green cyan":"zeleno cijan",hue:"Nijansa",light:"svetla",lightness:"Osvetljenje",magenta:"purpurnocrvena","magenta pink":"magenta ružičasta",orange:"narandžasta","orange yellow":"narandžastožuta",pale:"bledo",pink:"ružičasta","pink red":"ružičastocrvena",purple:"ljubičasta","purple magenta":"ljubičasta magenta",red:"Crvena","red orange":"crvenonarandžasta",saturation:"Zasićenje",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozirna`,"very dark":"veoma tamno","very light":"vrlo svetlo",vibrant:"živopisna",white:"bela",yellow:"žuto","yellow green":"žutozelena"};var RF;RF={alpha:"Alfa",black:"svart",blue:"Blått","blue purple":"blålila",brightness:"Ljusstyrka",brown:"brun","brown yellow":"brungul",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyan","cyan blue":"cyanblå",dark:"mörk",gray:"grå",grayish:"gråaktig",green:"Grönt","green cyan":"grön cyan",hue:"Nyans",light:"ljus",lightness:"Ljushet",magenta:"magenta","magenta pink":"magentarosa",orange:"orange","orange yellow":"orangegul",pale:"blek",pink:"rosa","pink red":"rosaröd",purple:"lila","purple magenta":"lila magenta",red:"Rött","red orange":"rödorange",saturation:"Mättnad",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} genomskinlig`,"very dark":"mycket mörk","very light":"mycket ljus",vibrant:"livfull",white:"vit",yellow:"gul","yellow green":"gulgrön"};var LF;LF={alpha:"Alfa",black:"siyah",blue:"Mavi","blue purple":"mavi mor",brightness:"Parlaklık",brown:"kahverengi","brown yellow":"kahverengi sarı",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"camgöbeği","cyan blue":"camgöbeği mavi",dark:"koyu",gray:"gri",grayish:"grimsi",green:"Yeşil","green cyan":"yeşil camgöbeği",hue:"Ton",light:"açık",lightness:"Canlılık",magenta:"eflatun","magenta pink":"eflatun pembe",orange:"turuncu","orange yellow":"turuncu sarı",pale:"solgun",pink:"pembe","pink red":"pembe kırmızı",purple:"mor","purple magenta":"mor eflatun",red:"Kırmızı","red orange":"kırmızı portakal",saturation:"Doygunluk",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} saydam`,"very dark":"çok koyu","very light":"çok açık",vibrant:"canlı",white:"beyaz",yellow:"sarı","yellow green":"sarı yeşil"};var NF;NF={alpha:"Альфа",black:"чорний",blue:"Синій","blue purple":"синьо-фіолетовий",brightness:"Яскравість",brown:"коричневий","brown yellow":"коричнево-жовтий",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"блакитний","cyan blue":"синьо-блакитний",dark:"темний",gray:"сірий",grayish:"сіруватий",green:"Зелений","green cyan":"зелено-блакитний",hue:"Тон",light:"світлий",lightness:"Освітленість",magenta:"пурпуровий","magenta pink":"пурпурово-рожевий",orange:"помаранчевий","orange yellow":"помаранчево-жовтий",pale:"блідий",pink:"рожевий","pink red":"рожево-червоний",purple:"фіолетовий","purple magenta":"фіолетово-пурпуровий",red:"Червоний","red orange":"червоно-помаранчевий",saturation:"Насиченість",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, прозорий на ${e.percentTransparent}`,"very dark":"дуже темний","very light":"дуже світлий",vibrant:"яскравий",white:"білий",yellow:"жовтий","yellow green":"жовто-зелений"};var jF;jF={alpha:"Alpha",black:"黑色",blue:"蓝色","blue purple":"蓝紫色",brightness:"亮度",brown:"棕色的","brown yellow":"棕黄色",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"蓝绿色","cyan blue":"青蓝色",dark:"深色",gray:"灰色",grayish:"浅灰色的",green:"绿色","green cyan":"绿青色",hue:"色相",light:"浅色",lightness:"明亮度",magenta:"紫红色","magenta pink":"紫粉色",orange:"橙色","orange yellow":"橙黄色",pale:"苍白的",pink:"粉色","pink red":"粉红色",purple:"紫色","purple magenta":"紫洋红色",red:"红色","red orange":"红橙色",saturation:"饱和度",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":"很暗","very light":"很浅",vibrant:"生机勃勃",white:"白色",yellow:"黄色","yellow green":"黄色/绿色"};var DF;DF={alpha:"Alpha",black:"黑",blue:"藍色","blue purple":"藍紫",brightness:"亮度",brown:"棕","brown yellow":"棕黃",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"青","cyan blue":"青藍",dark:"暗",gray:"灰",grayish:"偏灰",green:"綠色","green cyan":"青綠",hue:"色相",light:"淺",lightness:"明亮",magenta:"洋紅","magenta pink":"淺洋紅",orange:"橙","orange yellow":"橙黃",pale:"淡",pink:"粉紅","pink red":"粉紅",purple:"紫","purple magenta":"紫洋紅",red:"紅色","red orange":"橙紅",saturation:"飽和度",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":"很暗","very light":"很淺",vibrant:"鮮豔",white:"白",yellow:"黃","yellow green":"黃綠"};var zF;zF={"ar-AE":XT,"bg-BG":aF,"cs-CZ":sF,"da-DK":lF,"de-DE":cF,"el-GR":uF,"en-US":dF,"es-ES":hF,"et-EE":fF,"fi-FI":pF,"fr-FR":gF,"he-IL":mF,"hr-HR":vF,"hu-HU":yF,"it-IT":bF,"ja-JP":wF,"ko-KR":xF,"lt-LT":CF,"lv-LV":_F,"nb-NO":SF,"nl-NL":AF,"pl-PL":kF,"pt-BR":EF,"pt-PT":IF,"ro-RO":TF,"ru-RU":FF,"sk-SK":OF,"sl-SI":PF,"sr-SP":MF,"sv-SE":RF,"tr-TR":LF,"uk-UA":NF,"zh-CN":jF,"zh-TW":DF};const BF=Symbol.for("react-aria.i18n.locale"),UF=Symbol.for("react-aria.i18n.strings");let VF;class HF{getStringForLocale(e,t){let r=this.getStringsForLocale(t)[e];if(!r)throw new Error(`Could not find intl message ${e} in ${t} locale`);return r}getStringsForLocale(e){let t=this.strings[e];return t||(t=function(e,t,r="en-US"){if(t[e])return t[e];let n=function(e){return Intl.Locale?new Intl.Locale(e).language:e.split("-")[0]}(e);if(t[n])return t[n];for(let e in t)if(e.startsWith(n+"-"))return t[e];return t[r]}(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(e){if(typeof window>"u")return null;let t=window[BF];if(void 0===VF){let e=window[UF];if(!e)return null;VF={};for(let r in e)VF[r]=new HF({[t]:e[r]},t)}let r=null==VF?void 0:VF[e];if(!r)throw new Error(`Strings for package "${e}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}constructor(e,t="en-US"){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}}const WF=new Map,$F=new Map;class qF{format(e,t){let r=this.strings.getStringForLocale(e,this.locale);return"function"==typeof r?r(t,this):r}plural(e,t,r="cardinal"){let n=t["="+e];if(n)return"function"==typeof n?n():n;let i=this.locale+":"+r,o=WF.get(i);return o||(o=new Intl.PluralRules(this.locale,{type:r}),WF.set(i,o)),n=t[o.select(e)]||t.other,"function"==typeof n?n():n}number(e){let t=$F.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),$F.set(this.locale,t)),t.format(e)}select(e,t){let r=e[t]||e.other;return"function"==typeof r?r():r}constructor(e,t){this.locale=e,this.strings=t}}let GF=new Map,YF=!1;try{YF="exceptZero"===new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay}catch{}let XF=!1;try{XF="unit"===new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style}catch{}const KF={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class ZF{format(e){let t="";if(t=YF||null==this.options.signDisplay?this.numberFormatter.format(e):function(e,t,r){if("auto"===t)return e.format(r);if("never"===t)return e.format(Math.abs(r));{let n=!1;if("always"===t?n=r>0||Object.is(r,0):"exceptZero"===t&&(Object.is(r,-0)||Object.is(r,0)?r=Math.abs(r):n=r>0),n){let t=e.format(-r),n=e.format(r),i=t.replace(n,"").replace(/\u200e|\u061C/,"");return 1!==[...i].length&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),t.replace(n,"!!!").replace(i,"+").replace("!!!",n)}return e.format(r)}}(this.numberFormatter,this.options.signDisplay,e),"unit"===this.options.style&&!XF){var r;let{unit:e,unitDisplay:n="short",locale:i}=this.resolvedOptions();if(!e)return t;let o=null===(r=KF[e])||void 0===r?void 0:r[n];t+=o[i]||o.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if("function"==typeof this.numberFormatter.formatRange)return this.numberFormatter.formatRange(e,t);if(t<e)throw new RangeError("End date must be >= start date");return`${this.format(e)} – ${this.format(t)}`}formatRangeToParts(e,t){if("function"==typeof this.numberFormatter.formatRangeToParts)return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw new RangeError("End date must be >= start date");let r=this.numberFormatter.formatToParts(e),n=this.numberFormatter.formatToParts(t);return[...r.map(e=>({...e,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...n.map(e=>({...e,source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!YF&&null!=this.options.signDisplay&&(e={...e,signDisplay:this.options.signDisplay}),!XF&&"unit"===this.options.style&&(e={...e,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}constructor(e,t={}){this.numberFormatter=function(e,t={}){let{numberingSystem:r}=t;if(r&&e.includes("-nu-")&&(e.includes("-u-")||(e+="-u-"),e+=`-nu-${r}`),"unit"===t.style&&!XF){var n;let{unit:e,unitDisplay:r="short"}=t;if(!e)throw new Error('unit option must be provided with style: "unit"');if(null===(n=KF[e])||void 0===n||!n[r])throw new Error(`Unsupported unit ${e} with unitDisplay = ${r}`);t={...t,style:"decimal"}}let i=e+(t?Object.entries(t).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(GF.has(i))return GF.get(i);let o=new Intl.NumberFormat(e,t);return GF.set(i,o),o}(e,t),this.options=t}}let QF=new HF(function(e){return e&&e.__esModule?e.default:e}(zF));const JF=[[0,"pink"],[15,"red"],[48,"orange"],[94,"yellow"],[135,"green"],[175,"cyan"],[264,"blue"],[284,"purple"],[320,"magenta"],[349,"pink"]];class eO{toHexInt(){return this.toFormat("rgb").toHexInt()}getChannelValue(e){if(e in this)return this[e];throw new Error("Unsupported color channel: "+e)}withChannelValue(e,t){if(e in this){let r=this.clone();return r[e]=t,r}throw new Error("Unsupported color channel: "+e)}getChannelName(e,t){return(HF.getGlobalDictionaryForPackage("@react-stately/color")||QF).getStringForLocale(e,t)}getColorSpaceAxes(e){let{xChannel:t,yChannel:r}=e,n=t||this.getColorChannels().find(e=>e!==r),i=r||this.getColorChannels().find(e=>e!==n),o=this.getColorChannels().find(e=>e!==n&&e!==i);return{xChannel:n,yChannel:i,zChannel:o}}getColorName(e){let t,[r,n,i]=sO(this),o=HF.getGlobalDictionaryForPackage("@react-stately/color")||QF;if(r>.999)return o.getStringForLocale("white",e);if(r<.001)return o.getStringForLocale("black",e);[t,r]=this.getOklchHue(r,n,i,e);let a="",s="";n<=.1&&n>=.001?s=r>=.7?"pale":"grayish":n>=.15&&(s="vibrant"),r<.3?a="very dark":r<.55?a="dark":r<.7||(a=r<.85?"light":"very light"),s&&(s=o.getStringForLocale(s,e)),a&&(a=o.getStringForLocale(a,e));let l=this.getChannelValue("alpha"),c=new qF(e,o);if(l<1){let r=new ZF(e,{style:"percent"}).format(1-l);return c.format("transparentColorName",{lightness:a,chroma:s,hue:t,percentTransparent:r}).replace(/\s+/g," ").trim()}return c.format("colorName",{lightness:a,chroma:s,hue:t}).replace(/\s+/g," ").trim()}getOklchHue(e,t,r,n){let i=HF.getGlobalDictionaryForPackage("@react-stately/color")||QF;if(t<.001)return[i.getStringForLocale("gray",n),e];for(let t=0;t<JF.length;t++){let[o,a]=JF[t],[s,l]=JF[t+1]||[360,"pink"];if(r>=o&&r<s)return"orange"===a&&(e<.68?a="brown":e=e-.68+.55),r>o+(s-o)/2&&a!==l?a=`${a} ${l}`:"yellow"===a&&e<.85&&(a="yellow green"),[i.getStringForLocale(a,n).toLocaleLowerCase(n),e]}throw new Error("Unexpected hue")}getHueName(e){let[t,r,n]=sO(this),[i]=this.getOklchHue(t,r,n,e);return i}}class tO extends eO{static parse(e){let t=[];if(/^#[\da-f]+$/i.test(e)&&[4,5,7,9].includes(e.length)){const r=(e.length<6?e.replace(/[^#]/gi,"$&$&"):e).slice(1).split("");for(;r.length>0;)t.push(parseInt(r.splice(0,2).join(""),16));t[3]=void 0!==t[3]?t[3]/255:void 0}const r=e.match(/^rgba?\((.*)\)$/);var n;return null!=r&&r[1]&&(t=r[1].split(",").map(e=>Number(e.trim())),t=t.map((e,t)=>IC(e,0,t<3?255:1))),t.length<3?void 0:new tO(t[0],t[1],t[2],null!==(n=t[3])&&void 0!==n?n:1)}toString(e="css"){switch(e){case"hex":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")).toUpperCase();case"hexa":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")+Math.round(255*this.alpha).toString(16).padStart(2,"0")).toUpperCase();case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"css":case"rgba":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hex":case"hexa":case"rgb":case"rgba":return this;case"hsb":case"hsba":return this.toHSB();case"hsl":case"hsla":return this.toHSL();default:throw new Error("Unsupported color conversion: rgb -> "+e)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){const e=this.red/255,t=this.green/255,r=this.blue/255,n=Math.min(e,t,r),i=Math.max(e,t,r),o=i-n,a=0===i?0:o/i;let s=0;if(0!==o){switch(i){case e:s=(t-r)/o+(t<r?6:0);break;case t:s=(r-e)/o+2;break;case r:s=(e-t)/o+4}s/=6}return new nO(FC(360*s,2),FC(100*a,2),FC(100*i,2),this.alpha)}toHSL(){const e=this.red/255,t=this.green/255,r=this.blue/255,n=Math.min(e,t,r),i=Math.max(e,t,r),o=(i+n)/2,a=i-n;let s,l;if(0===a)s=l=0;else{switch(l=a/(o<.5?i+n:2-i-n),i){case e:s=(t-r)/a+(t<r?6:0);break;case t:s=(r-e)/a+2;break;case r:s=(e-t)/a+4}s/=6}return new aO(FC(360*s,2),FC(100*l,2),FC(100*o,2),this.alpha)}clone(){return new tO(this.red,this.green,this.blue,this.alpha)}getChannelRange(e){switch(e){case"red":case"green":case"blue":return{minValue:0,maxValue:255,step:1,pageSize:17};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"red":case"green":case"blue":return{style:"decimal"};case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,t){let r=this.getChannelFormatOptions(e),n=this.getChannelValue(e);return new ZF(t,r).format(n)}getColorSpace(){return"rgb"}getColorChannels(){return tO.colorChannels}constructor(e,t,r,n){super(),this.red=e,this.green=t,this.blue=r,this.alpha=n}}tO.colorChannels=["red","green","blue"];const rO=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;class nO extends eO{static parse(e){let t;if(t=e.match(rO)){var r;const[e,n,i,o]=(null!==(r=t[1])&&void 0!==r?r:t[2]).split(",").map(e=>Number(e.trim().replace("%","")));return new nO(oO(e,360),IC(n,0,100),IC(i,0,100),IC(o??1,0,1))}}toString(e="css"){switch(e){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${FC(this.saturation,2)}%, ${FC(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${FC(this.saturation,2)}%, ${FC(this.brightness,2)}%, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hsb":case"hsba":return this;case"hsl":case"hsla":return this.toHSL();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsb -> "+e)}}toHSL(){let e=this.saturation/100,t=this.brightness/100,r=t*(1-e/2);return e=0===r||1===r?0:(t-r)/Math.min(r,1-r),new aO(FC(this.hue,2),FC(100*e,2),FC(100*r,2),this.alpha)}toRGB(){let e=this.hue,t=this.saturation/100,r=this.brightness/100,n=(n,i=(n+e/60)%6)=>r-t*r*Math.max(Math.min(i,4-i,1),0);return new tO(Math.round(255*n(5)),Math.round(255*n(3)),Math.round(255*n(1)),this.alpha)}clone(){return new nO(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(e){switch(e){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"brightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"brightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,t){let r=this.getChannelFormatOptions(e),n=this.getChannelValue(e);return("saturation"===e||"brightness"===e)&&(n/=100),new ZF(t,r).format(n)}getColorSpace(){return"hsb"}getColorChannels(){return nO.colorChannels}constructor(e,t,r,n){super(),this.hue=e,this.saturation=t,this.brightness=r,this.alpha=n}}nO.colorChannels=["hue","saturation","brightness"];const iO=/hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;function oO(e,t){return(e%t+t)%t}class aO extends eO{static parse(e){let t;if(t=e.match(iO)){var r;const[e,n,i,o]=(null!==(r=t[1])&&void 0!==r?r:t[2]).split(",").map(e=>Number(e.trim().replace("%","")));return new aO(oO(e,360),IC(n,0,100),IC(i,0,100),IC(o??1,0,1))}}toString(e="css"){switch(e){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${FC(this.saturation,2)}%, ${FC(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${FC(this.saturation,2)}%, ${FC(this.lightness,2)}%, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hsl":case"hsla":return this;case"hsb":case"hsba":return this.toHSB();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsl -> "+e)}}toHSB(){let e=this.saturation/100,t=this.lightness/100,r=t+e*Math.min(t,1-t);return e=0===r?0:2*(1-t/r),new nO(FC(this.hue,2),FC(100*e,2),FC(100*r,2),this.alpha)}toRGB(){let e=this.hue,t=this.saturation/100,r=this.lightness/100,n=t*Math.min(r,1-r),i=(t,i=(t+e/30)%12)=>r-n*Math.max(Math.min(i-3,9-i,1),-1);return new tO(Math.round(255*i(0)),Math.round(255*i(8)),Math.round(255*i(4)),this.alpha)}clone(){return new aO(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(e){switch(e){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"lightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"lightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,t){let r=this.getChannelFormatOptions(e),n=this.getChannelValue(e);return("saturation"===e||"lightness"===e)&&(n/=100),new ZF(t,r).format(n)}getColorSpace(){return"hsl"}getColorChannels(){return aO.colorChannels}constructor(e,t,r,n){super(),this.hue=e,this.saturation=t,this.lightness=r,this.alpha=n}}function sO(e){let t=e.toFormat("rgb"),r=t.getChannelValue("red")/255,n=t.getChannelValue("green")/255,i=t.getChannelValue("blue")/255;[r,n,i]=function(e,t,r){return[lO(e),lO(t),lO(r)]}(r,n,i);let[o,a,s]=function(e,t,r){return cO([.4123907992659595,.35758433938387796,.1804807884018343,.21263900587151036,.7151686787677559,.07219231536073371,.01933081871559185,.11919477979462599,.9505321522496606],e,t,r)}(r,n,i),[l,c,u]=function(e,t,r){const n=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],i=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774];let[o,a,s]=cO(n,e,t,r);return cO(i,Math.cbrt(o),Math.cbrt(a),Math.cbrt(s))}(o,a,s);return function(e,t,r){var n=180*Math.atan2(r,t)/Math.PI;return[e,Math.sqrt(t**2+r**2),n>=0?n:n+360]}(l,c,u)}function lO(e){let t=e<0?-1:1,r=Math.abs(e);return r<=.04045?e/12.92:t*Math.pow((r+.055)/1.055,2.4)}function cO(e,t,r,n){return[e[0]*t+e[1]*r+e[2]*n,e[3]*t+e[4]*r+e[5]*n,e[6]*t+e[7]*r+e[8]*n]}aO.colorChannels=["hue","saturation","lightness"];function uO({onChange:t,value:r,colors:n}){const i=n.map(n=>{const i=r===n;return e(lS,{onClick:()=>{null==t||t(n)},className:Tf("relative block flex-shrink-0 w-26 h-26 border rounded",i&&"shadow-md"),style:{backgroundColor:n},children:i&&e("span",{className:"absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"})},n)});return e("div",{className:"flex flex-wrap gap-6",children:i})}const dO=[{color:"rgb(255, 255, 255)",name:wf("White")},{color:"rgb(239,245,245)",name:wf("Solitude")},{color:"rgb(245,213,174)",name:wf("Wheat")},{color:"rgb(253,227,167)",name:wf("Cape Honey")},{color:"rgb(242,222,186)",name:wf("Milk punch")},{color:"rgb(97,118,75)",name:wf("Dingy"),foreground:"rgb(255, 255, 255)"},{color:"rgb(4, 147, 114)",name:wf("Aquamarine"),foreground:"rgb(255, 255, 255)"},{color:"rgb(222,245,229)",name:wf("Cosmic Latte")},{color:"rgb(233,119,119)",name:wf("Geraldine"),foreground:"rgb(90,14,14)"},{color:"rgb(247,164,164)",name:wf("Sundown")},{color:"rgb(30,139,195)",name:wf("Pelorous"),foreground:"rgb(255, 255, 255)"},{color:"rgb(142,68,173)",name:wf("Deep Lilac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(108,74,182)",name:wf("Blue marguerite"),foreground:"rgb(255, 255, 255)"},{color:"rgb(139,126,116)",name:wf("Americano"),foreground:"rgb(255, 255, 255)"},{color:"rgb(0,0,0)",name:wf("Black"),foreground:"rgb(255, 255, 255)"},{color:"rgb(64,66,88)",name:wf("Blue zodiac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(101,100,124)",name:wf("Comet"),foreground:"rgb(255, 255, 255)"}].map(({color:e})=>e).slice(0,14);function hO({defaultValue:r,onChange:n,colorPresets:i,showInput:a}){const[s,l]=o(r),c=i||dO,u=aE({size:"sm"});return t("div",{children:[e(tF,{className:"!w-auto",color:s,onChange:e=>{null==n||n(e),l(e)}}),t("div",{className:"px-12 py-20",children:[c&&e(uO,{colors:c,onChange:e=>{if(e){const t=function(e){let t=tO.parse(e)||nO.parse(e)||aO.parse(e);if(t)return t;throw new Error("Invalid color value: "+e)}(e).toString("hex");null==n||n(t),l(t)}},value:s}),a&&e("div",{className:"pt-20",children:e(oF,{autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,"aria-label":"Hex color",prefixed:!0,className:u.input,color:s,onChange:e=>{null==n||n(e),l(e)}})})]})]})}const fO=i.createContext(null);function pO(){return l(fO)}function gO(){const{lines:e,localeCode:t}=Ek();return{trans:c(r=>mO({...r,lines:e,localeCode:t}),[e,t])}}const mO=yS(e=>{let{lines:t,message:r,values:n,localeCode:i}=e;return null==r?"":(r=(null==t?void 0:t[r])||(null==t?void 0:t[r.toLowerCase()])||r,n&&(r=Ik(i,e),Object.entries(n).forEach(([e,t])=>{r=r.replace(`:${e}`,`${t}`)})),r)},{equals:kk,callTimeout:0});function vO({onDismiss:t}){const{trans:r}=gO();return e("button",{className:"sr-only","aria-label":r(wf("Dismiss")),tabIndex:-1,onClick:()=>{t&&t()}})}function yO(r){const{type:n="modal",dialogProps:i,...o}=l(fO),{children:a,className:s,size:c="md",background:u,radius:d="rounded",maxWidth:h="max-w-dialog",...f}=r;let p=null;("popover"===n||"tray"===n)&&(p=e(vO,{onDismiss:o.close}));const g="fullscreenTakeover"===c||"tray"===n,y=Tf("mx-auto pointer-events-auto outline-none flex flex-col overflow-hidden",u||"bg","tray"!==n&&function(e){switch(e){case"2xs":return"w-256";case"xs":return"w-320";case"sm":return"w-384";case"md":return"w-440";case"lg":return"w-620";case"xl":return"w-780";case"2xl":return"w-850";case"fullscreen":return"w-1280";case"fullscreenTakeover":return"w-full h-full";default:return e}}(c),"tray"===n&&"rounded-t border-b-bg","fullscreenTakeover"!==c&&"shadow-2xl border max-h-dialog",!g&&`${d} ${h}`,s);return t("div",{...gC({role:"dialog",tabIndex:-1},i,f),style:{...r.style,"--be-dialog-padding":"24px"},"aria-modal":!0,className:y,children:[m.toArray(a).map(e=>v(e)?w(e,{size:e.props.size??c}):e),p]})}const bO=Pf(e("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDownOutlined"),wO=p(({children:r,autoFocus:n=!1,restoreFocus:i=!0,isDismissable:o=!0,isOpen:a=!1,placement:s="center",onClose:l},c)=>{const u=bk(),d=SC(c);return t("div",{className:"fixed inset-0 isolate z-modal",style:u,onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),e.preventDefault(),l())},children:[e(Sk,{onClick:()=>{o&&l()}},"modal-underlay"),e(Gx.div,{ref:d,className:Tf("pointer-events-none absolute inset-0 z-20 flex h-full w-full","center"===s&&"items-center justify-center","top"===s&&"items-start justify-center pt-40"),role:"presentation",initial:{opacity:0,scale:"top"===s?1:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1},transition:{duration:.1},children:e(nk,{restoreFocus:i,autoFocus:n,contain:!0,children:r})})]})});function xO(r){let{children:n,type:i,disableInitialTransition:o,isDismissable:s=!0,moveFocusToDialog:l=!0,returnFocusToTrigger:h=!0,triggerOnHover:f=!1,triggerOnContextMenu:p=!1,usePortal:g=!0,mobileType:v,alwaysReturnCurrentValueOnClose:x}=r;const C=u(null),_=p&&!r.triggerRef?C:r.triggerRef,S=u(r.value),[A,k]=EC(r.isOpen,r.defaultIsOpen,r.onOpenChange),[E,I]=EC(r.value,r.defaultValue,r.onValueChange);Dk()&&"popover"===i&&(i=v||"modal");const T=u(null),{x:F,y:O,reference:P,strategy:M,refs:R}=jA({...r,disablePositioning:"modal"===i}),L="popover"===i?{position:M,top:O??"",left:F??""}:{},N=b(),j=`${N}-label`,D=`${N}-description`,z=`${N}-form`,B=function(e){const t=u(e);return a(()=>{t.current=e}),d(()=>(...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}(r.onClose),U=c(e=>{typeof e>"u"&&x&&(e=E);const t=typeof e<"u"?e:S.current;null==B||B(t,{initialValue:S.current,valueChanged:t!==S.current}),k(!1)},[B,k,E,x]),V=c(()=>{k(!0),S.current=r.value},[r.value,k]);iC(()=>{null!=_&&_.current&&R.reference.current!==_.current&&P(_.current)},[P,null==_?void 0:_.current,R]);const H=d(()=>({"aria-labelledby":j,"aria-describedby":D}),[j,D]);let W;W="modal"===i?wO:"tray"===i?Ak:xk;const $=d(()=>({dialogProps:H,type:i,labelId:j,descriptionId:D,isDismissable:s,close:U,value:E,initialValue:S.current,setValue:I,formId:z}),[U,D,H,z,j,i,s,E,I]);f=f&&"popover"===i;const q={onPointerEnter:sS(e=>{V()}),onPointerLeave:sS(e=>{T.current=setTimeout(()=>{U()},150)})},G={onPointerEnter:sS(e=>{T.current&&clearTimeout(T.current)}),onPointerLeave:sS(e=>{U()})},Y={onContextMenu:sS(e=>{e.preventDefault(),C.current=function({x:e,y:t},r){return{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,right:e,bottom:t,left:e}),contextElement:r}}({x:e.clientX,y:e.clientY},e.currentTarget),V()})},X={onClick:sS(e=>{e.stopPropagation(),A?U():V()})},{dialogTrigger:K,dialog:Z}=function(e,t){const r=Array.isArray(e)?e:m.toArray(e);let n=2===r.length?r[1]:r[0];return n="function"==typeof n?n(t):n,2===r.length?{dialogTrigger:r[0],dialog:n}:{dialog:n}}(n,$),Q=e(eC,{initial:!o,children:A&&e(fO.Provider,{value:$,children:e(W,{...f?G:{},ref:R.setFloating,triggerRef:R.reference,style:L,restoreFocus:h,autoFocus:l,isOpen:A,onClose:U,isDismissable:s,isContextMenu:p,placement:r.placement,children:Z})})});return t(y,{children:[K&&w(K,gC({..._||p?{}:{ref:P},...p?{}:X,...f?q:{},...p?Y:{}},{...K.props})),g?Dm&&ke(Q,Dm):Q]})}function CO(r){const{label:n,className:i,value:a,onChange:s,size:l,width:c="w-max"}=r,u=$m(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.colorPresets)?void 0:r.items})||[],d=aE({size:l}),[h,f]=o(a),[p,g]=o(!1);return t("div",{className:Tf(i,c),children:[n&&e("span",{className:d.label,children:n}),t(xO,{type:"popover",isOpen:p,onOpenChange:g,children:[t(lS,{className:Tf(d.input,"inline-flex items-center"),"aria-label":r["aria-label"],children:[e("span",{className:"block flex-shrink-0 mr-5 border rounded h-2/4 aspect-square",style:{backgroundColor:h}}),e(_O,{isActive:p,className:d.adornment})]}),e(yO,{size:"auto",children:e(hO,{onChange:e=>{f(e),null==s||s(e)},defaultValue:h,colorPresets:u})})]})]})}function _O({isActive:t,className:r}){return e(bO,{size:"sm",className:`transition-transform ml-auto flex-shrink-0 ${t?"rotate-180":"rotate-0"} ${r}`})}function SO(r){const{size:n="md",inline:i,label:o,showValueLabel:a=!!o,className:s,width:l="w-full",slider:c,children:u,trackColor:d="primary",fillColor:h="primary"}=r,{domProps:f,trackRef:p,getThumbPercent:g,getThumbValueLabel:m,labelId:v,groupId:y,thumbIds:b,isDisabled:w,numberFormatter:x,minValue:C,maxValue:_,step:S,values:A,getValueLabel:k}=c;let E="",I=Math.max([...x.format(C)].length,[...x.format(_)].length,[...x.format(S)].length);k?E=k(A[0]):1===A.length?E=m(0):2===A.length&&(E=`${m(0)} – ${m(1)}`,I=3+2*Math.max(I,[...x.format(C)].length,[...x.format(_)].length));const T=aE({size:n,disabled:w,labelDisplay:"flex"}),F=Tf("touch-none",s,l,{"flex items-center":i});return t("div",{className:F,role:"group",id:y,children:[(o||a)&&t("div",{className:Tf(T.label,"select-none"),children:[o&&e("label",{onClick:()=>{var e;null==(e=document.getElementById(b[0]))||e.focus()},id:v,htmlFor:y,children:o}),a&&e("output",{htmlFor:b[0],className:"ml-auto text-right","aria-live":"off",style:I?{width:`${I}ch`,minWidth:`${I}ch`}:void 0,children:E})]}),t("div",{ref:p,className:Tf("relative",AO(r)),...f,role:"presentation",children:[e("div",{className:Tf("absolute inset-0 m-auto rounded",EO(d,w),kO(n))}),e("div",{className:Tf("absolute inset-0 my-auto rounded",IO(h,w),kO(n)),style:{width:`${Math.max(100*g(0),0)}%`}}),u]})]})}function AO({size:e,wrapperHeight:t}){if(t)return t;switch(e){case"xs":return"h-14";case"sm":return"h-20";default:return"h-30"}}function kO(e){switch(e){case"xs":return"h-2";case"sm":return"h-3";default:return"h-4"}}function EO(e,t){switch(t&&(e="disabled"),e){case"disabled":return"bg-slider-disabled/60";case"primary":return"bg-primary-light";case"neutral":return"bg-divider";default:return e}}function IO(e,t){switch(t&&(e="disabled"),e){case"disabled":return"bg-slider-disabled";case"primary":return"bg-primary";default:return e}}function TO(e={}){const{localeCode:t}=Ek();return d(()=>new ZF(t,e),[t,e])}function FO({minValue:e=0,maxValue:t=100,isDisabled:r=!1,step:n=1,formatOptions:i,onChangeEnd:a,onPointerDown:s,label:l,getValueLabel:c,showThumbOnHoverOnly:d,thumbSize:h,onPointerMove:f,...p}){const[g,m]=o(!1),v=TO(i),{addGlobalListener:y,removeGlobalListener:w}=_C(),x=u(null),[C,_]=EC(p.value?p.value:void 0,p.defaultValue??[e],p.onChange),S=u(null);S.current=C;const[A,k]=o(new Array(C.length).fill(!1)),E=u(null);E.current=A;const I=t=>0===t?e:C[t-1],T=e=>e===C.length-1?t:C[e+1],F=(e,t)=>{if(r||!j(e)||!S.current)return;t=function(e,t,r,n){t=Number(t),r=Number(r);let i=(e-(isNaN(t)?0:t))%n,o=TC(2*Math.abs(i)>=n?e+Math.sign(i)*(n-Math.abs(i)):e-i,n);return isNaN(t)?!isNaN(r)&&o>r&&(o=Math.floor(TC(r/n,n))*n):o<t?o=t:!isNaN(r)&&o>r&&(o=t+Math.floor(TC((r-t)/n,n))*n),o=TC(o,n),o}(t,I(e),T(e),n),S.current=OO(S.current,e,t),_(S.current)},O=(e,t)=>{var n;if(r||!j(e))return;const i=null==(n=E.current)?void 0:n[e];E.current=OO(E.current||[],e,t),k(E.current),a&&i&&!E.current.some(Boolean)&&a(S.current||[])},[P,M]=o(void 0),R=r=>(r=>{const n=Math.min(1,(r-e)/(t-e));return isNaN(n)?0:n})(S.current[r]),L=r=>oT((t=>Math.round((t-e)/n)*n+e)(r*(t-e)+e),e,t),N=u(new Array(C.length).fill(!0)),j=e=>N.current[e],D=u(null),z=u(void 0),B=u(null),{domProps:U}=XI({onPointerDown:e=>{if(("mouse"!==e.pointerType||!(0!==e.button||e.altKey||e.ctrlKey||e.metaKey))&&(null==s||s(),x.current&&!r&&C.every((e,t)=>!A[t]))){const t=x.current.offsetWidth,r=x.current.getBoundingClientRect().left,n=(e.clientX-r)/t,i=L(n);let o;const a=C.findIndex(e=>i-e<0);if(0===a)o=a;else if(-1===a)o=C.length-1;else{const e=C[a-1],t=C[a];o=Math.abs(e-i)<Math.abs(t-i)?a-1:a}o>=0&&j(o)?(e.preventDefault(),D.current=o,M(o),z.current=e.pointerId,O(D.current,!0),F(o,i),y(window,"pointerup",H,!1)):D.current=null}},onMoveStart(){B.current=null},onMove(e,t){var r;const n=(null==(r=x.current)?void 0:r.offsetWidth)||0;if(null==B.current&&(B.current=R(D.current||0)*n),B.current+=t,null!=D.current&&x.current){const e=oT(B.current/n,0,1);((e,t)=>{F(e,L(t))})(D.current,e)}},onMoveEnd(){null!=D.current&&(O(D.current,!1),D.current=null)}}),V=gC(U,{onPointerEnter:()=>{m(!0)},onPointerLeave:()=>{m(!1)},onPointerMove:e=>{null==f||f(e)}}),H=e=>{e.pointerId===z.current&&(null!=D.current&&(O(D.current,!1),D.current=null),w(window,"pointerup",H,!1))},W=b(),$=l?`${W}-label`:void 0,q=`${W}-group`,G=[...Array(C.length)].map((e,t)=>`${W}-thumb-${t}`);return{domProps:V,trackRef:x,isDisabled:r,step:n,values:C,minValue:e,maxValue:t,focusedThumb:P,labelId:$,groupId:q,thumbIds:G,numberFormatter:v,getThumbPercent:R,getThumbMinValue:I,getThumbMaxValue:T,getThumbValueLabel:e=>function(e){return v.format(e)}(C[e]),isThumbDragging:e=>{var t;return(null==(t=E.current)?void 0:t[e])||!1},setThumbValue:F,updateDraggedThumbs:O,setThumbEditable:(e,t)=>{N.current[e]=t},setFocusedThumb:M,getValueLabel:c,isPointerOver:g,showThumbOnHoverOnly:d,thumbSize:h}}function OO(e,t,r){return e[t]===r?e:[...e.slice(0,t),r,...e.slice(t+1)]}function PO({index:t,slider:r,isDisabled:n,ariaLabel:i,inputRef:o,onBlur:s,fillColor:l="primary"}){const d=SC(o),{addGlobalListener:h,removeGlobalListener:f}=_C(),{step:p,values:g,focusedThumb:m,labelId:v,thumbIds:y,isDisabled:b,getThumbPercent:w,getThumbMinValue:x,getThumbMaxValue:C,getThumbValueLabel:_,setThumbValue:S,updateDraggedThumbs:A,isThumbDragging:k,setThumbEditable:E,setFocusedThumb:I,isPointerOver:T,showThumbOnHoverOnly:F,thumbSize:O="w-18 h-18"}=r,P=k(t),M=g[t];E(t,!n);const R=n||b,L=c(()=>{d.current&&d.current.focus({preventScroll:!0})},[d]),N=m===t;a(()=>{N&&L()},[N,L]);const j=u(void 0),D=e=>{e.pointerId===j.current&&(L(),A(t,!1),f(window,"pointerup",D,!1))},z=Tf("outline-none rounded-full top-1/2 -translate-y-1/2 -translate-x-1/2 absolute inset-0 transition-button duration-200",O,!R&&"shadow-md",function({isDisabled:e,isDragging:t,fillColor:r}){return e?"bg-slider-disabled cursor-default":r&&"primary"!==r?r:Tf("hover:bg-primary-dark",t?"bg-primary-dark":"bg-primary")}({fillColor:l,isDisabled:R,isDragging:P}),!F||F&&P||T?"visible":"invisible");return e("div",{role:"presentation",className:z,style:{left:`${Math.max(100*w(t),0)}%`},onPointerDown:e=>{0!==e.button||e.altKey||e.ctrlKey||e.metaKey||(L(),j.current=e.pointerId,A(t,!0),h(window,"pointerup",D,!1))},children:e("input",{id:y[t],onKeyDown:sS(()=>{A(t,!0)}),onKeyUp:sS(()=>{A(t,!1)}),ref:d,tabIndex:R?void 0:0,min:x(t),max:C(t),step:p,value:M,disabled:R,"aria-label":i,"aria-labelledby":v,"aria-orientation":"horizontal","aria-valuetext":_(t),onFocus:()=>{I(t)},onBlur:e=>{I(void 0),A(t,!1),null==s||s(e)},onChange:e=>{S(t,parseFloat(e.target.value))},type:"range",className:"sr-only"})})}function MO({inputRef:t,onBlur:r,...n}){const{onChange:i,onChangeEnd:o,value:a,defaultValue:s,...l}=n,c={...l,value:null!=a?[a]:void 0,defaultValue:null!=s?[s]:void 0,onChange:e=>{null==i||i(e[0])},onChangeEnd:e=>{null==o||o(e[0])}},u=FO(c);return e(SO,{...c,slider:u,children:e(PO,{fillColor:n.fillColor,index:0,slider:u,inputRef:t,onBlur:r})})}const RO=i.forwardRef((r,n)=>{let{value:i=0,minValue:o=0,maxValue:a=100,size:s="md",isIndeterminate:l=!1,className:c,position:u="relative",trackColor:d,fillColor:h="border-primary",...f}=r;i=oT(i,o,a);const p=function(e){switch(e){case"xs":return"w-20 h-20";case"sm":return"w-24 h-24";case"md":return"w-32 h-32";case"lg":return"w-42 h-42";default:return e}}(s),g=(i-o)/(a-o),m=TO({style:"percent"});let v="";!l&&!v&&(v=m.format(g));const y={},b={};if(!l){const e=(i-o)/(a-o)*100;let t;e>0&&e<=50?(t=e/50*180-180,y.transform=`rotate(${t}deg)`,b.transform="rotate(-180deg)"):e>50&&(t=(e-50)/50*180-180,y.transform="rotate(0deg)",b.transform=`rotate(${t}deg)`)}return t("div",{...f,"aria-valuenow":l?void 0:i,"aria-valuemin":o,"aria-valuemax":a,"aria-valuetext":l?void 0:v,role:"progressbar",ref:n,className:Tf("progress-circle",u,p,l&&"indeterminate",c),children:[e("div",{className:Tf(p,d,"rounded-full border-4")}),t("div",{className:Tf("fills absolute left-0 top-0 h-full w-full",l&&"progress-circle-fills-animate"),children:[e(LO,{circleSize:p,subMaskStyle:y,isIndeterminate:l,className:"rotate-180",fillColor:h,subMaskClassName:Tf(l&&"progress-circle-fill-submask-1-animate")}),e(LO,{circleSize:p,subMaskStyle:b,isIndeterminate:l,fillColor:h,subMaskClassName:Tf(l&&"progress-circle-fill-submask-2-animate")})]})]})});function LO({subMaskStyle:t,subMaskClassName:r,className:n,circleSize:i,isIndeterminate:o,fillColor:a}){return e("div",{className:Tf("absolute h-full w-1/2 origin-[100%] overflow-hidden",n),children:e("div",{className:Tf("h-full w-full origin-[100%] rotate-180 overflow-hidden",!o&&"transition-transform duration-100",r),style:t,children:e("div",{className:Tf(i,a,"rounded-full border-4")})})})}function NO({isLoading:t,icon:r}){const n=u(null),{trans:i}=gO(),[s,l]=o(!1),{state:{isOpen:c,inputValue:d}}=hS(),h=u(d);return a(()=>{t&&!s?(null===n.current&&(n.current=setTimeout(()=>{l(!0)},500)),d!==h.current&&(clearTimeout(n.current),n.current=setTimeout(()=>{l(!0)},500))):t||(l(!1),clearTimeout(n.current),n.current=null),h.current=d},[t,s,d]),s&&(c||t)?e(RO,{"aria-label":i({message:"Loading"}),size:"sm",isIndeterminate:!0}):r||e(bO,{})}const jO=i.forwardRef(function(r,n){const i=Dk(),{hideCaret:o,placeholder:a=e(Ok,{message:"Select an option..."}),selectedValue:s,onItemSelected:l,onOpenChange:c,onInputValueChange:u,onSelectionChange:d,selectionMode:h,minWidth:f="min-w-128",children:p,searchPlaceholder:g,showEmptyMessage:m,showSearchField:v,defaultInputValue:y,inputValue:b,isLoading:w,isAsync:x,valueClassName:C,floatingWidth:_=(i?"auto":"matchTrigger"),...S}=r,A=DA({...r,clearInputOnItemSelection:!0,showEmptyMessage:m||v,floatingWidth:_,selectionMode:"single",role:"listbox",virtualFocus:v},n),{state:{selectedValues:k,isOpen:E,setIsOpen:I,activeIndex:T,setSelectedIndex:F,inputValue:O,setInputValue:P},collections:M,focusItem:R,listboxId:L,reference:N,refs:j,listContent:D,onInputChange:z}=A,{fieldProps:B,inputProps:U}=mE({...S,focusRef:j.reference}),V=M.collection.get(k[0]),H=V?t("span",{className:"flex items-center gap-10",children:[V.element.props.startIcon,e("span",{className:Tf("overflow-hidden overflow-ellipsis whitespace-nowrap",C),children:V.element.props.children})]}):e("span",{className:"italic",children:a}),W=aE({...r,endAdornment:!0}),{handleTriggerKeyDown:$,handleListboxKeyboardNavigation:q,handleListboxSearchFieldKeydown:G}=Lk(A),{findMatchingItem:Y}=jk();return e(Pk,{listbox:A,onKeyDownCapture:v?void 0:e=>{if(!E)return;const t=Y(e,D,T);null!=t&&R("increment",t)},onKeyDown:q,onClose:v?()=>P(""):void 0,isLoading:w,searchField:v&&e(vE,{size:"xs"===r.size||"sm"===r.size?"xs":"sm",placeholder:g,startAdornment:e(zk,{}),className:"flex-shrink-0 px-8 pb-8 pt-4",autoFocus:!0,"aria-expanded":E?"true":"false","aria-haspopup":"listbox","aria-controls":E?L:void 0,"aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:"false",value:O,onChange:z,onKeyDown:e=>{G(e)}}),children:e(hE,{fieldClassNames:W,...B,endAdornment:!o&&e(NO,{isLoading:w}),children:e("button",{...U,type:"button","data-selected-value":null==V?void 0:V.value,"aria-expanded":E?"true":"false","aria-haspopup":"listbox","aria-controls":E?L:void 0,ref:N,onKeyDown:$,onKeyDownCapture:v?void 0:e=>{if(E)return;const t=Y(e,D,T);null!=t&&F(t)},disabled:S.disabled,onClick:()=>{I(!E)},className:Tf(W.input,!B.unstyled&&f),children:H})})})});function DO(){const t=$m(e=>e.filter.selected);if(!t)return null;const r=Gm().filter.getByName(t).options,n=(e,r)=>{var n;null==(n=Gm().filter)||n.applyValue(t,e,r),qm().setDirty(!0)},i=Gm().canvas.getMainImage().filters,o=Gm().filter.findFilterIndex(t,i),a=null==i?void 0:i[o];if(r){const t=Object.entries(r).map(([t,r])=>{let i;const o=a?a[t]:r.current;return"slider"===r.type?i=e(MO,{label:e("span",{className:"capitalize",children:e(Ok,{...o_[t]})}),minValue:r.min,maxValue:r.max,step:r.step,defaultValue:o,formatOptions:{style:"percent"},size:"sm",onChange:e=>{n(t,e)}}):"colorPicker"===r.type?i=e(CO,{label:e(Ok,{...o_[t]}),size:"sm",width:"w-full",value:o,onChange:e=>{n(t,e)}}):"select"===r.type&&(i=e(jO,{selectionMode:"single",size:"sm",label:e(Ok,{...o_[t]}),defaultValue:o,onSelectionChange:e=>{n(t,e)},children:r.available.map(t=>e(mS,{value:t.key,children:e("span",{className:"capitalize",children:e(Ok,{message:t.key})})},t.key))})),e("div",{className:"pb-10",children:i},t)});return e(ET,{children:e("div",{className:"max-w-240 pt-10 mx-auto",children:t})})}return null}function zO(){const r=$m(e=>e.frame.active),n="basic"===(null==r?void 0:r.mode),i=c(e=>`${e}%`,[]);return e(ET,{className:"pb-18 pt-6",children:t("div",{className:"max-w-288 m-auto",children:[n&&e(CO,{className:"mb-20",width:"w-full",size:"sm",label:e(Ok,{message:"Color"}),value:Gm().frame.builder.defaultColor,onChange:e=>{Gm().frame.active.changeColor(e)}}),e(MO,{size:"sm",label:e(Ok,{message:"Size"}),step:1,minValue:Gm().frame.active.getMinSize(),maxValue:Gm().frame.active.getMaxSize(),defaultValue:Gm().frame.active.currentSizeInPercent,getValueLabel:i,onChange:e=>{Gm().frame.resize(e)}})]})})}const BO=i.createContext(null);function UO(){const{tabsRef:t,selectedTab:r}=l(BO),[n,i]=o({width:void 0,transform:void 0,className:void 0});return iC(()=>{if(null!=r&&t.current){const e=t.current[r];if(!e)return;i(t=>({width:`${e.offsetWidth}px`,transform:`translateX(${e.offsetLeft}px)`,className:void 0===t.width?"":"transition-all"}))}},[i,r,t]),e("div",{className:Tf("absolute bottom-0 left-0 h-2 bg-primary",n.className),role:"presentation",style:{width:n.width,transform:n.transform}})}function VO({children:r,center:n,expand:i,className:o}){const a=m.toArray(r);return e(nk,{children:t("div",{className:Tf("flex relative max-w-full overflow-auto border-b max-sm:hidden-scrollbar md:compact-scrollbar",o),role:"tablist","aria-orientation":"horizontal",children:[a.map((e,t)=>v(e)?w(e,{index:t,className:Tf(e.props.className,i&&"flex-auto",n&&0===t&&"ml-auto",n&&t===a.length-1&&"mr-auto")}):null),e(UO,{})]})})}function HO(t){const{size:r="md",children:n,className:i,isLazy:o,overflow:a="overflow-hidden"}=t,s=u([]),l=b(),[c,h]=EC(t.selectedTab,t.defaultSelectedTab||0,t.onTabChange),f=d(()=>({selectedTab:c,setSelectedTab:h,tabsRef:s,size:r,isLazy:o,id:l}),[c,l,o,h,r]);return e(BO.Provider,{value:f,children:e("div",{className:Tf(i,a,"max-w-full"),children:n})})}const WO=Pf(e("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"}),"FormatUnderlinedOutlined"),$O=Pf(e("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"}),"FormatStrikethroughOutlined"),qO=Pf(e("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),GO=Pf(e("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),YO=Pf(e("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),XO=Pf(e("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined");function KO(){return t("div",{className:"flex gap-20 justify-center",children:[e(ZO,{}),e(QO,{}),e(JO,{})]})}function ZO(){const t=$m(e=>e.objects.active.editableProps.fontSize)??40,{trans:r}=gO();return e(vE,{type:"number",size:"xs","aria-label":r({message:"Font Size"}),min:1,max:300,className:"w-64 flex-shrink-0",value:t,onChange:e=>{Gm().objects.setValues({fontSize:e.target.valueAsNumber}),qm().setDirty(!0)}})}function QO(){const r=$m(e=>e.objects.active.editableProps.fontStyle),n=$m(e=>e.objects.active.editableProps.underline),i=$m(e=>e.objects.active.editableProps.linethrough),[a,s]=o([r,n&&"underline",i&&"linethrough"]);return t(EE,{size:"xs",variant:"outline",radius:"rounded",value:a,multiple:!0,onChange:e=>{s(e),Gm().objects.setValues({underline:e.includes("underline"),linethrough:e.includes("linethrough"),fontStyle:e.includes("italic")?"italic":""}),qm().setDirty(!0)},children:[e(xE,{value:"underline",children:e(WO,{})}),e(xE,{value:"linethrough",children:e($O,{})}),e(xE,{value:"italic",children:e(qO,{})})]})}function JO(){const r=$m(e=>e.objects.active.editableProps.textAlign);return t(EE,{size:"xs",variant:"outline",radius:"rounded",value:r,onChange:e=>{Gm().objects.setValues({textAlign:e}),qm().setDirty(!0)},children:[e(xE,{value:"left",children:e(YO,{})}),e(xE,{value:"center",children:e(XO,{})}),e(xE,{value:"right",children:e(GO,{})})]})}function eP({children:t,className:r}){const{selectedTab:n,isLazy:i}=l(BO),o=m.toArray(t).filter(e=>!!e);let a;if(i){const e=o[n];a=v(e)?w(o[n],{index:n}):null}else a=o.map((e,t)=>{if(v(e)){const r=t===n;return w(e,{index:t,"aria-hidden":!r,className:r?e.props.className:Tf(e.props.className,"hidden")})}return null});return e("div",{className:r,children:a})}function tP({className:t,children:r,index:n,...i}){const{id:a}=l(BO),[s,c]=o(0),d=u(null);return iC(()=>{if(null!=d&&d.current){const e=()=>{const e=gk(d.current,{tabbable:!0});c(e.nextNode()?void 0:0)};e();const t=new MutationObserver(e);return t.observe(d.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{t.disconnect()}}},[d]),e("div",{tabIndex:s,ref:d,id:`${a}-${n}-tabpanel`,"aria-labelledby":`${a}-${n}-tab`,className:Tf(t,"focus-visible:outline-primary-light"),role:"tabpanel",...i,children:r})}const rP=[{type:"linear",coords:{x1:-80,y1:0,x2:80,y2:0},colorStops:[{color:"#ffe47b",offset:0},{color:"rgb(111,154,211)",offset:1}]},{type:"linear",coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{color:"#ff4040",offset:0},{color:"#e6399b",offset:1}]},{type:"linear",coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:"rgb(166,111,213)"},{offset:.5,color:"rgba(106, 72, 215, 0.5)"},{offset:1,color:"#200772"}]},{type:"radial",coords:{r1:100,r2:10,x1:0,y1:0,x2:0,y2:0},colorStops:[{offset:0,color:"#FF4F4F"},{offset:1,color:"rgb(255, 239, 64)"}]},{type:"radial",coords:{r1:100,r2:10,x1:0,y1:0,x2:20,y2:20},colorStops:[{offset:0,color:"#ffe47b"},{offset:.5,color:"rgb(111,154,211)"},{offset:1,color:"rgb(166,111,213)"}]},{type:"radial",coords:{r1:50,r2:80,x1:45,y1:45,x2:52,y2:50},colorStops:[{offset:0,color:"rgb(155, 237, 0)"},{offset:1,color:"rgba(0, 164, 128,0.4)"}]},{type:"linear",coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:"#9ecb2d"},{offset:.5,color:"#72aa00"},{offset:1,color:"#bfd255"}]},{type:"radial",coords:{r1:100,r2:50,x1:30,y1:0,x2:0,y2:0},colorStops:[{offset:0,color:"#aebcbf"},{offset:1,color:"#0a0809"}]},{type:"linear",coords:{x1:-80,y1:0,x2:80,y2:0},colorStops:[{offset:0,color:"#ffffff"},{offset:1,color:"#f6f6f6"}]},{type:"linear",coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{offset:0,color:"#fefcea"},{offset:1,color:"#f1da36"}]},{type:"linear",coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:"rgb(166,111,213)"},{offset:.5,color:"rgba(106, 72, 215, 0.5)"},{offset:1,color:"#ff1a00"}]},{type:"linear",coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{offset:0,color:"#b7deed"},{offset:1,color:"#21b4e2"}]},{type:"linear",coords:{x1:-80,y1:100,x2:80,y2:-100},colorStops:[{offset:0,color:"#ffe47b"},{offset:1,color:"rgb(111,154,211)"}]}],nP=Pf(e("path",{d:"M19.51 3.08 3.08 19.51c.09.34.27.65.51.9.25.24.56.42.9.51L20.93 4.49c-.19-.69-.73-1.23-1.42-1.41zM11.88 3 3 11.88v2.83L14.71 3h-2.83zM5 3c-1.1 0-2 .9-2 2v2l4-4H5zm14 18c.55 0 1.05-.22 1.41-.59.37-.36.59-.86.59-1.41v-2l-4 4h2zm-9.71 0h2.83L21 12.12V9.29L9.29 21z"}),"TextureOutlined"),iP=Pf(e("path",{d:"M11 9h2v2h-2V9zm-2 2h2v2H9v-2zm4 0h2v2h-2v-2zm2-2h2v2h-2V9zM7 9h2v2H7V9zm12-6H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 18H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm2-7h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H9v-2H7v2H5v-2h2v-2H5V5h14v6z"}),"GradientOutlined"),oP=Pf(e("path",{d:"M18 20H4V6h9V4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2v9zm-7.79-3.17-1.96-2.36L5.5 18h11l-3.54-4.71zM20 4V1h-2v3h-3c.01.01 0 2 0 2h3v2.99c.01.01 2 0 2 0V6h3V4h-3z"}),"AddPhotoAlternateOutlined");function aP({property:r}){const{trans:n}=gO(),i=$m(e=>e.objects.active.editableProps[r]);return t("div",{className:"flex items-center justify-center gap-14",children:[e(CO,{className:"flex-shrink-0",size:"xs","aria-label":n({message:"Color"}),value:"string"==typeof i?i:_f.fill,onChange:e=>{Gm().objects.setValues({[r]:e}),qm().setDirty(!0)}}),e(sP,{type:"gradient",property:r}),e(sP,{type:"texture",property:r})]})}function sP({type:r,property:n}){return e(y,{children:t(xO,{type:"popover",children:[e(cS,{className:"flex-shrink-0",id:`${r}-panel-trigger`,variant:"outline",size:"xs",startIcon:e("texture"===r?nP:iP,{}),endIcon:e(bO,{}),children:e("span",{className:"capitalize",children:e(Ok,"gradient"===r?{message:"Gradient"}:{message:"Texture"})})}),e(yO,{size:"auto",children:e("div",{className:"grid gap-8 grid-cols-5-min-content p-10 bg-paper rounded shadow-md",children:e(lP,{property:n,type:r})})})]})})}function lP({type:t,property:r}){const{close:n}=pO(),i=Array.from(Array("gradient"===t?rP.length:28).keys()),o="w-56 h-56 bg border shadow-sm hover:scale-110",a=i.map(i=>{const a=KC(`images/${t}s/${i}.png`);return e(lS,{radius:"rounded",className:o,style:{backgroundImage:`url(${a})`},"aria-label":`Select ${t} #${i}`,onClick:async()=>{n();const e="gradient"===t?new OC.fabric.Gradient(rP[i]):await uP(a);Gm().objects.setValues({[r]:e}),qm().setDirty(!0)}},i)});return"texture"===t&&a.unshift(e(cP,{property:r,className:o},"upload-btn")),e(y,{children:a})}function cP({className:t,property:r}){const{close:n}=pO();return e(lS,{radius:"rounded",className:t,"aria-label":"Upload an image",onClick:async()=>{const e=await Gm().import.openUploadWindow();if(n(),e){const t=await uP(await e.data);Gm().objects.setValues({[r]:t})}},children:e(oP,{className:"icon-md"})})}function uP(e){return new Promise(t=>{OC.fabric.util.loadImage(e,e=>{const r=new OC.fabric.Pattern({source:e,repeat:"repeat"});t(r)})})}function dP(){const t=$m(e=>e.objects.active.editableProps.opacity);return e(MO,{className:"max-w-240 w-full mx-auto","aria-label":"Opacity",value:t,minValue:.1,step:.1,maxValue:1,onChange:e=>{Gm().objects.setValues({opacity:e}),qm().setDirty(!0)}})}function hP(){const{trans:r}=gO(),n=$m(e=>e.objects.active.editableProps.stroke),i=$m(e=>e.objects.active.editableProps.strokeWidth);return t("div",{className:"flex items-center gap-40",children:[e(CO,{className:"ml-auto flex-shrink-0",size:"xs",value:n,"aria-label":r({message:"Outline Color"}),onChange:e=>{Gm().objects.setValues({stroke:e}),qm().setDirty(!0)}}),e(MO,{"aria-label":"Outline Width",className:"max-w-240 mr-auto flex-shrink-0",value:i,onChange:e=>{Gm().objects.setValues({strokeWidth:e}),qm().setDirty(!0)}})]})}const fP=Pf(e("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}),"ImageOutlined");function pP(){return e("div",{className:"flex justify-center",children:e(cS,{type:"button",variant:"outline",size:"xs",startIcon:e(fP,{}),radius:"rounded-full",onClick:async()=>{const e=await Gm().import.openUploadWindow();if(e){const t=Gm().objects.getActive();if(t&&"setSrc"in t){const r=await e.data;t.setSrc(r,()=>{VC({src:r}),Gm().canvas.render()})}}},children:e(Ok,{message:"Replace Image"})})})}const gP={color:"rgba(0, 0, 0, 0.6)",blur:3,offsetX:-1,offsetY:0};function mP(){const{trans:r}=gO(),n=$m(e=>e.objects.active.editableProps.shadow)||gP;return t("div",{className:"flex items-center gap-40",children:[e(CO,{className:"ml-auto flex-shrink-0",value:n.color,size:"xs","aria-label":r({message:"Shadow Color"}),onChange:e=>{Gm().objects.setValues({shadow:vP({color:e})}),qm().setDirty(!0)}}),e(MO,{"aria-label":"Shadow Blur",className:"max-w-240 mr-auto flex-shrink-0",defaultValue:n.blur,onChange:e=>{Gm().objects.setValues({shadow:vP({blur:e})}),qm().setDirty(!0)}})]})}function vP(e){var t;const r=null==(t=Gm().objects.getActive())?void 0:t.shadow;return r?(Object.entries(e).forEach(([e,t])=>{r[e]=t}),r):new OC.fabric.Shadow({...gP,...e})}function yP({index:t,className:r,isDisabled:n,children:i,padding:o,elementType:a="button",to:s,relative:c,width:u="min-w-min"}){const{selectedTab:d,setSelectedTab:h,tabsRef:f,size:p="md",id:g}=l(BO),m=t===d,v=function(){var e;return null===(e=l(tk))||void 0===e?void 0:e.focusManager}(),y=o||("sm"===p?"px-12":"px-18"),b=Tf("tracking-wide overflow-hidden capitalize text-sm flex items-center justify-center outline-none transition-colors","focus-visible:ring focus-visible:ring-2 ring-inset rounded whitespace-nowrap cursor-pointer",u,function({isDisabled:e,isSelected:t}){return e?"text-disabled cursor-default":t?"text-primary":"text-muted hover:text-main"}({isDisabled:n,isSelected:m}),r,"md"===p&&`${y} h-48`,"sm"===p&&`${y} h-32`,n&&"pointer-events-none");return e(a,{disabled:n,id:`${g}-${t}-tab`,"aria-controls":`${g}-${t}-tabpanel`,type:"button",role:"tab","aria-selected":m,tabIndex:n?void 0:m?0:-1,onKeyDown:e=>{switch(e.key){case"ArrowLeft":null==v||v.focusPrevious();break;case"ArrowRight":null==v||v.focusNext();break;case"Home":null==v||v.focusFirst();break;case"End":null==v||v.focusLast()}},onClick:()=>{h(t)},to:s,relative:c,className:b,ref:e=>{f.current&&e&&(f.current[t]=e)},children:i})}function bP(){const r=$m(e=>e.objects.active);return t(HO,{size:"sm",className:"pb-18 pt-6",children:[t(VO,{center:!0,children:[r.isText&&e(yP,{children:e(Ok,{message:"Font"})}),!r.isImage&&e(yP,{children:e(Ok,{message:"Color"})}),!r.isImage&&e(yP,{children:e(Ok,{message:"Background"})}),r.isImage&&e(yP,{children:e(Ok,{message:"Image"})}),e(yP,{children:e(Ok,{message:"Opacity"})}),e(yP,{children:e(Ok,{message:"Outline"})}),e(yP,{children:e(Ok,{message:"Shadow"})})]}),t(eP,{className:"pt-16 h-50",children:[r.isText&&e(tP,{children:e(KO,{})},"font"),!r.isImage&&e(tP,{children:e(aP,{property:"fill"})}),!r.isImage&&e(tP,{children:e(aP,{property:"backgroundColor"})}),r.isImage&&e(tP,{children:e(pP,{})}),e(tP,{children:e(dP,{})}),e(tP,{children:e(hP,{})}),e(tP,{children:e(mP,{})})]})]})}function wP(){const t=!Dk()&&e(cS,{size:"sm",color:"primary",variant:"outline",onClick:()=>{Gm().text.add(),qm().setDirty(!0)},children:e(Ok,{message:"New Text"})});return e(ET,{actionBtn:t,children:e(bP,{})})}const xP=Pf(e("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownwardOutlined"),CP={};let _P=!1,SP=null,AP=null;const kP=e=>{var t;for(const r in CP)r!==e&&(null==(t=CP[r])||t.call(CP,!0),delete CP[r])},EP=p(({children:r,label:n,placement:i="top",offset:s=10,variant:l="neutral",delay:d=1500,isDisabled:h,usePortal:f=!0,...p},g)=>{const{x:m,y:v,reference:x,strategy:C,arrowRef:_,arrowStyle:S,refs:A}=jA({placement:i,offset:s,ref:g,showArrow:!0}),[k,E]=o(!1),I=b(),T=u(),F=()=>{clearTimeout(T.current),T.current=void 0,kP(I),CP[I]=O,_P=!0,E(!0),SP&&(clearTimeout(SP),SP=null),AP&&(clearTimeout(AP),AP=null)},O=c(e=>{e?(clearTimeout(T.current),T.current=void 0,E(!1)):T.current||(T.current=setTimeout(()=>{T.current=void 0,E(!1)},500)),SP&&(clearTimeout(SP),SP=null),_P&&(AP&&clearTimeout(AP),AP=setTimeout(()=>{delete CP[I],AP=null,_P=!1},500))},[I]),P=e=>{!e&&d>0&&!T.current?(kP(I),CP[I]=O,k||SP||_P?k||F():SP=setTimeout(()=>{SP=null,_P=!0,F()},d)):F()};a(()=>()=>{clearTimeout(T.current),CP[I]&&delete CP[I]},[I]),a(()=>{const e=e=>{"Escape"===e.key&&O(!0)};if(k)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[k,O]);const M=e(eC,{children:k&&t(Gx.div,{...wk,ref:A.setFloating,id:I,role:"tooltip",onPointerEnter:()=>{P(!0)},onPointerLeave:()=>{O()},className:Tf("z-tooltip my-4 max-w-240 break-words rounded px-8 py-4 text-xs text-white shadow","positive"===l&&"bg-positive","danger"===l&&"bg-danger","neutral"===l&&"bg-toast"),style:{position:C,top:v??"",left:m??""},children:[e("div",{ref:_,className:"absolute h-8 w-8 rotate-45 bg-inherit",style:S}),n]})});return t(y,{children:[w(r,gC({"aria-describedby":k?I:void 0,ref:x,onPointerEnter:e=>{"mouse"===e.pointerType&&P()},onFocus:e=>{e.target.matches(":focus-visible")&&P(!0)},onPointerLeave:e=>{"mouse"===e.pointerType&&O()},onPointerDown:()=>{O(!0)},onBlur:()=>{O()},"aria-label":"string"==typeof n?n:n.props.message},p)),f?Dm&&ke(M,Dm):M]})});function IP(){const r=$m(e=>e.activeToolOverlay),n=$m(e=>e.objects.active.id),i=function(t,r){switch(t){case Mg.Filter:return e(DO,{});case Mg.Frame:return e(zO,{});case Mg.Text:return r&&e(wP,{});case Mg.ActiveObject:return r&&e(bP,{});default:return null}}(r,n),[a,s]=o(!0);return t("div",{className:"relative z-tool-overlay text-sm",children:[i&&e("div",{className:Tf("absolute right-16 text-muted z-50 transition-all",!a&&"rotate-180",a?"-top-144":"-top-40"),children:e(EP,{label:e(Ok,a?{message:"Hide options"}:{message:"Show options"}),children:e(xE,{variant:"outline",radius:"rounded-lg",size:"xs",onClick:()=>{s(!a)},children:e(xP,{})})})}),e(eC,{children:i&&a&&e(Gx.div,{initial:{y:0,opacity:0},animate:{y:"-100%",opacity:1},exit:{y:0,opacity:0},transition:{type:"tween",duration:.15},className:"absolute inset-x-0 gap-16 px-5vw bg bg-opacity-95 border-t",children:i},"tool-controls-overlay")})]})}const TP=Pf(e("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 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 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined");function FP({filter:r}){const n=$m(e=>e.filter.applied.includes(r)),i=Gm().filter.hasOptions(r),o=Tf("block flex-shrink-0 rounded",{"text-primary border-primary":n}),a=i_[r],s=t(y,{children:[t("div",{className:"relative",children:[e(OP,{filter:r}),n&&e(PP,{filter:r,hasOptions:i})]}),e("div",{className:"mt-4 text-center text-xs capitalize",children:a?e(Ok,{...a}):r})]});return n&&i?e("div",{className:o,children:s}):e(lS,{className:o,onClick:()=>{n?Gm().filter.remove(r):Gm().filter.apply(r)},children:s})}function OP({filter:t}){const r=$m(e=>e.filter.selected===t),n=Tf("m-auto w-96 h-56 border rounded object-cover",{shadow:r});return e("img",{src:KC(`images/filter/${t}.jpg`),className:n,alt:""})}function PP({filter:r,hasOptions:n}){return t("div",{className:"flex items-center justify-center bg-background/70 absolute inset-0 border-2 border-primary rounded",children:[n?e(xE,{color:"primary",size:"md",onClick:()=>{Gm().filter.remove(r)},children:e(TP,{})}):e(TP,{className:"svg-icon icon-md"}),n&&e(MP,{filter:r,hasOptions:n})]})}function MP({filter:t,hasOptions:r}){return e(xE,{color:"primary",size:"md",onClick:()=>{qm().activeToolOverlay===Mg.Filter&&qm().filter.selected===t?qm().setActiveTool(qm().activeTool,null):qm().filter.select(t,r)},children:e(Lf,{})})}const RP=p(({children:t,className:r,gap:n="gap-10"},o)=>{const a=i.Children.map(t,(e,r)=>i.isValidElement(e)?i.cloneElement(e,{isFirst:0===r,isLast:i.Children.count(t)===r+1}):e);return e("div",{ref:o,className:Tf("tiny-scrollbar pb-4 overflow-x-auto relative flex items-center",n,r),children:a})});function LP({isFirst:t,isLast:r,children:n,className:i}){const o=Tf(i,"flex-shrink-0",{"ml-auto":t,"mr-auto":r});return e("div",{className:o,children:n})}function NP(){const t=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.filter)?void 0:r.items})||[];a(()=>{Gm().filter.syncState()},[]);const r=t.map(t=>e(LP,{children:e(FP,{filter:t})},t));return e(RP,{children:r})}const jP=Pf(e("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"}),"LockOutlined"),DP=Pf(e("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h2c0-1.66 1.34-3 3-3s3 1.34 3 3v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm0 12H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"}),"LockOpenOutlined"),zP=Pf(e("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlankOutlined"),BP=Pf(e("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),UP=Pf(e("path",{d:"M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M17,13H7v-2h10V13z"}),"CheckBox"),VP=p((r,n)=>{const{size:i="md",children:o,className:s,icon:l,checkedIcon:u,disabled:d,isIndeterminate:h,errorMessage:f,invalid:p,orientation:g="horizontal",onChange:m,autoFocus:v,required:y,value:b,name:w,inputTestId:x}=r,C=aE({...r,label:o}),_=l||zP,S=u||(h?UP:BP),A=SC(n);gE({autoFocus:v},A),a(()=>{A.current&&(A.current.indeterminate=h||!1)});const[k,E]=EC(r.checked,r.defaultChecked||!1),I=c(e=>{null==m||m(e),E(e.target.checked)},[m,E]),T=Tf("select-none",s,p&&"text-danger",!p&&d&&"text-disabled");let F,O=p?"text-danger":null;return h?(F=UP,O=O||"text-primary"):k?(F=S,O=O||"text-primary"):(F=_,O=O||"text-muted"),t("div",{children:[e("label",{className:T,children:t("div",{className:Tf("relative flex items-center","vertical"===g&&"flex-col flex-col-reverse"),children:[e("input",{className:"absolute left-0 top-0 h-24 w-24 appearance-none overflow-hidden rounded outline-none ring-inset transition-shadow focus-visible:ring",type:"checkbox","aria-checked":h?"mixed":k,"aria-invalid":p||void 0,onChange:I,ref:A,required:y,disabled:d,value:b,name:w,"data-testid":x}),e(F,{size:i,className:Tf("pointer-events-none",d?"text-disabled":O)}),o&&e("div",{className:Tf("first-letter:capitalize",C.size.font,"vertical"===g?"mb-6":"ml-6"),children:o})]})}),f&&e("div",{className:C.error,children:f})]})});function HP(){const{trans:r}=gO(),{minWidth:n=50,minHeight:i=50,maxHeight:o=2400,maxWidth:s=2400}=$m(e=>{var t;return null==(t=e.config.tools)?void 0:t.resize})||{},l=$m(e=>e.original),c=$m(e=>e.resize.formValue);a(()=>{qm().resize.setFormValue({...l})},[l]),a(()=>{qm().setDirty(!0)},[]);return t("form",{className:"flex items-center justify-center gap-16 w-full",onSubmit:e=>{e.preventDefault(),qm().applyChanges()},children:[e(vE,{type:"number",min:n,max:s,size:"sm",className:"w-full max-w-112",label:e(Ok,{message:"Width"}),value:c.width,onChange:e=>{(e=>{const t={...c,width:e};c.maintainAspect&&(t.height=f_(e,c.usePercentages)),qm().resize.setFormValue(t)})(e.target.valueAsNumber)}}),e("div",{className:"mt-24",children:e(VP,{size:"md",checked:c.maintainAspect,onChange:e=>{(e=>{const t={...c,maintainAspect:e};e&&(t.height=f_(t.width,t.usePercentages)),qm().resize.setFormValue(t)})(!c.maintainAspect)},"aria-label":r({message:"Maintain aspect ratio"}),checkedIcon:jP,icon:DP})}),e(vE,{type:"number",min:i,max:o,size:"sm",className:"w-full max-w-112",label:e(Ok,{message:"Height"}),value:c.height,onChange:e=>{(e=>{const t={...c,height:e};e&&c.maintainAspect&&(t.width=h_(e,c.usePercentages)),qm().resize.setFormValue(t)})(e.target.valueAsNumber)}}),e("button",{type:"submit",className:"hidden",children:e(Ok,{message:"Resize"})})]})}function WP(){const r=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.crop)?void 0:r.presets})||[],n=$m(e=>e.crop.selectedAspectRatio),i=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.crop)?void 0:r.allowCustomRatio})??!0,o=r.filter(e=>e.ratio||!e.ratio&&i).map(r=>e(LP,{children:t(lS,{onClick:()=>Gm().crop.resetCropzone(r.ratio),className:"flex flex-col items-center justify-between cursor-pointer h-56",children:[e($P,{preset:r,selectedRatio:n}),e(qP,{preset:r,selectedRatio:n})]})},r.ratio||r.name));return e(RP,{gap:"gap-18",children:o})}function $P({preset:t,selectedRatio:r}){let n=40,i=30;if(t.ratio){const e=v_(t.ratio);({width:n,height:i}=m_(e,n,i))}const o=Tf("border-2",{"border-dotted":null===t.ratio,"border-primary":r===t.ratio});return e("div",{style:{width:`${n}px`,height:`${i}px`},className:o})}function qP({preset:t,selectedRatio:r}){const n=Tf("mt-4 text-center text-xs",{"text-primary":r===t.ratio});return e("div",{className:n,children:t.name?e(Ok,{message:t.name}):t.ratio})}const GP=Pf(e("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}),"FlipOutlined");function YP(){return t("div",{children:[e(xE,{size:"sm",onClick:()=>{Gm().transform.flip("vertical"),qm().setDirty(!0)},children:e(GP,{})}),e(xE,{size:"sm",onClick:()=>{Gm().transform.flip("horizontal"),qm().setDirty(!0)},children:e(GP,{className:"rotate-90"})})]})}const XP=Pf(e("path",{d:"M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z"}),"RotateLeftOutlined"),KP=Pf(e("path",{d:"M15.55 5.55 11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42 1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z"}),"RotateRightOutlined");function ZP(){return t("div",{children:[e(xE,{size:"sm",onClick:()=>{Gm().transform.rotateLeft(),qm().setDirty(!0)},children:e(XP,{})}),e(xE,{size:"sm",onClick:()=>{Gm().transform.rotateRight(),qm().setDirty(!0)},children:e(KP,{})})]})}function QP(){return t("div",{className:"flex items-center justify-center gap-16",children:[e(YP,{}),e(JP,{}),e(ZP,{})]})}function JP(){const r=u(null),{domProps:n,groupId:i,thumbIds:o,trackRef:a,getThumbValueLabel:s}=FO({minValue:-45,maxValue:45,step:1,defaultValue:[qm().crop.straightenAngle],onChange:e=>{const t=e[0];Gm().transform.straighten(t),qm().crop.setTransformAngle(t),qm().setDirty(!0),r.current.style.transform=`translateX(${t}px)`}});return e("div",{id:i,role:"group",className:"flex-auto flex-shrink-0 max-w-320 touch-none isolate",children:t("div",{...n,ref:a,className:"h-36 relative",children:[t("output",{htmlFor:o[0],"aria-live":"off",className:"absolute left-1/2 top-1/2 w-40 text-center bg -translate-x-1/2 -translate-y-1/2 z-10",children:[s(0),"°"]}),e(eM,{ref:r})]})})}const eM=i.forwardRef((t,r)=>{const n=[...Array(80).keys()],i=n.map(t=>e("circle",{cx:2+10*t,cy:"20",r:t%5?.75:2},t));return e("div",{className:"relative h-full cursor-pointer overflow-hidden",children:e("svg",{ref:r,style:{width:10*n.length},className:"absolute -left-80 h-full fill-current",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:i})})});function tM(){return a(()=>(qm().setDirty(!0),Gm().frame.active.hide(),()=>{Gm().frame.active.show()}),[]),t("div",{className:"pb-16",children:[e("div",{className:"mb-10",children:e(QP,{})}),e(WP,{})]})}const rM=Pf(e("path",{d:"M 16 6 C 12.484375 6 9.273438 7.070313 6.90625 8.84375 C 4.539063 10.617188 3 13.15625 3 16 C 3 18.84375 4.539063 21.382813 6.90625 23.15625 C 9.273438 24.929688 12.484375 26 16 26 C 19.515625 26 22.726563 24.929688 25.09375 23.15625 C 27.460938 21.382813 29 18.84375 29 16 C 29 13.15625 27.460938 10.617188 25.09375 8.84375 C 22.726563 7.070313 19.515625 6 16 6 Z M 16 8 C 19.109375 8 21.898438 8.957031 23.875 10.4375 C 25.851563 11.917969 27 13.875 27 16 C 27 18.125 25.851563 20.082031 23.875 21.5625 C 21.898438 23.042969 19.109375 24 16 24 C 12.890625 24 10.101563 23.042969 8.125 21.5625 C 6.148438 20.082031 5 18.125 5 16 C 5 13.875 6.148438 11.917969 8.125 10.4375 C 10.101563 8.957031 12.890625 8 16 8 Z "})),nM=Pf(e("path",{d:"M 16 4 C 9.382813 4 4 9.382813 4 16 C 4 22.617188 9.382813 28 16 28 C 22.617188 28 28 22.617188 28 16 C 28 9.382813 22.617188 4 16 4 Z M 16 6 C 21.535156 6 26 10.464844 26 16 C 26 21.535156 21.535156 26 16 26 C 10.464844 26 6 21.535156 6 16 C 6 10.464844 10.464844 6 16 6 Z "})),iM=Pf(e("path",{d:"M 3 6 L 3 26 L 29 26 L 29 6 Z M 5 8 L 27 8 L 27 24 L 5 24 Z "})),oM=Pf(e("path",{d:"M 16 4.90625 L 15.125 6.40625 L 4.71875 24.5 L 3.875 26 L 28.125 26 L 27.28125 24.5 L 16.875 6.40625 Z M 16 8.9375 L 24.65625 24 L 7.34375 24 Z "}));function aM(){const t=($m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.shapes)?void 0:r.items})||[]).map(t=>e(LP,{children:e(xE,{variant:"outline",radius:"rounded-2xl",size:"xl",onClick:()=>{Gm().shape.addBasicShape(t.name),qm().setDirty(!0)},children:e(sM,{shape:t})})},t.name));return e(RP,{children:t})}function sM({shape:t}){var r;return"Path"===t.type?e("svg",{className:"m-auto w-36 h-36",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -100 512 700",children:e("path",{className:"fill-transparent stroke-current",d:null==(r=t.options)?void 0:r.path,strokeWidth:25})}):i.cloneElement(lM[t.name],{className:"w-30 h-30"})}const lM={circle:e(nM,{viewBox:"0 0 32 32"}),square:e(iM,{viewBox:"0 0 32 32"}),triangle:e(oM,{viewBox:"0 0 32 32"}),ellipse:e(rM,{viewBox:"0 0 32 32"})};function cM(e,t,r){let n,i=r.initialDeps??[];return()=>{var o,a,s,l;let c;r.key&&null!=(o=r.debug)&&o.call(r)&&(c=Date.now());const u=e();if(u.length===i.length&&!u.some((e,t)=>i[t]!==e))return n;let d;if(i=u,r.key&&null!=(a=r.debug)&&a.call(r)&&(d=Date.now()),n=t(...u),r.key&&null!=(s=r.debug)&&s.call(r)){const e=Math.round(100*(Date.now()-c))/100,t=Math.round(100*(Date.now()-d))/100,n=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*n,120))}deg 100% 31%);`,null==r?void 0:r.key)}return null==(l=null==r?void 0:r.onChange)||l.call(r,n),n}}function uM(e,t){if(void 0===e)throw new Error("Unexpected undefined");return e}const dM=(e,t,r)=>{let n;return function(...i){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,i),r)}},hM=e=>e,fM=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1),n=[];for(let e=t;e<=r;e++)n.push(e);return n},pM=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;const i=e=>{const{width:r,height:n}=e;t({width:Math.round(r),height:Math.round(n)})};if(i(r.getBoundingClientRect()),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(e=>{const t=e[0];if(null!=t&&t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void i({width:e.inlineSize,height:e.blockSize})}i(r.getBoundingClientRect())});return o.observe(r,{box:"border-box"}),()=>{o.unobserve(r)}},gM={passive:!0},mM=typeof window>"u"||"onscrollend"in window,vM=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;let i=0;const o=mM?()=>{}:dM(n,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=n=>()=>{i=r[e.options.horizontal?"scrollLeft":"scrollTop"],o(),t(i,n)},s=a(!0),l=a(!1);return l(),r.addEventListener("scroll",s,gM),r.addEventListener("scrollend",l,gM),()=>{r.removeEventListener("scroll",s),r.removeEventListener("scrollend",l)}},yM=(e,t,r)=>{if(null!=t&&t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return Math.round(e[r.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[r.options.horizontal?"width":"height"])},bM=(e,{adjustments:t=0,behavior:r},n)=>{var i,o;const a=e+t;null==(o=null==(i=n.scrollElement)?void 0:i.scrollTo)||o.call(i,{[n.options.horizontal?"left":"top"]:a,behavior:r})};class wM{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{this._measureElement(e.target,e)})}):null);return{disconnect:()=>{var e;return null==(e=t())?void 0:e.disconnect()},observe:e=>{var r;return null==(r=t())?void 0:r.observe(e,{box:"border-box"})},unobserve:e=>{var r;return null==(r=t())?void 0:r.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,r])=>{typeof r>"u"&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:hM,rangeExtractor:fM,onChange:()=>{},measureElement:yM,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,...e}},this.notify=(e,t)=>{var r,n;const{startIndex:i,endIndex:o}=this.range??{startIndex:void 0,endIndex:void 0},a=this.calculateRange();(e||i!==(null==a?void 0:a.startIndex)||o!==(null==a?void 0:a.endIndex))&&(null==(n=(r=this.options).onChange)||n.call(r,this,t))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.scrollElement=null},this._didMount=()=>(this.measureElementCache.forEach(this.observer.observe),()=>{this.observer.disconnect(),this.cleanup()}),this._willUpdate=()=>{var e;const t=this.options.getScrollElement();this.scrollElement!==t&&(this.cleanup(),this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this._scrollToOffset(this.scrollOffset,{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.scrollOffset<e?"forward":"backward":null,this.scrollOffset=e;const r=this.isScrolling;this.isScrolling=t,this.notify(r!==t,t)})))},this.getSize=()=>this.scrollRect[this.options.horizontal?"width":"height"],this.getMeasurementOptions=cM(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey],(e,t,r,n)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:r,getItemKey:n}),{key:!1}),this.getFurthestMeasurement=(e,t)=>{const r=new Map,n=new Map;for(let i=t-1;i>=0;i--){const t=e[i];if(r.has(t.lane))continue;const o=n.get(t.lane);if(null==o||t.end>o.end?n.set(t.lane,t):t.end<o.end&&r.set(t.lane,!0),r.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurements=cM(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:r,getItemKey:n},i)=>{const o=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const a=this.measurementsCache.slice(0,o);for(let s=o;s<e;s++){const e=n(s),o=1===this.options.lanes?a[s-1]:this.getFurthestMeasurement(a,s),l=o?o.end+this.options.gap:t+r,c=i.get(e),u="number"==typeof c?c:this.options.estimateSize(s),d=l+u,h=o?o.lane:s%this.options.lanes;a[s]={index:s,start:l,size:u,end:d,key:e,lane:h}}return this.measurementsCache=a,a},{key:!1,debug:()=>this.options.debug}),this.calculateRange=cM(()=>[this.getMeasurements(),this.getSize(),this.scrollOffset],(e,t,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:r}){const n=e.length-1,i=xM(0,n,t=>e[t].start,r);let o=i;for(;o<n&&e[o].end<r+t;)o++;return{startIndex:i,endIndex:o}}({measurements:e,outerSize:t,scrollOffset:r}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=cM(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(e,t,r,n)=>null===t?[]:e({startIndex:t.startIndex,endIndex:t.endIndex,overscan:r,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,r=e.getAttribute(t);return r?parseInt(r,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const r=this.measurementsCache[this.indexFromElement(e)];if(!r||!e.isConnected)return void this.measureElementCache.forEach((t,r)=>{t===e&&(this.observer.unobserve(e),this.measureElementCache.delete(r))});const n=this.measureElementCache.get(r.key);n!==e&&(n&&this.observer.unobserve(n),this.observer.observe(e),this.measureElementCache.set(r.key,e));const i=this.options.measureElement(e,t,this);this.resizeItem(r,i)},this.resizeItem=(e,t)=>{const r=t-(this.itemSizeCache.get(e.key)??e.size);0!==r&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(e,r,this):e.start<this.scrollOffset+this.scrollAdjustments)&&this._scrollToOffset(this.scrollOffset,{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(e.index),this.itemSizeCache=new Map(this.itemSizeCache.set(e.key,t)),this.notify(!0,!1))},this.measureElement=e=>{e&&this._measureElement(e,void 0)},this.getVirtualItems=cM(()=>[this.getIndexes(),this.getMeasurements()],(e,t)=>{const r=[];for(let n=0,i=e.length;n<i;n++){const i=t[e[n]];r.push(i)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();return uM(t[xM(0,t.length-1,e=>uM(t[e]).start,e)])},this.getOffsetForAlignment=(e,t)=>{const r=this.getSize();"auto"===t&&(t=e<=this.scrollOffset?"start":e>=this.scrollOffset+r?"end":"start"),"start"===t||("end"===t?e-=r:"center"===t&&(e-=r/2));const n=this.options.horizontal?"scrollWidth":"scrollHeight",i=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[n]:this.scrollElement[n]:0)-this.getSize();return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const r=uM(this.getMeasurements()[e]);if("auto"===t)if(r.end>=this.scrollOffset+this.getSize()-this.options.scrollPaddingEnd)t="end";else{if(!(r.start<=this.scrollOffset+this.options.scrollPaddingStart))return[this.scrollOffset,t];t="start"}const n="end"===t?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(n,t),t]},this.isDynamicMode=()=>this.measureElementCache.size>0,this.cancelScrollToIndex=()=>{null!==this.scrollToIndexTimeoutId&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(e,{align:t="start",behavior:r}={})=>{this.cancelScrollToIndex(),"smooth"===r&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:r})},this.scrollToIndex=(e,{align:t="auto",behavior:r}={})=>{e=Math.max(0,Math.min(e,this.options.count-1)),this.cancelScrollToIndex(),"smooth"===r&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const[n,i]=this.getOffsetForIndex(e,t);this._scrollToOffset(n,{adjustments:void 0,behavior:r}),"smooth"!==r&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.measureElementCache.has(this.options.getItemKey(e))){const[t]=this.getOffsetForIndex(e,i);((e,t)=>Math.abs(e-t)<1)(t,this.scrollOffset)||this.scrollToIndex(e,{align:i,behavior:r})}else this.scrollToIndex(e,{align:i,behavior:r})}))},this.scrollBy=(e,{behavior:t}={})=>{this.cancelScrollToIndex(),"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.scrollOffset+e,{adjustments:void 0,behavior:t})},this.getTotalSize=()=>{var e;const t=this.getMeasurements();let r;return r=0===t.length?this.options.paddingStart:1===this.options.lanes?(null==(e=t[t.length-1])?void 0:e.end)??0:Math.max(...t.slice(-this.options.lanes).map(e=>e.end)),r-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(e,{adjustments:t,behavior:r})=>{this.options.scrollToFn(e,{behavior:r,adjustments:t},this)},this.measure=()=>{var e,t;this.itemSizeCache=new Map,null==(t=(e=this.options).onChange)||t.call(e,this,!1)},this.setOptions(e),this.scrollRect=this.options.initialRect,this.scrollOffset="function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}),this.notify(!1,!1)}}const xM=(e,t,r,n)=>{for(;e<=t;){const i=(e+t)/2|0,o=r(i);if(o<n)e=i+1;else{if(!(o>n))return i;t=i-1}}return e>0?e-1:0};const CM=typeof document<"u"?n.useLayoutEffect:n.useEffect;function _M(e){return function(e){const t=n.useReducer(()=>({}),{})[1],r={...e,onChange:(r,n)=>{var i;n?Ee(t):t(),null==(i=e.onChange)||i.call(e,r,n)}},[i]=n.useState(()=>new wM(r));return i.setOptions(r),n.useEffect(()=>i._didMount(),[]),CM(()=>i._willUpdate()),i}({observeElementRect:pM,observeElementOffset:vM,scrollToFn:bM,...e})}function SM(){const e=$m(e=>{var t;return null==(t=e.config.ui)?void 0:t.activeTheme});return $m(t=>{var r;return((null==(r=t.config.ui)?void 0:r.themes)||[]).find(t=>t.name===e)})}function AM({category:t}){const r=SM(),n=t.name,i=t.list?t.list:Array.from(Array(t.items).keys()),o=u(null),s=_M({horizontal:!0,count:i.length,getScrollElement:()=>o.current,estimateSize:c(()=>52,[]),overscan:5});return a(()=>{s.scrollToIndex(0)},[n]),e(y,{children:e("div",{ref:o,className:"tiny-scrollbar overflow-x-auto overflow-y-hidden",style:{height:"52px"},children:e("div",{className:"h-full relative mx-auto",style:{width:`${s.getTotalSize()}px`},children:s.getVirtualItems().map(n=>{const o=`${i[n.index]}`;return e("div",{className:"absolute top-0 left-0 h-full",style:{width:`${n.size}px`,transform:`translateX(${n.start}px)`},children:e(cS,{variant:"outline",radius:"rounded-xl",size:"md",equalWidth:!0,onClick:async()=>{await Gm().shape.addSticker(t.name,o),qm().setDirty(!0)},children:e("img",{className:Tf("m-auto m-auto w-28 h-28",t.invertPreview&&(null==r?void 0:r.isDark)&&"invert"),src:w_(t,o),alt:o})})},n.index)})})})})}function kM(){const r=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.stickers)?void 0:r.items})||[],[n,i]=o(r[0]),a=r.map(t=>{const r=n===t,i=Cf[t.name];return e(cS,{size:"xs",color:r?"primary":null,value:t,children:e("span",{className:"capitalize",children:i?e(Ok,{...i}):t.name})},t.name)});return t("div",{className:"h-92",children:[e("div",{className:"mb-10 w-full hide-scrollbar overflow-x-auto overflow-y-hidden flex",children:e(EE,{value:n,onChange:e=>i(e),variant:"outline",radius:"rounded-full",className:"mx-auto",children:a})}),n&&e(AM,{category:n})]})}function EM(){const r=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.frame)?void 0:r.items})||[],n=$m(e=>e.frame.active);a(()=>{qm().frame.active&&qm().frame.showOptionsPanel()},[]);const i=r.map(r=>{const i=KC(`images/frames/${r.name}/thumbnail.png`),o=(null==n?void 0:n.name)===r.name;return e(LP,{children:t("button",{type:"button",className:"border-2 overflow-hidden relative rounded border cursor-pointer "+(o?"border-primary":""),onClick:()=>{qm().setDirty(!0),o?Gm().frame.remove():Gm().frame.add(r.name)},children:[o&&e(IM,{}),e("img",{draggable:"false",className:"w-64 h-64",src:i,alt:r.name})]})},r.name)});return e(RP,{children:i})}function IM(){return e("span",{className:"bg-background/70 absolute inset-0 text-primary",children:e(TP,{className:"svg-icon icon-md absolute inset-0 block m-auto"})})}function TM(){const t=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.text)?void 0:r.items});a(()=>{t&&e_(t,{prefixSrc:KC,id:"pixie-fonts"}).catch(()=>{})},[t]),a(()=>{Gm().text.selectOrAddText()&&qm().setDirty(!0)},[]);const r=(t||[]).map(t=>e(LP,{children:e(FM,{fontConfig:t})},t.family));return e(RP,{className:"pt-6",children:r})}function FM({fontConfig:t}){var r;const n=$m(e=>e.objects.active.editableProps.fontFamily),i=Tf("block px-6 w-110 h-68 text-sm bg border rounded-2xl",{"border-primary":n===t.family,"text-primary":n===t.family});return e("button",{type:"button",className:i,style:{fontFamily:t.family.includes('"')?t.family:`"${t.family}"`,fontWeight:(null==(r=t.descriptors)?void 0:r.weight)||"normal"},onClick:async()=>{Gm().text.selectOrAddText(),qm().setDirty(!0),Gm().objects.setValues({fontFamily:t.family})},children:t.family})}const OM=Pf(e("path",{d:"M290.7 57.4L57.4 290.7c-25 25-25 65.5 0 90.5l80 80c12 12 28.3 18.7 45.3 18.7H288h9.4H512c17.7 0 32-14.3 32-32s-14.3-32-32-32H387.9L518.6 285.3c25-25 25-65.5 0-90.5L381.3 57.4c-25-25-65.5-25-90.5 0zM297.4 416H288l-105.4 0-80-80L227.3 211.3 364.7 348.7 297.4 416z"}),"EraserFA","0 0 576 512");function PM(){return a(()=>(Gm().draw.enable(),()=>{Gm().draw.disable()}),[]),t(RP,{gap:"gap-16",children:[e(LP,{children:e(CO,{size:"sm",label:e(Ok,{message:"Brush Color"}),value:Gm().draw.currentBrush.color,onChange:e=>{Gm().draw.setBrushColor(e)}})}),e(LP,{children:e(RM,{})}),e(LP,{children:e(MM,{})})]})}function MM(){const r=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.draw)?void 0:r.brushSizes})||[],[n,i]=o(Gm().draw.currentBrush.width);return e(jO,{selectionMode:"single",selectedValue:n,onSelectionChange:e=>{i(e),Gm().draw.setBrushSize(e)},size:"sm",label:e(Ok,{message:"Brush Size"}),children:r.map(r=>e(mS,{value:r,children:t("div",{className:"flex items-center",children:[e("div",{className:"flex-shrink-0 mr-8 border-[3px] rounded-full",style:{width:`${r}px`,height:`${r}px`}}),r]})},r))})}function RM(){const r=$m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.draw)?void 0:r.brushTypes})||[],n=SM(),[i,a]=o(Gm().draw.currentBrush.type);return e(jO,{selectionMode:"single",selectedValue:i,onSelectionChange:e=>{a(e),Gm().draw.setBrushType(e)},size:"sm",label:e(Ok,{message:"Brush Type"}),children:r.map(r=>e(mS,{value:r,children:t("div",{className:"flex items-center",children:["EraserBrush"===r?e(OM,{className:"mr-8"}):e("img",{className:"flex-shrink-0 mr-8 w-24 h-24",src:LM(r,null==n?void 0:n.isDark),alt:""}),e(Ok,{message:r.replace(/([A-Z])/g," $1").trim()})]})},r))})}function LM(e,t=!1){return KC(`images/brushes/${t?"white":"black"}/${e.replace("Brush","").toLowerCase()}.png`)}function NM(){const{trans:t}=gO(),r=$m(e=>e.corners.radius);return a(()=>(qm().setDirty(!0),Gm().corners.showPreview(),()=>Gm().corners.hidePreview()),[]),e("div",{className:"max-w-320 mx-auto",children:e(MO,{minValue:1,maxValue:300,label:t({message:"Radius"}),getValueLabel:e=>`${e}px`,onChange:e=>{Gm().corners.updatePreview(e),qm().corners.setRadius(e)},value:r})})}const jM={initial:{y:"130%",opacity:0},animate:{y:0,opacity:1},exit:{y:"130%",opacity:0,left:0,position:"absolute",overflowY:"hidden"},transition:{type:"tween",duration:.15}};function DM({activeTool:t}){const r=function(t){switch(t){case Ef.FILTER:return e(NP,{});case Ef.RESIZE:return e(HP,{});case Ef.CROP:return e(tM,{});case Ef.DRAW:return e(PM,{});case Ef.TEXT:return e(TM,{});case Ef.SHAPES:return e(aM,{});case Ef.STICKERS:return e(kM,{});case Ef.FRAME:return e(EM,{});case Ef.CORNERS:return e(NM,{});default:return null}}(t);return e(Gx.div,{className:"relative h-full w-full text-sm bg select-none overflow-hidden",...jM,children:r})}function zM({className:t}){const r=$m(e=>e.activeTool);return e("nav",{className:Tf("z-navbar min-h-86 flex-shrink-0 px-16 relative overflow-hidden",t),children:e(eC,{initial:!1,children:r?e(DM,{activeTool:r},"tool-controls"):e(BM,{},"nav-items")})})}function BM(){const t=$m(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.nav)?void 0:r.items})||[];return e(Gx.div,{className:"w-full h-full bg-inherit",...jM,children:e(RP,{children:t.map(t=>e(LP,{children:e(UM,{item:t})},t.name))})})}function UM({item:r}){const n=Qf[r.name];return t(lS,{variant:"outline",color:"paper",className:"flex-col flex-shrink-0 w-68 h-68",radius:"rounded-2xl",onClick:()=>{"string"==typeof r.action?Jm(r.action):"function"==typeof r.action&&r.action(qm().editor)},children:[e("div",{className:"mb-1",children:e(CE,{className:"icon-md",icon:r.icon})}),e("div",{className:"mt-6 text-xs capitalize max-w-[90%] overflow-hidden overflow-ellipsis",children:n?e(Ok,{...n}):r.name})]})}function VM(){const r=$m(e=>e.history.items),n=$m(e=>e.history.pointer);return t(Gx.div,{...wk,className:"absolute bottom-20 right-20 w-224 max-w-[calc(100%-40px)] max-h-[calc(100%-40px)] bg-paper shadow-xl border focus:outline-none rounded overflow-hidden",children:[t("div",{className:"px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",children:[e(Ok,{message:"History"}),e(xE,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{qm().togglePanel("history",!1)},children:e(NE,{})})]}),e("div",{className:"p-10",children:r.map(t=>{const o=t.id===r[n].id,a=Kf[t.name],s=a.icon&&i.createElement(a.icon,{className:"icon-sm"});return e(cS,{onClick:()=>{o||Gm().history.load(t)},variant:"outline",color:o?"primary":null,size:"sm",className:Tf("w-full mb-8",o&&"pointer-events-none"),justify:"justify-start",startIcon:s,children:e(Ok,{...a.name})},t.id)})})]})}function HM(r){const{children:n,className:i,color:o,onDismiss:a,leftAdornment:s,rightAdornment:c,hideDismissButton:u=!1,size:d,showDivider:h,justify:f="justify-between",titleFontWeight:p="font-semibold",titleTextSize:g=("xs"===d?"text-xs":"text-sm"),closeButtonSize:m=("xs"===d?"xs":"sm"),actions:v}=r,{labelId:y,isDismissable:b,close:w}=l(fO);return t("div",{className:Tf(i,"flex flex-shrink-0 items-center gap-10",p,h&&"border-b",WM(r),o||"text-main",f),children:[s,e("h3",{id:y,className:Tf(g,"mr-auto leading-5 opacity-90"),children:n}),c,v,b&&!u&&e(xE,{"aria-label":"Dismiss",onClick:()=>{a?a():w()},size:m,className:Tf("-mr-8 text-muted",c&&"sr-only"),children:e(NE,{})})]})}function WM({size:e,padding:t}){if(t)return t;switch(e){case"2xs":case"xs":return"px-14 py-4";case"sm":return"px-18 py-4";default:return"px-24 py-6"}}const $M=p((t,r)=>{const{children:n,className:i,padding:o,size:a,...s}=t;return e("div",{...s,ref:r,className:Tf(i,qM(t),"overflow-y-auto overflow-x-hidden overscroll-contain text-sm flex-auto"),children:n})});function qM({size:e,padding:t}){if(t)return t;switch(e){case"xs":return"p-14";case"sm":return"p-18";default:return"px-24 py-20"}}function GM(){const t=$m(e=>e.openPanels.newImage);return e(xO,{isOpen:t,disableInitialTransition:!0,type:"modal",isDismissable:!1,children:e(YM,{})})}function YM(){const[r,n]=o("default");return t(yO,{className:"text-center max-w-max text-main",size:"auto",children:[e(HM,{padding:"px-24 pt-24 pb-12",showDivider:!1,children:e(Ok,{message:"Open a photo or design to get started"})}),e($M,{children:e("default"===r?XM:ZM,{setActivePanel:n})})]})}function XM({setActivePanel:n}){return t(r,{children:[e(cS,{className:"mr-20",size:"sm",variant:"raised",color:"primary",onClick:()=>{Gm().import.uploadAndReplaceMainImage()},children:e(Ok,{message:"Open Photo"})}),e(cS,{variant:"outline",size:"sm",color:"primary",onClick:()=>{n("newCanvas")},children:e(Ok,{message:"Create New"})}),e(KM,{})]})}function KM(){const n=$m(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.openImageDialog)?void 0:r.sampleImages});return null!=n&&n.length?t(r,{children:[t("div",{className:"relative py-20 text-main",children:[e("hr",{className:"absolute h-1 border-none bg-divider w-full top inset-0 m-auto"}),e("span",{className:"text-sm bg px-6 relative",children:e(Ok,{message:"or use sample"})})]}),e("ul",{className:"flex items-center gap-16",children:n.map(t=>e("li",{className:"shrink-0",children:e("button",{type:"button",onClick:async()=>{"function"==typeof t.action?t.action():t.url.endsWith(".json")?(await Km(KC(t.url)),qm().togglePanel("newImage",!1)):(await Gm().import.openBackgroundImage(KC(t.url)),qm().togglePanel("newImage",!1))},children:e("img",{className:"w-80 h-80 rounded overflow-hidden transition-shadow hover:shadow-md",src:KC(t.thumbnail),alt:""})})},t.url||t.thumbnail))})]}):null}function ZM({setActivePanel:r}){const[n,i]=o({width:800,height:600,bgColor:"transparent"});return t("form",{onSubmit:e=>{e.preventDefault();const{width:t,height:r,bgColor:i}=n;t&&r&&(qm().setConfig({blankCanvasSize:{width:t,height:r}}),Gm().canvas.openNew(t,r,i),qm().togglePanel("newImage",!1),Gm().history.addInitial())},children:[e(vE,{type:"number",label:e(Ok,{message:"Width"}),value:n.width,min:1,required:!0,className:"mb-16",onChange:e=>{i({...n,width:e.target.valueAsNumber})}}),e(vE,{type:"number",label:e(Ok,{message:"Height"}),value:n.height,min:1,required:!0,className:"mb-16",onChange:e=>{i({...n,height:e.target.valueAsNumber})}}),e(CO,{onChange:e=>{i({...n,bgColor:e})},className:"mb-16",value:n.bgColor,label:e(Ok,{message:"Background color"})}),t("div",{className:"text-right",children:[e(cS,{size:"sm",variant:"text",className:"mr-10",onClick:()=>{r("default")},children:e(Ok,{message:"Cancel"})}),e(cS,{size:"sm",type:"submit",variant:"raised",color:"primary",children:e(Ok,{message:"Create"})})]})]})}const QM=p((r,n)=>{const i=aE(r),{label:o,children:a,size:s,className:l,orientation:c="horizontal",disabled:u,required:d,invalid:h,errorMessage:f,description:p}=r,g=b(),y=r.name||g;return t("fieldset",{"aria-describedby":p?`${g}-description`:void 0,ref:n,className:Tf("text-left",l),children:[o&&e("legend",{className:i.label,children:o}),e("div",{className:Tf("flex",o?"mt-6":"mt-0","vertical"===c?"flex-col gap-10":"flex-row gap-16"),children:m.map(a,e=>{if(v(e))return w(e,{name:y,size:s,invalid:e.props.invalid||h||void 0,disabled:e.props.disabled||u,required:e.props.required||d})})}),p&&!f&&e("div",{className:i.description,id:`${g}-description`,children:p}),f&&e("div",{className:i.error,children:f})]})}),JM=p((r,n)=>{const{children:i,autoFocus:o,size:a,invalid:s,isFirst:l,...c}=r,u=SC(n);gE({autoFocus:o},u);const d=function(e){switch(e){case"xs":return{circle:"h-12 w-12",label:"text-xs"};case"sm":return{circle:"h-16 w-16",label:"text-sm"};case"lg":return{circle:"h-24 w-24",label:"text-lg"};default:return{circle:"h-20 w-20",label:"text-base"}}}(a);return t("label",{className:Tf("inline-flex gap-8 select-none items-center whitespace-nowrap align-middle",d.label,r.disabled&&"text-disabled pointer-events-none",r.invalid&&"text-danger"),children:[e("input",{type:"radio",className:Tf("focus-visible:ring outline-none","rounded-full transition-button border-2 appearance-none","border-text-muted disabled:border-disabled-fg checked:border-primary checked:hover:border-primary-dark","before:bg-primary disabled:before:bg-disabled-fg before:hover:bg-primary-dark","before:h-full before:w-full before:block before:rounded-full before:scale-10 before:opacity-0 before:transition before:duration-200","checked:before:scale-[.65] checked:before:opacity-100",d.circle),ref:u,...c}),i&&e("span",{children:i})]})});function eR(){const t=$m(e=>e.openPanels.export);return e(xO,{isOpen:t,onOpenChange:e=>{e||qm().togglePanel("export",!1)},type:"modal",children:e(tR,{})})}function tR(){const[r,n]=o(()=>{var e,t,r,n,i,o;return{filename:(null==(t=null==(e=qm().config.tools)?void 0:e.export)?void 0:t.defaultName)||"image",format:(null==(n=null==(r=qm().config.tools)?void 0:r.export)?void 0:n.defaultFormat)||"jpeg",quality:(null==(o=null==(i=qm().config.tools)?void 0:i.export)?void 0:o.defaultQuality)||.8}});return e(yO,{className:"text-center max-w-max text-main",size:"auto",children:e($M,{children:t("form",{onSubmit:e=>{e.preventDefault(),Gm().export.save(r.filename,r.format,r.quality),qm().togglePanel("export",!1)},children:[e(vE,{required:!0,size:"sm",label:e(Ok,{message:"Save As"}),value:r.filename,onChange:e=>{n({...r,filename:e.target.value})}}),t(QM,{size:"sm",className:"my-20","aria-label":"Image format",children:[e(JM,{value:"jpeg",checked:"jpeg"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"JPEG"}),e(JM,{value:"png",checked:"png"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"PNG"}),e(JM,{value:"json",checked:"json"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"JSON"})]}),e(MO,{size:"sm",minValue:.1,step:.1,maxValue:1,value:r.quality,onChange:e=>{n({...r,quality:e})},formatOptions:{style:"percent"},label:e(Ok,{message:"Quality"})}),e(cS,{variant:"raised",color:"primary",type:"submit",className:"mt-20 w-full",size:"sm",children:e(Ok,{message:"Save"})})]})})})}function rR(){const r=$m(e=>e.objects.all),n=$m(e=>e.objects.active.id);return t(Gx.div,{...wk,className:"absolute bottom-20 right-20 w-224 max-w-[calc(100%-40px)] max-h-[calc(100%-40px)] bg-paper shadow-xl border focus:outline-none rounded overflow-hidden",children:[t("div",{className:"px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",children:[e(Ok,{message:"Objects"}),e(xE,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{qm().togglePanel("objects",!1)},children:e(NE,{})})]}),e("div",{className:"p-8",children:r.map(t=>{const r=t.id===n,o=t.name;if(!o)return null;const a=Bg[o],s=a.icon&&i.createElement(a.icon,{className:"icon-sm"});return e(cS,{onClick:()=>{r||!t.selectable||Gm().objects.select(t.id)},variant:"outline",color:r?"primary":null,size:"sm",className:Tf("w-full mb-8",(r||!t.selectable)&&"pointer-events-none"),justify:"justify-start",startIcon:s,children:e(Ok,{...a.name})},t.id)})})]})}function nR(){const r=$m(e=>e.openPanels.history),n=$m(e=>e.openPanels.objects);return t("div",{className:"z-modal",children:[t(eC,{children:[r&&e(VM,{},"historyPanel"),n&&e(rR,{},"objListPanel")]}),e(GM,{}),e(eR,{})]})}
30
- /**
31
- * @remix-run/router v1.16.1
32
- *
33
- * Copyright (c) Remix Software Inc.
34
- *
35
- * This source code is licensed under the MIT license found in the
36
- * LICENSE.md file in the root directory of this source tree.
37
- *
38
- * @license MIT
39
- */function iR(){return iR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},iR.apply(this,arguments)}var oR,aR;function sR(e,t){if(!1===e||null===e||typeof e>"u")throw new Error(t)}function lR(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),n&&"#"!==n&&(t+="#"===n.charAt(0)?n:"#"+n),t}function cR(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function uR(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)}),r.length>1?r.join("/"):"/"}function dR(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function hR(e,t){let r=function(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}(e);return t?r.map((t,r)=>r===e.length-1?t.pathname:t.pathnameBase):r.map(e=>e.pathnameBase)}function fR(e,t,r,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=cR(e):(i=iR({},e),sR(!i.pathname||!i.pathname.includes("?"),dR("?","pathname","search",i)),sR(!i.pathname||!i.pathname.includes("#"),dR("#","pathname","hash",i)),sR(!i.search||!i.search.includes("#"),dR("#","search","hash",i)));let o,a=""===e||""===i.pathname,s=a?"/":i.pathname;if(null==s)o=r;else{let e=t.length-1;if(!n&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}o=e>=0?t[e]:"/"}let l=function(e,t){void 0===t&&(t="/");let{pathname:r,search:n="",hash:i=""}="string"==typeof e?cR(e):e;return{pathname:r?r.startsWith("/")?r:uR(r,t):t,search:gR(n),hash:mR(i)}}(i,o),c=s&&"/"!==s&&s.endsWith("/"),u=(a||"."===s)&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(oR||(oR={})),function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(aR||(aR={}));const pR=e=>e.join("/").replace(/\/\/+/g,"/"),gR=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",mR=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",vR=["post","put","patch","delete"];new Set(vR);const yR=["get",...vR];
40
- /**
41
- * React Router v6.23.1
42
- *
43
- * Copyright (c) Remix Software Inc.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE.md file in the root directory of this source tree.
47
- *
48
- * @license MIT
49
- */
50
- function bR(){return bR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bR.apply(this,arguments)}new Set(yR);const wR=n.createContext(null),xR=n.createContext(null),CR=n.createContext(null),_R=n.createContext({outlet:null,matches:[],isDataRoute:!1});function SR(){return null!=n.useContext(CR)}function AR(){return SR()||sR(!1),n.useContext(CR).location}function kR(e){n.useContext(xR).static||n.useLayoutEffect(e)}function ER(){let{isDataRoute:e}=n.useContext(_R);return e?function(){let{router:e}=function(){let e=n.useContext(wR);return e||sR(!1),e}(TR.UseNavigateStable),t=function(){let e=function(){let e=n.useContext(_R);return e||sR(!1),e}(),t=e.matches[e.matches.length-1];return t.route.id||sR(!1),t.route.id}(FR.UseNavigateStable),r=n.useRef(!1);return kR(()=>{r.current=!0}),n.useCallback(function(n,i){void 0===i&&(i={}),r.current&&("number"==typeof n?e.navigate(n):e.navigate(n,bR({fromRouteId:t},i)))},[e,t])}():function(){SR()||sR(!1);let e=n.useContext(wR),{basename:t,future:r,navigator:i}=n.useContext(xR),{matches:o}=n.useContext(_R),{pathname:a}=AR(),s=JSON.stringify(hR(o,r.v7_relativeSplatPath)),l=n.useRef(!1);return kR(()=>{l.current=!0}),n.useCallback(function(r,n){if(void 0===n&&(n={}),!l.current)return;if("number"==typeof r)return void i.go(r);let o=fR(r,JSON.parse(s),a,"path"===n.relative);null==e&&"/"!==t&&(o.pathname="/"===o.pathname?t:pR([t,o.pathname])),(n.replace?i.replace:i.push)(o,n.state,n)},[t,i,s,a,e])}()}function IR(e,t){let{relative:r}=void 0===t?{}:t,{future:i}=n.useContext(xR),{matches:o}=n.useContext(_R),{pathname:a}=AR(),s=JSON.stringify(hR(o,i.v7_relativeSplatPath));return n.useMemo(()=>fR(e,JSON.parse(s),a,"path"===r),[e,s,a,r])}var TR=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(TR||{}),FR=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(FR||{});
51
- /**
52
- * React Router DOM v6.23.1
53
- *
54
- * Copyright (c) Remix Software Inc.
55
- *
56
- * This source code is licensed under the MIT license found in the
57
- * LICENSE.md file in the root directory of this source tree.
58
- *
59
- * @license MIT
60
- */
61
- function OR(){return OR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},OR.apply(this,arguments)}new Promise(()=>{});const PR=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="6"}catch{}const MR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",RR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,LR=n.forwardRef(function(e,t){let r,{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 r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&(i[r]=e[r]);return i}(e,PR),{basename:p}=n.useContext(xR),g=!1;if("string"==typeof u&&RR.test(u)&&(r=u,MR))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),r=function(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&"/"!==n?null:e.slice(r)||"/"}(t.pathname,p);t.origin===e.origin&&null!=r?u=r+t.search+t.hash:g=!0}catch{}let m=function(e,t){let{relative:r}=void 0===t?{}:t;SR()||sR(!1);let{basename:i,navigator:o}=n.useContext(xR),{hash:a,pathname:s,search:l}=IR(e,{relative:r}),c=s;return"/"!==i&&(c="/"===s?i:pR([i,s])),o.createHref({pathname:c,search:l,hash:a})}(u,{relative:o}),v=function(e,t){let{target:r,replace:i,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:l}=void 0===t?{}:t,c=ER(),u=AR(),d=IR(e,{relative:s});return n.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,r)){t.preventDefault();let r=void 0!==i?i:lR(u)===lR(d);c(e,{replace:r,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:l})}},[u,c,d,i,o,r,e,a,s,l])}(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:o,unstable_viewTransition:h});return n.createElement("a",OR({},f,{href:r||m,onClick:g||a?i:function(e){i&&i(e),e.defaultPrevented||v(e)},ref:t,target:c}))});var NR,jR;!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"}(NR||(NR={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(jR||(jR={}));const DR=Pf(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"),zR=Pf(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"),BR={opacity:0,y:50,scale:.3},UR={opacity:1,y:0,scale:1},VR={opacity:0,scale:.5};function HR(){const r=nv(e=>e.toasts);return e("div",{className:"pointer-events-none relative",children:e(eC,{initial:!1,children:r.map(r=>e("div",{className:Tf("fixed z-toast mx-auto p-20","bottom-center"===r.position?"bottom-0 left-0 right-0":"bottom-0 right-0"),children:t(Gx.div,{initial:r.disableEnterAnimation?void 0:BR,animate:r.disableEnterAnimation?void 0:UR,exit:r.disableExitAnimation?void 0:VR,className:Tf("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=r.timer)?void 0:e.pause()},onPointerLeave:()=>{var e;return null==(e=r.timer)?void 0:e.resume()},role:"alert","aria-live":"danger"===r.type?"assertive":"polite",children:["danger"===r.type&&e(DR,{className:"flex-shrink-0 text-danger",size:"md"}),"loading"===r.type&&e(RO,{size:"sm",className:"flex-shrink-0",isIndeterminate:!0}),"positive"===r.type&&e(zR,{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(_E,{value:r.message})}),r.action&&e(cS,{variant:"text",color:"primary",size:"sm",className:"flex-shrink-0",onFocus:()=>{var e;return null==(e=r.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=r.timer)?void 0:e.resume()},onClick:()=>iv().remove(r.id),elementType:LR,to:r.action.action,children:e(_E,{value:r.action.label})}),"loading"!==r.type&&e(xE,{onFocus:()=>{var e;return null==(e=r.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=r.timer)?void 0:e.resume()},type:"button",className:"flex-shrink-0",onClick:()=>{iv().remove(r.id)},size:"sm",children:e(NE,{})})]})},r.id))})})}function WR(e){return yC()?e.metaKey:e.ctrlKey}function $R(e){switch(e.key){case"z":WR(e)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?Gm().history.redo():Gm().history.undo());break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),Gm().objects.move("up");break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),Gm().objects.move("right");break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),Gm().objects.move("down");break;case"ArrowLeft":e.preventDefault(),e.stopPropagation(),Gm().objects.move("left");break;case"Delete":e.preventDefault(),e.stopPropagation(),Gm().objects.delete();break;case"v":WR(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 r=await t.getType(e),n=new FileReader;return n.onload=e=>{var t;null!=(t=e.target)&&t.result&&Gm().import.addImageFromData(e.target.result)},void n.readAsDataURL(r)}}catch(e){console.error(e)}}())}}const qR=new Map,GR=new Map,YR={};async function*XR(e){const t=e.createReader();let r;do{r=await new Promise((e,r)=>{t.readEntries(e,r)});for(const e of r)if(e.isFile){if(".DS_Store"===e.name)continue;const t=await KR(e);yield new L_(t,e.fullPath)}else e.isDirectory&&(yield*XR(e))}while(r.length>0)}function KR(e){return new Promise((t,r)=>e.file(t,r))}function ZR(e){return null!=YR.dragTargetId?qR.get(YR.dragTargetId):e.dataTransfer.types.includes("Files")?{type:"nativeFile",el:null,ref:null,getData:()=>async function(e){const t=[];for await(const r of e)t.push(r);return t}(async function*(e){const t=[];for(const r of e.items)if("file"===r.kind){const e=r.webkitGetAsEntry();e&&t.push(e)}for(const e of t)if(e.isFile){if(".DS_Store"===e.name)continue;const t=await KR(e);yield new L_(t,e.fullPath)}else e.isDirectory&&(yield*XR(e))}(e.dataTransfer))}:void 0}function QR(){const r=$m(e=>{var t;return null==(t=e.config.ui)?void 0:t.visible})??!0,n=$m(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.nav)?void 0:r.position})??"bottom",i=$m(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.menubar)?void 0:r.position})??"top",o=$m(e=>{var t;return null==(t=e.config.ui)?void 0:t.allowEditorClose})??!0,s=u(null),l=u(null),{isModal:d,isMobile:h}=jE(),f=c(async e=>{var t,r;if(qm().activeTool||qm().dirty||"nativeFile"!==e.type)return;const n=await e.getData();Gm().import.fileIsValid(n[0])&&((null==(r=null==(t=qm().config.tools)?void 0:t.import)?void 0:r.openDroppedImageAsBackground)?await Gm().import.openBackgroundImage(n[0]):await Gm().import.openUploadedFile(n[0]))},[]),{droppableProps:p}=function({id:e,disabled:t,ref:r,...n}){const i=u({dragOverElements:new Set,dropActivateTimer:void 0}).current,o=u(n);o.current=n,x(()=>(GR.set(e,{...GR.get(e),disabled:t,id:e,ref:r}),()=>{GR.delete(e)}),[e,o,t,r]);const a=e=>{var t;const n=o.current,i=n.allowDragEventsFromItself||r.current!==(null==(t=e.ref)?void 0:t.current);return!(!(null!=e&&e.type&&i&&n.types.includes(e.type))||n.acceptsDrop&&!n.acceptsDrop(e))},s=e=>{var t,r;const n=ZR(e);n&&(null==(r=(t=o.current).onDragLeave)||r.call(t,n))};return{droppableProps:t?{}:{onDragOver:e=>{var t,r;e.preventDefault(),e.stopPropagation();const n=ZR(e);n&&a(n)&&(null==(r=(t=o.current).onDragOver)||r.call(t,n,e))},onDragEnter:e=>{var t,r;if(e.stopPropagation(),i.dragOverElements.add(e.target),i.dragOverElements.size>1)return;const n=ZR(e);n&&a(n)&&(null==(r=(t=o.current).onDragEnter)||r.call(t,n),clearTimeout(i.dropActivateTimer),"function"==typeof o.current.onDropActivate&&(i.dropActivateTimer=setTimeout(()=>{var e,t;n&&(null==(t=(e=o.current).onDropActivate)||t.call(e,n))},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=ZR(e);t&&a(t)&&(s(e),clearTimeout(i.dropActivateTimer))},onDrop:async e=>{var t,r,n,l;e.preventDefault(),e.stopPropagation(),i.dragOverElements.clear(),s(e),clearTimeout(i.dropActivateTimer);const c=ZR(e);c&&(null==(r=(t=o.current).onDragLeave)||r.call(t,c),a(c)&&(null==(l=(n=o.current).onDrop)||l.call(n,c)))}}}}({id:"pixie-root",ref:l,types:["nativeFile"],onDrop:f});a(()=>{var e,t;qm().fabric||($m.setState({canvasRef:s}),eS(s.current),null!=(e=qm().config.ui)&&e.defaultTool&&qm().setActiveTool(null==(t=qm().config.ui)?void 0:t.defaultTool,null),Gm().canvas.loadInitialContent().then(()=>{var e,t;null==(t=(e=qm().config).onLoad)||t.call(e,qm().editor)}));const r=tS(l,()=>{qm().setStageSize(rS(l.current))}),n=tS(s,()=>{qm().setCanvasSize(rS(s.current))});return()=>{r(),n()}},[l]);const g=Tf("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(tC,{features:nC,strict:!0,children:[d&&r&&!h&&o&&e(xE,{className:"z-20 fixed right-2 top-2 text-white",size:"lg",onClick:()=>{qm().editor.close()},children:e(NE,{})}),d&&r&&e(Sk,{position:"fixed",disableInitialTransition:!0}),t(Gx.div,{initial:!1,variants:{visible:{opacity:1,scale:1,display:"flex"},hidden:{opacity:0,transitionEnd:{display:"none"}}},animate:r?"visible":"hidden",className:g,children:["top"===i&&e(WE,{}),"top"===n&&e(zM,{className:"pt-14"}),t("main",{className:"relative flex-auto my-20 overflow-hidden outline-none",tabIndex:-1,...gC(p,{onKeyDownCapture:$R}),ref:l,children:[e(qE,{}),e(ST,{ref:s})]}),e(IP,{}),"bottom"===n&&e(zM,{}),"bottom"===i&&e(WE,{}),e(nR,{}),e(HR,{})]})]})}!function(){fabric.Object.ENLIVEN_PROPS.push("eraser");var e=fabric.Object.prototype._drawClipPath,t=fabric.Object.prototype.needsItsOwnCache,r=fabric.Object.prototype.toObject,n=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,r){if(e.call(this,t,r),this.eraser){var n=this._getNonTransformedDimensions();this.eraser.isType("eraser")&&this.eraser.set({width:n.x,height:n.y}),e.call(this,t,this.eraser)}},toObject:function(e){var t=r.call(this,["erasable"].concat(e));return this.eraser&&!this.eraser.excludeFromExport&&(t.eraser=this.eraser.toObject(e)),t},getSvgCommons:function(){return n.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 r=e.calcTransformMatrix();t.clone(function(t){var n=e.clipPath;t.getObjects("path").forEach(function(t){var i=fabric.util.multiplyTransformMatrices(r,t.calcTransformMatrix());fabric.util.applyTransformToObject(t,i),n?n.clone(function(n){var i=fabric.EraserBrush.prototype.applyClipPathToPath.call(fabric.EraserBrush.prototype,t,n,r);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"],r=["<rect ",'fill="white" ','x="',-this.width/2,'" y="',-this.height/2,'" width="',this.width,'" height="',this.height,'" />\n'].join("");t.push("\t\t",r);for(var n=0,i=this._objects.length;n<i;n++)t.push("\t\t",this._objects[n].toSVG(e));return t.push("</g>\n"),t}}),fabric.Eraser.fromObject=function(e,t){var r=e.objects;fabric.util.enlivenObjects(r,function(r){var n=fabric.util.object.clone(e,!0);delete n.objects,fabric.util.enlivenObjectEnlivables(e,n,function(){t&&t(new fabric.Eraser(r,n,!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,r){e.forEachObject(function(n){n.forEachObject&&"deep"===n.erasable?this._prepareCollectionTraversal(n,t,r):!this.inverted&&n.erasable&&n.visible?(n.visible=!1,e.dirty=!0,r.visibility.push(n),r.collection.push(e)):this.inverted&&n.visible&&(n.erasable&&n.eraser?(n.eraser.inverted=!0,n.dirty=!0,e.dirty=!0,r.eraser.push(n),r.collection.push(e)):(n.visible=!1,e.dirty=!0,r.visibility.push(n),r.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 r=this.canvas.getRetinaScaling();this.canvas.__initRetinaScaling(r,e,t)}var n=this.canvas.backgroundImage,i=n&&this._isErasable(n),o=this.canvas.overlayImage,a=o&&this._isErasable(o);if(!this.inverted&&(n&&!i||this.canvas.backgroundColor))i&&(this.canvas.backgroundImage=void 0),this.canvas._renderBackground(t),i&&(this.canvas.backgroundImage=n);else if(this.inverted&&n&&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,r){var n=fabric.util.invertTransform(e.calcTransformMatrix()),i=t.calcTransformMatrix(),o=t.absolutePositioned?n:fabric.util.multiplyTransformMatrices(n,r);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,r){var n=t.calcTransformMatrix(),i=t.clipPath,o=this;e.clone(function(e){i.clone(function(t){r(o.applyClipPathToPath(e,t,n))},["absolutePositioned","inverted"])})},_addPathToObjectEraser:function(e,t){var r=this;if(e.forEachObject&&"deep"===e.erasable){var n=e._objects.filter(function(e){return e.erasable});n.length>0&&e.clipPath?this.clonePathWithClipPath(t,e,function(e){n.forEach(function(t){r._addPathToObjectEraser(t,e)})}):n.length>0&&n.forEach(function(e){r._addPathToObjectEraser(e,t)})}else{var i=e.eraser;i||(i=new fabric.Eraser,e.eraser=i),t.clone(function(t){var n=fabric.util.multiplyTransformMatrices(fabric.util.invertTransform(e.calcTransformMatrix()),t.calcTransformMatrix());fabric.util.applyTransformToObject(t,n),i.addWithUpdate(t),e.set("dirty",!0),e.fire("erasing:end",{path:t}),e.group&&Array.isArray(r.__subTargets)&&r.__subTargets.push(e)})}},applyEraserToCanvas:function(e){var t=this.canvas,r={};return["backgroundImage","overlayImage"].forEach(function(n){var i=t[n];i&&i.erasable&&(this._addPathToObjectEraser(i,e),r[n]=i)},this),r},_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 r=this._points&&this._points.length>1?this.convertPointsToSVGPath(this._points):null;if(!r||this._isEmptySVGPath(r))return t.fire("erasing:end"),void t.requestRenderAll();var n=this.createPath(r);n.setCoords(),t.fire("before:path:created",{path:n});var i=this.applyEraserToCanvas(n),o=this;this.__subTargets=[];var a=[];t.forEachObject(function(e){e.erasable&&e.intersectsWithObject(n,!0,!0)&&(o._addPathToObjectEraser(e,n),a.push(e))}),t.fire("erasing:end",{path:n,targets:a,subTargets:this.__subTargets,drawables:i}),delete this.__subTargets,t.requestRenderAll(),this._resetShadow(),t.fire("path:created",{path:n})}})}(),Kl.enableBoundaryChecking(!1);const JR=class t{constructor(t){if(zl(this,"tools",{}),zl(this,"fabric",null),t.sentryDsn&&function(e){const t={...e};rh(t,"react"),pf(t)}({dsn:t.sentryDsn}),function(e,t){void 0===t&&(t={});var r=t.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===r&&n.firstChild?n.insertBefore(i,n.firstChild):n.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 r=document.querySelector(t.selector);r&&(r.classList.add("pi"),function(e){Dm=e,zm=e}(r),this.setConfig(t),$m.setState({editor:this}),_(r).render(e(i.StrictMode,{children:e(QR,{})})))}get state(){return qm()}get defaultConfig(){return t.defaultConfig}open(e={}){return new Promise(async t=>{var r;Object.keys(e).length?await this.resetEditor({...Ig(e,{ui:{visible:!0},image:e.image||qm().config.image,state:e.state||qm().config.state,blankCanvasSize:e.blankCanvasSize||qm().config.blankCanvasSize})}):null!=(r=qm().config.ui)&&r.visible||qm().setConfig({ui:{visible:!0}}),t()})}close(){var e,t,r;null!=(e=qm().config.ui)&&e.visible&&(this.setConfig({ui:{visible:!1}}),null==(r=(t=qm().config).onClose)||r.call(t))}setConfig(e){qm().setConfig(e)}uploadAndAddImage(){return Gm().import.uploadAndAddImage()}uploadAndReplaceMainImage(){return Gm().import.uploadAndReplaceMainImage()}uploadAndOpenStateFile(){return Gm().import.uploadAndOpenStateFile()}newCanvas(e,t,r){return Gm().canvas.openNew(e,t,r)}getState(e){return JSON.stringify(Qm(e))}setState(e){return Gm().import.loadState(e)}async setStateFromUrl(e){const t=await Km(e);return Gm().import.loadState(t)}openTool(e){Jm(e)}applyChanges(){qm().applyChanges()}cancelChanges(){qm().cancelChanges()}async resetEditor(e){await Xm(e),await Gm().canvas.loadInitialContent()}togglePanel(e,t){"objects"===e&&qm().togglePanel("history",!1),"history"===e&&qm().togglePanel("objects",!1),qm().togglePanel(e,t)}on(e,t){var r;null==(r=this.fabric)||r.on(e,t)}isDirty(){return qm().dirty}get(e){return this.tools[e]}notify(e){return ov(e)}static init(e){return new Promise(t=>{const r=e.onLoad;e.onLoad=e=>{null==r||r(e),t(e)},new this(e)})}};zl(JR,"defaultConfig",tp),zl(JR,"version",ep);let eL=JR;function tL(e){if(!this.backgroundColor)return;const t=this._getNonTransformedDimensions(),r=-t.x/2,n=-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(r,n,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(r,n,i,o))}else e.drawImage(a.source,r,n,i,o)}else{const t=function(e,t,r,n){var i,o;if("linear"===t.type){const i=e.createLinearGradient(r+t.coords.x1,n+t.coords.y1,r+t.coords.x2,n+t.coords.y2);return t.colorStops.forEach(e=>i.addColorStop(e.offset,e.color)),i}if("radial"===t.type){const a=e.createRadialGradient(r+t.coords.x1,n+t.coords.y1,null!==(i=t.coords.r1)&&void 0!==i?i:0,r+t.coords.x2,n+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,r,n);e.fillStyle=t,e.fillRect(r,n,i,o)}this._removeShadow(e)}const rL="fm-pixie-editor";const nL=new class{constructor(){this._container=document.createElement("div"),this._instance=null,this._container.classList.add(rL),this._container.style.width="100%",this._container.style.height="85vh",this._container.style.minHeight="400px"}get className(){return`.${rL}`}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 eL.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=tL)}):console.warn("Pixie fabric instance is not available")}async show(e,t,r=t.firstChild){t.insertBefore(this._container,r),await this._setConfig(e),this._instance.open()}close(){var e;null===(e=this._container.parentNode)||void 0===e||e.removeChild(this._container)}};function iL(e,t){if(!e)return t;if(!t)return e;return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function oL(e,t){if(/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(t))return t;const r=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 r=iL(t,e||"");return!r||r.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(r)||(r="/"+r),r}(e),n=iL(r,t);return!n||n.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(n)?n:"/"+n}var aL,sL;!function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(aL||(aL={})),function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(sL||(sL={}));const lL=(e,t="image/png")=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());function cL(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>{var e;return r(null!==(e=n.error)&&void 0!==e?e:new Error("Failed to convert blob to data URL"))},n.readAsDataURL(e)})}const uL=({visible:r,onClose:n,file:o,onSave:a,onSaveCopy:s})=>{var l;const{t:c}=ri(),u=i.useRef(null),d=Yo(),h=gs(),{options:f,actions:p}=Oo(),{i18n:g}=ri(),{config:m}=f,{setCurrentMenuFile:v}=p,{getFileData:y,resolveFileForEditByUrl:b}=h,[w,x]=i.useState(!1),[C,_]=i.useState(null),[S,A]=i.useState(""),[k,E]=i.useState(!1),[I,T]=i.useState(!1),[F,O]=i.useState(null),P=i.useRef(!1),R=i.useRef(),L=i.useRef(),N=i.useRef("saveCopy"),j=i.useRef(void 0);R.current=a,L.current=s,i.useEffect(()=>{o&&!P.current&&(async()=>{if(j.current!==o)if("object"!=typeof o){j.current=o,x(!0);try{if(o.startsWith("data:"))O({thumbnail:o,saveWithoutFolder:!0});else{const e=await b(o);j.current===o&&O(e)}}catch(e){console.error("Failed to load file for editor:",e),j.current===o&&(j.current=null),null==n||n()}finally{x(!1)}}else O(o)})()},[o,n,b]);const D=i.useCallback(async e=>{try{if("string"==typeof e.thumbnail&&e.thumbnail.startsWith("data:"))return e.thumbnail;const t=await y(e.id,!0);if(!t)throw new Error(c("Error loading image"));return new Promise(e=>{const r=new FileReader;r.onload=()=>e(r.result),r.readAsDataURL(t)})}catch(e){throw console.error("Error getting the image data:",e),e}},[y,c]);i.useEffect(()=>{if(!C&&r&&F){let e=!1;const t=async()=>{var t,r,i;x(!0);try{const t=await D(F);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid image data: empty or null");if(!t.startsWith("data:"))throw new Error("Invalid image data: not a valid data URL");const r=t.match(/^data:([^;]+);base64,(.+)$/);if(!r)throw new Error("Invalid image data: malformed data URL format");const[,n,i]=r;if(!n.startsWith("image/"))throw new Error(`Invalid image data: unsupported MIME type ${n}`);if(i.length<10)throw new Error("Invalid image data: base64 content too short");if(!/^[A-Za-z0-9+/]+=*$/.test(i))throw new Error("Invalid image data: corrupted base64 content");if(!e){_(t);const e=Ga(F,"image/png");A(e.mimeType)}}catch(o){e||(d.error({id:"IMAGE_DOWNLOAD_FAILED",innerException:o,message:c("Error loading image"),placement:"bottomRight",data:{itemId:null!==(t=null==F?void 0:F.id)&&void 0!==t?t:void 0,itemName:null!==(r=null==F?void 0:F.name)&&void 0!==r?r:void 0,folderId:null!==(i=null==F?void 0:F.folderId)&&void 0!==i?i:null,thumbnail:null==F?void 0:F.thumbnail}}),null==n||n())}finally{x(!1)}};return t(),()=>{e=!0}}},[F,D,C,n,c,r]);const z=i.useCallback(async(e,t,r)=>{var n;let i=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 r=`image/${e}`;if(t.startsWith("data:")){const e=Ar(t);e&&e.startsWith("image/")&&(r=e);const n=t.replace(/data:image\/[^;]+;base64,/,"");return lL(n,Sr(r))}return lL(t,Sr(r))}(r,e),o=Sr(i.type||`image/${r}`);const a=null!==(n=null==m?void 0:m.compessorUrl)&&void 0!==n?n:null==m?void 0:m.compressorUrl;if(o.startsWith("image/"))try{const e=new File([i],t,{type:o}),r=await is(e,{maxSizeMB:null==m?void 0:m.compressMaxSize,maxWidthOrHeight:null==m?void 0:m.compressMaxWidthOrHeight,mimeType:o,fileName:t,libURL:a,enableCompression:Boolean(m)&&"image/gif"!==o});i=r,o=r.type}catch(e){console.warn("Image preparation failed, using original:",e)}return{blob:i,mimeType:o,thumbnailDataUrl:await cL(i)}},[m]),B=i.useCallback(async(e,t,r,n)=>{var i,o,a,s,l,u;const h="save"===n?R.current:L.current;if(!F||!h)return;const f="object"==typeof F&&null!==F?F:null;let p=null;try{x(!0);const{blob:o,mimeType:a,thumbnailDataUrl:s}=await z(e,t,r),l=Object.assign(Object.assign({},F),{thumbnail:s,size:o.size,date:(new Date).toISOString().split("T")[0],type:a,folderId:F.folderId||"",name:F.name||t,extension:F.extension||(null===(i=(F.name||t).split(".").pop())||void 0===i?void 0:i.toLowerCase())||""});p=l;const u={blob:o,mimeType:a,thumbnail:s,mode:n},d=await h(l,u);if(d)return x(!1),d;throw new Error(c("saveCopy"===n?"Failed to save image copy":"Failed to save changes"))}catch(e){console.error("Error saving:",e);const r=null!=p?p:f,i=e;if(!(null==i?void 0:i.notificationShown)){const i=Jo(e),h=null!==(a=null!==(o=Zo(null==i?void 0:i.code,c))&&void 0!==o?o:null==i?void 0:i.message)&&void 0!==a?a:c("saveCopy"===n?"Failed to save image copy":"Error saving image");d.error({id:"saveCopy"===n?"IMAGE_SAVE_COPY_FAILED":"IMAGE_SAVE_FAILED",message:h,placement:"bottomRight",data:{itemId:null!==(s=null==r?void 0:r.id)&&void 0!==s?s:void 0,itemName:null!==(l=null==r?void 0:r.name)&&void 0!==l?l:t,folderId:null!==(u=null==r?void 0:r.folderId)&&void 0!==u?u:null,thumbnail:null==r?void 0:r.thumbnail},innerException:e})}x(!1)}},[F,d,z,c]),U=i.useCallback(async e=>{var t;if(!nL.isLoaded()||!F)return void console.error("❌ Pixie instance or file is missing");N.current=e;const r=F.name||"edited-image",n=Ga(F,S);try{await(null===(t=nL.tools)||void 0===t?void 0:t.export.save(r.replace(/\.[^/.]+$/,""),n.pixieFormat,Ya.QUALITY))}catch(t){console.error("🎨 Error saving through the button:",t);try{const t=nL.canvas,i=t?t.toDataURL(n.mimeType):null;i&&await B(i,r,n.extension,e)}catch(e){console.error("🎨 Alternative method also did not work:",e)}}},[F,S,B]),V=i.useCallback(async()=>{var t;if(C&&r&&k&&!P.current)try{P.current=!0;const r=u.current;let i=0;for(;i<20&&(0===r.clientWidth||0===r.clientHeight);)await new Promise(e=>setTimeout(e,50)),i++;const o=(null==m?void 0:m.locale)?null==m?void 0:m.locale.replace("_","-"):"en",a=matchMedia(ur).matches?lr:sr,s=(null==m?void 0:m.theme)===cr?a:null==m?void 0:m.theme,l=((null==m?void 0:m.locale)||g.language||"en").split("-")[0].split("_")[0],c=(g.getResourceBundle(l,"translation")||{}).pixie||{},d=e=>e.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),h={};Object.entries(c).forEach(([e,t])=>{const r=d(e);h[r]=t,h[e]=t});const f={[o]:h},p=Ga(F,S),v={selector:"#pixie-editor",baseUrl:oL((null==m?void 0:m.baseUrl)||"",(null==m?void 0:m.assetsUrl)||"assets/image-editor"),image:C,activeLanguage:o,languages:f,ui:{activeTheme:s,mode:"inline",forceOverlayModeOnMobile:!1,visible:!0,menubar:{replaceDefaultItems:!0,position:aL.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(me,{style:{fontSize:20}}),align:"right",desktopOnly:!0,action:n}]},nav:{position:sL.TOP}},tools:{export:{defaultFormat:p.pixieFormat,defaultQuality:Ya.QUALITY,defaultName:(null===(t=null==F?void 0:F.name)||void 0===t?void 0:t.replace(/\.[^/.]+$/,""))||"image"},text:{replaceDefaultItems:!0,defaultText:"Handwriting",items:[{family:"Inter",src:"fonts/inter-v20-cyrillic_latin-regular.woff2"},{family:"Commissioner",src:"fonts/commissioner-v24-cyrillic_latin-regular.woff2"},{family:"Montserrat Light",src:"fonts/Montserrat-Light.woff2"},{family:"Montserrat Regular",src:"fonts/Montserrat-Regular.woff2"},{family:"Montserrat Bold",src:"fonts/Montserrat-Bold.woff2"},{family:"Montserrat Black",src:"fonts/Montserrat-Black.woff2"},{family:"Roboto Light",src:"fonts/Roboto-Light.woff2"},{family:"Roboto Regular",src:"fonts/Roboto-Regular.woff2"},{family:"Roboto Bold",src:"fonts/Roboto-Bold.woff2"},{family:"Roboto Black",src:"fonts/Roboto-Black.woff2"},{family:"Lato Light",src:"fonts/Lato-Light.woff2"},{family:"Lato Regular",src:"fonts/Lato-Regular.woff2"},{family:"Lato Bold",src:"fonts/Lato-Bold.woff2"},{family:"Lato Black",src:"fonts/Lato-Black.woff2"},{family:"Rubik Light",src:"fonts/Rubik-Light.woff2"},{family:"Rubik Regular",src:"fonts/Rubik-Regular.woff2"},{family:"Rubik Bold",src:"fonts/Rubik-Bold.woff2"},{family:"Rubik Black",src:"fonts/Rubik-Black.woff2"},{family:"Bebas Neue Light",src:"fonts/BebasNeueLight.woff2"},{family:"Bebas Neue Regular",src:"fonts/BebasNeueRegular.woff2"},{family:"Bebas Neue Book",src:"fonts/BebasNeueBook.woff2"},{family:"Bebas Neue Bold",src:"fonts/BebasNeueBold.woff2"},{family:"Fira Sans",src:"fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"},{family:"Lobster",src:"fonts/Lobster.woff2"},{family:"Pacifico",src:"fonts/pacifico-v23-cyrillic_latin-regular.woff2"},{family:"Playfair Display",src:"fonts/playfair-display-v40-cyrillic_latin-regular.woff2"},{family:"Oswald",src:"fonts/oswald-v57-cyrillic_latin-regular.woff2"},{family:"Caveat",src:"fonts/caveat-v23-cyrillic_latin-regular.woff2"}]}},onSave:async function(e,t,r){try{x(!0);return await B(e,t,r,N.current)}catch(e){throw console.error("🎨 PIXIE onSave ERROR:",e),x(!1),e}}};try{T(!1),await nL.show(v,u.current);const e=nL.canvas;e&&e.focus(),T(!0),x(!1)}catch(e){console.error("init pixie failed:",e)}}catch(e){console.error("Error initializing Pixie:",e),d.error({id:"EDITOR_INIT_FAILED",message:c("Error initializing editor"),placement:"bottomRight",innerException:e}),P.current=!1,null==n||n()}},[F,S,C,r,k,null==m?void 0:m.locale,null==m?void 0:m.theme,null==m?void 0:m.baseUrl,null==m?void 0:m.assetsUrl,n,B,d,g,c]);i.useEffect(()=>{r&&C&&k&&V()},[r,C,k,V]),i.useEffect(()=>{if(!r){try{nL.close()}catch(e){console.warn("Error closing Pixie:",e)}x(!1),_(null),A(""),P.current=!1,E(!1),T(!1)}return()=>{try{nL.close()}catch(e){console.warn("Error closing Pixie when unmounting:",e)}}},[r]);const H=Boolean(null==F?void 0:F.id)&&!1!==(null===(l=null==m?void 0:m.features)||void 0===l?void 0:l.enableUpdateFile);return e(q,{title:(null==F?void 0:F.name)?c("Editing: {{name}}",{name:F.name}):c("Editing image"),open:r,closeIcon:null,onCancel:n,afterOpenChange:e=>E(e),forceRender:!0,width:"100vw",style:{top:0,height:"100vh",maxWidth:"none",padding:10},styles:{body:{height:"85vh",padding:0}},footer:[e(M,{onClick:n,disabled:!k||w,children:c("Cancel")},"cancel"),e(M,{type:"primary",onClick:()=>U("saveCopy"),loading:w,children:c("Save as copy and choose")},"save-copy"),...H?[e(M,{type:"primary",onClick:()=>U("save"),loading:w,children:c("Save and choose")},"save")]:[]],maskClosable:!1,destroyOnHidden:!1,afterClose:()=>{v&&v("")},children:t("div",{ref:u,style:{position:"relative",width:"100%",height:"100%"},children:[r&&!I?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:c("Loading editor...")})}):null,w&&I&&e(Fl,{style:{position:"absolute",top:0,background:"var(--colorBgLayout)",zIndex:100,opacity:.7}})]})})};var dL="uploadProgress",hL="uploadProgress__card",fL="uploadProgress__header",pL="uploadProgress__header-title",gL="uploadProgress__header-buttons",mL="uploadProgress__header-button",vL="uploadProgress__close-icon",yL="uploadProgress__body",bL="uploadProgress__common-error",wL="uploadProgress__common-error-row",xL="uploadProgress__common-error-hint",CL="uploadProgress__list-wrapper",_L="uploadProgress__status-icon",SL="uploadProgress__file-item",AL="uploadProgress__file-item--error",kL="uploadProgress__body--error",EL="uploadProgress__error-item",IL="uploadProgress__error-message",TL="uploadProgress__error-hint",FL="uploadProgress__file-avatar",OL="uploadProgress__file-info",PL="uploadProgress__file-name",ML="uploadProgress__file-size",RL="uploadProgress__progress-bar",LL="uploadProgress__minimized",NL="uploadProgress__minimized-button",jL="uploadProgress__file-list";const{Text:DL}=F,zL=({visible:r,files:n,totalFiles:i,completedFiles:o,onClose:a,onMinimize:s,onInsert:l,minimized:c=!1})=>{var u;const{token:d}=A.useToken(),{t:h}=ri();if(!r)return null;const f=t=>{switch(t){case"success":return e("div",{className:_L,children:e(xe,{style:{color:d.colorSuccess}})});case"error":return e(be,{style:{color:d.colorError}});default:return e(we,{style:{color:"#1890ff"}})}},p=t=>"success"===t.status?[e(M,{type:"primary",size:"small",onClick:()=>l(t),children:h("Insert")},"insert")]:[];if(c)return e("div",{className:LL,children:e(M,{type:"primary",size:"small",onClick:s,className:NL,children:h("Upload progress",{completed:o,total:i})})});const g=n.filter(e=>"uploading"===e.status).length,m=n.filter(e=>"success"===e.status).length,v=n.filter(e=>"error"===e.status).length,y=n.filter(e=>"error"===e.status),b=y.length>1&&y.every(e=>{var t;return e.error&&e.error===(null===(t=y[0])||void 0===t?void 0:t.error)}),w=b?null===(u=y[0])||void 0===u?void 0:u.error:null;return e("div",{className:dL+" fm-upload-progress",children:t("div",{className:hL,children:[t("div",{className:fL,children:[e(DL,{strong:!0,className:pL,children:g>0?h("Uploading files",{completed:o,total:i}):m>0?h("Uploaded files",{success:m,total:i}):h("Upload error files",{errorCount:v})}),e("div",{className:gL,children:e(M,{type:"text",size:"small",icon:e(me,{className:vL}),onClick:a,className:mL})})]}),t("div",{className:`${yL} ${n.some(e=>"error"===e.status)?kL:""}`,children:[e("div",{className:CL,children:e(K,{className:jL,size:"small",dataSource:n,renderItem:r=>{const n="error"===r.status,i=n?(e=>{if(!e)return null;const t=e.toLowerCase();return t.includes("type")||t.includes("format")||t.includes("формат")||t.includes("тип")||t.includes("not allowed")||t.includes("дозволен")||t.includes("name")||t.includes("invalid")||t.includes("назва")||t.includes("неприпустим")||t.includes("allowed characters")?null:t.includes("large")||t.includes("size")||t.includes("розмір")||t.includes("размер")?h("upload_error_hint_size"):t.includes("exists")||t.includes("вже існує")||t.includes("уже существует")?h("upload_error_hint_exists"):null})(r.error):null;return e(K.Item,{className:`${SL} ${n?AL:""}`,actions:p(r),children:e(K.Item.Meta,{avatar:e(Z,{size:"small",icon:f(r.status),className:FL}),title:t("div",{className:OL,children:[e(DL,{ellipsis:!0,className:PL,children:r.name}),e(DL,{type:"secondary",className:ML,children:void 0!==r.size?ki(r.size):""})]}),description:"uploading"===r.status?e(G,{percent:r.progress,size:"small",status:"active",showInfo:!1,className:RL}):n?b?null:t("div",{className:EL,children:[e(DL,{type:"danger",className:IL,children:r.error||h("Error")}),i&&e(DL,{type:"secondary",className:TL,children:i})]}):null})})}})}),w&&t("div",{className:bL,children:[t("div",{className:wL,children:[e(be,{style:{color:d.colorError,marginRight:8,flexShrink:0}}),e(DL,{type:"danger",children:w})]}),e(DL,{type:"secondary",className:xL,children:h("Applies to all {{count}} files",{count:y.length})})]})]})]})})},{Header:BL}=Q,{Title:UL}=F,VL=({activeLibraryItem:r,selectedFolder:i,isTrashFolder:o,onClearTrash:a,files:s,loading:l,onRefresh:c,refreshDisabled:u,showRefresh:d=!1})=>{const{t:h}=ri(),f=r===Jt&&(null!=o?o:i===ar),[p,g]=n.useState(!1),m={[Jt]:h("My files"),[er]:h("GIF"),[tr]:h("Stock images"),[rr]:h("Icons"),[ir]:h("QR & Barcode"),[nr]:h("AI image generation")};let v;return n.useEffect(()=>{const e=setTimeout(()=>{g(f&&s.length>0&&!l)},200);return()=>clearTimeout(e)},[f,s.length,l]),v=r===Jt?f?h("Trash"):i:m[r],e(BL,{className:"actions-header",children:t("div",{className:"header-title-container",children:[e(UL,{level:5,className:"header-title",children:v}),p&&a&&e(M,{type:"default",onClick:a,className:"clear-trash-button","aria-label":h("Clear Trash"),children:h("Clear")}),r===Jt&&d&&c&&e(P,{title:h("Refresh"),children:e(M,{type:"text",className:"folder-refresh-button",icon:e($i,{size:16}),onClick:c,disabled:u})})]})})};function HL(e,t){return!e||!t||e<=0||t<=0?1:e/t}const WL=1200;function $L({items:e,getId:t,getPreviewSrc:r,getAltText:n,getWidth:i,getHeight:a,layoutMode:s="masonry",minColumnWidth:l=240,estimatedItemHeight:c=240,gap:u=20,overscanPx:h=800,prefetchThresholdPx:f=1200,resolveColumnCount:p,virtualizationThreshold:g=40}){var m,v;const[y,b]=o({scrollTop:0,viewportHeight:800,viewportWidth:WL,scrollHeight:0}),w=d(()=>function(e){return{getId:e,buildSignature:(t,r)=>{var n,i;const o=r.getPreviewSrc(t)||"",a=r.getAltText(t),s=null===(n=r.getWidth)||void 0===n?void 0:n.call(r,t),l=null===(i=r.getHeight)||void 0===i?void 0:i.call(r,t);return[e(t),o,a,null!=s?s:"",null!=l?l:""].join("::")},buildRowModel:(e,t,r)=>{var n,i;const o=null===(n=t.getWidth)||void 0===n?void 0:n.call(t,e),a=null===(i=t.getHeight)||void 0===i?void 0:i.call(t,e);return{id:r.id,signature:r.signature,item:e,previewSrc:t.getPreviewSrc(e),altText:t.getAltText(e),width:o,height:a,aspectRatio:HL(o,a)}}}}(t),[t]),x=d(()=>({getPreviewSrc:r,getAltText:n,getWidth:i,getHeight:a}),[n,a,r,i]),C=d(()=>{const e=Math.max(1,y.viewportWidth||WL);return p?Math.max(1,p(e)):Math.max(1,Math.floor((e+u)/(l+u)))},[u,l,p,y.viewportWidth]),_=d(()=>{const e=Math.max(1,y.viewportWidth||WL);return Math.max(1,(e-u*Math.max(0,C-1))/C)},[C,u,y.viewportWidth]),S=d(()=>{const t=new Array(C).fill(0),r=[];e:for(let n=0;n<e.length;n+=1){const o=e[n],l=null==i?void 0:i(o),d=null==a?void 0:a(o),h=l&&d&&l>0&&d>0?l/d:void 0,f=h?_/h:c;if("grid"===s){const e=Math.floor(n/C)*(f+u),t=n%C*(_+u);r.push({index:n,top:e,left:t,width:_,height:f,bottom:e+f});continue e}let p=0;for(let e=1;e<t.length;e+=1)t[e]<t[p]&&(p=e);const g=t[p],m=p*(_+u);t[p]=g+f+u,r.push({index:n,top:g,left:m,width:_,height:f,bottom:g+f})}const n=0===r.length?0:"grid"===s?Math.max(...r.map(e=>e.bottom)):Math.max(0,...t.map(e=>e-u));return{positionedItems:r,containerHeight:n}},[C,_,c,u,a,i,e,s]),A=d(()=>e.length<=g?{renderStrategy:"full"}:{renderStrategy:"positioned",positioned:{layout:S.positionedItems,viewportTop:y.scrollTop,viewportBottom:y.scrollTop+y.viewportHeight,overscanPx:h,containerHeight:S.containerHeight}},[e.length,S.containerHeight,S.positionedItems,h,y.scrollTop,y.viewportHeight,g]),{rowModels:k,renderWindow:E}=fl({items:e,context:x,adapter:w,options:A}),I=null!==(m=E.positionedItems)&&void 0!==m?m:k.map((e,t)=>{var r;return{row:e,layout:null!==(r=S.positionedItems[t])&&void 0!==r?r:{index:t,top:0,left:0,width:_,height:c,bottom:c}}}),T=null!==(v=E.containerHeight)&&void 0!==v?v:S.containerHeight,F=T>0&&y.scrollTop+y.viewportHeight>=T-f;return{rowModels:k,renderRows:E.rows,renderWindow:E,positionedItems:I,containerHeight:T,isNearEnd:F,viewportMetrics:y,handleViewportChange:e=>{b(t=>t.scrollTop===e.scrollTop&&t.viewportHeight===e.viewportHeight&&t.viewportWidth===e.viewportWidth&&t.scrollHeight===e.scrollHeight?t:e)}}}const qL=t=>{var r,{imageId:n,sourceUrl:i,shouldLoad:s=!0,loader:l,onLoad:c}=t,h=Zs(t,["imageId","sourceUrl","shouldLoad","loader","onLoad"]);const f=Rs(d(()=>[i],[i])),[p,g]=o(()=>l.getSnapshot(n,i)),m=u(null);return a(()=>(g(l.getSnapshot(n,i)),l.subscribe(n,i,g)),[n,l,i]),a(()=>(l.setActive(n,i,s),()=>{l.setActive(n,i,!1),l.release(n)}),[n,l,s,i]),p.shouldLoad&&f.src?e("img",Object.assign({},h,{ref:m,src:f.src,loading:null!==(r=h.loading)&&void 0!==r?r:"lazy",onLoad:e=>{f.handleLoad(),l.markLoaded(n),null==c||c(e)},onError:async e=>{var t;(await f.handleError()).exhausted&&l.markError(n),null===(t=h.onError)||void 0===t||t.call(h,e)}})):null};var GL={gifTab:"gifTab",scrollableDiv:"scrollableDiv",gifSearchInput:"gifSearchInput",search:"search",searchResults:"searchResults",virtualCanvas:"virtualCanvas",listItem:"listItem",loaded:"loaded",loadedImage:"loadedImage",searchOutputWrapper:"searchOutputWrapper",divider:"divider",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle"};const YL=e=>{const t="undefined"!=typeof window?window.innerWidth:e;return t<=700?1:t<=1100?2:t<=1600?3:4},XL=e=>e.images.downsized.url,KL=({setImageGifList:n,imageGifList:i=[],currentReqGif:s,setCurrentReqGif:l,inputRef:d,customRequest:h})=>{const{t:f}=ri(),{GifPlayIcon:p}=Mo(),{options:g}=Oo(),{config:m}=g,v=Os({maxConcurrent:6}),[y,b]=o(null),[w,x]=o(new Set),[C,_]=o(!1),[A,k]=o(!1),[E,F]=o(!1),[O]=I.useForm(),P=u(s),M=u(null),R=u(null),L=u(null),N=u(0),j=u(0),D=u(new Set);a(()=>{P.current=s},[s]),a(()=>{O.setFieldsValue({keywords:s.keywords})},[]);const z=null==m?void 0:m.handleProxyUrl,B=null==m?void 0:m.fetchWithProxy,U=async e=>z?Promise.resolve(z(e)):e,V=c(async e=>B?Promise.resolve(B(e,void 0,{intent:"metadata"})):fetch(await U(e)),[B,U]),H=async function({query:e,page:t}){var r;const n=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const e=`https://api.giphy.com/v1/gifs/search?api_key=${null!==(r=null==m?void 0:m.REACT_APP_GIPHY_KEY)&&void 0!==r?r:"Nh77eBlPeMn1ed9MBAvL542NUGeNO26F"}&q=${encodeURIComponent(n)}&limit=50&offset=${t}&lang=en`,i=await V(e);return{data:await i.json()}}catch(e){console.warn(e)}},{positionedItems:W,containerHeight:$,isNearEnd:q,viewportMetrics:G,handleViewportChange:Y}=$L({items:i,getId:e=>e.id,getPreviewSrc:XL,getAltText:e=>e.title,getWidth:e=>e.images.downsized.width?Number(e.images.downsized.width):void 0,getHeight:e=>e.images.downsized.height?Number(e.images.downsized.height):void 0,layoutMode:"masonry",minColumnWidth:240,estimatedItemHeight:220,prefetchThresholdPx:320,resolveColumnCount:YL}),X=Hs(Y,[i.length]),K=()=>{M.current&&(clearTimeout(M.current),M.current=null)},Z=e=>!D.current.has(e)&&(D.current.add(e),!0),Q=e=>{D.current.delete(e)},J=c(async()=>{var e,t,r;const i=null===(e=P.current.keywords)||void 0===e?void 0:e.trim();if(!i||C||A||!E)return;const o=`gif:${i}:${j.current}`;if(!Z(o))return;const a=N.current;k(!0);try{const e=await H({query:P.current,page:j.current});if(a!==N.current)return;const i=null!==(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.data)&&void 0!==r?r:[];if(!Array.isArray(i)||0===i.length)return void F(!1);const o=i;if(a!==N.current)return;n(e=>{const t=new Set(e.map(e=>e.id)),r=o.filter(e=>!t.has(e.id));return r.length>0?[...e,...r]:e}),j.current+=i.length,F(50===i.length)}finally{Q(o),a===N.current&&k(!1)}},[E,C,A,n]),ee=async()=>{var e,t;K();const r=null===(e=P.current.keywords)||void 0===e?void 0:e.trim();if(!r)return R.current=null,L.current=null,N.current+=1,j.current=0,n([]),x(new Set),F(!1),void k(!1);if(L.current===r)return;if(R.current===r||C&&R.current===r)return;const i=`gif:${r}:0`;if(!Z(i))return;const o=N.current+1;N.current=o,R.current=r,j.current=0,n([]),x(new Set),F(!1),k(!1),_(!0);try{const e=await H({query:P.current,page:0});if(o!==N.current)return;const i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.data;if(Array.isArray(i)&&i.length>0){const e=i;if(o!==N.current)return;n(e),j.current=i.length,F(50===i.length)}else n([]),F(!1);L.current=r}catch(e){F(!1)}finally{Q(i),R.current===r&&(R.current=null),_(!1)}};return a(()=>()=>{K()},[]),a(()=>{!C&&!A&&E&&i.length>0&&q&&J()},[E,i.length,q,J,C,A]),e("div",{className:GL.gifTab,children:e("div",{className:GL.searchOutputWrapper,children:t("div",{id:"scrollableDiv",ref:X,className:GL.scrollableDiv,children:[t(I,{form:O,onValuesChange:e=>{if(void 0!==e.keywords){const t=Object.assign(Object.assign({},P.current),{keywords:e.keywords});l(t),P.current=t,K(),M.current=setTimeout(ee,800)}},className:i.length>0?GL.searchResults:GL.search,children:[e(I.Item,{name:"keywords",className:GL.gifSearchInput,children:e(T,{onPressEnter:()=>{ee()},allowClear:!0,placeholder:f("Search GIFs"),ref:d,spellCheck:"false",prefix:e(Gi,{size:16,strokeWidth:null==m?void 0:m.iconStrokeWidth,onClick:()=>{ee()}})})}),i.length>0&&!C&&e("div",{className:`ant-divider ${GL.divider}`,role:"separator"})]}),!i.length&&!C&&e(r,{children:s.keywords?e(Do,{}):t("div",{className:GL.resultsContainer,children:[e("div",{className:GL.videoIcon,children:e(p,{className:GL.playButton})}),e("h1",{className:GL.title,children:f("Over 350,000 live images")}),e("p",{className:GL.subtitle,children:f("Enter a search query and we'll find the perfect image for you")})]})}),!i.length&&C&&e(Fl,{}),i.length>0&&t(r,{children:[e("div",{className:GL.virtualCanvas,style:{height:$},children:W.map(({row:r,layout:n})=>{const i=r.item,o=w.has(i.id),a=XL(i),s=n.bottom>=G.scrollTop-240&&n.top<=G.scrollTop+G.viewportHeight+240;return t("div",{className:`${GL.listItem} ${o?GL.loaded:""}`,onClick:()=>(async(e,t)=>{var r;b(t),setTimeout(()=>{b(null)},2e3);let n=e.split("?")[0].split("#")[0].split("/"),i=n[n.length-1]||"uploaded-file";i.includes(".")&&(null===(r=i.split(".").pop())||void 0===r?void 0:r.length)&&i.split(".").pop().length<=5||(i+=".gif"),h(e,i)})(i.images.downsized.url,i.id,i.title),style:{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height,minHeight:n.height,maxHeight:"none",marginBottom:0},children:[e(qL,{imageId:i.id,sourceUrl:a,shouldLoad:s,loader:v,className:y===i.id?GL.loadedImage:"",width:"100%",height:"100%",alt:i.title,decoding:"async",onLoad:()=>{x(e=>{if(e.has(i.id))return e;const t=new Set(e);return t.add(i.id),t})}}),e("a",{rel:"noreferrer",href:"https://giphy.com/",target:"_blank",onClick:e=>e.stopPropagation()}),y===i.id&&e(S,{className:GL.antSpin})]},i.id)})}),A&&e(Fl,{})]})]})})})};var ZL={stockTab:"stockTab",stockSearchInput:"stockSearchInput",searchOutputWrapper:"searchOutputWrapper",divider:"divider",search:"search",searchResults:"searchResults",virtualCanvas:"virtualCanvas",scrollableDiv:"scrollableDiv",listItem:"listItem",loaded:"loaded",loadedImage:"loadedImage",creatorInfo:"creatorInfo",stockColorFilter:"stockColorFilter",allColors:"allColors",blackColor:"blackColor",bwColor:"bwColor",whiteColor:"whiteColor",orangeColor:"orangeColor",redColor:"redColor",purpleColor:"purpleColor",magentaColor:"magentaColor",greenColor:"greenColor",tealColor:"tealColor",blueColor:"blueColor",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle"};const QL=e=>{const t="undefined"!=typeof window?window.innerWidth:e;return t<=650?1:t<=1e3?2:t<=1450?3:4},JL=(e,t)=>{const r=new URL(e);return r.searchParams.set("w",t.toString()),r.toString()},eN=({imageStockList:n,setImageStockList:i,currentReq:s,setCurrentReq:l,inputRef:d,customRequest:h})=>{var f,p;const{t:g}=ri(),{StockBigIcon:m,MixedViewIcon:v,LandscapeViewIcon:y,PortraitViewIcon:b,SquareViewIcon:w}=Mo(),{options:x}=Oo(),{config:C}=x,_=Os({maxConcurrent:6}),[A,k]=o(!1),[E,F]=o(!1),[O,M]=o(!1),[R,L]=o(null),[N,j]=o(new Set),[D]=I.useForm(),B=null==C?void 0:C.fetchWithProxy,V=null==C?void 0:C.handleProxyUrl,H=null!==(f=null==C?void 0:C.UNSPLASH_KEY)&&void 0!==f?f:"HX2_qqq3F3ljmtYtfmb9P6h0dn2u9mnnOl36IdV8el0",W=(null===(p=null==C?void 0:C.locale)||void 0===p?void 0:p.slice(0,2))||"ru",$=u(s),q=u(null),G=u(null),Y=u(0),X=u(1),K=u(new Set),Z=async e=>V?Promise.resolve(V(e)):e,Q=c(async e=>B?Promise.resolve(B(e,void 0,{intent:"metadata"})):fetch(await Z(e)),[B,Z]),ee=()=>{q.current&&(clearTimeout(q.current),q.current=null)},te=e=>!K.current.has(e)&&(K.current.add(e),!0),re=e=>{K.current.delete(e)},ne=e=>e.map(e=>Object.assign(Object.assign({},e),{urls:{raw:JL(e.urls.raw,1200),small:JL(e.urls.raw,540)}}));a(()=>{$.current=s},[s]),a(()=>{0===n.length&&D.setFieldsValue({color:"",orientation:""})},[n,D]),a(()=>{D.setFieldsValue({keywords:s.keywords,color:s.color,orientation:s.orientation})},[]);const ie=async function({query:e,page:t}){const r=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{let n=`https://api.unsplash.com/search/photos?client_id=${H}&lang=${W}&per_page=30&query=${encodeURIComponent(r)}&page=${t}`;""!==e.color&&(n+=`&color=${e.color}`),""!==e.orientation&&(n+=`&orientation=${e.orientation}`);const i=await Q(n);return{data:await i.json()}}catch(e){console.warn(e)}},{positionedItems:oe,containerHeight:ae,isNearEnd:se,viewportMetrics:le,handleViewportChange:ce}=$L({items:n,getId:e=>e.id,getPreviewSrc:e=>e.urls.small,getAltText:e=>e.description||e.user.name,getWidth:e=>e.width,getHeight:e=>e.height,layoutMode:"masonry",minColumnWidth:240,estimatedItemHeight:220,prefetchThresholdPx:320,resolveColumnCount:QL}),ue=Hs(ce,[n.length]),de=c(async()=>{var e,t;if(A||E||!O||!$.current.keywords.trim())return;const r=Y.current,n=X.current,o=`stock:${`${$.current.keywords.trim()}|${$.current.color}|${$.current.orientation}`}:${n}`;if(te(o)){F(!0);try{const o=await ie({query:$.current,page:n});if(r!==Y.current)return;const a=null!==(t=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[];if(0===a.length)return void M(!1);const s=ne(a);if(r!==Y.current)return;i(e=>{const t=new Set(e.map(e=>e.id)),r=s.filter(e=>!t.has(e.id));return r.length>0?[...e,...r]:e}),X.current=n+1,M(30===a.length)}finally{re(o),r===Y.current&&F(!1)}}},[O,A,E,i]),he=async()=>{var e,t;ee();const r=`${$.current.keywords.trim()}|${$.current.color}|${$.current.orientation}`;if(!$.current.keywords.trim())return void(G.current=null);if(G.current===r)return;const n=`stock:${r}:1`;if(!te(n))return;const o=Y.current+1;Y.current=o,k(!0),F(!1),M(!1),X.current=1,i([]),j(new Set);try{const n=await ie({query:$.current,page:1});if(o!==Y.current)return;const a=null!==(t=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[];if(a.length>0){const e=ne(a);if(o!==Y.current)return;i(e),X.current=2,M(30===a.length)}else M(!1);G.current=r}finally{re(n),k(!1)}};a(()=>()=>{ee()},[]),a(()=>{!A&&!E&&O&&n.length>0&&se&&de()},[O,n.length,se,de,A,E]);const fe=async(e,t,r,n)=>{var i;!async function(e){try{const t=`${e}${e.includes("?")?"&":"?"}client_id=${H}`,r=await Q(t);return{data:await r.json()}}catch(e){console.warn(e)}}(t.download_location),L(r),setTimeout(()=>L(null),2e3);const o=e.raw,a=o.split("?")[0].split("#")[0].split("/");let s=a[a.length-1]||"uploaded-file";s.includes(".")&&(null===(i=s.split(".").pop())||void 0===i?void 0:i.length)&&s.split(".").pop().length<=5||(s+=".jpg"),h(o,s)};return e("div",{className:ZL.stockTab,children:e("div",{className:ZL.searchOutputWrapper,children:t("div",{className:ZL.scrollableDiv,id:"scrollableDiv",ref:ue,children:[t(I,{form:D,initialValues:gr,onValuesChange:(e,t)=>{const r=Object.assign(Object.assign({},gr),t);l(r),$.current=r,ee(),""!==r.keywords?q.current=setTimeout(he,800):(G.current=null,Y.current+=1,X.current=1,i([]),j(new Set),M(!1),F(!1),l(Object.assign({},gr)),$.current=gr,D.resetFields())},className:n.length>0?ZL.searchResults:ZL.search,children:[t(U,{gutter:24,children:[e(z,{span:n.length>0?void 0:24,children:e(I.Item,{name:"keywords",className:ZL.stockSearchInput,children:e(T,{allowClear:!0,placeholder:g("Search image"),ref:d,spellCheck:"false",prefix:e(Gi,{size:16,strokeWidth:null==C?void 0:C.iconStrokeWidth})})})}),!!n.length&&t(r,{children:[e(z,{children:e(I.Item,{name:"orientation",children:t(J.Group,{onChange:e=>l(t=>Object.assign(Object.assign({},t),{orientation:e.target.value})),children:[e(P,{title:g("All"),placement:"top",children:e(J.Button,{value:"",children:e(v,{})})}),e(P,{title:g("Landscape"),placement:"top",children:e(J.Button,{value:"landscape",children:e(y,{})})}),e(P,{title:g("Portrait"),placement:"top",children:e(J.Button,{value:"portrait",children:e(b,{})})}),e(P,{title:g("Squarish"),placement:"top",children:e(J.Button,{value:"squarish",children:e(w,{})})})]})})}),e(z,{children:e(I.Item,{name:"color",children:t(J.Group,{className:ZL.stockColorFilter,onChange:e=>l(t=>Object.assign(Object.assign({},t),{color:e.target.value})),children:[e(P,{title:g("All"),placement:"top",children:e(J.Button,{className:ZL.allColors,value:"",children:"All"})}),e(P,{title:g("Black"),placement:"top",children:e(J.Button,{className:ZL.blackColor,value:"black",children:"B"})}),e(P,{title:g("Black and White"),placement:"top",children:e(J.Button,{className:ZL.bwColor,value:"black_and_white",children:"B&W"})}),e(P,{title:g("White"),placement:"top",children:e(J.Button,{className:ZL.whiteColor,value:"white",children:"W"})}),e(P,{title:g("Orange"),placement:"top",children:e(J.Button,{className:ZL.orangeColor,value:"orange",children:"O"})}),e(P,{title:g("Red"),placement:"top",children:e(J.Button,{className:ZL.redColor,value:"red",children:"R"})}),e(P,{title:g("Purple"),placement:"top",children:e(J.Button,{className:ZL.purpleColor,value:"purple",children:"P"})}),e(P,{title:g("Magenta"),placement:"top",children:e(J.Button,{className:ZL.magentaColor,value:"magenta",children:"M"})}),e(P,{title:g("Green"),placement:"top",children:e(J.Button,{className:ZL.greenColor,value:"green",children:"G"})}),e(P,{title:g("Teal"),placement:"top",children:e(J.Button,{className:ZL.tealColor,value:"teal",children:"T"})}),e(P,{title:g("Blue"),placement:"top",children:e(J.Button,{className:ZL.blueColor,value:"blue",children:"B"})})]})})})]})]}),n.length>0&&!A&&e("div",{className:`ant-divider ${ZL.divider}`,role:"separator"})]}),!n.length&&!A&&e(r,{children:s.keywords?e(Do,{}):t("div",{className:ZL.resultsContainer,children:[e("div",{className:ZL.videoIcon,children:e(m,{className:ZL.playButton})}),e("h1",{className:ZL.title,children:g("Millions of free stock images")}),e("p",{className:ZL.subtitle,children:g("Enter a search query and we'll find the perfect image for you")})]})}),!n.length&&A&&e(Fl,{}),n.length>0&&t(r,{children:[e("div",{className:ZL.virtualCanvas,style:{height:ae},children:oe.map(({row:r,layout:n})=>{const i=r.item,o=N.has(i.id),a=n.bottom>=le.scrollTop-240&&n.top<=le.scrollTop+le.viewportHeight+240;return t("div",{className:`${ZL.listItem} ${o?ZL.loaded:""}`,onClick:()=>fe(i.urls,i.links,i.id,i.description),style:{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height,minHeight:n.height,maxHeight:"none",marginBottom:0},children:[e(qL,{imageId:i.id,sourceUrl:i.urls.small,shouldLoad:a,loader:_,className:R===i.id?ZL.loadedImage:"",width:"100%",height:"100%",alt:i.description,decoding:"async",onLoad:()=>{j(e=>{if(e.has(i.id))return e;const t=new Set(e);return t.add(i.id),t})}}),t("p",{className:ZL.creatorInfo,onClick:e=>e.stopPropagation(),children:[g("Photo by")," ",e("a",{target:"_blank",href:`${i.user.links.html}?utm_source=${null==C?void 0:C.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:i.user.name})," ",g("on")," ",e("a",{target:"_blank",href:`https://unsplash.com/?utm_source=${null==C?void 0:C.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:"Unsplash"})]}),R===i.id&&e(S,{className:ZL.antSpin})]},i.id)})}),E&&e(Fl,{})]})]})})})},tN=()=>{const{options:e}=Oo(),t=e.config;return c((e,r)=>{!1!==(null==t?void 0:t.pushToGTM)&&((e,t)=>{const r=()=>{try{const t=Object.assign(Object.assign({},e),{appLabel:"blocks_app"});window.dataLayer&&"function"==typeof window.dataLayer.push&&window.dataLayer.push(t)}catch(e){console.error("Ошибка при вызове GTM:",e)}};t?setTimeout(r,t):r()})(e,r)},[null==t?void 0:t.pushToGTM])};var rN="slideshowContainer",nN="slideshowImage";const iN=({images:t,transitionDuration:r=1e3,frameHeight:n})=>{const[i,s]=o([]),[l,c]=o(n);a(()=>{const e=()=>{if("undefined"==typeof window)return void c(n);const e=window.innerHeight,t=Math.max(e-260,130);if("number"==typeof n){const e=Math.min(n,t);c(e)}else c(t)};if(e(),"undefined"!=typeof window)return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[n]);const u=()=>{s(e=>e.map((t,r)=>r===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:rN,style:{height:l,minHeight:130},children:i.map((t,n)=>e("img",{src:`data:image/jpeg;base64, ${t.src}`,alt:`Slide ${n+1}`,className:nN,style:{opacity:t.opacity,transition:`opacity ${r}ms linear`,display:"block"}},n))})},oN=t=>{var{className:r,style:n,color:i,text:o,bordered:a}=t,s=Zs(t,["className","style","color","text","bordered"]);const l=o||"";return e(ee,Object.assign({style:n,color:i,bordered:a,className:r},s,{children:l}))},aN=({text:r,counter:n,limits:i,wrapperStyles:o})=>{const{t:a}=ri(),{options:s}=Oo(),l=s.config,{token:c}=A.useToken(),u=+i>0,d=!u||n<+i,h=(null==l?void 0:l.billingPageUrl)||"/billing",f=n+" "+a("of")+" "+(u?i:"∞")+" "+(r||a("tests",{count:i}))+" "+a("was used",{count:n});return t("div",{className:"limits-couter-wrapper",style:o,children:[e(oN,{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 sN={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 lN=f(({className:t,onClick:r})=>e("div",{className:`${sN.arrow} ${sN.arrowNext} ${t||""}`,onClick:r,children:e(M,{className:`${sN.arrowBtn} ${sN.arrowBtnNext}`,size:"large",icon:e(Ce,{})})}));lN.displayName="SampleNextArrow";const cN=f(({className:t,onClick:r})=>e("div",{className:`${sN.arrow} ${sN.arrowPrev} ${t||""}`,onClick:r,children:e(M,{className:`${sN.arrowBtn} ${sN.arrowBtnPrev}`,size:"large",icon:e(_e,{})})}));cN.displayName="SamplePrevArrow";const uN=({customRequest:r,inputAiRef:n,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,setAiImageRequest:f,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v})=>{const{t:y}=ri(),{AiIcon_2:b}=Mo(),w=i.useRef(null),[x,C]=o("auto"),{aiImageCounter:_,currentAiImgLimits:S,loadingDuringGeneration:A,requestStatus:k,handleGenerate:E,convertBase64ToFile:F,isShiftPressed:O,setIsShiftPressed:P,limitsInPlugin:R}=function({setFrameHeight:e,customRequest:t,aiTabRef:r,isImageUploaded:n,setIsImageUploaded:i,aiImageRequest:s,imageAiList:l,setImageAiList:h,isLoadingAi:f,setIsLoadingAi:p}){const{t:g}=ri(),{options:m}=Oo(),v=m.config,y=Yo(),b=tN(),{messages:w}=m.config,[x,C]=o([]),[_,S]=o(0),[A,k]=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||A||(C([]),M.current.clear(),R.current.clear(),L.current.clear(),D.current=-1)},[l,A]);const N=d(()=>v&&"function"==typeof(null==v?void 0:v.sendAIImageRequest)?null==v?void 0:v.sendAIImageRequest:()=>Promise.resolve({}),[v]),j=c(e=>{const t=`${A}-${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=A,r=Array.isArray(e.images)?e.images:[];r.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:r}})),k(null),P(!1)}}else if(e.data&&(h([String(e.data)]),100===e.progress)){p(!1);const t=A,r=e.data?[String(e.data)]:[];r.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:r}})),k(null),P(!1)}}else p(!1),P(!1),A&&!R.current.has(A)&&(R.current.add(A),y.error({id:"AI_RESPONSE_INVALID",message:g("Something went wrong, please try again"),placement:"bottomRight",description:String(A)||void 0,data:{requestId:A,request:s,response:e},innerException:e}))},[s,h,F,g,p,A,y,P]),D=u(-1);a(()=>{if(x.length>0){const e=x.length-1;e>D.current&&(D.current=e,j(x[e]))}},[j,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:H}=(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)&&dr,G=c(()=>{B.fire({name:"AiImgCount",count:_+1})},[B,_]),Y=d(()=>!$&&!q,[$,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}),N({body:{project_id:V,request:"create-image",connection:"midjourney",message:s}}).then(e=>{var t,r,n,i,o,a,l,c,u;const{data:d,error:f}=e||{};if(f)throw f;const m=d;if(401===(null==m?void 0:m.status)||401===(null===(t=null==m?void 0:m.data)||void 0===t?void 0:t.status))throw new Error("ERROR");const v=null!==(r=null==m?void 0:m.data)&&void 0!==r?r:m;if((null==v?void 0:v._eventResult)&&Array.isArray(null===(n=v.task)||void 0===n?void 0:n.images)&&(null!==(o=null===(i=v.task.images)||void 0===i?void 0:i.length)&&void 0!==o?o:0)>0){const e=v.task.images;return h(e),p(!1),P(!1),void k(null)}const b=(null==m?void 0:m.task)||(null===(a=null==m?void 0:m.data)||void 0===a?void 0:a.task),w=null!==(c=null!==(l=null==b?void 0:b.id)&&void 0!==l?l:A)&&void 0!==c?c:void 0;200===(null==m?void 0:m.status)||200===(null===(u=null==m?void 0:m.data)||void 0===u?void 0:u.status)?((null==b?void 0:b.id)&&(F(b.message),k(b.id)),(null==m?void 0:m.message)&&y.success({id:"AI_IMAGE_GENERATION_STARTED",message:m.message,placement:"bottomRight",data:{request:s,taskId:w,response:null==m?void 0:m.data}}),z({task_id:null==b?void 0:b.id,entity_id:U})):(p(!1),P(!1),w&&!R.current.has(w)&&(R.current.add(w),y.error({id:"AI_IMAGE_GENERATION_FAILED",message:(null==m?void 0:m.message)||g("Something went wrong, please try again"),placement:"bottomRight",description:s,data:{request:s,taskId:w,response:m},innerException:m})))}).catch(e=>{p(!1),P(!1);const t=e;return((null==t?void 0:t.error)||(null==t?void 0:t.data))&&A&&!R.current.has(A)&&(R.current.add(A),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:A,response:null==t?void 0:t.data,error:Jo(null==t?void 0:t.error)}})),t}))},[s,f,p,P,h,b,U,V,N,y,z,g,A]),K=c(()=>{Y&&X()},[Y,q,S,G,X,y,g]);a(()=>{},[v,q]);const Z=c(e=>{if(n)return;const r=e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);if(!r)return;const o=r[1],a=r[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.error("FM AI: customRequest error",e)}finally{i(!1)}})()},[n,i,t]);return a(()=>{(f||l.length>0)&&setTimeout(()=>{var t,n;let i=350;if(r.current){const e=null===(t=r.current)||void 0===t?void 0:t.firstChild;e&&e instanceof HTMLElement&&(i=(null===(n=r.current.getBoundingClientRect())||void 0===n?void 0:n.height)-48-e.clientHeight)}e(i)},0)},[r,l.length,f,e]),{aiImageCounter:_,setAiImageCounter:S,currentAiImgLimits:W,isFieldsDisabled:$,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:A,setCurrentReqId:k,limitsInPlugin:q}}({setFrameHeight:C,customRequest:r,aiTabRef:w,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v});a(()=>{},[s]);const[L,N]=o(!1),j=c(()=>N(!0),[]),D=c(()=>N(!1),[]),B=c(e=>f(e.target.value),[f]),V=c(e=>{"Shift"===e.key?P(!0):"Enter"!==e.key||O||(e.preventDefault(),E())},[O,E,P]),H=c(e=>{"Shift"===e.key&&P(!1)},[P]);return t("div",{className:sN.imageAi,ref:w,children:[R&&e(aN,{text:"images",counter:_,limits:S,wrapperStyles:{marginTop:-25}}),e(U,{gutter:24,className:sN.row,children:t(z,{span:24,children:[e(I.Item,{children:t("span",{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg ${sN.inputAffixWrapper}${L?" ant-input-affix-wrapper-focused":""}`,children:[e(T.TextArea,{ref:n,onKeyDown:V,onKeyUp:H,onFocus:j,onBlur:D,autoSize:!0,allowClear:!0,className:`${sN.textAreaInputHybrid} ${sN.textarea}`,placeholder:y("Generate image"),value:h,onChange:B,spellCheck:"false"}),e("span",{className:`ant-input-suffix ${sN.inputSuffix}`,children:m||A?e(ie,{className:`${sN.inputIcon} input-icon`,spin:!0}):e(b,{className:`${sN.inputIcon} input-icon`,onClick:E})})]})}),t("div",{className:sN.imageAiExample,children:[e("span",{children:y("For example:")})," ",y("A beautiful image of a sunset over a calm ocean.")]})]})}),(m||p.length>0)&&t(te,{dotPosition:"top",arrows:!0,nextArrow:e(lN,{}),prevArrow:e(cN,{}),className:sN.carousel,infinite:!1,children:[m&&!p.length&&e("div",{className:sN.loading,children:t("div",{className:"spin",children:[e(ie,{style:{fontSize:48},spin:!0}),e("p",{className:"status",children:k})]})}),p.length>0&&p.map((r,n)=>t("div",{className:sN.imageItem,children:[e(iN,{images:p,frameHeight:x}),e("div",{className:"buttons",children:p.length>0&&!m&&e(M,{onClick:()=>F(`data:image/jpeg;base64, ${r}`),loading:s,icon:e(Se,{}),children:y("Use this variant")})})]},n))]})]})},dN=e=>{(null==e?void 0:e.customTheme)&&((e={})=>{const t=document.querySelector("head");if(!t)return;const r=document.createElement("style");if(r.type="text/css",r.dataset.themeVariablesFm="true",r.setAttribute("data-file-manager","true"),Object.entries(e).length){let n="";Object.entries(e).forEach(([e,t])=>{"object"!=typeof t&&(n+=`\t--${e}: ${t};\n`)}),n=`.em-filemanager {\n${n}}`,r.appendChild(document.createTextNode(n));const i=t.querySelector('[data-theme-variables-fm="true"]');i?t.replaceChild(r,i):t.insertBefore(r,t.firstChild)}})(null==e?void 0:e.customTheme)},{Sider:hN,Content:fN}=Q,pN=i.lazy(()=>import("./file-manager-IconsTab-ChxfMtuF.js")),gN=i.lazy(()=>import("./file-manager-ImageCodeGenerator-BxCMOvUC.js")),mN={keywords:""},vN=()=>{var s,l,d;const h=la(),f=Fs(),p=(()=>{var e,t;const{state:r,actions:n,options:i}=Oo(),{selectedFolder:o,pathHistory:a,folders:s}=r,{t:l}=ri(),{setSelectedFolder:u,setPathHistory:d}=n,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(`Cycle detected in the path to the folder with id=${e}`),[];const r=(Array.isArray(s)?s:[]).find(t=>t.id===e);if(!r)return[];const n=new Set(t);return n.add(e),r.parentId?r.parentId===r.id?(console.warn(`Cycle detected: folder ${r.id} is a parent of itself`),[{id:r.id,name:r.name+" (ошибка)"}]):[...f(r.parentId,n),{id:r.id,name:r.name}]:[{id:r.id,name:r.name}]},[s]),p=c(e=>{var t;if("undefined"==typeof window)return;const r=!0===(null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.rememberLastFolder),n=h();try{if(!r)return void localStorage.removeItem(n);e?localStorage.setItem(n,e):localStorage.removeItem(n)}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([]))}const t=(Array.isArray(s)?s:[]).find(t=>t.id===e);if(!t)return void console.warn("⚠️ Folder not found:",e);const r=f(e),n=[{id:"folders",name:l("Folders")},...r];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),r=t[t.length-1],n="folders"===r.id?void 0:r.id;null==u||u(n||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}})(),g=(()=>{const{state:e,actions:t}=Oo(),{pagination:r}=e,{setPagination:n}=t,i=c((e,t)=>{const i=t||r.pageSize;null==n||n({current:e,pageSize:i,total:r.total})},[r.pageSize,r.total,n]);return{state:{pagination:r},actions:{handlePaginationChange:i}}})(),m=(()=>{const[e,t]=o([]),[r,n]=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=>ki(e.size),[]),f=c((e,r)=>{const i=r.map(t=>({id:d(),folderId:e,name:t.name,size:h(t),status:"uploading",progress:0}));return t(i),n(!0),a(!1),i.map(e=>e.id)},[d,h]),p=c((e,r)=>{const i={id:d(),folderId:e,name:r,size:void 0,status:"uploading",progress:0};return t(e=>[...e,i]),n(!0),a(!1),i.id},[d]),g=c((e,r)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{progress:Math.min(100,Math.max(0,r))}):t))},[]),m=c((e,r)=>{r&&l.current.set(e,r),t(t=>t.map(t=>{if(t.id===e){const e=Object.assign(Object.assign({},t),{status:"success",progress:100});return(null==r?void 0:r.name)&&(e.name=r.name),(null==r?void 0:r.size)&&void 0===t.size&&(e.size=ki(r.size)),e}return t}))},[]),v=c((e,r)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{status:"error",error:r}):t))},[]),y=c(()=>{n(!1),a(!1),setTimeout(()=>{t([]),l.current.clear()},300)},[]),b=c(()=>{a(e=>!e)},[]),w=c(e=>l.current.get(e),[]),x=e.length,C=e.filter(e=>"success"===e.status||"error"===e.status).length;return{uploadFiles:e,isUploadVisible:r,isUploadMinimized:i,totalFiles:x,completedFiles:C,startUpload:f,startUploadByUrl:p,updateProgress:g,markAsSuccess:m,markAsError:v,getUploadedFile:w,closeUpload:y,minimizeUpload:b}})(),v=gs(),{deleteItems:y}=ca(),b=Yo(),{t:w}=ri(),{options:C,state:_,actions:A}=Oo(),k=C,E=null==k?void 0:k.onChangeSelection,I=_,T=null==k?void 0:k.config,{dataProviders:F}=k,{form:O,urlForm:P,renameForm:M,moveForm:R,renameFolderForm:L,copyForm:N,isModalVisible:j,isUrlModalVisible:D,isMoveModalVisible:z,isRenameFolderModalVisible:B,isCopyModalVisible:U,isDeleteConfirmVisible:V,folderToRename:H,activeLibraryItem:W}=_,{setIsUrlModalVisible:$,setActiveLibraryItem:q}=A,{config:G}=C,{DropZoneFileIcon:Y}=Mo(),[K,Z]=o(!1),[J,ee]=o(!1),[te,re]=o(!1),ne=u(0),ie=u(!1);ie.current=J;const oe=i.useRef(null),ae=i.useRef([]),[se,le]=o(!1),[ce,ue]=o(!1),de=ws(e=>e.selectedFiles),he=ws(e=>e.clearSelection),fe=ws(e=>e.syncVisibleFiles),{folders:pe,loading:ge}=h.state,{fetchFolders:me,fetchChildFolders:ve,handleCreateFolder:ye,handleModalOk:be,handleModalCancel:we,generateMenuItems:xe}=h.actions,Ce=(e=>{var t;const{state:r,actions:n,options:i}=Oo(),{t:o}=ri(),a=Yo(),{folders:s,folderToRename:l,renameFolderForm:u,isRenameFolderModalVisible:d}=r,{setFolderToRename:h,setIsRenameFolderModalVisible:f}=n,{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,r;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!==(r=s.parentId)&&void 0!==r?r:null}}),y(),await e(),l!==s.id&&n.setSelectedFolder&&n.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}}})(me),{files:_e,loading:Se,isRenamingFile:Ae,fileToRename:Ee}=f.state,{fetchFiles:Ie,handleDeleteFile:Te,handleDeleteFolder:Fe,handleAddFile:Oe,handleAddFileByUrl:Pe,showRenameModal:Me,handleRenameCancel:Re,handleRenameOk:Le,handleDroppedFiles:Ne,showMoveModal:je,handleMoveCancel:De,handleMoveOk:ze,handleCopyOk:Be,handleCopyCancel:Ue,showDeleteConfirm:Ve,handleDeleteConfirmCancel:He,handleDeleteConfirmOk:We}=f.actions,{selectedFolder:$e,pathHistory:qe}=p.state,{handleFolderSelect:Ge,handleItemClick:Ye}=p.actions,{pagination:Xe}=g.state,Ke=$o(Ie),{searchTerm:Ze,sortBy:Qe,sortOrder:Je}=Ke.state,{handleSearch:et,handleSort:tt,handlePaginationChange:rt}=Ke.actions,nt=c(async()=>{const e=(e=>ia(e))(qe||[]);try{await sa({options:k,pathFolder:e,dataProviders:null==k?void 0:k.dataProviders})}catch(e){console.error("Cache clear failed:",e)}await me(),await Ie({folderId:$e||"",page:Xe.current,limit:Xe.pageSize,search:Ze,sortBy:Qe,sortOrder:Je,itemType:"all"})},[Ie,me,k,Xe,qe,Ze,$e,Qe,Je]),it=(({files:e,fetchFiles:t,selectedFolder:r})=>{var i;const{t:o}=ri(),a=Yo(),{options:s,actions:l,state:c}=n.useContext(Fo),{setActiveLibraryItem:u}=l,{activeLibraryItem:d}=c,h=gs(),[f,p]=n.useState(!1),[g,m]=n.useState(null),v=n.useCallback(e=>{var t;if(e.type&&e.type.startsWith("image/"))return!0;if(e.extension){const t=e.extension.toLowerCase();return fr.includes(t)}const r=null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();return!!r&&fr.includes(r)},[]),y=n.useCallback(async(e,t)=>{var r,n;const{dataProviders:i}=s;if(!1===(null===(n=null===(r=s.config)||void 0===r?void 0:r.features)||void 0===n?void 0:n.enableUpdateFile))throw new ua(o("Updating files is disabled by configuration"),"UnsupportedOperation");if(!e.id||!e.thumbnail||!(null==i?void 0:i.updateFile))throw new ua(o("Failed to save changes"),"UnsupportedOperation");const a=(null==t?void 0:t.mimeType)||kr(e.thumbnail,e.type),l=Er(a),c=e.name.lastIndexOf("."),u=`${c>0?e.name.substring(0,c):e.name}.${l}`,d=(null==t?void 0:t.blob)||Mr(e.thumbnail,a);return i.updateFile(e.id,{name:u,type:a,data:d})},[s,o]),b=n.useCallback(async(e,t)=>{var r,n,i;if(!e.thumbnail)throw new ua(o("Failed to save changes"),"ValidationError");const a=!(!0===(null===(r=s.config)||void 0===r?void 0:r.saveCopyToCurrentFolder))||(null!==(n=e.saveWithoutFolder)&&void 0!==n?n:!e.id),l=a?void 0:null!==(i=e.folderId)&&void 0!==i?i:void 0,c=(null==t?void 0:t.mimeType)||kr(e.thumbnail,e.type),u=(null==t?void 0:t.blob)||Mr(e.thumbnail,c),d=new File([u],e.name,{type:c,lastModified:Date.now()}),f=await h.uploadFileWithProvider(d,l,void 0,a);if(!f)throw new ua(o("Failed to save image copy"),"FileWriteError");return f},[h,null===(i=s.config)||void 0===i?void 0:i.saveCopyToCurrentFolder,o]),w=n.useCallback(t=>{let r;if(t)r=t;else{const t=ws.getState().selectedFiles;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}u&&u(or),m(r),p(!0)},[e,v,p,u]),x=n.useCallback(()=>{u&&d===or&&u(Jt),p(!1),m(null)},[d,u]),C=n.useCallback(async(e,n)=>{var i,l,c,u,d,h;try{const c=await y(e,n);return a.success({id:"IMAGE_UPDATE_SUCCESS",message:o("Success"),description:o("Image updated successfully"),placement:"bottomRight",data:{itemId:null!==(i=null==c?void 0:c.id)&&void 0!==i?i:void 0,itemName:null==c?void 0:c.name,folderId:null!==(l=null==c?void 0:c.folderId)&&void 0!==l?l:null,thumbnail:null==c?void 0:c.thumbnail}}),c&&s.onEditorOk&&s.onEditorOk(c,{mode:n.mode}),await t({folderId:r||""}),x(),null!=c?c:void 0}catch(t){const r=Jo(t),n=null!==(u=null!==(c=Zo(null==r?void 0:r.code,o))&&void 0!==c?c:null==r?void 0:r.message)&&void 0!==u?u:o("Failed to save changes");throw a.error({id:"IMAGE_SAVE_FAILED",message:n,innerException:t,placement:"bottomRight",data:{itemId:null!==(d=e.id)&&void 0!==d?d:void 0,itemName:e.name,folderId:null!==(h=e.folderId)&&void 0!==h?h:null,thumbnail:e.thumbnail}}),t.notificationShown=!0,t}},[y,s,t,r,a,x,o]),_=n.useCallback(async(e,n)=>{var i,l,c,u,d,h;try{const c=await b(e,n);return a.success({id:"IMAGE_SAVE_COPY_SUCCESS",message:o("Success"),description:o("Image copy saved successfully"),placement:"bottomRight",data:{itemId:null!==(i=null==c?void 0:c.id)&&void 0!==i?i:void 0,itemName:null==c?void 0:c.name,folderId:null!==(l=null==c?void 0:c.folderId)&&void 0!==l?l:null,thumbnail:null==c?void 0:c.thumbnail}}),c&&s.onEditorOk&&s.onEditorOk(c,{mode:n.mode}),await t({folderId:r||""}),x(),null!=c?c:void 0}catch(t){const r=Jo(t),n=null!==(u=null!==(c=Zo(null==r?void 0:r.code,o))&&void 0!==c?c:null==r?void 0:r.message)&&void 0!==u?u:o("Failed to save image copy");throw a.error({id:"IMAGE_SAVE_COPY_FAILED",message:n,innerException:t,placement:"bottomRight",data:{itemId:null!==(d=e.id)&&void 0!==d?d:void 0,itemName:e.name,folderId:null!==(h=e.folderId)&&void 0!==h?h:null,thumbnail:e.thumbnail}}),t.notificationShown=!0,t}},[b,s,t,r,a,x,o]);return{isPixieEditorVisible:f,editingFile:g,handleEdit:w,handlePixieEditorSave:C,handlePixieEditorSaveCopy:_,handlePixieEditorClose:x}})({files:_e||[],fetchFiles:Ie,selectedFolder:$e||null}),[ot,at]=o(!1),st=c(e=>{if(e.preventDefault(),e.stopPropagation(),!e.dataTransfer||!e.dataTransfer.types||!e.dataTransfer.types.includes("Files"))return;e.dataTransfer.dropEffect="copy";const t=e.relatedTarget,r=e.currentTarget;t&&r.contains(t)||(ne.current+=1,ne.current>0&&Z(!0))},[]),lt=c(e=>{e.preventDefault(),e.stopPropagation();const t=e.relatedTarget,r=e.currentTarget;if(t&&!r.contains(t))ne.current=Math.max(0,ne.current-1),ne.current<=0&&Z(!1);else if(t){const e=t.closest('[class*="dragOverlay"]');if(e&&r.contains(e))return}},[]),ct=c(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},[]),ut=c(e=>{e.preventDefault(),e.stopPropagation(),Z(!1),ne.current=0;const t=(()=>{var t;const r=e.dataTransfer;if(!r)return[];if(null===(t=r.files)||void 0===t?void 0:t.length)return Array.from(r.files);const n=[];if(r.items)for(let e=0;e<r.items.length;e++){const t=r.items[e].getAsFile();t&&n.push(t)}return n})();t.length&&(at(!0),Ne(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error("Ошибка при загрузке файлов:",e)}).finally(()=>{at(!1)}))},[Ne]),dt=c(()=>{Z(!1),ne.current=0,document.body.removeAttribute("data-fm-dragging"),re(!1),ee(!1)},[]);i.useEffect(()=>{ae.current=_e||[]},[_e]);const ht=null==I?void 0:I.activeLibraryItem;a(()=>{const e=e=>{e?document.body.setAttribute("data-fm-dragging","true"):document.body.removeAttribute("data-fm-dragging")};let t=!1;const r=r=>{var n,i;!t&&(null===(i=null===(n=r.dataTransfer)||void 0===n?void 0:n.types)||void 0===i?void 0:i.includes("Files"))&&(t=!0,re(!0),e(!0),ht===Jt&&ee(!0))},n=r=>{const n=r.relatedTarget;(!n||!document.documentElement.contains(n))&&t&&(t=!1,re(!1),ee(!1),e(!1))};return window.addEventListener("dragenter",r,!0),window.addEventListener("dragleave",n,!0),()=>{window.removeEventListener("dragenter",r,!0),window.removeEventListener("dragleave",n,!0),document.body.removeAttribute("data-fm-dragging")}},[ht]),a(()=>{const e=e=>{var t,r;if(document.body.removeAttribute("data-fm-dragging"),re(!1),!(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files")))return;e.preventDefault();const n=(e=>{var t;if(!e)return[];if(null===(t=e.files)||void 0===t?void 0:t.length)return Array.from(e.files);const r=[];if(e.items)for(let t=0;t<e.items.length;t++){const n=e.items[t].getAsFile();n&&r.push(n)}return r})(e.dataTransfer);if(!n.length)return;const i=e.target,o=i.closest(`.${qs.filesContainer.replace(/\s+/g,".")}`)||i.closest("[data-files-container]"),a=i.closest(".em-filemanager")||i.closest(".file-manager__layout")||i.closest("[data-drop-overlay]")||i.closest("[data-drag-capture]");(ie.current||K||o||a)&&(e.preventDefault(),e.stopPropagation(),ee(!1),Z(!1),ne.current=0,at(!0),Ne(n).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error("Ошибка при загрузке файлов:",e)}).finally(()=>at(!1)))},t=e=>{var t,r;(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files"))&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",document.body.hasAttribute("data-fm-dragging")||(document.body.setAttribute("data-fm-dragging","true"),re(!0)),ht!==Jt||ie.current||ee(!0))},r=e=>{var t,r;(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files"))&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",document.body.setAttribute("data-fm-dragging","true"),re(!0))},n={capture:!0,passive:!1};return window.addEventListener("drop",e,n),window.addEventListener("dragover",t,n),window.addEventListener("dragenter",r,n),()=>{window.removeEventListener("drop",e,n),window.removeEventListener("dragover",t,n),window.removeEventListener("dragenter",r,n)}},[K,Ne,ht]),a(()=>{const e=e=>{K&&dt(),ee(!1),re(!1),document.body.removeAttribute("data-fm-dragging")};return window.addEventListener("dragend",e,!0),()=>window.removeEventListener("dragend",e,!0)},[K,dt]),a(()=>{let e=null;const t=t=>{K&&(e=setTimeout(()=>{K&&dt()},200))};return document.addEventListener("mouseup",t,!0),()=>{document.removeEventListener("mouseup",t,!0),e&&clearTimeout(e)}},[K,dt]),a(()=>{const e=e=>{"Escape"===e.key&&K&&dt()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[K,dt]),a(()=>{const e=e=>{K&&setTimeout(()=>{K&&dt()},100)};return document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}},[K,dt]);const ft=i.useCallback(async()=>{await We(),await me(),$e===ar&&ve&&await ve(ar),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var e,t;return null===(t=null===(e=oe.current)||void 0===e?void 0:e.refreshFileCounts)||void 0===t?void 0:t.call(e)})})},[me,ve,We,$e]),pt=i.useCallback(()=>{ue(!0)},[]),gt=i.useCallback(async()=>{var e,t;if($e!==ar)return console.error("Clear trash called outside of trash folder"),void ue(!1);try{if(null==F?void 0:F.cleanTrash){const t=await F.cleanTrash();await Ie({folderId:ar}),await(null===(e=oe.current)||void 0===e?void 0:e.refreshFileCounts()),t.success?b.success({id:"TRASH_CLEARED_SUCCESS",message:w("Trash cleared successfully"),description:w("{{count}} items permanently deleted",{count:t.deletedCount||0}),placement:"bottomRight"}):b.error({id:"TRASH_CLEAR_FAILED",message:w("Failed to clear trash"),placement:"bottomRight"})}else{const e=ae.current||[];if(0===e.length)return void ue(!1);const r=e.map(e=>({id:e.id,isFolder:e.isFolder})),n=await y({items:r,selectedFolder:ar,getItemNameById:t=>{var r;return(null===(r=e.find(e=>e.id===t))||void 0===r?void 0:r.name)||t||""},showNotifications:!1});await Ie({folderId:ar}),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts());const{successCount:i,failCount:o}=n;0===o?b.success({id:"TRASH_CLEARED_SUCCESS",message:w("Trash cleared successfully"),description:w("{{count}} items permanently deleted",{count:i}),placement:"bottomRight"}):i>0?b.warning({id:"TRASH_CLEARED_PARTIAL",message:w("Trash partially cleared"),description:w("{{succeeded}} items deleted, {{failed}} items failed",{succeeded:i,failed:o}),placement:"bottomRight"}):b.error({id:"TRASH_CLEAR_FAILED",message:w("Failed to clear trash"),placement:"bottomRight"})}ue(!1)}catch(e){console.error("Error clearing trash:",e),b.error({id:"TRASH_CLEAR_ERROR",message:w("Error clearing trash"),placement:"bottomRight"}),ue(!1)}},[$e,F,Ie,b,w,y]),mt=i.useCallback(()=>{ue(!1)},[]),vt=i.useCallback(async e=>{var t;await ze(e),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())},[ze]),yt=i.useCallback(async e=>{var t;await Be(e),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())},[Be]),bt=i.useCallback(async()=>{let e=[],t=new Map;const r=null==k?void 0:k.config;await Oe({onStartBatch:n=>{e=m.startUpload($e||void 0,n),t=new Map,n.forEach((n,i)=>{const o=e[i];o&&(t.set(n.name,o),t.set(Wr(n.name,r),o))})},onStart:n=>{if(0===e.length){e=m.startUpload($e||void 0,[n]);const i=e[0];i&&(t.set(n.name,i),t.set(Wr(n.name,r),i))}},onProgress:(e,r)=>{const n=t.get(e);n&&m.updateProgress(n,r)},onComplete:async e=>{var r;const n=t.get(e);if(n){await new Promise(e=>setTimeout(e,100));const t=null==_e?void 0:_e.find(t=>t.name===e&&!t.isFolder);m.markAsSuccess(n,t)}await(null===(r=oe.current)||void 0===r?void 0:r.refreshFileCounts())},onError:(r,n,i)=>{var o;const a=null!==(o=t.get(r))&&void 0!==o?o:null!=i&&i<e.length?e[i]:void 0;a&&m.markAsError(a,n)},onBatchComplete:async r=>{var n,i,o,a,s,l,c,u;for(let u=0;u<r.successes.length;u++){const d=r.successes[u],h=null===(n=r.uploadedFiles)||void 0===n?void 0:n.get(d),f=null!==(a=null!==(o=null!==(i=t.get(d))&&void 0!==i?i:(null==h?void 0:h.originalFileName)?t.get(h.originalFileName):void 0)&&void 0!==o?o:null!=(null==h?void 0:h.originalIndex)&&h.originalIndex<e.length?e[h.originalIndex]:void 0)&&void 0!==a?a:u<e.length?e[u]:void 0;if(f){let e;if(null==h?void 0:h.id){const t=h;e={id:t.id,name:null!==(s=t.name)&&void 0!==s?s:d,folderId:null!==(c=null!==(l=t.folderId)&&void 0!==l?l:$e)&&void 0!==c?c:null,isFolder:!1,size:t.size}}else await new Promise(e=>setTimeout(e,100)),e=null==_e?void 0:_e.find(e=>e.name===d&&!e.isFolder);m.updateProgress(f,100),m.markAsSuccess(f,e)}}r.errors.forEach(({fileName:e,error:r})=>{const n=t.get(e);n&&m.markAsError(n,r)}),await(null===(u=oe.current)||void 0===u?void 0:u.refreshFileCounts())}})},[Oe,m,_e,$e,null==k?void 0:k.config]),wt=i.useCallback(async(e,t,r,n)=>{var i,o;try{le(!0);let a=r||"uploaded-file";if(!r&&e){const t=e.split("?")[0].split("#")[0].split("/");a=t[t.length-1]||"uploaded-file";a.includes(".")&&(null===(i=a.split(".").pop())||void 0===i?void 0:i.length)&&a.split(".").pop().length<=5||(a+=".jpg")}const s=m.startUploadByUrl($e||void 0,a);try{const r=await Pe(e,t,!0,null!=n?n:"uploadByUrl");if(m.updateProgress(s,100),r){await new Promise(e=>setTimeout(e,100));const e=(null==_e?void 0:_e.find(e=>e.id===r.id&&!e.isFolder))||r;m.markAsSuccess(s,e)}else m.markAsSuccess(s);await(null===(o=oe.current)||void 0===o?void 0:o.refreshFileCounts())}catch(e){const t=Jo(e),r=na(t,w);m.markAsError(s,r)}}finally{le(!1)}},[Pe,m,$e,_e,w]),xt=i.useCallback(async({file:e})=>{var t;const r=m.startUpload($e||void 0,[e])[0];let n=0;const i=setInterval(()=>{n=Math.min(n+10+Math.floor(Date.now()%10),90),m.updateProgress(r,n)},200);try{const n=await v.uploadFileWithProvider(e,void 0,!0);if(clearInterval(i),m.updateProgress(r,100),n){await new Promise(e=>setTimeout(e,100));const e=(null==_e?void 0:_e.find(e=>e.id===n.id&&!e.isFolder))||n;m.markAsSuccess(r,e)}else m.markAsSuccess(r);const o=n&&n.folderId||$e||null;return Ge&&Ge(o&&"folders"!==o?o:"folders"),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts()),n}catch(e){clearInterval(i);const t=e instanceof Error?e.message:String(e);throw m.markAsError(r,t),e}},[v,m,$e,_e,Ge]),Ct=i.useCallback(async e=>{var t;if(Ne){const r=m.startUpload($e||void 0,e);e.forEach(async(e,t)=>{const n=r[t];if(!n)return;let i=0;const o=setInterval(()=>{i=Math.min(i+10+Math.floor(Date.now()%10),85),m.updateProgress(n,i)},200);setTimeout(()=>{clearInterval(o)},2e3)}),await Ne(e),r.forEach(e=>{m.updateProgress(e,100),m.markAsSuccess(e)}),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())}},[Ne,m,$e]),_t=i.useCallback(async e=>{var t;await Fe(e),await me(),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())},[Fe,me]),St=(({files:e,clearSelection:t,showRenameModal:r,showMoveModal:i,showCopyModal:o,handleDeleteFile:a,handleDeleteFolder:s,showDeleteConfirm:l,onEdit:c})=>{const u=n.useCallback(()=>{t()},[t]),d=n.useCallback(e=>{const t=ws.getState().selectedFiles;if(t&&1===t.size||e){const n=e||Array.from(t)[0];r(n)}},[r]),h=n.useCallback(t=>{const r=ws.getState().selectedFiles;if(r&&r.size>0||(null==t?void 0:t.id)){if(l)return void l();(t?[t.id]:r).forEach(t=>{const r=e.find(e=>e.id===t);r?r.isFolder?s(t):a(t):console.warn(`Объект с ID ${t} не найден в списке файлов`)})}},[e,a,s,l]);return{handleClearSelection:u,handleRename:d,handleDeleteSelected:h,handleCopy:n.useCallback(()=>{o()},[o]),handleMove:n.useCallback(()=>{i()},[i]),handleEdit:n.useCallback(()=>{c()},[c])}})({files:_e||[],clearSelection:he,showRenameModal:Me,showMoveModal:je,showCopyModal:f.actions.showCopyModal||(()=>{}),handleDeleteFile:Te,handleDeleteFolder:_t,showDeleteConfirm:Ve,onEdit:it.handleEdit}),At=ge||Se||ot;a(()=>{Cr()},[]),x(()=>{W!==Jt?he():fe(_e||[])},[W,_e,fe,he]),a(()=>{if(!E||W!==Jt)return;if(!cr.current)return void(cr.current=!0);const e=(Array.isArray(_e)?_e:[]).filter(e=>de.has(e.id));E(e)},[W,_e,de,E]),i.useEffect(()=>{if(!Ge||0===pe.length)return;const e=!1!==(null==T?void 0:T.rememberLastFolder),t=`em_fm:lastFolder:${(null==T?void 0:T.projectId)||"default"}`;if(e&&"undefined"!=typeof window)try{const e=localStorage.getItem(t),r=e&&pe.some(t=>t.id===e);if(r)return void Ge(e)}catch(e){}$e||Ge("folders")},[$e,Ge,pe,null==T?void 0:T.rememberLastFolder,null==T?void 0:T.projectId]);const{handleRenameFolderCancel:kt,handleRenameFolderOk:Et}=Ce.actions;a(()=>{const e=async e=>{if(W!==Jt)return;const t=document.activeElement;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||"true"===(null==t?void 0:t.getAttribute("contenteditable")))return;const r=e.clipboardData;if(!r)return;const n=Array.from(r.items),i=n.filter(e=>e.type.startsWith("image/"));if(i.length>0){const t=i.map(e=>e.getAsFile()).filter(e=>null!==e);return void(t.length>0&&(e.preventDefault(),await Ct(t)))}const o=n.find(e=>"text/plain"===e.type);o&&o.getAsString(async t=>{const r=t.trim();if(r.startsWith("http://")||r.startsWith("https://"))e.preventDefault(),await wt(r);else if(r.includes("<meta")||r.includes("http")){const t=r.match(/https?:\/\/[^\s"']+/);t&&(e.preventDefault(),await wt(t[0]))}})};return document.addEventListener("paste",e),()=>{document.removeEventListener("paste",e)}},[W,wt,Ct]);const It=u(Xe);a(()=>{It.current=Xe},[Xe]);const Tt=c(e=>{rt(e.current||It.current.current,e.pageSize||It.current.pageSize)},[rt]),Ft=c(e=>{null==Ye||Ye(e)},[Ye]),Ot=i.useCallback(e=>{const{sortBy:t,sortOrder:r}=(e=>{const[t,r]=e.split("-");return{sortBy:t,sortOrder:r}})(e);tt(t,r)},[tt]),[Pt,Mt]=o(mN),[Rt,Lt]=o([]),Nt=u(null),[jt,Dt]=o(gr),[zt,Bt]=o([]),Ut=u(null),[Vt,Ht]=o(""),Wt=u(null),[$t,qt]=o(""),[Gt,Yt]=o([]),Xt=i.useRef(void 0),[Kt,Zt]=o(!1),[Qt,sr]=o(!1),lr=i.useRef(null),cr=i.useRef(!1),[ur,dr]=o({mode:"qr",rawText:"",foregroundHex:"#000000",backgroundHex:"#ffffff",transparentBackground:!1,qrSidePx:200,barcodeBarHeightPx:60}),hr=i.useRef(W),pr=i.useCallback(e=>{const t=e.indexOf(",");if(-1===t)return null;const r=e.substring(0,t),n=r.match(/^data:([^;]+)/),i=n&&n[1]||"image/svg+xml";let o,a="svg";if(i.includes("png")?a="png":(i.includes("jpeg")||i.includes("jpg"))&&(a="jpg"),/;base64/i.test(r)){const r=e.substring(t+1),n=atob(r),a=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)a[e]=n.charCodeAt(e);o=new Blob([a],{type:i})}else{const r=decodeURIComponent(e.substring(t+1));o=new Blob([r],{type:i})}return new File([o],`icon_${Date.now()}.${a}`,{type:i})},[]),mr=i.useCallback(async e=>{var t;const r=m.startUpload($e||void 0,[e])[0];let n=0;const i=setInterval(()=>{n=Math.min(n+10+Math.floor(Date.now()%10),90),m.updateProgress(r,n)},200);try{const n=await v.uploadFileWithProvider(e,void 0,!0);if(clearInterval(i),m.updateProgress(r,100),n){await new Promise(e=>setTimeout(e,100));const e=(null==_e?void 0:_e.find(e=>e.id===n.id&&!e.isFolder))||n;m.markAsSuccess(r,e)}else m.markAsSuccess(r);await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())}catch(e){clearInterval(i);const t=e instanceof Error?e.message:String(e);throw m.markAsError(r,t),e}},[m,_e,v,$e]),vr=c(async e=>{if(Boolean(e&&e.startsWith("data:"))){const t=pr(e);if(!t)return;return void await mr(t)}e&&await wt(e,void 0,void 0,"iconStock")},[pr,wt,mr]),yr=c(async()=>{const e=null==G?void 0:G.fileForEdit;if(Xt.current===e)return;if(W===or&&e&&!it.editingFile){Xt.current=e;try{if("string"==typeof e){if(e.startsWith("data:"))return void(null==it||it.handleEdit({thumbnail:e,saveWithoutFolder:!0}));const t=await v.resolveFileForEditByUrl(e);Xt.current===e&&(null==it||it.handleEdit(t))}}catch(t){Xt.current===e&&(Xt.current=null),console.error("Failed to open file in editor:",t),null==it||it.handlePixieEditorClose()}}},[null==G?void 0:G.fileForEdit,W,it,v]);a(()=>{yr()},[yr]),a(()=>{var e,t,r,n;const i=hr.current;hr.current=W,W===Jt?(Lt([]),Mt(mN),Bt([]),Dt(gr),Yt([]),qt(""),sr(!1),Zt(!1),i===Jt||i!==tr&&i!==er&&i!==nr||et("")):W===nr?null===(e=lr.current)||void 0===e||e.focus():W===er?null===(t=Nt.current)||void 0===t||t.focus():W===tr?null===(r=Ut.current)||void 0===r||r.focus():W===rr&&(null===(n=Wt.current)||void 0===n||n.focus())},[W,et]);const br=i.useCallback(async()=>{var e;await Et(),await(null===(e=oe.current)||void 0===e?void 0:e.refreshFileCounts())},[Et]),wr=c(e=>{var t;return e?(null===(t=e.files)||void 0===t?void 0:t.length)?Array.from(e.files):e.items?Array.from(e.items).map(e=>e.getAsFile()).filter(e=>Boolean(e)):[]:[]},[]);return t(r,{children:[te&&ht===Jt&&ke(e("div",{className:qs.dragCaptureLayer,"data-drag-capture":"true",onDragOver:e=>{var t,r;e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files"))&&!ie.current&&ee(!0)},onDragEnter:e=>{var t,r;e.preventDefault(),e.stopPropagation(),(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files"))&&ee(!0)},onDragLeave:e=>{const t=e.relatedTarget;t&&document.documentElement.contains(t)||(ee(!1),re(!1),document.body.removeAttribute("data-fm-dragging"))},onDrop:e=>{e.preventDefault(),e.stopPropagation(),re(!1),ee(!1),document.body.removeAttribute("data-fm-dragging");const t=wr(e.dataTransfer);t.length&&(at(!0),Ne(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error(e)}).finally(()=>at(!1)))},"aria-hidden":"true"}),document.body),J&&ke(e("div",{className:qs.dragOverlayGlobal,"data-drop-overlay":"true",onDragOver:e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},onDragEnter:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),e.stopPropagation(),ee(!1),re(!1),document.body.removeAttribute("data-fm-dragging");const t=wr(e.dataTransfer);t.length&&(at(!0),Ne(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error(e)}).finally(()=>at(!1)))},"aria-hidden":"true",children:t("div",{className:qs.dragOverlayInner,children:[e("div",{className:qs.uploadIcon,children:e(Y,{})}),e("div",{className:qs.textTitle,children:w("Drop files here to upload")}),e("div",{className:qs.textDescription,children:w("Supported files:")+" .jpg, .jpeg, .svg, .png"})]})}),document.body),e(Q,{className:"file-manager__layout",children:t("div",{className:qs.filesContainer,"data-files-container":"true",onDragOver:ct,onDragLeave:lt,onDragEnter:st,onDrop:ut,children:[K&&e("div",{className:qs.dragOverlay,children:t("div",{className:qs.dragOverlayInner,children:[e("div",{className:qs.uploadIcon,children:e(Y,{})}),e("div",{className:qs.textTitle,children:w("Drop files here to upload")}),e("div",{className:qs.textDescription,children:w("Supported files:")+" .jpg, .jpeg, .svg, .png"})]})}),t(Q,{className:"file-manager__content",children:[e(hN,{width:320,theme:"light",className:"file-manager-sider",children:e(jl,{ref:oe,selectedFolder:$e||"folders",generateMenuItems:xe,onFolderSelect:e=>null==Ge?void 0:Ge(e),folders:pe||[],fetchFolders:me,fetchChildFolders:ve,handleAddFile:bt,setIsUrlModalVisible:e=>null==$?void 0:$(e),handleDeleteFolder:_t,handleCreateFolder:ye,activeLibraryItem:W,setActiveLibraryItem:e=>null==q?void 0:q(e)})}),t(Q,{className:"file-manager__main-content",children:[ot&&e(Fl,{style:{position:"absolute",width:"100%",height:"100%",top:0,left:0,zIndex:100,background:"var(--colorBgLayout)"}}),t(fN,{className:"main-content",children:[e(VL,{activeLibraryItem:W,selectedFolder:(null===(s=null==pe?void 0:pe.find(e=>(null==e?void 0:e.id)===$e))||void 0===s?void 0:s.name)||w("Folders"),isTrashFolder:"Trash"===$e,onClearTrash:pt,files:_e||[],loading:At,onRefresh:nt,refreshDisabled:Se||ge,showRefresh:!(!(null===(l=null==k?void 0:k.apiEndpoints)||void 0===l?void 0:l.clearCache)&&!(null===(d=null==k?void 0:k.dataProviders)||void 0===d?void 0:d.clearCache))}),e(X,{className:"zero-divider"}),W===Jt&&e(bl,{searchTerm:Ze,handleAddFile:bt,files:_e||[],handleSearch:et,sortBy:Qe,sortOrder:Je,handleSortOptionChange:Ot,pagination:Xe,setPagination:Tt,loading:At,handleItemClick:Ft,onClearSelection:St.handleClearSelection,onRename:St.handleRename,onCopy:St.handleCopy,onMove:St.handleMove,onDelete:St.handleDeleteSelected,showRenameModal:Me,showDeleteConfirm:Ve,showCopyModal:f.actions.showCopyModal||(()=>{}),showMoveModal:je,onEdit:it.handleEdit,getFileData:v.getFileData}),W===er&&e(KL,{imageGifList:Rt,setImageGifList:Lt,currentReqGif:Pt,setCurrentReqGif:Mt,inputRef:Nt,customRequest:(e,t)=>wt(e,void 0,t,"gif")}),W===tr&&e(eN,{imageStockList:zt,setImageStockList:Bt,currentReq:jt,setCurrentReq:Dt,inputRef:Ut,customRequest:(e,t)=>wt(e,void 0,t,"imageStock")}),W===rr&&e(i.Suspense,{fallback:e("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e(S,{size:"large"})}),children:e(pN,{customRequest:vr,query:Vt,setQuery:Ht,inputRef:Wt})}),W===ir&&e(i.Suspense,{fallback:e("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e(S,{size:"large"})}),children:e(gN,{customRequest:xt,state:ur,setState:dr})}),W===nr&&!!(null==G?void 0:G.sseQuery)&&e(uN,{imageAiList:Gt,setImageAiList:Yt,aiImageRequest:$t,setAiImageRequest:qt,inputAiRef:lr,customRequest:xt,isLoadingAi:Kt,setIsLoadingAi:Zt,isImageUploaded:Qt,setIsImageUploaded:sr}),W===or&&e(r,{})]})]})]}),se&&!m.isUploadVisible&&e("div",{style:{position:"fixed",inset:0,zIndex:1500,backgroundColor:"rgba(255, 255, 255, 0.5)",pointerEvents:"all",display:"flex",alignItems:"center",justifyContent:"center"},children:e(S,{size:"large"})}),e(Ll,{isModalVisible:j,handleModalOk:be,handleModalCancel:we,form:O,selectedFolder:$e||null,folders:pe||[],isUrlModalVisible:D,setIsUrlModalVisible:e=>null==$?void 0:$(e),handleAddFileByUrl:wt,urlForm:P,isRenameModalVisible:Ae,handleRenameOk:()=>null==Le?void 0:Le(),handleRenameCancel:()=>null==Re?void 0:Re(),renameForm:M,fileToRename:Ee,files:_e||[],isMoveModalVisible:z,handleMoveOk:vt,handleMoveCancel:De,moveForm:R,selectedFiles:de||new Set,isRenameFolderModalVisible:B,handleRenameFolderOk:br,handleRenameFolderCancel:kt,renameFolderForm:L,folderToRename:H,isCopyModalVisible:U,handleCopyOk:yt,handleCopyCancel:Ue,copyForm:N,isDeleteConfirmVisible:V,handleDeleteConfirmOk:ft,handleDeleteConfirmCancel:()=>null==He?void 0:He(),isClearTrashConfirmVisible:ce,handleClearTrashConfirm:gt,handleClearTrashCancel:mt,fetchChildFolders:ve}),e(uL,{visible:it.isPixieEditorVisible,onClose:it.handlePixieEditorClose,file:it.editingFile,onSave:it.handlePixieEditorSave,onSaveCopy:it.handlePixieEditorSaveCopy}),e(zL,{files:m.uploadFiles,visible:m.isUploadVisible,minimized:m.isUploadMinimized,totalFiles:m.totalFiles,completedFiles:m.completedFiles,onClose:m.closeUpload,onMinimize:m.minimizeUpload,onInsert:e=>{var t;const r=m.getUploadedFile(e.id)||e;null===(t=C.onEditorOk)||void 0===t||t.call(C,r)}})]})})]})},yN=f(({config:n={},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"],fileNameProcessing:Object.assign(Object.assign({},{transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0}),n.fileNameProcessing),folderNameProcessing:Object.assign(Object.assign({},{transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0}),n.folderNameProcessing)},n),[n]);i.useEffect(()=>{b.theme&&(e=>{if("system"===e){const t=matchMedia(ur).matches?lr:sr;e=e===cr?t:e}document.documentElement.setAttribute("data-theme",e)})(b.theme),dN(b)},[b]),a(()=>{b.locale&&b.locale!==jn.language&&jn.changeLanguage(b.locale),b.customLocale&&b.locale&&jn.addResourceBundle(b.locale,"translation",b.customLocale,!0,!0)},[b.locale,b.customLocale]);const w=u(null),x=i.useMemo(()=>({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}),[h,c,d,o,s,l,b,f,p,g,m,v,y]);return e(E,{className:"em-filemanager",children:t(r,{children:[e(k,{getPopupContainer:()=>w.current||document.body,children:e(Po,{options:x,children:e(vN,{})})}),e("div",{ref:w,className:"file-manager-modal-root"})]})})});yN.displayName="FileManagerApp";const bN=t=>{var r,n,i;return e(ni,{i18n:jn,children:e(yr,{externalTheme:null!==(n=null===(r=t.config)||void 0===r?void 0:r.theme)&&void 0!==n?n:"light",customThemeToken:null===(i=t.config)||void 0===i?void 0:i.customTheme,children:e(re,{children:e(yN,Object.assign({},t))})})})},wN=new Map,xN=(t,r)=>{var n;let i;Cr();let o={};const a=e=>{const t=!e||"fileManager"!==e.mode&&"imageCenter"!==e.mode&&"plugin"!==e.mode?void 0:e.mode;return"imageCenter"===t?wr("imageCenter",e):wr(t)};if(t instanceof HTMLElement){i=t;o={config:a(r),apiEndpoints:null==r?void 0:r.apiEndpoints}}else{i=t.element;const e=a(t.config),r=Object.assign(Object.assign({},null===(n=t.config)||void 0===n?void 0:n.apiEndpoints),t.apiEndpoints);o={config:e,currentPath:t.currentPath,onPathChange:t.onPathChange,onChangeSelection:t.onChangeSelection,searchQuery:t.searchQuery,sortBySize:t.sortBySize,apiEndpoints:r,dataProviders:t.dataProviders,customIcons:t.customIcons,dragDropIcon:t.dragDropIcon,handleNotify:t.handleNotify,handleError:t.handleError,handleSuccess:t.handleSuccess}}const s=_(i);s.render(e(bN,Object.assign({},o))),wN.set(i.id||`container_${Date.now()}`,s)},CN=e=>{const t=e.id||Object.keys(wN).find(e=>e.startsWith("container_"));if(t&&wN.has(t)){const e=wN.get(t);null==e||e.unmount(),wN.delete(t)}else{console.warn("Couldn t find the root to unmount");try{_(e).unmount()}catch(e){console.error("Error unmounting the component:",e)}}},_N=new Map,SN=n=>{const{onClose:o,onSave:s,dataProviders:l,theme:c,locale:d,hasPagination:h,disablePagination:f,paginationAvailable:p,dedupeUploadNamesOnClient:g,saveCopyToCurrentFolder:m}=n,v=i.useMemo(()=>{var e,t;return{theme:null!=c?c:"light",locale:d,baseUrl:n.baseUrl,assetsUrl:n.assetsUrl,compressMaxSize:n.compressMaxSize,compressMaxWidthOrHeight:n.compressMaxWidthOrHeight,compessorUrl:null!==(e=n.compessorUrl)&&void 0!==e?e:n.compressorUrl,compressorUrl:null!==(t=n.compressorUrl)&&void 0!==t?t:n.compessorUrl,showNotifications:n.showNotifications,fetchWithProxy:n.fetchWithProxy,handleFileProxy:n.handleFileProxy,hasPagination:h,disablePagination:f,paginationAvailable:p,dedupeUploadNamesOnClient:g,saveCopyToCurrentFolder:m}},[c,d,n.baseUrl,n.assetsUrl,n.compressMaxSize,n.compressMaxWidthOrHeight,n.compessorUrl,n.compressorUrl,n.showNotifications,n.fetchWithProxy,n.handleFileProxy,h,f,p,g,m]),y=i.useCallback(async(e,t,r,n)=>{if(!e&&!t||!(null==l?void 0:l.getFiles))return null;try{const i=await l.getFiles({folderId:n?void 0:null!=r?r:void 0,noFolder:n,search:t||void 0,itemType:"file",page:1,limit:1}),[o]=i.files;return o?e&&o.id!==e?null:o:null}catch(e){return console.warn("Standalone Pixie: failed to resolve uploaded file from provider",e),null}},[l]),b=i.useMemo(()=>{if(n.file)return n.file;const e=n.name||"edited-image",t=n.extension||(n.type?n.type.split("/")[1]:"png"),r=n.type||`image/${t}`;return{thumbnail:n.imageDataUrl||"",name:e,id:void 0,type:r,extension:t,saveWithoutFolder:!0}},[n.file,n.imageDataUrl,n.name,n.extension,n.type]),w=i.useCallback(async(e,t)=>{if((null==l?void 0:l.updateFile)&&e.thumbnail)try{const r=(null==t?void 0:t.mimeType)||kr(e.thumbnail,e.type),n=Er(r),i=e.name.substring(0,e.name.lastIndexOf("."))+"."+n,o=(null==t?void 0:t.blob)||Mr(e.thumbnail,r);return await l.updateFile(e.id,{name:i,type:r,data:o})}catch(e){return console.error("Error updating the file through updateFile:",e),null}return console.warn("DataProvider for updating files is not configured"),null},[l]),x=i.useCallback(async(e,t)=>{var r,n,i,o,a,s;if(!e.thumbnail)return null;try{const c=!0!==v.saveCopyToCurrentFolder||(null!==(r=e.saveWithoutFolder)&&void 0!==r?r:!e.id),u=c?"":e.folderId||"",d=(null==t?void 0:t.mimeType)||kr(e.thumbnail,e.type),h=(null==t?void 0:t.blob)||Mr(e.thumbnail,d),f=Wr(e.name,v),p=await Ii(l,f,u,c,qr(v)),g=new File([h],p,{type:d,lastModified:Date.now()});if(null==l?void 0:l.uploadFiles){const t=await l.uploadFiles({items:[{name:g.name,size:g.size,type:g.type,folderId:u,noFolder:c,data:g,extension:Er(d)}],folderId:u}),r=null===(n=t.detailed)||void 0===n?void 0:n[0];if(t.success&&(null==r?void 0:r.success)&&r.data){const t=r.data;if(t.url||t.thumbnailUrl||t.thumbnail)return{id:t.id||e.id||"",name:t.name||e.name,folderId:null!==(i=t.folderId)&&void 0!==i?i:u,type:t.type||g.type,size:null!==(o=t.size)&&void 0!==o?o:g.size,extension:t.extension||Er(d),url:t.url,thumbnailUrl:t.thumbnailUrl,thumbnail:t.thumbnail,date:t.date,dimensions:t.dimensions,aspectRatio:t.aspectRatio,sourceUrl:t.sourceUrl,isFolder:!1,selected:!1};const n=await y(r.data.id,r.data.name||g.name,null!==(a=r.data.folderId)&&void 0!==a?a:u,c);return n||{id:r.data.id||e.id||"",name:r.data.name||e.name,folderId:null!==(s=r.data.folderId)&&void 0!==s?s:u,type:g.type,size:g.size,extension:Er(d),url:r.data.url,thumbnailUrl:r.data.thumbnailUrl,thumbnail:r.data.thumbnail,isFolder:!1,selected:!1}}}return(null==l?void 0:l.uploadFile)?await l.uploadFile({name:g.name,size:g.size,type:g.type,folderId:u,noFolder:c,data:g,extension:Er(d)}):null}catch(e){return console.error("Error saving file copy:",e),null}},[l,y,v]),C=i.useCallback(async(e,t)=>{if((null==l?void 0:l.updateFile)&&e.id&&e.thumbnail)try{const r=await w(e,t);r&&(e=r)}catch(e){console.error("Standalone Pixie: saveFileToServer error",e)}return s&&await s(e,t),o&&o(),e},[l,s,o,w]),_=i.useCallback(async(e,t)=>{let r=e;if(e.thumbnail)try{const n=await x(e,t);n&&(r=n)}catch(e){console.error("Standalone Pixie: saveFileCopyToServer error",e)}return s&&await s(r,t),o&&o(),r},[o,s,x]),S=u(null);return a(()=>{d&&d!==jn.language&&jn.changeLanguage(d)},[d]),e(E,{className:"em-filemanager",children:t(r,{children:[e(k,{getPopupContainer:()=>S.current||document.body,children:e(ni,{i18n:jn,children:e(yr,{externalTheme:null!=c?c:"light",children:e(re,{children:e(Po,{options:{dataProviders:l,handleNotify:n.handleNotify,handleError:n.handleError,handleSuccess:n.handleSuccess,config:v},children:e(uL,{visible:!0,onClose:o,file:b,onSave:C,onSaveCopy:_})})})})})}),e("div",{ref:S,className:"file-manager-modal-root"})]})})},AN=t=>{Cr();const r=t.element,n=_(r);n.render(e(SN,Object.assign({},t))),_N.set(r.id||`pixie_container_${Date.now()}`,n)},kN=e=>{const t=Array.from(_N.keys()).find(e=>e.startsWith("pixie_container_")),r=e.id||t;if(r&&_N.has(r)){const e=_N.get(r);null==e||e.unmount(),_N.delete(r)}else{console.warn("Couldn t find the root to unmount Pixie");try{_(e).unmount()}catch(e){console.error("Error unmounting Pixie:",e)}}},EN=e=>{var t,r;const{mode:n,element:i,fileManager:o,pixieEditor:a,theme:s,dataProviders:l}=e;let c,u;const d={unmount:()=>{c&&CN(c),u&&kN(u)},unmountFileManager:void 0,unmountPixieEditor:void 0};switch(n){case"fileManager":c=i,xN(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=()=>CN(c);break;case"pixieEditor":u=i,AN(Object.assign({element:i,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountPixieEditor=()=>kN(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,xN(c,Object.assign(Object.assign({},null==o?void 0:o.config),{theme:s||(null===(r=null==o?void 0:o.config)||void 0===r?void 0:r.theme),apiEndpoints:null==o?void 0:o.apiEndpoints})),AN(Object.assign({element:u,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountFileManager=()=>CN(c),d.unmountPixieEditor=()=>kN(u);break}}return d};function IN(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 TN={init:xN,unmount:CN,initPixieEditor:AN,unmountPixieEditor:kN,initFileManager:EN};export{EN as A,TN as B,yN as C,bl as D,Ll as E,Tl as F,jl as G,Cr as H,_r as I,ua as J,IN as K,Do as N,SN as P,Oo as a,Mo as b,$L as c,Hs as d,Yo as e,la as f,Ml as g,qr as h,Gi as i,Ka as j,Za as k,ts as l,qi as m,Wr as n,Oi as o,Ol as p,Vo as q,Ii as r,Ni as s,zn as t,ri as u,xN as v,CN as w,bN as x,AN as y,kN as z};
62
- //# sourceMappingURL=file-manager-index-DL8wzCQG.js.map