leafer-draw 1.11.2 → 1.12.1
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.cjs +24 -15
- package/dist/web.esm.js +24 -15
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +98 -25
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +98 -25
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";var e,s;t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",t.Answer=void 0,(s=t.Answer||(t.Answer={}))[s.No=0]="No",s[s.Yes=1]="Yes",s[s.NoAndSkip=2]="NoAndSkip",s[s.YesAndSkip=3]="YesAndSkip";function i(t){return void 0===t}function r(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:n}=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,s){let i;Object.keys(e).forEach(r=>{var o,n;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return _(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&_(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{i(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{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(!i(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=i(s)?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!i(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(l(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!i(t))){if("path"===o&&!this.__pathInputed)continue;e=r?r[o]:void 0,s[o]=i(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:g,max:f}=Math,y={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,s,i)=>t.width*t.height*(e?e*s:1)>(i||m.maxCacheSize),isSuperLarge:(t,e,s)=>m.isLarge(t,e,s,m.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=y.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,i,r,o,n,a,h){const l=y.origin.createCanvas(f(g(e+(i||0)),1),f(g(s+(r||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==n,o){const i=e/o.width,r=s/o.height;d.setTransform(i,0,0,r,-o.x*i,-o.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,s);return l},setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&u.stintSet(s,"transform",e)}}},{image:m}=y,x={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=x;let v,b,B;const{max:k}=Math,S=[0,0,0,0],R={zero:[...S],tempFour:S,set:(t,e,s,i,r)=>(void 0===s&&(s=i=r=e),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t),setTemp:(t,e,s,i)=>C(S,t,e,s,i),toTempAB(t,e,s){B=s?a(t)?e:t:[],a(t)?(v=P(t),b=e):a(e)?(v=t,b=P(e)):(v=t,b=e),4!==v.length&&(v=T(v)),4!==b.length&&(b=T(b))},get(t,e){let s;if(!a(t))switch(t.length){case 4:s=i(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!i(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,s)=>a(t)&&a(e)?k(t,e):(L(t,e,s),C(B,k(v[0],b[0]),k(v[1],b[1]),k(v[2],b[2]),k(v[3],b[3]))),add:(t,e,s)=>a(t)&&a(e)?t+e:(L(t,e,s),C(B,v[0]+b[0],v[1]+b[1],v[2]+b[2],v[3]+b[3])),swapAndScale(t,e,s,i){if(a(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[o,n,h,l]=4===t.length?t:T(t);return C(r,h*s,l*e,o*s,n*e)}},{set:C,get:T,setTemp:P,toTempAB:L}=R,{round:I,pow:E,max:O,floor:A,PI:M}=Math,W={within:(t,e,s)=>(d(e)&&(s=e.max,e=e.min),!i(e)&&t<e&&(t=e),!i(s)&&t>s&&(t=s),t),fourNumber:R.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=i(e)?1e12:E(10,e);return-0===(t=I(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(a(e)?e:e.width||0)/s.width,r=(a(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&W.assignScale(i,t);return i},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(A(t),e)/t,randInt:D,randColor:t=>`rgba(${D(255)},${D(255)},${D(255)},${t||1})`};function D(t){return Math.round(Math.random()*t)}const F=M/180,z=2*M,U=M/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:G,acos:V,sqrt:j}=Math,{float:q}=W,Q={};function J(){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:J(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:X,getWorld:J,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},pixelScale(t,e,s){s||(s=t),s.a=t.a*e,s.b=t.b*e,s.c=t.c*e,s.d=t.d*e,s.e=t.e*e,s.f=t.f*e},scaleOfOuter(t,e,s,i){Z.toInnerPoint(t,e,Q),Z.scaleOfInner(t,Q,s,i)},scaleOfInner(t,e,s,i=s){Z.translateInner(t,e.x,e.y),Z.scale(t,s,i),Z.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=G(e*=F),a=H(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){Z.toInnerPoint(t,e,Q),Z.rotateOfInner(t,Q,s)},rotateOfInner(t,e,s){Z.translateInner(t,e.x,e.y),Z.rotate(t,s),Z.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=F,t.a=i+o*s,t.b=r+n*s),e&&(e*=F,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){Z.toInnerPoint(t,e,Q),Z.skewOfInner(t,Q,s,i)},skewOfInner(t,e,s,i=0){Z.translateInner(t,e.x,e.y),Z.skew(t,s,i),Z.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,r,o){const{e:n,f:a}=t;if(s||(s=t),i(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:i,b:r,c:n,d:a}=t;s.a=i*e.a+r*e.c,s.b=i*e.b+r*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,o&&(s.scaleX=e.scaleX*o.scaleX,s.scaleY=e.scaleY*o.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,o&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){Z.multiply(t,Z.tempInvert(e))},divideParent(t,e){Z.multiplyParent(t,Z.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Z;return Z.copy(e,t),Z.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,r,o){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(i(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:s,skewX:i,skewY:r}=e,o=s*F,n=G(o),a=H(o);if(i||r){const e=i*F,s=r*F;t.a=(n+s*-a)*h,t.b=(a+s*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(s=s||r)&&Z.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,i){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(o||n){const t=r*a-o*n;if(n&&!i){d=j(r*r+o*o),c=t/d;const e=r/d;u=o>0?V(e):-V(e)}else{c=j(n*n+a*a),d=t/c;const e=n/c;u=U-(a>0?V(-e):-V(e))}const e=q(G(u)),s=H(u);d=q(d),c=q(c),_=e?q((n/c+s)/e/F,9):0,p=e?q((o/d-s)/e/F,9):0,u=q(u/F)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(g+=e.x*r+e.y*n,f+=e.x*o+e.y*a,s||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:o,d:n}=t;r||o?s=(i*n-r*o)/(e=j(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){Z.set(t)}},Z=$,{toInnerPoint:K,toOuterPoint:tt}=$,{sin:et,cos:st,abs:it,sqrt:rt,atan2:ot,min:nt,round:at}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=i(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,s){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=lt.defaultPoint);const i=st(e*=F),r=et(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=lt;return ct(s,t),K(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=lt;return ct(s,t),tt(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=lt;return ct(s,t),lt.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),K(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){K(e,t,s)},toOuterOf(t,e,s){tt(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=it(s-t),o=it(i-e);return rt(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>nt(dt(t,e,s,i),dt(s,i,r,o)),getAngle:(t,e)=>ut(t,e)/F,getRotation:(t,e,s,i)=>(i||(i=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/F),getRadianFrom(t,e,s,r,o,n,a,h){i(a)&&(a=s,h=r);const l=t-s,d=e-r,c=o-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i,r){const o=ut(t,e);return r&&(t=e),i||(e={}),e.x=t.x+st(o)*s,e.y=t.y+et(o)*s,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,s){return ht.scaleOf(this,t,e,s),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,s){return ht.getRotation(this,t,e,s)}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,s,i){return new _t(ht.getDistancePoint(this,t,e,s,i))}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,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return d(t)?$.copy(this,t):$.set(this,t,e,s,i,r,o),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}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,s){return $.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return $.scaleOfInner(this,t,e,s),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,s){return $.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return $.skewOfInner(this,t,e,s),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,s){$.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){$.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return $.setLayout(this,t,e,s),this}getLayout(t,e,s){return $.getLayout(this,t,e,s)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const ft=new gt,yt={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){mt(t,e,s),mt(t,e+i,s+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 xt,wt;t.Direction4=void 0,(xt=t.Direction4||(t.Direction4={}))[xt.top=0]="top",xt[xt.right=1]="right",xt[xt.bottom=2]="bottom",xt[xt.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 vt=[{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}];vt.forEach(t=>t.type="percent");const bt={directionData:vt,tempPoint:{},get:Bt,toPoint(t,e,s,i,r,o){const n=Bt(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(o||(s.x-=r.x,s.y-=r.y),n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),bt.toPoint(t,e,s,!0),s)};function Bt(e){return o(e)?vt[t.Direction9[e]]:e}const{toPoint:kt}=bt,St={toPoint(t,e,s,i,r,o){kt(t,s,i,r,e,o)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Tt,toBounds:Pt}=yt,{toOuterPoint:Lt}=$,{float:It,fourNumber:Et}=W,{floor:Ot,ceil:At}=Math;let Mt,Wt,Dt,Ft;const zt={},Ut={},Nt={},Yt={tempBounds:Nt,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,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,s,i,r){const{x:o,y:n,width:a,height:h}=e;if(l(s)){const e=Et(s);i?Xt.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Xt.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Xt.set(t,o-s,n-s,a+2*s,h+2*s);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Xt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Gt(e,t):e=t,s||(s=t),e.offsetX=Xt.maxX(s),e.offsetY=Xt.maxY(s),Xt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||ht.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){ht.scaleOf(t,e,s,i),t.width*=s,t.height*=i},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,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r,e:o,f:n}=e;i>0?(s.width=t.width*i,s.x=o+t.x*i):(s.width=t.width*-i,s.x=o+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=n+t.y*r):(s.height=t.height*-r,s.y=n+t.y*r-s.height)}else zt.x=t.x,zt.y=t.y,Lt(e,zt,Ut),Ct(Rt,Ut.x,Ut.y),zt.x=t.x+t.width,Lt(e,zt,Ut),Tt(Rt,Ut.x,Ut.y),zt.y=t.y+t.height,Lt(e,zt,Ut),Tt(Rt,Ut.x,Ut.y),zt.x=t.x,Lt(e,zt,Ut),Tt(Rt,Ut.x,Ut.y),Pt(Rt,s)},toInnerOf(t,e,s){s||(s=t),Xt.move(s,-e.e,-e.f),Xt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Xt.getFitScale(t,e));return new gt(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,n){n||(n=e),o(i)&&(i=Xt.getFitScale(t,e,"cover"===i)),Nt.width=r?e.width*=i:e.width*i,Nt.height=r?e.height*=i:e.height*i,St.toPoint(s,Nt,t,n,!0,!0)},getSpread(t,e,s){const i={};return Xt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Xt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Xt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Ot(t.x),t.y=Ot(t.y),t.width=e>t.x?At(t.width+e-t.x):At(t.width),t.height=s>t.y?At(t.height+s-t.y):At(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=It(t.x,e),t.y=It(t.y,e),t.width=It(t.width,e),t.height=It(t.height,e)},add(t,e,s){Mt=t.x+t.width,Wt=t.y+t.height,Dt=e.x,Ft=e.y,s||(Dt+=e.width,Ft+=e.height),Mt=Mt>Dt?Mt:Dt,Wt=Wt>Ft?Wt:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=Wt-t.y},addList(t,e){Xt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Xt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Xt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||Gt(t,r)):Ht(t,r));o&&Xt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Rt,t.x,t.y):Tt(Rt,t.x,t.y)),Pt(Rt,t)},setPoint(t,e){Xt.set(t,e.x,e.y)},addPoint(t,e){Ht(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=ht.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=ht.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Xt.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=Xt.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){if(s&&(e=Xt.tempToOuterOf(e,s)),!Xt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return Mt=i+o,Wt=r+n,Dt=t.x+t.width,Ft=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,Mt=Mt<Dt?Mt:Dt,Wt=Wt<Ft?Wt:Ft,o=Mt-i,n=Wt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Xt.copy(t,Xt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Xt.set(t)}},Xt=Yt,{add:Ht,copy:Gt}=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,s,i){this.set(t,e,s,i)}set(t,e,s,i){return d(t)?Yt.copy(this,t):Yt.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Vt(this)}move(t,e){return Yt.move(this,t,e),this}scale(t,e,s){return Yt.scale(this,t,e,s),this}scaleOf(t,e,s){return Yt.scaleOf(this,t,e,s),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,s){Yt.put(this,t,e,s)}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 jt=new Vt;class qt{constructor(t,e,s,i,r,o){d(t)?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Vt(r,e,o||t.width-r-s,n||t.height-e-i)}}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:Jt}=W;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=Zt(t)}static set exclude(t){this.excludeList=Zt(t)}static drawRepaint(t,e){const s=Jt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===$t.showBounds,r=t.__nowWorld,o=Jt();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),i?e.stroke():e.strokeWorld(r,o)}log(...t){if(Kt.enable){if(Kt.filterList.length&&Kt.filterList.every(t=>t!==this.name))return;if(Kt.excludeList.length&&Kt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Kt.enable&&this.warn(...t)}warn(...t){Kt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Zt(t){return t?o(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const Kt=$t,te=$t.get("RunTime"),ee={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=x.create(x.RUNTIME);return se.currentId=se.idMap[s]=e?performance.now():Date.now(),se.currentName=se.nameMap[s]=t,se.nameToIdMap[t]=s,s},end(t,e){const s=se.idMap[t],i=se.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;se.idMap[t]=se.nameMap[t]=se.nameToIdMap[i]=void 0,te.log(i,r,"ms")},endOfName(t,e){const s=se.nameToIdMap[t];i(s)||se.end(s,e)}},se=ee,ie=[],re={list:{},add(t,...e){this.list[t]=!0,ie.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ie.forEach(t=>re.has(t,!0)));const oe={editor:t=>re.need("editor")},ne=$t.get("UICreator"),ae={list:{},register(t){const{__tag:e}=t.prototype;he[e]&&ne.repeat(e),he[e]=t},get(t,e,s,r,o,n){he[t]||ne.error("not register "+t);const a=new he[t](e);return i(s)||(a.x=s,r&&(a.y=r),o&&(a.width=o),n&&(a.height=n)),a}},{list:he}=ae,le=$t.get("EventCreator"),de={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],o(e)&&(ce[e]&&le.repeat(e),ce[e]=t)})},changeName(t,e){const s=ce[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,ce[e]=s)}},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:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=oe.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function _e(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function pe(t,e,s,i){return new(s||(s=Promise))(function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})}function ge(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const fe=[];function ye(){return(t,e)=>{fe.push(e)}}const me=[];class xe{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,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}_e([ge("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),_e([ge("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),_e([ge("globalAlpha")],xe.prototype,"opacity",void 0),_e([ge()],xe.prototype,"fillStyle",void 0),_e([ge()],xe.prototype,"strokeStyle",void 0),_e([ge("lineWidth")],xe.prototype,"strokeWidth",void 0),_e([ge("lineCap")],xe.prototype,"strokeCap",void 0),_e([ge("lineJoin")],xe.prototype,"strokeJoin",void 0),_e([ge("lineDashOffset")],xe.prototype,"dashOffset",void 0),_e([ge()],xe.prototype,"miterLimit",void 0),_e([ge()],xe.prototype,"shadowBlur",void 0),_e([ge()],xe.prototype,"shadowColor",void 0),_e([ge()],xe.prototype,"shadowOffsetX",void 0),_e([ge()],xe.prototype,"shadowOffsetY",void 0),_e([ge()],xe.prototype,"filter",void 0),_e([ge()],xe.prototype,"font",void 0),_e([ge()],xe.prototype,"fontKerning",void 0),_e([ge()],xe.prototype,"fontStretch",void 0),_e([ge()],xe.prototype,"fontVariantCaps",void 0),_e([ge()],xe.prototype,"textAlign",void 0),_e([ge()],xe.prototype,"textBaseline",void 0),_e([ge()],xe.prototype,"textRendering",void 0),_e([ge()],xe.prototype,"wordSpacing",void 0),_e([ge()],xe.prototype,"letterSpacing",void 0),_e([ge()],xe.prototype,"direction",void 0),_e([ye()],xe.prototype,"setTransform",null),_e([ye()],xe.prototype,"resetTransform",null),_e([ye()],xe.prototype,"getTransform",null),_e([ye()],xe.prototype,"save",null),_e([ye()],xe.prototype,"restore",null),_e([ye()],xe.prototype,"translate",null),_e([ye()],xe.prototype,"scale",null),_e([ye()],xe.prototype,"rotate",null),_e([ye()],xe.prototype,"fill",null),_e([ye()],xe.prototype,"stroke",null),_e([ye()],xe.prototype,"clip",null),_e([ye()],xe.prototype,"fillRect",null),_e([ye()],xe.prototype,"strokeRect",null),_e([ye()],xe.prototype,"clearRect",null),_e([ye()],xe.prototype,"beginPath",null),_e([ye()],xe.prototype,"moveTo",null),_e([ye()],xe.prototype,"lineTo",null),_e([ye()],xe.prototype,"bezierCurveTo",null),_e([ye()],xe.prototype,"quadraticCurveTo",null),_e([ye()],xe.prototype,"closePath",null),_e([ye()],xe.prototype,"arc",null),_e([ye()],xe.prototype,"arcTo",null),_e([ye()],xe.prototype,"ellipse",null),_e([ye()],xe.prototype,"rect",null),_e([ye()],xe.prototype,"roundRect",null),_e([ye()],xe.prototype,"createConicGradient",null),_e([ye()],xe.prototype,"createLinearGradient",null),_e([ye()],xe.prototype,"createPattern",null),_e([ye()],xe.prototype,"createRadialGradient",null),_e([ye()],xe.prototype,"fillText",null),_e([ye()],xe.prototype,"measureText",null),_e([ye()],xe.prototype,"strokeText",null);const{copy:we,multiplyParent:ve,pixelScale:be}=$,{round:Be}=Math,ke=new Vt,Se=new Vt,Re={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Te extends xe{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=Re),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,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 s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;u.copyAttrs(i,t,Ce),Ce.forEach(t=>i[t]||(i[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&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&ve(t,e,r),be(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=Be(r.e-.5)+.5,r.f=Be(r.f-.5)+.5):(r.e=Be(r.e),r.f=Be(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,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:r,dashPattern:o,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),i(e.dashPattern)||(o=e.dashPattern),i(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=r,this.dashPattern=o,this.dashOffset=n,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=Se):s=ke,this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Yt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o=!0){this.resetTransform(),this.copyWorld(t,e,s,i,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(ke.x,ke.y,ke.width,ke.height),{data:o}=r;for(let t=0,i=o.length;t<i;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));i.putImageData(r,ke.x,ke.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(ke.x,ke.y,ke.width,ke.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(ke.x,ke.y,ke.width,ke.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ke.x,ke.y,ke.width,ke.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ke.x,ke.y,ke.width,ke.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(ke,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(Se,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):oe.canvas(Object.assign({},s));return r.save(),t&&(we(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),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 Pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Le={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=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},Le),Ee={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},Oe={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},Ae=Object.assign(Object.assign({},Oe),Le),Me=Ie,We={};for(let t in Me)We[Me[t]]=t;const De={};for(let t in Me)De[Me[t]]=Ee[t];const Fe={drawRoundRect(t,e,s,i,r,o){const n=W.fourNumber(o,Math.min(i/2,r/2)),a=e+i,h=s+r;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(a,s,a,h,n[1]):t.lineTo(a,s),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,s,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,s,a,s,n[0]):t.lineTo(e,s)}},{sin:ze,cos:Ue,hypot:Ne,atan2:Ye,ceil:Xe,abs:He,PI:Ge,sqrt:Ve,pow:je}=Math,{setPoint:qe,addPoint:Qe}=yt,{set:Je,toNumberPoints:$e}=ht,{M:Ze,L:Ke,C:ts,Q:es,Z:ss}=Ie,is={},rs={points(t,e,s,i){let r=$e(e);if(t.push(Ze,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-2;s+=2)e=r[s-2],o=r[s-1],n=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=Ve(je(n-e,2)+je(a-o,2)),g=Ve(je(h-n,2)+je(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(es,d,c,n,a):t.push(ts,u,_,d,c,n,a),u=n+g*h,_=a+g*l);i||t.push(es,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Ke,r[e],r[e+1]);i&&t.push(ss)},rect(t,e,s,i,r){Pe.creator.path=t,Pe.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){Pe.creator.path=[],Fe.drawRoundRect(Pe.creator,e,s,i,r,o),t.push(...Pe.convertToCanvasData(Pe.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let g=Ye(u,c),f=Ye(p,_);const y=Ne(c,u),m=Ne(_,p);let x=f-g;if(x<0&&(x+=z),y<1e-12||m<1e-12||x<1e-12||He(x-Ge)<1e-12)return t&&t.push(Ke,i,r),h&&(qe(h,e,s),Qe(h,i,r)),d&&Je(d,e,s),void(l&&Je(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/Ue(x/2),B=i+b*Ue(g+x/2+U*v),k=r+b*ze(g+x/2+U*v);return g-=U*v,f-=U*v,as(t,B,k,a,a,0,g/F,f/F,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>as(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*F,_=ze(u),p=Ue(u);let g=n*F,f=a*F;g>Ge&&(g-=z),f<0&&(f+=z);let y=f-g;y<0?y+=z:y>z&&(y-=z),h&&(y-=z);const m=Xe(He(y/U)),x=y/m,w=ze(x/4),v=8/3*w*w/ze(x/2);f=g+x;let b,B,k,S,R,C,T,P,L=Ue(g),I=ze(g),E=k=p*i*L-_*r*I,O=S=_*i*L+p*r*I,A=e+k,M=s+S;t&&t.push(t.length?Ke:Ze,A,M),l&&qe(l,A,M),c&&Je(c,A,M);for(let o=0;o<m;o++)b=Ue(f),B=ze(f),k=p*i*b-_*r*B,S=_*i*b+p*r*B,R=e+E-v*(p*i*I+_*r*L),C=s+O-v*(_*i*I-p*r*L),T=e+k+v*(p*i*B+_*r*b),P=s+S+v*(_*i*B-p*r*b),t&&t.push(ts,R,C,T,P,e+k,s+S),l&&ns(e+E,s+O,R,C,T,P,e+k,s+S,l,!0),E=k,O=S,L=b,I=B,g=f,f+=x;d&&Je(d,e+k,s+S)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(ts,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){ns(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=s,v=r,b=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=o,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,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):qe(h,t,e),Qe(h,n,a);for(let l=0,c=d.length;l<c;l++)os(d[l],t,e,s,i,r,o,n,a,is),Qe(h,is.x,is.y)},getPointAndSet(t,e,s,i,r,o,n,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*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return os(t,e,s,i,r,o,n,a,h,l),l},getDerivative(t,e,s,i,r){const o=1-t;return 3*o*o*(s-e)+6*o*t*(i-s)+3*t*t*(r-i)}},{getPointAndSet:os,toTwoPointBounds:ns,ellipse:as}=rs,{sin:hs,cos:ls,sqrt:ds,atan2:cs}=Math,{ellipse:us}=rs,_s={ellipticalArc(t,e,s,i,r,o,n,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=o*F,p=hs(_),g=ls(_),f=-g*c-p*u,m=-g*u+p*c,x=i*i,w=r*r,v=m*m,b=f*f,B=x*w-x*v-w*b;let k=0;if(B<0){const t=ds(1-B/(x*w));i*=t,r*=t}else k=(n===a?-1:1)*ds(B/(x*v+w*b));const S=k*i*m/r,R=-k*r*f/i,C=cs((m-R)/r,(f-S)/i),T=cs((-m-R)/r,(-f-S)/i);let P=T-C;0===a&&P>0?P-=z:1===a&&P<0&&(P+=z);const L=e+c+g*S-p*R,I=s+u+p*S+g*R,E=P<0?1:0;d||y.ellipseToCurve?us(t,L,I,i,r,o,C/F,T/F,E):i!==r||o?t.push(Ie.G,L,I,i,r,o,C/F,T/F,E):t.push(Ie.O,L,I,i,C/F,T/F,E)}},ps={toCommand:t=>[],toNode:t=>[]},{M:gs,m:fs,L:ys,l:ms,H:xs,h:ws,V:vs,v:bs,C:Bs,c:ks,S:Ss,s:Rs,Q:Cs,q:Ts,T:Ps,t:Ls,A:Is,a:Es,Z:Os,z:As,N:Ms,D:Ws,X:Ds,G:Fs,F:zs,O:Us,P:Ns,U:Ys}=Ie,{rect:Xs,roundRect:Hs,arcTo:Gs,arc:Vs,ellipse:js,quadraticCurveTo:qs}=rs,{ellipticalArc:Qs}=_s,Js=$t.get("PathConvert"),$s={},Zs={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=De[i],a+=i===r?" ":We[i];for(let i=1;i<s;i++)a+=W.float(t[o+i],e),i===s-1||(a+=" ");r=i,o+=s}return a},parse(t,e){let s,i,r,o="";const n=[],a=e?Ae:Oe;for(let e=0,h=t.length;e<h;e++)i=t[e],Qt[i]?("."===i&&(Ks.dot&&(ti(n,o),o=""),Ks.dot++),"0"===o&&"."!==i&&(ti(n,o),o=""),o+=i):Ie[i]?(o&&(ti(n,o),o=""),Ks.name=Ie[i],Ks.length=Ee[i],Ks.index=0,ti(n,Ks.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&ti(n,o),o=i):o&&(ti(n,o),o=""),r=i;return o&&ti(n,o),s?Zs.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case fs:t[c+1]+=a,t[c+2]+=h;case gs:a=t[c+1],h=t[c+2],_.push(gs,a,h),c+=3;break;case ws:t[c+1]+=a;case xs:a=t[c+1],_.push(ys,a,h),c+=2;break;case bs:t[c+1]+=h;case vs:h=t[c+1],_.push(ys,a,h),c+=2;break;case ms:t[c+1]+=a,t[c+2]+=h;case ys:a=t[c+1],h=t[c+2],_.push(ys,a,h),c+=3;break;case Rs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Ss;case Ss:n=o===Bs||o===Ss,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(Bs,l,d,s,i,a,h),c+=5;break;case ks: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=Bs;case Bs:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(Bs,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Ls:t[c+1]+=a,t[c+2]+=h,r=Ps;case Ps:n=o===Cs||o===Ps,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?qs(_,a,h,s,i,t[c+1],t[c+2]):_.push(Cs,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ts:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Cs;case Cs:s=t[c+1],i=t[c+2],e?qs(_,a,h,s,i,t[c+3],t[c+4]):_.push(Cs,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Es:t[c+6]+=a,t[c+7]+=h;case Is:Qs(_,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 As:case Os:_.push(Os),c++;break;case Ms:a=t[c+1],h=t[c+2],e?Xs(_,a,h,t[c+3],t[c+4]):ei(_,t,c,5),c+=5;break;case Ws:a=t[c+1],h=t[c+2],e?Hs(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ei(_,t,c,9),c+=9;break;case Ds:a=t[c+1],h=t[c+2],e?Hs(_,a,h,t[c+3],t[c+4],t[c+5]):ei(_,t,c,6),c+=6;break;case Fs:js(e?_:ei(_,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,$s),a=$s.x,h=$s.y,c+=9;break;case zs:e?js(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ei(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Us:Vs(e?_:ei(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,$s),a=$s.x,h=$s.y,c+=7;break;case Ns:e?Vs(_,t[c+1],t[c+2],t[c+3],0,360,!1):ei(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ys:Gs(e?_:ei(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,$s),a=$s.x,h=$s.y,c+=6;break;default:return Js.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return ps.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(gs,t.x,t.y);break;case"L":e.push(ys,t.x,t.y);break;case"C":e.push(Bs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Cs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Os)}}),e}},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Ks.index===Ks.length&&(Ks.index=1,t.push(Ks.name)),t.push(Number(e)),Ks.index++,Ks.dot=0}},{current:Ks,pushData:ti,copyData:ei}=Zs,{M:si,L:ii,C:ri,Q:oi,Z:ni,N:ai,D:hi,X:li,G:di,F:ci,O:ui,P:_i,U:pi}=Ie,{getMinDistanceFrom:gi,getRadianFrom:fi}=ht,{tan:yi,min:mi,abs:xi}=Math,wi={},vi={beginPath(t){t.length=0},moveTo(t,e,s){t.push(si,e,s)},lineTo(t,e,s){t.push(ii,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(ri,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(oi,e,s,i,r)},closePath(t){t.push(ni)},rect(t,e,s,i,r){t.push(ai,e,s,i,r)},roundRect(t,e,s,i,r,o){if(a(o))t.push(li,e,s,i,r,o);else{const n=W.fourNumber(o);n?t.push(hi,e,s,i,r,...n):t.push(ai,e,s,i,r)}},ellipse(t,e,s,i,o,n,a,h,l){r(n)?t.push(ci,e,s,i,o):(r(a)&&(a=0),r(h)&&(h=360),t.push(di,e,s,i,o,n,a,h,l?1:0))},arc(t,e,s,i,o,n,a){r(o)?t.push(_i,e,s,i):(r(n)&&(n=360),t.push(ui,e,s,i,o,n,a?1:0))},arcTo(t,e,s,r,o,n,a,h){if(!i(a)){const t=gi(a,h,e,s,r,o);n=mi(n,mi(t/2,t/2*xi(yi(fi(a,h,e,s,r,o)/2))))}t.push(pi,e,s,r,o,n)},drawEllipse(t,e,s,i,o,n,a,h,l){rs.ellipse(null,e,s,i,o,r(n)?0:n,r(a)?0:a,r(h)?360:h,l,null,null,wi),t.push(si,wi.x,wi.y),bi(t,e,s,i,o,n,a,h,l)},drawArc(t,e,s,i,o,n,a){rs.arc(null,e,s,i,r(o)?0:o,r(n)?360:n,a,null,null,wi),t.push(si,wi.x,wi.y),Bi(t,e,s,i,o,n,a)},drawPoints(t,e,s,i){rs.points(t,e,s,i)}},{ellipse:bi,arc:Bi}=vi,{moveTo:ki,lineTo:Si,quadraticCurveTo:Ri,bezierCurveTo:Ci,closePath:Ti,beginPath:Pi,rect:Li,roundRect:Ii,ellipse:Ei,arc:Oi,arcTo:Ai,drawEllipse:Mi,drawArc:Wi,drawPoints:Di}=vi;class Fi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?Pe.parse(t):t:[],this}beginPath(){return Pi(this.__path),this.paint(),this}moveTo(t,e){return ki(this.__path,t,e),this.paint(),this}lineTo(t,e){return Si(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return Ci(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return Ri(this.__path,t,e,s,i),this.paint(),this}closePath(){return Ti(this.__path),this.paint(),this}rect(t,e,s,i){return Li(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Ii(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return Ei(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return Oi(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return Ai(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return Mi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return Wi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return Di(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:zi,L:Ui,C:Ni,Q:Yi,Z:Xi,N:Hi,D:Gi,X:Vi,G:ji,F:qi,O:Qi,P:Ji,U:$i}=Ie,Zi=$t.get("PathDrawer"),Ki={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case zi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Ui:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Ni:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Yi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Xi:t.closePath(),i+=1;break;case Hi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Gi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Vi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case ji:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*F,e[i+6]*F,e[i+7]*F,e[i+8]),i+=9;break;case qi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,z,!1),i+=5;break;case Qi:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*F,e[i+5]*F,e[i+6]),i+=7;break;case Ji:t.arc(e[i+1],e[i+2],e[i+3],0,z,!1),i+=4;break;case $i:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Zi.error(`command: ${s} [index:${i}]`,e)}}},{M:tr,L:er,C:sr,Q:ir,Z:rr,N:or,D:nr,X:ar,G:hr,F:lr,O:dr,P:cr,U:ur}=Ie,{toTwoPointBounds:_r,toTwoPointBoundsByQuadraticCurve:pr,arcTo:gr,arc:fr,ellipse:yr}=rs,{addPointBounds:mr,copy:xr,addPoint:wr,setPoint:vr,addBounds:br,toBounds:Br}=yt,kr=$t.get("PathBounds");let Sr,Rr,Cr;const Tr={},Pr={},Lr={},Ir={toBounds(t,e){Ir.toTwoPointBounds(t,Pr),Br(Pr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return vr(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===rr||n===sr||n===ir?vr(e,h,l):vr(e,t[a+1],t[a+2])),n){case tr:case er:h=t[a+1],l=t[a+2],wr(e,h,l),a+=3;break;case sr:r=t[a+5],o=t[a+6],_r(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,Tr),mr(e,Tr),h=r,l=o,a+=7;break;case ir:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],pr(h,l,s,i,r,o,Tr),mr(e,Tr),h=r,l=o,a+=5;break;case rr:a+=1;break;case or:h=t[a+1],l=t[a+2],br(e,h,l,t[a+3],t[a+4]),a+=5;break;case nr:case ar:h=t[a+1],l=t[a+2],br(e,h,l,t[a+3],t[a+4]),a+=n===nr?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,Lr),0===a?xr(e,Tr):mr(e,Tr),h=Lr.x,l=Lr.y,a+=9;break;case lr:h=t[a+1],l=t[a+2],Rr=t[a+3],Cr=t[a+4],br(e,h-Rr,l-Cr,2*Rr,2*Cr),h+=Rr,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,Lr),0===a?xr(e,Tr):mr(e,Tr),h=Lr.x,l=Lr.y,a+=7;break;case cr:h=t[a+1],l=t[a+2],Sr=t[a+3],br(e,h-Sr,l-Sr,2*Sr,2*Sr),h+=Sr,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,Lr),0===a?xr(e,Tr):mr(e,Tr),h=Lr.x,l=Lr.y,a+=6;break;default:return void kr.error(`command: ${n} [index:${a}]`,t)}}},{M:Er,L:Or,Z:Ar}=Ie,{getCenterX:Mr,getCenterY:Wr}=ht,{arcTo:Dr}=vi,Fr={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;n<g;){switch(i=t[n],i){case Er:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===Or?(c=t[n+1],u=t[n+2],f.push(Er,Mr(l,c),Wr(d,u))):f.push(Er,l,d);break;case Or:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case Or:Dr(f,a,h,t[n+1],t[n+2],e,_,p);break;case Ar:Dr(f,a,h,l,d,e,_,p);break;default:f.push(Or,a,h)}_=a,p=h;break;case Ar:r!==Ar&&(Dr(f,l,d,c,u,e,_,p),f.push(Ar)),n+=1;break;default:o=De[i];for(let e=0;e<o;e++)f.push(t[n+e]);n+=o}r=i}return i!==Ar&&(f[1]=l,f[2]=d),f}};function zr(t){return new Fi(t)}const Ur=zr();Pe.creator=zr(),Pe.parse=Zs.parse,Pe.convertToCanvasData=Zs.toCanvasData;const{drawRoundRect:Nr}=Fe;function Yr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Nr(this,t,e,s,i,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 Gr=$t.get("TaskProcessor");class Vr{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.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){Gr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class jr{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&u.assign(this.config,t),this.empty()}add(t,e,s){let r,o,n,h;const l=new Vr(t);return l.parent=this,a(e)?h=e:e&&(o=e.parallel,r=e.start,n=e.time,h=e.delay,s||(s=e.canUse)),n&&(l.time=n),!1===o&&(l.parallel=!1),s&&(l.canUse=s),i(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:s,index:i}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=i+e.parallel;if(r>s.length&&(r=s.length),e.parallel>1)for(let e=i;e<r&&(t=s[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 qr=$t.get("Resource"),Qr={tasker:new jr,map:{},get isComplete(){return Jr.tasker.isComplete},set(t,e){Jr.map[t]&&qr.repeat(t),Jr.map[t]=e},get:t=>Jr.map[t],remove(t){const e=Jr.map[t];e&&(e.destroy&&e.destroy(),delete Jr.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return o(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=oe.image(i)),Jr.set(t,e),e},destroy(){Jr.map={}}},Jr=Qr,$r={maxRecycled:10,recycledList:[],patternTasker:new jr,get(t){let e=Qr.get(t.url);return e||Qr.set(t.url,e=oe.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Zr.recycledList.push(t)})},clearRecycled(){const t=Zr.recycledList;t.length>Zr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Qr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Xr.alphaPixelTypes.some(e=>Zr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Xr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Xr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Zr.recycledList=[]}},Zr=$r,{IMAGE:Kr,create:to}=x;class eo{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=to(Kr),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,i(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 s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,s,i,r,o,n){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const a=y.image.resize(this.view,t,e,r,o,void 0,n,s,i);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,s,i){const r=y.canvas.createPattern(t,e);return y.image.setPatternTransform(r,s,i),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function so(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function io(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ro(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function oo(t,e){return(s,i)=>ao(s,i,t,e&&e(i))}function no(t){return t}function ao(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};so(t,e,Object.assign(r,i||{})),Wo(t,e,s)}function ho(t){return oo(t)}function lo(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function co(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function uo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),yo(this))}}))}function _o(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function po(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function go(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&yo(this)}}))}function fo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(yo(this),this.__.__removeNaturalSize())}}))}function yo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function mo(t){return oo(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),yo(this)}}))}const xo=go;function wo(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s)&&(vo(this),e&&(this.__.__useStroke=!0))}}))}function vo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&yo(t)}const bo=wo;function Bo(t){return oo(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function ko(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function So(t){return oo(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 Ro(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&To(this)}}))}function Co(t){return oo(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Po(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Po(this,t,e,s),this.mask&&To(this)}}))}function To(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Po(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||yo(t))}function Lo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Io(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Eo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Oo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Ao(t){return oo(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Mo(t){return(e,s)=>{so(e,"__DataProcessor",{get:()=>t})}}function Wo(t,e,s){const r=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=ro(e,s);if(i(s))a.get=function(){return this[o]};else if("function"==typeof s)a.get=function(){const t=this[o];return null==t?s(this.__leaf):t};else if(d(s)){const t=c(s);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:u.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,_=r;for(;!l&&_;)l=io(_,e),_=_.__proto__;l&&l.set&&(a.set=l.set),r[n]&&(a.set=r[n],delete r[n]),so(r,e,a)}const Do=new $t("rewrite"),Fo=[],zo=["destroy","constructor"];function Uo(t){return(e,s)=>{Fo.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function No(){return t=>{Yo()}}function Yo(t){Fo.length&&(Fo.forEach(e=>{t&&Do.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Fo.length=0)}function Xo(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(zo.includes(i)||e&&e.includes(i)))if(t.prototype){io(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Ho(){return t=>{ae.register(t)}}setTimeout(()=>Yo(!0));const{copy:Go,toInnerPoint:Vo,toOuterPoint:jo,scaleOfOuter:qo,rotateOfOuter:Qo,skewOfOuter:Jo,multiplyParent:$o,divideParent:Zo,getLayout:Ko}=$,tn={},{round:en}=Math,sn={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),nn(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)on(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)an(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&an(t),t.__updateChange()},updateAllChange(t){if(ln(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)hn(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,s,i,r,o){i||(i=t.__nowWorld),t.__worldFlipped||y.fullImageShadow?e.copyWorldByReset(s,i,t.__nowWorld,r,o):e.copyWorldToInner(s,i,t.__layout.renderBounds,r)},moveWorld(t,e,s=0,i,r){const o=d(e)?Object.assign({},e):{x:e,y:s};i?jo(t.localTransform,o,o,!0):t.parent&&Vo(t.parent.scrollWorldTransform,o,o,!0),rn.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){d(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=en(e),s=en(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){rn.zoomOfLocal(t,dn(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const n=t.__localMatrix;if(a(i)||(i&&(o=i),i=s),Go(tn,n),qo(tn,e,s,i),rn.hasHighPosition(t))rn.setTransform(t,tn,r,o);else{const e=t.x+tn.e-n.e,a=t.y+tn.f-n.f;o&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){rn.rotateOfLocal(t,dn(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Go(tn,r),Qo(tn,e,s),rn.hasHighPosition(t)?rn.setTransform(t,tn,!1,i):t.set({x:t.x+tn.e-r.e,y:t.y+tn.f-r.f,rotation:W.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){rn.skewOfLocal(t,dn(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Go(tn,t.__localMatrix),Jo(tn,e,s,i),rn.setTransform(t,tn,r,o)},transformWorld(t,e,s,i){Go(tn,t.worldTransform),$o(tn,e),t.parent&&Zo(tn,t.parent.scrollWorldTransform),rn.setTransform(t,tn,s,i)},transform(t,e,s,i){Go(tn,t.localTransform),$o(tn,e),rn.setTransform(t,tn,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&rn.getInnerOrigin(t,r.origin),n=Ko(e,o,r.around&&rn.getInnerOrigin(t,r.around));if(rn.hasOffset(t)&&(n.x-=r.offsetX,n.y-=r.offsetY),s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){Yt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=rn.getInnerOrigin(t,r.origin);ht.move(n,o.x-i.x,o.y-i.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return qo(s,rn.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>ht.tempToOuterOf(rn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return bt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Go(tn,t.worldTransform),Zo(tn,e.scrollWorldTransform),s?tn:Object.assign({},tn)),drop(t,e,s,i){t.setTransform(rn.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||rn.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,s=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const i=e.x*s,r=e.y*s;e.x-=i,e.y-=r,t.move(i,r),y.requestRender(()=>rn.animateMove(t,e,s))}}},rn=sn,{updateAllMatrix:on,updateMatrix:nn,updateAllWorldOpacity:an,updateAllChange:hn,updateChange:ln}=rn;function dn(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const cn={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)=>_n(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>_n(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>_n(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 un;function _n(t,e){return e||(un=0),t.__.mask&&(un=1),un<0?null:(un&&(un=-1),!0)}const{updateBounds:pn}=sn,gn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),fn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&i(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)yn(e[t],e)},updateBounds(t,e){const s=[t];yn(t,s),mn(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)pn(i[t]);e&&e===s||pn(s)}}},{pushAllChildBranch:fn,pushAllBranchStack:yn,updateBoundsByBranchStack:mn}=gn,xn={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:wn,updateBounds:vn}=sn,{toOuterOf:bn,getPoints:Bn,copy:kn}=Yt,Sn="_localContentBounds",Rn="_worldContentBounds",Cn="_worldBoxBounds",Tn="_worldStrokeBounds";class Pn{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 bn(this.contentBounds,this.leaf.__localMatrix,this[Sn]||(this[Sn]={})),this[Sn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return bn(this.contentBounds,this.leaf.__world,this[Rn]||(this[Rn]={})),this[Rn]}get worldBoxBounds(){return bn(this.boxBounds,this.leaf.__world,this[Cn]||(this[Cn]={})),this[Cn]}get worldStrokeBounds(){return bn(this.strokeBounds,this.leaf.__world,this[Tn]||(this[Tn]={})),this[Tn]}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 vn(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 s=e;if(s.__fullLayouting)return;s.__fullLayouting=!0,y.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return $.defaultMatrix;case"page":t=e.zoomLayer;default:return wn(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",s){const{leaf:i}=this;let r,o,n,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),o=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,o=$.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=wn(i,e,!0)}if(n||(n=$.getLayout(o)),kn(n,a),ht.copy(n,r),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(n.scaleX/=s,n.scaleY/=i,n.width*=s,n.height*=i)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=Bn(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:o=e}return i(o)||r.forEach(t=>s.innerToWorld(t,null,!1,o)),r}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}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 Ln{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 In extends Ln{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}In.ADD="child.add",In.REMOVE="child.remove",In.CREATED="created",In.MOUNTED="mounted",In.UNMOUNTED="unmounted",In.DESTROY="destroy";const En="property.scroll";class On extends Ln{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}On.CHANGE="property.change",On.LEAFER_CHANGE="property.leafer_change",On.SCROLL=En;const An={scrollX:En,scrollY:En};class Mn extends Ln{constructor(t,e){super(t),Object.assign(this,e)}}Mn.LOAD="image.load",Mn.LOADED="image.loaded",Mn.ERROR="image.error";class Wn extends Ln{static checkHas(t,e,s){"on"===s?e===Un?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Dn)||t.hasEvent(Fn)||t.hasEvent(zn),t.__hasWorldEvent=t.hasEvent(Un))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Dn,t),"inner"===e&&t.emit(Fn,t)),t.emit(zn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Un,this)}}Wn.RESIZE="bounds.resize",Wn.INNER="bounds.inner",Wn.LOCAL="bounds.local",Wn.WORLD="bounds.world";const{RESIZE:Dn,INNER:Fn,LOCAL:zn,WORLD:Un}=Wn,Nn={};[Dn,Fn,zn,Un].forEach(t=>Nn[t]=1);class Yn extends Ln{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(Yn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!i(this.resizingKeys[t.innerId])}}Yn.RESIZE="resize";class Xn extends Ln{constructor(t,e){super(t),this.data=e}}Xn.REQUEST="watch.request",Xn.DATA="watch.data";class Hn extends Ln{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Hn.REQUEST="layout.request",Hn.START="layout.start",Hn.BEFORE="layout.before",Hn.LAYOUT="layout",Hn.AFTER="layout.after",Hn.AGAIN="layout.again",Hn.END="layout.end";class Gn extends Ln{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Gn.REQUEST="render.request",Gn.CHILD_START="render.child_start",Gn.CHILD_END="render.child_end",Gn.START="render.start",Gn.BEFORE="render.before",Gn.RENDER="render",Gn.AFTER="render.after",Gn.AGAIN="render.again",Gn.END="render.end",Gn.NEXT="render.next";class Vn extends Ln{}Vn.START="leafer.start",Vn.BEFORE_READY="leafer.before_ready",Vn.READY="leafer.ready",Vn.AFTER_READY="leafer.after_ready",Vn.VIEW_READY="leafer.view_ready",Vn.VIEW_COMPLETED="leafer.view_completed",Vn.STOP="leafer.stop",Vn.RESTART="leafer.restart",Vn.END="leafer.end",Vn.UPDATE_MODE="leafer.update_mode",Vn.TRANSFORM="leafer.transform",Vn.MOVE="leafer.move",Vn.SCALE="leafer.scale",Vn.ROTATE="leafer.rotate",Vn.SKEW="leafer.skew";const{MOVE:jn,SCALE:qn,ROTATE:Qn,SKEW:Jn}=Vn,$n={x:jn,y:jn,scaleX:qn,scaleY:qn,rotation:Qn,skewX:Jn,skewY:Jn},Zn={};class Kn{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)l(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,n;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const a=ta(this,i,!0),h=o(t)?t.split(" "):t,d=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=a[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(d):a[t]=[d],Nn[t]&&Wn.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=o(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=ta(this,t);i.forEach(t=>{t&&(r=n[t],r&&(o=r.findIndex(t=>t.listener===e),o>-1&&r.splice(o,1),r.length||delete n[t],Nn[t]&&Wn.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):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:i}}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,s,i){if(!e)return l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&de.has(t)&&(e=de.get(t,{type:t,target:this,current:this}));const i=ta(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&!((r=i[o])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,o=s&&s[t],n=r&&r[t];return!!(i(e)?o||n:e?n:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ta(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Zn)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Zn)}}const{on:ea,on_:sa,off:ia,off_:ra,once:oa,emit:na,emitEvent:aa,hasEvent:ha,destroy:la}=Kn.prototype,da={on:ea,on_:sa,off:ia,off_:ra,once:oa,emit:na,emitEvent:aa,hasEvent:ha,destroyEventer:la},ca=$t.get("setAttr"),ua={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!s||n(e)||i(e)||(ca.warn(this.innerName,t,e),e=void 0),d(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new On(On.LEAFER_CHANGE,this,t,r,e));const s=$n[t];s&&(this.emitEvent(new Vn(s,this)),this.emitEvent(new Vn(Vn.TRANSFORM,this)))}this.emitPropertyEvent(On.CHANGE,t,r,e);const s=An[t];return s&&this.emitPropertyEvent(s,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new On(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||i(s.normalStyle[t])||(s.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,xa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;pa(this.__local||e,t?t.__scrollWorld||t.__world:fa,s,!!e.affectScaleOrRotation,r),i&&ga(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(_a(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(ya(s.around||s.origin,t.boxBounds,ma),ga(e,-ma.x,-ma.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:wa,updateAllMatrix:va}=sn,{updateBounds:ba}=gn,{toOuterOf:Ba,copyAndSpread:ka,copy:Sa}=Yt,{toBounds:Ra}=Ir,Ca={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ba(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Wn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Wn.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(),Ba(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ba(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ba(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?Ra(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),va(this),ba(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(va(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;ka(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;a(s)&&s<=0?Sa(e.renderBounds,e.strokeBounds):ka(e.renderBounds,e.boxBounds,s)}},Ta={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(s.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),sn.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.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:Pa}=cn,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 s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Pa(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Pa(s[i],e)||s[i].__clip(t,e)}}},Ia={},{LEAF:Ea,create:Oa}=x,{stintSet:Aa}=u,{toInnerPoint:Ma,toOuterPoint:Wa,multiplyParent:Da}=$,{toOuterOf:Fa}=Yt,{copy:za,move:Ua}=ht,{moveLocal:Na,zoomOfLocal:Ya,rotateOfLocal:Xa,skewOfLocal:Ha,moveWorld:Ga,zoomOfWorld:Va,rotateOfWorld:ja,skewOfWorld:qa,transform:Qa,transformWorld:Ja,setTransform:$a,getFlipTransform:Za,getLocalOrigin:Ka,getRelativeWorld:th,drop:eh}=sn;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 Pn}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=Oa(Ea),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(In.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(In.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(In.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(In.MOUNTED)):this.__emitLifeEvent(In.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){i(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=i(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return Da(s,t.matrix,e,void 0,s),Fa(this.__layout.renderBounds,e,e),Aa(e,"half",s.half),Aa(e,"ignorePixelSnap",s.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:s,scaleY:i}=$r.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),Ia.scaleX=s,Ia.scaleY=i,Ia}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?th(this,e):this.worldTransform,r=s?t:{};return Fa(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&za(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&za(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Ma(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){Wa(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Ua(r,-o,-n),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Ua(r,o,n),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){$a(this,t,e,s)}transform(t,e,s){Qa(this,t,e,s)}move(t,e,s){Na(this,t,e,s)}moveInner(t,e,s){Ga(this,t,e,!0,s)}scaleOf(t,e,s,i,r){Ya(this,Ka(this,t),e,s,i,r)}rotateOf(t,e,s){Xa(this,Ka(this,t),e,s)}skewOf(t,e,s,i,r){Ha(this,Ka(this,t),e,s,i,r)}transformWorld(t,e,s){Ja(this,t,e,s)}moveWorld(t,e,s){Ga(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Va(this,t,e,s,i,r)}rotateOfWorld(t,e){ja(this,t,e)}skewOfWorld(t,e,s,i,r){qa(this,t,e,s,i,r)}flip(t,e){Qa(this,Za(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return 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,s){eh(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):Wo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=go),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new In(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(In.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=_e([Xo(ua),Xo(xa),Xo(Ca),Xo(da),Xo(Ta)],t.Leaf);const{setListWithFn:sh}=Yt,{sort:ih}=gn,{localBoxBounds:rh,localStrokeBounds:oh,localRenderBounds:nh,maskLocalBoxBounds:ah,maskLocalStrokeBounds:hh,maskLocalRenderBounds:lh}=cn,dh=new $t("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){sh(e||this.__layout.boxBounds,this.children,this.__hasMask?ah:rh)}__updateStrokeBounds(t){sh(t||this.__layout.strokeBounds,this.children,this.__hasMask?hh:oh)}__updateRenderBounds(t){sh(t||this.__layout.renderBounds,this.children,this.__hasMask?lh:nh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(ih),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return dh.warn("add self or destroyed");const s=i(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),s||e++});t=ae.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(In.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(In.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)):i(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(In.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(In.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new In(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=_e([Xo(La)],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&&!i(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return i(e)?-1:e}add(t){const{list:e,keys:s}=this;i(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(i(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,o=e.length;r<o;r++)i(s)?e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;i(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new ch;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}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!i(this.keys[t.innerId])}without(t){return i(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}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:s}=this;if(e&&s){const i=s.children[t];i?(this.setAbsolute(i),s.insertBefore(e,i)):s.appendChild(i)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:s}=this.view;if(s.display||(s.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}y.syncDomFont&&!this.parentView&&(s.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=o(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:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;t.hasChildNodes()&&(this.setAbsolute(s),t.style.position||(t.style.position="relative")),t.appendChild(s)}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:s}=this,{style:r}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:s}=this;t.width?(i(e)&&(this.autoWidthStr=r.width||""),r.width=t.width+"px"):i(e)||(r.width=e),t.height?(i(s)&&(this.autoHeightStr=r.height||""),r.height=t.height+"px"):i(s)||(r.height=s)}else r.width=t+"px",r.height=e+"px",this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}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:s}=this;this.emitResize({width:e,height:s,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:o}=this.autoBounds.getBoundsFrom(t),n={width:r,height:o,pixelRatio:this.config.pixelRatio?this.pixelRatio:y.devicePixelRatio};if(!this.isSameSize(n)){const{style:t}=e;t.marginLeft=s+"px",t.marginTop=i+"px",this.emitResize(n)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};u.copyAttrs(e,this,Ce),this.resize(t),this.resizeListener&&!i(this.width)&&this.resizeListener(new Yn(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:gh,fileType:fh}=Xr;function yh(t,e){y.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>{const i=gh(e),r=t.toDataURL(i,s);return"image/bmp"===i?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,s)=>new Promise(i=>t.toBlob(i,gh(e),s)),canvasSaveAs:(t,e,s)=>{const i=t.toDataURL(gh(fh(e)),s);return y.origin.download(i,e)},download:(t,e)=>new Promise(s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()}),loadImage:t=>new Promise((e,s)=>{const i=new y.origin.Image,{crossOrigin:r}=y.image;r&&(i.setAttribute("crossOrigin",r),i.crossOrigin=r),i.onload=()=>{e(i)},i.onerror=t=>{s(t)},i.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=oe.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(oe,{canvas:(t,e)=>new ph(t,e),image:t=>new eo(t)}),y.name="web",y.isMobile="ontouchstart"in window,y.requestRender=function(t){window.requestAnimationFrame(t)},so(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 xh{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(Gn.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===In.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,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Xn(Xn.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_([[On.CHANGE,this.__onAttrChange,this],[[In.ADD,In.REMOVE],this.__onChildEvent,this],[Xn.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:vh,updateChange:bh}=sn,{pushAllChildBranch:Bh,pushAllParent:kh}=gn;const{worldBounds:Sh}=cn;class Rh{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,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:Ch,updateAllChange:Th}=sn,Ph=$t.get("Layouter");class Lh{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(Hn.START),this.layoutOnce(),t.emitEvent(new Hn(Hn.END,this.layoutedBlocks,this.times))}catch(t){Ph.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ph.warn("layouting"):this.times>3?Ph.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Xn.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:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Hn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new Hn(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(wh(t,!0),e.add(t),t.isBranch&&Bh(t,e),kh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),kh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||vh(i[t])}vh(s)}})}(this.__levelList),function(t){t.list.forEach(bh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new Hn(o,a,this.times)),s.emitEvent(new Hn(n,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:s,LAYOUT:i,AFTER:r}=Hn,o=this.getBlocks(new ch(e));e.emitEvent(new Hn(s,o,this.times)),Lh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Hn(i,o,this.times)),e.emitEvent(new Hn(r,o,this.times)),this.addBlocks(o),ee.end(t)}static fullLayout(t){Ch(t,!0),t.isBranch?gn.updateBounds(t):sn.updateBounds(t),Th(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Rh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new Rh(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_([[Hn.REQUEST,this.layout,this],[Hn.AGAIN,this.layoutAgain,this],[Xn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ih=$t.get("Renderer");class Eh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=u.default(s,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(Hn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Gn.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Gn.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Gn.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Vt,Ih.log(e.innerName,"---\x3e");try{this.emitRender(Gn.START),this.renderOnce(t),this.emitRender(Gn.END,this.totalBounds),$r.clearRecycled()}catch(t){this.rendering=!1,Ih.error(t)}Ih.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ih.warn("rendering");if(this.times>3)return Ih.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Vt,this.renderOptions={},t)this.emitRender(Gn.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Gn.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Gn.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Gn.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:s}=this,i=t.getIntersect(s.bounds),r=new Vt(i);s.save(),i.spread(Eh.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.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:s}=this,i=t.includes(this.target.__world),r=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),$t.showRepaint&&$t.drawRepaint(s,t),y.render(this.target,s,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.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:s}=this.config;if(s&&t>s)return y.requestRender(e);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Vt(0,0,e,s).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||Ih.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new Gn(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Gn.REQUEST,this.update,this],[Hn.END,this.__onLayoutEnd,this],[Gn.AGAIN,this.renderAgain,this],[Yn.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function Oh(t){return oo(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ah(t){return oo(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Mh(){return(t,e)=>{const s="_"+e;so(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}Eh.clipSpread=10,Object.assign(oe,{watcher:(t,e)=>new xh(t,e),layouter:(t,e)=>new Lh(t,e),renderer:(t,e,s)=>new Eh(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),y.layout=Lh.fullLayout,y.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new ch,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Wh={},Dh={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}},Fh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},zh={},Uh={},Nh={},Yh={},Xh={},Hh={apply(){re.need("filter")}},Gh={},Vh={setStyleName:()=>re.need("state"),set:()=>re.need("state")},jh={list:{},register(t,e){jh.list[t]=e},get:t=>jh.list[t]},{parse:qh,objectToCanvasData:Qh}=Zs,{stintSet:Jh}=u,{hasTransparent:$h}=Dh,Zh={originPaint:{}},Kh=$t.get("UIData");class tl 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,Kh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Kh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(Jh(this,"__isTransparentFill",$h(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(Jh(this,"__isTransparentStroke",$h(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=o(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?qh(t):Qh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){el(this,"shadow",t)}setInnerShadow(t){el(this,"innerShadow",t)}setFilter(t){el(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Uh.compute("fill",this.__leaf),e&&Uh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),i(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Zh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Zh))}__removePaint(t,e){e&&this.__removeInput(t),Nh.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 el(t,e,s){t.__setInput(e,s),l(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class sl extends tl{}class il extends sl{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 rl extends sl{__getInputData(t,e){const s=super.__getInputData(t,e);return Ce.forEach(t=>delete s[t]),s}}class ol extends il{}class nl extends tl{get __usePathBox(){return this.points||this.__pathInputed}}class al extends tl{get __boxStroke(){return!this.__pathInputed}}class hl extends tl{get __boxStroke(){return!this.__pathInputed}}class ll extends nl{}class dl extends tl{}class cl extends tl{get __pathInputed(){return 2}}class ul extends sl{}const _l={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class pl extends tl{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=_l[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=ae.get("Rect",0);const r=e.__layout,o=s.__layout;i||(s.parent=e,s.__world=e.__world,o.boxBounds=r.boxBounds),s.set(t),o.strokeChanged&&r.strokeChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class gl extends al{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 s=super.__getInputData(t,e);return s.url&&delete s.fill,s}}class fl extends al{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const{max:yl,add:ml}=R,xl={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,o=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=yl(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:o,renderSpread:n}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Xh.getShadowRenderSpread(this,e)),i&&(t=yl(t,i)),o&&(t=ml(t,Hh.getSpread(o))),n&&(t=ml(t,n)),a&&(t=ml(t,a));let l=t;return s&&(l=yl(l,Xh.getInnerShadowSpread(this,s))),r&&(l=yl(l,r)),this.__layout.renderShapeSpread=l,h?yl(h.__updateRenderSpread(),t):t}},{stintSet:wl}=u,vl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);wl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),wl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;wl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Xh.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(l(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),wl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){bl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:o,__drawAfterFill:n,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=Uh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Xh.shadow(this,t,h),a&&(i.__isStrokes?Uh.strokes(o,this,t,e):Uh.stroke(o,this,t,e)),r&&(i.__isFills?Uh.fills(r,this,t,e):Uh.fill(r,this,t,e)),n&&this.__drawAfterFill(t,e),d&&Xh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?Uh.strokes(o,this,t,e):Uh.stroke(o,this,t,e)),c&&Hh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Uh.strokes(o,this,t,e):Uh.stroke(o,this,t,e)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,Dh.string(e.color))}r&&(i.__isFills?Uh.fills(r,this,t,e):Uh.fill(r,this,t,e)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?Uh.strokes(o,this,t,e):Uh.stroke(o,this,t,e))}}else i.__pathInputed?bl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?Uh.fills(i,this,t,e):Uh.fill("#000000",this,t,e)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Uh.strokes(r,this,t,e):Uh.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,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&Uh.stroke(r,t,e,s),i&&Uh.fill(i,t,e,s),o&&t.__drawAfterFill(e,s),r&&!n&&Uh.stroke(r,t,e,s)}const Bl={__drawFast(t,e){let{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;const{fill:n,stroke:a,__drawAfterFill:h}=this.__;if(n&&(t.fillStyle=n,t.fillRect(s,i,r,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:n,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(n){case"center":t.strokeRect(0,0,r,o);break;case"inside":r-=h,o-=h,r<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,o),t.restore()):t.strokeRect(s+l,i+l,r,o);break;case"outside":t.strokeRect(s-l,i-l,r+h,o+h)}}}};var kl,Sl;t.UI=kl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.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 o(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 s=e?this.__.__pathForRender:this.__.path;return s||(Ur.set(s=[]),this.__drawPathByBox(Ur)),t?Zs.toCanvasData(s,!0):s}getPathString(t,e,s){return Zs.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Gh.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&&zh.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?Ki.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,s,i,r,a(o)?[o]:o)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e,s){Uh.fill(this.__.placeholderColor,this,e,s)}animate(t,e,s,i){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),kl.one(e)}static one(t,e,s,i,r){return ae.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Ho()(this)}static registerData(t){Mo(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([Mo(tl)],t.UI.prototype,"__",void 0),_e([Mh()],t.UI.prototype,"zoomLayer",void 0),_e([ho("")],t.UI.prototype,"id",void 0),_e([ho("")],t.UI.prototype,"name",void 0),_e([ho("")],t.UI.prototype,"className",void 0),_e([ko("pass-through")],t.UI.prototype,"blendMode",void 0),_e([Ro(1)],t.UI.prototype,"opacity",void 0),_e([Co(!0)],t.UI.prototype,"visible",void 0),_e([ko(!1)],t.UI.prototype,"locked",void 0),_e([So(!1)],t.UI.prototype,"dim",void 0),_e([So(!1)],t.UI.prototype,"dimskip",void 0),_e([Lo(0)],t.UI.prototype,"zIndex",void 0),_e([Io(!1)],t.UI.prototype,"mask",void 0),_e([Eo(!1)],t.UI.prototype,"eraser",void 0),_e([lo(0,!0)],t.UI.prototype,"x",void 0),_e([lo(0,!0)],t.UI.prototype,"y",void 0),_e([go(100,!0)],t.UI.prototype,"width",void 0),_e([go(100,!0)],t.UI.prototype,"height",void 0),_e([_o(1,!0)],t.UI.prototype,"scaleX",void 0),_e([_o(1,!0)],t.UI.prototype,"scaleY",void 0),_e([po(0,!0)],t.UI.prototype,"rotation",void 0),_e([po(0,!0)],t.UI.prototype,"skewX",void 0),_e([po(0,!0)],t.UI.prototype,"skewY",void 0),_e([lo(0,!0)],t.UI.prototype,"offsetX",void 0),_e([lo(0,!0)],t.UI.prototype,"offsetY",void 0),_e([co(0,!0)],t.UI.prototype,"scrollX",void 0),_e([co(0,!0)],t.UI.prototype,"scrollY",void 0),_e([uo()],t.UI.prototype,"origin",void 0),_e([uo()],t.UI.prototype,"around",void 0),_e([ho(!1)],t.UI.prototype,"lazy",void 0),_e([fo(1)],t.UI.prototype,"pixelRatio",void 0),_e([Bo(0)],t.UI.prototype,"renderSpread",void 0),_e([mo()],t.UI.prototype,"path",void 0),_e([xo()],t.UI.prototype,"windingRule",void 0),_e([xo(!0)],t.UI.prototype,"closed",void 0),_e([go(0)],t.UI.prototype,"padding",void 0),_e([go(!1)],t.UI.prototype,"lockRatio",void 0),_e([go()],t.UI.prototype,"widthRange",void 0),_e([go()],t.UI.prototype,"heightRange",void 0),_e([ho(!1)],t.UI.prototype,"draggable",void 0),_e([ho()],t.UI.prototype,"dragBounds",void 0),_e([ho("auto")],t.UI.prototype,"dragBoundsType",void 0),_e([ho(!1)],t.UI.prototype,"editable",void 0),_e([Oo(!0)],t.UI.prototype,"hittable",void 0),_e([Oo("path")],t.UI.prototype,"hitFill",void 0),_e([bo("path")],t.UI.prototype,"hitStroke",void 0),_e([Oo(!1)],t.UI.prototype,"hitBox",void 0),_e([Oo(!0)],t.UI.prototype,"hitChildren",void 0),_e([Oo(!0)],t.UI.prototype,"hitSelf",void 0),_e([Oo()],t.UI.prototype,"hitRadius",void 0),_e([Ao("")],t.UI.prototype,"cursor",void 0),_e([ko()],t.UI.prototype,"fill",void 0),_e([bo(void 0,!0)],t.UI.prototype,"stroke",void 0),_e([bo("inside")],t.UI.prototype,"strokeAlign",void 0),_e([bo(1,!0)],t.UI.prototype,"strokeWidth",void 0),_e([bo(!1)],t.UI.prototype,"strokeWidthFixed",void 0),_e([bo("none")],t.UI.prototype,"strokeCap",void 0),_e([bo("miter")],t.UI.prototype,"strokeJoin",void 0),_e([bo()],t.UI.prototype,"dashPattern",void 0),_e([bo(0)],t.UI.prototype,"dashOffset",void 0),_e([bo(10)],t.UI.prototype,"miterLimit",void 0),_e([xo(0)],t.UI.prototype,"cornerRadius",void 0),_e([xo()],t.UI.prototype,"cornerSmoothing",void 0),_e([Oh()],t.UI.prototype,"shadow",void 0),_e([Oh()],t.UI.prototype,"innerShadow",void 0),_e([Oh()],t.UI.prototype,"blur",void 0),_e([Oh()],t.UI.prototype,"backgroundBlur",void 0),_e([Oh()],t.UI.prototype,"grayscale",void 0),_e([Oh()],t.UI.prototype,"filter",void 0),_e([ko()],t.UI.prototype,"placeholderColor",void 0),_e([ho(100)],t.UI.prototype,"placeholderDelay",void 0),_e([ho({})],t.UI.prototype,"data",void 0),_e([Uo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=kl=_e([Xo(xl),Xo(vl),No()],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:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}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([Mo(sl)],t.Group.prototype,"__",void 0),_e([go(0)],t.Group.prototype,"width",void 0),_e([go(0)],t.Group.prototype,"height",void 0),t.Group=_e([Xo(t.Branch),Ho()],t.Group);const Rl=$t.get("Leafer");t.Leafer=Sl=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),Sl.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,u.assign(i,t));const r=this.canvas=oe.canvas(i);this.__controllers.push(this.renderer=oe.renderer(this,r,i),this.watcher=oe.watcher(this,i),this.layouter=oe.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=oe.selector(this),this.interaction=oe.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=oe.hitCanvasManager()),this.canvasManager=new ue,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),xn.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(Vn.RESTART):this.emitLeafer(Vn.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(Vn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=u.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Vt(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.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 s=u.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new Yn(t,s))}__onResize(t){this.emitEvent(t),u.copyAttrs(this.__,t,Ce),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 qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ce.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(Vn.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=u.copyAttrs({},i,Ce);r[t]=s[t]=e,s.width&&s.height?i.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(Vn.BEFORE_READY),this.emitLeafer(Vn.READY),this.emitLeafer(Vn.AFTER_READY),xn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Vn.VIEW_READY),xn.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:o}=this;const n="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,n.x+n.width)),s||(r=Math.max(1,n.y+n.height)),this.__doResize({width:i,height:r,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){xn.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(Vn.VIEW_COMPLETED),xn.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,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return re.need("view")}getValidMove(t,e,s){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:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Vn(t,this))}__listenEvents(){const t=ee.start("FirstCreate "+this.innerName);this.once([[Vn.START,()=>ee.end(t)],[Hn.START,this.updateLazyBounds,this],[Gn.START,this.__onCreated,this],[Gn.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Xn.DATA,this.__onWatchData,this],[Hn.END,this.__onLayoutEnd,this],[Gn.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Sl.list.remove(this);try{this.stop(),this.emitLeafer(Vn.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){Rl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ch,_e([Mo(rl)],t.Leafer.prototype,"__",void 0),_e([go()],t.Leafer.prototype,"pixelRatio",void 0),_e([ho("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Sl=_e([Ho()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},_e([Mo(al)],t.Rect.prototype,"__",void 0),t.Rect=_e([Xo(Bl),No(),Ho()],t.Rect);const{add:Cl,includes:Tl,scroll:Pl}=Yt,Ll=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 s=this.__,i=this.__layout,{renderBounds:r,boxBounds:o}=i,{overflow:n}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=n&&n.includes("scroll"))&&(Cl(a,o),Pl(a,s)),this.__updateRectRenderBounds(),t=!Tl(o,a),t&&"show"===n&&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([Mo(il)],t.Box.prototype,"__",void 0),_e([go(100)],t.Box.prototype,"width",void 0),_e([go(100)],t.Box.prototype,"height",void 0),_e([ho(!1)],t.Box.prototype,"resizeChildren",void 0),_e([Bo("show")],t.Box.prototype,"overflow",void 0),_e([Uo(Ll.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),_e([Uo(Ll.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),_e([Uo(Ll.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),_e([Uo(Ll.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),_e([Uo(Ll.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),_e([Uo(Ll.__updateChange)],t.Box.prototype,"__updateRectChange",null),_e([Uo(Ll.__render)],t.Box.prototype,"__renderRect",null),_e([Uo(Il.__render)],t.Box.prototype,"__renderGroup",null),t.Box=_e([No(),Ho()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},_e([Mo(ol)],t.Frame.prototype,"__",void 0),_e([ko("#FFFFFF")],t.Frame.prototype,"fill",void 0),_e([Bo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=_e([Ho()],t.Frame);const{moveTo:El,closePath:Ol,ellipse:Al}=vi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?(i||r?(s<1&&Al(a,o,n,o*s,n*s,0,i,r,!1),Al(a,o,n,o,n,0,r,i,!0),s<1&&Ol(a)):(s<1&&(Al(a,o,n,o*s,n*s),El(a,t,n)),Al(a,o,n,o,n,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):i||r?(El(a,o,n),Al(a,o,n,o,n,0,i,r,!1),Ol(a)):Al(a,o,n,o,n)}},_e([Mo(hl)],t.Ellipse.prototype,"__",void 0),_e([xo(0)],t.Ellipse.prototype,"innerRadius",void 0),_e([xo(0)],t.Ellipse.prototype,"startAngle",void 0),_e([xo(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=_e([Ho()],t.Ellipse);const{sin:Ml,cos:Wl,PI:Dl}=Math,{moveTo:Fl,lineTo:zl,closePath:Ul,drawPoints:Nl}=vi;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Nl(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,o=s/2,n=i/2;Fl(e,o,0);for(let t=1;t<r;t++)zl(e,o+o*Ml(2*t*Dl/r),n-n*Wl(2*t*Dl/r));Ul(e)}}},_e([Mo(ll)],t.Polygon.prototype,"__",void 0),_e([xo(3)],t.Polygon.prototype,"sides",void 0),_e([xo()],t.Polygon.prototype,"points",void 0),_e([xo(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=_e([No(),Ho()],t.Polygon);const{sin:Yl,cos:Xl,PI:Hl}=Math,{moveTo:Gl,lineTo:Vl,closePath:jl}=vi;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Gl(n,r,0);for(let t=1;t<2*s;t++)Vl(n,r+(t%2==0?r:r*i)*Yl(t*Hl/s),o-(t%2==0?o:o*i)*Xl(t*Hl/s));jl(n)}},_e([Mo(dl)],t.Star.prototype,"__",void 0),_e([xo(5)],t.Star.prototype,"corners",void 0),_e([xo(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=_e([Ho()],t.Star);const{moveTo:ql,lineTo:Ql,drawPoints:Jl}=vi,{rotate:$l,getAngle:Zl,getDistance:Kl,defaultPoint:td}=ht;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&$l(s,e),s}set toPoint(t){this.width=Kl(td,t),this.rotation=Zl(td,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Jl(e,t.points,t.curve,t.closed):(ql(e,0,0),Ql(e,this.width,0))}},_e([Mo(nl)],t.Line.prototype,"__",void 0),_e([wo("center")],t.Line.prototype,"strokeAlign",void 0),_e([go(0)],t.Line.prototype,"height",void 0),_e([xo()],t.Line.prototype,"points",void 0),_e([xo(0)],t.Line.prototype,"curve",void 0),_e([xo(!1)],t.Line.prototype,"closed",void 0),t.Line=_e([Ho()],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([Mo(gl)],t.Image.prototype,"__",void 0),_e([go("")],t.Image.prototype,"url",void 0),t.Image=_e([Ho()],t.Image);const ed=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=oe.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new eo({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Mn(Mn.LOADED,{image:t}))})}draw(t,e,s,i){const r=new gt(t.worldTransform).invert(),o=new gt;e&&o.translate(e.x,e.y),s&&(a(s)?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.multiplyParent(o),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},_e([Mo(fl)],t.Canvas.prototype,"__",void 0),_e([Ah(100)],t.Canvas.prototype,"width",void 0),_e([Ah(100)],t.Canvas.prototype,"height",void 0),_e([Ah(1)],t.Canvas.prototype,"pixelRatio",void 0),_e([Ah(!0)],t.Canvas.prototype,"smooth",void 0),_e([ho(!1)],t.Canvas.prototype,"safeResize",void 0),_e([Ah()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=_e([Ho()],t.Canvas);const{copyAndSpread:sd,includes:id,spread:rd,setList:od}=Yt,{stintSet:nd}=u;function ad(t,e,s){t.__.__font?Uh.fillText(t,e,s):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function hd(t,e,s,i,r){const o=s.__;d(t)?Uh.drawStrokesStyle(t,e,!1,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),i.stroke()),o.__useArrow&&Uh.strokeArrow(t,s,i,r)}function ld(t,e,s,i,r){const o=s.__;d(t)?Uh.drawStrokesStyle(t,e,!0,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),Uh.drawTextStroke(s,i,r))}function dd(t,e,s,i,r){const o=i.getSameCanvas(!0,!0);o.font=s.__.__font,ld(t,2,s,o,r),o.blendMode="outside"===e?"destination-out":"destination-in",Uh.fillText(s,o,r),o.blendMode="normal",sn.copyCanvasByWorld(s,i,o),o.recycle(s.__nowWorld)}t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:o,italic:n,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Fh.number(e,r),t.__letterSpacing=Fh.number(s,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${n?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${i||"caption"}`,nd(t,"__padding",l&&W.fourNumber(l)),nd(t,"__clipText","show"!==h&&!t.__autoSize),nd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Wh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:o,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&rd(a,s/2),o||n){if(h.x=o?a.x:0,h.y=n?a.y:0,h.width=o?a.width:t.width,h.height=n?a.height:t.height,r){const[e,s,i,r]=t.__padding;o&&(h.x-=r,h.width+=s+r),n&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),u.stintSet(this,"isOverflow",!id(h,a)),this.isOverflow?(od(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;sd(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,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__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([Mo(pl)],t.Text.prototype,"__",void 0),_e([go(0)],t.Text.prototype,"width",void 0),_e([go(0)],t.Text.prototype,"height",void 0),_e([ko()],t.Text.prototype,"boxStyle",void 0),_e([ho(!1)],t.Text.prototype,"resizeFontSize",void 0),_e([ko("#000000")],t.Text.prototype,"fill",void 0),_e([wo("outside")],t.Text.prototype,"strokeAlign",void 0),_e([Oo("all")],t.Text.prototype,"hitFill",void 0),_e([go("")],t.Text.prototype,"text",void 0),_e([go("")],t.Text.prototype,"placeholder",void 0),_e([go("caption")],t.Text.prototype,"fontFamily",void 0),_e([go(12)],t.Text.prototype,"fontSize",void 0),_e([go("normal")],t.Text.prototype,"fontWeight",void 0),_e([go(!1)],t.Text.prototype,"italic",void 0),_e([go("none")],t.Text.prototype,"textCase",void 0),_e([go("none")],t.Text.prototype,"textDecoration",void 0),_e([go(0)],t.Text.prototype,"letterSpacing",void 0),_e([go({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),_e([go(0)],t.Text.prototype,"paraIndent",void 0),_e([go(0)],t.Text.prototype,"paraSpacing",void 0),_e([go("x")],t.Text.prototype,"writingMode",void 0),_e([go("left")],t.Text.prototype,"textAlign",void 0),_e([go("top")],t.Text.prototype,"verticalAlign",void 0),_e([go(!0)],t.Text.prototype,"autoSizeAlign",void 0),_e([go("normal")],t.Text.prototype,"textWrap",void 0),_e([go("show")],t.Text.prototype,"textOverflow",void 0),_e([ko(!1)],t.Text.prototype,"textEditing",void 0),t.Text=_e([Ho()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},_e([Mo(cl)],t.Path.prototype,"__",void 0),_e([wo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=_e([Ho()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const s=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=s.path||(s.path=[]),this.add(s),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},_e([Mo(ul)],t.Pen.prototype,"__",void 0),_e([(t,e)=>{so(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=_e([Xo(Fi,["set","path","paint"]),Ho()],t.Pen);const{getSpread:cd,copyAndSpread:ud,toOuterOf:_d,getOuterOf:pd,getByMove:gd,move:fd,getIntersectData:yd}=Yt,md={};let xd;const{stintSet:wd}=u,{hasTransparent:vd}=Dh;function bd(t,e,s){if(!d(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:n}=s.__layout;switch(e.type){case"image":r=Nh.image(s,t,e,n,!xd||!xd[e.url]);break;case"linear":r=Yh.linearGradient(e,n);break;case"radial":r=Yh.radialGradient(e,n);break;case"angular":r=Yh.conicGradient(e,n);break;case"solid":const{type:o,color:a,opacity:h}=e;r={type:o,style:Dh.string(a,h)};break;default:i(e.r)||(r={type:"solid",style:Dh.string(e)})}if(r&&(r.originPaint=e,o(r.style)&&vd(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const Bd={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];l(a)||(a=[a]),xd=Nh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=bd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length?(i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(wd(s,"__isAlphaPixelFill",r),wd(s,"__isTransparentFill",o)):(wd(s,"__isAlphaPixelStroke",r),wd(s,"__isTransparentStroke",o),wd(s,"__hasMultiStrokeStyle",n))):s.__removePaint(t,!1)},fill:function(t,e,s,i){s.fillStyle=t,ad(e,s,i)},fills:function(t,e,s,i){let r,o,n;for(let a=0,h=t.length;a<h;a++){if(r=t[a],o=r.originPaint,r.image){if(n?n++:n=1,Nh.checkImage(r,!e.__.__font,e,s,i))continue;if(!r.style){1===n&&r.image.isPlacehold&&e.drawImagePlaceholder(r,s,i);continue}}if(s.fillStyle=r.style,r.transform||o.scaleFixed){if(s.save(),r.transform&&s.transform(r.transform),o.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0);(!0===o.scaleFixed||"zoom-in"===o.scaleFixed&&t>1&&i>1)&&s.scale(1/t,1/i)}o.blendMode&&(s.blendMode=o.blendMode),ad(e,s,i),s.restore()}else o.blendMode?(s.saveBlendMode(o.blendMode),ad(e,s,i),s.restoreBlendMode()):ad(e,s,i)}},fillPathOrText:ad,fillText:function(t,e,s){const i=t.__,{rows:r,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,s=r.length;t<s;t++)n=r[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(o){const{decorationColor:t,decorationHeight:s}=i.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>o.forEach(i=>e.fillRect(t.x,t.y+i,t.width,s)))}},stroke:function(t,e,s,i){const r=e.__;if(r.__strokeWidth)if(r.__font)Uh.strokeText(t,e,s,i);else switch(r.strokeAlign){case"center":hd(t,1,e,s,i);break;case"inside":!function(t,e,s,i){s.save(),s.clipUI(e),hd(t,2,e,s,i),s.restore()}(t,e,s,i);break;case"outside":!function(t,e,s,i){const r=e.__;if(r.__fillAfterStroke)hd(t,2,e,s,i);else{const{renderBounds:o}=e.__layout,n=s.getSameCanvas(!0,!0);e.__drawRenderPath(n),hd(t,2,e,n,i),n.clipUI(r),n.clearWorld(o),sn.copyCanvasByWorld(e,s,n),n.recycle(e.__nowWorld)}}(t,e,s,i)}},strokes:function(t,e,s,i){Uh.stroke(t,e,s,i)},strokeText:function(t,e,s,i){switch(e.__.strokeAlign){case"center":ld(t,1,e,s,i);break;case"inside":dd(t,"inside",e,s,i);break;case"outside":e.__.__fillAfterStroke?ld(t,2,e,s,i):dd(t,"outside",e,s,i)}},drawTextStroke:function(t,e,s){let i,r=t.__.__textDrawData;const{rows:o,decorationY:n}=r;for(let t=0,s=o.length;t<s;t++)i=o[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(n){const{decorationHeight:t}=r;o.forEach(s=>n.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}},drawStrokesStyle:function(t,e,s,i,r,o){let n;const a=i.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(n=t[l],(!n.image||!Nh.checkImage(n,!1,i,r,o))&&n.style){if(h){const{strokeStyle:t}=n;t?r.setStroke(n.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(n.style,a.__strokeWidth*e,a)}else r.strokeStyle=n.style;n.originPaint.blendMode?(r.saveBlendMode(n.originPaint.blendMode),s?Uh.drawTextStroke(i,r,o):r.stroke(),r.restoreBlendMode()):s?Uh.drawTextStroke(i,r,o):r.stroke()}},shape:function(t,e,s){const i=e.getSameCanvas(),r=e.bounds,o=t.__nowWorld,n=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;_d(n.strokeSpread?(ud(md,n.boxBounds,n.strokeSpread),md):n.boxBounds,o,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(a))_=i,h=u=a,l=o;else{let i;if(y.fullImageShadow)i=a;else{const t=n.renderShapeSpread?cd(r,R.swapAndScale(n.renderShapeSpread,p,g)):r;i=yd(t,a)}c=r.getFitMatrix(i);let{a:f,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,s),p*=f,g*=m),u=pd(a,c),h=gd(u,-c.e,-c.f),l=pd(o,c),fd(l,-c.e,-c.f);const x=s.matrix;x?(d=new gt(c),d.multiply(x),f*=x.scaleX,m*=x.scaleY):d=c,d.withScale(f,m),s=Object.assign(Object.assign({},s),{matrix:d})}return t.__renderShape(i,s),{canvas:i,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let kd,Sd=new Vt;const{isSame:Rd}=Yt;function Cd(t,e,s,i,r,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.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||Nh.createData(r,i,s,o),!0}function Td(t,e){Id(t,Mn.LOAD,e)}function Pd(t,e){Id(t,Mn.LOADED,e)}function Ld(t,e,s){e.error=s,t.forceUpdate("surface"),Id(t,Mn.ERROR,e)}function Id(t,e,s){t.hasEvent(e)&&t.emitEvent(new Mn(e,s))}function Ed(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Od,translate:Ad}=$,Md=new Vt,Wd={},Dd={};function Fd(t,e,s,i){const r=o(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let zd={},Ud={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Nd,set:Yd,rotateOfOuter:Xd,translate:Hd,scaleOfOuter:Gd,multiplyParent:Vd,scale:jd,rotate:qd,skew:Qd}=$;function Jd(t,e,s,i,r,o,n,a){n&&qd(t,n),a&&Qd(t,a.x,a.y),r&&jd(t,r,o),Hd(t,e.x+s,e.y+i)}const{get:$d,scale:Zd,copy:Kd}=$,{getFloorScale:tc}=W,{abs:ec}=Math;const sc={image:function(t,e,s,i,r){let o,n;const a=$r.get(s);return kd&&s===kd.paint&&Rd(i,kd.boxBounds)?o=kd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),kd=a.use>1?{leafPaint:o,paint:s,boxBounds:Sd.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Cd(t,e,s,a,o,i),r&&(Td(t,n),Pd(t,n))):a.error?r&&Ld(t,n,a.error):(r&&(Ed(t,!0),Td(t,n)),o.loadId=a.load(()=>{Ed(t,!1),t.destroyed||(Cd(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Pd(t,n)),o.loadId=void 0},e=>{Ed(t,!1),Ld(t,n,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,s,i,r){const{scaleX:o,scaleY:n}=Nh.getImageRenderScaleData(t,s,i,r),{image:a,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===o+"-"+n&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&Yn.isResizing(s)||d||(e=y.image.isLarge(a,o,n))),e?(s.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill()),Nh.drawImage(t,o,n,s,i,r),!0):(!t.style||l.sync||d?Nh.createPattern(t,s,i,r):Nh.createPatternTask(t,s,i,r),!1))},drawImage:function(t,e,s,i,r,o){const{data:n,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=n,c=a.getFull(n.filters),u=i.__;let _,{width:p,height:g}=a;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(i),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(n.scaleX&&(p*=n.scaleX,g*=n.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,s,i){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(s){const{pixelRatio:t}=s;r.scaleX*=t,r.scaleY*=t}return o&&o.scaleX&&(r.scaleX*=Math.abs(o.scaleX),r.scaleY*=Math.abs(o.scaleY)),r},recycleImage:function(t,e){const s=e["_"+t];if(l(s)){let i,r,o,n,a;for(let h=0,d=s.length;h<d;h++)i=s[h],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,$r.recycle(r),r.loading&&(n||(n=e.__input&&e.__input[t]||[],l(n)||(n=[n])),r.unload(s[h].loadId,!n.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,s,i){t.patternTask||(t.patternTask=$r.patternTasker.add(()=>pe(this,void 0,void 0,function*(){t.patternTask=null,s.bounds.hit(e.__nowWorld)&&Nh.createPattern(t,e,s,i),e.forceUpdate("surface")}),300))},createPattern:function(t,e,s,i){let{scaleX:r,scaleY:o}=Nh.getImageRenderScaleData(t,e,s,i),n=r+"-"+o;if(t.patternId!==n&&!e.destroyed&&(!y.image.isLarge(t.image,r,o)||t.data.repeat)){const{image:s,data:i}=t,{transform:a,gap:h}=i,l=Nh.getPatternFixScale(t,r,o);let d,c,u,{width:_,height:p}=s;l&&(r*=l,o*=l),_*=r,p*=o,h&&(c=h.x*r/ec(i.scaleX||1),u=h.y*o/ec(i.scaleY||1)),(a||1!==r||1!==o)&&(r*=tc(_+(c||0)),o*=tc(p+(u||0)),d=$d(),a&&Kd(d,a),Zd(d,1/r,1/o));const g=s.getCanvas(_,p,i.opacity,i.filters,c,u,e.leafer&&e.leafer.config.smooth),f=s.getPattern(g,i.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=n}},getPatternFixScale:function(t,e,s){const{image:i}=t;let r,o=y.image.maxPatternSize,n=i.width*i.height;return i.isSVG?e>1&&(r=Math.ceil(e)/e):o>n&&(o=n),(n*=e*s)>o&&(r=Math.sqrt(o/n)),r},createData:function(t,e,s,i){t.data=Nh.getPatternData(s,i,e)},getPatternData:function(t,e,s){t.padding&&(e=Md.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:i,height:r}=s,{opacity:n,mode:a,align:h,offset:l,scale:c,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,x=e.width===i&&e.height===r,w={mode:a},v="center"!==h&&(_||0)%180==90;let b,B;switch(Yt.set(Dd,0,0,v?r:i,v?i:r),a&&"cover"!==a&&"fit"!==a?((c||u)&&(W.getScaleData(c,u,s,Wd),b=Wd.scaleX,B=Wd.scaleY),(h||y||f)&&(b&&Yt.scale(Dd,b,B,!0),h&&St.toPoint(h,Dd,e,Dd,!0,!0))):x&&!_||(b=B=Yt.getFitScale(e,Dd,"fit"!==a),Yt.put(e,s,h,b,!1,Dd),Yt.scale(Dd,b,B,!0)),l&&ht.move(Dd,l),a){case"stretch":x?b&&(b=B=void 0):(b=e.width/i,B=e.height/r,Nh.stretchMode(w,e,b,B));break;case"normal":case"clip":if(Dd.x||Dd.y||b||g||_||p){let t,s;g&&(t=e.width/g.width,s=e.height/g.height),Nh.clipMode(w,e,Dd.x,Dd.y,b,B,_,p,t,s),t&&(b=b?b*t:t,B=B?B*s:s)}break;case"repeat":(!x||b||_||p)&&Nh.repeatMode(w,e,i,r,Dd.x,Dd.y,b,B,_,p,h,t.freeTransform),f||(w.repeat="repeat");const s=d(f);(y||s)&&(w.gap=function(t,e,s,i,r){let o,n;d(t)?(o=t.x,n=t.y):o=n=t;return{x:Fd(o,s,r.width,e&&e.x),y:Fd(n,i,r.height,e&&e.y)}}(y,s&&f,Dd.width,Dd.height,e));break;default:b&&Nh.fillOrFitMode(w,e,Dd.x,Dd.y,b,B,_)}return w.transform||(e.x||e.y)&&Ad(w.transform=Od(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=B),n&&n<1&&(w.opacity=n),m&&(w.filters=m),f&&(w.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,s,i){const r=Nd(),{x:o,y:n}=e;o||n?Hd(r,o,n):r.onlyScale=!0,jd(r,s,i),t.transform=r},fillOrFitMode:function(t,e,s,i,r,o,n){const a=Nd();Hd(a,e.x+s,e.y+i),jd(a,r,o),n&&Xd(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a},clipMode:function(t,e,s,i,r,o,n,a,h,l){const d=Nd();Jd(d,e,s,i,r,o,n,a),h&&(n||a?(Yd(Ud),Gd(Ud,e,h,l),Vd(d,Ud)):Gd(d,e,h,l)),t.transform=d},repeatMode:function(t,e,s,i,r,o,n,a,h,l,d,c){const u=Nd();if(c)Jd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)Xd(u,{x:s/2,y:i/2},h);else switch(qd(u,h),h){case 90:Hd(u,i,0);break;case 180:Hd(u,s,i);break;case 270:Hd(u,0,s)}zd.x=e.x+r,zd.y=e.y+o,Hd(u,zd.x,zd.y),n&&Gd(u,zd,n,a)}t.transform=u}},{toPoint:ic}=bt,{hasTransparent:rc}=Dh,oc={},nc={};function ac(t,e,s,i){if(s){let r,n,a,h;for(let t=0,l=s.length;t<l;t++)r=s[t],o(r)?(a=t/(l-1),n=Dh.string(r,i)):(a=r.offset,n=Dh.string(r.color,i)),e.addColorStop(a,n),!h&&rc(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:hc,getDistance:lc}=ht,{get:dc,rotateOfOuter:cc,scaleOfOuter:uc}=$,{toPoint:_c}=bt,pc={},gc={};function fc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=hc(e,s);o=dc(),r?(uc(o,e,n/a*(i||1),1),cc(o,e,t+90)):(uc(o,e,1,n/a*(i||1)),cc(o,e,t))}return o}const{getDistance:yc}=ht,{toPoint:mc}=bt,xc={},wc={};const vc={linearGradient:function(t,e){let{from:s,to:i,type:r,opacity:o}=t;ic(s||"top",e,oc),ic(i||"bottom",e,nc);const n=y.canvas.createLinearGradient(oc.x,oc.y,nc.x,nc.y),a={type:r,style:n};return ac(a,n,t.stops,o),a},radialGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;_c(s||"center",e,pc),_c(i||"bottom",e,gc);const a=y.canvas.createRadialGradient(pc.x,pc.y,0,pc.x,pc.y,lc(pc,gc)),h={type:r,style:a};ac(h,a,t.stops,o);const l=fc(e,pc,gc,n,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;mc(s||"center",e,xc),mc(i||"bottom",e,wc);const a=y.conicGradientSupport?y.canvas.createConicGradient(0,xc.x,xc.y):y.canvas.createRadialGradient(xc.x,xc.y,0,xc.x,xc.y,yc(xc,wc)),h={type:r,style:a};ac(h,a,t.stops,o);const l=fc(e,xc,wc,n||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:fc},{copy:bc,move:Bc,toOffsetOutBounds:kc}=Yt,{max:Sc,abs:Rc}=Math,Cc={},Tc=new gt,Pc={};function Lc(t,e){let s,i,r,o,n=0,a=0,h=0,l=0;return e.forEach(t=>{s=t.x||0,i=t.y||0,o=1.5*(t.blur||0),r=Rc(t.spread||0),n=Sc(n,r+o-i),a=Sc(a,r+o+s),h=Sc(h,r+o+i),l=Sc(l,r+o-s)}),n===a&&a===h&&h===l?n:[n,a,h,l]}function Ic(t,e,s){const{shapeBounds:i}=s;let r,o;y.fullImageShadow?(bc(Cc,t.bounds),Bc(Cc,e.x-i.x,e.y-i.y),r=t.bounds,o=Cc):(r=i,o=e),t.copyWorld(s.canvas,r,o)}const{toOffsetOutBounds:Ec}=Yt,Oc={};const Ac=Lc;const Mc={shadow:function(t,e,s){let i,r;const{__nowWorld:o}=t,{shadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=n.length-1;kc(h,Pc,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Pc.offsetX+(n.x||0)*c*f,Pc.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f,Dh.string(n.color)),r=Xh.getShadowTransform(t,_,s,n,Pc,f),r&&_.setTransform(r),Ic(_,Pc,s),r&&_.resetTransform(),i=l,n.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,o,"copy"),i=o),a?_.copyWorld(a,o,o,"destination-out"):_.copyWorld(s.canvas,d,h,"destination-out")),sn.copyCanvasByWorld(t,e,_,i,n.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o}=t,{innerShadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=n.length-1;Ec(h,Oc,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Oc.offsetX+(n.x||0)*c*f,Oc.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f),r=Xh.getShadowTransform(t,_,s,n,Oc,f,!0),r&&_.setTransform(r),Ic(_,Oc,s),_.restore(),a?(_.copyWorld(_,l,o,"copy"),_.copyWorld(a,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,h,"source-out"),i=l),_.fillWorld(i,Dh.string(n.color),"source-in"),sn.copyCanvasByWorld(t,e,_,i,n.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){},getShadowRenderSpread:Lc,getShadowTransform:function(t,e,s,i,r,o,n){if(i.spread){const s=2*i.spread*o*(n?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Tc.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+s/a,1+s/h),Tc}},isTransformShadow(t){},getInnerShadowSpread:Ac},{excludeRenderBounds:Wc}=cn;let Dc;function Fc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":Dc||(Dc=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,o){const n=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,n),o&&i.recycle(n);Uc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":Uc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function zc(t){return t.getSameCanvas(!1,!0)}function Uc(t,e,s,i,r,o){const n=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,n,void 0,r),o?s.recycle(n):s.clearWorld(n)}t.Group.prototype.__renderMask=function(t,e){let s,i,r,o,n,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){n&&(Fc(this,n,t,r,i,o,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||Wc(s,e)||s.__render(t,e),o=s.__.opacity,Dc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=zc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=zc(t)),r||(r=zc(t)),s.__render(i,e));continue}const d=1===o&&s.__.__blendMode;d&&Fc(this,n,t,r,i,o,void 0,!1),Wc(s,e)||s.__render(r||t,e),d&&Fc(this,n,t,r,i,o,d,!1)}Fc(this,n,t,r,i,o,void 0,!0)};const Nc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Yc=Nc+"_#~&*+\\=|≮≯≈≠=…",Xc=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 Hc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Gc=Hc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Vc=Hc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),jc=Hc(Nc),qc=Hc(Yc),Qc=Hc("- —/~|┆·");var Jc;!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"}(Jc||(Jc={}));const{Letter:$c,Single:Zc,Before:Kc,After:tu,Symbol:eu,Break:su}=Jc;function iu(t){return Gc[t]?$c:Qc[t]?su:Vc[t]?Kc:jc[t]?tu:qc[t]?eu:Xc.test(t)?Zc:$c}const ru={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function ou(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:nu}=ru,{Letter:au,Single:hu,Before:lu,After:du,Symbol:cu,Break:uu}=Jc;let _u,pu,gu,fu,yu,mu,xu,wu,vu,bu,Bu,ku,Su,Ru,Cu,Tu,Pu,Lu=[];function Iu(t,e){vu&&!wu&&(wu=vu),_u.data.push({char:t,width:e}),gu+=e}function Eu(){fu+=gu,_u.width=gu,pu.words.push(_u),_u={data:[]},gu=0}function Ou(){Ru&&(Cu.paraNumber++,pu.paraStart=!0,Ru=!1),vu&&(pu.startCharSize=wu,pu.endCharSize=vu,wu=0),pu.width=fu,Tu.width?nu(pu):Pu&&Au(),Lu.push(pu),pu={words:[]},fu=0}function Au(){fu>(Cu.maxWidth||0)&&(Cu.maxWidth=fu)}const{top:Mu,right:Wu,bottom:Du,left:Fu}=t.Direction4;function zu(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const Uu={getDrawData:function(t,e){o(t)||(t=String(t));let s=0,i=0,r=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:a}=e;a&&(r?(s=a[Fu],r-=a[Wu]+a[Fu],!r&&(r=.01)):e.autoSizeAlign||(s=a[Fu]),n?(i=a[Mu],n-=a[Mu]+a[Du],!n&&(n=.01)):e.autoSizeAlign||(i=a[Mu]));const h={bounds:{x:s,y:i,width:r,height:n},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,s){Cu=t,Lu=t.rows,Tu=t.bounds,Pu=!Tu.width&&!s.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:o}=s,{canvas:n}=y,{width:a}=Tu;if(s.__isCharMode){const t="none"!==s.textWrap,h="break"===s.textWrap;Ru=!0,Bu=null,wu=xu=vu=gu=fu=0,_u={data:[]},pu={words:[]},i&&(e=[...e]);for(let s=0,l=e.length;s<l;s++)mu=e[s],"\n"===mu?(gu&&Eu(),pu.paraEnd=!0,Ou(),Ru=!0):(bu=iu(mu),bu===au&&"none"!==o&&(mu=ou(mu,o,!gu)),xu=n.measureText(mu).width,i&&(i<0&&(vu=xu),xu+=i),ku=bu===hu&&(Bu===hu||Bu===au)||Bu===hu&&bu!==du,Su=!(bu!==lu&&bu!==hu||Bu!==cu&&Bu!==du),yu=Ru&&r?a-r:a,t&&a&&fu+gu+xu>yu&&(h?(gu&&Eu(),fu&&Ou()):(Su||(Su=bu===au&&Bu==du),ku||Su||bu===uu||bu===lu||bu===hu||gu+xu>yu?(gu&&Eu(),fu&&Ou()):fu&&Ou()))," "===mu&&!0!==Ru&&fu+gu===0||(bu===uu?(" "===mu&&gu&&Eu(),Iu(mu,xu),Eu()):ku||Su?(gu&&Eu(),Iu(mu,xu)):Iu(mu,xu)),Bu=bu);gu&&Eu(),fu&&Ou(),Lu.length>0&&(Lu[Lu.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Cu.paraNumber++,fu=n.measureText(t).width,Lu.push({x:r||0,text:t,width:fu,paraStart:!0}),Pu&&Au()})}(h,t,e),a&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":zu(e,"x",t[Fu]);break;case"right":zu(e,"x",-t[Wu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":zu(e,"y",t[Mu]);break;case"bottom":zu(e,"y",-t[Du])}}(a,h,e,r,n),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:o,__baseLine:n,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=i,y=o*r+(c?c*(t.paraNumber-1):0),m=n;if(h&&y>f)y=Math.max(f,o),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 x,w,v,b=g||u?g:t.maxWidth;for(let n=0,d=r;n<d;n++){if(x=s[n],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&n>0&&(m+=c),x.y=m,m+=o,t.overflow>n&&m>y&&(x.isOverflow=!0,t.overflow=n+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(h,e),e.__isCharMode&&function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:o,letterSpacing:n}=e,a=s&&r.includes("both"),h=a||s&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,x;i.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,y=t.words.length,h&&(x=!t.paraEnd||a,c=s-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=n||t.isOverflow||l?0:u?1:2,t.isOverflow&&!n&&(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,s)=>{1===g?(f={char:"",x:d},d=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,s,i,r){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,x&&_),x&&(m=s===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,s,i){if(!i)return;const{rows:r,overflow:o}=t;let{textOverflow:n}=e;if(r.splice(o),n&&"show"!==n){let t,a;"hide"===n?n="":"ellipsis"===n&&(n="...");const h=n?y.canvas.measureText(n).width:0,l=s+i-h;("none"===e.textWrap?r:[r[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],a=t.x+t.width,!(i===s&&a<l));i--){if(a<l&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:n,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,s,r),"none"!==e.textDecoration&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:o}=e;switch(t.decorationHeight=r/11,d(o)?(s=o.type,o.color&&(t.decorationColor=Dh.string(o.color)),o.offset&&(i=Math.min(.3*r,Math.max(o.offset,.15*-r)))):s=o,s){case"under":t.decorationY=[.15*r+i];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+i,.35*-r]}}(h,e),h}};const Nu={string:function(t,e){if(!t)return"#000";const s=a(e)&&e<1;if(o(t)){if(!s||!Dh.object)return t;t=Dh.object(t)}let r=i(t.a)?1:t.a;s&&(r*=e);const n=t.r+","+t.g+","+t.b;return 1===r?"rgb("+n+")":"rgba("+n+","+r+")"}};return Object.assign(Wh,Uu),Object.assign(Dh,Nu),Object.assign(Uh,Bd),Object.assign(Nh,sc),Object.assign(Yh,vc),Object.assign(Xh,Mc),yh(),t.AlignHelper=St,t.AroundHelper=bt,t.AutoBounds=qt,t.BezierHelper=rs,t.Bounds=Vt,t.BoundsEvent=Wn,t.BoundsHelper=Yt,t.BoxData=il,t.BranchHelper=gn,t.BranchRender=La,t.CanvasData=fl,t.CanvasManager=ue,t.ChildEvent=In,t.ColorConvert=Dh,t.Creator=oe,t.DataHelper=u,t.Debug=$t,t.Effect=Xh,t.EllipseData=hl,t.EllipseHelper=_s,t.Event=Ln,t.EventCreator=de,t.Eventer=Kn,t.Export=Gh,t.FileHelper=Xr,t.Filter=Hh,t.FourNumberHelper=R,t.FrameData=ol,t.GroupData=sl,t.ImageData=gl,t.ImageEvent=Mn,t.ImageManager=$r,t.IncrementId=x,t.LayoutEvent=Hn,t.Layouter=Lh,t.LeafBounds=Ca,t.LeafBoundsHelper=cn,t.LeafData=p,t.LeafDataProxy=ua,t.LeafEventer=da,t.LeafHelper=sn,t.LeafLayout=Pn,t.LeafLevelList=uh,t.LeafList=ch,t.LeafMatrix=xa,t.LeafRender=Ta,t.LeaferCanvas=ph,t.LeaferCanvasBase=Te,t.LeaferData=rl,t.LeaferEvent=Vn,t.LeaferImage=eo,t.LineData=nl,t.MathHelper=W,t.Matrix=gt,t.MatrixHelper=$,t.MyImage=ed,t.NeedConvertToCanvasCommandMap=Oe,t.OneRadian=F,t.PI2=z,t.PI_2=U,t.Paint=Uh,t.PaintGradient=Yh,t.PaintImage=Nh,t.PathArrow=zh,t.PathBounds=Ir,t.PathCommandDataHelper=vi,t.PathCommandMap=Ie,t.PathCommandNodeHelper=ps,t.PathConvert=Zs,t.PathCorner=Fr,t.PathCreator=Fi,t.PathData=cl,t.PathDrawer=Ki,t.PathHelper=Pe,t.PathNumberCommandLengthMap=De,t.PathNumberCommandMap=We,t.PenData=ul,t.Platform=y,t.Plugin=re,t.Point=_t,t.PointHelper=ht,t.PolygonData=ll,t.PropertyEvent=On,t.RectData=al,t.RectHelper=Fe,t.RectRender=Bl,t.RenderEvent=Gn,t.Renderer=Eh,t.ResizeEvent=Yn,t.Resource=Qr,t.Run=ee,t.StarData=dl,t.State=Vh,t.StringNumberMap=Qt,t.TaskItem=Vr,t.TaskProcessor=jr,t.TextConvert=Wh,t.TextData=pl,t.Transition=jh,t.TwoPointBoundsHelper=yt,t.UIBounds=xl,t.UICreator=ae,t.UIData=tl,t.UIRender=vl,t.UnitConvert=Fh,t.WaitHelper=xn,t.WatchEvent=Xn,t.Watcher=xh,t.affectRenderBoundsType=Bo,t.affectStrokeBoundsType=wo,t.attr=no,t.autoLayoutType=uo,t.boundsType=go,t.canvasPatch=Yr,t.canvasSizeAttrs=Ce,t.createAttr=function(t){return(e,s)=>{so(e,s,ro(s,t))}},t.createDescriptor=ro,t.cursorType=Ao,t.dataProcessor=Mo,t.dataType=ho,t.decorateLeafAttr=oo,t.defineDataProcessor=Wo,t.defineKey=so,t.defineLeafAttr=ao,t.dimType=So,t.doBoundsType=yo,t.doStrokeType=vo,t.effectType=Oh,t.emptyData={},t.eraserType=Eo,t.extraPropertyEventMap=An,t.getBoundsData=Y,t.getDescriptor=io,t.getMatrixData=X,t.getPointData=N,t.hitType=Oo,t.isArray=l,t.isData=function(t){return d(t)&&!l(t)},t.isEmptyData=c,t.isFinite=n,t.isNull=r,t.isNumber=a,t.isObject=d,t.isString=o,t.isUndefined=i,t.layoutProcessor=function(t){return(e,s)=>{so(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=$n,t.maskType=Io,t.naturalBoundsType=fo,t.opacityType=Ro,t.path=zr,t.pathInputType=mo,t.pathType=xo,t.pen=Ur,t.positionType=lo,t.registerUI=Ho,t.registerUIEvent=function(){return t=>{de.register(t)}},t.resizeType=Ah,t.rewrite=Uo,t.rewriteAble=No,t.rotationType=po,t.scaleType=_o,t.scrollType=co,t.sortType=Lo,t.strokeType=bo,t.surfaceType=ko,t.tempBounds=jt,t.tempMatrix=ft,t.tempPoint=pt,t.tryToNumber=function(t){return"string"==typeof t&&h.test(t)?+t:t},t.useCanvas=yh,t.useModule=Xo,t.version="1.11.2",t.visibleType=Co,t.zoomLayerType=Mh,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,s;t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",t.Answer=void 0,(s=t.Answer||(t.Answer={}))[s.No=0]="No",s[s.Yes=1]="Yes",s[s.NoAndSkip=2]="NoAndSkip",s[s.YesAndSkip=3]="YesAndSkip";function i(t){return void 0===t}function r(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:n}=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,s){let i;Object.keys(e).forEach(r=>{var o,n;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return _(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&_(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{i(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{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(!i(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=i(s)?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!i(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(l(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!i(t))){if("path"===o&&!this.__pathInputed)continue;e=r?r[o]:void 0,s[o]=i(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:g,max:f}=Math,y={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,s,i)=>t.width*t.height*(e?e*s:1)>(i||m.maxCacheSize),isSuperLarge:(t,e,s)=>m.isLarge(t,e,s,m.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=y.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,i,r,o,n,a,h){const l=y.origin.createCanvas(f(g(e+(i||0)),1),f(g(s+(r||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==n,o){const i=e/o.width,r=s/o.height;d.setTransform(i,0,0,r,-o.x*i,-o.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,s);return l},setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&u.stintSet(s,"transform",e)}}},{image:m}=y,x={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=x;let v,b,B;const{max:k}=Math,S=[0,0,0,0],R={zero:[...S],tempFour:S,set:(t,e,s,i,r)=>(void 0===s&&(s=i=r=e),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t),setTemp:(t,e,s,i)=>C(S,t,e,s,i),toTempAB(t,e,s){B=s?a(t)?e:t:[],a(t)?(v=T(t),b=e):a(e)?(v=t,b=T(e)):(v=t,b=e),4!==v.length&&(v=P(v)),4!==b.length&&(b=P(b))},get(t,e){let s;if(!a(t))switch(t.length){case 4:s=i(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!i(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,s)=>a(t)&&a(e)?k(t,e):(L(t,e,s),C(B,k(v[0],b[0]),k(v[1],b[1]),k(v[2],b[2]),k(v[3],b[3]))),add:(t,e,s)=>a(t)&&a(e)?t+e:(L(t,e,s),C(B,v[0]+b[0],v[1]+b[1],v[2]+b[2],v[3]+b[3])),swapAndScale(t,e,s,i){if(a(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[o,n,h,l]=4===t.length?t:P(t);return C(r,h*s,l*e,o*s,n*e)}},{set:C,get:P,setTemp:T,toTempAB:L}=R,{round:I,pow:E,max:O,floor:A,PI:M}=Math,W={within:(t,e,s)=>(d(e)&&(s=e.max,e=e.min),!i(e)&&t<e&&(t=e),!i(s)&&t>s&&(t=s),t),fourNumber:R.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=i(e)?1e12:E(10,e);return-0===(t=I(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(a(e)?e:e.width||0)/s.width,r=(a(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&W.assignScale(i,t);return i},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(A(t),e)/t,randInt:D,randColor:t=>`rgba(${D(255)},${D(255)},${D(255)},${t||1})`};function D(t){return Math.round(Math.random()*t)}const F=M/180,z=2*M,U=M/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:G,acos:V,sqrt:j}=Math,{float:q}=W,Q={};function J(){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:J(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:X,getWorld:J,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},pixelScale(t,e,s){s||(s=t),s.a=t.a*e,s.b=t.b*e,s.c=t.c*e,s.d=t.d*e,s.e=t.e*e,s.f=t.f*e},scaleOfOuter(t,e,s,i){Z.toInnerPoint(t,e,Q),Z.scaleOfInner(t,Q,s,i)},scaleOfInner(t,e,s,i=s){Z.translateInner(t,e.x,e.y),Z.scale(t,s,i),Z.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=G(e*=F),a=H(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){Z.toInnerPoint(t,e,Q),Z.rotateOfInner(t,Q,s)},rotateOfInner(t,e,s){Z.translateInner(t,e.x,e.y),Z.rotate(t,s),Z.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=F,t.a=i+o*s,t.b=r+n*s),e&&(e*=F,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){Z.toInnerPoint(t,e,Q),Z.skewOfInner(t,Q,s,i)},skewOfInner(t,e,s,i=0){Z.translateInner(t,e.x,e.y),Z.skew(t,s,i),Z.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,r,o){const{e:n,f:a}=t;if(s||(s=t),i(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:i,b:r,c:n,d:a}=t;s.a=i*e.a+r*e.c,s.b=i*e.b+r*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,o&&(s.scaleX=e.scaleX*o.scaleX,s.scaleY=e.scaleY*o.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,o&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){Z.multiply(t,Z.tempInvert(e))},divideParent(t,e){Z.multiplyParent(t,Z.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Z;return Z.copy(e,t),Z.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,r,o){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(i(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:s,skewX:i,skewY:r}=e,o=s*F,n=G(o),a=H(o);if(i||r){const e=i*F,s=r*F;t.a=(n+s*-a)*h,t.b=(a+s*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(s=s||r)&&Z.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,i){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(o||n){const t=r*a-o*n;if(n&&!i){d=j(r*r+o*o),c=t/d;const e=r/d;u=o>0?V(e):-V(e)}else{c=j(n*n+a*a),d=t/c;const e=n/c;u=U-(a>0?V(-e):-V(e))}const e=q(G(u)),s=H(u);d=q(d),c=q(c),_=e?q((n/c+s)/e/F,9):0,p=e?q((o/d-s)/e/F,9):0,u=q(u/F)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(g+=e.x*r+e.y*n,f+=e.x*o+e.y*a,s||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:o,d:n}=t;r||o?s=(i*n-r*o)/(e=j(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){Z.set(t)}},Z=$,{toInnerPoint:K,toOuterPoint:tt}=$,{sin:et,cos:st,abs:it,sqrt:rt,atan2:ot,min:nt,round:at}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=i(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,s){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=lt.defaultPoint);const i=st(e*=F),r=et(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=lt;return ct(s,t),K(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=lt;return ct(s,t),tt(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=lt;return ct(s,t),lt.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),K(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){K(e,t,s)},toOuterOf(t,e,s){tt(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=it(s-t),o=it(i-e);return rt(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>nt(dt(t,e,s,i),dt(s,i,r,o)),getAngle:(t,e)=>ut(t,e)/F,getRotation:(t,e,s,i)=>(i||(i=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/F),getRadianFrom(t,e,s,r,o,n,a,h){i(a)&&(a=s,h=r);const l=t-s,d=e-r,c=o-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i,r){const o=ut(t,e);return r&&(t=e),i||(e={}),e.x=t.x+st(o)*s,e.y=t.y+et(o)*s,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,s){return ht.scaleOf(this,t,e,s),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,s){return ht.getRotation(this,t,e,s)}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,s,i){return new _t(ht.getDistancePoint(this,t,e,s,i))}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,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return d(t)?$.copy(this,t):$.set(this,t,e,s,i,r,o),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}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,s){return $.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return $.scaleOfInner(this,t,e,s),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,s){return $.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return $.skewOfInner(this,t,e,s),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,s){$.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){$.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return $.setLayout(this,t,e,s),this}getLayout(t,e,s){return $.getLayout(this,t,e,s)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const ft=new gt,yt={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){mt(t,e,s),mt(t,e+i,s+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 xt,wt;t.Direction4=void 0,(xt=t.Direction4||(t.Direction4={}))[xt.top=0]="top",xt[xt.right=1]="right",xt[xt.bottom=2]="bottom",xt[xt.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 vt=[{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}];vt.forEach(t=>t.type="percent");const bt={directionData:vt,tempPoint:{},get:Bt,toPoint(t,e,s,i,r,o){const n=Bt(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(o||(s.x-=r.x,s.y-=r.y),n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),bt.toPoint(t,e,s,!0),s)};function Bt(e){return o(e)?vt[t.Direction9[e]]:e}const{toPoint:kt}=bt,St={toPoint(t,e,s,i,r,o){kt(t,s,i,r,e,o)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Pt,toBounds:Tt}=yt,{toOuterPoint:Lt}=$,{float:It,fourNumber:Et}=W,{floor:Ot,ceil:At}=Math;let Mt,Wt,Dt,Ft;const zt={},Ut={},Nt={},Yt={tempBounds:Nt,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,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,s,i,r){const{x:o,y:n,width:a,height:h}=e;if(l(s)){const e=Et(s);i?Xt.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Xt.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Xt.set(t,o-s,n-s,a+2*s,h+2*s);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Xt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Gt(e,t):e=t,s||(s=t),e.offsetX=Xt.maxX(s),e.offsetY=Xt.maxY(s),Xt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||ht.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){ht.scaleOf(t,e,s,i),t.width*=s,t.height*=i},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,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r,e:o,f:n}=e;i>0?(s.width=t.width*i,s.x=o+t.x*i):(s.width=t.width*-i,s.x=o+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=n+t.y*r):(s.height=t.height*-r,s.y=n+t.y*r-s.height)}else zt.x=t.x,zt.y=t.y,Lt(e,zt,Ut),Ct(Rt,Ut.x,Ut.y),zt.x=t.x+t.width,Lt(e,zt,Ut),Pt(Rt,Ut.x,Ut.y),zt.y=t.y+t.height,Lt(e,zt,Ut),Pt(Rt,Ut.x,Ut.y),zt.x=t.x,Lt(e,zt,Ut),Pt(Rt,Ut.x,Ut.y),Tt(Rt,s)},toInnerOf(t,e,s){s||(s=t),Xt.move(s,-e.e,-e.f),Xt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Xt.getFitScale(t,e));return new gt(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,n){n||(n=e),o(i)&&(i=Xt.getFitScale(t,e,"cover"===i)),Nt.width=r?e.width*=i:e.width*i,Nt.height=r?e.height*=i:e.height*i,St.toPoint(s,Nt,t,n,!0,!0)},getSpread(t,e,s){const i={};return Xt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Xt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Xt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Ot(t.x),t.y=Ot(t.y),t.width=e>t.x?At(t.width+e-t.x):At(t.width),t.height=s>t.y?At(t.height+s-t.y):At(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=It(t.x,e),t.y=It(t.y,e),t.width=It(t.width,e),t.height=It(t.height,e)},add(t,e,s){Mt=t.x+t.width,Wt=t.y+t.height,Dt=e.x,Ft=e.y,s||(Dt+=e.width,Ft+=e.height),Mt=Mt>Dt?Mt:Dt,Wt=Wt>Ft?Wt:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=Wt-t.y},addList(t,e){Xt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Xt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Xt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||Gt(t,r)):Ht(t,r));o&&Xt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Rt,t.x,t.y):Pt(Rt,t.x,t.y)),Tt(Rt,t)},setPoint(t,e){Xt.set(t,e.x,e.y)},addPoint(t,e){Ht(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=ht.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=ht.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Xt.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=Xt.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){if(s&&(e=Xt.tempToOuterOf(e,s)),!Xt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return Mt=i+o,Wt=r+n,Dt=t.x+t.width,Ft=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,Mt=Mt<Dt?Mt:Dt,Wt=Wt<Ft?Wt:Ft,o=Mt-i,n=Wt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Xt.copy(t,Xt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Xt.set(t)}},Xt=Yt,{add:Ht,copy:Gt}=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,s,i){this.set(t,e,s,i)}set(t,e,s,i){return d(t)?Yt.copy(this,t):Yt.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Vt(this)}move(t,e){return Yt.move(this,t,e),this}scale(t,e,s){return Yt.scale(this,t,e,s),this}scaleOf(t,e,s){return Yt.scaleOf(this,t,e,s),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,s){Yt.put(this,t,e,s)}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 jt=new Vt;class qt{constructor(t,e,s,i,r,o){d(t)?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Vt(r,e,o||t.width-r-s,n||t.height-e-i)}}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:Jt}=W;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=Zt(t)}static set exclude(t){this.excludeList=Zt(t)}static drawRepaint(t,e){const s=Jt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===$t.showBounds,r=t.__nowWorld,o=Jt();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),i?e.stroke():e.strokeWorld(r,o)}log(...t){if(Kt.enable){if(Kt.filterList.length&&Kt.filterList.every(t=>t!==this.name))return;if(Kt.excludeList.length&&Kt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Kt.enable&&this.warn(...t)}warn(...t){Kt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Zt(t){return t?o(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const Kt=$t,te=$t.get("RunTime"),ee={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=x.create(x.RUNTIME);return se.currentId=se.idMap[s]=e?performance.now():Date.now(),se.currentName=se.nameMap[s]=t,se.nameToIdMap[t]=s,s},end(t,e){const s=se.idMap[t],i=se.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;se.idMap[t]=se.nameMap[t]=se.nameToIdMap[i]=void 0,te.log(i,r,"ms")},endOfName(t,e){const s=se.nameToIdMap[t];i(s)||se.end(s,e)}},se=ee,ie=[],re={list:{},add(t,...e){this.list[t]=!0,ie.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ie.forEach(t=>re.has(t,!0)));const oe={editor:t=>re.need("editor")},ne=$t.get("UICreator"),ae={list:{},register(t){const{__tag:e}=t.prototype;he[e]&&ne.repeat(e),he[e]=t},get(t,e,s,r,o,n){he[t]||ne.error("not register "+t);const a=new he[t](e);return i(s)||(a.x=s,r&&(a.y=r),o&&(a.width=o),n&&(a.height=n)),a}},{list:he}=ae,le=$t.get("EventCreator"),de={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],o(e)&&(ce[e]&&le.repeat(e),ce[e]=t)})},changeName(t,e){const s=ce[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,ce[e]=s)}},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:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=oe.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function _e(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function pe(t,e,s,i){return new(s||(s=Promise))(function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})}function ge(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const fe=[];function ye(){return(t,e)=>{fe.push(e)}}const me=[];class xe{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,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}_e([ge("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),_e([ge("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),_e([ge("globalAlpha")],xe.prototype,"opacity",void 0),_e([ge()],xe.prototype,"fillStyle",void 0),_e([ge()],xe.prototype,"strokeStyle",void 0),_e([ge("lineWidth")],xe.prototype,"strokeWidth",void 0),_e([ge("lineCap")],xe.prototype,"strokeCap",void 0),_e([ge("lineJoin")],xe.prototype,"strokeJoin",void 0),_e([ge("lineDashOffset")],xe.prototype,"dashOffset",void 0),_e([ge()],xe.prototype,"miterLimit",void 0),_e([ge()],xe.prototype,"shadowBlur",void 0),_e([ge()],xe.prototype,"shadowColor",void 0),_e([ge()],xe.prototype,"shadowOffsetX",void 0),_e([ge()],xe.prototype,"shadowOffsetY",void 0),_e([ge()],xe.prototype,"filter",void 0),_e([ge()],xe.prototype,"font",void 0),_e([ge()],xe.prototype,"fontKerning",void 0),_e([ge()],xe.prototype,"fontStretch",void 0),_e([ge()],xe.prototype,"fontVariantCaps",void 0),_e([ge()],xe.prototype,"textAlign",void 0),_e([ge()],xe.prototype,"textBaseline",void 0),_e([ge()],xe.prototype,"textRendering",void 0),_e([ge()],xe.prototype,"wordSpacing",void 0),_e([ge()],xe.prototype,"letterSpacing",void 0),_e([ge()],xe.prototype,"direction",void 0),_e([ye()],xe.prototype,"setTransform",null),_e([ye()],xe.prototype,"resetTransform",null),_e([ye()],xe.prototype,"getTransform",null),_e([ye()],xe.prototype,"save",null),_e([ye()],xe.prototype,"restore",null),_e([ye()],xe.prototype,"translate",null),_e([ye()],xe.prototype,"scale",null),_e([ye()],xe.prototype,"rotate",null),_e([ye()],xe.prototype,"fill",null),_e([ye()],xe.prototype,"stroke",null),_e([ye()],xe.prototype,"clip",null),_e([ye()],xe.prototype,"fillRect",null),_e([ye()],xe.prototype,"strokeRect",null),_e([ye()],xe.prototype,"clearRect",null),_e([ye()],xe.prototype,"beginPath",null),_e([ye()],xe.prototype,"moveTo",null),_e([ye()],xe.prototype,"lineTo",null),_e([ye()],xe.prototype,"bezierCurveTo",null),_e([ye()],xe.prototype,"quadraticCurveTo",null),_e([ye()],xe.prototype,"closePath",null),_e([ye()],xe.prototype,"arc",null),_e([ye()],xe.prototype,"arcTo",null),_e([ye()],xe.prototype,"ellipse",null),_e([ye()],xe.prototype,"rect",null),_e([ye()],xe.prototype,"roundRect",null),_e([ye()],xe.prototype,"createConicGradient",null),_e([ye()],xe.prototype,"createLinearGradient",null),_e([ye()],xe.prototype,"createPattern",null),_e([ye()],xe.prototype,"createRadialGradient",null),_e([ye()],xe.prototype,"fillText",null),_e([ye()],xe.prototype,"measureText",null),_e([ye()],xe.prototype,"strokeText",null);const{copy:we,multiplyParent:ve,pixelScale:be}=$,{round:Be}=Math,ke=new Vt,Se=new Vt,Re={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Pe extends xe{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=Re),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,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 s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;u.copyAttrs(i,t,Ce),Ce.forEach(t=>i[t]||(i[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&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&ve(t,e,r),be(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=Be(r.e-.5)+.5,r.f=Be(r.f-.5)+.5):(r.e=Be(r.e),r.f=Be(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,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:r,dashPattern:o,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),i(e.dashPattern)||(o=e.dashPattern),i(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=r,this.dashPattern=o,this.dashOffset=n,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=Se):s=ke,this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Yt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o=!0){this.resetTransform(),this.copyWorld(t,e,s,i,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(ke.x,ke.y,ke.width,ke.height),{data:o}=r;for(let t=0,i=o.length;t<i;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));i.putImageData(r,ke.x,ke.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(ke.x,ke.y,ke.width,ke.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(ke.x,ke.y,ke.width,ke.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ke.x,ke.y,ke.width,ke.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ke.x,ke.y,ke.width,ke.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(ke,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(Se,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):oe.canvas(Object.assign({},s));return r.save(),t&&(we(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),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 Te={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Le={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=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},Le),Ee={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},Oe={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},Ae=Object.assign(Object.assign({},Oe),Le),Me=Ie,We={};for(let t in Me)We[Me[t]]=t;const De={};for(let t in Me)De[Me[t]]=Ee[t];const Fe={drawRoundRect(t,e,s,i,r,o){const n=W.fourNumber(o,Math.min(i/2,r/2)),a=e+i,h=s+r;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(a,s,a,h,n[1]):t.lineTo(a,s),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,s,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,s,a,s,n[0]):t.lineTo(e,s)}},{sin:ze,cos:Ue,hypot:Ne,atan2:Ye,ceil:Xe,abs:He,PI:Ge,sqrt:Ve,pow:je}=Math,{setPoint:qe,addPoint:Qe}=yt,{set:Je,toNumberPoints:$e}=ht,{M:Ze,L:Ke,C:ts,Q:es,Z:ss}=Ie,is={},rs={points(t,e,s,i){let r=$e(e);if(t.push(Ze,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-2;s+=2)e=r[s-2],o=r[s-1],n=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=Ve(je(n-e,2)+je(a-o,2)),g=Ve(je(h-n,2)+je(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(es,d,c,n,a):t.push(ts,u,_,d,c,n,a),u=n+g*h,_=a+g*l);i||t.push(es,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Ke,r[e],r[e+1]);i&&t.push(ss)},rect(t,e,s,i,r){Te.creator.path=t,Te.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){Te.creator.path=[],Fe.drawRoundRect(Te.creator,e,s,i,r,o),t.push(...Te.convertToCanvasData(Te.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let g=Ye(u,c),f=Ye(p,_);const y=Ne(c,u),m=Ne(_,p);let x=f-g;if(x<0&&(x+=z),y<1e-12||m<1e-12||x<1e-12||He(x-Ge)<1e-12)return t&&t.push(Ke,i,r),h&&(qe(h,e,s),Qe(h,i,r)),d&&Je(d,e,s),void(l&&Je(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/Ue(x/2),B=i+b*Ue(g+x/2+U*v),k=r+b*ze(g+x/2+U*v);return g-=U*v,f-=U*v,as(t,B,k,a,a,0,g/F,f/F,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>as(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*F,_=ze(u),p=Ue(u);let g=n*F,f=a*F;g>Ge&&(g-=z),f<0&&(f+=z);let y=f-g;y<0?y+=z:y>z&&(y-=z),h&&(y-=z);const m=Xe(He(y/U)),x=y/m,w=ze(x/4),v=8/3*w*w/ze(x/2);f=g+x;let b,B,k,S,R,C,P,T,L=Ue(g),I=ze(g),E=k=p*i*L-_*r*I,O=S=_*i*L+p*r*I,A=e+k,M=s+S;t&&t.push(t.length?Ke:Ze,A,M),l&&qe(l,A,M),c&&Je(c,A,M);for(let o=0;o<m;o++)b=Ue(f),B=ze(f),k=p*i*b-_*r*B,S=_*i*b+p*r*B,R=e+E-v*(p*i*I+_*r*L),C=s+O-v*(_*i*I-p*r*L),P=e+k+v*(p*i*B+_*r*b),T=s+S+v*(_*i*B-p*r*b),t&&t.push(ts,R,C,P,T,e+k,s+S),l&&ns(e+E,s+O,R,C,P,T,e+k,s+S,l,!0),E=k,O=S,L=b,I=B,g=f,f+=x;d&&Je(d,e+k,s+S)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(ts,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){ns(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=s,v=r,b=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=o,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,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):qe(h,t,e),Qe(h,n,a);for(let l=0,c=d.length;l<c;l++)os(d[l],t,e,s,i,r,o,n,a,is),Qe(h,is.x,is.y)},getPointAndSet(t,e,s,i,r,o,n,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*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return os(t,e,s,i,r,o,n,a,h,l),l},getDerivative(t,e,s,i,r){const o=1-t;return 3*o*o*(s-e)+6*o*t*(i-s)+3*t*t*(r-i)}},{getPointAndSet:os,toTwoPointBounds:ns,ellipse:as}=rs,{sin:hs,cos:ls,sqrt:ds,atan2:cs}=Math,{ellipse:us}=rs,_s={ellipticalArc(t,e,s,i,r,o,n,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=o*F,p=hs(_),g=ls(_),f=-g*c-p*u,m=-g*u+p*c,x=i*i,w=r*r,v=m*m,b=f*f,B=x*w-x*v-w*b;let k=0;if(B<0){const t=ds(1-B/(x*w));i*=t,r*=t}else k=(n===a?-1:1)*ds(B/(x*v+w*b));const S=k*i*m/r,R=-k*r*f/i,C=cs((m-R)/r,(f-S)/i),P=cs((-m-R)/r,(-f-S)/i);let T=P-C;0===a&&T>0?T-=z:1===a&&T<0&&(T+=z);const L=e+c+g*S-p*R,I=s+u+p*S+g*R,E=T<0?1:0;d||y.ellipseToCurve?us(t,L,I,i,r,o,C/F,P/F,E):i!==r||o?t.push(Ie.G,L,I,i,r,o,C/F,P/F,E):t.push(Ie.O,L,I,i,C/F,P/F,E)}},ps={toCommand:t=>[],toNode:t=>[]},{M:gs,m:fs,L:ys,l:ms,H:xs,h:ws,V:vs,v:bs,C:Bs,c:ks,S:Ss,s:Rs,Q:Cs,q:Ps,T:Ts,t:Ls,A:Is,a:Es,Z:Os,z:As,N:Ms,D:Ws,X:Ds,G:Fs,F:zs,O:Us,P:Ns,U:Ys}=Ie,{rect:Xs,roundRect:Hs,arcTo:Gs,arc:Vs,ellipse:js,quadraticCurveTo:qs}=rs,{ellipticalArc:Qs}=_s,Js=$t.get("PathConvert"),$s={},Zs={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=De[i],a+=i===r?" ":We[i];for(let i=1;i<s;i++)a+=W.float(t[o+i],e),i===s-1||(a+=" ");r=i,o+=s}return a},parse(t,e){let s,i,r,o="";const n=[],a=e?Ae:Oe;for(let e=0,h=t.length;e<h;e++)i=t[e],Qt[i]?("."===i&&(Ks.dot&&(ti(n,o),o=""),Ks.dot++),"0"===o&&"."!==i&&(ti(n,o),o=""),o+=i):Ie[i]?(o&&(ti(n,o),o=""),Ks.name=Ie[i],Ks.length=Ee[i],Ks.index=0,ti(n,Ks.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&ti(n,o),o=i):o&&(ti(n,o),o=""),r=i;return o&&ti(n,o),s?Zs.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case fs:t[c+1]+=a,t[c+2]+=h;case gs:a=t[c+1],h=t[c+2],_.push(gs,a,h),c+=3;break;case ws:t[c+1]+=a;case xs:a=t[c+1],_.push(ys,a,h),c+=2;break;case bs:t[c+1]+=h;case vs:h=t[c+1],_.push(ys,a,h),c+=2;break;case ms:t[c+1]+=a,t[c+2]+=h;case ys:a=t[c+1],h=t[c+2],_.push(ys,a,h),c+=3;break;case Rs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Ss;case Ss:n=o===Bs||o===Ss,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(Bs,l,d,s,i,a,h),c+=5;break;case ks: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=Bs;case Bs:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(Bs,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Ls:t[c+1]+=a,t[c+2]+=h,r=Ts;case Ts:n=o===Cs||o===Ts,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?qs(_,a,h,s,i,t[c+1],t[c+2]):_.push(Cs,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ps:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Cs;case Cs:s=t[c+1],i=t[c+2],e?qs(_,a,h,s,i,t[c+3],t[c+4]):_.push(Cs,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Es:t[c+6]+=a,t[c+7]+=h;case Is:Qs(_,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 As:case Os:_.push(Os),c++;break;case Ms:a=t[c+1],h=t[c+2],e?Xs(_,a,h,t[c+3],t[c+4]):ei(_,t,c,5),c+=5;break;case Ws:a=t[c+1],h=t[c+2],e?Hs(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ei(_,t,c,9),c+=9;break;case Ds:a=t[c+1],h=t[c+2],e?Hs(_,a,h,t[c+3],t[c+4],t[c+5]):ei(_,t,c,6),c+=6;break;case Fs:js(e?_:ei(_,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,$s),a=$s.x,h=$s.y,c+=9;break;case zs:e?js(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ei(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Us:Vs(e?_:ei(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,$s),a=$s.x,h=$s.y,c+=7;break;case Ns:e?Vs(_,t[c+1],t[c+2],t[c+3],0,360,!1):ei(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ys:Gs(e?_:ei(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,$s),a=$s.x,h=$s.y,c+=6;break;default:return Js.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return ps.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(gs,t.x,t.y);break;case"L":e.push(ys,t.x,t.y);break;case"C":e.push(Bs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Cs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Os)}}),e}},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Ks.index===Ks.length&&(Ks.index=1,t.push(Ks.name)),t.push(Number(e)),Ks.index++,Ks.dot=0}},{current:Ks,pushData:ti,copyData:ei}=Zs,{M:si,L:ii,C:ri,Q:oi,Z:ni,N:ai,D:hi,X:li,G:di,F:ci,O:ui,P:_i,U:pi}=Ie,{getMinDistanceFrom:gi,getRadianFrom:fi}=ht,{tan:yi,min:mi,abs:xi}=Math,wi={},vi={beginPath(t){t.length=0},moveTo(t,e,s){t.push(si,e,s)},lineTo(t,e,s){t.push(ii,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(ri,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(oi,e,s,i,r)},closePath(t){t.push(ni)},rect(t,e,s,i,r){t.push(ai,e,s,i,r)},roundRect(t,e,s,i,r,o){if(a(o))t.push(li,e,s,i,r,o);else{const n=W.fourNumber(o);n?t.push(hi,e,s,i,r,...n):t.push(ai,e,s,i,r)}},ellipse(t,e,s,i,o,n,a,h,l){r(n)?t.push(ci,e,s,i,o):(r(a)&&(a=0),r(h)&&(h=360),t.push(di,e,s,i,o,n,a,h,l?1:0))},arc(t,e,s,i,o,n,a){r(o)?t.push(_i,e,s,i):(r(n)&&(n=360),t.push(ui,e,s,i,o,n,a?1:0))},arcTo(t,e,s,r,o,n,a,h){if(!i(a)){const t=gi(a,h,e,s,r,o);n=mi(n,mi(t/2,t/2*xi(yi(fi(a,h,e,s,r,o)/2))))}t.push(pi,e,s,r,o,n)},drawEllipse(t,e,s,i,o,n,a,h,l){rs.ellipse(null,e,s,i,o,r(n)?0:n,r(a)?0:a,r(h)?360:h,l,null,null,wi),t.push(si,wi.x,wi.y),bi(t,e,s,i,o,n,a,h,l)},drawArc(t,e,s,i,o,n,a){rs.arc(null,e,s,i,r(o)?0:o,r(n)?360:n,a,null,null,wi),t.push(si,wi.x,wi.y),Bi(t,e,s,i,o,n,a)},drawPoints(t,e,s,i){rs.points(t,e,s,i)}},{ellipse:bi,arc:Bi}=vi,{moveTo:ki,lineTo:Si,quadraticCurveTo:Ri,bezierCurveTo:Ci,closePath:Pi,beginPath:Ti,rect:Li,roundRect:Ii,ellipse:Ei,arc:Oi,arcTo:Ai,drawEllipse:Mi,drawArc:Wi,drawPoints:Di}=vi;class Fi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?Te.parse(t):t:[],this}beginPath(){return Ti(this.__path),this.paint(),this}moveTo(t,e){return ki(this.__path,t,e),this.paint(),this}lineTo(t,e){return Si(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return Ci(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return Ri(this.__path,t,e,s,i),this.paint(),this}closePath(){return Pi(this.__path),this.paint(),this}rect(t,e,s,i){return Li(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Ii(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return Ei(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return Oi(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return Ai(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return Mi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return Wi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return Di(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:zi,L:Ui,C:Ni,Q:Yi,Z:Xi,N:Hi,D:Gi,X:Vi,G:ji,F:qi,O:Qi,P:Ji,U:$i}=Ie,Zi=$t.get("PathDrawer"),Ki={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case zi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Ui:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Ni:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Yi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Xi:t.closePath(),i+=1;break;case Hi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Gi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Vi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case ji:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*F,e[i+6]*F,e[i+7]*F,e[i+8]),i+=9;break;case qi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,z,!1),i+=5;break;case Qi:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*F,e[i+5]*F,e[i+6]),i+=7;break;case Ji:t.arc(e[i+1],e[i+2],e[i+3],0,z,!1),i+=4;break;case $i:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Zi.error(`command: ${s} [index:${i}]`,e)}}},{M:tr,L:er,C:sr,Q:ir,Z:rr,N:or,D:nr,X:ar,G:hr,F:lr,O:dr,P:cr,U:ur}=Ie,{toTwoPointBounds:_r,toTwoPointBoundsByQuadraticCurve:pr,arcTo:gr,arc:fr,ellipse:yr}=rs,{addPointBounds:mr,copy:xr,addPoint:wr,setPoint:vr,addBounds:br,toBounds:Br}=yt,kr=$t.get("PathBounds");let Sr,Rr,Cr;const Pr={},Tr={},Lr={},Ir={toBounds(t,e){Ir.toTwoPointBounds(t,Tr),Br(Tr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return vr(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===rr||n===sr||n===ir?vr(e,h,l):vr(e,t[a+1],t[a+2])),n){case tr:case er:h=t[a+1],l=t[a+2],wr(e,h,l),a+=3;break;case sr:r=t[a+5],o=t[a+6],_r(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,Pr),mr(e,Pr),h=r,l=o,a+=7;break;case ir:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],pr(h,l,s,i,r,o,Pr),mr(e,Pr),h=r,l=o,a+=5;break;case rr:a+=1;break;case or:h=t[a+1],l=t[a+2],br(e,h,l,t[a+3],t[a+4]),a+=5;break;case nr:case ar:h=t[a+1],l=t[a+2],br(e,h,l,t[a+3],t[a+4]),a+=n===nr?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],Pr,Lr),0===a?xr(e,Pr):mr(e,Pr),h=Lr.x,l=Lr.y,a+=9;break;case lr:h=t[a+1],l=t[a+2],Rr=t[a+3],Cr=t[a+4],br(e,h-Rr,l-Cr,2*Rr,2*Cr),h+=Rr,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],Pr,Lr),0===a?xr(e,Pr):mr(e,Pr),h=Lr.x,l=Lr.y,a+=7;break;case cr:h=t[a+1],l=t[a+2],Sr=t[a+3],br(e,h-Sr,l-Sr,2*Sr,2*Sr),h+=Sr,a+=4;break;case ur:gr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Pr,Lr),0===a?xr(e,Pr):mr(e,Pr),h=Lr.x,l=Lr.y,a+=6;break;default:return void kr.error(`command: ${n} [index:${a}]`,t)}}},{M:Er,L:Or,Z:Ar}=Ie,{getCenterX:Mr,getCenterY:Wr}=ht,{arcTo:Dr}=vi,Fr={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;n<g;){switch(i=t[n],i){case Er:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===Or?(c=t[n+1],u=t[n+2],f.push(Er,Mr(l,c),Wr(d,u))):f.push(Er,l,d);break;case Or:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case Or:Dr(f,a,h,t[n+1],t[n+2],e,_,p);break;case Ar:Dr(f,a,h,l,d,e,_,p);break;default:f.push(Or,a,h)}_=a,p=h;break;case Ar:r!==Ar&&(Dr(f,l,d,c,u,e,_,p),f.push(Ar)),n+=1;break;default:o=De[i];for(let e=0;e<o;e++)f.push(t[n+e]);n+=o}r=i}return i!==Ar&&(f[1]=l,f[2]=d),f}};function zr(t){return new Fi(t)}const Ur=zr();Te.creator=zr(),Te.parse=Zs.parse,Te.convertToCanvasData=Zs.toCanvasData;const{drawRoundRect:Nr}=Fe;function Yr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Nr(this,t,e,s,i,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 Gr=$t.get("TaskProcessor");class Vr{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.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){Gr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class jr{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&u.assign(this.config,t),this.empty()}add(t,e,s){let r,o,n,h;const l=new Vr(t);return l.parent=this,a(e)?h=e:e&&(o=e.parallel,r=e.start,n=e.time,h=e.delay,s||(s=e.canUse)),n&&(l.time=n),!1===o&&(l.parallel=!1),s&&(l.canUse=s),i(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:s,index:i}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=i+e.parallel;if(r>s.length&&(r=s.length),e.parallel>1)for(let e=i;e<r&&(t=s[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 qr=$t.get("Resource"),Qr={tasker:new jr,map:{},get isComplete(){return Jr.tasker.isComplete},set(t,e){Jr.map[t]&&qr.repeat(t),Jr.map[t]=e},get:t=>Jr.map[t],remove(t){const e=Jr.map[t];e&&(e.destroy&&e.destroy(),delete Jr.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return o(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=oe.image(i)),Jr.set(t,e),e},destroy(){Jr.map={}}},Jr=Qr,$r={maxRecycled:10,recycledList:[],patternTasker:new jr,get(t){let e=Qr.get(t.url);return e||Qr.set(t.url,e=oe.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(y.image.isLarge(t)?t.url&&Qr.remove(t.url):(t.clearLevels(),Zr.recycledList.push(t)))})},recyclePaint(t){Zr.recycle(t.image)},clearRecycled(t){const e=Zr.recycledList;(e.length>Zr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&Qr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Xr.alphaPixelTypes.some(e=>Zr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Xr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Xr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},Zr=$r,{IMAGE:Kr,create:to}=x;class eo{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=to(Kr),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,i(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 s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,s,i,r,o,n){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const a=y.image.resize(this.view,t,e,r,o,void 0,n,s,i);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,s,i){const r=y.canvas.createPattern(t,e);return y.image.setPatternTransform(r,s,i),r}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function so(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function io(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ro(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function oo(t,e){return(s,i)=>ao(s,i,t,e&&e(i))}function no(t){return t}function ao(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};so(t,e,Object.assign(r,i||{})),Wo(t,e,s)}function ho(t){return oo(t)}function lo(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function co(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function uo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),yo(this))}}))}function _o(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function po(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function go(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s,e)&&yo(this)}}))}function fo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(yo(this),this.__.__removeNaturalSize())}}))}function yo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function mo(t){return oo(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),yo(this)}}))}const xo=go;function wo(t,e){return oo(t,t=>({set(s){this.__setAttr(t,s)&&(vo(this),e&&(this.__.__useStroke=!0))}}))}function vo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&yo(t)}const bo=wo;function Bo(t){return oo(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function ko(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function So(t){return oo(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 Ro(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Po(this)}}))}function Co(t){return oo(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>To(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");To(this,t,e,s),this.mask&&Po(this)}}))}function Po(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function To(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||yo(t))}function Lo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Io(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Eo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Oo(t){return oo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Ao(t){return oo(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Mo(t){return(e,s)=>{so(e,"__DataProcessor",{get:()=>t})}}function Wo(t,e,s){const r=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=ro(e,s);if(i(s))a.get=function(){return this[o]};else if("function"==typeof s)a.get=function(){const t=this[o];return null==t?s(this.__leaf):t};else if(d(s)){const t=c(s);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:u.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,_=r;for(;!l&&_;)l=io(_,e),_=_.__proto__;l&&l.set&&(a.set=l.set),r[n]&&(a.set=r[n],delete r[n]),so(r,e,a)}const Do=new $t("rewrite"),Fo=[],zo=["destroy","constructor"];function Uo(t){return(e,s)=>{Fo.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function No(){return t=>{Yo()}}function Yo(t){Fo.length&&(Fo.forEach(e=>{t&&Do.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Fo.length=0)}function Xo(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(zo.includes(i)||e&&e.includes(i)))if(t.prototype){io(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Ho(){return t=>{ae.register(t)}}setTimeout(()=>Yo(!0));const{copy:Go,toInnerPoint:Vo,toOuterPoint:jo,scaleOfOuter:qo,rotateOfOuter:Qo,skewOfOuter:Jo,multiplyParent:$o,divideParent:Zo,getLayout:Ko}=$,tn={},{round:en}=Math,sn={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),nn(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)on(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)an(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&an(t),t.__updateChange()},updateAllChange(t){if(ln(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)hn(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,s,i,r,o){i||(i=t.__nowWorld),t.__worldFlipped||y.fullImageShadow?e.copyWorldByReset(s,i,t.__nowWorld,r,o):e.copyWorldToInner(s,i,t.__layout.renderBounds,r)},moveWorld(t,e,s=0,i,r){const o=d(e)?Object.assign({},e):{x:e,y:s};i?jo(t.localTransform,o,o,!0):t.parent&&Vo(t.parent.scrollWorldTransform,o,o,!0),rn.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){d(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=en(e),s=en(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){rn.zoomOfLocal(t,dn(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const n=t.__localMatrix;if(a(i)||(i&&(o=i),i=s),Go(tn,n),qo(tn,e,s,i),rn.hasHighPosition(t))rn.setTransform(t,tn,r,o);else{const e=t.x+tn.e-n.e,a=t.y+tn.f-n.f;o&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){rn.rotateOfLocal(t,dn(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Go(tn,r),Qo(tn,e,s),rn.hasHighPosition(t)?rn.setTransform(t,tn,!1,i):t.set({x:t.x+tn.e-r.e,y:t.y+tn.f-r.f,rotation:W.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){rn.skewOfLocal(t,dn(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Go(tn,t.__localMatrix),Jo(tn,e,s,i),rn.setTransform(t,tn,r,o)},transformWorld(t,e,s,i){Go(tn,t.worldTransform),$o(tn,e),t.parent&&Zo(tn,t.parent.scrollWorldTransform),rn.setTransform(t,tn,s,i)},transform(t,e,s,i){Go(tn,t.localTransform),$o(tn,e),rn.setTransform(t,tn,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&rn.getInnerOrigin(t,r.origin),n=Ko(e,o,r.around&&rn.getInnerOrigin(t,r.around));if(rn.hasOffset(t)&&(n.x-=r.offsetX,n.y-=r.offsetY),s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){Yt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=rn.getInnerOrigin(t,r.origin);ht.move(n,o.x-i.x,o.y-i.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return qo(s,rn.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>ht.tempToOuterOf(rn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return bt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Go(tn,t.worldTransform),Zo(tn,e.scrollWorldTransform),s?tn:Object.assign({},tn)),drop(t,e,s,i){t.setTransform(rn.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||rn.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,s=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const i=e.x*s,r=e.y*s;e.x-=i,e.y-=r,t.move(i,r),y.requestRender(()=>rn.animateMove(t,e,s))}}},rn=sn,{updateAllMatrix:on,updateMatrix:nn,updateAllWorldOpacity:an,updateAllChange:hn,updateChange:ln}=rn;function dn(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const cn={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)=>_n(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>_n(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>_n(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 un;function _n(t,e){return e||(un=0),t.__.mask&&(un=1),un<0?null:(un&&(un=-1),!0)}const{updateBounds:pn}=sn,gn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),fn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&i(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)yn(e[t],e)},updateBounds(t,e){const s=[t];yn(t,s),mn(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)pn(i[t]);e&&e===s||pn(s)}},move(t,e,s){let i;const{children:r}=t;for(let o=0,n=r.length;o<n;o++)i=(t=r[o]).__world,i.e+=e,i.f+=s,i.x+=e,i.y+=s,t.isBranch&&xn(t,e,s)},scale(t,e,s,i,r,o,n){let a;const{children:h}=t,l=i-1,d=r-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=i,a.d*=r,(a.b||a.c)&&(a.b*=i,a.c*=r),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-o)*l+e,a.y=a.f+=(a.f-n)*d+s):(a.e+=(a.e-o)*l+e,a.f+=(a.f-n)*d+s,a.x+=(a.x-o)*l+e,a.y+=(a.y-n)*d+s),a.width*=i,a.height*=r,a.scaleX*=i,a.scaleY*=r,t.isBranch&&wn(t,e,s,i,r,o,n)}},{pushAllChildBranch:fn,pushAllBranchStack:yn,updateBoundsByBranchStack:mn,move:xn,scale:wn}=gn,vn={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:bn,updateBounds:Bn}=sn,{toOuterOf:kn,getPoints:Sn,copy:Rn}=Yt,Cn="_localContentBounds",Pn="_worldContentBounds",Tn="_worldBoxBounds",Ln="_worldStrokeBounds";class In{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 kn(this.contentBounds,this.leaf.__localMatrix,this[Cn]||(this[Cn]={})),this[Cn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return kn(this.contentBounds,this.leaf.__world,this[Pn]||(this[Pn]={})),this[Pn]}get worldBoxBounds(){return kn(this.boxBounds,this.leaf.__world,this[Tn]||(this[Tn]={})),this[Tn]}get worldStrokeBounds(){return kn(this.strokeBounds,this.leaf.__world,this[Ln]||(this[Ln]={})),this[Ln]}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 Bn(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 s=e;if(s.__fullLayouting)return;s.__fullLayouting=!0,y.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return $.defaultMatrix;case"page":t=e.zoomLayer;default:return bn(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",s){const{leaf:i}=this;let r,o,n,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),o=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,o=$.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=bn(i,e,!0)}if(n||(n=$.getLayout(o)),Rn(n,a),ht.copy(n,r),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(n.scaleX/=s,n.scaleY/=i,n.width*=s,n.height*=i)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=Sn(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:o=e}return i(o)||r.forEach(t=>s.innerToWorld(t,null,!1,o)),r}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}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 En{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 On extends En{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}On.ADD="child.add",On.REMOVE="child.remove",On.CREATED="created",On.MOUNTED="mounted",On.UNMOUNTED="unmounted",On.DESTROY="destroy";const An="property.scroll";class Mn extends En{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}Mn.CHANGE="property.change",Mn.LEAFER_CHANGE="property.leafer_change",Mn.SCROLL=An;const Wn={scrollX:An,scrollY:An};class Dn extends En{constructor(t,e){super(t),Object.assign(this,e)}}Dn.LOAD="image.load",Dn.LOADED="image.loaded",Dn.ERROR="image.error";class Fn extends En{static checkHas(t,e,s){"on"===s?e===Yn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(zn)||t.hasEvent(Un)||t.hasEvent(Nn),t.__hasWorldEvent=t.hasEvent(Yn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(zn,t),"inner"===e&&t.emit(Un,t)),t.emit(Nn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Yn,this)}}Fn.RESIZE="bounds.resize",Fn.INNER="bounds.inner",Fn.LOCAL="bounds.local",Fn.WORLD="bounds.world";const{RESIZE:zn,INNER:Un,LOCAL:Nn,WORLD:Yn}=Fn,Xn={};[zn,Un,Nn,Yn].forEach(t=>Xn[t]=1);class Hn extends En{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(Hn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!i(this.resizingKeys[t.innerId])}}Hn.RESIZE="resize";class Gn extends En{constructor(t,e){super(t),this.data=e}}Gn.REQUEST="watch.request",Gn.DATA="watch.data";class Vn extends En{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Vn.REQUEST="layout.request",Vn.START="layout.start",Vn.BEFORE="layout.before",Vn.LAYOUT="layout",Vn.AFTER="layout.after",Vn.AGAIN="layout.again",Vn.END="layout.end";class jn extends En{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}jn.REQUEST="render.request",jn.CHILD_START="render.child_start",jn.CHILD_END="render.child_end",jn.START="render.start",jn.BEFORE="render.before",jn.RENDER="render",jn.AFTER="render.after",jn.AGAIN="render.again",jn.END="render.end",jn.NEXT="render.next";class qn extends En{}qn.START="leafer.start",qn.BEFORE_READY="leafer.before_ready",qn.READY="leafer.ready",qn.AFTER_READY="leafer.after_ready",qn.VIEW_READY="leafer.view_ready",qn.VIEW_COMPLETED="leafer.view_completed",qn.STOP="leafer.stop",qn.RESTART="leafer.restart",qn.END="leafer.end",qn.UPDATE_MODE="leafer.update_mode",qn.TRANSFORM="leafer.transform",qn.MOVE="leafer.move",qn.SCALE="leafer.scale",qn.ROTATE="leafer.rotate",qn.SKEW="leafer.skew";const{MOVE:Qn,SCALE:Jn,ROTATE:$n,SKEW:Zn}=qn,Kn={x:Qn,y:Qn,scaleX:Jn,scaleY:Jn,rotation:$n,skewX:Zn,skewY:Zn},ta={};class ea{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)l(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,n;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const a=sa(this,i,!0),h=o(t)?t.split(" "):t,d=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=a[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(d):a[t]=[d],Xn[t]&&Fn.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=o(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=sa(this,t);i.forEach(t=>{t&&(r=n[t],r&&(o=r.findIndex(t=>t.listener===e),o>-1&&r.splice(o,1),r.length||delete n[t],Xn[t]&&Fn.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):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:i}}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,s,i){if(!e)return l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&de.has(t)&&(e=de.get(t,{type:t,target:this,current:this}));const i=sa(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&!((r=i[o])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,o=s&&s[t],n=r&&r[t];return!!(i(e)?o||n:e?n:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function sa(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:ta)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:ta)}}const{on:ia,on_:ra,off:oa,off_:na,once:aa,emit:ha,emitEvent:la,hasEvent:da,destroy:ca}=ea.prototype,ua={on:ia,on_:ra,off:oa,off_:na,once:aa,emit:ha,emitEvent:la,hasEvent:da,destroyEventer:ca},_a=$t.get("setAttr"),pa={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!s||n(e)||i(e)||(_a.warn(this.innerName,t,e),e=void 0),d(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Mn(Mn.LEAFER_CHANGE,this,t,r,e));const s=Kn[t];s&&(this.emitEvent(new qn(s,this)),this.emitEvent(new qn(qn.TRANSFORM,this)))}this.emitPropertyEvent(Mn.CHANGE,t,r,e);const s=Wn[t];return s&&this.emitPropertyEvent(s,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new Mn(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||i(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ga,multiplyParent:fa,translateInner:ya,defaultWorld:ma}=$,{toPoint:xa,tempPoint:wa}=bt,va={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;fa(this.__local||e,t?t.__scrollWorld||t.__world:ma,s,!!e.affectScaleOrRotation,r),i&&ya(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ga(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(xa(s.around||s.origin,t.boxBounds,wa),ya(e,-wa.x,-wa.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ba,updateAllMatrix:Ba}=sn,{updateBounds:ka}=gn,{toOuterOf:Sa,copyAndSpread:Ra,copy:Ca}=Yt,{toBounds:Pa}=Ir,Ta={__updateWorldBounds(){const{__layout:t,__world:e}=this;Sa(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Fn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Fn.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(),Sa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Sa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Sa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?Pa(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Ba(this),ka(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ba(this),ka(this,this))):ba(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ra(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;a(s)&&s<=0?Ca(e.renderBounds,e.strokeBounds):Ra(e.renderBounds,e.boxBounds,s)}},La={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const s=this.__;if(s.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),sn.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.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:Ia}=cn,Ea={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ia(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ia(s[i],e)||s[i].__clip(t,e)}}},Oa={},{LEAF:Aa,create:Ma}=x,{stintSet:Wa}=u,{toInnerPoint:Da,toOuterPoint:Fa,multiplyParent:za}=$,{toOuterOf:Ua}=Yt,{copy:Na,move:Ya}=ht,{moveLocal:Xa,zoomOfLocal:Ha,rotateOfLocal:Ga,skewOfLocal:Va,moveWorld:ja,zoomOfWorld:qa,rotateOfWorld:Qa,skewOfWorld:Ja,transform:$a,transformWorld:Za,setTransform:Ka,getFlipTransform:th,getLocalOrigin:eh,getRelativeWorld:sh,drop:ih}=sn;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 In}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=Ma(Aa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(On.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(On.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(On.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(On.MOUNTED)):this.__emitLifeEvent(On.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){i(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=i(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return za(s,t.matrix,e,void 0,s),Ua(this.__layout.renderBounds,e,e),Wa(e,"half",s.half),Wa(e,"ignorePixelSnap",s.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:s,scaleY:i}=$r.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),Oa.scaleX=s,Oa.scaleY=i,Oa}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?sh(this,e):this.worldTransform,r=s?t:{};return Ua(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Na(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Na(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Da(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){Fa(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Ya(r,-o,-n),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Ya(r,o,n),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){Ka(this,t,e,s)}transform(t,e,s){$a(this,t,e,s)}move(t,e,s){Xa(this,t,e,s)}moveInner(t,e,s){ja(this,t,e,!0,s)}scaleOf(t,e,s,i,r){Ha(this,eh(this,t),e,s,i,r)}rotateOf(t,e,s){Ga(this,eh(this,t),e,s)}skewOf(t,e,s,i,r){Va(this,eh(this,t),e,s,i,r)}transformWorld(t,e,s){Za(this,t,e,s)}moveWorld(t,e,s){ja(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){qa(this,t,e,s,i,r)}rotateOfWorld(t,e){Qa(this,t,e)}skewOfWorld(t,e,s,i,r){Ja(this,t,e,s,i,r)}flip(t,e){$a(this,th(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return 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,s){ih(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):Wo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=go),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new On(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(On.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=_e([Xo(pa),Xo(va),Xo(Ta),Xo(ua),Xo(La)],t.Leaf);const{setListWithFn:rh}=Yt,{sort:oh}=gn,{localBoxBounds:nh,localStrokeBounds:ah,localRenderBounds:hh,maskLocalBoxBounds:lh,maskLocalStrokeBounds:dh,maskLocalRenderBounds:ch}=cn,uh=new $t("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){rh(e||this.__layout.boxBounds,this.children,this.__hasMask?lh:nh)}__updateStrokeBounds(t){rh(t||this.__layout.strokeBounds,this.children,this.__hasMask?dh:ah)}__updateRenderBounds(t){rh(t||this.__layout.renderBounds,this.children,this.__hasMask?ch:hh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(oh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return uh.warn("add self or destroyed");const s=i(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),s||e++});t=ae.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(On.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(On.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)):i(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(On.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(On.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new On(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=_e([Xo(Ea)],t.Branch);class _h{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!i(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return i(e)?-1:e}add(t){const{list:e,keys:s}=this;i(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(i(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,o=e.length;r<o;r++)i(s)?e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;i(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new _h;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class ph{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!i(this.keys[t.innerId])}without(t){return i(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const gh=$t.get("LeaferCanvas");class fh extends Pe{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:s}=this;if(e&&s){const i=s.children[t];i?(this.setAbsolute(i),s.insertBefore(e,i)):s.appendChild(i)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:s}=this.view;if(s.display||(s.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}y.syncDomFont&&!this.parentView&&(s.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=o(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:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;t.hasChildNodes()&&(this.setAbsolute(s),t.style.position||(t.style.position="relative")),t.appendChild(s)}else gh.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:s}=this,{style:r}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:s}=this;t.width?(i(e)&&(this.autoWidthStr=r.width||""),r.width=t.width+"px"):i(e)||(r.width=e),t.height?(i(s)&&(this.autoHeightStr=r.height||""),r.height=t.height+"px"):i(s)||(r.height=s)}else r.width=t+"px",r.height=e+"px",this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}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),gh.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:s}=this;this.emitResize({width:e,height:s,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:o}=this.autoBounds.getBoundsFrom(t),n={width:r,height:o,pixelRatio:this.config.pixelRatio?this.pixelRatio:y.devicePixelRatio};if(!this.isSameSize(n)){const{style:t}=e;t.marginLeft=s+"px",t.marginTop=i+"px",this.emitResize(n)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};u.copyAttrs(e,this,Ce),this.resize(t),this.resizeListener&&!i(this.width)&&this.resizeListener(new Hn(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:yh,fileType:mh}=Xr;function xh(t,e){y.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>{const i=yh(e),r=t.toDataURL(i,s);return"image/bmp"===i?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,s)=>new Promise(i=>t.toBlob(i,yh(e),s)),canvasSaveAs:(t,e,s)=>{const i=t.toDataURL(yh(mh(e)),s);return y.origin.download(i,e)},download:(t,e)=>new Promise(s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()}),loadImage:t=>new Promise((e,s)=>{const i=new y.origin.Image,{crossOrigin:r}=y.image;r&&(i.setAttribute("crossOrigin",r),i.crossOrigin=r),i.onload=()=>{e(i)},i.onerror=t=>{s(t)},i.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=oe.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(oe,{canvas:(t,e)=>new fh(t,e),image:t=>new eo(t)}),y.name="web",y.isMobile="ontouchstart"in window,y.requestRender=function(t){window.requestAnimationFrame(t)},so(y,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:wh}=navigator;wh.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),wh.indexOf("Windows")>-1?(y.os="Windows",y.intWheelDeltaY=!0):wh.indexOf("Mac")>-1?y.os="Mac":wh.indexOf("Linux")>-1&&(y.os="Linux");class vh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new _h;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 _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}update(){this.changed=!0,this.running&&this.target.emit(jn.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===On.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,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Gn(Gn.DATA,{updatedList:this.updatedList})),this.__updatedList=new _h,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Mn.CHANGE,this.__onAttrChange,this],[[On.ADD,On.REMOVE],this.__onChildEvent,this],[Gn.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:bh,updateBounds:Bh,updateChange:kh}=sn,{pushAllChildBranch:Sh,pushAllParent:Rh}=gn;const{worldBounds:Ch}=cn;class Ph{constructor(t){this.updatedBounds=new Vt,this.beforeBounds=new Vt,this.afterBounds=new Vt,l(t)&&(t=new _h(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ch)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ch),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:Lh}=sn,Ih=$t.get("Layouter");class Eh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new ph,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(Vn.START),this.layoutOnce(),t.emitEvent(new Vn(Vn.END,this.layoutedBlocks,this.times))}catch(t){Ih.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ih.warn("layouting"):this.times>3?Ih.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Gn.REQUEST),this.totalTimes>1&&this.config.usePartLayout?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:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Vn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new Vn(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(bh(t,!0),e.add(t),t.isBranch&&Sh(t,e),Rh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Rh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||Bh(i[t])}Bh(s)}})}(this.__levelList),function(t){t.list.forEach(kh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new Vn(o,a,this.times)),s.emitEvent(new Vn(n,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:s,LAYOUT:i,AFTER:r}=Vn,o=this.getBlocks(new _h(e));e.emitEvent(new Vn(s,o,this.times)),Eh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Vn(i,o,this.times)),e.emitEvent(new Vn(r,o,this.times)),this.addBlocks(o),ee.end(t)}static fullLayout(t){Th(t,!0),t.isBranch?gn.updateBounds(t):sn.updateBounds(t),Lh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Ph([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new Ph(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_([[Vn.REQUEST,this.layout,this],[Vn.AGAIN,this.layoutAgain,this],[Gn.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 Ah{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=u.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(Vn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(jn.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(jn.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(jn.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(jn.START),this.renderOnce(t),this.emitRender(jn.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(jn.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(jn.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(jn.RENDER,this.renderBounds,this.renderOptions),this.emitRender(jn.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:s}=this,i=t.getIntersect(s.bounds),r=new Vt(i);s.save(),i.spread(Ah.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.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:s,target:i}=this,r=t.includes(i.__world),o=r?{includes:r}:{bounds:t,includes:r};this.needFill&&s.fillWorld(t,this.config.fill),$t.showRepaint&&$t.drawRepaint(s,t),this.config.useCellRender&&(o.cellList=this.getCellList()),y.render(i,s,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}getCellList(){}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:s}=this.config;if(s&&t>s)return y.requestRender(e);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Vt(0,0,e,s).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,s){this.target.emitEvent(new jn(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[jn.REQUEST,this.update,this],[Vn.END,this.__onLayoutEnd,this],[jn.AGAIN,this.renderAgain,this],[Hn.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function Mh(t){return oo(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Wh(t){return oo(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Dh(){return(t,e)=>{const s="_"+e;so(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}Ah.clipSpread=10,Object.assign(oe,{watcher:(t,e)=>new vh(t,e),layouter:(t,e)=>new Eh(t,e),renderer:(t,e,s)=>new Ah(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),y.layout=Eh.fullLayout,y.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new _h,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Fh={},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}},Uh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Nh={},Yh={},Xh={},Hh={},Gh={},Vh={apply(){re.need("filter")}},jh={},qh={setStyleName:()=>re.need("state"),set:()=>re.need("state")},Qh={list:{},register(t,e){Qh.list[t]=e},get:t=>Qh.list[t]},{parse:Jh,objectToCanvasData:$h}=Zs,{stintSet:Zh}=u,{hasTransparent:Kh}=zh,tl={originPaint:{}},el=$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,el.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,el.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(Zh(this,"__isTransparentFill",Kh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(Zh(this,"__isTransparentStroke",Kh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=o(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?Jh(t):$h(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){il(this,"shadow",t)}setInnerShadow(t){il(this,"innerShadow",t)}setFilter(t){il(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Yh.compute("fill",this.__leaf),e&&Yh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),i(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=tl)):(this.__isStrokes=!0,this._stroke||(this._stroke=tl))}__removePaint(t,e){e&&this.__removeInput(t),Xh.recycleImage(t,this),"fill"===t?(Zh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Zh(this,"__isAlphaPixelStroke",void 0),Zh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function il(t,e,s){t.__setInput(e,s),l(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class rl extends sl{}class ol extends rl{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 nl extends rl{__getInputData(t,e){const s=super.__getInputData(t,e);return Ce.forEach(t=>delete s[t]),s}}class al extends ol{}class hl extends sl{get __usePathBox(){return this.points||this.__pathInputed}}class ll extends sl{get __boxStroke(){return!this.__pathInputed}}class dl extends sl{get __boxStroke(){return!this.__pathInputed}}class cl extends hl{}class ul extends sl{}class _l extends sl{get __pathInputed(){return 2}}class pl extends rl{}const gl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class fl extends sl{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=gl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=ae.get("Rect",0);const r=e.__layout,o=s.__layout;i||(s.parent=e,s.__world=e.__world,o.boxBounds=r.boxBounds),s.set(t),o.strokeChanged&&r.strokeChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}__getInputData(t,e){const s=super.__getInputData(t,e);return s.textEditing&&delete s.textEditing,s}}class yl extends ll{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 s=super.__getInputData(t,e);return s.url&&delete s.fill,s}}class ml extends ll{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const{max:xl,add:wl}=R,vl={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,o=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=xl(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:o,renderSpread:n}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Gh.getShadowRenderSpread(this,e)),i&&(t=xl(t,i)),o&&(t=wl(t,Vh.getSpread(o))),n&&(t=wl(t,n)),a&&(t=wl(t,a));let l=t;return s&&(l=xl(l,Gh.getInnerShadowSpread(this,s))),r&&(l=xl(l,r)),this.__layout.renderShapeSpread=l,h?xl(h.__updateRenderSpread(),t):t}},{stintSet:bl}=u,Bl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);bl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),bl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;bl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Gh.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(l(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),bl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){kl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:o,__drawAfterFill:n,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=Yh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Gh.shadow(this,t,h),a&&(i.__isStrokes?Yh.strokes(o,this,t,e):Yh.stroke(o,this,t,e)),r&&(i.__isFills?Yh.fills(r,this,t,e):Yh.fill(r,this,t,e)),n&&this.__drawAfterFill(t,e),d&&Gh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?Yh.strokes(o,this,t,e):Yh.stroke(o,this,t,e)),c&&Vh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Yh.strokes(o,this,t,e):Yh.stroke(o,this,t,e)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,zh.string(e.color))}r&&(i.__isFills?Yh.fills(r,this,t,e):Yh.fill(r,this,t,e)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?Yh.strokes(o,this,t,e):Yh.stroke(o,this,t,e))}}else i.__pathInputed?kl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?Yh.fills(i,this,t,e):Yh.fill("#000000",this,t,e)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Yh.strokes(r,this,t,e):Yh.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 kl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&Yh.stroke(r,t,e,s),i&&Yh.fill(i,t,e,s),o&&t.__drawAfterFill(e,s),r&&!n&&Yh.stroke(r,t,e,s)}const Sl={__drawFast(t,e){let{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;const{fill:n,stroke:a,__drawAfterFill:h}=this.__;if(n&&(t.fillStyle=n,t.fillRect(s,i,r,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:n,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(n){case"center":t.strokeRect(0,0,r,o);break;case"inside":r-=h,o-=h,r<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,o),t.restore()):t.strokeRect(s+l,i+l,r,o);break;case"outside":t.strokeRect(s-l,i-l,r+h,o+h)}}}};var Rl,Cl;t.UI=Rl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.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 o(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 s=e?this.__.__pathForRender:this.__.path;return s||(Ur.set(s=[]),this.__drawPathByBox(Ur)),t?Zs.toCanvasData(s,!0):s}getPathString(t,e,s){return Zs.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||jh.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&&Nh.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?Ki.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,s,i,r,a(o)?[o]:o)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e,s){Yh.fill(this.__.placeholderColor,this,e,s)}animate(t,e,s,i){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),Rl.one(e)}static one(t,e,s,i,r){return ae.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Ho()(this)}static registerData(t){Mo(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([Mo(sl)],t.UI.prototype,"__",void 0),_e([Dh()],t.UI.prototype,"zoomLayer",void 0),_e([ho("")],t.UI.prototype,"id",void 0),_e([ho("")],t.UI.prototype,"name",void 0),_e([ho("")],t.UI.prototype,"className",void 0),_e([ko("pass-through")],t.UI.prototype,"blendMode",void 0),_e([Ro(1)],t.UI.prototype,"opacity",void 0),_e([Co(!0)],t.UI.prototype,"visible",void 0),_e([ko(!1)],t.UI.prototype,"locked",void 0),_e([So(!1)],t.UI.prototype,"dim",void 0),_e([So(!1)],t.UI.prototype,"dimskip",void 0),_e([Lo(0)],t.UI.prototype,"zIndex",void 0),_e([Io(!1)],t.UI.prototype,"mask",void 0),_e([Eo(!1)],t.UI.prototype,"eraser",void 0),_e([lo(0,!0)],t.UI.prototype,"x",void 0),_e([lo(0,!0)],t.UI.prototype,"y",void 0),_e([go(100,!0)],t.UI.prototype,"width",void 0),_e([go(100,!0)],t.UI.prototype,"height",void 0),_e([_o(1,!0)],t.UI.prototype,"scaleX",void 0),_e([_o(1,!0)],t.UI.prototype,"scaleY",void 0),_e([po(0,!0)],t.UI.prototype,"rotation",void 0),_e([po(0,!0)],t.UI.prototype,"skewX",void 0),_e([po(0,!0)],t.UI.prototype,"skewY",void 0),_e([lo(0,!0)],t.UI.prototype,"offsetX",void 0),_e([lo(0,!0)],t.UI.prototype,"offsetY",void 0),_e([co(0,!0)],t.UI.prototype,"scrollX",void 0),_e([co(0,!0)],t.UI.prototype,"scrollY",void 0),_e([uo()],t.UI.prototype,"origin",void 0),_e([uo()],t.UI.prototype,"around",void 0),_e([ho(!1)],t.UI.prototype,"lazy",void 0),_e([fo(1)],t.UI.prototype,"pixelRatio",void 0),_e([Bo(0)],t.UI.prototype,"renderSpread",void 0),_e([mo()],t.UI.prototype,"path",void 0),_e([xo()],t.UI.prototype,"windingRule",void 0),_e([xo(!0)],t.UI.prototype,"closed",void 0),_e([go(0)],t.UI.prototype,"padding",void 0),_e([go(!1)],t.UI.prototype,"lockRatio",void 0),_e([go()],t.UI.prototype,"widthRange",void 0),_e([go()],t.UI.prototype,"heightRange",void 0),_e([ho(!1)],t.UI.prototype,"draggable",void 0),_e([ho()],t.UI.prototype,"dragBounds",void 0),_e([ho("auto")],t.UI.prototype,"dragBoundsType",void 0),_e([ho(!1)],t.UI.prototype,"editable",void 0),_e([Oo(!0)],t.UI.prototype,"hittable",void 0),_e([Oo("path")],t.UI.prototype,"hitFill",void 0),_e([bo("path")],t.UI.prototype,"hitStroke",void 0),_e([Oo(!1)],t.UI.prototype,"hitBox",void 0),_e([Oo(!0)],t.UI.prototype,"hitChildren",void 0),_e([Oo(!0)],t.UI.prototype,"hitSelf",void 0),_e([Oo()],t.UI.prototype,"hitRadius",void 0),_e([Ao("")],t.UI.prototype,"cursor",void 0),_e([ko()],t.UI.prototype,"fill",void 0),_e([bo(void 0,!0)],t.UI.prototype,"stroke",void 0),_e([bo("inside")],t.UI.prototype,"strokeAlign",void 0),_e([bo(1,!0)],t.UI.prototype,"strokeWidth",void 0),_e([bo(!1)],t.UI.prototype,"strokeWidthFixed",void 0),_e([bo("none")],t.UI.prototype,"strokeCap",void 0),_e([bo("miter")],t.UI.prototype,"strokeJoin",void 0),_e([bo()],t.UI.prototype,"dashPattern",void 0),_e([bo(0)],t.UI.prototype,"dashOffset",void 0),_e([bo(10)],t.UI.prototype,"miterLimit",void 0),_e([xo(0)],t.UI.prototype,"cornerRadius",void 0),_e([xo()],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([ko()],t.UI.prototype,"placeholderColor",void 0),_e([ho(100)],t.UI.prototype,"placeholderDelay",void 0),_e([ho({})],t.UI.prototype,"data",void 0),_e([Uo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Rl=_e([Xo(vl),Xo(Bl),No()],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:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}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([Mo(rl)],t.Group.prototype,"__",void 0),_e([go(0)],t.Group.prototype,"width",void 0),_e([go(0)],t.Group.prototype,"height",void 0),t.Group=_e([Xo(t.Branch),Ho()],t.Group);const Pl=$t.get("Leafer");t.Leafer=Cl=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),Cl.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,u.assign(i,t));const r=this.canvas=oe.canvas(i);this.__controllers.push(this.renderer=oe.renderer(this,r,i),this.watcher=oe.watcher(this,i),this.layouter=oe.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=oe.selector(this),this.interaction=oe.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=oe.hitCanvasManager()),this.canvasManager=new ue,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),vn.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(qn.RESTART):this.emitLeafer(qn.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(qn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=u.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Vt(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.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 s=u.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new Hn(t,s))}__onResize(t){this.emitEvent(t),u.copyAttrs(this.__,t,Ce),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 qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ce.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(qn.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=u.copyAttrs({},i,Ce);r[t]=s[t]=e,s.width&&s.height?i.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(qn.BEFORE_READY),this.emitLeafer(qn.READY),this.emitLeafer(qn.AFTER_READY),vn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(qn.VIEW_READY),vn.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:o}=this;const n="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,n.x+n.width)),s||(r=Math.max(1,n.y+n.height)),this.__doResize({width:i,height:r,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){vn.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(qn.VIEW_COMPLETED),vn.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,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return re.need("view")}getValidMove(t,e,s){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:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new qn(t,this))}__listenEvents(){const t=ee.start("FirstCreate "+this.innerName);this.once([[qn.START,()=>ee.end(t)],[Vn.START,this.updateLazyBounds,this],[jn.START,this.__onCreated,this],[jn.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Gn.DATA,this.__onWatchData,this],[Vn.END,this.__onLayoutEnd,this],[jn.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Cl.list.remove(this);try{this.stop(),this.emitLeafer(qn.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){Pl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new _h,_e([Mo(nl)],t.Leafer.prototype,"__",void 0),_e([go()],t.Leafer.prototype,"pixelRatio",void 0),_e([ho("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Cl=_e([Ho()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},_e([Mo(ll)],t.Rect.prototype,"__",void 0),t.Rect=_e([Xo(Sl),No(),Ho()],t.Rect);const{add:Tl,includes:Ll,scroll:Il}=Yt,El=t.Rect.prototype,Ol=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 s=this.__,i=this.__layout,{renderBounds:r,boxBounds:o}=i,{overflow:n}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=n&&n.includes("scroll"))&&(Tl(a,o),Il(a,s)),this.__updateRectRenderBounds(),t=!Ll(o,a),t&&"show"===n&&Tl(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([Mo(ol)],t.Box.prototype,"__",void 0),_e([go(100)],t.Box.prototype,"width",void 0),_e([go(100)],t.Box.prototype,"height",void 0),_e([ho(!1)],t.Box.prototype,"resizeChildren",void 0),_e([Bo("show")],t.Box.prototype,"overflow",void 0),_e([Uo(El.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),_e([Uo(El.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),_e([Uo(El.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),_e([Uo(El.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),_e([Uo(El.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),_e([Uo(El.__updateChange)],t.Box.prototype,"__updateRectChange",null),_e([Uo(El.__render)],t.Box.prototype,"__renderRect",null),_e([Uo(Ol.__render)],t.Box.prototype,"__renderGroup",null),t.Box=_e([No(),Ho()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},_e([Mo(al)],t.Frame.prototype,"__",void 0),_e([ko("#FFFFFF")],t.Frame.prototype,"fill",void 0),_e([Bo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=_e([Ho()],t.Frame);const{moveTo:Al,closePath:Ml,ellipse:Wl}=vi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?(i||r?(s<1&&Wl(a,o,n,o*s,n*s,0,i,r,!1),Wl(a,o,n,o,n,0,r,i,!0),s<1&&Ml(a)):(s<1&&(Wl(a,o,n,o*s,n*s),Al(a,t,n)),Wl(a,o,n,o,n,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):i||r?(Al(a,o,n),Wl(a,o,n,o,n,0,i,r,!1),Ml(a)):Wl(a,o,n,o,n)}},_e([Mo(dl)],t.Ellipse.prototype,"__",void 0),_e([xo(0)],t.Ellipse.prototype,"innerRadius",void 0),_e([xo(0)],t.Ellipse.prototype,"startAngle",void 0),_e([xo(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=_e([Ho()],t.Ellipse);const{sin:Dl,cos:Fl,PI:zl}=Math,{moveTo:Ul,lineTo:Nl,closePath:Yl,drawPoints:Xl}=vi;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Xl(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,o=s/2,n=i/2;Ul(e,o,0);for(let t=1;t<r;t++)Nl(e,o+o*Dl(2*t*zl/r),n-n*Fl(2*t*zl/r));Yl(e)}}},_e([Mo(cl)],t.Polygon.prototype,"__",void 0),_e([xo(3)],t.Polygon.prototype,"sides",void 0),_e([xo()],t.Polygon.prototype,"points",void 0),_e([xo(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=_e([No(),Ho()],t.Polygon);const{sin:Hl,cos:Gl,PI:Vl}=Math,{moveTo:jl,lineTo:ql,closePath:Ql}=vi;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];jl(n,r,0);for(let t=1;t<2*s;t++)ql(n,r+(t%2==0?r:r*i)*Hl(t*Vl/s),o-(t%2==0?o:o*i)*Gl(t*Vl/s));Ql(n)}},_e([Mo(ul)],t.Star.prototype,"__",void 0),_e([xo(5)],t.Star.prototype,"corners",void 0),_e([xo(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=_e([Ho()],t.Star);const{moveTo:Jl,lineTo:$l,drawPoints:Zl}=vi,{rotate:Kl,getAngle:td,getDistance:ed,defaultPoint:sd}=ht;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Kl(s,e),s}set toPoint(t){this.width=ed(sd,t),this.rotation=td(sd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Zl(e,t.points,t.curve,t.closed):(Jl(e,0,0),$l(e,this.width,0))}},_e([Mo(hl)],t.Line.prototype,"__",void 0),_e([wo("center")],t.Line.prototype,"strokeAlign",void 0),_e([go(0)],t.Line.prototype,"height",void 0),_e([xo()],t.Line.prototype,"points",void 0),_e([xo(0)],t.Line.prototype,"curve",void 0),_e([xo(!1)],t.Line.prototype,"closed",void 0),t.Line=_e([Ho()],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([Mo(yl)],t.Image.prototype,"__",void 0),_e([go("")],t.Image.prototype,"url",void 0),t.Image=_e([Ho()],t.Image);const id=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=oe.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new eo({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Dn(Dn.LOADED,{image:t}))})}draw(t,e,s,i){const r=new gt(t.worldTransform).invert(),o=new gt;e&&o.translate(e.x,e.y),s&&(a(s)?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.multiplyParent(o),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},_e([Mo(ml)],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([ho(!1)],t.Canvas.prototype,"safeResize",void 0),_e([Wh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=_e([Ho()],t.Canvas);const{copyAndSpread:rd,includes:od,spread:nd,setList:ad}=Yt,{stintSet:hd}=u;function ld(t,e,s){t.__.__font?Yh.fillText(t,e,s):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function dd(t,e,s,i,r){const o=s.__;d(t)?Yh.drawStrokesStyle(t,e,!1,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),i.stroke()),o.__useArrow&&Yh.strokeArrow(t,s,i,r)}function cd(t,e,s,i,r){const o=s.__;d(t)?Yh.drawStrokesStyle(t,e,!0,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),Yh.drawTextStroke(s,i,r))}function ud(t,e,s,i,r){const o=i.getSameCanvas(!0,!0);o.font=s.__.__font,cd(t,2,s,o,r),o.blendMode="outside"===e?"destination-out":"destination-in",Yh.fillText(s,o,r),o.blendMode="normal",sn.copyCanvasByWorld(s,i,o),o.recycle(s.__nowWorld)}t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:o,italic:n,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Uh.number(e,r),t.__letterSpacing=Uh.number(s,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${n?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${i||"caption"}`,hd(t,"__padding",l&&W.fourNumber(l)),hd(t,"__clipText","show"!==h&&!t.__autoSize),hd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Fh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:o,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&nd(a,s/2),o||n){if(h.x=o?a.x:0,h.y=n?a.y:0,h.width=o?a.width:t.width,h.height=n?a.height:t.height,r){const[e,s,i,r]=t.__padding;o&&(h.x-=r,h.width+=s+r),n&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),u.stintSet(this,"isOverflow",!od(h,a)),this.isOverflow?(ad(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;rd(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,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__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([Mo(fl)],t.Text.prototype,"__",void 0),_e([go(0)],t.Text.prototype,"width",void 0),_e([go(0)],t.Text.prototype,"height",void 0),_e([ko()],t.Text.prototype,"boxStyle",void 0),_e([ho(!1)],t.Text.prototype,"resizeFontSize",void 0),_e([ko("#000000")],t.Text.prototype,"fill",void 0),_e([wo("outside")],t.Text.prototype,"strokeAlign",void 0),_e([Oo("all")],t.Text.prototype,"hitFill",void 0),_e([go("")],t.Text.prototype,"text",void 0),_e([go("")],t.Text.prototype,"placeholder",void 0),_e([go("caption")],t.Text.prototype,"fontFamily",void 0),_e([go(12)],t.Text.prototype,"fontSize",void 0),_e([go("normal")],t.Text.prototype,"fontWeight",void 0),_e([go(!1)],t.Text.prototype,"italic",void 0),_e([go("none")],t.Text.prototype,"textCase",void 0),_e([go("none")],t.Text.prototype,"textDecoration",void 0),_e([go(0)],t.Text.prototype,"letterSpacing",void 0),_e([go({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),_e([go(0)],t.Text.prototype,"paraIndent",void 0),_e([go(0)],t.Text.prototype,"paraSpacing",void 0),_e([go("x")],t.Text.prototype,"writingMode",void 0),_e([go("left")],t.Text.prototype,"textAlign",void 0),_e([go("top")],t.Text.prototype,"verticalAlign",void 0),_e([go(!0)],t.Text.prototype,"autoSizeAlign",void 0),_e([go("normal")],t.Text.prototype,"textWrap",void 0),_e([go("show")],t.Text.prototype,"textOverflow",void 0),_e([ko(!1)],t.Text.prototype,"textEditing",void 0),t.Text=_e([Ho()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},_e([Mo(_l)],t.Path.prototype,"__",void 0),_e([wo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=_e([Ho()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const s=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=s.path||(s.path=[]),this.add(s),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},_e([Mo(pl)],t.Pen.prototype,"__",void 0),_e([(t,e)=>{so(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=_e([Xo(Fi,["set","path","paint"]),Ho()],t.Pen);const{getSpread:_d,copyAndSpread:pd,toOuterOf:gd,getOuterOf:fd,getByMove:yd,move:md,getIntersectData:xd}=Yt,wd={};let vd;const{stintSet:bd}=u,{hasTransparent:Bd}=zh;function kd(t,e,s){if(!d(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:n}=s.__layout;switch(e.type){case"image":if(!e.url)return;r=Xh.image(s,t,e,n,!vd||!vd[e.url]);break;case"linear":r=Hh.linearGradient(e,n);break;case"radial":r=Hh.radialGradient(e,n);break;case"angular":r=Hh.conicGradient(e,n);break;case"solid":const{type:o,color:a,opacity:h}=e;r={type:o,style:zh.string(a,h)};break;default:i(e.r)||(r={type:"solid",style:zh.string(e)})}if(r&&(r.originPaint=e,o(r.style)&&Bd(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const Sd={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];l(a)||(a=[a]),vd=Xh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=kd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length?(i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(bd(s,"__isAlphaPixelFill",r),bd(s,"__isTransparentFill",o)):(bd(s,"__isAlphaPixelStroke",r),bd(s,"__isTransparentStroke",o),bd(s,"__hasMultiStrokeStyle",n))):s.__removePaint(t,!1)},fill:function(t,e,s,i){s.fillStyle=t,ld(e,s,i)},fills:function(t,e,s,i){let r,o,n;for(let a=0,h=t.length;a<h;a++){if(r=t[a],o=r.originPaint,r.image){if(n?n++:n=1,Xh.checkImage(r,!e.__.__font,e,s,i))continue;if(!r.style){1===n&&r.image.isPlacehold&&e.drawImagePlaceholder(r,s,i);continue}}if(s.fillStyle=r.style,r.transform||o.scaleFixed){if(s.save(),r.transform&&s.transform(r.transform),o.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0);(!0===o.scaleFixed||"zoom-in"===o.scaleFixed&&t>1&&i>1)&&s.scale(1/t,1/i)}o.blendMode&&(s.blendMode=o.blendMode),ld(e,s,i),s.restore()}else o.blendMode?(s.saveBlendMode(o.blendMode),ld(e,s,i),s.restoreBlendMode()):ld(e,s,i)}},fillPathOrText:ld,fillText:function(t,e,s){const i=t.__,{rows:r,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,s=r.length;t<s;t++)n=r[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(o){const{decorationColor:t,decorationHeight:s}=i.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>o.forEach(i=>e.fillRect(t.x,t.y+i,t.width,s)))}},stroke:function(t,e,s,i){const r=e.__;if(r.__strokeWidth)if(r.__font)Yh.strokeText(t,e,s,i);else switch(r.strokeAlign){case"center":dd(t,1,e,s,i);break;case"inside":!function(t,e,s,i){s.save(),s.clipUI(e),dd(t,2,e,s,i),s.restore()}(t,e,s,i);break;case"outside":!function(t,e,s,i){const r=e.__;if(r.__fillAfterStroke)dd(t,2,e,s,i);else{const{renderBounds:o}=e.__layout,n=s.getSameCanvas(!0,!0);e.__drawRenderPath(n),dd(t,2,e,n,i),n.clipUI(r),n.clearWorld(o),sn.copyCanvasByWorld(e,s,n),n.recycle(e.__nowWorld)}}(t,e,s,i)}},strokes:function(t,e,s,i){Yh.stroke(t,e,s,i)},strokeText:function(t,e,s,i){switch(e.__.strokeAlign){case"center":cd(t,1,e,s,i);break;case"inside":ud(t,"inside",e,s,i);break;case"outside":e.__.__fillAfterStroke?cd(t,2,e,s,i):ud(t,"outside",e,s,i)}},drawTextStroke:function(t,e,s){let i,r=t.__.__textDrawData;const{rows:o,decorationY:n}=r;for(let t=0,s=o.length;t<s;t++)i=o[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(n){const{decorationHeight:t}=r;o.forEach(s=>n.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}},drawStrokesStyle:function(t,e,s,i,r,o){let n;const a=i.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(n=t[l],(!n.image||!Xh.checkImage(n,!1,i,r,o))&&n.style){if(h){const{strokeStyle:t}=n;t?r.setStroke(n.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(n.style,a.__strokeWidth*e,a)}else r.strokeStyle=n.style;n.originPaint.blendMode?(r.saveBlendMode(n.originPaint.blendMode),s?Yh.drawTextStroke(i,r,o):r.stroke(),r.restoreBlendMode()):s?Yh.drawTextStroke(i,r,o):r.stroke()}},shape:function(t,e,s){const i=e.getSameCanvas(),r=e.bounds,o=t.__nowWorld,n=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;gd(n.strokeSpread?(pd(wd,n.boxBounds,n.strokeSpread),wd):n.boxBounds,o,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(a))_=i,h=u=a,l=o;else{let i;if(y.fullImageShadow)i=a;else{const t=n.renderShapeSpread?_d(r,R.swapAndScale(n.renderShapeSpread,p,g)):r;i=xd(t,a)}c=r.getFitMatrix(i);let{a:f,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,s),p*=f,g*=m),u=fd(a,c),h=yd(u,-c.e,-c.f),l=fd(o,c),md(l,-c.e,-c.f);const x=s.matrix;x?(d=new gt(c),d.multiply(x),f*=x.scaleX,m*=x.scaleY):d=c,d.withScale(f,m),s=Object.assign(Object.assign({},s),{matrix:d})}return t.__renderShape(i,s),{canvas:i,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Rd,Cd=new Vt;const{isSame:Pd}=Yt;function Td(t,e,s,i,r,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.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||Xh.createData(r,i,s,o),!0}function Ld(t,e){Od(t,Dn.LOAD,e)}function Id(t,e){Od(t,Dn.LOADED,e)}function Ed(t,e,s){e.error=s,t.forceUpdate("surface"),Od(t,Dn.ERROR,e)}function Od(t,e,s){t.hasEvent(e)&&t.emitEvent(new Dn(e,s))}function Ad(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Md,translate:Wd}=$,Dd=new Vt,Fd={},zd={};function Ud(t,e,s,i){const r=o(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let Nd={},Yd={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Xd,set:Hd,rotateOfOuter:Gd,translate:Vd,scaleOfOuter:jd,multiplyParent:qd,scale:Qd,rotate:Jd,skew:$d}=$;function Zd(t,e,s,i,r,o,n,a){n&&Jd(t,n),a&&$d(t,a.x,a.y),r&&Qd(t,r,o),Vd(t,e.x+s,e.y+i)}const{get:Kd,scale:tc,copy:ec}=$,{getFloorScale:sc}=W,{abs:ic}=Math;const rc={image:function(t,e,s,i,r){let o,n;const a=$r.get(s);return Rd&&s===Rd.paint&&Pd(i,Rd.boxBounds)?o=Rd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Rd=a.use>1?{leafPaint:o,paint:s,boxBounds:Cd.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Td(t,e,s,a,o,i),r&&(Ld(t,n),Id(t,n))):a.error?r&&Ed(t,n,a.error):(r&&(Ad(t,!0),Ld(t,n)),o.loadId=a.load(()=>{Ad(t,!1),t.destroyed||(Td(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Id(t,n)),o.loadId=void 0},e=>{Ad(t,!1),Ed(t,n,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,s,i,r){const{scaleX:o,scaleY:n}=Xh.getImageRenderScaleData(t,s,i,r),{image:a,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===o+"-"+n&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&Hn.isResizing(s)||d||(e=y.image.isLarge(a,o,n)||a.width*o>8096||a.height*n>8096)),e?(s.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill()),Xh.drawImage(t,o,n,s,i,r),!0):(!t.style||l.sync||d?Xh.createPattern(t,s,i,r):Xh.createPatternTask(t,s,i,r),!1))},drawImage:function(t,e,s,i,r,o){const{data:n,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=n,c=a.getFull(n.filters),u=i.__;let _,{width:p,height:g}=a;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(i),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(n.scaleX&&(p*=n.scaleX,g*=n.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,s,i){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(s){const{pixelRatio:t}=s;r.scaleX*=t,r.scaleY*=t}return o&&o.scaleX&&(r.scaleX*=Math.abs(o.scaleX),r.scaleY*=Math.abs(o.scaleY)),r},recycleImage:function(t,e){const s=e["_"+t];if(l(s)){let i,r,o,n,a;for(let h=0,d=s.length;h<d;h++)i=s[h],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,$r.recyclePaint(i),r.loading&&(n||(n=e.__input&&e.__input[t]||[],l(n)||(n=[n])),r.unload(s[h].loadId,!n.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,s,i){t.patternTask||(t.patternTask=$r.patternTasker.add(()=>pe(this,void 0,void 0,function*(){t.patternTask=null,s.bounds.hit(e.__nowWorld)&&Xh.createPattern(t,e,s,i),e.forceUpdate("surface")}),300))},createPattern:function(t,e,s,i){let{scaleX:r,scaleY:o}=Xh.getImageRenderScaleData(t,e,s,i),n=r+"-"+o;if(t.patternId!==n&&!e.destroyed&&(!y.image.isLarge(t.image,r,o)||t.data.repeat)){const{image:s,data:i}=t,{transform:a,gap:h}=i,l=Xh.getPatternFixScale(t,r,o);let d,c,u,{width:_,height:p}=s;l&&(r*=l,o*=l),_*=r,p*=o,h&&(c=h.x*r/ic(i.scaleX||1),u=h.y*o/ic(i.scaleY||1)),(a||1!==r||1!==o)&&(r*=sc(_+(c||0)),o*=sc(p+(u||0)),d=Kd(),a&&ec(d,a),tc(d,1/r,1/o));const g=s.getCanvas(_,p,i.opacity,i.filters,c,u,e.leafer&&e.leafer.config.smooth),f=s.getPattern(g,i.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=n}},getPatternFixScale:function(t,e,s){const{image:i}=t;let r,o=y.image.maxPatternSize,n=i.width*i.height;return i.isSVG?e>1&&(r=Math.ceil(e)/e):o>n&&(o=n),(n*=e*s)>o&&(r=Math.sqrt(o/n)),r},createData:function(t,e,s,i){t.data=Xh.getPatternData(s,i,e)},getPatternData:function(t,e,s){t.padding&&(e=Dd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:i,height:r}=s,{opacity:n,mode:a,align:h,offset:l,scale:c,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,x=e.width===i&&e.height===r,w={mode:a},v="center"!==h&&(_||0)%180==90;let b,B;switch(Yt.set(zd,0,0,v?r:i,v?i:r),a&&"cover"!==a&&"fit"!==a?((c||u)&&(W.getScaleData(c,u,s,Fd),b=Fd.scaleX,B=Fd.scaleY),(h||y||f)&&(b&&Yt.scale(zd,b,B,!0),h&&St.toPoint(h,zd,e,zd,!0,!0))):x&&!_||(b=B=Yt.getFitScale(e,zd,"fit"!==a),Yt.put(e,s,h,b,!1,zd),Yt.scale(zd,b,B,!0)),l&&ht.move(zd,l),a){case"stretch":x?b&&(b=B=void 0):(b=e.width/i,B=e.height/r,Xh.stretchMode(w,e,b,B));break;case"normal":case"clip":if(zd.x||zd.y||b||g||_||p){let t,s;g&&(t=e.width/g.width,s=e.height/g.height),Xh.clipMode(w,e,zd.x,zd.y,b,B,_,p,t,s),t&&(b=b?b*t:t,B=B?B*s:s)}break;case"repeat":(!x||b||_||p)&&Xh.repeatMode(w,e,i,r,zd.x,zd.y,b,B,_,p,h,t.freeTransform),f||(w.repeat="repeat");const s=d(f);(y||s)&&(w.gap=function(t,e,s,i,r){let o,n;d(t)?(o=t.x,n=t.y):o=n=t;return{x:Ud(o,s,r.width,e&&e.x),y:Ud(n,i,r.height,e&&e.y)}}(y,s&&f,zd.width,zd.height,e));break;default:b&&Xh.fillOrFitMode(w,e,zd.x,zd.y,b,B,_)}return w.transform||(e.x||e.y)&&Wd(w.transform=Md(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=B),n&&n<1&&(w.opacity=n),m&&(w.filters=m),f&&(w.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,s,i){const r=Xd(),{x:o,y:n}=e;o||n?Vd(r,o,n):r.onlyScale=!0,Qd(r,s,i),t.transform=r},fillOrFitMode:function(t,e,s,i,r,o,n){const a=Xd();Vd(a,e.x+s,e.y+i),Qd(a,r,o),n&&Gd(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a},clipMode:function(t,e,s,i,r,o,n,a,h,l){const d=Xd();Zd(d,e,s,i,r,o,n,a),h&&(n||a?(Hd(Yd),jd(Yd,e,h,l),qd(d,Yd)):jd(d,e,h,l)),t.transform=d},repeatMode:function(t,e,s,i,r,o,n,a,h,l,d,c){const u=Xd();if(c)Zd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)Gd(u,{x:s/2,y:i/2},h);else switch(Jd(u,h),h){case 90:Vd(u,i,0);break;case 180:Vd(u,s,i);break;case 270:Vd(u,0,s)}Nd.x=e.x+r,Nd.y=e.y+o,Vd(u,Nd.x,Nd.y),n&&jd(u,Nd,n,a)}t.transform=u}},{toPoint:oc}=bt,{hasTransparent:nc}=zh,ac={},hc={};function lc(t,e,s,i){if(s){let r,n,a,h;for(let t=0,l=s.length;t<l;t++)r=s[t],o(r)?(a=t/(l-1),n=zh.string(r,i)):(a=r.offset,n=zh.string(r.color,i)),e.addColorStop(a,n),!h&&nc(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:dc,getDistance:cc}=ht,{get:uc,rotateOfOuter:_c,scaleOfOuter:pc}=$,{toPoint:gc}=bt,fc={},yc={};function mc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=dc(e,s);o=uc(),r?(pc(o,e,n/a*(i||1),1),_c(o,e,t+90)):(pc(o,e,1,n/a*(i||1)),_c(o,e,t))}return o}const{getDistance:xc}=ht,{toPoint:wc}=bt,vc={},bc={};const Bc={linearGradient:function(t,e){let{from:s,to:i,type:r,opacity:o}=t;oc(s||"top",e,ac),oc(i||"bottom",e,hc);const n=y.canvas.createLinearGradient(ac.x,ac.y,hc.x,hc.y),a={type:r,style:n};return lc(a,n,t.stops,o),a},radialGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;gc(s||"center",e,fc),gc(i||"bottom",e,yc);const a=y.canvas.createRadialGradient(fc.x,fc.y,0,fc.x,fc.y,cc(fc,yc)),h={type:r,style:a};lc(h,a,t.stops,o);const l=mc(e,fc,yc,n,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;wc(s||"center",e,vc),wc(i||"bottom",e,bc);const a=y.conicGradientSupport?y.canvas.createConicGradient(0,vc.x,vc.y):y.canvas.createRadialGradient(vc.x,vc.y,0,vc.x,vc.y,xc(vc,bc)),h={type:r,style:a};lc(h,a,t.stops,o);const l=mc(e,vc,bc,n||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:mc},{copy:kc,move:Sc,toOffsetOutBounds:Rc}=Yt,{max:Cc,abs:Pc}=Math,Tc={},Lc=new gt,Ic={};function Ec(t,e){let s,i,r,o,n=0,a=0,h=0,l=0;return e.forEach(t=>{s=t.x||0,i=t.y||0,o=1.5*(t.blur||0),r=Pc(t.spread||0),n=Cc(n,r+o-i),a=Cc(a,r+o+s),h=Cc(h,r+o+i),l=Cc(l,r+o-s)}),n===a&&a===h&&h===l?n:[n,a,h,l]}function Oc(t,e,s){const{shapeBounds:i}=s;let r,o;y.fullImageShadow?(kc(Tc,t.bounds),Sc(Tc,e.x-i.x,e.y-i.y),r=t.bounds,o=Tc):(r=i,o=e),t.copyWorld(s.canvas,r,o)}const{toOffsetOutBounds:Ac}=Yt,Mc={};const Wc=Ec;const Dc={shadow:function(t,e,s){let i,r;const{__nowWorld:o}=t,{shadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=n.length-1;Rc(h,Ic,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Ic.offsetX+(n.x||0)*c*f,Ic.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f,zh.string(n.color)),r=Gh.getShadowTransform(t,_,s,n,Ic,f),r&&_.setTransform(r),Oc(_,Ic,s),r&&_.resetTransform(),i=l,n.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,o,"copy"),i=o),a?_.copyWorld(a,o,o,"destination-out"):_.copyWorld(s.canvas,d,h,"destination-out")),sn.copyCanvasByWorld(t,e,_,i,n.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o}=t,{innerShadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=n.length-1;Ac(h,Mc,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Mc.offsetX+(n.x||0)*c*f,Mc.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f),r=Gh.getShadowTransform(t,_,s,n,Mc,f,!0),r&&_.setTransform(r),Oc(_,Mc,s),_.restore(),a?(_.copyWorld(_,l,o,"copy"),_.copyWorld(a,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,h,"source-out"),i=l),_.fillWorld(i,zh.string(n.color),"source-in"),sn.copyCanvasByWorld(t,e,_,i,n.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){},getShadowRenderSpread:Ec,getShadowTransform:function(t,e,s,i,r,o,n){if(i.spread){const s=2*i.spread*o*(n?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Lc.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+s/a,1+s/h),Lc}},isTransformShadow(t){},getInnerShadowSpread:Wc},{excludeRenderBounds:Fc}=cn;let zc;function Uc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":zc||(zc=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,o){const n=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,n),o&&i.recycle(n);Yc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":Yc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function Nc(t){return t.getSameCanvas(!1,!0)}function Yc(t,e,s,i,r,o){const n=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,n,void 0,r),o?s.recycle(n):s.clearWorld(n)}t.Group.prototype.__renderMask=function(t,e){let s,i,r,o,n,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){n&&(Uc(this,n,t,r,i,o,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||Fc(s,e)||s.__render(t,e),o=s.__.opacity,zc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=Nc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=Nc(t)),r||(r=Nc(t)),s.__render(i,e));continue}const d=1===o&&s.__.__blendMode;d&&Uc(this,n,t,r,i,o,void 0,!1),Fc(s,e)||s.__render(r||t,e),d&&Uc(this,n,t,r,i,o,d,!1)}Uc(this,n,t,r,i,o,void 0,!0)};const Xc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Hc=Xc+"_#~&*+\\=|≮≯≈≠=…",Gc=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 Vc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const jc=Vc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),qc=Vc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Qc=Vc(Xc),Jc=Vc(Hc),$c=Vc("- —/~|┆·");var Zc;!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"}(Zc||(Zc={}));const{Letter:Kc,Single:tu,Before:eu,After:su,Symbol:iu,Break:ru}=Zc;function ou(t){return jc[t]?Kc:$c[t]?ru:qc[t]?eu:Qc[t]?su:Jc[t]?iu:Gc.test(t)?tu:Kc}const nu={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function au(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:hu}=nu,{Letter:lu,Single:du,Before:cu,After:uu,Symbol:_u,Break:pu}=Zc;let gu,fu,yu,mu,xu,wu,vu,bu,Bu,ku,Su,Ru,Cu,Pu,Tu,Lu,Iu,Eu=[];function Ou(t,e){Bu&&!bu&&(bu=Bu),gu.data.push({char:t,width:e}),yu+=e}function Au(){mu+=yu,gu.width=yu,fu.words.push(gu),gu={data:[]},yu=0}function Mu(){Pu&&(Tu.paraNumber++,fu.paraStart=!0,Pu=!1),Bu&&(fu.startCharSize=bu,fu.endCharSize=Bu,bu=0),fu.width=mu,Lu.width?hu(fu):Iu&&Wu(),Eu.push(fu),fu={words:[]},mu=0}function Wu(){mu>(Tu.maxWidth||0)&&(Tu.maxWidth=mu)}const{top:Du,right:Fu,bottom:zu,left:Uu}=t.Direction4;function Nu(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const Yu={getDrawData:function(t,e){o(t)||(t=String(t));let s=0,i=0,r=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:a}=e;a&&(r?(s=a[Uu],r-=a[Fu]+a[Uu],!r&&(r=.01)):e.autoSizeAlign||(s=a[Uu]),n?(i=a[Du],n-=a[Du]+a[zu],!n&&(n=.01)):e.autoSizeAlign||(i=a[Du]));const h={bounds:{x:s,y:i,width:r,height:n},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,s){Tu=t,Eu=t.rows,Lu=t.bounds,Iu=!Lu.width&&!s.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:o}=s,{canvas:n}=y,{width:a}=Lu;if(s.__isCharMode){const t="none"!==s.textWrap,h="break"===s.textWrap;Pu=!0,Su=null,bu=vu=Bu=yu=mu=0,gu={data:[]},fu={words:[]},i&&(e=[...e]);for(let s=0,l=e.length;s<l;s++)wu=e[s],"\n"===wu?(yu&&Au(),fu.paraEnd=!0,Mu(),Pu=!0):(ku=ou(wu),ku===lu&&"none"!==o&&(wu=au(wu,o,!yu)),vu=n.measureText(wu).width,i&&(i<0&&(Bu=vu),vu+=i),Ru=ku===du&&(Su===du||Su===lu)||Su===du&&ku!==uu,Cu=!(ku!==cu&&ku!==du||Su!==_u&&Su!==uu),xu=Pu&&r?a-r:a,t&&a&&mu+yu+vu>xu&&(h?(yu&&Au(),mu&&Mu()):(Cu||(Cu=ku===lu&&Su==uu),Ru||Cu||ku===pu||ku===cu||ku===du||yu+vu>xu?(yu&&Au(),mu&&Mu()):mu&&Mu()))," "===wu&&!0!==Pu&&mu+yu===0||(ku===pu?(" "===wu&&yu&&Au(),Ou(wu,vu),Au()):Ru||Cu?(yu&&Au(),Ou(wu,vu)):Ou(wu,vu)),Su=ku);yu&&Au(),mu&&Mu(),Eu.length>0&&(Eu[Eu.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Tu.paraNumber++,mu=n.measureText(t).width,Eu.push({x:r||0,text:t,width:mu,paraStart:!0}),Iu&&Wu()})}(h,t,e),a&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":Nu(e,"x",t[Uu]);break;case"right":Nu(e,"x",-t[Fu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":Nu(e,"y",t[Du]);break;case"bottom":Nu(e,"y",-t[zu])}}(a,h,e,r,n),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:o,__baseLine:n,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=i,y=o*r+(c?c*(t.paraNumber-1):0),m=n;if(h&&y>f)y=Math.max(f,o),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 x,w,v,b=g||u?g:t.maxWidth;for(let n=0,d=r;n<d;n++){if(x=s[n],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&n>0&&(m+=c),x.y=m,m+=o,t.overflow>n&&m>y&&(x.isOverflow=!0,t.overflow=n+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(h,e),e.__isCharMode&&function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:o,letterSpacing:n}=e,a=s&&r.includes("both"),h=a||s&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,x;i.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,y=t.words.length,h&&(x=!t.paraEnd||a,c=s-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=n||t.isOverflow||l?0:u?1:2,t.isOverflow&&!n&&(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,s)=>{1===g?(f={char:"",x:d},d=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,s,i,r){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,x&&_),x&&(m=s===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,s,i){if(!i)return;const{rows:r,overflow:o}=t;let{textOverflow:n}=e;if(r.splice(o),n&&"show"!==n){let t,a;"hide"===n?n="":"ellipsis"===n&&(n="...");const h=n?y.canvas.measureText(n).width:0,l=s+i-h;("none"===e.textWrap?r:[r[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],a=t.x+t.width,!(i===s&&a<l));i--){if(a<l&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:n,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,s,r),"none"!==e.textDecoration&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:o}=e;switch(t.decorationHeight=r/11,d(o)?(s=o.type,o.color&&(t.decorationColor=zh.string(o.color)),o.offset&&(i=Math.min(.3*r,Math.max(o.offset,.15*-r)))):s=o,s){case"under":t.decorationY=[.15*r+i];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+i,.35*-r]}}(h,e),h}};const Xu={string:function(t,e){if(!t)return"#000";const s=a(e)&&e<1;if(o(t)){if(!s||!zh.object)return t;t=zh.object(t)}let r=i(t.a)?1:t.a;s&&(r*=e);const n=t.r+","+t.g+","+t.b;return 1===r?"rgb("+n+")":"rgba("+n+","+r+")"}};return Object.assign(Fh,Yu),Object.assign(zh,Xu),Object.assign(Yh,Sd),Object.assign(Xh,rc),Object.assign(Hh,Bc),Object.assign(Gh,Dc),xh(),t.AlignHelper=St,t.AroundHelper=bt,t.AutoBounds=qt,t.BezierHelper=rs,t.Bounds=Vt,t.BoundsEvent=Fn,t.BoundsHelper=Yt,t.BoxData=ol,t.BranchHelper=gn,t.BranchRender=Ea,t.CanvasData=ml,t.CanvasManager=ue,t.ChildEvent=On,t.ColorConvert=zh,t.Creator=oe,t.DataHelper=u,t.Debug=$t,t.Effect=Gh,t.EllipseData=dl,t.EllipseHelper=_s,t.Event=En,t.EventCreator=de,t.Eventer=ea,t.Export=jh,t.FileHelper=Xr,t.Filter=Vh,t.FourNumberHelper=R,t.FrameData=al,t.GroupData=rl,t.ImageData=yl,t.ImageEvent=Dn,t.ImageManager=$r,t.IncrementId=x,t.LayoutEvent=Vn,t.Layouter=Eh,t.LeafBounds=Ta,t.LeafBoundsHelper=cn,t.LeafData=p,t.LeafDataProxy=pa,t.LeafEventer=ua,t.LeafHelper=sn,t.LeafLayout=In,t.LeafLevelList=ph,t.LeafList=_h,t.LeafMatrix=va,t.LeafRender=La,t.LeaferCanvas=fh,t.LeaferCanvasBase=Pe,t.LeaferData=nl,t.LeaferEvent=qn,t.LeaferImage=eo,t.LineData=hl,t.MathHelper=W,t.Matrix=gt,t.MatrixHelper=$,t.MyImage=id,t.NeedConvertToCanvasCommandMap=Oe,t.OneRadian=F,t.PI2=z,t.PI_2=U,t.Paint=Yh,t.PaintGradient=Hh,t.PaintImage=Xh,t.PathArrow=Nh,t.PathBounds=Ir,t.PathCommandDataHelper=vi,t.PathCommandMap=Ie,t.PathCommandNodeHelper=ps,t.PathConvert=Zs,t.PathCorner=Fr,t.PathCreator=Fi,t.PathData=_l,t.PathDrawer=Ki,t.PathHelper=Te,t.PathNumberCommandLengthMap=De,t.PathNumberCommandMap=We,t.PenData=pl,t.Platform=y,t.Plugin=re,t.Point=_t,t.PointHelper=ht,t.PolygonData=cl,t.PropertyEvent=Mn,t.RectData=ll,t.RectHelper=Fe,t.RectRender=Sl,t.RenderEvent=jn,t.Renderer=Ah,t.ResizeEvent=Hn,t.Resource=Qr,t.Run=ee,t.StarData=ul,t.State=qh,t.StringNumberMap=Qt,t.TaskItem=Vr,t.TaskProcessor=jr,t.TextConvert=Fh,t.TextData=fl,t.Transition=Qh,t.TwoPointBoundsHelper=yt,t.UIBounds=vl,t.UICreator=ae,t.UIData=sl,t.UIRender=Bl,t.UnitConvert=Uh,t.WaitHelper=vn,t.WatchEvent=Gn,t.Watcher=vh,t.affectRenderBoundsType=Bo,t.affectStrokeBoundsType=wo,t.attr=no,t.autoLayoutType=uo,t.boundsType=go,t.canvasPatch=Yr,t.canvasSizeAttrs=Ce,t.createAttr=function(t){return(e,s)=>{so(e,s,ro(s,t))}},t.createDescriptor=ro,t.cursorType=Ao,t.dataProcessor=Mo,t.dataType=ho,t.decorateLeafAttr=oo,t.defineDataProcessor=Wo,t.defineKey=so,t.defineLeafAttr=ao,t.dimType=So,t.doBoundsType=yo,t.doStrokeType=vo,t.effectType=Mh,t.emptyData={},t.eraserType=Eo,t.extraPropertyEventMap=Wn,t.getBoundsData=Y,t.getDescriptor=io,t.getMatrixData=X,t.getPointData=N,t.hitType=Oo,t.isArray=l,t.isData=function(t){return d(t)&&!l(t)},t.isEmptyData=c,t.isFinite=n,t.isNull=r,t.isNumber=a,t.isObject=d,t.isString=o,t.isUndefined=i,t.layoutProcessor=function(t){return(e,s)=>{so(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Kn,t.maskType=Io,t.naturalBoundsType=fo,t.opacityType=Ro,t.path=zr,t.pathInputType=mo,t.pathType=xo,t.pen=Ur,t.positionType=lo,t.registerUI=Ho,t.registerUIEvent=function(){return t=>{de.register(t)}},t.resizeType=Wh,t.rewrite=Uo,t.rewriteAble=No,t.rotationType=po,t.scaleType=_o,t.scrollType=co,t.sortType=Lo,t.strokeType=bo,t.surfaceType=ko,t.tempBounds=jt,t.tempMatrix=ft,t.tempPoint=pt,t.tryToNumber=function(t){return"string"==typeof t&&h.test(t)?+t:t},t.useCanvas=xh,t.useModule=Xo,t.version="1.12.1",t.visibleType=Co,t.zoomLayerType=Dh,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
|