@emailmaker/filemanager 0.10.78 → 0.10.79

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.
@@ -1,62 +1,2 @@
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 k,ConfigProvider as A,App as I,Form as E,Input as F,Typography as T,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 $,Tree as W,Modal as G,Progress as q,Menu as Y,Divider as X,List as K,Avatar as Z,Layout as J,Radio as Q,Tag as ee,Carousel as te,InputNumber as re,ColorPicker as ne,message as ie}from"antd";import oe from"antd/es/alert/ErrorBoundary";import ae,{LoadingOutlined as se,BarsOutlined as le,AppstoreOutlined as ce,DownOutlined as ue,RightOutlined as de,LinkOutlined as he,UploadOutlined as fe,FileOutlined as pe,FolderAddOutlined as ge,FolderOpenOutlined as me,FolderOutlined as ve,EyeOutlined as ye,CloseOutlined as be,LikeOutlined as we,HistoryOutlined as xe,ExclamationCircleOutlined as Ce,FileImageOutlined as _e,CheckCircleOutlined as Se,ArrowRightOutlined as ke,ArrowLeftOutlined as Ae,CheckOutlined as Ie}from"@ant-design/icons";import*as Ee from"react-dom";import{createPortal as Fe,flushSync as Te}from"react-dom";function Oe(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 Pe(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 Oe(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)?Oe(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 Me(e){return Me="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},Me(e)}function Re(e){var t=function(e,t){if("object"!=Me(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=Me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Me(t)?t:t+""}function Le(e,t,r){return(t=Re(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ne(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?Ne(Object(r),!0).forEach(function(t){Le(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ne(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var De={},ze=[];function Be(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console){var r=ze.reduce(function(e,t){return t(null!=e?e:"","warning")},t);r&&console.error("Warning: ".concat(r))}}function Ue(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console){var r=ze.reduce(function(e,t){return t(null!=e?e:"","note")},t);r&&console.warn("Note: ".concat(r))}}function Ve(e,t,r){t||De[r]||(e(!1,r),De[r]=!0)}function He(e,t){Ve(Be,e,t)}function $e(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(He(!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"===Me(t)&&"object"===Me(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 We(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ge(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,Re(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}He.preMessage=function(e){ze.push(e)},He.resetWarned=function(){De={}},He.noteOnce=function(e,t){Ve(Ue,e,t)};function qe(e){return e.join("%")}var Ye=function(){function e(t){We(this,e),Le(this,"instanceId",void 0),Le(this,"cache",new Map),Le(this,"extracted",new Set),this.instanceId=t}return Ge(e,[{key:"get",value:function(e){return this.opGet(qe(e))}},{key:"opGet",value:function(e){return this.cache.get(e)||null}},{key:"update",value:function(e,t){return this.opUpdate(qe(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}(),Xe=["children"],Ke="data-css-hash",Ze="__cssinjs_instance__";function Je(){var e=Math.random().toString(12).slice(2);if("undefined"!=typeof document&&document.head&&document.body){var t=document.body.querySelectorAll("style[".concat(Ke,"]"))||[],r=document.head.firstChild;Array.from(t).forEach(function(t){t[Ze]=t[Ze]||e,t[Ze]===e&&document.head.insertBefore(t,r)});var n={};Array.from(document.querySelectorAll("style[".concat(Ke,"]"))).forEach(function(t){var r,i=t.getAttribute(Ke);n[i]?t[Ze]===e&&(null===(r=t.parentNode)||void 0===r||r.removeChild(t)):n[i]=!0})}return new Ye(e)}var Qe=n.createContext({hashPriority:"low",cache:Je(),defaultCache:!0}),et=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,Xe),l=n.useContext(Qe),c=(t=function(){var e=je({},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||Je(),e.defaultCache=!t&&l.defaultCache,e},r=[l,s],i=function(e,t){return!$e(e[0],t[0],!0)||!$e(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(Qe.Provider,{value:c},a)};var tt=function(){function e(){We(this,e),Le(this,"cache",void 0),Le(this,"keys",void 0),Le(this,"cacheCallTimes",void 0),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return Ge(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=Pe(e,2)[1];return n.internalGet(t)[1]<r?[t,n.internalGet(t)[1]]:e},[this.keys[0],this.cacheCallTimes]),o=Pe(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 rt(e,t,r){if(arguments.length>4&&void 0!==arguments[4]&&arguments[4])return e;var n=je(je({},arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}),{},Le(Le({},"data-token-hash",t),Ke,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>")}Le(tt,"MAX_CACHE_SIZE",20),Le(tt,"MAX_CACHE_OFFSET",5),new tt,"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,je({},n).useInsertionEffect,je({},n).useInsertionEffect;if(process.env.NODE_ENV,"production"!==process.env.NODE_ENV&&"undefined"!=typeof module&&module&&module.hot&&"undefined"!=typeof window){var nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:null;if(nt&&"function"==typeof nt.webpackHotUpdate){var it=nt.webpackHotUpdate;nt.webpackHotUpdate=function(){return setTimeout(function(){0},0),it.apply(void 0,arguments)}}}process.env.NODE_ENV;var ot="comm",at="rule",st="decl",lt=Math.abs,ct=String.fromCharCode;function ut(e){return e.trim()}function dt(e,t,r){return e.replace(t,r)}function ht(e,t,r){return e.indexOf(t,r)}function ft(e,t){return 0|e.charCodeAt(t)}function pt(e,t,r){return e.slice(t,r)}function gt(e){return e.length}function mt(e,t){return t.push(e),e}var vt=1,yt=1,bt=0,wt=0,xt=0,Ct="";function _t(e,t,r,n,i,o,a,s){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:vt,column:yt,length:a,return:"",siblings:s}}function St(){return xt=wt>0?ft(Ct,--wt):0,yt--,10===xt&&(yt=1,vt--),xt}function kt(){return xt=wt<bt?ft(Ct,wt++):0,yt++,10===xt&&(yt=1,vt++),xt}function At(){return ft(Ct,wt)}function It(){return wt}function Et(e,t){return pt(Ct,e,t)}function Ft(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 Tt(e){return ut(Et(wt-1,Mt(91===e?e+2:40===e?e+1:e)))}function Ot(e){for(;(xt=At())&&xt<33;)kt();return Ft(e)>2||Ft(xt)>3?"":" "}function Pt(e,t){for(;--t&&kt()&&!(xt<48||xt>102||xt>57&&xt<65||xt>70&&xt<97););return Et(e,It()+(t<6&&32==At()&&32==kt()))}function Mt(e){for(;kt();)switch(xt){case e:return wt;case 34:case 39:34!==e&&39!==e&&Mt(xt);break;case 40:41===e&&Mt(e);break;case 92:kt()}return wt}function Rt(e,t){for(;kt()&&e+xt!==57&&(e+xt!==84||47!==At()););return"/*"+Et(t,wt-1)+"*"+ct(47===e?e:kt())}function Lt(e){for(;!Ft(At());)kt();return Et(e,wt)}function Nt(e){return function(e){return Ct="",e}(jt("",null,null,null,[""],e=function(e){return vt=yt=1,bt=gt(Ct=e),wt=0,[]}(e),0,[0],e))}function jt(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=kt()){case 40:if(108!=p&&58==ft(_,d-1)){-1!=ht(_+=dt(Tt(y),"&","&\f"),"&\f",lt(c?s[c-1]:0))&&(v=-1);break}case 34:case 39:case 91:_+=Tt(y);break;case 9:case 10:case 13:case 32:_+=Ot(p);break;case 92:_+=Pt(It()-1,7);continue;case 47:switch(At()){case 42:case 47:mt(zt(Rt(kt(),It()),t,r,l),l),5!=Ft(p||1)&&5!=Ft(At()||1)||!gt(_)||" "===pt(_,-1,void 0)||(_+=" ");break;default:_+="/"}break;case 123*g:s[c++]=gt(_)*v;case 125*g:case 59:case 0:switch(y){case 0:case 125:m=0;case 59+u:-1==v&&(_=dt(_,/\f/g,"")),f>0&&(gt(_)-d||0===g&&47===p)&&mt(f>32?Bt(_+";",n,r,d-1,l):Bt(dt(_," ","")+";",n,r,d-2,l),l);break;case 59:_+=";";default:if(mt(C=Dt(_,t,r,c,u,i,s,b,w=[],x=[],d,o),o),123===y)if(0===u)jt(_,t,C,C,w,o,d,s,x);else{switch(h){case 99:if(110===ft(_,3))break;case 108:if(97===ft(_,2))break;default:u=0;case 100:case 109:case 115:}u?jt(e,C,C,n&&mt(Dt(e,C,C,0,0,i,s,b,i,w=[],d,x),x),i,x,d,s,n?w:x):jt(_,C,C,C,[""],x,0,s,x)}}c=u=f=0,g=v=1,b=_="",d=a;break;case 58:d=1+gt(_),f=p;default:if(g<1)if(123==y)--g;else if(125==y&&0==g++&&125==St())continue;switch(_+=ct(y),y*g){case 38:v=u>0?1:(_+="\f",-1);break;case 44:s[c++]=(gt(_)-1)*v,v=1;break;case 64:45===At()&&(_+=Tt(kt())),h=At(),u=d=gt(b=_+=Lt(It())),y++;break;case 45:45===p&&2==gt(_)&&(g=0)}}return o}function Dt(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=pt(e,h+1,h=lt(m=a[g])),w=e;y<p;++y)(w=ut(m>0?f[y]+" "+b:dt(b,/&\f/g,f[y])))&&(l[v++]=w);return _t(e,t,r,0===i?at:s,l,c,u,d)}function zt(e,t,r,n){return _t(e,t,r,ot,ct(xt),pt(e,2,-2),0,n)}function Bt(e,t,r,n,i){return _t(e,t,r,st,pt(e,0,n),pt(e,n+1,-1),n,i)}function Ut(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function Vt(e,t,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case"@namespace":case st:return e.return=e.return||e.value;case ot:return"";case"@keyframes":return e.return=e.value+"{"+Ut(e.children,n)+"}";case at:if(!gt(e.value=e.props.join(",")))return""}return gt(r=Ut(e.children,n))?e.return=e.value+"{"+r+"}":""}function Ht(e){return e.notSplit=!0,e}Le(Le(Le({},"style",function(e,t,r){var n=Pe(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=rt(i,o,a,h,u),s&&Object.keys(s).forEach(function(e){if(!t[e]){t[e]=!0;var r=function(e){return Ut(Nt(e),Vt).replace(/\{%%%\:[^;];}/g,";")}(s[e]),n=rt(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=Pe(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,rt(o,a,l,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},s)]}),"cssVar",function(e,t,r){var n=Pe(e,4),i=n[1],o=n[2],a=n[3],s=(r||{}).plain;if(!i)return null;return[-999,o,rt(i,a,o,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},s)]}),Ht(["borderTop","borderBottom"]),Ht(["borderTop"]),Ht(["borderBottom"]),Ht(["borderLeft","borderRight"]),Ht(["borderLeft"]),Ht(["borderRight"]);const $t={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};function Wt(e,t){return t}function Gt(e,t){return e.filter(e=>void 0!==e)}var qt;function Yt(e){return"object"!=typeof e||null===e?0:Array.isArray(e)?2:function(e){if(!Zt.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||!Zt.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 Xt(e,t){return"object"==typeof e&&Object.prototype.propertyIsEnumerable.call(e,t)}function Kt(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"}(qt||(qt={}));const Zt=["[object Object]","[object Module]"];const Jt={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)Xt(t,i)&&o.push(t[i]);if(0===o.length)continue;const a=t.metaDataUpdater(r,{key:i,parents:e}),s=er(o,t,a);s!==$t.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(Kt(e))},mergeMaps:function(e){return new Map(Kt(e))},mergeOthers:function(e){return e.at(-1)}};function Qt(...e){return function(e,t){const r=function(e,t){return{defaultMergeFunctions:Jt,mergeFunctions:{...Jt,...Object.fromEntries(Object.entries(e).filter(([e,t])=>Object.hasOwn(Jt,e)).map(([e,t])=>!1===t?[e,Jt.mergeOthers]:[e,t]))},metaDataUpdater:e.metaDataUpdater??Wt,deepmerge:t,useImplicitDefaultMerging:e.enableImplicitDefaultMerging??!1,filterValues:!1===e.filterValues?void 0:e.filterValues??Gt,actions:$t}}(e,n);function n(...e){return er(e,r,t)}return n}({})(...e)}function er(e,t,r){const n=t.filterValues?.(e,r)??e;if(0===n.length)return;if(1===n.length)return tr(n,t,r);const i=Yt(n[0]);if(0!==i&&5!==i)for(let e=1;e<n.length;e++)if(Yt(n[e])!==i)return tr(n,t,r);switch(i){case 1:return function(e,t,r){const n=t.mergeFunctions.mergeRecords(e,t,r);if(n===$t.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===$t.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===$t.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===$t.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps)return t.defaultMergeFunctions.mergeMaps(e);return n}(n,t,r);default:return tr(n,t,r)}}function tr(e,t,r){const n=t.mergeFunctions.mergeOthers(e,t,r);return n===$t.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):n}const rr="my_files",nr="gif",ir="stock_images",or="icons",ar="ai",sr="editor",lr="Trash",cr="light",ur="dark",dr="system",hr="(prefers-color-scheme: dark)",fr=!1,pr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiBmaWxsPSIjRjVGNUY1Ii8+CjxwYXRoIGQ9Ik0yNCAzMkw0MCA0OEw1NiAzMkw2NCA0MEw2NCA2NEgyNFYzMloiIGZpbGw9IiNEOUQ5RDkiLz4KPC9zdmc+",gr=["jpg","jpeg","png","bmp","webp","svg","ico","tiff","tif"],mr=["jpg","jpeg","png","bmp","webp","svg","ico","tiff","tif","gif"],vr={keywords:"",color:"",orientation:""};S.setDefaultIndicator(e(()=>e(se,{style:{fontSize:48,height:"100%"},spin:!0}),{}));const yr={hashed:!1,algorithm:k.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}}},br={hashed:!1,algorithm:k.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}}},wr=({externalTheme:t=cr,children:r,customThemeToken:n})=>{const i=matchMedia(hr).matches?ur:cr,s=t===dr?i:t,[l,c]=o(s),[u,d]=o("light"===l?yr:br);return a(()=>{c(s)},[s]),a(()=>{const e="light"===l?yr:br,t=n?Qt(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(A,{theme:u,children:e(et,{transformers:[],children:e(I,{style:{height:"100%"},children:r})})})})},xr={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"]}},Cr=(e="fileManager",t)=>"imageCenter"===e&&t?t:Object.assign({},xr[e]);let _r=!1;const Sr=()=>{if(_r)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)}_r=!0},kr=()=>{_r=!1},Ar=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"},Ir=e=>{if(!e.startsWith("data:"))return null;const t=e.match(/^data:([^;,]+)/);return t?t[1]:null},Er=(e,t="image/png")=>{let r=t;if("string"==typeof e&&e.startsWith("data:")){const t=Ir(e);t&&t.startsWith("image/")&&(r=t)}return Ar(r)},Fr=e=>{const t=Ar(e).split("/")[1];return"svg+xml"===t?"svg":t||"png"};function Tr(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 Or(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(Tr(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 Pr=/^data:(.+?);base64,(.+)$/i,Mr=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},Rr=(e,t)=>{const r=e.replace(/\s/g,""),n=Mr(r),i=new ArrayBuffer(n.length);return new Uint8Array(i).set(n),new Blob([i],{type:t})},Lr=(e,t="application/octet-stream")=>{if(e instanceof Blob)return e;if("string"==typeof e){const r=e.trim(),n=r.match(Pr);if(n){const[,e,t]=n;return Rr(t,e)}return Rr(r,t)}throw new Error("Unsupported data type. Expected Blob or base64 string.")},Nr={"а":"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"},jr=/[<>:"/\\|?*()#\x00-\x1f]/g,Dr={transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0};function zr(e,t){let r=e;return t.transliterate&&(r=r.normalize("NFC").split("").map(e=>{var t;return null!==(t=Nr[e])&&void 0!==t?t:e}).join("")),t.removeForbiddenChars&&(r=r.replace(jr,"_")),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 Br(e,t){const r=Object.assign(Object.assign({},Dr),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(zr(i,r)||"unnamed_file")+o}function Ur(e,t){return zr(e,Object.assign(Object.assign({},Dr),null==t?void 0:t.folderNameProcessing))||"unnamed_folder"}function Vr(e){return!0===(null==e?void 0:e.dedupeUploadNamesOnClient)}const Hr=e=>"string"==typeof e,$r=()=>{let e,t;const r=new Promise((r,n)=>{e=r,t=n});return r.resolve=e,r.reject=t,r},Wr=e=>null==e?"":""+e,Gr=/###/g,qr=e=>e&&e.indexOf("###")>-1?e.replace(Gr,"."):e,Yr=e=>!e||Hr(e),Xr=(e,t,r)=>{const n=Hr(t)?t.split("."):t;let i=0;for(;i<n.length-1;){if(Yr(e))return{};const t=qr(n[i]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return Yr(e)?{}:{obj:e,k:qr(n[i])}},Kr=(e,t,r)=>{const{obj:n,k:i}=Xr(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=Xr(e,a,Object);for(;void 0===s.obj&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),s=Xr(e,a,Object),s?.obj&&void 0!==s.obj[`${s.k}.${o}`]&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=r},Zr=(e,t)=>{const{obj:r,k:n}=Xr(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Jr=(e,t,r)=>{for(const n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?Hr(e[n])||e[n]instanceof String||Hr(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):Jr(e[n],t[n],r):e[n]=t[n]);return e},Qr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var en={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const tn=e=>Hr(e)?e.replace(/[&<>"'\/]/g,e=>en[e]):e;const rn=[" ",",","?","!",";"],nn=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),on=(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},an=e=>e?.replace("_","-"),sn={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 ln{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||sn,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:(Hr(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new ln(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new ln(this.logger,e)}}var cn=new ln;class un{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 dn extends un{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):Hr(r)&&i?a.push(...r.split(i)):a.push(r)));const s=Zr(this.data,a);return!s&&!t&&!r&&e.indexOf(".")>-1&&(e=a[0],t=a[1],r=a.slice(2).join(".")),!s&&o&&Hr(r)?on(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),Kr(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)(Hr(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=Zr(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),n?Jr(s,r,i):s={...s,...r},Kr(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 hn={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 fn=Symbol("i18next/PATH_KEY");function pn(e,t){const{[fn]:r}=e(function(){const e=[],t=Object.create(null);let r;return t.get=(n,i)=>(r?.revoke?.(),i===fn?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return r.join(t?.keySeparator??".")}const gn={},mn=e=>!Hr(e)&&"boolean"!=typeof e&&"number"!=typeof e;class vn extends un{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=cn.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=rn.filter(e=>t.indexOf(e)<0&&r.indexOf(e)<0);if(0===n.length)return!0;const i=nn.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:Hr(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:Hr(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=pn(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&&!Hr(n.count),b=vn.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 k=mn(S),A=Object.prototype.toString.apply(S);if(!(v&&S&&k&&["[object Number]","[object Function]","[object RegExp]"].indexOf(A)<0)||Hr(m)&&Array.isArray(S))if(v&&Hr(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:mn(_)?_[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=Hr(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&&!Hr(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=Hr(o)?[o]:o;return null!=e&&a?.length&&!1!==r.applyPostProcessor&&(e=hn.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 Hr(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&&!Hr(t.count),d=u&&!t.ordinal&&0===t.count,h=void 0!==t.context&&(Hr(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,gn[`${f[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(a)||(gn[`${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&&!Hr(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 yn{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=cn.create("languageUtils")}getScriptPartFromCode(e){if(!(e=an(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=an(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Hr(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)),Hr(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 Hr(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))):Hr(e)&&i(this.formatLanguageCode(e)),r.forEach(e=>{n.indexOf(e)<0&&i(this.formatLanguageCode(e))}),n}}const bn={zero:0,one:1,two:2,few:3,many:4,other:5},wn={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class xn{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=cn.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const r=an("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!"),wn;if(!e.match(/-|_/))return wn;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)=>bn[e]-bn[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 Cn=(e,t,r,n=".",i=!0)=>{let o=((e,t,r)=>{const n=Zr(e,r);return void 0!==n?n:Zr(t,r)})(e,t,r);return!o&&i&&Hr(r)&&(o=on(e,r,n),void 0===o&&(o=on(t,r,n))),o},_n=e=>e.replace(/\$/g,"$$$$");class Sn{constructor(e={}){this.logger=cn.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:tn,this.escapeValue=void 0===r||r,this.useRawValueToEscape=void 0!==n&&n,this.prefix=i?Qr(i):o||"{{",this.suffix=a?Qr(a):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?Qr(d):h||Qr("$t("),this.nestingSuffix=f?Qr(f):p||Qr(")"),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=Cn(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(Cn(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=>_n(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?_n(this.escape(e)):_n(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=Hr(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 Hr(o)||this.useRawValueToEscape||(o=Wr(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&&!Hr(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&&!Hr(i))return i;Hr(i)||(i=Wr(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 kn=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(an(n),i),t[a]=s),s(r)}},An=e=>(t,r,n)=>e(an(r),n)(t);class In{constructor(e={}){this.logger=cn.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const r=t.cacheInBuiltFormats?kn:An;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()]=kn(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 En extends un{constructor(e,t,r,n={}){super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=n,this.logger=cn.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}=Xr(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();Hr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Hr(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 Fn=()=>({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]),Hr(e[1])&&(t.defaultValue=e[1]),Hr(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}),Tn=e=>(Hr(e.ns)&&(e.ns=[e.ns]),Hr(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Hr(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),On=()=>{};class Pn extends un{constructor(e={},t){var r;if(super(),this.options=Tn(e),this.services={},this.logger=cn,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&&(Hr(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=Fn();this.options={...r,...this.options,...Tn(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?cn.init(n(this.modules.logger),this.options):cn.init(null,this.options),e=this.modules.formatter?this.modules.formatter:In;const t=new yn(this.options);this.store=new dn(this.options.resources,this.options);const i=this.services;i.logger=cn,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new xn(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 Sn(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new En(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 vn(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=On),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=$r(),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=On){let r=t;const n=Hr(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=$r();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=On),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&&hn.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=$r();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=Hr(t)?t:t&&t[0],o=this.store.hasLanguageSomeTranslations(r)?r:this.services.languageUtils.getBestMatchFromCodes(Hr(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=pn(e,{...this.options,...t})),`${o.keyPrefix}${a}${e}`)):("function"==typeof e&&(e=pn(e,{...this.options,...t})),s=o.keyPrefix?`${o.keyPrefix}${a}${e}`:e),this.t(s,o)};return Hr(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=$r();return this.options.ns?(Hr(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=$r();Hr(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 yn(Fn());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 Pn(e,t)}cloneInstance(e={},t=On){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},i=new Pn(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 dn(e,n),i.services.resourceStore=i.store}return i.translator=new vn(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 Mn=Pn.createInstance();Mn.createInstance=Pn.createInstance,Mn.createInstance,Mn.dir,Mn.init,Mn.loadResources,Mn.reloadResources,Mn.use,Mn.changeLanguage,Mn.getFixedT,Mn.t,Mn.exists,Mn.setDefaultNamespace,Mn.hasLoadedNamespace,Mn.loadNamespaces,Mn.loadLanguages;var Rn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};const Ln={},Nn=(e,t,r,n)=>{Bn(r)&&Ln[r]||(Bn(r)&&(Ln[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);Bn(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))},jn=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},Dn=(e,t,r)=>{e.loadNamespaces(t,jn(e,r))},zn=(e,t,r,n)=>{if(Bn(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Dn(e,r,n);r.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,jn(e,n))},Bn=e=>"string"==typeof e,Un=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Vn={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Hn=e=>Vn[e];let $n={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(Un,Hn)};let Wn;const Gn={type:"3rdParty",init(e){((e={})=>{$n={...$n,...e}})(e.options.react),(e=>{Wn=e})(e)}},qn=s();class Yn{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Xn=(e,t,r,n)=>e.getFixedT(t,r,n),Kn=(e,t={})=>{const{i18n:r}=t,{i18n:n,defaultNS:i}=l(qn)||{},s=r||n||Wn;if(s&&!s.reportNamespaces&&(s.reportNamespaces=new Yn),!s){Nn(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const e=(e,t)=>{return Bn(t)?t:"object"==typeof(r=t)&&null!==r&&Bn(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&&Nn(s,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...$n,...s.options.react,...t},{useSuspense:h,keyPrefix:f}=d;let p=i||s.options?.defaultNS;p=Bn(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}}):(Nn(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,s,d)),m=((e,t,r,n)=>c(Xn(e,t,r,n),[e,t,r,n]))(s,t.lng||null,"fallback"===d.nsMode?p:p[0],f),v=()=>m,y=()=>Xn(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?zn(s,t.lng,p,()=>{_.current&&w(y)}):Dn(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?zn(s,t.lng,p,()=>e()):Dn(s,p,()=>e())})};function Zn({i18n:e,defaultNS:t,children:r}){const n=d(()=>({i18n:e,defaultNS:t}),[e,t]);return h(qn.Provider,{value:n},r)}var Jn,Qn,ei,ti,ri,ni={};function ii(){if(Qn)return Jn;function e(t){return e="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},e(t)}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function r(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 n(e,t){return function(e,t){if(t.get)return t.get.call(e);return t.value}(e,o(e,t,"get"))}function i(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,o(e,t,"set"),r),r}function o(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function a(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)}Qn=1;var s=function(t){if(!t)return[];Array.isArray(t)||(t=[t]);for(var r={},n=0;n<t.length;++n){var i,o=t[n];if(o&&"object"===e(o)&&(o=String(o)),"string"!=typeof o){var a="Locales should be strings, ".concat(JSON.stringify(o)," isn't.");throw new TypeError(a)}var s=o.split("-");if(!s.every(function(e){return/[a-z0-9]+/i.test(e)})){var l=JSON.stringify(o),c="The locale ".concat(l," is not a structurally valid BCP 47 language tag.");throw new RangeError(c)}var u=s[0].toLowerCase();s[0]=null!==(i={in:"id",iw:"he",ji:"yi"}[u])&&void 0!==i?i:u,r[s.join("-")]=!0}return Object.keys(r)};function l(t){switch(e(t)){case"number":return t;case"bigint":throw new TypeError("Cannot convert a BigInt value to a number");default:return Number(t)}}return Jn=function(e,r,o,c){var u=function(e){do{if(r(e))return e;e=e.replace(/-?[^-]*$/,"")}while(e);return null},d=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,m=function(){function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=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,m),a(this,d,{writable:!0,value:void 0}),a(this,h,{writable:!0,value:void 0}),a(this,f,{writable:!0,value:void 0}),a(this,p,{writable:!0,value:void 0}),a(this,g,{writable:!0,value:void 0}),i(this,d,function(t){for(var r=s(t),n=0;n<r.length;++n){var i=u(r[n]);if(i)return i}var o=(new e).resolvedOptions().locale;return u(o)}(t)),i(this,f,r(n(this,d))),i(this,h,c(n(this,d))),i(this,p,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))}(o)),i(this,g,new e("en",o))}var v,y,b;return v=m,b=[{key:"supportedLocalesOf",value:function(e){return s(e).filter(u)}}],(y=[{key:"resolvedOptions",value:function(){var e=n(this,g).resolvedOptions(),t=e.minimumIntegerDigits,r=e.minimumFractionDigits,i=e.maximumFractionDigits,a=e.minimumSignificantDigits,s=e.maximumSignificantDigits,l=e.roundingPriority,c={locale:n(this,d),type:n(this,p),minimumIntegerDigits:t,minimumFractionDigits:r,maximumFractionDigits:i};return"number"==typeof a&&(c.minimumSignificantDigits=a,c.maximumSignificantDigits=s),c.pluralCategories=o(n(this,d),"ordinal"===n(this,p)).slice(0),c.roundingPriority=l||"auto",c}},{key:"select",value:function(e){if(!(this instanceof m))throw new TypeError("select() called on incompatible ".concat(this));if("number"!=typeof e&&(e=Number(e)),!isFinite(e))return"other";var t=n(this,g).format(Math.abs(e));return n(this,f).call(this,t,"ordinal"===n(this,p))}},{key:"selectRange",value:function(e,t){if(!(this instanceof m))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=l(e),i=l(t);if(!isFinite(r))throw new RangeError("start must be finite");if(!isFinite(i))throw new RangeError("end must be finite");return n(this,h).call(this,this.select(r),this.select(i))}}])&&t(v.prototype,y),b&&t(v,b),Object.defineProperty(v,"prototype",{writable:!1}),m}();return"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(m.prototype,Symbol.toStringTag,{value:"Intl.PluralRules",writable:!1,configurable:!0}),Object.defineProperty(m,"prototype",{writable:!1}),m},Jn}!function(){if(ri)return ni;ri=1;var e=function(){if(ti)return ei;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)}ti=1;var r=e(ii());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!==Rn||"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 ei=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!==Rn?Rn.Intl={PluralRules:r.default}:"undefined"!=typeof window?window.Intl={PluralRules:r.default}:ni.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 oi={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",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","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:"Color1:",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..."}},ai={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":"Стоковые изображения",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":"Миллионы иконок","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:"Цвет 1:",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...":"Выберите опцию..."}},si={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":"Файл видалено","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":"Стокові зображення",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":"Мільйони іконок","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...":"Виберіть опцію..."}},li={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",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",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","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 ci={en:{translation:oi},ru:{translation:ai},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",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",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","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:si},"pt-br":{translation:li},pt:{translation:li},br:{translation:li},"pt-BR":{translation:li}};Mn.use(Gn).init({resources:ci,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 ui=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]},di=e=>{if(!e||e<=0)return"";const t=1048576;if(e<t){return`${Math.round(e/1024)} Kb`}return`${(e/t).toFixed(2)} Mb`},hi=e=>{if(null==e)return"";if("number"==typeof e)return di(e);const t=String(e).trim();if(!t)return"";const r=Number(t);return Number.isNaN(r)?t:di(r)},fi=(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 pi(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 fi(t,i)}catch(e){return console.warn("Could not fetch files for duplicate check:",e),t}}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:"m6 9 6 6 6-6"}));gi.displayName="ChevronDown";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 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"}));mi.displayName="Colors";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:"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"}));vi.displayName="Copy04";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:"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"}));yi.displayName="Crop02";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 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"}));bi.displayName="DotsVertical";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:"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"}));wi.displayName="FolderDownload";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 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"}));xi.displayName="FolderMinus";const Ci=({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"}));Ci.displayName="FolderPlus";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:"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"}));_i.displayName="FolderSearch";const Si=({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"}));Si.displayName="Grid01";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:"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"}));ki.displayName="Image03";const Ai=({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"}));Ai.displayName="Link01";const Ii=({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"}));Ii.displayName="List";const Ei=({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"}));Ei.displayName="PlaySquare";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 8v8m-4-4h8m6 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Fi.displayName="PlusCircle";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:"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"}));Ti.displayName="RefreshCw05";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:"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"}));Oi.displayName="Scale01";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:"m21 21-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"}));Pi.displayName="SearchMd";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:"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"}));Mi.displayName="Stars02";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 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"}));Ri.displayName="TextInput";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:"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"}));Li.displayName="ThumbsUp";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:"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"}));Ni.displayName="Trash03";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:"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"}));ji.displayName="Trash04";const Di=()=>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"})}),zi=()=>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"})}),Bi=()=>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"})}),Ui=()=>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"})}),Vi=()=>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"})]}),Hi=()=>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"})}),$i=()=>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"})}),Wi=()=>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"})]}),Gi=()=>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"})]}),qi=()=>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"})}),Yi=()=>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"})}),Xi=()=>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"})]}),Ki=()=>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"})]}),Zi=()=>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"})]}),Ji=()=>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"})}),Qi=t=>e(ae,Object.assign({component:Di},t)),eo=t=>e(ae,Object.assign({component:zi},t)),to=t=>e(ae,Object.assign({component:Bi},t)),ro=t=>e(ae,Object.assign({component:Ui},t)),no=t=>e(ae,Object.assign({component:Vi},t)),io=t=>e(ae,Object.assign({component:Hi},t)),oo=t=>e(ae,Object.assign({component:$i},t)),ao=t=>e(ae,Object.assign({component:Wi},t)),so=t=>e(ae,Object.assign({component:Gi},t)),lo=t=>e(ae,Object.assign({component:qi},t)),co=t=>e(ae,Object.assign({component:Yi},t)),uo=t=>e(ae,Object.assign({component:Xi},t)),ho=t=>e(ae,Object.assign({component:Ki},t)),fo=t=>e(ae,Object.assign({component:Zi},t)),po=t=>e(ae,Object.assign({component:Ji},t)),go=s({state:{},actions:{},options:{}}),mo=()=>l(go),vo=({children:t,options:r})=>{var n,i,s;const[l,u]=o([]),[h,f]=o([]),[p,g]=o(null),[m,v]=o(r.searchQuery||""),[y,b]=o(r.sortBySize||"name"),{config:w}=r,x=c(e=>{var t,r,n;if(e===nr){const e=!1!==(null===(t=null==w?void 0:w.features)||void 0===t?void 0:t.enableGif),r=!(null==w?void 0:w.enabledTabs)||w.enabledTabs.includes("gif");return e&&r}if(e===ir){const e=!1!==(null===(r=null==w?void 0:w.features)||void 0===r?void 0:r.enableStockImages),t=!(null==w?void 0:w.enabledTabs)||w.enabledTabs.includes("stock");return e&&t}if(e===or){const e=!1!==(null===(n=null==w?void 0:w.features)||void 0===n?void 0:n.enableIconStock),t=!(null==w?void 0:w.enabledTabs)||w.enabledTabs.includes("icons");return e&&t}return!0},[null==w?void 0:w.enabledTabs,null===(n=null==w?void 0:w.features)||void 0===n?void 0:n.enableGif,null===(i=null==w?void 0:w.features)||void 0===i?void 0:i.enableIconStock,null===(s=null==w?void 0:w.features)||void 0===s?void 0:s.enableStockImages]),[C,_]=o("date"),[S,k]=o("desc"),[A,I]=o([{id:"folders",name:"Папки"}]),[F,T]=o(""),[O,P]=o(!1),[M,R]=o(rr);a(()=>{(null==w?void 0:w.activeLibraryItem)&&R&&R(x(w.activeLibraryItem)?w.activeLibraryItem:rr)},[null==w?void 0:w.activeLibraryItem,x,R]),a(()=>{x(M)||R(rr)},[M,x]);const[L,N]=o({current:1,pageSize:20,total:0}),[j]=E.useForm(),[D]=E.useForm(),[z]=E.useForm(),[B]=E.useForm(),[U]=E.useForm(),[V]=E.useForm(),[H,$]=o(!1),[W,G]=o(!1),[q,Y]=o(!1),[X,K]=o(!1),[Z,J]=o(!1),[Q,ee]=o(!1),[te,re]=o(!1),[ne,ie]=o(null),[oe,ae]=o(null),[se,le]=o(null),ce=(e,t)=>{I(r=>r.map(r=>r.id===e?Object.assign(Object.assign({},r),{name:t}):r))},ue=c(e=>{N(t=>Object.assign(Object.assign({},t),e))},[N]),de=d(()=>{var e;return{folders:l,files:h,selectedFolder:p,searchTerm:m,sortField:y,sortBy:C,sortOrder:S,pathHistory:A,currentMenuFile:F,loading:O,pagination:L,isModalVisible:H,isUrlModalVisible:W,isRenameModalVisible:q,isMoveModalVisible:X,isRenameFolderModalVisible:Z,isCopyModalVisible:Q,isDeleteConfirmVisible:te,form:j,urlForm:D,renameForm:z,moveForm:B,renameFolderForm:U,copyForm:V,fileToRename:ne,folderToRename:oe,activeLibraryItem:M,multiSelect:null===(e=null==w?void 0:w.multiSelect)||void 0===e||e,undoDeletion:se}},[M,null==w?void 0:w.multiSelect,V,F,ne,h,l,j,Q,te,H,X,Z,q,W,O,B,L,A,U,z,m,p,C,y,S,se,D,oe]),he=d(()=>({setFolders:u,setFiles:f,setSelectedFolder:g,setSearchTerm:v,setSortField:b,setSortBy:_,setSortOrder:k,setPathHistory:I,setLoading:P,setPagination:ue,setIsModalVisible:$,setIsUrlModalVisible:G,setIsRenameModalVisible:Y,setIsMoveModalVisible:K,setIsRenameFolderModalVisible:J,setIsCopyModalVisible:ee,setIsDeleteConfirmVisible:re,setFileToRename:ie,setFolderToRename:ae,setUndoDeletion:le,updatePathHistoryOnFolderRename:ce,setActiveLibraryItem:e=>R(x(e)?e:rr),setCurrentMenuFile:T}),[ue,x]),fe=d(()=>({state:de,actions:he,options:r}),[he,r,de]);return e(go.Provider,{value:fe,children:t})},yo=()=>{const{options:e}=mo(),{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",ve,e),FolderIcon:e=>r("folder",ao,e),FolderOpenIcon:e=>r("folderOpen",me,e),AddFolderIcon:e=>r("addFolder",ge,e),FileIcon:e=>r("file",pe,e),UploadIcon:e=>r("upload",fe,e),UploadByUrlIcon:e=>r("uploadByUrl",he,e),ExpandArrowIcon:e=>r("expandArrow",de,e),CollapseArrowIcon:e=>r("collapseArrow",ue,e),ExpandFolderIcon:e=>r("expandArrow",Ci,e),CollapseFolderIcon:e=>r("collapseArrow",xi,e),FolderPreviewIcon:e=>r("folderPreview",so,e),EmptyFolderIcon:e=>r("folderPreview",lo,e),GridViewIcon:e=>r("gridView",ce,e),ListViewIcon:e=>r("listView",le,e),DropZoneFileIcon:e=>r("folderPreview",co,e),BigStockIcon:e=>r("folderPreview",uo,e),BigAIIcon:e=>r("folderPreview",ho,e),GifPlayIcon:e=>r("folderPreview",fo,e),StockBigIcon:e=>r("folderPreview",po,e),MixedViewIcon:e=>r("mixedView",Qi,e),LandscapeViewIcon:e=>r("landscapeView",eo,e),PortraitViewIcon:e=>r("portraitView",to,e),SquareViewIcon:e=>r("squareView",ro,e),LightModeIcon:e=>r("lightMode",io,e),DarkModeIcon:e=>r("darkMode",oo,e),AiIcon_2:e=>r("aiIcon_2",no,e),NoFilesIcon:e=>r("noFiles",_i,e),ThumbsUpIcon:e=>r("thumbsUp",Li,e),getCustomIcon:r}),[r])};var bo="noFilesContainer",wo="noFilesImage",xo="noFilesTitle",Co="noFilesDescription";const _o=()=>{const{t:r}=Kn(),{NoFilesIcon:n}=yo();return t("div",{className:bo,children:[e(n,{className:wo,size:48,strokeWidth:1.4}),e("h2",{className:xo,children:r("There's nothing here")}),e("div",{className:Co,children:r("Try using a different search query.")})]})};var So,ko={exports:{}},Ao=ko.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 Io=(So||(So=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]",k="[object RegExp]",A="[object Set]",I="[object String]",E="[object Symbol]",F="[object WeakMap]",T="[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,$=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,G=RegExp($.source),q=RegExp(W.source),Y=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),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",ke="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ie="['’]",Ee="["+we+"]",Fe="["+Ae+"]",Te="["+xe+"]",Oe="\\d+",Pe="["+Ce+"]",Me="["+_e+"]",Re="[^"+we+Ae+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))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Te+"|"+Le+")?",Ge="["+ke+"]?",qe=Ge+We+"(?:"+Be+"(?:"+[Ne,je,De].join("|")+")"+Ge+We+")*",Ye="(?:"+[Pe,je,De].join("|")+")"+qe,Xe="(?:"+[Ne+Te+"?",Te,je,De,Ee].join("|")+")",Ke=RegExp(Ie,"g"),Ze=RegExp(Te,"g"),Je=RegExp(Le+"(?="+Le+")|"+Xe+qe,"g"),Qe=RegExp([ze+"?"+Me+"+"+He+"(?="+[Fe,ze,"$"].join("|")+")",Ve+"+"+$e+"(?="+[Fe,ze+Ue,"$"].join("|")+")",ze+"?"+Ue+"+"+He,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oe,Ye].join("|"),"g"),et=RegExp("["+Be+we+xe+ke+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,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[T]=it[m]=it[O]=it[v]=it[y]=it[b]=it[x]=it[C]=it[_]=it[k]=it[A]=it[I]=it[F]=!1;var ot={};ot[p]=ot[g]=ot[T]=ot[O]=ot[m]=ot[v]=ot[P]=ot[M]=ot[R]=ot[L]=ot[N]=ot[x]=ot[C]=ot[_]=ot[k]=ot[A]=ot[I]=ot[E]=ot[j]=ot[D]=ot[z]=ot[B]=!0,ot[y]=ot[b]=ot[F]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,lt=parseInt,ct="object"==typeof Rn&&Rn&&Rn.Object===Object&&Rn,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 kt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function At(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function It(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 Et(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 Ft(e,t){return!(null==e||!e.length)&&zt(e,t,0)>-1}function Tt(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?Gt(e,t)/r:d}function Ht(e){return function(t){return null==t?r:t[e]}}function $t(e){return function(t){return null==e?r:e[t]}}function Wt(e,t,r,n,i){return i(e,function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)}),r}function Gt(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 qt(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 Jt(e,t){for(var r=-1,n=e.length;++r<n&&zt(t,e[r],0)>-1;);return r}function Qt(e,t){for(var r=e.length;r--&&zt(t,e[r],0)>-1;);return r}var er=$t({"À":"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=$t({"&":"&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=Je.lastIndex=0;Je.test(e);)++t;return t}(e):Nt(e)}function ur(e){return nr(e)?function(e){return e.match(Je)||[]}(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=$t({"&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,ke=t.Object,Ae=t.RegExp,Ie=t.String,Ee=t.TypeError,Fe=we.prototype,Te=_e.prototype,Oe=ke.prototype,Pe=t["__core-js_shared__"],Me=Te.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(ke),ze=dt._,Be=Ae("^"+Me.call(Re).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=pt?t.Buffer:r,Ve=t.Symbol,He=t.Uint8Array,$e=Ue?Ue.allocUnsafe:r,We=or(ke.getPrototypeOf,ke),Ge=ke.create,qe=Oe.propertyIsEnumerable,Ye=Fe.splice,Xe=Ve?Ve.isConcatSpreadable:r,Je=Ve?Ve.iterator:r,et=Ve?Ve.toStringTag:r,at=function(){try{var e=uo(ke,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ut=xe&&xe.now!==dt.Date.now&&xe.now,ht=t.setTimeout!==dt.setTimeout&&t.setTimeout,ft=Se.ceil,gt=Se.floor,mt=ke.getOwnPropertySymbols,Nt=Ue?Ue.isBuffer:r,$t=t.isFinite,pr=Fe.join,gr=or(ke.keys,ke),mr=Se.max,vr=Se.min,yr=xe.now,br=t.parseInt,wr=Se.random,xr=Fe.reverse,Cr=uo(t,"DataView"),_r=uo(t,"Map"),Sr=uo(t,"Promise"),kr=uo(t,"Set"),Ar=uo(t,"WeakMap"),Ir=uo(ke,"create"),Er=Ar&&new Ar,Fr={},Tr=jo(Cr),Or=jo(_r),Pr=jo(Sr),Mr=jo(kr),Rr=jo(Ar),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(!Qa(t))return{};if(Ge)return Ge(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 $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 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 Gr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Wr;++t<r;)this.add(e[t])}function qr(e){var t=this.__data__=new $r(e);this.size=t.size}function Yr(e,t){var r=Ha(e),n=!r&&Va(e),i=!r&&!n&&qa(e),o=!r&&!n&&!i&&ls(e),a=r||n||i||o,s=a?qt(e.length,Ie):[],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[qn(0,t-1)]:r}function Kr(e,t){return Ro(Ei(e),an(t,0,e.length))}function Zr(e){return Ro(Ei(e))}function Jr(e,t,n){(n!==r&&!za(e[t],n)||n===r&&!(t in e))&&nn(e,t,n)}function Qr(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&&Fi(t,Ts(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:ks(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(!Qa(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 Ei(e,s)}else{var h=po(e),f=h==b||h==w;if(qa(e))return Ci(e,l);if(h==_||h==p||f&&!o){if(s=c||f?{}:mo(e),!l)return c?function(e,t){return Fi(e,fo(e),t)}(e,function(e,t){return e&&Fi(t,Os(t),e)}(s,e)):function(e,t){return Fi(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 T: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 I:return new i(e);case k:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new i;case E:return n=e,Nr?ke(Nr.call(n)):{}}}(e,h,l)}}a||(a=new qr);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:Ts)(e);return kt(y||e,function(r,i){y&&(r=e[i=r]),Qr(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=ke(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 Ee(n);return To(function(){e.apply(r,i)},t)}function un(e,t,r,n){var i=-1,o=Ft,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;r&&(t=Ot(t,Xt(r))),n?(o=Tt,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gr(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__=Ir?Ir(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(Ir){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 Ir?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]=Ir&&t===r?i:t,this},$r.prototype.clear=function(){this.__data__=[],this.size=0},$r.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))},$r.prototype.get=function(e){var t=this.__data__,n=en(t,e);return n<0?r:t[n][1]},$r.prototype.has=function(e){return en(this.__data__,e)>-1},$r.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},Wr.prototype.clear=function(){this.size=0,this.__data__={hash:new Hr,map:new(_r||$r),string:new Hr}},Wr.prototype.delete=function(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t},Wr.prototype.get=function(e){return lo(this,e).get(e)},Wr.prototype.has=function(e){return lo(this,e).has(e)},Wr.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},Gr.prototype.add=Gr.prototype.push=function(e){return this.__data__.set(e,i),this},Gr.prototype.has=function(e){return this.__data__.has(e)},qr.prototype.clear=function(){this.__data__=new $r,this.size=0},qr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},qr.prototype.get=function(e){return this.__data__.get(e)},qr.prototype.has=function(e){return this.__data__.has(e)},qr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof $r){var n=r.__data__;if(!_r||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Wr(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,Ts)}function wn(e,t){return e&&yn(e,t,Ts)}function xn(e,t){return Et(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 ke(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 kn(e,t){return e>t}function An(e,t){return null!=e&&Re.call(e,t)}function In(e,t){return null!=e&&t in ke(e)}function En(e,t,n){for(var i=n?Tt:Ft,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 Gr(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 Fn(e,t,n){var i=null==(e=Io(e,t=yi(t,e)))?e:e[No(Xo(t))];return null==i?r:_t(i,e,n)}function Tn(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&&qa(e)){if(!qa(t))return!1;s=!0,d=!1}if(f&&!d)return a||(a=new qr),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 T: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 k:case I:return e==t+"";case x:var s=ir;case A: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 E: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,F=w?t.value():t;return a||(a=new qr),o(S,F,n,i,a)}}return!!f&&(a||(a=new qr),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=ke(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 qr;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!(!Qa(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 ke(e))Re.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Nn(e){if(!Qa(e))return function(e){var t=[];if(null!=e)for(var r in ke(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=Wa(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]?ko(t[0][0],t[0][1]):function(r){return r===e||Pn(r,e,t)}}function Bn(e,t){return wo(e)&&So(t)?ko(No(e),t):function(n){var i=ks(n,e);return i===r&&i===t?As(n,e):On(t,i,3)}}function Un(e,t,n,i,o){e!==t&&vn(t,function(a,s){if(o||(o=new qr),Qa(a))!function(e,t,n,i,o,a,s){var l=Eo(e,n),c=Eo(t,n),u=s.get(c);if(u)Jr(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&&qa(c),g=!f&&!p&&ls(c);d=c,f||p||g?Ha(l)?d=l:Ga(l)?d=Ei(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):Qa(l)&&!Ka(l)||(d=mo(c))):h=!1}h&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Jr(e,n,d)}}(e,t,s,n,Un,i,o);else{var l=i?i(Eo(e,s),a,s+"",e,t,o):r;l===r&&(l=a),Jr(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=ki(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 $n(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Cn(e,a);r(s,a)&&Jn(o,yi(a,e),s)}return o}function Wn(e,t,r,n){var i=n?Bt:zt,o=-1,a=t.length,s=e;for(e===t&&(t=Ei(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 Gn(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 qn(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(Ao(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 Jn(e,t,n,i){if(!Qa(e))return e;for(var o=-1,a=(t=yi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var c=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=Qa(d)?d:yo(t[o+1])?[]:{})}Qr(l,c,u),l=l[c]}return e}var Qn=Er?function(e,t){return Er.set(e,t),e}:rl,ei=at?function(e,t){return at(e,"toString",{configurable:!0,enumerable:!1,value:Qs(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=Ft,o=e.length,a=!0,s=[],l=s;if(r)a=!1,i=Tt;else if(o>=200){var c=t?null:Yi(e);if(c)return sr(c);a=!1,i=Zt,l=new Gr}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=Io(e,t=yi(t,e)))||delete e[No(Xo(t))]}function di(e,t,r,n){return Jn(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 Ga(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=$e?$e(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 ki(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 Ai(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 Ii(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 Ei(e,t){var r=-1,n=e.length;for(t||(t=we(n));++r<n;)t[r]=e[r];return t}function Fi(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):Qr(n,l,c)}return n}function Ti(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=ke(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(!Wa(r))return e(r,n);for(var i=r.length,o=t?i:-1,a=ke(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=ke(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 Qa(n)?n:r}}function ji(e){return function(t,n,i){var o=ke(t);if(!Wa(t)){var a=so(n,3);t=Ts(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 Ee(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=Ai(b,i,o,g)),a&&(b=Ii(b,a,l,g)),y-=C,g&&y<d){var _=ar(b,x);return Gi(e,t,zi,s.placeholder,n,b,_,c,u,d-y)}var S=f?n:this,k=p?S[e]:e;return y=b.length,c?b=function(e,t){for(var n=e.length,i=vr(t.length,n),o=Ei(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&&(k=v||Ni(k)),k.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 $i(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 Wi(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=gs(t),r=gs(r)),e(t,r)}}function Gi(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)&&Fo(p,f),p.placeholder=i,Po(p,e,t)}function qi(e){var t=Se[e];return function(e,r){if(e=gs(e),(r=null==r?0:vr(fs(r),292))&&$t(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=kr&&1/sr(new kr([,-0]))[1]==c?function(e){return new kr(e)}:sl;function Xi(e){return function(t){var r=po(t);return r==x?ir(t):r==A?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 Ee(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?Ai(d,u,t[4]):u,e[4]=d?ar(e[3],o):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ii(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?Gi(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?Qn:Fo)(w,b),e,t)}function Zi(e,t,n,i){return e===r||za(e,Oe[n])&&!Re.call(i,n)?t:e}function Ji(e,t,n,i,o,a){return Qa(e)&&Qa(t)&&(a.set(t,e),Un(e,t,r,Ji,a),a.delete(t)),e}function Qi(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 Gr: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(Ao(e,r,$o),e+"")}function ro(e){return _n(e,Ts,ho)}function no(e){return _n(e,Os,fo)}var io=Er?function(e){return Er.get(e)}:sl;function oo(e){for(var t=e.name+"",r=Fr[t],n=Re.call(Fr,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=Ts(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=ke(e),Et(mt(e),function(t){return qe.call(e,t)}))}:pl,fo=mt?function(e){for(var t=[];e;)Pt(t,ho(e)),e=We(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)&&Ja(i)&&yo(a,i)&&(Ha(e)||Va(e))}function mo(e){return"function"!=typeof e.constructor||_o(e)?{}:zr(We(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(!Qa(r))return!1;var n=typeof t;return!!("number"==n?Wa(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))||J.test(e)||!Z.test(e)||null!=t&&e in ke(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||kr&&po(new kr)!=A||Ar&&po(new Ar)!=F)&&(po=function(e){var t=Sn(e),n=t==_?e.constructor:r,i=n?jo(n):"";if(i)switch(i){case Tr:return O;case Or:return x;case Pr:return S;case Mr:return A;case Rr:return F}return t});var Co=Pe?Ka:gl;function _o(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Oe)}function So(e){return e==e&&!Qa(e)}function ko(e,t){return function(n){return null!=n&&n[e]===t&&(t!==r||e in ke(n))}}function Ao(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 Io(e,t){return t.length<2?e:Cn(e,ri(t,0,-1))}function Eo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Fo=Mo(Qn),To=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 kt(f,function(r){var n="_."+r[0];t&r[1]&&!Ft(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=qn(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(Q,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__=Ei(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var zo=Xn(function(e,t){return Ga(e)?un(e,mn(t,1,Ga,!0)):[]}),Bo=Xn(function(e,t){var n=Xo(t);return Ga(n)&&(n=r),Ga(e)?un(e,mn(t,1,Ga,!0),so(n,2)):[]}),Uo=Xn(function(e,t){var n=Xo(t);return Ga(n)&&(n=r),Ga(e)?un(e,mn(t,1,Ga,!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 $o(e){return null!=e&&e.length?mn(e,1):[]}function Wo(e){return e&&e.length?e[0]:r}var Go=Xn(function(e){var t=Ot(e,mi);return t.length&&t[0]===e[0]?En(t):[]}),qo=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]?En(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]?En(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?Wn(e,t):e}var Jo=to(function(e,t){var r=null==e?0:e.length,n=on(e,t);return Gn(e,Ot(t,function(e){return yo(e,r)?+e:e}).sort(ki)),n});function Qo(e){return null==e?e:xr.call(e)}var ea=Xn(function(e){return ci(mn(e,1,Ga,!0))}),ta=Xn(function(e){var t=Xo(e);return Ga(t)&&(t=r),ci(mn(e,1,Ga,!0),so(t,2))}),ra=Xn(function(e){var t=Xo(e);return t="function"==typeof t?t:r,ci(mn(e,1,Ga,!0),r,t)});function na(e){if(!e||!e.length)return[];var t=0;return e=Et(e,function(e){if(Ga(e))return t=mr(e.length,t),!0}),qt(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 Ga(e)?un(e,t):[]}),aa=Xn(function(e){return pi(Et(e,Ga))}),sa=Xn(function(e){var t=Xo(e);return Ga(t)&&(t=r),pi(Et(e,Ga),so(t,2))}),la=Xn(function(e){var t=Xo(e);return t="function"==typeof t?t:r,pi(Et(e,Ga),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=Ti(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)?kt:dn)(e,so(t,3))}function ya(e,t){return(Ha(e)?At:hn)(e,so(t,3))}var ba=Ti(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=Wa(e)?we(e.length):[];return dn(e,function(e){o[++n]=i?_t(t,e,r):Fn(e,t,r)}),o}),xa=Ti(function(e,t,r){nn(e,r,t)});function Ca(e,t){return(Ha(e)?Ot:Dn)(e,so(t,3))}var _a=Ti(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),[])}),ka=ut||function(){return dt.Date.now()};function Aa(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Ki(e,s,r,r,r,r,t)}function Ia(e,t){var i;if("function"!=typeof t)throw new Ee(n);return e=fs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Ea=Xn(function(e,t,r){var n=1;if(r.length){var i=ar(r,ao(Ea));n|=a}return Ki(e,n,t,r,i)}),Fa=Xn(function(e,t,r){var n=3;if(r.length){var i=ar(r,ao(Fa));n|=a}return Ki(t,n,e,r,i)});function Ta(e,t,i){var o,a,s,l,c,u,d=0,h=!1,f=!1,p=!0;if("function"!=typeof e)throw new Ee(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=ka();if(m(e))return y(e);c=To(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=ka(),n=m(e);if(o=arguments,a=this,u=e,n){if(c===r)return function(e){return d=e,c=To(v,t),h?g(e):l}(u);if(f)return xi(c),c=To(v,t),g(u)}return c===r&&(c=To(v,t)),l}return t=gs(t)||0,Qa(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(ka())},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 Ee(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||Wr),r}function Ra(e){if("function"!=typeof e)throw new Ee(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=Wr;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=Wi(kn),Ua=Wi(function(e,t){return e>=t}),Va=Tn(function(){return arguments}())?Tn:function(e){return es(e)&&Re.call(e,"callee")&&!qe.call(e,"callee")},Ha=we.isArray,$a=vt?Xt(vt):function(e){return es(e)&&Sn(e)==T};function Wa(e){return null!=e&&Ja(e.length)&&!Ka(e)}function Ga(e){return es(e)&&Wa(e)}var qa=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(!Qa(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 Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=bt?Xt(bt):function(e){return es(e)&&po(e)==x};function rs(e){return"number"==typeof e||es(e)&&Sn(e)==C}function ns(e){if(!es(e)||Sn(e)!=_)return!1;var t=We(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)==k},os=xt?Xt(xt):function(e){return es(e)&&po(e)==A};function as(e){return"string"==typeof e||!Ha(e)&&es(e)&&Sn(e)==I}function ss(e){return"symbol"==typeof e||es(e)&&Sn(e)==E}var ls=Ct?Xt(Ct):function(e){return es(e)&&Ja(e.length)&&!!it[Sn(e)]},cs=Wi(jn),us=Wi(function(e,t){return e<=t});function ds(e){if(!e)return[];if(Wa(e))return as(e)?ur(e):Ei(e);if(Je&&e[Je])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Je]());var t=po(e);return(t==x?ir:t==A?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(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var 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 Fi(e,Os(e))}function vs(e){return null==e?"":li(e)}var ys=Oi(function(e,t){if(_o(t)||Wa(t))Fi(t,Ts(t),e);else for(var r in t)Re.call(t,r)&&Qr(e,r,t[r])}),bs=Oi(function(e,t){Fi(t,Os(t),e)}),ws=Oi(function(e,t,r,n){Fi(t,Os(t),e,n)}),xs=Oi(function(e,t,r,n){Fi(t,Ts(t),e,n)}),Cs=to(on),_s=Xn(function(e,t){e=ke(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,Ji),_t(Ms,r,e)});function ks(e,t,n){var i=null==e?r:Cn(e,t);return i===r?n:i}function As(e,t){return null!=e&&go(e,t,In)}var Is=Bi(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=r},Qs(rl)),Es=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),Fs=Xn(Fn);function Ts(e){return Wa(e)?Yr(e):Ln(e)}function Os(e){return Wa(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}),Fi(e,no(e),r),n&&(r=sn(r,7,Qi));for(var i=t.length;i--;)ui(r,t[i]);return r}),Ls=to(function(e,t){return null==e?{}:function(e,t){return $n(e,t,function(t,r){return As(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),$n(e,r,function(e,r){return t(e,r[0])})}var js=Xi(Ts),Ds=Xi(Os);function zs(e){return null==e?[]:Kt(e,Ts(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()}),$s=Li(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),Ws=Ri("toLowerCase"),Gs=Li(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),qs=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(Qe)||[]}(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)}}),Js=to(function(e,t){return kt(t,function(t){t=No(t),nn(e,t,Ea(e[t],e))}),e});function Qs(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 Fn(r,e,t)}}),ol=Xn(function(e,t){return function(r){return Fn(e,r,t)}});function al(e,t,r){var n=Ts(t),i=xn(t,n);null!=r||Qa(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=xn(t,Ts(t)));var o=!(Qa(r)&&"chain"in r&&!r.chain),a=Ka(e);return kt(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__=Ei(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(It),ul=Vi(Lt);function dl(e){return wo(e)?Ht(No(e)):function(e){return function(t){return Cn(t,e)}}(e)}var hl=$i(),fl=$i(!0);function pl(){return[]}function gl(){return!1}var ml,vl=Ui(function(e,t){return e+t},0),yl=qi("ceil"),bl=Ui(function(e,t){return e/t},1),wl=qi("floor"),xl=Ui(function(e,t){return e*t},1),Cl=qi("round"),_l=Ui(function(e,t){return e-t},0);return Dr.after=function(e,t){if("function"!=typeof t)throw new Ee(n);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Dr.ary=Aa,Dr.assign=ys,Dr.assignIn=bs,Dr.assignInWith=ws,Dr.assignWith=xs,Dr.at=Cs,Dr.before=Ia,Dr.bind=Ea,Dr.bindAll=Js,Dr.bindKey=Fa,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)?Ei(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 Ee(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=Ts(e);return function(r){return ln(r,e,t)}}(sn(e,1))},Dr.constant=Qs,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=Ta,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)?Et: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=$o,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,Ts(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=Go,Dr.intersectionBy=qo,Dr.intersectionWith=Yo,Dr.invert=Is,Dr.invertBy=Es,Dr.invokeMap=wa,Dr.iteratee=nl,Dr.keyBy=xa,Dr.keys=Ts,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 Ia(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?Wn(e,t,so(r,2)):e},Dr.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Wn(e,t,r,n):e},Dr.pullAt=Jo,Dr.range=hl,Dr.rangeRight=fl,Dr.rearg=Da,Dr.reject=function(e,t){return(Ha(e)?Et: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 Gn(e,i),r},Dr.rest=function(e,t){if("function"!=typeof e)throw new Ee(n);return Xn(e,t=t===r?t:fs(t))},Dr.reverse=Qo,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:Jn(e,t,r)},Dr.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Jn(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 Ee(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 Ee(n);return Qa(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Ta(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]:Ei(Lo(vs(e)))},Dr.toPlainObject=ms,Dr.transform=function(e,t,r){var n=Ha(e),i=n||qa(e)||ls(e);if(t=so(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Qa(e)&&Ka(o)?zr(We(e)):{}}return(i?kt:bn)(e,function(e,n,i){return t(r,e,n,i)}),r},Dr.unary=function(e){return Aa(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||[],Qr)},Dr.zipObjectDeep=function(e,t){return gi(e||[],t||[],Jn)},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,Ts(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))&&q.test(e)?e.replace(W,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)?It: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=ks,Dr.gt=Ba,Dr.gte=Ua,Dr.has=function(e,t){return null!=e&&go(e,t,An)},Dr.hasIn=As,Dr.head=Wo,Dr.identity=rl,Dr.includes=function(e,t,r,n){e=Wa(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=Fs,Dr.isArguments=Va,Dr.isArray=Ha,Dr.isArrayBuffer=$a,Dr.isArrayLike=Wa,Dr.isArrayLikeObject=Ga,Dr.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sn(e)==m},Dr.isBuffer=qa,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(Wa(e)&&(Ha(e)||"string"==typeof e||"function"==typeof e.splice||qa(e)||ls(e)||Va(e)))return!e.length;var t=po(e);if(t==x||t==A)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&&$t(e)},Dr.isFunction=Ka,Dr.isInteger=Za,Dr.isLength=Ja,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=Qa,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)==F},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=$s,Dr.lowerFirst=Ws,Dr.lt=cs,Dr.lte=us,Dr.max=function(e){return e&&e.length?pn(e,rl,kn):r},Dr.maxBy=function(e,t){return e&&e.length?pn(e,so(t,2),kn):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=ka,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 qn(e,t)},Dr.reduce=function(e,t,r){var n=Ha(e)?Mt:Wt,i=arguments.length<3;return n(e,so(t,4),r,i,dn)},Dr.reduceRight=function(e,t,r){var n=Ha(e)?Rt:Wt,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(Wa(e))return as(e)?cr(e):e.length;var t=po(e);return t==x||t==A?e.size:Ln(e).length},Dr.snakeCase=Gs,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=qs,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?Gt(e,rl):0},Dr.sumBy=function(e,t){return e&&e.length?Gt(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=Ts(s),c=Kt(s,l),u=0,d=t.interpolate||ye,h="__p += '",f=Ae((t.escape||ye).source+"|"+d.source+"|"+(d===K?ue:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),p="//# sourceURL="+(Re.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++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=qt(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,Jt(i,o),Qt(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,Qt(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,Jt(i,ur(t))).join("")},Dr.truncate=function(e,t){var n=30,i="...";if(Qa(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=Ae(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))&&G.test(e)?e.replace($,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=Wo,al(Dr,(ml={},bn(Dr,function(e,t){Re.call(Dr.prototype,t)||(ml[t]=e)}),ml),{chain:!1}),Dr.VERSION="4.17.21",kt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Dr[e].placeholder=Dr}),kt(["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()}}),kt(["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}}),kt(["head","last"],function(e,t){var r="take"+(t?"Right":"");Vr.prototype[e]=function(){return this[r](1).value()[0]}}),kt(["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 Fn(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)})}),kt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Fe[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(Fr,n)||(Fr[n]=[]),Fr[n].push({name:t,func:r})}}),Fr[zi(r,2).name]=[{name:"wrapper",func:r}],Vr.prototype.clone=function(){var e=new Vr(this.__wrapped__);return e.__actions__=Ei(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ei(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ei(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:[Qo],thisArg:r}),new Ur(t,this.__chain__)}return this.thru(Qo)},Dr.prototype.toJSON=Dr.prototype.valueOf=Dr.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Dr.prototype.first=Dr.prototype.head,Je&&(Dr.prototype[Je]=function(){return this}),Dr}();ft?((ft.exports=fr)._=fr,ht._=fr):dt._=fr}).call(Ao)}(ko,ko.exports)),ko.exports);const Eo=e=>null===e.parentId||"null"===e.parentId||!e.parentId,Fo=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(Eo);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]},To=e=>{var t,r,n,i;const{state:o,actions:s,options:l}=mo(),{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(Io.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]),k=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]),A=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]),I=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]),E=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=k();_(Object.assign(Object.assign({},e),{page:1}))}},[p]),a(()=>{x&&_(k())},[]),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:A,handleSort:I,handlePaginationChange:E,getCurrentQueryParams:k}}},Oo=new Map;function Po(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 Mo=()=>{var e,t;const{notification:r}=I.useApp(),n=mo(),{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=Po(e),n=Date.now(),i=Oo.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||Oo.set(Po(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])},Ro={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."},Lo={FileTooLarge:"File is too large to upload.",PayloadTooLarge:"File is too large to upload."},No=(e,t,r)=>{var n,i,o;if(!e)return;const a=Ro[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=Lo[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})},jo=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},Do=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 zo=(e,t,r)=>{const n=Do(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:ui(r.fileSize),maxSize:ui(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:ui(r.fileSize),maxSize:ui(r.maxSize)}:void 0,a=No(i,t,o);return null!=a?a:t("Error uploading file")},Bo=e=>{const t=Do(e);return"path_folder_not_found"===(null==t?void 0:t.code)},Uo=["file_get_contents","open stream","failed to open stream","http request failed","curl_error"];const Vo=(e,t,r)=>{var n;if(!e)return t("Error when downloading a file by URL");const i=null!==(n=(e=>{const t=jo(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=No(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!Uo.some(e=>t.includes(e))}(a)?a:t("Failed to download file from the URL.")},Ho=e=>Array.isArray(e)?e.filter(e=>(null==e?void 0:e.id)&&"folders"!==e.id).map(e=>e.name).filter(Boolean).join("/"):"",$o=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},Wo=(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 $o(a)||null}const o=Do(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 $o(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 $o(r)||null}}return null})(e);return r?(e=>{const t=e.split("/").filter(Boolean);return t.length<=1?"":(t.pop(),t.join("/"))})(r):Ho(t)},Go=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}`)},qo=()=>{var e,t;const{state:r,actions:i,options:o}=mo(),{t:a}=Kn(),s=Mo(),{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=Do(t);if(!e&&(404===(null==r?void 0:r.status)||"FileNotFound"===(null==r?void 0:r.code))){const e=Wo(t,d||[]);try{return await Go({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=No(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]),k=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]),A=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]),I=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=Ur(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(Vr(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 k(p,{preserveSelection:Boolean(e)}),await C(),await new Promise(e=>setTimeout(e,200));await A(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=Do(e),o=No(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,k,C,A,v,s,a,l,g,b,d]),E=c(()=>{null==v||v(!1)},[v]),F=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(ve,{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?F(o,i):void 0}})},[l]),T=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=F(r),[t]},[l,a,F]),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=Ur(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:I,handleModalCancel:E,generateMenuItems:T,renameFolder:O}}},Yo=()=>{const{options:e,actions:t}=mo(),{dataProviders:r,config:n}=e,{setUndoDeletion:i}=t,{t:o}=Kn(),a=Mo(),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 Bo(r)}),n=t.filter(e=>{var t;const r=null!==(t=e.innerException)&&void 0!==t?t:e.error;return!Bo(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=Do(n);d.push({itemId:r,itemName:s(r),error:i})})}if(n.success)c+=e.length;else{const t=n.error;if(Bo(t))c+=e.length;else if(t){u+=e.length;const r=Do(t);d.push({error:r})}else u+=e.length}return}catch(r){if(Bo(r))c+=e.length;else{const n=t?"Ошибка при удалении":"Ошибка при перемещении в корзину";console.error(n,r),u+=e.length;const i=Do(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 Xo 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,Xo)}}const Ko=/^(localhost|127\.0\.0\.1|0\.0\.0\.0|::1)$/i,Zo=/^(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.)/;function Jo(e,t){const r=e.trim();if(!r)throw new Xo(t("Enter the URL of the image"),"UploadUrlInvalid");if(r.length>8192)throw new Xo(t("URL too long"),"UploadUrlInvalid");let n;try{n=new URL(r)}catch(e){throw new Xo(t("The specified URL is not valid."),"UploadUrlInvalid")}const i=n.protocol.toLowerCase();if("http:"!==i&&"https:"!==i)throw new Xo(t("Only http and https URLs are supported"),"UploadUrlInvalid");const o=n.hostname.toLowerCase();if(Ko.test(o)&&("undefined"==typeof window||!Ko.test(window.location.hostname.toLowerCase())))throw new Xo(t("Private and local URLs are not allowed"),"UploadUrlInvalid");if(Zo.test(o))throw new Xo(t("Private and local URLs are not allowed"),"UploadUrlInvalid")}function Qo(e,t){return new Promise(function(r,n){let i;return ea(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 ea=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 ta={},ra={get exports(){return ta},set exports(e){ta=e}};!function(){var e,t,r={};ra.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,k=65535&_;if(0!=_){k=65535&_;var A=s(S=_>>>16,a.of0);a.lhst[257+A]++;var I=s(k,a.df0);a.dhst[I]++,b+=a.exb[A]+a.dxb[I],f[m]=S<<23|c-d,f[m+1]=k<<16|A<<8|I,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 k=0;k<286;k++)b.lhst[k]=0;for(k=0;k<30;k++)b.dhst[k]=0;for(k=0;k<19;k++)b.ihst[k]=0;var A=C<_&&C<S?0:_<S?1:2;if(w(l,c,e),w(l,c+1,A),c+=3,0==A){for(;7&c;)c++;c=r.F._copyExact(o,a,s,l,c)}else{var I,E;if(1==A&&(I=b.fltree,E=b.fdtree),2==A){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),I=b.ltree,E=b.dtree,x(l,c,p-257),x(l,c+=5,g-1),x(l,c+=5,m-4),c+=4;for(var F=0;F<m;F++)x(l,c+3*F,b.itree[1+(b.ordr[F]<<1)]);c+=3*m,c=r.F._codeTiny(v,b.itree,l,c),c=r.F._codeTiny(y,b.itree,l,c)}for(var T=a,O=0;O<n;O+=2){for(var P=t[O],M=P>>>23,R=T+(8388607&P);T<R;)c=r.F._writeLit(o[T++],I,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,I,l,c),M-b.of0[j]),c+=b.exb[j],w(l,c=r.F._writeLit(D,E,l,c),N-b.df0[D]),c+=b.dxb[D],T+=M}}c=r.F._writeLit(256,I,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 k=1;for(S=0;S<b;S++){var A=a(e,_+3*S,3);d.itree[1+(d.ordr[S]<<1)]=A,A>k&&(k=A)}_+=3*b,l(d.itree,k),c(d.itree,k,d.imap),f=d.lmap,p=d.dmap,_=s(d.imap,(1<<k)-1,v+y,e,_,d.ttree);var I=i._copyOut(d.ttree,0,v,d.ltree);w=(1<<I)-1;var E=i._copyOut(d.ttree,v,y,d.dtree);x=(1<<E)-1,l(d.ltree,I),c(d.ltree,I,f),l(d.dtree,E),c(d.dtree,E,p)}for(;;){var F=f[u(e,_)&w];_+=15&F;var T=F>>>4;if(T>>>8==0)t[C++]=T;else{if(256==T)break;var O=C+T-254;if(T>264){var P=d.ldef[T-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 na=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:ta},[ta]);const ia=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 k=0;k<r;k++){var A=(_=255*(t[e+(k>>>3)]>>>7-(7&k)&1))==255*m?0:255;u[n+k]=A<<24|_<<16|_<<8|_}else if(2==h)for(k=0;k<r;k++)A=(_=85*(t[e+(k>>>2)]>>>6-((3&k)<<1)&3))==85*m?0:255,u[n+k]=A<<24|_<<16|_<<8|_;else if(4==h)for(k=0;k<r;k++)A=(_=17*(t[e+(k>>>1)]>>>4-((1&k)<<2)&15))==17*m?0:255,u[n+k]=A<<24|_<<16|_<<8|_;else if(8==h)for(k=0;k<r;k++)A=(_=t[e+k])==m?0:255,u[n+k]=A<<24|_<<16|_<<8|_;else if(16==h)for(k=0;k<r;k++)_=t[e+(k<<1)],A=f(t,e+(k<<1))==m?0:255,u[n+k]=A<<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}=ia,{_bin:t}=ia,r=ia._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={},k=[],A=[];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++)k.push(r.plte[x].est.rgba);let n=0;for(x=0;x<_.length;x++){const e=(E=_[x]).img.length;var I=new Uint8Array(r.inds.buffer,n>>2,e>>2);A.push(I);const t=new Uint8Array(r.abuf,n,e);p&&s(E.img,E.rect.width,E.rect.height,k,t,I),E.img.set(t),n+=e}}else for(b=0;b<_.length;b++){var E=_[b];const e=new Uint32Array(E.img.buffer);var F=E.rect.width;for(w=e.length,I=new Uint8Array(w),A.push(I),x=0;x<w;x++){const t=e[x];if(0!=x&&t==e[x-1])I[x]=I[x-1];else if(x>F&&t==e[x-F])I[x]=I[x-F];else{let e=S[t];if(null==e&&(S[t]=e=k.length,k.push(t),k.length>=300))break;I[x]=e}}}const T=k.length;for(T<=256&&0==f&&(v=T<=2?1:T<=4?2:T<=16?4:8,v=Math.max(v,u)),b=0;b<_.length;b++){(E=_[b]).rect.x,E.rect.y,F=E.rect.width;const e=E.rect.height;let t=E.img;new Uint32Array(t.buffer);let r=4*F,n=4;if(T<=256&&0==f){r=Math.ceil(v*F/8);var O=new Uint8Array(r*e);const i=A[b];for(let t=0;t<e;t++){x=t*r;const e=t*F;if(8==v)for(var P=0;P<F;P++)O[x+P]=i[e+P];else if(4==v)for(P=0;P<F;P++)O[x+(P>>1)]|=i[e+P]<<4-4*(1&P);else if(2==v)for(P=0;P<F;P++)O[x+(P>>2)]|=i[e+P]<<6-2*(3&P);else if(1==v)for(P=0;P<F;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(F*e*3);const i=F*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*F}E.img=t,E.bpl=r,E.bpp=n}return{ctype:m,depth:v,plte:k,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=na;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]]};ia.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)},ia.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)},ia.encode.compress=u,ia.encode.dither=s,ia.quantize=g,ia.quantize.getKDtree=m,ia.quantize.getNearest=v}();const oa={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,oa._dly)):t(u)}()},toBlob(e,t){this.toArrayBuffer(e,e=>{t(new Blob([e],{type:"image/bmp"}))})},_dly:9};var aa={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},sa={[aa.CHROME]:16384,[aa.FIREFOX]:11180,[aa.DESKTOP_SAFARI]:16384,[aa.IE]:8192,[aa.IOS]:4096,[aa.ETC]:8192};const la="undefined"!=typeof window,ca="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,ua=la&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),da=(la||ca)&&(ua&&ua.getOriginalSymbol(window,"File")||"undefined"!=typeof File&&File),ha=(la||ca)&&(ua&&ua.getOriginalSymbol(window,"FileReader")||"undefined"!=typeof FileReader&&FileReader);function fa(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 pa(e){return new Promise((t,r)=>{const n=new ha;n.onload=()=>t(n.result),n.onerror=e=>r(e),n.readAsDataURL(e)})}function ga(e){return new Promise((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=e=>r(e),n.src=e})}function ma(){if(void 0!==ma.cachedResult)return ma.cachedResult;let e=aa.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=aa.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=aa.IOS:/Safari/i.test(t)?e=aa.DESKTOP_SAFARI:/Firefox/i.test(t)?e=aa.FIREFOX:(/MSIE/i.test(t)||1==!!document.documentMode)&&(e=aa.IE),ma.cachedResult=e,ma.cachedResult}function va(e,t){const r=ma(),n=sa[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 ya(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 ba(e,t){const{width:r,height:n}=va(e.width,e.height),[i,o]=ya(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 wa(){return void 0!==wa.cachedResult||(wa.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"undefined"!=typeof document&&"ontouchend"in document),wa.cachedResult}function xa(e,t={}){return new Promise(function(r,n){let i,o;var a=function(){try{return o=ba(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 pa(e).then(function(e){try{return t=e,ga(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(wa()||[aa.DESKTOP_SAFARI,aa.MOBILE_SAFARI].includes(ma()))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 Ca(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=ia.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=>oa.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),fa(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 _a(e){e.width=0,e.height=0}function Sa(){return new Promise(function(e,t){let r,n,i,o;return void 0!==Sa.cachedResult?e(Sa.cachedResult):fa("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(a){try{return r=a,xa(r).then(function(a){try{return n=a[1],Ca(n,r.type,r.name,r.lastModified).then(function(r){try{return i=r,_a(n),xa(i).then(function(r){try{return o=r[0],Sa.cachedResult=1===o.width&&2===o.height,e(Sa.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 ka(e){return new Promise((t,r)=>{const n=new ha;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 Aa(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]=ya(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),_a(e)),a}function Ia(e,t){const{width:r}=e,{height:n}=e,[i,o]=ya(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),_a(e),i}function Ea(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 k(e=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=e,t.onProgress(Math.min(o,100))}function A(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,k(),xa(e,t).then(function(r){try{return[,l]=r,k(),c=Aa(l,t),k(),new Promise(function(r,n){var i;if(!(i=t.exifOrientation))return ka(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,k(),Sa().then(function(r){try{return d=r?c:Ia(c,u),k(),h=t.initialQuality||1,f=t.fileType||e.type,Ca(d,f,e.name,e.lastModified,h).then(function(r){try{{if(p=r,k(),g=p.size>s,m=p.size>e.size,!g&&!m)return A(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]=ya(t,r),C.drawImage(_,0,0,t,r),h*="image/png"===f?.85:.95,Ca(x,f,e.name,e.lastModified,h).then(function(e){try{return w=e,_a(_),_=x,b=w.size,A(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()?I.call(this):e;e=u}else e=e.call(this)}catch(e){return i(e)}}}.bind(this))(u);function I(){return _a(_),_a(x),_a(c),_a(d),_a(l),A(100),n(w)}}}catch(E){return i(E)}}.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 Fa;function Ta(e,t){return new Promise((r,n)=>{Fa||(Fa=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(Fa);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 Oa(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 da))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 Ea(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 Ea(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",Ta(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=Qo(e,o))}catch(e){}return r(o)}})}function Pa(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=Ar(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=Ar(t),r=Fr(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"}}Oa.getDataUrlFromFile=pa,Oa.getFilefromDataUrl=fa,Oa.loadImage=ga,Oa.drawImageInCanvas=ba,Oa.drawFileInCanvas=xa,Oa.canvasToFile=Ca,Oa.getExifOrientation=ka,Oa.handleMaxWidthOrHeight=Aa,Oa.followExifOrientation=Ia,Oa.cleanupCanvasMemory=_a,Oa.isAutoOrientationInBrowser=Sa,Oa.approximateBelowMaximumCanvasSizeOfBrowser=va,Oa.copyExifWithoutOrientation=Qo,Oa.getBrowserName=ma,Oa.version="2.0.2";const Ma={MAX_SIZE_MB:.48,MAX_WIDTH_OR_HEIGHT:2e3,QUALITY:.8},Ra=["gif","svg"];function La(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 Na(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=La(s),u=La(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 ja(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 Da(e,t,r,n,i){const o=await ja(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 za(e,t,r,n){return new File([e],t,{type:r,lastModified:n})}function Ba(e,t){return t&&t!==e.name?za(e,t,e.type,e.lastModified):e}async function Ua(e,t={}){const{maxSizeMB:r=Ma.MAX_SIZE_MB,maxWidthOrHeight:n=Ma.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}=Na(s,o,a),u=await ja(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:Tr(c.name))||i||"image/jpeg",h=Ar(d);if(!h.startsWith("image/"))return Ba(c,o);const f="image/webp"===(p=h)?"image/jpeg":p;var p;const g=Fr(h),m=Fr(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,!Ra.includes(b));var b;if(!y&&!(f!==h))return Ba(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 Oa(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?za(e,i,r,t.lastModified):e:za(e,i,r,t.lastModified)}(i,c,Ar(i.type||f),v)}catch(e){console.error("prepareImageForUpload failed",e);try{return Ba(c,v)}catch(e){return console.error("Failed to create File with normalized name after image preparation error",e),c}}}async function Va(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 Ha=/^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;function $a(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])=>!Ha.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 Wa(e){return!!(null==e?void 0:e.startsWith("image/"))&&"image/gif"!==e}function Ga(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 qa(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 Ya(e){try{const t=new URL(e).pathname.split("/").pop();return t?decodeURIComponent(t):void 0}catch(e){return}}function Xa(e){return null==e||""===e||"folders"===e?null:e}async function Ka(e){const t=await fetch(e,{mode:"cors"});if(!t.ok)throw new Xo(`HTTP ${t.status}`,"UploadUrlDownloadFailed",t.status);return t.blob()}function Za(e,t){var r,n;if(!(e instanceof Blob)||0===e.size)throw new Xo(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 Xo(t("Content type at the URL is not allowed."),"UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:i}}const Ja=()=>{var e,t,r,n;const{state:o,actions:a,options:s}=mo(),l=To(),{sortBy:u,sortOrder:d}=l.state,{actions:{fetchFolders:h}}=qo(),{t:f}=Kn(),p=Mo(),{deleteItems:g}=Yo(),{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:k,setLoading:A,setIsUrlModalVisible:I,setActiveLibraryItem:E,setPagination:F,setSelectedFolder:T,setPathHistory:O}=a,{dataProviders:P}=s,M=c(async e=>{var t,r,n;if(!(null==P?void 0:P.getFiles))return[];const i=null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.disablePagination,{files:o,pagination:a}=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===(r=null==e?void 0:e.search)||void 0===r?void 0:r.trim())||void 0,sortBy:null==e?void 0:e.sortBy,sortOrder:null==e?void 0:e.sortOrder,page:i||null==e?void 0:e.page,limit:i||null==e?void 0:e.limit,itemType:(null==e?void 0:e.itemType)||"all"});return F&&((null===(n=null==s?void 0:s.config)||void 0===n?void 0:n.disablePagination)?F({current:1,pageSize:o.length||1,total:o.length||0}):a&&F({current:a.page,pageSize:a.limit,total:a.total})),o},[P,null===(e=null==s?void 0:s.config)||void 0===e?void 0:e.disablePagination,F]),R=c(async(e,t,r)=>pi(P,e,t,r,Vr(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==A||A(!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 Fo(t,r,null==P?void 0:P.getFolders)),"Trash"!==(m||"")&&(t=t.filter(e=>!(e.isFolder&&"Trash"===e.id))),null==k||k(t);const n=Xa(r.folderId);if(n===Xa(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=Do(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=Wo(o,w||[]);try{return await Go({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&&T&&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),T(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")}]),T("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&&T&&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||(T(c.selectedFolder),O(c.pathHistory.map(e=>Object.assign({},e))),s.onPathChange&&s.onPathChange(c.pathHistory.map(e=>e.name)))}const u=No(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 Va({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}),k=u&&u!==C?u:void 0;p.error({id:"FILES_FETCH_FAILED",message:_,description:k,placement:"bottomRight",innerException:o,notificationDedupe:!0,data:{params:Object.assign(Object.assign({},d),{folderName:b}),folderName:b}})}finally{null==A||A(!1)}},[P,k,A,T,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=$a(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;Jo(e,f);const i=$a(e),o=await j(i,t);if(o)return{kind:"existing",file:o,normalizedUrl:i};let a,l,c;const u=null===(r=null==s?void 0:s.config)||void 0===r?void 0:r.handleFileProxy,d=null===(n=null==s?void 0:s.config)||void 0===n?void 0:n.handleProxyUrl,h=function(e){if("undefined"==typeof window)return!1;try{return new URL(e).origin===window.location.origin}catch(e){return!1}}(i);if(!h&&u)try{const e=Za(await Promise.resolve(u(i)),f);a=e.blob,l=e.mimeType}catch(e){c=e,console.warn("handleFileProxy failed or returned a non-image blob, falling back to next strategy",e)}if(!h&&!a&&d)try{const e=await Promise.resolve(d(i)),t=Za(await Ka(e),f);a=t.blob,l=t.mimeType}catch(e){c=e,console.warn("handleProxyUrl fetch failed or returned a non-image blob, falling back to direct fetch",e)}if(!a)try{const e=Za(await Ka(i),f);a=e.blob,l=e.mimeType}catch(e){c=e}if(!a||!l)throw c instanceof Error?c:new Xo(f("Failed to download file from the URL."),"UploadUrlDownloadFailed");const p=Fr(l),g=Ya(i)||"uploaded-file",m=g.replace(/\.[^.]+$/,"")||"uploaded-file";return{kind:"blob",blob:a,normalizedUrl:i,mimeType:l,extension:p,fileName:Br(g.includes(".")?g:`${m}.${p}`,null==s?void 0:s.config)}},[j,null==s?void 0:s.config,f]),z=c(async(e,t)=>{var r,n,i,o;Jo(e,f);const a=$a(e);try{const e=await D(a,t);if("existing"===e.kind)return e.file;return{thumbnail:await qa(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=Br(Ya(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=Za(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 Ka(o.url):(null==o?void 0:o.thumbnailUrl)?await Ka(o.thumbnailUrl):(null==o?void 0:o.sourceUrl)?await Ka(o.sourceUrl):void 0,f),c=await qa(l.blob);return Object.assign(Object.assign({},o),{thumbnail:c,type:o.type||l.mimeType,extension:o.extension||Fr(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=Do(u),h=(l=null==d?void 0:d.code,c="UploadUrlDownloadFailed","string"==typeof l?l:c),g=u instanceof Xo?u:new Xo(null!==(o=null!==(i=No(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:Do(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:Do(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 _=Br(e.name,null==s?void 0:s.config),S=_.split(".").pop()||"",k=n?"":null!=t?t:m||"";let A=e;try{if(Or(e)){const t=null!==(a=null===(i=null==s?void 0:s.config)||void 0===i?void 0:i.compressMaxSize)&&void 0!==a?a:Ma.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())||Tr(e.name)||e.type;A=await Ua(e,{maxSizeMB:t,maxWidthOrHeight:r,mimeType:o,fileName:_,libURL:n,enableCompression:Wa(o),convertSvgToPng:!0})}else A=Ga(e,_)}catch(t){console.warn("Image preparation failed, uploading original file",t),A=Ga(e,_)}let I=A.name;const F=Vr(null==s?void 0:s.config);F&&(I=await R(I,k,n)),F&&(A=Ga(A,I));try{if(null==P?void 0:P.uploadFiles)try{const t=await P.uploadFiles({items:[{name:I,size:A.size,type:A.type||e.type,folderId:k,data:A,extension:S,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:_,innerException:null==i?void 0:i.error,data:{itemName:_,folderId:k||null,eventSource:"upload"}})}return void(E&&E(rr))}{const t=i.data;if(t.id){const r=(null!==(v=t.folderId)&&void 0!==v?v:k)||void 0;await N({folderId:r,noFolder:n});let i=o.files.find(e=>e.id===t.id);if(!i)try{i=(await M({folderId:r,noFolder:n,itemType:"file"})).find(e=>e.id===t.id)}catch(e){console.warn("uploadFileWithProvider: не удалось получить свежий список файлов",e)}return E&&E(rr),i||Object.assign(Object.assign({},t),{id:t.id,name:t.name||_,folderId:null!==(b=null!==(y=t.folderId)&&void 0!==y?y:k)&&void 0!==b?b:null,type:A.type||e.type,size:A.size,extension:S||_.split(".").pop()||"",thumbnail:null!==(w=t.thumbnail)&&void 0!==w?w:void 0,url:null!==(x=t.url)&&void 0!==x?x:void 0,thumbnailUrl:null!==(C=t.thumbnailUrl)&&void 0!==C?C: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:_,innerException:t.error,data:{itemName:_,folderId:k||null,eventSource:"upload"}})}return void(E&&E(rr))}return void(E&&E(rr))}catch(e){throw e}if(null==P?void 0:P.uploadFile){const t=await P.uploadFile({name:I,size:A.size,type:A.type||e.type,folderId:k,noFolder:n,data:A,extension:S});return E&&E(rr),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=Do(e),n=No(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:_,innerException:e,data:{itemName:_,folderId:k||null,error:Do(e),eventSource:"upload"}})}},[P,m,E,o.files,N,M,p,f,null==s?void 0:s.config]),$=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]),W=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 $(t||"",r)||t||"")}return null!==(o=null!==(i=s)&&void 0!==i?i:t)&&void 0!==o?o:null},[$]);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 W(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)}},[W]);const G=c(async(e,t)=>{var r,n,i,o,a,l,c,u,d,h,g,v,y,b,w,x,C,_,S,k,A,I,F,T,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},$=[];for(let r=0;r<e.length;r++){const v=e[r];if(!Or(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=Br(v.name,null==s?void 0:s.config);let b=v;try{if(Or(v)){const e=null!==(o=null===(i=null==s?void 0:s.config)||void 0===i?void 0:i.compressMaxSize)&&void 0!==o?o:Ma.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())||Tr(v.name)||v.type;b=await Ua(v,{maxSizeMB:e,maxWidthOrHeight:t,mimeType:n,fileName:y,libURL:r,enableCompression:Wa(n),convertSvgToPng:!0})}else b=Ga(v,y)}catch(e){console.warn("Image preparation failed, uploading original file",e),b=Ga(v,y)}const w=`${Date.now()}-${r}-${Math.random().toString(36).slice(2,8)}`,x=await W(b,m);null===(g=null==t?void 0:t.onStart)||void 0===g||g.call(t,b),$.push({file:b,targetFolderId:x,requestId:w,originalFileName:v.name,originalIndex:r})}const G=$.length;if(0===G)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};const q=Vr(null==s?void 0:s.config),Y=new Map;if(q&&(null==P?void 0:P.getFiles)){const e=[...new Set($.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=$.map(e=>{const t=q?((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=fi(t,Array.from(i));return i.add(o.toLowerCase()),o})(e.targetFolderId,e.file.name):e.file.name,r=q?Ga(e.file,t):e.file;return Object.assign(Object.assign({},e),{resolvedUploadName:t,uploadFile:r})}),Z=!t,J=1===G&&Z,Q=[],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++,Q.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=Do(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?ui(Number(g)):void 0,maxSize:null!=v?ui(Number(v)):void 0},b=null==h?void 0:h.code,w="BatchItemLimitExceeded"===b||"exceeded_max_files"===b?b:null!==(l=jo(null==h?void 0:h.message))&&void 0!==l?l:b,x="BatchItemLimitExceeded"===w||"exceeded_max_files"===w?zo(r,f):No(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:Do(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:Do(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:G,successes:[],errors:[],totalCount:G};{const e=[];try{(null==t?void 0:t.onProgress)&&$.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:J})}else{const e=null==i?void 0:i.data,r=null!==(k=null==e?void 0:e.name)&&void 0!==k?k:t.resolvedUploadName,n=null!==(F=null!==(I=null!==(A=null==e?void 0:e.folderId)&&void 0!==A?A:t.targetFolderId)&&void 0!==I?I:m)&&void 0!==F?F:null;await le(r,n,null!==(T=null==i?void 0:i.error)&&void 0!==T?T:new Error(f("Error uploading file")),{emitNotification:J,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:J})}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:J,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:J,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}finally{e.forEach(e=>window.clearInterval(e))}}if(ie>0&&(E&&E(rr),G>1&&Z)){const e=H(Q),t=e?f("Uploaded",{names:e}):f("uploads_success_summary",{successCount:ie,totalCount:G});p.success({id:"FILES_UPLOAD_BATCH_SUCCESS",message:t,placement:"bottomRight",data:{successCount:ie,totalCount:G,itemIds:ee,itemNames:Q,folderId:null!=m?m:null,eventSource:"upload"}})}if(oe>0&&Z&&!J)if(G>1){const e=te.map(e=>e.fileName),t=H(e),r=t?f("Failed",{names:t}):f("uploads_fail_summary",{failCount:oe,totalCount:G});p.error({id:"FILES_UPLOAD_BATCH_FAILED",message:r,placement:"bottomRight",data:{failCount:oe,totalCount:G,itemNames:e,folderId:null!=m?m:null,errors:re,eventSource:"upload"}})}else if(1===G&&re.length>0&&(null===(z=re[0].error)||void 0===z?void 0:z.code)){const e=No(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:G,itemNames:[t],folderId:null!=m?m:null,errors:re,eventSource:"upload"}})}return{successCount:ie,failCount:oe,successes:Q,errors:te,totalCount:G,uploadedFiles:ne.size>0?ne:void 0}},[P,null===(r=null==s?void 0:s.config)||void 0===r?void 0:r.dedupeUploadNamesOnClient,p,W,m,E,f,null==s?void 0:s.config]),q=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==A||A(!0);const{successes:t,errors:i,uploadedFiles:a}=await G(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==A||A(!1)}},n.click()},[null==P?void 0:P.uploadFiles,m,p,f,A,N,h,u,d,G,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 Xo(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 Xo(f("Please fill in all fields"),"UploadUrlInvalid");if(Jo(l,f),l=$a(l),null==A||A(!0),l){const e=l.split("?")[0].split("#")[0].split("/");c=e[e.length-1]||"uploaded-file",c=Br(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 Xo(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 Xo(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==I||I(!1),null==v||v.resetFields()),E&&E(rr),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=Do(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)?zo(t,f,s):Vo(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==A||A(!1)}},[v,A,P,p,f,I,E,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 G(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,G,p,f]);return{fetchFiles:N,handleDeleteFile:B,handleDeleteFolder:U,handleAddFile:q,handleAddFileByUrl:Y,handleDroppedFiles:X,getFileData:V,findFileByUrl:j,resolveFileForEditByUrl:z,uploadFileWithProvider:H}},Qa=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},es=e=>e;const ts=e=>{const t=(e=>e?Qa(e):Qa)(e),r=e=>function(e,t=es){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 rs(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const ns=(is=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=rs(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 rs(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 rs(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 rs(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)}),rs(e.selectedFiles,c)?e:{selectedFiles:c}}if(i&&!e.anchorId){const r=new Set([t]);return rs(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),rs(e.selectedFiles,r)&&e.anchorId===t?e:{selectedFiles:r,anchorId:t}}const l=new Set([t]);return rs(e.selectedFiles,l)&&e.anchorId===t?e:{selectedFiles:l,anchorId:t}})}}),is?ts(is):ts);var is;const os=e=>{var t,r,n,i;const{state:o,actions:a,options:s}=mo(),{t:l}=Kn(),u=qo(),d=Mo(),{fetchFolders:h}=u.actions,{renameItem:f}=(()=>{const{options:e}=mo(),{dataProviders:t}=e,{t:r}=Kn(),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=Ur(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=Br(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:Do(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},k=(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)}},A=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:k(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:k(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]),I=c(()=>{null==x||x(!1),null==w||w(null),null==v||v.resetFields()},[x,w,v]),E=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 A=(null==S?void 0:S.isFolder)||m.startsWith("folder_");if(A){if(!(!1!==(null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder)))return void d.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:l("Folder rename is disabled by config"),placement:"bottomRight",data:k(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:k(S,m)})}const E=await f({itemId:m,newName:p.newFileName,isFolder:A});if(!E.success){const e=No(null===(n=E.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=E.error)||void 0===i?void 0:i.message)&&void 0!==o?o:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},k(S,m)),{error:E.error}),innerException:E.error})}const F=E.renamedItem;A?(d.success({id:"FOLDER_RENAME_SUCCESS",message:l(`${l("Folder renamed to")} ${null!==(s=null==F?void 0:F.name)&&void 0!==s?s:p.newFileName}`),placement:"bottomRight",data:{itemId:null!==(c=null==F?void 0:F.id)&&void 0!==c?c:m,itemName:null!==(u=null==F?void 0:F.name)&&void 0!==u?u:p.newFileName,folderId:null!==(w=null!==(y=null==F?void 0:F.parentId)&&void 0!==y?y:null==F?void 0:F.folderId)&&void 0!==w?w:null}}),await h(),(null==F?void 0:F.id)&&F.id!==m&&a.setSelectedFolder&&a.setSelectedFolder(F.id)):d.success({id:"FILE_RENAME_SUCCESS",message:`${l("File renamed to")} ${null!==(x=null==F?void 0:F.name)&&void 0!==x?x:p.newFileName}`,placement:"bottomRight",data:Object.assign(Object.assign({},k(S,m)),{itemName:null!==(C=null==F?void 0:F.name)&&void 0!==C?C:p.newFileName})}),I(),await e({folderId:g||"",page:b.current,limit:b.pageSize})}catch(e){console.error("Error when renaming:",e);const t=Do(e),r=No(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({},k(S,m)),{error:t}),innerException:e})}},[m,v,p,a,I,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:A,handleRenameCancel:I,handleRenameOk:E}}},as=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}),ls=(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}),cs=()=>{const e=Mo(),{t:t}=Kn(),{state:r,options:n}=mo(),{folders:i,pathHistory:o}=r,{dataProviders:a}=n,{actions:{fetchFolders:s,fetchChildFolders:l}}=qo();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 Va({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])}},us=e=>{var t;const{state:r,actions:n,options:i}=mo(),{t:o}=Kn(),a=Mo(),s=ns(e=>e.selectedFiles),l=ns(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}=mo(),{dataProviders:t}=e,{t:r}=Kn(),n=Mo(),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=Do(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=Do(t);c.push({error:r})}else l+=e.length}}catch(t){l+=e.length;const r=Do(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}=cs(),{getItemNameById:x,getItemNamesByIds:C,getNamesPreview:_}=as(u),S=c(()=>{null==g||g(!0)},[g]),k=c(()=>{null==g||g(!1),null==h||h.resetFields()},[g,h]),A=c(async t=>{var r,n,c,g,S,A,I,E;if(!((null==p?void 0:p.length)||s&&0!==s.size))return;const F=u.length,T=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=fi(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===(A=L[0].error)||void 0===A?void 0:A.code)){const e=No(null===(I=L[0].error)||void 0===I?void 0:I.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:ls(O,R,P,u,L.length?L:void 0,e)})}k(),l();let z=T.current;if(M>0&&F>0&&M>=F&&T.current>1&&(z=T.current-1),M>0&&T.total>=M){const e=Math.max(0,(null!==(E=T.total)&&void 0!==E?E:0)-M);null==m||m({current:z,pageSize:T.pageSize,total:e})}j&&await b({parentIds:void 0,selectedFolder:f}),await w({fetchFiles:e,selectedFolder:d,page:z,limit:T.pageSize})}catch(e){console.error("Error when moving:",e);const t=No(Do(e).code,o);a.error({id:"FILES_MOVE_ERROR",innerException:e,message:null!=t?t:o("Error moving"),placement:"bottomRight",data:ls(O,P,P,d||null,[{error:Do(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:k,handleMoveOk:A}}},ds=e=>{var t;const{state:r,actions:n,options:i}=mo(),{t:o}=Kn(),a=Mo(),s=ns(e=>e.selectedFiles),l=ns(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}=mo(),{dataProviders:t}=e,{t:r}=Kn(),n=Mo(),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=Do(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=Do(t);c.push({error:r})}else l+=e.length}}catch(t){l+=e.length;const r=Do(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=Do(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}=cs(),{getItemNameById:w,getItemNamesByIds:x,getNamesPreview:C}=as(u),_=c(()=>{null==g||g(!0)},[g]),S=c(()=>{null==g||g(!1),null==h||h.resetFields()},[g,h]),k=c(async t=>{var r,n,c,g,_;if(!((null==p?void 0:p.length)||s&&0!==s.size))return;const k=Array.from((null==p?void 0:p.length)?[p]:s),A=k.length;let I=0,E=0;const F=[],T=k.map(e=>u.find(t=>t.id===e)).filter(e=>Boolean(e)),O=T.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=T.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 T){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=T.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=T.find(t=>t.id===e.id),o=(null==i?void 0:i.name)||w(e.id)||"",a=fi(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=T.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(I=R.successCount,E=R.failCount,F.push(...R.errorDetails),I>0){const e=x(k),t=C(e),r=t?o("Copied",{names:t}):o("copy_success_summary",{successCount:I,totalCount:A});a.success({id:"FILES_COPY_SUCCESS",message:r,placement:"bottomRight",data:ss(k,I,A,u,e)})}if(E>0){const e=x(k),t=C(e);let r;if(1===A&&F.length>0&&(null===(g=F[0].error)||void 0===g?void 0:g.code)){const e=No(null===(_=F[0].error)||void 0===_?void 0:_.code,o);r=null!=e?e:t?o("Failed",{names:t}):o("copy_fail_summary",{failCount:E,totalCount:A})}else r=t?o("Failed",{names:t}):o("copy_fail_summary",{failCount:E,totalCount:A});a.error({id:"FILES_COPY_ERROR",message:r,placement:"bottomRight",innerException:F.length?F:void 0,data:ls(k,E,A,u,F.length?F: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=No(Do(e).code,o);a.error({id:"FILES_COPY_ERROR",message:null!=t?t:o("Error copying"),innerException:e,placement:"bottomRight",data:ls(k,A,A,d||null,[{error:Do(e)}],x(k))})}},[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:k}}},hs=e=>{const t=os(e),r=us(e),n=ds(e),i=(e=>{const{state:t,actions:r,options:n}=mo(),{t:i}=Kn(),o=Mo(),a=ns(e=>e.selectedFiles),s=ns(e=>e.clearSelection),{files:l,selectedFolder:u,pagination:d,currentMenuFile:h}=t,{setIsDeleteConfirmVisible:f,setUndoDeletion:p,setPagination:g}=r,{config:m}=n,{deleteItems:v}=Yo(),{refreshFolders:y,refreshFiles:b}=cs(),{getItemNameById:w,getItemNamesByIds:x,getNamesPreview:C}=as(l),_=c(()=>{null==f||f(!0)},[f]),S=c(()=>{null==f||f(!1)},[f]),k=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),k=S.map(e=>l.find(t=>t.id===e)).filter(e=>Boolean(e)),A=new Set;k.forEach(e=>{(null==e?void 0:e.isFolder)&&A.add((e=>{var t,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 I=0,E=0;const F=[];try{const a=await v({items:k,selectedFolder:u,getItemNameById:w,showNotifications:!1});I=a.successCount,E=a.failCount,F.push(...a.errorDetails);const l=(null==m?void 0:m.enableTrashFolder)&&"Trash"===u;if(I>0&&(null==m?void 0:m.enableTrashFolder)&&!l&&(null==p||p({itemIds:S,sourceFolderId:u||"folders"})),I>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:I}),placement:"bottomRight",data:{successCount:I,totalCount:e,itemIds:S,folderId:u||null}}):await o.success({id:"FILES_DELETE_SUCCESS",message:i("Files deleted"),placement:"bottomRight",data:{successCount:I,totalCount:e,itemIds:S,folderId:u||null}})}if(E>0){const e=x(S),n=C(e),a=S.length,s=1===a&&F.length>0&&(null===(t=F[0].error)||void 0===t?void 0:t.code),c=(null==m?void 0:m.enableTrashFolder)&&!l,u=i(c?"При перемещении в корзину произошли ошибки":"При удалении произошли ошибки"),d=s?No(null===(r=F[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:F.length?F:void 0,data:{failCount:E,isTrashMove:c,totalCount:a,itemNames:e,errors:F.length?F:void 0}})}s(),null==f||f(!1),await y({parentIds:Array.from(A),selectedFolder:u});let d=_.current;if(I>0&&c>0&&I>=c&&_.current>1&&(d=_.current-1),I>0&&_.total>=I){const e=Math.max(0,(null!==(n=_.total)&&void 0!==n?n:0)-I);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:E,totalCount:k.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:k}}})(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}=mo(),{files:t,loading:r,isUrlModalVisible:n}=e,i=Ja(),o=(()=>{const{state:e}=mo(),t=e.multiSelect,r=ns(e=>e.selectedFiles),n=ns(e=>e.toggleFileSelection),i=ns(e=>e.setMultiSelect);return a(()=>{i(!1!==t)},[t,i]),{state:{selectedFiles:r},actions:{toggleFileSelection:n}}})(),s=hs(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 ps({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}const gs=/(auto|scroll|overlay)/;function ms(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 vs(e){if("undefined"==typeof window)return!1;const t=window.getComputedStyle(e);return gs.test(t.overflowY)||gs.test(t.overflow)||gs.test(t.overflowX)}function ys(e){if("undefined"==typeof window)return e;let t=e;for(;t;){if(vs(t))return t;t=t.parentElement}return null}function bs(e){if("undefined"==typeof window)return[e];const t=ys(e);return t?t===e?[window,e]:[window,t]:[window]}function ws(e,t,r){Math.max(0,e.clientHeight),Math.max(0,Math.round(e.getBoundingClientRect().height));return Math.max(1,t)}function xs(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:ws(e,Math.min(t.clientHeight,r||t.clientHeight)),viewportWidth:ms(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:ws(e,l),viewportWidth:ms(e,c||t.clientWidth||e.clientWidth),scrollHeight:e.scrollHeight}}function Cs(e){if("undefined"==typeof window)return{scrollTop:e.scrollTop,viewportHeight:Math.max(1,e.clientHeight),viewportWidth:ms(e),scrollHeight:e.scrollHeight};const t=ys(e);return t&&function(e){return e.scrollHeight-e.clientHeight>1}(t)?xs(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:ws(e,l),viewportWidth:ms(e,Math.min(Math.round(n.width),o)),scrollHeight:e.scrollHeight}}(e)}function _s(e,t){const r=u(null),n=c(t=>{e(Cs(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=bs(e);return i.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{i.forEach(e=>{e.removeEventListener("scroll",t)})}},[n,...t]),r}const Ss=({onSearch:t,placeholder:r,className:n})=>{const{t:i}=Kn(),[s,l]=o(""),c=u(null),{options:d}=mo(),{config:h}=d,f=r||i("Search files...");a(()=>(c.current=Io.debounce(e=>{t(e)},500),()=>{var e;null===(e=c.current)||void 0===e||e.cancel()}),[t]);return e(F,{value:s,onChange:e=>{var t;const r=e.target.value;l(r),null===(t=c.current)||void 0===t||t.call(c,r)},placeholder:f,prefix:e(Pi,{size:16,strokeWidth:null==h?void 0:h.iconStrokeWidth}),className:n,allowClear:!0,onClear:()=>{l(""),t("")}})},ks=[{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 As={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:Is}=T,{Option:Es}=O;const Fs=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)?ks.filter(e=>p.includes(e.value)):ks,[p]),_=d(()=>C.map(e=>e.value).join("|")||"all",[C]),S=ns(e=>e.selectedFiles),k=ns(e=>e.selectedFiles.size),A=ns(e=>e.selectAllVisible),I=r.length>0&&k===r.length,E=d(()=>Array.from(S)[0],[S]),F=d(()=>E?n.get(E):void 0,[n,E]),T=(null==F?void 0:F.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===k&&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&&gr.includes(i.toLowerCase()))}(F),[k,F]);return t("div",k>0?{className:`header-container ${As.headerContainer}`,children:[t(Is,{type:"secondary",className:"selected-text",children:[t("div",{children:[k," ",x("selected")]}),s&&e(P,{title:o?x("Select all"):null,children:e(M,{className:As.buttonSelectAll,onClick:A,disabled:I||0===r.length,children:x("Select all")})}),e(P,{title:o?x("Deselected"):null,children:e(M,{className:As.buttonDeselected,icon:e(Oi,{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(yi,{size:16,strokeWidth:a}),onClick:()=>w(F),disabled:!D,children:x("Edit")})}),N&&e(P,{title:o?x("Move to"):null,children:e(M,{icon:e(wi,{size:16,strokeWidth:a}),onClick:b,children:x("Move to")})}),j&&e(P,{title:o?x("Copy"):null,children:e(M,{icon:e(vi,{size:16,strokeWidth:a}),onClick:y,children:x("Copy")})}),1===k&&T&&e(P,{title:o?x("Rename"):null,children:e(M,{icon:e(Ri,{size:16,strokeWidth:a}),onClick:()=>m(),disabled:1!==k||!T,children:x("Rename")})}),!1!==(null==l?void 0:l.enableDelete)&&e(P,{title:o?x("Delete"):null,children:e(M,{danger:!0,icon:e(Ni,{size:16,strokeWidth:a}),onClick:e=>{e.stopPropagation(),e.preventDefault(),v()},children:x("Delete")})})]})]}:{className:As.headerContainer,children:[e("div",{className:"search-container",children:e(Ss,{placeholder:x("Search file or folder"),onSearch:h,className:As.searchInput})}),t("div",{className:As.actionsBox,children:[e("div",{className:"sort-container",children:e(O,{value:i,onChange:f,className:As.sortSelect,popupMatchSelectWidth:!1,suffixIcon:e(gi,{size:16,strokeWidth:a}),children:C.map(({value:t,labelKey:r})=>e(Es,{value:t,children:x(r)},t))},_)}),e("div",{className:As.actionsContainer,children:e(L,{options:[{value:"grid",icon:e(Si,{size:16,strokeWidth:a})},{value:"table",icon:e(Ii,{size:20,strokeWidth:a})}],value:c,onChange:e=>u(e)})})]})]})});Fs.displayName="FileContentHeader";const Ts=i.memo(({fileId:t,style:r})=>{const n=ns(e=>e.selectedFiles.has(t)),i=ns(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 Os(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}Ts.displayName="FileSelectionCheckbox","function"==typeof SuppressedError&&SuppressedError;const Ps=i.memo(t=>{var{className:r}=t,n=Os(t,["className"]);const i=n["data-row-key"],o=null==i?"":String(i),a=[r,ns(e=>!!o&&e.selectedFiles.has(o))?As.selectedRow:""].filter(Boolean).join(" ");return e("tr",Object.assign({},n,{className:a}))});Ps.displayName="SelectableTableRow";const Ms=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(yi,{size:16,strokeWidth:i})}),t.canMove&&r.push({key:"move",label:n("Move to"),icon:e(wi,{size:16,strokeWidth:i})}),t.canCopy&&r.push({key:"copy",label:n("Copy"),icon:e(vi,{size:16,strokeWidth:i})}),t.canRename&&r.push({key:"rename",label:n("Rename"),icon:e(Ri,{size:16,strokeWidth:i})}),t.canDelete&&r.push({key:"delete",label:n("Delete"),icon:e(Ni,{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:`${As.gridFileMenuButton} gridFileMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(bi,{size:16,strokeWidth:i})}):e("span",{className:`${As.tableMenu} tableMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(bi,{size:16,strokeWidth:i})})})});Ms.displayName="FileItemActionsDropdown";const Rs=({thumbnailSrc:t,previewSrc:r,lightboxSrc:n,alt:i,className:s,width:l,height:u,preview:h=!1})=>{const f=i,[p,g]=o(0),m=c(e=>{const t=e.split(",")[1];return!!(t&&t.length>20)},[]),v=c(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)return e.startsWith("data:image/")?m(e)?e:void 0: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},[m]),y=d(()=>v(t),[t,v]),b=d(()=>v(r),[r,v]),w=d(()=>v(n),[n,v]),x=d(()=>[y,b].filter((e,t,r)=>Boolean(e)&&r.indexOf(e)===t),[y,b]);a(()=>{g(0)},[x]);const C=c((e,t)=>e&&e.toLowerCase().endsWith(".svg")||t&&(t.includes(".svg")||t.includes("image/svg+xml")),[]),_=x[p],S=null!=w?w:_,k=c(()=>{if(!_)return;const e=p+1;C(f,_),g(e)},[_,p,f,C]),A=null!=_?_:pr,I=!(!h||!S)&&{src:S,toolbarRender:()=>null,destroyOnHidden:!0,mask:e(ye,{style:{fontSize:"20px"}})};return e(D,{className:s,src:A,alt:i,width:l,height:u,preview:I,onError:k,fallback:pr})},Ls=i.memo(({item:t,variant:r="table",FolderIcon:n,getFileData:i,className:o,width:a,height:s})=>t.isFolder?e("div","grid"===r?{className:As.gridFolderIcon,children:e(n,{className:As.gridFolderIconImage})}:{className:As.fileManagerTableFolder,children:e("div",{className:As.fileManagerTableFolderInner,children:e(n,{className:As.tableFolderIcon,style:{width:null!=a?a:40,height:null!=s?s:40}})})}):t.thumbnailSrc||t.previewSrc?e(Rs,{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);function Ns(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&&mr.includes(a)}Ls.displayName="FileItemPreview";const js=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=ns(e=>e.selectedFiles.has(r.id)),y=c(e=>{const t=e.target;if(t.closest(".gridFileMenuButton")||t.closest(".ant-dropdown-menu"))return;Boolean(t.closest(".ant-image"))||Boolean(t.closest(".ant-image-preview-wrap"))||1===e.detail&&(r.isFolder?a(r.file):p&&Ns(r.file)&&p(r.file))},[a,r.file,r.isFolder,p]);return e(z,{className:As.gridCard_col,style:{padding:0},children:t(B,{hoverable:!0,cover:e("div",{className:r.isFolder?As.gridPreviewContainerFolder:As.gridPreviewContainer,onClick:e=>{e.stopPropagation(),y(e)},children:e(Ls,{item:r,variant:"grid",FolderIcon:o,getFileData:g,className:As.gridImagePreview})}),className:`${As.gridCard} ${v?As.gridCardSelected:""}`,onClick:e=>{e.stopPropagation(),e.preventDefault(),y(e)},children:[t("div",{className:As.gridCardContent,onClick:e=>{e.stopPropagation(),e.preventDefault(),y(e)},children:[e("div",{className:As.gridFileName,children:r.nameText||n("Untitled")}),e("div",{className:As.gridFileInfo,children:r.gridInfoText})]}),e("div",{className:As.gridFileMenu,onClick:e=>{e.stopPropagation()},children:e(Ms,{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:As.gridCheckbox,children:e(Ts,{fileId:r.id,style:{height:20}})}):null]})})});js.displayName="FileGridItem";const Ds=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:As.gridRow,style:{gap:20,padding:"0 24px 24px",margin:0},children:t.map(t=>e(js,{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))})})}));Ds.displayName="FileGridView";const zs=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(A,{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:As.tableLoadingWrapper,children:l})});zs.displayName="FileTableView";const Bs=i.memo(({item:t})=>t.dateText?e(P,{title:t.dateText,placement:"bottom",className:As.fileDate,children:t.dateText}):null);Bs.displayName="FileItemDate";const Us=i.memo(({item:r})=>t("div",{className:As.fileName,children:[r.nameText,r.isFolder&&e("div",{className:As.fileItemCount,children:r.folderItemsText})]}));Us.displayName="FileItemName";const Vs="filemanager_view_mode";class Hs{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 $s{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,k,A;const I=null!==(r=null==t?void 0:t.renderStrategy)&&void 0!==r?r:"full";if("windowed"!==I){if("positioned"===I){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 E=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),F=null!==(w=null===(b=null==t?void 0:t.windowed)||void 0===b?void 0:b.endIndex)&&void 0!==w?w:e.length-1,T=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!==(A=null===(k=null==t?void 0:t.windowed)||void 0===k?void 0:k.itemsPerLane)&&void 0!==A?A:1),M=Math.ceil(e.length/P),R=Math.min(e.length-1,F),L=Math.floor(E/P),N=Math.floor(Math.max(E,R)/P),j=Math.max(0,L-T),D=Math.min(M-1,N+T),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 Ws({items:e,context:t,adapter:r,options:n}){const i=u(null),o=u(null);i.current||(i.current=new Hs),o.current||(o.current=new $s);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 Gs({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 qs(e,t){if("number"==typeof e.childCount)return e.childCount;const r=t[e.id];return null===r?null:null!=r?r:0}function Ys(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&&gr.includes(i.toLowerCase()))}function Xs(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 Ks={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?qs(e,t.folderFileCounts):null,h=u?null===d?"u":String(d):"0",f=Xs(e.date,t.t),p=!u&&e.size?String(e.size):"",g=e.thumbnailUrl||e.thumbnail,m=e.url&&Ys(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?qs(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?hi(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=Xs(e.date,t.t),y=d?f:[p,g,m].filter(Boolean).join(" • "),b=e.thumbnailUrl||e.thumbnail,w=e.url&&Ys(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)&&Ys(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 Zs=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:k,showMoveModal:A,onEdit:I,getFileData:E,handleAddFile:F})=>{var T;const{t:O}=Kn(),P=Mo(),{DropZoneFileIcon:M,BigStockIcon:R,BigAIIcon:L,FolderIcon:N}=yo(),{options:j,actions:D,state:z}=mo(),{dataProviders:B,config:U}=j,V=null==U?void 0:U.disablePagination,{setCurrentMenuFile:H,setActiveLibraryItem:W}=D,G="Trash"===(null==z?void 0:z.selectedFolder),q=!1!==(null==z?void 0:z.multiSelect),{viewMode:Y,setViewMode:X}=(()=>{const[e,t]=o(()=>{try{return localStorage.getItem(Vs)||"table"}catch(e){return"table"}}),r=c(e=>{t(e);try{localStorage.setItem(Vs,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({}),[J,Q]=o(!1),ee=u(0),te=u(null);a(()=>{const e=window.matchMedia("(max-width: 1199px)"),t=e=>{Q(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=ks.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}=Gs({totalCount:e.length,plan:h}),{rowModels:g,renderWindow:m}=Ws({items:e,context:s,adapter:Ks,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 Va({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(Cs(te.current))},[r.length,de,Y]),a(()=>{if(!te.current||"undefined"==typeof ResizeObserver)return;const e=te.current,t=new ResizeObserver(()=>{de(Cs(e))});return t.observe(e),()=>{t.disconnect()}},[de]);const pe=c(e=>{const t=Cs(e);de(t)},[de]);a(()=>{const e=te.current;if(!e)return;const t=()=>{pe(e)},r=bs(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(()=>[...q?[{key:"selection",width:46,shouldCellUpdate:ge,render:(t,r)=>e(Ts,{fileId:r.id})}]:[],{key:"preview",width:60,shouldCellUpdate:ge,render:(t,r)=>e(Ls,{item:r,variant:"table",FolderIcon:N,getFileData:E,className:`${As.imagePreview} ${As.tableImagePreview}`,width:40,height:40})},{title:O("Name"),width:"calc(100% - 430px)",dataIndex:"nameText",key:"name",className:As.fileNameCol,shouldCellUpdate:ge,render:(t,r)=>e(Us,{item:r})},{title:O("Dimensions"),key:"dimensions",width:100,shouldCellUpdate:ge,render:(t,r)=>r.dimensionsText&&e("div",{className:As.fileSize,children:r.dimensionsText})},{title:O("Size"),key:"size",width:90,shouldCellUpdate:ge,render:(t,r)=>r.sizeText?e("div",{className:As.fileSize,children:r.sizeText}):null},{title:O("Type"),key:"type",width:90,shouldCellUpdate:ge,render:(t,r)=>e("div",{className:As.fileSize,children:r.typeText})},...ue?[{title:O("Date"),dataIndex:"dateText",key:"date",width:200,shouldCellUpdate:ge,render:(t,r)=>e(Bs,{item:r})}]:[],{width:40,title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),shouldCellUpdate:ge,render:(t,r)=>e(Ms,{item:r,variant:"table",t:O,iconStrokeWidth:ne,setCurrentMenuFile:H,showMoveModal:A,showCopyModal:k,showRenameModal:C,showDeleteConfirm:_,onEdit:I})}],[N,E,ue,ne,q,I,H,ge,k,_,A,C,O]),ve=d(()=>({body:{row:Ps}}),[]),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(".ant-image"))||Boolean(r.closest(".ant-image-preview-wrap")),o=Boolean(r.closest(".tableMenuButton")),a=Boolean(r.closest(".ant-dropdown-menu"));n||i||o||a||(e.isFolder?m(e.file):j.onEditorOk&&Ns(e.file)&&j.onEditorOk(e.file))}}),[m,j]);let be="table"===Y?e(zs,{rows:le,columns:me,topOffset:ce.topOffset,bottomOffset:ce.bottomOffset,onRow:ye,components:ve}):e(Ds,{rows:le,topOffset:ce.topOffset,bottomOffset:ce.bottomOffset,t:O,iconStrokeWidth:ne,FolderIcon:N,handleItemClick:m,setCurrentMenuFile:H,showMoveModal:A,showCopyModal:k,showRenameModal:C,showDeleteConfirm:_,onEdit:I,onEditorOk:j.onEditorOk,getFileData:E,showSelectionCheckbox:q});n&&!r.length&&(be=e(_o,{}));const we=null===(T=null==U?void 0:U.availableImageExtensions)||void 0===T?void 0:T.map(e=>"."+e).join(", "),xe=t("div",G?{className:`${As.noFiles} ant-layout-sider-light`,children:[e(ji,{size:48,className:As.noFilesIcon}),e("div",{className:`${As.textTitle_trash} ant-menu-submenu-title`,children:O("Trash is empty")}),e("div",{className:`${As.textDescription_trash} ant-menu-submenu-title`,children:O("Deleted files will be displayed here")})]}:{className:As.uploadContainer,children:[t("div",{className:`${As.uploadArea} `,onClick:F,children:[e("div",{className:As.uploadIcon,children:e(M,{})}),e("div",{className:As.textTitle,children:O("Click here to select a file")}),e("div",{className:As.textDescription,children:O("Supported files:")+" "+(we||"jpeg, .svg, .png")})]}),t("div",{className:As.buttons,children:[t("button",{className:As.btnPhoto,onClick:()=>{W&&W(ir)},children:[e("div",{className:As.icon,children:e(R,{})}),t("div",{className:As.blockText,children:[e("div",{className:As.textTitle,children:O("Stock")}),e("div",{className:As.textDescription,children:O("Select an image from our library")})]})]}),t("button",{className:As.btnAi,onClick:()=>{W&&W(ar)},children:[e("div",{className:As.icon,children:e(L,{})}),t("div",{className:As.blockText,children:[e("div",{className:As.textTitle,children:O("AI generation")}),e("div",{className:As.textDescription,children:O("Creating an image on demand")})]})]})]})]});return e("div",{className:`content-layout ${As.contentLayout}`,children:g||0!==(null==r?void 0:r.length)||n?t("div",{className:As.tableContainer,children:[e(Fs,{files:r,filesById:se,currentSortOption:ae,isSmallScreen:J,iconStrokeWidth:ne,multiSelectEnabled:q,features:re,viewMode:Y,setViewMode:X,handleSearch:i,handleSortOptionChange:h,sortOptions:ie,onClearSelection:v,onRename:y,onDelete:b,onCopy:w,onMove:x,onEdit:I,t:O}),t("div",{ref:te,className:As.filesContainer,children:[be,g?e("div",{className:As.filesLoadingOverlay,"aria-busy":"true","aria-live":"polite",children:e(S,{size:"large"})}):null]}),!V&&f.total>f.pageSize&&e("div",{className:As.paginationContainer,children:e($,{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:As.emptyStateWrapper,children:xe})})});Zs.displayName="FileContent";var Js="folderTree",Qs="emptyFolderContainer",el="folderItemContainer",tl="folderLabel",rl="folderLabelItem",nl="fileCount",il="foldersTitle",ol="foldersTitleItem",al="folderMenu";const sl=({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}=Kn(),{options:x}=mo(),{config:C}=x,{ExpandArrowIcon:_,CollapseArrowIcon:S,CollapseFolderIcon:k,ExpandFolderIcon:A,EmptyFolderIcon:I}=yo(),E=c(e=>{const t=[],r=e=>{e.forEach(e=>{t.push(e.key),e.children&&r(e.children)})};return r(e),t},[]),[F,T]=o(()=>{if(b||"selection"===y&&b){const e=s();return E(e)}return[]}),O=void 0!==g?g:F,P=void 0!==m?m:T;a(()=>{if(b||"selection"===y&&b){const e=s(),t=E(e);void 0===g&&T(t)}},[b,y,s,E,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?k:A,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}):e(I,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth})})(),d=t("div",{className:`${el} folder-item-container`,onClick:()=>!s&&c(r.key),style:{opacity:s?.5:1,cursor:s?"not-allowed":"pointer"},children:[t("div",{className:tl,children:[void 0!==r.icon?r.icon:l,e("span",{className:rl,children:r.label})]}),h&&e("div",{className:nl,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:il,onClick:()=>c("folders"),children:t("div",{className:ol,children:[e(g?k:A,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:`${rl} 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:il,onClick:()=>c("Trash"),children:t("div",{className:ol,children:[e(Ni,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:rl,children:w("Trash")})]})}),children:void 0});if(d){if(!v)return[{key:"empty",title:e("div",{className:Qs,children:w("No folders yet")}),disabled:!0}];const t=[];return l.length>0&&"folders"===l[0].key&&t.push({key:"folders",title:m,children:[]}),t.push(b()),t}if(l.length>0&&"folders"===l[0].key){const e=[{key:"folders",title:m,children:null===(i=l[0].children)||void 0===i?void 0:i.map(p)}];return v&&e.push(b()),e}return l.map(p)},[s,O,k,null==C?void 0:C.iconStrokeWidth,A,w,r,M,h,f,I,u,v,y,P]),N=d(()=>L(),[L]);return e(W,{className:`${Js} ${al} ${p}`,selectedKeys:r?[r]:[],expandedKeys:O,onSelect:M,onExpand:R,treeData:N,switcherIcon:({expanded:t})=>e(t?S:_,{}),showLine:!1})},ll=({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 cl={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 ul=({folderId:n,activeFormField:i,EmptyFolderIcon:o,targetForm:a,handleModalOk:s,onComplete:l,setIsLoading:c,t:u})=>e(E.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(F,{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(be,{style:{fontSize:10}}),className:cl.inputButtonClose,type:"text",onClick:()=>{a.setFieldsValue({folderName:""})}})}),e(M,{className:cl.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 dl({folders:n,selectedFolder:o,EmptyFolderIcon:a,handleCreateFolderModalOk:s,setIsLoading:l,t:c}){const[u,d]=i.useState(""),h=i.useCallback((t,r)=>n=>e(ul,{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:`${cl.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:`${cl.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 hl=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(E.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(F,{className:"form-input",autoFocus:!0,prefix:e(n,{style:{marginRight:6}}),suffix:e(M,{className:cl.inputButtonOk,type:"text",onClick:()=>{l(!0),d()},children:s("Create")})})})});hl.displayName="CustomFolderInput";const fl=({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:k,moveForm:A,selectedFiles:I,isRenameFolderModalVisible:T,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:$,handleClearTrashCancel:W,fetchChildFolders:Y})=>{var X,K,Z;const{t:J}=Kn(),{state:Q,actions:ee,options:te}=mo(),{setCurrentMenuFile:re}=ee,{config:ne}=te,{currentMenuFile:ie}=Q,oe=E.useWatch("folderName",l),{EmptyFolderIcon:ae}=yo(),[se,le]=o(!1),ce=d(()=>{var e;return(null===(e=null==ne?void 0:ne.defaultFolderName)||void 0===e?void 0:e.trim())||J("New folder")},[null==ne?void 0:ne.defaultFolderName,J]),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:me,generateMenuItemsFromFolders:ve}=dl({folders:fe,selectedFolder:u,EmptyFolderIcon:ae,handleCreateFolderModalOk:i,setIsLoading:e=>le(Boolean(e)),t:J});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 ye=x?de.find(e=>e.id===x):null,we=(null==ye?void 0:ye.isFolder)||(null==x?void 0:x.startsWith("folder_")),xe=c(async e=>{e.length>0&&(A.setFieldsValue({targetFolder:e[0]}),ge!==e[0].toString()&&me(""))},[A,ge,me]),Ce=c(async e=>{e.length>0&&(z.setFieldsValue({targetFolder:e[0]}),ge!==e[0].toString()&&me(""))},[ge,z,me]),_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]),ke=d(()=>{const e=Array.from(I).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},[I,de,h,u]);return t(r,{children:[e(G,{title:e("div",{className:"modal-title",children:J("Creating a new folder")}),open:n,onOk:()=>i(),onCancel:s,okText:J("Create"),cancelText:J("Cancel"),okButtonProps:{disabled:ue,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>le(!1),children:t(E,{form:l,layout:"vertical",children:[e(E.Item,{name:"folderName",label:e("div",{className:"form-label",children:J("Folder name")}),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(J("Enter the name of the folder"))):Promise.resolve()}],initialValue:ce,className:"form-item",style:{marginBottom:5},children:e(F,{autoFocus:!0,className:"form-input",disabled:se,placeholder:J("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:[J("A folder will be created inside:")," ",(null===(Z=fe.find(e=>e.id===u))||void 0===Z?void 0:Z.name)||J("selected folder"),"."]}):e("p",{className:"fm-note",children:J("The folder will be created in the root directory.")})})]})}),e(G,{title:e("div",{className:"modal-title",children:J("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:J("Download"),okButtonProps:{loading:se},cancelText:J("Cancel"),cancelButtonProps:{disabled:se},afterClose:()=>le(!1),children:e(E,{form:m,layout:"vertical",children:e(E.Item,{name:"fileUrl",label:e("div",{className:"form-label",children:J("File URL")}),rules:[{required:!0,message:J("Enter the URL of the image")},{validator:(e,t)=>{if(!t||!String(t).trim())return Promise.resolve();try{return Jo(String(t),J),Promise.resolve()}catch(e){return Promise.reject(new Error(e instanceof Error?e.message:J("The specified URL is not valid.")))}}}],validateTrigger:"onBlur",className:"form-item",children:e(F,{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(G,{title:e("div",{className:"modal-title",children:we?`${J("Rename folder")} ${he}`:J("Rename file",{currentFileName:he})}),open:v,onOk:y,okText:J("Rename"),okButtonProps:{loading:se},onCancel:b,cancelText:J("Cancel"),cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},children:e(E,{form:w,layout:"vertical",children:e(E.Item,{name:"newFileName",label:e("div",{className:"form-label",children:J(we?"New folder name":"New file name")}),rules:[{required:!0,message:J(we?"Enter a new folder name":"Enter a new file name")}],className:"form-item",children:e(F,{autoFocus:!0,className:"form-input",disabled:se,onPressEnter:async()=>{le(!0);try{await w.validateFields(),y()}catch(e){le(!1)}}})})})}),e(G,{title:e("div",{className:"modal-title",children:J("Move to")}),open:_,onCancel:k,footer:t("div",{className:cl.formFooter,children:[t(M,{className:cl.folderButton,onClick:()=>{const e=null!=u?u:"folders";me(e),A.setFieldsValue({folderName:ce,targetFolder:e})},loading:se,children:[e(Ci,{size:18,strokeWidth:null==ne?void 0:ne.iconStrokeWidth}),J("Create folder")]}),e(M,{type:"primary",className:cl.folderButton,onClick:k,loading:se,children:J("Done")})]}),afterClose:()=>{re&&re(""),me(""),le(!1)},loading:se,children:t("div",{className:cl.modalContentWithLoader,children:[se&&e("div",{className:cl.modalLoaderOverlay,children:e(ll,{})}),e(E,{form:A,layout:"vertical",initialValues:{targetFolder:"folders",folderName:ce,is_force_create:!1},children:t("div",{className:cl.foldersWrapper,children:[e(E.Item,{name:"targetFolder",rules:[{required:!0,message:J("Select the destination folder")}],className:cl.formItem,children:e(sl,{onSelect:xe,generateMenuItems:()=>ve({targetForm:A,onTreeSelect:xe,onComplete:_e,actionButtonText:J("Move here")}),fetchChildFolders:Y,disabledFolders:ke,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(E.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(J("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{})}),e(E.Item,{name:"is_force_create",style:{display:"none"},children:e(F,{})})]})})]})}),e(G,{title:e("div",{className:"modal-title",children:J("Copy to folder")}),open:N,onCancel:D,footer:t("div",{className:cl.formFooter,children:[t(M,{className:cl.folderButton,onClick:()=>{const e=null!=u?u:"folders";me(e),z.setFieldsValue({folderName:ce,targetFolder:e})},loading:se,children:[e(Ci,{size:18,strokeWidth:null==ne?void 0:ne.iconStrokeWidth}),J("Create folder")]}),e(M,{type:"primary",className:cl.folderButton,onClick:D,loading:se,children:J("Done")})]}),afterClose:()=>{re&&re(""),me(""),le(!1)},loading:se,children:t("div",{className:cl.modalContentWithLoader,children:[se&&e("div",{className:cl.modalLoaderOverlay,children:e(ll,{})}),e(E,{form:z,layout:"vertical",initialValues:{targetFolder:"folders",folderName:ce,is_force_create:!1},children:t("div",{className:cl.foldersWrapper,children:[e(E.Item,{name:"targetFolder",rules:[{required:!0,message:J("Select the destination folder")}],className:cl.formItem,children:e(sl,{onSelect:Ce,generateMenuItems:()=>ve({targetForm:z,onTreeSelect:Ce,onComplete:Se,actionButtonText:J("Copy here")}),fetchChildFolders:Y,disabledFolders:ke,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(E.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(J("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{})}),e(E.Item,{name:"is_force_create",style:{display:"none"},children:e(F,{})})]})})]})}),e(G,{title:t("div",{className:"modal-title",children:[J("Rename folder")," ",pe]}),open:T,onOk:O,onCancel:P,okText:J("Rename"),cancelText:J("Cancel"),okButtonProps:{loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},children:e(E,{form:R,layout:"vertical",children:e(E.Item,{name:"newFolderName",label:e("div",{className:"form-label",children:J("New folder name")}),rules:[{required:!0,message:J("Enter a new folder name")}],className:"form-item",children:e(F,{autoFocus:!0,className:"form-input",disabled:se,onPressEnter:async()=>{le(!0);try{await R.validateFields(),O()}catch(e){le(!1)}}})})})}),e(G,{className:`${cl.deleteModal} deleteModal`,title:(()=>{const t=!!(null==ne?void 0:ne.enableTrashFolder)&&"Trash"===u||!(null==ne?void 0:ne.enableTrashFolder),r=J(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?J("Delete permanently"):(null==ne?void 0:ne.enableTrashFolder)?J("Move to Trash"):J("Delete"),cancelText:J("Cancel"),okButtonProps:{danger:!(null==ne?void 0:ne.enableTrashFolder)||"Trash"===u,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},closeIcon:e(be,{className:cl.closeIcon}),children:(()=>{var r,n;const i=(ie?[ie]:Array.from(I||[])).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=J("delete_folder_permanent",{name:t,count:i})}else n=0===l&&c>0?J("delete_files_permanent",{count:c}):J("delete_mixed_permanent",{total:s,folders:l,images:c});return t("div",{children:[e("div",{children:n}),e("p",{className:cl.permanentDeleteWarning,children:J("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:J("move_folder_to_trash",{name:r,count:i})})}return e("div",0===l&&c>0?{children:J("move_files_to_trash",{count:c})}:{children:J("move_mixed_to_trash",{total:s,folders:l,images:c})})})()}),t(G,{className:`${cl.deleteModal} deleteModal`,title:e("div",{className:"modal-title",children:J("Clear Trash")}),open:!!H,onOk:async()=>{le(!0),$&&await $(),le(!1)},onCancel:()=>W&&W(),okText:J("Delete permanently"),cancelText:J("Cancel"),okButtonProps:{danger:!0,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1)},closeIcon:e(be,{className:cl.closeIcon}),children:[e("div",{children:J("Are you sure you want to permanently delete all items from Trash?")}),se&&t("div",{className:cl.clearTrashProgress,children:[e(q,{percent:99,status:"active",showInfo:!1}),e("div",{className:cl.progressText,children:J("Deleting items...")})]})]})]})};var pl={button:"button",folderActions:"folderActions",uploadButton:"uploadButton",foldersContainer:"foldersContainer",buttonWrapper:"buttonWrapper",uploadButtonTitle:"uploadButtonTitle"};const gl=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;const C=d(()=>Array.isArray(s)?s:[],[s]),{t:_}=Kn(),S=Mo(),[k,A]=o({}),{options:I,state:E}=mo(),{dataProviders:F,config:T}=I,O=E.pathHistory,P=!1!==(null===(b=null==T?void 0:T.features)||void 0===b?void 0:b.enableGif)&&(!(null==T?void 0:T.enabledTabs)||T.enabledTabs.includes("gif")),R=!1!==(null===(w=null==T?void 0:T.features)||void 0===w?void 0:w.enableStockImages)&&(!(null==T?void 0:T.enabledTabs)||T.enabledTabs.includes("stock")),L=!1!==(null===(x=null==T?void 0:T.features)||void 0===x?void 0:x.enableIconStock)&&(!(null==T?void 0:T.enabledTabs)||T.enabledTabs.includes("icons")),N=c(e=>{const t=[],r=e=>{e.forEach(e=>{t.push(e.key),e.children&&r(e.children)})};return r(e),t},[]),[j,D]=o(()=>{if(!0===(null==T?void 0:T.expandAllFoldersOnInit)&&"lazy"!==(null==T?void 0:T.folderTreeLoading)){const e=n();return N(e)}return!0===(null==T?void 0:T.expandRootFolderOnInit)?["folders"]:[]}),z=u(!1),B=u(!1);a(()=>{if(z.current)return;"lazy"===(null==T?void 0:T.folderTreeLoading)&&!0===(null==T?void 0:T.expandRootFolderOnInit)&&(z.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==T?void 0:T.folderTreeLoading,null==T?void 0:T.expandRootFolderOnInit,l]),a(()=>{!0===(null==T?void 0:T.expandRootFolderOnInit)&&Array.isArray(C)&&C.length>0&&(B.current||j&&0!==j.length||(B.current=!0,D(["folders"])))},[null==T?void 0:T.expandRootFolderOnInit,C,j]),a(()=>{if(!0===(null==T?void 0:T.expandAllFoldersOnInit)&&"lazy"!==(null==T?void 0:T.folderTreeLoading)){const e=n(),t=N(e);return void D(t)}!0===(null==T?void 0:T.expandRootFolderOnInit)&&D(e=>e&&e.length>0?[...e]:["folders"])},[C,n,N,null==T?void 0:T.expandAllFoldersOnInit,null==T?void 0:T.folderTreeLoading,null==T?void 0:T.expandRootFolderOnInit]);const U=null==T?void 0:T.disablePagination,V=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:U?void 0:1,limit:U?void 0:1});return U?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 Va({folderId:e,dataProviders:F,folders:C,pathHistory:O,t:_});return S.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:_("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,U,S,O,C,_]),H=c(async()=>{if(0===C.length)return;const e={};e.folders=await V("folders");const t=C.map(async t=>{"number"!=typeof t.childCount?e[t.id]=await V(t.id):e[t.id]=t.childCount});await Promise.all(t),A(e)},[C,V]),$=c(async e=>{const t=await V(e);A(r=>Object.assign(Object.assign({},r),{[e]:t}))},[V]);g(y,()=>({refreshFileCounts:H}),[H]),a(()=>{H()},[H]),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=C.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?D(e=>{const r=new Set(e);return t.forEach(e=>r.add(e)),r.add("folders"),Array.from(r)}):D(e=>e.includes("folders")?e:[...e,"folders"])},[r,C]);const W=c(async()=>{await h(),r?await $(r):await $("folders")},[h,r,$]),G=[{key:rr,label:_("My files"),icon:e(ki,{size:20,strokeWidth:null==T?void 0:T.iconStrokeWidth})},{key:nr,label:_("GIF"),icon:e(Ei,{size:20,strokeWidth:null==T?void 0:T.iconStrokeWidth}),disabled:!P},{key:ir,label:_("Stock images"),icon:e(mi,{size:20,strokeWidth:null==T?void 0:T.iconStrokeWidth}),disabled:!R},{key:or,label:_("Icons"),icon:e(we,{size:20}),disabled:!L},{key:ar,label:_("AI"),icon:e(Mi,{size:20,strokeWidth:null==T?void 0:T.iconStrokeWidth}),disabled:!(null==T?void 0:T.sseQuery)}].filter(e=>!e.disabled),q=c(async e=>{const t=e[0];t&&"empty"!==t&&(m!==rr&&v(rr),null==i||i(t),await(null==l?void 0:l(t)))},[i,m,v,l]),K=c(({key:e})=>{v(e)},[v]),Z=c(async(e,t)=>{var r;D(e);if(!("lazy"===(null==T?void 0:T.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 Va({folderId:n,dataProviders:F,folders:C,pathHistory:O,t:_});S.error({id:"FOLDER_CHILDREN_FETCH_FAILED",message:_("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==T?void 0:T.folderTreeLoading,F,l,S,O,C,_]);return t("div",{className:"sidebar-container",children:[t("div",{className:pl.buttonWrapper,children:[e(M,{type:"primary",size:"large",icon:e(Fi,{size:24,strokeWidth:null==T?void 0:T.iconStrokeWidth}),onClick:W,className:pl.uploadButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===r,children:e("span",{className:pl.uploadButtonTitle,children:_("Upload file")})}),e(M,{type:"primary",size:"large",icon:e(Ai,{size:24,strokeWidth:null==T?void 0:T.iconStrokeWidth}),onClick:()=>null==f?void 0:f(!0),className:pl.uploadByURLButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===r})]}),e(Y,{className:"folder-menu",items:G,defaultSelectedKeys:[rr],onSelect:({key:e})=>K({key:e}),selectedKeys:[m]}),e(X,{className:pl.divider}),t("div",{className:pl.foldersContainer,children:[e(sl,{selectedFolder:r,onSelect:q,onExpand:Z,generateMenuItems:n,fetchChildFolders:l,showFileCounts:!0,folderFileCounts:k,expandedKeys:j,setExpandedKeys:D,showTrashFolder:null==T?void 0:T.enableTrashFolder}),e("div",{className:pl.folderActions,children:e(M,{onClick:e=>{e.stopPropagation(),p()},className:pl.button,icon:e(Ci,{size:18,strokeWidth:null==T?void 0:T.iconStrokeWidth}),size:"middle"})})]})]})}));gl.displayName="FolderSidebar";var ml=Object.defineProperty,vl=(e,t,r)=>(((e,t,r)=>{t in e?ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);function yl(e,t){return void 0===t&&(t=15),+parseFloat(Number(e).toPrecision(t))}function bl(e){var t=e.toString().split(/[eE]/),r=(t[0].split(".")[1]||"").length-+(t[1]||0);return r>0?r:0}function wl(e){if(-1===e.toString().indexOf("e"))return Number(e.toString().replace(".",""));var t=bl(e);return t>0?yl(Number(e)*Math.pow(10,t)):Number(e)}function xl(e){Il&&(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 Cl(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=Cl(function(e,t){var r=wl(e),n=wl(t),i=bl(e)+bl(t),o=r*n;return xl(o),o/Math.pow(10,i)}),Sl=Cl(function(e,t){var r=Math.pow(10,Math.max(bl(e),bl(t)));return(_l(e,r)+_l(t,r))/r}),kl=Cl(function(e,t){var r=Math.pow(10,Math.max(bl(e),bl(t)));return(_l(e,r)-_l(t,r))/r}),Al=Cl(function(e,t){var r=wl(e),n=wl(t);return xl(r),xl(n),_l(r/n,yl(Math.pow(10,bl(t)-bl(e))))});var Il=!0;var El={strip:yl,plus:Sl,minus:kl,times:_l,divide:Al,round:function(e,t){var r=Math.pow(10,t),n=Al(Math.round(Math.abs(_l(e,r))),r);return e<0&&0!==n&&(n=_l(n,-1)),n},digitLength:bl,float2Fixed:wl,enableBoundaryChecking:function(e){void 0===e&&(e=!0),Il=e}};const Fl=Object.prototype.toString;function Tl(e){switch(Fl.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Bl(e,Error)}}function Ol(e,t){return Fl.call(e)===`[object ${t}]`}function Pl(e){return Ol(e,"ErrorEvent")}function Ml(e){return Ol(e,"DOMError")}function Rl(e){return Ol(e,"String")}function Ll(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function Nl(e){return null===e||Ll(e)||"object"!=typeof e&&"function"!=typeof e}function jl(e){return Ol(e,"Object")}function Dl(e){return typeof Event<"u"&&Bl(e,Event)}function zl(e){return!(!e||!e.then||"function"!=typeof e.then)}function Bl(e,t){try{return e instanceof t}catch{return!1}}function Ul(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}function Vl(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Hl(e,t){if(!Array.isArray(e))return"";const r=[];for(let t=0;t<e.length;t++){const n=e[t];try{Ul(n)?r.push("[VueViewModel]"):r.push(String(n))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function $l(e,t,r=!1){return!!Rl(e)&&(function(e){return Ol(e,"RegExp")}(t)?t.test(e):!!Rl(t)&&(r?e===t:e.includes(t)))}function Wl(e,t=[],r=!1){return t.some(t=>$l(e,t,r))}function Gl(e,t,r=250,n,i,o,a){if(!(o.exception&&o.exception.values&&a&&Bl(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=Vl(e.value,t)),e))}(ql(e,t,i,a.originalException,n,o.exception.values,s,0),r))}function ql(e,t,r,n,i,o,a,s){if(o.length>=r+1)return o;let l=[...o];if(Bl(n[i],Error)){Yl(a,s);const o=e(t,n[i]),c=l.length;Xl(o,i,c,s),l=ql(e,t,r,n[i],i,[o,...l],o,c)}return Array.isArray(n.errors)&&n.errors.forEach((n,o)=>{if(Bl(n,Error)){Yl(a,s);const c=e(t,n),u=l.length;Xl(c,`errors[${o}]`,u,s),l=ql(e,t,r,n,i,[c,...l],c,u)}}),l}function Yl(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 Xl(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 Kl(e){return e&&e.Math==Math?e:void 0}const Zl="object"==typeof globalThis&&Kl(globalThis)||"object"==typeof window&&Kl(window)||"object"==typeof self&&Kl(self)||"object"==typeof global&&Kl(global)||function(){return this}()||{};function Jl(){return Zl}function Ql(e,t,r){const n=r||Zl,i=n.__SENTRY__=n.__SENTRY__||{};return i[e]||(i[e]=t())}const ec=Jl();function tc(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=rc(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 rc(e,t){const r=e,n=[];let i,o,a,s,l;if(!r||!r.tagName)return"";if(ec.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&&Rl(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 nc=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ic=["debug","info","warn","error","log","assert","trace"],oc={};function ac(e){if(!("console"in Zl))return e();const t=Zl.console,r={},n=Object.keys(oc);n.forEach(e=>{const n=oc[e];r[e]=t[e],t[e]=n});try{return e()}finally{n.forEach(e=>{t[e]=r[e]})}}const sc=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return nc?ic.forEach(r=>{t[r]=(...t)=>{e&&ac(()=>{Zl.console[r](`Sentry Logger [${r}]:`,...t)})}}):ic.forEach(e=>{t[e]=()=>{}}),t}(),lc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function cc(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 uc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function dc(e){const t="string"==typeof e?function(e){const t=lc.exec(e);if(!t)return void ac(()=>{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 uc({host:o,pass:i,path:l,projectId:c,port:a,protocol:r,publicKey:n})}(e):uc(e);if(t&&function(e){if(!nc)return!0;const{port:t,projectId:r,protocol:n}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(sc.error(`Invalid Sentry Dsn: ${t} missing`),!0))||(r.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(n)?t&&isNaN(parseInt(t,10))&&(sc.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(sc.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),1):(sc.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),1)))}(t))return t}class hc 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 fc(e,t,r){if(!(t in e))return;const n=e[t],i=r(n);"function"==typeof i&&gc(i,n),e[t]=i}function pc(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{nc&&sc.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function gc(e,t){try{const r=t.prototype||{};e.prototype=t.prototype=r,pc(e,"__sentry_original__",t)}catch{}}function mc(e){return e.__sentry_original__}function vc(e){if(Tl(e))return{message:e.message,name:e.name,stack:e.stack,...bc(e)};if(Dl(e)){const t={type:e.type,target:yc(e.target),currentTarget:yc(e.currentTarget),...bc(e)};return typeof CustomEvent<"u"&&Bl(e,CustomEvent)&&(t.detail=e.detail),t}return e}function yc(e){try{return function(e){return typeof Element<"u"&&Bl(e,Element)}(e)?tc(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function bc(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 wc(e){return xc(e,new Map)}function xc(e,t){if(function(e){if(!jl(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]=xc(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(xc(e,t))}),n}return e}const Cc=/\(error: (.*)\)/,_c=/captureMessage|captureException/;function Sc(...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=Cc.test(r)?r.replace(Cc,"$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 kc(e){return Array.isArray(e)?Sc(...e):e}const Ac="<anonymous>";function Ic(e){try{return e&&"function"==typeof e&&e.name||Ac}catch{return Ac}}const Ec={},Fc={};function Tc(e,t){Ec[e]=Ec[e]||[],Ec[e].push(t)}function Oc(e,t){Fc[e]||(t(),Fc[e]=!0)}function Pc(e,t){const r=e&&Ec[e];if(r)for(const n of r)try{n(t)}catch(t){nc&&sc.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Ic(n)}\nError:`,t)}}function Mc(){"console"in Zl&&ic.forEach(function(e){e in Zl.console&&fc(Zl.console,e,function(t){return oc[e]=t,function(...t){Pc("console",{args:t,level:e});const r=oc[e];r&&r.apply(Zl.console,t)}})})}function Rc(){const e=Zl,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 Lc(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function Nc(e){const{message:t,event_id:r}=e;if(t)return t;const n=Lc(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function jc(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 Dc(e,t){const r=Lc(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 zc(e){if(e&&e.__sentry_captured__)return!0;try{pc(e,"__sentry_captured__",!0)}catch{}return!1}function Bc(e){return Array.isArray(e)?e:[e]}const Uc=Zl;let Vc,Hc,$c;function Wc(){if(!Uc.document)return;const e=Pc.bind(null,"dom"),t=Gc(e,!0);Uc.document.addEventListener("click",t,!1),Uc.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const r=Uc[t]&&Uc[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(fc(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=Gc(e);a.handler=n,t.call(this,r,n,i)}a.refCount++}catch{}return t.call(this,r,n,i)}}),fc(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 Gc(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;pc(r,"_sentryCaptured",!0),n&&!n._sentryId&&pc(n,"_sentryId",Rc());const i="keypress"===r.type?"input":r.type;(function(e){if(e.type!==Hc)return!1;try{if(!e.target||e.target._sentryId!==$c)return!1}catch{}return!0})(r)||(e({event:r,name:i,global:t}),Hc=r.type,$c=n?n._sentryId:void 0),clearTimeout(Vc),Vc=Uc.setTimeout(()=>{$c=void 0,Hc=void 0},1e3)}}const qc=Jl();function Yc(){if(!("fetch"in qc))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Xc(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Kc(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!Yc())return!1;if(Xc(qc.fetch))return!0;let e=!1;const t=qc.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=Xc(r.contentWindow.fetch)),t.head.removeChild(r)}catch(e){nc&&sc.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e})()&&fc(Zl,"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:Jc(t),method:Zc(r,"method")?String(r.method).toUpperCase():"GET"}}const t=e[0];return{url:Jc(t),method:Zc(t,"method")?String(t.method).toUpperCase():"GET"}}(t),i={args:t,fetchData:{method:r,url:n},startTimestamp:Date.now()};return Pc("fetch",{...i}),e.apply(Zl,t).then(e=>(Pc("fetch",{...i,endTimestamp:Date.now(),response:e}),e),e=>{throw Pc("fetch",{...i,endTimestamp:Date.now(),error:e}),e})}})}function Zc(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Jc(e){return"string"==typeof e?e:e?Zc(e,"url")?e.url:e.toString?e.toString():"":""}let Qc=null;function eu(){Qc=Zl.onerror,Zl.onerror=function(e,t,r,n,i){return Pc("error",{column:n,error:i,line:r,msg:e,url:t}),!(!Qc||Qc.__SENTRY_LOADER__)&&Qc.apply(this,arguments)},Zl.onerror.__SENTRY_INSTRUMENTED__=!0}let tu=null;function ru(){tu=Zl.onunhandledrejection,Zl.onunhandledrejection=function(e){return Pc("unhandledrejection",e),!(tu&&!tu.__SENTRY_LOADER__)||tu.apply(this,arguments)},Zl.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const nu=Jl();const iu=Zl;let ou;function au(e){const t="history";Tc(t,e),Oc(t,su)}function su(){if(!function(){const e=nu.chrome,t=e&&e.app&&e.app.runtime,r="history"in nu&&!!nu.history.pushState&&!!nu.history.replaceState;return!t&&r}())return;const e=iu.onpopstate;function t(e){return function(...t){const r=t.length>2?t[2]:void 0;if(r){const e=ou,t=String(r);ou=t,Pc("history",{from:e,to:t})}return e.apply(this,t)}}iu.onpopstate=function(...t){const r=iu.location.href,n=ou;if(ou=r,Pc("history",{from:n,to:r}),e)try{return e.apply(this,t)}catch{}},fc(iu.history,"pushState",t),fc(iu.history,"replaceState",t)}const lu=Zl,cu="__sentry_xhr_v3__";function uu(){if(!lu.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;fc(e,"open",function(e){return function(...t){const r=Date.now(),n=Rl(t[0])?t[0].toUpperCase():void 0,i=function(e){if(Rl(e))return e;try{return e.toString()}catch{}}(t[1]);if(!n||!i)return e.apply(this,t);this[cu]={method:n,url:i,request_headers:{}},"POST"===n&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const e=this[cu];if(e&&4===this.readyState){try{e.status_code=this.status}catch{}Pc("xhr",{args:[n,i],endTimestamp:Date.now(),startTimestamp:r,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?fc(this,"onreadystatechange",function(e){return function(...t){return o(),e.apply(this,t)}}):this.addEventListener("readystatechange",o),fc(this,"setRequestHeader",function(e){return function(...t){const[r,n]=t,i=this[cu];return i&&Rl(r)&&Rl(n)&&(i.request_headers[r.toLowerCase()]=n),e.apply(this,t)}}),e.apply(this,t)}}),fc(e,"send",function(e){return function(...t){const r=this[cu];if(!r)return e.apply(this,t);void 0!==t[0]&&(r.body=t[0]);return Pc("xhr",{args:[r.method,r.url],startTimestamp:Date.now(),xhr:this}),e.apply(this,t)}})}function du(e,t=100,r=1/0){try{return fu("",e,t,r)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function hu(e,t=3,r=102400){const n=du(e,t);return function(e){return function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(e))}(n)>r?hu(e,t-1,r):n}function fu(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(Ul(t))return"[VueViewModel]";if(function(e){return jl(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: ${Ic(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 fu("",c.toJSON(),l-1,n,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=vc(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]=fu(e,t,l-1,n,i),d++}return a(t),u}var pu;function gu(e){return new vu(t=>{t(e)})}function mu(e){return new vu((t,r)=>{r(e)})}!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(pu||(pu={}));class vu{constructor(e){vu.prototype.__init.call(this),vu.prototype.__init2.call(this),vu.prototype.__init3.call(this),vu.prototype.__init4.call(this),this._state=pu.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new vu((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 vu((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(pu.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(pu.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===pu.PENDING){if(zl(t))return void t.then(this._resolve,this._reject);this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===pu.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||(this._state===pu.RESOLVED&&e[1](this._value),this._state===pu.REJECTED&&e[2](this._value),e[0]=!0)})}}}function yu(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 mu(new hc("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 vu((r,n)=>{let i=t.length;if(!i)return r(!0);const o=setTimeout(()=>{e&&e>0&&r(!1)},e);t.forEach(e=>{gu(e).then(()=>{--i||(clearTimeout(o),r(!0))},n)})})}}}function bu(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 wu=["fatal","error","warning","log","info","debug"];function xu(e){return"warn"===e?"warning":wu.includes(e)?e:"log"}function Cu(){return Date.now()/1e3}const _u=function(){const{performance:e}=Zl;if(!e||!e.now)return Cu;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/1e3}();function Su(e,t=[]){return[e,t]}function ku(e,t){const[r,n]=e;return[r,[...n,t]]}function Au(e,t){const r=e[1];for(const e of r){if(t(e,e[0].type))return!0}return!1}function Iu(e,t){return(t||new TextEncoder).encode(e)}function Eu(e,t){const[r,n]=e;let i=JSON.stringify(r);function o(e){"string"==typeof i?i="string"==typeof e?i+e:[Iu(i,t),e]:i.push("string"==typeof e?Iu(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(du(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 Fu(e,t){const r="string"==typeof e.data?Iu(e.data,t):e.data;return[wc({type:"attachment",length:r.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),r]}(()=>{const{performance:e}=Zl;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 Tu={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 Ou(e){return Tu[e]}function Pu(e){if(!e||!e.sdk)return;const{name:t,version:r}=e.sdk;return{name:t,version:r}}function Mu(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 Ru=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Lu="production";function Nu(){return Ql("globalEventProcessors",()=>[])}function ju(e){Nu().push(e)}function Du(e,t,r,n=0){return new vu((i,o)=>{const a=e[n];if(null===t||"function"!=typeof a)i(t);else{const s=a({...t},r);Ru&&a.id&&null===s&&sc.log(`Event processor "${a.id}" dropped event`),zl(s)?s.then(t=>Du(e,t,r,n+1).then(i)).then(null,o):Du(e,s,r,n+1).then(i).then(null,o)}})}function zu(e){const t=_u(),r={sid:Rc(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return wc({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&&Bu(r,e),r}function Bu(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:Rc()),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 Uu(e,t){let r={};"ok"===e.status&&(r={status:"exited"}),Bu(e,r)}function Vu(e){const{spanId:t,traceId:r}=e.spanContext(),{data:n,op:i,parent_span_id:o,status:a,tags:s,origin:l}=Hu(e);return wc({data:n,op:i,parent_span_id:o,span_id:t,status:a,tags:s,trace_id:r,origin:l})}function Hu(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}function $u(e,t,r,n,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||r.event_id||Rc(),timestamp:t.timestamp||Cu()},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:Lu),void 0===e.release&&void 0!==n&&(e.release=n),void 0===e.dist&&void 0!==i&&(e.dist=i),e.message&&(e.message=Vl(e.message,o));const a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=Vl(a.value,o));const s=e.request;s&&s.url&&(s.url=Vl(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=Zl._sentryDebugIds;if(!r)return;let n;const i=Wu.get(t);i?n=i:(n=new Map,Wu.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 sd;return r.update(t),r}(n,r.captureContext);r.mechanism&&Dc(l,r.mechanism);const d=i&&i.getEventProcessors?i.getEventProcessors():[],h=(ad||(ad=new sd),ad).getScopeData();if(o){id(h,o.getScopeData())}if(u){id(h,u.getScopeData())}const f=[...r.attachments||[],...h.attachments];f.length&&(r.attachments=f),nd(l,h);return Du([...d,...Nu(),...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:du(e.data,t,r)}}))},...e.user&&{user:du(e.user,t,r)},...e.contexts&&{contexts:du(e.contexts,t,r)},...e.extra&&{extra:du(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=du(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(e=>{const n=Hu(e).data;return n&&(e.data=du(n,t,r)),e})),n}(e,a,s):e))}const Wu=new WeakMap;function Gu(e,t){return gd().captureEvent(e,t)}function qu(e,t){gd().addBreadcrumb(e,t)}function Yu(){return gd().getClient()}function Xu(){return gd().getScope()}function Ku(e){const t=Yu(),r=md(),n=Xu(),{release:i,environment:o=Lu}=t&&t.getOptions()||{},{userAgent:a}=Zl.navigator||{},s=zu({release:i,environment:o,user:n.getUser()||r.getUser(),...a&&{userAgent:a},...e}),l=r.getSession();return l&&"ok"===l.status&&Bu(l,{status:"exited"}),Zu(),r.setSession(s),n.setSession(s),s}function Zu(){const e=md(),t=Xu(),r=t.getSession()||e.getSession();r&&Uu(r),Ju(),e.setSession(),t.setSession()}function Ju(){const e=md(),t=Xu(),r=Yu(),n=t.getSession()||e.getSession();n&&r&&r.captureSession&&r.captureSession(n)}function Qu(e=!1){e?Zu():Ju()}function ed(e){return e.transaction}function td(e,t,r){const n=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:o}=r&&r.getUser()||{},a=wc({environment:n.environment||Lu,release:n.release,user_segment:o,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",a),a}function rd(e){const t=Yu();if(!t)return{};const r=td(Hu(e).trace_id||"",t,Xu()),n=ed(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=Hu(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 nd(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=wc(r);l&&Object.keys(l).length&&(e.extra={...l,...e.extra});const c=wc(n);c&&Object.keys(c).length&&(e.tags={...c,...e.tags});const u=wc(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});const d=wc(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:Vu(t),...e.contexts};const r=ed(t);if(r){e.sdkProcessingMetadata={dynamicSamplingContext:rd(t),...e.sdkProcessingMetadata};const n=Hu(r).description;n&&(e.tags={transaction:n,...e.tags})}}(e,n),function(e,t){e.fingerprint=e.fingerprint?Bc(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 id(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;od(e,"extra",r),od(e,"tags",n),od(e,"user",i),od(e,"contexts",o),od(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 od(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 ad;class sd{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=ld()}static clone(e){return e?e.clone():new sd}clone(){const e=new sd;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&&Bu(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 sd){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(jl(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=ld(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:100;if(r<=0)return this;const n={timestamp:Cu(),...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=[]){nd(e,this.getScopeData());return Du([...r,...Nu(),...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:Rc();if(!this._client)return sc.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:Rc();if(!this._client)return sc.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:Rc();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(sc.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 ld(){return{traceId:Rc(),spanId:Rc().substring(16)}}const cd="7.116.0",ud=parseFloat(cd),dd=100;class hd{constructor(e,t,r,n=ud){let i,o;this._version=n,t?i=t:(i=new sd,i.setClient(e)),r?o=r:(o=new sd,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 zl(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:Rc(),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:Rc(),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:Rc();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=dd}=n.getOptions&&n.getOptions()||{};if(o<=0)return;const a={timestamp:Cu(),...e},s=i?ac(()=>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=pd(this);try{e(this)}finally{pd(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch{return Ru&&sc.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const r=this._callExtensionMethod("startTransaction",e,t);return Ru&&!r&&(this.getClient()?sc.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):sc.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&&Uu(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:r}=this.getStackTop(),{release:n,environment:i=Lu}=r&&r.getOptions()||{},{userAgent:o}=Zl.navigator||{},a=zu({release:n,environment:i,user:t.getUser(),...o&&{userAgent:o},...e}),s=t.getSession&&t.getSession();return s&&"ok"===s.status&&Bu(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=fd().__SENTRY__;if(r&&r.extensions&&"function"==typeof r.extensions[e])return r.extensions[e].apply(this,t);Ru&&sc.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function fd(){return Zl.__SENTRY__=Zl.__SENTRY__||{extensions:{},hub:void 0},Zl}function pd(e){const t=fd(),r=vd(t);return yd(t,e),r}function gd(){const e=fd();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=fd()){return(!function(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}(e)||vd(e).isOlderThan(ud))&&yd(e,new hd),vd(e)}(e)}function md(){return gd().getIsolationScope()}function vd(e){return Ql("hub",()=>new hd,e)}function yd(e,t){if(!e)return!1;return(e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0}function bd(e,t,r,n){const i=Pu(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:cc(n)},...i&&{trace:wc({...i})}}}(e,i,n,t);return delete e.sdkProcessingMetadata,Su(a,[[{type:o},e]])}function wd(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 xd=[];function Cd(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?Bc(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 Sd(e,t,r){if(r[t.name])Ru&&sc.log(`Integration skipped because it was already installed: ${t.name}`);else{if(r[t.name]=t,-1===xd.indexOf(t.name)&&(t.setupOnce(ju,gd),xd.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)}Ru&&sc.log(`Integration installed: ${t.name}`)}}function kd(e,t){return Object.assign(function(...e){return t(...e)},{id:e})}function Ad(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=cc(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 Su(i,[o])}const Id="Not capturing exception because it's already been captured.";class Ed{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=dc(e.dsn):Ru&&sc.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)}?${wd(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(zc(e))return void(Ru&&sc.log(Id));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=Ll(e)?e:String(e),a=Nl(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&&zc(t.originalException))return void(Ru&&sc.log(Id));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?Ru&&sc.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),Bu(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))):gu(!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 Ru&&sc.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];Sd(this,e,this._integrations),t||_d(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let r=bd(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])r=ku(r,Fu(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=Pu(r);return Su({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!n&&t&&{dsn:cc(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}`;Ru&&sc.log(`Adding outcome: "${r}"`),this._outcomes[r]=this._outcomes[r]+1||1}}captureAggregateMetrics(e){Ru&&sc.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=Ad(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&&Sd(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)&&(Bu(e,{...r&&{status:"crashed"},errors:e.errors||Number(n||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new vu(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=md()){const i=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o.length>0&&(t.integrations=o),this.emit("preprocessEvent",e,t),$u(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||td(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(Ru){const t=e;"log"===t.logLevel?sc.log(t.message):sc.warn(t)}})}_processEvent(e,t,r){const n=this.getOptions(),{sampleRate:i}=n,o=Td(e),a=Fd(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),mu(new hc(`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 hc("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 Fd(t)&&n?n(t,r):Td(t)&&i?i(t,r):t}(n,r,t);return function(e,t){const r=`${t} must return \`null\` or a valid event.`;if(zl(e))return e.then(e=>{if(!jl(e)&&null!==e)throw new hc(r);return e},e=>{throw new hc(`${t} rejected with ${e}`)});if(!jl(e)&&null!==e)throw new hc(r);return e}(i,l)}).then(n=>{if(null===n)throw this.recordDroppedEvent("before_send",c,e),new hc(`${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 hc?e:(this.captureException(e,{data:{__sentry__:!0},originalException:e}),new hc(`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=>{Ru&&sc.error("Error while sending event:",e)});Ru&&sc.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 Fd(e){return void 0===e.type}function Td(e){return"transaction"===e.type}function Od(e,t){!0===t.debug&&(Ru?sc.enable():ac(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Xu().update(t.initialScope);const r=new e(t);(function(e){const t=gd().getStackTop();t.client=e,t.scope.setClient(e)})(r),function(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}(r)}function Pd(e,t,r=yu(e.bufferSize||30)){let n={};function i(i){const o=[];if(Au(i,(t,r)=>{const i=Ou(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=Md(t,r);e.recordDroppedEvent("ratelimit_backoff",i,n)}else o.push(t)}),0===o.length)return gu();const a=Su(i[0],o),s=t=>{Au(a,(r,n)=>{const i=Md(r,n);e.recordDroppedEvent(t,Ou(n),i)})};return r.add(()=>t({body:Eu(a,e.textEncoder)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Ru&&sc.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),n=Mu(n,e),e),e=>{throw s("network_error"),e})).then(e=>e,e=>{if(e instanceof hc)return Ru&&sc.error("Skipped sending event because buffer is full."),s("queue_overflow"),gu();throw e})}return i.__sentry__baseTransport__=!0,{send:i,flush:e=>r.drain(e)}}function Md(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}function Rd(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:cd})),version:cd}),e._metadata=i}const Ld=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],Nd=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],jd="InboundFilters",Dd=(e={})=>({name:jd,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?[]:Ld],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:Nd],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)?(Ru&&sc.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${Nc(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}`)),Ru&&0===t.length&&sc.error(`Could not extract message for event ${Nc(e)}`),t}(e).some(e=>Wl(e,t))}(e,t.ignoreErrors)?(Ru&&sc.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Nc(e)}`),!0):function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const r=e.transaction;return!!r&&Wl(r,t)}(e,t.ignoreTransactions)?(Ru&&sc.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Nc(e)}`),!0):function(e,t){if(!t||!t.length)return!1;const r=zd(e);return!!r&&Wl(r,t)}(e,t.denyUrls)?(Ru&&sc.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Nc(e)}.\nUrl: ${zd(e)}`),!0):!function(e,t){if(!t||!t.length)return!0;const r=zd(e);return!r||Wl(r,t)}(e,t.allowUrls)&&(Ru&&sc.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Nc(e)}.\nUrl: ${zd(e)}`),!0)}(t,o)?null:t}});function zd(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 Ru&&sc.error(`Cannot extract url for event ${Nc(e)}`),null}}let Bd;kd(jd,Dd);const Ud="FunctionToString",Vd=new WeakMap,Hd=()=>({name:Ud,setupOnce(){Bd=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=mc(this),r=Vd.has(Yu())&&void 0!==t?t:this;return Bd.apply(r,e)}}catch{}},setup(e){Vd.set(e,!0)}});kd(Ud,Hd);const $d=Zl;let Wd=0;function Gd(){return Wd>0}function qd(e,t={},r){if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return t;if(mc(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=>qd(e,t));return e.apply(this,i)}catch(e){throw Wd++,setTimeout(()=>{Wd--}),function(...e){const t=gd();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&&(jc(e,void 0),Dc(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),function(e){gd().captureException(e,void 0)}(e)}),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}gc(n,e),pc(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}const Yd=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Xd(e,t){const r=Zd(e,t),n={type:t&&t.name,value:Qd(t)};return r.length&&(n.stacktrace={frames:r}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function Kd(e,t){return{exception:{values:[Xd(e,t)]}}}function Zd(e,t){const r=t.stacktrace||t.stack||"",n=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(Jd.test(e.message))return 1}return 0}(t);try{return e(r,n)}catch{}return[]}const Jd=/Minified React error #\d+;/i;function Qd(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function eh(e,t,r,n,i){let o;if(Pl(t)&&t.error)return Kd(e,t.error);if(Ml(t)||function(e){return Ol(e,"DOMException")}(t)){const i=t;if("stack"in t)o=Kd(e,t);else{const t=i.name||(Ml(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=th(e,a,r,n),jc(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Tl(t)?Kd(e,t):jl(t)||Dl(t)?(o=function(e,t,r,n){const i=Yu(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:Dl(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:rh(t,{isUnhandledRejection:n})}]},extra:{__serialized__:hu(t,o)}};if(r){const t=Zd(e,r);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,r,i),Dc(o,{synthetic:!0}),o):(o=th(e,t,r,n),jc(o,`${t}`),Dc(o,{synthetic:!0}),o)}function th(e,t,r,n){const i={};if(n&&r){const n=Zd(e,r);n.length&&(i.exception={values:[{value:t,stacktrace:{frames:n}}]})}if(Ll(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 rh(e,{isUnhandledRejection:t}){const r=function(e,t=40){const r=Object.keys(vc(e));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=t)return Vl(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:Vl(n,t)}return""}(e),n=t?"promise rejection":"exception";return Pl(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:Dl(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 nh extends Ed{constructor(e){Rd(e,"browser",["browser"],$d.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&$d.document&&$d.document.addEventListener("visibilitychange",()=>{"hidden"===$d.document.visibilityState&&this._flushOutcomes()})}eventFromException(e,t){return function(e,t,r,n){const i=eh(e,t,r&&r.syntheticException||void 0,n);return Dc(i),i.level="error",r&&r.event_id&&(i.event_id=r.event_id),gu(i)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return function(e,t,r="info",n,i){const o=th(e,t,n&&n.syntheticException||void 0,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),gu(o)}(this._options.stackParser,e,t,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(Yd&&sc.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:cc(n)}},o=function(e){return[{type:"user_report"},e]}(e);return Su(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(Yd&&sc.log("No outcomes to send"));if(!this._dsn)return void(Yd&&sc.log("No dsn provided, will not send outcomes"));Yd&&sc.log("Sending outcomes:",e);const t=function(e,t){return Su(t?{dsn:t}:{},[[{type:"client_report"},{timestamp:Cu(),discarded_events:e}]])}(e,this._options.tunnel&&cc(this._dsn));this._sendEnvelope(t)}}let ih;function oh(e,t=function(){if(ih)return ih;if(Xc($d.fetch))return ih=$d.fetch.bind($d);const e=$d.document;let t=$d.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){Yd&&sc.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return ih=t.bind($d)}()){let r=0,n=0;return Pd(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 ih=void 0,r-=o,n--,mu(e)}})}function ah(e){return Pd(e,function(t){return new vu((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 sh="?";function lh(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 ch=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,uh=/\((\S*)(?::(\d+))(?::(\d+))\)/,dh=[30,e=>{const t=ch.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=uh.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,r]=yh(t[1]||sh,t[2]);return lh(r,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],hh=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ph=[50,e=>{const t=hh.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=fh.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]||sh;return[r,e]=yh(r,e),lh(e,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],gh=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,mh=[40,e=>{const t=gh.exec(e);return t?lh(t[2],t[1]||sh,+t[3],t[4]?+t[4]:void 0):void 0}],vh=Sc(...[dh,ph,mh]),yh=(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]:sh,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},bh=1024,wh="Breadcrumbs",xh=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:wh,setupOnce(){},setup(e){t.console&&function(e){const t="console";Tc(t,e),Oc(t,Mc)}(function(e){return function(t){if(Yu()!==e)return;const r={category:"console",data:{arguments:t.args,logger:"console"},level:xu(t.level),message:Hl(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;r.message=`Assertion failed: ${Hl(t.args.slice(1)," ")||"console.assert"}`,r.data.arguments=t.args.slice(1)}qu(r,{input:t.args,level:t.level})}}(e)),t.dom&&function(e){Tc("dom",e),Oc("dom",Wc)}(function(e,t){return function(r){if(Yu()!==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>bh&&(Yd&&sc.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=bh),"string"==typeof o&&(o=[o]);try{const e=r.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;n=tc(t,{keyAttrs:o,maxStringLength:a}),i=function(e){if(!ec.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}),qu(s,{event:r.event,name:r.name,global:r.global})}}(e,t.dom)),t.xhr&&function(e){Tc("xhr",e),Oc("xhr",uu)}(function(e){return function(t){if(Yu()!==e)return;const{startTimestamp:r,endTimestamp:n}=t,i=t.xhr[cu];if(!r||!n||!i)return;const{method:o,url:a,status_code:s,body:l}=i;qu({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";Tc(t,e),Oc(t,Kc)}(function(e){return function(t){if(Yu()!==e)return;const{startTimestamp:r,endTimestamp:n}=t;if(n&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){qu({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:r,endTimestamp:n})}else{const e=t.response;qu({category:"fetch",data:{...t.fetchData,status_code:e&&e.status},type:"http"},{input:t.args,response:e,startTimestamp:r,endTimestamp:n})}}}(e)),t.history&&au(function(e){return function(t){if(Yu()!==e)return;let r=t.from,n=t.to;const i=bu($d.location.href);let o=r?bu(r):void 0;const a=bu(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),qu({category:"navigation",data:{from:r,to:n}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){Yu()===e&&qu({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Nc(t)},{event:t})}}(e))}}};kd(wh,xh);const Ch="Dedupe",_h=()=>{let e;return{name:Ch,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||!kh(e,t)||!Sh(e,t))}(e,t)&&!function(e,t){const r=Ah(t),n=Ah(e);return!!(r&&n&&r.type===n.type&&r.value===n.value&&kh(e,t)&&Sh(e,t))}(e,t))}(t,e))return Yd&&sc.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function Sh(e,t){let r=Ih(e),n=Ih(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 kh(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 Ah(e){return e.exception&&e.exception.values&&e.exception.values[0]}function Ih(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}kd(Ch,_h);const Eh="GlobalHandlers",Fh=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:Eh,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(e){const t="error";Tc(t,e),Oc(t,eu)}(t=>{const{stackParser:r,attachStacktrace:n}=Ph();if(Yu()!==e||Gd())return;const{msg:i,url:o,line:a,column:s,error:l}=t,c=void 0===l&&Rl(i)?function(e,t,r,n){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=Pl(e)?e.message:e,a="Error";const s=o.match(i);return s&&(a=s[1],o=s[2]),Th({exception:{values:[{type:a,value:o}]}},t,r,n)}(i,o,a,s):Th(eh(r,l||i,void 0,n,!1),o,a,s);c.level="error",Gu(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}(e),Oh("onerror")),t.onunhandledrejection&&(function(e){!function(e){const t="unhandledrejection";Tc(t,e),Oc(t,ru)}(t=>{const{stackParser:r,attachStacktrace:n}=Ph();if(Yu()!==e||Gd())return;const i=function(e){if(Nl(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=Nl(i)?function(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}(i):eh(r,i,void 0,n,!0);o.level="error",Gu(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(e),Oh("onunhandledrejection"))}}};function Th(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=Rl(t)&&t.length>0?t:function(){try{return ec.document.location.href}catch{return""}}();return 0===l.length&&l.push({colno:c,filename:d,function:"?",in_app:!0,lineno:u}),e}function Oh(e){Yd&&sc.log(`Global Handler attached: ${e}`)}function Ph(){const e=Yu();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}kd(Eh,Fh);const Mh="HttpContext",Rh=()=>({name:Mh,setupOnce(){},preprocessEvent(e){if(!$d.navigator&&!$d.location&&!$d.document)return;const t=e.request&&e.request.url||$d.location&&$d.location.href,{referrer:r}=$d.document||{},{userAgent:n}=$d.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}});kd(Mh,Rh);const Lh="LinkedErrors",Nh=(e={})=>{const t=e.limit||5,r=e.key||"cause";return{name:Lh,setupOnce(){},preprocessEvent(e,n,i){const o=i.getOptions();Gl(Xd,o.stackParser,o.maxValueLength,r,t,e,n)}}};kd(Lh,Nh);const jh=["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"],Dh="TryCatch",zh=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:Dh,setupOnce(){t.setTimeout&&fc($d,"setTimeout",Bh),t.setInterval&&fc($d,"setInterval",Bh),t.requestAnimationFrame&&fc($d,"requestAnimationFrame",Uh),t.XMLHttpRequest&&"XMLHttpRequest"in $d&&fc(XMLHttpRequest.prototype,"send",Vh);const e=t.eventTarget;e&&(Array.isArray(e)?e:jh).forEach(Hh)}}};function Bh(e){return function(...t){const r=t[0];return t[0]=qd(r,{mechanism:{data:{function:Ic(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function Uh(e){return function(t){return e.apply(this,[qd(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Ic(e)},handled:!1,type:"instrument"}})])}}function Vh(e){return function(...t){const r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in r&&"function"==typeof r[e]&&fc(r,e,function(t){const r={mechanism:{data:{function:e,handler:Ic(t)},handled:!1,type:"instrument"}},n=mc(t);return n&&(r.mechanism.data.handler=Ic(n)),qd(t,r)})}),e.apply(this,t)}}function Hh(e){const t=$d,r=t[e]&&t[e].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(fc(r,"addEventListener",function(t){return function(r,n,i){try{"function"==typeof n.handleEvent&&(n.handleEvent=qd(n.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Ic(n),target:e},handled:!1,type:"instrument"}}))}catch{}return t.apply(this,[r,qd(n,{mechanism:{data:{function:"addEventListener",handler:Ic(n),target:e},handled:!1,type:"instrument"}}),i])}}),fc(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)}}))}kd(Dh,zh);const $h=[Dd(),Hd(),zh(),xh(),Fh(),Nh(),_h(),Rh()];function Wh(e={}){void 0===e.defaultIntegrations&&(e.defaultIntegrations=[...$h]),void 0===e.release&&("string"==typeof __SENTRY_RELEASE__&&(e.release=__SENTRY_RELEASE__),$d.SENTRY_RELEASE&&$d.SENTRY_RELEASE.id&&(e.release=$d.SENTRY_RELEASE.id)),void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0);const t={...e,stackParser:kc(e.stackParser||vh),integrations:Cd(e),transport:e.transport||(Yc()?oh:ah)};Od(nh,t),e.autoSessionTracking&&function(){if(typeof $d.document>"u")return void(Yd&&sc.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));Ku({ignoreDuration:!0}),Qu(),au(({from:e,to:t})=>{void 0!==e&&e!==t&&(Ku({ignoreDuration:!0}),Qu())})}()}var Gh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Yh(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 Xh=(e=>(e.INLINE="inline",e.OVERLAY="overlay",e))(Xh||{}),Kh=(e=>(e.TOP="top",e.BOTTOM="bottom",e.HIDDEN="",e))(Kh||{});function Zh(e,t){return{...t,message:e}}const Jh=[{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}],Qh={emoticons:Zh("Emoticons"),doodles:Zh("Doodles"),landmarks:Zh("Landmarks"),bubbles:Zh("Bubbles"),transportation:Zh("Transportation"),beach:Zh("Beach")},ef={fill:"#1565C0",opacity:1,backgroundColor:null,strokeWidth:.05,stroke:"#000"},tf=[1,8,15,20,25];var rf=(e=>(e.DARK="dark",e.LIGHT="light",e))(rf||{});const nf=[{name:rf.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:rf.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 of=(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))(of||{});function af(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=af(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function sf(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=af(e))&&(n&&(n+=" "),n+=t);return n}const lf=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:sf("svg-icon",s,cf(o)),style:{color:l,...c},ref:n,height:f||"1em",width:h||"1em",children:[a&&e("title",{children:a}),u]})});function cf(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 uf(t,r="",n){return i.memo(i.forwardRef((i,o)=>e(lf,{"data-testid":`${r}Icon`,ref:o,viewBox:n,...i,size:i.size||"md",children:t})))}function df(e,t=""){return uf(hf(e),t)}function hf(e){return(null==e?void 0:e.map)&&e.map((e,t)=>i.createElement(e.tag,{key:t,...e.attr},hf(e.child)))}const ff=uf(e("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined"),pf=uf(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"),gf=uf(e("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"}),"CropOutlined"),mf=uf(e("path",{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}),"TextFieldsOutlined"),vf=uf(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"),yf=uf(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"),bf=uf(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"),wf=uf(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"),xf=uf(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"),Cf=uf(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=uf(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"),Sf=uf([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"),kf=uf(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"),Af=uf(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"),If=uf(e("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}),"HomeOutlined"),Ef={[of.FILTER]:{name:Zh("Applied Filters"),icon:ff},[of.RESIZE]:{name:Zh("Resized Image"),icon:pf},[of.CROP]:{name:Zh("Cropped Image"),icon:gf},[of.DRAW]:{name:Zh("Added Drawing"),icon:Af},[of.TEXT]:{name:Zh("Added Text"),icon:mf},[of.SHAPES]:{name:Zh("Added Shape"),icon:vf},[of.STICKERS]:{name:Zh("Added Sticker"),icon:yf},[of.FRAME]:{name:Zh("Added Frame"),icon:bf},[of.MERGE]:{name:Zh("Merged Objects"),icon:wf},[of.CORNERS]:{name:Zh("Rounded Corner"),icon:xf},bgImage:{name:Zh("Replaced Background Image"),icon:Cf},overlayImage:{name:Zh("Added Image"),icon:Cf},initial:{name:Zh("Initial"),icon:If},loadedState:{name:Zh("Loaded State"),icon:_f},objectStyle:{name:Zh("Changed Style"),icon:Sf},deletedObject:{name:Zh("Deleted object"),icon:kf}},Ff=Object.values(of).map(e=>({name:e,icon:Ef[e].icon,action:e===of.MERGE?e=>{e.tools.merge.apply()}:e})),Tf={filter:Zh("filter"),resize:Zh("resize"),crop:Zh("crop"),draw:Zh("draw"),text:Zh("text"),shapes:Zh("shapes"),stickers:Zh("stickers"),frame:Zh("frame"),corners:Zh("corners"),merge:Zh("merge")},Of=uf(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"),Pf="3.0.5",Mf={selector:"pixie-editor",textureSize:4096,activeLanguage:"en",ui:{visible:!0,mode:Xh.INLINE,forceOverlayModeOnMobile:!0,activeTheme:rf.LIGHT,themes:nf,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:Of,label:Zh("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:Kh.BOTTOM,items:[...Ff]},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:{...ef},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:tf,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:Jh},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}}]}}},Rf=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 Lf={exports:{}},Nf={},jf={exports:{}},Df={},zf=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 Bf="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Uf=zf.useState,Vf=zf.useEffect,Hf=zf.useLayoutEffect,$f=zf.useDebugValue;function Wf(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Bf(e,r)}catch{return!0}}var Gf=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,t){var r=t(),n=Uf({inst:{value:r,getSnapshot:t}}),i=n[0].inst,o=n[1];return Hf(function(){i.value=r,i.getSnapshot=t,Wf(i)&&o({inst:i})},[e,r,t]),Vf(function(){return Wf(i)&&o({inst:i}),e(function(){Wf(i)&&o({inst:i})})},[e]),$f(r),r};Df.useSyncExternalStore=void 0!==zf.useSyncExternalStore?zf.useSyncExternalStore:Gf,jf.exports=Df;var qf=jf.exports,Yf=i,Xf=qf;
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 Kf="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Zf=Xf.useSyncExternalStore,Jf=Yf.useRef,Qf=Yf.useEffect,ep=Yf.useMemo,tp=Yf.useDebugValue;Nf.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var o=Jf(null);if(null===o.current){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=ep(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,Kf(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=Zf(e,o[0],o[1]);return Qf(function(){a.hasValue=!0,a.value=s},[s]),tp(s),s},Lf.exports=Nf;const rp=qh(Lf.exports),{useDebugValue:np}=i,{useSyncExternalStoreWithSelector:ip}=rp,op=e=>e;const ap=e=>{const t="function"==typeof e?(e=>e?Rf(e):Rf)(e):e,r=(e,r)=>function(e,t=op,r){const n=ip(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return np(n),n}(t,e,r);return Object.assign(r,t),r},sp=e=>ap,lp=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 cp=Symbol.for("immer-nothing"),up=Symbol.for("immer-draftable"),dp=Symbol.for("immer-state");function hp(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fp=Object.getPrototypeOf;function pp(e){return!!e&&!!e[dp]}function gp(e){var t;return!!e&&(vp(e)||Array.isArray(e)||!!e[up]||!(null==(t=e.constructor)||!t[up])||Cp(e)||_p(e))}var mp=Object.prototype.constructor.toString();function vp(e){if(!e||"object"!=typeof e)return!1;const t=fp(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)===mp}function yp(e,t){0===bp(e)?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function bp(e){const t=e[dp];return t?t.type_:Array.isArray(e)?1:Cp(e)?2:_p(e)?3:0}function wp(e,t){return 2===bp(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function xp(e,t,r){const n=bp(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function Cp(e){return e instanceof Map}function _p(e){return e instanceof Set}function Sp(e){return e.copy_||e.base_}function kp(e,t){if(Cp(e))return new Map(e);if(_p(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=vp(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[dp];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(fp(e),t)}{const t=fp(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function Ap(e,t=!1){return Ep(e)||pp(e)||!gp(e)||(bp(e)>1&&(e.set=e.add=e.clear=e.delete=Ip),Object.freeze(e),t&&Object.entries(e).forEach(([e,t])=>Ap(t,!0))),e}function Ip(){hp(2)}function Ep(e){return Object.isFrozen(e)}var Fp,Tp={};function Op(e){const t=Tp[e];return t||hp(0),t}function Pp(){return Fp}function Mp(e,t){t&&(Op("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Rp(e){Lp(e),e.drafts_.forEach(jp),e.drafts_=null}function Lp(e){e===Fp&&(Fp=e.parent_)}function Np(e){return Fp=function(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(Fp,e)}function jp(e){const t=e[dp];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Dp(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[dp].modified_&&(Rp(t),hp(4)),gp(e)&&(e=zp(t,e),t.parent_||Up(t,e)),t.patches_&&Op("Patches").generateReplacementPatches_(r[dp].base_,e,t.patches_,t.inversePatches_)):e=zp(t,r,[]),Rp(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==cp?e:void 0}function zp(e,t,r){if(Ep(t))return t;const n=t[dp];if(!n)return yp(t,(i,o)=>Bp(e,n,t,i,o,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return Up(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),yp(i,(i,a)=>Bp(e,n,t,i,a,r,o)),Up(e,t,!1),r&&e.patches_&&Op("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function Bp(e,t,r,n,i,o,a){if(pp(i)){const a=zp(e,i,o&&t&&3!==t.type_&&!wp(t.assigned_,n)?o.concat(n):void 0);if(xp(r,n,a),!pp(a))return;e.canAutoFreeze_=!1}else a&&r.add(i);if(gp(i)&&!Ep(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;zp(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&Object.prototype.propertyIsEnumerable.call(r,n)&&Up(e,i)}}function Up(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ap(t,r)}var Vp={get(e,t){if(t===dp)return e;const r=Sp(e);if(!wp(r,t))return function(e,t,r){var n;const i=Wp(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_||!gp(n)?n:n===$p(e.base_,t)?(qp(e),e.copy_[t]=Yp(n,e)):n},has:(e,t)=>t in Sp(e),ownKeys:e=>Reflect.ownKeys(Sp(e)),set(e,t,r){const n=Wp(Sp(e),t);if(null!=n&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=$p(Sp(e),t),i=null==n?void 0:n[dp];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||wp(e.base_,t)))return!0;qp(e),Gp(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!==$p(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,qp(e),Gp(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=Sp(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}},defineProperty(){hp(11)},getPrototypeOf:e=>fp(e.base_),setPrototypeOf(){hp(12)}},Hp={};function $p(e,t){const r=e[dp];return(r?Sp(r):e)[t]}function Wp(e,t){if(!(t in e))return;let r=fp(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=fp(r)}}function Gp(e){e.modified_||(e.modified_=!0,e.parent_&&Gp(e.parent_))}function qp(e){e.copy_||(e.copy_=kp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}yp(Vp,(e,t)=>{Hp[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Hp.deleteProperty=function(e,t){return Hp.set.call(this,e,t,void 0)},Hp.set=function(e,t,r){return Vp.set.call(this,e[0],t,r,e[0])};function Yp(e,t){const r=Cp(e)?Op("MapSet").proxyMap_(e,t):_p(e)?Op("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Pp(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,o=Vp;r&&(i=[n],o=Hp);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return n.draft_=s,n.revoke_=a,s}(e,t);return(t?t.scope_:Pp()).drafts_.push(r),r}function Xp(e){if(!gp(e)||Ep(e))return e;const t=e[dp];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=kp(e,t.scope_.immer_.useStrictShallowCopy_)}else r=kp(e,!0);return yp(r,(e,t)=>{xp(r,e,Xp(t))}),t&&(t.finalized_=!1),r}var Kp=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&&hp(6),void 0!==r&&"function"!=typeof r&&hp(7),gp(e)){const i=Np(this),o=Yp(e,void 0);let a=!0;try{n=t(o),a=!1}finally{a?Rp(i):Lp(i)}return Mp(i,r),Dp(n,i)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===cp&&(n=void 0),this.autoFreeze_&&Ap(n,!0),r){const t=[],i=[];Op("Patches").generateReplacementPatches_(e,n,t,i),r(t,i)}return n}hp(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){gp(e)||hp(8),pp(e)&&(e=function(e){return pp(e)||hp(10),Xp(e)}(e));const t=Np(this),r=Yp(e,void 0);return r[dp].isManual_=!0,Lp(t),r}finishDraft(e,t){const r=e&&e[dp];(!r||!r.isManual_)&&hp(9);const{scope_:n}=r;return Mp(n,t),Dp(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=Op("Patches").applyPatches_;return pp(e)?n(e,t):this.produce(e,e=>n(e,t))}},Zp=Kp.produce;Kp.produceWithPatches.bind(Kp),Kp.setAutoFreeze.bind(Kp),Kp.setUseStrictShallowCopy.bind(Kp),Kp.applyPatches.bind(Kp),Kp.createDraft.bind(Kp),Kp.finishDraft.bind(Kp);var Jp=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===Qp}(e)}(e)};var Qp="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function eg(e,t){return!1!==t.clone&&t.isMergeableObject(e)?og(function(e){return Array.isArray(e)?[]:{}}(e),e,t):e}function tg(e,t,r){return e.concat(t).map(function(e){return eg(e,r)})}function rg(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 ng(e,t){try{return t in e}catch{return!1}}function ig(e,t,r){var n={};return r.isMergeableObject(e)&&rg(e).forEach(function(t){n[t]=eg(e[t],r)}),rg(t).forEach(function(i){(function(e,t){return ng(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(ng(e,i)&&r.isMergeableObject(t[i])?n[i]=function(e,t){if(!t.customMerge)return og;var r=t.customMerge(e);return"function"==typeof r?r:og}(i,r)(e[i],t[i],r):n[i]=eg(t[i],r))}),n}function og(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||tg,r.isMergeableObject=r.isMergeableObject||Jp,r.cloneUnlessOtherwiseSpecified=eg;var n=Array.isArray(t);return n===Array.isArray(e)?n?r.arrayMerge(e,t,r):ig(e,t,r):eg(t,r)}og.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,r){return og(e,r,t)},{})};const ag=qh(og);function sg(e,t){return lg(ag(t,e),e)}function lg(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]&&lg(e[r],null==t?void 0:t[r])}),e}const cg=(e,t)=>({history:{...ug,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??ug}})}}}),ug={items:[],pointer:0,canUndo:!1,canRedo:!1};var dg=(e=>(e.Filter="filter",e.Frame="frame",e.ActiveObject="activeObj",e.Text="text",e))(dg||{});const hg=(e,t)=>({filter:{...fg,select(t,r=!1){e(e=>{e.filter.selected=t,e.activeToolOverlay=r?dg.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,...fg}})}}}),fg={selected:null,applied:[]},pg=(e,t)=>({crop:{...gg,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,...gg}})}}}),gg={zoneRect:null,selectedAspectRatio:null,straightenAngle:0};function mg(e){return"i-text"===(null==e?void 0:e.type)}var vg=(e=>(e.Text="text",e.Shape="shape",e.Sticker="sticker",e.Drawing="drawing",e.Image="image",e.MainImage="mainImage",e.StraightenAnchor="straightenHelper",e))(vg||{});const yg={text:{name:Zh("Text"),icon:Ef.text.icon},shape:{name:Zh("Shape"),icon:Ef.shapes.icon},sticker:{name:Zh("Sticker"),icon:Ef.stickers.icon},drawing:{name:Zh("Drawing"),icon:Ef.draw.icon},image:{name:Zh("Image"),icon:Ef.overlayImage.icon},mainImage:{name:Zh("Background Image"),icon:Ef.bgImage.icon}};const bg={isMoving:!1,editableProps:{},id:null,isText:!1,isImage:!1,name:null};const wg=(e,t)=>({objects:{...xg,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}),mg(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=mg(r),e.objects.active.isImage=function(e){return e.name===vg.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={...bg,editableProps:s}})},reset(){e({objects:{...t().objects,...xg}})}}}),xg={all:[],isEditingText:!1,active:bg},Cg=(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===of.FRAME&&e(e=>{e.activeToolOverlay=dg.Frame})},reset(){e({frame:{...t().frame,..._g}})}}}),_g={active:null},Sg=(e,t)=>({resize:{...kg,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,...kg}})}}}),kg={formValue:{width:1,height:1,maintainAspect:!0,usePercentages:!1}},Ag=(e,t)=>({corners:{...Ig,setRadius:t=>{e(e=>{e.corners.radius=t})},apply:()=>t().editor.tools.corners.apply(t().corners.radius),reset(){e({corners:{...t().corners,...Ig}})}}}),Ig={radius:50},Eg=e=>(t,r,n)=>(n.setState=(e,r,...n)=>{const i="function"==typeof e?Zp(e):e;return t(i,r,...n)},e(n.setState,r,n));var Fg={exports:{}},Tg={exports:{}},Og=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))},Pg=Array.prototype.concat,Mg=Array.prototype.slice,Rg=Tg.exports=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];Og(i)?t=Pg.call(t,Mg.call(i)):t.push(i)}return t};Rg.wrap=function(e){return function(){return e(Rg(arguments))}};var Lg=Tg.exports,Ng={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]},jg=Lg,Dg=Object.hasOwnProperty,zg=Object.create(null);for(var Bg in Ng)Dg.call(Ng,Bg)&&(zg[Ng[Bg]]=Bg);var Ug=Fg.exports={to:{},get:{}};function Vg(e,t,r){return Math.min(Math.max(t,e),r)}function Hg(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}Ug.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=Ug.get.hsl(e),r="hsl";break;case"hwb":t=Ug.get.hwb(e),r="hwb";break;default:t=Ug.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},Ug.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]:Dg.call(Ng,t[1])?((i=Ng[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]=Vg(i[r],0,255);return i[3]=Vg(i[3],0,1),i},Ug.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,Vg(parseFloat(t[2]),0,100),Vg(parseFloat(t[3]),0,100),Vg(isNaN(r)?1:r,0,1)]}return null},Ug.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,Vg(parseFloat(t[2]),0,100),Vg(parseFloat(t[3]),0,100),Vg(isNaN(r)?1:r,0,1)]}return null},Ug.to.hex=function(){var e=jg(arguments);return"#"+Hg(e[0])+Hg(e[1])+Hg(e[2])+(e[3]<1?Hg(Math.round(255*e[3])):"")},Ug.to.rgb=function(){var e=jg(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]+")"},Ug.to.rgb.percent=function(){var e=jg(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]+")"},Ug.to.hsl=function(){var e=jg(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},Ug.to.hwb=function(){var e=jg(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},Ug.to.keyword=function(e){return zg[e.slice(0,3)]};var $g=Fg.exports;const Wg={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]},Gg={};for(const e of Object.keys(Wg))Gg[Wg[e]]=e;const qg={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 Yg=qg;for(const e of Object.keys(qg)){if(!("channels"in qg[e]))throw new Error("missing channels property: "+e);if(!("labels"in qg[e]))throw new Error("missing channel labels property: "+e);if(qg[e].labels.length!==qg[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:r}=qg[e];delete qg[e].channels,delete qg[e].labels,Object.defineProperty(qg[e],"channels",{value:t}),Object.defineProperty(qg[e],"labels",{value:r})}function Xg(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}qg.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]},qg.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]},qg.rgb.hwb=function(e){const t=e[0],r=e[1];let n=e[2];const i=qg.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]},qg.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]},qg.rgb.keyword=function(e){const t=Gg[e];if(t)return t;let r,n=1/0;for(const t of Object.keys(Wg)){const i=Xg(e,Wg[t]);i<n&&(n=i,r=t)}return r},qg.keyword.rgb=function(e){return Wg[e]},qg.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)]},qg.rgb.lab=function(e){const t=qg.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)]},qg.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},qg.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)]},qg.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]}},qg.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]},qg.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]},qg.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))]},qg.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]},qg.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)]},qg.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]},qg.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]},qg.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)]},qg.rgb.ansi16=function(e,t=null){const[r,n,i]=e;let o=null===t?qg.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},qg.hsv.ansi16=function(e){return qg.rgb.ansi16(qg.hsv.rgb(e),e[2])},qg.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)},qg.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]},qg.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]},qg.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},qg.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]},qg.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]},qg.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]},qg.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]},qg.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)]},qg.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]},qg.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]},qg.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)]},qg.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]},qg.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},qg.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},qg.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},qg.gray.hsl=function(e){return[0,0,e[0]]},qg.gray.hsv=qg.gray.hsl,qg.gray.hwb=function(e){return[0,100,e[0]]},qg.gray.cmyk=function(e){return[0,0,0,e[0]]},qg.gray.lab=function(e){return[e[0],0,0]},qg.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},qg.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const Kg=Yg;function Zg(e){const t=function(){const e={},t=Object.keys(Kg);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(Kg[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 Jg(e,t){return function(r){return t(e(r))}}function Qg(e,t){const r=[t[e].parent,e];let n=Kg[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)r.unshift(t[i].parent),n=Jg(Kg[t[i].parent][i],n),i=t[i].parent;return n.conversion=r,n}const em=Yg,tm=function(e){const t=Zg(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]=Qg(e,t))}return r},rm={};Object.keys(em).forEach(e=>{rm[e]={},Object.defineProperty(rm[e],"channels",{value:em[e].channels}),Object.defineProperty(rm[e],"labels",{value:em[e].labels});const t=tm(e);Object.keys(t).forEach(r=>{const n=t[r];rm[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),rm[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 nm=$g,im=rm,om=["keyword","gray","hex"],am={};for(const e of Object.keys(im))am[[...im[e].labels].sort().join("")]=e;const sm={};function lm(e,t){if(!(this instanceof lm))return new lm(e,t);if(t&&t in om&&(t=null),t&&!(t in im))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 lm)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if("string"==typeof e){const t=nm.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,n=im[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=im[this.model].channels;const r=Array.prototype.slice.call(e,0,n);this.color=fm(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 am))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=am[n];const{labels:i}=im[this.model],o=[];for(r=0;r<i.length;r++)o.push(e[i[r]]);this.color=fm(o)}if(sm[this.model])for(n=im[this.model].channels,r=0;r<n;r++){const e=sm[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)}lm.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in nm.to?this:this.rgb();t=t.round("number"==typeof e?e:1);const r=1===t.valpha?t.color:[...t.color,this.valpha];return nm.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 nm.to.rgb.percent(r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=im[this.model],{labels:r}=im[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 lm([...this.color.map(cm(e)),this.valpha],this.model)},alpha(e){return void 0!==e?new lm([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:um("rgb",0,dm(255)),green:um("rgb",1,dm(255)),blue:um("rgb",2,dm(255)),hue:um(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:um("hsl",1,dm(100)),lightness:um("hsl",2,dm(100)),saturationv:um("hsv",1,dm(100)),value:um("hsv",2,dm(100)),chroma:um("hcg",1,dm(100)),gray:um("hcg",2,dm(100)),white:um("hwb",1,dm(100)),wblack:um("hwb",2,dm(100)),cyan:um("cmyk",0,dm(100)),magenta:um("cmyk",1,dm(100)),yellow:um("cmyk",2,dm(100)),black:um("cmyk",3,dm(100)),x:um("xyz",0,dm(95.047)),y:um("xyz",1,dm(100)),z:um("xyz",2,dm(108.833)),l:um("lab",0,dm(100)),a:um("lab",1),b:um("lab",2),keyword(e){return void 0!==e?new lm(e):im[this.model].keyword(this.color)},hex(e){return void 0!==e?new lm(e):nm.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new lm(e);const t=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),nm.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 lm.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 lm.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(im)){if(om.includes(e))continue;const{channels:t}=im[e];lm.prototype[e]=function(...t){return this.model===e?new lm(this):t.length>0?new lm(t,e):new lm([...hm(im[this.model][e].raw(this.color)),this.valpha],e)},lm[e]=function(...r){let n=r[0];return"number"==typeof n&&(n=fm(r,t)),new lm(n,e)}}function cm(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}function um(e,t,r){e=Array.isArray(e)?e:[e];for(const n of e)(sm[n]||(sm[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 dm(e){return function(t){return Math.max(0,Math.min(e,t))}}function hm(e){return Array.isArray(e)?e:[e]}function fm(e,t){for(let r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}const pm=qh(lm);function gm(e){return e.endsWith("%")||3===e.split(" ").length?e:pm(e).rgb().array().slice(0,3).join(" ")}let mm=typeof document<"u"?document.getElementById("root")??document.body:void 0,vm=typeof document<"u"?document.documentElement:void 0;function ym(e){Object.entries(e.values).forEach(([e,t])=>{!function(e,t){null==vm||vm.style.setProperty(e,t)}(e,t)}),e.is_dark?vm.classList.add("dark"):vm.classList.remove("dark")}const bm=sp()(e=>({data:typeof window<"u"&&window.bootstrapData?xm(window.bootstrapData):null,setData:t=>{const r="string"==typeof t?xm(t):t;e({data:r})},mergeData:t=>{e(e=>({data:{...e.data,...t}}))}}));bm.getState().setData;const wm=bm.getState().mergeData;function xm(e){return"string"==typeof e?JSON.parse(e):e}const Cm={top:0,right:0,bottom:0,left:0,width:0,height:0},_m=sp()(lp(Eg((e,t)=>({editor:null,fabric:null,config:Mf,zoom:1,dirty:!1,original:{width:1,height:1},stageSize:Cm,canvasSize:Cm,canvasRef:null,activeTool:null,activeToolOverlay:null,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1},...cg(e,t),...wg(e,t),...hg(e,t),...pg(e,t),...Cg(e,t),...Sg(e,t),...Ag(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=sg(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?nf.find(e=>e.isDark):nf.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,gm(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&&ym(c),wm({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 Sm(){return _m.getState()}function km(){return Sm().editor.tools}function Am(){return Sm().fabric}function Im(e){var t,r,n,i,o;km().canvas.clear(),km().frame.remove();const a=!(null!=(t=Sm().config.ui)&&t.visible);return Sm().setConfig({image:void 0,blankCanvasSize:void 0,...e}),Sm().reset(),null!=(r=Sm().config.ui)&&r.defaultTool&&Sm().setActiveTool(null==(n=Sm().config.ui)?void 0:n.defaultTool,null),a&&(null==(o=(i=Sm().config).onOpen)||o.call(i)),new Promise(e=>setTimeout(e))}async function Em(e){return(await fetch(e)).json()}const Fm={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 Tm(e=[]){var t;e=[...Object.keys(Fm),"crossOrigin","name","displayName","data",...e];const r=Am().toJSON(e);r.objects=r.objects.filter(e=>!e.data.pixieInternal).map(e=>("image"===e.type&&Sm().config.crossOrigin&&(e.crossOrigin="anonymous"),mg(e)&&(e.selectable=!0,e.lockMovementX=!1,e.lockMovementY=!1,e.lockUniScaling=!1),{...e,data:e.data?{...e.data}:{}}));return{canvas:r,editor:{frame:km().frame.active.config?{name:km().frame.active.config.name,sizePercent:km().frame.active.currentSizeInPercent}:null,zoom:Sm().zoom,activeObjectId:(null==(t=Sm().objects.active)?void 0:t.id)||null},canvasWidth:Sm().original.width,canvasHeight:Sm().original.height}}function Om(e=null){if(Sm().dirty)return;km().zoom.fitToScreen();const[t,r]=Pm(Am().getActiveObject());e?Sm().setActiveTool(e,t===e?r:null):Sm().setActiveTool(t,r)}function Pm(e){switch(null==e?void 0:e.name){case vg.Text:return[of.TEXT,dg.Text];case vg.Sticker:return[of.STICKERS,dg.ActiveObject];case vg.Image:return[null,dg.ActiveObject];case vg.Shape:return[of.SHAPES,dg.ActiveObject];default:return[null,null]}}let Mm=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t};class Rm{constructor(e,t){vl(this,"timerId"),vl(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 Lm=sp()(Eg((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)||Mm(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 Rm(()=>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 Nm(){return Lm.getState()}function jm(e,t){Nm().add(e,t)}jm.danger=(e,t)=>{Nm().add(e,{...t,type:"danger"})},jm.positive=(e,t)=>{Nm().add(e,{...t,type:"positive"})},jm.loading=(e,t)=>{Nm().add(e,{...t,type:"loading"})};const Dm=s({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),zm=s({}),Bm=s(null),Um=typeof document<"u",Vm=Um?x:a,Hm=s({strict:!1}),$m=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),Wm="data-"+$m("framerAppearId");function Gm(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function qm(e){return"string"==typeof e||Array.isArray(e)}function Ym(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}const Xm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Km=["initial",...Xm];function Zm(e){return Ym(e.animate)||Km.some(t=>qm(e[t]))}function Jm(e){return!(!Zm(e)&&!e.variants)}function Qm(e){const{initial:t,animate:r}=function(e,t){if(Zm(e)){const{initial:t,animate:r}=e;return{initial:!1===t||qm(t)?t:void 0,animate:qm(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,l(zm));return d(()=>({initial:t,animate:r}),[ev(t),ev(r)])}function ev(e){return Array.isArray(e)?e.join(" "):e}const tv={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"]},rv={};for(const e in tv)rv[e]={isEnabled:t=>tv[e].some(e=>!!t[e])};function nv(e){for(const t in e)rv[t]={...rv[t],...e[t]}}const iv=s({}),ov=s({}),av=Symbol.for("motionComponentSymbol");function sv({preloadedFeatures:e,createVisualElement:t,useRender:r,useVisualState:i,Component:o}){e&&nv(e);const s=p(function(s,d){let h;const f={...l(Dm),...s,layoutId:lv(s)},{isStatic:p}=f,g=Qm(s),m=i(s,p);if(!p&&Um){g.visualElement=function(e,t,r,n){const{visualElement:i}=l(zm),o=l(Hm),s=l(Bm),c=l(Dm).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[Wm]||window.HandoffComplete));return Vm(()=>{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(ov),n=l(Hm).strict;g.visualElement&&(h=g.visualElement.loadFeatures(f,n,e,r))}return n.createElement(zm.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):Gm(r)&&(r.current=n))},[t])}(m,g.visualElement,d),m,p,g.visualElement))});return s[av]=o,s}function lv({layoutId:e}){const t=l(iv).id;return t&&void 0!==e?t+"-"+e:e}const cv=["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 uv(e){return"string"==typeof e&&!e.includes("-")&&!!(cv.indexOf(e)>-1||/[A-Z]/.test(e))}const dv={},hv=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],fv=new Set(hv);function pv(e,{layout:t,layoutId:r}){return fv.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!dv[e]||"opacity"===e)}const gv=e=>!(!e||!e.getVelocity),mv={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},vv=hv.length;const yv=e=>t=>"string"==typeof t&&t.startsWith(e),bv=yv("--"),wv=yv("var(--"),xv=(e,t)=>t&&"number"==typeof e?t.transform(e):e,Cv=(e,t,r)=>Math.min(Math.max(r,e),t),_v={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},Sv={..._v,transform:e=>Cv(0,1,e)},kv={..._v,default:1},Av=e=>Math.round(1e5*e)/1e5,Iv=/(-)?([\d]*\.?[\d])+/g,Ev=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Fv=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Tv(e){return"string"==typeof e}const Ov=e=>({test:t=>Tv(t)&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Pv=Ov("deg"),Mv=Ov("%"),Rv=Ov("px"),Lv=Ov("vh"),Nv=Ov("vw"),jv={...Mv,parse:e=>Mv.parse(e)/100,transform:e=>Mv.transform(100*e)},Dv={..._v,transform:Math.round},zv={borderWidth:Rv,borderTopWidth:Rv,borderRightWidth:Rv,borderBottomWidth:Rv,borderLeftWidth:Rv,borderRadius:Rv,radius:Rv,borderTopLeftRadius:Rv,borderTopRightRadius:Rv,borderBottomRightRadius:Rv,borderBottomLeftRadius:Rv,width:Rv,maxWidth:Rv,height:Rv,maxHeight:Rv,size:Rv,top:Rv,right:Rv,bottom:Rv,left:Rv,padding:Rv,paddingTop:Rv,paddingRight:Rv,paddingBottom:Rv,paddingLeft:Rv,margin:Rv,marginTop:Rv,marginRight:Rv,marginBottom:Rv,marginLeft:Rv,rotate:Pv,rotateX:Pv,rotateY:Pv,rotateZ:Pv,scale:kv,scaleX:kv,scaleY:kv,scaleZ:kv,skew:Pv,skewX:Pv,skewY:Pv,distance:Rv,translateX:Rv,translateY:Rv,translateZ:Rv,x:Rv,y:Rv,z:Rv,perspective:Rv,transformPerspective:Rv,opacity:Sv,originX:jv,originY:jv,originZ:Rv,zIndex:Dv,fillOpacity:Sv,strokeOpacity:Sv,numOctaves:Dv};function Bv(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(bv(e)){o[e]=r;continue}const n=zv[e],d=xv(r,n);if(fv.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<vv;t++){const r=hv[t];void 0!==e[r]&&(o+=`${mv[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 Uv=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Vv(e,t,r){for(const n in t)!gv(t[n])&&!pv(n,r)&&(e[n]=t[n])}function Hv(e,t,r){const n={};return Vv(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t,r){return d(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return Bv(n,t,{enableHardwareAcceleration:!r},e),Object.assign({},n.vars,n.style)},[t])}(e,t,r)),e.transformValues?e.transformValues(n):n}function $v(e,t,r){const n={},i=Hv(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 Wv=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 Gv(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Wv.has(e)}let qv=e=>!Gv(e);try{!function(e){e&&(qv=t=>t.startsWith("on")?!Gv(t):e(t))}(require("@emotion/is-prop-valid").default)}catch{}function Yv(e,t,r){const n={};for(const i in e)"values"===i&&"object"==typeof e.values||(qv(i)||!0===r&&Gv(i)||!t&&!Gv(i)||e.draggable&&i.startsWith("onDrag"))&&(n[i]=e[i]);return n}function Xv(e,t,r){return"string"==typeof e?e:Rv.transform(t+r*e)}const Kv={offset:"stroke-dashoffset",array:"stroke-dasharray"},Zv={offset:"strokeDashoffset",array:"strokeDasharray"};function Jv(e,{attrX:t,attrY:r,attrScale:n,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...c},u,d,h){if(Bv(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`${Xv(t,e.x,e.width)} ${Xv(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?Kv:Zv;e[o.offset]=Rv.transform(-n);const a=Rv.transform(t),s=Rv.transform(r);e[o.array]=`${a} ${s}`}(f,a,s,l,!1)}const Qv=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}}),ey=e=>"string"==typeof e&&"svg"===e.toLowerCase();function ty(e,t,r,n){const i=d(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Jv(r,t,{enableHardwareAcceleration:!1},ey(n),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const t={};Vv(t,e.style,e),i.style={...t,...i.style}}return i}function ry(e=!1){return(t,r,n,{latestValues:i},o)=>{const a=(uv(t)?ty:$v)(r,i,o,t),s={...Yv(r,"string"==typeof t,e),...a,ref:n},{children:l}=r,c=d(()=>gv(l)?l.get():l,[l]);return h(t,{...s,children:c})}}function ny(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 iy=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 oy(e,t,r,n){ny(e,t,void 0,n);for(const r in t.attrs)e.setAttribute(iy.has(r)?r:$m(r),t.attrs[r])}function ay(e,t){const{style:r}=e,n={};for(const i in r)(gv(r[i])||t.style&&gv(t.style[i])||pv(i,e))&&(n[i]=r[i]);return n}function sy(e,t){const r=ay(e,t);for(const n in e)if(gv(e[n])||gv(t[n])){r[-1!==hv.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]}return r}function ly(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 cy(e){const t=u(null);return null===t.current&&(t.current=e()),t.current}const uy=e=>Array.isArray(e),dy=e=>uy(e)?e[e.length-1]||0:e;function hy(e){const t=gv(e)?e.get():e;return(e=>!!(e&&"object"==typeof e&&e.mix&&e.toValue))(t)?t.toValue():t}const fy=e=>(t,r)=>{const n=l(zm),i=l(Bm),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:r},n,i,o){const a={latestValues:py(n,i,o,e),renderState:t()};return r&&(a.mount=e=>r(n,e,a)),a}(e,t,n,i);return r?o():cy(o)};function py(e,t,r,n){const i={},o=n(e,{});for(const e in o)i[e]=hy(o[e]);let{initial:a,animate:s}=e;const l=Zm(e),c=Jm(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&&!Ym(d)&&(Array.isArray(d)?d:[d]).forEach(t=>{const r=ly(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 gy=e=>e;class my{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 vy=["prepare","read","update","preRender","render","postRender"];const{schedule:yy,cancel:by,state:wy}=function(e,t){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=vy.reduce((e,t)=>(e[t]=function(e){let t=new my,r=new my,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,vy.forEach(a),i.isProcessing=!1,r&&t&&(n=!1,e(s))};return{schedule:vy.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=>vy.forEach(t=>o[t].cancel(e)),state:i,steps:o}}(typeof requestAnimationFrame<"u"?requestAnimationFrame:gy,!0),xy={useVisualState:fy({scrapeMotionValuesFromProps:sy,createRenderState:Qv,onMount:(e,t,{renderState:r,latestValues:n})=>{yy.read(()=>{try{r.dimensions="function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),yy.render(()=>{Jv(r,n,{enableHardwareAcceleration:!1},ey(t.tagName),e.transformTemplate),oy(t,r)})}})},Cy={useVisualState:fy({scrapeMotionValuesFromProps:ay,createRenderState:Uv})};function _y(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}function Sy(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}function ky(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,Sy(t)))(r),n)}const Ay=(e,t)=>r=>t(e(r)),Iy=(...e)=>e.reduce(Ay);function Ey(e){let t=null;return()=>null===t&&(t=e,()=>{t=null})}const Fy=Ey("dragHorizontal"),Ty=Ey("dragVertical");function Oy(){const e=function(){let e=!1;{const t=Fy(),r=Ty();t&&r?e=()=>{t(),r()}:(t&&t(),r&&r())}return e}();return!e||(e(),!1)}class Py{constructor(e){this.isMounted=!1,this.node=e}update(){}}function My(e,t){const r="pointer"+(t?"enter":"leave"),n="onHover"+(t?"Start":"End");return ky(e.current,r,(r,i)=>{if("touch"===r.pointerType||Oy())return;const o=e.getProps();e.animationState&&o.whileHover&&e.animationState.setActive("whileHover",t),o[n]&&yy.update(()=>o[n](r,i))},{passive:!e.getProps()[n]})}const Ry=(e,t)=>!!t&&(e===t||Ry(e,t.parentElement));function Ly(e,t){if(!t)return;const r=new PointerEvent("pointer"+e);t(r,Sy(r))}const Ny=new WeakMap,jy=new WeakMap,Dy=e=>{const t=Ny.get(e.target);t&&t(e)},zy=e=>{e.forEach(Dy)};function By(e,t,r){const n=function({root:e,...t}){const r=e||document;jy.has(r)||jy.set(r,{});const n=jy.get(r),i=JSON.stringify(t);return n[i]||(n[i]=new IntersectionObserver(zy,{root:e,...t})),n[i]}(t);return Ny.set(e,r),n.observe(e),()=>{Ny.delete(e),n.unobserve(e)}}const Uy={some:0,all:1};const Vy={inView:{Feature:class extends Py{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:Uy[n]};return By(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 Py{constructor(){super(...arguments),this.removeStartListeners=gy,this.removeEndListeners=gy,this.removeAccessibleListeners=gy,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),n=ky(window,"pointerup",(e,t)=>{if(!this.checkPressEnd())return;const{onTap:r,onTapCancel:n,globalTapTarget:i}=this.node.getProps();yy.update(()=>{i||Ry(this.node.current,e.target)?r&&r(e,t):n&&n(e,t)})},{passive:!(r.onTap||r.onPointerUp)}),i=ky(window,"pointercancel",(e,t)=>this.cancelPress(e,t),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Iy(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()||Ly("up",(e,t)=>{const{onTap:r}=this.node.getProps();r&&yy.update(()=>r(e,t))})}),Ly("down",(e,t)=>{this.startPress(e,t)})}),t=_y(this.node.current,"blur",()=>{this.isPressing&&Ly("cancel",(e,t)=>this.cancelPress(e,t))});this.removeAccessibleListeners=Iy(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&&yy.update(()=>r(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Oy()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&yy.update(()=>r(e,t))}mount(){const e=this.node.getProps(),t=ky(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=_y(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Iy(t,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Py{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=Iy(_y(this.node.current,"focus",()=>this.onFocus()),_y(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends Py{mount(){this.unmount=Iy(My(this.node,!0),My(this.node,!1))}unmount(){}}}};function Hy(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 $y(e,t,r){const n=e.getProps();return ly(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 Wy=gy;const Gy=e=>1e3*e,qy=e=>e/1e3,Yy=!1,Xy=e=>Array.isArray(e)&&"number"==typeof e[0];function Ky(e){return!!(!e||"string"==typeof e&&Jy[e]||Xy(e)||Array.isArray(e)&&e.every(Ky))}const Zy=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,Jy={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Zy([0,.65,.55,1]),circOut:Zy([.55,0,1,.45]),backIn:Zy([.31,.01,.66,-.59]),backOut:Zy([.33,1.53,.69,.99])};function Qy(e){if(e)return Xy(e)?Zy(e):Array.isArray(e)?e.map(Qy):Jy[e]}const eb=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function tb(e,t,r,n){if(e===t&&r===n)return gy;const i=t=>function(e,t,r,n,i){let o,a,s=0;do{a=t+(r-t)/2,o=eb(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:eb(i(e),t,n)}const rb=tb(.42,0,1,1),nb=tb(0,0,.58,1),ib=tb(.42,0,.58,1),ob=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,ab=e=>t=>1-e(1-t),sb=e=>1-Math.sin(Math.acos(e)),lb=ab(sb),cb=ob(sb),ub=tb(.33,1.53,.69,.99),db=ab(ub),hb=ob(db),fb={linear:gy,easeIn:rb,easeInOut:ib,easeOut:nb,circIn:sb,circInOut:cb,circOut:lb,backIn:db,backInOut:hb,backOut:ub,anticipate:e=>(e*=2)<1?.5*db(e):.5*(2-Math.pow(2,-10*(e-1)))},pb=e=>{if(Array.isArray(e)){Wy(4===e.length);const[t,r,n,i]=e;return tb(t,r,n,i)}return"string"==typeof e?fb[e]:e},gb=(e,t)=>r=>!!(Tv(r)&&Fv.test(r)&&r.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(r,t)),mb=(e,t,r)=>n=>{if(!Tv(n))return n;const[i,o,a,s]=n.match(Iv);return{[e]:parseFloat(i),[t]:parseFloat(o),[r]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},vb={..._v,transform:e=>Math.round((e=>Cv(0,255,e))(e))},yb={test:gb("rgb","red"),parse:mb("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+vb.transform(e)+", "+vb.transform(t)+", "+vb.transform(r)+", "+Av(Sv.transform(n))+")"};const bb={test:gb("#"),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:yb.transform},wb={test:gb("hsl","hue"),parse:mb("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+Mv.transform(Av(t))+", "+Mv.transform(Av(r))+", "+Av(Sv.transform(n))+")"},xb={test:e=>yb.test(e)||bb.test(e)||wb.test(e),parse:e=>yb.test(e)?yb.parse(e):wb.test(e)?wb.parse(e):bb.parse(e),transform:e=>Tv(e)?e:e.hasOwnProperty("red")?yb.transform(e):wb.transform(e)},Cb=(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 Sb=(e,t,r)=>{const n=e*e;return Math.sqrt(Math.max(0,r*(t*t-n)+n))},kb=[bb,yb,wb];function Ab(e){const t=(e=>kb.find(t=>t.test(e)))(e);let r=t.parse(e);return t===wb&&(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 Ib=(e,t)=>{const r=Ab(e),n=Ab(t),i={...r};return e=>(i.red=Sb(r.red,n.red,e),i.green=Sb(r.green,n.green,e),i.blue=Sb(r.blue,n.blue,e),i.alpha=Cb(r.alpha,n.alpha,e),yb.transform(i))};const Eb={regex:/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,countKey:"Vars",token:"${v}",parse:gy},Fb={regex:Ev,countKey:"Colors",token:"${c}",parse:xb.parse},Tb={regex:Iv,countKey:"Numbers",token:"${n}",parse:_v.parse};function Ob(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 Pb(e){const t=e.toString(),r={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return r.value.includes("var(--")&&Ob(r,Eb),Ob(r,Fb),Ob(r,Tb),r}function Mb(e){return Pb(e).values}function Rb(e){const{values:t,numColors:r,numVars:n,tokenised:i}=Pb(e),o=t.length;return e=>{let t=i;for(let i=0;i<o;i++)t=i<n?t.replace(Eb.token,e[i]):i<n+r?t.replace(Fb.token,xb.transform(e[i])):t.replace(Tb.token,Av(e[i]));return t}}const Lb=e=>"number"==typeof e?0:e;const Nb={test:function(e){var t,r;return isNaN(e)&&Tv(e)&&((null===(t=e.match(Iv))||void 0===t?void 0:t.length)||0)+((null===(r=e.match(Ev))||void 0===r?void 0:r.length)||0)>0},parse:Mb,createTransformer:Rb,getAnimatableNone:function(e){const t=Mb(e);return Rb(e)(t.map(Lb))}},jb=(e,t)=>r=>`${r>0?t:e}`;function Db(e,t){return"number"==typeof e?r=>Cb(e,t,r):xb.test(e)?Ib(e,t):e.startsWith("var(")?jb(e,t):Ub(e,t)}const zb=(e,t)=>{const r=[...e],n=r.length,i=e.map((e,r)=>Db(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=i[t](e);return r}},Bb=(e,t)=>{const r={...e,...t},n={};for(const i in r)void 0!==e[i]&&void 0!==t[i]&&(n[i]=Db(e[i],t[i]));return e=>{for(const t in n)r[t]=n[t](e);return r}},Ub=(e,t)=>{const r=Nb.createTransformer(t),n=Pb(e),i=Pb(t);return n.numVars===i.numVars&&n.numColors===i.numColors&&n.numNumbers>=i.numNumbers?Iy(zb(n.values,i.values),r):jb(e,t)},Vb=(e,t,r)=>{const n=t-e;return 0===n?1:(r-e)/n},Hb=(e,t)=>r=>Cb(e,t,r);function $b(e,t,r){const n=[],i=r||function(e){return"number"==typeof e?Hb:"string"==typeof e?xb.test(e)?Ib:Ub:Array.isArray(e)?zb:"object"==typeof e?Bb:Hb}(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]||gy:t;o=Iy(e,o)}n.push(o)}return n}function Wb(e,t,{clamp:r=!0,ease:n,mixer:i}={}){const o=e.length;if(Wy(o===t.length),1===o)return()=>t[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=$b(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=Vb(e[r],e[r+1],t);return a[r](n)};return r?t=>l(Cv(e[0],e[o-1],t)):l}function Gb(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const i=Vb(0,t,n);e.push(Cb(r,1,i))}}(t,e.length-1),t}function qb(e,t){return e.map(()=>t||ib).splice(0,e.length-1)}function Yb({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const i=(e=>Array.isArray(e)&&"number"!=typeof e[0])(n)?n.map(pb):pb(n),o={done:!1,value:t[0]},a=function(e,t){return e.map(e=>e*t)}(r&&r.length===t.length?r:Gb(t),e),s=Wb(a,t,{ease:Array.isArray(i)?i:qb(t,i)});return{calculatedDuration:e,next:t=>(o.value=s(t),o.done=t>=e,o)}}function Xb(e,t){return t?e*(1e3/t):0}function Kb(e,t,r){const n=Math.max(t-5,0);return Xb(r-e(n),t-n)}const Zb=.001;function Jb({duration:e=800,bounce:t=.25,velocity:r=0,mass:n=1}){let i,o,a=1-t;a=Cv(.05,1,a),e=Cv(.01,10,qy(e)),a<1?(i=t=>{const n=t*a,i=n*e,o=n-r,s=ew(t,a),l=Math.exp(-i);return Zb-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=ew(Math.pow(t,2),a);return(-i(t)+Zb>0?-1:1)*((o-s)*l)/c}):(i=t=>Math.exp(-t*e)*((t-r)*e+1)-Zb,o=t=>Math.exp(-t*e)*(e*e*(r-t)));const s=function(e,t,r){let n=r;for(let r=1;r<Qb;r++)n-=e(n)/t(n);return n}(i,o,5/e);if(e=Gy(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 Qb=12;function ew(e,t){return e*Math.sqrt(1-t*t)}const tw=["duration","bounce"],rw=["stiffness","damping","mass"];function nw(e,t){return t.some(t=>void 0!==e[t])}function iw({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(!nw(e,rw)&&nw(e,tw)){const r=Jb(e);t={...t,...r,mass:1},t.isResolvedFromDuration=!0}return t}({...n,velocity:-qy(n.velocity||0)}),f=d||0,p=l/(2*Math.sqrt(s*c)),g=o-i,m=qy(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=ew(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?Kb(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 ow({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=iw({keyframes:[h.value,f(h.value)],velocity:Kb(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 aw=e=>{const t=({timestamp:t})=>e(t);return{start:()=>yy.update(t,!0),stop:()=>by(t),now:()=>wy.isProcessing?wy.timestamp:performance.now()}};function sw(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 lw={decay:ow,inertia:ow,tween:Yb,keyframes:Yb,spring:iw};function cw({autoplay:e=!0,delay:t=0,driver:r=aw,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=lw[i]||Yb;let w;b!==Yb&&"number"!=typeof n[0]&&(w=Wb([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,k=null,A=null;null===x.calculatedDuration&&o&&(x.calculatedDuration=sw(x));const{calculatedDuration:I}=x;let E=1/0,F=1/0;null!==I&&(E=I+a,F=E*(o+1)-a);let T=0;const O=e=>{if(null===k)return;g>0&&(k=Math.min(k,e)),g<0&&(k=Math.min(e-F/g,k)),T=null!==S?S:Math.round(e-k)*g;const r=T-t*(g>=0?1:-1),i=g>=0?r<0:r>F;T=Math.max(r,0),"finished"===_&&null===S&&(T=F);let l=T,c=x;if(o){const e=Math.min(T,F)/E;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/E)):"mirror"===s&&(c=C)),l=Cv(0,1,r)*E}const u=i?{done:!1,value:n[0]}:c.next(l);w&&(u.value=w(u.value));let{done:h}=u;!i&&null!==I&&(h=g>=0?T>=F:T<=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(),k=A=null},R=()=>{_="finished",u&&u(),P(),f()},L=()=>{if(m)return;y||(y=r(O));const e=y.now();l&&l(),null!==S?k=e-S:(!k||"finished"===_)&&(k=e),"finished"===_&&v(),A=k,S=null,_="running",y.start()};e&&L();const N={then:(e,t)=>p.then(e,t),get time(){return qy(T)},set time(e){e=Gy(e),T=e,null===S&&y&&0!==g?k=y.now()-e/g:S=e},get duration(){const e=null===x.calculatedDuration?sw(x):x.calculatedDuration;return qy(e)},get speed(){return g},set speed(e){e===g||!y||(g=e,N.time=qy(T))},get state(){return _},play:L,pause:()=>{_="paused",S=T},stop:()=>{m=!0,"idle"!==_&&(_="idle",c&&c(),M())},cancel:()=>{null!==A&&O(A),M()},complete:()=>{_="finished"},sample:e=>(k=0,O(e))};return N}const uw=function(e){let t;return()=>(void 0===t&&(t=e()),t)}(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),dw=new Set(["opacity","clipPath","filter","transform","backgroundColor"]);function hw(e,t,{onUpdate:r,onComplete:n,...i}){if(!uw()||!dw.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||!Ky(t.ease))(t,i)){const e=cw({...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=Qy(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,yy.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,gy),get time(){return qy(p.currentTime||0)},set time(e){p.currentTime=Gy(e)},get speed(){return p.playbackRate},set speed(e){p.playbackRate=e},get duration(){return qy(d)},play:()=>{s||(p.play(),by(g))},pause:()=>p.pause(),stop:()=>{if(s=!0,"idle"===p.playState)return;const{currentTime:t}=p;if(t){const r=cw({...i,autoplay:!1});e.setWithVelocity(r.sample(t-10).value,r.sample(t).value,10)}m()},complete:()=>{l||p.finish()},cancel:m}}const fw={type:"spring",stiffness:500,damping:25,restSpeed:10},pw={type:"keyframes",duration:.8},gw={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},mw=(e,{keyframes:t})=>t.length>2?pw:fv.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):fw:gw,vw=(e,t)=>"zIndex"!==e&&!("number"!=typeof t&&!Array.isArray(t)&&("string"!=typeof t||!Nb.test(t)&&"0"!==t||t.startsWith("url("))),yw=new Set(["brightness","contrast","saturate","opacity"]);function bw(e){const[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=r.match(Iv)||[];if(!n)return e;const i=r.replace(n,"");let o=yw.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+i+")"}const ww=/([a-z-]*)\(.*?\)/g,xw={...Nb,getAnimatableNone:e=>{const t=e.match(ww);return t?t.map(bw).join(" "):e}},Cw={...zv,color:xb,backgroundColor:xb,outlineColor:xb,fill:xb,stroke:xb,borderColor:xb,borderTopColor:xb,borderRightColor:xb,borderBottomColor:xb,borderLeftColor:xb,filter:xw,WebkitFilter:xw},_w=e=>Cw[e];function Sw(e,t){let r=_w(e);return r!==xw&&(r=Nb),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const kw=e=>/^0[^.\s]+$/.test(e);function Aw(e){return"number"==typeof e?0===e:null!==e?"none"===e||"0"===e||kw(e):void 0}function Iw(e,t){return e[t]||e.default||e}const Ew=!1,Fw=(e,t,r,n={})=>i=>{const o=Iw(n,e)||{},a=o.delay||n.delay||0;let{elapsed:s=0}=n;s-=Gy(a);const l=function(e,t,r,n){const i=vw(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]),Aw(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]]=Sw(t,s);return o}(t,e,r,o),c=l[0],u=l[l.length-1],d=vw(e,c),h=vw(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,...mw(e,f)}),f.duration&&(f.duration=Gy(f.duration)),f.repeatDelay&&(f.repeatDelay=Gy(f.repeatDelay)),!d||!h||Yy||!1===o.type||Ew)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:gy,pause:gy,stop:gy,then:e=>(e(),Promise.resolve()),cancel:gy,complete:gy});return t?cw({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=hw(t,e,f);if(r)return r}return cw(f)};function Tw(e){return!(!gv(e)||!e.add)}const Ow=e=>/^\-?\d*\.?\d+$/.test(e);class Pw{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 Mw{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}=wy;this.lastUpdated!==n&&(this.timeDelta=r,this.lastUpdated=n,yy.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=()=>yy.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 Pw);const r=this.events[e].add(t);return"change"===e?()=>{r(),yy.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?Xb(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 Rw(e,t){return new Mw(e,t)}const Lw=e=>t=>t.test(e),Nw=[_v,Rv,Mv,Pv,Nv,Lv,{test:e=>"auto"===e,parse:e=>e}],jw=e=>Nw.find(Lw(e)),Dw=[...Nw,xb,Nb],zw=e=>Dw.find(Lw(e));function Bw(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Rw(r))}function Uw(e,t){return t?(t[e]||t.default||t).from:void 0}function Vw({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}function Hw(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 $w(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&&Vw(u,t))continue;const a={delay:r,elapsed:0,...Iw(o||{},t)};if(window.HandoffAppearAnimations){const r=e.getProps()[Wm];if(r){const e=window.HandoffAppearAnimations(r,t,n,yy);null!==e&&(a.elapsed=e,a.isHandoff=!0)}}let d=!a.isHandoff&&!Hw(n,i);if("spring"===a.type&&(n.getVelocity()||a.velocity)&&(d=!1),n.animation&&(d=!1),d)continue;n.start(Fw(t,n,i,e.shouldReduceMotion&&fv.has(t)?{type:!1}:a));const h=n.animation;Tw(l)&&(l.add(t),h.then(()=>l.remove(t))),c.push(h)}return a&&Promise.all(c).then(()=>{a&&function(e,t){const r=$y(e,t);let{transitionEnd:n={},transition:i={},...o}=r?e.makeTargetAnimatable(r,!1):{};o={...o,...n};for(const t in o)Bw(e,t,dy(o[t]))}(e,a)}),c}function Ww(e,t,r={}){const n=$y(e,t,r.custom);let{transition:i=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);const o=n?()=>Promise.all($w(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(Gw).forEach((e,n)=>{e.notify("AnimationStart",t),a.push(Ww(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 Gw(e,t){return e.sortNodePosition(t)}const qw=[...Xm].reverse(),Yw=Xm.length;function Xw(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=>Ww(e,t,r));n=Promise.all(i)}else if("string"==typeof t)n=Ww(e,t,r);else{const i="function"==typeof t?$y(e,t,r.custom):t;n=Promise.all($w(e,i,r))}return n.then(()=>e.notify("AnimationComplete",t))}(e,t,r)))}function Kw(e){let t=Xw(e);const r={animate:Jw(!0),whileInView:Jw(),whileHover:Jw(),whileTap:Jw(),whileDrag:Jw(),whileFocus:Jw(),exit:Jw()};let n=!0;const i=(t,r)=>{const n=$y(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<Yw;t++){const f=qw[t],p=r[f],g=void 0!==s[f]?s[f]:l[f],m=qm(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||Ym(g)||"boolean"==typeof g)continue;let b=Zw(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},k=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=uy(t)&&uy(r)?!Hy(t,r):t!==r,n?void 0!==t?k(e):u.add(e):void 0!==t&&u.has(e)?k(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 Zw(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!Hy(t,e)}function Jw(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}let Qw=0;const ex={animation:{Feature:class extends Py{constructor(e){super(e),e.animationState||(e.animationState=Kw(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),Ym(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 Py{constructor(){super(...arguments),this.id=Qw++}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 tx=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function rx(e,t,r=1){const[n,i]=function(e){const t=tx.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 Ow(e)?parseFloat(e):e}return wv(i)?rx(i,t,r+1):i}const nx=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),ix=e=>nx.has(e),ox=e=>e===_v||e===Rv,ax=(e,t)=>parseFloat(e.split(", ")[t]),sx=(e,t)=>(r,{transform:n})=>{if("none"===n||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/);if(i)return ax(i[1],t);{const t=n.match(/^matrix\((.+)\)$/);return t?ax(t[1],e):0}},lx=new Set(["x","y","z"]),cx=hv.filter(e=>!lx.has(e));const ux={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:sx(4,13),y:sx(5,14)};ux.translateX=ux.x,ux.translateY=ux.y;const dx=(e,t,r={},n={})=>{t={...t},n={...n};const i=Object.keys(t).filter(ix);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=jw(c);const d=t[i];let h;if(uy(d)){const e=d.length,t=null===d[0]?1:0;c=d[t],u=jw(c);for(let r=t;r<e&&null!==d[r];r++)h?Wy(jw(d[r])===h):h=jw(d[r])}else h=jw(d);if(u!==h)if(ox(u)&&ox(h)){const e=l.get();"string"==typeof e&&l.set(parseFloat(e)),"string"==typeof d?t[i]=parseFloat(d):Array.isArray(d)&&h===Rv&&(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 cx.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]=ux[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]=ux[r](l,o)}),e})(t,e,s);return o.length&&o.forEach(([t,r])=>{e.getValue(t).set(r)}),e.render(),Um&&null!==r&&window.scrollTo({top:r}),{target:i,transitionEnd:n}}return{target:t,transitionEnd:n}};function hx(e,t,r,n){return(e=>Object.keys(e).some(ix))(t)?dx(e,t,r,n):{target:t,transitionEnd:n}}const fx=(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(!wv(t))return;const r=rx(t,n);r&&e.set(r)});for(const e in t){const i=t[e];if(!wv(i))continue;const o=rx(i,n);o&&(t[e]=o,r||(r={}),void 0===r[e]&&(r[e]=i))}return{target:t,transitionEnd:r}}(e,t,n);return hx(e,t=i.target,r,n=i.transitionEnd)},px={current:null},gx={current:!1};const mx=new WeakMap,vx=Object.keys(rv),yx=vx.length,bx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],wx=Km.length;class xx{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=()=>yy.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=Zm(t),this.isVariantNode=Jm(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]&&gv(t)&&(t.set(a[e],!1),Tw(l)&&l.add(e))}}scrapeMotionValuesFromProps(e,t){return{}}mount(e){this.current=e,mx.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)),gx.current||function(){if(gx.current=!0,Um)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>px.current=e.matches;e.addListener(t),t()}else px.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||px.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){mx.delete(this.current),this.projection&&this.projection.unmount(),by(this.notifyUpdate),by(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=fv.has(e),n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&yy.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<yx;e++){const r=vx[e],{isEnabled:n,Feature:i,ProjectionNode:s,MeasureLayout:l}=rv[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&&Gm(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<bx.length;t++){const r=bx[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(gv(o))e.addValue(i,o),Tw(n)&&n.add(i);else if(gv(a))e.addValue(i,Rw(o,{owner:e})),Tw(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,Rw(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<wx;e++){const r=Km[e],n=this.props[r];(qm(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=Rw(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=ly(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||gv(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 Pw),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class Cx extends xx{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=Uw(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&&(Ow(c)||kw(c))?c=parseFloat(c):!zw(c)&&Nb.test(l)&&(c=Sw(a,l)),e.addValue(a,Rw(c,{owner:e})),void 0===r[a]&&(r[a]=c),null!==c&&e.setBaseTarget(a,c))}}(this,r,o);const e=fx(this,r,o,t);t=e.transitionEnd,r=e.target}return{transition:e,transitionEnd:t,...r}}}class _x extends Cx{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,t){if(fv.has(t)){const e=_w(t);return e&&e.default||0}{const r=function(e){return window.getComputedStyle(e)}(e),n=(bv(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){Bv(e,t,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,t){return ay(e,t)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;gv(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}renderInstance(e,t,r,n){ny(e,t,r,n)}}class Sx extends Cx{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(fv.has(t)){const e=_w(t);return e&&e.default||0}return t=iy.has(t)?t:$m(t),e.getAttribute(t)}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(e,t){return sy(e,t)}build(e,t,r,n){Jv(e,t,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,r,n){oy(e,t,0,n)}mount(e){this.isSVGTag=ey(e.tagName),super.mount(e)}}const kx=function(e){function t(t,r={}){return sv(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{...uv(e)?xy:Cy,preloadedFeatures:r,useRender:ry(t),createVisualElement:n,Component:e}});function Ax(){const e=u(!1);return Vm(()=>(e.current=!0,()=>{e.current=!1}),[]),e}class Ix 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 Ex({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(Ix,{isPresent:t,childRef:i,sizeRef:o},n.cloneElement(e,{ref:i}))}const Fx=({children:e,initial:t,isPresent:r,onExitComplete:i,custom:o,presenceAffectsLayout:a,mode:s})=>{const l=cy(Tx),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(Ex,{isPresent:r},e)),n.createElement(Bm.Provider,{value:u},e)};function Tx(){return new Map}const Ox=e=>e.key||"";const Px=({children:e,custom:t,initial:r=!0,onExitComplete:i,exitBeforeEnter:s,presenceAffectsLayout:d=!0,mode:h="sync"})=>{const f=l(iv).forceRender||function(){const e=Ax(),[t,r]=o(0),n=c(()=>{e.current&&r(t+1)},[t]);return[c(()=>yy.postRender(n),[n]),t]}()[0],p=Ax(),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(Vm(()=>{_.current=!1,function(e,t){e.forEach(e=>{const r=Ox(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(Fx,{key:Ox(e),isPresent:!0,initial:!!r&&void 0,presenceAffectsLayout:d,mode:h},e)));y=[...y];const S=x.current.map(Ox),k=g.map(Ox),A=S.length;for(let e=0;e<A;e++){const t=S[e];-1===k.indexOf(t)&&!b.has(t)&&b.set(t,void 0)}return"wait"===h&&b.size&&(y=[]),b.forEach((e,r)=>{if(-1!==k.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=>!k.includes(e));if(e.forEach(e=>C.delete(e)),x.current=g.filter(t=>{const n=Ox(t);return n===r||e.includes(n)}),!b.size){if(!1===p.current)return;f(),i&&i()}};s=n.createElement(Fx,{key:Ox(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(Fx,{key:Ox(e),isPresent:!0,presenceAffectsLayout:d,mode:h},e)}),n.createElement(n.Fragment,null,b.size?y:y.map(e=>w(e)))};function Mx({children:e,features:t,strict:r=!1}){const[,i]=o(!Rx(t)),s=u(void 0);if(!Rx(t)){const{renderer:e,...r}=t;s.current=e,nv(r)}return a(()=>{Rx(t)&&t().then(({renderer:e,...t})=>{nv(t),s.current=e,i(!0)})},[]),n.createElement(Hm.Provider,{value:{renderer:s.current,strict:r}},e)}function Rx(e){return"function"==typeof e}const Lx={renderer:(e,t)=>uv(e)?new Sx(t,{enableHardwareAcceleration:!1}):new _x(t,{enableHardwareAcceleration:!0}),...ex,...Vy},Nx=typeof document<"u"?i.useLayoutEffect:()=>{},jx=i.createContext(!1);function Dx(){return!1}function zx(){return!0}function Bx(e){return()=>{}}function Ux(){return"function"==typeof i.useSyncExternalStore?i.useSyncExternalStore(Bx,Dx,zx):l(jx)}i.useId;let Vx=new Map;function Hx(e,t){if(e===t)return e;let r=Vx.get(e);if(r)return r(t),t;let n=Vx.get(t);return n?(n(e),e):t}function $x(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}const Wx=e=>{var t;return null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document},Gx=e=>e&&"window"in e&&e.window===e?e:Wx(e).defaultView||window;function qx(...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]=$x(r,i):"className"!==e&&"UNSAFE_className"!==e||"string"!=typeof r||"string"!=typeof i?"id"===e&&r&&i?t.id=Hx(r,i):t[e]=void 0!==i?i:r:t[e]=sf(r,i)}}return t}function Yx(e){if(function(){if(null==Xx){Xx=!1;try{document.createElement("div").focus({get preventScroll(){return Xx=!0,!0}})}catch{}}return Xx}())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 Xx=null;function Kx(){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 Zx(){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 Jx=new Map,Qx=new Set;function eC(){if(typeof window>"u")return;function e(e){return"propertyName"in e}let t=r=>{if(!e(r)||!r.target)return;let n=Jx.get(r.target);if(n&&(n.delete(r.propertyName),0===n.size&&(r.target.removeEventListener("transitioncancel",t),Jx.delete(r.target)),0===Jx.size)){for(let e of Qx)e();Qx.clear()}};document.body.addEventListener("transitionrun",r=>{if(!e(r)||!r.target)return;let n=Jx.get(r.target);n||(n=new Set,Jx.set(r.target,n),r.target.addEventListener("transitioncancel",t,{once:!0})),n.add(r.propertyName)}),document.body.addEventListener("transitionend",t)}function tC(){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 rC(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?eC():document.addEventListener("DOMContentLoaded",eC));let nC=typeof document<"u"&&window.visualViewport;function iC(){return{width:nC&&(null==nC?void 0:nC.width)||window.innerWidth,height:nC&&(null==nC?void 0:nC.height)||window.innerHeight}}function oC(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 aC(e,t=-1/0,r=1/0){return Math.min(Math.max(e,t),r)}function sC(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 lC(e,t,r=10){const n=Math.pow(r,t);return Math.round(e*n)/n}var cC={};const uC=Yh(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 uC.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=uC.implForWrapper,t.nodeCanvas=uC.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 k=_*n*v/a,A=-_*a*m/n,I=f*k-h*A+.5*e,E=h*k+f*A+.5*r,F=o(1,0,(m-k)/n,(v-A)/a),T=o((m-k)/n,(v-A)/a,(-m-k)/n,(-v-A)/a);0===l&&T>0?T-=2*u:1===l&&T<0&&(T+=2*u);for(var O=Math.ceil(Math.abs(T/u*2)),P=[],M=T/O,R=8/3*Math.sin(M/4)*Math.sin(M/4)/Math.sin(M/2),L=F+M,N=0;N<O;N++)P[N]=i(F,L,f,h,n,a,I,E,R,p,g),p=P[N][5],g=P[N][6],F=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 k=1,A=m.length;k<A;k+=_)c.push([b].concat(m.slice(k,k+_))),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 k=0;k<2;++k)if(k>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 A,I,E,F=_.length,T=F;F--;)A=(E=1-(p=_[F]))*E*E*r+3*E*E*p*i+3*E*p*p*a+p*p*p*l,S[0][F]=A,I=E*E*E*n+3*E*E*p*o+3*E*p*p*s+p*p*p*c,S[1][F]=I;S[0][T]=r,S[1][T]=n,S[0][T+1]=l,S[1][T+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 k(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 A(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),k=t.original,A=S/(Math.abs(l.x*k.scaleX/f.scaleX)+Math.abs(l.y*k.scaleY/f.scaleY));a=k.scaleX*A,s=k.scaleY*A}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 I=f.scaleX,E=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)),I!==f.scaleX||E!==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 A(e,t,r,n)})),i.scalingX=w("scaling",b(function(e,t,r,n){return A(e,t,r,n,{by:"x"})})),i.scalingY=w("scaling",b(function(e,t,r,n){return A(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(k))(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,k,A,I,E,F,T,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),I=0,E=0,F=0,T=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)),(k=w[P][M])>0&&(I+=k,E+=k*u[A=4*(R*t+S)],F+=k*u[A+1],T+=k*u[A+2],O+=k*u[A+3]))}h[A=4*(_*s+l)]=E/I,h[A+1]=F/I,h[A+2]=T/I,h[A+3]=O/I}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,k=0,A=(m+.5)*u,I=n(m*u);I<(m+1)*u;I++)for(var E=o(A-(I+.5))/h,F=(v+.5)*c,T=E*E,O=n(v*c);O<(v+1)*c;O++){var P=o(F-(O+.5))/d,M=i(T+P*P);M>1&&M<-1||(b=2*M*M*M-3*M*M+1)>0&&(k+=b*f[(P=4*(O+I*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]=k/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 k=0,A=l.length;k<A;k++)if(f=this.__charBounds[_][k],p=this.getValueOfPropertyAt(_,k,t),m=this.getValueOfPropertyAt(_,k,"fill"),i=this.getHeightOfChar(_,k),s=this.getValueOfPropertyAt(_,k,"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 I=y+o+d;"rtl"===this.direction&&(I=this.width-I-h),c&&v&&(e.fillStyle=v,e.fillRect(I,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;I=y+o+d;"rtl"===this.direction&&(I=this.width-I-h),e.fillStyle=m,p&&m&&e.fillRect(I,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"})}}()}(cC);const dC={lockScalingFlip:!0,originY:"center",originX:"center",lockMovementX:!0,lockMovementY:!0,borderColor:"transparent"};function hC(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 fC=null;function pC(e){fC=e}class gC{constructor(){vl(this,"maxZoom",2),vl(this,"minZoom",1),vl(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=Sm().config)?void 0:e.tools)?void 0:t.zoom)?void 0:r.allowUserZoom)??!0}get currentZoom(){return Sm().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=El.round(Sm().original.width*e,0),n=El.round(Sm().original.height*e,0);Am().setZoom(e),t&&Am().setDimensions({width:r,height:n}),Sm().setZoom(e)}fitToScreen(){var e,t;if(null==(t=null==(e=Sm().config.tools)?void 0:e.zoom)||!t.fitImageToScreen)return;const{width:r,height:n}=Sm().stageSize,i=Math.max(n,1),o=Math.max(r,1);if(Sm().original.height>i||Sm().original.width>o){const e=Math.min(i/Sm().original.height,o/Sm().original.width);this.minZoom=Math.min(e,1)}else this.minZoom=1;this.set(this.minZoom)}bindMouseWheel(){Am().on("mouse:wheel",e=>{e.e.preventDefault(),e.e.stopPropagation(),null==fC&&(e.e.deltaY<0?this.zoomIn():this.zoomOut())})}}function mC(e){return new Promise(t=>{cC.fabric.util.loadImage(e,e=>t(new cC.fabric.Image(e)),null,Sm().config.crossOrigin?"anonymous":void 0)})}function vC(){return!(Sm().config.image||Sm().config.blankCanvasSize||Am()&&0!==Am().getObjects().length)}class yC{constructor(){vl(this,"minWidth",50),vl(this,"minHeight",50)}resize(e,t,{applyZoom:r=!1,resizeHelper:n=!0}={}){const i=Sm().zoom;Am().setWidth(e*(r?i:1)),Am().setHeight(t*(r?i:1)),Sm().setOriginal(e,t),n&&km().transform.resetStraightenAnchor()}async addMainImage(e,t="mainImage"){var r,n;Sm().toggleLoading(t);const i=await mC(e);if(i)return this.clear(),i.set(Fm),i.name=vg.MainImage,Am().add(i),this.resize(i.width,i.height),i.center(),i.setCoords(),km().zoom.fitToScreen(),Sm().toggleLoading(!1),null==(n=(r=Sm().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),Am().backgroundColor=r,km().zoom.fitToScreen(),Sm().toggleLoading("newCanvas"),requestAnimationFrame(()=>{Sm().toggleLoading(!1)}),Promise.resolve({width:e,height:t})}getMainImage(){return Am().getObjects().find(e=>e.name===vg.MainImage)}render(){Am().requestRenderAll()}async loadInitialContent(){var e,t;const r=Sm().config.image,n=Sm().config.blankCanvasSize,i=Sm().config.state;if(r&&r.endsWith("json")){const e=await Em(r);await km().import.loadState(e)}else r&&r.startsWith('{"canvas')?await km().import.loadState(r):r?await this.addMainImage(r):i?await km().import.loadState(i):n&&await this.openNew(n.width,n.height);return vC()&&null!=(t=null==(e=Sm().config.ui)?void 0:e.openImageDialog)&&t.show&&Sm().togglePanel("newImage",!0),new Promise(e=>{setTimeout(()=>{km().history.addInitial(),e()},10)})}clear(){Am().clear(),km().frame.remove(),km().transform.resetStraightenAnchor()}}const bC=["fontSize","fontFamily","left","top","width","height","scaleX","scaleY","flipX","flipY","angle","src","strokeWidth"];function wC(e={}){Am().fire("object:modified",function(e){return{values:e,sizeOrPositionChanged:xC(e)}}(e))}function xC(e){return Object.keys(e).some(e=>bC.includes(e))}function CC(e){var t,r;const[n]=Pm(null==(t=e.selected)?void 0:t[0]),i=n===Sm().activeTool;return!(!Sm().dirty||null!=(r=e.selected)&&r[0]&&i)&&(e.deselected&&km().objects.select(e.deselected[0]),!0)}function _C(e){(null==e?void 0:e.data.id)!==Sm().objects.active.id&&(Sm().objects.setActive(e??null),Sm().activeTool!==of.DRAW&&Om())}class SC{constructor(){this.syncObjects(),Sm().fabric.on("selection:created",e=>{var t;null!=(t=e.selected)&&t[0]&&!CC(e)&&_C(e.selected[0])}),Sm().fabric.on("selection:updated",e=>{var t;CC(e)||_C(null==(t=e.selected)?void 0:t[0])}),Sm().fabric.on("selection:cleared",()=>{_C()}),Sm().fabric.on("text:editing:entered",()=>{Sm().objects.setIsEditingText(!0)}),Sm().fabric.on("text:editing:exited",()=>{Sm().objects.setIsEditingText(!1)}),Sm().fabric.on("object:added",()=>{this.syncObjects()}),Sm().fabric.on("object:removed",()=>{this.syncObjects()})}getAll(){return Am().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=Sm().objects.active)?void 0:t.id)===r}getActive(){return Am().getActiveObject()}has(e){return this.getAll().findIndex(t=>t.name===e)>-1}select(e){const t="string"==typeof e?this.getById(e):e;t&&(Am().setActiveObject(t),Am().requestRenderAll())}deselectActive(){Am().discardActiveObject(),Am().requestRenderAll()}setValues(e,t){if(!(t=t||this.getActive()))return;let r=!1;(function(e){return e.name===vg.Sticker&&"forEachObject"in e})(t)&&e.fill&&e.fill!==t.fill&&t.forEachObject(t=>t.set("fill",e.fill)),mg(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(()=>{Am().requestRenderAll()},50):Am().requestRenderAll(),Sm().objects.setActive(t),wC(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}),km().canvas.render())}bringToFront(e){(e=e||this.getActive())&&(e.bringToFront(),km().canvas.render())}sendToBack(e){(e=e||this.getActive())&&(e.sendToBack(),km().canvas.render())}flipHorizontally(e){(e=e||this.getActive())&&(this.setValues({flipX:!e.flipX}),km().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:hC(10)},name:t.name}),Am().add(e),this.select(e),km().canvas.render()}))}delete(e){(e=e||this.getActive())&&(this.deselectActive(),Am().remove(e),Am().requestRenderAll(),km().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:{...Sm().objects,all:e}})}}const kC={frame:null,fonts:[]};function AC(e){return e.state||(e.state=Tm()),{...e.state||Tm(),name:e.name,id:hC(15)}}function IC(e){return!!e&&/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(e)}function EC(e){return e?IC(e)?e:`${Sm().config.baseUrl?`${Sm().config.baseUrl}/`:""}${e}`:""}function FC(e,t){return t||btoa(e.split("/").pop())}const TC=new class{constructor(){vl(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:IC(e)?e:`assets/${e}`,id:FC(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=FC(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=FC(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 OC(e){return`be-fonts-${e}`}function PC(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=TC.loadAsset(`https://fonts.googleapis.com/css?family=${i}&display=swap`,{type:"css",id:OC(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 MC{async undo(){if(this.canUndo()){const e=Sm().history.items[Sm().history.pointer-1];await this.load(e)}}async redo(){if(this.canRedo()){const e=Sm().history.items[Sm().history.pointer+1];await this.load(e)}}canUndo(){return Sm().history.canUndo}canRedo(){return Sm().history.canRedo}reload(){return this.load(Sm().history.items[Sm().history.pointer])}replaceCurrent(){const e=Sm().history.items[Sm().history.pointer];[...Sm().history.items][Sm().history.pointer]=AC({name:e.name,state:e})}addHistoryItem(e){const t=AC(e),r=[...Sm().history.items.slice(0,Sm().history.pointer+1),t];Sm().history.update(r.length-1,r)}load(e){return e={...e,editor:e.editor||kC},new Promise(t=>{PC(function(e){const t=[];return e.forEach(e=>{var r,n,i;if(!mg(e))return;const o=null==(i=null==(n=null==(r=Sm().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:EC,id:"pixie-fonts"}).finally(()=>{Am().loadFromJSON(e.canvas,()=>{km().zoom.set(1),e.canvasWidth&&e.canvasHeight&&km().canvas.resize(e.canvasWidth,e.canvasHeight,{resizeHelper:!1,applyZoom:!1}),km().frame.remove(),e.editor.frame&&km().frame.add(e.editor.frame.name,e.editor.frame.sizePercent),km().objects.syncObjects(),km().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({...dC}),"i-text"===e.type&&(e.padding=null==(r=null==(t=Sm().config.tools)?void 0:t.text)?void 0:r.controlsPadding)}),km().canvas.render(),Am().calcOffset(),km().zoom.fitToScreen(),Sm().history.updatePointerById(e.id),km().transform.resetStraightenAnchor(),t()})})})}addInitial(e){!Sm().history.items.find(e=>"initial"===e.name)&&(e||!vC())&&this.addHistoryItem({name:"initial",state:e})}}class RC{canMerge(){return km().objects.getAll().filter(e=>e.name!==vg.MainImage).length>0}async apply(){Sm().toggleLoading("merge");const e=km().export.getDataUrl();e&&await km().canvas.addMainImage(e,"merge")}}const LC=[{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"}}}],NC={grayscale:Zh("grayscale"),blackWhite:Zh("Black & White"),sharpen:Zh("Sharpen"),invert:Zh("Invert"),vintage:Zh("Vintage"),polaroid:Zh("Polaroid"),kodachrome:Zh("Kodachrome"),technicolor:Zh("Technicolor"),brownie:Zh("Brownie"),sepia:Zh("Sepia"),removeColor:Zh("Remove Color"),brightness:Zh("Brightness"),gamma:Zh("Gamma"),noise:Zh("Noise"),pixelate:Zh("Pixelate"),blur:Zh("Blur"),emboss:Zh("Emboss"),blendColor:Zh("Blend Color")},jC={distance:Zh("distance"),color:Zh("color"),brightness:Zh("brightness"),red:Zh("red"),green:Zh("green"),blue:Zh("blue"),noise:Zh("noise"),blocksize:Zh("blocksize"),mode:Zh("mode"),alpha:Zh("alpha")};function DC(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}class zC{constructor(){_m.subscribe(e=>e.history.pointer,()=>{this.syncState()})}apply(e){Sm().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(),km().canvas.render()}remove(e){Sm().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(),km().canvas.render()}getAll(){return LC}getByName(e){return LC.find(t=>t.name===e)}isApplied(e){const t=km().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())}),km().canvas.render()}addCustom(e,t,r,n){const i=cC.fabric.Image.filters;i[DC(e)]=cC.fabric.util.createClass(i.BaseFilter,t),i[DC(e)].fromObject=i.BaseFilter.fromObject,LC.push({name:e,options:r,initialConfig:n})}create(e){const t=e.initialConfig||{};let r;return e.uses?(t.matrix=e.matrix,r=new(cC.fabric.Image.filters[DC(e.uses)])(t)):(Object.entries(e.options||{}).forEach(([e,r])=>{t[e]=r.current}),r=new(cC.fabric.Image.filters[DC(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:{...Sm().filter,applied:t}})}getByFabricFilter(e){return LC.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 km().objects.getAll().filter(e=>e.name===vg.Image||e.name===vg.MainImage)}}function BC(e){var t,r;const n=(null==(r=null==(t=Sm().config.tools)?void 0:t.resize)?void 0:r.minWidth)||50;return e?Math.ceil(100*n/Sm().original.width):n}function UC(e){var t,r;const n=(null==(r=null==(t=Sm().config.tools)?void 0:t.resize)?void 0:r.maxWidth)||2400;return e?Math.ceil(100*n/Sm().original.width):n}function VC(e){var t,r;const n=(null==(r=null==(t=Sm().config.tools)?void 0:t.resize)?void 0:r.minHeight)||50;return e?Math.ceil(100*n/Sm().original.height):n}function HC(e){var t,r;const n=(null==(r=null==(t=Sm().config.tools)?void 0:t.resize)?void 0:r.maxHeight)||2400;return e?Math.ceil(100*n/Sm().original.height):n}function $C(e,t){if(t)return e;const r=Sm().original.height/e;return Math.floor(Sm().original.width/r)}function WC(e,t){if(t)return e;const r=Sm().original.width/e;return Math.floor(Sm().original.height/r)}class GC{apply(e){const{width:t,height:r,usePercentages:n}=function(e){return e.width<BC(e.usePercentages)&&(e.width=BC(e.usePercentages),e.maintainAspect&&(e.height=WC(e.width,e.usePercentages))),e.width>UC(e.usePercentages)&&(e.width=UC(e.usePercentages),e.maintainAspect&&(e.height=WC(e.width,e.usePercentages))),e.height<VC(e.usePercentages)&&(e.height=VC(e.usePercentages),e.maintainAspect&&(e.width=$C(e.height,e.usePercentages))),e.height>HC(e.usePercentages)&&(e.height=HC(e.usePercentages),e.maintainAspect&&(e.width=$C(e.height,e.usePercentages))),e}(e),i=Math.ceil(Sm().original.width),o=Math.ceil(Sm().original.height),a=Math.ceil(t),s=Math.ceil(r);let l,c;n?(l=t/100,c=r/100):(l=t/Sm().original.width,c=r/Sm().original.height),(i!==a||o!==s)&&this.resize(l,c)}resize(e,t){km().zoom.set(1,!1);const r=Math.round(Sm().original.height*t),n=Math.round(Sm().original.width*e);km().canvas.resize(n,r,{applyZoom:!1,resizeHelper:!0}),km().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()}),km().zoom.fitToScreen(),Am().requestRenderAll()}}function qC(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=Sm().canvasSize.width,n=Sm().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 YC(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 XC(e){if(!e)return null;const t=e.split(":");return parseInt(t[0])/parseInt(t[1])}class KC{constructor(){vl(this,"refs",null)}apply(e){var t;const r=null==(t=km().frame.active.config)?void 0:t.name,n=km().frame.active.currentSizeInPercent;return km().frame.active.hide(),km().merge.apply().then(()=>{km().canvas.resize(Math.round(e.width),Math.round(e.height),{applyZoom:!0,resizeHelper:!0});const t=km().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&&km().frame.add(r,n),km().zoom.fitToScreen(),km().canvas.render()})}drawZone(e){var t;null!=(t=this.refs)&&t.current&&(Sm().crop.setCropzoneRect(e),qC(e,this.refs.current))}resetCropzone(e){const t=Sm().canvasSize,r=XC(e);if(!t)return;Sm().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=YC(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 ZC{getShapeByName(e){var t,r;const n=null==(r=null==(t=Sm().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=Sm().config.objectDefaults)?void 0:t.shape)||{},a={...o,...r.options};let s;if("circle"===r.name)s=new cC.fabric.Circle({...a,radius:100});else if("ellipse"===r.name)s=new cC.fabric.Ellipse({...a,rx:100,ry:50});else if("Path"===r.type)s=new cC.fabric.Path(a.path,{displayName:r.name,...a});else{const e=r.type;s=new cC.fabric[e]({...a,width:150,height:150})}return this.addAndPositionShape(s,vg.Shape,{width:n,height:i}),s}addSticker(e,t){var r,n,i;const o=null==(i=null==(n=null==(r=Sm().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=JC(o,t);return this.addSvgSticker(e)}return this.addRegularSticker(o,t)}addRegularSticker(e,t){return new Promise(r=>{cC.fabric.util.loadImage(JC(e,t),e=>{var t;const{width:n,height:i,...o}=(null==(t=Sm().config.objectDefaults)?void 0:t.sticker)||{},a=new cC.fabric.Image(e,o);this.addAndPositionShape(a,vg.Sticker,{width:n,height:i}),r()})})}addSvgSticker(e,t=vg.Sticker){return new Promise(r=>{cC.fabric.loadSVGFromURL(e,(e,n)=>{var i;const{width:o,height:a,...s}=(null==(i=Sm().config.objectDefaults)?void 0:i.sticker)||{},l=cC.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,Am().add(e);const n=r||Sm().original.width*Sm().zoom/4;e.scaleToWidth(Math.min(150,n)),e.viewportCenter(),e.setCoords(),km().canvas.render(),Am().setActiveObject(e)}}function JC(e,t){return EC(`images/stickers/${e.name}/${t}.${e.type}`)}class QC{constructor(e){vl(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 cC.fabric.StaticCanvas(null),e.canvas.add(e.img);const r=new cC.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/=Am().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()}))}),km().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={...Fm,originX:"left",originY:"top"};Sm().config.crossOrigin&&(n.crossOrigin="anonymous"),cC.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 EC(`images/frames/${e.name}/${t}.png`)}}class e_{constructor(e,t){this.activeFrame=e,this.patterns=t}get defaultColor(){var e,t;return null==(t=null==(e=Sm().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),km().canvas.render()}):km().canvas.render()}createParts(e){const t={};this.activeFrame.getPartNames().forEach(r=>{const n="basic"===e.mode?this.defaultColor:void 0;t[r]=new cC.fabric.Rect({...Fm,fill:n,originX:"left",originY:"top",name:`frame.rect.${r}`,objectCaching:!1,data:{pixieInternal:!0}}),Am().add(t[r])}),this.activeFrame.parts=t}resize(e){const t=Sm().original.width,r=Sm().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 t_{constructor(){vl(this,"corners",["topLeft","topRight","bottomLeft","bottomRight"]),vl(this,"sides",["top","right","bottom","left"]),vl(this,"parts",null),vl(this,"config",null),vl(this,"currentSizeInPercent",100)}getPartNames(){return[...this.corners,...this.sides]}hide(){this.parts&&(Object.values(this.parts).forEach(e=>e.set({visible:!1})),km().canvas.render())}show(){this.parts&&(Object.values(this.parts).forEach(e=>e.set({visible:!0})),km().canvas.render())}remove(){this.parts&&(this.config=null,Object.values(this.parts).forEach(e=>{Am().remove(e)}),this.parts=null,km().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)}),km().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 r_{constructor(){vl(this,"patterns"),vl(this,"builder"),vl(this,"active"),this.active=new t_,this.patterns=new QC(this.active),this.builder=new e_(this.active,this.patterns),Am().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),Sm().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),km().canvas.render()}changeColor(e){this.active.changeColor(e)}remove(){this.active.remove(),Sm().frame.deselect()}getByName(e){var t,r;const n=null==(r=null==(t=Sm().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(Sm().original.width,Sm().original.height);return Math.ceil(e/100*t)}}class n_{constructor(){vl(this,"minWidth",250)}add(e,t={}){var r,n,i,o,a;if(!(e=e||(null==(n=null==(r=Sm().config.tools)?void 0:r.text)?void 0:n.defaultText)))return;const s={...null==(i=Sm().config.objectDefaults)?void 0:i.text,...t,name:vg.Text,padding:null==(a=null==(o=Sm().config.tools)?void 0:o.text)?void 0:a.controlsPadding,editingBorderColor:ef.fill},l=new cC.fabric.IText(e,s);Am().add(l),null==t.left&&null==t.top&&this.autoPositionText(l),km().objects.select(l)}autoPositionText(e){const t=Am().getWidth(),r=Am().getHeight(),n=Math.min(Am().getWidth(),this.minWidth);e.scaleToWidth(Math.max(t/3,n)),e.getScaledHeight()>r&&e.scaleToHeight(r-e.getScaledHeight()-20),e.viewportCenter(),Am().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>Sm().original.height-t.getScaledHeight()&&(n=0),e.set("top",n),e.setCoords()}})}selectOrAddText(e,t={}){if(Sm().objects.active.isText)return!1;const r=km().objects.getAll().find(e=>mg(e));return r?(km().objects.select(r),!1):(this.add(e,t),!0)}}const i_=e=>{const t=new cC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=cC.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},o_=e=>{const t=new cC.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},a_=e=>{const t=new cC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=this.width/2,t=document.createElement("canvas"),r=new cC.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},s_=e=>{const t=new cC.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 l_,c_;class u_{constructor(){vl(this,"customBrushes",{VLineBrush:i_,HLineBrush:o_,DiamondBrush:a_,SquareBrush:s_}),vl(this,"currentBrush",{type:"PencilBrush",color:null==(c_=null==(l_=Sm().config.objectDefaults)?void 0:l_.global)?void 0:c_.fill,width:tf[1]}),vl(this,"onPathCreated",e=>{e.path.name=vg.Drawing,e.path.set(function(){const e={...Fm};return delete e.strokeWidth,e}()),Sm().setDirty(!0)})}enable(){Am().on("path:created",this.onPathCreated),Am().isDrawingMode=!0,this.setBrushType(this.currentBrush.type),this.setBrushSize(this.currentBrush.width)}disable(){Am().off("path:created",this.onPathCreated),Am().isDrawingMode=!1}getBrushType(){return this.currentBrush.type}setBrushType(e){this.currentBrush.type=e,Am().freeDrawingBrush=e in cC.fabric?new cC.fabric[e](Am()):this.customBrushes[e](Am()),this.applyBrushStyles()}applyBrushStyles(){Object.keys(this.currentBrush).forEach(e=>{Am().freeDrawingBrush[e]=this.currentBrush[e]});const e=Am().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 d_(e,t=!0,r=!0){const n=await mC(e);if(n)return new Promise(e=>{n.name=vg.Image,n.opacity=0;const i=Sm().original.width,o=Sm().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}Sm().fabric.add(n),r&&Sm().fabric.setActiveObject(n),n.viewportCenter(),n.setCoords(),Sm().fabric.requestRenderAll(),km().zoom.fitToScreen(),n.animate("opacity","1",{duration:425,onChange:()=>{Sm().fabric.requestRenderAll()},onComplete:()=>{e(n)}})})}function h_(e){var t;return(null==(t=/(?:\.([^.]+))?$/.exec(e))?void 0:t[1])||""}class f_{constructor(e,t){vl(this,"id"),vl(this,"fingerprint"),vl(this,"name"),vl(this,"relativePath",""),vl(this,"size"),vl(this,"mime",""),vl(this,"extension",""),vl(this,"native"),vl(this,"lastModified"),vl(this,"cachedData"),this.id=Mm(),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?h_(e.name):null;return e.type?e.type:r&&r in t?t[r]:"application/octet-stream"}(e),this.lastModified=e.lastModified,this.extension=h_(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+=`-${p_(e.toLowerCase())}`),t&&(o+=`-${t}`),"string"==typeof n&&(o+=`-${p_(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 p_(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}function g_(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 f_(e));t(i),r.remove()},document.body.appendChild(r),r.click()})}var m_=(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))(m_||{});function v_(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 y_(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}y_.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 b_=function(e,t,r){var n=new y_(e,r||/[\/\.]/);return typeof t<"u"?n.match(t):n},w_=/[\/\+\.]/,x_=function(e,t){function r(t){var r=b_(t,e,w_);return r&&r.length>=2}return t?r(t.split(";")[0]):r};const C_=qh(x_);function __(e,t){return t.map(e=>e.split(",")).flat().some(t=>{if(t.includes("/"))return!!e.mime&&C_(e.mime.replace(/;.*?$/,""),t);const r=t.replace(".","").toLowerCase();return!(!r||!e.extension)&&e.extension.toLowerCase()===r})}class S_{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(k_);e&&await this.loadState(await e.data)}async addImageFromUrl(e,t=!0){var r,n;await d_(e,(null==(n=null==(r=Sm().config.tools)?void 0:r.import)?void 0:n.fitOverlayToScreen)??!0,t),km().history.addHistoryItem({name:"overlayImage"})}async addImageFromData(e,t=!0){var r,n;await d_(e,(null==(n=null==(r=Sm().config.tools)?void 0:r.import)?void 0:n.fitOverlayToScreen)??!0,t),km().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 km().shape.addSvgSticker(r,vg.Image),km().history.addHistoryItem({name:"overlayImage"});break;default:await this.addImageFromData(r,t)}}async loadState(e){let t;Sm().toggleLoading("state"),await Im(),t="string"==typeof e?e.endsWith(".json")?await Em(e):JSON.parse(e):e,t.history?Sm().history.reset(t.history):await km().history.addInitial(t),await km().history.reload(),Sm().toggleLoading(!1)}async openUploadWindow(e){var t,r;e=e||function(){var e,t;const r=null==(t=null==(e=Sm().config.tools)?void 0:e.import)?void 0:t.validImgExtensions;return r?{extensions:r}:{types:[m_.image]}}();const n=(await g_(e))[0];return this.fileIsValid(n)?(null==(r=(t=Sm().config).onFileOpen)||r.call(t,n),n):null}async openBackgroundImage(e){let t;await Im(),t=e instanceof HTMLImageElement?e.src:e instanceof f_?await e.data:e;const r=await km().canvas.addMainImage(t);return await km().history.addInitial(),r}fileIsValid(e){var t,r,n,i;const o=(null==(r=null==(t=Sm().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?Zh("`:file` exceeds maximum allowed size of :size",{values:{file:e.name,size:v_(r)}}):null!=n&&n.length&&!__(e,n)||null!=i&&i.length&&__(e,i)?Zh("This file type is not allowed"):void 0}(e,{maxFileSize:o,allowedFileTypes:[...(null==(i=null==(n=Sm().config.tools)?void 0:n.import)?void 0:i.validImgExtensions)??[],"json"]});return!a||(jm.danger(a),!1)}}const k_={types:[".json",m_.json]};class A_{constructor(){vl(this,"watermark",null),vl(this,"lineStyle",{stroke:"rgba(255,255,255,0.3)",strokeWidth:5,strokeLineCap:"round",strokeLineJoin:"round"})}add(e){this.createGroup(),this.addText(e),this.addLines(),Am().add(this.watermark),km().canvas.render()}remove(){this.watermark&&(Am().remove(this.watermark),this.watermark=null,km().canvas.render())}createGroup(){this.watermark=new cC.fabric.Group(void 0,{...Fm,width:Sm().original.width,height:Sm().original.height,excludeFromExport:!0,top:0,left:0,originX:"left",originY:"top"})}addText(e){var t;const r=new cC.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(Sm().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=Sm().original.width/2,n=Sm().original.height/2,i=100,o=t.width/4,a=new cC.fabric.Line(void 0,this.lineStyle),s=new cC.fabric.Line(void 0,this.lineStyle),l=new cC.fabric.Line(void 0,this.lineStyle),c=new cC.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 I_={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 Gh&&Gh.global===Gh?Gh: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}()}(I_);var E_=I_.exports;class F_{save(e,t,r){var n,i,o;const a=null==(n=Sm().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(km().watermark.remove(),l)if(Sm().config.saveUrl)fetch(Sm().config.saveUrl,{method:"POST",body:JSON.stringify({data:l,filename:s,format:t})});else if(Sm().config.onSave)null==(o=(i=Sm().config).onSave)||o.call(i,l,s,t);else{const e=this.getCanvasBlob(t,l);E_.saveAs(e,s)}}getDataUrl(e,t){try{return"svg"===e?Am().toSVG():Am().toDataURL({format:this.getFormat(e),quality:this.getQuality(t),multiplier:Math.max(Sm().original.width/Am().width,Sm().original.height/Am().height)})}catch(e){e.message.toLowerCase().includes("tainted")&&jm.danger(Zh("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({...Tm(),history:Sm().history})}applyWaterMark(){const e=Sm().config.watermarkText;e&&km().watermark.add(e)}getFormat(e){var t;const r=null==(t=Sm().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=Sm().config.tools)?void 0:t.export;return e=e||(null==r?void 0:r.defaultQuality)||.8}}class T_{constructor(){vl(this,"previewRect",null)}async apply(e){this.previewRect||this.showPreview(),this.updatePreview(e),Am().remove(this.previewRect),Am().clipPath=this.previewRect;const t=km().export.getDataUrl();t&&km().canvas.clear(),this.hidePreview(),t&&await km().canvas.addMainImage(t),Am().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}),km().canvas.render())}showPreview(){const e=.04*Sm().original.width;this.previewRect=new cC.fabric.Rect({width:Sm().original.width,height:Sm().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}),Am().add(this.previewRect),this.previewRect.moveTo(99),this.previewRect.viewportCenter(),km().canvas.render()}hidePreview(){this.previewRect&&(Am().remove(this.previewRect),km().canvas.render(),this.previewRect=null)}}class O_{get straightenAnchor(){return Am().getObjects().find(e=>e.name===vg.StraightenAnchor)}rotateLeft(){this.rotateFixed(-90)}rotateRight(){this.rotateFixed(90)}straighten(e){this.storeObjectsRelationToHelper(),km().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";km().objects.getAll().forEach(e=>{e[t]=!e[t]}),km().canvas.render()}rotateFixed(e){km().zoom.set(1,!1),km().objects.deselectActive();const t=this.straightenAnchor.data.rotateAngle||0;e=90*Math.round(e/90);const r=t+(this.straightenAnchor.data.straightenAngle||0)+e;km().canvas.resize(Sm().original.height,Sm().original.width,{applyZoom:!1,resizeHelper:!1}),this.storeObjectsRelationToHelper(),this.straightenAnchor.rotate(r),this.straightenAnchor.data.rotateAngle=t+e,this.straightenAnchor.center(),this.transformObjectsBasedOnHelper(),km().frame.resize(km().frame.active.currentSizeInPercent),requestAnimationFrame(()=>{km().zoom.fitToScreen()})}getImageScale(e,t){e=cC.fabric.util.degreesToRadians(e);const r=Sm().original.width/2,n=Sm().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(){km().objects.getAll().forEach(e=>{if(e!==this.straightenAnchor){const t=cC.fabric.util.multiplyTransformMatrices(cC.fabric.util.invertTransform(this.straightenAnchor.calcTransformMatrix()),e.calcTransformMatrix());e.data={...e.data,relationToCanvas:t}}})}transformObjectsBasedOnHelper(){km().objects.getAll().forEach(e=>{if(e.data.relationToCanvas){const t=cC.fabric.util.multiplyTransformMatrices(this.straightenAnchor.calcTransformMatrix(),e.data.relationToCanvas),r=cC.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&&Am().remove(e);const t=new cC.fabric.Rect({...Fm,name:vg.StraightenAnchor,visible:!1,width:Sm().original.width,height:Sm().original.height,data:{pixieInternal:!0,straightenAngle:0,rotateAngle:0}});Am().add(t),t.viewportCenter()}}function P_(e){const t=function(e){var t;const r=new cC.fabric.Canvas(e,{width:1,height:1});r.preserveObjectStacking=!0,r.selection=!1,r.renderOnAddRemove=!1;const n=Sm().config.textureSize;n&&(cC.fabric.textureSize=n);const i={...null==(t=Sm().config.objectDefaults)?void 0:t.global,...dC};Object.keys(i).forEach(e=>{cC.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=hC(10))});const o=cC.fabric.Object.prototype.controls;return Object.keys(o).forEach(e=>{delete o[e]}),r}(e);Sm().editor.fabric=t,_m.setState({fabric:t}),Sm().editor.tools={canvas:new yC,objects:new SC,zoom:new gC,history:new MC,filter:new zC,resize:new GC,crop:new KC,merge:new RC,shape:new ZC,frame:new r_,text:new n_,draw:new u_,transform:new O_,import:new S_,watermark:new A_,export:new F_,corners:new T_}}function M_(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 R_(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 L_="flex flex-shrink-0 items-center justify-between px-12 py-[9px] w-full h-[54px]",N_={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:"absolute"},transition:{type:"tween",duration:.15}};function j_(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 D_(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 z_(e){return e&&(t=>{t.currentTarget.contains(t.target)&&e(t)})}const B_=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,...k}=t,A=p||(d?"a":"button"),I="a"===A;return e(A,{ref:r,form:I?void 0:h,href:d,to:g,relative:m,type:I?void 0:w,replace:v,end:y,onPointerDown:z_(C),onPointerUp:z_(_),onClick:z_(x),onKeyDown:z_(S),className:sf("focus-visible:ring",D_({variant:o,color:i,border:f,whitespace:l,display:b}),a,c,u),...k,children:n})}),U_=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=sf("font-semibold",a||j_(o,{equalWidth:l,variant:u}),s);return t(B_,{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(V_,{position:"start",icon:n,size:o}),r,i&&e(V_,{position:"end",icon:i,size:o})]})});function V_({icon:e,position:t,size:r}){const n=sf("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 H_=s(null);function $_(){return l(H_)}const W_=uf(e("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"}),"CheckOutlined"),G_=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(W_,{size:"sm",className:sf("text-primary",!h&&"invisible")}));const y=sf("icon-sm rounded overflow-hidden flex-shrink-0",!u&&"text-muted"),b=sf(!u&&"text-muted");return t(p,{...v,"aria-disabled":u,className:q_(r),ref:n,children:[i&&e("div",{className:y,children:i}),t("div",{className:sf("min-w-auto mr-auto w-full overflow-hidden overflow-ellipsis",o&&"first-letter:capitalize"),children:[a,s&&e("div",{className:sf("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 q_({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"),sf("w-full select-none outline-none cursor-pointer","text-sm truncate flex items-center gap-10",!n&&"text-main",c,u,e,s)}function Y_({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:_}}=$_(),S=x.includes(r),k=null==(f=p.get(r))?void 0:f.index,A=C===k;if(null==k)return null;return e(G_,{...h,onFocus:()=>{m||_(k)},onPointerEnter:e=>{_(k),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[k]=e,id:`${v}-${k}`,role:"menu"===y?"menuitem":"option",tabIndex:m?void 0:A&&!c?-1:0,"aria-selected":A&&S,showCheckmark:g,isDisabled:c,isActive:A,isSelected:S,startIcon:n,description:a,endIcon:i,endSection:o,capitalizeFirst:s,"data-value":r,children:t})}var X_={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(Gh)}(X_);const K_=qh(X_.exports);function Z_({children:r,label:n,index:i}){const o=b();return t("div",{role:"group",className:sf(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 J_=K_(({maxItems:e,children:t,items:r,inputValue:n})=>{let i=eS({children:t,items:r}),o=Q_({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}}),Q_=K_(({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}),eS=K_(({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:tS(e),item:l,section:r,isDisabled:e.props.isDisabled,value:e.props.value})};return m.forEach(r,(e,t)=>{v(e)&&(e.type===Z_?m.forEach(e.props.children,(r,n)=>{o(r,e,t,n)}):o(e))}),n});function tS(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 rS=Math.min,nS=Math.max,iS=Math.round,oS=Math.floor,aS=e=>({x:e,y:e}),sS={left:"right",right:"left",bottom:"top",top:"bottom"},lS={start:"end",end:"start"};function cS(e,t,r){return nS(e,rS(t,r))}function uS(e,t){return"function"==typeof e?e(t):e}function dS(e){return e.split("-")[0]}function hS(e){return e.split("-")[1]}function fS(e){return"x"===e?"y":"x"}function pS(e){return"y"===e?"height":"width"}function gS(e){return["top","bottom"].includes(dS(e))?"y":"x"}function mS(e){return fS(gS(e))}function vS(e){return e.replace(/start|end/g,e=>lS[e])}function yS(e){return e.replace(/left|right|bottom|top/g,e=>sS[e])}function bS(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 wS(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 xS(e,t,r){let{reference:n,floating:i}=e;const o=gS(t),a=mS(t),s=pS(a),l=dS(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(hS(t)){case"start":f[a]-=h*(r&&c?-1:1);break;case"end":f[a]+=h*(r&&c?-1:1)}return f}async function CS(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}=uS(t,e),p=bS(f),g=s[h?"floating"===d?"reference":"floating":d],m=wS(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=wS(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 AS(e)?(e.nodeName||"").toLowerCase():"#document"}function SS(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function kS(e){var t;return null==(t=(AS(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function AS(e){return e instanceof Node||e instanceof SS(e).Node}function IS(e){return e instanceof Element||e instanceof SS(e).Element}function ES(e){return e instanceof HTMLElement||e instanceof SS(e).HTMLElement}function FS(e){return!(typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof SS(e).ShadowRoot)}function TS(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=LS(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function OS(e){return["table","td","th"].includes(_S(e))}function PS(e){const t=MS(),r=LS(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 MS(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function RS(e){return["html","body","#document"].includes(_S(e))}function LS(e){return SS(e).getComputedStyle(e)}function NS(e){return IS(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function jS(e){if("html"===_S(e))return e;const t=e.assignedSlot||e.parentNode||FS(e)&&e.host||kS(e);return FS(t)?t.host:t}function DS(e){const t=jS(e);return RS(t)?e.ownerDocument?e.ownerDocument.body:e.body:ES(t)&&TS(t)?t:DS(t)}function zS(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const i=DS(e),o=i===(null==(n=e.ownerDocument)?void 0:n.body),a=SS(i);return o?t.concat(a,a.visualViewport||[],TS(i)?i:[],a.frameElement&&r?zS(a.frameElement):[]):t.concat(i,zS(i,[],r))}function BS(e){const t=LS(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ES(e),o=i?e.offsetWidth:r,a=i?e.offsetHeight:n,s=iS(r)!==o||iS(n)!==a;return s&&(r=o,n=a),{width:r,height:n,$:s}}function US(e){return IS(e)?e:e.contextElement}function VS(e){const t=US(e);if(!ES(t))return aS(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=BS(t);let a=(o?iS(r.width):r.width)/n,s=(o?iS(r.height):r.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const HS=aS(0);function $S(e){const t=SS(e);return MS()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:HS}function WS(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const i=e.getBoundingClientRect(),o=US(e);let a=aS(1);t&&(n?IS(n)&&(a=VS(n)):a=VS(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==SS(e))&&t}(o,r,n)?$S(o):aS(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=SS(o),t=n&&IS(n)?SS(n):n;let r=e,i=r.frameElement;for(;i&&n&&t!==r;){const e=VS(i),t=i.getBoundingClientRect(),n=LS(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=SS(i),i=r.frameElement}}return wS({width:u,height:d,x:l,y:c})}const GS=[":popover-open",":modal"];function qS(e){return GS.some(t=>{try{return e.matches(t)}catch{return!1}})}function YS(e){return WS(kS(e)).left+NS(e).scrollLeft}function XS(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=SS(e),n=kS(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=MS();(!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=kS(e),r=NS(e),n=e.ownerDocument.body,i=nS(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=nS(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+YS(e);const s=-r.scrollTop;return"rtl"===LS(n).direction&&(a+=nS(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:a,y:s}}(kS(e));else if(IS(t))n=function(e,t){const r=WS(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=ES(e)?VS(e):aS(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=$S(e);n={...t,x:t.x-r.x,y:t.y-r.y}}return wS(n)}function KS(e,t){const r=jS(e);return!(r===t||!IS(r)||RS(r))&&("fixed"===LS(r).position||KS(r,t))}function ZS(e,t){const r=t.get(e);if(r)return r;let n=zS(e,[],!1).filter(e=>IS(e)&&"body"!==_S(e)),i=null;const o="fixed"===LS(e).position;let a=o?jS(e):e;for(;IS(a)&&!RS(a);){const t=LS(a),r=PS(a);!r&&"fixed"===t.position&&(i=null),(o?!r&&!i:!r&&"static"===t.position&&i&&["absolute","fixed"].includes(i.position)||TS(a)&&!r&&KS(e,a))?n=n.filter(e=>e!==a):i=t,a=jS(a)}return t.set(e,n),n}function JS(e,t,r){const n=ES(t),i=kS(t),o="fixed"===r,a=WS(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const l=aS(0);if(n||!n&&!o)if(("body"!==_S(t)||TS(i))&&(s=NS(t)),n){const e=WS(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=YS(i));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function QS(e){return"static"===LS(e).position}function ek(e,t){return ES(e)&&"fixed"!==LS(e).position?t?t(e):e.offsetParent:null}function tk(e,t){const r=SS(e);if(qS(e))return r;if(!ES(e)){let t=jS(e);for(;t&&!RS(t);){if(IS(t)&&!QS(t))return t;t=jS(t)}return r}let n=ek(e,t);for(;n&&OS(n)&&QS(n);)n=ek(n,t);return n&&RS(n)&&QS(n)&&!PS(n)?r:n||function(e){let t=jS(e);for(;ES(t)&&!RS(t);){if(PS(t))return t;t=jS(t)}return null}(e)||r}const rk={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o="fixed"===i,a=kS(n),s=!!t&&qS(t.floating);if(n===a||s&&o)return r;let l={scrollLeft:0,scrollTop:0},c=aS(1);const u=aS(0),d=ES(n);if((d||!d&&!o)&&(("body"!==_S(n)||TS(a))&&(l=NS(n)),ES(n))){const e=WS(n);c=VS(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:kS,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[..."clippingAncestors"===r?qS(t)?[]:ZS(t,this._c):[].concat(r),n],a=o[0],s=o.reduce((e,r)=>{const n=XS(t,r,i);return e.top=nS(n.top,e.top),e.right=rS(n.right,e.right),e.bottom=rS(n.bottom,e.bottom),e.left=nS(n.left,e.left),e},XS(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:tk,getElementRects:async function(e){const t=this.getOffsetParent||tk,r=this.getDimensions,n=await r(e.floating);return{reference:JS(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}=BS(e);return{width:t,height:r}},getScale:VS,isElement:IS,isRTL:function(e){return"rtl"===LS(e).direction}};function nk(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=US(e),u=i||o?[...c?zS(c):[],...zS(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=kS(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:-oS(u)+"px "+-oS(i.clientWidth-(c+d))+"px "+-oS(i.clientHeight-(u+h))+"px "+-oS(c)+"px",threshold:nS(0,rS(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?WS(e):null;return l&&function t(){const n=WS(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 ik=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=dS(r),s=hS(r),l="y"===gS(r),c=["left","top"].includes(a)?-1:1,u=o&&l?-1:1,d=uS(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}}}}},ok=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}=uS(e,t),c={x:r,y:n},u=await CS(t,l),d=gS(dS(i)),h=fS(d);let f=c[h],p=c[d];if(o){const e="y"===h?"bottom":"right";f=cS(f+u["y"===h?"top":"left"],f,f-u[e])}if(a){const e="y"===d?"bottom":"right";p=cS(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}}}}},ak=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}=uS(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=dS(i),y=dS(s)===s,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=h||(y||!g?[yS(s)]:function(e){const t=yS(e);return[vS(e),t,vS(t)]}(s));!h&&"none"!==p&&w.push(...function(e,t,r,n){const i=hS(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[]}}(dS(e),"start"===r,n);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(vS)))),o}(s,g,p,b));const x=[s,...w],C=await CS(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=hS(e),i=mS(e),o=pS(i);let a="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=yS(a)),[a,yS(a)]}(i,a,b);_.push(C[e[0]],C[e[1]])}if(S=[...S,{placement:i,overflows:_}],!_.every(e=>e<=0)){var k,A;const e=((null==(k=o.flip)?void 0:k.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let r=null==(A=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!r)switch(f){case"bestFit":{var I;const e=null==(I=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:I[0];e&&(r=e);break}case"initialPlacement":r=s}if(i!==r)return{reset:{placement:r}}}return{}}}},sk=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}=uS(e,t),l=await CS(t,s),c=dS(r),u=hS(r),d="y"===gS(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=rS(f-l[p],m),b=rS(h-l[g],v),w=!t.middlewareData.shift;let x=y,C=b;if(d?C=u||w?rS(b,v):v:x=u||w?rS(y,m):m,w&&!u){const e=nS(l.left,0),t=nS(l.right,0),r=nS(l.top,0),n=nS(l.bottom,0);d?C=h-2*(0!==e||0!==t?e+t:nS(l.left,l.right)):x=f-2*(0!==r||0!==n?r+n:nS(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}}:{}}}},lk=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}=uS(e,t)||{};if(null==c)return{};const d=bS(u),h={x:r,y:n},f=mS(i),p=pS(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,k=_/2-g[p]/2-1,A=rS(d[v],k),I=rS(d[y],k),E=A,F=_-g[p]-I,T=_/2-g[p]/2+S,O=cS(E,T,F),P=!l.arrow&&null!=hS(i)&&T!==O&&o.reference[p]/2-(T<E?A:I)-g[p]/2<0,M=P?T<E?T-E:T-F:0;return{[f]:h[f]+M,data:{[f]:O,centerOffset:T-O-M,...P&&{alignmentOffset:M}},reset:P}}}),ck=(e,t,r)=>{const n=new Map,i={platform:rk,...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}=xS(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}=xS(c,h,l))),r=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var uk=typeof document<"u"?x:a;function dk(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(!dk(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||dk(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function hk(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fk(e,t){const r=hk(e);return Math.round(t*r)/r}function pk(e){const t=n.useRef(e);return uk(()=>{t.current=e}),t}function gk({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=nk,f.middleware=[ik(o),ok({padding:16,crossAxis:l,mainAxis:!0}),ak({padding:16,fallbackPlacements:c}),sk({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?lk({element:r.current,padding:n}).fn(t):{}:r?lk({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);dk(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),k=n.useRef(d),A=pk(c),I=pk(o),E=n.useCallback(()=>{if(!_.current||!S.current)return;const e={placement:t,strategy:r,middleware:f};I.current&&(e.platform=I.current),ck(_.current,S.current,e).then(e=>{const t={...e,isPositioned:!0};F.current&&!dk(k.current,t)&&(k.current=t,Ee.flushSync(()=>{h(t)}))})},[f,t,r,I]);uk(()=>{!1===u&&k.current.isPositioned&&(k.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[u]);const F=n.useRef(!1);uk(()=>(F.current=!0,()=>{F.current=!1}),[]),uk(()=>{if(x&&(_.current=x),C&&(S.current=C),x&&C){if(A.current)return A.current(x,C,E);E()}},[x,C,E,A]);const T=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=fk(O.floating,d.x),n=fk(O.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...hk(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:E,refs:T,elements:O,floatingStyles:P}),[d,E,T,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 mk(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:k,clearSelectionOnInputClear:A}=e,I=e.selectionMode||"none",E=`${b()}-listbox`,[F,T]=oC(e.inputValue,e.defaultInputValue||"",e.onInputValueChange),[O,P]=o("all"),M=J_({children:r,items:n,inputValue:S?void 0:F,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]=oC(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]=oC(e.isOpen,e.defaultIsOpen,e.onOpenChange),[U,V]=o(null),H=gk({floatingWidth:g,ref:t,placement:w,offset:y,maxHeight:v??420,shiftCrossAxis:!a}),{refs:$,strategy:W,x:G,y:q}=H,Y="none"===I?void 0:R.get(j[0]),X="none"===I||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=$.reference.current;"none"!==I?D(e):t&&"focus"in t&&t.focus(),a&&(T(f?"":`${e}`),p&&t&&"blur"in t&&t.blur()),P("all"),B(!1),null==h||h(e),V(null)},onInputChange:c(e=>{T(e.target.value),P(e.target.value.trim()?"filtered":"all"),e.target.value?B(!0):A&&D(""),l&&null==U?K("increment",0):V(null)},[T,B,P,D,A,K,l,U]),focusLoopingMode:s,floatingWidth:g,floatingMinWidth:m,floatingMaxHeight:v,showCheckmark:x,collection:R,collections:M,virtualFocus:a,focusItem:K,showEmptyMessage:C&&!!F,allowCustomValue:k,refs:$,reference:H.reference,floating:$.setFloating,positionStyle:{position:W,top:q??"",left:G??""},listContent:N,listItemsRef:L,listboxId:E,role:i,state:{activeIndex:U,setActiveIndex:V,selectedIndex:X,setSelectedIndex:e=>{if("none"!==I){const t=[...R.values()][e];t&&D(t.value)}},selectionMode:I,selectedValues:j,selectValues:D,inputValue:F,setInputValue:T,isOpen:z,setIsOpen:B,setActiveCollection:P}}}function vk(){return Ux()||typeof window>"u"?bm.getState().data.is_mobile_device??!1:window.screen.width<=768}let yk=null,bk=new Set,wk=new Map,xk=!1,Ck=!1;function _k(e,t){for(let r of bk)r(e,t)}function Sk(e){xk=!0,function(e){return!(e.metaKey||!Kx()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(yk="keyboard",_k("keyboard",e))}function kk(e){yk="pointer",("mousedown"===e.type||"pointerdown"===e.type)&&(xk=!0,_k("pointer",e))}function Ak(e){(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(Zx()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)})(e)&&(xk=!0,yk="virtual")}function Ik(e){e.target===window||e.target===document||(!xk&&!Ck&&(yk="virtual",_k("virtual",e)),xk=!1,Ck=!1)}function Ek(){xk=!1,Ck=!0}function Fk(e){if(typeof window>"u"||wk.get(Gx(e)))return;const t=Gx(e),r=Wx(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){xk=!0,n.apply(this,arguments)},r.addEventListener("keydown",Sk,!0),r.addEventListener("keyup",Sk,!0),r.addEventListener("click",Ak,!0),t.addEventListener("focus",Ik,!0),t.addEventListener("blur",Ek,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",kk,!0),r.addEventListener("pointermove",kk,!0),r.addEventListener("pointerup",kk,!0)):(r.addEventListener("mousedown",kk,!0),r.addEventListener("mousemove",kk,!0),r.addEventListener("mouseup",kk,!0)),t.addEventListener("beforeunload",()=>{Tk(e)},{once:!0}),wk.set(t,{focus:n})}const Tk=(e,t)=>{const r=Gx(e),n=Wx(e);t&&n.removeEventListener("DOMContentLoaded",t),wk.has(r)&&(r.HTMLElement.prototype.focus=wk.get(r).focus,n.removeEventListener("keydown",Sk,!0),n.removeEventListener("keyup",Sk,!0),n.removeEventListener("click",Ak,!0),r.removeEventListener("focus",Ik,!0),r.removeEventListener("blur",Ek,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",kk,!0),n.removeEventListener("pointermove",kk,!0),n.removeEventListener("pointerup",kk,!0)):(n.removeEventListener("mousedown",kk,!0),n.removeEventListener("mousemove",kk,!0),n.removeEventListener("mouseup",kk,!0)),wk.delete(r))};function Ok(e){const t=Wx(e);if("virtual"===yk){let r=t.activeElement;!function(e){requestAnimationFrame(()=>{0===Jx.size?e():Qx.add(e)})}(()=>{t.activeElement===r&&e.isConnected&&Yx(e)})}else Yx(e)}function Pk(e,t){return"#comment"!==e.nodeName&&function(e){const t=Gx(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||Pk(e.parentElement,e))}typeof document<"u"&&function(e){const t=Wx(e);let r;"loading"!==t.readyState?Fk(e):(r=()=>{Fk(e)},t.addEventListener("DOMContentLoaded",r))}();const Mk=i.createContext(null);let Rk=null;function Lk(e){let{children:t,contain:r,restoreFocus:n,autoFocus:o}=e,s=u(null),c=u(null),h=u([]),{parentNode:f}=l(Mk)||{},p=d(()=>new Xk({scopeRef:h}),[h]);Nx(()=>{let e=f||Kk.root;if(Kk.getTreeNode(e.scopeRef)&&Rk&&!$k(Rk,e.scopeRef)){let t=Kk.getTreeNode(Rk);t&&(e=t)}e.addChild(p),Kk.addNode(p)},[p,f]),Nx(()=>{let e=Kk.getTreeNode(h);e&&(e.contain=!!r)},[r]),Nx(()=>{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){Nx(()=>{if(t||r)return;let n=e.current;const i=Wx(n?n[0]:void 0);let o=t=>{let r=t.target;Vk(r,e.current)?Rk=e:Uk(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();Nx(()=>{let i=e.current;if(!t)return void(n.current&&(cancelAnimationFrame(n.current),n.current=void 0));const o=Wx(i?i[0]:void 0);let a=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey||!Bk(e)||t.isComposing)return;let r=o.activeElement,n=e.current;if(!n||!Vk(r,n))return;let i=qk(zk(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&&Wk(a,!0)},s=t=>{Rk&&!$k(Rk,e)||!Vk(t.target,e.current)?Bk(e)&&!Hk(t.target,e)?r.current?r.current.focus():Rk&&Rk.current&&Gk(Rk.current):Bk(e)&&(r.current=t.target):(Rk=e,r.current=t.target)},l=t=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{if(o.activeElement&&Bk(e)&&!Hk(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&&Gk(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]),Nx(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}(h,r),function(e,t,r){const n=u(typeof document<"u"?Wx(e.current?e.current[0]:void 0).activeElement:null);Nx(()=>{let n=e.current;const i=Wx(n?n[0]:void 0);if(!t||r)return;let o=()=>{(!Rk||$k(Rk,e))&&Vk(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]),Nx(()=>{const n=Wx(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey||!Bk(e)||t.isComposing)return;let r=n.activeElement;if(!Vk(r,e.current))return;let i=Kk.getTreeNode(e);if(!i)return;let o=i.nodeToRestore,a=qk(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||!Vk(s,e.current))&&o){a.currentNode=o;do{s=t.shiftKey?a.previousNode():a.nextNode()}while(Vk(s,e.current));t.preventDefault(),t.stopPropagation(),s?Wk(s,!0):Uk(o)?Wk(o,!0):r.blur()}};return r||n.addEventListener("keydown",i,!0),()=>{r||n.removeEventListener("keydown",i,!0)}},[e,t,r]),Nx(()=>{const r=Wx(e.current?e.current[0]:void 0);if(!t)return;let i=Kk.getTreeNode(e);var o;return i?(i.nodeToRestore=null!==(o=n.current)&&void 0!==o?o:void 0,()=>{let n=Kk.getTreeNode(e);if(!n)return;let i=n.nodeToRestore;if(t&&i&&(Vk(r.activeElement,e.current)||r.activeElement===r.body&&function(e){let t=Kk.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=Kk.clone();requestAnimationFrame(()=>{if(r.activeElement===r.body){let r=t.getTreeNode(e);for(;r;){if(r.nodeToRestore&&r.nodeToRestore.isConnected)return void Wk(r.nodeToRestore);r=r.parent}for(r=t.getTreeNode(e);r;){if(r.scopeRef&&r.scopeRef.current&&Kk.getTreeNode(r.scopeRef))return void Gk(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;!Vk(Wx(e.current?e.current[0]:void 0).activeElement,Rk.current)&&e.current&&Gk(e.current)}r.current=!1},[e])}(h,o),a(()=>{const e=Wx(h.current?h.current[0]:void 0).activeElement;let t=null;if(Vk(e,h.current)){for(let r of Kk.traverse())r.scopeRef&&Vk(e,r.scopeRef.current)&&(t=r);t===Kk.getTreeNode(h)&&(Rk=t.scopeRef)}},[h]),Nx(()=>()=>{var e,t,r;let n=null!==(r=null===(t=Kk.getTreeNode(h))||void 0===t||null===(e=t.parent)||void 0===e?void 0:e.scopeRef)&&void 0!==r?r:null;(h===Rk||$k(h,Rk))&&(!n||Kk.getTreeNode(n))&&(Rk=n),Kk.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||Wx(r[0]).activeElement,l=r[0].previousElementSibling,c=qk(zk(r),{tabbable:i,accept:a},r);c.currentNode=Vk(s,r)?s:l;let u=c.nextNode();return!u&&o&&(c.currentNode=l,u=c.nextNode()),u&&Wk(u,!0),u},focusPrevious(t={}){let r=e.current,{from:n,tabbable:i,wrap:o,accept:a}=t,s=n||Wx(r[0]).activeElement,l=r[r.length-1].nextElementSibling,c=qk(zk(r),{tabbable:i,accept:a},r);c.currentNode=Vk(s,r)?s:l;let u=c.previousNode();return!u&&o&&(c.currentNode=l,u=c.previousNode()),u&&Wk(u,!0),u},focusFirst(t={}){let r=e.current,{tabbable:n,accept:i}=t,o=qk(zk(r),{tabbable:n,accept:i},r);o.currentNode=r[0].previousElementSibling;let a=o.nextNode();return a&&Wk(a,!0),a},focusLast(t={}){let r=e.current,{tabbable:n,accept:i}=t,o=qk(zk(r),{tabbable:n,accept:i},r);o.currentNode=r[r.length-1].nextElementSibling;let a=o.previousNode();return a&&Wk(a,!0),a}}}(h),[]),m=d(()=>({focusManager:g,parentNode:p}),[p,g]);return i.createElement(Mk.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 Nk=["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]"],jk=Nk.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Nk.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Dk=Nk.join(':not([hidden]):not([tabindex="-1"]),');function zk(e){return e[0].parentElement}function Bk(e){let t=Kk.getTreeNode(Rk);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Uk(e){return Hk(e)}function Vk(e,t){return!(!e||!t)&&t.some(t=>t.contains(e))}function Hk(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of Kk.traverse(Kk.getTreeNode(t)))if(r&&Vk(e,r.current))return!0;return!1}function $k(e,t){var r;let n=null===(r=Kk.getTreeNode(t))||void 0===r?void 0:r.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function Wk(e,t=!1){if(null==e||t){if(null!=e)try{e.focus()}catch{}}else try{Ok(e)}catch{}}function Gk(e,t=!0){let r=e[0].previousElementSibling,n=zk(e),i=qk(n,{tabbable:t},e);i.currentNode=r;let o=i.nextNode();t&&!o&&(n=zk(e),i=qk(n,{tabbable:!1},e),i.currentNode=r,o=i.nextNode()),Wk(o)}function qk(e,t,r){let n=null!=t&&t.tabbable?Dk:jk,i=Wx(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)||!Pk(e)||r&&!Vk(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 Yk{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 Xk({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&&Vk(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 Yk;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 Xk({scopeRef:null}),this.fastMap.set(null,this.root)}}class Xk{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 Kk=new Yk;function Zk(){const{width:e,height:t}=function(){let e=Ux(),[t,r]=o(()=>e?{width:0,height:0}:iC());return a(()=>{let e=()=>{r(e=>{let t=iC();return t.width===e.width&&t.height===e.height?e:t})};return nC?nC.addEventListener("resize",e):window.addEventListener("resize",e),()=>{nC?nC.removeEventListener("resize",e):window.removeEventListener("resize",e)}},[]),t}();return{"--be-viewport-height":`${t}px`,"--be-viewport-width":`${e}px`}}const Jk={initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:"tween",duration:.125}},Qk=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=Zk(),b=rC(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(()=>eA[eA.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(()=>{eA.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=eA.indexOf(i);r>=0&&eA.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(kx.div,{className:"isolate z-popover",role:"presentation",ref:b,style:{...y,...r,position:"fixed"},...Jk,...qx(w,{onPointerLeave:g,onPointerEnter:m}),children:e(Lk,{restoreFocus:i,autoFocus:n,contain:!1,children:t})})}),eA=[];const tA={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2}};function rA({position:t="absolute",className:r,isTransparent:n=!1,disableInitialTransition:i,...o}){return e(kx.div,{...o,className:sf(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},...tA,transition:{duration:.15}})}const nA=p(({children:r,autoFocus:n=!1,restoreFocus:i=!0,isDismissable:o,isOpen:a,onClose:s},l)=>{const c=Zk(),u=rC(l);return t("div",{className:"fixed inset-0 isolate z-tray",style:c,children:[e(rA,{onClick:()=>{o&&s()}},"tray-underlay"),e(kx.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(Lk,{restoreFocus:i,autoFocus:n,contain:!0,children:r})})]})});function iA(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 oA(){const{i18n:e}=bm(e=>e.data);return{locale:e,localeCode:(null==e?void 0:e.language)||"en",lines:null==e?void 0:e.lines}}function aA(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=sA(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 sA=K_(e=>new Intl.PluralRules(e));function lA(e,t){return null!=e&&(void 0!==Object.hasOwn?Object.hasOwn(e,t):Object.hasOwnProperty(t))}const cA=f(t=>{const{message:r,values:n}=t,{lines:i,localeCode:o}=oA();let a;if(a=lA(i,r)?null==i?void 0:i[r]:lA(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=aA(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 iA(i,r)&&iA(n,o)});function uA({listbox:r,children:n,isLoading:i,mobileOverlay:o=nA,searchField:a,onClose:s,prepend:l,className:c,...u}){const h=vk(),{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:Qk,S=sf("text-base sm:text-sm outline-none bg max-h-inherit flex flex-col",!l&&"shadow-xl border py-4",c,_===Qk&&"rounded-panel",_===Qk&&"auto"===f?`max-w-288 ${p}`:""),k=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]),A=k.length>0||m&&!i,I=A?t("div",{className:S,role:"presentation",children:[a,e(dA,{isLoading:i,...u,children:k})]}):null;return t(H_.Provider,{value:r,children:[n,l?I:mm&&Fe(e(Px,{children:v&&A&&e(_,{triggerRef:C.reference,restoreFocus:!0,isOpen:v,onClose:()=>{null==s||s(),y(!1)},isDismissable:!0,style:b,ref:x,children:I})}),mm)]})}function dA({className:t,children:r,isLoading:n,...i}){const{role:o,listboxId:s,virtualFocus:l,focusItem:c,state:{activeIndex:d,setActiveIndex:h,selectedIndex:f}}=$_(),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(hA,{})})}function hA(){return e("div",{className:"px-8 py-4 text-sm italic text-muted",children:e(cA,{message:"There are no items matching your query"})})}function fA({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 pA=new Map;function gA(){const e=function(e){const{localeCode:t}=oA(),r=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(pA.has(r))return pA.get(r);const n=new Intl.Collator(t,e);return pA.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 mA(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 vA=uf(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 yA=e=>null==e;var bA=e=>!yA(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),wA=e=>bA(e)&&e.target?(e=>"checkbox"===e.type)(e.target)?e.target.checked:e.target.value:e,xA=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function CA(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(xA&&(e instanceof Blob||e instanceof FileList)||!r&&!bA(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return bA(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=CA(e[r]));else t=e}return t}var _A=e=>Array.isArray(e)?e.filter(Boolean):[],SA=e=>void 0===e,kA=(e,t,r)=>{if(!t||!bA(e))return r;const n=_A(t.split(/[,[\].]+?/)).reduce((e,t)=>yA(e)?e:e[t],e);return SA(n)||n===e?SA(e[t])?r:e[t]:n},AA=e=>"boolean"==typeof e,IA=(e,t,r)=>{let n=-1;const i=(e=>/^\w*$/.test(e))(t)?[t]:(e=>_A(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=bA(r)||Array.isArray(r)?r:isNaN(+i[n+1])?{}:[]}if("__proto__"===t)return;e[t]=o,e=e[t]}return e};const EA="blur",FA="change",TA="all",OA=i.createContext(null),PA=()=>i.useContext(OA);var MA=(e,t,r,n)=>{r(e);const{name:i,...o}=e;return(e=>bA(e)&&!Object.keys(e).length)(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>!0===t[e])},RA=(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 LA(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 NA(e){const t=PA(),{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,LA({disabled:n,next:e=>c.current&&RA(d.current,e.name,a)&&MA(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]!==TA&&(t._proxyFormState[i]=!n||TA),r&&(r[i]=!0),e[i]}});return i})(s,r,u.current,!1)}function jA(e){const t=PA(),{control:r=t.control,name:n,defaultValue:o,disabled:a,exact:s}=e||{},l=i.useRef(n);l.current=n,LA({disabled:a,subject:r._subjects.values,next:e=>{RA(l.current,e.name,s)&&u(CA(((e,t,r,n,i)=>(e=>"string"==typeof e)(e)?kA(r,e,i):Array.isArray(e)?e.map(e=>kA(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 DA(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:sf(!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:sf(!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:sf(a,"first-letter:capitalize text-left whitespace-nowrap",d&&"text-disabled",b.font,y?"":"side"===o?"mr-16":"mb-4"),input:sf("block text-left relative w-full appearance-none transition-shadow text",h,C.input,zA(e),!d&&`${x} focus:outline-none ${p}`,d&&"text-disabled cursor-not-allowed",s,b.font,b.height,BA(e)),adornment:UA(t),append:{size:j_(t),radius:C.append},wrapper:sf(i,b.font,{"flex items-center":"side"===o}),inputWrapper:sf("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 zA({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 BA({startAdornment:e,endAdornment:t,inputRadius:r}){return"rounded-full"===r?sf(e?"pl-54":"pl-28",t?"pr-54":"pr-28"):sf(e?"pl-46":"pl-12",t?"pr-46":"pr-12")}function UA(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 VA({children:t,direction:r,className:n,position:i=("start"===r?"left-0":"right-0")}){return t?e("div",{className:sf("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 HA(e,t){const r={...e};return Object.keys(r).forEach(e=>{const t=e;(null==r[t]||""===r[t])&&delete r[t]}),r}const $A=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(WA,{...r}),t("div",{className:p.inputWrapper,children:[e(VA,{direction:"start",className:p.adornment,position:d,children:c}),h&&e(GA,{style:p.append,disabled:g,children:h}),i,f&&e(GA,{style:p.append,disabled:g,children:f}),e(VA,{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 WA({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:sf("mb-4 flex w-full gap-4","spaced"===s?"items-end":"items-center"),children:[c,e("div",{className:sf("text-xs text-muted","spaced"===s?"ml-auto":""),children:a})]}):c}function GA({children:e,style:t,disabled:r}){return i.cloneElement(e,{...e.props,disabled:e.props.disabled||r,...HA(t)})}function qA({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 YA(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:k,disabled:A,id:I,inputRadius:E,inputBorder:F,inputShadow:T,inputRing:O,inputFontSize:P,...M}=e;qA(e,t);const R=b(),L=I||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":k||void 0,id:L,disabled:A,...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:A,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:k},inputProps:z}}const XA=p(({inputElementType:t="input",flexibleHeight:r,inputRef:n,inputTestId:i,...o},a)=>{const s=rC(n),{fieldProps:l,inputProps:c}=YA({...o,focusRef:s}),u="textarea"===t,d=u?"textarea":"input",h=DA({...o,flexibleHeight:r||"textarea"===t});return"textarea"===t&&!o.unstyled&&(h.input=`${h.input} py-12`),e($A,{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=PA(),{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=jA({control:o,name:r,defaultValue:kA(o._formValues,r,kA(o._defaultValues,r,e.defaultValue)),exact:!0}),c=NA({control:o,name:r}),u=i.useRef(o.register(r,{...e.rules,value:l,...AA(e.disabled)?{disabled:e.disabled}:{}}));return i.useEffect(()=>{const e=o._options.shouldUnregister||a,t=(e,t)=>{const r=kA(o._fields,e);r&&(r._f.mount=t)};if(t(r,!0),e){const e=CA(kA(o._options.defaultValues,r));IA(o._defaultValues,r,e),SA(kA(o._formValues,r))&&IA(o._formValues,r,e)}return()=>{(s?e&&!o._state.action:e)?o.unregister(r):t(r,!1)}},[r,o,s,a]),i.useEffect(()=>{kA(o._fields,r)&&o._updateDisabledField({disabled:n,fields:o._fields,name:r,value:kA(o._fields,r)._f.value})},[n,r,o]),{field:{name:r,value:l,...AA(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:i.useCallback(e=>u.current.onChange({target:{value:wA(e),name:r},type:FA}),[r]),onBlur:i.useCallback(()=>u.current.onBlur({target:{value:kA(o._formValues,r),name:r},type:EA}),[r,o]),ref:e=>{const t=kA(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:()=>!!kA(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!kA(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!kA(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!kA(c.validatingFields,r)},error:{enumerable:!0,get:()=>kA(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(XA,{ref:n,...qx(d,r)})});const KA=p((t,r)=>{const{searchPlaceholder:n,showSearchField:i,children:[o,a],floatingWidth:s="auto",isLoading:l}=t,c=b(),u=mA(),d=mk({...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:k,handleListboxSearchFieldKeydown:A}=fA(d),{findMatchingItem:I}=gA();return e(uA,{onClick:e=>e.stopPropagation(),listbox:d,onKeyDownCapture:i?void 0:e=>{if(!h)return;const t=I(e,x,p);null!=t&&y("increment",t)},onKeyDown:k,onClose:i?()=>m(""):void 0,"aria-labelledby":c,isLoading:l,searchField:i?e(XA,{size:"sm",placeholder:n,startAdornment:e(vA,{}),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=>{A(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:z_(e=>{var t,r;null==(r=null==(t=o.props)?void 0:t.onClick)||r.call(t,e),f(!h)})})})});function ZA({children:e}){return e}function JA({item:r,button:n}){return t(KA,{children:[n,e(ZA,{children:(r.menuItems||[]).map(t=>e(Y_,{value:t.label,onSelected:()=>{t.action(Sm().editor)},children:t.label},t.label))})]})}const QA=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=sf(j_(r,{padding:s,equalWidth:l,variant:i}),a,c&&"relative");return t(B_,{...u,ref:d,radius:o,variant:i,className:h,children:[w(e,{size:n}),c]})});const eI=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(df(t),{size:n}):i.createElement(t,{size:n}),e("span",{className:sf(r,"leading-none"),children:o})});function tI({value:t}){return t?e(cA,"string"==typeof t?{message:t}:{...t}):null}function rI({item:t}){const r=t.label?e(iI,{item:t}):e(nI,{item:t});return t.menuItems?e(JA,{item:t,button:r}):i.cloneElement(r,{onClick:()=>{var e;null==(e=t.action)||e.call(t,Sm().editor)}})}const nI=p(({item:t,...r},n)=>e(QA,{ref:n,radius:"rounded-full",size:"sm",...r,children:e(eI,{icon:t.icon})})),iI=p(({item:t,...r},n)=>e(U_,{ref:n,radius:"rounded-full",size:"xs",color:t.buttonColor||"primary",variant:t.buttonVariant||"flat",startIcon:t.icon&&e(eI,{icon:t.icon}),...r,children:e(tI,{value:t.label})}));function oI({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:sf(e.props.className,h?"z-20":"z-10",aI(s,t,o,f))})}});return e("div",{className:sf(o,"isolate inline-flex",s),children:h})}function aI(e,t,r,n){return 0===e?sf(r,"rounded-tr-none rounded-br-none",!n&&"border-r-transparent disabled:border-r-transparent"):e===t.length-1?sf(r,"rounded-tl-none rounded-bl-none -ml-1"):sf("rounded-none -ml-1",!n&&"border-r-transparent disabled:border-r-transparent")}const sI=uf(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"),lI=uf(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 cI(){const r=_m(e=>e.history.canUndo),n=_m(e=>e.history.canRedo);return t(oI,{variant:"outline",children:[e(QA,{equalWidth:!1,size:"xs",padding:"pl-12 pr-10",radius:"rounded-full",disabled:!r,onClick:()=>{km().history.undo()},children:e(sI,{})},"undo"),e(QA,{equalWidth:!1,padding:"pl-10 pr-12",size:"xs",radius:"rounded-full",disabled:!n,onClick:()=>{km().history.redo()},children:e(lI,{})},"redo")]})}const uI=uf(e("path",{d:"M19 13H5v-2h14v2z"}),"RemoveOutlined"),dI=uf(e("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"AddOutlined");function hI(){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(QA,{size:"sm",disabled:!(null!=(r=km().zoom)&&r.canZoomOut()),onClick:()=>{km().zoom.zoomOut(km().zoom.step)},children:e(uI,{})}),t("div",{className:"w-[4ch] text-sm text-center",children:[Math.round(100*i),"%"]}),e(QA,{size:"sm",disabled:!(null!=(n=km().zoom)&&n.canZoomIn()),onClick:()=>{km().zoom.zoomIn(km().zoom.step)},children:e(dI,{})})]}):null}function fI({item:t}){switch(t.type){case"undoWidget":return e(cI,{});case"zoomWidget":return e(hI,{});case"button":return e(rI,{item:t});case"image":return e("img",{className:"h-30 object-cover",src:EC(t.src),alt:""});default:return null}}const pI=uf(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 gI(){var e;let t=_m(e=>{var t;return(null==(t=e.config.ui)?void 0:t.mode)===Xh.OVERLAY});const{width:r}=_m(e=>e.stageSize),n=r<=700;return n&&null!=(e=Sm().config.ui)&&e.forceOverlayModeOnMobile&&(t=!0),{isModal:t,isMobile:n}}function mI(){const{isModal:r,isMobile:n}=gI(),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(QA,{size:"sm",className:"ml-10",onClick:()=>{Sm().editor.close()},children:e(pI,{})});return t(kx.div,{className:L_,...N_,children:[e("div",{className:"mr-auto flex items-center gap-8",children:a.map((t,r)=>e(fI,{item:t},r))}),e("div",{className:"flex items-center gap-10",children:s.map((t,r)=>e(fI,{item:t},r))}),e("div",{className:"ml-auto flex items-center gap-8",children:l.map((t,r)=>e(fI,{item:t},r))}),c]})}function vI(){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 yI(){const r=_m(e=>e.activeTool);return t(kx.div,{className:L_,...N_,children:[e(bI,{}),wI(r),e(xI,{})]})}function bI(){const{isMobile:t}=gI(),r=_m(e=>e.dirty);return t?e(QA,{size:"sm",onClick:()=>{Sm().cancelChanges()},children:e(pI,{})}):e(U_,{variant:"outline",size:"xs",startIcon:e(pI,{}),radius:"rounded-full",className:"min-w-92",onClick:()=>{Sm().cancelChanges()},children:e(cA,r?{message:"Cancel"}:{message:"Close"})})}function wI(t){var r,n;if(!t)return null;const i=e("div",{className:"capitalize text-sm",children:e(cA,{message:t})});return t===of.CROP&&((null==(n=null==(r=Sm().config.tools)?void 0:r.crop)?void 0:n.allowCustomRatio)??1)?e(vI,{}):i}function xI(){const{isMobile:t}=gI(),r=_m(e=>e.dirty);return t?e(QA,{size:"sm",disabled:!r,onClick:()=>{Sm().applyChanges()},children:e(W_,{})}):e(U_,{variant:"flat",color:"primary",size:"xs",disabled:!r,startIcon:e(W_,{}),radius:"rounded-full",onClick:()=>{Sm().applyChanges()},children:e(cA,{message:"Apply"})})}function CI(){const t=_m(e=>e.activeTool);return e(Px,{initial:!1,children:t?e(yI,{},"activeToolbar"):e(mI,{},"mainToolbar")})}const _I={newCanvas:Zh("Loading Canvas"),mainImage:Zh("Loading Image"),state:Zh("Loading State"),merge:Zh("Processing Image")};function SI(){const[t,r]=o(!1);return a(()=>{_m.subscribe(e=>e.loading,e=>{e&&r(e)})},[]),e(Px,{children:t&&e(kx.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(cA,{..._I[t]})})})}const kI={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 AI(e,t,r){return 0===t||Math.abs(t)===1/0?Math.pow(e,5*r):e*t*r/(t+r*e)}function II(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?-AI(t-e,r-t,n)+t:e>r?+AI(e-r,r-t,n)+r:e}function EI(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 FI(e,t,r){return(t=EI(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function TI(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 OI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?TI(Object(r),!0).forEach(function(t){FI(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TI(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const PI={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 MI(e){return e?e[0].toUpperCase()+e.slice(1):""}const RI=["enter","leave"];function LI(e,t="",r=!1){const n=PI[e],i=n&&n[t]||t;return"on"+MI(e)+MI(i)+(function(e=!1,t){return e&&!RI.includes(t)}(r,i)?"Capture":"")}const NI=["gotpointercapture","lostpointercapture"];function jI(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const n=NI.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(n);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function DI(e){return"touches"in e}function zI(e){return DI(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function BI(e){return DI(e)?function(e){return"touchend"===e.type||"touchcancel"===e.type?e.changedTouches:e.targetTouches}(e)[0]:e}function UI(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 VI(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 HI(e,t){const[r,n]=Array.from(e.touches).filter(e=>t.includes(e.identifier));return UI(r,n)}function $I(e){const t=BI(e);return DI(e)?t.identifier:t.pointerId}function WI(e){const t=BI(e);return[t.clientX,t.clientY]}function GI(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 qI(e,...t){return"function"==typeof e?e(...t):e}function YI(){}function XI(...e){return 0===e.length?YI:1===e.length?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function KI(e,t){return Object.assign({},t,e||{})}class ZI{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?qI(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);kI.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=qI(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[II(t,o,a,n),II(r,s,l,i)]}(t._bounds,t.offset,w),t.delta=kI.sub(t.offset,h),this.computeMovement(),f&&(!t.last||i>32)){t.delta=kI.sub(t.offset,h);const e=t.delta.map(Math.abs);kI.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(OI(OI(OI({},t),e),{},{[this.aliasKey]:e.values}));void 0!==n&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}class JI extends ZI{constructor(...e){super(...e),FI(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=kI.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=kI.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[zI(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 QI=e=>e,eE={enabled:(e=!0)=>e,eventOptions:(e,t,r)=>OI(OI({},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 kI.toVector(e)}},from:e=>"function"==typeof e?e:null!=e?kI.toVector(e):void 0,transform(e,t,r){const n=e||r.shared.transform;return this.hasCustomTransform=!!n,n||QI},threshold:e=>kI.toVector(e,0)},tE=OI(OI({},eE),{},{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=>tE.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]]}}),rE={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 nE=typeof window<"u"&&window.document&&window.document.createElement;function iE(){return nE&&"ontouchstart"in window}const oE={isBrowser:nE,gesture:function(){try{return"constructor"in GestureEvent}catch{return!1}}(),touch:iE(),touchscreen:iE()||nE&&window.navigator.maxTouchPoints>1,pointer:nE&&"onpointerdown"in window,pointerLock:nE&&"exitPointerLock"in window.document},aE={mouse:0,touch:0,pen:8},sE=OI(OI({},tE),{},{device(e,t,{pointer:{touch:r=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&oE.pointerLock,oE.touch&&r?"touch":this.pointerLock?"mouse":oE.pointer&&!i?"pointer":oE.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay="number"==typeof r?r:r||void 0===r&&e?250:void 0,oE.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=kI.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(kI.toVector(e)),distance:this.transform(kI.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return 180;case!1:return 0;default:return e}},axisThreshold:e=>e?OI(OI({},aE),e):aE,keyboardDisplacement:(e=10)=>e});const lE=OI(OI({},eE),{},{device(e,t,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!oE.touch&&oE.gesture)return"gesture";if(oE.touch&&n)return"touch";if(oE.touchscreen){if(oE.pointer)return"pointer";if(oE.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:n={}}){const i=e=>{const t=KI(qI(r,e),{min:-1/0,max:1/0});return[t.min,t.max]},o=e=>{const t=KI(qI(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,kI.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey:e=>void 0===e?"ctrlKey":e,pinchOnWheel:(e=!0)=>e});OI(OI({},tE),{},{mouseOnly:(e=!0)=>e}),OI(OI({},tE),{},{mouseOnly:(e=!0)=>e});const cE=new Map,uE=new Map;function dE(e){cE.set(e.key,e.engine),uE.set(e.key,e.resolver)}const hE={key:"drag",engine:class extends JI{constructor(...e){super(...e),FI(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=tE.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=$I(e),r._pointerActive=!0,this.computeValues(WI(e)),this.computeInitial(),t.preventScrollAxis&&"mouse"!==zI(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=$I(e);if(void 0!==t._pointerId&&n!==t._pointerId)return;const i=WI(e);return document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=kI.sub(i,t._values),this.computeValues(i)),kI.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=$I(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=rE[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,kI.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in rE&&(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:sE},fE={key:"pinch",engine:class extends ZI{constructor(...e){super(...e),FI(this,"ingKey","pinching"),FI(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?kI.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=HI(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=UI(...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=HI(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=UI(...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=kI.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=[-GI(e)[1]/100*t.offset[0],0],kI.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:lE};function pE(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 gE={target(e){if(e)return()=>"current"in e?e.current:e},enabled:(e=!0)=>e,window:(e=(oE.isBrowser?window:void 0))=>e,eventOptions:({passive:e=!0,capture:t=!1}={})=>({passive:e,capture:t}),transform:e=>e},mE=["target","eventOptions","window","enabled","transform"];function vE(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]=vE(e[n],i);break;case"boolean":i&&(r[n]=e[n])}return r}class yE{constructor(e,t){FI(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=PI[e];return e+(r&&r[t]||t)}(t,r),s=OI(OI({},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 bE{constructor(){FI(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 wE{constructor(e){FI(this,"gestures",new Set),FI(this,"_targetEventStore",new yE(this)),FI(this,"gestureEventStores",{}),FI(this,"gestureTimeoutStores",{}),FI(this,"handlers",{}),FI(this,"config",{}),FI(this,"pointerIds",new Set),FI(this,"touchIds",new Set),FI(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(e,t){t.drag&&xE(e,"drag"),t.wheel&&xE(e,"wheel"),t.scroll&&xE(e,"scroll"),t.move&&xE(e,"move"),t.pinch&&xE(e,"pinch"),t.hover&&xE(e,"hover")}(this,e)}setEventIds(e){return DI(e)?(this.touchIds=new Set(VI(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=pE(n,mE);if(r.shared=vE({target:i,eventOptions:o,window:a,enabled:s,transform:l},gE),t){const e=uE.get(t);r[t]=vE(OI({shared:r.shared},c),e)}else for(const e in c){const t=uE.get(e);t&&(r[e]=vE(OI({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=CE(r,i.eventOptions,!!n);if(i.enabled){new(cE.get(t))(this,e,t).bind(o)}}const i=CE(r,t.eventOptions,!!n);for(const t in this.nativeHandlers)i(t,"",r=>this.nativeHandlers[t](OI(OI({},this.state.shared),{},{event:r,args:e})),void 0,!0)}for(const e in r)r[e]=XI(...r[e]);if(!n)return r;for(const e in r){const{device:t,capture:i,passive:o}=jI(e);this._targetEventStore.add(n,t,"",r[e],{capture:i,passive:o})}}}}function xE(e,t){e.gestures.add(t),e.gestureEventStores[t]=new yE(e,t),e.gestureTimeoutStores[t]=new bE}const CE=(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:LI(n,i,u);r&&d&&(h+="Passive"),e[h]=e[h]||[],e[h].push(o)},_E=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function SE(e,t,r,n,i,o){if(!e.has(r)||!cE.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 kE(e,t){const[r,n,i]=function(e){const t={},r={},n=new Set;for(let i in e)_E.test(i)?(n.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,n]}(e),o={};return SE(i,r,"onDrag","drag",o,t),SE(i,r,"onWheel","wheel",o,t),SE(i,r,"onScroll","scroll",o,t),SE(i,r,"onPinch","pinch",o,t),SE(i,r,"onMove","move",o,t),SE(i,r,"onHover","hover",o,t),{handlers:o,config:t,nativeHandlers:n}}function AE({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 IE({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}=tC(),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:z_(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 EE(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}var FE=(e=>(e.topLeft="topLeft",e.topRight="topRight",e.bottomLeft="bottomLeft",e.bottomRight="bottomRight",e))(FE||{});let TE={};const OE=(e={})=>{pC(null),TE=e};function PE({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||fC||(OE({currentRect:EE(n.getBoundingClientRect()),resizeDir:o.dataset.resizeHandle}),!TE.currentRect))return!1;pC("resize"),r?TE.boundaryRect=r:null!=t&&t.current&&(TE.boundaryRect=EE(t.current.getBoundingClientRect())),TE.currentRect&&TE.boundaryRect&&(TE.currentRect.left-=TE.boundaryRect.left,TE.currentRect.top-=TE.boundaryRect.top),TE.initialAspectRatio=TE.currentRect.width/TE.currentRect.height,null==(i=a.onResizeStart)||i.call(a,AE({rect:TE.currentRect,e:e}))},onMove:(t,r,n)=>{var s;if(!TE.resizeDir||!TE.currentRect)return;const l="initial"===e?TE.initialAspectRatio:e,c=function(e,t,r,n){const i={...e},o={...e};return"topRight"===TE.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"===TE.resizeDir?(o.width=Math.floor(o.width+t),o.height=n?Math.floor(o.width/n):Math.floor(o.height+r)):"topLeft"===TE.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"===TE.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}(TE.currentRect,r,n,l),u=function(e,t,r,n){const i="bottomLeft"===TE.resizeDir||"topLeft"===TE.resizeDir,o="topRight"===TE.resizeDir||"topLeft"===TE.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),TE.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,TE.boundaryRect)),n){const e=a.width,t=a.height,r=YC(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,AE({rect:u,e:t,deltaX:r,deltaY:n})),TE.currentRect=c},onMoveEnd:e=>{var t;TE.currentRect&&(null==(t=a.onResizeEnd)||t.call(a,AE({rect:TE.currentRect,e:e}))),OE()}},{domProps:l}=IE(s);return{resizeProps:l}}function ME({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 FE.topLeft:return`${r} ${n} border-l-4 border-t-4 cursor-nwse-resize`;case FE.topRight:return`${o} ${n} border-r-4 border-t-4 cursor-nesw-resize`;case FE.bottomRight:return`${o} ${i} border-r-4 border-b-4 cursor-se-resize`;case FE.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 RE=(e=>(e.top="maskTop",e.right="maskRight",e.bottom="maskBottom",e.left="maskLeft",e))(RE||{});function LE({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 NE({name:t,refs:r}){const n=sf("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 jE(e,t,r){return Math.min(Math.max(e,t),r)}let DE={};function zE({boundaryRef:e,boundaryRect:t,minimumMovement:r,restrictWithinBoundary:n=!0,...i}){const o={minimumMovement:r,onMoveStart:(r,n)=>{var o;if(fC)return!1;DE={currentRect:EE(n.getBoundingClientRect())},pC("move"),t?DE.boundaryRect=t:null!=e&&e.current&&(DE.boundaryRect=EE(e.current.getBoundingClientRect())),DE.currentRect&&DE.boundaryRect&&(DE.currentRect.left-=DE.boundaryRect.left,DE.currentRect.top-=DE.boundaryRect.top),null==(o=i.onMoveStart)||o.call(i,AE({rect:DE.currentRect,e:r}))},onMove:(e,t,r)=>{var o;if(!DE.currentRect)return;const a={...DE.currentRect,left:DE.currentRect.left+t,top:DE.currentRect.top+r},s={...a};DE.boundaryRect&&n&&(s.left=jE(a.left,0,DE.boundaryRect.width-a.width),s.top=jE(a.top,0,DE.boundaryRect.height-a.height)),null==(o=i.onMove)||o.call(i,AE({rect:s,e:e,deltaX:t,deltaY:r})),DE.currentRect=a},onMoveEnd:e=>{var t;DE.currentRect&&(null==(t=i.onMoveEnd)||t.call(i,AE({rect:DE.currentRect,e:e})),pC(null),DE={})}},{domProps:a}=IE(o);return{moveProps:a}}function BE(){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}=zE({boundaryRect:a,onMoveStart:()=>i(!0),onMove:e=>km().crop.drawZone(e.rect),onMoveEnd:()=>i(!1)}),{resizeProps:h}=PE({boundaryRect:a,minHeight:50,minWidth:50,aspectRatio:XC(c),onResizeStart:()=>i(!0),onResize:e=>km().crop.drawZone(e.rect),onResizeEnd:()=>i(!1)});x(()=>{km().crop.registerRefs(r),km().crop.resetCropzone(l)},[l,a]);const f=sf("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",...qx(h,d),ref:e=>r.current.innerZone=e,children:[!(null!=s&&s.hideTopLeft)&&e(ME,{position:FE.topLeft,inset:!0}),!(null!=s&&s.hideTopRight)&&e(ME,{position:FE.topRight,inset:!0}),!(null!=s&&s.hideBottomLeft)&&e(ME,{position:FE.bottomLeft,inset:!0}),!(null!=s&&s.hideBottomRight)&&e(ME,{position:FE.bottomRight,inset:!0}),e(NE,{name:"lineVer1",refs:r}),e(NE,{name:"lineVer2",refs:r}),e(NE,{name:"lineHor1",refs:r}),e(NE,{name:"lineHor2",refs:r})]}),e(LE,{refs:r,position:RE.top}),e(LE,{refs:r,position:RE.left}),e(LE,{refs:r,position:RE.right}),e(LE,{refs:r,position:RE.bottom})]})}const UE=uf(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"})),VE=uf(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"})),HE=uf(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"})),$E=uf(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"})),WE={width:120,height:30},GE=[{name:"Duplicate",icon:UE,onClick:()=>{km().objects.duplicate()}},{name:"Flip",icon:VE,onClick:()=>{km().objects.flipHorizontally()}},{name:"Bring to front",icon:HE,onClick:()=>{km().objects.bringToFront()}},{name:"Delete",icon:$E,onClick:()=>{km().objects.delete()}}],qE=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:GE.map(t=>{const r=t.icon;return e(QA,{size:"sm",className:"w-30 h-30 hover:bg-white/hover",radius:"rounded-none",onClick:t.onClick,children:e(r,{})},t.name)})})});function YE(e,t){const r=km().objects.getActive();if(!r||!e.current)return;const n=e.current,i=cC.fabric.util.degreesToRadians(r.angle??0);let o=Math.round(r.getScaledWidth()*Sm().zoom),a=Math.round(r.getScaledHeight()*Sm().zoom),s=Math.round((r.left??0)*Sm().zoom),l=Math.round((r.top??0)*Sm().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)`,km().canvas.render(),function(e,t){if(!t)return;const r=e.angle||0,n=r>168&&r<188?-30:-15,i=Sm().canvasSize,o=Sm().stageSize,a=WE,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 XE(){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 KE={};function ZE(e){const t=KE.centerX||0,r=KE.centerY||0;return Math.atan2(r-e.pageY,t-e.pageX)-(KE.startAngle||0)}const JE=(e={})=>{pC(null),KE=e};function QE(){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=km().objects.getActive();if(!e||!e.name)return{};const t=Sm().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=km().objects.getActive();mg(t)&&(t.enterEditing(),null==(e=t.hiddenTextarea)||e.focus())}()):d.current=setTimeout(()=>{d.current=null},300)},[]);let{moveProps:f}=zE({boundaryRef:Sm().canvasRef,restrictWithinBoundary:!1,onMoveEnd:()=>{Sm().objects.setActiveIsMoving(!1)},onMove:e=>{Sm().objects.setActiveIsMoving(!0),function(e){const t=e.rect.width/2,r=e.rect.height/2;km().objects.setValues({left:(e.rect.left+t)/Sm().zoom,top:(e.rect.top+r)/Sm().zoom})}(e)}});l.lockMovement&&(f={});const{resizeProps:p}=PE({minWidth:50,minHeight:50,aspectRatio:l.unlockAspectRatio?null:"initial",boundaryRef:l.containWithinCanvas?Sm().canvasRef:void 0,restrictWithinBoundary:!1,onResizeEnd:()=>{Sm().objects.setActiveIsMoving(!1)},onResize:e=>{Sm().objects.setActiveIsMoving(!0),function(e){const t=km().objects.getActive();if(!t)return;const r={};mg(t)?(e.deltaX>0||t.getScaledHeight()>=20&&t.getScaledWidth()>=20)&&(r.fontSize=(t.fontSize||1)+e.deltaX):(t.width&&(r.scaleX=e.rect.width/Sm().zoom/t.width),t.height&&(r.scaleY=e.rect.height/Sm().zoom/t.height)),km().objects.setValues(r)}(e)}}),{rotateProps:g}=function(e){const t={onMoveStart:(t,r)=>{var n,i;if(!t.target.dataset.rotateHandle||fC)return!1;const o=EE(r.getBoundingClientRect());if(!o)return!1;const a=null==(n=r.style.transform.match(/rotate\((.+?)\)/))?void 0:n[1],[s="0"]=a?a.split(","):[];JE({currentRect:o,centerX:o.left+o.width/2,centerY:o.top+o.height/2,startAngle:parseFloat(s)}),pC("rotate"),KE.startAngle=ZE(t),null==(i=e.onRotateStart)||i.call(e,AE({rect:o,e:t}))},onMove:(t,r,n)=>{var i;if(!KE.currentRect)return;const o={...KE.currentRect};o.angle=ZE(t),o.left+=r,o.top+=n,null==(i=e.onRotate)||i.call(e,AE({rect:o,e:t,deltaX:r,deltaY:n})),KE.currentRect=o},onMoveEnd:t=>{var r;KE.currentRect&&(null==(r=e.onRotateEnd)||r.call(e,AE({rect:KE.currentRect,e:t}))),JE()}},{domProps:r}=IE(t);return{rotateProps:r}}({boundaryRef:Sm().canvasRef,onRotateEnd:()=>{Sm().objects.setActiveIsMoving(!1)},onRotate:e=>{Sm().objects.setActiveIsMoving(!0),function(e){const t=km().objects.getActive();if(!t||!e.rect.angle)return;const r=cC.fabric.util.radiansToDegrees(e.rect.angle);r!==t.angle&&km().objects.setValues({angle:r})}(e)}});return a(()=>{Am()&&Sm().editor.on("object:modified",e=>{e.sizeOrPositionChanged&&YE(r,n)})},[]),a(()=>{YE(r,n)},[i,s,o]),t("div",{className:i&&!o?"block":"hidden",children:[t("div",{ref:r,...qx(g,p,f),onClick:h,className:"absolute z-obj-box border-2 border-white shadow-md cursor-move",children:[!l.hideTopLeft&&e(ME,{position:FE.topLeft}),!l.hideTopRight&&e(ME,{position:FE.topRight}),!l.hideBottomLeft&&e(ME,{position:FE.bottomLeft}),!l.hideBottomRight&&e(ME,{position:FE.bottomRight}),!l.hideRotatingPoint&&e(XE,{})]}),e(qE,{ref:n})]})}function eF(){const r=_m(e=>e.activeTool===of.CROP),n=_m(e=>e.objects.active.id);return t("div",{children:[r&&e(BE,{}),n&&e(QE,{})]})}const tF=function(e){return e.forEach(dE),function(e,t){const{handlers:r,nativeHandlers:n,config:o}=kE(e,t||{});return function(e,t={},r,n){const o=i.useMemo(()=>new wE(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)}}([hE,fE]),rF=i.forwardRef((r,n)=>{const[i,s]=o(!1);a(()=>_m.subscribe(e=>e.loading,e=>{s(!e)}),[]);return e(nF,{children:t(kx.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(${EC("images/empty-canvas-bg.png")})`},children:[e(eF,{}),e("canvas",{ref:n})]})})});function nF({children:t}){const r=u(null),n=tF({onPinch:e=>{if(!km().zoom.allowUserZoom||!iF(e))return e.cancel();1===e.direction[0]?km().zoom.zoomIn(.01):km().zoom.zoomOut(.01),e.event.stopPropagation(),e.event.preventDefault()},onDrag:e=>{if(e.pinching||!iF(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 iF(e){return!(Am().findTarget(e.event,!1)||Am().isDrawingMode)}function oF({actionBtn:r,children:n,className:i}){return t("div",{className:sf(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 aF(){return(aF=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 sF(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 lF(e){var t=u(e),r=u(function(e){t.current&&t.current(e)});return t.current=e,r.current}var cF=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e<t?t:e},uF=function(e){return"touches"in e},dF=function(e){return e&&e.ownerDocument.defaultView||self},hF=function(e,t,r){var n=e.getBoundingClientRect(),i=uF(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:cF((i.pageX-(n.left+dF(e).pageXOffset))/n.width),top:cF((i.pageY-(n.top+dF(e).pageYOffset))/n.height)}},fF=function(e){!uF(e)&&e.preventDefault()},pF=i.memo(function(e){var t=e.onMove,r=e.onKey,n=sF(e,["onMove","onKey"]),o=u(null),s=lF(t),l=lF(r),c=u(null),h=u(!1),f=d(function(){var e=function(e){fF(e),(uF(e)?e.touches.length>0:e.buttons>0)&&o.current?s(hF(o.current,e,c.current)):r(!1)},t=function(){return r(!1)};function r(r){var n=h.current,i=dF(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&&(fF(n),t=n,(!h.current||uF(t))&&i)){if(uF(n)){h.current=!0;var a=n.changedTouches||[];a.length&&(c.current=a[0].identifier)}i.focus(),s(hF(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",aF({},n,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:o,onKeyDown:g,tabIndex:0,role:"slider"}))}),gF=function(e){return e.filter(Boolean).join(" ")},mF=function(e){var t=e.color,r=e.left,n=e.top,o=void 0===n?.5:n,a=gF(["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}}))},vF=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r},yF=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?vF(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?vF(parseInt(e.substring(6,8),16)/255,2):1}},bF=function(e){var t=function(e){var t=e.s,r=e.v,n=e.a,i=(200-t)*r/100;return{h:vF(e.h),s:vF(i>0&&i<200?t*r/100/(i<=100?i:200-i)*100:0),l:vF(i/2),a:vF(n,2)}}(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},wF=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:vF(255*[n,s,a,a,l,n][c]),g:vF(255*[l,n,n,s,a,a][c]),b:vF(255*[a,a,l,n,n,s][c]),a:vF(i,2)}},xF=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},CF=function(e){var t=e.r,r=e.g,n=e.b,i=e.a,o=i<1?xF(vF(255*i)):"";return"#"+xF(t)+xF(r)+xF(n)+o},_F=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:vF(60*(s<0?s+6:s)),s:vF(o?a/o*100:0),v:vF(o/255*100),a:i}},SF=i.memo(function(e){var t=e.hue,r=e.onChange,n=gF(["react-colorful__hue",e.className]);return i.createElement("div",{className:n},i.createElement(pF,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:cF(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":vF(t),"aria-valuemax":"360","aria-valuemin":"0"},i.createElement(mF,{className:"react-colorful__hue-pointer",left:t/360,color:bF({h:t,s:100,v:100,a:1})})))}),kF=i.memo(function(e){var t=e.hsva,r=e.onChange,n={backgroundColor:bF({h:t.h,s:100,v:100,a:1})};return i.createElement("div",{className:"react-colorful__saturation",style:n},i.createElement(pF,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:cF(t.s+100*e.left,0,100),v:cF(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+vF(t.s)+"%, Brightness "+vF(t.v)+"%"},i.createElement(mF,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:bF(t)})))}),AF=function(e,t){if(e===t)return!0;for(var r in e)if(e[r]!==t[r])return!1;return!0};var IF,EF=typeof window<"u"?x:a,FF=new Map,TF=function(e){EF(function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!FF.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}',FF.set(t,r);var n=typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0;n&&r.setAttribute("nonce",n),t.head.appendChild(r)}},[])},OF=function(e){var t=e.className,r=e.colorModel,n=e.color,s=void 0===n?r.defaultColor:n,l=e.onChange,d=sF(e,["className","colorModel","color","onChange"]),h=u(null);TF(h);var f=function(e,t,r){var n=lF(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;AF(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=gF(["react-colorful",t]);return i.createElement("div",aF({},d,{ref:h,className:m}),i.createElement(kF,{hsva:p,onChange:g}),i.createElement(SF,{hue:p.h,onChange:g,className:"react-colorful__last-control"}))},PF={defaultColor:"000",toHsva:function(e){return _F(yF(e))},fromHsva:function(e){return function(e){return CF(wF(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||AF(yF(e),yF(t))}},MF=function(e){return i.createElement(OF,aF({},e,{colorModel:PF}))},RF=/^#?([0-9A-F]{3,8})$/i,LF=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=sF(e,["color","onChange","onBlur","escape","validate","format","process"]),p=o(function(){return l(r)}),g=p[0],m=p[1],v=lF(n),y=lF(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",aF({},f,{value:d?d(g):g,spellCheck:"false",onChange:b,onBlur:w}))},NF=function(e){return"#"+e},jF=function(e){var t=e.prefixed,r=e.alpha,n=sF(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(LF,aF({},n,{escape:o,format:t?NF:void 0,process:NF,validate:a}))};IF={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:"Алфа",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={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 BF;BF={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 UF;UF={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 VF;VF={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 HF;HF={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 $F;$F={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 WF;WF={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 GF;GF={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 qF;qF={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 YF;YF={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:"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 KF;KF={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 ZF;ZF={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 JF;JF={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 QF;QF={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 eT;eT={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 tT;tT={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 rT;rT={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 nT;nT={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 iT;iT={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 oT;oT={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 aT;aT={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 sT;sT={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 lT;lT={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 cT;cT={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 uT;uT={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 dT;dT={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 hT;hT={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 fT;fT={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 pT;pT={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 gT;gT={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 mT;mT={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 vT;vT={"ar-AE":IF,"bg-BG":DF,"cs-CZ":zF,"da-DK":BF,"de-DE":UF,"el-GR":VF,"en-US":HF,"es-ES":$F,"et-EE":WF,"fi-FI":GF,"fr-FR":qF,"he-IL":YF,"hr-HR":XF,"hu-HU":KF,"it-IT":ZF,"ja-JP":JF,"ko-KR":QF,"lt-LT":eT,"lv-LV":tT,"nb-NO":rT,"nl-NL":nT,"pl-PL":iT,"pt-BR":oT,"pt-PT":aT,"ro-RO":sT,"ru-RU":lT,"sk-SK":cT,"sl-SI":uT,"sr-SP":dT,"sv-SE":hT,"tr-TR":fT,"uk-UA":pT,"zh-CN":gT,"zh-TW":mT};const yT=Symbol.for("react-aria.i18n.locale"),bT=Symbol.for("react-aria.i18n.strings");let wT;class xT{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[yT];if(void 0===wT){let e=window[bT];if(!e)return null;wT={};for(let r in e)wT[r]=new xT({[t]:e[r]},t)}let r=null==wT?void 0:wT[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 CT=new Map,_T=new Map;class ST{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=CT.get(i);return o||(o=new Intl.PluralRules(this.locale,{type:r}),CT.set(i,o)),n=t[o.select(e)]||t.other,"function"==typeof n?n():n}number(e){let t=_T.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),_T.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 kT=new Map,AT=!1;try{AT="exceptZero"===new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay}catch{}let IT=!1;try{IT="unit"===new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style}catch{}const ET={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class FT{format(e){let t="";if(t=AT||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&&!IT){var r;let{unit:e,unitDisplay:n="short",locale:i}=this.resolvedOptions();if(!e)return t;let o=null===(r=ET[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!AT&&null!=this.options.signDisplay&&(e={...e,signDisplay:this.options.signDisplay}),!IT&&"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&&!IT){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=ET[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(kT.has(i))return kT.get(i);let o=new Intl.NumberFormat(e,t);return kT.set(i,o),o}(e,t),this.options=t}}let TT=new xT(function(e){return e&&e.__esModule?e.default:e}(vT));const OT=[[0,"pink"],[15,"red"],[48,"orange"],[94,"yellow"],[135,"green"],[175,"cyan"],[264,"blue"],[284,"purple"],[320,"magenta"],[349,"pink"]];class PT{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(xT.getGlobalDictionaryForPackage("@react-stately/color")||TT).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]=zT(this),o=xT.getGlobalDictionaryForPackage("@react-stately/color")||TT;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 ST(e,o);if(l<1){let r=new FT(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=xT.getGlobalDictionaryForPackage("@react-stately/color")||TT;if(t<.001)return[i.getStringForLocale("gray",n),e];for(let t=0;t<OT.length;t++){let[o,a]=OT[t],[s,l]=OT[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]=zT(this),[i]=this.getOklchHue(t,r,n,e);return i}}class MT extends PT{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)=>aC(e,0,t<3?255:1))),t.length<3?void 0:new MT(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 LT(lC(360*s,2),lC(100*a,2),lC(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 DT(lC(360*s,2),lC(100*l,2),lC(100*o,2),this.alpha)}clone(){return new MT(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 FT(t,r).format(n)}getColorSpace(){return"rgb"}getColorChannels(){return MT.colorChannels}constructor(e,t,r,n){super(),this.red=e,this.green=t,this.blue=r,this.alpha=n}}MT.colorChannels=["red","green","blue"];const RT=/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 LT extends PT{static parse(e){let t;if(t=e.match(RT)){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 LT(jT(e,360),aC(n,0,100),aC(i,0,100),aC(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}, ${lC(this.saturation,2)}%, ${lC(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${lC(this.saturation,2)}%, ${lC(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 DT(lC(this.hue,2),lC(100*e,2),lC(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 MT(Math.round(255*n(5)),Math.round(255*n(3)),Math.round(255*n(1)),this.alpha)}clone(){return new LT(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 FT(t,r).format(n)}getColorSpace(){return"hsb"}getColorChannels(){return LT.colorChannels}constructor(e,t,r,n){super(),this.hue=e,this.saturation=t,this.brightness=r,this.alpha=n}}LT.colorChannels=["hue","saturation","brightness"];const NT=/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 jT(e,t){return(e%t+t)%t}class DT extends PT{static parse(e){let t;if(t=e.match(NT)){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 DT(jT(e,360),aC(n,0,100),aC(i,0,100),aC(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}, ${lC(this.saturation,2)}%, ${lC(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${lC(this.saturation,2)}%, ${lC(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 LT(lC(this.hue,2),lC(100*e,2),lC(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 MT(Math.round(255*i(0)),Math.round(255*i(8)),Math.round(255*i(4)),this.alpha)}clone(){return new DT(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 FT(t,r).format(n)}getColorSpace(){return"hsl"}getColorChannels(){return DT.colorChannels}constructor(e,t,r,n){super(),this.hue=e,this.saturation=t,this.lightness=r,this.alpha=n}}function zT(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[BT(e),BT(t),BT(r)]}(r,n,i);let[o,a,s]=function(e,t,r){return UT([.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]=UT(n,e,t,r);return UT(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 BT(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 UT(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]}DT.colorChannels=["hue","saturation","lightness"];function VT({onChange:t,value:r,colors:n}){const i=n.map(n=>{const i=r===n;return e(B_,{onClick:()=>{null==t||t(n)},className:sf("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 HT=[{color:"rgb(255, 255, 255)",name:Zh("White")},{color:"rgb(239,245,245)",name:Zh("Solitude")},{color:"rgb(245,213,174)",name:Zh("Wheat")},{color:"rgb(253,227,167)",name:Zh("Cape Honey")},{color:"rgb(242,222,186)",name:Zh("Milk punch")},{color:"rgb(97,118,75)",name:Zh("Dingy"),foreground:"rgb(255, 255, 255)"},{color:"rgb(4, 147, 114)",name:Zh("Aquamarine"),foreground:"rgb(255, 255, 255)"},{color:"rgb(222,245,229)",name:Zh("Cosmic Latte")},{color:"rgb(233,119,119)",name:Zh("Geraldine"),foreground:"rgb(90,14,14)"},{color:"rgb(247,164,164)",name:Zh("Sundown")},{color:"rgb(30,139,195)",name:Zh("Pelorous"),foreground:"rgb(255, 255, 255)"},{color:"rgb(142,68,173)",name:Zh("Deep Lilac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(108,74,182)",name:Zh("Blue marguerite"),foreground:"rgb(255, 255, 255)"},{color:"rgb(139,126,116)",name:Zh("Americano"),foreground:"rgb(255, 255, 255)"},{color:"rgb(0,0,0)",name:Zh("Black"),foreground:"rgb(255, 255, 255)"},{color:"rgb(64,66,88)",name:Zh("Blue zodiac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(101,100,124)",name:Zh("Comet"),foreground:"rgb(255, 255, 255)"}].map(({color:e})=>e).slice(0,14);function $T({defaultValue:r,onChange:n,colorPresets:i,showInput:a}){const[s,l]=o(r),c=i||HT,u=DA({size:"sm"});return t("div",{children:[e(MF,{className:"!w-auto",color:s,onChange:e=>{null==n||n(e),l(e)}}),t("div",{className:"px-12 py-20",children:[c&&e(VT,{colors:c,onChange:e=>{if(e){const t=function(e){let t=MT.parse(e)||LT.parse(e)||DT.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(jF,{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 WT=i.createContext(null);function GT(){return l(WT)}function qT(){const{lines:e,localeCode:t}=oA();return{trans:c(r=>YT({...r,lines:e,localeCode:t}),[e,t])}}const YT=K_(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=aA(i,e),Object.entries(n).forEach(([e,t])=>{r=r.replace(`:${e}`,`${t}`)})),r)},{equals:iA,callTimeout:0});function XT({onDismiss:t}){const{trans:r}=qT();return e("button",{className:"sr-only","aria-label":r(Zh("Dismiss")),tabIndex:-1,onClick:()=>{t&&t()}})}function KT(r){const{type:n="modal",dialogProps:i,...o}=l(WT),{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(XT,{onDismiss:o.close}));const g="fullscreenTakeover"===c||"tray"===n,y=sf("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",{...qx({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 ZT=uf(e("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDownOutlined"),JT=p(({children:r,autoFocus:n=!1,restoreFocus:i=!0,isDismissable:o=!0,isOpen:a=!1,placement:s="center",onClose:l},c)=>{const u=Zk(),d=rC(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(rA,{onClick:()=>{o&&l()}},"modal-underlay"),e(kx.div,{ref:d,className:sf("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(Lk,{restoreFocus:i,autoFocus:n,contain:!0,children:r})})]})});function QT(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),[k,A]=oC(r.isOpen,r.defaultIsOpen,r.onOpenChange),[I,E]=oC(r.value,r.defaultValue,r.onValueChange);mA()&&"popover"===i&&(i=v||"modal");const F=u(null),{x:T,y:O,reference:P,strategy:M,refs:R}=gk({...r,disablePositioning:"modal"===i}),L="popover"===i?{position:M,top:O??"",left:T??""}:{},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=I);const t=typeof e<"u"?e:S.current;null==B||B(t,{initialValue:S.current,valueChanged:t!==S.current}),A(!1)},[B,A,I,x]),V=c(()=>{A(!0),S.current=r.value},[r.value,A]);Nx(()=>{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 $;$="modal"===i?JT:"tray"===i?nA:Qk;const W=d(()=>({dialogProps:H,type:i,labelId:j,descriptionId:D,isDismissable:s,close:U,value:I,initialValue:S.current,setValue:E,formId:z}),[U,D,H,z,j,i,s,I,E]);f=f&&"popover"===i;const G={onPointerEnter:z_(e=>{V()}),onPointerLeave:z_(e=>{F.current=setTimeout(()=>{U()},150)})},q={onPointerEnter:z_(e=>{F.current&&clearTimeout(F.current)}),onPointerLeave:z_(e=>{U()})},Y={onContextMenu:z_(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:z_(e=>{e.stopPropagation(),k?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,W),J=e(Px,{initial:!o,children:k&&e(WT.Provider,{value:W,children:e($,{...f?q:{},ref:R.setFloating,triggerRef:R.reference,style:L,restoreFocus:h,autoFocus:l,isOpen:k,onClose:U,isDismissable:s,isContextMenu:p,placement:r.placement,children:Z})})});return t(y,{children:[K&&w(K,qx({..._||p?{}:{ref:P},...p?{}:X,...f?G:{},...p?Y:{}},{...K.props})),g?mm&&Fe(J,mm):J]})}function eO(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=DA({size:l}),[h,f]=o(a),[p,g]=o(!1);return t("div",{className:sf(i,c),children:[n&&e("span",{className:d.label,children:n}),t(QT,{type:"popover",isOpen:p,onOpenChange:g,children:[t(B_,{className:sf(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(tO,{isActive:p,className:d.adornment})]}),e(KT,{size:"auto",children:e($T,{onChange:e=>{f(e),null==s||s(e)},defaultValue:h,colorPresets:u})})]})]})}function tO({isActive:t,className:r}){return e(ZT,{size:"sm",className:`transition-transform ml-auto flex-shrink-0 ${t?"rotate-180":"rotate-0"} ${r}`})}function rO(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:k,getValueLabel:A}=c;let I="",E=Math.max([...x.format(C)].length,[...x.format(_)].length,[...x.format(S)].length);A?I=A(k[0]):1===k.length?I=m(0):2===k.length&&(I=`${m(0)} – ${m(1)}`,E=3+2*Math.max(E,[...x.format(C)].length,[...x.format(_)].length));const F=DA({size:n,disabled:w,labelDisplay:"flex"}),T=sf("touch-none",s,l,{"flex items-center":i});return t("div",{className:T,role:"group",id:y,children:[(o||a)&&t("div",{className:sf(F.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:E?{width:`${E}ch`,minWidth:`${E}ch`}:void 0,children:I})]}),t("div",{ref:p,className:sf("relative",nO(r)),...f,role:"presentation",children:[e("div",{className:sf("absolute inset-0 m-auto rounded",oO(d,w),iO(n))}),e("div",{className:sf("absolute inset-0 my-auto rounded",aO(h,w),iO(n)),style:{width:`${Math.max(100*g(0),0)}%`}}),u]})]})}function nO({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 iO(e){switch(e){case"xs":return"h-2";case"sm":return"h-3";default:return"h-4"}}function oO(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 aO(e,t){switch(t&&(e="disabled"),e){case"disabled":return"bg-slider-disabled";case"primary":return"bg-primary";default:return e}}function sO(e={}){const{localeCode:t}=oA();return d(()=>new FT(t,e),[t,e])}function lO({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=sO(i),{addGlobalListener:y,removeGlobalListener:w}=tC(),x=u(null),[C,_]=oC(p.value?p.value:void 0,p.defaultValue??[e],p.onChange),S=u(null);S.current=C;const[k,A]=o(new Array(C.length).fill(!1)),I=u(null);I.current=k;const E=t=>0===t?e:C[t-1],F=e=>e===C.length-1?t:C[e+1],T=(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=sC(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(sC(r/n,n))*n):o<t?o=t:!isNaN(r)&&o>r&&(o=t+Math.floor(sC((r-t)/n,n))*n),o=sC(o,n),o}(t,E(e),F(e),n),S.current=cO(S.current,e,t),_(S.current)},O=(e,t)=>{var n;if(r||!j(e))return;const i=null==(n=I.current)?void 0:n[e];I.current=cO(I.current||[],e,t),A(I.current),a&&i&&!I.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=>jE((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}=IE({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)=>!k[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),T(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=jE(B.current/n,0,1);((e,t)=>{T(e,L(t))})(D.current,e)}},onMoveEnd(){null!=D.current&&(O(D.current,!1),D.current=null)}}),V=qx(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))},$=b(),W=l?`${$}-label`:void 0,G=`${$}-group`,q=[...Array(C.length)].map((e,t)=>`${$}-thumb-${t}`);return{domProps:V,trackRef:x,isDisabled:r,step:n,values:C,minValue:e,maxValue:t,focusedThumb:P,labelId:W,groupId:G,thumbIds:q,numberFormatter:v,getThumbPercent:R,getThumbMinValue:E,getThumbMaxValue:F,getThumbValueLabel:e=>function(e){return v.format(e)}(C[e]),isThumbDragging:e=>{var t;return(null==(t=I.current)?void 0:t[e])||!1},setThumbValue:T,updateDraggedThumbs:O,setThumbEditable:(e,t)=>{N.current[e]=t},setFocusedThumb:M,getValueLabel:c,isPointerOver:g,showThumbOnHoverOnly:d,thumbSize:h}}function cO(e,t,r){return e[t]===r?e:[...e.slice(0,t),r,...e.slice(t+1)]}function uO({index:t,slider:r,isDisabled:n,ariaLabel:i,inputRef:o,onBlur:s,fillColor:l="primary"}){const d=rC(o),{addGlobalListener:h,removeGlobalListener:f}=tC(),{step:p,values:g,focusedThumb:m,labelId:v,thumbIds:y,isDisabled:b,getThumbPercent:w,getThumbMinValue:x,getThumbMaxValue:C,getThumbValueLabel:_,setThumbValue:S,updateDraggedThumbs:k,isThumbDragging:A,setThumbEditable:I,setFocusedThumb:E,isPointerOver:F,showThumbOnHoverOnly:T,thumbSize:O="w-18 h-18"}=r,P=A(t),M=g[t];I(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(),k(t,!1),f(window,"pointerup",D,!1))},z=sf("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:sf("hover:bg-primary-dark",t?"bg-primary-dark":"bg-primary")}({fillColor:l,isDisabled:R,isDragging:P}),!T||T&&P||F?"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,k(t,!0),h(window,"pointerup",D,!1))},children:e("input",{id:y[t],onKeyDown:z_(()=>{k(t,!0)}),onKeyUp:z_(()=>{k(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:()=>{E(t)},onBlur:e=>{E(void 0),k(t,!1),null==s||s(e)},onChange:e=>{S(t,parseFloat(e.target.value))},type:"range",className:"sr-only"})})}function dO({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=lO(c);return e(rO,{...c,slider:u,children:e(uO,{fillColor:n.fillColor,index:0,slider:u,inputRef:t,onBlur:r})})}const hO=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=jE(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=sO({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:sf("progress-circle",u,p,l&&"indeterminate",c),children:[e("div",{className:sf(p,d,"rounded-full border-4")}),t("div",{className:sf("fills absolute left-0 top-0 h-full w-full",l&&"progress-circle-fills-animate"),children:[e(fO,{circleSize:p,subMaskStyle:y,isIndeterminate:l,className:"rotate-180",fillColor:h,subMaskClassName:sf(l&&"progress-circle-fill-submask-1-animate")}),e(fO,{circleSize:p,subMaskStyle:b,isIndeterminate:l,fillColor:h,subMaskClassName:sf(l&&"progress-circle-fill-submask-2-animate")})]})]})});function fO({subMaskStyle:t,subMaskClassName:r,className:n,circleSize:i,isIndeterminate:o,fillColor:a}){return e("div",{className:sf("absolute h-full w-1/2 origin-[100%] overflow-hidden",n),children:e("div",{className:sf("h-full w-full origin-[100%] rotate-180 overflow-hidden",!o&&"transition-transform duration-100",r),style:t,children:e("div",{className:sf(i,a,"rounded-full border-4")})})})}function pO({isLoading:t,icon:r}){const n=u(null),{trans:i}=qT(),[s,l]=o(!1),{state:{isOpen:c,inputValue:d}}=$_(),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(hO,{"aria-label":i({message:"Loading"}),size:"sm",isIndeterminate:!0}):r||e(ZT,{})}const gO=i.forwardRef(function(r,n){const i=mA(),{hideCaret:o,placeholder:a=e(cA,{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,k=mk({...r,clearInputOnItemSelection:!0,showEmptyMessage:m||v,floatingWidth:_,selectionMode:"single",role:"listbox",virtualFocus:v},n),{state:{selectedValues:A,isOpen:I,setIsOpen:E,activeIndex:F,setSelectedIndex:T,inputValue:O,setInputValue:P},collections:M,focusItem:R,listboxId:L,reference:N,refs:j,listContent:D,onInputChange:z}=k,{fieldProps:B,inputProps:U}=YA({...S,focusRef:j.reference}),V=M.collection.get(A[0]),H=V?t("span",{className:"flex items-center gap-10",children:[V.element.props.startIcon,e("span",{className:sf("overflow-hidden overflow-ellipsis whitespace-nowrap",C),children:V.element.props.children})]}):e("span",{className:"italic",children:a}),$=DA({...r,endAdornment:!0}),{handleTriggerKeyDown:W,handleListboxKeyboardNavigation:G,handleListboxSearchFieldKeydown:q}=fA(k),{findMatchingItem:Y}=gA();return e(uA,{listbox:k,onKeyDownCapture:v?void 0:e=>{if(!I)return;const t=Y(e,D,F);null!=t&&R("increment",t)},onKeyDown:G,onClose:v?()=>P(""):void 0,isLoading:w,searchField:v&&e(XA,{size:"xs"===r.size||"sm"===r.size?"xs":"sm",placeholder:g,startAdornment:e(vA,{}),className:"flex-shrink-0 px-8 pb-8 pt-4",autoFocus:!0,"aria-expanded":I?"true":"false","aria-haspopup":"listbox","aria-controls":I?L:void 0,"aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:"false",value:O,onChange:z,onKeyDown:e=>{q(e)}}),children:e($A,{fieldClassNames:$,...B,endAdornment:!o&&e(pO,{isLoading:w}),children:e("button",{...U,type:"button","data-selected-value":null==V?void 0:V.value,"aria-expanded":I?"true":"false","aria-haspopup":"listbox","aria-controls":I?L:void 0,ref:N,onKeyDown:W,onKeyDownCapture:v?void 0:e=>{if(I)return;const t=Y(e,D,F);null!=t&&T(t)},disabled:S.disabled,onClick:()=>{E(!I)},className:sf($.input,!B.unstyled&&f),children:H})})})});function mO(){const t=_m(e=>e.filter.selected);if(!t)return null;const r=km().filter.getByName(t).options,n=(e,r)=>{var n;null==(n=km().filter)||n.applyValue(t,e,r),Sm().setDirty(!0)},i=km().canvas.getMainImage().filters,o=km().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(dO,{label:e("span",{className:"capitalize",children:e(cA,{...jC[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(eO,{label:e(cA,{...jC[t]}),size:"sm",width:"w-full",value:o,onChange:e=>{n(t,e)}}):"select"===r.type&&(i=e(gO,{selectionMode:"single",size:"sm",label:e(cA,{...jC[t]}),defaultValue:o,onSelectionChange:e=>{n(t,e)},children:r.available.map(t=>e(Y_,{value:t.key,children:e("span",{className:"capitalize",children:e(cA,{message:t.key})})},t.key))})),e("div",{className:"pb-10",children:i},t)});return e(oF,{children:e("div",{className:"max-w-240 pt-10 mx-auto",children:t})})}return null}function vO(){const r=_m(e=>e.frame.active),n="basic"===(null==r?void 0:r.mode),i=c(e=>`${e}%`,[]);return e(oF,{className:"pb-18 pt-6",children:t("div",{className:"max-w-288 m-auto",children:[n&&e(eO,{className:"mb-20",width:"w-full",size:"sm",label:e(cA,{message:"Color"}),value:km().frame.builder.defaultColor,onChange:e=>{km().frame.active.changeColor(e)}}),e(dO,{size:"sm",label:e(cA,{message:"Size"}),step:1,minValue:km().frame.active.getMinSize(),maxValue:km().frame.active.getMaxSize(),defaultValue:km().frame.active.currentSizeInPercent,getValueLabel:i,onChange:e=>{km().frame.resize(e)}})]})})}const yO=i.createContext(null);function bO(){const{tabsRef:t,selectedTab:r}=l(yO),[n,i]=o({width:void 0,transform:void 0,className:void 0});return Nx(()=>{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:sf("absolute bottom-0 left-0 h-2 bg-primary",n.className),role:"presentation",style:{width:n.width,transform:n.transform}})}function wO({children:r,center:n,expand:i,className:o}){const a=m.toArray(r);return e(Lk,{children:t("div",{className:sf("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:sf(e.props.className,i&&"flex-auto",n&&0===t&&"ml-auto",n&&t===a.length-1&&"mr-auto")}):null),e(bO,{})]})})}function xO(t){const{size:r="md",children:n,className:i,isLazy:o,overflow:a="overflow-hidden"}=t,s=u([]),l=b(),[c,h]=oC(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(yO.Provider,{value:f,children:e("div",{className:sf(i,a,"max-w-full"),children:n})})}const CO=uf(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=uf(e("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"}),"FormatStrikethroughOutlined"),SO=uf(e("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),kO=uf(e("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),AO=uf(e("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),IO=uf(e("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined");function EO(){return t("div",{className:"flex gap-20 justify-center",children:[e(FO,{}),e(TO,{}),e(OO,{})]})}function FO(){const t=_m(e=>e.objects.active.editableProps.fontSize)??40,{trans:r}=qT();return e(XA,{type:"number",size:"xs","aria-label":r({message:"Font Size"}),min:1,max:300,className:"w-64 flex-shrink-0",value:t,onChange:e=>{km().objects.setValues({fontSize:e.target.valueAsNumber}),Sm().setDirty(!0)}})}function TO(){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(oI,{size:"xs",variant:"outline",radius:"rounded",value:a,multiple:!0,onChange:e=>{s(e),km().objects.setValues({underline:e.includes("underline"),linethrough:e.includes("linethrough"),fontStyle:e.includes("italic")?"italic":""}),Sm().setDirty(!0)},children:[e(QA,{value:"underline",children:e(CO,{})}),e(QA,{value:"linethrough",children:e(_O,{})}),e(QA,{value:"italic",children:e(SO,{})})]})}function OO(){const r=_m(e=>e.objects.active.editableProps.textAlign);return t(oI,{size:"xs",variant:"outline",radius:"rounded",value:r,onChange:e=>{km().objects.setValues({textAlign:e}),Sm().setDirty(!0)},children:[e(QA,{value:"left",children:e(AO,{})}),e(QA,{value:"center",children:e(IO,{})}),e(QA,{value:"right",children:e(kO,{})})]})}function PO({children:t,className:r}){const{selectedTab:n,isLazy:i}=l(yO),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:sf(e.props.className,"hidden")})}return null});return e("div",{className:r,children:a})}function MO({className:t,children:r,index:n,...i}){const{id:a}=l(yO),[s,c]=o(0),d=u(null);return Nx(()=>{if(null!=d&&d.current){const e=()=>{const e=qk(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:sf(t,"focus-visible:outline-primary-light"),role:"tabpanel",...i,children:r})}const RO=[{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)"}]}],LO=uf(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"),NO=uf(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"),jO=uf(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 DO({property:r}){const{trans:n}=qT(),i=_m(e=>e.objects.active.editableProps[r]);return t("div",{className:"flex items-center justify-center gap-14",children:[e(eO,{className:"flex-shrink-0",size:"xs","aria-label":n({message:"Color"}),value:"string"==typeof i?i:ef.fill,onChange:e=>{km().objects.setValues({[r]:e}),Sm().setDirty(!0)}}),e(zO,{type:"gradient",property:r}),e(zO,{type:"texture",property:r})]})}function zO({type:r,property:n}){return e(y,{children:t(QT,{type:"popover",children:[e(U_,{className:"flex-shrink-0",id:`${r}-panel-trigger`,variant:"outline",size:"xs",startIcon:e("texture"===r?LO:NO,{}),endIcon:e(ZT,{}),children:e("span",{className:"capitalize",children:e(cA,"gradient"===r?{message:"Gradient"}:{message:"Texture"})})}),e(KT,{size:"auto",children:e("div",{className:"grid gap-8 grid-cols-5-min-content p-10 bg-paper rounded shadow-md",children:e(BO,{property:n,type:r})})})]})})}function BO({type:t,property:r}){const{close:n}=GT(),i=Array.from(Array("gradient"===t?RO.length:28).keys()),o="w-56 h-56 bg border shadow-sm hover:scale-110",a=i.map(i=>{const a=EC(`images/${t}s/${i}.png`);return e(B_,{radius:"rounded",className:o,style:{backgroundImage:`url(${a})`},"aria-label":`Select ${t} #${i}`,onClick:async()=>{n();const e="gradient"===t?new cC.fabric.Gradient(RO[i]):await VO(a);km().objects.setValues({[r]:e}),Sm().setDirty(!0)}},i)});return"texture"===t&&a.unshift(e(UO,{property:r,className:o},"upload-btn")),e(y,{children:a})}function UO({className:t,property:r}){const{close:n}=GT();return e(B_,{radius:"rounded",className:t,"aria-label":"Upload an image",onClick:async()=>{const e=await km().import.openUploadWindow();if(n(),e){const t=await VO(await e.data);km().objects.setValues({[r]:t})}},children:e(jO,{className:"icon-md"})})}function VO(e){return new Promise(t=>{cC.fabric.util.loadImage(e,e=>{const r=new cC.fabric.Pattern({source:e,repeat:"repeat"});t(r)})})}function HO(){const t=_m(e=>e.objects.active.editableProps.opacity);return e(dO,{className:"max-w-240 w-full mx-auto","aria-label":"Opacity",value:t,minValue:.1,step:.1,maxValue:1,onChange:e=>{km().objects.setValues({opacity:e}),Sm().setDirty(!0)}})}function $O(){const{trans:r}=qT(),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(eO,{className:"ml-auto flex-shrink-0",size:"xs",value:n,"aria-label":r({message:"Outline Color"}),onChange:e=>{km().objects.setValues({stroke:e}),Sm().setDirty(!0)}}),e(dO,{"aria-label":"Outline Width",className:"max-w-240 mr-auto flex-shrink-0",value:i,onChange:e=>{km().objects.setValues({strokeWidth:e}),Sm().setDirty(!0)}})]})}const WO=uf(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 GO(){return e("div",{className:"flex justify-center",children:e(U_,{type:"button",variant:"outline",size:"xs",startIcon:e(WO,{}),radius:"rounded-full",onClick:async()=>{const e=await km().import.openUploadWindow();if(e){const t=km().objects.getActive();if(t&&"setSrc"in t){const r=await e.data;t.setSrc(r,()=>{wC({src:r}),km().canvas.render()})}}},children:e(cA,{message:"Replace Image"})})})}const qO={color:"rgba(0, 0, 0, 0.6)",blur:3,offsetX:-1,offsetY:0};function YO(){const{trans:r}=qT(),n=_m(e=>e.objects.active.editableProps.shadow)||qO;return t("div",{className:"flex items-center gap-40",children:[e(eO,{className:"ml-auto flex-shrink-0",value:n.color,size:"xs","aria-label":r({message:"Shadow Color"}),onChange:e=>{km().objects.setValues({shadow:XO({color:e})}),Sm().setDirty(!0)}}),e(dO,{"aria-label":"Shadow Blur",className:"max-w-240 mr-auto flex-shrink-0",defaultValue:n.blur,onChange:e=>{km().objects.setValues({shadow:XO({blur:e})}),Sm().setDirty(!0)}})]})}function XO(e){var t;const r=null==(t=km().objects.getActive())?void 0:t.shadow;return r?(Object.entries(e).forEach(([e,t])=>{r[e]=t}),r):new cC.fabric.Shadow({...qO,...e})}function KO({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(yO),m=t===d,v=function(){var e;return null===(e=l(Mk))||void 0===e?void 0:e.focusManager}(),y=o||("sm"===p?"px-12":"px-18"),b=sf("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 ZO(){const r=_m(e=>e.objects.active);return t(xO,{size:"sm",className:"pb-18 pt-6",children:[t(wO,{center:!0,children:[r.isText&&e(KO,{children:e(cA,{message:"Font"})}),!r.isImage&&e(KO,{children:e(cA,{message:"Color"})}),!r.isImage&&e(KO,{children:e(cA,{message:"Background"})}),r.isImage&&e(KO,{children:e(cA,{message:"Image"})}),e(KO,{children:e(cA,{message:"Opacity"})}),e(KO,{children:e(cA,{message:"Outline"})}),e(KO,{children:e(cA,{message:"Shadow"})})]}),t(PO,{className:"pt-16 h-50",children:[r.isText&&e(MO,{children:e(EO,{})},"font"),!r.isImage&&e(MO,{children:e(DO,{property:"fill"})}),!r.isImage&&e(MO,{children:e(DO,{property:"backgroundColor"})}),r.isImage&&e(MO,{children:e(GO,{})}),e(MO,{children:e(HO,{})}),e(MO,{children:e($O,{})}),e(MO,{children:e(YO,{})})]})]})}function JO(){const t=!mA()&&e(U_,{size:"sm",color:"primary",variant:"outline",onClick:()=>{km().text.add(),Sm().setDirty(!0)},children:e(cA,{message:"New Text"})});return e(oF,{actionBtn:t,children:e(ZO,{})})}const QO=uf(e("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownwardOutlined"),eP={};let tP=!1,rP=null,nP=null;const iP=e=>{var t;for(const r in eP)r!==e&&(null==(t=eP[r])||t.call(eP,!0),delete eP[r])},oP=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:k}=gk({placement:i,offset:s,ref:g,showArrow:!0}),[A,I]=o(!1),E=b(),F=u(),T=()=>{clearTimeout(F.current),F.current=void 0,iP(E),eP[E]=O,tP=!0,I(!0),rP&&(clearTimeout(rP),rP=null),nP&&(clearTimeout(nP),nP=null)},O=c(e=>{e?(clearTimeout(F.current),F.current=void 0,I(!1)):F.current||(F.current=setTimeout(()=>{F.current=void 0,I(!1)},500)),rP&&(clearTimeout(rP),rP=null),tP&&(nP&&clearTimeout(nP),nP=setTimeout(()=>{delete eP[E],nP=null,tP=!1},500))},[E]),P=e=>{!e&&d>0&&!F.current?(iP(E),eP[E]=O,A||rP||tP?A||T():rP=setTimeout(()=>{rP=null,tP=!0,T()},d)):T()};a(()=>()=>{clearTimeout(F.current),eP[E]&&delete eP[E]},[E]),a(()=>{const e=e=>{"Escape"===e.key&&O(!0)};if(A)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[A,O]);const M=e(Px,{children:A&&t(kx.div,{...Jk,ref:k.setFloating,id:E,role:"tooltip",onPointerEnter:()=>{P(!0)},onPointerLeave:()=>{O()},className:sf("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,qx({"aria-describedby":A?E: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?mm&&Fe(M,mm):M]})});function aP(){const r=_m(e=>e.activeToolOverlay),n=_m(e=>e.objects.active.id),i=function(t,r){switch(t){case dg.Filter:return e(mO,{});case dg.Frame:return e(vO,{});case dg.Text:return r&&e(JO,{});case dg.ActiveObject:return r&&e(ZO,{});default:return null}}(r,n),[a,s]=o(!0);return t("div",{className:"relative z-tool-overlay text-sm",children:[i&&e("div",{className:sf("absolute right-16 text-muted z-50 transition-all",!a&&"rotate-180",a?"-top-144":"-top-40"),children:e(oP,{label:e(cA,a?{message:"Hide options"}:{message:"Show options"}),children:e(QA,{variant:"outline",radius:"rounded-lg",size:"xs",onClick:()=>{s(!a)},children:e(QO,{})})})}),e(Px,{children:i&&a&&e(kx.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 sP=uf(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 lP({filter:r}){const n=_m(e=>e.filter.applied.includes(r)),i=km().filter.hasOptions(r),o=sf("block flex-shrink-0 rounded",{"text-primary border-primary":n}),a=NC[r],s=t(y,{children:[t("div",{className:"relative",children:[e(cP,{filter:r}),n&&e(uP,{filter:r,hasOptions:i})]}),e("div",{className:"mt-4 text-center text-xs capitalize",children:a?e(cA,{...a}):r})]});return n&&i?e("div",{className:o,children:s}):e(B_,{className:o,onClick:()=>{n?km().filter.remove(r):km().filter.apply(r)},children:s})}function cP({filter:t}){const r=_m(e=>e.filter.selected===t),n=sf("m-auto w-96 h-56 border rounded object-cover",{shadow:r});return e("img",{src:EC(`images/filter/${t}.jpg`),className:n,alt:""})}function uP({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(QA,{color:"primary",size:"md",onClick:()=>{km().filter.remove(r)},children:e(sP,{})}):e(sP,{className:"svg-icon icon-md"}),n&&e(dP,{filter:r,hasOptions:n})]})}function dP({filter:t,hasOptions:r}){return e(QA,{color:"primary",size:"md",onClick:()=>{Sm().activeToolOverlay===dg.Filter&&Sm().filter.selected===t?Sm().setActiveTool(Sm().activeTool,null):Sm().filter.select(t,r)},children:e(ff,{})})}const hP=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:sf("tiny-scrollbar pb-4 overflow-x-auto relative flex items-center",n,r),children:a})});function fP({isFirst:t,isLast:r,children:n,className:i}){const o=sf(i,"flex-shrink-0",{"ml-auto":t,"mr-auto":r});return e("div",{className:o,children:n})}function pP(){const t=_m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.filter)?void 0:r.items})||[];a(()=>{km().filter.syncState()},[]);const r=t.map(t=>e(fP,{children:e(lP,{filter:t})},t));return e(hP,{children:r})}const gP=uf(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"),mP=uf(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"),vP=uf(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"),yP=uf(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"),bP=uf(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"),wP=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=DA({...r,label:o}),_=l||vP,S=u||(h?bP:yP),k=rC(n);qA({autoFocus:v},k),a(()=>{k.current&&(k.current.indeterminate=h||!1)});const[A,I]=oC(r.checked,r.defaultChecked||!1),E=c(e=>{null==m||m(e),I(e.target.checked)},[m,I]),F=sf("select-none",s,p&&"text-danger",!p&&d&&"text-disabled");let T,O=p?"text-danger":null;return h?(T=bP,O=O||"text-primary"):A?(T=S,O=O||"text-primary"):(T=_,O=O||"text-muted"),t("div",{children:[e("label",{className:F,children:t("div",{className:sf("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":A,"aria-invalid":p||void 0,onChange:E,ref:k,required:y,disabled:d,value:b,name:w,"data-testid":x}),e(T,{size:i,className:sf("pointer-events-none",d?"text-disabled":O)}),o&&e("div",{className:sf("first-letter:capitalize",C.size.font,"vertical"===g?"mb-6":"ml-6"),children:o})]})}),f&&e("div",{className:C.error,children:f})]})});function xP(){const{trans:r}=qT(),{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(()=>{Sm().resize.setFormValue({...l})},[l]),a(()=>{Sm().setDirty(!0)},[]);return t("form",{className:"flex items-center justify-center gap-16 w-full",onSubmit:e=>{e.preventDefault(),Sm().applyChanges()},children:[e(XA,{type:"number",min:n,max:s,size:"sm",className:"w-full max-w-112",label:e(cA,{message:"Width"}),value:c.width,onChange:e=>{(e=>{const t={...c,width:e};c.maintainAspect&&(t.height=WC(e,c.usePercentages)),Sm().resize.setFormValue(t)})(e.target.valueAsNumber)}}),e("div",{className:"mt-24",children:e(wP,{size:"md",checked:c.maintainAspect,onChange:e=>{(e=>{const t={...c,maintainAspect:e};e&&(t.height=WC(t.width,t.usePercentages)),Sm().resize.setFormValue(t)})(!c.maintainAspect)},"aria-label":r({message:"Maintain aspect ratio"}),checkedIcon:gP,icon:mP})}),e(XA,{type:"number",min:i,max:o,size:"sm",className:"w-full max-w-112",label:e(cA,{message:"Height"}),value:c.height,onChange:e=>{(e=>{const t={...c,height:e};e&&c.maintainAspect&&(t.width=$C(e,c.usePercentages)),Sm().resize.setFormValue(t)})(e.target.valueAsNumber)}}),e("button",{type:"submit",className:"hidden",children:e(cA,{message:"Resize"})})]})}function CP(){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(fP,{children:t(B_,{onClick:()=>km().crop.resetCropzone(r.ratio),className:"flex flex-col items-center justify-between cursor-pointer h-56",children:[e(_P,{preset:r,selectedRatio:n}),e(SP,{preset:r,selectedRatio:n})]})},r.ratio||r.name));return e(hP,{gap:"gap-18",children:o})}function _P({preset:t,selectedRatio:r}){let n=40,i=30;if(t.ratio){const e=XC(t.ratio);({width:n,height:i}=YC(e,n,i))}const o=sf("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 SP({preset:t,selectedRatio:r}){const n=sf("mt-4 text-center text-xs",{"text-primary":r===t.ratio});return e("div",{className:n,children:t.name?e(cA,{message:t.name}):t.ratio})}const kP=uf(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 AP(){return t("div",{children:[e(QA,{size:"sm",onClick:()=>{km().transform.flip("vertical"),Sm().setDirty(!0)},children:e(kP,{})}),e(QA,{size:"sm",onClick:()=>{km().transform.flip("horizontal"),Sm().setDirty(!0)},children:e(kP,{className:"rotate-90"})})]})}const IP=uf(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"),EP=uf(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 FP(){return t("div",{children:[e(QA,{size:"sm",onClick:()=>{km().transform.rotateLeft(),Sm().setDirty(!0)},children:e(IP,{})}),e(QA,{size:"sm",onClick:()=>{km().transform.rotateRight(),Sm().setDirty(!0)},children:e(EP,{})})]})}function TP(){return t("div",{className:"flex items-center justify-center gap-16",children:[e(AP,{}),e(OP,{}),e(FP,{})]})}function OP(){const r=u(null),{domProps:n,groupId:i,thumbIds:o,trackRef:a,getThumbValueLabel:s}=lO({minValue:-45,maxValue:45,step:1,defaultValue:[Sm().crop.straightenAngle],onChange:e=>{const t=e[0];km().transform.straighten(t),Sm().crop.setTransformAngle(t),Sm().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(PP,{ref:r})]})})}const PP=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 MP(){return a(()=>(Sm().setDirty(!0),km().frame.active.hide(),()=>{km().frame.active.show()}),[]),t("div",{className:"pb-16",children:[e("div",{className:"mb-10",children:e(TP,{})}),e(CP,{})]})}const RP=uf(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 "})),LP=uf(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 "})),NP=uf(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 "})),jP=uf(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 DP(){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(fP,{children:e(QA,{variant:"outline",radius:"rounded-2xl",size:"xl",onClick:()=>{km().shape.addBasicShape(t.name),Sm().setDirty(!0)},children:e(zP,{shape:t})})},t.name));return e(hP,{children:t})}function zP({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(BP[t.name],{className:"w-30 h-30"})}const BP={circle:e(LP,{viewBox:"0 0 32 32"}),square:e(NP,{viewBox:"0 0 32 32"}),triangle:e(jP,{viewBox:"0 0 32 32"}),ellipse:e(RP,{viewBox:"0 0 32 32"})};function UP(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 VP(e,t){if(void 0===e)throw new Error("Unexpected undefined");return e}const HP=(e,t,r)=>{let n;return function(...i){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,i),r)}},$P=e=>e,WP=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},GP=(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)}},qP={passive:!0},YP=typeof window>"u"||"onscrollend"in window,XP=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;let i=0;const o=YP?()=>{}:HP(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,qP),r.addEventListener("scrollend",l,qP),()=>{r.removeEventListener("scroll",s),r.removeEventListener("scrollend",l)}},KP=(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"])},ZP=(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 JP{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:$P,rangeExtractor:WP,onChange:()=>{},measureElement:KP,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=UP(()=>[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=UP(()=>[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=UP(()=>[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=QP(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=UP(()=>[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=UP(()=>[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 VP(t[QP(0,t.length-1,e=>VP(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=VP(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 QP=(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 eM=typeof document<"u"?n.useLayoutEffect:n.useEffect;function tM(e){return function(e){const t=n.useReducer(()=>({}),{})[1],r={...e,onChange:(r,n)=>{var i;n?Te(t):t(),null==(i=e.onChange)||i.call(e,r,n)}},[i]=n.useState(()=>new JP(r));return i.setOptions(r),n.useEffect(()=>i._didMount(),[]),eM(()=>i._willUpdate()),i}({observeElementRect:GP,observeElementOffset:XP,scrollToFn:ZP,...e})}function rM(){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 nM({category:t}){const r=rM(),n=t.name,i=t.list?t.list:Array.from(Array(t.items).keys()),o=u(null),s=tM({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(U_,{variant:"outline",radius:"rounded-xl",size:"md",equalWidth:!0,onClick:async()=>{await km().shape.addSticker(t.name,o),Sm().setDirty(!0)},children:e("img",{className:sf("m-auto m-auto w-28 h-28",t.invertPreview&&(null==r?void 0:r.isDark)&&"invert"),src:JC(t,o),alt:o})})},n.index)})})})})}function iM(){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=Qh[t.name];return e(U_,{size:"xs",color:r?"primary":null,value:t,children:e("span",{className:"capitalize",children:i?e(cA,{...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(oI,{value:n,onChange:e=>i(e),variant:"outline",radius:"rounded-full",className:"mx-auto",children:a})}),n&&e(nM,{category:n})]})}function oM(){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(()=>{Sm().frame.active&&Sm().frame.showOptionsPanel()},[]);const i=r.map(r=>{const i=EC(`images/frames/${r.name}/thumbnail.png`),o=(null==n?void 0:n.name)===r.name;return e(fP,{children:t("button",{type:"button",className:"border-2 overflow-hidden relative rounded border cursor-pointer "+(o?"border-primary":""),onClick:()=>{Sm().setDirty(!0),o?km().frame.remove():km().frame.add(r.name)},children:[o&&e(aM,{}),e("img",{draggable:"false",className:"w-64 h-64",src:i,alt:r.name})]})},r.name)});return e(hP,{children:i})}function aM(){return e("span",{className:"bg-background/70 absolute inset-0 text-primary",children:e(sP,{className:"svg-icon icon-md absolute inset-0 block m-auto"})})}function sM(){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&&PC(t,{prefixSrc:EC,id:"pixie-fonts"}).catch(()=>{})},[t]),a(()=>{km().text.selectOrAddText()&&Sm().setDirty(!0)},[]);const r=(t||[]).map(t=>e(fP,{children:e(lM,{fontConfig:t})},t.family));return e(hP,{className:"pt-6",children:r})}function lM({fontConfig:t}){var r;const n=_m(e=>e.objects.active.editableProps.fontFamily),i=sf("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()=>{km().text.selectOrAddText(),Sm().setDirty(!0),km().objects.setValues({fontFamily:t.family})},children:t.family})}const cM=uf(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 uM(){return a(()=>(km().draw.enable(),()=>{km().draw.disable()}),[]),t(hP,{gap:"gap-16",children:[e(fP,{children:e(eO,{size:"sm",label:e(cA,{message:"Brush Color"}),value:km().draw.currentBrush.color,onChange:e=>{km().draw.setBrushColor(e)}})}),e(fP,{children:e(hM,{})}),e(fP,{children:e(dM,{})})]})}function dM(){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(km().draw.currentBrush.width);return e(gO,{selectionMode:"single",selectedValue:n,onSelectionChange:e=>{i(e),km().draw.setBrushSize(e)},size:"sm",label:e(cA,{message:"Brush Size"}),children:r.map(r=>e(Y_,{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 hM(){const r=_m(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.draw)?void 0:r.brushTypes})||[],n=rM(),[i,a]=o(km().draw.currentBrush.type);return e(gO,{selectionMode:"single",selectedValue:i,onSelectionChange:e=>{a(e),km().draw.setBrushType(e)},size:"sm",label:e(cA,{message:"Brush Type"}),children:r.map(r=>e(Y_,{value:r,children:t("div",{className:"flex items-center",children:["EraserBrush"===r?e(cM,{className:"mr-8"}):e("img",{className:"flex-shrink-0 mr-8 w-24 h-24",src:fM(r,null==n?void 0:n.isDark),alt:""}),e(cA,{message:r.replace(/([A-Z])/g," $1").trim()})]})},r))})}function fM(e,t=!1){return EC(`images/brushes/${t?"white":"black"}/${e.replace("Brush","").toLowerCase()}.png`)}function pM(){const{trans:t}=qT(),r=_m(e=>e.corners.radius);return a(()=>(Sm().setDirty(!0),km().corners.showPreview(),()=>km().corners.hidePreview()),[]),e("div",{className:"max-w-320 mx-auto",children:e(dO,{minValue:1,maxValue:300,label:t({message:"Radius"}),getValueLabel:e=>`${e}px`,onChange:e=>{km().corners.updatePreview(e),Sm().corners.setRadius(e)},value:r})})}const gM={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 mM({activeTool:t}){const r=function(t){switch(t){case of.FILTER:return e(pP,{});case of.RESIZE:return e(xP,{});case of.CROP:return e(MP,{});case of.DRAW:return e(uM,{});case of.TEXT:return e(sM,{});case of.SHAPES:return e(DP,{});case of.STICKERS:return e(iM,{});case of.FRAME:return e(oM,{});case of.CORNERS:return e(pM,{});default:return null}}(t);return e(kx.div,{className:"relative h-full w-full text-sm bg select-none overflow-hidden",...gM,children:r})}function vM({className:t}){const r=_m(e=>e.activeTool);return e("nav",{className:sf("z-navbar min-h-86 flex-shrink-0 px-16 relative overflow-hidden",t),children:e(Px,{initial:!1,children:r?e(mM,{activeTool:r},"tool-controls"):e(yM,{},"nav-items")})})}function yM(){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(kx.div,{className:"w-full h-full bg-inherit",...gM,children:e(hP,{children:t.map(t=>e(fP,{children:e(bM,{item:t})},t.name))})})}function bM({item:r}){const n=Tf[r.name];return t(B_,{variant:"outline",color:"paper",className:"flex-col flex-shrink-0 w-68 h-68",radius:"rounded-2xl",onClick:()=>{"string"==typeof r.action?Om(r.action):"function"==typeof r.action&&r.action(Sm().editor)},children:[e("div",{className:"mb-1",children:e(eI,{className:"icon-md",icon:r.icon})}),e("div",{className:"mt-6 text-xs capitalize max-w-[90%] overflow-hidden overflow-ellipsis",children:n?e(cA,{...n}):r.name})]})}function wM(){const r=_m(e=>e.history.items),n=_m(e=>e.history.pointer);return t(kx.div,{...Jk,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(cA,{message:"History"}),e(QA,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{Sm().togglePanel("history",!1)},children:e(pI,{})})]}),e("div",{className:"p-10",children:r.map(t=>{const o=t.id===r[n].id,a=Ef[t.name],s=a.icon&&i.createElement(a.icon,{className:"icon-sm"});return e(U_,{onClick:()=>{o||km().history.load(t)},variant:"outline",color:o?"primary":null,size:"sm",className:sf("w-full mb-8",o&&"pointer-events-none"),justify:"justify-start",startIcon:s,children:e(cA,{...a.name})},t.id)})})]})}function xM(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(WT);return t("div",{className:sf(i,"flex flex-shrink-0 items-center gap-10",p,h&&"border-b",CM(r),o||"text-main",f),children:[s,e("h3",{id:y,className:sf(g,"mr-auto leading-5 opacity-90"),children:n}),c,v,b&&!u&&e(QA,{"aria-label":"Dismiss",onClick:()=>{a?a():w()},size:m,className:sf("-mr-8 text-muted",c&&"sr-only"),children:e(pI,{})})]})}function CM({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:sf(i,SM(t),"overflow-y-auto overflow-x-hidden overscroll-contain text-sm flex-auto"),children:n})});function SM({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 kM(){const t=_m(e=>e.openPanels.newImage);return e(QT,{isOpen:t,disableInitialTransition:!0,type:"modal",isDismissable:!1,children:e(AM,{})})}function AM(){const[r,n]=o("default");return t(KT,{className:"text-center max-w-max text-main",size:"auto",children:[e(xM,{padding:"px-24 pt-24 pb-12",showDivider:!1,children:e(cA,{message:"Open a photo or design to get started"})}),e(_M,{children:e("default"===r?IM:FM,{setActivePanel:n})})]})}function IM({setActivePanel:n}){return t(r,{children:[e(U_,{className:"mr-20",size:"sm",variant:"raised",color:"primary",onClick:()=>{km().import.uploadAndReplaceMainImage()},children:e(cA,{message:"Open Photo"})}),e(U_,{variant:"outline",size:"sm",color:"primary",onClick:()=>{n("newCanvas")},children:e(cA,{message:"Create New"})}),e(EM,{})]})}function EM(){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(cA,{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 Em(EC(t.url)),Sm().togglePanel("newImage",!1)):(await km().import.openBackgroundImage(EC(t.url)),Sm().togglePanel("newImage",!1))},children:e("img",{className:"w-80 h-80 rounded overflow-hidden transition-shadow hover:shadow-md",src:EC(t.thumbnail),alt:""})})},t.url||t.thumbnail))})]}):null}function FM({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&&(Sm().setConfig({blankCanvasSize:{width:t,height:r}}),km().canvas.openNew(t,r,i),Sm().togglePanel("newImage",!1),km().history.addInitial())},children:[e(XA,{type:"number",label:e(cA,{message:"Width"}),value:n.width,min:1,required:!0,className:"mb-16",onChange:e=>{i({...n,width:e.target.valueAsNumber})}}),e(XA,{type:"number",label:e(cA,{message:"Height"}),value:n.height,min:1,required:!0,className:"mb-16",onChange:e=>{i({...n,height:e.target.valueAsNumber})}}),e(eO,{onChange:e=>{i({...n,bgColor:e})},className:"mb-16",value:n.bgColor,label:e(cA,{message:"Background color"})}),t("div",{className:"text-right",children:[e(U_,{size:"sm",variant:"text",className:"mr-10",onClick:()=>{r("default")},children:e(cA,{message:"Cancel"})}),e(U_,{size:"sm",type:"submit",variant:"raised",color:"primary",children:e(cA,{message:"Create"})})]})]})}const TM=p((r,n)=>{const i=DA(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:sf("text-left",l),children:[o&&e("legend",{className:i.label,children:o}),e("div",{className:sf("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})]})}),OM=p((r,n)=>{const{children:i,autoFocus:o,size:a,invalid:s,isFirst:l,...c}=r,u=rC(n);qA({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:sf("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:sf("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 PM(){const t=_m(e=>e.openPanels.export);return e(QT,{isOpen:t,onOpenChange:e=>{e||Sm().togglePanel("export",!1)},type:"modal",children:e(MM,{})})}function MM(){const[r,n]=o(()=>{var e,t,r,n,i,o;return{filename:(null==(t=null==(e=Sm().config.tools)?void 0:e.export)?void 0:t.defaultName)||"image",format:(null==(n=null==(r=Sm().config.tools)?void 0:r.export)?void 0:n.defaultFormat)||"jpeg",quality:(null==(o=null==(i=Sm().config.tools)?void 0:i.export)?void 0:o.defaultQuality)||.8}});return e(KT,{className:"text-center max-w-max text-main",size:"auto",children:e(_M,{children:t("form",{onSubmit:e=>{e.preventDefault(),km().export.save(r.filename,r.format,r.quality),Sm().togglePanel("export",!1)},children:[e(XA,{required:!0,size:"sm",label:e(cA,{message:"Save As"}),value:r.filename,onChange:e=>{n({...r,filename:e.target.value})}}),t(TM,{size:"sm",className:"my-20","aria-label":"Image format",children:[e(OM,{value:"jpeg",checked:"jpeg"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"JPEG"}),e(OM,{value:"png",checked:"png"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"PNG"}),e(OM,{value:"json",checked:"json"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"JSON"})]}),e(dO,{size:"sm",minValue:.1,step:.1,maxValue:1,value:r.quality,onChange:e=>{n({...r,quality:e})},formatOptions:{style:"percent"},label:e(cA,{message:"Quality"})}),e(U_,{variant:"raised",color:"primary",type:"submit",className:"mt-20 w-full",size:"sm",children:e(cA,{message:"Save"})})]})})})}function RM(){const r=_m(e=>e.objects.all),n=_m(e=>e.objects.active.id);return t(kx.div,{...Jk,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(cA,{message:"Objects"}),e(QA,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{Sm().togglePanel("objects",!1)},children:e(pI,{})})]}),e("div",{className:"p-8",children:r.map(t=>{const r=t.id===n,o=t.name;if(!o)return null;const a=yg[o],s=a.icon&&i.createElement(a.icon,{className:"icon-sm"});return e(U_,{onClick:()=>{r||!t.selectable||km().objects.select(t.id)},variant:"outline",color:r?"primary":null,size:"sm",className:sf("w-full mb-8",(r||!t.selectable)&&"pointer-events-none"),justify:"justify-start",startIcon:s,children:e(cA,{...a.name})},t.id)})})]})}function LM(){const r=_m(e=>e.openPanels.history),n=_m(e=>e.openPanels.objects);return t("div",{className:"z-modal",children:[t(Px,{children:[r&&e(wM,{},"historyPanel"),n&&e(RM,{},"objListPanel")]}),e(kM,{}),e(PM,{})]})}
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 NM(){return NM=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},NM.apply(this,arguments)}var jM,DM;function zM(e,t){if(!1===e||null===e||typeof e>"u")throw new Error(t)}function BM(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 UM(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 VM(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 HM(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 $M(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 WM(e,t,r,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=UM(e):(i=NM({},e),zM(!i.pathname||!i.pathname.includes("?"),HM("?","pathname","search",i)),zM(!i.pathname||!i.pathname.includes("#"),HM("#","pathname","hash",i)),zM(!i.search||!i.search.includes("#"),HM("#","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?UM(e):e;return{pathname:r?r.startsWith("/")?r:VM(r,t):t,search:qM(n),hash:YM(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"}(jM||(jM={})),function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(DM||(DM={}));const GM=e=>e.join("/").replace(/\/\/+/g,"/"),qM=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",YM=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",XM=["post","put","patch","delete"];new Set(XM);const KM=["get",...XM];
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 ZM(){return ZM=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},ZM.apply(this,arguments)}new Set(KM);const JM=n.createContext(null),QM=n.createContext(null),eR=n.createContext(null),tR=n.createContext({outlet:null,matches:[],isDataRoute:!1});function rR(){return null!=n.useContext(eR)}function nR(){return rR()||zM(!1),n.useContext(eR).location}function iR(e){n.useContext(QM).static||n.useLayoutEffect(e)}function oR(){let{isDataRoute:e}=n.useContext(tR);return e?function(){let{router:e}=function(){let e=n.useContext(JM);return e||zM(!1),e}(sR.UseNavigateStable),t=function(){let e=function(){let e=n.useContext(tR);return e||zM(!1),e}(),t=e.matches[e.matches.length-1];return t.route.id||zM(!1),t.route.id}(lR.UseNavigateStable),r=n.useRef(!1);return iR(()=>{r.current=!0}),n.useCallback(function(n,i){void 0===i&&(i={}),r.current&&("number"==typeof n?e.navigate(n):e.navigate(n,ZM({fromRouteId:t},i)))},[e,t])}():function(){rR()||zM(!1);let e=n.useContext(JM),{basename:t,future:r,navigator:i}=n.useContext(QM),{matches:o}=n.useContext(tR),{pathname:a}=nR(),s=JSON.stringify($M(o,r.v7_relativeSplatPath)),l=n.useRef(!1);return iR(()=>{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=WM(r,JSON.parse(s),a,"path"===n.relative);null==e&&"/"!==t&&(o.pathname="/"===o.pathname?t:GM([t,o.pathname])),(n.replace?i.replace:i.push)(o,n.state,n)},[t,i,s,a,e])}()}function aR(e,t){let{relative:r}=void 0===t?{}:t,{future:i}=n.useContext(QM),{matches:o}=n.useContext(tR),{pathname:a}=nR(),s=JSON.stringify($M(o,i.v7_relativeSplatPath));return n.useMemo(()=>WM(e,JSON.parse(s),a,"path"===r),[e,s,a,r])}var sR=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(sR||{}),lR=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}(lR||{});
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 cR(){return cR=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},cR.apply(this,arguments)}new Promise(()=>{});const uR=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="6"}catch{}const dR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",hR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fR=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,uR),{basename:p}=n.useContext(QM),g=!1;if("string"==typeof u&&hR.test(u)&&(r=u,dR))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;rR()||zM(!1);let{basename:i,navigator:o}=n.useContext(QM),{hash:a,pathname:s,search:l}=aR(e,{relative:r}),c=s;return"/"!==i&&(c="/"===s?i:GM([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=oR(),u=nR(),d=aR(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:BM(u)===BM(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",cR({},f,{href:r||m,onClick:g||a?i:function(e){i&&i(e),e.defaultPrevented||v(e)},ref:t,target:c}))});var pR,gR;!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"}(pR||(pR={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(gR||(gR={}));const mR=uf(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"),vR=uf(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"),yR={opacity:0,y:50,scale:.3},bR={opacity:1,y:0,scale:1},wR={opacity:0,scale:.5};function xR(){const r=Lm(e=>e.toasts);return e("div",{className:"pointer-events-none relative",children:e(Px,{initial:!1,children:r.map(r=>e("div",{className:sf("fixed z-toast mx-auto p-20","bottom-center"===r.position?"bottom-0 left-0 right-0":"bottom-0 right-0"),children:t(kx.div,{initial:r.disableEnterAnimation?void 0:yR,animate:r.disableEnterAnimation?void 0:bR,exit:r.disableExitAnimation?void 0:wR,className:sf("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(mR,{className:"flex-shrink-0 text-danger",size:"md"}),"loading"===r.type&&e(hO,{size:"sm",className:"flex-shrink-0",isIndeterminate:!0}),"positive"===r.type&&e(vR,{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(tI,{value:r.message})}),r.action&&e(U_,{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:()=>Nm().remove(r.id),elementType:fR,to:r.action.action,children:e(tI,{value:r.action.label})}),"loading"!==r.type&&e(QA,{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:()=>{Nm().remove(r.id)},size:"sm",children:e(pI,{})})]})},r.id))})})}function CR(e){return Kx()?e.metaKey:e.ctrlKey}function _R(e){switch(e.key){case"z":CR(e)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?km().history.redo():km().history.undo());break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),km().objects.move("up");break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),km().objects.move("right");break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),km().objects.move("down");break;case"ArrowLeft":e.preventDefault(),e.stopPropagation(),km().objects.move("left");break;case"Delete":e.preventDefault(),e.stopPropagation(),km().objects.delete();break;case"v":CR(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&&km().import.addImageFromData(e.target.result)},void n.readAsDataURL(r)}}catch(e){console.error(e)}}())}}const SR=new Map,kR=new Map,AR={};async function*IR(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 ER(e);yield new f_(t,e.fullPath)}else e.isDirectory&&(yield*IR(e))}while(r.length>0)}function ER(e){return new Promise((t,r)=>e.file(t,r))}function FR(e){return null!=AR.dragTargetId?SR.get(AR.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 ER(e);yield new f_(t,e.fullPath)}else e.isDirectory&&(yield*IR(e))}(e.dataTransfer))}:void 0}function TR(){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}=gI(),f=c(async e=>{var t,r;if(Sm().activeTool||Sm().dirty||"nativeFile"!==e.type)return;const n=await e.getData();km().import.fileIsValid(n[0])&&((null==(r=null==(t=Sm().config.tools)?void 0:t.import)?void 0:r.openDroppedImageAsBackground)?await km().import.openBackgroundImage(n[0]):await km().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(()=>(kR.set(e,{...kR.get(e),disabled:t,id:e,ref:r}),()=>{kR.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=FR(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=FR(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=FR(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=FR(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=FR(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;Sm().fabric||(_m.setState({canvasRef:s}),P_(s.current),null!=(e=Sm().config.ui)&&e.defaultTool&&Sm().setActiveTool(null==(t=Sm().config.ui)?void 0:t.defaultTool,null),km().canvas.loadInitialContent().then(()=>{var e,t;null==(t=(e=Sm().config).onLoad)||t.call(e,Sm().editor)}));const r=M_(l,()=>{Sm().setStageSize(R_(l.current))}),n=M_(s,()=>{Sm().setCanvasSize(R_(s.current))});return()=>{r(),n()}},[l]);const g=sf("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(Mx,{features:Lx,strict:!0,children:[d&&r&&!h&&o&&e(QA,{className:"z-20 fixed right-2 top-2 text-white",size:"lg",onClick:()=>{Sm().editor.close()},children:e(pI,{})}),d&&r&&e(rA,{position:"fixed",disableInitialTransition:!0}),t(kx.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(CI,{}),"top"===n&&e(vM,{className:"pt-14"}),t("main",{className:"relative flex-auto my-20 overflow-hidden outline-none",tabIndex:-1,...qx(p,{onKeyDownCapture:_R}),ref:l,children:[e(SI,{}),e(rF,{ref:s})]}),e(aP,{}),"bottom"===n&&e(vM,{}),"bottom"===i&&e(CI,{}),e(LM,{}),e(xR,{})]})]})}!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})}})}(),El.enableBoundaryChecking(!1);const OR=class t{constructor(t){if(vl(this,"tools",{}),vl(this,"fabric",null),t.sentryDsn&&function(e){const t={...e};Rd(t,"react"),Wh(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){mm=e,vm=e}(r),this.setConfig(t),_m.setState({editor:this}),_(r).render(e(i.StrictMode,{children:e(TR,{})})))}get state(){return Sm()}get defaultConfig(){return t.defaultConfig}open(e={}){return new Promise(async t=>{var r;Object.keys(e).length?await this.resetEditor({...ag(e,{ui:{visible:!0},image:e.image||Sm().config.image,state:e.state||Sm().config.state,blankCanvasSize:e.blankCanvasSize||Sm().config.blankCanvasSize})}):null!=(r=Sm().config.ui)&&r.visible||Sm().setConfig({ui:{visible:!0}}),t()})}close(){var e,t,r;null!=(e=Sm().config.ui)&&e.visible&&(this.setConfig({ui:{visible:!1}}),null==(r=(t=Sm().config).onClose)||r.call(t))}setConfig(e){Sm().setConfig(e)}uploadAndAddImage(){return km().import.uploadAndAddImage()}uploadAndReplaceMainImage(){return km().import.uploadAndReplaceMainImage()}uploadAndOpenStateFile(){return km().import.uploadAndOpenStateFile()}newCanvas(e,t,r){return km().canvas.openNew(e,t,r)}getState(e){return JSON.stringify(Tm(e))}setState(e){return km().import.loadState(e)}async setStateFromUrl(e){const t=await Em(e);return km().import.loadState(t)}openTool(e){Om(e)}applyChanges(){Sm().applyChanges()}cancelChanges(){Sm().cancelChanges()}async resetEditor(e){await Im(e),await km().canvas.loadInitialContent()}togglePanel(e,t){"objects"===e&&Sm().togglePanel("history",!1),"history"===e&&Sm().togglePanel("objects",!1),Sm().togglePanel(e,t)}on(e,t){var r;null==(r=this.fabric)||r.on(e,t)}isDirty(){return Sm().dirty}get(e){return this.tools[e]}notify(e){return jm(e)}static init(e){return new Promise(t=>{const r=e.onLoad;e.onLoad=e=>{null==r||r(e),t(e)},new this(e)})}};vl(OR,"defaultConfig",Mf),vl(OR,"version",Pf);let PR=OR;function MR(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 RR="fm-pixie-editor";const LR=new class{constructor(){this._container=document.createElement("div"),this._instance=null,this._container.classList.add(RR),this._container.style.width="100%",this._container.style.height="85vh",this._container.style.minHeight="400px"}get className(){return`.${RR}`}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 PR.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=MR)}):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 NR(e,t){if(!e)return t;if(!t)return e;return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function jR(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=NR(t,e||"");return!r||r.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(r)||(r="/"+r),r}(e),n=NR(r,t);return!n||n.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(n)?n:"/"+n}var DR,zR;!function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(DR||(DR={})),function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(zR||(zR={}));const BR=(e,t="image/png")=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());function UR(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 VR=({visible:r,onClose:n,file:o,onSave:a,onSaveCopy:s})=>{var l;const{t:c}=Kn(),u=i.useRef(null),d=Mo(),h=Ja(),{options:f,actions:p}=mo(),{i18n:g}=Kn(),{config:m}=f,{setCurrentMenuFile:v}=p,{getFileData:y,resolveFileForEditByUrl:b}=h,[w,x]=i.useState(!1),[C,_]=i.useState(null),[S,k]=i.useState(""),[A,I]=i.useState(!1),[E,F]=i.useState(!1),[T,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&&T){let e=!1;const t=async()=>{var t,r,i;x(!0);try{const t=await D(T);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=Pa(T,"image/png");k(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==T?void 0:T.id)&&void 0!==t?t:void 0,itemName:null!==(r=null==T?void 0:T.name)&&void 0!==r?r:void 0,folderId:null!==(i=null==T?void 0:T.folderId)&&void 0!==i?i:null,thumbnail:null==T?void 0:T.thumbnail}}),null==n||n())}finally{x(!1)}};return t(),()=>{e=!0}}},[T,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=Ir(t);e&&e.startsWith("image/")&&(r=e);const n=t.replace(/data:image\/[^;]+;base64,/,"");return BR(n,Ar(r))}return BR(t,Ar(r))}(r,e),o=Ar(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 Ua(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 UR(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(!T||!h)return;const f="object"==typeof T&&null!==T?T:null;let p=null;try{x(!0);const{blob:o,mimeType:a,thumbnailDataUrl:s}=await z(e,t,r),l=Object.assign(Object.assign({},T),{thumbnail:s,size:o.size,date:(new Date).toISOString().split("T")[0],type:a,folderId:T.folderId||"",name:T.name||t,extension:T.extension||(null===(i=(T.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=Do(e),h=null!==(a=null!==(o=No(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)}},[T,d,z,c]),U=i.useCallback(async e=>{var t;if(!LR.isLoaded()||!T)return void console.error("❌ Pixie instance or file is missing");N.current=e;const r=T.name||"edited-image",n=Pa(T,S);try{await(null===(t=LR.tools)||void 0===t?void 0:t.export.save(r.replace(/\.[^/.]+$/,""),n.pixieFormat,Ma.QUALITY))}catch(t){console.error("🎨 Error saving through the button:",t);try{const t=LR.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)}}},[T,S,B]),V=i.useCallback(async()=>{var t;if(C&&r&&A&&!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(hr).matches?ur:cr,s=(null==m?void 0:m.theme)===dr?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=Pa(T,S),v={selector:"#pixie-editor",baseUrl:jR((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:DR.TOP,items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",align:"right",desktopOnly:!0,icon:()=>e(xe,{style:{fontSize:20}}),action:e=>{e.togglePanel("history")}},{type:"button",icon:()=>e(be,{style:{fontSize:20}}),align:"right",desktopOnly:!0,action:n}]},nav:{position:zR.TOP}},tools:{export:{defaultFormat:p.pixieFormat,defaultQuality:Ma.QUALITY,defaultName:(null===(t=null==T?void 0:T.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{F(!1),await LR.show(v,u.current);const e=LR.canvas;e&&e.focus(),F(!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()}},[T,S,C,r,A,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&&A&&V()},[r,C,A,V]),i.useEffect(()=>{if(!r){try{LR.close()}catch(e){console.warn("Error closing Pixie:",e)}x(!1),_(null),k(""),P.current=!1,I(!1),F(!1)}return()=>{try{LR.close()}catch(e){console.warn("Error closing Pixie when unmounting:",e)}}},[r]);const H=Boolean(null==T?void 0:T.id)&&!1!==(null===(l=null==m?void 0:m.features)||void 0===l?void 0:l.enableUpdateFile);return e(G,{title:(null==T?void 0:T.name)?c("Editing: {{name}}",{name:T.name}):c("Editing image"),open:r,closeIcon:null,onCancel:n,afterOpenChange:e=>I(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:!A||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&&!E?e("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.45)",backdropFilter:"blur(1px)",pointerEvents:"all",zIndex:10},children:e("span",{style:{fontSize:14,color:"#555"},children:c("Loading editor...")})}):null,w&&E&&e(ll,{style:{position:"absolute",top:0,background:"var(--colorBgLayout)",zIndex:100,opacity:.7}})]})})};var HR="uploadProgress",$R="uploadProgress__card",WR="uploadProgress__header",GR="uploadProgress__header-title",qR="uploadProgress__header-buttons",YR="uploadProgress__header-button",XR="uploadProgress__close-icon",KR="uploadProgress__body",ZR="uploadProgress__common-error",JR="uploadProgress__common-error-row",QR="uploadProgress__common-error-hint",eL="uploadProgress__list-wrapper",tL="uploadProgress__status-icon",rL="uploadProgress__file-item",nL="uploadProgress__file-item--error",iL="uploadProgress__body--error",oL="uploadProgress__error-item",aL="uploadProgress__error-message",sL="uploadProgress__error-hint",lL="uploadProgress__file-avatar",cL="uploadProgress__file-info",uL="uploadProgress__file-name",dL="uploadProgress__file-size",hL="uploadProgress__progress-bar",fL="uploadProgress__minimized",pL="uploadProgress__minimized-button",gL="uploadProgress__file-list";const{Text:mL}=T,vL=({visible:r,files:n,totalFiles:i,completedFiles:o,onClose:a,onMinimize:s,onInsert:l,minimized:c=!1})=>{var u;const{token:d}=k.useToken(),{t:h}=Kn();if(!r)return null;const f=t=>{switch(t){case"success":return e("div",{className:tL,children:e(Se,{style:{color:d.colorSuccess}})});case"error":return e(Ce,{style:{color:d.colorError}});default:return e(_e,{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:fL,children:e(M,{type:"primary",size:"small",onClick:s,className:pL,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:HR+" fm-upload-progress",children:t("div",{className:$R,children:[t("div",{className:WR,children:[e(mL,{strong:!0,className:GR,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:qR,children:e(M,{type:"text",size:"small",icon:e(be,{className:XR}),onClick:a,className:YR})})]}),t("div",{className:`${KR} ${n.some(e=>"error"===e.status)?iL:""}`,children:[e("div",{className:eL,children:e(K,{className:gL,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:`${rL} ${n?nL:""}`,actions:p(r),children:e(K.Item.Meta,{avatar:e(Z,{size:"small",icon:f(r.status),className:lL}),title:t("div",{className:cL,children:[e(mL,{ellipsis:!0,className:uL,children:r.name}),e(mL,{type:"secondary",className:dL,children:void 0!==r.size?hi(r.size):""})]}),description:"uploading"===r.status?e(q,{percent:r.progress,size:"small",status:"active",showInfo:!1,className:hL}):n?b?null:t("div",{className:oL,children:[e(mL,{type:"danger",className:aL,children:r.error||h("Error")}),i&&e(mL,{type:"secondary",className:sL,children:i})]}):null})})}})}),w&&t("div",{className:ZR,children:[t("div",{className:JR,children:[e(Ce,{style:{color:d.colorError,marginRight:8,flexShrink:0}}),e(mL,{type:"danger",children:w})]}),e(mL,{type:"secondary",className:QR,children:h("Applies to all {{count}} files",{count:y.length})})]})]})]})})},{Header:yL}=J,{Title:bL}=T,wL=({activeLibraryItem:r,selectedFolder:i,isTrashFolder:o,onClearTrash:a,files:s,loading:l,onRefresh:c,refreshDisabled:u,showRefresh:d=!1})=>{const{t:h}=Kn(),f=r===rr&&(null!=o?o:i===lr),[p,g]=n.useState(!1),m={[rr]:h("My files"),[nr]:h("GIF"),[ir]:h("Stock images"),[or]:h("Icons"),[ar]: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===rr?f?h("Trash"):i:m[r],e(yL,{className:"actions-header",children:t("div",{className:"header-title-container",children:[e(bL,{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===rr&&d&&c&&e(P,{title:h("Refresh"),children:e(M,{type:"text",className:"folder-refresh-button",icon:e(Ti,{size:16}),onClick:c,disabled:u})})]})})};function xL(e,t){return!e||!t||e<=0||t<=0?1:e/t}const CL=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:CL,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:xL(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||CL);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||CL);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]),k=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:A,renderWindow:I}=Ws({items:e,context:x,adapter:w,options:k}),E=null!==(m=I.positionedItems)&&void 0!==m?m:A.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}}}),F=null!==(v=I.containerHeight)&&void 0!==v?v:S.containerHeight,T=F>0&&y.scrollTop+y.viewportHeight>=F-f;return{rowModels:A,renderRows:I.rows,renderWindow:I,positionedItems:E,containerHeight:F,isNearEnd:T,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 SL=t=>{var r,{imageId:n,sourceUrl:i,shouldLoad:s=!0,loader:l,onLoad:c}=t,d=Os(t,["imageId","sourceUrl","shouldLoad","loader","onLoad"]);const[h,f]=o(()=>l.getSnapshot(n,i)),p=u(null);return a(()=>(f(l.getSnapshot(n,i)),l.subscribe(n,i,f)),[n,l,i]),a(()=>(l.setActive(n,i,s),()=>{l.setActive(n,i,!1),l.release(n)}),[n,l,s,i]),h.shouldLoad?e("img",Object.assign({},d,{ref:p,src:i,loading:null!==(r=d.loading)&&void 0!==r?r:"lazy",onLoad:e=>{l.markLoaded(n),null==c||c(e)},onError:e=>{var t;l.markError(n),null===(t=d.onError)||void 0===t||t.call(d,e)}})):null};var kL={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 AL=e=>{const t="undefined"!=typeof window?window.innerWidth:e;return t<=700?1:t<=1100?2:t<=1600?3:4},IL=e=>e.images.downsized.url,EL=({setImageGifList:n,imageGifList:i=[],currentReqGif:s,setCurrentReqGif:l,inputRef:d,customRequest:h})=>{const{t:f}=Kn(),{GifPlayIcon:p}=yo(),{options:g}=mo(),{config:m}=g,v=ps({maxConcurrent:6}),[y,b]=o(null),[w,x]=o(new Set),[C,_]=o(!1),[k,A]=o(!1),[I,T]=o(!1),[O]=E.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=async e=>z?Promise.resolve(z(e)):e,U=async e=>Promise.all(e.map(async e=>Object.assign(Object.assign({},e),{images:Object.assign(Object.assign({},e.images),{downsized:Object.assign(Object.assign({},e.images.downsized),{url:await B(e.images.downsized.url)}),fixed_width:e.images.fixed_width?Object.assign(Object.assign({},e.images.fixed_width),{url:await B(e.images.fixed_width.url)}):void 0,fixed_width_downsampled:e.images.fixed_width_downsampled?Object.assign(Object.assign({},e.images.fixed_width_downsampled),{url:await B(e.images.fixed_width_downsampled.url)}):void 0})}))),V=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 fetch(await B(e));return{data:await i.json()}}catch(e){console.warn(e)}},{positionedItems:H,containerHeight:$,isNearEnd:W,viewportMetrics:G,handleViewportChange:q}=_L({items:i,getId:e=>e.id,getPreviewSrc:IL,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:AL}),Y=_s(q,[i.length]),X=()=>{M.current&&(clearTimeout(M.current),M.current=null)},K=e=>!D.current.has(e)&&(D.current.add(e),!0),Z=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||k||!I)return;const o=`gif:${i}:${j.current}`;if(!K(o))return;const a=N.current;A(!0);try{const e=await V({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 T(!1);const o=await U(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,T(50===i.length)}finally{Z(o),a===N.current&&A(!1)}},[I,C,k,n]),Q=async()=>{var e,t;X();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),T(!1),void A(!1);if(L.current===r)return;if(R.current===r||C&&R.current===r)return;const i=`gif:${r}:0`;if(!K(i))return;const o=N.current+1;N.current=o,R.current=r,j.current=0,n([]),x(new Set),T(!1),A(!1),_(!0);try{const e=await V({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=await U(i);if(o!==N.current)return;n(e),j.current=i.length,T(50===i.length)}else n([]),T(!1);L.current=r}catch(e){T(!1)}finally{Z(i),R.current===r&&(R.current=null),_(!1)}};return a(()=>()=>{X()},[]),a(()=>{!C&&!k&&I&&i.length>0&&W&&J()},[I,i.length,W,J,C,k]),e("div",{className:kL.gifTab,children:e("div",{className:kL.searchOutputWrapper,children:t("div",{id:"scrollableDiv",ref:Y,className:kL.scrollableDiv,children:[t(E,{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,X(),M.current=setTimeout(Q,800)}},className:i.length>0?kL.searchResults:kL.search,children:[e(E.Item,{name:"keywords",className:kL.gifSearchInput,children:e(F,{onPressEnter:()=>{Q()},allowClear:!0,placeholder:f("Search GIFs"),ref:d,spellCheck:"false",prefix:e(Pi,{size:16,strokeWidth:null==m?void 0:m.iconStrokeWidth,onClick:()=>{Q()}})})}),i.length>0&&!C&&e("div",{className:`ant-divider ${kL.divider}`,role:"separator"})]}),!i.length&&!C&&e(r,{children:s.keywords?e(_o,{}):t("div",{className:kL.resultsContainer,children:[e("div",{className:kL.videoIcon,children:e(p,{className:kL.playButton})}),e("h1",{className:kL.title,children:f("Over 350,000 live images")}),e("p",{className:kL.subtitle,children:f("Enter a search query and we'll find the perfect image for you")})]})}),!i.length&&C&&e(ll,{}),i.length>0&&t(r,{children:[e("div",{className:kL.virtualCanvas,style:{height:$},children:H.map(({row:r,layout:n})=>{const i=r.item,o=w.has(i.id),a=IL(i),s=n.bottom>=G.scrollTop-240&&n.top<=G.scrollTop+G.viewportHeight+240;return t("div",{className:`${kL.listItem} ${o?kL.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(SL,{imageId:i.id,sourceUrl:a,shouldLoad:s,loader:v,className:y===i.id?kL.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:kL.antSpin})]},i.id)})}),k&&e(ll,{})]})]})})})};var FL={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 TL=e=>{const t="undefined"!=typeof window?window.innerWidth:e;return t<=650?1:t<=1e3?2:t<=1450?3:4},OL=(e,t)=>{const r=new URL(e);return r.searchParams.set("w",t.toString()),r.toString()},PL=({imageStockList:n,setImageStockList:i,currentReq:s,setCurrentReq:l,inputRef:d,customRequest:h})=>{var f,p;const{t:g}=Kn(),{StockBigIcon:m,MixedViewIcon:v,LandscapeViewIcon:y,PortraitViewIcon:b,SquareViewIcon:w}=yo(),{options:x}=mo(),{config:C}=x,_=ps({maxConcurrent:6}),[k,A]=o(!1),[I,T]=o(!1),[O,M]=o(!1),[R,L]=o(null),[N,j]=o(new Set),[D]=E.useForm(),B=null==C?void 0:C.handleProxyUrl,V=null!==(f=null==C?void 0:C.UNSPLASH_KEY)&&void 0!==f?f:"HX2_qqq3F3ljmtYtfmb9P6h0dn2u9mnnOl36IdV8el0",H=(null===(p=null==C?void 0:C.locale)||void 0===p?void 0:p.slice(0,2))||"ru",$=u(s),W=u(null),G=u(null),q=u(0),Y=u(1),X=u(new Set),K=async e=>B?Promise.resolve(B(e)):e,Z=()=>{W.current&&(clearTimeout(W.current),W.current=null)},J=e=>!X.current.has(e)&&(X.current.add(e),!0),ee=e=>{X.current.delete(e)},te=async e=>Promise.all(e.map(async e=>Object.assign(Object.assign({},e),{urls:{raw:await K(OL(e.urls.raw,1200)),small:await K(OL(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 re=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=${V}&lang=${H}&per_page=30&query=${encodeURIComponent(r)}&page=${t}`;""!==e.color&&(n+=`&color=${e.color}`),""!==e.orientation&&(n+=`&orientation=${e.orientation}`);const i=await fetch(await K(n));return{data:await i.json()}}catch(e){console.warn(e)}},{positionedItems:ne,containerHeight:ie,isNearEnd:oe,viewportMetrics:ae,handleViewportChange:se}=_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:TL}),le=_s(se,[n.length]),ce=c(async()=>{var e,t;if(k||I||!O||!$.current.keywords.trim())return;const r=q.current,n=Y.current,o=`stock:${`${$.current.keywords.trim()}|${$.current.color}|${$.current.orientation}`}:${n}`;if(J(o)){T(!0);try{const o=await re({query:$.current,page:n});if(r!==q.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=await te(a);if(r!==q.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}),Y.current=n+1,M(30===a.length)}finally{ee(o),r===q.current&&T(!1)}}},[O,k,I,i]),ue=async()=>{var e,t;Z();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(!J(n))return;const o=q.current+1;q.current=o,A(!0),T(!1),M(!1),Y.current=1,i([]),j(new Set);try{const n=await re({query:$.current,page:1});if(o!==q.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=await te(a);if(o!==q.current)return;i(e),Y.current=2,M(30===a.length)}else M(!1);G.current=r}finally{ee(n),A(!1)}};a(()=>()=>{Z()},[]),a(()=>{!k&&!I&&O&&n.length>0&&oe&&ce()},[O,n.length,oe,ce,k,I]);const de=async(e,t,r,n)=>{var i;!async function(e){try{const t=`${e}${e.includes("?")?"&":"?"}client_id=${V}`,r=await K(t),n=await fetch(r);return{data:await n.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:FL.stockTab,children:e("div",{className:FL.searchOutputWrapper,children:t("div",{className:FL.scrollableDiv,id:"scrollableDiv",ref:le,children:[t(E,{form:D,initialValues:vr,onValuesChange:(e,t)=>{const r=Object.assign(Object.assign({},vr),t);l(r),$.current=r,Z(),""!==r.keywords?W.current=setTimeout(ue,800):(G.current=null,q.current+=1,Y.current=1,i([]),j(new Set),M(!1),T(!1),l(Object.assign({},vr)),$.current=vr,D.resetFields())},className:n.length>0?FL.searchResults:FL.search,children:[t(U,{gutter:24,children:[e(z,{span:n.length>0?void 0:24,children:e(E.Item,{name:"keywords",className:FL.stockSearchInput,children:e(F,{allowClear:!0,placeholder:g("Search image"),ref:d,spellCheck:"false",prefix:e(Pi,{size:16,strokeWidth:null==C?void 0:C.iconStrokeWidth})})})}),!!n.length&&t(r,{children:[e(z,{children:e(E.Item,{name:"orientation",children:t(Q.Group,{onChange:e=>l(t=>Object.assign(Object.assign({},t),{orientation:e.target.value})),children:[e(P,{title:g("All"),placement:"top",children:e(Q.Button,{value:"",children:e(v,{})})}),e(P,{title:g("Landscape"),placement:"top",children:e(Q.Button,{value:"landscape",children:e(y,{})})}),e(P,{title:g("Portrait"),placement:"top",children:e(Q.Button,{value:"portrait",children:e(b,{})})}),e(P,{title:g("Squarish"),placement:"top",children:e(Q.Button,{value:"squarish",children:e(w,{})})})]})})}),e(z,{children:e(E.Item,{name:"color",children:t(Q.Group,{className:FL.stockColorFilter,onChange:e=>l(t=>Object.assign(Object.assign({},t),{color:e.target.value})),children:[e(P,{title:g("All"),placement:"top",children:e(Q.Button,{className:FL.allColors,value:"",children:"All"})}),e(P,{title:g("Black"),placement:"top",children:e(Q.Button,{className:FL.blackColor,value:"black",children:"B"})}),e(P,{title:g("Black and White"),placement:"top",children:e(Q.Button,{className:FL.bwColor,value:"black_and_white",children:"B&W"})}),e(P,{title:g("White"),placement:"top",children:e(Q.Button,{className:FL.whiteColor,value:"white",children:"W"})}),e(P,{title:g("Orange"),placement:"top",children:e(Q.Button,{className:FL.orangeColor,value:"orange",children:"O"})}),e(P,{title:g("Red"),placement:"top",children:e(Q.Button,{className:FL.redColor,value:"red",children:"R"})}),e(P,{title:g("Purple"),placement:"top",children:e(Q.Button,{className:FL.purpleColor,value:"purple",children:"P"})}),e(P,{title:g("Magenta"),placement:"top",children:e(Q.Button,{className:FL.magentaColor,value:"magenta",children:"M"})}),e(P,{title:g("Green"),placement:"top",children:e(Q.Button,{className:FL.greenColor,value:"green",children:"G"})}),e(P,{title:g("Teal"),placement:"top",children:e(Q.Button,{className:FL.tealColor,value:"teal",children:"T"})}),e(P,{title:g("Blue"),placement:"top",children:e(Q.Button,{className:FL.blueColor,value:"blue",children:"B"})})]})})})]})]}),n.length>0&&!k&&e("div",{className:`ant-divider ${FL.divider}`,role:"separator"})]}),!n.length&&!k&&e(r,{children:s.keywords?e(_o,{}):t("div",{className:FL.resultsContainer,children:[e("div",{className:FL.videoIcon,children:e(m,{className:FL.playButton})}),e("h1",{className:FL.title,children:g("Millions of free stock images")}),e("p",{className:FL.subtitle,children:g("Enter a search query and we'll find the perfect image for you")})]})}),!n.length&&k&&e(ll,{}),n.length>0&&t(r,{children:[e("div",{className:FL.virtualCanvas,style:{height:ie},children:ne.map(({row:r,layout:n})=>{const i=r.item,o=N.has(i.id),a=n.bottom>=ae.scrollTop-240&&n.top<=ae.scrollTop+ae.viewportHeight+240;return t("div",{className:`${FL.listItem} ${o?FL.loaded:""}`,onClick:()=>de(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(SL,{imageId:i.id,sourceUrl:i.urls.small,shouldLoad:a,loader:_,className:R===i.id?FL.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:FL.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:FL.antSpin})]},i.id)})}),I&&e(ll,{})]})]})})})},ML=()=>{const{options:e}=mo(),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 RL="slideshowContainer",LL="slideshowImage";const NL=({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:RL,style:{height:l,minHeight:130},children:i.map((t,n)=>e("img",{src:`data:image/jpeg;base64, ${t.src}`,alt:`Slide ${n+1}`,className:LL,style:{opacity:t.opacity,transition:`opacity ${r}ms linear`,display:"block"}},n))})},jL=t=>{var{className:r,style:n,color:i,text:o,bordered:a}=t,s=Os(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}))},DL=({text:r,counter:n,limits:i,wrapperStyles:o})=>{const{t:a}=Kn(),{options:s}=mo(),l=s.config,{token:c}=k.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(jL,{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 zL={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 BL=f(({className:t,onClick:r})=>e("div",{className:`${zL.arrow} ${zL.arrowNext} ${t||""}`,onClick:r,children:e(M,{className:`${zL.arrowBtn} ${zL.arrowBtnNext}`,size:"large",icon:e(ke,{})})}));BL.displayName="SampleNextArrow";const UL=f(({className:t,onClick:r})=>e("div",{className:`${zL.arrow} ${zL.arrowPrev} ${t||""}`,onClick:r,children:e(M,{className:`${zL.arrowBtn} ${zL.arrowBtnPrev}`,size:"large",icon:e(Ae,{})})}));UL.displayName="SamplePrevArrow";const VL=({customRequest:r,inputAiRef:n,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,setAiImageRequest:f,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v})=>{const{t:y}=Kn(),{AiIcon_2:b}=yo(),w=i.useRef(null),[x,C]=o("auto"),{aiImageCounter:_,currentAiImgLimits:S,loadingDuringGeneration:k,requestStatus:A,handleGenerate:I,convertBase64ToFile:T,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}=Kn(),{options:m}=mo(),v=m.config,y=Mo(),b=ML(),{messages:w}=m.config,[x,C]=o([]),[_,S]=o(0),[k,A]=o(null),[I,E]=o(!1),[F,T]=o(g("Evaluating the task")),[O,P]=o(!1),M=u(new Set),R=u(new Set),L=u(new Set);a(()=>{C(w)},[w]),a(()=>{l.length||k||(C([]),M.current.clear(),R.current.clear(),L.current.clear(),D.current=-1)},[l,k]);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=`${k}-${e.progress}-${JSON.stringify(e.images||e.data)}`;if(!L.current.has(t))if(L.current.add(t),"error"!==e.status&&"Canceled"!==e.status){if(e.images){if(T(String(e.status)),100===e.progress){p(!1),h(e.images);const t=k,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}})),A(null),P(!1)}}else if(e.data&&(h([String(e.data)]),100===e.progress)){p(!1);const t=k,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}})),A(null),P(!1)}}else p(!1),P(!1),k&&!R.current.has(k)&&(R.current.add(k),y.error({id:"AI_RESPONSE_INVALID",message:g("Something went wrong, please try again"),placement:"bottomRight",description:String(k)||void 0,data:{requestId:k,request:s,response:e},innerException:e}))},[s,h,T,g,p,k,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:$}=H,W=$>0&&_>=$,G=!(!(null==v?void 0:v.limits)||!v.counters)&&fr,q=c(()=>{B.fire({name:"AiImgCount",count:_+1})},[B,_]),Y=d(()=>!W&&!G,[W,G,_,$]),X=c(async()=>{T(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 A(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:k)&&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)&&(T(b.message),A(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))&&k&&!R.current.has(k)&&(R.current.add(k),null==y||y.error({id:"AI_IMAGE_GENERATION_FAILED",message:g("Something went wrong, please try again"),placement:"bottomRight",description:s,innerException:e,data:{request:s,taskId:k,response:null==t?void 0:t.data,error:Do(null==t?void 0:t.error)}})),t}))},[s,f,p,P,h,b,U,V,N,y,z,g,k]),K=c(()=>{Y&&X()},[Y,G,S,q,X,y,g]);a(()=>{},[v,G]);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:$,isFieldsDisabled:W,canGenerateImage:Y,aiImageRequest:s,imageAiList:l,setImageAiList:h,isLoadingAi:f,setIsLoadingAi:p,loadingDuringGeneration:O,setLoadingDuringGeneration:P,requestStatus:F,setRequestStatus:T,handleGenerate:K,handleLimitAiImgCount:q,convertBase64ToFile:Z,isShiftPressed:I,setIsShiftPressed:E,currentReqId:k,setCurrentReqId:A,limitsInPlugin:G}}({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(),I())},[O,I,P]),H=c(e=>{"Shift"===e.key&&P(!1)},[P]);return t("div",{className:zL.imageAi,ref:w,children:[R&&e(DL,{text:"images",counter:_,limits:S,wrapperStyles:{marginTop:-25}}),e(U,{gutter:24,className:zL.row,children:t(z,{span:24,children:[e(E.Item,{children:t("span",{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg ${zL.inputAffixWrapper}${L?" ant-input-affix-wrapper-focused":""}`,children:[e(F.TextArea,{ref:n,onKeyDown:V,onKeyUp:H,onFocus:j,onBlur:D,autoSize:!0,allowClear:!0,className:`${zL.textAreaInputHybrid} ${zL.textarea}`,placeholder:y("Generate image"),value:h,onChange:B,spellCheck:"false"}),e("span",{className:`ant-input-suffix ${zL.inputSuffix}`,children:m||k?e(se,{className:`${zL.inputIcon} input-icon`,spin:!0}):e(b,{className:`${zL.inputIcon} input-icon`,onClick:I})})]})}),t("div",{className:zL.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(BL,{}),prevArrow:e(UL,{}),className:zL.carousel,infinite:!1,children:[m&&!p.length&&e("div",{className:zL.loading,children:t("div",{className:"spin",children:[e(se,{style:{fontSize:48},spin:!0}),e("p",{className:"status",children:A})]})}),p.length>0&&p.map((r,n)=>t("div",{className:zL.imageItem,children:[e(NL,{images:p,frameHeight:x}),e("div",{className:"buttons",children:p.length>0&&!m&&e(M,{onClick:()=>T(`data:image/jpeg;base64, ${r}`),loading:s,icon:e(Ie,{}),children:y("Use this variant")})})]},n))]})]})};var HL={iconsTab:"iconsTab",hasSearch:"hasSearch",iconsSearchFormCenteredContainer:"iconsSearchFormCenteredContainer",iconsSearchFormCentered:"iconsSearchFormCentered",iconsSearchFormInput:"iconsSearchFormInput",iconsSearchFormInputInput:"iconsSearchFormInputInput",iconsSearchResults:"iconsSearchResults",iconsControlsControls:"iconsControlsControls",iconsControls:"iconsControls",iconsControlElement:"iconsControlElement",iconsControlsStrokeWidth:"iconsControlsStrokeWidth",iconsControlsHeader:"iconsControlsHeader",iconsSearchFormSelect:"iconsSearchFormSelect",iconsSearchFormStyleItem:"iconsSearchFormStyleItem",iconsSearchDivider:"iconsSearchDivider",iconsGrid:"iconsGrid",iconsBottomBar:"iconsBottomBar",iconsBottomBarContent:"iconsBottomBarContent",iconsGridEmptyState:"iconsGridEmptyState",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle",iconsGridLoadingMore:"iconsGridLoadingMore",iconsGridVirtualCanvas:"iconsGridVirtualCanvas",iconsGridItem:"iconsGridItem",iconsGridItemThumbnail:"iconsGridItemThumbnail",iconsGridItemSvg:"iconsGridItemSvg",iconsGridItemImg:"iconsGridItemImg",iconsGridItemName:"iconsGridItemName",iconsGridItemSelected:"iconsGridItemSelected",iconsGridLoading:"iconsGridLoading",iconsControlsBackButton:"iconsControlsBackButton",iconsGridCheckbox:"iconsGridCheckbox",iconsGridShowCheckboxes:"iconsGridShowCheckboxes",iconsHeaderContainer:"iconsHeaderContainer",iconsHeaderContainerLeft:"iconsHeaderContainerLeft",copyToFolderModalBody:"copyToFolderModalBody",copyToFolderModalLoadingOverlay:"copyToFolderModalLoadingOverlay"};const $L=[{label:"Line",value:"line"},{label:"Solid",value:"solid"},{label:"Flat",value:"flat"},{label:"Duo",value:"duo"},{label:"Handrawn",value:"handrawn"},{label:"Creative",value:"creative"},{label:"Gradient",value:"gradient"},{label:"Remix",value:"remix"},{label:"Neon",value:"neon"},{label:"Pop",value:"pop"},{label:"Light",value:"light"},{label:"Glyph",value:"glyph"},{label:"Minimal",value:"minimal"},{label:"Outlined",value:"outlined"},{label:"Geometric",value:"geometric"},{label:"Bold",value:"bold"},{label:"Stroke",value:"stroke"},{label:"Wireframe",value:"wireframe"},{label:"Filled",value:"filled"}],WL=({query:r,onQueryChange:n,onSubmit:i,styleFilter:o,onStyleChange:a,hasResults:s=!1,inputRef:l})=>{const{t:c}=Kn(),{options:u}=mo(),{config:d}=u,h=r.length>0&&s;return t("div",{className:HL.iconsSearchFormCenteredContainer,children:[t(E,{layout:"inline",onFinish:i,className:h?HL.iconsSearchResults:HL.iconsSearchFormCentered,children:[e(E.Item,{className:HL.iconsSearchFormInput,children:e(F,{ref:l,className:HL.iconsSearchFormInputInput,allowClear:!0,prefix:e(Pi,{size:16,strokeWidth:null==d?void 0:d.iconStrokeWidth,onClick:i}),placeholder:c("Search icons"),value:r,onChange:e=>n(e.target.value),onKeyDown:e=>"Space"===e.code&&i(),onPressEnter:i,spellCheck:"false"})}),h&&e(E.Item,{className:HL.iconsSearchFormStyleItem,children:e(O,{allowClear:!0,placeholder:c("Style"),value:null!=o?o:void 0,onChange:e=>a(null!=e?e:null),className:HL.iconsSearchFormSelect,options:$L.map(e=>({label:c(e.label),value:e.value}))})})]}),h&&e("div",{className:`ant-divider ${HL.iconsSearchDivider}`,role:"separator"})]})},GL=n=>{const{t:i}=Kn(),{mode:o,colorHex:a,setColorHex:s,colorHex2:l,setColorHex2:c,colorHex3:u,setColorHex3:d,sizePx:h,setSizePx:f,strokeWidth:p,setStrokeWidth:g,showSecondColor:m,showThirdColor:v,onBack:y,styleFilter:b}=n;return t("div",{className:HL.iconsControls,children:[e("div",{className:HL.iconsControlsControls,children:"family"===o&&t(r,{children:[t("div",{className:HL.iconsControlsStrokeWidth,children:[e("span",{children:i("Size")}),e(re,{min:20,max:200,value:h,formatter:e=>`${e}px`,parser:e=>e?e.replace("px",""):"",onChange:e=>f("number"==typeof e?e:50)})]}),t("div",{className:HL.iconsControlsStrokeWidth,children:[e("span",{children:i("Stroke width")}),e(re,{min:.3,max:3,step:.1,value:"number"==typeof p?p:1,formatter:e=>`${e}px`,parser:e=>e?e.replace("px",""):"",onChange:e=>g("number"==typeof e?e:1)})]}),"gradient"===b?e(R,{size:8,children:e(ne,{defaultValue:[{color:a||"#108ee9",percent:0},{color:l||"#87d068",percent:100}],showText:!0,mode:"gradient",onChangeComplete:e=>{try{const t=e.toCssString().match(/(rgba?\([^)]+\)|#[0-9a-fA-F]{3,8})/g)||[];t[0]&&s(t[0]),t[1]&&c(t[1])}catch(e){console.warn("ColorPicker gradient parsing error",e)}},size:"small"})}):t(r,{children:[t("div",{className:HL.iconsControlElement,children:[e("span",{children:i("Color1")}),e(ne,{value:a,format:"hex",disabledAlpha:!0,onChange:(e,t)=>s(t),size:"middle"})]}),m&&t("div",{className:HL.iconsControlElement,children:[e("span",{children:i("Color2")}),e(ne,{value:l,format:"hex",disabledAlpha:!0,onChange:(e,t)=>c(t),size:"middle"})]}),v&&t("div",{className:HL.iconsControlElement,children:[e("span",{children:i("Color3")}),e(ne,{value:u,format:"hex",disabledAlpha:!0,onChange:(e,t)=>d(t),size:"middle"})]})]})]})}),e("div",{className:HL.iconsControlsHeader,children:e("div",{children:"family"===o?e(M,{className:HL.iconsControlsBackButton,type:"default",onClick:y,title:i("Back"),children:i("Back")}):null})})]})},qL=e(se,{style:{fontSize:20},spin:!0}),YL=({items:n,loading:o,isCollectingResults:a=!1,hasMore:s=!1,hasQuery:l,mode:c,selectedHash:u,onItemClick:d,onInsert:h,onLoadMore:f,colorVars:p,svgTextMap:g,previewSize:m,selectedHashes:v,onToggleSelect:y})=>{const{t:b}=Kn(),{ThumbsUpIcon:w}=yo(),x=ps({maxConcurrent:6}),C=Boolean(v&&v.size>0),_=i.useRef(null),k=Math.max(100,(null!=m?m:50)+48),{positionedItems:A,containerHeight:I,isNearEnd:E,viewportMetrics:F,handleViewportChange:T}=_L({items:n,getId:e=>e.hash,getPreviewSrc:e=>e.imagePreviewUrl,getAltText:e=>e.name,getWidth:()=>1,getHeight:()=>1,layoutMode:"grid",minColumnWidth:k,gap:16,prefetchThresholdPx:240}),O=_s(T,[n.length,null!=m?m:50]);i.useEffect(()=>{s||(_.current=null)},[s,n.length]),i.useEffect(()=>{if(!o&&!a&&s&&n.length>0&&E){if(_.current===n.length)return;_.current=n.length,null==f||f()}},[s,a,E,n.length,o,f]);const P=e("div",l?{className:HL.iconsGridEmptyState,children:e(_o,{})}:{className:HL.iconsGridEmptyState,children:t("div",{className:HL.resultsContainer,children:[e("span",{className:HL.videoIcon,children:e(w,{className:HL.playButton,style:{width:48,height:49,marginBottom:10}})}),e("h1",{className:HL.title,children:b("Millions of icons")}),e("p",{className:HL.subtitle,children:b("Enter a search query and we'll find the perfect icon for you")})]})});return t("div",{id:"iconsScrollableDiv",ref:O,className:HL.iconsGrid,children:[0!==n.length||o?t(r,{children:[e("div",{className:HL.iconsGridVirtualCanvas,style:{height:I},children:A.map(({row:r,layout:n})=>{var i,o,a,s,l,h,f,b,w,_,S;const k=r.item,A=Boolean(v&&v.has(k.hash)||u===k.hash),I=n.bottom>=F.scrollTop-180&&n.top<=F.scrollTop+F.viewportHeight+180;return t("div",{style:{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height},className:`${HL.iconsGridItem} ${A?HL.iconsGridItemSelected:""} ${C?HL.iconsGridShowCheckboxes:""}`,onClick:()=>{d(k),y&&"family"===c&&y(k.hash)},children:[e("div",{style:{height:null!=m?m:50},className:HL.iconsGridItemThumbnail,children:"family"===c&&g[k.hash]?e("div",{style:{color:null==p?void 0:p.colorHex,"--icon-grad-1":null!==(i=null==p?void 0:p.colorHex)&&void 0!==i?i:"#000","--icon-grad-2":null!==(o=null==p?void 0:p.colorHex2)&&void 0!==o?o:"#ff007a","--icon-color-1":null!==(a=null==p?void 0:p.colorHex)&&void 0!==a?a:"#000","--icon-color-2":null!==(s=null==p?void 0:p.colorHex2)&&void 0!==s?s:"#ff007a","--icon-color-3":null!==(l=null==p?void 0:p.colorHex3)&&void 0!==l?l:"#00C2FF","--icon-stroke-1":null!==(h=null==p?void 0:p.colorHex)&&void 0!==h?h:"#000","--icon-stroke-2":null!==(f=null==p?void 0:p.colorHex2)&&void 0!==f?f:"#ff007a","--icon-stroke-3":null!==(b=null==p?void 0:p.colorHex3)&&void 0!==b?b:"#00C2FF","--icon-fill-1":null!==(w=null==p?void 0:p.colorHex)&&void 0!==w?w:"#000","--icon-fill-2":null!==(_=null==p?void 0:p.colorHex2)&&void 0!==_?_:"#ff007a","--icon-fill-3":null!==(S=null==p?void 0:p.colorHex3)&&void 0!==S?S:"#00C2FF"},dangerouslySetInnerHTML:{__html:g[k.hash]},className:HL.iconsGridItemSvg}):e(SL,{imageId:k.hash,sourceUrl:k.imagePreviewUrl,shouldLoad:I,loader:x,alt:k.name,style:{maxHeight:null!=m?m:96},className:HL.iconsGridItemImg,decoding:"async"})}),e("div",{className:HL.iconsGridItemName,title:k.name,children:k.name}),y?e("div",{onClick:e=>{e.stopPropagation()},className:HL.iconsGridCheckbox,children:e(N,{checked:Boolean(v&&v.has(k.hash)),onChange:()=>y(k.hash)})}):null]},k.hash)})}),a&&e("div",{className:HL.iconsGridLoadingMore,children:e(S,{indicator:qL})})]}):P,o&&0===n.length&&e("div",{className:HL.iconsGridLoading,children:e(S,{indicator:qL})})]})},XL="path|rect|circle|ellipse|polygon|line|polyline|g";function KL(e){const t=e.trim();if(!t||"none"===t||"transparent"===t)return null;if(/^url\(#/.test(t))return null;if(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(t)){const e=t.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})/);return e?"#"+(3===e[1].length?e[1].replace(/(.)/g,"$1$1"):e[1]).toLowerCase():null}if(/^rgb\(/.test(t)){const e=t.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);if(e)return"#"+[1,2,3].map(t=>parseInt(e[t],10).toString(16).padStart(2,"0")).join("")}if(/^rgba\(/.test(t)){const e=t.match(/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*[\d.]+\s*\)/);if(e)return"#"+[1,2,3].map(t=>parseInt(e[t],10).toString(16).padStart(2,"0")).join("")}const r={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff"},n=t.toLowerCase();return r[n]?r[n]:("currentcolor"===n||"inherit"===n||/^[a-zA-Z]+$/.test(t),null)}function ZL(e,t){const r=new RegExp(`${t}\\s*:\\s*([^;]+)`,"i"),n=e.match(r);return n?n[1].trim():null}function JL(e){let t=0;const r=new RegExp(`<(?:${XL})([^>]*)>`,"gi");let n;for(;null!==(n=r.exec(e));){const e=n[1],r=e.match(/fill\s*=\s*["']([^"']*)["']/i),i=e.match(/style\s*=\s*["']([^"']*)["']/i),o=r&&r[1]&&!/^none$/i.test(r[1])&&!/^url\(#/i.test(r[1]),a=i&&ZL(i[1],"fill")&&!/^none$/i.test(ZL(i[1],"fill"));(o||a)&&(t+=1)}return t}function QL(e){let t=0;const r=new RegExp(`<(?:${XL})([^>]*)>`,"gi");let n;for(;null!==(n=r.exec(e));){const e=n[1],r=e.match(/stroke\s*=\s*["']([^"']*)["']/i),i=e.match(/style\s*=\s*["']([^"']*)["']/i),o=r&&r[1]&&!/^none$/i.test(r[1])&&!/^url\(#/i.test(r[1]),a=i&&ZL(i[1],"stroke")&&!/^none$/i.test(ZL(i[1],"stroke"));(o||a)&&(t+=1)}return t}function eN(e){return/<linearGradient/i.test(e)||/<radialGradient/i.test(e)||/fill="url\(#|stroke="url\(#/i.test(e)}function tN(e){const t=e.trim().replace(/(?:px|em|ex|%)\s*$/i,""),r=parseFloat(t);return Number.isNaN(r)||r<=0||r>10?null:Math.round(10*r)/10}function rN(e){const t=[],r=e.indexOf("</defs>"),n=r>=0?e.slice(r):e,i=new RegExp(`<(?:${XL})[^>]*stroke-width\\s*=\\s*["']([^"']+)["']`,"gi");let o;for(;null!==(o=i.exec(n));){const e=tN(o[1]);null!=e&&t.push(e)}const a=new RegExp(`<(?:${XL})[^>]*style\\s*=\\s*["'][^"']*stroke-width\\s*:\\s*([^;"]+)[^"']*["']`,"gi");for(;null!==(o=a.exec(n));){const e=tN(o[1]);null!=e&&t.push(e)}if(0===t.length)return;t.sort((e,t)=>e-t);const s=Math.floor(t.length/2);return t.length%2==1?t[s]:(t[s-1]+t[s])/2}function nN(e){const t=function(e){const t=[],r=new Set;Array.from(e.matchAll(/<stop[^>]*?stop-color\s*=\s*["']([^"']+)["']/gi)).map(e=>e[1]).forEach(e=>{const n=KL(e);n&&!r.has(n)&&(r.add(n),t.push(e))});const n=new RegExp(`<(?:${XL})([^>]*)>`,"gi");let i;for(;null!==(i=n.exec(e));){const e=i[1],n=e.match(/fill\s*=\s*["']([^"']*)["']/i);if(n&&n[1]){const e=KL(n[1]);e&&!r.has(e)&&(r.add(e),t.push(n[1]))}const o=e.match(/stroke\s*=\s*["']([^"']*)["']/i);if(o&&o[1]){const e=KL(o[1]);e&&!r.has(e)&&(r.add(e),t.push(o[1]))}const a=e.match(/style\s*=\s*["']([^"']*)["']/i);if(a&&a[1]){const e=ZL(a[1],"fill");if(e){const n=KL(e);n&&!r.has(n)&&(r.add(n),t.push(e))}const n=ZL(a[1],"stroke");if(n){const e=KL(n);e&&!r.has(e)&&(r.add(e),t.push(n))}}}const o=e.match(/<svg([^>]*)>/i);if(o&&o[1]){const e=o[1];for(const[n,i]of[["fill",/fill\s*=\s*["']([^"']*)["']/i],["stroke",/stroke\s*=\s*["']([^"']*)["']/i]]){const n=e.match(i);if(n&&n[1]){const e=KL(n[1]);e&&!r.has(e)&&(r.add(e),t.push(n[1]))}}const n=e.match(/style\s*=\s*["']([^"']*)["']/i);if(n&&n[1])for(const e of["fill","stroke"]){const i=ZL(n[1],e);if(i){const e=KL(i);e&&!r.has(e)&&(r.add(e),t.push(i))}}}return t}(e);return{colors:t,fillsCount:JL(e),strokesCount:QL(e),hasGradient:eN(e),strokeWidth:rN(e)}}const iN=new Map,oN="https://public-api.streamlinehq.com/v1";function aN(e,t,r,n){const o=i.useMemo(()=>t&&"string"==typeof t?t.replace(/\/$/,""):"/streamline",[t]),a=async e=>r?Promise.resolve(r(e)):e,s=null==n?void 0:n.trim(),l=i.useCallback(async e=>r?a(function(e){const{mode:t,q:r,offset:n,limit:i,familySlug:o,style:a}=e,s=new URLSearchParams;"global"===t&&(s.set("productType","icons"),s.set("productTier","free")),s.set("query",r),s.set("offset",String(n)),s.set("limit",String(i)),a&&s.set("style",a);const l="global"===t?"search/global":`search/family/${encodeURIComponent(o||"")}`;return`${oN}/${l}?${s.toString()}`}(e)):function(e,t){const{mode:r,q:n,offset:i,limit:o,familySlug:a,style:s}=t,l="global"===r?"search/global":`search/family/${encodeURIComponent(a||"")}`,c=new URL(`${e}/${l}`,window.location.origin);return"global"===r&&(c.searchParams.set("productType","icons"),c.searchParams.set("productTier","free")),c.searchParams.set("query",n),c.searchParams.set("offset",String(i)),c.searchParams.set("limit",String(o)),s&&c.searchParams.set("style",s),c.toString().replace(window.location.origin,"")}(o,e),[o,r]),c=i.useCallback(async e=>{var t;const r=await l({mode:e.mode,q:e.query.trim(),offset:e.offset,limit:e.limit,familySlug:e.familySlug,style:null!==(t=e.style)&&void 0!==t?t:null}),n={Accept:"application/json"};s&&(n["x-api-key"]=s);const i=await fetch(r,{method:"GET",headers:n,signal:e.signal});if(!i.ok){const e=await i.text();throw new Error(`Request failed: ${i.status} ${e}`)}return await i.json()},[l,s]),u=i.useCallback((e,t)=>{let r=e;const n=/<linearGradient[\s\S]*?<\/linearGradient>/i.test(r)||/<radialGradient[\s\S]*?<\/radialGradient>/i.test(r);if(!(/fill="url\(#/i.test(r)||/stroke="url\(#/i.test(r))){const e=function(e){var t,r,n,i,o,a,s,l;const c=new Map,u={v:1},d=e=>{const t=KL(e);t&&!c.has(t)&&(c.set(t,u.v),u.v=Math.min(u.v+1,3))},h=e.match(/<svg([^>]*)>/i);if(null==h?void 0:h[1]){const e=h[1],t=e.match(/fill\s*=\s*["']([^"']*)["']/i),r=e.match(/stroke\s*=\s*["']([^"']*)["']/i);!(null==t?void 0:t[1])||/^none$/i.test(t[1])||/^url\(#/i.test(t[1])||d(t[1]),!(null==r?void 0:r[1])||/^none$/i.test(r[1])||/^url\(#/i.test(r[1])||d(r[1])}const f=new RegExp(`<(?:${XL})([^>]*)>`,"gi");let p;for(;null!==(p=f.exec(e));){const e=p[1],c=e.match(/fill\s*=\s*["']([^"']*)["']/i),u=e.match(/style\s*=\s*["']([^"']*)["']/i),h=null===(t=null==u?void 0:u[1])||void 0===t?void 0:t.match(/fill\s*:\s*([^;]+)/i),f=null===(i=null!==(r=null==c?void 0:c[1])&&void 0!==r?r:null===(n=null==h?void 0:h[1])||void 0===n?void 0:n.trim())||void 0===i?void 0:i.trim();!f||/^none$/i.test(f)||/^url\(#/i.test(f)||d(f);const g=e.match(/stroke\s*=\s*["']([^"']*)["']/i),m=e.match(/style\s*=\s*["']([^"']*)["']/i),v=null===(o=null==m?void 0:m[1])||void 0===o?void 0:o.match(/stroke\s*:\s*([^;]+)/i),y=null===(l=null!==(a=null==g?void 0:g[1])&&void 0!==a?a:null===(s=null==v?void 0:v[1])||void 0===s?void 0:s.trim())||void 0===l?void 0:l.trim();!y||/^none$/i.test(y)||/^url\(#/i.test(y)||d(y)}return c}(r),t=t=>{const r=KL(t),n=r?e.get(r):void 0;return 1===n?"var(--icon-color-1)":2===n?"var(--icon-color-2)":3===n?"var(--icon-color-3)":"currentColor"};r=r.replace(/<svg([^>]*)>/i,(e,r)=>{let n=r;const i=r.match(/fill\s*=\s*["']([^"']*)["']/i);!(null==i?void 0:i[1])||/^none$/i.test(i[1])||/^url\(#/i.test(i[1])||(n=n.replace(/fill\s*=\s*["'][^"']*["']/i,`fill="${t(i[1])}"`));const o=r.match(/stroke\s*=\s*["']([^"']*)["']/i);return!(null==o?void 0:o[1])||/^none$/i.test(o[1])||/^url\(#/i.test(o[1])||(n=n.replace(/stroke\s*=\s*["'][^"']*["']/i,`stroke="${t(o[1])}"`)),`<svg${n}>`}),r=r.replace(/<(path|rect|circle|ellipse|polygon|line|polyline)([^>]*?)(\/>|>)/gi,(e,r,n,i)=>{var o,a,s,l,c,u,d,h;let f=n;const p=n.match(/fill\s*=\s*["']([^"']*)["']/i),g=n.match(/style\s*=\s*["']([^"']*)["']/i),m=null===(o=null==g?void 0:g[1])||void 0===o?void 0:o.match(/fill\s*:\s*([^;]+)/i),v=null===(l=null!==(a=null==p?void 0:p[1])&&void 0!==a?a:null===(s=null==m?void 0:m[1])||void 0===s?void 0:s.trim())||void 0===l?void 0:l.trim();if(v&&!/^none$/i.test(v)&&!/^url\(#/i.test(v)){const e=t(v);p?f=f.replace(/fill\s*=\s*["'][^"']*["']/i,`fill="${e}"`):(null==g?void 0:g[1])&&(f=f.replace(/style\s*=\s*["']([^"']*)["']/i,(t,r)=>`style="${r.replace(/fill\s*:\s*[^;]+/gi,`fill: ${e}`)}"`))}const y=n.match(/stroke\s*=\s*["']([^"']*)["']/i),b=n.match(/style\s*=\s*["']([^"']*)["']/i),w=null===(c=null==b?void 0:b[1])||void 0===c?void 0:c.match(/stroke\s*:\s*([^;]+)/i),x=null===(h=null!==(u=null==y?void 0:y[1])&&void 0!==u?u:null===(d=null==w?void 0:w[1])||void 0===d?void 0:d.trim())||void 0===h?void 0:h.trim();if(x&&!/^none$/i.test(x)&&!/^url\(#/i.test(x)){const e=t(x);y?f=f.replace(/stroke\s*=\s*["'][^"']*["']/i,`stroke="${e}"`):(null==b?void 0:b[1])&&(f=f.replace(/style\s*=\s*["']([^"']*)["']/i,(t,r)=>`style="${r.replace(/stroke\s*:\s*[^;]+/gi,`stroke: ${e}`)}"`))}return`<${r}${f}${i}`})}return n&&(r=r.replace(/<linearGradient([^>]*?)>([\s\S]*?)<\/linearGradient>/gi,(e,t,r)=>{let n=0;return`<linearGradient${t}>${r.replace(/<stop([^>]*?)>/gi,(e,t)=>{const r=0===n?"var(--icon-grad-1)":"var(--icon-grad-2)";if(n+=1,/stop-color\s*=/.test(t)){return"<stop"+t.replace(/stop-color="[^"]*"/i,'stop-color="'+r+'"')+">"}return"<stop"+t+' stop-color="'+r+'">'})}</linearGradient>`}),r=r.replace(/<radialGradient([^>]*?)>([\s\S]*?)<\/radialGradient>/gi,(e,t,r)=>{let n=0;return`<radialGradient${t}>${r.replace(/<stop([^>]*?)>/gi,(e,t)=>{const r=0===n?"var(--icon-grad-1)":"var(--icon-grad-2)";if(n+=1,/stop-color\s*=/.test(t)){return"<stop"+t.replace(/stop-color="[^"]*"/i,'stop-color="'+r+'"')+">"}return"<stop"+t+' stop-color="'+r+'">'})}</radialGradient>`})),"number"!=typeof(null==t?void 0:t.strokeWidth)||Number.isNaN(t.strokeWidth)||(/stroke-width\s*=\s*["'][^"']*["']/i.test(r)&&(r=r.replace(/stroke-width\s*=\s*["'][^"']*["']/gi,`stroke-width="${t.strokeWidth}"`)),/stroke-width\s*:/.test(r)&&(r=r.replace(/stroke-width\s*:\s*[^;]+/gi,`stroke-width: ${t.strokeWidth}`)),/stroke-width/i.test(r)||(r=r.replace(/<svg/,`<svg stroke-width="${t.strokeWidth}"`))),r=r.replace(/<svg([^>]*)>/i,(e,t)=>`<svg${t.replace(/\swidth="[^"]*"/i,"").replace(/\sheight="[^"]*"/i,"")} width="100%" height="100%">`),r},[]),d=i.useCallback(async(t,n)=>{const i=[t,e?"css=1":"css=0",(null==n?void 0:n.colors)?`c=${n.colors}`:"",(null==n?void 0:n.backgroundColor)?`bg=${n.backgroundColor}`:"",null!=(null==n?void 0:n.strokeWidth)?`sw=${n.strokeWidth}`:"",null!=(null==n?void 0:n.size)?`s=${n.size}`:"",null!=(null==n?void 0:n.responsive)?`r=${n.responsive}`:"",null!=(null==n?void 0:n.strokeToFill)?`sf=${n.strokeToFill}`:""].filter(Boolean).join("|"),l=iN.get(i);if(l)return l;const c=await(async(e,t)=>{var n,i;const s=new URLSearchParams;(null==t?void 0:t.colors)&&s.set("colors",t.colors),(null==t?void 0:t.backgroundColor)&&s.set("backgroundColor",t.backgroundColor),null!=(null==t?void 0:t.strokeWidth)&&s.set("strokeWidth",String(t.strokeWidth)),s.set("size",String(null!==(n=null==t?void 0:t.size)&&void 0!==n?n:96)),s.set("responsive",String(null===(i=null==t?void 0:t.responsive)||void 0===i||i)),null!=(null==t?void 0:t.strokeToFill)&&s.set("strokeToFill",String(t.strokeToFill));const l=`${oN}/icons/${encodeURIComponent(e)}/download/svg?${s.toString()}`;if(r)return a(l);const c=new URL(`${o}/icons/${encodeURIComponent(e)}/download/svg`,window.location.origin);return s.forEach((e,t)=>c.searchParams.set(t,e)),c.toString().replace(window.location.origin,"")})(t,n),d={Accept:"image/svg+xml"};s&&(d["x-api-key"]=s);const h=await fetch(c,{method:"GET",headers:d,signal:null==n?void 0:n.signal});if(!h.ok){const e=await h.text();throw new Error(`SVG request failed: ${h.status} ${e}`)}let f=await h.text();const p=f;e&&!(null==n?void 0:n.colors)&&(f=u(f,{strokeWidth:null==n?void 0:n.strokeWidth}));const g={text:f,url:`data:image/svg+xml;utf8,${encodeURIComponent(f)}`,original:p};return iN.set(i,g),g},[o,u,e,r,a,s]),h=i.useCallback(async(e,t)=>{const n=await(async(e,t)=>{var n;const i=new URLSearchParams;i.set("size",String(null!==(n=null==t?void 0:t.size)&&void 0!==n?n:96)),(null==t?void 0:t.colors)&&i.set("colors",t.colors),(null==t?void 0:t.backgroundColor)&&i.set("backgroundColor",t.backgroundColor),null!=(null==t?void 0:t.strokeWidth)&&i.set("strokeWidth",String(t.strokeWidth));const s=`${oN}/icons/${encodeURIComponent(e)}/download/png?${i.toString()}`;if(r)return a(s);const l=new URL(`${o}/icons/${encodeURIComponent(e)}/download/png`,window.location.origin);return i.forEach((e,t)=>l.searchParams.set(t,e)),l.toString().replace(window.location.origin,"")})(e,t),i={Accept:"image/png"};s&&(i["x-api-key"]=s);const l=await fetch(n,{method:"GET",headers:i,signal:null==t?void 0:t.signal});if(!l.ok){const e=await l.text();throw new Error(`PNG request failed: ${l.status} ${e}`)}const c=await l.blob();return await new Promise((e,t)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(new Error("Failed to read PNG blob")),r.readAsDataURL(c)})},[o,r,a,s]);return{buildUrl:l,performSearch:c,fetchSvgDataUrl:d,fetchPngDataUrl:h,normalizeSvgForCss:u}}const sN=({items:e,selectedHashes:t,getPngDataUrlForItem:r,dataUrlToBlob:n,clearSelection:o})=>{const{t:a}=Kn(),{options:s,state:l}=mo(),c=Mo(),[u,d]=i.useState(!1),[h]=E.useForm(),[f,p]=i.useState(!1),g=i.useRef(!1),{state:m,actions:{fetchFolders:v,fetchChildFolders:y,handleModalOk:b}}=qo(),{EmptyFolderIcon:w}=yo(),{activeFormField:x,setActiveFormField:C,generateMenuItemsFromFolders:_}=dl({folders:Array.isArray(m.folders)?m.folders:[],selectedFolder:l.selectedFolder,EmptyFolderIcon:w,handleCreateFolderModalOk:b,setIsLoading:p,t:a}),S=i.useCallback(async()=>{await v(),d(!0)},[v]),k=i.useCallback(async e=>{e.length>0&&(h.setFieldsValue({targetFolder:e[0]}),x!==e[0].toString()&&C(""))},[x,h,C]),A=i.useCallback(async i=>{var u,d;try{const{dataProviders:d}=s;if(!d||!d.uploadFile&&!d.uploadFiles)return void c.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:a("API-endpoint for file upload is not configured"),placement:"bottomRight"});const h=i||(null==l?void 0:l.selectedFolder)||void 0,f=Array.from(t);if(0===f.length)return;const p=null!==(u=d.uploadFile)&&void 0!==u?u:async e=>{var t,r,n;if(!d.uploadFiles)throw new Error("Upload is not supported by data provider");const i=await d.uploadFiles({folderId:e.folderId,items:[{name:e.name,size:e.size,type:e.type,folderId:e.folderId,data:e.data,extension:e.extension}]}),o=null===(t=null==i?void 0:i.detailed)||void 0===t?void 0:t[0];if(!i||!i.success||!o||!1===o.success){const e=(null===(r=null==o?void 0:o.error)||void 0===r?void 0:r.message)||(null===(n=null==i?void 0:i.error)||void 0===n?void 0:n.message)||"Upload failed";throw new Error(e)}return o.data},{successCount:g,failCount:m}=await async function(e){var t;const{hashes:r,items:n,folderId:i,dataProviders:o,getPngDataUrlForItem:a,dataUrlToBlob:s,config:l}=e;let c=0,u=0;for(const e of r){const r=n.find(t=>t.hash===e);if(!r){u+=1;continue}const d=await a(r);if(!d){u+=1;continue}const h=Br(`${(null===(t=r.name)||void 0===t?void 0:t.trim())||`icon-${e}`}.png`,l),f=await pi(o,h,i,!1,Vr(l)),p=s(d,"image/png"),g=new File([p],f,{type:"image/png",lastModified:Date.now()});try{await o.uploadFile({name:f,size:g.size,type:g.type,folderId:i,data:g,extension:"png"}),c+=1}catch(e){u+=1}}return{successCount:c,failCount:u}}({hashes:f,items:e,folderId:h,dataProviders:{uploadFile:p,getFiles:d.getFiles,getFolders:d.getFolders},getPngDataUrlForItem:r,dataUrlToBlob:n,config:null==s?void 0:s.config});g>0&&c.success({id:"FILES_COPY_SUCCESS",message:a("Files copied"),placement:"bottomRight",data:{successCount:g,totalCount:f.length,itemIds:f,folderId:null!=h?h:null}}),m>0&&c.error({id:"FILES_COPY_ERROR",message:a("При копировании произошли ошибки"),placement:"bottomRight",data:{failCount:m,totalCount:f.length,itemIds:f,folderId:null!=h?h:null}}),o()}catch(e){console.error(e),c.error({id:"FILES_COPY_ERROR",message:a("При копировании произошли ошибки"),placement:"bottomRight",innerException:e,data:{failCount:Array.from(t).length||0,totalCount:Array.from(t).length||0,itemIds:Array.from(t),folderId:null!==(d=null==l?void 0:l.selectedFolder)&&void 0!==d?d:null}})}},[o,n,r,e,c,s,t,null==l?void 0:l.selectedFolder,a]),I=i.useCallback(()=>{f||g.current||(d(!1),C(""),p(!1))},[f,C]),F=i.useCallback(()=>{C(""),p(!1)},[C]),T=i.useCallback(async e=>{if(!g.current){g.current=!0,p(!0);try{await A(null!=e?e:null),d(!1),C("")}finally{g.current=!1,p(!1)}}},[A,C]),O=i.useCallback(()=>{var e;const t=null!==(e=l.selectedFolder)&&void 0!==e?e:"folders";C(t),h.setFieldsValue({folderName:a("New folder"),targetFolder:t})},[h,l.selectedFolder,C,a]);return{isCopyIconsModalVisible:u,isCopyLoading:f,copyForm:h,openCopyModal:S,closeCopyModal:I,resetAfterClose:F,handleCopyTreeSelect:k,handleIconsCopyOk:T,handleCreateFolderAndCopy:O,fetchChildFolders:y,generateMenuItemsFromFolders:_}};async function lN(e,t,r){if(0===e.length)return[];const n=new Array(e.length);let i=0;const o=Math.max(1,Math.min(t,e.length));return await Promise.all(Array.from({length:o},()=>(async()=>{for(;;){const t=i++;if(t>=e.length)return;n[t]=await r(e[t])}})())),n}const cN=({apiKey:n,customRequest:o,query:a,setQuery:s,inputRef:l})=>{var c,u,d,h,f,p,g,m,v;const{t:y}=Kn(),[b,w]=i.useState(""),x=void 0!==a?a:b,C=void 0!==s?s:w,[_,k]=i.useState(""),[A,I]=i.useState("global"),[O,P]=i.useState(null),[L,N]=i.useState(null),[j,D]=i.useState(null),[z,B]=i.useState(null),[U,V]=i.useState([]),[H,$]=i.useState(0),[W,q]=i.useState(!1),[Y,K]=i.useState(!1),[Z,J]=i.useState(!1),[Q,ee]=i.useState(null),[te,re]=i.useState({}),[ne,oe]=i.useState({}),[ae,se]=i.useState({}),[le,ce]=i.useState("#000000"),[ue,de]=i.useState("#ff007a"),[he,fe]=i.useState("#00C2FF"),[pe,ge]=i.useState(1),[me,ve]=i.useState(50),[ye,be]=i.useState(!0),[we,xe]=i.useState(!0),[Ce,_e]=i.useState(!1),Se=i.useRef(A);i.useEffect(()=>{Se.current=A},[A]);const ke=mo(),{options:Ae}=ke,Ie=i.useRef(!1),Ee=i.useRef(null),Fe=i.useRef(0),Te=i.useRef(null),Oe=i.useRef(!1),Pe=i.useRef(null),Me=i.useRef(null===(c=null==Ae?void 0:Ae.config)||void 0===c?void 0:c.handleTranslate),Re=i.useRef(null===(u=null==Ae?void 0:Ae.config)||void 0===u?void 0:u.locale);i.useEffect(()=>{var e,t;Me.current=null===(e=null==Ae?void 0:Ae.config)||void 0===e?void 0:e.handleTranslate,Re.current=null===(t=null==Ae?void 0:Ae.config)||void 0===t?void 0:t.locale},[null===(d=null==Ae?void 0:Ae.config)||void 0===d?void 0:d.handleTranslate,null===(h=null==Ae?void 0:Ae.config)||void 0===h?void 0:h.locale]);const Le=i.useRef(null),Ne=i.useRef(null),je=i.useRef(new Set),De=i.useRef(null),ze=i.useRef(new Set),[Be,Ue]=i.useState(new Set),Ve=null!==(p=null===(f=null==Ae?void 0:Ae.config)||void 0===f?void 0:f.STREAMLINE_API_KEY)&&void 0!==p?p:"3pAQQzwUNMmcgSr2.f4eb08cd5886d44b1fc6a701a3ba797c",He=null===(g=null==Ae?void 0:Ae.config)||void 0===g?void 0:g.handleProxyUrl,$e=async e=>He?Promise.resolve(He(e)):e,{performSearch:We,fetchSvgDataUrl:Ge,fetchPngDataUrl:qe,normalizeSvgForCss:Ye}=aN(we,null===(m=null==Ae?void 0:Ae.config)||void 0===m?void 0:m.STREAMLINE_BASE_URL,He,Ve),Xe=i.useMemo(()=>{if("family"!==A||0===U.length)return null;const e=new Set(U.map(e=>e.hash)),t=Object.keys(ae).some(t=>e.has(t))?ae:ne,r=U.map(e=>t[e.hash]).filter(e=>Boolean(e));if(0===r.length)return null;return function(e){const t=[],r=new Set;let n,i=0,o=0,a=!1;for(const s of e){i+=s.fillsCount,o+=s.strokesCount,s.hasGradient&&(a=!0);for(const e of s.colors){const n=KL(e);n&&!r.has(n)&&(r.add(n),t.push(e))}null==n&&null!=s.strokeWidth&&(n=s.strokeWidth)}return{colors:t,fillsCount:i,strokesCount:o,hasGradient:a,strokeWidth:n}}(r.map(e=>nN(e)))},[U,A,ae,ne]);i.useMemo(()=>"family"===A&&(!!(null==Xe?void 0:Xe.hasGradient)||!!(O||"").toLowerCase().includes("gradient")),[Xe,O,A]);const Ke=i.useMemo(()=>"family"===A&&U.some(e=>{const t=ne[e.hash];return t&&/var\(--icon-color-2\)/i.test(t)}),[U,A,ne]),Ze=i.useMemo(()=>"family"===A&&U.some(e=>{const t=ne[e.hash];return t&&/var\(--icon-color-3\)/i.test(t)}),[U,A,ne]),Je=i.useMemo(()=>!!we&&(!!Xe&&(Xe.hasGradient||Xe.colors.length>=2&&Ke)),[Xe,we,Ke]),Qe=i.useMemo(()=>!!we&&(!!Xe&&(Xe.colors.length>=3&&Ze)),[Xe,we,Ze]);i.useEffect(()=>(Ie.current=!0,()=>{var e,t,r;Ie.current=!1;try{null===(e=Le.current)||void 0===e||e.abort(),null===(t=Ne.current)||void 0===t||t.abort(),null===(r=De.current)||void 0===r||r.abort()}catch(e){}}),[]);const et=i.useRef(x),tt=i.useCallback(async e=>{var t,r,n,i,o,a,s,l;const c=null!==(r=null===(t=e.override)||void 0===t?void 0:t.query)&&void 0!==r?r:_;if(!c||0===c.trim().length)return;if(e.initial?Y:Z||Y)return;if(!Ie.current)return;e.initial&&(null===(n=Le.current)||void 0===n||n.abort());const u=new AbortController;Le.current=u,e.initial?(K(!0),V([]),$(0),q(!1)):J(!0);const d=e.initial?0:H,h=(e.initial,30),f=null!==(o=null===(i=e.override)||void 0===i?void 0:i.mode)&&void 0!==o?o:A,p=null!==(s=null===(a=e.override)||void 0===a?void 0:a.familySlug)&&void 0!==s?s:O,g=c.trim(),m=`${f}|${p||""}|${g}|${j||""}|${d}|${h}`;if(!ze.current.has(m)){ze.current.add(m);try{const t=await We({mode:f,familySlug:p||null,query:g,offset:d,limit:h,style:j,signal:u.signal});if(!Ie.current)return;const r=await(async e=>Promise.all(e.map(async e=>Object.assign(Object.assign({},e),{imagePreviewUrl:await $e(e.imagePreviewUrl)}))))(t.results);if(e.initial){const e=r.filter((e,t,r)=>r.findIndex(t=>t.hash===e.hash)===t);V(e)}else V(e=>{const t=new Set(e.map(e=>e.hash)),n=r.filter(e=>!t.has(e.hash));return n.length>0?[...e,...n]:e});q(Boolean(null===(l=t.pagination)||void 0===l?void 0:l.hasMore)),$(d+r.length)}catch(e){if("AbortError"===(null==e?void 0:e.name))return;console.error(e),ie.error(y("Request error"))}finally{Ie.current&&(e.initial?K(!1):J(!1)),ze.current.delete(m)}}},[_,O,Z,Y,A,H,We,j,y]);i.useEffect(()=>{Pe.current=tt},[tt]),i.useEffect(()=>{if("family"===A){const e=window.setTimeout(()=>{Oe.current=!1},100);return()=>window.clearTimeout(e)}Oe.current=!1},[A]);const rt=i.useCallback(async e=>{var t;if(!e||0===e.trim().length)return;const r=`${e.trim()}|${j||""}`;if(Te.current===r&&"global"===Se.current)return;const n=++Fe.current;let i=e.trim();if(Me.current)try{i=await Me.current(e,{locale:Re.current})}catch(t){console.error("IconsTab: translation error",t),i=e}n===Fe.current&&(je.current.clear(),I("global"),P(null),B(null),V([]),q(!1),$(0),ee(null),Ue(new Set),k(i),await(null===(t=Pe.current)||void 0===t?void 0:t.call(Pe,{initial:!0,override:{query:i}})),Te.current=r)},[j]),nt=i.useCallback(async()=>{x&&0!==x.trim().length&&(Ee.current&&(window.clearTimeout(Ee.current),Ee.current=null),await rt(x))},[x,rt]),it=i.useCallback(()=>{Fe.current+=1,je.current.clear(),I("global"),P(null),N(null),B(null),D(null),k(""),V([]),J(!1),q(!1),$(0),Te.current=null,ee(null),Ue(new Set),ce("#000000"),de("#ff007a"),fe("#00C2FF")},[]);i.useEffect(()=>{const e=et.current;e&&e.trim().length>=3&&rt(e)},[]),i.useEffect(()=>{const e=x.trim();Ee.current&&(window.clearTimeout(Ee.current),Ee.current=null),e.length<3?it():Ee.current=window.setTimeout(()=>{rt(e)},700)},[x,j,it,rt]);const ot=i.useCallback(e=>{if("global"===A){if(!e.familySlug||!_)return;return Ee.current&&(window.clearTimeout(Ee.current),Ee.current=null),je.current.clear(),Oe.current=!0,I("family"),P(e.familySlug),N(e.hash),B(e.categoryName||null),V([]),J(!1),q(!1),$(0),ee(null),Ue(new Set),ce("#000000"),de("#ff007a"),fe("#00C2FF"),void tt({initial:!0,override:{mode:"family",familySlug:e.familySlug,query:_}})}ee(e.hash)},[_,tt,A]),at=i.useCallback(()=>{const e=_.trim();je.current.clear(),I("global"),P(null),N(null),B(null),V([]),J(!1),q(!1),$(0),ee(null),Ue(new Set),ce("#000000"),de("#ff007a"),fe("#00C2FF"),e&&tt({initial:!0,override:{mode:"global",familySlug:null,query:e}})},[_,tt]);i.useEffect(()=>{var e;if("family"!==A||0===U.length)return;const t=new Set(U.map(e=>e.hash));let r=U.map(e=>e.hash).filter(e=>!te[e]||!ne[e]);if(!L||t.has(L)||ae[L]||(r=[L,...r]),r=r.filter(e=>!je.current.has(e)),0===r.length)return;let n=!1;null===(e=Ne.current)||void 0===e||e.abort();const i=new AbortController;return Ne.current=i,lN(r,4,e=>Ge(e,{colors:we?void 0:le,strokeWidth:pe,size:me,responsive:ye,signal:i.signal}).then(t=>({h:e,r:t})).catch(t=>("AbortError"===(null==t?void 0:t.name)||je.current.add(e),{h:e,r:null}))).then(e=>{if(n||!Ie.current)return;const t={},r={},i={};e.forEach(e=>{e&&e.h&&e.r&&(t[e.h]=e.r.url,r[e.h]=e.r.text,e.r.original&&(i[e.h]=e.r.original))}),Object.keys(t).length>0&&re(e=>Object.assign(Object.assign({},e),t)),Object.keys(r).length>0&&oe(e=>Object.assign(Object.assign({},e),r)),Object.keys(i).length>0&&se(e=>Object.assign(Object.assign({},e),i))}),()=>{n=!0,i.abort()}},[le,L,Ge,U,A,ae,ye,me,pe,ne,te,we]),i.useEffect(()=>{if("family"!==A)return;if(0===U.length)return;const e=U.map(e=>e.hash),t={},r={};let n=!1;e.forEach(e=>{const i=ae[e]||ne[e];if(!i)return;const o=Ye(i,{strokeWidth:"number"==typeof pe?pe:void 0});o&&o!==ne[e]&&(t[e]=o,r[e]=`data:image/svg+xml;utf8,${encodeURIComponent(o)}`,n=!0)}),n&&(Object.keys(t).length>0&&oe(e=>Object.assign(Object.assign({},e),t)),Object.keys(r).length>0&&re(e=>Object.assign(Object.assign({},e),r)))},[U,A,Ye,ae,pe,ne]);const st=i.useRef(null);i.useEffect(()=>{var e;if("family"!==A||0===U.length)return;const t=L&&ae[L]?L:null===(e=U[0])||void 0===e?void 0:e.hash;if(!t||!ae[t])return;if(st.current===O)return;const r=ae[t];if(!r)return;st.current=O;const n=function(e){var t,r,n,i,o,a,s,l;const c=[],u=new Set,d=e=>{const t=KL(e);t&&!u.has(t)&&(u.add(t),c.push(e))},h=Array.from(e.matchAll(/<stop[^>]*?stop-color\s*=\s*["']([^"']+)["']/gi)).map(e=>e[1]);if(h.length>=2)return h.slice(0,3).forEach(e=>d(e)),c;const f=e.match(/<svg([^>]*)>/i);if(null==f?void 0:f[1]){const e=f[1],t=e.match(/fill\s*=\s*["']([^"']*)["']/i),r=e.match(/stroke\s*=\s*["']([^"']*)["']/i);!(null==t?void 0:t[1])||/^none$/i.test(t[1])||/^url\(#/i.test(t[1])||d(t[1]),!(null==r?void 0:r[1])||/^none$/i.test(r[1])||/^url\(#/i.test(r[1])||d(r[1])}const p=new RegExp(`<(?:${XL})([^>]*)>`,"gi");let g;for(;null!==(g=p.exec(e));){const e=g[1],c=e.match(/fill\s*=\s*["']([^"']*)["']/i),u=e.match(/style\s*=\s*["']([^"']*)["']/i),h=null===(t=null==u?void 0:u[1])||void 0===t?void 0:t.match(/fill\s*:\s*([^;]+)/i),f=null===(i=null!==(r=null==c?void 0:c[1])&&void 0!==r?r:null===(n=null==h?void 0:h[1])||void 0===n?void 0:n.trim())||void 0===i?void 0:i.trim();!f||/^none$/i.test(f)||/^url\(#/i.test(f)||d(f);const p=e.match(/stroke\s*=\s*["']([^"']*)["']/i),m=e.match(/style\s*=\s*["']([^"']*)["']/i),v=null===(o=null==m?void 0:m[1])||void 0===o?void 0:o.match(/stroke\s*:\s*([^;]+)/i),y=null===(l=null!==(a=null==p?void 0:p[1])&&void 0!==a?a:null===(s=null==v?void 0:v[1])||void 0===s?void 0:s.trim())||void 0===l?void 0:l.trim();!y||/^none$/i.test(y)||/^url\(#/i.test(y)||d(y)}return c.slice(0,3)}(r),i=e=>{const t=(e||"").trim().match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);if(t){return"#"+(3===t[1].length?t[1].replace(/(.)/g,"$1$1"):t[1]).toLowerCase()}return function(e){var t;const r=e.trim();if(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(r)){const e=r.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})/);if(e)return"#"+(3===e[1].length?e[1].replace(/(.)/g,"$1$1"):e[1]).toLowerCase()}const n=r.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);if(n)return"#"+[1,2,3].map(e=>parseInt(n[e],10).toString(16).padStart(2,"0")).join("");const i=r.match(/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*[\d.]+\s*\)/);return i?"#"+[1,2,3].map(e=>parseInt(i[e],10).toString(16).padStart(2,"0")).join(""):null!==(t={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff"}[r.toLowerCase()])&&void 0!==t?t:KL(r)||"#000000"}(e)};n[0]&&ce(i(n[0])),n[1]&&de(i(n[1])),n[2]&&fe(i(n[2]))},[U,A,ae,O,L]),i.useEffect(()=>{"family"!==A&&(st.current=null)},[A]);const lt=i.useRef(null);i.useEffect(()=>{if("family"!==A||!O||0===U.length)return;const e=U[0];if(!e||!ae[e.hash])return;if(lt.current===O)return;const t=ae[e.hash];if(!t)return;const r=nN(t);"number"==typeof r.strokeWidth&&r.strokeWidth>0&&(lt.current=O,ge(r.strokeWidth))},[U,A,ae,O]),i.useEffect(()=>{"family"!==A&&(lt.current=null)},[A]);const ct=i.useCallback(e=>function(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}(e,{colorHex:le,colorHex2:ue,colorHex3:he}),[le,ue,he]),ut=i.useCallback(e=>{Ue(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),dt=i.useCallback(()=>{Ue(new Set)},[]),ht=i.useMemo(()=>{if(1===Be.size){const[e]=Array.from(Be);return U.find(t=>t.hash===e)||null}return 0===Be.size&&Q&&U.find(e=>e.hash===Q)||null},[U,Q,Be]),ft=i.useCallback((e,t="image/png")=>{try{const r=e.split(",");if(r.length<2)return new Blob([],{type:t});const n=r[1]||"",i=atob(n),o=new Array(i.length);for(let e=0;e<i.length;e+=1)o[e]=i.charCodeAt(e);const a=new Uint8Array(o);return new Blob([a],{type:t})}catch(e){return new Blob([],{type:t})}},[]),pt=i.useCallback(async(e,t)=>{try{const r=async e=>{const t="family"===A?ct(e):e,r=function(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}}(t,me);return Da(t,r.width,r.height)},n=async e=>{const n=await Ge(e,{colors:we?void 0:le,strokeWidth:"number"==typeof pe?pe:void 0,size:me,responsive:ye,signal:t}),i=n.original||n.text;return r(i)};if("family"!==A)try{return await qe(e.hash,{size:me,colors:we?void 0:le,strokeWidth:"number"==typeof pe?pe:void 0,signal:t})}catch(t){return e.hash?await n(e.hash):null}const i=ne[e.hash]||ae[e.hash];return i?r(i):e.hash?await n(e.hash):null}catch(e){return null}},[ct,le,Ge,qe,A,ae,ye,me,pe,ne,we]),gt=i.useCallback(async e=>{var t;try{if(!Ie.current)return;_e(!0),null===(t=De.current)||void 0===t||t.abort();const r=new AbortController;De.current=r;const n=await pt(e,r.signal);if(!Ie.current||!n)return;await Promise.resolve(o(n))}catch(e){console.error("IconsTab: insert error",e),ie.error(y("Request error"))}finally{Ie.current&&_e(!1)}},[o,pt,y]);i.useCallback(()=>{var e;ee(null),dt();const t=null===(e=null==Ae?void 0:Ae.config)||void 0===e?void 0:e.onClose;"function"==typeof t&&t()},[dt,Ae]);const{isCopyIconsModalVisible:mt,isCopyLoading:vt,copyForm:yt,openCopyModal:bt,closeCopyModal:wt,resetAfterClose:xt,handleCopyTreeSelect:Ct,handleIconsCopyOk:_t,fetchChildFolders:St,generateMenuItemsFromFolders:kt,handleCreateFolderAndCopy:At}=sN({items:U,selectedHashes:Be,getPngDataUrlForItem:pt,dataUrlToBlob:ft,clearSelection:dt}),It=Boolean(_.trim())&&(U.length>0||Y),Et=It&&Be.size>0;return t(r,{children:[t("div",{className:`${HL.iconsTab} ${_.trim()?HL.hasSearch:""}`,children:[It&&Et?t("div",{className:HL.iconsHeaderContainer,children:[t("div",{className:HL.iconsHeaderContainerLeft,children:[t(T.Text,{type:"secondary",children:[Be.size," ",y("selected")]}),e(M,{icon:e(Oi,{size:16}),onClick:dt,children:y("Deselected")})]}),e(R,{children:e(M,{icon:e(vi,{size:16}),onClick:bt,children:y("Copy to folder")})})]}):e(WL,{query:x,onQueryChange:C,onSubmit:nt,styleFilter:j,onStyleChange:D,hasResults:U.length>0||Y,inputRef:l}),"family"===A?e(GL,{mode:A,familySlug:O,categoryName:z,colorHex:le,setColorHex:ce,colorHex2:ue,setColorHex2:de,colorHex3:he,setColorHex3:fe,sizePx:me,setSizePx:ve,strokeWidth:pe,setStrokeWidth:ge,responsiveSvg:ye,setResponsiveSvg:be,useCssColor:we,setUseCssColor:xe,showSecondColor:Je,showThirdColor:Qe,styleFilter:j,onBack:at}):null,e(YL,{items:U,loading:Y,isCollectingResults:Z,hasMore:W,hasQuery:Boolean(_.trim()),mode:A,selectedHash:Q,onItemClick:ot,onInsert:gt,onLoadMore:()=>{tt({initial:!1})},colorVars:{colorHex:le,colorHex2:ue,colorHex3:he},svgTextMap:ne,previewSize:me,selectedHashes:Be,onToggleSelect:ut}),ht?t("div",{className:HL.iconsBottomBar,children:[e(X,{className:"zero-divider"}),e("div",{className:HL.iconsBottomBarContent,children:e(R,{children:e(M,{size:"large",type:"primary",style:{height:40},loading:Ce,onClick:()=>gt(ht),children:y("Choose")})})})]}):null]}),e(G,{title:e("div",{className:"modal-title",children:y("Copy to folder")}),open:mt,onCancel:()=>{vt||wt()},maskClosable:!vt,closable:!vt,keyboard:!vt,footer:t("div",{className:cl.formFooter,children:[t(M,{className:cl.folderButton,onClick:At,loading:vt,children:[e(Ci,{size:18,strokeWidth:null===(v=Ae.config)||void 0===v?void 0:v.iconStrokeWidth}),y("Create folder")]}),e(M,{type:"primary",className:cl.folderButton,onClick:()=>{wt()},loading:vt,children:y("Done")})]}),afterClose:()=>xt(),children:t("div",{className:HL.copyToFolderModalBody,children:[vt?e("div",{className:HL.copyToFolderModalLoadingOverlay,children:e(S,{size:"large"})}):null,e(E,{form:yt,layout:"vertical",initialValues:{targetFolder:"folders",folderName:y("New folder"),is_force_create:!1},children:t("div",{className:cl.foldersWrapper,children:[e(E.Item,{name:"targetFolder",rules:[{required:!0,message:y("Select the destination folder")}],className:cl.formItem,children:e(sl,{onSelect:Ct,generateMenuItems:()=>kt({targetForm:yt,onTreeSelect:Ct,onComplete:_t,actionButtonText:y("Copy here")}),fetchChildFolders:St,disabledFolders:[],mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(E.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(y("Enter the name of the folder"))):Promise.resolve()}],children:e(F,{})}),e(E.Item,{name:"is_force_create",style:{display:"none"},children:e(F,{})})]})})]})})]})},uN=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:dN,Content:hN}=J,fN={keywords:""},pN=()=>{var s,l,d;const h=qo(),f=fs(),p=(()=>{var e,t;const{state:r,actions:n,options:i}=mo(),{selectedFolder:o,pathHistory:a,folders:s}=r,{t:l}=Kn(),{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}=mo(),{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=>hi(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=hi(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=Ja(),{deleteItems:y}=Yo(),b=Mo(),{t:w}=Kn(),{options:C,state:_,actions:k}=mo(),A=C,I=null==A?void 0:A.onChangeSelection,E=_,F=null==A?void 0:A.config,{dataProviders:T}=A,{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:$}=_,{setIsUrlModalVisible:W,setActiveLibraryItem:G}=k,{config:q}=C,{DropZoneFileIcon:Y}=yo(),[K,Z]=o(!1),[Q,ee]=o(!1),[te,re]=o(!1),ne=u(0),ie=u(!1);ie.current=Q;const oe=i.useRef(null),ae=i.useRef([]),[se,le]=o(!1),[ce,ue]=o(!1),de=ns(e=>e.selectedFiles),he=ns(e=>e.clearSelection),fe=ns(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}=mo(),{t:o}=Kn(),a=Mo(),{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:ke,fileToRename:Ae}=f.state,{fetchFiles:Ie,handleDeleteFile:Ee,handleDeleteFolder:Te,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:$e}=f.actions,{selectedFolder:We,pathHistory:Ge}=p.state,{handleFolderSelect:qe,handleItemClick:Ye}=p.actions,{pagination:Xe}=g.state,Ke=To(Ie),{searchTerm:Ze,sortBy:Je,sortOrder:Qe}=Ke.state,{handleSearch:et,handleSort:tt,handlePaginationChange:rt}=Ke.actions,nt=c(async()=>{const e=(e=>Ho(e))(Ge||[]);try{await Go({options:A,pathFolder:e,dataProviders:null==A?void 0:A.dataProviders})}catch(e){console.error("Cache clear failed:",e)}await me(),await Ie({folderId:We||"",page:Xe.current,limit:Xe.pageSize,search:Ze,sortBy:Je,sortOrder:Qe,itemType:"all"})},[Ie,me,A,Xe,Ge,Ze,We,Je,Qe]),it=(({files:e,fetchFiles:t,selectedFolder:r})=>{var i;const{t:o}=Kn(),a=Mo(),{options:s,actions:l,state:c}=n.useContext(go),{setActiveLibraryItem:u}=l,{activeLibraryItem:d}=c,h=Ja(),[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 gr.includes(t)}const r=null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();return!!r&&gr.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 Xo(o("Updating files is disabled by configuration"),"UnsupportedOperation");if(!e.id||!e.thumbnail||!(null==i?void 0:i.updateFile))throw new Xo(o("Failed to save changes"),"UnsupportedOperation");const a=(null==t?void 0:t.mimeType)||Er(e.thumbnail,e.type),l=Fr(a),c=e.name.lastIndexOf("."),u=`${c>0?e.name.substring(0,c):e.name}.${l}`,d=(null==t?void 0:t.blob)||Lr(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 Xo(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)||Er(e.thumbnail,e.type),u=(null==t?void 0:t.blob)||Lr(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 Xo(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=ns.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(sr),m(r),p(!0)},[e,v,p,u]),x=n.useCallback(()=>{u&&d===sr&&u(rr),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=Do(t),n=null!==(u=null!==(c=No(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=Do(t),n=null!==(u=null!==(c=No(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:We||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==E?void 0:E.activeLibraryItem;a(()=>{const e=e=>{e?document.body.setAttribute("data-fm-dragging","true"):document.body.removeAttribute("data-fm-dragging")};let t=!1;const 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===rr&&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(`.${As.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!==rr||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 $e(),await me(),We===lr&&ve&&await ve(lr),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,$e,We]),pt=i.useCallback(()=>{ue(!0)},[]),gt=i.useCallback(async()=>{var e,t;if(We!==lr)return console.error("Clear trash called outside of trash folder"),void ue(!1);try{if(null==T?void 0:T.cleanTrash){const t=await T.cleanTrash();await Ie({folderId:lr}),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:lr,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:lr}),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)}},[We,T,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==A?void 0:A.config;await Oe({onStartBatch:n=>{e=m.startUpload(We||void 0,n),t=new Map,n.forEach((n,i)=>{const o=e[i];o&&(t.set(n.name,o),t.set(Br(n.name,r),o))})},onStart:n=>{if(0===e.length){e=m.startUpload(We||void 0,[n]);const i=e[0];i&&(t.set(n.name,i),t.set(Br(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:We)&&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,We,null==A?void 0:A.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(We||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=Do(e),r=Vo(t,w);m.markAsError(s,r)}}finally{le(!1)}},[Pe,m,We,_e,w]),xt=i.useCallback(async({file:e})=>{var t;const r=m.startUpload(We||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||We||null;return qe&&qe(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,We,_e,qe]),Ct=i.useCallback(async e=>{var t;if(Ne){const r=m.startUpload(We||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,We]),_t=i.useCallback(async e=>{var t;await Te(e),await me(),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())},[Te,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=ns.getState().selectedFiles;if(t&&1===t.size||e){const n=e||Array.from(t)[0];r(n)}},[r]),h=n.useCallback(t=>{const r=ns.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:Ee,handleDeleteFolder:_t,showDeleteConfirm:Ve,onEdit:it.handleEdit}),kt=ge||Se||ot;a(()=>{Sr()},[]),x(()=>{$!==rr?he():fe(_e||[])},[$,_e,fe,he]),a(()=>{if(!I||$!==rr)return;if(!tr.current)return void(tr.current=!0);const e=(Array.isArray(_e)?_e:[]).filter(e=>de.has(e.id));I(e)},[$,_e,de,I]),i.useEffect(()=>{if(!qe||0===pe.length)return;const e=!1!==(null==F?void 0:F.rememberLastFolder),t=`em_fm:lastFolder:${(null==F?void 0:F.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 qe(e)}catch(e){}We||qe("folders")},[We,qe,pe,null==F?void 0:F.rememberLastFolder,null==F?void 0:F.projectId]);const{handleRenameFolderCancel:At,handleRenameFolderOk:It}=Ce.actions;a(()=>{const e=async e=>{if($!==rr)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)}},[$,wt,Ct]);const Et=u(Xe);a(()=>{Et.current=Xe},[Xe]);const Ft=c(e=>{rt(e.current||Et.current.current,e.pageSize||Et.current.pageSize)},[rt]),Tt=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(fN),[Rt,Lt]=o([]),Nt=u(null),[jt,Dt]=o(vr),[zt,Bt]=o([]),Ut=u(null),[Vt,Ht]=o(""),$t=u(null),[Wt,Gt]=o(""),[qt,Yt]=o([]),Xt=i.useRef(void 0),[Kt,Zt]=o(!1),[Jt,Qt]=o(!1),er=i.useRef(null),tr=i.useRef(!1),cr=i.useRef($),ur=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})},[]),dr=i.useCallback(async e=>{var t;const r=m.startUpload(We||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,We]),hr=c(async e=>{if(Boolean(e&&e.startsWith("data:"))){const t=ur(e);if(!t)return;return void await dr(t)}e&&await wt(e,void 0,void 0,"iconStock")},[ur,wt,dr]),fr=c(async()=>{const e=null==q?void 0:q.fileForEdit;if(Xt.current===e)return;if($===sr&&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==q?void 0:q.fileForEdit,$,it,v]);a(()=>{fr()},[fr]),a(()=>{var e,t,r,n;const i=cr.current;cr.current=$,$===rr?(Lt([]),Mt(fN),Bt([]),Dt(vr),Yt([]),Gt(""),Qt(!1),Zt(!1),i===rr||i!==ir&&i!==nr&&i!==ar||et("")):$===ar?null===(e=er.current)||void 0===e||e.focus():$===nr?null===(t=Nt.current)||void 0===t||t.focus():$===ir?null===(r=Ut.current)||void 0===r||r.focus():$===or&&(null===(n=$t.current)||void 0===n||n.focus())},[$,et]);const pr=i.useCallback(async()=>{var e;await It(),await(null===(e=oe.current)||void 0===e?void 0:e.refreshFileCounts())},[It]),mr=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===rr&&Fe(e("div",{className:As.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=mr(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),Q&&Fe(e("div",{className:As.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=mr(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:As.dragOverlayInner,children:[e("div",{className:As.uploadIcon,children:e(Y,{})}),e("div",{className:As.textTitle,children:w("Drop files here to upload")}),e("div",{className:As.textDescription,children:w("Supported files:")+" .jpg, .jpeg, .svg, .png"})]})}),document.body),e(J,{className:"file-manager__layout",children:t("div",{className:As.filesContainer,"data-files-container":"true",onDragOver:ct,onDragLeave:lt,onDragEnter:st,onDrop:ut,children:[K&&e("div",{className:As.dragOverlay,children:t("div",{className:As.dragOverlayInner,children:[e("div",{className:As.uploadIcon,children:e(Y,{})}),e("div",{className:As.textTitle,children:w("Drop files here to upload")}),e("div",{className:As.textDescription,children:w("Supported files:")+" .jpg, .jpeg, .svg, .png"})]})}),t(J,{className:"file-manager__content",children:[e(dN,{width:320,theme:"light",className:"file-manager-sider",children:e(gl,{ref:oe,selectedFolder:We||"folders",generateMenuItems:xe,onFolderSelect:e=>null==qe?void 0:qe(e),folders:pe||[],fetchFolders:me,fetchChildFolders:ve,handleAddFile:bt,setIsUrlModalVisible:e=>null==W?void 0:W(e),handleDeleteFolder:_t,handleCreateFolder:ye,activeLibraryItem:$,setActiveLibraryItem:e=>null==G?void 0:G(e)})}),t(J,{className:"file-manager__main-content",children:[ot&&e(ll,{style:{position:"absolute",width:"100%",height:"100%",top:0,left:0,zIndex:100,background:"var(--colorBgLayout)"}}),t(hN,{className:"main-content",children:[e(wL,{activeLibraryItem:$,selectedFolder:(null===(s=null==pe?void 0:pe.find(e=>(null==e?void 0:e.id)===We))||void 0===s?void 0:s.name)||w("Folders"),isTrashFolder:"Trash"===We,onClearTrash:pt,files:_e||[],loading:kt,onRefresh:nt,refreshDisabled:Se||ge,showRefresh:!(!(null===(l=null==A?void 0:A.apiEndpoints)||void 0===l?void 0:l.clearCache)&&!(null===(d=null==A?void 0:A.dataProviders)||void 0===d?void 0:d.clearCache))}),e(X,{className:"zero-divider"}),$===rr&&e(Zs,{searchTerm:Ze,handleAddFile:bt,files:_e||[],handleSearch:et,sortBy:Je,sortOrder:Qe,handleSortOptionChange:Ot,pagination:Xe,setPagination:Ft,loading:kt,handleItemClick:Tt,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}),$===nr&&e(EL,{imageGifList:Rt,setImageGifList:Lt,currentReqGif:Pt,setCurrentReqGif:Mt,inputRef:Nt,customRequest:(e,t)=>wt(e,void 0,t,"gif")}),$===ir&&e(PL,{imageStockList:zt,setImageStockList:Bt,currentReq:jt,setCurrentReq:Dt,inputRef:Ut,customRequest:(e,t)=>wt(e,void 0,t,"imageStock")}),$===or&&e(cN,{apiKey:null==q?void 0:q.STREAMLINE_API_KEY,customRequest:hr,query:Vt,setQuery:Ht,inputRef:$t}),$===ar&&!!(null==q?void 0:q.sseQuery)&&e(VL,{imageAiList:qt,setImageAiList:Yt,aiImageRequest:Wt,setAiImageRequest:Gt,inputAiRef:er,customRequest:xt,isLoadingAi:Kt,setIsLoadingAi:Zt,isImageUploaded:Jt,setIsImageUploaded:Qt}),$===sr&&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(fl,{isModalVisible:j,handleModalOk:be,handleModalCancel:we,form:O,selectedFolder:We||null,folders:pe||[],isUrlModalVisible:D,setIsUrlModalVisible:e=>null==W?void 0:W(e),handleAddFileByUrl:wt,urlForm:P,isRenameModalVisible:ke,handleRenameOk:()=>null==Le?void 0:Le(),handleRenameCancel:()=>null==Re?void 0:Re(),renameForm:M,fileToRename:Ae,files:_e||[],isMoveModalVisible:z,handleMoveOk:vt,handleMoveCancel:De,moveForm:R,selectedFiles:de||new Set,isRenameFolderModalVisible:B,handleRenameFolderOk:pr,handleRenameFolderCancel:At,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(VR,{visible:it.isPixieEditorVisible,onClose:it.handlePixieEditorClose,file:it.editingFile,onSave:it.handlePixieEditorSave,onSaveCopy:it.handlePixieEditorSaveCopy}),e(vL,{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)}})]})})]})},gN=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(hr).matches?ur:cr;e=e===dr?t:e}document.documentElement.setAttribute("data-theme",e)})(b.theme),uN(b)},[b]),a(()=>{b.locale&&b.locale!==Mn.language&&Mn.changeLanguage(b.locale),b.customLocale&&b.locale&&Mn.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(I,{className:"em-filemanager",children:t(r,{children:[e(A,{getPopupContainer:()=>w.current||document.body,children:e(vo,{options:x,children:e(pN,{})})}),e("div",{ref:w,className:"file-manager-modal-root"})]})})});gN.displayName="FileManagerApp";const mN=t=>{var r,n,i;return e(Zn,{i18n:Mn,children:e(wr,{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(oe,{children:e(gN,Object.assign({},t))})})})},vN=new Map,yN=(t,r)=>{var n;let i;Sr();let o={};const a=e=>{const t=!e||"fileManager"!==e.mode&&"imageCenter"!==e.mode&&"plugin"!==e.mode?void 0:e.mode;return"imageCenter"===t?Cr("imageCenter",e):Cr(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(mN,Object.assign({},o))),vN.set(i.id||`container_${Date.now()}`,s)},bN=e=>{const t=e.id||Object.keys(vN).find(e=>e.startsWith("container_"));if(t&&vN.has(t)){const e=vN.get(t);null==e||e.unmount(),vN.delete(t)}else{console.warn("Couldn t find the root to unmount");try{_(e).unmount()}catch(e){console.error("Error unmounting the component:",e)}}},wN=new Map,xN=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,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.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)||Er(e.thumbnail,e.type),n=Fr(r),i=e.name.substring(0,e.name.lastIndexOf("."))+"."+n,o=(null==t?void 0:t.blob)||Lr(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)||Er(e.thumbnail,e.type),h=(null==t?void 0:t.blob)||Lr(e.thumbnail,d),f=Br(e.name,v),p=await pi(l,f,u,c,Vr(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:Fr(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||Fr(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:Fr(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:Fr(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!==Mn.language&&Mn.changeLanguage(d)},[d]),e(I,{className:"em-filemanager",children:t(r,{children:[e(A,{getPopupContainer:()=>S.current||document.body,children:e(Zn,{i18n:Mn,children:e(wr,{externalTheme:null!=c?c:"light",children:e(oe,{children:e(vo,{options:{dataProviders:l,handleNotify:n.handleNotify,handleError:n.handleError,handleSuccess:n.handleSuccess,config:v},children:e(VR,{visible:!0,onClose:o,file:b,onSave:C,onSaveCopy:_})})})})})}),e("div",{ref:S,className:"file-manager-modal-root"})]})})},CN=t=>{Sr();const r=t.element,n=_(r);n.render(e(xN,Object.assign({},t))),wN.set(r.id||`pixie_container_${Date.now()}`,n)},_N=e=>{const t=Array.from(wN.keys()).find(e=>e.startsWith("pixie_container_")),r=e.id||t;if(r&&wN.has(r)){const e=wN.get(r);null==e||e.unmount(),wN.delete(r)}else{console.warn("Couldn t find the root to unmount Pixie");try{_(e).unmount()}catch(e){console.error("Error unmounting Pixie:",e)}}},SN=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&&bN(c),u&&_N(u)},unmountFileManager:void 0,unmountPixieEditor:void 0};switch(n){case"fileManager":c=i,yN(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=()=>bN(c);break;case"pixieEditor":u=i,CN(Object.assign({element:i,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountPixieEditor=()=>_N(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,yN(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})),CN(Object.assign({element:u,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountFileManager=()=>bN(c),d.unmountPixieEditor=()=>_N(u);break}}return d};function kN(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 AN={init:yN,unmount:bN,initPixieEditor:CN,unmountPixieEditor:_N,initFileManager:SN};export{Zs as FileContent,Xo as FileManagerApiError,gN as FileManagerApp,mN as FileManagerAppWithContext,fl as FileModals,gl as FolderSidebar,xN as PixieOnlyApp,AN as default,yN as init,SN as initFileManager,CN as initPixieEditor,Sr as installResizeObserverErrorHandler,kN as mapHttpStatusToErrorCode,kr as uninstallResizeObserverErrorHandler,bN as unmount,_N as unmountPixieEditor};
1
+ export{B as FileContent,H as FileManagerApiError,A as FileManagerApp,v as FileManagerAppWithContext,C as FileModals,D as FolderSidebar,P as PixieOnlyApp,z as default,q as init,y as initFileManager,w as initPixieEditor,E as installResizeObserverErrorHandler,I as mapHttpStatusToErrorCode,G as uninstallResizeObserverErrorHandler,t as unmount,x as unmountPixieEditor}from"./file-manager-index-CBQ0C6Zs.js";import"react/jsx-runtime";import"react";import"react-dom/client";import"antd";import"antd/es/alert/ErrorBoundary";import"@ant-design/icons";import"react-dom";
62
2
  //# sourceMappingURL=file-manager.esm.js.map