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