(function(){ shadow$provide[606]=function(aa,K,za,t){var l=K(2);!function(A,n){"object"==typeof t&&"object"==typeof za?za.exports=n(K(13),K(22)):"function"==typeof define&&define.amd?define(["react","react-dom"],n):"object"==typeof t?t.Excalidraw=n(K(13),K(22)):A.Excalidraw=n(A.React,A.ReactDOM)}(self,function(A,n){return function(){function k(u){var m=a[u];if(void 0!==m)return m.exports;m=a[u]={id:u,exports:{}};return p[u](m,m.exports,k),m.exports}var b,f,h,p={7945:function(u,m,e){u.exports=e(1602)},4516:function(u){var m= Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;u.exports=function(){try{if(!Object.assign)return!1;var w=new String("abc");if(w[5]="de","5"===Object.getOwnPropertyNames(w)[0])return!1;var y={};for(w=0;10>w;w++)y["_"+String.fromCharCode(w)]=w;if("0123456789"!==Object.getOwnPropertyNames(y).map(function(M){return y[M]}).join(""))return!1;var E={};return"abcdefghijklmnopqrst".split("").forEach(function(M){E[M]=M}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({}, E)).join("")}catch(M){return!1}}()?Object.assign:function(w,y){var E;if(null==w)throw new TypeError("Object.assign cannot be called with null or undefined");var M=Object(w);for(var G=1;GZ.length)&&(x=Z.length);for(var D=0,R=Array(x);D{const [va,Aa]=ha;ha[0]=(va-R)*na-(Aa-z)*sa+R;ha[1]=(va-R)*sa+(Aa-z)*na+z})}}function X(Z){const x=Z[0];Z=Z[1];return Math.sqrt(Math.pow(x[0]-Z[0],2)+Math.pow(x[1]-Z[1],2))}function Q(Z,x,D,R){const z=x[1]-Z[1];x=Z[0]-x[0];Z=z*Z[0]+x*Z[1];const na=R[1]-D[1];R=D[0]-R[0];D=na*D[0]+R*D[1];const sa=z*R-na*x;return sa?[(R*Z-x*D)/sa,(z*D-na*Z)/sa]:null}function V(Z,x,D){const R=Z.length;if(3>R)return!1;const z=[Number.MAX_SAFE_INTEGER,D];x=[x,D];D= 0;for(let na=0;na=Math.min(Z[0],D[0])&&x[1]<=Math.max(Z[1],D[1])&&x[1]>=Math.min(Z[1],D[1])}function N(Z,x,D){Z=(x[1]-Z[1])*(D[0]-x[0])-(x[0]-Z[0])*(D[1]-x[1]);return 0===Z?0:0va&&(va=4*na.strokeWidth);va=Math.max(va,.1);na=[];for(var ha=0;haHa.yminVa.ymin?1:Ha.xVa.x?1:Ha.ymax===Va.ymax?0:(Ha.ymax-Va.ymax)/Math.abs(Ha.ymax-Va.ymax)),!na.length)return z;let Aa=[],Ba=na[0].ymin;for(;Aa.length||na.length;){if(na.length){sa=-1;for(ha=0;haBa);ha++)sa=ha;na.splice(0,sa+1).forEach(Ha=>{Aa.push({s:Ba,edge:Ha})})}if(Aa=Aa.filter(Ha=>!(Ha.edge.ymax<=Ba)),Aa.sort((Ha,Va)=>Ha.edge.x===Va.edge.x?0:(Ha.edge.x-Va.edge.x)/Math.abs(Ha.edge.x-Va.edge.x)), 1=Aa.length)break;z.push([[Math.round(Aa[sa].edge.x),Ba],[Math.round(Aa[ha].edge.x),Ba]])}Ba+=va;Aa.forEach(Ha=>{Ha.edge.x+=va*Ha.edge.islope})}}return z}(Z,x);return R&&(O(Z,D,-R),function(z,na,sa){const ha=[];z.forEach(va=>ha.push(...va));O(ha,na,sa)}(x,D,-R)),x}function ua(Z){const x=[];a:{var D=Z;for(var R=[];""!==D;){if(!D.match(/^([ \t\r\n,]+)/))if(D.match(/^([aAcChHlLmMqQsStTvVzZ])/))R[R.length]={type:0,text:RegExp.$1};else{if(!D.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)){D= [];break a}R[R.length]={type:1,text:`${parseFloat(RegExp.$1)}`}}D=D.substr(RegExp.$1.length)}D=(R[R.length]={type:2,text:""},R)}R="BOD";let z=0;for(var na=D[z];2!==na.type;){let sa=0;const ha=[];if("BOD"===R){if("M"!==na.text&&"m"!==na.text)return ua("M0,0"+Z);z++;sa=ck[na.text];R=na.text}else 1===na.type?sa=ck[R]:(z++,sa=ck[na.text],R=na.text);if(!(z+saAa%2?va+D:va+x);na.push({key:"C",data:Z});x=Z[4];D=Z[5];break;case "Q":na.push({key:"Q",data:[...ha]});x=ha[2];D=ha[3];break;case "q":Z=ha.map((va,Aa)=>Aa%2?va+D:va+x);na.push({key:"Q",data:Z});x=Z[2];D=Z[3];break;case "A":na.push({key:"A",data:[...ha]});x=ha[5];D=ha[6];break;case "a":x+=ha[5];D+=ha[6];na.push({key:"A",data:[ha[0],ha[1],ha[2],ha[3],ha[4],x,D]});break;case "H":na.push({key:"H",data:[...ha]}); x=ha[0];break;case "h":x+=ha[0];na.push({key:"H",data:[x]});break;case "V":na.push({key:"V",data:[...ha]});D=ha[0];break;case "v":D+=ha[0];na.push({key:"V",data:[D]});break;case "S":na.push({key:"S",data:[...ha]});x=ha[2];D=ha[3];break;case "s":Z=ha.map((va,Aa)=>Aa%2?va+D:va+x);na.push({key:"S",data:Z});x=Z[2];D=Z[3];break;case "T":na.push({key:"T",data:[...ha]});x=ha[0];D=ha[1];break;case "t":x+=ha[0];D+=ha[1];na.push({key:"T",data:[x,D]});break;case "Z":case "z":na.push({key:"Z",data:[]}),x=R,D= z}return na}function oa(Z){const x=[];var D="";let R=0,z=0,na=0,sa=0,ha=0,va=0;for(const {key:Ba,data:Ha}of Z){switch(Ba){case "M":x.push({key:"M",data:[...Ha]});[R,z]=Ha;[na,sa]=Ha;break;case "C":x.push({key:"C",data:[...Ha]});R=Ha[4];z=Ha[5];ha=Ha[2];va=Ha[3];break;case "L":x.push({key:"L",data:[...Ha]});[R,z]=Ha;break;case "H":R=Ha[0];x.push({key:"L",data:[R,z]});break;case "V":z=Ha[0];x.push({key:"L",data:[R,z]});break;case "S":var Aa=Z=0;"C"===D||"S"===D?(Z=R+(R-ha),Aa=z+(z-va)):(Z=R,Aa=z);x.push({key:"C", data:[Z,Aa,...Ha]});ha=Ha[0];va=Ha[1];R=Ha[2];z=Ha[3];break;case "T":const [Va,Ya]=Ha;Aa=Z=0;"Q"===D||"T"===D?(Z=R+(R-ha),Aa=z+(z-va)):(Z=R,Aa=z);x.push({key:"C",data:[R+2*(Z-R)/3,z+2*(Aa-z)/3,Va+2*(Z-Va)/3,Ya+2*(Aa-Ya)/3,Va,Ya]});ha=Z;va=Aa;R=Va;z=Ya;break;case "Q":const [ob,Bb,Rb,ic]=Ha;x.push({key:"C",data:[R+2*(ob-R)/3,z+2*(Bb-z)/3,Rb+2*(ob-Rb)/3,ic+2*(Bb-ic)/3,Rb,ic]});ha=ob;va=Bb;R=Rb;z=ic;break;case "A":D=Math.abs(Ha[0]);Z=Math.abs(Ha[1]);Aa=Ha[2];const mc=Ha[3],Sc=Ha[4],Xc=Ha[5],Pc=Ha[6]; if(0===D||0===Z)x.push({key:"C",data:[R,z,Xc,Pc,Xc,Pc]}),R=Xc,z=Pc;else if(R!==Xc||z!==Pc)wa(R,z,Xc,Pc,D,Z,Aa,mc,Sc).forEach(function(Yc){x.push({key:"C",data:Yc})}),R=Xc,z=Pc;break;case "Z":x.push({key:"Z",data:[]}),R=na,z=sa}D=Ba}return x}function ta(Z,x,D){return[Z*Math.cos(D)-x*Math.sin(D),Z*Math.sin(D)+x*Math.cos(D)]}function wa(Z,x,D,R,z,na,sa,ha,va,Aa){const Ba=(Ha=sa,Math.PI*Ha/180);var Ha;Ha=[];if(Aa)[ha,Va,Ya,ob]=Aa;else{[Z,x]=ta(Z,x,-Ba);[D,R]=ta(D,R,-Ba);var Va=(Z-D)/2;var Ya=(x-R)/2; var ob=Va*Va/(z*z)+Ya*Ya/(na*na);1ha&&(ha=2*Math.PI+ha);0>Va&&(Va=2*Math.PI+Va);va&&ha>Va&&(ha-=2*Math.PI);!va&&Va>ha&&(Va-=2*Math.PI)}if(Math.abs(Va-ha)>120*Math.PI/180){Ha= Va;Bb=D;const Rb=R;Va=va&&Va>ha?ha+120*Math.PI/180:ha+120*Math.PI/180*-1;Ha=wa(D=Ya+z*Math.cos(Va),R=ob+na*Math.sin(Va),Bb,Rb,z,na,sa,0,va,[Va,Ha,Ya,ob])}sa=Math.tan((Va-ha)/4);z=4/3*z*sa;sa*=4/3*na;na=[Z,x];Z=[Z+z*Math.sin(ha),x-sa*Math.cos(ha)];x=[D+z*Math.sin(Va),R-sa*Math.cos(Va)];D=[D,R];if(Z[0]=2*na[0]-Z[0],Z[1]=2*na[1]-Z[1],Aa)return[Z,x,D].concat(Ha);Ha=[Z,x,D].concat(Ha);Aa=[];for(D=0;Dz;)z+=2*Math.PI,na+=2*Math.PI;na-z>2*Math.PI&&(z=0,na=2*Math.PI);var Aa=Math.min(2*Math.PI/va.curveStepCount/2,(na-z)/2);const Ba=ib(Aa,Z,x,D,R,z,na,1,va);va.disableMultiStroke||(Aa=ib(Aa,Z,x,D,R,z,na,1.5,va),Ba.push(...Aa));return sa&&(ha?Ba.push(...Db(Z,x,Z+D*Math.cos(z), x+R*Math.sin(z),va),...Db(Z,x,Z+D*Math.cos(na),x+R*Math.sin(na),va)):Ba.push({op:"lineTo",data:[Z,x]},{op:"lineTo",data:[Z+D*Math.cos(z),x+R*Math.sin(z)]})),{type:"path",ops:Ba}}function db(Z,x){const D=[];if(Z.length){const R=x.maxRandomnessOffset||0,z=Z.length;if(2va?1:500ha&&(Ba=va/10);ha=Ba/2;va=.2+.2*Fb(z);let Ha=z.bowing*z.maxRandomnessOffset*(R-x)/200,Va=z.bowing*z.maxRandomnessOffset*(Z-D)/200;Ha=hc(Ha,z,Aa);Va= hc(Va,z,Aa);const Ya=[],ob=z.preserveVertices;return na&&(sa?Ya.push({op:"move",data:[Z+(ob?0:hc(ha,z,Aa)),x+(ob?0:hc(ha,z,Aa))]}):Ya.push({op:"move",data:[Z+(ob?0:hc(Ba,z,Aa)),x+(ob?0:hc(Ba,z,Aa))]})),sa?Ya.push({op:"bcurveTo",data:[Ha+Z+(D-Z)*va+hc(ha,z,Aa),Va+x+(R-x)*va+hc(ha,z,Aa),Ha+Z+2*(D-Z)*va+hc(ha,z,Aa),Va+x+2*(R-x)*va+hc(ha,z,Aa),D+(ob?0:hc(ha,z,Aa)),R+(ob?0:hc(ha,z,Aa))]}):Ya.push({op:"bcurveTo",data:[Ha+Z+(D-Z)*va+hc(Ba,z,Aa),Va+x+(R-x)*va+hc(Ba,z,Aa),Ha+Z+2*(D-Z)*va+hc(Ba,z,Aa),Va+x+ 2*(R-x)*va+hc(Ba,z,Aa),D+(ob?0:hc(Ba,z,Aa)),R+(ob?0:hc(Ba,z,Aa))]}),Ya}function Zb(Z,x,D){const R=[];R.push([Z[0][0]+hc(x,D),Z[0][1]+hc(x,D)]);R.push([Z[0][0]+hc(x,D),Z[0][1]+hc(x,D)]);for(let z=1;zha&&(ha=Aa,va=Ya)}return Math.sqrt(ha)>R?(Yb(Z,x,va+1,R,z),Yb(Z,va,D,R,z)):(z.length||z.push(na), z.push(sa)),z}function Ub(Z,x=.15,D){const R=[],z=(Z.length-1)/3;for(let na=0;na= Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function Mc(Z,x){(null==x||x>Z.length)&&(x=Z.length);for(var D=0,R= Array(x);D=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function Td(Z, x){(null==x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);Dz){return Z*R(.5-x*(.5-D))}function ze(Z,x){return[Z[0]+x[0],Z[1]+x[1]]}function Ee(Z,x){return[Z[0]-x[0],Z[1]-x[1]]}function xd(Z,x){return[Z[0]*x,Z[1]*x]}function Dd(Z){return[Z[1],-Z[0]]}function Ie(Z,x){return Z[0]===x[0]&&Z[1]===x[1]}function qg(Z,x){Z=Ee(Z,x);return Z[0]*Z[0]+Z[1]*Z[1]}function qf(Z){var x=Math.hypot(Z[0],Z[1]);return[Z[0]/x,Z[1]/x]}function rf(Z,x){return Math.hypot(Z[1]- x[1],Z[0]-x[0])}function hf(Z,x,D){let R=Math.sin(D);D=Math.cos(D);let z=Z[0]-x[0];Z=Z[1]-x[1];return[z*D-Z*R+x[0],z*R+Z*D+x[1]]}function Gf(Z,x,D){return ze(Z,xd(Ee(x,Z),D))}function og(Z,x,D){return ze(Z,xd(x,D))}function Ih(Z,x={}){var D;let {size:R=16,smoothing:z=.5,thinning:na=.5,simulatePressure:sa=!0,easing:ha=pf=>pf,start:va={},end:Aa={},last:Ba=!1}=x,{cap:Ha=!0,taper:Va=0,easing:Ya=pf=>pf*(2-pf)}=va,{cap:ob=!0,taper:Bb=0,easing:Rb=pf=>--pf*pf*pf+1}=Aa;if(0===Z.length)return[];var ic,mc=Z[Z.length- 1].runningLength,Sc=Math.pow(R*z,2);x=[];var Xc=[],Pc=Z.slice(0,10).reduce((pf,ye)=>{var Mg=ye.pressure;sa&&(ye=Wl(1,ye.distance/R),Mg=Wl(1,1-ye),Mg=Wl(1,pf+.275*ye*(Mg-pf)));return(pf+Mg)/2},Z[0].pressure),Yc=ud(R,na,Z[Z.length-1].pressure,ha);let Bd=Z[0].vector;var Xd=Z[0].point;let kd=Xd;var qd=Xd,Hd=kd,He=!0;for(let pf=0;pfni){Xd=xd(Dd(Bd),Yc);for(let El=1/13,Fl=0;1>=Fl;Fl+=El)Hd=hf(ze(ye,Xd),ye,Gm*-Fl),qd=hf(Ee(ye,Xd),ye,Gm*Fl),Xc.push(Hd),x.push(qd);Xd=qd;kd=Hd}else Hd=xd(Dd(Gf(Bi,Mg,ni)),Yc),qd=Ee(ye,Hd),Hd=ze(ye,Hd),((Pc=2>pf||.25>ni)||qg(Xd,qd)>Sc)&&(x.push(qd),Xd=qd),(Pc|| qg(kd,Hd)>Sc)&&(Xc.push(Hd),kd=Hd),Pc=Tg,Bd=Mg}}D=Z[0];ic=Z[Z.length-1];if((mc=He||2>Xc.length||2>x.length)&&(!Va&&!Bb||Ba)){x=0;Xc=Ie(D.point,ic.point)?ze(D.point,[1,1]):ic.point;for(qd=0;qdR){x=ud(R,na,pf,ha);break}}x=og(D.point,Dd(qf(Ee(D.point,Xc))),-(x||Yc));Xc=[];for(let pf=1/13,ye=pf;1>=ye;ye+=pf)Xc.push(hf(x,D.point,2*Gm*ye));return Xc}Z=[];He=[];if(1=ye;ye+=pf){Sc=hf(Hd,D.point,Gm*ye);if(1>rf(Sc,qd))break;Z.push(Sc)}x.shift();Xc.shift()}}else Ie(Hd,qd)||(Sc=qf(Ee(qd,Hd)),qd=rf(Hd,qd)/2,Z.push(og(D.point,Sc,-qd),og(D.point,Sc,.95*-qd),og(D.point,Sc,.95*qd),og(D.point,Sc,qd)),x.shift(),Xc.shift());D=xd(ze(x[x.length-1],Xc[Xc.length-1]),.5);qd=ic.point;Hd=Dd(qf(Ee(qd,D)));if(ob||Bb)if(Bb||Va&&mc)He.push(qd.slice(0, 2));else{Yc=og(qd,Hd,Yc);for(let pf=1/29,ye=0;1>=ye;ye+=pf)Hd=hf(Yc,qd,3*Gm*ye),He.push(Hd)}else D=Gf(D,qd,.95),Yc*=.95,He.push(og(D,Hd,Yc),og(qd,Hd,Yc),og(qd,Hd,-Yc),og(D,Hd,-Yc))}return x.concat(He,Xc.reverse(),Z)}function Jh(Z,x={}){return Ih(function(D,R={}){var z;let {streamline:na=.5,size:sa=16,last:ha=!1}=R;if(0===D.length)return[];R=.15+.85*(1-na);D=Array.isArray(D[0])?D:D.map(({x:Ya,y:ob,pressure:Bb=.5})=>[Ya,ob,Bb]);1===D.length&&D.push([...ze(D[0],[1,1]),D[0][2]||.5]);let va=[{point:[D[0][0], D[0][1]],pressure:D[0][2]||.25,vector:[1,1],distance:0,runningLength:0}],Aa=!1,Ba=0,Ha=va[0],Va=D.length-1;for(let Ya=1;Ya=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function wb(Z,x){(null== x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);D=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D= D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function jd(Z,x){(null==x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);D=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function Wa(Z,x){(null== x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);D=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha; },f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function Cd(Z,x){(null==x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);D=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z; }}}}function ne(Z,x){(null==x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);D=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function qe(Z,x){(null== x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);D=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D= D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function Ye(Z,x){(null==x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);D=Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next(); return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function Hi(Z,x){(null==x||x>Z.length)&&(x=Z.length);for(var D=0,R=Array(x);D= Z.length?{done:!0}:{done:!1,value:Z[R++]}},e:function(ha){throw ha;},f:x}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var z,na=!0,sa=!1;return{s:function(){D=D.call(Z)},n:function(){var ha=D.next();return na=ha.done,ha},e:function(ha){sa=!0;z=ha},f:function(){try{na||null==D.return||D.return()}finally{if(sa)throw z;}}}}function $i(Z,x){(null==x||x>Z.length)&&(x=Z.length);for(var D=0,R= Array(x);Dx.label?1:-1}).filter(function(Z){return 85<=Ik[Z.code]});"production"===yc.Vi.DEVELOPMENT&&bk.unshift({code:"__test__",label:"test language"},{code:"".concat("__test__",".rtl"),label:"‪test language (rtl)‬", rtl:!0});var Cg=Wg,zh={},tg=function(){var Z=(0,ff.Z)(Yd().mark(function R(D){return Yd().wrap(function(z){for(;;)switch(z.prev=z.next){case 0:if(Cg=D,document.documentElement.dir=Cg.rtl?"rtl":"ltr",document.documentElement.lang=Cg.code,!D.code.startsWith("__test__")){z.next=7;break}zh={};z.next=10;break;case 7:return z.next=9,e(788)("./".concat(Cg.code,".json"));case 9:zh=z.sent;case 10:case "end":return z.stop()}},R)}));return function(D){return Z.apply(this,arguments)}}(),Ah=function(Z,x){for(var D= 0;DX(R)||(R=[x[z][0],R[1]],3D&&ha>D&&R.push({point:na,distance:sa})}}if(1ha.distance-va.distance).map(ha=>ha.point);if(V(Z,...x[0])||D.shift(),V(Z,...x[1])||D.pop(),1>=D.length)return this.midPointInPolygon(Z,x)?[x]:[];x=[x[0],...D,x[1]];D=[];for(R=0;RR&&(R=4*x.strokeWidth);R=Math.max(R,.1);let z=x.fillWeight;0>z&&(z=x.strokeWidth/2);const na=R/4;for(const Aa of Z){var sa= X(Aa);Z=Math.ceil(sa/R)-1;sa-=Z*R;const Ba=(Aa[0][0]+Aa[1][0])/2-R/4,Ha=Math.min(Aa[0][1],Aa[1][1]);for(let Va=0;Vax.dashOffset?0>x.hachureGap?4* x.strokeWidth:x.hachureGap:x.dashOffset,R=0>x.dashGap?0>x.hachureGap?4*x.strokeWidth:x.hachureGap:x.dashGap,z=[];return Z.forEach(na=>{var sa=X(na);const ha=Math.floor(sa/(D+R));sa=(sa+R-ha*(D+R))/2;let va=na[0];var Aa=na[1];va[0]>Aa[0]&&(va=na[1],Aa=na[0]);na=Math.atan((Aa[1]-va[1])/(Aa[0]-va[0]));for(Aa=0;Aax.hachureGap?4*x.strokeWidth:x.hachureGap,R=0>x.zigzagOffset?D:x.zigzagOffset;Z=ba(Z,x=Object.assign({},x,{hachureGap:D+R}));return{type:"fillSketch",ops:this.zigzagLines(Z,R,x)}}zigzagLines(Z,x,D){const R=[];return Z.forEach(z=>{var na=X(z);na=Math.round(na/(2*x));let sa=z[0];var ha=z[1];sa[0]>ha[0]&&(sa=z[1],ha=z[0]);z=Math.atan((ha[1]-sa[1])/(ha[0]-sa[0]));for(ha= 0;haz;)z+=2*Math.PI,na+=2* Math.PI;na-z>2*Math.PI&&(z=0,na=2*Math.PI);const Ba=(na-z)/ha.curveStepCount,Ha=[];for(;z<=na;z+=Ba)Ha.push([Z+D*Math.cos(z),x+R*Math.sin(z)]);Z=(Ha.push([Z+D*Math.cos(na),x+R*Math.sin(na)]),Ha.push([Z,x]),Ib(Ha,ha));sa.call(va,Z)}return"none"!==ha.stroke&&va.push(Aa),this._d("arc",va,ha)}curve(Z,x){x=this._o(x);const D=[],R=ya(Z,x);x.fill&&"none"!==x.fill&&3<=Z.length&&(Z=Ub(function(z,na=0){var sa=z.length;if(3>sa)throw Error("A curve must have at least three points.");const ha=[];if(3===sa)ha.push([...z[0]], [...z[1]],[...z[2]],[...z[2]]);else{sa=[];sa.push(z[0],z[0]);for(var va=1;vaD.simplification),sa=function(ha,va,Aa){var Ba=oa(U(ua(ha)));ha=[];let Ha=[];var Va=[0,0];let Ya=[];const ob=()=>{4<=Ya.length&&Ha.push(...Ub(Ya,va));Ya=[]};for(const {key:Bb,data:Rb}of Ba)switch(Bb){case "M":ob();Ha.length&&(ha.push(Ha),Ha=[]);Va=[Rb[0],Rb[1]];Ha.push(Va);break;case "L":ob();Ha.push([Rb[0],Rb[1]]);break;case "C":Ya.length||(Ba=Ha.length?Ha[Ha.length-1]:Va,Ya.push([Ba[0],Ba[1]]));Ya.push([Rb[0],Rb[1]]);Ya.push([Rb[2],Rb[3]]);Ya.push([Rb[4],Rb[5]]);break; case "Z":ob(),Ha.push([Va[0],Va[1]])}ob();Ha.length&&(ha.push(Ha),Ha=[]);if(!Aa)return ha;Va=[];for(const Bb of ha)ha=Yb(Bb,0,Bb.length,Aa),ha.length&&Va.push(ha);return Va}(Z,1,na?4-4*D.simplification:(1+D.roughness)/2);if(x)if(D.combineNestedSvgPaths){const ha=[];sa.forEach(va=>ha.push(...va));"solid"===D.fillStyle?R.push(db(ha,D)):R.push(Ib(ha,D))}else sa.forEach(ha=>{"solid"===D.fillStyle?R.push(db(ha,D)):R.push(Ib(ha,D))});return z&&(na?sa.forEach(ha=>{R.push(Da(ha,!1,D))}):R.push(function(ha, va){ha=oa(U(ua(ha)));const Aa=[];let Ba=[0,0],Ha=[0,0];for(const {key:Va,data:Ya}of ha)switch(Va){case "M":const ob=1*(va.maxRandomnessOffset||0),Bb=va.preserveVertices;Aa.push({op:"move",data:Ya.map(Yc=>Yc+(Bb?0:hc(ob,va)))});Ha=[Ya[0],Ya[1]];Ba=[Ya[0],Ya[1]];break;case "L":Aa.push(...Db(Ha[0],Ha[1],Ya[0],Ya[1],va));Ha=[Ya[0],Ya[1]];break;case "C":const [Rb,ic,mc,Sc,Xc,Pc]=Ya;Aa.push(...La(Rb,ic,mc,Sc,Xc,Pc,Ha,va));Ha=[Xc,Pc];break;case "Z":Aa.push(...Db(Ha[0],Ha[1],Ba[0],Ba[1],va)),Ha=[Ba[0],Ba[1]]}return{type:"path", ops:Aa}}(Z,D))),this._d("path",R,D)}opsToPath(Z,x){let D="";for(const R of Z.ops)switch(Z="number"==typeof x&&0<=x?R.data.map(z=>+z.toFixed(x)):R.data,R.op){case "move":D+=`M${Z[0]} ${Z[1]} `;break;case "bcurveTo":D+=`C${Z[0]} ${Z[1]}, ${Z[2]} ${Z[3]}, ${Z[4]} ${Z[5]} `;break;case "lineTo":D+=`L${Z[0]} ${Z[1]} `}return D.trim()}toPaths(Z){var x=Z.sets||[];Z=Z.options||this.defaultOptions;const D=[];for(const R of x){x=null;switch(R.type){case "path":x={d:this.opsToPath(R),stroke:Z.stroke,strokeWidth:Z.strokeWidth, fill:"none"};break;case "fillPath":x={d:this.opsToPath(R),stroke:"none",strokeWidth:0,fill:Z.fill||"none"};break;case "fillSketch":x=this.fillSketch(R,Z)}x&&D.push(x)}return D}fillSketch(Z,x){let D=x.fillWeight;return 0>D&&(D=x.strokeWidth/2),{d:this.opsToPath(Z),stroke:x.fill||"none",strokeWidth:D,fill:"none"}}}class $k{constructor(Z,x){this.canvas=Z;this.ctx=this.canvas.getContext("2d");this.gen=new aj(x)}draw(Z){const x=Z.sets||[],D=Z.options||this.getDefaultOptions(),R=this.ctx;for(const z of x)switch(z.type){case "path":R.save(); R.strokeStyle="none"===D.stroke?"transparent":D.stroke;R.lineWidth=D.strokeWidth;D.strokeLineDash&&R.setLineDash(D.strokeLineDash);D.strokeLineDashOffset&&(R.lineDashOffset=D.strokeLineDashOffset);this._drawToContext(R,z);R.restore();break;case "fillPath":R.save();R.fillStyle=D.fill||"";this._drawToContext(R,z,"curve"===Z.shape||"polygon"===Z.shape?"evenodd":"nonzero");R.restore();break;case "fillSketch":this.fillSketch(R,z,D)}}fillSketch(Z,x,D){let R=D.fillWeight;0>R&&(R=D.strokeWidth/2);Z.save(); D.fillLineDash&&Z.setLineDash(D.fillLineDash);D.fillLineDashOffset&&(Z.lineDashOffset=D.fillLineDashOffset);Z.strokeStyle=D.fill||"";Z.lineWidth=R;this._drawToContext(Z,x);Z.restore()}_drawToContext(Z,x,D="nonzero"){Z.beginPath();for(const R of x.ops){const z=R.data;switch(R.op){case "move":Z.moveTo(z[0],z[1]);break;case "bcurveTo":Z.bezierCurveTo(z[0],z[1],z[2],z[3],z[4],z[5]);break;case "lineTo":Z.lineTo(z[0],z[1])}}"fillPath"===x.type?Z.fill(D):Z.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(Z, x,D,R,z){Z=this.gen.line(Z,x,D,R,z);return this.draw(Z),Z}rectangle(Z,x,D,R,z){Z=this.gen.rectangle(Z,x,D,R,z);return this.draw(Z),Z}ellipse(Z,x,D,R,z){Z=this.gen.ellipse(Z,x,D,R,z);return this.draw(Z),Z}circle(Z,x,D,R){Z=this.gen.circle(Z,x,D,R);return this.draw(Z),Z}linearPath(Z,x){Z=this.gen.linearPath(Z,x);return this.draw(Z),Z}polygon(Z,x){Z=this.gen.polygon(Z,x);return this.draw(Z),Z}arc(Z,x,D,R,z,na,sa=!1,ha){Z=this.gen.arc(Z,x,D,R,z,na,sa,ha);return this.draw(Z),Z}curve(Z,x){Z=this.gen.curve(Z, x);return this.draw(Z),Z}path(Z,x){Z=this.gen.path(Z,x);return this.draw(Z),Z}}class Hn{constructor(Z,x){this.svg=Z;this.gen=new aj(x)}draw(Z){var x=Z.sets||[];const D=Z.options||this.getDefaultOptions(),R=this.svg.ownerDocument||window.document,z=R.createElementNS("http://www.w3.org/2000/svg","g"),na=Z.options.fixedDecimalPlaceDigits;for(const sa of x){x=null;switch(sa.type){case "path":x=R.createElementNS("http://www.w3.org/2000/svg","path");x.setAttribute("d",this.opsToPath(sa,na));x.setAttribute("stroke", D.stroke);x.setAttribute("stroke-width",D.strokeWidth+"");x.setAttribute("fill","none");D.strokeLineDash&&x.setAttribute("stroke-dasharray",D.strokeLineDash.join(" ").trim());D.strokeLineDashOffset&&x.setAttribute("stroke-dashoffset",`${D.strokeLineDashOffset}`);break;case "fillPath":x=R.createElementNS("http://www.w3.org/2000/svg","path");x.setAttribute("d",this.opsToPath(sa,na));x.setAttribute("stroke","none");x.setAttribute("stroke-width","0");x.setAttribute("fill",D.fill||"");"curve"!==Z.shape&& "polygon"!==Z.shape||x.setAttribute("fill-rule","evenodd");break;case "fillSketch":x=this.fillSketch(R,sa,D)}x&&z.appendChild(x)}return z}fillSketch(Z,x,D){let R=D.fillWeight;0>R&&(R=D.strokeWidth/2);Z=Z.createElementNS("http://www.w3.org/2000/svg","path");return Z.setAttribute("d",this.opsToPath(x,D.fixedDecimalPlaceDigits)),Z.setAttribute("stroke",D.fill||""),Z.setAttribute("stroke-width",R+""),Z.setAttribute("fill","none"),D.fillLineDash&&Z.setAttribute("stroke-dasharray",D.fillLineDash.join(" ").trim()), D.fillLineDashOffset&&Z.setAttribute("stroke-dashoffset",`${D.fillLineDashOffset}`),Z}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(Z,x){return this.gen.opsToPath(Z,x)}line(Z,x,D,R,z){Z=this.gen.line(Z,x,D,R,z);return this.draw(Z)}rectangle(Z,x,D,R,z){Z=this.gen.rectangle(Z,x,D,R,z);return this.draw(Z)}ellipse(Z,x,D,R,z){Z=this.gen.ellipse(Z,x,D,R,z);return this.draw(Z)}circle(Z,x,D,R){Z=this.gen.circle(Z,x,D,R);return this.draw(Z)}linearPath(Z,x){Z= this.gen.linearPath(Z,x);return this.draw(Z)}polygon(Z,x){Z=this.gen.polygon(Z,x);return this.draw(Z)}arc(Z,x,D,R,z,na,sa=!1,ha){Z=this.gen.arc(Z,x,D,R,z,na,sa,ha);return this.draw(Z)}curve(Z,x){Z=this.gen.curve(Z,x);return this.draw(Z)}path(Z,x){Z=this.gen.path(Z,x);return this.draw(Z)}}var Bj={canvas:(Z,x)=>new $k(Z,x),svg:(Z,x)=>new Hn(Z,x),generator:Z=>new aj(Z),newSeed:()=>aj.newSeed()};let dk=(Z=21)=>{let x="",D=crypto.getRandomValues(new Uint8Array(Z));for(;Z--;){let R=63&D[Z];x+=36>R?R.toString(36): 62>R?(R-26).toString(36).toUpperCase():63>R?"_":"-"}return x};var Yg=function(Z){return null!=Z&&"text"===Z.type},ki=function(Z){return null!=Z&&"freedraw"===Z.type},Dg=function(Z){return null!=Z&&oj(Z.type)},oj=function(Z){return"arrow"===Z||"line"===Z},Xg=function(Z){return null!=Z&&"arrow"===Z.type},Ze=function(Z){return null!=Z&&("rectangle"===Z.type||"diamond"===Z.type||"ellipse"===Z.type||"text"===Z.type)},Jf=function(Z,x,D,R,z){return[(Z-D)*Math.cos(z)-(x-R)*Math.sin(z)+D,(Z-D)*Math.sin(z)+ (x-R)*Math.cos(z)+R]},Df=function(Z,x,D){return Jf(Z[0],Z[1],x[0],x[1],D)},qi=function(Z,x,D,R,z,na,sa,ha){var va=Math.cos(R);R=Math.sin(R);return Z.e&&Z.w?x+=z+sa:Z.e?(x+=z*(1+va),D+=z*R,x+=sa*(1-va),D+=sa*-R):Z.w&&(x+=z*(1-va),D+=z*-R,x+=sa*(1+va),D+=sa*R),Z.n&&Z.s?D+=na+ha:Z.n?(x+=na*R,D+=na*(1-va),x+=ha*-R,D+=ha*(1+va)):Z.s&&(x+=na*-R,D+=na*(1+va),x+=ha*R,D+=ha*(1-va)),[x,D]},qj=function(Z){var x=1R)return!1;var z=[Number.MAX_SAFE_INTEGER,D];x=[x,D];for(var na=D=0;na=Math.min(Z[0],D[0])&&x[1]<=Math.max(Z[1],D[1])&&x[1]>=Math.min(Z[1],D[1])},Qi=function(Z,x,D){Z=(x[1]-Z[1])*(D[0]-x[0])-(x[0]-Z[0])*(D[1]-x[1]);return 0===Z?0:0=z;){var Ba=na(z,0),Ha=na(z,1);x&&(Ha=ia(x(Ba,Ha),2),Ba=Ha[0],Ha=Ha[1]);R.minY=Math.min(R.minY,Ha);R.minX=Math.min(R.minX,Ba);R.maxX=Math.max(R.maxX,Ba);R.maxY=Math.max(R.maxY,Ha);z+=.1}}return R},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/ 0});return[Z.minX,Z.minY,Z.maxX,Z.maxY]},tl=function(Z){var x,D=1/0,R=1/0,z=-1/0,na=-1/0;Z=Hc(Z);try{for(Z.s();!(x=Z.n()).done;){var sa=ia(x.value,2),ha=sa[0],va=sa[1];D=Math.min(D,ha);R=Math.min(R,va);z=Math.max(z,ha);na=Math.max(na,va)}}catch(Aa){Z.e(Aa)}finally{Z.f()}return[D,R,z,na]},jf=function(Z){if(2>Z.points.length||!kh.get(Z)){var x=Z.points.reduce(function(D,R){var z=ia(R,2);R=z[0];z=z[1];return D.minY=Math.min(D.minY,z),D.minX=Math.min(D.minX,R),D.maxX=Math.max(D.maxX,R),D.maxY=Math.max(D.maxY, z),D},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});Z=[x.minX+Z.x,x.minY+Z.y,x.maxX+Z.x,x.maxY+Z.y]}else x=kh.get(Z),x=Jk(x[0]),x=ia(Mh(x),4),Z=[x[0]+Z.x,x[1]+Z.y,x[2]+Z.x,x[3]+Z.y];return Z},gk=function(Z){var x=ia(Vf(Z),4),D=x[0],R=x[1];var z=x[2];var na=x[3],sa=(D+z)/2,ha=(R+na)/2;if(ki(Z))return z=tl(Z.points.map(function(Ha){Ha=ia(Ha,2);return Jf(Ha[0],Ha[1],sa-Z.x,ha-Z.y,Z.angle)})),z=ia(z,4),[z[0]+Z.x,z[1]+Z.y,z[2]+Z.x,z[3]+Z.y];if(Dg(Z))z=function(Ha,Va,Ya){if(2>Ha.points.length||!kh.get(Ha)){var ob= Ha.points.reduce(function(Bb,Rb){var ic=ia(Rb,2);Rb=ic[0];ic=ic[1];var mc=ia(Jf(Ha.x+Rb,Ha.y+ic,Va,Ya,Ha.angle),2);return Rb=mc[0],ic=mc[1],Bb.minY=Math.min(Bb.minY,ic),Bb.minX=Math.min(Bb.minX,Rb),Bb.maxX=Math.max(Bb.maxX,Rb),Bb.maxY=Math.max(Bb.maxY,ic),Bb},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[ob.minX,ob.minY,ob.maxX,ob.maxY]}ob=kh.get(Ha);ob=Jk(ob[0]);return Mh(ob,function(Bb,Rb){return Jf(Ha.x+Bb,Ha.y+Rb,Va,Ya,Ha.angle)})}(Z,sa,ha);else if("diamond"===Z.type){R=ia(Jf(sa,R,sa,ha,Z.angle), 2);x=R[0];R=R[1];na=ia(Jf(sa,na,sa,ha,Z.angle),2);var va=na[0];na=na[1];var Aa=ia(Jf(D,ha,sa,ha,Z.angle),2);D=Aa[0];Aa=Aa[1];var Ba=ia(Jf(z,ha,sa,ha,Z.angle),2);z=Ba[0];Ba=Ba[1];z=[Math.min(x,va,D,z),Math.min(R,na,Aa,Ba),Math.max(x,va,D,z),Math.max(R,na,Aa,Ba)]}else"ellipse"===Z.type?(z=(z-D)/2,R=(na-R)/2,va=Math.cos(Z.angle),D=Math.sin(Z.angle),x=Math.hypot(z*va,R*D),z=Math.hypot(R*va,z*D),z=[sa-x,ha-z,sa+x,ha+z]):(va=ia(Jf(D,R,sa,ha,Z.angle),2),x=va[0],va=va[1],Aa=ia(Jf(D,na,sa,ha,Z.angle),2),D= Aa[0],Aa=Aa[1],Ba=ia(Jf(z,na,sa,ha,Z.angle),2),na=Ba[0],Ba=Ba[1],R=ia(Jf(z,R,sa,ha,Z.angle),2),z=R[0],R=R[1],z=[Math.min(x,D,na,z),Math.min(va,Aa,Ba,R),Math.max(x,D,na,z),Math.max(va,Aa,Ba,R)]);return z},Bg=function(Z){if(!Z.length)return[0,0,0,0];var x=1/0,D=-1/0,R=1/0,z=-1/0;return Z.forEach(function(na){na=ia(gk(na),4);var sa=na[1],ha=na[2],va=na[3];x=Math.min(x,na[0]);R=Math.min(R,sa);D=Math.max(D,ha);z=Math.max(z,va)}),[x,R,D,z]},Re=function(Z,x,D){if(!Dg(Z)&&!ki(Z))return[Z.x,Z.y,Z.x+x,Z.y+ D];x=lm(0,x,lm(1,D,Z.points));ki(Z)?x=tl(x):(D=Bj.generator(),x="sharp"===Z.strokeSharpness?D.linearPath(x,Yf(Z)):D.curve(x,Yf(Z)),x=Jk(x),x=Mh(x));x=ia(x,4);return[x[0]+Z.x,x[1]+Z.y,x[2]+Z.x,x[3]+Z.y]},ul=function(Z,x,D){var R=Bj.generator();x="sharp"===D?R.linearPath(x,Yf(Z)):R.curve(x,Yf(Z));x=Jk(x);x=ia(Mh(x),4);return[x[0]+Z.x,x[1]+Z.y,x[2]+Z.x,x[3]+Z.y]},mf=JSON.parse('{"white":"#ffffff","black":"#000000","gray":["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],"red":["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],"pink":["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],"grape":["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],"violet":["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],"indigo":["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],"blue":["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],"cyan":["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],"teal":["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],"green":["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],"lime":["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],"yellow":["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],"orange":["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]}'), $h=function(Z){return[mf.red[Z],mf.pink[Z],mf.grape[Z],mf.violet[Z],mf.indigo[Z],mf.blue[Z],mf.cyan[Z],mf.teal[Z],mf.green[Z],mf.lime[Z],mf.yellow[Z],mf.orange[Z]]},ri={canvasBackground:[mf.white,mf.gray[0],mf.gray[1]].concat(ja($h(0))),elementBackground:["transparent",mf.gray[4],mf.gray[6]].concat(ja($h(6))),elementStroke:[mf.black,mf.gray[8],mf.gray[7]].concat(ja($h(9)))},rh=e(6207),xi=/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),nj=/^Win/.test(window.navigator.platform),Af=xi?"metaKey": "ctrlKey",oh=function(Z){return"ArrowLeft"===Z||"ArrowRight"===Z||"ArrowDown"===Z||"ArrowUp"===Z},Nh=function(Z){return Z.charAt(0).toUpperCase()+Z.slice(1)},Dj=function(Z){return Z instanceof HTMLElement&&"wysiwyg"===Z.dataset.type||Z instanceof HTMLBRElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLInputElement&&("text"===Z.type||"number"===Z.type)},mm=function(Z){Z=Z.fontFamily;for(var x=0,D=Object.entries(yc.ut);xic.length)return null;var Xc="start"===mc?1:ic.length-1,Pc=ic[Xc].data,Yc=[Pc[4],Pc[5]],Bd=[Pc[2],Pc[3]],Xd=[Pc[0],Pc[1]];ic=ic[Xc-1];var kd=[0,0];"move"===ic.op?kd=ic.data:"bcurveTo"===ic.op&&(kd=[ic.data[4],ic.data[5]]);Xc=function(pf,ye){return Math.pow(1-pf,3)*Yc[ye]+3*pf*Math.pow(1-pf,2)*Bd[ye]+3*Math.pow(pf,2)*(1-pf)*Xd[ye]+ kd[ye]*Math.pow(pf,3)};ic=ia("start"===mc?kd:Yc,2);mc=ic[0];ic=ic[1];Pc=[Xc(.3,0),Xc(.3,1)];Xc=Pc[0];Pc=Pc[1];var qd=Math.hypot(mc-Xc,ic-Pc);Xc=(mc-Xc)/qd;Pc=(ic-Pc)/qd;qd={arrow:30,bar:15,dot:15}[Sc];var Hd=0;if("arrow"===Sc){var He=ia(Rb.points[Rb.points.length-1],2);Hd=He[0];He=He[1];var Tg=ia(1na?Math.floor(Math.abs(Z.x-na))*window.devicePixelRatio*D.value:0;sa=Z.y>sa?Math.floor(Math.abs(Z.y- sa))*window.devicePixelRatio*D.value:0;x.translate(na,sa)}else R.width=Z.width*window.devicePixelRatio*D.value+z*D.value*2,R.height=Z.height*window.devicePixelRatio*D.value+z*D.value*2;x.save();x.translate(z*D.value,z*D.value);x.scale(window.devicePixelRatio*D.value,window.devicePixelRatio*D.value);z=Bj.canvas(R);D=(Sl(Z,z,x),x.restore(),{element:Z,canvas:R,canvasZoom:D.value,canvasOffsetX:na,canvasOffsetY:sa});return Xl.set(Z,D),D}return R},Ek=function(Z,x,D,R){x=Z.element;var z="freedraw"===x.type? 12*x.strokeWidth:20,na=ia(Vf(x),4),sa=na[0],ha=na[1],va=na[2];na=na[3];ki(x)&&(sa=Math.floor(sa),va=Math.ceil(va),ha=Math.floor(ha),na=Math.ceil(na));var Aa=((sa+va)/2+R.scrollX)*window.devicePixelRatio;R=((ha+na)/2+R.scrollY)*window.devicePixelRatio;D.save();D.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);D.translate(Aa,R);D.rotate(x.angle);D.drawImage(Z.canvas,-(va-sa)/2*window.devicePixelRatio-z*Z.canvasZoom/Z.canvasZoom,-(na-ha)/2*window.devicePixelRatio-z*Z.canvasZoom/Z.canvasZoom, Z.canvas.width/Z.canvasZoom,Z.canvas.height/Z.canvasZoom);D.restore()},lh=function(Z,x,D,R,z){var na=x.generator;switch(Z.type){case "selection":D.save();D.translate(Z.x+z.scrollX,Z.y+z.scrollY);D.fillStyle="rgba(0, 0, 255, 0.10)";D.fillRect(0,0,Z.width,Z.height);D.restore();break;case "freedraw":if(hi(Z,na),R)Z=gh(Z,z),Ek(Z,0,D,z);else{na=ia(Vf(Z),4);var sa=na[0];R=na[1];var ha=na[2],va=na[3];na=(sa+ha)/2+z.scrollX;z=(R+va)/2+z.scrollY;sa=(ha-sa)/2-(Z.x-sa);R=(va-R)/2-(Z.y-R);D.save();D.translate(na, z);D.rotate(Z.angle);D.translate(-sa,-R);Sl(Z,x,D);D.restore()}break;case "rectangle":case "diamond":case "ellipse":case "line":case "arrow":case "text":(hi(Z,na),R)?(Z=gh(Z,z),Ek(Z,0,D,z)):(na=ia(Vf(Z),4),sa=na[0],R=na[1],ha=na[2],va=na[3],na=(sa+ha)/2+z.scrollX,z=(R+va)/2+z.scrollY,sa=(ha-sa)/2-(Z.x-sa),R=(va-R)/2-(Z.y-R),D.save(),D.translate(na,z),D.rotate(Z.angle),D.translate(-sa,-R),Sl(Z,x,D),D.restore());break;default:throw Error("Unimplemented type ".concat(Z.type));}},Li=function(Z,x,D){if(void 0=== D)return Z.draw(x);x={sets:x.sets,shape:x.shape,options:yg(yg({},x.options),{},{fixedDecimalPlaceDigits:D})};return Z.draw(x)},Bf=function(Z,x,D,R,z){var na=ia(Vf(Z),4),sa=na[0],ha=na[1],va=(na[2]-sa)/2-(Z.x-sa),Aa=(na[3]-ha)/2-(Z.y-ha),Ba=180*Z.angle/Math.PI;na=x.generator;switch(Z.type){case "selection":throw Error("Selection rendering is not supported for SVG");case "rectangle":case "diamond":case "ellipse":hi(Z,na);na=Li(x,kh.get(Z),yc.zK);sa=Z.opacity/100;1!==sa&&(na.setAttribute("stroke-opacity", "".concat(sa)),na.setAttribute("fill-opacity","".concat(sa)));na.setAttribute("stroke-linecap","round");na.setAttribute("transform","translate(".concat(R||0," ").concat(z||0,") rotate(").concat(Ba," ").concat(va," ").concat(Aa,")"));D.appendChild(na);break;case "line":case "arrow":hi(Z,na);var Ha=D.ownerDocument.createElementNS("http://www.w3.org/2000/svg","g"),Va=Z.opacity/100;Ha.setAttribute("stroke-linecap","round");kh.get(Z).forEach(function(Sc){Sc=Li(x,Sc,yc.zK);1!==Va&&(Sc.setAttribute("stroke-opacity", "".concat(Va)),Sc.setAttribute("fill-opacity","".concat(Va)));Sc.setAttribute("transform","translate(".concat(R||0," ").concat(z||0,") rotate(").concat(Ba," ").concat(va," ").concat(Aa,")"));"line"===Z.type&&qj(Z.points)&&"transparent"!==Z.backgroundColor&&Sc.setAttribute("fill-rule","evenodd");Ha.appendChild(Sc)});D.appendChild(Ha);break;case "freedraw":xg(Z);sa=Z.opacity/100;na=D.ownerDocument.createElementNS("http://www.w3.org/2000/svg","g");1!==sa&&(na.setAttribute("stroke-opacity","".concat(sa)), na.setAttribute("fill-opacity","".concat(sa)));na.setAttribute("transform","translate(".concat(R||0," ").concat(z||0,") rotate(").concat(Ba," ").concat(va," ").concat(Aa,")"));sa=D.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("stroke","none");na.setAttribute("fill",Z.strokeColor);sa.setAttribute("d",Se(Z));na.appendChild(sa);D.appendChild(na);break;default:if(!Yg(Z))throw Error("Unimplemented type ".concat(Z.type));sa=Z.opacity/100;na=D.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "g");1!==sa&&(na.setAttribute("stroke-opacity","".concat(sa)),na.setAttribute("fill-opacity","".concat(sa)));na.setAttribute("transform","translate(".concat(R||0," ").concat(z||0,") rotate(").concat(Ba," ").concat(va," ").concat(Aa,")"));sa=Z.text.replace(/\r\n?/g,"\n").split("\n");ha=Z.height/sa.length;for(var Ya=Z.height-Z.baseline,ob="center"===Z.textAlign?Z.width/2:"right"===Z.textAlign?Z.width:0,Bb=ik.test(Z.text)?"rtl":"ltr",Rb="center"===Z.textAlign?"middle":"right"===Z.textAlign||"rtl"=== Bb?"end":"start",ic=0;icZ.points.length:0===Z.width&&0===Z.height},mk=function(Z,x,D){var R=Math.abs(x),z=Math.abs(D);"line"===Z||"arrow"===Z||"freedraw"===Z?(Z=Math.round(Math.atan(z/R)/yc.ay)*yc.ay,0===Z?D=0:Z===Math.PI/2?x=0:D=Math.round(R*Math.tan(Z))* Math.sign(D)||D):"selection"!==Z&&(D=R*Math.sign(D));return{width:x,height:D}},Rj=function(Z){var x={width:Z.width,height:Z.height,x:Z.x,y:Z.y};if(0>Z.width){var D=Math.abs(Z.width);x.width=D;x.x=Z.x-D}0>Z.height&&(D=Math.abs(Z.height),x.height=D,x.y=Z.y-D);return x},Qf=function(Z,x,D){D=D.filter(function(R){return R.groupIds.includes(Z)});return 2>D.length?x.selectedGroupIds[Z]||x.editingGroupId===Z?rc(rc({},x),{},{selectedGroupIds:rc(rc({},x.selectedGroupIds),{},da({},Z,!1)),editingGroupId:null}): x:rc(rc({},x),{},{selectedGroupIds:rc(rc({},x.selectedGroupIds),{},da({},Z,!0)),selectedElementIds:rc(rc({},x.selectedElementIds),Object.fromEntries(D.map(function(R){return[R.id,!0]})))})},dh=function(Z,x){return x.groupIds.filter(function(D){return D!==Z.editingGroupId}).find(function(D){return Z.selectedGroupIds[D]})},vi=function(Z){return Object.entries(Z.selectedGroupIds).filter(function(x){x=ia(x,2);x[0];return x[1]}).map(function(x){x=ia(x,2);var D=x[0];x[1];return D})},Me=function(Z,x){var D= rc(rc({},Z),{},{selectedGroupIds:{}}),R=Sf(x,Z);if(!R.length)return rc(rc({},D),{},{editingGroupId:null});var z;R=kb(R);try{for(R.s();!(z=R.n()).done;){var na=z.value.groupIds;if(Z.editingGroupId){var sa=na.indexOf(Z.editingGroupId);-1Pc&&(Aa.n||(Xc.n=af(sa+Bb/2-Ha/2,ha-Sc-ob+Ba,Ha,Va,ic,mc,D)),Aa.s||(Xc.s= af(sa+Bb/2-Ha/2,na+Sc-Ba,Ha,Va,ic,mc,D))),Math.abs(Rb)>Pc&&(Aa.w||(Xc.w=af(sa-Sc-Ya+Ba,ha+Rb/2-Va/2,Ha,Va,ic,mc,D)),Aa.e||(Xc.e=af(va+Sc-Ba,ha+Rb/2-Va/2,Ha,Va,ic,mc,D))),Xc},Tk=function(x,D){var R=2na[1]?z=Qj:0na[0]&&0na[0]&&0>na[1]&&(z=Uf)}}else"text"=== x.type&&(z=Nm);return Jg(Vf(x),x.angle,D,R,z)},uh=function(x,D){return[0,0,0,0,D,x,1,0]},vh=function(){var x=0D||7x[6]?-1:1)/D)},yf=(vh(1,1),vh(1,2),vh(1,3),vh(1,4),vh(1,5),vh(1,6),vh(1,7),function(x,D,R){return Lf([0,R,x,D,0,0,0,0])}),Di=function(x,D){return R=x,[(z=D)[0]*R[0]+z[2]*R[2]+z[3]*R[3]-z[6]*R[6],z[1]*R[0]+z[0]*R[1]-z[4]*R[2]+z[5]*R[3]+z[2]*R[4]-z[3]*R[5]-z[7]*R[6]-z[6]*R[7],z[2]*R[0]+z[0]*R[2]-z[6]*R[3]+z[3]*R[6],z[3]*R[0]+z[6]*R[2]+z[0]*R[3]-z[2]*R[6],z[4]*R[0]+z[7]*R[3]+z[0]*R[4]+z[3]*R[7],z[5]*R[0]+z[7]* R[2]+z[0]*R[5]+z[2]*R[7],z[6]*R[0]+z[0]*R[6],z[7]*R[0]+z[0]*R[7]];var R,z},th=function(x){x=ia(x,2);return[0,0,0,0,x[1],x[0],1,0]},Zh=function(x){return[x[5],x[4]]},Nk=function(x,D){return R=Vg(x,Math.sin(D/2)),z=Math.cos(D/2),"number"==typeof z?[R[0]+z,R[1],R[2],R[3],R[4],R[5],R[6],R[7]]:[R[0]+z[0],R[1]+z[1],R[2]+z[2],R[3]+z[3],R[4]+z[4],R[5]+z[5],R[6]+z[6],R[7]+z[7]];var R,z},Ch=function(x,D){return Lf(Vg(Vg(x,D),vk(x)))},Xi=function(x,D,R,z){var na=10/D.zoom.value;return!Ok(x,D,[R,z])&&eg(x,[R, z],na)},Ok=function(x,D,R){D=10/D.zoom.value;if("text"===x.type)var z=zk;else"arrow"===x.type?z=!1:"freedraw"===x.type?z=!0:(z="transparent"!==x.backgroundColor,z="line"===x.type?z&&qj(x.points):z),z=z?wk:gm;return hj({element:x,point:R,threshold:D,check:z})},eg=function(x,D,R){D=ia(D,2);var z=D[0],na=D[1],sa=ia(Vf(x),4);D=sa[0];var ha=sa[1],va=sa[2];sa=sa[3];z=ia(Jf(z,na,(D+va)/2,(ha+sa)/2,-x.angle),2);x=z[0];z=z[1];return x>D-R&&xha-R&&zAa?sa:BaAa?na:va,Math.hypot(R-va[1],z-va[0])x},wk=function(x,D){return x=Ya)va=[];else{Ya=Math.sqrt(Ya);var ob= ha*Aa*Aa-Va*va*Aa-va*Ba;Ba=Va*va*va-ha*va*Aa-Aa*Ba;va=[uh((ob+Aa*Ya)/Ha,(Ba-va*Ya)/Ha),uh((ob-Aa*Ya)/Ha,(Ba+va*Ya)/Ha)]}}return va}));break;case "ellipse":sa=Hh(x,z,D)}if(2>sa.length)return[];sa=sa.sort(function(ha,va){return lk(Ki(ha,R))-lk(Ki(va,R))});return[sa[0],sa[sa.length-1]]},Sh=function(x){var D=1=ha)return[];ha=Math.sqrt(ha);var va=-z*z*D*sa;sa*=-x*x*na;return[uh((va+z*x*na*ha)/R,(sa-z*x*D*ha)/R),uh((va-z*x*na*ha)/R,(sa+z*x*D*ha)/R)]},wi=function(x,D,R){var z=Math.sign(D),na=0,sa=null;return Sh(x,Math.abs(D)).forEach(function(ha){var va=z*Lf(Ki(ha,R))[1];va>na&&(na=va,sa=ha)}),sa},tj=function(x,D,R,z){var na=[0,0];return Jk(x).some(function(sa, ha){ha=sa.op;var va=sa.data;if("move"===ha)na=va;else if("bcurveTo"===ha){sa=[va[0],va[1]];ha=[va[2],va[3]];va=[va[4],va[5]];var Aa=na;return na=va,function(Ba,Ha,Va,Ya,ob,Bb){var Rb=ia(ob,2);ob=Rb[0];Rb=Rb[1];for(var ic=function(Pc,Yc){return Math.pow(1-Pc,3)*Ya[Yc]+3*Pc*Math.pow(1-Pc,2)*Va[Yc]+3*Math.pow(Pc,2)*(1-Pc)*Ha[Yc]+Ba[Yc]*Math.pow(Pc,3)},mc=0;1>=mc;){var Sc=ic(mc,0),Xc=ic(mc,1);if(Math.sqrt(Math.pow(Sc-ob,2)+Math.pow(Xc-Rb,2))=x[0]&&D<=x[0]+x[2]&&R>=x[1]&&R<=x[1]+x[3]},fh=function(x,D,R,z,na,sa){return x.reduce(function(ha,va){return ha?ha:(ha=function(Aa,Ba,Ha,Va,Ya,ob){if(!Ba.selectedElementIds[Aa.id])return!1;Aa=Tk(Aa,Ya,ob);Ba=Aa.rotation;var Bb=Za(Aa,yk);if(Ba&&Sj(Ba,Ha,Va))return"rotation";Aa=Object.keys(Bb).filter(function(Rb){Rb=Bb[Rb];return!!Rb&&Sj(Rb,Ha,Va)});return 0R?D.points.length+R:R;R=ia(Vf(D),4);z=D.points[z];return Jf(D.x+z[0],D.y+z[1],(R[0]+R[2])/2,(R[1]+R[3])/2,D.angle)}},{key:"pointFromAbsoluteCoords",value:function(D,R){var z=ia(Vf(D),4);R=ia(Jf(R[0],R[1],(z[0]+z[2])/2,(z[1]+z[3])/2,-D.angle),2);return[R[0]-D.x,R[1]-D.y]}},{key:"getPointIndexUnderCursor", value:function(D,R,z,na){D=this.getPointsGlobalCoordinates(D);for(var sa=D.length;-1<--sa;){var ha=D[sa];if(Math.hypot(ha[0]-z,ha[1]-na)*R.valuex.points.length},yd=function(x){x.forEach(function(D){Xg(D)&&Md(D,null,null)})},hg=function(x,D){return ka(D.getElements(),function(R){return Ze(R)&&Uk(R,x)})},fd=function(x,D,R){var z="start"===R?-1:1;R=-1===z?0:x.points.length-1;z=R-z;R=dd.getPointAtIndexGlobalCoordinates(x,R);z=dd.getPointAtIndexGlobalCoordinates(x,z);a:{x=fm(D);z=Ch(x,th(z));x=Ch(x,th(R));var na=Lf(Ki(x,z));x=D.height/D.width;z=D.width/2;var sa=D.height/2,ha=na[2],va=na[3];na=na[1]; var Aa=Math.abs(va),Ba=Math.abs(ha);switch(D.type){case "rectangle":case "text":x=na/(z*(Ba+x*Aa));break a;case "diamond":x=Aa=2*Math.PI?x-2*Math.PI:x},ok=function(x,D,R){return Dg(x)||ki(x)?{points:lm(0,D,lm(1,R,x.points))}:{}},fg=function(x,D,R){D=D/x.width*x.fontSize;if(1>D)return null;x=Vl(x.text,jk({fontSize:D,fontFamily:x.fontFamily})); return{size:D,baseline:x.baseline+(R-x.height)}},Gi=function(x,D,R,z,na,sa,ha){var va=ia(Re(x,x.width,x.height),4),Aa=[va[0],va[1]],Ba=[va[2],va[3]];va=[(Aa[0]+Ba[0])/2,(Aa[1]+Ba[1])/2];var Ha=Df([sa,ha],va,-x.angle);sa=ia(Re(R,R.width,R.height),4);var Va=sa[2]-sa[0],Ya=sa[3]-sa[1];sa=(Ba[0]-Aa[0])/Va;ha=(Ba[1]-Aa[1])/Ya;z.includes("e")&&(sa=(Ha[0]-Aa[0])/Va);z.includes("s")&&(ha=(Ha[1]-Aa[1])/Ya);z.includes("w")&&(sa=(Ba[0]-Ha[0])/Va);z.includes("n")&&(ha=(Ba[1]-Ha[1])/Ya);Ha=x.width;Va=x.height; sa*=R.width;ha*=R.height;if(na&&(sa=2*sa-Ha,ha=2*ha-Va),D){Ya=Math.abs(sa)/Ha;var ob=Math.abs(ha)/Va;if(1===z.length&&(ha*=Ya,sa*=ob),2===z.length)Ya=Math.max(Ya,ob),sa=Ha*Ya*Math.sign(sa),ha=Va*Ya*Math.sign(ha)}ob=ia(Re(x,sa,ha),4);Ha=ob[0];Va=ob[1];Ya=ob[2]-Ha;ob=ob[3]-Va;var Bb=[].concat(Aa);if(["n","w","nw"].includes(z)&&(Bb=[Ba[0]-Math.abs(Ya),Ba[1]-Math.abs(ob)]),"ne"===z)Bb=[Aa[0],Ba[1]],Bb=[Bb[0],Bb[1]-Math.abs(ob)];"sw"===z&&(Aa=[Ba[0],Aa[1]],Bb=[Aa[0]-Math.abs(Ya),Aa[1]]);D&&(["s","n"].includes(z)&& (Bb[0]=va[0]-Ya/2),["e","w"].includes(z)&&(Bb[1]=va[1]-ob/2));0>sa&&(z.includes("e")&&(Bb[0]-=Math.abs(Ya)),z.includes("w")&&(Bb[0]+=Math.abs(Ya)));0>ha&&(z.includes("s")&&(Bb[1]-=Math.abs(ob)),z.includes("n")&&(Bb[1]+=Math.abs(ob)));na&&(Bb[0]=va[0]-Math.abs(Ya)/2,Bb[1]=va[1]-Math.abs(ob)/2);D=x.angle;z=Df(Bb,va,D);va=Df([Bb[0]+Math.abs(Ya)/2,Bb[1]+Math.abs(ob)/2],va,D);Bb=Df(z,va,-D);va=ok(x,sa,ha);D=ja(Bb);D[0]+=x.x-Ha;D[1]+=x.y-Va;x=hd({width:Math.abs(sa),height:Math.abs(ha),x:D[0],y:D[1]},va); 0!==x.width&&0!==x.height&&Number.isFinite(x.x)&&Number.isFinite(x.y)&&(Ei(R,{newSize:{width:x.width,height:x.height}}),ke(R,x))},Hm=function(x,D,R,z){var na=ia(Bg(x),4),sa=na[0],ha=na[1],va=na[2],Aa=na[3];switch(D){case "se":var Ba=Math.max((R-sa)/(va-sa),(z-ha)/(Aa-ha));var Ha=function(Ya,ob,Bb){var Rb=ia(ob,2);ob=Rb[0];Rb=Rb[1];Bb=ia(Bb,2);return{x:Ya.x+(ob-sa)*(Ba-1)+ob-Bb[0],y:Ya.y+(Rb-ha)*(Ba-1)+Rb-Bb[1]}};break;case "nw":Ba=Math.max((va-R)/(va-sa),(Aa-z)/(Aa-ha));Ha=function(Ya,ob,Bb){var Rb= ia(ob,4);ob=Rb[2];Rb=Rb[3];Bb=ia(Bb,4);return{x:Ya.x-(va-ob)*(Ba-1)+ob-Bb[2],y:Ya.y-(Aa-Rb)*(Ba-1)+Rb-Bb[3]}};break;case "ne":Ba=Math.max((R-sa)/(va-sa),(Aa-z)/(Aa-ha));Ha=function(Ya,ob,Bb){var Rb=ia(ob,4);ob=Rb[0];Rb=Rb[3];Bb=ia(Bb,4);return{x:Ya.x+(ob-sa)*(Ba-1)+ob-Bb[0],y:Ya.y-(Aa-Rb)*(Ba-1)+Rb-Bb[3]}};break;case "sw":Ba=Math.max((va-R)/(va-sa),(z-ha)/(Aa-ha)),Ha=function(Ya,ob,Bb){var Rb=ia(ob,3);ob=Rb[1];Rb=Rb[2];Bb=ia(Bb,3);return{x:Ya.x-(va-Rb)*(Ba-1)+Rb-Bb[2],y:Ya.y+(ob-ha)*(Ba-1)+ob-Bb[1]}}}if(0< Ba){var Va=x.reduce(function(Ya,ob){if(!Ya)return Ya;var Bb=ob.width*Ba,Rb=ob.height*Ba,ic={};if("text"===ob.type){ic=fg(ob,Bb,Rb);if(null===ic)return null;ic={fontSize:ic.size,baseline:ic.baseline}}var mc=Vf(ob),Sc=ok(ob,Bb,Rb);Ei(ob,{newSize:{width:Bb,height:Rb},simultaneouslyUpdated:x});var Xc=Re(hd(hd({},ob),Sc),Bb,Rb);mc=Ha(ob,mc,Xc);ob=mc.x;mc=mc.y;return[].concat(ja(Ya),[hd(hd({width:Bb,height:Rb,x:ob,y:mc},Sc),ic)])},[]);Va&&x.forEach(function(Ya,ob){ke(Ya,Va[ob])})}},Ck=function(x,D,R,z, na,sa,ha){var va=5*Math.PI/2+Math.atan2(z-ha,R-sa);na&&(va+=yc.ay/2,va-=va%yc.ay);D.forEach(function(Aa,Ba){var Ha,Va,Ya=ia(Vf(Aa),4);Ba=(Ya[0]+Ya[2])/2;Ya=(Ya[1]+Ya[3])/2;var ob=null!==(Ha=null===(Va=x.originalElements.get(Aa.id))||void 0===Va?void 0:Va.angle)&&void 0!==Ha?Ha:Aa.angle;Ha=ia(Jf(Ba,Ya,sa,ha,va+ob-Aa.angle),2);ke(Aa,{x:Aa.x+(Ha[0]-Ba),y:Aa.y+(Ha[1]-Ya),angle:fe(va+ob)})})},Pk=function(x,D,R,z,na,sa,ha,va,Aa,Ba){Aa&&(D=mk(D,ha,sa(va=D.height)&&(va=-va));na=na< R?R-ha:R;sa=saha.width||Ba-Ha>ha.height})(D,0,[R,na,sa,z])&&(x=function(ha,va){if(!ha.length)return[0, 0,0,0];var Aa=1/0,Ba=ha[0];return ha.forEach(function(Ha){var Va=ia(gk(Ha),4);Va=Math.hypot(va.x-(Va[0]+Va[2])/2,va.y-(Va[1]+Va[3])/2);Vaha.points.length)return x= x.filter(function(va){return va.id!==ha.id}),{elements:x,appState:mb(mb({},Uo(D,x)),{},{editingLinearElement:null}),commitToHistory:!1};R={startBindingElement:0===z?null:na,endBindingElement:z===ha.points.length-1?null:sa};return dd.movePoint(ha,z,"delete"),{elements:x,appState:mb(mb({},D),{},{editingLinearElement:mb(mb(mb({},D.editingLinearElement),R),{},{activePointIndex:0Aa&&(Aa=ha.length+Aa);for(Aa=Math.min(ha.length-1,Math.max(Aa,0))+1;-1<--Aa;)if(va(ha[Aa],Aa,ha))return Aa;return-1}(D,sa,Math.max(0,R-1)):function(ha,va){var Aa=2Aa&&(Aa=ha.length+Aa);for(Aa=Math.min(ha.length,Math.max(Aa,0))-1;++AaYa&&(va.style.left="".concat(Ya-Ha,"px"));Aa=window.innerHeight;Ba+Va>Aa&&(va.style.top="".concat(Aa-Va,"px"))}},[sa]),(0,ue.useEffect)(function(){if(na){var va=function(Aa){var Ba;null!==(Ba=ha.current)&&void 0!==Ba&&Ba.contains(Aa.target)||(0,rh.unstable_batchedUpdates)(function(){return na(Aa)})};return document.addEventListener("pointerdown", va,!1),function(){return document.removeEventListener("pointerdown",va,!1)}}},[na]),(0,Sa.jsx)("div",{className:"popover",style:{top:z,left:R},ref:ha,children:D})}),gb=(e(4220),function(x){var D=(new Option).style;return D.color=x,!!D.color}),zb=[["1","2","3","4","5"],["q","w","e","r","t"],["a","s","d","f","g"]].flat(),Nb=function(x){var D=x.colors,R=x.color,z=x.onChange,na=x.onClose,sa=x.label,ha=x.showInput,va=void 0===ha||ha;x=x.type;var Aa=ce().useRef(),Ba=ce().useRef(),Ha=ce().useRef(),Va=ce().useRef(); ce().useEffect(function(){Ba.current?Ba.current.focus():Va.current?Va.current.focus():Ha.current&&Ha.current.focus()},[]);return(0,Sa.jsxs)("div",{className:"color-picker color-picker-type-".concat(x),role:"dialog","aria-modal":"true","aria-label":Wb("labels.colorPicker"),onKeyDown:function(Ya){if("Tab"===Ya.key){var ob,Bb=document.activeElement;if(Ya.shiftKey)Bb===Aa.current&&(null===(ob=Va.current)||void 0===ob||ob.focus(),Ya.preventDefault());else if(Bb===Va.current){var Rb;null===(Rb=Aa.current)|| void 0===Rb||Rb.focus();Ya.preventDefault()}}else oh(Ya.key)?(ob=Cg.rtl,Bb=Array.prototype.indexOf.call(Ha.current.children,document.activeElement),-1!==Bb&&(Rb=Ha.current.children.length-(va?1:0),Ha.current.children[Ya.key===(ob?"ArrowLeft":"ArrowRight")?(Bb+1)%Rb:Ya.key===(ob?"ArrowRight":"ArrowLeft")?(Rb+Bb-1)%Rb:"ArrowDown"===Ya.key?(Bb+5)%Rb:"ArrowUp"===Ya.key?(Rb+Bb-5)%Rb:Bb].focus()),Ya.preventDefault()):zb.includes(Ya.key.toLowerCase())&&!Dj(Ya.target)?(ob=zb.indexOf(Ya.key.toLowerCase()), Ha.current.children[ob].focus(),Ya.preventDefault()):"Escape"!==Ya.key&&"Enter"!==Ya.key||(Ya.preventDefault(),na());Ya.nativeEvent.stopImmediatePropagation();Ya.stopPropagation()},children:[(0,Sa.jsx)("div",{className:"color-picker-triangle color-picker-triangle-shadow"}),(0,Sa.jsx)("div",{className:"color-picker-triangle"}),(0,Sa.jsxs)("div",{className:"color-picker-content",ref:function(Ya){Ya&&(Ha.current=Ya)},tabIndex:0,children:[D.map(function(Ya,ob){var Bb=Ya.replace("#","");return(0,Sa.jsxs)("button", {className:"color-picker-swatch",onClick:function(Rb){Rb.currentTarget.focus();z(Ya)},title:"".concat(Wb("colors.".concat(Bb))).concat(Ri(Ya)?"":" (".concat(Ya,")")," — ").concat(zb[ob].toUpperCase()),"aria-label":Wb("colors.".concat(Bb)),"aria-keyshortcuts":zb[ob],style:{color:Ya},ref:function(Rb){Rb&&0===ob&&(Aa.current=Rb);Rb&&Ya===R&&(Ba.current=Rb)},onFocus:function(){z(Ya)},children:[Ri(Ya)?(0,Sa.jsx)("div",{className:"color-picker-transparent"}):void 0,(0,Sa.jsx)("span",{className:"color-picker-keybinding", children:zb[ob]})]},Ya)}),va&&(0,Sa.jsx)(sc,{color:R,label:sa,onChange:function(Ya){z(Ya)},ref:Va})]})]})},sc=ce().forwardRef(function(x,D){var R=x.color,z=x.onChange;x=x.label;var na=ia(ce().useState(R),2),sa=na[0],ha=na[1],va=ce().useRef(null);ce().useEffect(function(){ha(R)},[R]);ce().useImperativeHandle(D,function(){return va.current});var Aa=ce().useCallback(function(Ba){Ba=Ba.toLowerCase();var Ha;(Ha=Ri(Ba)||gb(Ba)?Ba:gb("#".concat(Ba))?"#".concat(Ba):null)&&z(Ha);ha(Ba)},[z]);return(0,Sa.jsxs)("label", {className:"color-input-container",children:[(0,Sa.jsx)("div",{className:"color-picker-hash",children:"#"}),(0,Sa.jsx)("input",{spellCheck:!1,className:"color-picker-input","aria-label":x,onChange:function(Ba){return Aa(Ba.target.value)},value:(sa||"").replace(/^#/,""),onBlur:function(){return ha(R)},ref:va})]})}),Fc=function(x){var D=x.type,R=x.color,z=x.onChange,na=x.label,sa=x.isActive,ha=x.setActive,va=ce().useRef(null);return(0,Sa.jsxs)("div",{children:[(0,Sa.jsxs)("div",{className:"color-picker-control-container", children:[(0,Sa.jsx)("button",{className:"color-picker-label-swatch","aria-label":na,style:R?{"--swatch-color":R}:void 0,onClick:function(){return ha(!sa)},ref:va}),(0,Sa.jsx)(sc,{color:R,label:na,onChange:function(Aa){z(Aa)}})]}),(0,Sa.jsx)(ce().Suspense,{fallback:"",children:sa?(0,Sa.jsx)(Fa,{onCloseRequest:function(Aa){return Aa.target!==va.current&&ha(!1)},children:(0,Sa.jsx)(Nb,{colors:ri[D],color:R||null,onChange:function(Aa){z(Aa)},onClose:function(){var Aa;ha(!1);null===(Aa=va.current)||void 0=== Aa||Aa.focus()},label:na,showInput:!1,type:D})}):null})]})};e(7117);var Oc=function(x,D,R){return x.map(function(z){var na;return D.selectedElementIds[z.id]||z.id===(null===(na=D.editingElement)||void 0===na?void 0:na.id)?R(z):z})},ad=function(x,D,R,z){var na,sa,ha=D.editingElement;x=oe(x);return null!==(na=null!==(sa=ha&&R(ha))&&void 0!==sa?sa:wh(x,D)?function(va,Aa,Ba){va=Array.from(new Set(Sf(va,Aa).map(function(Ha){return Ba(Ha)})));return 1===va.length?va[0]:null}(x,D,R):z)&&void 0!==na?na:null}, zd=(we({name:"changeStrokeColor",perform:function(x,D,R){return od(od({},R.currentItemStrokeColor&&{elements:Oc(x,D,function(z){return cf(z,{strokeColor:R.currentItemStrokeColor})})}),{},{appState:od(od({},D),R),commitToHistory:!!R.currentItemStrokeColor})},PanelComponent:function(x){var D=x.elements,R=x.appState,z=x.updateData;return(0,Sa.jsxs)(Sa.Fragment,{children:[(0,Sa.jsx)("h3",{"aria-hidden":"true",children:Wb("labels.stroke")}),(0,Sa.jsx)(Fc,{type:"elementStroke",label:Wb("labels.stroke"), color:ad(D,R,function(na){return na.strokeColor},R.currentItemStrokeColor),onChange:function(na){return z({currentItemStrokeColor:na})},isActive:"strokeColorPicker"===R.openPopup,setActive:function(na){return z({openPopup:na?"strokeColorPicker":null})}})]})}}),we({name:"changeBackgroundColor",perform:function(x,D,R){return od(od({},R.currentItemBackgroundColor&&{elements:Oc(x,D,function(z){return cf(z,{backgroundColor:R.currentItemBackgroundColor})})}),{},{appState:od(od({},D),R),commitToHistory:!!R.currentItemBackgroundColor})}, PanelComponent:function(x){var D=x.elements,R=x.appState,z=x.updateData;return(0,Sa.jsxs)(Sa.Fragment,{children:[(0,Sa.jsx)("h3",{"aria-hidden":"true",children:Wb("labels.background")}),(0,Sa.jsx)(Fc,{type:"elementBackground",label:Wb("labels.background"),color:ad(D,R,function(na){return na.backgroundColor},R.currentItemBackgroundColor),onChange:function(na){return z({currentItemBackgroundColor:na})},isActive:"backgroundColorPicker"===R.openPopup,setActive:function(na){return z({openPopup:na?"backgroundColorPicker": null})}})]})}}),we({name:"changeFillStyle",perform:function(x,D,R){return{elements:Oc(x,D,function(z){return cf(z,{fillStyle:R})}),appState:od(od({},D),{},{currentItemFillStyle:R}),commitToHistory:!0}},PanelComponent:function(x){var D=x.elements,R=x.appState,z=x.updateData;return(0,Sa.jsxs)("fieldset",{children:[(0,Sa.jsx)("legend",{children:Wb("labels.fill")}),(0,Sa.jsx)(la,{options:[{value:"hachure",text:Wb("labels.hachure"),icon:(0,Sa.jsx)(im,{theme:R.theme})},{value:"cross-hatch",text:Wb("labels.crossHatch"), icon:(0,Sa.jsx)(Qm,{theme:R.theme})},{value:"solid",text:Wb("labels.solid"),icon:(0,Sa.jsx)(Cm,{theme:R.theme})}],group:"fill",value:ad(D,R,function(na){return na.fillStyle},R.currentItemFillStyle),onChange:function(na){z(na)}})]})}}),we({name:"changeStrokeWidth",perform:function(x,D,R){return{elements:Oc(x,D,function(z){return cf(z,{strokeWidth:R})}),appState:od(od({},D),{},{currentItemStrokeWidth:R}),commitToHistory:!0}},PanelComponent:function(x){var D=x.elements,R=x.appState,z=x.updateData;return(0, Sa.jsxs)("fieldset",{children:[(0,Sa.jsx)("legend",{children:Wb("labels.strokeWidth")}),(0,Sa.jsx)(la,{group:"stroke-width",options:[{value:1,text:Wb("labels.thin"),icon:(0,Sa.jsx)(bo,{theme:R.theme,strokeWidth:2})},{value:2,text:Wb("labels.bold"),icon:(0,Sa.jsx)(bo,{theme:R.theme,strokeWidth:6})},{value:4,text:Wb("labels.extraBold"),icon:(0,Sa.jsx)(bo,{theme:R.theme,strokeWidth:10})}],value:ad(D,R,function(na){return na.strokeWidth},R.currentItemStrokeWidth),onChange:function(na){return z(na)}})]})}}), we({name:"changeSloppiness",perform:function(x,D,R){return{elements:Oc(x,D,function(z){return cf(z,{seed:yl(),roughness:R})}),appState:od(od({},D),{},{currentItemRoughness:R}),commitToHistory:!0}},PanelComponent:function(x){var D=x.elements,R=x.appState,z=x.updateData;return(0,Sa.jsxs)("fieldset",{children:[(0,Sa.jsx)("legend",{children:Wb("labels.sloppiness")}),(0,Sa.jsx)(la,{group:"sloppiness",options:[{value:0,text:Wb("labels.architect"),icon:(0,Sa.jsx)(Zo,{theme:R.theme})},{value:1,text:Wb("labels.artist"), icon:(0,Sa.jsx)(lo,{theme:R.theme})},{value:2,text:Wb("labels.cartoonist"),icon:(0,Sa.jsx)(jm,{theme:R.theme})}],value:ad(D,R,function(na){return na.roughness},R.currentItemRoughness),onChange:function(na){return z(na)}})]})}}),we({name:"changeStrokeStyle",perform:function(x,D,R){return{elements:Oc(x,D,function(z){return cf(z,{strokeStyle:R})}),appState:od(od({},D),{},{currentItemStrokeStyle:R}),commitToHistory:!0}},PanelComponent:function(x){var D=x.elements,R=x.appState,z=x.updateData;return(0, Sa.jsxs)("fieldset",{children:[(0,Sa.jsx)("legend",{children:Wb("labels.strokeStyle")}),(0,Sa.jsx)(la,{group:"strokeStyle",options:[{value:"solid",text:Wb("labels.strokeStyle_solid"),icon:(0,Sa.jsx)(Bn,{theme:R.theme})},{value:"dashed",text:Wb("labels.strokeStyle_dashed"),icon:(0,Sa.jsx)(co,{theme:R.theme})},{value:"dotted",text:Wb("labels.strokeStyle_dotted"),icon:(0,Sa.jsx)(Fj,{theme:R.theme})}],value:ad(D,R,function(na){return na.strokeStyle},R.currentItemStrokeStyle),onChange:function(na){return z(na)}})]})}}), we({name:"changeOpacity",perform:function(x,D,R){return{elements:Oc(x,D,function(z){return cf(z,{opacity:R})}),appState:od(od({},D),{},{currentItemOpacity:R}),commitToHistory:!0}},PanelComponent:function(x){var D,R=x.elements,z=x.appState,na=x.updateData;return(0,Sa.jsxs)("label",{className:"control-label",children:[Wb("labels.opacity"),(0,Sa.jsx)("input",{type:"range",min:"0",max:"100",step:"10",onChange:function(sa){return na(+sa.target.value)},onWheel:function(sa){sa.stopPropagation();var ha=+sa.target.value; 0>sa.deltaY&&100>ha?na(ha+10):0=Va?va+Ha-Va:0;Ba=sa+5;Object.assign(na.style,{top:"".concat(Ba-(Ba+ha>=window.innerHeight?sa-Aa+ha+10:0),"px"),left:"".concat(va-Ha,"px")})},onPointerLeave:function(){return re().classList.remove("excalidraw-tooltip--visible")},children:D})};we({name:"changeViewBackgroundColor", perform:function(x,D,R){return{appState:Rd(Rd({},D),R),commitToHistory:!!R.viewBackgroundColor}},PanelComponent:function(x){var D=x.appState,R=x.updateData;return(0,Sa.jsx)("div",{style:{position:"relative"},children:(0,Sa.jsx)(Fc,{label:Wb("labels.canvasBackground"),type:"canvasBackground",color:D.viewBackgroundColor,onChange:function(z){return R({viewBackgroundColor:z})},isActive:"canvasColorPicker"===D.openPopup,setActive:function(z){return R({openPopup:z?"canvasColorPicker":null})},"data-testid":"canvas-background-picker"})})}}); we({name:"clearCanvas",perform:function(x,D){return{elements:x.map(function(R){return cf(R,{isDeleted:!0})}),appState:Rd(Rd({},Ij()),{},{theme:D.theme,elementLocked:D.elementLocked,exportBackground:D.exportBackground,exportEmbedScene:D.exportEmbedScene,gridSize:D.gridSize,showStats:D.showStats,pasteDialog:D.pasteDialog}),commitToHistory:!0}},PanelComponent:function(x){var D=x.updateData;return(0,Sa.jsx)(Ga,{type:"button",icon:be,title:Wb("buttons.clearReset"),"aria-label":Wb("buttons.clearReset"), showAriaLabel:om(),onClick:function(){window.confirm(Wb("alerts.clearReset"))&&D(null)},"data-testid":"clear-canvas-button"})}});we({name:"zoomIn",perform:function(x,D){x=ea(ra(D.zoom.value+yc.V4),D.zoom,{left:D.offsetLeft,top:D.offsetTop},{x:D.width/2,y:D.height/2});return{appState:Rd(Rd({},D),{},{zoom:x}),commitToHistory:!1}},PanelComponent:function(x){var D=x.updateData;return(0,Sa.jsx)(Ga,{type:"button",icon:Ag,title:"".concat(Wb("buttons.zoomIn")," — ").concat(Vd("CtrlOrCmd++")),"aria-label":Wb("buttons.zoomIn"), onClick:function(){D(null)},size:"small"})},keyTest:function(x){return("Equal"===x.code||"NumpadAdd"===x.code)&&(x[Af]||x.shiftKey)}});we({name:"zoomOut",perform:function(x,D){x=ea(ra(D.zoom.value-yc.V4),D.zoom,{left:D.offsetLeft,top:D.offsetTop},{x:D.width/2,y:D.height/2});return{appState:Rd(Rd({},D),{},{zoom:x}),commitToHistory:!1}},PanelComponent:function(x){var D=x.updateData;return(0,Sa.jsx)(Ga,{type:"button",icon:Gg,title:"".concat(Wb("buttons.zoomOut")," — ").concat(Vd("CtrlOrCmd+-")),"aria-label":Wb("buttons.zoomOut"), onClick:function(){D(null)},size:"small"})},keyTest:function(x){return("Minus"===x.code||"NumpadSubtract"===x.code)&&(x[Af]||x.shiftKey)}});we({name:"resetZoom",perform:function(x,D){return{appState:Rd(Rd({},D),{},{zoom:ea(1,D.zoom,{left:D.offsetLeft,top:D.offsetTop},{x:D.width/2,y:D.height/2})}),commitToHistory:!1}},PanelComponent:function(x){var D=x.updateData;x=x.appState;return(0,Sa.jsx)(uf,{label:Wb("buttons.resetZoom"),children:(0,Sa.jsxs)(Ga,{type:"button",className:"reset-zoom-button",title:Wb("buttons.resetZoom"), "aria-label":Wb("buttons.resetZoom"),onClick:function(){D(null)},size:"small",children:[(100*x.zoom.value).toFixed(0),"%"]})})},keyTest:function(x){return("Digit0"===x.code||"Numpad0"===x.code)&&(x[Af]||x.shiftKey)}});var lf=function(x,D,R){x=oe(x);var z=Sf(x,D);R=R&&0Aa.points.length||Kj(Aa)?x.filter(function(Va){return Va.id!==Aa.id}):void 0,appState:Ia(Ia({},D),{},{editingLinearElement:null}),commitToHistory:!0}}window.document.activeElement instanceof HTMLElement&&z();if(z=D.multiElement?D.multiElement:"freedraw"===(null===(na=D.editingElement)||void 0===na?void 0:na.type)?D.editingElement:null){"freedraw"!==z.type&&"touch"!==D.lastPointerDownWith&&(na=z.points, (sa=z.lastCommittedPoint)&&na[na.length-1]===sa||ke(z,{points:z.points.slice(0,-1)}));Kj(z)&&(x=x.slice(0,-1));na=qj(z.points,D.zoom.value);if(("line"===z.type||"freedraw"===z.type)&&na){var Ba=z.points,Ha=Ba[0];ke(z,{points:Ba.map(function(Va,Ya){return Ya===Ba.length-1?[Ha[0],Ha[1]]:Va})})}Xg(z)&&!na&&1=kd&&qd.y>=He});(va.forEach(function(kd){try{lh(kd, na,Ya,Va,ha)}catch(qd){console.error(qd)}}),D.editingLinearElement)&&(Ha=dd.getElement(D.editingLinearElement.elementId))&&Hk(Ya,D,ha,Ha);if(R)try{lh(R,na,Ya,Va,ha)}catch(kd){console.error(kd)}if(D.isBindingEnabled&&D.suggestedBindings.filter(function(kd){return null!=kd}).forEach(function(kd){var qd=Array.isArray(kd)?zq:Mn;Ya.save();Ya.translate(ha.scrollX,ha.scrollY);qd(Ya,kd);Ya.restore()}),Ba&&!D.multiElement&&!D.editingLinearElement){var mc,Sc=x.reduce(function(kd,qd){var Hd=[];if(D.selectedElementIds[qd.id]&& null==dh(D,qd)&&Hd.push(mf.black),ha.remoteSelectedElementIds[qd.id]&&Hd.push.apply(Hd,ja(ha.remoteSelectedElementIds[qd.id].map(function(Tg){return Dm(Tg,D).background}))),Hd.length){var He=ia(Vf(qd),4);kd.push({angle:qd.angle,elementX1:He[0],elementY1:He[1],elementX2:He[2],elementY2:He[3],selectionColors:Hd})}return kd},[]);Ba=function(kd){kd=li(x,kd);kd=ia(Bg(kd),4);Sc.push({angle:0,elementX1:kd[0],elementX2:kd[2],elementY1:kd[1],elementY2:kd[3],selectionColors:[mf.black]})};Ha=cb(vi(D));try{for(Ha.s();!(mc= Ha.n()).done;)Ba(mc.value)}catch(kd){Ha.e(kd)}finally{Ha.f()}D.editingGroupId&&Ba(D.editingGroupId);Sc.forEach(function(kd){var qd=kd.angle,Hd=kd.elementX1,He=kd.elementY1,Tg=kd.selectionColors,ni=kd.elementX2-Hd;kd=kd.elementY2-He;var Bi=4/ha.zoom.value,pf=8/ha.zoom.value,ye=4/ha.zoom.value;Ya.save();Ya.translate(ha.scrollX,ha.scrollY);Ya.lineWidth=1/ha.zoom.value;for(var Mg=Tg.length,Wi=0;WiHa||Ha>ob-9||0>Rb||Rb>Bb-14;Ha=Math.max(Ha,0);Ha=Math.min(Ha,ob-9);Rb=Math.max(Rb,0);Rb=Math.min(Rb,Bb-14);Ba=Dm(Bd,D);mc=Ba.background;Ba=Ba.stroke;Ya.save();Ya.strokeStyle=Ba;Ya.fillStyle=mc;Pc=ha.remotePointerUserStates[Bd]; (Xc||Pc===yi.AWAY)&&(Ya.globalAlpha=.48);ha.remotePointerButton&&"down"===ha.remotePointerButton[Bd]&&(Ya.beginPath(),Ya.arc(Ha,Rb,15,0,2*Math.PI,!1),Ya.lineWidth=3,Ya.strokeStyle="#ffffff88",Ya.stroke(),Ya.closePath(),Ya.beginPath(),Ya.arc(Ha,Rb,15,0,2*Math.PI,!1),Ya.lineWidth=1,Ya.strokeStyle=Ba,Ya.stroke(),Ya.closePath());Ya.beginPath();Ya.moveTo(Ha,Rb);Ya.lineTo(Ha+1,Rb+14);Ya.lineTo(Ha+4,Rb+9);Ya.lineTo(Ha+9,Rb+10);Ya.lineTo(Ha,Rb);Ya.fill();Ya.stroke();Yc=ha.remotePointerUsernames[Bd];var Xd= "";Pc===yi.AWAY?Xd=Ln?"⚫️":" (".concat(yi.AWAY,")"):Pc===yi.IDLE?Xd=Ln?"\ud83d\udca4":" (".concat(yi.IDLE,")"):Pc===yi.ACTIVE&&(Xd=Ln?"\ud83d\udfe2":"");Pc="".concat(Yc?"".concat(Yc," "):"").concat(Xd);!Xc&&Pc&&(Ha+=9,Rb+=14,Xc=Ya.measureText(Pc),Yc=Xc.actualBoundingBoxDescent+Xc.actualBoundingBoxAscent,Ya.fillStyle=Ba,Ya.fillRect(Ha-1,Rb-1,Xc.width+8+2,Yc+8+2),Ya.fillStyle=mc,Ya.fillRect(Ha,Rb,Xc.width+8,Yc+8),Ya.fillStyle=mf.white,Ya.fillText(Pc,Ha+4,Rb+4+Xc.actualBoundingBoxAscent));Ya.restore(); Ya.closePath()}return Aa&&(ic=sh(x,ob,Bb,ha),Ya.save(),Ya.fillStyle="rgba(0,0,0,0.3)",Ya.strokeStyle="rgba(255,255,255,0.8)",[ic.horizontal,ic.vertical].forEach(function(kd){if(kd){var qd=kd.x,Hd=kd.y,He=kd.width;kd=kd.height;Ya.beginPath();Ya.moveTo(qd+3,Hd);Ya.lineTo(qd+He-3,Hd);Ya.quadraticCurveTo(qd+He,Hd,qd+He,Hd+3);Ya.lineTo(qd+He,Hd+kd-3);Ya.quadraticCurveTo(qd+He,Hd+kd,qd+He-3,Hd+kd);Ya.lineTo(qd+3,Hd+kd);Ya.quadraticCurveTo(qd,Hd+kd,qd,Hd+kd-3);Ya.lineTo(qd,Hd+3);Ya.quadraticCurveTo(qd,Hd, qd+3,Hd);Ya.closePath();Ya.fill();Ya.stroke()}}),Ya.restore()),Ya.restore(),{atLeastOneVisibleElement:0{if("undefined"==typeof self)return!1;if("top"in self&&self!==top)try{top.location}catch{}else if("showOpenFilePicker"in self)return"showOpenFilePicker";return!1})();const ho=nm?e.e(736).then(e.bind(e,6629)):e.e(736).then(e.bind(e,3112));nm?e.e(736).then(e.bind(e,5756)):e.e(736).then(e.bind(e,8396));const To=nm?e.e(736).then(e.bind(e,4868)):e.e(736).then(e.bind(e,6882));var mn=function(x){function D(){var z, na=0x.points.length?[[0,0],[x.width,x.height]]:x.points;if(0!==sa[0][0]||0!==sa[0][1])na=dd.getNormalizedPoints(x),sa=na.points,z=na.x,na=na.y;return In(x,{type:"draw"===x.type?"line":x.type,startBinding:x.startBinding,endBinding:x.endBinding,lastCommittedPoint:null,startArrowhead:D,endArrowhead:R,points:sa,x:z,y:na});case "ellipse":case "rectangle":case "diamond":return In(x,{})}},sl=function(x, D){var R=D?al(D):null;return(x||[]).reduce(function(z,na){if("selection"!==na.type&&!Kj(na)){var sa=wq(na);sa&&((na=null==R?void 0:R[na.id])&&na.version>sa.version&&(sa=vg(sa,na.version)),z.push(sa))}return z},[])},Um=function(x,D){x=x||{};var R,z=Ij(),na={},sa=Nc(Object.entries(z));try{for(sa.s();!(R=sa.n()).done;){var ha=ia(R.value,2),va=ha[0],Aa=ha[1],Ba=x[va],Ha=D?D[va]:void 0;na[va]=void 0!==Ba?Ba:void 0!==Ha?Ha:Aa}}catch(Va){sa.e(Va)}finally{sa.f()}return Ud(Ud({},na),{},{elementType:Fe[na.elementType]? na.elementType:"selection",zoom:"number"==typeof x.zoom?{value:x.zoom,translation:z.zoom.translation}:x.zoom||z.zoom})},Tm=function(x,D,R){return{elements:sl(null==x?void 0:x.elements,R),appState:Um(null==x?void 0:x.appState,D||null)}},ko=function(){var x=(0,ff.Z)(Yd().mark(function z(R){var na;return Yd().wrap(function(sa){for(;;)switch(sa.prev=sa.next){case 0:if("image/png"!==R.type){sa.next=18;break}return sa.prev=1,sa.next=4,Promise.all([e.e(736),e.e(9)]).then(e.bind(e,8527));case 4:return sa.next= 6,sa.sent.decodePngMetadata(R);case 6:return sa.abrupt("return",sa.sent);case 9:if(sa.prev=9,sa.t0=sa.catch(1),"INVALID"!==sa.t0.message){sa.next=15;break}throw Error(Wb("alerts.imageDoesNotContainScene"));case 15:throw Error(Wb("alerts.cannotRestoreFromImage"));case 16:sa.next=43;break;case 18:if(!("text"in Blob)){sa.next=24;break}return sa.next=21,R.text();case 21:na=sa.sent;sa.next=27;break;case 24:return sa.next=26,new Promise(function(ha){var va=new FileReader;va.readAsText(R,"utf8");va.onloadend= function(){va.readyState===FileReader.DONE&&ha(va.result)}});case 26:na=sa.sent;case 27:if("image/svg+xml"!==R.type){sa.next=43;break}return sa.prev=28,sa.next=31,Promise.all([e.e(736),e.e(9)]).then(e.bind(e,8527));case 31:return sa.next=33,sa.sent.decodeSvgMetadata({svg:na});case 33:return sa.abrupt("return",sa.sent);case 36:if(sa.prev=36,sa.t1=sa.catch(28),"INVALID"!==sa.t1.message){sa.next=42;break}throw Error(Wb("alerts.imageDoesNotContainScene"));case 42:throw Error(Wb("alerts.cannotRestoreFromImage")); case 43:return sa.abrupt("return",na);case 44:case "end":return sa.stop()}},z,null,[[1,9],[28,36]])}));return function(R){return x.apply(this,arguments)}}(),Fp=function(x){var D;return x&&(null===(D=x.name.match(/\.(json|excalidraw|png|svg)$/))||void 0===D?void 0:D[1])||null},Yo=function(x){x=Fp(x);return"png"===x||"svg"===x},vl=function(){var x=(0,ff.Z)(Yd().mark(function sa(R,z,na){var ha,va,Aa;return Yd().wrap(function(Ba){for(;;)switch(Ba.prev=Ba.next){case 0:return Ba.next=2,ko(R);case 2:ha= Ba.sent;Ba.prev=3;var Ha=va=JSON.parse(ha);if((null==Ha?void 0:Ha.type)===yc.r8.excalidraw&&(!Ha.elements||Array.isArray(Ha.elements)&&(!Ha.appState||"object"===G(Ha.appState)))){Ba.next=7;break}throw Error(Wb("alerts.couldNotLoadInvalidFile"));case 7:return Aa=Tm({elements:Ml(va.elements||[]),appState:ge(ge({theme:null==z?void 0:z.theme,fileHandle:R.handle||null},fk(va.appState||{},"export")),z?Fg(va.elements||[],z):{})},z,na),Ba.abrupt("return",Aa);case 11:throw Ba.prev=11,Ba.t0=Ba.catch(3),console.error(Ba.t0.message), Error(Wb("alerts.couldNotLoadInvalidFile"));case 15:case "end":return Ba.stop()}},sa,null,[[3,11]])}));return function(R,z,na){return x.apply(this,arguments)}}(),jo=function(){var x=(0,ff.Z)(Yd().mark(function z(R){var na,sa;return Yd().wrap(function(ha){for(;;)switch(ha.prev=ha.next){case 0:return ha.next=2,ko(R);case 2:if(na=ha.sent,(sa=JSON.parse(na)).type===yc.r8.excalidrawLibrary){ha.next=6;break}throw Error(Wb("alerts.couldNotLoadInvalidFile"));case 6:return ha.abrupt("return",sa);case 7:case "end":return ha.stop()}}, z)}));return function(R){return x.apply(this,arguments)}}(),Dp=function(){var x=(0,ff.Z)(Yd().mark(function z(R){return Yd().wrap(function(na){for(;;)switch(na.prev=na.next){case 0:return na.abrupt("return",new Promise(function(sa,ha){try{R.toBlob(function(va){if(!va)return ha(new mn(Wb("canvasError.canvasTooBig"),"CANVAS_POSSIBLY_TOO_BIG"));sa(va)})}catch(va){ha(va)}}));case 1:case "end":return na.stop()}},z)}));return function(R){return x.apply(this,arguments)}}(),Jn=function(x,D){x={type:yc.r8.excalidraw, version:2,source:yc.pb,elements:Ml(x),appState:fk(D,"export")};return JSON.stringify(x,null,2)},Em=function(){var x=(0,ff.Z)(Yd().mark(function na(R,z){var sa,ha,va;return Yd().wrap(function(Aa){for(;;)switch(Aa.prev=Aa.next){case 0:return sa=Jn(R,z),ha=new Blob([sa],{type:yc.LO.excalidraw}),Aa.next=4,go(ha,{name:z.name,extension:"excalidraw",description:"Excalidraw file",fileHandle:Yo(z.fileHandle)?null:z.fileHandle});case 4:return va=Aa.sent,Aa.abrupt("return",{fileHandle:va});case 6:case "end":return Aa.stop()}}, na)}));return function(R,z){return x.apply(this,arguments)}}(),Cp=function(){var x=(0,ff.Z)(Yd().mark(function na(R,z){var sa;return Yd().wrap(function(ha){for(;;)switch(ha.prev=ha.next){case 0:return ha.next=2,Bp({description:"Excalidraw files"});case 2:return sa=ha.sent,ha.abrupt("return",vl(sa,R,z));case 4:case "end":return ha.stop()}},na)}));return function(R,z){return x.apply(this,arguments)}}(),Xo=function(){var x=(0,ff.Z)(Yd().mark(function z(R){var na,sa,ha;return Yd().wrap(function(va){for(;;)switch(va.prev= va.next){case 0:return va.next=2,R.loadLibrary();case 2:return na=va.sent,sa={type:yc.r8.excalidrawLibrary,version:1,source:yc.pb,library:na},ha=JSON.stringify(sa,null,2),va.next=7,go(new Blob([ha],{type:yc.LO.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"});case 7:case "end":return va.stop()}},z)}));return function(R){return x.apply(this,arguments)}}(),Ep=function(){var x=(0,ff.Z)(Yd().mark(function z(R){var na;return Yd().wrap(function(sa){for(;;)switch(sa.prev= sa.next){case 0:return sa.next=2,Bp({description:"Excalidraw library files"});case 2:return na=sa.sent,sa.next=5,R.importLibrary(na);case 5:case "end":return sa.stop()}},z)}));return function(R){return x.apply(this,arguments)}}(),Aq=function(x,D,R){var z=R.exportBackground,na=R.exportPadding;na=void 0===na?yc.qy:na;var sa=R.viewBackgroundColor,ha=3R.length?{type:"NOT_SPREADSHEET",reason:"Less than two rows"}:{type:"VALID_SPREADSHEET",spreadsheet:{title:D?x[0][0]: null,labels:null,values:R}}}var z=vq(x,0)?0:1;if(!vq(x,z))return{type:"NOT_SPREADSHEET",reason:"Value is not numeric"};var na=(z+1)%2;R=(D=null===So(x[0][z]))?x.slice(1):x;return 2>R.length?{type:"NOT_SPREADSHEET",reason:"Less than 2 rows"}:{type:"VALID_SPREADSHEET",spreadsheet:{title:D?x[0][z]:null,labels:R.map(function(sa){return sa[na]}),values:R.map(function(sa){return So(sa[z])})}}},pn=ri.elementBackground.slice(2,ri.elementBackground.length),Yl={fillStyle:"hachure",fontFamily:yc.rk,fontSize:yc.n5, opacity:100,roughness:1,strokeColor:ri.elementStroke[0],strokeSharpness:"sharp",strokeStyle:"solid",strokeWidth:1,verticalAlign:"middle"},$o=function(x){return{chartWidth:44*x.values.length+12,chartHeight:280}},H=function(x,D,R,z,na,sa){var ha=$o(x),va=ha.chartWidth,Aa=ha.chartHeight;ha=x.title?Eg(fa(fa({backgroundColor:na,groupIds:[z]},Yl),{},{text:x.title,x:D+va/2,y:R-256-24-yc.n5,strokeSharpness:"sharp",strokeStyle:"solid",textAlign:"center"})):null;sa=sa?xf(fa(fa({backgroundColor:na,groupIds:[z]}, Yl),{},{type:"rectangle",x:D,y:R-Aa,width:va,height:Aa,strokeColor:ri.elementStroke[0],fillStyle:"solid",opacity:6})):null;return[].concat(ja(sa?[sa]:[]),ja(ha?[ha]:[]),ja(function(Ba,Ha,Va,Ya,ob){var Bb;return(null===(Bb=Ba.labels)||void 0===Bb?void 0:Bb.map(function(Rb,ic){return Eg(fa(fa({groupIds:[Ya],backgroundColor:ob},Yl),{},{text:8sa.length)return{appState:na,elements:z,commitToHistory:!1};var ha=vi(na);if(1===ha.length&&(ha=new Set(li(z,ha[0]).map(function(Ba){return Ba.id})), sa=new Set(sa.map(function(Ba){return Ba.id})),(new Set([].concat(ja(Array.from(ha)),ja(Array.from(sa))))).size===ha.size))return{appState:na,elements:z,commitToHistory:!1};var va=dk();ha=z.map(function(Ba){if(na.selectedElementIds[Ba.id]){var Ha=na.editingGroupId;var Va=ja(Ba.groupIds);Ha=Ha?Va.indexOf(Ha):-1;Va=(Va.splice(-1Aa.length?Aa[0].substring(0,2).toUpperCase():(Aa[0][0]+Aa[Aa.length-1][0]).toUpperCase()}(ha.username);return(0,Sa.jsx)(Bv,{color:na,border:z,onClick:function(){return sa(ha.pointer)},children:va})}});var Cv=we({name:"addToLibrary",perform:function(z,na,sa,ha){var va=Sf(oe(z),na);return ha.library.loadLibrary().then(function(Aa){ha.library.saveLibrary([].concat(ja(Aa), [va.map(Wf)]))}),!1},contextItemLabel:"labels.addToLibrary"}),zv=function(z){var na=new Map;return z.forEach(function(sa){var ha=0===sa.groupIds.length?sa.id:sa.groupIds[sa.groupIds.length-1],va=na.get(ha)||[];na.set(ha,[].concat(ja(va),[sa]))}),Array.from(na.values())},Av=function(z,na,sa){var ha=sa.axis;sa=sa.position;z=At(z);var va=ia("x"===ha?["minX","maxX"]:["minY","maxY"],2),Aa=va[0];va=va[1];return Vh(Vh({},{x:0,y:0}),{},da({},ha,"start"===sa?na[Aa]-z[Aa]:"end"===sa?na[va]-z[va]:(na[Aa]+na[va])/ 2-(z[Aa]+z[va])/2))},At=function(z){z=ia(Bg(z),4);return{minX:z[0],minY:z[1],maxX:z[2],maxY:z[3]}},Np=function(z,na){return 1mc){var Sc=va.findIndex(function(Xd){return Xd[1][Va]===Rb[Va]}),Xc=va.findIndex(function(Xd){return Xd[1][ob]===Rb[ob]}),Pc=(va[Xc][1][Ya]-va[Sc][1][Ya])/(va.length-1),Yc=va[Sc][1][Ya];return va.flatMap(function(Xd,kd){var qd=ia(Xd,2);Xd=qd[0];qd=qd[1]; var Hd={x:0,y:0};return kd!==Sc&&kd!==Xc&&(Yc+=Pc,Hd[Aa.axis]=Yc-qd[Ya]),Xd.map(function(He){return cf(He,{x:He.x+Hd.x,y:He.y+Hd.y})})})}var Bd=Rb[Va];return va.flatMap(function(Xd){var kd=ia(Xd,2);Xd=kd[0];kd=kd[1];var qd={x:0,y:0};return qd[Aa.axis]=Bd-kd[Va],Bd+=mc,Bd+=kd[Bb],Xd.map(function(Hd){return cf(Hd,{x:Hd.x+qd.x,y:Hd.y+qd.y})})})}(Sf(oe(z),na),sa);var ha=al(na);return z.map(function(va){return ha[va.id]||va})},Kt=(we({name:"distributeHorizontally",perform:function(z,na){return{appState:na, elements:Jt(z,na,{space:"between",axis:"x"}),commitToHistory:!0}},keyTest:function(z){return z.altKey&&"KeyH"===z.code},PanelComponent:function(z){var na=z.elements,sa=z.appState,ha=z.updateData;return(0,Sa.jsx)(Ga,{hidden:!It(na,sa),type:"button",icon:(0,Sa.jsx)(Cf,{theme:sa.theme}),onClick:function(){return ha(null)},title:"".concat(Wb("labels.distributeHorizontally")," — ").concat(Vd("Alt+H")),"aria-label":Wb("labels.distributeHorizontally"),visible:wh(oe(na),sa)})}}),we({name:"distributeVertically", perform:function(z,na){return{appState:na,elements:Jt(z,na,{space:"between",axis:"y"}),commitToHistory:!0}},keyTest:function(z){return z.altKey&&"KeyV"===z.code},PanelComponent:function(z){var na=z.elements,sa=z.appState,ha=z.updateData;return(0,Sa.jsx)(Ga,{hidden:!It(na,sa),type:"button",icon:(0,Sa.jsx)(Nn,{theme:sa.theme}),onClick:function(){return ha(null)},title:"".concat(Wb("labels.distributeVertically")," — ").concat(Vd("Alt+V")),"aria-label":Wb("labels.distributeVertically"),visible:wh(oe(na), sa)})}}),we({name:"flipHorizontal",perform:function(z,na){return{elements:Mt(z,na,"horizontal"),appState:na,commitToHistory:!0}},keyTest:function(z){return z.shiftKey&&"KeyH"===z.code},contextItemLabel:"labels.flipHorizontal",contextItemPredicate:function(z,na){z=Sf(oe(z),na);return 1===z.length&&"text"!==z[0].type}})),Lt=we({name:"flipVertical",perform:function(z,na){return{elements:Mt(z,na,"vertical"),appState:na,commitToHistory:!0}},keyTest:function(z){return z.shiftKey&&"KeyV"===z.code},contextItemLabel:"labels.flipVertical", contextItemPredicate:function(z,na){return 1===Sf(oe(z),na).length}}),Mt=function(z,na,sa){var ha=Sf(oe(z),na);if(1Ha&&(Ha=fe(2*Math.PI+Ha));ke(va,{angle:Ha});ke(va,{x:Aa,y:Ba})}return z},Fv=function(z,na){var sa=z.x,ha=z.y,va=z.width,Aa=z.height,Ba=fe(z.angle), Ha=0;(Dg(z)||ki(z))&&(Ha=2*z.points.reduce(function(Bb,Rb){return Math.max(Bb,Rb[0])},0)-z.width);ke(z,{angle:fe(0)});na=Tk(z,na.zoom);var Va=!0,Ya=0,ob=na.nw;if(ob||(Va=!1,ob=na.ne)){if(Dg(z)){for(va=1;vaBa&&(Ba=fe(Ba+2*Math.PI));ke(z,{angle:Ba});ke(z,{x:sa+Ha,y:ha});Ei(z)}else ke(z,{angle:Ba})}, ts=we({name:"copy",perform:function(z,na){return fc(oe(z),na),{commitToHistory:!1}},contextItemLabel:"labels.copy",keyTest:void 0}),Gv=we({name:"cut",perform:function(z,na,sa,ha){return ts.perform(z,na,sa,ha),hn.perform(z,na,sa,ha)},contextItemLabel:"labels.cut",keyTest:function(z){return z[Af]&&"KeyX"===z.code}}),Nt=we({name:"copyAsSvg",perform:function(){var z=(0,ff.Z)(Yd().mark(function Ba(sa,ha,va,Aa){var Ha;return Yd().wrap(function(Va){for(;;)switch(Va.prev=Va.next){case 0:if(Aa.canvas){Va.next= 2;break}return Va.abrupt("return",{commitToHistory:!1});case 2:return Ha=Sf(oe(sa),ha),Va.prev=3,Va.next=6,vf("clipboard-svg",Ha.length?Ha:oe(sa),ha,ha);case 6:return Va.abrupt("return",{commitToHistory:!1});case 9:return Va.prev=9,Va.t0=Va.catch(3),console.error(Va.t0),Va.abrupt("return",{appState:Id(Id({},ha),{},{errorMessage:Va.t0.message}),commitToHistory:!1});case 13:case "end":return Va.stop()}},Ba,null,[[3,9]])}));return function(sa,ha,va,Aa){return z.apply(this,arguments)}}(),contextItemLabel:"labels.copyAsSvg"}), Ot=we({name:"copyAsPng",perform:function(){var z=(0,ff.Z)(Yd().mark(function Ba(sa,ha,va,Aa){var Ha;return Yd().wrap(function(Va){for(;;)switch(Va.prev=Va.next){case 0:if(Aa.canvas){Va.next=2;break}return Va.abrupt("return",{commitToHistory:!1});case 2:return Ha=Sf(oe(sa),ha),Va.prev=3,Va.next=6,vf("clipboard",Ha.length?Ha:oe(sa),ha,ha);case 6:return Va.abrupt("return",{appState:Id(Id({},ha),{},{toastMessage:Wb("toast.copyToClipboardAsPng",{exportSelection:Ha.length?Wb("toast.selection"):Wb("toast.canvas"), exportColorScheme:ha.exportWithDarkMode?Wb("buttons.darkMode"):Wb("buttons.lightMode")})}),commitToHistory:!1});case 9:return Va.prev=9,Va.t0=Va.catch(3),console.error(Va.t0),Va.abrupt("return",{appState:Id(Id({},ha),{},{errorMessage:Va.t0.message}),commitToHistory:!1});case 13:case "end":return Va.stop()}},Ba,null,[[3,9]])}));return function(sa,ha,va,Aa){return z.apply(this,arguments)}}(),contextItemLabel:"labels.copyAsPng",keyTest:function(z){return"KeyC"===z.code&&z.altKey&&z.shiftKey}}),Pt=we({name:"gridMode", perform:function(z,na){return Lh("view","mode","grid"),{appState:oi(oi({},na),{},{gridSize:this.checked(na)?null:yc.k}),commitToHistory:!1}},checked:function(z){return null!==z.gridSize},contextItemLabel:"labels.showGrid",keyTest:function(z){return z[Af]&&"Quote"===z.code}}),ss=we({name:"zenMode",perform:function(z,na){return Lh("view","mode","zen"),{appState:Ni(Ni({},na),{},{zenModeEnabled:!this.checked(na)}),commitToHistory:!1}},checked:function(z){return z.zenModeEnabled},contextItemLabel:"buttons.zenMode", keyTest:function(z){return!z[Af]&&z.altKey&&"KeyZ"===z.code}}),rs=we({name:"stats",perform:function(z,na){return{appState:Dk(Dk({},na),{},{showStats:!this.checked(na)}),commitToHistory:!1}},checked:function(z){return z.showStats},contextItemLabel:"stats.title",keyTest:function(z){return!z[Af]&&z.altKey&&"Slash"===z.code}}),vt=function(z,na,sa){if(!(na.multiElement||na.resizingElement||na.editingElement||na.draggingElement)){sa=sa();if(null===sa)return{commitToHistory:!1};var ha=al(z),va=sa.elements, Aa=al(va);z=z.filter(function(Ba){return!Aa.hasOwnProperty(Ba.id)});va=va.map(function(Ba){return cf(ha[Ba.id]||Ba,Ba)}).concat(z.map(function(Ba){return cf(Ba,{isDeleted:!0})}));return Ll(va,z),{elements:va,appState:yh(yh({},na),sa.appState),commitToHistory:!1,syncHistory:!0}}return{commitToHistory:!1}},uv=function(){function z(na,sa,ha,va){var Aa=this;q(this,z);this.actions={};this.renderAction=function(Ba,Ha){var Va=Aa.app.props.UIOptions.canvasActions;if(Aa.actions[Ba]&&"PanelComponent"in Aa.actions[Ba]&& (!(Ba in Va)||Va[Ba])){var Ya=Aa.actions[Ba];Ba=Ya.PanelComponent;return(0,Sa.jsx)(Ba,{elements:Aa.getElementsIncludingDeleted(),appState:Aa.getAppState(),updateData:function(ob){Aa.updater(Ya.perform(Aa.getElementsIncludingDeleted(),Aa.getAppState(),ob,Aa.app))},appProps:Aa.app.props,data:Ha})}return null};this.updater=function(Ba){if(!(Ba&&"then"in Ba))return na(Ba);Ba.then(function(Ha){return na(Ha)})};this.getAppState=sa;this.getElementsIncludingDeleted=ha;this.app=va}return y(z,[{key:"registerAction", value:function(na){this.actions[na.name]=na}},{key:"registerAll",value:function(na){var sa=this;na.forEach(function(ha){return sa.registerAction(ha)})}},{key:"handleKeyDown",value:function(na){var sa=this,ha=this.app.props.UIOptions.canvasActions,va=Object.values(this.actions).sort(function(Aa,Ba){return(Ba.keyPriority||0)-(Aa.keyPriority||0)}).filter(function(Aa){return(!(Aa.name in ha)||ha[Aa.name])&&Aa.keyTest&&Aa.keyTest(na,sa.getAppState(),sa.getElementsIncludingDeleted())});return 0!==va.length&& !(this.getAppState().viewModeEnabled&&!Object.values(yc.EH).includes(va[0].name))&&(na.preventDefault(),this.updater(va[0].perform(this.getElementsIncludingDeleted(),this.getAppState(),null,this.app)),!0)}},{key:"executeAction",value:function(na){this.updater(na.perform(this.getElementsIncludingDeleted(),this.getAppState(),null,this.app))}}]),z}(),yv=function(){function z(sa){var ha=this;q(this,z);this.libraryCache=null;this.resetLibrary=(0,ff.Z)(Yd().mark(function Aa(){var Ba,Ha;return Yd().wrap(function(Va){for(;;)switch(Va.prev= Va.next){case 0:return Va.next=2,null===(Ba=(Ha=ha.app.props).onLibraryChange)||void 0===Ba?void 0:Ba.call(Ha,[]);case 2:ha.libraryCache=[];case 3:case "end":return Va.stop()}},Aa)}));this.restoreLibraryItem=function(Aa){Aa=oe(sl(Aa,null));return Aa.length?Aa:null};this.loadLibrary=function(){return new Promise(function(){var Aa=(0,ff.Z)(Yd().mark(function Va(Ha){var Ya,ob;return Yd().wrap(function(Bb){for(;;)switch(Bb.prev=Bb.next){case 0:if(!ha.libraryCache){Bb.next=2;break}return Bb.abrupt("return", Ha(JSON.parse(JSON.stringify(ha.libraryCache))));case 2:if(Bb.prev=2,Ya=ha.app.libraryItemsFromStorage){Bb.next=6;break}return Bb.abrupt("return",Ha([]));case 6:ob=Ya.reduce(function(Rb,ic){return ha.restoreLibraryItem(ic)&&Rb.push(ic),Rb},[]);ha.libraryCache=JSON.parse(JSON.stringify(ob));Ha(ob);Bb.next=15;break;case 11:Bb.prev=11,Bb.t0=Bb.catch(2),console.error(Bb.t0),Ha([]);case 15:case "end":return Bb.stop()}},Va,null,[[2,11]])}));return function(Ha){return Aa.apply(this,arguments)}}())};this.saveLibrary= function(){var Aa=(0,ff.Z)(Yd().mark(function Va(Ha){var Ya,ob,Bb,Rb;return Yd().wrap(function(ic){for(;;)switch(ic.prev=ic.next){case 0:return Ya=ha.libraryCache,ic.prev=1,Rb=JSON.stringify(Ha),ha.libraryCache=JSON.parse(Rb),ic.next=6,null===(ob=(Bb=ha.app.props).onLibraryChange)||void 0===ob?void 0:ob.call(Bb,Ha);case 6:ic.next=12;break;case 8:throw ic.prev=8,ic.t0=ic.catch(1),ha.libraryCache=Ya,ic.t0;case 12:case "end":return ic.stop()}},Va,null,[[1,8]])}));return function(Ha){return Aa.apply(this, arguments)}}();this.app=sa}var na;return y(z,[{key:"importLibrary",value:(na=(0,ff.Z)(Yd().mark(function va(ha){var Aa,Ba,Ha,Va,Ya=this;return Yd().wrap(function(ob){for(;;)switch(ob.prev=ob.next){case 0:return ob.next=2,jo(ha);case 2:if((Aa=ob.sent)&&Aa.library){ob.next=5;break}return ob.abrupt("return");case 5:return Ba=function(Bb,Rb){return!Bb.find(function(ic){return ic.length===Rb.length&&ic.every(function(mc,Sc){return mc.id===Rb[Sc].id&&mc.versionNonce===Rb[Sc].versionNonce})})},ob.next=8, this.loadLibrary();case 8:return Ha=ob.sent,Va=Aa.library.reduce(function(Bb,Rb){Rb=Ya.restoreLibraryItem(Rb);return Rb&&Ba(Ha,Rb)&&Bb.push(Rb),Bb},[]),ob.next=12,this.saveLibrary([].concat(ja(Ha),ja(Va)));case 12:case "end":return ob.stop()}},va,this)})),function(ha){return na.apply(this,arguments)})}]),z}(),yt=function(z){z=Array.from(z.values());return{x:Ft(z,function(na){return na.x})/z.length,y:Ft(z,function(na){return na.y})/z.length}},zt=function(z){var na=ia(z,2);z=na[0];na=na[1];return Math.hypot(z.x- na.x,z.y-na.y)},Ft=function(z,na){return z.reduce(function(sa,ha){return sa+na(ha)},0)},vv=function(){function z(){var na=this;q(this,z);this.elementCache=new Map;this.recording=!0;this.stateHistory=[];this.redoStack=[];this.lastEntry=null;this.generateEntry=function(sa,ha){return na.dehydrateHistoryEntry({appState:{selectedElementIds:sa.selectedElementIds,selectedGroupIds:sa.selectedGroupIds,viewBackgroundColor:sa.viewBackgroundColor,editingLinearElement:sa.editingLinearElement,editingGroupId:sa.editingGroupId, name:sa.name},elements:ha.reduce(function(va,Aa){if(Dg(Aa)&&sa.multiElement&&sa.multiElement.id===Aa.id){if(sa.multiElement&&sa.multiElement.id===Aa.id&&2>Aa.points.length)return va;va.push(Ol(Ol({},Aa),{},{points:Aa.lastCommittedPoint!==Aa.points[Aa.points.length-1]?Aa.points.slice(0,-1):Aa.points}))}else va.push(Aa);return va},[])})}}return y(z,[{key:"hydrateHistoryEntry",value:function(na){var sa=this,ha=na.elements;return{appState:JSON.parse(na.appState),elements:ha.map(function(va){var Aa,Ba= null===(Aa=sa.elementCache.get(va.id))||void 0===Aa?void 0:Aa.get(va.versionNonce);if(!Ba)throw Error("Element not found: ".concat(va.id,":").concat(va.versionNonce));return Ba})}}},{key:"dehydrateHistoryEntry",value:function(na){var sa=this,ha=na.elements;return{appState:JSON.stringify(na.appState),elements:ha.map(function(va){sa.elementCache.has(va.id)||sa.elementCache.set(va.id,new Map);var Aa=sa.elementCache.get(va.id);return Aa.has(va.versionNonce)||Aa.set(va.versionNonce,Wf(va)),{id:va.id,versionNonce:va.versionNonce}})}}}, {key:"getSnapshotForTest",value:function(){var na=this;return{recording:this.recording,stateHistory:this.stateHistory.map(function(sa){return na.hydrateHistoryEntry(sa)}),redoStack:this.redoStack.map(function(sa){return na.hydrateHistoryEntry(sa)})}}},{key:"clear",value:function(){this.stateHistory.length=0;this.redoStack.length=0;this.lastEntry=null;this.elementCache.clear()}},{key:"shouldCreateEntry",value:function(na){var sa,ha=this.lastEntry;if(!ha||na.elements.length!==ha.elements.length)return!0; for(var va=na.elements.length-1;-1=na.length;Sc=Sc||Pc;Rb.push((0,Sa.jsx)(Rc,{children:(0,Sa.jsx)(bv,{elements:na[Ya+Xc],pendingElements:Pc?Aa:void 0,onRemoveFromLibrary:sa.bind(null,Ya+Xc),onClick:Pc?ha.bind(null,Aa):va.bind(null,na[Ya+Xc])})},Xc))}mc.push((0,Sa.jsx)(Gc,{align:"center",gap:1,children:Rb},Ba))}return(0,Sa.jsx)(Rc,{align:"start",gap:1,className:"layer-ui__library-items",children:mc})},lv=function(z){var na=z.onClickOutside,sa=z.onInsertShape, ha=z.pendingElements,va=z.onAddToLibrary,Aa=z.theme,Ba=z.setAppState,Ha=z.libraryReturnUrl,Va=z.focusContainer,Ya=z.library;z=z.id;var ob=(0,ue.useRef)(null);!function(Yc,Bd){(0,ue.useEffect)(function(){var Xd=function(kd){Yc.current&&(kd.target instanceof Element&&(Yc.current.contains(kd.target)||!document.body.contains(kd.target))||Bd(kd))};return document.addEventListener("pointerdown",Xd,!1),function(){document.removeEventListener("pointerdown",Xd)}},[Yc,Bd])}(ob,function(Yc){Yc.target.closest(".ToolIcon_type_button__library")|| na(Yc)});var Bb=ia((0,ue.useState)([]),2),Rb=Bb[0],ic=Bb[1],mc=ia((0,ue.useState)("preloading"),2);Bb=mc[0];var Sc=mc[1],Xc=(0,ue.useRef)(null);(0,ue.useEffect)(function(){return Promise.race([new Promise(function(Yc){Xc.current=setTimeout(function(){Yc("loading")},100)}),Ya.loadLibrary().then(function(Yc){ic(Yc);Sc("ready")})]).then(function(Yc){"loading"===Yc&&Sc("loading")}),function(){clearTimeout(Xc.current)}},[Ya]);mc=(0,ue.useCallback)(function(){var Yc=(0,ff.Z)(Yd().mark(function kd(Xd){var qd, Hd;return Yd().wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Ya.loadLibrary();case 2:qd=He.sent,Hd=qd.filter(function(Tg,ni){return ni!==Xd}),Ya.saveLibrary(Hd).catch(function(Tg){ic(qd);Ba({errorMessage:Wb("alerts.errorRemovingFromLibrary")})}),ic(Hd);case 6:case "end":return He.stop()}},kd)}));return function(Xd){return Yc.apply(this,arguments)}}(),[Ya,Ba]);var Pc=(0,ue.useCallback)(function(){var Yc=(0,ff.Z)(Yd().mark(function kd(Xd){var qd,Hd;return Yd().wrap(function(He){for(;;)switch(He.prev= He.next){case 0:return He.next=2,Ya.loadLibrary();case 2:qd=He.sent,Hd=[].concat(ja(qd),[Xd]),va(),Ya.saveLibrary(Hd).catch(function(Tg){ic(qd);Ba({errorMessage:Wb("alerts.errorAddingToLibrary")})}),ic(Hd);case 7:case "end":return He.stop()}},kd)}));return function(Xd){return Yc.apply(this,arguments)}}(),[va,Ya,Ba]);return"preloading"===Bb?null:(0,Sa.jsx)(qn,{padding:1,ref:ob,className:"layer-ui__library",children:"loading"===Bb?(0,Sa.jsx)("div",{className:"layer-ui__library-message",children:Wb("labels.libraryLoadingMessage")}): (0,Sa.jsx)(kv,{libraryItems:Rb,onRemoveFromLibrary:mc,onAddToLibrary:Pc,onInsertShape:sa,pendingElements:ha,setAppState:Ba,setLibraryItems:ic,libraryReturnUrl:Ha,focusContainer:Va,library:Ya,theme:Aa,id:z})})},mv=ce().memo(function(z){var na,sa=z.actionManager,ha=z.appState,va=z.setAppState,Aa=z.canvas,Ba=z.elements,Ha=z.onCollabButtonClick,Va=z.onLockToggle,Ya=z.onInsertElements,ob=z.zenModeEnabled,Bb=z.showExitZenModeBtn,Rb=z.showThemeBtn,ic=z.toggleZenMode,mc=z.isCollaborating,Sc=z.renderTopRightUI, Xc=z.renderCustomFooter,Pc=z.viewModeEnabled,Yc=z.libraryReturnUrl,Bd=z.UIOptions,Xd=z.focusContainer,kd=z.library,qd=z.id;z=om();var Hd=function(){return Bd.canvasActions.export?(0,Sa.jsx)(iv,{elements:Ba,appState:ha,actionManager:sa,exportOpts:Bd.canvasActions.export,canvas:Aa}):null},He=function(){if(!Bd.canvasActions.saveAsImage)return null;var ye=function(Mg){return function(){var Wi=(0,ff.Z)(Yd().mark(function Fl(El){var Mf;return Yd().wrap(function(wg){for(;;)switch(wg.prev=wg.next){case 0:return wg.next= 2,vf(Mg,El,ha,{exportBackground:ha.exportBackground,name:ha.name,viewBackgroundColor:ha.viewBackgroundColor}).catch(kk).catch(function(Gl){console.error(Gl);va({errorMessage:Gl.message})});case 2:Mf=wg.sent,ha.exportEmbedScene&&Mf&&Yo(Mf)&&va({fileHandle:Mf});case 4:case "end":return wg.stop()}},Fl)}));return function(El){return Wi.apply(this,arguments)}}()};return(0,Sa.jsx)($u,{elements:Ba,appState:ha,actionManager:sa,onExportToPng:ye("png"),onExportToSvg:ye("svg"),onExportToClipboard:ye("clipboard")})}, Tg=function(){return(0,Sa.jsx)("div",{style:{width:".625em"}})},ni=(0,ue.useCallback)(function(ye){va({isLibraryOpen:!1})},[va]),Bi=(0,ue.useCallback)(function(){va({selectedElementIds:{},selectedGroupIds:{}})},[va]),pf=ha.isLibraryOpen?(0,Sa.jsx)(lv,{pendingElements:Sf(Ba,ha),onClickOutside:ni,onInsertShape:Ya,onAddToLibrary:Bi,setAppState:va,libraryReturnUrl:Yc,focusContainer:Xd,library:kd,theme:ha.theme,id:qd}):null;Ya=(0,Sa.jsxs)(Sa.Fragment,{children:[ha.isLoading&&(0,Sa.jsx)(Aj,{}),ha.errorMessage&& (0,Sa.jsx)(pv,{message:ha.errorMessage,onClose:function(){return va({errorMessage:null})}}),ha.showHelpDialog&&(0,Sa.jsx)(gv,{onClose:function(){va({showHelpDialog:!1})}}),ha.pasteDialog.shown&&(0,Sa.jsx)(Uu,{setAppState:va,appState:ha,onInsertChart:Ya,onClose:function(){return va({pasteDialog:{shown:!1,data:null}})}})]});return z?(0,Sa.jsxs)(Sa.Fragment,{children:[Ya,(0,Sa.jsx)(Tu,{appState:ha,elements:Ba,actionManager:sa,libraryMenu:pf,renderJSONExportDialog:Hd,renderImageExportDialog:He,setAppState:va, onCollabButtonClick:Ha,onLockToggle:Va,canvas:Aa,isCollaborating:mc,renderCustomFooter:Xc,viewModeEnabled:Pc,showThemeBtn:Rb})]}):(0,Sa.jsxs)("div",{className:Dc("layer-ui__wrapper",{"disable-pointerEvents":ha.draggingElement||ha.resizingElement||ha.editingElement&&!Yg(ha.editingElement)}),children:[Ya,(na=xh(ha,Ba),(0,Sa.jsx)(ot,{side:"top",children:(0,Sa.jsxs)("div",{className:"App-menu App-menu_top",children:[(0,Sa.jsxs)(Rc,{gap:4,className:Dc({"disable-pointerEvents":ob}),children:[Pc?(0,Sa.jsx)(oo, {heading:"canvasActions",className:Dc("zen-mode-transition",{"transition-left":ob}),children:(0,Sa.jsx)(qn,{padding:2,style:{zIndex:1},children:(0,Sa.jsx)(Rc,{gap:4,children:(0,Sa.jsxs)(Gc,{gap:1,justifyContent:"space-between",children:[Hd(),He()]})})})}):(0,Sa.jsx)(oo,{heading:"canvasActions",className:Dc("zen-mode-transition",{"transition-left":ob}),children:(0,Sa.jsx)(qn,{padding:2,style:{zIndex:1},children:(0,Sa.jsxs)(Rc,{gap:4,children:[(0,Sa.jsxs)(Gc,{gap:1,justifyContent:"space-between",children:[sa.renderAction("clearCanvas"), (0,Sa.jsx)(Tg,{}),sa.renderAction("loadScene"),Hd(),He(),(0,Sa.jsx)(Tg,{}),Ha&&(0,Sa.jsx)(Et,{isCollaborating:mc,collaboratorCount:ha.collaborators.size,onClick:Ha})]}),(0,Sa.jsx)(ut,{actionManager:sa,appState:ha,setAppState:va,showThemeBtn:Rb}),ha.fileHandle&&(0,Sa.jsx)(Sa.Fragment,{children:sa.renderAction("saveToActiveFile")})]})})}),na&&(0,Sa.jsx)(oo,{heading:"selectedShapeActions",className:Dc("zen-mode-transition",{"transition-left":ob}),children:(0,Sa.jsx)(qn,{className:yc.$C.SHAPE_ACTIONS_MENU, padding:2,style:{maxHeight:"".concat(ha.height-(ha.fileHandle?248:200),"px")},children:(0,Sa.jsx)(Gt,{appState:ha,elements:Ba,renderAction:sa.renderAction,elementType:ha.elementType})})})]}),!Pc&&(0,Sa.jsx)(oo,{heading:"shapes",children:function(ye){return(0,Sa.jsxs)(Rc,{gap:4,align:"start",children:[(0,Sa.jsxs)(Gc,{gap:1,children:[(0,Sa.jsx)(qt,{zenModeEnabled:ob,checked:ha.elementLocked,onChange:Va,title:Wb("toolBar.lock")}),(0,Sa.jsxs)(qn,{padding:1,className:Dc({"zen-mode":ob}),children:[(0,Sa.jsx)(pt, {appState:ha,elements:Ba}),ye,(0,Sa.jsx)(Gc,{gap:1,children:(0,Sa.jsx)(wt,{canvas:Aa,elementType:ha.elementType,setAppState:va})})]}),(0,Sa.jsx)(lt,{appState:ha,setAppState:va})]}),pf]})}}),(0,Sa.jsxs)("div",{className:Dc("layer-ui__wrapper__top-right zen-mode-transition",{"transition-right":ob}),children:[(0,Sa.jsx)(kt,{children:0Ba.clientHeight&&("auto"===Ha||"scroll"===Ha))break a;Ba=Ba.parentElement}Ba=document}this.nearestScrollableContainer= Ba;this.nearestScrollableContainer.addEventListener(yc.Ks.SCROLL,this.onScroll)}window.addEventListener(yc.Ks.RESIZE,this.onResize,!1);window.addEventListener(yc.Ks.UNLOAD,this.onUnload,!1);window.addEventListener(yc.Ks.BLUR,this.onBlur,!1);window.addEventListener(yc.Ks.DRAG_OVER,this.disableEvent,!1);window.addEventListener(yc.Ks.DROP,this.disableEvent,!1)}}},{key:"componentDidUpdate",value:function(Ba,Ha){var Va,Ya,ob=this;Ba.langCode!==this.props.langCode&&this.updateLanguage();Ba.viewModeEnabled!== this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled});Ha.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements());Ba.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled});Ba.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme});Ba.gridModeEnabled!==this.props.gridModeEnabled&&this.setState({gridSize:this.props.gridModeEnabled?yc.k:null});this.props.name&& Ba.name!==this.props.name&&this.setState({name:this.props.name});null===(Va=this.excalidrawContainerRef.current)||void 0===Va||Va.classList.toggle("theme--dark","dark"===this.state.theme);this.state.editingLinearElement&&!this.state.selectedElementIds[this.state.editingLinearElement.elementId]&&setTimeout(function(){ob.actionManager.executeAction($f)});Ba=Ha.multiElement;Ha.elementType!==this.state.elementType&&null!=Ba&&this.state.isBindingEnabled&&Xg(Ba)&&ng(Ba,this.state,this.scene,Hj(dd.getPointAtIndexGlobalCoordinates(Ba, -1)));var Bb={},Rb={},ic={},mc={},Sc={};this.state.collaborators.forEach(function(Yc,Bd){if(Yc.selectedElementIds)for(var Xd=0,kd=Object.keys(Yc.selectedElementIds);Xdbm&&1!==Pq.value&&(tk=bm/2*(Pq.value-1)),"translate(".concat(tk,"px, ").concat(Qv,"px) scale(").concat(Pq.value,") rotate(").concat(Pv, "deg)"));Wv.call(Yp,Vv,{font:Tv,lineHeight:Lm,width:Uv,height:Rv,left:Gl,top:sk,transform:wr,textAlign:Mf,color:wg.strokeColor,opacity:wg.opacity/100,filter:"var(--theme-filter)",maxWidth:"".concat(bm,"px")})}},kd=document.createElement("textarea");kd.dir="auto";kd.tabIndex=0;kd.dataset.type="wysiwyg";kd.wrap="off";Object.assign(kd.style,{position:"absolute",display:"inline-block",minHeight:"1em",backfaceVisibility:"hidden",margin:0,padding:0,border:0,outline:0,resize:"none",background:"transparent", overflow:"hidden",whiteSpace:"pre",zIndex:"var(--zIndex-wysiwyg)"});Xd();mc&&(kd.oninput=function(){mc(Bk(kd.value))});kd.onkeydown=function(Mf){(Mf.stopPropagation(),"Escape"===Mf.key)?(Mf.preventDefault(),pf=!0,ye()):"Enter"===Mf.key&&Mf[Af]?(Mf.preventDefault(),Mf.isComposing||229===Mf.keyCode)||(pf=!0,ye()):("Tab"===Mf.key||Mf[Af]&&("BracketLeft"===Mf.code||"BracketRight"===Mf.code))&&(Mf.preventDefault(),Mf.shiftKey||"BracketLeft"===Mf.code?Tg():He(),kd.dispatchEvent(new Event("input")))};var qd= " ".repeat(4),Hd=new RegExp("^ {1,".concat(4,"}")),He=function(){var Mf=kd.selectionStart,wg=kd.selectionEnd,Gl=ni(),sk=kd.value;Gl.forEach(function(tk){var bm=sk.slice(0,tk);tk=sk.slice(tk);sk="".concat(bm).concat(qd).concat(tk)});kd.value=sk;kd.selectionStart=Mf+4;kd.selectionEnd=wg+4*Gl.length},Tg=function(){var Mf=kd.selectionStart,wg=kd.selectionEnd,Gl=ni(),sk=[],tk=kd.value;Gl.forEach(function(bm){var Lm=tk.slice(bm,bm+4).match(Hd);if(Lm){var Yp=tk.slice(0,bm);Lm=tk.slice(bm+Lm[0].length);tk= "".concat(Yp).concat(Lm);sk.push(bm)}});kd.value=tk;sk.length&&(Mf>sk[sk.length-1]?kd.selectionStart=Math.max(Mf-4,sk[sk.length-1]):kd.selectionStart=Mf,kd.selectionEnd=Math.max(kd.selectionStart,wg-4*sk.length))},ni=function(){var Mf=kd.selectionStart,wg=kd.selectionEnd,Gl=kd.value,sk=Gl.slice(0,Mf).match(/[^\n]*$/)[0].length;return Mf-=sk,Gl.slice(Mf,wg).split("\n").reduce(function(tk,bm,Lm,Yp){return tk.concat(Lm?tk[Lm-1]+Yp[Lm-1].length+1:Mf)},[]).reverse()},Bi=function(Mf){Mf.preventDefault(); Mf.stopPropagation()},pf=!1,ye=function(){El||(El=!0,kd.onblur=null,kd.oninput=null,kd.onkeydown=null,Fl&&Fl.disconnect(),window.removeEventListener("resize",Xd),window.removeEventListener("wheel",Bi,!0),window.removeEventListener("pointerdown",Wi),window.removeEventListener("pointerup",Mg),window.removeEventListener("blur",ye),rk(),kd.remove());Sc({text:Bk(kd.value),viaKeyboard:pf})},Mg=function wg(){window.removeEventListener("pointerup",wg);setTimeout(function(){kd.onblur=ye;kd.focus()})},Wi=function(wg){(wg.target instanceof HTMLElement||wg.target instanceof SVGElement)&&wg.target.closest(".".concat(yc.$C.SHAPE_ACTIONS_MENU))&&!Dj(wg.target)&&(kd.onblur=null,window.addEventListener("pointerup",Mg),window.addEventListener("blur",ye))},rk=Ph.getScene(Pc).addCallback(function(){Xd();kd.focus()}),El=!1;kd.select();Mg();var Fl=null;Yc&&"ResizeObserver"in window?(Fl=new window.ResizeObserver(function(){Xd()})).observe(Yc):window.addEventListener("resize",Xd);window.addEventListener("pointerdown",Wi);window.addEventListener("wheel", Bi,{passive:!1,capture:!0});null==Bd||Bd.querySelector(".excalidraw-textEditorContainer").appendChild(kd)}({id:Ba.id,appState:this.state,canvas:this.canvas,getViewportCoords:function(Bb,Rb){Bb=hk({sceneX:Bb,sceneY:Rb},Va.state);return[Bb.x-Va.state.offsetLeft,Bb.y-Va.state.offsetTop]},onChange:ag(function(Bb){ob(Bb);!Ba.isDeleted&&Ei(Ba)}),onSubmit:ag(function(Bb){var Rb=Bb.text;Bb=Bb.viaKeyboard;var ic=!Rb.trim();ob(Rb,ic);!ic&&Bb&&Va.setState(function(mc){return{selectedElementIds:Wd(Wd({},mc.selectedElementIds), {},da({},Ba.id,!0))}});ic&&Ll(Va.scene.getElements(),[Ba]);ic&&!Ya||Va.history.resumeRecording();Va.setState({draggingElement:null,editingElement:null});Va.state.elementLocked&&si(Va.canvas,Va.state.elementType);Va.focusContainer()}),element:Ba,excalidrawContainer:this.excalidrawContainerRef.current});this.deselectElements();ob(Ba.text)}},{key:"deselectElements",value:function(){this.setState({selectedElementIds:{},selectedGroupIds:{},editingGroupId:null})}},{key:"getTextElementAtPosition",value:function(Ba, Ha){return(Ba=this.getElementAtPosition(Ba,Ha))&&Yg(Ba)&&!Ba.isDeleted?Ba:null}},{key:"getElementAtPosition",value:function(Ba,Ha,Va){var Ya=this.getElementsAtPosition(Ba,Ha);if(1Ha.length)return!1;var Va=10/this.state.zoom.value;Ha=ia(Bg(Ha),4);var Ya=Ha[1],ob=Ha[2],Bb=Ha[3];return Ba.x>Ha[0]-Va&&Ba.xYa-Va&&Ba.yye;var wg=qd.originalElements.get(El.id);Fl=Fl&&wg?wg.x:El.x+Wi;Mf=Mf&&wg?wg.y:El.y+rk}else Fl=El.x+Wi,Mf=El.y+rk;ke(El,{x:Fl,y:Mf});Ei(El,{simultaneouslyUpdated:Hd})})}(Ba,Rb,Bb,ob,Ha.scene,Va.shiftKey,ic[0],ic[1]),Ha.maybeSuggestBindingForAll(Rb),Va.altKey&&!Ba.hit.hasBeenDuplicated){Ba.hit.hasBeenDuplicated= !0;var mc;ic=[];Va=[];var Sc=new Map;Rb=new Map;var Xc=Ba.hit.element,Pc=lj(Ha.scene.getElementsIncludingDeleted());try{for(Pc.s();!(mc=Pc.n()).done;){var Yc=mc.value;if(Ha.state.selectedElementIds[Yc.id]||Yc.id===(null==Xc?void 0:Xc.id)&&Ba.hit.wasAddedToSelection){var Bd=Xj(Ha.state.editingGroupId,Sc,Yc),Xd=ia(Dh(Ba.origin.x-Ba.drag.offset.x,Ba.origin.y-Ba.drag.offset.y,Ha.state.gridSize),2);ke(Bd,{x:Bd.x+(Xd[0]-Bb),y:Bd.y+(Xd[1]-ob)});ic.push(Bd);Va.push(Yc);Rb.set(Yc.id,Bd.id)}else ic.push(Yc)}}catch(qd){Pc.e(qd)}finally{Pc.f()}mc= [].concat(ic,Va);Tj(mc,Va,Rb,"duplicatesServeAsOld");Ha.scene.replaceAllElements(mc)}return}}if(mc=Ha.state.draggingElement)if("freedraw"===mc.type?(Yc=mc.points,Bd=Ya.x-mc.x,Xd=Ya.y-mc.y,Bb=mc.simulatePressure?mc.pressures:[].concat(ja(mc.pressures),[Va.pressure]),ke(mc,{points:[].concat(ja(Yc),[[Bd,Xd]]),pressures:Bb})):Dg(mc)?(Ba.drag.hasOccurred=!0,Yc=mc.points,Bd=Bb-mc.x,Xd=ob-mc.y,Va.shiftKey&&2===Yc.length&&(Xd=mk(Ha.state.elementType,Bd,Xd),Bd=Xd.width,Xd=Xd.height),1===Yc.length?ke(mc,{points:[].concat(ja(Yc), [[Bd,Xd]])}):1=rk&&Bi>=ye})}(Yc,mc);Ha.setState(function(qd){return Me(Wd(Wd({},qd),{},{selectedElementIds:Wd(Wd(Wd({},qd.selectedElementIds),kd.reduce(function(Hd,He){return Hd[He.id]=!0,Hd},{})),Ba.hit.element?da({},Ba.hit.element.id, !kd.length):null)}),Ha.scene.getElements())})}}}})}},{key:"handlePointerMoveOverScrollbars",value:function(Ba,Ha){return Ha.scrollbars.isOverHorizontal?(Ba=Ba.clientX,this.setState({scrollX:this.state.scrollX-(Ba-Ha.lastCoords.x)/this.state.zoom.value}),Ha.lastCoords.x=Ba,!0):Ha.scrollbars.isOverVertical?(Ba=Ba.clientY,this.setState({scrollY:this.state.scrollY-(Ba-Ha.lastCoords.y)/this.state.zoom.value}),Ha.lastCoords.y=Ba,!0):!1}},{key:"onPointerUpFromPointerDownHandler",value:function(Ba){var Ha= this;return ag(function(Va){var Ya=Ha.state,ob=Ya.draggingElement,Bb=Ya.resizingElement,Rb=Ya.multiElement,ic=Ya.elementType,mc=Ya.elementLocked,Sc=Ya.isResizing;Ya=Ya.isRotating;if(Ha.setState({isResizing:!1,isRotating:!1,resizingElement:null,selectionElement:null,cursorButton:"up",editingElement:Rb||Yg(Ha.state.editingElement)?Ha.state.editingElement:null}),Ha.savePointer(Va.clientX,Va.clientY,"up"),Ha.state.editingLinearElement){var Xc=dd.handlePointerUp(Va,Ha.state.editingLinearElement,Ha.state); Xc!==Ha.state.editingLinearElement&&Ha.setState({editingLinearElement:Xc,suggestedBindings:[]})}if(mo=null,window.removeEventListener(yc.Ks.POINTER_MOVE,Ba.eventListeners.onMove),window.removeEventListener(yc.Ks.POINTER_UP,Ba.eventListeners.onUp),window.removeEventListener(yc.Ks.KEYDOWN,Ba.eventListeners.onKeyDown),window.removeEventListener(yc.Ks.KEYUP,Ba.eventListeners.onKeyUp),"freedraw"===(null==ob?void 0:ob.type))return ic=hh(Va,Ha.state),Rb=ob.points,mc=ic.x-ob.x,ic=ic.y-ob.y,mc===Rb[0][0]&& ic===Rb[0][1]&&(ic+=1E-4,mc+=1E-4),Va=ob.simulatePressure?[]:[].concat(ja(ob.pressures),[Va.pressure]),ke(ob,{points:[].concat(ja(Rb),[[mc,ic]]),pressures:Va}),void Ha.actionManager.executeAction($f);if(Dg(ob))1=yc.qx?ke(ha,{points:[].concat(ja(ic),[[Bb-Ya,Rb-ob]])}):zi(z.canvas,yc.oc.POINTER):2ic||0>mc)||"ne"===Ya&&0<=ic||"sw"===Ya&&0>=ic||"se"===Ya&&(0ha.points.length?[]:[va]})};this.handleCanvasRef=function(ha){var va,Aa,Ba;null!==ha?(z.canvas=ha,z.rc=Bj.canvas(z.canvas),z.canvas.addEventListener(yc.Ks.WHEEL,z.handleWheel,{passive:!1}),z.canvas.addEventListener(yc.Ks.TOUCH_START,z.onTapStart),z.canvas.addEventListener(yc.Ks.TOUCH_END,z.onTapEnd)):(null===(va=z.canvas)|| void 0===va||va.removeEventListener(yc.Ks.WHEEL,z.handleWheel),null===(Aa=z.canvas)||void 0===Aa||Aa.removeEventListener(yc.Ks.TOUCH_START,z.onTapStart),null===(Ba=z.canvas)||void 0===Ba||Ba.removeEventListener(yc.Ks.TOUCH_END,z.onTapEnd))};this.handleAppOnDrop=function(){var ha=(0,ff.Z)(Yd().mark(function Ba(Aa){var Ha,Va,Ya,ob,Bb,Rb,ic,mc,Sc,Xc;return Yd().wrap(function(Pc){for(;;)switch(Pc.prev=Pc.next){case 0:if(Pc.prev=0,"image/png"!==(null==(Ya=Aa.dataTransfer.files[0])?void 0:Ya.type)&&"image/svg+xml"!== (null==Ya?void 0:Ya.type)){Pc.next=21;break}if(!nm){Pc.next=14;break}return Pc.prev=4,ob=Aa.dataTransfer.items[0],Pc.next=8,ob.getAsFileSystemHandle();case 8:Ya.handle=Pc.sent;Pc.next=14;break;case 11:Pc.prev=11,Pc.t0=Pc.catch(4),console.warn(Pc.t0.name,Pc.t0.message);case 14:return Pc.next=16,vl(Ya,z.state,z.scene.getElementsIncludingDeleted());case 16:return Bb=Pc.sent,Rb=Bb.elements,ic=Bb.appState,z.syncActionResult({elements:Rb,appState:Wd(Wd({},ic||z.state),{},{isLoading:!1}),commitToHistory:!0}), Pc.abrupt("return");case 21:Pc.next=26;break;case 23:return Pc.prev=23,Pc.t1=Pc.catch(0),Pc.abrupt("return",z.setState({isLoading:!1,errorMessage:Pc.t1.message}));case 26:if(""===(mc=Aa.dataTransfer.getData(yc.LO.excalidrawlib))){Pc.next=30;break}return z.addElementsFromPasteOrLibrary({elements:JSON.parse(mc),position:Aa}),Pc.abrupt("return");case 30:if(!((null==(Sc=null===(Ha=Aa.dataTransfer)||void 0===Ha?void 0:Ha.files[0])?void 0:Sc.type)===yc.LO.excalidrawlib||null!=Sc&&null!==(Va=Sc.name)&&void 0!== Va&&Va.endsWith(".excalidrawlib"))){Pc.next=35;break}z.library.importLibrary(Sc).then(function(){z.setState({isLibraryOpen:!1});z.setState({isLibraryOpen:!0})}).catch(function(Yc){return z.setState({isLoading:!1,errorMessage:Yc.message})});Pc.next=49;break;case 35:if(z.setState({isLoading:!0}),!nm){Pc.next=47;break}return Pc.prev=37,Xc=Aa.dataTransfer.items[0],Pc.next=41,Xc.getAsFileSystemHandle();case 41:Sc.handle=Pc.sent;Pc.next=47;break;case 44:Pc.prev=44,Pc.t2=Pc.catch(37),console.warn(Pc.t2.name, Pc.t2.message);case 47:return Pc.next=49,z.loadFileToCanvas(Sc);case 49:case "end":return Pc.stop()}},Ba,null,[[0,23],[4,11],[37,44]])}));return function(Aa){return ha.apply(this,arguments)}}();this.loadFileToCanvas=function(ha){vl(ha,z.state,z.scene.getElementsIncludingDeleted()).then(function(va){return z.syncActionResult({elements:va.elements,appState:Wd(Wd({},va.appState||z.state),{},{isLoading:!1}),commitToHistory:!0})}).catch(function(va){z.setState({isLoading:!1,errorMessage:va.message})})}; this.handleCanvasContextMenu=function(ha){ha.preventDefault();var va=hh(ha,z.state),Aa=(va=z.getElementAtPosition(va.x,va.y,{preferSelected:!0}))?"element":"canvas",Ba=z.excalidrawContainerRef.current.getBoundingClientRect(),Ha=ha.clientX-Ba.left,Va=ha.clientY-Ba.top;va&&!z.state.selectedElementIds[va.id]?z.setState({selectedElementIds:da({},va.id,!0)},function(){z._openContextMenu({top:Va,left:Ha},Aa)}):z._openContextMenu({top:Va,left:Ha},Aa)};this.maybeDragNewGenericElement=function(ha,va){var Aa= z.state.draggingElement,Ba=ha.lastCoords;if(Aa)if("selection"===Aa.type)Pk(Aa,z.state.elementType,ha.origin.x,ha.origin.y,Ba.x,Ba.y,Math.abs(ha.origin.x-Ba.x),Math.abs(ha.origin.y-Ba.y),va.shiftKey,va.altKey);else{var Ha=ia(Dh(Ba.x,Ba.y,z.state.gridSize),2);Ba=Ha[0];Ha=Ha[1];Pk(Aa,z.state.elementType,ha.originInGrid.x,ha.originInGrid.y,Ba,Ha,Math.abs(ha.originInGrid.x-Ba),Math.abs(ha.originInGrid.y-Ha),va.shiftKey,va.altKey);z.maybeSuggestBindingForAll([Aa])}};this.maybeHandleResize=function(ha,va){var Aa= Sf(z.scene.getElements(),z.state),Ba=ha.resize.handleType;z.setState({isResizing:Ba&&"rotation"!==Ba,isRotating:"rotation"===Ba});var Ha=ha.lastCoords;Ha=ia(Dh(Ha.x-ha.resize.offset.x,Ha.y-ha.resize.offset.y,z.state.gridSize),2);a:{var Va=ha.resize.arrowDirection,Ya=va.shiftKey,ob=va.altKey,Bb=va.shiftKey;va=Ha[0];var Rb=Ha[1];Ha=ha.resize.center.x;var ic=ha.resize.center.y;if(1===Aa.length){Ha=ia(Aa,1)[0];if("rotation"===Ba)Ba=ia(Vf(Ha),4),Ba=5*Math.PI/2+Math.atan2(Rb-(Ba[1]+Ba[3])/2,va-(Ba[0]+Ba[2])/ 2),Ya&&(Ba+=yc.ay/2,Ba-=Ba%yc.ay),Ba=fe(Ba),ke(Ha,{angle:Ba}),Ei(Ha);else if(!Dg(Ha)||2!==Ha.points.length||"nw"!==Ba&&"ne"!==Ba&&"sw"!==Ba&&"se"!==Ba)if(!Yg(Ha)||"nw"!==Ba&&"ne"!==Ba&&"sw"!==Ba&&"se"!==Ba)Ba&&Gi(ha.originalElements.get(Ha.id),Bb,Ha,Ba,ob,va,Rb);else{Ya=ia(Vf(Ha),4);Bb=Ya[0];ha=Ya[1];Va=Ya[2];Ya=Ya[3];Rb=ia(Jf(va,Rb,(Bb+Va)/2,(ha+Ya)/2,-Ha.angle),2);va=Rb[0];Rb=Rb[1];switch(Ba){case "se":var mc=Math.max((va-Bb)/(Va-Bb),(Rb-ha)/(Ya-ha));break;case "nw":mc=Math.max((Va-va)/(Va-Bb), (Ya-Rb)/(Ya-ha));break;case "ne":mc=Math.max((va-Bb)/(Va-Bb),(Ya-Rb)/(Ya-ha));break;case "sw":mc=Math.max((Va-va)/(Va-Bb),(Rb-ha)/(Ya-ha))}0