@leafer/core 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core.cjs +3006 -2425
- package/lib/core.esm.js +2877 -2434
- package/lib/core.esm.min.js +1 -1
- package/lib/core.esm.min.js.map +1 -1
- package/lib/core.min.cjs +1 -1
- package/lib/core.min.cjs.map +1 -1
- package/package.json +17 -17
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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.running)return;r<this.total&&(t=this.list[r],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const xi=bt.get("Resource"),wi={tasker:new mi,map:{},get isComplete(){return bi.tasker.isComplete},set(t,e){bi.map[t]&&xi.repeat(t),bi.map[t]=e},get:t=>bi.map[t],remove(t){const e=bi.map[t];e&&(e.destroy&&e.destroy(),delete bi.map[t])},loadImage(t,e){return new Promise(((s,r)=>{const i=this.setImage(t,t,e);i.load((()=>s(i)),(t=>r(t)))}))},setImage(t,e,s){let r;return"string"==typeof e?r={url:e}:e.url||(r={url:t,view:e}),r&&(s&&(r.format=s),e=St.image(r)),bi.set(t,e),e},destroy(){bi.map={}}},bi=wi,vi={maxRecycled:10,recycledList:[],patternTasker:new mi,get(t){let e=wi.get(t.url);return e||wi.set(t.url,e=St.image(t)),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||Bi.recycledList.push(t)}))},clearRecycled(){const t=Bi.recycledList;t.length>Bi.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&wi.remove(t.url))),t.length=0)},hasAlphaPixel:t=>pi.alphaPixelTypes.some((e=>Bi.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+pi.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+pi.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Bi.recycledList=[]}},Bi=vi,{IMAGE:ki,create:Ci}=e;class Oi{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Ci(ki),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}vi.isFormat("svg",t)&&(this.isSVG=!0),vi.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,s){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:s}=t.origin,r=this.config.showProgress&&s&&this.onProgress.bind(this);r&&(e=s),wi.tasker.add((()=>Ht(this,void 0,void 0,(function*(){return yield e(this.url,r).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))}return this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,s,r,i){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const n=t.origin.createCanvas(e,s),o=n.getContext("2d");return r&&(o.globalAlpha=r),o.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:n,params:arguments}:null,n}getPattern(e,s,r,i){const n=t.canvas.createPattern(e,s);try{r&&n.setTransform&&(n.setTransform(r),r=void 0)}catch(t){}return i&&Nt.stintSet(i,"transform",r),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Ti(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function Pi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Si(t,e){return(s,r)=>Li(s,r,t,e&&e(r))}function Ri(t){return t}function Li(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Ti(t,e,Object.assign(i,r||{})),nn(t,e,s)}function Ei(t){return Si(t)}function Ii(t,e){return Si(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Mi(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Yi(this))}})))}function Ai(t,e){return Si(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Wi(t,e){return Si(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Ni(t,e){return Si(t,(t=>({set(s){this.__setAttr(t,s,e)&&Yi(this)}})))}function Di(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(Yi(this),this.__.__removeNaturalSize())}})))}function Yi(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Xi(t){return Si(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Yi(this)}})))}const zi=Ni;function Fi(t,e){return Si(t,(t=>({set(s){this.__setAttr(t,s)&&(ji(this),e&&(this.__.__useStroke=!0))}})))}function ji(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Yi(t)}const Ui=Fi;function Hi(t){return Si(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Gi(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Vi(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Qi(this)}})))}function qi(t){return Si(t,(t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Zi(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Zi(this,t,e,s),this.mask&&Qi(this)}})))}function Qi(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Zi(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||Yi(t))}function Ji(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function $i(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function Ki(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function tn(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===bt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function en(t){return Si(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function sn(t){return(e,s)=>{Ti(e,"__DataProcessor",{get:()=>t})}}function rn(t){return(e,s)=>{Ti(e,"__LayoutProcessor",{get:()=>t})}}function nn(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};if(void 0===s)o.get=function(){return this[i]};else if("function"==typeof s)o.get=function(){let t=this[i];return void 0===t?s(this.__leaf):t};else if("object"==typeof s){const t=jt(s);o.get=function(){let e=this[i];return void 0===e?this[i]=t?{}:Nt.clone(s):e}}const a=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalWidth,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:a&&r.children.length?r.boxBounds.width:s}return t}:"height"===e&&(o.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalHeight,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:a&&r.children.length?r.boxBounds.height:s}return t});let h,l=r;for(;!h&&l;)h=Pi(l,e),l=l.__proto__;h&&h.set&&(o.set=h.set),r[n]&&(o.set=r[n],delete r[n]),Ti(r,e,o)}const on=new bt("rewrite"),an=[],hn=["destroy","constructor"];function ln(t){return(e,s)=>{an.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function dn(){return t=>{un()}}function un(t){an.length&&(an.forEach((e=>{t&&on.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),an.length=0)}function cn(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(hn.includes(r)||e&&e.includes(r)))if(t.prototype){Pi(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function _n(){return t=>{Lt.register(t)}}function pn(){return t=>{Mt.register(t)}}setTimeout((()=>un(!0)));const{copy:fn,toInnerPoint:gn,toOuterPoint:yn,scaleOfOuter:mn,rotateOfOuter:xn,skewOfOuter:wn,multiplyParent:bn,divideParent:vn,getLayout:Bn}=b,kn={},{round:Cn}=Math,On={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Sn(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)Pn(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Rn(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Rn(t),t.__updateChange()},updateAllChange(t){if(En(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ln(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0,r,i){const n="object"==typeof e?Object.assign({},e):{x:e,y:s};r?yn(t.localTransform,n,n,!0):t.parent&&gn(t.parent.worldTransform,n,n,!0),Tn.moveLocal(t,n.x,n.y,i)},moveLocal(t,e,s=0,r){"object"==typeof e&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Cn(e),s=Cn(s)),r?t.animate({x:e,y:s},r):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,r,i,n){Tn.zoomOfLocal(t,In(t,e),s,r,i,n)},zoomOfLocal(t,e,s,r=s,i,n){const o=t.__localMatrix;if("number"!=typeof r&&(r&&(n=r),r=s),fn(kn,o),mn(kn,e,s,r),t.origin||t.around)Tn.setTransform(t,kn,i,n);else{const e=t.x+kn.e-o.e,a=t.y+kn.f-o.f;n&&!i?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*r},n):(t.x=e,t.y=a,t.scaleResize(s,r,!0!==i))}},rotateOfWorld(t,e,s,r){Tn.rotateOfLocal(t,In(t,e),s,r)},rotateOfLocal(t,e,s,r){const i=t.__localMatrix;fn(kn,i),xn(kn,e,s),t.origin||t.around?Tn.setTransform(t,kn,!1,r):t.set({x:t.x+kn.e-i.e,y:t.y+kn.f-i.f,rotation:o.formatRotation(t.rotation+s)},r)},skewOfWorld(t,e,s,r,i,n){Tn.skewOfLocal(t,In(t,e),s,r,i,n)},skewOfLocal(t,e,s,r=0,i,n){fn(kn,t.__localMatrix),wn(kn,e,s,r),Tn.setTransform(t,kn,i,n)},transformWorld(t,e,s,r){fn(kn,t.worldTransform),bn(kn,e),t.parent&&vn(kn,t.parent.worldTransform),Tn.setTransform(t,kn,s,r)},transform(t,e,s,r){fn(kn,t.localTransform),bn(kn,e),Tn.setTransform(t,kn,s,r)},setTransform(t,e,s,r){const i=t.__,n=i.origin&&Tn.getInnerOrigin(t,i.origin),o=Bn(e,n,i.around&&Tn.getInnerOrigin(t,i.around));if(s){const e=o.scaleX/t.scaleX,s=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){ct.scale(t.boxBounds,Math.abs(e),Math.abs(s));const r=Tn.getInnerOrigin(t,i.origin);E.move(o,n.x-r.x,n.y-r.y)}t.set(o),t.scaleResize(e,s,!1)}else t.set(o,r)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},r="x"===e?1:-1;return mn(s,Tn.getLocalOrigin(t,"center"),-1*r,1*r),s},getLocalOrigin:(t,e)=>E.tempToOuterOf(Tn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return G.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(fn(kn,t.worldTransform),vn(kn,e.worldTransform),s?kn:Object.assign({},kn)),drop(t,e,s,r){t.setTransform(Tn.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},Tn=On,{updateAllMatrix:Pn,updateMatrix:Sn,updateAllWorldOpacity:Rn,updateAllChange:Ln,updateChange:En}=Tn;function In(t,e){return t.__layout.update(),t.parent?E.tempToInnerOf(e,t.parent.__world):e}const Mn={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.mask?t.__localBoxBounds:null,maskLocalStrokeBounds:t=>t.__.mask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.mask?t.__layout.localRenderBounds:null,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))},{updateBounds:An}=On,Wn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.add(t),Nn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)Dn(e[t],e)},updateBounds(t,e){const s=[t];Dn(t,s),Yn(s,e)},updateBoundsByBranchStack(t,e){let s,r;for(let i=t.length-1;i>-1;i--){s=t[i],r=s.children;for(let t=0,e=r.length;t<e;t++)An(r[t]);e&&e===s||An(s)}}},{pushAllChildBranch:Nn,pushAllBranchStack:Dn,updateBoundsByBranchStack:Yn}=Wn,Xn={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:zn,updateBounds:Fn}=On,{toOuterOf:jn,getPoints:Un,copy:Hn}=ct,Gn="_localContentBounds",Vn="_worldContentBounds",qn="_worldBoxBounds",Qn="_worldStrokeBounds";class Zn{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return jn(this.contentBounds,this.leaf.__localMatrix,this[Gn]||(this[Gn]={})),this[Gn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return jn(this.contentBounds,this.leaf.__world,this[Vn]||(this[Vn]={})),this[Vn]}get worldBoxBounds(){return jn(this.boxBounds,this.leaf.__world,this[qn]||(this[qn]={})),this[qn]}get worldStrokeBounds(){return jn(this.strokeBounds,this.leaf.__world,this[Qn]||(this[Qn]={})),this[Qn]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:s}=e;if(e.isApp)return Fn(e);if(s)s.ready?s.watcher.changed&&s.layouter.layout():s.start();else{let s=e;for(;s.parent&&!s.parent.leafer;)s=s.parent;const r=s;if(r.__fullLayouting)return;r.__fullLayouting=!0,t.layout(r),delete r.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return b.defaultMatrix;case"page":t=e.zoomLayer;default:return zn(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new gt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,n,o,a=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(a),n=r.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=r.__;o={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},i=r.getLocalPointByInner(a);break;case"inner":i=a,n=b.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(a,e),n=zn(r,e,!0)}if(o||(o=b.getLayout(n)),Hn(o,a),E.copy(o,i),s){const{scaleX:t,scaleY:e}=o,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(o.scaleX/=s,o.scaleY/=r,o.width*=s,o.height*=r)}return o}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=Un(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:r},this._localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:r},this._localRenderBounds={x:t,y:e,width:s,height:r}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Jn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class $n extends Jn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}$n.ADD="child.add",$n.REMOVE="child.remove",$n.CREATED="created",$n.MOUNTED="mounted",$n.UNMOUNTED="unmounted",$n.DESTROY="destroy";class Kn extends Jn{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}Kn.CHANGE="property.change",Kn.LEAFER_CHANGE="property.leafer_change";class to extends Jn{constructor(t,e){super(t),Object.assign(this,e)}}to.LOAD="image.load",to.LOADED="image.loaded",to.ERROR="image.error";class eo extends Jn{static checkHas(t,e,s){"on"===s?e===no?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(so)||t.hasEvent(ro)||t.hasEvent(io),t.__hasWorldEvent=t.hasEvent(no))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(so,t),"inner"===e&&t.emit(ro,t)),t.emit(io,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(no,this)}}eo.RESIZE="bounds.resize",eo.INNER="bounds.inner",eo.LOCAL="bounds.local",eo.WORLD="bounds.world";const{RESIZE:so,INNER:ro,LOCAL:io,WORLD:no}=eo,oo={};[so,ro,io,no].forEach((t=>oo[t]=1));class ao extends Jn{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){"object"==typeof t?(super(ao.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}ao.RESIZE="resize";class ho extends Jn{constructor(t,e){super(t),this.data=e}}ho.REQUEST="watch.request",ho.DATA="watch.data";class lo extends Jn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}lo.REQUEST="layout.request",lo.START="layout.start",lo.BEFORE="layout.before",lo.LAYOUT="layout",lo.AFTER="layout.after",lo.AGAIN="layout.again",lo.END="layout.end";class uo extends Jn{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}uo.REQUEST="render.request",uo.CHILD_START="render.child_start",uo.CHILD_END="render.child_end",uo.START="render.start",uo.BEFORE="render.before",uo.RENDER="render",uo.AFTER="render.after",uo.AGAIN="render.again",uo.END="render.end",uo.NEXT="render.next";class co extends Jn{}co.START="leafer.start",co.BEFORE_READY="leafer.before_ready",co.READY="leafer.ready",co.AFTER_READY="leafer.after_ready",co.VIEW_READY="leafer.view_ready",co.VIEW_COMPLETED="leafer.view_completed",co.STOP="leafer.stop",co.RESTART="leafer.restart",co.END="leafer.end";const _o={};class po{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(t instanceof Array)t.forEach((t=>this.on(t[0],t[1],t[2])));else for(let s in t)(e=t[s])instanceof Array?this.on(s,e[0],e[1]):this.on(s,e);return}let r,i,n;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const o=fo(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(n=o[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):o[t]=[h],oo[t]&&eo.checkHas(this,t,"on"))}))}off(t,e,s){if(t){const r="string"==typeof t?t.split(" "):t;if(e){let t,i,n;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const o=fo(this,t);r.forEach((t=>{t&&(i=o[t],i&&(n=i.findIndex((t=>t.listener===e)),n>-1&&i.splice(n,1),i.length||delete o[t],oo[t]&&eo.checkHas(this,t,"off")))}))}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach((s=>{t&&delete t[s],e&&delete e[s]}))}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,r){return e?this.on(t,s?e=e.bind(s):e,r):t instanceof Array&&t.forEach((t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3]))),{type:t,current:this,listener:e,options:r}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{t.listener?t.current.off(t.type,t.listener,t.options):t.type instanceof Array&&t.type.forEach((e=>t.current.off(e[0],e[1],e[3])))})),e.length=0}once(t,e,s,r){if(!e)return t instanceof Array&&t.forEach((t=>this.once(t[0],t[1],t[2],t[3])));"object"==typeof s?e=e.bind(s):r=s,this.on(t,e,{once:!0,capture:r})}emit(t,e,s){!e&&Mt.has(t)&&(e=Mt.get(t,{type:t,target:this,current:this}));const r=fo(this,s)[t];if(r){let i;for(let n=0,o=r.length;n<o&&!((i=r[n])&&(i.listener(e),i.once&&(this.off(t,i.listener,s),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],n=r&&r[t];return!!(void 0===e?i||n:e?n:i)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function fo(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:_o)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:_o)}}const{on:go,on_:yo,off:mo,off_:xo,once:wo,emit:bo,emitEvent:vo,hasEvent:Bo,destroy:ko}=po.prototype,Co={on:go,on_:yo,off:mo,off_:xo,once:wo,emit:bo,emitEvent:vo,hasEvent:Bo,destroyEventer:ko},{isFinite:Oo}=Number,To=bt.get("setAttr"),Po={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(s&&!Oo(e)&&void 0!==e&&(To.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=Kn,i=new Kn(s,this,t,r,e);return this.isLeafer?this.emitEvent(new Kn(Kn.LEAFER_CHANGE,this,t,r,e)):this.hasEvent(s)&&this.emitEvent(i),this.leafer.emitEvent(i),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||void 0===s.normalStyle[t]||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:So,multiplyParent:Ro,translateInner:Lo,defaultWorld:Eo}=b,{toPoint:Io,tempPoint:Mo}=G,Ao={__updateWorldMatrix(){Ro(this.__local||this.__layout,this.parent?this.parent.__world:Eo,this.__world,!!this.__layout.affectScaleOrRotation,this.__,this.parent&&this.parent.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized="scale")||t.rotationChanged)&&(So(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(Io(s.around||s.origin,t.boxBounds,Mo),Lo(e,-Mo.x,-Mo.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Wo,updateAllMatrix:No}=On,{updateBounds:Do}=Wn,{toOuterOf:Yo,copyAndSpread:Xo,copy:zo}=ct,{toBounds:Fo}=ri,jo={__updateWorldBounds(){const t=this.__layout;Yo(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&eo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&eo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Yo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Yo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Yo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Fo(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),No(this),Do(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(No(this),Do(this,this))):Wo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Xo(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Xo(t.renderBounds,t.boxBounds,t.renderSpread):zo(t.renderBounds,t.strokeBounds)}},Uo={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!0,!0);this.__draw(r,e,t),this.__worldFlipped?t.copyWorldByReset(r,this.__nowWorld,null,s.__blendMode,!0):t.copyWorldToInner(r,this.__nowWorld,this.__layout.renderBounds,s.__blendMode),r.recycle(this.__nowWorld)}else this.__draw(t,e);bt.showBounds&&bt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ho}=Mn,Go={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0),s.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e);const i=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(r,i,i,s.__blendMode,!0),r.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)Ho(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)Ho(s[r],e)||s[r].__clip(t,e)}}},{LEAF:Vo,create:qo}=e,{toInnerPoint:Qo,toOuterPoint:Zo,multiplyParent:Jo}=b,{toOuterOf:$o}=ct,{copy:Ko,move:ta}=E,{moveLocal:ea,zoomOfLocal:sa,rotateOfLocal:ra,skewOfLocal:ia,moveWorld:na,zoomOfWorld:oa,rotateOfWorld:aa,skewOfWorld:ha,transform:la,transformWorld:da,setTransform:ua,getFlipTransform:ca,getLocalOrigin:_a,getRelativeWorld:pa,drop:fa}=On;let ga=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return Yt}get __LayoutProcessor(){return Zn}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=qo(Vo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent($n.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on($n.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on($n.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer((()=>this.leafer.nextRender(t,e,s)))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent($n.MOUNTED)):this.__emitLifeEvent($n.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some((t=>t.__.mask&&t.__.visible&&t.__.opacity))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return Jo(s,t.matrix,e,void 0,s),$o(this.__layout.renderBounds,e,e),e.half!==s.half&&(e.half=s.half),e}return this.__world}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const r=e?pa(this,e):this.worldTransform,i=s?t:{};return $o(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&Ko(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&Ko(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),Qo(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){Zo(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,r){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,r),null,null,!0)}getBoxPointByInner(t,e,s,r){const i=r?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return ta(i,-n,-o),i}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByBox(t,e,s,r){const i=r?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return ta(i,n,o),i}getInnerPointByLocal(t,e,s,r){return this.getInnerPoint(t,this.parent,s,r)}getLocalPoint(t,e,s,r){const i=r?t:{};return this.worldToLocal(t,i,s,e),i}getLocalPointByInner(t,e,s,r){return this.getWorldPoint(t,this.parent,s,r)}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByBox(t,e,s,r){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,r),e,s,!0)}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e,s){ua(this,t,e,s)}transform(t,e,s){la(this,t,e,s)}move(t,e,s){ea(this,t,e,s)}moveInner(t,e,s){na(this,t,e,!0,s)}scaleOf(t,e,s,r,i){sa(this,_a(this,t),e,s,r,i)}rotateOf(t,e,s){ra(this,_a(this,t),e,s)}skewOf(t,e,s,r,i){ia(this,_a(this,t),e,s,r,i)}transformWorld(t,e,s){da(this,t,e,s)}moveWorld(t,e,s){na(this,t,e,!1,s)}scaleOfWorld(t,e,s,r,i){oa(this,t,e,s,r,i)}rotateOfWorld(t,e){aa(this,t,e)}skewOfWorld(t,e,s,r,i){ha(this,t,e,s,r,i)}flip(t,e){la(this,ca(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Pt.need("path")}getMotionPoint(t){return Pt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){fa(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s,r){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):nn(this.prototype,t,e)}static addAttr(t,e,s,r){s||(s=Ni),s(e,r)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new $n(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent($n.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};ga=Ut([cn(Po),cn(Ao),cn(jo),cn(Co),cn(Uo)],ga);const{setListWithFn:ya}=ct,{sort:ma}=Wn,{localBoxBounds:xa,localStrokeBounds:wa,localRenderBounds:ba,maskLocalBoxBounds:va,maskLocalStrokeBounds:Ba,maskLocalRenderBounds:ka}=Mn,Ca=new bt("Branch");let Oa=class extends ga{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){ya(this.__layout.boxBounds,this.children,this.__hasMask?va:xa)}__updateStrokeBounds(){ya(this.__layout.strokeBounds,this.children,this.__hasMask?Ba:wa)}__updateRenderBounds(){ya(this.__layout.renderBounds,this.children,this.__hasMask?ka:ba)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(ma),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ca.warn("add self or destroyed");const s=void 0===e;if(!t.__){if(t instanceof Array)return t.forEach((t=>{this.add(t,e),s||e++}));t=Lt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent($n.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent($n.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",(()=>this.__remove(t,e))):this.__remove(t,e):this.find(t).forEach((t=>this.remove(t,e))):void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()})))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent($n.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent($n.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new $n(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};Oa=Ut([cn(Go)],Oa);class Ta{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:r}=this;for(let t=e,i=r.length;t<i;t++)s[r[t].innerId]++;0===e?r.unshift(t):(e>r.length&&(e=r.length),r.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new Ta;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,r=t.length;s<r;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Pa{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}addList(t){t.forEach((t=>{this.add(t)}))}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Sa="1.7.0";export{Q as AlignHelper,Xt as Answer,G as AroundHelper,mt as AutoBounds,Le as BezierHelper,gt as Bounds,eo as BoundsEvent,ct as BoundsHelper,Oa as Branch,Wn as BranchHelper,Go as BranchRender,Wt as CanvasManager,$n as ChildEvent,St as Creator,Nt as DataHelper,bt as Debug,j as Direction4,U as Direction9,Xe as EllipseHelper,Jn as Event,Mt as EventCreator,po as Eventer,pi as FileHelper,to as ImageEvent,vi as ImageManager,e as IncrementId,lo as LayoutEvent,ga as Leaf,jo as LeafBounds,Mn as LeafBoundsHelper,Yt as LeafData,Po as LeafDataProxy,Co as LeafEventer,On as LeafHelper,Zn as LeafLayout,Pa as LeafLevelList,Ta as LeafList,Ao as LeafMatrix,Uo as LeafRender,se as LeaferCanvasBase,co as LeaferEvent,Oi as LeaferImage,o as MathHelper,Y as Matrix,b as MatrixHelper,ae as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,ri as PathBounds,Vs as PathCommandDataHelper,ne as PathCommandMap,ks as PathConvert,di as PathCorner,dr as PathCreator,Cr as PathDrawer,re as PathHelper,ue as PathNumberCommandLengthMap,de as PathNumberCommandMap,t as Platform,Pt as Plugin,N as Point,E as PointHelper,Kn as PropertyEvent,ce as RectHelper,uo as RenderEvent,ao as ResizeEvent,wi as Resource,Ct as Run,xt as StringNumberMap,yi as TaskItem,mi as TaskProcessor,z as TwoPointBoundsHelper,Lt as UICreator,Xn as WaitHelper,ho as WatchEvent,Hi as affectRenderBoundsType,Fi as affectStrokeBoundsType,Ri as attr,Mi as autoLayoutType,Ni as boundsType,_i as canvasPatch,ee as canvasSizeAttrs,en as cursorType,sn as dataProcessor,Ei as dataType,Si as decorateLeafAttr,nn as defineDataProcessor,Ti as defineKey,Li as defineLeafAttr,Yi as doBoundsType,ji as doStrokeType,zt as emptyData,Ki as eraserType,c as getBoundsData,Pi as getDescriptor,_ as getMatrixData,u as getPointData,tn as hitType,jt as isEmptyData,Ft as isNull,rn as layoutProcessor,$i as maskType,Di as naturalBoundsType,Vi as opacityType,Xi as pathInputType,zi as pathType,ui as pen,Ii as positionType,_n as registerUI,pn as registerUIEvent,ln as rewrite,dn as rewriteAble,Wi as rotationType,Ai as scaleType,Ji as sortType,Ui as strokeType,Gi as surfaceType,yt as tempBounds,X as tempMatrix,D as tempPoint,cn as useModule,Sa as version,qi as visibleType};
|
|
1
|
+
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;var r;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(r||(r={}));const i={};function n(t){return void 0===t}function o(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+)?$/;function u(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:c}=Array;function _(t){return t&&"object"==typeof t}function p(t){return _(t)&&!c(t)}function f(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(y(e,t),y(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 y(t[i],e[i],s&&s[i]);s&&i in s?(null===(o=s[i])||void 0===o?void 0:o.constructor)===Object&&y(t[i]={},e[i],s[i]):t[i]=e[i]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{n(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:y}=g;class m{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(!n(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]=n(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(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(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:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],!n(t))){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=n(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}}const{round:x,pow:w,PI:b}=Math,B={within:(t,e,s)=>(_(e)&&(s=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(s)&&t>s&&(t=s),t),fourNumber(t,e){let s;if(c(t))switch(t.length){case 4:s=n(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)),B.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=n(e)?1e12:w(10,e);return-0===(t=x(t*s)/s)?0:t},getScaleData(t,e,s,r){if(r||(r={}),e){const t=(l(e)?e:e.width||0)/s.width,i=(l(e)?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&B.assignScale(r,t);return r},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:v,randColor:t=>`rgba(${v(255)},${v(255)},${v(255)},${t||1})`};function v(t){return Math.round(Math.random()*t)}const k=b/180,C=2*b,O=b/2;function T(){return{x:0,y:0}}function P(){return{x:0,y:0,width:0,height:0}}function S(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:R,cos:L,acos:E,sqrt:I}=Math,{float:M}=B,A={};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 N={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:S,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){Y.toInnerPoint(t,e,A),Y.scaleOfInner(t,A,s,r)},scaleOfInner(t,e,s,r=s){Y.translateInner(t,e.x,e.y),Y.scale(t,s,r),Y.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=L(e*=k),a=R(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){Y.toInnerPoint(t,e,A),Y.rotateOfInner(t,A,s)},rotateOfInner(t,e,s){Y.translateInner(t,e.x,e.y),Y.rotate(t,s),Y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:o}=t;s&&(s*=k,t.a=r+n*s,t.b=i+o*s),e&&(e*=k,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){Y.toInnerPoint(t,e,A),Y.skewOfInner(t,A,s,r)},skewOfInner(t,e,s,r=0){Y.translateInner(t,e.x,e.y),Y.skew(t,s,r),Y.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,o){let{e:a,f:h}=t;if(o&&(a+=o.scrollX,h+=o.scrollY),s||(s=t),n(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=a*e.a+h*e.c+e.e,s.f=a*e.b+h*e.d+e.f},divide(t,e){Y.multiply(t,Y.tempInvert(e))},divideParent(t,e){Y.multiplyParent(t,Y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Y;return Y.copy(e,t),Y.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:o,y:a,scaleX:h,scaleY:l}=e;if(n(i)&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,n=s*k,o=L(n),a=R(n);if(r||i){const e=r*k,s=i*k;t.a=(o+s*-a)*h,t.b=(a+s*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(s=s||r)&&Y.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:n,c:o,d:a,e:h,f:l}=t;let d,u,c,_,p,f=h,g=l;if(n||o){const t=i*a-n*o;if(o&&!r){d=I(i*i+n*n),u=t/d;const e=i/d;c=n>0?E(e):-E(e)}else{u=I(o*o+a*a),d=t/u;const e=o/u;c=O-(a>0?E(-e):-E(e))}const e=M(L(c)),s=R(c);d=M(d),u=M(u),_=e?M((o/u+s)/e/k,9):0,p=e?M((n/d-s)/e/k,9):0,c=M(c/k)}else d=i,u=a,c=_=p=0;return(e=s||e)&&(f+=e.x*i+e.y*o,g+=e.x*n+e.y*a,s||(f-=e.x,g-=e.y)),{x:f,y:g,scaleX:d,scaleY:u,rotation:c,skewX:_,skewY:p}},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=I(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){Y.set(t)}},Y=N,{toInnerPoint:X,toOuterPoint:D}=N,{sin:z,cos:F,abs:j,sqrt:U,atan2:H,min:G,round:V}=Math,q={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=n(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?V(t.x-.5)+.5:V(t.x),t.y=e?V(t.y-.5)+.5:V(t.y)},move(t,e,s){_(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=Q.defaultPoint);const r=F(e*=k),i=z(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}=Q;return Z(s,t),X(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=Q;return Z(s,t),D(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=Q;return Z(s,t),Q.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),X(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){X(e,t,s)},toOuterOf(t,e,s){D(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)=>J(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=j(s-t),n=j(r-e);return U(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>G(J(t,e,s,r),J(s,r,i,n)),getAngle:(t,e)=>$(t,e)/k,getRotation:(t,e,s,r)=>(r||(r=e),Q.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/k),getRadianFrom(t,e,s,r,i,o,a,h){n(a)&&(a=s,h=r);const l=t-s,d=e-r,u=i-a,c=o-h;return Math.atan2(l*c-d*u,l*u+d*c)},getAtan2:(t,e)=>H(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=$(t,e);return(e=r?e:{}).x=t.x+F(i)*s,e.y=t.y+z(i)*s,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){Q.reset(t)}},Q=q,{getDistanceFrom:J,copy:Z,getAtan2:$}=Q;class K{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?q.copy(this,t):q.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new K(this)}move(t,e){return q.move(this,t,e),this}scale(t,e){return q.scale(this,t,e),this}scaleOf(t,e,s){return q.scaleOf(this,t,e,s),this}rotate(t,e){return q.rotate(this,t,e),this}rotateOf(t,e){return q.rotate(this,e,t),this}getRotation(t,e,s){return q.getRotation(this,t,e,s)}toInnerOf(t,e){return q.toInnerOf(this,t,e),this}toOuterOf(t,e){return q.toOuterOf(this,t,e),this}getCenter(t){return new K(q.getCenter(this,t))}getDistance(t){return q.getDistance(this,t)}getDistancePoint(t,e,s){return new K(q.getDistancePoint(this,t,e,s))}getAngle(t){return q.getAngle(this,t)}getAtan2(t){return q.getAtan2(this,t)}reset(){return q.reset(this),this}}const tt=new K;class et{constructor(t,e,s,r,i,n){this.set(t,e,s,r,i,n)}set(t,e,s,r,i,n){return _(t)?N.copy(this,t):N.set(this,t,e,s,r,i,n),this}setWith(t){return N.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 et(this)}translate(t,e){return N.translate(this,t,e),this}translateInner(t,e){return N.translateInner(this,t,e),this}scale(t,e){return N.scale(this,t,e),this}scaleWith(t,e){return N.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return N.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return N.scaleOfInner(this,t,e,s),this}rotate(t){return N.rotate(this,t),this}rotateOfOuter(t,e){return N.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return N.rotateOfInner(this,t,e),this}skew(t,e){return N.skew(this,t,e),this}skewOfOuter(t,e,s){return N.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return N.skewOfInner(this,t,e,s),this}multiply(t){return N.multiply(this,t),this}multiplyParent(t){return N.multiplyParent(this,t),this}divide(t){return N.divide(this,t),this}divideParent(t){return N.divideParent(this,t),this}invert(){return N.invert(this),this}invertWith(){return N.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){N.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){N.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return N.setLayout(this,t,e,s),this}getLayout(t,e,s){return N.getLayout(this,t,e,s)}withScale(t,e){return N.withScale(this,t,e)}reset(){N.reset(this)}}const st=new et,rt={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){it(t,e,s),it(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:it}=rt;var nt,ot;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(nt||(nt={})),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"}(ot||(ot={}));const at=[{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}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,s,r,i,n){const o=lt(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)},getPoint:(t,e,s)=>(s||(s={}),ht.toPoint(t,e,s,!0),s)};function lt(t){return a(t)?at[ot[t]]:t}const{toPoint:dt}=ht,ut={toPoint(t,e,s,r,i,n){dt(t,s,r,i,e,n)}},{tempPointBounds:ct,setPoint:_t,addPoint:pt,toBounds:ft}=rt,{toOuterPoint:gt}=N,{float:yt,fourNumber:mt}=B,{floor:xt,ceil:wt}=Math;let bt,Bt,vt,kt;const Ct={},Ot={},Tt={},Pt={tempBounds:Tt,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(c(s)){const e=mt(s);r?St.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):St.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),St.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),St.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Lt(e,t):e=t,s?(e.offsetX=-(St.maxX(s)-t.x),e.offsetY=-(St.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),St.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,r){r||q.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){q.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(St.copy(Tt,t),St.toOuterOf(Tt,e),Tt),getOuterOf:(t,e)=>(t=Object.assign({},t),St.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 Ct.x=t.x,Ct.y=t.y,gt(e,Ct,Ot),_t(ct,Ot.x,Ot.y),Ct.x=t.x+t.width,gt(e,Ct,Ot),pt(ct,Ot.x,Ot.y),Ct.y=t.y+t.height,gt(e,Ct,Ot),pt(ct,Ot.x,Ot.y),Ct.x=t.x,gt(e,Ct,Ot),pt(ct,Ot.x,Ot.y),ft(ct,s)},toInnerOf(t,e,s){s||(s=t),St.move(s,-e.e,-e.f),St.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,St.getFitScale(t,e));return new et(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),a(r)&&(r=St.getFitScale(t,e,"cover"===r)),Tt.width=i?e.width*=r:e.width*r,Tt.height=i?e.height*=r:e.height*r,ut.toPoint(s,Tt,t,n,!0,!0)},getSpread(t,e,s){const r={};return St.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){St.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){St.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=xt(t.x),t.y=xt(t.y),t.width=e>t.x?wt(t.width+e-t.x):wt(t.width),t.height=s>t.y?wt(t.height+s-t.y):wt(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=yt(t.x,e),t.y=yt(t.y,e),t.width=yt(t.width,e),t.height=yt(t.height,e)},add(t,e,s){bt=t.x+t.width,Bt=t.y+t.height,vt=e.x,kt=e.y,s||(vt+=e.width,kt+=e.height),bt=bt>vt?bt:vt,Bt=Bt>kt?Bt:kt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=bt-t.x,t.height=Bt-t.y},addList(t,e){St.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){St.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){St.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],o):e[o],i&&(i.width||i.height)&&(n?(n=!1,r||Lt(t,i)):Rt(t,i));n&&St.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?_t(ct,t.x,t.y):pt(ct,t.x,t.y)),ft(ct,t)},setPoint(t,e){St.set(t,e.x,e.y)},addPoint(t,e){Rt(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=q.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=q.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=St.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=St.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=St.tempToOuterOf(e,s)),!St.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return bt=r+n,Bt=i+o,vt=t.x+t.width,kt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,bt=bt<vt?bt:vt,Bt=Bt<kt?Bt:kt,n=bt-r,o=Bt-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){St.copy(t,St.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){St.set(t)}},St=Pt,{add:Rt,copy:Lt}=St;class Et{get minX(){return Pt.minX(this)}get minY(){return Pt.minY(this)}get maxX(){return Pt.maxX(this)}get maxY(){return Pt.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return _(t)?Pt.copy(this,t):Pt.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 Et(this)}move(t,e){return Pt.move(this,t,e),this}scale(t,e,s){return Pt.scale(this,t,e,s),this}scaleOf(t,e,s){return Pt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Pt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Pt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Pt.getFitMatrix(this,t,e)}put(t,e,s){Pt.put(this,t,e,s)}spread(t,e){return Pt.spread(this,t,e),this}shrink(t,e){return Pt.shrink(this,t,e),this}ceil(){return Pt.ceil(this),this}unsign(){return Pt.unsign(this),this}float(t){return Pt.float(this,t),this}add(t){return Pt.add(this,t),this}addList(t){return Pt.setList(this,t,!0),this}setList(t){return Pt.setList(this,t),this}addListWithFn(t,e){return Pt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Pt.setListWithFn(this,t,e),this}setPoint(t){return Pt.setPoint(this,t),this}setPoints(t){return Pt.setPoints(this,t),this}addPoint(t){return Pt.addPoint(this,t),this}getPoints(){return Pt.getPoints(this)}hitPoint(t,e){return Pt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Pt.hitRadiusPoint(this,t,e)}hit(t,e){return Pt.hit(this,t,e)}includes(t,e){return Pt.includes(this,t,e)}intersect(t,e){return Pt.intersect(this,t,e),this}getIntersect(t,e){return new Et(Pt.getIntersectData(this,t,e))}isSame(t){return Pt.isSame(this,t)}isEmpty(){return Pt.isEmpty(this)}reset(){Pt.reset(this)}}const It=new Et;class Mt{constructor(t,e,s,r,i,n){_(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 Et(i,e,n||t.width-i-s,o||t.height-e-r)}}const At={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}=B;class Nt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Nt(t)}static set filter(t){this.filterList=Yt(t)}static set exclude(t){this.excludeList=Yt(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"===Nt.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(Xt.enable){if(Xt.filterList.length&&Xt.filterList.every(t=>t!==this.name))return;if(Xt.excludeList.length&&Xt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Xt.enable&&this.warn(...t)}warn(...t){Xt.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 Yt(t){return t?a(t)&&(t=[t]):t=[],t}Nt.filterList=[],Nt.excludeList=[],Nt.showWarn=!0;const Xt=Nt,Dt=Nt.get("RunTime"),zt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,s){const r=e.create(e.RUNTIME);return Ft.currentId=Ft.idMap[r]=s?performance.now():Date.now(),Ft.currentName=Ft.nameMap[r]=t,Ft.nameToIdMap[t]=r,r},end(t,e){const s=Ft.idMap[t],r=Ft.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Ft.idMap[t]=Ft.nameMap[t]=Ft.nameToIdMap[r]=void 0,Dt.log(r,i,"ms")},endOfName(t,e){const s=Ft.nameToIdMap[t];n(s)||Ft.end(s,e)}},Ft=zt,jt=[],Ut={list:{},add(t,...e){this.list[t]=!0,jt.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(()=>jt.forEach(t=>Ut.has(t,!0)));const Ht={editor:t=>Ut.need("editor")},Gt=Nt.get("UICreator"),Vt={list:{},register(t){const{__tag:e}=t.prototype;qt[e]&&Gt.repeat(e),qt[e]=t},get(t,e,s,r,i,o){qt[t]||Gt.error("not register "+t);const a=new qt[t](e);return n(s)||(a.x=s,r&&(a.y=r),i&&(a.width=i),o&&(a.height=o)),a}},{list:qt}=Vt,Qt=Nt.get("EventCreator"),Jt={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(Zt[e]&&Qt.repeat(e),Zt[e]=t)})},changeName(t,e){const s=Zt[t];if(s){const r=Object.keys(s).find(e=>s[e]===t);r&&(s[r]=e,Zt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Zt[t](...e)},{nameList:Zt}=Jt;class $t{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=Ht.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()}}function Kt(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 te(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 ee(t){return(e,s)=>{t||(t=s);const r={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(r.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,r)}}"function"==typeof SuppressedError&&SuppressedError;const se=[];function re(){return(t,e)=>{se.push(e)}}const ie=[];class ne{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||ie)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;se.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){_(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}}Kt([ee("imageSmoothingEnabled")],ne.prototype,"smooth",void 0),Kt([ee("imageSmoothingQuality")],ne.prototype,"smoothLevel",void 0),Kt([ee("globalAlpha")],ne.prototype,"opacity",void 0),Kt([ee()],ne.prototype,"fillStyle",void 0),Kt([ee()],ne.prototype,"strokeStyle",void 0),Kt([ee("lineWidth")],ne.prototype,"strokeWidth",void 0),Kt([ee("lineCap")],ne.prototype,"strokeCap",void 0),Kt([ee("lineJoin")],ne.prototype,"strokeJoin",void 0),Kt([ee("lineDashOffset")],ne.prototype,"dashOffset",void 0),Kt([ee()],ne.prototype,"miterLimit",void 0),Kt([ee()],ne.prototype,"shadowBlur",void 0),Kt([ee()],ne.prototype,"shadowColor",void 0),Kt([ee()],ne.prototype,"shadowOffsetX",void 0),Kt([ee()],ne.prototype,"shadowOffsetY",void 0),Kt([ee()],ne.prototype,"filter",void 0),Kt([ee()],ne.prototype,"font",void 0),Kt([ee()],ne.prototype,"fontKerning",void 0),Kt([ee()],ne.prototype,"fontStretch",void 0),Kt([ee()],ne.prototype,"fontVariantCaps",void 0),Kt([ee()],ne.prototype,"textAlign",void 0),Kt([ee()],ne.prototype,"textBaseline",void 0),Kt([ee()],ne.prototype,"textRendering",void 0),Kt([ee()],ne.prototype,"wordSpacing",void 0),Kt([ee()],ne.prototype,"letterSpacing",void 0),Kt([ee()],ne.prototype,"direction",void 0),Kt([re()],ne.prototype,"setTransform",null),Kt([re()],ne.prototype,"resetTransform",null),Kt([re()],ne.prototype,"getTransform",null),Kt([re()],ne.prototype,"save",null),Kt([re()],ne.prototype,"restore",null),Kt([re()],ne.prototype,"translate",null),Kt([re()],ne.prototype,"scale",null),Kt([re()],ne.prototype,"rotate",null),Kt([re()],ne.prototype,"fill",null),Kt([re()],ne.prototype,"stroke",null),Kt([re()],ne.prototype,"clip",null),Kt([re()],ne.prototype,"fillRect",null),Kt([re()],ne.prototype,"strokeRect",null),Kt([re()],ne.prototype,"clearRect",null),Kt([re()],ne.prototype,"beginPath",null),Kt([re()],ne.prototype,"moveTo",null),Kt([re()],ne.prototype,"lineTo",null),Kt([re()],ne.prototype,"bezierCurveTo",null),Kt([re()],ne.prototype,"quadraticCurveTo",null),Kt([re()],ne.prototype,"closePath",null),Kt([re()],ne.prototype,"arc",null),Kt([re()],ne.prototype,"arcTo",null),Kt([re()],ne.prototype,"ellipse",null),Kt([re()],ne.prototype,"rect",null),Kt([re()],ne.prototype,"roundRect",null),Kt([re()],ne.prototype,"createConicGradient",null),Kt([re()],ne.prototype,"createLinearGradient",null),Kt([re()],ne.prototype,"createPattern",null),Kt([re()],ne.prototype,"createRadialGradient",null),Kt([re()],ne.prototype,"fillText",null),Kt([re()],ne.prototype,"measureText",null),Kt([re()],ne.prototype,"strokeText",null);const{copy:oe,multiplyParent:ae}=N,{round:he}=Math,le={width:1,height:1,pixelRatio:1},de=["width","height","pixelRatio"];class ue extends ne{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(s,r){super(),this.size={},this.worldTransform={},s||(s=le),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;g.copyAttrs(r,t,de),de.forEach(t=>r[t]||(r[t]=1)),this.bounds=new Et(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&&ae(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=he(i.e-.5)+.5,i.f=he(i.f-.5)+.5):(i.e=he(i.e),i.f=he(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,r){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,r)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:r,dashPattern:i,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),n(e.dashPattern)||(i=e.dashPattern),n(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=r,this.dashPattern=i,this.dashOffset=o,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,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,Pt.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(It.x,It.y,It.width,It.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,It.x,It.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(It.x,It.y,It.width,It.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(It.x,It.y,It.width,It.height),s&&(this.blendMode="source-over")}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(It.x,It.y,It.width,It.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(It.x,It.y,It.width,It.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,s){It.set(t),s&&It.intersect(this.bounds),It.scale(this.pixelRatio),e&&It.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):Ht.canvas(Object.assign({},s));return i.save(),t&&(oe(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 ce={creator:{},parse(t,e){},convertToCanvasData(t,e){}},_e={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},pe=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},_e),fe={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},ge={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},ye=Object.assign(Object.assign({},ge),_e),me=pe,xe={};for(let t in me)xe[me[t]]=t;const we={};for(let t in me)we[me[t]]=fe[t];const be={drawRoundRect(t,e,s,r,i,n){const o=B.fourNumber(n,Math.min(r/2,i/2)),a=e+r,h=s+i;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(a,s,a,h,o[1]):t.lineTo(a,s),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,s,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,s,a,s,o[0]):t.lineTo(e,s)}},{sin:Be,cos:ve,atan2:ke,ceil:Ce,abs:Oe,PI:Te,sqrt:Pe,pow:Se}=Math,{setPoint:Re,addPoint:Le}=rt,{set:Ee,toNumberPoints:Ie}=q,{M:Me,L:Ae,C:We,Q:Ne,Z:Ye}=pe,Xe={},De={points(t,e,s,r){let i=Ie(e);if(t.push(Me,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=Pe(Se(o-e,2)+Se(a-n,2)),f=Pe(Se(h-o,2)+Se(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(Ne,d,u,o,a):t.push(We,c,_,d,u,o,a),c=o+f*h,_=a+f*l);r||t.push(Ne,c,_,i[y-2],i[y-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(Ae,i[e],i[e+1]);r&&t.push(Ye)},rect(t,e,s,r,i){ce.creator.path=t,ce.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){ce.creator.path=[],be.drawRoundRect(ce.creator,e,s,r,i,n),t.push(...ce.convertToCanvasData(ce.creator.path,!0))},arcTo(t,e,s,r,i,n,o,a,h,l,d){const u=r-e,c=i-s,_=n-r,p=o-i;let f=ke(c,u),g=ke(p,_),y=g-f;if(y<0&&(y+=C),y===Te||Oe(u+c)<1e-12||Oe(_+p)<1e-12)return t&&t.push(Ae,r,i),h&&(Re(h,e,s),Le(h,r,i)),d&&Ee(d,e,s),void(l&&Ee(l,r,i));const m=u*p-_*c<0,x=m?-1:1,w=a/ve(y/2),b=r+w*ve(f+y/2+O*x),B=i+w*Be(f+y/2+O*x);return f-=O*x,g-=O*x,je(t,b,B,a,a,0,f/k,g/k,m,h,l,d)},arc:(t,e,s,r,i,n,o,a,h,l)=>je(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,h,l,d,u){const c=n*k,_=Be(c),p=ve(c);let f=o*k,g=a*k;f>Te&&(f-=C),g<0&&(g+=C);let y=g-f;y<0?y+=C:y>C&&(y-=C),h&&(y-=C);const m=Ce(Oe(y/O)),x=y/m,w=Be(x/4),b=8/3*w*w/Be(x/2);g=f+x;let B,v,T,P,S,R,L,E,I=ve(f),M=Be(f),A=T=p*r*I-_*i*M,W=P=_*r*I+p*i*M,N=e+T,Y=s+P;t&&t.push(t.length?Ae:Me,N,Y),l&&Re(l,N,Y),u&&Ee(u,N,Y);for(let n=0;n<m;n++)B=ve(g),v=Be(g),T=p*r*B-_*i*v,P=_*r*B+p*i*v,S=e+A-b*(p*r*M+_*i*I),R=s+W-b*(_*r*M-p*i*I),L=e+T+b*(p*r*v+_*i*B),E=s+P+b*(_*r*v-p*i*B),t&&t.push(We,S,R,L,E,e+T,s+P),l&&Fe(e+A,s+W,S,R,L,E,e+T,s+P,l,!0),A=T,W=P,I=B,M=v,f=g,g+=x;d&&Ee(d,e+T,s+P)},quadraticCurveTo(t,e,s,r,i,n,o){t.push(We,(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){Fe(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,B=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=r,b=n,B=a),u=-3*x+9*w-9*b+3*B,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?Le(h,t,e):Re(h,t,e),Le(h,o,a);for(let l=0,u=d.length;l<u;l++)ze(d[l],t,e,s,r,i,n,o,a,Xe),Le(h,Xe.x,Xe.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 ze(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:ze,toTwoPointBounds:Fe,ellipse:je}=De,{sin:Ue,cos:He,sqrt:Ge,atan2:Ve}=Math,{ellipse:qe}=De,Qe={ellipticalArc(e,s,r,i,n,o,a,h,l,d,u){const c=(l-s)/2,_=(d-r)/2,p=o*k,f=Ue(p),g=He(p),y=-g*c-f*_,m=-g*_+f*c,x=i*i,w=n*n,b=m*m,B=y*y,v=x*w-x*b-w*B;let O=0;if(v<0){const t=Ge(1-v/(x*w));i*=t,n*=t}else O=(a===h?-1:1)*Ge(v/(x*b+w*B));const T=O*i*m/n,P=-O*n*y/i,S=Ve((m-P)/n,(y-T)/i),R=Ve((-m-P)/n,(-y-T)/i);let L=R-S;0===h&&L>0?L-=C:1===h&&L<0&&(L+=C);const E=s+c+g*T-f*P,I=r+_+f*T+g*P,M=L<0?1:0;u||t.ellipseToCurve?qe(e,E,I,i,n,o,S/k,R/k,M):i!==n||o?e.push(pe.G,E,I,i,n,o,S/k,R/k,M):e.push(pe.O,E,I,i,S/k,R/k,M)}},{M:Je,m:Ze,L:$e,l:Ke,H:ts,h:es,V:ss,v:rs,C:is,c:ns,S:os,s:as,Q:hs,q:ls,T:ds,t:us,A:cs,a:_s,Z:ps,z:fs,N:gs,D:ys,X:ms,G:xs,F:ws,O:bs,P:Bs,U:vs}=pe,{rect:ks,roundRect:Cs,arcTo:Os,arc:Ts,ellipse:Ps,quadraticCurveTo:Ss}=De,{ellipticalArc:Rs}=Qe,Ls=Nt.get("PathConvert"),Es={},Is={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,a="";for(;n<o;){r=t[n],s=we[r],a+=r===i?" ":xe[r];for(let r=1;r<s;r++)a+=B.float(t[n+r],e),r===s-1||(a+=" ");i=r,n+=s}return a},parse(t,e){let s,r,i,n="";const o=[],a=e?ye:ge;for(let e=0,h=t.length;e<h;e++)r=t[e],At[r]?("."===r&&(Ms.dot&&(As(o,n),n=""),Ms.dot++),"0"===n&&"."!==r&&(As(o,n),n=""),n+=r):pe[r]?(n&&(As(o,n),n=""),Ms.name=pe[r],Ms.length=fe[r],Ms.index=0,As(o,Ms.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?n+=r:(n&&As(o,n),n=r):n&&(As(o,n),n=""),i=r;return n&&As(o,n),s?Is.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 Ze: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 es:t[u+1]+=a;case ts:a=t[u+1],_.push($e,a,h),u+=2;break;case rs:t[u+1]+=h;case ss:h=t[u+1],_.push($e,a,h),u+=2;break;case Ke:t[u+1]+=a,t[u+2]+=h;case $e:a=t[u+1],h=t[u+2],_.push($e,a,h),u+=3;break;case as:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=os;case os:o=n===is||n===os,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(is,l,d,s,r,a,h),u+=5;break;case ns: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=is;case is:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],_.push(is,t[u+1],t[u+2],s,r,a,h),u+=7;break;case us:t[u+1]+=a,t[u+2]+=h,i=ds;case ds:o=n===hs||n===ds,s=o?2*a-s:t[u+1],r=o?2*h-r:t[u+2],e?Ss(_,a,h,s,r,t[u+1],t[u+2]):_.push(hs,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case ls:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=hs;case hs:s=t[u+1],r=t[u+2],e?Ss(_,a,h,s,r,t[u+3],t[u+4]):_.push(hs,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case _s:t[u+6]+=a,t[u+7]+=h;case cs:Rs(_,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 fs:case ps:_.push(ps),u++;break;case gs:a=t[u+1],h=t[u+2],e?ks(_,a,h,t[u+3],t[u+4]):Ws(_,t,u,5),u+=5;break;case ys:a=t[u+1],h=t[u+2],e?Cs(_,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):Ws(_,t,u,9),u+=9;break;case ms:a=t[u+1],h=t[u+2],e?Cs(_,a,h,t[u+3],t[u+4],t[u+5]):Ws(_,t,u,6),u+=6;break;case xs:Ps(e?_:Ws(_,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,Es),a=Es.x,h=Es.y,u+=9;break;case ws:e?Ps(_,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):Ws(_,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case bs:Ts(e?_:Ws(_,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,Es),a=Es.x,h=Es.y,u+=7;break;case Bs:e?Ts(_,t[u+1],t[u+2],t[u+3],0,360,!1):Ws(_,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case vs:Os(e?_:Ws(_,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,Es),a=Es.x,h=Es.y,u+=6;break;default:return Ls.error(`command: ${i} [index:${u}]`,t),_}n=i}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(Je,t.x,t.y);break;case"L":e.push($e,t.x,t.y);break;case"C":e.push(is,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(hs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ps)}}),e},copyData(t,e,s,r){for(let i=s,n=s+r;i<n;i++)t.push(e[i])},pushData(t,e){Ms.index===Ms.length&&(Ms.index=1,t.push(Ms.name)),t.push(Number(e)),Ms.index++,Ms.dot=0}},{current:Ms,pushData:As,copyData:Ws}=Is,{M:Ns,L:Ys,C:Xs,Q:Ds,Z:zs,N:Fs,D:js,X:Us,G:Hs,F:Gs,O:Vs,P:qs,U:Qs}=pe,{getMinDistanceFrom:Js,getRadianFrom:Zs}=q,{tan:$s,min:Ks,abs:tr}=Math,er={},sr={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ns,e,s)},lineTo(t,e,s){t.push(Ys,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(Xs,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(Ds,e,s,r,i)},closePath(t){t.push(zs)},rect(t,e,s,r,i){t.push(Fs,e,s,r,i)},roundRect(t,e,s,r,i,n){if(l(n))t.push(Us,e,s,r,i,n);else{const o=B.fourNumber(n);o?t.push(js,e,s,r,i,...o):t.push(Fs,e,s,r,i)}},ellipse(t,e,s,r,i,n,a,h,l){o(n)?t.push(Gs,e,s,r,i):(o(a)&&(a=0),o(h)&&(h=360),t.push(Hs,e,s,r,i,n,a,h,l?1:0))},arc(t,e,s,r,i,n,a){o(i)?t.push(qs,e,s,r):(o(n)&&(n=360),t.push(Vs,e,s,r,i,n,a?1:0))},arcTo(t,e,s,r,i,o,a,h){if(!n(a)){const t=Js(a,h,e,s,r,i);o=Ks(o,Ks(t/2,t/2*tr($s(Zs(a,h,e,s,r,i)/2))))}t.push(Qs,e,s,r,i,o)},drawEllipse(t,e,s,r,i,n,a,h,l){De.ellipse(null,e,s,r,i,o(n)?0:n,o(a)?0:a,o(h)?360:h,l,null,null,er),t.push(Ns,er.x,er.y),rr(t,e,s,r,i,n,a,h,l)},drawArc(t,e,s,r,i,n,a){De.arc(null,e,s,r,o(i)?0:i,o(n)?360:n,a,null,null,er),t.push(Ns,er.x,er.y),ir(t,e,s,r,i,n,a)},drawPoints(t,e,s,r){De.points(t,e,s,r)}},{ellipse:rr,arc:ir}=sr,{moveTo:nr,lineTo:or,quadraticCurveTo:ar,bezierCurveTo:hr,closePath:lr,beginPath:dr,rect:ur,roundRect:cr,ellipse:_r,arc:pr,arcTo:fr,drawEllipse:gr,drawArc:yr,drawPoints:mr}=sr;class xr{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?ce.parse(t):t:[],this}beginPath(){return dr(this.__path),this.paint(),this}moveTo(t,e){return nr(this.__path,t,e),this.paint(),this}lineTo(t,e){return or(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,n){return hr(this.__path,t,e,s,r,i,n),this.paint(),this}quadraticCurveTo(t,e,s,r){return ar(this.__path,t,e,s,r),this.paint(),this}closePath(){return lr(this.__path),this.paint(),this}rect(t,e,s,r){return ur(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return cr(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,n,o,a){return _r(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}arc(t,e,s,r,i,n){return pr(this.__path,t,e,s,r,i,n),this.paint(),this}arcTo(t,e,s,r,i){return fr(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,n,o,a){return gr(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}drawArc(t,e,s,r,i,n){return yr(this.__path,t,e,s,r,i,n),this.paint(),this}drawPoints(t,e,s){return mr(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:wr,L:br,C:Br,Q:vr,Z:kr,N:Cr,D:Or,X:Tr,G:Pr,F:Sr,O:Rr,P:Lr,U:Er}=pe,Ir=Nt.get("PathDrawer"),Mr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case wr:t.moveTo(e[r+1],e[r+2]),r+=3;break;case br:t.lineTo(e[r+1],e[r+2]),r+=3;break;case Br:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case vr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case kr:t.closePath(),r+=1;break;case Cr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Or: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 Tr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case Pr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*k,e[r+6]*k,e[r+7]*k,e[r+8]),r+=9;break;case Sr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,C,!1),r+=5;break;case Rr:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*k,e[r+5]*k,e[r+6]),r+=7;break;case Lr:t.arc(e[r+1],e[r+2],e[r+3],0,C,!1),r+=4;break;case Er:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void Ir.error(`command: ${s} [index:${r}]`,e)}}},{M:Ar,L:Wr,C:Nr,Q:Yr,Z:Xr,N:Dr,D:zr,X:Fr,G:jr,F:Ur,O:Hr,P:Gr,U:Vr}=pe,{toTwoPointBounds:qr,toTwoPointBoundsByQuadraticCurve:Qr,arcTo:Jr,arc:Zr,ellipse:$r}=De,{addPointBounds:Kr,copy:ti,addPoint:ei,setPoint:si,addBounds:ri,toBounds:ii}=rt,ni=Nt.get("PathBounds");let oi,ai,hi;const li={},di={},ui={},ci={toBounds(t,e){ci.toTwoPointBounds(t,di),ii(di,e)},toTwoPointBounds(t,e){if(!t||!t.length)return si(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===Xr||o===Nr||o===Yr?si(e,h,l):si(e,t[a+1],t[a+2])),o){case Ar:case Wr:h=t[a+1],l=t[a+2],ei(e,h,l),a+=3;break;case Nr:i=t[a+5],n=t[a+6],qr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,n,li),Kr(e,li),h=i,l=n,a+=7;break;case Yr:s=t[a+1],r=t[a+2],i=t[a+3],n=t[a+4],Qr(h,l,s,r,i,n,li),Kr(e,li),h=i,l=n,a+=5;break;case Xr:a+=1;break;case Dr:h=t[a+1],l=t[a+2],ri(e,h,l,t[a+3],t[a+4]),a+=5;break;case zr:case Fr:h=t[a+1],l=t[a+2],ri(e,h,l,t[a+3],t[a+4]),a+=o===zr?9:6;break;case jr:$r(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],li,ui),0===a?ti(e,li):Kr(e,li),h=ui.x,l=ui.y,a+=9;break;case Ur:h=t[a+1],l=t[a+2],ai=t[a+3],hi=t[a+4],ri(e,h-ai,l-hi,2*ai,2*hi),h+=ai,a+=5;break;case Hr:Zr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],li,ui),0===a?ti(e,li):Kr(e,li),h=ui.x,l=ui.y,a+=7;break;case Gr:h=t[a+1],l=t[a+2],oi=t[a+3],ri(e,h-oi,l-oi,2*oi,2*oi),h+=oi,a+=4;break;case Vr:Jr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],li,ui),0===a?ti(e,li):Kr(e,li),h=ui.x,l=ui.y,a+=6;break;default:return void ni.error(`command: ${o} [index:${a}]`,t)}}},{M:_i,L:pi,Z:fi}=pe,{getCenterX:gi,getCenterY:yi}=q,{arcTo:mi}=sr,xi={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 _i:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===pi?(u=t[o+1],c=t[o+2],g.push(_i,gi(l,u),yi(d,c))):g.push(_i,l,d);break;case pi:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case pi:mi(g,a,h,t[o+1],t[o+2],e,_,p);break;case fi:mi(g,a,h,l,d,e,_,p);break;default:g.push(pi,a,h)}_=a,p=h;break;case fi:i!==fi&&(mi(g,l,d,u,c,e,_,p),g.push(fi)),o+=1;break;default:n=we[r];for(let e=0;e<n;e++)g.push(t[o+e]);o+=n}i=r}return r!==fi&&(g[1]=l,g[2]=d),g}};ce.creator=new xr,ce.parse=Is.parse,ce.convertToCanvasData=Is.toCanvasData;const wi=new xr,{drawRoundRect:bi}=be;function Bi(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){bi(this,t,e,s,r,i)})}(t)}const vi={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=ki.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{}}}},ki=vi;ki.alphaPixelTypes.forEach(t=>ki.upperCaseTypeMap[t]=t.toUpperCase());const Ci=Nt.get("TaskProcessor");class Oi{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return te(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Ci.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Ti{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&&g.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const a=new Oi(t);return a.parent=this,l(e)?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(a.time=i),!1===r&&(a.parallel=!1),n(o)?this.push(a,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))},o)),this.isComplete=!1,a}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.running)return;r<this.total&&(t=this.list[r],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Pi=Nt.get("Resource"),Si={tasker:new Ti,map:{},get isComplete(){return Ri.tasker.isComplete},set(t,e){Ri.map[t]&&Pi.repeat(t),Ri.map[t]=e},get:t=>Ri.map[t],remove(t){const e=Ri.map[t];e&&(e.destroy&&e.destroy(),delete Ri.map[t])},loadImage(t,e){return new Promise((s,r)=>{const i=this.setImage(t,t,e);i.load(()=>s(i),t=>r(t))})},setImage(t,e,s){let r;return a(e)?r={url:e}:e.url||(r={url:t,view:e}),r&&(s&&(r.format=s),e=Ht.image(r)),Ri.set(t,e),e},destroy(){Ri.map={}}},Ri=Si,Li={maxRecycled:10,recycledList:[],patternTasker:new Ti,get(t){let e=Si.get(t.url);return e||Si.set(t.url,e=Ht.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Ei.recycledList.push(t)})},clearRecycled(){const t=Ei.recycledList;t.length>Ei.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Si.remove(t.url)),t.length=0)},hasAlphaPixel:t=>vi.alphaPixelTypes.some(e=>Ei.isFormat(e,t)),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+vi.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+vi.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Ei.recycledList=[]}},Ei=Li,{IMAGE:Ii,create:Mi}=e,{floor:Ai,max:Wi}=Math;class Ni{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Mi(Ii),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Li.isFormat("svg",t)&&(this.isSVG=!0),Li.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,s){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:s}=t.origin,r=this.config.showProgress&&s&&this.onProgress.bind(this);r&&(e=s),Si.tasker.add(()=>te(this,void 0,void 0,function*(){return yield e(this.url,r).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,s,r,i,n,o){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const a=t.origin.createCanvas(Wi(Ai(e+(n||0)),1),Wi(Ai(s+(o||0)),1)),h=a.getContext("2d");return r&&(h.globalAlpha=r),h.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(e,s,r,i){const n=t.canvas.createPattern(e,s);try{r&&n.setTransform&&(n.setTransform(r),r=void 0)}catch(t){}return i&&g.stintSet(i,"transform",r),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Yi(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function Xi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Di(t,e){const s="_"+t;return{get(){const t=this[s];return n(t)?e:t},set(t){this[s]=t}}}function zi(t,e){return(s,r)=>ji(s,r,t,e&&e(r))}function Fi(t){return t}function ji(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Yi(t,e,Object.assign(i,r||{})),yn(t,e,s)}function Ui(t){return zi(t)}function Hi(t,e){return zi(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Gi(t){return zi(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Zi(this))}}))}function Vi(t,e){return zi(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function qi(t,e){return zi(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Qi(t,e){return zi(t,t=>({set(s){this.__setAttr(t,s,e)&&Zi(this)}}))}function Ji(t){return zi(t,t=>({set(e){this.__setAttr(t,e)&&(Zi(this),this.__.__removeNaturalSize())}}))}function Zi(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function $i(t){return zi(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Zi(this)}}))}const Ki=Qi;function tn(t,e){return zi(t,t=>({set(s){this.__setAttr(t,s)&&(en(this),e&&(this.__.__useStroke=!0))}}))}function en(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Zi(t)}const sn=tn;function rn(t){return zi(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function nn(t){return zi(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function on(t){return zi(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&hn(this)}}))}function an(t){return zi(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>ln(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");ln(this,t,e,s),this.mask&&hn(this)}}))}function hn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function ln(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||Zi(t))}function dn(t){return zi(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function un(t){return zi(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function cn(t){return zi(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function _n(t){return zi(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Nt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function pn(t){return zi(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function fn(t){return(e,s)=>{Yi(e,"__DataProcessor",{get:()=>t})}}function gn(t){return(e,s)=>{Yi(e,"__LayoutProcessor",{get:()=>t})}}function yn(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Di(e,s);if(n(s))a.get=function(){return this[i]};else if("function"==typeof s)a.get=function(){let t=this[i];return void 0===t?s(this.__leaf):t};else if(_(s)){const t=f(s);a.get=function(){let e=this[i];return void 0===e?this[i]=t?{}:g.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalWidth,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&r.children.length?r.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalHeight,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&r.children.length?r.boxBounds.height:s}return t});let l,d=r;for(;!l&&d;)l=Xi(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),r[o]&&(a.set=r[o],delete r[o]),Yi(r,e,a)}const mn=new Nt("rewrite"),xn=[],wn=["destroy","constructor"];function bn(t){return(e,s)=>{xn.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Bn(){return t=>{vn()}}function vn(t){xn.length&&(xn.forEach(e=>{t&&mn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),xn.length=0)}function kn(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach(r=>{if(!(wn.includes(r)||e&&e.includes(r)))if(t.prototype){Xi(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]})}}function Cn(){return t=>{Vt.register(t)}}function On(){return t=>{Jt.register(t)}}setTimeout(()=>vn(!0));const{copy:Tn,toInnerPoint:Pn,toOuterPoint:Sn,scaleOfOuter:Rn,rotateOfOuter:Ln,skewOfOuter:En,multiplyParent:In,divideParent:Mn,getLayout:An}=N,Wn={},{round:Nn}=Math,Yn={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),zn(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)Dn(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Fn(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Fn(t),t.__updateChange()},updateAllChange(t){if(Un(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)jn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,s,r,i,n,o){i||(i=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?s.copyWorldByReset(r,i,e.__nowWorld,n,o):s.copyWorldToInner(r,i,e.__layout.renderBounds,n)},moveWorld(t,e,s=0,r,i){const n=_(e)?Object.assign({},e):{x:e,y:s};r?Sn(t.localTransform,n,n,!0):t.parent&&Pn(t.parent.worldTransform,n,n,!0),Xn.moveLocal(t,n.x,n.y,i)},moveLocal(t,e,s=0,r){_(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Nn(e),s=Nn(s)),r?t.animate({x:e,y:s},r):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,r,i,n){Xn.zoomOfLocal(t,Hn(t,e),s,r,i,n)},zoomOfLocal(t,e,s,r=s,i,n){const o=t.__localMatrix;if(l(r)||(r&&(n=r),r=s),Tn(Wn,o),Rn(Wn,e,s,r),t.origin||t.around)Xn.setTransform(t,Wn,i,n);else{const e=t.x+Wn.e-o.e,a=t.y+Wn.f-o.f;n&&!i?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*r},n):(t.x=e,t.y=a,t.scaleResize(s,r,!0!==i))}},rotateOfWorld(t,e,s,r){Xn.rotateOfLocal(t,Hn(t,e),s,r)},rotateOfLocal(t,e,s,r){const i=t.__localMatrix;Tn(Wn,i),Ln(Wn,e,s),t.origin||t.around?Xn.setTransform(t,Wn,!1,r):t.set({x:t.x+Wn.e-i.e,y:t.y+Wn.f-i.f,rotation:B.formatRotation(t.rotation+s)},r)},skewOfWorld(t,e,s,r,i,n){Xn.skewOfLocal(t,Hn(t,e),s,r,i,n)},skewOfLocal(t,e,s,r=0,i,n){Tn(Wn,t.__localMatrix),En(Wn,e,s,r),Xn.setTransform(t,Wn,i,n)},transformWorld(t,e,s,r){Tn(Wn,t.worldTransform),In(Wn,e),t.parent&&Mn(Wn,t.parent.worldTransform),Xn.setTransform(t,Wn,s,r)},transform(t,e,s,r){Tn(Wn,t.localTransform),In(Wn,e),Xn.setTransform(t,Wn,s,r)},setTransform(t,e,s,r){const i=t.__,n=i.origin&&Xn.getInnerOrigin(t,i.origin),o=An(e,n,i.around&&Xn.getInnerOrigin(t,i.around));if(s){const e=o.scaleX/t.scaleX,s=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){Pt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const r=Xn.getInnerOrigin(t,i.origin);q.move(o,n.x-r.x,n.y-r.y)}t.set(o),t.scaleResize(e,s,!1)}else t.set(o,r)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},r="x"===e?1:-1;return Rn(s,Xn.getLocalOrigin(t,"center"),-1*r,1*r),s},getLocalOrigin:(t,e)=>q.tempToOuterOf(Xn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return ht.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Tn(Wn,t.worldTransform),Mn(Wn,e.worldTransform),s?Wn:Object.assign({},Wn)),drop(t,e,s,r){t.setTransform(Xn.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,s,r=.3){if(s.x||s.y)if(Math.abs(s.x)<1&&Math.abs(s.y)<1)e.move(s);else{const i=s.x*r,n=s.y*r;s.x-=i,s.y-=n,e.move(i,n),t.requestRender(()=>Xn.animateMove(e,s,r))}}},Xn=Yn,{updateAllMatrix:Dn,updateMatrix:zn,updateAllWorldOpacity:Fn,updateAllChange:jn,updateChange:Un}=Xn;function Hn(t,e){return t.__layout.update(),t.parent?q.tempToInnerOf(e,t.parent.__world):e}const Gn={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>qn(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>qn(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>qn(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let Vn;function qn(t,e){return e||(Vn=0),t.__.mask&&(Vn=1),Vn<0?null:(Vn&&(Vn=-1),!0)}const{updateBounds:Qn}=Yn,Jn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.add(t),Zn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&n(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)$n(e[t],e)},updateBounds(t,e){const s=[t];$n(t,s),Kn(s,e)},updateBoundsByBranchStack(t,e){let s,r;for(let i=t.length-1;i>-1;i--){s=t[i],r=s.children;for(let t=0,e=r.length;t<e;t++)Qn(r[t]);e&&e===s||Qn(s)}}},{pushAllChildBranch:Zn,pushAllBranchStack:$n,updateBoundsByBranchStack:Kn}=Jn,to={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:eo,updateBounds:so}=Yn,{toOuterOf:ro,getPoints:io,copy:no}=Pt,oo="_localContentBounds",ao="_worldContentBounds",ho="_worldBoxBounds",lo="_worldStrokeBounds";class uo{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return ro(this.contentBounds,this.leaf.__localMatrix,this[oo]||(this[oo]={})),this[oo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ro(this.contentBounds,this.leaf.__world,this[ao]||(this[ao]={})),this[ao]}get worldBoxBounds(){return ro(this.boxBounds,this.leaf.__world,this[ho]||(this[ho]={})),this[ho]}get worldStrokeBounds(){return ro(this.strokeBounds,this.leaf.__world,this[lo]||(this[lo]={})),this[lo]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:s}=e;if(e.isApp)return so(e);if(s)s.ready?s.watcher.changed&&s.layouter.layout():s.start();else{let s=e;for(;s.parent&&!s.parent.leafer;)s=s.parent;const r=s;if(r.__fullLayouting)return;r.__fullLayouting=!0,t.layout(r),delete r.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return N.defaultMatrix;case"page":t=e.zoomLayer;default:return eo(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Et(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,n,o,a=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(a),n=r.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=r.__;o={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},i=r.getLocalPointByInner(a);break;case"inner":i=a,n=N.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(a,e),n=eo(r,e,!0)}if(o||(o=N.getLayout(n)),no(o,a),q.copy(o,i),s){const{scaleX:t,scaleY:e}=o,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(o.scaleX/=s,o.scaleY/=r,o.width*=s,o.height*=r)}return o}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=io(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return n(i)||r.forEach(t=>s.innerToWorld(t,null,!1,i)),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:r},this._localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:r},this._localRenderBounds={x:t,y:e,width:s,height:r}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class co{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class _o extends co{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}_o.ADD="child.add",_o.REMOVE="child.remove",_o.CREATED="created",_o.MOUNTED="mounted",_o.UNMOUNTED="unmounted",_o.DESTROY="destroy";class po extends co{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}po.CHANGE="property.change",po.LEAFER_CHANGE="property.leafer_change";class fo extends co{constructor(t,e){super(t),Object.assign(this,e)}}fo.LOAD="image.load",fo.LOADED="image.loaded",fo.ERROR="image.error";class go extends co{static checkHas(t,e,s){"on"===s?e===wo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(yo)||t.hasEvent(mo)||t.hasEvent(xo),t.__hasWorldEvent=t.hasEvent(wo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(yo,t),"inner"===e&&t.emit(mo,t)),t.emit(xo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(wo,this)}}go.RESIZE="bounds.resize",go.INNER="bounds.inner",go.LOCAL="bounds.local",go.WORLD="bounds.world";const{RESIZE:yo,INNER:mo,LOCAL:xo,WORLD:wo}=go,bo={};[yo,mo,xo,wo].forEach(t=>bo[t]=1);class Bo extends co{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){_(t)?(super(Bo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Bo.RESIZE="resize";class vo extends co{constructor(t,e){super(t),this.data=e}}vo.REQUEST="watch.request",vo.DATA="watch.data";class ko extends co{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}ko.REQUEST="layout.request",ko.START="layout.start",ko.BEFORE="layout.before",ko.LAYOUT="layout",ko.AFTER="layout.after",ko.AGAIN="layout.again",ko.END="layout.end";class Co extends co{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}Co.REQUEST="render.request",Co.CHILD_START="render.child_start",Co.CHILD_END="render.child_end",Co.START="render.start",Co.BEFORE="render.before",Co.RENDER="render",Co.AFTER="render.after",Co.AGAIN="render.again",Co.END="render.end",Co.NEXT="render.next";class Oo extends co{}Oo.START="leafer.start",Oo.BEFORE_READY="leafer.before_ready",Oo.READY="leafer.ready",Oo.AFTER_READY="leafer.after_ready",Oo.VIEW_READY="leafer.view_ready",Oo.VIEW_COMPLETED="leafer.view_completed",Oo.STOP="leafer.stop",Oo.RESTART="leafer.restart",Oo.END="leafer.end",Oo.TRANSFORM="leafer.transform",Oo.MOVE="leafer.move",Oo.SCALE="leafer.scale",Oo.ROTATE="leafer.rotate",Oo.SKEW="leafer.skew";const{MOVE:To,SCALE:Po,ROTATE:So,SKEW:Ro}=Oo,Lo={x:To,y:To,scaleX:Po,scaleY:Po,rotation:So,skewX:Ro,skewY:Ro},Eo={};class Io{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(c(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)c(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let r,i,n;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const o=Mo(this,r,!0),h=a(t)?t.split(" "):t,l=i?{listener:e,once:i}:{listener:e};h.forEach(t=>{t&&(n=o[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):o[t]=[l],bo[t]&&go.checkHas(this,t,"on"))})}off(t,e,s){if(t){const r=a(t)?t.split(" "):t;if(e){let t,i,n;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const o=Mo(this,t);r.forEach(t=>{t&&(i=o[t],i&&(n=i.findIndex(t=>t.listener===e),n>-1&&i.splice(n,1),i.length||delete o[t],bo[t]&&go.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,r){return e?this.on(t,s?e=e.bind(s):e,r):c(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:r}}off_(t){if(!t)return;const e=c(t)?t:[t];e.forEach(t=>{t.listener?t.current.off(t.type,t.listener,t.options):c(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3]))}),e.length=0}once(t,e,s,r){if(!e)return c(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(s)?e=e.bind(s):r=s,this.on(t,e,{once:!0,capture:r})}emit(t,e,s){!e&&Jt.has(t)&&(e=Jt.get(t,{type:t,target:this,current:this}));const r=Mo(this,s)[t];if(r){let i;for(let n=0,o=r.length;n<o&&!((i=r[n])&&(i.listener(e),i.once&&(this.off(t,i.listener,s),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],o=r&&r[t];return!!(n(e)?i||o:e?o:i)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Mo(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Eo)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Eo)}}const{on:Ao,on_:Wo,off:No,off_:Yo,once:Xo,emit:Do,emitEvent:zo,hasEvent:Fo,destroy:jo}=Io.prototype,Uo={on:Ao,on_:Wo,off:No,off_:Yo,once:Xo,emit:Do,emitEvent:zo,hasEvent:Fo,destroyEventer:jo},Ho=Nt.get("setAttr"),Go={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!s||h(e)||n(e)||(Ho.warn(this.innerName,t,e),e=void 0),_(e)||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=po,i=new po(s,this,t,r,e);if(this.isLeafer){this.emitEvent(new po(po.LEAFER_CHANGE,this,t,r,e));const s=Lo[t];s&&(this.emitEvent(new Oo(s,this)),this.emitEvent(new Oo(Oo.TRANSFORM,this)))}else this.hasEvent(s)&&this.emitEvent(i);return this.leafer.emitEvent(i),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||n(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Vo,multiplyParent:qo,translateInner:Qo,defaultWorld:Jo}=N,{toPoint:Zo,tempPoint:$o}=ht,Ko={__updateWorldMatrix(){const{parent:t,__layout:e}=this;qo(this.__local||e,t?t.__world:Jo,this.__world,!!e.affectScaleOrRotation,this.__,t&&(t.scrollY||t.scrollX)&&t.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Vo(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(Zo(s.around||s.origin,t.boxBounds,$o),Qo(e,-$o.x,-$o.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ta,updateAllMatrix:ea}=Yn,{updateBounds:sa}=Jn,{toOuterOf:ra,copyAndSpread:ia,copy:na}=Pt,{toBounds:oa}=ci,aa={__updateWorldBounds(){const t=this.__layout;ra(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&go.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&go.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ra(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ra(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ra(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?oa(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ea(this),sa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ea(this),sa(this,this))):ta(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;ia(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?ia(t.renderBounds,t.boxBounds,t.renderSpread):na(t.renderBounds,t.strokeBounds)}},ha={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!0,!0);this.__draw(r,e,t),Yn.copyCanvasByWorld(this,t,r,this.__nowWorld,s.__blendMode,!0),r.recycle(this.__nowWorld)}else this.__draw(t,e);Nt.showBounds&&Nt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:la}=Gn,da={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0),s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e);const i=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(r,i,i,s.__blendMode,!0),r.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)la(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)la(s[r],e)||s[r].__clip(t,e)}}},ua={},{LEAF:ca,create:_a}=e,{toInnerPoint:pa,toOuterPoint:fa,multiplyParent:ga}=N,{toOuterOf:ya}=Pt,{copy:ma,move:xa}=q,{moveLocal:wa,zoomOfLocal:ba,rotateOfLocal:Ba,skewOfLocal:va,moveWorld:ka,zoomOfWorld:Ca,rotateOfWorld:Oa,skewOfWorld:Ta,transform:Pa,transformWorld:Sa,setTransform:Ra,getFlipTransform:La,getLocalOrigin:Ea,getRelativeWorld:Ia,drop:Ma}=Yn;let Aa=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return m}get __LayoutProcessor(){return uo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=_a(ca),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(_o.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(_o.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(_o.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(_o.MOUNTED)):this.__emitLifeEvent(_o.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return ga(s,t.matrix,e,void 0,s),ya(this.__layout.renderBounds,e,e),e.half!==s.half&&(e.half=s.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:s,scaleY:r}=Li.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),r<0&&(r=-r)),(!0===e||"zoom-in"===e&&s>1&&r>1)&&(s=r=1),ua.scaleX=s,ua.scaleY=r,ua}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const r=e?Ia(this,e):this.worldTransform,i=s?t:{};return ya(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&ma(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&ma(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),pa(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){fa(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,r){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,r),null,null,!0)}getBoxPointByInner(t,e,s,r){const i=r?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return xa(i,-n,-o),i}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByBox(t,e,s,r){const i=r?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return xa(i,n,o),i}getInnerPointByLocal(t,e,s,r){return this.getInnerPoint(t,this.parent,s,r)}getLocalPoint(t,e,s,r){const i=r?t:{};return this.worldToLocal(t,i,s,e),i}getLocalPointByInner(t,e,s,r){return this.getWorldPoint(t,this.parent,s,r)}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByBox(t,e,s,r){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,r),e,s,!0)}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e,s){Ra(this,t,e,s)}transform(t,e,s){Pa(this,t,e,s)}move(t,e,s){wa(this,t,e,s)}moveInner(t,e,s){ka(this,t,e,!0,s)}scaleOf(t,e,s,r,i){ba(this,Ea(this,t),e,s,r,i)}rotateOf(t,e,s){Ba(this,Ea(this,t),e,s)}skewOf(t,e,s,r,i){va(this,Ea(this,t),e,s,r,i)}transformWorld(t,e,s){Sa(this,t,e,s)}moveWorld(t,e,s){ka(this,t,e,!1,s)}scaleOfWorld(t,e,s,r,i){Ca(this,t,e,s,r,i)}rotateOfWorld(t,e){Oa(this,t,e)}skewOfWorld(t,e,s,r,i){Ta(this,t,e,s,r,i)}flip(t,e){Pa(this,La(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ut.need("path")}getMotionPoint(t){return Ut.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){Ma(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s,r){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):yn(this.prototype,t,e)}static addAttr(t,e,s,r){s||(s=Qi),s(e,r)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new _o(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(_o.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};Aa=Kt([kn(Go),kn(Ko),kn(aa),kn(Uo),kn(ha)],Aa);const{setListWithFn:Wa}=Pt,{sort:Na}=Jn,{localBoxBounds:Ya,localStrokeBounds:Xa,localRenderBounds:Da,maskLocalBoxBounds:za,maskLocalStrokeBounds:Fa,maskLocalRenderBounds:ja}=Gn,Ua=new Nt("Branch");let Ha=class extends Aa{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){Wa(this.__layout.boxBounds,this.children,this.__hasMask?za:Ya)}__updateStrokeBounds(){Wa(this.__layout.strokeBounds,this.children,this.__hasMask?Fa:Xa)}__updateRenderBounds(){Wa(this.__layout.renderBounds,this.children,this.__hasMask?ja:Da)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Na),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ua.warn("add self or destroyed");const s=n(e);if(!t.__){if(c(t))return t.forEach(t=>{this.add(t,e),s||e++});t=Vt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(_o.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(_o.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):n(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(_o.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(_o.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new _o(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};Ha=Kt([kn(da)],Ha);class Ga{get length(){return this.list.length}constructor(t){this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:s}=this;n(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(n(s[t.innerId])){const{list:r}=this;for(let t=e,i=r.length;t<i;t++)s[r[t].innerId]++;0===e?r.unshift(t):(e>r.length&&(e=r.length),r.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)n(s)?e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;n(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Ga;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,r=t.length;s<r;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Va{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const qa="1.9.0";export{ut as AlignHelper,r as Answer,ht as AroundHelper,Mt as AutoBounds,De as BezierHelper,Et as Bounds,go as BoundsEvent,Pt as BoundsHelper,Ha as Branch,Jn as BranchHelper,da as BranchRender,$t as CanvasManager,_o as ChildEvent,Ht as Creator,g as DataHelper,Nt as Debug,nt as Direction4,ot as Direction9,Qe as EllipseHelper,co as Event,Jt as EventCreator,Io as Eventer,vi as FileHelper,fo as ImageEvent,Li as ImageManager,e as IncrementId,ko as LayoutEvent,Aa as Leaf,aa as LeafBounds,Gn as LeafBoundsHelper,m as LeafData,Go as LeafDataProxy,Uo as LeafEventer,Yn as LeafHelper,uo as LeafLayout,Va as LeafLevelList,Ga as LeafList,Ko as LeafMatrix,ha as LeafRender,ue as LeaferCanvasBase,Oo as LeaferEvent,Ni as LeaferImage,B as MathHelper,et as Matrix,N as MatrixHelper,ge as NeedConvertToCanvasCommandMap,k as OneRadian,C as PI2,O as PI_2,ci as PathBounds,sr as PathCommandDataHelper,pe as PathCommandMap,Is as PathConvert,xi as PathCorner,xr as PathCreator,Mr as PathDrawer,ce as PathHelper,we as PathNumberCommandLengthMap,xe as PathNumberCommandMap,t as Platform,Ut as Plugin,K as Point,q as PointHelper,po as PropertyEvent,be as RectHelper,Co as RenderEvent,Bo as ResizeEvent,Si as Resource,zt as Run,At as StringNumberMap,Oi as TaskItem,Ti as TaskProcessor,rt as TwoPointBoundsHelper,Vt as UICreator,to as WaitHelper,vo as WatchEvent,rn as affectRenderBoundsType,tn as affectStrokeBoundsType,Fi as attr,Gi as autoLayoutType,Qi as boundsType,Bi as canvasPatch,de as canvasSizeAttrs,Di as createDescriptor,pn as cursorType,fn as dataProcessor,Ui as dataType,zi as decorateLeafAttr,yn as defineDataProcessor,Yi as defineKey,ji as defineLeafAttr,Zi as doBoundsType,en as doStrokeType,i as emptyData,cn as eraserType,P as getBoundsData,Xi as getDescriptor,S as getMatrixData,T as getPointData,_n as hitType,c as isArray,p as isData,f as isEmptyData,h as isFinite,o as isNull,l as isNumber,_ as isObject,a as isString,n as isUndefined,gn as layoutProcessor,Lo as leaferTransformAttrMap,un as maskType,Ji as naturalBoundsType,on as opacityType,$i as pathInputType,Ki as pathType,wi as pen,Hi as positionType,Cn as registerUI,On as registerUIEvent,bn as rewrite,Bn as rewriteAble,qi as rotationType,Vi as scaleType,dn as sortType,sn as strokeType,nn as surfaceType,It as tempBounds,st as tempMatrix,tt as tempPoint,u as tryToNumber,kn as useModule,qa as version,an as visibleType};
|
|
2
2
|
//# sourceMappingURL=core.esm.min.js.map
|