leafer-game 2.0.2 → 2.0.4

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.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var LeaferUI=function(t){"use strict";var e,i;function s(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function n(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())})}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","function"==typeof SuppressedError&&SuppressedError,t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const r={};function o(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;const{isArray:u}=Array;function p(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return f(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&f(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:f}=g;class y{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(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=o(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=v;return e[t]?e[t]++:(e[t]=1,0)}},v=m;let w,x,b;const{max:E}=Math,P=[0,0,0,0],S={zero:[...P],tempFour:P,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>B(P,t,e,i,s),toTempAB(t,e,i){b=i?d(t)?e:t:[],d(t)?(w=k(t),x=e):d(e)?(w=t,x=k(e)):(w=t,x=e),4!==w.length&&(w=T(w)),4!==x.length&&(x=T(x))},get(t,e){let i;if(!d(t))switch(t.length){case 4:i=o(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!o(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>d(t)&&d(e)?E(t,e):(R(t,e,i),B(b,E(w[0],x[0]),E(w[1],x[1]),E(w[2],x[2]),E(w[3],x[3]))),add:(t,e,i)=>d(t)&&d(e)?t+e:(R(t,e,i),B(b,w[0]+x[0],w[1]+x[1],w[2]+x[2],w[3]+x[3])),swapAndScale(t,e,i,s){if(d(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,h]=4===t.length?t:T(t);return B(n,a*i,h*e,r*i,o*e)}},{set:B,get:T,setTemp:k,toTempAB:R}=S,{round:C,pow:L,max:D,floor:A,PI:O}=Math,I={within:(t,e,i)=>(p(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber:S.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),I.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=o(e)?1e12:L(10,e);return-0===(t=C(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&I.assignScale(s,t);return s},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(A(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}const F=O/180,W=2*O,U=O/2;function N(){return{x:0,y:0}}function z(){return{x:0,y:0,width:0,height:0}}function Y(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:H,acos:j,sqrt:V}=Math,{float:G}=I,q={};function K(){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 Z={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:K(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:Y,getWorld:K,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){$.toInnerPoint(t,e,q),$.scaleOfInner(t,q,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=H(e*=F),a=X(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,q),$.rotateOfInner(t,q,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=F,t.a=s+r*i,t.b=n+o*i),e&&(e*=F,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,q),$.skewOfInner(t,q,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*F,o=H(r),a=X(r);if(s||n){const e=s*F,i=n*F;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,p,_,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=V(n*n+r*r),c=t/d;const e=n/d;u=r>0?j(e):-j(e)}else{c=V(o*o+a*a),d=t/c;const e=o/c;u=U-(a>0?j(-e):-j(e))}const e=G(H(u)),i=X(u);d=G(d),c=G(c),p=e?G((o/c+i)/e/F,9):0,_=e?G((r/d-i)/e/F,9):0,u=G(u/F)}else d=n,c=a,u=p=_=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=V(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=Z,{float:J}=I,{toInnerPoint:Q,toOuterPoint:tt}=Z,{sin:et,cos:it,abs:st,sqrt:nt,atan2:rt,min:ot,round:at}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=o(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,i){p(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=lt.defaultPoint);const s=it(e*=F),n=et(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=lt;return ct(i,t),Q(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=lt;return ct(i,t),tt(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=lt;return ct(i,t),lt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ct(t,e),ut(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),Q(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){Q(e,t,i)},toOuterOf(t,e,i){tt(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=st(i-t),r=st(s-e);return nt(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>ot(dt(t,e,i,s),dt(i,s,n,r)),getAngle:(t,e)=>pt(t,e)/F,getRotation:(t,e,i,s)=>(s||(s=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/F),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>rt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=pt(t,e);return n&&(t=e),s||(e={}),e.x=t.x+it(r)*i,e.y=t.y+et(r)*i,e},toNumberPoints(t){let e=t;return p(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>J(t.x)===J(e.x)&&J(t.y)===J(e.y),reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,setRadius:ut,getAtan2:pt}=lt;class _t{constructor(t,e){this.set(t,e)}set(t,e){return p(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,i){return ht.scaleOf(this,t,e,i),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,i){return ht.getRotation(this,t,e,i)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new _t(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(ht.getDistancePoint(this,t,e,i,s))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}isSame(t){return ht.isSame(this,t)}reset(){return ht.reset(this),this}}const gt=new _t;class ft{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return p(t)?Z.copy(this,t):Z.set(this,t,e,i,s,n,r),this}setWith(t){return Z.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new ft(this)}translate(t,e){return Z.translate(this,t,e),this}translateInner(t,e){return Z.translateInner(this,t,e),this}scale(t,e){return Z.scale(this,t,e),this}scaleWith(t,e){return Z.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Z.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Z.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Z.scaleOfInner(this,t,e,i),this}rotate(t){return Z.rotate(this,t),this}rotateOfOuter(t,e){return Z.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Z.rotateOfInner(this,t,e),this}skew(t,e){return Z.skew(this,t,e),this}skewOfOuter(t,e,i){return Z.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Z.skewOfInner(this,t,e,i),this}multiply(t){return Z.multiply(this,t),this}multiplyParent(t){return Z.multiplyParent(this,t),this}divide(t){return Z.divide(this,t),this}divideParent(t){return Z.divideParent(this,t),this}invert(){return Z.invert(this),this}invertWith(){return Z.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Z.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Z.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Z.setLayout(this,t,e,i),this}getLayout(t,e,i){return Z.getLayout(this,t,e,i)}withScale(t,e){return Z.withScale(this,t,e)}reset(){Z.reset(this)}}const yt=new ft,mt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){vt(t,e,i),vt(t,e+s,i+n)},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:vt}=mt;var wt,xt;t.Direction4=void 0,(wt=t.Direction4||(t.Direction4={}))[wt.top=0]="top",wt[wt.right=1]="right",wt[wt.bottom=2]="bottom",wt[wt.left=3]="left",t.Direction9=void 0,(xt=t.Direction9||(t.Direction9={}))[xt.topLeft=0]="topLeft",xt[xt.top=1]="top",xt[xt.topRight=2]="topRight",xt[xt.right=3]="right",xt[xt.bottomRight=4]="bottomRight",xt[xt.bottom=5]="bottom",xt[xt.bottomLeft=6]="bottomLeft",xt[xt.left=7]="left",xt[xt.center=8]="center",xt[xt["top-left"]=0]="top-left",xt[xt["top-right"]=2]="top-right",xt[xt["bottom-right"]=4]="bottom-right",xt[xt["bottom-left"]=6]="bottom-left";const bt=[{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}];bt.forEach(t=>t.type="percent");const Et={directionData:bt,tempPoint:{},get:Pt,toPoint(t,e,i,s,n,r){const o=Pt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),Et.toPoint(t,e,i,!0),i)};function Pt(e){return h(e)?bt[t.Direction9[e]]:e}const{toPoint:St}=Et,Bt={toPoint(t,e,i,s,n,r){St(t,i,s,n,e,r)}},{tempPointBounds:Tt,setPoint:kt,addPoint:Rt,toBounds:Ct}=mt,{toOuterPoint:Lt}=Z,{float:Dt,fourNumber:At}=I,{floor:Ot,ceil:It}=Math;let Mt,Ft,Wt,Ut;const Nt={},zt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=At(i);s?Ht.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ht.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ht.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Vt(e,t):e=t,i||(i=t),e.offsetX=Ht.maxX(i),e.offsetY=Ht.maxY(i),Ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ht.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ht.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ht.copy(Yt,t),Ht.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ht.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else Nt.x=t.x,Nt.y=t.y,Lt(e,Nt,zt),kt(Tt,zt.x,zt.y),Nt.x=t.x+t.width,Lt(e,Nt,zt),Rt(Tt,zt.x,zt.y),Nt.y=t.y+t.height,Lt(e,Nt,zt),Rt(Tt,zt.x,zt.y),Nt.x=t.x,Lt(e,Nt,zt),Rt(Tt,zt.x,zt.y),Ct(Tt,i)},toInnerOf(t,e,i){i||(i=t),Ht.move(i,-e.e,-e.f),Ht.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ht.getFitScale(t,e));return new ft(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),h(s)&&(s=Ht.getFitScale(t,e,"cover"===s)),Yt.width=n?e.width*=s:e.width*s,Yt.height=n?e.height*=s:e.height*s,Bt.toPoint(i,Yt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Ot(t.x),t.y=Ot(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=i>t.y?It(t.height+i-t.y):It(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Dt(t.x,e),t.y=Dt(t.y,e),t.width=Dt(t.width,e),t.height=Dt(t.height,e)},add(t,e,i){Mt=t.x+t.width,Ft=t.y+t.height,Wt=e.x,Ut=e.y,i||(Wt+=e.width,Ut+=e.height),Mt=Mt>Wt?Mt:Wt,Ft=Ft>Ut?Ft:Ut,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=Ft-t.y},addList(t,e){Ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ht.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Vt(t,n)):jt(t,n));r&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?kt(Tt,t.x,t.y):Rt(Tt,t.x,t.y)),Ct(Tt,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ht.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=ht.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Ht.tempToOuterOf(e,i)),!Ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Mt=s+r,Ft=n+o,Wt=t.x+t.width,Ut=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Mt=Mt<Wt?Mt:Wt,Ft=Ft<Ut?Ft:Ut,r=Mt-s,o=Ft-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Ht.copy(t,Ht.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ht.set(t)}},Ht=Xt,{add:jt,copy:Vt}=Ht;class Gt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return p(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Gt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const qt=new Gt;class Kt{constructor(t,e,i,s,n,r){p(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new Gt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Zt={number:(t,e)=>p(t)?"percent"===t.type?t.value*e:t.value:t},$t={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},{floor:Jt,max:Qt}=Math,te={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||ee.maxCacheSize),isSuperLarge:(t,e,i)=>ee.isLarge(t,e,i,ee.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ee;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=Qt(Jt(e+(s||0)),1),c=Qt(Jt(i+(n||0)),1);let u,p,_;l&&(_=Zt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:p=!0);const g=te.origin.createCanvas(p?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ee.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);_&&(f.drawImage(g,0,0,d,c,u?_-d:d,u?c:_-c,d,c),f.drawImage(g,0,0,d,c,u?_:d,u?c:_,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:ee}=te,{randColor:ie}=I;class se{constructor(t){this.repeatMap={},this.name=t}static get(t){return new se(t)}static set filter(t){this.filterList=ne(t)}static set exclude(t){this.excludeList=ne(t)}static drawRepaint(t,e){const i=ie();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===se.showBounds,n=t.__nowWorld,r=ie();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(re.enable){if(re.filterList.length&&re.filterList.every(t=>t!==this.name))return;if(re.excludeList.length&&re.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){re.enable&&this.warn(...t)}warn(...t){re.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 ne(t){return t?h(t)&&(t=[t]):t=[],t}se.filterList=[],se.excludeList=[],se.showWarn=!0;const re=se,oe=se.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=m.create(m.RUNTIME);return he.currentId=he.idMap[i]=e?performance.now():Date.now(),he.currentName=he.nameMap[i]=t,he.nameToIdMap[t]=i,i},end(t,e){const i=he.idMap[t],s=he.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;he.idMap[t]=he.nameMap[t]=he.nameToIdMap[s]=void 0,oe.log(s,n,"ms")},endOfName(t,e){const i=he.nameToIdMap[t];o(i)||he.end(i,e)}},he=ae,le=[],de={list:{},add(t,...e){this.list[t]=!0,le.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>le.forEach(t=>de.has(t,!0)));const ce={editor:t=>de.need("editor")},ue=se.get("UICreator"),pe={list:{},register(t){const{__tag:e}=t.prototype;_e[e]&&ue.repeat(e),_e[e]=t},get(t,e,i,s,n,r){if(!_e[t])return void ue.warn("not register "+t);const a=new _e[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:_e}=pe,ge=se.get("EventCreator"),fe={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(ye[e]&&ge.repeat(e),ye[e]=t)})},changeName(t,e){const i=ye[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ye[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=fe;class me{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ce.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function ve(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}const we=[];function xe(){return(t,e)=>{we.push(e)}}const be=[];class Ee{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||be)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;we.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){p(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}s([ve("imageSmoothingEnabled")],Ee.prototype,"smooth",void 0),s([ve("imageSmoothingQuality")],Ee.prototype,"smoothLevel",void 0),s([ve("globalAlpha")],Ee.prototype,"opacity",void 0),s([ve()],Ee.prototype,"fillStyle",void 0),s([ve()],Ee.prototype,"strokeStyle",void 0),s([ve("lineWidth")],Ee.prototype,"strokeWidth",void 0),s([ve("lineCap")],Ee.prototype,"strokeCap",void 0),s([ve("lineJoin")],Ee.prototype,"strokeJoin",void 0),s([ve("lineDashOffset")],Ee.prototype,"dashOffset",void 0),s([ve()],Ee.prototype,"miterLimit",void 0),s([ve()],Ee.prototype,"shadowBlur",void 0),s([ve()],Ee.prototype,"shadowColor",void 0),s([ve()],Ee.prototype,"shadowOffsetX",void 0),s([ve()],Ee.prototype,"shadowOffsetY",void 0),s([ve()],Ee.prototype,"filter",void 0),s([ve()],Ee.prototype,"font",void 0),s([ve()],Ee.prototype,"fontKerning",void 0),s([ve()],Ee.prototype,"fontStretch",void 0),s([ve()],Ee.prototype,"fontVariantCaps",void 0),s([ve()],Ee.prototype,"textAlign",void 0),s([ve()],Ee.prototype,"textBaseline",void 0),s([ve()],Ee.prototype,"textRendering",void 0),s([ve()],Ee.prototype,"wordSpacing",void 0),s([ve()],Ee.prototype,"letterSpacing",void 0),s([ve()],Ee.prototype,"direction",void 0),s([xe()],Ee.prototype,"setTransform",null),s([xe()],Ee.prototype,"resetTransform",null),s([xe()],Ee.prototype,"getTransform",null),s([xe()],Ee.prototype,"save",null),s([xe()],Ee.prototype,"restore",null),s([xe()],Ee.prototype,"translate",null),s([xe()],Ee.prototype,"scale",null),s([xe()],Ee.prototype,"rotate",null),s([xe()],Ee.prototype,"fill",null),s([xe()],Ee.prototype,"stroke",null),s([xe()],Ee.prototype,"clip",null),s([xe()],Ee.prototype,"fillRect",null),s([xe()],Ee.prototype,"strokeRect",null),s([xe()],Ee.prototype,"clearRect",null),s([xe()],Ee.prototype,"beginPath",null),s([xe()],Ee.prototype,"moveTo",null),s([xe()],Ee.prototype,"lineTo",null),s([xe()],Ee.prototype,"bezierCurveTo",null),s([xe()],Ee.prototype,"quadraticCurveTo",null),s([xe()],Ee.prototype,"closePath",null),s([xe()],Ee.prototype,"arc",null),s([xe()],Ee.prototype,"arcTo",null),s([xe()],Ee.prototype,"ellipse",null),s([xe()],Ee.prototype,"rect",null),s([xe()],Ee.prototype,"roundRect",null),s([xe()],Ee.prototype,"createConicGradient",null),s([xe()],Ee.prototype,"createLinearGradient",null),s([xe()],Ee.prototype,"createPattern",null),s([xe()],Ee.prototype,"createRadialGradient",null),s([xe()],Ee.prototype,"fillText",null),s([xe()],Ee.prototype,"measureText",null),s([xe()],Ee.prototype,"strokeText",null);const{copy:Pe,multiplyParent:Se,pixelScale:Be}=Z,{round:Te}=Math,ke=new Gt,Re=new Gt,Ce={width:1,height:1,pixelRatio:1},Le=["width","height","pixelRatio"];class De extends Ee{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=Ce),this.manager=e,this.innerId=m.create(m.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||te.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;g.copyAttrs(s,t,Le),Le.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Se(t,e,n),Be(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Te(n.e-.5)+.5,n.f=Te(n.f-.5)+.5):(n.e=Te(n.e),n.f=Te(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Re):i=ke,this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(ke.x,ke.y,ke.width,ke.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,ke.x,ke.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(ke.x,ke.y,ke.width,ke.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(ke.x,ke.y,ke.width,ke.height),i&&(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,i){this.copyToPixelBounds(ke,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Re,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ce.canvas(Object.assign({},i));return n.save(),t&&(Pe(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}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 Ae={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Oe={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},Oe),Me={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Fe={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},We=Object.assign(Object.assign({},Fe),Oe),Ue=Ie,Ne={};for(let t in Ue)Ne[Ue[t]]=t;const ze={};for(let t in Ue)ze[Ue[t]]=Me[t];const Ye={drawRoundRect(t,e,i,s,n,r){const o=I.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Xe,cos:He,hypot:je,atan2:Ve,ceil:Ge,abs:qe,PI:Ke,sqrt:Ze,pow:$e}=Math,{setPoint:Je,addPoint:Qe}=mt,{set:ti,toNumberPoints:ei}=ht,{M:ii,L:si,C:ni,Q:ri,Z:oi}=Ie,ai={},hi={points(t,e,i,s){let n=ei(e);if(t.push(ii,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,_,g,f,y,m,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=o-e,g=a-r,f=Ze($e(_,2)+$e(g,2)),y=Ze($e(h-o,2)+$e(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(ri,d,c,o,a):(_||g)&&t.push(ni,u,p,d,c,o,a),u=o+y*h,p=a+y*l);s||t.push(ri,u,p,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(si,n[e],n[e+1]);s&&t.push(oi)},rect(t,e,i,s,n){Ae.creator.path=t,Ae.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){Ae.creator.path=[],Ye.drawRoundRect(Ae.creator,e,i,s,n,r),t.push(...Ae.convertToCanvasData(Ae.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,p=r-s,_=o-n;let g=Ve(u,c),f=Ve(_,p);const y=je(c,u),m=je(p,_);let v=f-g;if(v<0&&(v+=W),y<1e-12||m<1e-12||v<1e-12||qe(v-Ke)<1e-12)return t&&t.push(si,s,n),h&&(Je(h,e,i),Qe(h,s,n)),d&&ti(d,e,i),void(l&&ti(l,s,n));const w=c*_-p*u<0,x=w?-1:1,b=a/He(v/2),E=s+b*He(g+v/2+U*x),P=n+b*Xe(g+v/2+U*x);return g-=U*x,f-=U*x,ci(t,E,P,a,a,0,g/F,f/F,w,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ci(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*F,p=Xe(u),_=He(u);let g=o*F,f=a*F;g>Ke&&(g-=W),f<0&&(f+=W);let y=f-g;y<0?y+=W:y>W&&(y-=W),h&&(y-=W);const m=Ge(qe(y/U)),v=y/m,w=Xe(v/4),x=8/3*w*w/Xe(v/2);f=g+v;let b,E,P,S,B,T,k,R,C=He(g),L=Xe(g),D=P=_*s*C-p*n*L,A=S=p*s*C+_*n*L,O=e+P,I=i+S;t&&t.push(t.length?si:ii,O,I),l&&Je(l,O,I),c&&ti(c,O,I);for(let r=0;r<m;r++)b=He(f),E=Xe(f),P=_*s*b-p*n*E,S=p*s*b+_*n*E,B=e+D-x*(_*s*L+p*n*C),T=i+A-x*(p*s*L-_*n*C),k=e+P+x*(_*s*E+p*n*b),R=i+S+x*(p*s*E-_*n*b),t&&t.push(ni,B,T,k,R,e+P,i+S),l&&di(e+D,i+A,B,T,k,R,e+P,i+S,l,!0),D=P,A=S,C=b,L=E,g=f,f+=v;d&&ti(d,e+P,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ni,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){di(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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):Je(h,t,e),Qe(h,o,a);for(let l=0,c=d.length;l<c;l++)li(d[l],t,e,i,s,n,r,o,a,ai),Qe(h,ai.x,ai.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*r+_*a,l.y=c*i+u*n+p*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return li(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:li,toTwoPointBounds:di,ellipse:ci}=hi,{sin:ui,cos:pi,sqrt:_i,atan2:gi}=Math,{ellipse:fi}=hi,yi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=r*F,_=ui(p),g=pi(p),f=-g*c-_*u,y=-g*u+_*c,m=s*s,v=n*n,w=y*y,x=f*f,b=m*v-m*w-v*x;let E=0;if(b<0){const t=_i(1-b/(m*v));s*=t,n*=t}else E=(o===a?-1:1)*_i(b/(m*w+v*x));const P=E*s*y/n,S=-E*n*f/s,B=gi((y-S)/n,(f-P)/s),T=gi((-y-S)/n,(-f-P)/s);let k=T-B;0===a&&k>0?k-=W:1===a&&k<0&&(k+=W);const R=e+c+g*P-_*S,C=i+u+_*P+g*S,L=k<0?1:0;d||te.ellipseToCurve?fi(t,R,C,s,n,r,B/F,T/F,L):s!==n||r?t.push(Ie.G,R,C,s,n,r,B/F,T/F,L):t.push(Ie.O,R,C,s,B/F,T/F,L)}},mi={toCommand:t=>[],toNode:t=>[]},{M:vi,m:wi,L:xi,l:bi,H:Ei,h:Pi,V:Si,v:Bi,C:Ti,c:ki,S:Ri,s:Ci,Q:Li,q:Di,T:Ai,t:Oi,A:Ii,a:Mi,Z:Fi,z:Wi,N:Ui,D:Ni,X:zi,G:Yi,F:Xi,O:Hi,P:ji,U:Vi}=Ie,{rect:Gi,roundRect:qi,arcTo:Ki,arc:Zi,ellipse:$i,quadraticCurveTo:Ji}=hi,{ellipticalArc:Qi}=yi,ts=se.get("PathConvert"),es={},is={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=ze[s],a+=s===n?" ":Ne[s];for(let s=1;s<i;s++)a+=I.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?We:Fe;for(let e=0,h=t.length;e<h;e++)s=t[e],$t[s]?("."===s&&(ss.dot&&(ns(o,r),r=""),ss.dot++),"0"===r&&"."!==s&&(ns(o,r),r=""),r+=s):Ie[s]?(r&&(ns(o,r),r=""),ss.name=Ie[s],ss.length=Me[s],ss.index=0,ns(o,ss.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&ns(o,r),r=s):r&&(ns(o,r),r=""),n=s;return r&&ns(o,r),i?is.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case wi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],p.push(vi,a,h),c+=3;break;case Pi:t[c+1]+=a;case Ei:a=t[c+1],p.push(xi,a,h),c+=2;break;case Bi:t[c+1]+=h;case Si:h=t[c+1],p.push(xi,a,h),c+=2;break;case bi:t[c+1]+=a,t[c+2]+=h;case xi:a=t[c+1],h=t[c+2],p.push(xi,a,h),c+=3;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ri;case Ri:o=r===Ti||r===Ri,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(Ti,l,d,i,s,a,h),c+=5;break;case ki:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ti;case Ti:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Ti,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Oi:t[c+1]+=a,t[c+2]+=h,n=Ai;case Ai:o=r===Li||r===Ai,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Ji(p,a,h,i,s,t[c+1],t[c+2]):p.push(Li,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Li;case Li:i=t[c+1],s=t[c+2],e?Ji(p,a,h,i,s,t[c+3],t[c+4]):p.push(Li,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Mi:t[c+6]+=a,t[c+7]+=h;case Ii:Qi(p,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 Wi:case Fi:p.push(Fi),c++;break;case Ui:a=t[c+1],h=t[c+2],e?Gi(p,a,h,t[c+3],t[c+4]):rs(p,t,c,5),c+=5;break;case Ni:a=t[c+1],h=t[c+2],e?qi(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):rs(p,t,c,9),c+=9;break;case zi:a=t[c+1],h=t[c+2],e?qi(p,a,h,t[c+3],t[c+4],t[c+5]):rs(p,t,c,6),c+=6;break;case Yi:$i(e?p:rs(p,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,es),a=es.x,h=es.y,c+=9;break;case Xi:e?$i(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):rs(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Hi:Zi(e?p:rs(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,es),a=es.x,h=es.y,c+=7;break;case ji:e?Zi(p,t[c+1],t[c+2],t[c+3],0,360,!1):rs(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Vi:Ki(e?p:rs(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,es),a=es.x,h=es.y,c+=6;break;default:return ts.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){if(t[0].name.length>1)return mi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vi,t.x,t.y);break;case"L":e.push(xi,t.x,t.y);break;case"C":e.push(Ti,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Li,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Fi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ss.index===ss.length&&(ss.index=1,t.push(ss.name)),t.push(Number(e)),ss.index++,ss.dot=0}},{current:ss,pushData:ns,copyData:rs}=is,{M:os,L:as,C:hs,Q:ls,Z:ds,N:cs,D:us,X:ps,G:_s,F:gs,O:fs,P:ys,U:ms}=Ie,{getMinDistanceFrom:vs,getRadianFrom:ws}=ht,{tan:xs,min:bs,abs:Es}=Math,Ps={},Ss={beginPath(t){t.length=0},moveTo(t,e,i){t.push(os,e,i)},lineTo(t,e,i){t.push(as,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(hs,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ls,e,i,s,n)},closePath(t){t.push(ds)},rect(t,e,i,s,n){t.push(cs,e,i,s,n)},roundRect(t,e,i,s,n,r){if(d(r))t.push(ps,e,i,s,n,r);else{const o=I.fourNumber(r);o?t.push(us,e,i,s,n,...o):t.push(cs,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,h,l){if(s===n)return Ts(t,e,i,s,o,h,l);a(r)?t.push(gs,e,i,s,n):(a(o)&&(o=0),a(h)&&(h=360),t.push(_s,e,i,s,n,r,o,h,l?1:0))},arc(t,e,i,s,n,r,o){a(n)?t.push(ys,e,i,s):(a(n)&&(n=0),a(r)&&(r=360),t.push(fs,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,a,h,l){if(!o(a)){const t=vs(a,h,e,i,s,n)/(l?1:2);r=bs(r,bs(t,t*Es(xs(ws(a,h,e,i,s,n)/2))))}t.push(ms,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,h,l){hi.ellipse(null,e,i,s,n,a(r)?0:r,a(o)?0:o,a(h)?360:h,l,null,null,Ps),t.push(os,Ps.x,Ps.y),Bs(t,e,i,s,n,r,o,h,l)},drawArc(t,e,i,s,n,r,o){hi.arc(null,e,i,s,a(n)?0:n,a(r)?360:r,o,null,null,Ps),t.push(os,Ps.x,Ps.y),Ts(t,e,i,s,n,r,o)},drawPoints(t,e,i,s){hi.points(t,e,i,s)}},{ellipse:Bs,arc:Ts}=Ss,{moveTo:ks,lineTo:Rs,quadraticCurveTo:Cs,bezierCurveTo:Ls,closePath:Ds,beginPath:As,rect:Os,roundRect:Is,ellipse:Ms,arc:Fs,arcTo:Ws,drawEllipse:Us,drawArc:Ns,drawPoints:zs}=Ss;class Ys{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?Ae.parse(t):t:[],this}beginPath(){return As(this.__path),this.paint(),this}moveTo(t,e){return ks(this.__path,t,e),this.paint(),this}lineTo(t,e){return Rs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ls(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ds(this.__path),this.paint(),this}rect(t,e,i,s){return Os(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Is(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ms(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Fs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Ws(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Us(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Ns(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return zs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Xs,L:Hs,C:js,Q:Vs,Z:Gs,N:qs,D:Ks,X:Zs,G:$s,F:Js,O:Qs,P:tn,U:en}=Ie,sn=se.get("PathDrawer"),nn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Xs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Hs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case js:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Vs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.closePath(),s+=1;break;case qs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Zs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*F,e[s+6]*F,e[s+7]*F,e[s+8]),s+=9;break;case Js:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,W,!1),s+=5;break;case Qs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*F,e[s+5]*F,e[s+6]),s+=7;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],0,W,!1),s+=4;break;case en:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sn.error(`command: ${i} [index:${s}]`,e)}}},{M:rn,L:on,C:an,Q:hn,Z:ln,N:dn,D:cn,X:un,G:pn,F:_n,O:gn,P:fn,U:yn}=Ie,{toTwoPointBounds:mn,toTwoPointBoundsByQuadraticCurve:vn,arcTo:wn,arc:xn,ellipse:bn}=hi,{addPointBounds:En,copy:Pn,addPoint:Sn,setPoint:Bn,addBounds:Tn,toBounds:kn}=mt,Rn=se.get("PathBounds");let Cn,Ln,Dn;const An={},On={},In={},Mn={toBounds(t,e){Mn.toTwoPointBounds(t,On),kn(On,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Bn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===ln||o===an||o===hn?Bn(e,h,l):Bn(e,t[a+1],t[a+2])),o){case rn:case on:h=t[a+1],l=t[a+2],Sn(e,h,l),a+=3;break;case an:n=t[a+5],r=t[a+6],mn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,An),En(e,An),h=n,l=r,a+=7;break;case hn:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],vn(h,l,i,s,n,r,An),En(e,An),h=n,l=r,a+=5;break;case ln:a+=1;break;case dn:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=5;break;case cn:case un:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=o===cn?9:6;break;case pn:bn(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],An,In),0===a?Pn(e,An):En(e,An),h=In.x,l=In.y,a+=9;break;case _n:h=t[a+1],l=t[a+2],Ln=t[a+3],Dn=t[a+4],Tn(e,h-Ln,l-Dn,2*Ln,2*Dn),h+=Ln,a+=5;break;case gn:xn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],An,In),0===a?Pn(e,An):En(e,An),h=In.x,l=In.y,a+=7;break;case fn:h=t[a+1],l=t[a+2],Cn=t[a+3],Tn(e,h-Cn,l-Cn,2*Cn,2*Cn),h+=Cn,a+=4;break;case yn:wn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],An,In),0===a?Pn(e,An):En(e,An),h=In.x,l=In.y,a+=6;break;default:return void Rn.error(`command: ${o} [index:${a}]`,t)}}},{M:Fn,L:Wn,Z:Un}=Ie,{getCenterX:Nn,getCenterY:zn}=ht,{arcTo:Yn}=Ss,Xn={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,d=0,c=0,p=0,_=0,g=0;u(e)&&(e=e[0]||0);const f=t.length,y=9===f,m=[];for(;o<f;){switch(s=t[o],s){case Fn:l=_=t[o+1],d=g=t[o+2],o+=3,t[o]===Wn?(c=t[o+1],p=t[o+2],y?m.push(Fn,l,d):m.push(Fn,Nn(l,c),zn(d,p))):m.push(Fn,l,d);break;case Wn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Wn:Yn(m,a,h,t[o+1],t[o+2],e,_,g,y);break;case Un:Yn(m,a,h,l,d,e,_,g,y);break;default:m.push(Wn,a,h)}_=a,g=h;break;case Un:n!==Un&&(Yn(m,l,d,c,p,e,_,g,y),m.push(Un)),o+=1;break;default:r=ze[s];for(let e=0;e<r;e++)m.push(t[o+e]);o+=r}n=s}return s!==Un&&(m[1]=l,m[2]=d),m}};function Hn(t){return new Ys(t)}const jn=Hn();Ae.creator=Hn(),Ae.parse=is.parse,Ae.convertToCanvasData=is.toCanvasData;const{drawRoundRect:Vn}=Ye;function Gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Vn(this,t,e,i,s,n)})}(t)}const qn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Kn.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{}}}},Kn=qn;Kn.mineType=Kn.mimeType,Kn.alphaPixelTypes.forEach(t=>Kn.upperCaseTypeMap[t]=t.toUpperCase());const Zn=se.get("TaskProcessor");class $n{constructor(t){this.parallel=!0,this.time=1,this.id=m.create(m.TASK),this.task=t}run(){return n(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Zn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Jn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&g.assign(this.config,t),this.empty()}add(t,e,i){let s,n,r,a;const h=new $n(t);return h.parent=this,d(e)?a=e:e&&(n=e.parallel,s=e.start,r=e.time,a=e.delay,i||(i=e.canUse)),r&&(h.time=r),!1===n&&(h.parallel=!1),i&&(h.canUse=i),o(a)?this.push(h,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(h,s))},a)),this.isComplete=!1,h}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.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Qn=se.get("Resource"),tr={tasker:new Jn,queue:new Jn({parallel:1}),map:{},get isComplete(){return er.tasker.isComplete},set(t,e){er.map[t]&&Qn.repeat(t),er.map[t]=e},get:t=>er.map[t],remove(t){const e=er.map[t];e&&(e.destroy&&e.destroy(),delete er.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ce.image(s)),er.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){er.map={}}},er=tr,ir={maxRecycled:10,recycledList:[],patternTasker:tr.queue,get(t,e){let i=tr.get(t.url);return i||tr.set(t.url,i="film"===e?ce.film(t):ce.image(t)),i.use++,i},recycle(t){t.use--,setTimeout(()=>{t.use||(te.image.isLarge(t)?t.url&&tr.remove(t.url):(t.clearLevels(),sr.recycledList.push(t)))})},recyclePaint(t){sr.recycle(t.image)},clearRecycled(t){const e=sr.recycledList;(e.length>sr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&tr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>qn.alphaPixelTypes.some(e=>sr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+qn.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+qn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},sr=ir,{IMAGE:nr,create:rr}=m;class or{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return o(t)?te.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=rr(nr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}ir.isFormat("svg",t)&&(this.isSVG=!0),ir.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,tr.tasker.add(()=>n(this,void 0,void 0,function*(){return yield te.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,r,o,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=te.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=te.canvas.createPattern(t,e);return te.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,r,o,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}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 ar(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function hr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function lr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function dr(t,e){return(i,s)=>ur(i,s,t,e&&e(s))}function cr(t){return t}function ur(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};ar(t,e,Object.assign(n,s||{})),Nr(t,e,i)}function pr(t){return dr(t)}function _r(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function gr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function fr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),xr(this))}}))}function yr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function mr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function vr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&xr(this)}}))}function wr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(xr(this),this.__.__removeNaturalSize())}}))}function xr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function br(t){return dr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),xr(this)}}))}const Er=vr;function Pr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i)&&(Sr(this),e&&(this.__.__useStroke=!0))}}))}function Sr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&xr(t)}const Br=Pr;function Tr(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function kr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Rr(t){return dr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;g.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Cr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Dr(this)}}))}function Lr(t){return dr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Ar(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Ar(this,t,e,i),this.mask&&Dr(this)}}))}function Dr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Ar(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||xr(t))}function Or(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Ir(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Mr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===se.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Wr(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Ur(t){return(e,i)=>{ar(e,"__DataProcessor",{get:()=>t})}}function Nr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=lr(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(p(i)){const t=_(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:g.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=hr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),ar(s,e,a)}const zr=new se("rewrite"),Yr=[],Xr=["destroy","constructor"];function Hr(t){return(e,i)=>{Yr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function jr(){return t=>{Vr()}}function Vr(t){Yr.length&&(Yr.forEach(e=>{t&&zr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Yr.length=0)}function Gr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Xr.includes(s)||e&&e.includes(s)))if(t.prototype){hr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function qr(){return t=>{pe.register(t)}}function Kr(){return t=>{fe.register(t)}}setTimeout(()=>Vr(!0));const{copy:Zr,toInnerPoint:$r,toOuterPoint:Jr,scaleOfOuter:Qr,rotateOfOuter:to,skewOfOuter:eo,multiplyParent:io,divideParent:so,getLayout:no}=Z,ro={},{round:oo}=Math,ao={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),co(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)lo(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)uo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&uo(t),t.__updateChange()},updateAllChange(t){if(_o(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)po(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,r){s||(s=t.__nowWorld),t.__worldFlipped||te.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=p(e)?Object.assign({},e):{x:e,y:i};s?Jr(t.localTransform,r,r,!0):t.parent&&$r(t.parent.scrollWorldTransform,r,r,!0),ho.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){p(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=oo(e),i=oo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){ho.zoomOfLocal(t,go(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(d(s)||(s&&(r=s),s=i),Zr(ro,o),Qr(ro,e,i,s),ho.hasHighPosition(t))ho.setTransform(t,ro,n,r);else{const e=t.x+ro.e-o.e,a=t.y+ro.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){ho.rotateOfLocal(t,go(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Zr(ro,n),to(ro,e,i),ho.hasHighPosition(t)?ho.setTransform(t,ro,!1,s):t.set({x:t.x+ro.e-n.e,y:t.y+ro.f-n.f,rotation:I.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){ho.skewOfLocal(t,go(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Zr(ro,t.__localMatrix),eo(ro,e,i,s),ho.setTransform(t,ro,n,r)},transformWorld(t,e,i,s){Zr(ro,t.worldTransform),io(ro,e),t.parent&&so(ro,t.parent.scrollWorldTransform),ho.setTransform(t,ro,i,s)},transform(t,e,i,s){Zr(ro,t.localTransform),io(ro,e),ho.setTransform(t,ro,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&ho.getInnerOrigin(t,n.origin),o=no(e,r,n.around&&ho.getInnerOrigin(t,n.around));if(ho.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=ho.getInnerOrigin(t,n.origin);ht.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Qr(i,ho.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ht.tempToOuterOf(ho.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Et.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Zr(ro,t.worldTransform),so(ro,e.scrollWorldTransform),i?ro:Object.assign({},ro)),drop(t,e,i,s){t.setTransform(ho.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||ho.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),te.requestRender(()=>ho.animateMove(t,e,i))}}},ho=ao,{updateAllMatrix:lo,updateMatrix:co,updateAllWorldOpacity:uo,updateAllChange:po,updateChange:_o}=ho;function go(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const fo={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)=>mo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>mo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>mo(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 yo;function mo(t,e){return e||(yo=0),t.__.mask&&(yo=1),yo<0?null:(yo&&(yo=-1),!0)}const{updateBounds:vo}=ao,wo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),xo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)bo(e[t],e)},updateBounds(t,e){const i=[t];bo(t,i),Eo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)vo(s[t]);e&&e===i||vo(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Po(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&So(t,e,i,s,n,r,o)}},{pushAllChildBranch:xo,pushAllBranchStack:bo,updateBoundsByBranchStack:Eo,move:Po,scale:So}=wo,Bo={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:To,updateBounds:ko}=ao,{toOuterOf:Ro,getPoints:Co,copy:Lo}=Xt,Do="_localContentBounds",Ao="_worldContentBounds",Oo="_worldBoxBounds",Io="_worldStrokeBounds";class Mo{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return Ro(this.contentBounds,this.leaf.__localMatrix,this[Do]||(this[Do]={})),this[Do]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ro(this.contentBounds,this.leaf.__world,this[Ao]||(this[Ao]={})),this[Ao]}get worldBoxBounds(){return Ro(this.boxBounds,this.leaf.__world,this[Oo]||(this[Oo]={})),this[Oo]}get worldStrokeBounds(){return Ro(this.strokeBounds,this.leaf.__world,this[Io]||(this[Io]={})),this[Io]}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 ko(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,te.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return Z.defaultMatrix;case"page":t=e.zoomLayer;default:return To(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Gt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=Z.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=To(s,e,!0)}if(o||(o=Z.getLayout(r)),Lo(o,a),ht.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Co(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Fo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&te.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&te.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&te.event.stop(this.origin)}}class Wo extends Fo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Wo.ADD="child.add",Wo.REMOVE="child.remove",Wo.CREATED="created",Wo.MOUNTED="mounted",Wo.UNMOUNTED="unmounted",Wo.DESTROY="destroy";const Uo="property.scroll";class No extends Fo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}No.CHANGE="property.change",No.LEAFER_CHANGE="property.leafer_change",No.SCROLL=Uo;const zo={scrollX:Uo,scrollY:Uo};class Yo extends Fo{constructor(t,e){super(t),Object.assign(this,e)}}Yo.LOAD="image.load",Yo.LOADED="image.loaded",Yo.ERROR="image.error";class Xo extends Fo{static checkHas(t,e,i){"on"===i?e===Go?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ho)||t.hasEvent(jo)||t.hasEvent(Vo),t.__hasWorldEvent=t.hasEvent(Go))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ho,t),"inner"===e&&t.emit(jo,t)),t.emit(Vo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Go,this)}}Xo.RESIZE="bounds.resize",Xo.INNER="bounds.inner",Xo.LOCAL="bounds.local",Xo.WORLD="bounds.world";const{RESIZE:Ho,INNER:jo,LOCAL:Vo,WORLD:Go}=Xo,qo={};[Ho,jo,Vo,Go].forEach(t=>qo[t]=1);class Ko extends Fo{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){p(t)?(super(Ko.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Ko.RESIZE="resize";class Zo extends Fo{constructor(t,e){super(t),this.data=e}}Zo.REQUEST="watch.request",Zo.DATA="watch.data";class $o extends Fo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}$o.REQUEST="layout.request",$o.START="layout.start",$o.BEFORE="layout.before",$o.LAYOUT="layout",$o.AFTER="layout.after",$o.AGAIN="layout.again",$o.END="layout.end";class Jo extends Fo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Jo.REQUEST="render.request",Jo.CHILD_START="render.child_start",Jo.CHILD_END="render.child_end",Jo.START="render.start",Jo.BEFORE="render.before",Jo.RENDER="render",Jo.AFTER="render.after",Jo.AGAIN="render.again",Jo.END="render.end",Jo.NEXT="render.next";class Qo extends Fo{}Qo.START="leafer.start",Qo.BEFORE_READY="leafer.before_ready",Qo.READY="leafer.ready",Qo.AFTER_READY="leafer.after_ready",Qo.VIEW_READY="leafer.view_ready",Qo.VIEW_COMPLETED="leafer.view_completed",Qo.STOP="leafer.stop",Qo.RESTART="leafer.restart",Qo.END="leafer.end",Qo.UPDATE_MODE="leafer.update_mode",Qo.TRANSFORM="leafer.transform",Qo.MOVE="leafer.move",Qo.SCALE="leafer.scale",Qo.ROTATE="leafer.rotate",Qo.SKEW="leafer.skew";const{MOVE:ta,SCALE:ea,ROTATE:ia,SKEW:sa}=Qo,na={x:ta,y:ta,scaleX:ea,scaleY:ea,rotation:ia,skewX:sa,skewY:sa},ra={};class oa{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=aa(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(r=o[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):o[t]=[l],qo[t]&&Xo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=aa(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],qo[t]&&Xo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));p(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&fe.has(t)&&(e=fe.get(t,{type:t,target:this,current:this}));const s=aa(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function aa(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ra)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ra)}}const{on:ha,on_:la,off:da,off_:ca,once:ua,emit:pa,emitEvent:_a,hasEvent:ga,destroy:fa}=oa.prototype,ya={on:ha,on_:la,off:da,off_:ca,once:ua,emit:pa,emitEvent:_a,hasEvent:ga,destroyEventer:fa},ma=se.get("setAttr"),va={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||o(e)||(ma.warn(this.innerName,t,e),e=void 0),p(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new No(No.LEAFER_CHANGE,this,t,s,e));const i=na[t];i&&(this.emitEvent(new Qo(i,this)),this.emitEvent(new Qo(Qo.TRANSFORM,this)))}this.emitPropertyEvent(No.CHANGE,t,s,e);const i=zo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new No(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:wa,multiplyParent:xa,translateInner:ba,defaultWorld:Ea}=Z,{toPoint:Pa,tempPoint:Sa}=Et,Ba={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;xa(this.__local||e,t?t.__scrollWorld||t.__world:Ea,i,!!e.affectScaleOrRotation,n),s&&ba(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(wa(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Pa(i.around||i.origin,t.boxBounds,Sa),ba(e,-Sa.x,-Sa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ta,updateAllMatrix:ka}=ao,{updateBounds:Ra}=wo,{toOuterOf:Ca,copyAndSpread:La,copy:Da}=Xt,{toBounds:Aa}=Mn,Oa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ca(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Xo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Xo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ca(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ca(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ca(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Aa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ka(this),Ra(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ka(this),Ra(this,this))):Ta(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;La(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;d(i)&&i<=0?Da(e.renderBounds,e.strokeBounds):La(e.renderBounds,e.boxBounds,i)}},Ia={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ao.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);se.showBounds&&se.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ma}=fo,{hasSize:Fa}=Xt,Wa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Fa(i)){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 n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,r=s.length;n<r;n++)i=s[n],Ma(i,e)||(i.__.complex?i.__renderComplex(t,e):i.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ma(i[s],e)||i[s].__clip(t,e)}}},Ua={},{LEAF:Na,create:za}=m,{stintSet:Ya}=g,{toInnerPoint:Xa,toOuterPoint:Ha,multiplyParent:ja}=Z,{toOuterOf:Va}=Xt,{copy:Ga,move:qa}=ht,{moveLocal:Ka,zoomOfLocal:Za,rotateOfLocal:$a,skewOfLocal:Ja,moveWorld:Qa,zoomOfWorld:th,rotateOfWorld:eh,skewOfWorld:ih,transform:sh,transformWorld:nh,setTransform:rh,getFlipTransform:oh,getLocalOrigin:ah,getRelativeWorld:hh,drop:lh}=ao;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 y}get __LayoutProcessor(){return Mo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=za(Na),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Wo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Wo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Wo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Wo.MOUNTED)):this.__emitLifeEvent(Wo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return ja(i,t.matrix,e,void 0,i),Va(this.__layout.renderBounds,e,e),Ya(e,"half",i.half),Ya(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=ir.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Ua.scaleX=i,Ua.scaleY=s,Ua}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?hh(this,e):this.worldTransform,n=i?t:{};return Va(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ga(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ga(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Xa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ha(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return qa(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return qa(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){rh(this,t,e,i)}transform(t,e,i){sh(this,t,e,i)}move(t,e,i){Ka(this,t,e,i)}moveInner(t,e,i){Qa(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Za(this,ah(this,t),e,i,s,n)}rotateOf(t,e,i){$a(this,ah(this,t),e,i)}skewOf(t,e,i,s,n){Ja(this,ah(this,t),e,i,s,n)}transformWorld(t,e,i){nh(this,t,e,i)}moveWorld(t,e,i){Qa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){th(this,t,e,i,s,n)}rotateOfWorld(t,e){eh(this,t,e)}skewOfWorld(t,e,i,s,n){ih(this,t,e,i,s,n)}flip(t,e){sh(this,oh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,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){}__renderComplex(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return de.need("path")}getMotionPoint(t){return de.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){lh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Nr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=vr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Wo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Wo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=s([Gr(va),Gr(Ba),Gr(Oa),Gr(ya),Gr(Ia)],t.Leaf);const{setListWithFn:dh}=Xt,{sort:ch}=wo,{localBoxBounds:uh,localStrokeBounds:ph,localRenderBounds:_h,maskLocalBoxBounds:gh,maskLocalStrokeBounds:fh,maskLocalRenderBounds:yh}=fo,mh=new se("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){dh(e||this.__layout.boxBounds,this.children,this.__hasMask?gh:uh)}__updateStrokeBounds(t){dh(t||this.__layout.strokeBounds,this.children,this.__hasMask?fh:ph)}__updateRenderBounds(t){dh(t||this.__layout.renderBounds,this.children,this.__hasMask?yh:_h)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(ch),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return mh.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=pe.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Wo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Wo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Wo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Wo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Wo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=s([Gr(Wa)],t.Branch);class vh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new vh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class wh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const xh=se.get("LeaferCanvas");class bh extends De{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none",this.view.classList.add("leafer-canvas-view")}te.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=h(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else xh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.unreal||(this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),xh.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()),te.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=te.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:n,height:r}=this.autoBounds.getBoundsFrom(t),o={width:n,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:te.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};g.copyAttrs(e,this,Le),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new Ko(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){let t=this.view;t&&t.remove(),t=this.view=document.createElement("div"),this.parentView.appendChild(this.view),t.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:t}=this;t&&(this.stopAutoLayout(),this.stopListenPixelRatio(),t.parentElement&&t.remove(),super.destroy())}}function Eh(t,e){te.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=qn.mimeType(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,qn.mimeType(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL(qn.mimeType(qn.fileType(e)),i);return te.origin.download(s,e)},download(t,e){return n(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(t,e,i)=>new Promise((i,s)=>{const n=new te.origin.Image;e&&(n.setAttribute("crossOrigin",e),n.crossOrigin=e),n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.src=te.image.getRealURL(t)}),loadContent(t){return n(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},te.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},te.canvas=ce.canvas(),te.conicGradientSupport=!!te.canvas.context.createConicGradient}Gn(CanvasRenderingContext2D.prototype),Gn(Path2D.prototype),Object.assign(ce,{canvas:(t,e)=>new bh(t,e),image:t=>new or(t)}),te.name="web",te.isMobile="ontouchstart"in window,te.requestRender=function(t){window.requestAnimationFrame(t)},ar(te,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Ph}=navigator;Ph.indexOf("Firefox")>-1?(te.conicGradientRotate90=!0,te.intWheelDeltaY=!0,te.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(te.fullImageShadow=!0),Ph.indexOf("Windows")>-1?(te.os="Windows",te.intWheelDeltaY=!0):Ph.indexOf("Mac")>-1?te.os="Mac":Ph.indexOf("Linux")>-1&&(te.os="Linux");class Sh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new vh;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 vh,this.target=t,e&&(this.config=g.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Jo.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Wo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Zo(Zo.DATA,{updatedList:this.updatedList})),this.__updatedList=new vh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[No.CHANGE,this.__onAttrChange,this],[[Wo.ADD,Wo.REMOVE],this.__onChildEvent,this],[Zo.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:Th,updateChange:kh}=ao,{pushAllChildBranch:Rh,pushAllParent:Ch}=wo;const{worldBounds:Lh}=fo;class Dh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,u(t)&&(t=new vh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Lh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Lh),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:Ah,updateAllChange:Oh}=ao,Ih=se.get("Layouter");class Mh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new wh,this.target=t,e&&(this.config=g.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($o.START),this.layoutOnce(),t.emitEvent(new $o($o.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(Zo.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=ae.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=$o,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new $o(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Bh(t,!0),e.add(t),t.isBranch&&Rh(t,e),Ch(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ch(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Th(s[t])}Th(i)}})}(this.__levelList),function(t){t.list.forEach(kh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new $o(r,a,this.times)),i.emitEvent(new $o(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ae.end(e)}fullLayout(){const t=ae.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=$o,r=this.getBlocks(new vh(e));e.emitEvent(new $o(i,r,this.times)),Mh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new $o(s,r,this.times)),e.emitEvent(new $o(n,r,this.times)),this.addBlocks(r),ae.end(t)}static fullLayout(t){Ah(t,!0),t.isBranch?wo.updateBounds(t):ao.updateBounds(t),Oh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Dh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Dh(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_([[$o.REQUEST,this.layout,this],[$o.AGAIN,this.layoutAgain,this],[Zo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Fh=se.get("Renderer");class Wh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=g.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit($o.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Jo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Jo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Jo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Fh.log(e.innerName,"---\x3e");try{this.emitRender(Jo.START),this.renderOnce(t),this.emitRender(Jo.END,this.totalBounds),ir.clearRecycled()}catch(t){this.rendering=!1,Fh.error(t)}Fh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Fh.warn("rendering");if(this.times>3)return Fh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(Jo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Jo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Jo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Jo.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=ae.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Gt(s);i.save(),s.spread(Wh.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),this.__render(s,n),i.restore(),ae.end(e)}fullRender(){const t=ae.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ae.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),se.showRepaint&&se.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),te.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Gt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return te.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};te.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Gt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Fh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new Jo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Jo.REQUEST,this.update,this],[$o.END,this.__onLayoutEnd,this],[Jo.AGAIN,this.renderAgain,this],[Ko.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Wh.clipSpread=10;const Uh={},{copyRadiusPoint:Nh}=ht,{hitRadiusPoint:zh}=Xt;class Yh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new vh(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new vh;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||ao.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ao.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>ao.worldHittable(t))}getPath(t){const e=new vh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new vh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new vh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=zh(i.__world,n.hitRadius?Nh(Uh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Xh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Yh(this.target=t,this),this.finder=ce.finder&&ce.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return te.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):de.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Hh(t){return dr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function jh(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Vh(){return(t,e)=>{const i="_"+e;ar(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ce,{watcher:(t,e)=>new Sh(t,e),layouter:(t,e)=>new Mh(t,e),renderer:(t,e,i)=>new Wh(t,e,i),selector:(t,e)=>new Xh(t,e)}),te.layout=Mh.fullLayout,te.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new vh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Gh={},qh={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}},Kh=Zt,Zh={},$h={},Jh={},Qh={},tl={},el={apply(){de.need("filter")}},il={},sl={setStyleName:()=>de.need("state"),set:()=>de.need("state")},nl={list:{},register(t,e){nl.list[t]=e},get:t=>nl.list[t]},{parse:rl,objectToCanvasData:ol}=is,{stintSet:al}=g,{hasTransparent:hl}=qh,ll={originPaint:{}},dl=se.get("UIData");class cl extends y{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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,dl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,dl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(al(this,"__isTransparentFill",hl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):p(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(al(this,"__isTransparentStroke",hl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):p(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&p(t[0])?(this.__setInput("path",t),this._path=e?rl(t):ol(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){ul(this,"shadow",t)}setInnerShadow(t){ul(this,"innerShadow",t)}setFilter(t){ul(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&$h.compute("fill",this.__leaf),e&&$h.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=ll)):(this.__isStrokes=!0,this._stroke||(this._stroke=ll))}__removePaint(t,e){e&&this.__removeInput(t),Jh.recycleImage(t,this),"fill"===t?(al(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(al(this,"__isAlphaPixelStroke",void 0),al(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function ul(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class pl extends cl{}class _l extends pl{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 gl extends pl{__getInputData(t,e){const i=super.__getInputData(t,e);return Le.forEach(t=>delete i[t]),i}}class fl extends _l{}class yl extends cl{get __usePathBox(){return this.points||this.__pathInputed}}class ml extends cl{get __boxStroke(){return!this.__pathInputed}}class vl extends cl{get __boxStroke(){return!this.__pathInputed}}class wl extends yl{}class xl extends cl{}class bl extends cl{get __pathInputed(){return 2}}class El extends pl{}const Pl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Sl extends cl{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=Pl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=pe.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Bl extends ml{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Tl extends ml{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:kl,add:Rl}=S,Cl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=kl(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=tl.getShadowRenderSpread(this,e)),s&&(t=kl(t,s)),r&&(t=Rl(t,el.getSpread(r))),o&&(t=Rl(t,o)),a&&(t=Rl(t,a));let l=t;return i&&(l=kl(l,tl.getInnerShadowSpread(this,i))),n&&(l=kl(l,n)),this.__layout.renderShapeSpread=l,h?kl(h.__updateRenderSpread(),t):t}},{stintSet:Ll}=g,Dl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ll(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ll(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ll(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!tl.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Ll(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Al(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=$h.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&tl.shadow(this,t,h),a&&(s.__isStrokes?$h.strokes(r,this,t,e):$h.stroke(r,this,t,e)),n&&(s.__isFills?$h.fills(n,this,t,e):$h.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&tl.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?$h.strokes(r,this,t,e):$h.stroke(r,this,t,e)),c&&el.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?$h.strokes(r,this,t,e):$h.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,qh.string(e.color))}n&&(s.__isFills?$h.fills(n,this,t,e):$h.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?$h.strokes(r,this,t,e):$h.stroke(r,this,t,e))}}else s.__pathForRender?Al(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?$h.fills(s,this,t,e):$h.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?$h.strokes(n,this,t,e):$h.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 Al(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&$h.stroke(n,t,e,i),s&&$h.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&$h.stroke(n,t,e,i)}const Ol={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Il,Ml;t.UI=Il=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){I.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 jn.set(this.path=t||[]),t||this.__drawPathByBox(jn),jn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return h(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return de.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return de.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(jn.set(i=[]),this.__drawPathByBox(jn,!e)),t?is.toCanvasData(i,!0):i}getPathString(t,e,i){return is.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||il.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Xn.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,!0)}__drawPathByData(t,e,i){e?nn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,r,d(e)?[e]:e)}else t.rect(i,s,n,r);t.closePath()}drawImagePlaceholder(t,e,i){$h.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),de.need("animate")}killAnimate(t,e){}export(t,e){return de.need("export")}syncExport(t,e){return de.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Il.one(e)}static one(t,e,i,s,n){return pe.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){qr()(this)}static registerData(t){Ur(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},s([Ur(cl)],t.UI.prototype,"__",void 0),s([Vh()],t.UI.prototype,"zoomLayer",void 0),s([pr("")],t.UI.prototype,"id",void 0),s([pr("")],t.UI.prototype,"name",void 0),s([pr("")],t.UI.prototype,"className",void 0),s([kr("pass-through")],t.UI.prototype,"blendMode",void 0),s([Cr(1)],t.UI.prototype,"opacity",void 0),s([Lr(!0)],t.UI.prototype,"visible",void 0),s([kr(!1)],t.UI.prototype,"locked",void 0),s([Rr(!1)],t.UI.prototype,"dim",void 0),s([Rr(!1)],t.UI.prototype,"dimskip",void 0),s([Or(0)],t.UI.prototype,"zIndex",void 0),s([Ir(!1)],t.UI.prototype,"mask",void 0),s([Mr(!1)],t.UI.prototype,"eraser",void 0),s([_r(0,!0)],t.UI.prototype,"x",void 0),s([_r(0,!0)],t.UI.prototype,"y",void 0),s([vr(100,!0)],t.UI.prototype,"width",void 0),s([vr(100,!0)],t.UI.prototype,"height",void 0),s([yr(1,!0)],t.UI.prototype,"scaleX",void 0),s([yr(1,!0)],t.UI.prototype,"scaleY",void 0),s([mr(0,!0)],t.UI.prototype,"rotation",void 0),s([mr(0,!0)],t.UI.prototype,"skewX",void 0),s([mr(0,!0)],t.UI.prototype,"skewY",void 0),s([_r(0,!0)],t.UI.prototype,"offsetX",void 0),s([_r(0,!0)],t.UI.prototype,"offsetY",void 0),s([gr(0,!0)],t.UI.prototype,"scrollX",void 0),s([gr(0,!0)],t.UI.prototype,"scrollY",void 0),s([fr()],t.UI.prototype,"origin",void 0),s([fr()],t.UI.prototype,"around",void 0),s([pr(!1)],t.UI.prototype,"lazy",void 0),s([wr(1)],t.UI.prototype,"pixelRatio",void 0),s([Tr(0)],t.UI.prototype,"renderSpread",void 0),s([br()],t.UI.prototype,"path",void 0),s([Er()],t.UI.prototype,"windingRule",void 0),s([Er(!0)],t.UI.prototype,"closed",void 0),s([vr(0)],t.UI.prototype,"padding",void 0),s([vr(!1)],t.UI.prototype,"lockRatio",void 0),s([vr()],t.UI.prototype,"widthRange",void 0),s([vr()],t.UI.prototype,"heightRange",void 0),s([pr(!1)],t.UI.prototype,"draggable",void 0),s([pr()],t.UI.prototype,"dragBounds",void 0),s([pr("auto")],t.UI.prototype,"dragBoundsType",void 0),s([pr(!1)],t.UI.prototype,"editable",void 0),s([Fr(!0)],t.UI.prototype,"hittable",void 0),s([Fr("path")],t.UI.prototype,"hitFill",void 0),s([Br("path")],t.UI.prototype,"hitStroke",void 0),s([Fr(!1)],t.UI.prototype,"hitBox",void 0),s([Fr(!0)],t.UI.prototype,"hitChildren",void 0),s([Fr(!0)],t.UI.prototype,"hitSelf",void 0),s([Fr()],t.UI.prototype,"hitRadius",void 0),s([Wr("")],t.UI.prototype,"cursor",void 0),s([kr()],t.UI.prototype,"fill",void 0),s([Br(void 0,!0)],t.UI.prototype,"stroke",void 0),s([Br("inside")],t.UI.prototype,"strokeAlign",void 0),s([Br(1,!0)],t.UI.prototype,"strokeWidth",void 0),s([Br(!1)],t.UI.prototype,"strokeWidthFixed",void 0),s([Br("none")],t.UI.prototype,"strokeCap",void 0),s([Br("miter")],t.UI.prototype,"strokeJoin",void 0),s([Br()],t.UI.prototype,"dashPattern",void 0),s([Br(0)],t.UI.prototype,"dashOffset",void 0),s([Br(10)],t.UI.prototype,"miterLimit",void 0),s([Er(0)],t.UI.prototype,"cornerRadius",void 0),s([Er()],t.UI.prototype,"cornerSmoothing",void 0),s([Hh()],t.UI.prototype,"shadow",void 0),s([Hh()],t.UI.prototype,"innerShadow",void 0),s([Hh()],t.UI.prototype,"blur",void 0),s([Hh()],t.UI.prototype,"backgroundBlur",void 0),s([Hh()],t.UI.prototype,"grayscale",void 0),s([Hh()],t.UI.prototype,"filter",void 0),s([kr()],t.UI.prototype,"placeholderColor",void 0),s([pr(100)],t.UI.prototype,"placeholderDelay",void 0),s([pr({})],t.UI.prototype,"data",void 0),s([Hr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Il=s([Gr(Cl),Gr(Dl),jr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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(){}},s([Ur(pl)],t.Group.prototype,"__",void 0),s([vr(0)],t.Group.prototype,"width",void 0),s([vr(0)],t.Group.prototype,"height",void 0),t.Group=s([Gr(t.Branch),qr()],t.Group);const Fl=se.get("Leafer");t.Leafer=Ml=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&&tr.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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),Ml.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,g.assign(s,t));const n=this.canvas=ce.canvas(s);this.__controllers.push(this.renderer=ce.renderer(this,n,s),this.watcher=ce.watcher(this,s),this.layouter=ce.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ce.selector(this),this.interaction=ce.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ce.hitCanvasManager()),this.canvasManager=new me,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Bo.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(Qo.RESTART):this.emitLeafer(Qo.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(Qo.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,Le);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Gt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=g.copyAttrs({},this.canvas,Le);e.resize(t),this.updateLazyBounds(),this.__onResize(new Ko(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,Le),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Le.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(Qo.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Le.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=g.copyAttrs({},s,Le);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__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(Qo.BEFORE_READY),this.emitLeafer(Qo.READY),this.emitLeafer(Qo.AFTER_READY),Bo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Qo.VIEW_READY),Bo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Bo.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(Qo.VIEW_COMPLETED),Bo.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return de.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Qo(t,this))}__listenEvents(){const t=ae.start("FirstCreate "+this.innerName);this.once([[Qo.START,()=>ae.end(t)],[$o.START,this.updateLazyBounds,this],[Jo.START,this.__onCreated,this],[Jo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Zo.DATA,this.__onWatchData,this],[$o.END,this.__onLayoutEnd,this],[Jo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ml.list.remove(this);try{this.stop(),this.emitLeafer(Qo.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.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{ir.clearRecycled()},100)}catch(t){Fl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new vh,s([Ur(gl)],t.Leafer.prototype,"__",void 0),s([vr()],t.Leafer.prototype,"pixelRatio",void 0),s([pr("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Ml=s([qr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},s([Ur(ml)],t.Rect.prototype,"__",void 0),t.Rect=s([Gr(Ol),jr(),qr()],t.Rect);const{add:Wl,includes:Ul,scroll:Nl}=Xt,zl=t.Rect.prototype,Yl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(Wl(a,r),Nl(a,i)),this.__updateRectRenderBounds(),t=!Ul(r,a),t&&"show"===o&&Wl(n,a)}else this.__updateRectRenderBounds();g.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))}},s([Ur(_l)],t.Box.prototype,"__",void 0),s([vr(100)],t.Box.prototype,"width",void 0),s([vr(100)],t.Box.prototype,"height",void 0),s([pr(!1)],t.Box.prototype,"resizeChildren",void 0),s([Tr("show")],t.Box.prototype,"overflow",void 0),s([Hr(zl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),s([Hr(zl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),s([Hr(zl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),s([Hr(zl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),s([Hr(zl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),s([Hr(zl.__updateChange)],t.Box.prototype,"__updateRectChange",null),s([Hr(zl.__render)],t.Box.prototype,"__renderRect",null),s([Hr(Yl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=s([jr(),qr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},s([Ur(fl)],t.Frame.prototype,"__",void 0),s([kr("#FFFFFF")],t.Frame.prototype,"fill",void 0),s([Tr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=s([qr()],t.Frame);const{moveTo:Xl,closePath:Hl,ellipse:jl}=Ss;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];let h;i?s||n?(i<1?jl(a,r,o,r*i,o*i,0,s,n,!1):h=!0,jl(a,r,o,r,o,0,n,s,!0)):(i<1&&(jl(a,r,o,r*i,o*i),Xl(a,t,o)),jl(a,r,o,r,o,0,360,0,!0)):s||n?(Xl(a,r,o),jl(a,r,o,r,o,0,s,n,!1)):jl(a,r,o,r,o),h||Hl(a),te.ellipseToCurve&&(this.__.path=this.getPath(!0))}},s([Ur(vl)],t.Ellipse.prototype,"__",void 0),s([Er(0)],t.Ellipse.prototype,"innerRadius",void 0),s([Er(0)],t.Ellipse.prototype,"startAngle",void 0),s([Er(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=s([qr()],t.Ellipse);const{sin:Vl,cos:Gl,PI:ql}=Math,{moveTo:Kl,lineTo:Zl,closePath:$l,drawPoints:Jl}=Ss;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Jl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;Kl(e,r,0);for(let t=1;t<n;t++)Zl(e,r+r*Vl(2*t*ql/n),o-o*Gl(2*t*ql/n));$l(e)}}},s([Ur(wl)],t.Polygon.prototype,"__",void 0),s([Er(3)],t.Polygon.prototype,"sides",void 0),s([Er()],t.Polygon.prototype,"points",void 0),s([Er(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=s([jr(),qr()],t.Polygon);const{sin:Ql,cos:td,PI:ed}=Math,{moveTo:id,lineTo:sd,closePath:nd}=Ss;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];id(o,n,0);for(let t=1;t<2*i;t++)sd(o,n+(t%2==0?n:n*s)*Ql(t*ed/i),r-(t%2==0?r:r*s)*td(t*ed/i));nd(o)}},s([Ur(xl)],t.Star.prototype,"__",void 0),s([Er(5)],t.Star.prototype,"corners",void 0),s([Er(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=s([qr()],t.Star);const{moveTo:rd,lineTo:od,drawPoints:ad}=Ss,{rotate:hd,getAngle:ld,getDistance:dd,defaultPoint:cd}=ht;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&hd(i,e),i}set toPoint(t){this.width=dd(cd,t),this.rotation=ld(cd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ad(e,t.points,t.curve,t.closed):(rd(e,0,0),od(e,this.width,0))}},s([Ur(yl)],t.Line.prototype,"__",void 0),s([Pr("center")],t.Line.prototype,"strokeAlign",void 0),s([vr(0)],t.Line.prototype,"height",void 0),s([Er()],t.Line.prototype,"points",void 0),s([Er(0)],t.Line.prototype,"curve",void 0),s([Er(!1)],t.Line.prototype,"closed",void 0),t.Line=s([qr()],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 u(t)&&t[0].image}},s([Ur(Bl)],t.Image.prototype,"__",void 0),s([vr("")],t.Image.prototype,"url",void 0),t.Image=s([qr()],t.Image);const ud=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=ce.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new or({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Yo(Yo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new ft(t.worldTransform).invert(),r=new ft;e&&r.translate(e.x,e.y),i&&(d(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},s([Ur(Tl)],t.Canvas.prototype,"__",void 0),s([jh(100)],t.Canvas.prototype,"width",void 0),s([jh(100)],t.Canvas.prototype,"height",void 0),s([jh(1)],t.Canvas.prototype,"pixelRatio",void 0),s([jh(!0)],t.Canvas.prototype,"smooth",void 0),s([pr(!1)],t.Canvas.prototype,"safeResize",void 0),s([jh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=s([qr()],t.Canvas);const{copyAndSpread:pd,includes:_d,spread:gd,setList:fd}=Xt,{stintSet:yd}=g;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Kh.number(e,n),t.__letterSpacing=Kh.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,yd(t,"__padding",l&&I.fourNumber(l)),yd(t,"__clipText","show"!==h&&!t.__autoSize),yd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Gh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&gd(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),g.stintSet(this,"isOverflow",!_d(h,a)),this.isOverflow?(fd(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;pd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},s([Ur(Sl)],t.Text.prototype,"__",void 0),s([vr(0)],t.Text.prototype,"width",void 0),s([vr(0)],t.Text.prototype,"height",void 0),s([kr()],t.Text.prototype,"boxStyle",void 0),s([pr(!1)],t.Text.prototype,"resizeFontSize",void 0),s([kr("#000000")],t.Text.prototype,"fill",void 0),s([Pr("outside")],t.Text.prototype,"strokeAlign",void 0),s([Fr("all")],t.Text.prototype,"hitFill",void 0),s([vr("")],t.Text.prototype,"text",void 0),s([vr("")],t.Text.prototype,"placeholder",void 0),s([vr("caption")],t.Text.prototype,"fontFamily",void 0),s([vr(12)],t.Text.prototype,"fontSize",void 0),s([vr("normal")],t.Text.prototype,"fontWeight",void 0),s([vr(!1)],t.Text.prototype,"italic",void 0),s([vr("none")],t.Text.prototype,"textCase",void 0),s([vr("none")],t.Text.prototype,"textDecoration",void 0),s([vr(0)],t.Text.prototype,"letterSpacing",void 0),s([vr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),s([vr(0)],t.Text.prototype,"paraIndent",void 0),s([vr(0)],t.Text.prototype,"paraSpacing",void 0),s([vr("x")],t.Text.prototype,"writingMode",void 0),s([vr("left")],t.Text.prototype,"textAlign",void 0),s([vr("top")],t.Text.prototype,"verticalAlign",void 0),s([vr(!0)],t.Text.prototype,"autoSizeAlign",void 0),s([vr("normal")],t.Text.prototype,"textWrap",void 0),s([vr("show")],t.Text.prototype,"textOverflow",void 0),s([kr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=s([qr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},s([Ur(bl)],t.Path.prototype,"__",void 0),s([Pr("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=s([qr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},s([Ur(El)],t.Pen.prototype,"__",void 0),s([(t,e)=>{ar(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=s([Gr(Ys,["set","path","paint"]),qr()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ce.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),o(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&g.assign(e,t),this.autoLayout&&g.copyAttrs(e,this,Le),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[$o.END,this.__onReady,this],[Jo.START,this.__onCreated,this],[Jo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Jo.END,this.__onChildRenderEnd,this))}},t.App=s([qr()],t.App);const md={},vd={isHoldSpaceKey:()=>vd.isHold("Space"),isHold:t=>md[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){md[t]||(md[t]=!0)},setUpCode(t){md[t]=!1}},wd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class xd extends Fo{get spaceKey(){return vd.isHoldSpaceKey()}get left(){return wd.left(this)}get right(){return wd.right(this)}get middle(){return wd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return vd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){fe.changeName(t,e)}}const{min:bd,max:Ed,abs:Pd}=Math,{float:Sd,sign:Bd}=I,{minX:Td,maxX:kd,minY:Rd,maxY:Cd}=Xt,Ld=new Gt,Dd=new Gt,Ad={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Od.getValidMove(t.__localBoxBounds,Od.getDragBounds(t),s,e,!0),Od.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&Od.getValidScaleOf(t.__localBoxBounds,Od.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),Od.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),Od.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=Sd(s.x),s.y=Sd(s.y),s},getValidScaleOf(t,e,i,s,n,r,o){o||(n=Object.assign({},n)),Dd.set(e),Ld.set(t).scaleOf(s,n.x,n.y);const a=(s.x-t.x)/t.width,h=1-a,d=(s.y-t.y)/t.height,c=1-d;let u,p,_,g,f=1,y=1;return Od.isInnerMode(t,e,i,"width")?(n.x<0&&Ld.scaleOf(s,f=1/n.x,1),_=Sd(Ld.minX-Dd.minX),g=Sd(Dd.maxX-Ld.maxX),u=a&&_>0?1+_/(a*Ld.width):1,p=h&&g>0?1+g/(h*Ld.width):1,f*=Ed(u,p)):(n.x<0&&((Sd(Td(t)-Td(e))<=0||Sd(kd(e)-kd(t))<=0)&&Ld.scaleOf(s,f=1/n.x,1),Ld.unsign()),_=Sd(Dd.minX-Ld.minX),g=Sd(Ld.maxX-Dd.maxX),u=a&&_>0?1-_/(a*Ld.width):1,p=h&&g>0?1-g/(h*Ld.width):1,f*=bd(u,p)),Od.isInnerMode(t,e,i,"height")?(n.y<0&&Ld.scaleOf(s,1,y=1/n.y),_=Sd(Ld.minY-Dd.minY),g=Sd(Dd.maxY-Ld.maxY),u=d&&_>0?1+_/(d*Ld.height):1,p=c&&g>0?1+g/(c*Ld.height):1,y*=Ed(u,p),r&&(u=Ed(Pd(f),Pd(y)),f=Bd(f)*u,y=Bd(y)*u)):(n.y<0&&((Sd(Rd(t)-Rd(e))<=0||Sd(Cd(e)-Cd(t))<=0)&&Ld.scaleOf(s,1,y=1/n.y),Ld.unsign()),_=Sd(Dd.minY-Ld.minY),g=Sd(Ld.maxY-Dd.maxY),u=d&&_>0?1-_/(d*Ld.height):1,p=c&&g>0?1-g/(c*Ld.height):1,y*=bd(u,p)),n.x*=l(f)?f:1,n.y*=l(y)?y:1,n}},Od=Ad;t.PointerEvent=class extends xd{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=s([Kr()],t.PointerEvent);const Id=t.PointerEvent,Md={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof vh?t:new vh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return ht.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Ad.axisMove(t,n),n}static limitMove(t,e){Ad.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Md,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Md,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Md,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){Md.x=t?this.totalX:this.moveX,Md.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=s([Kr()],t.DragEvent);const Fd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=s([Kr()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.DRAG_ANIMATE="move.drag_animate",t.MoveEvent.END="move.end",t.MoveEvent.PULL_DOWN="move.pull_down",t.MoveEvent.REACH_BOTTOM="move.reach_bottom",t.MoveEvent=s([Kr()],t.MoveEvent),t.TouchEvent=class extends xd{},t.TouchEvent=s([Kr()],t.TouchEvent);const Wd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=s([Kr()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=s([Kr()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=s([Kr()],t.ZoomEvent),t.KeyEvent=class extends xd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=s([Kr()],t.KeyEvent);const Ud={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Nd.getSwipeDirection(ht.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:o(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new vh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>ao.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Nd=Ud,zd=new vh,{getDragEventData:Yd,getDropEventData:Xd,getSwipeEventData:Hd}=Ud;class jd{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Yd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||zd;return this.dragging&&(n?e?zd:new vh(i?[...s.list,...s.dragHoverExclude]:s.list):r)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&wd.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],ao.draggable(e)){this.draggableList=new vh(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=Yd(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:o}=i.p,a=!o||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},a||n);o&&!n&&e?ao.animateMove(i,l,d(o)?o:.3):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Yd(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(ht.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Hd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Xd(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Vd=se.get("emit");const Gd=["move","zoom","rotate","key"];function qd(t,e,i,s,n){if(Gd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Zd(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Kd(r,e,i,s,n)}}function Kd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Zd(t,n)&&(sl.updateEventStyle&&!s&&sl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=fe.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Zd(t,e){return e&&e.has(t)}const $d={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Jd,pathCanDrag:Qd,pathHasOutside:tc}=Ud;class ec{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&wd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&wd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&vd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=g.clone($d),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new vh(t),this.createTransformer(),this.dragger=new jd(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(wd.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),e.path.needUpdate&&this.updateDownData(e),this.emit(t.PointerEvent.DOWN,e),wd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=wd.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&wd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=ht.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;wd.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,vd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,vd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new vh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Jd(e.path,t));n<i.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:r}=this;te.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!tc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Qd(t.path))&&!tc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&ht.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Jd(e.path,t.PointerEvent.LONG_TAP)||Jd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Ko.RESIZE,this.__onResize,this)],t.once(Qo.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Kd(n,t,e,!0,s))return;n.isApp&&qd(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&qd(n,t,e,!1,s),Kd(n,t,e,!1,s))return}catch(t){Vd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class ic{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}ic.custom={};class sc extends me{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new vh,this.pixelList=new vh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ce.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ce.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}te.getSelector=function(t){return t.leafer?t.leafer.selector:te.selector||(te.selector=ce.selector())};const{toInnerRadiusPointOf:nc,copyRadiusPoint:rc}=ht,{hitRadiusPoint:oc,hitPoint:ac}=Xt,hc={},lc={},dc=t.Leaf.prototype;dc.hit=function(t,e=0){this.updateLayout(),rc(lc,t,e);const i=this.__world;return!!(e?oc(i,lc):ac(i,lc))&&(this.isBranch?te.getSelector(this).hitPoint(Object.assign({},lc),e,{target:this}):this.__hitWorld(lc))},dc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(rc(hc,t,i.hitRadius),t=hc),nc(t,s,hc),i.hitBox||r){if(Xt.hitRadiusPoint(n.boxBounds,hc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(hc,e)},dc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},dc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},dc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},dc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const cc=new ft,uc=t.UI.prototype;uc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=te.image.hitCanvasSize,o=r.hitScale=qt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=qt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),ir.patternLocked=!0,this.__renderShape(r,{matrix:cc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),ir.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},uc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:o}=i,a=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*o,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=o;break;case"outside":if(l+=2*o,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const pc=t.UI.prototype,_c=t.Rect.prototype,gc=t.Box.prototype;_c.__updateHitCanvas=gc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?pc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},_c.__hitFill=gc.__hitFill=function(t){return this.__hitCanvas?pc.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=r),this.updateLayout(),te.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const fc=De.prototype;fc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},fc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},fc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),qt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(qt.x,qt.y,qt.width||1,qt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const yc={convert(t,e){const i=Ud.getBase(t),{x:s,y:n}=e,r=Object.assign(Object.assign({},i),{x:s,y:n,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===r.pointerType&&(r.tangentialPressure=t.tangentialPressure,r.tiltX=t.tiltX,r.tiltY=t.tiltY,r.twist=t.twist),r},convertMouse(t,e){const i=Ud.getBase(t),{x:s,y:n}=e;return Object.assign(Object.assign({},i),{x:s,y:n,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=yc.getTouch(t),s=Ud.getBase(t),{x:n,y:r}=e;return Object.assign(Object.assign({},s),{x:n,y:r,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},mc={convert(t){const e=Ud.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:vc}=Ud;class wc extends ec{get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(mc.convert(t))}onKeyUp(t){this.keyUp(mc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(yc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(yc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=yc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(yc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(yc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(yc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(yc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=yc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&vc(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(yc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=yc.getTouch(t);this.pointerMove(yc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=yc.getTouch(t);this.pointerUp(yc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Ud.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},Ud.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=Ud.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(I.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),p(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>p(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,u(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=h(t)&&ic.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function xc(t,e,i){t.__.__font?$h.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function bc(t,e,i,s,n){const r=i.__;p(t)?$h.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&$h.strokeArrow(t,i,s,n)}function Ec(t,e,i,s,n){const r=i.__;p(t)?$h.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),$h.drawTextStroke(i,s,n))}function Pc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Ec(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",$h.fillText(i,r,n),r.blendMode="normal",ao.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}const{getSpread:Sc,copyAndSpread:Bc,toOuterOf:Tc,getOuterOf:kc,getByMove:Rc,move:Cc,getIntersectData:Lc}=Xt,Dc={};let Ac;const{stintSet:Oc}=g,{hasTransparent:Ic}=qh;function Mc(t,e,i){if(!p(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout,{type:r}=e;switch(r){case"image":case"film":case"video":if(!e.url)return;s=Jh.image(i,t,e,n,!Ac||!Ac[e.url]),"image"!==r&&Jh[r](s);break;case"linear":s=Qh.linearGradient(e,n);break;case"radial":s=Qh.radialGradient(e,n);break;case"angular":s=Qh.conicGradient(e,n);break;case"solid":const{color:a,opacity:h}=e;s={type:r,style:qh.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:qh.string(e)})}if(s&&(s.originPaint=e,h(s.style)&&Ic(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Fc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];u(a)||(a=[a]),Ac=Jh.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Mc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(Oc(i,"__isAlphaPixelFill",n),Oc(i,"__isTransparentFill",r)):(Oc(i,"__isAlphaPixelStroke",n),Oc(i,"__isTransparentStroke",r),Oc(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,xc(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,Jh.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}r.blendMode&&(i.blendMode=r.blendMode),xc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),xc(e,i,s),i.restoreBlendMode()):xc(e,i,s)}},fillPathOrText:xc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)$h.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":bc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),bc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)bc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),bc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),ao.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){$h.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Ec(t,1,e,i,s);break;case"inside":Pc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Ec(t,2,e,i,s):Pc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!Jh.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?$h.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?$h.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,p;Tc(o.strokeSpread?(Bc(Dc,o.boxBounds,o.strokeSpread),Dc):o.boxBounds,r,a);let{scaleX:_,scaleY:g}=t.getRenderScaleData(!0);if(n.includes(a))p=s,h=u=a,l=r;else{let s;if(te.fullImageShadow)s=a;else{const t=o.renderShapeSpread?Sc(n,S.swapAndScale(o.renderShapeSpread,_,g)):n;s=Lc(t,a)}c=n.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,i),_*=f,g*=y),u=kc(a,c),h=Rc(u,-c.e,-c.f),l=kc(r,c),Cc(l,-c.e,-c.f);const m=i.matrix;m?(d=new ft(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:p,shapeBounds:u,scaleX:_,scaleY:g}}};let Wc,Uc=new Gt;const{isSame:Nc}=Xt;function zc(t,e,i,s,n,r){const o=t.__;if("fill"===e&&!o.__naturalWidth&&(o.__naturalWidth=s.width/o.pixelRatio,o.__naturalHeight=s.height/o.pixelRatio,o.__autoSide))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",o.width),t.setProxyAttr("height",o.height)),!1;if(!n.data){Jh.createData(n,s,i,r);const{transform:t}=n.data,{opacity:e,blendMode:a}=i,h=t&&!t.onlyScale||o.path||o.cornerRadius;(h||e&&e<1||a)&&(n.complex=!h||2)}return!0}function Yc(t,e){jc(t,Yo.LOAD,e)}function Xc(t,e){jc(t,Yo.LOADED,e)}function Hc(t,e,i){e.error=i,t.forceUpdate("surface"),jc(t,Yo.ERROR,e)}function jc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Yo(e,i))}function Vc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Gc,translate:qc}=Z,Kc=new Gt,Zc={},$c={};function Jc(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Qc={},tu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:eu,set:iu,rotateOfOuter:su,translate:nu,scaleOfOuter:ru,multiplyParent:ou,scale:au,rotate:hu,skew:lu}=Z;function du(t,e,i,s,n,r,o,a){o&&hu(t,o),a&&lu(t,a.x,a.y),n&&au(t,n,r),nu(t,e.x+i,e.y+s)}const{get:cu,scale:uu,copy:pu}=Z,{getFloorScale:_u}=I,{abs:gu}=Math;const fu={image:function(t,e,i,s,n){let r,o;const a=ir.get(i,i.type);return Wc&&i===Wc.paint&&Nc(s,Wc.boxBounds)?r=Wc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Wc=a.use>1?{leafPaint:r,paint:i,boxBounds:Uc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(zc(t,e,i,a,r,s),n&&(Yc(t,o),Xc(t,o))):a.error?n&&Hc(t,o,a.error):(n&&(Vc(t,!0),Yc(t,o)),r.loadId=a.load(()=>{Vc(t,!1),t.destroyed||(zc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Xc(t,o)),r.loadId=void 0},e=>{Vc(t,!1),Hc(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=Jh.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:r+"-"+o,{image:h,data:l,originPaint:d}=t,{exporting:c,snapshot:u}=n;return!(!l||t.patternId===a&&!c||u)&&(e&&(l.repeat?e=!1:d.changeful||t.film||"miniapp"===te.name&&Ko.isResizing(i)||c||(e=te.image.isLarge(h,r,o)||h.width*r>8096||h.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Jh.drawImage(t,r,o,i,s,n),!0):(!t.style||d.sync||c?Jh.createPattern(t,i,s,n):Jh.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){const{data:o,image:a,complex:h}=t;let{width:l,height:d}=a;if(h){const{blendMode:r,opacity:c}=t.originPaint,{transform:u}=o;n.save(),2===h&&n.clipUI(s),r&&(n.blendMode=r),c&&(n.opacity*=c),u&&n.transform(u),a.render(n,0,0,l,d,s,t,e,i),n.restore()}else o.scaleX&&(l*=o.scaleX,d*=o.scaleY),a.render(n,0,0,l,d,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,ir.recyclePaint(s),n.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=ir.patternTasker.add(()=>n(this,void 0,void 0,function*(){Jh.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=Jh.getImageRenderScaleData(t,e,i,s),o=t.film?t.nowIndex:n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!te.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{opacity:a,filters:h}=t.originPaint,{transform:l,gap:d}=s,c=Jh.getPatternFixScale(t,n,r);let u,p,_,{width:g,height:f}=i;c&&(n*=c,r*=c),g*=n,f*=r,d&&(p=d.x*n/gu(s.scaleX||1),_=d.y*r/gu(s.scaleY||1)),(l||1!==n||1!==r)&&(n*=_u(g+(p||0)),r*=_u(f+(_||0)),u=cu(),l&&pu(u,l),uu(u,1/n,1/r));const y=i.getCanvas(g,f,a,h,p,_,e.leafer&&e.leafer.config.smooth,s.interlace),m=i.getPattern(y,s.repeat||te.origin.noRepeat||"no-repeat",u,t);t.style=m,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=te.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=Jh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Kc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:r,align:o,offset:a,scale:l,size:c,rotation:u,skew:_,clipSize:g,repeat:f,gap:y,interlace:m}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==o&&(u||0)%180==90;let b,E;switch(Xt.set($c,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((l||c)&&(I.getScaleData(l,c,i,Zc),b=Zc.scaleX,E=Zc.scaleY),(o||y||f)&&(b&&Xt.scale($c,b,E,!0),o&&Bt.toPoint(o,$c,e,$c,!0,!0))):v&&!u||(b=E=Xt.getFitScale(e,$c,"fit"!==r),Xt.put(e,i,o,b,!1,$c),Xt.scale($c,b,E,!0)),a&&ht.move($c,a),r){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/n,Jh.stretchMode(w,e,b,E));break;case"normal":case"clip":if($c.x||$c.y||b||g||u||_){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Jh.clipMode(w,e,$c.x,$c.y,b,E,u,_,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||u||_)&&Jh.repeatMode(w,e,s,n,$c.x,$c.y,b,E,u,_,o,t.freeTransform),f||(w.repeat="repeat");const i=p(f);(y||i)&&(w.gap=function(t,e,i,s,n){let r,o;p(t)?(r=t.x,o=t.y):r=o=t;return{x:Jc(r,i,n.width,e&&e.x),y:Jc(o,s,n.height,e&&e.y)}}(y,i&&f,$c.width,$c.height,e));break;default:b&&Jh.fillOrFitMode(w,e,$c.x,$c.y,b,E,u)}return w.transform||(e.x||e.y)&&qc(w.transform=Gc(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=E),f&&(w.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=d(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,i,s){const n=eu(),{x:r,y:o}=e;r||o?nu(n,r,o):i>0&&s>0&&(n.onlyScale=!0),au(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=eu();nu(a,e.x+i,e.y+s),au(a,n,r),o&&su(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=eu();du(d,e,i,s,n,r,o,a),h&&(o||a?(iu(tu),ru(tu,e,h,l),ou(d,tu)):ru(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=eu();if(c)du(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)su(u,{x:i/2,y:s/2},h);else switch(hu(u,h),h){case 90:nu(u,s,0);break;case 180:nu(u,i,s);break;case 270:nu(u,0,i)}Qc.x=e.x+n,Qc.y=e.y+r,nu(u,Qc.x,Qc.y),o&&ru(u,Qc,o,a)}t.transform=u}},{toPoint:yu}=Et,{hasTransparent:mu}=qh,vu={},wu={};function xu(t,e,i,s){if(i){let n,r,o,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(o=t/(l-1),r=qh.string(n,s)):(o=n.offset,r=qh.string(n.color,s)),e.addColorStop(o,r),!a&&mu(r)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:bu,getDistance:Eu}=ht,{get:Pu,rotateOfOuter:Su,scaleOfOuter:Bu}=Z,{toPoint:Tu}=Et,ku={},Ru={};function Cu(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=bu(e,i);r=Pu(),n?(Bu(r,e,o/a*(s||1),1),Su(r,e,t+90)):(Bu(r,e,1,o/a*(s||1)),Su(r,e,t))}return r}const{getDistance:Lu}=ht,{toPoint:Du}=Et,Au={},Ou={};const Iu={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;yu(i||"top",e,vu),yu(s||"bottom",e,wu);const o=te.canvas.createLinearGradient(vu.x,vu.y,wu.x,wu.y),a={type:n,style:o};return xu(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Tu(i||"center",e,ku),Tu(s||"bottom",e,Ru);const a=te.canvas.createRadialGradient(ku.x,ku.y,0,ku.x,ku.y,Eu(ku,Ru)),h={type:n,style:a};xu(h,a,t.stops,r);const l=Cu(e,ku,Ru,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Du(i||"center",e,Au),Du(s||"bottom",e,Ou);const a=te.conicGradientSupport?te.canvas.createConicGradient(0,Au.x,Au.y):te.canvas.createRadialGradient(Au.x,Au.y,0,Au.x,Au.y,Lu(Au,Ou)),h={type:n,style:a};xu(h,a,t.stops,r);const l=Cu(e,Au,Ou,o||1,te.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Cu},{copy:Mu,move:Fu,toOffsetOutBounds:Wu}=Xt,{max:Uu,abs:Nu}=Math,zu={},Yu=new ft,Xu={};function Hu(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=Nu(t.spread||0),o=Uu(o,n+r-s),a=Uu(a,n+r+i),h=Uu(h,n+r+s),l=Uu(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function ju(t,e,i){const{shapeBounds:s}=i;let n,r;te.fullImageShadow?(Mu(zu,t.bounds),Fu(zu,e.x-s.x,e.y-s.y),n=t.bounds,r=zu):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:Vu}=Xt,Gu={};const qu=Hu;const Ku={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=o.length-1;Wu(h,Xu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.setWorldShadow(Xu.offsetX+(o.x||0)*c*f,Xu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,qh.string(o.color)),n=tl.getShadowTransform(t,p,i,o,Xu,f),n&&p.setTransform(n),ju(p,Xu,i),n&&p.resetTransform(),s=l,o.box&&(p.restore(),p.save(),a&&(p.copyWorld(p,l,r,"copy"),s=r),a?p.copyWorld(a,r,r,"destination-out"):p.copyWorld(i.canvas,d,h,"destination-out")),ao.copyCanvasByWorld(t,e,p,s,o.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=o.length-1;Vu(h,Gu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(Gu.offsetX+(o.x||0)*c*f,Gu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=tl.getShadowTransform(t,p,i,o,Gu,f,!0),n&&p.setTransform(n),ju(p,Gu,i),p.restore(),a?(p.copyWorld(p,l,r,"copy"),p.copyWorld(a,r,r,"source-out"),s=r):(p.copyWorld(i.canvas,d,h,"source-out"),s=l),p.fillWorld(s,qh.string(o.color),"source-in"),ao.copyCanvasByWorld(t,e,p,s,o.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Hu,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Yu.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Yu}},isTransformShadow(t){},getInnerShadowSpread:qu},{excludeRenderBounds:Zu}=fo;let $u;function Ju(t,e,i,s,n,r,o,a){switch(e){case"grayscale":$u||($u=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);tp(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":tp(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function Qu(t){return t.getSameCanvas(!1,!0)}function tp(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(Ju(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||Zu(i,e)||i.__render(t,e),r=i.__.opacity,$u=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=Qu(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Qu(t)),n||(n=Qu(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&Ju(this,o,t,n,s,r,void 0,!1),Zu(i,e)||i.__render(n||t,e),d&&Ju(this,o,t,n,s,r,d,!1)}Ju(this,o,t,n,s,r,void 0,!0)};const ep=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ip=ep+"_#~&*+\\=|≮≯≈≠=…",sp=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 np(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const rp=np("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),op=np("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ap=np(ep),hp=np(ip),lp=np("- —/~|┆·");var dp;!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"}(dp||(dp={}));const{Letter:cp,Single:up,Before:pp,After:_p,Symbol:gp,Break:fp}=dp;function yp(t){return rp[t]?cp:lp[t]?fp:op[t]?pp:ap[t]?_p:hp[t]?gp:sp.test(t)?up:cp}const mp={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function vp(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:wp}=mp,{Letter:xp,Single:bp,Before:Ep,After:Pp,Symbol:Sp,Break:Bp}=dp;let Tp,kp,Rp,Cp,Lp,Dp,Ap,Op,Ip,Mp,Fp,Wp,Up,Np,zp,Yp,Xp,Hp=[];function jp(t,e){Ip&&!Op&&(Op=Ip),Tp.data.push({char:t,width:e}),Rp+=e}function Vp(){Cp+=Rp,Tp.width=Rp,kp.words.push(Tp),Tp={data:[]},Rp=0}function Gp(){Np&&(zp.paraNumber++,kp.paraStart=!0,Np=!1),Ip&&(kp.startCharSize=Op,kp.endCharSize=Ip,Op=0),kp.width=Cp,Yp.width?wp(kp):Xp&&qp(),Hp.push(kp),kp={words:[]},Cp=0}function qp(){Cp>(zp.maxWidth||0)&&(zp.maxWidth=Cp)}const{top:Kp,right:Zp,bottom:$p,left:Jp}=t.Direction4;function Qp(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const t_={getDrawData:function(t,e){h(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:o}=e;o&&(n?(i=o[Jp],n-=o[Zp]+o[Jp],!n&&(n=.01)):e.autoSizeAlign||(i=o[Jp]),r?(s=o[Kp],r-=o[Kp]+o[$p],!r&&(r=.01)):e.autoSizeAlign||(s=o[Kp]));const a={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:te.canvas.font=e.__font};return function(t,e,i){zp=t,Hp=t.rows,Yp=t.bounds,Xp=!Yp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=te,{width:a}=Yp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;Np=!0,Fp=null,Op=Ap=Ip=Rp=Cp=0,Tp={data:[]},kp={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)Dp=e[i],"\n"===Dp?(Rp&&Vp(),kp.paraEnd=!0,Gp(),Np=!0):(Mp=yp(Dp),Mp===xp&&"none"!==r&&(Dp=vp(Dp,r,!Rp)),Ap=o.measureText(Dp).width,s&&(s<0&&(Ip=Ap),Ap+=s),Wp=Mp===bp&&(Fp===bp||Fp===xp)||Fp===bp&&Mp!==Pp,Up=!(Mp!==Ep&&Mp!==bp||Fp!==Sp&&Fp!==Pp),Lp=Np&&n?a-n:a,t&&a&&Cp+Rp+Ap>Lp&&(h?(Rp&&Vp(),Cp&&Gp()):(Up||(Up=Mp===xp&&Fp==Pp),Wp||Up||Mp===Bp||Mp===Ep||Mp===bp||Rp+Ap>Lp?(Rp&&Vp(),Cp&&Gp()):Cp&&Gp()))," "===Dp&&!0!==Np&&Cp+Rp===0||(Mp===Bp?(" "===Dp&&Rp&&Vp(),jp(Dp,Ap),Vp()):Wp||Up?(Rp&&Vp(),jp(Dp,Ap)):jp(Dp,Ap)),Fp=Mp);Rp&&Vp(),Cp&&Gp(),Hp.length>0&&(Hp[Hp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{zp.paraNumber++,Cp=o.measureText(t).width,Hp.push({x:n||0,text:t,width:Cp,paraStart:!0}),Xp&&qp()})}(a,t,e),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Qp(e,"x",t[Jp]);break;case"right":Qp(e,"x",-t[Zp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Qp(e,"y",t[Kp]);break;case"bottom":Qp(e,"y",-t[$p])}}(o,a,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=p,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(a,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r,__letterSpacing:o}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,p,_,g,f,y,m,v;s.forEach(t=>{t.words&&(_=r&&t.paraStart?r:0,y=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-_,l?p=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=_,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=_,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,d,t.data,t.isOverflow,v&&p),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):p&&(t.width+=p*(e.data.length-(m?1:0))))})),t.words=null)})}(a,e,n),a.overflow&&function(t,e,i,s){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?te.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(a,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,p(r)?(i=r.type,r.color&&(t.decorationColor=qh.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(a,e),a}};const e_={string:function(t,e){if(!t)return"#000";const i=d(e)&&e<1;if(h(t)){if(!i||!qh.object)return t;t=qh.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(Gh,t_),Object.assign(qh,e_),Object.assign($h,Fc),Object.assign(Jh,fu),Object.assign(Qh,Iu),Object.assign(tl,Ku),Object.assign(ce,{interaction:(t,e,i,s)=>new wc(t,e,i,s),hitCanvas:(t,e)=>new bh(t,e),hitCanvasManager:()=>new sc}),Eh();class i_ extends cl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function s_(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?sl.setStyleName(this,e,i):sl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function n_(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function r_(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function o_(t,e){p(e)||(e=void 0),l_(t,e,"in")}function a_(t,e){const{normalStyle:i}=t;p(e)||(e=void 0),i&&(e||(e=i),l_(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!o(t))if(d(t))this.now=t;else if(p(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=ir.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:r,total:o}=e,{width:a,height:h}=r&&(d(r)?{width:r,height:r}:r)||(o>1?this:t);let l=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:c,width:a,height:h},l+a>=t.width?(l=0,c+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Yo(Yo.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),o(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},s([Ur(i_)],t.Robot.prototype,"__",void 0),s([vr()],t.Robot.prototype,"robot",void 0),s([pr()],t.Robot.prototype,"actions",void 0),s([pr("")],t.Robot.prototype,"action",void 0),s([kr(0)],t.Robot.prototype,"now",void 0),s([pr(12)],t.Robot.prototype,"FPS",void 0),s([pr(!0)],t.Robot.prototype,"loop",void 0),t.Robot=s([qr()],t.Robot),de.add("robot");const h_={};function l_(t,e,i){const{normalStyle:s}=t;e||(e=h_),e.scale&&(I.assignScale(e,e.scale),delete e.scale),e!==h_&&sl.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&a(i[s])&&a(e[s])&&(s="transition");return a(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=u_(e,t),s=t.animate();s&&u_(i,t,s.fromStyle);return i}(t,e):void 0;sl.canAnimate&&d_(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=d_(t);if(o){const{animation:s}=o;if(s){const r=t.animate(s,void 0,"animation",!0);Object.assign(o,r.endingStyle),"in"!==i||e.animation!==s?r.kill():n=!1,delete o.animation}t.normalStyle=c_(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(n){const e=c_(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function d_(t){let e;const i={},s=r_(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&sl.isState(n,t,s)&&(e=p_(i,r));const o=i.selectedStyle||t.selectedStyle;o&&sl.isSelected(t,s)&&(e=p_(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&sl.isPlacehold(t,s)&&(e=p_(i,a)),sl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=p_(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&sl.isFocus(t,s)&&(e=p_(i,n));const r=i.hoverStyle||t.hoverStyle;r&&sl.isHover(t,s)&&(e=p_(i,r));const o=i.pressStyle||t.pressStyle;o&&sl.isPress(t,s)&&(e=p_(i,o))}return e?i:void 0}function c_(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&sl.animateExcludes[t]||(n[t]=e[t]);return n}function u_(t,e,i){return c_(t,e,i,!0)}function p_(t,e){return Object.assign(t,e),!0}function __(t,e){const i=t[e];i&&o_(t,i),t.button&&f_(t.children,e)}function g_(t,e,i){i||(i=t.states[e]),o_(t,i),t.button&&f_(t.children,null,e)}function f_(t,e,i){if(!t)return;let s,n;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":sl.isHover(s)&&(n=!1);break;case"pressStyle":sl.isPress(s)&&(n=!1);break;case"focusStyle":sl.isFocus(s)&&(n=!1)}n&&__(s,e)}else o(i)||g_(s,i);s.isBranch&&f_(s.children,e,i)}}function y_(t,e){const i=t[e];i&&a_(t,i),t.button&&v_(t.children,e)}function m_(t,e,i){a_(t,i),t.button&&v_(t.children,null,e)}function v_(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?y_(s,e):o(i)||m_(s,i),s.isBranch&&v_(s.children,e,i)}function w_(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=r_(e,i);r&&(s=n[t](r))}return s}function x_(t,e,i){let s=e[t];if(!s&&i){const n=r_(e,i);n&&(s=n[t])}return s}de.add("state"),sl.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},sl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=r_(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},sl.isSelected=function(t,e){return x_("selected",t,e)},sl.isDisabled=function(t,e){return x_("disabled",t,e)},sl.isFocus=function(t,e){return w_("isFocus",t,e)},sl.isHover=function(t,e){return w_("isHover",t,e)},sl.isPress=function(t,e){return w_("isPress",t,e)},sl.isPlacehold=function(t,e){return t.__.__isPlacehold},sl.isDrag=function(t,e){return w_("isDrag",t,e)},sl.setStyleName=function(t,e,i){i?g_(t,e,t[e]):m_(t,e,t[e])},sl.set=function(t,e){const i=t.states[e];i?g_(t,e,i):m_(t,e,i)},sl.getStyle=d_,sl.updateStyle=l_,sl.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:__(e,"hoverStyle");break;case t.PointerEvent.LEAVE:y_(e,"hoverStyle");break;case t.PointerEvent.DOWN:__(e,"pressStyle");break;case t.PointerEvent.UP:y_(e,"pressStyle")}};const b_=t.UI.prototype;t.UI.addAttr("selected",!1,s_,"selectedStyle"),t.UI.addAttr("disabled",!1,s_,"disabledStyle"),t.UI.addAttr("states",{},n_),t.UI.addAttr("state","",s_),t.UI.addAttr("normalStyle",void 0,pr),t.UI.addAttr("hoverStyle",void 0,n_),t.UI.addAttr("pressStyle",void 0,n_),t.UI.addAttr("focusStyle",void 0,n_),t.UI.addAttr("selectedStyle",void 0,n_),t.UI.addAttr("disabledStyle",void 0,n_),t.UI.addAttr("placeholderStyle",void 0,n_),t.UI.addAttr("button",!1,pr),b_.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},b_.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?__(this,"focusStyle"):y_(this,"focusStyle")})},b_.updateState=function(){sl.updateStyle(this,void 0,"in")};const E_=t.Text.prototype,P_="text";ar(E_,P_,Object.assign(Object.assign({},hr(E_,P_)),{set(t){const e=this,i=e.text;e.__setAttr(P_,t)&&(xr(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:S_,sin:B_,pow:T_,sqrt:k_,abs:R_,ceil:C_,floor:L_,round:D_,PI:A_}=Math,O_=5*A_,I_=1.70158,M_=2.5949095,F_=7.5625,W_=2.75;function U_(t){return e=>T_(e,t)}function N_(t){return e=>1-T_(1-e,t)}function z_(t){return e=>e<.5?.5*T_(2*e,t):1-.5*T_(2-2*e,t)}function Y_(t){return t<1/W_?F_*t*t:t<2/W_?F_*(t-=1.5/W_)*t+.75:t<2.5/W_?F_*(t-=2.25/W_)*t+.9375:F_*(t-=2.625/W_)*t+.984375}function X_(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=H_(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(R_(l)<1e-6));e++)c-=d/l;return n[o]=H_(c,e,s)}}function H_(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const j_={get(t){const{list:e}=j_;return h(t)?e[t||"ease"]:p(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){j_.list[t]=e},list:{linear:t=>t,ease:X_(.25,.1,.25,1),"ease-in":X_(.42,0,1,1),"ease-out":X_(0,0,.58,1),"ease-in-out":X_(.42,0,.58,1),"sine-in":t=>1-S_(t*A_*.5),"sine-out":t=>B_(t*A_*.5),"sine-in-out":t=>.5*(1-S_(t*A_)),"quad-in":U_(2),"quad-out":N_(2),"quad-in-out":z_(2),"cubic-in":U_(3),"cubic-out":N_(3),"cubic-in-out":z_(3),"quart-in":U_(4),"quart-out":N_(4),"quart-in-out":z_(4),"quint-in":U_(5),"quint-out":N_(5),"quint-in-out":z_(5),"expo-in":t=>t?T_(2,10*t-10):0,"expo-out":t=>1===t?1:1-T_(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*T_(2,2*t*10-10):.5*(2-T_(2,10-2*t*10)),"circ-in":t=>1-k_(1-T_(t,2)),"circ-out":t=>k_(1-T_(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-k_(1-T_(2*t,2))):.5*(k_(1-T_(2-2*t,2))+1),"back-in":t=>((I_+1)*t-I_)*t*t,"back-out":t=>(t-=1)*t*((I_+1)*t+I_)+1,"back-in-out":t=>t<.5?(t*=2)*t*((M_+1)*t-M_)*.5:.5*((t=2*t-2)*t*((M_+1)*t+M_)+2),"elastic-in":t=>0===t||1===t?t:-T_(2,10*(t-1))*B_((t-1.1)*O_),"elastic-out":t=>0===t||1===t?t:T_(2,-10*t)*B_((t-.1)*O_)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-T_(2,10*((t*=2)-1))*B_((t-1.1)*O_)*.5:T_(2,10*(1-(t*=2)))*B_((t-1.1)*O_)*.5+1,"bounce-in":t=>1-Y_(1-t),"bounce-out":Y_,"bounce-in-out":t=>t<.5?.5*(1-Y_(1-2*t)):.5*(1+Y_(2*t-1)),"cubic-bezier":X_,steps:function(t,e="floor"){return i=>("floor"===e?L_(i*t):"ceil"===e?C_(i*t):D_(i*t))/t}}};function V_(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class G_{}G_.CREATED="created",G_.PLAY="play",G_.PAUSE="pause",G_.STOP="stop",G_.SEEK="seek",G_.UPDATE="update",G_.COMPLETED="completed";t.Animate=class extends oa{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&d(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=j_.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(G_.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(G_.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(G_.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;p(t)&&(t=Kh.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(G_.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let a,h,l,c,u,p=0,_=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),l={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=h;r&&(l.swing=d(r)?r:2,u=2*l.swing-1),o&&(l.loop=u=d(o)?o:2),t?(l.duration=t,p+=t*u,i&&(l.totalTime=t+i)):e&&(l.autoDuration=e,_+=e*u),i?(l.delay=i,p+=i*u):s&&(l.autoDelay=s,_+=s*u),n&&(l.easingFn=j_.get(n))}if(!l.autoDuration&&o(l.duration)&&(n>1?s>0||r?_+=u:l.duration=0:l.duration=this.duration),n>1)this.setBefore(l,c,a);else{for(let e in c)l.beforeStyle[e]=t[e];this.fromStyle=l.beforeStyle,this.toStyle=l.style}a=c,e.push(l)}_?((this.duration<=p||!s||!s.duration)&&this.changeDuration(p+.2*_),this.allocateTime((this.duration-p)/_)):p&&this.changeDuration(p),this.emitType(G_.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let a in e)o(s[a])&&(s[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=o(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],o(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,te.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(G_.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),nl.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emitType(G_.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return d(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},s([V_("ease")],t.Animate.prototype,"easing",void 0),s([V_(0)],t.Animate.prototype,"delay",void 0),s([V_(.2)],t.Animate.prototype,"duration",void 0),s([V_("auto")],t.Animate.prototype,"ending",void 0),s([V_(!1)],t.Animate.prototype,"reverse",void 0),s([V_(!1)],t.Animate.prototype,"swing",void 0),s([V_(!1)],t.Animate.prototype,"loop",void 0),s([V_(0)],t.Animate.prototype,"loopDelay",void 0),s([V_(1)],t.Animate.prototype,"speed",void 0),s([V_(!0)],t.Animate.prototype,"autoplay",void 0),s([V_()],t.Animate.prototype,"join",void 0),s([V_()],t.Animate.prototype,"jump",void 0),s([V_()],t.Animate.prototype,"attrs",void 0),t.Animate=s([Gr(ya)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(G_.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(G_.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(G_.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(G_.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case G_.COMPLETED:this.completed&&this.emitType(t);break;case G_.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=s([Gr(ya)],t.AnimateList);const q_={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},K_=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Z_=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,$_=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,J_=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Q_=parseInt,tg=parseFloat,{round:eg}=Math;let ig={},sg=0;function ng(t){let e,i,s,n=1;switch(t.length){case 9:e=Q_(t.slice(1,3),16),i=Q_(t.slice(3,5),16),s=Q_(t.slice(5,7),16),n=Q_(t.slice(7,9),16)/255;break;case 7:e=Q_(t.slice(1,3),16),i=Q_(t.slice(3,5),16),s=Q_(t.slice(5,7),16);break;case 5:e=Q_(t[1]+t[1],16),i=Q_(t[2]+t[2],16),s=Q_(t[3]+t[3],16),n=Q_(t[4]+t[4],16)/255;break;case 4:e=Q_(t[1]+t[1],16),i=Q_(t[2]+t[2],16),s=Q_(t[3]+t[3],16);break;case 3:e=i=s=Q_(t[1]+t[2],16);break;case 2:e=i=s=Q_(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const rg=1/6,og=.5,ag=2/3,hg=1/3;function lg(t,e,i){return i<0?i++:i>1&&i--,i<rg?t+6*(e-t)*i:i<og?e:i<ag?t+(e-t)*(ag-i)*6:t}function dg(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=lg(a,s,t+hg),r=lg(a,s,t),o=lg(a,s,t-hg)}return{r:eg(255*n),g:eg(255*r),b:eg(255*o),a:s}}de.add("color"),qh.object=function(t,e){let i,s=!o(e)&&e<1;if(h(t)){const e=ig[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=ng(t);break;case"R":case"r":"("===t[4]&&Z_.test(t)?i=function(t){const e=Z_.exec(t);return{r:Q_(e[1]),g:Q_(e[2]),b:Q_(e[3]),a:tg(e[4])}}(t):"("===t[3]&&K_.test(t)&&(i=function(t){const e=K_.exec(t);return{r:Q_(e[1]),g:Q_(e[2]),b:Q_(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&J_.test(t)?i=function(t){const e=J_.exec(t);return dg(tg(e[1]),tg(e[2]),tg(e[3]),tg(e[4]))}(t):"("===t[3]&&$_.test(t)&&(i=function(t){const e=$_.exec(t);return dg(tg(e[1]),tg(e[2]),tg(e[3]),1)}(t))}if(!i){const e=q_[t.toLowerCase()];e&&(i=ng("#"+e))}i&&(sg++,sg>1e4&&(ig={},sg=0),ig[t]=Object.assign({},i))}}else p(t)&&(o(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:cg}=Math,{fourNumber:ug}=I,pg={fill:mg,stroke:mg,cornerRadius:(t,e,i)=>d(t)&&d(e)?fg(t,e,i):(t=ug(t),e=ug(e),t.map((t,s)=>fg(t,e[s],i))),text(t,e,i){if(h(t)&&h(e)){const s=t.length,n=e.length,r=fg(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return d(t)||d(e)?I.float(fg(t,e,i),Math.max(gg(t),gg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return nl.setBetweenStyle(n,t,e,n,i,s),n},shadow:vg,innerShadow:vg},_g={value:function(t,e,i){const s=d(t),n=d(e);return s&&n?t+(e-t)*i:n||s?fg(t,e,i):t},number:fg,color:yg,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=nl;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,r)))}};function gg(t){const e=String(t).split(".")[1];return e?e.length:0}function fg(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?cg(n):n}function yg(t,e,i){t=qh.object(t),e=qh.object(e);const s=fg(t.r,e.r,i,1)+","+fg(t.g,e.g,i,1)+","+fg(t.b,e.b,i,1),n=fg(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function mg(t,e,i){return h(t)&&h(e)?yg(t,e,i):e}function vg(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:fg((t=t||{}).x,e.x,i),y:fg(t.y,e.y,i),blur:fg(t.blur,e.blur,i),spread:fg(t.spread,e.spread,i),color:yg(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}de.add("animate","color"),sl.canAnimate=!0,Object.assign(nl.list,pg),Object.assign(nl,_g);const wg=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,pr),t.UI.addAttr("transition",!0,pr),t.UI.addAttr("transitionOut",void 0,pr),wg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},wg.animate=function(e,i,s,n){if(o(e))return this.__animate;let r=u(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,r.toStyle);const a=this.__animate;return a&&(r instanceof t.AnimateList?r.list.unshift(a):r=new t.AnimateList(this,[a,r])),this.__animate=r},wg.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},wg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(G_.COMPLETED,e)};const xg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],bg=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Eg}=Math,{getDerivative:Pg}=hi,Sg={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,p,_,g=0,f=h/2;for(let h=0;h<xg.length;h++)l=f*(1+xg[h]),d=f*(1-xg[h]),c=Pg(l,t,i,n,o),u=Pg(l,e,s,r,a),p=Pg(d,t,i,n,o),_=Pg(d,e,s,r,a),g+=bg[h]*(Eg(c*c+u*u)+Eg(p*p+_*_));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=Pg(t,e,s,r,a),d=Pg(t,i,n,o,h);return Math.atan2(d,l)/F},getT(t,e,i,s,n,r,o,a,h,l,d=1){let c=0,u=1,p=t/e,_=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>_;)Bg(i,s,n,r,o,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,p=d*n+e*o,_=d*r+e*a,g=d*c+e*p,f=d*u+e*_,y=d*g+e*(d*p+e*(d*o+e*h)),m=d*f+e*(d*_+e*(d*a+e*l));t.push(Ie.C,c,u,g,f,y,m)}},{getDistance:Bg}=Sg,{M:Tg,L:kg,C:Rg,Z:Cg}=Ie,{float:Lg}=I,Dg={},Ag={},Og={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Tg:case kg:Og.transformPoints(t,e,s,1),s+=3;break;case Rg:Og.transformPoints(t,e,s,3),s+=7;break;case Cg:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)Dg.x=t[n],Dg.y=t[n+1],Z.toOuterPoint(e,Dg),t[n]=Dg.x,t[n+1]=Dg.y},getMotionPathData(t){let e,i,s,n,r=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Tg:case kg:i=t[a+1],s=t[a+2],e=n===kg&&a>0?ht.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Rg:i=t[a+5],s=t[a+6],e=Sg.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Cg:a+=1;default:e=0}o.push(e),r+=e}return{total:r,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Kh.number(e,t.total);let r,o,a,h,l,d,c,u,p,_=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Tg:case kg:if(o=n[f+1],a=n[f+2],r=s[y],_+r>=e||!t.total)return f||(m=o,v=a),Ag.x=m,Ag.y=v,g.x=o,g.y=a,ht.getDistancePoint(Ag,g,e-_,!0),g.rotation=ht.getAngle(Ag,g),g;m=o,v=a,f+=3;break;case Rg:if(o=n[f+5],a=n[f+6],r=s[y],_+r>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=Sg.getT(e-_,r,m,v,l,d,c,u,o,a,i),hi.getPointAndSet(p,m,v,l,d,c,u,o,a,g),g.rotation=Sg.getRotation(p,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case Cg:f+=1;default:r=0}y++,_+=r}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=Kh.number(e,t.total);let o,a,h,l,d,c,u,p,_,g,f=0,y={},m=0,v=0,w=0,x=0;const b=n.length;for(;m<b;){switch(d=n[m],d){case Tg:case kg:if(h=n[m+1],l=n[m+2],o=s[v],f+o>e||!t.total)return m||(w=h,x=l),Ag.x=w,Ag.y=x,y.x=h,y.y=l,a=Lg(e-f),a&&(ht.getDistancePoint(Ag,y,a,!0),r.push(d,y.x,y.y)),r;w=h,x=l,m+=3,r.push(d,w,x);break;case Rg:if(c=n[m+1],u=n[m+2],p=n[m+3],_=n[m+4],h=n[m+5],l=n[m+6],o=s[v],f+o>e)return a=Lg(e-f),a&&(g=Sg.getT(a,o,w,x,c,u,p,_,h,l,i),Sg.cut(r,g,w,x,c,u,p,_,h,l)),r;w=h,x=l,m+=7,r.push(d,c,u,p,_,h,l);break;case Cg:m+=1,r.push(d);default:o=0}v++,f+=o}return r}};function Ig(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!a(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}de.add("motion-path"),nl.register("motion",function(t,e,i,s){return p(t)&&(t=Kh.number(t,s.getMotionTotal())),p(e)&&(e=Kh.number(e,s.getMotionTotal())),nl.number(t||0,e||0,i)}),nl.register("motionRotation",function(t,e,i){return nl.number(t,e,i)});const Mg=t.UI.prototype,{updateMatrix:Fg,updateAllMatrix:Wg}=ao,{updateBounds:Ug}=wo;function Ng(t){const{motion:e,leaferIsCreated:i}=t;if(!a(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Yg(t);i.total&&(t.__.__pathForRender=Og.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Wg(t),Ug(t,t)):Fg(t));i&&(t.leafer.created=!0)}}function zg(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function Yg(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Og.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,Ig),t.UI.addAttr("motionPrecision",1,Ig),t.UI.addAttr("motion",void 0,Ig),t.UI.addAttr("motionRotation",!0,Ig),Mg.getMotionPathData=function(){return Yg(zg(this))},Mg.getMotionPoint=function(t){const e=zg(this),i=Yg(e);if(!i.total)return{};const s=Og.getDistancePoint(i,t,e.motionPrecision);Z.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:d(n)&&(s.rotation+=n),s},Mg.getMotionTotal=function(){return this.getMotionPathData().total},Mg.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],a(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Ng(t))}else Ng(this)};const{Yes:Xg,NoAndSkip:Hg,YesAndSkip:jg}=t.Answer,Vg={},Gg={},qg={};class Kg{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Vg.id=t.substring(1),t=Vg;break;case".":Gg.className=t.substring(1),t=Gg;break;default:qg.tag=t,t=qg}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?g.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&ao.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),"boolean"==typeof r&&(r=r?1:0),r===Xg||r===jg){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<Hg&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Wo.REMOVE,this.__onRemoveChild,this),this.target.on_(No.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Zg=t.UI.prototype;function $g(t){return t.leafer?t.leafer.selector:te.selector||(te.selector=ce.selector())}return Zg.find=function(t,e){return $g(this).getBy(t,this,!1,e)},Zg.findOne=function(t,e){return $g(this).getBy(t,this,!0,e)},de.add("find"),ce.finder=function(t){return new Kg(t)},t.AlignHelper=Bt,t.AnimateEasing=j_,t.AnimateEvent=G_,t.AroundHelper=Et,t.AutoBounds=Kt,t.BezierHelper=hi,t.Bounds=Gt,t.BoundsEvent=Xo,t.BoundsHelper=Xt,t.BoxData=_l,t.BranchHelper=wo,t.BranchRender=Wa,t.CanvasData=Tl,t.CanvasManager=me,t.ChildEvent=Wo,t.ColorConvert=qh,t.Creator=ce,t.Cursor=ic,t.DataHelper=g,t.Debug=se,t.DragBoundsHelper=Ad,t.Dragger=jd,t.Effect=tl,t.EllipseData=vl,t.EllipseHelper=yi,t.Event=Fo,t.EventCreator=fe,t.Eventer=oa,t.Export=il,t.FileHelper=qn,t.Filter=el,t.Finder=Kg,t.FourNumberHelper=S,t.FrameData=fl,t.GroupData=pl,t.HighBezierHelper=Sg,t.HighCurveHelper=Og,t.HitCanvasManager=sc,t.ImageData=Bl,t.ImageEvent=Yo,t.ImageManager=ir,t.IncrementId=m,t.Interaction=wc,t.InteractionBase=ec,t.InteractionHelper=Ud,t.Keyboard=vd,t.LayoutEvent=$o,t.Layouter=Mh,t.LeafBounds=Oa,t.LeafBoundsHelper=fo,t.LeafData=y,t.LeafDataProxy=va,t.LeafEventer=ya,t.LeafHelper=ao,t.LeafLayout=Mo,t.LeafLevelList=wh,t.LeafList=vh,t.LeafMatrix=Ba,t.LeafRender=Ia,t.LeaferCanvas=bh,t.LeaferCanvasBase=De,t.LeaferData=gl,t.LeaferEvent=Qo,t.LeaferFilm=class extends or{get tag(){return"Film"}},t.LeaferImage=or,t.LeaferVideo=class extends or{get tag(){return"Video"}},t.LineData=yl,t.MathHelper=I,t.Matrix=ft,t.MatrixHelper=Z,t.MyDragEvent=Fd,t.MyImage=ud,t.MyPointerEvent=Id,t.MyTouchEvent=Wd,t.NeedConvertToCanvasCommandMap=Fe,t.OneRadian=F,t.PI2=W,t.PI_2=U,t.Paint=$h,t.PaintGradient=Qh,t.PaintImage=Jh,t.PathArrow=Zh,t.PathBounds=Mn,t.PathCommandDataHelper=Ss,t.PathCommandMap=Ie,t.PathCommandNodeHelper=mi,t.PathConvert=is,t.PathCorner=Xn,t.PathCreator=Ys,t.PathData=bl,t.PathDrawer=nn,t.PathHelper=Ae,t.PathNumberCommandLengthMap=ze,t.PathNumberCommandMap=Ne,t.PenData=El,t.Picker=Yh,t.Platform=te,t.Plugin=de,t.Point=_t,t.PointHelper=ht,t.PointerButton=wd,t.PolygonData=wl,t.PropertyEvent=No,t.RectData=ml,t.RectHelper=Ye,t.RectRender=Ol,t.RenderEvent=Jo,t.Renderer=Wh,t.ResizeEvent=Ko,t.Resource=tr,t.RobotData=i_,t.Run=ae,t.Selector=Xh,t.StarData=xl,t.State=sl,t.StringNumberMap=$t,t.TaskItem=$n,t.TaskProcessor=Jn,t.TextConvert=Gh,t.TextData=Sl,t.Transition=nl,t.TwoPointBoundsHelper=mt,t.UIBounds=Cl,t.UICreator=pe,t.UIData=cl,t.UIEvent=xd,t.UIRender=Dl,t.UnitConvert=Kh,t.UnitConvertHelper=Zt,t.WaitHelper=Bo,t.WatchEvent=Zo,t.Watcher=Sh,t.affectRenderBoundsType=Tr,t.affectStrokeBoundsType=Pr,t.attr=cr,t.autoLayoutType=fr,t.boundsType=vr,t.canvasPatch=Gn,t.canvasSizeAttrs=Le,t.createAttr=function(t){return(e,i)=>{ar(e,i,lr(i,t))}},t.createDescriptor=lr,t.cursorType=Wr,t.dataProcessor=Ur,t.dataType=pr,t.decorateLeafAttr=dr,t.defineDataProcessor=Nr,t.defineKey=ar,t.defineLeafAttr=ur,t.dimType=Rr,t.doBoundsType=xr,t.doStrokeType=Sr,t.effectType=Hh,t.emptyData=r,t.eraserType=Mr,t.extraPropertyEventMap=zo,t.getBoundsData=z,t.getDescriptor=hr,t.getMatrixData=Y,t.getPointData=N,t.hitType=Fr,t.isArray=u,t.isData=function(t){return p(t)&&!u(t)},t.isEmptyData=_,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=p,t.isString=h,t.isUndefined=o,t.layoutProcessor=function(t){return(e,i)=>{ar(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=na,t.maskType=Ir,t.motionPathType=Ig,t.naturalBoundsType=wr,t.opacityType=Cr,t.path=Hn,t.pathInputType=br,t.pathType=Er,t.pen=jn,t.positionType=_r,t.registerUI=qr,t.registerUIEvent=Kr,t.resizeType=jh,t.rewrite=Hr,t.rewriteAble=jr,t.rotationType=mr,t.scaleType=yr,t.scrollType=gr,t.sortType=Or,t.stateStyleType=n_,t.stateType=s_,t.strokeType=Br,t.surfaceType=kr,t.tempBounds=qt,t.tempMatrix=yt,t.tempPoint=gt,t.tryToNumber=function(t){return"string"==typeof t&&c.test(t)?+t:t},t.useCanvas=Eh,t.useModule=Gr,t.version="2.0.2",t.visibleType=Lr,t.zoomLayerType=Vh,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,i;function s(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function n(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())})}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","function"==typeof SuppressedError&&SuppressedError,t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const r={};function o(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;const{isArray:u}=Array;function p(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return f(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&f(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:f}=g;class y{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(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=o(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null,this.__complexData&&this.__complexData.destroy()}}const m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=v;return e[t]?e[t]++:(e[t]=1,0)}},v=m;let w,x,b;const{max:E}=Math,P=[0,0,0,0],S={zero:[...P],tempFour:P,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>B(P,t,e,i,s),toTempAB(t,e,i){b=i?d(t)?e:t:[],d(t)?(w=k(t),x=e):d(e)?(w=t,x=k(e)):(w=t,x=e),4!==w.length&&(w=T(w)),4!==x.length&&(x=T(x))},get(t,e){let i;if(!d(t))switch(t.length){case 4:i=o(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!o(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>d(t)&&d(e)?E(t,e):(C(t,e,i),B(b,E(w[0],x[0]),E(w[1],x[1]),E(w[2],x[2]),E(w[3],x[3]))),add:(t,e,i)=>d(t)&&d(e)?t+e:(C(t,e,i),B(b,w[0]+x[0],w[1]+x[1],w[2]+x[2],w[3]+x[3])),swapAndScale(t,e,i,s){if(d(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,h]=4===t.length?t:T(t);return B(n,a*i,h*e,r*i,o*e)}},{set:B,get:T,setTemp:k,toTempAB:C}=S,{round:R,pow:L,max:D,floor:A,PI:O}=Math,I={},M={within:(t,e,i)=>(p(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber:S.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=o(e)?1e12:L(10,e);return-0===(t=R(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&M.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,n){let{scaleX:r,scaleY:o}=t;if((s||e)&&(r<0&&(r=-r),o<0&&(o=-o)),e)if(!0===e)r=o=i?1:1/r;else{let t;d(e)?t=e:"zoom-in"===e&&(t=1),t&&(r=o=r>t||o>t?i?1:1/r:i?1:1/t)}return I.scaleX=r,I.scaleY=o,I},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(A(t),e)/t,randInt:F,randColor:t=>`rgba(${F(255)},${F(255)},${F(255)},${t||1})`};function F(t){return Math.round(Math.random()*t)}const W=O/180,U=2*O,N=O/2;function z(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:j,acos:V,sqrt:G}=Math,{float:q}=M,K={};function Z(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Z(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:X,getWorld:Z,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){J.toInnerPoint(t,e,K),J.scaleOfInner(t,K,i,s)},scaleOfInner(t,e,i,s=i){J.translateInner(t,e.x,e.y),J.scale(t,i,s),J.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=j(e*=W),a=H(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){J.toInnerPoint(t,e,K),J.rotateOfInner(t,K,i)},rotateOfInner(t,e,i){J.translateInner(t,e.x,e.y),J.rotate(t,i),J.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=W,t.a=s+r*i,t.b=n+o*i),e&&(e*=W,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){J.toInnerPoint(t,e,K),J.skewOfInner(t,K,i,s)},skewOfInner(t,e,i,s=0){J.translateInner(t,e.x,e.y),J.skew(t,i,s),J.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){J.multiply(t,J.tempInvert(e))},divideParent(t,e){J.multiplyParent(t,J.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=J;return J.copy(e,t),J.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*W,o=j(r),a=H(r);if(s||n){const e=s*W,i=n*W;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&J.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,p,_,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=G(n*n+r*r),c=t/d;const e=n/d;u=r>0?V(e):-V(e)}else{c=G(o*o+a*a),d=t/c;const e=o/c;u=N-(a>0?V(-e):-V(e))}const e=q(j(u)),i=H(u);d=q(d),c=q(c),p=e?q((o/c+i)/e/W,9):0,_=e?q((r/d-i)/e/W,9):0,u=q(u/W)}else d=n,c=a,u=p=_=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=G(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){J.set(t)}},J=$,{float:Q}=M,{toInnerPoint:tt,toOuterPoint:et}=$,{sin:it,cos:st,abs:nt,sqrt:rt,atan2:ot,min:at,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=o(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){p(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=W),n=it(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ut(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=nt(i-t),r=nt(s-e);return rt(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>at(ct(t,e,i,s),ct(i,s,n,r)),getAngle:(t,e)=>_t(t,e)/W,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/W),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-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,i,s,n){const r=_t(t,e);return n&&(t=e),s||(e={}),e.x=t.x+st(r)*i,e.y=t.y+it(r)*i,e},toNumberPoints(t){let e=t;return p(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,i)=>i?t.x===e.x&&t.y===e.y:Q(t.x)===Q(e.x)&&Q(t.y)===Q(e.y),reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,setRadius:pt,getAtan2:_t}=dt;class gt{constructor(t,e){this.set(t,e)}set(t,e){return p(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new gt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new gt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new gt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t,e){return lt.isSame(this,t,e)}reset(){return lt.reset(this),this}}const ft=new gt;class yt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return p(t)?$.copy(this,t):$.set(this,t,e,i,s,n,r),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new yt(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const mt=new yt,vt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){wt(t,e,i),wt(t,e+s,i+n)},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:wt}=vt;var xt,bt;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,(bt=t.Direction9||(t.Direction9={}))[bt.topLeft=0]="topLeft",bt[bt.top=1]="top",bt[bt.topRight=2]="topRight",bt[bt.right=3]="right",bt[bt.bottomRight=4]="bottomRight",bt[bt.bottom=5]="bottom",bt[bt.bottomLeft=6]="bottomLeft",bt[bt.left=7]="left",bt[bt.center=8]="center",bt[bt["top-left"]=0]="top-left",bt[bt["top-right"]=2]="top-right",bt[bt["bottom-right"]=4]="bottom-right",bt[bt["bottom-left"]=6]="bottom-left";const Et=[{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}];Et.forEach(t=>t.type="percent");const Pt={directionData:Et,tempPoint:{},get:St,toPoint(t,e,i,s,n,r){const o=St(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i,s=!0)=>(i||(i={}),Pt.toPoint(t,e,i,s),i)};function St(e){return h(e)?Et[t.Direction9[e]]:e}const{toPoint:Bt}=Pt,Tt={toPoint(t,e,i,s,n,r){Bt(t,i,s,n,e,r)}},{tempPointBounds:kt,setPoint:Ct,addPoint:Rt,toBounds:Lt}=vt,{toOuterPoint:Dt}=$,{float:At,fourNumber:Ot}=M,{floor:It,ceil:Mt}=Math;let Ft,Wt,Ut,Nt;const zt={},Yt={},Xt={},Ht={tempBounds:Xt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=Ot(i);s?jt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(jt.copy(Xt,t),jt.toOuterOf(Xt,e),Xt),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else zt.x=t.x,zt.y=t.y,Dt(e,zt,Yt),Ct(kt,Yt.x,Yt.y),zt.x=t.x+t.width,Dt(e,zt,Yt),Rt(kt,Yt.x,Yt.y),zt.y=t.y+t.height,Dt(e,zt,Yt),Rt(kt,Yt.x,Yt.y),zt.x=t.x,Dt(e,zt,Yt),Rt(kt,Yt.x,Yt.y),Lt(kt,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new yt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),h(s)&&(s=jt.getFitScale(t,e,"cover"===s)),Xt.width=n?e.width*=s:e.width*s,Xt.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Xt,t,r,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(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=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){Ft=t.x+t.width,Wt=t.y+t.height,Ut=e.x,Nt=e.y,i||(Ut+=e.width,Nt+=e.height),Ft=Ft>Ut?Ft:Ut,Wt=Wt>Nt?Wt:Nt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ft-t.x,t.height=Wt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Gt(t,n)):Vt(t,n));r&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(kt,t.x,t.y):Rt(kt,t.x,t.y)),Lt(kt,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Vt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},getPoint:(t,e,i=!1,s)=>Pt.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=lt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=jt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=jt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Ft=s+r,Wt=n+o,Ut=t.x+t.width,Nt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Ft=Ft<Ut?Ft:Ut,Wt=Wt<Nt?Wt:Nt,r=Ft-s,o=Wt-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){jt.copy(t,jt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){jt.set(t)}},jt=Ht,{add:Vt,copy:Gt}=jt;class qt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return p(t)?Ht.copy(this,t):Ht.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new qt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}getPoint(t,e,i){return Ht.getPoint(this,t,e,i)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new qt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const Kt=new qt;class Zt{constructor(t,e,i,s,n,r){p(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new qt(n,e,r||t.width-n-i,o||t.height-e-s)}}const $t={number:(t,e)=>p(t)?"percent"===t.type?t.value*e:t.value:t},Jt={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},{floor:Qt,max:te}=Math,ee={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||ie.maxCacheSize),isSuperLarge:(t,e,i)=>ie.isLarge(t,e,i,ie.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ie;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=te(Qt(e+(s||0)),1),c=te(Qt(i+(n||0)),1);let u,p,_;l&&(_=$t.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:p=!0);const g=ee.origin.createCanvas(p?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ie.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);_&&(f.drawImage(g,0,0,d,c,u?_-d:d,u?c:_-c,d,c),f.drawImage(g,0,0,d,c,u?_:d,u?c:_,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:ie}=ee,{randColor:se}=M;class ne{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ne(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const i=se();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ne.showBounds,n=t.__nowWorld,r=se();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(oe.enable){if(oe.filterList.length&&oe.filterList.every(t=>t!==this.name))return;if(oe.excludeList.length&&oe.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){oe.enable&&this.warn(...t)}warn(...t){oe.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 re(t){return t?h(t)&&(t=[t]):t=[],t}ne.filterList=[],ne.excludeList=[],ne.showWarn=!0;const oe=ne,ae=ne.get("RunTime"),he={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=m.create(m.RUNTIME);return le.currentId=le.idMap[i]=e?performance.now():Date.now(),le.currentName=le.nameMap[i]=t,le.nameToIdMap[t]=i,i},end(t,e){const i=le.idMap[t],s=le.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;le.idMap[t]=le.nameMap[t]=le.nameToIdMap[s]=void 0,ae.log(s,n,"ms")},endOfName(t,e){const i=le.nameToIdMap[t];o(i)||le.end(i,e)}},le=he,de=[],ce={list:{},add(t,...e){this.list[t]=!0,de.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>de.forEach(t=>ce.has(t,!0)));const ue={editor:t=>ce.need("editor")},pe=ne.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;ge[e]&&pe.repeat(e),ge[e]=t},get(t,e,i,s,n,r){if(!ge[t])return void pe.warn("not register "+t);const a=new ge[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:ge}=_e,fe=ne.get("EventCreator"),ye={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(me[e]&&fe.repeat(e),me[e]=t)})},changeName(t,e){const i=me[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,me[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new me[t](...e)},{nameList:me}=ye;class ve{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ue.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function we(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}const xe=[];function be(){return(t,e)=>{xe.push(e)}}const Ee=[];class Pe{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||Ee)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){p(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}s([we("imageSmoothingEnabled")],Pe.prototype,"smooth",void 0),s([we("imageSmoothingQuality")],Pe.prototype,"smoothLevel",void 0),s([we("globalAlpha")],Pe.prototype,"opacity",void 0),s([we()],Pe.prototype,"fillStyle",void 0),s([we()],Pe.prototype,"strokeStyle",void 0),s([we("lineWidth")],Pe.prototype,"strokeWidth",void 0),s([we("lineCap")],Pe.prototype,"strokeCap",void 0),s([we("lineJoin")],Pe.prototype,"strokeJoin",void 0),s([we("lineDashOffset")],Pe.prototype,"dashOffset",void 0),s([we()],Pe.prototype,"miterLimit",void 0),s([we()],Pe.prototype,"shadowBlur",void 0),s([we()],Pe.prototype,"shadowColor",void 0),s([we()],Pe.prototype,"shadowOffsetX",void 0),s([we()],Pe.prototype,"shadowOffsetY",void 0),s([we()],Pe.prototype,"filter",void 0),s([we()],Pe.prototype,"font",void 0),s([we()],Pe.prototype,"fontKerning",void 0),s([we()],Pe.prototype,"fontStretch",void 0),s([we()],Pe.prototype,"fontVariantCaps",void 0),s([we()],Pe.prototype,"textAlign",void 0),s([we()],Pe.prototype,"textBaseline",void 0),s([we()],Pe.prototype,"textRendering",void 0),s([we()],Pe.prototype,"wordSpacing",void 0),s([we()],Pe.prototype,"letterSpacing",void 0),s([we()],Pe.prototype,"direction",void 0),s([be()],Pe.prototype,"setTransform",null),s([be()],Pe.prototype,"resetTransform",null),s([be()],Pe.prototype,"getTransform",null),s([be()],Pe.prototype,"save",null),s([be()],Pe.prototype,"restore",null),s([be()],Pe.prototype,"translate",null),s([be()],Pe.prototype,"scale",null),s([be()],Pe.prototype,"rotate",null),s([be()],Pe.prototype,"fill",null),s([be()],Pe.prototype,"stroke",null),s([be()],Pe.prototype,"clip",null),s([be()],Pe.prototype,"fillRect",null),s([be()],Pe.prototype,"strokeRect",null),s([be()],Pe.prototype,"clearRect",null),s([be()],Pe.prototype,"beginPath",null),s([be()],Pe.prototype,"moveTo",null),s([be()],Pe.prototype,"lineTo",null),s([be()],Pe.prototype,"bezierCurveTo",null),s([be()],Pe.prototype,"quadraticCurveTo",null),s([be()],Pe.prototype,"closePath",null),s([be()],Pe.prototype,"arc",null),s([be()],Pe.prototype,"arcTo",null),s([be()],Pe.prototype,"ellipse",null),s([be()],Pe.prototype,"rect",null),s([be()],Pe.prototype,"roundRect",null),s([be()],Pe.prototype,"createConicGradient",null),s([be()],Pe.prototype,"createLinearGradient",null),s([be()],Pe.prototype,"createPattern",null),s([be()],Pe.prototype,"createRadialGradient",null),s([be()],Pe.prototype,"fillText",null),s([be()],Pe.prototype,"measureText",null),s([be()],Pe.prototype,"strokeText",null);const{copy:Se,multiplyParent:Be,pixelScale:Te}=$,{round:ke}=Math,Ce=new qt,Re=new qt,Le={width:1,height:1,pixelRatio:1},De=["width","height","pixelRatio"];class Ae extends Pe{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=Le),this.manager=e,this.innerId=m.create(m.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||ee.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;g.copyAttrs(s,t,De),De.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Be(t,e,n),Te(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=ke(n.e-.5)+.5,n.f=ke(n.f-.5)+.5):(n.e=ke(n.e),n.f=ke(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Re):i=Ce,this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ht.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Ce.x,Ce.y,Ce.width,Ce.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,Ce.x,Ce.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ce.x,Ce.y,Ce.width,Ce.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ce.x,Ce.y,Ce.width,Ce.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ce,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Re,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ue.canvas(Object.assign({},i));return n.save(),t&&(Se(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}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 Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ie={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Me=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Ie),Fe={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},We={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},Ue=Object.assign(Object.assign({},We),Ie),Ne=Me,ze={};for(let t in Ne)ze[Ne[t]]=t;const Ye={};for(let t in Ne)Ye[Ne[t]]=Fe[t];const Xe={drawRoundRect(t,e,i,s,n,r){const o=M.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:He,cos:je,hypot:Ve,atan2:Ge,ceil:qe,abs:Ke,PI:Ze,sqrt:$e,pow:Je}=Math,{setPoint:Qe,addPoint:ti}=vt,{set:ei,toNumberPoints:ii}=lt,{M:si,L:ni,C:ri,Q:oi,Z:ai}=Me,hi={},li={points(t,e,i,s){let n=ii(e);if(t.push(si,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,_,g,f,y,m,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=o-e,g=a-r,f=$e(Je(_,2)+Je(g,2)),y=$e(Je(h-o,2)+Je(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,o,a):(_||g)&&t.push(ri,u,p,d,c,o,a),u=o+y*h,p=a+y*l);s||t.push(oi,u,p,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ni,n[e],n[e+1]);s&&t.push(ai)},rect(t,e,i,s,n){Oe.creator.path=t,Oe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){Oe.creator.path=[],Xe.drawRoundRect(Oe.creator,e,i,s,n,r),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,p=r-s,_=o-n;let g=Ge(u,c),f=Ge(_,p);const y=Ve(c,u),m=Ve(p,_);let v=f-g;if(v<0&&(v+=U),y<1e-12||m<1e-12||v<1e-12||Ke(v-Ze)<1e-12)return t&&t.push(ni,s,n),h&&(Qe(h,e,i),ti(h,s,n)),d&&ei(d,e,i),void(l&&ei(l,s,n));const w=c*_-p*u<0,x=w?-1:1,b=a/je(v/2),E=s+b*je(g+v/2+N*x),P=n+b*He(g+v/2+N*x);return g-=N*x,f-=N*x,ui(t,E,P,a,a,0,g/W,f/W,w,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ui(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*W,p=He(u),_=je(u);let g=o*W,f=a*W;g>Ze&&(g-=U),f<0&&(f+=U);let y=f-g;y<0?y+=U:y>U&&(y-=U),h&&(y-=U);const m=qe(Ke(y/N)),v=y/m,w=He(v/4),x=8/3*w*w/He(v/2);f=g+v;let b,E,P,S,B,T,k,C,R=je(g),L=He(g),D=P=_*s*R-p*n*L,A=S=p*s*R+_*n*L,O=e+P,I=i+S;t&&t.push(t.length?ni:si,O,I),l&&Qe(l,O,I),c&&ei(c,O,I);for(let r=0;r<m;r++)b=je(f),E=He(f),P=_*s*b-p*n*E,S=p*s*b+_*n*E,B=e+D-x*(_*s*L+p*n*R),T=i+A-x*(p*s*L-_*n*R),k=e+P+x*(_*s*E+p*n*b),C=i+S+x*(p*s*E-_*n*b),t&&t.push(ri,B,T,k,C,e+P,i+S),l&&ci(e+D,i+A,B,T,k,C,e+P,i+S,l,!0),D=P,A=S,R=b,L=E,g=f,f+=v;d&&ei(d,e+P,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ri,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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?ti(h,t,e):Qe(h,t,e),ti(h,o,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,n,r,o,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*r+_*a,l.y=c*i+u*n+p*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return di(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:pi,cos:_i,sqrt:gi,atan2:fi}=Math,{ellipse:yi}=li,mi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=r*W,_=pi(p),g=_i(p),f=-g*c-_*u,y=-g*u+_*c,m=s*s,v=n*n,w=y*y,x=f*f,b=m*v-m*w-v*x;let E=0;if(b<0){const t=gi(1-b/(m*v));s*=t,n*=t}else E=(o===a?-1:1)*gi(b/(m*w+v*x));const P=E*s*y/n,S=-E*n*f/s,B=fi((y-S)/n,(f-P)/s),T=fi((-y-S)/n,(-f-P)/s);let k=T-B;0===a&&k>0?k-=U:1===a&&k<0&&(k+=U);const C=e+c+g*P-_*S,R=i+u+_*P+g*S,L=k<0?1:0;d||ee.ellipseToCurve?yi(t,C,R,s,n,r,B/W,T/W,L):s!==n||r?t.push(Me.G,C,R,s,n,r,B/W,T/W,L):t.push(Me.O,C,R,s,B/W,T/W,L)}},vi={toCommand:t=>[],toNode:t=>[]},{M:wi,m:xi,L:bi,l:Ei,H:Pi,h:Si,V:Bi,v:Ti,C:ki,c:Ci,S:Ri,s:Li,Q:Di,q:Ai,T:Oi,t:Ii,A:Mi,a:Fi,Z:Wi,z:Ui,N:Ni,D:zi,X:Yi,G:Xi,F:Hi,O:ji,P:Vi,U:Gi}=Me,{rect:qi,roundRect:Ki,arcTo:Zi,arc:$i,ellipse:Ji,quadraticCurveTo:Qi}=li,{ellipticalArc:ts}=mi,es=ne.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ye[s],a+=s===n?" ":ze[s];for(let s=1;s<i;s++)a+=M.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?Ue:We;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(ns.dot&&(rs(o,r),r=""),ns.dot++),"0"===r&&"."!==s&&(rs(o,r),r=""),r+=s):Me[s]?(r&&(rs(o,r),r=""),ns.name=Me[s],ns.length=Fe[s],ns.index=0,rs(o,ns.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&rs(o,r),r=s):r&&(rs(o,r),r=""),n=s;return r&&rs(o,r),i?ss.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case xi:t[c+1]+=a,t[c+2]+=h;case wi:a=t[c+1],h=t[c+2],p.push(wi,a,h),c+=3;break;case Si:t[c+1]+=a;case Pi:a=t[c+1],p.push(bi,a,h),c+=2;break;case Ti:t[c+1]+=h;case Bi:h=t[c+1],p.push(bi,a,h),c+=2;break;case Ei:t[c+1]+=a,t[c+2]+=h;case bi:a=t[c+1],h=t[c+2],p.push(bi,a,h),c+=3;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ri;case Ri:o=r===ki||r===Ri,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(ki,l,d,i,s,a,h),c+=5;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=ki;case ki:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(ki,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ii:t[c+1]+=a,t[c+2]+=h,n=Oi;case Oi:o=r===Di||r===Oi,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Qi(p,a,h,i,s,t[c+1],t[c+2]):p.push(Di,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ai:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Di;case Di:i=t[c+1],s=t[c+2],e?Qi(p,a,h,i,s,t[c+3],t[c+4]):p.push(Di,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Fi:t[c+6]+=a,t[c+7]+=h;case Mi:ts(p,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 Ui:case Wi:p.push(Wi),c++;break;case Ni:a=t[c+1],h=t[c+2],e?qi(p,a,h,t[c+3],t[c+4]):os(p,t,c,5),c+=5;break;case zi:a=t[c+1],h=t[c+2],e?Ki(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):os(p,t,c,9),c+=9;break;case Yi:a=t[c+1],h=t[c+2],e?Ki(p,a,h,t[c+3],t[c+4],t[c+5]):os(p,t,c,6),c+=6;break;case Xi:Ji(e?p:os(p,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,is),a=is.x,h=is.y,c+=9;break;case Hi:e?Ji(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):os(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ji:$i(e?p:os(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,is),a=is.x,h=is.y,c+=7;break;case Vi:e?$i(p,t[c+1],t[c+2],t[c+3],0,360,!1):os(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Gi:Zi(e?p:os(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,is),a=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(wi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(ki,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Di,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:rs,copyData:os}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:ps,X:_s,G:gs,F:fs,O:ys,P:ms,U:vs}=Me,{getMinDistanceFrom:ws,getRadianFrom:xs}=lt,{tan:bs,min:Es,abs:Ps}=Math,Ss={},Bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(ls,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ds,e,i,s,n)},closePath(t){t.push(cs)},rect(t,e,i,s,n){t.push(us,e,i,s,n)},roundRect(t,e,i,s,n,r){if(d(r))t.push(_s,e,i,s,n,r);else{const o=M.fourNumber(r);o?t.push(ps,e,i,s,n,...o):t.push(us,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,h,l){if(s===n)return ks(t,e,i,s,o,h,l);a(r)?t.push(fs,e,i,s,n):(a(o)&&(o=0),a(h)&&(h=360),t.push(gs,e,i,s,n,r,o,h,l?1:0))},arc(t,e,i,s,n,r,o){a(n)?t.push(ms,e,i,s):(a(n)&&(n=0),a(r)&&(r=360),t.push(ys,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,a,h,l){if(!o(a)){const t=ws(a,h,e,i,s,n)/(l?1:2);r=Es(r,Es(t,t*Ps(bs(xs(a,h,e,i,s,n)/2))))}t.push(vs,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,h,l){li.ellipse(null,e,i,s,n,a(r)?0:r,a(o)?0:o,a(h)?360:h,l,null,null,Ss),t.push(as,Ss.x,Ss.y),Ts(t,e,i,s,n,r,o,h,l)},drawArc(t,e,i,s,n,r,o){li.arc(null,e,i,s,a(n)?0:n,a(r)?360:r,o,null,null,Ss),t.push(as,Ss.x,Ss.y),ks(t,e,i,s,n,r,o)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Ts,arc:ks}=Bs,{moveTo:Cs,lineTo:Rs,quadraticCurveTo:Ls,bezierCurveTo:Ds,closePath:As,beginPath:Os,rect:Is,roundRect:Ms,ellipse:Fs,arc:Ws,arcTo:Us,drawEllipse:Ns,drawArc:zs,drawPoints:Ys}=Bs;class Xs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?Oe.parse(t):t:[],this}beginPath(){return Os(this.__path),this.paint(),this}moveTo(t,e){return Cs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Rs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ds(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return As(this.__path),this.paint(),this}rect(t,e,i,s){return Is(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Ms(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Fs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Ws(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Us(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Ns(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return zs(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return Ys(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Hs,L:js,C:Vs,Q:Gs,Z:qs,N:Ks,D:Zs,X:$s,G:Js,F:Qs,O:tn,P:en,U:sn}=Me,nn=ne.get("PathDrawer"),rn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Hs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case js:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Vs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case qs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Zs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case $s:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Js:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*W,e[s+6]*W,e[s+7]*W,e[s+8]),s+=9;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*W,e[s+5]*W,e[s+6]),s+=7;break;case en:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case sn:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void nn.error(`command: ${i} [index:${s}]`,e)}}},{M:on,L:an,C:hn,Q:ln,Z:dn,N:cn,D:un,X:pn,G:_n,F:gn,O:fn,P:yn,U:mn}=Me,{toTwoPointBounds:vn,toTwoPointBoundsByQuadraticCurve:wn,arcTo:xn,arc:bn,ellipse:En}=li,{addPointBounds:Pn,copy:Sn,addPoint:Bn,setPoint:Tn,addBounds:kn,toBounds:Cn}=vt,Rn=ne.get("PathBounds");let Ln,Dn,An;const On={},In={},Mn={},Fn={toBounds(t,e){Fn.toTwoPointBounds(t,In),Cn(In,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Tn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===dn||o===hn||o===ln?Tn(e,h,l):Tn(e,t[a+1],t[a+2])),o){case on:case an:h=t[a+1],l=t[a+2],Bn(e,h,l),a+=3;break;case hn:n=t[a+5],r=t[a+6],vn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,On),Pn(e,On),h=n,l=r,a+=7;break;case ln:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],wn(h,l,i,s,n,r,On),Pn(e,On),h=n,l=r,a+=5;break;case dn:a+=1;break;case cn:h=t[a+1],l=t[a+2],kn(e,h,l,t[a+3],t[a+4]),a+=5;break;case un:case pn:h=t[a+1],l=t[a+2],kn(e,h,l,t[a+3],t[a+4]),a+=o===un?9:6;break;case _n:En(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],On,Mn),0===a?Sn(e,On):Pn(e,On),h=Mn.x,l=Mn.y,a+=9;break;case gn:h=t[a+1],l=t[a+2],Dn=t[a+3],An=t[a+4],kn(e,h-Dn,l-An,2*Dn,2*An),h+=Dn,a+=5;break;case fn:bn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],On,Mn),0===a?Sn(e,On):Pn(e,On),h=Mn.x,l=Mn.y,a+=7;break;case yn:h=t[a+1],l=t[a+2],Ln=t[a+3],kn(e,h-Ln,l-Ln,2*Ln,2*Ln),h+=Ln,a+=4;break;case mn:xn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],On,Mn),0===a?Sn(e,On):Pn(e,On),h=Mn.x,l=Mn.y,a+=6;break;default:return void Rn.error(`command: ${o} [index:${a}]`,t)}}},{M:Wn,L:Un,Z:Nn}=Me,{getCenterX:zn,getCenterY:Yn}=lt,{arcTo:Xn}=Bs,Hn={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,d=0,c=0,p=0,_=0,g=0;u(e)&&(e=e[0]||0);const f=t.length,y=9===f,m=[];for(;o<f;){switch(s=t[o],s){case Wn:l=_=t[o+1],d=g=t[o+2],o+=3,t[o]===Un?(c=t[o+1],p=t[o+2],y?m.push(Wn,l,d):m.push(Wn,zn(l,c),Yn(d,p))):m.push(Wn,l,d);break;case Un:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Un:Xn(m,a,h,t[o+1],t[o+2],e,_,g,y);break;case Nn:Xn(m,a,h,l,d,e,_,g,y);break;default:m.push(Un,a,h)}_=a,g=h;break;case Nn:n!==Nn&&(Xn(m,l,d,c,p,e,_,g,y),m.push(Nn)),o+=1;break;default:r=Ye[s];for(let e=0;e<r;e++)m.push(t[o+e]);o+=r}n=s}return s!==Nn&&(m[1]=l,m[2]=d),m}};function jn(t){return new Xs(t)}const Vn=jn();Oe.creator=jn(),Oe.parse=ss.parse,Oe.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:Gn}=Xe;function qn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Gn(this,t,e,i,s,n)})}(t)}const Kn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Zn.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{}}}},Zn=Kn;Zn.mineType=Zn.mimeType,Zn.alphaPixelTypes.forEach(t=>Zn.upperCaseTypeMap[t]=t.toUpperCase());const $n=ne.get("TaskProcessor");class Jn{constructor(t){this.parallel=!0,this.time=1,this.id=m.create(m.TASK),this.task=t}run(){return n(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){$n.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Qn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&g.assign(this.config,t),this.empty()}add(t,e,i){let s,n,r,a;const h=new Jn(t);return h.parent=this,d(e)?a=e:e&&(n=e.parallel,s=e.start,r=e.time,a=e.delay,i||(i=e.canUse)),r&&(h.time=r),!1===n&&(h.parallel=!1),i&&(h.canUse=i),o(a)?this.push(h,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(h,s))},a)),this.isComplete=!1,h}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.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const tr=ne.get("Resource"),er={tasker:new Qn,queue:new Qn({parallel:1}),map:{},get isComplete(){return ir.tasker.isComplete},set(t,e){ir.map[t]&&tr.repeat(t),ir.map[t]=e},get:t=>ir.map[t],remove(t){const e=ir.map[t];e&&(e.destroy&&e.destroy(),delete ir.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ue.image(s)),ir.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){ir.map={}}},ir=er,sr={maxRecycled:10,recycledList:[],patternTasker:er.queue,get(t,e){let i=er.get(t.url);return i||er.set(t.url,i="film"===e?ue.film(t):ue.image(t)),i.use++,i},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(ee.image.isLarge(t)?t.url&&er.remove(t.url):(t.clearLevels(),nr.recycledList.push(t)))})},recyclePaint(t){nr.recycle(t.image)},clearRecycled(t){const e=nr.recycledList;(e.length>nr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&er.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Kn.alphaPixelTypes.some(e=>nr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Kn.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Kn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},nr=sr,{IMAGE:rr,create:or}=m;class ar{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return o(t)?ee.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=or(rr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}sr.isFormat("svg",t)&&(this.isSVG=!0),sr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,er.tasker.add(()=>n(this,void 0,void 0,function*(){return yield ee.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,r,o,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=ee.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=ee.canvas.createPattern(t,e);return ee.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,r,o,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function hr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function lr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function cr(t,e){return(i,s)=>pr(i,s,t,e&&e(s))}function ur(t){return t}function pr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};hr(t,e,Object.assign(n,s||{})),zr(t,e,i)}function _r(t){return cr(t)}function gr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function fr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function yr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),br(this))}}))}function mr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function vr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function wr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&br(this)}}))}function xr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(br(this),this.__.__removeNaturalSize())}}))}function br(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Er(t){return cr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),br(this)}}))}const Pr=wr;function Sr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i)&&(Br(this),e&&(this.__.__useStroke=!0))}}))}function Br(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&br(t)}const Tr=Sr;function kr(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Cr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Rr(t){return cr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;g.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function Lr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Ar(this)}}))}function Dr(t){return cr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Or(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Or(this,t,e,i),this.mask&&Ar(this)}}))}function Ar(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Or(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||br(t))}function Ir(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__layout.childrenSortChange()})}}))}function Mr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Fr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Wr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function Ur(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Nr(t){return(e,i)=>{hr(e,"__DataProcessor",{get:()=>t})}}function zr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=dr(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(p(i)){const t=_(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:g.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=lr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),hr(s,e,a)}const Yr=new ne("rewrite"),Xr=[],Hr=["destroy","constructor"];function jr(t){return(e,i)=>{Xr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Vr(){return t=>{Gr()}}function Gr(t){Xr.length&&(Xr.forEach(e=>{t&&Yr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Xr.length=0)}function qr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Hr.includes(s)||e&&e.includes(s)))if(t.prototype){lr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Kr(){return t=>{_e.register(t)}}function Zr(){return t=>{ye.register(t)}}setTimeout(()=>Gr(!0));const{copy:$r,toInnerPoint:Jr,toOuterPoint:Qr,scaleOfOuter:to,rotateOfOuter:eo,skewOfOuter:io,multiplyParent:so,divideParent:no,getLayout:ro}=$,oo={},{round:ao}=Math,ho={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),uo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)co(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)po(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&po(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&lo.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(go(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)_o(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,r){s||(s=t.__nowWorld),t.__worldFlipped||ee.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},renderComplex(t,e,i){},updateComplex(t){},checkComplex(t){},moveWorld(t,e,i=0,s,n){const r=p(e)?Object.assign({},e):{x:e,y:i};s?Qr(t.localTransform,r,r,!0):t.parent&&Jr(t.parent.scrollWorldTransform,r,r,!0),lo.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){p(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=ao(e),i=ao(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){lo.zoomOfLocal(t,fo(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(d(s)||(s&&(r=s),s=i),$r(oo,o),to(oo,e,i,s),lo.hasHighPosition(t))lo.setTransform(t,oo,n,r);else{const e=t.x+oo.e-o.e,a=t.y+oo.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){lo.rotateOfLocal(t,fo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;$r(oo,n),eo(oo,e,i),lo.hasHighPosition(t)?lo.setTransform(t,oo,!1,s):t.set({x:t.x+oo.e-n.e,y:t.y+oo.f-n.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){lo.skewOfLocal(t,fo(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){$r(oo,t.__localMatrix),io(oo,e,i,s),lo.setTransform(t,oo,n,r)},transformWorld(t,e,i,s){$r(oo,t.worldTransform),so(oo,e),t.parent&&no(oo,t.parent.scrollWorldTransform),lo.setTransform(t,oo,i,s)},transform(t,e,i,s){$r(oo,t.localTransform),so(oo,e),lo.setTransform(t,oo,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&lo.getInnerOrigin(t,n.origin),o=ro(e,r,n.around&&lo.getInnerOrigin(t,n.around));if(lo.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Ht.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=lo.getInnerOrigin(t,n.origin);lt.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return to(i,lo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(lo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Pt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>($r(oo,t.worldTransform),no(oo,e.scrollWorldTransform),i?oo:Object.assign({},oo)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,i,s){t.setTransform(lo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||lo.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),ee.requestRender(()=>lo.animateMove(t,e,i))}}},lo=ho,{updateAllMatrix:co,updateMatrix:uo,updateAllWorldOpacity:po,updateAllChange:_o,updateChange:go}=lo;function fo(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const yo={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){const{__:e,__layout:i}=t;return e.eraser||0===e.visible?null:i.localOuterBounds||i.localRenderBounds},maskLocalBoxBounds:(t,e)=>vo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>vo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:i}=t;return vo(t,e)&&(i.localOuterBounds||i.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let mo;function vo(t,e){return e||(mo=0),t.__.mask&&(mo=1),mo<0?null:(mo&&(mo=-1),!0)}const{updateBounds:wo}=ho,xo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),bo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)Eo(e[t],e)},updateBounds(t,e){const i=[t];Eo(t,i),Po(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)wo(s[t]);e&&e===i||wo(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&So(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&Bo(t,e,i,s,n,r,o)}},{pushAllChildBranch:bo,pushAllBranchStack:Eo,updateBoundsByBranchStack:Po,move:So,scale:Bo}=xo,To={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:ko,updateBounds:Co}=ho,{toOuterOf:Ro,getPoints:Lo,copy:Do}=Ht,Ao="_localContentBounds",Oo="_worldContentBounds",Io="_worldBoxBounds",Mo="_worldStrokeBounds";class Fo{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return Ro(this.contentBounds,this.leaf.__localMatrix,this[Ao]||(this[Ao]={})),this[Ao]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ro(this.contentBounds,this.leaf.__world,this[Oo]||(this[Oo]={})),this[Oo]}get worldBoxBounds(){return Ro(this.boxBounds,this.leaf.__world,this[Io]||(this[Io]={})),this[Io]}get worldStrokeBounds(){return Ro(this.strokeBounds,this.leaf.__world,this[Mo]||(this[Mo]={})),this[Mo]}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 Co(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,ee.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return $.defaultMatrix;case"page":t=e.zoomLayer;default:return ko(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 qt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=ko(s,e,!0)}if(o||(o=$.getLayout(r)),Do(o,a),lt.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Lo(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Wo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&ee.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&ee.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&ee.event.stop(this.origin)}}class Uo extends Wo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Uo.ADD="child.add",Uo.REMOVE="child.remove",Uo.CREATED="created",Uo.MOUNTED="mounted",Uo.UNMOUNTED="unmounted",Uo.DESTROY="destroy";const No="property.scroll";class zo extends Wo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}zo.CHANGE="property.change",zo.LEAFER_CHANGE="property.leafer_change",zo.SCROLL=No;const Yo={scrollX:No,scrollY:No};class Xo extends Wo{constructor(t,e){super(t),Object.assign(this,e)}}Xo.LOAD="image.load",Xo.LOADED="image.loaded",Xo.ERROR="image.error";class Ho extends Wo{static checkHas(t,e,i){"on"===i?e===qo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(jo)||t.hasEvent(Vo)||t.hasEvent(Go),t.__hasWorldEvent=t.hasEvent(qo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(jo,t),"inner"===e&&t.emit(Vo,t)),t.emit(Go,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(qo,t)}}Ho.RESIZE="bounds.resize",Ho.INNER="bounds.inner",Ho.LOCAL="bounds.local",Ho.WORLD="bounds.world";const{RESIZE:jo,INNER:Vo,LOCAL:Go,WORLD:qo}=Ho,Ko={};[jo,Vo,Go,qo].forEach(t=>Ko[t]=1);class Zo extends Wo{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){p(t)?(super(Zo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Zo.RESIZE="resize";class $o extends Wo{constructor(t,e){super(t),this.data=e}}$o.REQUEST="watch.request",$o.DATA="watch.data";class Jo extends Wo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Jo.REQUEST="layout.request",Jo.START="layout.start",Jo.BEFORE="layout.before",Jo.LAYOUT="layout",Jo.AFTER="layout.after",Jo.AGAIN="layout.again",Jo.END="layout.end";class Qo extends Wo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Qo.REQUEST="render.request",Qo.CHILD_START="render.child_start",Qo.CHILD_END="render.child_end",Qo.START="render.start",Qo.BEFORE="render.before",Qo.RENDER="render",Qo.AFTER="render.after",Qo.AGAIN="render.again",Qo.END="render.end",Qo.NEXT="render.next";class ta extends Wo{}ta.START="leafer.start",ta.BEFORE_READY="leafer.before_ready",ta.READY="leafer.ready",ta.AFTER_READY="leafer.after_ready",ta.VIEW_READY="leafer.view_ready",ta.VIEW_COMPLETED="leafer.view_completed",ta.STOP="leafer.stop",ta.RESTART="leafer.restart",ta.END="leafer.end",ta.UPDATE_MODE="leafer.update_mode",ta.TRANSFORM="leafer.transform",ta.MOVE="leafer.move",ta.SCALE="leafer.scale",ta.ROTATE="leafer.rotate",ta.SKEW="leafer.skew";const{MOVE:ea,SCALE:ia,ROTATE:sa,SKEW:na}=ta,ra={x:ea,y:ea,scaleX:ia,scaleY:ia,rotation:sa,skewX:na,skewY:na},oa={};class aa{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=ha(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(r=o[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):o[t]=[l],Ko[t]&&Ho.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ha(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],Ko[t]&&Ho.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));p(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ye.has(t)&&(e=ye.get(t,{type:t,target:this,current:this}));const s=ha(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ha(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:oa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:oa)}}const{on:la,on_:da,off:ca,off_:ua,once:pa,emit:_a,emitEvent:ga,hasEvent:fa,destroy:ya}=aa.prototype,ma={on:la,on_:da,off:ca,off_:ua,once:pa,emit:_a,emitEvent:ga,hasEvent:fa,destroyEventer:ya},va=ne.get("setAttr"),wa={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||o(e)||(va.warn(this.innerName,t,e),e=void 0),p(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new zo(zo.LEAFER_CHANGE,this,t,s,e));const i=ra[t];i&&(this.emitEvent(new ta(i,this)),this.emitEvent(new ta(ta.TRANSFORM,this)))}this.emitPropertyEvent(zo.CHANGE,t,s,e);const i=Yo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new zo(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:xa,multiplyParent:ba,translateInner:Ea,defaultWorld:Pa}=$,{toPoint:Sa,tempPoint:Ba}=Pt,Ta={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ba(this.__local||e,t?t.__scrollWorld||t.__world:Pa,i,!!e.affectScaleOrRotation,n),s&&Ea(Object.assign(s,i),n.scrollX,n.scrollY),e.scaleFixed&&ho.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(xa(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Sa(i.around||i.origin,t.boxBounds,Ba),Ea(e,-Ba.x,-Ba.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ka,updateAllMatrix:Ca}=ho,{updateBounds:Ra}=xo,{toOuterOf:La,copyAndSpread:Da,copy:Aa}=Ht,{toBounds:Oa}=Fn,Ia={__updateWorldBounds(){const{__layout:t,__world:e}=this;La(t.renderBounds,e,e),this.__hasComplex&&ho.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Ho.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Ho.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.outerScale&&ho.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),La(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){La(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){La(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Oa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Ca(this),Ra(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ca(this),Ra(this,this))):ka(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Da(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;d(i)&&i<=0?Aa(e.renderBounds,e.strokeBounds):Da(e.renderBounds,e.boxBounds,i)}},Ma={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.ignoreOpacity?1:e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ho.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ne.showBounds&&ne.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:Fa}=yo,{hasSize:Wa}=Ht,Ua={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Wa(i)){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 n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,r=s.length;n<r;n++)i=s[n],Fa(i,e)||(i.__hasComplex?ho.renderComplex(i,t,e):i.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Fa(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Na,create:za}=m,{stintSet:Ya}=g,{toInnerPoint:Xa,toOuterPoint:Ha,multiplyParent:ja}=$,{toOuterOf:Va}=Ht,{copy:Ga,move:qa}=lt,{getScaleFixedData:Ka}=M,{moveLocal:Za,zoomOfLocal:$a,rotateOfLocal:Ja,skewOfLocal:Qa,moveWorld:th,zoomOfWorld:eh,rotateOfWorld:ih,skewOfWorld:sh,transform:nh,transformWorld:rh,setTransform:oh,getFlipTransform:ah,getLocalOrigin:hh,getRelativeWorld:lh,drop:dh}=ho;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 y}get __LayoutProcessor(){return Fo}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=za(Na),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Uo.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(Uo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Uo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Uo.MOUNTED),t.cacheId&&ho.cacheId(this)):this.__emitLifeEvent(Uo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return ja(i,t.matrix,e,void 0,i),Va(this.__layout.renderBounds,e,e),Ya(e,"half",i.half),Ya(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e,i=!0){return Ka(sr.patternLocked?this.__world:this.__nowWorld||this.__world,e,i,t)}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?lh(this,e):this.worldTransform,n=i?t:{};return Va(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ga(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ga(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Xa(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Ha(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){const n=this.getInnerPoint(t,e,i,s);return i?n:this.getBoxPointByInner(n,null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return qa(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return qa(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){oh(this,t,e,i)}transform(t,e,i){nh(this,t,e,i)}move(t,e,i){Za(this,t,e,i)}moveInner(t,e,i){th(this,t,e,!0,i)}scaleOf(t,e,i,s,n){$a(this,hh(this,t),e,i,s,n)}rotateOf(t,e,i){Ja(this,hh(this,t),e,i)}skewOf(t,e,i,s,n){Qa(this,hh(this,t),e,i,s,n)}transformWorld(t,e,i){rh(this,t,e,i)}moveWorld(t,e,i){th(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){eh(this,t,e,i,s,n)}rotateOfWorld(t,e){ih(this,t,e)}skewOfWorld(t,e,i,s,n){sh(this,t,e,i,s,n)}flip(t,e){nh(this,ah(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,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,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(t){}getMotionPathData(){return ce.need("path")}getMotionPoint(t){return ce.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){dh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):zr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=wr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Uo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Uo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=s([qr(wa),qr(Ta),qr(Ia),qr(ma),qr(Ma)],t.Leaf);const{setListWithFn:ch}=Ht,{sort:uh}=xo,{localBoxBounds:ph,localStrokeBounds:_h,localRenderBounds:gh,maskLocalBoxBounds:fh,maskLocalStrokeBounds:yh,maskLocalRenderBounds:mh}=yo,vh=new ne("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){let t;const{children:e}=this;for(let i=0,s=e.length;i<s;i++)if(t=e[i].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){ch(e||this.__layout.boxBounds,this.children,this.__hasMask?fh:ph)}__updateStrokeBounds(t){ch(t||this.__layout.strokeBounds,this.children,this.__hasMask?yh:_h)}__updateRenderBounds(t){ch(t||this.__layout.renderBounds,this.children,this.__hasMask?mh:gh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(uh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return vh.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=_e.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Uo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Uo.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)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Uo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Uo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Uo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=s([qr(Ua)],t.Branch);class wh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new wh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class xh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const bh=ne.get("LeaferCanvas");class Eh extends Ae{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none",this.view.classList.add("leafer-canvas-view")}ee.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=h(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else bh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.unreal||(this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),bh.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()),ee.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=ee.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:n,height:r}=this.autoBounds.getBoundsFrom(t),o={width:n,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:ee.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};g.copyAttrs(e,this,De),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new Zo(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){let t=this.view;t&&t.remove(),t=this.view=document.createElement("div"),this.parentView.appendChild(this.view),t.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:t}=this;t&&(this.stopAutoLayout(),this.stopListenPixelRatio(),t.parentElement&&t.remove(),super.destroy())}}function Ph(t,e){ee.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=Kn.mimeType(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,Kn.mimeType(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL(Kn.mimeType(Kn.fileType(e)),i);return ee.origin.download(s,e)},download(t,e){return n(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(t,e,i)=>new Promise((i,s)=>{const n=new ee.origin.Image;e&&(n.setAttribute("crossOrigin",e),n.crossOrigin=e),n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.src=ee.image.getRealURL(t)}),loadContent(t){return n(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},ee.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},ee.canvas=ue.canvas(),ee.conicGradientSupport=!!ee.canvas.context.createConicGradient}qn(CanvasRenderingContext2D.prototype),qn(Path2D.prototype),Object.assign(ue,{canvas:(t,e)=>new Eh(t,e),image:t=>new ar(t)}),ee.name="web",ee.isMobile="ontouchstart"in window,ee.requestRender=function(t){window.requestAnimationFrame(t)},hr(ee,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Sh}=navigator;Sh.indexOf("Firefox")>-1?(ee.conicGradientRotate90=!0,ee.intWheelDeltaY=!0,ee.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(ee.fullImageShadow=!0),Sh.indexOf("Windows")>-1?(ee.os="Windows",ee.intWheelDeltaY=!0):Sh.indexOf("Mac")>-1?ee.os="Mac":Sh.indexOf("Linux")>-1&&(ee.os="Linux");class Bh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new wh;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 wh,this.target=t,e&&(this.config=g.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(Qo.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Uo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new $o($o.DATA,{updatedList:this.updatedList})),this.__updatedList=new wh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[zo.CHANGE,this.__onAttrChange,this],[[Uo.ADD,Uo.REMOVE],this.__onChildEvent,this],[$o.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Th,updateBounds:kh,updateChange:Ch}=ho,{pushAllChildBranch:Rh,pushAllParent:Lh}=xo;const{worldBounds:Dh}=yo;class Ah{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,u(t)&&(t=new wh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Dh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Dh),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:Oh,updateAllChange:Ih}=ho,Mh=ne.get("Layouter");class Fh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new xh,this.target=t,e&&(this.config=g.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Jo.START),this.layoutOnce(),t.emitEvent(new Jo(Jo.END,this.layoutedBlocks,this.times))}catch(t){Mh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Mh.warn("layouting"):this.times>3?Mh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit($o.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=he.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=Jo,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Jo(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Th(t,!0),e.add(t),t.isBranch&&Rh(t,e),Lh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Lh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||kh(s[t])}kh(i)}})}(this.__levelList),function(t){t.list.forEach(Ch)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Jo(r,a,this.times)),i.emitEvent(new Jo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,he.end(e)}fullLayout(){const t=he.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Jo,r=this.getBlocks(new wh(e));e.emitEvent(new Jo(i,r,this.times)),Fh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new Jo(s,r,this.times)),e.emitEvent(new Jo(n,r,this.times)),this.addBlocks(r),he.end(t)}static fullLayout(t){Oh(t,!0),t.isBranch?xo.updateBounds(t):ho.updateBounds(t),Ih(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ah([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ah(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Jo.REQUEST,this.layout,this],[Jo.AGAIN,this.layoutAgain,this],[$o.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Wh=ne.get("Renderer");class Uh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=g.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(Jo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Qo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Qo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Qo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Wh.log(e.innerName,"---\x3e");try{this.emitRender(Qo.START),this.renderOnce(t),this.emitRender(Qo.END,this.totalBounds),sr.clearRecycled()}catch(t){this.rendering=!1,Wh.error(t)}Wh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Wh.warn("rendering");if(this.times>3)return Wh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(Qo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Qo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Qo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Qo.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=he.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(Uh.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),this.__render(s,n),i.restore(),he.end(e)}fullRender(){const t=he.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),he.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ne.showRepaint&&ne.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),ee.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return ee.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};ee.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Wh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new Qo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Qo.REQUEST,this.update,this],[Jo.END,this.__onLayoutEnd,this],[Qo.AGAIN,this.renderAgain,this],[Zo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Uh.clipSpread=10;const Nh={},{copyRadiusPoint:zh}=lt,{hitRadiusPoint:Yh}=Ht;class Xh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new wh(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new wh;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||ho.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ho.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>ho.worldHittable(t))}getPath(t){const e=new wh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new wh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new wh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=Yh(i.__world,n.hitRadius?zh(Nh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Hh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Xh(this.target=t,this),this.finder=ue.finder&&ue.finder(t,this.config)}getByPoint(t,e,i){const{target:s,picker:n}=this;return ee.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):ce.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function jh(t){return cr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function Vh(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Gh(){return(t,e)=>{const i="_"+e;hr(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ue,{watcher:(t,e)=>new Bh(t,e),layouter:(t,e)=>new Fh(t,e),renderer:(t,e,i)=>new Uh(t,e,i),selector:(t,e)=>new Hh(t,e)}),ee.layout=Fh.fullLayout,ee.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new wh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const qh={},Kh={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}},Zh=$t,$h={},Jh={},Qh={},tl={},el={},il={apply(){ce.need("filter")}},sl={},nl={setStyleName:()=>ce.need("state"),set:()=>ce.need("state")},rl={list:{},register(t,e){rl.list[t]=e},get:t=>rl.list[t]},{parse:ol,objectToCanvasData:al}=ss,{stintSet:hl}=g,{hasTransparent:ll}=Kh,dl={originPaint:{}},cl=ne.get("UIData");class ul extends y{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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,cl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,cl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(hl(this,"__isTransparentFill",ll(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):p(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(hl(this,"__isTransparentStroke",ll(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):p(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&p(t[0])?(this.__setInput("path",t),this._path=e?ol(t):al(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){pl(this,"shadow",t)}setInnerShadow(t){pl(this,"innerShadow",t)}setFilter(t){pl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Jh.compute("fill",this.__leaf),e&&Jh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=dl)):(this.__isStrokes=!0,this._stroke||(this._stroke=dl))}__removePaint(t,e){e&&this.__removeInput(t),Qh.recycleImage(t,this),"fill"===t?(hl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(hl(this,"__isAlphaPixelStroke",void 0),hl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function pl(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class _l extends ul{}class gl extends _l{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 fl extends _l{__getInputData(t,e){const i=super.__getInputData(t,e);return De.forEach(t=>delete i[t]),i}}class yl extends gl{}class ml extends ul{get __usePathBox(){return this.points||this.__pathInputed}}class vl extends ul{get __boxStroke(){return!this.__pathInputed}}class wl extends ul{get __boxStroke(){return!this.__pathInputed}}class xl extends ml{}class bl extends ul{get __boxStroke(){return!this.__pathInputed}}class El extends ul{get __pathInputed(){return 2}}class Pl extends _l{}const Sl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Bl extends ul{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=Sl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=_e.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Tl extends vl{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class kl extends vl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Cl,add:Rl}=S,Ll={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke||i.__useArrow)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Cl(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=el.getShadowRenderSpread(this,e)),s&&(t=Cl(t,s)),r&&(t=Rl(t,il.getSpread(r))),o&&(t=Rl(t,o)),a&&(t=Rl(t,a));let l=t;return i&&(l=Cl(l,el.getInnerShadowSpread(this,i))),n&&(l=Cl(l,n)),this.__layout.renderShapeSpread=l,h?Cl(h.__updateRenderSpread(),t):t}},{stintSet:Dl}=g,Al={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Dl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Dl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Dl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!el.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Dl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Ol(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Jh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&el.shadow(this,t,h),a&&(s.__isStrokes?Jh.strokes(r,this,t,e):Jh.stroke(r,this,t,e)),n&&(s.__isFills?Jh.fills(n,this,t,e):Jh.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&el.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?Jh.strokes(r,this,t,e):Jh.stroke(r,this,t,e)),c&&il.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Jh.strokes(r,this,t,e):Jh.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,Kh.string(e.color))}n&&(s.__isFills?Jh.fills(n,this,t,e):Jh.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?Jh.strokes(r,this,t,e):Jh.stroke(r,this,t,e))}}else s.__pathForRender?Ol(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Jh.fills(s,this,t,e):Jh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Jh.strokes(n,this,t,e):Jh.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 Ol(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Jh.stroke(n,t,e,i),s&&Jh.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&Jh.stroke(n,t,e,i)}const Il={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Ml,Fl;t.UI=Ml=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){M.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Vn.set(this.path=t||[]),t||this.__drawPathByBox(Vn),Vn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return h(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ce.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ce.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Vn.set(i=[]),this.__drawPathByBox(Vn,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||sl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius?Hn.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&$h.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&$h.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?rn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,r,d(e)?[e]:e)}else t.rect(i,s,n,r);t.closePath()}drawImagePlaceholder(t,e,i){Jh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ce.need("animate")}killAnimate(t,e){}export(t,e){return ce.need("export")}syncExport(t,e){return ce.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Ml.one(e)}static one(t,e,i,s,n){return _e.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Kr()(this)}static registerData(t){Nr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},s([Nr(ul)],t.UI.prototype,"__",void 0),s([Gh()],t.UI.prototype,"zoomLayer",void 0),s([_r("")],t.UI.prototype,"id",void 0),s([_r("")],t.UI.prototype,"name",void 0),s([_r("")],t.UI.prototype,"className",void 0),s([Cr("pass-through")],t.UI.prototype,"blendMode",void 0),s([Lr(1)],t.UI.prototype,"opacity",void 0),s([Dr(!0)],t.UI.prototype,"visible",void 0),s([Cr(!1)],t.UI.prototype,"locked",void 0),s([Rr(!1)],t.UI.prototype,"dim",void 0),s([Rr(!1)],t.UI.prototype,"dimskip",void 0),s([Ir(0)],t.UI.prototype,"zIndex",void 0),s([Mr(!1)],t.UI.prototype,"mask",void 0),s([Fr(!1)],t.UI.prototype,"eraser",void 0),s([gr(0,!0)],t.UI.prototype,"x",void 0),s([gr(0,!0)],t.UI.prototype,"y",void 0),s([wr(100,!0)],t.UI.prototype,"width",void 0),s([wr(100,!0)],t.UI.prototype,"height",void 0),s([mr(1,!0)],t.UI.prototype,"scaleX",void 0),s([mr(1,!0)],t.UI.prototype,"scaleY",void 0),s([vr(0,!0)],t.UI.prototype,"rotation",void 0),s([vr(0,!0)],t.UI.prototype,"skewX",void 0),s([vr(0,!0)],t.UI.prototype,"skewY",void 0),s([gr(0,!0)],t.UI.prototype,"offsetX",void 0),s([gr(0,!0)],t.UI.prototype,"offsetY",void 0),s([fr(0,!0)],t.UI.prototype,"scrollX",void 0),s([fr(0,!0)],t.UI.prototype,"scrollY",void 0),s([yr()],t.UI.prototype,"origin",void 0),s([yr()],t.UI.prototype,"around",void 0),s([_r(!1)],t.UI.prototype,"lazy",void 0),s([xr(1)],t.UI.prototype,"pixelRatio",void 0),s([kr(0)],t.UI.prototype,"renderSpread",void 0),s([Er()],t.UI.prototype,"path",void 0),s([Pr()],t.UI.prototype,"windingRule",void 0),s([Pr(!0)],t.UI.prototype,"closed",void 0),s([wr(0)],t.UI.prototype,"padding",void 0),s([wr(!1)],t.UI.prototype,"lockRatio",void 0),s([wr()],t.UI.prototype,"widthRange",void 0),s([wr()],t.UI.prototype,"heightRange",void 0),s([_r(!1)],t.UI.prototype,"draggable",void 0),s([_r()],t.UI.prototype,"dragBounds",void 0),s([_r("auto")],t.UI.prototype,"dragBoundsType",void 0),s([_r(!1)],t.UI.prototype,"editable",void 0),s([Wr(!0)],t.UI.prototype,"hittable",void 0),s([Wr("path")],t.UI.prototype,"hitFill",void 0),s([Tr("path")],t.UI.prototype,"hitStroke",void 0),s([Wr(!1)],t.UI.prototype,"hitBox",void 0),s([Wr(!0)],t.UI.prototype,"hitChildren",void 0),s([Wr(!0)],t.UI.prototype,"hitSelf",void 0),s([Wr()],t.UI.prototype,"hitRadius",void 0),s([Ur("")],t.UI.prototype,"cursor",void 0),s([Cr()],t.UI.prototype,"fill",void 0),s([Tr(void 0,!0)],t.UI.prototype,"stroke",void 0),s([Tr("inside")],t.UI.prototype,"strokeAlign",void 0),s([Tr(1,!0)],t.UI.prototype,"strokeWidth",void 0),s([Tr(!1)],t.UI.prototype,"strokeScaleFixed",void 0),s([Tr("none")],t.UI.prototype,"strokeCap",void 0),s([Tr("miter")],t.UI.prototype,"strokeJoin",void 0),s([Tr()],t.UI.prototype,"dashPattern",void 0),s([Tr(0)],t.UI.prototype,"dashOffset",void 0),s([Tr(10)],t.UI.prototype,"miterLimit",void 0),s([Pr(0)],t.UI.prototype,"cornerRadius",void 0),s([Pr()],t.UI.prototype,"cornerSmoothing",void 0),s([jh()],t.UI.prototype,"shadow",void 0),s([jh()],t.UI.prototype,"innerShadow",void 0),s([jh()],t.UI.prototype,"blur",void 0),s([jh()],t.UI.prototype,"backgroundBlur",void 0),s([jh()],t.UI.prototype,"grayscale",void 0),s([jh()],t.UI.prototype,"filter",void 0),s([Cr()],t.UI.prototype,"placeholderColor",void 0),s([_r(100)],t.UI.prototype,"placeholderDelay",void 0),s([_r({})],t.UI.prototype,"data",void 0),s([jr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Ml=s([qr(Ll),qr(Al),Vr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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(){}},s([Nr(_l)],t.Group.prototype,"__",void 0),s([wr(0)],t.Group.prototype,"width",void 0),s([wr(0)],t.Group.prototype,"height",void 0),t.Group=s([qr(t.Branch),Kr()],t.Group);const Wl=ne.get("Leafer");t.Leafer=Fl=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&&er.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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),Fl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,g.assign(s,t));const n=this.canvas=ue.canvas(s);this.__controllers.push(this.renderer=ue.renderer(this,n,s),this.watcher=ue.watcher(this,s),this.layouter=ue.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ue.selector(this),this.interaction=ue.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ue.hitCanvasManager()),this.canvasManager=new ve,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),To.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(ta.RESTART):this.emitLeafer(ta.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(ta.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,De);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=g.copyAttrs({},this.canvas,De);e.resize(t),this.updateLazyBounds(),this.__onResize(new Zo(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,De),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 Zt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(De.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(ta.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&De.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=g.copyAttrs({},s,De);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__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(ta.BEFORE_READY),this.emitLeafer(ta.READY),this.emitLeafer(ta.AFTER_READY),To.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ta.VIEW_READY),To.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){To.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(ta.VIEW_COMPLETED),To.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return ce.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ta(t,this))}__listenEvents(){const t=he.start("FirstCreate "+this.innerName);this.once([[ta.START,()=>he.end(t)],[Jo.START,this.updateLazyBounds,this],[Qo.START,this.__onCreated,this],[Qo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[$o.DATA,this.__onWatchData,this],[Jo.END,this.__onLayoutEnd,this],[Qo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Fl.list.remove(this);try{this.stop(),this.emitLeafer(ta.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.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{sr.clearRecycled()},100)}catch(t){Wl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new wh,s([Nr(fl)],t.Leafer.prototype,"__",void 0),s([wr()],t.Leafer.prototype,"pixelRatio",void 0),s([_r("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Fl=s([Kr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},s([Nr(vl)],t.Rect.prototype,"__",void 0),t.Rect=s([qr(Il),Vr(),Kr()],t.Rect);const{add:Ul,includes:Nl,scroll:zl}=Ht,Yl=t.Rect.prototype,Xl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}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.__useSelfBox){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(Ul(a,r),zl(a,i)),this.__updateRectRenderBounds(),t=!Nl(r,a),t&&"show"===o&&Ul(n,a)}else this.__updateRectRenderBounds();g.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))}},s([Nr(gl)],t.Box.prototype,"__",void 0),s([wr(100)],t.Box.prototype,"width",void 0),s([wr(100)],t.Box.prototype,"height",void 0),s([_r(!1)],t.Box.prototype,"resizeChildren",void 0),s([kr("show")],t.Box.prototype,"overflow",void 0),s([jr(Yl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),s([jr(Yl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),s([jr(Yl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),s([jr(Yl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),s([jr(Yl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),s([jr(Yl.__updateChange)],t.Box.prototype,"__updateRectChange",null),s([jr(Yl.__render)],t.Box.prototype,"__renderRect",null),s([jr(Xl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=s([Vr(),Kr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},s([Nr(yl)],t.Frame.prototype,"__",void 0),s([Cr("#FFFFFF")],t.Frame.prototype,"fill",void 0),s([kr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=s([Kr()],t.Frame);const{moveTo:Hl,closePath:jl,ellipse:Vl}=Bs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:n,endAngle:r}=t,o=e/2,a=i/2,h=t.path=[];let l;s?n||r?(s<1?Vl(h,o,a,o*s,a*s,0,n,r,!1):l=!0,Vl(h,o,a,o,a,0,r,n,!0)):(s<1&&(Vl(h,o,a,o*s,a*s),Hl(h,e,a)),Vl(h,o,a,o,a,0,360,0,!0)):n||r?(Hl(h,o,a),Vl(h,o,a,o,a,0,n,r,!1)):Vl(h,o,a,o,a),l||jl(h),(ee.ellipseToCurve||t.__useArrow)&&(t.path=this.getPath(!0))}},s([Nr(wl)],t.Ellipse.prototype,"__",void 0),s([Pr(0)],t.Ellipse.prototype,"innerRadius",void 0),s([Pr(0)],t.Ellipse.prototype,"startAngle",void 0),s([Pr(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=s([Kr()],t.Ellipse);const{sin:Gl,cos:ql,PI:Kl}=Math,{moveTo:Zl,lineTo:$l,closePath:Jl,drawPoints:Ql}=Bs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ql(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;Zl(e,r,0);for(let t=1;t<n;t++)$l(e,r+r*Gl(2*t*Kl/n),o-o*ql(2*t*Kl/n));Jl(e)}}},s([Nr(xl)],t.Polygon.prototype,"__",void 0),s([Pr(3)],t.Polygon.prototype,"sides",void 0),s([Pr()],t.Polygon.prototype,"points",void 0),s([Pr(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=s([Vr(),Kr()],t.Polygon);const{sin:td,cos:ed,PI:id}=Math,{moveTo:sd,lineTo:nd,closePath:rd}=Bs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];sd(o,n,0);for(let t=1;t<2*i;t++)nd(o,n+(t%2==0?n:n*s)*td(t*id/i),r-(t%2==0?r:r*s)*ed(t*id/i));rd(o)}},s([Nr(bl)],t.Star.prototype,"__",void 0),s([Pr(5)],t.Star.prototype,"corners",void 0),s([Pr(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=s([Kr()],t.Star);const{moveTo:od,lineTo:ad,drawPoints:hd}=Bs,{rotate:ld,getAngle:dd,getDistance:cd,defaultPoint:ud}=lt;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&ld(i,e),i}set toPoint(t){this.width=cd(ud,t),this.rotation=dd(ud,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?hd(e,t.points,t.curve,t.closed):(od(e,0,0),ad(e,this.width,0))}},s([Nr(ml)],t.Line.prototype,"__",void 0),s([Sr("center")],t.Line.prototype,"strokeAlign",void 0),s([wr(0)],t.Line.prototype,"height",void 0),s([Pr()],t.Line.prototype,"points",void 0),s([Pr(0)],t.Line.prototype,"curve",void 0),s([Pr(!1)],t.Line.prototype,"closed",void 0),t.Line=s([Kr()],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 u(t)&&t[0].image}},s([Nr(Tl)],t.Image.prototype,"__",void 0),s([wr("")],t.Image.prototype,"url",void 0),t.Image=s([Kr()],t.Image);const pd=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=ue.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ar({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Xo(Xo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new yt(t.worldTransform).invert(),r=new yt;e&&r.translate(e.x,e.y),i&&(d(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},s([Nr(kl)],t.Canvas.prototype,"__",void 0),s([Vh(100)],t.Canvas.prototype,"width",void 0),s([Vh(100)],t.Canvas.prototype,"height",void 0),s([Vh(1)],t.Canvas.prototype,"pixelRatio",void 0),s([Vh(!0)],t.Canvas.prototype,"smooth",void 0),s([_r(!1)],t.Canvas.prototype,"safeResize",void 0),s([Vh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=s([Kr()],t.Canvas);const{copyAndSpread:_d,includes:gd,spread:fd,setList:yd}=Ht,{stintSet:md}=g;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Zh.number(e,n),t.__letterSpacing=Zh.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,md(t,"__padding",l&&M.fourNumber(l)),md(t,"__clipText","show"!==h&&!t.__autoSize),md(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=qh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&fd(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),g.stintSet(this,"isOverflow",!gd(h,a)),this.isOverflow?(yd(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;_d(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},s([Nr(Bl)],t.Text.prototype,"__",void 0),s([wr(0)],t.Text.prototype,"width",void 0),s([wr(0)],t.Text.prototype,"height",void 0),s([Cr()],t.Text.prototype,"boxStyle",void 0),s([_r(!1)],t.Text.prototype,"resizeFontSize",void 0),s([Cr("#000000")],t.Text.prototype,"fill",void 0),s([Sr("outside")],t.Text.prototype,"strokeAlign",void 0),s([Wr("all")],t.Text.prototype,"hitFill",void 0),s([wr("")],t.Text.prototype,"text",void 0),s([wr("")],t.Text.prototype,"placeholder",void 0),s([wr("caption")],t.Text.prototype,"fontFamily",void 0),s([wr(12)],t.Text.prototype,"fontSize",void 0),s([wr("normal")],t.Text.prototype,"fontWeight",void 0),s([wr(!1)],t.Text.prototype,"italic",void 0),s([wr("none")],t.Text.prototype,"textCase",void 0),s([wr("none")],t.Text.prototype,"textDecoration",void 0),s([wr(0)],t.Text.prototype,"letterSpacing",void 0),s([wr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),s([wr(0)],t.Text.prototype,"paraIndent",void 0),s([wr(0)],t.Text.prototype,"paraSpacing",void 0),s([wr("x")],t.Text.prototype,"writingMode",void 0),s([wr("left")],t.Text.prototype,"textAlign",void 0),s([wr("top")],t.Text.prototype,"verticalAlign",void 0),s([wr(!0)],t.Text.prototype,"autoSizeAlign",void 0),s([wr("normal")],t.Text.prototype,"textWrap",void 0),s([wr("show")],t.Text.prototype,"textOverflow",void 0),s([Cr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=s([Kr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},s([Nr(El)],t.Path.prototype,"__",void 0),s([Sr("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=s([Kr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},s([Nr(Pl)],t.Pen.prototype,"__",void 0),s([(t,e)=>{hr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=s([qr(Xs,["set","path","paint"]),Kr()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ue.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),o(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds,void 0,void 0,!0))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&g.assign(e,t),this.autoLayout&&g.copyAttrs(e,this,De),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Jo.END,this.__onReady,this],[Qo.START,this.__onCreated,this],[Qo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Qo.END,this.__onChildRenderEnd,this))}},t.App=s([Kr()],t.App);const vd={},wd={isHoldSpaceKey:()=>wd.isHold("Space"),isHold:t=>vd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){vd[t]||(vd[t]=!0)},setUpCode(t){vd[t]=!1}},xd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class bd extends Wo{get spaceKey(){return wd.isHoldSpaceKey()}get left(){return xd.left(this)}get right(){return xd.right(this)}get middle(){return xd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return wd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ye.changeName(t,e)}}const{min:Ed,max:Pd,abs:Sd}=Math,{float:Bd,sign:Td}=M,{minX:kd,maxX:Cd,minY:Rd,maxY:Ld}=Ht,Dd=new qt,Ad=new qt,Od={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Id.getValidMove(t.__localBoxBounds,Id.getDragBounds(t),s,e,!0),Id.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&Id.getValidScaleOf(t.__localBoxBounds,Id.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),Id.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),Id.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=Bd(s.x),s.y=Bd(s.y),s},getValidScaleOf(t,e,i,s,n,r,o){o||(n=Object.assign({},n)),Ad.set(e),Dd.set(t).scaleOf(s,n.x,n.y);const a=(s.x-t.x)/t.width,h=1-a,d=(s.y-t.y)/t.height,c=1-d;let u,p,_,g,f=1,y=1;return Id.isInnerMode(t,e,i,"width")?(n.x<0&&Dd.scaleOf(s,f=1/n.x,1),_=Bd(Dd.minX-Ad.minX),g=Bd(Ad.maxX-Dd.maxX),u=a&&_>0?1+_/(a*Dd.width):1,p=h&&g>0?1+g/(h*Dd.width):1,f*=Pd(u,p)):(n.x<0&&((Bd(kd(t)-kd(e))<=0||Bd(Cd(e)-Cd(t))<=0)&&Dd.scaleOf(s,f=1/n.x,1),Dd.unsign()),_=Bd(Ad.minX-Dd.minX),g=Bd(Dd.maxX-Ad.maxX),u=a&&_>0?1-_/(a*Dd.width):1,p=h&&g>0?1-g/(h*Dd.width):1,f*=Ed(u,p)),Id.isInnerMode(t,e,i,"height")?(n.y<0&&Dd.scaleOf(s,1,y=1/n.y),_=Bd(Dd.minY-Ad.minY),g=Bd(Ad.maxY-Dd.maxY),u=d&&_>0?1+_/(d*Dd.height):1,p=c&&g>0?1+g/(c*Dd.height):1,y*=Pd(u,p),r&&(u=Pd(Sd(f),Sd(y)),f=Td(f)*u,y=Td(y)*u)):(n.y<0&&((Bd(Rd(t)-Rd(e))<=0||Bd(Ld(e)-Ld(t))<=0)&&Dd.scaleOf(s,1,y=1/n.y),Dd.unsign()),_=Bd(Ad.minY-Dd.minY),g=Bd(Dd.maxY-Ad.maxY),u=d&&_>0?1-_/(d*Dd.height):1,p=c&&g>0?1-g/(c*Dd.height):1,y*=Ed(u,p)),n.x*=l(f)?f:1,n.y*=l(y)?y:1,n}},Id=Od;t.PointerEvent=class extends bd{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=s([Zr()],t.PointerEvent);const Md=t.PointerEvent,Fd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof wh?t:new wh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return lt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Od.axisMove(t,n),n}static limitMove(t,e){Od.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Fd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Fd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Fd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Ht.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ht.unsign(i),i}assignMove(t){Fd.x=t?this.totalX:this.moveX,Fd.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=s([Zr()],t.DragEvent);const Wd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=s([Zr()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.DRAG_ANIMATE="move.drag_animate",t.MoveEvent.END="move.end",t.MoveEvent.PULL_DOWN="move.pull_down",t.MoveEvent.REACH_BOTTOM="move.reach_bottom",t.MoveEvent=s([Zr()],t.MoveEvent),t.TouchEvent=class extends bd{},t.TouchEvent=s([Zr()],t.TouchEvent);const Ud=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=s([Zr()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=s([Zr()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=s([Zr()],t.ZoomEvent),t.KeyEvent=class extends bd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=s([Zr()],t.KeyEvent);const Nd={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:zd.getSwipeDirection(lt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:o(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new wh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>ho.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},zd=Nd,Yd=new wh,{getDragEventData:Xd,getDropEventData:Hd,getSwipeEventData:jd}=Nd;class Vd{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Xd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||Yd;return this.dragging&&(n?e?Yd:new wh(i?[...s.list,...s.dragHoverExclude]:s.list):r)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&xd.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],ho.draggable(e)){this.draggableList=new wh(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=Xd(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:o}=i.p,a=!o||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},a||n);o&&!n&&e?ho.animateMove(i,l,d(o)?o:.3):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Xd(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(lt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=jd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Hd(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Gd=ne.get("emit");const qd=["move","zoom","rotate","key"];function Kd(t,e,i,s,n){if(qd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!$d(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Zd(r,e,i,s,n)}}function Zd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!$d(t,n)&&(nl.updateEventStyle&&!s&&nl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ye.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function $d(t,e){return e&&e.has(t)}const Jd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Qd,pathCanDrag:tc,pathHasOutside:ec}=Nd;class ic{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&xd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&xd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&wd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=g.clone(Jd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new wh(t),this.createTransformer(),this.dragger=new Vd(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(xd.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),e.path.needUpdate&&this.updateDownData(e),this.emit(t.PointerEvent.DOWN,e),xd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=xd.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&xd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=lt.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;xd.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,wd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,wd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new wh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Qd(e.path,t));n<i.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:r}=this;ee.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!ec(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!tc(t.path))&&!ec(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}replaceDownTarget(t){const{downData:e}=this;if(e&&t){const{path:i}=e;i.remove(i.list[0]),i.addAt(t,0)}}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&lt.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Qd(e.path,t.PointerEvent.LONG_TAP)||Qd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Zo.RESIZE,this.__onResize,this)],t.once(ta.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Zd(n,t,e,!0,s))return;n.isApp&&Kd(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Kd(n,t,e,!1,s),Zd(n,t,e,!1,s))return}catch(t){Gd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class sc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}sc.custom={};class nc extends ve{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new wh,this.pixelList=new wh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ue.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ue.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}ee.getSelector=function(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())};const{toInnerRadiusPointOf:rc,copyRadiusPoint:oc}=lt,{hitRadiusPoint:ac,hitPoint:hc}=Ht,lc={},dc={},cc=t.Leaf.prototype;cc.hit=function(t,e=0){this.updateLayout(),oc(dc,t,e);const i=this.__world;return!!(e?ac(i,dc):hc(i,dc))&&(this.isBranch?ee.getSelector(this).hitPoint(Object.assign({},dc),e,{target:this}):this.__hitWorld(dc))},cc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(oc(lc,t,i.hitRadius),t=lc),rc(t,s,lc),i.hitBox||r){if(Ht.hitRadiusPoint(n.boxBounds,lc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(lc,e)},cc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},cc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},cc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},cc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const uc=new yt,pc=t.UI.prototype;pc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=ee.image.hitCanvasSize,o=r.hitScale=Kt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Kt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),sr.patternLocked=!0,this.__renderShape(r,{matrix:uc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),sr.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},pc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:o}=i,a=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*o,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=o;break;case"outside":if(l+=2*o,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const _c=t.UI.prototype,gc=t.Rect.prototype,fc=t.Box.prototype;gc.__updateHitCanvas=fc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?_c.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},gc.__hitFill=fc.__hitFill=function(t){return this.__hitCanvas?_c.__hitFill.call(this,t):Ht.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=r),this.updateLayout(),ee.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const yc=Ae.prototype;yc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},yc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},yc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Kt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const mc={convert(t,e){const i=Nd.getBase(t),{x:s,y:n}=e,r=Object.assign(Object.assign({},i),{x:s,y:n,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===r.pointerType&&(r.tangentialPressure=t.tangentialPressure,r.tiltX=t.tiltX,r.tiltY=t.tiltY,r.twist=t.twist),r},convertMouse(t,e){const i=Nd.getBase(t),{x:s,y:n}=e;return Object.assign(Object.assign({},i),{x:s,y:n,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=mc.getTouch(t),s=Nd.getBase(t),{x:n,y:r}=e;return Object.assign(Object.assign({},s),{x:n,y:r,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},vc={convert(t){const e=Nd.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:wc}=Nd;class xc extends ic{get windowTarget(){const{view:t}=this;return t&&t.ownerDocument||window}get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),this.windowTarget.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)this.windowTarget.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view&&(!this.config.shadowDOM||!t.composedPath||!t.composedPath().includes(this.view))}onKeyDown(t){this.keyDown(vc.convert(t))}onKeyUp(t){this.keyUp(vc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(mc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(mc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=mc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(mc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(mc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(mc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(mc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=mc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&wc(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(mc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=mc.getTouch(t);this.pointerMove(mc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=mc.getTouch(t);this.pointerUp(mc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Nd.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},Nd.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=Nd.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(M.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),p(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>p(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,u(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=h(t)&&sc.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function bc(t,e,i){t.__.__font?Jh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Ec(t,e,i,s,n){const r=i.__;p(t)?Jh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&Jh.strokeArrow(t,i,s,n)}function Pc(t,e,i,s,n){const r=i.__;p(t)?Jh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),Jh.drawTextStroke(i,s,n))}function Sc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Pc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",Jh.fillText(i,r,n),r.blendMode="normal",ho.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}const{getSpread:Bc,copyAndSpread:Tc,toOuterOf:kc,getOuterOf:Cc,getByMove:Rc,move:Lc,getIntersectData:Dc}=Ht,Ac={};let Oc;const{stintSet:Ic}=g,{hasTransparent:Mc}=Kh;function Fc(t,e,i){if(!p(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout,{type:r}=e;switch(r){case"image":case"film":case"video":if(!e.url)return;s=Qh.image(i,t,e,n,!Oc||!Oc[e.url]),"image"!==r&&Qh[r](s);break;case"linear":s=tl.linearGradient(e,n);break;case"radial":s=tl.radialGradient(e,n);break;case"angular":s=tl.conicGradient(e,n);break;case"solid":const{color:a,opacity:h}=e;s={type:r,style:Kh.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:Kh.string(e)})}if(s&&(s.originPaint=e,h(s.style)&&Mc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Wc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];u(a)||(a=[a]),Oc=Qh.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Fc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(Ic(i,"__isAlphaPixelFill",n),Ic(i,"__isTransparentFill",r)):(Ic(i,"__isAlphaPixelStroke",n),Ic(i,"__isTransparentStroke",r),Ic(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,bc(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,Qh.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,r.scaleFixed,!1);1!==t&&i.scale(t,s)}r.blendMode&&(i.blendMode=r.blendMode),bc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),bc(e,i,s),i.restoreBlendMode()):bc(e,i,s)}},fillPathOrText:bc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)Jh.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Ec(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Ec(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)Ec(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Ec(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),ho.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Jh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Pc(t,1,e,i,s);break;case"inside":Sc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Pc(t,2,e,i,s):Sc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!Qh.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?Jh.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?Jh.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,p;kc(o.strokeSpread?(Tc(Ac,o.boxBounds,o.strokeSpread),Ac):o.boxBounds,r,a);let{scaleX:_,scaleY:g}=t.getRenderScaleData(!0);if(n.includes(a))p=s,h=u=a,l=r;else{let s;if(ee.fullImageShadow)s=a;else{const t=o.renderShapeSpread?Bc(n,S.swapAndScale(o.renderShapeSpread,_,g)):n;s=Dc(t,a)}c=n.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,i),_*=f,g*=y),u=Cc(a,c),h=Rc(u,-c.e,-c.f),l=Cc(r,c),Lc(l,-c.e,-c.f);const m=i.matrix;m?(d=new yt(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:p,shapeBounds:u,scaleX:_,scaleY:g}}};let Uc,Nc=new qt;const{isSame:zc}=Ht;function Yc(t,e,i,s,n,r){const o=t.__;if("fill"===e&&!o.__naturalWidth&&(o.__naturalWidth=s.width/o.pixelRatio,o.__naturalHeight=s.height/o.pixelRatio,o.__autoSide))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",o.width),t.setProxyAttr("height",o.height)),!1;if(!n.data){Qh.createData(n,s,i,r);const{transform:t}=n.data,{opacity:e,blendMode:a}=i,h=t&&!t.onlyScale||o.path||o.cornerRadius;(h||e&&e<1||a)&&(n.complex=!h||2)}return i.filter&&Qh.applyFilter(n,s,i.filter,t),!0}function Xc(t,e){Vc(t,Xo.LOAD,e)}function Hc(t,e){Vc(t,Xo.LOADED,e)}function jc(t,e,i){e.error=i,t.forceUpdate("surface"),Vc(t,Xo.ERROR,e)}function Vc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Xo(e,i))}function Gc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:qc,translate:Kc}=$,Zc=new qt,$c={},Jc={};function Qc(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let tu={},eu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:iu,set:su,rotateOfOuter:nu,translate:ru,scaleOfOuter:ou,multiplyParent:au,scale:hu,rotate:lu,skew:du}=$;function cu(t,e,i,s,n,r,o,a){o&&lu(t,o),a&&du(t,a.x,a.y),n&&hu(t,n,r),ru(t,e.x+i,e.y+s)}const{get:uu,scale:pu,copy:_u}=$,{getFloorScale:gu}=M,{abs:fu}=Math;const yu={image:function(t,e,i,s,n){let r,o;const a=sr.get(i,i.type);return Uc&&i===Uc.paint&&zc(s,Uc.boxBounds)?r=Uc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Uc=a.use>1?{leafPaint:r,paint:i,boxBounds:Nc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Yc(t,e,i,a,r,s),n&&(Xc(t,o),Hc(t,o))):a.error?n&&jc(t,o,a.error):(n&&(Gc(t,!0),Xc(t,o)),r.loadId=a.load(()=>{Gc(t,!1),t.destroyed||(Yc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Hc(t,o)),r.loadId=void 0},e=>{Gc(t,!1),jc(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=Qh.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:r+"-"+o,{image:h,data:l,originPaint:d}=t,{exporting:c,snapshot:u}=n;return!(!l||t.patternId===a&&!c||u)&&(e&&(l.repeat?e=!1:d.changeful||t.film||"miniapp"===ee.name||c||(e=ee.image.isLarge(h,r,o)||h.width*r>8096||h.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Qh.drawImage(t,r,o,i,s,n),!0):(!t.style||d.sync||c?Qh.createPattern(t,i,s,n):Qh.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){const{data:o,image:a,complex:h}=t;let{width:l,height:d}=a;if(h){const{blendMode:r,opacity:c}=t.originPaint,{transform:u}=o;n.save(),2===h&&n.clipUI(s),r&&(n.blendMode=r),c&&(n.opacity*=c),u&&n.transform(u),a.render(n,0,0,l,d,s,t,e,i),n.restore()}else o.scaleX&&(l*=o.scaleX,d*=o.scaleY),a.render(n,0,0,l,d,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,sr.recyclePaint(s),e.__willDestroy&&n.parent&&Qh.recycleFilter(n,e.__leaf),n.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=sr.patternTasker.add(()=>n(this,void 0,void 0,function*(){Qh.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=Qh.getImageRenderScaleData(t,e,i,s),o=t.film?t.nowIndex:n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!ee.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{opacity:a}=t.originPaint,{transform:h,gap:l}=s,d=Qh.getPatternFixScale(t,n,r);let c,u,p,{width:_,height:g}=i;d&&(n*=d,r*=d),_*=n,g*=r,l&&(u=l.x*n/fu(s.scaleX||1),p=l.y*r/fu(s.scaleY||1)),(h||1!==n||1!==r)&&(n*=gu(_+(u||0)),r*=gu(g+(p||0)),c=uu(),h&&_u(c,h),pu(c,1/n,1/r));const f=i.getCanvas(_,g,a,void 0,u,p,e.leafer&&e.leafer.config.smooth,s.interlace),y=i.getPattern(f,s.repeat||ee.origin.noRepeat||"no-repeat",c,t);t.style=y,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=ee.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=Qh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Zc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:r,align:o,offset:a,scale:l,size:c,rotation:u,skew:_,clipSize:g,repeat:f,gap:y,interlace:m}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==o&&(u||0)%180==90;let b,E;switch(Ht.set(Jc,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((l||c)&&(M.getScaleData(l,c,i,$c),b=$c.scaleX,E=$c.scaleY),(o||y||f)&&(b&&Ht.scale(Jc,b,E,!0),o&&Tt.toPoint(o,Jc,e,Jc,!0,!0))):v&&!u||(b=E=Ht.getFitScale(e,Jc,"fit"!==r),Ht.put(e,i,o,b,!1,Jc),Ht.scale(Jc,b,E,!0)),a&&lt.move(Jc,a),r){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/n,Qh.stretchMode(w,e,b,E));break;case"normal":case"clip":if(Jc.x||Jc.y||b||g||u||_){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Qh.clipMode(w,e,Jc.x,Jc.y,b,E,u,_,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||u||_)&&Qh.repeatMode(w,e,s,n,Jc.x,Jc.y,b,E,u,_,o,t.freeTransform),f||(w.repeat="repeat");const i=p(f);(y||i)&&(w.gap=function(t,e,i,s,n){let r,o;p(t)?(r=t.x,o=t.y):r=o=t;return{x:Qc(r,i,n.width,e&&e.x),y:Qc(o,s,n.height,e&&e.y)}}(y,i&&f,Jc.width,Jc.height,e));break;default:b&&Qh.fillOrFitMode(w,e,Jc.x,Jc.y,b,E,u)}return w.transform||(e.x||e.y)&&Kc(w.transform=qc(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=E),f&&(w.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=d(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,i,s){const n=iu(),{x:r,y:o}=e;r||o?ru(n,r,o):i>0&&s>0&&(n.onlyScale=!0),hu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=iu();ru(a,e.x+i,e.y+s),hu(a,n,r),o&&nu(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=iu();cu(d,e,i,s,n,r,o,a),h&&(o||a?(su(eu),ou(eu,e,h,l),au(d,eu)):ou(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=iu();if(c)cu(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)nu(u,{x:i/2,y:s/2},h);else switch(lu(u,h),h){case 90:ru(u,s,0);break;case 180:ru(u,i,s);break;case 270:ru(u,0,i)}tu.x=e.x+n,tu.y=e.y+r,ru(u,tu.x,tu.y),o&&ou(u,tu,o,a)}t.transform=u}},{toPoint:mu}=Pt,{hasTransparent:vu}=Kh,wu={},xu={};function bu(t,e,i,s){if(i){let n,r,o,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(o=t/(l-1),r=Kh.string(n,s)):(o=n.offset,r=Kh.string(n.color,s)),e.addColorStop(o,r),!a&&vu(r)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Eu,getDistance:Pu}=lt,{get:Su,rotateOfOuter:Bu,scaleOfOuter:Tu}=$,{toPoint:ku}=Pt,Cu={},Ru={};function Lu(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Eu(e,i);r=Su(),n?(Tu(r,e,o/a*(s||1),1),Bu(r,e,t+90)):(Tu(r,e,1,o/a*(s||1)),Bu(r,e,t))}return r}const{getDistance:Du}=lt,{toPoint:Au}=Pt,Ou={},Iu={};const Mu={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;mu(i||"top",e,wu),mu(s||"bottom",e,xu);const o=ee.canvas.createLinearGradient(wu.x,wu.y,xu.x,xu.y),a={type:n,style:o};return bu(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;ku(i||"center",e,Cu),ku(s||"bottom",e,Ru);const a=ee.canvas.createRadialGradient(Cu.x,Cu.y,0,Cu.x,Cu.y,Pu(Cu,Ru)),h={type:n,style:a};bu(h,a,t.stops,r);const l=Lu(e,Cu,Ru,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Au(i||"center",e,Ou),Au(s||"bottom",e,Iu);const a=ee.conicGradientSupport?ee.canvas.createConicGradient(0,Ou.x,Ou.y):ee.canvas.createRadialGradient(Ou.x,Ou.y,0,Ou.x,Ou.y,Du(Ou,Iu)),h={type:n,style:a};bu(h,a,t.stops,r);const l=Lu(e,Ou,Iu,o||1,ee.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Lu},{copy:Fu,move:Wu,toOffsetOutBounds:Uu}=Ht,{max:Nu,abs:zu}=Math,Yu={},Xu=new yt,Hu={};function ju(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=zu(t.spread||0),o=Nu(o,n+r-s),a=Nu(a,n+r+i),h=Nu(h,n+r+s),l=Nu(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function Vu(t,e,i){const{shapeBounds:s}=i;let n,r;ee.fullImageShadow?(Fu(Yu,t.bounds),Wu(Yu,e.x-s.x,e.y-s.y),n=t.bounds,r=Yu):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:Gu}=Ht,qu={};const Ku=ju;const Zu={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=o.length-1;Uu(h,Hu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.setWorldShadow(Hu.offsetX+(o.x||0)*c*f,Hu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,Kh.string(o.color)),n=el.getShadowTransform(t,p,i,o,Hu,f),n&&p.setTransform(n),Vu(p,Hu,i),n&&p.resetTransform(),s=l,o.box&&(p.restore(),p.save(),a&&(p.copyWorld(p,l,r,"copy"),s=r),a?p.copyWorld(a,r,r,"destination-out"):p.copyWorld(i.canvas,d,h,"destination-out")),ho.copyCanvasByWorld(t,e,p,s,o.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=o.length-1;Gu(h,qu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(qu.offsetX+(o.x||0)*c*f,qu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=el.getShadowTransform(t,p,i,o,qu,f,!0),n&&p.setTransform(n),Vu(p,qu,i),p.restore(),a?(p.copyWorld(p,l,r,"copy"),p.copyWorld(a,r,r,"source-out"),s=r):(p.copyWorld(i.canvas,d,h,"source-out"),s=l),p.fillWorld(s,Kh.string(o.color),"source-in"),ho.copyCanvasByWorld(t,e,p,s,o.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:ju,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Xu.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Xu}},isTransformShadow(t){},getInnerShadowSpread:Ku},{excludeRenderBounds:$u}=yo;let Ju;function Qu(t,e,i,s,n,r,o,a){switch(e){case"grayscale":Ju||(Ju=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);ep(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":ep(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function tp(t){return t.getSameCanvas(!1,!0)}function ep(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(Qu(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||$u(i,e)||i.__render(t,e),r=i.__.opacity,Ju=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=tp(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=tp(t)),n||(n=tp(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&Qu(this,o,t,n,s,r,void 0,!1),$u(i,e)||i.__render(n||t,e),d&&Qu(this,o,t,n,s,r,d,!1)}Qu(this,o,t,n,s,r,void 0,!0)};const ip=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",sp=ip+"_#~&*+\\=|≮≯≈≠=…",np=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 rp(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const op=rp("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ap=rp("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),hp=rp(ip),lp=rp(sp),dp=rp("- —/~|┆·");var cp;!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"}(cp||(cp={}));const{Letter:up,Single:pp,Before:_p,After:gp,Symbol:fp,Break:yp}=cp;function mp(t){return op[t]?up:dp[t]?yp:ap[t]?_p:hp[t]?gp:lp[t]?fp:np.test(t)?pp:up}const vp={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function wp(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:xp}=vp,{Letter:bp,Single:Ep,Before:Pp,After:Sp,Symbol:Bp,Break:Tp}=cp;let kp,Cp,Rp,Lp,Dp,Ap,Op,Ip,Mp,Fp,Wp,Up,Np,zp,Yp,Xp,Hp,jp=[];function Vp(t,e){Mp&&!Ip&&(Ip=Mp),kp.data.push({char:t,width:e}),Rp+=e}function Gp(){Lp+=Rp,kp.width=Rp,Cp.words.push(kp),kp={data:[]},Rp=0}function qp(){zp&&(Yp.paraNumber++,Cp.paraStart=!0,zp=!1),Mp&&(Cp.startCharSize=Ip,Cp.endCharSize=Mp,Ip=0),Cp.width=Lp,Xp.width?xp(Cp):Hp&&Kp(),jp.push(Cp),Cp={words:[]},Lp=0}function Kp(){Lp>(Yp.maxWidth||0)&&(Yp.maxWidth=Lp)}const{top:Zp,right:$p,bottom:Jp,left:Qp}=t.Direction4;function t_(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const e_={getDrawData:function(t,e){h(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:o}=e;o&&(n?(i=o[Qp],n-=o[$p]+o[Qp],!n&&(n=.01)):e.autoSizeAlign||(i=o[Qp]),r?(s=o[Zp],r-=o[Zp]+o[Jp],!r&&(r=.01)):e.autoSizeAlign||(s=o[Zp]));const a={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:ee.canvas.font=e.__font};return function(t,e,i){Yp=t,jp=t.rows,Xp=t.bounds,Hp=!Xp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=ee,{width:a}=Xp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;zp=!0,Wp=null,Ip=Op=Mp=Rp=Lp=0,kp={data:[]},Cp={words:[]};for(let i=0,l=(e=[...e]).length;i<l;i++)Ap=e[i],"\n"===Ap?(Rp&&Gp(),Cp.paraEnd=!0,qp(),zp=!0):(Fp=mp(Ap),Fp===bp&&"none"!==r&&(Ap=wp(Ap,r,!Rp)),Op=o.measureText(Ap).width,s&&(s<0&&(Mp=Op),Op+=s),Up=Fp===Ep&&(Wp===Ep||Wp===bp)||Wp===Ep&&Fp!==Sp,Np=!(Fp!==Pp&&Fp!==Ep||Wp!==Bp&&Wp!==Sp),Dp=zp&&n?a-n:a,t&&a&&Lp+Rp+Op>Dp&&(h?(Rp&&Gp(),Lp&&qp()):(Np||(Np=Fp===bp&&Wp==Sp),Up||Np||Fp===Tp||Fp===Pp||Fp===Ep||Rp+Op>Dp?(Rp&&Gp(),Lp&&qp()):Lp&&qp()))," "===Ap&&!0!==zp&&Lp+Rp===0||(Fp===Tp?(" "===Ap&&Rp&&Gp(),Vp(Ap,Op),Gp()):Up||Np?(Rp&&Gp(),Vp(Ap,Op)):Vp(Ap,Op)),Wp=Fp);Rp&&Gp(),Lp&&qp(),jp.length>0&&(jp[jp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Yp.paraNumber++,Lp=o.measureText(t).width,jp.push({x:n||0,text:t,width:Lp,paraStart:!0}),Hp&&Kp()})}(a,t,e),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":t_(e,"x",t[Qp]);break;case"right":t_(e,"x",-t[$p])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":t_(e,"y",t[Zp]);break;case"bottom":t_(e,"y",-t[Jp])}}(o,a,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=p,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(a,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r,__letterSpacing:o}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,p,_,g,f,y,m,v;s.forEach(t=>{t.words&&(_=r&&t.paraStart?r:0,y=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-_,l?p=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=_,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=_,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,d,t.data,t.isOverflow,v&&p),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):p&&(t.width+=p*(e.data.length-(m?1:0))))})),t.words=null)})}(a,e,n),a.overflow&&function(t,e,i,s){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?ee.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(a,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,p(r)?(i=r.type,r.color&&(t.decorationColor=Kh.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(a,e),a}};const i_={string:function(t,e){if(!t)return"#000";const i=d(e)&&e<1;if(h(t)){if(!i||!Kh.object)return t;t=Kh.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(qh,e_),Object.assign(Kh,i_),Object.assign(Jh,Wc),Object.assign(Qh,yu),Object.assign(tl,Mu),Object.assign(el,Zu),Object.assign(ue,{interaction:(t,e,i,s)=>new xc(t,e,i,s),hitCanvas:(t,e)=>new Eh(t,e),hitCanvasManager:()=>new nc}),Ph();class s_ extends ul{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function n_(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?nl.setStyleName(this,e,i):nl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function r_(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function o_(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function a_(t,e){p(e)||(e=void 0),d_(t,e,"in")}function h_(t,e){const{normalStyle:i}=t;p(e)||(e=void 0),i&&(e||(e=i),d_(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!o(t))if(d(t))this.now=t;else if(p(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=sr.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:r,total:o}=e,{width:a,height:h}=r&&(d(r)?{width:r,height:r}:r)||(o>1?this:t);let l=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:c,width:a,height:h},l+a>=t.width?(l=0,c+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Xo(Xo.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),o(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},s([Nr(s_)],t.Robot.prototype,"__",void 0),s([wr()],t.Robot.prototype,"robot",void 0),s([_r()],t.Robot.prototype,"actions",void 0),s([_r("")],t.Robot.prototype,"action",void 0),s([Cr(0)],t.Robot.prototype,"now",void 0),s([_r(12)],t.Robot.prototype,"FPS",void 0),s([_r(!0)],t.Robot.prototype,"loop",void 0),t.Robot=s([Kr()],t.Robot),ce.add("robot");const l_={};function d_(t,e,i){const{normalStyle:s}=t;e||(e=l_),e.scale&&(M.assignScale(e,e.scale),delete e.scale),e!==l_&&nl.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&a(i[s])&&a(e[s])&&(s="transition");return a(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=p_(e,t),s=t.animate();s&&p_(i,t,s.fromStyle);return i}(t,e):void 0;nl.canAnimate&&c_(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=c_(t);if(o){const{animation:s}=o;if(s){const r=t.animate(s,void 0,"animation",!0);Object.assign(o,r.endingStyle),"in"!==i||e.animation!==s?r.kill():n=!1,delete o.animation}t.normalStyle=u_(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(n){const e=u_(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function c_(t){let e;const i={},s=o_(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&nl.isState(n,t,s)&&(e=__(i,r));const o=i.selectedStyle||t.selectedStyle;o&&nl.isSelected(t,s)&&(e=__(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&nl.isPlacehold(t,s)&&(e=__(i,a)),nl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=__(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&nl.isFocus(t,s)&&(e=__(i,n));const r=i.hoverStyle||t.hoverStyle;r&&nl.isHover(t,s)&&(e=__(i,r));const o=i.pressStyle||t.pressStyle;o&&nl.isPress(t,s)&&(e=__(i,o))}return e?i:void 0}function u_(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&nl.animateExcludes[t]||(n[t]=e[t]);return n}function p_(t,e,i){return u_(t,e,i,!0)}function __(t,e){return Object.assign(t,e),!0}function g_(t,e){const i=t[e];i&&a_(t,i),t.button&&y_(t.children,e)}function f_(t,e,i){i||(i=t.states[e]),a_(t,i),t.button&&y_(t.children,null,e)}function y_(t,e,i){if(!t)return;let s,n;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":nl.isHover(s)&&(n=!1);break;case"pressStyle":nl.isPress(s)&&(n=!1);break;case"focusStyle":nl.isFocus(s)&&(n=!1)}n&&g_(s,e)}else o(i)||f_(s,i);s.isBranch&&y_(s.children,e,i)}}function m_(t,e){const i=t[e];i&&h_(t,i),t.button&&w_(t.children,e)}function v_(t,e,i){h_(t,i),t.button&&w_(t.children,null,e)}function w_(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?m_(s,e):o(i)||v_(s,i),s.isBranch&&w_(s.children,e,i)}function x_(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=o_(e,i);r&&(s=n[t](r))}return s}function b_(t,e,i){let s=e[t];if(!s&&i){const n=o_(e,i);n&&(s=n[t])}return s}ce.add("state"),nl.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},nl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=o_(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},nl.isSelected=function(t,e){return b_("selected",t,e)},nl.isDisabled=function(t,e){return b_("disabled",t,e)},nl.isFocus=function(t,e){return x_("isFocus",t,e)},nl.isHover=function(t,e){return x_("isHover",t,e)},nl.isPress=function(t,e){return x_("isPress",t,e)},nl.isPlacehold=function(t,e){return t.__.__isPlacehold},nl.isDrag=function(t,e){return x_("isDrag",t,e)},nl.setStyleName=function(t,e,i){i?f_(t,e,t[e]):v_(t,e,t[e])},nl.set=function(t,e){const i=t.states[e];i?f_(t,e,i):v_(t,e,i)},nl.getStyle=c_,nl.updateStyle=d_,nl.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:g_(e,"hoverStyle");break;case t.PointerEvent.LEAVE:m_(e,"hoverStyle");break;case t.PointerEvent.DOWN:g_(e,"pressStyle");break;case t.PointerEvent.UP:m_(e,"pressStyle")}};const E_=t.UI.prototype;t.UI.addAttr("selected",!1,n_,"selectedStyle"),t.UI.addAttr("disabled",!1,n_,"disabledStyle"),t.UI.addAttr("states",{},r_),t.UI.addAttr("state","",n_),t.UI.addAttr("normalStyle",void 0,_r),t.UI.addAttr("hoverStyle",void 0,r_),t.UI.addAttr("pressStyle",void 0,r_),t.UI.addAttr("focusStyle",void 0,r_),t.UI.addAttr("selectedStyle",void 0,r_),t.UI.addAttr("disabledStyle",void 0,r_),t.UI.addAttr("placeholderStyle",void 0,r_),t.UI.addAttr("button",!1,_r),E_.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},E_.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?g_(this,"focusStyle"):m_(this,"focusStyle")})},E_.updateState=function(){nl.updateStyle(this,void 0,"in")};const P_=t.Text.prototype,S_="text";hr(P_,S_,Object.assign(Object.assign({},lr(P_,S_)),{set(t){const e=this,i=e.text;e.__setAttr(S_,t)&&(br(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:B_,sin:T_,pow:k_,sqrt:C_,abs:R_,ceil:L_,floor:D_,round:A_,PI:O_}=Math,I_=5*O_,M_=1.70158,F_=2.5949095,W_=7.5625,U_=2.75;function N_(t){return e=>k_(e,t)}function z_(t){return e=>1-k_(1-e,t)}function Y_(t){return e=>e<.5?.5*k_(2*e,t):1-.5*k_(2-2*e,t)}function X_(t){return t<1/U_?W_*t*t:t<2/U_?W_*(t-=1.5/U_)*t+.75:t<2.5/U_?W_*(t-=2.25/U_)*t+.9375:W_*(t-=2.625/U_)*t+.984375}function H_(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=j_(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(R_(l)<1e-6));e++)c-=d/l;return n[o]=j_(c,e,s)}}function j_(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const V_={get(t){const{list:e}=V_;return h(t)?e[t||"ease"]:p(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){V_.list[t]=e},list:{linear:t=>t,ease:H_(.25,.1,.25,1),"ease-in":H_(.42,0,1,1),"ease-out":H_(0,0,.58,1),"ease-in-out":H_(.42,0,.58,1),"sine-in":t=>1-B_(t*O_*.5),"sine-out":t=>T_(t*O_*.5),"sine-in-out":t=>.5*(1-B_(t*O_)),"quad-in":N_(2),"quad-out":z_(2),"quad-in-out":Y_(2),"cubic-in":N_(3),"cubic-out":z_(3),"cubic-in-out":Y_(3),"quart-in":N_(4),"quart-out":z_(4),"quart-in-out":Y_(4),"quint-in":N_(5),"quint-out":z_(5),"quint-in-out":Y_(5),"expo-in":t=>t?k_(2,10*t-10):0,"expo-out":t=>1===t?1:1-k_(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*k_(2,2*t*10-10):.5*(2-k_(2,10-2*t*10)),"circ-in":t=>1-C_(1-k_(t,2)),"circ-out":t=>C_(1-k_(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-C_(1-k_(2*t,2))):.5*(C_(1-k_(2-2*t,2))+1),"back-in":t=>((M_+1)*t-M_)*t*t,"back-out":t=>(t-=1)*t*((M_+1)*t+M_)+1,"back-in-out":t=>t<.5?(t*=2)*t*((F_+1)*t-F_)*.5:.5*((t=2*t-2)*t*((F_+1)*t+F_)+2),"elastic-in":t=>0===t||1===t?t:-k_(2,10*(t-1))*T_((t-1.1)*I_),"elastic-out":t=>0===t||1===t?t:k_(2,-10*t)*T_((t-.1)*I_)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-k_(2,10*((t*=2)-1))*T_((t-1.1)*I_)*.5:k_(2,10*(1-(t*=2)))*T_((t-1.1)*I_)*.5+1,"bounce-in":t=>1-X_(1-t),"bounce-out":X_,"bounce-in-out":t=>t<.5?.5*(1-X_(1-2*t)):.5*(1+X_(2*t-1)),"cubic-bezier":H_,steps:function(t,e="floor"){return i=>("floor"===e?D_(i*t):"ceil"===e?L_(i*t):A_(i*t))/t}}};function G_(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class q_{}q_.CREATED="created",q_.PLAY="play",q_.PAUSE="pause",q_.STOP="stop",q_.SEEK="seek",q_.UPDATE="update",q_.COMPLETED="completed";t.Animate=class extends aa{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&d(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=V_.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(q_.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(q_.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(q_.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;p(t)&&(t=Zh.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(q_.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let a,h,l,c,u,p=0,_=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),l={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=h;r&&(l.swing=d(r)?r:2,u=2*l.swing-1),o&&(l.loop=u=d(o)?o:2),t?(l.duration=t,p+=t*u,i&&(l.totalTime=t+i)):e&&(l.autoDuration=e,_+=e*u),i?(l.delay=i,p+=i*u):s&&(l.autoDelay=s,_+=s*u),n&&(l.easingFn=V_.get(n))}if(!l.autoDuration&&o(l.duration)&&(n>1?s>0||r?_+=u:l.duration=0:l.duration=this.duration),n>1)this.setBefore(l,c,a);else{for(let e in c)l.beforeStyle[e]=t[e];this.fromStyle=l.beforeStyle,this.toStyle=l.style}a=c,e.push(l)}_?((this.duration<=p||!s||!s.duration)&&this.changeDuration(p+.2*_),this.allocateTime((this.duration-p)/_)):p&&this.changeDuration(p),this.emitType(q_.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let a in e)o(s[a])&&(s[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=o(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],o(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,ee.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(q_.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),rl.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emitType(q_.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return d(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},s([G_("ease")],t.Animate.prototype,"easing",void 0),s([G_(0)],t.Animate.prototype,"delay",void 0),s([G_(.2)],t.Animate.prototype,"duration",void 0),s([G_("auto")],t.Animate.prototype,"ending",void 0),s([G_(!1)],t.Animate.prototype,"reverse",void 0),s([G_(!1)],t.Animate.prototype,"swing",void 0),s([G_(!1)],t.Animate.prototype,"loop",void 0),s([G_(0)],t.Animate.prototype,"loopDelay",void 0),s([G_(1)],t.Animate.prototype,"speed",void 0),s([G_(!0)],t.Animate.prototype,"autoplay",void 0),s([G_()],t.Animate.prototype,"join",void 0),s([G_()],t.Animate.prototype,"jump",void 0),s([G_()],t.Animate.prototype,"attrs",void 0),t.Animate=s([qr(ma)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(q_.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(q_.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(q_.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(q_.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case q_.COMPLETED:this.completed&&this.emitType(t);break;case q_.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=s([qr(ma)],t.AnimateList);const K_={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},Z_=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,$_=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,J_=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Q_=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,tg=parseInt,eg=parseFloat,{round:ig}=Math;let sg={},ng=0;function rg(t){let e,i,s,n=1;switch(t.length){case 9:e=tg(t.slice(1,3),16),i=tg(t.slice(3,5),16),s=tg(t.slice(5,7),16),n=tg(t.slice(7,9),16)/255;break;case 7:e=tg(t.slice(1,3),16),i=tg(t.slice(3,5),16),s=tg(t.slice(5,7),16);break;case 5:e=tg(t[1]+t[1],16),i=tg(t[2]+t[2],16),s=tg(t[3]+t[3],16),n=tg(t[4]+t[4],16)/255;break;case 4:e=tg(t[1]+t[1],16),i=tg(t[2]+t[2],16),s=tg(t[3]+t[3],16);break;case 3:e=i=s=tg(t[1]+t[2],16);break;case 2:e=i=s=tg(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const og=1/6,ag=.5,hg=2/3,lg=1/3;function dg(t,e,i){return i<0?i++:i>1&&i--,i<og?t+6*(e-t)*i:i<ag?e:i<hg?t+(e-t)*(hg-i)*6:t}function cg(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=dg(a,s,t+lg),r=dg(a,s,t),o=dg(a,s,t-lg)}return{r:ig(255*n),g:ig(255*r),b:ig(255*o),a:s}}ce.add("color"),Kh.object=function(t,e){let i,s=!o(e)&&e<1;if(h(t)){const e=sg[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=rg(t);break;case"R":case"r":"("===t[4]&&$_.test(t)?i=function(t){const e=$_.exec(t);return{r:tg(e[1]),g:tg(e[2]),b:tg(e[3]),a:eg(e[4])}}(t):"("===t[3]&&Z_.test(t)&&(i=function(t){const e=Z_.exec(t);return{r:tg(e[1]),g:tg(e[2]),b:tg(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Q_.test(t)?i=function(t){const e=Q_.exec(t);return cg(eg(e[1]),eg(e[2]),eg(e[3]),eg(e[4]))}(t):"("===t[3]&&J_.test(t)&&(i=function(t){const e=J_.exec(t);return cg(eg(e[1]),eg(e[2]),eg(e[3]),1)}(t))}if(!i){const e=K_[t.toLowerCase()];e&&(i=rg("#"+e))}i&&(ng++,ng>1e4&&(sg={},ng=0),sg[t]=Object.assign({},i))}}else p(t)&&(o(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:ug}=Math,{fourNumber:pg}=M,_g={fill:vg,stroke:vg,cornerRadius:(t,e,i)=>d(t)&&d(e)?yg(t,e,i):(t=pg(t),e=pg(e),t.map((t,s)=>yg(t,e[s],i))),text(t,e,i){if(h(t)&&h(e)){const s=t.length,n=e.length,r=yg(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return d(t)||d(e)?M.float(yg(t,e,i),Math.max(fg(t),fg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return rl.setBetweenStyle(n,t,e,n,i,s),n},shadow:wg,innerShadow:wg},gg={value:function(t,e,i){const s=d(t),n=d(e);return s&&n?t+(e-t)*i:n||s?yg(t,e,i):t},number:yg,color:mg,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=rl;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,r)))}};function fg(t){const e=String(t).split(".")[1];return e?e.length:0}function yg(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?ug(n):n}function mg(t,e,i){t=Kh.object(t),e=Kh.object(e);const s=yg(t.r,e.r,i,1)+","+yg(t.g,e.g,i,1)+","+yg(t.b,e.b,i,1),n=yg(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function vg(t,e,i){return h(t)&&h(e)?mg(t,e,i):e}function wg(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:yg((t=t||{}).x,e.x,i),y:yg(t.y,e.y,i),blur:yg(t.blur,e.blur,i),spread:yg(t.spread,e.spread,i),color:mg(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ce.add("animate","color"),nl.canAnimate=!0,Object.assign(rl.list,_g),Object.assign(rl,gg);const xg=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,_r),t.UI.addAttr("transition",!0,_r),t.UI.addAttr("transitionOut",void 0,_r),xg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},xg.animate=function(e,i,s,n){if(o(e))return this.__animate;let r=u(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,r.toStyle);const a=this.__animate;return a&&(r instanceof t.AnimateList?r.list.unshift(a):r=new t.AnimateList(this,[a,r])),this.__animate=r},xg.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},xg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(q_.COMPLETED,e)};const bg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Eg=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Pg}=Math,{getDerivative:Sg}=li,Bg={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,p,_,g=0,f=h/2;for(let h=0;h<bg.length;h++)l=f*(1+bg[h]),d=f*(1-bg[h]),c=Sg(l,t,i,n,o),u=Sg(l,e,s,r,a),p=Sg(d,t,i,n,o),_=Sg(d,e,s,r,a),g+=Eg[h]*(Pg(c*c+u*u)+Pg(p*p+_*_));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=Sg(t,e,s,r,a),d=Sg(t,i,n,o,h);return Math.atan2(d,l)/W},getT(t,e,i,s,n,r,o,a,h,l,d=1){let c=0,u=1,p=t/e,_=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>_;)Tg(i,s,n,r,o,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,p=d*n+e*o,_=d*r+e*a,g=d*c+e*p,f=d*u+e*_,y=d*g+e*(d*p+e*(d*o+e*h)),m=d*f+e*(d*_+e*(d*a+e*l));t.push(Me.C,c,u,g,f,y,m)}},{getDistance:Tg}=Bg,{M:kg,L:Cg,C:Rg,Z:Lg}=Me,{float:Dg}=M,Ag={},Og={},Ig={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case kg:case Cg:Ig.transformPoints(t,e,s,1),s+=3;break;case Rg:Ig.transformPoints(t,e,s,3),s+=7;break;case Lg:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)Ag.x=t[n],Ag.y=t[n+1],$.toOuterPoint(e,Ag),t[n]=Ag.x,t[n+1]=Ag.y},getMotionPathData(t){let e,i,s,n,r=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case kg:case Cg:i=t[a+1],s=t[a+2],e=n===Cg&&a>0?lt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Rg:i=t[a+5],s=t[a+6],e=Bg.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Lg:a+=1;default:e=0}o.push(e),r+=e}return{total:r,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Zh.number(e,t.total);let r,o,a,h,l,d,c,u,p,_=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case kg:case Cg:if(o=n[f+1],a=n[f+2],r=s[y],_+r>=e||!t.total)return f||(m=o,v=a),Og.x=m,Og.y=v,g.x=o,g.y=a,lt.getDistancePoint(Og,g,e-_,!0),g.rotation=lt.getAngle(Og,g),g;m=o,v=a,f+=3;break;case Rg:if(o=n[f+5],a=n[f+6],r=s[y],_+r>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=Bg.getT(e-_,r,m,v,l,d,c,u,o,a,i),li.getPointAndSet(p,m,v,l,d,c,u,o,a,g),g.rotation=Bg.getRotation(p,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case Lg:f+=1;default:r=0}y++,_+=r}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=Zh.number(e,t.total);let o,a,h,l,d,c,u,p,_,g,f=0,y={},m=0,v=0,w=0,x=0;const b=n.length;for(;m<b;){switch(d=n[m],d){case kg:case Cg:if(h=n[m+1],l=n[m+2],o=s[v],f+o>e||!t.total)return m||(w=h,x=l),Og.x=w,Og.y=x,y.x=h,y.y=l,a=Dg(e-f),a&&(lt.getDistancePoint(Og,y,a,!0),r.push(d,y.x,y.y)),r;w=h,x=l,m+=3,r.push(d,w,x);break;case Rg:if(c=n[m+1],u=n[m+2],p=n[m+3],_=n[m+4],h=n[m+5],l=n[m+6],o=s[v],f+o>e)return a=Dg(e-f),a&&(g=Bg.getT(a,o,w,x,c,u,p,_,h,l,i),Bg.cut(r,g,w,x,c,u,p,_,h,l)),r;w=h,x=l,m+=7,r.push(d,c,u,p,_,h,l);break;case Lg:m+=1,r.push(d);default:o=0}v++,f+=o}return r}};function Mg(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!a(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ce.add("motion-path"),rl.register("motion",function(t,e,i,s){return p(t)&&(t=Zh.number(t,s.getMotionTotal())),p(e)&&(e=Zh.number(e,s.getMotionTotal())),rl.number(t||0,e||0,i)}),rl.register("motionRotation",function(t,e,i){return rl.number(t,e,i)});const Fg=t.UI.prototype,{updateMatrix:Wg,updateAllMatrix:Ug}=ho,{updateBounds:Ng}=xo;function zg(t){const{motion:e,leaferIsCreated:i}=t;if(!a(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Xg(t);i.total&&(t.__.__pathForRender=Ig.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Ug(t),Ng(t,t)):Wg(t));i&&(t.leafer.created=!0)}}function Yg(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function Xg(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Ig.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,Mg),t.UI.addAttr("motionPrecision",1,Mg),t.UI.addAttr("motion",void 0,Mg),t.UI.addAttr("motionRotation",!0,Mg),Fg.getMotionPathData=function(){return Xg(Yg(this))},Fg.getMotionPoint=function(t){const e=Yg(this),i=Xg(e);if(!i.total)return{};const s=Ig.getDistancePoint(i,t,e.motionPrecision);$.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:d(n)&&(s.rotation+=n),s},Fg.getMotionTotal=function(){return this.getMotionPathData().total},Fg.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],a(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),zg(t))}else zg(this)};const{Yes:Hg,NoAndSkip:jg,YesAndSkip:Vg}=t.Answer,Gg={},qg={},Kg={};class Zg{constructor(t,e){this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},this.idMap={},this.innerIdMap={};const i=t&&t.app;i&&(i.idMap?this.idMap=i.idMap:i.idMap=this.idMap,i.innerIdMap?this.innerIdMap=i.innerIdMap:i.innerIdMap=this.innerIdMap),(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Gg.id=t.substring(1),t=Gg;break;case".":qg.className=t.substring(1),t=qg;break;default:Kg.tag=t,t=Kg}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?g.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&ho.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),"boolean"==typeof r&&(r=r?1:0),r===Hg||r===Vg){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<jg&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Uo.REMOVE,this.__onRemoveChild,this),this.target.on_(zo.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const $g=t.UI.prototype;function Jg(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())}return $g.find=function(t,e){return Jg(this).getBy(t,this,!1,e)},$g.findOne=function(t,e){return Jg(this).getBy(t,this,!0,e)},ce.add("find"),ue.finder=function(t,e){return new Zg(t,e)},ho.cacheId=function(t){const{leafer:e,id:i}=t;i&&(e.app.idMap[i]=t),e.cacheInnerId&&(e.app.innerIdMap[t.innerId]=t)},t.AlignHelper=Tt,t.AnimateEasing=V_,t.AnimateEvent=q_,t.AroundHelper=Pt,t.AutoBounds=Zt,t.BezierHelper=li,t.Bounds=qt,t.BoundsEvent=Ho,t.BoundsHelper=Ht,t.BoxData=gl,t.BranchHelper=xo,t.BranchRender=Ua,t.CanvasData=kl,t.CanvasManager=ve,t.ChildEvent=Uo,t.ColorConvert=Kh,t.Creator=ue,t.Cursor=sc,t.DataHelper=g,t.Debug=ne,t.DragBoundsHelper=Od,t.Dragger=Vd,t.Effect=el,t.EllipseData=wl,t.EllipseHelper=mi,t.Event=Wo,t.EventCreator=ye,t.Eventer=aa,t.Export=sl,t.FileHelper=Kn,t.Filter=il,t.Finder=Zg,t.FourNumberHelper=S,t.FrameData=yl,t.GroupData=_l,t.HighBezierHelper=Bg,t.HighCurveHelper=Ig,t.HitCanvasManager=nc,t.ImageData=Tl,t.ImageEvent=Xo,t.ImageManager=sr,t.IncrementId=m,t.Interaction=xc,t.InteractionBase=ic,t.InteractionHelper=Nd,t.Keyboard=wd,t.LayoutEvent=Jo,t.Layouter=Fh,t.LeafBounds=Ia,t.LeafBoundsHelper=yo,t.LeafData=y,t.LeafDataProxy=wa,t.LeafEventer=ma,t.LeafHelper=ho,t.LeafLayout=Fo,t.LeafLevelList=xh,t.LeafList=wh,t.LeafMatrix=Ta,t.LeafRender=Ma,t.LeaferCanvas=Eh,t.LeaferCanvasBase=Ae,t.LeaferData=fl,t.LeaferEvent=ta,t.LeaferFilm=class extends ar{get tag(){return"Film"}},t.LeaferImage=ar,t.LeaferVideo=class extends ar{get tag(){return"Video"}},t.LineData=ml,t.MathHelper=M,t.Matrix=yt,t.MatrixHelper=$,t.MyDragEvent=Wd,t.MyImage=pd,t.MyPointerEvent=Md,t.MyTouchEvent=Ud,t.NeedConvertToCanvasCommandMap=We,t.OneRadian=W,t.PI2=U,t.PI_2=N,t.Paint=Jh,t.PaintGradient=tl,t.PaintImage=Qh,t.PathArrow=$h,t.PathBounds=Fn,t.PathCommandDataHelper=Bs,t.PathCommandMap=Me,t.PathCommandNodeHelper=vi,t.PathConvert=ss,t.PathCorner=Hn,t.PathCreator=Xs,t.PathData=El,t.PathDrawer=rn,t.PathHelper=Oe,t.PathNumberCommandLengthMap=Ye,t.PathNumberCommandMap=ze,t.PenData=Pl,t.Picker=Xh,t.Platform=ee,t.Plugin=ce,t.Point=gt,t.PointHelper=lt,t.PointerButton=xd,t.PolygonData=xl,t.PropertyEvent=zo,t.RectData=vl,t.RectHelper=Xe,t.RectRender=Il,t.RenderEvent=Qo,t.Renderer=Uh,t.ResizeEvent=Zo,t.Resource=er,t.RobotData=s_,t.Run=he,t.Selector=Hh,t.StarData=bl,t.State=nl,t.StringNumberMap=Jt,t.TaskItem=Jn,t.TaskProcessor=Qn,t.TextConvert=qh,t.TextData=Bl,t.Transition=rl,t.TwoPointBoundsHelper=vt,t.UIBounds=Ll,t.UICreator=_e,t.UIData=ul,t.UIEvent=bd,t.UIRender=Al,t.UnitConvert=Zh,t.UnitConvertHelper=$t,t.WaitHelper=To,t.WatchEvent=$o,t.Watcher=Bh,t.affectRenderBoundsType=kr,t.affectStrokeBoundsType=Sr,t.attr=ur,t.autoLayoutType=yr,t.boundsType=wr,t.canvasPatch=qn,t.canvasSizeAttrs=De,t.createAttr=function(t){return(e,i)=>{hr(e,i,dr(i,t))}},t.createDescriptor=dr,t.cursorType=Ur,t.dataProcessor=Nr,t.dataType=_r,t.decorateLeafAttr=cr,t.defineDataProcessor=zr,t.defineKey=hr,t.defineLeafAttr=pr,t.dimType=Rr,t.doBoundsType=br,t.doStrokeType=Br,t.effectType=jh,t.emptyData=r,t.eraserType=Fr,t.extraPropertyEventMap=Yo,t.getBoundsData=Y,t.getDescriptor=lr,t.getMatrixData=X,t.getPointData=z,t.hitType=Wr,t.isArray=u,t.isData=function(t){return p(t)&&!u(t)},t.isEmptyData=_,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=p,t.isString=h,t.isUndefined=o,t.layoutProcessor=function(t){return(e,i)=>{hr(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=ra,t.maskType=Mr,t.motionPathType=Mg,t.naturalBoundsType=xr,t.opacityType=Lr,t.path=jn,t.pathInputType=Er,t.pathType=Pr,t.pen=Vn,t.positionType=gr,t.registerUI=Kr,t.registerUIEvent=Zr,t.resizeType=Vh,t.rewrite=jr,t.rewriteAble=Vr,t.rotationType=vr,t.scaleType=mr,t.scrollType=fr,t.sortType=Ir,t.stateStyleType=r_,t.stateType=n_,t.strokeType=Tr,t.surfaceType=Cr,t.tempBounds=Kt,t.tempMatrix=mt,t.tempPoint=ft,t.tryToNumber=function(t){return"string"==typeof t&&c.test(t)?+t:t},t.useCanvas=Ph,t.useModule=qr,t.version="2.0.4",t.visibleType=Dr,t.zoomLayerType=Gh,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