"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5332],{23362:function(t,e,i){i.d(e,{EO:function(){return m},IV:function(){return o},JQ:function(){return h},Of:function(){return x},PQ:function(){return g},Q$:function(){return c},QE:function(){return p},Qo:function(){return l},SE:function(){return Q},YK:function(){return s},ZR:function(){return y},a6:function(){return f},jZ:function(){return a},k:function(){return r},tA:function(){return u},xK:function(){return d}});var n=i(85270);let o={strokeStyle:"#3498DB",fillStyle:"white",lineWidth:2},a=12,h=7,r=25,l=7,f={[n.Qe.TopLeft]:"nwse-resize",[n.Qe.TopRight]:"nesw-resize",[n.Qe.BottomRight]:"nwse-resize",[n.Qe.BottomLeft]:"nesw-resize",[n.Qe.Top]:"ns-resize",[n.Qe.Right]:"ew-resize",[n.Qe.Bottom]:"ns-resize",[n.Qe.Left]:"ew-resize",[n.Qe.Drag]:"move",[n.Qe.RotateTL]:"rotate",[n.Qe.RotateTR]:"rotate",[n.Qe.RotateBL]:"rotate",[n.Qe.RotateBR]:"rotate",[n.Qe.None]:"default"},x={r:34,g:197,b:94},u={min:2,max:76,default:39},y={min:0,max:100,default:20},g={min:.5,max:3},d=.075,s=.03,c=.6,m=5,p=2e3,Q={[n.ED.PaintBrush]:"/hint/paint-brush.png",[n.ED.Eraser]:"/hint/eraser.png",[n.ED.MaskInversion]:"/hint/mask-inversion.png",[n.ED.PointPrompt]:"/hint/point-prompt.png",[n.ED.BoxPrompt]:"/hint/box-prompt.png",[n.ED.Lasso]:"/hint/lasso.png",[n.ED.MagicWand]:"/hint/magic-wand.png",[n.ED.Rectangle]:"/hint/rectangle.png",[n.ED.Polyline]:"/hint/polyline.png"}},85332:function(t,e,i){i.d(e,{Vg:function(){return W},o7:function(){return s},LN:function(){return j},X1:function(){return d},jJ:function(){return O},pS:function(){return b},LL:function(){return B},U:function(){return z},P8:function(){return T},r7:function(){return U},Of:function(){return y},W4:function(){return g},Nn:function(){return u},vO:function(){return L},Zo:function(){return p},jV:function(){return m},fV:function(){return V},yK:function(){return N},Lu:function(){return X},W3:function(){return I},V8:function(){return S},aS:function(){return C},lx:function(){return A},tg:function(){return c},We:function(){return k}});var n=i(85270),o=i(23362);let a=t=>{let[e,i,n]=t.map(t=>t/255);return[100*(.4124564*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3575761*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1804375*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126729*e+.7151522*i+.072175*n),100*(.0193339*e+.119192*i+.9503041*n)]},h=t=>{let[e,i,n]=t;return e/=95.047,i/=100,n/=108.883,e=e>.008856?Math.cbrt(e):7.787*e+16/116,[116*(i=i>.008856?Math.cbrt(i):7.787*i+16/116)-16,500*(e-i),200*(i-(n=n>.008856?Math.cbrt(n):7.787*n+16/116))]},r=t=>h(a(t)),l=(t,e)=>{let i=Math.atan2(e,t);return i<0&&(i+=2*Math.PI),[Math.hypot(t,e),i]},f=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,[a,h,r]=t,[f,x,u]=e,[y,g]=l(h,r),[d,s]=l(x,u),c=(a+f)/2,m=(y+d)/2,p=.5*(1-Math.sqrt(Math.pow(m,7)/(Math.pow(m,7)+6103515625))),[Q,M]=l(h*(1+p),r),[w,R]=l(x*(1+p),u),E=(Q+w)/2,k=Math.abs(M-R)>Math.PI?(M+R+2*Math.PI)/2:(M+R)/2;return Math.sqrt(Math.pow((f-a)/(i*(1+.015*Math.pow(c-50,2)/Math.sqrt(20+Math.pow(c-50,2)))),2)+Math.pow((w-Q)/(n*(1+.045*E)),2)+Math.pow(2*Math.sqrt(Q*w)*Math.sin((R-M)/2)/(o*(1+.015*E*(1-.17*Math.cos(k-Math.PI/6)+.24*Math.cos(2*k)+.32*Math.cos(3*k+Math.PI/30)-.2*Math.cos(4*k-21*Math.PI/60)))),2))},x={[n.Qe.Right]:0*Math.PI,[n.Qe.BottomRight]:1/4*Math.PI,[n.Qe.Bottom]:.5*Math.PI,[n.Qe.BottomLeft]:3/4*Math.PI,[n.Qe.Left]:1*Math.PI,[n.Qe.TopLeft]:5/4*Math.PI,[n.Qe.Top]:1.5*Math.PI,[n.Qe.TopRight]:7/4*Math.PI,[n.Qe.RotateBR]:1/4*Math.PI,[n.Qe.RotateBL]:3/4*Math.PI,[n.Qe.RotateTL]:5/4*Math.PI,[n.Qe.RotateTR]:7/4*Math.PI},u=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if([n.Qe.None,n.Qe.Drag].includes(t))return o.a6[t];let i=(x[t]+e+2*Math.PI)%(2*Math.PI),a=Math.PI/8;if([n.Qe.RotateTL,n.Qe.RotateTR,n.Qe.RotateBL,n.Qe.RotateBR].includes(t))return"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='-9 -9 27 36' fill='none'%3E%3Cg transform='rotate(".concat(180/Math.PI*i," 4.5 9)'%3E%3Cmask id='a' maskUnits='userSpaceOnUse' x='-2.718' y='-.504' width='14.027' height='17.304' fill='%23000'%3E%3Cpath fill='%23fff' d='M-2.718-.504h14.027V16.8H-2.718z'/%3E%3Cpath d='M3.455 14.754a5.776 5.776 0 0 0 3.785-7.24 6.26 6.26 0 0 0-2.972-3.602L2.45 2.961'/%3E%3C/mask%3E%3Cpath d='M3.071 13.529a1.283 1.283 0 1 0 .768 2.45l-.768-2.45zM7.24 7.515l1.225-.384-.001-.005-1.224.388zM4.269 3.912l.614-1.127-.019-.01-.595 1.138zM3.046 1.824a1.283 1.283 0 1 0-1.189 2.275l1.19-2.275zm.793 14.155a7.06 7.06 0 0 0 4.146-3.466l-2.275-1.19a4.495 4.495 0 0 1-2.638 2.206l.768 2.45zm4.146-3.466a7.06 7.06 0 0 0 .481-5.382l-2.45.768a4.495 4.495 0 0 1-.306 3.425l2.275 1.19zm.479-5.387a7.54 7.54 0 0 0-3.581-4.341L3.655 5.04a4.975 4.975 0 0 1 2.362 2.863l2.447-.777zm-3.6-4.352-1.818-.951-1.19 2.275 1.818.951 1.19-2.275z' fill='%23fff' mask='url(%23a)'/%3E%3Cmask id='b' maskUnits='userSpaceOnUse' x='.144' y='-.504' width='8.773' height='8.773' fill='%23000'%3E%3Cpath fill='%23fff' d='M.144-.504h8.773v8.773H.144z'/%3E%3Cpath d='m5.514 2.002-3.062.959.959 3.062'/%3E%3C/mask%3E%3Cpath d='M5.897 3.227A1.283 1.283 0 1 0 5.13.777l.768 2.45zm-3.446-.266-.384-1.225a1.283 1.283 0 0 0-.841 1.609l1.225-.384zm-.266 3.446a1.283 1.283 0 1 0 2.45-.768l-2.45.768zM5.13.777l-3.062.959.768 2.45 3.062-.959L5.13.777zM1.226 3.345l.959 3.062 2.45-.768-.959-3.062-2.45.768z' fill='%23fff' mask='url(%23b)'/%3E%3Cmask id='c' maskUnits='userSpaceOnUse' x='-.096' y='9.846' width='8.884' height='8.884' fill='%23000'%3E%3Cpath fill='%23fff' d='M-.096 9.846h8.884v8.884H-.096z'/%3E%3Cpath d='m5.282 16.192-3.038-1.035 1.035-3.038'/%3E%3C/mask%3E%3Cpath d='M4.867 17.407a1.283 1.283 0 1 0 .828-2.43l-.828 2.43zm-2.623-2.251-1.215-.414c-.229.671.13 1.401.801 1.629l.414-1.215zm2.251-2.623a1.283 1.283 0 1 0-2.43-.828l2.43.828zm1.201 2.444-3.038-1.036-.828 2.43 3.038 1.035.828-2.43zm-2.237.594 1.035-3.038-2.43-.828-1.035 3.038 2.43.828z' fill='%23fff' mask='url(%23c)'/%3E%3Cmask id='d' fill='%23fff'%3E%3Cpath d='M3.455 14.754a5.776 5.776 0 0 0 3.785-7.24 6.26 6.26 0 0 0-2.972-3.602L2.45 2.961'/%3E%3C/mask%3E%3Cpath d='M3.071 13.529a1.283 1.283 0 1 0 .768 2.45l-.768-2.45zM7.24 7.515l1.225-.384-.001-.005-1.224.388zM4.269 3.912l.614-1.127-.019-.01-.595 1.138zM3.046 1.824a1.283 1.283 0 1 0-1.189 2.275l1.19-2.275zm.793 14.155a7.06 7.06 0 0 0 4.146-3.466l-2.275-1.19a4.495 4.495 0 0 1-2.638 2.206l.768 2.45zm4.146-3.466a7.06 7.06 0 0 0 .481-5.382l-2.45.768a4.495 4.495 0 0 1-.306 3.425l2.275 1.19zm.479-5.387a7.54 7.54 0 0 0-3.581-4.341L3.655 5.04a4.975 4.975 0 0 1 2.362 2.863l2.447-.777zm-3.6-4.352-1.818-.951-1.19 2.275 1.818.951 1.19-2.275z' fill='%23fff' mask='url(%23d)'/%3E%3Cmask id='e' fill='%23fff'%3E%3Cpath d='m5.514 2.002-3.062.959.959 3.062'/%3E%3C/mask%3E%3Cpath d='M5.897 3.227A1.283 1.283 0 1 0 5.13.777l.768 2.45zm-3.446-.266-.384-1.225a1.283 1.283 0 0 0-.841 1.609l1.225-.384zm-.266 3.446a1.283 1.283 0 1 0 2.45-.768l-2.45.768zM5.13.777l-3.062.959.768 2.45 3.062-.959L5.13.777zM1.226 3.345l.959 3.062 2.45-.768-.959-3.062-2.45.768z' fill='%23fff' mask='url(%23e)'/%3E%3Cmask id='f' fill='%23fff'%3E%3Cpath d='m5.282 16.192-3.038-1.035 1.035-3.038'/%3E%3C/mask%3E%3Cpath d='M4.867 17.407a1.283 1.283 0 1 0 .828-2.43l-.828 2.43zm-2.623-2.251-1.215-.414c-.229.671.13 1.401.801 1.629l.414-1.215zm2.251-2.623a1.283 1.283 0 1 0-2.43-.828l2.43.828zm1.201 2.444-3.038-1.036-.828 2.43 3.038 1.035.828-2.43zm-2.237.594 1.035-3.038-2.43-.828-1.035 3.038 2.43.828z' fill='%23fff' mask='url(%23f)'/%3E%3Cg stroke='%23000' stroke-width='1.284' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.455 14.754a5.776 5.776 0 0 0 3.785-7.24 6.26 6.26 0 0 0-2.972-3.602L2.45 2.961'/%3E%3Cpath d='m5.514 2.002-3.062.959.959 3.062m1.871 10.169-3.038-1.035 1.035-3.038'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\") 18 18, auto");for(let t in x){let e=x[t];if(Math.min(Math.abs(e-i),Math.abs(e-i+2*Math.PI),Math.abs(e-i-2*Math.PI))<=a)return o.a6[t]}return o.a6[n.Qe.None]},y=t=>{let{x:e,y:i,images:n}=t,a=-1;for(let t=n.length-1;t>=0;t--){let h=n[t];if(e>=h.x-o.Qo&&e<=h.x+h.width+o.Qo&&i>=h.y-o.Qo&&i<=h.y+h.height+o.Qo){a=t;break}}return{image:-1===a?null:n[a],index:a}},g=t=>{let{x:e,y:i,images:n,distanceTolerance:o=7,exceptIndex:a=-1}=t;for(let t=n.length-1;t>=0;t--){let h=n[t];if(t===a)continue;let r=h.x+h.width/2,l=h.y+h.height/2,f=e-r,x=i-l,u=f*Math.cos(-h.rotation)-x*Math.sin(-h.rotation),y=f*Math.sin(-h.rotation)+x*Math.cos(-h.rotation),g=u+h.width/2,d=y+h.height/2;if(g>=-o&&g<=h.width+o&&d>=-o&&d<=h.height+o)return{image:h,index:t}}return{image:null,index:-1}},d=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=o.IV.lineWidth/i;t.strokeStyle=o.IV.strokeStyle,t.lineWidth=n,t.save(),t.translate(e.x+e.width/2,e.y+e.height/2),t.rotate(e.rotation),t.translate(-(e.x+e.width/2),-(e.y+e.height/2)),[{x1:e.x,y1:e.y,x2:e.x+e.width,y2:e.y},{x1:e.x+e.width,y1:e.y,x2:e.x+e.width,y2:e.y+e.height},{x1:e.x+e.width,y1:e.y+e.height,x2:e.x,y2:e.y+e.height},{x1:e.x,y1:e.y+e.height,x2:e.x,y2:e.y}].forEach(e=>{t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()}),t.restore()},s=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.strokeStyle=o.IV.strokeStyle,t.fillStyle=o.IV.fillStyle,t.lineWidth=o.IV.lineWidth/i,d(t,e,i);let n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x,y:e.y+e.height},{x:e.x+e.width,y:e.y+e.height}];t.save(),t.translate(e.x+e.width/2,e.y+e.height/2),t.rotate(e.rotation),t.translate(-(e.x+e.width/2),-(e.y+e.height/2));let a=o.jZ/i,h=a/2;n.forEach(e=>{t.beginPath(),t.fillRect(e.x-h,e.y-h,a,a),t.strokeRect(e.x-h,e.y-h,a,a)}),t.restore()},c=t=>{let{mode:e,image:i,offsetX:o,offsetY:a,mousePosition:h,minSize:r=20}=t,l=i.width/i.height;if([n.Qe.TopLeft,n.Qe.TopRight,n.Qe.BottomRight,n.Qe.BottomLeft].includes(e)){let t,a;a=(t=e===n.Qe.TopLeft||e===n.Qe.BottomLeft?i.x+i.width-o:o-i.x)/l,(t<r||a<r)&&(t<r&&(a=(t=r)/l),a<r&&(t=(a=r)*l)),e===n.Qe.TopLeft?(i.x=i.x+i.width-t,i.y=i.y+i.height-a):e===n.Qe.BottomLeft?i.x=i.x+i.width-t:e===n.Qe.TopRight&&(i.y=i.y+i.height-a),i.width=t,i.height=a}else if(e===n.Qe.Top){let t=i.y+i.height-a;t>=r&&(i.y=a,i.height=t)}else if(e===n.Qe.Right){let t=o-i.x;t>=r&&(i.width=t)}else if(e===n.Qe.Bottom){let t=a-i.y;t>=r&&(i.height=t)}else if(e===n.Qe.Left){let t=i.x+i.width-o;t>=r&&(i.x=o,i.width=t)}else e===n.Qe.Drag&&(i.x=o-h.x,i.y=a-h.y)},m=t=>{let{image:e,offsetX:i,offsetY:n,distanceTolerance:o=5}=t,a=-1,{x:h,y:r,width:l,height:f}=e;return[{x1:h,y1:r,x2:h+l,y2:r},{x1:h+l,y1:r,x2:h+l,y2:r+f},{x1:h+l,y1:r+f,x2:h,y2:r+f},{x1:h,y1:r+f,x2:h,y2:r}].forEach((t,e)=>{i>=Math.min(t.x1,t.x2)-o&&i<=Math.max(t.x1,t.x2)+o&&n>=Math.min(t.y1,t.y2)-o&&n<=Math.max(t.y1,t.y2)+o&&(a=e)}),a},p=t=>{let{image:e,offsetX:i,offsetY:n}=t,a=-1,{x:h,y:r,width:l,height:f}=e,x=o.jZ/2;return[{x:h,y:r},{x:h+l,y:r},{x:h+l,y:r+f},{x:h,y:r+f}].forEach((t,e)=>{i>=t.x-x&&i<=t.x+x&&n>=t.y-x&&n<=t.y+x&&(a=e)}),a},Q=(t,e,i,o)=>{let a=t===n.Qe.Top||t===n.Qe.Left?i-e:e-i,h=Math.max(Math.abs(a),o),r=a<0,l=r?i+(t===n.Qe.Top||t===n.Qe.Left?h:-h):i+(t===n.Qe.Top||t===n.Qe.Left?-h:h);return{newSize:h,handleLocal:l,flip:r}},M=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0},n=Math.cos(e),o=Math.sin(e);return{x:t.x*n-t.y*o+i.x,y:t.x*o+t.y*n+i.y}},w=(t,e,i)=>{let n=Math.atan2(e.y,e.x),o=Math.atan2(i.y,i.x);return{...t,rotation:t.rotation+o-n}},R=(t,e,i)=>{let n=i.x-e.x,o=i.y-e.y;return{...t,x:t.x+n,y:t.y+o}},E=(t,e,i,o)=>{let a={...e},h=e.width/2,r=e.height/2,l=0,f=0,x=0,u=0;switch(t){case n.Qe.TopLeft:l=-h,f=-r,x=h,u=r;break;case n.Qe.TopRight:l=h,f=-r,x=-h,u=r;break;case n.Qe.BottomRight:l=h,f=r,x=-h,u=-r;break;case n.Qe.BottomLeft:l=-h,f=r,x=h,u=-r;break;case n.Qe.Top:l=0,f=-r,x=0,u=r;break;case n.Qe.Bottom:l=0,f=r,x=0,u=-r;break;case n.Qe.Left:l=-h,f=0,x=h,u=0;break;case n.Qe.Right:l=h,f=0,x=-h,u=0;break;default:return a}let y=e.x+h,g=e.y+r,d=M({x:i.x+y-y,y:i.y+g-g},-e.rotation),s=d.x,c=d.y,m=e.width,p=e.height;if([n.Qe.TopLeft,n.Qe.TopRight,n.Qe.BottomRight,n.Qe.BottomLeft].includes(t)){let i=x-s,h=u-c,r=e.width/e.height;Math.abs(i/h)>r?p=(m=Math.max(Math.abs(h*r),o))/r:m=(p=Math.max(Math.abs(i/r),o))*r,m<o&&(p=(m=o)/r),p<o&&(m=(p=o)*r),([n.Qe.TopLeft,n.Qe.BottomLeft].includes(t)&&i<0||[n.Qe.TopRight,n.Qe.BottomRight].includes(t)&&i>0)&&(a.flipX=!a.flipX),([n.Qe.TopLeft,n.Qe.TopRight].includes(t)&&h<0||[n.Qe.BottomLeft,n.Qe.BottomRight].includes(t)&&h>0)&&(a.flipY=!a.flipY),l=x-Math.sign(i)*m,f=u-Math.sign(h)*p}else if(t===n.Qe.Top||t===n.Qe.Bottom){let{newSize:e,handleLocal:i,flip:n}=Q(t,c,u,o);p=e,f=i,a.flipY=n?!a.flipY:a.flipY}else if(t===n.Qe.Left||t===n.Qe.Right){let{newSize:e,handleLocal:i,flip:n}=Q(t,s,x,o);m=e,l=i,a.flipX=n?!a.flipX:a.flipX}let w=M({x:(x+l)/2,y:(u+f)/2},e.rotation);return a.width=m,a.height=p,a.x=y+w.x-m/2,a.y=g+w.y-p/2,a},k=t=>{let{mode:e,image:i,lastMousePosition:o,currentMousePosition:a,minSize:h=20}=t;return[n.Qe.RotateTL,n.Qe.RotateTR,n.Qe.RotateBL,n.Qe.RotateBR].includes(e)?w(i,o,a):e===n.Qe.Drag?R(i,o,a):E(e,i,a,h)},L=t=>{let{image:e,offsetX:i,offsetY:a,scale:h=1,considerRotation:r=!1}=t,l=e.x+e.width/2,f=e.y+e.height/2,x=M({x:i-l,y:a-f},-e.rotation,{x:l,y:f}),u=[{x:e.x,y:e.y,mode:n.Qe.TopLeft},{x:e.x+e.width,y:e.y,mode:n.Qe.TopRight},{x:e.x+e.width,y:e.y+e.height,mode:n.Qe.BottomRight},{x:e.x,y:e.y+e.height,mode:n.Qe.BottomLeft}],y=o.JQ/h;for(let t of u)if(Math.hypot(x.x-t.x,x.y-t.y)<=y)return t.mode;let g=[{x1:e.x,y1:e.y,x2:e.x+e.width,y2:e.y,mode:n.Qe.Top},{x1:e.x+e.width,y1:e.y,x2:e.x+e.width,y2:e.y+e.height,mode:n.Qe.Right},{x1:e.x+e.width,y1:e.y+e.height,x2:e.x,y2:e.y+e.height,mode:n.Qe.Bottom},{x1:e.x,y1:e.y+e.height,x2:e.x,y2:e.y,mode:n.Qe.Left}],d=o.Qo/h;for(let t of g)if(function(t,e,i,n,o,a){let h,r;let l=o-i,f=a-n,x=l*l+f*f,u=-1;return 0!==x&&(u=((t-i)*l+(e-n)*f)/x),u<0?(h=i,r=n):u>1?(h=o,r=a):(h=i+u*l,r=n+u*f),Math.hypot(t-h,e-r)}(x.x,x.y,t.x1,t.y1,t.x2,t.y2)<=d)return t.mode;if(x.x>=e.x&&x.x<=e.x+e.width&&x.y>=e.y&&x.y<=e.y+e.height)return n.Qe.Drag;if(r){let t=[{x:e.x,y:e.y,mode:n.Qe.RotateTL},{x:e.x+e.width,y:e.y,mode:n.Qe.RotateTR},{x:e.x+e.width,y:e.y+e.height,mode:n.Qe.RotateBR},{x:e.x,y:e.y+e.height,mode:n.Qe.RotateBL}],i=o.k/h;for(let e of t)if(Math.hypot(x.x-e.x,x.y-e.y)<=i)return e.mode}return n.Qe.None},C=(t,e,i,a,h)=>{let r=t.getContext("2d");r&&(r.strokeStyle="rgba(".concat(o.Of.r,",").concat(o.Of.g,",").concat(o.Of.b,",1)"),r.lineJoin="round",r.lineCap="round",a===n.ED.Eraser?r.globalCompositeOperation="destination-out":r.globalCompositeOperation="source-over",r.lineWidth=h,r.beginPath(),r.moveTo(e.x*t.width,e.y*t.height+.001),r.lineTo(i.x*t.width,i.y*t.height+.001),r.stroke(),r.closePath(),r.globalCompositeOperation="source-over")},T=function(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],{x1:n,y1:o,x2:a,y2:h}=e,r=t.getContext("2d");r&&(i&&r.clearRect(0,0,t.width,t.height),r.lineWidth=2,r.setLineDash([3,5]),r.beginPath(),r.moveTo(n,o),r.lineTo(a,o),r.lineTo(a,h),r.lineTo(n,h),r.lineTo(n,o),r.stroke())},z=function(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=t.getContext("2d");if(!n)return;let{x1:a,y1:h,x2:r,y2:l}=e;i?(n.fillStyle="rgba(".concat(o.Of.r,",").concat(o.Of.g,",").concat(o.Of.b,",255)"),n.fillRect(a,h,r-a,l-h)):n.clearRect(a,h,r-a,l-h)},b=t=>{let{canvas:e,startPoint:i,endPoint:n,isRatio:o=!0,removeAll:a=!0}=t,h=e.getContext("2d");h&&(a&&h.clearRect(0,0,e.width,e.height),h.lineWidth=2,h.setLineDash([3,5]),h.beginPath(),o&&(i.x*=e.width,i.y*=e.height,n.x*=e.width,n.y*=e.height),h.moveTo(i.x,i.y),h.lineTo(n.x,n.y),h.stroke())},B=t=>{let{canvas:e,points:i,isRatio:n=!0,removeAll:o=!0}=t,a=e.getContext("2d");if(!a)return;let{width:h,height:r}=e;o&&a.clearRect(0,0,h,r),a.lineWidth=2,a.setLineDash([3,5]),a.beginPath(),i.forEach((t,e)=>{let{x:i,y:o}=t;n&&(i*=h,o*=r),0===e?a.moveTo(i,o):a.lineTo(i,o)}),a.stroke()},I=t=>{let e=t.getContext("2d");if(!e)return;let i=e.getImageData(0,0,t.width,t.height),n=i.data;for(let t=0;t<n.length;t+=4)n[t+3]>0&&(n[t]>0||n[t+1]>0||n[t+2]>0)?(n[t]=0,n[t+1]=0,n[t+2]=0,n[t+3]=0):(n[t]=o.Of.r,n[t+1]=o.Of.g,n[t+2]=o.Of.b,n[t+3]=255);e.putImageData(i,0,0)},P=t=>{let e=t.getContext("2d");return!e||new Uint32Array(e.getImageData(0,0,t.width,t.height).data.buffer).some(t=>0!==t)},v=(t,e,i)=>(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y),D=(t,e)=>{let i=0;return e.forEach((n,o)=>{let a=e[(o+1)%e.length];n.y<=t.y?a.y>t.y&&v(n,a,t)>0&&(i+=1):a.y<=t.y&&0>v(n,a,t)&&(i-=1)}),0!==i},O=t=>{let{canvas:e,points:i,isRatio:n=!0,positiveMode:a=!0}=t,h=e.getContext("2d");if(!h||i.length<3)return;let{width:r,height:l}=e,f=h.getImageData(0,0,r,l),x=f.data,u=a?o.Of:{r:0,g:0,b:0},y=a?255:0,g=i.map(t=>{let{x:e,y:i}=t;return{x:n?e*r:e,y:n?i*l:i}});for(let t=0;t<l;t++)for(let e=0;e<r;e++){let i=(t*r+e)*4;D({x:e,y:t},g)&&(x[i]=u.r,x[i+1]=u.g,x[i+2]=u.b,x[i+3]=y)}h.putImageData(f,0,0)},S=function(t,e,i,n){let a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],h=t.getContext("2d",{willReadFrequently:!0});if(!h)return;let l=e.data,x=e.width,u=e.height,y=i.x,g=i.y,d=(g*x+y)*4,s=new Uint8Array([l[d],l[d+1],l[d+2]]),c=r([s[0],s[1],s[2]]),m=[{x:y,y:g}],p=new Uint8Array(x*u);p[m[0].y*x+m[0].x]=1;let Q=t.width/x,M=t.height/u,w=h.getImageData(0,0,t.width,t.height),R=w.data,E=[[1,0],[-1,0],[0,1],[0,-1]];for(;m.length>0;){let{x:e,y:i}=m.pop(),h=(Math.round(e*Q)+Math.round(i*M)*t.width)*4;a?(R[h]=o.Of.r,R[h+1]=o.Of.g,R[h+2]=o.Of.b,R[h+3]=255):(R[h]=0,R[h+1]=0,R[h+2]=0,R[h+3]=0),E.forEach(t=>{let[o,a]=t,h=e+o,y=i+a;if(h>=0&&h<x&&y>=0&&y<u&&!p[y*x+h]){let t=(i*x+e)*4,o=new Uint8Array([l[t],l[t+1],l[t+2]]);f(c,r([o[0],o[1],o[2]]))<=n&&(m.push({x:h,y:y}),p[y*x+h]=1)}})}h.putImageData(w,0,0)},W=(t,e)=>{let i=t.getContext("2d");if(!i)return;let{x:n,y:o,width:a,height:h}=e;i.fillStyle="#dedede",i.fillRect(n,o,a,h)},U=t=>{let e=t.getContext("2d");e&&e.clearRect(0,0,t.width,t.height)},V=t=>P(t)?t.toDataURL("image/png").split(",")[1]:null,A=(t,e,i)=>{let n=t.getContext("2d");if(!n)return;let{x:o,y:a,width:h,height:r}=i;n.clearRect(0,0,t.width,t.height),n.drawImage(e,o,a,h,r)},N=(t,e)=>{let i=e.getBoundingClientRect();return{x:t.clientX-i.left,y:t.clientY-i.top}},X=(t,e,i)=>({x:e-(t.x+t.width/2),y:i-(t.y+t.height/2)}),Y=function(t,e,i,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},{fontSize:a=22,fontFamily:h="Arial",color:r="#6b7280"}=o;t.font="".concat(a,"px ").concat(h),t.fillStyle=r,t.textAlign="left",t.textBaseline="top",t.fillText(e,i,n-a)},j=t=>{let{ctx:e,frame:i,drawBackground:n=!0,drawStroke:o=!0,title:a}=t;n&&(e.fillStyle="white",e.fillRect(i.x,i.y,i.width,i.height)),o&&(e.lineWidth=1,e.strokeStyle="#e5e7eb",e.strokeRect(i.x,i.y,i.width,i.height)),a&&Y(e,a.text,i.x,i.y,{fontSize:a.fontSize})}}}]);