@leafer/miniapp 1.9.8 → 1.9.10

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.
@@ -1,2 +1,2 @@
1
- const t={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",getRealURL(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e;var s;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(s||(s={}));const o={};function n(t){return void 0===t}function r(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function g(t){return t&&"object"==typeof t}function _(t){return g(t)&&!u(t)}function p(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(m(e,t),m(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return m(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&m(t[o]={},e[o],i[o]):t[o]=e[o]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{n(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:m}=f;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(!n(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]=n(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(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const 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 o in this)if("_"!==o[0]&&(t=this["_"+o],!n(t))){if("path"===o&&!this.__pathInputed)continue;e=s?s[o]:void 0,i[o]=n(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,f:r}}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}}let v,w,x;const{max:b}=Math,k=[0,0,0,0],S={zero:[...k],tempFour:k,set:(t,e,i,s,o)=>(void 0===i&&(i=s=o=e),t[0]=e,t[1]=i,t[2]=s,t[3]=o,t),setTemp:(t,e,i,s)=>E(k,t,e,i,s),toTempAB(t,e,i){x=i?l(t)?e:t:[],l(t)?(v=T(t),w=e):l(e)?(v=t,w=T(e)):(v=t,w=e),4!==v.length&&(v=B(v)),4!==w.length&&(w=B(w))},get(t,e){let i;if(!l(t))switch(t.length){case 4:i=n(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]),!n(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>l(t)&&l(e)?b(t,e):(R(t,e,i),E(x,b(v[0],w[0]),b(v[1],w[1]),b(v[2],w[2]),b(v[3],w[3]))),add:(t,e,i)=>l(t)&&l(e)?t+e:(R(t,e,i),E(x,v[0]+w[0],v[1]+w[1],v[2]+w[2],v[3]+w[3])),swapAndScale(t,e,i,s){if(l(t))return e===i?t*e:[t*i,t*e];const o=s?t:[],[n,r,a,h]=4===t.length?t:B(t);return E(o,a*i,h*e,n*i,r*e)}},{set:E,get:B,setTemp:T,toTempAB:R}=S,{round:C,pow:O,PI:P}=Math,L={within:(t,e,i)=>(g(e)&&(i=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(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)),L.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=n(e)?1e12:O(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=(l(e)?e:e.width||0)/i.width,o=(l(e)?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&L.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:A,randColor:t=>`rgba(${A(255)},${A(255)},${A(255)},${t||1})`};function A(t){return Math.round(Math.random()*t)}const D=P/180,M=2*P,F=P/2;function I(){return{x:0,y:0}}function W(){return{x:0,y:0,width:0,height:0}}function z(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:N,cos:Y,acos:X,sqrt:H}=Math,{float:V}=L,j={};function U(){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 G={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:U(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:z,getWorld:U,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){K.toInnerPoint(t,e,j),K.scaleOfInner(t,j,i,s)},scaleOfInner(t,e,i,s=i){K.translateInner(t,e.x,e.y),K.scale(t,i,s),K.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=Y(e*=D),a=N(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){K.toInnerPoint(t,e,j),K.rotateOfInner(t,j,i)},rotateOfInner(t,e,i){K.translateInner(t,e.x,e.y),K.rotate(t,i),K.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=D,t.a=s+n*i,t.b=o+r*i),e&&(e*=D,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){K.toInnerPoint(t,e,j),K.skewOfInner(t,j,i,s)},skewOfInner(t,e,i,s=0){K.translateInner(t,e.x,e.y),K.skew(t,i,s),K.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,s,o){const{e:r,f:a}=t;if(i||(i=t),n(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(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){K.multiply(t,K.tempInvert(e))},divideParent(t,e){K.multiplyParent(t,K.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=K;return K.copy(e,t),K.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,s,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(n(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:o}=e,n=i*D,r=Y(n),a=N(n);if(s||o){const e=s*D,i=o*D;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&K.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:l}=t;let d,c,u,g,_,p=h,f=l;if(n||r){const t=o*a-n*r;if(r&&!s){d=H(o*o+n*n),c=t/d;const e=o/d;u=n>0?X(e):-X(e)}else{c=H(r*r+a*a),d=t/c;const e=r/c;u=F-(a>0?X(-e):-X(e))}const e=V(Y(u)),i=N(u);d=V(d),c=V(c),g=e?V((r/c+i)/e/D,9):0,_=e?V((n/d-i)/e/D,9):0,u=V(u/D)}else d=o,c=a,u=g=_=0;return(e=i||e)&&(p+=e.x*o+e.y*r,f+=e.x*n+e.y*a,i||(p-=e.x,f-=e.y)),{x:p,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=H(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){K.set(t)}},K=G,{toInnerPoint:q,toOuterPoint:Z}=G,{sin:J,cos:Q,abs:$,sqrt:tt,atan2:et,min:it,round:st}=Math,ot={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=n(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?st(t.x-.5)+.5:st(t.x),t.y=e?st(t.y-.5)+.5:st(t.y)},move(t,e,i){g(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=nt.defaultPoint);const s=Q(e*=D),o=J(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=nt;return at(i,t),q(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=nt;return at(i,t),Z(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=nt;return at(i,t),nt.toInnerRadiusPointOf(t,e,i),i},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){Z(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)=>rt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=$(i-t),n=$(s-e);return tt(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>it(rt(t,e,i,s),rt(i,s,o,n)),getAngle:(t,e)=>ht(t,e)/D,getRotation:(t,e,i,s)=>(s||(s=e),nt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/D),getRadianFrom(t,e,i,s,o,r,a,h){n(a)&&(a=i,h=s);const l=t-i,d=e-s,c=o-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>et(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const o=ht(t,e);return(e=s?e:{}).x=t.x+Q(o)*i,e.y=t.y+J(o)*i,e},toNumberPoints(t){let e=t;return g(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){nt.reset(t)}},nt=ot,{getDistanceFrom:rt,copy:at,getAtan2:ht}=nt;class lt{constructor(t,e){this.set(t,e)}set(t,e){return g(t)?ot.copy(this,t):ot.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new lt(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,i){return ot.scaleOf(this,t,e,i),this}rotate(t,e){return ot.rotate(this,t,e),this}rotateOf(t,e){return ot.rotate(this,e,t),this}getRotation(t,e,i){return ot.getRotation(this,t,e,i)}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}getCenter(t){return new lt(ot.getCenter(this,t))}getDistance(t){return ot.getDistance(this,t)}getDistancePoint(t,e,i){return new lt(ot.getDistancePoint(this,t,e,i))}getAngle(t){return ot.getAngle(this,t)}getAtan2(t){return ot.getAtan2(this,t)}reset(){return ot.reset(this),this}}const dt=new lt;class ct{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return g(t)?G.copy(this,t):G.set(this,t,e,i,s,o,n),this}setWith(t){return G.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new ct(this)}translate(t,e){return G.translate(this,t,e),this}translateInner(t,e){return G.translateInner(this,t,e),this}scale(t,e){return G.scale(this,t,e),this}scaleWith(t,e){return G.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return G.pixelScale(this,t),this}scaleOfOuter(t,e,i){return G.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return G.scaleOfInner(this,t,e,i),this}rotate(t){return G.rotate(this,t),this}rotateOfOuter(t,e){return G.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return G.rotateOfInner(this,t,e),this}skew(t,e){return G.skew(this,t,e),this}skewOfOuter(t,e,i){return G.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return G.skewOfInner(this,t,e,i),this}multiply(t){return G.multiply(this,t),this}multiplyParent(t){return G.multiplyParent(this,t),this}divide(t){return G.divide(this,t),this}divideParent(t){return G.divideParent(this,t),this}invert(){return G.invert(this),this}invertWith(){return G.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){G.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){G.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return G.setLayout(this,t,e,i),this}getLayout(t,e,i){return G.getLayout(this,t,e,i)}withScale(t,e){return G.withScale(this,t,e)}reset(){G.reset(this)}}const ut=new ct,gt={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,o){_t(t,e,i),_t(t,e+s,i+o)},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:_t}=gt;var pt,ft;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(pt||(pt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(ft||(ft={}));const mt=[{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}];mt.forEach(t=>t.type="percent");const yt={directionData:mt,tempPoint:{},get:vt,toPoint(t,e,i,s,o,n){const r=vt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),yt.toPoint(t,e,i,!0),i)};function vt(t){return a(t)?mt[ft[t]]:t}const{toPoint:wt}=yt,xt={toPoint(t,e,i,s,o,n){wt(t,i,s,o,e,n)}},{tempPointBounds:bt,setPoint:kt,addPoint:St,toBounds:Et}=gt,{toOuterPoint:Bt}=G,{float:Tt,fourNumber:Rt}=L,{floor:Ct,ceil:Ot}=Math;let Pt,Lt,At,Dt;const Mt={},Ft={},It={},Wt={tempBounds:It,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(u(i)){const e=Rt(i);s?zt.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):zt.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),zt.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),zt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Yt(e,t):e=t,i||(i=t),e.offsetX=zt.maxX(i),e.offsetY=zt.maxY(i),zt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ot.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ot.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(zt.copy(It,t),zt.toOuterOf(It,e),It),getOuterOf:(t,e)=>(t=Object.assign({},t),zt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),o>0?(i.height=t.height*o,i.y=e.f+t.y*o):(i.height=t.height*-o,i.y=e.f+t.y*o-i.height)}else Mt.x=t.x,Mt.y=t.y,Bt(e,Mt,Ft),kt(bt,Ft.x,Ft.y),Mt.x=t.x+t.width,Bt(e,Mt,Ft),St(bt,Ft.x,Ft.y),Mt.y=t.y+t.height,Bt(e,Mt,Ft),St(bt,Ft.x,Ft.y),Mt.x=t.x,Bt(e,Mt,Ft),St(bt,Ft.x,Ft.y),Et(bt,i)},toInnerOf(t,e,i){i||(i=t),zt.move(i,-e.e,-e.f),zt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,zt.getFitScale(t,e));return new ct(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,n){n||(n=e),a(s)&&(s=zt.getFitScale(t,e,"cover"===s)),It.width=o?e.width*=s:e.width*s,It.height=o?e.height*=s:e.height*s,xt.toPoint(i,It,t,n,!0,!0)},getSpread(t,e,i){const s={};return zt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){zt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){zt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Ct(t.x),t.y=Ct(t.y),t.width=e>t.x?Ot(t.width+e-t.x):Ot(t.width),t.height=i>t.y?Ot(t.height+i-t.y):Ot(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=Tt(t.x,e),t.y=Tt(t.y,e),t.width=Tt(t.width,e),t.height=Tt(t.height,e)},add(t,e,i){Pt=t.x+t.width,Lt=t.y+t.height,At=e.x,Dt=e.y,i||(At+=e.width,Dt+=e.height),Pt=Pt>At?Pt:At,Lt=Lt>Dt?Lt:Dt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Pt-t.x,t.height=Lt-t.y},addList(t,e){zt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){zt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){zt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r],r):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||Yt(t,o)):Nt(t,o));n&&zt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?kt(bt,t.x,t.y):St(bt,t.x,t.y)),Et(bt,t)},setPoint(t,e){zt.set(t,e.x,e.y)},addPoint(t,e){Nt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ot.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=ot.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=zt.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=zt.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=zt.tempToOuterOf(e,i)),!zt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return Pt=s+n,Lt=o+r,At=t.x+t.width,Dt=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,Pt=Pt<At?Pt:At,Lt=Lt<Dt?Lt:Dt,n=Pt-s,r=Lt-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){zt.copy(t,zt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){zt.set(t)}},zt=Wt,{add:Nt,copy:Yt}=zt;class Xt{get minX(){return Wt.minX(this)}get minY(){return Wt.minY(this)}get maxX(){return Wt.maxX(this)}get maxY(){return Wt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return g(t)?Wt.copy(this,t):Wt.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 Xt(this)}move(t,e){return Wt.move(this,t,e),this}scale(t,e,i){return Wt.scale(this,t,e,i),this}scaleOf(t,e,i){return Wt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Wt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Wt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Wt.getFitMatrix(this,t,e)}put(t,e,i){Wt.put(this,t,e,i)}spread(t,e){return Wt.spread(this,t,e),this}shrink(t,e){return Wt.shrink(this,t,e),this}ceil(){return Wt.ceil(this),this}unsign(){return Wt.unsign(this),this}float(t){return Wt.float(this,t),this}add(t){return Wt.add(this,t),this}addList(t){return Wt.setList(this,t,!0),this}setList(t){return Wt.setList(this,t),this}addListWithFn(t,e){return Wt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Wt.setListWithFn(this,t,e),this}setPoint(t){return Wt.setPoint(this,t),this}setPoints(t){return Wt.setPoints(this,t),this}addPoint(t){return Wt.addPoint(this,t),this}getPoints(){return Wt.getPoints(this)}hitPoint(t,e){return Wt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Wt.hitRadiusPoint(this,t,e)}hit(t,e){return Wt.hit(this,t,e)}includes(t,e){return Wt.includes(this,t,e)}intersect(t,e){return Wt.intersect(this,t,e),this}getIntersect(t,e){return new Xt(Wt.getIntersectData(this,t,e))}isSame(t){return Wt.isSame(this,t)}isEmpty(){return Wt.isEmpty(this)}reset(){Wt.reset(this)}}const Ht=new Xt;class Vt{constructor(t,e,i,s,o,n){g(t)?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Xt(o,e,n||t.width-o-i,r||t.height-e-s)}}const 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},{randColor:Ut}=L;class Gt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Gt(t)}static set filter(t){this.filterList=Kt(t)}static set exclude(t){this.excludeList=Kt(t)}static drawRepaint(t,e){const i=Ut();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Gt.showBounds,o=t.__nowWorld,n=Ut();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(qt.enable){if(qt.filterList.length&&qt.filterList.every(t=>t!==this.name))return;if(qt.excludeList.length&&qt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){qt.enable&&this.warn(...t)}warn(...t){qt.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 Kt(t){return t?a(t)&&(t=[t]):t=[],t}Gt.filterList=[],Gt.excludeList=[],Gt.showWarn=!0;const qt=Gt,Zt=Gt.get("RunTime"),Jt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return Qt.currentId=Qt.idMap[s]=i?performance.now():Date.now(),Qt.currentName=Qt.nameMap[s]=t,Qt.nameToIdMap[t]=s,s},end(t,e){const i=Qt.idMap[t],s=Qt.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;Qt.idMap[t]=Qt.nameMap[t]=Qt.nameToIdMap[s]=void 0,Zt.log(s,o,"ms")},endOfName(t,e){const i=Qt.nameToIdMap[t];n(i)||Qt.end(i,e)}},Qt=Jt,$t=[],te={list:{},add(t,...e){this.list[t]=!0,$t.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(()=>$t.forEach(t=>te.has(t,!0)));const ee={editor:t=>te.need("editor")},ie=Gt.get("UICreator"),se={list:{},register(t){const{__tag:e}=t.prototype;oe[e]&&ie.repeat(e),oe[e]=t},get(t,e,i,s,o,r){oe[t]||ie.error("not register "+t);const a=new oe[t](e);return n(i)||(a.x=i,s&&(a.y=s),o&&(a.width=o),r&&(a.height=r)),a}},{list:oe}=se,ne=Gt.get("EventCreator"),re={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(ae[e]&&ne.repeat(e),ae[e]=t)})},changeName(t,e){const i=ae[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ae[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ae[t](...e)},{nameList:ae}=re;class he{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ee.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 le(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function de(t,e,i,s){return new(i||(i=Promise))(function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function ce(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ue=[];function ge(){return(t,e)=>{ue.push(e)}}const _e=[];let pe=class{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||_e)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ue.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){g(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};le([ce("imageSmoothingEnabled")],pe.prototype,"smooth",void 0),le([ce("imageSmoothingQuality")],pe.prototype,"smoothLevel",void 0),le([ce("globalAlpha")],pe.prototype,"opacity",void 0),le([ce()],pe.prototype,"fillStyle",void 0),le([ce()],pe.prototype,"strokeStyle",void 0),le([ce("lineWidth")],pe.prototype,"strokeWidth",void 0),le([ce("lineCap")],pe.prototype,"strokeCap",void 0),le([ce("lineJoin")],pe.prototype,"strokeJoin",void 0),le([ce("lineDashOffset")],pe.prototype,"dashOffset",void 0),le([ce()],pe.prototype,"miterLimit",void 0),le([ce()],pe.prototype,"shadowBlur",void 0),le([ce()],pe.prototype,"shadowColor",void 0),le([ce()],pe.prototype,"shadowOffsetX",void 0),le([ce()],pe.prototype,"shadowOffsetY",void 0),le([ce()],pe.prototype,"filter",void 0),le([ce()],pe.prototype,"font",void 0),le([ce()],pe.prototype,"fontKerning",void 0),le([ce()],pe.prototype,"fontStretch",void 0),le([ce()],pe.prototype,"fontVariantCaps",void 0),le([ce()],pe.prototype,"textAlign",void 0),le([ce()],pe.prototype,"textBaseline",void 0),le([ce()],pe.prototype,"textRendering",void 0),le([ce()],pe.prototype,"wordSpacing",void 0),le([ce()],pe.prototype,"letterSpacing",void 0),le([ce()],pe.prototype,"direction",void 0),le([ge()],pe.prototype,"setTransform",null),le([ge()],pe.prototype,"resetTransform",null),le([ge()],pe.prototype,"getTransform",null),le([ge()],pe.prototype,"save",null),le([ge()],pe.prototype,"restore",null),le([ge()],pe.prototype,"translate",null),le([ge()],pe.prototype,"scale",null),le([ge()],pe.prototype,"rotate",null),le([ge()],pe.prototype,"fill",null),le([ge()],pe.prototype,"stroke",null),le([ge()],pe.prototype,"clip",null),le([ge()],pe.prototype,"fillRect",null),le([ge()],pe.prototype,"strokeRect",null),le([ge()],pe.prototype,"clearRect",null),le([ge()],pe.prototype,"beginPath",null),le([ge()],pe.prototype,"moveTo",null),le([ge()],pe.prototype,"lineTo",null),le([ge()],pe.prototype,"bezierCurveTo",null),le([ge()],pe.prototype,"quadraticCurveTo",null),le([ge()],pe.prototype,"closePath",null),le([ge()],pe.prototype,"arc",null),le([ge()],pe.prototype,"arcTo",null),le([ge()],pe.prototype,"ellipse",null),le([ge()],pe.prototype,"rect",null),le([ge()],pe.prototype,"roundRect",null),le([ge()],pe.prototype,"createConicGradient",null),le([ge()],pe.prototype,"createLinearGradient",null),le([ge()],pe.prototype,"createPattern",null),le([ge()],pe.prototype,"createRadialGradient",null),le([ge()],pe.prototype,"fillText",null),le([ge()],pe.prototype,"measureText",null),le([ge()],pe.prototype,"strokeText",null);const{copy:fe,multiplyParent:me,pixelScale:ye}=G,{round:ve}=Math,we=new Xt,xe=new Xt,be={width:1,height:1,pixelRatio:1},ke=["width","height","pixelRatio"];class Se 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(i,s){super(),this.size={},this.worldTransform={},i||(i=be),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:o,height:n,pixelRatio:r}=i;this.autoLayout=!o||!n,this.size.pixelRatio=r||t.devicePixelRatio,this.config=i,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;f.copyAttrs(s,t,ke),ke.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Xt(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,o=this.worldTransform;e&&me(t,e,o),ye(t,i,o),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(o.e=ve(o.e-.5)+.5,o.f=ve(o.f-.5)+.5):(o.e=ve(o.e),o.f=ve(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.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:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),n(e.dashPattern)||(o=e.dashPattern),n(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=o,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:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,o=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,o),i?(this.setTempPixelBounds2(i,o),i=xe):i=we,this.drawImage(t.view,we.x,we.y,we.width,we.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,o=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Wt.tempToOuterOf(i,e),s,o),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,o),this.drawImage(t.view,we.x,we.y,we.width,we.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,o,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(we.x,we.y,we.width,we.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,we.x,we.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(we.x,we.y,we.width,we.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(we.x,we.y,we.width,we.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(we.x,we.y,we.width,we.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(we.x,we.y,we.width,we.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(we,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(xe,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,o=this.manager?this.manager.get(i):ee.canvas(Object.assign({},i));return o.save(),t&&(fe(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}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 Ee={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Be={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Te=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},Be),Re={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},Ce={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},Oe=Object.assign(Object.assign({},Ce),Be),Pe=Te,Le={};for(let t in Pe)Le[Pe[t]]=t;const Ae={};for(let t in Pe)Ae[Pe[t]]=Re[t];const De={drawRoundRect(t,e,i,s,o,n){const r=L.fourNumber(n,Math.min(s/2,o/2)),a=e+s,h=i+o;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Me,cos:Fe,hypot:Ie,atan2:We,ceil:ze,abs:Ne,PI:Ye,sqrt:Xe,pow:He}=Math,{setPoint:Ve,addPoint:je}=gt,{set:Ue,toNumberPoints:Ge}=ot,{M:Ke,L:qe,C:Ze,Q:Je,Z:Qe}=Te,$e={},ti={points(t,e,i,s){let o=Ge(e);if(t.push(Ke,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,g,_,p,f,m=o.length;const y=!0===i?.5:i;s&&(o=[o[m-2],o[m-1],...o,o[0],o[1],o[2],o[3]],m=o.length);for(let i=2;i<m-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],_=Xe(He(r-e,2)+He(a-n,2)),p=Xe(He(h-r,2)+He(l-a,2)),(_||p)&&(f=_+p,_=y*_/f,p=y*p/f,h-=e,l-=n,d=r-_*h,c=a-_*l,2===i?s||t.push(Je,d,c,r,a):t.push(Ze,u,g,d,c,r,a),u=r+p*h,g=a+p*l);s||t.push(Je,u,g,o[m-2],o[m-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(qe,o[e],o[e+1]);s&&t.push(Qe)},rect(t,e,i,s,o){Ee.creator.path=t,Ee.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){Ee.creator.path=[],De.drawRoundRect(Ee.creator,e,i,s,o,n),t.push(...Ee.convertToCanvasData(Ee.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,l,d){const c=s-e,u=o-i,g=n-s,_=r-o;let p=We(u,c),f=We(_,g);const m=Ie(c,u),y=Ie(g,_);let v=f-p;if(v<0&&(v+=M),m<1e-12||y<1e-12||v<1e-12||Ne(v-Ye)<1e-12)return t&&t.push(qe,s,o),h&&(Ve(h,e,i),je(h,s,o)),d&&Ue(d,e,i),void(l&&Ue(l,s,o));const w=c*_-g*u<0,x=w?-1:1,b=a/Fe(v/2),k=s+b*Fe(p+v/2+F*x),S=o+b*Me(p+v/2+F*x);return p-=F*x,f-=F*x,si(t,k,S,a,a,0,p/D,f/D,w,h,l,d)},arc:(t,e,i,s,o,n,r,a,h,l)=>si(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,l,d,c){const u=n*D,g=Me(u),_=Fe(u);let p=r*D,f=a*D;p>Ye&&(p-=M),f<0&&(f+=M);let m=f-p;m<0?m+=M:m>M&&(m-=M),h&&(m-=M);const y=ze(Ne(m/F)),v=m/y,w=Me(v/4),x=8/3*w*w/Me(v/2);f=p+v;let b,k,S,E,B,T,R,C,O=Fe(p),P=Me(p),L=S=_*s*O-g*o*P,A=E=g*s*O+_*o*P,I=e+S,W=i+E;t&&t.push(t.length?qe:Ke,I,W),l&&Ve(l,I,W),c&&Ue(c,I,W);for(let n=0;n<y;n++)b=Fe(f),k=Me(f),S=_*s*b-g*o*k,E=g*s*b+_*o*k,B=e+L-x*(_*s*P+g*o*O),T=i+A-x*(g*s*P-_*o*O),R=e+S+x*(_*s*k+g*o*b),C=i+E+x*(g*s*k-_*o*b),t&&t.push(Ze,B,T,R,C,e+S,i+E),l&&ii(e+L,i+A,B,T,R,C,e+S,i+E,l,!0),L=S,A=E,O=b,P=k,p=f,f+=v;d&&Ue(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(Ze,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){ii(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,g,_,p,f,m,y,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-g/u,0<_&&_<1&&d.push(_)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(p=(-u+y)/(2*c),0<p&&p<1&&d.push(p),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?je(h,t,e):Ve(h,t,e),je(h,r,a);for(let l=0,c=d.length;l<c;l++)ei(d[l],t,e,i,s,o,n,r,a,$e),je(h,$e.x,$e.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,_=t*t*t;l.x=c*e+u*s+g*n+_*a,l.y=c*i+u*o+g*r+_*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return ei(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:ei,toTwoPointBounds:ii,ellipse:si}=ti,{sin:oi,cos:ni,sqrt:ri,atan2:ai}=Math,{ellipse:hi}=ti,li={ellipticalArc(e,i,s,o,n,r,a,h,l,d,c){const u=(l-i)/2,g=(d-s)/2,_=r*D,p=oi(_),f=ni(_),m=-f*u-p*g,y=-f*g+p*u,v=o*o,w=n*n,x=y*y,b=m*m,k=v*w-v*x-w*b;let S=0;if(k<0){const t=ri(1-k/(v*w));o*=t,n*=t}else S=(a===h?-1:1)*ri(k/(v*x+w*b));const E=S*o*y/n,B=-S*n*m/o,T=ai((y-B)/n,(m-E)/o),R=ai((-y-B)/n,(-m-E)/o);let C=R-T;0===h&&C>0?C-=M:1===h&&C<0&&(C+=M);const O=i+u+f*E-p*B,P=s+g+p*E+f*B,L=C<0?1:0;c||t.ellipseToCurve?hi(e,O,P,o,n,r,T/D,R/D,L):o!==n||r?e.push(Te.G,O,P,o,n,r,T/D,R/D,L):e.push(Te.O,O,P,o,T/D,R/D,L)}},{M:di,m:ci,L:ui,l:gi,H:_i,h:pi,V:fi,v:mi,C:yi,c:vi,S:wi,s:xi,Q:bi,q:ki,T:Si,t:Ei,A:Bi,a:Ti,Z:Ri,z:Ci,N:Oi,D:Pi,X:Li,G:Ai,F:Di,O:Mi,P:Fi,U:Ii}=Te,{rect:Wi,roundRect:zi,arcTo:Ni,arc:Yi,ellipse:Xi,quadraticCurveTo:Hi}=ti,{ellipticalArc:Vi}=li,ji=Gt.get("PathConvert"),Ui={},Gi={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,a="";for(;n<r;){s=t[n],i=Ae[s],a+=s===o?" ":Le[s];for(let s=1;s<i;s++)a+=L.float(t[n+s],e),s===i-1||(a+=" ");o=s,n+=i}return a},parse(t,e){let i,s,o,n="";const r=[],a=e?Oe:Ce;for(let e=0,h=t.length;e<h;e++)s=t[e],jt[s]?("."===s&&(Ki.dot&&(qi(r,n),n=""),Ki.dot++),"0"===n&&"."!==s&&(qi(r,n),n=""),n+=s):Te[s]?(n&&(qi(r,n),n=""),Ki.name=Te[s],Ki.length=Re[s],Ki.index=0,qi(r,Ki.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&qi(r,n),n=s):n&&(qi(r,n),n=""),o=s;return n&&qi(r,n),i?Gi.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(o=t[c],o){case ci:t[c+1]+=a,t[c+2]+=h;case di:a=t[c+1],h=t[c+2],g.push(di,a,h),c+=3;break;case pi:t[c+1]+=a;case _i:a=t[c+1],g.push(ui,a,h),c+=2;break;case mi:t[c+1]+=h;case fi:h=t[c+1],g.push(ui,a,h),c+=2;break;case gi:t[c+1]+=a,t[c+2]+=h;case ui:a=t[c+1],h=t[c+2],g.push(ui,a,h),c+=3;break;case xi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=wi;case wi:r=n===yi||n===wi,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(yi,l,d,i,s,a,h),c+=5;break;case vi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,o=yi;case yi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(yi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ei:t[c+1]+=a,t[c+2]+=h,o=Si;case Si:r=n===bi||n===Si,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Hi(g,a,h,i,s,t[c+1],t[c+2]):g.push(bi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ki:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=bi;case bi:i=t[c+1],s=t[c+2],e?Hi(g,a,h,i,s,t[c+3],t[c+4]):g.push(bi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ti:t[c+6]+=a,t[c+7]+=h;case Bi:Vi(g,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 Ci:case Ri:g.push(Ri),c++;break;case Oi:a=t[c+1],h=t[c+2],e?Wi(g,a,h,t[c+3],t[c+4]):Zi(g,t,c,5),c+=5;break;case Pi:a=t[c+1],h=t[c+2],e?zi(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Zi(g,t,c,9),c+=9;break;case Li:a=t[c+1],h=t[c+2],e?zi(g,a,h,t[c+3],t[c+4],t[c+5]):Zi(g,t,c,6),c+=6;break;case Ai:Xi(e?g:Zi(g,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,Ui),a=Ui.x,h=Ui.y,c+=9;break;case Di:e?Xi(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Zi(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Mi:Yi(e?g:Zi(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ui),a=Ui.x,h=Ui.y,c+=7;break;case Fi:e?Yi(g,t[c+1],t[c+2],t[c+3],0,360,!1):Zi(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ii:Ni(e?g:Zi(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ui),a=Ui.x,h=Ui.y,c+=6;break;default:return ji.error(`command: ${o} [index:${c}]`,t),g}n=o}return g},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(di,t.x,t.y);break;case"L":e.push(ui,t.x,t.y);break;case"C":e.push(yi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(bi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ri)}}),e},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){Ki.index===Ki.length&&(Ki.index=1,t.push(Ki.name)),t.push(Number(e)),Ki.index++,Ki.dot=0}},{current:Ki,pushData:qi,copyData:Zi}=Gi,{M:Ji,L:Qi,C:$i,Q:ts,Z:es,N:is,D:ss,X:os,G:ns,F:rs,O:as,P:hs,U:ls}=Te,{getMinDistanceFrom:ds,getRadianFrom:cs}=ot,{tan:us,min:gs,abs:_s}=Math,ps={},fs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ji,e,i)},lineTo(t,e,i){t.push(Qi,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push($i,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(ts,e,i,s,o)},closePath(t){t.push(es)},rect(t,e,i,s,o){t.push(is,e,i,s,o)},roundRect(t,e,i,s,o,n){if(l(n))t.push(os,e,i,s,o,n);else{const r=L.fourNumber(n);r?t.push(ss,e,i,s,o,...r):t.push(is,e,i,s,o)}},ellipse(t,e,i,s,o,n,a,h,l){r(n)?t.push(rs,e,i,s,o):(r(a)&&(a=0),r(h)&&(h=360),t.push(ns,e,i,s,o,n,a,h,l?1:0))},arc(t,e,i,s,o,n,a){r(o)?t.push(hs,e,i,s):(r(n)&&(n=360),t.push(as,e,i,s,o,n,a?1:0))},arcTo(t,e,i,s,o,r,a,h){if(!n(a)){const t=ds(a,h,e,i,s,o);r=gs(r,gs(t/2,t/2*_s(us(cs(a,h,e,i,s,o)/2))))}t.push(ls,e,i,s,o,r)},drawEllipse(t,e,i,s,o,n,a,h,l){ti.ellipse(null,e,i,s,o,r(n)?0:n,r(a)?0:a,r(h)?360:h,l,null,null,ps),t.push(Ji,ps.x,ps.y),ms(t,e,i,s,o,n,a,h,l)},drawArc(t,e,i,s,o,n,a){ti.arc(null,e,i,s,r(o)?0:o,r(n)?360:n,a,null,null,ps),t.push(Ji,ps.x,ps.y),ys(t,e,i,s,o,n,a)},drawPoints(t,e,i,s){ti.points(t,e,i,s)}},{ellipse:ms,arc:ys}=fs,{moveTo:vs,lineTo:ws,quadraticCurveTo:xs,bezierCurveTo:bs,closePath:ks,beginPath:Ss,rect:Es,roundRect:Bs,ellipse:Ts,arc:Rs,arcTo:Cs,drawEllipse:Os,drawArc:Ps,drawPoints:Ls}=fs;class As{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Ee.parse(t):t:[],this}beginPath(){return Ss(this.__path),this.paint(),this}moveTo(t,e){return vs(this.__path,t,e),this.paint(),this}lineTo(t,e){return ws(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return bs(this.__path,t,e,i,s,o,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return xs(this.__path,t,e,i,s),this.paint(),this}closePath(){return ks(this.__path),this.paint(),this}rect(t,e,i,s){return Es(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return Bs(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return Ts(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return Rs(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return Cs(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return Os(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return Ps(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return Ls(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ds,L:Ms,C:Fs,Q:Is,Z:Ws,N:zs,D:Ns,X:Ys,G:Xs,F:Hs,O:Vs,P:js,U:Us}=Te,Gs=Gt.get("PathDrawer"),Ks={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case Ds:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ms:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Fs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Is:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ws:t.closePath(),s+=1;break;case zs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ns: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 Ys:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*D,e[s+6]*D,e[s+7]*D,e[s+8]),s+=9;break;case Hs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,M,!1),s+=5;break;case Vs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*D,e[s+5]*D,e[s+6]),s+=7;break;case js:t.arc(e[s+1],e[s+2],e[s+3],0,M,!1),s+=4;break;case Us:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Gs.error(`command: ${i} [index:${s}]`,e)}}},{M:qs,L:Zs,C:Js,Q:Qs,Z:$s,N:to,D:eo,X:io,G:so,F:oo,O:no,P:ro,U:ao}=Te,{toTwoPointBounds:ho,toTwoPointBoundsByQuadraticCurve:lo,arcTo:co,arc:uo,ellipse:go}=ti,{addPointBounds:_o,copy:po,addPoint:fo,setPoint:mo,addBounds:yo,toBounds:vo}=gt,wo=Gt.get("PathBounds");let xo,bo,ko;const So={},Eo={},Bo={},To={toBounds(t,e){To.toTwoPointBounds(t,Eo),vo(Eo,e)},toTwoPointBounds(t,e){if(!t||!t.length)return mo(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===$s||r===Js||r===Qs?mo(e,h,l):mo(e,t[a+1],t[a+2])),r){case qs:case Zs:h=t[a+1],l=t[a+2],fo(e,h,l),a+=3;break;case Js:o=t[a+5],n=t[a+6],ho(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,So),_o(e,So),h=o,l=n,a+=7;break;case Qs:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],lo(h,l,i,s,o,n,So),_o(e,So),h=o,l=n,a+=5;break;case $s:a+=1;break;case to:h=t[a+1],l=t[a+2],yo(e,h,l,t[a+3],t[a+4]),a+=5;break;case eo:case io:h=t[a+1],l=t[a+2],yo(e,h,l,t[a+3],t[a+4]),a+=r===eo?9:6;break;case so:go(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],So,Bo),0===a?po(e,So):_o(e,So),h=Bo.x,l=Bo.y,a+=9;break;case oo:h=t[a+1],l=t[a+2],bo=t[a+3],ko=t[a+4],yo(e,h-bo,l-ko,2*bo,2*ko),h+=bo,a+=5;break;case no:uo(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],So,Bo),0===a?po(e,So):_o(e,So),h=Bo.x,l=Bo.y,a+=7;break;case ro:h=t[a+1],l=t[a+2],xo=t[a+3],yo(e,h-xo,l-xo,2*xo,2*xo),h+=xo,a+=4;break;case ao:co(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],So,Bo),0===a?po(e,So):_o(e,So),h=Bo.x,l=Bo.y,a+=6;break;default:return void wo.error(`command: ${r} [index:${a}]`,t)}}},{M:Ro,L:Co,Z:Oo}=Te,{getCenterX:Po,getCenterY:Lo}=ot,{arcTo:Ao}=fs,Do={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,_=0;const p=t.length,f=[];for(;r<p;){switch(s=t[r],s){case Ro:l=g=t[r+1],d=_=t[r+2],r+=3,t[r]===Co?(c=t[r+1],u=t[r+2],f.push(Ro,Po(l,c),Lo(d,u))):f.push(Ro,l,d);break;case Co:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Co:Ao(f,a,h,t[r+1],t[r+2],e,g,_);break;case Oo:Ao(f,a,h,l,d,e,g,_);break;default:f.push(Co,a,h)}g=a,_=h;break;case Oo:o!==Oo&&(Ao(f,l,d,c,u,e,g,_),f.push(Oo)),r+=1;break;default:n=Ae[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==Oo&&(f[1]=l,f[2]=d),f}};function Mo(t){return new As(t)}const Fo=Mo();Ee.creator=Mo(),Ee.parse=Gi.parse,Ee.convertToCanvasData=Gi.toCanvasData;const{drawRoundRect:Io}=De;function Wo(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){Io(this,t,e,i,s,o)})}(t)}const zo={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=No.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{}}}},No=zo;No.alphaPixelTypes.forEach(t=>No.upperCaseTypeMap[t]=t.toUpperCase());const Yo=Gt.get("TaskProcessor");class Xo{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return de(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Yo.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Ho{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&&f.assign(this.config,t),this.empty()}add(t,e){let i,s,o,r;const a=new Xo(t);return a.parent=this,l(e)?r=e:e&&(s=e.parallel,i=e.start,o=e.time,r=e.delay),o&&(a.time=o),!1===s&&(a.parallel=!1),n(r)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},r)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)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 Vo=Gt.get("Resource"),jo={tasker:new Ho,map:{},get isComplete(){return Uo.tasker.isComplete},set(t,e){Uo.map[t]&&Vo.repeat(t),Uo.map[t]=e},get:t=>Uo.map[t],remove(t){const e=Uo.map[t];e&&(e.destroy&&e.destroy(),delete Uo.map[t])},loadImage(t,e){return new Promise((i,s)=>{const o=this.setImage(t,t,e);o.load(()=>i(o),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ee.image(s)),Uo.set(t,e),e},destroy(){Uo.map={}}},Uo=jo,Go={maxRecycled:10,recycledList:[],patternTasker:new Ho,get(t){let e=jo.get(t.url);return e||jo.set(t.url,e=ee.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Ko.recycledList.push(t)})},clearRecycled(){const t=Ko.recycledList;t.length>Ko.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&jo.remove(t.url)),t.length=0)},hasAlphaPixel:t=>zo.alphaPixelTypes.some(e=>Ko.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:"+zo.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+zo.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Ko.recycledList=[]}},Ko=Go,{IMAGE:qo,create:Zo}=e,{floor:Jo,max:Qo}=Math;class $o{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Zo(qo),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Go.isFormat("svg",t)&&(this.isSVG=!0),Go.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),jo.tasker.add(()=>de(this,void 0,void 0,function*(){return yield e(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}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(e,i,s,o,n,r,a){if(e||(e=this.width),i||(i=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=t.origin.createCanvas(Qo(Jo(e+(n||0)),1),Qo(Jo(i+(r||0)),1)),l=h.getContext("2d");return s&&(l.globalAlpha=s),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(e,i,s,o){const n=t.canvas.createPattern(e,i);try{s&&n.setTransform&&(n.setTransform(s),s=void 0)}catch(t){}return o&&f.stintSet(o,"transform",s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function tn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function en(t,e){return Object.getOwnPropertyDescriptor(t,e)}function sn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function on(t,e){return(i,s)=>rn(i,s,t,e&&e(s))}function nn(t){return t}function rn(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};tn(t,e,Object.assign(o,s||{})),Mn(t,e,i)}function an(t){return on(t)}function hn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function ln(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function dn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),pn(this))}}))}function cn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function un(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function gn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&pn(this)}}))}function _n(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(pn(this),this.__.__removeNaturalSize())}}))}function pn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function fn(t){return on(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),pn(this)}}))}const mn=gn;function yn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i)&&(vn(this),e&&(this.__.__useStroke=!0))}}))}function vn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&pn(t)}const wn=yn;function xn(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function bn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function kn(t){return on(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;f.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Sn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Bn(this)}}))}function En(t){return on(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Tn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Tn(this,t,e,i),this.mask&&Bn(this)}}))}function Bn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Tn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||pn(t))}function Rn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Cn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function On(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Pn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Gt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Ln(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function An(t){return(e,i)=>{tn(e,"__DataProcessor",{get:()=>t})}}function Dn(t){return(e,i)=>{tn(e,"__LayoutProcessor",{get:()=>t})}}function Mn(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=sn(e,i);if(n(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(g(i)){const t=p(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];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[o];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=en(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),tn(s,e,a)}const Fn=new Gt("rewrite"),In=[],Wn=["destroy","constructor"];function zn(t){return(e,i)=>{In.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Nn(){return t=>{Yn()}}function Yn(t){In.length&&(In.forEach(e=>{t&&Fn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),In.length=0)}function Xn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Wn.includes(s)||e&&e.includes(s)))if(t.prototype){en(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Hn(){return t=>{se.register(t)}}function Vn(){return t=>{re.register(t)}}setTimeout(()=>Yn(!0));const{copy:jn,toInnerPoint:Un,toOuterPoint:Gn,scaleOfOuter:Kn,rotateOfOuter:qn,skewOfOuter:Zn,multiplyParent:Jn,divideParent:Qn,getLayout:$n}=G,tr={},{round:er}=Math,ir={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),nr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)or(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++)rr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&rr(t),t.__updateChange()},updateAllChange(t){if(hr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ar(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,i,s,o,n,r){o||(o=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?i.copyWorldByReset(s,o,e.__nowWorld,n,r):i.copyWorldToInner(s,o,e.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,o){const n=g(e)?Object.assign({},e):{x:e,y:i};s?Gn(t.localTransform,n,n,!0):t.parent&&Un(t.parent.scrollWorldTransform,n,n,!0),sr.moveLocal(t,n.x,n.y,o)},moveLocal(t,e,i=0,s){g(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=er(e),i=er(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){sr.zoomOfLocal(t,lr(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const r=t.__localMatrix;if(l(s)||(s&&(n=s),s=i),jn(tr,r),Kn(tr,e,i,s),sr.hasHighPosition(t))sr.setTransform(t,tr,o,n);else{const e=t.x+tr.e-r.e,a=t.y+tr.f-r.f;n&&!o?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){sr.rotateOfLocal(t,lr(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;jn(tr,o),qn(tr,e,i),sr.hasHighPosition(t)?sr.setTransform(t,tr,!1,s):t.set({x:t.x+tr.e-o.e,y:t.y+tr.f-o.f,rotation:L.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){sr.skewOfLocal(t,lr(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){jn(tr,t.__localMatrix),Zn(tr,e,i,s),sr.setTransform(t,tr,o,n)},transformWorld(t,e,i,s){jn(tr,t.worldTransform),Jn(tr,e),t.parent&&Qn(tr,t.parent.scrollWorldTransform),sr.setTransform(t,tr,i,s)},transform(t,e,i,s){jn(tr,t.localTransform),Jn(tr,e),sr.setTransform(t,tr,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&sr.getInnerOrigin(t,o.origin),r=$n(e,n,o.around&&sr.getInnerOrigin(t,o.around));if(sr.hasOffset(t)&&(r.x-=o.offsetX,r.y-=o.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){Wt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=sr.getInnerOrigin(t,o.origin);ot.move(r,n.x-s.x,n.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Kn(i,sr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ot.tempToOuterOf(sr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return yt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(jn(tr,t.worldTransform),Qn(tr,e.scrollWorldTransform),i?tr:Object.assign({},tr)),drop(t,e,i,s){t.setTransform(sr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||sr.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)e.move(i);else{const o=i.x*s,n=i.y*s;i.x-=o,i.y-=n,e.move(o,n),t.requestRender(()=>sr.animateMove(e,i,s))}}},sr=ir,{updateAllMatrix:or,updateMatrix:nr,updateAllWorldOpacity:rr,updateAllChange:ar,updateChange:hr}=sr;function lr(t,e){return t.updateLayout(),t.parent?ot.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const dr={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)=>ur(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>ur(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>ur(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 cr;function ur(t,e){return e||(cr=0),t.__.mask&&(cr=1),cr<0?null:(cr&&(cr=-1),!0)}const{updateBounds:gr}=ir,_r={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,o=i.length;s<o;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),pr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&n(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++)fr(e[t],e)},updateBounds(t,e){const i=[t];fr(t,i),mr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let o=t.length-1;o>-1;o--){i=t[o],s=i.children;for(let t=0,e=s.length;t<e;t++)gr(s[t]);e&&e===i||gr(i)}}},{pushAllChildBranch:pr,pushAllBranchStack:fr,updateBoundsByBranchStack:mr}=_r,yr={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:vr,updateBounds:wr}=ir,{toOuterOf:xr,getPoints:br,copy:kr}=Wt,Sr="_localContentBounds",Er="_worldContentBounds",Br="_worldBoxBounds",Tr="_worldStrokeBounds";class Rr{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 xr(this.contentBounds,this.leaf.__localMatrix,this[Sr]||(this[Sr]={})),this[Sr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return xr(this.contentBounds,this.leaf.__world,this[Er]||(this[Er]={})),this[Er]}get worldBoxBounds(){return xr(this.boxBounds,this.leaf.__world,this[Br]||(this[Br]={})),this[Br]}get worldStrokeBounds(){return xr(this.strokeBounds,this.leaf.__world,this[Tr]||(this[Tr]={})),this[Tr]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:i}=e;if(e.isApp)return wr(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return G.defaultMatrix;case"page":t=e.zoomLayer;default:return vr(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 Xt(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 o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=G.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=vr(s,e,!0)}if(r||(r=G.getLayout(n)),kr(r,a),ot.copy(r,o),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=br(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return n(o)||s.forEach(t=>i.innerToWorld(t,null,!1,o)),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 Cr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class Or extends Cr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Or.ADD="child.add",Or.REMOVE="child.remove",Or.CREATED="created",Or.MOUNTED="mounted",Or.UNMOUNTED="unmounted",Or.DESTROY="destroy";const Pr="property.scroll";class Lr extends Cr{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}Lr.CHANGE="property.change",Lr.LEAFER_CHANGE="property.leafer_change",Lr.SCROLL=Pr;const Ar={scrollX:Pr,scrollY:Pr};class Dr extends Cr{constructor(t,e){super(t),Object.assign(this,e)}}Dr.LOAD="image.load",Dr.LOADED="image.loaded",Dr.ERROR="image.error";class Mr extends Cr{static checkHas(t,e,i){"on"===i?e===zr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Fr)||t.hasEvent(Ir)||t.hasEvent(Wr),t.__hasWorldEvent=t.hasEvent(zr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Fr,t),"inner"===e&&t.emit(Ir,t)),t.emit(Wr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(zr,this)}}Mr.RESIZE="bounds.resize",Mr.INNER="bounds.inner",Mr.LOCAL="bounds.local",Mr.WORLD="bounds.world";const{RESIZE:Fr,INNER:Ir,LOCAL:Wr,WORLD:zr}=Mr,Nr={};[Fr,Ir,Wr,zr].forEach(t=>Nr[t]=1);class Yr extends Cr{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){g(t)?(super(Yr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Yr.RESIZE="resize";class Xr extends Cr{constructor(t,e){super(t),this.data=e}}Xr.REQUEST="watch.request",Xr.DATA="watch.data";class Hr extends Cr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Hr.REQUEST="layout.request",Hr.START="layout.start",Hr.BEFORE="layout.before",Hr.LAYOUT="layout",Hr.AFTER="layout.after",Hr.AGAIN="layout.again",Hr.END="layout.end";class Vr extends Cr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Vr.REQUEST="render.request",Vr.CHILD_START="render.child_start",Vr.CHILD_END="render.child_end",Vr.START="render.start",Vr.BEFORE="render.before",Vr.RENDER="render",Vr.AFTER="render.after",Vr.AGAIN="render.again",Vr.END="render.end",Vr.NEXT="render.next";class jr extends Cr{}jr.START="leafer.start",jr.BEFORE_READY="leafer.before_ready",jr.READY="leafer.ready",jr.AFTER_READY="leafer.after_ready",jr.VIEW_READY="leafer.view_ready",jr.VIEW_COMPLETED="leafer.view_completed",jr.STOP="leafer.stop",jr.RESTART="leafer.restart",jr.END="leafer.end",jr.UPDATE_MODE="leafer.update_mode",jr.TRANSFORM="leafer.transform",jr.MOVE="leafer.move",jr.SCALE="leafer.scale",jr.ROTATE="leafer.rotate",jr.SKEW="leafer.skew";const{MOVE:Ur,SCALE:Gr,ROTATE:Kr,SKEW:qr}=jr,Zr={x:Ur,y:Ur,scaleX:Gr,scaleY:Gr,rotation:Kr,skewX:qr,skewY:qr},Jr={};class Qr{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,o,n;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const r=$r(this,s,!0),h=a(t)?t.split(" "):t,l=o?{listener:e,once:o}:{listener:e};h.forEach(t=>{t&&(n=r[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):r[t]=[l],Nr[t]&&Mr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=$r(this,t);s.forEach(t=>{t&&(o=r[t],o&&(n=o.findIndex(t=>t.listener===e),n>-1&&o.splice(n,1),o.length||delete r[t],Nr[t]&&Mr.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]));g(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&re.has(t)&&(e=re.get(t,{type:t,target:this,current:this}));const s=$r(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,o=i&&i[t],r=s&&s[t];return!!(n(e)?o||r:e?r:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function $r(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Jr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Jr)}}const{on:ta,on_:ea,off:ia,off_:sa,once:oa,emit:na,emitEvent:ra,hasEvent:aa,destroy:ha}=Qr.prototype,la={on:ta,on_:ea,off:ia,off_:sa,once:oa,emit:na,emitEvent:ra,hasEvent:aa,destroyEventer:ha},da=Gt.get("setAttr"),ca={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||n(e)||(da.warn(this.innerName,t,e),e=void 0),g(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Lr(Lr.LEAFER_CHANGE,this,t,s,e));const i=Zr[t];i&&(this.emitEvent(new jr(i,this)),this.emitEvent(new jr(jr.TRANSFORM,this)))}this.emitPropertyEvent(Lr.CHANGE,t,s,e);const i=Ar[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const o=new Lr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(o),this.leafer.emitEvent(o)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||n(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ua,multiplyParent:ga,translateInner:_a,defaultWorld:pa}=G,{toPoint:fa,tempPoint:ma}=yt,ya={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:o}=this;ga(this.__local||e,t?t.__scrollWorld||t.__world:pa,i,!!e.affectScaleOrRotation,o),s&&_a(Object.assign(s,i),o.scrollX,o.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)&&(ua(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)&&(fa(i.around||i.origin,t.boxBounds,ma),_a(e,-ma.x,-ma.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:va,updateAllMatrix:wa}=ir,{updateBounds:xa}=_r,{toOuterOf:ba,copyAndSpread:ka,copy:Sa}=Wt,{toBounds:Ea}=To,Ba={__updateWorldBounds(){const t=this.__layout;ba(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Mr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Mr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ba(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ba(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ba(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Ea(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(),wa(this),xa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(wa(this),xa(this,this))):va(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;ka(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;l(i)&&i<=0?Sa(e.renderBounds,e.strokeBounds):ka(e.renderBounds,e.boxBounds,i)}},Ta={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ir.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Gt.showBounds&&Gt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ra}=dr,Ca={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Ra(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Ra(i[s],e)||i[s].__clip(t,e)}}},Oa={},{LEAF:Pa,create:La}=e,{stintSet:Aa}=f,{toInnerPoint:Da,toOuterPoint:Ma,multiplyParent:Fa}=G,{toOuterOf:Ia}=Wt,{copy:Wa,move:za}=ot,{moveLocal:Na,zoomOfLocal:Ya,rotateOfLocal:Xa,skewOfLocal:Ha,moveWorld:Va,zoomOfWorld:ja,rotateOfWorld:Ua,skewOfWorld:Ga,transform:Ka,transformWorld:qa,setTransform:Za,getFlipTransform:Ja,getLocalOrigin:Qa,getRelativeWorld:$a,drop:th}=ir;let eh=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 Rr}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=La(Pa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Or.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(Or.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Or.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(Or.MOUNTED)):this.__emitLifeEvent(Or.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){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Fa(i,t.matrix,e,void 0,i),Ia(this.__layout.renderBounds,e,e),Aa(e,"half",i.half),Aa(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Go.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Oa.scaleX=i,Oa.scaleY=s,Oa}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?$a(this,e):this.worldTransform,o=i?t:{};return Ia(t,s,o),o}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Wa(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Wa(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Da(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ma(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return za(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return za(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}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 o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Za(this,t,e,i)}transform(t,e,i){Ka(this,t,e,i)}move(t,e,i){Na(this,t,e,i)}moveInner(t,e,i){Va(this,t,e,!0,i)}scaleOf(t,e,i,s,o){Ya(this,Qa(this,t),e,i,s,o)}rotateOf(t,e,i){Xa(this,Qa(this,t),e,i)}skewOf(t,e,i,s,o){Ha(this,Qa(this,t),e,i,s,o)}transformWorld(t,e,i){qa(this,t,e,i)}moveWorld(t,e,i){Va(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){ja(this,t,e,i,s,o)}rotateOfWorld(t,e){Ua(this,t,e)}skewOfWorld(t,e,i,s,o){Ga(this,t,e,i,s,o)}flip(t,e){Ka(this,Ja(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return te.need("path")}getMotionPoint(t){return te.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){th(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Mn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=gn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Or(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Or.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};eh=le([Xn(ca),Xn(ya),Xn(Ba),Xn(la),Xn(Ta)],eh);const{setListWithFn:ih}=Wt,{sort:sh}=_r,{localBoxBounds:oh,localStrokeBounds:nh,localRenderBounds:rh,maskLocalBoxBounds:ah,maskLocalStrokeBounds:hh,maskLocalRenderBounds:lh}=dr,dh=new Gt("Branch");let ch=class extends eh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){ih(e||this.__layout.boxBounds,this.children,this.__hasMask?ah:oh)}__updateStrokeBounds(t){ih(t||this.__layout.strokeBounds,this.children,this.__hasMask?hh:nh)}__updateRenderBounds(t){ih(t||this.__layout.renderBounds,this.children,this.__hasMask?lh:rh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(sh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return dh.warn("add self or destroyed");const i=n(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=se.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Or.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Or.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):n(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const 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(Or.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Or.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Or(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};ch=le([Xn(Ca)],ch);class uh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:i}=this;n(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(n(i[t.innerId])){const{list:s}=this;for(let t=e,o=s.length;t<o;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,o=e.length;s<o;s++)n(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;n(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new uh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class gh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const _h="1.9.8";class ph extends Se{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?(a(i)?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:s,pixelRatio:o}=this.config,n={width:i||e.width,height:s||e.height,pixelRatio:o};this.resize(n),this.context&&(this.viewSelect&&(t.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,l(o)?[o]:o)}),Wo(this.context.__proto__))}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(e){this.viewSelect&&t.miniapp.getBounds(this.viewSelect).then(t=>{this.clientBounds=t,e&&e()})}startAutoLayout(e,i){this.resizeListener||(this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};f.copyAttrs(e,this,ke),this.resize(t),n(this.width)||this.resizeListener(new Yr(t,e))}}const{mineType:fh,fileType:mh}=zo;function yh(e,i){t.origin={createCanvas:(t,e,s)=>{const o={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(o):i.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(fh(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,s)=>{let o=e.toDataURL(fh(mh(i)),s);return o=o.substring(o.indexOf("64,")+3),t.origin.download(o,i)},download:(e,s)=>new Promise((o,n)=>{let r;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,r=!0);const a=i.getFileSystemManager();a.writeFile({filePath:s,data:e,encoding:"base64",success(){r?t.miniapp.saveToAlbum(s).then(()=>{a.unlink({filePath:s}),o()}):o()},fail(t){n(t)}})}),loadImage:e=>new Promise((i,s)=>{const o=t.canvas.view.createImage();o.onload=()=>{i(o)},o.onerror=t=>{s(t)},o.src=t.image.getRealURL(e)}),noRepeat:"repeat-x"},t.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(e=>{i.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})}),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.event={stopDefault(t){},stopNow(t){},stop(t){}},t.canvas=ee.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(ee,{canvas:(t,e)=>new ph(t,e),image:t=>new $o(t)}),t.name="miniapp",t.requestRender=function(e){const{view:i}=t.renderCanvas||t.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},tn(t,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class vh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new uh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new uh,this.target=t,e&&(this.config=f.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(Vr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Or.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 Xr(Xr.DATA,{updatedList:this.updatedList})),this.__updatedList=new uh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Lr.CHANGE,this.__onAttrChange,this],[[Or.ADD,Or.REMOVE],this.__onChildEvent,this],[Xr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:wh,updateBounds:xh,updateChange:bh}=ir,{pushAllChildBranch:kh,pushAllParent:Sh}=_r;const{worldBounds:Eh}=dr;class Bh{constructor(t){this.updatedBounds=new Xt,this.beforeBounds=new Xt,this.afterBounds=new Xt,u(t)&&(t=new uh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Eh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Eh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Th,updateAllChange:Rh}=ir,Ch=Gt.get("Layouter");class Oh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new gh,this.target=t,e&&(this.config=f.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(Hr.START),this.layoutOnce(),t.emitEvent(new Hr(Hr.END,this.layoutedBlocks,this.times))}catch(t){Ch.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ch.warn("layouting"):this.times>3?Ch.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Xr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=Jt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=Hr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Hr(o,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(wh(t,!0),e.add(t),t.isBranch&&kh(t,e),Sh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Sh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||xh(s[t])}xh(i)}})}(this.__levelList),function(t){t.list.forEach(bh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Hr(n,a,this.times)),i.emitEvent(new Hr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Jt.end(e)}fullLayout(){const t=Jt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=Hr,n=this.getBlocks(new uh(e));e.emitEvent(new Hr(i,n,this.times)),Oh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Hr(s,n,this.times)),e.emitEvent(new Hr(o,n,this.times)),this.addBlocks(n),Jt.end(t)}static fullLayout(t){Th(t,!0),t.isBranch?_r.updateBounds(t):ir.updateBounds(t),Rh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Bh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Bh(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_([[Hr.REQUEST,this.layout,this],[Hr.AGAIN,this.layoutAgain,this],[Xr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ph=Gt.get("Renderer");class Lh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Hr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Vr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Vr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Vr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Xt,Ph.log(e.innerName,"---\x3e");try{this.emitRender(Vr.START),this.renderOnce(t),this.emitRender(Vr.END,this.totalBounds),Go.clearRecycled()}catch(t){this.rendering=!1,Ph.error(t)}Ph.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ph.warn("rendering");if(this.times>3)return Ph.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Xt,this.renderOptions={},t)this.emitRender(Vr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Vr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Vr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Vr.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=Jt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),o=new Xt(s);i.save(),s.spread(Lh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,o),i.restore(),Jt.end(e)}fullRender(){const t=Jt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Jt.end(t)}__render(e,i){const{canvas:s}=this,o=e.includes(this.target.__world),n=o?{includes:o}:{bounds:e,includes:o};this.needFill&&s.fillWorld(e,this.config.fill),Gt.showRepaint&&Gt.drawRepaint(s,e),t.render(this.target,s,n),this.renderBounds=i=i||e,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Xt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const i=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&e>s)return t.requestRender(i);const{frames:o}=this;o.length>30&&o.shift(),o.push(e),this.FPS=Math.round(o.reduce((t,e)=>t+e,0)/o.length),this.requestTime=0,this.checkRender()};t.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Xt(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 Xt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ph.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Vr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Vr.REQUEST,this.update,this],[Hr.END,this.__onLayoutEnd,this],[Vr.AGAIN,this.renderAgain,this],[Yr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Lh.clipSpread=10;const{hitRadiusPoint:Ah}=Wt;class Dh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new uh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o),h=o?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i){const s=this.findList=new uh;if(t.length){let e;const{x:o,y:n}=this.point,r={x:o,y:n,radiusX:0,radiusY:0};for(let o=0,n=t.length;o<n;o++)if(e=t[o],(i||ir.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ir.hasParent(t,e))){s.reset();break}return s.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),s.length)return s.list[0];return i?t[0]:t.find(t=>ir.worldHittable(t))}getPath(t){const e=new uh;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new uh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new uh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)i=t[n],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Ah(i.__world,o),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)):s&&this.hitChild(i,o))}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,o=[];const{children:n}=s;for(let s=0,r=n.length;s<r;s++)if(i=n[s],i.__.mask&&o.push(i),i===t){if(o&&!o.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Mh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new Dh(this.target=t,this),this.finder=ee.finder&&ee.finder()}getByPoint(e,i,s){const{target:o,picker:n}=this;return t.backgrounder&&o&&o.updateLayout(),n.getByPoint(e,i,s)}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):te.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Fh(t){return on(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ih(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Wh(){return(t,e)=>{const i="_"+e;tn(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}})}}function zh(t){return(e,i)=>{tn(e,i,sn(i,t))}}Object.assign(ee,{watcher:(t,e)=>new vh(t,e),layouter:(t,e)=>new Oh(t,e),renderer:(t,e,i)=>new Lh(t,e,i),selector:(t,e)=>new Mh(t,e)}),t.layout=Oh.fullLayout,t.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new uh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Nh={},Yh={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}},Xh={number:(t,e)=>g(t)?"percent"===t.type?t.value*e:t.value:t},Hh={},Vh={},jh={},Uh={},Gh={},Kh={apply(){te.need("filter")}},qh={},Zh={setStyleName:()=>te.need("state"),set:()=>te.need("state")},Jh={list:{},register(t,e){Jh.list[t]=e},get:t=>Jh.list[t]},{parse:Qh,objectToCanvasData:$h}=Gi,{stintSet:tl}=f,{hasTransparent:el}=Yh,il={},sl=Gt.get("UIData");class ol 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!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,sl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,sl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(tl(this,"__isTransparentFill",el(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):g(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(tl(this,"__isTransparentStroke",el(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):g(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&g(t[0])?(this.__setInput("path",t),this._path=e?Qh(t):$h(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){nl(this,"shadow",t)}setInnerShadow(t){nl(this,"innerShadow",t)}setFilter(t){nl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Vh.compute("fill",this.__leaf),e&&Vh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),n(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=il)):(this.__isStrokes=!0,this._stroke||(this._stroke=il))}__removePaint(t,e){e&&this.__removeInput(t),jh.recycleImage(t,this),"fill"===t?(tl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(tl(this,"__isAlphaPixelStroke",void 0),tl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function nl(t,e,i){t.__setInput(e,i),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 rl extends ol{}class al extends rl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class hl extends rl{__getInputData(t,e){const i=super.__getInputData(t,e);return ke.forEach(t=>delete i[t]),i}}class ll extends al{}class dl extends ol{get __usePathBox(){return this.points||this.__pathInputed}}class cl extends ol{get __boxStroke(){return!this.__pathInputed}}class ul extends ol{get __boxStroke(){return!this.__pathInputed}}class gl extends dl{}class _l extends ol{}class pl extends ol{get __pathInputed(){return 2}}class fl extends rl{}const ml={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class yl extends ol{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=ml[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=se.get("Rect",0);const o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class vl extends cl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class wl extends cl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:xl,add:bl}=S,kl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=xl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Gh.getShadowRenderSpread(this,e)),s&&(t=xl(t,s)),n&&(t=bl(t,Kh.getSpread(n))),r&&(t=bl(t,r)),a&&(t=bl(t,a));let l=t;return i&&(l=xl(l,Gh.getInnerShadowSpread(this,i))),o&&(l=xl(l,o)),this.__layout.renderShapeSpread=l,h?xl(h.__updateRenderSpread(),t):t}},{float:Sl}=L,El=new Xt,Bl=new Xt,Tl=new Xt,Rl={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Cl.getValidMove(t.__localBoxBounds,Cl.getDragBounds(t),s,e,!0),Cl.axisMove(t,e)},limitScaleOf(t,e,i){const{dragBounds:s,dragBoundsType:o}=t;s&&Cl.getValidScaleOf(t.__localBoxBounds,Cl.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,!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,o){const n=t.x+s.x,r=t.y+s.y,a=n+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return o||(s=Object.assign({},s)),Cl.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),Cl.isInnerMode(t,e,i,"height")?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=Sl(s.x),s.y=Sl(s.y),s},getValidScaleOf(t,e,i,s,o,n){let r,a;return n||(o=Object.assign({},o)),El.set(t).scaleOf(s,o.x,o.y).unsign(),Bl.set(El).add(e),Tl.set(El).intersect(e),r=Cl.isInnerMode(t,e,i,"width")?Bl.width/El.width:Tl.width/El.width,a=Cl.isInnerMode(t,e,i,"height")?Bl.height/El.height:Tl.height/El.height,o.x=Sl(Tl.width)?o.x*r:1,o.y=Sl(Tl.height)?o.y*a:1,o}},Cl=Rl,{stintSet:Ol}=f,Pl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ol(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ol(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ol(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Gh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),Ol(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Ll(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:n,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Vh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Gh.shadow(this,t,h),a&&(s.__isStrokes?Vh.strokes(n,this,t):Vh.stroke(n,this,t)),o&&(s.__isFills?Vh.fills(o,this,t):Vh.fill(o,this,t)),r&&this.__drawAfterFill(t,e),d&&Gh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?Vh.strokes(n,this,t):Vh.stroke(n,this,t)),c&&Kh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Vh.strokes(n,this,t):Vh.stroke(n,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Yh.string(e.color))}o&&(s.__isFills?Vh.fills(o,this,t):Vh.fill(o,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?Vh.strokes(n,this,t):Vh.stroke(n,this,t))}}else s.__pathInputed?Ll(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Vh.fills(s,this,t):Vh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Vh.strokes(o,this,t):Vh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Ll(t,e,i){const{fill:s,stroke:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Vh.stroke(o,t,e),s&&Vh.fill(s,t,e),n&&t.__drawAfterFill(e,i),o&&!r&&Vh.stroke(o,t,e)}const Al={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+h)}}}};var Dl;let Ml=Dl=class extends eh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){L.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 Fo.set(this.path=t||[]),t||this.__drawPathByBox(Fo),Fo}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return te.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return te.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Fo.set(i=[]),this.__drawPathByBox(Fo)),t?Gi.toCanvasData(i,!0):i}getPathString(t,e,i){return Gi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||qh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Do.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Hh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Ks.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,l(n)?[n]:n)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Vh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),te.need("animate")}killAnimate(t,e){}export(t,e){return te.need("export")}syncExport(t,e){return te.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),Dl.one(e)}static one(t,e,i,s,o){return se.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){Hn()(this)}static registerData(t){An(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};le([An(ol)],Ml.prototype,"__",void 0),le([Wh()],Ml.prototype,"zoomLayer",void 0),le([an("")],Ml.prototype,"id",void 0),le([an("")],Ml.prototype,"name",void 0),le([an("")],Ml.prototype,"className",void 0),le([bn("pass-through")],Ml.prototype,"blendMode",void 0),le([Sn(1)],Ml.prototype,"opacity",void 0),le([En(!0)],Ml.prototype,"visible",void 0),le([bn(!1)],Ml.prototype,"locked",void 0),le([kn(!1)],Ml.prototype,"dim",void 0),le([kn(!1)],Ml.prototype,"dimskip",void 0),le([Rn(0)],Ml.prototype,"zIndex",void 0),le([Cn(!1)],Ml.prototype,"mask",void 0),le([On(!1)],Ml.prototype,"eraser",void 0),le([hn(0,!0)],Ml.prototype,"x",void 0),le([hn(0,!0)],Ml.prototype,"y",void 0),le([gn(100,!0)],Ml.prototype,"width",void 0),le([gn(100,!0)],Ml.prototype,"height",void 0),le([cn(1,!0)],Ml.prototype,"scaleX",void 0),le([cn(1,!0)],Ml.prototype,"scaleY",void 0),le([un(0,!0)],Ml.prototype,"rotation",void 0),le([un(0,!0)],Ml.prototype,"skewX",void 0),le([un(0,!0)],Ml.prototype,"skewY",void 0),le([hn(0,!0)],Ml.prototype,"offsetX",void 0),le([hn(0,!0)],Ml.prototype,"offsetY",void 0),le([ln(0,!0)],Ml.prototype,"scrollX",void 0),le([ln(0,!0)],Ml.prototype,"scrollY",void 0),le([dn()],Ml.prototype,"origin",void 0),le([dn()],Ml.prototype,"around",void 0),le([an(!1)],Ml.prototype,"lazy",void 0),le([_n(1)],Ml.prototype,"pixelRatio",void 0),le([xn(0)],Ml.prototype,"renderSpread",void 0),le([fn()],Ml.prototype,"path",void 0),le([mn()],Ml.prototype,"windingRule",void 0),le([mn(!0)],Ml.prototype,"closed",void 0),le([gn(0)],Ml.prototype,"padding",void 0),le([gn(!1)],Ml.prototype,"lockRatio",void 0),le([gn()],Ml.prototype,"widthRange",void 0),le([gn()],Ml.prototype,"heightRange",void 0),le([an(!1)],Ml.prototype,"draggable",void 0),le([an()],Ml.prototype,"dragBounds",void 0),le([an("auto")],Ml.prototype,"dragBoundsType",void 0),le([an(!1)],Ml.prototype,"editable",void 0),le([Pn(!0)],Ml.prototype,"hittable",void 0),le([Pn("path")],Ml.prototype,"hitFill",void 0),le([wn("path")],Ml.prototype,"hitStroke",void 0),le([Pn(!1)],Ml.prototype,"hitBox",void 0),le([Pn(!0)],Ml.prototype,"hitChildren",void 0),le([Pn(!0)],Ml.prototype,"hitSelf",void 0),le([Pn()],Ml.prototype,"hitRadius",void 0),le([Ln("")],Ml.prototype,"cursor",void 0),le([bn()],Ml.prototype,"fill",void 0),le([wn(void 0,!0)],Ml.prototype,"stroke",void 0),le([wn("inside")],Ml.prototype,"strokeAlign",void 0),le([wn(1,!0)],Ml.prototype,"strokeWidth",void 0),le([wn(!1)],Ml.prototype,"strokeWidthFixed",void 0),le([wn("none")],Ml.prototype,"strokeCap",void 0),le([wn("miter")],Ml.prototype,"strokeJoin",void 0),le([wn()],Ml.prototype,"dashPattern",void 0),le([wn(0)],Ml.prototype,"dashOffset",void 0),le([wn(10)],Ml.prototype,"miterLimit",void 0),le([mn(0)],Ml.prototype,"cornerRadius",void 0),le([mn()],Ml.prototype,"cornerSmoothing",void 0),le([Fh()],Ml.prototype,"shadow",void 0),le([Fh()],Ml.prototype,"innerShadow",void 0),le([Fh()],Ml.prototype,"blur",void 0),le([Fh()],Ml.prototype,"backgroundBlur",void 0),le([Fh()],Ml.prototype,"grayscale",void 0),le([Fh()],Ml.prototype,"filter",void 0),le([bn()],Ml.prototype,"placeholderColor",void 0),le([an(100)],Ml.prototype,"placeholderDelay",void 0),le([an({})],Ml.prototype,"data",void 0),le([zn(eh.prototype.reset)],Ml.prototype,"reset",null),Ml=Dl=le([Xn(kl),Xn(Pl),Nn()],Ml);let Fl=class extends Ml{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Il;le([An(rl)],Fl.prototype,"__",void 0),le([gn(0)],Fl.prototype,"width",void 0),le([gn(0)],Fl.prototype,"height",void 0),Fl=le([Xn(ch),Hn()],Fl);const Wl=Gt.get("Leafer");let zl=Il=class extends Fl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&jo.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Il.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,f.assign(s,t));const o=this.canvas=ee.canvas(s);this.__controllers.push(this.renderer=ee.renderer(this,o,s),this.watcher=ee.watcher(this,s),this.layouter=ee.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=ee.selector(this),this.interaction=ee.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ee.hitCanvasManager()),this.canvasManager=new he,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),yr.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(jr.RESTART):this.emitLeafer(jr.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(jr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,ke);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Xt(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=f.copyAttrs({},this.canvas,ke);e.resize(t),this.updateLazyBounds(),this.__onResize(new Yr(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,ke),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Vt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ke.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(jr.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ke.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=f.copyAttrs({},s,ke);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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(jr.BEFORE_READY),this.emitLeafer(jr.READY),this.emitLeafer(jr.AFTER_READY),yr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(jr.VIEW_READY),yr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){yr.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(jr.VIEW_COMPLETED),yr.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 te.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 jr(t,this))}__listenEvents(){const t=Jt.start("FirstCreate "+this.innerName);this.once([[jr.START,()=>Jt.end(t)],[Hr.START,this.updateLazyBounds,this],[Vr.START,this.__onCreated,this],[Vr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Xr.DATA,this.__onWatchData,this],[Hr.END,this.__onLayoutEnd,this],[Vr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Il.list.remove(this);try{this.stop(),this.emitLeafer(jr.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Go.clearRecycled()},100)}catch(t){Wl.error(t)}}};t?e():setTimeout(e)}};zl.list=new uh,le([An(hl)],zl.prototype,"__",void 0),le([gn()],zl.prototype,"pixelRatio",void 0),le([an("normal")],zl.prototype,"mode",void 0),zl=Il=le([Hn()],zl);let Nl=class extends Ml{get __tag(){return"Rect"}};le([An(cl)],Nl.prototype,"__",void 0),Nl=le([Xn(Al),Nn(),Hn()],Nl);const{add:Yl,includes:Xl,scroll:Hl}=Wt,Vl=Nl.prototype,jl=Fl.prototype;let Ul=class extends Fl{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:o,boxBounds:n}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r.includes("scroll"))&&(Yl(a,n),Hl(a,i)),this.__updateRectRenderBounds(),t=!Xl(n,a),t&&"show"===r&&Yl(o,a)}else this.__updateRectRenderBounds();f.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))}};le([An(al)],Ul.prototype,"__",void 0),le([gn(100)],Ul.prototype,"width",void 0),le([gn(100)],Ul.prototype,"height",void 0),le([an(!1)],Ul.prototype,"resizeChildren",void 0),le([xn("show")],Ul.prototype,"overflow",void 0),le([zn(Vl.__updateStrokeSpread)],Ul.prototype,"__updateStrokeSpread",null),le([zn(Vl.__updateRenderSpread)],Ul.prototype,"__updateRectRenderSpread",null),le([zn(Vl.__updateBoxBounds)],Ul.prototype,"__updateRectBoxBounds",null),le([zn(Vl.__updateStrokeBounds)],Ul.prototype,"__updateStrokeBounds",null),le([zn(Vl.__updateRenderBounds)],Ul.prototype,"__updateRectRenderBounds",null),le([zn(Vl.__updateChange)],Ul.prototype,"__updateRectChange",null),le([zn(Vl.__render)],Ul.prototype,"__renderRect",null),le([zn(jl.__render)],Ul.prototype,"__renderGroup",null),Ul=le([Nn(),Hn()],Ul);let Gl=class extends Ul{get __tag(){return"Frame"}get isFrame(){return!0}};le([An(ll)],Gl.prototype,"__",void 0),le([bn("#FFFFFF")],Gl.prototype,"fill",void 0),le([xn("hide")],Gl.prototype,"overflow",void 0),Gl=le([Hn()],Gl);const{moveTo:Kl,closePath:ql,ellipse:Zl}=fs;let Jl=class extends Ml{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:o,endAngle:n}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(o||n?(s<1&&Zl(h,r,a,r*s,a*s,0,o,n,!1),Zl(h,r,a,r,a,0,n,o,!0),s<1&&ql(h)):(s<1&&(Zl(h,r,a,r*s,a*s),Kl(h,e,a)),Zl(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||n?(Kl(h,r,a),Zl(h,r,a,r,a,0,o,n,!1),ql(h)):Zl(h,r,a,r,a)}};le([An(ul)],Jl.prototype,"__",void 0),le([mn(0)],Jl.prototype,"innerRadius",void 0),le([mn(0)],Jl.prototype,"startAngle",void 0),le([mn(0)],Jl.prototype,"endAngle",void 0),Jl=le([Hn()],Jl);const{sin:Ql,cos:$l,PI:td}=Math,{moveTo:ed,lineTo:id,closePath:sd,drawPoints:od}=fs;let nd=class extends Ml{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)od(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,n=i/2,r=s/2;ed(e,n,0);for(let t=1;t<o;t++)id(e,n+n*Ql(2*t*td/o),r-r*$l(2*t*td/o));sd(e)}}};le([An(gl)],nd.prototype,"__",void 0),le([mn(3)],nd.prototype,"sides",void 0),le([mn()],nd.prototype,"points",void 0),le([mn(0)],nd.prototype,"curve",void 0),nd=le([Nn(),Hn()],nd);const{sin:rd,cos:ad,PI:hd}=Math,{moveTo:ld,lineTo:dd,closePath:cd}=fs;let ud=class extends Ml{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,n=e/2,r=this.__.path=[];ld(r,o,0);for(let t=1;t<2*i;t++)dd(r,o+(t%2==0?o:o*s)*rd(t*hd/i),n-(t%2==0?n:n*s)*ad(t*hd/i));cd(r)}};le([An(_l)],ud.prototype,"__",void 0),le([mn(5)],ud.prototype,"corners",void 0),le([mn(.382)],ud.prototype,"innerRadius",void 0),ud=le([Hn()],ud);const{moveTo:gd,lineTo:_d,drawPoints:pd}=fs,{rotate:fd,getAngle:md,getDistance:yd,defaultPoint:vd}=ot;let wd=class extends Ml{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&fd(i,e),i}set toPoint(t){this.width=yd(vd,t),this.rotation=md(vd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?pd(e,t.points,t.curve,t.closed):(gd(e,0,0),_d(e,this.width,0))}};le([An(dl)],wd.prototype,"__",void 0),le([yn("center")],wd.prototype,"strokeAlign",void 0),le([gn(0)],wd.prototype,"height",void 0),le([mn()],wd.prototype,"points",void 0),le([mn(0)],wd.prototype,"curve",void 0),le([mn(!1)],wd.prototype,"closed",void 0),wd=le([Hn()],wd);let xd=class extends Nl{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}};le([An(vl)],xd.prototype,"__",void 0),le([gn("")],xd.prototype,"url",void 0),xd=le([Hn()],xd);const bd=xd;let kd=class extends Nl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ee.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new $o({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Dr(Dr.LOADED,{image:t}))})}draw(t,e,i,s){const o=new ct(t.worldTransform).invert(),n=new ct;e&&n.translate(e.x,e.y),i&&(l(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.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()}};le([An(wl)],kd.prototype,"__",void 0),le([Ih(100)],kd.prototype,"width",void 0),le([Ih(100)],kd.prototype,"height",void 0),le([Ih(1)],kd.prototype,"pixelRatio",void 0),le([Ih(!0)],kd.prototype,"smooth",void 0),le([an(!1)],kd.prototype,"safeResize",void 0),le([Ih()],kd.prototype,"contextSettings",void 0),kd=le([Hn()],kd);const{copyAndSpread:Sd,includes:Ed,spread:Bd,setList:Td}=Wt;let Rd=class extends Ml{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:n,italic:r,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Xh.number(e,o),t.__letterSpacing=Xh.number(i,o),t.__padding=l?L.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${o||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Nh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Bd(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!Ed(h,a)),this.isOverflow?(Td(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Sd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,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()}};le([An(yl)],Rd.prototype,"__",void 0),le([gn(0)],Rd.prototype,"width",void 0),le([gn(0)],Rd.prototype,"height",void 0),le([bn()],Rd.prototype,"boxStyle",void 0),le([an(!1)],Rd.prototype,"resizeFontSize",void 0),le([bn("#000000")],Rd.prototype,"fill",void 0),le([yn("outside")],Rd.prototype,"strokeAlign",void 0),le([Pn("all")],Rd.prototype,"hitFill",void 0),le([gn("")],Rd.prototype,"text",void 0),le([gn("")],Rd.prototype,"placeholder",void 0),le([gn("caption")],Rd.prototype,"fontFamily",void 0),le([gn(12)],Rd.prototype,"fontSize",void 0),le([gn("normal")],Rd.prototype,"fontWeight",void 0),le([gn(!1)],Rd.prototype,"italic",void 0),le([gn("none")],Rd.prototype,"textCase",void 0),le([gn("none")],Rd.prototype,"textDecoration",void 0),le([gn(0)],Rd.prototype,"letterSpacing",void 0),le([gn({type:"percent",value:1.5})],Rd.prototype,"lineHeight",void 0),le([gn(0)],Rd.prototype,"paraIndent",void 0),le([gn(0)],Rd.prototype,"paraSpacing",void 0),le([gn("x")],Rd.prototype,"writingMode",void 0),le([gn("left")],Rd.prototype,"textAlign",void 0),le([gn("top")],Rd.prototype,"verticalAlign",void 0),le([gn(!0)],Rd.prototype,"autoSizeAlign",void 0),le([gn("normal")],Rd.prototype,"textWrap",void 0),le([gn("show")],Rd.prototype,"textOverflow",void 0),le([bn(!1)],Rd.prototype,"textEditing",void 0),Rd=le([Hn()],Rd);let Cd=class extends Ml{get __tag(){return"Path"}};le([An(pl)],Cd.prototype,"__",void 0),le([yn("center")],Cd.prototype,"strokeAlign",void 0),Cd=le([Hn()],Cd);let Od=class extends Fl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Cd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};le([An(fl)],Od.prototype,"__",void 0),le([(t,e)=>{tn(t,e,{get(){return this.__path}})}],Od.prototype,"path",void 0),Od=le([Xn(As,["set","path","paint"]),Hn()],Od);let Pd=class extends zl{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:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&ee.editor(o,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(t){const e=new zl(t);return this.add(e),e}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),n(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&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,ke),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Hr.END,this.__onReady,this],[Vr.START,this.__onCreated,this],[Vr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Vr.END,this.__onChildRenderEnd,this))}};Pd=le([Hn()],Pd);const Ld={},Ad={isHoldSpaceKey:()=>Ad.isHold("Space"),isHold:t=>Ld[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Ld[t]||(Ld[t]=!0)},setUpCode(t){Ld[t]=!1}},Dd={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 Md extends Cr{get spaceKey(){return Ad.isHoldSpaceKey()}get left(){return Dd.left(this)}get right(){return Dd.right(this)}get middle(){return Dd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Ad.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){re.changeName(t,e)}}let Fd=class extends Md{};Fd.POINTER="pointer",Fd.BEFORE_DOWN="pointer.before_down",Fd.BEFORE_MOVE="pointer.before_move",Fd.BEFORE_UP="pointer.before_up",Fd.DOWN="pointer.down",Fd.MOVE="pointer.move",Fd.UP="pointer.up",Fd.OVER="pointer.over",Fd.OUT="pointer.out",Fd.ENTER="pointer.enter",Fd.LEAVE="pointer.leave",Fd.TAP="tap",Fd.DOUBLE_TAP="double_tap",Fd.CLICK="click",Fd.DOUBLE_CLICK="double_click",Fd.LONG_PRESS="long_press",Fd.LONG_TAP="long_tap",Fd.MENU="pointer.menu",Fd.MENU_TAP="pointer.menu_tap",Fd=le([Vn()],Fd);const Id=Fd,Wd={};let zd=class extends Fd{static setList(t){this.list=t instanceof uh?t:new uh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const o=t.getLocalPoint(i,null,!0);return ot.move(o,e.x-t.x,e.y-t.y),s&&this.limitMove(t,o),Rl.axisMove(t,o),o}static limitMove(t,e){Rl.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Wd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Wd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Wd,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 Wt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Wt.unsign(i),i}assignMove(t){Wd.x=t?this.totalX:this.moveX,Wd.y=t?this.totalY:this.moveY}};zd.BEFORE_DRAG="drag.before_drag",zd.START="drag.start",zd.DRAG="drag",zd.END="drag.end",zd.OVER="drag.over",zd.OUT="drag.out",zd.ENTER="drag.enter",zd.LEAVE="drag.leave",zd=le([Vn()],zd);const Nd=zd;let Yd=class extends Fd{static setList(t){zd.setList(t)}static setData(t){zd.setData(t)}};Yd.DROP="drop",Yd=le([Vn()],Yd);let Xd=class extends zd{};Xd.BEFORE_MOVE="move.before_move",Xd.START="move.start",Xd.MOVE="move",Xd.END="move.end",Xd=le([Vn()],Xd);let Hd=class extends Fd{};Hd.BEFORE_ROTATE="rotate.before_rotate",Hd.START="rotate.start",Hd.ROTATE="rotate",Hd.END="rotate.end",Hd=le([Vn()],Hd);let Vd=class extends zd{};Vd.SWIPE="swipe",Vd.LEFT="swipe.left",Vd.RIGHT="swipe.right",Vd.UP="swipe.up",Vd.DOWN="swipe.down",Vd=le([Vn()],Vd);let jd=class extends Fd{};jd.BEFORE_ZOOM="zoom.before_zoom",jd.START="zoom.start",jd.ZOOM="zoom",jd.END="zoom.end",jd=le([Vn()],jd);let Ud=class extends Md{};Ud.BEFORE_DOWN="key.before_down",Ud.BEFORE_UP="key.before_up",Ud.DOWN="key.down",Ud.HOLD="key.hold",Ud.UP="key.up",Ud=le([Vn()],Ud);const Gd={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:t=>t<-45&&t>-135?Vd.UP:t>45&&t<135?Vd.DOWN:t<=45&&t>=-45?Vd.RIGHT:Vd.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:Kd.getSwipeDirection(ot.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:n(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new uh,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>ir.draggable(t)||!t.isLeafer&&t.hasEvent(zd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Kd=Gd,qd=new uh,{getDragEventData:Zd,getDropEventData:Jd,getSwipeEventData:Qd}=Gd;class $d{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Zd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=zd.list||this.draggableList||qd;return this.dragging&&(s?t?qd:new uh(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Xd.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Dd.left(t),this.dragging&&(this.interaction.emit(zd.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],ir.draggable(e)){this.draggableList=new uh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=Zd(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",e.emit(Xd.BEFORE_MOVE,this.dragData),e.emit(Xd.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(zd.BEFORE_DRAG,this.dragData),e.emit(zd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:o}=this.dragData,{dragLimitAnimate:n}=e.p,r=!n||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=zd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:o},r||s);n&&!s&&t?ir.animateMove(e,h,l(n)?n:.3):e.move(h)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(zd.OUT,t,i),e.emit(zd.OVER,t,s)):e.emit(zd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(zd.LEAVE,t,i,s),e.emit(zd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=Zd(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Xd.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(zd.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(ot.getDistance(e,t)>o.config.pointer.swipeDistance){const t=Qd(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Jd(t,e,zd.data);s.path=i,this.interaction.emit(Yd.DROP,s),this.interaction.emit(zd.LEAVE,t,i)}dragReset(){zd.list=zd.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const tc=Gt.get("emit");const ec=["move","zoom","rotate","key"];function ic(t,e,i,s,o){if(ec.some(t=>e.startsWith(t))&&t.__.hitChildren&&!oc(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&sc(n,e,i,s,o)}}function sc(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!oc(t,o)&&(Zh.updateEventStyle&&!s&&Zh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=re.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function oc(t,e){return e&&e.has(t)}const nc={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:rc,pathCanDrag:ac,pathHasOutside:hc}=Gd;class lc{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&&Dd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Dd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Ad.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=f.clone(nc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new uh(t),this.createTransformer(),this.dragger=new $d(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Dd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Fd.BEFORE_DOWN,t),this.emit(Fd.DOWN,t),Dd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Dd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Dd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Fd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ot.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(Fd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Dd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(Fd.BEFORE_UP,t),this.emit(Fd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(Fd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Fd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(Ud.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Ad.setDownCode(e),this.emit(Ud.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Ud.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(Ud.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Ad.setUpCode(e),this.emit(Ud.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new uh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(Fd.OUT,t,i),this.emit(Fd.OVER,t,e)):this.emit(Fd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(Fd.LEAVE,t,i,e),this.emit(Fd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Fd.LEAVE,t),this.dragger.dragging&&this.emit(Yd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[Fd.DOUBLE_TAP,Fd.DOUBLE_CLICK].some(e=>rc(t.path,e));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:o}=this.p,{bottomList:n,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:n,name:e.type},i||{through:o}));return a.throughPath&&(e.throughPath=a.throughPath),e.path=a.path,a.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&&!hc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!ac(t.path))&&!hc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:Fd.MOVE}),this.hoverData=t)}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,o=s.length;t<o&&(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:o}=this.canvas;return s.x*=o.width/i.width,s.y*=o.height/i.height,this.p.snap&&ot.round(s),s}emitTap(t){this.emit(Fd.TAP,t),this.emit(Fd.CLICK,t)}emitDoubleTap(t){this.emit(Fd.DOUBLE_TAP,t),this.emit(Fd.DOUBLE_CLICK,t)}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(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(Fd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Fd.LONG_TAP,t),(rc(t.path,Fd.LONG_TAP)||rc(t.path,Fd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Xt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Yr.RESIZE,this.__onResize,this)],t.once(jr.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 o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],sc(o,t,e,!0,s))return;o.isApp&&ic(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&ic(o,t,e,!1,s),sc(o,t,e,!1,s))return}catch(t){tc.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 dc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}dc.custom={};class cc extends he{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new uh,this.pixelList=new uh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ee.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ee.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()}}t.getSelector=function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=ee.selector())};const{toInnerRadiusPointOf:uc,copy:gc,setRadius:_c}=ot,{hitRadiusPoint:pc,hitPoint:fc}=Wt,mc={},yc={},vc=eh.prototype;vc.hit=function(e,i=0){this.updateLayout(),gc(yc,e),_c(yc,i);const s=this.__world;return!!(i?pc(s,yc):fc(s,yc))&&(this.isBranch?t.getSelector(this).hitPoint(Object.assign({},yc),i,{target:this}):this.__hitWorld(yc))},vc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,o=i.width<10&&i.height<10;if(e.hitRadius&&(gc(mc,t),_c(t=mc,e.hitRadius)),uc(t,i,mc),e.hitBox||o){if(Wt.hitRadiusPoint(s.boxBounds,mc))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(mc)},vc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},vc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},vc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},vc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const wc=new ct,xc=Ml.prototype;xc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.leafer||this.parent&&this.parent.leafer;if(!e)return;const i=this.__,{hitCanvasManager:s}=e,o=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,n=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,r=o||n;this.__hitCanvas||(this.__hitCanvas=r?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(r){const{renderBounds:e}=this.__layout,s=t.image.hitCanvasSize,r=a.hitScale=Ht.set(0,0,s,s).getFitMatrix(e).a,{x:h,y:l,width:d,height:c}=Ht.set(e).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Go.patternLocked=!0,this.__renderShape(a,{matrix:wc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!o,ignoreStroke:!n}),Go.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},xc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:o,__maxStrokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__isAlphaPixelStroke)||"all"===o;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const bc=Ml.prototype,kc=Nl.prototype,Sc=Ul.prototype;kc.__updateHitCanvas=Sc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?bc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},kc.__hitFill=Sc.__hitFill=function(t){return this.__hitCanvas?bc.__hitFill.call(this,t):Wt.hitRadiusPoint(this.__layout.boxBounds,t)},Rd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach(o=>t.rect(o.x,o.y-s,o.width,e<i?i:e))},Fl.prototype.pick=function(e,i){return i||(i=o),this.updateLayout(),t.getSelector(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Ec=Se.prototype;Ec.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Ec.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Ec.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),Ht.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Ht.x,Ht.y,Ht.width||1,Ht.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 Bc={convertTouch(t,e){const i=Bc.getTouch(t),s=Gd.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class Tc extends lc{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return n(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=Bc.getTouch(t);this.pointerDown(Bc.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=Bc.getTouch(t);this.pointerMove(Bc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=Bc.getTouch(t);this.pointerUp(Bc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){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(Gd.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))}destroy(){super.destroy(),this.touches=null}}function Rc(t,e){const i=t.__,{rows:s,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)n=s[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(o){const{decorationColor:t,decorationHeight:n}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>o.forEach(i=>e.fillRect(t.x,t.y+i,t.width,n)))}}function Cc(t,e){t.__.__font?Rc(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Oc(t,e,i){switch(e.__.strokeAlign){case"center":Pc(t,1,e,i);break;case"inside":Lc(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Pc(t,2,e,i):Lc(t,"outside",e,i)}}function Pc(t,e,i,s){const o=i.__;g(t)?Dc(t,e,!0,i,s):(s.setStroke(t,o.__strokeWidth*e,o),Ac(i,s))}function Lc(t,e,i,s){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Pc(t,2,i,o),o.blendMode="outside"===e?"destination-out":"destination-in",Rc(i,o),o.blendMode="normal",ir.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}function Ac(t,e){let i,s=t.__.__textDrawData;const{rows:o,decorationY:n}=s;for(let t=0,s=o.length;t<s;t++)i=o[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(n){const{decorationHeight:t}=s;o.forEach(i=>n.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function Dc(t,e,i,s,o){let n;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||o.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(n=t[h],(!n.image||!jh.checkImage(s,o,n,!1))&&n.style){if(a){const{strokeStyle:t}=n;t?o.setStroke(n.style,r.__getRealStrokeWidth(t)*e,r,t):o.setStroke(n.style,r.__strokeWidth*e,r)}else o.strokeStyle=n.style;n.blendMode?(o.saveBlendMode(n.blendMode),i?Ac(s,o):o.stroke(),o.restoreBlendMode()):i?Ac(s,o):o.stroke()}}function Mc(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Oc(t,e,i);else switch(s.strokeAlign){case"center":Fc(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Fc(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Fc(t,2,e,i);else{const{renderBounds:o}=e.__layout,n=i.getSameCanvas(!0,!0);e.__drawRenderPath(n),Fc(t,2,e,n),n.clipUI(s),n.clearWorld(o),ir.copyCanvasByWorld(e,i,n),n.recycle(e.__nowWorld)}}(t,e,i)}}function Fc(t,e,i,s){const o=i.__;g(t)?Dc(t,e,!1,i,s):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&Vh.strokeArrow(t,i,s)}const{getSpread:Ic,copyAndSpread:Wc,toOuterOf:zc,getOuterOf:Nc,getByMove:Yc,move:Xc,getIntersectData:Hc}=Wt,Vc={};let jc;const{stintSet:Uc}=f,{hasTransparent:Gc}=Yh;function Kc(t,e,i){if(!g(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:o}=i.__layout;switch(e.type){case"image":s=jh.image(i,t,e,o,!jc||!jc[e.url]);break;case"linear":s=Uh.linearGradient(e,o);break;case"radial":s=Uh.radialGradient(e,o);break;case"angular":s=Uh.conicGradient(e,o);break;case"solid":const{type:r,color:a,opacity:h}=e;s={type:r,style:Yh.string(a,h)};break;default:n(e.r)||(s={type:"solid",style:Yh.string(e)})}if(s){if(a(s.style)&&Gc(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const qc={compute:function(t,e){const i=e.__,s=[];let o,n,r,a=i.__input[t];u(a)||(a=[a]),jc=jh.recycleImage(t,i);for(let i,o=0,n=a.length;o<n;o++)(i=Kc(t,a[o],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(o=!0),n=!0),"fill"===t?(Uc(i,"__isAlphaPixelFill",o),Uc(i,"__isTransparentFill",n)):(Uc(i,"__isAlphaPixelStroke",o),Uc(i,"__isTransparentStroke",n),Uc(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,Cc(e,i)},fills:function(t,e,i){let s;for(let o=0,n=t.length;o<n;o++){if(s=t[o],s.image){if(jh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!o&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:o}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&o>1)&&i.scale(1/t,1/o)}s.blendMode&&(i.blendMode=s.blendMode),Cc(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Cc(e,i),i.restoreBlendMode()):Cc(e,i)}},fillPathOrText:Cc,fillText:Rc,stroke:Mc,strokes:function(t,e,i){Mc(t,e,i)},strokeText:Oc,drawTextStroke:Ac,shape:function(e,i,s){const o=i.getSameCanvas(),n=i.bounds,r=e.__nowWorld,a=e.__layout,h=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let l,d,c,u,g,_;zc(a.strokeSpread?(Wc(Vc,a.boxBounds,a.strokeSpread),Vc):a.boxBounds,r,h);let{scaleX:p,scaleY:f}=e.getRenderScaleData(!0);if(n.includes(h))_=o,l=g=h,d=r;else{let o;if(t.fullImageShadow)o=h;else{const t=a.renderShapeSpread?Ic(n,S.swapAndScale(a.renderShapeSpread,p,f)):n;o=Hc(t,h)}u=n.getFitMatrix(o);let{a:m,d:y}=u;u.a<1&&(_=i.getSameCanvas(),e.__renderShape(_,s),p*=m,f*=y),g=Nc(h,u),l=Yc(g,-u.e,-u.f),d=Nc(r,u),Xc(d,-u.e,-u.f);const v=s.matrix;v?(c=new ct(u),c.multiply(v),m*=v.scaleX,y*=v.scaleY):c=u,c.withScale(m,y),s=Object.assign(Object.assign({},s),{matrix:c})}return e.__renderShape(o,s),{canvas:o,matrix:c,fitMatrix:u,bounds:l,renderBounds:d,worldCanvas:_,shapeBounds:g,scaleX:p,scaleY:f}}};let Zc={},Jc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Qc,rotateOfOuter:$c,translate:tu,scaleOfOuter:eu,multiplyParent:iu,scale:su,rotate:ou,skew:nu}=G;function ru(t,e,i,s,o,n,r){const a=Qc();tu(a,e.x+i,e.y+s),su(a,o,n),r&&$c(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function au(t,e,i,s,o,n,r,a,h,l){const d=Qc();lu(d,e,i,s,o,n,r,a),h&&(Jc.a=h,Jc.d=l,iu(d,Jc)),t.transform=d}function hu(t,e,i,s,o,n,r,a,h,l,d,c){const u=Qc();if(c)lu(u,e,o,n,r,a,h,l);else{if(h)if("center"===d)$c(u,{x:i/2,y:s/2},h);else switch(ou(u,h),h){case 90:tu(u,s,0);break;case 180:tu(u,i,s);break;case 270:tu(u,0,i)}Zc.x=e.x+o,Zc.y=e.y+n,tu(u,Zc.x,Zc.y),r&&eu(u,Zc,r,a)}t.transform=u}function lu(t,e,i,s,o,n,r,a){r&&ou(t,r),a&&nu(t,a.x,a.y),o&&su(t,o,n),tu(t,e.x+i,e.y+s)}const{get:du,translate:cu}=G,uu=new Xt,gu={},_u={};function pu(t,e,i,s){const{changeful:o,sync:n,scaleFixed:r}=i;o&&(t.changeful=o),n&&(t.sync=n),r&&(t.scaleFixed=r),t.data=fu(i,s,e)}function fu(t,e,i){t.padding&&(e=uu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:o}=i;const{opacity:n,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,skew:_,clipSize:p,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===o,w={mode:r},x="center"!==h&&(u||0)%180==90;let b,k;switch(Wt.set(_u,0,0,x?o:s,x?s:o),r&&"cover"!==r&&"fit"!==r?((d||c)&&(L.getScaleData(d,c,i,gu),b=gu.scaleX,k=gu.scaleY),(h||m||f)&&(b&&Wt.scale(_u,b,k,!0),h&&xt.toPoint(h,_u,e,_u,!0,!0))):v&&!u||(b=k=Wt.getFitScale(e,_u,"fit"!==r),Wt.put(e,i,h,b,!1,_u),Wt.scale(_u,b,k,!0)),l&&ot.move(_u,l),r){case"stretch":v||(s=e.width,o=e.height);break;case"normal":case"clip":if(_u.x||_u.y||b||p||u||_){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),au(w,e,_u.x,_u.y,b,k,u,_,t,i),t&&(b=b?b*t:b,k=k?k*i:i)}break;case"repeat":(!v||b||u||_)&&hu(w,e,s,o,_u.x,_u.y,b,k,u,_,h,t.freeTransform),f||(w.repeat="repeat");const i=g(f);(m||i)&&(w.gap=function(t,e,i,s,o){let n,r;g(t)?(n=t.x,r=t.y):n=r=t;return{x:mu(n,i,o.width,e&&e.x),y:mu(r,s,o.height,e&&e.y)}}(m,i&&f,_u.width,_u.height,e));break;default:b&&ru(w,e,_u.x,_u.y,b,k,u)}return w.transform||(e.x||e.y)&&(w.transform=du(),cu(w.transform,e.x,e.y)),b&&"stretch"!==r&&(w.scaleX=b,w.scaleY=k),w.width=s,w.height=o,n&&(w.opacity=n),y&&(w.filters=y),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function mu(t,e,i,s){const o=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let yu,vu=new Xt;const{isSame:wu}=Wt;function xu(t,e,i,s,o,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return o.data||pu(o,s,i,n),!0}function bu(t,e){Eu(t,Dr.LOAD,e)}function ku(t,e){Eu(t,Dr.LOADED,e)}function Su(t,e,i){e.error=i,t.forceUpdate("surface"),Eu(t,Dr.ERROR,e)}function Eu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Dr(e,i))}function Bu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Tu,scale:Ru,copy:Cu}=G,{floor:Ou,ceil:Pu,max:Lu,abs:Au}=Math;function Du(e,i,s){let{scaleX:o,scaleY:n}=e.getRenderScaleData(!0,i.scaleFixed);const r=o+"-"+n+"-"+s;if(i.patternId===r||e.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:g,scaleY:_,transform:p,repeat:f,gap:m}=h;o*=s,n*=s,g&&(g=Au(g),_=Au(_),d=Tu(),Cu(d,p),Ru(d,1/g,1/_),o*=g,n*=_),c*=o,u*=n;const y=c*u;if(!f&&y>t.image.maxCacheSize)return!1;let v=t.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/Pu(t))}else{const t=a.width*a.height;v>t&&(v=t)}y>v&&(l=Math.sqrt(y/v)),l&&(o/=l,n/=l,c/=l,u/=l),g&&(o/=g,n/=_);const w=m&&m.x*o,x=m&&m.y*n;if(p||1!==o||1!==n){const t=c+(w||0),e=u+(x||0);o/=t/Lu(Ou(t),1),n/=e/Lu(Ou(e),1),d||(d=Tu(),p&&Cu(d,p)),Ru(d,1/o,1/n)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,x,e.leafer&&e.leafer.config.smooth),k=a.getPattern(b,f||t.origin.noRepeat||"no-repeat",d,i);return i.style=k,i.patternId=r,!0}}const Mu={image:function(t,e,i,s,o){let n,r;const a=Go.get(i);return yu&&i===yu.paint&&wu(s,yu.boxBounds)?n=yu.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),yu=a.use>1?{leafPaint:n,paint:i,boxBounds:vu.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(xu(t,e,i,a,n,s),o&&(bu(t,r),ku(t,r))):a.error?o&&Su(t,r,a.error):(o&&(Bu(t,!0),bu(t,r)),n.loadId=a.load(()=>{Bu(t,!1),t.destroyed||(xu(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),ku(t,r)),n.loadId=void 0},e=>{Bu(t,!1),Su(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(e,i,s,o){const{scaleX:n,scaleY:r}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+r+"-"+a&&!qh.running)return!1;if(o)if(h.repeat)o=!1;else if(!(s.changeful||"miniapp"===t.name&&Yr.isResizing(e)||qh.running)){let{width:e,height:i}=h;e*=n*a,i*=r*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),o=e*i>t.image.maxCacheSize}return o?(e.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,i,s,h),!0):(!s.style||s.sync||qh.running?Du(e,s,a):s.patternTask||(s.patternTask=Go.patternTasker.add(()=>de(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&Du(e,s,a),e.forceUpdate("surface")}),300)),!1)},createPattern:Du,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,o,n,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,Go.recycle(o),o.loading&&(r||(r=e.__input&&e.__input[t]||[],u(r)||(r=[r])),o.unload(i[h].loadId,!r.some(t=>t.url===a))));return n}return null},createData:pu,getPatternData:fu,fillOrFitMode:ru,clipMode:au,repeatMode:hu},{toPoint:Fu}=yt,{hasTransparent:Iu}=Yh,Wu={},zu={};function Nu(t,e,i,s){if(i){let o,n,r,h;for(let t=0,l=i.length;t<l;t++)o=i[t],a(o)?(r=t/(l-1),n=Yh.string(o,s)):(r=o.offset,n=Yh.string(o.color,s)),e.addColorStop(r,n),!h&&Iu(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Yu,getDistance:Xu}=ot,{get:Hu,rotateOfOuter:Vu,scaleOfOuter:ju}=G,{toPoint:Uu}=yt,Gu={},Ku={};function qu(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=Yu(e,i);n=Hu(),o?(ju(n,e,r/a*(s||1),1),Vu(n,e,t+90)):(ju(n,e,1,r/a*(s||1)),Vu(n,e,t))}return n}const{getDistance:Zu}=ot,{toPoint:Ju}=yt,Qu={},$u={};const tg={linearGradient:function(e,i){let{from:s,to:o,type:n,opacity:r}=e;Fu(s||"top",i,Wu),Fu(o||"bottom",i,zu);const a=t.canvas.createLinearGradient(Wu.x,Wu.y,zu.x,zu.y),h={type:n,style:a};return Nu(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Uu(s||"center",i,Gu),Uu(o||"bottom",i,Ku);const h=t.canvas.createRadialGradient(Gu.x,Gu.y,0,Gu.x,Gu.y,Xu(Gu,Ku)),l={type:n,style:h};Nu(l,h,e.stops,r);const d=qu(i,Gu,Ku,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Ju(s||"center",i,Qu),Ju(o||"bottom",i,$u);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Qu.x,Qu.y):t.canvas.createRadialGradient(Qu.x,Qu.y,0,Qu.x,Qu.y,Zu(Qu,$u)),l={type:n,style:h};Nu(l,h,e.stops,r);const d=qu(i,Qu,$u,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:qu},{copy:eg,move:ig,toOffsetOutBounds:sg}=Wt,{max:og}=Math,ng={},rg=new ct,ag={};function hg(t,e){let i,s,o,n,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=t.spread||0,n=1.5*(t.blur||0),r=og(r,o+n-s),a=og(a,o+n+i),h=og(h,o+n+s),l=og(l,o+n-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function lg(t,e,i,s,o,n,r){if(s.spread){const i=1+2*s.spread/t.__layout.strokeBounds.width*n*(r?-1:1);return rg.set().scaleOfOuter({x:(o.x+o.width/2)*e.pixelRatio,y:(o.y+o.height/2)*e.pixelRatio},i),rg}}function dg(e,i,s){const{shapeBounds:o}=s;let n,r;t.fullImageShadow?(eg(ng,e.bounds),ig(ng,i.x-o.x,i.y-o.y),n=e.bounds,r=ng):(n=o,r=i),e.copyWorld(s.canvas,n,r)}const{toOffsetOutBounds:cg}=Wt,ug={};const gg=hg;const _g={shadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;sg(h,ag,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.setWorldShadow(ag.offsetX+r.x*c*f,ag.offsetY+r.y*u*f,r.blur*c*f,Yh.string(r.color)),o=lg(t,g,i,r,ag,f),o&&g.setTransform(o),dg(g,ag,i),o&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,n,"copy"),s=n),a?g.copyWorld(a,n,n,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),ir.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;cg(h,ug,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(ug.offsetX+r.x*c*f,ug.offsetY+r.y*u*f,r.blur*c*f),o=lg(t,g,0,r,ug,f,!0),o&&g.setTransform(o),dg(g,ug,i),g.restore(),a?(g.copyWorld(g,l,n,"copy"),g.copyWorld(a,n,n,"source-out"),s=n):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,Yh.string(r.color),"source-in"),ir.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.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:hg,getShadowTransform:lg,isTransformShadow(t){},getInnerShadowSpread:gg},{excludeRenderBounds:pg}=dr;let fg;function mg(t,e,i,s,o,n,r,a){switch(e){case"grayscale":fg||(fg=!0,o.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,o,n){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),n&&s.recycle(r);vg(t,e,i,1,o,n)}(t,i,s,o,r,a);break;case"opacity-path":vg(t,i,s,n,r,a);break;case"path":a&&i.restore()}}function yg(t){return t.getSameCanvas(!1,!0)}function vg(t,e,i,s,o,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,o),n?i.recycle(r):i.clearWorld(r)}Fl.prototype.__renderMask=function(t,e){let i,s,o,n,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(mg(this,r,t,o,s,n,void 0,!0),s=o=null),"clipping"!==a&&"clipping-path"!==a||pg(i,e)||i.__render(t,e),n=i.__.opacity,fg=!1,"path"===a||"clipping-path"===a?(n<1?(r="opacity-path",o||(o=yg(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=yg(t)),o||(o=yg(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&mg(this,r,t,o,s,n,void 0,!1),pg(i,e)||i.__render(o||t,e),d&&mg(this,r,t,o,s,n,d,!1)}mg(this,r,t,o,s,n,void 0,!0)};const wg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",xg=wg+"_#~&*+\\=|≮≯≈≠=…",bg=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 kg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Sg=kg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Eg=kg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Bg=kg(wg),Tg=kg(xg),Rg=kg("- —/~|┆·");var Cg;!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"}(Cg||(Cg={}));const{Letter:Og,Single:Pg,Before:Lg,After:Ag,Symbol:Dg,Break:Mg}=Cg;function Fg(t){return Sg[t]?Og:Rg[t]?Mg:Eg[t]?Lg:Bg[t]?Ag:Tg[t]?Dg:bg.test(t)?Pg:Og}const Ig={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function Wg(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:zg}=Ig,{Letter:Ng,Single:Yg,Before:Xg,After:Hg,Symbol:Vg,Break:jg}=Cg;let Ug,Gg,Kg,qg,Zg,Jg,Qg,$g,t_,e_,i_,s_,o_,n_,r_,a_,h_,l_=[];function d_(t,e){t_&&!$g&&($g=t_),Ug.data.push({char:t,width:e}),Kg+=e}function c_(){qg+=Kg,Ug.width=Kg,Gg.words.push(Ug),Ug={data:[]},Kg=0}function u_(){n_&&(r_.paraNumber++,Gg.paraStart=!0,n_=!1),t_&&(Gg.startCharSize=$g,Gg.endCharSize=t_,$g=0),Gg.width=qg,a_.width?zg(Gg):h_&&g_(),l_.push(Gg),Gg={words:[]},qg=0}function g_(){qg>(r_.maxWidth||0)&&(r_.maxWidth=qg)}const{top:__,right:p_,bottom:f_,left:m_}=pt;function y_(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const v_={getDrawData:function(e,i){a(e)||(e=String(e));let s=0,o=0,n=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=i;d&&(n?(s=d[m_],n-=d[p_]+d[m_]):i.autoSizeAlign||(s=d[m_]),r?(o=d[__],r-=d[__]+d[f_]):i.autoSizeAlign||(o=d[__]));const c={bounds:{x:s,y:o,width:n,height:r},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,i,s){r_=e,l_=e.rows,a_=e.bounds,h_=!a_.width&&!s.autoSizeAlign;const{__letterSpacing:o,paraIndent:n,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=a_;if(h||l||o||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;n_=!0,i_=null,$g=Qg=t_=Kg=qg=0,Ug={data:[]},Gg={words:[]},o&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)Jg=i[s],"\n"===Jg?(Kg&&c_(),Gg.paraEnd=!0,u_(),n_=!0):(e_=Fg(Jg),e_===Ng&&"none"!==r&&(Jg=Wg(Jg,r,!Kg)),Qg=a.measureText(Jg).width,o&&(o<0&&(t_=Qg),Qg+=o),s_=e_===Yg&&(i_===Yg||i_===Ng)||i_===Yg&&e_!==Hg,o_=!(e_!==Xg&&e_!==Yg||i_!==Vg&&i_!==Hg),Zg=n_&&n?h-n:h,t&&h&&qg+Kg+Qg>Zg&&(e?(Kg&&c_(),qg&&u_()):(o_||(o_=e_===Ng&&i_==Hg),s_||o_||e_===jg||e_===Xg||e_===Yg||Kg+Qg>Zg?(Kg&&c_(),qg&&u_()):qg&&u_()))," "===Jg&&!0!==n_&&qg+Kg===0||(e_===jg?(" "===Jg&&Kg&&c_(),d_(Jg,Qg),c_()):s_||o_?(Kg&&c_(),d_(Jg,Qg)):d_(Jg,Qg)),i_=e_);Kg&&c_(),qg&&u_(),l_.length>0&&(l_[l_.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{r_.paraNumber++,qg=a.measureText(t).width,l_.push({x:n||0,text:t,width:qg,paraStart:!0}),h_&&g_()})}(c,e,i),d&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":y_(e,"x",t[m_]);break;case"right":y_(e,"x",-t[p_])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":y_(e,"y",t[__]);break;case"bottom":y_(e,"y",-t[f_])}}(d,c,i,n,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:_,width:p,height:f}=s,m=n*o+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,n),o>1&&(t.overflow=o);else if(f||u)switch(d){case"middle":_+=(f-m)/2;break;case"bottom":_+=f-m}y+=_;let v,w,x,b=p||u?p:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=g,v.width<p||v.width>p&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=n,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+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&&p&&p<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=m}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:o,paraIndent:n,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=i&&("justify"===o||"both"===o)&&u>1?(i-t.width-l)/(u-1):0,d=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==o||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,n),c.overflow&&function(e,i,s,o){if(!o)return;const{rows:n,overflow:r}=e;let{textOverflow:a}=i;if(n.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+o-l;("none"===i.textWrap?n:[n[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,i,s,n),"none"!==h&&function(t,e){let i,s=0;const{fontSize:o,textDecoration:n}=e;switch(t.decorationHeight=o/11,g(n)?(i=n.type,n.color&&(t.decorationColor=Yh.string(n.color)),n.offset&&(s=Math.min(.3*o,Math.max(n.offset,.15*-o)))):i=n,i){case"under":t.decorationY=[.15*o+s];break;case"delete":t.decorationY=[.35*-o];break;case"under-delete":t.decorationY=[.15*o+s,.35*-o]}}(c,i),c}};const w_={string:function(t,e){const i=l(e)&&e<1;if(a(t)){if(!i||!Yh.object)return t;t=Yh.object(t)}let s=n(t.a)?1:t.a;i&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}};Object.assign(Nh,v_),Object.assign(Yh,w_),Object.assign(Vh,qc),Object.assign(jh,Mu),Object.assign(Uh,tg),Object.assign(Gh,_g),Object.assign(ee,{interaction:(t,e,i,s)=>new Tc(t,e,i,s),hitCanvas:(t,e)=>new ph(t,e),hitCanvasManager:()=>new cc}),zl.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&yh(0,wx)}catch(t){}function x_(t){return t?u(t)?t:[t]:[]}class b_ extends Cr{get list(){return x_(this.value)}get oldList(){return x_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function k_(t){return(e,i)=>{const s="_"+i;tn(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){const n=this;if(n.config){const t="target"===i;if(t){const{beforeSelect:t}=n.config;if(t){const i=t({target:e});if(g(i))e=i;else if(!1===i)return}n.setDimOthers(!1),n.setBright(!1),u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),n.single&&(n.element.syncEventer=null)}const s=t?b_.BEFORE_SELECT:b_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new b_(s,{editor:n,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}b_.BEFORE_SELECT="editor.before_select",b_.SELECT="editor.select",b_.AFTER_SELECT="editor.after_select",b_.BEFORE_HOVER="editor.before_hover",b_.HOVER="editor.hover";const{abs:S_}=Math,{copy:E_,scale:B_}=G,{setListWithFn:T_}=Wt,{worldBounds:R_}=dr,C_={a:1,b:0,c:0,d:1,e:0,f:0},O_={x:0,y:0,width:0,height:0};class P_ extends Ml{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(T_(O_,e,R_),t&&this.set(t),this.set(O_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:n,strokeWidth:r,fill:h}=o,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=S_(c.scaleX),l=S_(c.scaleY);if(E_(C_,c),C_.half=r%2,i!==l){B_(C_,1/i,1/l),t.setWorld(C_,e.matrix),t.beginPath(),o.strokeWidth=r;const{x:n,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(n*i,a*l,h*i,d*l)}else t.setWorld(C_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=r/S_(c.scaleX);n&&(a(n)?Vh.stroke(n,this,t):Vh.strokes(n,this,t)),h&&(a(h)?Vh.fill(h,this,t):Vh.fills(h,this,t))}}o.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}le([k_(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],P_.prototype,"target",void 0);class L_ extends Fl{constructor(t){super(t),this.strokeArea=new Nl({strokeAlign:"center"}),this.fillArea=new Nl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const A_={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return D_([t],i,e),i}};function D_(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&o.hitSelf&&e.push(s)}s.isBranch&&D_(s.children,e,i)}}const{findOne:M_,findByBounds:F_}=A_;class I_ extends Fl{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new P_,this.targetStroker=new P_,this.bounds=new Xt,this.selectArea=new L_,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:o}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},o||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),o=new uh(F_(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach(e=>{o.has(e)||t.push(e)}),o.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!M_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new uh(this.editor.editBox.rect)};return M_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):M_(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[b_.HOVER,this.onHover,this],[b_.SELECT,this.onSelect,this]]),e.on_([[Fd.MOVE,this.onPointerMove,this],[Fd.BEFORE_DOWN,this.onBeforeDown,this],[Fd.TAP,this.onTap,this],[zd.START,this.onDragStart,this,!0],[zd.DRAG,this.onDrag,this],[zd.END,this.onDragEnd,this],[Xd.MOVE,this.onAutoMove,this],[[jd.ZOOM,Xd.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:W_,top:z_,topRight:N_,right:Y_,bottomRight:X_,bottom:H_,bottomLeft:V_,left:j_}=ft,{toPoint:U_}=yt,{within:G_,sign:K_}=L,q_={getScaleData(t,e,i,s,o,n,r,a){let h,d={},c=1,u=1;const{boxBounds:g,widthRange:_,heightRange:p,dragBounds:f,worldBoxBounds:m}=t,{width:y,height:v}=e,w=t.scaleX/e.scaleX,x=t.scaleY/e.scaleY,b=K_(w),k=K_(x),S=a?w:b*g.width/y,E=a?x:k*g.height/v;if(l(s))c=u=Math.sqrt(s);else{n&&(s.x*=2,s.y*=2),s.x*=a?w:b,s.y*=a?x:k;const t=(-s.y+v)/v,e=(s.x+y)/y,r=(s.y+v)/v,l=(-s.x+y)/y;switch(i){case z_:u=t,h="bottom";break;case Y_:c=e,h="left";break;case H_:u=r,h="top";break;case j_:c=l,h="right";break;case W_:u=t,c=l,h="bottom-right";break;case N_:u=t,c=e,h="bottom-left";break;case X_:u=r,c=e,h="top-left";break;case V_:u=r,c=l,h="top-right"}if(o)if("corner"===o&&i%2)o=!1;else{let t;switch(i){case z_:case H_:t=u;break;case j_:case Y_:t=c;break;default:t=Math.sqrt(Math.abs(c*u))}c=c<0?-t:t,u=u<0?-t:t}}const B=1!==c,T=1!==u;if(B&&(c/=S),T&&(u/=E),!r){const{worldTransform:e}=t;c<0&&(c=1/g.width/e.scaleX),u<0&&(u=1/g.height/e.scaleY)}if(U_(n||h,g,d,!0),f){const e={x:c,y:u};Rl.limitScaleOf(t,d,e),c=e.x,u=e.y}if(B&&_){const e=g.width*t.scaleX;c=G_(e*c,_)/e}if(T&&p){const e=g.height*t.scaleY;u=G_(e*u,p)/e}return B&&Math.abs(c*m.width)<1&&(c=K_(c)/m.width),T&&Math.abs(u*m.height)<1&&(u=K_(u)/m.height),o&&c!==u&&(u=c=Math.min(c,u)),{origin:d,scaleX:c,scaleY:u,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case W_:n="bottom-right";break;case N_:n="bottom-left";break;case X_:n="top-left";break;case V_:n="top-right";break;default:n="center"}return U_(o||n,t.boxBounds,r,!0),{origin:r,rotation:ot.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case z_:case W_:n={x:.5,y:0},o="bottom",a=1;break;case H_:case X_:n={x:.5,y:1},o="top",a=1;break;case j_:case V_:n={x:0,y:.5},o="right",h=1;break;case Y_:case N_:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,U_(s||o,t,r,!0);const c=ot.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case j_:t=Y_;break;case W_:t=N_;break;case V_:t=X_;break;case Y_:t=j_;break;case N_:t=W_;break;case X_:t=V_}if(i)switch(t){case z_:t=H_;break;case W_:t=V_;break;case N_:t=X_;break;case H_:t=z_;break;case V_:t=W_;break;case X_:t=N_}return t}},Z_={};function J_(t,e){const{enterPoint:i,dragging:s,skewing:o,resizing:n,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return Q_(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:_,resizeable:p,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(_||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!p)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?o?g:n?c:u:v?g:y?c:u;h+=45*(q_.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(L.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;Z_[S]?i.cursor=Z_[S]:Z_[S]=i.cursor={url:$_(x,h),x:b,y:k}}function Q_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function $_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class tp extends Ul{constructor(t){super(t),this.useFastShadow=!0}}const ep=["top","right","bottom","left"],ip=void 0;class sp extends Fl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return a(t)||a(e)||a(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Fl,this.rect=new tp({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new tp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Fl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:o,rotatePoints:n,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new tp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new tp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new tp({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:n,resizeLines:r}=this,{stroke:a,strokeWidth:h,resizeLine:l}=e,d=this.getPointsStyle(),c=this.getMiddlePointsStyle();let u;this.visible=!t.locked;for(let t=0;t<8;t++)u=n[t],u.set(this.getPointStyle(t%2?c[(t-1)/2%c.length]:d[t/2%d.length])),u.rotation=(t-(t%2?1:0))/2*90,t%2&&r[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},l||{}));o.set(this.getPointStyle(e.circle||e.rotatePoint||d[0])),s.set(Object.assign({stroke:a,strokeWidth:h,editConfig:ip},e.rect||{}));const g=i&&this.transformTool.editTool;s.hittable=!g,s.syncEventer=g&&this.editor,g&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),Q_(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:o,circle:n,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:_,hideOnSmall:p,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Wt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=l(p)?p:10,y=f&&!(p&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)yt.toPoint(yt.directionData[i],t,S),w=a[i],v=h[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!_),v.visible=y&&_&&g&&!x,i%2&&(k=d[(i-1)/2],k.set(S),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,p&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,p&&2*w.width>c&&(w.visible=!1)));n.visible=y&&_&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=ep.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=ep.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?q_.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:ip};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:o,rotateable:n,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!o?(n&&(this.rotating=!0),"resize-rotate"===i?o&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&o&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:o,skewing:n}=this;if(i)e.onMove(t);else if(s||o||n){const i=t.current;i.pointType&&(this.enterPoint=i),o&&e.onRotate(t),s&&e.onScale(t),n&&e.onSkew(t)}J_(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){if(this.canUse){this.moving&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Yr.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}}onTransformEnd(t){this.canUse&&(this.canDragLimitAnimate&&(t instanceof zd||t instanceof Xd)&&this.transformTool.onMove(t),this.resizing&&(Yr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.update())}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergedConfig.moveable)&&(this.gesturing=this.moving=!0,t.type===Xd.START?this.onTransformStart(t):this.transformTool.onMove(t)))}onScale(t){this.canGesture&&(t.stop(),a(this.mergedConfig.resizeable)&&(this.gesturing=this.resizing=!0,t.type===jd.START?this.onTransformStart(t):this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),a(this.mergedConfig.rotateable)&&(this.gesturing=this.rotating=!0,t.type===Hd.START?this.onTransformStart(t):this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){J_(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof Rd)||t.find(t=>t instanceof Rd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[zd.START,this.onDragStart,this],[zd.DRAG,this.onDrag,this],[zd.END,this.onDragEnd,this],[Fd.ENTER,e=>{this.enterPoint=t,J_(this,e)}],[Fd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[Fd.DOUBLE_TAP,this.onDoubleTap,this],[Fd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[Ud.HOLD,Ud.UP],this.onKey,this],[Ud.DOWN,this.onArrow,this],[[Xd.START,Xd.BEFORE_MOVE],this.onMove,this,!0],[[jd.START,jd.BEFORE_ZOOM],this.onScale,this,!0],[[Hd.START,Hd.BEFORE_ROTATE],this.onRotate,this,!0],[[Xd.END,jd.END,Hd.END],this.onTransformEnd,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const op={x:0,y:0,width:1e5,height:1e5};class np extends Ml{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,op),Object.assign(this.__world,op)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const rp='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',ap={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${rp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${rp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${rp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},hp=new Xt;function lp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{hp.setListWithFn(i,t=>t.getBounds("box","page")),0===hp.width&&(hp.width=.1),0===hp.height&&(hp.height=.1),e.reset(hp.get())}),s.add(e)}const dp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),cp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),up={group(t,e,i){t.sort(cp);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new Fl(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(dp);const r=new ct(e.worldTransform);return r.divideParent(o.scrollWorldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(n)),s.unlockLayout(),n},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(dp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(cp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},gp=Gt.get("EditToolCreator");function _p(){return t=>{fp.register(t)}}const pp=_p,fp={list:{},register(t){const{tag:e}=t.prototype;mp[e]&&gp.repeat(e),mp[e]=t},get:(t,e)=>new mp[t](e)},{list:mp}=fp;class yp extends b_{constructor(t,e){super(t,e)}}yp.BEFORE_OPEN="innerEditor.before_open",yp.OPEN="innerEditor.open",yp.BEFORE_CLOSE="innerEditor.before_close",yp.CLOSE="innerEditor.close";class vp extends b_{constructor(t,e){super(t,e)}}vp.BEFORE_GROUP="editor.before_group",vp.GROUP="editor.group",vp.BEFORE_UNGROUP="editor.before_ungroup",vp.UNGROUP="editor.ungroup",vp.BEFORE_OPEN="editor.before_open_group",vp.OPEN="editor.open_group",vp.BEFORE_CLOSE="editor.before_close_group",vp.CLOSE="editor.close_group";const{updateMatrix:wp}=ir,xp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},bp="top-left";class kp extends Nl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Lr.CHANGE,e=>{if(this.checkChange&&xp[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,wp(this.parent),wp(this);const a=new ct(this.__world);switch(r[i]=s,this.__layout.rotationChange(),wp(this),this.changedTransform=new ct(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(bp,n);break;case"scaleX":t.scaleOf(bp,n,1);break;case"scaleY":t.scaleOf(bp,1,n);break;case"skewX":t.skewOf(bp,n,0);break;case"skewY":t.skewOf(bp,0,n)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Sp extends b_{constructor(t,e){super(t,e)}}Sp.BEFORE_MOVE="editor.before_move",Sp.MOVE="editor.move";class Ep extends b_{constructor(t,e){super(t,e)}}Ep.BEFORE_SCALE="editor.before_scale",Ep.SCALE="editor.scale";class Bp extends b_{constructor(t,e){super(t,e)}}Bp.BEFORE_ROTATE="editor.before_rotate",Bp.ROTATE="editor.rotate";class Tp extends b_{constructor(t,e){super(t,e)}}Tp.BEFORE_SKEW="editor.before_skew",Tp.SKEW="editor.skew";class Rp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let o,{dragLimitAnimate:n}=i;const r=t.type===Xd.END||t.type===zd.END,h=a(e.draggable),d=!n||r||h,c={x:t.totalX,y:t.totalY};t instanceof Xd&&ot.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),o=zd.getValidMove(e,s.point,c,d),(o.x||o.y)&&(n&&!h&&r?ir.animateMove(this,o,l(n)?n:.3):this.move(o))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:o}=this.editBox;let n,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof jd?(r=e.getBoxPoint(t),n=t.totalScale):n=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=q_.getScaleData(e,o.bounds,d,n,a,q_.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof zd&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),ot.move(o.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:o,rotateAround:n,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof Hd)d=t.rotation,l=n?yt.getPoint(n,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=q_.getRotateData(e,h,t,s,i?null:n||e.around||e.origin||o||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=L.float(L.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),ot.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:o,skewX:n,skewY:r}=q_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),q_.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;g(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(g(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);o||i.safeChange(()=>i.move(t,e));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new Sp(Sp.BEFORE_MOVE,h));const l=new Sp(Sp.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Ep(Ep.BEFORE_SCALE,t));const n=new Ep(Ep.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,origin:t,scaleX:e,scaleY:i});if(g(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.scaleOf(t,e,i))),c={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Ep(Ep.BEFORE_SCALE,c));const u=new Ep(Ep.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new ct(ir.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new Ep(Ep.BEFORE_SCALE,r));const a=new Ep(Ep.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(l(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!o&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:n,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Bp(Bp.BEFORE_ROTATE,d));const c=new Bp(Bp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,origin:t,skewX:e,skewY:i});if(g(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.skewOf(t,e,i))),c={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Tp(Tp.BEFORE_SKEW,c));const u=new Tp(Tp.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(ir.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new ct(e.worldTransform);return t(),new ct(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Cp=class extends Fl{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new uh,this.openedGroupList=new uh,this.simulateTarget=new kp(this),this.editBox=new sp(this),this.editToolList={},this.selector=new I_(this),this.editMask=new np(this),this.targetEventIds=[];let i=f.clone(ap);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),te.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?u(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>f.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&lp(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(a(s))e=s;else if(!1===s)return}if(fp.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||fp.get(e,this);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(vp.BEFORE_GROUP),this.target=up.group(this.list,this.element,t),this.emitGroupEvent(vp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(vp.BEFORE_UNGROUP,t)),this.target=up.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(vp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(vp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(vp.OPEN,t)}closeGroup(t){this.emitGroupEvent(vp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(vp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ir.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new vp(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(a(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(a(i))s=i;else if(!1===i)return}fp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||fp.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(yp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(yp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(yp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(yp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new yp(t,{editTarget:i,innerEditor:e});i.syncEventer||this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(up.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(up.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Vr.START,this.onRenderStart,this),i&&i.on_(Lr.SCROLL,this.onChildScroll,this),t.on_(Vr.CHILD_START,this.onAppRenderStart,this),t.on_(jr.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};le([(t,e)=>{tn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:o}=this,a=Object.assign({},t);return e&&e.editConfig&&Object.assign(a,e.editConfig),s.config&&Object.assign(a,s.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),r(a.lockRatio)&&(a.lockRatio=!0))),n(a.dragLimitAnimate)&&(a.dragLimitAnimate=o&&o.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Cp.prototype,"mergeConfig",void 0),le([k_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof uh?i:new uh(i),t.multiple&&lp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new b_(b_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new b_(b_.AFTER_SELECT,s))})],Cp.prototype,"target",void 0),le([k_(function(t,e){t.emitEvent(new b_(b_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Cp.prototype,"hoverTarget",void 0),Cp=le([Xn(Rp,["editBox","editTool","emitEvent"])],Cp);class Op{static registerInnerEditor(){fp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Fl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let Pp=class extends Op{static registerEditTool(){fp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach(t=>{t.moveWorld(e,i)}),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach(t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)}),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};Pp=le([_p()],Pp);const{left:Lp,right:Ap}=ft,{move:Dp,copy:Mp,toNumberPoints:Fp}=ot;let Ip=class extends Pp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===Lp;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=Fp(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(Dp(t,n,r),s&&Dp(e,-n,-r)):(s&&Dp(t,-n,-r),Dp(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),Mp(s[7],i),Mp(e[7],i),Mp(s[3],a),Mp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Lp||t===Ap,s[t].visible=a,e[t].visible=!r&&a}};Ip=le([_p()],Ip);const{M:Wp,L:zp,C:Np,Q:Yp,Z:Xp,N:Hp,D:Vp,X:jp,G:Up,F:Gp,O:Kp,P:qp,U:Zp}=Te,Jp={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case Wp:case zp:Qp(t,e,i,o,1),o+=3;break;case Np:Qp(t,e,i,o,3),o+=7;break;case Yp:Qp(t,e,i,o,2),o+=5;break;case Xp:o+=1;break;case Hp:Qp(t,e,i,o,2),o+=5;break;case Vp:Qp(t,e,i,o,2),o+=9;break;case jp:Qp(t,e,i,o,2),o+=6;break;case Up:Qp(t,e,i,o,2),o+=9;break;case Gp:Qp(t,e,i,o,2),o+=5;break;case Kp:t[o]=Up,t.splice(o+4,0,t[o+3],0),Qp(t,e,i,o,2),o+=9,n+=2;break;case qp:t[o]=Gp,t.splice(o+4,0,t[o+3]),Qp(t,e,i,o,2),o+=5,n+=1;break;case Zp:Qp(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:Qp}=Jp,$p=G.get(),{topLeft:tf,top:ef,topRight:sf,right:of,bottom:nf,left:rf}=ft;function af(t,e,i){t.pathInputed?lf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function hf(t,e,i,s){let o=e;if(!n(s)){const n=t.__layout;let{width:r,height:a}=n.boxBounds;switch(r*=i-e,a*=e-i,s){case ef:case nf:o=i,n.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case rf:case of:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case tf:case sf:n.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function lf(t,e,i){Jp.scale(t.__.path,e,i),t.path=t.__.path}function df(t,e,i){const{points:s}=t;g(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):Jp.scalePoints(s,e,i),t.points=s}function cf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)$p.a=e,$p.d=i,s[t].transform($p,!0)}const uf=eh.prototype;function gf(t,e,i){_f(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Xd.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(Xd.END,e=>{ir.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(jd.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function _f(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}uf.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},uf.__scaleResize=function(t,e){af(this,t,e)},uf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},uf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Rd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,n=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize)hf(this,t,e,n&&n.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:n}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==o&&1!==t&&(this.x+=r.x),s&&"top"!==n&&1!==e&&(this.y+=r.y),af(this,t,e)}},Cd.prototype.__scaleResize=function(t,e){lf(this,t,e)},wd.prototype.__scaleResize=function(t,e){this.pathInputed?lf(this,t,e):this.points?df(this,t,e):this.width*=t},nd.prototype.__scaleResize=function(t,e){this.pathInputed?lf(this,t,e):this.points?df(this,t,e):af(this,t,e)},Fl.prototype.__scaleResize=function(t,e){cf(this,t,e)},Ul.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||af(this,t,e),i&&cf(this,t,e)},te.add("resize"),te.add("editor","resize"),ee.editor=function(t,e){const i=new Cp(t);return e&&e.sky.add(e.editor=i),i},Ul.addAttr("textBox",!1,an),Ml.addAttr("editConfig",void 0,an),Ml.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),an),Ml.addAttr("editInner","PathEditor",an),Fl.addAttr("editInner","",an),Rd.addAttr("editInner","TextEditor",an),Ml.setEditConfig=function(t){this.changeAttr("editConfig",t)},Ml.setEditOuter=function(t){this.changeAttr("editOuter",t)},Ml.setEditInner=function(t){this.changeAttr("editInner",t)};const pf=Gt.get("LeaferTypeCreator"),ff={list:{},register(t,e){mf[t]&&pf.repeat(t),mf[t]=e},run(t,e){const i=mf[t];i&&i(e)}},{list:mf,register:yf}=ff;yf("viewport",gf),yf("custom",function(t){gf(t,null,!0)}),yf("design",function(t){gf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),yf("document",function(t){gf(t,{zoom:{min:1},move:{scroll:"limit"}})});const vf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=ot.getCenter(e.from,i.from),o=ot.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=ot.getDistance(e.from,i.from);return{move:n,scale:ot.getDistance(e.to,i.to)/r,rotation:ot.getRotation(e.from,i.from,e.to,i.to),center:o}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),o=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&o<1?"none":i>=s&&i>=o?"move":s>=o?"zoom":"rotate"},detect(t,e){const{state:i}=wf,s=wf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),wf.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?wf.getType(i.totalData,e):"none"},add(t,e){e&&(ot.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=wf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},wf=vf,{abs:xf,max:bf}=Math,{sign:kf,within:Sf}=L,Ef={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;t.shiftKey&&!s&&(s=o,o=0);const n=xf(s),r=xf(o);return n>50&&(s=bf(50,n/3)*kf(s)),r>50&&(o=bf(50,r/3)*kf(o)),{x:-s*i*2,y:-o*i*2}},getScale(e,i){let s,o=1,{zoomMode:n,zoomSpeed:r}=i;const a=e.deltaY||e.deltaX;if(n?(s="mouse"===n||!e.deltaX&&(t.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){r=Sf(r,0,1);const t=e.deltaY?i.delta.y:i.delta.x,s=Sf(1-xf(a)/(4*t)*r,.5,2);o=a>0?s:1/s}return o}};let Bf,Tf,Rf,Cf;class Of{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Bf=0,Tf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Bf,totalY:Tf}),e.emit(Xd.START,this.moveData)),t.path=this.moveData.path,t.totalX=Bf+=t.moveX,t.totalY=Tf+=t.moveY,e.emit(Xd.BEFORE_MOVE,t),e.emit(Xd.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Rf=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Rf}),e.emit(jd.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Rf*=t.scale,e.emit(jd.BEFORE_ZOOM,t),e.emit(jd.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Cf=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Cf}),e.emit(Hd.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Cf+=t.rotation,e.emit(Hd.BEFORE_ROTATE,t),e.emit(Hd.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(Xd.END,Object.assign(Object.assign({},e),{totalX:Bf,totalY:Tf})),i&&t.emit(jd.END,Object.assign(Object.assign({},i),{totalScale:Rf})),s&&t.emit(Hd.END,Object.assign(Object.assign({},s),{totalRotation:Cf})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Pf=zl.prototype,Lf=new Xt,Af=new lt;function Df(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Mf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Pf.initType=function(t){ff.run(t,this)},Pf.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:o}=this.app.config.move;if(Af.set(t,e),s){const t=!0===s?"":s;t.includes("x")?Af.y=0:t.includes("y")?Af.x=0:Math.abs(Af.x)>Math.abs(Af.y)?Af.y=0:Af.x=0,i&&t.includes("limit")&&(Lf.set(this.__world).addPoint(this.zoomLayer),Rl.getValidMove(Lf,this.canvas.bounds,"inner",Af,!0),t.includes("x")?Af.y=0:t.includes("y")&&(Af.x=0))}return{x:o?0:Af.x,y:o?0:Af.y}},Pf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const Ff=lc.prototype;Ff.createTransformer=function(){this.transformer=new Of(this)},Ff.move=function(t){this.transformer.move(t)},Ff.zoom=function(t){this.transformer.zoom(t)},Ff.rotate=function(t){this.transformer.rotate(t)},Ff.transformEnd=function(){this.transformer.transformEnd()},Ff.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):Ef.getScale(t,e);if(1!==n)this.zoom(Mf(n,t));else{const s=e.getMove?e.getMove(t,e):Ef.getMove(t,e);i.snap&&ot.round(s),this.move(Df(s,t))}},Ff.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let o=vf.getData(e),{moving:n,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(vf.detect(o,g(s)?s:{})){case"move":n=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}vf.reset()}n||(o.center=vf.state.center)}else n=r=a=!0;var h,l;Object.assign(t,o.center),t.multiTouch=!0,a&&this.rotate((h=o.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(Mf(o.scale,t)),n&&this.move(Df(o.move,t))};const If=$d.prototype,{abs:Wf}=Math;function zf(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}If.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=Wf(i),n=Wf(s),r=e?1:.1,a=this.canAnimate&&this.moving&&(o>r||n>r)&&this.interaction.m.dragAnimate;if(a){const r="touch"===t.pointerType?3:1,h=70;o*(e=e?l(a)?a:.95:r)>h?e=h/o:n*e>h&&(e=h/n),t=Object.assign({},t),ot.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},If.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},If.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},If.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Wt.maxX(r),d=Wt.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let g=0,_=0;this.autoMoveTimer=setInterval(()=>{g+=c,_+=u,ot.move(i,c,u),ot.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},If.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},te.add("viewport"),te.add("view"),zl.prototype.zoom=function(t,e,i,s){let o;this.killAnimate(),_(e)?(o=e.padding,i=e.scroll,s=e.transition):o=e;const{zoomLayer:n}=this,h=this.canvas.bounds.clone().shrink(r(o)?30:o),d=new Xt,c={x:h.x+h.width/2,y:h.y+h.height/2};let p;const{x:f,y:m,scaleX:y,scaleY:v}=n.__;if(a(t))switch(t){case"in":p=zf(y,"in");break;case"out":p=zf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Xt(this.boxBounds)).height=0;break;case"fit-height":(t=new Xt(this.boxBounds)).width=0}else l(t)&&(p=t/y);if(p)p=this.getValidScale(p),n.scaleOfWorld(c,p,p,!1,s);else if(g(t)){const e={x:f,y:m,scaleX:y,scaleY:v},o=u(t);if(o||t.tag){const e=o?t:[t];d.setListWithFn(e,dr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,h);d.set(n.getWorldBounds(e))}const{width:r,height:a}=d;let l=h.x-d.x,c=h.y-d.y;return i?(l+=Math.max((h.width-r)/2,0),c+=Math.max((h.height-a)/2,0)):(p=this.getValidScale(Math.min(h.width/r,h.height/a)),l+=(h.width-r*p)/2,c+=(h.height-a*p)/2,ot.scaleOf(e,d,p),d.scaleOf(d,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(l=0),ot.move(e,l,c),d.move(l,c),n.set(e,s),d}return n.worldBoxBounds};class Nf extends Fl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;a(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Ul,this.scrollYBar=new Ul),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new Xt(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:_,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?p.width+6:2,u?_.height+6:2,2]);_.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),p.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:g})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(zd.DRAG,this.onDrag,this),e.on_(zd.DRAG,this.onDrag,this),t.on_(zd.END,this.onDragEnd,this),e.on_(zd.END,this.onDragEnd,this),this.target.on_(Vr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Yr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}te.add("scroll");class Yf extends dl{}function Xf(t){return on(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,vn(this)}}}))}let Hf=class extends wd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Hh.register(t,e)}};le([An(Yf)],Hf.prototype,"__",void 0),le([Xf("angle")],Hf.prototype,"endArrow",void 0),Hf=le([Hn()],Hf);const{M:Vf,L:jf,C:Uf,Q:Gf,O:Kf}=Te,{rotate:qf,copyFrom:Zf,scale:Jf}=ot,Qf={},$f={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case Vf:case jf:tm(t,l+1,e,i,s,o,n,r),l+=3;break;case Uf:for(h=1;h<6;h+=2)tm(t,l+h,e,i,s,o,n,r);l+=7;break;case Gf:for(h=1;h<4;h+=2)tm(t,l+h,e,i,s,o,n,r);l+=5;break;case Kf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){$f.layout(t,0,0,1,1,e,i)}};function tm(t,e,i,s,o,n,r,a){Zf(Qf,t[e],t[e+1]),r&&qf(Qf,r,a),o&&Jf(Qf,o,n),t[e]=i+Qf.x,t[e+1]=s+Qf.y}const{layout:em,rotate:im}=$f,{getAngle:sm}=ot,om={x:-.5},nm={connect:om,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},rm={connect:om,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},am={connect:om,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},hm={connect:om,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},lm={offset:om,path:[...am.path],dashPath:[1,-2.5,0,2,-1,0]};im(lm.path,180,{x:-1.5,y:0});const dm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},cm={connect:{x:.5},path:[...dm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},um={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},gm={path:[...um.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},_m=f.clone(um),pm=f.clone(gm);im(_m.path,45),im(pm.path,45);const fm={angle:nm,"angle-side":rm,arrow:hm,triangle:am,"triangle-flip":lm,circle:cm,"circle-line":dm,square:gm,"square-line":um,diamond:pm,"diamond-line":_m,mark:{offset:om,path:[1,0,-2,2,0,2]}};function mm(t,e,i,s,o,n,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;g(e)?e.type?(h=e.scale,a=fm[e.type]):a=e:a=fm[e];const{offset:c,connect:u,path:_,dashPath:p}=a;let f=u?u.x:0,m=c?c.x:0;const y=[..._];return r&&p&&y.push(...p),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?m+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(m+=c.bevelJoin)),h&&em(y,0,0,h,h),m&&em(y,m,0),em(y,s.x,s.y,o,o,sm(i,s)),n.x=(f+m)*o,y}const{M:ym,L:vm,C:wm,Q:xm,Z:bm,N:km,D:Sm,X:Em,G:Bm,F:Tm,O:Rm,P:Cm,U:Om}=Te,{copy:Pm,copyFrom:Lm,getDistancePoint:Am}=ot,Dm={},Mm={},Fm={},Im={},Wm={},zm={list:fm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:o,__pathForRender:n,cornerRadius:r}=t.__,a=!r;let h,l=0,d=n.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=n[l],h){case ym:case vm:(c<2||l+6>=d)&&(Lm(Wm,n[l+1],n[l+2]),!c&&u&&Pm(Mm,Wm)),l+=3;break;case wm:(1===c||l+7>=d-3)&&Nm(n,Im,Wm,l+3),l+=7;break;case xm:(1===c||l+5>=d-3)&&Nm(n,Im,Wm,l+1),l+=5;break;case bm:return;case km:l+=5;break;case Sm:l+=9;break;case Em:l+=6;break;case Bm:l+=9;break;case Tm:l+=5;break;case Rm:l+=7;break;case Cm:l+=4;break;case Om:(1===c||l+6>=d-3)&&(Nm(n,Im,Wm,l+1),l+6!==d&&(Wm.x-=(Wm.x-Im.x)/10,Wm.y-=(Wm.y-Im.y)/10)),l+=6}if(c++,1===c&&h!==ym)return;if(2===c&&u&&Pm(Fm,h===vm?Wm:Im),l===d){const r=t.__.__pathForRender=a?[...n]:n,d=t.__.__pathForArrow=[];if(u){const i=mm(t,e,Fm,Mm,s,Dm,!!o);o?d.push(...i):r.push(...i),Dm.x&&(Am(Mm,Fm,-Dm.x,!0),r[1]=Fm.x,r[2]=Fm.y)}if(i&&"none"!==i){const e=mm(t,i,Im,Wm,s,Dm,!!o);if(o?d.push(...e):r.push(...e),Dm.x){let t;switch(Am(Wm,Im,-Dm.x,!0),h){case vm:t=l-3+1;break;case wm:t=l-7+5;break;case xm:t=l-5+3;break;case Om:t=l-6+3}t&&Ym(r,Im,t)}}}else Pm(Im,Wm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Nm(t,e,i,s){Lm(e,t[s],t[s+1]),Lm(i,t[s+2],t[s+3])}function Ym(t,e,i){t[i]=e.x,t[i+1]=e.y}te.add("arrow"),Ml.addAttr("startArrow","none",Xf),Ml.addAttr("endArrow","none",Xf),Object.assign(Hh,zm),Object.assign(Vh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let Xm=class extends Ul{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};le([An(class extends al{})],Xm.prototype,"__",void 0),le([dn("x")],Xm.prototype,"flow",void 0),Xm=le([Hn()],Xm);const Hm={},Vm={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},jm={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function Um(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;xt.toPoint(i,e,o,Hm),e.x=s.__autoWidth?o.x:Hm.x,e.y=s.__autoHeight?o.y:Hm.y}const{move:Gm}=ot;function Km(t,e,i,s,o,n){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=s+(e.height-h.height)/("center"===o?2:1)),Gm(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function qm(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const Zm={};function Jm(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:n,__autoHeight:r}=t.__,h=o&&(e?!n:!r);return g(i)?(Zm.xGap=i.x||0,Zm.yGap=i.y||0):Zm.xGap=Zm.yGap=c(i),Zm.isAutoXGap=a(Zm.xGap)&&!n,Zm.isAutoYGap=a(Zm.yGap)&&!r,Zm.complex=h||"top-left"!==s||t.__hasGrow||Zm.isAutoXGap||Zm.isAutoYGap,Zm.wrap=h,Zm.complex&&(Zm.isFitXGap="fit"===Zm.xGap&&!n,Zm.isFitYGap="fit"===Zm.yGap&&!r,g(s)?(Zm.contentAlign=s.content||"top-left",Zm.rowXAlign=s.x||"from",Zm.rowYAlign=s.y||"from"):(Zm.contentAlign=s,Zm.rowXAlign=Vm[s],Zm.rowYAlign=jm[s])),Zm}function Qm(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function $m(t,e,i,s){const{count:o}=t;o>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(o-1),t[e]=i)}function ty(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:ey}=L;function iy(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__widthGrow)&&(r=sy(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.widthRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__widthGrow,o=e/i*s,r=sy(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s})}(h,a,l)}}function sy(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?ey(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:oy}=L;function ny(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__heightGrow)&&(r=ry(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.heightRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__heightGrow,o=e/i*s,r=ry(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s})}(h,a,l)}}function ry(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?oy(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:ay}=ot;function hy(t,e){const i="width",{children:s,itemBox:o}=t,n=Jm(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:h;let _,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=ty(_,o),r?(_.__flowBounds=p,y||(y=Qm(m,g)),a&&y.count&&y.width+p.width>x&&(y.grow?iy(t,y,x,e):d&&$m(y,i,x,c),qm(u,y,i),y=Qm(m,g)),f=p.width,_.__widthGrow&&(y.grow+=_.__widthGrow,f=0,_.__.widthRange&&(y.hasRangeSize=!0)),_.__heightGrow&&ry(_,p,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,p.height),y.count++):(ay(_,v-p.x,w-p.y),v+=p.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:g}=n;y.count&&(y.grow?iy(t,y,x,e):d&&$m(y,i,x,c),a&&qm(u,y,i)),a?(s?$m(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Um(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=Vm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],Km(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(Um(t,y,r),Km(t,y,0,y.y,g,e))}}const{move:ly}=ot;function dy(t,e,i,s,o,n){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=i+(e.width-h.width)/("center"===o?2:1)),ly(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:cy}=ot;function uy(t,e){const i="height",{children:s,itemBox:o}=t,n=Jm(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:l;let _,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=ty(_,o),r?(_.__flowBounds=p,y||(y=Qm(m,g)),a&&y.count&&y.height+p.height>b&&(y.grow&&ny(t,y,b,e),d&&$m(y,i,b,c),qm(u,y,i),y=Qm(m,g)),f=p.height,_.__heightGrow&&(y.grow+=_.__heightGrow,f=0,_.__.heightRange&&(y.hasRangeSize=!0)),_.__widthGrow&&sy(_,p,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,p.width),y.count++):(cy(_,v-p.x,w-p.y),w+=p.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:g}=n;y.count&&(y.grow&&ny(t,y,b,e),d&&$m(y,i,b,c),a&&qm(u,y,i)),a?(s?$m(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Um(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=jm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],dy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Um(t,y,r),dy(t,y,y.x,0,l,e))}}function gy(t){return on(t,t=>({set(e){const i=l(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&pn(this)}}))}te.add("flow","resize");const _y=Ul.prototype,{__updateBoxBounds:py}=Fl.prototype;Ml.addAttr("flow",!1,dn),Ml.addAttr("gap",0,gn),Ml.addAttr("flowAlign","top-left",gn),Ml.addAttr("flowWrap",!1,gn),Ml.addAttr("itemBox","box",gn),Ml.addAttr("inFlow",!0,gn),Ml.addAttr("autoWidth",void 0,gy),Ml.addAttr("autoHeight",void 0,gy),Ml.addAttr("autoBox",void 0,gn);const{copyAndSpread:fy}=Wt;_y.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:hy(this);break;case"y":uy(this);break;case"x-reverse":hy(this,!0);break;case"y-reverse":uy(this,!0)}t&&(this.leafer.created=!0)},_y.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),fy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},_y.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():py.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&fy(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:my,sin:yy,pow:vy,sqrt:wy,abs:xy,ceil:by,floor:ky,round:Sy,PI:Ey}=Math,By=5*Ey,Ty=1.70158,Ry=2.5949095,Cy=7.5625,Oy=2.75;function Py(t){return e=>vy(e,t)}function Ly(t){return e=>1-vy(1-e,t)}function Ay(t){return e=>e<.5?.5*vy(2*e,t):1-.5*vy(2-2*e,t)}function Dy(t){return t<1/Oy?Cy*t*t:t<2/Oy?Cy*(t-=1.5/Oy)*t+.75:t<2.5/Oy?Cy*(t-=2.25/Oy)*t+.9375:Cy*(t-=2.625/Oy)*t+.984375}function My(t,e,i,s){const o={};return n=>{const r=~~(1e4*n),a=o[r];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=Fy(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(xy(l)<1e-6));e++)c-=d/l;return o[r]=Fy(c,e,s)}}function Fy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Iy={get(t){const{list:e}=Iy;return a(t)?e[t||"ease"]:g(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){Iy.list[t]=e},list:{linear:t=>t,ease:My(.25,.1,.25,1),"ease-in":My(.42,0,1,1),"ease-out":My(0,0,.58,1),"ease-in-out":My(.42,0,.58,1),"sine-in":t=>1-my(t*Ey*.5),"sine-out":t=>yy(t*Ey*.5),"sine-in-out":t=>.5*(1-my(t*Ey)),"quad-in":Py(2),"quad-out":Ly(2),"quad-in-out":Ay(2),"cubic-in":Py(3),"cubic-out":Ly(3),"cubic-in-out":Ay(3),"quart-in":Py(4),"quart-out":Ly(4),"quart-in-out":Ay(4),"quint-in":Py(5),"quint-out":Ly(5),"quint-in-out":Ay(5),"expo-in":t=>t?vy(2,10*t-10):0,"expo-out":t=>1===t?1:1-vy(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*vy(2,2*t*10-10):.5*(2-vy(2,10-2*t*10)),"circ-in":t=>1-wy(1-vy(t,2)),"circ-out":t=>wy(1-vy(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-wy(1-vy(2*t,2))):.5*(wy(1-vy(2-2*t,2))+1),"back-in":t=>((Ty+1)*t-Ty)*t*t,"back-out":t=>(t-=1)*t*((Ty+1)*t+Ty)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Ry+1)*t-Ry)*.5:.5*((t=2*t-2)*t*((Ry+1)*t+Ry)+2),"elastic-in":t=>0===t||1===t?t:-vy(2,10*(t-1))*yy((t-1.1)*By),"elastic-out":t=>0===t||1===t?t:vy(2,-10*t)*yy((t-.1)*By)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-vy(2,10*((t*=2)-1))*yy((t-1.1)*By)*.5:vy(2,10*(1-(t*=2)))*yy((t-1.1)*By)*.5+1,"bounce-in":t=>1-Dy(1-t),"bounce-out":Dy,"bounce-in-out":t=>t<.5?.5*(1-Dy(1-2*t)):.5*(1+Dy(2*t-1)),"cubic-bezier":My,steps:function(t,e="floor"){return i=>("floor"===e?ky(i*t):"ceil"===e?by(i*t):Sy(i*t))/t}}};function Wy(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 zy{}zy.CREATED="created",zy.PLAY="play",zy.PAUSE="pause",zy.STOP="stop",zy.SEEK="seek",zy.UPDATE="update",zy.COMPLETED="completed";let Ny=class extends Qr{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:o}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&o&&l(o)&&(t+=o-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),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:o,attrs:n}=this;this.easingFn=Iy.get(o),(n||this.attrsMap)&&(this.attrsMap=n?n.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.requestAnimate():(this.clearTimer(),this.start()),this.emitType(zy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(zy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(zy.STOP))}seek(t){this.destroyed||(g(t)&&(t=Xh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(zy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:o}=i,r=!(o>1)||this.join;let a,h,d,c,u,g=0,_=0;o>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<o;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:o,swing:n,loop:r}=h;n&&(d.swing=l(n)?n:2,u=2*d.swing-1),r&&(d.loop=u=l(r)?r:2),t?(d.duration=t,g+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,_+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,_+=s*u),o&&(d.easingFn=Iy.get(o))}if(!d.autoDuration&&n(d.duration)&&(o>1?s>0||r?_+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,a);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}a=c,e.push(d)}_?((this.duration<=g||!s||!s.duration)&&this.changeDuration(g+.2*_),this.allocateTime((this.duration-g)/_)):g&&this.changeDuration(g),this.emitType(zy.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:o,target:r}=this;for(let a in e)n(s[a])&&(s[a]=o[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=n(i[a])?o[a]:i[a],o[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let o=0;o<s;o++)e=i[o],n(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))}requestAnimate(){this.requestAnimateTime=Date.now(),t.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}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}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?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.requestAnimate()}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(zy.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,o=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(o);else{const{attrsMap:i,target:n}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),Jh.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emitType(zy.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 l(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)}};le([Wy("ease")],Ny.prototype,"easing",void 0),le([Wy(0)],Ny.prototype,"delay",void 0),le([Wy(.2)],Ny.prototype,"duration",void 0),le([Wy("auto")],Ny.prototype,"ending",void 0),le([Wy(!1)],Ny.prototype,"reverse",void 0),le([Wy(!1)],Ny.prototype,"swing",void 0),le([Wy(!1)],Ny.prototype,"loop",void 0),le([Wy(0)],Ny.prototype,"loopDelay",void 0),le([Wy(1)],Ny.prototype,"speed",void 0),le([Wy(!0)],Ny.prototype,"autoplay",void 0),le([Wy()],Ny.prototype,"join",void 0),le([Wy()],Ny.prototype,"attrs",void 0),Ny=le([Xn(la)],Ny);let Yy=class extends Ny{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(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Ny(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(zy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(zy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(zy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(zy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case zy.COMPLETED:this.completed&&this.emitType(t);break;case zy.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)}};Yy=le([Xn(la)],Yy);const Xy={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"},Hy=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Vy=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,jy=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Uy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Gy=parseInt,Ky=parseFloat,{round:qy}=Math;let Zy={},Jy=0;function Qy(t){let e,i,s,o=1;switch(t.length){case 9:e=Gy(t.slice(1,3),16),i=Gy(t.slice(3,5),16),s=Gy(t.slice(5,7),16),o=Gy(t.slice(7,9),16)/255;break;case 7:e=Gy(t.slice(1,3),16),i=Gy(t.slice(3,5),16),s=Gy(t.slice(5,7),16);break;case 5:e=Gy(t[1]+t[1],16),i=Gy(t[2]+t[2],16),s=Gy(t[3]+t[3],16),o=Gy(t[4]+t[4],16)/255;break;case 4:e=Gy(t[1]+t[1],16),i=Gy(t[2]+t[2],16),s=Gy(t[3]+t[3],16);break;case 3:e=i=s=Gy(t[1]+t[2],16);break;case 2:e=i=s=Gy(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const $y=1/6,tv=.5,ev=2/3,iv=1/3;function sv(t,e,i){return i<0?i++:i>1&&i--,i<$y?t+6*(e-t)*i:i<tv?e:i<ev?t+(e-t)*(ev-i)*6:t}function ov(t,e,i,s=1){let o,n,r;if(t/=360,i/=100,0===(e/=100))o=n=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;o=sv(a,s,t+iv),n=sv(a,s,t),r=sv(a,s,t-iv)}return{r:qy(255*o),g:qy(255*n),b:qy(255*r),a:s}}te.add("color"),Yh.object=function(t,e){let i,s=!n(e)&&e<1;if(a(t)){const e=Zy[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Qy(t);break;case"R":case"r":"("===t[4]&&Vy.test(t)?i=function(t){const e=Vy.exec(t);return{r:Gy(e[1]),g:Gy(e[2]),b:Gy(e[3]),a:Ky(e[4])}}(t):"("===t[3]&&Hy.test(t)&&(i=function(t){const e=Hy.exec(t);return{r:Gy(e[1]),g:Gy(e[2]),b:Gy(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Uy.test(t)?i=function(t){const e=Uy.exec(t);return ov(Ky(e[1]),Ky(e[2]),Ky(e[3]),Ky(e[4]))}(t):"("===t[3]&&jy.test(t)&&(i=function(t){const e=jy.exec(t);return ov(Ky(e[1]),Ky(e[2]),Ky(e[3]),1)}(t))}if(!i){const e=Xy[t.toLowerCase()];e&&(i=Qy("#"+e))}i&&(Jy++,Jy>1e4&&(Zy={},Jy=0),Zy[t]=Object.assign({},i))}}else g(t)&&(n(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:nv}=Math,{fourNumber:rv}=L,av={fill:uv,stroke:uv,cornerRadius:(t,e,i)=>l(t)&&l(e)?dv(t,e,i):(t=rv(t),e=rv(e),t.map((t,s)=>dv(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,o=e.length,n=dv(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return l(t)||l(e)?L.float(dv(t,e,i),Math.max(lv(t),lv(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return Jh.setBetweenStyle(o,t,e,o,i,s),o},shadow:gv,innerShadow:gv},hv={value:function(t,e,i){const s=l(t),o=l(e);return s&&o?t+(e-t)*i:o||s?dv(t,e,i):t},number:dv,color:cv,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=Jh;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,o,n)))}};function lv(t){const e=String(t).split(".")[1];return e?e.length:0}function dv(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?nv(o):o}function cv(t,e,i){t=Yh.object(t),e=Yh.object(e);const s=dv(t.r,e.r,i,1)+","+dv(t.g,e.g,i,1)+","+dv(t.b,e.b,i,1),o=dv(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function uv(t,e,i){return a(t)&&a(e)?cv(t,e,i):e}function gv(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:dv((t=t||{}).x,e.x,i),y:dv(t.y,e.y,i),blur:dv(t.blur,e.blur,i),spread:dv(t.spread,e.spread,i),color:cv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}te.add("animate","color"),Zh.canAnimate=!0,Object.assign(Jh.list,av),Object.assign(Jh,hv);const _v=Ml.prototype;Ml.addAttr("animation",void 0,function(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Ml.addAttr("animationOut",void 0,an),Ml.addAttr("transition",!0,an),Ml.addAttr("transitionOut",void 0,an),_v.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))},_v.animate=function(t,e,i,s){if(n(t))return this.__animate;let o=u(t)&&!e&&i?new Yy(this,t,s):new Ny(this,t,e,s);this.killAnimate(i,o.toStyle);const r=this.__animate;return r&&(o instanceof Yy?o.list.unshift(r):o=new Yy(this,[r,o])),this.__animate=o},_v.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Yy&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},_v.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(zy.COMPLETED,e)};const pv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],fv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:mv}=Math,{getDerivative:yv}=ti,vv={getDistance(t,e,i,s,o,n,r,a,h=1){let l,d,c,u,g,_,p=0,f=h/2;for(let h=0;h<pv.length;h++)l=f*(1+pv[h]),d=f*(1-pv[h]),c=yv(l,t,i,o,r),u=yv(l,e,s,n,a),g=yv(d,t,i,o,r),_=yv(d,e,s,n,a),p+=fv[h]*(mv(c*c+u*u)+mv(g*g+_*_));return p*f},getRotation(t,e,i,s,o,n,r,a,h){const l=yv(t,e,s,n,a),d=yv(t,i,o,r,h);return Math.atan2(d,l)/D},getT(t,e,i,s,o,n,r,a,h,l,d=1){let c=0,u=1,g=t/e,_=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>_;)wv(i,s,o,n,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,o,n,r,a,h,l){const d=1-e,c=d*i+e*o,u=d*s+e*n,g=d*o+e*r,_=d*n+e*a,p=d*c+e*g,f=d*u+e*_,m=d*p+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*_+e*(d*a+e*l));t.push(Te.C,c,u,p,f,m,y)}},{getDistance:wv}=vv,{M:xv,L:bv,C:kv,Z:Sv}=Te,Ev={},Bv={},Tv={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case xv:case bv:Tv.transformPoints(t,e,s,1),s+=3;break;case kv:Tv.transformPoints(t,e,s,3),s+=7;break;case Sv:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Ev.x=t[o],Ev.y=t[o+1],G.toOuterPoint(e,Ev),t[o]=Ev.x,t[o+1]=Ev.y},getMotionPathData(t){let e,i,s,o,n=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(o=t[a],o){case xv:case bv:i=t[a+1],s=t[a+2],e=o===bv&&a>0?ot.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case kv:i=t[a+5],s=t[a+6],e=vv.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 Sv:a+=1;default:e=0}r.push(e),n+=e}return{total:n,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:o}=t;e=Xh.number(e,t.total);let n,r,a,h,l,d,c,u,g,_=0,p={},f=0,m=0,y=0,v=0;const w=o.length;for(;f<w;){switch(h=o[f],h){case xv:case bv:if(r=o[f+1],a=o[f+2],n=s[m],_+n>=e||!t.total)return f||(y=r,v=a),Bv.x=y,Bv.y=v,p.x=r,p.y=a,ot.getDistancePoint(Bv,p,e-_,!0),p.rotation=ot.getAngle(Bv,p),p;y=r,v=a,f+=3;break;case kv:if(r=o[f+5],a=o[f+6],n=s[m],_+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],g=vv.getT(e-_,n,y,v,l,d,c,u,r,a,i),ti.getPointAndSet(g,y,v,l,d,c,u,r,a,p),p.rotation=vv.getRotation(g,y,v,l,d,c,u,r,a),p;y=r,v=a,f+=7;break;case Sv:f+=1;default:n=0}m++,_+=n}return p},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=Xh.number(e,t.total);let r,a,h,l,d,c,u,g,_,p=0,f={},m=0,y=0,v=0,w=0;const x=o.length;for(;m<x;){switch(l=o[m],l){case xv:case bv:if(a=o[m+1],h=o[m+2],r=s[y],p+r>=e||!t.total)return m||(v=a,w=h),Bv.x=v,Bv.y=w,f.x=a,f.y=h,ot.getDistancePoint(Bv,f,e-p,!0),n.push(l,f.x,f.y),n;v=a,w=h,m+=3,n.push(l,v,w);break;case kv:if(d=o[m+1],c=o[m+2],u=o[m+3],g=o[m+4],a=o[m+5],h=o[m+6],r=s[y],p+r>=e)return _=vv.getT(e-p,r,v,w,d,c,u,g,a,h,i),vv.cut(n,_,v,w,d,c,u,g,a,h),n;v=a,w=h,m+=7,n.push(l,d,c,u,g,a,h);break;case Sv:m+=1,n.push(l);default:r=0}y++,p+=r}return n}};function Rv(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}te.add("motion-path"),Jh.register("motion",function(t,e,i,s){return g(t)&&(t=Xh.number(t,s.getMotionTotal())),g(e)&&(e=Xh.number(e,s.getMotionTotal())),Jh.number(t||0,e||0,i)}),Jh.register("motionRotation",function(t,e,i){return Jh.number(t,e,i)});const Cv=Ml.prototype,{updateMatrix:Ov,updateAllMatrix:Pv}=ir,{updateBounds:Lv}=_r;function Av(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Mv(t);i.total&&(t.__.__pathForRender=Tv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Pv(t),Lv(t,t)):Ov(t));i&&(t.leafer.created=!0)}}function Dv(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 Mv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Tv.getMotionPathData(t.getPath(!0,!0))}function Fv(t,e){return on(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Zh.setStyleName(this,e,i):Zh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Iv(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Wv(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 zv(t,e){g(e)||(e=void 0),Xv(t,e,"in")}function Nv(t,e){const{normalStyle:i}=t;g(e)||(e=void 0),i&&(e||(e=i),Xv(t,e,"out"))}Ml.addAttr("motionPath",void 0,Rv),Ml.addAttr("motionPrecision",1,Rv),Ml.addAttr("motion",void 0,Rv),Ml.addAttr("motionRotation",!0,Rv),Cv.getMotionPathData=function(){return Mv(Dv(this))},Cv.getMotionPoint=function(t){const e=Dv(this),i=Mv(e);if(!i.total)return{};const s=Tv.getDistancePoint(i,t,e.motionPrecision);G.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:l(o)&&(s.rotation+=o),s},Cv.getMotionTotal=function(){return this.getMotionPathData().total},Cv.__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],r(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Av(t))}else Av(this)};const Yv={};function Xv(t,e,i){const{normalStyle:s}=t;e||(e=Yv),e.scale&&(L.assignScale(e,e.scale),delete e.scale),e!==Yv&&Zh.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&r(i[s])&&r(e[s])&&(s="transition");return r(e[s])?i[s]:e[s]}(i,e,t);const n=o?function(t,e){const i=jv(e,t),s=t.animate();s&&jv(i,t,s.fromStyle);return i}(t,e):void 0;Zh.canAnimate&&Hv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=Hv(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete a.animation}t.normalStyle=Vv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=Vv(n,t);t.set(n,"temp"),t.animate([n,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function Hv(t){let e;const i={},s=Wv(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&Zh.isState(o,t,s)&&(e=Uv(i,n));const r=i.selectedStyle||t.selectedStyle;r&&Zh.isSelected(t,s)&&(e=Uv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Zh.isPlacehold(t,s)&&(e=Uv(i,a)),Zh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Uv(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&Zh.isFocus(t,s)&&(e=Uv(i,o));const n=i.hoverStyle||t.hoverStyle;n&&Zh.isHover(t,s)&&(e=Uv(i,n));const r=i.pressStyle||t.pressStyle;r&&Zh.isPress(t,s)&&(e=Uv(i,r))}return e?i:void 0}function Vv(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&Zh.animateExcludes[t]||(o[t]=e[t]);return o}function jv(t,e,i){return Vv(t,e,i,!0)}function Uv(t,e){return Object.assign(t,e),!0}function Gv(t,e){const i=t[e];i&&zv(t,i),t.button&&qv(t.children,e)}function Kv(t,e,i){i||(i=t.states[e]),zv(t,i),t.button&&qv(t.children,null,e)}function qv(t,e,i){if(!t)return;let s,o;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(o=!0,e){case"hoverStyle":Zh.isHover(s)&&(o=!1);break;case"pressStyle":Zh.isPress(s)&&(o=!1);break;case"focusStyle":Zh.isFocus(s)&&(o=!1)}o&&Gv(s,e)}else n(i)||Kv(s,i);s.isBranch&&qv(s.children,e,i)}}function Zv(t,e){const i=t[e];i&&Nv(t,i),t.button&&Qv(t.children,e)}function Jv(t,e,i){Nv(t,i),t.button&&Qv(t.children,null,e)}function Qv(t,e,i){if(!t)return;let s;for(let o=0,r=t.length;o<r;o++)s=t[o],e?Zv(s,e):n(i)||Jv(s,i),s.isBranch&&Qv(s.children,e,i)}function $v(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=Wv(e,i);n&&(s=o[t](n))}return s}function tw(t,e,i){let s=e[t];if(!s&&i){const o=Wv(e,i);o&&(s=o[t])}return s}te.add("state"),Zh.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},Zh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const o=Wv(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},Zh.isSelected=function(t,e){return tw("selected",t,e)},Zh.isDisabled=function(t,e){return tw("disabled",t,e)},Zh.isFocus=function(t,e){return $v("isFocus",t,e)},Zh.isHover=function(t,e){return $v("isHover",t,e)},Zh.isPress=function(t,e){return $v("isPress",t,e)},Zh.isPlacehold=function(t,e){return t.__.__isPlacehold},Zh.isDrag=function(t,e){return $v("isDrag",t,e)},Zh.setStyleName=function(t,e,i){i?Kv(t,e,t[e]):Jv(t,e,t[e])},Zh.set=function(t,e){const i=t.states[e];i?Kv(t,e,i):Jv(t,e,i)},Zh.getStyle=Hv,Zh.updateStyle=Xv,Zh.updateEventStyle=function(t,e){switch(e){case Fd.ENTER:Gv(t,"hoverStyle");break;case Fd.LEAVE:Zv(t,"hoverStyle");break;case Fd.DOWN:Gv(t,"pressStyle");break;case Fd.UP:Zv(t,"pressStyle")}};const ew=Ml.prototype;Ml.addAttr("selected",!1,Fv,"selectedStyle"),Ml.addAttr("disabled",!1,Fv,"disabledStyle"),Ml.addAttr("states",{},Iv),Ml.addAttr("state","",Fv),Ml.addAttr("normalStyle",void 0,an),Ml.addAttr("hoverStyle",void 0,Iv),Ml.addAttr("pressStyle",void 0,Iv),Ml.addAttr("focusStyle",void 0,Iv),Ml.addAttr("selectedStyle",void 0,Iv),Ml.addAttr("disabledStyle",void 0,Iv),Ml.addAttr("placeholderStyle",void 0,Iv),Ml.addAttr("button",!1,an),ew.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))},ew.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?Gv(this,"focusStyle"):Zv(this,"focusStyle")})},ew.updateState=function(){Zh.updateStyle(this,void 0,"in")};const iw=Rd.prototype,sw="text";tn(iw,sw,Object.assign(Object.assign({},en(iw,sw)),{set(t){const e=this,i=e.text;e.__setAttr(sw,t)&&(pn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class ow extends ol{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let nw=class extends Ml{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}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),!n(t))if(l(t))this.now=t;else if(g(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=Go.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:o,size:n,total:r}=e,{width:a,height:h}=n&&(l(n)?{width:n,height:n}:n)||(r>1?this:t);let d=o?o.x:0,c=o?o.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:h},d+a>=t.width?(d=0,c+=h):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Dr(Dr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:o}=this;o&&(o.FPS&&(i=o.FPS),n(o.loop)||(s=o.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:o}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,o)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};le([An(ow)],nw.prototype,"__",void 0),le([gn()],nw.prototype,"robot",void 0),le([an()],nw.prototype,"actions",void 0),le([an("")],nw.prototype,"action",void 0),le([bn(0)],nw.prototype,"now",void 0),le([an(12)],nw.prototype,"FPS",void 0),le([an(!0)],nw.prototype,"loop",void 0),nw=le([Hn()],nw),te.add("robot");const{Yes:rw,NoAndSkip:aw,YesAndSkip:hw}=s,lw={},dw={},cw={};class uw{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 o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":lw.id=t.substring(1),t=lw;break;case".":dw.className=t.substring(1),t=dw;break;default:cw.tag=t,t=cw}case"object":if(n(t.id)){if(t.tag){const{tag:s}=t,o=u(s);return this.getByMethod(o?this.methods.tags:this.methods.tag,e,i,o?f.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&&ir.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 o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===rw||n===hw){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<aw&&this.eachFind(o.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_(Or.REMOVE,this.__onRemoveChild,this),this.target.on_(Lr.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 gw=Ml.prototype;function _w(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=ee.selector())}gw.find=function(t,e){return _w(this).getBy(t,this,!1,e)},gw.findOne=function(t,e){return _w(this).getBy(t,this,!0,e)},te.add("find"),ee.finder=function(t){return new uw(t)};const{setPoint:pw,addPoint:fw,toBounds:mw}=gt;const yw={syncExport(e,i,s){let o;qh.running=!0;try{const r=zo.fileType(i),a=i.includes(".");s=zo.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===r)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),o={data:!!a||e.toJSON(s.json)};else if("svg"===r)a&&l(h(e.toSVG(),"svg"),i),o={data:!!a||e.toSVG()};else{let r,a,h=1,l=1;const{worldTransform:d,isLeafer:c,leafer:u,isFrame:g}=e,{slice:_,clip:p,trim:f,screenshot:m,padding:y,onCanvas:v}=s,w=n(s.smooth)?!u||u.config.smooth:s.smooth,x=s.contextSettings||(u?u.config.contextSettings:void 0),b=c&&m&&n(s.fill)?e.fill:s.fill,k=zo.isOpaqueImage(i)||b,S=new ct;if(m)r=!0===m?c?u.canvas.bounds:e.worldRenderBounds:m;else{let t=s.relative||(c?"inner":"local");switch(h=d.scaleX,l=d.scaleY,t){case"inner":S.set(d);break;case"local":S.set(d).divide(e.localTransform),h/=e.scaleX,l/=e.scaleY;break;case"world":h=1,l=1;break;case"page":t=u||e;default:S.set(d).divide(e.getTransform(t));const i=t.worldTransform;h/=h/i.scaleX,l/=l/i.scaleY}r=e.getBounds("render",t)}const E={scaleX:1,scaleY:1};L.getScaleData(s.scale,s.size,r,E);let B=s.pixelRatio||1,{x:T,y:R,width:C,height:O}=new Xt(r).scale(E.scaleX,E.scaleY);p&&(T+=p.x,R+=p.y,C=p.width,O=p.height);const P={exporting:!0,matrix:S.scale(1/E.scaleX,1/E.scaleY).invert().translate(-T,-R).withScale(1/h*E.scaleX,1/l*E.scaleY)};let A,D=ee.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:w,contextSettings:x});_&&(A=e,A.__worldOpacity=0,e=u||e,P.bounds=D.bounds),D.save();const M=g&&!n(b),F=e.get("fill");if(M&&(e.fill=""),t.render(e,D,P),M&&(e.fill=F),D.restore(),A&&A.__updateWorldOpacity(),f){a=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?fw(r,o,n):pw(r={},o,n)),a++;const h=new Xt;return r&&(mw(r,h),h.scale(1/t.pixelRatio).ceil()),h}(D);const t=D,{width:e,height:i}=a,s={x:0,y:0,width:e,height:i,pixelRatio:B};D=ee.canvas(s),D.copyWorld(t,a,s),t.destroy()}if(y){const[t,e,i,s]=L.fourNumber(y),o=D,{width:n,height:r}=o;D=ee.canvas({width:n+s+e,height:r+t+i,pixelRatio:B}),D.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:r}),o.destroy()}k&&D.fillWorld(D.bounds,b||"#FFFFFF","destination-over"),v&&v(D);o={data:"canvas"===i?D:D.export(i,s),width:D.pixelWidth,height:D.pixelHeight,renderBounds:r,trimBounds:a};const I=u&&u.app;I&&I.canvasManager&&I.canvasManager.clearRecycled()}}catch(t){o={data:"",error:t}}return qh.running=!1,o},export(e,i,s){return qh.running=!0,function(t){vw||(vw=new Ho);return new Promise(e=>{vw.add(()=>de(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(o=>new Promise(n=>{const r=()=>de(this,void 0,void 0,function*(){if(!jo.isComplete)return t.requestRender(r);const a=qh.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),o(a),n()});e.updateLayout(),ww(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))}};let vw;function ww(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>ww(t))}const xw=Se.prototype,bw=Gt.get("@leafer-in/export");xw.export=function(t,e){const{quality:i,blob:s}=zo.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},xw.toBlob=function(e,i){return new Promise(s=>{t.origin.canvasToBolb(this.view,e,i).then(t=>{s(t)}).catch(t=>{bw.error(t),s(null)})})},xw.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},xw.saveAs=function(e,i){return new Promise(s=>{t.origin.canvasSaveAs(this.view,e,i).then(()=>{s(!0)}).catch(t=>{bw.error(t),s(!1)})})},te.add("export"),Object.assign(qh,yw),Ml.prototype.export=function(t,e){return qh.export(this,t,e)},Ml.prototype.syncExport=function(t,e){return qh.syncExport(this,t,e)},te.add("filter"),Object.assign(Kh,{list:{},register(t,e){Kh.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach(t=>{r=Kh.list[t.type],r&&r.apply(t,e,i,s,o,n)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Kh.list[t.type],e&&(i+=e.getSpread(t))}),i}}),te.add("bright"),Ml.addAttr("bright",!1,kn);export{xt as AlignHelper,Ny as Animate,Iy as AnimateEasing,zy as AnimateEvent,Yy as AnimateList,s as Answer,Pd as App,yt as AroundHelper,Hf as Arrow,Yf as ArrowData,Vt as AutoBounds,ti as BezierHelper,Xt as Bounds,Mr as BoundsEvent,Wt as BoundsHelper,Ul as Box,al as BoxData,ch as Branch,_r as BranchHelper,Ca as BranchRender,kd as Canvas,wl as CanvasData,he as CanvasManager,Or as ChildEvent,Yh as ColorConvert,ee as Creator,dc as Cursor,f as DataHelper,Gt as Debug,pt as Direction4,ft as Direction9,Rl as DragBoundsHelper,zd as DragEvent,$d as Dragger,Yd as DropEvent,sp as EditBox,q_ as EditDataHelper,tp as EditPoint,I_ as EditSelect,A_ as EditSelectHelper,Pp as EditTool,fp as EditToolCreator,Cp as Editor,b_ as EditorEvent,vp as EditorGroupEvent,up as EditorHelper,Sp as EditorMoveEvent,Bp as EditorRotateEvent,Ep as EditorScaleEvent,Tp as EditorSkewEvent,Gh as Effect,Jl as Ellipse,ul as EllipseData,li as EllipseHelper,Cr as Event,re as EventCreator,Qr as Eventer,qh as Export,zo as FileHelper,Kh as Filter,uw as Finder,Xm as Flow,S as FourNumberHelper,Gl as Frame,ll as FrameData,Fl as Group,rl as GroupData,vv as HighBezierHelper,Tv as HighCurveHelper,cc as HitCanvasManager,xd as Image,vl as ImageData,Dr as ImageEvent,Go as ImageManager,e as IncrementId,Op as InnerEditor,yp as InnerEditorEvent,Tc as Interaction,lc as InteractionBase,Gd as InteractionHelper,Ud as KeyEvent,Ad as Keyboard,Hr as LayoutEvent,Oh as Layouter,eh as Leaf,Ba as LeafBounds,dr as LeafBoundsHelper,y as LeafData,ca as LeafDataProxy,la as LeafEventer,ir as LeafHelper,Rr as LeafLayout,gh as LeafLevelList,uh as LeafList,ya as LeafMatrix,Ta as LeafRender,zl as Leafer,ph as LeaferCanvas,Se as LeaferCanvasBase,hl as LeaferData,jr as LeaferEvent,$o as LeaferImage,ff as LeaferTypeCreator,wd as Line,dl as LineData,Ip as LineEditTool,L as MathHelper,ct as Matrix,G as MatrixHelper,Xd as MoveEvent,vf as MultiTouchHelper,Nd as MyDragEvent,bd as MyImage,Id as MyPointerEvent,Ce as NeedConvertToCanvasCommandMap,D as OneRadian,M as PI2,F as PI_2,Vh as Paint,Uh as PaintGradient,jh as PaintImage,Cd as Path,Hh as PathArrow,zm as PathArrowModule,To as PathBounds,fs as PathCommandDataHelper,Te as PathCommandMap,Gi as PathConvert,Do as PathCorner,As as PathCreator,pl as PathData,Ks as PathDrawer,Ee as PathHelper,$f as PathMatrixHelper,Ae as PathNumberCommandLengthMap,Le as PathNumberCommandMap,Jp as PathScaler,Od as Pen,fl as PenData,Dh as Picker,t as Platform,te as Plugin,lt as Point,ot as PointHelper,Dd as PointerButton,Fd as PointerEvent,nd as Polygon,gl as PolygonData,Lr as PropertyEvent,Nl as Rect,cl as RectData,De as RectHelper,Al as RectRender,Vr as RenderEvent,Lh as Renderer,Yr as ResizeEvent,jo as Resource,nw as Robot,ow as RobotData,Hd as RotateEvent,Jt as Run,Nf as ScrollBar,L_ as SelectArea,Mh as Selector,ud as Star,_l as StarData,Zh as State,jt as StringNumberMap,P_ as Stroker,Vd as SwipeEvent,Xo as TaskItem,Ho as TaskProcessor,Rd as Text,Nh as TextConvert,yl as TextData,Rp as TransformTool,Of as Transformer,Jh as Transition,gt as TwoPointBoundsHelper,Ml as UI,kl as UIBounds,se as UICreator,ol as UIData,Md as UIEvent,Pl as UIRender,Xh as UnitConvert,yr as WaitHelper,Xr as WatchEvent,vh as Watcher,Ef as WheelEventHelper,jd as ZoomEvent,gf as addViewport,_f as addViewportConfig,xn as affectRenderBoundsType,yn as affectStrokeBoundsType,Xf as arrowType,nn as attr,dn as autoLayoutType,gn as boundsType,Wo as canvasPatch,ke as canvasSizeAttrs,zh as createAttr,sn as createDescriptor,Ln as cursorType,An as dataProcessor,an as dataType,on as decorateLeafAttr,Mn as defineDataProcessor,tn as defineKey,rn as defineLeafAttr,kn as dimType,pn as doBoundsType,vn as doStrokeType,Fh as effectType,o as emptyData,On as eraserType,Ar as extraPropertyEventMap,W as getBoundsData,en as getDescriptor,z as getMatrixData,I as getPointData,Pn as hitType,u as isArray,_ as isData,p as isEmptyData,h as isFinite,r as isNull,l as isNumber,g as isObject,a as isString,n as isUndefined,Dn as layoutProcessor,Zr as leaferTransformAttrMap,Cn as maskType,Rv as motionPathType,_n as naturalBoundsType,Sn as opacityType,Mo as path,fn as pathInputType,mn as pathType,Fo as pen,hn as positionType,_p as registerEditTool,pp as registerInnerEditor,Hn as registerUI,Vn as registerUIEvent,Ih as resizeType,zn as rewrite,Nn as rewriteAble,un as rotationType,af as scaleResize,hf as scaleResizeFontSize,cf as scaleResizeGroup,lf as scaleResizePath,df as scaleResizePoints,cn as scaleType,ln as scrollType,Rn as sortType,Iv as stateStyleType,Fv as stateType,wn as strokeType,bn as surfaceType,Ht as tempBounds,ut as tempMatrix,dt as tempPoint,c as tryToNumber,yh as useCanvas,Xn as useModule,_h as version,En as visibleType,Wh as zoomLayerType};
1
+ const t={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",getRealURL(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e;var s;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(s||(s={}));const o={};function n(t){return void 0===t}function r(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function g(t){return t&&"object"==typeof t}function _(t){return g(t)&&!u(t)}function p(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(m(e,t),m(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return m(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&m(t[o]={},e[o],i[o]):t[o]=e[o]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{n(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:m}=f;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(!n(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]=n(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(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const 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 o in this)if("_"!==o[0]&&(t=this["_"+o],!n(t))){if("path"===o&&!this.__pathInputed)continue;e=s?s[o]:void 0,i[o]=n(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,f:r}}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}}let v,w,x;const{max:b}=Math,k=[0,0,0,0],S={zero:[...k],tempFour:k,set:(t,e,i,s,o)=>(void 0===i&&(i=s=o=e),t[0]=e,t[1]=i,t[2]=s,t[3]=o,t),setTemp:(t,e,i,s)=>E(k,t,e,i,s),toTempAB(t,e,i){x=i?l(t)?e:t:[],l(t)?(v=T(t),w=e):l(e)?(v=t,w=T(e)):(v=t,w=e),4!==v.length&&(v=B(v)),4!==w.length&&(w=B(w))},get(t,e){let i;if(!l(t))switch(t.length){case 4:i=n(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]),!n(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>l(t)&&l(e)?b(t,e):(R(t,e,i),E(x,b(v[0],w[0]),b(v[1],w[1]),b(v[2],w[2]),b(v[3],w[3]))),add:(t,e,i)=>l(t)&&l(e)?t+e:(R(t,e,i),E(x,v[0]+w[0],v[1]+w[1],v[2]+w[2],v[3]+w[3])),swapAndScale(t,e,i,s){if(l(t))return e===i?t*e:[t*i,t*e];const o=s?t:[],[n,r,a,h]=4===t.length?t:B(t);return E(o,a*i,h*e,n*i,r*e)}},{set:E,get:B,setTemp:T,toTempAB:R}=S,{round:C,pow:O,PI:P}=Math,L={within:(t,e,i)=>(g(e)&&(i=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(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)),L.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=n(e)?1e12:O(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=(l(e)?e:e.width||0)/i.width,o=(l(e)?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&L.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:A,randColor:t=>`rgba(${A(255)},${A(255)},${A(255)},${t||1})`};function A(t){return Math.round(Math.random()*t)}const D=P/180,M=2*P,F=P/2;function I(){return{x:0,y:0}}function W(){return{x:0,y:0,width:0,height:0}}function z(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:Y,cos:N,acos:X,sqrt:H}=Math,{float:V}=L,j={};function U(){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 G={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:U(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:z,getWorld:U,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){K.toInnerPoint(t,e,j),K.scaleOfInner(t,j,i,s)},scaleOfInner(t,e,i,s=i){K.translateInner(t,e.x,e.y),K.scale(t,i,s),K.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=N(e*=D),a=Y(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){K.toInnerPoint(t,e,j),K.rotateOfInner(t,j,i)},rotateOfInner(t,e,i){K.translateInner(t,e.x,e.y),K.rotate(t,i),K.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=D,t.a=s+n*i,t.b=o+r*i),e&&(e*=D,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){K.toInnerPoint(t,e,j),K.skewOfInner(t,j,i,s)},skewOfInner(t,e,i,s=0){K.translateInner(t,e.x,e.y),K.skew(t,i,s),K.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,s,o){const{e:r,f:a}=t;if(i||(i=t),n(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(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){K.multiply(t,K.tempInvert(e))},divideParent(t,e){K.multiplyParent(t,K.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=K;return K.copy(e,t),K.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,s,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(n(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:o}=e,n=i*D,r=N(n),a=Y(n);if(s||o){const e=s*D,i=o*D;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&K.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:l}=t;let d,c,u,g,_,p=h,f=l;if(n||r){const t=o*a-n*r;if(r&&!s){d=H(o*o+n*n),c=t/d;const e=o/d;u=n>0?X(e):-X(e)}else{c=H(r*r+a*a),d=t/c;const e=r/c;u=F-(a>0?X(-e):-X(e))}const e=V(N(u)),i=Y(u);d=V(d),c=V(c),g=e?V((r/c+i)/e/D,9):0,_=e?V((n/d-i)/e/D,9):0,u=V(u/D)}else d=o,c=a,u=g=_=0;return(e=i||e)&&(p+=e.x*o+e.y*r,f+=e.x*n+e.y*a,i||(p-=e.x,f-=e.y)),{x:p,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=H(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){K.set(t)}},K=G,{toInnerPoint:q,toOuterPoint:Z}=G,{sin:J,cos:Q,abs:$,sqrt:tt,atan2:et,min:it,round:st}=Math,ot={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=n(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?st(t.x-.5)+.5:st(t.x),t.y=e?st(t.y-.5)+.5:st(t.y)},move(t,e,i){g(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=nt.defaultPoint);const s=Q(e*=D),o=J(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=nt;return at(i,t),q(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=nt;return at(i,t),Z(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=nt;return at(i,t),nt.toInnerRadiusPointOf(t,e,i),i},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){Z(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)=>rt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=$(i-t),n=$(s-e);return tt(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>it(rt(t,e,i,s),rt(i,s,o,n)),getAngle:(t,e)=>ht(t,e)/D,getRotation:(t,e,i,s)=>(s||(s=e),nt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/D),getRadianFrom(t,e,i,s,o,r,a,h){n(a)&&(a=i,h=s);const l=t-i,d=e-s,c=o-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>et(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const o=ht(t,e);return(e=s?e:{}).x=t.x+Q(o)*i,e.y=t.y+J(o)*i,e},toNumberPoints(t){let e=t;return g(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){nt.reset(t)}},nt=ot,{getDistanceFrom:rt,copy:at,getAtan2:ht}=nt;class lt{constructor(t,e){this.set(t,e)}set(t,e){return g(t)?ot.copy(this,t):ot.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new lt(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,i){return ot.scaleOf(this,t,e,i),this}rotate(t,e){return ot.rotate(this,t,e),this}rotateOf(t,e){return ot.rotate(this,e,t),this}getRotation(t,e,i){return ot.getRotation(this,t,e,i)}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}getCenter(t){return new lt(ot.getCenter(this,t))}getDistance(t){return ot.getDistance(this,t)}getDistancePoint(t,e,i){return new lt(ot.getDistancePoint(this,t,e,i))}getAngle(t){return ot.getAngle(this,t)}getAtan2(t){return ot.getAtan2(this,t)}reset(){return ot.reset(this),this}}const dt=new lt;class ct{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return g(t)?G.copy(this,t):G.set(this,t,e,i,s,o,n),this}setWith(t){return G.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new ct(this)}translate(t,e){return G.translate(this,t,e),this}translateInner(t,e){return G.translateInner(this,t,e),this}scale(t,e){return G.scale(this,t,e),this}scaleWith(t,e){return G.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return G.pixelScale(this,t),this}scaleOfOuter(t,e,i){return G.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return G.scaleOfInner(this,t,e,i),this}rotate(t){return G.rotate(this,t),this}rotateOfOuter(t,e){return G.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return G.rotateOfInner(this,t,e),this}skew(t,e){return G.skew(this,t,e),this}skewOfOuter(t,e,i){return G.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return G.skewOfInner(this,t,e,i),this}multiply(t){return G.multiply(this,t),this}multiplyParent(t){return G.multiplyParent(this,t),this}divide(t){return G.divide(this,t),this}divideParent(t){return G.divideParent(this,t),this}invert(){return G.invert(this),this}invertWith(){return G.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){G.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){G.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return G.setLayout(this,t,e,i),this}getLayout(t,e,i){return G.getLayout(this,t,e,i)}withScale(t,e){return G.withScale(this,t,e)}reset(){G.reset(this)}}const ut=new ct,gt={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,o){_t(t,e,i),_t(t,e+s,i+o)},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:_t}=gt;var pt,ft;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(pt||(pt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(ft||(ft={}));const mt=[{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}];mt.forEach(t=>t.type="percent");const yt={directionData:mt,tempPoint:{},get:vt,toPoint(t,e,i,s,o,n){const r=vt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),yt.toPoint(t,e,i,!0),i)};function vt(t){return a(t)?mt[ft[t]]:t}const{toPoint:wt}=yt,xt={toPoint(t,e,i,s,o,n){wt(t,i,s,o,e,n)}},{tempPointBounds:bt,setPoint:kt,addPoint:St,toBounds:Et}=gt,{toOuterPoint:Bt}=G,{float:Tt,fourNumber:Rt}=L,{floor:Ct,ceil:Ot}=Math;let Pt,Lt,At,Dt;const Mt={},Ft={},It={},Wt={tempBounds:It,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(u(i)){const e=Rt(i);s?zt.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):zt.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),zt.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),zt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Nt(e,t):e=t,i||(i=t),e.offsetX=zt.maxX(i),e.offsetY=zt.maxY(i),zt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ot.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ot.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(zt.copy(It,t),zt.toOuterOf(It,e),It),getOuterOf:(t,e)=>(t=Object.assign({},t),zt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),o>0?(i.height=t.height*o,i.y=e.f+t.y*o):(i.height=t.height*-o,i.y=e.f+t.y*o-i.height)}else Mt.x=t.x,Mt.y=t.y,Bt(e,Mt,Ft),kt(bt,Ft.x,Ft.y),Mt.x=t.x+t.width,Bt(e,Mt,Ft),St(bt,Ft.x,Ft.y),Mt.y=t.y+t.height,Bt(e,Mt,Ft),St(bt,Ft.x,Ft.y),Mt.x=t.x,Bt(e,Mt,Ft),St(bt,Ft.x,Ft.y),Et(bt,i)},toInnerOf(t,e,i){i||(i=t),zt.move(i,-e.e,-e.f),zt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,zt.getFitScale(t,e));return new ct(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,n){n||(n=e),a(s)&&(s=zt.getFitScale(t,e,"cover"===s)),It.width=o?e.width*=s:e.width*s,It.height=o?e.height*=s:e.height*s,xt.toPoint(i,It,t,n,!0,!0)},getSpread(t,e,i){const s={};return zt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){zt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){zt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Ct(t.x),t.y=Ct(t.y),t.width=e>t.x?Ot(t.width+e-t.x):Ot(t.width),t.height=i>t.y?Ot(t.height+i-t.y):Ot(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=Tt(t.x,e),t.y=Tt(t.y,e),t.width=Tt(t.width,e),t.height=Tt(t.height,e)},add(t,e,i){Pt=t.x+t.width,Lt=t.y+t.height,At=e.x,Dt=e.y,i||(At+=e.width,Dt+=e.height),Pt=Pt>At?Pt:At,Lt=Lt>Dt?Lt:Dt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Pt-t.x,t.height=Lt-t.y},addList(t,e){zt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){zt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){zt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r],r):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||Nt(t,o)):Yt(t,o));n&&zt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?kt(bt,t.x,t.y):St(bt,t.x,t.y)),Et(bt,t)},setPoint(t,e){zt.set(t,e.x,e.y)},addPoint(t,e){Yt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ot.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=ot.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=zt.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=zt.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=zt.tempToOuterOf(e,i)),!zt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return Pt=s+n,Lt=o+r,At=t.x+t.width,Dt=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,Pt=Pt<At?Pt:At,Lt=Lt<Dt?Lt:Dt,n=Pt-s,r=Lt-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){zt.copy(t,zt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){zt.set(t)}},zt=Wt,{add:Yt,copy:Nt}=zt;class Xt{get minX(){return Wt.minX(this)}get minY(){return Wt.minY(this)}get maxX(){return Wt.maxX(this)}get maxY(){return Wt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return g(t)?Wt.copy(this,t):Wt.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 Xt(this)}move(t,e){return Wt.move(this,t,e),this}scale(t,e,i){return Wt.scale(this,t,e,i),this}scaleOf(t,e,i){return Wt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Wt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Wt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Wt.getFitMatrix(this,t,e)}put(t,e,i){Wt.put(this,t,e,i)}spread(t,e){return Wt.spread(this,t,e),this}shrink(t,e){return Wt.shrink(this,t,e),this}ceil(){return Wt.ceil(this),this}unsign(){return Wt.unsign(this),this}float(t){return Wt.float(this,t),this}add(t){return Wt.add(this,t),this}addList(t){return Wt.setList(this,t,!0),this}setList(t){return Wt.setList(this,t),this}addListWithFn(t,e){return Wt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Wt.setListWithFn(this,t,e),this}setPoint(t){return Wt.setPoint(this,t),this}setPoints(t){return Wt.setPoints(this,t),this}addPoint(t){return Wt.addPoint(this,t),this}getPoints(){return Wt.getPoints(this)}hitPoint(t,e){return Wt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Wt.hitRadiusPoint(this,t,e)}hit(t,e){return Wt.hit(this,t,e)}includes(t,e){return Wt.includes(this,t,e)}intersect(t,e){return Wt.intersect(this,t,e),this}getIntersect(t,e){return new Xt(Wt.getIntersectData(this,t,e))}isSame(t){return Wt.isSame(this,t)}isEmpty(){return Wt.isEmpty(this)}reset(){Wt.reset(this)}}const Ht=new Xt;class Vt{constructor(t,e,i,s,o,n){g(t)?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Xt(o,e,n||t.width-o-i,r||t.height-e-s)}}const 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},{randColor:Ut}=L;class Gt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Gt(t)}static set filter(t){this.filterList=Kt(t)}static set exclude(t){this.excludeList=Kt(t)}static drawRepaint(t,e){const i=Ut();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Gt.showBounds,o=t.__nowWorld,n=Ut();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(qt.enable){if(qt.filterList.length&&qt.filterList.every(t=>t!==this.name))return;if(qt.excludeList.length&&qt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){qt.enable&&this.warn(...t)}warn(...t){qt.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 Kt(t){return t?a(t)&&(t=[t]):t=[],t}Gt.filterList=[],Gt.excludeList=[],Gt.showWarn=!0;const qt=Gt,Zt=Gt.get("RunTime"),Jt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return Qt.currentId=Qt.idMap[s]=i?performance.now():Date.now(),Qt.currentName=Qt.nameMap[s]=t,Qt.nameToIdMap[t]=s,s},end(t,e){const i=Qt.idMap[t],s=Qt.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;Qt.idMap[t]=Qt.nameMap[t]=Qt.nameToIdMap[s]=void 0,Zt.log(s,o,"ms")},endOfName(t,e){const i=Qt.nameToIdMap[t];n(i)||Qt.end(i,e)}},Qt=Jt,$t=[],te={list:{},add(t,...e){this.list[t]=!0,$t.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(()=>$t.forEach(t=>te.has(t,!0)));const ee={editor:t=>te.need("editor")},ie=Gt.get("UICreator"),se={list:{},register(t){const{__tag:e}=t.prototype;oe[e]&&ie.repeat(e),oe[e]=t},get(t,e,i,s,o,r){oe[t]||ie.error("not register "+t);const a=new oe[t](e);return n(i)||(a.x=i,s&&(a.y=s),o&&(a.width=o),r&&(a.height=r)),a}},{list:oe}=se,ne=Gt.get("EventCreator"),re={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(ae[e]&&ne.repeat(e),ae[e]=t)})},changeName(t,e){const i=ae[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ae[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ae[t](...e)},{nameList:ae}=re;class he{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ee.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 le(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function de(t,e,i,s){return new(i||(i=Promise))(function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function ce(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ue=[];function ge(){return(t,e)=>{ue.push(e)}}const _e=[];let pe=class{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||_e)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ue.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){g(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};le([ce("imageSmoothingEnabled")],pe.prototype,"smooth",void 0),le([ce("imageSmoothingQuality")],pe.prototype,"smoothLevel",void 0),le([ce("globalAlpha")],pe.prototype,"opacity",void 0),le([ce()],pe.prototype,"fillStyle",void 0),le([ce()],pe.prototype,"strokeStyle",void 0),le([ce("lineWidth")],pe.prototype,"strokeWidth",void 0),le([ce("lineCap")],pe.prototype,"strokeCap",void 0),le([ce("lineJoin")],pe.prototype,"strokeJoin",void 0),le([ce("lineDashOffset")],pe.prototype,"dashOffset",void 0),le([ce()],pe.prototype,"miterLimit",void 0),le([ce()],pe.prototype,"shadowBlur",void 0),le([ce()],pe.prototype,"shadowColor",void 0),le([ce()],pe.prototype,"shadowOffsetX",void 0),le([ce()],pe.prototype,"shadowOffsetY",void 0),le([ce()],pe.prototype,"filter",void 0),le([ce()],pe.prototype,"font",void 0),le([ce()],pe.prototype,"fontKerning",void 0),le([ce()],pe.prototype,"fontStretch",void 0),le([ce()],pe.prototype,"fontVariantCaps",void 0),le([ce()],pe.prototype,"textAlign",void 0),le([ce()],pe.prototype,"textBaseline",void 0),le([ce()],pe.prototype,"textRendering",void 0),le([ce()],pe.prototype,"wordSpacing",void 0),le([ce()],pe.prototype,"letterSpacing",void 0),le([ce()],pe.prototype,"direction",void 0),le([ge()],pe.prototype,"setTransform",null),le([ge()],pe.prototype,"resetTransform",null),le([ge()],pe.prototype,"getTransform",null),le([ge()],pe.prototype,"save",null),le([ge()],pe.prototype,"restore",null),le([ge()],pe.prototype,"translate",null),le([ge()],pe.prototype,"scale",null),le([ge()],pe.prototype,"rotate",null),le([ge()],pe.prototype,"fill",null),le([ge()],pe.prototype,"stroke",null),le([ge()],pe.prototype,"clip",null),le([ge()],pe.prototype,"fillRect",null),le([ge()],pe.prototype,"strokeRect",null),le([ge()],pe.prototype,"clearRect",null),le([ge()],pe.prototype,"beginPath",null),le([ge()],pe.prototype,"moveTo",null),le([ge()],pe.prototype,"lineTo",null),le([ge()],pe.prototype,"bezierCurveTo",null),le([ge()],pe.prototype,"quadraticCurveTo",null),le([ge()],pe.prototype,"closePath",null),le([ge()],pe.prototype,"arc",null),le([ge()],pe.prototype,"arcTo",null),le([ge()],pe.prototype,"ellipse",null),le([ge()],pe.prototype,"rect",null),le([ge()],pe.prototype,"roundRect",null),le([ge()],pe.prototype,"createConicGradient",null),le([ge()],pe.prototype,"createLinearGradient",null),le([ge()],pe.prototype,"createPattern",null),le([ge()],pe.prototype,"createRadialGradient",null),le([ge()],pe.prototype,"fillText",null),le([ge()],pe.prototype,"measureText",null),le([ge()],pe.prototype,"strokeText",null);const{copy:fe,multiplyParent:me,pixelScale:ye}=G,{round:ve}=Math,we=new Xt,xe=new Xt,be={width:1,height:1,pixelRatio:1},ke=["width","height","pixelRatio"];class Se 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(i,s){super(),this.size={},this.worldTransform={},i||(i=be),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:o,height:n,pixelRatio:r}=i;this.autoLayout=!o||!n,this.size.pixelRatio=r||t.devicePixelRatio,this.config=i,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;f.copyAttrs(s,t,ke),ke.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Xt(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,o=this.worldTransform;e&&me(t,e,o),ye(t,i,o),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(o.e=ve(o.e-.5)+.5,o.f=ve(o.f-.5)+.5):(o.e=ve(o.e),o.f=ve(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.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:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),n(e.dashPattern)||(o=e.dashPattern),n(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=o,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:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,o=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,o),i?(this.setTempPixelBounds2(i,o),i=xe):i=we,this.drawImage(t.view,we.x,we.y,we.width,we.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,o=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Wt.tempToOuterOf(i,e),s,o),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,o),this.drawImage(t.view,we.x,we.y,we.width,we.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,o,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(we.x,we.y,we.width,we.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,we.x,we.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(we.x,we.y,we.width,we.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(we.x,we.y,we.width,we.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(we.x,we.y,we.width,we.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(we.x,we.y,we.width,we.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(we,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(xe,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,o=this.manager?this.manager.get(i):ee.canvas(Object.assign({},i));return o.save(),t&&(fe(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}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 Ee={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Be={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Te=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},Be),Re={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},Ce={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},Oe=Object.assign(Object.assign({},Ce),Be),Pe=Te,Le={};for(let t in Pe)Le[Pe[t]]=t;const Ae={};for(let t in Pe)Ae[Pe[t]]=Re[t];const De={drawRoundRect(t,e,i,s,o,n){const r=L.fourNumber(n,Math.min(s/2,o/2)),a=e+s,h=i+o;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Me,cos:Fe,hypot:Ie,atan2:We,ceil:ze,abs:Ye,PI:Ne,sqrt:Xe,pow:He}=Math,{setPoint:Ve,addPoint:je}=gt,{set:Ue,toNumberPoints:Ge}=ot,{M:Ke,L:qe,C:Ze,Q:Je,Z:Qe}=Te,$e={},ti={points(t,e,i,s){let o=Ge(e);if(t.push(Ke,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,g,_,p,f,m=o.length;const y=!0===i?.5:i;s&&(o=[o[m-2],o[m-1],...o,o[0],o[1],o[2],o[3]],m=o.length);for(let i=2;i<m-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],_=Xe(He(r-e,2)+He(a-n,2)),p=Xe(He(h-r,2)+He(l-a,2)),(_||p)&&(f=_+p,_=y*_/f,p=y*p/f,h-=e,l-=n,d=r-_*h,c=a-_*l,2===i?s||t.push(Je,d,c,r,a):t.push(Ze,u,g,d,c,r,a),u=r+p*h,g=a+p*l);s||t.push(Je,u,g,o[m-2],o[m-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(qe,o[e],o[e+1]);s&&t.push(Qe)},rect(t,e,i,s,o){Ee.creator.path=t,Ee.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){Ee.creator.path=[],De.drawRoundRect(Ee.creator,e,i,s,o,n),t.push(...Ee.convertToCanvasData(Ee.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,l,d){const c=s-e,u=o-i,g=n-s,_=r-o;let p=We(u,c),f=We(_,g);const m=Ie(c,u),y=Ie(g,_);let v=f-p;if(v<0&&(v+=M),m<1e-12||y<1e-12||v<1e-12||Ye(v-Ne)<1e-12)return t&&t.push(qe,s,o),h&&(Ve(h,e,i),je(h,s,o)),d&&Ue(d,e,i),void(l&&Ue(l,s,o));const w=c*_-g*u<0,x=w?-1:1,b=a/Fe(v/2),k=s+b*Fe(p+v/2+F*x),S=o+b*Me(p+v/2+F*x);return p-=F*x,f-=F*x,si(t,k,S,a,a,0,p/D,f/D,w,h,l,d)},arc:(t,e,i,s,o,n,r,a,h,l)=>si(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,l,d,c){const u=n*D,g=Me(u),_=Fe(u);let p=r*D,f=a*D;p>Ne&&(p-=M),f<0&&(f+=M);let m=f-p;m<0?m+=M:m>M&&(m-=M),h&&(m-=M);const y=ze(Ye(m/F)),v=m/y,w=Me(v/4),x=8/3*w*w/Me(v/2);f=p+v;let b,k,S,E,B,T,R,C,O=Fe(p),P=Me(p),L=S=_*s*O-g*o*P,A=E=g*s*O+_*o*P,I=e+S,W=i+E;t&&t.push(t.length?qe:Ke,I,W),l&&Ve(l,I,W),c&&Ue(c,I,W);for(let n=0;n<y;n++)b=Fe(f),k=Me(f),S=_*s*b-g*o*k,E=g*s*b+_*o*k,B=e+L-x*(_*s*P+g*o*O),T=i+A-x*(g*s*P-_*o*O),R=e+S+x*(_*s*k+g*o*b),C=i+E+x*(g*s*k-_*o*b),t&&t.push(Ze,B,T,R,C,e+S,i+E),l&&ii(e+L,i+A,B,T,R,C,e+S,i+E,l,!0),L=S,A=E,O=b,P=k,p=f,f+=v;d&&Ue(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(Ze,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){ii(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,g,_,p,f,m,y,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-g/u,0<_&&_<1&&d.push(_)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(p=(-u+y)/(2*c),0<p&&p<1&&d.push(p),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?je(h,t,e):Ve(h,t,e),je(h,r,a);for(let l=0,c=d.length;l<c;l++)ei(d[l],t,e,i,s,o,n,r,a,$e),je(h,$e.x,$e.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,_=t*t*t;l.x=c*e+u*s+g*n+_*a,l.y=c*i+u*o+g*r+_*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return ei(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:ei,toTwoPointBounds:ii,ellipse:si}=ti,{sin:oi,cos:ni,sqrt:ri,atan2:ai}=Math,{ellipse:hi}=ti,li={ellipticalArc(e,i,s,o,n,r,a,h,l,d,c){const u=(l-i)/2,g=(d-s)/2,_=r*D,p=oi(_),f=ni(_),m=-f*u-p*g,y=-f*g+p*u,v=o*o,w=n*n,x=y*y,b=m*m,k=v*w-v*x-w*b;let S=0;if(k<0){const t=ri(1-k/(v*w));o*=t,n*=t}else S=(a===h?-1:1)*ri(k/(v*x+w*b));const E=S*o*y/n,B=-S*n*m/o,T=ai((y-B)/n,(m-E)/o),R=ai((-y-B)/n,(-m-E)/o);let C=R-T;0===h&&C>0?C-=M:1===h&&C<0&&(C+=M);const O=i+u+f*E-p*B,P=s+g+p*E+f*B,L=C<0?1:0;c||t.ellipseToCurve?hi(e,O,P,o,n,r,T/D,R/D,L):o!==n||r?e.push(Te.G,O,P,o,n,r,T/D,R/D,L):e.push(Te.O,O,P,o,T/D,R/D,L)}},{M:di,m:ci,L:ui,l:gi,H:_i,h:pi,V:fi,v:mi,C:yi,c:vi,S:wi,s:xi,Q:bi,q:ki,T:Si,t:Ei,A:Bi,a:Ti,Z:Ri,z:Ci,N:Oi,D:Pi,X:Li,G:Ai,F:Di,O:Mi,P:Fi,U:Ii}=Te,{rect:Wi,roundRect:zi,arcTo:Yi,arc:Ni,ellipse:Xi,quadraticCurveTo:Hi}=ti,{ellipticalArc:Vi}=li,ji=Gt.get("PathConvert"),Ui={},Gi={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,a="";for(;n<r;){s=t[n],i=Ae[s],a+=s===o?" ":Le[s];for(let s=1;s<i;s++)a+=L.float(t[n+s],e),s===i-1||(a+=" ");o=s,n+=i}return a},parse(t,e){let i,s,o,n="";const r=[],a=e?Oe:Ce;for(let e=0,h=t.length;e<h;e++)s=t[e],jt[s]?("."===s&&(Ki.dot&&(qi(r,n),n=""),Ki.dot++),"0"===n&&"."!==s&&(qi(r,n),n=""),n+=s):Te[s]?(n&&(qi(r,n),n=""),Ki.name=Te[s],Ki.length=Re[s],Ki.index=0,qi(r,Ki.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&qi(r,n),n=s):n&&(qi(r,n),n=""),o=s;return n&&qi(r,n),i?Gi.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(o=t[c],o){case ci:t[c+1]+=a,t[c+2]+=h;case di:a=t[c+1],h=t[c+2],g.push(di,a,h),c+=3;break;case pi:t[c+1]+=a;case _i:a=t[c+1],g.push(ui,a,h),c+=2;break;case mi:t[c+1]+=h;case fi:h=t[c+1],g.push(ui,a,h),c+=2;break;case gi:t[c+1]+=a,t[c+2]+=h;case ui:a=t[c+1],h=t[c+2],g.push(ui,a,h),c+=3;break;case xi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=wi;case wi:r=n===yi||n===wi,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(yi,l,d,i,s,a,h),c+=5;break;case vi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,o=yi;case yi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(yi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ei:t[c+1]+=a,t[c+2]+=h,o=Si;case Si:r=n===bi||n===Si,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Hi(g,a,h,i,s,t[c+1],t[c+2]):g.push(bi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ki:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=bi;case bi:i=t[c+1],s=t[c+2],e?Hi(g,a,h,i,s,t[c+3],t[c+4]):g.push(bi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ti:t[c+6]+=a,t[c+7]+=h;case Bi:Vi(g,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 Ci:case Ri:g.push(Ri),c++;break;case Oi:a=t[c+1],h=t[c+2],e?Wi(g,a,h,t[c+3],t[c+4]):Zi(g,t,c,5),c+=5;break;case Pi:a=t[c+1],h=t[c+2],e?zi(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Zi(g,t,c,9),c+=9;break;case Li:a=t[c+1],h=t[c+2],e?zi(g,a,h,t[c+3],t[c+4],t[c+5]):Zi(g,t,c,6),c+=6;break;case Ai:Xi(e?g:Zi(g,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,Ui),a=Ui.x,h=Ui.y,c+=9;break;case Di:e?Xi(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Zi(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Mi:Ni(e?g:Zi(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ui),a=Ui.x,h=Ui.y,c+=7;break;case Fi:e?Ni(g,t[c+1],t[c+2],t[c+3],0,360,!1):Zi(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ii:Yi(e?g:Zi(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ui),a=Ui.x,h=Ui.y,c+=6;break;default:return ji.error(`command: ${o} [index:${c}]`,t),g}n=o}return g},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(di,t.x,t.y);break;case"L":e.push(ui,t.x,t.y);break;case"C":e.push(yi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(bi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ri)}}),e},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){Ki.index===Ki.length&&(Ki.index=1,t.push(Ki.name)),t.push(Number(e)),Ki.index++,Ki.dot=0}},{current:Ki,pushData:qi,copyData:Zi}=Gi,{M:Ji,L:Qi,C:$i,Q:ts,Z:es,N:is,D:ss,X:os,G:ns,F:rs,O:as,P:hs,U:ls}=Te,{getMinDistanceFrom:ds,getRadianFrom:cs}=ot,{tan:us,min:gs,abs:_s}=Math,ps={},fs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ji,e,i)},lineTo(t,e,i){t.push(Qi,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push($i,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(ts,e,i,s,o)},closePath(t){t.push(es)},rect(t,e,i,s,o){t.push(is,e,i,s,o)},roundRect(t,e,i,s,o,n){if(l(n))t.push(os,e,i,s,o,n);else{const r=L.fourNumber(n);r?t.push(ss,e,i,s,o,...r):t.push(is,e,i,s,o)}},ellipse(t,e,i,s,o,n,a,h,l){r(n)?t.push(rs,e,i,s,o):(r(a)&&(a=0),r(h)&&(h=360),t.push(ns,e,i,s,o,n,a,h,l?1:0))},arc(t,e,i,s,o,n,a){r(o)?t.push(hs,e,i,s):(r(n)&&(n=360),t.push(as,e,i,s,o,n,a?1:0))},arcTo(t,e,i,s,o,r,a,h){if(!n(a)){const t=ds(a,h,e,i,s,o);r=gs(r,gs(t/2,t/2*_s(us(cs(a,h,e,i,s,o)/2))))}t.push(ls,e,i,s,o,r)},drawEllipse(t,e,i,s,o,n,a,h,l){ti.ellipse(null,e,i,s,o,r(n)?0:n,r(a)?0:a,r(h)?360:h,l,null,null,ps),t.push(Ji,ps.x,ps.y),ms(t,e,i,s,o,n,a,h,l)},drawArc(t,e,i,s,o,n,a){ti.arc(null,e,i,s,r(o)?0:o,r(n)?360:n,a,null,null,ps),t.push(Ji,ps.x,ps.y),ys(t,e,i,s,o,n,a)},drawPoints(t,e,i,s){ti.points(t,e,i,s)}},{ellipse:ms,arc:ys}=fs,{moveTo:vs,lineTo:ws,quadraticCurveTo:xs,bezierCurveTo:bs,closePath:ks,beginPath:Ss,rect:Es,roundRect:Bs,ellipse:Ts,arc:Rs,arcTo:Cs,drawEllipse:Os,drawArc:Ps,drawPoints:Ls}=fs;class As{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Ee.parse(t):t:[],this}beginPath(){return Ss(this.__path),this.paint(),this}moveTo(t,e){return vs(this.__path,t,e),this.paint(),this}lineTo(t,e){return ws(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return bs(this.__path,t,e,i,s,o,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return xs(this.__path,t,e,i,s),this.paint(),this}closePath(){return ks(this.__path),this.paint(),this}rect(t,e,i,s){return Es(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return Bs(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return Ts(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return Rs(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return Cs(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return Os(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return Ps(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return Ls(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ds,L:Ms,C:Fs,Q:Is,Z:Ws,N:zs,D:Ys,X:Ns,G:Xs,F:Hs,O:Vs,P:js,U:Us}=Te,Gs=Gt.get("PathDrawer"),Ks={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case Ds:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ms:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Fs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Is:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ws:t.closePath(),s+=1;break;case zs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ys: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 Ns:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*D,e[s+6]*D,e[s+7]*D,e[s+8]),s+=9;break;case Hs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,M,!1),s+=5;break;case Vs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*D,e[s+5]*D,e[s+6]),s+=7;break;case js:t.arc(e[s+1],e[s+2],e[s+3],0,M,!1),s+=4;break;case Us:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Gs.error(`command: ${i} [index:${s}]`,e)}}},{M:qs,L:Zs,C:Js,Q:Qs,Z:$s,N:to,D:eo,X:io,G:so,F:oo,O:no,P:ro,U:ao}=Te,{toTwoPointBounds:ho,toTwoPointBoundsByQuadraticCurve:lo,arcTo:co,arc:uo,ellipse:go}=ti,{addPointBounds:_o,copy:po,addPoint:fo,setPoint:mo,addBounds:yo,toBounds:vo}=gt,wo=Gt.get("PathBounds");let xo,bo,ko;const So={},Eo={},Bo={},To={toBounds(t,e){To.toTwoPointBounds(t,Eo),vo(Eo,e)},toTwoPointBounds(t,e){if(!t||!t.length)return mo(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===$s||r===Js||r===Qs?mo(e,h,l):mo(e,t[a+1],t[a+2])),r){case qs:case Zs:h=t[a+1],l=t[a+2],fo(e,h,l),a+=3;break;case Js:o=t[a+5],n=t[a+6],ho(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,So),_o(e,So),h=o,l=n,a+=7;break;case Qs:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],lo(h,l,i,s,o,n,So),_o(e,So),h=o,l=n,a+=5;break;case $s:a+=1;break;case to:h=t[a+1],l=t[a+2],yo(e,h,l,t[a+3],t[a+4]),a+=5;break;case eo:case io:h=t[a+1],l=t[a+2],yo(e,h,l,t[a+3],t[a+4]),a+=r===eo?9:6;break;case so:go(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],So,Bo),0===a?po(e,So):_o(e,So),h=Bo.x,l=Bo.y,a+=9;break;case oo:h=t[a+1],l=t[a+2],bo=t[a+3],ko=t[a+4],yo(e,h-bo,l-ko,2*bo,2*ko),h+=bo,a+=5;break;case no:uo(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],So,Bo),0===a?po(e,So):_o(e,So),h=Bo.x,l=Bo.y,a+=7;break;case ro:h=t[a+1],l=t[a+2],xo=t[a+3],yo(e,h-xo,l-xo,2*xo,2*xo),h+=xo,a+=4;break;case ao:co(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],So,Bo),0===a?po(e,So):_o(e,So),h=Bo.x,l=Bo.y,a+=6;break;default:return void wo.error(`command: ${r} [index:${a}]`,t)}}},{M:Ro,L:Co,Z:Oo}=Te,{getCenterX:Po,getCenterY:Lo}=ot,{arcTo:Ao}=fs,Do={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,_=0;const p=t.length,f=[];for(;r<p;){switch(s=t[r],s){case Ro:l=g=t[r+1],d=_=t[r+2],r+=3,t[r]===Co?(c=t[r+1],u=t[r+2],f.push(Ro,Po(l,c),Lo(d,u))):f.push(Ro,l,d);break;case Co:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Co:Ao(f,a,h,t[r+1],t[r+2],e,g,_);break;case Oo:Ao(f,a,h,l,d,e,g,_);break;default:f.push(Co,a,h)}g=a,_=h;break;case Oo:o!==Oo&&(Ao(f,l,d,c,u,e,g,_),f.push(Oo)),r+=1;break;default:n=Ae[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==Oo&&(f[1]=l,f[2]=d),f}};function Mo(t){return new As(t)}const Fo=Mo();Ee.creator=Mo(),Ee.parse=Gi.parse,Ee.convertToCanvasData=Gi.toCanvasData;const{drawRoundRect:Io}=De;function Wo(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){Io(this,t,e,i,s,o)})}(t)}const zo={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Yo.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{}}}},Yo=zo;Yo.alphaPixelTypes.forEach(t=>Yo.upperCaseTypeMap[t]=t.toUpperCase());const No=Gt.get("TaskProcessor");class Xo{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return de(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){No.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Ho{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&&f.assign(this.config,t),this.empty()}add(t,e){let i,s,o,r;const a=new Xo(t);return a.parent=this,l(e)?r=e:e&&(s=e.parallel,i=e.start,o=e.time,r=e.delay),o&&(a.time=o),!1===s&&(a.parallel=!1),n(r)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},r)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)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 Vo=Gt.get("Resource"),jo={tasker:new Ho,map:{},get isComplete(){return Uo.tasker.isComplete},set(t,e){Uo.map[t]&&Vo.repeat(t),Uo.map[t]=e},get:t=>Uo.map[t],remove(t){const e=Uo.map[t];e&&(e.destroy&&e.destroy(),delete Uo.map[t])},loadImage(t,e){return new Promise((i,s)=>{const o=this.setImage(t,t,e);o.load(()=>i(o),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ee.image(s)),Uo.set(t,e),e},destroy(){Uo.map={}}},Uo=jo,Go={maxRecycled:10,recycledList:[],patternTasker:new Ho,get(t){let e=jo.get(t.url);return e||jo.set(t.url,e=ee.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Ko.recycledList.push(t)})},clearRecycled(){const t=Ko.recycledList;t.length>Ko.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&jo.remove(t.url)),t.length=0)},hasAlphaPixel:t=>zo.alphaPixelTypes.some(e=>Ko.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:"+zo.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+zo.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Ko.recycledList=[]}},Ko=Go,{IMAGE:qo,create:Zo}=e,{floor:Jo,max:Qo}=Math;class $o{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Zo(qo),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Go.isFormat("svg",t)&&(this.isSVG=!0),Go.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),jo.tasker.add(()=>de(this,void 0,void 0,function*(){return yield e(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}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(e,i,s,o,n,r,a){if(e||(e=this.width),i||(i=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=t.origin.createCanvas(Qo(Jo(e+(n||0)),1),Qo(Jo(i+(r||0)),1)),l=h.getContext("2d");return s&&(l.globalAlpha=s),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(e,i,s,o){const n=t.canvas.createPattern(e,i);try{s&&n.setTransform&&(n.setTransform(s),s=void 0)}catch(t){}return o&&f.stintSet(o,"transform",s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function tn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function en(t,e){return Object.getOwnPropertyDescriptor(t,e)}function sn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function on(t,e){return(i,s)=>rn(i,s,t,e&&e(s))}function nn(t){return t}function rn(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};tn(t,e,Object.assign(o,s||{})),Mn(t,e,i)}function an(t){return on(t)}function hn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function ln(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function dn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),pn(this))}}))}function cn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function un(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function gn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&pn(this)}}))}function _n(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(pn(this),this.__.__removeNaturalSize())}}))}function pn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function fn(t){return on(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),pn(this)}}))}const mn=gn;function yn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i)&&(vn(this),e&&(this.__.__useStroke=!0))}}))}function vn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&pn(t)}const wn=yn;function xn(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function bn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function kn(t){return on(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;f.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Sn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Bn(this)}}))}function En(t){return on(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Tn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Tn(this,t,e,i),this.mask&&Bn(this)}}))}function Bn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Tn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||pn(t))}function Rn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Cn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function On(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Pn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Gt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Ln(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function An(t){return(e,i)=>{tn(e,"__DataProcessor",{get:()=>t})}}function Dn(t){return(e,i)=>{tn(e,"__LayoutProcessor",{get:()=>t})}}function Mn(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=sn(e,i);if(n(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(g(i)){const t=p(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];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[o];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=en(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),tn(s,e,a)}const Fn=new Gt("rewrite"),In=[],Wn=["destroy","constructor"];function zn(t){return(e,i)=>{In.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Yn(){return t=>{Nn()}}function Nn(t){In.length&&(In.forEach(e=>{t&&Fn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),In.length=0)}function Xn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Wn.includes(s)||e&&e.includes(s)))if(t.prototype){en(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Hn(){return t=>{se.register(t)}}function Vn(){return t=>{re.register(t)}}setTimeout(()=>Nn(!0));const{copy:jn,toInnerPoint:Un,toOuterPoint:Gn,scaleOfOuter:Kn,rotateOfOuter:qn,skewOfOuter:Zn,multiplyParent:Jn,divideParent:Qn,getLayout:$n}=G,tr={},{round:er}=Math,ir={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),nr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)or(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++)rr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&rr(t),t.__updateChange()},updateAllChange(t){if(hr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ar(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,i,s,o,n,r){o||(o=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?i.copyWorldByReset(s,o,e.__nowWorld,n,r):i.copyWorldToInner(s,o,e.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,o){const n=g(e)?Object.assign({},e):{x:e,y:i};s?Gn(t.localTransform,n,n,!0):t.parent&&Un(t.parent.scrollWorldTransform,n,n,!0),sr.moveLocal(t,n.x,n.y,o)},moveLocal(t,e,i=0,s){g(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=er(e),i=er(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){sr.zoomOfLocal(t,lr(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const r=t.__localMatrix;if(l(s)||(s&&(n=s),s=i),jn(tr,r),Kn(tr,e,i,s),sr.hasHighPosition(t))sr.setTransform(t,tr,o,n);else{const e=t.x+tr.e-r.e,a=t.y+tr.f-r.f;n&&!o?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){sr.rotateOfLocal(t,lr(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;jn(tr,o),qn(tr,e,i),sr.hasHighPosition(t)?sr.setTransform(t,tr,!1,s):t.set({x:t.x+tr.e-o.e,y:t.y+tr.f-o.f,rotation:L.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){sr.skewOfLocal(t,lr(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){jn(tr,t.__localMatrix),Zn(tr,e,i,s),sr.setTransform(t,tr,o,n)},transformWorld(t,e,i,s){jn(tr,t.worldTransform),Jn(tr,e),t.parent&&Qn(tr,t.parent.scrollWorldTransform),sr.setTransform(t,tr,i,s)},transform(t,e,i,s){jn(tr,t.localTransform),Jn(tr,e),sr.setTransform(t,tr,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&sr.getInnerOrigin(t,o.origin),r=$n(e,n,o.around&&sr.getInnerOrigin(t,o.around));if(sr.hasOffset(t)&&(r.x-=o.offsetX,r.y-=o.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){Wt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=sr.getInnerOrigin(t,o.origin);ot.move(r,n.x-s.x,n.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Kn(i,sr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ot.tempToOuterOf(sr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return yt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(jn(tr,t.worldTransform),Qn(tr,e.scrollWorldTransform),i?tr:Object.assign({},tr)),drop(t,e,i,s){t.setTransform(sr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||sr.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)e.move(i);else{const o=i.x*s,n=i.y*s;i.x-=o,i.y-=n,e.move(o,n),t.requestRender(()=>sr.animateMove(e,i,s))}}},sr=ir,{updateAllMatrix:or,updateMatrix:nr,updateAllWorldOpacity:rr,updateAllChange:ar,updateChange:hr}=sr;function lr(t,e){return t.updateLayout(),t.parent?ot.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const dr={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)=>ur(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>ur(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>ur(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 cr;function ur(t,e){return e||(cr=0),t.__.mask&&(cr=1),cr<0?null:(cr&&(cr=-1),!0)}const{updateBounds:gr}=ir,_r={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,o=i.length;s<o;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),pr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&n(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++)fr(e[t],e)},updateBounds(t,e){const i=[t];fr(t,i),mr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let o=t.length-1;o>-1;o--){i=t[o],s=i.children;for(let t=0,e=s.length;t<e;t++)gr(s[t]);e&&e===i||gr(i)}}},{pushAllChildBranch:pr,pushAllBranchStack:fr,updateBoundsByBranchStack:mr}=_r,yr={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:vr,updateBounds:wr}=ir,{toOuterOf:xr,getPoints:br,copy:kr}=Wt,Sr="_localContentBounds",Er="_worldContentBounds",Br="_worldBoxBounds",Tr="_worldStrokeBounds";class Rr{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 xr(this.contentBounds,this.leaf.__localMatrix,this[Sr]||(this[Sr]={})),this[Sr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return xr(this.contentBounds,this.leaf.__world,this[Er]||(this[Er]={})),this[Er]}get worldBoxBounds(){return xr(this.boxBounds,this.leaf.__world,this[Br]||(this[Br]={})),this[Br]}get worldStrokeBounds(){return xr(this.strokeBounds,this.leaf.__world,this[Tr]||(this[Tr]={})),this[Tr]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:i}=e;if(e.isApp)return wr(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return G.defaultMatrix;case"page":t=e.zoomLayer;default:return vr(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 Xt(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 o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=G.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=vr(s,e,!0)}if(r||(r=G.getLayout(n)),kr(r,a),ot.copy(r,o),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=br(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return n(o)||s.forEach(t=>i.innerToWorld(t,null,!1,o)),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 Cr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class Or extends Cr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Or.ADD="child.add",Or.REMOVE="child.remove",Or.CREATED="created",Or.MOUNTED="mounted",Or.UNMOUNTED="unmounted",Or.DESTROY="destroy";const Pr="property.scroll";class Lr extends Cr{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}Lr.CHANGE="property.change",Lr.LEAFER_CHANGE="property.leafer_change",Lr.SCROLL=Pr;const Ar={scrollX:Pr,scrollY:Pr};class Dr extends Cr{constructor(t,e){super(t),Object.assign(this,e)}}Dr.LOAD="image.load",Dr.LOADED="image.loaded",Dr.ERROR="image.error";class Mr extends Cr{static checkHas(t,e,i){"on"===i?e===zr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Fr)||t.hasEvent(Ir)||t.hasEvent(Wr),t.__hasWorldEvent=t.hasEvent(zr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Fr,t),"inner"===e&&t.emit(Ir,t)),t.emit(Wr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(zr,this)}}Mr.RESIZE="bounds.resize",Mr.INNER="bounds.inner",Mr.LOCAL="bounds.local",Mr.WORLD="bounds.world";const{RESIZE:Fr,INNER:Ir,LOCAL:Wr,WORLD:zr}=Mr,Yr={};[Fr,Ir,Wr,zr].forEach(t=>Yr[t]=1);class Nr extends Cr{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){g(t)?(super(Nr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Nr.RESIZE="resize";class Xr extends Cr{constructor(t,e){super(t),this.data=e}}Xr.REQUEST="watch.request",Xr.DATA="watch.data";class Hr extends Cr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Hr.REQUEST="layout.request",Hr.START="layout.start",Hr.BEFORE="layout.before",Hr.LAYOUT="layout",Hr.AFTER="layout.after",Hr.AGAIN="layout.again",Hr.END="layout.end";class Vr extends Cr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Vr.REQUEST="render.request",Vr.CHILD_START="render.child_start",Vr.CHILD_END="render.child_end",Vr.START="render.start",Vr.BEFORE="render.before",Vr.RENDER="render",Vr.AFTER="render.after",Vr.AGAIN="render.again",Vr.END="render.end",Vr.NEXT="render.next";class jr extends Cr{}jr.START="leafer.start",jr.BEFORE_READY="leafer.before_ready",jr.READY="leafer.ready",jr.AFTER_READY="leafer.after_ready",jr.VIEW_READY="leafer.view_ready",jr.VIEW_COMPLETED="leafer.view_completed",jr.STOP="leafer.stop",jr.RESTART="leafer.restart",jr.END="leafer.end",jr.UPDATE_MODE="leafer.update_mode",jr.TRANSFORM="leafer.transform",jr.MOVE="leafer.move",jr.SCALE="leafer.scale",jr.ROTATE="leafer.rotate",jr.SKEW="leafer.skew";const{MOVE:Ur,SCALE:Gr,ROTATE:Kr,SKEW:qr}=jr,Zr={x:Ur,y:Ur,scaleX:Gr,scaleY:Gr,rotation:Kr,skewX:qr,skewY:qr},Jr={};class Qr{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,o,n;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const r=$r(this,s,!0),h=a(t)?t.split(" "):t,l=o?{listener:e,once:o}:{listener:e};h.forEach(t=>{t&&(n=r[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):r[t]=[l],Yr[t]&&Mr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=$r(this,t);s.forEach(t=>{t&&(o=r[t],o&&(n=o.findIndex(t=>t.listener===e),n>-1&&o.splice(n,1),o.length||delete r[t],Yr[t]&&Mr.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]));g(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&re.has(t)&&(e=re.get(t,{type:t,target:this,current:this}));const s=$r(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,o=i&&i[t],r=s&&s[t];return!!(n(e)?o||r:e?r:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function $r(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Jr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Jr)}}const{on:ta,on_:ea,off:ia,off_:sa,once:oa,emit:na,emitEvent:ra,hasEvent:aa,destroy:ha}=Qr.prototype,la={on:ta,on_:ea,off:ia,off_:sa,once:oa,emit:na,emitEvent:ra,hasEvent:aa,destroyEventer:ha},da=Gt.get("setAttr"),ca={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||n(e)||(da.warn(this.innerName,t,e),e=void 0),g(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Lr(Lr.LEAFER_CHANGE,this,t,s,e));const i=Zr[t];i&&(this.emitEvent(new jr(i,this)),this.emitEvent(new jr(jr.TRANSFORM,this)))}this.emitPropertyEvent(Lr.CHANGE,t,s,e);const i=Ar[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const o=new Lr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(o),this.leafer.emitEvent(o)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||n(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ua,multiplyParent:ga,translateInner:_a,defaultWorld:pa}=G,{toPoint:fa,tempPoint:ma}=yt,ya={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:o}=this;ga(this.__local||e,t?t.__scrollWorld||t.__world:pa,i,!!e.affectScaleOrRotation,o),s&&_a(Object.assign(s,i),o.scrollX,o.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)&&(ua(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)&&(fa(i.around||i.origin,t.boxBounds,ma),_a(e,-ma.x,-ma.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:va,updateAllMatrix:wa}=ir,{updateBounds:xa}=_r,{toOuterOf:ba,copyAndSpread:ka,copy:Sa}=Wt,{toBounds:Ea}=To,Ba={__updateWorldBounds(){const t=this.__layout;ba(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Mr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Mr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ba(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ba(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ba(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Ea(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(),wa(this),xa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(wa(this),xa(this,this))):va(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;ka(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;l(i)&&i<=0?Sa(e.renderBounds,e.strokeBounds):ka(e.renderBounds,e.boxBounds,i)}},Ta={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ir.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Gt.showBounds&&Gt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ra}=dr,Ca={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Ra(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Ra(i[s],e)||i[s].__clip(t,e)}}},Oa={},{LEAF:Pa,create:La}=e,{stintSet:Aa}=f,{toInnerPoint:Da,toOuterPoint:Ma,multiplyParent:Fa}=G,{toOuterOf:Ia}=Wt,{copy:Wa,move:za}=ot,{moveLocal:Ya,zoomOfLocal:Na,rotateOfLocal:Xa,skewOfLocal:Ha,moveWorld:Va,zoomOfWorld:ja,rotateOfWorld:Ua,skewOfWorld:Ga,transform:Ka,transformWorld:qa,setTransform:Za,getFlipTransform:Ja,getLocalOrigin:Qa,getRelativeWorld:$a,drop:th}=ir;let eh=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 Rr}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=La(Pa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Or.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(Or.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Or.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(Or.MOUNTED)):this.__emitLifeEvent(Or.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){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Fa(i,t.matrix,e,void 0,i),Ia(this.__layout.renderBounds,e,e),Aa(e,"half",i.half),Aa(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Go.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Oa.scaleX=i,Oa.scaleY=s,Oa}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?$a(this,e):this.worldTransform,o=i?t:{};return Ia(t,s,o),o}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Wa(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Wa(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Da(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ma(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return za(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return za(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}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 o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Za(this,t,e,i)}transform(t,e,i){Ka(this,t,e,i)}move(t,e,i){Ya(this,t,e,i)}moveInner(t,e,i){Va(this,t,e,!0,i)}scaleOf(t,e,i,s,o){Na(this,Qa(this,t),e,i,s,o)}rotateOf(t,e,i){Xa(this,Qa(this,t),e,i)}skewOf(t,e,i,s,o){Ha(this,Qa(this,t),e,i,s,o)}transformWorld(t,e,i){qa(this,t,e,i)}moveWorld(t,e,i){Va(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){ja(this,t,e,i,s,o)}rotateOfWorld(t,e){Ua(this,t,e)}skewOfWorld(t,e,i,s,o){Ga(this,t,e,i,s,o)}flip(t,e){Ka(this,Ja(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return te.need("path")}getMotionPoint(t){return te.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){th(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Mn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=gn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Or(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Or.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};eh=le([Xn(ca),Xn(ya),Xn(Ba),Xn(la),Xn(Ta)],eh);const{setListWithFn:ih}=Wt,{sort:sh}=_r,{localBoxBounds:oh,localStrokeBounds:nh,localRenderBounds:rh,maskLocalBoxBounds:ah,maskLocalStrokeBounds:hh,maskLocalRenderBounds:lh}=dr,dh=new Gt("Branch");let ch=class extends eh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){ih(e||this.__layout.boxBounds,this.children,this.__hasMask?ah:oh)}__updateStrokeBounds(t){ih(t||this.__layout.strokeBounds,this.children,this.__hasMask?hh:nh)}__updateRenderBounds(t){ih(t||this.__layout.renderBounds,this.children,this.__hasMask?lh:rh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(sh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return dh.warn("add self or destroyed");const i=n(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=se.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Or.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Or.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):n(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const 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(Or.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Or.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Or(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};ch=le([Xn(Ca)],ch);class uh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:i}=this;n(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(n(i[t.innerId])){const{list:s}=this;for(let t=e,o=s.length;t<o;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,o=e.length;s<o;s++)n(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;n(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new uh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class gh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const _h="1.9.10";class ph extends Se{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?(a(i)?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:s,pixelRatio:o}=this.config,n={width:i||e.width,height:s||e.height,pixelRatio:o};this.resize(n),this.context&&(this.viewSelect&&(t.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,l(o)?[o]:o)}),Wo(this.context.__proto__))}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(e){this.viewSelect&&t.miniapp.getBounds(this.viewSelect).then(t=>{this.clientBounds=t,e&&e()})}startAutoLayout(e,i){this.resizeListener||(this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};f.copyAttrs(e,this,ke),this.resize(t),n(this.width)||this.resizeListener(new Nr(t,e))}}const{mineType:fh,fileType:mh}=zo;function yh(e,i){t.origin={createCanvas:(t,e,s)=>{const o={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(o):i.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(fh(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,s)=>{let o=e.toDataURL(fh(mh(i)),s);return o=o.substring(o.indexOf("64,")+3),t.origin.download(o,i)},download:(e,s)=>new Promise((o,n)=>{let r;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,r=!0);const a=i.getFileSystemManager();a.writeFile({filePath:s,data:e,encoding:"base64",success(){r?t.miniapp.saveToAlbum(s).then(()=>{a.unlink({filePath:s}),o()}):o()},fail(t){n(t)}})}),loadImage:e=>new Promise((i,s)=>{const o=t.canvas.view.createImage();o.onload=()=>{i(o)},o.onerror=t=>{s(t)},o.src=t.image.getRealURL(e)}),noRepeat:"repeat-x"},t.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(e=>{i.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})}),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.event={stopDefault(t){},stopNow(t){},stop(t){}},t.canvas=ee.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(ee,{canvas:(t,e)=>new ph(t,e),image:t=>new $o(t)}),t.name="miniapp",t.requestRender=function(e){const{view:i}=t.renderCanvas||t.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},tn(t,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class vh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new uh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new uh,this.target=t,e&&(this.config=f.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(Vr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Or.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 Xr(Xr.DATA,{updatedList:this.updatedList})),this.__updatedList=new uh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Lr.CHANGE,this.__onAttrChange,this],[[Or.ADD,Or.REMOVE],this.__onChildEvent,this],[Xr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:wh,updateBounds:xh,updateChange:bh}=ir,{pushAllChildBranch:kh,pushAllParent:Sh}=_r;const{worldBounds:Eh}=dr;class Bh{constructor(t){this.updatedBounds=new Xt,this.beforeBounds=new Xt,this.afterBounds=new Xt,u(t)&&(t=new uh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Eh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Eh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Th,updateAllChange:Rh}=ir,Ch=Gt.get("Layouter");class Oh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new gh,this.target=t,e&&(this.config=f.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(Hr.START),this.layoutOnce(),t.emitEvent(new Hr(Hr.END,this.layoutedBlocks,this.times))}catch(t){Ch.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ch.warn("layouting"):this.times>3?Ch.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Xr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=Jt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=Hr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Hr(o,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(wh(t,!0),e.add(t),t.isBranch&&kh(t,e),Sh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Sh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||xh(s[t])}xh(i)}})}(this.__levelList),function(t){t.list.forEach(bh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Hr(n,a,this.times)),i.emitEvent(new Hr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Jt.end(e)}fullLayout(){const t=Jt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=Hr,n=this.getBlocks(new uh(e));e.emitEvent(new Hr(i,n,this.times)),Oh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Hr(s,n,this.times)),e.emitEvent(new Hr(o,n,this.times)),this.addBlocks(n),Jt.end(t)}static fullLayout(t){Th(t,!0),t.isBranch?_r.updateBounds(t):ir.updateBounds(t),Rh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Bh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Bh(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_([[Hr.REQUEST,this.layout,this],[Hr.AGAIN,this.layoutAgain,this],[Xr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ph=Gt.get("Renderer");class Lh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Hr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Vr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Vr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Vr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Xt,Ph.log(e.innerName,"---\x3e");try{this.emitRender(Vr.START),this.renderOnce(t),this.emitRender(Vr.END,this.totalBounds),Go.clearRecycled()}catch(t){this.rendering=!1,Ph.error(t)}Ph.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ph.warn("rendering");if(this.times>3)return Ph.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Xt,this.renderOptions={},t)this.emitRender(Vr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Vr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Vr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Vr.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=Jt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),o=new Xt(s);i.save(),s.spread(Lh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,o),i.restore(),Jt.end(e)}fullRender(){const t=Jt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Jt.end(t)}__render(e,i){const{canvas:s}=this,o=e.includes(this.target.__world),n=o?{includes:o}:{bounds:e,includes:o};this.needFill&&s.fillWorld(e,this.config.fill),Gt.showRepaint&&Gt.drawRepaint(s,e),t.render(this.target,s,n),this.renderBounds=i=i||e,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Xt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const i=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&e>s)return t.requestRender(i);const{frames:o}=this;o.length>30&&o.shift(),o.push(e),this.FPS=Math.round(o.reduce((t,e)=>t+e,0)/o.length),this.requestTime=0,this.checkRender()};t.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Xt(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 Xt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ph.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Vr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Vr.REQUEST,this.update,this],[Hr.END,this.__onLayoutEnd,this],[Vr.AGAIN,this.renderAgain,this],[Nr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Lh.clipSpread=10;const{hitRadiusPoint:Ah}=Wt;class Dh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new uh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o,!!i.findList),h=o?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const o=this.findList=new uh;if(t.length){let e;const{x:s,y:n}=this.point,r={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||ir.worldHittable(e))&&(this.hitChild(e,r),o.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ir.hasParent(t,e))){o.reset();break}return o.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),o.length)return o.list[0];return s?null:i?t[0]:t.find(t=>ir.worldHittable(t))}getPath(t){const e=new uh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new uh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new uh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)i=t[n],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Ah(i.__world,o),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)):s&&this.hitChild(i,o))}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,o=[];const{children:n}=s;for(let s=0,r=n.length;s<r;s++)if(i=n[s],i.__.mask&&o.push(i),i===t){if(o&&!o.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Mh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new Dh(this.target=t,this),this.finder=ee.finder&&ee.finder()}getByPoint(e,i,s){const{target:o,picker:n}=this;return t.backgrounder&&o&&o.updateLayout(),n.getByPoint(e,i,s)}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):te.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Fh(t){return on(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ih(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Wh(){return(t,e)=>{const i="_"+e;tn(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}})}}function zh(t){return(e,i)=>{tn(e,i,sn(i,t))}}Object.assign(ee,{watcher:(t,e)=>new vh(t,e),layouter:(t,e)=>new Oh(t,e),renderer:(t,e,i)=>new Lh(t,e,i),selector:(t,e)=>new Mh(t,e)}),t.layout=Oh.fullLayout,t.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new uh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Yh={},Nh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Xh={number:(t,e)=>g(t)?"percent"===t.type?t.value*e:t.value:t},Hh={},Vh={},jh={},Uh={},Gh={},Kh={apply(){te.need("filter")}},qh={},Zh={setStyleName:()=>te.need("state"),set:()=>te.need("state")},Jh={list:{},register(t,e){Jh.list[t]=e},get:t=>Jh.list[t]},{parse:Qh,objectToCanvasData:$h}=Gi,{stintSet:tl}=f,{hasTransparent:el}=Nh,il={},sl=Gt.get("UIData");class ol 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!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,sl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,sl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(tl(this,"__isTransparentFill",el(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):g(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(tl(this,"__isTransparentStroke",el(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):g(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&g(t[0])?(this.__setInput("path",t),this._path=e?Qh(t):$h(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){nl(this,"shadow",t)}setInnerShadow(t){nl(this,"innerShadow",t)}setFilter(t){nl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Vh.compute("fill",this.__leaf),e&&Vh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),n(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=il)):(this.__isStrokes=!0,this._stroke||(this._stroke=il))}__removePaint(t,e){e&&this.__removeInput(t),jh.recycleImage(t,this),"fill"===t?(tl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(tl(this,"__isAlphaPixelStroke",void 0),tl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function nl(t,e,i){t.__setInput(e,i),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 rl extends ol{}class al extends rl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class hl extends rl{__getInputData(t,e){const i=super.__getInputData(t,e);return ke.forEach(t=>delete i[t]),i}}class ll extends al{}class dl extends ol{get __usePathBox(){return this.points||this.__pathInputed}}class cl extends ol{get __boxStroke(){return!this.__pathInputed}}class ul extends ol{get __boxStroke(){return!this.__pathInputed}}class gl extends dl{}class _l extends ol{}class pl extends ol{get __pathInputed(){return 2}}class fl extends rl{}const ml={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class yl extends ol{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=ml[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=se.get("Rect",0);const o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class vl extends cl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class wl extends cl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:xl,add:bl}=S,kl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=xl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Gh.getShadowRenderSpread(this,e)),s&&(t=xl(t,s)),n&&(t=bl(t,Kh.getSpread(n))),r&&(t=bl(t,r)),a&&(t=bl(t,a));let l=t;return i&&(l=xl(l,Gh.getInnerShadowSpread(this,i))),o&&(l=xl(l,o)),this.__layout.renderShapeSpread=l,h?xl(h.__updateRenderSpread(),t):t}},{stintSet:Sl}=f,El={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Sl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Sl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Sl(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Gh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),Sl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Bl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:n,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Vh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Gh.shadow(this,t,h),a&&(s.__isStrokes?Vh.strokes(n,this,t):Vh.stroke(n,this,t)),o&&(s.__isFills?Vh.fills(o,this,t):Vh.fill(o,this,t)),r&&this.__drawAfterFill(t,e),d&&Gh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?Vh.strokes(n,this,t):Vh.stroke(n,this,t)),c&&Kh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Vh.strokes(n,this,t):Vh.stroke(n,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Nh.string(e.color))}o&&(s.__isFills?Vh.fills(o,this,t):Vh.fill(o,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?Vh.strokes(n,this,t):Vh.stroke(n,this,t))}}else s.__pathInputed?Bl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Vh.fills(s,this,t):Vh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Vh.strokes(o,this,t):Vh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Bl(t,e,i){const{fill:s,stroke:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Vh.stroke(o,t,e),s&&Vh.fill(s,t,e),n&&t.__drawAfterFill(e,i),o&&!r&&Vh.stroke(o,t,e)}const Tl={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+h)}}}};var Rl;let Cl=Rl=class extends eh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){L.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 Fo.set(this.path=t||[]),t||this.__drawPathByBox(Fo),Fo}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return te.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return te.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Fo.set(i=[]),this.__drawPathByBox(Fo)),t?Gi.toCanvasData(i,!0):i}getPathString(t,e,i){return Gi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||qh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Do.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Hh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Ks.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,l(n)?[n]:n)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Vh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),te.need("animate")}killAnimate(t,e){}export(t,e){return te.need("export")}syncExport(t,e){return te.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),Rl.one(e)}static one(t,e,i,s,o){return se.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){Hn()(this)}static registerData(t){An(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};le([An(ol)],Cl.prototype,"__",void 0),le([Wh()],Cl.prototype,"zoomLayer",void 0),le([an("")],Cl.prototype,"id",void 0),le([an("")],Cl.prototype,"name",void 0),le([an("")],Cl.prototype,"className",void 0),le([bn("pass-through")],Cl.prototype,"blendMode",void 0),le([Sn(1)],Cl.prototype,"opacity",void 0),le([En(!0)],Cl.prototype,"visible",void 0),le([bn(!1)],Cl.prototype,"locked",void 0),le([kn(!1)],Cl.prototype,"dim",void 0),le([kn(!1)],Cl.prototype,"dimskip",void 0),le([Rn(0)],Cl.prototype,"zIndex",void 0),le([Cn(!1)],Cl.prototype,"mask",void 0),le([On(!1)],Cl.prototype,"eraser",void 0),le([hn(0,!0)],Cl.prototype,"x",void 0),le([hn(0,!0)],Cl.prototype,"y",void 0),le([gn(100,!0)],Cl.prototype,"width",void 0),le([gn(100,!0)],Cl.prototype,"height",void 0),le([cn(1,!0)],Cl.prototype,"scaleX",void 0),le([cn(1,!0)],Cl.prototype,"scaleY",void 0),le([un(0,!0)],Cl.prototype,"rotation",void 0),le([un(0,!0)],Cl.prototype,"skewX",void 0),le([un(0,!0)],Cl.prototype,"skewY",void 0),le([hn(0,!0)],Cl.prototype,"offsetX",void 0),le([hn(0,!0)],Cl.prototype,"offsetY",void 0),le([ln(0,!0)],Cl.prototype,"scrollX",void 0),le([ln(0,!0)],Cl.prototype,"scrollY",void 0),le([dn()],Cl.prototype,"origin",void 0),le([dn()],Cl.prototype,"around",void 0),le([an(!1)],Cl.prototype,"lazy",void 0),le([_n(1)],Cl.prototype,"pixelRatio",void 0),le([xn(0)],Cl.prototype,"renderSpread",void 0),le([fn()],Cl.prototype,"path",void 0),le([mn()],Cl.prototype,"windingRule",void 0),le([mn(!0)],Cl.prototype,"closed",void 0),le([gn(0)],Cl.prototype,"padding",void 0),le([gn(!1)],Cl.prototype,"lockRatio",void 0),le([gn()],Cl.prototype,"widthRange",void 0),le([gn()],Cl.prototype,"heightRange",void 0),le([an(!1)],Cl.prototype,"draggable",void 0),le([an()],Cl.prototype,"dragBounds",void 0),le([an("auto")],Cl.prototype,"dragBoundsType",void 0),le([an(!1)],Cl.prototype,"editable",void 0),le([Pn(!0)],Cl.prototype,"hittable",void 0),le([Pn("path")],Cl.prototype,"hitFill",void 0),le([wn("path")],Cl.prototype,"hitStroke",void 0),le([Pn(!1)],Cl.prototype,"hitBox",void 0),le([Pn(!0)],Cl.prototype,"hitChildren",void 0),le([Pn(!0)],Cl.prototype,"hitSelf",void 0),le([Pn()],Cl.prototype,"hitRadius",void 0),le([Ln("")],Cl.prototype,"cursor",void 0),le([bn()],Cl.prototype,"fill",void 0),le([wn(void 0,!0)],Cl.prototype,"stroke",void 0),le([wn("inside")],Cl.prototype,"strokeAlign",void 0),le([wn(1,!0)],Cl.prototype,"strokeWidth",void 0),le([wn(!1)],Cl.prototype,"strokeWidthFixed",void 0),le([wn("none")],Cl.prototype,"strokeCap",void 0),le([wn("miter")],Cl.prototype,"strokeJoin",void 0),le([wn()],Cl.prototype,"dashPattern",void 0),le([wn(0)],Cl.prototype,"dashOffset",void 0),le([wn(10)],Cl.prototype,"miterLimit",void 0),le([mn(0)],Cl.prototype,"cornerRadius",void 0),le([mn()],Cl.prototype,"cornerSmoothing",void 0),le([Fh()],Cl.prototype,"shadow",void 0),le([Fh()],Cl.prototype,"innerShadow",void 0),le([Fh()],Cl.prototype,"blur",void 0),le([Fh()],Cl.prototype,"backgroundBlur",void 0),le([Fh()],Cl.prototype,"grayscale",void 0),le([Fh()],Cl.prototype,"filter",void 0),le([bn()],Cl.prototype,"placeholderColor",void 0),le([an(100)],Cl.prototype,"placeholderDelay",void 0),le([an({})],Cl.prototype,"data",void 0),le([zn(eh.prototype.reset)],Cl.prototype,"reset",null),Cl=Rl=le([Xn(kl),Xn(El),Yn()],Cl);let Ol=class extends Cl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Pl;le([An(rl)],Ol.prototype,"__",void 0),le([gn(0)],Ol.prototype,"width",void 0),le([gn(0)],Ol.prototype,"height",void 0),Ol=le([Xn(ch),Hn()],Ol);const Ll=Gt.get("Leafer");let Al=Pl=class extends Ol{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&jo.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Pl.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,f.assign(s,t));const o=this.canvas=ee.canvas(s);this.__controllers.push(this.renderer=ee.renderer(this,o,s),this.watcher=ee.watcher(this,s),this.layouter=ee.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=ee.selector(this),this.interaction=ee.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ee.hitCanvasManager()),this.canvasManager=new he,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),yr.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(jr.RESTART):this.emitLeafer(jr.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(jr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,ke);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Xt(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=f.copyAttrs({},this.canvas,ke);e.resize(t),this.updateLazyBounds(),this.__onResize(new Nr(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,ke),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Vt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ke.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(jr.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ke.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=f.copyAttrs({},s,ke);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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(jr.BEFORE_READY),this.emitLeafer(jr.READY),this.emitLeafer(jr.AFTER_READY),yr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(jr.VIEW_READY),yr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){yr.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(jr.VIEW_COMPLETED),yr.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 te.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 jr(t,this))}__listenEvents(){const t=Jt.start("FirstCreate "+this.innerName);this.once([[jr.START,()=>Jt.end(t)],[Hr.START,this.updateLazyBounds,this],[Vr.START,this.__onCreated,this],[Vr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Xr.DATA,this.__onWatchData,this],[Hr.END,this.__onLayoutEnd,this],[Vr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Pl.list.remove(this);try{this.stop(),this.emitLeafer(jr.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Go.clearRecycled()},100)}catch(t){Ll.error(t)}}};t?e():setTimeout(e)}};Al.list=new uh,le([An(hl)],Al.prototype,"__",void 0),le([gn()],Al.prototype,"pixelRatio",void 0),le([an("normal")],Al.prototype,"mode",void 0),Al=Pl=le([Hn()],Al);let Dl=class extends Cl{get __tag(){return"Rect"}};le([An(cl)],Dl.prototype,"__",void 0),Dl=le([Xn(Tl),Yn(),Hn()],Dl);const{add:Ml,includes:Fl,scroll:Il}=Wt,Wl=Dl.prototype,zl=Ol.prototype;let Yl=class extends Ol{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:o,boxBounds:n}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r.includes("scroll"))&&(Ml(a,n),Il(a,i)),this.__updateRectRenderBounds(),t=!Fl(n,a),t&&"show"===r&&Ml(o,a)}else this.__updateRectRenderBounds();f.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))}};le([An(al)],Yl.prototype,"__",void 0),le([gn(100)],Yl.prototype,"width",void 0),le([gn(100)],Yl.prototype,"height",void 0),le([an(!1)],Yl.prototype,"resizeChildren",void 0),le([xn("show")],Yl.prototype,"overflow",void 0),le([zn(Wl.__updateStrokeSpread)],Yl.prototype,"__updateStrokeSpread",null),le([zn(Wl.__updateRenderSpread)],Yl.prototype,"__updateRectRenderSpread",null),le([zn(Wl.__updateBoxBounds)],Yl.prototype,"__updateRectBoxBounds",null),le([zn(Wl.__updateStrokeBounds)],Yl.prototype,"__updateStrokeBounds",null),le([zn(Wl.__updateRenderBounds)],Yl.prototype,"__updateRectRenderBounds",null),le([zn(Wl.__updateChange)],Yl.prototype,"__updateRectChange",null),le([zn(Wl.__render)],Yl.prototype,"__renderRect",null),le([zn(zl.__render)],Yl.prototype,"__renderGroup",null),Yl=le([Yn(),Hn()],Yl);let Nl=class extends Yl{get __tag(){return"Frame"}get isFrame(){return!0}};le([An(ll)],Nl.prototype,"__",void 0),le([bn("#FFFFFF")],Nl.prototype,"fill",void 0),le([xn("hide")],Nl.prototype,"overflow",void 0),Nl=le([Hn()],Nl);const{moveTo:Xl,closePath:Hl,ellipse:Vl}=fs;let jl=class extends Cl{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:o,endAngle:n}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(o||n?(s<1&&Vl(h,r,a,r*s,a*s,0,o,n,!1),Vl(h,r,a,r,a,0,n,o,!0),s<1&&Hl(h)):(s<1&&(Vl(h,r,a,r*s,a*s),Xl(h,e,a)),Vl(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||n?(Xl(h,r,a),Vl(h,r,a,r,a,0,o,n,!1),Hl(h)):Vl(h,r,a,r,a)}};le([An(ul)],jl.prototype,"__",void 0),le([mn(0)],jl.prototype,"innerRadius",void 0),le([mn(0)],jl.prototype,"startAngle",void 0),le([mn(0)],jl.prototype,"endAngle",void 0),jl=le([Hn()],jl);const{sin:Ul,cos:Gl,PI:Kl}=Math,{moveTo:ql,lineTo:Zl,closePath:Jl,drawPoints:Ql}=fs;let $l=class extends Cl{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:o}=t,n=i/2,r=s/2;ql(e,n,0);for(let t=1;t<o;t++)Zl(e,n+n*Ul(2*t*Kl/o),r-r*Gl(2*t*Kl/o));Jl(e)}}};le([An(gl)],$l.prototype,"__",void 0),le([mn(3)],$l.prototype,"sides",void 0),le([mn()],$l.prototype,"points",void 0),le([mn(0)],$l.prototype,"curve",void 0),$l=le([Yn(),Hn()],$l);const{sin:td,cos:ed,PI:id}=Math,{moveTo:sd,lineTo:od,closePath:nd}=fs;let rd=class extends Cl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,n=e/2,r=this.__.path=[];sd(r,o,0);for(let t=1;t<2*i;t++)od(r,o+(t%2==0?o:o*s)*td(t*id/i),n-(t%2==0?n:n*s)*ed(t*id/i));nd(r)}};le([An(_l)],rd.prototype,"__",void 0),le([mn(5)],rd.prototype,"corners",void 0),le([mn(.382)],rd.prototype,"innerRadius",void 0),rd=le([Hn()],rd);const{moveTo:ad,lineTo:hd,drawPoints:ld}=fs,{rotate:dd,getAngle:cd,getDistance:ud,defaultPoint:gd}=ot;let _d=class extends Cl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&dd(i,e),i}set toPoint(t){this.width=ud(gd,t),this.rotation=cd(gd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ld(e,t.points,t.curve,t.closed):(ad(e,0,0),hd(e,this.width,0))}};le([An(dl)],_d.prototype,"__",void 0),le([yn("center")],_d.prototype,"strokeAlign",void 0),le([gn(0)],_d.prototype,"height",void 0),le([mn()],_d.prototype,"points",void 0),le([mn(0)],_d.prototype,"curve",void 0),le([mn(!1)],_d.prototype,"closed",void 0),_d=le([Hn()],_d);let pd=class extends Dl{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}};le([An(vl)],pd.prototype,"__",void 0),le([gn("")],pd.prototype,"url",void 0),pd=le([Hn()],pd);const fd=pd;let md=class extends Dl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ee.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new $o({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Dr(Dr.LOADED,{image:t}))})}draw(t,e,i,s){const o=new ct(t.worldTransform).invert(),n=new ct;e&&n.translate(e.x,e.y),i&&(l(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.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()}};le([An(wl)],md.prototype,"__",void 0),le([Ih(100)],md.prototype,"width",void 0),le([Ih(100)],md.prototype,"height",void 0),le([Ih(1)],md.prototype,"pixelRatio",void 0),le([Ih(!0)],md.prototype,"smooth",void 0),le([an(!1)],md.prototype,"safeResize",void 0),le([Ih()],md.prototype,"contextSettings",void 0),md=le([Hn()],md);const{copyAndSpread:yd,includes:vd,spread:wd,setList:xd}=Wt;let bd=class extends Cl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:n,italic:r,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Xh.number(e,o),t.__letterSpacing=Xh.number(i,o),t.__padding=l?L.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${o||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Yh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&wd(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!vd(h,a)),this.isOverflow?(xd(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;yd(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()}};le([An(yl)],bd.prototype,"__",void 0),le([gn(0)],bd.prototype,"width",void 0),le([gn(0)],bd.prototype,"height",void 0),le([bn()],bd.prototype,"boxStyle",void 0),le([an(!1)],bd.prototype,"resizeFontSize",void 0),le([bn("#000000")],bd.prototype,"fill",void 0),le([yn("outside")],bd.prototype,"strokeAlign",void 0),le([Pn("all")],bd.prototype,"hitFill",void 0),le([gn("")],bd.prototype,"text",void 0),le([gn("")],bd.prototype,"placeholder",void 0),le([gn("caption")],bd.prototype,"fontFamily",void 0),le([gn(12)],bd.prototype,"fontSize",void 0),le([gn("normal")],bd.prototype,"fontWeight",void 0),le([gn(!1)],bd.prototype,"italic",void 0),le([gn("none")],bd.prototype,"textCase",void 0),le([gn("none")],bd.prototype,"textDecoration",void 0),le([gn(0)],bd.prototype,"letterSpacing",void 0),le([gn({type:"percent",value:1.5})],bd.prototype,"lineHeight",void 0),le([gn(0)],bd.prototype,"paraIndent",void 0),le([gn(0)],bd.prototype,"paraSpacing",void 0),le([gn("x")],bd.prototype,"writingMode",void 0),le([gn("left")],bd.prototype,"textAlign",void 0),le([gn("top")],bd.prototype,"verticalAlign",void 0),le([gn(!0)],bd.prototype,"autoSizeAlign",void 0),le([gn("normal")],bd.prototype,"textWrap",void 0),le([gn("show")],bd.prototype,"textOverflow",void 0),le([bn(!1)],bd.prototype,"textEditing",void 0),bd=le([Hn()],bd);let kd=class extends Cl{get __tag(){return"Path"}};le([An(pl)],kd.prototype,"__",void 0),le([yn("center")],kd.prototype,"strokeAlign",void 0),kd=le([Hn()],kd);let Sd=class extends Ol{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new kd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};le([An(fl)],Sd.prototype,"__",void 0),le([(t,e)=>{tn(t,e,{get(){return this.__path}})}],Sd.prototype,"path",void 0),Sd=le([Xn(As,["set","path","paint"]),Hn()],Sd);let Ed=class extends Al{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:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&ee.editor(o,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(t){const e=new Al(t);return this.add(e),e}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),n(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&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,ke),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Hr.END,this.__onReady,this],[Vr.START,this.__onCreated,this],[Vr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Vr.END,this.__onChildRenderEnd,this))}};Ed=le([Hn()],Ed);const Bd={},Td={isHoldSpaceKey:()=>Td.isHold("Space"),isHold:t=>Bd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Bd[t]||(Bd[t]=!0)},setUpCode(t){Bd[t]=!1}},Rd={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 Cd extends Cr{get spaceKey(){return Td.isHoldSpaceKey()}get left(){return Rd.left(this)}get right(){return Rd.right(this)}get middle(){return Rd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Td.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){re.changeName(t,e)}}const{float:Od,sign:Pd}=L,{min:Ld,max:Ad,abs:Dd}=Math,Md=new Xt,Fd=new Xt,Id={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Wd.getValidMove(t.__localBoxBounds,Wd.getDragBounds(t),s,e,!0),Wd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:o,dragBoundsType:n}=t;o&&Wd.getValidScaleOf(t.__localBoxBounds,Wd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,o){const n=t.x+s.x,r=t.y+s.y,a=n+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return o||(s=Object.assign({},s)),Wd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),Wd.isInnerMode(t,e,i,"height")?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=Od(s.x),s.y=Od(s.y),s},getValidScaleOf(t,e,i,s,o,n,r){r||(o=Object.assign({},o)),Fd.set(e),Md.set(t).scaleOf(s,o.x,o.y);const a=(s.x-t.x)/t.width,l=1-a,d=(s.y-t.y)/t.height,c=1-d;let u,g,_,p,f,m;return Wd.isInnerMode(t,e,i,"width")?(u=o.x<0?1/o.x:1,o.x<0&&Md.scaleOf(s,u,1),f=Od(Md.minX-Fd.minX),m=Od(Fd.maxX-Md.maxX),_=a&&f>0?1+f/(a*Md.width):1,p=l&&m>0?1+m/(l*Md.width):1,u*=Ad(_,p)):(o.x<0&&Md.unsign(),f=Od(Fd.minX-Md.minX),m=Od(Md.maxX-Fd.maxX),_=a&&f>0?1-f/(a*Md.width):1,p=l&&m>0?1-m/(l*Md.width):1,u=Ld(_,p)),Wd.isInnerMode(t,e,i,"height")?(g=o.y<0?1/o.y:1,o.y<0&&Md.scaleOf(s,1,g),f=Od(Md.minY-Fd.minY),m=Od(Fd.maxY-Md.maxY),_=d&&f>0?1+f/(d*Md.height):1,p=c&&m>0?1+m/(c*Md.height):1,g*=Ad(_,p),n&&(_=Ad(Dd(u),Dd(g)),u=Pd(u)*_,g=Pd(g)*_)):(o.y<0&&Md.unsign(),f=Od(Fd.minY-Md.minY),m=Od(Md.maxY-Fd.maxY),_=d&&f>0?1-f/(d*Md.height):1,p=c&&m>0?1-m/(c*Md.height):1,g=Ld(_,p)),o.x*=h(u)?u:1,o.y*=h(g)?g:1,o}},Wd=Id;let zd=class extends Cd{};zd.POINTER="pointer",zd.BEFORE_DOWN="pointer.before_down",zd.BEFORE_MOVE="pointer.before_move",zd.BEFORE_UP="pointer.before_up",zd.DOWN="pointer.down",zd.MOVE="pointer.move",zd.UP="pointer.up",zd.OVER="pointer.over",zd.OUT="pointer.out",zd.ENTER="pointer.enter",zd.LEAVE="pointer.leave",zd.TAP="tap",zd.DOUBLE_TAP="double_tap",zd.CLICK="click",zd.DOUBLE_CLICK="double_click",zd.LONG_PRESS="long_press",zd.LONG_TAP="long_tap",zd.MENU="pointer.menu",zd.MENU_TAP="pointer.menu_tap",zd=le([Vn()],zd);const Yd=zd,Nd={};let Xd=class extends zd{static setList(t){this.list=t instanceof uh?t:new uh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const o=t.getLocalPoint(i,null,!0);return ot.move(o,e.x-t.x,e.y-t.y),s&&this.limitMove(t,o),Id.axisMove(t,o),o}static limitMove(t,e){Id.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Nd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Nd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Nd,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 Wt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Wt.unsign(i),i}assignMove(t){Nd.x=t?this.totalX:this.moveX,Nd.y=t?this.totalY:this.moveY}};Xd.BEFORE_DRAG="drag.before_drag",Xd.START="drag.start",Xd.DRAG="drag",Xd.END="drag.end",Xd.OVER="drag.over",Xd.OUT="drag.out",Xd.ENTER="drag.enter",Xd.LEAVE="drag.leave",Xd=le([Vn()],Xd);const Hd=Xd;let Vd=class extends zd{static setList(t){Xd.setList(t)}static setData(t){Xd.setData(t)}};Vd.DROP="drop",Vd=le([Vn()],Vd);let jd=class extends Xd{};jd.BEFORE_MOVE="move.before_move",jd.START="move.start",jd.MOVE="move",jd.END="move.end",jd=le([Vn()],jd);let Ud=class extends zd{};Ud.BEFORE_ROTATE="rotate.before_rotate",Ud.START="rotate.start",Ud.ROTATE="rotate",Ud.END="rotate.end",Ud=le([Vn()],Ud);let Gd=class extends Xd{};Gd.SWIPE="swipe",Gd.LEFT="swipe.left",Gd.RIGHT="swipe.right",Gd.UP="swipe.up",Gd.DOWN="swipe.down",Gd=le([Vn()],Gd);let Kd=class extends zd{};Kd.BEFORE_ZOOM="zoom.before_zoom",Kd.START="zoom.start",Kd.ZOOM="zoom",Kd.END="zoom.end",Kd=le([Vn()],Kd);let qd=class extends Cd{};qd.BEFORE_DOWN="key.before_down",qd.BEFORE_UP="key.before_up",qd.DOWN="key.down",qd.HOLD="key.hold",qd.UP="key.up",qd=le([Vn()],qd);const Zd={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:t=>t<-45&&t>-135?Gd.UP:t>45&&t<135?Gd.DOWN:t<=45&&t>=-45?Gd.RIGHT:Gd.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:Jd.getSwipeDirection(ot.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:n(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new uh,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>ir.draggable(t)||!t.isLeafer&&t.hasEvent(Xd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Jd=Zd,Qd=new uh,{getDragEventData:$d,getDropEventData:tc,getSwipeEventData:ec}=Zd;class ic{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=$d(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=Xd.list||this.draggableList||Qd;return this.dragging&&(s?t?Qd:new uh(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(jd.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Rd.left(t),this.dragging&&(this.interaction.emit(Xd.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],ir.draggable(e)){this.draggableList=new uh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=$d(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",e.emit(jd.BEFORE_MOVE,this.dragData),e.emit(jd.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(Xd.BEFORE_DRAG,this.dragData),e.emit(Xd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:o}=this.dragData,{dragLimitAnimate:n}=e.p,r=!n||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=Xd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:o},r||s);n&&!s&&t?ir.animateMove(e,h,l(n)?n:.3):e.move(h)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Xd.OUT,t,i),e.emit(Xd.OVER,t,s)):e.emit(Xd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Xd.LEAVE,t,i,s),e.emit(Xd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=$d(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(jd.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(Xd.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(ot.getDistance(e,t)>o.config.pointer.swipeDistance){const t=ec(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=tc(t,e,Xd.data);s.path=i,this.interaction.emit(Vd.DROP,s),this.interaction.emit(Xd.LEAVE,t,i)}dragReset(){Xd.list=Xd.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const sc=Gt.get("emit");const oc=["move","zoom","rotate","key"];function nc(t,e,i,s,o){if(oc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!ac(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&rc(n,e,i,s,o)}}function rc(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!ac(t,o)&&(Zh.updateEventStyle&&!s&&Zh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=re.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function ac(t,e){return e&&e.has(t)}const hc={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:lc,pathCanDrag:dc,pathHasOutside:cc}=Zd;class uc{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&&Rd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Rd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Td.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=f.clone(hc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new uh(t),this.createTransformer(),this.dragger=new ic(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Rd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(zd.BEFORE_DOWN,t),this.emit(zd.DOWN,t),Rd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Rd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Rd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(zd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ot.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(zd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Rd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(zd.BEFORE_UP,t),this.emit(zd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(zd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(zd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(qd.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Td.setDownCode(e),this.emit(qd.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(qd.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(qd.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Td.setUpCode(e),this.emit(qd.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new uh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(zd.OUT,t,i),this.emit(zd.OVER,t,e)):this.emit(zd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(zd.LEAVE,t,i,e),this.emit(zd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(zd.LEAVE,t),this.dragger.dragging&&this.emit(Vd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[zd.DOUBLE_TAP,zd.DOUBLE_CLICK].some(e=>lc(t.path,e));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:o}=this.p,{bottomList:n,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:n,name:e.type},i||{through:o}));return a.throughPath&&(e.throughPath=a.throughPath),e.path=a.path,a.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&&!cc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!dc(t.path))&&!cc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:zd.MOVE}),this.hoverData=t)}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,o=s.length;t<o&&(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:o}=this.canvas;return s.x*=o.width/i.width,s.y*=o.height/i.height,this.p.snap&&ot.round(s),s}emitTap(t){this.emit(zd.TAP,t),this.emit(zd.CLICK,t)}emitDoubleTap(t){this.emit(zd.DOUBLE_TAP,t),this.emit(zd.DOUBLE_CLICK,t)}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(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(zd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(zd.LONG_TAP,t),(lc(t.path,zd.LONG_TAP)||lc(t.path,zd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Xt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Nr.RESIZE,this.__onResize,this)],t.once(jr.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 o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],rc(o,t,e,!0,s))return;o.isApp&&nc(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&nc(o,t,e,!1,s),rc(o,t,e,!1,s))return}catch(t){sc.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 gc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}gc.custom={};class _c extends he{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new uh,this.pixelList=new uh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ee.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ee.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()}}t.getSelector=function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=ee.selector())};const{toInnerRadiusPointOf:pc,copy:fc,setRadius:mc}=ot,{hitRadiusPoint:yc,hitPoint:vc}=Wt,wc={},xc={},bc=eh.prototype;bc.hit=function(e,i=0){this.updateLayout(),fc(xc,e),mc(xc,i);const s=this.__world;return!!(i?yc(s,xc):vc(s,xc))&&(this.isBranch?t.getSelector(this).hitPoint(Object.assign({},xc),i,{target:this}):this.__hitWorld(xc))},bc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,o=i.width<10&&i.height<10;if(e.hitRadius&&(fc(wc,t),mc(t=wc,e.hitRadius)),pc(t,i,wc),e.hitBox||o){if(Wt.hitRadiusPoint(s.boxBounds,wc))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(wc)},bc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},bc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},bc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},bc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const kc=new ct,Sc=Cl.prototype;Sc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.leafer||this.parent&&this.parent.leafer;if(!e)return;const i=this.__,{hitCanvasManager:s}=e,o=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,n=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,r=o||n;this.__hitCanvas||(this.__hitCanvas=r?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(r){const{renderBounds:e}=this.__layout,s=t.image.hitCanvasSize,r=a.hitScale=Ht.set(0,0,s,s).getFitMatrix(e).a,{x:h,y:l,width:d,height:c}=Ht.set(e).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Go.patternLocked=!0,this.__renderShape(a,{matrix:kc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!o,ignoreStroke:!n}),Go.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},Sc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:o,__maxStrokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__isAlphaPixelStroke)||"all"===o;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Ec=Cl.prototype,Bc=Dl.prototype,Tc=Yl.prototype;Bc.__updateHitCanvas=Tc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Ec.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Bc.__hitFill=Tc.__hitFill=function(t){return this.__hitCanvas?Ec.__hitFill.call(this,t):Wt.hitRadiusPoint(this.__layout.boxBounds,t)},bd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach(o=>t.rect(o.x,o.y-s,o.width,e<i?i:e))},Ol.prototype.pick=function(e,i){return i||(i=o),this.updateLayout(),t.getSelector(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Rc=Se.prototype;Rc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Rc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Rc.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),Ht.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Ht.x,Ht.y,Ht.width||1,Ht.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const Cc={convertTouch(t,e){const i=Cc.getTouch(t),s=Zd.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class Oc extends uc{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return n(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=Cc.getTouch(t);this.pointerDown(Cc.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=Cc.getTouch(t);this.pointerMove(Cc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=Cc.getTouch(t);this.pointerUp(Cc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){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(Zd.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))}destroy(){super.destroy(),this.touches=null}}function Pc(t,e){const i=t.__,{rows:s,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)n=s[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(o){const{decorationColor:t,decorationHeight:n}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>o.forEach(i=>e.fillRect(t.x,t.y+i,t.width,n)))}}function Lc(t,e){t.__.__font?Pc(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Ac(t,e,i){switch(e.__.strokeAlign){case"center":Dc(t,1,e,i);break;case"inside":Mc(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Dc(t,2,e,i):Mc(t,"outside",e,i)}}function Dc(t,e,i,s){const o=i.__;g(t)?Ic(t,e,!0,i,s):(s.setStroke(t,o.__strokeWidth*e,o),Fc(i,s))}function Mc(t,e,i,s){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Dc(t,2,i,o),o.blendMode="outside"===e?"destination-out":"destination-in",Pc(i,o),o.blendMode="normal",ir.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}function Fc(t,e){let i,s=t.__.__textDrawData;const{rows:o,decorationY:n}=s;for(let t=0,s=o.length;t<s;t++)i=o[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(n){const{decorationHeight:t}=s;o.forEach(i=>n.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function Ic(t,e,i,s,o){let n;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||o.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(n=t[h],(!n.image||!jh.checkImage(s,o,n,!1))&&n.style){if(a){const{strokeStyle:t}=n;t?o.setStroke(n.style,r.__getRealStrokeWidth(t)*e,r,t):o.setStroke(n.style,r.__strokeWidth*e,r)}else o.strokeStyle=n.style;n.blendMode?(o.saveBlendMode(n.blendMode),i?Fc(s,o):o.stroke(),o.restoreBlendMode()):i?Fc(s,o):o.stroke()}}function Wc(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Ac(t,e,i);else switch(s.strokeAlign){case"center":zc(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),zc(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)zc(t,2,e,i);else{const{renderBounds:o}=e.__layout,n=i.getSameCanvas(!0,!0);e.__drawRenderPath(n),zc(t,2,e,n),n.clipUI(s),n.clearWorld(o),ir.copyCanvasByWorld(e,i,n),n.recycle(e.__nowWorld)}}(t,e,i)}}function zc(t,e,i,s){const o=i.__;g(t)?Ic(t,e,!1,i,s):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&Vh.strokeArrow(t,i,s)}const{getSpread:Yc,copyAndSpread:Nc,toOuterOf:Xc,getOuterOf:Hc,getByMove:Vc,move:jc,getIntersectData:Uc}=Wt,Gc={};let Kc;const{stintSet:qc}=f,{hasTransparent:Zc}=Nh;function Jc(t,e,i){if(!g(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:o}=i.__layout;switch(e.type){case"image":s=jh.image(i,t,e,o,!Kc||!Kc[e.url]);break;case"linear":s=Uh.linearGradient(e,o);break;case"radial":s=Uh.radialGradient(e,o);break;case"angular":s=Uh.conicGradient(e,o);break;case"solid":const{type:r,color:a,opacity:h}=e;s={type:r,style:Nh.string(a,h)};break;default:n(e.r)||(s={type:"solid",style:Nh.string(e)})}if(s){if(a(s.style)&&Zc(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const Qc={compute:function(t,e){const i=e.__,s=[];let o,n,r,a=i.__input[t];u(a)||(a=[a]),Kc=jh.recycleImage(t,i);for(let i,o=0,n=a.length;o<n;o++)(i=Jc(t,a[o],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(o=!0),n=!0),"fill"===t?(qc(i,"__isAlphaPixelFill",o),qc(i,"__isTransparentFill",n)):(qc(i,"__isAlphaPixelStroke",o),qc(i,"__isTransparentStroke",n),qc(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,Lc(e,i)},fills:function(t,e,i){let s;for(let o=0,n=t.length;o<n;o++){if(s=t[o],s.image){if(jh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!o&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:o}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&o>1)&&i.scale(1/t,1/o)}s.blendMode&&(i.blendMode=s.blendMode),Lc(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Lc(e,i),i.restoreBlendMode()):Lc(e,i)}},fillPathOrText:Lc,fillText:Pc,stroke:Wc,strokes:function(t,e,i){Wc(t,e,i)},strokeText:Ac,drawTextStroke:Fc,shape:function(e,i,s){const o=i.getSameCanvas(),n=i.bounds,r=e.__nowWorld,a=e.__layout,h=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let l,d,c,u,g,_;Xc(a.strokeSpread?(Nc(Gc,a.boxBounds,a.strokeSpread),Gc):a.boxBounds,r,h);let{scaleX:p,scaleY:f}=e.getRenderScaleData(!0);if(n.includes(h))_=o,l=g=h,d=r;else{let o;if(t.fullImageShadow)o=h;else{const t=a.renderShapeSpread?Yc(n,S.swapAndScale(a.renderShapeSpread,p,f)):n;o=Uc(t,h)}u=n.getFitMatrix(o);let{a:m,d:y}=u;u.a<1&&(_=i.getSameCanvas(),e.__renderShape(_,s),p*=m,f*=y),g=Hc(h,u),l=Vc(g,-u.e,-u.f),d=Hc(r,u),jc(d,-u.e,-u.f);const v=s.matrix;v?(c=new ct(u),c.multiply(v),m*=v.scaleX,y*=v.scaleY):c=u,c.withScale(m,y),s=Object.assign(Object.assign({},s),{matrix:c})}return e.__renderShape(o,s),{canvas:o,matrix:c,fitMatrix:u,bounds:l,renderBounds:d,worldCanvas:_,shapeBounds:g,scaleX:p,scaleY:f}}};let $c={},tu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:eu,set:iu,rotateOfOuter:su,translate:ou,scaleOfOuter:nu,multiplyParent:ru,scale:au,rotate:hu,skew:lu}=G;function du(t,e,i,s){const o=eu();ou(o,e.x,e.y),i&&au(o,i,s),t.transform=o}function cu(t,e,i,s,o,n,r){const a=eu();ou(a,e.x+i,e.y+s),au(a,o,n),r&&su(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function uu(t,e,i,s,o,n,r,a,h,l){const d=eu();_u(d,e,i,s,o,n,r,a),h&&(r||a?(iu(tu),nu(tu,e,h,l),ru(d,tu)):nu(d,e,h,l)),t.transform=d}function gu(t,e,i,s,o,n,r,a,h,l,d,c){const u=eu();if(c)_u(u,e,o,n,r,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:ou(u,s,0);break;case 180:ou(u,i,s);break;case 270:ou(u,0,i)}$c.x=e.x+o,$c.y=e.y+n,ou(u,$c.x,$c.y),r&&nu(u,$c,r,a)}t.transform=u}function _u(t,e,i,s,o,n,r,a){r&&hu(t,r),a&&lu(t,a.x,a.y),o&&au(t,o,n),ou(t,e.x+i,e.y+s)}const{get:pu,translate:fu}=G,mu=new Xt,yu={},vu={};function wu(t,e,i,s){const{changeful:o,sync:n,scaleFixed:r}=i;o&&(t.changeful=o),n&&(t.sync=n),r&&(t.scaleFixed=r),t.data=xu(i,s,e)}function xu(t,e,i){t.padding&&(e=mu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:o}=i;const{opacity:n,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,skew:_,clipSize:p,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===o,w={mode:r},x="center"!==h&&(u||0)%180==90;let b,k;switch(Wt.set(vu,0,0,x?o:s,x?s:o),r&&"cover"!==r&&"fit"!==r?((d||c)&&(L.getScaleData(d,c,i,yu),b=yu.scaleX,k=yu.scaleY),(h||m||f)&&(b&&Wt.scale(vu,b,k,!0),h&&xt.toPoint(h,vu,e,vu,!0,!0))):v&&!u||(b=k=Wt.getFitScale(e,vu,"fit"!==r),Wt.put(e,i,h,b,!1,vu),Wt.scale(vu,b,k,!0)),l&&ot.move(vu,l),r){case"stretch":v||(b=e.width/s,k=e.height/o,du(w,e,b,k));break;case"normal":case"clip":if(vu.x||vu.y||b||p||u||_){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),uu(w,e,vu.x,vu.y,b,k,u,_,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||u||_)&&gu(w,e,s,o,vu.x,vu.y,b,k,u,_,h,t.freeTransform),f||(w.repeat="repeat");const i=g(f);(m||i)&&(w.gap=function(t,e,i,s,o){let n,r;g(t)?(n=t.x,r=t.y):n=r=t;return{x:bu(n,i,o.width,e&&e.x),y:bu(r,s,o.height,e&&e.y)}}(m,i&&f,vu.width,vu.height,e));break;default:b&&cu(w,e,vu.x,vu.y,b,k,u)}return w.transform||(e.x||e.y)&&fu(w.transform=pu(),e.x,e.y),w.width=s,w.height=o,b&&(w.scaleX=b,w.scaleY=k),n&&(w.opacity=n),y&&(w.filters=y),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function bu(t,e,i,s){const o=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let ku,Su=new Xt;const{isSame:Eu}=Wt;function Bu(t,e,i,s,o,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return o.data||wu(o,s,i,n),!0}function Tu(t,e){Ou(t,Dr.LOAD,e)}function Ru(t,e){Ou(t,Dr.LOADED,e)}function Cu(t,e,i){e.error=i,t.forceUpdate("surface"),Ou(t,Dr.ERROR,e)}function Ou(t,e,i){t.hasEvent(e)&&t.emitEvent(new Dr(e,i))}function Pu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Lu,scale:Au,copy:Du}=G,{floor:Mu,ceil:Fu,max:Iu,abs:Wu}=Math;function zu(e,i,s){let{scaleX:o,scaleY:n}=e.getRenderScaleData(!0,i.scaleFixed);const r=o+"-"+n+"-"+s;if(i.patternId===r||e.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:g,scaleY:_,transform:p,repeat:f,gap:m}=h;o*=s,n*=s,g&&(g=Wu(g),_=Wu(_),d=Lu(),Du(d,p),Au(d,1/g,1/_),o*=g,n*=_),c*=o,u*=n;const y=c*u;if(!f&&y>t.image.maxCacheSize)return!1;let v=t.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/Fu(t))}else{const t=a.width*a.height;v>t&&(v=t)}y>v&&(l=Math.sqrt(y/v)),l&&(o/=l,n/=l,c/=l,u/=l),g&&(o/=g,n/=_);const w=m&&m.x*o,x=m&&m.y*n;if(p||1!==o||1!==n){const t=c+(w||0),e=u+(x||0);o/=t/Iu(Mu(t),1),n/=e/Iu(Mu(e),1),d||(d=Lu(),p&&Du(d,p)),Au(d,1/o,1/n)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,x,e.leafer&&e.leafer.config.smooth),k=a.getPattern(b,f||t.origin.noRepeat||"no-repeat",d,i);return i.style=k,i.patternId=r,!0}}const Yu={image:function(t,e,i,s,o){let n,r;const a=Go.get(i);return ku&&i===ku.paint&&Eu(s,ku.boxBounds)?n=ku.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),ku=a.use>1?{leafPaint:n,paint:i,boxBounds:Su.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Bu(t,e,i,a,n,s),o&&(Tu(t,r),Ru(t,r))):a.error?o&&Cu(t,r,a.error):(o&&(Pu(t,!0),Tu(t,r)),n.loadId=a.load(()=>{Pu(t,!1),t.destroyed||(Bu(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ru(t,r)),n.loadId=void 0},e=>{Pu(t,!1),Cu(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(e,i,s,o){const{scaleX:n,scaleY:r}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+r+"-"+a&&!qh.running)return!1;if(o)if(h.repeat)o=!1;else if(!(s.changeful||"miniapp"===t.name&&Nr.isResizing(e)||qh.running)){let{width:e,height:i}=h;e*=n*a,i*=r*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),o=e*i>t.image.maxCacheSize}return o?(e.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,i,s,h),!0):(!s.style||s.sync||qh.running?zu(e,s,a):s.patternTask||(s.patternTask=Go.patternTasker.add(()=>de(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&zu(e,s,a),e.forceUpdate("surface")}),300)),!1)},createPattern:zu,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,o,n,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,Go.recycle(o),o.loading&&(r||(r=e.__input&&e.__input[t]||[],u(r)||(r=[r])),o.unload(i[h].loadId,!r.some(t=>t.url===a))));return n}return null},createData:wu,getPatternData:xu,stretchMode:du,fillOrFitMode:cu,clipMode:uu,repeatMode:gu},{toPoint:Nu}=yt,{hasTransparent:Xu}=Nh,Hu={},Vu={};function ju(t,e,i,s){if(i){let o,n,r,h;for(let t=0,l=i.length;t<l;t++)o=i[t],a(o)?(r=t/(l-1),n=Nh.string(o,s)):(r=o.offset,n=Nh.string(o.color,s)),e.addColorStop(r,n),!h&&Xu(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Uu,getDistance:Gu}=ot,{get:Ku,rotateOfOuter:qu,scaleOfOuter:Zu}=G,{toPoint:Ju}=yt,Qu={},$u={};function tg(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=Uu(e,i);n=Ku(),o?(Zu(n,e,r/a*(s||1),1),qu(n,e,t+90)):(Zu(n,e,1,r/a*(s||1)),qu(n,e,t))}return n}const{getDistance:eg}=ot,{toPoint:ig}=yt,sg={},og={};const ng={linearGradient:function(e,i){let{from:s,to:o,type:n,opacity:r}=e;Nu(s||"top",i,Hu),Nu(o||"bottom",i,Vu);const a=t.canvas.createLinearGradient(Hu.x,Hu.y,Vu.x,Vu.y),h={type:n,style:a};return ju(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Ju(s||"center",i,Qu),Ju(o||"bottom",i,$u);const h=t.canvas.createRadialGradient(Qu.x,Qu.y,0,Qu.x,Qu.y,Gu(Qu,$u)),l={type:n,style:h};ju(l,h,e.stops,r);const d=tg(i,Qu,$u,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;ig(s||"center",i,sg),ig(o||"bottom",i,og);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,sg.x,sg.y):t.canvas.createRadialGradient(sg.x,sg.y,0,sg.x,sg.y,eg(sg,og)),l={type:n,style:h};ju(l,h,e.stops,r);const d=tg(i,sg,og,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:tg},{copy:rg,move:ag,toOffsetOutBounds:hg}=Wt,{max:lg,abs:dg}=Math,cg={},ug=new ct,gg={};function _g(t,e){let i,s,o,n,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),o=dg(t.spread||0),r=lg(r,o+n-s),a=lg(a,o+n+i),h=lg(h,o+n+s),l=lg(l,o+n-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function pg(e,i,s){const{shapeBounds:o}=s;let n,r;t.fullImageShadow?(rg(cg,e.bounds),ag(cg,i.x-o.x,i.y-o.y),n=e.bounds,r=cg):(n=o,r=i),e.copyWorld(s.canvas,n,r)}const{toOffsetOutBounds:fg}=Wt,mg={};const yg=_g;const vg={shadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;hg(h,gg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.setWorldShadow(gg.offsetX+(r.x||0)*c*f,gg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,Nh.string(r.color)),o=Gh.getShadowTransform(t,g,i,r,gg,f),o&&g.setTransform(o),pg(g,gg,i),o&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,n,"copy"),s=n),a?g.copyWorld(a,n,n,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),ir.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;fg(h,mg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(mg.offsetX+(r.x||0)*c*f,mg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),o=Gh.getShadowTransform(t,g,i,r,mg,f,!0),o&&g.setTransform(o),pg(g,mg,i),g.restore(),a?(g.copyWorld(g,l,n,"copy"),g.copyWorld(a,n,n,"source-out"),s=n):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,Nh.string(r.color),"source-in"),ir.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.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:_g,getShadowTransform:function(t,e,i,s,o,n,r){if(s.spread){const i=1+2*s.spread/t.__layout.strokeBounds.width*n*(r?-1:1);return ug.set().scaleOfOuter({x:(o.x+o.width/2)*e.pixelRatio,y:(o.y+o.height/2)*e.pixelRatio},i),ug}},isTransformShadow(t){},getInnerShadowSpread:yg},{excludeRenderBounds:wg}=dr;let xg;function bg(t,e,i,s,o,n,r,a){switch(e){case"grayscale":xg||(xg=!0,o.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,o,n){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),n&&s.recycle(r);Sg(t,e,i,1,o,n)}(t,i,s,o,r,a);break;case"opacity-path":Sg(t,i,s,n,r,a);break;case"path":a&&i.restore()}}function kg(t){return t.getSameCanvas(!1,!0)}function Sg(t,e,i,s,o,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,o),n?i.recycle(r):i.clearWorld(r)}Ol.prototype.__renderMask=function(t,e){let i,s,o,n,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(bg(this,r,t,o,s,n,void 0,!0),s=o=null),"clipping"!==a&&"clipping-path"!==a||wg(i,e)||i.__render(t,e),n=i.__.opacity,xg=!1,"path"===a||"clipping-path"===a?(n<1?(r="opacity-path",o||(o=kg(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=kg(t)),o||(o=kg(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&bg(this,r,t,o,s,n,void 0,!1),wg(i,e)||i.__render(o||t,e),d&&bg(this,r,t,o,s,n,d,!1)}bg(this,r,t,o,s,n,void 0,!0)};const Eg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Bg=Eg+"_#~&*+\\=|≮≯≈≠=…",Tg=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 Rg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Cg=Rg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Og=Rg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Pg=Rg(Eg),Lg=Rg(Bg),Ag=Rg("- —/~|┆·");var Dg;!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"}(Dg||(Dg={}));const{Letter:Mg,Single:Fg,Before:Ig,After:Wg,Symbol:zg,Break:Yg}=Dg;function Ng(t){return Cg[t]?Mg:Ag[t]?Yg:Og[t]?Ig:Pg[t]?Wg:Lg[t]?zg:Tg.test(t)?Fg:Mg}const Xg={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function Hg(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:Vg}=Xg,{Letter:jg,Single:Ug,Before:Gg,After:Kg,Symbol:qg,Break:Zg}=Dg;let Jg,Qg,$g,t_,e_,i_,s_,o_,n_,r_,a_,h_,l_,d_,c_,u_,g_,__=[];function p_(t,e){n_&&!o_&&(o_=n_),Jg.data.push({char:t,width:e}),$g+=e}function f_(){t_+=$g,Jg.width=$g,Qg.words.push(Jg),Jg={data:[]},$g=0}function m_(){d_&&(c_.paraNumber++,Qg.paraStart=!0,d_=!1),n_&&(Qg.startCharSize=o_,Qg.endCharSize=n_,o_=0),Qg.width=t_,u_.width?Vg(Qg):g_&&y_(),__.push(Qg),Qg={words:[]},t_=0}function y_(){t_>(c_.maxWidth||0)&&(c_.maxWidth=t_)}const{top:v_,right:w_,bottom:x_,left:b_}=pt;function k_(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const S_={getDrawData:function(e,i){a(e)||(e=String(e));let s=0,o=0,n=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=i;d&&(n?(s=d[b_],n-=d[w_]+d[b_]):i.autoSizeAlign||(s=d[b_]),r?(o=d[v_],r-=d[v_]+d[x_]):i.autoSizeAlign||(o=d[v_]));const c={bounds:{x:s,y:o,width:n,height:r},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,i,s){c_=e,__=e.rows,u_=e.bounds,g_=!u_.width&&!s.autoSizeAlign;const{__letterSpacing:o,paraIndent:n,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=u_;if(h||l||o||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;d_=!0,a_=null,o_=s_=n_=$g=t_=0,Jg={data:[]},Qg={words:[]},o&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)i_=i[s],"\n"===i_?($g&&f_(),Qg.paraEnd=!0,m_(),d_=!0):(r_=Ng(i_),r_===jg&&"none"!==r&&(i_=Hg(i_,r,!$g)),s_=a.measureText(i_).width,o&&(o<0&&(n_=s_),s_+=o),h_=r_===Ug&&(a_===Ug||a_===jg)||a_===Ug&&r_!==Kg,l_=!(r_!==Gg&&r_!==Ug||a_!==qg&&a_!==Kg),e_=d_&&n?h-n:h,t&&h&&t_+$g+s_>e_&&(e?($g&&f_(),t_&&m_()):(l_||(l_=r_===jg&&a_==Kg),h_||l_||r_===Zg||r_===Gg||r_===Ug||$g+s_>e_?($g&&f_(),t_&&m_()):t_&&m_()))," "===i_&&!0!==d_&&t_+$g===0||(r_===Zg?(" "===i_&&$g&&f_(),p_(i_,s_),f_()):h_||l_?($g&&f_(),p_(i_,s_)):p_(i_,s_)),a_=r_);$g&&f_(),t_&&m_(),__.length>0&&(__[__.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{c_.paraNumber++,t_=a.measureText(t).width,__.push({x:n||0,text:t,width:t_,paraStart:!0}),g_&&y_()})}(c,e,i),d&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":k_(e,"x",t[b_]);break;case"right":k_(e,"x",-t[w_])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":k_(e,"y",t[v_]);break;case"bottom":k_(e,"y",-t[x_])}}(d,c,i,n,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:_,width:p,height:f}=s,m=n*o+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,n),o>1&&(t.overflow=o);else if(f||u)switch(d){case"middle":_+=(f-m)/2;break;case"bottom":_+=f-m}y+=_;let v,w,x,b=p||u?p:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=g,v.width<p||v.width>p&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=n,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+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&&p&&p<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=m}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:o,paraIndent:n,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=i&&("justify"===o||"both"===o)&&u>1?(i-t.width-l)/(u-1):0,d=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==o||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,n),c.overflow&&function(e,i,s,o){if(!o)return;const{rows:n,overflow:r}=e;let{textOverflow:a}=i;if(n.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+o-l;("none"===i.textWrap?n:[n[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,i,s,n),"none"!==h&&function(t,e){let i,s=0;const{fontSize:o,textDecoration:n}=e;switch(t.decorationHeight=o/11,g(n)?(i=n.type,n.color&&(t.decorationColor=Nh.string(n.color)),n.offset&&(s=Math.min(.3*o,Math.max(n.offset,.15*-o)))):i=n,i){case"under":t.decorationY=[.15*o+s];break;case"delete":t.decorationY=[.35*-o];break;case"under-delete":t.decorationY=[.15*o+s,.35*-o]}}(c,i),c}};const E_={string:function(t,e){if(!t)return"#000";const i=l(e)&&e<1;if(a(t)){if(!i||!Nh.object)return t;t=Nh.object(t)}let s=n(t.a)?1:t.a;i&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}};Object.assign(Yh,S_),Object.assign(Nh,E_),Object.assign(Vh,Qc),Object.assign(jh,Yu),Object.assign(Uh,ng),Object.assign(Gh,vg),Object.assign(ee,{interaction:(t,e,i,s)=>new Oc(t,e,i,s),hitCanvas:(t,e)=>new ph(t,e),hitCanvasManager:()=>new _c}),Al.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&yh(0,wx)}catch(t){}function B_(t){return t?u(t)?t:[t]:[]}class T_ extends Cr{get list(){return B_(this.value)}get oldList(){return B_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function R_(t){return(e,i)=>{const s="_"+i;tn(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){const n=this;if(n.config){const t="target"===i;if(t){const{beforeSelect:t}=n.config;if(t){const i=t({target:e});if(g(i))e=i;else if(!1===i)return}n.setDimOthers(!1),n.setBright(!1),u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),n.single&&(delete n.element.syncEventer,delete n.element.__world.ignorePixelSnap)}const s=t?T_.BEFORE_SELECT:T_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new T_(s,{editor:n,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}T_.BEFORE_SELECT="editor.before_select",T_.SELECT="editor.select",T_.AFTER_SELECT="editor.after_select",T_.BEFORE_HOVER="editor.before_hover",T_.HOVER="editor.hover";const{abs:C_}=Math,{copy:O_,scale:P_}=G,{setListWithFn:L_}=Wt,{worldBounds:A_}=dr,D_={a:1,b:0,c:0,d:1,e:0,f:0},M_={x:0,y:0,width:0,height:0};class F_ extends Cl{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(L_(M_,e,A_),t&&this.set(t),this.set(M_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:n,strokeWidth:r,fill:h}=o,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=C_(c.scaleX),l=C_(c.scaleY);if(O_(D_,c),D_.half=r%2,i!==l){P_(D_,1/i,1/l),t.setWorld(D_,e.matrix),t.beginPath(),o.strokeWidth=r;const{x:n,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(n*i,a*l,h*i,d*l)}else t.setWorld(D_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=r/C_(c.scaleX);n&&(a(n)?Vh.stroke(n,this,t):Vh.strokes(n,this,t)),h&&(a(h)?Vh.fill(h,this,t):Vh.fills(h,this,t))}}o.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}le([R_(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],F_.prototype,"target",void 0);class I_ extends Ol{constructor(t){super(t),this.strokeArea=new Dl({strokeAlign:"center"}),this.fillArea=new Dl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const W_={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return z_([t],i,e),i}};function z_(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&o.hitSelf&&e.push(s)}s.isBranch&&z_(s.children,e,i)}}const{findOne:Y_,findByBounds:N_}=W_;class X_ extends Ol{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new F_,this.targetStroker=new F_,this.bounds=new Xt,this.selectArea=new I_,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:o,strokeWidth:n,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:o,strokeWidth:n},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),o=new uh(N_(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach(e=>{o.has(e)||t.push(e)}),o.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!Y_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new uh(this.editor.editBox.rect)};return Y_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Y_(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[T_.HOVER,this.onHover,this],[T_.SELECT,this.onSelect,this]]),e.on_([[zd.MOVE,this.onPointerMove,this],[zd.BEFORE_DOWN,this.onBeforeDown,this],[zd.TAP,this.onTap,this],[Xd.START,this.onDragStart,this,!0],[Xd.DRAG,this.onDrag,this],[Xd.END,this.onDragEnd,this],[jd.MOVE,this.onAutoMove,this],[[Kd.ZOOM,jd.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:H_,top:V_,topRight:j_,right:U_,bottomRight:G_,bottom:K_,bottomLeft:q_,left:Z_}=ft,{toPoint:J_}=yt,{within:Q_,sign:$_}=L,{abs:tp}=Math,ep={getScaleData(t,e,i,s,o,n,r,a){let h,d,c={},u=1,g=1;const{boxBounds:_,widthRange:p,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=$_(x),S=$_(b),E=a?x:k*_.width/v,B=a?b:S*_.height/w;if(l(s))u=g=Math.sqrt(s);else{n&&(s.x*=2,s.y*=2),s.x*=a?x:k,s.y*=a?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,l=(-s.x+v)/v;switch(i){case V_:g=t,h="bottom";break;case U_:u=e,h="left";break;case K_:g=r,h="top";break;case Z_:u=l,h="right";break;case H_:g=t,u=l,h="bottom-right";break;case j_:g=t,u=e,h="bottom-left";break;case G_:g=r,u=e,h="top-left";break;case q_:g=r,u=l,h="top-right"}if(o)if("corner"===o&&i%2)o=!1;else switch(i){case V_:case K_:u=g;break;case Z_:case U_:g=u;break;default:d=Math.sqrt(tp(u*g)),u=$_(u)*d,g=$_(g)*d}}const T=1!==u,R=1!==g;if(T&&(u/=E),R&&(g/=B),!r){const{worldTransform:e}=t;u<0&&(u=1/_.width/e.scaleX),g<0&&(g=1/_.height/e.scaleY)}if(J_(n||h,_,c,!0),m){const e={x:u,y:g};Id.limitScaleOf(t,c,e,o),u=e.x,g=e.y}if(T&&p){const e=_.width*t.scaleX;u=Q_(e*u,p)/e}if(R&&f){const e=_.height*t.scaleY;g=Q_(e*g,f)/e}return T&&tp(u*y.width)<1&&(u=$_(u)/y.width),R&&tp(g*y.height)<1&&(g=$_(g)/y.height),o&&u!==g&&(d=Math.min(tp(u),tp(g)),u=$_(u)*d,g=$_(g)*d),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case H_:n="bottom-right";break;case j_:n="bottom-left";break;case G_:n="top-left";break;case q_:n="top-right";break;default:n="center"}return J_(o||n,t.boxBounds,r,!0),{origin:r,rotation:ot.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case V_:case H_:n={x:.5,y:0},o="bottom",a=1;break;case K_:case G_:n={x:.5,y:1},o="top",a=1;break;case Z_:case q_:n={x:0,y:.5},o="right",h=1;break;case U_:case j_:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,J_(s||o,t,r,!0);const c=ot.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case Z_:t=U_;break;case H_:t=j_;break;case q_:t=G_;break;case U_:t=Z_;break;case j_:t=H_;break;case G_:t=q_}if(i)switch(t){case V_:t=K_;break;case H_:t=q_;break;case j_:t=G_;break;case K_:t=V_;break;case q_:t=H_;break;case G_:t=j_}return t}},ip={};function sp(t,e){const{enterPoint:i,dragging:s,skewing:o,resizing:n,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return op(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:_,resizeable:p,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(_||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!p)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?o?g:n?c:u:v?g:y?c:u;h+=45*(ep.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(L.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;ip[S]?i.cursor=ip[S]:ip[S]=i.cursor={url:np(x,h),x:b,y:k}}function op(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function np(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class rp extends Yl{constructor(t){super(t),this.useFastShadow=!0}}const ap=["top","right","bottom","left"],hp=void 0;class lp extends Ol{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return a(t)||a(e)||a(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Ol,this.rect=new rp({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new rp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Ol({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:o,rotatePoints:n,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new rp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new rp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new rp({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:n,resizeLines:a}=this,{stroke:h,strokeWidth:l,resizeLine:d,ignorePixelSnap:c}=e,u=this.getPointsStyle(),g=this.getMiddlePointsStyle();let _;this.visible=!t.locked;for(let t=0;t<8;t++)_=n[t],_.set(this.getPointStyle(t%2?g[(t-1)/2%g.length]:u[t/2%u.length])),_.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},d||{}));o.set(this.getPointStyle(e.circle||e.rotatePoint||u[0])),s.set(Object.assign({stroke:h,strokeWidth:l,editConfig:hp},e.rect||{}));const p=r(e.rectThrough)?i:e.rectThrough;s.hittable=!p,p&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&f.stintSet(t.__world,"ignorePixelSnap",c),op(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:o,circle:n,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:_,hideOnSmall:p,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Wt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=l(p)?p:10,y=f&&!(p&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)yt.toPoint(yt.directionData[i],t,S),w=a[i],v=h[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!_),v.visible=y&&_&&g&&!x,i%2&&(k=d[(i-1)/2],k.set(S),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,p&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,p&&2*w.width>c&&(w.visible=!1)));n.visible=y&&_&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=ap.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=ap.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?ep.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:hp};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:o,rotateable:n,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!o?(n&&(this.rotating=!0),"resize-rotate"===i?o&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&o&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:o,skewing:n}=this;if(i)e.onMove(t);else if(s||o||n){const i=t.current;i.pointType&&(this.enterPoint=i),o&&e.onRotate(t),s&&e.onScale(t),n&&e.onSkew(t)}sp(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){if(this.canUse){this.moving&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Nr.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}}onTransformEnd(t){this.canUse&&(this.canDragLimitAnimate&&(t instanceof Xd||t instanceof jd)&&this.transformTool.onMove(t),this.resizing&&(Nr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.update())}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergedConfig.moveable)&&(this.gesturing=this.moving=!0,t.type===jd.START?this.onTransformStart(t):this.transformTool.onMove(t)))}onScale(t){this.canGesture&&(t.stop(),a(this.mergedConfig.resizeable)&&(this.gesturing=this.resizing=!0,t.type===Kd.START?this.onTransformStart(t):this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),a(this.mergedConfig.rotateable)&&(this.gesturing=this.rotating=!0,t.type===Ud.START?this.onTransformStart(t):this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){sp(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof bd)||t.find(t=>t instanceof bd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[Xd.START,this.onDragStart,this],[Xd.DRAG,this.onDrag,this],[Xd.END,this.onDragEnd,this],[zd.ENTER,e=>{this.enterPoint=t,sp(this,e)}],[zd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[zd.DOUBLE_TAP,this.onDoubleTap,this],[zd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[qd.HOLD,qd.UP],this.onKey,this],[qd.DOWN,this.onArrow,this],[[jd.START,jd.BEFORE_MOVE],this.onMove,this,!0],[[Kd.START,Kd.BEFORE_ZOOM],this.onScale,this,!0],[[Ud.START,Ud.BEFORE_ROTATE],this.onRotate,this,!0],[[jd.END,Kd.END,Ud.END],this.onTransformEnd,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const dp={x:0,y:0,width:1e5,height:1e5};class cp extends Cl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,dp),Object.assign(this.__world,dp)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const up='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',gp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${up}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${up}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${up}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},_p=new Xt;function pp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{_p.setListWithFn(i,t=>t.getBounds("box","page")),0===_p.width&&(_p.width=.1),0===_p.height&&(_p.height=.1),e.reset(_p.get())}),s.add(e)}const fp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),mp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),yp={group(t,e,i){t.sort(mp);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new Ol(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(fp);const r=new ct(e.worldTransform);return r.divideParent(o.scrollWorldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(n)),s.unlockLayout(),n},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(fp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(mp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},vp=Gt.get("EditToolCreator");function wp(){return t=>{bp.register(t)}}const xp=wp,bp={list:{},register(t){const{tag:e}=t.prototype;kp[e]&&vp.repeat(e),kp[e]=t},get:(t,e)=>new kp[t](e)},{list:kp}=bp;class Sp extends T_{constructor(t,e){super(t,e)}}Sp.BEFORE_OPEN="innerEditor.before_open",Sp.OPEN="innerEditor.open",Sp.BEFORE_CLOSE="innerEditor.before_close",Sp.CLOSE="innerEditor.close";class Ep extends T_{constructor(t,e){super(t,e)}}Ep.BEFORE_GROUP="editor.before_group",Ep.GROUP="editor.group",Ep.BEFORE_UNGROUP="editor.before_ungroup",Ep.UNGROUP="editor.ungroup",Ep.BEFORE_OPEN="editor.before_open_group",Ep.OPEN="editor.open_group",Ep.BEFORE_CLOSE="editor.before_close_group",Ep.CLOSE="editor.close_group";const{updateMatrix:Bp}=ir,Tp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Rp="top-left";class Cp extends Dl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Lr.CHANGE,e=>{if(this.checkChange&&Tp[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,Bp(this.parent),Bp(this);const a=new ct(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Bp(this),this.changedTransform=new ct(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(Rp,n);break;case"scaleX":t.scaleOf(Rp,n,1);break;case"scaleY":t.scaleOf(Rp,1,n);break;case"skewX":t.skewOf(Rp,n,0);break;case"skewY":t.skewOf(Rp,0,n)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Op extends T_{constructor(t,e){super(t,e)}}Op.BEFORE_MOVE="editor.before_move",Op.MOVE="editor.move";class Pp extends T_{constructor(t,e){super(t,e)}}Pp.BEFORE_SCALE="editor.before_scale",Pp.SCALE="editor.scale";class Lp extends T_{constructor(t,e){super(t,e)}}Lp.BEFORE_ROTATE="editor.before_rotate",Lp.ROTATE="editor.rotate";class Ap extends T_{constructor(t,e){super(t,e)}}Ap.BEFORE_SKEW="editor.before_skew",Ap.SKEW="editor.skew";class Dp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let o,{dragLimitAnimate:n}=i;const r=t.type===jd.END||t.type===Xd.END,h=a(e.draggable),d=!n||r||h,c={x:t.totalX,y:t.totalY};t instanceof jd&&ot.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),o=Xd.getValidMove(e,s.point,c,d),(o.x||o.y)&&(n&&!h&&r?ir.animateMove(this,o,l(n)?n:.3):this.move(o))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:o}=this.editBox;let n,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof Kd?(r=e.getBoxPoint(t),n=t.totalScale):n=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=ep.getScaleData(e,o.bounds,d,n,a,ep.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof Xd&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),ot.move(o.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:o,rotateAround:n,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof Ud)d=t.rotation,l=n?yt.getPoint(n,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=ep.getRotateData(e,h,t,s,i?null:n||e.around||e.origin||o||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=L.float(L.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),ot.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:o,skewX:n,skewY:r}=ep.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),ep.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;g(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(g(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);o||i.safeChange(()=>i.move(t,e));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new Op(Op.BEFORE_MOVE,h));const l=new Op(Op.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Pp(Pp.BEFORE_SCALE,t));const n=new Pp(Pp.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,origin:t,scaleX:e,scaleY:i});if(g(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.scaleOf(t,e,i))),c={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Pp(Pp.BEFORE_SCALE,c));const u=new Pp(Pp.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new ct(ir.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new Pp(Pp.BEFORE_SCALE,r));const a=new Pp(Pp.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(l(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!o&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:n,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Lp(Lp.BEFORE_ROTATE,d));const c=new Lp(Lp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,origin:t,skewX:e,skewY:i});if(g(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.skewOf(t,e,i))),c={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Ap(Ap.BEFORE_SKEW,c));const u=new Ap(Ap.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(ir.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new ct(e.worldTransform);return t(),new ct(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Mp=class extends Ol{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new uh,this.openedGroupList=new uh,this.simulateTarget=new Cp(this),this.editBox=new lp(this),this.editToolList={},this.selector=new X_(this),this.editMask=new cp(this),this.targetEventIds=[];let i=f.clone(gp);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),te.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?u(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>f.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&pp(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(a(s))e=s;else if(!1===s)return}if(bp.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||bp.get(e,this);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Ep.BEFORE_GROUP),this.target=yp.group(this.list,this.element,t),this.emitGroupEvent(Ep.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Ep.BEFORE_UNGROUP,t)),this.target=yp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Ep.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Ep.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Ep.OPEN,t)}closeGroup(t){this.emitGroupEvent(Ep.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Ep.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ir.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Ep(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(a(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(a(i))s=i;else if(!1===i)return}bp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||bp.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(Sp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Sp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Sp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Sp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Sp(t,{editTarget:i,innerEditor:e});i.syncEventer||this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(yp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(yp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Vr.START,this.onRenderStart,this),i&&i.on_(Lr.SCROLL,this.onChildScroll,this),t.on_(Vr.CHILD_START,this.onAppRenderStart,this),t.on_(jr.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};le([(t,e)=>{tn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:o}=this,a=Object.assign({},t);if(e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(a,t)}return s.config&&Object.assign(a,s.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),r(a.lockRatio)&&(a.lockRatio=!0))),n(a.dragLimitAnimate)&&(a.dragLimitAnimate=o&&o.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Mp.prototype,"mergeConfig",void 0),le([R_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof uh?i:new uh(i),t.multiple&&pp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new T_(T_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new T_(T_.AFTER_SELECT,s))})],Mp.prototype,"target",void 0),le([R_(function(t,e){t.emitEvent(new T_(T_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Mp.prototype,"hoverTarget",void 0),Mp=le([Xn(Dp,["editBox","editTool","emitEvent"])],Mp);class Fp{static registerInnerEditor(){bp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Ol,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let Ip=class extends Fp{static registerEditTool(){bp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach(t=>{t.moveWorld(e,i)}),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach(t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)}),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};Ip=le([wp()],Ip);const{left:Wp,right:zp}=ft,{move:Yp,copy:Np,toNumberPoints:Xp}=ot;let Hp=class extends Ip{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===Wp;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=Xp(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(Yp(t,n,r),s&&Yp(e,-n,-r)):(s&&Yp(t,-n,-r),Yp(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),Np(s[7],i),Np(e[7],i),Np(s[3],a),Np(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Wp||t===zp,s[t].visible=a,e[t].visible=!r&&a}};Hp=le([wp()],Hp);const{M:Vp,L:jp,C:Up,Q:Gp,Z:Kp,N:qp,D:Zp,X:Jp,G:Qp,F:$p,O:tf,P:ef,U:sf}=Te,of={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case Vp:case jp:nf(t,e,i,o,1),o+=3;break;case Up:nf(t,e,i,o,3),o+=7;break;case Gp:nf(t,e,i,o,2),o+=5;break;case Kp:o+=1;break;case qp:nf(t,e,i,o,2),o+=5;break;case Zp:nf(t,e,i,o,2),o+=9;break;case Jp:nf(t,e,i,o,2),o+=6;break;case Qp:nf(t,e,i,o,2),o+=9;break;case $p:nf(t,e,i,o,2),o+=5;break;case tf:t[o]=Qp,t.splice(o+4,0,t[o+3],0),nf(t,e,i,o,2),o+=9,n+=2;break;case ef:t[o]=$p,t.splice(o+4,0,t[o+3]),nf(t,e,i,o,2),o+=5,n+=1;break;case sf:nf(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:nf}=of,rf=G.get(),{topLeft:af,top:hf,topRight:lf,right:df,bottom:cf,left:uf}=ft;function gf(t,e,i){t.pathInputed?pf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function _f(t,e,i,s){let o=e;if(!n(s)){const n=t.__layout;let{width:r,height:a}=n.boxBounds;switch(r*=i-e,a*=e-i,s){case hf:case cf:o=i,n.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case uf:case df:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case af:case lf:n.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function pf(t,e,i){of.scale(t.__.path,e,i),t.path=t.__.path}function ff(t,e,i){const{points:s}=t;g(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):of.scalePoints(s,e,i),t.points=s}function mf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)rf.a=e,rf.d=i,s[t].transform(rf,!0)}const yf=eh.prototype;function vf(t,e,i){wf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(jd.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(jd.END,e=>{ir.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(Kd.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function wf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}yf.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},yf.__scaleResize=function(t,e){gf(this,t,e)},yf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},yf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},bd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,n=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize)_f(this,t,e,n&&n.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:n}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==o&&1!==t&&(this.x+=r.x),s&&"top"!==n&&1!==e&&(this.y+=r.y),gf(this,t,e)}},kd.prototype.__scaleResize=function(t,e){pf(this,t,e)},_d.prototype.__scaleResize=function(t,e){this.pathInputed?pf(this,t,e):this.points?ff(this,t,e):this.width*=t},$l.prototype.__scaleResize=function(t,e){this.pathInputed?pf(this,t,e):this.points?ff(this,t,e):gf(this,t,e)},Ol.prototype.__scaleResize=function(t,e){mf(this,t,e)},Yl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||gf(this,t,e),i&&mf(this,t,e)},te.add("resize"),te.add("editor","resize"),ee.editor=function(t,e){const i=new Mp(t);return e&&e.sky.add(e.editor=i),i},Yl.addAttr("textBox",!1,an),Cl.addAttr("editConfig",void 0,an),Cl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),an),Cl.addAttr("editInner","PathEditor",an),Ol.addAttr("editInner","",an),bd.addAttr("editInner","TextEditor",an),Cl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Cl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Cl.setEditInner=function(t){this.changeAttr("editInner",t)};const xf=Gt.get("LeaferTypeCreator"),bf={list:{},register(t,e){kf[t]&&xf.repeat(t),kf[t]=e},run(t,e){const i=kf[t];i&&i(e)}},{list:kf,register:Sf}=bf;Sf("viewport",vf),Sf("custom",function(t){vf(t,null,!0)}),Sf("design",function(t){vf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Sf("document",function(t){vf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Ef={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=ot.getCenter(e.from,i.from),o=ot.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=ot.getDistance(e.from,i.from);return{move:n,scale:ot.getDistance(e.to,i.to)/r,rotation:ot.getRotation(e.from,i.from,e.to,i.to),center:o}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),o=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&o<1?"none":i>=s&&i>=o?"move":s>=o?"zoom":"rotate"},detect(t,e){const{state:i}=Bf,s=Bf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Bf.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?Bf.getType(i.totalData,e):"none"},add(t,e){e&&(ot.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Bf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Bf=Ef,{abs:Tf,max:Rf}=Math,{sign:Cf,within:Of}=L,Pf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;t.shiftKey&&!s&&(s=o,o=0);const n=Tf(s),r=Tf(o);return n>50&&(s=Rf(50,n/3)*Cf(s)),r>50&&(o=Rf(50,r/3)*Cf(o)),{x:-s*i*2,y:-o*i*2}},getScale(e,i){let s,o=1,{zoomMode:n,zoomSpeed:r}=i;const a=e.deltaY||e.deltaX;if(n?(s="mouse"===n||!e.deltaX&&(t.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){r=Of(r,0,1);const t=e.deltaY?i.delta.y:i.delta.x,s=Of(1-Tf(a)/(4*t)*r,.5,2);o=a>0?s:1/s}return o}};let Lf,Af,Df,Mf;class Ff{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Lf=0,Af=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Lf,totalY:Af}),e.emit(jd.START,this.moveData)),t.path=this.moveData.path,t.totalX=Lf+=t.moveX,t.totalY=Af+=t.moveY,e.emit(jd.BEFORE_MOVE,t),e.emit(jd.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Df=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Df}),e.emit(Kd.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Df*=t.scale,e.emit(Kd.BEFORE_ZOOM,t),e.emit(Kd.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Mf=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Mf}),e.emit(Ud.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Mf+=t.rotation,e.emit(Ud.BEFORE_ROTATE,t),e.emit(Ud.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(jd.END,Object.assign(Object.assign({},e),{totalX:Lf,totalY:Af})),i&&t.emit(Kd.END,Object.assign(Object.assign({},i),{totalScale:Df})),s&&t.emit(Ud.END,Object.assign(Object.assign({},s),{totalRotation:Mf})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const If=Al.prototype,Wf=new Xt,zf=new lt;function Yf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Nf(t,e){return Object.assign(Object.assign({},e),{scale:t})}If.initType=function(t){bf.run(t,this)},If.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:o}=this.app.config.move;if(zf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?zf.y=0:t.includes("y")?zf.x=0:Math.abs(zf.x)>Math.abs(zf.y)?zf.y=0:zf.x=0,i&&t.includes("limit")&&(Wf.set(this.__world).addPoint(this.zoomLayer),Id.getValidMove(Wf,this.canvas.bounds,"inner",zf,!0),t.includes("x")?zf.y=0:t.includes("y")&&(zf.x=0))}return{x:o?0:zf.x,y:o?0:zf.y}},If.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const Xf=uc.prototype;Xf.createTransformer=function(){this.transformer=new Ff(this)},Xf.move=function(t){this.transformer.move(t)},Xf.zoom=function(t){this.transformer.zoom(t)},Xf.rotate=function(t){this.transformer.rotate(t)},Xf.transformEnd=function(){this.transformer.transformEnd()},Xf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):Pf.getScale(t,e);if(1!==n)this.zoom(Nf(n,t));else{const s=e.getMove?e.getMove(t,e):Pf.getMove(t,e);i.snap&&ot.round(s),this.move(Yf(s,t))}},Xf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let o=Ef.getData(e),{moving:n,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Ef.detect(o,g(s)?s:{})){case"move":n=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Ef.reset()}n||(o.center=Ef.state.center)}else n=r=a=!0;var h,l;Object.assign(t,o.center),t.multiTouch=!0,a&&this.rotate((h=o.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(Nf(o.scale,t)),n&&this.move(Yf(o.move,t))};const Hf=ic.prototype,{abs:Vf}=Math;function jf(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}Hf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=Vf(i),n=Vf(s),r=e?1:.1,a=this.canAnimate&&this.moving&&(o>r||n>r)&&this.interaction.m.dragAnimate;if(a){const r="touch"===t.pointerType?3:1,h=70;o*(e=e?l(a)?a:.95:r)>h?e=h/o:n*e>h&&(e=h/n),t=Object.assign({},t),ot.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},Hf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Hf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Hf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Wt.maxX(r),d=Wt.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let g=0,_=0;this.autoMoveTimer=setInterval(()=>{g+=c,_+=u,ot.move(i,c,u),ot.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},Hf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},te.add("viewport"),te.add("view"),Al.prototype.zoom=function(t,e,i,s){let o;this.killAnimate(),_(e)?(o=e.padding,i=e.scroll,s=e.transition):o=e;const{zoomLayer:n}=this,h=this.canvas.bounds.clone().shrink(r(o)?30:o),d=new Xt,c={x:h.x+h.width/2,y:h.y+h.height/2};let p;const{x:f,y:m,scaleX:y,scaleY:v}=n.__;if(a(t))switch(t){case"in":p=jf(y,"in");break;case"out":p=jf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Xt(this.boxBounds)).height=0;break;case"fit-height":(t=new Xt(this.boxBounds)).width=0}else l(t)&&(p=t/y);if(p)p=this.getValidScale(p),n.scaleOfWorld(c,p,p,!1,s);else if(g(t)){const e={x:f,y:m,scaleX:y,scaleY:v},o=u(t);if(o||t.tag){const e=o?t:[t];d.setListWithFn(e,dr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,h);d.set(n.getWorldBounds(e))}const{width:r,height:a}=d;let l=h.x-d.x,c=h.y-d.y;return i?(l+=Math.max((h.width-r)/2,0),c+=Math.max((h.height-a)/2,0)):(p=this.getValidScale(Math.min(h.width/r,h.height/a)),l+=(h.width-r*p)/2,c+=(h.height-a*p)/2,ot.scaleOf(e,d,p),d.scaleOf(d,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(l=0),ot.move(e,l,c),d.move(l,c),n.set(e,s),d}return n.worldBoxBounds};class Uf extends Ol{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;a(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Yl,this.scrollYBar=new Yl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new Xt(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:_,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?p.width+6:2,u?_.height+6:2,2]);_.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),p.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:g})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Xd.DRAG,this.onDrag,this),e.on_(Xd.DRAG,this.onDrag,this),t.on_(Xd.END,this.onDragEnd,this),e.on_(Xd.END,this.onDragEnd,this),this.target.on_(Vr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Nr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}te.add("scroll");class Gf extends dl{}function Kf(t){return on(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,vn(this)}}}))}let qf=class extends _d{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Hh.register(t,e)}};le([An(Gf)],qf.prototype,"__",void 0),le([Kf("angle")],qf.prototype,"endArrow",void 0),qf=le([Hn()],qf);const{M:Zf,L:Jf,C:Qf,Q:$f,O:tm}=Te,{rotate:em,copyFrom:im,scale:sm}=ot,om={},nm={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case Zf:case Jf:rm(t,l+1,e,i,s,o,n,r),l+=3;break;case Qf:for(h=1;h<6;h+=2)rm(t,l+h,e,i,s,o,n,r);l+=7;break;case $f:for(h=1;h<4;h+=2)rm(t,l+h,e,i,s,o,n,r);l+=5;break;case tm:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){nm.layout(t,0,0,1,1,e,i)}};function rm(t,e,i,s,o,n,r,a){im(om,t[e],t[e+1]),r&&em(om,r,a),o&&sm(om,o,n),t[e]=i+om.x,t[e+1]=s+om.y}const{layout:am,rotate:hm}=nm,{getAngle:lm}=ot,dm={x:-.5},cm={connect:dm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},um={connect:dm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},gm={connect:dm,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},_m={connect:dm,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},pm={offset:dm,path:[...gm.path],dashPath:[1,-2.5,0,2,-1,0]};hm(pm.path,180,{x:-1.5,y:0});const fm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},mm={connect:{x:.5},path:[...fm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},ym={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},vm={path:[...ym.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},wm=f.clone(ym),xm=f.clone(vm);hm(wm.path,45),hm(xm.path,45);const bm={angle:cm,"angle-side":um,arrow:_m,triangle:gm,"triangle-flip":pm,circle:mm,"circle-line":fm,square:vm,"square-line":ym,diamond:xm,"diamond-line":wm,mark:{offset:dm,path:[1,0,-2,2,0,2]}};function km(t,e,i,s,o,n,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;g(e)?e.type?(h=e.scale,a=bm[e.type]):a=e:a=bm[e];const{offset:c,connect:u,path:_,dashPath:p}=a;let f=u?u.x:0,m=c?c.x:0;const y=[..._];return r&&p&&y.push(...p),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?m+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(m+=c.bevelJoin)),h&&am(y,0,0,h,h),m&&am(y,m,0),am(y,s.x,s.y,o,o,lm(i,s)),n.x=(f+m)*o,y}const{M:Sm,L:Em,C:Bm,Q:Tm,Z:Rm,N:Cm,D:Om,X:Pm,G:Lm,F:Am,O:Dm,P:Mm,U:Fm}=Te,{copy:Im,copyFrom:Wm,getDistancePoint:zm}=ot,Ym={},Nm={},Xm={},Hm={},Vm={},jm={list:bm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:o,__pathForRender:n,cornerRadius:r}=t.__,a=!r;let h,l=0,d=n.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=n[l],h){case Sm:case Em:(c<2||l+6>=d)&&(Wm(Vm,n[l+1],n[l+2]),!c&&u&&Im(Nm,Vm)),l+=3;break;case Bm:(1===c||l+7>=d-3)&&Um(n,Hm,Vm,l+3),l+=7;break;case Tm:(1===c||l+5>=d-3)&&Um(n,Hm,Vm,l+1),l+=5;break;case Rm:return;case Cm:l+=5;break;case Om:l+=9;break;case Pm:l+=6;break;case Lm:l+=9;break;case Am:l+=5;break;case Dm:l+=7;break;case Mm:l+=4;break;case Fm:(1===c||l+6>=d-3)&&(Um(n,Hm,Vm,l+1),l+6!==d&&(Vm.x-=(Vm.x-Hm.x)/10,Vm.y-=(Vm.y-Hm.y)/10)),l+=6}if(c++,1===c&&h!==Sm)return;if(2===c&&u&&Im(Xm,h===Em?Vm:Hm),l===d){const r=t.__.__pathForRender=a?[...n]:n,d=t.__.__pathForArrow=[];if(u){const i=km(t,e,Xm,Nm,s,Ym,!!o);o?d.push(...i):r.push(...i),Ym.x&&(zm(Nm,Xm,-Ym.x,!0),r[1]=Xm.x,r[2]=Xm.y)}if(i&&"none"!==i){const e=km(t,i,Hm,Vm,s,Ym,!!o);if(o?d.push(...e):r.push(...e),Ym.x){let t;switch(zm(Vm,Hm,-Ym.x,!0),h){case Em:t=l-3+1;break;case Bm:t=l-7+5;break;case Tm:t=l-5+3;break;case Fm:t=l-6+3}t&&Gm(r,Hm,t)}}}else Im(Hm,Vm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Um(t,e,i,s){Wm(e,t[s],t[s+1]),Wm(i,t[s+2],t[s+3])}function Gm(t,e,i){t[i]=e.x,t[i+1]=e.y}te.add("arrow"),Cl.addAttr("startArrow","none",Kf),Cl.addAttr("endArrow","none",Kf),Object.assign(Hh,jm),Object.assign(Vh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let Km=class extends Yl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};le([An(class extends al{})],Km.prototype,"__",void 0),le([dn("x")],Km.prototype,"flow",void 0),Km=le([Hn()],Km);const qm={},Zm={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},Jm={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function Qm(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;xt.toPoint(i,e,o,qm),e.x=s.__autoWidth?o.x:qm.x,e.y=s.__autoHeight?o.y:qm.y}const{move:$m}=ot;function ty(t,e,i,s,o,n){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=s+(e.height-h.height)/("center"===o?2:1)),$m(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function ey(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const iy={};function sy(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:n,__autoHeight:r}=t.__,h=o&&(e?!n:!r);return g(i)?(iy.xGap=i.x||0,iy.yGap=i.y||0):iy.xGap=iy.yGap=c(i),iy.isAutoXGap=a(iy.xGap)&&!n,iy.isAutoYGap=a(iy.yGap)&&!r,iy.complex=h||"top-left"!==s||t.__hasGrow||iy.isAutoXGap||iy.isAutoYGap,iy.wrap=h,iy.complex&&(iy.isFitXGap="fit"===iy.xGap&&!n,iy.isFitYGap="fit"===iy.yGap&&!r,g(s)?(iy.contentAlign=s.content||"top-left",iy.rowXAlign=s.x||"from",iy.rowYAlign=s.y||"from"):(iy.contentAlign=s,iy.rowXAlign=Zm[s],iy.rowYAlign=Jm[s])),iy}function oy(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function ny(t,e,i,s){const{count:o}=t;o>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(o-1),t[e]=i)}function ry(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:ay}=L;function hy(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__widthGrow)&&(r=ly(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.widthRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__widthGrow,o=e/i*s,r=ly(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s})}(h,a,l)}}function ly(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?ay(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:dy}=L;function cy(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__heightGrow)&&(r=uy(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.heightRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__heightGrow,o=e/i*s,r=uy(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s})}(h,a,l)}}function uy(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?dy(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:gy}=ot;function _y(t,e){const i="width",{children:s,itemBox:o}=t,n=sy(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:h;let _,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=ry(_,o),r?(_.__flowBounds=p,y||(y=oy(m,g)),a&&y.count&&y.width+p.width>x&&(y.grow?hy(t,y,x,e):d&&ny(y,i,x,c),ey(u,y,i),y=oy(m,g)),f=p.width,_.__widthGrow&&(y.grow+=_.__widthGrow,f=0,_.__.widthRange&&(y.hasRangeSize=!0)),_.__heightGrow&&uy(_,p,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,p.height),y.count++):(gy(_,v-p.x,w-p.y),v+=p.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:g}=n;y.count&&(y.grow?hy(t,y,x,e):d&&ny(y,i,x,c),a&&ey(u,y,i)),a?(s?ny(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Qm(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=Zm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],ty(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(Qm(t,y,r),ty(t,y,0,y.y,g,e))}}const{move:py}=ot;function fy(t,e,i,s,o,n){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=i+(e.width-h.width)/("center"===o?2:1)),py(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:my}=ot;function yy(t,e){const i="height",{children:s,itemBox:o}=t,n=sy(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:l;let _,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=ry(_,o),r?(_.__flowBounds=p,y||(y=oy(m,g)),a&&y.count&&y.height+p.height>b&&(y.grow&&cy(t,y,b,e),d&&ny(y,i,b,c),ey(u,y,i),y=oy(m,g)),f=p.height,_.__heightGrow&&(y.grow+=_.__heightGrow,f=0,_.__.heightRange&&(y.hasRangeSize=!0)),_.__widthGrow&&ly(_,p,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,p.width),y.count++):(my(_,v-p.x,w-p.y),w+=p.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:g}=n;y.count&&(y.grow&&cy(t,y,b,e),d&&ny(y,i,b,c),a&&ey(u,y,i)),a?(s?ny(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Qm(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=Jm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],fy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Qm(t,y,r),fy(t,y,y.x,0,l,e))}}function vy(t){return on(t,t=>({set(e){const i=l(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&pn(this)}}))}te.add("flow","resize");const wy=Yl.prototype,{__updateBoxBounds:xy}=Ol.prototype;Cl.addAttr("flow",!1,dn),Cl.addAttr("gap",0,gn),Cl.addAttr("flowAlign","top-left",gn),Cl.addAttr("flowWrap",!1,gn),Cl.addAttr("itemBox","box",gn),Cl.addAttr("inFlow",!0,gn),Cl.addAttr("autoWidth",void 0,vy),Cl.addAttr("autoHeight",void 0,vy),Cl.addAttr("autoBox",void 0,gn);const{copyAndSpread:by}=Wt;wy.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:_y(this);break;case"y":yy(this);break;case"x-reverse":_y(this,!0);break;case"y-reverse":yy(this,!0)}t&&(this.leafer.created=!0)},wy.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),by(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},wy.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():xy.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&by(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:ky,sin:Sy,pow:Ey,sqrt:By,abs:Ty,ceil:Ry,floor:Cy,round:Oy,PI:Py}=Math,Ly=5*Py,Ay=1.70158,Dy=2.5949095,My=7.5625,Fy=2.75;function Iy(t){return e=>Ey(e,t)}function Wy(t){return e=>1-Ey(1-e,t)}function zy(t){return e=>e<.5?.5*Ey(2*e,t):1-.5*Ey(2-2*e,t)}function Yy(t){return t<1/Fy?My*t*t:t<2/Fy?My*(t-=1.5/Fy)*t+.75:t<2.5/Fy?My*(t-=2.25/Fy)*t+.9375:My*(t-=2.625/Fy)*t+.984375}function Ny(t,e,i,s){const o={};return n=>{const r=~~(1e4*n),a=o[r];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=Xy(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Ty(l)<1e-6));e++)c-=d/l;return o[r]=Xy(c,e,s)}}function Xy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Hy={get(t){const{list:e}=Hy;return a(t)?e[t||"ease"]:g(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){Hy.list[t]=e},list:{linear:t=>t,ease:Ny(.25,.1,.25,1),"ease-in":Ny(.42,0,1,1),"ease-out":Ny(0,0,.58,1),"ease-in-out":Ny(.42,0,.58,1),"sine-in":t=>1-ky(t*Py*.5),"sine-out":t=>Sy(t*Py*.5),"sine-in-out":t=>.5*(1-ky(t*Py)),"quad-in":Iy(2),"quad-out":Wy(2),"quad-in-out":zy(2),"cubic-in":Iy(3),"cubic-out":Wy(3),"cubic-in-out":zy(3),"quart-in":Iy(4),"quart-out":Wy(4),"quart-in-out":zy(4),"quint-in":Iy(5),"quint-out":Wy(5),"quint-in-out":zy(5),"expo-in":t=>t?Ey(2,10*t-10):0,"expo-out":t=>1===t?1:1-Ey(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Ey(2,2*t*10-10):.5*(2-Ey(2,10-2*t*10)),"circ-in":t=>1-By(1-Ey(t,2)),"circ-out":t=>By(1-Ey(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-By(1-Ey(2*t,2))):.5*(By(1-Ey(2-2*t,2))+1),"back-in":t=>((Ay+1)*t-Ay)*t*t,"back-out":t=>(t-=1)*t*((Ay+1)*t+Ay)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Dy+1)*t-Dy)*.5:.5*((t=2*t-2)*t*((Dy+1)*t+Dy)+2),"elastic-in":t=>0===t||1===t?t:-Ey(2,10*(t-1))*Sy((t-1.1)*Ly),"elastic-out":t=>0===t||1===t?t:Ey(2,-10*t)*Sy((t-.1)*Ly)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Ey(2,10*((t*=2)-1))*Sy((t-1.1)*Ly)*.5:Ey(2,10*(1-(t*=2)))*Sy((t-1.1)*Ly)*.5+1,"bounce-in":t=>1-Yy(1-t),"bounce-out":Yy,"bounce-in-out":t=>t<.5?.5*(1-Yy(1-2*t)):.5*(1+Yy(2*t-1)),"cubic-bezier":Ny,steps:function(t,e="floor"){return i=>("floor"===e?Cy(i*t):"ceil"===e?Ry(i*t):Oy(i*t))/t}}};function Vy(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 jy{}jy.CREATED="created",jy.PLAY="play",jy.PAUSE="pause",jy.STOP="stop",jy.SEEK="seek",jy.UPDATE="update",jy.COMPLETED="completed";let Uy=class extends Qr{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:o}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&o&&l(o)&&(t+=o-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),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:o,attrs:n}=this;this.easingFn=Hy.get(o),(n||this.attrsMap)&&(this.attrsMap=n?n.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.requestAnimate():(this.clearTimer(),this.start()),this.emitType(jy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(jy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(jy.STOP))}seek(t){this.destroyed||(g(t)&&(t=Xh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(jy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:o}=i,r=!(o>1)||this.join;let a,h,d,c,u,g=0,_=0;o>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<o;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:o,swing:n,loop:r}=h;n&&(d.swing=l(n)?n:2,u=2*d.swing-1),r&&(d.loop=u=l(r)?r:2),t?(d.duration=t,g+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,_+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,_+=s*u),o&&(d.easingFn=Hy.get(o))}if(!d.autoDuration&&n(d.duration)&&(o>1?s>0||r?_+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,a);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}a=c,e.push(d)}_?((this.duration<=g||!s||!s.duration)&&this.changeDuration(g+.2*_),this.allocateTime((this.duration-g)/_)):g&&this.changeDuration(g),this.emitType(jy.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:o,target:r}=this;for(let a in e)n(s[a])&&(s[a]=o[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=n(i[a])?o[a]:i[a],o[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let o=0;o<s;o++)e=i[o],n(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))}requestAnimate(){this.requestAnimateTime=Date.now(),t.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}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}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?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.requestAnimate()}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(jy.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,o=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(o);else{const{attrsMap:i,target:n}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),Jh.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emitType(jy.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 l(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)}};le([Vy("ease")],Uy.prototype,"easing",void 0),le([Vy(0)],Uy.prototype,"delay",void 0),le([Vy(.2)],Uy.prototype,"duration",void 0),le([Vy("auto")],Uy.prototype,"ending",void 0),le([Vy(!1)],Uy.prototype,"reverse",void 0),le([Vy(!1)],Uy.prototype,"swing",void 0),le([Vy(!1)],Uy.prototype,"loop",void 0),le([Vy(0)],Uy.prototype,"loopDelay",void 0),le([Vy(1)],Uy.prototype,"speed",void 0),le([Vy(!0)],Uy.prototype,"autoplay",void 0),le([Vy()],Uy.prototype,"join",void 0),le([Vy()],Uy.prototype,"attrs",void 0),Uy=le([Xn(la)],Uy);let Gy=class extends Uy{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(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Uy(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(jy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(jy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(jy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(jy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case jy.COMPLETED:this.completed&&this.emitType(t);break;case jy.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)}};Gy=le([Xn(la)],Gy);const Ky={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"},qy=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Zy=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Jy=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Qy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,$y=parseInt,tv=parseFloat,{round:ev}=Math;let iv={},sv=0;function ov(t){let e,i,s,o=1;switch(t.length){case 9:e=$y(t.slice(1,3),16),i=$y(t.slice(3,5),16),s=$y(t.slice(5,7),16),o=$y(t.slice(7,9),16)/255;break;case 7:e=$y(t.slice(1,3),16),i=$y(t.slice(3,5),16),s=$y(t.slice(5,7),16);break;case 5:e=$y(t[1]+t[1],16),i=$y(t[2]+t[2],16),s=$y(t[3]+t[3],16),o=$y(t[4]+t[4],16)/255;break;case 4:e=$y(t[1]+t[1],16),i=$y(t[2]+t[2],16),s=$y(t[3]+t[3],16);break;case 3:e=i=s=$y(t[1]+t[2],16);break;case 2:e=i=s=$y(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const nv=1/6,rv=.5,av=2/3,hv=1/3;function lv(t,e,i){return i<0?i++:i>1&&i--,i<nv?t+6*(e-t)*i:i<rv?e:i<av?t+(e-t)*(av-i)*6:t}function dv(t,e,i,s=1){let o,n,r;if(t/=360,i/=100,0===(e/=100))o=n=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;o=lv(a,s,t+hv),n=lv(a,s,t),r=lv(a,s,t-hv)}return{r:ev(255*o),g:ev(255*n),b:ev(255*r),a:s}}te.add("color"),Nh.object=function(t,e){let i,s=!n(e)&&e<1;if(a(t)){const e=iv[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=ov(t);break;case"R":case"r":"("===t[4]&&Zy.test(t)?i=function(t){const e=Zy.exec(t);return{r:$y(e[1]),g:$y(e[2]),b:$y(e[3]),a:tv(e[4])}}(t):"("===t[3]&&qy.test(t)&&(i=function(t){const e=qy.exec(t);return{r:$y(e[1]),g:$y(e[2]),b:$y(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Qy.test(t)?i=function(t){const e=Qy.exec(t);return dv(tv(e[1]),tv(e[2]),tv(e[3]),tv(e[4]))}(t):"("===t[3]&&Jy.test(t)&&(i=function(t){const e=Jy.exec(t);return dv(tv(e[1]),tv(e[2]),tv(e[3]),1)}(t))}if(!i){const e=Ky[t.toLowerCase()];e&&(i=ov("#"+e))}i&&(sv++,sv>1e4&&(iv={},sv=0),iv[t]=Object.assign({},i))}}else g(t)&&(n(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:cv}=Math,{fourNumber:uv}=L,gv={fill:yv,stroke:yv,cornerRadius:(t,e,i)=>l(t)&&l(e)?fv(t,e,i):(t=uv(t),e=uv(e),t.map((t,s)=>fv(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,o=e.length,n=fv(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return l(t)||l(e)?L.float(fv(t,e,i),Math.max(pv(t),pv(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return Jh.setBetweenStyle(o,t,e,o,i,s),o},shadow:vv,innerShadow:vv},_v={value:function(t,e,i){const s=l(t),o=l(e);return s&&o?t+(e-t)*i:o||s?fv(t,e,i):t},number:fv,color:mv,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=Jh;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,o,n)))}};function pv(t){const e=String(t).split(".")[1];return e?e.length:0}function fv(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?cv(o):o}function mv(t,e,i){t=Nh.object(t),e=Nh.object(e);const s=fv(t.r,e.r,i,1)+","+fv(t.g,e.g,i,1)+","+fv(t.b,e.b,i,1),o=fv(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function yv(t,e,i){return a(t)&&a(e)?mv(t,e,i):e}function vv(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:fv((t=t||{}).x,e.x,i),y:fv(t.y,e.y,i),blur:fv(t.blur,e.blur,i),spread:fv(t.spread,e.spread,i),color:mv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}te.add("animate","color"),Zh.canAnimate=!0,Object.assign(Jh.list,gv),Object.assign(Jh,_v);const wv=Cl.prototype;Cl.addAttr("animation",void 0,function(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Cl.addAttr("animationOut",void 0,an),Cl.addAttr("transition",!0,an),Cl.addAttr("transitionOut",void 0,an),wv.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))},wv.animate=function(t,e,i,s){if(n(t))return this.__animate;let o=u(t)&&!e&&i?new Gy(this,t,s):new Uy(this,t,e,s);this.killAnimate(i,o.toStyle);const r=this.__animate;return r&&(o instanceof Gy?o.list.unshift(r):o=new Gy(this,[r,o])),this.__animate=o},wv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Gy&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},wv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(jy.COMPLETED,e)};const xv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],bv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:kv}=Math,{getDerivative:Sv}=ti,Ev={getDistance(t,e,i,s,o,n,r,a,h=1){let l,d,c,u,g,_,p=0,f=h/2;for(let h=0;h<xv.length;h++)l=f*(1+xv[h]),d=f*(1-xv[h]),c=Sv(l,t,i,o,r),u=Sv(l,e,s,n,a),g=Sv(d,t,i,o,r),_=Sv(d,e,s,n,a),p+=bv[h]*(kv(c*c+u*u)+kv(g*g+_*_));return p*f},getRotation(t,e,i,s,o,n,r,a,h){const l=Sv(t,e,s,n,a),d=Sv(t,i,o,r,h);return Math.atan2(d,l)/D},getT(t,e,i,s,o,n,r,a,h,l,d=1){let c=0,u=1,g=t/e,_=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>_;)Bv(i,s,o,n,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,o,n,r,a,h,l){const d=1-e,c=d*i+e*o,u=d*s+e*n,g=d*o+e*r,_=d*n+e*a,p=d*c+e*g,f=d*u+e*_,m=d*p+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*_+e*(d*a+e*l));t.push(Te.C,c,u,p,f,m,y)}},{getDistance:Bv}=Ev,{M:Tv,L:Rv,C:Cv,Z:Ov}=Te,Pv={},Lv={},Av={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case Tv:case Rv:Av.transformPoints(t,e,s,1),s+=3;break;case Cv:Av.transformPoints(t,e,s,3),s+=7;break;case Ov:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Pv.x=t[o],Pv.y=t[o+1],G.toOuterPoint(e,Pv),t[o]=Pv.x,t[o+1]=Pv.y},getMotionPathData(t){let e,i,s,o,n=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(o=t[a],o){case Tv:case Rv:i=t[a+1],s=t[a+2],e=o===Rv&&a>0?ot.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Cv:i=t[a+5],s=t[a+6],e=Ev.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 Ov:a+=1;default:e=0}r.push(e),n+=e}return{total:n,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:o}=t;e=Xh.number(e,t.total);let n,r,a,h,l,d,c,u,g,_=0,p={},f=0,m=0,y=0,v=0;const w=o.length;for(;f<w;){switch(h=o[f],h){case Tv:case Rv:if(r=o[f+1],a=o[f+2],n=s[m],_+n>=e||!t.total)return f||(y=r,v=a),Lv.x=y,Lv.y=v,p.x=r,p.y=a,ot.getDistancePoint(Lv,p,e-_,!0),p.rotation=ot.getAngle(Lv,p),p;y=r,v=a,f+=3;break;case Cv:if(r=o[f+5],a=o[f+6],n=s[m],_+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],g=Ev.getT(e-_,n,y,v,l,d,c,u,r,a,i),ti.getPointAndSet(g,y,v,l,d,c,u,r,a,p),p.rotation=Ev.getRotation(g,y,v,l,d,c,u,r,a),p;y=r,v=a,f+=7;break;case Ov:f+=1;default:n=0}m++,_+=n}return p},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=Xh.number(e,t.total);let r,a,h,l,d,c,u,g,_,p=0,f={},m=0,y=0,v=0,w=0;const x=o.length;for(;m<x;){switch(l=o[m],l){case Tv:case Rv:if(a=o[m+1],h=o[m+2],r=s[y],p+r>=e||!t.total)return m||(v=a,w=h),Lv.x=v,Lv.y=w,f.x=a,f.y=h,ot.getDistancePoint(Lv,f,e-p,!0),n.push(l,f.x,f.y),n;v=a,w=h,m+=3,n.push(l,v,w);break;case Cv:if(d=o[m+1],c=o[m+2],u=o[m+3],g=o[m+4],a=o[m+5],h=o[m+6],r=s[y],p+r>=e)return _=Ev.getT(e-p,r,v,w,d,c,u,g,a,h,i),Ev.cut(n,_,v,w,d,c,u,g,a,h),n;v=a,w=h,m+=7,n.push(l,d,c,u,g,a,h);break;case Ov:m+=1,n.push(l);default:r=0}y++,p+=r}return n}};function Dv(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}te.add("motion-path"),Jh.register("motion",function(t,e,i,s){return g(t)&&(t=Xh.number(t,s.getMotionTotal())),g(e)&&(e=Xh.number(e,s.getMotionTotal())),Jh.number(t||0,e||0,i)}),Jh.register("motionRotation",function(t,e,i){return Jh.number(t,e,i)});const Mv=Cl.prototype,{updateMatrix:Fv,updateAllMatrix:Iv}=ir,{updateBounds:Wv}=_r;function zv(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Nv(t);i.total&&(t.__.__pathForRender=Av.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Iv(t),Wv(t,t)):Fv(t));i&&(t.leafer.created=!0)}}function Yv(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 Nv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Av.getMotionPathData(t.getPath(!0,!0))}function Xv(t,e){return on(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Zh.setStyleName(this,e,i):Zh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Hv(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Vv(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 jv(t,e){g(e)||(e=void 0),Kv(t,e,"in")}function Uv(t,e){const{normalStyle:i}=t;g(e)||(e=void 0),i&&(e||(e=i),Kv(t,e,"out"))}Cl.addAttr("motionPath",void 0,Dv),Cl.addAttr("motionPrecision",1,Dv),Cl.addAttr("motion",void 0,Dv),Cl.addAttr("motionRotation",!0,Dv),Mv.getMotionPathData=function(){return Nv(Yv(this))},Mv.getMotionPoint=function(t){const e=Yv(this),i=Nv(e);if(!i.total)return{};const s=Av.getDistancePoint(i,t,e.motionPrecision);G.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:l(o)&&(s.rotation+=o),s},Mv.getMotionTotal=function(){return this.getMotionPathData().total},Mv.__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],r(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),zv(t))}else zv(this)};const Gv={};function Kv(t,e,i){const{normalStyle:s}=t;e||(e=Gv),e.scale&&(L.assignScale(e,e.scale),delete e.scale),e!==Gv&&Zh.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&r(i[s])&&r(e[s])&&(s="transition");return r(e[s])?i[s]:e[s]}(i,e,t);const n=o?function(t,e){const i=Jv(e,t),s=t.animate();s&&Jv(i,t,s.fromStyle);return i}(t,e):void 0;Zh.canAnimate&&qv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=qv(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete a.animation}t.normalStyle=Zv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=Zv(n,t);t.set(n,"temp"),t.animate([n,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function qv(t){let e;const i={},s=Vv(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&Zh.isState(o,t,s)&&(e=Qv(i,n));const r=i.selectedStyle||t.selectedStyle;r&&Zh.isSelected(t,s)&&(e=Qv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Zh.isPlacehold(t,s)&&(e=Qv(i,a)),Zh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Qv(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&Zh.isFocus(t,s)&&(e=Qv(i,o));const n=i.hoverStyle||t.hoverStyle;n&&Zh.isHover(t,s)&&(e=Qv(i,n));const r=i.pressStyle||t.pressStyle;r&&Zh.isPress(t,s)&&(e=Qv(i,r))}return e?i:void 0}function Zv(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&Zh.animateExcludes[t]||(o[t]=e[t]);return o}function Jv(t,e,i){return Zv(t,e,i,!0)}function Qv(t,e){return Object.assign(t,e),!0}function $v(t,e){const i=t[e];i&&jv(t,i),t.button&&ew(t.children,e)}function tw(t,e,i){i||(i=t.states[e]),jv(t,i),t.button&&ew(t.children,null,e)}function ew(t,e,i){if(!t)return;let s,o;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(o=!0,e){case"hoverStyle":Zh.isHover(s)&&(o=!1);break;case"pressStyle":Zh.isPress(s)&&(o=!1);break;case"focusStyle":Zh.isFocus(s)&&(o=!1)}o&&$v(s,e)}else n(i)||tw(s,i);s.isBranch&&ew(s.children,e,i)}}function iw(t,e){const i=t[e];i&&Uv(t,i),t.button&&ow(t.children,e)}function sw(t,e,i){Uv(t,i),t.button&&ow(t.children,null,e)}function ow(t,e,i){if(!t)return;let s;for(let o=0,r=t.length;o<r;o++)s=t[o],e?iw(s,e):n(i)||sw(s,i),s.isBranch&&ow(s.children,e,i)}function nw(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=Vv(e,i);n&&(s=o[t](n))}return s}function rw(t,e,i){let s=e[t];if(!s&&i){const o=Vv(e,i);o&&(s=o[t])}return s}te.add("state"),Zh.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},Zh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const o=Vv(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},Zh.isSelected=function(t,e){return rw("selected",t,e)},Zh.isDisabled=function(t,e){return rw("disabled",t,e)},Zh.isFocus=function(t,e){return nw("isFocus",t,e)},Zh.isHover=function(t,e){return nw("isHover",t,e)},Zh.isPress=function(t,e){return nw("isPress",t,e)},Zh.isPlacehold=function(t,e){return t.__.__isPlacehold},Zh.isDrag=function(t,e){return nw("isDrag",t,e)},Zh.setStyleName=function(t,e,i){i?tw(t,e,t[e]):sw(t,e,t[e])},Zh.set=function(t,e){const i=t.states[e];i?tw(t,e,i):sw(t,e,i)},Zh.getStyle=qv,Zh.updateStyle=Kv,Zh.updateEventStyle=function(t,e){switch(e){case zd.ENTER:$v(t,"hoverStyle");break;case zd.LEAVE:iw(t,"hoverStyle");break;case zd.DOWN:$v(t,"pressStyle");break;case zd.UP:iw(t,"pressStyle")}};const aw=Cl.prototype;Cl.addAttr("selected",!1,Xv,"selectedStyle"),Cl.addAttr("disabled",!1,Xv,"disabledStyle"),Cl.addAttr("states",{},Hv),Cl.addAttr("state","",Xv),Cl.addAttr("normalStyle",void 0,an),Cl.addAttr("hoverStyle",void 0,Hv),Cl.addAttr("pressStyle",void 0,Hv),Cl.addAttr("focusStyle",void 0,Hv),Cl.addAttr("selectedStyle",void 0,Hv),Cl.addAttr("disabledStyle",void 0,Hv),Cl.addAttr("placeholderStyle",void 0,Hv),Cl.addAttr("button",!1,an),aw.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))},aw.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?$v(this,"focusStyle"):iw(this,"focusStyle")})},aw.updateState=function(){Zh.updateStyle(this,void 0,"in")};const hw=bd.prototype,lw="text";tn(hw,lw,Object.assign(Object.assign({},en(hw,lw)),{set(t){const e=this,i=e.text;e.__setAttr(lw,t)&&(pn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class dw extends ol{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let cw=class extends Cl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}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),!n(t))if(l(t))this.now=t;else if(g(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=Go.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:o,size:n,total:r}=e,{width:a,height:h}=n&&(l(n)?{width:n,height:n}:n)||(r>1?this:t);let d=o?o.x:0,c=o?o.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:h},d+a>=t.width?(d=0,c+=h):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Dr(Dr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:o}=this;o&&(o.FPS&&(i=o.FPS),n(o.loop)||(s=o.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:o}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,o)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};le([An(dw)],cw.prototype,"__",void 0),le([gn()],cw.prototype,"robot",void 0),le([an()],cw.prototype,"actions",void 0),le([an("")],cw.prototype,"action",void 0),le([bn(0)],cw.prototype,"now",void 0),le([an(12)],cw.prototype,"FPS",void 0),le([an(!0)],cw.prototype,"loop",void 0),cw=le([Hn()],cw),te.add("robot");const{Yes:uw,NoAndSkip:gw,YesAndSkip:_w}=s,pw={},fw={},mw={};class yw{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 o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":pw.id=t.substring(1),t=pw;break;case".":fw.className=t.substring(1),t=fw;break;default:mw.tag=t,t=mw}case"object":if(n(t.id)){if(t.tag){const{tag:s}=t,o=u(s);return this.getByMethod(o?this.methods.tags:this.methods.tag,e,i,o?f.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&&ir.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 o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===uw||n===_w){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<gw&&this.eachFind(o.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_(Or.REMOVE,this.__onRemoveChild,this),this.target.on_(Lr.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 vw=Cl.prototype;function ww(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=ee.selector())}vw.find=function(t,e){return ww(this).getBy(t,this,!1,e)},vw.findOne=function(t,e){return ww(this).getBy(t,this,!0,e)},te.add("find"),ee.finder=function(t){return new yw(t)};const{setPoint:xw,addPoint:bw,toBounds:kw}=gt;const Sw={syncExport(e,i,s){let o;qh.running=!0;try{const r=zo.fileType(i),a=i.includes(".");s=zo.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===r)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),o={data:!!a||e.toJSON(s.json)};else if("svg"===r)a&&l(h(e.toSVG(),"svg"),i),o={data:!!a||e.toSVG()};else{let r,a,h=1,l=1;const{worldTransform:d,isLeafer:c,leafer:u,isFrame:g}=e,{slice:_,clip:p,trim:f,screenshot:m,padding:y,onCanvas:v}=s,w=n(s.smooth)?!u||u.config.smooth:s.smooth,x=s.contextSettings||(u?u.config.contextSettings:void 0),b=c&&m&&n(s.fill)?e.fill:s.fill,k=zo.isOpaqueImage(i)||b,S=new ct;if(m)r=!0===m?c?u.canvas.bounds:e.worldRenderBounds:m;else{let t=s.relative||(c?"inner":"local");switch(h=d.scaleX,l=d.scaleY,t){case"inner":S.set(d);break;case"local":S.set(d).divide(e.localTransform),h/=e.scaleX,l/=e.scaleY;break;case"world":h=1,l=1;break;case"page":t=u||e;default:S.set(d).divide(e.getTransform(t));const i=t.worldTransform;h/=h/i.scaleX,l/=l/i.scaleY}r=e.getBounds("render",t)}const E={scaleX:1,scaleY:1};L.getScaleData(s.scale,s.size,r,E);let B=s.pixelRatio||1,{x:T,y:R,width:C,height:O}=new Xt(r).scale(E.scaleX,E.scaleY);p&&(T+=p.x,R+=p.y,C=p.width,O=p.height);const P={exporting:!0,matrix:S.scale(1/E.scaleX,1/E.scaleY).invert().translate(-T,-R).withScale(1/h*E.scaleX,1/l*E.scaleY)};let A,D=ee.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:w,contextSettings:x});_&&(A=e,A.__worldOpacity=0,e=u||e,P.bounds=D.bounds),D.save();const M=g&&!n(b),F=e.get("fill");if(M&&(e.fill=""),t.render(e,D,P),M&&(e.fill=F),D.restore(),A&&A.__updateWorldOpacity(),f){a=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?bw(r,o,n):xw(r={},o,n)),a++;const h=new Xt;return r&&(kw(r,h),h.scale(1/t.pixelRatio).ceil()),h}(D);const t=D,{width:e,height:i}=a,s={x:0,y:0,width:e,height:i,pixelRatio:B};D=ee.canvas(s),D.copyWorld(t,a,s),t.destroy()}if(y){const[t,e,i,s]=L.fourNumber(y),o=D,{width:n,height:r}=o;D=ee.canvas({width:n+s+e,height:r+t+i,pixelRatio:B}),D.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:r}),o.destroy()}k&&D.fillWorld(D.bounds,b||"#FFFFFF","destination-over"),v&&v(D);o={data:"canvas"===i?D:D.export(i,s),width:D.pixelWidth,height:D.pixelHeight,renderBounds:r,trimBounds:a};const I=u&&u.app;I&&I.canvasManager&&I.canvasManager.clearRecycled()}}catch(t){o={data:"",error:t}}return qh.running=!1,o},export(e,i,s){return qh.running=!0,function(t){Ew||(Ew=new Ho);return new Promise(e=>{Ew.add(()=>de(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(o=>new Promise(n=>{const r=()=>de(this,void 0,void 0,function*(){if(!jo.isComplete)return t.requestRender(r);const a=qh.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),o(a),n()});e.updateLayout(),Bw(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))}};let Ew;function Bw(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Bw(t))}const Tw=Se.prototype,Rw=Gt.get("@leafer-in/export");Tw.export=function(t,e){const{quality:i,blob:s}=zo.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Tw.toBlob=function(e,i){return new Promise(s=>{t.origin.canvasToBolb(this.view,e,i).then(t=>{s(t)}).catch(t=>{Rw.error(t),s(null)})})},Tw.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},Tw.saveAs=function(e,i){return new Promise(s=>{t.origin.canvasSaveAs(this.view,e,i).then(()=>{s(!0)}).catch(t=>{Rw.error(t),s(!1)})})},te.add("export"),Object.assign(qh,Sw),Cl.prototype.export=function(t,e){return qh.export(this,t,e)},Cl.prototype.syncExport=function(t,e){return qh.syncExport(this,t,e)},te.add("filter"),Object.assign(Kh,{list:{},register(t,e){Kh.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach(t=>{r=Kh.list[t.type],r&&r.apply(t,e,i,s,o,n)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Kh.list[t.type],e&&(i+=e.getSpread(t))}),i}}),te.add("bright"),Cl.addAttr("bright",!1,kn);export{xt as AlignHelper,Uy as Animate,Hy as AnimateEasing,jy as AnimateEvent,Gy as AnimateList,s as Answer,Ed as App,yt as AroundHelper,qf as Arrow,Gf as ArrowData,Vt as AutoBounds,ti as BezierHelper,Xt as Bounds,Mr as BoundsEvent,Wt as BoundsHelper,Yl as Box,al as BoxData,ch as Branch,_r as BranchHelper,Ca as BranchRender,md as Canvas,wl as CanvasData,he as CanvasManager,Or as ChildEvent,Nh as ColorConvert,ee as Creator,gc as Cursor,f as DataHelper,Gt as Debug,pt as Direction4,ft as Direction9,Id as DragBoundsHelper,Xd as DragEvent,ic as Dragger,Vd as DropEvent,lp as EditBox,ep as EditDataHelper,rp as EditPoint,X_ as EditSelect,W_ as EditSelectHelper,Ip as EditTool,bp as EditToolCreator,Mp as Editor,T_ as EditorEvent,Ep as EditorGroupEvent,yp as EditorHelper,Op as EditorMoveEvent,Lp as EditorRotateEvent,Pp as EditorScaleEvent,Ap as EditorSkewEvent,Gh as Effect,jl as Ellipse,ul as EllipseData,li as EllipseHelper,Cr as Event,re as EventCreator,Qr as Eventer,qh as Export,zo as FileHelper,Kh as Filter,yw as Finder,Km as Flow,S as FourNumberHelper,Nl as Frame,ll as FrameData,Ol as Group,rl as GroupData,Ev as HighBezierHelper,Av as HighCurveHelper,_c as HitCanvasManager,pd as Image,vl as ImageData,Dr as ImageEvent,Go as ImageManager,e as IncrementId,Fp as InnerEditor,Sp as InnerEditorEvent,Oc as Interaction,uc as InteractionBase,Zd as InteractionHelper,qd as KeyEvent,Td as Keyboard,Hr as LayoutEvent,Oh as Layouter,eh as Leaf,Ba as LeafBounds,dr as LeafBoundsHelper,y as LeafData,ca as LeafDataProxy,la as LeafEventer,ir as LeafHelper,Rr as LeafLayout,gh as LeafLevelList,uh as LeafList,ya as LeafMatrix,Ta as LeafRender,Al as Leafer,ph as LeaferCanvas,Se as LeaferCanvasBase,hl as LeaferData,jr as LeaferEvent,$o as LeaferImage,bf as LeaferTypeCreator,_d as Line,dl as LineData,Hp as LineEditTool,L as MathHelper,ct as Matrix,G as MatrixHelper,jd as MoveEvent,Ef as MultiTouchHelper,Hd as MyDragEvent,fd as MyImage,Yd as MyPointerEvent,Ce as NeedConvertToCanvasCommandMap,D as OneRadian,M as PI2,F as PI_2,Vh as Paint,Uh as PaintGradient,jh as PaintImage,kd as Path,Hh as PathArrow,jm as PathArrowModule,To as PathBounds,fs as PathCommandDataHelper,Te as PathCommandMap,Gi as PathConvert,Do as PathCorner,As as PathCreator,pl as PathData,Ks as PathDrawer,Ee as PathHelper,nm as PathMatrixHelper,Ae as PathNumberCommandLengthMap,Le as PathNumberCommandMap,of as PathScaler,Sd as Pen,fl as PenData,Dh as Picker,t as Platform,te as Plugin,lt as Point,ot as PointHelper,Rd as PointerButton,zd as PointerEvent,$l as Polygon,gl as PolygonData,Lr as PropertyEvent,Dl as Rect,cl as RectData,De as RectHelper,Tl as RectRender,Vr as RenderEvent,Lh as Renderer,Nr as ResizeEvent,jo as Resource,cw as Robot,dw as RobotData,Ud as RotateEvent,Jt as Run,Uf as ScrollBar,I_ as SelectArea,Mh as Selector,rd as Star,_l as StarData,Zh as State,jt as StringNumberMap,F_ as Stroker,Gd as SwipeEvent,Xo as TaskItem,Ho as TaskProcessor,bd as Text,Yh as TextConvert,yl as TextData,Dp as TransformTool,Ff as Transformer,Jh as Transition,gt as TwoPointBoundsHelper,Cl as UI,kl as UIBounds,se as UICreator,ol as UIData,Cd as UIEvent,El as UIRender,Xh as UnitConvert,yr as WaitHelper,Xr as WatchEvent,vh as Watcher,Pf as WheelEventHelper,Kd as ZoomEvent,vf as addViewport,wf as addViewportConfig,xn as affectRenderBoundsType,yn as affectStrokeBoundsType,Kf as arrowType,nn as attr,dn as autoLayoutType,gn as boundsType,Wo as canvasPatch,ke as canvasSizeAttrs,zh as createAttr,sn as createDescriptor,Ln as cursorType,An as dataProcessor,an as dataType,on as decorateLeafAttr,Mn as defineDataProcessor,tn as defineKey,rn as defineLeafAttr,kn as dimType,pn as doBoundsType,vn as doStrokeType,Fh as effectType,o as emptyData,On as eraserType,Ar as extraPropertyEventMap,W as getBoundsData,en as getDescriptor,z as getMatrixData,I as getPointData,Pn as hitType,u as isArray,_ as isData,p as isEmptyData,h as isFinite,r as isNull,l as isNumber,g as isObject,a as isString,n as isUndefined,Dn as layoutProcessor,Zr as leaferTransformAttrMap,Cn as maskType,Dv as motionPathType,_n as naturalBoundsType,Sn as opacityType,Mo as path,fn as pathInputType,mn as pathType,Fo as pen,hn as positionType,wp as registerEditTool,xp as registerInnerEditor,Hn as registerUI,Vn as registerUIEvent,Ih as resizeType,zn as rewrite,Yn as rewriteAble,un as rotationType,gf as scaleResize,_f as scaleResizeFontSize,mf as scaleResizeGroup,pf as scaleResizePath,ff as scaleResizePoints,cn as scaleType,ln as scrollType,Rn as sortType,Hv as stateStyleType,Xv as stateType,wn as strokeType,bn as surfaceType,Ht as tempBounds,ut as tempMatrix,dt as tempPoint,c as tryToNumber,yh as useCanvas,Xn as useModule,_h as version,En as visibleType,Wh as zoomLayerType};
2
2
  //# sourceMappingURL=miniapp.module.min.js.map