UNPKG

@leafer/core

Version:
1 lines 96.1 kB
const t={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",getRealURL(e){const{prefix:s,suffix:r}=t.image;return!r||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+r),s&&"/"===e[0]&&(e=s+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=e,{round:r,pow:i,PI:n}=Math,o={within:(t,e,s)=>("object"==typeof e&&(s=e.max,e=e.min),void 0!==e&&t<e&&(t=e),void 0!==s&&t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=void 0===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]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),o.float(t)),getGapRotation(t,e,s=0){let r=t+s;if(e>1){const t=Math.abs(r%e);(t<1||t>e-1)&&(r=Math.round(r/e)*e)}return r-s},float(t,e){const s=void 0!==e?i(10,e):1e12;return-0===(t=r(t*s)/s)?0:t},getScaleData(t,e,s,r){if(r||(r={}),e){const t=("number"==typeof e?e:e.width||0)/s.width,i=("number"==typeof e?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&o.assignScale(r,t);return r},assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:a,randColor:t=>`rgba(${a(255)},${a(255)},${a(255)},${t||1})`};function a(t){return Math.round(Math.random()*t)}const h=n/180,l=2*n,d=n/2;function u(){return{x:0,y:0}}function c(){return{x:0,y:0,width:0,height:0}}function _(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:p,cos:f,acos:g,sqrt:y}=Math,{float:m}=o,x={};function w(){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 b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:w(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,n=0,o=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=n,t.f=o},get:_,getWorld:w,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,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){v.toInnerPoint(t,e,x),v.scaleOfInner(t,x,s,r)},scaleOfInner(t,e,s,r=s){v.translateInner(t,e.x,e.y),v.scale(t,s,r),v.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=f(e*=h),a=p(e);t.a=s*o-r*a,t.b=s*a+r*o,t.c=i*o-n*a,t.d=i*a+n*o},rotateOfOuter(t,e,s){v.toInnerPoint(t,e,x),v.rotateOfInner(t,x,s)},rotateOfInner(t,e,s){v.translateInner(t,e.x,e.y),v.rotate(t,s),v.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:o}=t;s&&(s*=h,t.a=r+n*s,t.b=i+o*s),e&&(e*=h,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){v.toInnerPoint(t,e,x),v.skewOfInner(t,x,s,r)},skewOfInner(t,e,s,r=0){v.translateInner(t,e.x,e.y),v.skew(t,s,r),v.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*n,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*n,t.e=e.e*s+e.f*i+o,t.f=e.e*r+e.f*n+a},multiplyParent(t,e,s,r,i,n){let{e:o,f:a}=t;if(n&&(o+=n.scrollX,a+=n.scrollY),s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:n,c:o,d:a}=t;s.a=r*e.a+n*e.c,s.b=r*e.b+n*e.d,s.c=o*e.a+a*e.c,s.d=o*e.b+a*e.d,i&&(s.scaleX=e.scaleX*i.scaleX,s.scaleY=e.scaleY*i.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=o*e.a+a*e.c+e.e,s.f=o*e.b+a*e.d+e.f},divide(t,e){v.multiply(t,v.tempInvert(e))},divideParent(t,e){v.multiplyParent(t,v.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=v;return v.copy(e,t),v.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:n,f:o}=t;if(s||r){const a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(n*i-o*r)*a,t.f=-(o*e-n*s)*a}else if(1===e&&1===i)t.e=-n,t.f=-o;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-n*i*s,t.f=-o*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:n}=e;s||(s=e),s.x=i*t.a+n*t.c,s.y=i*t.b+n*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:n,c:o,d:a}=t,h=1/(i*a-n*o),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*o)*h,s.y=(d*i-l*n)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*o)*h,s.y-=(r*i-e*n)*h}},setLayout(t,e,s,r,i){const{x:n,y:o,scaleX:a,scaleY:l}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,n=s*h,o=f(n),d=p(n);if(r||i){const e=r*h,s=i*h;t.a=(o+s*-d)*a,t.b=(d+s*o)*a,t.c=(e*o-d)*l,t.d=(o+e*d)*l}else t.a=o*a,t.b=d*a,t.c=-d*l,t.d=o*l}else t.a=a,t.b=0,t.c=0,t.d=l;t.e=n,t.f=o,(s=s||r)&&v.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:n,c:o,d:a,e:l,f:u}=t;let c,_,x,w,b,v=l,B=u;if(n||o){const t=i*a-n*o;if(o&&!r){c=y(i*i+n*n),_=t/c;const e=i/c;x=n>0?g(e):-g(e)}else{_=y(o*o+a*a),c=t/_;const e=o/_;x=d-(a>0?g(-e):-g(e))}const e=m(f(x)),s=p(x);c=m(c),_=m(_),w=e?m((o/_+s)/e/h,9):0,b=e?m((n/c-s)/e/h,9):0,x=m(x/h)}else c=i,_=a,x=w=b=0;return(e=s||e)&&(v+=e.x*i+e.y*o,B+=e.x*n+e.y*a,s||(v-=e.x,B-=e.y)),{x:v,y:B,scaleX:c,scaleY:_,rotation:x,skewX:w,skewY:b}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:n,d:o}=t;i||n?s=(r*o-i*n)/(e=y(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){v.set(t)}},v=b,{toInnerPoint:B,toOuterPoint:k}=b,{sin:C,cos:O,abs:T,sqrt:P,atan2:S,min:R,round:L}=Math,E={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=void 0===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?L(t.x-.5)+.5:L(t.x),t.y=e?L(t.y-.5)+.5:L(t.y)},move(t,e,s){"object"==typeof 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,r=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1)},rotate(t,e,s){s||(s=I.defaultPoint);const r=O(e*=h),i=C(e),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*r-o*i,t.y=s.y+n*i+o*r},tempToInnerOf(t,e){const{tempPoint:s}=I;return A(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=I;return A(s,t),k(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=I;return A(s,t),I.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),B(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){B(e,t,s)},toOuterOf(t,e,s){k(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)=>M(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=T(s-t),n=T(r-e);return P(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>R(M(t,e,s,r),M(s,r,i,n)),getAngle:(t,e)=>W(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),I.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/h),getRadianFrom(t,e,s,r,i,n,o,a){void 0===o&&(o=s,a=r);const h=t-s,l=e-r,d=i-o,u=n-a;return Math.atan2(h*u-l*d,h*d+l*u)},getAtan2:(t,e)=>S(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=W(t,e);return(e=r?e:{}).x=t.x+O(i)*s,e.y=t.y+C(i)*s,e},toNumberPoints(t){let e=t;return"object"==typeof t[0]&&(e=[],t.forEach((t=>e.push(t.x,t.y)))),e},reset(t){I.reset(t)}},I=E,{getDistanceFrom:M,copy:A,getAtan2:W}=I;class N{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?E.copy(this,t):E.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new N(this)}move(t,e){return E.move(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleOf(t,e,s){return E.scaleOf(this,t,e,s),this}rotate(t,e){return E.rotate(this,t,e),this}rotateOf(t,e){return E.rotate(this,e,t),this}getRotation(t,e,s){return E.getRotation(this,t,e,s)}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return new N(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new N(E.getDistancePoint(this,t,e,s))}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){return E.reset(this),this}}const D=new N;class Y{constructor(t,e,s,r,i,n){this.set(t,e,s,r,i,n)}set(t,e,s,r,i,n){return"object"==typeof t?b.copy(this,t):b.set(this,t,e,s,r,i,n),this}setWith(t){return b.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:r,e:i,f:n}=this;return{a:t,b:e,c:s,d:r,e:i,f:n}}clone(){return new Y(this)}translate(t,e){return b.translate(this,t,e),this}translateInner(t,e){return b.translateInner(this,t,e),this}scale(t,e){return b.scale(this,t,e),this}scaleWith(t,e){return b.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return b.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return b.scaleOfInner(this,t,e,s),this}rotate(t){return b.rotate(this,t),this}rotateOfOuter(t,e){return b.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return b.rotateOfInner(this,t,e),this}skew(t,e){return b.skew(this,t,e),this}skewOfOuter(t,e,s){return b.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return b.skewOfInner(this,t,e,s),this}multiply(t){return b.multiply(this,t),this}multiplyParent(t){return b.multiplyParent(this,t),this}divide(t){return b.divide(this,t),this}divideParent(t){return b.divideParent(this,t),this}invert(){return b.invert(this),this}invertWith(){return b.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){b.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){b.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return b.setLayout(this,t,e,s),this}getLayout(t,e,s){return b.getLayout(this,t,e,s)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const X=new Y,z={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,r,i){F(t,e,s),F(t,e+r,s+i)},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:F}=z;var j,U;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(j||(j={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(U||(U={}));const H=[{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}];H.forEach((t=>t.type="percent"));const G={directionData:H,tempPoint:{},get:V,toPoint(t,e,s,r,i,n){const o=V(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(n||(s.x-=i.x,s.y-=i.y),o.x&&(s.x-=1===o.x?i.width:.5===o.x?o.x*i.width:0),o.y&&(s.y-=1===o.y?i.height:.5===o.y?o.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function V(t){return"string"==typeof t?H[U[t]]:t}const{toPoint:q}=G,Q={toPoint(t,e,s,r,i,n){q(t,s,r,i,e,n)}},{tempPointBounds:Z,setPoint:J,addPoint:$,toBounds:K}=z,{toOuterPoint:tt}=b,{float:et,fourNumber:st}=o,{floor:rt,ceil:it}=Math;let nt,ot,at,ht;const lt={},dt={},ut={},ct={tempBounds:ut,set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,r,i){const{x:n,y:o,width:a,height:h}=e;if(s instanceof Array){const e=st(s);r?_t.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):_t.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),_t.set(t,n-s,o-s,a+2*s,h+2*s);i&&("width"===i?(t.y=o,t.height=h):(t.x=n,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},getByMove:(t,e,s)=>(t=Object.assign({},t),_t.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?ft(e,t):e=t,s?(e.offsetX=-(_t.maxX(s)-t.x),e.offsetY=-(_t.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),_t.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,r){r||E.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){E.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(_t.copy(ut,t),_t.toOuterOf(ut,e),ut),getOuterOf:(t,e)=>(t=Object.assign({},t),_t.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else lt.x=t.x,lt.y=t.y,tt(e,lt,dt),J(Z,dt.x,dt.y),lt.x=t.x+t.width,tt(e,lt,dt),$(Z,dt.x,dt.y),lt.y=t.y+t.height,tt(e,lt,dt),$(Z,dt.x,dt.y),lt.x=t.x,tt(e,lt,dt),$(Z,dt.x,dt.y),K(Z,s)},toInnerOf(t,e,s){s||(s=t),_t.move(s,-e.e,-e.f),_t.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,_t.getFitScale(t,e));return new Y(r,0,0,r,-e.x*r,-e.y*r)},getFitScale(t,e,s){const r=t.width/e.width,i=t.height/e.height;return s?Math.max(r,i):Math.min(r,i)},put(t,e,s="center",r=1,i=!0,n){n||(n=e),"string"==typeof r&&(r=_t.getFitScale(t,e,"cover"===r)),ut.width=i?e.width*=r:e.width*r,ut.height=i?e.height*=r:e.height*r,Q.toPoint(s,ut,t,n,!0,!0)},getSpread(t,e,s){const r={};return _t.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){_t.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){_t.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=rt(t.x),t.y=rt(t.y),t.width=e>t.x?it(t.width+e-t.x):it(t.width),t.height=s>t.y?it(t.height+s-t.y):it(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){nt=t.x+t.width,ot=t.y+t.height,at=e.x,ht=e.y,s||(at+=e.width,ht+=e.height),nt=nt>at?nt:at,ot=ot>ht?ot:ht,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=nt-t.x,t.height=ot-t.y},addList(t,e){_t.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){_t.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){_t.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,n=!0;for(let o=0,a=e.length;o<a;o++)i=s?s(e[o]):e[o],i&&(i.width||i.height)&&(n?(n=!1,r||ft(t,i)):pt(t,i));n&&_t.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?J(Z,t.x,t.y):$(Z,t.x,t.y))),K(Z,t)},setPoint(t,e){_t.set(t,e.x,e.y)},addPoint(t,e){pt(t,e,!0)},getPoints(t){const{x:e,y:s,width:r,height:i}=t;return[{x:e,y:s},{x:e+r,y:s},{x:e+r,y:s+i},{x:e,y:s+i}]},hitRadiusPoint:(t,e,s)=>(s&&(e=E.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=E.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=_t.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=_t.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=_t.tempToOuterOf(e,s)),!_t.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return nt=r+n,ot=i+o,at=t.x+t.width,ht=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,nt=nt<at?nt:at,ot=ot<ht?ot:ht,n=nt-r,o=ot-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){_t.copy(t,_t.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,reset(t){_t.set(t)}},_t=ct,{add:pt,copy:ft}=_t;class gt{get minX(){return ct.minX(this)}get minY(){return ct.minY(this)}get maxX(){return ct.maxX(this)}get maxY(){return ct.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?ct.copy(this,t):ct.set(this,t,e,s,r),this}get(){const{x:t,y:e,width:s,height:r}=this;return{x:t,y:e,width:s,height:r}}clone(){return new gt(this)}move(t,e){return ct.move(this,t,e),this}scale(t,e,s){return ct.scale(this,t,e,s),this}scaleOf(t,e,s){return ct.scaleOf(this,t,e,s),this}toOuterOf(t,e){return ct.toOuterOf(this,t,e),this}toInnerOf(t,e){return ct.toInnerOf(this,t,e),this}getFitMatrix(t,e){return ct.getFitMatrix(this,t,e)}put(t,e,s){ct.put(this,t,e,s)}spread(t,e){return ct.spread(this,t,e),this}shrink(t,e){return ct.shrink(this,t,e),this}ceil(){return ct.ceil(this),this}unsign(){return ct.unsign(this),this}float(t){return ct.float(this,t),this}add(t){return ct.add(this,t),this}addList(t){return ct.setList(this,t,!0),this}setList(t){return ct.setList(this,t),this}addListWithFn(t,e){return ct.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return ct.setListWithFn(this,t,e),this}setPoint(t){return ct.setPoint(this,t),this}setPoints(t){return ct.setPoints(this,t),this}addPoint(t){return ct.addPoint(this,t),this}getPoints(){return ct.getPoints(this)}hitPoint(t,e){return ct.hitPoint(this,t,e)}hitRadiusPoint(t,e){return ct.hitRadiusPoint(this,t,e)}hit(t,e){return ct.hit(this,t,e)}includes(t,e){return ct.includes(this,t,e)}intersect(t,e){return ct.intersect(this,t,e),this}getIntersect(t,e){return new gt(ct.getIntersectData(this,t,e))}isSame(t){return ct.isSame(this,t)}isEmpty(){return ct.isEmpty(this)}reset(){ct.reset(this)}}const yt=new gt;class mt{constructor(t,e,s,r,i,n){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,n)}set(t=0,e=0,s=0,r=0,i=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=n}copy(t){const{top:e,right:s,bottom:r,left:i,width:n,height:o}=t;this.set(e,s,r,i,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:n,height:o}=this;return new gt(i,e,n||t.width-i-s,o||t.height-e-r)}}const xt={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},{randColor:wt}=o;class bt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new bt(t)}static set filter(t){this.filterList=vt(t)}static set exclude(t){this.excludeList=vt(t)}static drawRepaint(t,e){const s=wt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===bt.showBounds,i=t.__nowWorld,n=wt();r&&(e.setWorld(i),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),r?e.stroke():e.strokeWorld(i,n)}log(...t){if(Bt.enable){if(Bt.filterList.length&&Bt.filterList.every((t=>t!==this.name)))return;if(Bt.excludeList.length&&Bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Bt.enable&&this.warn(...t)}warn(...t){Bt.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 vt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const Bt=bt,kt=bt.get("RunTime"),Ct={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,s){const r=e.create(e.RUNTIME);return Ot.currentId=Ot.idMap[r]=s?performance.now():Date.now(),Ot.currentName=Ot.nameMap[r]=t,Ot.nameToIdMap[t]=r,r},end(t,e){const s=Ot.idMap[t],r=Ot.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Ot.idMap[t]=Ot.nameMap[t]=Ot.nameToIdMap[r]=void 0,kt.log(r,i,"ms")},endOfName(t,e){const s=Ot.nameToIdMap[t];void 0!==s&&Ot.end(s,e)}},Ot=Ct,Tt=[],Pt={list:{},add(t,...e){this.list[t]=!0,Tt.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((()=>Tt.forEach((t=>Pt.has(t,!0)))));const St={editor:t=>Pt.need("editor")},Rt=bt.get("UICreator"),Lt={list:{},register(t){const{__tag:e}=t.prototype;Et[e]&&Rt.repeat(e),Et[e]=t},get(t,e,s,r,i,n){Et[t]||Rt.error("not register "+t);const o=new Et[t](e);return void 0!==s&&(o.x=s,r&&(o.y=r),i&&(o.width=i),n&&(o.height=n)),o}},{list:Et}=Lt,It=bt.get("EventCreator"),Mt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(At[e]&&It.repeat(e),At[e]=t)}))},changeName(t,e){const s=At[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,At[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new At[t](...e)},{nameList:At}=Mt;class Wt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let r=0,i=s.length;r<i;r++)if(e=s[r],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const r=St.canvas(t);return this.add(r),r}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;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()}}const Nt={default:(t,e)=>(Dt(e,t),Dt(t,e),t),assign(t,e,s){let r;Object.keys(e).forEach((i=>{var n,o;if(r=e[i],(null==r?void 0:r.constructor)===Object&&(null===(n=t[i])||void 0===n?void 0:n.constructor)===Object)return Dt(t[i],e[i],s&&s[i]);s&&i in s?(null===(o=s[i])||void 0===o?void 0:o.constructor)===Object&&Dt(t[i]={},e[i],s[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,r=t.length;s<r;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:Dt}=Nt;class Yt{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}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(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=void 0===s?this[r]: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(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(t instanceof Array)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:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],void 0!==t)){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:r,d:i,e:n,f:o}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:n,f:o}}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}}var Xt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Xt||(Xt={}));const zt={};function Ft(t){return null==t}function jt(t){return"{}"===JSON.stringify(t)}function Ut(t,e,s,r){var i,n=arguments.length,o=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(n<3?i(o):n>3?i(e,s,o):i(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function Ht(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{h(r.next(t))}catch(t){n(t)}}function a(t){try{h(r.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}h((r=r.apply(t,e||[])).next())}))}function Gt(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}"function"==typeof SuppressedError&&SuppressedError;const Vt=[];function qt(){return(t,e)=>{Vt.push(e)}}const Qt=[];class Zt{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||Qt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Vt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,n){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,r,i,n,o,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,n){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,n){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,n,o,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,n){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}Ut([Gt("imageSmoothingEnabled")],Zt.prototype,"smooth",void 0),Ut([Gt("imageSmoothingQuality")],Zt.prototype,"smoothLevel",void 0),Ut([Gt("globalAlpha")],Zt.prototype,"opacity",void 0),Ut([Gt()],Zt.prototype,"fillStyle",void 0),Ut([Gt()],Zt.prototype,"strokeStyle",void 0),Ut([Gt("lineWidth")],Zt.prototype,"strokeWidth",void 0),Ut([Gt("lineCap")],Zt.prototype,"strokeCap",void 0),Ut([Gt("lineJoin")],Zt.prototype,"strokeJoin",void 0),Ut([Gt("lineDashOffset")],Zt.prototype,"dashOffset",void 0),Ut([Gt()],Zt.prototype,"miterLimit",void 0),Ut([Gt()],Zt.prototype,"shadowBlur",void 0),Ut([Gt()],Zt.prototype,"shadowColor",void 0),Ut([Gt()],Zt.prototype,"shadowOffsetX",void 0),Ut([Gt()],Zt.prototype,"shadowOffsetY",void 0),Ut([Gt()],Zt.prototype,"filter",void 0),Ut([Gt()],Zt.prototype,"font",void 0),Ut([Gt()],Zt.prototype,"fontKerning",void 0),Ut([Gt()],Zt.prototype,"fontStretch",void 0),Ut([Gt()],Zt.prototype,"fontVariantCaps",void 0),Ut([Gt()],Zt.prototype,"textAlign",void 0),Ut([Gt()],Zt.prototype,"textBaseline",void 0),Ut([Gt()],Zt.prototype,"textRendering",void 0),Ut([Gt()],Zt.prototype,"wordSpacing",void 0),Ut([Gt()],Zt.prototype,"letterSpacing",void 0),Ut([Gt()],Zt.prototype,"direction",void 0),Ut([qt()],Zt.prototype,"setTransform",null),Ut([qt()],Zt.prototype,"resetTransform",null),Ut([qt()],Zt.prototype,"getTransform",null),Ut([qt()],Zt.prototype,"save",null),Ut([qt()],Zt.prototype,"restore",null),Ut([qt()],Zt.prototype,"translate",null),Ut([qt()],Zt.prototype,"scale",null),Ut([qt()],Zt.prototype,"rotate",null),Ut([qt()],Zt.prototype,"fill",null),Ut([qt()],Zt.prototype,"stroke",null),Ut([qt()],Zt.prototype,"clip",null),Ut([qt()],Zt.prototype,"fillRect",null),Ut([qt()],Zt.prototype,"strokeRect",null),Ut([qt()],Zt.prototype,"clearRect",null),Ut([qt()],Zt.prototype,"beginPath",null),Ut([qt()],Zt.prototype,"moveTo",null),Ut([qt()],Zt.prototype,"lineTo",null),Ut([qt()],Zt.prototype,"bezierCurveTo",null),Ut([qt()],Zt.prototype,"quadraticCurveTo",null),Ut([qt()],Zt.prototype,"closePath",null),Ut([qt()],Zt.prototype,"arc",null),Ut([qt()],Zt.prototype,"arcTo",null),Ut([qt()],Zt.prototype,"ellipse",null),Ut([qt()],Zt.prototype,"rect",null),Ut([qt()],Zt.prototype,"roundRect",null),Ut([qt()],Zt.prototype,"createConicGradient",null),Ut([qt()],Zt.prototype,"createLinearGradient",null),Ut([qt()],Zt.prototype,"createPattern",null),Ut([qt()],Zt.prototype,"createRadialGradient",null),Ut([qt()],Zt.prototype,"fillText",null),Ut([qt()],Zt.prototype,"measureText",null),Ut([qt()],Zt.prototype,"strokeText",null);const{copy:Jt,multiplyParent:$t}=b,{round:Kt}=Math,te={width:1,height:1,pixelRatio:1},ee=["width","height","pixelRatio"];class se extends Zt{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}get pixelHeight(){return this.height*this.pixelRatio}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(s,r){super(),this.size={},this.worldTransform={},s||(s=te),this.manager=r,this.innerId=e.create(e.CNAVAS);const{width:i,height:n,pixelRatio:o}=s;this.autoLayout=!i||!n,this.size.pixelRatio=o|t.devicePixelRatio,this.config=s,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 r=this.size;Nt.copyAttrs(r,t,ee),ee.forEach((t=>r[t]||(r[t]=1))),this.bounds=new gt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!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:r}=this,i=this.worldTransform;e&&$t(t,e,i),i.a=t.a*s,i.b=t.b*s,i.c=t.c*s,i.d=t.d*s,i.e=t.e*s,i.f=t.f*s,r&&(t.half&&t.half*s%2?(i.e=Kt(i.e-.5)+.5,i.f=Kt(i.f-.5)+.5):(i.e=Kt(i.e),i.f=Kt(i.f))),this.setTransform(i.a,i.b,i.c,i.d,i.e,i.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){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap="none"===t.strokeCap?"butt":t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}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,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,ct.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,r,i){this.resetTransform(),this.copyWorld(t,e,s,r),i||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempBounds(t,!0,!0);const{context:r}=this,i=r.getImageData(yt.x,yt.y,yt.width,yt.height),{data:n}=i;for(let t=0,r=n.length;t<r;t+=4)s=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?s:e*(s/255));r.putImageData(i,yt.x,yt.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){s&&(this.blendMode=s),this.fillStyle=e,this.setTempBounds(t),this.fillRect(yt.x,yt.y,yt.width,yt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(yt.x,yt.y,yt.width,yt.height),s&&(this.blendMode="source-over")}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(yt.x,yt.y,yt.width,yt.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(yt.x,yt.y,yt.width,yt.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,s){yt.set(t),s&&yt.intersect(this.bounds),yt.scale(this.pixelRatio),e&&yt.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:r}=this,i=this.manager?this.manager.get(s):St.canvas(Object.assign({},s));return i.save(),t&&(Jt(i.worldTransform,this.worldTransform),i.useWorldTransform()),e&&(i.smooth=this.smooth),i.pixelSnap!==r&&(i.pixelSnap=r),i}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const re={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ie={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ne=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},ie),oe={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},ae={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},he=Object.assign(Object.assign({},ae),ie),le=ne,de={};for(let t in le)de[le[t]]=t;const ue={};for(let t in le)ue[le[t]]=oe[t];const ce={drawRoundRect(t,e,s,r,i,n){const a=o.fourNumber(n,Math.min(r/2,i/2)),h=e+r,l=s+i;a[0]?t.moveTo(e+a[0],s):t.moveTo(e,s),a[1]?t.arcTo(h,s,h,l,a[1]):t.lineTo(h,s),a[2]?t.arcTo(h,l,e,l,a[2]):t.lineTo(h,l),a[3]?t.arcTo(e,l,e,s,a[3]):t.lineTo(e,l),a[0]?t.arcTo(e,s,h,s,a[0]):t.lineTo(e,s)}},{sin:_e,cos:pe,atan2:fe,ceil:ge,abs:ye,PI:me,sqrt:xe,pow:we}=Math,{setPoint:be,addPoint:ve}=z,{set:Be,toNumberPoints:ke}=E,{M:Ce,L:Oe,C:Te,Q:Pe,Z:Se}=ne,Re={},Le={points(t,e,s,r){let i=ke(e);if(t.push(Ce,i[0],i[1]),s&&i.length>5){let e,n,o,a,h,l,d,u,c,_,p,f,g,y=i.length;const m=!0===s?.5:s;r&&(i=[i[y-2],i[y-1],...i,i[0],i[1],i[2],i[3]],y=i.length);for(let s=2;s<y-2;s+=2)e=i[s-2],n=i[s-1],o=i[s],a=i[s+1],h=i[s+2],l=i[s+3],p=xe(we(o-e,2)+we(a-n,2)),f=xe(we(h-o,2)+we(l-a,2)),(p||f)&&(g=p+f,p=m*p/g,f=m*f/g,h-=e,l-=n,d=o-p*h,u=a-p*l,2===s?r||t.push(Pe,d,u,o,a):t.push(Te,c,_,d,u,o,a),c=o+f*h,_=a+f*l);r||t.push(Pe,c,_,i[y-2],i[y-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(Oe,i[e],i[e+1]);r&&t.push(Se)},rect(t,e,s,r,i){re.creator.path=t,re.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,n){re.creator.path=[],ce.drawRoundRect(re.creator,e,s,r,i,n),t.push(...re.convertToCanvasData(re.creator.path,!0))},arcTo(t,e,s,r,i,n,o,a,u,c,_){const p=r-e,f=i-s,g=n-r,y=o-i;let m=fe(f,p),x=fe(y,g),w=x-m;if(w<0&&(w+=l),w===me||ye(p+f)<1e-12||ye(g+y)<1e-12)return t&&t.push(Oe,r,i),u&&(be(u,e,s),ve(u,r,i)),_&&Be(_,e,s),void(c&&Be(c,r,i));const b=p*y-g*f<0,v=b?-1:1,B=a/pe(w/2),k=r+B*pe(m+w/2+d*v),C=i+B*_e(m+w/2+d*v);return m-=d*v,x-=d*v,Me(t,k,C,a,a,0,m/h,x/h,b,u,c,_)},arc:(t,e,s,r,i,n,o,a,h,l)=>Me(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,u,c,_,p){const f=n*h,g=_e(f),y=pe(f);let m=o*h,x=a*h;m>me&&(m-=l),x<0&&(x+=l);let w=x-m;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=ge(ye(w/d)),v=w/b,B=_e(v/4),k=8/3*B*B/_e(v/2);x=m+v;let C,O,T,P,S,R,L,E,I=pe(m),M=_e(m),A=T=y*r*I-g*i*M,W=P=g*r*I+y*i*M,N=e+T,D=s+P;t&&t.push(t.length?Oe:Ce,N,D),c&&be(c,N,D),p&&Be(p,N,D);for(let n=0;n<b;n++)C=pe(x),O=_e(x),T=y*r*C-g*i*O,P=g*r*C+y*i*O,S=e+A-k*(y*r*M+g*i*I),R=s+W-k*(g*r*M-y*i*I),L=e+T+k*(y*r*O+g*i*C),E=s+P+k*(g*r*O-y*i*C),t&&t.push(Te,S,R,L,E,e+T,s+P),c&&Ie(e+A,s+W,S,R,L,E,e+T,s+P,c,!0),A=T,W=P,I=C,M=O,m=x,x+=v;_&&Be(_,e+T,s+P)},quadraticCurveTo(t,e,s,r,i,n,o){t.push(Te,(e+2*r)/3,(s+2*i)/3,(n+2*r)/3,(o+2*i)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,n,o,a){Ie(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(n+2*r)/3,i,n,o,a)},toTwoPointBounds(t,e,s,r,i,n,o,a,h,l){const d=[];let u,c,_,p,f,g,y,m,x=t,w=s,b=i,v=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=r,b=n,v=a),u=-3*x+9*w-9*b+3*v,c=6*x-12*w+6*b,_=3*w-3*x,Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;p=-_/c,0<p&&p<1&&d.push(p)}else y=c*c-4*_*u,m=Math.sqrt(y),y<0||(f=(-c+m)/(2*u),0<f&&f<1&&d.push(f),g=(-c-m)/(2*u),0<g&&g<1&&d.push(g));l?ve(h,t,e):be(h,t,e),ve(h,o,a);for(let l=0,u=d.length;l<u;l++)Ee(d[l],t,e,s,r,i,n,o,a,Re),ve(h,Re.x,Re.y)},getPointAndSet(t,e,s,r,i,n,o,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=u*e+c*r+_*n+p*a,l.y=u*s+c*i+_*o+p*h},getPoint(t,e,s,r,i,n,o,a,h){const l={};return Ee(t,e,s,r,i,n,o,a,h,l),l},getDerivative(t,e,s,r,i){const n=1-t;return 3*n*n*(s-e)+6*n*t*(r-s)+3*t*t*(i-r)}},{getPointAndSet:Ee,toTwoPointBounds:Ie,ellipse:Me}=Le,{sin:Ae,cos:We,sqrt:Ne,atan2:De}=Math,{ellipse:Ye}=Le,Xe={ellipticalArc(e,s,r,i,n,o,a,d,u,c,_){const p=(u-s)/2,f=(c-r)/2,g=o*h,y=Ae(g),m=We(g),x=-m*p-y*f,w=-m*f+y*p,b=i*i,v=n*n,B=w*w,k=x*x,C=b*v-b*B-v*k;let O=0;if(C<0){const t=Ne(1-C/(b*v));i*=t,n*=t}else O=(a===d?-1:1)*Ne(C/(b*B+v*k));const T=O*i*w/n,P=-O*n*x/i,S=De((w-P)/n,(x-T)/i),R=De((-w-P)/n,(-x-T)/i);let L=R-S;0===d&&L>0?L-=l:1===d&&L<0&&(L+=l);const E=s+p+m*T-y*P,I=r+f+y*T+m*P,M=L<0?1:0;_||t.ellipseToCurve?Ye(e,E,I,i,n,o,S/h,R/h,M):i!==n||o?e.push(ne.G,E,I,i,n,o,S/h,R/h,M):e.push(ne.O,E,I,i,S/h,R/h,M)}},{M:ze,m:Fe,L:je,l:Ue,H:He,h:Ge,V:Ve,v:qe,C:Qe,c:Ze,S:Je,s:$e,Q:Ke,q:ts,T:es,t:ss,A:rs,a:is,Z:ns,z:os,N:as,D:hs,X:ls,G:ds,F:us,O:cs,P:_s,U:ps}=ne,{rect:fs,roundRect:gs,arcTo:ys,arc:ms,ellipse:xs,quadraticCurveTo:ws}=Le,{ellipticalArc:bs}=Xe,vs=bt.get("PathConvert"),Bs={},ks={current:{dot:0},stringify(t,e){let s,r,i,n=0,a=t.length,h="";for(;n<a;){r=t[n],s=ue[r],h+=r===i?" ":de[r];for(let r=1;r<s;r++)h+=o.float(t[n+r],e),r===s-1||(h+=" ");i=r,n+=s}return h},parse(t,e){let s,r,i,n="";const o=[],a=e?he:ae;for(let e=0,h=t.length;e<h;e++)r=t[e],xt[r]?("."===r&&(Cs.dot&&(Os(o,n),n=""),Cs.dot++),"0"===n&&"."!==r&&(Os(o,n),n=""),n+=r):ne[r]?(n&&(Os(o,n),n=""),Cs.name=ne[r],Cs.length=oe[r],Cs.index=0,Os(o,Cs.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?n+=r:(n&&Os(o,n),n=r):n&&(Os(o,n),n=""),i=r;return n&&Os(o,n),s?ks.toCanvasData(o,e):o},toCanvasData(t,e){let s,r,i,n,o,a=0,h=0,l=0,d=0,u=0,c=t.length;const _=[];for(;u<c;){switch(i=t[u],i){case Fe:t[u+1]+=a,t[u+2]+=h;case ze:a=t[u+1],h=t[u+2],_.push(ze,a,h),u+=3;break;case Ge:t[u+1]+=a;case He:a=t[u+1],_.push(je,a,h),u+=2;break;case qe:t[u+1]+=h;case Ve:h=t[u+1],_.push(je,a,h),u+=2;break;case Ue:t[u+1]+=a,t[u+2]+=h;case je:a=t[u+1],h=t[u+2],_.push(je,a,h),u+=3;break;case $e:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Je;case Je:o=n===Qe||n===Je,l=o?2*a-s:t[u+1],d=o?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],_.push(Qe,l,d,s,r,a,h),u+=5;break;case Ze:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,t[u+5]+=a,t[u+6]+=h,i=Qe;case Qe:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],_.push(Qe,t[u+1],t[u+2],s,r,a,h),u+=7;break;case ss:t[u+1]+=a,t[u+2]+=h,i=es;case es:o=n===Ke||n===es,s=o?2*a-s:t[u+1],r=o?2*h-r:t[u+2],e?ws(_,a,h,s,r,t[u+1],t[u+2]):_.push(Ke,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case ts:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Ke;case Ke:s=t[u+1],r=t[u+2],e?ws(_,a,h,s,r,t[u+3],t[u+4]):_.push(Ke,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case is:t[u+6]+=a,t[u+7]+=h;case rs:bs(_,a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],e),a=t[u+6],h=t[u+7],u+=8;break;case os:case ns:_.push(ns),u++;break;case as:a=t[u+1],h=t[u+2],e?fs(_,a,h,t[u+3],t[u+4]):Ts(_,t,u,5),u+=5;break;case hs:a=t[u+1],h=t[u+2],e?gs(_,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):Ts(_,t,u,9),u+=9;break;case ls:a=t[u+1],h=t[u+2],e?gs(_,a,h,t[u+3],t[u+4],t[u+5]):Ts(_,t,u,6),u+=6;break;case ds:xs(e?_:Ts(_,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,Bs),a=Bs.x,h=Bs.y,u+=9;break;case us:e?xs(_,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):Ts(_,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case cs:ms(e?_:Ts(_,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,Bs),a=Bs.x,h=Bs.y,u+=7;break;case _s:e?ms(_,t[u+1],t[u+2],t[u+3],0,360,!1):Ts(_,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case ps:ys(e?_:Ts(_,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,Bs),a=Bs.x,h=Bs.y,u+=6;break;default:return vs.error(`command: ${i} [index:${u}]`,t),_}n=i}return _},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(ze,t.x,t.y);break;case"L":e.push(je,t.x,t.y);break;case"C":e.push(Qe,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ke,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ns)}})),e},copyData(t,e,s,r){for(let i=s,n=s+r;i<n;i++)t.push(e[i])},pushData(t,e){Cs.index===Cs.length&&(Cs.index=1,t.push(Cs.name)),t.push(Number(e)),Cs.index++,Cs.dot=0}},{current:Cs,pushData:Os,copyData:Ts}=ks,{M:Ps,L:Ss,C:Rs,Q:Ls,Z:Es,N:Is,D:Ms,X:As,G:Ws,F:Ns,O:Ds,P:Ys,U:Xs}=ne,{getMinDistanceFrom:zs,getRadianFrom:Fs}=E,{tan:js,min:Us,abs:Hs}=Math,Gs={},Vs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ps,e,s)},lineTo(t,e,s){t.push(Ss,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(Rs,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(Ls,e,s,r,i)},closePath(t){t.push(Es)},rect(t,e,s,r,i){t.push(Is,e,s,r,i)},roundRect(t,e,s,r,i,n){if("number"==typeof n)t.push(As,e,s,r,i,n);else{const a=o.fourNumber(n);a?t.push(Ms,e,s,r,i,...a):t.push(Is,e,s,r,i)}},ellipse(t,e,s,r,i,n,o,a,h){void 0===n?t.push(Ns,e,s,r,i):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Ws,e,s,r,i,n,o,a,h?1:0))},arc(t,e,s,r,i,n,o){void 0===i?t.push(Ys,e,s,r):(void 0===n&&(n=360),t.push(Ds,e,s,r,i,n,o?1:0))},arcTo(t,e,s,r,i,n,o,a){if(void 0!==o){const t=zs(o,a,e,s,r,i);n=Us(n,Us(t/2,t/2*Hs(js(Fs(o,a,e,s,r,i)/2))))}t.push(Xs,e,s,r,i,n)},drawEllipse(t,e,s,r,i,n,o,a,h){Le.ellipse(null,e,s,r,i,void 0===n?0:n,void 0===o?0:o,void 0===a?360:a,h,null,null,Gs),t.push(Ps,Gs.x,Gs.y),qs(t,e,s,r,i,n,o,a,h)},drawArc(t,e,s,r,i,n,o){Le.arc(null,e,s,r,void 0===i?0:i,void 0===n?360:n,o,null,null,Gs),t.push(Ps,Gs.x,Gs.y),Qs(t,e,s,r,i,n,o)},drawPoints(t,e,s,r){Le.points(t,e,s,r)}},{ellipse:qs,arc:Qs}=Vs,{moveTo:Zs,lineTo:Js,quadraticCurveTo:$s,bezierCurveTo:Ks,closePath:tr,beginPath:er,rect:sr,roundRect:rr,ellipse:ir,arc:nr,arcTo:or,drawEllipse:ar,drawArc:hr,drawPoints:lr}=Vs;class dr{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?"string"==typeof t?re.parse(t):t:[],this}beginPath(){return er(this.__path),this.paint(),this}moveTo(t,e){return Zs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Js(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,n){return Ks(this.__path,t,e,s,r,i,n),this.paint(),this}quadraticCurveTo(t,e,s,r){return $s(this.__path,t,e,s,r),this.paint(),this}closePath(){return tr(this.__path),this.paint(),this}rect(t,e,s,r){return sr(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return rr(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,n,o,a){return ir(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}arc(t,e,s,r,i,n){return nr(this.__path,t,e,s,r,i,n),this.paint(),this}arcTo(t,e,s,r,i){return or(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,n,o,a){return ar(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}drawArc(t,e,s,r,i,n){return hr(this.__path,t,e,s,r,i,n),this.paint(),this}drawPoints(t,e,s){return lr(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:ur,L:cr,C:_r,Q:pr,Z:fr,N:gr,D:yr,X:mr,G:xr,F:wr,O:br,P:vr,U:Br}=ne,kr=bt.get("PathDrawer"),Cr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case ur:t.moveTo(e[r+1],e[r+2]),r+=3;break;case cr:t.lineTo(e[r+1],e[r+2]),r+=3;break;case _r:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case pr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case fr:t.closePath(),r+=1;break;case gr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case yr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case mr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case xr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*h,e[r+6]*h,e[r+7]*h,e[r+8]),r+=9;break;case wr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case br:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*h,e[r+5]*h,e[r+6]),r+=7;break;case vr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case Br:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void kr.error(`command: ${s} [index:${r}]`,e)}}},{M:Or,L:Tr,C:Pr,Q:Sr,Z:Rr,N:Lr,D:Er,X:Ir,G:Mr,F:Ar,O:Wr,P:Nr,U:Dr}=ne,{toTwoPointBounds:Yr,toTwoPointBoundsByQuadraticCurve:Xr,arcTo:zr,arc:Fr,ellipse:jr}=Le,{addPointBounds:Ur,copy:Hr,addPoint:Gr,setPoint:Vr,addBounds:qr,toBounds:Qr}=z,Zr=bt.get("PathBounds");let Jr,$r,Kr;const ti={},ei={},si={},ri={toBounds(t,e){ri.toTwoPointBounds(t,ei),Qr(ei,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Vr(e,0,0);let s,r,i,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===Rr||o===Pr||o===Sr?Vr(e,h,l):Vr(e,t[a+1],t[a+2])),o){case Or:case Tr:h=t[a+1],l=t[a+2],Gr(e,h,l),a+=3;break;case Pr:i=t[a+5],n=t[a+6],Yr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,n,ti),Ur(e,ti),h=i,l=n,a+=7;break;case Sr:s=t[a+1],r=t[a+2],i=t[a+3],n=t[a+4],Xr(h,l,s,r,i,n,ti),Ur(e,ti),h=i,l=n,a+=5;break;case Rr:a+=1;break;case Lr:h=t[a+1],l=t[a+2],qr(e,h,l,t[a+3],t[a+4]),a+=5;break;case Er:case Ir:h=t[a+1],l=t[a+2],qr(e,h,l,t[a+3],t[a+4]),a+=o===Er?9:6;break;case Mr:jr(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],ti,si),0===a?Hr(e,ti):Ur(e,ti),h=si.x,l=si.y,a+=9;break;case Ar:h=t[a+1],l=t[a+2],$r=t[a+3],Kr=t[a+4],qr(e,h-$r,l-Kr,2*$r,2*Kr),h+=$r,a+=5;break;case Wr:Fr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],ti,si),0===a?Hr(e,ti):Ur(e,ti),h=si.x,l=si.y,a+=7;break;case Nr:h=t[a+1],l=t[a+2],Jr=t[a+3],qr(e,h-Jr,l-Jr,2*Jr,2*Jr),h+=Jr,a+=4;break;case Dr:zr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ti,si),0===a?Hr(e,ti):Ur(e,ti),h=si.x,l=si.y,a+=6;break;default:return void Zr.error(`command: ${o} [index:${a}]`,t)}}},{M:ii,L:ni,Z:oi}=ne,{getCenterX:ai,getCenterY:hi}=E,{arcTo:li}=Vs,di={smooth(t,e,s){let r,i,n,o=0,a=0,h=0,l=0,d=0,u=0,c=0,_=0,p=0;const f=t.length,g=[];for(;o<f;){switch(r=t[o],r){case ii:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===ni?(u=t[o+1],c=t[o+2],g.push(ii,ai(l,u),hi(d,c))):g.push(ii,l,d);break;case ni:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case ni:li(g,a,h,t[o+1],t[o+2],e,_,p);break;case oi:li(g,a,h,l,d,e,_,p);break;default:g.push(ni,a,h)}_=a,p=h;break;case oi:i!==oi&&(li(g,l,d,u,c,e,_,p),g.push(oi)),o+=1;break;default:n=ue[r];for(let e=0;e<n;e++)g.push(t[o+e]);o+=n}i=r}return r!==oi&&(g[1]=l,g[2]=d),g}};re.creator=new dr,re.parse=ks.parse,re.convertToCanvasData=ks.toCanvasData;const ui=new dr,{drawRoundRect:ci}=ce;function _i(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){ci(this,t,e,s,r,i)})}(t)}const pi={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=fi.fileType(t);return["jpg","jpeg"].some((t=>t===e))},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},fi=pi;fi.alphaPixelTypes.forEach((t=>fi.upperCaseTypeMap[t]=t.toUpperCase()));const gi=bt.get("TaskProcessor");class yi{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return Ht(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){gi.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class mi{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&Nt.assign(this.config,t),this.empty()}add(t,e){let s,r,i,n;const o=new yi(t);return o.parent=this,"number"==typeof e?n=e:e&&(r=e.parallel,s=e.start,i=e.time,n=e.delay),i&&(o.time=i),!1===r&&(o.parallel=!1),void 0===n?this.push(o,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(o,s))}),n)),this.isComplete=!1,o}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this.runnin