@leafer/core 1.6.0 → 1.6.2
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 +23 -7
- package/lib/core.esm.js +23 -7
- 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.cjs.map +0 -1
- package/lib/core.esm.js.map +0 -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={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,{round:i,pow:n,PI:o}=Math,a={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)),a.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?n(10,e):1e12;return-0===(t=i(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&&a.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:h,randColor:t=>`rgba(${h(255)},${h(255)},${h(255)},${t||1})`};function h(t){return Math.round(Math.random()*t)}const l=o/180,d=2*o,u=o/2;function c(){return{x:0,y:0}}function _(){return{x:0,y:0,width:0,height:0}}function p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:f,cos:g,acos:y,sqrt:m}=Math,{float:x}=a,w={};function b(){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 v={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:b(),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:p,getWorld:b,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){B.toInnerPoint(t,e,w),B.scaleOfInner(t,w,s,r)},scaleOfInner(t,e,s,r=s){B.translateInner(t,e.x,e.y),B.scale(t,s,r),B.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=g(e*=l),a=f(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){B.toInnerPoint(t,e,w),B.rotateOfInner(t,w,s)},rotateOfInner(t,e,s){B.translateInner(t,e.x,e.y),B.rotate(t,s),B.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:o}=t;s&&(s*=l,t.a=r+n*s,t.b=i+o*s),e&&(e*=l,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){B.toInnerPoint(t,e,w),B.skewOfInner(t,w,s,r)},skewOfInner(t,e,s,r=0){B.translateInner(t,e.x,e.y),B.skew(t,s,r),B.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){B.multiply(t,B.tempInvert(e))},divideParent(t,e){B.multiplyParent(t,B.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=B;return B.copy(e,t),B.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:h}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,n=s*l,o=g(n),d=f(n);if(r||i){const e=r*l,s=i*l;t.a=(o+s*-d)*a,t.b=(d+s*o)*a,t.c=(e*o-d)*h,t.d=(o+e*d)*h}else t.a=o*a,t.b=d*a,t.c=-d*h,t.d=o*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=n,t.f=o,(s=s||r)&&B.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:n,c:o,d:a,e:h,f:d}=t;let c,_,p,w,b,v=h,B=d;if(n||o){const t=i*a-n*o;if(o&&!r){c=m(i*i+n*n),_=t/c;const e=i/c;p=n>0?y(e):-y(e)}else{_=m(o*o+a*a),c=t/_;const e=o/_;p=u-(a>0?y(-e):-y(e))}const e=x(g(p)),s=f(p);c=x(c),_=x(_),w=e?x((o/_+s)/e/l,9):0,b=e?x((n/c-s)/e/l,9):0,p=x(p/l)}else c=i,_=a,p=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:p,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=m(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){B.set(t)}},B=v,{toInnerPoint:k,toOuterPoint:C}=v,{sin:O,cos:T,abs:P,sqrt:R,atan2:S,min:L,round:I,PI:M}=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?I(t.x-.5)+.5:I(t.x),t.y=e?I(t.y-.5)+.5:I(t.y)},move(t,e,s){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=A.defaultPoint);const r=T(e*=l),i=O(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}=A;return N(s,t),k(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=A;return N(s,t),C(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=A;return N(s,t),A.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),k(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){k(e,t,s)},toOuterOf(t,e,s){C(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)=>W(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=P(s-t),n=P(r-e);return R(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>L(W(t,e,s,r),W(s,r,i,n)),getAngle:(t,e)=>Y(t,e)/l,getRotation:(t,e,s,r)=>(r||(r=e),A.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/l),getRadianFrom(t,e,s,r,i,n,o,a){void 0===o&&(o=s,a=r);let h=S(e-r,t-s);const l=S(n-a,i-o)-h;return l<-M?l+d:l},getAtan2:(t,e)=>S(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=Y(t,e);return(e=r?e:{}).x=t.x+T(i)*s,e.y=t.y+O(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){A.reset(t)}},A=E,{getDistanceFrom:W,copy:N,getAtan2:Y}=A;class D{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 D(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 D(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new D(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 X=new D;class z{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?v.copy(this,t):v.set(this,t,e,s,r,i,n),this}setWith(t){return v.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 z(this)}translate(t,e){return v.translate(this,t,e),this}translateInner(t,e){return v.translateInner(this,t,e),this}scale(t,e){return v.scale(this,t,e),this}scaleWith(t,e){return v.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return v.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return v.scaleOfInner(this,t,e,s),this}rotate(t){return v.rotate(this,t),this}rotateOfOuter(t,e){return v.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return v.rotateOfInner(this,t,e),this}skew(t,e){return v.skew(this,t,e),this}skewOfOuter(t,e,s){return v.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return v.skewOfInner(this,t,e,s),this}multiply(t){return v.multiply(this,t),this}multiplyParent(t){return v.multiplyParent(this,t),this}divide(t){return v.divide(this,t),this}divideParent(t){return v.divideParent(this,t),this}invert(){return v.invert(this),this}invertWith(){return v.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){v.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){v.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return v.setLayout(this,t,e,s),this}getLayout(t,e,s){return v.getLayout(this,t,e,s)}withScale(t,e){return v.withScale(this,t,e)}reset(){v.reset(this)}}const F=new z,j={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){U(t,e,s),U(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:U}=j,{tempPointBounds:G,setPoint:H,addPoint:V,toBounds:q}=j,{toOuterPoint:Q}=v,{float:J,fourNumber:Z}=a,{floor:$,ceil:K}=Math;let tt,et,st,rt;const it={},nt={},ot={tempBounds:{},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=Z(s);r?at.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):at.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),at.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),at.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?lt(e,t):e=t,s?(e.offsetX=-(at.maxX(s)-t.x),e.offsetY=-(at.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),at.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){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)=>(at.copy(at.tempBounds,t),at.toOuterOf(at.tempBounds,e),at.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),at.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 it.x=t.x,it.y=t.y,Q(e,it,nt),H(G,nt.x,nt.y),it.x=t.x+t.width,Q(e,it,nt),V(G,nt.x,nt.y),it.y=t.y+t.height,Q(e,it,nt),V(G,nt.x,nt.y),it.x=t.x,Q(e,it,nt),V(G,nt.x,nt.y),q(G,s)},toInnerOf(t,e,s){s||(s=t),at.move(s,-e.e,-e.f),at.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new z(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e,s){const r={};return at.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){at.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){at.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=$(t.x),t.y=$(t.y),t.width=e>t.x?K(t.width+e-t.x):K(t.width),t.height=s>t.y?K(t.height+s-t.y):K(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=J(t.x,e),t.y=J(t.y,e),t.width=J(t.width,e),t.height=J(t.height,e)},add(t,e,s){tt=t.x+t.width,et=t.y+t.height,st=e.x,rt=e.y,s||(st+=e.width,rt+=e.height),tt=tt>st?tt:st,et=et>rt?et:rt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=tt-t.x,t.height=et-t.y},addList(t,e){at.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){at.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){at.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||lt(t,i)):ht(t,i));n&&at.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?H(G,t.x,t.y):V(G,t.x,t.y))),q(G,t)},setPoint(t,e){at.set(t,e.x,e.y)},addPoint(t,e){ht(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=at.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=at.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=at.tempToOuterOf(e,s)),!at.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return tt=r+n,et=i+o,st=t.x+t.width,rt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,tt=tt<st?tt:st,et=et<rt?et:rt,n=tt-r,o=et-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){at.copy(t,at.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){at.set(t)}},at=ot,{add:ht,copy:lt}=at;class dt{get minX(){return ot.minX(this)}get minY(){return ot.minY(this)}get maxX(){return ot.maxX(this)}get maxY(){return ot.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?ot.copy(this,t):ot.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 dt(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,s){return ot.scaleOf(this,t,e,s),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}getFitMatrix(t,e){return ot.getFitMatrix(this,t,e)}spread(t,e){return ot.spread(this,t,e),this}shrink(t,e){return ot.shrink(this,t,e),this}ceil(){return ot.ceil(this),this}unsign(){return ot.unsign(this),this}float(t){return ot.float(this,t),this}add(t){return ot.add(this,t),this}addList(t){return ot.setList(this,t,!0),this}setList(t){return ot.setList(this,t),this}addListWithFn(t,e){return ot.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return ot.setListWithFn(this,t,e),this}setPoint(t){return ot.setPoint(this,t),this}setPoints(t){return ot.setPoints(this,t),this}addPoint(t){return ot.addPoint(this,t),this}getPoints(){return ot.getPoints(this)}hitPoint(t,e){return ot.hitPoint(this,t,e)}hitRadiusPoint(t,e){return ot.hitRadiusPoint(this,t,e)}hit(t,e){return ot.hit(this,t,e)}includes(t,e){return ot.includes(this,t,e)}intersect(t,e){return ot.intersect(this,t,e),this}getIntersect(t,e){return new dt(ot.getIntersectData(this,t,e))}isSame(t){return ot.isSame(this,t)}isEmpty(){return ot.isEmpty(this)}reset(){ot.reset(this)}}const ut=new dt;class ct{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 dt(i,e,n||t.width-i-s,o||t.height-e-r)}}var _t,pt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(_t||(_t={})),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"}(pt||(pt={}));const ft=[{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}];ft.forEach((t=>t.type="percent"));const gt={directionData:ft,tempPoint:{},get:yt,toPoint(t,e,s,r,i){const n=yt(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,n.x&&(s.x-=1===n.x?i.width:.5===n.x?n.x*i.width:0),n.y&&(s.y-=1===n.y?i.height:.5===n.y?n.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function yt(t){return"string"==typeof t?ft[pt[t]]:t}const{toPoint:mt}=gt,xt={toPoint(t,e,s,r,i){mt(t,s,r,i,e)}},wt={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:bt}=a;class vt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new vt(t)}static set filter(t){this.filterList=Bt(t)}static set exclude(t){this.excludeList=Bt(t)}static drawRepaint(t,e){const s=bt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===vt.showBounds,i=t.__nowWorld,n=bt();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(kt.enable){if(kt.filterList.length&&kt.filterList.every((t=>t!==this.name)))return;if(kt.excludeList.length&&kt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){kt.enable&&this.warn(...t)}warn(...t){kt.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 Bt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}vt.filterList=[],vt.excludeList=[],vt.showWarn=!0;const kt=vt,Ct=vt.get("RunTime"),Ot={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return Tt.currentId=Tt.idMap[r]=e?performance.now():Date.now(),Tt.currentName=Tt.nameMap[r]=t,Tt.nameToIdMap[t]=r,r},end(t,e){const s=Tt.idMap[t],r=Tt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Tt.idMap[t]=Tt.nameMap[t]=Tt.nameToIdMap[r]=void 0,Ct.log(r,i,"ms")},endOfName(t,e){const s=Tt.nameToIdMap[t];void 0!==s&&Tt.end(s,e)}},Tt=Ot,Pt=[],Rt={list:{},add(t,...e){this.list[t]=!0,Pt.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Pt.forEach((t=>Rt.has(t,!0)))));const St=vt.get("UICreator"),Lt={list:{},register(t){const{__tag:e}=t.prototype;It[e]&&St.repeat(e),It[e]=t},get(t,e,s,r,i,n){It[t]||St.error("not register "+t);const o=new It[t](e);return void 0!==s&&(o.x=s,r&&(o.y=r),i&&(o.width=i),n&&(o.height=n)),o}},{list:It}=Lt,Mt=vt.get("EventCreator"),Et={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(At[e]&&Mt.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}=Et;class Wt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.canvas(t);return this.add(i),i}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)=>(Yt(e,t),Yt(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 Yt(t[i],e[i],s&&s[i]);s&&i in s?(null===(o=s[i])||void 0===o?void 0:o.constructor)===Object&&Yt(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}},{assign:Yt}=Nt;class Dt{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 Gt(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 Ht(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 Jt{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([Ht("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),Ut([Ht("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),Ut([Ht("globalAlpha")],Jt.prototype,"opacity",void 0),Ut([Ht()],Jt.prototype,"fillStyle",void 0),Ut([Ht()],Jt.prototype,"strokeStyle",void 0),Ut([Ht("lineWidth")],Jt.prototype,"strokeWidth",void 0),Ut([Ht("lineCap")],Jt.prototype,"strokeCap",void 0),Ut([Ht("lineJoin")],Jt.prototype,"strokeJoin",void 0),Ut([Ht("lineDashOffset")],Jt.prototype,"dashOffset",void 0),Ut([Ht()],Jt.prototype,"miterLimit",void 0),Ut([Ht()],Jt.prototype,"shadowBlur",void 0),Ut([Ht()],Jt.prototype,"shadowColor",void 0),Ut([Ht()],Jt.prototype,"shadowOffsetX",void 0),Ut([Ht()],Jt.prototype,"shadowOffsetY",void 0),Ut([Ht()],Jt.prototype,"filter",void 0),Ut([Ht()],Jt.prototype,"font",void 0),Ut([Ht()],Jt.prototype,"fontKerning",void 0),Ut([Ht()],Jt.prototype,"fontStretch",void 0),Ut([Ht()],Jt.prototype,"fontVariantCaps",void 0),Ut([Ht()],Jt.prototype,"textAlign",void 0),Ut([Ht()],Jt.prototype,"textBaseline",void 0),Ut([Ht()],Jt.prototype,"textRendering",void 0),Ut([Ht()],Jt.prototype,"wordSpacing",void 0),Ut([Ht()],Jt.prototype,"letterSpacing",void 0),Ut([Ht()],Jt.prototype,"direction",void 0),Ut([qt()],Jt.prototype,"setTransform",null),Ut([qt()],Jt.prototype,"resetTransform",null),Ut([qt()],Jt.prototype,"getTransform",null),Ut([qt()],Jt.prototype,"save",null),Ut([qt()],Jt.prototype,"restore",null),Ut([qt()],Jt.prototype,"translate",null),Ut([qt()],Jt.prototype,"scale",null),Ut([qt()],Jt.prototype,"rotate",null),Ut([qt()],Jt.prototype,"fill",null),Ut([qt()],Jt.prototype,"stroke",null),Ut([qt()],Jt.prototype,"clip",null),Ut([qt()],Jt.prototype,"fillRect",null),Ut([qt()],Jt.prototype,"strokeRect",null),Ut([qt()],Jt.prototype,"clearRect",null),Ut([qt()],Jt.prototype,"beginPath",null),Ut([qt()],Jt.prototype,"moveTo",null),Ut([qt()],Jt.prototype,"lineTo",null),Ut([qt()],Jt.prototype,"bezierCurveTo",null),Ut([qt()],Jt.prototype,"quadraticCurveTo",null),Ut([qt()],Jt.prototype,"closePath",null),Ut([qt()],Jt.prototype,"arc",null),Ut([qt()],Jt.prototype,"arcTo",null),Ut([qt()],Jt.prototype,"ellipse",null),Ut([qt()],Jt.prototype,"rect",null),Ut([qt()],Jt.prototype,"roundRect",null),Ut([qt()],Jt.prototype,"createConicGradient",null),Ut([qt()],Jt.prototype,"createLinearGradient",null),Ut([qt()],Jt.prototype,"createPattern",null),Ut([qt()],Jt.prototype,"createRadialGradient",null),Ut([qt()],Jt.prototype,"fillText",null),Ut([qt()],Jt.prototype,"measureText",null),Ut([qt()],Jt.prototype,"strokeText",null);const{copy:Zt,multiplyParent:$t}=v,{round:Kt}=Math,te={width:1,height:1,pixelRatio:1},ee=["width","height","pixelRatio"];class se extends Jt{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(e,r){super(),this.size={},this.worldTransform={},e||(e=te),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:n,pixelRatio:o}=e;this.autoLayout=!i||!n,this.size.pixelRatio=o|t.devicePixelRatio,this.config=e,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 dt(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,ot.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(ut.x,ut.y,ut.width,ut.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,ut.x,ut.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(ut.x,ut.y,ut.width,ut.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(ut.x,ut.y,ut.width,ut.height),s&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(ut.x,ut.y,ut.width,ut.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(ut.x,ut.y,ut.width,ut.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,s){ut.set(t),s&&ut.intersect(this.bounds),ut.scale(this.pixelRatio),e&&ut.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,s){const{size:r,pixelSnap:i}=this,n=this.manager?this.manager.get(r):e.canvas(Object.assign({},r));return n.save(),t&&(Zt(n.worldTransform,this.worldTransform),n.useWorldTransform()),s&&(n.smooth=this.smooth),n.pixelSnap!==i&&(n.pixelSnap=i),n}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 o=a.fourNumber(n,Math.min(r/2,i/2)),h=e+r,l=s+i;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(h,s,h,l,o[1]):t.lineTo(h,s),o[2]?t.arcTo(h,l,e,l,o[2]):t.lineTo(h,l),o[3]?t.arcTo(e,l,e,s,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,s,h,s,o[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}=j,{set:Be,toNumberPoints:ke}=E,{M:Ce,L:Oe,C:Te,Q:Pe,Z:Re}=ne,Se={},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)),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(Re)},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,h,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+=d),w===me||ye(p+f)<1e-12||ye(g+y)<1e-12)return t&&t.push(Oe,r,i),h&&(be(h,e,s),ve(h,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+u*v),C=i+B*_e(m+w/2+u*v);return m-=u*v,x-=u*v,Ee(t,k,C,a,a,0,m/l,x/l,b,h,c,_)},arc:(t,e,s,r,i,n,o,a,h,l)=>Ee(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,h,c,_,p){const f=n*l,g=_e(f),y=pe(f);let m=o*l,x=a*l;m>me&&(m-=d),x<0&&(x+=d);let w=x-m;w<0?w+=d:w>d&&(w-=d),h&&(w-=d);const b=ge(ye(w/u)),v=w/b,B=_e(v/4),k=8/3*B*B/_e(v/2);x=m+v;let C,O,T,P,R,S,L,I,M=pe(m),E=_e(m),A=T=y*r*M-g*i*E,W=P=g*r*M+y*i*E,N=e+T,Y=s+P;t&&t.push(t.length?Oe:Ce,N,Y),c&&be(c,N,Y),p&&Be(p,N,Y);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,R=e+A-k*(y*r*E+g*i*M),S=s+W-k*(g*r*E-y*i*M),L=e+T+k*(y*r*O+g*i*C),I=s+P+k*(g*r*O-y*i*C),t&&t.push(Te,R,S,L,I,e+T,s+P),c&&Me(e+A,s+W,R,S,L,I,e+T,s+P,c,!0),A=T,W=P,M=C,E=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){Me(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++)Ie(d[l],t,e,s,r,i,n,o,a,Se),ve(h,Se.x,Se.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 Ie(t,e,s,r,i,n,o,a,h,l),l}},{getPointAndSet:Ie,toTwoPointBounds:Me,ellipse:Ee}=Le,{sin:Ae,cos:We,sqrt:Ne,atan2:Ye}=Math,{ellipse:De}=Le,Xe={ellipticalArc(e,s,r,i,n,o,a,h,u,c,_){const p=(u-s)/2,f=(c-r)/2,g=o*l,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===h?-1:1)*Ne(C/(b*B+v*k));const T=O*i*w/n,P=-O*n*x/i,R=Ye((w-P)/n,(x-T)/i),S=Ye((-w-P)/n,(-x-T)/i);let L=S-R;0===h&&L>0?L-=d:1===h&&L<0&&(L+=d);const I=s+p+m*T-y*P,M=r+f+y*T+m*P,E=L<0?1:0;_||t.ellipseToCurve?De(e,I,M,i,n,o,R/l,S/l,E):i!==n||o?e.push(ne.G,I,M,i,n,o,R/l,S/l,E):e.push(ne.O,I,M,i,R/l,S/l,E)}},{M:ze,m:Fe,L:je,l:Ue,H:Ge,h:He,V:Ve,v:qe,C:Qe,c:Je,S:Ze,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=vt.get("PathConvert"),Bs={},ks={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,h="";for(;n<o;){r=t[n],s=ue[r],h+=r===i?" ":de[r];for(let r=1;r<s;r++)h+=a.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],wt[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 He:t[u+1]+=a;case Ge: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=Ze;case Ze:o=n===Qe||n===Ze,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 Je: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:Rs,C:Ss,Q:Ls,Z:Is,N:Ms,D:Es,X:As,G:Ws,F:Ns,O:Ys,P:Ds,U:Xs}=ne,{getMinDistanceFrom:zs,getRadianFrom:Fs}=E,{tan:js,min:Us,abs:Gs}=Math,Hs={},Vs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ps,e,s)},lineTo(t,e,s){t.push(Rs,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(Ss,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(Ls,e,s,r,i)},closePath(t){t.push(Is)},rect(t,e,s,r,i){t.push(Ms,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 o=a.fourNumber(n);o?t.push(Es,e,s,r,i,...o):t.push(Ms,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(Ds,e,s,r):(void 0===n&&(n=360),t.push(Ys,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*Gs(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,Hs),t.push(Ps,Hs.x,Hs.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,Hs),t.push(Ps,Hs.x,Hs.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:Js,lineTo:Zs,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 Js(this.__path,t,e),this.paint(),this}lineTo(t,e){return Zs(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=vt.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]*l,e[r+6]*l,e[r+7]*l,e[r+8]),r+=9;break;case wr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,d,!1),r+=5;break;case br:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*l,e[r+5]*l,e[r+6]),r+=7;break;case vr:t.arc(e[r+1],e[r+2],e[r+3],0,d,!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:Rr,Z:Sr,N:Lr,D:Ir,X:Mr,G:Er,F:Ar,O:Wr,P:Nr,U:Yr}=ne,{toTwoPointBounds:Dr,toTwoPointBoundsByQuadraticCurve:Xr,arcTo:zr,arc:Fr,ellipse:jr}=Le,{addPointBounds:Ur,copy:Gr,addPoint:Hr,setPoint:Vr,addBounds:qr,toBounds:Qr}=j,Jr=vt.get("PathBounds");let Zr,$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===Sr||o===Pr||o===Rr?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],Hr(e,h,l),a+=3;break;case Pr:i=t[a+5],n=t[a+6],Dr(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 Rr: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 Sr: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 Ir:case Mr:h=t[a+1],l=t[a+2],qr(e,h,l,t[a+3],t[a+4]),a+=o===Ir?9:6;break;case Er: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?Gr(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?Gr(e,ti):Ur(e,ti),h=si.x,l=si.y,a+=7;break;case Nr:h=t[a+1],l=t[a+2],Zr=t[a+3],qr(e,h-Zr,l-Zr,2*Zr,2*Zr),h+=Zr,a+=4;break;case Yr:zr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ti,si),0===a?Gr(e,ti):Ur(e,ti),h=si.x,l=si.y,a+=6;break;default:return void Jr.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=0,o=0,a=0,h=0,l=0,d=0,u=0,c=0,_=0;const p=t.length,f=[];for(;n<p;)switch(r=t[n],r){case ii:h=c=t[n+1],l=_=t[n+2],n+=3,t[n]===ni?(d=t[n+1],u=t[n+2],f.push(ii,ai(h,d),hi(l,u))):f.push(ii,h,l);break;case ni:switch(o=t[n+1],a=t[n+2],n+=3,t[n]){case ni:li(f,o,a,t[n+1],t[n+2],e,c,_);break;case oi:li(f,o,a,h,l,e,c,_);break;default:f.push(ni,o,a)}c=o,_=a;break;case oi:li(f,h,l,d,u,e,c,_),f.push(oi),n+=1;break;default:i=ue[r];for(let e=0;e<i;e++)f.push(t[n+e]);n+=i}return r!==oi&&(f[1]=h,f[2]=l),f}};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={opacityTypes:["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.opacityTypes.forEach((t=>fi.upperCaseTypeMap[t]=t.toUpperCase()));const gi=vt.get("TaskProcessor");class yi{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Gt(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=vt.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,s,r){let i;return"string"==typeof s?i={url:s}:s.url||(i={url:t,view:s}),i&&(r&&(i.format=r),s=e.image(i)),bi.set(t,s),s},destroy(){bi.map={}}},bi=wi,vi={maxRecycled:10,recycledList:[],patternTasker:new mi,get(t){let s=wi.get(t.url);return s||wi.set(t.url,s=e.image(t)),s.use++,s},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)},hasOpacityPixel:t=>pi.opacityTypes.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}=s;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.hasOpacityPixel(t)&&(this.hasOpacityPixel=!0)}load(e,s){return this.loading||(this.loading=!0,wi.tasker.add((()=>Gt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),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)}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=null)}catch(t){}return i&&(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 Ri(t,e){return(s,r)=>Li(s,r,t,e&&e(r))}function Si(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 Ii(t){return Ri(t)}function Mi(t,e){return Ri(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Ei(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Di(this))}})))}function Ai(t,e){return Ri(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Wi(t,e){return Ri(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Ni(t,e){return Ri(t,(t=>({set(s){this.__setAttr(t,s,e)&&Di(this)}})))}function Yi(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&(Di(this),this.__.__removeNaturalSize())}})))}function Di(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Xi(t){return Ri(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Di(this)}})))}const zi=Ni;function Fi(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&ji(this)}})))}function ji(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Di(t)}const Ui=Fi;function Gi(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Hi(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Vi(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Qi(this)}})))}function qi(t){return Ri(t,(t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Ji(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Ji(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 Ji(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||Di(t))}function Zi(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function $i(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function Ki(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function tn(t){return Ri(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===vt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function en(t){return Ri(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 vt("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=>{Et.register(t)}}setTimeout((()=>un(!0)));const{copy:fn,toInnerPoint:gn,toOuterPoint:yn,scaleOfOuter:mn,rotateOfOuter:xn,skewOfOuter:wn,multiplyParent:bn,divideParent:vn,getLayout:Bn}=v,kn={},{round:Cn}=Math,On={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Rn(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++)Sn(e[t])}},updateAllChange(t){if(Sn(t),t.__updateChange(),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:a.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){ot.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 gt.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:Rn,updateAllWorldOpacity:Sn,updateAllChange:Ln}=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:En}=On,An={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),Wn(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++)Nn(e[t],e)},updateBounds(t,e){const s=[t];Nn(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++)En(r[t]);e&&e===s||En(s)}}},{pushAllChildBranch:Wn,pushAllBranchStack:Nn,updateBoundsByBranchStack:Yn}=An,Dn={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:Xn}=On,{toOuterOf:zn,getPoints:Fn,copy:jn}=ot,Un="_localContentBounds",Gn="_worldContentBounds",Hn="_worldBoxBounds",Vn="_worldStrokeBounds";class qn{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 zn(this.contentBounds,this.leaf.__localMatrix,this[Un]||(this[Un]={})),this[Un]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return zn(this.contentBounds,this.leaf.__world,this[Gn]||(this[Gn]={})),this[Gn]}get worldBoxBounds(){return zn(this.boxBounds,this.leaf.__world,this[Hn]||(this[Hn]={})),this[Hn]}get worldStrokeBounds(){return zn(this.strokeBounds,this.leaf.__world,this[Vn]||(this[Vn]={})),this[Vn]}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{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;const s=e;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__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 v.defaultMatrix;case"page":t=e.zoomLayer;default:return Xn(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 dt(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=v.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(a,e),n=Xn(r,e,!0)}if(o||(o=v.getLayout(n)),jn(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=Fn(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=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Qn{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 Jn extends Qn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Jn.ADD="child.add",Jn.REMOVE="child.remove",Jn.CREATED="created",Jn.MOUNTED="mounted",Jn.UNMOUNTED="unmounted",Jn.DESTROY="destroy";class Zn extends Qn{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}Zn.CHANGE="property.change",Zn.LEAFER_CHANGE="property.leafer_change";class $n extends Qn{constructor(t,e){super(t),Object.assign(this,e)}}$n.LOAD="image.load",$n.LOADED="image.loaded",$n.ERROR="image.error";class Kn extends Qn{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(Kn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}Kn.RESIZE="resize";class to extends Qn{constructor(t,e){super(t),this.data=e}}to.REQUEST="watch.request",to.DATA="watch.data";class eo extends Qn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}eo.REQUEST="layout.request",eo.START="layout.start",eo.BEFORE="layout.before",eo.LAYOUT="layout",eo.AFTER="layout.after",eo.AGAIN="layout.again",eo.END="layout.end";class so extends Qn{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}so.REQUEST="render.request",so.CHILD_START="render.child_start",so.CHILD_END="render.child_end",so.START="render.start",so.BEFORE="render.before",so.RENDER="render",so.AFTER="render.after",so.AGAIN="render.again",so.END="render.end",so.NEXT="render.next";class ro extends Qn{}ro.START="leafer.start",ro.BEFORE_READY="leafer.before_ready",ro.READY="leafer.ready",ro.AFTER_READY="leafer.after_ready",ro.VIEW_READY="leafer.view_ready",ro.VIEW_COMPLETED="leafer.view_completed",ro.STOP="leafer.stop",ro.RESTART="leafer.restart",ro.END="leafer.end";const io={};class no{set event(t){this.on(t)}on(t,e,s){if(!e){let e,s=t;for(let t in s)e=s[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let r,i,n;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const o=oo(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])}))}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=oo(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]))}))}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 s&&(e=e.bind(s)),this.on(t,e,r),{type:t,current:this,listener:e,options:r}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0}once(t,e,s){this.on(t,e,{once:!0,capture:s})}emit(t,e,s){!e&&Et.has(t)&&(e=Et.get(t,{type:t,target:this,current:this}));const r=oo(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 oo(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:io)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:io)}}const{on:ao,on_:ho,off:lo,off_:uo,once:co,emit:_o,emitEvent:po,hasEvent:fo,destroy:go}=no.prototype,yo={on:ao,on_:ho,off:lo,off_:uo,once:co,emit:_o,emitEvent:po,hasEvent:fo,destroyEventer:go},{isFinite:mo}=Number,xo=vt.get("setAttr"),wo={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(s&&!mo(e)&&void 0!==e&&(xo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=Zn,i=new Zn(s,this,t,r,e);return this.isLeafer?this.emitEvent(new Zn(Zn.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:bo,multiplyParent:vo,translateInner:Bo,defaultWorld:ko}=v,{toPoint:Co,tempPoint:Oo}=gt,To={__updateWorldMatrix(){vo(this.__local||this.__layout,this.parent?this.parent.__world:ko,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.rotationChanged)&&(bo(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(Co(s.around||s.origin,t.boxBounds,Oo),Bo(e,-Oo.x,-Oo.y,!s.around))}this.__layout.matrixChanged=!1}},{updateMatrix:Po,updateAllMatrix:Ro}=On,{updateBounds:So}=An,{toOuterOf:Lo,copyAndSpread:Io,copy:Mo}=ot,{toBounds:Eo}=ri,Ao={__updateWorldBounds(){Lo(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Lo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Lo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Lo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Eo(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(),Ro(this),So(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ro(this),So(this,this))):Po(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Io(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Io(t.renderBounds,t.boxBounds,t.renderSpread):Mo(t.renderBounds,t.strokeBounds)}},Wo={__render(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);vt.showBounds&&vt.drawBounds(this,t,e)}},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.windingRule?t.clip(this.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:No}=Mn,Yo={__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++)No(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++)No(s[r],e)||s[r].__clip(t,e)}}},{LEAF:Do,create:Xo}=s,{toInnerPoint:zo,toOuterPoint:Fo,multiplyParent:jo}=v,{toOuterOf:Uo}=ot,{copy:Go,move:Ho}=E,{moveLocal:Vo,zoomOfLocal:qo,rotateOfLocal:Qo,skewOfLocal:Jo,moveWorld:Zo,zoomOfWorld:$o,rotateOfWorld:Ko,skewOfWorld:ta,transform:ea,transformWorld:sa,setTransform:ra,getFlipTransform:ia,getLocalOrigin:na,getRelativeWorld:oa,drop:aa}=On;let ha=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 Dt}get __LayoutProcessor(){return qn}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=Xo(Do),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Jn.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(Jn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Jn.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(Jn.MOUNTED)):this.__emitLifeEvent(Jn.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),Uo(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?oa(this,e):this.worldTransform,i=s?t:{};return Uo(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&Go(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&Go(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),zo(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){Fo(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 Ho(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 Ho(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){ea(this,t,e,s)}move(t,e,s){Vo(this,t,e,s)}moveInner(t,e,s){Zo(this,t,e,!0,s)}scaleOf(t,e,s,r,i){qo(this,na(this,t),e,s,r,i)}rotateOf(t,e,s){Qo(this,na(this,t),e,s)}skewOf(t,e,s,r,i){Jo(this,na(this,t),e,s,r,i)}transformWorld(t,e,s){sa(this,t,e,s)}moveWorld(t,e,s){Zo(this,t,e,!1,s)}scaleOfWorld(t,e,s,r,i){$o(this,t,e,s,r,i)}rotateOfWorld(t,e){Ko(this,t,e)}skewOfWorld(t,e,s,r,i){ta(this,t,e,s,r,i)}flip(t,e){ea(this,ia(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,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Rt.need("path")}getMotionPoint(t){return Rt.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){aa(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}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 Jn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Jn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};ha=Ut([cn(wo),cn(To),cn(Ao),cn(yo),cn(Wo)],ha);const{setListWithFn:la}=ot,{sort:da}=An,{localBoxBounds:ua,localStrokeBounds:ca,localRenderBounds:_a,maskLocalBoxBounds:pa,maskLocalStrokeBounds:fa,maskLocalRenderBounds:ga}=Mn,ya=new vt("Branch");let ma=class extends ha{__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(){la(this.__layout.boxBounds,this.children,this.__hasMask?pa:ua)}__updateStrokeBounds(){la(this.__layout.strokeBounds,this.children,this.__hasMask?fa:ca)}__updateRenderBounds(){la(this.__layout.renderBounds,this.children,this.__hasMask?ga:_a)}__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(da),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ya.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(Jn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Jn.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(Jn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Jn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Jn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};ma=Ut([cn(Yo)],ma);class xa{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 xa;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 wa{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 ba="1.6.0";export{xt as AlignHelper,Xt as Answer,gt as AroundHelper,ct as AutoBounds,Le as BezierHelper,dt as Bounds,ot as BoundsHelper,ma as Branch,An as BranchHelper,Yo as BranchRender,Wt as CanvasManager,Jn as ChildEvent,e as Creator,Nt as DataHelper,vt as Debug,_t as Direction4,pt as Direction9,Xe as EllipseHelper,Qn as Event,Et as EventCreator,no as Eventer,pi as FileHelper,$n as ImageEvent,vi as ImageManager,s as IncrementId,eo as LayoutEvent,ha as Leaf,Ao as LeafBounds,Mn as LeafBoundsHelper,Dt as LeafData,wo as LeafDataProxy,yo as LeafEventer,On as LeafHelper,qn as LeafLayout,wa as LeafLevelList,xa as LeafList,To as LeafMatrix,Wo as LeafRender,se as LeaferCanvasBase,ro as LeaferEvent,Oi as LeaferImage,a as MathHelper,z as Matrix,v as MatrixHelper,ae as NeedConvertToCanvasCommandMap,l as OneRadian,d as PI2,u 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,Rt as Plugin,D as Point,E as PointHelper,Zn as PropertyEvent,ce as RectHelper,so as RenderEvent,Kn as ResizeEvent,wi as Resource,Ot as Run,wt as StringNumberMap,yi as TaskItem,mi as TaskProcessor,j as TwoPointBoundsHelper,Lt as UICreator,Dn as WaitHelper,to as WatchEvent,Gi as affectRenderBoundsType,Fi as affectStrokeBoundsType,Si as attr,Ei as autoLayoutType,Ni as boundsType,_i as canvasPatch,ee as canvasSizeAttrs,en as cursorType,sn as dataProcessor,Ii as dataType,Ri as decorateLeafAttr,nn as defineDataProcessor,Ti as defineKey,Li as defineLeafAttr,Di as doBoundsType,ji as doStrokeType,zt as emptyData,Ki as eraserType,_ as getBoundsData,Pi as getDescriptor,p as getMatrixData,c as getPointData,tn as hitType,jt as isEmptyData,Ft as isNull,rn as layoutProcessor,$i as maskType,Yi as naturalBoundsType,Vi as opacityType,Xi as pathInputType,zi as pathType,ui as pen,Mi as positionType,_n as registerUI,pn as registerUIEvent,ln as rewrite,dn as rewriteAble,Wi as rotationType,Ai as scaleType,Zi as sortType,Ui as strokeType,Hi as surfaceType,ut as tempBounds,F as tempMatrix,X as tempPoint,cn as useModule,ba 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={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,{round:i,pow:n,PI:o}=Math,a={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)),a.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?n(10,e):1e12;return-0===(t=i(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&&a.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:h,randColor:t=>`rgba(${h(255)},${h(255)},${h(255)},${t||1})`};function h(t){return Math.round(Math.random()*t)}const l=o/180,d=2*o,u=o/2;function c(){return{x:0,y:0}}function _(){return{x:0,y:0,width:0,height:0}}function p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:f,cos:g,acos:y,sqrt:m}=Math,{float:x}=a,w={};function b(){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 v={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:b(),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:p,getWorld:b,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){B.toInnerPoint(t,e,w),B.scaleOfInner(t,w,s,r)},scaleOfInner(t,e,s,r=s){B.translateInner(t,e.x,e.y),B.scale(t,s,r),B.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=g(e*=l),a=f(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){B.toInnerPoint(t,e,w),B.rotateOfInner(t,w,s)},rotateOfInner(t,e,s){B.translateInner(t,e.x,e.y),B.rotate(t,s),B.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:o}=t;s&&(s*=l,t.a=r+n*s,t.b=i+o*s),e&&(e*=l,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){B.toInnerPoint(t,e,w),B.skewOfInner(t,w,s,r)},skewOfInner(t,e,s,r=0){B.translateInner(t,e.x,e.y),B.skew(t,s,r),B.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){B.multiply(t,B.tempInvert(e))},divideParent(t,e){B.multiplyParent(t,B.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=B;return B.copy(e,t),B.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:h}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,n=s*l,o=g(n),d=f(n);if(r||i){const e=r*l,s=i*l;t.a=(o+s*-d)*a,t.b=(d+s*o)*a,t.c=(e*o-d)*h,t.d=(o+e*d)*h}else t.a=o*a,t.b=d*a,t.c=-d*h,t.d=o*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=n,t.f=o,(s=s||r)&&B.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:n,c:o,d:a,e:h,f:d}=t;let c,_,p,w,b,v=h,B=d;if(n||o){const t=i*a-n*o;if(o&&!r){c=m(i*i+n*n),_=t/c;const e=i/c;p=n>0?y(e):-y(e)}else{_=m(o*o+a*a),c=t/_;const e=o/_;p=u-(a>0?y(-e):-y(e))}const e=x(g(p)),s=f(p);c=x(c),_=x(_),w=e?x((o/_+s)/e/l,9):0,b=e?x((n/c-s)/e/l,9):0,p=x(p/l)}else c=i,_=a,p=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:p,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=m(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){B.set(t)}},B=v,{toInnerPoint:k,toOuterPoint:C}=v,{sin:O,cos:T,abs:P,sqrt:S,atan2:R,min:L,round:I,PI:M}=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?I(t.x-.5)+.5:I(t.x),t.y=e?I(t.y-.5)+.5:I(t.y)},move(t,e,s){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=A.defaultPoint);const r=T(e*=l),i=O(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}=A;return N(s,t),k(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=A;return N(s,t),C(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=A;return N(s,t),A.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),k(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){k(e,t,s)},toOuterOf(t,e,s){C(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)=>W(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=P(s-t),n=P(r-e);return S(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>L(W(t,e,s,r),W(s,r,i,n)),getAngle:(t,e)=>Y(t,e)/l,getRotation:(t,e,s,r)=>(r||(r=e),A.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/l),getRadianFrom(t,e,s,r,i,n,o,a){void 0===o&&(o=s,a=r);let h=R(e-r,t-s);const l=R(n-a,i-o)-h;return l<-M?l+d:l},getAtan2:(t,e)=>R(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=Y(t,e);return(e=r?e:{}).x=t.x+T(i)*s,e.y=t.y+O(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){A.reset(t)}},A=E,{getDistanceFrom:W,copy:N,getAtan2:Y}=A;class D{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 D(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 D(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new D(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 X=new D;class z{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?v.copy(this,t):v.set(this,t,e,s,r,i,n),this}setWith(t){return v.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 z(this)}translate(t,e){return v.translate(this,t,e),this}translateInner(t,e){return v.translateInner(this,t,e),this}scale(t,e){return v.scale(this,t,e),this}scaleWith(t,e){return v.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return v.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return v.scaleOfInner(this,t,e,s),this}rotate(t){return v.rotate(this,t),this}rotateOfOuter(t,e){return v.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return v.rotateOfInner(this,t,e),this}skew(t,e){return v.skew(this,t,e),this}skewOfOuter(t,e,s){return v.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return v.skewOfInner(this,t,e,s),this}multiply(t){return v.multiply(this,t),this}multiplyParent(t){return v.multiplyParent(this,t),this}divide(t){return v.divide(this,t),this}divideParent(t){return v.divideParent(this,t),this}invert(){return v.invert(this),this}invertWith(){return v.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){v.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){v.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return v.setLayout(this,t,e,s),this}getLayout(t,e,s){return v.getLayout(this,t,e,s)}withScale(t,e){return v.withScale(this,t,e)}reset(){v.reset(this)}}const F=new z,j={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){U(t,e,s),U(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:U}=j,{tempPointBounds:G,setPoint:H,addPoint:V,toBounds:q}=j,{toOuterPoint:Q}=v,{float:J,fourNumber:Z}=a,{floor:$,ceil:K}=Math;let tt,et,st,rt;const it={},nt={},ot={tempBounds:{},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=Z(s);r?at.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):at.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),at.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),at.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?lt(e,t):e=t,s?(e.offsetX=-(at.maxX(s)-t.x),e.offsetY=-(at.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),at.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){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)=>(at.copy(at.tempBounds,t),at.toOuterOf(at.tempBounds,e),at.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),at.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 it.x=t.x,it.y=t.y,Q(e,it,nt),H(G,nt.x,nt.y),it.x=t.x+t.width,Q(e,it,nt),V(G,nt.x,nt.y),it.y=t.y+t.height,Q(e,it,nt),V(G,nt.x,nt.y),it.x=t.x,Q(e,it,nt),V(G,nt.x,nt.y),q(G,s)},toInnerOf(t,e,s){s||(s=t),at.move(s,-e.e,-e.f),at.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new z(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e,s){const r={};return at.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){at.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){at.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=$(t.x),t.y=$(t.y),t.width=e>t.x?K(t.width+e-t.x):K(t.width),t.height=s>t.y?K(t.height+s-t.y):K(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=J(t.x,e),t.y=J(t.y,e),t.width=J(t.width,e),t.height=J(t.height,e)},add(t,e,s){tt=t.x+t.width,et=t.y+t.height,st=e.x,rt=e.y,s||(st+=e.width,rt+=e.height),tt=tt>st?tt:st,et=et>rt?et:rt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=tt-t.x,t.height=et-t.y},addList(t,e){at.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){at.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){at.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||lt(t,i)):ht(t,i));n&&at.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?H(G,t.x,t.y):V(G,t.x,t.y))),q(G,t)},setPoint(t,e){at.set(t,e.x,e.y)},addPoint(t,e){ht(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=at.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=at.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=at.tempToOuterOf(e,s)),!at.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return tt=r+n,et=i+o,st=t.x+t.width,rt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,tt=tt<st?tt:st,et=et<rt?et:rt,n=tt-r,o=et-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){at.copy(t,at.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){at.set(t)}},at=ot,{add:ht,copy:lt}=at;class dt{get minX(){return ot.minX(this)}get minY(){return ot.minY(this)}get maxX(){return ot.maxX(this)}get maxY(){return ot.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?ot.copy(this,t):ot.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 dt(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,s){return ot.scaleOf(this,t,e,s),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}getFitMatrix(t,e){return ot.getFitMatrix(this,t,e)}spread(t,e){return ot.spread(this,t,e),this}shrink(t,e){return ot.shrink(this,t,e),this}ceil(){return ot.ceil(this),this}unsign(){return ot.unsign(this),this}float(t){return ot.float(this,t),this}add(t){return ot.add(this,t),this}addList(t){return ot.setList(this,t,!0),this}setList(t){return ot.setList(this,t),this}addListWithFn(t,e){return ot.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return ot.setListWithFn(this,t,e),this}setPoint(t){return ot.setPoint(this,t),this}setPoints(t){return ot.setPoints(this,t),this}addPoint(t){return ot.addPoint(this,t),this}getPoints(){return ot.getPoints(this)}hitPoint(t,e){return ot.hitPoint(this,t,e)}hitRadiusPoint(t,e){return ot.hitRadiusPoint(this,t,e)}hit(t,e){return ot.hit(this,t,e)}includes(t,e){return ot.includes(this,t,e)}intersect(t,e){return ot.intersect(this,t,e),this}getIntersect(t,e){return new dt(ot.getIntersectData(this,t,e))}isSame(t){return ot.isSame(this,t)}isEmpty(){return ot.isEmpty(this)}reset(){ot.reset(this)}}const ut=new dt;class ct{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 dt(i,e,n||t.width-i-s,o||t.height-e-r)}}var _t,pt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(_t||(_t={})),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"}(pt||(pt={}));const ft=[{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}];ft.forEach((t=>t.type="percent"));const gt={directionData:ft,tempPoint:{},get:yt,toPoint(t,e,s,r,i){const n=yt(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,n.x&&(s.x-=1===n.x?i.width:.5===n.x?n.x*i.width:0),n.y&&(s.y-=1===n.y?i.height:.5===n.y?n.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function yt(t){return"string"==typeof t?ft[pt[t]]:t}const{toPoint:mt}=gt,xt={toPoint(t,e,s,r,i){mt(t,s,r,i,e)}},wt={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:bt}=a;class vt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new vt(t)}static set filter(t){this.filterList=Bt(t)}static set exclude(t){this.excludeList=Bt(t)}static drawRepaint(t,e){const s=bt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===vt.showBounds,i=t.__nowWorld,n=bt();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(kt.enable){if(kt.filterList.length&&kt.filterList.every((t=>t!==this.name)))return;if(kt.excludeList.length&&kt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){kt.enable&&this.warn(...t)}warn(...t){kt.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 Bt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}vt.filterList=[],vt.excludeList=[],vt.showWarn=!0;const kt=vt,Ct=vt.get("RunTime"),Ot={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return Tt.currentId=Tt.idMap[r]=e?performance.now():Date.now(),Tt.currentName=Tt.nameMap[r]=t,Tt.nameToIdMap[t]=r,r},end(t,e){const s=Tt.idMap[t],r=Tt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Tt.idMap[t]=Tt.nameMap[t]=Tt.nameToIdMap[r]=void 0,Ct.log(r,i,"ms")},endOfName(t,e){const s=Tt.nameToIdMap[t];void 0!==s&&Tt.end(s,e)}},Tt=Ot,Pt=[],St={list:{},add(t,...e){this.list[t]=!0,Pt.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Pt.forEach((t=>St.has(t,!0)))));const Rt=vt.get("UICreator"),Lt={list:{},register(t){const{__tag:e}=t.prototype;It[e]&&Rt.repeat(e),It[e]=t},get(t,e,s,r,i,n){It[t]||Rt.error("not register "+t);const o=new It[t](e);return void 0!==s&&(o.x=s,r&&(o.y=r),i&&(o.width=i),n&&(o.height=n)),o}},{list:It}=Lt,Mt=vt.get("EventCreator"),Et={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(At[e]&&Mt.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}=Et;class Wt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.canvas(t);return this.add(i),i}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)=>(Yt(e,t),Yt(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 Yt(t[i],e[i],s&&s[i]);s&&i in s?(null===(o=s[i])||void 0===o?void 0:o.constructor)===Object&&Yt(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}},{assign:Yt}=Nt;class Dt{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 Gt(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 Ht(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 Jt{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([Ht("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),Ut([Ht("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),Ut([Ht("globalAlpha")],Jt.prototype,"opacity",void 0),Ut([Ht()],Jt.prototype,"fillStyle",void 0),Ut([Ht()],Jt.prototype,"strokeStyle",void 0),Ut([Ht("lineWidth")],Jt.prototype,"strokeWidth",void 0),Ut([Ht("lineCap")],Jt.prototype,"strokeCap",void 0),Ut([Ht("lineJoin")],Jt.prototype,"strokeJoin",void 0),Ut([Ht("lineDashOffset")],Jt.prototype,"dashOffset",void 0),Ut([Ht()],Jt.prototype,"miterLimit",void 0),Ut([Ht()],Jt.prototype,"shadowBlur",void 0),Ut([Ht()],Jt.prototype,"shadowColor",void 0),Ut([Ht()],Jt.prototype,"shadowOffsetX",void 0),Ut([Ht()],Jt.prototype,"shadowOffsetY",void 0),Ut([Ht()],Jt.prototype,"filter",void 0),Ut([Ht()],Jt.prototype,"font",void 0),Ut([Ht()],Jt.prototype,"fontKerning",void 0),Ut([Ht()],Jt.prototype,"fontStretch",void 0),Ut([Ht()],Jt.prototype,"fontVariantCaps",void 0),Ut([Ht()],Jt.prototype,"textAlign",void 0),Ut([Ht()],Jt.prototype,"textBaseline",void 0),Ut([Ht()],Jt.prototype,"textRendering",void 0),Ut([Ht()],Jt.prototype,"wordSpacing",void 0),Ut([Ht()],Jt.prototype,"letterSpacing",void 0),Ut([Ht()],Jt.prototype,"direction",void 0),Ut([qt()],Jt.prototype,"setTransform",null),Ut([qt()],Jt.prototype,"resetTransform",null),Ut([qt()],Jt.prototype,"getTransform",null),Ut([qt()],Jt.prototype,"save",null),Ut([qt()],Jt.prototype,"restore",null),Ut([qt()],Jt.prototype,"translate",null),Ut([qt()],Jt.prototype,"scale",null),Ut([qt()],Jt.prototype,"rotate",null),Ut([qt()],Jt.prototype,"fill",null),Ut([qt()],Jt.prototype,"stroke",null),Ut([qt()],Jt.prototype,"clip",null),Ut([qt()],Jt.prototype,"fillRect",null),Ut([qt()],Jt.prototype,"strokeRect",null),Ut([qt()],Jt.prototype,"clearRect",null),Ut([qt()],Jt.prototype,"beginPath",null),Ut([qt()],Jt.prototype,"moveTo",null),Ut([qt()],Jt.prototype,"lineTo",null),Ut([qt()],Jt.prototype,"bezierCurveTo",null),Ut([qt()],Jt.prototype,"quadraticCurveTo",null),Ut([qt()],Jt.prototype,"closePath",null),Ut([qt()],Jt.prototype,"arc",null),Ut([qt()],Jt.prototype,"arcTo",null),Ut([qt()],Jt.prototype,"ellipse",null),Ut([qt()],Jt.prototype,"rect",null),Ut([qt()],Jt.prototype,"roundRect",null),Ut([qt()],Jt.prototype,"createConicGradient",null),Ut([qt()],Jt.prototype,"createLinearGradient",null),Ut([qt()],Jt.prototype,"createPattern",null),Ut([qt()],Jt.prototype,"createRadialGradient",null),Ut([qt()],Jt.prototype,"fillText",null),Ut([qt()],Jt.prototype,"measureText",null),Ut([qt()],Jt.prototype,"strokeText",null);const{copy:Zt,multiplyParent:$t}=v,{round:Kt}=Math,te={width:1,height:1,pixelRatio:1},ee=["width","height","pixelRatio"];class se extends Jt{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(e,r){super(),this.size={},this.worldTransform={},e||(e=te),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:n,pixelRatio:o}=e;this.autoLayout=!i||!n,this.size.pixelRatio=o|t.devicePixelRatio,this.config=e,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 dt(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,ot.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(ut.x,ut.y,ut.width,ut.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,ut.x,ut.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(ut.x,ut.y,ut.width,ut.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(ut.x,ut.y,ut.width,ut.height),s&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(ut.x,ut.y,ut.width,ut.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(ut.x,ut.y,ut.width,ut.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,s){ut.set(t),s&&ut.intersect(this.bounds),ut.scale(this.pixelRatio),e&&ut.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,s){const{size:r,pixelSnap:i}=this,n=this.manager?this.manager.get(r):e.canvas(Object.assign({},r));return n.save(),t&&(Zt(n.worldTransform,this.worldTransform),n.useWorldTransform()),s&&(n.smooth=this.smooth),n.pixelSnap!==i&&(n.pixelSnap=i),n}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 o=a.fourNumber(n,Math.min(r/2,i/2)),h=e+r,l=s+i;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(h,s,h,l,o[1]):t.lineTo(h,s),o[2]?t.arcTo(h,l,e,l,o[2]):t.lineTo(h,l),o[3]?t.arcTo(e,l,e,s,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,s,h,s,o[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}=j,{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)),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,h,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+=d),w===me||ye(p+f)<1e-12||ye(g+y)<1e-12)return t&&t.push(Oe,r,i),h&&(be(h,e,s),ve(h,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+u*v),C=i+B*_e(m+w/2+u*v);return m-=u*v,x-=u*v,Ee(t,k,C,a,a,0,m/l,x/l,b,h,c,_)},arc:(t,e,s,r,i,n,o,a,h,l)=>Ee(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,h,c,_,p){const f=n*l,g=_e(f),y=pe(f);let m=o*l,x=a*l;m>me&&(m-=d),x<0&&(x+=d);let w=x-m;w<0?w+=d:w>d&&(w-=d),h&&(w-=d);const b=ge(ye(w/u)),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,I,M=pe(m),E=_e(m),A=T=y*r*M-g*i*E,W=P=g*r*M+y*i*E,N=e+T,Y=s+P;t&&t.push(t.length?Oe:Ce,N,Y),c&&be(c,N,Y),p&&Be(p,N,Y);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*E+g*i*M),R=s+W-k*(g*r*E-y*i*M),L=e+T+k*(y*r*O+g*i*C),I=s+P+k*(g*r*O-y*i*C),t&&t.push(Te,S,R,L,I,e+T,s+P),c&&Me(e+A,s+W,S,R,L,I,e+T,s+P,c,!0),A=T,W=P,M=C,E=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){Me(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++)Ie(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 Ie(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:Ie,toTwoPointBounds:Me,ellipse:Ee}=Le,{sin:Ae,cos:We,sqrt:Ne,atan2:Ye}=Math,{ellipse:De}=Le,Xe={ellipticalArc(e,s,r,i,n,o,a,h,u,c,_){const p=(u-s)/2,f=(c-r)/2,g=o*l,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===h?-1:1)*Ne(C/(b*B+v*k));const T=O*i*w/n,P=-O*n*x/i,S=Ye((w-P)/n,(x-T)/i),R=Ye((-w-P)/n,(-x-T)/i);let L=R-S;0===h&&L>0?L-=d:1===h&&L<0&&(L+=d);const I=s+p+m*T-y*P,M=r+f+y*T+m*P,E=L<0?1:0;_||t.ellipseToCurve?De(e,I,M,i,n,o,S/l,R/l,E):i!==n||o?e.push(ne.G,I,M,i,n,o,S/l,R/l,E):e.push(ne.O,I,M,i,S/l,R/l,E)}},{M:ze,m:Fe,L:je,l:Ue,H:Ge,h:He,V:Ve,v:qe,C:Qe,c:Je,S:Ze,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=vt.get("PathConvert"),Bs={},ks={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,h="";for(;n<o;){r=t[n],s=ue[r],h+=r===i?" ":de[r];for(let r=1;r<s;r++)h+=a.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],wt[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 He:t[u+1]+=a;case Ge: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=Ze;case Ze:o=n===Qe||n===Ze,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 Je: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:Is,N:Ms,D:Es,X:As,G:Ws,F:Ns,O:Ys,P:Ds,U:Xs}=ne,{getMinDistanceFrom:zs,getRadianFrom:Fs}=E,{tan:js,min:Us,abs:Gs}=Math,Hs={},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(Is)},rect(t,e,s,r,i){t.push(Ms,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 o=a.fourNumber(n);o?t.push(Es,e,s,r,i,...o):t.push(Ms,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(Ds,e,s,r):(void 0===n&&(n=360),t.push(Ys,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*Gs(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,Hs),t.push(Ps,Hs.x,Hs.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,Hs),t.push(Ps,Hs.x,Hs.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:Js,lineTo:Zs,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 Js(this.__path,t,e),this.paint(),this}lineTo(t,e){return Zs(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=vt.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]*l,e[r+6]*l,e[r+7]*l,e[r+8]),r+=9;break;case wr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,d,!1),r+=5;break;case br:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*l,e[r+5]*l,e[r+6]),r+=7;break;case vr:t.arc(e[r+1],e[r+2],e[r+3],0,d,!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:Ir,X:Mr,G:Er,F:Ar,O:Wr,P:Nr,U:Yr}=ne,{toTwoPointBounds:Dr,toTwoPointBoundsByQuadraticCurve:Xr,arcTo:zr,arc:Fr,ellipse:jr}=Le,{addPointBounds:Ur,copy:Gr,addPoint:Hr,setPoint:Vr,addBounds:qr,toBounds:Qr}=j,Jr=vt.get("PathBounds");let Zr,$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],Hr(e,h,l),a+=3;break;case Pr:i=t[a+5],n=t[a+6],Dr(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 Ir:case Mr:h=t[a+1],l=t[a+2],qr(e,h,l,t[a+3],t[a+4]),a+=o===Ir?9:6;break;case Er: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?Gr(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?Gr(e,ti):Ur(e,ti),h=si.x,l=si.y,a+=7;break;case Nr:h=t[a+1],l=t[a+2],Zr=t[a+3],qr(e,h-Zr,l-Zr,2*Zr,2*Zr),h+=Zr,a+=4;break;case Yr:zr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ti,si),0===a?Gr(e,ti):Ur(e,ti),h=si.x,l=si.y,a+=6;break;default:return void Jr.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=0,o=0,a=0,h=0,l=0,d=0,u=0,c=0,_=0;const p=t.length,f=[];for(;n<p;)switch(r=t[n],r){case ii:h=c=t[n+1],l=_=t[n+2],n+=3,t[n]===ni?(d=t[n+1],u=t[n+2],f.push(ii,ai(h,d),hi(l,u))):f.push(ii,h,l);break;case ni:switch(o=t[n+1],a=t[n+2],n+=3,t[n]){case ni:li(f,o,a,t[n+1],t[n+2],e,c,_);break;case oi:li(f,o,a,h,l,e,c,_);break;default:f.push(ni,o,a)}c=o,_=a;break;case oi:li(f,h,l,d,u,e,c,_),f.push(oi),n+=1;break;default:i=ue[r];for(let e=0;e<i;e++)f.push(t[n+e]);n+=i}return r!==oi&&(f[1]=h,f[2]=l),f}};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={opacityTypes:["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.opacityTypes.forEach((t=>fi.upperCaseTypeMap[t]=t.toUpperCase()));const gi=vt.get("TaskProcessor");class yi{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Gt(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=vt.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,s,r){let i;return"string"==typeof s?i={url:s}:s.url||(i={url:t,view:s}),i&&(r&&(i.format=r),s=e.image(i)),bi.set(t,s),s},destroy(){bi.map={}}},bi=wi,vi={maxRecycled:10,recycledList:[],patternTasker:new mi,get(t){let s=wi.get(t.url);return s||wi.set(t.url,s=e.image(t)),s.use++,s},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)},hasOpacityPixel:t=>pi.opacityTypes.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}=s;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.hasOpacityPixel(t)&&(this.hasOpacityPixel=!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((()=>Gt(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=null)}catch(t){}return i&&(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 Ii(t){return Si(t)}function Mi(t,e){return Si(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Ei(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Di(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)&&Di(this)}})))}function Yi(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&(Di(this),this.__.__removeNaturalSize())}})))}function Di(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),Di(this)}})))}const zi=Ni;function Fi(t){return Si(t,(t=>({set(e){this.__setAttr(t,e)&&ji(this)}})))}function ji(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Di(t)}const Ui=Fi;function Gi(t){return Si(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Hi(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",(()=>Ji(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Ji(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 Ji(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||Di(t))}function Zi(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"===vt.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 vt("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=>{Et.register(t)}}setTimeout((()=>un(!0)));const{copy:fn,toInnerPoint:gn,toOuterPoint:yn,scaleOfOuter:mn,rotateOfOuter:xn,skewOfOuter:wn,multiplyParent:bn,divideParent:vn,getLayout:Bn}=v,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(In(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,Mn(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,Mn(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:a.formatRotation(t.rotation+s)},r)},skewOfWorld(t,e,s,r,i,n){Tn.skewOfLocal(t,Mn(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){ot.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 gt.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:In}=Tn;function Mn(t,e){return t.__layout.update(),t.parent?E.tempToInnerOf(e,t.parent.__world):e}const En={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++)Yn(e[t],e)},updateBounds(t,e){const s=[t];Yn(t,s),Dn(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:Yn,updateBoundsByBranchStack:Dn}=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}=On,{toOuterOf:Fn,getPoints:jn,copy:Un}=ot,Gn="_localContentBounds",Hn="_worldContentBounds",Vn="_worldBoxBounds",qn="_worldStrokeBounds";class Qn{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 Fn(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 Fn(this.contentBounds,this.leaf.__world,this[Hn]||(this[Hn]={})),this[Hn]}get worldBoxBounds(){return Fn(this.boxBounds,this.leaf.__world,this[Vn]||(this[Vn]={})),this[Vn]}get worldStrokeBounds(){return Fn(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{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;const s=e;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__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 v.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 dt(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=v.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(a,e),n=zn(r,e,!0)}if(o||(o=v.getLayout(n)),Un(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=jn(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=!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 Zn extends Jn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Zn.ADD="child.add",Zn.REMOVE="child.remove",Zn.CREATED="created",Zn.MOUNTED="mounted",Zn.UNMOUNTED="unmounted",Zn.DESTROY="destroy";class $n extends Jn{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}$n.CHANGE="property.change",$n.LEAFER_CHANGE="property.leafer_change";class Kn extends Jn{constructor(t,e){super(t),Object.assign(this,e)}}Kn.LOAD="image.load",Kn.LOADED="image.loaded",Kn.ERROR="image.error";class to 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(to.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}to.RESIZE="resize";class eo extends Jn{constructor(t,e){super(t),this.data=e}}eo.REQUEST="watch.request",eo.DATA="watch.data";class so extends Jn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}so.REQUEST="layout.request",so.START="layout.start",so.BEFORE="layout.before",so.LAYOUT="layout",so.AFTER="layout.after",so.AGAIN="layout.again",so.END="layout.end";class ro extends Jn{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}ro.REQUEST="render.request",ro.CHILD_START="render.child_start",ro.CHILD_END="render.child_end",ro.START="render.start",ro.BEFORE="render.before",ro.RENDER="render",ro.AFTER="render.after",ro.AGAIN="render.again",ro.END="render.end",ro.NEXT="render.next";class io extends Jn{}io.START="leafer.start",io.BEFORE_READY="leafer.before_ready",io.READY="leafer.ready",io.AFTER_READY="leafer.after_ready",io.VIEW_READY="leafer.view_ready",io.VIEW_COMPLETED="leafer.view_completed",io.STOP="leafer.stop",io.RESTART="leafer.restart",io.END="leafer.end";const no={};class oo{set event(t){this.on(t)}on(t,e,s){if(!e){let e,s=t;for(let t in s)e=s[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let r,i,n;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const o=ao(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])}))}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=ao(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]))}))}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 s&&(e=e.bind(s)),this.on(t,e,r),{type:t,current:this,listener:e,options:r}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0}once(t,e,s){this.on(t,e,{once:!0,capture:s})}emit(t,e,s){!e&&Et.has(t)&&(e=Et.get(t,{type:t,target:this,current:this}));const r=ao(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 ao(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:no)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:no)}}const{on:ho,on_:lo,off:uo,off_:co,once:_o,emit:po,emitEvent:fo,hasEvent:go,destroy:yo}=oo.prototype,mo={on:ho,on_:lo,off:uo,off_:co,once:_o,emit:po,emitEvent:fo,hasEvent:go,destroyEventer:yo},{isFinite:xo}=Number,wo=vt.get("setAttr"),bo={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(s&&!xo(e)&&void 0!==e&&(wo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=$n,i=new $n(s,this,t,r,e);return this.isLeafer?this.emitEvent(new $n($n.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:vo,multiplyParent:Bo,translateInner:ko,defaultWorld:Co}=v,{toPoint:Oo,tempPoint:To}=gt,Po={__updateWorldMatrix(){Bo(this.__local||this.__layout,this.parent?this.parent.__world:Co,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.rotationChanged)&&(vo(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(Oo(s.around||s.origin,t.boxBounds,To),ko(e,-To.x,-To.y,!s.around))}this.__layout.matrixChanged=!1}},{updateMatrix:So,updateAllMatrix:Ro}=On,{updateBounds:Lo}=Wn,{toOuterOf:Io,copyAndSpread:Mo,copy:Eo}=ot,{toBounds:Ao}=ri,Wo={__updateWorldBounds(){Io(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Io(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Io(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Io(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Ao(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(),Ro(this),Lo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ro(this),Lo(this,this))):So(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Mo(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Mo(t.renderBounds,t.boxBounds,t.renderSpread):Eo(t.renderBounds,t.strokeBounds)}},No={__render(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);vt.showBounds&&vt.drawBounds(this,t,e)}},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.windingRule?t.clip(this.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Yo}=En,Do={__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++)Yo(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++)Yo(s[r],e)||s[r].__clip(t,e)}}},{LEAF:Xo,create:zo}=s,{toInnerPoint:Fo,toOuterPoint:jo,multiplyParent:Uo}=v,{toOuterOf:Go}=ot,{copy:Ho,move:Vo}=E,{moveLocal:qo,zoomOfLocal:Qo,rotateOfLocal:Jo,skewOfLocal:Zo,moveWorld:$o,zoomOfWorld:Ko,rotateOfWorld:ta,skewOfWorld:ea,transform:sa,transformWorld:ra,setTransform:ia,getFlipTransform:na,getLocalOrigin:oa,getRelativeWorld:aa,drop:ha}=On;let la=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 Dt}get __LayoutProcessor(){return Qn}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=zo(Xo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Zn.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(Zn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Zn.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(Zn.MOUNTED)):this.__emitLifeEvent(Zn.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 Uo(s,t.matrix,e,void 0,s),Go(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?aa(this,e):this.worldTransform,i=s?t:{};return Go(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&Ho(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&Ho(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),Fo(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){jo(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 Vo(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 Vo(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){ia(this,t,e,s)}transform(t,e,s){sa(this,t,e,s)}move(t,e,s){qo(this,t,e,s)}moveInner(t,e,s){$o(this,t,e,!0,s)}scaleOf(t,e,s,r,i){Qo(this,oa(this,t),e,s,r,i)}rotateOf(t,e,s){Jo(this,oa(this,t),e,s)}skewOf(t,e,s,r,i){Zo(this,oa(this,t),e,s,r,i)}transformWorld(t,e,s){ra(this,t,e,s)}moveWorld(t,e,s){$o(this,t,e,!1,s)}scaleOfWorld(t,e,s,r,i){Ko(this,t,e,s,r,i)}rotateOfWorld(t,e){ta(this,t,e)}skewOfWorld(t,e,s,r,i){ea(this,t,e,s,r,i)}flip(t,e){sa(this,na(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,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return St.need("path")}getMotionPoint(t){return St.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){ha(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}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 Zn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Zn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};la=Ut([cn(bo),cn(Po),cn(Wo),cn(mo),cn(No)],la);const{setListWithFn:da}=ot,{sort:ua}=Wn,{localBoxBounds:ca,localStrokeBounds:_a,localRenderBounds:pa,maskLocalBoxBounds:fa,maskLocalStrokeBounds:ga,maskLocalRenderBounds:ya}=En,ma=new vt("Branch");let xa=class extends la{__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(){da(this.__layout.boxBounds,this.children,this.__hasMask?fa:ca)}__updateStrokeBounds(){da(this.__layout.strokeBounds,this.children,this.__hasMask?ga:_a)}__updateRenderBounds(){da(this.__layout.renderBounds,this.children,this.__hasMask?ya:pa)}__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(ua),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ma.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(Zn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Zn.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(Zn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Zn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Zn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};xa=Ut([cn(Do)],xa);class wa{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 wa;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 ba{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 va="1.6.2";export{xt as AlignHelper,Xt as Answer,gt as AroundHelper,ct as AutoBounds,Le as BezierHelper,dt as Bounds,ot as BoundsHelper,xa as Branch,Wn as BranchHelper,Do as BranchRender,Wt as CanvasManager,Zn as ChildEvent,e as Creator,Nt as DataHelper,vt as Debug,_t as Direction4,pt as Direction9,Xe as EllipseHelper,Jn as Event,Et as EventCreator,oo as Eventer,pi as FileHelper,Kn as ImageEvent,vi as ImageManager,s as IncrementId,so as LayoutEvent,la as Leaf,Wo as LeafBounds,En as LeafBoundsHelper,Dt as LeafData,bo as LeafDataProxy,mo as LeafEventer,On as LeafHelper,Qn as LeafLayout,ba as LeafLevelList,wa as LeafList,Po as LeafMatrix,No as LeafRender,se as LeaferCanvasBase,io as LeaferEvent,Oi as LeaferImage,a as MathHelper,z as Matrix,v as MatrixHelper,ae as NeedConvertToCanvasCommandMap,l as OneRadian,d as PI2,u 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,St as Plugin,D as Point,E as PointHelper,$n as PropertyEvent,ce as RectHelper,ro as RenderEvent,to as ResizeEvent,wi as Resource,Ot as Run,wt as StringNumberMap,yi as TaskItem,mi as TaskProcessor,j as TwoPointBoundsHelper,Lt as UICreator,Xn as WaitHelper,eo as WatchEvent,Gi as affectRenderBoundsType,Fi as affectStrokeBoundsType,Ri as attr,Ei as autoLayoutType,Ni as boundsType,_i as canvasPatch,ee as canvasSizeAttrs,en as cursorType,sn as dataProcessor,Ii as dataType,Si as decorateLeafAttr,nn as defineDataProcessor,Ti as defineKey,Li as defineLeafAttr,Di as doBoundsType,ji as doStrokeType,zt as emptyData,Ki as eraserType,_ as getBoundsData,Pi as getDescriptor,p as getMatrixData,c as getPointData,tn as hitType,jt as isEmptyData,Ft as isNull,rn as layoutProcessor,$i as maskType,Yi as naturalBoundsType,Vi as opacityType,Xi as pathInputType,zi as pathType,ui as pen,Mi as positionType,_n as registerUI,pn as registerUIEvent,ln as rewrite,dn as rewriteAble,Wi as rotationType,Ai as scaleType,Zi as sortType,Ui as strokeType,Hi as surfaceType,ut as tempBounds,F as tempMatrix,X as tempPoint,cn as useModule,va as version,qi as visibleType};
|
|
2
2
|
//# sourceMappingURL=core.esm.min.js.map
|