@leafer-draw/worker
Version:
1 lines • 177 kB
JavaScript
var LeaferUI=function(t){"use strict";var e,s;function i(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function r(t,e,s,i){return new(s||(s=Promise))(function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})}t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError,t.Answer=void 0,(s=t.Answer||(t.Answer={}))[s.No=0]="No",s[s.Yes=1]="Yes",s[s.NoAndSkip=2]="NoAndSkip",s[s.YesAndSkip=3]="YesAndSkip";function o(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;const{isArray:c}=Array;function u(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var o,n;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return f(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&f(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{o(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:f}=p;class g{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=o(s)?this[i]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(c(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:i}=this;s.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!o(t))){if("path"===r&&!this.__pathInputed)continue;e=i?i[r]:void 0,s[r]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null,this.__complexData&&this.__complexData.destroy()}}const y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=m;return e[t]?e[t]++:(e[t]=1,0)}},m=y;let x,w,v;const{max:b}=Math,B=[0,0,0,0],k={zero:[...B],tempFour:B,set:(t,e,s,i,r)=>(void 0===s&&(s=i=r=e),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t),setTemp:(t,e,s,i)=>S(B,t,e,s,i),toTempAB(t,e,s){v=s?l(t)?e:t:[],l(t)?(x=R(t),w=e):l(e)?(x=t,w=R(e)):(x=t,w=e),4!==x.length&&(x=C(x)),4!==w.length&&(w=C(w))},get(t,e){let s;if(!l(t))switch(t.length){case 4:s=o(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!o(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,s)=>l(t)&&l(e)?b(t,e):(T(t,e,s),S(v,b(x[0],w[0]),b(x[1],w[1]),b(x[2],w[2]),b(x[3],w[3]))),add:(t,e,s)=>l(t)&&l(e)?t+e:(T(t,e,s),S(v,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,s,i){if(l(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[o,n,a,h]=4===t.length?t:C(t);return S(r,a*s,h*e,o*s,n*e)}},{set:S,get:C,setTemp:R,toTempAB:T}=k,{round:P,pow:L,max:I,floor:E,PI:O}=Math,A={},M={within:(t,e,s)=>(u(e)&&(s=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(s)&&t>s&&(t=s),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=o(e)?1e12:L(10,e);return-0===(t=P(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(l(e)?e:e.width||0)/s.width,r=(l(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&M.assignScale(i,t);return i},getScaleFixedData(t,e,s,i,r){let{scaleX:o,scaleY:n}=t;if((i||e)&&(o<0&&(o=-o),n<0&&(n=-n)),e)if(!0===e)o=n=s?1:1/o;else{let t;l(e)?t=e:"zoom-in"===e&&(t=1),t&&(o=n=o>t||n>t?s?1:1/o:s?1:1/t)}return A.scaleX=o,A.scaleY=n,A},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>I(E(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const D=O/180,F=2*O,U=O/2;function N(){return{x:0,y:0}}function z(){return{x:0,y:0,width:0,height:0}}function Y(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:H,acos:G,sqrt:j}=Math,{float:V}=M,q={};function J(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:J(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:Y,getWorld:J,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},pixelScale(t,e,s){s||(s=t),s.a=t.a*e,s.b=t.b*e,s.c=t.c*e,s.d=t.d*e,s.e=t.e*e,s.f=t.f*e},scaleOfOuter(t,e,s,i){$.toInnerPoint(t,e,q),$.scaleOfInner(t,q,s,i)},scaleOfInner(t,e,s,i=s){$.translateInner(t,e.x,e.y),$.scale(t,s,i),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=H(e*=D),a=X(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){$.toInnerPoint(t,e,q),$.rotateOfInner(t,q,s)},rotateOfInner(t,e,s){$.translateInner(t,e.x,e.y),$.rotate(t,s),$.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=D,t.a=i+o*s,t.b=r+n*s),e&&(e*=D,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){$.toInnerPoint(t,e,q),$.skewOfInner(t,q,s,i)},skewOfInner(t,e,s,i=0){$.translateInner(t,e.x,e.y),$.skew(t,s,i),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,i,r){const{e:n,f:a}=t;if(s||(s=t),o(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:o,c:n,d:a}=t;s.a=i*e.a+o*e.c,s.b=i*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,r&&(s.scaleX=e.scaleX*r.scaleX,s.scaleY=e.scaleY*r.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,i,r){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(o(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:i,skewY:r}=e,o=s*D,n=H(o),a=X(o);if(i||r){const e=i*D,s=r*D;t.a=(n+s*-a)*h,t.b=(a+s*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(s=s||i)&&$.translateInner(t,-s.x,-s.y,!i)},getLayout(t,e,s,i){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,_,p,f=h,g=l;if(o||n){const t=r*a-o*n;if(n&&!i){d=j(r*r+o*o),c=t/d;const e=r/d;u=o>0?G(e):-G(e)}else{c=j(n*n+a*a),d=t/c;const e=n/c;u=U-(a>0?G(-e):-G(e))}const e=V(H(u)),s=X(u);d=V(d),c=V(c),_=e?V((n/c+s)/e/D,9):0,p=e?V((o/d-s)/e/D,9):0,u=V(u/D)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(f+=e.x*r+e.y*n,g+=e.x*o+e.y*a,s||(f-=e.x,g-=e.y)),{x:f,y:g,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:o,d:n}=t;r||o?s=(i*n-r*o)/(e=j(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){$.set(t)}},$=Q,{float:Z}=M,{toInnerPoint:K,toOuterPoint:tt}=Q,{sin:et,cos:st,abs:it,sqrt:rt,atan2:ot,min:nt,round:at}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=o(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,s){u(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=lt.defaultPoint);const i=st(e*=D),r=et(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=lt;return ct(s,t),K(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=lt;return ct(s,t),tt(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=lt;return ct(s,t),lt.toInnerRadiusPointOf(t,e,s),s},copyRadiusPoint:(t,e,s,i)=>(ct(t,e),ut(t,s,i),t),toInnerRadiusPointOf(t,e,s){s||(s=t),K(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){K(e,t,s)},toOuterOf(t,e,s){tt(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=it(s-t),o=it(i-e);return rt(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>nt(dt(t,e,s,i),dt(s,i,r,o)),getAngle:(t,e)=>_t(t,e)/D,getRotation:(t,e,s,i)=>(i||(i=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/D),getRadianFrom(t,e,s,i,r,n,a,h){o(a)&&(a=s,h=i);const l=t-s,d=e-i,c=r-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i,r){const o=_t(t,e);return r&&(t=e),i||(e={}),e.x=t.x+st(o)*s,e.y=t.y+et(o)*s,e},toNumberPoints(t){let e=t;return u(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,s)=>s?t.x===e.x&&t.y===e.y:Z(t.x)===Z(e.x)&&Z(t.y)===Z(e.y),reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,setRadius:ut,getAtan2:_t}=lt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return u(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,s){return ht.scaleOf(this,t,e,s),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,s){return ht.getRotation(this,t,e,s)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new pt(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,s,i){return new pt(ht.getDistancePoint(this,t,e,s,i))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}isSame(t,e){return ht.isSame(this,t,e)}reset(){return ht.reset(this),this}}const ft=new pt;class gt{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return u(t)?Q.copy(this,t):Q.set(this,t,e,s,i,r,o),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}clone(){return new gt(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,s){return Q.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return Q.scaleOfInner(this,t,e,s),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,s){return Q.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return Q.skewOfInner(this,t,e,s),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){Q.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){Q.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return Q.setLayout(this,t,e,s),this}getLayout(t,e,s){return Q.getLayout(this,t,e,s)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const yt=new gt,mt={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){xt(t,e,s),xt(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:xt}=mt;var wt,vt;t.Direction4=void 0,(wt=t.Direction4||(t.Direction4={}))[wt.top=0]="top",wt[wt.right=1]="right",wt[wt.bottom=2]="bottom",wt[wt.left=3]="left",t.Direction9=void 0,(vt=t.Direction9||(t.Direction9={}))[vt.topLeft=0]="topLeft",vt[vt.top=1]="top",vt[vt.topRight=2]="topRight",vt[vt.right=3]="right",vt[vt.bottomRight=4]="bottomRight",vt[vt.bottom=5]="bottom",vt[vt.bottomLeft=6]="bottomLeft",vt[vt.left=7]="left",vt[vt.center=8]="center",vt[vt["top-left"]=0]="top-left",vt[vt["top-right"]=2]="top-right",vt[vt["bottom-right"]=4]="bottom-right",vt[vt["bottom-left"]=6]="bottom-left";const bt=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];bt.forEach(t=>t.type="percent");const Bt={directionData:bt,tempPoint:{},get:kt,toPoint(t,e,s,i,r,o){const n=kt(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(o||(s.x-=r.x,s.y-=r.y),n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s,i=!0)=>(s||(s={}),Bt.toPoint(t,e,s,i),s)};function kt(e){return a(e)?bt[t.Direction9[e]]:e}const{toPoint:St}=Bt,Ct={toPoint(t,e,s,i,r,o){St(t,s,i,r,e,o)}},{tempPointBounds:Rt,setPoint:Tt,addPoint:Pt,toBounds:Lt}=mt,{toOuterPoint:It}=Q,{float:Et,fourNumber:Ot}=M,{floor:At,ceil:Mt}=Math;let Wt,Dt,Ft,Ut;const Nt={},zt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:o,y:n,width:a,height:h}=e;if(c(s)){const e=Ot(s);i?Ht.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ht.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Ht.set(t,o-s,n-s,a+2*s,h+2*s);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Ht.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?jt(e,t):e=t,s||(s=t),e.offsetX=Ht.maxX(s),e.offsetY=Ht.maxY(s),Ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||ht.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){ht.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Ht.copy(Yt,t),Ht.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ht.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r,e:o,f:n}=e;i>0?(s.width=t.width*i,s.x=o+t.x*i):(s.width=t.width*-i,s.x=o+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=n+t.y*r):(s.height=t.height*-r,s.y=n+t.y*r-s.height)}else Nt.x=t.x,Nt.y=t.y,It(e,Nt,zt),Tt(Rt,zt.x,zt.y),Nt.x=t.x+t.width,It(e,Nt,zt),Pt(Rt,zt.x,zt.y),Nt.y=t.y+t.height,It(e,Nt,zt),Pt(Rt,zt.x,zt.y),Nt.x=t.x,It(e,Nt,zt),Pt(Rt,zt.x,zt.y),Lt(Rt,s)},toInnerOf(t,e,s){s||(s=t),Ht.move(s,-e.e,-e.f),Ht.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Ht.getFitScale(t,e));return new gt(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,o){o||(o=e),a(i)&&(i=Ht.getFitScale(t,e,"cover"===i)),Yt.width=r?e.width*=i:e.width*i,Yt.height=r?e.height*=i:e.height*i,Ct.toPoint(s,Yt,t,o,!0,!0)},getSpread(t,e,s){const i={};return Ht.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Ht.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Ht.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=At(t.x),t.y=At(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=s>t.y?Mt(t.height+s-t.y):Mt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Et(t.x,e),t.y=Et(t.y,e),t.width=Et(t.width,e),t.height=Et(t.height,e)},add(t,e,s){Wt=t.x+t.width,Dt=t.y+t.height,Ft=e.x,Ut=e.y,s||(Ft+=e.width,Ut+=e.height),Wt=Wt>Ft?Wt:Ft,Dt=Dt>Ut?Dt:Ut,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Wt-t.x,t.height=Dt-t.y},addList(t,e){Ht.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Ht.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Ht.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||jt(t,r)):Gt(t,r));o&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Tt(Rt,t.x,t.y):Pt(Rt,t.x,t.y)),Lt(Rt,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){Gt(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},getPoint:(t,e,s=!1,i)=>Bt.getPoint(e,t,i,s),hitRadiusPoint:(t,e,s)=>(s&&(e=ht.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=ht.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Ht.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=Ht.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){if(s&&(e=Ht.tempToOuterOf(e,s)),!Ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return Wt=i+o,Dt=r+n,Ft=t.x+t.width,Ut=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,Wt=Wt<Ft?Wt:Ft,Dt=Dt<Ut?Dt:Ut,o=Wt-i,n=Dt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Ht.copy(t,Ht.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ht.set(t)}},Ht=Xt,{add:Gt,copy:jt}=Ht;class Vt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return u(t)?Xt.copy(this,t):Xt.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Vt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,s){return Xt.scale(this,t,e,s),this}scaleOf(t,e,s){return Xt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,s){Xt.put(this,t,e,s)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}getPoint(t,e,s){return Xt.getPoint(this,t,e,s)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new Vt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const qt=new Vt;class Jt{constructor(t,e,s,i,r,o){u(t)?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Vt(r,e,o||t.width-r-s,n||t.height-e-i)}}const Qt={number:(t,e)=>u(t)?"percent"===t.type?t.value*e:t.value:t},$t={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Zt,max:Kt}=Math,te={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,s,i)=>t.width*t.height*(e?e*s:1)>(i||ee.maxCacheSize),isSuperLarge:(t,e,s)=>ee.isLarge(t,e,s,ee.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=ee;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,i,r,o,n,a,h,l){const d=Kt(Zt(e+(i||0)),1),c=Kt(Zt(s+(r||0)),1);let u,_,p;l&&(p=Qt.number(l.offset,"x"===l.type?e:s))&&("x"===l.type?u=!0:_=!0);const f=te.origin.createCanvas(_?2*d:d,u?2*c:c),g=f.getContext("2d");if(a&&(g.globalAlpha=a),g.imageSmoothingEnabled=!1!==n,ee.canUse(t)){if(o){const i=e/o.width,r=s/o.height;g.setTransform(i,0,0,r,-o.x*i,-o.y*r),g.drawImage(t,0,0,t.width,t.height)}else g.drawImage(t,0,0,e,s);p&&(g.drawImage(f,0,0,d,c,u?p-d:d,u?c:p-c,d,c),g.drawImage(f,0,0,d,c,u?p:d,u?c:p,d,c))}return f},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&p.stintSet(s,"transform",e)}}},{image:ee}=te,{randColor:se}=M;class ie{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ie(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const s=se();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===ie.showBounds,r=t.__nowWorld,o=se();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),i?e.stroke():e.strokeWorld(r,o)}log(...t){if(oe.enable){if(oe.filterList.length&&oe.filterList.every(t=>t!==this.name))return;if(oe.excludeList.length&&oe.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){oe.enable&&this.warn(...t)}warn(...t){oe.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function re(t){return t?a(t)&&(t=[t]):t=[],t}ie.filterList=[],ie.excludeList=[],ie.showWarn=!0;const oe=ie,ne=ie.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=y.create(y.RUNTIME);return he.currentId=he.idMap[s]=e?performance.now():Date.now(),he.currentName=he.nameMap[s]=t,he.nameToIdMap[t]=s,s},end(t,e){const s=he.idMap[t],i=he.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;he.idMap[t]=he.nameMap[t]=he.nameToIdMap[i]=void 0,ne.log(i,r,"ms")},endOfName(t,e){const s=he.nameToIdMap[t];o(s)||he.end(s,e)}},he=ae,le=[],de={list:{},add(t,...e){this.list[t]=!0,le.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>le.forEach(t=>de.has(t,!0)));const ce={editor:t=>de.need("editor")},ue=ie.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;pe[e]&&ue.repeat(e),pe[e]=t},get(t,e,s,i,r,n){if(!pe[t])return void ue.warn("not register "+t);const a=new pe[t](e);return o(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),n&&(a.height=n)),a}},{list:pe}=_e,fe=ie.get("EventCreator"),ge={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(ye[e]&&fe.repeat(e),ye[e]=t)})},changeName(t,e){const s=ye[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,ye[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=ge;class me{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=ce.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function xe(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}const we=[];function ve(){return(t,e)=>{we.push(e)}}const be=[];class Be{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||be)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;we.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){u(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}i([xe("imageSmoothingEnabled")],Be.prototype,"smooth",void 0),i([xe("imageSmoothingQuality")],Be.prototype,"smoothLevel",void 0),i([xe("globalAlpha")],Be.prototype,"opacity",void 0),i([xe()],Be.prototype,"fillStyle",void 0),i([xe()],Be.prototype,"strokeStyle",void 0),i([xe("lineWidth")],Be.prototype,"strokeWidth",void 0),i([xe("lineCap")],Be.prototype,"strokeCap",void 0),i([xe("lineJoin")],Be.prototype,"strokeJoin",void 0),i([xe("lineDashOffset")],Be.prototype,"dashOffset",void 0),i([xe()],Be.prototype,"miterLimit",void 0),i([xe()],Be.prototype,"shadowBlur",void 0),i([xe()],Be.prototype,"shadowColor",void 0),i([xe()],Be.prototype,"shadowOffsetX",void 0),i([xe()],Be.prototype,"shadowOffsetY",void 0),i([xe()],Be.prototype,"filter",void 0),i([xe()],Be.prototype,"font",void 0),i([xe()],Be.prototype,"fontKerning",void 0),i([xe()],Be.prototype,"fontStretch",void 0),i([xe()],Be.prototype,"fontVariantCaps",void 0),i([xe()],Be.prototype,"textAlign",void 0),i([xe()],Be.prototype,"textBaseline",void 0),i([xe()],Be.prototype,"textRendering",void 0),i([xe()],Be.prototype,"wordSpacing",void 0),i([xe()],Be.prototype,"letterSpacing",void 0),i([xe()],Be.prototype,"direction",void 0),i([ve()],Be.prototype,"setTransform",null),i([ve()],Be.prototype,"resetTransform",null),i([ve()],Be.prototype,"getTransform",null),i([ve()],Be.prototype,"save",null),i([ve()],Be.prototype,"restore",null),i([ve()],Be.prototype,"translate",null),i([ve()],Be.prototype,"scale",null),i([ve()],Be.prototype,"rotate",null),i([ve()],Be.prototype,"fill",null),i([ve()],Be.prototype,"stroke",null),i([ve()],Be.prototype,"clip",null),i([ve()],Be.prototype,"fillRect",null),i([ve()],Be.prototype,"strokeRect",null),i([ve()],Be.prototype,"clearRect",null),i([ve()],Be.prototype,"beginPath",null),i([ve()],Be.prototype,"moveTo",null),i([ve()],Be.prototype,"lineTo",null),i([ve()],Be.prototype,"bezierCurveTo",null),i([ve()],Be.prototype,"quadraticCurveTo",null),i([ve()],Be.prototype,"closePath",null),i([ve()],Be.prototype,"arc",null),i([ve()],Be.prototype,"arcTo",null),i([ve()],Be.prototype,"ellipse",null),i([ve()],Be.prototype,"rect",null),i([ve()],Be.prototype,"roundRect",null),i([ve()],Be.prototype,"createConicGradient",null),i([ve()],Be.prototype,"createLinearGradient",null),i([ve()],Be.prototype,"createPattern",null),i([ve()],Be.prototype,"createRadialGradient",null),i([ve()],Be.prototype,"fillText",null),i([ve()],Be.prototype,"measureText",null),i([ve()],Be.prototype,"strokeText",null);const{copy:ke,multiplyParent:Se,pixelScale:Ce}=Q,{round:Re}=Math,Te=new Vt,Pe=new Vt,Le={width:1,height:1,pixelRatio:1},Ie=["width","height","pixelRatio"];class Ee extends Be{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Le),this.manager=e,this.innerId=y.create(y.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,this.size.pixelRatio=r||te.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;p.copyAttrs(i,t,Ie),Ie.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Vt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&Se(t,e,r),Ce(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=Re(r.e-.5)+.5,r.f=Re(r.f-.5)+.5):(r.e=Re(r.e),r.f=Re(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:i,dashPattern:r,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),o(e.dashPattern)||(r=e.dashPattern),o(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=i,this.dashPattern=r,this.dashOffset=n,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=Pe):s=Te,this.drawImage(t.view,Te.x,Te.y,Te.width,Te.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,Te.x,Te.y,Te.width,Te.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o){this.resetTransform(),this.copyWorld(t,e,s,i,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(Te.x,Te.y,Te.width,Te.height),{data:o}=r;for(let t=0,i=o.length;t<i;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));i.putImageData(r,Te.x,Te.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(Te.x,Te.y,Te.width,Te.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(Te.x,Te.y,Te.width,Te.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Te.x,Te.y,Te.width,Te.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Te.x,Te.y,Te.width,Te.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(Te,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(Pe,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):ce.canvas(Object.assign({},s));return r.save(),t&&(ke(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ae={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Me=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Ae),We={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},De={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Fe=Object.assign(Object.assign({},De),Ae),Ue=Me,Ne={};for(let t in Ue)Ne[Ue[t]]=t;const ze={};for(let t in Ue)ze[Ue[t]]=We[t];const Ye={drawRoundRect(t,e,s,i,r,o){const n=M.fourNumber(o,Math.min(i/2,r/2)),a=e+i,h=s+r;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(a,s,a,h,n[1]):t.lineTo(a,s),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,s,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,s,a,s,n[0]):t.lineTo(e,s)}},{sin:Xe,cos:He,hypot:Ge,atan2:je,ceil:Ve,abs:qe,PI:Je,sqrt:Qe,pow:$e}=Math,{setPoint:Ze,addPoint:Ke}=mt,{set:ts,toNumberPoints:es}=ht,{M:ss,L:is,C:rs,Q:os,Z:ns}=Me,as={},hs={points(t,e,s,i){let r=es(e);if(t.push(ss,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,f,g,y,m,x=r.length;const w=!0===s?.5:s;i&&(r=[r[x-2],r[x-1],...r,r[0],r[1],r[2],r[3]],x=r.length);for(let s=2;s<x-2;s+=2)e=r[s-2],o=r[s-1],n=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=n-e,f=a-o,g=Qe($e(p,2)+$e(f,2)),y=Qe($e(h-n,2)+$e(l-a,2)),(g||y)&&(m=g+y,g=w*g/m,y=w*y/m,h-=e,l-=o,d=n-g*h,c=a-g*l,2===s?i||t.push(os,d,c,n,a):(p||f)&&t.push(rs,u,_,d,c,n,a),u=n+y*h,_=a+y*l);i||t.push(os,u,_,r[x-2],r[x-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(is,r[e],r[e+1]);i&&t.push(ns)},rect(t,e,s,i,r){Oe.creator.path=t,Oe.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){Oe.creator.path=[],Ye.drawRoundRect(Oe.creator,e,s,i,r,o),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let f=je(u,c),g=je(p,_);const y=Ge(c,u),m=Ge(_,p);let x=g-f;if(x<0&&(x+=F),y<1e-12||m<1e-12||x<1e-12||qe(x-Je)<1e-12)return t&&t.push(is,i,r),h&&(Ze(h,e,s),Ke(h,i,r)),d&&ts(d,e,s),void(l&&ts(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/He(x/2),B=i+b*He(f+x/2+U*v),k=r+b*Xe(f+x/2+U*v);return f-=U*v,g-=U*v,cs(t,B,k,a,a,0,f/D,g/D,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>cs(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*D,_=Xe(u),p=He(u);let f=n*D,g=a*D;f>Je&&(f-=F),g<0&&(g+=F);let y=g-f;y<0?y+=F:y>F&&(y-=F),h&&(y-=F);const m=Ve(qe(y/U)),x=y/m,w=Xe(x/4),v=8/3*w*w/Xe(x/2);g=f+x;let b,B,k,S,C,R,T,P,L=He(f),I=Xe(f),E=k=p*i*L-_*r*I,O=S=_*i*L+p*r*I,A=e+k,M=s+S;t&&t.push(t.length?is:ss,A,M),l&&Ze(l,A,M),c&&ts(c,A,M);for(let o=0;o<m;o++)b=He(g),B=Xe(g),k=p*i*b-_*r*B,S=_*i*b+p*r*B,C=e+E-v*(p*i*I+_*r*L),R=s+O-v*(_*i*I-p*r*L),T=e+k+v*(p*i*B+_*r*b),P=s+S+v*(_*i*B-p*r*b),t&&t.push(rs,C,R,T,P,e+k,s+S),l&&ds(e+E,s+O,C,R,T,P,e+k,s+S,l,!0),E=k,O=S,L=b,I=B,f=g,g+=x;d&&ts(d,e+k,s+S)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(rs,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){ds(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,f,g,y,m,x=t,w=s,v=r,b=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=o,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(f=(-u+m)/(2*c),0<f&&f<1&&d.push(f),g=(-u-m)/(2*c),0<g&&g<1&&d.push(g));l?Ke(h,t,e):Ze(h,t,e),Ke(h,n,a);for(let l=0,c=d.length;l<c;l++)ls(d[l],t,e,s,i,r,o,n,a,as),Ke(h,as.x,as.y)},getPointAndSet(t,e,s,i,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return ls(t,e,s,i,r,o,n,a,h,l),l},getDerivative(t,e,s,i,r){const o=1-t;return 3*o*o*(s-e)+6*o*t*(i-s)+3*t*t*(r-i)},cut(t,e,s,i,r,o,n,a,h){if(t<=0)return{left:null,right:[i,r,o,n,a,h]};if(t>=1)return{left:[i,r,o,n,a,h],right:null};const l=1-t,d=e*l+i*t,c=s*l+r*t,u=i*l+o*t,_=r*l+n*t,p=o*l+a*t,f=n*l+h*t,g=d*l+u*t,y=c*l+_*t,m=u*l+p*t,x=_*l+f*t;return{left:[d,c,g,y,g*l+m*t,y*l+x*t],right:[m,x,p,f,a,h]}}},{getPointAndSet:ls,toTwoPointBounds:ds,ellipse:cs}=hs,{sin:us,cos:_s,sqrt:ps,atan2:fs}=Math,{ellipse:gs}=hs,ys={ellipticalArc(t,e,s,i,r,o,n,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=o*D,p=us(_),f=_s(_),g=-f*c-p*u,y=-f*u+p*c,m=i*i,x=r*r,w=y*y,v=g*g,b=m*x-m*w-x*v;let B=0;if(b<0){const t=ps(1-b/(m*x));i*=t,r*=t}else B=(n===a?-1:1)*ps(b/(m*w+x*v));const k=B*i*y/r,S=-B*r*g/i,C=fs((y-S)/r,(g-k)/i),R=fs((-y-S)/r,(-g-k)/i);let T=R-C;0===a&&T>0?T-=F:1===a&&T<0&&(T+=F);const P=e+c+f*k-p*S,L=s+u+p*k+f*S,I=T<0?1:0;d||te.ellipseToCurve?gs(t,P,L,i,r,o,C/D,R/D,I):i!==r||o?t.push(Me.G,P,L,i,r,o,C/D,R/D,I):t.push(Me.O,P,L,i,C/D,R/D,I)}},ms={toCommand:t=>[],toNode:t=>[]},{M:xs,m:ws,L:vs,l:bs,H:Bs,h:ks,V:Ss,v:Cs,C:Rs,c:Ts,S:Ps,s:Ls,Q:Is,q:Es,T:Os,t:As,A:Ms,a:Ws,Z:Ds,z:Fs,N:Us,D:Ns,X:zs,G:Ys,F:Xs,O:Hs,P:Gs,U:js}=Me,{rect:Vs,roundRect:qs,arcTo:Js,arc:Qs,ellipse:$s,quadraticCurveTo:Zs}=hs,{ellipticalArc:Ks}=ys,ti=ie.get("PathConvert"),ei={},si={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=ze[i],a+=i===r?" ":Ne[i];for(let i=1;i<s;i++)a+=M.float(t[o+i],e),i===s-1||(a+=" ");r=i,o+=s}return a},parse(t,e){let s,i,r,o="";const n=[],a=e?Fe:De;for(let e=0,h=t.length;e<h;e++)i=t[e],$t[i]?("."===i&&(ii.dot&&(ri(n,o),o=""),ii.dot++),"0"===o&&"."!==i&&(ri(n,o),o=""),o+=i):Me[i]?(o&&(ri(n,o),o=""),ii.name=Me[i],ii.length=We[i],ii.index=0,ri(n,ii.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&ri(n,o),o=i):o&&(ri(n,o),o=""),r=i;return o&&ri(n,o),s?si.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=t.length;const f=[];for(;_<p;){switch(r=t[_],r){case ws:t[_+1]+=a,t[_+2]+=h;case xs:a=t[_+1],h=t[_+2],o===r?f.push(vs,a,h):(f.push(xs,a,h),c=a,u=h),_+=3;break;case ks:t[_+1]+=a;case Bs:a=t[_+1],f.push(vs,a,h),_+=2;break;case Cs:t[_+1]+=h;case Ss:h=t[_+1],f.push(vs,a,h),_+=2;break;case bs:t[_+1]+=a,t[_+2]+=h;case vs:a=t[_+1],h=t[_+2],f.push(vs,a,h),_+=3;break;case Ls:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,r=Ps;case Ps:n=o===Rs||o===Ps,l=n?2*a-s:t[_+1],d=n?2*h-i:t[_+2],s=t[_+1],i=t[_+2],a=t[_+3],h=t[_+4],f.push(Rs,l,d,s,i,a,h),_+=5;break;case Ts:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,t[_+5]+=a,t[_+6]+=h,r=Rs;case Rs:s=t[_+3],i=t[_+4],a=t[_+5],h=t[_+6],f.push(Rs,t[_+1],t[_+2],s,i,a,h),_+=7;break;case As:t[_+1]+=a,t[_+2]+=h,r=Os;case Os:n=o===Is||o===Os,s=n?2*a-s:t[_+1],i=n?2*h-i:t[_+2],e?Zs(f,a,h,s,i,t[_+1],t[_+2]):f.push(Is,s,i,t[_+1],t[_+2]),a=t[_+1],h=t[_+2],_+=3;break;case Es:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,r=Is;case Is:s=t[_+1],i=t[_+2],e?Zs(f,a,h,s,i,t[_+3],t[_+4]):f.push(Is,s,i,t[_+3],t[_+4]),a=t[_+3],h=t[_+4],_+=5;break;case Ws:t[_+6]+=a,t[_+7]+=h;case Ms:Ks(f,a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],e),a=t[_+6],h=t[_+7],_+=8;break;case Fs:case Ds:f.push(Ds),a=c,h=u,_++;break;case Us:a=t[_+1],h=t[_+2],e?Vs(f,a,h,t[_+3],t[_+4]):oi(f,t,_,5),_+=5;break;case Ns:a=t[_+1],h=t[_+2],e?qs(f,a,h,t[_+3],t[_+4],[t[_+5],t[_+6],t[_+7],t[_+8]]):oi(f,t,_,9),_+=9;break;case zs:a=t[_+1],h=t[_+2],e?qs(f,a,h,t[_+3],t[_+4],t[_+5]):oi(f,t,_,6),_+=6;break;case Ys:$s(e?f:oi(f,t,_,9),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],t[_+8],null,ei),a=ei.x,h=ei.y,_+=9;break;case Xs:e?$s(f,t[_+1],t[_+2],t[_+3],t[_+4],0,0,360,!1):oi(f,t,_,5),a=t[_+1]+t[_+3],h=t[_+2],_+=5;break;case Hs:Qs(e?f:oi(f,t,_,7),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],null,ei),a=ei.x,h=ei.y,_+=7;break;case Gs:e?Qs(f,t[_+1],t[_+2],t[_+3],0,360,!1):oi(f,t,_,4),a=t[_+1]+t[_+3],h=t[_+2],_+=4;break;case js:Js(e?f:oi(f,t,_,6),a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],null,ei),a=ei.x,h=ei.y,_+=6;break;default:return ti.error(`command: ${r} [index:${_}]`,t),f}o=r}return f},objectToCanvasData(t){if(t[0].name.length>1)return ms.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(xs,t.x,t.y);break;case"L":e.push(vs,t.x,t.y);break;case"C":e.push(Rs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Is,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ds)}}),e}},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){ii.index===ii.length&&(ii.index=1,t.push(ii.name)),t.push(Number(e)),ii.index++,ii.dot=0}},{current:ii,pushData:ri,copyData:oi}=si,{M:ni,L:ai,C:hi,Q:li,Z:di,N:ci,D:ui,X:_i,G:pi,F:fi,O:gi,P:yi,U:mi}=Me,{getMinDistanceFrom:xi,getRadianFrom:wi}=ht,{tan:vi,min:bi,abs:Bi}=Math,ki={},Si={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ni,e,s)},lineTo(t,e,s){t.push(ai,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(hi,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(li,e,s,i,r)},closePath(t){t.push(di)},rect(t,e,s,i,r){t.push(ci,e,s,i,r)},roundRect(t,e,s,i,r,o){if(l(o))t.push(_i,e,s,i,r,o);else{const n=M.fourNumber(o);n?t.push(ui,e,s,i,r,...n):t.push(ci,e,s,i,r)}},ellipse(t,e,s,i,r,o,a,h,l){if(i===r)return Ri(t,e,s,i,a,h,l);n(o)?t.push(fi,e,s,i,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(pi,e,s,i,r,o,a,h,l?1:0))},arc(t,e,s,i,r,o,a){n(r)?t.push(yi,e,s,i):(n(r)&&(r=0),n(o)&&(o=360),t.push(gi,e,s,i,r,o,a?1:0))},arcTo(t,e,s,i,r,n,a,h,l){if(!o(a)){const t=xi(a,h,e,s,i,r)/(l?1:2);n=bi(n,bi(t,t*Bi(vi(wi(a,h,e,s,i,r)/2))))}t.push(mi,e,s,i,r,n)},drawEllipse(t,e,s,i,r,o,a,h,l){hs.ellipse(null,e,s,i,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,ki),t.push(ni,ki.x,ki.y),Ci(t,e,s,i,r,o,a,h,l)},drawArc(t,e,s,i,r,o,a){hs.arc(null,e,s,i,n(r)?0:r,n(o)?360:o,a,null,null,ki),t.push(ni,ki.x,ki.y),Ri(t,e,s,i,r,o,a)},drawPoints(t,e,s,i){hs.points(t,e,s,i)}},{ellipse:Ci,arc:Ri}=Si,{moveTo:Ti,lineTo:Pi,quadraticCurveTo:Li,bezierCurveTo:Ii,closePath:Ei,beginPath:Oi,rect:Ai,roundRect:Mi,ellipse:Wi,arc:Di,arcTo:Fi,drawEllipse:Ui,drawArc:Ni,drawPoints:zi}=Si;class Yi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Oe.parse(t):t:[],this}beginPath(){return Oi(this.__path),this.paint(),this}moveTo(t,e){return Ti(this.__path,t,e),this.paint(),this}lineTo(t,e){return Pi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return Ii(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return Li(this.__path,t,e,s,i),this.paint(),this}closePath(){return Ei(this.__path),this.paint(),this}rect(t,e,s,i){return Ai(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Mi(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return Wi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return Di(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return Fi(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return Ui(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return Ni(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return zi(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Xi,L:Hi,C:Gi,Q:ji,Z:Vi,N:qi,D:Ji,X:Qi,G:$i,F:Zi,O:Ki,P:tr,U:er}=Me,sr=ie.get("PathDrawer"),ir={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Xi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Hi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Gi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case ji:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Vi:t.closePath(),i+=1;break;case qi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ji:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Qi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case $i:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*D,e[i+6]*D,e[i+7]*D,e[i+8]),i+=9;break;case Zi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,F,!1),i+=5;break;case Ki:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*D,e[i+5]*D,e[i+6]),i+=7;break;case tr:t.arc(e[i+1],e[i+2],e[i+3],0,F,!1),i+=4;break;case er:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void sr.error(`command: ${s} [index:${i}]`,e)}}},{M:rr,L:or,C:nr,Q:ar,Z:hr,N:lr,D:dr,X:cr,G:ur,F:_r,O:pr,P:fr,U:gr}=Me,{toTwoPointBounds:yr,toTwoPointBoundsByQuadraticCurve:mr,arcTo:xr,arc:wr,ellipse:vr}=hs,{addPointBounds:br,copy:Br,addPoint:kr,setPoint:Sr,addBounds:Cr,toBounds:Rr}=mt,Tr=ie.get("PathBounds");let Pr,Lr,Ir;const Er={},Or={},Ar={},Mr={toBounds(t,e){Mr.toTwoPointBounds(t,Or),Rr(Or,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Sr(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===hr||n===nr||n===ar?Sr(e,h,l):Sr(e,t[a+1],t[a+2])),n){case rr:case or:h=t[a+1],l=t[a+2],kr(e,h,l),a+=3;break;case nr:r=t[a+5],o=t[a+6],yr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,Er),br(e,Er),h=r,l=o,a+=7;break;case ar:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],mr(h,l,s,i,r,o,Er),br(e,Er),h=r,l=o,a+=5;break;case hr:a+=1;break;case lr:h=t[a+1],l=t[a+2],Cr(e,h,l,t[a+3],t[a+4]),a+=5;break;case dr:case cr:h=t[a+1],l=t[a+2],Cr(e,h,l,t[a+3],t[a+4]),a+=n===dr?9:6;break;case ur:vr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Er,Ar),0===a?Br(e,Er):br(e,Er),h=Ar.x,l=Ar.y,a+=9;break;case _r:h=t[a+1],l=t[a+2],Lr=t[a+3],Ir=t[a+4],Cr(e,h-Lr,l-Ir,2*Lr,2*Ir),h+=Lr,a+=5;break;case pr:wr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Er,Ar),0===a?Br(e,Er):br(e,Er),h=Ar.x,l=Ar.y,a+=7;break;case fr:h=t[a+1],l=t[a+2],Pr=t[a+3],Cr(e,h-Pr,l-Pr,2*Pr,2*Pr),h+=Pr,a+=4;break;case gr:xr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Er,Ar),0===a?Br(e,Er):br(e,Er),h=Ar.x,l=Ar.y,a+=6;break;default:return void Tr.error(`command: ${n} [index:${a}]`,t)}}},{M:Wr,L:Dr,Z:Fr}=Me,{getCenterX:Ur,getCenterY:Nr}=ht,{arcTo:zr}=Si,Yr={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,u=0,_=0,p=0,f=0;c(e)&&(e=e[0]||0);const g=t.length,y=9===g,m=[];for(;n<g;){switch(i=t[n],i){case Wr:l=p=t[n+1],d=f=t[n+2],n+=3,t[n]===Dr?(u=t[n+1],_=t[n+2],y?m.push(Wr,l,d):m.push(Wr,Ur(l,u),Nr(d,_))):m.push(Wr,l,d);break;case Dr:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case Dr:zr(m,a,h,t[n+1],t[n+2],e,p,f,y);break;case Fr:zr(m,a,h,l,d,e,p,f,y);break;default:m.push(Dr,a,h)}p=a,f=h;break;case Fr:r!==Fr&&(zr(m,l,d,u,_,e,p,