leafer-ui 1.10.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.js +54 -34
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +55 -35
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";var e;t.Answer=void 0,(e=t.Answer||(t.Answer={}))[e.No=0]="No",e[e.Yes=1]="Yes",e[e.NoAndSkip=2]="NoAndSkip",e[e.YesAndSkip=3]="YesAndSkip";const i={};function s(t){return void 0===t}function r(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:o}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return"{}"===JSON.stringify(t)}const u={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,o;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return _(t[r],e[r],i&&i[r]);i&&r in i?(null===(o=i[r])||void 0===o?void 0:o.constructor)===Object&&_(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:_}=u;class p{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(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let r in this)"_"!==r[0]&&(i=e?e[r]:void 0,t[r]=s(i)?this[r]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(l(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:r}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=r?r[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:o}}return i}__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{floor:g,max:f}=Math,y={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||m.maxCacheSize),isSuperLarge:(t,e,i)=>m.isLarge(t,e,i,m.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=y.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,o,a,h){const l=y.origin.createCanvas(f(g(e+(s||0)),1),f(g(i+(r||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,n){const s=e/n.width,r=i/n.height;d.setTransform(s,0,0,r,-n.x*s,-n.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&u.stintSet(i,"transform",e)}}},{image:m}=y,v={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=v;let x,b,E;const{max:P}=Math,B=[0,0,0,0],k={zero:[...B],tempFour:B,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>S(B,t,e,i,s),toTempAB(t,e,i){E=i?a(t)?e:t:[],a(t)?(x=R(t),b=e):a(e)?(x=t,b=R(e)):(x=t,b=e),4!==x.length&&(x=T(x)),4!==b.length&&(b=T(b))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?P(t,e):(C(t,e,i),S(E,P(x[0],b[0]),P(x[1],b[1]),P(x[2],b[2]),P(x[3],b[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(C(t,e,i),S(E,x[0]+b[0],x[1]+b[1],x[2]+b[2],x[3]+b[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,o,h,l]=4===t.length?t:T(t);return S(r,h*i,l*e,n*i,o*e)}},{set:S,get:T,setTemp:R,toTempAB:C}=k,{round:L,pow:O,max:D,floor:I,PI:A}=Math,M={within:(t,e,i)=>(d(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:O(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(a(e)?e:e.width||0)/i.width,r=(a(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&M.assignScale(s,t);return s},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(I(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const F=A/180,U=2*A,z=A/2;function N(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:j,acos:V,sqrt:G}=Math,{float:K}=M,q={};function Z(){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 $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Z(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,o=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=o},get:X,getWorld:Z,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,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){Q.toInnerPoint(t,e,q),Q.scaleOfInner(t,q,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,o=j(e*=F),a=H(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=r*o-n*a,t.d=r*a+n*o},rotateOfOuter(t,e,i){Q.toInnerPoint(t,e,q),Q.rotateOfInner(t,q,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:o}=t;i&&(i*=F,t.a=s+n*i,t.b=r+o*i),e&&(e*=F,t.c=n+s*e,t.d=o+r*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,q),Q.skewOfInner(t,q,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:o,f:a}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+o,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,r,n){const{e:o,f:a}=t;if(i||(i=t),s(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){Q.multiply(t,Q.tempInvert(e))},divideParent(t,e){Q.multiplyParent(t,Q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Q;return Q.copy(e,t),Q.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:o}=t;if(i||s){const a=1/(e*r-i*s);t.a=r*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*r-o*s)*a,t.f=-(o*e-n*i)*a}else if(1===e&&1===r)t.e=-n,t.f=-o;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:o,d:a}=t,h=1/(r*a-n*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,r,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*F,o=j(n),a=H(n);if(s||r){const e=s*F,i=r*F;t.a=(o+i*-a)*h,t.b=(a+i*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,(i=i||r)&&Q.translateInner(t,-i.x,-i.y,!r)},getLayout(t,e,i,s){const{a:r,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||o){const t=r*a-n*o;if(o&&!s){d=G(r*r+n*n),c=t/d;const e=r/d;u=n>0?V(e):-V(e)}else{c=G(o*o+a*a),d=t/c;const e=o/c;u=z-(a>0?V(-e):-V(e))}const e=K(j(u)),i=H(u);d=K(d),c=K(c),_=e?K((o/c+i)/e/F,9):0,p=e?K((n/d-i)/e/F,9):0,u=K(u/F)}else d=r,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*o,f+=e.x*n+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:o}=t;r||n?i=(s*o-r*n)/(e=G(s*s+r*r)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=$,{toInnerPoint:J,toOuterPoint:tt}=$,{sin:et,cos:it,abs:st,sqrt:rt,atan2:nt,min:ot,round:at}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,i){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=lt.defaultPoint);const s=it(e*=F),r=et(e),n=t.x-i.x,o=t.y-i.y;t.x=i.x+n*s-o*r,t.y=i.y+n*r+o*s},tempToInnerOf(t,e){const{tempPoint:i}=lt;return ct(i,t),J(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=lt;return ct(i,t),tt(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=lt;return ct(i,t),lt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),J(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){J(e,t,i)},toOuterOf(t,e,i){tt(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=st(i-t),n=st(s-e);return rt(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>ot(dt(t,e,i,s),dt(i,s,r,n)),getAngle:(t,e)=>ut(t,e)/F,getRotation:(t,e,i,s)=>(s||(s=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/F),getRadianFrom(t,e,i,r,n,o,a,h){s(a)&&(a=i,h=r);const l=t-i,d=e-r,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>nt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const r=ut(t,e);return(e=s?e:{}).x=t.x+it(r)*i,e.y=t.y+et(r)*i,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,getAtan2:ut}=lt;class _t{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,i){return ht.scaleOf(this,t,e,i),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,i){return ht.getRotation(this,t,e,i)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new _t(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,i){return new _t(ht.getDistancePoint(this,t,e,i))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}reset(){return ht.reset(this),this}}const pt=new _t;class gt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return d(t)?$.copy(this,t):$.set(this,t,e,i,s,r,n),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new gt(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const ft=new gt,yt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){mt(t,e,i),mt(t,e+s,i+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:mt}=yt;var vt,wt;t.Direction4=void 0,(vt=t.Direction4||(t.Direction4={}))[vt.top=0]="top",vt[vt.right=1]="right",vt[vt.bottom=2]="bottom",vt[vt.left=3]="left",t.Direction9=void 0,(wt=t.Direction9||(t.Direction9={}))[wt.topLeft=0]="topLeft",wt[wt.top=1]="top",wt[wt.topRight=2]="topRight",wt[wt.right=3]="right",wt[wt.bottomRight=4]="bottomRight",wt[wt.bottom=5]="bottom",wt[wt.bottomLeft=6]="bottomLeft",wt[wt.left=7]="left",wt[wt.center=8]="center",wt[wt["top-left"]=0]="top-left",wt[wt["top-right"]=2]="top-right",wt[wt["bottom-right"]=4]="bottom-right",wt[wt["bottom-left"]=6]="bottom-left";const xt=[{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}];xt.forEach(t=>t.type="percent");const bt={directionData:xt,tempPoint:{},get:Et,toPoint(t,e,i,s,r,n){const o=Et(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),o.x&&(i.x-=1===o.x?r.width:.5===o.x?o.x*r.width:0),o.y&&(i.y-=1===o.y?r.height:.5===o.y?o.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function Et(e){return n(e)?xt[t.Direction9[e]]:e}const{toPoint:Pt}=bt,Bt={toPoint(t,e,i,s,r,n){Pt(t,i,s,r,e,n)}},{tempPointBounds:kt,setPoint:St,addPoint:Tt,toBounds:Rt}=yt,{toOuterPoint:Ct}=$,{float:Lt,fourNumber:Ot}=M,{floor:Dt,ceil:It}=Math;let At,Mt,Wt,Ft;const Ut={},zt={},Nt={},Yt={tempBounds:Nt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:o,width:a,height:h}=e;if(l(i)){const e=Ot(i);s?Xt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Xt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Xt.set(t,n-i,o-i,a+2*i,h+2*i);r&&("width"===r?(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,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Xt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?jt(e,t):e=t,i||(i=t),e.offsetX=Xt.maxX(i),e.offsetY=Xt.maxY(i),Xt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ht.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ht.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Xt.copy(Nt,t),Xt.toOuterOf(Nt,e),Nt),getOuterOf:(t,e)=>(t=Object.assign({},t),Xt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:o}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=o+t.y*r):(i.height=t.height*-r,i.y=o+t.y*r-i.height)}else Ut.x=t.x,Ut.y=t.y,Ct(e,Ut,zt),St(kt,zt.x,zt.y),Ut.x=t.x+t.width,Ct(e,Ut,zt),Tt(kt,zt.x,zt.y),Ut.y=t.y+t.height,Ct(e,Ut,zt),Tt(kt,zt.x,zt.y),Ut.x=t.x,Ct(e,Ut,zt),Tt(kt,zt.x,zt.y),Rt(kt,i)},toInnerOf(t,e,i){i||(i=t),Xt.move(i,-e.e,-e.f),Xt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Xt.getFitScale(t,e));return new gt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,o){o||(o=e),n(s)&&(s=Xt.getFitScale(t,e,"cover"===s)),Nt.width=r?e.width*=s:e.width*s,Nt.height=r?e.height*=s:e.height*s,Bt.toPoint(i,Nt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Xt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Xt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Xt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=i>t.y?It(t.height+i-t.y):It(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,i){At=t.x+t.width,Mt=t.y+t.height,Wt=e.x,Ft=e.y,i||(Wt+=e.width,Ft+=e.height),At=At>Wt?At:Wt,Mt=Mt>Ft?Mt:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=At-t.x,t.height=Mt-t.y},addList(t,e){Xt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Xt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Xt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=i?i(e[o],o):e[o],r&&(r.width||r.height)&&(n?(n=!1,s||jt(t,r)):Ht(t,r));n&&Xt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?St(kt,t.x,t.y):Tt(kt,t.x,t.y)),Rt(kt,t)},setPoint(t,e){Xt.set(t,e.x,e.y)},addPoint(t,e){Ht(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ht.tempToInnerRadiusPointOf(e,i)),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,i)=>(i&&(e=ht.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),!(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,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),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,i){if(i&&(e=Xt.tempToOuterOf(e,i)),!Xt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:o}=e;return At=s+n,Mt=r+o,Wt=t.x+t.width,Ft=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,At=At<Wt?At:Wt,Mt=Mt<Ft?Mt:Ft,n=At-s,o=Mt-r,{x:s,y:r,width:n,height:o}},intersect(t,e,i){Xt.copy(t,Xt.getIntersectData(t,e,i))},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){Xt.set(t)}},Xt=Yt,{add:Ht,copy:jt}=Xt;class Vt{get minX(){return Yt.minX(this)}get minY(){return Yt.minY(this)}get maxX(){return Yt.maxX(this)}get maxY(){return Yt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?Yt.copy(this,t):Yt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Vt(this)}move(t,e){return Yt.move(this,t,e),this}scale(t,e,i){return Yt.scale(this,t,e,i),this}scaleOf(t,e,i){return Yt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Yt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Yt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Yt.getFitMatrix(this,t,e)}put(t,e,i){Yt.put(this,t,e,i)}spread(t,e){return Yt.spread(this,t,e),this}shrink(t,e){return Yt.shrink(this,t,e),this}ceil(){return Yt.ceil(this),this}unsign(){return Yt.unsign(this),this}float(t){return Yt.float(this,t),this}add(t){return Yt.add(this,t),this}addList(t){return Yt.setList(this,t,!0),this}setList(t){return Yt.setList(this,t),this}addListWithFn(t,e){return Yt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Yt.setListWithFn(this,t,e),this}setPoint(t){return Yt.setPoint(this,t),this}setPoints(t){return Yt.setPoints(this,t),this}addPoint(t){return Yt.addPoint(this,t),this}getPoints(){return Yt.getPoints(this)}hitPoint(t,e){return Yt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Yt.hitRadiusPoint(this,t,e)}hit(t,e){return Yt.hit(this,t,e)}includes(t,e){return Yt.includes(this,t,e)}intersect(t,e){return Yt.intersect(this,t,e),this}getIntersect(t,e){return new Vt(Yt.getIntersectData(this,t,e))}isSame(t){return Yt.isSame(this,t)}isEmpty(){return Yt.isEmpty(this)}reset(){Yt.reset(this)}}const Gt=new Vt;class Kt{constructor(t,e,i,s,r,n){d(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=t;this.set(e,i,s,r,n,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=this;return new Vt(r,e,n||t.width-r-i,o||t.height-e-s)}}const qt={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:Zt}=M;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=Qt(t)}static set exclude(t){this.excludeList=Qt(t)}static drawRepaint(t,e){const i=Zt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===$t.showBounds,r=t.__nowWorld,n=Zt();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(Jt.enable){if(Jt.filterList.length&&Jt.filterList.every(t=>t!==this.name))return;if(Jt.excludeList.length&&Jt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Jt.enable&&this.warn(...t)}warn(...t){Jt.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 Qt(t){return t?n(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const Jt=$t,te=$t.get("RunTime"),ee={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=v.create(v.RUNTIME);return ie.currentId=ie.idMap[i]=e?performance.now():Date.now(),ie.currentName=ie.nameMap[i]=t,ie.nameToIdMap[t]=i,i},end(t,e){const i=ie.idMap[t],s=ie.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;ie.idMap[t]=ie.nameMap[t]=ie.nameToIdMap[s]=void 0,te.log(s,r,"ms")},endOfName(t,e){const i=ie.nameToIdMap[t];s(i)||ie.end(i,e)}},ie=ee,se=[],re={list:{},add(t,...e){this.list[t]=!0,se.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>se.forEach(t=>re.has(t,!0)));const ne={editor:t=>re.need("editor")},oe=$t.get("UICreator"),ae={list:{},register(t){const{__tag:e}=t.prototype;he[e]&&oe.repeat(e),he[e]=t},get(t,e,i,r,n,o){he[t]||oe.error("not register "+t);const a=new he[t](e);return s(i)||(a.x=i,r&&(a.y=r),n&&(a.width=n),o&&(a.height=o)),a}},{list:he}=ae,le=$t.get("EventCreator"),de={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(ce[e]&&le.repeat(e),ce[e]=t)})},changeName(t,e){const i=ce[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ce[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ce[t](...e)},{nameList:ce}=de;class ue{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ne.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],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 _e(t,e,i,s){var r,n=arguments.length,o=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,i,o):r(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o}function pe(t,e,i,s){return new(i||(i=Promise))(function(r,n){function o(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}function ge(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const fe=[];function ye(){return(t,e)=>{fe.push(e)}}const me=[];class ve{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||me)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;fe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/r*h;r+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}_e([ge("imageSmoothingEnabled")],ve.prototype,"smooth",void 0),_e([ge("imageSmoothingQuality")],ve.prototype,"smoothLevel",void 0),_e([ge("globalAlpha")],ve.prototype,"opacity",void 0),_e([ge()],ve.prototype,"fillStyle",void 0),_e([ge()],ve.prototype,"strokeStyle",void 0),_e([ge("lineWidth")],ve.prototype,"strokeWidth",void 0),_e([ge("lineCap")],ve.prototype,"strokeCap",void 0),_e([ge("lineJoin")],ve.prototype,"strokeJoin",void 0),_e([ge("lineDashOffset")],ve.prototype,"dashOffset",void 0),_e([ge()],ve.prototype,"miterLimit",void 0),_e([ge()],ve.prototype,"shadowBlur",void 0),_e([ge()],ve.prototype,"shadowColor",void 0),_e([ge()],ve.prototype,"shadowOffsetX",void 0),_e([ge()],ve.prototype,"shadowOffsetY",void 0),_e([ge()],ve.prototype,"filter",void 0),_e([ge()],ve.prototype,"font",void 0),_e([ge()],ve.prototype,"fontKerning",void 0),_e([ge()],ve.prototype,"fontStretch",void 0),_e([ge()],ve.prototype,"fontVariantCaps",void 0),_e([ge()],ve.prototype,"textAlign",void 0),_e([ge()],ve.prototype,"textBaseline",void 0),_e([ge()],ve.prototype,"textRendering",void 0),_e([ge()],ve.prototype,"wordSpacing",void 0),_e([ge()],ve.prototype,"letterSpacing",void 0),_e([ge()],ve.prototype,"direction",void 0),_e([ye()],ve.prototype,"setTransform",null),_e([ye()],ve.prototype,"resetTransform",null),_e([ye()],ve.prototype,"getTransform",null),_e([ye()],ve.prototype,"save",null),_e([ye()],ve.prototype,"restore",null),_e([ye()],ve.prototype,"translate",null),_e([ye()],ve.prototype,"scale",null),_e([ye()],ve.prototype,"rotate",null),_e([ye()],ve.prototype,"fill",null),_e([ye()],ve.prototype,"stroke",null),_e([ye()],ve.prototype,"clip",null),_e([ye()],ve.prototype,"fillRect",null),_e([ye()],ve.prototype,"strokeRect",null),_e([ye()],ve.prototype,"clearRect",null),_e([ye()],ve.prototype,"beginPath",null),_e([ye()],ve.prototype,"moveTo",null),_e([ye()],ve.prototype,"lineTo",null),_e([ye()],ve.prototype,"bezierCurveTo",null),_e([ye()],ve.prototype,"quadraticCurveTo",null),_e([ye()],ve.prototype,"closePath",null),_e([ye()],ve.prototype,"arc",null),_e([ye()],ve.prototype,"arcTo",null),_e([ye()],ve.prototype,"ellipse",null),_e([ye()],ve.prototype,"rect",null),_e([ye()],ve.prototype,"roundRect",null),_e([ye()],ve.prototype,"createConicGradient",null),_e([ye()],ve.prototype,"createLinearGradient",null),_e([ye()],ve.prototype,"createPattern",null),_e([ye()],ve.prototype,"createRadialGradient",null),_e([ye()],ve.prototype,"fillText",null),_e([ye()],ve.prototype,"measureText",null),_e([ye()],ve.prototype,"strokeText",null);const{copy:we,multiplyParent:xe,pixelScale:be}=$,{round:Ee}=Math,Pe=new Vt,Be=new Vt,ke={width:1,height:1,pixelRatio:1},Se=["width","height","pixelRatio"];class Te extends ve{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=ke),this.manager=e,this.innerId=v.create(v.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||y.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;u.copyAttrs(s,t,Se),Se.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Vt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&xe(t,e,r),be(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Ee(r.e-.5)+.5,r.f=Ee(r.f-.5)+.5):(r.e=Ee(r.e),r.f=Ee(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:r,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=r,this.dashPattern=n,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,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Be):i=Pe,this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Yt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Pe.x,Pe.y,Pe.width,Pe.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Pe.x,Pe.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Pe.x,Pe.y,Pe.width,Pe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Pe.x,Pe.y,Pe.width,Pe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Pe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Be,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):ne.canvas(Object.assign({},i));return r.save(),t&&(we(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Re={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ce={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=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},Ce),Oe={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},De={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ie=Object.assign(Object.assign({},De),Ce),Ae=Le,Me={};for(let t in Ae)Me[Ae[t]]=t;const We={};for(let t in Ae)We[Ae[t]]=Oe[t];const Fe={drawRoundRect(t,e,i,s,r,n){const o=M.fourNumber(n,Math.min(s/2,r/2)),a=e+s,h=i+r;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Ue,cos:ze,hypot:Ne,atan2:Ye,ceil:Xe,abs:He,PI:je,sqrt:Ve,pow:Ge}=Math,{setPoint:Ke,addPoint:qe}=yt,{set:Ze,toNumberPoints:$e}=ht,{M:Qe,L:Je,C:ti,Q:ei,Z:ii}=Le,si={},ri={points(t,e,i,s){let r=$e(e);if(t.push(Qe,r[0],r[1]),i&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===i?.5:i;s&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let i=2;i<y-2;i+=2)e=r[i-2],n=r[i-1],o=r[i],a=r[i+1],h=r[i+2],l=r[i+3],p=Ve(Ge(o-e,2)+Ge(a-n,2)),g=Ve(Ge(h-o,2)+Ge(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=o-p*h,c=a-p*l,2===i?s||t.push(ei,d,c,o,a):t.push(ti,u,_,d,c,o,a),u=o+g*h,_=a+g*l);s||t.push(ei,u,_,r[y-2],r[y-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(Je,r[e],r[e+1]);s&&t.push(ii)},rect(t,e,i,s,r){Re.creator.path=t,Re.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Re.creator.path=[],Fe.drawRoundRect(Re.creator,e,i,s,r,n),t.push(...Re.convertToCanvasData(Re.creator.path,!0))},arcTo(t,e,i,s,r,n,o,a,h,l,d){const c=s-e,u=r-i,_=n-s,p=o-r;let g=Ye(u,c),f=Ye(p,_);const y=Ne(c,u),m=Ne(_,p);let v=f-g;if(v<0&&(v+=U),y<1e-12||m<1e-12||v<1e-12||He(v-je)<1e-12)return t&&t.push(Je,s,r),h&&(Ke(h,e,i),qe(h,s,r)),d&&Ze(d,e,i),void(l&&Ze(l,s,r));const w=c*p-_*u<0,x=w?-1:1,b=a/ze(v/2),E=s+b*ze(g+v/2+z*x),P=r+b*Ue(g+v/2+z*x);return g-=z*x,f-=z*x,ai(t,E,P,a,a,0,g/F,f/F,w,h,l,d)},arc:(t,e,i,s,r,n,o,a,h,l)=>ai(t,e,i,s,s,0,r,n,o,a,h,l),ellipse(t,e,i,s,r,n,o,a,h,l,d,c){const u=n*F,_=Ue(u),p=ze(u);let g=o*F,f=a*F;g>je&&(g-=U),f<0&&(f+=U);let y=f-g;y<0?y+=U:y>U&&(y-=U),h&&(y-=U);const m=Xe(He(y/z)),v=y/m,w=Ue(v/4),x=8/3*w*w/Ue(v/2);f=g+v;let b,E,P,B,k,S,T,R,C=ze(g),L=Ue(g),O=P=p*s*C-_*r*L,D=B=_*s*C+p*r*L,I=e+P,A=i+B;t&&t.push(t.length?Je:Qe,I,A),l&&Ke(l,I,A),c&&Ze(c,I,A);for(let n=0;n<m;n++)b=ze(f),E=Ue(f),P=p*s*b-_*r*E,B=_*s*b+p*r*E,k=e+O-x*(p*s*L+_*r*C),S=i+D-x*(_*s*L-p*r*C),T=e+P+x*(p*s*E+_*r*b),R=i+B+x*(_*s*E-p*r*b),t&&t.push(ti,k,S,T,R,e+P,i+B),l&&oi(e+O,i+D,k,S,T,R,e+P,i+B,l,!0),O=P,D=B,C=b,L=E,g=f,f+=v;d&&Ze(d,e+P,i+B)},quadraticCurveTo(t,e,i,s,r,n,o){t.push(ti,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,o,a){oi(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,o,a)},toTwoPointBounds(t,e,i,s,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?qe(h,t,e):Ke(h,t,e),qe(h,o,a);for(let l=0,c=d.length;l<c;l++)ni(d[l],t,e,i,s,r,n,o,a,si),qe(h,si.x,si.y)},getPointAndSet(t,e,i,s,r,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*a,l.y=c*i+u*r+_*o+p*h},getPoint(t,e,i,s,r,n,o,a,h){const l={};return ni(t,e,i,s,r,n,o,a,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:ni,toTwoPointBounds:oi,ellipse:ai}=ri,{sin:hi,cos:li,sqrt:di,atan2:ci}=Math,{ellipse:ui}=ri,_i={ellipticalArc(t,e,i,s,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*F,p=hi(_),g=li(_),f=-g*c-p*u,m=-g*u+p*c,v=s*s,w=r*r,x=m*m,b=f*f,E=v*w-v*x-w*b;let P=0;if(E<0){const t=di(1-E/(v*w));s*=t,r*=t}else P=(o===a?-1:1)*di(E/(v*x+w*b));const B=P*s*m/r,k=-P*r*f/s,S=ci((m-k)/r,(f-B)/s),T=ci((-m-k)/r,(-f-B)/s);let R=T-S;0===a&&R>0?R-=U:1===a&&R<0&&(R+=U);const C=e+c+g*B-p*k,L=i+u+p*B+g*k,O=R<0?1:0;d||y.ellipseToCurve?ui(t,C,L,s,r,n,S/F,T/F,O):s!==r||n?t.push(Le.G,C,L,s,r,n,S/F,T/F,O):t.push(Le.O,C,L,s,S/F,T/F,O)}},{M:pi,m:gi,L:fi,l:yi,H:mi,h:vi,V:wi,v:xi,C:bi,c:Ei,S:Pi,s:Bi,Q:ki,q:Si,T:Ti,t:Ri,A:Ci,a:Li,Z:Oi,z:Di,N:Ii,D:Ai,X:Mi,G:Wi,F:Fi,O:Ui,P:zi,U:Ni}=Le,{rect:Yi,roundRect:Xi,arcTo:Hi,arc:ji,ellipse:Vi,quadraticCurveTo:Gi}=ri,{ellipticalArc:Ki}=_i,qi=$t.get("PathConvert"),Zi={},$i={current:{dot:0},stringify(t,e){let i,s,r,n=0,o=t.length,a="";for(;n<o;){s=t[n],i=We[s],a+=s===r?" ":Me[s];for(let s=1;s<i;s++)a+=M.float(t[n+s],e),s===i-1||(a+=" ");r=s,n+=i}return a},parse(t,e){let i,s,r,n="";const o=[],a=e?Ie:De;for(let e=0,h=t.length;e<h;e++)s=t[e],qt[s]?("."===s&&(Qi.dot&&(Ji(o,n),n=""),Qi.dot++),"0"===n&&"."!==s&&(Ji(o,n),n=""),n+=s):Le[s]?(n&&(Ji(o,n),n=""),Qi.name=Le[s],Qi.length=Oe[s],Qi.index=0,Ji(o,Qi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&Ji(o,n),n=s):n&&(Ji(o,n),n=""),r=s;return n&&Ji(o,n),i?$i.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case gi:t[c+1]+=a,t[c+2]+=h;case pi:a=t[c+1],h=t[c+2],_.push(pi,a,h),c+=3;break;case vi:t[c+1]+=a;case mi:a=t[c+1],_.push(fi,a,h),c+=2;break;case xi:t[c+1]+=h;case wi:h=t[c+1],_.push(fi,a,h),c+=2;break;case yi:t[c+1]+=a,t[c+2]+=h;case fi:a=t[c+1],h=t[c+2],_.push(fi,a,h),c+=3;break;case Bi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Pi;case Pi:o=n===bi||n===Pi,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(bi,l,d,i,s,a,h),c+=5;break;case Ei:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=bi;case bi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(bi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ri:t[c+1]+=a,t[c+2]+=h,r=Ti;case Ti:o=n===ki||n===Ti,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Gi(_,a,h,i,s,t[c+1],t[c+2]):_.push(ki,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Si:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ki;case ki:i=t[c+1],s=t[c+2],e?Gi(_,a,h,i,s,t[c+3],t[c+4]):_.push(ki,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Li:t[c+6]+=a,t[c+7]+=h;case Ci:Ki(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Di:case Oi:_.push(Oi),c++;break;case Ii:a=t[c+1],h=t[c+2],e?Yi(_,a,h,t[c+3],t[c+4]):ts(_,t,c,5),c+=5;break;case Ai:a=t[c+1],h=t[c+2],e?Xi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ts(_,t,c,9),c+=9;break;case Mi:a=t[c+1],h=t[c+2],e?Xi(_,a,h,t[c+3],t[c+4],t[c+5]):ts(_,t,c,6),c+=6;break;case Wi:Vi(e?_:ts(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Zi),a=Zi.x,h=Zi.y,c+=9;break;case Fi:e?Vi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ts(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ui:ji(e?_:ts(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Zi),a=Zi.x,h=Zi.y,c+=7;break;case zi:e?ji(_,t[c+1],t[c+2],t[c+3],0,360,!1):ts(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ni:Hi(e?_:ts(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Zi),a=Zi.x,h=Zi.y,c+=6;break;default:return qi.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(pi,t.x,t.y);break;case"L":e.push(fi,t.x,t.y);break;case"C":e.push(bi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ki,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Oi)}}),e},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){Qi.index===Qi.length&&(Qi.index=1,t.push(Qi.name)),t.push(Number(e)),Qi.index++,Qi.dot=0}},{current:Qi,pushData:Ji,copyData:ts}=$i,{M:es,L:is,C:ss,Q:rs,Z:ns,N:os,D:as,X:hs,G:ls,F:ds,O:cs,P:us,U:_s}=Le,{getMinDistanceFrom:ps,getRadianFrom:gs}=ht,{tan:fs,min:ys,abs:ms}=Math,vs={},ws={beginPath(t){t.length=0},moveTo(t,e,i){t.push(es,e,i)},lineTo(t,e,i){t.push(is,e,i)},bezierCurveTo(t,e,i,s,r,n,o){t.push(ss,e,i,s,r,n,o)},quadraticCurveTo(t,e,i,s,r){t.push(rs,e,i,s,r)},closePath(t){t.push(ns)},rect(t,e,i,s,r){t.push(os,e,i,s,r)},roundRect(t,e,i,s,r,n){if(a(n))t.push(hs,e,i,s,r,n);else{const o=M.fourNumber(n);o?t.push(as,e,i,s,r,...o):t.push(os,e,i,s,r)}},ellipse(t,e,i,s,n,o,a,h,l){r(o)?t.push(ds,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(ls,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(us,e,i,s):(r(o)&&(o=360),t.push(cs,e,i,s,n,o,a?1:0))},arcTo(t,e,i,r,n,o,a,h){if(!s(a)){const t=ps(a,h,e,i,r,n);o=ys(o,ys(t/2,t/2*ms(fs(gs(a,h,e,i,r,n)/2))))}t.push(_s,e,i,r,n,o)},drawEllipse(t,e,i,s,n,o,a,h,l){ri.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,vs),t.push(es,vs.x,vs.y),xs(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){ri.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,vs),t.push(es,vs.x,vs.y),bs(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:xs,arc:bs}=ws,{moveTo:Es,lineTo:Ps,quadraticCurveTo:Bs,bezierCurveTo:ks,closePath:Ss,beginPath:Ts,rect:Rs,roundRect:Cs,ellipse:Ls,arc:Os,arcTo:Ds,drawEllipse:Is,drawArc:As,drawPoints:Ms}=ws;class Ws{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?Re.parse(t):t:[],this}beginPath(){return Ts(this.__path),this.paint(),this}moveTo(t,e){return Es(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ps(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return ks(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Bs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ss(this.__path),this.paint(),this}rect(t,e,i,s){return Rs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Cs(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,o,a){return Ls(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}arc(t,e,i,s,r,n){return Os(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Ds(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,o,a){return Is(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}drawArc(t,e,i,s,r,n){return As(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Ms(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Fs,L:Us,C:zs,Q:Ns,Z:Ys,N:Xs,D:Hs,X:js,G:Vs,F:Gs,O:Ks,P:qs,U:Zs}=Le,$s=$t.get("PathDrawer"),Qs={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Fs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Us:t.lineTo(e[s+1],e[s+2]),s+=3;break;case zs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ns:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ys:t.closePath(),s+=1;break;case Xs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Hs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Vs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*F,e[s+6]*F,e[s+7]*F,e[s+8]),s+=9;break;case Gs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case Ks:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*F,e[s+5]*F,e[s+6]),s+=7;break;case qs:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case Zs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void $s.error(`command: ${i} [index:${s}]`,e)}}},{M:Js,L:tr,C:er,Q:ir,Z:sr,N:rr,D:nr,X:or,G:ar,F:hr,O:lr,P:dr,U:cr}=Le,{toTwoPointBounds:ur,toTwoPointBoundsByQuadraticCurve:_r,arcTo:pr,arc:gr,ellipse:fr}=ri,{addPointBounds:yr,copy:mr,addPoint:vr,setPoint:wr,addBounds:xr,toBounds:br}=yt,Er=$t.get("PathBounds");let Pr,Br,kr;const Sr={},Tr={},Rr={},Cr={toBounds(t,e){Cr.toTwoPointBounds(t,Tr),br(Tr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return wr(e,0,0);let i,s,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===sr||o===er||o===ir?wr(e,h,l):wr(e,t[a+1],t[a+2])),o){case Js:case tr:h=t[a+1],l=t[a+2],vr(e,h,l),a+=3;break;case er:r=t[a+5],n=t[a+6],ur(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,Sr),yr(e,Sr),h=r,l=n,a+=7;break;case ir:i=t[a+1],s=t[a+2],r=t[a+3],n=t[a+4],_r(h,l,i,s,r,n,Sr),yr(e,Sr),h=r,l=n,a+=5;break;case sr:a+=1;break;case rr:h=t[a+1],l=t[a+2],xr(e,h,l,t[a+3],t[a+4]),a+=5;break;case nr:case or:h=t[a+1],l=t[a+2],xr(e,h,l,t[a+3],t[a+4]),a+=o===nr?9:6;break;case ar:fr(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],Sr,Rr),0===a?mr(e,Sr):yr(e,Sr),h=Rr.x,l=Rr.y,a+=9;break;case hr:h=t[a+1],l=t[a+2],Br=t[a+3],kr=t[a+4],xr(e,h-Br,l-kr,2*Br,2*kr),h+=Br,a+=5;break;case lr:gr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Sr,Rr),0===a?mr(e,Sr):yr(e,Sr),h=Rr.x,l=Rr.y,a+=7;break;case dr:h=t[a+1],l=t[a+2],Pr=t[a+3],xr(e,h-Pr,l-Pr,2*Pr,2*Pr),h+=Pr,a+=4;break;case cr:pr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Sr,Rr),0===a?mr(e,Sr):yr(e,Sr),h=Rr.x,l=Rr.y,a+=6;break;default:return void Er.error(`command: ${o} [index:${a}]`,t)}}},{M:Lr,L:Or,Z:Dr}=Le,{getCenterX:Ir,getCenterY:Ar}=ht,{arcTo:Mr}=ws,Wr={smooth(t,e,i){let s,r,n,o=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;o<g;){switch(s=t[o],s){case Lr:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===Or?(c=t[o+1],u=t[o+2],f.push(Lr,Ir(l,c),Ar(d,u))):f.push(Lr,l,d);break;case Or:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Or:Mr(f,a,h,t[o+1],t[o+2],e,_,p);break;case Dr:Mr(f,a,h,l,d,e,_,p);break;default:f.push(Or,a,h)}_=a,p=h;break;case Dr:r!==Dr&&(Mr(f,l,d,c,u,e,_,p),f.push(Dr)),o+=1;break;default:n=We[s];for(let e=0;e<n;e++)f.push(t[o+e]);o+=n}r=s}return s!==Dr&&(f[1]=l,f[2]=d),f}};function Fr(t){return new Ws(t)}const Ur=Fr();Re.creator=Fr(),Re.parse=$i.parse,Re.convertToCanvasData=$i.toCanvasData;const{drawRoundRect:zr}=Fe;function Nr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){zr(this,t,e,i,s,r)})}(t)}const Yr={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=Xr.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{}}}},Xr=Yr;Xr.alphaPixelTypes.forEach(t=>Xr.upperCaseTypeMap[t]=t.toUpperCase());const Hr=$t.get("TaskProcessor");class jr{constructor(t){this.parallel=!0,this.time=1,this.id=v.create(v.TASK),this.task=t}run(){return pe(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Hr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Vr{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,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&u.assign(this.config,t),this.empty()}add(t,e,i){let r,n,o,h;const l=new jr(t);return l.parent=this,a(e)?h=e:e&&(n=e.parallel,r=e.start,o=e.time,h=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===n&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,r):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,r))},h)),this.isComplete=!1,l}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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],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 Gr=$t.get("Resource"),Kr={tasker:new Vr,map:{},get isComplete(){return qr.tasker.isComplete},set(t,e){qr.map[t]&&Gr.repeat(t),qr.map[t]=e},get:t=>qr.map[t],remove(t){const e=qr.map[t];e&&(e.destroy&&e.destroy(),delete qr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ne.image(s)),qr.set(t,e),e},destroy(){qr.map={}}},qr=Kr,Zr={maxRecycled:10,recycledList:[],patternTasker:new Vr,get(t){let e=Kr.get(t.url);return e||Kr.set(t.url,e=ne.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||$r.recycledList.push(t)})},clearRecycled(){const t=$r.recycledList;t.length>$r.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Kr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Yr.alphaPixelTypes.some(e=>$r.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Yr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Yr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){$r.recycledList=[]}},$r=Zr,{IMAGE:Qr,create:Jr}=v;class tn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Jr(Qr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Zr.isFormat("svg",t)&&(this.isSVG=!0),Zr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Kr.tasker.add(()=>pe(this,void 0,void 0,function*(){return yield y.origin.loadImage(this.url,s(t)?y.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,o){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=y.image.resize(this.view,t,e,r,n,void 0,o,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const r=y.canvas.createPattern(t,e);return y.image.setPatternTransform(r,i,s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function en(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function sn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function rn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function nn(t,e){return(i,s)=>an(i,s,t,e&&e(s))}function on(t){return t}function an(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};en(t,e,Object.assign(r,s||{})),An(t,e,i)}function hn(t){return nn(t)}function ln(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function dn(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function cn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),fn(this))}}))}function un(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function _n(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function pn(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&fn(this)}}))}function gn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(fn(this),this.__.__removeNaturalSize())}}))}function fn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function yn(t){return nn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),fn(this)}}))}const mn=pn;function vn(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i)&&(wn(this),e&&(this.__.__useStroke=!0))}}))}function wn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&fn(t)}const xn=vn;function bn(t){return nn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function En(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Pn(t){return nn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;u.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Bn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Sn(this)}}))}function kn(t){return nn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Tn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Tn(this,t,e,i),this.mask&&Sn(this)}}))}function Sn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Tn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||fn(t))}function Rn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Cn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Ln(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function On(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Dn(t){return nn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function In(t){return(e,i)=>{en(e,"__DataProcessor",{get:()=>t})}}function An(t,e,i){const r=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=rn(e,i);if(s(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(d(i)){const t=c(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:u.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,_=r;for(;!l&&_;)l=sn(_,e),_=_.__proto__;l&&l.set&&(a.set=l.set),r[o]&&(a.set=r[o],delete r[o]),en(r,e,a)}const Mn=new $t("rewrite"),Wn=[],Fn=["destroy","constructor"];function Un(t){return(e,i)=>{Wn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function zn(){return t=>{Nn()}}function Nn(t){Wn.length&&(Wn.forEach(e=>{t&&Mn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Wn.length=0)}function Yn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Fn.includes(s)||e&&e.includes(s)))if(t.prototype){sn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Xn(){return t=>{ae.register(t)}}function Hn(){return t=>{de.register(t)}}setTimeout(()=>Nn(!0));const{copy:jn,toInnerPoint:Vn,toOuterPoint:Gn,scaleOfOuter:Kn,rotateOfOuter:qn,skewOfOuter:Zn,multiplyParent:$n,divideParent:Qn,getLayout:Jn}=$,to={},{round:eo}=Math,io={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),no(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)ro(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.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,i=e.length;t<i;t++)oo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&oo(t),t.__updateChange()},updateAllChange(t){if(ho(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ao(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(t,e,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||y.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=d(e)?Object.assign({},e):{x:e,y:i};s?Gn(t.localTransform,n,n,!0):t.parent&&Vn(t.parent.scrollWorldTransform,n,n,!0),so.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){d(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=eo(e),i=eo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){so.zoomOfLocal(t,lo(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const o=t.__localMatrix;if(a(s)||(s&&(n=s),s=i),jn(to,o),Kn(to,e,i,s),so.hasHighPosition(t))so.setTransform(t,to,r,n);else{const e=t.x+to.e-o.e,a=t.y+to.f-o.f;n&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){so.rotateOfLocal(t,lo(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;jn(to,r),qn(to,e,i),so.hasHighPosition(t)?so.setTransform(t,to,!1,s):t.set({x:t.x+to.e-r.e,y:t.y+to.f-r.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){so.skewOfLocal(t,lo(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){jn(to,t.__localMatrix),Zn(to,e,i,s),so.setTransform(t,to,r,n)},transformWorld(t,e,i,s){jn(to,t.worldTransform),$n(to,e),t.parent&&Qn(to,t.parent.scrollWorldTransform),so.setTransform(t,to,i,s)},transform(t,e,i,s){jn(to,t.localTransform),$n(to,e),so.setTransform(t,to,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&so.getInnerOrigin(t,r.origin),o=Jn(e,n,r.around&&so.getInnerOrigin(t,r.around));if(so.hasOffset(t)&&(o.x-=r.offsetX,o.y-=r.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){Yt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=so.getInnerOrigin(t,r.origin);ht.move(o,n.x-s.x,n.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Kn(i,so.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ht.tempToOuterOf(so.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(jn(to,t.worldTransform),Qn(to,e.scrollWorldTransform),i?to:Object.assign({},to)),drop(t,e,i,s){t.setTransform(so.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||so.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(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),y.requestRender(()=>so.animateMove(t,e,i))}}},so=io,{updateAllMatrix:ro,updateMatrix:no,updateAllWorldOpacity:oo,updateAllChange:ao,updateChange:ho}=so;function lo(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const co={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)=>_o(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>_o(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>_o(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 uo;function _o(t,e){return e||(uo=0),t.__.mask&&(uo=1),uo<0?null:(uo&&(uo=-1),!0)}const{updateBounds:po}=io,go={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:i}=t;for(let s=0,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),fo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)yo(e[t],e)},updateBounds(t,e){const i=[t];yo(t,i),mo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)po(s[t]);e&&e===i||po(i)}}},{pushAllChildBranch:fo,pushAllBranchStack:yo,updateBoundsByBranchStack:mo}=go,vo={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:wo,updateBounds:xo}=io,{toOuterOf:bo,getPoints:Eo,copy:Po}=Yt,Bo="_localContentBounds",ko="_worldContentBounds",So="_worldBoxBounds",To="_worldStrokeBounds";class Ro{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 bo(this.contentBounds,this.leaf.__localMatrix,this[Bo]||(this[Bo]={})),this[Bo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return bo(this.contentBounds,this.leaf.__world,this[ko]||(this[ko]={})),this[ko]}get worldBoxBounds(){return bo(this.boxBounds,this.leaf.__world,this[So]||(this[So]={})),this[So]}get worldStrokeBounds(){return bo(this.strokeBounds,this.leaf.__world,this[To]||(this[To]={})),this[To]}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:t}=this,{leafer:e}=t;if(t.isApp)return xo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,y.layout(i),delete i.__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 $.defaultMatrix;case"page":t=e.zoomLayer;default:return wo(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 Vt(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",i){const{leaf:s}=this;let r,n,o,a=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(a);break;case"inner":r=a,n=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(a,e),n=wo(s,e,!0)}if(o||(o=$.getLayout(n)),Po(o,a),ht.copy(o,r),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,r=Eo(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return s(n)||r.forEach(t=>i.innerToWorld(t,null,!1,n)),r}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}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 Co{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&y.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&y.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&y.event.stop(this.origin)}}class Lo extends Co{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Lo.ADD="child.add",Lo.REMOVE="child.remove",Lo.CREATED="created",Lo.MOUNTED="mounted",Lo.UNMOUNTED="unmounted",Lo.DESTROY="destroy";const Oo="property.scroll";class Do extends Co{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Do.CHANGE="property.change",Do.LEAFER_CHANGE="property.leafer_change",Do.SCROLL=Oo;const Io={scrollX:Oo,scrollY:Oo};class Ao extends Co{constructor(t,e){super(t),Object.assign(this,e)}}Ao.LOAD="image.load",Ao.LOADED="image.loaded",Ao.ERROR="image.error";class Mo extends Co{static checkHas(t,e,i){"on"===i?e===zo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Wo)||t.hasEvent(Fo)||t.hasEvent(Uo),t.__hasWorldEvent=t.hasEvent(zo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Wo,t),"inner"===e&&t.emit(Fo,t)),t.emit(Uo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(zo,this)}}Mo.RESIZE="bounds.resize",Mo.INNER="bounds.inner",Mo.LOCAL="bounds.local",Mo.WORLD="bounds.world";const{RESIZE:Wo,INNER:Fo,LOCAL:Uo,WORLD:zo}=Mo,No={};[Wo,Fo,Uo,zo].forEach(t=>No[t]=1);class Yo extends Co{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){d(t)?(super(Yo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Yo.RESIZE="resize";class Xo extends Co{constructor(t,e){super(t),this.data=e}}Xo.REQUEST="watch.request",Xo.DATA="watch.data";class Ho extends Co{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Ho.REQUEST="layout.request",Ho.START="layout.start",Ho.BEFORE="layout.before",Ho.LAYOUT="layout",Ho.AFTER="layout.after",Ho.AGAIN="layout.again",Ho.END="layout.end";class jo extends Co{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}jo.REQUEST="render.request",jo.CHILD_START="render.child_start",jo.CHILD_END="render.child_end",jo.START="render.start",jo.BEFORE="render.before",jo.RENDER="render",jo.AFTER="render.after",jo.AGAIN="render.again",jo.END="render.end",jo.NEXT="render.next";class Vo extends Co{}Vo.START="leafer.start",Vo.BEFORE_READY="leafer.before_ready",Vo.READY="leafer.ready",Vo.AFTER_READY="leafer.after_ready",Vo.VIEW_READY="leafer.view_ready",Vo.VIEW_COMPLETED="leafer.view_completed",Vo.STOP="leafer.stop",Vo.RESTART="leafer.restart",Vo.END="leafer.end",Vo.UPDATE_MODE="leafer.update_mode",Vo.TRANSFORM="leafer.transform",Vo.MOVE="leafer.move",Vo.SCALE="leafer.scale",Vo.ROTATE="leafer.rotate",Vo.SKEW="leafer.skew";const{MOVE:Go,SCALE:Ko,ROTATE:qo,SKEW:Zo}=Vo,$o={x:Go,y:Go,scaleX:Ko,scaleY:Ko,rotation:qo,skewX:Zo,skewY:Zo},Qo={};class Jo{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,o;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const a=ta(this,s,!0),h=n(t)?t.split(" "):t,d=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(d):a[t]=[d],No[t]&&Mo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ta(this,t);s.forEach(t=>{t&&(r=o[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete o[t],No[t]&&Mo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):l(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:s}}off_(t){if(!t)return;const e=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&de.has(t)&&(e=de.get(t,{type:t,target:this,current:this}));const s=ta(this,i)[t];if(s){let r;for(let n=0,o=s.length;n<o&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}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:i,__captureMap:r}=this,n=i&&i[t],o=r&&r[t];return!!(s(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ta(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Qo)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Qo)}}const{on:ea,on_:ia,off:sa,off_:ra,once:na,emit:oa,emitEvent:aa,hasEvent:ha,destroy:la}=Jo.prototype,da={on:ea,on_:ia,off:sa,off_:ra,once:na,emit:oa,emitEvent:aa,hasEvent:ha,destroyEventer:la},ca=$t.get("setAttr"),ua={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||o(e)||s(e)||(ca.warn(this.innerName,t,e),e=void 0),d(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Do(Do.LEAFER_CHANGE,this,t,r,e));const i=$o[t];i&&(this.emitEvent(new Vo(i,this)),this.emitEvent(new Vo(Vo.TRANSFORM,this)))}this.emitPropertyEvent(Do.CHANGE,t,r,e);const i=Io[t];return i&&this.emitPropertyEvent(i,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Do(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:_a,multiplyParent:pa,translateInner:ga,defaultWorld:fa}=$,{toPoint:ya,tempPoint:ma}=bt,va={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;pa(this.__local||e,t?t.__scrollWorld||t.__world:fa,i,!!e.affectScaleOrRotation,r),s&&ga(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(_a(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(ya(i.around||i.origin,t.boxBounds,ma),ga(e,-ma.x,-ma.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:wa,updateAllMatrix:xa}=io,{updateBounds:ba}=go,{toOuterOf:Ea,copyAndSpread:Pa,copy:Ba}=Yt,{toBounds:ka}=Cr,Sa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ea(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Mo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Mo.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(),Ea(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ea(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ea(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?ka(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),xa(this),ba(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(xa(this),ba(this,this))):wa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Pa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Ba(e.renderBounds,e.strokeBounds):Pa(e.renderBounds,e.boxBounds,i)}},Ta={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),io.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);$t.showBounds&&$t.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:Ra}=co,Ca={__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 i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Ra(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Ra(i[s],e)||i[s].__clip(t,e)}}},La={},{LEAF:Oa,create:Da}=v,{stintSet:Ia}=u,{toInnerPoint:Aa,toOuterPoint:Ma,multiplyParent:Wa}=$,{toOuterOf:Fa}=Yt,{copy:Ua,move:za}=ht,{moveLocal:Na,zoomOfLocal:Ya,rotateOfLocal:Xa,skewOfLocal:Ha,moveWorld:ja,zoomOfWorld:Va,rotateOfWorld:Ga,skewOfWorld:Ka,transform:qa,transformWorld:Za,setTransform:$a,getFlipTransform:Qa,getLocalOrigin:Ja,getRelativeWorld:th,drop:eh}=io;t.Leaf=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 p}get __LayoutProcessor(){return Ro}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=Da(Oa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Lo.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(Lo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Lo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}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(Lo.MOUNTED)):this.__emitLifeEvent(Lo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__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){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(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:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.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,i=this.__world;return Wa(i,t.matrix,e,void 0,i),Fa(this.__layout.renderBounds,e,e),Ia(e,"half",i.half),Ia(e,"ignorePixelSnap",i.ignorePixelSnap),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:i,scaleY:s}=Zr.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),La.scaleX=i,La.scaleY=s,La}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?th(this,e):this.worldTransform,r=i?t:{};return Fa(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ua(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ua(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Aa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ma(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return za(r,-n,-o),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return za(r,n,o),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){$a(this,t,e,i)}transform(t,e,i){qa(this,t,e,i)}move(t,e,i){Na(this,t,e,i)}moveInner(t,e,i){ja(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Ya(this,Ja(this,t),e,i,s,r)}rotateOf(t,e,i){Xa(this,Ja(this,t),e,i)}skewOf(t,e,i,s,r){Ha(this,Ja(this,t),e,i,s,r)}transformWorld(t,e,i){Za(this,t,e,i)}moveWorld(t,e,i){ja(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Va(this,t,e,i,s,r)}rotateOfWorld(t,e){Ga(this,t,e)}skewOfWorld(t,e,i,s,r){Ka(this,t,e,i,s,r)}flip(t,e){qa(this,Qa(this,t),!1,e)}scaleResize(t,e=t,i){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,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return re.need("path")}getMotionPoint(t){return re.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,i){eh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):An(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=pn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Lo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Lo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=_e([Yn(ua),Yn(va),Yn(Sa),Yn(da),Yn(Ta)],t.Leaf);const{setListWithFn:ih}=Yt,{sort:sh}=go,{localBoxBounds:rh,localStrokeBounds:nh,localRenderBounds:oh,maskLocalBoxBounds:ah,maskLocalStrokeBounds:hh,maskLocalRenderBounds:lh}=co,dh=new $t("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){ih(e||this.__layout.boxBounds,this.children,this.__hasMask?ah:rh)}__updateStrokeBounds(t){ih(t||this.__layout.strokeBounds,this.children,this.__hasMask?hh:nh)}__updateRenderBounds(t){ih(t||this.__layout.renderBounds,this.children,this.__hasMask?lh:oh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(sh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return dh.warn("add self or destroyed");const i=s(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ae.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?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(Lo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Lo.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)):s(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 i=this.children.indexOf(t);i>-1&&(this.children.splice(i,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(Lo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Lo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Lo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=_e([Yn(Ca)],t.Branch);class ch{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let r=0,n=e.length;r<n;r++)s(i)?e[r].innerId===t.innerId&&(i=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;s(i)||e.splice(i,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 ch;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class uh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const _h=$t.get("LeaferCanvas");class ph extends Te{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}y.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=n(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else _h.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:r}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:i}=this;t.width?(s(e)&&(this.autoWidthStr=r.width||""),r.width=t.width+"px"):s(e)||(r.width=e),t.height?(s(i)&&(this.autoHeightStr=r.height||""),r.height=t.height+"px"):s(i)||(r.height=i)}else r.width=t+"px",r.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),_h.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),y.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=y.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:r,height:n}=this.autoBounds.getBoundsFrom(t),o={width:r,height:n,pixelRatio:this.config.pixelRatio?this.pixelRatio:y.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};u.copyAttrs(e,this,Se),this.resize(t),this.resizeListener&&!s(this.width)&&this.resizeListener(new Yo(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}Nr(CanvasRenderingContext2D.prototype),Nr(Path2D.prototype);const{mineType:gh,fileType:fh}=Yr;function yh(t,e){y.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=gh(e),r=t.toDataURL(s,i);return"image/bmp"===s?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,gh(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL(gh(fh(e)),i);return y.origin.download(s,e)},download:(t,e)=>new Promise(i=>{let s=document.createElement("a");s.href=t,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),i()}),loadImage:t=>new Promise((e,i)=>{const s=new y.origin.Image,{crossOrigin:r}=y.image;r&&(s.setAttribute("crossOrigin",r),s.crossOrigin=r),s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=y.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},y.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},y.canvas=ne.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(ne,{canvas:(t,e)=>new ph(t,e),image:t=>new tn(t)}),y.name="web",y.isMobile="ontouchstart"in window,y.requestRender=function(t){window.requestAnimationFrame(t)},en(y,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:mh}=navigator;mh.indexOf("Firefox")>-1?(y.conicGradientRotate90=!0,y.intWheelDeltaY=!0,y.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(y.fullImageShadow=!0),mh.indexOf("Windows")>-1?(y.os="Windows",y.intWheelDeltaY=!0):mh.indexOf("Mac")>-1?y.os="Mac":mh.indexOf("Linux")>-1&&(y.os="Linux");class vh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ch;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ch,this.target=t,e&&(this.config=u.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(jo.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Lo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Xo(Xo.DATA,{updatedList:this.updatedList})),this.__updatedList=new ch,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Do.CHANGE,this.__onAttrChange,this],[[Lo.ADD,Lo.REMOVE],this.__onChildEvent,this],[Xo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:wh,updateBounds:xh,updateChange:bh}=io,{pushAllChildBranch:Eh,pushAllParent:Ph}=go;const{worldBounds:Bh}=co;class kh{constructor(t){this.updatedBounds=new Vt,this.beforeBounds=new Vt,this.afterBounds=new Vt,l(t)&&(t=new ch(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Bh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Bh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Sh,updateAllChange:Th}=io,Rh=$t.get("Layouter");class Ch{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new uh,this.target=t,e&&(this.config=u.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Ho.START),this.layoutOnce(),t.emitEvent(new Ho(Ho.END,this.layoutedBlocks,this.times))}catch(t){Rh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Rh.warn("layouting"):this.times>3?Rh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Xo.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ee.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=Ho,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Ho(r,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(wh(t,!0),e.add(t),t.isBranch&&Eh(t,e),Ph(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ph(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||xh(s[t])}xh(i)}})}(this.__levelList),function(t){t.list.forEach(bh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Ho(n,a,this.times)),i.emitEvent(new Ho(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ee.end(e)}fullLayout(){const t=ee.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=Ho,n=this.getBlocks(new ch(e));e.emitEvent(new Ho(i,n,this.times)),Ch.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Ho(s,n,this.times)),e.emitEvent(new Ho(r,n,this.times)),this.addBlocks(n),ee.end(t)}static fullLayout(t){Sh(t,!0),t.isBranch?go.updateBounds(t):io.updateBounds(t),Th(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new kh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new kh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Ho.REQUEST,this.layout,this],[Ho.AGAIN,this.layoutAgain,this],[Xo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Lh=$t.get("Renderer");class Oh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=u.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Ho.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(jo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(jo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(jo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Vt,Lh.log(e.innerName,"---\x3e");try{this.emitRender(jo.START),this.renderOnce(t),this.emitRender(jo.END,this.totalBounds),Zr.clearRecycled()}catch(t){this.rendering=!1,Lh.error(t)}Lh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Lh.warn("rendering");if(this.times>3)return Lh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Vt,this.renderOptions={},t)this.emitRender(jo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(jo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(jo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(jo.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=ee.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new Vt(s);i.save(),s.spread(Oh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,r),i.restore(),ee.end(e)}fullRender(){const t=ee.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ee.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),r=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),$t.showRepaint&&$t.drawRepaint(i,t),y.render(this.target,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Vt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return y.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Vt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Vt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Lh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new jo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[jo.REQUEST,this.update,this],[Ho.END,this.__onLayoutEnd,this],[jo.AGAIN,this.renderAgain,this],[Yo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Oh.clipSpread=10;const{hitRadiusPoint:Dh}=Yt;class Ih{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new ch(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,r,!!i.findList),h=r?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new ch;if(t.length){let e;const{x:s,y:n}=this.point,o={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||io.worldHittable(e))&&(this.hitChild(e,o),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&io.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>io.worldHittable(t))}getPath(t){const e=new ch,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new ch;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new ch,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,o=i.length;t<o;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:r}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Dh(i.__world,r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(r))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,o=n.length;s<o;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Ah{constructor(t,e){this.config={},e&&(this.config=u.default(e,this.config)),this.picker=new Ih(this.target=t,this),this.finder=ne.finder&&ne.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return y.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Mh(t){return nn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Wh(t){return nn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Fh(){return(t,e)=>{const i="_"+e;en(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ne,{watcher:(t,e)=>new vh(t,e),layouter:(t,e)=>new Ch(t,e),renderer:(t,e,i)=>new Oh(t,e,i),selector:(t,e)=>new Ah(t,e)}),y.layout=Ch.fullLayout,y.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new ch,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Uh={},zh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Nh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Yh={},Xh={},Hh={},jh={},Vh={},Gh={apply(){re.need("filter")}},Kh={},qh={setStyleName:()=>re.need("state"),set:()=>re.need("state")},Zh={list:{},register(t,e){Zh.list[t]=e},get:t=>Zh.list[t]},{parse:$h,objectToCanvasData:Qh}=$i,{stintSet:Jh}=u,{hasTransparent:tl}=zh,el={},il=$t.get("UIData");class sl extends p{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,il.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,il.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(Jh(this,"__isTransparentFill",tl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(Jh(this,"__isTransparentStroke",tl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?$h(t):Qh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){rl(this,"shadow",t)}setInnerShadow(t){rl(this,"innerShadow",t)}setFilter(t){rl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Xh.compute("fill",this.__leaf),e&&Xh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=el)):(this.__isStrokes=!0,this._stroke||(this._stroke=el))}__removePaint(t,e){e&&this.__removeInput(t),Hh.recycleImage(t,this),"fill"===t?(Jh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Jh(this,"__isAlphaPixelStroke",void 0),Jh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function rl(t,e,i){t.__setInput(e,i),l(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class nl extends sl{}class ol extends nl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class al extends nl{__getInputData(t,e){const i=super.__getInputData(t,e);return Se.forEach(t=>delete i[t]),i}}class hl extends ol{}class ll extends sl{get __usePathBox(){return this.points||this.__pathInputed}}class dl extends sl{get __boxStroke(){return!this.__pathInputed}}class cl extends sl{get __boxStroke(){return!this.__pathInputed}}class ul extends ll{}class _l extends sl{}class pl extends sl{get __pathInputed(){return 2}}class gl extends nl{}const fl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class yl extends sl{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=fl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ae.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class ml extends dl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class vl extends dl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:wl,add:xl}=k,bl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=wl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Vh.getShadowRenderSpread(this,e)),s&&(t=wl(t,s)),n&&(t=xl(t,Gh.getSpread(n))),o&&(t=xl(t,o)),a&&(t=xl(t,a));let l=t;return i&&(l=wl(l,Vh.getInnerShadowSpread(this,i))),r&&(l=wl(l,r)),this.__layout.renderShapeSpread=l,h?wl(h.__updateRenderSpread(),t):t}},{stintSet:El}=u,Pl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);El(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),El(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;El(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Vh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),El(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Bl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Xh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Vh.shadow(this,t,h),a&&(s.__isStrokes?Xh.strokes(n,this,t,e):Xh.stroke(n,this,t,e)),r&&(s.__isFills?Xh.fills(r,this,t,e):Xh.fill(r,this,t,e)),o&&this.__drawAfterFill(t,e),d&&Vh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?Xh.strokes(n,this,t,e):Xh.stroke(n,this,t,e)),c&&Gh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Xh.strokes(n,this,t,e):Xh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,zh.string(e.color))}r&&(s.__isFills?Xh.fills(r,this,t,e):Xh.fill(r,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?Xh.strokes(n,this,t,e):Xh.stroke(n,this,t,e))}}else s.__pathInputed?Bl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Xh.fills(s,this,t,e):Xh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Xh.strokes(r,this,t,e):Xh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Bl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Xh.stroke(r,t,e,i),s&&Xh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!o&&Xh.stroke(r,t,e,i)}const kl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Sl,Tl;t.UI=Sl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){M.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Ur.set(this.path=t||[]),t||this.__drawPathByBox(Ur),Ur}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Ur.set(i=[]),this.__drawPathByBox(Ur)),t?$i.toCanvasData(i,!0):i}getPathString(t,e,i){return $i.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Kh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Wr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Yh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Qs.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,r,a(n)?[n]:n)}else t.rect(e,i,s,r)}drawImagePlaceholder(t,e,i){Xh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=u.clone(this.toJSON());return t&&Object.assign(e,t),Sl.one(e)}static one(t,e,i,s,r){return ae.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Xn()(this)}static registerData(t){In(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},_e([In(sl)],t.UI.prototype,"__",void 0),_e([Fh()],t.UI.prototype,"zoomLayer",void 0),_e([hn("")],t.UI.prototype,"id",void 0),_e([hn("")],t.UI.prototype,"name",void 0),_e([hn("")],t.UI.prototype,"className",void 0),_e([En("pass-through")],t.UI.prototype,"blendMode",void 0),_e([Bn(1)],t.UI.prototype,"opacity",void 0),_e([kn(!0)],t.UI.prototype,"visible",void 0),_e([En(!1)],t.UI.prototype,"locked",void 0),_e([Pn(!1)],t.UI.prototype,"dim",void 0),_e([Pn(!1)],t.UI.prototype,"dimskip",void 0),_e([Rn(0)],t.UI.prototype,"zIndex",void 0),_e([Cn(!1)],t.UI.prototype,"mask",void 0),_e([Ln(!1)],t.UI.prototype,"eraser",void 0),_e([ln(0,!0)],t.UI.prototype,"x",void 0),_e([ln(0,!0)],t.UI.prototype,"y",void 0),_e([pn(100,!0)],t.UI.prototype,"width",void 0),_e([pn(100,!0)],t.UI.prototype,"height",void 0),_e([un(1,!0)],t.UI.prototype,"scaleX",void 0),_e([un(1,!0)],t.UI.prototype,"scaleY",void 0),_e([_n(0,!0)],t.UI.prototype,"rotation",void 0),_e([_n(0,!0)],t.UI.prototype,"skewX",void 0),_e([_n(0,!0)],t.UI.prototype,"skewY",void 0),_e([ln(0,!0)],t.UI.prototype,"offsetX",void 0),_e([ln(0,!0)],t.UI.prototype,"offsetY",void 0),_e([dn(0,!0)],t.UI.prototype,"scrollX",void 0),_e([dn(0,!0)],t.UI.prototype,"scrollY",void 0),_e([cn()],t.UI.prototype,"origin",void 0),_e([cn()],t.UI.prototype,"around",void 0),_e([hn(!1)],t.UI.prototype,"lazy",void 0),_e([gn(1)],t.UI.prototype,"pixelRatio",void 0),_e([bn(0)],t.UI.prototype,"renderSpread",void 0),_e([yn()],t.UI.prototype,"path",void 0),_e([mn()],t.UI.prototype,"windingRule",void 0),_e([mn(!0)],t.UI.prototype,"closed",void 0),_e([pn(0)],t.UI.prototype,"padding",void 0),_e([pn(!1)],t.UI.prototype,"lockRatio",void 0),_e([pn()],t.UI.prototype,"widthRange",void 0),_e([pn()],t.UI.prototype,"heightRange",void 0),_e([hn(!1)],t.UI.prototype,"draggable",void 0),_e([hn()],t.UI.prototype,"dragBounds",void 0),_e([hn("auto")],t.UI.prototype,"dragBoundsType",void 0),_e([hn(!1)],t.UI.prototype,"editable",void 0),_e([On(!0)],t.UI.prototype,"hittable",void 0),_e([On("path")],t.UI.prototype,"hitFill",void 0),_e([xn("path")],t.UI.prototype,"hitStroke",void 0),_e([On(!1)],t.UI.prototype,"hitBox",void 0),_e([On(!0)],t.UI.prototype,"hitChildren",void 0),_e([On(!0)],t.UI.prototype,"hitSelf",void 0),_e([On()],t.UI.prototype,"hitRadius",void 0),_e([Dn("")],t.UI.prototype,"cursor",void 0),_e([En()],t.UI.prototype,"fill",void 0),_e([xn(void 0,!0)],t.UI.prototype,"stroke",void 0),_e([xn("inside")],t.UI.prototype,"strokeAlign",void 0),_e([xn(1,!0)],t.UI.prototype,"strokeWidth",void 0),_e([xn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),_e([xn("none")],t.UI.prototype,"strokeCap",void 0),_e([xn("miter")],t.UI.prototype,"strokeJoin",void 0),_e([xn()],t.UI.prototype,"dashPattern",void 0),_e([xn(0)],t.UI.prototype,"dashOffset",void 0),_e([xn(10)],t.UI.prototype,"miterLimit",void 0),_e([mn(0)],t.UI.prototype,"cornerRadius",void 0),_e([mn()],t.UI.prototype,"cornerSmoothing",void 0),_e([Mh()],t.UI.prototype,"shadow",void 0),_e([Mh()],t.UI.prototype,"innerShadow",void 0),_e([Mh()],t.UI.prototype,"blur",void 0),_e([Mh()],t.UI.prototype,"backgroundBlur",void 0),_e([Mh()],t.UI.prototype,"grayscale",void 0),_e([Mh()],t.UI.prototype,"filter",void 0),_e([En()],t.UI.prototype,"placeholderColor",void 0),_e([hn(100)],t.UI.prototype,"placeholderDelay",void 0),_e([hn({})],t.UI.prototype,"data",void 0),_e([Un(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Sl=_e([Yn(bl),Yn(Pl),zn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},_e([In(nl)],t.Group.prototype,"__",void 0),_e([pn(0)],t.Group.prototype,"width",void 0),_e([pn(0)],t.Group.prototype,"height",void 0),t.Group=_e([Yn(t.Branch),Xn()],t.Group);const Rl=$t.get("Leafer");t.Leafer=Tl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Kr.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Tl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,u.assign(s,t));const r=this.canvas=ne.canvas(s);this.__controllers.push(this.renderer=ne.renderer(this,r,s),this.watcher=ne.watcher(this,s),this.layouter=ne.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=ne.selector(this),this.interaction=ne.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ne.hitCanvasManager()),this.canvasManager=new ue,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),vo.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Vo.RESTART):this.emitLeafer(Vo.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Vo.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=u.copyAttrs({},t,Se);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Vt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=u.copyAttrs({},this.canvas,Se);e.resize(t),this.updateLazyBounds(),this.__onResize(new Yo(t,i))}__onResize(t){this.emitEvent(t),u.copyAttrs(this.__,t,Se),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Se.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(Vo.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Se.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=u.copyAttrs({},s,Se);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Vo.BEFORE_READY),this.emitLeafer(Vo.READY),this.emitLeafer(Vo.AFTER_READY),vo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Vo.VIEW_READY),vo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(r=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){vo.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Vo.VIEW_COMPLETED),vo.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return re.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Vo(t,this))}__listenEvents(){const t=ee.start("FirstCreate "+this.innerName);this.once([[Vo.START,()=>ee.end(t)],[Ho.START,this.updateLazyBounds,this],[jo.START,this.__onCreated,this],[jo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Xo.DATA,this.__onWatchData,this],[Ho.END,this.__onLayoutEnd,this],[jo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Tl.list.remove(this);try{this.stop(),this.emitLeafer(Vo.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Zr.clearRecycled()},100)}catch(t){Rl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ch,_e([In(al)],t.Leafer.prototype,"__",void 0),_e([pn()],t.Leafer.prototype,"pixelRatio",void 0),_e([hn("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Tl=_e([Xn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},_e([In(dl)],t.Rect.prototype,"__",void 0),t.Rect=_e([Yn(kl),zn(),Xn()],t.Rect);const{add:Cl,includes:Ll,scroll:Ol}=Yt,Dl=t.Rect.prototype,Il=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o.includes("scroll"))&&(Cl(a,n),Ol(a,i)),this.__updateRectRenderBounds(),t=!Ll(n,a),t&&"show"===o&&Cl(r,a)}else this.__updateRectRenderBounds();u.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},_e([In(ol)],t.Box.prototype,"__",void 0),_e([pn(100)],t.Box.prototype,"width",void 0),_e([pn(100)],t.Box.prototype,"height",void 0),_e([hn(!1)],t.Box.prototype,"resizeChildren",void 0),_e([bn("show")],t.Box.prototype,"overflow",void 0),_e([Un(Dl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),_e([Un(Dl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),_e([Un(Dl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),_e([Un(Dl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),_e([Un(Dl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),_e([Un(Dl.__updateChange)],t.Box.prototype,"__updateRectChange",null),_e([Un(Dl.__render)],t.Box.prototype,"__renderRect",null),_e([Un(Il.__render)],t.Box.prototype,"__renderGroup",null),t.Box=_e([zn(),Xn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},_e([In(hl)],t.Frame.prototype,"__",void 0),_e([En("#FFFFFF")],t.Frame.prototype,"fill",void 0),_e([bn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=_e([Xn()],t.Frame);const{moveTo:Al,closePath:Ml,ellipse:Wl}=ws;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];i?(s||r?(i<1&&Wl(a,n,o,n*i,o*i,0,s,r,!1),Wl(a,n,o,n,o,0,r,s,!0),i<1&&Ml(a)):(i<1&&(Wl(a,n,o,n*i,o*i),Al(a,t,o)),Wl(a,n,o,n,o,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||r?(Al(a,n,o),Wl(a,n,o,n,o,0,s,r,!1),Ml(a)):Wl(a,n,o,n,o)}},_e([In(cl)],t.Ellipse.prototype,"__",void 0),_e([mn(0)],t.Ellipse.prototype,"innerRadius",void 0),_e([mn(0)],t.Ellipse.prototype,"startAngle",void 0),_e([mn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=_e([Xn()],t.Ellipse);const{sin:Fl,cos:Ul,PI:zl}=Math,{moveTo:Nl,lineTo:Yl,closePath:Xl,drawPoints:Hl}=ws;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Hl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,o=s/2;Nl(e,n,0);for(let t=1;t<r;t++)Yl(e,n+n*Fl(2*t*zl/r),o-o*Ul(2*t*zl/r));Xl(e)}}},_e([In(ul)],t.Polygon.prototype,"__",void 0),_e([mn(3)],t.Polygon.prototype,"sides",void 0),_e([mn()],t.Polygon.prototype,"points",void 0),_e([mn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=_e([zn(),Xn()],t.Polygon);const{sin:jl,cos:Vl,PI:Gl}=Math,{moveTo:Kl,lineTo:ql,closePath:Zl}=ws;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,o=this.__.path=[];Kl(o,r,0);for(let t=1;t<2*i;t++)ql(o,r+(t%2==0?r:r*s)*jl(t*Gl/i),n-(t%2==0?n:n*s)*Vl(t*Gl/i));Zl(o)}},_e([In(_l)],t.Star.prototype,"__",void 0),_e([mn(5)],t.Star.prototype,"corners",void 0),_e([mn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=_e([Xn()],t.Star);const{moveTo:$l,lineTo:Ql,drawPoints:Jl}=ws,{rotate:td,getAngle:ed,getDistance:id,defaultPoint:sd}=ht;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&td(i,e),i}set toPoint(t){this.width=id(sd,t),this.rotation=ed(sd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Jl(e,t.points,t.curve,t.closed):($l(e,0,0),Ql(e,this.width,0))}},_e([In(ll)],t.Line.prototype,"__",void 0),_e([vn("center")],t.Line.prototype,"strokeAlign",void 0),_e([pn(0)],t.Line.prototype,"height",void 0),_e([mn()],t.Line.prototype,"points",void 0),_e([mn(0)],t.Line.prototype,"curve",void 0),_e([mn(!1)],t.Line.prototype,"closed",void 0),t.Line=_e([Xn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}},_e([In(ml)],t.Image.prototype,"__",void 0),_e([pn("")],t.Image.prototype,"url",void 0),t.Image=_e([Xn()],t.Image);const rd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ne.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new tn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Ao(Ao.LOADED,{image:t}))})}draw(t,e,i,s){const r=new gt(t.worldTransform).invert(),n=new gt;e&&n.translate(e.x,e.y),i&&(a(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},_e([In(vl)],t.Canvas.prototype,"__",void 0),_e([Wh(100)],t.Canvas.prototype,"width",void 0),_e([Wh(100)],t.Canvas.prototype,"height",void 0),_e([Wh(1)],t.Canvas.prototype,"pixelRatio",void 0),_e([Wh(!0)],t.Canvas.prototype,"smooth",void 0),_e([hn(!1)],t.Canvas.prototype,"safeResize",void 0),_e([Wh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=_e([Xn()],t.Canvas);const{copyAndSpread:nd,includes:od,spread:ad,setList:hd}=Yt,{stintSet:ld}=u;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Nh.number(e,r),t.__letterSpacing=Nh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,ld(t,"__padding",l&&M.fourNumber(l)),ld(t,"__clipText","show"!==h&&!t.__autoSize),ld(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Uh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&ad(a,i/2),n||o){if(h.x=n?a.x:0,h.y=o?a.y:0,h.width=n?a.width:t.width,h.height=o?a.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),u.stintSet(this,"isOverflow",!od(h,a)),this.isOverflow?(hd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;nd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},_e([In(yl)],t.Text.prototype,"__",void 0),_e([pn(0)],t.Text.prototype,"width",void 0),_e([pn(0)],t.Text.prototype,"height",void 0),_e([En()],t.Text.prototype,"boxStyle",void 0),_e([hn(!1)],t.Text.prototype,"resizeFontSize",void 0),_e([En("#000000")],t.Text.prototype,"fill",void 0),_e([vn("outside")],t.Text.prototype,"strokeAlign",void 0),_e([On("all")],t.Text.prototype,"hitFill",void 0),_e([pn("")],t.Text.prototype,"text",void 0),_e([pn("")],t.Text.prototype,"placeholder",void 0),_e([pn("caption")],t.Text.prototype,"fontFamily",void 0),_e([pn(12)],t.Text.prototype,"fontSize",void 0),_e([pn("normal")],t.Text.prototype,"fontWeight",void 0),_e([pn(!1)],t.Text.prototype,"italic",void 0),_e([pn("none")],t.Text.prototype,"textCase",void 0),_e([pn("none")],t.Text.prototype,"textDecoration",void 0),_e([pn(0)],t.Text.prototype,"letterSpacing",void 0),_e([pn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),_e([pn(0)],t.Text.prototype,"paraIndent",void 0),_e([pn(0)],t.Text.prototype,"paraSpacing",void 0),_e([pn("x")],t.Text.prototype,"writingMode",void 0),_e([pn("left")],t.Text.prototype,"textAlign",void 0),_e([pn("top")],t.Text.prototype,"verticalAlign",void 0),_e([pn(!0)],t.Text.prototype,"autoSizeAlign",void 0),_e([pn("normal")],t.Text.prototype,"textWrap",void 0),_e([pn("show")],t.Text.prototype,"textOverflow",void 0),_e([En(!1)],t.Text.prototype,"textEditing",void 0),t.Text=_e([Xn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},_e([In(pl)],t.Path.prototype,"__",void 0),_e([vn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=_e([Xn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,o,a){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,o,a){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},_e([In(gl)],t.Pen.prototype,"__",void 0),_e([(t,e)=>{en(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=_e([Yn(Ws,["set","path","paint"]),Xn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&ne.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&u.assign(e,t),this.autoLayout&&u.copyAttrs(e,this,Se),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Ho.END,this.__onReady,this],[jo.START,this.__onCreated,this],[jo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(jo.END,this.__onChildRenderEnd,this))}},t.App=_e([Xn()],t.App);const dd={},cd={isHoldSpaceKey:()=>cd.isHold("Space"),isHold:t=>dd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){dd[t]||(dd[t]=!0)},setUpCode(t){dd[t]=!1}},ud={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class _d extends Co{get spaceKey(){return cd.isHoldSpaceKey()}get left(){return ud.left(this)}get right(){return ud.right(this)}get middle(){return ud.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return cd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){de.changeName(t,e)}}const{min:pd,max:gd,abs:fd}=Math,{float:yd,sign:md}=M,{minX:vd,maxX:wd,minY:xd,maxY:bd}=Yt,Ed=new Vt,Pd=new Vt,Bd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&kd.getValidMove(t.__localBoxBounds,kd.getDragBounds(t),s,e,!0),kd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&kd.getValidScaleOf(t.__localBoxBounds,kd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,o=t.y+s.y,a=n+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),kd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),kd.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=yd(s.x),s.y=yd(s.y),s},getValidScaleOf(t,e,i,s,r,n,a){a||(r=Object.assign({},r)),Pd.set(e),Ed.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return kd.isInnerMode(t,e,i,"width")?(r.x<0&&Ed.scaleOf(s,f=1/r.x,1),p=yd(Ed.minX-Pd.minX),g=yd(Pd.maxX-Ed.maxX),u=h&&p>0?1+p/(h*Ed.width):1,_=l&&g>0?1+g/(l*Ed.width):1,f*=gd(u,_)):(r.x<0&&((yd(vd(t)-vd(e))<=0||yd(wd(e)-wd(t))<=0)&&Ed.scaleOf(s,f=1/r.x,1),Ed.unsign()),p=yd(Pd.minX-Ed.minX),g=yd(Ed.maxX-Pd.maxX),u=h&&p>0?1-p/(h*Ed.width):1,_=l&&g>0?1-g/(l*Ed.width):1,f*=pd(u,_)),kd.isInnerMode(t,e,i,"height")?(r.y<0&&Ed.scaleOf(s,1,y=1/r.y),p=yd(Ed.minY-Pd.minY),g=yd(Pd.maxY-Ed.maxY),u=d&&p>0?1+p/(d*Ed.height):1,_=c&&g>0?1+g/(c*Ed.height):1,y*=gd(u,_),n&&(u=gd(fd(f),fd(y)),f=md(f)*u,y=md(y)*u)):(r.y<0&&((yd(xd(t)-xd(e))<=0||yd(bd(e)-bd(t))<=0)&&Ed.scaleOf(s,1,y=1/r.y),Ed.unsign()),p=yd(Pd.minY-Ed.minY),g=yd(Ed.maxY-Pd.maxY),u=d&&p>0?1-p/(d*Ed.height):1,_=c&&g>0?1-g/(c*Ed.height):1,y*=pd(u,_)),r.x*=o(f)?f:1,r.y*=o(y)?y:1,r}},kd=Bd;t.PointerEvent=class extends _d{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=_e([Hn()],t.PointerEvent);const Sd=t.PointerEvent,Td={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof ch?t:new ch(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return ht.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Bd.axisMove(t,r),r}static limitMove(t,e){Bd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Td,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Td,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Td,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Yt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Yt.unsign(i),i}assignMove(t){Td.x=t?this.totalX:this.moveX,Td.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=_e([Hn()],t.DragEvent);const Rd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=_e([Hn()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=_e([Hn()],t.MoveEvent),t.TouchEvent=class extends _d{},t.TouchEvent=_e([Hn()],t.TouchEvent);const Cd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=_e([Hn()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=_e([Hn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=_e([Hn()],t.ZoomEvent),t.KeyEvent=class extends _d{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=_e([Hn()],t.KeyEvent);const Ld={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Od.getSwipeDirection(ht.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new ch,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>io.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Od=Ld,Dd=new ch,{getDragEventData:Id,getDropEventData:Ad,getSwipeEventData:Md}=Ld;class Wd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Id(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Dd;return this.dragging&&(r?e?Dd:new ch(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&ud.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],io.draggable(e)){this.draggableList=new ch(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:o}=r;this.dragData=Id(r,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,r=this.realDraggableList;if(r.length&&s){const{totalX:s,totalY:o}=this.dragData,{dragLimitAnimate:h}=i.p,l=!h||!!e;r.forEach(i=>{if(i.draggable){const r=n(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:o},l||r);h&&!r&&e?io.animateMove(i,d,a(h)?h:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:o}=s,a=Id(s,e,e);if(o&&(a.throughPath=o),a.path=n,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const n=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,r,a),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(ht.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Md(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=Ad(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Fd=$t.get("emit");const Ud=["move","zoom","rotate","key"];function zd(t,e,i,s,r){if(Ud.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Yd(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!i.path.has(n)&&n.__.hittable&&Nd(n,e,i,s,r)}}function Nd(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Yd(t,r)&&(qh.updateEventStyle&&!s&&qh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=de.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Yd(t,e){return e&&e.has(t)}const Xd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Hd,pathCanDrag:jd,pathHasOutside:Vd}=Ld;class Gd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&ud.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&ud.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&cd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=u.clone(Xd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ch(t),this.createTransformer(),this.dragger=new Wd(this),s&&(this.config=u.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(ud.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),ud.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=ud.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&ud.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=ht.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;ud.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,cd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,cd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new ch),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Hd(e.path,t));r<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;y.backgrounder||t.origin||n&&n.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Vd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!jd(t.path))&&!Vd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&ht.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Hd(e.path,t.PointerEvent.LONG_TAP)||Hd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Vt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Yo.RESIZE,this.__onResize,this)],t.once(Vo.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Nd(r,t,e,!0,s))return;r.isApp&&zd(r,t,e,!0,s)}for(let n=0,o=i.length;n<o;n++)if(r=i.list[n],r.isApp&&zd(r,t,e,!1,s),Nd(r,t,e,!1,s))return}catch(t){Fd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Kd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Kd.custom={};class qd extends ue{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ch,this.pixelList=new ch}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ne.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ne.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}y.getSelector=function(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=ne.selector())};const{toInnerRadiusPointOf:Zd,copy:$d,setRadius:Qd}=ht,{hitRadiusPoint:Jd,hitPoint:tc}=Yt,ec={},ic={},sc=t.Leaf.prototype;sc.hit=function(t,e=0){this.updateLayout(),$d(ic,t),Qd(ic,e);const i=this.__world;return!!(e?Jd(i,ic):tc(i,ic))&&(this.isBranch?y.getSelector(this).hitPoint(Object.assign({},ic),e,{target:this}):this.__hitWorld(ic))},sc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,r=i.width<10&&i.height<10;if(e.hitRadius&&($d(ec,t),Qd(t=ec,e.hitRadius)),Zd(t,i,ec),e.hitBox||r){if(Yt.hitRadiusPoint(s.boxBounds,ec))return!0;if(r)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(ec)},sc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},sc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},sc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},sc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const rc=new gt,nc=t.UI.prototype;nc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=y.image.hitCanvasSize,o=n.hitScale=Gt.set(0,0,r,r).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Gt.set(t).scale(o);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),Zr.patternLocked=!0,this.__renderShape(n,{matrix:rc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),Zr.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},nc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:n}=e,o=e.stroke&&("path"===r||"pixel"===r&&!e.__isAlphaPixelStroke)||"all"===r;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const oc=t.UI.prototype,ac=t.Rect.prototype,hc=t.Box.prototype;ac.__updateHitCanvas=hc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?oc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},ac.__hitFill=hc.__hitFill=function(t){return this.__hitCanvas?oc.__hitFill.call(this,t):Yt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),y.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const lc=Te.prototype;lc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},lc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},lc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:o}=t;e&&(s-=e.x,r-=e.y),Gt.set(s-n,r-o,2*n,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Gt.x,Gt.y,Gt.width||1,Gt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const dc={convert(t,e){const i=Ld.getBase(t),{x:s,y:r}=e,n=Object.assign(Object.assign({},i),{x:s,y:r,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===n.pointerType&&(n.tangentialPressure=t.tangentialPressure,n.tiltX=t.tiltX,n.tiltY=t.tiltY,n.twist=t.twist),n},convertMouse(t,e){const i=Ld.getBase(t),{x:s,y:r}=e;return Object.assign(Object.assign({},i),{x:s,y:r,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=dc.getTouch(t),s=Ld.getBase(t),{x:r,y:n}=e;return Object.assign(Object.assign({},s),{x:r,y:n,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},cc={convert(t){const e=Ld.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:uc}=Ld;class _c extends Gd{get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(cc.convert(t))}onKeyUp(t){this.keyUp(cc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(dc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(dc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=dc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(dc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(dc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(dc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(dc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=dc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&uc(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(dc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=dc.getTouch(t);this.pointerMove(dc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=dc.getTouch(t);this.pointerUp(dc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Ld.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},Ld.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=Ld.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(M.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),d(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>d(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,l(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=n(t)&&Kd.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function pc(t,e,i){t.__.__font?Xh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function gc(t,e,i,s,r){const n=i.__;d(t)?Xh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Xh.strokeArrow(t,i,s,r)}function fc(t,e,i,s,r){const n=i.__;d(t)?Xh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),Xh.drawTextStroke(i,s,r))}function yc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,fc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",Xh.fillText(i,n,r),n.blendMode="normal",io.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}const{getSpread:mc,copyAndSpread:vc,toOuterOf:wc,getOuterOf:xc,getByMove:bc,move:Ec,getIntersectData:Pc}=Yt,Bc={};let kc;const{stintSet:Sc}=u,{hasTransparent:Tc}=zh;function Rc(t,e,i){if(!d(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:o}=i.__layout;switch(e.type){case"image":r=Hh.image(i,t,e,o,!kc||!kc[e.url]);break;case"linear":r=jh.linearGradient(e,o);break;case"radial":r=jh.radialGradient(e,o);break;case"angular":r=jh.conicGradient(e,o);break;case"solid":const{type:n,color:a,opacity:h}=e;r={type:n,style:zh.string(a,h)};break;default:s(e.r)||(r={type:"solid",style:zh.string(e)})}if(r&&(r.originPaint=e,n(r.style)&&Tc(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const Cc={compute:function(t,e){const i=e.__,s=[];let r,n,o,a=i.__input[t];l(a)||(a=[a]),kc=Hh.recycleImage(t,i);for(let i,r=0,n=a.length;r<n;r++)(i=Rc(t,a[r],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(Sc(i,"__isAlphaPixelFill",r),Sc(i,"__isTransparentFill",n)):(Sc(i,"__isAlphaPixelStroke",r),Sc(i,"__isTransparentStroke",n),Sc(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,pc(e,i,s)},fills:function(t,e,i,s){let r,n,o;for(let a=0,h=t.length;a<h;a++){if(r=t[a],n=r.originPaint,r.image){if(o?o++:o=1,Hh.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),pc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),pc(e,i,s),i.restoreBlendMode()):pc(e,i,s)}},fillPathOrText:pc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)o=r[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)Xh.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":gc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),gc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)gc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),gc(t,2,e,o,s),o.clipUI(r),o.clearWorld(n),io.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Xh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":fc(t,1,e,i,s);break;case"inside":yc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?fc(t,2,e,i,s):yc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:o}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=r;n.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!Hh.checkImage(o,!1,s,r,n))&&o.style){if(h){const{strokeStyle:t}=o;t?r.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(o.style,a.__strokeWidth*e,a)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),i?Xh.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?Xh.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;wc(o.strokeSpread?(vc(Bc,o.boxBounds,o.strokeSpread),Bc):o.boxBounds,n,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(a))_=s,h=u=a,l=n;else{let s;if(y.fullImageShadow)s=a;else{const t=o.renderShapeSpread?mc(r,k.swapAndScale(o.renderShapeSpread,p,g)):r;s=Pc(t,a)}c=r.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=m),u=xc(a,c),h=bc(u,-c.e,-c.f),l=xc(n,c),Ec(l,-c.e,-c.f);const v=i.matrix;v?(d=new gt(c),d.multiply(v),f*=v.scaleX,m*=v.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Lc,Oc=new Vt;const{isSame:Dc}=Yt;function Ic(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Hh.createData(r,s,i,n),!0}function Ac(t,e){Fc(t,Ao.LOAD,e)}function Mc(t,e){Fc(t,Ao.LOADED,e)}function Wc(t,e,i){e.error=i,t.forceUpdate("surface"),Fc(t,Ao.ERROR,e)}function Fc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Ao(e,i))}function Uc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:zc,translate:Nc}=$,Yc=new Vt,Xc={},Hc={};function jc(t,e,i,s){const r=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Vc={},Gc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Kc,set:qc,rotateOfOuter:Zc,translate:$c,scaleOfOuter:Qc,multiplyParent:Jc,scale:tu,rotate:eu,skew:iu}=$;function su(t,e,i,s,r,n,o,a){o&&eu(t,o),a&&iu(t,a.x,a.y),r&&tu(t,r,n),$c(t,e.x+i,e.y+s)}const{get:ru,scale:nu,copy:ou}=$,{getFloorScale:au}=M,{abs:hu}=Math;const lu={image:function(t,e,i,s,r){let n,o;const a=Zr.get(i);return Lc&&i===Lc.paint&&Dc(s,Lc.boxBounds)?n=Lc.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),Lc=a.use>1?{leafPaint:n,paint:i,boxBounds:Oc.set(s)}:null),(r||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Ic(t,e,i,a,n,s),r&&(Ac(t,o),Mc(t,o))):a.error?r&&Wc(t,o,a.error):(r&&(Uc(t,!0),Ac(t,o)),n.loadId=a.load(()=>{Uc(t,!1),t.destroyed||(Ic(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Mc(t,o)),n.loadId=void 0},e=>{Uc(t,!1),Wc(t,o,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:o}=Hh.getImageRenderScaleData(t,i,s,r),{image:a,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===n+"-"+o&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&Yo.isResizing(i)||d||(e=y.image.isLarge(a,n,o))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Hh.drawImage(t,n,o,i,s,r),!0):(!t.style||l.sync||d?Hh.createPattern(t,i,s,r):Hh.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:o,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=o,c=a.getFull(o.filters),u=s.__;let _,{width:p,height:g}=a;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(o.scaleX&&(p*=o.scaleX,g*=o.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(l(i)){let s,r,n,o,a;for(let h=0,d=i.length;h<d;h++)s=i[h],r=s.image,a=r&&r.url,a&&(n||(n={}),n[a]=!0,Zr.recycle(r),r.loading&&(o||(o=e.__input&&e.__input[t]||[],l(o)||(o=[o])),r.unload(i[h].loadId,!o.some(t=>t.url===a))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=Zr.patternTasker.add(()=>pe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Hh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=Hh.getImageRenderScaleData(t,e,i,s),o=r+"-"+n;if(t.patternId!==o&&!e.destroyed&&(!y.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Hh.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/hu(s.scaleX||1),u=h.y*n/hu(s.scaleY||1)),(a||1!==r||1!==n)&&(r*=au(_+(c||0)),n*=au(p+(u||0)),d=ru(),a&&ou(d,a),nu(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=y.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>o&&(n=o),(o*=e*i)>n&&(r=Math.sqrt(n/o)),r},createData:function(t,e,i,s){t.data=Hh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Yc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:o,mode:a,align:h,offset:l,scale:c,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===r,w={mode:a},x="center"!==h&&(_||0)%180==90;let b,E;switch(Yt.set(Hc,0,0,x?r:s,x?s:r),a&&"cover"!==a&&"fit"!==a?((c||u)&&(M.getScaleData(c,u,i,Xc),b=Xc.scaleX,E=Xc.scaleY),(h||y||f)&&(b&&Yt.scale(Hc,b,E,!0),h&&Bt.toPoint(h,Hc,e,Hc,!0,!0))):v&&!_||(b=E=Yt.getFitScale(e,Hc,"fit"!==a),Yt.put(e,i,h,b,!1,Hc),Yt.scale(Hc,b,E,!0)),l&&ht.move(Hc,l),a){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/r,Hh.stretchMode(w,e,b,E));break;case"normal":case"clip":if(Hc.x||Hc.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Hh.clipMode(w,e,Hc.x,Hc.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&Hh.repeatMode(w,e,s,r,Hc.x,Hc.y,b,E,_,p,h,t.freeTransform),f||(w.repeat="repeat");const i=d(f);(y||i)&&(w.gap=function(t,e,i,s,r){let n,o;d(t)?(n=t.x,o=t.y):n=o=t;return{x:jc(n,i,r.width,e&&e.x),y:jc(o,s,r.height,e&&e.y)}}(y,i&&f,Hc.width,Hc.height,e));break;default:b&&Hh.fillOrFitMode(w,e,Hc.x,Hc.y,b,E,_)}return w.transform||(e.x||e.y)&&Nc(w.transform=zc(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=E),o&&o<1&&(w.opacity=o),m&&(w.filters=m),f&&(w.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const r=Kc(),{x:n,y:o}=e;n||o?$c(r,n,o):r.onlyScale=!0,tu(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,o){const a=Kc();$c(a,e.x+i,e.y+s),tu(a,r,n),o&&Zc(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,r,n,o,a,h,l){const d=Kc();su(d,e,i,s,r,n,o,a),h&&(o||a?(qc(Gc),Qc(Gc,e,h,l),Jc(d,Gc)):Qc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,o,a,h,l,d,c){const u=Kc();if(c)su(u,e,r,n,o,a,h,l);else{if(h)if("center"===d)Zc(u,{x:i/2,y:s/2},h);else switch(eu(u,h),h){case 90:$c(u,s,0);break;case 180:$c(u,i,s);break;case 270:$c(u,0,i)}Vc.x=e.x+r,Vc.y=e.y+n,$c(u,Vc.x,Vc.y),o&&Qc(u,Vc,o,a)}t.transform=u}},{toPoint:du}=bt,{hasTransparent:cu}=zh,uu={},_u={};function pu(t,e,i,s){if(i){let r,o,a,h;for(let t=0,l=i.length;t<l;t++)r=i[t],n(r)?(a=t/(l-1),o=zh.string(r,s)):(a=r.offset,o=zh.string(r.color,s)),e.addColorStop(a,o),!h&&cu(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:gu,getDistance:fu}=ht,{get:yu,rotateOfOuter:mu,scaleOfOuter:vu}=$,{toPoint:wu}=bt,xu={},bu={};function Eu(t,e,i,s,r){let n;const{width:o,height:a}=t;if(o!==a||s){const t=gu(e,i);n=yu(),r?(vu(n,e,o/a*(s||1),1),mu(n,e,t+90)):(vu(n,e,1,o/a*(s||1)),mu(n,e,t))}return n}const{getDistance:Pu}=ht,{toPoint:Bu}=bt,ku={},Su={};const Tu={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;du(i||"top",e,uu),du(s||"bottom",e,_u);const o=y.canvas.createLinearGradient(uu.x,uu.y,_u.x,_u.y),a={type:r,style:o};return pu(a,o,t.stops,n),a},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:o}=t;wu(i||"center",e,xu),wu(s||"bottom",e,bu);const a=y.canvas.createRadialGradient(xu.x,xu.y,0,xu.x,xu.y,fu(xu,bu)),h={type:r,style:a};pu(h,a,t.stops,n);const l=Eu(e,xu,bu,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:o}=t;Bu(i||"center",e,ku),Bu(s||"bottom",e,Su);const a=y.conicGradientSupport?y.canvas.createConicGradient(0,ku.x,ku.y):y.canvas.createRadialGradient(ku.x,ku.y,0,ku.x,ku.y,Pu(ku,Su)),h={type:r,style:a};pu(h,a,t.stops,n);const l=Eu(e,ku,Su,o||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Eu},{copy:Ru,move:Cu,toOffsetOutBounds:Lu}=Yt,{max:Ou,abs:Du}=Math,Iu={},Au=new gt,Mu={};function Wu(t,e){let i,s,r,n,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=Du(t.spread||0),o=Ou(o,r+n-s),a=Ou(a,r+n+i),h=Ou(h,r+n+s),l=Ou(l,r+n-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function Fu(t,e,i){const{shapeBounds:s}=i;let r,n;y.fullImageShadow?(Ru(Iu,t.bounds),Cu(Iu,e.x-s.x,e.y-s.y),r=t.bounds,n=Iu):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:Uu}=Yt,zu={};const Nu=Wu;const Yu={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;Lu(h,Mu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Mu.offsetX+(o.x||0)*c*f,Mu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,zh.string(o.color)),r=Vh.getShadowTransform(t,_,i,o,Mu,f),r&&_.setTransform(r),Fu(_,Mu,i),r&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,n,"copy"),s=n),a?_.copyWorld(a,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),io.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;Uu(h,zu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(zu.offsetX+(o.x||0)*c*f,zu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),r=Vh.getShadowTransform(t,_,i,o,zu,f,!0),r&&_.setTransform(r),Fu(_,zu,i),_.restore(),a?(_.copyWorld(_,l,n,"copy"),_.copyWorld(a,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,zh.string(o.color),"source-in"),io.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Wu,getShadowTransform:function(t,e,i,s,r,n,o){if(s.spread){const i=2*s.spread*n*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Au.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/a,1+i/h),Au}},isTransformShadow(t){},getInnerShadowSpread:Nu},{excludeRenderBounds:Xu}=co;let Hu;function ju(t,e,i,s,r,n,o,a){switch(e){case"grayscale":Hu||(Hu=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),n&&s.recycle(o);Gu(t,e,i,1,r,n)}(t,i,s,r,o,a);break;case"opacity-path":Gu(t,i,s,n,o,a);break;case"path":a&&i.restore()}}function Vu(t){return t.getSameCanvas(!1,!0)}function Gu(t,e,i,s,r,n){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,r),n?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(ju(this,o,t,r,s,n,void 0,!0),s=r=null),"clipping"!==a&&"clipping-path"!==a||Xu(i,e)||i.__render(t,e),n=i.__.opacity,Hu=!1,"path"===a||"clipping-path"===a?(n<1?(o="opacity-path",r||(r=Vu(t))):(o="path",t.save()),i.__clip(r||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Vu(t)),r||(r=Vu(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&ju(this,o,t,r,s,n,void 0,!1),Xu(i,e)||i.__render(r||t,e),d&&ju(this,o,t,r,s,n,d,!1)}ju(this,o,t,r,s,n,void 0,!0)};const Ku=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",qu=Ku+"_#~&*+\\=|≮≯≈≠=…",Zu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function $u(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Qu=$u("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ju=$u("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),t_=$u(Ku),e_=$u(qu),i_=$u("- —/~|┆·");var s_;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(s_||(s_={}));const{Letter:r_,Single:n_,Before:o_,After:a_,Symbol:h_,Break:l_}=s_;function d_(t){return Qu[t]?r_:i_[t]?l_:Ju[t]?o_:t_[t]?a_:e_[t]?h_:Zu.test(t)?n_:r_}const c_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function u_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:__}=c_,{Letter:p_,Single:g_,Before:f_,After:y_,Symbol:m_,Break:v_}=s_;let w_,x_,b_,E_,P_,B_,k_,S_,T_,R_,C_,L_,O_,D_,I_,A_,M_,W_=[];function F_(t,e){T_&&!S_&&(S_=T_),w_.data.push({char:t,width:e}),b_+=e}function U_(){E_+=b_,w_.width=b_,x_.words.push(w_),w_={data:[]},b_=0}function z_(){D_&&(I_.paraNumber++,x_.paraStart=!0,D_=!1),T_&&(x_.startCharSize=S_,x_.endCharSize=T_,S_=0),x_.width=E_,A_.width?__(x_):M_&&N_(),W_.push(x_),x_={words:[]},E_=0}function N_(){E_>(I_.maxWidth||0)&&(I_.maxWidth=E_)}const{top:Y_,right:X_,bottom:H_,left:j_}=t.Direction4;function V_(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const G_={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;a&&(r?(i=a[j_],r-=a[X_]+a[j_],!r&&(r=.01)):e.autoSizeAlign||(i=a[j_]),o?(s=a[Y_],o-=a[Y_]+a[H_],!o&&(o=.01)):e.autoSizeAlign||(s=a[Y_]));const h={bounds:{x:i,y:s,width:r,height:o},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,i){I_=t,W_=t.rows,A_=t.bounds,M_=!A_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:o}=y,{width:a}=A_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;D_=!0,C_=null,S_=k_=T_=b_=E_=0,w_={data:[]},x_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)B_=e[i],"\n"===B_?(b_&&U_(),x_.paraEnd=!0,z_(),D_=!0):(R_=d_(B_),R_===p_&&"none"!==n&&(B_=u_(B_,n,!b_)),k_=o.measureText(B_).width,s&&(s<0&&(T_=k_),k_+=s),L_=R_===g_&&(C_===g_||C_===p_)||C_===g_&&R_!==y_,O_=!(R_!==f_&&R_!==g_||C_!==m_&&C_!==y_),P_=D_&&r?a-r:a,t&&a&&E_+b_+k_>P_&&(h?(b_&&U_(),E_&&z_()):(O_||(O_=R_===p_&&C_==y_),L_||O_||R_===v_||R_===f_||R_===g_||b_+k_>P_?(b_&&U_(),E_&&z_()):E_&&z_()))," "===B_&&!0!==D_&&E_+b_===0||(R_===v_?(" "===B_&&b_&&U_(),F_(B_,k_),U_()):L_||O_?(b_&&U_(),F_(B_,k_)):F_(B_,k_)),C_=R_);b_&&U_(),E_&&z_(),W_.length>0&&(W_[W_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{I_.paraNumber++,E_=o.measureText(t).width,W_.push({x:r||0,text:t,width:E_,paraStart:!0}),M_&&N_()})}(h,t,e),a&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":V_(e,"x",t[j_]);break;case"right":V_(e,"x",-t[X_])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":V_(e,"y",t[Y_]);break;case"bottom":V_(e,"y",-t[H_])}}(a,h,e,r,o),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=r;o<d;o++){if(v=i[o],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=n,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:o}=e,a=i&&r.includes("both"),h=a||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:o}=e;if(r.splice(n),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?y.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,d(n)?(i=n.type,n.color&&(t.decorationColor=zh.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const K_={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(n(t)){if(!i||!zh.object)return t;t=zh.object(t)}let r=s(t.a)?1:t.a;i&&(r*=e);const o=t.r+","+t.g+","+t.b;return 1===r?"rgb("+o+")":"rgba("+o+","+r+")"}};return Object.assign(Uh,G_),Object.assign(zh,K_),Object.assign(Xh,Cc),Object.assign(Hh,lu),Object.assign(jh,Tu),Object.assign(Vh,Yu),Object.assign(ne,{interaction:(t,e,i,s)=>new _c(t,e,i,s),hitCanvas:(t,e)=>new ph(t,e),hitCanvasManager:()=>new qd}),yh(),t.AlignHelper=Bt,t.AroundHelper=bt,t.AutoBounds=Kt,t.BezierHelper=ri,t.Bounds=Vt,t.BoundsEvent=Mo,t.BoundsHelper=Yt,t.BoxData=ol,t.BranchHelper=go,t.BranchRender=Ca,t.CanvasData=vl,t.CanvasManager=ue,t.ChildEvent=Lo,t.ColorConvert=zh,t.Creator=ne,t.Cursor=Kd,t.DataHelper=u,t.Debug=$t,t.DragBoundsHelper=Bd,t.Dragger=Wd,t.Effect=Vh,t.EllipseData=cl,t.EllipseHelper=_i,t.Event=Co,t.EventCreator=de,t.Eventer=Jo,t.Export=Kh,t.FileHelper=Yr,t.Filter=Gh,t.FourNumberHelper=k,t.FrameData=hl,t.GroupData=nl,t.HitCanvasManager=qd,t.ImageData=ml,t.ImageEvent=Ao,t.ImageManager=Zr,t.IncrementId=v,t.Interaction=_c,t.InteractionBase=Gd,t.InteractionHelper=Ld,t.Keyboard=cd,t.LayoutEvent=Ho,t.Layouter=Ch,t.LeafBounds=Sa,t.LeafBoundsHelper=co,t.LeafData=p,t.LeafDataProxy=ua,t.LeafEventer=da,t.LeafHelper=io,t.LeafLayout=Ro,t.LeafLevelList=uh,t.LeafList=ch,t.LeafMatrix=va,t.LeafRender=Ta,t.LeaferCanvas=ph,t.LeaferCanvasBase=Te,t.LeaferData=al,t.LeaferEvent=Vo,t.LeaferImage=tn,t.LineData=ll,t.MathHelper=M,t.Matrix=gt,t.MatrixHelper=$,t.MyDragEvent=Rd,t.MyImage=rd,t.MyPointerEvent=Sd,t.MyTouchEvent=Cd,t.NeedConvertToCanvasCommandMap=De,t.OneRadian=F,t.PI2=U,t.PI_2=z,t.Paint=Xh,t.PaintGradient=jh,t.PaintImage=Hh,t.PathArrow=Yh,t.PathBounds=Cr,t.PathCommandDataHelper=ws,t.PathCommandMap=Le,t.PathConvert=$i,t.PathCorner=Wr,t.PathCreator=Ws,t.PathData=pl,t.PathDrawer=Qs,t.PathHelper=Re,t.PathNumberCommandLengthMap=We,t.PathNumberCommandMap=Me,t.PenData=gl,t.Picker=Ih,t.Platform=y,t.Plugin=re,t.Point=_t,t.PointHelper=ht,t.PointerButton=ud,t.PolygonData=ul,t.PropertyEvent=Do,t.RectData=dl,t.RectHelper=Fe,t.RectRender=kl,t.RenderEvent=jo,t.Renderer=Oh,t.ResizeEvent=Yo,t.Resource=Kr,t.Run=ee,t.Selector=Ah,t.StarData=_l,t.State=qh,t.StringNumberMap=qt,t.TaskItem=jr,t.TaskProcessor=Vr,t.TextConvert=Uh,t.TextData=yl,t.Transition=Zh,t.TwoPointBoundsHelper=yt,t.UIBounds=bl,t.UICreator=ae,t.UIData=sl,t.UIEvent=_d,t.UIRender=Pl,t.UnitConvert=Nh,t.WaitHelper=vo,t.WatchEvent=Xo,t.Watcher=vh,t.affectRenderBoundsType=bn,t.affectStrokeBoundsType=vn,t.attr=on,t.autoLayoutType=cn,t.boundsType=pn,t.canvasPatch=Nr,t.canvasSizeAttrs=Se,t.createAttr=function(t){return(e,i)=>{en(e,i,rn(i,t))}},t.createDescriptor=rn,t.cursorType=Dn,t.dataProcessor=In,t.dataType=hn,t.decorateLeafAttr=nn,t.defineDataProcessor=An,t.defineKey=en,t.defineLeafAttr=an,t.dimType=Pn,t.doBoundsType=fn,t.doStrokeType=wn,t.effectType=Mh,t.emptyData=i,t.eraserType=Ln,t.extraPropertyEventMap=Io,t.getBoundsData=Y,t.getDescriptor=sn,t.getMatrixData=X,t.getPointData=N,t.hitType=On,t.isArray=l,t.isData=function(t){return d(t)&&!l(t)},t.isEmptyData=c,t.isFinite=o,t.isNull=r,t.isNumber=a,t.isObject=d,t.isString=n,t.isUndefined=s,t.layoutProcessor=function(t){return(e,i)=>{en(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=$o,t.maskType=Cn,t.naturalBoundsType=gn,t.opacityType=Bn,t.path=Fr,t.pathInputType=yn,t.pathType=mn,t.pen=Ur,t.positionType=ln,t.registerUI=Xn,t.registerUIEvent=Hn,t.resizeType=Wh,t.rewrite=Un,t.rewriteAble=zn,t.rotationType=_n,t.scaleType=un,t.scrollType=dn,t.sortType=Rn,t.strokeType=xn,t.surfaceType=En,t.tempBounds=Gt,t.tempMatrix=ft,t.tempPoint=pt,t.tryToNumber=function(t){return"string"==typeof t&&h.test(t)?+t:t},t.useCanvas=yh,t.useModule=Yn,t.version="1.10.1",t.visibleType=kn,t.zoomLayerType=Fh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
1
|
+
var LeaferUI=function(t){"use strict";var e;t.Answer=void 0,(e=t.Answer||(t.Answer={}))[e.No=0]="No",e[e.Yes=1]="Yes",e[e.NoAndSkip=2]="NoAndSkip",e[e.YesAndSkip=3]="YesAndSkip";const i={};function s(t){return void 0===t}function r(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:o}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return"{}"===JSON.stringify(t)}const u={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,o;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return _(t[r],e[r],i&&i[r]);i&&r in i?(null===(o=i[r])||void 0===o?void 0:o.constructor)===Object&&_(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:_}=u;class p{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(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let r in this)"_"!==r[0]&&(i=e?e[r]:void 0,t[r]=s(i)?this[r]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(l(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:r}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=r?r[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:o}}return i}__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{floor:g,max:f}=Math,y={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||m.maxCacheSize),isSuperLarge:(t,e,i)=>m.isLarge(t,e,i,m.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=y.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,o,a,h){const l=y.origin.createCanvas(f(g(e+(s||0)),1),f(g(i+(r||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,n){const s=e/n.width,r=i/n.height;d.setTransform(s,0,0,r,-n.x*s,-n.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&u.stintSet(i,"transform",e)}}},{image:m}=y,v={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=v;let x,b,E;const{max:P}=Math,B=[0,0,0,0],S={zero:[...B],tempFour:B,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>k(B,t,e,i,s),toTempAB(t,e,i){E=i?a(t)?e:t:[],a(t)?(x=R(t),b=e):a(e)?(x=t,b=R(e)):(x=t,b=e),4!==x.length&&(x=T(x)),4!==b.length&&(b=T(b))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?P(t,e):(C(t,e,i),k(E,P(x[0],b[0]),P(x[1],b[1]),P(x[2],b[2]),P(x[3],b[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(C(t,e,i),k(E,x[0]+b[0],x[1]+b[1],x[2]+b[2],x[3]+b[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,o,h,l]=4===t.length?t:T(t);return k(r,h*i,l*e,n*i,o*e)}},{set:k,get:T,setTemp:R,toTempAB:C}=S,{round:L,pow:O,max:D,floor:I,PI:A}=Math,M={within:(t,e,i)=>(d(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:S.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:O(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(a(e)?e:e.width||0)/i.width,r=(a(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&M.assignScale(s,t);return s},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(I(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const F=A/180,U=2*A,z=A/2;function N(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:j,acos:V,sqrt:G}=Math,{float:K}=M,q={};function Z(){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 $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Z(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,o=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=o},get:X,getWorld:Z,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,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){Q.toInnerPoint(t,e,q),Q.scaleOfInner(t,q,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,o=j(e*=F),a=H(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=r*o-n*a,t.d=r*a+n*o},rotateOfOuter(t,e,i){Q.toInnerPoint(t,e,q),Q.rotateOfInner(t,q,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:o}=t;i&&(i*=F,t.a=s+n*i,t.b=r+o*i),e&&(e*=F,t.c=n+s*e,t.d=o+r*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,q),Q.skewOfInner(t,q,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:o,f:a}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+o,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,r,n){const{e:o,f:a}=t;if(i||(i=t),s(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){Q.multiply(t,Q.tempInvert(e))},divideParent(t,e){Q.multiplyParent(t,Q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Q;return Q.copy(e,t),Q.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:o}=t;if(i||s){const a=1/(e*r-i*s);t.a=r*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*r-o*s)*a,t.f=-(o*e-n*i)*a}else if(1===e&&1===r)t.e=-n,t.f=-o;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:o,d:a}=t,h=1/(r*a-n*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,r,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*F,o=j(n),a=H(n);if(s||r){const e=s*F,i=r*F;t.a=(o+i*-a)*h,t.b=(a+i*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,(i=i||r)&&Q.translateInner(t,-i.x,-i.y,!r)},getLayout(t,e,i,s){const{a:r,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||o){const t=r*a-n*o;if(o&&!s){d=G(r*r+n*n),c=t/d;const e=r/d;u=n>0?V(e):-V(e)}else{c=G(o*o+a*a),d=t/c;const e=o/c;u=z-(a>0?V(-e):-V(e))}const e=K(j(u)),i=H(u);d=K(d),c=K(c),_=e?K((o/c+i)/e/F,9):0,p=e?K((n/d-i)/e/F,9):0,u=K(u/F)}else d=r,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*o,f+=e.x*n+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:o}=t;r||n?i=(s*o-r*n)/(e=G(s*s+r*r)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=$,{toInnerPoint:J,toOuterPoint:tt}=$,{sin:et,cos:it,abs:st,sqrt:rt,atan2:nt,min:ot,round:at}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,i){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=lt.defaultPoint);const s=it(e*=F),r=et(e),n=t.x-i.x,o=t.y-i.y;t.x=i.x+n*s-o*r,t.y=i.y+n*r+o*s},tempToInnerOf(t,e){const{tempPoint:i}=lt;return ct(i,t),J(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=lt;return ct(i,t),tt(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=lt;return ct(i,t),lt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),J(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){J(e,t,i)},toOuterOf(t,e,i){tt(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=st(i-t),n=st(s-e);return rt(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>ot(dt(t,e,i,s),dt(i,s,r,n)),getAngle:(t,e)=>ut(t,e)/F,getRotation:(t,e,i,s)=>(s||(s=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/F),getRadianFrom(t,e,i,r,n,o,a,h){s(a)&&(a=i,h=r);const l=t-i,d=e-r,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>nt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const n=ut(t,e);return r&&(t=e),s||(e={}),e.x=t.x+it(n)*i,e.y=t.y+et(n)*i,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,getAtan2:ut}=lt;class _t{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,i){return ht.scaleOf(this,t,e,i),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,i){return ht.getRotation(this,t,e,i)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new _t(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(ht.getDistancePoint(this,t,e,i,s))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}isSame(t){return ht.isSame(this,t)}reset(){return ht.reset(this),this}}const pt=new _t;class gt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return d(t)?$.copy(this,t):$.set(this,t,e,i,s,r,n),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new gt(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const ft=new gt,yt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){mt(t,e,i),mt(t,e+s,i+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:mt}=yt;var vt,wt;t.Direction4=void 0,(vt=t.Direction4||(t.Direction4={}))[vt.top=0]="top",vt[vt.right=1]="right",vt[vt.bottom=2]="bottom",vt[vt.left=3]="left",t.Direction9=void 0,(wt=t.Direction9||(t.Direction9={}))[wt.topLeft=0]="topLeft",wt[wt.top=1]="top",wt[wt.topRight=2]="topRight",wt[wt.right=3]="right",wt[wt.bottomRight=4]="bottomRight",wt[wt.bottom=5]="bottom",wt[wt.bottomLeft=6]="bottomLeft",wt[wt.left=7]="left",wt[wt.center=8]="center",wt[wt["top-left"]=0]="top-left",wt[wt["top-right"]=2]="top-right",wt[wt["bottom-right"]=4]="bottom-right",wt[wt["bottom-left"]=6]="bottom-left";const xt=[{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}];xt.forEach(t=>t.type="percent");const bt={directionData:xt,tempPoint:{},get:Et,toPoint(t,e,i,s,r,n){const o=Et(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),o.x&&(i.x-=1===o.x?r.width:.5===o.x?o.x*r.width:0),o.y&&(i.y-=1===o.y?r.height:.5===o.y?o.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function Et(e){return n(e)?xt[t.Direction9[e]]:e}const{toPoint:Pt}=bt,Bt={toPoint(t,e,i,s,r,n){Pt(t,i,s,r,e,n)}},{tempPointBounds:St,setPoint:kt,addPoint:Tt,toBounds:Rt}=yt,{toOuterPoint:Ct}=$,{float:Lt,fourNumber:Ot}=M,{floor:Dt,ceil:It}=Math;let At,Mt,Wt,Ft;const Ut={},zt={},Nt={},Yt={tempBounds:Nt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:o,width:a,height:h}=e;if(l(i)){const e=Ot(i);s?Xt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Xt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Xt.set(t,n-i,o-i,a+2*i,h+2*i);r&&("width"===r?(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,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Xt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?jt(e,t):e=t,i||(i=t),e.offsetX=Xt.maxX(i),e.offsetY=Xt.maxY(i),Xt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ht.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ht.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Xt.copy(Nt,t),Xt.toOuterOf(Nt,e),Nt),getOuterOf:(t,e)=>(t=Object.assign({},t),Xt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:o}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=o+t.y*r):(i.height=t.height*-r,i.y=o+t.y*r-i.height)}else Ut.x=t.x,Ut.y=t.y,Ct(e,Ut,zt),kt(St,zt.x,zt.y),Ut.x=t.x+t.width,Ct(e,Ut,zt),Tt(St,zt.x,zt.y),Ut.y=t.y+t.height,Ct(e,Ut,zt),Tt(St,zt.x,zt.y),Ut.x=t.x,Ct(e,Ut,zt),Tt(St,zt.x,zt.y),Rt(St,i)},toInnerOf(t,e,i){i||(i=t),Xt.move(i,-e.e,-e.f),Xt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Xt.getFitScale(t,e));return new gt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,o){o||(o=e),n(s)&&(s=Xt.getFitScale(t,e,"cover"===s)),Nt.width=r?e.width*=s:e.width*s,Nt.height=r?e.height*=s:e.height*s,Bt.toPoint(i,Nt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Xt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Xt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Xt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=i>t.y?It(t.height+i-t.y):It(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,i){At=t.x+t.width,Mt=t.y+t.height,Wt=e.x,Ft=e.y,i||(Wt+=e.width,Ft+=e.height),At=At>Wt?At:Wt,Mt=Mt>Ft?Mt:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=At-t.x,t.height=Mt-t.y},addList(t,e){Xt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Xt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Xt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=i?i(e[o],o):e[o],r&&(r.width||r.height)&&(n?(n=!1,s||jt(t,r)):Ht(t,r));n&&Xt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?kt(St,t.x,t.y):Tt(St,t.x,t.y)),Rt(St,t)},setPoint(t,e){Xt.set(t,e.x,e.y)},addPoint(t,e){Ht(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ht.tempToInnerRadiusPointOf(e,i)),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,i)=>(i&&(e=ht.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),!(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,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),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,i){if(i&&(e=Xt.tempToOuterOf(e,i)),!Xt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:o}=e;return At=s+n,Mt=r+o,Wt=t.x+t.width,Ft=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,At=At<Wt?At:Wt,Mt=Mt<Ft?Mt:Ft,n=At-s,o=Mt-r,{x:s,y:r,width:n,height:o}},intersect(t,e,i){Xt.copy(t,Xt.getIntersectData(t,e,i))},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){Xt.set(t)}},Xt=Yt,{add:Ht,copy:jt}=Xt;class Vt{get minX(){return Yt.minX(this)}get minY(){return Yt.minY(this)}get maxX(){return Yt.maxX(this)}get maxY(){return Yt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?Yt.copy(this,t):Yt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Vt(this)}move(t,e){return Yt.move(this,t,e),this}scale(t,e,i){return Yt.scale(this,t,e,i),this}scaleOf(t,e,i){return Yt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Yt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Yt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Yt.getFitMatrix(this,t,e)}put(t,e,i){Yt.put(this,t,e,i)}spread(t,e){return Yt.spread(this,t,e),this}shrink(t,e){return Yt.shrink(this,t,e),this}ceil(){return Yt.ceil(this),this}unsign(){return Yt.unsign(this),this}float(t){return Yt.float(this,t),this}add(t){return Yt.add(this,t),this}addList(t){return Yt.setList(this,t,!0),this}setList(t){return Yt.setList(this,t),this}addListWithFn(t,e){return Yt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Yt.setListWithFn(this,t,e),this}setPoint(t){return Yt.setPoint(this,t),this}setPoints(t){return Yt.setPoints(this,t),this}addPoint(t){return Yt.addPoint(this,t),this}getPoints(){return Yt.getPoints(this)}hitPoint(t,e){return Yt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Yt.hitRadiusPoint(this,t,e)}hit(t,e){return Yt.hit(this,t,e)}includes(t,e){return Yt.includes(this,t,e)}intersect(t,e){return Yt.intersect(this,t,e),this}getIntersect(t,e){return new Vt(Yt.getIntersectData(this,t,e))}isSame(t){return Yt.isSame(this,t)}isEmpty(){return Yt.isEmpty(this)}reset(){Yt.reset(this)}}const Gt=new Vt;class Kt{constructor(t,e,i,s,r,n){d(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=t;this.set(e,i,s,r,n,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=this;return new Vt(r,e,n||t.width-r-i,o||t.height-e-s)}}const qt={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:Zt}=M;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=Qt(t)}static set exclude(t){this.excludeList=Qt(t)}static drawRepaint(t,e){const i=Zt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===$t.showBounds,r=t.__nowWorld,n=Zt();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(Jt.enable){if(Jt.filterList.length&&Jt.filterList.every(t=>t!==this.name))return;if(Jt.excludeList.length&&Jt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Jt.enable&&this.warn(...t)}warn(...t){Jt.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 Qt(t){return t?n(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const Jt=$t,te=$t.get("RunTime"),ee={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=v.create(v.RUNTIME);return ie.currentId=ie.idMap[i]=e?performance.now():Date.now(),ie.currentName=ie.nameMap[i]=t,ie.nameToIdMap[t]=i,i},end(t,e){const i=ie.idMap[t],s=ie.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;ie.idMap[t]=ie.nameMap[t]=ie.nameToIdMap[s]=void 0,te.log(s,r,"ms")},endOfName(t,e){const i=ie.nameToIdMap[t];s(i)||ie.end(i,e)}},ie=ee,se=[],re={list:{},add(t,...e){this.list[t]=!0,se.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>se.forEach(t=>re.has(t,!0)));const ne={editor:t=>re.need("editor")},oe=$t.get("UICreator"),ae={list:{},register(t){const{__tag:e}=t.prototype;he[e]&&oe.repeat(e),he[e]=t},get(t,e,i,r,n,o){he[t]||oe.error("not register "+t);const a=new he[t](e);return s(i)||(a.x=i,r&&(a.y=r),n&&(a.width=n),o&&(a.height=o)),a}},{list:he}=ae,le=$t.get("EventCreator"),de={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(ce[e]&&le.repeat(e),ce[e]=t)})},changeName(t,e){const i=ce[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ce[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ce[t](...e)},{nameList:ce}=de;class ue{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ne.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],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 _e(t,e,i,s){var r,n=arguments.length,o=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,i,o):r(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o}function pe(t,e,i,s){return new(i||(i=Promise))(function(r,n){function o(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}function ge(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const fe=[];function ye(){return(t,e)=>{fe.push(e)}}const me=[];class ve{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||me)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;fe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/r*h;r+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}_e([ge("imageSmoothingEnabled")],ve.prototype,"smooth",void 0),_e([ge("imageSmoothingQuality")],ve.prototype,"smoothLevel",void 0),_e([ge("globalAlpha")],ve.prototype,"opacity",void 0),_e([ge()],ve.prototype,"fillStyle",void 0),_e([ge()],ve.prototype,"strokeStyle",void 0),_e([ge("lineWidth")],ve.prototype,"strokeWidth",void 0),_e([ge("lineCap")],ve.prototype,"strokeCap",void 0),_e([ge("lineJoin")],ve.prototype,"strokeJoin",void 0),_e([ge("lineDashOffset")],ve.prototype,"dashOffset",void 0),_e([ge()],ve.prototype,"miterLimit",void 0),_e([ge()],ve.prototype,"shadowBlur",void 0),_e([ge()],ve.prototype,"shadowColor",void 0),_e([ge()],ve.prototype,"shadowOffsetX",void 0),_e([ge()],ve.prototype,"shadowOffsetY",void 0),_e([ge()],ve.prototype,"filter",void 0),_e([ge()],ve.prototype,"font",void 0),_e([ge()],ve.prototype,"fontKerning",void 0),_e([ge()],ve.prototype,"fontStretch",void 0),_e([ge()],ve.prototype,"fontVariantCaps",void 0),_e([ge()],ve.prototype,"textAlign",void 0),_e([ge()],ve.prototype,"textBaseline",void 0),_e([ge()],ve.prototype,"textRendering",void 0),_e([ge()],ve.prototype,"wordSpacing",void 0),_e([ge()],ve.prototype,"letterSpacing",void 0),_e([ge()],ve.prototype,"direction",void 0),_e([ye()],ve.prototype,"setTransform",null),_e([ye()],ve.prototype,"resetTransform",null),_e([ye()],ve.prototype,"getTransform",null),_e([ye()],ve.prototype,"save",null),_e([ye()],ve.prototype,"restore",null),_e([ye()],ve.prototype,"translate",null),_e([ye()],ve.prototype,"scale",null),_e([ye()],ve.prototype,"rotate",null),_e([ye()],ve.prototype,"fill",null),_e([ye()],ve.prototype,"stroke",null),_e([ye()],ve.prototype,"clip",null),_e([ye()],ve.prototype,"fillRect",null),_e([ye()],ve.prototype,"strokeRect",null),_e([ye()],ve.prototype,"clearRect",null),_e([ye()],ve.prototype,"beginPath",null),_e([ye()],ve.prototype,"moveTo",null),_e([ye()],ve.prototype,"lineTo",null),_e([ye()],ve.prototype,"bezierCurveTo",null),_e([ye()],ve.prototype,"quadraticCurveTo",null),_e([ye()],ve.prototype,"closePath",null),_e([ye()],ve.prototype,"arc",null),_e([ye()],ve.prototype,"arcTo",null),_e([ye()],ve.prototype,"ellipse",null),_e([ye()],ve.prototype,"rect",null),_e([ye()],ve.prototype,"roundRect",null),_e([ye()],ve.prototype,"createConicGradient",null),_e([ye()],ve.prototype,"createLinearGradient",null),_e([ye()],ve.prototype,"createPattern",null),_e([ye()],ve.prototype,"createRadialGradient",null),_e([ye()],ve.prototype,"fillText",null),_e([ye()],ve.prototype,"measureText",null),_e([ye()],ve.prototype,"strokeText",null);const{copy:we,multiplyParent:xe,pixelScale:be}=$,{round:Ee}=Math,Pe=new Vt,Be=new Vt,Se={width:1,height:1,pixelRatio:1},ke=["width","height","pixelRatio"];class Te extends ve{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Se),this.manager=e,this.innerId=v.create(v.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||y.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;u.copyAttrs(s,t,ke),ke.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Vt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&xe(t,e,r),be(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Ee(r.e-.5)+.5,r.f=Ee(r.f-.5)+.5):(r.e=Ee(r.e),r.f=Ee(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:r,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=r,this.dashPattern=n,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,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Be):i=Pe,this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Yt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Pe.x,Pe.y,Pe.width,Pe.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Pe.x,Pe.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Pe.x,Pe.y,Pe.width,Pe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Pe.x,Pe.y,Pe.width,Pe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Pe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Be,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):ne.canvas(Object.assign({},i));return r.save(),t&&(we(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Re={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ce={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=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},Ce),Oe={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},De={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ie=Object.assign(Object.assign({},De),Ce),Ae=Le,Me={};for(let t in Ae)Me[Ae[t]]=t;const We={};for(let t in Ae)We[Ae[t]]=Oe[t];const Fe={drawRoundRect(t,e,i,s,r,n){const o=M.fourNumber(n,Math.min(s/2,r/2)),a=e+s,h=i+r;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Ue,cos:ze,hypot:Ne,atan2:Ye,ceil:Xe,abs:He,PI:je,sqrt:Ve,pow:Ge}=Math,{setPoint:Ke,addPoint:qe}=yt,{set:Ze,toNumberPoints:$e}=ht,{M:Qe,L:Je,C:ti,Q:ei,Z:ii}=Le,si={},ri={points(t,e,i,s){let r=$e(e);if(t.push(Qe,r[0],r[1]),i&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===i?.5:i;s&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let i=2;i<y-2;i+=2)e=r[i-2],n=r[i-1],o=r[i],a=r[i+1],h=r[i+2],l=r[i+3],p=Ve(Ge(o-e,2)+Ge(a-n,2)),g=Ve(Ge(h-o,2)+Ge(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=o-p*h,c=a-p*l,2===i?s||t.push(ei,d,c,o,a):t.push(ti,u,_,d,c,o,a),u=o+g*h,_=a+g*l);s||t.push(ei,u,_,r[y-2],r[y-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(Je,r[e],r[e+1]);s&&t.push(ii)},rect(t,e,i,s,r){Re.creator.path=t,Re.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Re.creator.path=[],Fe.drawRoundRect(Re.creator,e,i,s,r,n),t.push(...Re.convertToCanvasData(Re.creator.path,!0))},arcTo(t,e,i,s,r,n,o,a,h,l,d){const c=s-e,u=r-i,_=n-s,p=o-r;let g=Ye(u,c),f=Ye(p,_);const y=Ne(c,u),m=Ne(_,p);let v=f-g;if(v<0&&(v+=U),y<1e-12||m<1e-12||v<1e-12||He(v-je)<1e-12)return t&&t.push(Je,s,r),h&&(Ke(h,e,i),qe(h,s,r)),d&&Ze(d,e,i),void(l&&Ze(l,s,r));const w=c*p-_*u<0,x=w?-1:1,b=a/ze(v/2),E=s+b*ze(g+v/2+z*x),P=r+b*Ue(g+v/2+z*x);return g-=z*x,f-=z*x,ai(t,E,P,a,a,0,g/F,f/F,w,h,l,d)},arc:(t,e,i,s,r,n,o,a,h,l)=>ai(t,e,i,s,s,0,r,n,o,a,h,l),ellipse(t,e,i,s,r,n,o,a,h,l,d,c){const u=n*F,_=Ue(u),p=ze(u);let g=o*F,f=a*F;g>je&&(g-=U),f<0&&(f+=U);let y=f-g;y<0?y+=U:y>U&&(y-=U),h&&(y-=U);const m=Xe(He(y/z)),v=y/m,w=Ue(v/4),x=8/3*w*w/Ue(v/2);f=g+v;let b,E,P,B,S,k,T,R,C=ze(g),L=Ue(g),O=P=p*s*C-_*r*L,D=B=_*s*C+p*r*L,I=e+P,A=i+B;t&&t.push(t.length?Je:Qe,I,A),l&&Ke(l,I,A),c&&Ze(c,I,A);for(let n=0;n<m;n++)b=ze(f),E=Ue(f),P=p*s*b-_*r*E,B=_*s*b+p*r*E,S=e+O-x*(p*s*L+_*r*C),k=i+D-x*(_*s*L-p*r*C),T=e+P+x*(p*s*E+_*r*b),R=i+B+x*(_*s*E-p*r*b),t&&t.push(ti,S,k,T,R,e+P,i+B),l&&oi(e+O,i+D,S,k,T,R,e+P,i+B,l,!0),O=P,D=B,C=b,L=E,g=f,f+=v;d&&Ze(d,e+P,i+B)},quadraticCurveTo(t,e,i,s,r,n,o){t.push(ti,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,o,a){oi(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,o,a)},toTwoPointBounds(t,e,i,s,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?qe(h,t,e):Ke(h,t,e),qe(h,o,a);for(let l=0,c=d.length;l<c;l++)ni(d[l],t,e,i,s,r,n,o,a,si),qe(h,si.x,si.y)},getPointAndSet(t,e,i,s,r,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*a,l.y=c*i+u*r+_*o+p*h},getPoint(t,e,i,s,r,n,o,a,h){const l={};return ni(t,e,i,s,r,n,o,a,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:ni,toTwoPointBounds:oi,ellipse:ai}=ri,{sin:hi,cos:li,sqrt:di,atan2:ci}=Math,{ellipse:ui}=ri,_i={ellipticalArc(t,e,i,s,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*F,p=hi(_),g=li(_),f=-g*c-p*u,m=-g*u+p*c,v=s*s,w=r*r,x=m*m,b=f*f,E=v*w-v*x-w*b;let P=0;if(E<0){const t=di(1-E/(v*w));s*=t,r*=t}else P=(o===a?-1:1)*di(E/(v*x+w*b));const B=P*s*m/r,S=-P*r*f/s,k=ci((m-S)/r,(f-B)/s),T=ci((-m-S)/r,(-f-B)/s);let R=T-k;0===a&&R>0?R-=U:1===a&&R<0&&(R+=U);const C=e+c+g*B-p*S,L=i+u+p*B+g*S,O=R<0?1:0;d||y.ellipseToCurve?ui(t,C,L,s,r,n,k/F,T/F,O):s!==r||n?t.push(Le.G,C,L,s,r,n,k/F,T/F,O):t.push(Le.O,C,L,s,k/F,T/F,O)}},pi={toCommand:t=>[],toNode:t=>[]},{M:gi,m:fi,L:yi,l:mi,H:vi,h:wi,V:xi,v:bi,C:Ei,c:Pi,S:Bi,s:Si,Q:ki,q:Ti,T:Ri,t:Ci,A:Li,a:Oi,Z:Di,z:Ii,N:Ai,D:Mi,X:Wi,G:Fi,F:Ui,O:zi,P:Ni,U:Yi}=Le,{rect:Xi,roundRect:Hi,arcTo:ji,arc:Vi,ellipse:Gi,quadraticCurveTo:Ki}=ri,{ellipticalArc:qi}=_i,Zi=$t.get("PathConvert"),$i={},Qi={current:{dot:0},stringify(t,e){let i,s,r,n=0,o=t.length,a="";for(;n<o;){s=t[n],i=We[s],a+=s===r?" ":Me[s];for(let s=1;s<i;s++)a+=M.float(t[n+s],e),s===i-1||(a+=" ");r=s,n+=i}return a},parse(t,e){let i,s,r,n="";const o=[],a=e?Ie:De;for(let e=0,h=t.length;e<h;e++)s=t[e],qt[s]?("."===s&&(Ji.dot&&(ts(o,n),n=""),Ji.dot++),"0"===n&&"."!==s&&(ts(o,n),n=""),n+=s):Le[s]?(n&&(ts(o,n),n=""),Ji.name=Le[s],Ji.length=Oe[s],Ji.index=0,ts(o,Ji.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ts(o,n),n=s):n&&(ts(o,n),n=""),r=s;return n&&ts(o,n),i?Qi.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case fi:t[c+1]+=a,t[c+2]+=h;case gi:a=t[c+1],h=t[c+2],_.push(gi,a,h),c+=3;break;case wi:t[c+1]+=a;case vi:a=t[c+1],_.push(yi,a,h),c+=2;break;case bi:t[c+1]+=h;case xi:h=t[c+1],_.push(yi,a,h),c+=2;break;case mi:t[c+1]+=a,t[c+2]+=h;case yi:a=t[c+1],h=t[c+2],_.push(yi,a,h),c+=3;break;case Si:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Bi;case Bi:o=n===Ei||n===Bi,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(Ei,l,d,i,s,a,h),c+=5;break;case Pi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=Ei;case Ei:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ei,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ci:t[c+1]+=a,t[c+2]+=h,r=Ri;case Ri:o=n===ki||n===Ri,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Ki(_,a,h,i,s,t[c+1],t[c+2]):_.push(ki,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ti:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ki;case ki:i=t[c+1],s=t[c+2],e?Ki(_,a,h,i,s,t[c+3],t[c+4]):_.push(ki,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Oi:t[c+6]+=a,t[c+7]+=h;case Li:qi(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Ii:case Di:_.push(Di),c++;break;case Ai:a=t[c+1],h=t[c+2],e?Xi(_,a,h,t[c+3],t[c+4]):es(_,t,c,5),c+=5;break;case Mi:a=t[c+1],h=t[c+2],e?Hi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):es(_,t,c,9),c+=9;break;case Wi:a=t[c+1],h=t[c+2],e?Hi(_,a,h,t[c+3],t[c+4],t[c+5]):es(_,t,c,6),c+=6;break;case Fi:Gi(e?_:es(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,$i),a=$i.x,h=$i.y,c+=9;break;case Ui:e?Gi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):es(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case zi:Vi(e?_:es(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,$i),a=$i.x,h=$i.y,c+=7;break;case Ni:e?Vi(_,t[c+1],t[c+2],t[c+3],0,360,!1):es(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Yi:ji(e?_:es(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,$i),a=$i.x,h=$i.y,c+=6;break;default:return Zi.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return pi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(gi,t.x,t.y);break;case"L":e.push(yi,t.x,t.y);break;case"C":e.push(Ei,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ki,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Di)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){Ji.index===Ji.length&&(Ji.index=1,t.push(Ji.name)),t.push(Number(e)),Ji.index++,Ji.dot=0}},{current:Ji,pushData:ts,copyData:es}=Qi,{M:is,L:ss,C:rs,Q:ns,Z:os,N:as,D:hs,X:ls,G:ds,F:cs,O:us,P:_s,U:ps}=Le,{getMinDistanceFrom:gs,getRadianFrom:fs}=ht,{tan:ys,min:ms,abs:vs}=Math,ws={},xs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(is,e,i)},lineTo(t,e,i){t.push(ss,e,i)},bezierCurveTo(t,e,i,s,r,n,o){t.push(rs,e,i,s,r,n,o)},quadraticCurveTo(t,e,i,s,r){t.push(ns,e,i,s,r)},closePath(t){t.push(os)},rect(t,e,i,s,r){t.push(as,e,i,s,r)},roundRect(t,e,i,s,r,n){if(a(n))t.push(ls,e,i,s,r,n);else{const o=M.fourNumber(n);o?t.push(hs,e,i,s,r,...o):t.push(as,e,i,s,r)}},ellipse(t,e,i,s,n,o,a,h,l){r(o)?t.push(cs,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(ds,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(_s,e,i,s):(r(o)&&(o=360),t.push(us,e,i,s,n,o,a?1:0))},arcTo(t,e,i,r,n,o,a,h){if(!s(a)){const t=gs(a,h,e,i,r,n);o=ms(o,ms(t/2,t/2*vs(ys(fs(a,h,e,i,r,n)/2))))}t.push(ps,e,i,r,n,o)},drawEllipse(t,e,i,s,n,o,a,h,l){ri.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,ws),t.push(is,ws.x,ws.y),bs(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){ri.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,ws),t.push(is,ws.x,ws.y),Es(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:bs,arc:Es}=xs,{moveTo:Ps,lineTo:Bs,quadraticCurveTo:Ss,bezierCurveTo:ks,closePath:Ts,beginPath:Rs,rect:Cs,roundRect:Ls,ellipse:Os,arc:Ds,arcTo:Is,drawEllipse:As,drawArc:Ms,drawPoints:Ws}=xs;class Fs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?Re.parse(t):t:[],this}beginPath(){return Rs(this.__path),this.paint(),this}moveTo(t,e){return Ps(this.__path,t,e),this.paint(),this}lineTo(t,e){return Bs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return ks(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ss(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ts(this.__path),this.paint(),this}rect(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Ls(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,o,a){return Os(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}arc(t,e,i,s,r,n){return Ds(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Is(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,o,a){return As(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}drawArc(t,e,i,s,r,n){return Ms(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Ws(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:zs,C:Ns,Q:Ys,Z:Xs,N:Hs,D:js,X:Vs,G:Gs,F:Ks,O:qs,P:Zs,U:$s}=Le,Qs=$t.get("PathDrawer"),Js={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case zs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ys:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Xs:t.closePath(),s+=1;break;case Hs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Vs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Gs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*F,e[s+6]*F,e[s+7]*F,e[s+8]),s+=9;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case qs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*F,e[s+5]*F,e[s+6]),s+=7;break;case Zs:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case $s:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Qs.error(`command: ${i} [index:${s}]`,e)}}},{M:tr,L:er,C:ir,Q:sr,Z:rr,N:nr,D:or,X:ar,G:hr,F:lr,O:dr,P:cr,U:ur}=Le,{toTwoPointBounds:_r,toTwoPointBoundsByQuadraticCurve:pr,arcTo:gr,arc:fr,ellipse:yr}=ri,{addPointBounds:mr,copy:vr,addPoint:wr,setPoint:xr,addBounds:br,toBounds:Er}=yt,Pr=$t.get("PathBounds");let Br,Sr,kr;const Tr={},Rr={},Cr={},Lr={toBounds(t,e){Lr.toTwoPointBounds(t,Rr),Er(Rr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return xr(e,0,0);let i,s,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===rr||o===ir||o===sr?xr(e,h,l):xr(e,t[a+1],t[a+2])),o){case tr:case er:h=t[a+1],l=t[a+2],wr(e,h,l),a+=3;break;case ir:r=t[a+5],n=t[a+6],_r(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,Tr),mr(e,Tr),h=r,l=n,a+=7;break;case sr:i=t[a+1],s=t[a+2],r=t[a+3],n=t[a+4],pr(h,l,i,s,r,n,Tr),mr(e,Tr),h=r,l=n,a+=5;break;case rr:a+=1;break;case nr:h=t[a+1],l=t[a+2],br(e,h,l,t[a+3],t[a+4]),a+=5;break;case or:case ar:h=t[a+1],l=t[a+2],br(e,h,l,t[a+3],t[a+4]),a+=o===or?9:6;break;case hr:yr(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],Tr,Cr),0===a?vr(e,Tr):mr(e,Tr),h=Cr.x,l=Cr.y,a+=9;break;case lr:h=t[a+1],l=t[a+2],Sr=t[a+3],kr=t[a+4],br(e,h-Sr,l-kr,2*Sr,2*kr),h+=Sr,a+=5;break;case dr:fr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Tr,Cr),0===a?vr(e,Tr):mr(e,Tr),h=Cr.x,l=Cr.y,a+=7;break;case cr:h=t[a+1],l=t[a+2],Br=t[a+3],br(e,h-Br,l-Br,2*Br,2*Br),h+=Br,a+=4;break;case ur:gr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Tr,Cr),0===a?vr(e,Tr):mr(e,Tr),h=Cr.x,l=Cr.y,a+=6;break;default:return void Pr.error(`command: ${o} [index:${a}]`,t)}}},{M:Or,L:Dr,Z:Ir}=Le,{getCenterX:Ar,getCenterY:Mr}=ht,{arcTo:Wr}=xs,Fr={smooth(t,e,i){let s,r,n,o=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;o<g;){switch(s=t[o],s){case Or:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===Dr?(c=t[o+1],u=t[o+2],f.push(Or,Ar(l,c),Mr(d,u))):f.push(Or,l,d);break;case Dr:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Dr:Wr(f,a,h,t[o+1],t[o+2],e,_,p);break;case Ir:Wr(f,a,h,l,d,e,_,p);break;default:f.push(Dr,a,h)}_=a,p=h;break;case Ir:r!==Ir&&(Wr(f,l,d,c,u,e,_,p),f.push(Ir)),o+=1;break;default:n=We[s];for(let e=0;e<n;e++)f.push(t[o+e]);o+=n}r=s}return s!==Ir&&(f[1]=l,f[2]=d),f}};function Ur(t){return new Fs(t)}const zr=Ur();Re.creator=Ur(),Re.parse=Qi.parse,Re.convertToCanvasData=Qi.toCanvasData;const{drawRoundRect:Nr}=Fe;function Yr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){Nr(this,t,e,i,s,r)})}(t)}const Xr={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=Hr.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{}}}},Hr=Xr;Hr.alphaPixelTypes.forEach(t=>Hr.upperCaseTypeMap[t]=t.toUpperCase());const jr=$t.get("TaskProcessor");class Vr{constructor(t){this.parallel=!0,this.time=1,this.id=v.create(v.TASK),this.task=t}run(){return pe(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){jr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Gr{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,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&u.assign(this.config,t),this.empty()}add(t,e,i){let r,n,o,h;const l=new Vr(t);return l.parent=this,a(e)?h=e:e&&(n=e.parallel,r=e.start,o=e.time,h=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===n&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,r):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,r))},h)),this.isComplete=!1,l}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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],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 Kr=$t.get("Resource"),qr={tasker:new Gr,map:{},get isComplete(){return Zr.tasker.isComplete},set(t,e){Zr.map[t]&&Kr.repeat(t),Zr.map[t]=e},get:t=>Zr.map[t],remove(t){const e=Zr.map[t];e&&(e.destroy&&e.destroy(),delete Zr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ne.image(s)),Zr.set(t,e),e},destroy(){Zr.map={}}},Zr=qr,$r={maxRecycled:10,recycledList:[],patternTasker:new Gr,get(t){let e=qr.get(t.url);return e||qr.set(t.url,e=ne.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Qr.recycledList.push(t)})},clearRecycled(){const t=Qr.recycledList;t.length>Qr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&qr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Xr.alphaPixelTypes.some(e=>Qr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Xr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Xr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Qr.recycledList=[]}},Qr=$r,{IMAGE:Jr,create:tn}=v;class en{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=tn(Jr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}$r.isFormat("svg",t)&&(this.isSVG=!0),$r.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;qr.tasker.add(()=>pe(this,void 0,void 0,function*(){return yield y.origin.loadImage(this.url,s(t)?y.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,o){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=y.image.resize(this.view,t,e,r,n,void 0,o,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const r=y.canvas.createPattern(t,e);return y.image.setPatternTransform(r,i,s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function sn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function rn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function nn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function on(t,e){return(i,s)=>hn(i,s,t,e&&e(s))}function an(t){return t}function hn(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};sn(t,e,Object.assign(r,s||{})),Mn(t,e,i)}function ln(t){return on(t)}function dn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function cn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function un(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),yn(this))}}))}function _n(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function pn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function gn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&yn(this)}}))}function fn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(yn(this),this.__.__removeNaturalSize())}}))}function yn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function mn(t){return on(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),yn(this)}}))}const vn=gn;function wn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i)&&(xn(this),e&&(this.__.__useStroke=!0))}}))}function xn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&yn(t)}const bn=wn;function En(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Pn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Bn(t){return on(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;u.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Sn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Tn(this)}}))}function kn(t){return on(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Rn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Rn(this,t,e,i),this.mask&&Tn(this)}}))}function Tn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Rn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||yn(t))}function Cn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Ln(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function On(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Dn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function In(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function An(t){return(e,i)=>{sn(e,"__DataProcessor",{get:()=>t})}}function Mn(t,e,i){const r=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=nn(e,i);if(s(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(d(i)){const t=c(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:u.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,_=r;for(;!l&&_;)l=rn(_,e),_=_.__proto__;l&&l.set&&(a.set=l.set),r[o]&&(a.set=r[o],delete r[o]),sn(r,e,a)}const Wn=new $t("rewrite"),Fn=[],Un=["destroy","constructor"];function zn(t){return(e,i)=>{Fn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Nn(){return t=>{Yn()}}function Yn(t){Fn.length&&(Fn.forEach(e=>{t&&Wn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Fn.length=0)}function Xn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Un.includes(s)||e&&e.includes(s)))if(t.prototype){rn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Hn(){return t=>{ae.register(t)}}function jn(){return t=>{de.register(t)}}setTimeout(()=>Yn(!0));const{copy:Vn,toInnerPoint:Gn,toOuterPoint:Kn,scaleOfOuter:qn,rotateOfOuter:Zn,skewOfOuter:$n,multiplyParent:Qn,divideParent:Jn,getLayout:to}=$,eo={},{round:io}=Math,so={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),oo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)no(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.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,i=e.length;t<i;t++)ao(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&ao(t),t.__updateChange()},updateAllChange(t){if(lo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ho(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(t,e,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||y.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=d(e)?Object.assign({},e):{x:e,y:i};s?Kn(t.localTransform,n,n,!0):t.parent&&Gn(t.parent.scrollWorldTransform,n,n,!0),ro.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){d(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=io(e),i=io(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){ro.zoomOfLocal(t,co(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const o=t.__localMatrix;if(a(s)||(s&&(n=s),s=i),Vn(eo,o),qn(eo,e,i,s),ro.hasHighPosition(t))ro.setTransform(t,eo,r,n);else{const e=t.x+eo.e-o.e,a=t.y+eo.f-o.f;n&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){ro.rotateOfLocal(t,co(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Vn(eo,r),Zn(eo,e,i),ro.hasHighPosition(t)?ro.setTransform(t,eo,!1,s):t.set({x:t.x+eo.e-r.e,y:t.y+eo.f-r.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){ro.skewOfLocal(t,co(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){Vn(eo,t.__localMatrix),$n(eo,e,i,s),ro.setTransform(t,eo,r,n)},transformWorld(t,e,i,s){Vn(eo,t.worldTransform),Qn(eo,e),t.parent&&Jn(eo,t.parent.scrollWorldTransform),ro.setTransform(t,eo,i,s)},transform(t,e,i,s){Vn(eo,t.localTransform),Qn(eo,e),ro.setTransform(t,eo,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&ro.getInnerOrigin(t,r.origin),o=to(e,n,r.around&&ro.getInnerOrigin(t,r.around));if(ro.hasOffset(t)&&(o.x-=r.offsetX,o.y-=r.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){Yt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=ro.getInnerOrigin(t,r.origin);ht.move(o,n.x-s.x,n.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return qn(i,ro.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ht.tempToOuterOf(ro.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Vn(eo,t.worldTransform),Jn(eo,e.scrollWorldTransform),i?eo:Object.assign({},eo)),drop(t,e,i,s){t.setTransform(ro.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||ro.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(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),y.requestRender(()=>ro.animateMove(t,e,i))}}},ro=so,{updateAllMatrix:no,updateMatrix:oo,updateAllWorldOpacity:ao,updateAllChange:ho,updateChange:lo}=ro;function co(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const uo={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)=>po(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>po(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>po(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 _o;function po(t,e){return e||(_o=0),t.__.mask&&(_o=1),_o<0?null:(_o&&(_o=-1),!0)}const{updateBounds:go}=so,fo={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:i}=t;for(let s=0,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),yo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)mo(e[t],e)},updateBounds(t,e){const i=[t];mo(t,i),vo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)go(s[t]);e&&e===i||go(i)}}},{pushAllChildBranch:yo,pushAllBranchStack:mo,updateBoundsByBranchStack:vo}=fo,wo={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:xo,updateBounds:bo}=so,{toOuterOf:Eo,getPoints:Po,copy:Bo}=Yt,So="_localContentBounds",ko="_worldContentBounds",To="_worldBoxBounds",Ro="_worldStrokeBounds";class Co{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 Eo(this.contentBounds,this.leaf.__localMatrix,this[So]||(this[So]={})),this[So]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Eo(this.contentBounds,this.leaf.__world,this[ko]||(this[ko]={})),this[ko]}get worldBoxBounds(){return Eo(this.boxBounds,this.leaf.__world,this[To]||(this[To]={})),this[To]}get worldStrokeBounds(){return Eo(this.strokeBounds,this.leaf.__world,this[Ro]||(this[Ro]={})),this[Ro]}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:t}=this,{leafer:e}=t;if(t.isApp)return bo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,y.layout(i),delete i.__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 $.defaultMatrix;case"page":t=e.zoomLayer;default:return xo(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 Vt(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",i){const{leaf:s}=this;let r,n,o,a=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(a);break;case"inner":r=a,n=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(a,e),n=xo(s,e,!0)}if(o||(o=$.getLayout(n)),Bo(o,a),ht.copy(o,r),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,r=Po(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return s(n)||r.forEach(t=>i.innerToWorld(t,null,!1,n)),r}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}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 Lo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&y.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&y.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&y.event.stop(this.origin)}}class Oo extends Lo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Oo.ADD="child.add",Oo.REMOVE="child.remove",Oo.CREATED="created",Oo.MOUNTED="mounted",Oo.UNMOUNTED="unmounted",Oo.DESTROY="destroy";const Do="property.scroll";class Io extends Lo{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Io.CHANGE="property.change",Io.LEAFER_CHANGE="property.leafer_change",Io.SCROLL=Do;const Ao={scrollX:Do,scrollY:Do};class Mo extends Lo{constructor(t,e){super(t),Object.assign(this,e)}}Mo.LOAD="image.load",Mo.LOADED="image.loaded",Mo.ERROR="image.error";class Wo extends Lo{static checkHas(t,e,i){"on"===i?e===No?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Fo)||t.hasEvent(Uo)||t.hasEvent(zo),t.__hasWorldEvent=t.hasEvent(No))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Fo,t),"inner"===e&&t.emit(Uo,t)),t.emit(zo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(No,this)}}Wo.RESIZE="bounds.resize",Wo.INNER="bounds.inner",Wo.LOCAL="bounds.local",Wo.WORLD="bounds.world";const{RESIZE:Fo,INNER:Uo,LOCAL:zo,WORLD:No}=Wo,Yo={};[Fo,Uo,zo,No].forEach(t=>Yo[t]=1);class Xo extends Lo{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){d(t)?(super(Xo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Xo.RESIZE="resize";class Ho extends Lo{constructor(t,e){super(t),this.data=e}}Ho.REQUEST="watch.request",Ho.DATA="watch.data";class jo extends Lo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}jo.REQUEST="layout.request",jo.START="layout.start",jo.BEFORE="layout.before",jo.LAYOUT="layout",jo.AFTER="layout.after",jo.AGAIN="layout.again",jo.END="layout.end";class Vo extends Lo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Vo.REQUEST="render.request",Vo.CHILD_START="render.child_start",Vo.CHILD_END="render.child_end",Vo.START="render.start",Vo.BEFORE="render.before",Vo.RENDER="render",Vo.AFTER="render.after",Vo.AGAIN="render.again",Vo.END="render.end",Vo.NEXT="render.next";class Go extends Lo{}Go.START="leafer.start",Go.BEFORE_READY="leafer.before_ready",Go.READY="leafer.ready",Go.AFTER_READY="leafer.after_ready",Go.VIEW_READY="leafer.view_ready",Go.VIEW_COMPLETED="leafer.view_completed",Go.STOP="leafer.stop",Go.RESTART="leafer.restart",Go.END="leafer.end",Go.UPDATE_MODE="leafer.update_mode",Go.TRANSFORM="leafer.transform",Go.MOVE="leafer.move",Go.SCALE="leafer.scale",Go.ROTATE="leafer.rotate",Go.SKEW="leafer.skew";const{MOVE:Ko,SCALE:qo,ROTATE:Zo,SKEW:$o}=Go,Qo={x:Ko,y:Ko,scaleX:qo,scaleY:qo,rotation:Zo,skewX:$o,skewY:$o},Jo={};class ta{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,o;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const a=ea(this,s,!0),h=n(t)?t.split(" "):t,d=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(d):a[t]=[d],Yo[t]&&Wo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ea(this,t);s.forEach(t=>{t&&(r=o[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete o[t],Yo[t]&&Wo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):l(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:s}}off_(t){if(!t)return;const e=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&de.has(t)&&(e=de.get(t,{type:t,target:this,current:this}));const s=ea(this,i)[t];if(s){let r;for(let n=0,o=s.length;n<o&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}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:i,__captureMap:r}=this,n=i&&i[t],o=r&&r[t];return!!(s(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ea(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Jo)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Jo)}}const{on:ia,on_:sa,off:ra,off_:na,once:oa,emit:aa,emitEvent:ha,hasEvent:la,destroy:da}=ta.prototype,ca={on:ia,on_:sa,off:ra,off_:na,once:oa,emit:aa,emitEvent:ha,hasEvent:la,destroyEventer:da},ua=$t.get("setAttr"),_a={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||o(e)||s(e)||(ua.warn(this.innerName,t,e),e=void 0),d(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Io(Io.LEAFER_CHANGE,this,t,r,e));const i=Qo[t];i&&(this.emitEvent(new Go(i,this)),this.emitEvent(new Go(Go.TRANSFORM,this)))}this.emitPropertyEvent(Io.CHANGE,t,r,e);const i=Ao[t];return i&&this.emitPropertyEvent(i,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Io(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:pa,multiplyParent:ga,translateInner:fa,defaultWorld:ya}=$,{toPoint:ma,tempPoint:va}=bt,wa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;ga(this.__local||e,t?t.__scrollWorld||t.__world:ya,i,!!e.affectScaleOrRotation,r),s&&fa(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(pa(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(ma(i.around||i.origin,t.boxBounds,va),fa(e,-va.x,-va.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:xa,updateAllMatrix:ba}=so,{updateBounds:Ea}=fo,{toOuterOf:Pa,copyAndSpread:Ba,copy:Sa}=Yt,{toBounds:ka}=Lr,Ta={__updateWorldBounds(){const{__layout:t,__world:e}=this;Pa(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Wo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Wo.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(),Pa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Pa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Pa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?ka(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ba(this),Ea(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ba(this),Ea(this,this))):xa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ba(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Sa(e.renderBounds,e.strokeBounds):Ba(e.renderBounds,e.boxBounds,i)}},Ra={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),so.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);$t.showBounds&&$t.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:Ca}=uo,La={__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 i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Ca(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Ca(i[s],e)||i[s].__clip(t,e)}}},Oa={},{LEAF:Da,create:Ia}=v,{stintSet:Aa}=u,{toInnerPoint:Ma,toOuterPoint:Wa,multiplyParent:Fa}=$,{toOuterOf:Ua}=Yt,{copy:za,move:Na}=ht,{moveLocal:Ya,zoomOfLocal:Xa,rotateOfLocal:Ha,skewOfLocal:ja,moveWorld:Va,zoomOfWorld:Ga,rotateOfWorld:Ka,skewOfWorld:qa,transform:Za,transformWorld:$a,setTransform:Qa,getFlipTransform:Ja,getLocalOrigin:th,getRelativeWorld:eh,drop:ih}=so;t.Leaf=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 p}get __LayoutProcessor(){return Co}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=Ia(Da),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Oo.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(Oo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Oo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}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(Oo.MOUNTED)):this.__emitLifeEvent(Oo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__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){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(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:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.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,i=this.__world;return Fa(i,t.matrix,e,void 0,i),Ua(this.__layout.renderBounds,e,e),Aa(e,"half",i.half),Aa(e,"ignorePixelSnap",i.ignorePixelSnap),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:i,scaleY:s}=$r.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Oa.scaleX=i,Oa.scaleY=s,Oa}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?eh(this,e):this.worldTransform,r=i?t:{};return Ua(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&za(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&za(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ma(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Wa(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Na(r,-n,-o),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Na(r,n,o),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Qa(this,t,e,i)}transform(t,e,i){Za(this,t,e,i)}move(t,e,i){Ya(this,t,e,i)}moveInner(t,e,i){Va(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Xa(this,th(this,t),e,i,s,r)}rotateOf(t,e,i){Ha(this,th(this,t),e,i)}skewOf(t,e,i,s,r){ja(this,th(this,t),e,i,s,r)}transformWorld(t,e,i){$a(this,t,e,i)}moveWorld(t,e,i){Va(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Ga(this,t,e,i,s,r)}rotateOfWorld(t,e){Ka(this,t,e)}skewOfWorld(t,e,i,s,r){qa(this,t,e,i,s,r)}flip(t,e){Za(this,Ja(this,t),!1,e)}scaleResize(t,e=t,i){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,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return re.need("path")}getMotionPoint(t){return re.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,i){ih(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Mn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=gn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Oo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Oo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=_e([Xn(_a),Xn(wa),Xn(Ta),Xn(ca),Xn(Ra)],t.Leaf);const{setListWithFn:sh}=Yt,{sort:rh}=fo,{localBoxBounds:nh,localStrokeBounds:oh,localRenderBounds:ah,maskLocalBoxBounds:hh,maskLocalStrokeBounds:lh,maskLocalRenderBounds:dh}=uo,ch=new $t("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){sh(e||this.__layout.boxBounds,this.children,this.__hasMask?hh:nh)}__updateStrokeBounds(t){sh(t||this.__layout.strokeBounds,this.children,this.__hasMask?lh:oh)}__updateRenderBounds(t){sh(t||this.__layout.renderBounds,this.children,this.__hasMask?dh:ah)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(rh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ch.warn("add self or destroyed");const i=s(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ae.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?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(Oo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Oo.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)):s(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 i=this.children.indexOf(t);i>-1&&(this.children.splice(i,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(Oo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Oo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Oo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=_e([Xn(La)],t.Branch);class uh{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let r=0,n=e.length;r<n;r++)s(i)?e[r].innerId===t.innerId&&(i=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;s(i)||e.splice(i,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 uh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class _h{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const ph=$t.get("LeaferCanvas");class gh extends Te{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}y.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=n(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else ph.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:r}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:i}=this;t.width?(s(e)&&(this.autoWidthStr=r.width||""),r.width=t.width+"px"):s(e)||(r.width=e),t.height?(s(i)&&(this.autoHeightStr=r.height||""),r.height=t.height+"px"):s(i)||(r.height=i)}else r.width=t+"px",r.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),ph.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),y.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=y.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:r,height:n}=this.autoBounds.getBoundsFrom(t),o={width:r,height:n,pixelRatio:this.config.pixelRatio?this.pixelRatio:y.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};u.copyAttrs(e,this,ke),this.resize(t),this.resizeListener&&!s(this.width)&&this.resizeListener(new Xo(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}Yr(CanvasRenderingContext2D.prototype),Yr(Path2D.prototype);const{mineType:fh,fileType:yh}=Xr;function mh(t,e){y.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=fh(e),r=t.toDataURL(s,i);return"image/bmp"===s?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,fh(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL(fh(yh(e)),i);return y.origin.download(s,e)},download:(t,e)=>new Promise(i=>{let s=document.createElement("a");s.href=t,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),i()}),loadImage:t=>new Promise((e,i)=>{const s=new y.origin.Image,{crossOrigin:r}=y.image;r&&(s.setAttribute("crossOrigin",r),s.crossOrigin=r),s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=y.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},y.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},y.canvas=ne.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(ne,{canvas:(t,e)=>new gh(t,e),image:t=>new en(t)}),y.name="web",y.isMobile="ontouchstart"in window,y.requestRender=function(t){window.requestAnimationFrame(t)},sn(y,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:vh}=navigator;vh.indexOf("Firefox")>-1?(y.conicGradientRotate90=!0,y.intWheelDeltaY=!0,y.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(y.fullImageShadow=!0),vh.indexOf("Windows")>-1?(y.os="Windows",y.intWheelDeltaY=!0):vh.indexOf("Mac")>-1?y.os="Mac":vh.indexOf("Linux")>-1&&(y.os="Linux");class wh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new uh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new uh,this.target=t,e&&(this.config=u.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Vo.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Oo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Ho(Ho.DATA,{updatedList:this.updatedList})),this.__updatedList=new uh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Io.CHANGE,this.__onAttrChange,this],[[Oo.ADD,Oo.REMOVE],this.__onChildEvent,this],[Ho.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:xh,updateBounds:bh,updateChange:Eh}=so,{pushAllChildBranch:Ph,pushAllParent:Bh}=fo;const{worldBounds:Sh}=uo;class kh{constructor(t){this.updatedBounds=new Vt,this.beforeBounds=new Vt,this.afterBounds=new Vt,l(t)&&(t=new uh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Sh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Sh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Th,updateAllChange:Rh}=so,Ch=$t.get("Layouter");class Lh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new _h,this.target=t,e&&(this.config=u.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(jo.START),this.layoutOnce(),t.emitEvent(new jo(jo.END,this.layoutedBlocks,this.times))}catch(t){Ch.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ch.warn("layouting"):this.times>3?Ch.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ho.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ee.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=jo,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new jo(r,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(xh(t,!0),e.add(t),t.isBranch&&Ph(t,e),Bh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Bh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||bh(s[t])}bh(i)}})}(this.__levelList),function(t){t.list.forEach(Eh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new jo(n,a,this.times)),i.emitEvent(new jo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ee.end(e)}fullLayout(){const t=ee.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=jo,n=this.getBlocks(new uh(e));e.emitEvent(new jo(i,n,this.times)),Lh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new jo(s,n,this.times)),e.emitEvent(new jo(r,n,this.times)),this.addBlocks(n),ee.end(t)}static fullLayout(t){Th(t,!0),t.isBranch?fo.updateBounds(t):so.updateBounds(t),Rh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new kh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new kh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[jo.REQUEST,this.layout,this],[jo.AGAIN,this.layoutAgain,this],[Ho.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Oh=$t.get("Renderer");class Dh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=u.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(jo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Vo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Vo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Vo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Vt,Oh.log(e.innerName,"---\x3e");try{this.emitRender(Vo.START),this.renderOnce(t),this.emitRender(Vo.END,this.totalBounds),$r.clearRecycled()}catch(t){this.rendering=!1,Oh.error(t)}Oh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Oh.warn("rendering");if(this.times>3)return Oh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Vt,this.renderOptions={},t)this.emitRender(Vo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Vo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Vo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Vo.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=ee.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new Vt(s);i.save(),s.spread(Dh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,r),i.restore(),ee.end(e)}fullRender(){const t=ee.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ee.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),r=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),$t.showRepaint&&$t.drawRepaint(i,t),y.render(this.target,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Vt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return y.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Vt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Vt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Oh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Vo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Vo.REQUEST,this.update,this],[jo.END,this.__onLayoutEnd,this],[Vo.AGAIN,this.renderAgain,this],[Xo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Dh.clipSpread=10;const{hitRadiusPoint:Ih}=Yt;class Ah{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new uh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,r,!!i.findList),h=r?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new uh;if(t.length){let e;const{x:s,y:n}=this.point,o={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||so.worldHittable(e))&&(this.hitChild(e,o),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&so.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>so.worldHittable(t))}getPath(t){const e=new uh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new uh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new uh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,o=i.length;t<o;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:r}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Ih(i.__world,r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(r))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,o=n.length;s<o;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Mh{constructor(t,e){this.config={},e&&(this.config=u.default(e,this.config)),this.picker=new Ah(this.target=t,this),this.finder=ne.finder&&ne.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return y.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Wh(t){return on(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Fh(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Uh(){return(t,e)=>{const i="_"+e;sn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ne,{watcher:(t,e)=>new wh(t,e),layouter:(t,e)=>new Lh(t,e),renderer:(t,e,i)=>new Dh(t,e,i),selector:(t,e)=>new Mh(t,e)}),y.layout=Lh.fullLayout,y.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new uh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const zh={},Nh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Yh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Xh={},Hh={},jh={},Vh={},Gh={},Kh={apply(){re.need("filter")}},qh={},Zh={setStyleName:()=>re.need("state"),set:()=>re.need("state")},$h={list:{},register(t,e){$h.list[t]=e},get:t=>$h.list[t]},{parse:Qh,objectToCanvasData:Jh}=Qi,{stintSet:tl}=u,{hasTransparent:el}=Nh,il={originPaint:{}},sl=$t.get("UIData");class rl extends p{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,sl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,sl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(tl(this,"__isTransparentFill",el(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(tl(this,"__isTransparentStroke",el(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?Qh(t):Jh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){nl(this,"shadow",t)}setInnerShadow(t){nl(this,"innerShadow",t)}setFilter(t){nl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Hh.compute("fill",this.__leaf),e&&Hh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=il)):(this.__isStrokes=!0,this._stroke||(this._stroke=il))}__removePaint(t,e){e&&this.__removeInput(t),jh.recycleImage(t,this),"fill"===t?(tl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(tl(this,"__isAlphaPixelStroke",void 0),tl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function nl(t,e,i){t.__setInput(e,i),l(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class ol extends rl{}class al extends ol{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class hl extends ol{__getInputData(t,e){const i=super.__getInputData(t,e);return ke.forEach(t=>delete i[t]),i}}class ll extends al{}class dl extends rl{get __usePathBox(){return this.points||this.__pathInputed}}class cl extends rl{get __boxStroke(){return!this.__pathInputed}}class ul extends rl{get __boxStroke(){return!this.__pathInputed}}class _l extends dl{}class pl extends rl{}class gl extends rl{get __pathInputed(){return 2}}class fl extends ol{}const yl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ml extends rl{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=yl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ae.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class vl extends cl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class wl extends cl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:xl,add:bl}=S,El={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=xl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Gh.getShadowRenderSpread(this,e)),s&&(t=xl(t,s)),n&&(t=bl(t,Kh.getSpread(n))),o&&(t=bl(t,o)),a&&(t=bl(t,a));let l=t;return i&&(l=xl(l,Gh.getInnerShadowSpread(this,i))),r&&(l=xl(l,r)),this.__layout.renderShapeSpread=l,h?xl(h.__updateRenderSpread(),t):t}},{stintSet:Pl}=u,Bl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Pl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Pl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Pl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Gh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Pl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Sl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Hh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Gh.shadow(this,t,h),a&&(s.__isStrokes?Hh.strokes(n,this,t,e):Hh.stroke(n,this,t,e)),r&&(s.__isFills?Hh.fills(r,this,t,e):Hh.fill(r,this,t,e)),o&&this.__drawAfterFill(t,e),d&&Gh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?Hh.strokes(n,this,t,e):Hh.stroke(n,this,t,e)),c&&Kh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Hh.strokes(n,this,t,e):Hh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,Nh.string(e.color))}r&&(s.__isFills?Hh.fills(r,this,t,e):Hh.fill(r,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?Hh.strokes(n,this,t,e):Hh.stroke(n,this,t,e))}}else s.__pathInputed?Sl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Hh.fills(s,this,t,e):Hh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Hh.strokes(r,this,t,e):Hh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Sl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Hh.stroke(r,t,e,i),s&&Hh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!o&&Hh.stroke(r,t,e,i)}const kl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Tl,Rl;t.UI=Tl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){M.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return zr.set(this.path=t||[]),t||this.__drawPathByBox(zr),zr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(zr.set(i=[]),this.__drawPathByBox(zr)),t?Qi.toCanvasData(i,!0):i}getPathString(t,e,i){return Qi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||qh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Fr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Xh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Js.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,r,a(n)?[n]:n)}else t.rect(e,i,s,r)}drawImagePlaceholder(t,e,i){Hh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=u.clone(this.toJSON());return t&&Object.assign(e,t),Tl.one(e)}static one(t,e,i,s,r){return ae.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Hn()(this)}static registerData(t){An(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},_e([An(rl)],t.UI.prototype,"__",void 0),_e([Uh()],t.UI.prototype,"zoomLayer",void 0),_e([ln("")],t.UI.prototype,"id",void 0),_e([ln("")],t.UI.prototype,"name",void 0),_e([ln("")],t.UI.prototype,"className",void 0),_e([Pn("pass-through")],t.UI.prototype,"blendMode",void 0),_e([Sn(1)],t.UI.prototype,"opacity",void 0),_e([kn(!0)],t.UI.prototype,"visible",void 0),_e([Pn(!1)],t.UI.prototype,"locked",void 0),_e([Bn(!1)],t.UI.prototype,"dim",void 0),_e([Bn(!1)],t.UI.prototype,"dimskip",void 0),_e([Cn(0)],t.UI.prototype,"zIndex",void 0),_e([Ln(!1)],t.UI.prototype,"mask",void 0),_e([On(!1)],t.UI.prototype,"eraser",void 0),_e([dn(0,!0)],t.UI.prototype,"x",void 0),_e([dn(0,!0)],t.UI.prototype,"y",void 0),_e([gn(100,!0)],t.UI.prototype,"width",void 0),_e([gn(100,!0)],t.UI.prototype,"height",void 0),_e([_n(1,!0)],t.UI.prototype,"scaleX",void 0),_e([_n(1,!0)],t.UI.prototype,"scaleY",void 0),_e([pn(0,!0)],t.UI.prototype,"rotation",void 0),_e([pn(0,!0)],t.UI.prototype,"skewX",void 0),_e([pn(0,!0)],t.UI.prototype,"skewY",void 0),_e([dn(0,!0)],t.UI.prototype,"offsetX",void 0),_e([dn(0,!0)],t.UI.prototype,"offsetY",void 0),_e([cn(0,!0)],t.UI.prototype,"scrollX",void 0),_e([cn(0,!0)],t.UI.prototype,"scrollY",void 0),_e([un()],t.UI.prototype,"origin",void 0),_e([un()],t.UI.prototype,"around",void 0),_e([ln(!1)],t.UI.prototype,"lazy",void 0),_e([fn(1)],t.UI.prototype,"pixelRatio",void 0),_e([En(0)],t.UI.prototype,"renderSpread",void 0),_e([mn()],t.UI.prototype,"path",void 0),_e([vn()],t.UI.prototype,"windingRule",void 0),_e([vn(!0)],t.UI.prototype,"closed",void 0),_e([gn(0)],t.UI.prototype,"padding",void 0),_e([gn(!1)],t.UI.prototype,"lockRatio",void 0),_e([gn()],t.UI.prototype,"widthRange",void 0),_e([gn()],t.UI.prototype,"heightRange",void 0),_e([ln(!1)],t.UI.prototype,"draggable",void 0),_e([ln()],t.UI.prototype,"dragBounds",void 0),_e([ln("auto")],t.UI.prototype,"dragBoundsType",void 0),_e([ln(!1)],t.UI.prototype,"editable",void 0),_e([Dn(!0)],t.UI.prototype,"hittable",void 0),_e([Dn("path")],t.UI.prototype,"hitFill",void 0),_e([bn("path")],t.UI.prototype,"hitStroke",void 0),_e([Dn(!1)],t.UI.prototype,"hitBox",void 0),_e([Dn(!0)],t.UI.prototype,"hitChildren",void 0),_e([Dn(!0)],t.UI.prototype,"hitSelf",void 0),_e([Dn()],t.UI.prototype,"hitRadius",void 0),_e([In("")],t.UI.prototype,"cursor",void 0),_e([Pn()],t.UI.prototype,"fill",void 0),_e([bn(void 0,!0)],t.UI.prototype,"stroke",void 0),_e([bn("inside")],t.UI.prototype,"strokeAlign",void 0),_e([bn(1,!0)],t.UI.prototype,"strokeWidth",void 0),_e([bn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),_e([bn("none")],t.UI.prototype,"strokeCap",void 0),_e([bn("miter")],t.UI.prototype,"strokeJoin",void 0),_e([bn()],t.UI.prototype,"dashPattern",void 0),_e([bn(0)],t.UI.prototype,"dashOffset",void 0),_e([bn(10)],t.UI.prototype,"miterLimit",void 0),_e([vn(0)],t.UI.prototype,"cornerRadius",void 0),_e([vn()],t.UI.prototype,"cornerSmoothing",void 0),_e([Wh()],t.UI.prototype,"shadow",void 0),_e([Wh()],t.UI.prototype,"innerShadow",void 0),_e([Wh()],t.UI.prototype,"blur",void 0),_e([Wh()],t.UI.prototype,"backgroundBlur",void 0),_e([Wh()],t.UI.prototype,"grayscale",void 0),_e([Wh()],t.UI.prototype,"filter",void 0),_e([Pn()],t.UI.prototype,"placeholderColor",void 0),_e([ln(100)],t.UI.prototype,"placeholderDelay",void 0),_e([ln({})],t.UI.prototype,"data",void 0),_e([zn(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Tl=_e([Xn(El),Xn(Bl),Nn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},_e([An(ol)],t.Group.prototype,"__",void 0),_e([gn(0)],t.Group.prototype,"width",void 0),_e([gn(0)],t.Group.prototype,"height",void 0),t.Group=_e([Xn(t.Branch),Hn()],t.Group);const Cl=$t.get("Leafer");t.Leafer=Rl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&qr.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Rl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,u.assign(s,t));const r=this.canvas=ne.canvas(s);this.__controllers.push(this.renderer=ne.renderer(this,r,s),this.watcher=ne.watcher(this,s),this.layouter=ne.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=ne.selector(this),this.interaction=ne.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ne.hitCanvasManager()),this.canvasManager=new ue,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),wo.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Go.RESTART):this.emitLeafer(Go.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Go.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=u.copyAttrs({},t,ke);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Vt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=u.copyAttrs({},this.canvas,ke);e.resize(t),this.updateLazyBounds(),this.__onResize(new Xo(t,i))}__onResize(t){this.emitEvent(t),u.copyAttrs(this.__,t,ke),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ke.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(Go.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ke.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=u.copyAttrs({},s,ke);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Go.BEFORE_READY),this.emitLeafer(Go.READY),this.emitLeafer(Go.AFTER_READY),wo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Go.VIEW_READY),wo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(r=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){wo.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Go.VIEW_COMPLETED),wo.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return re.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Go(t,this))}__listenEvents(){const t=ee.start("FirstCreate "+this.innerName);this.once([[Go.START,()=>ee.end(t)],[jo.START,this.updateLazyBounds,this],[Vo.START,this.__onCreated,this],[Vo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ho.DATA,this.__onWatchData,this],[jo.END,this.__onLayoutEnd,this],[Vo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Rl.list.remove(this);try{this.stop(),this.emitLeafer(Go.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{$r.clearRecycled()},100)}catch(t){Cl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new uh,_e([An(hl)],t.Leafer.prototype,"__",void 0),_e([gn()],t.Leafer.prototype,"pixelRatio",void 0),_e([ln("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Rl=_e([Hn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},_e([An(cl)],t.Rect.prototype,"__",void 0),t.Rect=_e([Xn(kl),Nn(),Hn()],t.Rect);const{add:Ll,includes:Ol,scroll:Dl}=Yt,Il=t.Rect.prototype,Al=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(Ll(a,n),Dl(a,i)),this.__updateRectRenderBounds(),t=!Ol(n,a),t&&"show"===o&&Ll(r,a)}else this.__updateRectRenderBounds();u.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},_e([An(al)],t.Box.prototype,"__",void 0),_e([gn(100)],t.Box.prototype,"width",void 0),_e([gn(100)],t.Box.prototype,"height",void 0),_e([ln(!1)],t.Box.prototype,"resizeChildren",void 0),_e([En("show")],t.Box.prototype,"overflow",void 0),_e([zn(Il.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),_e([zn(Il.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),_e([zn(Il.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),_e([zn(Il.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),_e([zn(Il.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),_e([zn(Il.__updateChange)],t.Box.prototype,"__updateRectChange",null),_e([zn(Il.__render)],t.Box.prototype,"__renderRect",null),_e([zn(Al.__render)],t.Box.prototype,"__renderGroup",null),t.Box=_e([Nn(),Hn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},_e([An(ll)],t.Frame.prototype,"__",void 0),_e([Pn("#FFFFFF")],t.Frame.prototype,"fill",void 0),_e([En("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=_e([Hn()],t.Frame);const{moveTo:Ml,closePath:Wl,ellipse:Fl}=xs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];i?(s||r?(i<1&&Fl(a,n,o,n*i,o*i,0,s,r,!1),Fl(a,n,o,n,o,0,r,s,!0),i<1&&Wl(a)):(i<1&&(Fl(a,n,o,n*i,o*i),Ml(a,t,o)),Fl(a,n,o,n,o,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||r?(Ml(a,n,o),Fl(a,n,o,n,o,0,s,r,!1),Wl(a)):Fl(a,n,o,n,o)}},_e([An(ul)],t.Ellipse.prototype,"__",void 0),_e([vn(0)],t.Ellipse.prototype,"innerRadius",void 0),_e([vn(0)],t.Ellipse.prototype,"startAngle",void 0),_e([vn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=_e([Hn()],t.Ellipse);const{sin:Ul,cos:zl,PI:Nl}=Math,{moveTo:Yl,lineTo:Xl,closePath:Hl,drawPoints:jl}=xs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)jl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,o=s/2;Yl(e,n,0);for(let t=1;t<r;t++)Xl(e,n+n*Ul(2*t*Nl/r),o-o*zl(2*t*Nl/r));Hl(e)}}},_e([An(_l)],t.Polygon.prototype,"__",void 0),_e([vn(3)],t.Polygon.prototype,"sides",void 0),_e([vn()],t.Polygon.prototype,"points",void 0),_e([vn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=_e([Nn(),Hn()],t.Polygon);const{sin:Vl,cos:Gl,PI:Kl}=Math,{moveTo:ql,lineTo:Zl,closePath:$l}=xs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,o=this.__.path=[];ql(o,r,0);for(let t=1;t<2*i;t++)Zl(o,r+(t%2==0?r:r*s)*Vl(t*Kl/i),n-(t%2==0?n:n*s)*Gl(t*Kl/i));$l(o)}},_e([An(pl)],t.Star.prototype,"__",void 0),_e([vn(5)],t.Star.prototype,"corners",void 0),_e([vn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=_e([Hn()],t.Star);const{moveTo:Ql,lineTo:Jl,drawPoints:td}=xs,{rotate:ed,getAngle:id,getDistance:sd,defaultPoint:rd}=ht;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&ed(i,e),i}set toPoint(t){this.width=sd(rd,t),this.rotation=id(rd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?td(e,t.points,t.curve,t.closed):(Ql(e,0,0),Jl(e,this.width,0))}},_e([An(dl)],t.Line.prototype,"__",void 0),_e([wn("center")],t.Line.prototype,"strokeAlign",void 0),_e([gn(0)],t.Line.prototype,"height",void 0),_e([vn()],t.Line.prototype,"points",void 0),_e([vn(0)],t.Line.prototype,"curve",void 0),_e([vn(!1)],t.Line.prototype,"closed",void 0),t.Line=_e([Hn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}},_e([An(vl)],t.Image.prototype,"__",void 0),_e([gn("")],t.Image.prototype,"url",void 0),t.Image=_e([Hn()],t.Image);const nd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ne.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new en({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Mo(Mo.LOADED,{image:t}))})}draw(t,e,i,s){const r=new gt(t.worldTransform).invert(),n=new gt;e&&n.translate(e.x,e.y),i&&(a(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},_e([An(wl)],t.Canvas.prototype,"__",void 0),_e([Fh(100)],t.Canvas.prototype,"width",void 0),_e([Fh(100)],t.Canvas.prototype,"height",void 0),_e([Fh(1)],t.Canvas.prototype,"pixelRatio",void 0),_e([Fh(!0)],t.Canvas.prototype,"smooth",void 0),_e([ln(!1)],t.Canvas.prototype,"safeResize",void 0),_e([Fh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=_e([Hn()],t.Canvas);const{copyAndSpread:od,includes:ad,spread:hd,setList:ld}=Yt,{stintSet:dd}=u;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Yh.number(e,r),t.__letterSpacing=Yh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,dd(t,"__padding",l&&M.fourNumber(l)),dd(t,"__clipText","show"!==h&&!t.__autoSize),dd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=zh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&hd(a,i/2),n||o){if(h.x=n?a.x:0,h.y=o?a.y:0,h.width=n?a.width:t.width,h.height=o?a.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),u.stintSet(this,"isOverflow",!ad(h,a)),this.isOverflow?(ld(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;od(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},_e([An(ml)],t.Text.prototype,"__",void 0),_e([gn(0)],t.Text.prototype,"width",void 0),_e([gn(0)],t.Text.prototype,"height",void 0),_e([Pn()],t.Text.prototype,"boxStyle",void 0),_e([ln(!1)],t.Text.prototype,"resizeFontSize",void 0),_e([Pn("#000000")],t.Text.prototype,"fill",void 0),_e([wn("outside")],t.Text.prototype,"strokeAlign",void 0),_e([Dn("all")],t.Text.prototype,"hitFill",void 0),_e([gn("")],t.Text.prototype,"text",void 0),_e([gn("")],t.Text.prototype,"placeholder",void 0),_e([gn("caption")],t.Text.prototype,"fontFamily",void 0),_e([gn(12)],t.Text.prototype,"fontSize",void 0),_e([gn("normal")],t.Text.prototype,"fontWeight",void 0),_e([gn(!1)],t.Text.prototype,"italic",void 0),_e([gn("none")],t.Text.prototype,"textCase",void 0),_e([gn("none")],t.Text.prototype,"textDecoration",void 0),_e([gn(0)],t.Text.prototype,"letterSpacing",void 0),_e([gn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),_e([gn(0)],t.Text.prototype,"paraIndent",void 0),_e([gn(0)],t.Text.prototype,"paraSpacing",void 0),_e([gn("x")],t.Text.prototype,"writingMode",void 0),_e([gn("left")],t.Text.prototype,"textAlign",void 0),_e([gn("top")],t.Text.prototype,"verticalAlign",void 0),_e([gn(!0)],t.Text.prototype,"autoSizeAlign",void 0),_e([gn("normal")],t.Text.prototype,"textWrap",void 0),_e([gn("show")],t.Text.prototype,"textOverflow",void 0),_e([Pn(!1)],t.Text.prototype,"textEditing",void 0),t.Text=_e([Hn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},_e([An(gl)],t.Path.prototype,"__",void 0),_e([wn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=_e([Hn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,o,a){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,o,a){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},_e([An(fl)],t.Pen.prototype,"__",void 0),_e([(t,e)=>{sn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=_e([Xn(Fs,["set","path","paint"]),Hn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&ne.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&u.assign(e,t),this.autoLayout&&u.copyAttrs(e,this,ke),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[jo.END,this.__onReady,this],[Vo.START,this.__onCreated,this],[Vo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Vo.END,this.__onChildRenderEnd,this))}},t.App=_e([Hn()],t.App);const cd={},ud={isHoldSpaceKey:()=>ud.isHold("Space"),isHold:t=>cd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){cd[t]||(cd[t]=!0)},setUpCode(t){cd[t]=!1}},_d={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class pd extends Lo{get spaceKey(){return ud.isHoldSpaceKey()}get left(){return _d.left(this)}get right(){return _d.right(this)}get middle(){return _d.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return ud.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){de.changeName(t,e)}}const{min:gd,max:fd,abs:yd}=Math,{float:md,sign:vd}=M,{minX:wd,maxX:xd,minY:bd,maxY:Ed}=Yt,Pd=new Vt,Bd=new Vt,Sd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&kd.getValidMove(t.__localBoxBounds,kd.getDragBounds(t),s,e,!0),kd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&kd.getValidScaleOf(t.__localBoxBounds,kd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,o=t.y+s.y,a=n+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),kd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),kd.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=md(s.x),s.y=md(s.y),s},getValidScaleOf(t,e,i,s,r,n,a){a||(r=Object.assign({},r)),Bd.set(e),Pd.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return kd.isInnerMode(t,e,i,"width")?(r.x<0&&Pd.scaleOf(s,f=1/r.x,1),p=md(Pd.minX-Bd.minX),g=md(Bd.maxX-Pd.maxX),u=h&&p>0?1+p/(h*Pd.width):1,_=l&&g>0?1+g/(l*Pd.width):1,f*=fd(u,_)):(r.x<0&&((md(wd(t)-wd(e))<=0||md(xd(e)-xd(t))<=0)&&Pd.scaleOf(s,f=1/r.x,1),Pd.unsign()),p=md(Bd.minX-Pd.minX),g=md(Pd.maxX-Bd.maxX),u=h&&p>0?1-p/(h*Pd.width):1,_=l&&g>0?1-g/(l*Pd.width):1,f*=gd(u,_)),kd.isInnerMode(t,e,i,"height")?(r.y<0&&Pd.scaleOf(s,1,y=1/r.y),p=md(Pd.minY-Bd.minY),g=md(Bd.maxY-Pd.maxY),u=d&&p>0?1+p/(d*Pd.height):1,_=c&&g>0?1+g/(c*Pd.height):1,y*=fd(u,_),n&&(u=fd(yd(f),yd(y)),f=vd(f)*u,y=vd(y)*u)):(r.y<0&&((md(bd(t)-bd(e))<=0||md(Ed(e)-Ed(t))<=0)&&Pd.scaleOf(s,1,y=1/r.y),Pd.unsign()),p=md(Bd.minY-Pd.minY),g=md(Pd.maxY-Bd.maxY),u=d&&p>0?1-p/(d*Pd.height):1,_=c&&g>0?1-g/(c*Pd.height):1,y*=gd(u,_)),r.x*=o(f)?f:1,r.y*=o(y)?y:1,r}},kd=Sd;t.PointerEvent=class extends pd{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=_e([jn()],t.PointerEvent);const Td=t.PointerEvent,Rd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof uh?t:new uh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return ht.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Sd.axisMove(t,r),r}static limitMove(t,e){Sd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Rd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Rd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Rd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Yt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Yt.unsign(i),i}assignMove(t){Rd.x=t?this.totalX:this.moveX,Rd.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=_e([jn()],t.DragEvent);const Cd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=_e([jn()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=_e([jn()],t.MoveEvent),t.TouchEvent=class extends pd{},t.TouchEvent=_e([jn()],t.TouchEvent);const Ld=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=_e([jn()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=_e([jn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=_e([jn()],t.ZoomEvent),t.KeyEvent=class extends pd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=_e([jn()],t.KeyEvent);const Od={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Dd.getSwipeDirection(ht.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new uh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>so.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Dd=Od,Id=new uh,{getDragEventData:Ad,getDropEventData:Md,getSwipeEventData:Wd}=Od;class Fd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Ad(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Id;return this.dragging&&(r?e?Id:new uh(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&_d.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],so.draggable(e)){this.draggableList=new uh(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:o}=r;this.dragData=Ad(r,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,r=this.realDraggableList;if(r.length&&s){const{totalX:s,totalY:o}=this.dragData,{dragLimitAnimate:h}=i.p,l=!h||!!e;r.forEach(i=>{if(i.draggable){const r=n(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:o},l||r);h&&!r&&e?so.animateMove(i,d,a(h)?h:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:o}=s,a=Ad(s,e,e);if(o&&(a.throughPath=o),a.path=n,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const n=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,r,a),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(ht.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Wd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=Md(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Ud=$t.get("emit");const zd=["move","zoom","rotate","key"];function Nd(t,e,i,s,r){if(zd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Xd(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!i.path.has(n)&&n.__.hittable&&Yd(n,e,i,s,r)}}function Yd(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Xd(t,r)&&(Zh.updateEventStyle&&!s&&Zh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=de.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Xd(t,e){return e&&e.has(t)}const Hd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:jd,pathCanDrag:Vd,pathHasOutside:Gd}=Od;class Kd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&_d.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&_d.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&ud.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=u.clone(Hd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new uh(t),this.createTransformer(),this.dragger=new Fd(this),s&&(this.config=u.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(_d.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),_d.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=_d.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&_d.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=ht.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;_d.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,ud.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,ud.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new uh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>jd(e.path,t));r<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;y.backgrounder||t.origin||n&&n.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Gd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Vd(t.path))&&!Gd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&ht.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(jd(e.path,t.PointerEvent.LONG_TAP)||jd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Vt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Xo.RESIZE,this.__onResize,this)],t.once(Go.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Yd(r,t,e,!0,s))return;r.isApp&&Nd(r,t,e,!0,s)}for(let n=0,o=i.length;n<o;n++)if(r=i.list[n],r.isApp&&Nd(r,t,e,!1,s),Yd(r,t,e,!1,s))return}catch(t){Ud.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class qd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}qd.custom={};class Zd extends ue{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new uh,this.pixelList=new uh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ne.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ne.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}y.getSelector=function(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=ne.selector())};const{toInnerRadiusPointOf:$d,copy:Qd,setRadius:Jd}=ht,{hitRadiusPoint:tc,hitPoint:ec}=Yt,ic={},sc={},rc=t.Leaf.prototype;rc.hit=function(t,e=0){this.updateLayout(),Qd(sc,t),Jd(sc,e);const i=this.__world;return!!(e?tc(i,sc):ec(i,sc))&&(this.isBranch?y.getSelector(this).hitPoint(Object.assign({},sc),e,{target:this}):this.__hitWorld(sc))},rc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,r=i.width<10&&i.height<10;if(e.hitRadius&&(Qd(ic,t),Jd(t=ic,e.hitRadius)),$d(t,i,ic),e.hitBox||r){if(Yt.hitRadiusPoint(s.boxBounds,ic))return!0;if(r)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(ic)},rc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},rc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},rc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},rc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const nc=new gt,oc=t.UI.prototype;oc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=y.image.hitCanvasSize,o=n.hitScale=Gt.set(0,0,r,r).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Gt.set(t).scale(o);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),$r.patternLocked=!0,this.__renderShape(n,{matrix:nc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),$r.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},oc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:n}=e,o=e.stroke&&("path"===r||"pixel"===r&&!e.__isAlphaPixelStroke)||"all"===r;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const ac=t.UI.prototype,hc=t.Rect.prototype,lc=t.Box.prototype;hc.__updateHitCanvas=lc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?ac.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},hc.__hitFill=lc.__hitFill=function(t){return this.__hitCanvas?ac.__hitFill.call(this,t):Yt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),y.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const dc=Te.prototype;dc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},dc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},dc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:o}=t;e&&(s-=e.x,r-=e.y),Gt.set(s-n,r-o,2*n,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Gt.x,Gt.y,Gt.width||1,Gt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const cc={convert(t,e){const i=Od.getBase(t),{x:s,y:r}=e,n=Object.assign(Object.assign({},i),{x:s,y:r,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===n.pointerType&&(n.tangentialPressure=t.tangentialPressure,n.tiltX=t.tiltX,n.tiltY=t.tiltY,n.twist=t.twist),n},convertMouse(t,e){const i=Od.getBase(t),{x:s,y:r}=e;return Object.assign(Object.assign({},i),{x:s,y:r,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=cc.getTouch(t),s=Od.getBase(t),{x:r,y:n}=e;return Object.assign(Object.assign({},s),{x:r,y:n,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},uc={convert(t){const e=Od.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:_c}=Od;class pc extends Kd{get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(uc.convert(t))}onKeyUp(t){this.keyUp(uc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(cc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(cc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=cc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(cc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(cc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(cc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(cc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=cc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&_c(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(cc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=cc.getTouch(t);this.pointerMove(cc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=cc.getTouch(t);this.pointerUp(cc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Od.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},Od.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=Od.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(M.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),d(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>d(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,l(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=n(t)&&qd.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function gc(t,e,i){t.__.__font?Hh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function fc(t,e,i,s,r){const n=i.__;d(t)?Hh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Hh.strokeArrow(t,i,s,r)}function yc(t,e,i,s,r){const n=i.__;d(t)?Hh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),Hh.drawTextStroke(i,s,r))}function mc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,yc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",Hh.fillText(i,n,r),n.blendMode="normal",so.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}const{getSpread:vc,copyAndSpread:wc,toOuterOf:xc,getOuterOf:bc,getByMove:Ec,move:Pc,getIntersectData:Bc}=Yt,Sc={};let kc;const{stintSet:Tc}=u,{hasTransparent:Rc}=Nh;function Cc(t,e,i){if(!d(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:o}=i.__layout;switch(e.type){case"image":r=jh.image(i,t,e,o,!kc||!kc[e.url]);break;case"linear":r=Vh.linearGradient(e,o);break;case"radial":r=Vh.radialGradient(e,o);break;case"angular":r=Vh.conicGradient(e,o);break;case"solid":const{type:n,color:a,opacity:h}=e;r={type:n,style:Nh.string(a,h)};break;default:s(e.r)||(r={type:"solid",style:Nh.string(e)})}if(r&&(r.originPaint=e,n(r.style)&&Rc(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const Lc={compute:function(t,e){const i=e.__,s=[];let r,n,o,a=i.__input[t];l(a)||(a=[a]),kc=jh.recycleImage(t,i);for(let i,r=0,n=a.length;r<n;r++)(i=Cc(t,a[r],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(Tc(i,"__isAlphaPixelFill",r),Tc(i,"__isTransparentFill",n)):(Tc(i,"__isAlphaPixelStroke",r),Tc(i,"__isTransparentStroke",n),Tc(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,gc(e,i,s)},fills:function(t,e,i,s){let r,n,o;for(let a=0,h=t.length;a<h;a++){if(r=t[a],n=r.originPaint,r.image){if(o?o++:o=1,jh.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),gc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),gc(e,i,s),i.restoreBlendMode()):gc(e,i,s)}},fillPathOrText:gc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)o=r[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)Hh.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":fc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),fc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)fc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),fc(t,2,e,o,s),o.clipUI(r),o.clearWorld(n),so.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Hh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":yc(t,1,e,i,s);break;case"inside":mc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?yc(t,2,e,i,s):mc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:o}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=r;n.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!jh.checkImage(o,!1,s,r,n))&&o.style){if(h){const{strokeStyle:t}=o;t?r.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(o.style,a.__strokeWidth*e,a)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),i?Hh.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?Hh.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;xc(o.strokeSpread?(wc(Sc,o.boxBounds,o.strokeSpread),Sc):o.boxBounds,n,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(a))_=s,h=u=a,l=n;else{let s;if(y.fullImageShadow)s=a;else{const t=o.renderShapeSpread?vc(r,S.swapAndScale(o.renderShapeSpread,p,g)):r;s=Bc(t,a)}c=r.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=m),u=bc(a,c),h=Ec(u,-c.e,-c.f),l=bc(n,c),Pc(l,-c.e,-c.f);const v=i.matrix;v?(d=new gt(c),d.multiply(v),f*=v.scaleX,m*=v.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Oc,Dc=new Vt;const{isSame:Ic}=Yt;function Ac(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||jh.createData(r,s,i,n),!0}function Mc(t,e){Uc(t,Mo.LOAD,e)}function Wc(t,e){Uc(t,Mo.LOADED,e)}function Fc(t,e,i){e.error=i,t.forceUpdate("surface"),Uc(t,Mo.ERROR,e)}function Uc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Mo(e,i))}function zc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Nc,translate:Yc}=$,Xc=new Vt,Hc={},jc={};function Vc(t,e,i,s){const r=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Gc={},Kc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:qc,set:Zc,rotateOfOuter:$c,translate:Qc,scaleOfOuter:Jc,multiplyParent:tu,scale:eu,rotate:iu,skew:su}=$;function ru(t,e,i,s,r,n,o,a){o&&iu(t,o),a&&su(t,a.x,a.y),r&&eu(t,r,n),Qc(t,e.x+i,e.y+s)}const{get:nu,scale:ou,copy:au}=$,{getFloorScale:hu}=M,{abs:lu}=Math;const du={image:function(t,e,i,s,r){let n,o;const a=$r.get(i);return Oc&&i===Oc.paint&&Ic(s,Oc.boxBounds)?n=Oc.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),Oc=a.use>1?{leafPaint:n,paint:i,boxBounds:Dc.set(s)}:null),(r||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Ac(t,e,i,a,n,s),r&&(Mc(t,o),Wc(t,o))):a.error?r&&Fc(t,o,a.error):(r&&(zc(t,!0),Mc(t,o)),n.loadId=a.load(()=>{zc(t,!1),t.destroyed||(Ac(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Wc(t,o)),n.loadId=void 0},e=>{zc(t,!1),Fc(t,o,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:o}=jh.getImageRenderScaleData(t,i,s,r),{image:a,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===n+"-"+o&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&Xo.isResizing(i)||d||(e=y.image.isLarge(a,n,o))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),jh.drawImage(t,n,o,i,s,r),!0):(!t.style||l.sync||d?jh.createPattern(t,i,s,r):jh.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:o,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=o,c=a.getFull(o.filters),u=s.__;let _,{width:p,height:g}=a;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(o.scaleX&&(p*=o.scaleX,g*=o.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(l(i)){let s,r,n,o,a;for(let h=0,d=i.length;h<d;h++)s=i[h],r=s.image,a=r&&r.url,a&&(n||(n={}),n[a]=!0,$r.recycle(r),r.loading&&(o||(o=e.__input&&e.__input[t]||[],l(o)||(o=[o])),r.unload(i[h].loadId,!o.some(t=>t.url===a))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=$r.patternTasker.add(()=>pe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&jh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=jh.getImageRenderScaleData(t,e,i,s),o=r+"-"+n;if(t.patternId!==o&&!e.destroyed&&(!y.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=jh.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/lu(s.scaleX||1),u=h.y*n/lu(s.scaleY||1)),(a||1!==r||1!==n)&&(r*=hu(_+(c||0)),n*=hu(p+(u||0)),d=nu(),a&&au(d,a),ou(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=y.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>o&&(n=o),(o*=e*i)>n&&(r=Math.sqrt(n/o)),r},createData:function(t,e,i,s){t.data=jh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Xc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:o,mode:a,align:h,offset:l,scale:c,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===r,w={mode:a},x="center"!==h&&(_||0)%180==90;let b,E;switch(Yt.set(jc,0,0,x?r:s,x?s:r),a&&"cover"!==a&&"fit"!==a?((c||u)&&(M.getScaleData(c,u,i,Hc),b=Hc.scaleX,E=Hc.scaleY),(h||y||f)&&(b&&Yt.scale(jc,b,E,!0),h&&Bt.toPoint(h,jc,e,jc,!0,!0))):v&&!_||(b=E=Yt.getFitScale(e,jc,"fit"!==a),Yt.put(e,i,h,b,!1,jc),Yt.scale(jc,b,E,!0)),l&&ht.move(jc,l),a){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/r,jh.stretchMode(w,e,b,E));break;case"normal":case"clip":if(jc.x||jc.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),jh.clipMode(w,e,jc.x,jc.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&jh.repeatMode(w,e,s,r,jc.x,jc.y,b,E,_,p,h,t.freeTransform),f||(w.repeat="repeat");const i=d(f);(y||i)&&(w.gap=function(t,e,i,s,r){let n,o;d(t)?(n=t.x,o=t.y):n=o=t;return{x:Vc(n,i,r.width,e&&e.x),y:Vc(o,s,r.height,e&&e.y)}}(y,i&&f,jc.width,jc.height,e));break;default:b&&jh.fillOrFitMode(w,e,jc.x,jc.y,b,E,_)}return w.transform||(e.x||e.y)&&Yc(w.transform=Nc(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=E),o&&o<1&&(w.opacity=o),m&&(w.filters=m),f&&(w.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const r=qc(),{x:n,y:o}=e;n||o?Qc(r,n,o):r.onlyScale=!0,eu(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,o){const a=qc();Qc(a,e.x+i,e.y+s),eu(a,r,n),o&&$c(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,r,n,o,a,h,l){const d=qc();ru(d,e,i,s,r,n,o,a),h&&(o||a?(Zc(Kc),Jc(Kc,e,h,l),tu(d,Kc)):Jc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,o,a,h,l,d,c){const u=qc();if(c)ru(u,e,r,n,o,a,h,l);else{if(h)if("center"===d)$c(u,{x:i/2,y:s/2},h);else switch(iu(u,h),h){case 90:Qc(u,s,0);break;case 180:Qc(u,i,s);break;case 270:Qc(u,0,i)}Gc.x=e.x+r,Gc.y=e.y+n,Qc(u,Gc.x,Gc.y),o&&Jc(u,Gc,o,a)}t.transform=u}},{toPoint:cu}=bt,{hasTransparent:uu}=Nh,_u={},pu={};function gu(t,e,i,s){if(i){let r,o,a,h;for(let t=0,l=i.length;t<l;t++)r=i[t],n(r)?(a=t/(l-1),o=Nh.string(r,s)):(a=r.offset,o=Nh.string(r.color,s)),e.addColorStop(a,o),!h&&uu(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:fu,getDistance:yu}=ht,{get:mu,rotateOfOuter:vu,scaleOfOuter:wu}=$,{toPoint:xu}=bt,bu={},Eu={};function Pu(t,e,i,s,r){let n;const{width:o,height:a}=t;if(o!==a||s){const t=fu(e,i);n=mu(),r?(wu(n,e,o/a*(s||1),1),vu(n,e,t+90)):(wu(n,e,1,o/a*(s||1)),vu(n,e,t))}return n}const{getDistance:Bu}=ht,{toPoint:Su}=bt,ku={},Tu={};const Ru={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;cu(i||"top",e,_u),cu(s||"bottom",e,pu);const o=y.canvas.createLinearGradient(_u.x,_u.y,pu.x,pu.y),a={type:r,style:o};return gu(a,o,t.stops,n),a},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:o}=t;xu(i||"center",e,bu),xu(s||"bottom",e,Eu);const a=y.canvas.createRadialGradient(bu.x,bu.y,0,bu.x,bu.y,yu(bu,Eu)),h={type:r,style:a};gu(h,a,t.stops,n);const l=Pu(e,bu,Eu,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:o}=t;Su(i||"center",e,ku),Su(s||"bottom",e,Tu);const a=y.conicGradientSupport?y.canvas.createConicGradient(0,ku.x,ku.y):y.canvas.createRadialGradient(ku.x,ku.y,0,ku.x,ku.y,Bu(ku,Tu)),h={type:r,style:a};gu(h,a,t.stops,n);const l=Pu(e,ku,Tu,o||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Pu},{copy:Cu,move:Lu,toOffsetOutBounds:Ou}=Yt,{max:Du,abs:Iu}=Math,Au={},Mu=new gt,Wu={};function Fu(t,e){let i,s,r,n,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=Iu(t.spread||0),o=Du(o,r+n-s),a=Du(a,r+n+i),h=Du(h,r+n+s),l=Du(l,r+n-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function Uu(t,e,i){const{shapeBounds:s}=i;let r,n;y.fullImageShadow?(Cu(Au,t.bounds),Lu(Au,e.x-s.x,e.y-s.y),r=t.bounds,n=Au):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:zu}=Yt,Nu={};const Yu=Fu;const Xu={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;Ou(h,Wu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Wu.offsetX+(o.x||0)*c*f,Wu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,Nh.string(o.color)),r=Gh.getShadowTransform(t,_,i,o,Wu,f),r&&_.setTransform(r),Uu(_,Wu,i),r&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,n,"copy"),s=n),a?_.copyWorld(a,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),so.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;zu(h,Nu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Nu.offsetX+(o.x||0)*c*f,Nu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),r=Gh.getShadowTransform(t,_,i,o,Nu,f,!0),r&&_.setTransform(r),Uu(_,Nu,i),_.restore(),a?(_.copyWorld(_,l,n,"copy"),_.copyWorld(a,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,Nh.string(o.color),"source-in"),so.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Fu,getShadowTransform:function(t,e,i,s,r,n,o){if(s.spread){const i=2*s.spread*n*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Mu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/a,1+i/h),Mu}},isTransformShadow(t){},getInnerShadowSpread:Yu},{excludeRenderBounds:Hu}=uo;let ju;function Vu(t,e,i,s,r,n,o,a){switch(e){case"grayscale":ju||(ju=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),n&&s.recycle(o);Ku(t,e,i,1,r,n)}(t,i,s,r,o,a);break;case"opacity-path":Ku(t,i,s,n,o,a);break;case"path":a&&i.restore()}}function Gu(t){return t.getSameCanvas(!1,!0)}function Ku(t,e,i,s,r,n){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,r),n?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(Vu(this,o,t,r,s,n,void 0,!0),s=r=null),"clipping"!==a&&"clipping-path"!==a||Hu(i,e)||i.__render(t,e),n=i.__.opacity,ju=!1,"path"===a||"clipping-path"===a?(n<1?(o="opacity-path",r||(r=Gu(t))):(o="path",t.save()),i.__clip(r||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Gu(t)),r||(r=Gu(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&Vu(this,o,t,r,s,n,void 0,!1),Hu(i,e)||i.__render(r||t,e),d&&Vu(this,o,t,r,s,n,d,!1)}Vu(this,o,t,r,s,n,void 0,!0)};const qu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Zu=qu+"_#~&*+\\=|≮≯≈≠=…",$u=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Qu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Ju=Qu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),t_=Qu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),e_=Qu(qu),i_=Qu(Zu),s_=Qu("- —/~|┆·");var r_;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(r_||(r_={}));const{Letter:n_,Single:o_,Before:a_,After:h_,Symbol:l_,Break:d_}=r_;function c_(t){return Ju[t]?n_:s_[t]?d_:t_[t]?a_:e_[t]?h_:i_[t]?l_:$u.test(t)?o_:n_}const u_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function __(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:p_}=u_,{Letter:g_,Single:f_,Before:y_,After:m_,Symbol:v_,Break:w_}=r_;let x_,b_,E_,P_,B_,S_,k_,T_,R_,C_,L_,O_,D_,I_,A_,M_,W_,F_=[];function U_(t,e){R_&&!T_&&(T_=R_),x_.data.push({char:t,width:e}),E_+=e}function z_(){P_+=E_,x_.width=E_,b_.words.push(x_),x_={data:[]},E_=0}function N_(){I_&&(A_.paraNumber++,b_.paraStart=!0,I_=!1),R_&&(b_.startCharSize=T_,b_.endCharSize=R_,T_=0),b_.width=P_,M_.width?p_(b_):W_&&Y_(),F_.push(b_),b_={words:[]},P_=0}function Y_(){P_>(A_.maxWidth||0)&&(A_.maxWidth=P_)}const{top:X_,right:H_,bottom:j_,left:V_}=t.Direction4;function G_(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const K_={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;a&&(r?(i=a[V_],r-=a[H_]+a[V_],!r&&(r=.01)):e.autoSizeAlign||(i=a[V_]),o?(s=a[X_],o-=a[X_]+a[j_],!o&&(o=.01)):e.autoSizeAlign||(s=a[X_]));const h={bounds:{x:i,y:s,width:r,height:o},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,i){A_=t,F_=t.rows,M_=t.bounds,W_=!M_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:o}=y,{width:a}=M_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;I_=!0,L_=null,T_=k_=R_=E_=P_=0,x_={data:[]},b_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)S_=e[i],"\n"===S_?(E_&&z_(),b_.paraEnd=!0,N_(),I_=!0):(C_=c_(S_),C_===g_&&"none"!==n&&(S_=__(S_,n,!E_)),k_=o.measureText(S_).width,s&&(s<0&&(R_=k_),k_+=s),O_=C_===f_&&(L_===f_||L_===g_)||L_===f_&&C_!==m_,D_=!(C_!==y_&&C_!==f_||L_!==v_&&L_!==m_),B_=I_&&r?a-r:a,t&&a&&P_+E_+k_>B_&&(h?(E_&&z_(),P_&&N_()):(D_||(D_=C_===g_&&L_==m_),O_||D_||C_===w_||C_===y_||C_===f_||E_+k_>B_?(E_&&z_(),P_&&N_()):P_&&N_()))," "===S_&&!0!==I_&&P_+E_===0||(C_===w_?(" "===S_&&E_&&z_(),U_(S_,k_),z_()):O_||D_?(E_&&z_(),U_(S_,k_)):U_(S_,k_)),L_=C_);E_&&z_(),P_&&N_(),F_.length>0&&(F_[F_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{A_.paraNumber++,P_=o.measureText(t).width,F_.push({x:r||0,text:t,width:P_,paraStart:!0}),W_&&Y_()})}(h,t,e),a&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":G_(e,"x",t[V_]);break;case"right":G_(e,"x",-t[H_])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":G_(e,"y",t[X_]);break;case"bottom":G_(e,"y",-t[j_])}}(a,h,e,r,o),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=r;o<d;o++){if(v=i[o],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=n,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:o}=e,a=i&&r.includes("both"),h=a||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:o}=e;if(r.splice(n),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?y.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,d(n)?(i=n.type,n.color&&(t.decorationColor=Nh.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const q_={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(n(t)){if(!i||!Nh.object)return t;t=Nh.object(t)}let r=s(t.a)?1:t.a;i&&(r*=e);const o=t.r+","+t.g+","+t.b;return 1===r?"rgb("+o+")":"rgba("+o+","+r+")"}};return Object.assign(zh,K_),Object.assign(Nh,q_),Object.assign(Hh,Lc),Object.assign(jh,du),Object.assign(Vh,Ru),Object.assign(Gh,Xu),Object.assign(ne,{interaction:(t,e,i,s)=>new pc(t,e,i,s),hitCanvas:(t,e)=>new gh(t,e),hitCanvasManager:()=>new Zd}),mh(),t.AlignHelper=Bt,t.AroundHelper=bt,t.AutoBounds=Kt,t.BezierHelper=ri,t.Bounds=Vt,t.BoundsEvent=Wo,t.BoundsHelper=Yt,t.BoxData=al,t.BranchHelper=fo,t.BranchRender=La,t.CanvasData=wl,t.CanvasManager=ue,t.ChildEvent=Oo,t.ColorConvert=Nh,t.Creator=ne,t.Cursor=qd,t.DataHelper=u,t.Debug=$t,t.DragBoundsHelper=Sd,t.Dragger=Fd,t.Effect=Gh,t.EllipseData=ul,t.EllipseHelper=_i,t.Event=Lo,t.EventCreator=de,t.Eventer=ta,t.Export=qh,t.FileHelper=Xr,t.Filter=Kh,t.FourNumberHelper=S,t.FrameData=ll,t.GroupData=ol,t.HitCanvasManager=Zd,t.ImageData=vl,t.ImageEvent=Mo,t.ImageManager=$r,t.IncrementId=v,t.Interaction=pc,t.InteractionBase=Kd,t.InteractionHelper=Od,t.Keyboard=ud,t.LayoutEvent=jo,t.Layouter=Lh,t.LeafBounds=Ta,t.LeafBoundsHelper=uo,t.LeafData=p,t.LeafDataProxy=_a,t.LeafEventer=ca,t.LeafHelper=so,t.LeafLayout=Co,t.LeafLevelList=_h,t.LeafList=uh,t.LeafMatrix=wa,t.LeafRender=Ra,t.LeaferCanvas=gh,t.LeaferCanvasBase=Te,t.LeaferData=hl,t.LeaferEvent=Go,t.LeaferImage=en,t.LineData=dl,t.MathHelper=M,t.Matrix=gt,t.MatrixHelper=$,t.MyDragEvent=Cd,t.MyImage=nd,t.MyPointerEvent=Td,t.MyTouchEvent=Ld,t.NeedConvertToCanvasCommandMap=De,t.OneRadian=F,t.PI2=U,t.PI_2=z,t.Paint=Hh,t.PaintGradient=Vh,t.PaintImage=jh,t.PathArrow=Xh,t.PathBounds=Lr,t.PathCommandDataHelper=xs,t.PathCommandMap=Le,t.PathCommandNodeHelper=pi,t.PathConvert=Qi,t.PathCorner=Fr,t.PathCreator=Fs,t.PathData=gl,t.PathDrawer=Js,t.PathHelper=Re,t.PathNumberCommandLengthMap=We,t.PathNumberCommandMap=Me,t.PenData=fl,t.Picker=Ah,t.Platform=y,t.Plugin=re,t.Point=_t,t.PointHelper=ht,t.PointerButton=_d,t.PolygonData=_l,t.PropertyEvent=Io,t.RectData=cl,t.RectHelper=Fe,t.RectRender=kl,t.RenderEvent=Vo,t.Renderer=Dh,t.ResizeEvent=Xo,t.Resource=qr,t.Run=ee,t.Selector=Mh,t.StarData=pl,t.State=Zh,t.StringNumberMap=qt,t.TaskItem=Vr,t.TaskProcessor=Gr,t.TextConvert=zh,t.TextData=ml,t.Transition=$h,t.TwoPointBoundsHelper=yt,t.UIBounds=El,t.UICreator=ae,t.UIData=rl,t.UIEvent=pd,t.UIRender=Bl,t.UnitConvert=Yh,t.WaitHelper=wo,t.WatchEvent=Ho,t.Watcher=wh,t.affectRenderBoundsType=En,t.affectStrokeBoundsType=wn,t.attr=an,t.autoLayoutType=un,t.boundsType=gn,t.canvasPatch=Yr,t.canvasSizeAttrs=ke,t.createAttr=function(t){return(e,i)=>{sn(e,i,nn(i,t))}},t.createDescriptor=nn,t.cursorType=In,t.dataProcessor=An,t.dataType=ln,t.decorateLeafAttr=on,t.defineDataProcessor=Mn,t.defineKey=sn,t.defineLeafAttr=hn,t.dimType=Bn,t.doBoundsType=yn,t.doStrokeType=xn,t.effectType=Wh,t.emptyData=i,t.eraserType=On,t.extraPropertyEventMap=Ao,t.getBoundsData=Y,t.getDescriptor=rn,t.getMatrixData=X,t.getPointData=N,t.hitType=Dn,t.isArray=l,t.isData=function(t){return d(t)&&!l(t)},t.isEmptyData=c,t.isFinite=o,t.isNull=r,t.isNumber=a,t.isObject=d,t.isString=n,t.isUndefined=s,t.layoutProcessor=function(t){return(e,i)=>{sn(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Qo,t.maskType=Ln,t.naturalBoundsType=fn,t.opacityType=Sn,t.path=Ur,t.pathInputType=mn,t.pathType=vn,t.pen=zr,t.positionType=dn,t.registerUI=Hn,t.registerUIEvent=jn,t.resizeType=Fh,t.rewrite=zn,t.rewriteAble=Nn,t.rotationType=pn,t.scaleType=_n,t.scrollType=cn,t.sortType=Cn,t.strokeType=bn,t.surfaceType=Pn,t.tempBounds=Gt,t.tempMatrix=ft,t.tempPoint=pt,t.tryToNumber=function(t){return"string"==typeof t&&h.test(t)?+t:t},t.useCanvas=mh,t.useModule=Xn,t.version="1.11.0",t.visibleType=kn,t.zoomLayerType=Uh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
2
2
|
//# sourceMappingURL=web.min.js.map
|