@yorab/react-paint 0.9.0 → 0.9.2

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,21 +1,21 @@
1
- (function(_,I){typeof exports=="object"&&typeof module<"u"?module.exports=I(require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react"],I):(_=typeof globalThis<"u"?globalThis:_||self,_["react-paint"]=I(_.jsxRuntime,_.React))})(this,function(_,I){"use strict";const T1="blue",N1=[[0,0],[.5,0],[1,0],[1,.5],[1,1],[.5,1],[0,1],[0,.5]],M1=["brush","rect","square","line","polygon","circle","curve","ellipse","picture","text","triangle"],te=["transparent","black","white","red","green","blue","yellow"],er=[0,1,2],lc=[0,1,2,3],D1=[[1,0],[1,2],[4,6]],fc=["arial","serif","monospace"],en="serif",pc=36,rn={APP:1,LOADING:2,PANEL:3,SNACKBAR:4},vr=[10,20,40],jo=18,H1=n=>{n.lineCap="round",n.lineJoin="round"},xr=(n,o={})=>{const{fillColor:u="transparent",globalAlpha:a=100,strokeColor:l=T1,lineWidth:f=2,lineDash:p=0}=o;a!==void 0&&(n.globalAlpha=a/100),u&&(n.fillStyle=u),l&&(n.strokeStyle=l),f&&(n.lineWidth=f),p!==void 0&&f&&n.setLineDash([D1[p][0]*f,D1[p][1]*f])},V1=(n,o,u,a,l)=>{n.save(),n.scale(o,o),n.translate(u[0],u[1]),a!==0&&(n.translate(l[0],l[1]),n.rotate(a),n.translate(-l[0],-l[1]))};var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var kn={exports:{}};/**
1
+ (function(y,x){typeof exports=="object"&&typeof module<"u"?module.exports=x(require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react"],x):(y=typeof globalThis<"u"?globalThis:y||self,y["react-paint"]=x(y.jsxRuntime,y.React))})(this,function(y,x){"use strict";const T1="blue",N1=[[0,0],[.5,0],[1,0],[1,.5],[1,1],[.5,1],[0,1],[0,.5]],D1=["brush","rect","square","line","polygon","circle","curve","ellipse","picture","text","triangle"],te=["transparent","black","white","red","green","blue","yellow"],tr=[0,1,2],lc=[0,1,2,3],M1=[[1,0],[1,2],[4,6]],fc=["arial","serif","monospace"],en="serif",pc=36,rn={APP:1,LOADING:2,PANEL:3,SNACKBAR:4},dr=[10,20,40],jo=18,H1=n=>{n.lineCap="round",n.lineJoin="round"},Lr=(n,o={})=>{const{fillColor:u="transparent",globalAlpha:a=100,strokeColor:l=T1,lineWidth:f=2,lineDash:p=0}=o;a!==void 0&&(n.globalAlpha=a/100),u&&(n.fillStyle=u),l&&(n.strokeStyle=l),f&&(n.lineWidth=f),p!==void 0&&f&&n.setLineDash([M1[p][0]*f,M1[p][1]*f])},V1=(n,o,u,a,l)=>{n.save(),n.scale(o,o),n.translate(u[0],u[1]),a!==0&&(n.translate(l[0],l[1]),n.rotate(a),n.translate(-l[0],-l[1]))};var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var kn={exports:{}};/**
2
2
  * @license
3
3
  * Lodash <https://lodash.com/>
4
4
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
5
5
  * Released under MIT license <https://lodash.com/license>
6
6
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7
7
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8
- */kn.exports,function(n,o){(function(){function u(m,E,s){switch(s.length){case 0:return m.call(E);case 1:return m.call(E,s[0]);case 2:return m.call(E,s[0],s[1]);case 3:return m.call(E,s[0],s[1],s[2])}return m.apply(E,s)}function a(m,E,s,j){for(var J=-1,U=m==null?0:m.length;++J<U;){var ue=m[J];E(j,ue,s(ue),m)}return j}function l(m,E){for(var s=-1,j=m==null?0:m.length;++s<j&&E(m[s],s,m)!==!1;);return m}function f(m,E){for(var s=m==null?0:m.length;s--&&E(m[s],s,m)!==!1;);return m}function p(m,E){for(var s=-1,j=m==null?0:m.length;++s<j;)if(!E(m[s],s,m))return!1;return!0}function d(m,E){for(var s=-1,j=m==null?0:m.length,J=0,U=[];++s<j;){var ue=m[s];E(ue,s,m)&&(U[J++]=ue)}return U}function Q(m,E){return!!(m!=null&&m.length)&&F(m,E,0)>-1}function w(m,E,s){for(var j=-1,J=m==null?0:m.length;++j<J;)if(s(E,m[j]))return!0;return!1}function C(m,E){for(var s=-1,j=m==null?0:m.length,J=Array(j);++s<j;)J[s]=E(m[s],s,m);return J}function k(m,E){for(var s=-1,j=E.length,J=m.length;++s<j;)m[J+s]=E[s];return m}function N(m,E,s,j){var J=-1,U=m==null?0:m.length;for(j&&U&&(s=m[++J]);++J<U;)s=E(s,m[J],J,m);return s}function D(m,E,s,j){var J=m==null?0:m.length;for(j&&J&&(s=m[--J]);J--;)s=E(s,m[J],J,m);return s}function T(m,E){for(var s=-1,j=m==null?0:m.length;++s<j;)if(E(m[s],s,m))return!0;return!1}function W(m){return m.split("")}function H(m){return m.match(Z0)||[]}function q(m,E,s){var j;return s(m,function(J,U,ue){if(E(J,U,ue))return j=U,!1}),j}function tt(m,E,s,j){for(var J=m.length,U=s+(j?1:-1);j?U--:++U<J;)if(E(m[U],U,m))return U;return-1}function F(m,E,s){return E===E?Ut(m,E,s):tt(m,pt,s)}function rt(m,E,s,j){for(var J=s-1,U=m.length;++J<U;)if(j(m[J],E))return J;return-1}function pt(m){return m!==m}function dt(m,E){var s=m==null?0:m.length;return s?B(m,E)/s:zr}function vt(m){return function(E){return E==null?v:E[m]}}function gt(m){return function(E){return m==null?v:m[E]}}function Z(m,E,s,j,J){return J(m,function(U,ue,Hi){s=j?(j=!1,U):E(s,U,ue,Hi)}),s}function G(m,E){var s=m.length;for(m.sort(E);s--;)m[s]=m[s].value;return m}function B(m,E){for(var s,j=-1,J=m.length;++j<J;){var U=E(m[j]);U!==v&&(s=s===v?U:s+U)}return s}function ut(m,E){for(var s=-1,j=Array(m);++s<m;)j[s]=E(s);return j}function R(m,E){return C(E,function(s){return[s,m[s]]})}function at(m){return m&&m.slice(0,or(m)+1).replace(Li,"")}function yt(m){return function(E){return m(E)}}function Mt(m,E){return C(E,function(s){return m[s]})}function Qt(m,E){return m.has(E)}function bt(m,E){for(var s=-1,j=m.length;++s<j&&F(E,m[s],0)>-1;);return s}function ve(m,E){for(var s=m.length;s--&&F(E,m[s],0)>-1;);return s}function It(m,E){for(var s=m.length,j=0;s--;)m[s]===E&&++j;return j}function ee(m){return"\\"+b3[m]}function Xt(m,E){return m==null?v:m[E]}function kt(m){return d3.test(m)}function Ne(m){return v3.test(m)}function Y(m){for(var E,s=[];!(E=m.next()).done;)s.push(E.value);return s}function M(m){var E=-1,s=Array(m.size);return m.forEach(function(j,J){s[++E]=[J,j]}),s}function z(m,E){return function(s){return m(E(s))}}function $(m,E){for(var s=-1,j=m.length,J=0,U=[];++s<j;){var ue=m[s];ue!==E&&ue!==Zr||(m[s]=Zr,U[J++]=s)}return U}function nt(m){var E=-1,s=Array(m.size);return m.forEach(function(j){s[++E]=j}),s}function Vt(m){var E=-1,s=Array(m.size);return m.forEach(function(j){s[++E]=[j,j]}),s}function Ut(m,E,s){for(var j=s-1,J=m.length;++j<J;)if(m[j]===E)return j;return-1}function St(m,E,s){for(var j=s+1;j--;)if(m[j]===E)return j;return j}function Wt(m){return kt(m)?Vr(m):A3(m)}function Kt(m){return kt(m)?Gn(m):W(m)}function or(m){for(var E=m.length;E--&&D0.test(m.charAt(E)););return E}function Vr(m){for(var E=Ni.lastIndex=0;Ni.test(m);)++E;return E}function Gn(m){return m.match(Ni)||[]}function ai(m){return m.match(h3)||[]}var v,si="4.17.21",an=200,ci="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Ot="Expected a function",Wr="Invalid `variable` option passed into `_.template`",gr="__lodash_hash_undefined__",Xn=500,Zr="__lodash_placeholder__",qt=1,Br=2,Me=4,De=1,ir=2,re=1,Ue=2,Kn=4,ge=8,ur=16,ye=32,ar=64,Ie=128,ne=256,Le=512,li=30,fi="...",pi=800,jr=16,He=1,hi=2,yr=3,$e=1/0,Ve=9007199254740991,di=17976931348623157e292,zr=NaN,_e=4294967295,vi=_e-1,gi=_e>>>1,ft=[["ary",Ie],["bind",re],["bindKey",Ue],["curry",ge],["curryRight",ur],["flip",Le],["partial",ye],["partialRight",ar],["rearg",ne]],wt="[object Arguments]",Fe="[object Array]",_r="[object AsyncFunction]",Se="[object Boolean]",sn="[object Date]",_0="[object DOMException]",Jn="[object Error]",Pn="[object Function]",Uu="[object GeneratorFunction]",xe="[object Map]",cn="[object Number]",m0="[object Null]",qe="[object Object]",$u="[object Promise]",Q0="[object Proxy]",ln="[object RegExp]",ke="[object Set]",fn="[object String]",Rn="[object Symbol]",b0="[object Undefined]",pn="[object WeakMap]",w0="[object WeakSet]",hn="[object ArrayBuffer]",Ur="[object DataView]",yi="[object Float32Array]",_i="[object Float64Array]",mi="[object Int8Array]",Qi="[object Int16Array]",bi="[object Int32Array]",wi="[object Uint8Array]",Ci="[object Uint8ClampedArray]",Ei="[object Uint16Array]",Ai="[object Uint32Array]",C0=/\b__p \+= '';/g,E0=/\b(__p \+=) '' \+/g,A0=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Fu=/&(?:amp|lt|gt|quot|#39);/g,Su=/[&<>"']/g,I0=RegExp(Fu.source),L0=RegExp(Su.source),x0=/<%-([\s\S]+?)%>/g,k0=/<%([\s\S]+?)%>/g,qu=/<%=([\s\S]+?)%>/g,O0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T0=/^\w*$/,N0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ii=/[\\^$.*+?()[\]{}|]/g,M0=RegExp(Ii.source),Li=/^\s+/,D0=/\s/,H0=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,V0=/\{\n\/\* \[wrapped with (.+)\] \*/,W0=/,? & /,Z0=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,B0=/[()=,{}\[\]\/\s]/,j0=/\\(\\)?/g,z0=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Yu=/\w*$/,U0=/^[-+]0x[0-9a-f]+$/i,$0=/^0b[01]+$/i,F0=/^\[object .+?Constructor\]$/,S0=/^0o[0-7]+$/i,q0=/^(?:0|[1-9]\d*)$/,Y0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,to=/($^)/,G0=/['\n\r\u2028\u2029\\]/g,eo="\\ud800-\\udfff",X0="\\u0300-\\u036f",K0="\\ufe20-\\ufe2f",J0="\\u20d0-\\u20ff",Gu=X0+K0+J0,Xu="\\u2700-\\u27bf",Ku="a-z\\xdf-\\xf6\\xf8-\\xff",P0="\\xac\\xb1\\xd7\\xf7",R0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",t3="\\u2000-\\u206f",e3=" \\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",Ju="A-Z\\xc0-\\xd6\\xd8-\\xde",Pu="\\ufe0e\\ufe0f",Ru=P0+R0+t3+e3,xi="['’]",r3="["+eo+"]",ta="["+Ru+"]",ro="["+Gu+"]",ea="\\d+",n3="["+Xu+"]",ra="["+Ku+"]",na="[^"+eo+Ru+ea+Xu+Ku+Ju+"]",ki="\\ud83c[\\udffb-\\udfff]",o3="(?:"+ro+"|"+ki+")",oa="[^"+eo+"]",Oi="(?:\\ud83c[\\udde6-\\uddff]){2}",Ti="[\\ud800-\\udbff][\\udc00-\\udfff]",$r="["+Ju+"]",ia="\\u200d",ua="(?:"+ra+"|"+na+")",i3="(?:"+$r+"|"+na+")",aa="(?:"+xi+"(?:d|ll|m|re|s|t|ve))?",sa="(?:"+xi+"(?:D|LL|M|RE|S|T|VE))?",ca=o3+"?",la="["+Pu+"]?",u3="(?:"+ia+"(?:"+[oa,Oi,Ti].join("|")+")"+la+ca+")*",a3="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s3="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",fa=la+ca+u3,c3="(?:"+[n3,Oi,Ti].join("|")+")"+fa,l3="(?:"+[oa+ro+"?",ro,Oi,Ti,r3].join("|")+")",f3=RegExp(xi,"g"),p3=RegExp(ro,"g"),Ni=RegExp(ki+"(?="+ki+")|"+l3+fa,"g"),h3=RegExp([$r+"?"+ra+"+"+aa+"(?="+[ta,$r,"$"].join("|")+")",i3+"+"+sa+"(?="+[ta,$r+ua,"$"].join("|")+")",$r+"?"+ua+"+"+aa,$r+"+"+sa,s3,a3,ea,c3].join("|"),"g"),d3=RegExp("["+ia+eo+Gu+Pu+"]"),v3=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,g3=["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"],y3=-1,Et={};Et[yi]=Et[_i]=Et[mi]=Et[Qi]=Et[bi]=Et[wi]=Et[Ci]=Et[Ei]=Et[Ai]=!0,Et[wt]=Et[Fe]=Et[hn]=Et[Se]=Et[Ur]=Et[sn]=Et[Jn]=Et[Pn]=Et[xe]=Et[cn]=Et[qe]=Et[ln]=Et[ke]=Et[fn]=Et[pn]=!1;var Ct={};Ct[wt]=Ct[Fe]=Ct[hn]=Ct[Ur]=Ct[Se]=Ct[sn]=Ct[yi]=Ct[_i]=Ct[mi]=Ct[Qi]=Ct[bi]=Ct[xe]=Ct[cn]=Ct[qe]=Ct[ln]=Ct[ke]=Ct[fn]=Ct[Rn]=Ct[wi]=Ct[Ci]=Ct[Ei]=Ct[Ai]=!0,Ct[Jn]=Ct[Pn]=Ct[pn]=!1;var _3={À:"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"},m3={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Q3={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},b3={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},w3=parseFloat,C3=parseInt,pa=typeof nn=="object"&&nn&&nn.Object===Object&&nn,E3=typeof self=="object"&&self&&self.Object===Object&&self,Yt=pa||E3||Function("return this")(),Mi=o&&!o.nodeType&&o,mr=Mi&&!0&&n&&!n.nodeType&&n,ha=mr&&mr.exports===Mi,Di=ha&&pa.process,me=function(){try{var m=mr&&mr.require&&mr.require("util").types;return m||Di&&Di.binding&&Di.binding("util")}catch{}}(),da=me&&me.isArrayBuffer,va=me&&me.isDate,ga=me&&me.isMap,ya=me&&me.isRegExp,_a=me&&me.isSet,ma=me&&me.isTypedArray,A3=vt("length"),I3=gt(_3),L3=gt(m3),x3=gt(Q3),k3=function m(E){function s(t){if(Tt(t)&&!et(t)&&!(t instanceof U)){if(t instanceof J)return t;if(mt.call(t,"__wrapped__"))return hs(t)}return new J(t)}function j(){}function J(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=v}function U(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=_e,this.__views__=[]}function ue(){var t=new U(this.__wrapped__);return t.__actions__=ae(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ae(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ae(this.__views__),t}function Hi(){if(this.__filtered__){var t=new U(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function O3(){var t=this.__wrapped__.value(),e=this.__dir__,r=et(t),i=e<0,c=r?t.length:0,h=B2(0,c,this.__views__),g=h.start,y=h.end,b=y-g,x=i?y:g-1,A=this.__iteratees__,O=A.length,V=0,S=Jt(b,this.__takeCount__);if(!r||!i&&c==b&&S==b)return ja(t,this.__actions__);var X=[];t:for(;b--&&V<S;){x+=e;for(var ot=-1,K=t[x];++ot<O;){var ct=A[ot],lt=ct.iteratee,Rt=ct.type,fe=lt(K);if(Rt==hi)K=fe;else if(!fe){if(Rt==He)continue t;break t}}X[V++]=K}return X}function Qr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function T3(){this.__data__=An?An(null):{},this.size=0}function N3(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function M3(t){var e=this.__data__;if(An){var r=e[t];return r===gr?v:r}return mt.call(e,t)?e[t]:v}function D3(t){var e=this.__data__;return An?e[t]!==v:mt.call(e,t)}function H3(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=An&&e===v?gr:e,this}function Ye(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function V3(){this.__data__=[],this.size=0}function W3(t){var e=this.__data__,r=no(e,t);return!(r<0)&&(r==e.length-1?e.pop():No.call(e,r,1),--this.size,!0)}function Z3(t){var e=this.__data__,r=no(e,t);return r<0?v:e[r][1]}function B3(t){return no(this.__data__,t)>-1}function j3(t,e){var r=this.__data__,i=no(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}function Ge(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function z3(){this.size=0,this.__data__={hash:new Qr,map:new(Cn||Ye),string:new Qr}}function U3(t){var e=go(this,t).delete(t);return this.size-=e?1:0,e}function $3(t){return go(this,t).get(t)}function F3(t){return go(this,t).has(t)}function S3(t,e){var r=go(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}function br(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Ge;++e<r;)this.add(t[e])}function q3(t){return this.__data__.set(t,gr),this}function Y3(t){return this.__data__.has(t)}function Oe(t){this.size=(this.__data__=new Ye(t)).size}function G3(){this.__data__=new Ye,this.size=0}function X3(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function K3(t){return this.__data__.get(t)}function J3(t){return this.__data__.has(t)}function P3(t,e){var r=this.__data__;if(r instanceof Ye){var i=r.__data__;if(!Cn||i.length<an-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ge(i)}return r.set(t,e),this.size=r.size,this}function Qa(t,e){var r=et(t),i=!r&&Lr(t),c=!r&&!i&&hr(t),h=!r&&!i&&!c&&tn(t),g=r||i||c||h,y=g?ut(t.length,Gh):[],b=y.length;for(var x in t)!e&&!mt.call(t,x)||g&&(x=="length"||c&&(x=="offset"||x=="parent")||h&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||Pe(x,b))||y.push(x);return y}function ba(t){var e=t.length;return e?t[Si(0,e-1)]:v}function R3(t,e){return yo(ae(t),wr(e,0,t.length))}function t2(t){return yo(ae(t))}function Vi(t,e,r){(r===v||Te(t[e],r))&&(r!==v||e in t)||Xe(t,e,r)}function dn(t,e,r){var i=t[e];mt.call(t,e)&&Te(i,r)&&(r!==v||e in t)||Xe(t,e,r)}function no(t,e){for(var r=t.length;r--;)if(Te(t[r][0],e))return r;return-1}function e2(t,e,r,i){return pr(t,function(c,h,g){e(i,c,r(c),g)}),i}function wa(t,e){return t&&Ze(e,$t(e),t)}function r2(t,e){return t&&Ze(e,ce(e),t)}function Xe(t,e,r){e=="__proto__"&&Mo?Mo(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function Wi(t,e){for(var r=-1,i=e.length,c=Zt(i),h=t==null;++r<i;)c[r]=h?v:l1(t,e[r]);return c}function wr(t,e,r){return t===t&&(r!==v&&(t=t<=r?t:r),e!==v&&(t=t>=e?t:e)),t}function Qe(t,e,r,i,c,h){var g,y=e&qt,b=e&Br,x=e&Me;if(r&&(g=c?r(t,i,c,h):r(t)),g!==v)return g;if(!xt(t))return t;var A=et(t);if(A){if(g=z2(t),!y)return ae(t,g)}else{var O=Pt(t),V=O==Pn||O==Uu;if(hr(t))return Ua(t,y);if(O==qe||O==wt||V&&!c){if(g=b||V?{}:us(t),!y)return b?T2(t,r2(g,t)):O2(t,wa(g,t))}else{if(!Ct[O])return c?t:{};g=U2(t,O,y)}}h||(h=new Oe);var S=h.get(t);if(S)return S;h.set(t,g),nc(t)?t.forEach(function(K){g.add(Qe(K,e,r,K,t,h))}):rc(t)&&t.forEach(function(K,ct){g.set(ct,Qe(K,e,r,ct,t,h))});var X=x?b?r1:e1:b?ce:$t,ot=A?v:X(t);return l(ot||t,function(K,ct){ot&&(ct=K,K=t[ct]),dn(g,ct,Qe(K,e,r,ct,t,h))}),g}function n2(t){var e=$t(t);return function(r){return Ca(r,t,e)}}function Ca(t,e,r){var i=r.length;if(t==null)return!i;for(t=At(t);i--;){var c=r[i],h=e[c],g=t[c];if(g===v&&!(c in t)||!h(g))return!1}return!0}function Ea(t,e,r){if(typeof t!="function")throw new Ee(Ot);return Ln(function(){t.apply(v,r)},e)}function vn(t,e,r,i){var c=-1,h=Q,g=!0,y=t.length,b=[],x=e.length;if(!y)return b;r&&(e=C(e,yt(r))),i?(h=w,g=!1):e.length>=an&&(h=Qt,g=!1,e=new br(e));t:for(;++c<y;){var A=t[c],O=r==null?A:r(A);if(A=i||A!==0?A:0,g&&O===O){for(var V=x;V--;)if(e[V]===O)continue t;b.push(A)}else h(e,O,i)||b.push(A)}return b}function o2(t,e){var r=!0;return pr(t,function(i,c,h){return r=!!e(i,c,h)}),r}function oo(t,e,r){for(var i=-1,c=t.length;++i<c;){var h=t[i],g=e(h);if(g!=null&&(y===v?g===g&&!de(g):r(g,y)))var y=g,b=h}return b}function i2(t,e,r,i){var c=t.length;for(r=it(r),r<0&&(r=-r>c?0:c+r),i=i===v||i>c?c:it(i),i<0&&(i+=c),i=r>i?0:Ts(i);r<i;)t[r++]=e;return t}function Aa(t,e){var r=[];return pr(t,function(i,c,h){e(i,c,h)&&r.push(i)}),r}function Gt(t,e,r,i,c){var h=-1,g=t.length;for(r||(r=F2),c||(c=[]);++h<g;){var y=t[h];e>0&&r(y)?e>1?Gt(y,e-1,r,i,c):k(c,y):i||(c[c.length]=y)}return c}function We(t,e){return t&&C1(t,e,$t)}function Zi(t,e){return t&&Gs(t,e,$t)}function io(t,e){return d(e,function(r){return Re(t[r])})}function Cr(t,e){e=cr(e,t);for(var r=0,i=e.length;t!=null&&r<i;)t=t[Be(e[r++])];return r&&r==i?t:v}function Ia(t,e,r){var i=e(t);return et(t)?i:k(i,r(t))}function oe(t){return t==null?t===v?b0:m0:Ir&&Ir in At(t)?Z2(t):K2(t)}function Bi(t,e){return t>e}function u2(t,e){return t!=null&&mt.call(t,e)}function a2(t,e){return t!=null&&e in At(t)}function s2(t,e,r){return t>=Jt(e,r)&&t<Bt(e,r)}function ji(t,e,r){for(var i=r?w:Q,c=t[0].length,h=t.length,g=h,y=Zt(h),b=1/0,x=[];g--;){var A=t[g];g&&e&&(A=C(A,yt(e))),b=Jt(A.length,b),y[g]=!r&&(e||c>=120&&A.length>=120)?new br(g&&A):v}A=t[0];var O=-1,V=y[0];t:for(;++O<c&&x.length<b;){var S=A[O],X=e?e(S):S;if(S=r||S!==0?S:0,!(V?Qt(V,X):i(x,X,r))){for(g=h;--g;){var ot=y[g];if(!(ot?Qt(ot,X):i(t[g],X,r)))continue t}V&&V.push(X),x.push(S)}}return x}function c2(t,e,r,i){return We(t,function(c,h,g){e(i,r(c),h,g)}),i}function gn(t,e,r){e=cr(e,t),t=ls(t,e);var i=t==null?t:t[Be(we(e))];return i==null?v:u(i,t,r)}function La(t){return Tt(t)&&oe(t)==wt}function l2(t){return Tt(t)&&oe(t)==hn}function f2(t){return Tt(t)&&oe(t)==sn}function yn(t,e,r,i,c){return t===e||(t==null||e==null||!Tt(t)&&!Tt(e)?t!==t&&e!==e:p2(t,e,r,i,yn,c))}function p2(t,e,r,i,c,h){var g=et(t),y=et(e),b=g?Fe:Pt(t),x=y?Fe:Pt(e);b=b==wt?qe:b,x=x==wt?qe:x;var A=b==qe,O=x==qe,V=b==x;if(V&&hr(t)){if(!hr(e))return!1;g=!0,A=!1}if(V&&!A)return h||(h=new Oe),g||tn(t)?os(t,e,r,i,c,h):V2(t,e,b,r,i,c,h);if(!(r&De)){var S=A&&mt.call(t,"__wrapped__"),X=O&&mt.call(e,"__wrapped__");if(S||X){var ot=S?t.value():t,K=X?e.value():e;return h||(h=new Oe),c(ot,K,r,i,h)}}return!!V&&(h||(h=new Oe),W2(t,e,r,i,c,h))}function h2(t){return Tt(t)&&Pt(t)==xe}function zi(t,e,r,i){var c=r.length,h=c,g=!i;if(t==null)return!h;for(t=At(t);c--;){var y=r[c];if(g&&y[2]?y[1]!==t[y[0]]:!(y[0]in t))return!1}for(;++c<h;){y=r[c];var b=y[0],x=t[b],A=y[1];if(g&&y[2]){if(x===v&&!(b in t))return!1}else{var O=new Oe;if(i)var V=i(x,A,b,t,e,O);if(!(V===v?yn(A,x,De|ir,i,O):V))return!1}}return!0}function xa(t){return!(!xt(t)||q2(t))&&(Re(t)?Rh:F0).test(Ar(t))}function d2(t){return Tt(t)&&oe(t)==ln}function v2(t){return Tt(t)&&Pt(t)==ke}function g2(t){return Tt(t)&&wo(t.length)&&!!Et[oe(t)]}function ka(t){return typeof t=="function"?t:t==null?le:typeof t=="object"?et(t)?Na(t[0],t[1]):Ta(t):Ws(t)}function Ui(t){if(!Qn(t))return i7(t);var e=[];for(var r in At(t))mt.call(t,r)&&r!="constructor"&&e.push(r);return e}function y2(t){if(!xt(t))return X2(t);var e=Qn(t),r=[];for(var i in t)(i!="constructor"||!e&&mt.call(t,i))&&r.push(i);return r}function $i(t,e){return t<e}function Oa(t,e){var r=-1,i=se(t)?Zt(t.length):[];return pr(t,function(c,h,g){i[++r]=e(c,h,g)}),i}function Ta(t){var e=n1(t);return e.length==1&&e[0][2]?ss(e[0][0],e[0][1]):function(r){return r===t||zi(r,t,e)}}function Na(t,e){return o1(t)&&as(e)?ss(Be(t),e):function(r){var i=l1(r,t);return i===v&&i===e?f1(r,t):yn(e,i,De|ir)}}function uo(t,e,r,i,c){t!==e&&C1(e,function(h,g){if(c||(c=new Oe),xt(h))_2(t,e,g,r,uo,i,c);else{var y=i?i(u1(t,g),h,g+"",t,e,c):v;y===v&&(y=h),Vi(t,g,y)}},ce)}function _2(t,e,r,i,c,h,g){var y=u1(t,r),b=u1(e,r),x=g.get(b);if(x)return Vi(t,r,x),v;var A=h?h(y,b,r+"",t,e,g):v,O=A===v;if(O){var V=et(b),S=!V&&hr(b),X=!V&&!S&&tn(b);A=b,V||S||X?et(y)?A=y:Dt(y)?A=ae(y):S?(O=!1,A=Ua(b,!0)):X?(O=!1,A=$a(b,!0)):A=[]:bn(b)||Lr(b)?(A=y,Lr(y)?A=Ns(y):xt(y)&&!Re(y)||(A=us(b))):O=!1}O&&(g.set(b,A),c(A,b,i,h,g),g.delete(b)),Vi(t,r,A)}function Ma(t,e){var r=t.length;if(r)return e+=e<0?r:0,Pe(e,r)?t[e]:v}function Da(t,e,r){e=e.length?C(e,function(c){return et(c)?function(h){return Cr(h,c.length===1?c[0]:c)}:c}):[le];var i=-1;return e=C(e,yt(P())),G(Oa(t,function(c,h,g){return{criteria:C(e,function(y){return y(c)}),index:++i,value:c}}),function(c,h){return k2(c,h,r)})}function m2(t,e){return Ha(t,e,function(r,i){return f1(t,i)})}function Ha(t,e,r){for(var i=-1,c=e.length,h={};++i<c;){var g=e[i],y=Cr(t,g);r(y,g)&&_n(h,cr(g,t),y)}return h}function Q2(t){return function(e){return Cr(e,t)}}function Fi(t,e,r,i){var c=i?rt:F,h=-1,g=e.length,y=t;for(t===e&&(e=ae(e)),r&&(y=C(t,yt(r)));++h<g;)for(var b=0,x=e[h],A=r?r(x):x;(b=c(y,A,b,i))>-1;)y!==t&&No.call(y,b,1),No.call(t,b,1);return t}function Va(t,e){for(var r=t?e.length:0,i=r-1;r--;){var c=e[r];if(r==i||c!==h){var h=c;Pe(c)?No.call(t,c,1):Gi(t,c)}}return t}function Si(t,e){return t+Ho(Ss()*(e-t+1))}function b2(t,e,r,i){for(var c=-1,h=Bt(Do((e-t)/(r||1)),0),g=Zt(h);h--;)g[i?h:++c]=t,t+=r;return g}function qi(t,e){var r="";if(!t||e<1||e>Ve)return r;do e%2&&(r+=t),e=Ho(e/2),e&&(t+=t);while(e);return r}function st(t,e){return I1(cs(t,e,le),t+"")}function w2(t){return ba(Gr(t))}function C2(t,e){var r=Gr(t);return yo(r,wr(e,0,r.length))}function _n(t,e,r,i){if(!xt(t))return t;e=cr(e,t);for(var c=-1,h=e.length,g=h-1,y=t;y!=null&&++c<h;){var b=Be(e[c]),x=r;if(b==="__proto__"||b==="constructor"||b==="prototype")return t;if(c!=g){var A=y[b];x=i?i(A,b,y):v,x===v&&(x=xt(A)?A:Pe(e[c+1])?[]:{})}dn(y,b,x),y=y[b]}return t}function E2(t){return yo(Gr(t))}function be(t,e,r){var i=-1,c=t.length;e<0&&(e=-e>c?0:c+e),r=r>c?c:r,r<0&&(r+=c),c=e>r?0:r-e>>>0,e>>>=0;for(var h=Zt(c);++i<c;)h[i]=t[i+e];return h}function A2(t,e){var r;return pr(t,function(i,c,h){return r=e(i,c,h),!r}),!!r}function ao(t,e,r){var i=0,c=t==null?i:t.length;if(typeof e=="number"&&e===e&&c<=gi){for(;i<c;){var h=i+c>>>1,g=t[h];g!==null&&!de(g)&&(r?g<=e:g<e)?i=h+1:c=h}return c}return Yi(t,e,le,r)}function Yi(t,e,r,i){var c=0,h=t==null?0:t.length;if(h===0)return 0;e=r(e);for(var g=e!==e,y=e===null,b=de(e),x=e===v;c<h;){var A=Ho((c+h)/2),O=r(t[A]),V=O!==v,S=O===null,X=O===O,ot=de(O);if(g)var K=i||X;else K=x?X&&(i||V):y?X&&V&&(i||!S):b?X&&V&&!S&&(i||!ot):!S&&!ot&&(i?O<=e:O<e);K?c=A+1:h=A}return Jt(h,vi)}function Wa(t,e){for(var r=-1,i=t.length,c=0,h=[];++r<i;){var g=t[r],y=e?e(g):g;if(!r||!Te(y,b)){var b=y;h[c++]=g===0?0:g}}return h}function Za(t){return typeof t=="number"?t:de(t)?zr:+t}function he(t){if(typeof t=="string")return t;if(et(t))return C(t,he)+"";if(de(t))return qs?qs.call(t):"";var e=t+"";return e=="0"&&1/t==-$e?"-0":e}function sr(t,e,r){var i=-1,c=Q,h=t.length,g=!0,y=[],b=y;if(r)g=!1,c=w;else if(h>=an){var x=e?null:g7(t);if(x)return nt(x);g=!1,c=Qt,b=new br}else b=e?[]:y;t:for(;++i<h;){var A=t[i],O=e?e(A):A;if(A=r||A!==0?A:0,g&&O===O){for(var V=b.length;V--;)if(b[V]===O)continue t;e&&b.push(O),y.push(A)}else c(b,O,r)||(b!==y&&b.push(O),y.push(A))}return y}function Gi(t,e){return e=cr(e,t),t=ls(t,e),t==null||delete t[Be(we(e))]}function Ba(t,e,r,i){return _n(t,e,r(Cr(t,e)),i)}function so(t,e,r,i){for(var c=t.length,h=i?c:-1;(i?h--:++h<c)&&e(t[h],h,t););return r?be(t,i?0:h,i?h+1:c):be(t,i?h+1:0,i?c:h)}function ja(t,e){var r=t;return r instanceof U&&(r=r.value()),N(e,function(i,c){return c.func.apply(c.thisArg,k([i],c.args))},r)}function Xi(t,e,r){var i=t.length;if(i<2)return i?sr(t[0]):[];for(var c=-1,h=Zt(i);++c<i;)for(var g=t[c],y=-1;++y<i;)y!=c&&(h[c]=vn(h[c]||g,t[y],e,r));return sr(Gt(h,1),e,r)}function za(t,e,r){for(var i=-1,c=t.length,h=e.length,g={};++i<c;)r(g,t[i],i<h?e[i]:v);return g}function Ki(t){return Dt(t)?t:[]}function Ji(t){return typeof t=="function"?t:le}function cr(t,e){return et(t)?t:o1(t,e)?[t]:Rs(_t(t))}function lr(t,e,r){var i=t.length;return r=r===v?i:r,!e&&r>=i?t:be(t,e,r)}function Ua(t,e){if(e)return t.slice();var r=t.length,i=js?js(r):new t.constructor(r);return t.copy(i),i}function Pi(t){var e=new t.constructor(t.byteLength);return new Oo(e).set(new Oo(t)),e}function I2(t,e){return new t.constructor(e?Pi(t.buffer):t.buffer,t.byteOffset,t.byteLength)}function L2(t){var e=new t.constructor(t.source,Yu.exec(t));return e.lastIndex=t.lastIndex,e}function x2(t){return In?At(In.call(t)):{}}function $a(t,e){return new t.constructor(e?Pi(t.buffer):t.buffer,t.byteOffset,t.length)}function Fa(t,e){if(t!==e){var r=t!==v,i=t===null,c=t===t,h=de(t),g=e!==v,y=e===null,b=e===e,x=de(e);if(!y&&!x&&!h&&t>e||h&&g&&b&&!y&&!x||i&&g&&b||!r&&b||!c)return 1;if(!i&&!h&&!x&&t<e||x&&r&&c&&!i&&!h||y&&r&&c||!g&&c||!b)return-1}return 0}function k2(t,e,r){for(var i=-1,c=t.criteria,h=e.criteria,g=c.length,y=r.length;++i<g;){var b=Fa(c[i],h[i]);if(b)return i>=y?b:b*(r[i]=="desc"?-1:1)}return t.index-e.index}function Sa(t,e,r,i){for(var c=-1,h=t.length,g=r.length,y=-1,b=e.length,x=Bt(h-g,0),A=Zt(b+x),O=!i;++y<b;)A[y]=e[y];for(;++c<g;)(O||c<h)&&(A[r[c]]=t[c]);for(;x--;)A[y++]=t[c++];return A}function qa(t,e,r,i){for(var c=-1,h=t.length,g=-1,y=r.length,b=-1,x=e.length,A=Bt(h-y,0),O=Zt(A+x),V=!i;++c<A;)O[c]=t[c];for(var S=c;++b<x;)O[S+b]=e[b];for(;++g<y;)(V||c<h)&&(O[S+r[g]]=t[c++]);return O}function ae(t,e){var r=-1,i=t.length;for(e||(e=Zt(i));++r<i;)e[r]=t[r];return e}function Ze(t,e,r,i){var c=!r;r||(r={});for(var h=-1,g=e.length;++h<g;){var y=e[h],b=i?i(r[y],t[y],y,r,t):v;b===v&&(b=t[y]),c?Xe(r,y,b):dn(r,y,b)}return r}function O2(t,e){return Ze(t,A1(t),e)}function T2(t,e){return Ze(t,Js(t),e)}function co(t,e){return function(r,i){var c=et(r)?a:e2,h=e?e():{};return c(r,t,P(i,2),h)}}function Sr(t){return st(function(e,r){var i=-1,c=r.length,h=c>1?r[c-1]:v,g=c>2?r[2]:v;for(h=t.length>3&&typeof h=="function"?(c--,h):v,g&&ie(r[0],r[1],g)&&(h=c<3?v:h,c=1),e=At(e);++i<c;){var y=r[i];y&&t(e,y,i,h)}return e})}function Ya(t,e){return function(r,i){if(r==null)return r;if(!se(r))return t(r,i);for(var c=r.length,h=e?c:-1,g=At(r);(e?h--:++h<c)&&i(g[h],h,g)!==!1;);return r}}function Ga(t){return function(e,r,i){for(var c=-1,h=At(e),g=i(e),y=g.length;y--;){var b=g[t?y:++c];if(r(h[b],b,h)===!1)break}return e}}function N2(t,e,r){function i(){return(this&&this!==Yt&&this instanceof i?h:t).apply(c?r:this,arguments)}var c=e&re,h=mn(t);return i}function Xa(t){return function(e){e=_t(e);var r=kt(e)?Kt(e):v,i=r?r[0]:e.charAt(0),c=r?lr(r,1).join(""):e.slice(1);return i[t]()+c}}function qr(t){return function(e){return N(Vs(Hs(e).replace(f3,"")),t,"")}}function mn(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=Rr(t.prototype),i=t.apply(r,e);return xt(i)?i:r}}function M2(t,e,r){function i(){for(var h=arguments.length,g=Zt(h),y=h,b=Yr(i);y--;)g[y]=arguments[y];var x=h<3&&g[0]!==b&&g[h-1]!==b?[]:$(g,b);return h-=x.length,h<r?ts(t,e,lo,i.placeholder,v,g,x,v,v,r-h):u(this&&this!==Yt&&this instanceof i?c:t,this,g)}var c=mn(t);return i}function Ka(t){return function(e,r,i){var c=At(e);if(!se(e)){var h=P(r,3);e=$t(e),r=function(y){return h(c[y],y,c)}}var g=t(e,r,i);return g>-1?c[h?e[g]:g]:v}}function Ja(t){return Je(function(e){var r=e.length,i=r,c=J.prototype.thru;for(t&&e.reverse();i--;){var h=e[i];if(typeof h!="function")throw new Ee(Ot);if(c&&!g&&vo(h)=="wrapper")var g=new J([],!0)}for(i=g?i:r;++i<r;){h=e[i];var y=vo(h),b=y=="wrapper"?E1(h):v;g=b&&i1(b[0])&&b[1]==(Ie|ge|ye|ne)&&!b[4].length&&b[9]==1?g[vo(b[0])].apply(g,b[3]):h.length==1&&i1(h)?g[y]():g.thru(h)}return function(){var x=arguments,A=x[0];if(g&&x.length==1&&et(A))return g.plant(A).value();for(var O=0,V=r?e[O].apply(this,x):A;++O<r;)V=e[O].call(this,V);return V}})}function lo(t,e,r,i,c,h,g,y,b,x){function A(){for(var ct=arguments.length,lt=Zt(ct),Rt=ct;Rt--;)lt[Rt]=arguments[Rt];if(X)var fe=Yr(A),dr=It(lt,fe);if(i&&(lt=Sa(lt,i,c,X)),h&&(lt=qa(lt,h,g,X)),ct-=dr,X&&ct<x)return ts(t,e,lo,A.placeholder,r,lt,$(lt,fe),y,b,x-ct);var Nt=V?r:this,Ae=S?Nt[t]:t;return ct=lt.length,y?lt=J2(lt,y):ot&&ct>1&&lt.reverse(),O&&b<ct&&(lt.length=b),this&&this!==Yt&&this instanceof A&&(Ae=K||mn(Ae)),Ae.apply(Nt,lt)}var O=e&Ie,V=e&re,S=e&Ue,X=e&(ge|ur),ot=e&Le,K=S?v:mn(t);return A}function Pa(t,e){return function(r,i){return c2(r,t,e(i),{})}}function fo(t,e){return function(r,i){var c;if(r===v&&i===v)return e;if(r!==v&&(c=r),i!==v){if(c===v)return i;typeof r=="string"||typeof i=="string"?(r=he(r),i=he(i)):(r=Za(r),i=Za(i)),c=t(r,i)}return c}}function Ri(t){return Je(function(e){return e=C(e,yt(P())),st(function(r){var i=this;return t(e,function(c){return u(c,i,r)})})})}function po(t,e){e=e===v?" ":he(e);var r=e.length;if(r<2)return r?qi(e,t):e;var i=qi(e,Do(t/Wt(e)));return kt(e)?lr(Kt(i),0,t).join(""):i.slice(0,t)}function D2(t,e,r,i){function c(){for(var y=-1,b=arguments.length,x=-1,A=i.length,O=Zt(A+b),V=this&&this!==Yt&&this instanceof c?g:t;++x<A;)O[x]=i[x];for(;b--;)O[x++]=arguments[++y];return u(V,h?r:this,O)}var h=e&re,g=mn(t);return c}function Ra(t){return function(e,r,i){return i&&typeof i!="number"&&ie(e,r,i)&&(r=i=v),e=tr(e),r===v?(r=e,e=0):r=tr(r),i=i===v?e<r?1:-1:tr(i),b2(e,r,i,t)}}function ho(t){return function(e,r){return typeof e=="string"&&typeof r=="string"||(e=Ce(e),r=Ce(r)),t(e,r)}}function ts(t,e,r,i,c,h,g,y,b,x){var A=e&ge,O=A?g:v,V=A?v:g,S=A?h:v,X=A?v:h;e|=A?ye:ar,e&=~(A?ar:ye),e&Kn||(e&=~(re|Ue));var ot=[t,e,c,S,O,X,V,y,b,x],K=r.apply(v,ot);return i1(t)&&Ps(K,ot),K.placeholder=i,fs(K,t,e)}function t1(t){var e=Xr[t];return function(r,i){if(r=Ce(r),i=i==null?0:Jt(it(i),292),i&&Fs(r)){var c=(_t(r)+"e").split("e");return c=(_t(e(c[0]+"e"+(+c[1]+i)))+"e").split("e"),+(c[0]+"e"+(+c[1]-i))}return e(r)}}function es(t){return function(e){var r=Pt(e);return r==xe?M(e):r==ke?Vt(e):R(e,t(e))}}function Ke(t,e,r,i,c,h,g,y){var b=e&Ue;if(!b&&typeof t!="function")throw new Ee(Ot);var x=i?i.length:0;if(x||(e&=~(ye|ar),i=c=v),g=g===v?g:Bt(it(g),0),y=y===v?y:it(y),x-=c?c.length:0,e&ar){var A=i,O=c;i=c=v}var V=b?v:E1(t),S=[t,e,r,i,c,A,O,h,g,y];if(V&&G2(S,V),t=S[0],e=S[1],r=S[2],i=S[3],c=S[4],y=S[9]=S[9]===v?b?0:t.length:Bt(S[9]-x,0),!y&&e&(ge|ur)&&(e&=~(ge|ur)),e&&e!=re)X=e==ge||e==ur?M2(t,e,y):e!=ye&&e!=(re|ye)||c.length?lo.apply(v,S):D2(t,e,r,i);else var X=N2(t,e,r);return fs((V?Xs:Ps)(X,S),t,e)}function rs(t,e,r,i){return t===v||Te(t,Kr[r])&&!mt.call(i,r)?e:t}function ns(t,e,r,i,c,h){return xt(t)&&xt(e)&&(h.set(e,t),uo(t,e,v,ns,h),h.delete(e)),t}function H2(t){return bn(t)?v:t}function os(t,e,r,i,c,h){var g=r&De,y=t.length,b=e.length;if(y!=b&&!(g&&b>y))return!1;var x=h.get(t),A=h.get(e);if(x&&A)return x==e&&A==t;var O=-1,V=!0,S=r&ir?new br:v;for(h.set(t,e),h.set(e,t);++O<y;){var X=t[O],ot=e[O];if(i)var K=g?i(ot,X,O,e,t,h):i(X,ot,O,t,e,h);if(K!==v){if(K)continue;V=!1;break}if(S){if(!T(e,function(ct,lt){if(!Qt(S,lt)&&(X===ct||c(X,ct,r,i,h)))return S.push(lt)})){V=!1;break}}else if(X!==ot&&!c(X,ot,r,i,h)){V=!1;break}}return h.delete(t),h.delete(e),V}function V2(t,e,r,i,c,h,g){switch(r){case Ur:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case hn:return!(t.byteLength!=e.byteLength||!h(new Oo(t),new Oo(e)));case Se:case sn:case cn:return Te(+t,+e);case Jn:return t.name==e.name&&t.message==e.message;case ln:case fn:return t==e+"";case xe:var y=M;case ke:var b=i&De;if(y||(y=nt),t.size!=e.size&&!b)return!1;var x=g.get(t);if(x)return x==e;i|=ir,g.set(t,e);var A=os(y(t),y(e),i,c,h,g);return g.delete(t),A;case Rn:if(In)return In.call(t)==In.call(e)}return!1}function W2(t,e,r,i,c,h){var g=r&De,y=e1(t),b=y.length;if(b!=e1(e).length&&!g)return!1;for(var x=b;x--;){var A=y[x];if(!(g?A in e:mt.call(e,A)))return!1}var O=h.get(t),V=h.get(e);if(O&&V)return O==e&&V==t;var S=!0;h.set(t,e),h.set(e,t);for(var X=g;++x<b;){A=y[x];var ot=t[A],K=e[A];if(i)var ct=g?i(K,ot,A,e,t,h):i(ot,K,A,t,e,h);if(!(ct===v?ot===K||c(ot,K,r,i,h):ct)){S=!1;break}X||(X=A=="constructor")}if(S&&!X){var lt=t.constructor,Rt=e.constructor;lt!=Rt&&"constructor"in t&&"constructor"in e&&!(typeof lt=="function"&&lt instanceof lt&&typeof Rt=="function"&&Rt instanceof Rt)&&(S=!1)}return h.delete(t),h.delete(e),S}function Je(t){return I1(cs(t,v,gs),t+"")}function e1(t){return Ia(t,$t,A1)}function r1(t){return Ia(t,ce,Js)}function vo(t){for(var e=t.name+"",r=Pr[e],i=mt.call(Pr,e)?r.length:0;i--;){var c=r[i],h=c.func;if(h==null||h==t)return c.name}return e}function Yr(t){return(mt.call(s,"placeholder")?s:t).placeholder}function P(){var t=s.iteratee||h1;return t=t===h1?ka:t,arguments.length?t(arguments[0],arguments[1]):t}function go(t,e){var r=t.__data__;return S2(e)?r[typeof e=="string"?"string":"hash"]:r.map}function n1(t){for(var e=$t(t),r=e.length;r--;){var i=e[r],c=t[i];e[r]=[i,c,as(c)]}return e}function Er(t,e){var r=Xt(t,e);return xa(r)?r:v}function Z2(t){var e=mt.call(t,Ir),r=t[Ir];try{t[Ir]=v;var i=!0}catch{}var c=xo.call(t);return i&&(e?t[Ir]=r:delete t[Ir]),c}function B2(t,e,r){for(var i=-1,c=r.length;++i<c;){var h=r[i],g=h.size;switch(h.type){case"drop":t+=g;break;case"dropRight":e-=g;break;case"take":e=Jt(e,t+g);break;case"takeRight":t=Bt(t,e-g)}}return{start:t,end:e}}function j2(t){var e=t.match(V0);return e?e[1].split(W0):[]}function is(t,e,r){e=cr(e,t);for(var i=-1,c=e.length,h=!1;++i<c;){var g=Be(e[i]);if(!(h=t!=null&&r(t,g)))break;t=t[g]}return h||++i!=c?h:(c=t==null?0:t.length,!!c&&wo(c)&&Pe(g,c)&&(et(t)||Lr(t)))}function z2(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&mt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function us(t){return typeof t.constructor!="function"||Qn(t)?{}:Rr(To(t))}function U2(t,e,r){var i=t.constructor;switch(e){case hn:return Pi(t);case Se:case sn:return new i(+t);case Ur:return I2(t,r);case yi:case _i:case mi:case Qi:case bi:case wi:case Ci:case Ei:case Ai:return $a(t,r);case xe:return new i;case cn:case fn:return new i(t);case ln:return L2(t);case ke:return new i;case Rn:return x2(t)}}function $2(t,e){var r=e.length;if(!r)return t;var i=r-1;return e[i]=(r>1?"& ":"")+e[i],e=e.join(r>2?", ":" "),t.replace(H0,`{
8
+ */kn.exports,function(n,o){(function(){function u(m,E,s){switch(s.length){case 0:return m.call(E);case 1:return m.call(E,s[0]);case 2:return m.call(E,s[0],s[1]);case 3:return m.call(E,s[0],s[1],s[2])}return m.apply(E,s)}function a(m,E,s,B){for(var J=-1,z=m==null?0:m.length;++J<z;){var ie=m[J];E(B,ie,s(ie),m)}return B}function l(m,E){for(var s=-1,B=m==null?0:m.length;++s<B&&E(m[s],s,m)!==!1;);return m}function f(m,E){for(var s=m==null?0:m.length;s--&&E(m[s],s,m)!==!1;);return m}function p(m,E){for(var s=-1,B=m==null?0:m.length;++s<B;)if(!E(m[s],s,m))return!1;return!0}function d(m,E){for(var s=-1,B=m==null?0:m.length,J=0,z=[];++s<B;){var ie=m[s];E(ie,s,m)&&(z[J++]=ie)}return z}function Q(m,E){return!!(m!=null&&m.length)&&$(m,E,0)>-1}function w(m,E,s){for(var B=-1,J=m==null?0:m.length;++B<J;)if(s(E,m[B]))return!0;return!1}function C(m,E){for(var s=-1,B=m==null?0:m.length,J=Array(B);++s<B;)J[s]=E(m[s],s,m);return J}function k(m,E){for(var s=-1,B=E.length,J=m.length;++s<B;)m[J+s]=E[s];return m}function N(m,E,s,B){var J=-1,z=m==null?0:m.length;for(B&&z&&(s=m[++J]);++J<z;)s=E(s,m[J],J,m);return s}function H(m,E,s,B){var J=m==null?0:m.length;for(B&&J&&(s=m[--J]);J--;)s=E(s,m[J],J,m);return s}function T(m,E){for(var s=-1,B=m==null?0:m.length;++s<B;)if(E(m[s],s,m))return!0;return!1}function Z(m){return m.split("")}function V(m){return m.match(Z0)||[]}function q(m,E,s){var B;return s(m,function(J,z,ie){if(E(J,z,ie))return B=z,!1}),B}function R(m,E,s,B){for(var J=m.length,z=s+(B?1:-1);B?z--:++z<J;)if(E(m[z],z,m))return z;return-1}function $(m,E,s){return E===E?$t(m,E,s):R(m,ht,s)}function ct(m,E,s,B){for(var J=s-1,z=m.length;++J<z;)if(B(m[J],E))return J;return-1}function ht(m){return m!==m}function dt(m,E){var s=m==null?0:m.length;return s?S(m,E)/s:jr}function mt(m){return function(E){return E==null?v:E[m]}}function gt(m){return function(E){return m==null?v:m[E]}}function D(m,E,s,B,J){return J(m,function(z,ie,Hi){s=B?(B=!1,z):E(s,z,ie,Hi)}),s}function G(m,E){var s=m.length;for(m.sort(E);s--;)m[s]=m[s].value;return m}function S(m,E){for(var s,B=-1,J=m.length;++B<J;){var z=E(m[B]);z!==v&&(s=s===v?z:s+z)}return s}function tt(m,E){for(var s=-1,B=Array(m);++s<m;)B[s]=E(s);return B}function et(m,E){return C(E,function(s){return[s,m[s]]})}function pt(m){return m&&m.slice(0,nr(m)+1).replace(Li,"")}function yt(m){return function(E){return m(E)}}function Tt(m,E){return C(E,function(s){return m[s]})}function wt(m,E){return m.has(E)}function it(m,E){for(var s=-1,B=m.length;++s<B&&$(E,m[s],0)>-1;);return s}function Gt(m,E){for(var s=m.length;s--&&$(E,m[s],0)>-1;);return s}function vr(m,E){for(var s=m.length,B=0;s--;)m[s]===E&&++B;return B}function ze(m){return"\\"+b3[m]}function Xt(m,E){return m==null?v:m[E]}function xt(m){return d3.test(m)}function Te(m){return v3.test(m)}function Y(m){for(var E,s=[];!(E=m.next()).done;)s.push(E.value);return s}function M(m){var E=-1,s=Array(m.size);return m.forEach(function(B,J){s[++E]=[J,B]}),s}function j(m,E){return function(s){return m(E(s))}}function U(m,E){for(var s=-1,B=m.length,J=0,z=[];++s<B;){var ie=m[s];ie!==E&&ie!==Wr||(m[s]=Wr,z[J++]=s)}return z}function nt(m){var E=-1,s=Array(m.size);return m.forEach(function(B){s[++E]=B}),s}function Ht(m){var E=-1,s=Array(m.size);return m.forEach(function(B){s[++E]=[B,B]}),s}function $t(m,E,s){for(var B=s-1,J=m.length;++B<J;)if(m[B]===E)return B;return-1}function Ft(m,E,s){for(var B=s+1;B--;)if(m[B]===E)return B;return B}function Vt(m){return xt(m)?Hr(m):A3(m)}function Kt(m){return xt(m)?Gn(m):Z(m)}function nr(m){for(var E=m.length;E--&&M0.test(m.charAt(E)););return E}function Hr(m){for(var E=Ni.lastIndex=0;Ni.test(m);)++E;return E}function Gn(m){return m.match(Ni)||[]}function ai(m){return m.match(h3)||[]}var v,si="4.17.21",an=200,ci="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Nt="Expected a function",Vr="Invalid `variable` option passed into `_.template`",gr="__lodash_hash_undefined__",Xn=500,Wr="__lodash_placeholder__",St=1,Zr=2,Ne=4,De=1,or=2,ee=1,Ue=2,Kn=4,de=8,ir=16,ve=32,ur=64,Ee=128,re=256,Ae=512,li=30,fi="...",pi=800,Br=16,Me=1,hi=2,yr=3,$e=1/0,He=9007199254740991,di=17976931348623157e292,jr=NaN,ge=4294967295,vi=ge-1,sn=ge>>>1,gi=[["ary",Ee],["bind",ee],["bindKey",Ue],["curry",de],["curryRight",ir],["flip",Ae],["partial",ve],["partialRight",ur],["rearg",re]],ut="[object Arguments]",At="[object Array]",zr="[object AsyncFunction]",Ie="[object Boolean]",Fe="[object Date]",_0="[object DOMException]",Jn="[object Error]",Pn="[object Function]",Uu="[object GeneratorFunction]",Le="[object Map]",cn="[object Number]",m0="[object Null]",Se="[object Object]",$u="[object Promise]",Q0="[object Proxy]",ln="[object RegExp]",xe="[object Set]",fn="[object String]",Rn="[object Symbol]",b0="[object Undefined]",pn="[object WeakMap]",w0="[object WeakSet]",hn="[object ArrayBuffer]",Ur="[object DataView]",yi="[object Float32Array]",_i="[object Float64Array]",mi="[object Int8Array]",Qi="[object Int16Array]",bi="[object Int32Array]",wi="[object Uint8Array]",Ci="[object Uint8ClampedArray]",Ei="[object Uint16Array]",Ai="[object Uint32Array]",C0=/\b__p \+= '';/g,E0=/\b(__p \+=) '' \+/g,A0=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Fu=/&(?:amp|lt|gt|quot|#39);/g,Su=/[&<>"']/g,I0=RegExp(Fu.source),L0=RegExp(Su.source),x0=/<%-([\s\S]+?)%>/g,k0=/<%([\s\S]+?)%>/g,qu=/<%=([\s\S]+?)%>/g,O0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T0=/^\w*$/,N0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ii=/[\\^$.*+?()[\]{}|]/g,D0=RegExp(Ii.source),Li=/^\s+/,M0=/\s/,H0=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,V0=/\{\n\/\* \[wrapped with (.+)\] \*/,W0=/,? & /,Z0=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,B0=/[()=,{}\[\]\/\s]/,j0=/\\(\\)?/g,z0=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Yu=/\w*$/,U0=/^[-+]0x[0-9a-f]+$/i,$0=/^0b[01]+$/i,F0=/^\[object .+?Constructor\]$/,S0=/^0o[0-7]+$/i,q0=/^(?:0|[1-9]\d*)$/,Y0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,to=/($^)/,G0=/['\n\r\u2028\u2029\\]/g,eo="\\ud800-\\udfff",X0="\\u0300-\\u036f",K0="\\ufe20-\\ufe2f",J0="\\u20d0-\\u20ff",Gu=X0+K0+J0,Xu="\\u2700-\\u27bf",Ku="a-z\\xdf-\\xf6\\xf8-\\xff",P0="\\xac\\xb1\\xd7\\xf7",R0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",t3="\\u2000-\\u206f",e3=" \\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",Ju="A-Z\\xc0-\\xd6\\xd8-\\xde",Pu="\\ufe0e\\ufe0f",Ru=P0+R0+t3+e3,xi="['’]",r3="["+eo+"]",ta="["+Ru+"]",ro="["+Gu+"]",ea="\\d+",n3="["+Xu+"]",ra="["+Ku+"]",na="[^"+eo+Ru+ea+Xu+Ku+Ju+"]",ki="\\ud83c[\\udffb-\\udfff]",o3="(?:"+ro+"|"+ki+")",oa="[^"+eo+"]",Oi="(?:\\ud83c[\\udde6-\\uddff]){2}",Ti="[\\ud800-\\udbff][\\udc00-\\udfff]",$r="["+Ju+"]",ia="\\u200d",ua="(?:"+ra+"|"+na+")",i3="(?:"+$r+"|"+na+")",aa="(?:"+xi+"(?:d|ll|m|re|s|t|ve))?",sa="(?:"+xi+"(?:D|LL|M|RE|S|T|VE))?",ca=o3+"?",la="["+Pu+"]?",u3="(?:"+ia+"(?:"+[oa,Oi,Ti].join("|")+")"+la+ca+")*",a3="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s3="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",fa=la+ca+u3,c3="(?:"+[n3,Oi,Ti].join("|")+")"+fa,l3="(?:"+[oa+ro+"?",ro,Oi,Ti,r3].join("|")+")",f3=RegExp(xi,"g"),p3=RegExp(ro,"g"),Ni=RegExp(ki+"(?="+ki+")|"+l3+fa,"g"),h3=RegExp([$r+"?"+ra+"+"+aa+"(?="+[ta,$r,"$"].join("|")+")",i3+"+"+sa+"(?="+[ta,$r+ua,"$"].join("|")+")",$r+"?"+ua+"+"+aa,$r+"+"+sa,s3,a3,ea,c3].join("|"),"g"),d3=RegExp("["+ia+eo+Gu+Pu+"]"),v3=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,g3=["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"],y3=-1,Ct={};Ct[yi]=Ct[_i]=Ct[mi]=Ct[Qi]=Ct[bi]=Ct[wi]=Ct[Ci]=Ct[Ei]=Ct[Ai]=!0,Ct[ut]=Ct[At]=Ct[hn]=Ct[Ie]=Ct[Ur]=Ct[Fe]=Ct[Jn]=Ct[Pn]=Ct[Le]=Ct[cn]=Ct[Se]=Ct[ln]=Ct[xe]=Ct[fn]=Ct[pn]=!1;var bt={};bt[ut]=bt[At]=bt[hn]=bt[Ur]=bt[Ie]=bt[Fe]=bt[yi]=bt[_i]=bt[mi]=bt[Qi]=bt[bi]=bt[Le]=bt[cn]=bt[Se]=bt[ln]=bt[xe]=bt[fn]=bt[Rn]=bt[wi]=bt[Ci]=bt[Ei]=bt[Ai]=!0,bt[Jn]=bt[Pn]=bt[pn]=!1;var _3={À:"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"},m3={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Q3={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},b3={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},w3=parseFloat,C3=parseInt,pa=typeof nn=="object"&&nn&&nn.Object===Object&&nn,E3=typeof self=="object"&&self&&self.Object===Object&&self,qt=pa||E3||Function("return this")(),Di=o&&!o.nodeType&&o,_r=Di&&!0&&n&&!n.nodeType&&n,ha=_r&&_r.exports===Di,Mi=ha&&pa.process,ye=function(){try{var m=_r&&_r.require&&_r.require("util").types;return m||Mi&&Mi.binding&&Mi.binding("util")}catch{}}(),da=ye&&ye.isArrayBuffer,va=ye&&ye.isDate,ga=ye&&ye.isMap,ya=ye&&ye.isRegExp,_a=ye&&ye.isSet,ma=ye&&ye.isTypedArray,A3=mt("length"),I3=gt(_3),L3=gt(m3),x3=gt(Q3),k3=function m(E){function s(t){if(kt(t)&&!rt(t)&&!(t instanceof z)){if(t instanceof J)return t;if(Qt.call(t,"__wrapped__"))return hs(t)}return new J(t)}function B(){}function J(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=v}function z(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ge,this.__views__=[]}function ie(){var t=new z(this.__wrapped__);return t.__actions__=ue(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ue(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ue(this.__views__),t}function Hi(){if(this.__filtered__){var t=new z(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function O3(){var t=this.__wrapped__.value(),e=this.__dir__,r=rt(t),i=e<0,c=r?t.length:0,h=B2(0,c,this.__views__),g=h.start,_=h.end,b=_-g,L=i?_:g-1,A=this.__iteratees__,O=A.length,W=0,F=Jt(b,this.__takeCount__);if(!r||!i&&c==b&&F==b)return ja(t,this.__actions__);var X=[];t:for(;b--&&W<F;){L+=e;for(var ot=-1,K=t[L];++ot<O;){var lt=A[ot],ft=lt.iteratee,Rt=lt.type,le=ft(K);if(Rt==hi)K=le;else if(!le){if(Rt==Me)continue t;break t}}X[W++]=K}return X}function mr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function T3(){this.__data__=An?An(null):{},this.size=0}function N3(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function D3(t){var e=this.__data__;if(An){var r=e[t];return r===gr?v:r}return Qt.call(e,t)?e[t]:v}function M3(t){var e=this.__data__;return An?e[t]!==v:Qt.call(e,t)}function H3(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=An&&e===v?gr:e,this}function qe(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function V3(){this.__data__=[],this.size=0}function W3(t){var e=this.__data__,r=no(e,t);return!(r<0)&&(r==e.length-1?e.pop():No.call(e,r,1),--this.size,!0)}function Z3(t){var e=this.__data__,r=no(e,t);return r<0?v:e[r][1]}function B3(t){return no(this.__data__,t)>-1}function j3(t,e){var r=this.__data__,i=no(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}function Ye(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function z3(){this.size=0,this.__data__={hash:new mr,map:new(Cn||qe),string:new mr}}function U3(t){var e=go(this,t).delete(t);return this.size-=e?1:0,e}function $3(t){return go(this,t).get(t)}function F3(t){return go(this,t).has(t)}function S3(t,e){var r=go(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}function Qr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Ye;++e<r;)this.add(t[e])}function q3(t){return this.__data__.set(t,gr),this}function Y3(t){return this.__data__.has(t)}function ke(t){this.size=(this.__data__=new qe(t)).size}function G3(){this.__data__=new qe,this.size=0}function X3(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function K3(t){return this.__data__.get(t)}function J3(t){return this.__data__.has(t)}function P3(t,e){var r=this.__data__;if(r instanceof qe){var i=r.__data__;if(!Cn||i.length<an-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ye(i)}return r.set(t,e),this.size=r.size,this}function Qa(t,e){var r=rt(t),i=!r&&Ir(t),c=!r&&!i&&pr(t),h=!r&&!i&&!c&&tn(t),g=r||i||c||h,_=g?tt(t.length,Gh):[],b=_.length;for(var L in t)!e&&!Qt.call(t,L)||g&&(L=="length"||c&&(L=="offset"||L=="parent")||h&&(L=="buffer"||L=="byteLength"||L=="byteOffset")||Je(L,b))||_.push(L);return _}function ba(t){var e=t.length;return e?t[Si(0,e-1)]:v}function R3(t,e){return yo(ue(t),br(e,0,t.length))}function t2(t){return yo(ue(t))}function Vi(t,e,r){(r===v||Oe(t[e],r))&&(r!==v||e in t)||Ge(t,e,r)}function dn(t,e,r){var i=t[e];Qt.call(t,e)&&Oe(i,r)&&(r!==v||e in t)||Ge(t,e,r)}function no(t,e){for(var r=t.length;r--;)if(Oe(t[r][0],e))return r;return-1}function e2(t,e,r,i){return fr(t,function(c,h,g){e(i,c,r(c),g)}),i}function wa(t,e){return t&&We(e,zt(e),t)}function r2(t,e){return t&&We(e,se(e),t)}function Ge(t,e,r){e=="__proto__"&&Do?Do(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function Wi(t,e){for(var r=-1,i=e.length,c=Wt(i),h=t==null;++r<i;)c[r]=h?v:l1(t,e[r]);return c}function br(t,e,r){return t===t&&(r!==v&&(t=t<=r?t:r),e!==v&&(t=t>=e?t:e)),t}function _e(t,e,r,i,c,h){var g,_=e&St,b=e&Zr,L=e&Ne;if(r&&(g=c?r(t,i,c,h):r(t)),g!==v)return g;if(!Lt(t))return t;var A=rt(t);if(A){if(g=z2(t),!_)return ue(t,g)}else{var O=Pt(t),W=O==Pn||O==Uu;if(pr(t))return Ua(t,_);if(O==Se||O==ut||W&&!c){if(g=b||W?{}:us(t),!_)return b?T2(t,r2(g,t)):O2(t,wa(g,t))}else{if(!bt[O])return c?t:{};g=U2(t,O,_)}}h||(h=new ke);var F=h.get(t);if(F)return F;h.set(t,g),nc(t)?t.forEach(function(K){g.add(_e(K,e,r,K,t,h))}):rc(t)&&t.forEach(function(K,lt){g.set(lt,_e(K,e,r,lt,t,h))});var X=L?b?r1:e1:b?se:zt,ot=A?v:X(t);return l(ot||t,function(K,lt){ot&&(lt=K,K=t[lt]),dn(g,lt,_e(K,e,r,lt,t,h))}),g}function n2(t){var e=zt(t);return function(r){return Ca(r,t,e)}}function Ca(t,e,r){var i=r.length;if(t==null)return!i;for(t=Et(t);i--;){var c=r[i],h=e[c],g=t[c];if(g===v&&!(c in t)||!h(g))return!1}return!0}function Ea(t,e,r){if(typeof t!="function")throw new we(Nt);return Ln(function(){t.apply(v,r)},e)}function vn(t,e,r,i){var c=-1,h=Q,g=!0,_=t.length,b=[],L=e.length;if(!_)return b;r&&(e=C(e,yt(r))),i?(h=w,g=!1):e.length>=an&&(h=wt,g=!1,e=new Qr(e));t:for(;++c<_;){var A=t[c],O=r==null?A:r(A);if(A=i||A!==0?A:0,g&&O===O){for(var W=L;W--;)if(e[W]===O)continue t;b.push(A)}else h(e,O,i)||b.push(A)}return b}function o2(t,e){var r=!0;return fr(t,function(i,c,h){return r=!!e(i,c,h)}),r}function oo(t,e,r){for(var i=-1,c=t.length;++i<c;){var h=t[i],g=e(h);if(g!=null&&(_===v?g===g&&!he(g):r(g,_)))var _=g,b=h}return b}function i2(t,e,r,i){var c=t.length;for(r=at(r),r<0&&(r=-r>c?0:c+r),i=i===v||i>c?c:at(i),i<0&&(i+=c),i=r>i?0:Ts(i);r<i;)t[r++]=e;return t}function Aa(t,e){var r=[];return fr(t,function(i,c,h){e(i,c,h)&&r.push(i)}),r}function Yt(t,e,r,i,c){var h=-1,g=t.length;for(r||(r=F2),c||(c=[]);++h<g;){var _=t[h];e>0&&r(_)?e>1?Yt(_,e-1,r,i,c):k(c,_):i||(c[c.length]=_)}return c}function Ve(t,e){return t&&C1(t,e,zt)}function Zi(t,e){return t&&Gs(t,e,zt)}function io(t,e){return d(e,function(r){return Pe(t[r])})}function wr(t,e){e=sr(e,t);for(var r=0,i=e.length;t!=null&&r<i;)t=t[Ze(e[r++])];return r&&r==i?t:v}function Ia(t,e,r){var i=e(t);return rt(t)?i:k(i,r(t))}function ne(t){return t==null?t===v?b0:m0:Ar&&Ar in Et(t)?Z2(t):K2(t)}function Bi(t,e){return t>e}function u2(t,e){return t!=null&&Qt.call(t,e)}function a2(t,e){return t!=null&&e in Et(t)}function s2(t,e,r){return t>=Jt(e,r)&&t<Zt(e,r)}function ji(t,e,r){for(var i=r?w:Q,c=t[0].length,h=t.length,g=h,_=Wt(h),b=1/0,L=[];g--;){var A=t[g];g&&e&&(A=C(A,yt(e))),b=Jt(A.length,b),_[g]=!r&&(e||c>=120&&A.length>=120)?new Qr(g&&A):v}A=t[0];var O=-1,W=_[0];t:for(;++O<c&&L.length<b;){var F=A[O],X=e?e(F):F;if(F=r||F!==0?F:0,!(W?wt(W,X):i(L,X,r))){for(g=h;--g;){var ot=_[g];if(!(ot?wt(ot,X):i(t[g],X,r)))continue t}W&&W.push(X),L.push(F)}}return L}function c2(t,e,r,i){return Ve(t,function(c,h,g){e(i,r(c),h,g)}),i}function gn(t,e,r){e=sr(e,t),t=ls(t,e);var i=t==null?t:t[Ze(Qe(e))];return i==null?v:u(i,t,r)}function La(t){return kt(t)&&ne(t)==ut}function l2(t){return kt(t)&&ne(t)==hn}function f2(t){return kt(t)&&ne(t)==Fe}function yn(t,e,r,i,c){return t===e||(t==null||e==null||!kt(t)&&!kt(e)?t!==t&&e!==e:p2(t,e,r,i,yn,c))}function p2(t,e,r,i,c,h){var g=rt(t),_=rt(e),b=g?At:Pt(t),L=_?At:Pt(e);b=b==ut?Se:b,L=L==ut?Se:L;var A=b==Se,O=L==Se,W=b==L;if(W&&pr(t)){if(!pr(e))return!1;g=!0,A=!1}if(W&&!A)return h||(h=new ke),g||tn(t)?os(t,e,r,i,c,h):V2(t,e,b,r,i,c,h);if(!(r&De)){var F=A&&Qt.call(t,"__wrapped__"),X=O&&Qt.call(e,"__wrapped__");if(F||X){var ot=F?t.value():t,K=X?e.value():e;return h||(h=new ke),c(ot,K,r,i,h)}}return!!W&&(h||(h=new ke),W2(t,e,r,i,c,h))}function h2(t){return kt(t)&&Pt(t)==Le}function zi(t,e,r,i){var c=r.length,h=c,g=!i;if(t==null)return!h;for(t=Et(t);c--;){var _=r[c];if(g&&_[2]?_[1]!==t[_[0]]:!(_[0]in t))return!1}for(;++c<h;){_=r[c];var b=_[0],L=t[b],A=_[1];if(g&&_[2]){if(L===v&&!(b in t))return!1}else{var O=new ke;if(i)var W=i(L,A,b,t,e,O);if(!(W===v?yn(A,L,De|or,i,O):W))return!1}}return!0}function xa(t){return!(!Lt(t)||q2(t))&&(Pe(t)?Rh:F0).test(Er(t))}function d2(t){return kt(t)&&ne(t)==ln}function v2(t){return kt(t)&&Pt(t)==xe}function g2(t){return kt(t)&&wo(t.length)&&!!Ct[ne(t)]}function ka(t){return typeof t=="function"?t:t==null?ce:typeof t=="object"?rt(t)?Na(t[0],t[1]):Ta(t):Ws(t)}function Ui(t){if(!Qn(t))return i7(t);var e=[];for(var r in Et(t))Qt.call(t,r)&&r!="constructor"&&e.push(r);return e}function y2(t){if(!Lt(t))return X2(t);var e=Qn(t),r=[];for(var i in t)(i!="constructor"||!e&&Qt.call(t,i))&&r.push(i);return r}function $i(t,e){return t<e}function Oa(t,e){var r=-1,i=ae(t)?Wt(t.length):[];return fr(t,function(c,h,g){i[++r]=e(c,h,g)}),i}function Ta(t){var e=n1(t);return e.length==1&&e[0][2]?ss(e[0][0],e[0][1]):function(r){return r===t||zi(r,t,e)}}function Na(t,e){return o1(t)&&as(e)?ss(Ze(t),e):function(r){var i=l1(r,t);return i===v&&i===e?f1(r,t):yn(e,i,De|or)}}function uo(t,e,r,i,c){t!==e&&C1(e,function(h,g){if(c||(c=new ke),Lt(h))_2(t,e,g,r,uo,i,c);else{var _=i?i(u1(t,g),h,g+"",t,e,c):v;_===v&&(_=h),Vi(t,g,_)}},se)}function _2(t,e,r,i,c,h,g){var _=u1(t,r),b=u1(e,r),L=g.get(b);if(L)return Vi(t,r,L),v;var A=h?h(_,b,r+"",t,e,g):v,O=A===v;if(O){var W=rt(b),F=!W&&pr(b),X=!W&&!F&&tn(b);A=b,W||F||X?rt(_)?A=_:Dt(_)?A=ue(_):F?(O=!1,A=Ua(b,!0)):X?(O=!1,A=$a(b,!0)):A=[]:bn(b)||Ir(b)?(A=_,Ir(_)?A=Ns(_):Lt(_)&&!Pe(_)||(A=us(b))):O=!1}O&&(g.set(b,A),c(A,b,i,h,g),g.delete(b)),Vi(t,r,A)}function Da(t,e){var r=t.length;if(r)return e+=e<0?r:0,Je(e,r)?t[e]:v}function Ma(t,e,r){e=e.length?C(e,function(c){return rt(c)?function(h){return wr(h,c.length===1?c[0]:c)}:c}):[ce];var i=-1;return e=C(e,yt(P())),G(Oa(t,function(c,h,g){return{criteria:C(e,function(_){return _(c)}),index:++i,value:c}}),function(c,h){return k2(c,h,r)})}function m2(t,e){return Ha(t,e,function(r,i){return f1(t,i)})}function Ha(t,e,r){for(var i=-1,c=e.length,h={};++i<c;){var g=e[i],_=wr(t,g);r(_,g)&&_n(h,sr(g,t),_)}return h}function Q2(t){return function(e){return wr(e,t)}}function Fi(t,e,r,i){var c=i?ct:$,h=-1,g=e.length,_=t;for(t===e&&(e=ue(e)),r&&(_=C(t,yt(r)));++h<g;)for(var b=0,L=e[h],A=r?r(L):L;(b=c(_,A,b,i))>-1;)_!==t&&No.call(_,b,1),No.call(t,b,1);return t}function Va(t,e){for(var r=t?e.length:0,i=r-1;r--;){var c=e[r];if(r==i||c!==h){var h=c;Je(c)?No.call(t,c,1):Gi(t,c)}}return t}function Si(t,e){return t+Ho(Ss()*(e-t+1))}function b2(t,e,r,i){for(var c=-1,h=Zt(Mo((e-t)/(r||1)),0),g=Wt(h);h--;)g[i?h:++c]=t,t+=r;return g}function qi(t,e){var r="";if(!t||e<1||e>He)return r;do e%2&&(r+=t),e=Ho(e/2),e&&(t+=t);while(e);return r}function st(t,e){return I1(cs(t,e,ce),t+"")}function w2(t){return ba(Gr(t))}function C2(t,e){var r=Gr(t);return yo(r,br(e,0,r.length))}function _n(t,e,r,i){if(!Lt(t))return t;e=sr(e,t);for(var c=-1,h=e.length,g=h-1,_=t;_!=null&&++c<h;){var b=Ze(e[c]),L=r;if(b==="__proto__"||b==="constructor"||b==="prototype")return t;if(c!=g){var A=_[b];L=i?i(A,b,_):v,L===v&&(L=Lt(A)?A:Je(e[c+1])?[]:{})}dn(_,b,L),_=_[b]}return t}function E2(t){return yo(Gr(t))}function me(t,e,r){var i=-1,c=t.length;e<0&&(e=-e>c?0:c+e),r=r>c?c:r,r<0&&(r+=c),c=e>r?0:r-e>>>0,e>>>=0;for(var h=Wt(c);++i<c;)h[i]=t[i+e];return h}function A2(t,e){var r;return fr(t,function(i,c,h){return r=e(i,c,h),!r}),!!r}function ao(t,e,r){var i=0,c=t==null?i:t.length;if(typeof e=="number"&&e===e&&c<=sn){for(;i<c;){var h=i+c>>>1,g=t[h];g!==null&&!he(g)&&(r?g<=e:g<e)?i=h+1:c=h}return c}return Yi(t,e,ce,r)}function Yi(t,e,r,i){var c=0,h=t==null?0:t.length;if(h===0)return 0;e=r(e);for(var g=e!==e,_=e===null,b=he(e),L=e===v;c<h;){var A=Ho((c+h)/2),O=r(t[A]),W=O!==v,F=O===null,X=O===O,ot=he(O);if(g)var K=i||X;else K=L?X&&(i||W):_?X&&W&&(i||!F):b?X&&W&&!F&&(i||!ot):!F&&!ot&&(i?O<=e:O<e);K?c=A+1:h=A}return Jt(h,vi)}function Wa(t,e){for(var r=-1,i=t.length,c=0,h=[];++r<i;){var g=t[r],_=e?e(g):g;if(!r||!Oe(_,b)){var b=_;h[c++]=g===0?0:g}}return h}function Za(t){return typeof t=="number"?t:he(t)?jr:+t}function pe(t){if(typeof t=="string")return t;if(rt(t))return C(t,pe)+"";if(he(t))return qs?qs.call(t):"";var e=t+"";return e=="0"&&1/t==-$e?"-0":e}function ar(t,e,r){var i=-1,c=Q,h=t.length,g=!0,_=[],b=_;if(r)g=!1,c=w;else if(h>=an){var L=e?null:g7(t);if(L)return nt(L);g=!1,c=wt,b=new Qr}else b=e?[]:_;t:for(;++i<h;){var A=t[i],O=e?e(A):A;if(A=r||A!==0?A:0,g&&O===O){for(var W=b.length;W--;)if(b[W]===O)continue t;e&&b.push(O),_.push(A)}else c(b,O,r)||(b!==_&&b.push(O),_.push(A))}return _}function Gi(t,e){return e=sr(e,t),t=ls(t,e),t==null||delete t[Ze(Qe(e))]}function Ba(t,e,r,i){return _n(t,e,r(wr(t,e)),i)}function so(t,e,r,i){for(var c=t.length,h=i?c:-1;(i?h--:++h<c)&&e(t[h],h,t););return r?me(t,i?0:h,i?h+1:c):me(t,i?h+1:0,i?c:h)}function ja(t,e){var r=t;return r instanceof z&&(r=r.value()),N(e,function(i,c){return c.func.apply(c.thisArg,k([i],c.args))},r)}function Xi(t,e,r){var i=t.length;if(i<2)return i?ar(t[0]):[];for(var c=-1,h=Wt(i);++c<i;)for(var g=t[c],_=-1;++_<i;)_!=c&&(h[c]=vn(h[c]||g,t[_],e,r));return ar(Yt(h,1),e,r)}function za(t,e,r){for(var i=-1,c=t.length,h=e.length,g={};++i<c;)r(g,t[i],i<h?e[i]:v);return g}function Ki(t){return Dt(t)?t:[]}function Ji(t){return typeof t=="function"?t:ce}function sr(t,e){return rt(t)?t:o1(t,e)?[t]:Rs(_t(t))}function cr(t,e,r){var i=t.length;return r=r===v?i:r,!e&&r>=i?t:me(t,e,r)}function Ua(t,e){if(e)return t.slice();var r=t.length,i=js?js(r):new t.constructor(r);return t.copy(i),i}function Pi(t){var e=new t.constructor(t.byteLength);return new Oo(e).set(new Oo(t)),e}function I2(t,e){return new t.constructor(e?Pi(t.buffer):t.buffer,t.byteOffset,t.byteLength)}function L2(t){var e=new t.constructor(t.source,Yu.exec(t));return e.lastIndex=t.lastIndex,e}function x2(t){return In?Et(In.call(t)):{}}function $a(t,e){return new t.constructor(e?Pi(t.buffer):t.buffer,t.byteOffset,t.length)}function Fa(t,e){if(t!==e){var r=t!==v,i=t===null,c=t===t,h=he(t),g=e!==v,_=e===null,b=e===e,L=he(e);if(!_&&!L&&!h&&t>e||h&&g&&b&&!_&&!L||i&&g&&b||!r&&b||!c)return 1;if(!i&&!h&&!L&&t<e||L&&r&&c&&!i&&!h||_&&r&&c||!g&&c||!b)return-1}return 0}function k2(t,e,r){for(var i=-1,c=t.criteria,h=e.criteria,g=c.length,_=r.length;++i<g;){var b=Fa(c[i],h[i]);if(b)return i>=_?b:b*(r[i]=="desc"?-1:1)}return t.index-e.index}function Sa(t,e,r,i){for(var c=-1,h=t.length,g=r.length,_=-1,b=e.length,L=Zt(h-g,0),A=Wt(b+L),O=!i;++_<b;)A[_]=e[_];for(;++c<g;)(O||c<h)&&(A[r[c]]=t[c]);for(;L--;)A[_++]=t[c++];return A}function qa(t,e,r,i){for(var c=-1,h=t.length,g=-1,_=r.length,b=-1,L=e.length,A=Zt(h-_,0),O=Wt(A+L),W=!i;++c<A;)O[c]=t[c];for(var F=c;++b<L;)O[F+b]=e[b];for(;++g<_;)(W||c<h)&&(O[F+r[g]]=t[c++]);return O}function ue(t,e){var r=-1,i=t.length;for(e||(e=Wt(i));++r<i;)e[r]=t[r];return e}function We(t,e,r,i){var c=!r;r||(r={});for(var h=-1,g=e.length;++h<g;){var _=e[h],b=i?i(r[_],t[_],_,r,t):v;b===v&&(b=t[_]),c?Ge(r,_,b):dn(r,_,b)}return r}function O2(t,e){return We(t,A1(t),e)}function T2(t,e){return We(t,Js(t),e)}function co(t,e){return function(r,i){var c=rt(r)?a:e2,h=e?e():{};return c(r,t,P(i,2),h)}}function Sr(t){return st(function(e,r){var i=-1,c=r.length,h=c>1?r[c-1]:v,g=c>2?r[2]:v;for(h=t.length>3&&typeof h=="function"?(c--,h):v,g&&oe(r[0],r[1],g)&&(h=c<3?v:h,c=1),e=Et(e);++i<c;){var _=r[i];_&&t(e,_,i,h)}return e})}function Ya(t,e){return function(r,i){if(r==null)return r;if(!ae(r))return t(r,i);for(var c=r.length,h=e?c:-1,g=Et(r);(e?h--:++h<c)&&i(g[h],h,g)!==!1;);return r}}function Ga(t){return function(e,r,i){for(var c=-1,h=Et(e),g=i(e),_=g.length;_--;){var b=g[t?_:++c];if(r(h[b],b,h)===!1)break}return e}}function N2(t,e,r){function i(){return(this&&this!==qt&&this instanceof i?h:t).apply(c?r:this,arguments)}var c=e&ee,h=mn(t);return i}function Xa(t){return function(e){e=_t(e);var r=xt(e)?Kt(e):v,i=r?r[0]:e.charAt(0),c=r?cr(r,1).join(""):e.slice(1);return i[t]()+c}}function qr(t){return function(e){return N(Vs(Hs(e).replace(f3,"")),t,"")}}function mn(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=Rr(t.prototype),i=t.apply(r,e);return Lt(i)?i:r}}function D2(t,e,r){function i(){for(var h=arguments.length,g=Wt(h),_=h,b=Yr(i);_--;)g[_]=arguments[_];var L=h<3&&g[0]!==b&&g[h-1]!==b?[]:U(g,b);return h-=L.length,h<r?ts(t,e,lo,i.placeholder,v,g,L,v,v,r-h):u(this&&this!==qt&&this instanceof i?c:t,this,g)}var c=mn(t);return i}function Ka(t){return function(e,r,i){var c=Et(e);if(!ae(e)){var h=P(r,3);e=zt(e),r=function(_){return h(c[_],_,c)}}var g=t(e,r,i);return g>-1?c[h?e[g]:g]:v}}function Ja(t){return Ke(function(e){var r=e.length,i=r,c=J.prototype.thru;for(t&&e.reverse();i--;){var h=e[i];if(typeof h!="function")throw new we(Nt);if(c&&!g&&vo(h)=="wrapper")var g=new J([],!0)}for(i=g?i:r;++i<r;){h=e[i];var _=vo(h),b=_=="wrapper"?E1(h):v;g=b&&i1(b[0])&&b[1]==(Ee|de|ve|re)&&!b[4].length&&b[9]==1?g[vo(b[0])].apply(g,b[3]):h.length==1&&i1(h)?g[_]():g.thru(h)}return function(){var L=arguments,A=L[0];if(g&&L.length==1&&rt(A))return g.plant(A).value();for(var O=0,W=r?e[O].apply(this,L):A;++O<r;)W=e[O].call(this,W);return W}})}function lo(t,e,r,i,c,h,g,_,b,L){function A(){for(var lt=arguments.length,ft=Wt(lt),Rt=lt;Rt--;)ft[Rt]=arguments[Rt];if(X)var le=Yr(A),hr=vr(ft,le);if(i&&(ft=Sa(ft,i,c,X)),h&&(ft=qa(ft,h,g,X)),lt-=hr,X&&lt<L)return ts(t,e,lo,A.placeholder,r,ft,U(ft,le),_,b,L-lt);var Ot=W?r:this,Ce=F?Ot[t]:t;return lt=ft.length,_?ft=J2(ft,_):ot&&lt>1&&ft.reverse(),O&&b<lt&&(ft.length=b),this&&this!==qt&&this instanceof A&&(Ce=K||mn(Ce)),Ce.apply(Ot,ft)}var O=e&Ee,W=e&ee,F=e&Ue,X=e&(de|ir),ot=e&Ae,K=F?v:mn(t);return A}function Pa(t,e){return function(r,i){return c2(r,t,e(i),{})}}function fo(t,e){return function(r,i){var c;if(r===v&&i===v)return e;if(r!==v&&(c=r),i!==v){if(c===v)return i;typeof r=="string"||typeof i=="string"?(r=pe(r),i=pe(i)):(r=Za(r),i=Za(i)),c=t(r,i)}return c}}function Ri(t){return Ke(function(e){return e=C(e,yt(P())),st(function(r){var i=this;return t(e,function(c){return u(c,i,r)})})})}function po(t,e){e=e===v?" ":pe(e);var r=e.length;if(r<2)return r?qi(e,t):e;var i=qi(e,Mo(t/Vt(e)));return xt(e)?cr(Kt(i),0,t).join(""):i.slice(0,t)}function M2(t,e,r,i){function c(){for(var _=-1,b=arguments.length,L=-1,A=i.length,O=Wt(A+b),W=this&&this!==qt&&this instanceof c?g:t;++L<A;)O[L]=i[L];for(;b--;)O[L++]=arguments[++_];return u(W,h?r:this,O)}var h=e&ee,g=mn(t);return c}function Ra(t){return function(e,r,i){return i&&typeof i!="number"&&oe(e,r,i)&&(r=i=v),e=Re(e),r===v?(r=e,e=0):r=Re(r),i=i===v?e<r?1:-1:Re(i),b2(e,r,i,t)}}function ho(t){return function(e,r){return typeof e=="string"&&typeof r=="string"||(e=be(e),r=be(r)),t(e,r)}}function ts(t,e,r,i,c,h,g,_,b,L){var A=e&de,O=A?g:v,W=A?v:g,F=A?h:v,X=A?v:h;e|=A?ve:ur,e&=~(A?ur:ve),e&Kn||(e&=~(ee|Ue));var ot=[t,e,c,F,O,X,W,_,b,L],K=r.apply(v,ot);return i1(t)&&Ps(K,ot),K.placeholder=i,fs(K,t,e)}function t1(t){var e=Xr[t];return function(r,i){if(r=be(r),i=i==null?0:Jt(at(i),292),i&&Fs(r)){var c=(_t(r)+"e").split("e");return c=(_t(e(c[0]+"e"+(+c[1]+i)))+"e").split("e"),+(c[0]+"e"+(+c[1]-i))}return e(r)}}function es(t){return function(e){var r=Pt(e);return r==Le?M(e):r==xe?Ht(e):et(e,t(e))}}function Xe(t,e,r,i,c,h,g,_){var b=e&Ue;if(!b&&typeof t!="function")throw new we(Nt);var L=i?i.length:0;if(L||(e&=~(ve|ur),i=c=v),g=g===v?g:Zt(at(g),0),_=_===v?_:at(_),L-=c?c.length:0,e&ur){var A=i,O=c;i=c=v}var W=b?v:E1(t),F=[t,e,r,i,c,A,O,h,g,_];if(W&&G2(F,W),t=F[0],e=F[1],r=F[2],i=F[3],c=F[4],_=F[9]=F[9]===v?b?0:t.length:Zt(F[9]-L,0),!_&&e&(de|ir)&&(e&=~(de|ir)),e&&e!=ee)X=e==de||e==ir?D2(t,e,_):e!=ve&&e!=(ee|ve)||c.length?lo.apply(v,F):M2(t,e,r,i);else var X=N2(t,e,r);return fs((W?Xs:Ps)(X,F),t,e)}function rs(t,e,r,i){return t===v||Oe(t,Kr[r])&&!Qt.call(i,r)?e:t}function ns(t,e,r,i,c,h){return Lt(t)&&Lt(e)&&(h.set(e,t),uo(t,e,v,ns,h),h.delete(e)),t}function H2(t){return bn(t)?v:t}function os(t,e,r,i,c,h){var g=r&De,_=t.length,b=e.length;if(_!=b&&!(g&&b>_))return!1;var L=h.get(t),A=h.get(e);if(L&&A)return L==e&&A==t;var O=-1,W=!0,F=r&or?new Qr:v;for(h.set(t,e),h.set(e,t);++O<_;){var X=t[O],ot=e[O];if(i)var K=g?i(ot,X,O,e,t,h):i(X,ot,O,t,e,h);if(K!==v){if(K)continue;W=!1;break}if(F){if(!T(e,function(lt,ft){if(!wt(F,ft)&&(X===lt||c(X,lt,r,i,h)))return F.push(ft)})){W=!1;break}}else if(X!==ot&&!c(X,ot,r,i,h)){W=!1;break}}return h.delete(t),h.delete(e),W}function V2(t,e,r,i,c,h,g){switch(r){case Ur:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case hn:return!(t.byteLength!=e.byteLength||!h(new Oo(t),new Oo(e)));case Ie:case Fe:case cn:return Oe(+t,+e);case Jn:return t.name==e.name&&t.message==e.message;case ln:case fn:return t==e+"";case Le:var _=M;case xe:var b=i&De;if(_||(_=nt),t.size!=e.size&&!b)return!1;var L=g.get(t);if(L)return L==e;i|=or,g.set(t,e);var A=os(_(t),_(e),i,c,h,g);return g.delete(t),A;case Rn:if(In)return In.call(t)==In.call(e)}return!1}function W2(t,e,r,i,c,h){var g=r&De,_=e1(t),b=_.length;if(b!=e1(e).length&&!g)return!1;for(var L=b;L--;){var A=_[L];if(!(g?A in e:Qt.call(e,A)))return!1}var O=h.get(t),W=h.get(e);if(O&&W)return O==e&&W==t;var F=!0;h.set(t,e),h.set(e,t);for(var X=g;++L<b;){A=_[L];var ot=t[A],K=e[A];if(i)var lt=g?i(K,ot,A,e,t,h):i(ot,K,A,t,e,h);if(!(lt===v?ot===K||c(ot,K,r,i,h):lt)){F=!1;break}X||(X=A=="constructor")}if(F&&!X){var ft=t.constructor,Rt=e.constructor;ft!=Rt&&"constructor"in t&&"constructor"in e&&!(typeof ft=="function"&&ft instanceof ft&&typeof Rt=="function"&&Rt instanceof Rt)&&(F=!1)}return h.delete(t),h.delete(e),F}function Ke(t){return I1(cs(t,v,gs),t+"")}function e1(t){return Ia(t,zt,A1)}function r1(t){return Ia(t,se,Js)}function vo(t){for(var e=t.name+"",r=Pr[e],i=Qt.call(Pr,e)?r.length:0;i--;){var c=r[i],h=c.func;if(h==null||h==t)return c.name}return e}function Yr(t){return(Qt.call(s,"placeholder")?s:t).placeholder}function P(){var t=s.iteratee||h1;return t=t===h1?ka:t,arguments.length?t(arguments[0],arguments[1]):t}function go(t,e){var r=t.__data__;return S2(e)?r[typeof e=="string"?"string":"hash"]:r.map}function n1(t){for(var e=zt(t),r=e.length;r--;){var i=e[r],c=t[i];e[r]=[i,c,as(c)]}return e}function Cr(t,e){var r=Xt(t,e);return xa(r)?r:v}function Z2(t){var e=Qt.call(t,Ar),r=t[Ar];try{t[Ar]=v;var i=!0}catch{}var c=xo.call(t);return i&&(e?t[Ar]=r:delete t[Ar]),c}function B2(t,e,r){for(var i=-1,c=r.length;++i<c;){var h=r[i],g=h.size;switch(h.type){case"drop":t+=g;break;case"dropRight":e-=g;break;case"take":e=Jt(e,t+g);break;case"takeRight":t=Zt(t,e-g)}}return{start:t,end:e}}function j2(t){var e=t.match(V0);return e?e[1].split(W0):[]}function is(t,e,r){e=sr(e,t);for(var i=-1,c=e.length,h=!1;++i<c;){var g=Ze(e[i]);if(!(h=t!=null&&r(t,g)))break;t=t[g]}return h||++i!=c?h:(c=t==null?0:t.length,!!c&&wo(c)&&Je(g,c)&&(rt(t)||Ir(t)))}function z2(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Qt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function us(t){return typeof t.constructor!="function"||Qn(t)?{}:Rr(To(t))}function U2(t,e,r){var i=t.constructor;switch(e){case hn:return Pi(t);case Ie:case Fe:return new i(+t);case Ur:return I2(t,r);case yi:case _i:case mi:case Qi:case bi:case wi:case Ci:case Ei:case Ai:return $a(t,r);case Le:return new i;case cn:case fn:return new i(t);case ln:return L2(t);case xe:return new i;case Rn:return x2(t)}}function $2(t,e){var r=e.length;if(!r)return t;var i=r-1;return e[i]=(r>1?"& ":"")+e[i],e=e.join(r>2?", ":" "),t.replace(H0,`{
9
9
  /* [wrapped with `+e+`] */
10
- `)}function F2(t){return et(t)||Lr(t)||!!($s&&t&&t[$s])}function Pe(t,e){var r=typeof t;return e=e??Ve,!!e&&(r=="number"||r!="symbol"&&q0.test(t))&&t>-1&&t%1==0&&t<e}function ie(t,e,r){if(!xt(r))return!1;var i=typeof e;return!!(i=="number"?se(r)&&Pe(e,r.length):i=="string"&&e in r)&&Te(r[e],t)}function o1(t,e){if(et(t))return!1;var r=typeof t;return!(r!="number"&&r!="symbol"&&r!="boolean"&&t!=null&&!de(t))||T0.test(t)||!O0.test(t)||e!=null&&t in At(e)}function S2(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function i1(t){var e=vo(t),r=s[e];if(typeof r!="function"||!(e in U.prototype))return!1;if(t===r)return!0;var i=E1(r);return!!i&&t===i[0]}function q2(t){return!!Bs&&Bs in t}function Qn(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||Kr)}function as(t){return t===t&&!xt(t)}function ss(t,e){return function(r){return r!=null&&r[t]===e&&(e!==v||t in At(r))}}function Y2(t){var e=Qo(t,function(i){return r.size===Xn&&r.clear(),i}),r=e.cache;return e}function G2(t,e){var r=t[1],i=e[1],c=r|i,h=c<(re|Ue|Ie),g=i==Ie&&r==ge||i==Ie&&r==ne&&t[7].length<=e[8]||i==(Ie|ne)&&e[7].length<=e[8]&&r==ge;if(!h&&!g)return t;i&re&&(t[2]=e[2],c|=r&re?0:Kn);var y=e[3];if(y){var b=t[3];t[3]=b?Sa(b,y,e[4]):y,t[4]=b?$(t[3],Zr):e[4]}return y=e[5],y&&(b=t[5],t[5]=b?qa(b,y,e[6]):y,t[6]=b?$(t[5],Zr):e[6]),y=e[7],y&&(t[7]=y),i&Ie&&(t[8]=t[8]==null?e[8]:Jt(t[8],e[8])),t[9]==null&&(t[9]=e[9]),t[0]=e[0],t[1]=c,t}function X2(t){var e=[];if(t!=null)for(var r in At(t))e.push(r);return e}function K2(t){return xo.call(t)}function cs(t,e,r){return e=Bt(e===v?t.length-1:e,0),function(){for(var i=arguments,c=-1,h=Bt(i.length-e,0),g=Zt(h);++c<h;)g[c]=i[e+c];c=-1;for(var y=Zt(e+1);++c<e;)y[c]=i[c];return y[e]=r(g),u(t,this,y)}}function ls(t,e){return e.length<2?t:Cr(t,be(e,0,-1))}function J2(t,e){for(var r=t.length,i=Jt(e.length,r),c=ae(t);i--;){var h=e[i];t[i]=Pe(h,r)?c[h]:v}return t}function u1(t,e){if((e!=="constructor"||typeof t[e]!="function")&&e!="__proto__")return t[e]}function fs(t,e,r){var i=e+"";return I1(t,$2(i,P2(j2(i),r)))}function ps(t){var e=0,r=0;return function(){var i=u7(),c=jr-(i-r);if(r=i,c>0){if(++e>=pi)return arguments[0]}else e=0;return t.apply(v,arguments)}}function yo(t,e){var r=-1,i=t.length,c=i-1;for(e=e===v?i:e;++r<e;){var h=Si(r,c),g=t[h];t[h]=t[r],t[r]=g}return t.length=e,t}function Be(t){if(typeof t=="string"||de(t))return t;var e=t+"";return e=="0"&&1/t==-$e?"-0":e}function Ar(t){if(t!=null){try{return Lo.call(t)}catch{}try{return t+""}catch{}}return""}function P2(t,e){return l(ft,function(r){var i="_."+r[0];e&r[1]&&!Q(t,i)&&t.push(i)}),t.sort()}function hs(t){if(t instanceof U)return t.clone();var e=new J(t.__wrapped__,t.__chain__);return e.__actions__=ae(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}function R2(t,e,r){e=(r?ie(t,e,r):e===v)?1:Bt(it(e),0);var i=t==null?0:t.length;if(!i||e<1)return[];for(var c=0,h=0,g=Zt(Do(i/e));c<i;)g[h++]=be(t,c,c+=e);return g}function t5(t){for(var e=-1,r=t==null?0:t.length,i=0,c=[];++e<r;){var h=t[e];h&&(c[i++]=h)}return c}function e5(){var t=arguments.length;if(!t)return[];for(var e=Zt(t-1),r=arguments[0],i=t;i--;)e[i-1]=arguments[i];return k(et(r)?ae(r):[r],Gt(e,1))}function r5(t,e,r){var i=t==null?0:t.length;return i?(e=r||e===v?1:it(e),be(t,e<0?0:e,i)):[]}function n5(t,e,r){var i=t==null?0:t.length;return i?(e=r||e===v?1:it(e),e=i-e,be(t,0,e<0?0:e)):[]}function o5(t,e){return t&&t.length?so(t,P(e,3),!0,!0):[]}function i5(t,e){return t&&t.length?so(t,P(e,3),!0):[]}function u5(t,e,r,i){var c=t==null?0:t.length;return c?(r&&typeof r!="number"&&ie(t,e,r)&&(r=0,i=c),i2(t,e,r,i)):[]}function ds(t,e,r){var i=t==null?0:t.length;if(!i)return-1;var c=r==null?0:it(r);return c<0&&(c=Bt(i+c,0)),tt(t,P(e,3),c)}function vs(t,e,r){var i=t==null?0:t.length;if(!i)return-1;var c=i-1;return r!==v&&(c=it(r),c=r<0?Bt(i+c,0):Jt(c,i-1)),tt(t,P(e,3),c,!0)}function gs(t){return t!=null&&t.length?Gt(t,1):[]}function a5(t){return t!=null&&t.length?Gt(t,$e):[]}function s5(t,e){return t!=null&&t.length?(e=e===v?1:it(e),Gt(t,e)):[]}function c5(t){for(var e=-1,r=t==null?0:t.length,i={};++e<r;){var c=t[e];i[c[0]]=c[1]}return i}function ys(t){return t&&t.length?t[0]:v}function l5(t,e,r){var i=t==null?0:t.length;if(!i)return-1;var c=r==null?0:it(r);return c<0&&(c=Bt(i+c,0)),F(t,e,c)}function f5(t){return t!=null&&t.length?be(t,0,-1):[]}function p5(t,e){return t==null?"":o7.call(t,e)}function we(t){var e=t==null?0:t.length;return e?t[e-1]:v}function h5(t,e,r){var i=t==null?0:t.length;if(!i)return-1;var c=i;return r!==v&&(c=it(r),c=c<0?Bt(i+c,0):Jt(c,i-1)),e===e?St(t,e,c):tt(t,pt,c,!0)}function d5(t,e){return t&&t.length?Ma(t,it(e)):v}function _s(t,e){return t&&t.length&&e&&e.length?Fi(t,e):t}function v5(t,e,r){return t&&t.length&&e&&e.length?Fi(t,e,P(r,2)):t}function g5(t,e,r){return t&&t.length&&e&&e.length?Fi(t,e,v,r):t}function y5(t,e){var r=[];if(!t||!t.length)return r;var i=-1,c=[],h=t.length;for(e=P(e,3);++i<h;){var g=t[i];e(g,i,t)&&(r.push(g),c.push(i))}return Va(t,c),r}function a1(t){return t==null?t:s7.call(t)}function _5(t,e,r){var i=t==null?0:t.length;return i?(r&&typeof r!="number"&&ie(t,e,r)?(e=0,r=i):(e=e==null?0:it(e),r=r===v?i:it(r)),be(t,e,r)):[]}function m5(t,e){return ao(t,e)}function Q5(t,e,r){return Yi(t,e,P(r,2))}function b5(t,e){var r=t==null?0:t.length;if(r){var i=ao(t,e);if(i<r&&Te(t[i],e))return i}return-1}function w5(t,e){return ao(t,e,!0)}function C5(t,e,r){return Yi(t,e,P(r,2),!0)}function E5(t,e){if(t!=null&&t.length){var r=ao(t,e,!0)-1;if(Te(t[r],e))return r}return-1}function A5(t){return t&&t.length?Wa(t):[]}function I5(t,e){return t&&t.length?Wa(t,P(e,2)):[]}function L5(t){var e=t==null?0:t.length;return e?be(t,1,e):[]}function x5(t,e,r){return t&&t.length?(e=r||e===v?1:it(e),be(t,0,e<0?0:e)):[]}function k5(t,e,r){var i=t==null?0:t.length;return i?(e=r||e===v?1:it(e),e=i-e,be(t,e<0?0:e,i)):[]}function O5(t,e){return t&&t.length?so(t,P(e,3),!1,!0):[]}function T5(t,e){return t&&t.length?so(t,P(e,3)):[]}function N5(t){return t&&t.length?sr(t):[]}function M5(t,e){return t&&t.length?sr(t,P(e,2)):[]}function D5(t,e){return e=typeof e=="function"?e:v,t&&t.length?sr(t,v,e):[]}function s1(t){if(!t||!t.length)return[];var e=0;return t=d(t,function(r){if(Dt(r))return e=Bt(r.length,e),!0}),ut(e,function(r){return C(t,vt(r))})}function ms(t,e){if(!t||!t.length)return[];var r=s1(t);return e==null?r:C(r,function(i){return u(e,v,i)})}function H5(t,e){return za(t||[],e||[],dn)}function V5(t,e){return za(t||[],e||[],_n)}function Qs(t){var e=s(t);return e.__chain__=!0,e}function W5(t,e){return e(t),t}function _o(t,e){return e(t)}function Z5(){return Qs(this)}function B5(){return new J(this.value(),this.__chain__)}function j5(){this.__values__===v&&(this.__values__=Os(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?v:this.__values__[this.__index__++]}}function z5(){return this}function U5(t){for(var e,r=this;r instanceof j;){var i=hs(r);i.__index__=0,i.__values__=v,e?c.__wrapped__=i:e=i;var c=i;r=r.__wrapped__}return c.__wrapped__=t,e}function $5(){var t=this.__wrapped__;if(t instanceof U){var e=t;return this.__actions__.length&&(e=new U(this)),e=e.reverse(),e.__actions__.push({func:_o,args:[a1],thisArg:v}),new J(e,this.__chain__)}return this.thru(a1)}function F5(){return ja(this.__wrapped__,this.__actions__)}function S5(t,e,r){var i=et(t)?p:o2;return r&&ie(t,e,r)&&(e=v),i(t,P(e,3))}function q5(t,e){return(et(t)?d:Aa)(t,P(e,3))}function Y5(t,e){return Gt(mo(t,e),1)}function G5(t,e){return Gt(mo(t,e),$e)}function X5(t,e,r){return r=r===v?1:it(r),Gt(mo(t,e),r)}function bs(t,e){return(et(t)?l:pr)(t,P(e,3))}function ws(t,e){return(et(t)?f:Ys)(t,P(e,3))}function K5(t,e,r,i){t=se(t)?t:Gr(t),r=r&&!i?it(r):0;var c=t.length;return r<0&&(r=Bt(c+r,0)),Co(t)?r<=c&&t.indexOf(e,r)>-1:!!c&&F(t,e,r)>-1}function mo(t,e){return(et(t)?C:Oa)(t,P(e,3))}function J5(t,e,r,i){return t==null?[]:(et(e)||(e=e==null?[]:[e]),r=i?v:r,et(r)||(r=r==null?[]:[r]),Da(t,e,r))}function P5(t,e,r){var i=et(t)?N:Z,c=arguments.length<3;return i(t,P(e,4),r,c,pr)}function R5(t,e,r){var i=et(t)?D:Z,c=arguments.length<3;return i(t,P(e,4),r,c,Ys)}function tp(t,e){return(et(t)?d:Aa)(t,bo(P(e,3)))}function ep(t){return(et(t)?ba:w2)(t)}function rp(t,e,r){return e=(r?ie(t,e,r):e===v)?1:it(e),(et(t)?R3:C2)(t,e)}function np(t){return(et(t)?t2:E2)(t)}function op(t){if(t==null)return 0;if(se(t))return Co(t)?Wt(t):t.length;var e=Pt(t);return e==xe||e==ke?t.size:Ui(t).length}function ip(t,e,r){var i=et(t)?T:A2;return r&&ie(t,e,r)&&(e=v),i(t,P(e,3))}function up(t,e){if(typeof e!="function")throw new Ee(Ot);return t=it(t),function(){if(--t<1)return e.apply(this,arguments)}}function Cs(t,e,r){return e=r?v:e,e=t&&e==null?t.length:e,Ke(t,Ie,v,v,v,v,e)}function Es(t,e){var r;if(typeof e!="function")throw new Ee(Ot);return t=it(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=v),r}}function As(t,e,r){e=r?v:e;var i=Ke(t,ge,v,v,v,v,v,e);return i.placeholder=As.placeholder,i}function Is(t,e,r){e=r?v:e;var i=Ke(t,ur,v,v,v,v,v,e);return i.placeholder=Is.placeholder,i}function Ls(t,e,r){function i(Nt){var Ae=V,xn=S;return V=S=v,lt=Nt,ot=t.apply(xn,Ae)}function c(Nt){return lt=Nt,K=Ln(y,e),Rt?i(Nt):ot}function h(Nt){var Ae=Nt-ct,xn=Nt-lt,cc=e-Ae;return fe?Jt(cc,X-xn):cc}function g(Nt){var Ae=Nt-ct,xn=Nt-lt;return ct===v||Ae>=e||Ae<0||fe&&xn>=X}function y(){var Nt=Zo();return g(Nt)?b(Nt):(K=Ln(y,h(Nt)),v)}function b(Nt){return K=v,dr&&V?i(Nt):(V=S=v,ot)}function x(){K!==v&&Ks(K),lt=0,V=ct=S=K=v}function A(){return K===v?ot:b(Zo())}function O(){var Nt=Zo(),Ae=g(Nt);if(V=arguments,S=this,ct=Nt,Ae){if(K===v)return c(ct);if(fe)return Ks(K),K=Ln(y,e),i(ct)}return K===v&&(K=Ln(y,e)),ot}var V,S,X,ot,K,ct,lt=0,Rt=!1,fe=!1,dr=!0;if(typeof t!="function")throw new Ee(Ot);return e=Ce(e)||0,xt(r)&&(Rt=!!r.leading,fe="maxWait"in r,X=fe?Bt(Ce(r.maxWait)||0,e):X,dr="trailing"in r?!!r.trailing:dr),O.cancel=x,O.flush=A,O}function ap(t){return Ke(t,Le)}function Qo(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new Ee(Ot);var r=function(){var i=arguments,c=e?e.apply(this,i):i[0],h=r.cache;if(h.has(c))return h.get(c);var g=t.apply(this,i);return r.cache=h.set(c,g)||h,g};return r.cache=new(Qo.Cache||Ge),r}function bo(t){if(typeof t!="function")throw new Ee(Ot);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function sp(t){return Es(2,t)}function cp(t,e){if(typeof t!="function")throw new Ee(Ot);return e=e===v?e:it(e),st(t,e)}function lp(t,e){if(typeof t!="function")throw new Ee(Ot);return e=e==null?0:Bt(it(e),0),st(function(r){var i=r[e],c=lr(r,0,e);return i&&k(c,i),u(t,this,c)})}function fp(t,e,r){var i=!0,c=!0;if(typeof t!="function")throw new Ee(Ot);return xt(r)&&(i="leading"in r?!!r.leading:i,c="trailing"in r?!!r.trailing:c),Ls(t,e,{leading:i,maxWait:e,trailing:c})}function pp(t){return Cs(t,1)}function hp(t,e){return x1(Ji(e),t)}function dp(){if(!arguments.length)return[];var t=arguments[0];return et(t)?t:[t]}function vp(t){return Qe(t,Me)}function gp(t,e){return e=typeof e=="function"?e:v,Qe(t,Me,e)}function yp(t){return Qe(t,qt|Me)}function _p(t,e){return e=typeof e=="function"?e:v,Qe(t,qt|Me,e)}function mp(t,e){return e==null||Ca(t,e,$t(e))}function Te(t,e){return t===e||t!==t&&e!==e}function se(t){return t!=null&&wo(t.length)&&!Re(t)}function Dt(t){return Tt(t)&&se(t)}function Qp(t){return t===!0||t===!1||Tt(t)&&oe(t)==Se}function bp(t){return Tt(t)&&t.nodeType===1&&!bn(t)}function wp(t){if(t==null)return!0;if(se(t)&&(et(t)||typeof t=="string"||typeof t.splice=="function"||hr(t)||tn(t)||Lr(t)))return!t.length;var e=Pt(t);if(e==xe||e==ke)return!t.size;if(Qn(t))return!Ui(t).length;for(var r in t)if(mt.call(t,r))return!1;return!0}function Cp(t,e){return yn(t,e)}function Ep(t,e,r){r=typeof r=="function"?r:v;var i=r?r(t,e):v;return i===v?yn(t,e,v,r):!!i}function c1(t){if(!Tt(t))return!1;var e=oe(t);return e==Jn||e==_0||typeof t.message=="string"&&typeof t.name=="string"&&!bn(t)}function Ap(t){return typeof t=="number"&&Fs(t)}function Re(t){if(!xt(t))return!1;var e=oe(t);return e==Pn||e==Uu||e==_r||e==Q0}function xs(t){return typeof t=="number"&&t==it(t)}function wo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ve}function xt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Tt(t){return t!=null&&typeof t=="object"}function Ip(t,e){return t===e||zi(t,e,n1(e))}function Lp(t,e,r){return r=typeof r=="function"?r:v,zi(t,e,n1(e),r)}function xp(t){return ks(t)&&t!=+t}function kp(t){if(y7(t))throw new _1(ci);return xa(t)}function Op(t){return t===null}function Tp(t){return t==null}function ks(t){return typeof t=="number"||Tt(t)&&oe(t)==cn}function bn(t){if(!Tt(t)||oe(t)!=qe)return!1;var e=To(t);if(e===null)return!0;var r=mt.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Lo.call(r)==Jh}function Np(t){return xs(t)&&t>=-Ve&&t<=Ve}function Co(t){return typeof t=="string"||!et(t)&&Tt(t)&&oe(t)==fn}function de(t){return typeof t=="symbol"||Tt(t)&&oe(t)==Rn}function Mp(t){return t===v}function Dp(t){return Tt(t)&&Pt(t)==pn}function Hp(t){return Tt(t)&&oe(t)==w0}function Os(t){if(!t)return[];if(se(t))return Co(t)?Kt(t):ae(t);if(wn&&t[wn])return Y(t[wn]());var e=Pt(t);return(e==xe?M:e==ke?nt:Gr)(t)}function tr(t){return t?(t=Ce(t),t===$e||t===-$e?(t<0?-1:1)*di:t===t?t:0):t===0?t:0}function it(t){var e=tr(t),r=e%1;return e===e?r?e-r:e:0}function Ts(t){return t?wr(it(t),0,_e):0}function Ce(t){if(typeof t=="number")return t;if(de(t))return zr;if(xt(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=xt(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=at(t);var r=$0.test(t);return r||S0.test(t)?C3(t.slice(2),r?2:8):U0.test(t)?zr:+t}function Ns(t){return Ze(t,ce(t))}function Vp(t){return t?wr(it(t),-Ve,Ve):t===0?t:0}function _t(t){return t==null?"":he(t)}function Wp(t,e){var r=Rr(t);return e==null?r:wa(r,e)}function Zp(t,e){return q(t,P(e,3),We)}function Bp(t,e){return q(t,P(e,3),Zi)}function jp(t,e){return t==null?t:C1(t,P(e,3),ce)}function zp(t,e){return t==null?t:Gs(t,P(e,3),ce)}function Up(t,e){return t&&We(t,P(e,3))}function $p(t,e){return t&&Zi(t,P(e,3))}function Fp(t){return t==null?[]:io(t,$t(t))}function Sp(t){return t==null?[]:io(t,ce(t))}function l1(t,e,r){var i=t==null?v:Cr(t,e);return i===v?r:i}function qp(t,e){return t!=null&&is(t,e,u2)}function f1(t,e){return t!=null&&is(t,e,a2)}function $t(t){return se(t)?Qa(t):Ui(t)}function ce(t){return se(t)?Qa(t,!0):y2(t)}function Yp(t,e){var r={};return e=P(e,3),We(t,function(i,c,h){Xe(r,e(i,c,h),i)}),r}function Gp(t,e){var r={};return e=P(e,3),We(t,function(i,c,h){Xe(r,c,e(i,c,h))}),r}function Xp(t,e){return Ms(t,bo(P(e)))}function Ms(t,e){if(t==null)return{};var r=C(r1(t),function(i){return[i]});return e=P(e),Ha(t,r,function(i,c){return e(i,c[0])})}function Kp(t,e,r){e=cr(e,t);var i=-1,c=e.length;for(c||(c=1,t=v);++i<c;){var h=t==null?v:t[Be(e[i])];h===v&&(i=c,h=r),t=Re(h)?h.call(t):h}return t}function Jp(t,e,r){return t==null?t:_n(t,e,r)}function Pp(t,e,r,i){return i=typeof i=="function"?i:v,t==null?t:_n(t,e,r,i)}function Rp(t,e,r){var i=et(t),c=i||hr(t)||tn(t);if(e=P(e,4),r==null){var h=t&&t.constructor;r=c?i?new h:[]:xt(t)&&Re(h)?Rr(To(t)):{}}return(c?l:We)(t,function(g,y,b){return e(r,g,y,b)}),r}function th(t,e){return t==null||Gi(t,e)}function eh(t,e,r){return t==null?t:Ba(t,e,Ji(r))}function rh(t,e,r,i){return i=typeof i=="function"?i:v,t==null?t:Ba(t,e,Ji(r),i)}function Gr(t){return t==null?[]:Mt(t,$t(t))}function nh(t){return t==null?[]:Mt(t,ce(t))}function oh(t,e,r){return r===v&&(r=e,e=v),r!==v&&(r=Ce(r),r=r===r?r:0),e!==v&&(e=Ce(e),e=e===e?e:0),wr(Ce(t),e,r)}function ih(t,e,r){return e=tr(e),r===v?(r=e,e=0):r=tr(r),t=Ce(t),s2(t,e,r)}function uh(t,e,r){if(r&&typeof r!="boolean"&&ie(t,e,r)&&(e=r=v),r===v&&(typeof e=="boolean"?(r=e,e=v):typeof t=="boolean"&&(r=t,t=v)),t===v&&e===v?(t=0,e=1):(t=tr(t),e===v?(e=t,t=0):e=tr(e)),t>e){var i=t;t=e,e=i}if(r||t%1||e%1){var c=Ss();return Jt(t+c*(e-t+w3("1e-"+((c+"").length-1))),e)}return Si(t,e)}function Ds(t){return O1(_t(t).toLowerCase())}function Hs(t){return t=_t(t),t&&t.replace(Y0,I3).replace(p3,"")}function ah(t,e,r){t=_t(t),e=he(e);var i=t.length;r=r===v?i:wr(it(r),0,i);var c=r;return r-=e.length,r>=0&&t.slice(r,c)==e}function sh(t){return t=_t(t),t&&L0.test(t)?t.replace(Su,L3):t}function ch(t){return t=_t(t),t&&M0.test(t)?t.replace(Ii,"\\$&"):t}function lh(t,e,r){t=_t(t),e=it(e);var i=e?Wt(t):0;if(!e||i>=e)return t;var c=(e-i)/2;return po(Ho(c),r)+t+po(Do(c),r)}function fh(t,e,r){t=_t(t),e=it(e);var i=e?Wt(t):0;return e&&i<e?t+po(e-i,r):t}function ph(t,e,r){t=_t(t),e=it(e);var i=e?Wt(t):0;return e&&i<e?po(e-i,r)+t:t}function hh(t,e,r){return r||e==null?e=0:e&&(e=+e),a7(_t(t).replace(Li,""),e||0)}function dh(t,e,r){return e=(r?ie(t,e,r):e===v)?1:it(e),qi(_t(t),e)}function vh(){var t=arguments,e=_t(t[0]);return t.length<3?e:e.replace(t[1],t[2])}function gh(t,e,r){return r&&typeof r!="number"&&ie(t,e,r)&&(e=r=v),(r=r===v?_e:r>>>0)?(t=_t(t),t&&(typeof e=="string"||e!=null&&!k1(e))&&(e=he(e),!e&&kt(t))?lr(Kt(t),0,r):t.split(e,r)):[]}function yh(t,e,r){return t=_t(t),r=r==null?0:wr(it(r),0,t.length),e=he(e),t.slice(r,r+e.length)==e}function _h(t,e,r){var i=s.templateSettings;r&&ie(t,e,r)&&(e=v),t=_t(t),e=Bo({},e,i,rs);var c,h,g=Bo({},e.imports,i.imports,rs),y=$t(g),b=Mt(g,y),x=0,A=e.interpolate||to,O="__p += '",V=m1((e.escape||to).source+"|"+A.source+"|"+(A===qu?z0:to).source+"|"+(e.evaluate||to).source+"|$","g"),S="//# sourceURL="+(mt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++y3+"]")+`
11
- `;t.replace(V,function(K,ct,lt,Rt,fe,dr){return lt||(lt=Rt),O+=t.slice(x,dr).replace(G0,ee),ct&&(c=!0,O+=`' +
12
- __e(`+ct+`) +
13
- '`),fe&&(h=!0,O+=`';
14
- `+fe+`;
15
- __p += '`),lt&&(O+=`' +
16
- ((__t = (`+lt+`)) == null ? '' : __t) +
17
- '`),x=dr+K.length,K}),O+=`';
18
- `;var X=mt.call(e,"variable")&&e.variable;if(X){if(B0.test(X))throw new _1(Wr)}else O=`with (obj) {
10
+ `)}function F2(t){return rt(t)||Ir(t)||!!($s&&t&&t[$s])}function Je(t,e){var r=typeof t;return e=e??He,!!e&&(r=="number"||r!="symbol"&&q0.test(t))&&t>-1&&t%1==0&&t<e}function oe(t,e,r){if(!Lt(r))return!1;var i=typeof e;return!!(i=="number"?ae(r)&&Je(e,r.length):i=="string"&&e in r)&&Oe(r[e],t)}function o1(t,e){if(rt(t))return!1;var r=typeof t;return!(r!="number"&&r!="symbol"&&r!="boolean"&&t!=null&&!he(t))||T0.test(t)||!O0.test(t)||e!=null&&t in Et(e)}function S2(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function i1(t){var e=vo(t),r=s[e];if(typeof r!="function"||!(e in z.prototype))return!1;if(t===r)return!0;var i=E1(r);return!!i&&t===i[0]}function q2(t){return!!Bs&&Bs in t}function Qn(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||Kr)}function as(t){return t===t&&!Lt(t)}function ss(t,e){return function(r){return r!=null&&r[t]===e&&(e!==v||t in Et(r))}}function Y2(t){var e=Qo(t,function(i){return r.size===Xn&&r.clear(),i}),r=e.cache;return e}function G2(t,e){var r=t[1],i=e[1],c=r|i,h=c<(ee|Ue|Ee),g=i==Ee&&r==de||i==Ee&&r==re&&t[7].length<=e[8]||i==(Ee|re)&&e[7].length<=e[8]&&r==de;if(!h&&!g)return t;i&ee&&(t[2]=e[2],c|=r&ee?0:Kn);var _=e[3];if(_){var b=t[3];t[3]=b?Sa(b,_,e[4]):_,t[4]=b?U(t[3],Wr):e[4]}return _=e[5],_&&(b=t[5],t[5]=b?qa(b,_,e[6]):_,t[6]=b?U(t[5],Wr):e[6]),_=e[7],_&&(t[7]=_),i&Ee&&(t[8]=t[8]==null?e[8]:Jt(t[8],e[8])),t[9]==null&&(t[9]=e[9]),t[0]=e[0],t[1]=c,t}function X2(t){var e=[];if(t!=null)for(var r in Et(t))e.push(r);return e}function K2(t){return xo.call(t)}function cs(t,e,r){return e=Zt(e===v?t.length-1:e,0),function(){for(var i=arguments,c=-1,h=Zt(i.length-e,0),g=Wt(h);++c<h;)g[c]=i[e+c];c=-1;for(var _=Wt(e+1);++c<e;)_[c]=i[c];return _[e]=r(g),u(t,this,_)}}function ls(t,e){return e.length<2?t:wr(t,me(e,0,-1))}function J2(t,e){for(var r=t.length,i=Jt(e.length,r),c=ue(t);i--;){var h=e[i];t[i]=Je(h,r)?c[h]:v}return t}function u1(t,e){if((e!=="constructor"||typeof t[e]!="function")&&e!="__proto__")return t[e]}function fs(t,e,r){var i=e+"";return I1(t,$2(i,P2(j2(i),r)))}function ps(t){var e=0,r=0;return function(){var i=u7(),c=Br-(i-r);if(r=i,c>0){if(++e>=pi)return arguments[0]}else e=0;return t.apply(v,arguments)}}function yo(t,e){var r=-1,i=t.length,c=i-1;for(e=e===v?i:e;++r<e;){var h=Si(r,c),g=t[h];t[h]=t[r],t[r]=g}return t.length=e,t}function Ze(t){if(typeof t=="string"||he(t))return t;var e=t+"";return e=="0"&&1/t==-$e?"-0":e}function Er(t){if(t!=null){try{return Lo.call(t)}catch{}try{return t+""}catch{}}return""}function P2(t,e){return l(gi,function(r){var i="_."+r[0];e&r[1]&&!Q(t,i)&&t.push(i)}),t.sort()}function hs(t){if(t instanceof z)return t.clone();var e=new J(t.__wrapped__,t.__chain__);return e.__actions__=ue(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}function R2(t,e,r){e=(r?oe(t,e,r):e===v)?1:Zt(at(e),0);var i=t==null?0:t.length;if(!i||e<1)return[];for(var c=0,h=0,g=Wt(Mo(i/e));c<i;)g[h++]=me(t,c,c+=e);return g}function t5(t){for(var e=-1,r=t==null?0:t.length,i=0,c=[];++e<r;){var h=t[e];h&&(c[i++]=h)}return c}function e5(){var t=arguments.length;if(!t)return[];for(var e=Wt(t-1),r=arguments[0],i=t;i--;)e[i-1]=arguments[i];return k(rt(r)?ue(r):[r],Yt(e,1))}function r5(t,e,r){var i=t==null?0:t.length;return i?(e=r||e===v?1:at(e),me(t,e<0?0:e,i)):[]}function n5(t,e,r){var i=t==null?0:t.length;return i?(e=r||e===v?1:at(e),e=i-e,me(t,0,e<0?0:e)):[]}function o5(t,e){return t&&t.length?so(t,P(e,3),!0,!0):[]}function i5(t,e){return t&&t.length?so(t,P(e,3),!0):[]}function u5(t,e,r,i){var c=t==null?0:t.length;return c?(r&&typeof r!="number"&&oe(t,e,r)&&(r=0,i=c),i2(t,e,r,i)):[]}function ds(t,e,r){var i=t==null?0:t.length;if(!i)return-1;var c=r==null?0:at(r);return c<0&&(c=Zt(i+c,0)),R(t,P(e,3),c)}function vs(t,e,r){var i=t==null?0:t.length;if(!i)return-1;var c=i-1;return r!==v&&(c=at(r),c=r<0?Zt(i+c,0):Jt(c,i-1)),R(t,P(e,3),c,!0)}function gs(t){return t!=null&&t.length?Yt(t,1):[]}function a5(t){return t!=null&&t.length?Yt(t,$e):[]}function s5(t,e){return t!=null&&t.length?(e=e===v?1:at(e),Yt(t,e)):[]}function c5(t){for(var e=-1,r=t==null?0:t.length,i={};++e<r;){var c=t[e];i[c[0]]=c[1]}return i}function ys(t){return t&&t.length?t[0]:v}function l5(t,e,r){var i=t==null?0:t.length;if(!i)return-1;var c=r==null?0:at(r);return c<0&&(c=Zt(i+c,0)),$(t,e,c)}function f5(t){return t!=null&&t.length?me(t,0,-1):[]}function p5(t,e){return t==null?"":o7.call(t,e)}function Qe(t){var e=t==null?0:t.length;return e?t[e-1]:v}function h5(t,e,r){var i=t==null?0:t.length;if(!i)return-1;var c=i;return r!==v&&(c=at(r),c=c<0?Zt(i+c,0):Jt(c,i-1)),e===e?Ft(t,e,c):R(t,ht,c,!0)}function d5(t,e){return t&&t.length?Da(t,at(e)):v}function _s(t,e){return t&&t.length&&e&&e.length?Fi(t,e):t}function v5(t,e,r){return t&&t.length&&e&&e.length?Fi(t,e,P(r,2)):t}function g5(t,e,r){return t&&t.length&&e&&e.length?Fi(t,e,v,r):t}function y5(t,e){var r=[];if(!t||!t.length)return r;var i=-1,c=[],h=t.length;for(e=P(e,3);++i<h;){var g=t[i];e(g,i,t)&&(r.push(g),c.push(i))}return Va(t,c),r}function a1(t){return t==null?t:s7.call(t)}function _5(t,e,r){var i=t==null?0:t.length;return i?(r&&typeof r!="number"&&oe(t,e,r)?(e=0,r=i):(e=e==null?0:at(e),r=r===v?i:at(r)),me(t,e,r)):[]}function m5(t,e){return ao(t,e)}function Q5(t,e,r){return Yi(t,e,P(r,2))}function b5(t,e){var r=t==null?0:t.length;if(r){var i=ao(t,e);if(i<r&&Oe(t[i],e))return i}return-1}function w5(t,e){return ao(t,e,!0)}function C5(t,e,r){return Yi(t,e,P(r,2),!0)}function E5(t,e){if(t!=null&&t.length){var r=ao(t,e,!0)-1;if(Oe(t[r],e))return r}return-1}function A5(t){return t&&t.length?Wa(t):[]}function I5(t,e){return t&&t.length?Wa(t,P(e,2)):[]}function L5(t){var e=t==null?0:t.length;return e?me(t,1,e):[]}function x5(t,e,r){return t&&t.length?(e=r||e===v?1:at(e),me(t,0,e<0?0:e)):[]}function k5(t,e,r){var i=t==null?0:t.length;return i?(e=r||e===v?1:at(e),e=i-e,me(t,e<0?0:e,i)):[]}function O5(t,e){return t&&t.length?so(t,P(e,3),!1,!0):[]}function T5(t,e){return t&&t.length?so(t,P(e,3)):[]}function N5(t){return t&&t.length?ar(t):[]}function D5(t,e){return t&&t.length?ar(t,P(e,2)):[]}function M5(t,e){return e=typeof e=="function"?e:v,t&&t.length?ar(t,v,e):[]}function s1(t){if(!t||!t.length)return[];var e=0;return t=d(t,function(r){if(Dt(r))return e=Zt(r.length,e),!0}),tt(e,function(r){return C(t,mt(r))})}function ms(t,e){if(!t||!t.length)return[];var r=s1(t);return e==null?r:C(r,function(i){return u(e,v,i)})}function H5(t,e){return za(t||[],e||[],dn)}function V5(t,e){return za(t||[],e||[],_n)}function Qs(t){var e=s(t);return e.__chain__=!0,e}function W5(t,e){return e(t),t}function _o(t,e){return e(t)}function Z5(){return Qs(this)}function B5(){return new J(this.value(),this.__chain__)}function j5(){this.__values__===v&&(this.__values__=Os(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?v:this.__values__[this.__index__++]}}function z5(){return this}function U5(t){for(var e,r=this;r instanceof B;){var i=hs(r);i.__index__=0,i.__values__=v,e?c.__wrapped__=i:e=i;var c=i;r=r.__wrapped__}return c.__wrapped__=t,e}function $5(){var t=this.__wrapped__;if(t instanceof z){var e=t;return this.__actions__.length&&(e=new z(this)),e=e.reverse(),e.__actions__.push({func:_o,args:[a1],thisArg:v}),new J(e,this.__chain__)}return this.thru(a1)}function F5(){return ja(this.__wrapped__,this.__actions__)}function S5(t,e,r){var i=rt(t)?p:o2;return r&&oe(t,e,r)&&(e=v),i(t,P(e,3))}function q5(t,e){return(rt(t)?d:Aa)(t,P(e,3))}function Y5(t,e){return Yt(mo(t,e),1)}function G5(t,e){return Yt(mo(t,e),$e)}function X5(t,e,r){return r=r===v?1:at(r),Yt(mo(t,e),r)}function bs(t,e){return(rt(t)?l:fr)(t,P(e,3))}function ws(t,e){return(rt(t)?f:Ys)(t,P(e,3))}function K5(t,e,r,i){t=ae(t)?t:Gr(t),r=r&&!i?at(r):0;var c=t.length;return r<0&&(r=Zt(c+r,0)),Co(t)?r<=c&&t.indexOf(e,r)>-1:!!c&&$(t,e,r)>-1}function mo(t,e){return(rt(t)?C:Oa)(t,P(e,3))}function J5(t,e,r,i){return t==null?[]:(rt(e)||(e=e==null?[]:[e]),r=i?v:r,rt(r)||(r=r==null?[]:[r]),Ma(t,e,r))}function P5(t,e,r){var i=rt(t)?N:D,c=arguments.length<3;return i(t,P(e,4),r,c,fr)}function R5(t,e,r){var i=rt(t)?H:D,c=arguments.length<3;return i(t,P(e,4),r,c,Ys)}function tp(t,e){return(rt(t)?d:Aa)(t,bo(P(e,3)))}function ep(t){return(rt(t)?ba:w2)(t)}function rp(t,e,r){return e=(r?oe(t,e,r):e===v)?1:at(e),(rt(t)?R3:C2)(t,e)}function np(t){return(rt(t)?t2:E2)(t)}function op(t){if(t==null)return 0;if(ae(t))return Co(t)?Vt(t):t.length;var e=Pt(t);return e==Le||e==xe?t.size:Ui(t).length}function ip(t,e,r){var i=rt(t)?T:A2;return r&&oe(t,e,r)&&(e=v),i(t,P(e,3))}function up(t,e){if(typeof e!="function")throw new we(Nt);return t=at(t),function(){if(--t<1)return e.apply(this,arguments)}}function Cs(t,e,r){return e=r?v:e,e=t&&e==null?t.length:e,Xe(t,Ee,v,v,v,v,e)}function Es(t,e){var r;if(typeof e!="function")throw new we(Nt);return t=at(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=v),r}}function As(t,e,r){e=r?v:e;var i=Xe(t,de,v,v,v,v,v,e);return i.placeholder=As.placeholder,i}function Is(t,e,r){e=r?v:e;var i=Xe(t,ir,v,v,v,v,v,e);return i.placeholder=Is.placeholder,i}function Ls(t,e,r){function i(Ot){var Ce=W,xn=F;return W=F=v,ft=Ot,ot=t.apply(xn,Ce)}function c(Ot){return ft=Ot,K=Ln(_,e),Rt?i(Ot):ot}function h(Ot){var Ce=Ot-lt,xn=Ot-ft,cc=e-Ce;return le?Jt(cc,X-xn):cc}function g(Ot){var Ce=Ot-lt,xn=Ot-ft;return lt===v||Ce>=e||Ce<0||le&&xn>=X}function _(){var Ot=Zo();return g(Ot)?b(Ot):(K=Ln(_,h(Ot)),v)}function b(Ot){return K=v,hr&&W?i(Ot):(W=F=v,ot)}function L(){K!==v&&Ks(K),ft=0,W=lt=F=K=v}function A(){return K===v?ot:b(Zo())}function O(){var Ot=Zo(),Ce=g(Ot);if(W=arguments,F=this,lt=Ot,Ce){if(K===v)return c(lt);if(le)return Ks(K),K=Ln(_,e),i(lt)}return K===v&&(K=Ln(_,e)),ot}var W,F,X,ot,K,lt,ft=0,Rt=!1,le=!1,hr=!0;if(typeof t!="function")throw new we(Nt);return e=be(e)||0,Lt(r)&&(Rt=!!r.leading,le="maxWait"in r,X=le?Zt(be(r.maxWait)||0,e):X,hr="trailing"in r?!!r.trailing:hr),O.cancel=L,O.flush=A,O}function ap(t){return Xe(t,Ae)}function Qo(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new we(Nt);var r=function(){var i=arguments,c=e?e.apply(this,i):i[0],h=r.cache;if(h.has(c))return h.get(c);var g=t.apply(this,i);return r.cache=h.set(c,g)||h,g};return r.cache=new(Qo.Cache||Ye),r}function bo(t){if(typeof t!="function")throw new we(Nt);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function sp(t){return Es(2,t)}function cp(t,e){if(typeof t!="function")throw new we(Nt);return e=e===v?e:at(e),st(t,e)}function lp(t,e){if(typeof t!="function")throw new we(Nt);return e=e==null?0:Zt(at(e),0),st(function(r){var i=r[e],c=cr(r,0,e);return i&&k(c,i),u(t,this,c)})}function fp(t,e,r){var i=!0,c=!0;if(typeof t!="function")throw new we(Nt);return Lt(r)&&(i="leading"in r?!!r.leading:i,c="trailing"in r?!!r.trailing:c),Ls(t,e,{leading:i,maxWait:e,trailing:c})}function pp(t){return Cs(t,1)}function hp(t,e){return x1(Ji(e),t)}function dp(){if(!arguments.length)return[];var t=arguments[0];return rt(t)?t:[t]}function vp(t){return _e(t,Ne)}function gp(t,e){return e=typeof e=="function"?e:v,_e(t,Ne,e)}function yp(t){return _e(t,St|Ne)}function _p(t,e){return e=typeof e=="function"?e:v,_e(t,St|Ne,e)}function mp(t,e){return e==null||Ca(t,e,zt(e))}function Oe(t,e){return t===e||t!==t&&e!==e}function ae(t){return t!=null&&wo(t.length)&&!Pe(t)}function Dt(t){return kt(t)&&ae(t)}function Qp(t){return t===!0||t===!1||kt(t)&&ne(t)==Ie}function bp(t){return kt(t)&&t.nodeType===1&&!bn(t)}function wp(t){if(t==null)return!0;if(ae(t)&&(rt(t)||typeof t=="string"||typeof t.splice=="function"||pr(t)||tn(t)||Ir(t)))return!t.length;var e=Pt(t);if(e==Le||e==xe)return!t.size;if(Qn(t))return!Ui(t).length;for(var r in t)if(Qt.call(t,r))return!1;return!0}function Cp(t,e){return yn(t,e)}function Ep(t,e,r){r=typeof r=="function"?r:v;var i=r?r(t,e):v;return i===v?yn(t,e,v,r):!!i}function c1(t){if(!kt(t))return!1;var e=ne(t);return e==Jn||e==_0||typeof t.message=="string"&&typeof t.name=="string"&&!bn(t)}function Ap(t){return typeof t=="number"&&Fs(t)}function Pe(t){if(!Lt(t))return!1;var e=ne(t);return e==Pn||e==Uu||e==zr||e==Q0}function xs(t){return typeof t=="number"&&t==at(t)}function wo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=He}function Lt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function kt(t){return t!=null&&typeof t=="object"}function Ip(t,e){return t===e||zi(t,e,n1(e))}function Lp(t,e,r){return r=typeof r=="function"?r:v,zi(t,e,n1(e),r)}function xp(t){return ks(t)&&t!=+t}function kp(t){if(y7(t))throw new _1(ci);return xa(t)}function Op(t){return t===null}function Tp(t){return t==null}function ks(t){return typeof t=="number"||kt(t)&&ne(t)==cn}function bn(t){if(!kt(t)||ne(t)!=Se)return!1;var e=To(t);if(e===null)return!0;var r=Qt.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Lo.call(r)==Jh}function Np(t){return xs(t)&&t>=-He&&t<=He}function Co(t){return typeof t=="string"||!rt(t)&&kt(t)&&ne(t)==fn}function he(t){return typeof t=="symbol"||kt(t)&&ne(t)==Rn}function Dp(t){return t===v}function Mp(t){return kt(t)&&Pt(t)==pn}function Hp(t){return kt(t)&&ne(t)==w0}function Os(t){if(!t)return[];if(ae(t))return Co(t)?Kt(t):ue(t);if(wn&&t[wn])return Y(t[wn]());var e=Pt(t);return(e==Le?M:e==xe?nt:Gr)(t)}function Re(t){return t?(t=be(t),t===$e||t===-$e?(t<0?-1:1)*di:t===t?t:0):t===0?t:0}function at(t){var e=Re(t),r=e%1;return e===e?r?e-r:e:0}function Ts(t){return t?br(at(t),0,ge):0}function be(t){if(typeof t=="number")return t;if(he(t))return jr;if(Lt(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Lt(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=pt(t);var r=$0.test(t);return r||S0.test(t)?C3(t.slice(2),r?2:8):U0.test(t)?jr:+t}function Ns(t){return We(t,se(t))}function Vp(t){return t?br(at(t),-He,He):t===0?t:0}function _t(t){return t==null?"":pe(t)}function Wp(t,e){var r=Rr(t);return e==null?r:wa(r,e)}function Zp(t,e){return q(t,P(e,3),Ve)}function Bp(t,e){return q(t,P(e,3),Zi)}function jp(t,e){return t==null?t:C1(t,P(e,3),se)}function zp(t,e){return t==null?t:Gs(t,P(e,3),se)}function Up(t,e){return t&&Ve(t,P(e,3))}function $p(t,e){return t&&Zi(t,P(e,3))}function Fp(t){return t==null?[]:io(t,zt(t))}function Sp(t){return t==null?[]:io(t,se(t))}function l1(t,e,r){var i=t==null?v:wr(t,e);return i===v?r:i}function qp(t,e){return t!=null&&is(t,e,u2)}function f1(t,e){return t!=null&&is(t,e,a2)}function zt(t){return ae(t)?Qa(t):Ui(t)}function se(t){return ae(t)?Qa(t,!0):y2(t)}function Yp(t,e){var r={};return e=P(e,3),Ve(t,function(i,c,h){Ge(r,e(i,c,h),i)}),r}function Gp(t,e){var r={};return e=P(e,3),Ve(t,function(i,c,h){Ge(r,c,e(i,c,h))}),r}function Xp(t,e){return Ds(t,bo(P(e)))}function Ds(t,e){if(t==null)return{};var r=C(r1(t),function(i){return[i]});return e=P(e),Ha(t,r,function(i,c){return e(i,c[0])})}function Kp(t,e,r){e=sr(e,t);var i=-1,c=e.length;for(c||(c=1,t=v);++i<c;){var h=t==null?v:t[Ze(e[i])];h===v&&(i=c,h=r),t=Pe(h)?h.call(t):h}return t}function Jp(t,e,r){return t==null?t:_n(t,e,r)}function Pp(t,e,r,i){return i=typeof i=="function"?i:v,t==null?t:_n(t,e,r,i)}function Rp(t,e,r){var i=rt(t),c=i||pr(t)||tn(t);if(e=P(e,4),r==null){var h=t&&t.constructor;r=c?i?new h:[]:Lt(t)&&Pe(h)?Rr(To(t)):{}}return(c?l:Ve)(t,function(g,_,b){return e(r,g,_,b)}),r}function th(t,e){return t==null||Gi(t,e)}function eh(t,e,r){return t==null?t:Ba(t,e,Ji(r))}function rh(t,e,r,i){return i=typeof i=="function"?i:v,t==null?t:Ba(t,e,Ji(r),i)}function Gr(t){return t==null?[]:Tt(t,zt(t))}function nh(t){return t==null?[]:Tt(t,se(t))}function oh(t,e,r){return r===v&&(r=e,e=v),r!==v&&(r=be(r),r=r===r?r:0),e!==v&&(e=be(e),e=e===e?e:0),br(be(t),e,r)}function ih(t,e,r){return e=Re(e),r===v?(r=e,e=0):r=Re(r),t=be(t),s2(t,e,r)}function uh(t,e,r){if(r&&typeof r!="boolean"&&oe(t,e,r)&&(e=r=v),r===v&&(typeof e=="boolean"?(r=e,e=v):typeof t=="boolean"&&(r=t,t=v)),t===v&&e===v?(t=0,e=1):(t=Re(t),e===v?(e=t,t=0):e=Re(e)),t>e){var i=t;t=e,e=i}if(r||t%1||e%1){var c=Ss();return Jt(t+c*(e-t+w3("1e-"+((c+"").length-1))),e)}return Si(t,e)}function Ms(t){return O1(_t(t).toLowerCase())}function Hs(t){return t=_t(t),t&&t.replace(Y0,I3).replace(p3,"")}function ah(t,e,r){t=_t(t),e=pe(e);var i=t.length;r=r===v?i:br(at(r),0,i);var c=r;return r-=e.length,r>=0&&t.slice(r,c)==e}function sh(t){return t=_t(t),t&&L0.test(t)?t.replace(Su,L3):t}function ch(t){return t=_t(t),t&&D0.test(t)?t.replace(Ii,"\\$&"):t}function lh(t,e,r){t=_t(t),e=at(e);var i=e?Vt(t):0;if(!e||i>=e)return t;var c=(e-i)/2;return po(Ho(c),r)+t+po(Mo(c),r)}function fh(t,e,r){t=_t(t),e=at(e);var i=e?Vt(t):0;return e&&i<e?t+po(e-i,r):t}function ph(t,e,r){t=_t(t),e=at(e);var i=e?Vt(t):0;return e&&i<e?po(e-i,r)+t:t}function hh(t,e,r){return r||e==null?e=0:e&&(e=+e),a7(_t(t).replace(Li,""),e||0)}function dh(t,e,r){return e=(r?oe(t,e,r):e===v)?1:at(e),qi(_t(t),e)}function vh(){var t=arguments,e=_t(t[0]);return t.length<3?e:e.replace(t[1],t[2])}function gh(t,e,r){return r&&typeof r!="number"&&oe(t,e,r)&&(e=r=v),(r=r===v?ge:r>>>0)?(t=_t(t),t&&(typeof e=="string"||e!=null&&!k1(e))&&(e=pe(e),!e&&xt(t))?cr(Kt(t),0,r):t.split(e,r)):[]}function yh(t,e,r){return t=_t(t),r=r==null?0:br(at(r),0,t.length),e=pe(e),t.slice(r,r+e.length)==e}function _h(t,e,r){var i=s.templateSettings;r&&oe(t,e,r)&&(e=v),t=_t(t),e=Bo({},e,i,rs);var c,h,g=Bo({},e.imports,i.imports,rs),_=zt(g),b=Tt(g,_),L=0,A=e.interpolate||to,O="__p += '",W=m1((e.escape||to).source+"|"+A.source+"|"+(A===qu?z0:to).source+"|"+(e.evaluate||to).source+"|$","g"),F="//# sourceURL="+(Qt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++y3+"]")+`
11
+ `;t.replace(W,function(K,lt,ft,Rt,le,hr){return ft||(ft=Rt),O+=t.slice(L,hr).replace(G0,ze),lt&&(c=!0,O+=`' +
12
+ __e(`+lt+`) +
13
+ '`),le&&(h=!0,O+=`';
14
+ `+le+`;
15
+ __p += '`),ft&&(O+=`' +
16
+ ((__t = (`+ft+`)) == null ? '' : __t) +
17
+ '`),L=hr+K.length,K}),O+=`';
18
+ `;var X=Qt.call(e,"variable")&&e.variable;if(X){if(B0.test(X))throw new _1(Vr)}else O=`with (obj) {
19
19
  `+O+`
20
20
  }
21
21
  `;O=(h?O.replace(C0,""):O).replace(E0,"$1").replace(A0,"$1;"),O="function("+(X||"obj")+`) {
@@ -24,4 +24,4 @@ __p += '`),lt&&(O+=`' +
24
24
  function print() { __p += __j.call(arguments, '') }
25
25
  `:`;
26
26
  `)+O+`return __p
27
- }`;var ot=sc(function(){return Zs(y,S+"return "+O).apply(v,b)});if(ot.source=O,c1(ot))throw ot;return ot}function mh(t){return _t(t).toLowerCase()}function Qh(t){return _t(t).toUpperCase()}function bh(t,e,r){if(t=_t(t),t&&(r||e===v))return at(t);if(!t||!(e=he(e)))return t;var i=Kt(t),c=Kt(e);return lr(i,bt(i,c),ve(i,c)+1).join("")}function wh(t,e,r){if(t=_t(t),t&&(r||e===v))return t.slice(0,or(t)+1);if(!t||!(e=he(e)))return t;var i=Kt(t);return lr(i,0,ve(i,Kt(e))+1).join("")}function Ch(t,e,r){if(t=_t(t),t&&(r||e===v))return t.replace(Li,"");if(!t||!(e=he(e)))return t;var i=Kt(t);return lr(i,bt(i,Kt(e))).join("")}function Eh(t,e){var r=li,i=fi;if(xt(e)){var c="separator"in e?e.separator:c;r="length"in e?it(e.length):r,i="omission"in e?he(e.omission):i}t=_t(t);var h=t.length;if(kt(t)){var g=Kt(t);h=g.length}if(r>=h)return t;var y=r-Wt(i);if(y<1)return i;var b=g?lr(g,0,y).join(""):t.slice(0,y);if(c===v)return b+i;if(g&&(y+=b.length-y),k1(c)){if(t.slice(y).search(c)){var x,A=b;for(c.global||(c=m1(c.source,_t(Yu.exec(c))+"g")),c.lastIndex=0;x=c.exec(A);)var O=x.index;b=b.slice(0,O===v?y:O)}}else if(t.indexOf(he(c),y)!=y){var V=b.lastIndexOf(c);V>-1&&(b=b.slice(0,V))}return b+i}function Ah(t){return t=_t(t),t&&I0.test(t)?t.replace(Fu,x3):t}function Vs(t,e,r){return t=_t(t),e=r?v:e,e===v?Ne(t)?ai(t):H(t):t.match(e)||[]}function Ih(t){var e=t==null?0:t.length,r=P();return t=e?C(t,function(i){if(typeof i[1]!="function")throw new Ee(Ot);return[r(i[0]),i[1]]}):[],st(function(i){for(var c=-1;++c<e;){var h=t[c];if(u(h[0],this,i))return u(h[1],this,i)}})}function Lh(t){return n2(Qe(t,qt))}function p1(t){return function(){return t}}function xh(t,e){return t==null||t!==t?e:t}function le(t){return t}function h1(t){return ka(typeof t=="function"?t:Qe(t,qt))}function kh(t){return Ta(Qe(t,qt))}function Oh(t,e){return Na(t,Qe(e,qt))}function d1(t,e,r){var i=$t(e),c=io(e,i);r!=null||xt(e)&&(c.length||!i.length)||(r=e,e=t,t=this,c=io(e,$t(e)));var h=!(xt(r)&&"chain"in r&&!r.chain),g=Re(t);return l(c,function(y){var b=e[y];t[y]=b,g&&(t.prototype[y]=function(){var x=this.__chain__;if(h||x){var A=t(this.__wrapped__);return(A.__actions__=ae(this.__actions__)).push({func:b,args:arguments,thisArg:t}),A.__chain__=x,A}return b.apply(t,k([this.value()],arguments))})}),t}function Th(){return Yt._===this&&(Yt._=Ph),this}function v1(){}function Nh(t){return t=it(t),st(function(e){return Ma(e,t)})}function Ws(t){return o1(t)?vt(Be(t)):Q2(t)}function Mh(t){return function(e){return t==null?v:Cr(t,e)}}function g1(){return[]}function y1(){return!1}function Dh(){return{}}function Hh(){return""}function Vh(){return!0}function Wh(t,e){if(t=it(t),t<1||t>Ve)return[];var r=_e,i=Jt(t,_e);e=P(e),t-=_e;for(var c=ut(i,e);++r<t;)e(r);return c}function Zh(t){return et(t)?C(t,Be):de(t)?[t]:ae(Rs(_t(t)))}function Bh(t){var e=++Kh;return _t(t)+e}function jh(t){return t&&t.length?oo(t,le,Bi):v}function zh(t,e){return t&&t.length?oo(t,P(e,2),Bi):v}function Uh(t){return dt(t,le)}function $h(t,e){return dt(t,P(e,2))}function Fh(t){return t&&t.length?oo(t,le,$i):v}function Sh(t,e){return t&&t.length?oo(t,P(e,2),$i):v}function qh(t){return t&&t.length?B(t,le):0}function Yh(t,e){return t&&t.length?B(t,P(e,2)):0}E=E==null?Yt:Fr.defaults(Yt.Object(),E,Fr.pick(Yt,g3));var Zt=E.Array,Eo=E.Date,_1=E.Error,Zs=E.Function,Xr=E.Math,At=E.Object,m1=E.RegExp,Gh=E.String,Ee=E.TypeError,Ao=Zt.prototype,Xh=Zs.prototype,Kr=At.prototype,Io=E["__core-js_shared__"],Lo=Xh.toString,mt=Kr.hasOwnProperty,Kh=0,Bs=function(){var t=/[^.]+$/.exec(Io&&Io.keys&&Io.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),xo=Kr.toString,Jh=Lo.call(At),Ph=Yt._,Rh=m1("^"+Lo.call(mt).replace(Ii,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ko=ha?E.Buffer:v,fr=E.Symbol,Oo=E.Uint8Array,js=ko?ko.allocUnsafe:v,To=z(At.getPrototypeOf,At),zs=At.create,Us=Kr.propertyIsEnumerable,No=Ao.splice,$s=fr?fr.isConcatSpreadable:v,wn=fr?fr.iterator:v,Ir=fr?fr.toStringTag:v,Mo=function(){try{var t=Er(At,"defineProperty");return t({},"",{}),t}catch{}}(),t7=E.clearTimeout!==Yt.clearTimeout&&E.clearTimeout,e7=Eo&&Eo.now!==Yt.Date.now&&Eo.now,r7=E.setTimeout!==Yt.setTimeout&&E.setTimeout,Do=Xr.ceil,Ho=Xr.floor,Q1=At.getOwnPropertySymbols,n7=ko?ko.isBuffer:v,Fs=E.isFinite,o7=Ao.join,i7=z(At.keys,At),Bt=Xr.max,Jt=Xr.min,u7=Eo.now,a7=E.parseInt,Ss=Xr.random,s7=Ao.reverse,b1=Er(E,"DataView"),Cn=Er(E,"Map"),w1=Er(E,"Promise"),Jr=Er(E,"Set"),En=Er(E,"WeakMap"),An=Er(At,"create"),Vo=En&&new En,Pr={},c7=Ar(b1),l7=Ar(Cn),f7=Ar(w1),p7=Ar(Jr),h7=Ar(En),Wo=fr?fr.prototype:v,In=Wo?Wo.valueOf:v,qs=Wo?Wo.toString:v,Rr=function(){function t(){}return function(e){if(!xt(e))return{};if(zs)return zs(e);t.prototype=e;var r=new t;return t.prototype=v,r}}();s.templateSettings={escape:x0,evaluate:k0,interpolate:qu,variable:"",imports:{_:s}},s.prototype=j.prototype,s.prototype.constructor=s,J.prototype=Rr(j.prototype),J.prototype.constructor=J,U.prototype=Rr(j.prototype),U.prototype.constructor=U,Qr.prototype.clear=T3,Qr.prototype.delete=N3,Qr.prototype.get=M3,Qr.prototype.has=D3,Qr.prototype.set=H3,Ye.prototype.clear=V3,Ye.prototype.delete=W3,Ye.prototype.get=Z3,Ye.prototype.has=B3,Ye.prototype.set=j3,Ge.prototype.clear=z3,Ge.prototype.delete=U3,Ge.prototype.get=$3,Ge.prototype.has=F3,Ge.prototype.set=S3,br.prototype.add=br.prototype.push=q3,br.prototype.has=Y3,Oe.prototype.clear=G3,Oe.prototype.delete=X3,Oe.prototype.get=K3,Oe.prototype.has=J3,Oe.prototype.set=P3;var pr=Ya(We),Ys=Ya(Zi,!0),C1=Ga(),Gs=Ga(!0),Xs=Vo?function(t,e){return Vo.set(t,e),t}:le,d7=Mo?function(t,e){return Mo(t,"toString",{configurable:!0,enumerable:!1,value:p1(e),writable:!0})}:le,v7=st,Ks=t7||function(t){return Yt.clearTimeout(t)},g7=Jr&&1/nt(new Jr([,-0]))[1]==$e?function(t){return new Jr(t)}:v1,E1=Vo?function(t){return Vo.get(t)}:v1,A1=Q1?function(t){return t==null?[]:(t=At(t),d(Q1(t),function(e){return Us.call(t,e)}))}:g1,Js=Q1?function(t){for(var e=[];t;)k(e,A1(t)),t=To(t);return e}:g1,Pt=oe;(b1&&Pt(new b1(new ArrayBuffer(1)))!=Ur||Cn&&Pt(new Cn)!=xe||w1&&Pt(w1.resolve())!=$u||Jr&&Pt(new Jr)!=ke||En&&Pt(new En)!=pn)&&(Pt=function(t){var e=oe(t),r=e==qe?t.constructor:v,i=r?Ar(r):"";if(i)switch(i){case c7:return Ur;case l7:return xe;case f7:return $u;case p7:return ke;case h7:return pn}return e});var y7=Io?Re:y1,Ps=ps(Xs),Ln=r7||function(t,e){return Yt.setTimeout(t,e)},I1=ps(d7),Rs=Y2(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(N0,function(r,i,c,h){e.push(c?h.replace(j0,"$1"):i||r)}),e}),_7=st(function(t,e){return Dt(t)?vn(t,Gt(e,1,Dt,!0)):[]}),m7=st(function(t,e){var r=we(e);return Dt(r)&&(r=v),Dt(t)?vn(t,Gt(e,1,Dt,!0),P(r,2)):[]}),Q7=st(function(t,e){var r=we(e);return Dt(r)&&(r=v),Dt(t)?vn(t,Gt(e,1,Dt,!0),v,r):[]}),b7=st(function(t){var e=C(t,Ki);return e.length&&e[0]===t[0]?ji(e):[]}),w7=st(function(t){var e=we(t),r=C(t,Ki);return e===we(r)?e=v:r.pop(),r.length&&r[0]===t[0]?ji(r,P(e,2)):[]}),C7=st(function(t){var e=we(t),r=C(t,Ki);return e=typeof e=="function"?e:v,e&&r.pop(),r.length&&r[0]===t[0]?ji(r,v,e):[]}),E7=st(_s),A7=Je(function(t,e){var r=t==null?0:t.length,i=Wi(t,e);return Va(t,C(e,function(c){return Pe(c,r)?+c:c}).sort(Fa)),i}),I7=st(function(t){return sr(Gt(t,1,Dt,!0))}),L7=st(function(t){var e=we(t);return Dt(e)&&(e=v),sr(Gt(t,1,Dt,!0),P(e,2))}),x7=st(function(t){var e=we(t);return e=typeof e=="function"?e:v,sr(Gt(t,1,Dt,!0),v,e)}),k7=st(function(t,e){return Dt(t)?vn(t,e):[]}),O7=st(function(t){return Xi(d(t,Dt))}),T7=st(function(t){var e=we(t);return Dt(e)&&(e=v),Xi(d(t,Dt),P(e,2))}),N7=st(function(t){var e=we(t);return e=typeof e=="function"?e:v,Xi(d(t,Dt),v,e)}),M7=st(s1),D7=st(function(t){var e=t.length,r=e>1?t[e-1]:v;return r=typeof r=="function"?(t.pop(),r):v,ms(t,r)}),H7=Je(function(t){var e=t.length,r=e?t[0]:0,i=this.__wrapped__,c=function(h){return Wi(h,t)};return!(e>1||this.__actions__.length)&&i instanceof U&&Pe(r)?(i=i.slice(r,+r+(e?1:0)),i.__actions__.push({func:_o,args:[c],thisArg:v}),new J(i,this.__chain__).thru(function(h){return e&&!h.length&&h.push(v),h})):this.thru(c)}),V7=co(function(t,e,r){mt.call(t,r)?++t[r]:Xe(t,r,1)}),W7=Ka(ds),Z7=Ka(vs),B7=co(function(t,e,r){mt.call(t,r)?t[r].push(e):Xe(t,r,[e])}),j7=st(function(t,e,r){var i=-1,c=typeof e=="function",h=se(t)?Zt(t.length):[];return pr(t,function(g){h[++i]=c?u(e,g,r):gn(g,e,r)}),h}),z7=co(function(t,e,r){Xe(t,r,e)}),U7=co(function(t,e,r){t[r?0:1].push(e)},function(){return[[],[]]}),$7=st(function(t,e){if(t==null)return[];var r=e.length;return r>1&&ie(t,e[0],e[1])?e=[]:r>2&&ie(e[0],e[1],e[2])&&(e=[e[0]]),Da(t,Gt(e,1),[])}),Zo=e7||function(){return Yt.Date.now()},L1=st(function(t,e,r){var i=re;if(r.length){var c=$(r,Yr(L1));i|=ye}return Ke(t,i,e,r,c)}),tc=st(function(t,e,r){var i=re|Ue;if(r.length){var c=$(r,Yr(tc));i|=ye}return Ke(e,i,t,r,c)}),F7=st(function(t,e){return Ea(t,1,e)}),S7=st(function(t,e,r){return Ea(t,Ce(e)||0,r)});Qo.Cache=Ge;var q7=v7(function(t,e){e=e.length==1&&et(e[0])?C(e[0],yt(P())):C(Gt(e,1),yt(P()));var r=e.length;return st(function(i){for(var c=-1,h=Jt(i.length,r);++c<h;)i[c]=e[c].call(this,i[c]);return u(t,this,i)})}),x1=st(function(t,e){return Ke(t,ye,v,e,$(e,Yr(x1)))}),ec=st(function(t,e){return Ke(t,ar,v,e,$(e,Yr(ec)))}),Y7=Je(function(t,e){return Ke(t,ne,v,v,v,e)}),G7=ho(Bi),X7=ho(function(t,e){return t>=e}),Lr=La(function(){return arguments}())?La:function(t){return Tt(t)&&mt.call(t,"callee")&&!Us.call(t,"callee")},et=Zt.isArray,K7=da?yt(da):l2,hr=n7||y1,J7=va?yt(va):f2,rc=ga?yt(ga):h2,k1=ya?yt(ya):d2,nc=_a?yt(_a):v2,tn=ma?yt(ma):g2,P7=ho($i),R7=ho(function(t,e){return t<=e}),td=Sr(function(t,e){if(Qn(e)||se(e))return Ze(e,$t(e),t),v;for(var r in e)mt.call(e,r)&&dn(t,r,e[r])}),oc=Sr(function(t,e){Ze(e,ce(e),t)}),Bo=Sr(function(t,e,r,i){Ze(e,ce(e),t,i)}),ed=Sr(function(t,e,r,i){Ze(e,$t(e),t,i)}),rd=Je(Wi),nd=st(function(t,e){t=At(t);var r=-1,i=e.length,c=i>2?e[2]:v;for(c&&ie(e[0],e[1],c)&&(i=1);++r<i;)for(var h=e[r],g=ce(h),y=-1,b=g.length;++y<b;){var x=g[y],A=t[x];(A===v||Te(A,Kr[x])&&!mt.call(t,x))&&(t[x]=h[x])}return t}),od=st(function(t){return t.push(v,ns),u(ic,v,t)}),id=Pa(function(t,e,r){e!=null&&typeof e.toString!="function"&&(e=xo.call(e)),t[e]=r},p1(le)),ud=Pa(function(t,e,r){e!=null&&typeof e.toString!="function"&&(e=xo.call(e)),mt.call(t,e)?t[e].push(r):t[e]=[r]},P),ad=st(gn),sd=Sr(function(t,e,r){uo(t,e,r)}),ic=Sr(function(t,e,r,i){uo(t,e,r,i)}),cd=Je(function(t,e){var r={};if(t==null)return r;var i=!1;e=C(e,function(h){return h=cr(h,t),i||(i=h.length>1),h}),Ze(t,r1(t),r),i&&(r=Qe(r,qt|Br|Me,H2));for(var c=e.length;c--;)Gi(r,e[c]);return r}),ld=Je(function(t,e){return t==null?{}:m2(t,e)}),uc=es($t),ac=es(ce),fd=qr(function(t,e,r){return e=e.toLowerCase(),t+(r?Ds(e):e)}),pd=qr(function(t,e,r){return t+(r?"-":"")+e.toLowerCase()}),hd=qr(function(t,e,r){return t+(r?" ":"")+e.toLowerCase()}),dd=Xa("toLowerCase"),vd=qr(function(t,e,r){return t+(r?"_":"")+e.toLowerCase()}),gd=qr(function(t,e,r){return t+(r?" ":"")+O1(e)}),yd=qr(function(t,e,r){return t+(r?" ":"")+e.toUpperCase()}),O1=Xa("toUpperCase"),sc=st(function(t,e){try{return u(t,v,e)}catch(r){return c1(r)?r:new _1(r)}}),_d=Je(function(t,e){return l(e,function(r){r=Be(r),Xe(t,r,L1(t[r],t))}),t}),md=Ja(),Qd=Ja(!0),bd=st(function(t,e){return function(r){return gn(r,t,e)}}),wd=st(function(t,e){return function(r){return gn(t,r,e)}}),Cd=Ri(C),Ed=Ri(p),Ad=Ri(T),Id=Ra(),Ld=Ra(!0),xd=fo(function(t,e){return t+e},0),kd=t1("ceil"),Od=fo(function(t,e){return t/e},1),Td=t1("floor"),Nd=fo(function(t,e){return t*e},1),Md=t1("round"),Dd=fo(function(t,e){return t-e},0);return s.after=up,s.ary=Cs,s.assign=td,s.assignIn=oc,s.assignInWith=Bo,s.assignWith=ed,s.at=rd,s.before=Es,s.bind=L1,s.bindAll=_d,s.bindKey=tc,s.castArray=dp,s.chain=Qs,s.chunk=R2,s.compact=t5,s.concat=e5,s.cond=Ih,s.conforms=Lh,s.constant=p1,s.countBy=V7,s.create=Wp,s.curry=As,s.curryRight=Is,s.debounce=Ls,s.defaults=nd,s.defaultsDeep=od,s.defer=F7,s.delay=S7,s.difference=_7,s.differenceBy=m7,s.differenceWith=Q7,s.drop=r5,s.dropRight=n5,s.dropRightWhile=o5,s.dropWhile=i5,s.fill=u5,s.filter=q5,s.flatMap=Y5,s.flatMapDeep=G5,s.flatMapDepth=X5,s.flatten=gs,s.flattenDeep=a5,s.flattenDepth=s5,s.flip=ap,s.flow=md,s.flowRight=Qd,s.fromPairs=c5,s.functions=Fp,s.functionsIn=Sp,s.groupBy=B7,s.initial=f5,s.intersection=b7,s.intersectionBy=w7,s.intersectionWith=C7,s.invert=id,s.invertBy=ud,s.invokeMap=j7,s.iteratee=h1,s.keyBy=z7,s.keys=$t,s.keysIn=ce,s.map=mo,s.mapKeys=Yp,s.mapValues=Gp,s.matches=kh,s.matchesProperty=Oh,s.memoize=Qo,s.merge=sd,s.mergeWith=ic,s.method=bd,s.methodOf=wd,s.mixin=d1,s.negate=bo,s.nthArg=Nh,s.omit=cd,s.omitBy=Xp,s.once=sp,s.orderBy=J5,s.over=Cd,s.overArgs=q7,s.overEvery=Ed,s.overSome=Ad,s.partial=x1,s.partialRight=ec,s.partition=U7,s.pick=ld,s.pickBy=Ms,s.property=Ws,s.propertyOf=Mh,s.pull=E7,s.pullAll=_s,s.pullAllBy=v5,s.pullAllWith=g5,s.pullAt=A7,s.range=Id,s.rangeRight=Ld,s.rearg=Y7,s.reject=tp,s.remove=y5,s.rest=cp,s.reverse=a1,s.sampleSize=rp,s.set=Jp,s.setWith=Pp,s.shuffle=np,s.slice=_5,s.sortBy=$7,s.sortedUniq=A5,s.sortedUniqBy=I5,s.split=gh,s.spread=lp,s.tail=L5,s.take=x5,s.takeRight=k5,s.takeRightWhile=O5,s.takeWhile=T5,s.tap=W5,s.throttle=fp,s.thru=_o,s.toArray=Os,s.toPairs=uc,s.toPairsIn=ac,s.toPath=Zh,s.toPlainObject=Ns,s.transform=Rp,s.unary=pp,s.union=I7,s.unionBy=L7,s.unionWith=x7,s.uniq=N5,s.uniqBy=M5,s.uniqWith=D5,s.unset=th,s.unzip=s1,s.unzipWith=ms,s.update=eh,s.updateWith=rh,s.values=Gr,s.valuesIn=nh,s.without=k7,s.words=Vs,s.wrap=hp,s.xor=O7,s.xorBy=T7,s.xorWith=N7,s.zip=M7,s.zipObject=H5,s.zipObjectDeep=V5,s.zipWith=D7,s.entries=uc,s.entriesIn=ac,s.extend=oc,s.extendWith=Bo,d1(s,s),s.add=xd,s.attempt=sc,s.camelCase=fd,s.capitalize=Ds,s.ceil=kd,s.clamp=oh,s.clone=vp,s.cloneDeep=yp,s.cloneDeepWith=_p,s.cloneWith=gp,s.conformsTo=mp,s.deburr=Hs,s.defaultTo=xh,s.divide=Od,s.endsWith=ah,s.eq=Te,s.escape=sh,s.escapeRegExp=ch,s.every=S5,s.find=W7,s.findIndex=ds,s.findKey=Zp,s.findLast=Z7,s.findLastIndex=vs,s.findLastKey=Bp,s.floor=Td,s.forEach=bs,s.forEachRight=ws,s.forIn=jp,s.forInRight=zp,s.forOwn=Up,s.forOwnRight=$p,s.get=l1,s.gt=G7,s.gte=X7,s.has=qp,s.hasIn=f1,s.head=ys,s.identity=le,s.includes=K5,s.indexOf=l5,s.inRange=ih,s.invoke=ad,s.isArguments=Lr,s.isArray=et,s.isArrayBuffer=K7,s.isArrayLike=se,s.isArrayLikeObject=Dt,s.isBoolean=Qp,s.isBuffer=hr,s.isDate=J7,s.isElement=bp,s.isEmpty=wp,s.isEqual=Cp,s.isEqualWith=Ep,s.isError=c1,s.isFinite=Ap,s.isFunction=Re,s.isInteger=xs,s.isLength=wo,s.isMap=rc,s.isMatch=Ip,s.isMatchWith=Lp,s.isNaN=xp,s.isNative=kp,s.isNil=Tp,s.isNull=Op,s.isNumber=ks,s.isObject=xt,s.isObjectLike=Tt,s.isPlainObject=bn,s.isRegExp=k1,s.isSafeInteger=Np,s.isSet=nc,s.isString=Co,s.isSymbol=de,s.isTypedArray=tn,s.isUndefined=Mp,s.isWeakMap=Dp,s.isWeakSet=Hp,s.join=p5,s.kebabCase=pd,s.last=we,s.lastIndexOf=h5,s.lowerCase=hd,s.lowerFirst=dd,s.lt=P7,s.lte=R7,s.max=jh,s.maxBy=zh,s.mean=Uh,s.meanBy=$h,s.min=Fh,s.minBy=Sh,s.stubArray=g1,s.stubFalse=y1,s.stubObject=Dh,s.stubString=Hh,s.stubTrue=Vh,s.multiply=Nd,s.nth=d5,s.noConflict=Th,s.noop=v1,s.now=Zo,s.pad=lh,s.padEnd=fh,s.padStart=ph,s.parseInt=hh,s.random=uh,s.reduce=P5,s.reduceRight=R5,s.repeat=dh,s.replace=vh,s.result=Kp,s.round=Md,s.runInContext=m,s.sample=ep,s.size=op,s.snakeCase=vd,s.some=ip,s.sortedIndex=m5,s.sortedIndexBy=Q5,s.sortedIndexOf=b5,s.sortedLastIndex=w5,s.sortedLastIndexBy=C5,s.sortedLastIndexOf=E5,s.startCase=gd,s.startsWith=yh,s.subtract=Dd,s.sum=qh,s.sumBy=Yh,s.template=_h,s.times=Wh,s.toFinite=tr,s.toInteger=it,s.toLength=Ts,s.toLower=mh,s.toNumber=Ce,s.toSafeInteger=Vp,s.toString=_t,s.toUpper=Qh,s.trim=bh,s.trimEnd=wh,s.trimStart=Ch,s.truncate=Eh,s.unescape=Ah,s.uniqueId=Bh,s.upperCase=yd,s.upperFirst=O1,s.each=bs,s.eachRight=ws,s.first=ys,d1(s,function(){var t={};return We(s,function(e,r){mt.call(s.prototype,r)||(t[r]=e)}),t}(),{chain:!1}),s.VERSION=si,l(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){s[t].placeholder=s}),l(["drop","take"],function(t,e){U.prototype[t]=function(r){r=r===v?1:Bt(it(r),0);var i=this.__filtered__&&!e?new U(this):this.clone();return i.__filtered__?i.__takeCount__=Jt(r,i.__takeCount__):i.__views__.push({size:Jt(r,_e),type:t+(i.__dir__<0?"Right":"")}),i},U.prototype[t+"Right"]=function(r){return this.reverse()[t](r).reverse()}}),l(["filter","map","takeWhile"],function(t,e){var r=e+1,i=r==He||r==yr;U.prototype[t]=function(c){var h=this.clone();return h.__iteratees__.push({iteratee:P(c,3),type:r}),h.__filtered__=h.__filtered__||i,h}}),l(["head","last"],function(t,e){var r="take"+(e?"Right":"");U.prototype[t]=function(){return this[r](1).value()[0]}}),l(["initial","tail"],function(t,e){var r="drop"+(e?"":"Right");U.prototype[t]=function(){return this.__filtered__?new U(this):this[r](1)}}),U.prototype.compact=function(){return this.filter(le)},U.prototype.find=function(t){return this.filter(t).head()},U.prototype.findLast=function(t){return this.reverse().find(t)},U.prototype.invokeMap=st(function(t,e){return typeof t=="function"?new U(this):this.map(function(r){return gn(r,t,e)})}),U.prototype.reject=function(t){return this.filter(bo(P(t)))},U.prototype.slice=function(t,e){t=it(t);var r=this;return r.__filtered__&&(t>0||e<0)?new U(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==v&&(e=it(e),r=e<0?r.dropRight(-e):r.take(e-t)),r)},U.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},U.prototype.toArray=function(){return this.take(_e)},We(U.prototype,function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),c=s[i?"take"+(e=="last"?"Right":""):e],h=i||/^find/.test(e);c&&(s.prototype[e]=function(){var g=this.__wrapped__,y=i?[1]:arguments,b=g instanceof U,x=y[0],A=b||et(g),O=function(ct){var lt=c.apply(s,k([ct],y));return i&&V?lt[0]:lt};A&&r&&typeof x=="function"&&x.length!=1&&(b=A=!1);var V=this.__chain__,S=!!this.__actions__.length,X=h&&!V,ot=b&&!S;if(!h&&A){g=ot?g:new U(this);var K=t.apply(g,y);return K.__actions__.push({func:_o,args:[O],thisArg:v}),new J(K,V)}return X&&ot?t.apply(this,y):(K=this.thru(O),X?i?K.value()[0]:K.value():K)})}),l(["pop","push","shift","sort","splice","unshift"],function(t){var e=Ao[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);s.prototype[t]=function(){var c=arguments;if(i&&!this.__chain__){var h=this.value();return e.apply(et(h)?h:[],c)}return this[r](function(g){return e.apply(et(g)?g:[],c)})}}),We(U.prototype,function(t,e){var r=s[e];if(r){var i=r.name+"";mt.call(Pr,i)||(Pr[i]=[]),Pr[i].push({name:e,func:r})}}),Pr[lo(v,Ue).name]=[{name:"wrapper",func:v}],U.prototype.clone=ue,U.prototype.reverse=Hi,U.prototype.value=O3,s.prototype.at=H7,s.prototype.chain=Z5,s.prototype.commit=B5,s.prototype.next=j5,s.prototype.plant=U5,s.prototype.reverse=$5,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=F5,s.prototype.first=s.prototype.head,wn&&(s.prototype[wn]=z5),s},Fr=k3();mr?((mr.exports=Fr)._=Fr,Mi._=Fr):Yt._=Fr}).call(nn)}(kn,kn.exports);var dc=kn.exports,W1={};(function(n){n.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},n.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},n.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},n.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},n.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},n.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},n.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},n.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},n.realToAlias=function(){var o=Object.prototype.hasOwnProperty,u=n.aliasToReal,a={};for(var l in u){var f=u[l];o.call(a,f)?a[f].push(l):a[f]=[l]}return a}(),n.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},n.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},n.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}})(W1);var vc={},Ht=W1,gc=vc,Z1=Array.prototype.push;function yc(n,o){return o==2?function(u,a){return n.apply(void 0,arguments)}:function(u){return n.apply(void 0,arguments)}}function zo(n,o){return o==2?function(u,a){return n(u,a)}:function(u){return n(u)}}function B1(n){for(var o=n?n.length:0,u=Array(o);o--;)u[o]=n[o];return u}function _c(n){return function(o){return n({},o)}}function mc(n,o){return function(){for(var u=arguments.length,a=u-1,l=Array(u);u--;)l[u]=arguments[u];var f=l[o],p=l.slice(0,o);return f&&Z1.apply(p,f),o!=a&&Z1.apply(p,l.slice(o+1)),n.apply(this,p)}}function Uo(n,o){return function(){var u=arguments.length;if(u){for(var a=Array(u);u--;)a[u]=arguments[u];var l=a[0]=o.apply(void 0,a);return n.apply(void 0,a),l}}}function $o(n,o,u,a){var l=typeof o=="function",f=o===Object(o);if(f&&(a=u,u=o,o=void 0),u==null)throw new TypeError;a||(a={});var p={cap:"cap"in a?a.cap:!0,curry:"curry"in a?a.curry:!0,fixed:"fixed"in a?a.fixed:!0,immutable:"immutable"in a?a.immutable:!0,rearg:"rearg"in a?a.rearg:!0},d=l?u:gc,Q="curry"in a&&a.curry,w="fixed"in a&&a.fixed,C="rearg"in a&&a.rearg,k=l?u.runInContext():void 0,N=l?u:{ary:n.ary,assign:n.assign,clone:n.clone,curry:n.curry,forEach:n.forEach,isArray:n.isArray,isError:n.isError,isFunction:n.isFunction,isWeakMap:n.isWeakMap,iteratee:n.iteratee,keys:n.keys,rearg:n.rearg,toInteger:n.toInteger,toPath:n.toPath},D=N.ary,T=N.assign,W=N.clone,H=N.curry,q=N.forEach,tt=N.isArray,F=N.isError,rt=N.isFunction,pt=N.isWeakMap,dt=N.keys,vt=N.rearg,gt=N.toInteger,Z=N.toPath,G=dt(Ht.aryMethod),B={castArray:function(Y){return function(){var M=arguments[0];return tt(M)?Y(B1(M)):Y.apply(void 0,arguments)}},iteratee:function(Y){return function(){var M=arguments[0],z=arguments[1],$=Y(M,z),nt=$.length;return p.cap&&typeof z=="number"?(z=z>2?z-2:1,nt&&nt<=z?$:zo($,z)):$}},mixin:function(Y){return function(M){var z=this;if(!rt(z))return Y(z,Object(M));var $=[];return q(dt(M),function(nt){rt(M[nt])&&$.push([nt,z.prototype[nt]])}),Y(z,Object(M)),q($,function(nt){var Vt=nt[1];rt(Vt)?z.prototype[nt[0]]=Vt:delete z.prototype[nt[0]]}),z}},nthArg:function(Y){return function(M){var z=M<0?1:gt(M)+1;return H(Y(M),z)}},rearg:function(Y){return function(M,z){var $=z?z.length:0;return H(Y(M,z),$)}},runInContext:function(Y){return function(M){return $o(n,Y(M),a)}}};function ut(Y,M){if(p.cap){var z=Ht.iterateeRearg[Y];if(z)return It(M,z);var $=!l&&Ht.iterateeAry[Y];if($)return ve(M,$)}return M}function R(Y,M,z){return Q||p.curry&&z>1?H(M,z):M}function at(Y,M,z){if(p.fixed&&(w||!Ht.skipFixed[Y])){var $=Ht.methodSpread[Y],nt=$&&$.start;return nt===void 0?D(M,z):mc(M,nt)}return M}function yt(Y,M,z){return p.rearg&&z>1&&(C||!Ht.skipRearg[Y])?vt(M,Ht.methodRearg[Y]||Ht.aryRearg[z]):M}function Mt(Y,M){M=Z(M);for(var z=-1,$=M.length,nt=$-1,Vt=W(Object(Y)),Ut=Vt;Ut!=null&&++z<$;){var St=M[z],Wt=Ut[St];Wt!=null&&!(rt(Wt)||F(Wt)||pt(Wt))&&(Ut[St]=W(z==nt?Wt:Object(Wt))),Ut=Ut[St]}return Vt}function Qt(Y){return kt.runInContext.convert(Y)(void 0)}function bt(Y,M){var z=Ht.aliasToReal[Y]||Y,$=Ht.remap[z]||z,nt=a;return function(Vt){var Ut=l?k:N,St=l?k[$]:M,Wt=T(T({},nt),Vt);return $o(Ut,z,St,Wt)}}function ve(Y,M){return ee(Y,function(z){return typeof z=="function"?zo(z,M):z})}function It(Y,M){return ee(Y,function(z){var $=M.length;return yc(vt(zo(z,$),M),$)})}function ee(Y,M){return function(){var z=arguments.length;if(!z)return Y();for(var $=Array(z);z--;)$[z]=arguments[z];var nt=p.rearg?0:z-1;return $[nt]=M($[nt]),Y.apply(void 0,$)}}function Xt(Y,M,z){var $,nt=Ht.aliasToReal[Y]||Y,Vt=M,Ut=B[nt];return Ut?Vt=Ut(M):p.immutable&&(Ht.mutate.array[nt]?Vt=Uo(M,B1):Ht.mutate.object[nt]?Vt=Uo(M,_c(M)):Ht.mutate.set[nt]&&(Vt=Uo(M,Mt))),q(G,function(St){return q(Ht.aryMethod[St],function(Wt){if(nt==Wt){var Kt=Ht.methodSpread[nt],or=Kt&&Kt.afterRearg;return $=or?at(nt,yt(nt,Vt,St),St):yt(nt,at(nt,Vt,St),St),$=ut(nt,$),$=R(nt,$,St),!1}}),!$}),$||($=Vt),$==M&&($=Q?H($,1):function(){return M.apply(this,arguments)}),$.convert=bt(nt,M),$.placeholder=M.placeholder=z,$}if(!f)return Xt(o,u,d);var kt=u,Ne=[];return q(G,function(Y){q(Ht.aryMethod[Y],function(M){var z=kt[Ht.remap[M]||M];z&&Ne.push([M,Xt(M,z,kt)])})}),q(dt(kt),function(Y){var M=kt[Y];if(typeof M=="function"){for(var z=Ne.length;z--;)if(Ne[z][0]==Y)return;M.convert=bt(Y,M),Ne.push([Y,M])}}),q(Ne,function(Y){kt[Y[0]]=Y[1]}),kt.convert=Qt,kt.placeholder=kt,q(dt(kt),function(Y){q(Ht.realToAlias[Y]||[],function(M){kt[M]=kt[Y]})}),kt}var Qc=$o,j1=dc.runInContext(),bc=Qc(j1,j1);const L=hc(bc),wc=/(<([^>]+)>)/gi,Cc=/<(\/)?div(\/?\s?)>/gi,Ec=n=>n.map(o=>`<div>${o===""?"<br/>":o}</div>`).join(""),Ac=n=>{const o=document.createElement("textarea");return o.innerHTML=n,o.value},Ic=n=>L.flow(o=>Ac(o),o=>o.split("<div>"),L.flatMap(o=>{const u=o.replaceAll(Cc,"");return u===""?void 0:u.replaceAll(wc,"")}),L.reject(L.isUndefined))(n),Fo=n=>n*180/Math.PI,On=(n,o)=>o[0]>=n.x&&o[0]<=n.x+n.width&&o[1]>=n.y&&o[1]<=n.y+n.height,je=({origin:n=[0,0],point:o,rotation:u})=>{const a=[o[0]-n[0],o[1]-n[1]],l=a[1]*Math.cos(u)-a[0]*Math.sin(u);return[a[1]*Math.sin(u)+a[0]*Math.cos(u)+n[0],l+n[1]]},z1=n=>(n+2*Math.PI)%(2*Math.PI),U1=({targetVector:[n,o],radian:u=!0,originVector:a})=>{const l=z1(Math.atan2(o[1]-n[1],o[0]-n[0]));if(a){const[f,p]=a,d=Math.atan2(p[1]-f[1],p[0]-f[0]),Q=z1(l-d);return u?Q:Fo(Q)}return u?l:Fo(l)},Tn=n=>{const o=new Path2D;return o.rect(n.x,n.y,n.width,n.height),o},Nn=n=>{const o=new Path2D;return o.arc(n.x,n.y,n.radius,0,2*Math.PI),o},Lc=n=>{const o=new Path2D;return o.ellipse(n.x,n.y,n.radiusX,n.radiusY,0,0,2*Math.PI),o},$1=n=>{const o=new Path2D;return o.moveTo(...n.points[0]),o.lineTo(...n.points[1]),o},xc=n=>{if(n.points.length<3)return;const o=new Path2D;o.moveTo(...n.points[0]);for(let u=1;u<n.points.length-1;u++)o.quadraticCurveTo(...n.points[u],n.points.length-2===u?n.points[u+1][0]:(n.points[u+1][0]-n.points[u][0])/2+n.points[u][0],n.points.length-2===u?n.points[u+1][1]:(n.points[u+1][1]-n.points[u][1])/2+n.points[u][1]);return o},kc=n=>{if(n.points.length<1)return;const o=new Path2D;return o.moveTo(...n.points[0]),n.points.slice(1).forEach(u=>{o.lineTo(...u)}),o.lineTo(...n.points[0]),o},Oc=n=>{const o=new Path2D;return o.moveTo(...n.points[0]),o.lineTo(...n.points[1]),o.lineTo(...n.points[2]),o.lineTo(...n.points[0]),o},kr=(n,o,u)=>{const{borders:a}=zt(n,u);return{border:Tn(a),line:$1({points:[[a.x+a.width/2,a.y],[a.x+a.width/2,a.y-14/2-16/o]]}),anchors:[Nn({x:a.x+a.width/2,y:a.y-14/2-16/o,radius:14/2/o}),...N1.map(l=>Nn({x:a.x+a.width*l[0],y:a.y+a.height*l[1],radius:14/2/o}))]}},Tc=(n,o,u,a,l,f)=>{if(o.selection&&(xr(n,{fillColor:"transparent",strokeColor:u,lineWidth:a/l}),n.stroke(o.selection.border),!(!f||o.locked))){n.stroke(o.selection.line),xr(n,{fillColor:"rgb(255,255,255)",strokeColor:"rgb(150,150,150)",lineWidth:2/l});for(const p of o.selection.anchors)n.fill(p),n.stroke(p)}},F1=({borderStart:n,borderSize:o,vector:u,selectionPadding:a,invertedAxe:l,anchor:f})=>{switch(f){case 0:if(l){const p=o-2*a;return[n+p,u-p]}else{const p=Math.max(2*a,o-u);return[n+o-p,p]}case .5:return[n,o];case 1:if(l){const p=o+u;return[n+p,2*a-p]}else return[n,Math.max(2*a,o+u)];default:return[0,0]}},Nc=(n,o,u,a,l,f,p,d,Q,w)=>{const C=(o.width-w*2||1)/(o.height-w*2||1),k=(l-w*2)/(p-w*2);let N,D,T,W;return Q.anchor[0]!==.5&&Q.anchor[1]!==.5?k<C?(D=f,W=p,T=(p-w*2)*C+2*w,Q.anchor[0]===0?N=o.width-n[0]>w?o.x+(o.width-T):o.x+o.width-2*w:N=o.width+n[0]>w?o.x:o.x-T+2*w):(N=a,T=l,W=(l-w*2)/C+2*w,Q.anchor[1]===0?D=o.height-n[1]>w?o.y+(o.height-W):o.y+o.height-2*w:D=o.height+n[1]>w?o.y:o.y-W+2*w):Q.anchor[0]!==.5?(N=a,T=l,W=(l-w*2)/C+2*w,D=o.y+(o.height-W)/2):(D=f,W=p,T=(p-w*2)*C+2*w,N=o.x+(o.width-T)/2),{borderX:N,borderWidth:T,borderY:D,borderHeight:W,center:u,originalShape:d}},S1=({borderX:n,borderWidth:o,borderY:u,borderHeight:a,center:l,originalShape:f})=>{const p=[n+o/2-l[0],u+a/2-l[1]],[d,Q]=je({point:p,rotation:-f.rotation});return{borderX:nr(n+d-p[0]),borderWidth:nr(o),borderY:nr(u+Q-p[1]),borderHeight:nr(a)}},Mn=(n,o,u,a,l,f=!1)=>{const{center:p,borders:d}=zt(o,l),Q=je({origin:p,point:n,rotation:o.rotation}),w=u.anchor[0]===0&&Q[0]>=d.x+d.width||u.anchor[0]===1&&Q[0]<=d.x,C=u.anchor[1]===0&&Q[1]>=d.y+d.height||u.anchor[1]===1&&Q[1]<=d.y,k=[ht(Q[0],a,u.anchor[0]===0&&!w||u.anchor[0]===1&&w?l:-l),ht(Q[1],a,u.anchor[1]===0&&!C||u.anchor[1]===1&&C?l:-l)],N=a?[u.anchor[0]===0?d.x:u.anchor[0]===.5?d.x+d.width/2:d.x+d.width,u.anchor[1]===0?d.y:u.anchor[1]===.5?d.y+d.height/2:d.y+d.height]:je({origin:p,point:u.cursorStartPosition,rotation:o.rotation}),D=[k[0]-N[0],k[1]-N[1]],[T,W]=F1({borderStart:d.x,borderSize:d.width,vector:D[0],selectionPadding:l,invertedAxe:w,anchor:u.anchor[0]}),[H,q]=F1({borderStart:d.y,borderSize:d.height,vector:D[1],selectionPadding:l,invertedAxe:C,anchor:u.anchor[1]});if(f){const tt=Nc(D,d,p,T,W,H,q,o,u,l);return S1(tt)}return S1({borderX:T,borderWidth:W,borderY:H,borderHeight:q,center:p,originalShape:o})},Dn=(n,o,u,a=1,l=1)=>[o+(n[0]-o)*a,u+(n[1]-u)*l],Mc=n=>{if(n.points.length<1||n.style?.strokeColor==="transparent")return;const o=n.points.flat(),u=o.map(d=>d[0]),a=o.map(d=>d[1]),l=Math.min(...u),f=Math.min(...a),p=new Path2D;return n.points.forEach(d=>{d.length===1?p.rect(...Dn(d[0],l,f,n.scaleX,n.scaleY),1,1):(p.moveTo(...Dn(d[0],l,f,n.scaleX,n.scaleY)),d.slice(1).forEach(Q=>{p.lineTo(...Dn(Q,l,f,n.scaleX,n.scaleY))}))}),p},Or=(n,o,u)=>({...n,path:Mc(n),selection:kr(n,o,u)}),Dc=Or,Hc=(n,o,u,a)=>Or({toolId:n.id,type:n.type,id:L.uniqueId(`${n.type}_`),points:[[o]],rotation:0,scaleX:1,scaleY:1,style:{globalAlpha:n.settings.opacity.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default}},u,a),Vc=(n,o)=>{o.points.length<1||!o.path||n.globalAlpha!==0&&(o.style?.strokeColor==="transparent"||n.globalAlpha===0||n.stroke(o.path))},Wc=(n,o)=>{const u=n.points.flat(),a=Math.min(...u.map(Q=>Q[0])),l=Math.min(...u.map(Q=>Q[1])),f=u.map(Q=>Dn(Q,a,l,n.scaleX,n.scaleY)),p=Math.max(...f.map(Q=>Q[0]))+o,d=Math.max(...f.map(Q=>Q[1]))+o;return{x:a-o,width:p-a+o,y:l-o,height:d-l+o}},Zc=(n,o,u,a,l,f)=>{const{borders:p}=zt(o,f),d=a?ht(p.x+n[0]-u[0],a)-p.x:n[0]-u[0],Q=a?ht(p.y+n[1]-u[1],a)-p.y:n[1]-u[1];return Or({...o,points:o.points.map(w=>w.map(([C,k])=>[C+d,k+Q]))},l,f)},Bc=(n,o,u,a,l,f,p)=>{const{borders:d}=zt({...o,scaleX:1,scaleY:1},l),{borders:Q}=zt(o,l),{borderX:w,borderHeight:C,borderY:k,borderWidth:N}=Mn(n,o,u,a,l,p),D=Math.max(0,d.width-2*l),T=Math.max(0,d.height-2*l),W=Math.max(0,N-2*l),H=Math.max(0,C-2*l),q=W/D,tt=H/T,F=nr(w-Q.x),rt=nr(k-Q.y);return Or({...o,points:o.points.map(pt=>pt.map(([dt,vt])=>[dt+F,vt+rt])),scaleX:q,scaleY:tt},f,l)},jc=(n,o,u,a)=>{const l={...n,points:L.set(n.points.length-1,[...n.points[n.points.length-1],[Math.round(o[0]),Math.round(o[1])]],n.points)};return Or(l,u,a)},zc=(n,o,u,a)=>{const l={...n,points:L.set(n.points.length,[[Math.round(o[0]),Math.round(o[1])]],n.points)};return Or(l,u,a)},rr=300,nr=(n,o=2)=>Math.round(n*10**o)/10**o,ht=(n,o,u=0)=>{if(!o)return nr(n);const a=n+u,l=a>=0?vr[o-1]:-vr[o-1];return a+l/2-(a+l/2)%l-u},Uc=(n,o,u=0)=>o?n+Math.PI/jo/2-(n+Math.PI/jo/2)%(Math.PI/jo):nr(n,3),$c=(n,o,u,a,l,f,p,d,Q)=>{switch(f.mode){case"brush":return jc(o,u,Q,p);case"translate":return ri(u,f.originalShape,f.cursorStartPosition,a,Q,p);case"rotate":return Nf(o,u,f.originalShape,f.cursorStartPosition,f.center,a);case"resize":return Mf(n,o,u,l,f.originalShape,f,a,p,d,Q);default:return o}},Fc=(n,o,u,a,l=!1)=>{if(!n||!o||!a||!u)return[rr,rr];const f=n/o,p=u/a;if(f>p){const d=l?u:Math.min(n,u);return[d,d/f]}else{const d=l?a:Math.min(o,a);return[d*f,d]}},Hn=(n,o,u,a,l=1)=>{const{clientX:f=0,clientY:p=0}="touches"in n&&n.touches[0]?n.touches[0]:"changedTouches"in n&&n.changedTouches[0]?n.changedTouches[0]:"clientX"in n?n:{},d=o?.getBoundingClientRect()??{left:0,top:0,width:u,height:a};return[(f-d.left)*(u/d.width)/l,(p-d.top)*(a/d.height)/l]},Vn=(n,o,[u,a],[l,f])=>je({origin:[u-l,a-f],point:n,rotation:o}),Sc=(n,o,[u,a],[l,f])=>je({origin:[u-l,a-f],point:n,rotation:-o}),Wn=(n,o,u,a,l=1,f=!1)=>{if(n.locked)return!1;const p=Math.min(1,l),{borders:d,center:Q}=zt(n,a),w=Vn(o,n.rotation,Q,u);if(f)if(n.type==="line"||n.type==="polygon"||n.type==="curve"){for(let C=0;C<n.points.length;C++)if(On({x:n.points[C][0]-14/2/p,y:n.points[C][1]-14/2/p,width:14/p,height:14/p},w))return{mode:"resize",anchor:C}}else{if(On({x:d.x+d.width/2-14/2/p,y:d.y-14/p-16/p,width:14/p,height:14/p},w))return{mode:"rotate"};for(const C of N1)if(On({x:d.x+d.width*C[0]-14/2/p,y:d.y+d.height*C[1]-14/2/p,width:14/p,height:14/p},w))return{mode:"resize",anchor:C}}return On(d,w)?{mode:"translate"}:!1},qc=n=>({...n,path:Oc(n)}),q1=n=>{const o={...n,type:"triangle"};return qc(o)},Yc=(n,o)=>{n.globalAlpha!==0&&o.path&&(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},So=(n,o,u,a=!1)=>{const{borders:l}=zt(n,u);return{border:Tn(l),anchors:[...n.points.map((f,p)=>a&&p>0&&p<n.points.length-1?Tn({x:f[0]-14/2,y:f[1]-14/2,width:14/o,height:14/o}):Nn({x:f[0],y:f[1],radius:14/2/o}))]}},Gc=({ctx:n,shape:o,withAnchors:u,selectionWidth:a,selectionColor:l,currentScale:f=1})=>{if(o.selection&&(xr(n,{fillColor:"transparent",strokeColor:l,lineWidth:a/f}),n.stroke(o.selection.border),!(!u||o.locked))){xr(n,{fillColor:"rgb(255,255,255)",strokeColor:"rgb(150,150,150)",lineWidth:2/f});for(const p of o.selection.anchors)n.fill(p),n.stroke(p)}},Zn=(n,o,u)=>{const a=L.flow(l=>{if(n.style?.lineArrow===1||n.style?.lineArrow===3){const f=Math.PI/2-U1({targetVector:[n.points[0],n.points[1]]});return[...l,q1(Y1(n.points[0],f,n.style))]}return l},l=>{if(n.style?.lineArrow===2||n.style?.lineArrow===3){const f=Math.PI/2-U1({targetVector:[n.points[1],n.points[0]]});return[...l,q1(Y1(n.points[1],f,n.style))]}return l})([]);return{...n,path:$1(n),selection:So(n,o,u),arrows:a}},Xc=Zn,Kc=(n,o,u,a)=>{const l={toolId:n.id,type:n.type,id:L.uniqueId(`${n.type}_`),points:[o,o],rotation:0,style:{globalAlpha:n.settings.opacity.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default,lineArrow:n.settings.lineArrow.default}};return Zn(l,u,a)},Y1=(n,o,u)=>{const a=[je({point:[0,-(10+(u.lineWidth??0)*1)],rotation:o}),je({point:[-(5+(u.lineWidth??0)*1),5+(u.lineWidth??0)*2],rotation:o}),je({point:[5+(u.lineWidth??0)*1,5+(u.lineWidth??0)*2],rotation:o})];return{points:[[n[0]+a[0][0],n[1]+a[0][1]],[n[0]+a[1][0],n[1]+a[1][1]],[n[0]+a[2][0],n[1]+a[2][1]]],style:{...u,fillColor:u.strokeColor,strokeColor:"transparent"}}},Jc=(n,o)=>{if(!(n.globalAlpha===0||!o.path)){o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path);for(const u of o.arrows??[])xr(n,u.style),Yc(n,u)}},Pc=(n,o)=>{const u=Math.min(n.points[0][0],n.points[1][0])-o,a=Math.abs(n.points[0][0]-n.points[1][0])+o*2,l=Math.min(n.points[0][1],n.points[1][1])-o,f=Math.abs(n.points[0][1]-n.points[1][1])+o*2;return{x:u,width:a,y:l,height:f}},Rc=(n,o,u,a,l,f)=>Zn({...o,points:o.points.map(([p,d])=>[ht(p+n[0]-u[0],a),ht(d+n[1]-u[1],a)])},l,f),tl=(n,o,u,a,l,f,p)=>{const d=[ht(n[0],l),ht(n[1],l)],{center:Q}=zt(u,f),w=Vn(d,u.rotation,Q,o),C=L.set(["points",a.anchor],w,u);return Zn(C,p,f)},Tr=(n,o,u)=>({...n,path:kc(n),selection:So(n,o,u)}),el=Tr,rl=(n,o,u,a)=>Tr({toolId:n.id,type:n.type,id:L.uniqueId(`${n.type}_`),points:L.flow(L.range(0),L.map(()=>o))(n.settings.pointsCount.default),rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default,pointsCount:n.settings.pointsCount.default}},u,a),nl=(n,o)=>{o.path&&n.globalAlpha!==0&&(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},G1=(n,o)=>{const u=L.flow(L.map(p=>p[0]),L.min,L.add(-o))(n.points),a=L.flow(L.map(p=>p[0]),L.max,L.add(o))(n.points),l=L.flow(L.map(p=>p[1]),L.min,L.add(-o))(n.points),f=L.flow(L.map(p=>p[1]),L.max,L.add(o))(n.points);return{x:u,width:a-u,y:l,height:f-l}},ol=(n,o,u,a,l,f)=>{if(a){const{borders:p}=zt(o,f),d=ht(p.x+n[0]-u[0],a)-p.x,Q=ht(p.y+n[1]-u[1],a)-p.y;return{...o,points:o.points.map(([w,C])=>[w+d,C+Q])}}else return Tr({...o,points:o.points.map(([p,d])=>[ht(p+n[0]-u[0],a),ht(d+n[1]-u[1],a)])},l,f)},il=(n,o,u,a,l,f,p)=>{const d=[ht(n[0],l),ht(n[1],l)],{center:Q}=zt(u,f),w=Vn(d,u.rotation,Q,o),C=L.set(["points",a.anchor],w,u);return Tr(C,p,f)},ul=(n,o,u,a)=>{const l=n.points.length;if(l===o)return n;if(l>o){const f=n.points.slice(0,o);return Tr({...n,points:f,style:{...n.style,pointsCount:f.length}},u,a)}else{const f=o-l,p=L.flow(L.range(0),L.map(Q=>[n.points[0][0]+(n.points[1][0]-n.points[0][0])*(Q+1)/(f+1),n.points[0][1]+(n.points[1][1]-n.points[0][1])*(Q+1)/(f+1)]))(f),d=[n.points[0],...p,...n.points.slice(1,n.points.length)];return Tr({...n,points:d,style:{...n.style,pointsCount:d.length}},u,a)}},Bn=(n,o,u)=>({...n,path:xc(n),selection:So(n,o,u,!0)}),al=Bn,sl=(n,o,u,a)=>Bn({toolId:n.id,type:n.type,id:L.uniqueId(`${n.type}_`),points:L.flow(L.range(0),L.map(()=>o))(n.settings.pointsCount.default),rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default,pointsCount:n.settings.pointsCount.default}},u,a),cl=(n,o,u,a,l,f,p)=>{const d=[ht(n[0],l),ht(n[1],l)],{center:Q}=zt(u,f),w=Vn(d,u.rotation,Q,o),C=L.set(["points",a.anchor],w,u);return Bn(C,p,f)},ll=(n,o)=>{o.path&&n.globalAlpha!==0&&(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},fl=G1,pl=(n,o,u,a,l,f)=>{const{borders:p}=zt(o,f);return Bn({...o,points:o.points.map(([d,Q])=>a?[d+ht(p.x+n[0]-u[0],a)-p.x,Q+ht(p.y+n[1]-u[1],a)-p.y]:[ht(d+n[0]-u[0],a),ht(Q+n[1]-u[1],a)])},l,f)},jn=(n,o,u)=>({...n,path:Tn(n),selection:kr(n,o,u)}),hl=jn,dl=(n,o,u,a)=>{const l={toolId:n.id,type:n.type,id:L.uniqueId(`${n.type}_`),x:o[0],y:o[1],width:0,height:0,rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default}};return jn(l,u,a)},X1=(n,o)=>{n.globalAlpha===0||!o.path||(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},K1=(n,o)=>({x:n.x-o,width:n.width+o*2,y:n.y-o,height:n.height+o*2}),J1=(n,o,u,a,[l,f]=[!1,!1])=>{const p=n[0]===.5?u.x+u.width/2:n[0]===0?u.x+(l?0:u.width):u.x+(l?u.width:0),d=n[1]===.5?u.y+u.height/2:n[1]===0?u.y+(f?0:u.height):u.y+(f?u.height:0);return Sc([p,d],u.rotation,o,a)},vl=(n,o,u,a,l,f)=>jn({...o,x:ht(o.x+n[0]-u[0],a),y:ht(o.y+n[1]-u[1],a)},l,f),qo=(n,o,u,a,l,f,p=!1)=>{const{borderX:d,borderHeight:Q,borderY:w,borderWidth:C}=Mn(n,o,u,a,l,p);return jn({...o,width:Math.max(0,C-2*l),height:Math.max(0,Q-2*l),x:d+l,y:w+l},f,l)},Yo=["Texte"],Go=(n,o,u)=>({...n,selection:kr(n,o,u)}),gl=Go,Xo=(n,o,u,a,l,f=en)=>{n.font=`${l?"italic":""} ${a?"bold":""} 1px ${f}`;const p=o.map(d=>u/n.measureText(d).width);return Math.min(...p)||pc},yl=(n,o,u,a,l)=>{const f=Xo(n,Yo,50,o.settings?.fontBold.default??!1,o.settings?.fontItalic.default??!1,o.settings.fontFamily.default);return Go({toolId:o.id,type:o.type,id:L.uniqueId(`${o.type}_`),x:u[0],y:u[1],value:Yo,fontSize:f,width:50,height:f*(Yo.length||1),rotation:0,style:{globalAlpha:o.settings.opacity.default,strokeColor:o.settings.strokeColor.default,fontFamily:o.settings.fontFamily.default}},a,l)},_l=(n,o)=>{if(!(n.globalAlpha===0||!o.style?.strokeColor||o.style.strokeColor==="transparent")){n.font=`${o.style?.fontItalic?"italic":""} ${o.style?.fontBold?"bold":""} ${o.fontSize}px ${o.style?.fontFamily??en}`,n.textBaseline="top",n.fillStyle=o.style.strokeColor;for(let u=0;u<o.value.length;u++)n.fillText(o.value[u],o.x,o.y+u*o.fontSize,o.width)}},ml=(n,o)=>({x:n.x-o,width:n.width+o*2,y:n.y-o,height:n.height+o*2}),Ql=(n,o,u,a,l,f)=>Go({...o,x:ht(o.x+n[0]-u[0],a),y:ht(o.y+n[1]-u[1],a)},l,f),bl=(n,o,u,a,l,f,p)=>{const d=qo(o,u,a,l,f,p,!0);return{...d,fontSize:Xo(n,d.value,d.width,d.style?.fontBold??!1,d.style?.fontItalic??!1,d.style?.fontFamily)}},wl=(n,o,u,a,l,f=en)=>{n.font=`${l?"italic":""} ${a?"bold":""} ${u}px ${f}`;const p=o.map(d=>n.measureText(d).width);return Math.max(...p)||20},Cl=(n,o,u,a,l)=>{const f={...o,value:u},p=wl(n,f.value,f.fontSize,f.style?.fontBold??!1,f.style?.fontItalic??!1,f.style?.fontFamily),d=f.fontSize*f.value.length,Q={...f,width:p,height:d},{center:w}=zt(o,a),{center:C}=zt(Q,a),[k,N]=J1([1,1],w,o,l),[D,T]=J1([1,1],C,Q,l,[!1,!1]);return{...Q,x:Q.x-(D-k),y:Q.y-(T-N)}},zn=(n,o,u)=>({...n,path:Lc(n),selection:kr(n,o,u)}),El=zn,Al=(n,o,u,a)=>zn({toolId:n.id,type:n.type,id:L.uniqueId(`${n.type}_`),x:o[0],y:o[1],radiusX:0,radiusY:0,rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default}},u,a),Il=(n,o)=>{n.globalAlpha===0||!o.path||(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},Ll=(n,o)=>({x:n.x-n.radiusX-o,width:(n.radiusX+o)*2,y:n.y-n.radiusY-o,height:(n.radiusY+o)*2}),xl=(n,o,u,a,l,f)=>zn({...o,x:ht(o.x+n[0]-u[0],a),y:ht(o.y+n[1]-u[1],a)},l,f),kl=(n,o,u,a,l,f,p=!1)=>{const{borderX:d,borderHeight:Q,borderY:w,borderWidth:C}=Mn(n,o,u,a,l,p);return zn({...o,radiusX:Math.max(0,C/2-l),radiusY:Math.max(0,Q/2-l),x:d+C/2,y:w+Q/2},f,l)},Un=(n,o,u)=>({...n,path:Nn(n),selection:kr(n,o,u)}),Ol=Un,Tl=(n,o,u,a)=>Un({toolId:n.id,type:n.type,id:L.uniqueId(`${n.type}_`),x:o[0],y:o[1],radius:0,rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default}},u,a),Nl=(n,o)=>{n.globalAlpha===0||!o.path||(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},Ml=(n,o)=>({x:n.x-n.radius-o,width:(n.radius+o)*2,y:n.y-n.radius-o,height:(n.radius+o)*2}),Dl=(n,o,u,a,l,f)=>Un({...o,x:ht(o.x+n[0]-u[0],a),y:ht(o.y+n[1]-u[1],a)},l,f),Hl=(n,o,u,a,l,f)=>{const{borderX:p,borderHeight:d,borderY:Q,borderWidth:w}=Mn(n,o,u,a,l,!0);return Un({...o,radius:Math.max(0,w/2-l),x:p+w/2,y:Q+d/2},f,l)},Vl=n=>{const o=["img","id","selection","path"];return n.map(u=>u.type==="picture"&&!u.src.startsWith("http")?L.omit(o,{...u,src:Zl(u.img)}):L.omit(o,u))},P1=(n,o,u)=>({shapes:Vl(n),config:{width:o,height:u}}),R1=(n,o,u)=>on({...n,id:L.uniqueId(`${n.type}_`)},o,u),Wl=n=>n?.map(o=>{if(!o.translation)return o;const u=o.translation;switch(o.type){case"rect":case"square":case"ellipse":case"circle":case"picture":return{...L.omit(["translation"],o),x:o.x+u[0],y:o.y+u[1]};case"line":return{...L.omit(["translation"],o),points:o.points.map(([a,l])=>[a+u[0],l+u[1]])};case"polygon":case"curve":return{...L.omit(["translation"],o),points:o.points.map(([a,l])=>[a+u[0],l+u[1]])};case"brush":return{...L.omit(["translation"],o),points:o.points.map(a=>a.map(([l,f])=>[l+u[0],f+u[1]]))}}}),tu=n=>{const a=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("svg")[0],l=a.getAttribute("width"),f=a.getAttribute("height");let p;if(l||f)p=n;else{const Q=a.getAttribute("viewBox")??`0 0 ${rr} ${rr}`,[,,w,C]=Q.split(" ");a.setAttribute("width",w??rr),a.setAttribute("height",C??rr),p=new XMLSerializer().serializeToString(a)}const d=new Blob([p],{type:"image/svg+xml"});return URL.createObjectURL(d)},eu=n=>(n instanceof File?n.name:n).includes(".svg"),ru=n=>eu(n)?fetch(n).then(o=>o.text()).then(o=>tu(o)):fetch(n).then(o=>o.blob()).then(o=>URL.createObjectURL(o)),nu=(n,o)=>{const u=document.createElement("a");u.href=n,u.download=o,document.body.appendChild(u),u.click(),document.body.removeChild(u)},Zl=n=>{const o=document.createElement("canvas");o.width=n.width,o.height=n.height;const u=o.getContext("2d");return u?(u.drawImage(n,0,0),o.toDataURL("image/png")):""},Bl=n=>"data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(n)),ou=(n,o,u,a,l)=>{const f=document.createElement("canvas");f.width=u,f.height=a;const p=f.getContext("2d");if(!p)return"";p.clearRect(0,0,u,a),H1(p);for(let d=n.length-1;d>=0;d--)ku(p,n[d],1,o,l);return f.toDataURL("image/png")},jl=(n,o,u)=>{const a=P1(n,o,u);return Bl(a)},zl=async n=>new Promise((o,u)=>{const a=new FileReader;a.onload=l=>{const f=l.target?.result;if(!f)return u("Impossible de récupérer les données du fichier");const p=JSON.parse(f);o(p)},a.readAsText(n)}),Ul=async(n,o,u)=>{const a=[],l=n.shapes,f=L.flow(p=>Wl(p),L.map(p=>{if(!M1.includes(p.type))return null;if(p.type==="picture"){const d=new Image,Q=new Promise((w,C)=>{d.onload=()=>{URL.revokeObjectURL(d.src),w()},d.onerror=()=>{C(new Error("Some images could not be loaded"))}});return a.push(Q),p.src.startsWith("http")?ru(p.src).then(w=>{d.src=w}).catch(()=>{d.src=""}):d.src=p.src,R1({...p,img:d},o,u)}return R1(p,o,u)}),L.compact)(l);return await Promise.all(a),f},iu='<svg><path d="M5.146 17.5Q4.146 17.5 3.208 17Q2.271 16.5 1.667 15.708Q2.208 15.75 2.802 15.344Q3.396 14.938 3.396 14.104Q3.396 13.042 4.135 12.292Q4.875 11.542 5.958 11.542Q7.021 11.542 7.76 12.292Q8.5 13.042 8.5 14.104Q8.5 15.5 7.51 16.5Q6.521 17.5 5.146 17.5ZM9.917 12.5 7.562 10.146 14.917 2.729Q15.146 2.5 15.469 2.5Q15.792 2.5 16.021 2.729L17.271 3.958Q17.5 4.188 17.5 4.531Q17.5 4.875 17.271 5.125Z"/></svg>',$n='<svg><path d="M2.5 17.5V2.5H17.5V17.5ZM4.25 15.75H15.75V4.25H4.25ZM4.25 15.75V4.25V15.75Z"/></svg>',$l='<svg><path d="M5.333 9.292 10.021 1.646 14.708 9.292ZM14.562 18.333Q13 18.333 11.896 17.229Q10.792 16.125 10.792 14.562Q10.792 13 11.896 11.896Q13 10.792 14.562 10.792Q16.125 10.792 17.229 11.896Q18.333 13 18.333 14.562Q18.333 16.125 17.229 17.229Q16.125 18.333 14.562 18.333ZM2.5 17.917V11.188H9.229V17.917ZM14.562 16.583Q15.438 16.583 16.01 16.01Q16.583 15.438 16.583 14.562Q16.583 13.688 16.01 13.115Q15.438 12.542 14.562 12.542Q13.688 12.542 13.115 13.115Q12.542 13.688 12.542 14.562Q12.542 15.438 13.115 16.01Q13.688 16.583 14.562 16.583ZM4.25 16.167H7.479V12.938H4.25ZM8.458 7.542H11.583L10.021 5ZM10.021 7.542ZM7.479 12.938ZM14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Z"/></svg>',Fn='<svg><path d="M10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.271 2.323 6.75Q2.979 5.229 4.104 4.104Q5.229 2.979 6.75 2.323Q8.271 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.729 17.677 13.25Q17.021 14.771 15.896 15.896Q14.771 17.021 13.25 17.677Q11.729 18.333 10 18.333ZM10 16.583Q12.75 16.583 14.667 14.667Q16.583 12.75 16.583 10Q16.583 7.25 14.667 5.333Q12.75 3.417 10 3.417Q7.25 3.417 5.333 5.333Q3.417 7.25 3.417 10Q3.417 12.75 5.333 14.667Q7.25 16.583 10 16.583ZM10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Z"/></svg>',Ko='<svg><path d="M12.25 18.333V16.167L6.833 13.458H2.5V8.208H6.25L8.25 5.917V1.667H13.5V6.917H9.708L7.75 9.146V11.958L12.25 14.208V13.083H17.5V18.333Z"/></svg>',uu='<svg><path d="M4.125 5.083V3.333H7.062L7.896 2.5H12.104L12.938 3.333H15.875V5.083ZM6.75 17.5Q6.021 17.5 5.51 16.99Q5 16.479 5 15.75V5.958H15V15.75Q15 16.479 14.49 16.99Q13.979 17.5 13.25 17.5Z"/></svg>',au='<svg><path d="M10 17.5Q7.208 17.5 5.271 15.594Q3.333 13.688 3.333 10.958Q3.333 9.583 3.854 8.396Q4.375 7.208 5.292 6.292L10 1.667L14.688 6.292Q15.604 7.208 16.135 8.396Q16.667 9.583 16.667 10.958Q16.667 13.688 14.719 15.594Q12.771 17.5 10 17.5ZM5.146 11.667H14.854Q15.083 10.188 14.552 9.146Q14.021 8.104 13.479 7.562L10 4.125L6.521 7.562Q5.979 8.104 5.448 9.146Q4.917 10.188 5.146 11.667Z"/></svg>',Fl='<svg><path d="M11.708 15.833H5.854V14.083H11.708Q13 14.083 13.958 13.292Q14.917 12.5 14.917 11.271Q14.917 10.042 13.958 9.24Q13 8.438 11.708 8.438H6.667L8.792 10.562L7.562 11.792L3.333 7.562L7.562 3.333L8.792 4.562L6.667 6.688H11.708Q13.729 6.688 15.198 7.99Q16.667 9.292 16.667 11.25Q16.667 13.208 15.198 14.521Q13.729 15.833 11.708 15.833Z"/></svg>',Sl='<svg><path d="M8.292 15.833Q6.271 15.833 4.802 14.521Q3.333 13.208 3.333 11.25Q3.333 9.292 4.802 7.99Q6.271 6.688 8.292 6.688H13.333L11.208 4.562L12.438 3.333L16.667 7.562L12.438 11.792L11.208 10.562L13.333 8.438H8.292Q7 8.438 6.042 9.229Q5.083 10.021 5.083 11.25Q5.083 12.5 6.042 13.292Q7 14.083 8.292 14.083H14.146V15.833Z"/></svg>',ql='<svg><path d="M10 17.646 2.438 11.75 3.875 10.646 10 15.396 16.125 10.646 17.562 11.75ZM10 13.188 2.5 7.354 10 1.521 17.5 7.354Z"/></svg>',Yl='<svg><path d="M7.854 13.812 10 11.688 12.125 13.812 13.354 12.604 11.208 10.458 13.354 8.312 12.125 7.104 10 9.229 7.854 7.104 6.625 8.312 8.771 10.458 6.625 12.604ZM5.896 17.5Q5.167 17.5 4.656 16.99Q4.146 16.479 4.146 15.75V5.125H3.333V3.375H7.542V2.5H12.458V3.375H16.667V5.125H15.833V15.75Q15.833 16.479 15.323 16.99Q14.812 17.5 14.083 17.5Z"/></svg>',Gl='<svg><path d="M17.5 5.833V15.75Q17.5 16.479 16.99 16.99Q16.479 17.5 15.75 17.5H4.25Q3.521 17.5 3.01 16.99Q2.5 16.479 2.5 15.75V4.25Q2.5 3.521 3.01 3.01Q3.521 2.5 4.25 2.5H14.167ZM10 14.917Q11.062 14.917 11.823 14.156Q12.583 13.396 12.583 12.333Q12.583 11.271 11.823 10.51Q11.062 9.75 10 9.75Q8.938 9.75 8.177 10.51Q7.417 11.271 7.417 12.333Q7.417 13.396 8.177 14.156Q8.938 14.917 10 14.917ZM5.021 8.396H12.521V5.021H5.021Z"/></svg>',Xl='<svg><path d="M10 13.271 5.708 8.979 6.958 7.729 9.125 9.896V3.333H10.875V9.896L13.042 7.729L14.292 8.979ZM5.083 16.667Q4.354 16.667 3.844 16.156Q3.333 15.646 3.333 14.917V12.5H5.083V14.917Q5.083 14.917 5.083 14.917Q5.083 14.917 5.083 14.917H14.917Q14.917 14.917 14.917 14.917Q14.917 14.917 14.917 14.917V12.5H16.667V14.917Q16.667 15.646 16.156 16.156Q15.646 16.667 14.917 16.667Z"/></svg>',Kl='<svg><path d="M3.417 16.667Q2.729 16.667 2.198 16.135Q1.667 15.604 1.667 14.917V5.083Q1.667 4.396 2.198 3.865Q2.729 3.333 3.417 3.333H8.25L9.917 5H16.667Q17.354 5 17.844 5.531Q18.333 6.062 18.333 6.75H3.417V14.917Q3.417 14.917 3.417 14.917Q3.417 14.917 3.417 14.917L5.438 8.5H19.583L17.396 15.479Q17.229 16.021 16.802 16.344Q16.375 16.667 15.833 16.667Z"/></svg>',Jo='<svg><path d="M4.792 15.083 8.333 11.542 9.833 13.021 11.667 10.708 15.167 15.083ZM6.667 8.417Q5.938 8.417 5.427 7.906Q4.917 7.396 4.917 6.667Q4.917 5.938 5.427 5.427Q5.938 4.917 6.667 4.917Q7.396 4.917 7.906 5.427Q8.417 5.938 8.417 6.667Q8.417 7.396 7.906 7.906Q7.396 8.417 6.667 8.417ZM4.167 18.333Q3.125 18.333 2.396 17.604Q1.667 16.875 1.667 15.833V4.167Q1.667 3.125 2.396 2.396Q3.125 1.667 4.167 1.667H15.833Q16.875 1.667 17.604 2.396Q18.333 3.125 18.333 4.167V15.833Q18.333 16.875 17.604 17.604Q16.875 18.333 15.833 18.333ZM4.167 16.583H15.833Q16.146 16.583 16.365 16.365Q16.583 16.146 16.583 15.833V4.167Q16.583 3.854 16.365 3.635Q16.146 3.417 15.833 3.417H4.167Q3.854 3.417 3.635 3.635Q3.417 3.854 3.417 4.167V15.833Q3.417 16.146 3.635 16.365Q3.854 16.583 4.167 16.583Z"/></svg>',su='<svg><path d="M8.708 16.667V5.917H4.167V3.333H15.833V5.917H11.292V16.667Z"/></svg>',cu='<svg><path d="M7.5 15.833V14.083H12.833L3.333 4.583L4.583 3.333L14.083 12.833V7.5H15.833V15.833Z"/></svg>',Jl='<svg><path d="M8.0145 11.1707C8.38484 10.9914 8.82183 11.1558 8.99959 11.5295L10.7031 15.2591L12.0363 14.6238L10.3254 10.9017C10.1476 10.528 10.3106 10.0795 10.6809 9.90761L10.8883 9.84782L12.5918 9.51148L6.48133 4.33192V12.389L7.82934 11.2903L8.0145 11.1707ZM10.6587 16.9258C10.2883 17.1052 9.84395 16.9482 9.67359 16.5745L8.05894 13.0318L6.19988 14.5416C6.07396 14.6462 5.91842 14.706 5.74066 14.706C5.54423 14.706 5.35584 14.6272 5.21694 14.4871C5.07803 14.3469 5 14.1568 5 13.9586V2.74741C5 2.54919 5.07803 2.35908 5.21694 2.21891C5.35584 2.07874 5.54423 2 5.74066 2C5.91842 2 6.08878 2.06727 6.21469 2.1719L6.2221 2.16443L14.7323 9.36947C15.0508 9.63854 15.0879 10.1094 14.8286 10.4233C14.7175 10.5579 14.562 10.6475 14.4064 10.6774L12.0659 11.1408L13.6954 14.6761C13.888 15.0498 13.7102 15.4908 13.3399 15.6627L10.6587 16.9258Z"/></svg>',Pl='<svg><path d="M2.5 15V13.25H17.5V15ZM2.5 10.875V9.125H17.5V10.875ZM2.5 6.75V5H17.5V6.75Z"/></svg>',Rl='<svg><path d="M10 13.354Q11.583 13.354 12.688 12.25Q13.792 11.146 13.792 9.562Q13.792 7.979 12.688 6.875Q11.583 5.771 10 5.771Q8.417 5.771 7.312 6.875Q6.208 7.979 6.208 9.562Q6.208 11.146 7.312 12.25Q8.417 13.354 10 13.354ZM10 11.812Q9.062 11.812 8.406 11.156Q7.75 10.5 7.75 9.562Q7.75 8.625 8.406 7.969Q9.062 7.312 10 7.312Q10.938 7.312 11.594 7.969Q12.25 8.625 12.25 9.562Q12.25 10.5 11.594 11.156Q10.938 11.812 10 11.812ZM10 15.833Q6.938 15.833 4.448 14.125Q1.958 12.417 0.833 9.562Q1.958 6.708 4.458 5.021Q6.958 3.333 10 3.333Q13.042 3.333 15.542 5.021Q18.042 6.708 19.167 9.562Q18.042 12.417 15.552 14.125Q13.062 15.833 10 15.833ZM10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562ZM10 14.083Q12.333 14.083 14.281 12.865Q16.229 11.646 17.25 9.562Q16.229 7.479 14.281 6.281Q12.333 5.083 10 5.083Q7.667 5.083 5.708 6.281Q3.75 7.479 2.729 9.562Q3.75 11.646 5.708 12.865Q7.667 14.083 10 14.083Z"/></svg>',tf='<svg><path d="M13.521 11.021 12.25 9.75Q12.333 8.75 11.604 7.979Q10.875 7.208 9.812 7.312L8.542 6.042Q8.896 5.896 9.26 5.833Q9.625 5.771 10 5.771Q11.583 5.771 12.688 6.875Q13.792 7.979 13.792 9.562Q13.792 9.979 13.719 10.354Q13.646 10.729 13.521 11.021ZM16.167 13.646 14.917 12.417Q15.667 11.833 16.25 11.146Q16.833 10.458 17.25 9.562Q16.229 7.479 14.292 6.281Q12.354 5.083 10 5.083Q9.396 5.083 8.885 5.156Q8.375 5.229 7.875 5.375L6.5 4Q7.354 3.646 8.208 3.49Q9.062 3.333 10 3.333Q13.146 3.333 15.615 5.052Q18.083 6.771 19.167 9.562Q18.688 10.792 17.917 11.823Q17.146 12.854 16.167 13.646ZM16.396 18.854 12.938 15.396Q12.208 15.625 11.479 15.729Q10.75 15.833 10 15.833Q6.833 15.833 4.375 14.094Q1.917 12.354 0.833 9.562Q1.25 8.479 1.917 7.552Q2.583 6.625 3.417 5.875L1.125 3.562L2.375 2.354L17.625 17.625ZM4.604 7.062Q4.021 7.604 3.542 8.219Q3.062 8.833 2.729 9.562Q3.75 11.646 5.688 12.865Q7.625 14.083 10 14.083Q10.354 14.083 10.74 14.052Q11.125 14.021 11.479 13.938L10.812 13.271Q10.625 13.312 10.417 13.333Q10.208 13.354 10 13.354Q8.417 13.354 7.312 12.25Q6.208 11.146 6.208 9.562Q6.208 9.354 6.24 9.167Q6.271 8.979 6.312 8.771ZM11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875ZM8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Z"/></svg>',ef='<svg><path d="M9.958 18.333Q8.25 18.333 6.74 17.677Q5.229 17.021 4.104 15.885Q2.979 14.75 2.323 13.229Q1.667 11.708 1.667 10Q1.667 8.271 2.333 6.75Q3 5.229 4.156 4.104Q5.312 2.979 6.854 2.323Q8.396 1.667 10.125 1.667Q11.771 1.667 13.26 2.25Q14.75 2.833 15.875 3.854Q17 4.875 17.667 6.26Q18.333 7.646 18.333 9.25Q18.333 11.688 16.792 12.948Q15.25 14.208 13.188 14.208H11.75Q11.625 14.208 11.562 14.281Q11.5 14.354 11.5 14.458Q11.5 14.688 11.812 15.219Q12.125 15.75 12.125 16.458Q12.125 17.458 11.51 17.896Q10.896 18.333 9.958 18.333ZM5.458 10.875Q6 10.875 6.375 10.5Q6.75 10.125 6.75 9.583Q6.75 9.042 6.375 8.667Q6 8.292 5.458 8.292Q4.917 8.292 4.542 8.667Q4.167 9.042 4.167 9.583Q4.167 10.125 4.542 10.5Q4.917 10.875 5.458 10.875ZM7.917 7.583Q8.458 7.583 8.833 7.208Q9.208 6.833 9.208 6.292Q9.208 5.75 8.833 5.375Q8.458 5 7.917 5Q7.375 5 7 5.375Q6.625 5.75 6.625 6.292Q6.625 6.833 7 7.208Q7.375 7.583 7.917 7.583ZM12.021 7.583Q12.562 7.583 12.938 7.208Q13.312 6.833 13.312 6.292Q13.312 5.75 12.938 5.375Q12.562 5 12.021 5Q11.479 5 11.104 5.375Q10.729 5.75 10.729 6.292Q10.729 6.833 11.104 7.208Q11.479 7.583 12.021 7.583ZM14.479 10.875Q15.021 10.875 15.396 10.5Q15.771 10.125 15.771 9.583Q15.771 9.042 15.396 8.667Q15.021 8.292 14.479 8.292Q13.938 8.292 13.562 8.667Q13.188 9.042 13.188 9.583Q13.188 10.125 13.562 10.5Q13.938 10.875 14.479 10.875Z"/></svg>',rf='<svg><path d="M9.188 16.542V14.938Q8.5 14.938 8.021 14.458Q7.542 13.979 7.542 13.292V12.458L3.583 8.5Q3.5 8.875 3.458 9.25Q3.417 9.625 3.417 10Q3.417 12.5 5.062 14.365Q6.708 16.229 9.188 16.542ZM14.854 14.438Q15.708 13.521 16.146 12.385Q16.583 11.25 16.583 10Q16.583 7.979 15.469 6.313Q14.354 4.646 12.479 3.917V4.229Q12.479 4.917 12 5.396Q11.521 5.875 10.833 5.875H9.188V7.521Q9.188 7.875 8.948 8.115Q8.708 8.354 8.354 8.354H6.708V10H11.646Q12 10 12.24 10.229Q12.479 10.458 12.479 10.812V13.292H13.292Q13.833 13.292 14.26 13.604Q14.688 13.917 14.854 14.438ZM10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.271 2.323 6.75Q2.979 5.229 4.104 4.104Q5.229 2.979 6.75 2.323Q8.271 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.729 17.677 13.25Q17.021 14.771 15.896 15.896Q14.771 17.021 13.25 17.677Q11.729 18.333 10 18.333Z"/></svg>',nf='<svg><path d="M10 0.833Q11.771 0.833 12.99 2.052Q14.208 3.271 14.208 5.042V6.667H14.917Q15.646 6.667 16.156 7.177Q16.667 7.688 16.667 8.417V16.562Q16.667 17.292 16.156 17.812Q15.646 18.333 14.917 18.333H5.083Q4.354 18.333 3.844 17.812Q3.333 17.292 3.333 16.562V8.417Q3.333 7.688 3.844 7.177Q4.354 6.667 5.083 6.667H5.792V5.042Q5.792 3.271 7.01 2.052Q8.229 0.833 10 0.833ZM10 2.583Q8.979 2.583 8.26 3.302Q7.542 4.021 7.542 5.042V6.667H12.458V5.042Q12.458 4.021 11.74 3.302Q11.021 2.583 10 2.583ZM5.083 16.583H14.917Q14.917 16.583 14.917 16.583Q14.917 16.583 14.917 16.583V8.417Q14.917 8.417 14.917 8.417Q14.917 8.417 14.917 8.417H5.083Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417V16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583ZM10 10.812Q9.292 10.812 8.802 11.302Q8.312 11.792 8.312 12.5Q8.312 13.208 8.802 13.698Q9.292 14.188 10 14.188Q10.708 14.188 11.198 13.698Q11.688 13.208 11.688 12.5Q11.688 11.792 11.198 11.302Q10.708 10.812 10 10.812ZM5.083 8.417Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417V16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583V8.417Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417Z"/></svg>',of='<svg><path d="M5.792 5.042Q5.792 3.271 7.01 2.052Q8.229 0.833 10 0.833Q11.771 0.833 12.99 2.052Q14.208 3.271 14.208 5.042V6.667H14.917Q15.646 6.667 16.156 7.177Q16.667 7.688 16.667 8.417V16.562Q16.667 17.292 16.156 17.812Q15.646 18.333 14.917 18.333H5.083Q4.354 18.333 3.844 17.812Q3.333 17.292 3.333 16.562V8.417Q3.333 7.688 3.844 7.177Q4.354 6.667 5.083 6.667H12.458V5.042Q12.458 4.021 11.74 3.302Q11.021 2.583 10 2.583Q8.979 2.583 8.26 3.302Q7.542 4.021 7.542 5.042ZM5.083 16.583H14.917Q14.917 16.583 14.917 16.583Q14.917 16.583 14.917 16.583V8.417Q14.917 8.417 14.917 8.417Q14.917 8.417 14.917 8.417H5.083Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417V16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583ZM10 10.812Q9.292 10.812 8.802 11.302Q8.312 11.792 8.312 12.5Q8.312 13.208 8.802 13.698Q9.292 14.188 10 14.188Q10.708 14.188 11.198 13.698Q11.688 13.208 11.688 12.5Q11.688 11.792 11.198 11.302Q10.708 10.812 10 10.812ZM5.083 8.417Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417V16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583V8.417Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417Z"/></svg>',uf='<svg><path d="M18.333 15.854 16.583 14.104V13.354H15.833L14.083 11.604H16.583V8.375H13.375V10.896L11.625 9.146V8.375H10.875L9.125 6.625H11.625V3.417H8.396V5.896L6.646 4.146V3.417H5.896L4.146 1.667H16.583Q17.312 1.667 17.823 2.177Q18.333 2.688 18.333 3.417ZM13.375 6.625H16.583V3.417Q16.583 3.417 16.583 3.417Q16.583 3.417 16.583 3.417H13.375ZM16.771 19.229 15.854 18.333H3.417Q2.688 18.333 2.177 17.823Q1.667 17.312 1.667 16.583V4.125L0.812 3.271L2.042 2.021L18 18ZM13.375 16.583H14.104L13.375 15.833ZM8.396 11.604H9.125L8.396 10.854ZM8.396 16.583H11.625V14.083L10.875 13.354H8.396ZM3.417 6.625H4.167L3.417 5.875ZM3.417 11.604H6.646V9.104L5.917 8.375H3.417ZM6.646 16.583V13.354H3.417V16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583Z"/></svg>',lu='<svg><path d="M7.521 17.5Q6.125 17.5 5.146 16.51Q4.167 15.521 4.167 14.125V7.417Q3.438 7.125 2.969 6.49Q2.5 5.854 2.5 5.042Q2.5 3.979 3.24 3.24Q3.979 2.5 5.042 2.5Q6.104 2.5 6.844 3.24Q7.583 3.979 7.583 5.042Q7.583 5.854 7.115 6.49Q6.646 7.125 5.917 7.417V14.125Q5.917 14.792 6.385 15.271Q6.854 15.75 7.521 15.75Q8.188 15.75 8.656 15.271Q9.125 14.792 9.125 14.125V5.875Q9.125 4.479 10.104 3.49Q11.083 2.5 12.479 2.5Q13.875 2.5 14.854 3.49Q15.833 4.479 15.833 5.875V12.583Q16.562 12.875 17.031 13.51Q17.5 14.146 17.5 14.958Q17.5 16.021 16.76 16.76Q16.021 17.5 14.958 17.5Q13.896 17.5 13.156 16.76Q12.417 16.021 12.417 14.958Q12.417 14.146 12.885 13.5Q13.354 12.854 14.083 12.583V5.875Q14.083 5.208 13.615 4.729Q13.146 4.25 12.479 4.25Q11.812 4.25 11.344 4.729Q10.875 5.208 10.875 5.875V14.125Q10.875 15.521 9.896 16.51Q8.917 17.5 7.521 17.5Z"/></svg>',fu='<svg><path d="M5.833 15V3.333H10.375Q11.812 3.333 12.885 4.156Q13.958 4.979 13.958 6.375Q13.958 7.375 13.49 7.969Q13.021 8.562 12.396 8.875V9.042Q13.312 9.354 13.844 10.021Q14.375 10.688 14.375 11.75Q14.375 13.312 13.229 14.156Q12.083 15 10.5 15ZM8.125 8.042H10.188Q10.854 8.042 11.302 7.656Q11.75 7.271 11.75 6.708Q11.75 6.167 11.302 5.771Q10.854 5.375 10.188 5.375H8.125ZM8.125 12.917H10.354Q11.167 12.917 11.625 12.51Q12.083 12.104 12.083 11.458Q12.083 10.812 11.625 10.406Q11.167 10 10.354 10H8.125Z"/></svg>',pu='<svg><path d="M4.167 16.667V14.083H6.979L10.229 5.917H7.5V3.333H15.833V5.917H13.021L9.771 14.083H12.5V16.667Z"/></svg>',hu='<svg><path d="M3.021 16V15H17V16ZM3.021 13.5V12H17V13.5ZM3 10.5V8.5H16.979V10.5ZM3.021 7V4H17V7Z"/></svg>',af='<svg><path d="M3 16V14.5H4.5V16ZM6.125 16V14.5H7.625V16ZM9.25 16V14.5H10.75V16ZM12.375 16V14.5H13.875V16ZM15.5 16V14.5H17V16ZM3 13V11.5H6.5V13ZM8.25 13V11.5H11.75V13ZM13.5 13V11.5H17V13ZM3 10V8.5H9.25V10ZM10.75 10V8.5H17V10ZM3 7V4H17V7Z"/></svg>',sf='<svg><path d="M5.312 14.979H7.125L8.042 12.479H11.979L12.896 14.979H14.708L10.917 5H9.083ZM8.542 10.958 9.958 6.958H10.042L11.458 10.958ZM3.417 18.333Q2.688 18.333 2.177 17.823Q1.667 17.312 1.667 16.583V3.417Q1.667 2.688 2.177 2.177Q2.688 1.667 3.417 1.667H16.583Q17.312 1.667 17.823 2.177Q18.333 2.688 18.333 3.417V16.583Q18.333 17.312 17.823 17.823Q17.312 18.333 16.583 18.333ZM3.417 16.583H16.583Q16.583 16.583 16.583 16.583Q16.583 16.583 16.583 16.583V3.417Q16.583 3.417 16.583 3.417Q16.583 3.417 16.583 3.417H3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417V16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583ZM3.417 3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417V16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583V3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417Z"/></svg>',cf='<svg><path d="M6 17 2 13 6 9 7.062 10.062 4.875 12.25H17V13.75H4.875L7.062 15.938ZM14 11 12.938 9.938 15.125 7.75H3V6.25H15.125L12.938 4.062L14 3L18 7Z"/></svg>',lf='<svg><path d="M2.5 15.833V14.083H7.667V15.833ZM2.5 5.917V4.167H10.771V5.917ZM9.208 17.5V12.438H10.958V14.083H17.5V15.833H10.958V17.5ZM5.917 12.542V10.875H2.5V9.125H5.917V7.479H7.667V12.542ZM9.208 10.875V9.125H17.5V10.875ZM12.333 7.562V2.5H14.083V4.167H17.5V5.917H14.083V7.562Z"/></svg>',du='<svg><path d="M16.354 18.833 14.521 17Q13.542 17.646 12.396 17.99Q11.25 18.333 10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.729 2.01 7.594Q2.354 6.458 3 5.458L1.167 3.625L2.396 2.396L17.583 17.604ZM10 16.583Q10.896 16.583 11.708 16.365Q12.521 16.146 13.25 15.729L4.292 6.75Q3.875 7.479 3.646 8.292Q3.417 9.104 3.417 10Q3.417 12.729 5.344 14.656Q7.271 16.583 10 16.583ZM17 14.562 15.708 13.271Q16.125 12.542 16.354 11.719Q16.583 10.896 16.583 10Q16.583 7.271 14.656 5.344Q12.729 3.417 10 3.417Q9.104 3.417 8.292 3.646Q7.479 3.875 6.75 4.292L5.458 3Q6.458 2.354 7.594 2.01Q8.729 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.271 17.979 12.417Q17.625 13.562 17 14.562ZM11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771ZM8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Z"/></svg>',vu='<svg ><path d="M16.354 18.833 14.521 17Q13.542 17.646 12.396 17.99Q11.25 18.333 10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.729 2.01 7.594Q2.354 6.458 3 5.458L1.167 3.625L2.396 2.396L17.583 17.604ZM17 14.562 5.458 3Q6.458 2.354 7.594 2.01Q8.729 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.271 17.979 12.417Q17.625 13.562 17 14.562Z"/></svg>',jt="react-paint-",ff={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"transparent"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:er,default:0}},pf={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"transparent"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:er,default:0}},hf={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"transparent"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:er,default:0}},df={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"transparent"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:er,default:0}},vf={opacity:{min:0,max:100,step:1,default:100}},gf={strokeColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},fontFamily:{values:fc,default:en},fontBold:{values:[!1,!0],default:!1},fontItalic:{values:[!1,!0],default:!1}},yf={strokeColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:6,max:20,step:2,default:10},lineDash:{values:er,default:0}},_f={strokeColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:er,default:0},lineArrow:{values:lc,default:0}},mf={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:er,default:0},pointsCount:{min:3,max:10,step:1,default:3}},Qf={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:er,default:0},pointsCount:{min:3,max:10,step:1,default:3}},Po={type:"picture",id:`${jt}picture`,icon:Jo,label:"Image",settings:vf},gu={type:"brush",id:`${jt}brush`,icon:iu,label:"Brosse",settings:yf},yu={type:"line",id:`${jt}line`,icon:cu,label:"Ligne",settings:_f},_u={type:"polygon",id:`${jt}polygon`,icon:Ko,label:"Polygone",settings:mf},mu={type:"curve",id:`${jt}curve`,icon:lu,label:"Courbe",settings:Qf},Qu={type:"rect",id:`${jt}rect`,icon:$n,label:"Rectangle",settings:ff},bu={type:"square",id:`${jt}square`,icon:$n,label:"Carré",settings:pf},wu={type:"circle",id:`${jt}circle`,icon:Fn,label:"Cercle",settings:hf},Cu={type:"ellipse",id:`${jt}ellipse`,icon:Fn,label:"Ellipse",settings:df},Eu={type:"text",id:`${jt}text`,icon:su,label:"Texte",settings:gf},bf=[gu,yu,_u,mu,Qu,bu,wu,Cu,Po,Eu],ze={id:`${jt}selection`,type:"selection",icon:Jl,label:"Sélection"},Nr={id:`${jt}undo`,type:"undo",icon:Fl,label:"Undo"},Mr={id:`${jt}redo`,type:"redo",icon:Sl,label:"Redo"},Dr={id:`${jt}clear`,type:"clear",icon:Yl,label:"Clear"},Ro={id:`${jt}export`,type:"export",icon:Xl,label:"Export PNG"},Au={id:`${jt}load`,type:"loadfile",icon:Kl,label:"Load project"},ti={id:`${jt}save`,type:"savefile",icon:Gl,label:"Save project"},Iu={id:`${jt}upload-picture`,type:"uploadpicture",icon:Jo,label:"Upload picture"},ei=(n,o,u)=>({...n,selection:kr(n,o,u)}),wf=ei,Lu=(n,o,u,a,l,f)=>{const[p,d]=Fc(n.width,n.height,u,a,!0);return ei({toolId:Po.id,type:"picture",id:L.uniqueId("picture_"),x:(u-p)/2,y:(a-d)/2,width:p,height:d,src:o,img:n,rotation:0},l,f)},Cf=(n,o,u,a,l,f,p)=>{const d=URL.createObjectURL(u);n.onload=async()=>{if(URL.revokeObjectURL(n.src),eu(u)&&!n.width&&!n.height){const w=await u.text(),C=tu(w);if(d===n.src){n.src=C;return}}const Q=Lu(n,n.src,a,l,f,p);o(Q)},n.src=d},Ef=(n,o,u,a,l,f,p)=>{n.onload=()=>{URL.revokeObjectURL(n.src);const d=Lu(n,u,a,l,f,p);o(d)},ru(u).then(d=>{n.src=d}).catch(()=>{n.src=""})},Af=(n,o,u,a,l)=>new Promise((f,p)=>{const d=new Image;d.onerror=()=>{p(new Error("Some images could not be loaded"))},setTimeout(()=>{p(new Error("Timeout while loading images"))},4e3),n instanceof File?Cf(d,f,n,o,u,a,l):Ef(d,f,n,o,u,a,l)}),If=(n,o)=>{n.globalAlpha!==0&&(n.beginPath(),n.drawImage(o.img,o.x,o.y,o.width,o.height))},Lf=(n,o)=>K1(n,o),xf=(n,o,u,a,l,f)=>ei({...o,x:ht(o.x+n[0]-u[0],a),y:ht(o.y+n[1]-u[1],a)},l,f),kf=(n,o,u,a,l,f,p)=>qo(n,o,u,a,l,f,p),xu=(n,o,u,a,l,f)=>{const p=[ht(u[0],a),ht(u[1],a)];switch(o.type){case"brush":return Hc(o,p,l,f);case"line":return Kc(o,p,l,f);case"polygon":return rl(o,p,l,f);case"curve":return sl(o,p,l,f);case"rect":case"square":return dl(o,p,l,f);case"text":return yl(n,o,p,l,f);case"ellipse":return Al(o,p,l,f);case"circle":return Tl(o,p,l,f)}},ku=(n,o,u,a,l)=>{if(o.visible===!1)return;const{center:f}=zt(o,l);switch(V1(n,u,a,o.rotation,f),xr(n,o.style),o.type){case"brush":Vc(n,o);break;case"text":_l(n,o);break;case"line":Jc(n,o);break;case"polygon":nl(n,o);break;case"curve":ll(n,o);break;case"circle":Nl(n,o);break;case"ellipse":Il(n,o);break;case"rect":X1(n,o);break;case"square":X1(n,o);break;case"picture":If(n,o);break}n.restore()},Of=(n,o)=>{switch(n.type){case"brush":return Wc(n,o);case"line":return Pc(n,o);case"polygon":return G1(n,o);case"curve":return fl(n,o);case"circle":return Ml(n,o);case"ellipse":return Ll(n,o);case"rect":case"square":return K1(n,o);case"text":return ml(n,o);case"picture":return Lf(n,o);default:return{x:0,y:0,width:100,height:100}}},Tf=n=>[n.x+n.width/2,n.y+n.height/2],zt=(n,o)=>{const u=Of(n,o),a=Tf(u);return{borders:u,center:a}},Nf=(n,o,u,a,l,f)=>{const p=l[0]-a[0],d=l[1]-a[1],Q=l[0]-o[0],w=l[1]-o[1],C=u.rotation+Math.atan2(w,Q)-Math.atan2(d,p);return{...n,rotation:Uc(C,f)}},Mf=(n,o,u,a,l,f,p,d,Q,w)=>{switch(l.type){case"line":return tl(u,a,l,f,p,d,w);case"polygon":return il(u,a,l,f,p,d,w);case"curve":return cl(u,a,l,f,p,d,w);case"brush":return Bc(u,l,f,p,d,w,Q);case"circle":return Hl(u,l,f,p,d,w);case"ellipse":return kl(u,l,f,p,d,w,Q);case"rect":case"square":return qo(u,l,f,p,d,w,o.type==="square"||Q);case"text":return bl(n,u,l,f,p,d,w);case"picture":return kf(u,l,f,p,d,w,!Q);default:return l}},ri=(n,o,u,a,l,f)=>{switch(o.type){case"rect":case"square":return vl(n,o,u,a,l,f);case"ellipse":return xl(n,o,u,a,l,f);case"circle":return Dl(n,o,u,a,l,f);case"picture":return xf(n,o,u,a,l,f);case"text":return Ql(n,o,u,a,l,f);case"line":return Rc(n,o,u,a,l,f);case"polygon":return ol(n,o,u,a,l,f);case"curve":return pl(n,o,u,a,l,f);case"brush":return Zc(n,o,u,a,l,f);default:return o}},on=(n,o,u)=>{switch(n.type){case"rect":case"square":return hl(n,o,u);case"ellipse":return El(n,o,u);case"circle":return Ol(n,o,u);case"picture":return wf(n,o,u);case"text":return gl(n,o,u);case"line":return Xc(n,o,u);case"polygon":return el(n,o,u);case"curve":return al(n,o,u);case"brush":return Dc(n,o,u);default:return n}},Df=({ctx:n,shape:o,currentScale:u=1,canvasOffset:a,selectionPadding:l,selectionWidth:f,selectionColor:p,withAnchors:d=!0})=>{const{center:Q}=zt(o,l);switch(V1(n,u,a,o.rotation,Q),o.type){case"rect":case"square":case"circle":case"ellipse":case"picture":case"text":case"brush":Tc(n,o,p,f,u,d);break;case"polygon":case"line":case"curve":Gc({ctx:n,shape:o,withAnchors:d,selectionWidth:f,selectionColor:p,currentScale:u});break}n.restore()},Hf=(n,o,u,a)=>({...ri([20,20],n,[0,0],o,u,a),id:L.uniqueId(`${n.type}_`)}),Vf=({disabled:n=!1,scaleRatio:o,shape:u,defaultValue:a,updateValue:l,saveShapes:f,selectionPadding:p})=>{const d=I.useRef(null),Q=I.useRef(f),w=k=>{l(Ic(k.target.innerHTML))};I.useEffect(()=>{if(!d.current)return;const k=d.current,N=D=>{D.preventDefault();const T=D.clipboardData?.getData("text/plain");document.execCommand("insertText",!1,T)};return k.addEventListener("paste",N),k.innerHTML=Ec(a),k.focus(),()=>{k.removeEventListener("paste",N)}},[a]),I.useEffect(()=>{const k=Q.current;return()=>{k()}},[]);const C=I.useMemo(()=>{const{borders:k,center:N}=zt(u,p);return je({point:[k.x,k.y],rotation:-u.rotation,origin:N})},[u,p]);return _.jsx("div",{className:"react-paint-editor-toolbox-edittextbox",ref:d,"data-fontbold":u.style?.fontBold??!1,"data-fontitalic":u.style?.fontItalic??!1,contentEditable:!n,onInput:w,style:{"--react-paint-editor-toolbox-edittextbox-transform":`translate3D(${C[0]*o}px, ${C[1]*o}px, 0) rotate(${Fo(u.rotation)}deg)`,"--react-paint-editor-toolbox-edittextbox-fontsize":`${u.fontSize*o}px`,"--react-paint-editor-toolbox-edittextbox-padding":`${p*o}px`,"--react-paint-editor-toolbox-edittextbox-color":u.style?.strokeColor??"inherit","--react-paint-editor-toolbox-edittextbox-opacity":(u.style?.globalAlpha??100)/100,"--react-paint-editor-toolbox-edittextbox-fontfamily":u.style?.fontFamily??en}})},Wf=(n,o,u,a)=>{if(n.mode==="translate")return{mode:"translate",cursorStartPosition:u,originalShape:o};if(n.mode==="rotate"){const{center:l}=zt(o,a),f=[l[0],l[1]];return{mode:"rotate",cursorStartPosition:u,originalShape:o,center:f}}else if(n.mode==="resize")return{mode:"resize",cursorStartPosition:u,originalShape:o,anchor:n.anchor}},Zf=(n,o,u,a,l,f)=>{if(l){const d=Wn(l,o,a,f,u,!0)||{mode:"default"},Q=Wf(d,l,o,f);if(Q?.mode==="resize"||Q?.mode==="rotate")return{shape:l,mode:Q}}const p=n.find(d=>!!Wn(d,o,a,f,u,!1));return p?{shape:p,mode:{mode:"translate",cursorStartPosition:o,originalShape:p}}:{shape:void 0,mode:{mode:"default"}}},Bf=300,jf=()=>{const n=I.useRef(void 0),o=I.useRef(void 0),u=f=>{const p=new Date().getTime();n.current&&p<n.current+Bf&&o.current?.(f),n.current=new Date().getTime()};return{registerDoubleClickEvent:(f,p)=>{o.current=p,f.addEventListener("click",u),f.addEventListener("touchend",u)},unRegisterDoubleClickEvent:f=>{f.removeEventListener("click",u),f.removeEventListener("touchend",u)}}},zf=(n,o,u,a,l,f,p,d,Q,w,C,k,N,D,T,W,H)=>{if(u.type==="move"&&d!==void 0){const tt=Hn(n,o.current,Q,w,C);D([tt[0]-d[0],tt[1]-d[1]])}if(f==null||f.locked)return;const q=Hn(n,o.current,Q,w,C);if(p.mode==="default"||p.mode==="textedition"){const tt=Wn(f,q,l,W,C,!0)||{mode:"default"};k(tt)}else{const tt=o.current?.getContext("2d");if(!tt)return;const F=$c(tt,f,q,a,l,p,W,H,C);N(F),T(F)}},Uf=({disabled:n=!1,addShape:o,canvasSize:u,drawCanvasRef:a,setActiveTool:l,shapes:f,selectionMode:p,activeTool:d,isInsideComponent:Q,setCanvasOffset:w,selectedShape:C,selectionCanvasRef:k,canvasOffsetStartPosition:N,setSelectedShape:D,setCanvasOffsetStartPosition:T,updateSingleShape:W,gridFormat:H,canvasOffset:q,saveShapes:tt,setSelectionMode:F,selectionPadding:rt,isShiftPressed:pt})=>{const{width:dt,height:vt,scaleRatio:gt}=u,[Z,G]=I.useState({mode:"default"}),{registerDoubleClickEvent:B,unRegisterDoubleClickEvent:ut}=jf();return I.useEffect(()=>{const R=at=>window.requestAnimationFrame(()=>zf(at,k,d,H,q,C,p,N,dt,vt,gt,G,W,w,D,rt,pt));return Q&&(document.addEventListener("mousemove",R),document.addEventListener("touchmove",R)),()=>{Q&&(document.removeEventListener("mousemove",R),document.removeEventListener("touchmove",R))}},[Q,k,C,p,G,H,q,N,dt,vt,gt,W,d,w,D,rt,pt]),I.useEffect(()=>{const R=()=>{p.mode!=="textedition"&&p.mode!=="default"&&(F({mode:"default"}),tt())};return Q&&(document.addEventListener("mouseup",R),document.addEventListener("touchend",R)),()=>{Q&&(document.removeEventListener("mouseup",R),document.removeEventListener("touchend",R))}},[Q,p,tt,F]),I.useEffect(()=>{const R=k.current;if(!R||n)return;const at=yt=>{yt.preventDefault();const Mt=Hn(yt,k.current,dt,vt,gt);if(d.type==="selection"){const{shape:Qt,mode:bt}=Zf(f,Mt,gt,q,C,rt);D(Qt),F(bt)}else d.type==="move"&&T(Mt);if(M1.includes(d.type)){const Qt=a.current?.getContext("2d");if(!Qt)return;if(d.type==="brush"){if(C&&C.type==="brush"){const bt=zc(C,Mt,gt,rt);W(bt),D(bt)}else{const bt=xu(Qt,d,Mt,H,gt,rt);if(!bt)return;o(bt),D(bt)}F({mode:"brush"})}else if(d.type!=="picture"){const bt=xu(Qt,d,Mt,H,gt,rt);o(bt),l(ze),D(bt),F({mode:"resize",cursorStartPosition:[Mt[0]+rt,Mt[1]+rt],originalShape:bt,anchor:d.type==="line"||d.type==="polygon"||d.type==="curve"?0:[1,1]})}}};return R.addEventListener("mousedown",at,{passive:!1}),R.addEventListener("touchstart",at,{passive:!1}),()=>{R.removeEventListener("mousedown",at),R.removeEventListener("touchstart",at)}},[n,k,a,C,d,q,T,f,dt,vt,gt,W,o,l,D,F,rt,H]),I.useEffect(()=>{const R=k.current;if(!R)return;const at=yt=>{if(d.type==="selection"&&C?.type==="text"){const Mt=Hn(yt,k.current,dt,vt,gt);Wn(C,Mt,q,rt)&&F({mode:"textedition",defaultValue:C.value})}};if(Q)return B(R,at),()=>{ut(R)}},[B,ut,Q,k,d,C,dt,vt,gt,q,F,rt]),{hoverMode:Z}},$f=(n,o,u,a,l,f)=>{n.strokeStyle="rgb(220,220,220)",n.lineWidth=1,n.save(),n.scale(a,a),n.beginPath();const p=vr[f-1],d=-l[0]%p,Q=-l[1]%p,w=Math.ceil(o/a/p),C=Math.ceil(u/a/p);for(let k=0;k<w;k++)n.moveTo(d+(k+1)*p,Q),n.lineTo(d+(k+1)*p,Q+u/a);for(let k=0;k<C;k++)n.moveTo(d,Q+(k+1)*p),n.lineTo(d+o/a,Q+(k+1)*p);n.stroke(),n.restore()},Ff=(n,o,u,a,l,f,p,d)=>{const{width:Q,height:w,scaleRatio:C}=u;n.clearRect(0,0,Q,w),H1(n),a&&$f(n,Q,w,C,l,a);for(let k=f.length-1;k>=0;k--)(o.mode!=="textedition"||f[k]!==d)&&ku(n,f[k],C,l,p)},Sf=(n,o,u,a,l,f,p,d,Q)=>{const{width:w,height:C,scaleRatio:k}=u;n.clearRect(0,0,w,C),Q&&a.type!=="brush"&&Df({ctx:n,shape:Q,currentScale:k,canvasOffset:l,selectionPadding:f,selectionWidth:p,selectionColor:d,withAnchors:o.mode!=="textedition"})},qf=I.forwardRef(({gridFormat:n,canGrow:o,disabled:u=!1,canvasSize:a,shapes:l,addShape:f,updateSingleShape:p,selectedShape:d,setSelectedShape:Q,saveShapes:w,activeTool:C,setActiveTool:k,canvasOffsetStartPosition:N,setCanvasOffsetStartPosition:D,canvasOffset:T,setCanvasOffset:W,isInsideComponent:H,selectionMode:q,setSelectionMode:tt,selectionWidth:F,selectionColor:rt,selectionPadding:pt,isEditMode:dt,isShiftPressed:vt},gt)=>{const Z=I.useRef(null),G=I.useRef(null);I.useImperativeHandle(gt,()=>Z.current);const{hoverMode:B}=Uf({disabled:u,addShape:f,canvasSize:a,drawCanvasRef:Z,setActiveTool:k,shapes:l,selectionMode:q,activeTool:C,isInsideComponent:H,setCanvasOffset:W,selectedShape:d,selectionCanvasRef:G,canvasOffsetStartPosition:N,setSelectedShape:Q,setCanvasOffsetStartPosition:D,updateSingleShape:p,gridFormat:n,canvasOffset:T,saveShapes:w,setSelectionMode:tt,selectionPadding:pt,isShiftPressed:vt}),{scaleRatio:ut}=a,R=I.useCallback(at=>{if(d?.type!=="text")return;const yt=Z.current?.getContext("2d");if(!yt)return;const Mt=on(Cl(yt,d,at,pt,T),ut,pt);p(Mt)},[p,d,T,ut,pt]);return I.useEffect(()=>{const at=Z.current?.getContext("2d");at&&window.requestAnimationFrame(()=>Ff(at,q,a,n,T,l,pt,d))},[l,n,q,d,T,a,pt]),I.useEffect(()=>{const at=G.current?.getContext("2d");at&&window.requestAnimationFrame(()=>Sf(at,q,a,C,T,pt,F,rt,d))},[q,d,C,T,a,pt,F,rt]),_.jsx("div",{className:"react-paint-editor-canvas-box",children:_.jsxs("div",{className:"react-paint-editor-canvas-container","data-grow":o,children:[_.jsx("canvas",{className:"react-paint-editor-canvas-drawcanvas",ref:Z,"data-grow":o,width:a.width,height:a.height}),dt&&_.jsx("canvas",{className:"react-paint-editor-canvas-selectioncanvas",ref:G,width:a.width,height:a.height,"data-grow":o,style:{"--react-paint-editor-canvas-cursor":C.type!=="selection"&&C.type!=="move"||B.mode==="resize"?"crosshair":C.type==="move"||B.mode==="translate"?"move":B.mode==="rotate"?"grab":"default"}}),dt&&q.mode==="textedition"&&d?.type==="text"&&_.jsx(Vf,{scaleRatio:a.scaleRatio,disabled:u,shape:d,defaultValue:q.defaultValue,updateValue:R,saveShapes:w,selectionPadding:pt})]})})}),Yf=({disabled:n=!1,ref:o,shape:u,layoutDragging:a,setLayoutDragging:l,handleSelect:f,onMoveShapes:p})=>{const[d,Q]=I.useState(!1);return I.useEffect(()=>{a||Q(!1)},[a]),I.useEffect(()=>{const w=o.current;if(!w)return;const C=()=>{l(void 0)},k=H=>(H.preventDefault&&H.preventDefault(),!1),N=H=>{f(u),H.dataTransfer&&(H.dataTransfer.effectAllowed="move",H.dataTransfer.setData("draggableShapeId",u.id),l(u.id))},D=()=>{a!==u.id&&Q(!0)},T=()=>{Q(!1)},W=H=>(H.stopPropagation(),H.dataTransfer&&p(H.dataTransfer.getData("draggableShapeId"),u.id),!1);return n||(w.addEventListener("dragstart",N),w.addEventListener("dragend",C),w.addEventListener("dragover",k),w.addEventListener("dragenter",D),w.addEventListener("dragleave",T),w.addEventListener("drop",W)),()=>{n||(w.removeEventListener("dragstart",N),w.removeEventListener("dragend",C),w.removeEventListener("dragover",k),w.removeEventListener("dragenter",D),w.removeEventListener("dragleave",T),w.removeEventListener("drop",W))}},[n,o,u,l,f,p,a]),{isOver:d}},Gf=n=>{switch(n){case"brush":return iu;case"line":return cu;case"polygon":return Ko;case"curve":return lu;case"rect":return $n;case"square":return $n;case"circle":return Fn;case"ellipse":return Fn;case"text":return su;case"picture":return Jo;case"triangle":return""}},Lt=I.forwardRef((n,o)=>{if(n.type==="file"||n.type==="color"){const{hidden:u=!1,disabled:a=!1,selected:l=!1,icon:f,children:p,className:d="",title:Q,onClick:w,...C}=n;return _.jsxs("label",{className:`react-paint-editor-button ${d}`,title:Q,onClick:w,"data-disabled":+a,"data-selected":+l,"data-hidden":+u,children:[_.jsx("input",{ref:o,disabled:a,...C}),_.jsxs("span",{className:"react-paint-editor-button-content",children:[p&&_.jsx("span",{className:"react-paint-editor-button-children",children:p}),f&&_.jsx("span",{className:"react-paint-editor-button-icon",dangerouslySetInnerHTML:{__html:f}})]})]})}else{const{hidden:u=!1,disabled:a=!1,selected:l=!1,icon:f,children:p,type:d="button",className:Q="",...w}=n;return _.jsx("button",{className:`react-paint-editor-button ${Q}`,ref:o,disabled:a,"data-disabled":+a,"data-selected":+l,"data-hidden":+u,type:d,...w,children:_.jsxs("span",{className:"react-paint-editor-button-content",children:[p&&_.jsx("span",{className:"react-paint-editor-button-children",children:p}),f&&_.jsx("span",{className:"react-paint-editor-button-icon",dangerouslySetInnerHTML:{__html:f}})]})})}}),Hr=({children:n,title:o="",className:u="",position:a="bottom",fitContainer:l=!1,alignment:f="center"})=>_.jsxs("div",{className:`react-paint-editor-panel ${u}`,"data-fitcontainer":l,"data-position":a,"data-alignment":f,style:{"--react-paint-editor-panel-zindex":rn.PANEL},children:[o&&_.jsx("h3",{className:"react-paint-editor-panel-title",children:o}),n]}),Xf=({disabled:n=!1,shape:o,selected:u,layoutDragging:a,toggleShapeVisibility:l,toggleShapeLock:f,setLayoutDragging:p,handleRemove:d,handleSelect:Q,onMoveShapes:w})=>{const C=I.useRef(null),k=H=>{n||(H.preventDefault(),H.stopPropagation(),d(o))},N=H=>{n||(H.preventDefault(),H.stopPropagation(),Q(o))},D=H=>{n||(H.preventDefault(),H.stopPropagation(),l(o))},T=H=>{n||(H.preventDefault(),H.stopPropagation(),f(o))},{isOver:W}=Yf({disabled:n,ref:C,shape:o,layoutDragging:a,setLayoutDragging:p,handleSelect:Q,onMoveShapes:w});return _.jsxs("div",{className:"react-paint-editor-layout","data-disabled":+n,draggable:!n,"data-is-dragging":+(a===o.id),"data-is-over":+W,onClick:N,"data-selected":+u,ref:C,children:[_.jsx("span",{dangerouslySetInnerHTML:{__html:Gf(o.type)}}),_.jsx("span",{children:o.id}),_.jsx("div",{className:"react-paint-editor-layouts-separator"}),_.jsx(Lt,{className:"react-paint-editor-layouts-visible-button",title:o.visible?"Hide":"Show","data-visible":o.visible!==!1,disabled:n,selected:u,onClick:D,icon:o.visible===!1?tf:Rl}),_.jsx(Lt,{className:"react-paint-editor-layouts-locked-button",title:o.locked?"Locked":"Unlocked","data-locked":!!o.locked,disabled:n,selected:u,onClick:T,icon:o.locked?nf:of}),_.jsx(Lt,{className:"react-paint-editor-layouts-remove-button",title:"Remove",disabled:n,onClick:k,icon:uu})]})},Kf=({gridFormat:n,setGridFormat:o,disabled:u=!1,shapes:a,removeShape:l,toggleShapeVisibility:f,toggleShapeLock:p,selectedShape:d,moveShapes:Q,selectShape:w,isLayoutPanelShown:C})=>{const[k,N]=I.useState(void 0);return C?_.jsx(Hr,{alignment:"right",className:"react-paint-editor-layouts-panel",children:_.jsx("div",{className:"react-paint-editor-layouts-panel-content",children:_.jsxs("div",{className:"react-paint-editor-layouts-scrolling-content",children:[_.jsxs("div",{className:"react-paint-editor-layouts-row",children:[_.jsx("span",{className:"react-paint-editor-layouts-subtitle",children:"Grid"}),_.jsx(Lt,{icon:uf,className:"react-paint-editor-layouts-grid-button",selected:n===0,disabled:u,onClick:()=>o(0)}),["S","M","L"].map((D,T)=>_.jsx(Lt,{className:"react-paint-editor-layouts-grid-button",selected:n===T+1,disabled:u,onClick:()=>o(T+1),children:D},D))]}),_.jsx("hr",{}),_.jsx("div",{className:"react-paint-editor-layouts",children:a.length===0?_.jsx("div",{className:"react-paint-editor-layouts-placeholder",children:"No layer yet"}):a.map(D=>_.jsx(Xf,{shape:D,disabled:u,layoutDragging:k,setLayoutDragging:N,selected:d?.id===D.id,handleSelect:w,handleRemove:l,onMoveShapes:Q,toggleShapeVisibility:f,toggleShapeLock:p},D.id))})]})})}):null},Jf=(n,o)=>L.flow(L.flatMap(u=>{if(!L.isObject(u))return L.filter({type:u},n);const a=L.filter(l=>L.includes(l.type,u.toolsType),n);return a?{...u,toolsType:a}:null}),L.compact)(o),Ou=(n,o=!1)=>{const u=(a,l)=>{if(L.isArray(a))return l};return L.flow(L.map(a=>{if(!L.isObject(a))return null;switch(a.type){case"brush":return L.mergeWith(u,gu,a);case"circle":return L.mergeWith(u,wu,a);case"curve":return L.mergeWith(u,mu,a);case"ellipse":return L.mergeWith(u,Cu,a);case"line":return L.mergeWith(u,yu,a);case"polygon":return L.mergeWith(u,_u,a);case"rect":return L.mergeWith(u,Qu,a);case"square":return L.mergeWith(u,bu,a);case"text":return L.mergeWith(u,Eu,a)}return null}),a=>o?[...a,Po]:a,L.compact)(n)},pe=({type:n,img:o,isActive:u,withText:a=!1,disabled:l=!1,setActive:f})=>{const p=()=>{f(n)};return _.jsx(Lt,{disabled:l,selected:u,onClick:p,title:n.label??n.type,icon:o,children:a?n.label:void 0})},Tu=(n,o)=>!(n.target instanceof Node)||!o?!1:o.contains(n.target),Pf=({activeTool:n,alignment:o,group:u,disabled:a=!1,setActiveToolFromId:l})=>{const f=I.useRef(null),[p,d]=I.useState(!1),[,Q]=I.useTransition(),[w,C]=I.useState(void 0),k=W=>{C(W),l(W.id)};if(I.useEffect(()=>{if(!p)return;const W=H=>{!Tu(H,f.current)&&d(!1)};return document.addEventListener("mousedown",W,{passive:!1}),document.addEventListener("touchstart",W,{passive:!1}),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("touchstart",W)}},[p]),"type"in u)return _.jsx(pe,{disabled:a,type:u,img:u.icon,isActive:n.id===u.id,setActive:k});if(!u.toolsType.length)return null;if(u.toolsType?.length===1)return _.jsx(pe,{disabled:a,type:u.toolsType[0],img:u.toolsType[0].icon,isActive:n.id===u.toolsType[0].id,setActive:k});const N=u?.toolsType.find(W=>W.type===n.type)!==void 0,D=(w?w.icon:u.toolsType&&u.toolsType[0]&&u.toolsType[0].icon)??u.title,T=()=>{w?l(w.id):u.toolsType&&u.toolsType[0]&&k(u.toolsType[0]),Q(()=>{d(!0)})};return _.jsxs("div",{className:"react-paint-editor-toolbargroup-relative",children:[_.jsx(Lt,{selected:N,title:u.title,disabled:a,onClick:T,icon:D}),p&&_.jsx(Hr,{alignment:o,position:"top",children:_.jsx("div",{className:"react-paint-editor-toolbargroup-panel-content","data-vertical":+u.vertical,ref:f,children:u.toolsType.map((W,H)=>_.jsx(pe,{disabled:a,type:W,img:W.icon,isActive:n.id===W.id,setActive:k},H))})})]})},Nu=({disabled:n=!1,withText:o=!1,loadFile:u,type:a,img:l,accept:f})=>{const p=I.useRef(null),d=w=>{w.stopPropagation(),p.current&&(p.current.value="")},Q=w=>{const C=w.target.files?.item(0);C&&u(C)};return _.jsx(Lt,{ref:p,type:"file",onClick:d,onChange:Q,accept:f,title:a.label??a.type,icon:l,children:o?a.label:void 0,disabled:n})},Rf=({activeTool:n,withActionsInMenu:o,hasActionToUndo:u=!1,hasActionToRedo:a=!1,hasActionToClear:l=!1,undoAction:f,redoAction:p,clearCanvas:d,alignment:Q,group:w,vertical:C=!1,disabled:k=!1,withLoadAndSave:N,withExport:D,addPicture:T,loadFile:W,togglePictureUrlModal:H,saveFile:q,exportCanvasInFile:tt,withUploadPicture:F,withUrlPicture:rt})=>{const[pt,dt]=I.useState(!1),[,vt]=I.useTransition(),gt=at=>{dt(!1),W(at)},Z=async at=>{dt(!1),await T(at)},G=()=>{vt(()=>{dt(!0)})},B=w?.tools?.some(at=>at==n.type),ut=(B?n.icon:w.img)??w.title;return I.useEffect(()=>{if(!pt)return;const at=()=>{dt(!1)};return document.addEventListener("click",at),()=>{document.removeEventListener("click",at)}},[pt]),o||F||rt||N||D?_.jsxs("div",{className:"react-paint-editor-toolbox-relative",children:[_.jsx(Lt,{selected:B,title:w.title,disabled:k,onClick:G,icon:ut}),pt&&_.jsx(Hr,{alignment:Q,position:"top",children:_.jsxs("div",{className:"react-paint-editor-toolbox-panel-content","data-vertical":+C,children:[o&&_.jsxs(_.Fragment,{children:[_.jsx(pe,{withText:!0,type:Nr,disabled:k||!u,img:Nr.icon,isActive:n.id===Nr.id,setActive:f}),_.jsx(pe,{withText:!0,type:Mr,disabled:k||!a,img:Mr.icon,isActive:n.id===Mr.id,setActive:p}),_.jsx(pe,{withText:!0,type:Dr,disabled:k||!l,img:Dr.icon,isActive:n.id===Dr.id,setActive:d}),(F||rt||N)&&_.jsx("hr",{})]}),F&&_.jsx(Nu,{withText:!0,type:Iu,disabled:k,loadFile:Z,img:Iu.icon,accept:"image/png, image/gif, image/jpeg, image/svg+xml"}),rt&&_.jsx(Lt,{disabled:k,selected:!1,onClick:H,title:"Add picture from URL",icon:rf,children:"Add picture from URL"}),(F||rt)&&N&&_.jsx("hr",{}),N&&_.jsxs(_.Fragment,{children:[_.jsx(Nu,{withText:!0,type:Au,disabled:k,loadFile:gt,img:Au.icon,accept:"application/JSON"}),_.jsx(pe,{withText:!0,disabled:k,type:ti,img:ti.icon,isActive:n.id===ti.id,setActive:q})]}),D&&_.jsx(pe,{withText:!0,disabled:k,type:Ro,img:Ro.icon,isActive:n.id===Ro.id,setActive:tt})]})})]}):null},ni=({children:n,onClose:o,position:u="center",className:a=""})=>_.jsxs("div",{className:"react-paint-editor-modal","data-position":u,style:{"--react-paint-editor-modal-zindex":rn.PANEL},children:[_.jsx("div",{className:"react-paint-editor-modal-mask",onClick:o}),_.jsx("div",{className:`react-paint-editor-modal-panel ${a}`,children:n})]}),t0=({togglePictureUrlModal:n,addPicture:o})=>{const u=I.useRef(null),a=async l=>{l.preventDefault();const f=u.current?.value;f&&(await o(f),n())};return I.useEffect(()=>{u.current&&u.current.focus()},[]),_.jsx(ni,{className:"react-paint-editor-toolbox-pictureinput-modal",onClose:n,children:_.jsxs("form",{onSubmit:a,children:[_.jsxs("label",{children:["URL ",_.jsx("input",{type:"text",ref:u})]}),_.jsx(Lt,{onClick:n,children:"Annuler"}),_.jsx(Lt,{type:"submit",selected:!0,children:"Ajouter"})]})})},Mu=40,e0=[{title:"brush",toolsType:["brush"],vertical:!1},{title:"lines",toolsType:["line","curve","polygon"],vertical:!1},{title:"shapes",toolsType:["rect","square","circle","ellipse"],vertical:!1},"text"],r0=({width:n,disabled:o=!1,activeTool:u,hasActionToUndo:a=!1,hasActionToRedo:l=!1,hasActionToClear:f=!1,withLoadAndSave:p,withExport:d,clearCanvas:Q,setActiveTool:w,undoAction:C,redoAction:k,addPicture:N,loadFile:D,saveFile:T,exportCanvasInFile:W,availableTools:H,withUrlPicture:q,withUploadPicture:tt})=>{const F=Jf(H,e0),rt=(5+F.length)*Mu,pt=(2+F.length)*Mu,[dt,vt]=I.useState(!1),[gt,Z]=I.useState(!1),[G,B]=I.useState(n<rt),[ut,R]=I.useState(n<pt),at=()=>{vt(It=>!It)},yt=()=>{Z(!0)},Mt=()=>{Z(It=>!It)},Qt=It=>{w(It),vt(!1)},bt=It=>{Qt(H.find(ee=>ee.id===It)??u)};I.useEffect(()=>{B(n<rt),R(n<pt)},[n,rt,pt]);const ve=H.find(It=>It.type===u.type)!==void 0;return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"react-paint-editor-toolbar-toolbox",children:[_.jsxs("div",{className:"react-paint-editor-toolbar-shrinkable",children:[_.jsx(pe,{type:ze,disabled:o,img:ze.icon,isActive:u.id===ze.id,setActive:Qt}),ut?_.jsx(Lt,{disabled:o,onClick:at,title:"Toggle tools",icon:$l,selected:ve}):F.map((It,ee)=>_.jsx(Pf,{disabled:o,activeTool:u,group:It,setActiveToolFromId:bt},ee))]}),!G&&_.jsxs(_.Fragment,{children:[_.jsx(pe,{type:Nr,disabled:o||!a,img:Nr.icon,isActive:u.id===Nr.id,setActive:C}),_.jsx(pe,{type:Mr,disabled:o||!l,img:Mr.icon,isActive:u.id===Mr.id,setActive:k}),_.jsx(pe,{type:Dr,disabled:o||!f,img:Dr.icon,isActive:u.id===Dr.id,setActive:Q})]}),_.jsx(Rf,{withActionsInMenu:G,disabled:o,vertical:!0,alignment:"right",group:{title:"Menu",img:Pl},activeTool:u,addPicture:N,loadFile:D,saveFile:T,togglePictureUrlModal:yt,exportCanvasInFile:W,withUploadPicture:tt,withUrlPicture:q,withLoadAndSave:p,withExport:d,hasActionToUndo:a,hasActionToRedo:l,hasActionToClear:f,undoAction:C,redoAction:k,clearCanvas:Q})]}),dt&&_.jsx(ni,{className:"react-paint-editor-toolbar-modal",onClose:at,children:H.map((It,ee)=>It.type==="picture"?null:_.jsx(pe,{disabled:o,type:It,img:It.icon,withText:!1,isActive:u.id===It.id,setActive:Qt},ee))}),gt&&_.jsx(t0,{togglePictureUrlModal:Mt,addPicture:N})]})},Sn=({selectedSettings:n,setSelectedSettings:o,title:u="Choisissez une couleur",mode:a="fill",disabled:l=!1,values:f,field:p,value:d="",valueChanged:Q})=>{const[w]=I.useState(L.uniqueId("settings_")),C=T=>{const W=L.toNumber(T.target.value);Q(p,L.isNaN(W)?T.target.value:W)},k=T=>{Q(p,T)},N=()=>{o(T=>T===w?void 0:w)},D=n===w;return L.isEmpty(f)?null:_.jsxs(_.Fragment,{children:[_.jsx(Lt,{selected:D,title:u,disabled:l,onClick:N,icon:d==="transparent"?a==="fill"?vu:du:void 0,children:d!=="transparent"&&_.jsx("div",{className:"react-paint-editor-colorfield-color","data-mode":a,style:{"--react-paint-editor-colorfield-color-value":d}})}),D&&_.jsx(Hr,{title:u,alignment:"left",children:_.jsxs("div",{className:"react-paint-editor-colorfield-wrapper",children:[f.map((T,W)=>_.jsx(Lt,{title:T,selected:T===d,color:T,icon:T==="transparent"?a==="fill"?vu:du:void 0,onClick:()=>k(T),children:T!=="transparent"&&_.jsx("div",{className:"react-paint-editor-colorfield-color",color:T,"data-mode":a,style:{"--react-paint-editor-colorfield-color-value":T}})},W)),_.jsx(Lt,{type:"color",title:"Custom color",selected:!L.includes(d,f),value:d,onChange:C,children:_.jsx("div",{className:"react-paint-editor-colorfield-customcolor",style:{"--react-paint-editor-colorfield-color-value":L.includes(d,f)?"var(--react-paint-editor-app-font-color)":d},children:_.jsx("span",{dangerouslySetInnerHTML:{__html:ef}})})})]})})]})},n0=({disabled:n=!1,selectedShape:o,removeShape:u})=>{const a=()=>{u(o)};return _.jsx(Lt,{title:"Delete",disabled:n,"data-disabled":+n,onClick:a,icon:uu})},o0=({disabled:n,toggleLayoutPanel:o})=>_.jsx(Lt,{title:"Toggle layers panel",disabled:n,onClick:o,icon:ql,className:"react-paint-editor-layout-button"}),un=({selectedSettings:n,setSelectedSettings:o,title:u="Choisissez l'intervalle",icon:a,disabled:l=!1,field:f,value:p=1,min:d=1,max:Q=20,step:w=1,unity:C="",valueChanged:k})=>{const N=Math.round(p),[D]=I.useState(L.uniqueId("settings_")),T=q=>{const tt=+q.target.value;k(f,Number.isNaN(tt)?q.target.value:tt)},W=()=>{o(q=>q===D?void 0:D)},H=n===D;return d===Q?null:_.jsxs(_.Fragment,{children:[_.jsx(Lt,{selected:H,title:u,disabled:l,icon:a,onClick:W}),H&&_.jsx(Hr,{title:u,alignment:"left",fitContainer:!0,children:_.jsx("div",{children:_.jsxs("label",{className:"react-paint-editor-rangefield",children:[_.jsx("input",{type:"range",min:d,max:Q,step:w,value:p,onChange:T}),_.jsxs("span",{children:[N,C]})]})})})]})},oi=({CustomOption:n,selectedSettings:o,setSelectedSettings:u,title:a="Choisissez l'option",disabled:l=!1,field:f,icon:p,values:d,defaultValue:Q,valueChanged:w})=>{const[C]=I.useState(L.uniqueId("settings_")),k=T=>{w(f,T)},N=()=>{u(T=>T===C?void 0:C)},D=o===C;return d.length?_.jsxs(_.Fragment,{children:[_.jsx(Lt,{selected:D,title:a,icon:p,disabled:l,onClick:N}),D&&_.jsx(Hr,{title:a,alignment:"left",fitContainer:!0,children:_.jsx("div",{className:"react-paint-editor-selectfield-wrapper",children:d.map(T=>_.jsx(Lt,{title:`${T}`,onClick:()=>k(T),selected:Q==T,style:{"--react-paint-editor-button-padding":"16px"},children:_.jsx(n,{children:T})},T))})})]}):null},i0=({children:n})=>_.jsx("span",{className:"react-paint-editor-fontfamily-option",style:{"--react-paint-editor-fontfamily-family":n},children:n}),Du=({selectedSettings:n,setSelectedSettings:o,disabled:u=!1,values:a,defaultValue:l,valueChanged:f})=>a.length?_.jsx(oi,{selectedSettings:n,setSelectedSettings:o,CustomOption:i0,title:"Police",icon:sf,disabled:u,field:"fontFamily",values:a,defaultValue:l,valueChanged:f}):null,Hu=({selectedSettings:n,setSelectedSettings:o,disabled:u=!1,min:a,max:l,step:f,value:p,valueChanged:d})=>a===l?null:_.jsx(un,{selectedSettings:n,setSelectedSettings:o,icon:Ko,title:"Nombre de points",disabled:u,field:"pointsCount",min:a,max:l,step:f,unity:"",value:p,valueChanged:d}),u0=({children:n})=>_.jsxs("span",{className:"react-paint-editor-linetype-option","data-type":n,children:[_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{})]}),Vu=({selectedSettings:n,setSelectedSettings:o,disabled:u=!1,values:a,defaultValue:l,valueChanged:f})=>a.length?_.jsx(oi,{selectedSettings:n,setSelectedSettings:o,CustomOption:u0,icon:af,title:"Type de traits",disabled:u,field:"lineDash",values:a,defaultValue:l,valueChanged:f}):null,a0=({children:n})=>_.jsxs("span",{className:"react-paint-editor-linearrow-option","data-type":n,children:[_.jsx("span",{className:"react-paint-editor-linearrow-left"}),_.jsx("span",{className:"react-paint-editor-linearrow-right"})]}),Wu=({selectedSettings:n,setSelectedSettings:o,disabled:u=!1,values:a,defaultValue:l,valueChanged:f})=>a.length?_.jsx(oi,{selectedSettings:n,setSelectedSettings:o,CustomOption:a0,title:"Flèches",icon:cf,disabled:u,field:"lineArrow",values:a,defaultValue:l,valueChanged:f}):null,qn=({setSelectedSettings:n,disabled:o=!1,field:u,icon:a,values:l,value:f=!1,valueChanged:p})=>{const[d]=I.useState(L.uniqueId("settings_")),Q=()=>{n(w=>w===d?void 0:d),p(u,!f)};return l.length!==2?null:_.jsx(Lt,{onClick:Q,selected:f,disabled:o,icon:a})},s0=40,ii=({activeTool:n,selectedShape:o,selectedShapeTool:u,disabled:a,selectedSettings:l,setSelectedSettings:f,handleShapeStyleChange:p,handlePolygonLinesCount:d,handleShapeFontFamilyChange:Q})=>o?_.jsx(_.Fragment,{children:u&&_.jsxs(_.Fragment,{children:["strokeColor"in u.settings&&_.jsx(Sn,{selectedSettings:l,setSelectedSettings:f,title:"Couleur du trait",mode:"stroke",disabled:a,field:"strokeColor",value:o.style?.strokeColor,valueChanged:p,values:u.settings.strokeColor.values}),"fillColor"in u.settings&&_.jsx(Sn,{selectedSettings:l,setSelectedSettings:f,title:"Couleur de fond",disabled:a,field:"fillColor",value:o.style?.fillColor,valueChanged:p,values:u.settings.fillColor.values}),"lineWidth"in u.settings&&_.jsx(un,{selectedSettings:l,setSelectedSettings:f,title:"Epaisseur du trait",icon:hu,disabled:a,field:"lineWidth",value:o.style?.lineWidth,valueChanged:p,unity:"px",min:u.settings.lineWidth.min,max:u.settings.lineWidth.max,step:u.settings.lineWidth.step}),"lineDash"in u.settings&&_.jsx(Vu,{selectedSettings:l,setSelectedSettings:f,disabled:a,defaultValue:o.style?.lineDash,valueChanged:p,values:u.settings.lineDash.values}),"lineArrow"in u.settings&&_.jsx(Wu,{selectedSettings:l,setSelectedSettings:f,disabled:a,defaultValue:o.style?.lineArrow,valueChanged:p,values:u.settings.lineArrow.values}),"pointsCount"in u.settings&&_.jsx(Hu,{selectedSettings:l,setSelectedSettings:f,disabled:a,valueChanged:d,min:u.settings.pointsCount.min,max:u.settings.pointsCount.max,step:u.settings.pointsCount.step,value:o.style?.pointsCount}),"fontFamily"in u.settings&&_.jsx(Du,{selectedSettings:l,setSelectedSettings:f,disabled:a,valueChanged:Q,values:u.settings.fontFamily.values,defaultValue:o.style?.fontFamily}),"fontBold"in u.settings&&_.jsx(qn,{setSelectedSettings:f,disabled:a,field:"fontBold",icon:fu,valueChanged:Q,values:u.settings.fontBold.values,value:o.style?.fontBold}),"fontItalic"in u.settings&&_.jsx(qn,{setSelectedSettings:f,disabled:a,field:"fontItalic",icon:pu,valueChanged:Q,values:u.settings.fontItalic.values,value:o.style?.fontItalic}),"opacity"in u.settings&&_.jsx(un,{selectedSettings:l,setSelectedSettings:f,title:"Opacité",icon:au,min:u.settings.opacity.min,max:u.settings.opacity.max,step:u.settings.opacity.step,unity:"%",disabled:a,field:"globalAlpha",value:o.style?.globalAlpha??100,valueChanged:p})]})}):"settings"in n?_.jsxs(_.Fragment,{children:["strokeColor"in n.settings&&_.jsx(Sn,{selectedSettings:l,setSelectedSettings:f,title:"Couleur du trait",mode:"stroke",disabled:a,field:"strokeColor",value:n.settings.strokeColor.default,valueChanged:p,values:n.settings.strokeColor.values}),"fillColor"in n.settings&&_.jsx(Sn,{selectedSettings:l,setSelectedSettings:f,title:"Couleur de fond",disabled:a,field:"fillColor",value:n.settings.fillColor.default,valueChanged:p,values:n.settings.fillColor.values}),"lineWidth"in n.settings&&_.jsx(un,{selectedSettings:l,setSelectedSettings:f,title:"Epaisseur du trait",disabled:a,field:"lineWidth",icon:hu,value:n.settings.lineWidth.default,valueChanged:p,unity:"px",min:n.settings.lineWidth.min,max:n.settings.lineWidth.max,step:n.settings.lineWidth.step}),"lineDash"in n.settings&&_.jsx(Vu,{selectedSettings:l,setSelectedSettings:f,disabled:a,defaultValue:n.settings.lineDash.default,valueChanged:p,values:n.settings.lineDash.values}),"lineArrow"in n.settings&&_.jsx(Wu,{selectedSettings:l,setSelectedSettings:f,disabled:a,defaultValue:n.settings.lineArrow.default,valueChanged:p,values:n.settings.lineArrow.values}),"pointsCount"in n.settings&&_.jsx(Hu,{selectedSettings:l,setSelectedSettings:f,disabled:a,valueChanged:d,min:n.settings.pointsCount.min,max:n.settings.pointsCount.max,step:n.settings.pointsCount.step,value:n.settings.pointsCount.default}),"fontFamily"in n.settings&&_.jsx(Du,{selectedSettings:l,setSelectedSettings:f,disabled:a,valueChanged:Q,values:n.settings.fontFamily.values,defaultValue:n.settings.fontFamily.default}),"fontBold"in n.settings&&_.jsx(qn,{setSelectedSettings:f,disabled:a,field:"fontBold",icon:fu,valueChanged:Q,values:n.settings.fontBold.values,value:n.settings.fontBold.default}),"fontItalic"in n.settings&&_.jsx(qn,{setSelectedSettings:f,disabled:a,field:"fontItalic",icon:pu,valueChanged:Q,values:n.settings.fontItalic.values,value:n.settings.fontItalic.default}),"opacity"in n.settings&&_.jsx(un,{selectedSettings:l,setSelectedSettings:f,title:"Opacité",icon:au,min:n.settings.opacity.min,max:n.settings.opacity.max,step:n.settings.opacity.step,unity:"%",disabled:a,field:"opacity",value:n.settings.opacity.default,valueChanged:p})]}):null,c0=({width:n,disabled:o=!1,availableTools:u,updateToolSettings:a,layersManipulation:l,toggleLayoutPanel:f,activeTool:p,selectedShape:d,canvas:Q,currentScale:w,selectionPadding:C,updateShape:k,removeShape:N})=>{const[D,T]=I.useState(void 0),[W,H]=I.useState(!1),q=()=>{H(G=>!G)},tt=d?L.find({id:d.toolId},u)||L.find({type:d.type},u):void 0,F=(tt?L.size(tt.settings)+1:"settings"in p?L.size(p.settings):0)+(l?1:0),rt=F*s0,[pt,dt]=I.useState(n<rt),vt=(G,B)=>{d?(k(on(L.set(["style",G],B,d),w,C),!0),a(d.toolId||p.id,G,B)):a(p.id,G,B)},gt=(G,B)=>{if(d){if(d.type!=="text")return;const ut=Q?.getContext("2d");if(!ut)return;const R=L.set(["style",G],B,d),at=Xo(ut,R.value,R.width,R.style?.fontBold??!1,R.style?.fontItalic??!1,R.style?.fontFamily),yt=on({...R,fontSize:at,height:at*R.value.length},w,C);k(yt,!0),a(d.toolId||p.id,G,B)}else a(p.id,G,B)},Z=(G,B)=>{if(d){if(d.type!=="polygon")return;k(ul(d,B,w,C),!0),a(d.toolId||p.id,G,B)}else a(p.id,G,B)};return I.useEffect(()=>{dt(n<rt)},[n,rt]),_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"react-paint-editor-settings-bar",children:[pt&&F>2&&_.jsx(Lt,{disabled:o,onClick:q,title:"Toggle settings",icon:lf}),d?_.jsx(_.Fragment,{children:tt&&_.jsxs(_.Fragment,{children:[!pt&&_.jsx(ii,{activeTool:p,selectedShape:d,selectedShapeTool:tt,disabled:o,selectedSettings:D,setSelectedSettings:T,handleShapeStyleChange:vt,handlePolygonLinesCount:Z,handleShapeFontFamilyChange:gt}),_.jsx(n0,{disabled:o,selectedShape:d,removeShape:N})]})}):!pt&&_.jsx(ii,{activeTool:p,selectedShape:d,selectedShapeTool:tt,disabled:o,selectedSettings:D,setSelectedSettings:T,handleShapeStyleChange:vt,handlePolygonLinesCount:Z,handleShapeFontFamilyChange:gt}),_.jsx("div",{className:"react-paint-editor-settings-separator"}),l&&_.jsx(o0,{disabled:o,toggleLayoutPanel:f})]}),W&&_.jsx(ni,{className:"react-paint-editor-settings-modal",onClose:q,position:"bottom",children:_.jsx(ii,{activeTool:p,selectedShape:d,selectedShapeTool:tt,disabled:o,selectedSettings:D,setSelectedSettings:T,handleShapeStyleChange:vt,handlePolygonLinesCount:Z,handleShapeFontFamilyChange:gt})})]})},Ft={ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Delete:"Delete",Backspace:"Backspace",Escape:"Escape",Shift:"Shift",z:"z",Z:"Z",y:"y",Y:"Y"},Yn={Copy:"copy",Paste:"paste"},l0=({gridFormat:n,isInsideComponent:o,selectedShape:u,isEditingText:a,currentScale:l,selectionPadding:f,setSelectedShape:p,removeShape:d,pasteShape:Q,updateShape:w,backwardShape:C,forwardShape:k,setShiftPressed:N})=>{const[D,T]=I.useState(void 0);return I.useEffect(()=>{const W=F=>{u&&(a||(F.preventDefault(),T({...u})))},H=F=>{D&&(a||(F.preventDefault(),Q(Hf(D,n,l,f))))},q=F=>{switch(F.key){case Ft.Shift:N(!1);break}},tt=F=>{if(F.metaKey||F.ctrlKey){if(F.key===Ft.Z||F.key===Ft.z){F.preventDefault(),F.stopPropagation(),C();return}else if(F.key===Ft.Y||F.key===Ft.y){F.preventDefault(),F.stopPropagation(),k();return}}if(F.key===Ft.Shift){N(!0);return}if(!u)return;if(F.key===Ft.Escape){p(void 0);return}if(a)return;const rt={[Ft.ArrowLeft]:[n?-vr[n-1]:-1,0],[Ft.ArrowRight]:[n?vr[n-1]:1,0],[Ft.ArrowDown]:[0,n?vr[n-1]:1],[Ft.ArrowUp]:[0,n?-vr[n-1]:-1]};switch(F.key){case Ft.ArrowLeft:case Ft.ArrowRight:case Ft.ArrowDown:case Ft.ArrowUp:w(ri(rt[F.key],u,[0,0],n,l,f));break;case Ft.Delete:case Ft.Backspace:d(u);break}};return o&&(document.addEventListener("keydown",tt),document.addEventListener("keyup",q),document.addEventListener(Yn.Copy,W),document.addEventListener(Yn.Paste,H)),()=>{o&&(document.removeEventListener("keydown",tt),document.removeEventListener("keyup",q),document.removeEventListener(Yn.Copy,W),document.removeEventListener(Yn.Paste,H))}},[o,f,n,D,a,u,l,w,d,p,Q,C,k,N]),{}},f0=({disabled:n,componentRef:o})=>{const[u,a]=I.useState(!1);return I.useEffect(()=>{const l=f=>{a(Tu(f,o.current))};return n?a(!1):(document.addEventListener("mousedown",l,{passive:!0}),document.addEventListener("touchstart",l,{passive:!0})),()=>{n||(document.removeEventListener("mousedown",l),document.removeEventListener("touchstart",l))}},[n,o]),{isInsideComponent:u}},p0=(n=L.noop,o,u)=>{const a=I.useRef([]),l=I.useRef(n);l.current=n;const[f,p]=I.useState(void 0),[d,Q]=I.useState({states:[{shapes:[],selectedShape:void 0}],cursor:0}),w=d.cursor>0,C=d.cursor<d.states.length-1,k=a.current.length>0,N=I.useCallback(()=>{Q(Z=>L.isEqual(Z.states[Z.cursor].shapes,a.current)?Z:{states:[...Z.states.slice(0,Z.cursor+1),{shapes:a.current,selectedShape:f}],cursor:Z.cursor+1})},[f]),D=I.useCallback(Z=>{a.current=[Z,...a.current]},[]),T=I.useCallback(async(Z,G=rr,B=rr)=>{const ut=await Af(Z,G,B,u.scaleRatio,o);return D(ut),N(),ut},[D,N,u,o]),W=I.useCallback((Z,G=!1)=>{a.current=a.current.map(B=>B.id===f?.id?Z:B),p(B=>B?.id===Z.id?Z:B),G&&N()},[f,N]),H=I.useCallback(Z=>{const G=Z.map(B=>L.omit(["chosen"],B));a.current=G,N()},[N]),q=I.useCallback(Z=>{p(G=>G?.id===Z.id?void 0:G),a.current=L.remove({id:Z.id},a.current),N()},[N]),tt=I.useCallback(Z=>{Q(G=>{const B=Z(G);return a.current=G.states[B].shapes,p(G.states[B].selectedShape),L.set("cursor",B,G)})},[]),F=I.useCallback(()=>{tt(Z=>Math.max(0,Z.cursor-1))},[tt]),rt=I.useCallback(()=>{tt(Z=>Math.min(Z.states.length-1,Z.cursor+1))},[tt]),pt=I.useCallback((Z=[],G=!1)=>{p(void 0),a.current=Z,Q(B=>G?{states:[{shapes:Z,selectedShape:void 0}],cursor:0}:{states:[...B.states.slice(0,B.cursor+1),{shapes:Z,selectedShape:void 0}],cursor:B.cursor+1})},[]),dt=I.useCallback((Z,G)=>{const B=a.current,ut=L.findIndex({id:Z},B),R=L.findIndex({id:G},B);ut<R?H([...L.slice(0,ut,B),...L.slice(ut+1,R+1,B),B[ut],...L.slice(R+1,B.length,B)]):H([...L.slice(0,R,B),B[ut],...L.slice(R,ut,B),...L.slice(ut+1,B.length,B)])},[H]),vt=I.useCallback(Z=>{const G=a.current,B=L.findIndex({id:Z.id},G);if(B<0)return;const ut=L.set("visible",Z.visible===!1,Z);p(R=>R?.id===ut.id?ut:R),H(L.set(B,ut,G))},[H]),gt=I.useCallback(Z=>{const G=a.current,B=L.findIndex({id:Z.id},G);if(B<0)return;const ut=L.set("locked",!Z.locked,Z);p(R=>R?.id===ut.id?ut:R),H(L.set(B,ut,G))},[H]);return I.useEffect(()=>{l.current()},[d]),I.useEffect(()=>{a.current=a.current.map(Z=>on(Z,u.scaleRatio,o)),p(Z=>Z===void 0?void 0:a.current.find(G=>G.id===Z.id))},[u,o]),{shapesRef:a,selectedShape:f,addShape:D,addPictureShape:T,moveShapes:dt,saveShapes:N,setSelectedShape:p,toggleShapeVisibility:vt,toggleShapeLock:gt,removeShape:q,updateShape:W,backwardShape:F,forwardShape:rt,clearShapes:pt,canGoBackward:w,canGoForward:C,canClear:k}},Zu={type:"infos",duration:4e3},Bu=500,ju=100,h0=({type:n,text:o,duration:u})=>{const[a,l]=I.useState(!1);return I.useEffect(()=>{const f=setTimeout(()=>{l(!0)},ju),p=setTimeout(()=>{l(!1)},u-Bu-ju);return()=>{clearTimeout(f),clearTimeout(p)}},[u]),_.jsx("div",{className:"react-paint-editor-snackbar","data-is-shown":+a,"data-type":n,style:{"--react-paint-editor-panel-transition-duration":`${Bu}ms`},children:o})},d0=({snackbarList:n})=>_.jsx("div",{className:"react-paint-editor-snackbar-container",style:{"--react-paint-editor-snackbar-zindex":rn.PANEL},children:n.map(o=>_.jsx(h0,{...o},o.id))}),v0=()=>{const n=I.useRef([]),[o,u]=I.useState([]),a=f=>{u(p=>p.filter(d=>d.id!==f))},l=({type:f=Zu.type,duration:p=Zu.duration,text:d})=>{const Q={id:L.uniqueId("snackbar_"),duration:p,type:f,text:d};u(w=>[...w,Q]),n.current=[...n.current,setTimeout(()=>a(Q.id),p)]};return I.useEffect(()=>()=>{for(const f of n.current)clearTimeout(f)},[]),{snackbarList:o,addSnackbar:l}},zu=300,g0=({isLoading:n=!1})=>{const[o,u]=I.useState("hidden");return I.useEffect(()=>{if(n)u("visible");else{u("fadeOut");const a=setTimeout(()=>u("hidden"),zu);return()=>{clearTimeout(a)}}},[n]),o==="hidden"?null:_.jsx("div",{className:"react-paint-editor-loading","data-loading":o,style:{"--react-paint-editor-loading-zindex":rn.LOADING,"--react-paint-editor-loading-transition-duration":`${zu}ms`},children:_.jsxs("div",{className:"react-paint-editor-loader",children:[_.jsx("div",{}),_.jsx("div",{}),_.jsx("div",{}),_.jsx("div",{})]})})},y0=({onResized:n,element:o})=>{I.useEffect(()=>{const u=o.current;if(!u)return;const a=new ResizeObserver(l=>{const f=l?.[0]?.borderBoxSize?.[0],{width:p,height:d}=f?{width:f.inlineSize,height:f.blockSize}:l?.[0].contentRect;n(p,d)});return a.observe(u),()=>{a.unobserve(u)}},[o,n])},ui={layersManipulation:!0,grid:0,canGrow:!1,canShrink:!0,withExport:!0,withLoadAndSave:!0,withUploadPicture:!0,withUrlPicture:!1,availableTools:bf,clearCallback:"empty",uiStyle:{toolbarBackgroundColor:"white",dividerColor:"#36418129",fontRadius:8,fontDisabledColor:"#3641812b",fontDisabledBackgroundColor:"transparent",fontColor:"#364181",fontBackgroundColor:"transparent",fontSelectedColor:"white",fontSelectedBackgroundColor:"#364181",fontHoverColor:"#364181",fontHoverBackgroundColor:"#afd8d8",canvasBackgroundColor:"white",canvasSelectionColor:T1,canvasSelectionWidth:2,canvasSelectionPadding:0}};return({width:n=1e3,height:o=600,shapes:u,className:a="",mode:l="editor",disabled:f=!1,onDataChanged:p,apiRef:d,options:Q=ui})=>{const{layersManipulation:w,grid:C,canGrow:k,canShrink:N,withExport:D,withLoadAndSave:T,withUploadPicture:W,withUrlPicture:H,clearCallback:q,availableTools:tt}={...ui,...Q},{toolbarBackgroundColor:F,dividerColor:rt,fontRadius:pt,fontDisabledColor:dt,fontDisabledBackgroundColor:vt,fontColor:gt,fontBackgroundColor:Z,fontSelectedColor:G,fontSelectedBackgroundColor:B,fontHoverColor:ut,fontHoverBackgroundColor:R,canvasBackgroundColor:at,canvasSelectionColor:yt,canvasSelectionWidth:Mt,canvasSelectionPadding:Qt}={...ui.uiStyle,...Q?.uiStyle??{}},bt=l!=="viewer",ve=f||!bt,It=I.useRef(null),ee=I.useRef(null),[Xt,kt]=I.useState({width:n,height:o,scaleRatio:1}),[Ne,Y]=I.useState(Ou(tt,W||H));I.useEffect(()=>{Y(Ou(tt,W||H))},[tt,W,H]);const{isInsideComponent:M}=f0({disabled:ve,componentRef:It}),[z,$]=I.useState(!1),[nt,Vt]=I.useState(!1),[Ut,St]=I.useState([0,0]),[Wt,Kt]=I.useState(void 0),[or,Vr]=I.useState(ze),[Gn,ai]=I.useState({mode:"default"}),[v,si]=I.useState(C),[an,ci]=I.useState(!1),{shapesRef:Ot,selectedShape:Wr,addShape:gr,addPictureShape:Xn,moveShapes:Zr,setSelectedShape:qt,removeShape:Br,updateShape:Me,backwardShape:De,forwardShape:ir,clearShapes:re,saveShapes:Ue,toggleShapeVisibility:Kn,toggleShapeLock:ge,canGoBackward:ur,canGoForward:ye,canClear:ar}=p0(p,Qt,Xt),{snackbarList:Ie,addSnackbar:ne}=v0(),Le=I.useCallback(ft=>{qt(void 0),Vr(ft)},[qt]),li=I.useCallback((ft,wt,Fe)=>{Y(_r=>_r.map(Se=>Se.id===ft?L.set(["settings",wt,"default"],Fe,Se):Se)),Vr(_r=>_r.id===ft?L.set(["settings",wt,"default"],Fe,_r):_r)},[]),fi=I.useCallback(()=>{Le(ze),De()},[Le,De]),pi=I.useCallback(()=>{Le(ze),ir()},[Le,ir]),jr=I.useCallback((ft=[],wt=!1)=>{re(ft,wt),Le(ze),St([0,0])},[Le,re]),He=I.useCallback(async(ft,wt=!0)=>{const Fe=await Ul(ft,Xt.scaleRatio,Qt);jr(Fe,wt)},[jr,Xt,Qt]),hi=I.useCallback(()=>{typeof q!="string"?He({shapes:q()},!1):q==="defaultShapes"&&u!==void 0?He({shapes:u},!1):jr()},[jr,He,u,q]),yr=I.useCallback(ft=>{Vr(ze),qt(ft)},[qt]),$e=I.useCallback(ft=>{gr(ft),yr(ft)},[gr,yr]),Ve=I.useCallback(()=>{$(!0);try{const ft=ee.current&&ou(Ot.current,Ut,n,o,Qt);if(!ft)throw new Error;nu(ft,"drawing.png"),$(!1)}catch(ft){ft instanceof Error&&ne({type:"error",text:"L'export a échoué"}),console.warn(ft)}finally{$(!1)}},[ne,Ot,Ut,n,o,Qt]),di=I.useCallback(()=>{$(!0);try{const ft=jl(Ot.current,n,o);if(!ft)throw new Error("L'encodage a échoué");nu(ft,"drawing.json"),$(!1)}catch(ft){ft instanceof Error&&ne({type:"error",text:"L'enregistrement a échoué"}),console.warn(ft)}finally{$(!1)}},[Ot,ne,n,o]),zr=I.useCallback(async ft=>{$(!0);try{const wt=await zl(ft);await He(wt),ne({type:"success",text:"Fichier chargé !"})}catch(wt){wt instanceof Error&&ne({type:"error",text:"Le chargement a échoué"}),console.warn(wt)}finally{$(!1)}},[He,ne]),_e=I.useCallback(async ft=>{$(!0);try{const wt=await Xn(ft,n,o);yr(wt)}catch(wt){wt instanceof Error&&ne({type:"error",text:"Le chargement a échoué"}),console.warn(wt)}finally{$(!1)}},[Xn,yr,ne,n,o]),vi=I.useCallback(ft=>{const wt=ft/n;kt({width:ft,height:o*wt,scaleRatio:wt})},[n,o]);l0({isInsideComponent:M,selectionPadding:Qt,gridFormat:v,isEditingText:Gn.mode==="textedition",selectedShape:Wr,currentScale:Xt.scaleRatio,setSelectedShape:qt,removeShape:Br,pasteShape:$e,updateShape:Me,backwardShape:De,forwardShape:ir,setShiftPressed:ci}),y0({element:It,onResized:vi}),I.useEffect(()=>{M||qt(void 0)},[M,qt]),I.useEffect(()=>{u!==void 0&&He({shapes:u})},[He,u]),I.useEffect(()=>{d&&(d.current={getCurrentImage:()=>ee.current?ou(Ot.current,Ut,n,o,Qt):void 0,getCurrentData:()=>P1(Ot.current,n,o)})},[d,Ot,Ut,n,o,Qt]);const gi=`${a}${nt?" react-paint-editor-layout-opened":""} react-paint-editor-app`;return _.jsxs("div",{ref:It,className:gi,"data-grow":k,"data-shrink":N,style:{"--react-paint-editor-app-canvaswidth":`${n}px`,"--react-paint-editor-app-toolbar-bg":F,"--react-paint-editor-app-divider-color":rt,"--react-paint-editor-app-font-radius":pt,"--react-paint-editor-app-font-disabled-color":dt,"--react-paint-editor-app-font-disabled-bg":vt,"--react-paint-editor-app-font-color":gt,"--react-paint-editor-app-font-bg":Z,"--react-paint-editor-app-font-selected-color":G,"--react-paint-editor-app-font-selected-bg":B,"--react-paint-editor-app-font-hover-color":ut,"--react-paint-editor-app-font-hover-bg":R,"--react-paint-editor-app-canvas-bg":at},children:[bt&&_.jsx(r0,{width:Xt.width,disabled:ve,activeTool:or,clearCanvas:hi,setActiveTool:Le,exportCanvasInFile:Ve,saveFile:di,loadFile:zr,addPicture:_e,hasActionToUndo:ur,hasActionToRedo:ye,hasActionToClear:ar,undoAction:fi,redoAction:pi,availableTools:Ne,withExport:D,withLoadAndSave:T,withUploadPicture:W,withUrlPicture:H}),_.jsxs("div",{className:"react-paint-editor-app-row","data-grow":k,style:{"--react-paint-editor-app-row-zindex":rn.APP,"--react-paint-editor-app-row-width":Xt.width,"--react-paint-editor-app-row-aspectratio":`calc(${Xt.width} / ${Xt.height})`},children:[_.jsx(qf,{canGrow:k,gridFormat:v,disabled:ve,isInsideComponent:M,activeTool:or,setActiveTool:Vr,canvasOffsetStartPosition:Wt,setCanvasOffsetStartPosition:Kt,shapes:Ot.current,addShape:gr,updateSingleShape:Me,selectedShape:Wr,setSelectedShape:qt,canvasOffset:Ut,setCanvasOffset:St,saveShapes:Ue,ref:ee,canvasSize:Xt,selectionMode:Gn,setSelectionMode:ai,selectionColor:yt,selectionWidth:Mt,selectionPadding:Qt,isEditMode:bt,isShiftPressed:an}),bt&&w&&_.jsx(Kf,{gridFormat:v,setGridFormat:si,disabled:ve,shapes:Ot.current,moveShapes:Zr,selectedShape:Wr,removeShape:Br,selectShape:yr,toggleShapeVisibility:Kn,toggleShapeLock:ge,isLayoutPanelShown:nt})]}),bt&&_.jsxs(_.Fragment,{children:[_.jsx(c0,{width:Xt.width,disabled:ve,activeTool:or,availableTools:Ne,selectedShape:Wr,selectionPadding:Qt,removeShape:Br,updateShape:Me,canvas:ee.current,currentScale:Xt.scaleRatio,layersManipulation:w,toggleLayoutPanel:()=>{Vt(ft=>!ft)},updateToolSettings:li}),_.jsx(g0,{isLoading:z}),_.jsx(d0,{snackbarList:Ie})]})]})}});
27
+ }`;var ot=sc(function(){return Zs(_,F+"return "+O).apply(v,b)});if(ot.source=O,c1(ot))throw ot;return ot}function mh(t){return _t(t).toLowerCase()}function Qh(t){return _t(t).toUpperCase()}function bh(t,e,r){if(t=_t(t),t&&(r||e===v))return pt(t);if(!t||!(e=pe(e)))return t;var i=Kt(t),c=Kt(e);return cr(i,it(i,c),Gt(i,c)+1).join("")}function wh(t,e,r){if(t=_t(t),t&&(r||e===v))return t.slice(0,nr(t)+1);if(!t||!(e=pe(e)))return t;var i=Kt(t);return cr(i,0,Gt(i,Kt(e))+1).join("")}function Ch(t,e,r){if(t=_t(t),t&&(r||e===v))return t.replace(Li,"");if(!t||!(e=pe(e)))return t;var i=Kt(t);return cr(i,it(i,Kt(e))).join("")}function Eh(t,e){var r=li,i=fi;if(Lt(e)){var c="separator"in e?e.separator:c;r="length"in e?at(e.length):r,i="omission"in e?pe(e.omission):i}t=_t(t);var h=t.length;if(xt(t)){var g=Kt(t);h=g.length}if(r>=h)return t;var _=r-Vt(i);if(_<1)return i;var b=g?cr(g,0,_).join(""):t.slice(0,_);if(c===v)return b+i;if(g&&(_+=b.length-_),k1(c)){if(t.slice(_).search(c)){var L,A=b;for(c.global||(c=m1(c.source,_t(Yu.exec(c))+"g")),c.lastIndex=0;L=c.exec(A);)var O=L.index;b=b.slice(0,O===v?_:O)}}else if(t.indexOf(pe(c),_)!=_){var W=b.lastIndexOf(c);W>-1&&(b=b.slice(0,W))}return b+i}function Ah(t){return t=_t(t),t&&I0.test(t)?t.replace(Fu,x3):t}function Vs(t,e,r){return t=_t(t),e=r?v:e,e===v?Te(t)?ai(t):V(t):t.match(e)||[]}function Ih(t){var e=t==null?0:t.length,r=P();return t=e?C(t,function(i){if(typeof i[1]!="function")throw new we(Nt);return[r(i[0]),i[1]]}):[],st(function(i){for(var c=-1;++c<e;){var h=t[c];if(u(h[0],this,i))return u(h[1],this,i)}})}function Lh(t){return n2(_e(t,St))}function p1(t){return function(){return t}}function xh(t,e){return t==null||t!==t?e:t}function ce(t){return t}function h1(t){return ka(typeof t=="function"?t:_e(t,St))}function kh(t){return Ta(_e(t,St))}function Oh(t,e){return Na(t,_e(e,St))}function d1(t,e,r){var i=zt(e),c=io(e,i);r!=null||Lt(e)&&(c.length||!i.length)||(r=e,e=t,t=this,c=io(e,zt(e)));var h=!(Lt(r)&&"chain"in r&&!r.chain),g=Pe(t);return l(c,function(_){var b=e[_];t[_]=b,g&&(t.prototype[_]=function(){var L=this.__chain__;if(h||L){var A=t(this.__wrapped__);return(A.__actions__=ue(this.__actions__)).push({func:b,args:arguments,thisArg:t}),A.__chain__=L,A}return b.apply(t,k([this.value()],arguments))})}),t}function Th(){return qt._===this&&(qt._=Ph),this}function v1(){}function Nh(t){return t=at(t),st(function(e){return Da(e,t)})}function Ws(t){return o1(t)?mt(Ze(t)):Q2(t)}function Dh(t){return function(e){return t==null?v:wr(t,e)}}function g1(){return[]}function y1(){return!1}function Mh(){return{}}function Hh(){return""}function Vh(){return!0}function Wh(t,e){if(t=at(t),t<1||t>He)return[];var r=ge,i=Jt(t,ge);e=P(e),t-=ge;for(var c=tt(i,e);++r<t;)e(r);return c}function Zh(t){return rt(t)?C(t,Ze):he(t)?[t]:ue(Rs(_t(t)))}function Bh(t){var e=++Kh;return _t(t)+e}function jh(t){return t&&t.length?oo(t,ce,Bi):v}function zh(t,e){return t&&t.length?oo(t,P(e,2),Bi):v}function Uh(t){return dt(t,ce)}function $h(t,e){return dt(t,P(e,2))}function Fh(t){return t&&t.length?oo(t,ce,$i):v}function Sh(t,e){return t&&t.length?oo(t,P(e,2),$i):v}function qh(t){return t&&t.length?S(t,ce):0}function Yh(t,e){return t&&t.length?S(t,P(e,2)):0}E=E==null?qt:Fr.defaults(qt.Object(),E,Fr.pick(qt,g3));var Wt=E.Array,Eo=E.Date,_1=E.Error,Zs=E.Function,Xr=E.Math,Et=E.Object,m1=E.RegExp,Gh=E.String,we=E.TypeError,Ao=Wt.prototype,Xh=Zs.prototype,Kr=Et.prototype,Io=E["__core-js_shared__"],Lo=Xh.toString,Qt=Kr.hasOwnProperty,Kh=0,Bs=function(){var t=/[^.]+$/.exec(Io&&Io.keys&&Io.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),xo=Kr.toString,Jh=Lo.call(Et),Ph=qt._,Rh=m1("^"+Lo.call(Qt).replace(Ii,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ko=ha?E.Buffer:v,lr=E.Symbol,Oo=E.Uint8Array,js=ko?ko.allocUnsafe:v,To=j(Et.getPrototypeOf,Et),zs=Et.create,Us=Kr.propertyIsEnumerable,No=Ao.splice,$s=lr?lr.isConcatSpreadable:v,wn=lr?lr.iterator:v,Ar=lr?lr.toStringTag:v,Do=function(){try{var t=Cr(Et,"defineProperty");return t({},"",{}),t}catch{}}(),t7=E.clearTimeout!==qt.clearTimeout&&E.clearTimeout,e7=Eo&&Eo.now!==qt.Date.now&&Eo.now,r7=E.setTimeout!==qt.setTimeout&&E.setTimeout,Mo=Xr.ceil,Ho=Xr.floor,Q1=Et.getOwnPropertySymbols,n7=ko?ko.isBuffer:v,Fs=E.isFinite,o7=Ao.join,i7=j(Et.keys,Et),Zt=Xr.max,Jt=Xr.min,u7=Eo.now,a7=E.parseInt,Ss=Xr.random,s7=Ao.reverse,b1=Cr(E,"DataView"),Cn=Cr(E,"Map"),w1=Cr(E,"Promise"),Jr=Cr(E,"Set"),En=Cr(E,"WeakMap"),An=Cr(Et,"create"),Vo=En&&new En,Pr={},c7=Er(b1),l7=Er(Cn),f7=Er(w1),p7=Er(Jr),h7=Er(En),Wo=lr?lr.prototype:v,In=Wo?Wo.valueOf:v,qs=Wo?Wo.toString:v,Rr=function(){function t(){}return function(e){if(!Lt(e))return{};if(zs)return zs(e);t.prototype=e;var r=new t;return t.prototype=v,r}}();s.templateSettings={escape:x0,evaluate:k0,interpolate:qu,variable:"",imports:{_:s}},s.prototype=B.prototype,s.prototype.constructor=s,J.prototype=Rr(B.prototype),J.prototype.constructor=J,z.prototype=Rr(B.prototype),z.prototype.constructor=z,mr.prototype.clear=T3,mr.prototype.delete=N3,mr.prototype.get=D3,mr.prototype.has=M3,mr.prototype.set=H3,qe.prototype.clear=V3,qe.prototype.delete=W3,qe.prototype.get=Z3,qe.prototype.has=B3,qe.prototype.set=j3,Ye.prototype.clear=z3,Ye.prototype.delete=U3,Ye.prototype.get=$3,Ye.prototype.has=F3,Ye.prototype.set=S3,Qr.prototype.add=Qr.prototype.push=q3,Qr.prototype.has=Y3,ke.prototype.clear=G3,ke.prototype.delete=X3,ke.prototype.get=K3,ke.prototype.has=J3,ke.prototype.set=P3;var fr=Ya(Ve),Ys=Ya(Zi,!0),C1=Ga(),Gs=Ga(!0),Xs=Vo?function(t,e){return Vo.set(t,e),t}:ce,d7=Do?function(t,e){return Do(t,"toString",{configurable:!0,enumerable:!1,value:p1(e),writable:!0})}:ce,v7=st,Ks=t7||function(t){return qt.clearTimeout(t)},g7=Jr&&1/nt(new Jr([,-0]))[1]==$e?function(t){return new Jr(t)}:v1,E1=Vo?function(t){return Vo.get(t)}:v1,A1=Q1?function(t){return t==null?[]:(t=Et(t),d(Q1(t),function(e){return Us.call(t,e)}))}:g1,Js=Q1?function(t){for(var e=[];t;)k(e,A1(t)),t=To(t);return e}:g1,Pt=ne;(b1&&Pt(new b1(new ArrayBuffer(1)))!=Ur||Cn&&Pt(new Cn)!=Le||w1&&Pt(w1.resolve())!=$u||Jr&&Pt(new Jr)!=xe||En&&Pt(new En)!=pn)&&(Pt=function(t){var e=ne(t),r=e==Se?t.constructor:v,i=r?Er(r):"";if(i)switch(i){case c7:return Ur;case l7:return Le;case f7:return $u;case p7:return xe;case h7:return pn}return e});var y7=Io?Pe:y1,Ps=ps(Xs),Ln=r7||function(t,e){return qt.setTimeout(t,e)},I1=ps(d7),Rs=Y2(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(N0,function(r,i,c,h){e.push(c?h.replace(j0,"$1"):i||r)}),e}),_7=st(function(t,e){return Dt(t)?vn(t,Yt(e,1,Dt,!0)):[]}),m7=st(function(t,e){var r=Qe(e);return Dt(r)&&(r=v),Dt(t)?vn(t,Yt(e,1,Dt,!0),P(r,2)):[]}),Q7=st(function(t,e){var r=Qe(e);return Dt(r)&&(r=v),Dt(t)?vn(t,Yt(e,1,Dt,!0),v,r):[]}),b7=st(function(t){var e=C(t,Ki);return e.length&&e[0]===t[0]?ji(e):[]}),w7=st(function(t){var e=Qe(t),r=C(t,Ki);return e===Qe(r)?e=v:r.pop(),r.length&&r[0]===t[0]?ji(r,P(e,2)):[]}),C7=st(function(t){var e=Qe(t),r=C(t,Ki);return e=typeof e=="function"?e:v,e&&r.pop(),r.length&&r[0]===t[0]?ji(r,v,e):[]}),E7=st(_s),A7=Ke(function(t,e){var r=t==null?0:t.length,i=Wi(t,e);return Va(t,C(e,function(c){return Je(c,r)?+c:c}).sort(Fa)),i}),I7=st(function(t){return ar(Yt(t,1,Dt,!0))}),L7=st(function(t){var e=Qe(t);return Dt(e)&&(e=v),ar(Yt(t,1,Dt,!0),P(e,2))}),x7=st(function(t){var e=Qe(t);return e=typeof e=="function"?e:v,ar(Yt(t,1,Dt,!0),v,e)}),k7=st(function(t,e){return Dt(t)?vn(t,e):[]}),O7=st(function(t){return Xi(d(t,Dt))}),T7=st(function(t){var e=Qe(t);return Dt(e)&&(e=v),Xi(d(t,Dt),P(e,2))}),N7=st(function(t){var e=Qe(t);return e=typeof e=="function"?e:v,Xi(d(t,Dt),v,e)}),D7=st(s1),M7=st(function(t){var e=t.length,r=e>1?t[e-1]:v;return r=typeof r=="function"?(t.pop(),r):v,ms(t,r)}),H7=Ke(function(t){var e=t.length,r=e?t[0]:0,i=this.__wrapped__,c=function(h){return Wi(h,t)};return!(e>1||this.__actions__.length)&&i instanceof z&&Je(r)?(i=i.slice(r,+r+(e?1:0)),i.__actions__.push({func:_o,args:[c],thisArg:v}),new J(i,this.__chain__).thru(function(h){return e&&!h.length&&h.push(v),h})):this.thru(c)}),V7=co(function(t,e,r){Qt.call(t,r)?++t[r]:Ge(t,r,1)}),W7=Ka(ds),Z7=Ka(vs),B7=co(function(t,e,r){Qt.call(t,r)?t[r].push(e):Ge(t,r,[e])}),j7=st(function(t,e,r){var i=-1,c=typeof e=="function",h=ae(t)?Wt(t.length):[];return fr(t,function(g){h[++i]=c?u(e,g,r):gn(g,e,r)}),h}),z7=co(function(t,e,r){Ge(t,r,e)}),U7=co(function(t,e,r){t[r?0:1].push(e)},function(){return[[],[]]}),$7=st(function(t,e){if(t==null)return[];var r=e.length;return r>1&&oe(t,e[0],e[1])?e=[]:r>2&&oe(e[0],e[1],e[2])&&(e=[e[0]]),Ma(t,Yt(e,1),[])}),Zo=e7||function(){return qt.Date.now()},L1=st(function(t,e,r){var i=ee;if(r.length){var c=U(r,Yr(L1));i|=ve}return Xe(t,i,e,r,c)}),tc=st(function(t,e,r){var i=ee|Ue;if(r.length){var c=U(r,Yr(tc));i|=ve}return Xe(e,i,t,r,c)}),F7=st(function(t,e){return Ea(t,1,e)}),S7=st(function(t,e,r){return Ea(t,be(e)||0,r)});Qo.Cache=Ye;var q7=v7(function(t,e){e=e.length==1&&rt(e[0])?C(e[0],yt(P())):C(Yt(e,1),yt(P()));var r=e.length;return st(function(i){for(var c=-1,h=Jt(i.length,r);++c<h;)i[c]=e[c].call(this,i[c]);return u(t,this,i)})}),x1=st(function(t,e){return Xe(t,ve,v,e,U(e,Yr(x1)))}),ec=st(function(t,e){return Xe(t,ur,v,e,U(e,Yr(ec)))}),Y7=Ke(function(t,e){return Xe(t,re,v,v,v,e)}),G7=ho(Bi),X7=ho(function(t,e){return t>=e}),Ir=La(function(){return arguments}())?La:function(t){return kt(t)&&Qt.call(t,"callee")&&!Us.call(t,"callee")},rt=Wt.isArray,K7=da?yt(da):l2,pr=n7||y1,J7=va?yt(va):f2,rc=ga?yt(ga):h2,k1=ya?yt(ya):d2,nc=_a?yt(_a):v2,tn=ma?yt(ma):g2,P7=ho($i),R7=ho(function(t,e){return t<=e}),td=Sr(function(t,e){if(Qn(e)||ae(e))return We(e,zt(e),t),v;for(var r in e)Qt.call(e,r)&&dn(t,r,e[r])}),oc=Sr(function(t,e){We(e,se(e),t)}),Bo=Sr(function(t,e,r,i){We(e,se(e),t,i)}),ed=Sr(function(t,e,r,i){We(e,zt(e),t,i)}),rd=Ke(Wi),nd=st(function(t,e){t=Et(t);var r=-1,i=e.length,c=i>2?e[2]:v;for(c&&oe(e[0],e[1],c)&&(i=1);++r<i;)for(var h=e[r],g=se(h),_=-1,b=g.length;++_<b;){var L=g[_],A=t[L];(A===v||Oe(A,Kr[L])&&!Qt.call(t,L))&&(t[L]=h[L])}return t}),od=st(function(t){return t.push(v,ns),u(ic,v,t)}),id=Pa(function(t,e,r){e!=null&&typeof e.toString!="function"&&(e=xo.call(e)),t[e]=r},p1(ce)),ud=Pa(function(t,e,r){e!=null&&typeof e.toString!="function"&&(e=xo.call(e)),Qt.call(t,e)?t[e].push(r):t[e]=[r]},P),ad=st(gn),sd=Sr(function(t,e,r){uo(t,e,r)}),ic=Sr(function(t,e,r,i){uo(t,e,r,i)}),cd=Ke(function(t,e){var r={};if(t==null)return r;var i=!1;e=C(e,function(h){return h=sr(h,t),i||(i=h.length>1),h}),We(t,r1(t),r),i&&(r=_e(r,St|Zr|Ne,H2));for(var c=e.length;c--;)Gi(r,e[c]);return r}),ld=Ke(function(t,e){return t==null?{}:m2(t,e)}),uc=es(zt),ac=es(se),fd=qr(function(t,e,r){return e=e.toLowerCase(),t+(r?Ms(e):e)}),pd=qr(function(t,e,r){return t+(r?"-":"")+e.toLowerCase()}),hd=qr(function(t,e,r){return t+(r?" ":"")+e.toLowerCase()}),dd=Xa("toLowerCase"),vd=qr(function(t,e,r){return t+(r?"_":"")+e.toLowerCase()}),gd=qr(function(t,e,r){return t+(r?" ":"")+O1(e)}),yd=qr(function(t,e,r){return t+(r?" ":"")+e.toUpperCase()}),O1=Xa("toUpperCase"),sc=st(function(t,e){try{return u(t,v,e)}catch(r){return c1(r)?r:new _1(r)}}),_d=Ke(function(t,e){return l(e,function(r){r=Ze(r),Ge(t,r,L1(t[r],t))}),t}),md=Ja(),Qd=Ja(!0),bd=st(function(t,e){return function(r){return gn(r,t,e)}}),wd=st(function(t,e){return function(r){return gn(t,r,e)}}),Cd=Ri(C),Ed=Ri(p),Ad=Ri(T),Id=Ra(),Ld=Ra(!0),xd=fo(function(t,e){return t+e},0),kd=t1("ceil"),Od=fo(function(t,e){return t/e},1),Td=t1("floor"),Nd=fo(function(t,e){return t*e},1),Dd=t1("round"),Md=fo(function(t,e){return t-e},0);return s.after=up,s.ary=Cs,s.assign=td,s.assignIn=oc,s.assignInWith=Bo,s.assignWith=ed,s.at=rd,s.before=Es,s.bind=L1,s.bindAll=_d,s.bindKey=tc,s.castArray=dp,s.chain=Qs,s.chunk=R2,s.compact=t5,s.concat=e5,s.cond=Ih,s.conforms=Lh,s.constant=p1,s.countBy=V7,s.create=Wp,s.curry=As,s.curryRight=Is,s.debounce=Ls,s.defaults=nd,s.defaultsDeep=od,s.defer=F7,s.delay=S7,s.difference=_7,s.differenceBy=m7,s.differenceWith=Q7,s.drop=r5,s.dropRight=n5,s.dropRightWhile=o5,s.dropWhile=i5,s.fill=u5,s.filter=q5,s.flatMap=Y5,s.flatMapDeep=G5,s.flatMapDepth=X5,s.flatten=gs,s.flattenDeep=a5,s.flattenDepth=s5,s.flip=ap,s.flow=md,s.flowRight=Qd,s.fromPairs=c5,s.functions=Fp,s.functionsIn=Sp,s.groupBy=B7,s.initial=f5,s.intersection=b7,s.intersectionBy=w7,s.intersectionWith=C7,s.invert=id,s.invertBy=ud,s.invokeMap=j7,s.iteratee=h1,s.keyBy=z7,s.keys=zt,s.keysIn=se,s.map=mo,s.mapKeys=Yp,s.mapValues=Gp,s.matches=kh,s.matchesProperty=Oh,s.memoize=Qo,s.merge=sd,s.mergeWith=ic,s.method=bd,s.methodOf=wd,s.mixin=d1,s.negate=bo,s.nthArg=Nh,s.omit=cd,s.omitBy=Xp,s.once=sp,s.orderBy=J5,s.over=Cd,s.overArgs=q7,s.overEvery=Ed,s.overSome=Ad,s.partial=x1,s.partialRight=ec,s.partition=U7,s.pick=ld,s.pickBy=Ds,s.property=Ws,s.propertyOf=Dh,s.pull=E7,s.pullAll=_s,s.pullAllBy=v5,s.pullAllWith=g5,s.pullAt=A7,s.range=Id,s.rangeRight=Ld,s.rearg=Y7,s.reject=tp,s.remove=y5,s.rest=cp,s.reverse=a1,s.sampleSize=rp,s.set=Jp,s.setWith=Pp,s.shuffle=np,s.slice=_5,s.sortBy=$7,s.sortedUniq=A5,s.sortedUniqBy=I5,s.split=gh,s.spread=lp,s.tail=L5,s.take=x5,s.takeRight=k5,s.takeRightWhile=O5,s.takeWhile=T5,s.tap=W5,s.throttle=fp,s.thru=_o,s.toArray=Os,s.toPairs=uc,s.toPairsIn=ac,s.toPath=Zh,s.toPlainObject=Ns,s.transform=Rp,s.unary=pp,s.union=I7,s.unionBy=L7,s.unionWith=x7,s.uniq=N5,s.uniqBy=D5,s.uniqWith=M5,s.unset=th,s.unzip=s1,s.unzipWith=ms,s.update=eh,s.updateWith=rh,s.values=Gr,s.valuesIn=nh,s.without=k7,s.words=Vs,s.wrap=hp,s.xor=O7,s.xorBy=T7,s.xorWith=N7,s.zip=D7,s.zipObject=H5,s.zipObjectDeep=V5,s.zipWith=M7,s.entries=uc,s.entriesIn=ac,s.extend=oc,s.extendWith=Bo,d1(s,s),s.add=xd,s.attempt=sc,s.camelCase=fd,s.capitalize=Ms,s.ceil=kd,s.clamp=oh,s.clone=vp,s.cloneDeep=yp,s.cloneDeepWith=_p,s.cloneWith=gp,s.conformsTo=mp,s.deburr=Hs,s.defaultTo=xh,s.divide=Od,s.endsWith=ah,s.eq=Oe,s.escape=sh,s.escapeRegExp=ch,s.every=S5,s.find=W7,s.findIndex=ds,s.findKey=Zp,s.findLast=Z7,s.findLastIndex=vs,s.findLastKey=Bp,s.floor=Td,s.forEach=bs,s.forEachRight=ws,s.forIn=jp,s.forInRight=zp,s.forOwn=Up,s.forOwnRight=$p,s.get=l1,s.gt=G7,s.gte=X7,s.has=qp,s.hasIn=f1,s.head=ys,s.identity=ce,s.includes=K5,s.indexOf=l5,s.inRange=ih,s.invoke=ad,s.isArguments=Ir,s.isArray=rt,s.isArrayBuffer=K7,s.isArrayLike=ae,s.isArrayLikeObject=Dt,s.isBoolean=Qp,s.isBuffer=pr,s.isDate=J7,s.isElement=bp,s.isEmpty=wp,s.isEqual=Cp,s.isEqualWith=Ep,s.isError=c1,s.isFinite=Ap,s.isFunction=Pe,s.isInteger=xs,s.isLength=wo,s.isMap=rc,s.isMatch=Ip,s.isMatchWith=Lp,s.isNaN=xp,s.isNative=kp,s.isNil=Tp,s.isNull=Op,s.isNumber=ks,s.isObject=Lt,s.isObjectLike=kt,s.isPlainObject=bn,s.isRegExp=k1,s.isSafeInteger=Np,s.isSet=nc,s.isString=Co,s.isSymbol=he,s.isTypedArray=tn,s.isUndefined=Dp,s.isWeakMap=Mp,s.isWeakSet=Hp,s.join=p5,s.kebabCase=pd,s.last=Qe,s.lastIndexOf=h5,s.lowerCase=hd,s.lowerFirst=dd,s.lt=P7,s.lte=R7,s.max=jh,s.maxBy=zh,s.mean=Uh,s.meanBy=$h,s.min=Fh,s.minBy=Sh,s.stubArray=g1,s.stubFalse=y1,s.stubObject=Mh,s.stubString=Hh,s.stubTrue=Vh,s.multiply=Nd,s.nth=d5,s.noConflict=Th,s.noop=v1,s.now=Zo,s.pad=lh,s.padEnd=fh,s.padStart=ph,s.parseInt=hh,s.random=uh,s.reduce=P5,s.reduceRight=R5,s.repeat=dh,s.replace=vh,s.result=Kp,s.round=Dd,s.runInContext=m,s.sample=ep,s.size=op,s.snakeCase=vd,s.some=ip,s.sortedIndex=m5,s.sortedIndexBy=Q5,s.sortedIndexOf=b5,s.sortedLastIndex=w5,s.sortedLastIndexBy=C5,s.sortedLastIndexOf=E5,s.startCase=gd,s.startsWith=yh,s.subtract=Md,s.sum=qh,s.sumBy=Yh,s.template=_h,s.times=Wh,s.toFinite=Re,s.toInteger=at,s.toLength=Ts,s.toLower=mh,s.toNumber=be,s.toSafeInteger=Vp,s.toString=_t,s.toUpper=Qh,s.trim=bh,s.trimEnd=wh,s.trimStart=Ch,s.truncate=Eh,s.unescape=Ah,s.uniqueId=Bh,s.upperCase=yd,s.upperFirst=O1,s.each=bs,s.eachRight=ws,s.first=ys,d1(s,function(){var t={};return Ve(s,function(e,r){Qt.call(s.prototype,r)||(t[r]=e)}),t}(),{chain:!1}),s.VERSION=si,l(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){s[t].placeholder=s}),l(["drop","take"],function(t,e){z.prototype[t]=function(r){r=r===v?1:Zt(at(r),0);var i=this.__filtered__&&!e?new z(this):this.clone();return i.__filtered__?i.__takeCount__=Jt(r,i.__takeCount__):i.__views__.push({size:Jt(r,ge),type:t+(i.__dir__<0?"Right":"")}),i},z.prototype[t+"Right"]=function(r){return this.reverse()[t](r).reverse()}}),l(["filter","map","takeWhile"],function(t,e){var r=e+1,i=r==Me||r==yr;z.prototype[t]=function(c){var h=this.clone();return h.__iteratees__.push({iteratee:P(c,3),type:r}),h.__filtered__=h.__filtered__||i,h}}),l(["head","last"],function(t,e){var r="take"+(e?"Right":"");z.prototype[t]=function(){return this[r](1).value()[0]}}),l(["initial","tail"],function(t,e){var r="drop"+(e?"":"Right");z.prototype[t]=function(){return this.__filtered__?new z(this):this[r](1)}}),z.prototype.compact=function(){return this.filter(ce)},z.prototype.find=function(t){return this.filter(t).head()},z.prototype.findLast=function(t){return this.reverse().find(t)},z.prototype.invokeMap=st(function(t,e){return typeof t=="function"?new z(this):this.map(function(r){return gn(r,t,e)})}),z.prototype.reject=function(t){return this.filter(bo(P(t)))},z.prototype.slice=function(t,e){t=at(t);var r=this;return r.__filtered__&&(t>0||e<0)?new z(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==v&&(e=at(e),r=e<0?r.dropRight(-e):r.take(e-t)),r)},z.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},z.prototype.toArray=function(){return this.take(ge)},Ve(z.prototype,function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),c=s[i?"take"+(e=="last"?"Right":""):e],h=i||/^find/.test(e);c&&(s.prototype[e]=function(){var g=this.__wrapped__,_=i?[1]:arguments,b=g instanceof z,L=_[0],A=b||rt(g),O=function(lt){var ft=c.apply(s,k([lt],_));return i&&W?ft[0]:ft};A&&r&&typeof L=="function"&&L.length!=1&&(b=A=!1);var W=this.__chain__,F=!!this.__actions__.length,X=h&&!W,ot=b&&!F;if(!h&&A){g=ot?g:new z(this);var K=t.apply(g,_);return K.__actions__.push({func:_o,args:[O],thisArg:v}),new J(K,W)}return X&&ot?t.apply(this,_):(K=this.thru(O),X?i?K.value()[0]:K.value():K)})}),l(["pop","push","shift","sort","splice","unshift"],function(t){var e=Ao[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);s.prototype[t]=function(){var c=arguments;if(i&&!this.__chain__){var h=this.value();return e.apply(rt(h)?h:[],c)}return this[r](function(g){return e.apply(rt(g)?g:[],c)})}}),Ve(z.prototype,function(t,e){var r=s[e];if(r){var i=r.name+"";Qt.call(Pr,i)||(Pr[i]=[]),Pr[i].push({name:e,func:r})}}),Pr[lo(v,Ue).name]=[{name:"wrapper",func:v}],z.prototype.clone=ie,z.prototype.reverse=Hi,z.prototype.value=O3,s.prototype.at=H7,s.prototype.chain=Z5,s.prototype.commit=B5,s.prototype.next=j5,s.prototype.plant=U5,s.prototype.reverse=$5,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=F5,s.prototype.first=s.prototype.head,wn&&(s.prototype[wn]=z5),s},Fr=k3();_r?((_r.exports=Fr)._=Fr,Di._=Fr):qt._=Fr}).call(nn)}(kn,kn.exports);var dc=kn.exports,W1={};(function(n){n.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},n.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},n.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},n.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},n.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},n.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},n.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},n.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},n.realToAlias=function(){var o=Object.prototype.hasOwnProperty,u=n.aliasToReal,a={};for(var l in u){var f=u[l];o.call(a,f)?a[f].push(l):a[f]=[l]}return a}(),n.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},n.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},n.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}})(W1);var vc={},Mt=W1,gc=vc,Z1=Array.prototype.push;function yc(n,o){return o==2?function(u,a){return n.apply(void 0,arguments)}:function(u){return n.apply(void 0,arguments)}}function zo(n,o){return o==2?function(u,a){return n(u,a)}:function(u){return n(u)}}function B1(n){for(var o=n?n.length:0,u=Array(o);o--;)u[o]=n[o];return u}function _c(n){return function(o){return n({},o)}}function mc(n,o){return function(){for(var u=arguments.length,a=u-1,l=Array(u);u--;)l[u]=arguments[u];var f=l[o],p=l.slice(0,o);return f&&Z1.apply(p,f),o!=a&&Z1.apply(p,l.slice(o+1)),n.apply(this,p)}}function Uo(n,o){return function(){var u=arguments.length;if(u){for(var a=Array(u);u--;)a[u]=arguments[u];var l=a[0]=o.apply(void 0,a);return n.apply(void 0,a),l}}}function $o(n,o,u,a){var l=typeof o=="function",f=o===Object(o);if(f&&(a=u,u=o,o=void 0),u==null)throw new TypeError;a||(a={});var p={cap:"cap"in a?a.cap:!0,curry:"curry"in a?a.curry:!0,fixed:"fixed"in a?a.fixed:!0,immutable:"immutable"in a?a.immutable:!0,rearg:"rearg"in a?a.rearg:!0},d=l?u:gc,Q="curry"in a&&a.curry,w="fixed"in a&&a.fixed,C="rearg"in a&&a.rearg,k=l?u.runInContext():void 0,N=l?u:{ary:n.ary,assign:n.assign,clone:n.clone,curry:n.curry,forEach:n.forEach,isArray:n.isArray,isError:n.isError,isFunction:n.isFunction,isWeakMap:n.isWeakMap,iteratee:n.iteratee,keys:n.keys,rearg:n.rearg,toInteger:n.toInteger,toPath:n.toPath},H=N.ary,T=N.assign,Z=N.clone,V=N.curry,q=N.forEach,R=N.isArray,$=N.isError,ct=N.isFunction,ht=N.isWeakMap,dt=N.keys,mt=N.rearg,gt=N.toInteger,D=N.toPath,G=dt(Mt.aryMethod),S={castArray:function(Y){return function(){var M=arguments[0];return R(M)?Y(B1(M)):Y.apply(void 0,arguments)}},iteratee:function(Y){return function(){var M=arguments[0],j=arguments[1],U=Y(M,j),nt=U.length;return p.cap&&typeof j=="number"?(j=j>2?j-2:1,nt&&nt<=j?U:zo(U,j)):U}},mixin:function(Y){return function(M){var j=this;if(!ct(j))return Y(j,Object(M));var U=[];return q(dt(M),function(nt){ct(M[nt])&&U.push([nt,j.prototype[nt]])}),Y(j,Object(M)),q(U,function(nt){var Ht=nt[1];ct(Ht)?j.prototype[nt[0]]=Ht:delete j.prototype[nt[0]]}),j}},nthArg:function(Y){return function(M){var j=M<0?1:gt(M)+1;return V(Y(M),j)}},rearg:function(Y){return function(M,j){var U=j?j.length:0;return V(Y(M,j),U)}},runInContext:function(Y){return function(M){return $o(n,Y(M),a)}}};function tt(Y,M){if(p.cap){var j=Mt.iterateeRearg[Y];if(j)return vr(M,j);var U=!l&&Mt.iterateeAry[Y];if(U)return Gt(M,U)}return M}function et(Y,M,j){return Q||p.curry&&j>1?V(M,j):M}function pt(Y,M,j){if(p.fixed&&(w||!Mt.skipFixed[Y])){var U=Mt.methodSpread[Y],nt=U&&U.start;return nt===void 0?H(M,j):mc(M,nt)}return M}function yt(Y,M,j){return p.rearg&&j>1&&(C||!Mt.skipRearg[Y])?mt(M,Mt.methodRearg[Y]||Mt.aryRearg[j]):M}function Tt(Y,M){M=D(M);for(var j=-1,U=M.length,nt=U-1,Ht=Z(Object(Y)),$t=Ht;$t!=null&&++j<U;){var Ft=M[j],Vt=$t[Ft];Vt!=null&&!(ct(Vt)||$(Vt)||ht(Vt))&&($t[Ft]=Z(j==nt?Vt:Object(Vt))),$t=$t[Ft]}return Ht}function wt(Y){return xt.runInContext.convert(Y)(void 0)}function it(Y,M){var j=Mt.aliasToReal[Y]||Y,U=Mt.remap[j]||j,nt=a;return function(Ht){var $t=l?k:N,Ft=l?k[U]:M,Vt=T(T({},nt),Ht);return $o($t,j,Ft,Vt)}}function Gt(Y,M){return ze(Y,function(j){return typeof j=="function"?zo(j,M):j})}function vr(Y,M){return ze(Y,function(j){var U=M.length;return yc(mt(zo(j,U),M),U)})}function ze(Y,M){return function(){var j=arguments.length;if(!j)return Y();for(var U=Array(j);j--;)U[j]=arguments[j];var nt=p.rearg?0:j-1;return U[nt]=M(U[nt]),Y.apply(void 0,U)}}function Xt(Y,M,j){var U,nt=Mt.aliasToReal[Y]||Y,Ht=M,$t=S[nt];return $t?Ht=$t(M):p.immutable&&(Mt.mutate.array[nt]?Ht=Uo(M,B1):Mt.mutate.object[nt]?Ht=Uo(M,_c(M)):Mt.mutate.set[nt]&&(Ht=Uo(M,Tt))),q(G,function(Ft){return q(Mt.aryMethod[Ft],function(Vt){if(nt==Vt){var Kt=Mt.methodSpread[nt],nr=Kt&&Kt.afterRearg;return U=nr?pt(nt,yt(nt,Ht,Ft),Ft):yt(nt,pt(nt,Ht,Ft),Ft),U=tt(nt,U),U=et(nt,U,Ft),!1}}),!U}),U||(U=Ht),U==M&&(U=Q?V(U,1):function(){return M.apply(this,arguments)}),U.convert=it(nt,M),U.placeholder=M.placeholder=j,U}if(!f)return Xt(o,u,d);var xt=u,Te=[];return q(G,function(Y){q(Mt.aryMethod[Y],function(M){var j=xt[Mt.remap[M]||M];j&&Te.push([M,Xt(M,j,xt)])})}),q(dt(xt),function(Y){var M=xt[Y];if(typeof M=="function"){for(var j=Te.length;j--;)if(Te[j][0]==Y)return;M.convert=it(Y,M),Te.push([Y,M])}}),q(Te,function(Y){xt[Y[0]]=Y[1]}),xt.convert=wt,xt.placeholder=xt,q(dt(xt),function(Y){q(Mt.realToAlias[Y]||[],function(M){xt[M]=xt[Y]})}),xt}var Qc=$o,j1=dc.runInContext(),bc=Qc(j1,j1);const I=hc(bc),wc=/(<([^>]+)>)/gi,Cc=/<(\/)?div(\/?\s?)>/gi,Ec=n=>n.map(o=>`<div>${o===""?"<br/>":o}</div>`).join(""),Ac=n=>{const o=document.createElement("textarea");return o.innerHTML=n,o.value},Ic=n=>I.flow(o=>Ac(o),o=>o.split("<div>"),I.flatMap(o=>{const u=o.replaceAll(Cc,"");return u===""?void 0:u.replaceAll(wc,"")}),I.reject(I.isUndefined))(n),Fo=n=>n*180/Math.PI,On=(n,o)=>o[0]>=n.x&&o[0]<=n.x+n.width&&o[1]>=n.y&&o[1]<=n.y+n.height,Be=({origin:n=[0,0],point:o,rotation:u})=>{const a=[o[0]-n[0],o[1]-n[1]],l=a[1]*Math.cos(u)-a[0]*Math.sin(u);return[a[1]*Math.sin(u)+a[0]*Math.cos(u)+n[0],l+n[1]]},z1=n=>(n+2*Math.PI)%(2*Math.PI),U1=({targetVector:[n,o],radian:u=!0,originVector:a})=>{const l=z1(Math.atan2(o[1]-n[1],o[0]-n[0]));if(a){const[f,p]=a,d=Math.atan2(p[1]-f[1],p[0]-f[0]),Q=z1(l-d);return u?Q:Fo(Q)}return u?l:Fo(l)},Tn=n=>{const o=new Path2D;return o.rect(n.x,n.y,n.width,n.height),o},Nn=n=>{const o=new Path2D;return o.arc(n.x,n.y,n.radius,0,2*Math.PI),o},Lc=n=>{const o=new Path2D;return o.ellipse(n.x,n.y,n.radiusX,n.radiusY,0,0,2*Math.PI),o},$1=n=>{const o=new Path2D;return o.moveTo(...n.points[0]),o.lineTo(...n.points[1]),o},xc=n=>{if(n.points.length<3)return;const o=new Path2D;o.moveTo(...n.points[0]);for(let u=1;u<n.points.length-1;u++)o.quadraticCurveTo(...n.points[u],n.points.length-2===u?n.points[u+1][0]:(n.points[u+1][0]-n.points[u][0])/2+n.points[u][0],n.points.length-2===u?n.points[u+1][1]:(n.points[u+1][1]-n.points[u][1])/2+n.points[u][1]);return o},kc=n=>{if(n.points.length<1)return;const o=new Path2D;return o.moveTo(...n.points[0]),n.points.slice(1).forEach(u=>{o.lineTo(...u)}),o.lineTo(...n.points[0]),o},Oc=n=>{const o=new Path2D;return o.moveTo(...n.points[0]),o.lineTo(...n.points[1]),o.lineTo(...n.points[2]),o.lineTo(...n.points[0]),o},xr=(n,o,u)=>{const{borders:a}=jt(n,u);return{border:Tn(a),line:$1({points:[[a.x+a.width/2,a.y],[a.x+a.width/2,a.y-14/2-16/o]]}),anchors:[Nn({x:a.x+a.width/2,y:a.y-14/2-16/o,radius:14/2/o}),...N1.map(l=>Nn({x:a.x+a.width*l[0],y:a.y+a.height*l[1],radius:14/2/o}))]}},Tc=(n,o,u,a,l,f)=>{if(o.selection&&(Lr(n,{fillColor:"transparent",strokeColor:u,lineWidth:a/l}),n.stroke(o.selection.border),!(!f||o.locked))){n.stroke(o.selection.line),Lr(n,{fillColor:"rgb(255,255,255)",strokeColor:"rgb(150,150,150)",lineWidth:2/l});for(const p of o.selection.anchors)n.fill(p),n.stroke(p)}},F1=({borderStart:n,borderSize:o,vector:u,selectionPadding:a,invertedAxe:l,anchor:f})=>{switch(f){case 0:if(l){const p=o-2*a;return[n+p,u-p]}else{const p=Math.max(2*a,o-u);return[n+o-p,p]}case .5:return[n,o];case 1:if(l){const p=o+u;return[n+p,2*a-p]}else return[n,Math.max(2*a,o+u)];default:return[0,0]}},Nc=(n,o,u,a,l,f,p,d,Q,w)=>{const C=(o.width-w*2||1)/(o.height-w*2||1),k=(l-w*2)/(p-w*2);let N,H,T,Z;return Q.anchor[0]!==.5&&Q.anchor[1]!==.5?k<C?(H=f,Z=p,T=(p-w*2)*C+2*w,Q.anchor[0]===0?N=o.width-n[0]>w?o.x+(o.width-T):o.x+o.width-2*w:N=o.width+n[0]>w?o.x:o.x-T+2*w):(N=a,T=l,Z=(l-w*2)/C+2*w,Q.anchor[1]===0?H=o.height-n[1]>w?o.y+(o.height-Z):o.y+o.height-2*w:H=o.height+n[1]>w?o.y:o.y-Z+2*w):Q.anchor[0]!==.5?(N=a,T=l,Z=(l-w*2)/C+2*w,H=o.y+(o.height-Z)/2):(H=f,Z=p,T=(p-w*2)*C+2*w,N=o.x+(o.width-T)/2),{borderX:N,borderWidth:T,borderY:H,borderHeight:Z,center:u,originalShape:d}},S1=({borderX:n,borderWidth:o,borderY:u,borderHeight:a,center:l,originalShape:f})=>{const p=[n+o/2-l[0],u+a/2-l[1]],[d,Q]=Be({point:p,rotation:-f.rotation});return{borderX:rr(n+d-p[0]),borderWidth:rr(o),borderY:rr(u+Q-p[1]),borderHeight:rr(a)}},Dn=(n,o,u,a,l,f=!1)=>{const{center:p,borders:d}=jt(o,l),Q=Be({origin:p,point:n,rotation:o.rotation}),w=u.anchor[0]===0&&Q[0]>=d.x+d.width||u.anchor[0]===1&&Q[0]<=d.x,C=u.anchor[1]===0&&Q[1]>=d.y+d.height||u.anchor[1]===1&&Q[1]<=d.y,k=[vt(Q[0],a,u.anchor[0]===0&&!w||u.anchor[0]===1&&w?l:-l),vt(Q[1],a,u.anchor[1]===0&&!C||u.anchor[1]===1&&C?l:-l)],N=a?[u.anchor[0]===0?d.x:u.anchor[0]===.5?d.x+d.width/2:d.x+d.width,u.anchor[1]===0?d.y:u.anchor[1]===.5?d.y+d.height/2:d.y+d.height]:Be({origin:p,point:u.cursorStartPosition,rotation:o.rotation}),H=[k[0]-N[0],k[1]-N[1]],[T,Z]=F1({borderStart:d.x,borderSize:d.width,vector:H[0],selectionPadding:l,invertedAxe:w,anchor:u.anchor[0]}),[V,q]=F1({borderStart:d.y,borderSize:d.height,vector:H[1],selectionPadding:l,invertedAxe:C,anchor:u.anchor[1]});if(f){const R=Nc(H,d,p,T,Z,V,q,o,u,l);return S1(R)}return S1({borderX:T,borderWidth:Z,borderY:V,borderHeight:q,center:p,originalShape:o})},Mn=(n,o,u,a=1,l=1)=>[o+(n[0]-o)*a,u+(n[1]-u)*l],Dc=n=>{if(n.points.length<1||n.style?.strokeColor==="transparent")return;const o=n.points.flat(),u=o.map(d=>d[0]),a=o.map(d=>d[1]),l=Math.min(...u),f=Math.min(...a),p=new Path2D;return n.points.forEach(d=>{d.length===1?p.rect(...Mn(d[0],l,f,n.scaleX,n.scaleY),1,1):(p.moveTo(...Mn(d[0],l,f,n.scaleX,n.scaleY)),d.slice(1).forEach(Q=>{p.lineTo(...Mn(Q,l,f,n.scaleX,n.scaleY))}))}),p},kr=(n,o,u)=>({...n,path:Dc(n),selection:xr(n,o,u)}),Mc=kr,Hc=(n,o,u,a)=>kr({toolId:n.id,type:n.type,id:I.uniqueId(`${n.type}_`),points:[[o]],rotation:0,scaleX:1,scaleY:1,style:{globalAlpha:n.settings.opacity.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default}},u,a),Vc=(n,o)=>{o.points.length<1||!o.path||n.globalAlpha!==0&&(o.style?.strokeColor==="transparent"||n.globalAlpha===0||n.stroke(o.path))},Wc=(n,o)=>{const u=n.points.flat(),a=Math.min(...u.map(Q=>Q[0])),l=Math.min(...u.map(Q=>Q[1])),f=u.map(Q=>Mn(Q,a,l,n.scaleX,n.scaleY)),p=Math.max(...f.map(Q=>Q[0]))+o,d=Math.max(...f.map(Q=>Q[1]))+o;return{x:a-o,width:p-a+o,y:l-o,height:d-l+o}},Zc=(n,o,u,a,l,f)=>{const{borders:p}=jt(o,f),d=a?vt(p.x+n[0]-u[0],a)-p.x:n[0]-u[0],Q=a?vt(p.y+n[1]-u[1],a)-p.y:n[1]-u[1];return kr({...o,points:o.points.map(w=>w.map(([C,k])=>[C+d,k+Q]))},l,f)},Bc=(n,o,u,a,l,f,p)=>{const{borders:d}=jt({...o,scaleX:1,scaleY:1},l),{borders:Q}=jt(o,l),{borderX:w,borderHeight:C,borderY:k,borderWidth:N}=Dn(n,o,u,a,l,p),H=Math.max(0,d.width-2*l),T=Math.max(0,d.height-2*l),Z=Math.max(0,N-2*l),V=Math.max(0,C-2*l),q=Z/H,R=V/T,$=rr(w-Q.x),ct=rr(k-Q.y);return kr({...o,points:o.points.map(ht=>ht.map(([dt,mt])=>[dt+$,mt+ct])),scaleX:q,scaleY:R},f,l)},jc=(n,o,u,a)=>{const l={...n,points:I.set(n.points.length-1,[...n.points[n.points.length-1],[Math.round(o[0]),Math.round(o[1])]],n.points)};return kr(l,u,a)},zc=(n,o,u,a)=>{const l={...n,points:I.set(n.points.length,[[Math.round(o[0]),Math.round(o[1])]],n.points)};return kr(l,u,a)},er=300,rr=(n,o=2)=>Math.round(n*10**o)/10**o,vt=(n,o,u=0)=>{if(!o)return rr(n);const a=n+u,l=a>=0?dr[o-1]:-dr[o-1];return a+l/2-(a+l/2)%l-u},Uc=(n,o,u=0)=>o?n+Math.PI/jo/2-(n+Math.PI/jo/2)%(Math.PI/jo):rr(n,3),$c=(n,o,u,a,l,f,p,d,Q)=>{switch(f.mode){case"brush":return jc(o,u,Q,p);case"translate":return ri(u,f.originalShape,f.cursorStartPosition,a,Q,p);case"rotate":return Nf(o,u,f.originalShape,f.cursorStartPosition,f.center,a);case"resize":return Df(n,o,u,l,f.originalShape,f,a,p,d,Q);default:return o}},Fc=(n,o,u,a,l=!1)=>{if(!n||!o||!a||!u)return[er,er];const f=n/o,p=u/a;if(f>p){const d=l?u:Math.min(n,u);return[d,d/f]}else{const d=l?a:Math.min(o,a);return[d*f,d]}},Hn=(n,o,u,a,l=1)=>{const{clientX:f=0,clientY:p=0}="touches"in n&&n.touches[0]?n.touches[0]:"changedTouches"in n&&n.changedTouches[0]?n.changedTouches[0]:"clientX"in n?n:{},d=o?.getBoundingClientRect()??{left:0,top:0,width:u,height:a};return[(f-d.left)*(u/d.width)/l,(p-d.top)*(a/d.height)/l]},Vn=(n,o,[u,a],[l,f])=>Be({origin:[u-l,a-f],point:n,rotation:o}),Sc=(n,o,[u,a],[l,f])=>Be({origin:[u-l,a-f],point:n,rotation:-o}),Wn=(n,o,u,a,l=1,f=!1)=>{if(n.locked)return!1;const p=Math.min(1,l),{borders:d,center:Q}=jt(n,a),w=Vn(o,n.rotation,Q,u);if(f)if(n.type==="line"||n.type==="polygon"||n.type==="curve"){for(let C=0;C<n.points.length;C++)if(On({x:n.points[C][0]-14/2/p,y:n.points[C][1]-14/2/p,width:14/p,height:14/p},w))return{mode:"resize",anchor:C}}else{if(On({x:d.x+d.width/2-14/2/p,y:d.y-14/p-16/p,width:14/p,height:14/p},w))return{mode:"rotate"};for(const C of N1)if(On({x:d.x+d.width*C[0]-14/2/p,y:d.y+d.height*C[1]-14/2/p,width:14/p,height:14/p},w))return{mode:"resize",anchor:C}}return On(d,w)?{mode:"translate"}:!1},qc=n=>({...n,path:Oc(n)}),q1=n=>{const o={...n,type:"triangle"};return qc(o)},Yc=(n,o)=>{n.globalAlpha!==0&&o.path&&(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},So=(n,o,u,a=!1)=>{const{borders:l}=jt(n,u);return{border:Tn(l),anchors:[...n.points.map((f,p)=>a&&p>0&&p<n.points.length-1?Tn({x:f[0]-14/2,y:f[1]-14/2,width:14/o,height:14/o}):Nn({x:f[0],y:f[1],radius:14/2/o}))]}},Gc=({ctx:n,shape:o,withAnchors:u,selectionWidth:a,selectionColor:l,currentScale:f=1})=>{if(o.selection&&(Lr(n,{fillColor:"transparent",strokeColor:l,lineWidth:a/f}),n.stroke(o.selection.border),!(!u||o.locked))){Lr(n,{fillColor:"rgb(255,255,255)",strokeColor:"rgb(150,150,150)",lineWidth:2/f});for(const p of o.selection.anchors)n.fill(p),n.stroke(p)}},Zn=(n,o,u)=>{const a=I.flow(l=>{if(n.style?.lineArrow===1||n.style?.lineArrow===3){const f=Math.PI/2-U1({targetVector:[n.points[0],n.points[1]]});return[...l,q1(Y1(n.points[0],f,n.style))]}return l},l=>{if(n.style?.lineArrow===2||n.style?.lineArrow===3){const f=Math.PI/2-U1({targetVector:[n.points[1],n.points[0]]});return[...l,q1(Y1(n.points[1],f,n.style))]}return l})([]);return{...n,path:$1(n),selection:So(n,o,u),arrows:a}},Xc=Zn,Kc=(n,o,u,a)=>{const l={toolId:n.id,type:n.type,id:I.uniqueId(`${n.type}_`),points:[o,o],rotation:0,style:{globalAlpha:n.settings.opacity.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default,lineArrow:n.settings.lineArrow.default}};return Zn(l,u,a)},Y1=(n,o,u)=>{const a=[Be({point:[0,-(10+(u.lineWidth??0)*1)],rotation:o}),Be({point:[-(5+(u.lineWidth??0)*1),5+(u.lineWidth??0)*2],rotation:o}),Be({point:[5+(u.lineWidth??0)*1,5+(u.lineWidth??0)*2],rotation:o})];return{points:[[n[0]+a[0][0],n[1]+a[0][1]],[n[0]+a[1][0],n[1]+a[1][1]],[n[0]+a[2][0],n[1]+a[2][1]]],style:{...u,fillColor:u.strokeColor,strokeColor:"transparent"}}},Jc=(n,o)=>{if(!(n.globalAlpha===0||!o.path)){o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path);for(const u of o.arrows??[])Lr(n,u.style),Yc(n,u)}},Pc=(n,o)=>{const u=Math.min(n.points[0][0],n.points[1][0])-o,a=Math.abs(n.points[0][0]-n.points[1][0])+o*2,l=Math.min(n.points[0][1],n.points[1][1])-o,f=Math.abs(n.points[0][1]-n.points[1][1])+o*2;return{x:u,width:a,y:l,height:f}},Rc=(n,o,u,a,l,f)=>Zn({...o,points:o.points.map(([p,d])=>[vt(p+n[0]-u[0],a),vt(d+n[1]-u[1],a)])},l,f),tl=(n,o,u,a,l,f,p)=>{const d=[vt(n[0],l),vt(n[1],l)],{center:Q}=jt(u,f),w=Vn(d,u.rotation,Q,o),C=I.set(["points",a.anchor],w,u);return Zn(C,p,f)},Or=(n,o,u)=>({...n,path:kc(n),selection:So(n,o,u)}),el=Or,rl=(n,o,u,a)=>Or({toolId:n.id,type:n.type,id:I.uniqueId(`${n.type}_`),points:I.flow(I.range(0),I.map(()=>o))(n.settings.pointsCount.default),rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default,pointsCount:n.settings.pointsCount.default}},u,a),nl=(n,o)=>{o.path&&n.globalAlpha!==0&&(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},G1=(n,o)=>{const u=I.flow(I.map(p=>p[0]),I.min,I.add(-o))(n.points),a=I.flow(I.map(p=>p[0]),I.max,I.add(o))(n.points),l=I.flow(I.map(p=>p[1]),I.min,I.add(-o))(n.points),f=I.flow(I.map(p=>p[1]),I.max,I.add(o))(n.points);return{x:u,width:a-u,y:l,height:f-l}},ol=(n,o,u,a,l,f)=>{if(a){const{borders:p}=jt(o,f),d=vt(p.x+n[0]-u[0],a)-p.x,Q=vt(p.y+n[1]-u[1],a)-p.y;return{...o,points:o.points.map(([w,C])=>[w+d,C+Q])}}else return Or({...o,points:o.points.map(([p,d])=>[vt(p+n[0]-u[0],a),vt(d+n[1]-u[1],a)])},l,f)},il=(n,o,u,a,l,f,p)=>{const d=[vt(n[0],l),vt(n[1],l)],{center:Q}=jt(u,f),w=Vn(d,u.rotation,Q,o),C=I.set(["points",a.anchor],w,u);return Or(C,p,f)},ul=(n,o,u,a)=>{const l=n.points.length;if(l===o)return n;if(l>o){const f=n.points.slice(0,o);return Or({...n,points:f,style:{...n.style,pointsCount:f.length}},u,a)}else{const f=o-l,p=I.flow(I.range(0),I.map(Q=>[n.points[0][0]+(n.points[1][0]-n.points[0][0])*(Q+1)/(f+1),n.points[0][1]+(n.points[1][1]-n.points[0][1])*(Q+1)/(f+1)]))(f),d=[n.points[0],...p,...n.points.slice(1,n.points.length)];return Or({...n,points:d,style:{...n.style,pointsCount:d.length}},u,a)}},Bn=(n,o,u)=>({...n,path:xc(n),selection:So(n,o,u,!0)}),al=Bn,sl=(n,o,u,a)=>Bn({toolId:n.id,type:n.type,id:I.uniqueId(`${n.type}_`),points:I.flow(I.range(0),I.map(()=>o))(n.settings.pointsCount.default),rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default,pointsCount:n.settings.pointsCount.default}},u,a),cl=(n,o,u,a,l,f,p)=>{const d=[vt(n[0],l),vt(n[1],l)],{center:Q}=jt(u,f),w=Vn(d,u.rotation,Q,o),C=I.set(["points",a.anchor],w,u);return Bn(C,p,f)},ll=(n,o)=>{o.path&&n.globalAlpha!==0&&(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},fl=G1,pl=(n,o,u,a,l,f)=>{const{borders:p}=jt(o,f);return Bn({...o,points:o.points.map(([d,Q])=>a?[d+vt(p.x+n[0]-u[0],a)-p.x,Q+vt(p.y+n[1]-u[1],a)-p.y]:[vt(d+n[0]-u[0],a),vt(Q+n[1]-u[1],a)])},l,f)},jn=(n,o,u)=>({...n,path:Tn(n),selection:xr(n,o,u)}),hl=jn,dl=(n,o,u,a)=>{const l={toolId:n.id,type:n.type,id:I.uniqueId(`${n.type}_`),x:o[0],y:o[1],width:0,height:0,rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default}};return jn(l,u,a)},X1=(n,o)=>{n.globalAlpha===0||!o.path||(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},K1=(n,o)=>({x:n.x-o,width:n.width+o*2,y:n.y-o,height:n.height+o*2}),J1=(n,o,u,a,[l,f]=[!1,!1])=>{const p=n[0]===.5?u.x+u.width/2:n[0]===0?u.x+(l?0:u.width):u.x+(l?u.width:0),d=n[1]===.5?u.y+u.height/2:n[1]===0?u.y+(f?0:u.height):u.y+(f?u.height:0);return Sc([p,d],u.rotation,o,a)},vl=(n,o,u,a,l,f)=>jn({...o,x:vt(o.x+n[0]-u[0],a),y:vt(o.y+n[1]-u[1],a)},l,f),qo=(n,o,u,a,l,f,p=!1)=>{const{borderX:d,borderHeight:Q,borderY:w,borderWidth:C}=Dn(n,o,u,a,l,p);return jn({...o,width:Math.max(0,C-2*l),height:Math.max(0,Q-2*l),x:d+l,y:w+l},f,l)},Yo=["Texte"],Go=(n,o,u)=>({...n,selection:xr(n,o,u)}),gl=Go,Xo=(n,o,u,a,l,f=en)=>{n.font=`${l?"italic":""} ${a?"bold":""} 1px ${f}`;const p=o.map(d=>u/n.measureText(d).width);return Math.min(...p)||pc},yl=(n,o,u,a,l)=>{const f=Xo(n,Yo,50,o.settings?.fontBold.default??!1,o.settings?.fontItalic.default??!1,o.settings.fontFamily.default);return Go({toolId:o.id,type:o.type,id:I.uniqueId(`${o.type}_`),x:u[0],y:u[1],value:Yo,fontSize:f,width:50,height:f*(Yo.length||1),rotation:0,style:{globalAlpha:o.settings.opacity.default,strokeColor:o.settings.strokeColor.default,fontFamily:o.settings.fontFamily.default}},a,l)},_l=(n,o)=>{if(!(n.globalAlpha===0||!o.style?.strokeColor||o.style.strokeColor==="transparent")){n.font=`${o.style?.fontItalic?"italic":""} ${o.style?.fontBold?"bold":""} ${o.fontSize}px ${o.style?.fontFamily??en}`,n.textBaseline="top",n.fillStyle=o.style.strokeColor;for(let u=0;u<o.value.length;u++)n.fillText(o.value[u],o.x,o.y+u*o.fontSize,o.width)}},ml=(n,o)=>({x:n.x-o,width:n.width+o*2,y:n.y-o,height:n.height+o*2}),Ql=(n,o,u,a,l,f)=>Go({...o,x:vt(o.x+n[0]-u[0],a),y:vt(o.y+n[1]-u[1],a)},l,f),bl=(n,o,u,a,l,f,p)=>{const d=qo(o,u,a,l,f,p,!0);return{...d,fontSize:Xo(n,d.value,d.width,d.style?.fontBold??!1,d.style?.fontItalic??!1,d.style?.fontFamily)}},wl=(n,o,u,a,l,f=en)=>{n.font=`${l?"italic":""} ${a?"bold":""} ${u}px ${f}`;const p=o.map(d=>n.measureText(d).width);return Math.max(...p)||20},Cl=(n,o,u,a,l)=>{const f={...o,value:u},p=wl(n,f.value,f.fontSize,f.style?.fontBold??!1,f.style?.fontItalic??!1,f.style?.fontFamily),d=f.fontSize*f.value.length,Q={...f,width:p,height:d},{center:w}=jt(o,a),{center:C}=jt(Q,a),[k,N]=J1([1,1],w,o,l),[H,T]=J1([1,1],C,Q,l,[!1,!1]);return{...Q,x:Q.x-(H-k),y:Q.y-(T-N)}},zn=(n,o,u)=>({...n,path:Lc(n),selection:xr(n,o,u)}),El=zn,Al=(n,o,u,a)=>zn({toolId:n.id,type:n.type,id:I.uniqueId(`${n.type}_`),x:o[0],y:o[1],radiusX:0,radiusY:0,rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default}},u,a),Il=(n,o)=>{n.globalAlpha===0||!o.path||(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},Ll=(n,o)=>({x:n.x-n.radiusX-o,width:(n.radiusX+o)*2,y:n.y-n.radiusY-o,height:(n.radiusY+o)*2}),xl=(n,o,u,a,l,f)=>zn({...o,x:vt(o.x+n[0]-u[0],a),y:vt(o.y+n[1]-u[1],a)},l,f),kl=(n,o,u,a,l,f,p=!1)=>{const{borderX:d,borderHeight:Q,borderY:w,borderWidth:C}=Dn(n,o,u,a,l,p);return zn({...o,radiusX:Math.max(0,C/2-l),radiusY:Math.max(0,Q/2-l),x:d+C/2,y:w+Q/2},f,l)},Un=(n,o,u)=>({...n,path:Nn(n),selection:xr(n,o,u)}),Ol=Un,Tl=(n,o,u,a)=>Un({toolId:n.id,type:n.type,id:I.uniqueId(`${n.type}_`),x:o[0],y:o[1],radius:0,rotation:0,style:{globalAlpha:n.settings.opacity.default,fillColor:n.settings.fillColor.default,strokeColor:n.settings.strokeColor.default,lineWidth:n.settings.lineWidth.default,lineDash:n.settings.lineDash.default}},u,a),Nl=(n,o)=>{n.globalAlpha===0||!o.path||(o.style?.fillColor!=="transparent"&&n.fill(o.path),o.style?.strokeColor!=="transparent"&&n.stroke(o.path))},Dl=(n,o)=>({x:n.x-n.radius-o,width:(n.radius+o)*2,y:n.y-n.radius-o,height:(n.radius+o)*2}),Ml=(n,o,u,a,l,f)=>Un({...o,x:vt(o.x+n[0]-u[0],a),y:vt(o.y+n[1]-u[1],a)},l,f),Hl=(n,o,u,a,l,f)=>{const{borderX:p,borderHeight:d,borderY:Q,borderWidth:w}=Dn(n,o,u,a,l,!0);return Un({...o,radius:Math.max(0,w/2-l),x:p+w/2,y:Q+d/2},f,l)},Vl=n=>{const o=["img","id","selection","path"];return n.map(u=>u.type==="picture"&&!u.src.startsWith("http")?I.omit(o,{...u,src:Zl(u.img)}):I.omit(o,u))},P1=(n,o,u)=>({shapes:Vl(n),config:{width:o,height:u}}),R1=(n,o,u)=>on({...n,id:I.uniqueId(`${n.type}_`)},o,u),Wl=n=>n?.map(o=>{if(!o.translation)return o;const u=o.translation;switch(o.type){case"rect":case"square":case"ellipse":case"circle":case"picture":return{...I.omit(["translation"],o),x:o.x+u[0],y:o.y+u[1]};case"line":return{...I.omit(["translation"],o),points:o.points.map(([a,l])=>[a+u[0],l+u[1]])};case"polygon":case"curve":return{...I.omit(["translation"],o),points:o.points.map(([a,l])=>[a+u[0],l+u[1]])};case"brush":return{...I.omit(["translation"],o),points:o.points.map(a=>a.map(([l,f])=>[l+u[0],f+u[1]]))}}}),tu=n=>{const a=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("svg")[0],l=a.getAttribute("width"),f=a.getAttribute("height");let p;if(l||f)p=n;else{const Q=a.getAttribute("viewBox")??`0 0 ${er} ${er}`,[,,w,C]=Q.split(" ");a.setAttribute("width",w??er),a.setAttribute("height",C??er),p=new XMLSerializer().serializeToString(a)}const d=new Blob([p],{type:"image/svg+xml"});return URL.createObjectURL(d)},eu=n=>(n instanceof File?n.name:n).includes(".svg"),ru=n=>eu(n)?fetch(n).then(o=>o.text()).then(o=>tu(o)):fetch(n).then(o=>o.blob()).then(o=>URL.createObjectURL(o)),nu=(n,o)=>{const u=document.createElement("a");u.href=n,u.download=o,document.body.appendChild(u),u.click(),document.body.removeChild(u)},Zl=n=>{const o=document.createElement("canvas");o.width=n.width,o.height=n.height;const u=o.getContext("2d");return u?(u.drawImage(n,0,0),o.toDataURL("image/png")):""},Bl=n=>"data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(n)),ou=(n,o,u,a,l)=>{const f=document.createElement("canvas");f.width=u,f.height=a;const p=f.getContext("2d");if(!p)return"";p.clearRect(0,0,u,a),H1(p);for(let d=n.length-1;d>=0;d--)ku(p,n[d],1,o,l);return f.toDataURL("image/png")},jl=(n,o,u)=>{const a=P1(n,o,u);return Bl(a)},zl=async n=>new Promise((o,u)=>{const a=new FileReader;a.onload=l=>{const f=l.target?.result;if(!f)return u("Impossible de récupérer les données du fichier");const p=JSON.parse(f);o(p)},a.readAsText(n)}),Ul=async(n,o,u)=>{const a=[],l=n.shapes,f=I.flow(p=>Wl(p),I.map(p=>{if(!D1.includes(p.type))return null;if(p.type==="picture"){const d=new Image,Q=new Promise((w,C)=>{d.onload=()=>{URL.revokeObjectURL(d.src),w()},d.onerror=()=>{C(new Error("Some images could not be loaded"))}});return a.push(Q),p.src.startsWith("http")?ru(p.src).then(w=>{d.src=w}).catch(()=>{d.src=""}):d.src=p.src,R1({...p,img:d},o,u)}return R1(p,o,u)}),I.compact)(l);return await Promise.all(a),f},iu='<svg><path d="M5.146 17.5Q4.146 17.5 3.208 17Q2.271 16.5 1.667 15.708Q2.208 15.75 2.802 15.344Q3.396 14.938 3.396 14.104Q3.396 13.042 4.135 12.292Q4.875 11.542 5.958 11.542Q7.021 11.542 7.76 12.292Q8.5 13.042 8.5 14.104Q8.5 15.5 7.51 16.5Q6.521 17.5 5.146 17.5ZM9.917 12.5 7.562 10.146 14.917 2.729Q15.146 2.5 15.469 2.5Q15.792 2.5 16.021 2.729L17.271 3.958Q17.5 4.188 17.5 4.531Q17.5 4.875 17.271 5.125Z"/></svg>',$n='<svg><path d="M2.5 17.5V2.5H17.5V17.5ZM4.25 15.75H15.75V4.25H4.25ZM4.25 15.75V4.25V15.75Z"/></svg>',$l='<svg><path d="M5.333 9.292 10.021 1.646 14.708 9.292ZM14.562 18.333Q13 18.333 11.896 17.229Q10.792 16.125 10.792 14.562Q10.792 13 11.896 11.896Q13 10.792 14.562 10.792Q16.125 10.792 17.229 11.896Q18.333 13 18.333 14.562Q18.333 16.125 17.229 17.229Q16.125 18.333 14.562 18.333ZM2.5 17.917V11.188H9.229V17.917ZM14.562 16.583Q15.438 16.583 16.01 16.01Q16.583 15.438 16.583 14.562Q16.583 13.688 16.01 13.115Q15.438 12.542 14.562 12.542Q13.688 12.542 13.115 13.115Q12.542 13.688 12.542 14.562Q12.542 15.438 13.115 16.01Q13.688 16.583 14.562 16.583ZM4.25 16.167H7.479V12.938H4.25ZM8.458 7.542H11.583L10.021 5ZM10.021 7.542ZM7.479 12.938ZM14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Q14.562 14.562 14.562 14.562Z"/></svg>',Fn='<svg><path d="M10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.271 2.323 6.75Q2.979 5.229 4.104 4.104Q5.229 2.979 6.75 2.323Q8.271 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.729 17.677 13.25Q17.021 14.771 15.896 15.896Q14.771 17.021 13.25 17.677Q11.729 18.333 10 18.333ZM10 16.583Q12.75 16.583 14.667 14.667Q16.583 12.75 16.583 10Q16.583 7.25 14.667 5.333Q12.75 3.417 10 3.417Q7.25 3.417 5.333 5.333Q3.417 7.25 3.417 10Q3.417 12.75 5.333 14.667Q7.25 16.583 10 16.583ZM10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Z"/></svg>',Ko='<svg><path d="M12.25 18.333V16.167L6.833 13.458H2.5V8.208H6.25L8.25 5.917V1.667H13.5V6.917H9.708L7.75 9.146V11.958L12.25 14.208V13.083H17.5V18.333Z"/></svg>',uu='<svg><path d="M4.125 5.083V3.333H7.062L7.896 2.5H12.104L12.938 3.333H15.875V5.083ZM6.75 17.5Q6.021 17.5 5.51 16.99Q5 16.479 5 15.75V5.958H15V15.75Q15 16.479 14.49 16.99Q13.979 17.5 13.25 17.5Z"/></svg>',au='<svg><path d="M10 17.5Q7.208 17.5 5.271 15.594Q3.333 13.688 3.333 10.958Q3.333 9.583 3.854 8.396Q4.375 7.208 5.292 6.292L10 1.667L14.688 6.292Q15.604 7.208 16.135 8.396Q16.667 9.583 16.667 10.958Q16.667 13.688 14.719 15.594Q12.771 17.5 10 17.5ZM5.146 11.667H14.854Q15.083 10.188 14.552 9.146Q14.021 8.104 13.479 7.562L10 4.125L6.521 7.562Q5.979 8.104 5.448 9.146Q4.917 10.188 5.146 11.667Z"/></svg>',Fl='<svg><path d="M11.708 15.833H5.854V14.083H11.708Q13 14.083 13.958 13.292Q14.917 12.5 14.917 11.271Q14.917 10.042 13.958 9.24Q13 8.438 11.708 8.438H6.667L8.792 10.562L7.562 11.792L3.333 7.562L7.562 3.333L8.792 4.562L6.667 6.688H11.708Q13.729 6.688 15.198 7.99Q16.667 9.292 16.667 11.25Q16.667 13.208 15.198 14.521Q13.729 15.833 11.708 15.833Z"/></svg>',Sl='<svg><path d="M8.292 15.833Q6.271 15.833 4.802 14.521Q3.333 13.208 3.333 11.25Q3.333 9.292 4.802 7.99Q6.271 6.688 8.292 6.688H13.333L11.208 4.562L12.438 3.333L16.667 7.562L12.438 11.792L11.208 10.562L13.333 8.438H8.292Q7 8.438 6.042 9.229Q5.083 10.021 5.083 11.25Q5.083 12.5 6.042 13.292Q7 14.083 8.292 14.083H14.146V15.833Z"/></svg>',ql='<svg><path d="M10 17.646 2.438 11.75 3.875 10.646 10 15.396 16.125 10.646 17.562 11.75ZM10 13.188 2.5 7.354 10 1.521 17.5 7.354Z"/></svg>',Yl='<svg><path d="M7.854 13.812 10 11.688 12.125 13.812 13.354 12.604 11.208 10.458 13.354 8.312 12.125 7.104 10 9.229 7.854 7.104 6.625 8.312 8.771 10.458 6.625 12.604ZM5.896 17.5Q5.167 17.5 4.656 16.99Q4.146 16.479 4.146 15.75V5.125H3.333V3.375H7.542V2.5H12.458V3.375H16.667V5.125H15.833V15.75Q15.833 16.479 15.323 16.99Q14.812 17.5 14.083 17.5Z"/></svg>',Gl='<svg><path d="M17.5 5.833V15.75Q17.5 16.479 16.99 16.99Q16.479 17.5 15.75 17.5H4.25Q3.521 17.5 3.01 16.99Q2.5 16.479 2.5 15.75V4.25Q2.5 3.521 3.01 3.01Q3.521 2.5 4.25 2.5H14.167ZM10 14.917Q11.062 14.917 11.823 14.156Q12.583 13.396 12.583 12.333Q12.583 11.271 11.823 10.51Q11.062 9.75 10 9.75Q8.938 9.75 8.177 10.51Q7.417 11.271 7.417 12.333Q7.417 13.396 8.177 14.156Q8.938 14.917 10 14.917ZM5.021 8.396H12.521V5.021H5.021Z"/></svg>',Xl='<svg><path d="M10 13.271 5.708 8.979 6.958 7.729 9.125 9.896V3.333H10.875V9.896L13.042 7.729L14.292 8.979ZM5.083 16.667Q4.354 16.667 3.844 16.156Q3.333 15.646 3.333 14.917V12.5H5.083V14.917Q5.083 14.917 5.083 14.917Q5.083 14.917 5.083 14.917H14.917Q14.917 14.917 14.917 14.917Q14.917 14.917 14.917 14.917V12.5H16.667V14.917Q16.667 15.646 16.156 16.156Q15.646 16.667 14.917 16.667Z"/></svg>',Kl='<svg><path d="M3.417 16.667Q2.729 16.667 2.198 16.135Q1.667 15.604 1.667 14.917V5.083Q1.667 4.396 2.198 3.865Q2.729 3.333 3.417 3.333H8.25L9.917 5H16.667Q17.354 5 17.844 5.531Q18.333 6.062 18.333 6.75H3.417V14.917Q3.417 14.917 3.417 14.917Q3.417 14.917 3.417 14.917L5.438 8.5H19.583L17.396 15.479Q17.229 16.021 16.802 16.344Q16.375 16.667 15.833 16.667Z"/></svg>',Jo='<svg><path d="M4.792 15.083 8.333 11.542 9.833 13.021 11.667 10.708 15.167 15.083ZM6.667 8.417Q5.938 8.417 5.427 7.906Q4.917 7.396 4.917 6.667Q4.917 5.938 5.427 5.427Q5.938 4.917 6.667 4.917Q7.396 4.917 7.906 5.427Q8.417 5.938 8.417 6.667Q8.417 7.396 7.906 7.906Q7.396 8.417 6.667 8.417ZM4.167 18.333Q3.125 18.333 2.396 17.604Q1.667 16.875 1.667 15.833V4.167Q1.667 3.125 2.396 2.396Q3.125 1.667 4.167 1.667H15.833Q16.875 1.667 17.604 2.396Q18.333 3.125 18.333 4.167V15.833Q18.333 16.875 17.604 17.604Q16.875 18.333 15.833 18.333ZM4.167 16.583H15.833Q16.146 16.583 16.365 16.365Q16.583 16.146 16.583 15.833V4.167Q16.583 3.854 16.365 3.635Q16.146 3.417 15.833 3.417H4.167Q3.854 3.417 3.635 3.635Q3.417 3.854 3.417 4.167V15.833Q3.417 16.146 3.635 16.365Q3.854 16.583 4.167 16.583Z"/></svg>',su='<svg><path d="M8.708 16.667V5.917H4.167V3.333H15.833V5.917H11.292V16.667Z"/></svg>',cu='<svg><path d="M7.5 15.833V14.083H12.833L3.333 4.583L4.583 3.333L14.083 12.833V7.5H15.833V15.833Z"/></svg>',Jl='<svg><path d="M8.0145 11.1707C8.38484 10.9914 8.82183 11.1558 8.99959 11.5295L10.7031 15.2591L12.0363 14.6238L10.3254 10.9017C10.1476 10.528 10.3106 10.0795 10.6809 9.90761L10.8883 9.84782L12.5918 9.51148L6.48133 4.33192V12.389L7.82934 11.2903L8.0145 11.1707ZM10.6587 16.9258C10.2883 17.1052 9.84395 16.9482 9.67359 16.5745L8.05894 13.0318L6.19988 14.5416C6.07396 14.6462 5.91842 14.706 5.74066 14.706C5.54423 14.706 5.35584 14.6272 5.21694 14.4871C5.07803 14.3469 5 14.1568 5 13.9586V2.74741C5 2.54919 5.07803 2.35908 5.21694 2.21891C5.35584 2.07874 5.54423 2 5.74066 2C5.91842 2 6.08878 2.06727 6.21469 2.1719L6.2221 2.16443L14.7323 9.36947C15.0508 9.63854 15.0879 10.1094 14.8286 10.4233C14.7175 10.5579 14.562 10.6475 14.4064 10.6774L12.0659 11.1408L13.6954 14.6761C13.888 15.0498 13.7102 15.4908 13.3399 15.6627L10.6587 16.9258Z"/></svg>',Pl='<svg><path d="M2.5 15V13.25H17.5V15ZM2.5 10.875V9.125H17.5V10.875ZM2.5 6.75V5H17.5V6.75Z"/></svg>',Rl='<svg><path d="M10 13.354Q11.583 13.354 12.688 12.25Q13.792 11.146 13.792 9.562Q13.792 7.979 12.688 6.875Q11.583 5.771 10 5.771Q8.417 5.771 7.312 6.875Q6.208 7.979 6.208 9.562Q6.208 11.146 7.312 12.25Q8.417 13.354 10 13.354ZM10 11.812Q9.062 11.812 8.406 11.156Q7.75 10.5 7.75 9.562Q7.75 8.625 8.406 7.969Q9.062 7.312 10 7.312Q10.938 7.312 11.594 7.969Q12.25 8.625 12.25 9.562Q12.25 10.5 11.594 11.156Q10.938 11.812 10 11.812ZM10 15.833Q6.938 15.833 4.448 14.125Q1.958 12.417 0.833 9.562Q1.958 6.708 4.458 5.021Q6.958 3.333 10 3.333Q13.042 3.333 15.542 5.021Q18.042 6.708 19.167 9.562Q18.042 12.417 15.552 14.125Q13.062 15.833 10 15.833ZM10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562ZM10 14.083Q12.333 14.083 14.281 12.865Q16.229 11.646 17.25 9.562Q16.229 7.479 14.281 6.281Q12.333 5.083 10 5.083Q7.667 5.083 5.708 6.281Q3.75 7.479 2.729 9.562Q3.75 11.646 5.708 12.865Q7.667 14.083 10 14.083Z"/></svg>',tf='<svg><path d="M13.521 11.021 12.25 9.75Q12.333 8.75 11.604 7.979Q10.875 7.208 9.812 7.312L8.542 6.042Q8.896 5.896 9.26 5.833Q9.625 5.771 10 5.771Q11.583 5.771 12.688 6.875Q13.792 7.979 13.792 9.562Q13.792 9.979 13.719 10.354Q13.646 10.729 13.521 11.021ZM16.167 13.646 14.917 12.417Q15.667 11.833 16.25 11.146Q16.833 10.458 17.25 9.562Q16.229 7.479 14.292 6.281Q12.354 5.083 10 5.083Q9.396 5.083 8.885 5.156Q8.375 5.229 7.875 5.375L6.5 4Q7.354 3.646 8.208 3.49Q9.062 3.333 10 3.333Q13.146 3.333 15.615 5.052Q18.083 6.771 19.167 9.562Q18.688 10.792 17.917 11.823Q17.146 12.854 16.167 13.646ZM16.396 18.854 12.938 15.396Q12.208 15.625 11.479 15.729Q10.75 15.833 10 15.833Q6.833 15.833 4.375 14.094Q1.917 12.354 0.833 9.562Q1.25 8.479 1.917 7.552Q2.583 6.625 3.417 5.875L1.125 3.562L2.375 2.354L17.625 17.625ZM4.604 7.062Q4.021 7.604 3.542 8.219Q3.062 8.833 2.729 9.562Q3.75 11.646 5.688 12.865Q7.625 14.083 10 14.083Q10.354 14.083 10.74 14.052Q11.125 14.021 11.479 13.938L10.812 13.271Q10.625 13.312 10.417 13.333Q10.208 13.354 10 13.354Q8.417 13.354 7.312 12.25Q6.208 11.146 6.208 9.562Q6.208 9.354 6.24 9.167Q6.271 8.979 6.312 8.771ZM11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875ZM8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Z"/></svg>',ef='<svg><path d="M9.958 18.333Q8.25 18.333 6.74 17.677Q5.229 17.021 4.104 15.885Q2.979 14.75 2.323 13.229Q1.667 11.708 1.667 10Q1.667 8.271 2.333 6.75Q3 5.229 4.156 4.104Q5.312 2.979 6.854 2.323Q8.396 1.667 10.125 1.667Q11.771 1.667 13.26 2.25Q14.75 2.833 15.875 3.854Q17 4.875 17.667 6.26Q18.333 7.646 18.333 9.25Q18.333 11.688 16.792 12.948Q15.25 14.208 13.188 14.208H11.75Q11.625 14.208 11.562 14.281Q11.5 14.354 11.5 14.458Q11.5 14.688 11.812 15.219Q12.125 15.75 12.125 16.458Q12.125 17.458 11.51 17.896Q10.896 18.333 9.958 18.333ZM5.458 10.875Q6 10.875 6.375 10.5Q6.75 10.125 6.75 9.583Q6.75 9.042 6.375 8.667Q6 8.292 5.458 8.292Q4.917 8.292 4.542 8.667Q4.167 9.042 4.167 9.583Q4.167 10.125 4.542 10.5Q4.917 10.875 5.458 10.875ZM7.917 7.583Q8.458 7.583 8.833 7.208Q9.208 6.833 9.208 6.292Q9.208 5.75 8.833 5.375Q8.458 5 7.917 5Q7.375 5 7 5.375Q6.625 5.75 6.625 6.292Q6.625 6.833 7 7.208Q7.375 7.583 7.917 7.583ZM12.021 7.583Q12.562 7.583 12.938 7.208Q13.312 6.833 13.312 6.292Q13.312 5.75 12.938 5.375Q12.562 5 12.021 5Q11.479 5 11.104 5.375Q10.729 5.75 10.729 6.292Q10.729 6.833 11.104 7.208Q11.479 7.583 12.021 7.583ZM14.479 10.875Q15.021 10.875 15.396 10.5Q15.771 10.125 15.771 9.583Q15.771 9.042 15.396 8.667Q15.021 8.292 14.479 8.292Q13.938 8.292 13.562 8.667Q13.188 9.042 13.188 9.583Q13.188 10.125 13.562 10.5Q13.938 10.875 14.479 10.875Z"/></svg>',rf='<svg><path d="M9.188 16.542V14.938Q8.5 14.938 8.021 14.458Q7.542 13.979 7.542 13.292V12.458L3.583 8.5Q3.5 8.875 3.458 9.25Q3.417 9.625 3.417 10Q3.417 12.5 5.062 14.365Q6.708 16.229 9.188 16.542ZM14.854 14.438Q15.708 13.521 16.146 12.385Q16.583 11.25 16.583 10Q16.583 7.979 15.469 6.313Q14.354 4.646 12.479 3.917V4.229Q12.479 4.917 12 5.396Q11.521 5.875 10.833 5.875H9.188V7.521Q9.188 7.875 8.948 8.115Q8.708 8.354 8.354 8.354H6.708V10H11.646Q12 10 12.24 10.229Q12.479 10.458 12.479 10.812V13.292H13.292Q13.833 13.292 14.26 13.604Q14.688 13.917 14.854 14.438ZM10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.271 2.323 6.75Q2.979 5.229 4.104 4.104Q5.229 2.979 6.75 2.323Q8.271 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.729 17.677 13.25Q17.021 14.771 15.896 15.896Q14.771 17.021 13.25 17.677Q11.729 18.333 10 18.333Z"/></svg>',nf='<svg><path d="M10 0.833Q11.771 0.833 12.99 2.052Q14.208 3.271 14.208 5.042V6.667H14.917Q15.646 6.667 16.156 7.177Q16.667 7.688 16.667 8.417V16.562Q16.667 17.292 16.156 17.812Q15.646 18.333 14.917 18.333H5.083Q4.354 18.333 3.844 17.812Q3.333 17.292 3.333 16.562V8.417Q3.333 7.688 3.844 7.177Q4.354 6.667 5.083 6.667H5.792V5.042Q5.792 3.271 7.01 2.052Q8.229 0.833 10 0.833ZM10 2.583Q8.979 2.583 8.26 3.302Q7.542 4.021 7.542 5.042V6.667H12.458V5.042Q12.458 4.021 11.74 3.302Q11.021 2.583 10 2.583ZM5.083 16.583H14.917Q14.917 16.583 14.917 16.583Q14.917 16.583 14.917 16.583V8.417Q14.917 8.417 14.917 8.417Q14.917 8.417 14.917 8.417H5.083Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417V16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583ZM10 10.812Q9.292 10.812 8.802 11.302Q8.312 11.792 8.312 12.5Q8.312 13.208 8.802 13.698Q9.292 14.188 10 14.188Q10.708 14.188 11.198 13.698Q11.688 13.208 11.688 12.5Q11.688 11.792 11.198 11.302Q10.708 10.812 10 10.812ZM5.083 8.417Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417V16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583V8.417Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417Z"/></svg>',of='<svg><path d="M5.792 5.042Q5.792 3.271 7.01 2.052Q8.229 0.833 10 0.833Q11.771 0.833 12.99 2.052Q14.208 3.271 14.208 5.042V6.667H14.917Q15.646 6.667 16.156 7.177Q16.667 7.688 16.667 8.417V16.562Q16.667 17.292 16.156 17.812Q15.646 18.333 14.917 18.333H5.083Q4.354 18.333 3.844 17.812Q3.333 17.292 3.333 16.562V8.417Q3.333 7.688 3.844 7.177Q4.354 6.667 5.083 6.667H12.458V5.042Q12.458 4.021 11.74 3.302Q11.021 2.583 10 2.583Q8.979 2.583 8.26 3.302Q7.542 4.021 7.542 5.042ZM5.083 16.583H14.917Q14.917 16.583 14.917 16.583Q14.917 16.583 14.917 16.583V8.417Q14.917 8.417 14.917 8.417Q14.917 8.417 14.917 8.417H5.083Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417V16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583ZM10 10.812Q9.292 10.812 8.802 11.302Q8.312 11.792 8.312 12.5Q8.312 13.208 8.802 13.698Q9.292 14.188 10 14.188Q10.708 14.188 11.198 13.698Q11.688 13.208 11.688 12.5Q11.688 11.792 11.198 11.302Q10.708 10.812 10 10.812ZM5.083 8.417Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417V16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583Q5.083 16.583 5.083 16.583V8.417Q5.083 8.417 5.083 8.417Q5.083 8.417 5.083 8.417Z"/></svg>',uf='<svg><path d="M18.333 15.854 16.583 14.104V13.354H15.833L14.083 11.604H16.583V8.375H13.375V10.896L11.625 9.146V8.375H10.875L9.125 6.625H11.625V3.417H8.396V5.896L6.646 4.146V3.417H5.896L4.146 1.667H16.583Q17.312 1.667 17.823 2.177Q18.333 2.688 18.333 3.417ZM13.375 6.625H16.583V3.417Q16.583 3.417 16.583 3.417Q16.583 3.417 16.583 3.417H13.375ZM16.771 19.229 15.854 18.333H3.417Q2.688 18.333 2.177 17.823Q1.667 17.312 1.667 16.583V4.125L0.812 3.271L2.042 2.021L18 18ZM13.375 16.583H14.104L13.375 15.833ZM8.396 11.604H9.125L8.396 10.854ZM8.396 16.583H11.625V14.083L10.875 13.354H8.396ZM3.417 6.625H4.167L3.417 5.875ZM3.417 11.604H6.646V9.104L5.917 8.375H3.417ZM6.646 16.583V13.354H3.417V16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583Z"/></svg>',lu='<svg><path d="M7.521 17.5Q6.125 17.5 5.146 16.51Q4.167 15.521 4.167 14.125V7.417Q3.438 7.125 2.969 6.49Q2.5 5.854 2.5 5.042Q2.5 3.979 3.24 3.24Q3.979 2.5 5.042 2.5Q6.104 2.5 6.844 3.24Q7.583 3.979 7.583 5.042Q7.583 5.854 7.115 6.49Q6.646 7.125 5.917 7.417V14.125Q5.917 14.792 6.385 15.271Q6.854 15.75 7.521 15.75Q8.188 15.75 8.656 15.271Q9.125 14.792 9.125 14.125V5.875Q9.125 4.479 10.104 3.49Q11.083 2.5 12.479 2.5Q13.875 2.5 14.854 3.49Q15.833 4.479 15.833 5.875V12.583Q16.562 12.875 17.031 13.51Q17.5 14.146 17.5 14.958Q17.5 16.021 16.76 16.76Q16.021 17.5 14.958 17.5Q13.896 17.5 13.156 16.76Q12.417 16.021 12.417 14.958Q12.417 14.146 12.885 13.5Q13.354 12.854 14.083 12.583V5.875Q14.083 5.208 13.615 4.729Q13.146 4.25 12.479 4.25Q11.812 4.25 11.344 4.729Q10.875 5.208 10.875 5.875V14.125Q10.875 15.521 9.896 16.51Q8.917 17.5 7.521 17.5Z"/></svg>',fu='<svg><path d="M5.833 15V3.333H10.375Q11.812 3.333 12.885 4.156Q13.958 4.979 13.958 6.375Q13.958 7.375 13.49 7.969Q13.021 8.562 12.396 8.875V9.042Q13.312 9.354 13.844 10.021Q14.375 10.688 14.375 11.75Q14.375 13.312 13.229 14.156Q12.083 15 10.5 15ZM8.125 8.042H10.188Q10.854 8.042 11.302 7.656Q11.75 7.271 11.75 6.708Q11.75 6.167 11.302 5.771Q10.854 5.375 10.188 5.375H8.125ZM8.125 12.917H10.354Q11.167 12.917 11.625 12.51Q12.083 12.104 12.083 11.458Q12.083 10.812 11.625 10.406Q11.167 10 10.354 10H8.125Z"/></svg>',pu='<svg><path d="M4.167 16.667V14.083H6.979L10.229 5.917H7.5V3.333H15.833V5.917H13.021L9.771 14.083H12.5V16.667Z"/></svg>',hu='<svg><path d="M3.021 16V15H17V16ZM3.021 13.5V12H17V13.5ZM3 10.5V8.5H16.979V10.5ZM3.021 7V4H17V7Z"/></svg>',af='<svg><path d="M3 16V14.5H4.5V16ZM6.125 16V14.5H7.625V16ZM9.25 16V14.5H10.75V16ZM12.375 16V14.5H13.875V16ZM15.5 16V14.5H17V16ZM3 13V11.5H6.5V13ZM8.25 13V11.5H11.75V13ZM13.5 13V11.5H17V13ZM3 10V8.5H9.25V10ZM10.75 10V8.5H17V10ZM3 7V4H17V7Z"/></svg>',sf='<svg><path d="M5.312 14.979H7.125L8.042 12.479H11.979L12.896 14.979H14.708L10.917 5H9.083ZM8.542 10.958 9.958 6.958H10.042L11.458 10.958ZM3.417 18.333Q2.688 18.333 2.177 17.823Q1.667 17.312 1.667 16.583V3.417Q1.667 2.688 2.177 2.177Q2.688 1.667 3.417 1.667H16.583Q17.312 1.667 17.823 2.177Q18.333 2.688 18.333 3.417V16.583Q18.333 17.312 17.823 17.823Q17.312 18.333 16.583 18.333ZM3.417 16.583H16.583Q16.583 16.583 16.583 16.583Q16.583 16.583 16.583 16.583V3.417Q16.583 3.417 16.583 3.417Q16.583 3.417 16.583 3.417H3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417V16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583ZM3.417 3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417V16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583V3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417Z"/></svg>',cf='<svg><path d="M6 17 2 13 6 9 7.062 10.062 4.875 12.25H17V13.75H4.875L7.062 15.938ZM14 11 12.938 9.938 15.125 7.75H3V6.25H15.125L12.938 4.062L14 3L18 7Z"/></svg>',lf='<svg><path d="M2.5 15.833V14.083H7.667V15.833ZM2.5 5.917V4.167H10.771V5.917ZM9.208 17.5V12.438H10.958V14.083H17.5V15.833H10.958V17.5ZM5.917 12.542V10.875H2.5V9.125H5.917V7.479H7.667V12.542ZM9.208 10.875V9.125H17.5V10.875ZM12.333 7.562V2.5H14.083V4.167H17.5V5.917H14.083V7.562Z"/></svg>',du='<svg><path d="M16.354 18.833 14.521 17Q13.542 17.646 12.396 17.99Q11.25 18.333 10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.729 2.01 7.594Q2.354 6.458 3 5.458L1.167 3.625L2.396 2.396L17.583 17.604ZM10 16.583Q10.896 16.583 11.708 16.365Q12.521 16.146 13.25 15.729L4.292 6.75Q3.875 7.479 3.646 8.292Q3.417 9.104 3.417 10Q3.417 12.729 5.344 14.656Q7.271 16.583 10 16.583ZM17 14.562 15.708 13.271Q16.125 12.542 16.354 11.719Q16.583 10.896 16.583 10Q16.583 7.271 14.656 5.344Q12.729 3.417 10 3.417Q9.104 3.417 8.292 3.646Q7.479 3.875 6.75 4.292L5.458 3Q6.458 2.354 7.594 2.01Q8.729 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.271 17.979 12.417Q17.625 13.562 17 14.562ZM11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771ZM8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Z"/></svg>',vu='<svg ><path d="M16.354 18.833 14.521 17Q13.542 17.646 12.396 17.99Q11.25 18.333 10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.729 2.01 7.594Q2.354 6.458 3 5.458L1.167 3.625L2.396 2.396L17.583 17.604ZM17 14.562 5.458 3Q6.458 2.354 7.594 2.01Q8.729 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.271 17.979 12.417Q17.625 13.562 17 14.562Z"/></svg>',Bt="react-paint-",ff={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"transparent"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:tr,default:0}},pf={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"transparent"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:tr,default:0}},hf={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"transparent"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:tr,default:0}},df={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"transparent"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:tr,default:0}},vf={opacity:{min:0,max:100,step:1,default:100}},gf={strokeColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},fontFamily:{values:fc,default:en},fontBold:{values:[!1,!0],default:!1},fontItalic:{values:[!1,!0],default:!1}},yf={strokeColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:6,max:20,step:2,default:10},lineDash:{values:tr,default:0}},_f={strokeColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:tr,default:0},lineArrow:{values:lc,default:0}},mf={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:tr,default:0},pointsCount:{min:3,max:10,step:1,default:3}},Qf={strokeColor:{values:te,default:"black"},fillColor:{values:te,default:"black"},opacity:{min:0,max:100,step:1,default:100},lineWidth:{min:1,max:20,step:1,default:1},lineDash:{values:tr,default:0},pointsCount:{min:3,max:10,step:1,default:3}},Po={type:"picture",id:`${Bt}picture`,icon:Jo,label:"Image",settings:vf},gu={type:"brush",id:`${Bt}brush`,icon:iu,label:"Brosse",settings:yf},yu={type:"line",id:`${Bt}line`,icon:cu,label:"Ligne",settings:_f},_u={type:"polygon",id:`${Bt}polygon`,icon:Ko,label:"Polygone",settings:mf},mu={type:"curve",id:`${Bt}curve`,icon:lu,label:"Courbe",settings:Qf},Qu={type:"rect",id:`${Bt}rect`,icon:$n,label:"Rectangle",settings:ff},bu={type:"square",id:`${Bt}square`,icon:$n,label:"Carré",settings:pf},wu={type:"circle",id:`${Bt}circle`,icon:Fn,label:"Cercle",settings:hf},Cu={type:"ellipse",id:`${Bt}ellipse`,icon:Fn,label:"Ellipse",settings:df},Eu={type:"text",id:`${Bt}text`,icon:su,label:"Texte",settings:gf},bf=[gu,yu,_u,mu,Qu,bu,wu,Cu,Po,Eu],je={id:`${Bt}selection`,type:"selection",icon:Jl,label:"Sélection"},Tr={id:`${Bt}undo`,type:"undo",icon:Fl,label:"Undo"},Nr={id:`${Bt}redo`,type:"redo",icon:Sl,label:"Redo"},Dr={id:`${Bt}clear`,type:"clear",icon:Yl,label:"Clear"},Ro={id:`${Bt}export`,type:"export",icon:Xl,label:"Export PNG"},Au={id:`${Bt}load`,type:"loadfile",icon:Kl,label:"Load project"},ti={id:`${Bt}save`,type:"savefile",icon:Gl,label:"Save project"},Iu={id:`${Bt}upload-picture`,type:"uploadpicture",icon:Jo,label:"Upload picture"},ei=(n,o,u)=>({...n,selection:xr(n,o,u)}),wf=ei,Lu=(n,o,u,a,l,f)=>{const[p,d]=Fc(n.width,n.height,u,a,!0);return ei({toolId:Po.id,type:"picture",id:I.uniqueId("picture_"),x:(u-p)/2,y:(a-d)/2,width:p,height:d,src:o,img:n,rotation:0},l,f)},Cf=(n,o,u,a,l,f,p)=>{const d=URL.createObjectURL(u);n.onload=async()=>{if(URL.revokeObjectURL(n.src),eu(u)&&!n.width&&!n.height){const w=await u.text(),C=tu(w);if(d===n.src){n.src=C;return}}const Q=Lu(n,n.src,a,l,f,p);o(Q)},n.src=d},Ef=(n,o,u,a,l,f,p)=>{n.onload=()=>{URL.revokeObjectURL(n.src);const d=Lu(n,u,a,l,f,p);o(d)},ru(u).then(d=>{n.src=d}).catch(()=>{n.src=""})},Af=(n,o,u,a,l)=>new Promise((f,p)=>{const d=new Image;d.onerror=()=>{p(new Error("Some images could not be loaded"))},setTimeout(()=>{p(new Error("Timeout while loading images"))},4e3),n instanceof File?Cf(d,f,n,o,u,a,l):Ef(d,f,n,o,u,a,l)}),If=(n,o)=>{n.globalAlpha!==0&&(n.beginPath(),n.drawImage(o.img,o.x,o.y,o.width,o.height))},Lf=(n,o)=>K1(n,o),xf=(n,o,u,a,l,f)=>ei({...o,x:vt(o.x+n[0]-u[0],a),y:vt(o.y+n[1]-u[1],a)},l,f),kf=(n,o,u,a,l,f,p)=>qo(n,o,u,a,l,f,p),xu=(n,o,u,a,l,f)=>{const p=[vt(u[0],a),vt(u[1],a)];switch(o.type){case"brush":return Hc(o,p,l,f);case"line":return Kc(o,p,l,f);case"polygon":return rl(o,p,l,f);case"curve":return sl(o,p,l,f);case"rect":case"square":return dl(o,p,l,f);case"text":return yl(n,o,p,l,f);case"ellipse":return Al(o,p,l,f);case"circle":return Tl(o,p,l,f)}},ku=(n,o,u,a,l)=>{if(o.visible===!1)return;const{center:f}=jt(o,l);switch(V1(n,u,a,o.rotation,f),Lr(n,o.style),o.type){case"brush":Vc(n,o);break;case"text":_l(n,o);break;case"line":Jc(n,o);break;case"polygon":nl(n,o);break;case"curve":ll(n,o);break;case"circle":Nl(n,o);break;case"ellipse":Il(n,o);break;case"rect":X1(n,o);break;case"square":X1(n,o);break;case"picture":If(n,o);break}n.restore()},Of=(n,o)=>{switch(n.type){case"brush":return Wc(n,o);case"line":return Pc(n,o);case"polygon":return G1(n,o);case"curve":return fl(n,o);case"circle":return Dl(n,o);case"ellipse":return Ll(n,o);case"rect":case"square":return K1(n,o);case"text":return ml(n,o);case"picture":return Lf(n,o);default:return{x:0,y:0,width:100,height:100}}},Tf=n=>[n.x+n.width/2,n.y+n.height/2],jt=(n,o)=>{const u=Of(n,o),a=Tf(u);return{borders:u,center:a}},Nf=(n,o,u,a,l,f)=>{const p=l[0]-a[0],d=l[1]-a[1],Q=l[0]-o[0],w=l[1]-o[1],C=u.rotation+Math.atan2(w,Q)-Math.atan2(d,p);return{...n,rotation:Uc(C,f)}},Df=(n,o,u,a,l,f,p,d,Q,w)=>{switch(l.type){case"line":return tl(u,a,l,f,p,d,w);case"polygon":return il(u,a,l,f,p,d,w);case"curve":return cl(u,a,l,f,p,d,w);case"brush":return Bc(u,l,f,p,d,w,Q);case"circle":return Hl(u,l,f,p,d,w);case"ellipse":return kl(u,l,f,p,d,w,Q);case"rect":case"square":return qo(u,l,f,p,d,w,o.type==="square"||Q);case"text":return bl(n,u,l,f,p,d,w);case"picture":return kf(u,l,f,p,d,w,!Q);default:return l}},ri=(n,o,u,a,l,f)=>{switch(o.type){case"rect":case"square":return vl(n,o,u,a,l,f);case"ellipse":return xl(n,o,u,a,l,f);case"circle":return Ml(n,o,u,a,l,f);case"picture":return xf(n,o,u,a,l,f);case"text":return Ql(n,o,u,a,l,f);case"line":return Rc(n,o,u,a,l,f);case"polygon":return ol(n,o,u,a,l,f);case"curve":return pl(n,o,u,a,l,f);case"brush":return Zc(n,o,u,a,l,f);default:return o}},on=(n,o,u)=>{switch(n.type){case"rect":case"square":return hl(n,o,u);case"ellipse":return El(n,o,u);case"circle":return Ol(n,o,u);case"picture":return wf(n,o,u);case"text":return gl(n,o,u);case"line":return Xc(n,o,u);case"polygon":return el(n,o,u);case"curve":return al(n,o,u);case"brush":return Mc(n,o,u);default:return n}},Mf=({ctx:n,shape:o,currentScale:u=1,canvasOffset:a,selectionPadding:l,selectionWidth:f,selectionColor:p,withAnchors:d=!0})=>{const{center:Q}=jt(o,l);switch(V1(n,u,a,o.rotation,Q),o.type){case"rect":case"square":case"circle":case"ellipse":case"picture":case"text":case"brush":Tc(n,o,p,f,u,d);break;case"polygon":case"line":case"curve":Gc({ctx:n,shape:o,withAnchors:d,selectionWidth:f,selectionColor:p,currentScale:u});break}n.restore()},Hf=(n,o,u,a)=>({...ri([20,20],n,[0,0],o,u,a),id:I.uniqueId(`${n.type}_`)}),Vf=({disabled:n=!1,scaleRatio:o,shape:u,defaultValue:a,updateValue:l,saveShapes:f,selectionPadding:p})=>{const d=x.useRef(null),Q=x.useRef(f),w=k=>{l(Ic(k.target.innerHTML))};x.useEffect(()=>{if(!d.current)return;const k=d.current,N=H=>{H.preventDefault();const T=H.clipboardData?.getData("text/plain");document.execCommand("insertText",!1,T)};return k.addEventListener("paste",N),k.innerHTML=Ec(a),k.focus(),()=>{k.removeEventListener("paste",N)}},[a]),x.useEffect(()=>{const k=Q.current;return()=>{k()}},[]);const C=x.useMemo(()=>{const{borders:k,center:N}=jt(u,p);return Be({point:[k.x,k.y],rotation:-u.rotation,origin:N})},[u,p]);return y.jsx("div",{className:"react-paint-editor-toolbox-edittextbox",ref:d,"data-fontbold":u.style?.fontBold??!1,"data-fontitalic":u.style?.fontItalic??!1,contentEditable:!n,onInput:w,style:{"--react-paint-editor-toolbox-edittextbox-transform":`translate3D(${C[0]*o}px, ${C[1]*o}px, 0) rotate(${Fo(u.rotation)}deg)`,"--react-paint-editor-toolbox-edittextbox-fontsize":`${u.fontSize*o}px`,"--react-paint-editor-toolbox-edittextbox-padding":`${p*o}px`,"--react-paint-editor-toolbox-edittextbox-color":u.style?.strokeColor??"inherit","--react-paint-editor-toolbox-edittextbox-opacity":(u.style?.globalAlpha??100)/100,"--react-paint-editor-toolbox-edittextbox-fontfamily":u.style?.fontFamily??en}})},Wf=(n,o,u,a)=>{if(n.mode==="translate")return{mode:"translate",cursorStartPosition:u,originalShape:o};if(n.mode==="rotate"){const{center:l}=jt(o,a),f=[l[0],l[1]];return{mode:"rotate",cursorStartPosition:u,originalShape:o,center:f}}else if(n.mode==="resize")return{mode:"resize",cursorStartPosition:u,originalShape:o,anchor:n.anchor}},Zf=(n,o,u,a,l,f)=>{if(l){const d=Wn(l,o,a,f,u,!0)||{mode:"default"},Q=Wf(d,l,o,f);if(Q?.mode==="resize"||Q?.mode==="rotate")return{shape:l,mode:Q}}const p=n.find(d=>!!Wn(d,o,a,f,u,!1));return p?{shape:p,mode:{mode:"translate",cursorStartPosition:o,originalShape:p}}:{shape:void 0,mode:{mode:"default"}}},Bf=300,jf=()=>{const n=x.useRef(void 0),o=x.useRef(void 0),u=f=>{const p=new Date().getTime();n.current&&p<n.current+Bf&&o.current?.(f),n.current=new Date().getTime()};return{registerDoubleClickEvent:(f,p)=>{o.current=p,f.addEventListener("click",u),f.addEventListener("touchend",u)},unRegisterDoubleClickEvent:f=>{f.removeEventListener("click",u),f.removeEventListener("touchend",u)}}},zf=(n,o,u,a,l,f,p,d,Q,w,C,k,N,H,T,Z,V)=>{if(u.type==="move"&&d!==void 0){const R=Hn(n,o.current,Q,w,C);H([R[0]-d[0],R[1]-d[1]])}if(f==null||f.locked)return;const q=Hn(n,o.current,Q,w,C);if(p.mode==="default"||p.mode==="textedition"){const R=Wn(f,q,l,Z,C,!0)||{mode:"default"};k(R)}else{const R=o.current?.getContext("2d");if(!R)return;const $=$c(R,f,q,a,l,p,Z,V,C);N($),T($)}},Uf=({disabled:n=!1,addShape:o,canvasSize:u,drawCanvasRef:a,setActiveTool:l,shapes:f,selectionMode:p,activeTool:d,isInsideComponent:Q,setCanvasOffset:w,selectedShape:C,selectionCanvasRef:k,canvasOffsetStartPosition:N,setSelectedShape:H,setCanvasOffsetStartPosition:T,updateSingleShape:Z,gridFormat:V,canvasOffset:q,saveShapes:R,setSelectionMode:$,selectionPadding:ct,isShiftPressed:ht})=>{const{width:dt,height:mt,scaleRatio:gt}=u,[D,G]=x.useState({mode:"default"}),{registerDoubleClickEvent:S,unRegisterDoubleClickEvent:tt}=jf();return x.useEffect(()=>{const et=pt=>window.requestAnimationFrame(()=>zf(pt,k,d,V,q,C,p,N,dt,mt,gt,G,Z,w,H,ct,ht));return Q&&(document.addEventListener("mousemove",et),document.addEventListener("touchmove",et)),()=>{Q&&(document.removeEventListener("mousemove",et),document.removeEventListener("touchmove",et))}},[Q,k,C,p,G,V,q,N,dt,mt,gt,Z,d,w,H,ct,ht]),x.useEffect(()=>{const et=()=>{p.mode!=="textedition"&&p.mode!=="default"&&($({mode:"default"}),R())};return Q&&(document.addEventListener("mouseup",et),document.addEventListener("touchend",et)),()=>{Q&&(document.removeEventListener("mouseup",et),document.removeEventListener("touchend",et))}},[Q,p,R,$]),x.useEffect(()=>{const et=k.current;if(!et||n)return;const pt=yt=>{yt.preventDefault();const Tt=Hn(yt,k.current,dt,mt,gt);if(d.type==="selection"){const{shape:wt,mode:it}=Zf(f,Tt,gt,q,C,ct);H(wt),$(it)}else d.type==="move"&&T(Tt);if(D1.includes(d.type)){const wt=a.current?.getContext("2d");if(!wt)return;if(d.type==="brush"){if(C&&C.type==="brush"){const it=zc(C,Tt,gt,ct);Z(it),H(it)}else{const it=xu(wt,d,Tt,V,gt,ct);if(!it)return;o(it),H(it)}$({mode:"brush"})}else if(d.type!=="picture"){const it=xu(wt,d,Tt,V,gt,ct);o(it),l(je),H(it),$({mode:"resize",cursorStartPosition:[Tt[0]+ct,Tt[1]+ct],originalShape:it,anchor:d.type==="line"||d.type==="polygon"||d.type==="curve"?0:[1,1]})}}};return et.addEventListener("mousedown",pt,{passive:!1}),et.addEventListener("touchstart",pt,{passive:!1}),()=>{et.removeEventListener("mousedown",pt),et.removeEventListener("touchstart",pt)}},[n,k,a,C,d,q,T,f,dt,mt,gt,Z,o,l,H,$,ct,V]),x.useEffect(()=>{const et=k.current;if(!et)return;const pt=yt=>{if(d.type==="selection"&&C?.type==="text"){const Tt=Hn(yt,k.current,dt,mt,gt);Wn(C,Tt,q,ct)&&$({mode:"textedition",defaultValue:C.value})}};if(Q)return S(et,pt),()=>{tt(et)}},[S,tt,Q,k,d,C,dt,mt,gt,q,$,ct]),{hoverMode:D}},$f=(n,o,u,a,l,f)=>{n.strokeStyle="rgb(220,220,220)",n.lineWidth=1,n.save(),n.scale(a,a),n.beginPath();const p=dr[f-1],d=-l[0]%p,Q=-l[1]%p,w=Math.ceil(o/a/p),C=Math.ceil(u/a/p);for(let k=0;k<w;k++)n.moveTo(d+(k+1)*p,Q),n.lineTo(d+(k+1)*p,Q+u/a);for(let k=0;k<C;k++)n.moveTo(d,Q+(k+1)*p),n.lineTo(d+o/a,Q+(k+1)*p);n.stroke(),n.restore()},Ff=(n,o,u,a,l,f,p,d)=>{const{width:Q,height:w,scaleRatio:C}=u;n.clearRect(0,0,Q,w),H1(n),a&&$f(n,Q,w,C,l,a);for(let k=f.length-1;k>=0;k--)(o.mode!=="textedition"||f[k]!==d)&&ku(n,f[k],C,l,p)},Sf=(n,o,u,a,l,f,p,d,Q)=>{const{width:w,height:C,scaleRatio:k}=u;n.clearRect(0,0,w,C),Q&&a.type!=="brush"&&Mf({ctx:n,shape:Q,currentScale:k,canvasOffset:l,selectionPadding:f,selectionWidth:p,selectionColor:d,withAnchors:o.mode!=="textedition"})},qf=x.forwardRef(({gridFormat:n,canGrow:o,disabled:u=!1,canvasSize:a,shapes:l,addShape:f,updateSingleShape:p,selectedShape:d,setSelectedShape:Q,saveShapes:w,activeTool:C,setActiveTool:k,canvasOffsetStartPosition:N,setCanvasOffsetStartPosition:H,canvasOffset:T,setCanvasOffset:Z,isInsideComponent:V,selectionMode:q,setSelectionMode:R,selectionWidth:$,selectionColor:ct,selectionPadding:ht,isEditMode:dt,isShiftPressed:mt},gt)=>{const D=x.useRef(null),G=x.useRef(null);x.useImperativeHandle(gt,()=>D.current);const{hoverMode:S}=Uf({disabled:u,addShape:f,canvasSize:a,drawCanvasRef:D,setActiveTool:k,shapes:l,selectionMode:q,activeTool:C,isInsideComponent:V,setCanvasOffset:Z,selectedShape:d,selectionCanvasRef:G,canvasOffsetStartPosition:N,setSelectedShape:Q,setCanvasOffsetStartPosition:H,updateSingleShape:p,gridFormat:n,canvasOffset:T,saveShapes:w,setSelectionMode:R,selectionPadding:ht,isShiftPressed:mt}),{scaleRatio:tt}=a,et=x.useCallback(pt=>{if(d?.type!=="text")return;const yt=D.current?.getContext("2d");if(!yt)return;const Tt=on(Cl(yt,d,pt,ht,T),tt,ht);p(Tt)},[p,d,T,tt,ht]);return x.useEffect(()=>{const pt=D.current?.getContext("2d");pt&&window.requestAnimationFrame(()=>Ff(pt,q,a,n,T,l,ht,d))},[l,n,q,d,T,a,ht]),x.useEffect(()=>{const pt=G.current?.getContext("2d");pt&&window.requestAnimationFrame(()=>Sf(pt,q,a,C,T,ht,$,ct,d))},[q,d,C,T,a,ht,$,ct]),y.jsx("div",{className:"react-paint-editor-canvas-box",children:y.jsxs("div",{className:"react-paint-editor-canvas-container","data-grow":o,children:[y.jsx("canvas",{className:"react-paint-editor-canvas-drawcanvas",ref:D,"data-grow":o,width:a.width,height:a.height}),dt&&y.jsx("canvas",{className:"react-paint-editor-canvas-selectioncanvas",ref:G,width:a.width,height:a.height,"data-grow":o,style:{"--react-paint-editor-canvas-cursor":C.type!=="selection"&&C.type!=="move"||S.mode==="resize"?"crosshair":C.type==="move"||S.mode==="translate"?"move":S.mode==="rotate"?"grab":"default"}}),dt&&q.mode==="textedition"&&d?.type==="text"&&y.jsx(Vf,{scaleRatio:a.scaleRatio,disabled:u,shape:d,defaultValue:q.defaultValue,updateValue:et,saveShapes:w,selectionPadding:ht})]})})}),Yf=({disabled:n=!1,ref:o,shape:u,layoutDragging:a,setLayoutDragging:l,handleSelect:f,onMoveShapes:p})=>{const[d,Q]=x.useState(!1);return x.useEffect(()=>{a||Q(!1)},[a]),x.useEffect(()=>{const w=o.current;if(!w)return;const C=()=>{l(void 0)},k=V=>(V.preventDefault&&V.preventDefault(),!1),N=V=>{f(u),V.dataTransfer&&(V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("draggableShapeId",u.id),l(u.id))},H=()=>{a!==u.id&&Q(!0)},T=()=>{Q(!1)},Z=V=>(V.stopPropagation(),V.dataTransfer&&p(V.dataTransfer.getData("draggableShapeId"),u.id),!1);return n||(w.addEventListener("dragstart",N),w.addEventListener("dragend",C),w.addEventListener("dragover",k),w.addEventListener("dragenter",H),w.addEventListener("dragleave",T),w.addEventListener("drop",Z)),()=>{n||(w.removeEventListener("dragstart",N),w.removeEventListener("dragend",C),w.removeEventListener("dragover",k),w.removeEventListener("dragenter",H),w.removeEventListener("dragleave",T),w.removeEventListener("drop",Z))}},[n,o,u,l,f,p,a]),{isOver:d}},Gf=n=>{switch(n){case"brush":return iu;case"line":return cu;case"polygon":return Ko;case"curve":return lu;case"rect":return $n;case"square":return $n;case"circle":return Fn;case"ellipse":return Fn;case"text":return su;case"picture":return Jo;case"triangle":return""}},It=x.forwardRef((n,o)=>{if(n.type==="file"||n.type==="color"){const{hidden:u=!1,disabled:a=!1,selected:l=!1,icon:f,children:p,className:d="",title:Q,onClick:w,...C}=n;return y.jsxs("label",{className:`react-paint-editor-button ${d}`,title:Q,onClick:w,"data-disabled":+a,"data-selected":+l,"data-hidden":+u,children:[y.jsx("input",{ref:o,disabled:a,...C}),y.jsxs("span",{className:"react-paint-editor-button-content",children:[p&&y.jsx("span",{className:"react-paint-editor-button-children",children:p}),f&&y.jsx("span",{className:"react-paint-editor-button-icon",dangerouslySetInnerHTML:{__html:f}})]})]})}else{const{hidden:u=!1,disabled:a=!1,selected:l=!1,icon:f,children:p,type:d="button",className:Q="",...w}=n;return y.jsx("button",{className:`react-paint-editor-button ${Q}`,ref:o,disabled:a,"data-disabled":+a,"data-selected":+l,"data-hidden":+u,type:d,...w,children:y.jsxs("span",{className:"react-paint-editor-button-content",children:[p&&y.jsx("span",{className:"react-paint-editor-button-children",children:p}),f&&y.jsx("span",{className:"react-paint-editor-button-icon",dangerouslySetInnerHTML:{__html:f}})]})})}}),Mr=({children:n,title:o="",className:u="",position:a="bottom",fitContainer:l=!1,alignment:f="center"})=>y.jsxs("div",{className:`react-paint-editor-panel ${u}`,"data-fitcontainer":l,"data-position":a,"data-alignment":f,style:{"--react-paint-editor-panel-zindex":rn.PANEL},children:[o&&y.jsx("h3",{className:"react-paint-editor-panel-title",children:o}),n]}),Xf=({disabled:n=!1,shape:o,selected:u,layoutDragging:a,toggleShapeVisibility:l,toggleShapeLock:f,setLayoutDragging:p,handleRemove:d,handleSelect:Q,onMoveShapes:w})=>{const C=x.useRef(null),k=V=>{n||(V.preventDefault(),V.stopPropagation(),d(o))},N=V=>{n||(V.preventDefault(),V.stopPropagation(),Q(o))},H=V=>{n||(V.preventDefault(),V.stopPropagation(),l(o))},T=V=>{n||(V.preventDefault(),V.stopPropagation(),f(o))},{isOver:Z}=Yf({disabled:n,ref:C,shape:o,layoutDragging:a,setLayoutDragging:p,handleSelect:Q,onMoveShapes:w});return y.jsxs("div",{className:"react-paint-editor-layout","data-disabled":+n,draggable:!n,"data-is-dragging":+(a===o.id),"data-is-over":+Z,onClick:N,"data-selected":+u,ref:C,children:[y.jsx("span",{dangerouslySetInnerHTML:{__html:Gf(o.type)}}),y.jsx("span",{children:o.id}),y.jsx("div",{className:"react-paint-editor-layouts-separator"}),y.jsx(It,{className:"react-paint-editor-layouts-visible-button",title:o.visible?"Hide":"Show","data-visible":o.visible!==!1,disabled:n,selected:u,onClick:H,icon:o.visible===!1?tf:Rl}),y.jsx(It,{className:"react-paint-editor-layouts-locked-button",title:o.locked?"Locked":"Unlocked","data-locked":!!o.locked,disabled:n,selected:u,onClick:T,icon:o.locked?nf:of}),y.jsx(It,{className:"react-paint-editor-layouts-remove-button",title:"Remove",disabled:n,onClick:k,icon:uu})]})},Kf=({gridFormat:n,setGridFormat:o,disabled:u=!1,shapes:a,removeShape:l,toggleShapeVisibility:f,toggleShapeLock:p,selectedShape:d,moveShapes:Q,selectShape:w,isLayoutPanelShown:C})=>{const[k,N]=x.useState(void 0);return C?y.jsx(Mr,{alignment:"right",className:"react-paint-editor-layouts-panel",children:y.jsx("div",{className:"react-paint-editor-layouts-panel-content",children:y.jsxs("div",{className:"react-paint-editor-layouts-scrolling-content",children:[y.jsxs("div",{className:"react-paint-editor-layouts-row",children:[y.jsx("span",{className:"react-paint-editor-layouts-subtitle",children:"Grid"}),y.jsx(It,{icon:uf,className:"react-paint-editor-layouts-grid-button",selected:n===0,disabled:u,onClick:()=>o(0)}),["S","M","L"].map((H,T)=>y.jsx(It,{className:"react-paint-editor-layouts-grid-button",selected:n===T+1,disabled:u,onClick:()=>o(T+1),children:H},H))]}),y.jsx("hr",{}),y.jsx("div",{className:"react-paint-editor-layouts",children:a.length===0?y.jsx("div",{className:"react-paint-editor-layouts-placeholder",children:"No layer yet"}):a.map(H=>y.jsx(Xf,{shape:H,disabled:u,layoutDragging:k,setLayoutDragging:N,selected:d?.id===H.id,handleSelect:w,handleRemove:l,onMoveShapes:Q,toggleShapeVisibility:f,toggleShapeLock:p},H.id))})]})})}):null},Jf=(n,o)=>I.flow(I.flatMap(u=>{if(!I.isObject(u))return I.filter({type:u},n);const a=I.filter(l=>I.includes(l.type,u.toolsType),n);return a?{...u,toolsType:a}:null}),I.compact)(o),Ou=(n,o=!1)=>{const u=(a,l)=>{if(I.isArray(a))return l};return I.flow(I.map(a=>{if(!I.isObject(a))return null;switch(a.type){case"brush":return I.mergeWith(u,gu,a);case"circle":return I.mergeWith(u,wu,a);case"curve":return I.mergeWith(u,mu,a);case"ellipse":return I.mergeWith(u,Cu,a);case"line":return I.mergeWith(u,yu,a);case"polygon":return I.mergeWith(u,_u,a);case"rect":return I.mergeWith(u,Qu,a);case"square":return I.mergeWith(u,bu,a);case"text":return I.mergeWith(u,Eu,a)}return null}),a=>o?[...a,Po]:a,I.compact)(n)},fe=({type:n,img:o,isActive:u,withText:a=!1,disabled:l=!1,setActive:f})=>{const p=()=>{f(n)};return y.jsx(It,{disabled:l,selected:u,onClick:p,title:n.label??n.type,icon:o,children:a?n.label:void 0})},Tu=(n,o)=>!(n.target instanceof Node)||!o?!1:o.contains(n.target),Pf=({activeTool:n,alignment:o,group:u,disabled:a=!1,setActiveToolFromId:l})=>{const f=x.useRef(null),[p,d]=x.useState(!1),[,Q]=x.useTransition(),[w,C]=x.useState(void 0),k=Z=>{C(Z),l(Z.id)};if(x.useEffect(()=>{if(!p)return;const Z=V=>{!Tu(V,f.current)&&d(!1)};return document.addEventListener("mousedown",Z,{passive:!1}),document.addEventListener("touchstart",Z,{passive:!1}),()=>{document.removeEventListener("mousedown",Z),document.removeEventListener("touchstart",Z)}},[p]),"type"in u)return y.jsx(fe,{disabled:a,type:u,img:u.icon,isActive:n.id===u.id,setActive:k});if(!u.toolsType.length)return null;if(u.toolsType?.length===1)return y.jsx(fe,{disabled:a,type:u.toolsType[0],img:u.toolsType[0].icon,isActive:n.id===u.toolsType[0].id,setActive:k});const N=u?.toolsType.find(Z=>Z.type===n.type)!==void 0,H=(w?w.icon:u.toolsType&&u.toolsType[0]&&u.toolsType[0].icon)??u.title,T=()=>{w?l(w.id):u.toolsType&&u.toolsType[0]&&k(u.toolsType[0]),Q(()=>{d(!0)})};return y.jsxs("div",{className:"react-paint-editor-toolbargroup-relative",children:[y.jsx(It,{selected:N,title:u.title,disabled:a,onClick:T,icon:H}),p&&y.jsx(Mr,{alignment:o,position:"top",children:y.jsx("div",{className:"react-paint-editor-toolbargroup-panel-content","data-vertical":+u.vertical,ref:f,children:u.toolsType.map((Z,V)=>y.jsx(fe,{disabled:a,type:Z,img:Z.icon,isActive:n.id===Z.id,setActive:k},V))})})]})},Nu=({disabled:n=!1,withText:o=!1,loadFile:u,type:a,img:l,accept:f})=>{const p=x.useRef(null),d=w=>{w.stopPropagation(),p.current&&(p.current.value="")},Q=w=>{const C=w.target.files?.item(0);C&&u(C)};return y.jsx(It,{ref:p,type:"file",onClick:d,onChange:Q,accept:f,title:a.label??a.type,icon:l,children:o?a.label:void 0,disabled:n})},Rf=({activeTool:n,withActionsInMenu:o,hasActionToUndo:u=!1,hasActionToRedo:a=!1,hasActionToClear:l=!1,undoAction:f,redoAction:p,clearCanvas:d,alignment:Q,group:w,vertical:C=!1,disabled:k=!1,withLoadAndSave:N,withExport:H,addPicture:T,loadFile:Z,togglePictureUrlModal:V,saveFile:q,exportCanvasInFile:R,withUploadPicture:$,withUrlPicture:ct})=>{const[ht,dt]=x.useState(!1),[,mt]=x.useTransition(),gt=pt=>{dt(!1),Z(pt)},D=async pt=>{dt(!1),await T(pt)},G=()=>{mt(()=>{dt(!0)})},S=w?.tools?.some(pt=>pt==n.type),tt=(S?n.icon:w.img)??w.title;return x.useEffect(()=>{if(!ht)return;const pt=()=>{dt(!1)};return document.addEventListener("click",pt),()=>{document.removeEventListener("click",pt)}},[ht]),o||$||ct||N||H?y.jsxs("div",{className:"react-paint-editor-toolbox-relative",children:[y.jsx(It,{selected:S,title:w.title,disabled:k,onClick:G,icon:tt}),ht&&y.jsx(Mr,{alignment:Q,position:"top",children:y.jsxs("div",{className:"react-paint-editor-toolbox-panel-content","data-vertical":+C,children:[o&&y.jsxs(y.Fragment,{children:[y.jsx(fe,{withText:!0,type:Tr,disabled:k||!u,img:Tr.icon,isActive:n.id===Tr.id,setActive:f}),y.jsx(fe,{withText:!0,type:Nr,disabled:k||!a,img:Nr.icon,isActive:n.id===Nr.id,setActive:p}),y.jsx(fe,{withText:!0,type:Dr,disabled:k||!l,img:Dr.icon,isActive:n.id===Dr.id,setActive:d}),($||ct||N)&&y.jsx("hr",{})]}),$&&y.jsx(Nu,{withText:!0,type:Iu,disabled:k,loadFile:D,img:Iu.icon,accept:"image/png, image/gif, image/jpeg, image/svg+xml"}),ct&&y.jsx(It,{disabled:k,selected:!1,onClick:V,title:"Add picture from URL",icon:rf,children:"Add picture from URL"}),($||ct)&&N&&y.jsx("hr",{}),N&&y.jsxs(y.Fragment,{children:[y.jsx(Nu,{withText:!0,type:Au,disabled:k,loadFile:gt,img:Au.icon,accept:"application/JSON"}),y.jsx(fe,{withText:!0,disabled:k,type:ti,img:ti.icon,isActive:n.id===ti.id,setActive:q})]}),H&&y.jsx(fe,{withText:!0,disabled:k,type:Ro,img:Ro.icon,isActive:n.id===Ro.id,setActive:R})]})})]}):null},ni=({children:n,onClose:o,position:u="center",className:a=""})=>y.jsxs("div",{className:"react-paint-editor-modal","data-position":u,style:{"--react-paint-editor-modal-zindex":rn.PANEL},children:[y.jsx("div",{className:"react-paint-editor-modal-mask",onClick:o}),y.jsx("div",{className:`react-paint-editor-modal-panel ${a}`,children:n})]}),t0=({togglePictureUrlModal:n,addPicture:o})=>{const u=x.useRef(null),a=async l=>{l.preventDefault();const f=u.current?.value;f&&(await o(f),n())};return x.useEffect(()=>{u.current&&u.current.focus()},[]),y.jsx(ni,{className:"react-paint-editor-toolbox-pictureinput-modal",onClose:n,children:y.jsxs("form",{onSubmit:a,children:[y.jsxs("label",{children:["URL ",y.jsx("input",{type:"text",ref:u})]}),y.jsx(It,{onClick:n,children:"Annuler"}),y.jsx(It,{type:"submit",selected:!0,children:"Ajouter"})]})})},Du=40,e0=[{title:"brush",toolsType:["brush"],vertical:!1},{title:"lines",toolsType:["line","curve","polygon"],vertical:!1},{title:"shapes",toolsType:["rect","square","circle","ellipse"],vertical:!1},"text"],r0=({width:n,disabled:o=!1,activeTool:u,hasActionToUndo:a=!1,hasActionToRedo:l=!1,hasActionToClear:f=!1,withLoadAndSave:p,withExport:d,clearCanvas:Q,setActiveTool:w,undoAction:C,redoAction:k,addPicture:N,loadFile:H,saveFile:T,exportCanvasInFile:Z,availableTools:V,withUrlPicture:q,withUploadPicture:R})=>{const $=Jf(V,e0),ct=(5+$.length)*Du,ht=n<ct,dt=(2+$.length)*Du,mt=n<dt,[gt,D]=x.useState(!1),[G,S]=x.useState(!1),tt=()=>{D(it=>!it)},et=()=>{S(!0)},pt=()=>{S(it=>!it)},yt=it=>{w(it),D(!1)},Tt=it=>{yt(V.find(Gt=>Gt.id===it)??u)},wt=V.find(it=>it.type===u.type)!==void 0;return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"react-paint-editor-toolbar-toolbox",children:[y.jsxs("div",{className:"react-paint-editor-toolbar-shrinkable",children:[y.jsx(fe,{type:je,disabled:o,img:je.icon,isActive:u.id===je.id,setActive:yt}),mt?y.jsx(It,{disabled:o,onClick:tt,title:"Toggle tools",icon:$l,selected:wt}):$.map((it,Gt)=>y.jsx(Pf,{disabled:o,activeTool:u,group:it,setActiveToolFromId:Tt},Gt))]}),!ht&&y.jsxs(y.Fragment,{children:[y.jsx(fe,{type:Tr,disabled:o||!a,img:Tr.icon,isActive:u.id===Tr.id,setActive:C}),y.jsx(fe,{type:Nr,disabled:o||!l,img:Nr.icon,isActive:u.id===Nr.id,setActive:k}),y.jsx(fe,{type:Dr,disabled:o||!f,img:Dr.icon,isActive:u.id===Dr.id,setActive:Q})]}),y.jsx(Rf,{withActionsInMenu:ht,disabled:o,vertical:!0,alignment:"right",group:{title:"Menu",img:Pl},activeTool:u,addPicture:N,loadFile:H,saveFile:T,togglePictureUrlModal:et,exportCanvasInFile:Z,withUploadPicture:R,withUrlPicture:q,withLoadAndSave:p,withExport:d,hasActionToUndo:a,hasActionToRedo:l,hasActionToClear:f,undoAction:C,redoAction:k,clearCanvas:Q})]}),gt&&y.jsx(ni,{className:"react-paint-editor-toolbar-modal",onClose:tt,children:V.map((it,Gt)=>it.type==="picture"?null:y.jsx(fe,{disabled:o,type:it,img:it.icon,withText:!1,isActive:u.id===it.id,setActive:yt},Gt))}),G&&y.jsx(t0,{togglePictureUrlModal:pt,addPicture:N})]})},Sn=({selectedSettings:n,setSelectedSettings:o,title:u="Choisissez une couleur",mode:a="fill",disabled:l=!1,values:f,field:p,value:d="",valueChanged:Q})=>{const[w]=x.useState(I.uniqueId("settings_")),C=T=>{const Z=I.toNumber(T.target.value);Q(p,I.isNaN(Z)?T.target.value:Z)},k=T=>{Q(p,T)},N=()=>{o(T=>T===w?void 0:w)},H=n===w;return I.isEmpty(f)?null:y.jsxs(y.Fragment,{children:[y.jsx(It,{selected:H,title:u,disabled:l,onClick:N,icon:d==="transparent"?a==="fill"?vu:du:void 0,children:d!=="transparent"&&y.jsx("div",{className:"react-paint-editor-colorfield-color","data-mode":a,style:{"--react-paint-editor-colorfield-color-value":d}})}),H&&y.jsx(Mr,{title:u,alignment:"left",children:y.jsxs("div",{className:"react-paint-editor-colorfield-wrapper",children:[f.map((T,Z)=>y.jsx(It,{title:T,selected:T===d,color:T,icon:T==="transparent"?a==="fill"?vu:du:void 0,onClick:()=>k(T),children:T!=="transparent"&&y.jsx("div",{className:"react-paint-editor-colorfield-color",color:T,"data-mode":a,style:{"--react-paint-editor-colorfield-color-value":T}})},Z)),y.jsx(It,{type:"color",title:"Custom color",selected:!I.includes(d,f),value:d,onChange:C,children:y.jsx("div",{className:"react-paint-editor-colorfield-customcolor",style:{"--react-paint-editor-colorfield-color-value":I.includes(d,f)?"var(--react-paint-editor-app-font-color)":d},children:y.jsx("span",{dangerouslySetInnerHTML:{__html:ef}})})})]})})]})},n0=({disabled:n=!1,selectedShape:o,removeShape:u})=>{const a=()=>{u(o)};return y.jsx(It,{title:"Delete",disabled:n,"data-disabled":+n,onClick:a,icon:uu})},o0=({disabled:n,toggleLayoutPanel:o})=>y.jsx(It,{title:"Toggle layers panel",disabled:n,onClick:o,icon:ql,className:"react-paint-editor-layout-button"}),un=({selectedSettings:n,setSelectedSettings:o,title:u="Choisissez l'intervalle",icon:a,disabled:l=!1,field:f,value:p=1,min:d=1,max:Q=20,step:w=1,unity:C="",valueChanged:k})=>{const N=Math.round(p),[H]=x.useState(I.uniqueId("settings_")),T=q=>{const R=+q.target.value;k(f,Number.isNaN(R)?q.target.value:R)},Z=()=>{o(q=>q===H?void 0:H)},V=n===H;return d===Q?null:y.jsxs(y.Fragment,{children:[y.jsx(It,{selected:V,title:u,disabled:l,icon:a,onClick:Z}),V&&y.jsx(Mr,{title:u,alignment:"left",fitContainer:!0,children:y.jsx("div",{children:y.jsxs("label",{className:"react-paint-editor-rangefield",children:[y.jsx("input",{type:"range",min:d,max:Q,step:w,value:p,onChange:T}),y.jsxs("span",{children:[N,C]})]})})})]})},oi=({CustomOption:n,selectedSettings:o,setSelectedSettings:u,title:a="Choisissez l'option",disabled:l=!1,field:f,icon:p,values:d,defaultValue:Q,valueChanged:w})=>{const[C]=x.useState(I.uniqueId("settings_")),k=T=>{w(f,T)},N=()=>{u(T=>T===C?void 0:C)},H=o===C;return d.length?y.jsxs(y.Fragment,{children:[y.jsx(It,{selected:H,title:a,icon:p,disabled:l,onClick:N}),H&&y.jsx(Mr,{title:a,alignment:"left",fitContainer:!0,children:y.jsx("div",{className:"react-paint-editor-selectfield-wrapper",children:d.map(T=>y.jsx(It,{title:`${T}`,onClick:()=>k(T),selected:Q==T,style:{"--react-paint-editor-button-padding":"16px"},children:y.jsx(n,{children:T})},T))})})]}):null},i0=({children:n})=>y.jsx("span",{className:"react-paint-editor-fontfamily-option",style:{"--react-paint-editor-fontfamily-family":n},children:n}),Mu=({selectedSettings:n,setSelectedSettings:o,disabled:u=!1,values:a,defaultValue:l,valueChanged:f})=>a.length?y.jsx(oi,{selectedSettings:n,setSelectedSettings:o,CustomOption:i0,title:"Police",icon:sf,disabled:u,field:"fontFamily",values:a,defaultValue:l,valueChanged:f}):null,Hu=({selectedSettings:n,setSelectedSettings:o,disabled:u=!1,min:a,max:l,step:f,value:p,valueChanged:d})=>a===l?null:y.jsx(un,{selectedSettings:n,setSelectedSettings:o,icon:Ko,title:"Nombre de points",disabled:u,field:"pointsCount",min:a,max:l,step:f,unity:"",value:p,valueChanged:d}),u0=({children:n})=>y.jsxs("span",{className:"react-paint-editor-linetype-option","data-type":n,children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]}),Vu=({selectedSettings:n,setSelectedSettings:o,disabled:u=!1,values:a,defaultValue:l,valueChanged:f})=>a.length?y.jsx(oi,{selectedSettings:n,setSelectedSettings:o,CustomOption:u0,icon:af,title:"Type de traits",disabled:u,field:"lineDash",values:a,defaultValue:l,valueChanged:f}):null,a0=({children:n})=>y.jsxs("span",{className:"react-paint-editor-linearrow-option","data-type":n,children:[y.jsx("span",{className:"react-paint-editor-linearrow-left"}),y.jsx("span",{className:"react-paint-editor-linearrow-right"})]}),Wu=({selectedSettings:n,setSelectedSettings:o,disabled:u=!1,values:a,defaultValue:l,valueChanged:f})=>a.length?y.jsx(oi,{selectedSettings:n,setSelectedSettings:o,CustomOption:a0,title:"Flèches",icon:cf,disabled:u,field:"lineArrow",values:a,defaultValue:l,valueChanged:f}):null,qn=({setSelectedSettings:n,disabled:o=!1,field:u,icon:a,values:l,value:f=!1,valueChanged:p})=>{const[d]=x.useState(I.uniqueId("settings_")),Q=()=>{n(w=>w===d?void 0:d),p(u,!f)};return l.length!==2?null:y.jsx(It,{onClick:Q,selected:f,disabled:o,icon:a})},s0=40,ii=({activeTool:n,selectedShape:o,selectedShapeTool:u,disabled:a,selectedSettings:l,setSelectedSettings:f,handleShapeStyleChange:p,handlePolygonLinesCount:d,handleShapeFontFamilyChange:Q})=>o?y.jsx(y.Fragment,{children:u&&y.jsxs(y.Fragment,{children:["strokeColor"in u.settings&&y.jsx(Sn,{selectedSettings:l,setSelectedSettings:f,title:"Couleur du trait",mode:"stroke",disabled:a,field:"strokeColor",value:o.style?.strokeColor,valueChanged:p,values:u.settings.strokeColor.values}),"fillColor"in u.settings&&y.jsx(Sn,{selectedSettings:l,setSelectedSettings:f,title:"Couleur de fond",disabled:a,field:"fillColor",value:o.style?.fillColor,valueChanged:p,values:u.settings.fillColor.values}),"lineWidth"in u.settings&&y.jsx(un,{selectedSettings:l,setSelectedSettings:f,title:"Epaisseur du trait",icon:hu,disabled:a,field:"lineWidth",value:o.style?.lineWidth,valueChanged:p,unity:"px",min:u.settings.lineWidth.min,max:u.settings.lineWidth.max,step:u.settings.lineWidth.step}),"lineDash"in u.settings&&y.jsx(Vu,{selectedSettings:l,setSelectedSettings:f,disabled:a,defaultValue:o.style?.lineDash,valueChanged:p,values:u.settings.lineDash.values}),"lineArrow"in u.settings&&y.jsx(Wu,{selectedSettings:l,setSelectedSettings:f,disabled:a,defaultValue:o.style?.lineArrow,valueChanged:p,values:u.settings.lineArrow.values}),"pointsCount"in u.settings&&y.jsx(Hu,{selectedSettings:l,setSelectedSettings:f,disabled:a,valueChanged:d,min:u.settings.pointsCount.min,max:u.settings.pointsCount.max,step:u.settings.pointsCount.step,value:o.style?.pointsCount}),"fontFamily"in u.settings&&y.jsx(Mu,{selectedSettings:l,setSelectedSettings:f,disabled:a,valueChanged:Q,values:u.settings.fontFamily.values,defaultValue:o.style?.fontFamily}),"fontBold"in u.settings&&y.jsx(qn,{setSelectedSettings:f,disabled:a,field:"fontBold",icon:fu,valueChanged:Q,values:u.settings.fontBold.values,value:o.style?.fontBold}),"fontItalic"in u.settings&&y.jsx(qn,{setSelectedSettings:f,disabled:a,field:"fontItalic",icon:pu,valueChanged:Q,values:u.settings.fontItalic.values,value:o.style?.fontItalic}),"opacity"in u.settings&&y.jsx(un,{selectedSettings:l,setSelectedSettings:f,title:"Opacité",icon:au,min:u.settings.opacity.min,max:u.settings.opacity.max,step:u.settings.opacity.step,unity:"%",disabled:a,field:"globalAlpha",value:o.style?.globalAlpha??100,valueChanged:p})]})}):"settings"in n?y.jsxs(y.Fragment,{children:["strokeColor"in n.settings&&y.jsx(Sn,{selectedSettings:l,setSelectedSettings:f,title:"Couleur du trait",mode:"stroke",disabled:a,field:"strokeColor",value:n.settings.strokeColor.default,valueChanged:p,values:n.settings.strokeColor.values}),"fillColor"in n.settings&&y.jsx(Sn,{selectedSettings:l,setSelectedSettings:f,title:"Couleur de fond",disabled:a,field:"fillColor",value:n.settings.fillColor.default,valueChanged:p,values:n.settings.fillColor.values}),"lineWidth"in n.settings&&y.jsx(un,{selectedSettings:l,setSelectedSettings:f,title:"Epaisseur du trait",disabled:a,field:"lineWidth",icon:hu,value:n.settings.lineWidth.default,valueChanged:p,unity:"px",min:n.settings.lineWidth.min,max:n.settings.lineWidth.max,step:n.settings.lineWidth.step}),"lineDash"in n.settings&&y.jsx(Vu,{selectedSettings:l,setSelectedSettings:f,disabled:a,defaultValue:n.settings.lineDash.default,valueChanged:p,values:n.settings.lineDash.values}),"lineArrow"in n.settings&&y.jsx(Wu,{selectedSettings:l,setSelectedSettings:f,disabled:a,defaultValue:n.settings.lineArrow.default,valueChanged:p,values:n.settings.lineArrow.values}),"pointsCount"in n.settings&&y.jsx(Hu,{selectedSettings:l,setSelectedSettings:f,disabled:a,valueChanged:d,min:n.settings.pointsCount.min,max:n.settings.pointsCount.max,step:n.settings.pointsCount.step,value:n.settings.pointsCount.default}),"fontFamily"in n.settings&&y.jsx(Mu,{selectedSettings:l,setSelectedSettings:f,disabled:a,valueChanged:Q,values:n.settings.fontFamily.values,defaultValue:n.settings.fontFamily.default}),"fontBold"in n.settings&&y.jsx(qn,{setSelectedSettings:f,disabled:a,field:"fontBold",icon:fu,valueChanged:Q,values:n.settings.fontBold.values,value:n.settings.fontBold.default}),"fontItalic"in n.settings&&y.jsx(qn,{setSelectedSettings:f,disabled:a,field:"fontItalic",icon:pu,valueChanged:Q,values:n.settings.fontItalic.values,value:n.settings.fontItalic.default}),"opacity"in n.settings&&y.jsx(un,{selectedSettings:l,setSelectedSettings:f,title:"Opacité",icon:au,min:n.settings.opacity.min,max:n.settings.opacity.max,step:n.settings.opacity.step,unity:"%",disabled:a,field:"opacity",value:n.settings.opacity.default,valueChanged:p})]}):null,c0=({width:n,disabled:o=!1,availableTools:u,updateToolSettings:a,layersManipulation:l,toggleLayoutPanel:f,activeTool:p,selectedShape:d,canvas:Q,currentScale:w,selectionPadding:C,updateShape:k,removeShape:N})=>{const[H,T]=x.useState(void 0),[Z,V]=x.useState(!1),q=()=>{V(D=>!D)},R=d?I.find({id:d.toolId},u)||I.find({type:d.type},u):void 0,$=(R?I.size(R.settings)+1:"settings"in p?I.size(p.settings):0)+(l?1:0),ct=$*s0,ht=n<ct,dt=(D,G)=>{d?(k(on(I.set(["style",D],G,d),w,C),!0),a(d.toolId||p.id,D,G)):a(p.id,D,G)},mt=(D,G)=>{if(d){if(d.type!=="text")return;const S=Q?.getContext("2d");if(!S)return;const tt=I.set(["style",D],G,d),et=Xo(S,tt.value,tt.width,tt.style?.fontBold??!1,tt.style?.fontItalic??!1,tt.style?.fontFamily),pt=on({...tt,fontSize:et,height:et*tt.value.length},w,C);k(pt,!0),a(d.toolId||p.id,D,G)}else a(p.id,D,G)},gt=(D,G)=>{if(d){if(d.type!=="polygon")return;k(ul(d,G,w,C),!0),a(d.toolId||p.id,D,G)}else a(p.id,D,G)};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"react-paint-editor-settings-bar",children:[y.jsxs("div",{className:"react-paint-editor-settings-shrinkable",children:[ht&&$>2&&y.jsx(It,{disabled:o,onClick:q,title:"Toggle settings",icon:lf}),d?y.jsx(y.Fragment,{children:R&&y.jsxs(y.Fragment,{children:[!ht&&y.jsx(ii,{activeTool:p,selectedShape:d,selectedShapeTool:R,disabled:o,selectedSettings:H,setSelectedSettings:T,handleShapeStyleChange:dt,handlePolygonLinesCount:gt,handleShapeFontFamilyChange:mt}),y.jsx(n0,{disabled:o,selectedShape:d,removeShape:N})]})}):!ht&&y.jsx(ii,{activeTool:p,selectedShape:d,selectedShapeTool:R,disabled:o,selectedSettings:H,setSelectedSettings:T,handleShapeStyleChange:dt,handlePolygonLinesCount:gt,handleShapeFontFamilyChange:mt})]}),y.jsx("div",{className:"react-paint-editor-settings-separator"}),l&&y.jsx(o0,{disabled:o,toggleLayoutPanel:f})]}),Z&&y.jsx(ni,{className:"react-paint-editor-settings-modal",onClose:q,position:"bottom",children:y.jsx(ii,{activeTool:p,selectedShape:d,selectedShapeTool:R,disabled:o,selectedSettings:H,setSelectedSettings:T,handleShapeStyleChange:dt,handlePolygonLinesCount:gt,handleShapeFontFamilyChange:mt})})]})},Ut={ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Delete:"Delete",Backspace:"Backspace",Escape:"Escape",Shift:"Shift",z:"z",Z:"Z",y:"y",Y:"Y"},Yn={Copy:"copy",Paste:"paste"},l0=({gridFormat:n,isInsideComponent:o,selectedShape:u,isEditingText:a,currentScale:l,selectionPadding:f,setSelectedShape:p,removeShape:d,pasteShape:Q,updateShape:w,backwardShape:C,forwardShape:k,setShiftPressed:N})=>{const[H,T]=x.useState(void 0);return x.useEffect(()=>{const Z=$=>{u&&(a||($.preventDefault(),T({...u})))},V=$=>{H&&(a||($.preventDefault(),Q(Hf(H,n,l,f))))},q=$=>{switch($.key){case Ut.Shift:N(!1);break}},R=$=>{if($.metaKey||$.ctrlKey){if($.key===Ut.Z||$.key===Ut.z){$.preventDefault(),$.stopPropagation(),C();return}else if($.key===Ut.Y||$.key===Ut.y){$.preventDefault(),$.stopPropagation(),k();return}}if($.key===Ut.Shift){N(!0);return}if(!u)return;if($.key===Ut.Escape){p(void 0);return}if(a)return;const ct={[Ut.ArrowLeft]:[n?-dr[n-1]:-1,0],[Ut.ArrowRight]:[n?dr[n-1]:1,0],[Ut.ArrowDown]:[0,n?dr[n-1]:1],[Ut.ArrowUp]:[0,n?-dr[n-1]:-1]};switch($.key){case Ut.ArrowLeft:case Ut.ArrowRight:case Ut.ArrowDown:case Ut.ArrowUp:w(ri(ct[$.key],u,[0,0],n,l,f));break;case Ut.Delete:case Ut.Backspace:d(u);break}};return o&&(document.addEventListener("keydown",R),document.addEventListener("keyup",q),document.addEventListener(Yn.Copy,Z),document.addEventListener(Yn.Paste,V)),()=>{o&&(document.removeEventListener("keydown",R),document.removeEventListener("keyup",q),document.removeEventListener(Yn.Copy,Z),document.removeEventListener(Yn.Paste,V))}},[o,f,n,H,a,u,l,w,d,p,Q,C,k,N]),{}},f0=({disabled:n,componentRef:o})=>{const[u,a]=x.useState(!1);return x.useEffect(()=>{const l=f=>{a(Tu(f,o.current))};return n?a(!1):(document.addEventListener("mousedown",l,{passive:!0}),document.addEventListener("touchstart",l,{passive:!0})),()=>{n||(document.removeEventListener("mousedown",l),document.removeEventListener("touchstart",l))}},[n,o]),{isInsideComponent:u}},p0=(n=I.noop,o,u)=>{const a=x.useRef([]),l=x.useRef(n);l.current=n;const[f,p]=x.useState(void 0),[d,Q]=x.useState({states:[{shapes:[],selectedShape:void 0}],cursor:0}),w=d.cursor>0,C=d.cursor<d.states.length-1,k=a.current.length>0,N=x.useCallback(()=>{Q(D=>I.isEqual(D.states[D.cursor].shapes,a.current)?D:{states:[...D.states.slice(0,D.cursor+1),{shapes:a.current,selectedShape:f}],cursor:D.cursor+1})},[f]),H=x.useCallback(D=>{a.current=[D,...a.current]},[]),T=x.useCallback(async(D,G=er,S=er)=>{const tt=await Af(D,G,S,u.scaleRatio,o);return H(tt),N(),tt},[H,N,u,o]),Z=x.useCallback((D,G=!1)=>{a.current=a.current.map(S=>S.id===f?.id?D:S),p(S=>S?.id===D.id?D:S),G&&N()},[f,N]),V=x.useCallback(D=>{const G=D.map(S=>I.omit(["chosen"],S));a.current=G,N()},[N]),q=x.useCallback(D=>{p(G=>G?.id===D.id?void 0:G),a.current=I.remove({id:D.id},a.current),N()},[N]),R=x.useCallback(D=>{Q(G=>{const S=D(G);return a.current=G.states[S].shapes,p(G.states[S].selectedShape),I.set("cursor",S,G)})},[]),$=x.useCallback(()=>{R(D=>Math.max(0,D.cursor-1))},[R]),ct=x.useCallback(()=>{R(D=>Math.min(D.states.length-1,D.cursor+1))},[R]),ht=x.useCallback((D=[],G=!1)=>{p(void 0),a.current=D,Q(S=>G?{states:[{shapes:D,selectedShape:void 0}],cursor:0}:{states:[...S.states.slice(0,S.cursor+1),{shapes:D,selectedShape:void 0}],cursor:S.cursor+1})},[]),dt=x.useCallback((D,G)=>{const S=a.current,tt=I.findIndex({id:D},S),et=I.findIndex({id:G},S);tt<et?V([...I.slice(0,tt,S),...I.slice(tt+1,et+1,S),S[tt],...I.slice(et+1,S.length,S)]):V([...I.slice(0,et,S),S[tt],...I.slice(et,tt,S),...I.slice(tt+1,S.length,S)])},[V]),mt=x.useCallback(D=>{const G=a.current,S=I.findIndex({id:D.id},G);if(S<0)return;const tt=I.set("visible",D.visible===!1,D);p(et=>et?.id===tt.id?tt:et),V(I.set(S,tt,G))},[V]),gt=x.useCallback(D=>{const G=a.current,S=I.findIndex({id:D.id},G);if(S<0)return;const tt=I.set("locked",!D.locked,D);p(et=>et?.id===tt.id?tt:et),V(I.set(S,tt,G))},[V]);return x.useEffect(()=>{l.current()},[d]),x.useEffect(()=>{a.current=a.current.map(D=>on(D,u.scaleRatio,o)),p(D=>D===void 0?void 0:a.current.find(G=>G.id===D.id))},[u,o]),{shapesRef:a,selectedShape:f,addShape:H,addPictureShape:T,moveShapes:dt,saveShapes:N,setSelectedShape:p,toggleShapeVisibility:mt,toggleShapeLock:gt,removeShape:q,updateShape:Z,backwardShape:$,forwardShape:ct,clearShapes:ht,canGoBackward:w,canGoForward:C,canClear:k}},Zu={type:"infos",duration:4e3},Bu=500,ju=100,h0=({type:n,text:o,duration:u})=>{const[a,l]=x.useState(!1);return x.useEffect(()=>{const f=setTimeout(()=>{l(!0)},ju),p=setTimeout(()=>{l(!1)},u-Bu-ju);return()=>{clearTimeout(f),clearTimeout(p)}},[u]),y.jsx("div",{className:"react-paint-editor-snackbar","data-is-shown":+a,"data-type":n,style:{"--react-paint-editor-panel-transition-duration":`${Bu}ms`},children:o})},d0=({snackbarList:n})=>y.jsx("div",{className:"react-paint-editor-snackbar-container",style:{"--react-paint-editor-snackbar-zindex":rn.PANEL},children:n.map(o=>y.jsx(h0,{...o},o.id))}),v0=()=>{const n=x.useRef([]),[o,u]=x.useState([]),a=f=>{u(p=>p.filter(d=>d.id!==f))},l=({type:f=Zu.type,duration:p=Zu.duration,text:d})=>{const Q={id:I.uniqueId("snackbar_"),duration:p,type:f,text:d};u(w=>[...w,Q]),n.current=[...n.current,setTimeout(()=>a(Q.id),p)]};return x.useEffect(()=>()=>{for(const f of n.current)clearTimeout(f)},[]),{snackbarList:o,addSnackbar:l}},zu=300,g0=({isLoading:n=!1})=>{const[o,u]=x.useState("hidden");return x.useEffect(()=>{if(n)u("visible");else{u("fadeOut");const a=setTimeout(()=>u("hidden"),zu);return()=>{clearTimeout(a)}}},[n]),o==="hidden"?null:y.jsx("div",{className:"react-paint-editor-loading","data-loading":o,style:{"--react-paint-editor-loading-zindex":rn.LOADING,"--react-paint-editor-loading-transition-duration":`${zu}ms`},children:y.jsxs("div",{className:"react-paint-editor-loader",children:[y.jsx("div",{}),y.jsx("div",{}),y.jsx("div",{}),y.jsx("div",{})]})})},y0=({onResized:n,element:o})=>{x.useEffect(()=>{const u=o.current;if(!u)return;const a=new ResizeObserver(l=>{const f=l?.[0]?.borderBoxSize?.[0],{width:p,height:d}=f?{width:f.inlineSize,height:f.blockSize}:l?.[0].contentRect;n(p,d)});return a.observe(u),()=>{a.unobserve(u)}},[o,n])},ui={layersManipulation:!0,grid:0,canGrow:!1,canShrink:!0,withExport:!0,withLoadAndSave:!0,withUploadPicture:!0,withUrlPicture:!1,availableTools:bf,clearCallback:"empty",uiStyle:{toolbarBackgroundColor:"white",dividerColor:"#36418129",fontRadius:8,fontDisabledColor:"#3641812b",fontDisabledBackgroundColor:"transparent",fontColor:"#364181",fontBackgroundColor:"transparent",fontSelectedColor:"white",fontSelectedBackgroundColor:"#364181",fontHoverColor:"#364181",fontHoverBackgroundColor:"#afd8d8",canvasBackgroundColor:"white",canvasSelectionColor:T1,canvasSelectionWidth:2,canvasSelectionPadding:0}};return({width:n=1e3,height:o=600,shapes:u,className:a="",mode:l="editor",disabled:f=!1,onDataChanged:p,apiRef:d,options:Q=ui})=>{const{layersManipulation:w,grid:C,canGrow:k,canShrink:N,withExport:H,withLoadAndSave:T,withUploadPicture:Z,withUrlPicture:V,clearCallback:q,availableTools:R}={...ui,...Q},{toolbarBackgroundColor:$,dividerColor:ct,fontRadius:ht,fontDisabledColor:dt,fontDisabledBackgroundColor:mt,fontColor:gt,fontBackgroundColor:D,fontSelectedColor:G,fontSelectedBackgroundColor:S,fontHoverColor:tt,fontHoverBackgroundColor:et,canvasBackgroundColor:pt,canvasSelectionColor:yt,canvasSelectionWidth:Tt,canvasSelectionPadding:wt}={...ui.uiStyle,...Q?.uiStyle??{}},it=l!=="viewer",Gt=f||!it,vr=x.useRef(null),ze=x.useRef(null),[Xt,xt]=x.useState({width:n,height:o,scaleRatio:1}),[Te,Y]=x.useState(Ou(R,Z||V)),{isInsideComponent:M}=f0({disabled:Gt,componentRef:vr}),[j,U]=x.useState(!1),[nt,Ht]=x.useState(!1),[$t,Ft]=x.useState([0,0]),[Vt,Kt]=x.useState(void 0),[nr,Hr]=x.useState(je),[Gn,ai]=x.useState({mode:"default"}),[v,si]=x.useState(C),[an,ci]=x.useState(!1);d&&(d.current={getCurrentImage:()=>ze.current?ou(Nt.current,$t,n,o,wt):void 0,getCurrentData:()=>P1(Nt.current,n,o)});const{shapesRef:Nt,selectedShape:Vr,addShape:gr,addPictureShape:Xn,moveShapes:Wr,setSelectedShape:St,removeShape:Zr,updateShape:Ne,backwardShape:De,forwardShape:or,clearShapes:ee,saveShapes:Ue,toggleShapeVisibility:Kn,toggleShapeLock:de,canGoBackward:ir,canGoForward:ve,canClear:ur}=p0(p,wt,Xt),{snackbarList:Ee,addSnackbar:re}=v0(),Ae=x.useCallback(ut=>{St(void 0),Hr(ut)},[St]),li=x.useCallback((ut,At,zr)=>{Y(Ie=>Ie.map(Fe=>Fe.id===ut?I.set(["settings",At,"default"],zr,Fe):Fe)),Hr(Ie=>Ie.id===ut?I.set(["settings",At,"default"],zr,Ie):Ie)},[]),fi=x.useCallback(()=>{Ae(je),De()},[Ae,De]),pi=x.useCallback(()=>{Ae(je),or()},[Ae,or]),Br=x.useCallback((ut=[],At=!1)=>{ee(ut,At),Ae(je),Ft([0,0])},[Ae,ee]),Me=x.useCallback(async(ut,At=!0)=>{const zr=await Ul(ut,Xt.scaleRatio,wt);Br(zr,At)},[Br,Xt,wt]),hi=x.useCallback(()=>{typeof q!="string"?Me({shapes:q()},!1):q==="defaultShapes"&&u!==void 0?Me({shapes:u},!1):Br()},[Br,Me,u,q]),yr=x.useCallback(ut=>{Hr(je),St(ut)},[St]),$e=x.useCallback(ut=>{gr(ut),yr(ut)},[gr,yr]),He=x.useCallback(()=>{U(!0);try{const ut=ze.current&&ou(Nt.current,$t,n,o,wt);if(!ut)throw new Error;nu(ut,"drawing.png"),U(!1)}catch(ut){ut instanceof Error&&re({type:"error",text:"L'export a échoué"}),console.warn(ut)}finally{U(!1)}},[re,Nt,$t,n,o,wt]),di=x.useCallback(()=>{U(!0);try{const ut=jl(Nt.current,n,o);if(!ut)throw new Error("L'encodage a échoué");nu(ut,"drawing.json"),U(!1)}catch(ut){ut instanceof Error&&re({type:"error",text:"L'enregistrement a échoué"}),console.warn(ut)}finally{U(!1)}},[Nt,re,n,o]),jr=x.useCallback(async ut=>{U(!0);try{const At=await zl(ut);await Me(At),re({type:"success",text:"Fichier chargé !"})}catch(At){At instanceof Error&&re({type:"error",text:"Le chargement a échoué"}),console.warn(At)}finally{U(!1)}},[Me,re]),ge=x.useCallback(async ut=>{U(!0);try{const At=await Xn(ut,n,o);yr(At)}catch(At){At instanceof Error&&re({type:"error",text:"Le chargement a échoué"}),console.warn(At)}finally{U(!1)}},[Xn,yr,re,n,o]),vi=x.useCallback(ut=>{const At=ut/n;xt({width:ut,height:o*At,scaleRatio:At})},[n,o]);l0({isInsideComponent:M,selectionPadding:wt,gridFormat:v,isEditingText:Gn.mode==="textedition",selectedShape:Vr,currentScale:Xt.scaleRatio,setSelectedShape:St,removeShape:Zr,pasteShape:$e,updateShape:Ne,backwardShape:De,forwardShape:or,setShiftPressed:ci}),y0({element:vr,onResized:vi}),x.useEffect(()=>{Y(Ou(R,Z||V))},[R,Z,V]),x.useEffect(()=>{M||St(void 0)},[M,St]);const sn=x.useRef(Me);sn.current=Me,x.useEffect(()=>{u!==void 0&&sn.current({shapes:u})},[sn,u]);const gi=`${a}${nt?" react-paint-editor-layout-opened":""} react-paint-editor-app`;return y.jsxs("div",{ref:vr,className:gi,"data-grow":k,"data-shrink":N,style:{"--react-paint-editor-app-canvaswidth":`${n}px`,"--react-paint-editor-app-toolbar-bg":$,"--react-paint-editor-app-divider-color":ct,"--react-paint-editor-app-font-radius":ht,"--react-paint-editor-app-font-disabled-color":dt,"--react-paint-editor-app-font-disabled-bg":mt,"--react-paint-editor-app-font-color":gt,"--react-paint-editor-app-font-bg":D,"--react-paint-editor-app-font-selected-color":G,"--react-paint-editor-app-font-selected-bg":S,"--react-paint-editor-app-font-hover-color":tt,"--react-paint-editor-app-font-hover-bg":et,"--react-paint-editor-app-canvas-bg":pt},children:[it&&y.jsx(r0,{width:Xt.width,disabled:Gt,activeTool:nr,clearCanvas:hi,setActiveTool:Ae,exportCanvasInFile:He,saveFile:di,loadFile:jr,addPicture:ge,hasActionToUndo:ir,hasActionToRedo:ve,hasActionToClear:ur,undoAction:fi,redoAction:pi,availableTools:Te,withExport:H,withLoadAndSave:T,withUploadPicture:Z,withUrlPicture:V}),y.jsxs("div",{className:"react-paint-editor-app-row","data-grow":k,style:{"--react-paint-editor-app-row-zindex":rn.APP,"--react-paint-editor-app-row-width":Xt.width,"--react-paint-editor-app-row-aspectratio":`calc(${Xt.width} / ${Xt.height})`},children:[y.jsx(qf,{canGrow:k,gridFormat:v,disabled:Gt,isInsideComponent:M,activeTool:nr,setActiveTool:Hr,canvasOffsetStartPosition:Vt,setCanvasOffsetStartPosition:Kt,shapes:Nt.current,addShape:gr,updateSingleShape:Ne,selectedShape:Vr,setSelectedShape:St,canvasOffset:$t,setCanvasOffset:Ft,saveShapes:Ue,ref:ze,canvasSize:Xt,selectionMode:Gn,setSelectionMode:ai,selectionColor:yt,selectionWidth:Tt,selectionPadding:wt,isEditMode:it,isShiftPressed:an}),it&&w&&y.jsx(Kf,{gridFormat:v,setGridFormat:si,disabled:Gt,shapes:Nt.current,moveShapes:Wr,selectedShape:Vr,removeShape:Zr,selectShape:yr,toggleShapeVisibility:Kn,toggleShapeLock:de,isLayoutPanelShown:nt})]}),it&&y.jsxs(y.Fragment,{children:[y.jsx(c0,{width:Xt.width,disabled:Gt,activeTool:nr,availableTools:Te,selectedShape:Vr,selectionPadding:wt,removeShape:Zr,updateShape:Ne,canvas:ze.current,currentScale:Xt.scaleRatio,layersManipulation:w,toggleLayoutPanel:()=>{Ht(ut=>!ut)},updateToolSettings:li}),y.jsx(g0,{isLoading:j}),y.jsx(d0,{snackbarList:Ee})]})]})}});