(function(){ shadow$provide[595]=function(ka,N,Ba,w){var m=N(2);!function(G,p){"object"==typeof w&&"object"==typeof Ba?Ba.exports=p(N(14),N(23)):"function"==typeof define&&define.amd?define(["react","react-dom"],p):"object"==typeof w?w.Excalidraw=p(N(14),N(23)):G.Excalidraw=p(G.React,G.ReactDOM)}(self,function(G,p){return function(){function l(u){var g=a[u];if(void 0!==g)return g.exports;g=a[u]={id:u,exports:{}};return t[u](g,g.exports,l),g.exports}var c,h,n,t={7945:function(u,g,e){u.exports=e(1602)},4516:function(u){var g= Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;u.exports=function(){try{if(!Object.assign)return!1;var x=new String("abc");if(x[5]="de","5"===Object.getOwnPropertyNames(x)[0])return!1;var z={};for(x=0;10>x;x++)z["_"+String.fromCharCode(x)]=x;if("0123456789"!==Object.getOwnPropertyNames(z).map(function(K){return z[K]}).join(""))return!1;var y={};return"abcdefghijklmnopqrst".split("").forEach(function(K){y[K]=K}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({}, y)).join("")}catch(K){return!1}}()?Object.assign:function(x,z){var y;if(null==x)throw new TypeError("Object.assign cannot be called with null or undefined");var K=Object(x);for(var E=1;Eba.length)&&(v=ba.length);for(var C=0,U=Array(v);C{const [xa,Aa]=ja;ja[0]=(xa-U)*oa-(Aa-B)*va+U;ja[1]=(xa-U)*va+(Aa-B)*oa+B})}}function Y(ba){const v=ba[0];ba=ba[1];return Math.sqrt(Math.pow(v[0]-ba[0],2)+Math.pow(v[1]-ba[1],2))}function P(ba,v,C,U){const B=v[1]-ba[1];v=ba[0]-v[0];ba=B*ba[0]+v*ba[1];const oa=U[1]-C[1];U=C[0]-U[0];C=oa*C[0]+U*C[1];const va=B*U-oa*v;return va?[(U*ba-v*C)/va,(B*C-oa*ba)/va]:null}function W(ba,v,C){const U=ba.length;if(3>U)return!1;const B=[Number.MAX_SAFE_INTEGER, C];v=[v,C];C=0;for(let oa=0;oa=Math.min(ba[0],C[0])&&v[1]<=Math.max(ba[1],C[1])&&v[1]>=Math.min(ba[1],C[1])}function M(ba,v,C){ba=(v[1]-ba[1])*(C[0]-v[0])-(v[0]-ba[0])*(C[1]-v[1]);return 0===ba?0:0xa&&(xa=4*oa.strokeWidth);xa=Math.max(xa,.1);oa=[];for(var ja=0;jaIa.yminWa.ymin?1:Ia.xWa.x?1:Ia.ymax===Wa.ymax?0:(Ia.ymax-Wa.ymax)/Math.abs(Ia.ymax-Wa.ymax)),!oa.length)return B;let Aa=[],Ca=oa[0].ymin;for(;Aa.length||oa.length;){if(oa.length){va=-1;for(ja=0;jaCa);ja++)va=ja;oa.splice(0,va+1).forEach(Ia=>{Aa.push({s:Ca,edge:Ia})})}if(Aa=Aa.filter(Ia=>!(Ia.edge.ymax<=Ca)),Aa.sort((Ia,Wa)=>Ia.edge.x===Wa.edge.x?0:(Ia.edge.x-Wa.edge.x)/ Math.abs(Ia.edge.x-Wa.edge.x)),1=Aa.length)break;B.push([[Math.round(Aa[va].edge.x),Ca],[Math.round(Aa[ja].edge.x),Ca]])}Ca+=xa;Aa.forEach(Ia=>{Ia.edge.x+=xa*Ia.edge.islope})}}return B}(ba,v);return U&&(L(ba,C,-U),function(B,oa,va){const ja=[];B.forEach(xa=>ja.push(...xa));L(ja,oa,va)}(v,C,-U)),v}function za(ba){const v=[];a:{var C=ba;for(var U=[];""!==C;){if(!C.match(/^([ \t\r\n,]+)/))if(C.match(/^([aAcChHlLmMqQsStTvVzZ])/))U[U.length]={type:0, text:RegExp.$1};else{if(!C.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)){C=[];break a}U[U.length]={type:1,text:`${parseFloat(RegExp.$1)}`}}C=C.substr(RegExp.$1.length)}C=(U[U.length]={type:2,text:""},U)}U="BOD";let B=0;for(var oa=C[B];2!==oa.type;){let va=0;const ja=[];if("BOD"===U){if("M"!==oa.text&&"m"!==oa.text)return za("M0,0"+ba);B++;va=ck[oa.text];U=oa.text}else 1===oa.type?va=ck[U]:(B++,va=ck[oa.text],U=oa.text);if(!(B+vaAa%2?xa+C:xa+v);oa.push({key:"C",data:ba});v=ba[4];C=ba[5];break;case "Q":oa.push({key:"Q",data:[...ja]});v=ja[2];C=ja[3];break;case "q":ba=ja.map((xa,Aa)=>Aa%2?xa+C:xa+v);oa.push({key:"Q",data:ba});v=ba[2];C=ba[3];break;case "A":oa.push({key:"A",data:[...ja]});v=ja[5];C=ja[6];break;case "a":v+=ja[5];C+=ja[6];oa.push({key:"A", data:[ja[0],ja[1],ja[2],ja[3],ja[4],v,C]});break;case "H":oa.push({key:"H",data:[...ja]});v=ja[0];break;case "h":v+=ja[0];oa.push({key:"H",data:[v]});break;case "V":oa.push({key:"V",data:[...ja]});C=ja[0];break;case "v":C+=ja[0];oa.push({key:"V",data:[C]});break;case "S":oa.push({key:"S",data:[...ja]});v=ja[2];C=ja[3];break;case "s":ba=ja.map((xa,Aa)=>Aa%2?xa+C:xa+v);oa.push({key:"S",data:ba});v=ba[2];C=ba[3];break;case "T":oa.push({key:"T",data:[...ja]});v=ja[0];C=ja[1];break;case "t":v+=ja[0];C+= ja[1];oa.push({key:"T",data:[v,C]});break;case "Z":case "z":oa.push({key:"Z",data:[]}),v=U,C=B}return oa}function ta(ba){const v=[];var C="";let U=0,B=0,oa=0,va=0,ja=0,xa=0;for(const {key:Ca,data:Ia}of ba){switch(Ca){case "M":v.push({key:"M",data:[...Ia]});[U,B]=Ia;[oa,va]=Ia;break;case "C":v.push({key:"C",data:[...Ia]});U=Ia[4];B=Ia[5];ja=Ia[2];xa=Ia[3];break;case "L":v.push({key:"L",data:[...Ia]});[U,B]=Ia;break;case "H":U=Ia[0];v.push({key:"L",data:[U,B]});break;case "V":B=Ia[0];v.push({key:"L", data:[U,B]});break;case "S":var Aa=ba=0;"C"===C||"S"===C?(ba=U+(U-ja),Aa=B+(B-xa)):(ba=U,Aa=B);v.push({key:"C",data:[ba,Aa,...Ia]});ja=Ia[0];xa=Ia[1];U=Ia[2];B=Ia[3];break;case "T":const [Wa,$a]=Ia;Aa=ba=0;"Q"===C||"T"===C?(ba=U+(U-ja),Aa=B+(B-xa)):(ba=U,Aa=B);v.push({key:"C",data:[U+2*(ba-U)/3,B+2*(Aa-B)/3,Wa+2*(ba-Wa)/3,$a+2*(Aa-$a)/3,Wa,$a]});ja=ba;xa=Aa;U=Wa;B=$a;break;case "Q":const [rb,Hb,Xb,jc]=Ia;v.push({key:"C",data:[U+2*(rb-U)/3,B+2*(Hb-B)/3,Xb+2*(rb-Xb)/3,jc+2*(Hb-jc)/3,Xb,jc]});ja=rb; xa=Hb;U=Xb;B=jc;break;case "A":C=Math.abs(Ia[0]);ba=Math.abs(Ia[1]);Aa=Ia[2];const nc=Ia[3],Tc=Ia[4],Xc=Ia[5],Pc=Ia[6];if(0===C||0===ba)v.push({key:"C",data:[U,B,Xc,Pc,Xc,Pc]}),U=Xc,B=Pc;else if(U!==Xc||B!==Pc)ma(U,B,Xc,Pc,C,ba,Aa,nc,Tc).forEach(function(Zc){v.push({key:"C",data:Zc})}),U=Xc,B=Pc;break;case "Z":v.push({key:"Z",data:[]}),U=oa,B=va}C=Ca}return v}function fa(ba,v,C){return[ba*Math.cos(C)-v*Math.sin(C),ba*Math.sin(C)+v*Math.cos(C)]}function ma(ba,v,C,U,B,oa,va,ja,xa,Aa){const Ca=(Ia=va, Math.PI*Ia/180);var Ia;Ia=[];if(Aa)[ja,Wa,$a,rb]=Aa;else{[ba,v]=fa(ba,v,-Ca);[C,U]=fa(C,U,-Ca);var Wa=(ba-C)/2;var $a=(v-U)/2;var rb=Wa*Wa/(B*B)+$a*$a/(oa*oa);1ja&&(ja= 2*Math.PI+ja);0>Wa&&(Wa=2*Math.PI+Wa);xa&&ja>Wa&&(ja-=2*Math.PI);!xa&&Wa>ja&&(Wa-=2*Math.PI)}if(Math.abs(Wa-ja)>120*Math.PI/180){Hb=Wa;const Xb=C,jc=U;Wa=xa&&Wa>ja?ja+120*Math.PI/180:ja+120*Math.PI/180*-1;Ia=ma(C=$a+B*Math.cos(Wa),U=rb+oa*Math.sin(Wa),Xb,jc,B,oa,va,0,xa,[Wa,Hb,$a,rb])}va=Math.tan((Wa-ja)/4);B=4/3*B*va;va*=4/3*oa;oa=[ba,v];ba=[ba+B*Math.sin(ja),v-va*Math.cos(ja)];v=[C+B*Math.sin(Wa),U-va*Math.cos(Wa)];C=[C,U];if(ba[0]=2*oa[0]-ba[0],ba[1]=2*oa[1]-ba[1],Aa)return[ba,v,C].concat(Ia); Ia=[ba,v,C].concat(Ia);Aa=[];for(C=0;CB;)B+=2*Math.PI,oa+=2*Math.PI;oa-B>2*Math.PI&&(B=0,oa=2*Math.PI);var Aa=Math.min(2* Math.PI/xa.curveStepCount/2,(oa-B)/2);const Ca=cb(Aa,ba,v,C,U,B,oa,1,xa);xa.disableMultiStroke||(Aa=cb(Aa,ba,v,C,U,B,oa,1.5,xa),Ca.push(...Aa));return va&&(ja?Ca.push(...gb(ba,v,ba+C*Math.cos(B),v+U*Math.sin(B),xa),...gb(ba,v,ba+C*Math.cos(oa),v+U*Math.sin(oa),xa)):Ca.push({op:"lineTo",data:[ba,v]},{op:"lineTo",data:[ba+C*Math.cos(B),v+U*Math.sin(B)]})),{type:"path",ops:Ca}}function Ra(ba,v){const C=[];if(ba.length){const U=v.maxRandomnessOffset||0,B=ba.length;if(2xa?1:500ja&&(Ca=xa/10);ja=Ca/2;xa=.2+.2*sb(B);let Ia=B.bowing*B.maxRandomnessOffset*(U-v)/200,Wa=B.bowing*B.maxRandomnessOffset*(ba-C)/200;Ia=Vb(Ia,B,Aa);Wa=Vb(Wa,B,Aa);const $a=[],rb=B.preserveVertices;return oa&&(va?$a.push({op:"move",data:[ba+(rb?0:Vb(ja,B,Aa)),v+(rb?0:Vb(ja,B,Aa))]}):$a.push({op:"move",data:[ba+(rb?0:Vb(Ca,B,Aa)),v+(rb?0:Vb(Ca,B,Aa))]})),va?$a.push({op:"bcurveTo",data:[Ia+ba+(C-ba)*xa+Vb(ja,B,Aa),Wa+v+(U-v)*xa+Vb(ja,B,Aa),Ia+ba+2* (C-ba)*xa+Vb(ja,B,Aa),Wa+v+2*(U-v)*xa+Vb(ja,B,Aa),C+(rb?0:Vb(ja,B,Aa)),U+(rb?0:Vb(ja,B,Aa))]}):$a.push({op:"bcurveTo",data:[Ia+ba+(C-ba)*xa+Vb(Ca,B,Aa),Wa+v+(U-v)*xa+Vb(Ca,B,Aa),Ia+ba+2*(C-ba)*xa+Vb(Ca,B,Aa),Wa+v+2*(U-v)*xa+Vb(Ca,B,Aa),C+(rb?0:Vb(Ca,B,Aa)),U+(rb?0:Vb(Ca,B,Aa))]}),$a}function yb(ba,v,C){const U=[];U.push([ba[0][0]+Vb(v,C),ba[0][1]+Vb(v,C)]);U.push([ba[0][0]+Vb(v,C),ba[0][1]+Vb(v,C)]);for(let B=1;Bja&&(ja=Aa,xa=$a)}return Math.sqrt(ja)>U?(Sb(ba,v,xa+1,U,B),Sb(ba,xa,C,U,B)):(B.length||B.push(oa),B.push(va)),B}function xb(ba,v=.15,C){const U=[],B=(ba.length-1)/3;for(let oa=0;oa=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function zc(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);C=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function td(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);CB){return ba*U(.5-v*(.5-C))}function Xd(ba,v){return[ba[0]+v[0],ba[1]+v[1]]}function xe(ba,v){return[ba[0]-v[0],ba[1]-v[1]]}function vd(ba,v){return[ba[0]*v,ba[1]*v]} function zd(ba){return[ba[1],-ba[0]]}function Ie(ba,v){return ba[0]===v[0]&&ba[1]===v[1]}function qg(ba,v){ba=xe(ba,v);return ba[0]*ba[0]+ba[1]*ba[1]}function qf(ba){var v=Math.hypot(ba[0],ba[1]);return[ba[0]/v,ba[1]/v]}function rf(ba,v){return Math.hypot(ba[1]-v[1],ba[0]-v[0])}function hf(ba,v,C){let U=Math.sin(C);C=Math.cos(C);let B=ba[0]-v[0];ba=ba[1]-v[1];return[B*C-ba*U+v[0],B*U+ba*C+v[1]]}function Gf(ba,v,C){return Xd(ba,vd(xe(v,ba),C))}function og(ba,v,C){return Xd(ba,vd(v,C))}function Ih(ba, v={}){var C;let {size:U=16,smoothing:B=.5,thinning:oa=.5,simulatePressure:va=!0,easing:ja=pf=>pf,start:xa={},end:Aa={},last:Ca=!1}=v,{cap:Ia=!0,taper:Wa=0,easing:$a=pf=>pf*(2-pf)}=xa,{cap:rb=!0,taper:Hb=0,easing:Xb=pf=>--pf*pf*pf+1}=Aa;if(0===ba.length)return[];var jc,nc=ba[ba.length-1].runningLength,Tc=Math.pow(U*B,2);v=[];var Xc=[],Pc=ba.slice(0,10).reduce((pf,Ae)=>{var ah=Ae.pressure;va&&(Ae=Wl(1,Ae.distance/U),ah=Wl(1,1-Ae),ah=Wl(1,pf+.275*Ae*(ah-pf)));return(pf+ah)/2},ba[0].pressure),Zc=bd(U, oa,ba[ba.length-1].pressure,ja);let Dd=ba[0].vector;var Yd=ba[0].point;let md=Yd;var sd=Yd,Hd=md,He=!0;for(let pf=0;pfni){Yd=vd(zd(Dd),Zc);for(let El=1/13,Fl=0;1>=Fl;Fl+=El)Hd=hf(Xd(Ae,Yd),Ae,Gm*-Fl),sd=hf(xe(Ae,Yd),Ae,Gm*Fl),Xc.push(Hd),v.push(sd);Yd=sd;md=Hd}else Hd=vd(zd(Gf(Ai,ah,ni)),Zc),sd=xe(Ae,Hd),Hd=Xd(Ae,Hd),((Pc=2>pf||.25>ni)||qg(Yd,sd)>Tc)&&(v.push(sd),Yd=sd),(Pc||qg(md,Hd)>Tc)&&(Xc.push(Hd),md=Hd),Pc=Sg,Dd=ah}}C=ba[0];jc=ba[ba.length-1];if((nc=He||2>Xc.length||2>v.length)&&(!Wa&&!Hb||Ca)){v=0;Xc=Ie(C.point,jc.point)?Xd(C.point,[1,1]):jc.point;for(sd=0;sdU){v=bd(U,oa,pf,ja);break}}v=og(C.point,zd(qf(xe(C.point,Xc))),-(v||Zc));Xc=[];for(let pf=1/13,Ae=pf;1>=Ae;Ae+=pf)Xc.push(hf(v,C.point,2*Gm*Ae));return Xc}ba=[];He=[];if(1=Ae;Ae+=pf){Tc=hf(Hd,C.point,Gm*Ae);if(1>rf(Tc,sd))break;ba.push(Tc)}v.shift(); Xc.shift()}}else Ie(Hd,sd)||(Tc=qf(xe(sd,Hd)),sd=rf(Hd,sd)/2,ba.push(og(C.point,Tc,-sd),og(C.point,Tc,.95*-sd),og(C.point,Tc,.95*sd),og(C.point,Tc,sd)),v.shift(),Xc.shift());C=vd(Xd(v[v.length-1],Xc[Xc.length-1]),.5);sd=jc.point;Hd=zd(qf(xe(sd,C)));if(rb||Hb)if(Hb||Wa&&nc)He.push(sd.slice(0,2));else{Zc=og(sd,Hd,Zc);for(let pf=1/29,Ae=0;1>=Ae;Ae+=pf)Hd=hf(Zc,sd,3*Gm*Ae),He.push(Hd)}else C=Gf(C,sd,.95),Zc*=.95,He.push(og(C,Hd,Zc),og(sd,Hd,Zc),og(sd,Hd,-Zc),og(C,Hd,-Zc))}return v.concat(He,Xc.reverse(), ba)}function Jh(ba,v={}){return Ih(function(C,U={}){var B;let {streamline:oa=.5,size:va=16,last:ja=!1}=U;if(0===C.length)return[];U=.15+.85*(1-oa);C=Array.isArray(C[0])?C:C.map(({x:$a,y:rb,pressure:Hb=.5})=>[$a,rb,Hb]);1===C.length&&C.push([...Xd(C[0],[1,1]),C[0][2]||.5]);let xa=[{point:[C[0][0],C[0][1]],pressure:C[0][2]||.25,vector:[1,1],distance:0,runningLength:0}],Aa=!1,Ca=0,Ia=xa[0],Wa=C.length-1;for(let $a=1;$a=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function Db(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);C= ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function ld(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C= 0,U=Array(v);C=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function Xa(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);C=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null== C.return||C.return()}finally{if(va)throw B;}}}}function Ed(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);C=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function oe(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);C=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function re(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);C= ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function Ye(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C= 0,U=Array(v);C=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function Gi(ba, v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);C=ba.length?{done:!0}:{done:!1,value:ba[U++]}},e:function(ja){throw ja;},f:v}}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 B,oa=!0,va=!1;return{s:function(){C=C.call(ba)},n:function(){var ja=C.next();return oa=ja.done,ja},e:function(ja){va=!0;B=ja},f:function(){try{oa||null==C.return||C.return()}finally{if(va)throw B;}}}}function $i(ba,v){(null==v||v>ba.length)&&(v=ba.length);for(var C=0,U=Array(v);Cv.label?1:-1}).filter(function(ba){return 85<=Hk[ba.code]});"production"===Cc.Vi.DEVELOPMENT&&bk.unshift({code:"__test__",label:"test language"},{code:"".concat("__test__",".rtl"),label:"‪test language (rtl)‬",rtl:!0});var Cg=Vg,yh={},tg=function(){var ba=(0,ff.Z)(Zd().mark(function U(C){return Zd().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:if(Cg=C,document.documentElement.dir=Cg.rtl?"rtl":"ltr",document.documentElement.lang= Cg.code,!C.code.startsWith("__test__")){B.next=7;break}yh={};B.next=10;break;case 7:return B.next=9,e(788)("./".concat(Cg.code,".json"));case 9:yh=B.sent;case 10:case "end":return B.stop()}},U)}));return function(C){return ba.apply(this,arguments)}}(),zh=function(ba,v){for(var C=0;CY(U)||(U=[v[B][0],U[1]],3C&&ja>C&&U.push({point:oa,distance:va})}}if(1ja.distance-xa.distance).map(ja=>ja.point);if(W(ba, ...v[0])||C.shift(),W(ba,...v[1])||C.pop(),1>=C.length)return this.midPointInPolygon(ba,v)?[v]:[];v=[v[0],...C,v[1]];C=[];for(U=0;UU&&(U=4*v.strokeWidth);U=Math.max(U,.1);let B=v.fillWeight;0>B&&(B=v.strokeWidth/2);const oa=U/4;for(const Aa of ba){var va=Y(Aa);ba=Math.ceil(va/U)-1;va-=ba*U;const Ca=(Aa[0][0]+Aa[1][0])/2-U/4,Ia=Math.min(Aa[0][1],Aa[1][1]);for(let Wa=0;Wav.dashOffset?0>v.hachureGap?4*v.strokeWidth:v.hachureGap:v.dashOffset,U=0>v.dashGap?0>v.hachureGap?4*v.strokeWidth:v.hachureGap:v.dashGap,B=[];return ba.forEach(oa=>{var va=Y(oa);const ja=Math.floor(va/ (C+U));va=(va+U-ja*(C+U))/2;let xa=oa[0];var Aa=oa[1];xa[0]>Aa[0]&&(xa=oa[1],Aa=oa[0]);oa=Math.atan((Aa[1]-xa[1])/(Aa[0]-xa[0]));for(Aa=0;Aav.hachureGap?4*v.strokeWidth: v.hachureGap,U=0>v.zigzagOffset?C:v.zigzagOffset;ba=da(ba,v=Object.assign({},v,{hachureGap:C+U}));return{type:"fillSketch",ops:this.zigzagLines(ba,U,v)}}zigzagLines(ba,v,C){const U=[];return ba.forEach(B=>{var oa=Y(B);oa=Math.round(oa/(2*v));let va=B[0];var ja=B[1];va[0]>ja[0]&&(va=B[1],ja=B[0]);B=Math.atan((ja[1]-va[1])/(ja[0]-va[0]));for(ja=0;jaB;)B+=2*Math.PI,oa+=2*Math.PI;oa-B>2*Math.PI&&(B=0,oa=2*Math.PI);const Ca=(oa-B)/ja.curveStepCount,Ia=[];for(;B<=oa;B+=Ca)Ia.push([ba+C*Math.cos(B),v+ U*Math.sin(B)]);ba=(Ia.push([ba+C*Math.cos(oa),v+U*Math.sin(oa)]),Ia.push([ba,v]),qb(Ia,ja));va.call(xa,ba)}return"none"!==ja.stroke&&xa.push(Aa),this._d("arc",xa,ja)}curve(ba,v){v=this._o(v);const C=[],U=sa(ba,v);v.fill&&"none"!==v.fill&&3<=ba.length&&(ba=xb(function(B,oa=0){var va=B.length;if(3>va)throw Error("A curve must have at least three points.");const ja=[];if(3===va)ja.push([...B[0]],[...B[1]],[...B[2]],[...B[2]]);else{va=[];va.push(B[0],B[0]);for(var xa=1;xaC.simplification),va=function(ja,xa,Aa){var Ca=ta(Z(za(ja)));ja=[];let Ia= [];var Wa=[0,0];let $a=[];const rb=()=>{4<=$a.length&&Ia.push(...xb($a,xa));$a=[]};for(const {key:Hb,data:Xb}of Ca)switch(Hb){case "M":rb();Ia.length&&(ja.push(Ia),Ia=[]);Wa=[Xb[0],Xb[1]];Ia.push(Wa);break;case "L":rb();Ia.push([Xb[0],Xb[1]]);break;case "C":$a.length||(Ca=Ia.length?Ia[Ia.length-1]:Wa,$a.push([Ca[0],Ca[1]]));$a.push([Xb[0],Xb[1]]);$a.push([Xb[2],Xb[3]]);$a.push([Xb[4],Xb[5]]);break;case "Z":rb(),Ia.push([Wa[0],Wa[1]])}rb();Ia.length&&(ja.push(Ia),Ia=[]);if(!Aa)return ja;Wa=[];for(const Hb of ja)ja= Sb(Hb,0,Hb.length,Aa),ja.length&&Wa.push(ja);return Wa}(ba,1,oa?4-4*C.simplification:(1+C.roughness)/2);if(v)if(C.combineNestedSvgPaths){const ja=[];va.forEach(xa=>ja.push(...xa));"solid"===C.fillStyle?U.push(Ra(ja,C)):U.push(qb(ja,C))}else va.forEach(ja=>{"solid"===C.fillStyle?U.push(Ra(ja,C)):U.push(qb(ja,C))});return B&&(oa?va.forEach(ja=>{U.push(wa(ja,!1,C))}):U.push(function(ja,xa){ja=ta(Z(za(ja)));const Aa=[];let Ca=[0,0],Ia=[0,0];for(const {key:Wa,data:$a}of ja)switch(Wa){case "M":const rb= 1*(xa.maxRandomnessOffset||0),Hb=xa.preserveVertices;Aa.push({op:"move",data:$a.map(Zc=>Zc+(Hb?0:Vb(rb,xa)))});Ia=[$a[0],$a[1]];Ca=[$a[0],$a[1]];break;case "L":Aa.push(...gb(Ia[0],Ia[1],$a[0],$a[1],xa));Ia=[$a[0],$a[1]];break;case "C":const [Xb,jc,nc,Tc,Xc,Pc]=$a;Aa.push(...Na(Xb,jc,nc,Tc,Xc,Pc,Ia,xa));Ia=[Xc,Pc];break;case "Z":Aa.push(...gb(Ia[0],Ia[1],Ca[0],Ca[1],xa)),Ia=[Ca[0],Ca[1]]}return{type:"path",ops:Aa}}(ba,C))),this._d("path",U,C)}opsToPath(ba,v){let C="";for(const U of ba.ops)switch(ba= "number"==typeof v&&0<=v?U.data.map(B=>+B.toFixed(v)):U.data,U.op){case "move":C+=`M${ba[0]} ${ba[1]} `;break;case "bcurveTo":C+=`C${ba[0]} ${ba[1]}, ${ba[2]} ${ba[3]}, ${ba[4]} ${ba[5]} `;break;case "lineTo":C+=`L${ba[0]} ${ba[1]} `}return C.trim()}toPaths(ba){var v=ba.sets||[];ba=ba.options||this.defaultOptions;const C=[];for(const U of v){v=null;switch(U.type){case "path":v={d:this.opsToPath(U),stroke:ba.stroke,strokeWidth:ba.strokeWidth,fill:"none"};break;case "fillPath":v={d:this.opsToPath(U), stroke:"none",strokeWidth:0,fill:ba.fill||"none"};break;case "fillSketch":v=this.fillSketch(U,ba)}v&&C.push(v)}return C}fillSketch(ba,v){let C=v.fillWeight;return 0>C&&(C=v.strokeWidth/2),{d:this.opsToPath(ba),stroke:v.fill||"none",strokeWidth:C,fill:"none"}}}class $k{constructor(ba,v){this.canvas=ba;this.ctx=this.canvas.getContext("2d");this.gen=new aj(v)}draw(ba){const v=ba.sets||[],C=ba.options||this.getDefaultOptions(),U=this.ctx;for(const B of v)switch(B.type){case "path":U.save();U.strokeStyle= "none"===C.stroke?"transparent":C.stroke;U.lineWidth=C.strokeWidth;C.strokeLineDash&&U.setLineDash(C.strokeLineDash);C.strokeLineDashOffset&&(U.lineDashOffset=C.strokeLineDashOffset);this._drawToContext(U,B);U.restore();break;case "fillPath":U.save();U.fillStyle=C.fill||"";this._drawToContext(U,B,"curve"===ba.shape||"polygon"===ba.shape?"evenodd":"nonzero");U.restore();break;case "fillSketch":this.fillSketch(U,B,C)}}fillSketch(ba,v,C){let U=C.fillWeight;0>U&&(U=C.strokeWidth/2);ba.save();C.fillLineDash&& ba.setLineDash(C.fillLineDash);C.fillLineDashOffset&&(ba.lineDashOffset=C.fillLineDashOffset);ba.strokeStyle=C.fill||"";ba.lineWidth=U;this._drawToContext(ba,v);ba.restore()}_drawToContext(ba,v,C="nonzero"){ba.beginPath();for(const U of v.ops){const B=U.data;switch(U.op){case "move":ba.moveTo(B[0],B[1]);break;case "bcurveTo":ba.bezierCurveTo(B[0],B[1],B[2],B[3],B[4],B[5]);break;case "lineTo":ba.lineTo(B[0],B[1])}}"fillPath"===v.type?ba.fill(C):ba.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(ba, v,C,U,B){ba=this.gen.line(ba,v,C,U,B);return this.draw(ba),ba}rectangle(ba,v,C,U,B){ba=this.gen.rectangle(ba,v,C,U,B);return this.draw(ba),ba}ellipse(ba,v,C,U,B){ba=this.gen.ellipse(ba,v,C,U,B);return this.draw(ba),ba}circle(ba,v,C,U){ba=this.gen.circle(ba,v,C,U);return this.draw(ba),ba}linearPath(ba,v){ba=this.gen.linearPath(ba,v);return this.draw(ba),ba}polygon(ba,v){ba=this.gen.polygon(ba,v);return this.draw(ba),ba}arc(ba,v,C,U,B,oa,va=!1,ja){ba=this.gen.arc(ba,v,C,U,B,oa,va,ja);return this.draw(ba), ba}curve(ba,v){ba=this.gen.curve(ba,v);return this.draw(ba),ba}path(ba,v){ba=this.gen.path(ba,v);return this.draw(ba),ba}}class Hn{constructor(ba,v){this.svg=ba;this.gen=new aj(v)}draw(ba){var v=ba.sets||[];const C=ba.options||this.getDefaultOptions(),U=this.svg.ownerDocument||window.document,B=U.createElementNS("http://www.w3.org/2000/svg","g"),oa=ba.options.fixedDecimalPlaceDigits;for(const va of v){v=null;switch(va.type){case "path":v=U.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d", this.opsToPath(va,oa));v.setAttribute("stroke",C.stroke);v.setAttribute("stroke-width",C.strokeWidth+"");v.setAttribute("fill","none");C.strokeLineDash&&v.setAttribute("stroke-dasharray",C.strokeLineDash.join(" ").trim());C.strokeLineDashOffset&&v.setAttribute("stroke-dashoffset",`${C.strokeLineDashOffset}`);break;case "fillPath":v=U.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",this.opsToPath(va,oa));v.setAttribute("stroke","none");v.setAttribute("stroke-width","0");v.setAttribute("fill", C.fill||"");"curve"!==ba.shape&&"polygon"!==ba.shape||v.setAttribute("fill-rule","evenodd");break;case "fillSketch":v=this.fillSketch(U,va,C)}v&&B.appendChild(v)}return B}fillSketch(ba,v,C){let U=C.fillWeight;0>U&&(U=C.strokeWidth/2);ba=ba.createElementNS("http://www.w3.org/2000/svg","path");return ba.setAttribute("d",this.opsToPath(v,C.fixedDecimalPlaceDigits)),ba.setAttribute("stroke",C.fill||""),ba.setAttribute("stroke-width",U+""),ba.setAttribute("fill","none"),C.fillLineDash&&ba.setAttribute("stroke-dasharray", C.fillLineDash.join(" ").trim()),C.fillLineDashOffset&&ba.setAttribute("stroke-dashoffset",`${C.fillLineDashOffset}`),ba}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(ba,v){return this.gen.opsToPath(ba,v)}line(ba,v,C,U,B){ba=this.gen.line(ba,v,C,U,B);return this.draw(ba)}rectangle(ba,v,C,U,B){ba=this.gen.rectangle(ba,v,C,U,B);return this.draw(ba)}ellipse(ba,v,C,U,B){ba=this.gen.ellipse(ba,v,C,U,B);return this.draw(ba)}circle(ba,v,C,U){ba=this.gen.circle(ba, v,C,U);return this.draw(ba)}linearPath(ba,v){ba=this.gen.linearPath(ba,v);return this.draw(ba)}polygon(ba,v){ba=this.gen.polygon(ba,v);return this.draw(ba)}arc(ba,v,C,U,B,oa,va=!1,ja){ba=this.gen.arc(ba,v,C,U,B,oa,va,ja);return this.draw(ba)}curve(ba,v){ba=this.gen.curve(ba,v);return this.draw(ba)}path(ba,v){ba=this.gen.path(ba,v);return this.draw(ba)}}var Bj={canvas:(ba,v)=>new $k(ba,v),svg:(ba,v)=>new Hn(ba,v),generator:ba=>new aj(ba),newSeed:()=>aj.newSeed()};let dk=(ba=21)=>{let v="",C=crypto.getRandomValues(new Uint8Array(ba)); for(;ba--;){let U=63&C[ba];v+=36>U?U.toString(36):62>U?(U-26).toString(36).toUpperCase():63>U?"_":"-"}return v};var Xg=function(ba){return null!=ba&&"text"===ba.type},ki=function(ba){return null!=ba&&"freedraw"===ba.type},Dg=function(ba){return null!=ba&&oj(ba.type)},oj=function(ba){return"arrow"===ba||"line"===ba},Wg=function(ba){return null!=ba&&"arrow"===ba.type},Ze=function(ba){return null!=ba&&("rectangle"===ba.type||"diamond"===ba.type||"ellipse"===ba.type||"text"===ba.type)},Jf=function(ba, v,C,U,B){return[(ba-C)*Math.cos(B)-(v-U)*Math.sin(B)+C,(ba-C)*Math.sin(B)+(v-U)*Math.cos(B)+U]},Df=function(ba,v,C){return Jf(ba[0],ba[1],v[0],v[1],C)},qi=function(ba,v,C,U,B,oa,va,ja){var xa=Math.cos(U);U=Math.sin(U);return ba.e&&ba.w?v+=B+va:ba.e?(v+=B*(1+xa),C+=B*U,v+=va*(1-xa),C+=va*-U):ba.w&&(v+=B*(1-xa),C+=B*-U,v+=va*(1+xa),C+=va*U),ba.n&&ba.s?C+=oa+ja:ba.n?(v+=oa*U,C+=oa*(1-xa),v+=ja*-U,C+=ja*(1+xa)):ba.s&&(v+=oa*-U,C+=oa*(1+xa),v+=ja*U,C+=ja*(1-xa)),[v,C]},qj=function(ba){var v=1U)return!1;var B=[Number.MAX_SAFE_INTEGER,C];v=[v,C];for(var oa=C=0;oa=Math.min(ba[0],C[0])&&v[1]<=Math.max(ba[1],C[1])&&v[1]>=Math.min(ba[1],C[1])},Qi=function(ba,v,C){ba=(v[1]-ba[1])*(C[0]-v[0])-(v[0]-ba[0])*(C[1]-v[1]);return 0===ba?0:0=B;){var Ca=oa(B,0),Ia=oa(B,1);v&&(Ia=ca(v(Ca,Ia),2),Ca=Ia[0],Ia=Ia[1]);U.minY=Math.min(U.minY,Ia);U.minX= Math.min(U.minX,Ca);U.maxX=Math.max(U.maxX,Ca);U.maxY=Math.max(U.maxY,Ia);B+=.1}}return U},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[ba.minX,ba.minY,ba.maxX,ba.maxY]},tl=function(ba){var v,C=1/0,U=1/0,B=-1/0,oa=-1/0;ba=wc(ba);try{for(ba.s();!(v=ba.n()).done;){var va=ca(v.value,2),ja=va[0],xa=va[1];C=Math.min(C,ja);U=Math.min(U,xa);B=Math.max(B,ja);oa=Math.max(oa,xa)}}catch(Aa){ba.e(Aa)}finally{ba.f()}return[C,U,B,oa]},jf=function(ba){if(2>ba.points.length||!kh.get(ba)){var v=ba.points.reduce(function(C, U){var B=ca(U,2);U=B[0];B=B[1];return C.minY=Math.min(C.minY,B),C.minX=Math.min(C.minX,U),C.maxX=Math.max(C.maxX,U),C.maxY=Math.max(C.maxY,B),C},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});ba=[v.minX+ba.x,v.minY+ba.y,v.maxX+ba.x,v.maxY+ba.y]}else v=kh.get(ba),v=Ik(v[0]),v=ca(Mh(v),4),ba=[v[0]+ba.x,v[1]+ba.y,v[2]+ba.x,v[3]+ba.y];return ba},gk=function(ba){var v=ca(Vf(ba),4),C=v[0],U=v[1];var B=v[2];var oa=v[3],va=(C+B)/2,ja=(U+oa)/2;if(ki(ba))return B=tl(ba.points.map(function(Ia){Ia=ca(Ia,2);return Jf(Ia[0], Ia[1],va-ba.x,ja-ba.y,ba.angle)})),B=ca(B,4),[B[0]+ba.x,B[1]+ba.y,B[2]+ba.x,B[3]+ba.y];if(Dg(ba))B=function(Ia,Wa,$a){if(2>Ia.points.length||!kh.get(Ia)){var rb=Ia.points.reduce(function(Hb,Xb){var jc=ca(Xb,2);Xb=jc[0];jc=jc[1];var nc=ca(Jf(Ia.x+Xb,Ia.y+jc,Wa,$a,Ia.angle),2);return Xb=nc[0],jc=nc[1],Hb.minY=Math.min(Hb.minY,jc),Hb.minX=Math.min(Hb.minX,Xb),Hb.maxX=Math.max(Hb.maxX,Xb),Hb.maxY=Math.max(Hb.maxY,jc),Hb},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[rb.minX,rb.minY,rb.maxX,rb.maxY]}rb= kh.get(Ia);rb=Ik(rb[0]);return Mh(rb,function(Hb,Xb){return Jf(Ia.x+Hb,Ia.y+Xb,Wa,$a,Ia.angle)})}(ba,va,ja);else if("diamond"===ba.type){U=ca(Jf(va,U,va,ja,ba.angle),2);v=U[0];U=U[1];oa=ca(Jf(va,oa,va,ja,ba.angle),2);var xa=oa[0];oa=oa[1];var Aa=ca(Jf(C,ja,va,ja,ba.angle),2);C=Aa[0];Aa=Aa[1];var Ca=ca(Jf(B,ja,va,ja,ba.angle),2);B=Ca[0];Ca=Ca[1];B=[Math.min(v,xa,C,B),Math.min(U,oa,Aa,Ca),Math.max(v,xa,C,B),Math.max(U,oa,Aa,Ca)]}else"ellipse"===ba.type?(B=(B-C)/2,U=(oa-U)/2,xa=Math.cos(ba.angle),C= Math.sin(ba.angle),v=Math.hypot(B*xa,U*C),B=Math.hypot(U*xa,B*C),B=[va-v,ja-B,va+v,ja+B]):(xa=ca(Jf(C,U,va,ja,ba.angle),2),v=xa[0],xa=xa[1],Aa=ca(Jf(C,oa,va,ja,ba.angle),2),C=Aa[0],Aa=Aa[1],Ca=ca(Jf(B,oa,va,ja,ba.angle),2),oa=Ca[0],Ca=Ca[1],U=ca(Jf(B,U,va,ja,ba.angle),2),B=U[0],U=U[1],B=[Math.min(v,C,oa,B),Math.min(xa,Aa,Ca,U),Math.max(v,C,oa,B),Math.max(xa,Aa,Ca,U)]);return B},Bg=function(ba){if(!ba.length)return[0,0,0,0];var v=1/0,C=-1/0,U=1/0,B=-1/0;return ba.forEach(function(oa){oa=ca(gk(oa), 4);var va=oa[1],ja=oa[2],xa=oa[3];v=Math.min(v,oa[0]);U=Math.min(U,va);C=Math.max(C,ja);B=Math.max(B,xa)}),[v,U,C,B]},Re=function(ba,v,C){if(!Dg(ba)&&!ki(ba))return[ba.x,ba.y,ba.x+v,ba.y+C];v=lm(0,v,lm(1,C,ba.points));ki(ba)?v=tl(v):(C=Bj.generator(),v="sharp"===ba.strokeSharpness?C.linearPath(v,Yf(ba)):C.curve(v,Yf(ba)),v=Ik(v),v=Mh(v));v=ca(v,4);return[v[0]+ba.x,v[1]+ba.y,v[2]+ba.x,v[3]+ba.y]},ul=function(ba,v,C){var U=Bj.generator();v="sharp"===C?U.linearPath(v,Yf(ba)):U.curve(v,Yf(ba));v=Ik(v); v=ca(Mh(v),4);return[v[0]+ba.x,v[1]+ba.y,v[2]+ba.x,v[3]+ba.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(ba){return[mf.red[ba],mf.pink[ba],mf.grape[ba],mf.violet[ba],mf.indigo[ba],mf.blue[ba],mf.cyan[ba],mf.teal[ba],mf.green[ba],mf.lime[ba],mf.yellow[ba],mf.orange[ba]]},ri={canvasBackground:[mf.white,mf.gray[0],mf.gray[1]].concat(O($h(0))),elementBackground:["transparent",mf.gray[4],mf.gray[6]].concat(O($h(6))),elementStroke:[mf.black,mf.gray[8],mf.gray[7]].concat(O($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(ba){return"ArrowLeft"===ba||"ArrowRight"===ba||"ArrowDown"===ba||"ArrowUp"===ba},Nh=function(ba){return ba.charAt(0).toUpperCase()+ba.slice(1)},Dj=function(ba){return ba instanceof HTMLElement&&"wysiwyg"===ba.dataset.type||ba instanceof HTMLBRElement||ba instanceof HTMLTextAreaElement||ba instanceof HTMLInputElement&&("text"===ba.type||"number"===ba.type)},mm=function(ba){ba=ba.fontFamily;for(var v=0,C=Object.entries(Cc.ut);vjc.length)return null;var Xc="start"===nc?1:jc.length-1,Pc=jc[Xc].data,Zc=[Pc[4],Pc[5]],Dd=[Pc[2],Pc[3]],Yd=[Pc[0],Pc[1]];jc=jc[Xc-1];var md=[0,0];"move"===jc.op?md=jc.data:"bcurveTo"===jc.op&&(md=[jc.data[4],jc.data[5]]);Xc=function(pf,Ae){return Math.pow(1- pf,3)*Zc[Ae]+3*pf*Math.pow(1-pf,2)*Dd[Ae]+3*Math.pow(pf,2)*(1-pf)*Yd[Ae]+md[Ae]*Math.pow(pf,3)};jc=ca("start"===nc?md:Zc,2);nc=jc[0];jc=jc[1];Pc=[Xc(.3,0),Xc(.3,1)];Xc=Pc[0];Pc=Pc[1];var sd=Math.hypot(nc-Xc,jc-Pc);Xc=(nc-Xc)/sd;Pc=(jc-Pc)/sd;sd={arrow:30,bar:15,dot:15}[Tc];var Hd=0;if("arrow"===Tc){var He=ca(Xb.points[Xb.points.length-1],2);Hd=He[0];He=He[1];var Sg=ca(1 oa?Math.floor(Math.abs(ba.x-oa))*window.devicePixelRatio*C.value:0;va=ba.y>va?Math.floor(Math.abs(ba.y-va))*window.devicePixelRatio*C.value:0;v.translate(oa,va)}else U.width=ba.width*window.devicePixelRatio*C.value+B*C.value*2,U.height=ba.height*window.devicePixelRatio*C.value+B*C.value*2;v.save();v.translate(B*C.value,B*C.value);v.scale(window.devicePixelRatio*C.value,window.devicePixelRatio*C.value);B=Bj.canvas(U);C=(Sl(ba,B,v),v.restore(),{element:ba,canvas:U,canvasZoom:C.value,canvasOffsetX:oa, canvasOffsetY:va});return Xl.set(ba,C),C}return U},Dk=function(ba,v,C,U){v=ba.element;var B="freedraw"===v.type?12*v.strokeWidth:20,oa=ca(Vf(v),4),va=oa[0],ja=oa[1],xa=oa[2];oa=oa[3];ki(v)&&(va=Math.floor(va),xa=Math.ceil(xa),ja=Math.floor(ja),oa=Math.ceil(oa));var Aa=((va+xa)/2+U.scrollX)*window.devicePixelRatio;U=((ja+oa)/2+U.scrollY)*window.devicePixelRatio;C.save();C.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);C.translate(Aa,U);C.rotate(v.angle);C.drawImage(ba.canvas,-(xa-va)/2* window.devicePixelRatio-B*ba.canvasZoom/ba.canvasZoom,-(oa-ja)/2*window.devicePixelRatio-B*ba.canvasZoom/ba.canvasZoom,ba.canvas.width/ba.canvasZoom,ba.canvas.height/ba.canvasZoom);C.restore()},lh=function(ba,v,C,U,B){var oa=v.generator;switch(ba.type){case "selection":C.save();C.translate(ba.x+B.scrollX,ba.y+B.scrollY);C.fillStyle="rgba(0, 0, 255, 0.10)";C.fillRect(0,0,ba.width,ba.height);C.restore();break;case "freedraw":if(hi(ba,oa),U)ba=gh(ba,B),Dk(ba,0,C,B);else{oa=ca(Vf(ba),4);var va=oa[0]; U=oa[1];var ja=oa[2],xa=oa[3];oa=(va+ja)/2+B.scrollX;B=(U+xa)/2+B.scrollY;va=(ja-va)/2-(ba.x-va);U=(xa-U)/2-(ba.y-U);C.save();C.translate(oa,B);C.rotate(ba.angle);C.translate(-va,-U);Sl(ba,v,C);C.restore()}break;case "rectangle":case "diamond":case "ellipse":case "line":case "arrow":case "text":(hi(ba,oa),U)?(ba=gh(ba,B),Dk(ba,0,C,B)):(oa=ca(Vf(ba),4),va=oa[0],U=oa[1],ja=oa[2],xa=oa[3],oa=(va+ja)/2+B.scrollX,B=(U+xa)/2+B.scrollY,va=(ja-va)/2-(ba.x-va),U=(xa-U)/2-(ba.y-U),C.save(),C.translate(oa,B), C.rotate(ba.angle),C.translate(-va,-U),Sl(ba,v,C),C.restore());break;default:throw Error("Unimplemented type ".concat(ba.type));}},Li=function(ba,v,C){if(void 0===C)return ba.draw(v);v={sets:v.sets,shape:v.shape,options:yg(yg({},v.options),{},{fixedDecimalPlaceDigits:C})};return ba.draw(v)},Bf=function(ba,v,C,U,B){var oa=ca(Vf(ba),4),va=oa[0],ja=oa[1],xa=(oa[2]-va)/2-(ba.x-va),Aa=(oa[3]-ja)/2-(ba.y-ja),Ca=180*ba.angle/Math.PI;oa=v.generator;switch(ba.type){case "selection":throw Error("Selection rendering is not supported for SVG"); case "rectangle":case "diamond":case "ellipse":hi(ba,oa);oa=Li(v,kh.get(ba),Cc.zK);va=ba.opacity/100;1!==va&&(oa.setAttribute("stroke-opacity","".concat(va)),oa.setAttribute("fill-opacity","".concat(va)));oa.setAttribute("stroke-linecap","round");oa.setAttribute("transform","translate(".concat(U||0," ").concat(B||0,") rotate(").concat(Ca," ").concat(xa," ").concat(Aa,")"));C.appendChild(oa);break;case "line":case "arrow":hi(ba,oa);var Ia=C.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "g"),Wa=ba.opacity/100;Ia.setAttribute("stroke-linecap","round");kh.get(ba).forEach(function(Tc){Tc=Li(v,Tc,Cc.zK);1!==Wa&&(Tc.setAttribute("stroke-opacity","".concat(Wa)),Tc.setAttribute("fill-opacity","".concat(Wa)));Tc.setAttribute("transform","translate(".concat(U||0," ").concat(B||0,") rotate(").concat(Ca," ").concat(xa," ").concat(Aa,")"));"line"===ba.type&&qj(ba.points)&&"transparent"!==ba.backgroundColor&&Tc.setAttribute("fill-rule","evenodd");Ia.appendChild(Tc)});C.appendChild(Ia);break; case "freedraw":xg(ba);va=ba.opacity/100;oa=C.ownerDocument.createElementNS("http://www.w3.org/2000/svg","g");1!==va&&(oa.setAttribute("stroke-opacity","".concat(va)),oa.setAttribute("fill-opacity","".concat(va)));oa.setAttribute("transform","translate(".concat(U||0," ").concat(B||0,") rotate(").concat(Ca," ").concat(xa," ").concat(Aa,")"));va=C.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("stroke","none");oa.setAttribute("fill",ba.strokeColor);va.setAttribute("d", Se(ba));oa.appendChild(va);C.appendChild(oa);break;default:if(!Xg(ba))throw Error("Unimplemented type ".concat(ba.type));va=ba.opacity/100;oa=C.ownerDocument.createElementNS("http://www.w3.org/2000/svg","g");1!==va&&(oa.setAttribute("stroke-opacity","".concat(va)),oa.setAttribute("fill-opacity","".concat(va)));oa.setAttribute("transform","translate(".concat(U||0," ").concat(B||0,") rotate(").concat(Ca," ").concat(xa," ").concat(Aa,")"));va=ba.text.replace(/\r\n?/g,"\n").split("\n");ja=ba.height/va.length; for(var $a=ba.height-ba.baseline,rb="center"===ba.textAlign?ba.width/2:"right"===ba.textAlign?ba.width:0,Hb=ik.test(ba.text)?"rtl":"ltr",Xb="center"===ba.textAlign?"middle":"right"===ba.textAlign||"rtl"===Hb?"end":"start",jc=0;jc ba.points.length:0===ba.width&&0===ba.height},mk=function(ba,v,C){var U=Math.abs(v),B=Math.abs(C);"line"===ba||"arrow"===ba||"freedraw"===ba?(ba=Math.round(Math.atan(B/U)/Cc.ay)*Cc.ay,0===ba?C=0:ba===Math.PI/2?v=0:C=Math.round(U*Math.tan(ba))*Math.sign(C)||C):"selection"!==ba&&(C=U*Math.sign(C));return{width:v,height:C}},Rj=function(ba){var v={width:ba.width,height:ba.height,x:ba.x,y:ba.y};if(0>ba.width){var C=Math.abs(ba.width);v.width=C;v.x=ba.x-C}0>ba.height&&(C=Math.abs(ba.height),v.height=C, v.y=ba.y-C);return v},Pf=function(ba,v,C){C=C.filter(function(U){return U.groupIds.includes(ba)});return 2>C.length?v.selectedGroupIds[ba]||v.editingGroupId===ba?tc(tc({},v),{},{selectedGroupIds:tc(tc({},v.selectedGroupIds),{},T({},ba,!1)),editingGroupId:null}):v:tc(tc({},v),{},{selectedGroupIds:tc(tc({},v.selectedGroupIds),{},T({},ba,!0)),selectedElementIds:tc(tc({},v.selectedElementIds),Object.fromEntries(C.map(function(U){return[U.id,!0]})))})},dh=function(ba,v){return v.groupIds.filter(function(C){return C!== ba.editingGroupId}).find(function(C){return ba.selectedGroupIds[C]})},vi=function(ba){return Object.entries(ba.selectedGroupIds).filter(function(v){v=ca(v,2);v[0];return v[1]}).map(function(v){v=ca(v,2);var C=v[0];v[1];return C})},Me=function(ba,v){var C=tc(tc({},ba),{},{selectedGroupIds:{}}),U=Sf(v,ba);if(!U.length)return tc(tc({},C),{},{editingGroupId:null});var B;U=nb(U);try{for(U.s();!(B=U.n()).done;){var oa=B.value.groupIds;if(ba.editingGroupId){var va=oa.indexOf(ba.editingGroupId);-1Pc&&(Aa.n||(Xc.n=af(va+Hb/2-Ia/2,ja-Tc-rb+Ca,Ia,Wa,jc,nc,C)),Aa.s||(Xc.s=af(va+Hb/2-Ia/2,oa+Tc-Ca,Ia,Wa,jc,nc,C))),Math.abs(Xb)>Pc&&(Aa.w||(Xc.w=af(va-Tc-$a+Ca,ja+Xb/2-Wa/2,Ia,Wa, jc,nc,C)),Aa.e||(Xc.e=af(xa+Tc-Ca,ja+Xb/2-Wa/2,Ia,Wa,jc,nc,C))),Xc},Tk=function(v,C){var U=2oa[1]?B=Qj:0oa[0]&&0oa[0]&&0>oa[1]&&(B=Uf)}}else"text"===v.type&&(B=Nm);return Jg(Vf(v),v.angle,C,U,B)},th=function(v,C){return[0,0,0,0,C,v,1,0]},uh=function(){var v= 0C||7v[6]?-1:1)/C)},yf=(uh(1,1),uh(1,2),uh(1,3),uh(1,4),uh(1,5),uh(1,6),uh(1,7),function(v,C,U){return Lf([0,U,v,C,0,0,0,0])}),Ci=function(v,C){return U=v,[(B=C)[0]*U[0]+B[2]*U[2]+B[3]*U[3]-B[6]*U[6],B[1]*U[0]+B[0]*U[1]-B[4]*U[2]+B[5]*U[3]+B[2]*U[4]-B[3]*U[5]-B[7]*U[6]-B[6]*U[7],B[2]*U[0]+B[0]*U[2]-B[6]*U[3]+B[3]*U[6],B[3]*U[0]+B[6]*U[2]+B[0]*U[3]-B[2]*U[6],B[4]*U[0]+B[7]*U[3]+B[0]*U[4]+B[3]*U[7],B[5]*U[0]+B[7]*U[2]+B[0]*U[5]+B[2]*U[7],B[6]*U[0]+B[0]*U[6],B[7]*U[0]+B[0]*U[7]];var U,B}, Gh=function(v){v=ca(v,2);return[0,0,0,0,v[1],v[0],1,0]},Zh=function(v){return[v[5],v[4]]},Mk=function(v,C){return U=Ug(v,Math.sin(C/2)),B=Math.cos(C/2),"number"==typeof B?[U[0]+B,U[1],U[2],U[3],U[4],U[5],U[6],U[7]]:[U[0]+B[0],U[1]+B[1],U[2]+B[2],U[3]+B[3],U[4]+B[4],U[5]+B[5],U[6]+B[6],U[7]+B[7]];var U,B},Bh=function(v,C){return Lf(Ug(Ug(v,C),uk(v)))},Xi=function(v,C,U,B){var oa=10/C.zoom.value;return!Nk(v,C,[U,B])&&eg(v,[U,B],oa)},Nk=function(v,C,U){C=10/C.zoom.value;if("text"===v.type)var B=yk;else"arrow"=== v.type?B=!1:"freedraw"===v.type?B=!0:(B="transparent"!==v.backgroundColor,B="line"===v.type?B&&qj(v.points):B),B=B?vk:gm;return hj({element:v,point:U,threshold:C,check:B})},eg=function(v,C,U){C=ca(C,2);var B=C[0],oa=C[1],va=ca(Vf(v),4);C=va[0];var ja=va[1],xa=va[2];va=va[3];B=ca(Jf(B,oa,(C+xa)/2,(ja+va)/2,-v.angle),2);v=B[0];B=B[1];return v>C-U&&vja-U&&BAa?va:CaAa?oa:xa,Math.hypot(U- xa[1],B-xa[0])v},vk=function(v,C){return v< C},gm=function(v,C){return Math.abs(v)=$a)xa=[];else{$a=Math.sqrt($a);var rb=ja*Aa* Aa-Wa*xa*Aa-xa*Ca;Ca=Wa*xa*xa-ja*xa*Aa-Aa*Ca;xa=[th((rb+Aa*$a)/Ia,(Ca-xa*$a)/Ia),th((rb-Aa*$a)/Ia,(Ca+xa*$a)/Ia)]}}return xa}));break;case "ellipse":va=Hh(v,B,C)}if(2>va.length)return[];va=va.sort(function(ja,xa){return lk(Ki(ja,U))-lk(Ki(xa,U))});return[va[0],va[va.length-1]]},Sh=function(v){var C=1=ja)return[];ja=Math.sqrt(ja);var xa=-B*B*C*va;va*=-v*v*oa;return[th((xa+B*v*oa*ja)/U,(va-B*v*C*ja)/U),th((xa-B*v*oa*ja)/U,(va+B*v*C*ja)/U)]},wi=function(v,C,U){var B=Math.sign(C),oa=0,va=null;return Sh(v,Math.abs(C)).forEach(function(ja){var xa=B*Lf(Ki(ja,U))[1];xa>oa&&(oa=xa,va=ja)}),va},tj=function(v,C,U,B){var oa=[0,0];return Ik(v).some(function(va, ja){ja=va.op;var xa=va.data;if("move"===ja)oa=xa;else if("bcurveTo"===ja){va=[xa[0],xa[1]];ja=[xa[2],xa[3]];xa=[xa[4],xa[5]];var Aa=oa;return oa=xa,function(Ca,Ia,Wa,$a,rb,Hb){var Xb=ca(rb,2);rb=Xb[0];Xb=Xb[1];for(var jc=function(Pc,Zc){return Math.pow(1-Pc,3)*$a[Zc]+3*Pc*Math.pow(1-Pc,2)*Wa[Zc]+3*Math.pow(Pc,2)*(1-Pc)*Ia[Zc]+Ca[Zc]*Math.pow(Pc,3)},nc=0;1>=nc;){var Tc=jc(nc,0),Xc=jc(nc,1);if(Math.sqrt(Math.pow(Tc-rb,2)+Math.pow(Xc-Xb,2))=v[0]&&C<=v[0]+v[2]&&U>=v[1]&&U<=v[1]+v[3]},fh=function(v,C,U,B,oa,va){return v.reduce(function(ja,xa){return ja?ja:(ja=function(Aa,Ca,Ia,Wa,$a,rb){if(!Ca.selectedElementIds[Aa.id])return!1;Aa=Tk(Aa,$a,rb);Ca=Aa.rotation;var Hb=ab(Aa,xk);if(Ca&&Sj(Ca,Ia,Wa))return"rotation";Aa=Object.keys(Hb).filter(function(Xb){Xb=Hb[Xb];return!!Xb&&Sj(Xb,Ia,Wa)});return 0U?C.points.length+U:U;U=ca(Vf(C),4);B=C.points[B];return Jf(C.x+B[0],C.y+B[1],(U[0]+U[2])/2,(U[1]+U[3])/2,C.angle)}},{key:"pointFromAbsoluteCoords",value:function(C,U){var B=ca(Vf(C),4);U=ca(Jf(U[0],U[1],(B[0]+B[2])/2,(B[1]+B[3])/2,-C.angle),2);return[U[0]-C.x,U[1]-C.y]}},{key:"getPointIndexUnderCursor", value:function(C,U,B,oa){C=this.getPointsGlobalCoordinates(C);for(var va=C.length;-1<--va;){var ja=C[va];if(Math.hypot(ja[0]-B,ja[1]-oa)*U.valuev.points.length},Ad=function(v){v.forEach(function(C){Wg(C)&&Nd(C,null,null)})},hg=function(v,C){return la(C.getElements(),function(U){return Ze(U)&&Uk(U,v)})},hd=function(v,C,U){var B="start"===U?-1:1;U=-1===B?0:v.points.length-1;B=U-B;U=fd.getPointAtIndexGlobalCoordinates(v,U);B=fd.getPointAtIndexGlobalCoordinates(v,B);a:{v=fm(C);B=Bh(v,Gh(B));v=Bh(v,Gh(U));var oa=Lf(Ki(v,B));v=C.height/C.width;B=C.width/2;var va=C.height/2,ja=oa[2],xa=oa[3];oa=oa[1];var Aa=Math.abs(xa), Ca=Math.abs(ja);switch(C.type){case "rectangle":case "text":v=oa/(B*(Ca+v*Aa));break a;case "diamond":v=Aa=2*Math.PI?v-2*Math.PI:v},ok=function(v,C,U){return Dg(v)||ki(v)?{points:lm(0,C,lm(1,U,v.points))}:{}},fg=function(v,C,U){C=C/v.width*v.fontSize;if(1>C)return null;v=Vl(v.text,jk({fontSize:C,fontFamily:v.fontFamily}));return{size:C,baseline:v.baseline+(U-v.height)}},Fi=function(v,C,U,B,oa,va,ja){var xa=ca(Re(v,v.width,v.height),4),Aa= [xa[0],xa[1]],Ca=[xa[2],xa[3]];xa=[(Aa[0]+Ca[0])/2,(Aa[1]+Ca[1])/2];var Ia=Df([va,ja],xa,-v.angle);va=ca(Re(U,U.width,U.height),4);var Wa=va[2]-va[0],$a=va[3]-va[1];va=(Ca[0]-Aa[0])/Wa;ja=(Ca[1]-Aa[1])/$a;B.includes("e")&&(va=(Ia[0]-Aa[0])/Wa);B.includes("s")&&(ja=(Ia[1]-Aa[1])/$a);B.includes("w")&&(va=(Ca[0]-Ia[0])/Wa);B.includes("n")&&(ja=(Ca[1]-Ia[1])/$a);Ia=v.width;Wa=v.height;va*=U.width;ja*=U.height;if(oa&&(va=2*va-Ia,ja=2*ja-Wa),C){$a=Math.abs(va)/Ia;var rb=Math.abs(ja)/Wa;if(1===B.length&& (ja*=$a,va*=rb),2===B.length)$a=Math.max($a,rb),va=Ia*$a*Math.sign(va),ja=Wa*$a*Math.sign(ja)}rb=ca(Re(v,va,ja),4);Ia=rb[0];Wa=rb[1];$a=rb[2]-Ia;rb=rb[3]-Wa;var Hb=[].concat(Aa);if(["n","w","nw"].includes(B)&&(Hb=[Ca[0]-Math.abs($a),Ca[1]-Math.abs(rb)]),"ne"===B)Hb=[Aa[0],Ca[1]],Hb=[Hb[0],Hb[1]-Math.abs(rb)];"sw"===B&&(Aa=[Ca[0],Aa[1]],Hb=[Aa[0]-Math.abs($a),Aa[1]]);C&&(["s","n"].includes(B)&&(Hb[0]=xa[0]-$a/2),["e","w"].includes(B)&&(Hb[1]=xa[1]-rb/2));0>va&&(B.includes("e")&&(Hb[0]-=Math.abs($a)), B.includes("w")&&(Hb[0]+=Math.abs($a)));0>ja&&(B.includes("s")&&(Hb[1]-=Math.abs(rb)),B.includes("n")&&(Hb[1]+=Math.abs(rb)));oa&&(Hb[0]=xa[0]-Math.abs($a)/2,Hb[1]=xa[1]-Math.abs(rb)/2);C=v.angle;B=Df(Hb,xa,C);xa=Df([Hb[0]+Math.abs($a)/2,Hb[1]+Math.abs(rb)/2],xa,C);Hb=Df(B,xa,-C);xa=ok(v,va,ja);C=O(Hb);C[0]+=v.x-Ia;C[1]+=v.y-Wa;v=jd({width:Math.abs(va),height:Math.abs(ja),x:C[0],y:C[1]},xa);0!==v.width&&0!==v.height&&Number.isFinite(v.x)&&Number.isFinite(v.y)&&(Di(U,{newSize:{width:v.width,height:v.height}}), le(U,v))},Hm=function(v,C,U,B){var oa=ca(Bg(v),4),va=oa[0],ja=oa[1],xa=oa[2],Aa=oa[3];switch(C){case "se":var Ca=Math.max((U-va)/(xa-va),(B-ja)/(Aa-ja));var Ia=function($a,rb,Hb){var Xb=ca(rb,2);rb=Xb[0];Xb=Xb[1];Hb=ca(Hb,2);return{x:$a.x+(rb-va)*(Ca-1)+rb-Hb[0],y:$a.y+(Xb-ja)*(Ca-1)+Xb-Hb[1]}};break;case "nw":Ca=Math.max((xa-U)/(xa-va),(Aa-B)/(Aa-ja));Ia=function($a,rb,Hb){var Xb=ca(rb,4);rb=Xb[2];Xb=Xb[3];Hb=ca(Hb,4);return{x:$a.x-(xa-rb)*(Ca-1)+rb-Hb[2],y:$a.y-(Aa-Xb)*(Ca-1)+Xb-Hb[3]}};break;case "ne":Ca= Math.max((U-va)/(xa-va),(Aa-B)/(Aa-ja));Ia=function($a,rb,Hb){var Xb=ca(rb,4);rb=Xb[0];Xb=Xb[3];Hb=ca(Hb,4);return{x:$a.x+(rb-va)*(Ca-1)+rb-Hb[0],y:$a.y-(Aa-Xb)*(Ca-1)+Xb-Hb[3]}};break;case "sw":Ca=Math.max((xa-U)/(xa-va),(B-ja)/(Aa-ja)),Ia=function($a,rb,Hb){var Xb=ca(rb,3);rb=Xb[1];Xb=Xb[2];Hb=ca(Hb,3);return{x:$a.x-(xa-Xb)*(Ca-1)+Xb-Hb[2],y:$a.y+(rb-ja)*(Ca-1)+rb-Hb[1]}}}if(0(xa=C.height)&&(xa=-xa));oa=oaja.width||Ca-Ia>ja.height})(C,0,[U,oa,va,B])&&(v=function(ja,xa){if(!ja.length)return[0,0,0,0];var Aa=1/0,Ca=ja[0];return ja.forEach(function(Ia){var Wa=ca(gk(Ia),4);Wa=Math.hypot(xa.x-(Wa[0]+Wa[2])/2,xa.y-(Wa[1]+Wa[3])/2);Waja.points.length)return v=v.filter(function(xa){return xa.id!==ja.id}),{elements:v,appState:ob(ob({},Uo(C,v)),{},{editingLinearElement:null}),commitToHistory:!1};U={startBindingElement:0===B?null:oa,endBindingElement:B===ja.points.length-1?null:va};return fd.movePoint(ja,B,"delete"),{elements:v,appState:ob(ob({},C),{},{editingLinearElement:ob(ob(ob({},C.editingLinearElement),U),{},{activePointIndex:0Aa&&(Aa=ja.length+Aa);for(Aa=Math.min(ja.length-1,Math.max(Aa,0))+1;-1<--Aa;)if(xa(ja[Aa],Aa,ja))return Aa;return-1}(C,va,Math.max(0,U-1)):function(ja,xa){var Aa=2Aa&&(Aa=ja.length+Aa);for(Aa=Math.min(ja.length,Math.max(Aa,0))-1;++Aa$a&&(xa.style.left="".concat($a-Ia,"px"));Aa=window.innerHeight;Ca+Wa>Aa&&(xa.style.top="".concat(Aa-Wa,"px"))}},[va]),(0,ve.useEffect)(function(){if(oa){var xa=function(Aa){var Ca;null!==(Ca=ja.current)&&void 0!==Ca&&Ca.contains(Aa.target)||(0,rh.unstable_batchedUpdates)(function(){return oa(Aa)})};return document.addEventListener("pointerdown", xa,!1),function(){return document.removeEventListener("pointerdown",xa,!1)}}},[oa]),(0,Va.jsx)("div",{className:"popover",style:{top:B,left:U},ref:ja,children:C})}),kb=(e(4220),function(v){var C=(new Option).style;return C.color=v,!!C.color}),Gb=[["1","2","3","4","5"],["q","w","e","r","t"],["a","s","d","f","g"]].flat(),Rb=function(v){var C=v.colors,U=v.color,B=v.onChange,oa=v.onClose,va=v.label,ja=v.showInput,xa=void 0===ja||ja;v=v.type;var Aa=de().useRef(),Ca=de().useRef(),Ia=de().useRef(),Wa=de().useRef(); de().useEffect(function(){Ca.current?Ca.current.focus():Wa.current?Wa.current.focus():Ia.current&&Ia.current.focus()},[]);return(0,Va.jsxs)("div",{className:"color-picker color-picker-type-".concat(v),role:"dialog","aria-modal":"true","aria-label":$b("labels.colorPicker"),onKeyDown:function($a){if("Tab"===$a.key){var rb,Hb=document.activeElement;if($a.shiftKey)Hb===Aa.current&&(null===(rb=Wa.current)||void 0===rb||rb.focus(),$a.preventDefault());else if(Hb===Wa.current){var Xb;null===(Xb=Aa.current)|| void 0===Xb||Xb.focus();$a.preventDefault()}}else oh($a.key)?(rb=Cg.rtl,Hb=Array.prototype.indexOf.call(Ia.current.children,document.activeElement),-1!==Hb&&(Xb=Ia.current.children.length-(xa?1:0),Ia.current.children[$a.key===(rb?"ArrowLeft":"ArrowRight")?(Hb+1)%Xb:$a.key===(rb?"ArrowRight":"ArrowLeft")?(Xb+Hb-1)%Xb:"ArrowDown"===$a.key?(Hb+5)%Xb:"ArrowUp"===$a.key?(Xb+Hb-5)%Xb:Hb].focus()),$a.preventDefault()):Gb.includes($a.key.toLowerCase())&&!Dj($a.target)?(rb=Gb.indexOf($a.key.toLowerCase()), Ia.current.children[rb].focus(),$a.preventDefault()):"Escape"!==$a.key&&"Enter"!==$a.key||($a.preventDefault(),oa());$a.nativeEvent.stopImmediatePropagation();$a.stopPropagation()},children:[(0,Va.jsx)("div",{className:"color-picker-triangle color-picker-triangle-shadow"}),(0,Va.jsx)("div",{className:"color-picker-triangle"}),(0,Va.jsxs)("div",{className:"color-picker-content",ref:function($a){$a&&(Ia.current=$a)},tabIndex:0,children:[C.map(function($a,rb){var Hb=$a.replace("#","");return(0,Va.jsxs)("button", {className:"color-picker-swatch",onClick:function(Xb){Xb.currentTarget.focus();B($a)},title:"".concat($b("colors.".concat(Hb))).concat(Ri($a)?"":" (".concat($a,")")," — ").concat(Gb[rb].toUpperCase()),"aria-label":$b("colors.".concat(Hb)),"aria-keyshortcuts":Gb[rb],style:{color:$a},ref:function(Xb){Xb&&0===rb&&(Aa.current=Xb);Xb&&$a===U&&(Ca.current=Xb)},onFocus:function(){B($a)},children:[Ri($a)?(0,Va.jsx)("div",{className:"color-picker-transparent"}):void 0,(0,Va.jsx)("span",{className:"color-picker-keybinding", children:Gb[rb]})]},$a)}),xa&&(0,Va.jsx)(uc,{color:U,label:va,onChange:function($a){B($a)},ref:Wa})]})]})},uc=de().forwardRef(function(v,C){var U=v.color,B=v.onChange;v=v.label;var oa=ca(de().useState(U),2),va=oa[0],ja=oa[1],xa=de().useRef(null);de().useEffect(function(){ja(U)},[U]);de().useImperativeHandle(C,function(){return xa.current});var Aa=de().useCallback(function(Ca){Ca=Ca.toLowerCase();var Ia;(Ia=Ri(Ca)||kb(Ca)?Ca:kb("#".concat(Ca))?"#".concat(Ca):null)&&B(Ia);ja(Ca)},[B]);return(0,Va.jsxs)("label", {className:"color-input-container",children:[(0,Va.jsx)("div",{className:"color-picker-hash",children:"#"}),(0,Va.jsx)("input",{spellCheck:!1,className:"color-picker-input","aria-label":v,onChange:function(Ca){return Aa(Ca.target.value)},value:(va||"").replace(/^#/,""),onBlur:function(){return ja(U)},ref:xa})]})}),Ic=function(v){var C=v.type,U=v.color,B=v.onChange,oa=v.label,va=v.isActive,ja=v.setActive,xa=de().useRef(null);return(0,Va.jsxs)("div",{children:[(0,Va.jsxs)("div",{className:"color-picker-control-container", children:[(0,Va.jsx)("button",{className:"color-picker-label-swatch","aria-label":oa,style:U?{"--swatch-color":U}:void 0,onClick:function(){return ja(!va)},ref:xa}),(0,Va.jsx)(uc,{color:U,label:oa,onChange:function(Aa){B(Aa)}})]}),(0,Va.jsx)(de().Suspense,{fallback:"",children:va?(0,Va.jsx)(Ga,{onCloseRequest:function(Aa){return Aa.target!==xa.current&&ja(!1)},children:(0,Va.jsx)(Rb,{colors:ri[C],color:U||null,onChange:function(Aa){B(Aa)},onClose:function(){var Aa;ja(!1);null===(Aa=xa.current)||void 0=== Aa||Aa.focus()},label:oa,showInput:!1,type:C})}):null})]})};e(7117);var Oc=function(v,C,U){return v.map(function(B){var oa;return C.selectedElementIds[B.id]||B.id===(null===(oa=C.editingElement)||void 0===oa?void 0:oa.id)?U(B):B})},cd=function(v,C,U,B){var oa,va,ja=C.editingElement;v=pe(v);return null!==(oa=null!==(va=ja&&U(ja))&&void 0!==va?va:vh(v,C)?function(xa,Aa,Ca){xa=Array.from(new Set(Sf(xa,Aa).map(function(Ia){return Ca(Ia)})));return 1===xa.length?xa[0]:null}(v,C,U):B)&&void 0!==oa?oa:null}, Bd=(ye({name:"changeStrokeColor",perform:function(v,C,U){return qd(qd({},U.currentItemStrokeColor&&{elements:Oc(v,C,function(B){return cf(B,{strokeColor:U.currentItemStrokeColor})})}),{},{appState:qd(qd({},C),U),commitToHistory:!!U.currentItemStrokeColor})},PanelComponent:function(v){var C=v.elements,U=v.appState,B=v.updateData;return(0,Va.jsxs)(Va.Fragment,{children:[(0,Va.jsx)("h3",{"aria-hidden":"true",children:$b("labels.stroke")}),(0,Va.jsx)(Ic,{type:"elementStroke",label:$b("labels.stroke"), color:cd(C,U,function(oa){return oa.strokeColor},U.currentItemStrokeColor),onChange:function(oa){return B({currentItemStrokeColor:oa})},isActive:"strokeColorPicker"===U.openPopup,setActive:function(oa){return B({openPopup:oa?"strokeColorPicker":null})}})]})}}),ye({name:"changeBackgroundColor",perform:function(v,C,U){return qd(qd({},U.currentItemBackgroundColor&&{elements:Oc(v,C,function(B){return cf(B,{backgroundColor:U.currentItemBackgroundColor})})}),{},{appState:qd(qd({},C),U),commitToHistory:!!U.currentItemBackgroundColor})}, PanelComponent:function(v){var C=v.elements,U=v.appState,B=v.updateData;return(0,Va.jsxs)(Va.Fragment,{children:[(0,Va.jsx)("h3",{"aria-hidden":"true",children:$b("labels.background")}),(0,Va.jsx)(Ic,{type:"elementBackground",label:$b("labels.background"),color:cd(C,U,function(oa){return oa.backgroundColor},U.currentItemBackgroundColor),onChange:function(oa){return B({currentItemBackgroundColor:oa})},isActive:"backgroundColorPicker"===U.openPopup,setActive:function(oa){return B({openPopup:oa?"backgroundColorPicker": null})}})]})}}),ye({name:"changeFillStyle",perform:function(v,C,U){return{elements:Oc(v,C,function(B){return cf(B,{fillStyle:U})}),appState:qd(qd({},C),{},{currentItemFillStyle:U}),commitToHistory:!0}},PanelComponent:function(v){var C=v.elements,U=v.appState,B=v.updateData;return(0,Va.jsxs)("fieldset",{children:[(0,Va.jsx)("legend",{children:$b("labels.fill")}),(0,Va.jsx)(na,{options:[{value:"hachure",text:$b("labels.hachure"),icon:(0,Va.jsx)(im,{theme:U.theme})},{value:"cross-hatch",text:$b("labels.crossHatch"), icon:(0,Va.jsx)(Qm,{theme:U.theme})},{value:"solid",text:$b("labels.solid"),icon:(0,Va.jsx)(Cm,{theme:U.theme})}],group:"fill",value:cd(C,U,function(oa){return oa.fillStyle},U.currentItemFillStyle),onChange:function(oa){B(oa)}})]})}}),ye({name:"changeStrokeWidth",perform:function(v,C,U){return{elements:Oc(v,C,function(B){return cf(B,{strokeWidth:U})}),appState:qd(qd({},C),{},{currentItemStrokeWidth:U}),commitToHistory:!0}},PanelComponent:function(v){var C=v.elements,U=v.appState,B=v.updateData;return(0,Va.jsxs)("fieldset", {children:[(0,Va.jsx)("legend",{children:$b("labels.strokeWidth")}),(0,Va.jsx)(na,{group:"stroke-width",options:[{value:1,text:$b("labels.thin"),icon:(0,Va.jsx)(bo,{theme:U.theme,strokeWidth:2})},{value:2,text:$b("labels.bold"),icon:(0,Va.jsx)(bo,{theme:U.theme,strokeWidth:6})},{value:4,text:$b("labels.extraBold"),icon:(0,Va.jsx)(bo,{theme:U.theme,strokeWidth:10})}],value:cd(C,U,function(oa){return oa.strokeWidth},U.currentItemStrokeWidth),onChange:function(oa){return B(oa)}})]})}}),ye({name:"changeSloppiness", perform:function(v,C,U){return{elements:Oc(v,C,function(B){return cf(B,{seed:yl(),roughness:U})}),appState:qd(qd({},C),{},{currentItemRoughness:U}),commitToHistory:!0}},PanelComponent:function(v){var C=v.elements,U=v.appState,B=v.updateData;return(0,Va.jsxs)("fieldset",{children:[(0,Va.jsx)("legend",{children:$b("labels.sloppiness")}),(0,Va.jsx)(na,{group:"sloppiness",options:[{value:0,text:$b("labels.architect"),icon:(0,Va.jsx)(Zo,{theme:U.theme})},{value:1,text:$b("labels.artist"),icon:(0,Va.jsx)(lo, {theme:U.theme})},{value:2,text:$b("labels.cartoonist"),icon:(0,Va.jsx)(jm,{theme:U.theme})}],value:cd(C,U,function(oa){return oa.roughness},U.currentItemRoughness),onChange:function(oa){return B(oa)}})]})}}),ye({name:"changeStrokeStyle",perform:function(v,C,U){return{elements:Oc(v,C,function(B){return cf(B,{strokeStyle:U})}),appState:qd(qd({},C),{},{currentItemStrokeStyle:U}),commitToHistory:!0}},PanelComponent:function(v){var C=v.elements,U=v.appState,B=v.updateData;return(0,Va.jsxs)("fieldset", {children:[(0,Va.jsx)("legend",{children:$b("labels.strokeStyle")}),(0,Va.jsx)(na,{group:"strokeStyle",options:[{value:"solid",text:$b("labels.strokeStyle_solid"),icon:(0,Va.jsx)(Bn,{theme:U.theme})},{value:"dashed",text:$b("labels.strokeStyle_dashed"),icon:(0,Va.jsx)(co,{theme:U.theme})},{value:"dotted",text:$b("labels.strokeStyle_dotted"),icon:(0,Va.jsx)(Fj,{theme:U.theme})}],value:cd(C,U,function(oa){return oa.strokeStyle},U.currentItemStrokeStyle),onChange:function(oa){return B(oa)}})]})}}),ye({name:"changeOpacity", perform:function(v,C,U){return{elements:Oc(v,C,function(B){return cf(B,{opacity:U})}),appState:qd(qd({},C),{},{currentItemOpacity:U}),commitToHistory:!0}},PanelComponent:function(v){var C,U=v.elements,B=v.appState,oa=v.updateData;return(0,Va.jsxs)("label",{className:"control-label",children:[$b("labels.opacity"),(0,Va.jsx)("input",{type:"range",min:"0",max:"100",step:"10",onChange:function(va){return oa(+va.target.value)},onWheel:function(va){va.stopPropagation();var ja=+va.target.value;0>va.deltaY&& 100>ja?oa(ja+10):0=Wa?xa+Ia-Wa:0;Ca=va+5;Object.assign(oa.style,{top:"".concat(Ca-(Ca+ja>=window.innerHeight?va-Aa+ja+10:0),"px"),left:"".concat(xa-Ia,"px")})},onPointerLeave:function(){return se().classList.remove("excalidraw-tooltip--visible")},children:C})};ye({name:"changeViewBackgroundColor", perform:function(v,C,U){return{appState:Sd(Sd({},C),U),commitToHistory:!!U.viewBackgroundColor}},PanelComponent:function(v){var C=v.appState,U=v.updateData;return(0,Va.jsx)("div",{style:{position:"relative"},children:(0,Va.jsx)(Ic,{label:$b("labels.canvasBackground"),type:"canvasBackground",color:C.viewBackgroundColor,onChange:function(B){return U({viewBackgroundColor:B})},isActive:"canvasColorPicker"===C.openPopup,setActive:function(B){return U({openPopup:B?"canvasColorPicker":null})},"data-testid":"canvas-background-picker"})})}}); ye({name:"clearCanvas",perform:function(v,C){return{elements:v.map(function(U){return cf(U,{isDeleted:!0})}),appState:Sd(Sd({},Ij()),{},{theme:C.theme,elementLocked:C.elementLocked,exportBackground:C.exportBackground,exportEmbedScene:C.exportEmbedScene,gridSize:C.gridSize,showStats:C.showStats,pasteDialog:C.pasteDialog}),commitToHistory:!0}},PanelComponent:function(v){var C=v.updateData;return(0,Va.jsx)(Ha,{type:"button",icon:ce,title:$b("buttons.clearReset"),"aria-label":$b("buttons.clearReset"), showAriaLabel:om(),onClick:function(){window.confirm($b("alerts.clearReset"))&&C(null)},"data-testid":"clear-canvas-button"})}});ye({name:"zoomIn",perform:function(v,C){v=ha(ua(C.zoom.value+Cc.V4),C.zoom,{left:C.offsetLeft,top:C.offsetTop},{x:C.width/2,y:C.height/2});return{appState:Sd(Sd({},C),{},{zoom:v}),commitToHistory:!1}},PanelComponent:function(v){var C=v.updateData;return(0,Va.jsx)(Ha,{type:"button",icon:Ag,title:"".concat($b("buttons.zoomIn")," — ").concat(Vd("CtrlOrCmd++")),"aria-label":$b("buttons.zoomIn"), onClick:function(){C(null)},size:"small"})},keyTest:function(v){return("Equal"===v.code||"NumpadAdd"===v.code)&&(v[Af]||v.shiftKey)}});ye({name:"zoomOut",perform:function(v,C){v=ha(ua(C.zoom.value-Cc.V4),C.zoom,{left:C.offsetLeft,top:C.offsetTop},{x:C.width/2,y:C.height/2});return{appState:Sd(Sd({},C),{},{zoom:v}),commitToHistory:!1}},PanelComponent:function(v){var C=v.updateData;return(0,Va.jsx)(Ha,{type:"button",icon:Gg,title:"".concat($b("buttons.zoomOut")," — ").concat(Vd("CtrlOrCmd+-")),"aria-label":$b("buttons.zoomOut"), onClick:function(){C(null)},size:"small"})},keyTest:function(v){return("Minus"===v.code||"NumpadSubtract"===v.code)&&(v[Af]||v.shiftKey)}});ye({name:"resetZoom",perform:function(v,C){return{appState:Sd(Sd({},C),{},{zoom:ha(1,C.zoom,{left:C.offsetLeft,top:C.offsetTop},{x:C.width/2,y:C.height/2})}),commitToHistory:!1}},PanelComponent:function(v){var C=v.updateData;v=v.appState;return(0,Va.jsx)(wf,{label:$b("buttons.resetZoom"),children:(0,Va.jsxs)(Ha,{type:"button",className:"reset-zoom-button",title:$b("buttons.resetZoom"), "aria-label":$b("buttons.resetZoom"),onClick:function(){C(null)},size:"small",children:[(100*v.zoom.value).toFixed(0),"%"]})})},keyTest:function(v){return("Digit0"===v.code||"Numpad0"===v.code)&&(v[Af]||v.shiftKey)}});var lf=function(v,C,U){v=pe(v);var B=Sf(v,C);U=U&&0Aa.points.length||Kj(Aa)?v.filter(function(Wa){return Wa.id!==Aa.id}):void 0,appState:Ja(Ja({},C),{},{editingLinearElement:null}),commitToHistory:!0}}window.document.activeElement instanceof HTMLElement&&B();if(B=C.multiElement?C.multiElement:"freedraw"===(null===(oa=C.editingElement)||void 0===oa?void 0:oa.type)?C.editingElement:null){"freedraw"!==B.type&&"touch"!==C.lastPointerDownWith&&(oa=B.points, (va=B.lastCommittedPoint)&&oa[oa.length-1]===va||le(B,{points:B.points.slice(0,-1)}));Kj(B)&&(v=v.slice(0,-1));oa=qj(B.points,C.zoom.value);if(("line"===B.type||"freedraw"===B.type)&&oa){var Ca=B.points,Ia=Ca[0];le(B,{points:Ca.map(function(Wa,$a){return $a===Ca.length-1?[Ia[0],Ia[1]]:Wa})})}Wg(B)&&!oa&&1=md&&sd.y>=He});(xa.forEach(function(md){try{lh(md, oa,$a,Wa,ja)}catch(sd){console.error(sd)}}),C.editingLinearElement)&&(Ia=fd.getElement(C.editingLinearElement.elementId))&&Gk($a,C,ja,Ia);if(U)try{lh(U,oa,$a,Wa,ja)}catch(md){console.error(md)}if(C.isBindingEnabled&&C.suggestedBindings.filter(function(md){return null!=md}).forEach(function(md){var sd=Array.isArray(md)?zq:Mn;$a.save();$a.translate(ja.scrollX,ja.scrollY);sd($a,md);$a.restore()}),Ca&&!C.multiElement&&!C.editingLinearElement){var nc,Tc=v.reduce(function(md,sd){var Hd=[];if(C.selectedElementIds[sd.id]&& null==dh(C,sd)&&Hd.push(mf.black),ja.remoteSelectedElementIds[sd.id]&&Hd.push.apply(Hd,O(ja.remoteSelectedElementIds[sd.id].map(function(Sg){return Dm(Sg,C).background}))),Hd.length){var He=ca(Vf(sd),4);md.push({angle:sd.angle,elementX1:He[0],elementY1:He[1],elementX2:He[2],elementY2:He[3],selectionColors:Hd})}return md},[]);Ca=function(md){md=li(v,md);md=ca(Bg(md),4);Tc.push({angle:0,elementX1:md[0],elementX2:md[2],elementY1:md[1],elementY2:md[3],selectionColors:[mf.black]})};Ia=fb(vi(C));try{for(Ia.s();!(nc= Ia.n()).done;)Ca(nc.value)}catch(md){Ia.e(md)}finally{Ia.f()}C.editingGroupId&&Ca(C.editingGroupId);Tc.forEach(function(md){var sd=md.angle,Hd=md.elementX1,He=md.elementY1,Sg=md.selectionColors,ni=md.elementX2-Hd;md=md.elementY2-He;var Ai=4/ja.zoom.value,pf=8/ja.zoom.value,Ae=4/ja.zoom.value;$a.save();$a.translate(ja.scrollX,ja.scrollY);$a.lineWidth=1/ja.zoom.value;for(var ah=Sg.length,Wi=0;WiIa||Ia>rb-9||0>Xb||Xb>Hb-14;Ia=Math.max(Ia,0);Ia=Math.min(Ia,rb-9);Xb=Math.max(Xb,0);Xb=Math.min(Xb,Hb-14);Ca=Dm(Dd,C);nc=Ca.background;Ca=Ca.stroke;$a.save();$a.strokeStyle=Ca;$a.fillStyle=nc;Pc=ja.remotePointerUserStates[Dd]; (Xc||Pc===Ji.AWAY)&&($a.globalAlpha=.48);ja.remotePointerButton&&"down"===ja.remotePointerButton[Dd]&&($a.beginPath(),$a.arc(Ia,Xb,15,0,2*Math.PI,!1),$a.lineWidth=3,$a.strokeStyle="#ffffff88",$a.stroke(),$a.closePath(),$a.beginPath(),$a.arc(Ia,Xb,15,0,2*Math.PI,!1),$a.lineWidth=1,$a.strokeStyle=Ca,$a.stroke(),$a.closePath());$a.beginPath();$a.moveTo(Ia,Xb);$a.lineTo(Ia+1,Xb+14);$a.lineTo(Ia+4,Xb+9);$a.lineTo(Ia+9,Xb+10);$a.lineTo(Ia,Xb);$a.fill();$a.stroke();Zc=ja.remotePointerUsernames[Dd];var Yd= "";Pc===Ji.AWAY?Yd=Ln?"⚫️":" (".concat(Ji.AWAY,")"):Pc===Ji.IDLE?Yd=Ln?"\ud83d\udca4":" (".concat(Ji.IDLE,")"):Pc===Ji.ACTIVE&&(Yd=Ln?"\ud83d\udfe2":"");Pc="".concat(Zc?"".concat(Zc," "):"").concat(Yd);!Xc&&Pc&&(Ia+=9,Xb+=14,Xc=$a.measureText(Pc),Zc=Xc.actualBoundingBoxDescent+Xc.actualBoundingBoxAscent,$a.fillStyle=Ca,$a.fillRect(Ia-1,Xb-1,Xc.width+8+2,Zc+8+2),$a.fillStyle=nc,$a.fillRect(Ia,Xb,Xc.width+8,Zc+8),$a.fillStyle=mf.white,$a.fillText(Pc,Ia+4,Xb+4+Xc.actualBoundingBoxAscent));$a.restore(); $a.closePath()}return Aa&&(jc=sh(v,rb,Hb,ja),$a.save(),$a.fillStyle="rgba(0,0,0,0.3)",$a.strokeStyle="rgba(255,255,255,0.8)",[jc.horizontal,jc.vertical].forEach(function(md){if(md){var sd=md.x,Hd=md.y,He=md.width;md=md.height;$a.beginPath();$a.moveTo(sd+3,Hd);$a.lineTo(sd+He-3,Hd);$a.quadraticCurveTo(sd+He,Hd,sd+He,Hd+3);$a.lineTo(sd+He,Hd+md-3);$a.quadraticCurveTo(sd+He,Hd+md,sd+He-3,Hd+md);$a.lineTo(sd+3,Hd+md);$a.quadraticCurveTo(sd,Hd+md,sd,Hd+md-3);$a.lineTo(sd,Hd+3);$a.quadraticCurveTo(sd,Hd, sd+3,Hd);$a.closePath();$a.fill();$a.stroke()}}),$a.restore()),$a.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(v){function C(){var B, oa=0v.points.length?[[0,0],[v.width,v.height]]:v.points;if(0!==va[0][0]||0!==va[0][1])oa=fd.getNormalizedPoints(v),va=oa.points,B=oa.x,oa=oa.y;return In(v,{type:"draw"===v.type?"line":v.type,startBinding:v.startBinding,endBinding:v.endBinding,lastCommittedPoint:null,startArrowhead:C,endArrowhead:U,points:va,x:B,y:oa});case "ellipse":case "rectangle":case "diamond":return In(v,{})}},sl=function(v, C){var U=C?al(C):null;return(v||[]).reduce(function(B,oa){if("selection"!==oa.type&&!Kj(oa)){var va=wq(oa);va&&((oa=null==U?void 0:U[oa.id])&&oa.version>va.version&&(va=vg(va,oa.version)),B.push(va))}return B},[])},Um=function(v,C){v=v||{};var U,B=Ij(),oa={},va=Nc(Object.entries(B));try{for(va.s();!(U=va.n()).done;){var ja=ca(U.value,2),xa=ja[0],Aa=ja[1],Ca=v[xa],Ia=C?C[xa]:void 0;oa[xa]=void 0!==Ca?Ca:void 0!==Ia?Ia:Aa}}catch(Wa){va.e(Wa)}finally{va.f()}return Ud(Ud({},oa),{},{elementType:Fe[oa.elementType]? oa.elementType:"selection",zoom:"number"==typeof v.zoom?{value:v.zoom,translation:B.zoom.translation}:v.zoom||B.zoom})},Tm=function(v,C,U){return{elements:sl(null==v?void 0:v.elements,U),appState:Um(null==v?void 0:v.appState,C||null)}},ko=function(){var v=(0,ff.Z)(Zd().mark(function B(U){var oa;return Zd().wrap(function(va){for(;;)switch(va.prev=va.next){case 0:if("image/png"!==U.type){va.next=18;break}return va.prev=1,va.next=4,Promise.all([e.e(736),e.e(9)]).then(e.bind(e,8527));case 4:return va.next= 6,va.sent.decodePngMetadata(U);case 6:return va.abrupt("return",va.sent);case 9:if(va.prev=9,va.t0=va.catch(1),"INVALID"!==va.t0.message){va.next=15;break}throw Error($b("alerts.imageDoesNotContainScene"));case 15:throw Error($b("alerts.cannotRestoreFromImage"));case 16:va.next=43;break;case 18:if(!("text"in Blob)){va.next=24;break}return va.next=21,U.text();case 21:oa=va.sent;va.next=27;break;case 24:return va.next=26,new Promise(function(ja){var xa=new FileReader;xa.readAsText(U,"utf8");xa.onloadend= function(){xa.readyState===FileReader.DONE&&ja(xa.result)}});case 26:oa=va.sent;case 27:if("image/svg+xml"!==U.type){va.next=43;break}return va.prev=28,va.next=31,Promise.all([e.e(736),e.e(9)]).then(e.bind(e,8527));case 31:return va.next=33,va.sent.decodeSvgMetadata({svg:oa});case 33:return va.abrupt("return",va.sent);case 36:if(va.prev=36,va.t1=va.catch(28),"INVALID"!==va.t1.message){va.next=42;break}throw Error($b("alerts.imageDoesNotContainScene"));case 42:throw Error($b("alerts.cannotRestoreFromImage")); case 43:return va.abrupt("return",oa);case 44:case "end":return va.stop()}},B,null,[[1,9],[28,36]])}));return function(U){return v.apply(this,arguments)}}(),Fp=function(v){var C;return v&&(null===(C=v.name.match(/\.(json|excalidraw|png|svg)$/))||void 0===C?void 0:C[1])||null},Yo=function(v){v=Fp(v);return"png"===v||"svg"===v},vl=function(){var v=(0,ff.Z)(Zd().mark(function va(U,B,oa){var ja,xa,Aa;return Zd().wrap(function(Ca){for(;;)switch(Ca.prev=Ca.next){case 0:return Ca.next=2,ko(U);case 2:ja= Ca.sent;Ca.prev=3;var Ia=xa=JSON.parse(ja);if((null==Ia?void 0:Ia.type)===Cc.r8.excalidraw&&(!Ia.elements||Array.isArray(Ia.elements)&&(!Ia.appState||"object"===E(Ia.appState)))){Ca.next=7;break}throw Error($b("alerts.couldNotLoadInvalidFile"));case 7:return Aa=Tm({elements:Ml(xa.elements||[]),appState:ge(ge({theme:null==B?void 0:B.theme,fileHandle:U.handle||null},fk(xa.appState||{},"export")),B?Fg(xa.elements||[],B):{})},B,oa),Ca.abrupt("return",Aa);case 11:throw Ca.prev=11,Ca.t0=Ca.catch(3),console.error(Ca.t0.message), Error($b("alerts.couldNotLoadInvalidFile"));case 15:case "end":return Ca.stop()}},va,null,[[3,11]])}));return function(U,B,oa){return v.apply(this,arguments)}}(),jo=function(){var v=(0,ff.Z)(Zd().mark(function B(U){var oa,va;return Zd().wrap(function(ja){for(;;)switch(ja.prev=ja.next){case 0:return ja.next=2,ko(U);case 2:if(oa=ja.sent,(va=JSON.parse(oa)).type===Cc.r8.excalidrawLibrary){ja.next=6;break}throw Error($b("alerts.couldNotLoadInvalidFile"));case 6:return ja.abrupt("return",va);case 7:case "end":return ja.stop()}}, B)}));return function(U){return v.apply(this,arguments)}}(),Dp=function(){var v=(0,ff.Z)(Zd().mark(function B(U){return Zd().wrap(function(oa){for(;;)switch(oa.prev=oa.next){case 0:return oa.abrupt("return",new Promise(function(va,ja){try{U.toBlob(function(xa){if(!xa)return ja(new mn($b("canvasError.canvasTooBig"),"CANVAS_POSSIBLY_TOO_BIG"));va(xa)})}catch(xa){ja(xa)}}));case 1:case "end":return oa.stop()}},B)}));return function(U){return v.apply(this,arguments)}}(),Jn=function(v,C){v={type:Cc.r8.excalidraw, version:2,source:Cc.pb,elements:Ml(v),appState:fk(C,"export")};return JSON.stringify(v,null,2)},Em=function(){var v=(0,ff.Z)(Zd().mark(function oa(U,B){var va,ja,xa;return Zd().wrap(function(Aa){for(;;)switch(Aa.prev=Aa.next){case 0:return va=Jn(U,B),ja=new Blob([va],{type:Cc.LO.excalidraw}),Aa.next=4,go(ja,{name:B.name,extension:"excalidraw",description:"Excalidraw file",fileHandle:Yo(B.fileHandle)?null:B.fileHandle});case 4:return xa=Aa.sent,Aa.abrupt("return",{fileHandle:xa});case 6:case "end":return Aa.stop()}}, oa)}));return function(U,B){return v.apply(this,arguments)}}(),Cp=function(){var v=(0,ff.Z)(Zd().mark(function oa(U,B){var va;return Zd().wrap(function(ja){for(;;)switch(ja.prev=ja.next){case 0:return ja.next=2,Bp({description:"Excalidraw files"});case 2:return va=ja.sent,ja.abrupt("return",vl(va,U,B));case 4:case "end":return ja.stop()}},oa)}));return function(U,B){return v.apply(this,arguments)}}(),Xo=function(){var v=(0,ff.Z)(Zd().mark(function B(U){var oa,va,ja;return Zd().wrap(function(xa){for(;;)switch(xa.prev= xa.next){case 0:return xa.next=2,U.loadLibrary();case 2:return oa=xa.sent,va={type:Cc.r8.excalidrawLibrary,version:1,source:Cc.pb,library:oa},ja=JSON.stringify(va,null,2),xa.next=7,go(new Blob([ja],{type:Cc.LO.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"});case 7:case "end":return xa.stop()}},B)}));return function(U){return v.apply(this,arguments)}}(),Ep=function(){var v=(0,ff.Z)(Zd().mark(function B(U){var oa;return Zd().wrap(function(va){for(;;)switch(va.prev= va.next){case 0:return va.next=2,Bp({description:"Excalidraw library files"});case 2:return oa=va.sent,va.next=5,U.importLibrary(oa);case 5:case "end":return va.stop()}},B)}));return function(U){return v.apply(this,arguments)}}(),Aq=function(v,C,U){var B=U.exportBackground,oa=U.exportPadding;oa=void 0===oa?Cc.qy:oa;var va=U.viewBackgroundColor,ja=3U.length?{type:"NOT_SPREADSHEET",reason:"Less than two rows"}:{type:"VALID_SPREADSHEET",spreadsheet:{title:C?v[0][0]: null,labels:null,values:U}}}var B=vq(v,0)?0:1;if(!vq(v,B))return{type:"NOT_SPREADSHEET",reason:"Value is not numeric"};var oa=(B+1)%2;U=(C=null===So(v[0][B]))?v.slice(1):v;return 2>U.length?{type:"NOT_SPREADSHEET",reason:"Less than 2 rows"}:{type:"VALID_SPREADSHEET",spreadsheet:{title:C?v[0][B]:null,labels:U.map(function(va){return va[oa]}),values:U.map(function(va){return So(va[B])})}}},pn=ri.elementBackground.slice(2,ri.elementBackground.length),Yl={fillStyle:"hachure",fontFamily:Cc.rk,fontSize:Cc.n5, opacity:100,roughness:1,strokeColor:ri.elementStroke[0],strokeSharpness:"sharp",strokeStyle:"solid",strokeWidth:1,verticalAlign:"middle"},$o=function(v){return{chartWidth:44*v.values.length+12,chartHeight:280}},H=function(v,C,U,B,oa,va){var ja=$o(v),xa=ja.chartWidth,Aa=ja.chartHeight;ja=v.title?Eg(ia(ia({backgroundColor:oa,groupIds:[B]},Yl),{},{text:v.title,x:C+xa/2,y:U-256-24-Cc.n5,strokeSharpness:"sharp",strokeStyle:"solid",textAlign:"center"})):null;va=va?xf(ia(ia({backgroundColor:oa,groupIds:[B]}, Yl),{},{type:"rectangle",x:C,y:U-Aa,width:xa,height:Aa,strokeColor:ri.elementStroke[0],fillStyle:"solid",opacity:6})):null;return[].concat(O(va?[va]:[]),O(ja?[ja]:[]),O(function(Ca,Ia,Wa,$a,rb){var Hb;return(null===(Hb=Ca.labels)||void 0===Hb?void 0:Hb.map(function(Xb,jc){return Eg(ia(ia({groupIds:[$a],backgroundColor:rb},Yl),{},{text:8va.length)return{appState:oa,elements:B,commitToHistory:!1};var ja=vi(oa);if(1===ja.length&&(ja=new Set(li(B,ja[0]).map(function(Ca){return Ca.id})),va=new Set(va.map(function(Ca){return Ca.id})), (new Set([].concat(O(Array.from(ja)),O(Array.from(va))))).size===ja.size))return{appState:oa,elements:B,commitToHistory:!1};var xa=dk();ja=B.map(function(Ca){if(oa.selectedElementIds[Ca.id]){var Ia=oa.editingGroupId;var Wa=O(Ca.groupIds);Ia=Ia?Wa.indexOf(Ia):-1;Wa=(Wa.splice(-1Aa.length?Aa[0].substring(0,2).toUpperCase():(Aa[0][0]+Aa[Aa.length-1][0]).toUpperCase()}(ja.username);return(0,Va.jsx)(Cv,{color:oa,border:B,onClick:function(){return va(ja.pointer)},children:xa})}});var Dv=ye({name:"addToLibrary",perform:function(B,oa,va,ja){var xa=Sf(pe(B),oa);return ja.library.loadLibrary().then(function(Aa){ja.library.saveLibrary([].concat(O(Aa), [xa.map(Wf)]))}),!1},contextItemLabel:"labels.addToLibrary"}),Av=function(B){var oa=new Map;return B.forEach(function(va){var ja=0===va.groupIds.length?va.id:va.groupIds[va.groupIds.length-1],xa=oa.get(ja)||[];oa.set(ja,[].concat(O(xa),[va]))}),Array.from(oa.values())},Bv=function(B,oa,va){var ja=va.axis;va=va.position;B=At(B);var xa=ca("x"===ja?["minX","maxX"]:["minY","maxY"],2),Aa=xa[0];xa=xa[1];return Vh(Vh({},{x:0,y:0}),{},T({},ja,"start"===va?oa[Aa]-B[Aa]:"end"===va?oa[xa]-B[xa]:(oa[Aa]+oa[xa])/ 2-(B[Aa]+B[xa])/2))},At=function(B){B=ca(Bg(B),4);return{minX:B[0],minY:B[1],maxX:B[2],maxY:B[3]}},Np=function(B,oa){return 1nc){var Tc=xa.findIndex(function(Yd){return Yd[1][Wa]===Xb[Wa]}),Xc=xa.findIndex(function(Yd){return Yd[1][rb]===Xb[rb]}),Pc=(xa[Xc][1][$a]-xa[Tc][1][$a])/(xa.length-1),Zc=xa[Tc][1][$a];return xa.flatMap(function(Yd,md){var sd=ca(Yd,2);Yd=sd[0];sd=sd[1]; var Hd={x:0,y:0};return md!==Tc&&md!==Xc&&(Zc+=Pc,Hd[Aa.axis]=Zc-sd[$a]),Yd.map(function(He){return cf(He,{x:He.x+Hd.x,y:He.y+Hd.y})})})}var Dd=Xb[Wa];return xa.flatMap(function(Yd){var md=ca(Yd,2);Yd=md[0];md=md[1];var sd={x:0,y:0};return sd[Aa.axis]=Dd-md[Wa],Dd+=nc,Dd+=md[Hb],Yd.map(function(Hd){return cf(Hd,{x:Hd.x+sd.x,y:Hd.y+sd.y})})})}(Sf(pe(B),oa),va);var ja=al(oa);return B.map(function(xa){return ja[xa.id]||xa})},Kt=(ye({name:"distributeHorizontally",perform:function(B,oa){return{appState:oa, elements:Jt(B,oa,{space:"between",axis:"x"}),commitToHistory:!0}},keyTest:function(B){return B.altKey&&"KeyH"===B.code},PanelComponent:function(B){var oa=B.elements,va=B.appState,ja=B.updateData;return(0,Va.jsx)(Ha,{hidden:!It(oa,va),type:"button",icon:(0,Va.jsx)(Cf,{theme:va.theme}),onClick:function(){return ja(null)},title:"".concat($b("labels.distributeHorizontally")," — ").concat(Vd("Alt+H")),"aria-label":$b("labels.distributeHorizontally"),visible:vh(pe(oa),va)})}}),ye({name:"distributeVertically", perform:function(B,oa){return{appState:oa,elements:Jt(B,oa,{space:"between",axis:"y"}),commitToHistory:!0}},keyTest:function(B){return B.altKey&&"KeyV"===B.code},PanelComponent:function(B){var oa=B.elements,va=B.appState,ja=B.updateData;return(0,Va.jsx)(Ha,{hidden:!It(oa,va),type:"button",icon:(0,Va.jsx)(Nn,{theme:va.theme}),onClick:function(){return ja(null)},title:"".concat($b("labels.distributeVertically")," — ").concat(Vd("Alt+V")),"aria-label":$b("labels.distributeVertically"),visible:vh(pe(oa), va)})}}),ye({name:"flipHorizontal",perform:function(B,oa){return{elements:Mt(B,oa,"horizontal"),appState:oa,commitToHistory:!0}},keyTest:function(B){return B.shiftKey&&"KeyH"===B.code},contextItemLabel:"labels.flipHorizontal",contextItemPredicate:function(B,oa){B=Sf(pe(B),oa);return 1===B.length&&"text"!==B[0].type}})),Lt=ye({name:"flipVertical",perform:function(B,oa){return{elements:Mt(B,oa,"vertical"),appState:oa,commitToHistory:!0}},keyTest:function(B){return B.shiftKey&&"KeyV"===B.code},contextItemLabel:"labels.flipVertical", contextItemPredicate:function(B,oa){return 1===Sf(pe(B),oa).length}}),Mt=function(B,oa,va){var ja=Sf(pe(B),oa);if(1Ia&&(Ia=fe(2*Math.PI+Ia));le(xa,{angle:Ia});le(xa,{x:Aa,y:Ca})}return B},Gv=function(B,oa){var va=B.x,ja=B.y,xa=B.width,Aa=B.height,Ca=fe(B.angle), Ia=0;(Dg(B)||ki(B))&&(Ia=2*B.points.reduce(function(Hb,Xb){return Math.max(Hb,Xb[0])},0)-B.width);le(B,{angle:fe(0)});oa=Tk(B,oa.zoom);var Wa=!0,$a=0,rb=oa.nw;if(rb||(Wa=!1,rb=oa.ne)){if(Dg(B)){for(xa=1;xaCa&&(Ca=fe(Ca+2*Math.PI));le(B,{angle:Ca});le(B,{x:va+Ia,y:ja});Di(B)}else le(B,{angle:Ca})}, ts=ye({name:"copy",perform:function(B,oa){return hc(pe(B),oa),{commitToHistory:!1}},contextItemLabel:"labels.copy",keyTest:void 0}),Hv=ye({name:"cut",perform:function(B,oa,va,ja){return ts.perform(B,oa,va,ja),hn.perform(B,oa,va,ja)},contextItemLabel:"labels.cut",keyTest:function(B){return B[Af]&&"KeyX"===B.code}}),Nt=ye({name:"copyAsSvg",perform:function(){var B=(0,ff.Z)(Zd().mark(function Ca(va,ja,xa,Aa){var Ia;return Zd().wrap(function(Wa){for(;;)switch(Wa.prev=Wa.next){case 0:if(Aa.canvas){Wa.next= 2;break}return Wa.abrupt("return",{commitToHistory:!1});case 2:return Ia=Sf(pe(va),ja),Wa.prev=3,Wa.next=6,uf("clipboard-svg",Ia.length?Ia:pe(va),ja,ja);case 6:return Wa.abrupt("return",{commitToHistory:!1});case 9:return Wa.prev=9,Wa.t0=Wa.catch(3),console.error(Wa.t0),Wa.abrupt("return",{appState:Jd(Jd({},ja),{},{errorMessage:Wa.t0.message}),commitToHistory:!1});case 13:case "end":return Wa.stop()}},Ca,null,[[3,9]])}));return function(va,ja,xa,Aa){return B.apply(this,arguments)}}(),contextItemLabel:"labels.copyAsSvg"}), Ot=ye({name:"copyAsPng",perform:function(){var B=(0,ff.Z)(Zd().mark(function Ca(va,ja,xa,Aa){var Ia;return Zd().wrap(function(Wa){for(;;)switch(Wa.prev=Wa.next){case 0:if(Aa.canvas){Wa.next=2;break}return Wa.abrupt("return",{commitToHistory:!1});case 2:return Ia=Sf(pe(va),ja),Wa.prev=3,Wa.next=6,uf("clipboard",Ia.length?Ia:pe(va),ja,ja);case 6:return Wa.abrupt("return",{appState:Jd(Jd({},ja),{},{toastMessage:$b("toast.copyToClipboardAsPng",{exportSelection:Ia.length?$b("toast.selection"):$b("toast.canvas"), exportColorScheme:ja.exportWithDarkMode?$b("buttons.darkMode"):$b("buttons.lightMode")})}),commitToHistory:!1});case 9:return Wa.prev=9,Wa.t0=Wa.catch(3),console.error(Wa.t0),Wa.abrupt("return",{appState:Jd(Jd({},ja),{},{errorMessage:Wa.t0.message}),commitToHistory:!1});case 13:case "end":return Wa.stop()}},Ca,null,[[3,9]])}));return function(va,ja,xa,Aa){return B.apply(this,arguments)}}(),contextItemLabel:"labels.copyAsPng",keyTest:function(B){return"KeyC"===B.code&&B.altKey&&B.shiftKey}}),Pt=ye({name:"gridMode", perform:function(B,oa){return Lh("view","mode","grid"),{appState:oi(oi({},oa),{},{gridSize:this.checked(oa)?null:Cc.k}),commitToHistory:!1}},checked:function(B){return null!==B.gridSize},contextItemLabel:"labels.showGrid",keyTest:function(B){return B[Af]&&"Quote"===B.code}}),ss=ye({name:"zenMode",perform:function(B,oa){return Lh("view","mode","zen"),{appState:Ni(Ni({},oa),{},{zenModeEnabled:!this.checked(oa)}),commitToHistory:!1}},checked:function(B){return B.zenModeEnabled},contextItemLabel:"buttons.zenMode", keyTest:function(B){return!B[Af]&&B.altKey&&"KeyZ"===B.code}}),rs=ye({name:"stats",perform:function(B,oa){return{appState:Ck(Ck({},oa),{},{showStats:!this.checked(oa)}),commitToHistory:!1}},checked:function(B){return B.showStats},contextItemLabel:"stats.title",keyTest:function(B){return!B[Af]&&B.altKey&&"Slash"===B.code}}),vt=function(B,oa,va){if(!(oa.multiElement||oa.resizingElement||oa.editingElement||oa.draggingElement)){va=va();if(null===va)return{commitToHistory:!1};var ja=al(B),xa=va.elements, Aa=al(xa);B=B.filter(function(Ca){return!Aa.hasOwnProperty(Ca.id)});xa=xa.map(function(Ca){return cf(ja[Ca.id]||Ca,Ca)}).concat(B.map(function(Ca){return cf(Ca,{isDeleted:!0})}));return Ll(xa,B),{elements:xa,appState:xh(xh({},oa),va.appState),commitToHistory:!1,syncHistory:!0}}return{commitToHistory:!1}},vv=function(){function B(oa,va,ja,xa){var Aa=this;k(this,B);this.actions={};this.renderAction=function(Ca,Ia){var Wa=Aa.app.props.UIOptions.canvasActions;if(Aa.actions[Ca]&&"PanelComponent"in Aa.actions[Ca]&& (!(Ca in Wa)||Wa[Ca])){var $a=Aa.actions[Ca];return(0,Va.jsx)($a.PanelComponent,{elements:Aa.getElementsIncludingDeleted(),appState:Aa.getAppState(),updateData:function(rb){Aa.updater($a.perform(Aa.getElementsIncludingDeleted(),Aa.getAppState(),rb,Aa.app))},appProps:Aa.app.props,data:Ia})}return null};this.updater=function(Ca){if(!(Ca&&"then"in Ca))return oa(Ca);Ca.then(function(Ia){return oa(Ia)})};this.getAppState=va;this.getElementsIncludingDeleted=ja;this.app=xa}return z(B,[{key:"registerAction", value:function(oa){this.actions[oa.name]=oa}},{key:"registerAll",value:function(oa){var va=this;oa.forEach(function(ja){return va.registerAction(ja)})}},{key:"handleKeyDown",value:function(oa){var va=this,ja=this.app.props.UIOptions.canvasActions,xa=Object.values(this.actions).sort(function(Aa,Ca){return(Ca.keyPriority||0)-(Aa.keyPriority||0)}).filter(function(Aa){return(!(Aa.name in ja)||ja[Aa.name])&&Aa.keyTest&&Aa.keyTest(oa,va.getAppState(),va.getElementsIncludingDeleted())});return 0!==xa.length&& !(this.getAppState().viewModeEnabled&&!Object.values(Cc.EH).includes(xa[0].name))&&(oa.preventDefault(),this.updater(xa[0].perform(this.getElementsIncludingDeleted(),this.getAppState(),null,this.app)),!0)}},{key:"executeAction",value:function(oa){this.updater(oa.perform(this.getElementsIncludingDeleted(),this.getAppState(),null,this.app))}}]),B}(),zv=function(){function B(va){var ja=this;k(this,B);this.libraryCache=null;this.resetLibrary=(0,ff.Z)(Zd().mark(function Aa(){var Ca,Ia;return Zd().wrap(function(Wa){for(;;)switch(Wa.prev= Wa.next){case 0:return Wa.next=2,null===(Ca=(Ia=ja.app.props).onLibraryChange)||void 0===Ca?void 0:Ca.call(Ia,[]);case 2:ja.libraryCache=[];case 3:case "end":return Wa.stop()}},Aa)}));this.restoreLibraryItem=function(Aa){Aa=pe(sl(Aa,null));return Aa.length?Aa:null};this.loadLibrary=function(){return new Promise(function(){var Aa=(0,ff.Z)(Zd().mark(function Wa(Ia){var $a,rb;return Zd().wrap(function(Hb){for(;;)switch(Hb.prev=Hb.next){case 0:if(!ja.libraryCache){Hb.next=2;break}return Hb.abrupt("return", Ia(JSON.parse(JSON.stringify(ja.libraryCache))));case 2:if(Hb.prev=2,$a=ja.app.libraryItemsFromStorage){Hb.next=6;break}return Hb.abrupt("return",Ia([]));case 6:rb=$a.reduce(function(Xb,jc){return ja.restoreLibraryItem(jc)&&Xb.push(jc),Xb},[]);ja.libraryCache=JSON.parse(JSON.stringify(rb));Ia(rb);Hb.next=15;break;case 11:Hb.prev=11,Hb.t0=Hb.catch(2),console.error(Hb.t0),Ia([]);case 15:case "end":return Hb.stop()}},Wa,null,[[2,11]])}));return function(Ia){return Aa.apply(this,arguments)}}())};this.saveLibrary= function(){var Aa=(0,ff.Z)(Zd().mark(function Wa(Ia){var $a,rb,Hb,Xb;return Zd().wrap(function(jc){for(;;)switch(jc.prev=jc.next){case 0:return $a=ja.libraryCache,jc.prev=1,Xb=JSON.stringify(Ia),ja.libraryCache=JSON.parse(Xb),jc.next=6,null===(rb=(Hb=ja.app.props).onLibraryChange)||void 0===rb?void 0:rb.call(Hb,Ia);case 6:jc.next=12;break;case 8:throw jc.prev=8,jc.t0=jc.catch(1),ja.libraryCache=$a,jc.t0;case 12:case "end":return jc.stop()}},Wa,null,[[1,8]])}));return function(Ia){return Aa.apply(this, arguments)}}();this.app=va}var oa;return z(B,[{key:"importLibrary",value:(oa=(0,ff.Z)(Zd().mark(function xa(ja){var Aa,Ca,Ia,Wa,$a=this;return Zd().wrap(function(rb){for(;;)switch(rb.prev=rb.next){case 0:return rb.next=2,jo(ja);case 2:if((Aa=rb.sent)&&Aa.library){rb.next=5;break}return rb.abrupt("return");case 5:return Ca=function(Hb,Xb){return!Hb.find(function(jc){return jc.length===Xb.length&&jc.every(function(nc,Tc){return nc.id===Xb[Tc].id&&nc.versionNonce===Xb[Tc].versionNonce})})},rb.next=8, this.loadLibrary();case 8:return Ia=rb.sent,Wa=Aa.library.reduce(function(Hb,Xb){Xb=$a.restoreLibraryItem(Xb);return Xb&&Ca(Ia,Xb)&&Hb.push(Xb),Hb},[]),rb.next=12,this.saveLibrary([].concat(O(Ia),O(Wa)));case 12:case "end":return rb.stop()}},xa,this)})),function(ja){return oa.apply(this,arguments)})}]),B}(),yt=function(B){B=Array.from(B.values());return{x:Ft(B,function(oa){return oa.x})/B.length,y:Ft(B,function(oa){return oa.y})/B.length}},zt=function(B){var oa=ca(B,2);B=oa[0];oa=oa[1];return Math.hypot(B.x- oa.x,B.y-oa.y)},Ft=function(B,oa){return B.reduce(function(va,ja){return va+oa(ja)},0)},wv=function(){function B(){var oa=this;k(this,B);this.elementCache=new Map;this.recording=!0;this.stateHistory=[];this.redoStack=[];this.lastEntry=null;this.generateEntry=function(va,ja){return oa.dehydrateHistoryEntry({appState:{selectedElementIds:va.selectedElementIds,selectedGroupIds:va.selectedGroupIds,viewBackgroundColor:va.viewBackgroundColor,editingLinearElement:va.editingLinearElement,editingGroupId:va.editingGroupId, name:va.name},elements:ja.reduce(function(xa,Aa){if(Dg(Aa)&&va.multiElement&&va.multiElement.id===Aa.id){if(va.multiElement&&va.multiElement.id===Aa.id&&2>Aa.points.length)return xa;xa.push(Ol(Ol({},Aa),{},{points:Aa.lastCommittedPoint!==Aa.points[Aa.points.length-1]?Aa.points.slice(0,-1):Aa.points}))}else xa.push(Aa);return xa},[])})}}return z(B,[{key:"hydrateHistoryEntry",value:function(oa){var va=this,ja=oa.elements;return{appState:JSON.parse(oa.appState),elements:ja.map(function(xa){var Aa,Ca= null===(Aa=va.elementCache.get(xa.id))||void 0===Aa?void 0:Aa.get(xa.versionNonce);if(!Ca)throw Error("Element not found: ".concat(xa.id,":").concat(xa.versionNonce));return Ca})}}},{key:"dehydrateHistoryEntry",value:function(oa){var va=this,ja=oa.elements;return{appState:JSON.stringify(oa.appState),elements:ja.map(function(xa){va.elementCache.has(xa.id)||va.elementCache.set(xa.id,new Map);var Aa=va.elementCache.get(xa.id);return Aa.has(xa.versionNonce)||Aa.set(xa.versionNonce,Wf(xa)),{id:xa.id,versionNonce:xa.versionNonce}})}}}, {key:"getSnapshotForTest",value:function(){var oa=this;return{recording:this.recording,stateHistory:this.stateHistory.map(function(va){return oa.hydrateHistoryEntry(va)}),redoStack:this.redoStack.map(function(va){return oa.hydrateHistoryEntry(va)})}}},{key:"clear",value:function(){this.stateHistory.length=0;this.redoStack.length=0;this.lastEntry=null;this.elementCache.clear()}},{key:"shouldCreateEntry",value:function(oa){var va,ja=this.lastEntry;if(!ja||oa.elements.length!==ja.elements.length)return!0; for(var xa=oa.elements.length-1;-1=oa.length;Tc=Tc||Pc;Xb.push((0,Va.jsx)(Sc,{children:(0,Va.jsx)(cv,{elements:oa[$a+Xc],pendingElements:Pc?Aa:void 0,onRemoveFromLibrary:va.bind(null,$a+Xc),onClick:Pc?ja.bind(null,Aa):xa.bind(null,oa[$a+Xc])})},Xc))}nc.push((0,Va.jsx)(Jc,{align:"center",gap:1,children:Xb},Ca))}return(0,Va.jsx)(Sc,{align:"start",gap:1,className:"layer-ui__library-items",children:nc})},mv=function(B){var oa=B.onClickOutside,va=B.onInsertShape, ja=B.pendingElements,xa=B.onAddToLibrary,Aa=B.theme,Ca=B.setAppState,Ia=B.libraryReturnUrl,Wa=B.focusContainer,$a=B.library;B=B.id;var rb=(0,ve.useRef)(null);!function(Zc,Dd){(0,ve.useEffect)(function(){var Yd=function(md){Zc.current&&(md.target instanceof Element&&(Zc.current.contains(md.target)||!document.body.contains(md.target))||Dd(md))};return document.addEventListener("pointerdown",Yd,!1),function(){document.removeEventListener("pointerdown",Yd)}},[Zc,Dd])}(rb,function(Zc){Zc.target.closest(".ToolIcon_type_button__library")|| oa(Zc)});var Hb=ca((0,ve.useState)([]),2),Xb=Hb[0],jc=Hb[1],nc=ca((0,ve.useState)("preloading"),2);Hb=nc[0];var Tc=nc[1],Xc=(0,ve.useRef)(null);(0,ve.useEffect)(function(){return Promise.race([new Promise(function(Zc){Xc.current=setTimeout(function(){Zc("loading")},100)}),$a.loadLibrary().then(function(Zc){jc(Zc);Tc("ready")})]).then(function(Zc){"loading"===Zc&&Tc("loading")}),function(){clearTimeout(Xc.current)}},[$a]);nc=(0,ve.useCallback)(function(){var Zc=(0,ff.Z)(Zd().mark(function md(Yd){var sd, Hd;return Zd().wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,$a.loadLibrary();case 2:sd=He.sent,Hd=sd.filter(function(Sg,ni){return ni!==Yd}),$a.saveLibrary(Hd).catch(function(Sg){jc(sd);Ca({errorMessage:$b("alerts.errorRemovingFromLibrary")})}),jc(Hd);case 6:case "end":return He.stop()}},md)}));return function(Yd){return Zc.apply(this,arguments)}}(),[$a,Ca]);var Pc=(0,ve.useCallback)(function(){var Zc=(0,ff.Z)(Zd().mark(function md(Yd){var sd,Hd;return Zd().wrap(function(He){for(;;)switch(He.prev= He.next){case 0:return He.next=2,$a.loadLibrary();case 2:sd=He.sent,Hd=[].concat(O(sd),[Yd]),xa(),$a.saveLibrary(Hd).catch(function(Sg){jc(sd);Ca({errorMessage:$b("alerts.errorAddingToLibrary")})}),jc(Hd);case 7:case "end":return He.stop()}},md)}));return function(Yd){return Zc.apply(this,arguments)}}(),[xa,$a,Ca]);return"preloading"===Hb?null:(0,Va.jsx)(qn,{padding:1,ref:rb,className:"layer-ui__library",children:"loading"===Hb?(0,Va.jsx)("div",{className:"layer-ui__library-message",children:$b("labels.libraryLoadingMessage")}): (0,Va.jsx)(lv,{libraryItems:Xb,onRemoveFromLibrary:nc,onAddToLibrary:Pc,onInsertShape:va,pendingElements:ja,setAppState:Ca,setLibraryItems:jc,libraryReturnUrl:Ia,focusContainer:Wa,library:$a,theme:Aa,id:B})})},nv=de().memo(function(B){var oa,va=B.actionManager,ja=B.appState,xa=B.setAppState,Aa=B.canvas,Ca=B.elements,Ia=B.onCollabButtonClick,Wa=B.onLockToggle,$a=B.onInsertElements,rb=B.zenModeEnabled,Hb=B.showExitZenModeBtn,Xb=B.showThemeBtn,jc=B.toggleZenMode,nc=B.isCollaborating,Tc=B.renderTopRightUI, Xc=B.renderCustomFooter,Pc=B.viewModeEnabled,Zc=B.libraryReturnUrl,Dd=B.UIOptions,Yd=B.focusContainer,md=B.library,sd=B.id;B=om();var Hd=function(){return Dd.canvasActions.export?(0,Va.jsx)(jv,{elements:Ca,appState:ja,actionManager:va,exportOpts:Dd.canvasActions.export,canvas:Aa}):null},He=function(){if(!Dd.canvasActions.saveAsImage)return null;var Ae=function(ah){return function(){var Wi=(0,ff.Z)(Zd().mark(function Fl(El){var Mf;return Zd().wrap(function(wg){for(;;)switch(wg.prev=wg.next){case 0:return wg.next= 2,uf(ah,El,ja,{exportBackground:ja.exportBackground,name:ja.name,viewBackgroundColor:ja.viewBackgroundColor}).catch(kk).catch(function(Gl){console.error(Gl);xa({errorMessage:Gl.message})});case 2:Mf=wg.sent,ja.exportEmbedScene&&Mf&&Yo(Mf)&&xa({fileHandle:Mf});case 4:case "end":return wg.stop()}},Fl)}));return function(El){return Wi.apply(this,arguments)}}()};return(0,Va.jsx)(av,{elements:Ca,appState:ja,actionManager:va,onExportToPng:Ae("png"),onExportToSvg:Ae("svg"),onExportToClipboard:Ae("clipboard")})}, Sg=function(){return(0,Va.jsx)("div",{style:{width:".625em"}})},ni=(0,ve.useCallback)(function(Ae){xa({isLibraryOpen:!1})},[xa]),Ai=(0,ve.useCallback)(function(){xa({selectedElementIds:{},selectedGroupIds:{}})},[xa]),pf=ja.isLibraryOpen?(0,Va.jsx)(mv,{pendingElements:Sf(Ca,ja),onClickOutside:ni,onInsertShape:$a,onAddToLibrary:Ai,setAppState:xa,libraryReturnUrl:Zc,focusContainer:Yd,library:md,theme:ja.theme,id:sd}):null;$a=(0,Va.jsxs)(Va.Fragment,{children:[ja.isLoading&&(0,Va.jsx)(Aj,{}),ja.errorMessage&& (0,Va.jsx)(qv,{message:ja.errorMessage,onClose:function(){return xa({errorMessage:null})}}),ja.showHelpDialog&&(0,Va.jsx)(hv,{onClose:function(){xa({showHelpDialog:!1})}}),ja.pasteDialog.shown&&(0,Va.jsx)(Vu,{setAppState:xa,appState:ja,onInsertChart:$a,onClose:function(){return xa({pasteDialog:{shown:!1,data:null}})}})]});return B?(0,Va.jsxs)(Va.Fragment,{children:[$a,(0,Va.jsx)(Uu,{appState:ja,elements:Ca,actionManager:va,libraryMenu:pf,renderJSONExportDialog:Hd,renderImageExportDialog:He,setAppState:xa, onCollabButtonClick:Ia,onLockToggle:Wa,canvas:Aa,isCollaborating:nc,renderCustomFooter:Xc,viewModeEnabled:Pc,showThemeBtn:Xb})]}):(0,Va.jsxs)("div",{className:oc("layer-ui__wrapper",{"disable-pointerEvents":ja.draggingElement||ja.resizingElement||ja.editingElement&&!Xg(ja.editingElement)}),children:[$a,(oa=wh(ja,Ca),(0,Va.jsx)(ot,{side:"top",children:(0,Va.jsxs)("div",{className:"App-menu App-menu_top",children:[(0,Va.jsxs)(Sc,{gap:4,className:oc({"disable-pointerEvents":rb}),children:[Pc?(0,Va.jsx)(oo, {heading:"canvasActions",className:oc("zen-mode-transition",{"transition-left":rb}),children:(0,Va.jsx)(qn,{padding:2,style:{zIndex:1},children:(0,Va.jsx)(Sc,{gap:4,children:(0,Va.jsxs)(Jc,{gap:1,justifyContent:"space-between",children:[Hd(),He()]})})})}):(0,Va.jsx)(oo,{heading:"canvasActions",className:oc("zen-mode-transition",{"transition-left":rb}),children:(0,Va.jsx)(qn,{padding:2,style:{zIndex:1},children:(0,Va.jsxs)(Sc,{gap:4,children:[(0,Va.jsxs)(Jc,{gap:1,justifyContent:"space-between",children:[va.renderAction("clearCanvas"), (0,Va.jsx)(Sg,{}),va.renderAction("loadScene"),Hd(),He(),(0,Va.jsx)(Sg,{}),Ia&&(0,Va.jsx)(Et,{isCollaborating:nc,collaboratorCount:ja.collaborators.size,onClick:Ia})]}),(0,Va.jsx)(ut,{actionManager:va,appState:ja,setAppState:xa,showThemeBtn:Xb}),ja.fileHandle&&(0,Va.jsx)(Va.Fragment,{children:va.renderAction("saveToActiveFile")})]})})}),oa&&(0,Va.jsx)(oo,{heading:"selectedShapeActions",className:oc("zen-mode-transition",{"transition-left":rb}),children:(0,Va.jsx)(qn,{className:Cc.$C.SHAPE_ACTIONS_MENU, padding:2,style:{maxHeight:"".concat(ja.height-(ja.fileHandle?248:200),"px")},children:(0,Va.jsx)(Gt,{appState:ja,elements:Ca,renderAction:va.renderAction,elementType:ja.elementType})})})]}),!Pc&&(0,Va.jsx)(oo,{heading:"shapes",children:function(Ae){return(0,Va.jsxs)(Sc,{gap:4,align:"start",children:[(0,Va.jsxs)(Jc,{gap:1,children:[(0,Va.jsx)(qt,{zenModeEnabled:rb,checked:ja.elementLocked,onChange:Wa,title:$b("toolBar.lock")}),(0,Va.jsxs)(qn,{padding:1,className:oc({"zen-mode":rb}),children:[(0,Va.jsx)(pt, {appState:ja,elements:Ca}),Ae,(0,Va.jsx)(Jc,{gap:1,children:(0,Va.jsx)(wt,{canvas:Aa,elementType:ja.elementType,setAppState:xa})})]}),(0,Va.jsx)(lt,{appState:ja,setAppState:xa})]}),pf]})}}),(0,Va.jsxs)("div",{className:oc("layer-ui__wrapper__top-right zen-mode-transition",{"transition-right":rb}),children:[(0,Va.jsx)(kt,{children:0Ca.clientHeight&&("auto"===Ia||"scroll"===Ia))break a;Ca=Ca.parentElement}Ca=document}this.nearestScrollableContainer=Ca;this.nearestScrollableContainer.addEventListener(Cc.Ks.SCROLL,this.onScroll)}window.addEventListener(Cc.Ks.RESIZE, this.onResize,!1);window.addEventListener(Cc.Ks.UNLOAD,this.onUnload,!1);window.addEventListener(Cc.Ks.BLUR,this.onBlur,!1);window.addEventListener(Cc.Ks.DRAG_OVER,this.disableEvent,!1);window.addEventListener(Cc.Ks.DROP,this.disableEvent,!1)}}},{key:"componentDidUpdate",value:function(Ca,Ia){var Wa,$a,rb=this;Ca.langCode!==this.props.langCode&&this.updateLanguage();Ca.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled});Ia.viewModeEnabled!== this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements());Ca.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled});Ca.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme});Ca.gridModeEnabled!==this.props.gridModeEnabled&&this.setState({gridSize:this.props.gridModeEnabled?Cc.k:null});this.props.name&&Ca.name!==this.props.name&&this.setState({name:this.props.name});null===(Wa=this.excalidrawContainerRef.current)|| void 0===Wa||Wa.classList.toggle("theme--dark","dark"===this.state.theme);this.state.editingLinearElement&&!this.state.selectedElementIds[this.state.editingLinearElement.elementId]&&setTimeout(function(){rb.actionManager.executeAction($f)});Ca=Ia.multiElement;Ia.elementType!==this.state.elementType&&null!=Ca&&this.state.isBindingEnabled&&Wg(Ca)&&ng(Ca,this.state,this.scene,Hj(fd.getPointAtIndexGlobalCoordinates(Ca,-1)));var Hb={},Xb={},jc={},nc={},Tc={};this.state.collaborators.forEach(function(Zc, Dd){if(Zc.selectedElementIds)for(var Yd=0,md=Object.keys(Zc.selectedElementIds);Ydbm&&1!==Pq.value&&(Rt=bm/2*(Pq.value-1)),"translate(".concat(Rt,"px, ").concat(Qv,"px) scale(").concat(Pq.value,") rotate(").concat(Sk,"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")})}},md=document.createElement("textarea");md.dir="auto";md.tabIndex=0;md.dataset.type="wysiwyg";md.wrap="off";Object.assign(md.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)"});Yd();nc&& (md.oninput=function(){nc(Ak(md.value))});md.onkeydown=function(Mf){(Mf.stopPropagation(),"Escape"===Mf.key)?(Mf.preventDefault(),pf=!0,Ae()):"Enter"===Mf.key&&Mf[Af]?(Mf.preventDefault(),Mf.isComposing||229===Mf.keyCode)||(pf=!0,Ae()):("Tab"===Mf.key||Mf[Af]&&("BracketLeft"===Mf.code||"BracketRight"===Mf.code))&&(Mf.preventDefault(),Mf.shiftKey||"BracketLeft"===Mf.code?Sg():He(),md.dispatchEvent(new Event("input")))};var sd=" ".repeat(4),Hd=new RegExp("^ {1,".concat(4,"}")),He=function(){var Mf= md.selectionStart,wg=md.selectionEnd,Gl=ni(),sk=md.value;Gl.forEach(function(Sk){var bm=sk.slice(0,Sk);Sk=sk.slice(Sk);sk="".concat(bm).concat(sd).concat(Sk)});md.value=sk;md.selectionStart=Mf+4;md.selectionEnd=wg+4*Gl.length},Sg=function(){var Mf=md.selectionStart,wg=md.selectionEnd,Gl=ni(),sk=[],Sk=md.value;Gl.forEach(function(bm){var Lm=Sk.slice(bm,bm+4).match(Hd);if(Lm){var Yp=Sk.slice(0,bm);Lm=Sk.slice(bm+Lm[0].length);Sk="".concat(Yp).concat(Lm);sk.push(bm)}});md.value=Sk;sk.length&&(Mf>sk[sk.length- 1]?md.selectionStart=Math.max(Mf-4,sk[sk.length-1]):md.selectionStart=Mf,md.selectionEnd=Math.max(md.selectionStart,wg-4*sk.length))},ni=function(){var Mf=md.selectionStart,wg=md.selectionEnd,Gl=md.value,sk=Gl.slice(0,Mf).match(/[^\n]*$/)[0].length;return Mf-=sk,Gl.slice(Mf,wg).split("\n").reduce(function(Sk,bm,Lm,Yp){return Sk.concat(Lm?Sk[Lm-1]+Yp[Lm-1].length+1:Mf)},[]).reverse()},Ai=function(Mf){Mf.preventDefault();Mf.stopPropagation()},pf=!1,Ae=function(){El||(El=!0,md.onblur=null,md.oninput= null,md.onkeydown=null,Fl&&Fl.disconnect(),window.removeEventListener("resize",Yd),window.removeEventListener("wheel",Ai,!0),window.removeEventListener("pointerdown",Wi),window.removeEventListener("pointerup",ah),window.removeEventListener("blur",Ae),rk(),md.remove());Tc({text:Ak(md.value),viaKeyboard:pf})},ah=function wg(){window.removeEventListener("pointerup",wg);setTimeout(function(){md.onblur=Ae;md.focus()})},Wi=function(wg){(wg.target instanceof HTMLElement||wg.target instanceof SVGElement)&& wg.target.closest(".".concat(Cc.$C.SHAPE_ACTIONS_MENU))&&!Dj(wg.target)&&(md.onblur=null,window.addEventListener("pointerup",ah),window.addEventListener("blur",Ae))},rk=Ph.getScene(Pc).addCallback(function(){Yd();md.focus()}),El=!1;md.select();ah();var Fl=null;Zc&&"ResizeObserver"in window?(Fl=new window.ResizeObserver(function(){Yd()})).observe(Zc):window.addEventListener("resize",Yd);window.addEventListener("pointerdown",Wi);window.addEventListener("wheel",Ai,{passive:!1,capture:!0});null==Dd|| Dd.querySelector(".excalidraw-textEditorContainer").appendChild(md)}({id:Ca.id,appState:this.state,canvas:this.canvas,getViewportCoords:function(Hb,Xb){Hb=hk({sceneX:Hb,sceneY:Xb},Wa.state);return[Hb.x-Wa.state.offsetLeft,Hb.y-Wa.state.offsetTop]},onChange:ag(function(Hb){rb(Hb);!Ca.isDeleted&&Di(Ca)}),onSubmit:ag(function(Hb){var Xb=Hb.text;Hb=Hb.viaKeyboard;var jc=!Xb.trim();rb(Xb,jc);!jc&&Hb&&Wa.setState(function(nc){return{selectedElementIds:Wd(Wd({},nc.selectedElementIds),{},T({},Ca.id,!0))}}); jc&&Ll(Wa.scene.getElements(),[Ca]);jc&&!$a||Wa.history.resumeRecording();Wa.setState({draggingElement:null,editingElement:null});Wa.state.elementLocked&&si(Wa.canvas,Wa.state.elementType);Wa.focusContainer()}),element:Ca,excalidrawContainer:this.excalidrawContainerRef.current});this.deselectElements();rb(Ca.text)}},{key:"deselectElements",value:function(){this.setState({selectedElementIds:{},selectedGroupIds:{},editingGroupId:null})}},{key:"getTextElementAtPosition",value:function(Ca,Ia){return(Ca= this.getElementAtPosition(Ca,Ia))&&Xg(Ca)&&!Ca.isDeleted?Ca:null}},{key:"getElementAtPosition",value:function(Ca,Ia,Wa){var $a=this.getElementsAtPosition(Ca,Ia);if(1<$a.length){if(null!=Wa&&Wa.preferSelected)for(Wa=$a.length-1;-1Ia.length)return!1;var Wa=10/this.state.zoom.value;Ia=ca(Bg(Ia),4);var $a=Ia[1],rb=Ia[2],Hb=Ia[3];return Ca.x>Ia[0]-Wa&&Ca.x$a-Wa&&Ca.yAe;var wg=sd.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;le(El,{x:Fl,y:Mf});Di(El,{simultaneouslyUpdated:Hd})})}(Ca,Xb,Hb,rb,Ia.scene,Wa.shiftKey,jc[0],jc[1]),Ia.maybeSuggestBindingForAll(Xb),Wa.altKey&&!Ca.hit.hasBeenDuplicated){Ca.hit.hasBeenDuplicated= !0;var nc;jc=[];Wa=[];var Tc=new Map;Xb=new Map;var Xc=Ca.hit.element,Pc=lj(Ia.scene.getElementsIncludingDeleted());try{for(Pc.s();!(nc=Pc.n()).done;){var Zc=nc.value;if(Ia.state.selectedElementIds[Zc.id]||Zc.id===(null==Xc?void 0:Xc.id)&&Ca.hit.wasAddedToSelection){var Dd=Xj(Ia.state.editingGroupId,Tc,Zc),Yd=ca(Ch(Ca.origin.x-Ca.drag.offset.x,Ca.origin.y-Ca.drag.offset.y,Ia.state.gridSize),2);le(Dd,{x:Dd.x+(Yd[0]-Hb),y:Dd.y+(Yd[1]-rb)});jc.push(Dd);Wa.push(Zc);Xb.set(Zc.id,Dd.id)}else jc.push(Zc)}}catch(sd){Pc.e(sd)}finally{Pc.f()}nc= [].concat(jc,Wa);Tj(nc,Wa,Xb,"duplicatesServeAsOld");Ia.scene.replaceAllElements(nc)}return}}if(nc=Ia.state.draggingElement)if("freedraw"===nc.type?(Zc=nc.points,Dd=$a.x-nc.x,Yd=$a.y-nc.y,Hb=nc.simulatePressure?nc.pressures:[].concat(O(nc.pressures),[Wa.pressure]),le(nc,{points:[].concat(O(Zc),[[Dd,Yd]]),pressures:Hb})):Dg(nc)?(Ca.drag.hasOccurred=!0,Zc=nc.points,Dd=Hb-nc.x,Yd=rb-nc.y,Wa.shiftKey&&2===Zc.length&&(Yd=mk(Ia.state.elementType,Dd,Yd),Dd=Yd.width,Yd=Yd.height),1===Zc.length?le(nc,{points:[].concat(O(Zc), [[Dd,Yd]])}):1=rk&&Ai>=Ae})}(Zc,nc);Ia.setState(function(sd){return Me(Wd(Wd({},sd),{},{selectedElementIds:Wd(Wd(Wd({},sd.selectedElementIds),md.reduce(function(Hd,He){return Hd[He.id]=!0,Hd},{})),Ca.hit.element?T({},Ca.hit.element.id, !md.length):null)}),Ia.scene.getElements())})}}}})}},{key:"handlePointerMoveOverScrollbars",value:function(Ca,Ia){return Ia.scrollbars.isOverHorizontal?(Ca=Ca.clientX,this.setState({scrollX:this.state.scrollX-(Ca-Ia.lastCoords.x)/this.state.zoom.value}),Ia.lastCoords.x=Ca,!0):Ia.scrollbars.isOverVertical?(Ca=Ca.clientY,this.setState({scrollY:this.state.scrollY-(Ca-Ia.lastCoords.y)/this.state.zoom.value}),Ia.lastCoords.y=Ca,!0):!1}},{key:"onPointerUpFromPointerDownHandler",value:function(Ca){var Ia= this;return ag(function(Wa){var $a=Ia.state,rb=$a.draggingElement,Hb=$a.resizingElement,Xb=$a.multiElement,jc=$a.elementType,nc=$a.elementLocked,Tc=$a.isResizing;$a=$a.isRotating;if(Ia.setState({isResizing:!1,isRotating:!1,resizingElement:null,selectionElement:null,cursorButton:"up",editingElement:Xb||Xg(Ia.state.editingElement)?Ia.state.editingElement:null}),Ia.savePointer(Wa.clientX,Wa.clientY,"up"),Ia.state.editingLinearElement){var Xc=fd.handlePointerUp(Wa,Ia.state.editingLinearElement,Ia.state); Xc!==Ia.state.editingLinearElement&&Ia.setState({editingLinearElement:Xc,suggestedBindings:[]})}if(mo=null,window.removeEventListener(Cc.Ks.POINTER_MOVE,Ca.eventListeners.onMove),window.removeEventListener(Cc.Ks.POINTER_UP,Ca.eventListeners.onUp),window.removeEventListener(Cc.Ks.KEYDOWN,Ca.eventListeners.onKeyDown),window.removeEventListener(Cc.Ks.KEYUP,Ca.eventListeners.onKeyUp),"freedraw"===(null==rb?void 0:rb.type))return jc=hh(Wa,Ia.state),Xb=rb.points,nc=jc.x-rb.x,jc=jc.y-rb.y,nc===Xb[0][0]&& jc===Xb[0][1]&&(jc+=1E-4,nc+=1E-4),Wa=rb.simulatePressure?[]:[].concat(O(rb.pressures),[Wa.pressure]),le(rb,{points:[].concat(O(Xb),[[nc,jc]]),pressures:Wa}),void Ia.actionManager.executeAction($f);if(Dg(rb))1=Cc.qx?le(ja,{points:[].concat(O(jc),[[Hb-$a,Xb-rb]])}):yi(B.canvas,Cc.oc.POINTER):2jc||0>nc)||"ne"===$a&&0<=jc||"sw"===$a&&0>=jc||"se"===$a&&(0ja.points.length?[]:[xa]})};this.handleCanvasRef=function(ja){var xa,Aa,Ca;null!==ja?(B.canvas=ja,B.rc=Bj.canvas(B.canvas),B.canvas.addEventListener(Cc.Ks.WHEEL,B.handleWheel,{passive:!1}),B.canvas.addEventListener(Cc.Ks.TOUCH_START,B.onTapStart),B.canvas.addEventListener(Cc.Ks.TOUCH_END,B.onTapEnd)):(null===(xa=B.canvas)||void 0===xa||xa.removeEventListener(Cc.Ks.WHEEL,B.handleWheel), null===(Aa=B.canvas)||void 0===Aa||Aa.removeEventListener(Cc.Ks.TOUCH_START,B.onTapStart),null===(Ca=B.canvas)||void 0===Ca||Ca.removeEventListener(Cc.Ks.TOUCH_END,B.onTapEnd))};this.handleAppOnDrop=function(){var ja=(0,ff.Z)(Zd().mark(function Ca(Aa){var Ia,Wa,$a,rb,Hb,Xb,jc,nc,Tc,Xc;return Zd().wrap(function(Pc){for(;;)switch(Pc.prev=Pc.next){case 0:if(Pc.prev=0,"image/png"!==(null==($a=Aa.dataTransfer.files[0])?void 0:$a.type)&&"image/svg+xml"!==(null==$a?void 0:$a.type)){Pc.next=21;break}if(!nm){Pc.next= 14;break}return Pc.prev=4,rb=Aa.dataTransfer.items[0],Pc.next=8,rb.getAsFileSystemHandle();case 8:$a.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($a,B.state,B.scene.getElementsIncludingDeleted());case 16:return Hb=Pc.sent,Xb=Hb.elements,jc=Hb.appState,B.syncActionResult({elements:Xb,appState:Wd(Wd({},jc||B.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",B.setState({isLoading:!1,errorMessage:Pc.t1.message}));case 26:if(""===(nc=Aa.dataTransfer.getData(Cc.LO.excalidrawlib))){Pc.next=30;break}return B.addElementsFromPasteOrLibrary({elements:JSON.parse(nc),position:Aa}),Pc.abrupt("return");case 30:if(!((null==(Tc=null===(Ia=Aa.dataTransfer)||void 0===Ia?void 0:Ia.files[0])?void 0:Tc.type)===Cc.LO.excalidrawlib||null!=Tc&&null!==(Wa=Tc.name)&&void 0!==Wa&&Wa.endsWith(".excalidrawlib"))){Pc.next=35;break}B.library.importLibrary(Tc).then(function(){B.setState({isLibraryOpen:!1}); B.setState({isLibraryOpen:!0})}).catch(function(Zc){return B.setState({isLoading:!1,errorMessage:Zc.message})});Pc.next=49;break;case 35:if(B.setState({isLoading:!0}),!nm){Pc.next=47;break}return Pc.prev=37,Xc=Aa.dataTransfer.items[0],Pc.next=41,Xc.getAsFileSystemHandle();case 41:Tc.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,B.loadFileToCanvas(Tc);case 49:case "end":return Pc.stop()}},Ca,null,[[0,23],[4,11], [37,44]])}));return function(Aa){return ja.apply(this,arguments)}}();this.loadFileToCanvas=function(ja){vl(ja,B.state,B.scene.getElementsIncludingDeleted()).then(function(xa){return B.syncActionResult({elements:xa.elements,appState:Wd(Wd({},xa.appState||B.state),{},{isLoading:!1}),commitToHistory:!0})}).catch(function(xa){B.setState({isLoading:!1,errorMessage:xa.message})})};this.handleCanvasContextMenu=function(ja){ja.preventDefault();var xa=hh(ja,B.state),Aa=(xa=B.getElementAtPosition(xa.x,xa.y, {preferSelected:!0}))?"element":"canvas",Ca=B.excalidrawContainerRef.current.getBoundingClientRect(),Ia=ja.clientX-Ca.left,Wa=ja.clientY-Ca.top;xa&&!B.state.selectedElementIds[xa.id]?B.setState({selectedElementIds:T({},xa.id,!0)},function(){B._openContextMenu({top:Wa,left:Ia},Aa)}):B._openContextMenu({top:Wa,left:Ia},Aa)};this.maybeDragNewGenericElement=function(ja,xa){var Aa=B.state.draggingElement,Ca=ja.lastCoords;if(Aa)if("selection"===Aa.type)Ok(Aa,B.state.elementType,ja.origin.x,ja.origin.y, Ca.x,Ca.y,Math.abs(ja.origin.x-Ca.x),Math.abs(ja.origin.y-Ca.y),xa.shiftKey,xa.altKey);else{var Ia=ca(Ch(Ca.x,Ca.y,B.state.gridSize),2);Ca=Ia[0];Ia=Ia[1];Ok(Aa,B.state.elementType,ja.originInGrid.x,ja.originInGrid.y,Ca,Ia,Math.abs(ja.originInGrid.x-Ca),Math.abs(ja.originInGrid.y-Ia),xa.shiftKey,xa.altKey);B.maybeSuggestBindingForAll([Aa])}};this.maybeHandleResize=function(ja,xa){var Aa=Sf(B.scene.getElements(),B.state),Ca=ja.resize.handleType;B.setState({isResizing:Ca&&"rotation"!==Ca,isRotating:"rotation"=== Ca});var Ia=ja.lastCoords;Ia=ca(Ch(Ia.x-ja.resize.offset.x,Ia.y-ja.resize.offset.y,B.state.gridSize),2);a:{var Wa=ja.resize.arrowDirection,$a=xa.shiftKey,rb=xa.altKey,Hb=xa.shiftKey;xa=Ia[0];var Xb=Ia[1];Ia=ja.resize.center.x;var jc=ja.resize.center.y;if(1===Aa.length){Ia=ca(Aa,1)[0];if("rotation"===Ca)Ca=ca(Vf(Ia),4),Ca=5*Math.PI/2+Math.atan2(Xb-(Ca[1]+Ca[3])/2,xa-(Ca[0]+Ca[2])/2),$a&&(Ca+=Cc.ay/2,Ca-=Ca%Cc.ay),Ca=fe(Ca),le(Ia,{angle:Ca}),Di(Ia);else if(!Dg(Ia)||2!==Ia.points.length||"nw"!==Ca&& "ne"!==Ca&&"sw"!==Ca&&"se"!==Ca)if(!Xg(Ia)||"nw"!==Ca&&"ne"!==Ca&&"sw"!==Ca&&"se"!==Ca)Ca&&Fi(ja.originalElements.get(Ia.id),Hb,Ia,Ca,rb,xa,Xb);else{$a=ca(Vf(Ia),4);Hb=$a[0];ja=$a[1];Wa=$a[2];$a=$a[3];Xb=ca(Jf(xa,Xb,(Hb+Wa)/2,(ja+$a)/2,-Ia.angle),2);xa=Xb[0];Xb=Xb[1];switch(Ca){case "se":var nc=Math.max((xa-Hb)/(Wa-Hb),(Xb-ja)/($a-ja));break;case "nw":nc=Math.max((Wa-xa)/(Wa-Hb),($a-Xb)/($a-ja));break;case "ne":nc=Math.max((xa-Hb)/(Wa-Hb),($a-Xb)/($a-ja));break;case "sw":nc=Math.max((Wa-xa)/(Wa-Hb), (Xb-ja)/($a-ja))}0