@leafer/worker 2.0.2 → 2.0.3

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
- var t,e;function i(t,e,i,s){var n,o=arguments.length,r=o<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--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function s(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const n={};function o(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 p(t){return g(t)&&!u(t)}function _(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(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return m(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&m(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign: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(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=o(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,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}}const v={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=v;let x,b,k;const{max:S}=Math,E=[0,0,0,0],B={zero:[...E],tempFour:E,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>T(E,t,e,i,s),toTempAB(t,e,i){k=i?l(t)?e:t:[],l(t)?(x=C(t),b=e):l(e)?(x=t,b=C(e)):(x=t,b=e),4!==x.length&&(x=R(x)),4!==b.length&&(b=R(b))},get(t,e){let i;if(!l(t))switch(t.length){case 4:i=o(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!o(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>l(t)&&l(e)?S(t,e):(O(t,e,i),T(k,S(x[0],b[0]),S(x[1],b[1]),S(x[2],b[2]),S(x[3],b[3]))),add:(t,e,i)=>l(t)&&l(e)?t+e:(O(t,e,i),T(k,x[0]+b[0],x[1]+b[1],x[2]+b[2],x[3]+b[3])),swapAndScale(t,e,i,s){if(l(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[o,r,a,h]=4===t.length?t:R(t);return T(n,a*i,h*e,o*i,r*e)}},{set:T,get:R,setTemp:C,toTempAB:O}=B,{round:L,pow:P,max:A,floor:D,PI:M}=Math,F={within:(t,e,i)=>(g(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber:B.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),F.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=o(e)?1e12:P(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(l(e)?e:e.width||0)/i.width,n=(l(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&F.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>A(D(t),e)/t,randInt:I,randColor:t=>`rgba(${I(255)},${I(255)},${I(255)},${t||1})`};function I(t){return Math.round(Math.random()*t)}const W=M/180,z=2*M,Y=M/2;function X(){return{x:0,y:0}}function N(){return{x:0,y:0,width:0,height:0}}function H(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:V,cos:U,acos:j,sqrt:G}=Math,{float:q}=F,K={};function Z(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Z(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,t.f=r},get:H,getWorld:Z,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){$.toInnerPoint(t,e,K),$.scaleOfInner(t,K,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=U(e*=W),a=V(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*r},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,K),$.rotateOfInner(t,K,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=W,t.a=s+o*i,t.b=n+r*i),e&&(e*=W,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,K),$.skewOfInner(t,K,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*W,r=U(o),a=V(o);if(s||n){const e=s*W,i=n*W;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)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,g,p,_=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=G(n*n+o*o),c=t/d;const e=n/d;u=o>0?j(e):-j(e)}else{c=G(r*r+a*a),d=t/c;const e=r/c;u=Y-(a>0?j(-e):-j(e))}const e=q(U(u)),i=V(u);d=q(d),c=q(c),g=e?q((r/c+i)/e/W,9):0,p=e?q((o/d-i)/e/W,9):0,u=q(u/W)}else d=n,c=a,u=g=p=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=G(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=J,{float:Q}=F,{toInnerPoint:tt,toOuterPoint:et}=J,{sin:it,cos:st,abs:nt,sqrt:ot,atan2:rt,min:at,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=o(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){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=dt.defaultPoint);const s=st(e*=W),n=it(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ut(t,e),gt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=nt(i-t),o=nt(s-e);return ot(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>at(ct(t,e,i,s),ct(i,s,n,o)),getAngle:(t,e)=>pt(t,e)/W,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/W),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>rt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const o=pt(t,e);return n&&(t=e),s||(e={}),e.x=t.x+st(o)*i,e.y=t.y+it(o)*i,e},toNumberPoints(t){let e=t;return g(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>Q(t.x)===Q(e.x)&&Q(t.y)===Q(e.y),reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,setRadius:gt,getAtan2:pt}=dt;class _t{constructor(t,e){this.set(t,e)}set(t,e){return g(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new _t(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const ft=new _t;class mt{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return g(t)?J.copy(this,t):J.set(this,t,e,i,s,n,o),this}setWith(t){return J.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new mt(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,i){return J.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return J.scaleOfInner(this,t,e,i),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,i){return J.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return J.skewOfInner(this,t,e,i),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){J.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){J.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return J.setLayout(this,t,e,i),this}getLayout(t,e,i){return J.getLayout(this,t,e,i)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const yt=new mt,vt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){wt(t,e,i),wt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:wt}=vt;var xt,bt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(xt||(xt={})),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"}(bt||(bt={}));const kt=[{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}];kt.forEach(t=>t.type="percent");const St={directionData:kt,tempPoint:{},get:Et,toPoint(t,e,i,s,n,o){const r=Et(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(o||(i.x-=n.x,i.y-=n.y),r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),St.toPoint(t,e,i,!0),i)};function Et(t){return a(t)?kt[bt[t]]:t}const{toPoint:Bt}=St,Tt={toPoint(t,e,i,s,n,o){Bt(t,i,s,n,e,o)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Ot,toBounds:Lt}=vt,{toOuterPoint:Pt}=J,{float:At,fourNumber:Dt}=F,{floor:Mt,ceil:Ft}=Math;let It,Wt,zt,Yt;const Xt={},Nt={},Ht={},Vt={tempBounds:Ht,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:o,y:r,width:a,height:h}=e;if(u(i)){const e=Dt(i);s?Ut.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ut.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ut.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,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),Ut.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=Ut.maxX(i),e.offsetY=Ut.maxY(i),Ut.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ut.copy(Ht,t),Ut.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),Ut.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:o,f:r}=e;s>0?(i.width=t.width*s,i.x=o+t.x*s):(i.width=t.width*-s,i.x=o+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=r+t.y*n):(i.height=t.height*-n,i.y=r+t.y*n-i.height)}else Xt.x=t.x,Xt.y=t.y,Pt(e,Xt,Nt),Ct(Rt,Nt.x,Nt.y),Xt.x=t.x+t.width,Pt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.y),Xt.y=t.y+t.height,Pt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.y),Xt.x=t.x,Pt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.y),Lt(Rt,i)},toInnerOf(t,e,i){i||(i=t),Ut.move(i,-e.e,-e.f),Ut.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ut.getFitScale(t,e));return new mt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),a(s)&&(s=Ut.getFitScale(t,e,"cover"===s)),Ht.width=n?e.width*=s:e.width*s,Ht.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Ht,t,o,!0,!0)},getSpread(t,e,i){const s={};return Ut.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ut.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ut.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Mt(t.x),t.y=Mt(t.y),t.width=e>t.x?Ft(t.width+e-t.x):Ft(t.width),t.height=i>t.y?Ft(t.height+i-t.y):Ft(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){It=t.x+t.width,Wt=t.y+t.height,zt=e.x,Yt=e.y,i||(zt+=e.width,Yt+=e.height),It=It>zt?It:zt,Wt=Wt>Yt?Wt:Yt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=It-t.x,t.height=Wt-t.y},addList(t,e){Ut.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ut.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ut.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r],r):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||Gt(t,n)):jt(t,n));o&&Ut.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Rt,t.x,t.y):Ot(Rt,t.x,t.y)),Lt(Rt,t)},setPoint(t,e){Ut.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=lt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ut.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=Ut.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=Ut.tempToOuterOf(e,i)),!Ut.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return It=s+o,Wt=n+r,zt=t.x+t.width,Yt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,It=It<zt?It:zt,Wt=Wt<Yt?Wt:Yt,o=It-s,r=Wt-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Ut.copy(t,Ut.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ut.set(t)}},Ut=Vt,{add:jt,copy:Gt}=Ut;class qt{get minX(){return Vt.minX(this)}get minY(){return Vt.minY(this)}get maxX(){return Vt.maxX(this)}get maxY(){return Vt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return g(t)?Vt.copy(this,t):Vt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new qt(this)}move(t,e){return Vt.move(this,t,e),this}scale(t,e,i){return Vt.scale(this,t,e,i),this}scaleOf(t,e,i){return Vt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Vt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Vt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Vt.getFitMatrix(this,t,e)}put(t,e,i){Vt.put(this,t,e,i)}spread(t,e){return Vt.spread(this,t,e),this}shrink(t,e){return Vt.shrink(this,t,e),this}ceil(){return Vt.ceil(this),this}unsign(){return Vt.unsign(this),this}float(t){return Vt.float(this,t),this}add(t){return Vt.add(this,t),this}addList(t){return Vt.setList(this,t,!0),this}setList(t){return Vt.setList(this,t),this}addListWithFn(t,e){return Vt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Vt.setListWithFn(this,t,e),this}setPoint(t){return Vt.setPoint(this,t),this}setPoints(t){return Vt.setPoints(this,t),this}addPoint(t){return Vt.addPoint(this,t),this}getPoints(){return Vt.getPoints(this)}hitPoint(t,e){return Vt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Vt.hitRadiusPoint(this,t,e)}hit(t,e){return Vt.hit(this,t,e)}includes(t,e){return Vt.includes(this,t,e)}intersect(t,e){return Vt.intersect(this,t,e),this}getIntersect(t,e){return new qt(Vt.getIntersectData(this,t,e))}isSame(t){return Vt.isSame(this,t)}isEmpty(){return Vt.isEmpty(this)}reset(){Vt.reset(this)}}const Kt=new qt;class Zt{constructor(t,e,i,s,n,o){g(t)?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new qt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Jt={number:(t,e)=>g(t)?"percent"===t.type?t.value*e:t.value:t},$t={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Qt,max:te}=Math,ee={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||ie.maxCacheSize),isSuperLarge:(t,e,i)=>ie.isLarge(t,e,i,ie.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ie;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,o,r,a,h,l){const d=te(Qt(e+(s||0)),1),c=te(Qt(i+(n||0)),1);let u,g,p;l&&(p=Jt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:g=!0);const _=ee.origin.createCanvas(g?2*d:d,u?2*c:c),f=_.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==r,ie.canUse(t)){if(o){const s=e/o.width,n=i/o.height;f.setTransform(s,0,0,n,-o.x*s,-o.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(_,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(_,0,0,d,c,u?p:d,u?c:p,d,c))}return _},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&f.stintSet(i,"transform",e)}}},{image:ie}=ee,{randColor:se}=F;class ne{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ne(t)}static set filter(t){this.filterList=oe(t)}static set exclude(t){this.excludeList=oe(t)}static drawRepaint(t,e){const i=se();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ne.showBounds,n=t.__nowWorld,o=se();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(re.enable){if(re.filterList.length&&re.filterList.every(t=>t!==this.name))return;if(re.excludeList.length&&re.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){re.enable&&this.warn(...t)}warn(...t){re.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function oe(t){return t?a(t)&&(t=[t]):t=[],t}ne.filterList=[],ne.excludeList=[],ne.showWarn=!0;const re=ne,ae=ne.get("RunTime"),he={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=v.create(v.RUNTIME);return le.currentId=le.idMap[i]=e?performance.now():Date.now(),le.currentName=le.nameMap[i]=t,le.nameToIdMap[t]=i,i},end(t,e){const i=le.idMap[t],s=le.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;le.idMap[t]=le.nameMap[t]=le.nameToIdMap[s]=void 0,ae.log(s,n,"ms")},endOfName(t,e){const i=le.nameToIdMap[t];o(i)||le.end(i,e)}},le=he,de=[],ce={list:{},add(t,...e){this.list[t]=!0,de.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>de.forEach(t=>ce.has(t,!0)));const ue={editor:t=>ce.need("editor")},ge=ne.get("UICreator"),pe={list:{},register(t){const{__tag:e}=t.prototype;_e[e]&&ge.repeat(e),_e[e]=t},get(t,e,i,s,n,r){if(!_e[t])return void ge.warn("not register "+t);const a=new _e[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:_e}=pe,fe=ne.get("EventCreator"),me={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(ye[e]&&fe.repeat(e),ye[e]=t)})},changeName(t,e){const i=ye[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ye[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=me;class ve{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ue.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function we(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}const xe=[];function be(){return(t,e)=>{xe.push(e)}}const ke=[];let Se=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||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){g(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};i([we("imageSmoothingEnabled")],Se.prototype,"smooth",void 0),i([we("imageSmoothingQuality")],Se.prototype,"smoothLevel",void 0),i([we("globalAlpha")],Se.prototype,"opacity",void 0),i([we()],Se.prototype,"fillStyle",void 0),i([we()],Se.prototype,"strokeStyle",void 0),i([we("lineWidth")],Se.prototype,"strokeWidth",void 0),i([we("lineCap")],Se.prototype,"strokeCap",void 0),i([we("lineJoin")],Se.prototype,"strokeJoin",void 0),i([we("lineDashOffset")],Se.prototype,"dashOffset",void 0),i([we()],Se.prototype,"miterLimit",void 0),i([we()],Se.prototype,"shadowBlur",void 0),i([we()],Se.prototype,"shadowColor",void 0),i([we()],Se.prototype,"shadowOffsetX",void 0),i([we()],Se.prototype,"shadowOffsetY",void 0),i([we()],Se.prototype,"filter",void 0),i([we()],Se.prototype,"font",void 0),i([we()],Se.prototype,"fontKerning",void 0),i([we()],Se.prototype,"fontStretch",void 0),i([we()],Se.prototype,"fontVariantCaps",void 0),i([we()],Se.prototype,"textAlign",void 0),i([we()],Se.prototype,"textBaseline",void 0),i([we()],Se.prototype,"textRendering",void 0),i([we()],Se.prototype,"wordSpacing",void 0),i([we()],Se.prototype,"letterSpacing",void 0),i([we()],Se.prototype,"direction",void 0),i([be()],Se.prototype,"setTransform",null),i([be()],Se.prototype,"resetTransform",null),i([be()],Se.prototype,"getTransform",null),i([be()],Se.prototype,"save",null),i([be()],Se.prototype,"restore",null),i([be()],Se.prototype,"translate",null),i([be()],Se.prototype,"scale",null),i([be()],Se.prototype,"rotate",null),i([be()],Se.prototype,"fill",null),i([be()],Se.prototype,"stroke",null),i([be()],Se.prototype,"clip",null),i([be()],Se.prototype,"fillRect",null),i([be()],Se.prototype,"strokeRect",null),i([be()],Se.prototype,"clearRect",null),i([be()],Se.prototype,"beginPath",null),i([be()],Se.prototype,"moveTo",null),i([be()],Se.prototype,"lineTo",null),i([be()],Se.prototype,"bezierCurveTo",null),i([be()],Se.prototype,"quadraticCurveTo",null),i([be()],Se.prototype,"closePath",null),i([be()],Se.prototype,"arc",null),i([be()],Se.prototype,"arcTo",null),i([be()],Se.prototype,"ellipse",null),i([be()],Se.prototype,"rect",null),i([be()],Se.prototype,"roundRect",null),i([be()],Se.prototype,"createConicGradient",null),i([be()],Se.prototype,"createLinearGradient",null),i([be()],Se.prototype,"createPattern",null),i([be()],Se.prototype,"createRadialGradient",null),i([be()],Se.prototype,"fillText",null),i([be()],Se.prototype,"measureText",null),i([be()],Se.prototype,"strokeText",null);const{copy:Ee,multiplyParent:Be,pixelScale:Te}=J,{round:Re}=Math,Ce=new qt,Oe=new qt,Le={width:1,height:1,pixelRatio:1},Pe=["width","height","pixelRatio"];class Ae extends Se{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Le),this.manager=e,this.innerId=v.create(v.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||ee.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,Pe),Pe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Be(t,e,n),Te(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Re(n.e-.5)+.5,n.f=Re(n.f-.5)+.5):(n.e=Re(n.e),n.f=Re(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Oe):i=Ce,this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Vt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,o){this.resetTransform(),this.copyWorld(t,e,i,s,o),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Ce.x,Ce.y,Ce.width,Ce.height),{data:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?i:e*(i/255));s.putImageData(n,Ce.x,Ce.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ce.x,Ce.y,Ce.width,Ce.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ce.x,Ce.y,Ce.width,Ce.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ce,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Oe,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ue.canvas(Object.assign({},i));return n.save(),t&&(Ee(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const De={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Me={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Fe=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},Me),Ie={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},We={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},ze=Object.assign(Object.assign({},We),Me),Ye=Fe,Xe={};for(let t in Ye)Xe[Ye[t]]=t;const Ne={};for(let t in Ye)Ne[Ye[t]]=Ie[t];const He={drawRoundRect(t,e,i,s,n,o){const r=F.fourNumber(o,Math.min(s/2,n/2)),a=e+s,h=i+n;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:Ve,cos:Ue,hypot:je,atan2:Ge,ceil:qe,abs:Ke,PI:Ze,sqrt:Je,pow:$e}=Math,{setPoint:Qe,addPoint:ti}=vt,{set:ei,toNumberPoints:ii}=lt,{M:si,L:ni,C:oi,Q:ri,Z:ai}=Fe,hi={},li={points(t,e,i,s){let n=ii(e);if(t.push(si,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,g,p,_,f,m,y,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=r-e,_=a-o,f=Je($e(p,2)+$e(_,2)),m=Je($e(h-r,2)+$e(l-a,2)),(f||m)&&(y=f+m,f=w*f/y,m=w*m/y,h-=e,l-=o,d=r-f*h,c=a-f*l,2===i?s||t.push(ri,d,c,r,a):(p||_)&&t.push(oi,u,g,d,c,r,a),u=r+m*h,g=a+m*l);s||t.push(ri,u,g,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ni,n[e],n[e+1]);s&&t.push(ai)},rect(t,e,i,s,n){De.creator.path=t,De.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,o){De.creator.path=[],He.drawRoundRect(De.creator,e,i,s,n,o),t.push(...De.convertToCanvasData(De.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,g=o-s,p=r-n;let _=Ge(u,c),f=Ge(p,g);const m=je(c,u),y=je(g,p);let v=f-_;if(v<0&&(v+=z),m<1e-12||y<1e-12||v<1e-12||Ke(v-Ze)<1e-12)return t&&t.push(ni,s,n),h&&(Qe(h,e,i),ti(h,s,n)),d&&ei(d,e,i),void(l&&ei(l,s,n));const w=c*p-g*u<0,x=w?-1:1,b=a/Ue(v/2),k=s+b*Ue(_+v/2+Y*x),S=n+b*Ve(_+v/2+Y*x);return _-=Y*x,f-=Y*x,ui(t,k,S,a,a,0,_/W,f/W,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>ui(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,l,d,c){const u=o*W,g=Ve(u),p=Ue(u);let _=r*W,f=a*W;_>Ze&&(_-=z),f<0&&(f+=z);let m=f-_;m<0?m+=z:m>z&&(m-=z),h&&(m-=z);const y=qe(Ke(m/Y)),v=m/y,w=Ve(v/4),x=8/3*w*w/Ve(v/2);f=_+v;let b,k,S,E,B,T,R,C,O=Ue(_),L=Ve(_),P=S=p*s*O-g*n*L,A=E=g*s*O+p*n*L,D=e+S,M=i+E;t&&t.push(t.length?ni:si,D,M),l&&Qe(l,D,M),c&&ei(c,D,M);for(let o=0;o<y;o++)b=Ue(f),k=Ve(f),S=p*s*b-g*n*k,E=g*s*b+p*n*k,B=e+P-x*(p*s*L+g*n*O),T=i+A-x*(g*s*L-p*n*O),R=e+S+x*(p*s*k+g*n*b),C=i+E+x*(g*s*k-p*n*b),t&&t.push(oi,B,T,R,C,e+S,i+E),l&&ci(e+P,i+A,B,T,R,C,e+S,i+E,l,!0),P=S,A=E,O=b,L=k,_=f,f+=v;d&&ei(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(oi,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,g,p,_,f,m,y,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,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;p=-g/u,0<p&&p<1&&d.push(p)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?ti(h,t,e):Qe(h,t,e),ti(h,r,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,n,o,r,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,p=t*t*t;l.x=c*e+u*s+g*o+p*a,l.y=c*i+u*n+g*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return di(t,e,i,s,n,o,r,a,h,l),l},getDerivative(t,e,i,s,n){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:gi,cos:pi,sqrt:_i,atan2:fi}=Math,{ellipse:mi}=li,yi={ellipticalArc(t,e,i,s,n,o,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=o*W,p=gi(g),_=pi(g),f=-_*c-p*u,m=-_*u+p*c,y=s*s,v=n*n,w=m*m,x=f*f,b=y*v-y*w-v*x;let k=0;if(b<0){const t=_i(1-b/(y*v));s*=t,n*=t}else k=(r===a?-1:1)*_i(b/(y*w+v*x));const S=k*s*m/n,E=-k*n*f/s,B=fi((m-E)/n,(f-S)/s),T=fi((-m-E)/n,(-f-S)/s);let R=T-B;0===a&&R>0?R-=z:1===a&&R<0&&(R+=z);const C=e+c+_*S-p*E,O=i+u+p*S+_*E,L=R<0?1:0;d||ee.ellipseToCurve?mi(t,C,O,s,n,o,B/W,T/W,L):s!==n||o?t.push(Fe.G,C,O,s,n,o,B/W,T/W,L):t.push(Fe.O,C,O,s,B/W,T/W,L)}},vi={toCommand:t=>[],toNode:t=>[]},{M:wi,m:xi,L:bi,l:ki,H:Si,h:Ei,V:Bi,v:Ti,C:Ri,c:Ci,S:Oi,s:Li,Q:Pi,q:Ai,T:Di,t:Mi,A:Fi,a:Ii,Z:Wi,z:zi,N:Yi,D:Xi,X:Ni,G:Hi,F:Vi,O:Ui,P:ji,U:Gi}=Fe,{rect:qi,roundRect:Ki,arcTo:Zi,arc:Ji,ellipse:$i,quadraticCurveTo:Qi}=li,{ellipticalArc:ts}=yi,es=ne.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=Ne[s],a+=s===n?" ":Xe[s];for(let s=1;s<i;s++)a+=F.float(t[o+s],e),s===i-1||(a+=" ");n=s,o+=i}return a},parse(t,e){let i,s,n,o="";const r=[],a=e?ze:We;for(let e=0,h=t.length;e<h;e++)s=t[e],$t[s]?("."===s&&(ns.dot&&(os(r,o),o=""),ns.dot++),"0"===o&&"."!==s&&(os(r,o),o=""),o+=s):Fe[s]?(o&&(os(r,o),o=""),ns.name=Fe[s],ns.length=Ie[s],ns.index=0,os(r,ns.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&os(r,o),o=s):o&&(os(r,o),o=""),n=s;return o&&os(r,o),i?ss.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(n=t[c],n){case xi:t[c+1]+=a,t[c+2]+=h;case wi:a=t[c+1],h=t[c+2],g.push(wi,a,h),c+=3;break;case Ei:t[c+1]+=a;case Si:a=t[c+1],g.push(bi,a,h),c+=2;break;case Ti:t[c+1]+=h;case Bi:h=t[c+1],g.push(bi,a,h),c+=2;break;case ki:t[c+1]+=a,t[c+2]+=h;case bi:a=t[c+1],h=t[c+2],g.push(bi,a,h),c+=3;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Oi;case Oi:r=o===Ri||o===Oi,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(Ri,l,d,i,s,a,h),c+=5;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ri;case Ri:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ri,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Mi:t[c+1]+=a,t[c+2]+=h,n=Di;case Di:r=o===Pi||o===Di,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Qi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Pi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ai:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Pi;case Pi:i=t[c+1],s=t[c+2],e?Qi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Pi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ii:t[c+6]+=a,t[c+7]+=h;case Fi:ts(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 zi:case Wi:g.push(Wi),c++;break;case Yi:a=t[c+1],h=t[c+2],e?qi(g,a,h,t[c+3],t[c+4]):rs(g,t,c,5),c+=5;break;case Xi:a=t[c+1],h=t[c+2],e?Ki(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):rs(g,t,c,9),c+=9;break;case Ni:a=t[c+1],h=t[c+2],e?Ki(g,a,h,t[c+3],t[c+4],t[c+5]):rs(g,t,c,6),c+=6;break;case Hi:$i(e?g:rs(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,is),a=is.x,h=is.y,c+=9;break;case Vi:e?$i(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):rs(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ui:Ji(e?g:rs(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,is),a=is.x,h=is.y,c+=7;break;case ji:e?Ji(g,t[c+1],t[c+2],t[c+3],0,360,!1):rs(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Gi:Zi(e?g:rs(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,is),a=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${n} [index:${c}]`,t),g}o=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(wi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ri,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Pi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:os,copyData:rs}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:gs,X:ps,G:_s,F:fs,O:ms,P:ys,U:vs}=Fe,{getMinDistanceFrom:ws,getRadianFrom:xs}=lt,{tan:bs,min:ks,abs:Ss}=Math,Es={},Bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(ls,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(ds,e,i,s,n)},closePath(t){t.push(cs)},rect(t,e,i,s,n){t.push(us,e,i,s,n)},roundRect(t,e,i,s,n,o){if(l(o))t.push(ps,e,i,s,n,o);else{const r=F.fourNumber(o);r?t.push(gs,e,i,s,n,...r):t.push(us,e,i,s,n)}},ellipse(t,e,i,s,n,o,a,h,l){if(s===n)return Rs(t,e,i,s,a,h,l);r(o)?t.push(fs,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(_s,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(ys,e,i,s):(r(n)&&(n=0),r(o)&&(o=360),t.push(ms,e,i,s,n,o,a?1:0))},arcTo(t,e,i,s,n,r,a,h,l){if(!o(a)){const t=ws(a,h,e,i,s,n)/(l?1:2);r=ks(r,ks(t,t*Ss(bs(xs(a,h,e,i,s,n)/2))))}t.push(vs,e,i,s,n,r)},drawEllipse(t,e,i,s,n,o,a,h,l){li.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,Es),t.push(as,Es.x,Es.y),Ts(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){li.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,Es),t.push(as,Es.x,Es.y),Rs(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Ts,arc:Rs}=Bs,{moveTo:Cs,lineTo:Os,quadraticCurveTo:Ls,bezierCurveTo:Ps,closePath:As,beginPath:Ds,rect:Ms,roundRect:Fs,ellipse:Is,arc:Ws,arcTo:zs,drawEllipse:Ys,drawArc:Xs,drawPoints:Ns}=Bs;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?De.parse(t):t:[],this}beginPath(){return Ds(this.__path),this.paint(),this}moveTo(t,e){return Cs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Os(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return Ps(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return As(this.__path),this.paint(),this}rect(t,e,i,s){return Ms(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Fs(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return Is(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return Ws(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return zs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return Ys(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return Xs(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return Ns(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Vs,L:Us,C:js,Q:Gs,Z:qs,N:Ks,D:Zs,X:Js,G:$s,F:Qs,O:tn,P:en,U:sn}=Fe,nn=ne.get("PathDrawer"),on={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Vs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Us:t.lineTo(e[s+1],e[s+2]),s+=3;break;case js:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case qs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Zs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*W,e[s+6]*W,e[s+7]*W,e[s+8]),s+=9;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,z,!1),s+=5;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*W,e[s+5]*W,e[s+6]),s+=7;break;case en:t.arc(e[s+1],e[s+2],e[s+3],0,z,!1),s+=4;break;case sn:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void nn.error(`command: ${i} [index:${s}]`,e)}}},{M:rn,L:an,C:hn,Q:ln,Z:dn,N:cn,D:un,X:gn,G:pn,F:_n,O:fn,P:mn,U:yn}=Fe,{toTwoPointBounds:vn,toTwoPointBoundsByQuadraticCurve:wn,arcTo:xn,arc:bn,ellipse:kn}=li,{addPointBounds:Sn,copy:En,addPoint:Bn,setPoint:Tn,addBounds:Rn,toBounds:Cn}=vt,On=ne.get("PathBounds");let Ln,Pn,An;const Dn={},Mn={},Fn={},In={toBounds(t,e){In.toTwoPointBounds(t,Mn),Cn(Mn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Tn(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===dn||r===hn||r===ln?Tn(e,h,l):Tn(e,t[a+1],t[a+2])),r){case rn:case an:h=t[a+1],l=t[a+2],Bn(e,h,l),a+=3;break;case hn:n=t[a+5],o=t[a+6],vn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,Dn),Sn(e,Dn),h=n,l=o,a+=7;break;case ln:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],wn(h,l,i,s,n,o,Dn),Sn(e,Dn),h=n,l=o,a+=5;break;case dn:a+=1;break;case cn:h=t[a+1],l=t[a+2],Rn(e,h,l,t[a+3],t[a+4]),a+=5;break;case un:case gn:h=t[a+1],l=t[a+2],Rn(e,h,l,t[a+3],t[a+4]),a+=r===un?9:6;break;case pn:kn(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],Dn,Fn),0===a?En(e,Dn):Sn(e,Dn),h=Fn.x,l=Fn.y,a+=9;break;case _n:h=t[a+1],l=t[a+2],Pn=t[a+3],An=t[a+4],Rn(e,h-Pn,l-An,2*Pn,2*An),h+=Pn,a+=5;break;case fn:bn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Dn,Fn),0===a?En(e,Dn):Sn(e,Dn),h=Fn.x,l=Fn.y,a+=7;break;case mn:h=t[a+1],l=t[a+2],Ln=t[a+3],Rn(e,h-Ln,l-Ln,2*Ln,2*Ln),h+=Ln,a+=4;break;case yn:xn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Dn,Fn),0===a?En(e,Dn):Sn(e,Dn),h=Fn.x,l=Fn.y,a+=6;break;default:return void On.error(`command: ${r} [index:${a}]`,t)}}},{M:Wn,L:zn,Z:Yn}=Fe,{getCenterX:Xn,getCenterY:Nn}=lt,{arcTo:Hn}=Bs,Vn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,g=0,p=0,_=0;u(e)&&(e=e[0]||0);const f=t.length,m=9===f,y=[];for(;r<f;){switch(s=t[r],s){case Wn:l=p=t[r+1],d=_=t[r+2],r+=3,t[r]===zn?(c=t[r+1],g=t[r+2],m?y.push(Wn,l,d):y.push(Wn,Xn(l,c),Nn(d,g))):y.push(Wn,l,d);break;case zn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case zn:Hn(y,a,h,t[r+1],t[r+2],e,p,_,m);break;case Yn:Hn(y,a,h,l,d,e,p,_,m);break;default:y.push(zn,a,h)}p=a,_=h;break;case Yn:n!==Yn&&(Hn(y,l,d,c,g,e,p,_,m),y.push(Yn)),r+=1;break;default:o=Ne[s];for(let e=0;e<o;e++)y.push(t[r+e]);r+=o}n=s}return s!==Yn&&(y[1]=l,y[2]=d),y}};function Un(t){return new Hs(t)}const jn=Un();De.creator=Un(),De.parse=ss.parse,De.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:Gn}=He;function qn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Gn(this,t,e,i,s,n)})}(t)}const Kn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Zn.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Zn=Kn;Zn.mineType=Zn.mimeType,Zn.alphaPixelTypes.forEach(t=>Zn.upperCaseTypeMap[t]=t.toUpperCase());const Jn=ne.get("TaskProcessor");class $n{constructor(t){this.parallel=!0,this.time=1,this.id=v.create(v.TASK),this.task=t}run(){return s(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Jn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Qn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&f.assign(this.config,t),this.empty()}add(t,e,i){let s,n,r,a;const h=new $n(t);return h.parent=this,l(e)?a=e:e&&(n=e.parallel,s=e.start,r=e.time,a=e.delay,i||(i=e.canUse)),r&&(h.time=r),!1===n&&(h.parallel=!1),i&&(h.canUse=i),o(a)?this.push(h,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(h,s))},a)),this.isComplete=!1,h}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const to=ne.get("Resource"),eo={tasker:new Qn,queue:new Qn({parallel:1}),map:{},get isComplete(){return io.tasker.isComplete},set(t,e){io.map[t]&&to.repeat(t),io.map[t]=e},get:t=>io.map[t],remove(t){const e=io.map[t];e&&(e.destroy&&e.destroy(),delete io.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ue.image(s)),io.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){io.map={}}},io=eo,so={maxRecycled:10,recycledList:[],patternTasker:eo.queue,get(t,e){let i=eo.get(t.url);return i||eo.set(t.url,i="film"===e?ue.film(t):ue.image(t)),i.use++,i},recycle(t){t.use--,setTimeout(()=>{t.use||(ee.image.isLarge(t)?t.url&&eo.remove(t.url):(t.clearLevels(),no.recycledList.push(t)))})},recyclePaint(t){no.recycle(t.image)},clearRecycled(t){const e=no.recycledList;(e.length>no.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&eo.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Kn.alphaPixelTypes.some(e=>no.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Kn.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Kn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},no=so,{IMAGE:oo,create:ro}=v;class ao{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return o(t)?ee.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=ro(oo),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}so.isFormat("svg",t)&&(this.isSVG=!0),so.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,eo.tasker.add(()=>s(this,void 0,void 0,function*(){return yield ee.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,o,r,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=ee.image.resize(this.view,t,e,n,o,void 0,r,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=ee.canvas.createPattern(t,e);return ee.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,o,r,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}class ho extends ao{get tag(){return"Film"}}class lo extends ao{get tag(){return"Video"}}function co(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function uo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function go(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function po(t,e){return(i,s)=>fo(i,s,t,e&&e(s))}function _o(t){return t}function fo(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};co(t,e,Object.assign(n,s||{})),Uo(t,e,i)}function mo(t){return po(t)}function yo(t,e){return po(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function vo(t,e){return po(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function wo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Eo(this))}}))}function xo(t,e){return po(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function bo(t,e){return po(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function ko(t,e){return po(t,t=>({set(i){this.__setAttr(t,i,e)&&Eo(this)}}))}function So(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(Eo(this),this.__.__removeNaturalSize())}}))}function Eo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Bo(t){return po(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Eo(this)}}))}const To=ko;function Ro(t,e){return po(t,t=>({set(i){this.__setAttr(t,i)&&(Co(this),e&&(this.__.__useStroke=!0))}}))}function Co(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Eo(t)}const Oo=Ro;function Lo(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Po(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Ao(t){return po(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 Do(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Fo(this)}}))}function Mo(t){return po(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Io(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Io(this,t,e,i),this.mask&&Fo(this)}}))}function Fo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Io(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Eo(t))}function Wo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function zo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Yo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Xo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ne.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function No(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Ho(t){return(e,i)=>{co(e,"__DataProcessor",{get:()=>t})}}function Vo(t){return(e,i)=>{co(e,"__LayoutProcessor",{get:()=>t})}}function Uo(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=go(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(g(i)){const t=_(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=uo(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),co(s,e,a)}const jo=new ne("rewrite"),Go=[],qo=["destroy","constructor"];function Ko(t){return(e,i)=>{Go.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Zo(){return t=>{Jo()}}function Jo(t){Go.length&&(Go.forEach(e=>{t&&jo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Go.length=0)}function $o(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(qo.includes(s)||e&&e.includes(s)))if(t.prototype){uo(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Qo(){return t=>{pe.register(t)}}function tr(){return t=>{me.register(t)}}setTimeout(()=>Jo(!0));const{copy:er,toInnerPoint:ir,toOuterPoint:sr,scaleOfOuter:nr,rotateOfOuter:or,skewOfOuter:rr,multiplyParent:ar,divideParent:hr,getLayout:lr}=J,dr={},{round:cr}=Math,ur={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),_r(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)pr(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++)fr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&fr(t),t.__updateChange()},updateAllChange(t){if(yr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)mr(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,o){s||(s=t.__nowWorld),t.__worldFlipped||ee.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,o):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const o=g(e)?Object.assign({},e):{x:e,y:i};s?sr(t.localTransform,o,o,!0):t.parent&&ir(t.parent.scrollWorldTransform,o,o,!0),gr.moveLocal(t,o.x,o.y,n)},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=cr(e),i=cr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){gr.zoomOfLocal(t,vr(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(l(s)||(s&&(o=s),s=i),er(dr,r),nr(dr,e,i,s),gr.hasHighPosition(t))gr.setTransform(t,dr,n,o);else{const e=t.x+dr.e-r.e,a=t.y+dr.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){gr.rotateOfLocal(t,vr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;er(dr,n),or(dr,e,i),gr.hasHighPosition(t)?gr.setTransform(t,dr,!1,s):t.set({x:t.x+dr.e-n.e,y:t.y+dr.f-n.f,rotation:F.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){gr.skewOfLocal(t,vr(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){er(dr,t.__localMatrix),rr(dr,e,i,s),gr.setTransform(t,dr,n,o)},transformWorld(t,e,i,s){er(dr,t.worldTransform),ar(dr,e),t.parent&&hr(dr,t.parent.scrollWorldTransform),gr.setTransform(t,dr,i,s)},transform(t,e,i,s){er(dr,t.localTransform),ar(dr,e),gr.setTransform(t,dr,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&gr.getInnerOrigin(t,n.origin),r=lr(e,o,n.around&&gr.getInnerOrigin(t,n.around));if(gr.hasOffset(t)&&(r.x-=n.offsetX,r.y-=n.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){Vt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=gr.getInnerOrigin(t,n.origin);lt.move(r,o.x-s.x,o.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 nr(i,gr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(gr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return St.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(er(dr,t.worldTransform),hr(dr,e.scrollWorldTransform),i?dr:Object.assign({},dr)),drop(t,e,i,s){t.setTransform(gr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||gr.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),ee.requestRender(()=>gr.animateMove(t,e,i))}}},gr=ur,{updateAllMatrix:pr,updateMatrix:_r,updateAllWorldOpacity:fr,updateAllChange:mr,updateChange:yr}=gr;function vr(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const wr={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)=>br(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>br(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>br(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 xr;function br(t,e){return e||(xr=0),t.__.mask&&(xr=1),xr<0?null:(xr&&(xr=-1),!0)}const{updateBounds:kr}=ur,Sr={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Er(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)Br(e[t],e)},updateBounds(t,e){const i=[t];Br(t,i),Tr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)kr(s[t]);e&&e===i||kr(i)}},move(t,e,i){let s;const{children:n}=t;for(let o=0,r=n.length;o<r;o++)s=(t=n[o]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Rr(t,e,i)},scale(t,e,i,s,n,o,r){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-o)*l+e,a.y=a.f+=(a.f-r)*d+i):(a.e+=(a.e-o)*l+e,a.f+=(a.f-r)*d+i,a.x+=(a.x-o)*l+e,a.y+=(a.y-r)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&Cr(t,e,i,s,n,o,r)}},{pushAllChildBranch:Er,pushAllBranchStack:Br,updateBoundsByBranchStack:Tr,move:Rr,scale:Cr}=Sr,Or={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:Lr,updateBounds:Pr}=ur,{toOuterOf:Ar,getPoints:Dr,copy:Mr}=Vt,Fr="_localContentBounds",Ir="_worldContentBounds",Wr="_worldBoxBounds",zr="_worldStrokeBounds";class Yr{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 Ar(this.contentBounds,this.leaf.__localMatrix,this[Fr]||(this[Fr]={})),this[Fr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ar(this.contentBounds,this.leaf.__world,this[Ir]||(this[Ir]={})),this[Ir]}get worldBoxBounds(){return Ar(this.boxBounds,this.leaf.__world,this[Wr]||(this[Wr]={})),this[Wr]}get worldStrokeBounds(){return Ar(this.strokeBounds,this.leaf.__world,this[zr]||(this[zr]={})),this[zr]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Pr(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,ee.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return J.defaultMatrix;case"page":t=e.zoomLayer;default:return Lr(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=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},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=J.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=Lr(s,e,!0)}if(r||(r=J.getLayout(o)),Mr(r,a),lt.copy(r,n),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=Dr(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Xr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&ee.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&ee.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&ee.event.stop(this.origin)}}class Nr extends Xr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Nr.ADD="child.add",Nr.REMOVE="child.remove",Nr.CREATED="created",Nr.MOUNTED="mounted",Nr.UNMOUNTED="unmounted",Nr.DESTROY="destroy";const Hr="property.scroll";class Vr extends Xr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Vr.CHANGE="property.change",Vr.LEAFER_CHANGE="property.leafer_change",Vr.SCROLL=Hr;const Ur={scrollX:Hr,scrollY:Hr};class jr extends Xr{constructor(t,e){super(t),Object.assign(this,e)}}jr.LOAD="image.load",jr.LOADED="image.loaded",jr.ERROR="image.error";class Gr extends Xr{static checkHas(t,e,i){"on"===i?e===Jr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(qr)||t.hasEvent(Kr)||t.hasEvent(Zr),t.__hasWorldEvent=t.hasEvent(Jr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(qr,t),"inner"===e&&t.emit(Kr,t)),t.emit(Zr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Jr,this)}}Gr.RESIZE="bounds.resize",Gr.INNER="bounds.inner",Gr.LOCAL="bounds.local",Gr.WORLD="bounds.world";const{RESIZE:qr,INNER:Kr,LOCAL:Zr,WORLD:Jr}=Gr,$r={};[qr,Kr,Zr,Jr].forEach(t=>$r[t]=1);class Qr extends Xr{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(Qr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Qr.RESIZE="resize";class ta extends Xr{constructor(t,e){super(t),this.data=e}}ta.REQUEST="watch.request",ta.DATA="watch.data";class ea extends Xr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ea.REQUEST="layout.request",ea.START="layout.start",ea.BEFORE="layout.before",ea.LAYOUT="layout",ea.AFTER="layout.after",ea.AGAIN="layout.again",ea.END="layout.end";class ia extends Xr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ia.REQUEST="render.request",ia.CHILD_START="render.child_start",ia.CHILD_END="render.child_end",ia.START="render.start",ia.BEFORE="render.before",ia.RENDER="render",ia.AFTER="render.after",ia.AGAIN="render.again",ia.END="render.end",ia.NEXT="render.next";class sa extends Xr{}sa.START="leafer.start",sa.BEFORE_READY="leafer.before_ready",sa.READY="leafer.ready",sa.AFTER_READY="leafer.after_ready",sa.VIEW_READY="leafer.view_ready",sa.VIEW_COMPLETED="leafer.view_completed",sa.STOP="leafer.stop",sa.RESTART="leafer.restart",sa.END="leafer.end",sa.UPDATE_MODE="leafer.update_mode",sa.TRANSFORM="leafer.transform",sa.MOVE="leafer.move",sa.SCALE="leafer.scale",sa.ROTATE="leafer.rotate",sa.SKEW="leafer.skew";const{MOVE:na,SCALE:oa,ROTATE:ra,SKEW:aa}=sa,ha={x:na,y:na,scaleX:oa,scaleY:oa,rotation:ra,skewX:aa,skewY:aa},la={};class da{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const r=ca(this,s,!0),h=a(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(o=r[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):r[t]=[l],$r[t]&&Gr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=ca(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],$r[t]&&Gr.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&&me.has(t)&&(e=me.get(t,{type:t,target:this,current:this}));const s=ca(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ca(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:la)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:la)}}const{on:ua,on_:ga,off:pa,off_:_a,once:fa,emit:ma,emitEvent:ya,hasEvent:va,destroy:wa}=da.prototype,xa={on:ua,on_:ga,off:pa,off_:_a,once:fa,emit:ma,emitEvent:ya,hasEvent:va,destroyEventer:wa},ba=ne.get("setAttr"),ka={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||o(e)||(ba.warn(this.innerName,t,e),e=void 0),g(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Vr(Vr.LEAFER_CHANGE,this,t,s,e));const i=ha[t];i&&(this.emitEvent(new sa(i,this)),this.emitEvent(new sa(sa.TRANSFORM,this)))}this.emitPropertyEvent(Vr.CHANGE,t,s,e);const i=Ur[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new Vr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Sa,multiplyParent:Ea,translateInner:Ba,defaultWorld:Ta}=J,{toPoint:Ra,tempPoint:Ca}=St,Oa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;Ea(this.__local||e,t?t.__scrollWorld||t.__world:Ta,i,!!e.affectScaleOrRotation,n),s&&Ba(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Sa(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)&&(Ra(i.around||i.origin,t.boxBounds,Ca),Ba(e,-Ca.x,-Ca.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:La,updateAllMatrix:Pa}=ur,{updateBounds:Aa}=Sr,{toOuterOf:Da,copyAndSpread:Ma,copy:Fa}=Vt,{toBounds:Ia}=In,Wa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Da(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Gr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Gr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Da(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Da(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Da(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Ia(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(),Pa(this),Aa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Pa(this),Aa(this,this))):La(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ma(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;l(i)&&i<=0?Fa(e.renderBounds,e.strokeBounds):Ma(e.renderBounds,e.boxBounds,i)}},za={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ur.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ne.showBounds&&ne.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ya}=wr,{hasSize:Xa}=Vt,Na={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Xa(i)){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,o=s.length;n<o;n++)i=s[n],Ya(i,e)||(i.__.complex?i.__renderComplex(t,e):i.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ya(i[s],e)||i[s].__clip(t,e)}}},Ha={},{LEAF:Va,create:Ua}=v,{stintSet:ja}=f,{toInnerPoint:Ga,toOuterPoint:qa,multiplyParent:Ka}=J,{toOuterOf:Za}=Vt,{copy:Ja,move:$a}=lt,{moveLocal:Qa,zoomOfLocal:th,rotateOfLocal:eh,skewOfLocal:ih,moveWorld:sh,zoomOfWorld:nh,rotateOfWorld:oh,skewOfWorld:rh,transform:ah,transformWorld:hh,setTransform:lh,getFlipTransform:dh,getLocalOrigin:ch,getRelativeWorld:uh,drop:gh}=ur;let ph=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 Yr}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=Ua(Va),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Nr.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(Nr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Nr.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(Nr.MOUNTED)):this.__emitLifeEvent(Nr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ka(i,t.matrix,e,void 0,i),Za(this.__layout.renderBounds,e,e),ja(e,"half",i.half),ja(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}=so.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),Ha.scaleX=i,Ha.scaleY=s,Ha}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?uh(this,e):this.worldTransform,n=i?t:{};return Za(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ja(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ja(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ga(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){qa(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return $a(n,-o,-r),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return $a(n,o,r),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){lh(this,t,e,i)}transform(t,e,i){ah(this,t,e,i)}move(t,e,i){Qa(this,t,e,i)}moveInner(t,e,i){sh(this,t,e,!0,i)}scaleOf(t,e,i,s,n){th(this,ch(this,t),e,i,s,n)}rotateOf(t,e,i){eh(this,ch(this,t),e,i)}skewOf(t,e,i,s,n){ih(this,ch(this,t),e,i,s,n)}transformWorld(t,e,i){hh(this,t,e,i)}moveWorld(t,e,i){sh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){nh(this,t,e,i,s,n)}rotateOfWorld(t,e){oh(this,t,e)}skewOfWorld(t,e,i,s,n){rh(this,t,e,i,s,n)}flip(t,e){ah(this,dh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__renderComplex(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return ce.need("path")}getMotionPoint(t){return ce.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){gh(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):Uo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=ko),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Nr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Nr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};ph=i([$o(ka),$o(Oa),$o(Wa),$o(xa),$o(za)],ph);const{setListWithFn:_h}=Vt,{sort:fh}=Sr,{localBoxBounds:mh,localStrokeBounds:yh,localRenderBounds:vh,maskLocalBoxBounds:wh,maskLocalStrokeBounds:xh,maskLocalRenderBounds:bh}=wr,kh=new ne("Branch");let Sh=class extends ph{__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){_h(e||this.__layout.boxBounds,this.children,this.__hasMask?wh:mh)}__updateStrokeBounds(t){_h(t||this.__layout.strokeBounds,this.children,this.__hasMask?xh:yh)}__updateRenderBounds(t){_h(t||this.__layout.renderBounds,this.children,this.__hasMask?bh:vh)}__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(fh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return kh.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=pe.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Nr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Nr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Nr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Nr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Nr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};Sh=i([$o(Na)],Sh);class Eh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Eh;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 Bh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Th="2.0.2";class Rh extends Ae{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=ee.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}function Ch(t,e){ee.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Kn.mimeType(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Kn.mimeType(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:(t,e,i)=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",ee.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()}),loadContent(t){return s(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})}},ee.canvas=ue.canvas(),ee.conicGradientSupport=!!ee.canvas.context.createConicGradient}qn(OffscreenCanvasRenderingContext2D.prototype),qn(Path2D.prototype),Object.assign(ue,{canvas:(t,e)=>new Rh(t,e),image:t=>new ao(t)}),ee.name="web",ee.isWorker=!0,ee.backgrounder=!0,ee.requestRender=function(t){requestAnimationFrame(t)},co(ee,"devicePixelRatio",{get:()=>1});const{userAgent:Oh}=navigator;Oh.indexOf("Firefox")>-1?(ee.conicGradientRotate90=!0,ee.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(ee.fullImageShadow=!0),Oh.indexOf("Windows")>-1?(ee.os="Windows",ee.intWheelDeltaY=!0):Oh.indexOf("Mac")>-1?ee.os="Mac":Oh.indexOf("Linux")>-1&&(ee.os="Linux");class Lh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Eh;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 Eh,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(ia.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Nr.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 ta(ta.DATA,{updatedList:this.updatedList})),this.__updatedList=new Eh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Vr.CHANGE,this.__onAttrChange,this],[[Nr.ADD,Nr.REMOVE],this.__onChildEvent,this],[ta.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ph,updateBounds:Ah,updateChange:Dh}=ur,{pushAllChildBranch:Mh,pushAllParent:Fh}=Sr;const{worldBounds:Ih}=wr;class Wh{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,u(t)&&(t=new Eh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ih)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ih),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:zh,updateAllChange:Yh}=ur,Xh=ne.get("Layouter");class Nh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Bh,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(ea.START),this.layoutOnce(),t.emitEvent(new ea(ea.END,this.layoutedBlocks,this.times))}catch(t){Xh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Xh.warn("layouting"):this.times>3?Xh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ta.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=he.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=ea,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new ea(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Ph(t,!0),e.add(t),t.isBranch&&Mh(t,e),Fh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Fh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Ah(s[t])}Ah(i)}})}(this.__levelList),function(t){t.list.forEach(Dh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new ea(o,a,this.times)),i.emitEvent(new ea(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,he.end(e)}fullLayout(){const t=he.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=ea,o=this.getBlocks(new Eh(e));e.emitEvent(new ea(i,o,this.times)),Nh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new ea(s,o,this.times)),e.emitEvent(new ea(n,o,this.times)),this.addBlocks(o),he.end(t)}static fullLayout(t){zh(t,!0),t.isBranch?Sr.updateBounds(t):ur.updateBounds(t),Yh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Wh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Wh(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_([[ea.REQUEST,this.layout,this],[ea.AGAIN,this.layoutAgain,this],[ta.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Hh=ne.get("Renderer");class Vh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ea.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ia.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ia.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ia.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Hh.log(e.innerName,"---\x3e");try{this.emitRender(ia.START),this.renderOnce(t),this.emitRender(ia.END,this.totalBounds),so.clearRecycled()}catch(t){this.rendering=!1,Hh.error(t)}Hh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Hh.warn("rendering");if(this.times>3)return Hh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(ia.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ia.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ia.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ia.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=he.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(Vh.clipSpread).ceil();const{ceilPartPixel:o}=this.config;i.clipWorld(s,o),i.clearWorld(s,o),this.__render(s,n),i.restore(),he.end(e)}fullRender(){const t=he.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),he.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),o=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ne.showRepaint&&ne.drawRepaint(i,t),this.config.useCellRender&&(o.cellList=this.getCellList()),ee.render(s,i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return ee.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};ee.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Hh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new ia(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ia.REQUEST,this.update,this],[ea.END,this.__onLayoutEnd,this],[ia.AGAIN,this.renderAgain,this],[Qr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Vh.clipSpread=10;const Uh={},{copyRadiusPoint:jh}=lt,{hitRadiusPoint:Gh}=Vt;class qh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Eh(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),h=n?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 n=this.findList=new Eh;if(t.length){let e;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||ur.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ur.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>ur.worldHittable(t))}getPath(t){const e=new Eh,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 Eh;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 Eh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:o}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],n=i.__,n.visible&&(!e||n.mask))if(s=Gh(i.__world,n.hitRadius?jh(Uh,o,n.hitRadius):o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(o,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)}}else 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,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Kh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new qh(this.target=t,this),this.finder=ue.finder&&ue.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return ee.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):ce.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Zh(t){return po(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Jh(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function $h(){return(t,e)=>{const i="_"+e;co(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 Qh(t){return(e,i)=>{co(e,i,go(i,t))}}Object.assign(ue,{watcher:(t,e)=>new Lh(t,e),layouter:(t,e)=>new Nh(t,e),renderer:(t,e,i)=>new Vh(t,e,i),selector:(t,e)=>new Kh(t,e)}),ee.layout=Nh.fullLayout,ee.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Eh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const tl={},el={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}},il=Jt,sl={},nl={},ol={},rl={},al={},hl={apply(){ce.need("filter")}},ll={},dl={setStyleName:()=>ce.need("state"),set:()=>ce.need("state")},cl={list:{},register(t,e){cl.list[t]=e},get:t=>cl.list[t]},{parse:ul,objectToCanvasData:gl}=ss,{stintSet:pl}=f,{hasTransparent:_l}=el,fl={originPaint:{}},ml=ne.get("UIData");class yl extends y{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,ml.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,ml.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(pl(this,"__isTransparentFill",_l(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):g(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(pl(this,"__isTransparentStroke",_l(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?ul(t):gl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){vl(this,"shadow",t)}setInnerShadow(t){vl(this,"innerShadow",t)}setFilter(t){vl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&nl.compute("fill",this.__leaf),e&&nl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=fl)):(this.__isStrokes=!0,this._stroke||(this._stroke=fl))}__removePaint(t,e){e&&this.__removeInput(t),ol.recycleImage(t,this),"fill"===t?(pl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(pl(this,"__isAlphaPixelStroke",void 0),pl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function vl(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 wl extends yl{}class xl extends wl{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 bl extends wl{__getInputData(t,e){const i=super.__getInputData(t,e);return Pe.forEach(t=>delete i[t]),i}}class kl extends xl{}class Sl extends yl{get __usePathBox(){return this.points||this.__pathInputed}}class El extends yl{get __boxStroke(){return!this.__pathInputed}}class Bl extends yl{get __boxStroke(){return!this.__pathInputed}}class Tl extends Sl{}class Rl extends yl{}class Cl extends yl{get __pathInputed(){return 2}}class Ol extends wl{}const Ll={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Pl extends yl{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=Ll[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=pe.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Al extends El{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Dl extends El{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:Ml,add:Fl}=B,Il={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),o&&(t=Ml(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=al.getShadowRenderSpread(this,e)),s&&(t=Ml(t,s)),o&&(t=Fl(t,hl.getSpread(o))),r&&(t=Fl(t,r)),a&&(t=Fl(t,a));let l=t;return i&&(l=Ml(l,al.getInnerShadowSpread(this,i))),n&&(l=Ml(l,n)),this.__layout.renderShapeSpread=l,h?Ml(h.__updateRenderSpread(),t):t}},{stintSet:Wl}=f,zl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Wl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Wl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Wl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!al.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Wl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Yl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=nl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&al.shadow(this,t,h),a&&(s.__isStrokes?nl.strokes(o,this,t,e):nl.stroke(o,this,t,e)),n&&(s.__isFills?nl.fills(n,this,t,e):nl.fill(n,this,t,e)),r&&this.__drawAfterFill(t,e),d&&al.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?nl.strokes(o,this,t,e):nl.stroke(o,this,t,e)),c&&hl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?nl.strokes(o,this,t,e):nl.stroke(o,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,el.string(e.color))}n&&(s.__isFills?nl.fills(n,this,t,e):nl.fill(n,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?nl.strokes(o,this,t,e):nl.stroke(o,this,t,e))}}else s.__pathForRender?Yl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?nl.fills(s,this,t,e):nl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?nl.strokes(n,this,t,e):nl.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Yl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&nl.stroke(n,t,e,i),s&&nl.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),n&&!r&&nl.stroke(n,t,e,i)}const Xl={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),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,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var Nl;let Hl=Nl=class extends ph{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){F.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return jn.set(this.path=t||[]),t||this.__drawPathByBox(jn),jn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ce.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ce.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(jn.set(i=[]),this.__drawPathByBox(jn,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||ll.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Vn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&sl.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?on.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,o,l(e)?[e]:e)}else t.rect(i,s,n,o);t.closePath()}drawImagePlaceholder(t,e,i){nl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ce.need("animate")}killAnimate(t,e){}export(t,e){return ce.need("export")}syncExport(t,e){return ce.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),Nl.one(e)}static one(t,e,i,s,n){return pe.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Qo()(this)}static registerData(t){Ho(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};i([Ho(yl)],Hl.prototype,"__",void 0),i([$h()],Hl.prototype,"zoomLayer",void 0),i([mo("")],Hl.prototype,"id",void 0),i([mo("")],Hl.prototype,"name",void 0),i([mo("")],Hl.prototype,"className",void 0),i([Po("pass-through")],Hl.prototype,"blendMode",void 0),i([Do(1)],Hl.prototype,"opacity",void 0),i([Mo(!0)],Hl.prototype,"visible",void 0),i([Po(!1)],Hl.prototype,"locked",void 0),i([Ao(!1)],Hl.prototype,"dim",void 0),i([Ao(!1)],Hl.prototype,"dimskip",void 0),i([Wo(0)],Hl.prototype,"zIndex",void 0),i([zo(!1)],Hl.prototype,"mask",void 0),i([Yo(!1)],Hl.prototype,"eraser",void 0),i([yo(0,!0)],Hl.prototype,"x",void 0),i([yo(0,!0)],Hl.prototype,"y",void 0),i([ko(100,!0)],Hl.prototype,"width",void 0),i([ko(100,!0)],Hl.prototype,"height",void 0),i([xo(1,!0)],Hl.prototype,"scaleX",void 0),i([xo(1,!0)],Hl.prototype,"scaleY",void 0),i([bo(0,!0)],Hl.prototype,"rotation",void 0),i([bo(0,!0)],Hl.prototype,"skewX",void 0),i([bo(0,!0)],Hl.prototype,"skewY",void 0),i([yo(0,!0)],Hl.prototype,"offsetX",void 0),i([yo(0,!0)],Hl.prototype,"offsetY",void 0),i([vo(0,!0)],Hl.prototype,"scrollX",void 0),i([vo(0,!0)],Hl.prototype,"scrollY",void 0),i([wo()],Hl.prototype,"origin",void 0),i([wo()],Hl.prototype,"around",void 0),i([mo(!1)],Hl.prototype,"lazy",void 0),i([So(1)],Hl.prototype,"pixelRatio",void 0),i([Lo(0)],Hl.prototype,"renderSpread",void 0),i([Bo()],Hl.prototype,"path",void 0),i([To()],Hl.prototype,"windingRule",void 0),i([To(!0)],Hl.prototype,"closed",void 0),i([ko(0)],Hl.prototype,"padding",void 0),i([ko(!1)],Hl.prototype,"lockRatio",void 0),i([ko()],Hl.prototype,"widthRange",void 0),i([ko()],Hl.prototype,"heightRange",void 0),i([mo(!1)],Hl.prototype,"draggable",void 0),i([mo()],Hl.prototype,"dragBounds",void 0),i([mo("auto")],Hl.prototype,"dragBoundsType",void 0),i([mo(!1)],Hl.prototype,"editable",void 0),i([Xo(!0)],Hl.prototype,"hittable",void 0),i([Xo("path")],Hl.prototype,"hitFill",void 0),i([Oo("path")],Hl.prototype,"hitStroke",void 0),i([Xo(!1)],Hl.prototype,"hitBox",void 0),i([Xo(!0)],Hl.prototype,"hitChildren",void 0),i([Xo(!0)],Hl.prototype,"hitSelf",void 0),i([Xo()],Hl.prototype,"hitRadius",void 0),i([No("")],Hl.prototype,"cursor",void 0),i([Po()],Hl.prototype,"fill",void 0),i([Oo(void 0,!0)],Hl.prototype,"stroke",void 0),i([Oo("inside")],Hl.prototype,"strokeAlign",void 0),i([Oo(1,!0)],Hl.prototype,"strokeWidth",void 0),i([Oo(!1)],Hl.prototype,"strokeWidthFixed",void 0),i([Oo("none")],Hl.prototype,"strokeCap",void 0),i([Oo("miter")],Hl.prototype,"strokeJoin",void 0),i([Oo()],Hl.prototype,"dashPattern",void 0),i([Oo(0)],Hl.prototype,"dashOffset",void 0),i([Oo(10)],Hl.prototype,"miterLimit",void 0),i([To(0)],Hl.prototype,"cornerRadius",void 0),i([To()],Hl.prototype,"cornerSmoothing",void 0),i([Zh()],Hl.prototype,"shadow",void 0),i([Zh()],Hl.prototype,"innerShadow",void 0),i([Zh()],Hl.prototype,"blur",void 0),i([Zh()],Hl.prototype,"backgroundBlur",void 0),i([Zh()],Hl.prototype,"grayscale",void 0),i([Zh()],Hl.prototype,"filter",void 0),i([Po()],Hl.prototype,"placeholderColor",void 0),i([mo(100)],Hl.prototype,"placeholderDelay",void 0),i([mo({})],Hl.prototype,"data",void 0),i([Ko(ph.prototype.reset)],Hl.prototype,"reset",null),Hl=Nl=i([$o(Il),$o(zl),Zo()],Hl);let Vl=class extends Hl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Ul;i([Ho(wl)],Vl.prototype,"__",void 0),i([ko(0)],Vl.prototype,"width",void 0),i([ko(0)],Vl.prototype,"height",void 0),Vl=i([$o(Sh),Qo()],Vl);const jl=ne.get("Leafer");let Gl=Ul=class extends Vl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&eo.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ul.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 n=this.canvas=ue.canvas(s);this.__controllers.push(this.renderer=ue.renderer(this,n,s),this.watcher=ue.watcher(this,s),this.layouter=ue.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ue.selector(this),this.interaction=ue.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ue.hitCanvasManager()),this.canvasManager=new ve,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Or.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(sa.RESTART):this.emitLeafer(sa.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(sa.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,Pe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=f.copyAttrs({},this.canvas,Pe);e.resize(t),this.updateLazyBounds(),this.__onResize(new Qr(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,Pe),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Zt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Pe.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(sa.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Pe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=f.copyAttrs({},s,Pe);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(sa.BEFORE_READY),this.emitLeafer(sa.READY),this.emitLeafer(sa.AFTER_READY),Or.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(sa.VIEW_READY),Or.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Or.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(sa.VIEW_COMPLETED),Or.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return ce.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new sa(t,this))}__listenEvents(){const t=he.start("FirstCreate "+this.innerName);this.once([[sa.START,()=>he.end(t)],[ea.START,this.updateLazyBounds,this],[ia.START,this.__onCreated,this],[ia.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ta.DATA,this.__onWatchData,this],[ea.END,this.__onLayoutEnd,this],[ia.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ul.list.remove(this);try{this.stop(),this.emitLeafer(sa.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{so.clearRecycled()},100)}catch(t){jl.error(t)}}};t?e():setTimeout(e)}};Gl.list=new Eh,i([Ho(bl)],Gl.prototype,"__",void 0),i([ko()],Gl.prototype,"pixelRatio",void 0),i([mo("normal")],Gl.prototype,"mode",void 0),Gl=Ul=i([Qo()],Gl);let ql=class extends Hl{get __tag(){return"Rect"}};i([Ho(El)],ql.prototype,"__",void 0),ql=i([$o(Xl),Zo(),Qo()],ql);const{add:Kl,includes:Zl,scroll:Jl}=Vt,$l=ql.prototype,Ql=Vl.prototype;let td=class extends Vl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r&&r.includes("scroll"))&&(Kl(a,o),Jl(a,i)),this.__updateRectRenderBounds(),t=!Zl(o,a),t&&"show"===r&&Kl(n,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))}};i([Ho(xl)],td.prototype,"__",void 0),i([ko(100)],td.prototype,"width",void 0),i([ko(100)],td.prototype,"height",void 0),i([mo(!1)],td.prototype,"resizeChildren",void 0),i([Lo("show")],td.prototype,"overflow",void 0),i([Ko($l.__updateStrokeSpread)],td.prototype,"__updateStrokeSpread",null),i([Ko($l.__updateRenderSpread)],td.prototype,"__updateRectRenderSpread",null),i([Ko($l.__updateBoxBounds)],td.prototype,"__updateRectBoxBounds",null),i([Ko($l.__updateStrokeBounds)],td.prototype,"__updateStrokeBounds",null),i([Ko($l.__updateRenderBounds)],td.prototype,"__updateRectRenderBounds",null),i([Ko($l.__updateChange)],td.prototype,"__updateRectChange",null),i([Ko($l.__render)],td.prototype,"__renderRect",null),i([Ko(Ql.__render)],td.prototype,"__renderGroup",null),td=i([Zo(),Qo()],td);let ed=class extends td{get __tag(){return"Frame"}get isFrame(){return!0}};i([Ho(kl)],ed.prototype,"__",void 0),i([Po("#FFFFFF")],ed.prototype,"fill",void 0),i([Lo("hide")],ed.prototype,"overflow",void 0),ed=i([Qo()],ed);const{moveTo:id,closePath:sd,ellipse:nd}=Bs;let od=class extends Hl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,o=t/2,r=e/2,a=this.__.path=[];let h;i?s||n?(i<1?nd(a,o,r,o*i,r*i,0,s,n,!1):h=!0,nd(a,o,r,o,r,0,n,s,!0)):(i<1&&(nd(a,o,r,o*i,r*i),id(a,t,r)),nd(a,o,r,o,r,0,360,0,!0)):s||n?(id(a,o,r),nd(a,o,r,o,r,0,s,n,!1)):nd(a,o,r,o,r),h||sd(a),ee.ellipseToCurve&&(this.__.path=this.getPath(!0))}};i([Ho(Bl)],od.prototype,"__",void 0),i([To(0)],od.prototype,"innerRadius",void 0),i([To(0)],od.prototype,"startAngle",void 0),i([To(0)],od.prototype,"endAngle",void 0),od=i([Qo()],od);const{sin:rd,cos:ad,PI:hd}=Math,{moveTo:ld,lineTo:dd,closePath:cd,drawPoints:ud}=Bs;let gd=class extends Hl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ud(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;ld(e,o,0);for(let t=1;t<n;t++)dd(e,o+o*rd(2*t*hd/n),r-r*ad(2*t*hd/n));cd(e)}}};i([Ho(Tl)],gd.prototype,"__",void 0),i([To(3)],gd.prototype,"sides",void 0),i([To()],gd.prototype,"points",void 0),i([To(0)],gd.prototype,"curve",void 0),gd=i([Zo(),Qo()],gd);const{sin:pd,cos:_d,PI:fd}=Math,{moveTo:md,lineTo:yd,closePath:vd}=Bs;let wd=class extends Hl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];md(r,n,0);for(let t=1;t<2*i;t++)yd(r,n+(t%2==0?n:n*s)*pd(t*fd/i),o-(t%2==0?o:o*s)*_d(t*fd/i));vd(r)}};i([Ho(Rl)],wd.prototype,"__",void 0),i([To(5)],wd.prototype,"corners",void 0),i([To(.382)],wd.prototype,"innerRadius",void 0),wd=i([Qo()],wd);const{moveTo:xd,lineTo:bd,drawPoints:kd}=Bs,{rotate:Sd,getAngle:Ed,getDistance:Bd,defaultPoint:Td}=lt;let Rd=class extends Hl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Sd(i,e),i}set toPoint(t){this.width=Bd(Td,t),this.rotation=Ed(Td,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?kd(e,t.points,t.curve,t.closed):(xd(e,0,0),bd(e,this.width,0))}};i([Ho(Sl)],Rd.prototype,"__",void 0),i([Ro("center")],Rd.prototype,"strokeAlign",void 0),i([ko(0)],Rd.prototype,"height",void 0),i([To()],Rd.prototype,"points",void 0),i([To(0)],Rd.prototype,"curve",void 0),i([To(!1)],Rd.prototype,"closed",void 0),Rd=i([Qo()],Rd);let Cd=class extends ql{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}};i([Ho(Al)],Cd.prototype,"__",void 0),i([ko("")],Cd.prototype,"url",void 0),Cd=i([Qo()],Cd);const Od=Cd;let Ld=class extends ql{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ue.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ao({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new jr(jr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new mt(t.worldTransform).invert(),o=new mt;e&&o.translate(e.x,e.y),i&&(l(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};i([Ho(Dl)],Ld.prototype,"__",void 0),i([Jh(100)],Ld.prototype,"width",void 0),i([Jh(100)],Ld.prototype,"height",void 0),i([Jh(1)],Ld.prototype,"pixelRatio",void 0),i([Jh(!0)],Ld.prototype,"smooth",void 0),i([mo(!1)],Ld.prototype,"safeResize",void 0),i([Jh()],Ld.prototype,"contextSettings",void 0),Ld=i([Qo()],Ld);const{copyAndSpread:Pd,includes:Ad,spread:Dd,setList:Md}=Vt,{stintSet:Fd}=f;let Id=class extends Hl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=il.number(e,n),t.__letterSpacing=il.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n||12}px ${s||"caption"}`,Fd(t,"__padding",l&&F.fourNumber(l)),Fd(t,"__clipText","show"!==h&&!t.__autoSize),Fd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=tl.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Dd(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!Ad(h,a)),this.isOverflow?(Md(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Pd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};i([Ho(Pl)],Id.prototype,"__",void 0),i([ko(0)],Id.prototype,"width",void 0),i([ko(0)],Id.prototype,"height",void 0),i([Po()],Id.prototype,"boxStyle",void 0),i([mo(!1)],Id.prototype,"resizeFontSize",void 0),i([Po("#000000")],Id.prototype,"fill",void 0),i([Ro("outside")],Id.prototype,"strokeAlign",void 0),i([Xo("all")],Id.prototype,"hitFill",void 0),i([ko("")],Id.prototype,"text",void 0),i([ko("")],Id.prototype,"placeholder",void 0),i([ko("caption")],Id.prototype,"fontFamily",void 0),i([ko(12)],Id.prototype,"fontSize",void 0),i([ko("normal")],Id.prototype,"fontWeight",void 0),i([ko(!1)],Id.prototype,"italic",void 0),i([ko("none")],Id.prototype,"textCase",void 0),i([ko("none")],Id.prototype,"textDecoration",void 0),i([ko(0)],Id.prototype,"letterSpacing",void 0),i([ko({type:"percent",value:1.5})],Id.prototype,"lineHeight",void 0),i([ko(0)],Id.prototype,"paraIndent",void 0),i([ko(0)],Id.prototype,"paraSpacing",void 0),i([ko("x")],Id.prototype,"writingMode",void 0),i([ko("left")],Id.prototype,"textAlign",void 0),i([ko("top")],Id.prototype,"verticalAlign",void 0),i([ko(!0)],Id.prototype,"autoSizeAlign",void 0),i([ko("normal")],Id.prototype,"textWrap",void 0),i([ko("show")],Id.prototype,"textOverflow",void 0),i([Po(!1)],Id.prototype,"textEditing",void 0),Id=i([Qo()],Id);let Wd=class extends Hl{get __tag(){return"Path"}};i([Ho(Cl)],Wd.prototype,"__",void 0),i([Ro("center")],Wd.prototype,"strokeAlign",void 0),Wd=i([Qo()],Wd);let zd=class extends Vl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Wd(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,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};i([Ho(Ol)],zd.prototype,"__",void 0),i([(t,e)=>{co(t,e,{get(){return this.__path}})}],zd.prototype,"path",void 0),zd=i([$o(Hs,["set","path","paint"]),Qo()],zd);let Yd=class extends Gl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ue.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Gl(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),o(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,Pe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ea.END,this.__onReady,this],[ia.START,this.__onCreated,this],[ia.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ia.END,this.__onChildRenderEnd,this))}};Yd=i([Qo()],Yd);const Xd={},Nd={isHoldSpaceKey:()=>Nd.isHold("Space"),isHold:t=>Xd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Xd[t]||(Xd[t]=!0)},setUpCode(t){Xd[t]=!1}},Hd={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 Vd extends Xr{get spaceKey(){return Nd.isHoldSpaceKey()}get left(){return Hd.left(this)}get right(){return Hd.right(this)}get middle(){return Hd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Nd.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){me.changeName(t,e)}}const{min:Ud,max:jd,abs:Gd}=Math,{float:qd,sign:Kd}=F,{minX:Zd,maxX:Jd,minY:$d,maxY:Qd}=Vt,tc=new qt,ec=new qt,ic={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&sc.getValidMove(t.__localBoxBounds,sc.getDragBounds(t),s,e,!0),sc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&sc.getValidScaleOf(t.__localBoxBounds,sc.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,n){const o=t.x+s.x,r=t.y+s.y,a=o+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),sc.isInnerMode(t,e,i,"width")?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),sc.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=qd(s.x),s.y=qd(s.y),s},getValidScaleOf(t,e,i,s,n,o,r){r||(n=Object.assign({},n)),ec.set(e),tc.set(t).scaleOf(s,n.x,n.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=1,m=1;return sc.isInnerMode(t,e,i,"width")?(n.x<0&&tc.scaleOf(s,f=1/n.x,1),p=qd(tc.minX-ec.minX),_=qd(ec.maxX-tc.maxX),u=a&&p>0?1+p/(a*tc.width):1,g=l&&_>0?1+_/(l*tc.width):1,f*=jd(u,g)):(n.x<0&&((qd(Zd(t)-Zd(e))<=0||qd(Jd(e)-Jd(t))<=0)&&tc.scaleOf(s,f=1/n.x,1),tc.unsign()),p=qd(ec.minX-tc.minX),_=qd(tc.maxX-ec.maxX),u=a&&p>0?1-p/(a*tc.width):1,g=l&&_>0?1-_/(l*tc.width):1,f*=Ud(u,g)),sc.isInnerMode(t,e,i,"height")?(n.y<0&&tc.scaleOf(s,1,m=1/n.y),p=qd(tc.minY-ec.minY),_=qd(ec.maxY-tc.maxY),u=d&&p>0?1+p/(d*tc.height):1,g=c&&_>0?1+_/(c*tc.height):1,m*=jd(u,g),o&&(u=jd(Gd(f),Gd(m)),f=Kd(f)*u,m=Kd(m)*u)):(n.y<0&&((qd($d(t)-$d(e))<=0||qd(Qd(e)-Qd(t))<=0)&&tc.scaleOf(s,1,m=1/n.y),tc.unsign()),p=qd(ec.minY-tc.minY),_=qd(tc.maxY-ec.maxY),u=d&&p>0?1-p/(d*tc.height):1,g=c&&_>0?1-_/(c*tc.height):1,m*=Ud(u,g)),n.x*=h(f)?f:1,n.y*=h(m)?m:1,n}},sc=ic;let nc=class extends Vd{};nc.POINTER="pointer",nc.BEFORE_DOWN="pointer.before_down",nc.BEFORE_MOVE="pointer.before_move",nc.BEFORE_UP="pointer.before_up",nc.DOWN="pointer.down",nc.MOVE="pointer.move",nc.UP="pointer.up",nc.OVER="pointer.over",nc.OUT="pointer.out",nc.ENTER="pointer.enter",nc.LEAVE="pointer.leave",nc.TAP="tap",nc.DOUBLE_TAP="double_tap",nc.CLICK="click",nc.DOUBLE_CLICK="double_click",nc.LONG_PRESS="long_press",nc.LONG_TAP="long_tap",nc.MENU="pointer.menu",nc.MENU_TAP="pointer.menu_tap",nc=i([tr()],nc);const oc=nc,rc={};let ac=class extends nc{static setList(t){this.list=t instanceof Eh?t:new Eh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return lt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),ic.axisMove(t,n),n}static limitMove(t,e){ic.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(rc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(rc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(rc,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 Vt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Vt.unsign(i),i}assignMove(t){rc.x=t?this.totalX:this.moveX,rc.y=t?this.totalY:this.moveY}};ac.BEFORE_DRAG="drag.before_drag",ac.START="drag.start",ac.DRAG="drag",ac.END="drag.end",ac.OVER="drag.over",ac.OUT="drag.out",ac.ENTER="drag.enter",ac.LEAVE="drag.leave",ac=i([tr()],ac);const hc=ac;let lc=class extends nc{static setList(t){ac.setList(t)}static setData(t){ac.setData(t)}};lc.DROP="drop",lc=i([tr()],lc);let dc=class extends ac{};dc.BEFORE_MOVE="move.before_move",dc.START="move.start",dc.MOVE="move",dc.DRAG_ANIMATE="move.drag_animate",dc.END="move.end",dc.PULL_DOWN="move.pull_down",dc.REACH_BOTTOM="move.reach_bottom",dc=i([tr()],dc);let cc=class extends Vd{};cc=i([tr()],cc);const uc=cc;let gc=class extends nc{};gc.BEFORE_ROTATE="rotate.before_rotate",gc.START="rotate.start",gc.ROTATE="rotate",gc.END="rotate.end",gc=i([tr()],gc);let pc=class extends ac{};pc.SWIPE="swipe",pc.LEFT="swipe.left",pc.RIGHT="swipe.right",pc.UP="swipe.up",pc.DOWN="swipe.down",pc=i([tr()],pc);let _c=class extends nc{};_c.BEFORE_ZOOM="zoom.before_zoom",_c.START="zoom.start",_c.ZOOM="zoom",_c.END="zoom.end",_c=i([tr()],_c);let fc=class extends Vd{};fc.BEFORE_DOWN="key.before_down",fc.BEFORE_UP="key.before_up",fc.DOWN="key.down",fc.HOLD="key.hold",fc.UP="key.up",fc=i([tr()],fc);const mc={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?pc.UP:t>45&&t<135?pc.DOWN:t<=45&&t>=-45?pc.RIGHT:pc.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:yc.getSwipeDirection(lt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:o(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Eh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>ur.draggable(t)||!t.isLeafer&&t.hasEvent(ac.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},yc=mc,vc=new Eh,{getDragEventData:wc,getDropEventData:xc,getSwipeEventData:bc}=mc;class kc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=wc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=ac.list||this.draggableList||vc;return this.dragging&&(s?t?vc:new Eh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}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(dc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Hd.left(t),this.dragging&&(this.interaction.emit(ac.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],ur.draggable(e)){this.draggableList=new Eh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=wc(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(dc.BEFORE_MOVE,this.dragData),e.emit(dc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(ac.BEFORE_DRAG,this.dragData),e.emit(ac.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,r=!o||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=ac.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},r||s);o&&!s&&t?ur.animateMove(e,h,l(o)?o:.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(ac.OUT,t,i),e.emit(ac.OVER,t,s)):e.emit(ac.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(ac.LEAVE,t,i,s),e.emit(ac.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=wc(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(dc.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(ac.END,r),this.swipe(t,i,s,r),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(lt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=bc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=xc(t,e,ac.data);s.path=i,this.interaction.emit(lc.DROP,s),this.interaction.emit(ac.LEAVE,t,i)}dragReset(){ac.list=ac.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Sc=ne.get("emit");const Ec=["move","zoom","rotate","key"];function Bc(t,e,i,s,n){if(Ec.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Rc(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&Tc(o,e,i,s,n)}}function Tc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Rc(t,n)&&(dl.updateEventStyle&&!s&&dl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=me.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Rc(t,e){return e&&e.has(t)}const Cc={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:Oc,pathCanDrag:Lc,pathHasOutside:Pc}=mc;class Ac{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&&Hd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Hd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Nd.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(Cc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Eh(t),this.createTransformer(),this.dragger=new kc(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&&(Hd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(nc.BEFORE_DOWN,t),t.path.needUpdate&&this.updateDownData(t),this.emit(nc.DOWN,t),Hd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Hd.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&&Hd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(nc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=lt.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(nc.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;Hd.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(nc.BEFORE_UP,t),this.emit(nc.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(nc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(nc.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(fc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Nd.setDownCode(e),this.emit(fc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(fc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(fc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Nd.setUpCode(e),this.emit(fc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Eh),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(nc.OUT,t,i),this.emit(nc.OVER,t,e)):this.emit(nc.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(nc.LEAVE,t,i,e),this.emit(nc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(nc.LEAVE,t),this.dragger.dragging&&this.emit(lc.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,n=[nc.DOUBLE_TAP,nc.DOUBLE_CLICK].some(e=>Oc(t.path,e));s<e.tapTime+50&&n?(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(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:o}=this;ee.backgrounder||t.origin||o&&o.updateLayout();const r=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.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&&!Pc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Lc(t.path))&&!Pc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:nc.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,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&lt.round(s),s}emitTap(t){this.emit(nc.TAP,t),this.emit(nc.CLICK,t)}emitDoubleTap(t){this.emit(nc.DOUBLE_TAP,t),this.emit(nc.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(nc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(nc.LONG_TAP,t),(Oc(t.path,nc.LONG_TAP)||Oc(t.path,nc.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 qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Qr.RESIZE,this.__onResize,this)],t.once(sa.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let o=i.length-1;o>-1;o--){if(n=i.list[o],Tc(n,t,e,!0,s))return;n.isApp&&Bc(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&Bc(n,t,e,!1,s),Tc(n,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 Dc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Dc.custom={};class Mc extends ve{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Eh,this.pixelList=new Eh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ue.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ue.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}ee.getSelector=function(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())};const{toInnerRadiusPointOf:Fc,copyRadiusPoint:Ic}=lt,{hitRadiusPoint:Wc,hitPoint:zc}=Vt,Yc={},Xc={},Nc=ph.prototype;Nc.hit=function(t,e=0){this.updateLayout(),Ic(Xc,t,e);const i=this.__world;return!!(e?Wc(i,Xc):zc(i,Xc))&&(this.isBranch?ee.getSelector(this).hitPoint(Object.assign({},Xc),e,{target:this}):this.__hitWorld(Xc))},Nc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,o=s.width<10&&s.height<10;if(i.hitRadius&&(Ic(Yc,t,i.hitRadius),t=Yc),Fc(t,s,Yc),i.hitBox||o){if(Vt.hitRadiusPoint(n.boxBounds,Yc))return!0;if(o)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(Yc,e)},Nc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Nc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Nc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Nc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Hc=new mt,Vc=Hl.prototype;Vc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const o=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=ee.image.hitCanvasSize,r=o.hitScale=Kt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Kt.set(t).scale(r);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),so.patternLocked=!0,this.__renderShape(o,{matrix:Hc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),so.patternLocked=!1,o.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(e)},Vc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:o,__maxStrokeWidth:r}=i,a=i.stroke&&("path"===o||"pixel"===o&&!i.__isAlphaPixelStroke)||"all"===o;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*r,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=r;break;case"outside":if(l+=2*r,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const Uc=Hl.prototype,jc=ql.prototype,Gc=td.prototype;jc.__updateHitCanvas=Gc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Uc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},jc.__hitFill=Gc.__hitFill=function(t){return this.__hitCanvas?Uc.__hitFill.call(this,t):Vt.hitRadiusPoint(this.__layout.boxBounds,t)},Id.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},Vl.prototype.pick=function(t,e){return e||(e=n),this.updateLayout(),ee.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const qc=Ae.prototype;function Kc(t,e,i){t.__.__font?nl.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Zc(t,e,i,s,n){const o=i.__;g(t)?nl.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&nl.strokeArrow(t,i,s,n)}function Jc(t,e,i,s,n){const o=i.__;g(t)?nl.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),nl.drawTextStroke(i,s,n))}function $c(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Jc(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",nl.fillText(i,o,n),o.blendMode="normal",ur.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}qc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},qc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},qc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Kt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Qc,copyAndSpread:tu,toOuterOf:eu,getOuterOf:iu,getByMove:su,move:nu,getIntersectData:ou}=Vt,ru={};let au;const{stintSet:hu}=f,{hasTransparent:lu}=el;function du(t,e,i){if(!g(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout,{type:r}=e;switch(r){case"image":case"film":case"video":if(!e.url)return;s=ol.image(i,t,e,n,!au||!au[e.url]),"image"!==r&&ol[r](s);break;case"linear":s=rl.linearGradient(e,n);break;case"radial":s=rl.radialGradient(e,n);break;case"angular":s=rl.conicGradient(e,n);break;case"solid":const{color:a,opacity:h}=e;s={type:r,style:el.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:el.string(e)})}if(s&&(s.originPaint=e,a(s.style)&&lu(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const cu={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];u(a)||(a=[a]),au=ol.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=du(t,a[n],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)&&(n=!0),o=!0),"fill"===t?(hu(i,"__isAlphaPixelFill",n),hu(i,"__isTransparentFill",o)):(hu(i,"__isAlphaPixelStroke",n),hu(i,"__isTransparentStroke",o),hu(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Kc(e,i,s)},fills:function(t,e,i,s){let n,o,r;for(let a=0,h=t.length;a<h;a++){if(n=t[a],o=n.originPaint,n.image){if(r?r++:r=1,ol.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||o.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),o.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===o.scaleFixed||"zoom-in"===o.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}o.blendMode&&(i.blendMode=o.blendMode),Kc(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),Kc(e,i,s),i.restoreBlendMode()):Kc(e,i,s)}},fillPathOrText:Kc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:o}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(o){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>o.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)nl.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Zc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Zc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)Zc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Zc(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),ur.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){nl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Jc(t,1,e,i,s);break;case"inside":$c(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Jc(t,2,e,i,s):$c(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:o,decorationY:r}=n;for(let t=0,i=o.length;t<i;t++)s=o[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=n;o.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,o){let r;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(r=t[l],(!r.image||!ol.checkImage(r,!1,s,n,o))&&r.style){if(h){const{strokeStyle:t}=r;t?n.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(r.style,a.__strokeWidth*e,a)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?nl.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?nl.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,o=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;eu(r.strokeSpread?(tu(ru,r.boxBounds,r.strokeSpread),ru):r.boxBounds,o,a);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))g=s,h=u=a,l=o;else{let s;if(ee.fullImageShadow)s=a;else{const t=r.renderShapeSpread?Qc(n,B.swapAndScale(r.renderShapeSpread,p,_)):n;s=ou(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),p*=f,_*=m),u=iu(a,c),h=su(u,-c.e,-c.f),l=iu(o,c),nu(l,-c.e,-c.f);const y=i.matrix;y?(d=new mt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:p,scaleY:_}}};let uu,gu=new qt;const{isSame:pu}=Vt;function _u(t,e,i,s,n,o){const r=t.__;if("fill"===e&&!r.__naturalWidth&&(r.__naturalWidth=s.width/r.pixelRatio,r.__naturalHeight=s.height/r.pixelRatio,r.__autoSide))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",r.width),t.setProxyAttr("height",r.height)),!1;if(!n.data){ol.createData(n,s,i,o);const{transform:t}=n.data,{opacity:e,blendMode:a}=i,h=t&&!t.onlyScale||r.path||r.cornerRadius;(h||e&&e<1||a)&&(n.complex=!h||2)}return!0}function fu(t,e){vu(t,jr.LOAD,e)}function mu(t,e){vu(t,jr.LOADED,e)}function yu(t,e,i){e.error=i,t.forceUpdate("surface"),vu(t,jr.ERROR,e)}function vu(t,e,i){t.hasEvent(e)&&t.emitEvent(new jr(e,i))}function wu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:xu,translate:bu}=J,ku=new qt,Su={},Eu={};function Bu(t,e,i,s){const n=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Tu={},Ru={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Cu,set:Ou,rotateOfOuter:Lu,translate:Pu,scaleOfOuter:Au,multiplyParent:Du,scale:Mu,rotate:Fu,skew:Iu}=J;function Wu(t,e,i,s,n,o,r,a){r&&Fu(t,r),a&&Iu(t,a.x,a.y),n&&Mu(t,n,o),Pu(t,e.x+i,e.y+s)}const{get:zu,scale:Yu,copy:Xu}=J,{getFloorScale:Nu}=F,{abs:Hu}=Math;const Vu={image:function(t,e,i,s,n){let o,r;const a=so.get(i,i.type);return uu&&i===uu.paint&&pu(s,uu.boxBounds)?o=uu.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),uu=a.use>1?{leafPaint:o,paint:i,boxBounds:gu.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(_u(t,e,i,a,o,s),n&&(fu(t,r),mu(t,r))):a.error?n&&yu(t,r,a.error):(n&&(wu(t,!0),fu(t,r)),o.loadId=a.load(()=>{wu(t,!1),t.destroyed||(_u(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),mu(t,r)),o.loadId=void 0},e=>{wu(t,!1),yu(t,r,e),o.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,i,s,n){const{scaleX:o,scaleY:r}=ol.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:o+"-"+r,{image:h,data:l,originPaint:d}=t,{exporting:c,snapshot:u}=n;return!(!l||t.patternId===a&&!c||u)&&(e&&(l.repeat?e=!1:d.changeful||t.film||"miniapp"===ee.name&&Qr.isResizing(i)||c||(e=ee.image.isLarge(h,o,r)||h.width*o>8096||h.height*r>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),ol.drawImage(t,o,r,i,s,n),!0):(!t.style||d.sync||c?ol.createPattern(t,i,s,n):ol.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,o){const{data:r,image:a,complex:h}=t;let{width:l,height:d}=a;if(h){const{blendMode:o,opacity:c}=t.originPaint,{transform:u}=r;n.save(),2===h&&n.clipUI(s),o&&(n.blendMode=o),c&&(n.opacity*=c),u&&n.transform(u),a.render(n,0,0,l,d,s,t,e,i),n.restore()}else r.scaleX&&(l*=r.scaleX,d*=r.scaleY),a.render(n,0,0,l,d,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return o&&o.scaleX&&(n.scaleX*=Math.abs(o.scaleX),n.scaleY*=Math.abs(o.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,so.recyclePaint(s),n.loading&&(r||(r=e.__input&&e.__input[t]||[],u(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,i,n){t.patternTask||(t.patternTask=so.patternTasker.add(()=>s(this,void 0,void 0,function*(){ol.createPattern(t,e,i,n),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:o}=ol.getImageRenderScaleData(t,e,i,s),r=t.film?t.nowIndex:n+"-"+o;if(t.patternId!==r&&!e.destroyed&&(!ee.image.isLarge(t.image,n,o)||t.data.repeat)){const{image:i,data:s}=t,{opacity:a,filters:h}=t.originPaint,{transform:l,gap:d}=s,c=ol.getPatternFixScale(t,n,o);let u,g,p,{width:_,height:f}=i;c&&(n*=c,o*=c),_*=n,f*=o,d&&(g=d.x*n/Hu(s.scaleX||1),p=d.y*o/Hu(s.scaleY||1)),(l||1!==n||1!==o)&&(n*=Nu(_+(g||0)),o*=Nu(f+(p||0)),u=zu(),l&&Xu(u,l),Yu(u,1/n,1/o));const m=i.getCanvas(_,f,a,h,g,p,e.leafer&&e.leafer.config.smooth,s.interlace),y=i.getPattern(m,s.repeat||ee.origin.noRepeat||"no-repeat",u,t);t.style=y,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,o=ee.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):o>r&&(o=r),(r*=e*i)>o&&(n=Math.sqrt(o/r)),n},createData:function(t,e,i,s){t.data=ol.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=ku.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:o,align:r,offset:h,scale:d,size:c,rotation:u,skew:p,clipSize:_,repeat:f,gap:m,interlace:y}=t,v=e.width===s&&e.height===n,w={mode:o},x="center"!==r&&(u||0)%180==90;let b,k;switch(Vt.set(Eu,0,0,x?n:s,x?s:n),o&&"cover"!==o&&"fit"!==o?((d||c)&&(F.getScaleData(d,c,i,Su),b=Su.scaleX,k=Su.scaleY),(r||m||f)&&(b&&Vt.scale(Eu,b,k,!0),r&&Tt.toPoint(r,Eu,e,Eu,!0,!0))):v&&!u||(b=k=Vt.getFitScale(e,Eu,"fit"!==o),Vt.put(e,i,r,b,!1,Eu),Vt.scale(Eu,b,k,!0)),h&&lt.move(Eu,h),o){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/n,ol.stretchMode(w,e,b,k));break;case"normal":case"clip":if(Eu.x||Eu.y||b||_||u||p){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),ol.clipMode(w,e,Eu.x,Eu.y,b,k,u,p,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||u||p)&&ol.repeatMode(w,e,s,n,Eu.x,Eu.y,b,k,u,p,r,t.freeTransform),f||(w.repeat="repeat");const i=g(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;g(t)?(o=t.x,r=t.y):o=r=t;return{x:Bu(o,i,n.width,e&&e.x),y:Bu(r,s,n.height,e&&e.y)}}(m,i&&f,Eu.width,Eu.height,e));break;default:b&&ol.fillOrFitMode(w,e,Eu.x,Eu.y,b,k,u)}return w.transform||(e.x||e.y)&&bu(w.transform=xu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),y&&(w.interlace=l(y)||"percent"===y.type?{type:"x",offset:y}:y),w},stretchMode:function(t,e,i,s){const n=Cu(),{x:o,y:r}=e;o||r?Pu(n,o,r):i>0&&s>0&&(n.onlyScale=!0),Mu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=Cu();Pu(a,e.x+i,e.y+s),Mu(a,n,o),r&&Lu(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,n,o,r,a,h,l){const d=Cu();Wu(d,e,i,s,n,o,r,a),h&&(r||a?(Ou(Ru),Au(Ru,e,h,l),Du(d,Ru)):Au(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,o,r,a,h,l,d,c){const u=Cu();if(c)Wu(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Lu(u,{x:i/2,y:s/2},h);else switch(Fu(u,h),h){case 90:Pu(u,s,0);break;case 180:Pu(u,i,s);break;case 270:Pu(u,0,i)}Tu.x=e.x+n,Tu.y=e.y+o,Pu(u,Tu.x,Tu.y),r&&Au(u,Tu,r,a)}t.transform=u}},{toPoint:Uu}=St,{hasTransparent:ju}=el,Gu={},qu={};function Ku(t,e,i,s){if(i){let n,o,r,h;for(let t=0,l=i.length;t<l;t++)n=i[t],a(n)?(r=t/(l-1),o=el.string(n,s)):(r=n.offset,o=el.string(n.color,s)),e.addColorStop(r,o),!h&&ju(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Zu,getDistance:Ju}=lt,{get:$u,rotateOfOuter:Qu,scaleOfOuter:tg}=J,{toPoint:eg}=St,ig={},sg={};function ng(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Zu(e,i);o=$u(),n?(tg(o,e,r/a*(s||1),1),Qu(o,e,t+90)):(tg(o,e,1,r/a*(s||1)),Qu(o,e,t))}return o}const{getDistance:og}=lt,{toPoint:rg}=St,ag={},hg={};const lg={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:o}=t;Uu(i||"top",e,Gu),Uu(s||"bottom",e,qu);const r=ee.canvas.createLinearGradient(Gu.x,Gu.y,qu.x,qu.y),a={type:n,style:r};return Ku(a,r,t.stops,o),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;eg(i||"center",e,ig),eg(s||"bottom",e,sg);const a=ee.canvas.createRadialGradient(ig.x,ig.y,0,ig.x,ig.y,Ju(ig,sg)),h={type:n,style:a};Ku(h,a,t.stops,o);const l=ng(e,ig,sg,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;rg(i||"center",e,ag),rg(s||"bottom",e,hg);const a=ee.conicGradientSupport?ee.canvas.createConicGradient(0,ag.x,ag.y):ee.canvas.createRadialGradient(ag.x,ag.y,0,ag.x,ag.y,og(ag,hg)),h={type:n,style:a};Ku(h,a,t.stops,o);const l=ng(e,ag,hg,r||1,ee.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:ng},{copy:dg,move:cg,toOffsetOutBounds:ug}=Vt,{max:gg,abs:pg}=Math,_g={},fg=new mt,mg={};function yg(t,e){let i,s,n,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),n=pg(t.spread||0),r=gg(r,n+o-s),a=gg(a,n+o+i),h=gg(h,n+o+s),l=gg(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function vg(t,e,i){const{shapeBounds:s}=i;let n,o;ee.fullImageShadow?(dg(_g,t.bounds),cg(_g,e.x-s.x,e.y-s.y),n=t.bounds,o=_g):(n=s,o=e),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:wg}=Vt,xg={};const bg=yg;const kg={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;ug(h,mg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.setWorldShadow(mg.offsetX+(r.x||0)*c*f,mg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,el.string(r.color)),n=al.getShadowTransform(t,g,i,r,mg,f),n&&g.setTransform(n),vg(g,mg,i),n&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,o,"copy"),s=o),a?g.copyWorld(a,o,o,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),ur.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;wg(h,xg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(xg.offsetX+(r.x||0)*c*f,xg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=al.getShadowTransform(t,g,i,r,xg,f,!0),n&&g.setTransform(n),vg(g,xg,i),g.restore(),a?(g.copyWorld(g,l,o,"copy"),g.copyWorld(a,o,o,"source-out"),s=o):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,el.string(r.color),"source-in"),ur.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<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:yg,getShadowTransform:function(t,e,i,s,n,o,r){if(s.spread){const i=2*s.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return fg.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),fg}},isTransformShadow(t){},getInnerShadowSpread:bg},{excludeRenderBounds:Sg}=wr;let Eg;function Bg(t,e,i,s,n,o,r,a){switch(e){case"grayscale":Eg||(Eg=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);Rg(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":Rg(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function Tg(t){return t.getSameCanvas(!1,!0)}function Rg(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}Vl.prototype.__renderMask=function(t,e){let i,s,n,o,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,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||Sg(i,e)||i.__render(t,e),o=i.__.opacity,Eg=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=Tg(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Tg(t)),n||(n=Tg(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&Bg(this,r,t,n,s,o,void 0,!1),Sg(i,e)||i.__render(n||t,e),d&&Bg(this,r,t,n,s,o,d,!1)}Bg(this,r,t,n,s,o,void 0,!0)};const Cg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Og=Cg+"_#~&*+\\=|≮≯≈≠=…",Lg=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 Pg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Ag=Pg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Dg=Pg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Mg=Pg(Cg),Fg=Pg(Og),Ig=Pg("- —/~|┆·");var Wg;!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"}(Wg||(Wg={}));const{Letter:zg,Single:Yg,Before:Xg,After:Ng,Symbol:Hg,Break:Vg}=Wg;function Ug(t){return Ag[t]?zg:Ig[t]?Vg:Dg[t]?Xg:Mg[t]?Ng:Fg[t]?Hg:Lg.test(t)?Yg:zg}const jg={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Gg(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:qg}=jg,{Letter:Kg,Single:Zg,Before:Jg,After:$g,Symbol:Qg,Break:tp}=Wg;let ep,ip,sp,np,op,rp,ap,hp,lp,dp,cp,up,gp,pp,_p,fp,mp,yp=[];function vp(t,e){lp&&!hp&&(hp=lp),ep.data.push({char:t,width:e}),sp+=e}function wp(){np+=sp,ep.width=sp,ip.words.push(ep),ep={data:[]},sp=0}function xp(){pp&&(_p.paraNumber++,ip.paraStart=!0,pp=!1),lp&&(ip.startCharSize=hp,ip.endCharSize=lp,hp=0),ip.width=np,fp.width?qg(ip):mp&&bp(),yp.push(ip),ip={words:[]},np=0}function bp(){np>(_p.maxWidth||0)&&(_p.maxWidth=np)}const{top:kp,right:Sp,bottom:Ep,left:Bp}=xt;function Tp(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const Rp={getDrawData:function(t,e){a(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:r}=e;r&&(n?(i=r[Bp],n-=r[Sp]+r[Bp],!n&&(n=.01)):e.autoSizeAlign||(i=r[Bp]),o?(s=r[kp],o-=r[kp]+r[Ep],!o&&(o=.01)):e.autoSizeAlign||(s=r[kp]));const h={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:ee.canvas.font=e.__font};return function(t,e,i){_p=t,yp=t.rows,fp=t.bounds,mp=!fp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:r}=ee,{width:a}=fp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;pp=!0,cp=null,hp=ap=lp=sp=np=0,ep={data:[]},ip={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)rp=e[i],"\n"===rp?(sp&&wp(),ip.paraEnd=!0,xp(),pp=!0):(dp=Ug(rp),dp===Kg&&"none"!==o&&(rp=Gg(rp,o,!sp)),ap=r.measureText(rp).width,s&&(s<0&&(lp=ap),ap+=s),up=dp===Zg&&(cp===Zg||cp===Kg)||cp===Zg&&dp!==$g,gp=!(dp!==Jg&&dp!==Zg||cp!==Qg&&cp!==$g),op=pp&&n?a-n:a,t&&a&&np+sp+ap>op&&(h?(sp&&wp(),np&&xp()):(gp||(gp=dp===Kg&&cp==$g),up||gp||dp===tp||dp===Jg||dp===Zg||sp+ap>op?(sp&&wp(),np&&xp()):np&&xp()))," "===rp&&!0!==pp&&np+sp===0||(dp===tp?(" "===rp&&sp&&wp(),vp(rp,ap),wp()):up||gp?(sp&&wp(),vp(rp,ap)):vp(rp,ap)),cp=dp);sp&&wp(),np&&xp(),yp.length>0&&(yp[yp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{_p.paraNumber++,np=r.measureText(t).width,yp.push({x:n||0,text:t,width:np,paraStart:!0}),mp&&bp()})}(h,t,e),r&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Tp(e,"x",t[Bp]);break;case"right":Tp(e,"x",-t[Sp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Tp(e,"y",t[kp]);break;case"bottom":Tp(e,"y",-t[Ep])}}(r,h,e,n,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:p,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(e.__autoHeight?m:f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-m)/2;break;case"bottom":p+=f-m}y+=p;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=g,v.width<_||v.width>_&&!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+=o,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&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,__letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,g,p,_,f,m,y,v;s.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===_?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===_?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,d,t.data,t.isOverflow,v&&g),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):g&&(t.width+=g*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){const{rows:n,overflow:o}=t;let{textOverflow:r}=e;if(o&&n.splice(o),s&&r&&"show"!==r){let t,a;"hide"===r?r="":"ellipsis"===r&&(r="...");const h=r?ee.canvas.measureText(r).width:0,l=i+s-h;("none"===e.textWrap?n:[n[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:r,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,g(o)?(i=o.type,o.color&&(t.decorationColor=el.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const Cp={string:function(t,e){if(!t)return"#000";const i=l(e)&&e<1;if(a(t)){if(!i||!el.object)return t;t=el.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function Op(t){return t?u(t)?t:[t]:[]}Object.assign(tl,Rp),Object.assign(el,Cp),Object.assign(nl,cu),Object.assign(ol,Vu),Object.assign(rl,lg),Object.assign(al,kg),Object.assign(ue,{interaction:(t,e,i,s)=>new Ac(t,e,i,s),hitCanvas:(t,e)=>new Rh(t,e),hitCanvasManager:()=>new Mc}),Ch();class Lp extends Xr{get list(){return Op(this.value)}get oldList(){return Op(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function Pp(t){return(e,i)=>{const s="_"+i;co(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const o=this;if(o.config){const t="target"===i;if(t){const{beforeSelect:t}=o.config;if(t){const i=t({target:e});if(g(i))e=i;else if(!1===i)return}o.setDimOthers(!1),o.setBright(!1),u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),o.single&&(delete o.element.syncEventer,delete o.element.__world.ignorePixelSnap)}const s=t?Lp.BEFORE_SELECT:Lp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Lp(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Lp.BEFORE_SELECT="editor.before_select",Lp.SELECT="editor.select",Lp.AFTER_SELECT="editor.after_select",Lp.BEFORE_HOVER="editor.before_hover",Lp.HOVER="editor.hover";const{abs:Ap}=Math,{copy:Dp}=J,{setListWithFn:Mp}=Vt,{worldBounds:Fp}=wr,Ip={a:1,b:0,c:0,d:1,e:0,f:0},Wp={x:0,y:0,width:0,height:0};class zp extends Hl{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?(Mp(Wp,e,Fp),t&&this.set(t),this.set(Wp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:r,fill:h}=n,{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=Ap(c.scaleX),l=Ap(c.scaleY);if(Dp(Ip,c),Ip.half=r%2,t.setWorld(Ip,e.matrix),t.beginPath(),"path"===this.strokePathType||s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/Math.max(i,l),n.shadow){const e=n.shadow[0],{scaleX:i,scaleY:s}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*s,e.blur*i,el.string(e.color))}o&&(a(o)?nl.stroke(o,this,t,e):nl.strokes(o,this,t,e)),h&&(a(h)?nl.fill(h,this,t,e):nl.fills(h,this,t,e)),n.shadow&&t.restore()}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}i([Pp(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],zp.prototype,"target",void 0),i([Po("render-path")],zp.prototype,"strokePathType",void 0);class Yp extends Vl{constructor(t){super(t),this.strokeArea=new ql({strokeAlign:"center"}),this.fillArea=new ql,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const Xp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Np([t],i,e),i}};function Np(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.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)&&n.hitSelf&&e.push(s)}s.isBranch&&Np(s.children,e,i)}}const{findOne:Hp,findByBounds:Vp}=Xp;class Up extends Vl{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 zp,this.targetStroker=new zp,this.bounds=new qt,this.selectArea=new Yp,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:n,strokeWidth:o,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:n,strokeWidth:o},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedPathType:i,selectedStyle:s}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2),strokePathType:i},s||{}))}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,t.path.needUpdate=!0):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:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},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(),n=new Eh(Vp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.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)&&!Hp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Eh(this.editor.editBox.rect)};return Hp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Hp(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_([[Lp.HOVER,this.onHover,this],[Lp.SELECT,this.onSelect,this]]),e.on_([[nc.MOVE,this.onPointerMove,this],[nc.BEFORE_DOWN,this.onBeforeDown,this],[nc.TAP,this.onTap,this],[ac.START,this.onDragStart,this,!0],[ac.DRAG,this.onDrag,this],[ac.END,this.onDragEnd,this],[dc.MOVE,this.onAutoMove,this],[[_c.ZOOM,dc.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:jp,top:Gp,topRight:qp,right:Kp,bottomRight:Zp,bottom:Jp,bottomLeft:$p,left:Qp}=bt,{toPoint:t_}=St,{within:e_,sign:i_}=F,{abs:s_}=Math,n_={getScaleData(t,e,i,s,n,o,r,a){let h,d,c={},u=1,g=1;const{boxBounds:p,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=i_(x),S=i_(b),E=a?x:k*p.width/v,B=a?b:S*p.height/w;if(l(s))u=g=Math.sqrt(s);else{o&&(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 Gp:g=t,h="bottom";break;case Kp:u=e,h="left";break;case Jp:g=r,h="top";break;case Qp:u=l,h="right";break;case jp:g=t,u=l,h="bottom-right";break;case qp:g=t,u=e,h="bottom-left";break;case Zp:g=r,u=e,h="top-left";break;case $p:g=r,u=l,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case Gp:case Jp:u=g;break;case Qp:case Kp:g=u;break;default:d=Math.sqrt(s_(u*g)),u=i_(u)*d,g=i_(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/p.width/e.scaleX),g<0&&(g=1/p.height/e.scaleY)}if(t_(o||h,p,c,!0),m){const e={x:u,y:g};ic.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&_){const e=p.width*t.scaleX;u=e_(e*u,_)/e}if(R&&f){const e=p.height*t.scaleY;g=e_(e*g,f)/e}return T&&s_(u*y.width)<1&&(u=i_(u)/y.width),R&&s_(g*y.height)<1&&(g=i_(g)/y.height),n&&u!==g&&(d=Math.min(s_(u),s_(g)),u=i_(u)*d,g=i_(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case jp:o="bottom-right";break;case qp:o="bottom-left";break;case Zp:o="top-left";break;case $p:o="top-right";break;default:o="center"}return t_(n||o,t.boxBounds,r,!0),{origin:r,rotation:lt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case Gp:case jp:o={x:.5,y:0},n="bottom",a=1;break;case Jp:case Zp:o={x:.5,y:1},n="top",a=1;break;case Qp:case $p:o={x:0,y:.5},n="right",h=1;break;case Kp:case qp:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,t_(s||n,t,r,!0);const c=lt.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.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 Qp:t=Kp;break;case jp:t=qp;break;case $p:t=Zp;break;case Kp:t=Qp;break;case qp:t=jp;break;case Zp:t=$p}if(i)switch(t){case Gp:t=Jp;break;case jp:t=$p;break;case qp:t=Zp;break;case Jp:t=Gp;break;case $p:t=jp;break;case Zp:t=qp}return t}},o_={};function r_(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return a_(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:p,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(p||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?g:o?c:u:v?g:y?c:u;h+=45*(n_.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(F.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;o_[S]?i.cursor=o_[S]:o_[S]=i.cursor={url:h_(x,h),x:b,y:k}}function a_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function h_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class l_ extends td{constructor(t){super(t),this.useFastShadow=!0}}const d_=["top","right","bottom","left"],c_=void 0;class u_ extends Vl{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.editor.editing}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 Vl,this.rect=new l_({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new l_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Vl({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:n,rotatePoints:o,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 l_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new l_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new l_({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:o,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),g=this.getResizeLinesStyle();let p;this.visible=!t.locked;for(let t=0;t<8;t++)p=o[t],p.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),p.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},g[(t-1)/2%g.length]||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:c_},e.rect||{}));const _=r(e.rectThrough)?i:e.rectThrough;s.hittable=!_,_&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&f.stintSet(t.__world,"ignorePixelSnap",d),a_(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,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:n,rotation:o,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:n,circle:o,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:p,hideOnSmall:_,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&&Vt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=l(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)St.toPoint(St.directionData[i],t,S),w=a[i],v=h[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!p),v.visible=y&&p&&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,_&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,_&&2*w.width>c&&(w.visible=!1)));o.visible=y&&p&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=d_.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=d_.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?n_.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:c_};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()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return u(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:o,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(o&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t)}r_(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Qr.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.canDragLimitAnimate&&(t instanceof ac||t instanceof dc)&&this.transformTool.onMove(t),this.resizing&&(Qr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case dc.START:this.onTransformStart(t);break;case dc.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),a(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case _c.START:this.onTransformStart(t);break;case _c.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),a(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case _c.START:this.onTransformStart(t);break;case _c.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){r_(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 Id)||t.find(t=>t instanceof Id);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_([[ac.START,this.onDragStart,this],[ac.DRAG,this.onDrag,this],[ac.END,this.onDragEnd,this],[nc.ENTER,e=>{this.enterPoint=t,r_(this,e)}],[nc.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[nc.DOUBLE_TAP,this.onDoubleTap,this],[nc.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[fc.HOLD,fc.UP],this.onKey,this],[fc.DOWN,this.onArrow,this],[[dc.START,dc.BEFORE_MOVE,dc.END],this.onMove,this,!0],[[_c.START,_c.BEFORE_ZOOM,_c.END],this.onScale,this,!0],[[gc.START,gc.BEFORE_ROTATE,gc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const g_={x:0,y:0,width:1e5,height:1e5};class p_ extends Hl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,g_),Object.assign(this.__world,g_)}__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 __='\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"/>',f_={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${__}\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${__}\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${__}\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},m_=new qt;function y_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{m_.setListWithFn(i,t=>t.getBounds("box","page")),0===m_.width&&(m_.width=.1),0===m_.height&&(m_.height=.1),e.reset(m_.get())}),s.add(e)}const v_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),w_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),x_={group(t,e,i){t.sort(w_);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new Vl(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(v_);const r=new mt(e.worldTransform);return r.divideParent(n.scrollWorldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},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(v_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(w_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},b_=ne.get("EditToolCreator");function k_(){return t=>{E_.register(t)}}const S_=k_,E_={list:{},register(t){const{tag:e}=t.prototype;B_[e]&&b_.repeat(e),B_[e]=t},get:(t,e)=>new B_[t](e)},{list:B_}=E_;class T_ extends Lp{constructor(t,e){super(t,e)}}T_.BEFORE_OPEN="innerEditor.before_open",T_.OPEN="innerEditor.open",T_.BEFORE_CLOSE="innerEditor.before_close",T_.CLOSE="innerEditor.close";class R_ extends Lp{constructor(t,e){super(t,e)}}R_.BEFORE_GROUP="editor.before_group",R_.GROUP="editor.group",R_.BEFORE_UNGROUP="editor.before_ungroup",R_.UNGROUP="editor.ungroup",R_.BEFORE_OPEN="editor.before_open_group",R_.OPEN="editor.open_group",R_.BEFORE_CLOSE="editor.before_close_group",R_.CLOSE="editor.close_group";const{updateMatrix:C_}=ur,O_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},L_="top-left";class P_ extends ql{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.skipJSON=!0,this.on(Vr.CHANGE,e=>{if(this.checkChange&&O_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,C_(this.parent),C_(this);const a=new mt(this.__world);switch(r[i]=s,this.__layout.rotationChange(),C_(this),this.changedTransform=new mt(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(L_,o);break;case"scaleX":t.scaleOf(L_,o,1);break;case"scaleY":t.scaleOf(L_,1,o);break;case"skewX":t.skewOf(L_,o,0);break;case"skewY":t.skewOf(L_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class A_ extends Lp{constructor(t,e){super(t,e)}}A_.BEFORE_MOVE="editor.before_move",A_.MOVE="editor.move";class D_ extends Lp{constructor(t,e){super(t,e)}}D_.BEFORE_SCALE="editor.before_scale",D_.SCALE="editor.scale";class M_ extends Lp{constructor(t,e){super(t,e)}}M_.BEFORE_ROTATE="editor.before_rotate",M_.ROTATE="editor.rotate";class F_ extends Lp{constructor(t,e){super(t,e)}}F_.BEFORE_SKEW="editor.before_skew",F_.SKEW="editor.skew";class I_{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:o}=i;const r=t.type===dc.END||t.type===ac.END,h=a(e.draggable),d=!o||r||h,c={x:t.totalX,y:t.totalY};t instanceof dc&&lt.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),n=ac.getValidMove(e,s.point,c,d),(n.x||n.y)&&(o&&!h&&r?ur.animateMove(this,n,l(o)?o:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let o,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof _c?(r||(r=e.getBoxPoint(t)),o=t.totalScale):o=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=n_.getScaleData(e,n.bounds,d,o,a,n_.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof ac&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),lt.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:o,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof gc)d=t.rotation,l=o?St.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=n_.getRotateData(e,h,t,s,i?null:o||e.around||e.origin||n||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=F.float(F.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),lt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=n_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),n_.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;g(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=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);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new A_(A_.BEFORE_MOVE,h));const l=new A_(A_.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:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new D_(D_.BEFORE_SCALE,t));const o=new D_(D_.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,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(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new D_(D_.BEFORE_SCALE,c));const u=new D_(D_.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new mt(ur.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new D_(D_.BEFORE_SCALE,r));const a=new D_(D_.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=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=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:o,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new M_(M_.BEFORE_ROTATE,d));const c=new M_(M_.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,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(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new F_(F_.BEFORE_SKEW,c));const u=new F_(F_.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(ur.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new mt(e.worldTransform);return t(),new mt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let W_=class extends Vl{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 Eh,this.openedGroupList=new Eh,this.simulateTarget=new P_(this),this.editBox=new u_(this),this.editToolList={},this.selector=new Up(this),this.editMask=new p_(this),this.targetEventIds=[];let i=f.clone(f_);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),ce.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}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&&y_(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||E_.get(t,this)}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(E_.list[e]){const t=this.editTool=this.getEditTool(e);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(R_.BEFORE_GROUP),this.target=x_.group(this.list,this.element,t),this.emitGroupEvent(R_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(R_.BEFORE_UNGROUP,t)),this.target=x_.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(R_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(R_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(R_.OPEN,t)}closeGroup(t){this.emitGroupEvent(R_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(R_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ur.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 R_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||E_.get(t,this)}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}E_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(T_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(T_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(T_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(T_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new T_(t,{editTarget:i,innerEditor:e});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&&(x_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(x_.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_(ia.START,this.onRenderStart,this),i&&i.on_(Vr.SCROLL,this.onChildScroll,this),t.on_(ia.CHILD_START,this.onAppRenderStart,this),t.on_(sa.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())}};i([(t,e)=>{co(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:n}=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))),o(a.dragLimitAnimate)&&(a.dragLimitAnimate=n&&n.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],W_.prototype,"mergeConfig",void 0),i([Pp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Eh?i:new Eh(i),t.multiple&&y_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new Lp(Lp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new Lp(Lp.AFTER_SELECT,s))})],W_.prototype,"target",void 0),i([Pp(function(t,e){t.emitEvent(new Lp(Lp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],W_.prototype,"hoverTarget",void 0),W_=i([$o(I_,["editBox","editTool","emitEvent"])],W_);class z_{static registerInnerEditor(){E_.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this._editBox||this.editor.editBox}set editBox(t){this._editBox=t}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Vl,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 Y_=class extends z_{static registerEditTool(){E_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,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()}};Y_=i([k_()],Y_);const{left:X_,right:N_}=bt,{move:H_,copy:V_,toNumberPoints:U_}=lt;let j_=class extends Y_{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===X_;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.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=U_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(H_(t,o,r),s&&H_(e,-o,-r)):(s&&H_(t,-o,-r),H_(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=t.target;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),V_(s[7],i),V_(e[7],i),V_(s[3],a),V_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===X_||t===N_,s[t].visible=a,e[t].visible=!r&&a}};j_=i([k_()],j_);const{M:G_,L:q_,C:K_,Q:Z_,Z:J_,N:$_,D:Q_,X:tf,G:ef,F:sf,O:nf,P:of,U:rf}=Fe,af={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case G_:case q_:hf(t,e,i,n,1),n+=3;break;case K_:hf(t,e,i,n,3),n+=7;break;case Z_:hf(t,e,i,n,2),n+=5;break;case J_:n+=1;break;case $_:hf(t,e,i,n,2),n+=5;break;case Q_:hf(t,e,i,n,2),n+=9;break;case tf:hf(t,e,i,n,2),n+=6;break;case ef:hf(t,e,i,n,2),n+=9;break;case sf:hf(t,e,i,n,2),n+=5;break;case nf:t[n]=ef,t.splice(n+4,0,t[n+3],0),hf(t,e,i,n,2),n+=9,o+=2;break;case of:t[n]=sf,t.splice(n+4,0,t[n+3]),hf(t,e,i,n,2),n+=5,o+=1;break;case rf:hf(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:hf}=af,lf=J.get(),{topLeft:df,top:cf,topRight:uf,right:gf,bottom:pf,left:_f}=bt;function ff(t,e,i){t.pathInputed?yf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function mf(t,e,i,s){let n=e;if(!o(s)){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case cf:case pf:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case _f:case gf:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case df:case uf:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}function yf(t,e,i){af.scale(t.__.path,e,i),t.path=t.__.path}function vf(t,e,i){const{points:s}=t;g(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):af.scalePoints(s,e,i),t.points=s}function wf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)lf.a=e,lf.d=i,s[t].transform(lf,!0)}const xf=ph.prototype;xf.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))},xf.__scaleResize=function(t,e){ff(this,t,e)},xf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},xf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Id.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)mf(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),ff(this,t,e)}},Wd.prototype.__scaleResize=function(t,e){yf(this,t,e)},Rd.prototype.__scaleResize=function(t,e){this.pathInputed?yf(this,t,e):this.points?vf(this,t,e):this.width*=t},gd.prototype.__scaleResize=function(t,e){this.pathInputed?yf(this,t,e):this.points?vf(this,t,e):ff(this,t,e)},Vl.prototype.__scaleResize=function(t,e){wf(this,t,e)},td.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||ff(this,t,e),i&&wf(this,t,e)},ce.add("resize"),ce.add("editor","resize"),ue.editor=function(t,e){const i=new W_(t);return e&&e.sky.add(e.editor=i),i},td.addAttr("textBox",!1,mo),Hl.addAttr("editConfig",void 0,mo),Hl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),mo),Hl.addAttr("editInner","PathEditor",mo),Vl.addAttr("editInner","",mo),Id.addAttr("editInner","TextEditor",mo),Hl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Hl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Hl.setEditInner=function(t){this.changeAttr("editInner",t)};const bf={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},kf={top:"flex-start",middle:"center",bottom:"flex-end"},Sf={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Ef(t,e,i){const{style:s}=t,{fill:n,padding:r,textWrap:h,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";u(e)&&(e=e[0]);if(g(e))switch(e.type){case"solid":i=el.string(e.color);break;case"image":case"film":case"video":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=el.string(a(t)?t:t.color);break;default:o(e.r)||(i=el.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,g(d)?(c=d.type,d.color&&(s.textDecorationColor=el.string(d.color))):c=d,s.textDecoration=Sf[c],s.textTransform=bf[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=kf[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===h?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=u(r)?r.map(t=>t*i+"px").join(" "):(r||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}let Bf=class extends z_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Id),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div");s.classList.add("leafer-text-editor");const{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(nc.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];t&&(a.setStartAfter(t),a.setEndAfter(t)),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth)switch(i+=20,r.textAlign){case"center":n=r.autoSizeAlign?-i/2:-10;break;case"right":n=r.autoSizeAlign?-i:-20}if(r.__autoHeight)switch(s+=20,r.verticalAlign){case"middle":o=r.autoSizeAlign?-s/2:-10;break;case"bottom":o=r.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:g,f:p}=new mt(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${g},${p})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||Ef(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};function Tf(t){const{scroll:e,disabled:i}=t.app.config.move;return!e||i?"":!0===e?"free":e}function Rf(t,e,i){Cf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(dc.BEFORE_MOVE,e=>{const i=t.getValidMove(e.moveX,e.moveY,!1);if(Tf(t).includes("limit")){const s=t.getValidMove(0,0);if(s.x||s.y){const t=100,n=200,o="drag"===e.moveType?.3:.05;Math.abs(s.x)>t?i.x=0:i.x*=o,Math.abs(s.y)>n?i.y=0:i.y*=o}}t.zoomLayer.move(i)}),t.on_(dc.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(dc.END,e=>{ur.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(_c.BEFORE_ZOOM,e=>{const{zoomLayer:i,layouter:s}=t,n=t.getValidScale(e.scale);1!==n&&(s.stop(),ur.updateMatrix(t),i.scaleOfWorld(e,n),s.start())}))}function Cf(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)}Bf=i([S_()],Bf),ce.add("text-editor","editor");const Of=ne.get("LeaferTypeCreator"),Lf={list:{},register(t,e){Pf[t]&&Of.repeat(t),Pf[t]=e},run(t,e){const i=Pf[t];i&&i(e)}},{list:Pf,register:Af}=Lf;Af("viewport",Rf),Af("custom",function(t){Rf(t,null,!0)}),Af("design",function(t){Rf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Af("document",function(t){Rf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Df={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=lt.getCenter(e.from,i.from),n=lt.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=lt.getDistance(e.from,i.from);return{move:o,scale:lt.getDistance(e.to,i.to)/r,rotation:lt.getRotation(e.from,i.from,e.to,i.to),center:n}},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),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=Mf,s=Mf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Mf.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)?Mf.getType(i.totalData,e):"none"},add(t,e){e&&(lt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Mf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Mf=Df,{abs:Ff,max:If}=Math,{sign:Wf,within:zf}=F,Yf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=Ff(s),r=Ff(n);return o>50&&(s=If(50,o/3)*Wf(s)),r>50&&(n=If(50,r/3)*Wf(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:o}=e;const r=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(ee.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){o=zf(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=zf(1-Ff(r)/(4*i)*o,.5,2);s=r>0?n:1/n}return s}};let Xf,Nf,Hf,Vf;class Uf{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),Xf=0,Nf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Xf,totalY:Nf}),e.emit(dc.START,this.moveData)),t.path=this.moveData.path,t.totalX=Xf+=t.moveX,t.totalY=Nf+=t.moveY,e.emit(dc.BEFORE_MOVE,t),e.emit(dc.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Hf=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Hf}),e.emit(_c.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Hf*=t.scale,e.emit(_c.BEFORE_ZOOM,t),e.emit(_c.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Vf=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Vf}),e.emit(gc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Vf+=t.rotation,e.emit(gc.BEFORE_ROTATE,t),e.emit(gc.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(dc.END,Object.assign(Object.assign({},e),{totalX:Xf,totalY:Nf})),i&&t.emit(_c.END,Object.assign(Object.assign({},i),{totalScale:Hf})),s&&t.emit(gc.END,Object.assign(Object.assign({},s),{totalRotation:Vf})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const jf=Gl.prototype,Gf=new qt,qf=new _t;function Kf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Zf(t,e){return Object.assign(Object.assign({},e),{scale:t})}jf.initType=function(t){Lf.run(t,this)},jf.getValidMove=function(t,e,i=!0){const{disabled:s,scrollSpread:n}=this.app.config.move;qf.set(t,e);const o=Tf(this);return o&&(o.includes("x")?qf.y=0:o.includes("y")?qf.x=0:Math.abs(qf.x)>Math.abs(qf.y)?qf.y=0:qf.x=0,i&&o.includes("limit")&&(Gf.set(this.__world).addPoint(this.zoomLayer),n&&Gf.spread(n),ic.getValidMove(Gf,this.canvas.bounds,"auto",qf,!0),o.includes("x")?qf.y=0:o.includes("y")&&(qf.x=0))),{x:s?0:qf.x,y:s?0:qf.y}},jf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const Jf=Ac.prototype;Jf.createTransformer=function(){this.transformer=new Uf(this)},Jf.move=function(t){this.transformer.move(t)},Jf.zoom=function(t){this.transformer.zoom(t)},Jf.rotate=function(t){this.transformer.rotate(t)},Jf.transformEnd=function(){this.transformer.transformEnd()},Jf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):Yf.getScale(t,e);if(1!==o)this.zoom(Zf(o,t));else{const s=e.getMove?e.getMove(t,e):Yf.getMove(t,e);i.snap&&lt.round(s),this.move(Kf(s,t))}},Jf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Df.getData(e),{moving:o,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Df.detect(n,g(s)?s:{})){case"move":o=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Df.reset()}o||(n.center=Df.state.center)}else o=r=a=!0;var h,l;Object.assign(t,n.center),t.multiTouch=!0,a&&this.rotate((h=n.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(Zf(n.scale,t)),o&&this.move(Kf(n.move,t))};const $f=kc.prototype,{abs:Qf,min:tm,max:em,hypot:im}=Math;function sm(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}$f.checkDragEndAnimate=function(t){const{interaction:e}=this,i=this.canAnimate&&this.moving&&e.m.dragAnimate;if(i){const s=l(i)?i:.95,n=.15,o=150;let r,a,h,d=0,c=0,u=0,g=0,p=3;const{dragDataList:_}=this,f=_.length;for(let t=f-1;t>=em(f-3,0)&&(h=_[t],!(h.time&&Date.now()-h.time>100));t--)r=p--,d+=h.moveX*r,c+=h.moveY*r,g+=r,a=im(h.moveX,h.moveY),a>u&&(u=a);if(g&&(d/=g,c/=g),u>8){const t=1.15+tm((u-8)/17,1)*(1.6-1.15);d*=t,c*=t}const m=em(Qf(d),Qf(c));m>o&&(a=o/m,d*=a,c*=a);const y=()=>{if(d*=s,c*=s,t=Object.assign({},t),Qf(d)<n&&Qf(c)<n)return this.dragEndReal(t);lt.move(t,d,c),this.drag(t),this.animate(y),e.emit(dc.DRAG_ANIMATE,t)};this.animate(y)}return i},$f.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},$f.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},$f.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},$f.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Vt.maxX(r),d=Vt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let g=0,p=0;this.autoMoveTimer=setInterval(()=>{g+=c,p+=u,lt.move(i,c,u),lt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},$f.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},ce.add("viewport"),ce.add("view"),Gl.prototype.zoom=function(t,e,i,s){let n;p(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:o}=this,h=this.canvas.bounds.clone().shrink(r(n)?30:n),d=new qt,c={x:h.x+h.width/2,y:h.y+h.height/2};let _;o.killAnimate();const{x:f,y:m,scaleX:y,scaleY:v}=o.__,{boxBounds:w}=o;if(a(t))switch(t){case"in":_=sm(y,"in");break;case"out":_=sm(y,"out");break;case"fit":t=w;break;case"fit-width":(t=new qt(w)).height=0;break;case"fit-height":(t=new qt(w)).width=0}else l(t)&&(_=t/y);if(_)_=this.getValidScale(_),o.scaleOfWorld(c,_,_,!1,s);else if(g(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=u(t);if(n||t.tag){const e=n?t:[t];d.setListWithFn(e,wr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,h);d.set(o.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)):(_=this.getValidScale(Math.min(h.width/r,h.height/a)),l+=(h.width-r*_)/2,c+=(h.height-a*_)/2,lt.scaleOf(e,d,_),d.scaleOf(d,_),e.scaleX*=_,e.scaleY*=_),"x"===i?c=0:"y"===i&&(l=0),lt.move(e,l,c),d.move(l,c),o.set(e,s),d}return o.worldBoxBounds};class nm extends Vl{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 td,this.scrollYBar=new td),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:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new qt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),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:p,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?_.width+6:2,u?p.height+6:2,2]);p.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.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_(ac.DRAG,this.onDrag,this),e.on_(ac.DRAG,this.onDrag,this),t.on_(ac.END,this.onDragEnd,this),e.on_(ac.END,this.onDragEnd,this),this.target.on_(ia.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Qr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}ce.add("scroll");class om extends Al{setText(t){this._text=t,this.__htmlChanged=!0}}const rm={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};let am=class extends Cd{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const o=t.indexOf(";",n+1);if(o>n+1&&(e=t.slice(n+1,o),i=rm[e],void 0!==i)){s+=i,n=o+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){a(t)?rm[t]=e:Object.assign(rm,t)}};i([Ho(om)],am.prototype,"__",void 0),i([ko("")],am.prototype,"text",void 0),i([mo("TextEditor")],am.prototype,"editInner",void 0),i([Po(!1)],am.prototype,"textEditing",void 0),am=i([Qo()],am),ce.add("html");class hm extends Sl{}function lm(t){return po(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&Eo(this),t.__useArrow=e,Co(this)}}}))}let dm=class extends Rd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){sl.register(t,e)}};i([Ho(hm)],dm.prototype,"__",void 0),i([lm("angle")],dm.prototype,"endArrow",void 0),dm=i([Qo()],dm);const{M:cm,L:um,C:gm,Q:pm,O:_m}=Fe,{rotate:fm,copyFrom:mm,scale:ym}=lt,vm={},wm={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case cm:case um:xm(t,l+1,e,i,s,n,o,r),l+=3;break;case gm:for(h=1;h<6;h+=2)xm(t,l+h,e,i,s,n,o,r);l+=7;break;case pm:for(h=1;h<4;h+=2)xm(t,l+h,e,i,s,n,o,r);l+=5;break;case _m:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){wm.layout(t,0,0,1,1,e,i)}};function xm(t,e,i,s,n,o,r,a){mm(vm,t[e],t[e+1]),r&&fm(vm,r,a),n&&ym(vm,n,o),t[e]=i+vm.x,t[e+1]=s+vm.y}const{layout:bm,rotate:km}=wm,{getAngle:Sm}=lt,Em={x:-.5},Bm={connect:Em,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Tm={connect:Em,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Rm={connect:Em,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]},Cm={connect:Em,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]},Om={offset:Em,path:[...Rm.path],dashPath:[1,-2.5,0,2,-1,0]};km(Om.path,180,{x:-1.5,y:0});const Lm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Pm={connect:{x:.5},path:[...Lm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Am={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]},Dm={path:[...Am.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Mm=f.clone(Am),Fm=f.clone(Dm);km(Mm.path,45),km(Fm.path,45);const Im={angle:Bm,"angle-side":Tm,arrow:Cm,triangle:Rm,"triangle-flip":Om,circle:Pm,"circle-line":Lm,square:Dm,"square-line":Am,diamond:Fm,"diamond-line":Mm,mark:{offset:Em,path:[1,0,-2,2,0,2]}};function Wm(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;g(e)?e.type?(h=e.scale,a=Im[e.type]):a=e:a=Im[e];const{offset:c,connect:u,path:p,dashPath:_}=a;let f=u?u.x:0,m=c?c.x:0;const y=[...p];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?m+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(m+=c.bevelJoin)),h&&bm(y,0,0,h,h),m&&bm(y,m,0),bm(y,s.x,s.y,n,n,Sm(i,s)),o.x=(f+m)*n,y}const{M:zm,L:Ym,C:Xm,Q:Nm,Z:Hm,N:Vm,D:Um,X:jm,G:Gm,F:qm,O:Km,P:Zm,U:Jm}=Fe,{copy:$m,copyFrom:Qm,getDistancePoint:ty}=lt,ey={},iy={},sy={},ny={},oy={},ry={list:Im,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:o,cornerRadius:r}=t.__,a=!r;let h,l=0,d=o.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=o[l],h){case zm:case Ym:(c<2||l+6>=d)&&(Qm(oy,o[l+1],o[l+2]),!c&&u&&$m(iy,oy)),l+=3;break;case Xm:(1===c||l+7>=d-3)&&ay(o,ny,oy,l+3),l+=7;break;case Nm:(1===c||l+5>=d-3)&&ay(o,ny,oy,l+1),l+=5;break;case Hm:return;case Vm:l+=5;break;case Um:l+=9;break;case jm:l+=6;break;case Gm:l+=9;break;case qm:l+=5;break;case Km:l+=7;break;case Zm:l+=4;break;case Jm:(1===c||l+6>=d-3)&&(ay(o,ny,oy,l+1),l+6!==d&&(oy.x-=(oy.x-ny.x)/10,oy.y-=(oy.y-ny.y)/10)),l+=6}if(c++,1===c&&h!==zm)return;if(2===c&&u&&$m(sy,h===Ym?oy:ny),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=Wm(t,e,sy,iy,s,ey,!!n);n?d.push(...i):r.push(...i),ey.x&&(ty(iy,sy,-ey.x,!0),r[1]=sy.x,r[2]=sy.y)}if(i&&"none"!==i){const e=Wm(t,i,ny,oy,s,ey,!!n);if(n?d.push(...e):r.push(...e),ey.x){let t;switch(ty(oy,ny,-ey.x,!0),h){case Ym:t=l-3+1;break;case Xm:t=l-7+5;break;case Nm:t=l-5+3;break;case Jm:t=l-6+3}t&&hy(r,ny,t)}}}else $m(ny,oy)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function ay(t,e,i,s){Qm(e,t[s],t[s+1]),Qm(i,t[s+2],t[s+3])}function hy(t,e,i){t[i]=e.x,t[i+1]=e.y}ce.add("arrow"),Hl.addAttr("startArrow","none",lm),Hl.addAttr("endArrow","none",lm),Object.assign(sl,ry),Object.assign(nl,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let ly=class extends td{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};i([Ho(class extends xl{})],ly.prototype,"__",void 0),i([wo("x")],ly.prototype,"flow",void 0),ly=i([Qo()],ly);const dy={},cy={"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"},uy={"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 gy(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;Tt.toPoint(i,e,n,dy),e.x=s.__autoWidth?n.x:dy.x,e.y=s.__autoHeight?n.y:dy.y}const{move:py}=lt;function _y(t,e,i,s,n,o){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[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),py(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function fy(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 my={};function yy(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:o,__autoHeight:r}=t.__,h=n&&(e?!o:!r);return g(i)?(my.xGap=i.x||0,my.yGap=i.y||0):my.xGap=my.yGap=c(i),my.isAutoXGap=a(my.xGap)&&!o,my.isAutoYGap=a(my.yGap)&&!r,my.complex=h||"top-left"!==s||t.__hasGrow||my.isAutoXGap||my.isAutoYGap,my.wrap=h,my.complex&&(my.isFitXGap="fit"===my.xGap&&!o,my.isFitYGap="fit"===my.yGap&&!r,g(s)?(my.contentAlign=s.content||"top-left",my.rowXAlign=s.x||"from",my.rowYAlign=s.y||"from"):(my.contentAlign=s,my.rowXAlign=cy[s],my.rowYAlign=uy[s])),my}function vy(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function wy(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function xy(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:by}=F;function ky(t,e,i,s){let n,o,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++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=Sy(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=Sy(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Sy(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?by(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:Ey}=F;function By(t,e,i,s){let n,o,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++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=Ty(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=Ty(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function Ty(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?Ey(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:Ry}=lt;function Cy(t,e){const i="width",{children:s,itemBox:n}=t,o=yy(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;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 o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=xy(p,n),r?(p.__flowBounds=_,y||(y=vy(m,g)),a&&y.count&&y.width+_.width>x&&(y.grow?ky(t,y,x,e):d&&wy(y,i,x,c),fy(u,y,i),y=vy(m,g)),f=_.width,p.__widthGrow&&(y.grow+=p.__widthGrow,f=0,p.__.widthRange&&(y.hasRangeSize=!0)),p.__heightGrow&&Ty(p,_,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,_.height),y.count++):(Ry(p,v-_.x,w-_.y),v+=_.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:g}=o;y.count&&(y.grow?ky(t,y,x,e):d&&wy(y,i,x,c),a&&fy(u,y,i)),a?(s?wy(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){gy(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=cy[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],_y(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(gy(t,y,r),_y(t,y,0,y.y,g,e))}}const{move:Oy}=lt;function Ly(t,e,i,s,n,o){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[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),Oy(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Py}=lt;function Ay(t,e){const i="height",{children:s,itemBox:n}=t,o=yy(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;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 o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=xy(p,n),r?(p.__flowBounds=_,y||(y=vy(m,g)),a&&y.count&&y.height+_.height>b&&(y.grow&&By(t,y,b,e),d&&wy(y,i,b,c),fy(u,y,i),y=vy(m,g)),f=_.height,p.__heightGrow&&(y.grow+=p.__heightGrow,f=0,p.__.heightRange&&(y.hasRangeSize=!0)),p.__widthGrow&&Sy(p,_,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,_.width),y.count++):(Py(p,v-_.x,w-_.y),w+=_.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:g}=o;y.count&&(y.grow&&By(t,y,b,e),d&&wy(y,i,b,c),a&&fy(u,y,i)),a?(s?wy(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){gy(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=uy[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],Ly(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(gy(t,y,r),Ly(t,y,y.x,0,l,e))}}function Dy(t){return po(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)&&Eo(this)}}))}ce.add("flow","resize");const My=td.prototype,{__updateBoxBounds:Fy}=Vl.prototype;Hl.addAttr("flow",!1,wo),Hl.addAttr("gap",0,ko),Hl.addAttr("flowAlign","top-left",ko),Hl.addAttr("flowWrap",!1,ko),Hl.addAttr("itemBox","box",ko),Hl.addAttr("inFlow",!0,ko),Hl.addAttr("autoWidth",void 0,Dy),Hl.addAttr("autoHeight",void 0,Dy),Hl.addAttr("autoBox",void 0,ko);const{copyAndSpread:Iy}=Vt;My.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Cy(this);break;case"y":Ay(this);break;case"x-reverse":Cy(this,!0);break;case"y-reverse":Ay(this,!0)}t&&(this.leafer.created=!0)},My.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Iy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},My.__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():Fy.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&&Iy(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:Wy,sin:zy,pow:Yy,sqrt:Xy,abs:Ny,ceil:Hy,floor:Vy,round:Uy,PI:jy}=Math,Gy=5*jy,qy=1.70158,Ky=2.5949095,Zy=7.5625,Jy=2.75;function $y(t){return e=>Yy(e,t)}function Qy(t){return e=>1-Yy(1-e,t)}function tv(t){return e=>e<.5?.5*Yy(2*e,t):1-.5*Yy(2-2*e,t)}function ev(t){return t<1/Jy?Zy*t*t:t<2/Jy?Zy*(t-=1.5/Jy)*t+.75:t<2.5/Jy?Zy*(t-=2.25/Jy)*t+.9375:Zy*(t-=2.625/Jy)*t+.984375}function iv(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=sv(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Ny(l)<1e-6));e++)c-=d/l;return n[r]=sv(c,e,s)}}function sv(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const nv={get(t){const{list:e}=nv;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){nv.list[t]=e},list:{linear:t=>t,ease:iv(.25,.1,.25,1),"ease-in":iv(.42,0,1,1),"ease-out":iv(0,0,.58,1),"ease-in-out":iv(.42,0,.58,1),"sine-in":t=>1-Wy(t*jy*.5),"sine-out":t=>zy(t*jy*.5),"sine-in-out":t=>.5*(1-Wy(t*jy)),"quad-in":$y(2),"quad-out":Qy(2),"quad-in-out":tv(2),"cubic-in":$y(3),"cubic-out":Qy(3),"cubic-in-out":tv(3),"quart-in":$y(4),"quart-out":Qy(4),"quart-in-out":tv(4),"quint-in":$y(5),"quint-out":Qy(5),"quint-in-out":tv(5),"expo-in":t=>t?Yy(2,10*t-10):0,"expo-out":t=>1===t?1:1-Yy(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Yy(2,2*t*10-10):.5*(2-Yy(2,10-2*t*10)),"circ-in":t=>1-Xy(1-Yy(t,2)),"circ-out":t=>Xy(1-Yy(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Xy(1-Yy(2*t,2))):.5*(Xy(1-Yy(2-2*t,2))+1),"back-in":t=>((qy+1)*t-qy)*t*t,"back-out":t=>(t-=1)*t*((qy+1)*t+qy)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Ky+1)*t-Ky)*.5:.5*((t=2*t-2)*t*((Ky+1)*t+Ky)+2),"elastic-in":t=>0===t||1===t?t:-Yy(2,10*(t-1))*zy((t-1.1)*Gy),"elastic-out":t=>0===t||1===t?t:Yy(2,-10*t)*zy((t-.1)*Gy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Yy(2,10*((t*=2)-1))*zy((t-1.1)*Gy)*.5:Yy(2,10*(1-(t*=2)))*zy((t-1.1)*Gy)*.5+1,"bounce-in":t=>1-ev(1-t),"bounce-out":ev,"bounce-in-out":t=>t<.5?.5*(1-ev(1-2*t)):.5*(1+ev(2*t-1)),"cubic-bezier":iv,steps:function(t,e="floor"){return i=>("floor"===e?Vy(i*t):"ceil"===e?Hy(i*t):Uy(i*t))/t}}};function ov(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 rv{}rv.CREATED="created",rv.PLAY="play",rv.PAUSE="pause",rv.STOP="stop",rv.SEEK="seek",rv.UPDATE="update",rv.COMPLETED="completed";let av=class extends da{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&l(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=nv.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(rv.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(rv.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(rv.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;g(t)&&(t=il.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(rv.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let a,h,d,c,u,g=0,p=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=h;o&&(d.swing=l(o)?o: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,p+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=nv.get(n))}if(!d.autoDuration&&o(d.duration)&&(n>1?s>0||r?p+=u:d.duration=0:d.duration=this.duration),n>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)}p?((this.duration<=g||!s||!s.duration)&&this.changeDuration(g+.2*p),this.allocateTime((this.duration-g)/p)):g&&this.changeDuration(g),this.emitType(rv.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let a in e)o(s[a])&&(s[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=o(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],o(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,ee.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(rv.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),cl.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(rv.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)}};i([ov("ease")],av.prototype,"easing",void 0),i([ov(0)],av.prototype,"delay",void 0),i([ov(.2)],av.prototype,"duration",void 0),i([ov("auto")],av.prototype,"ending",void 0),i([ov(!1)],av.prototype,"reverse",void 0),i([ov(!1)],av.prototype,"swing",void 0),i([ov(!1)],av.prototype,"loop",void 0),i([ov(0)],av.prototype,"loopDelay",void 0),i([ov(1)],av.prototype,"speed",void 0),i([ov(!0)],av.prototype,"autoplay",void 0),i([ov()],av.prototype,"join",void 0),i([ov()],av.prototype,"jump",void 0),i([ov()],av.prototype,"attrs",void 0),av=i([$o(xa)],av);let hv=class extends av{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 av(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(rv.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(rv.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(rv.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(rv.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case rv.COMPLETED:this.completed&&this.emitType(t);break;case rv.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)}};hv=i([$o(xa)],hv);const lv={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"},dv=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,cv=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,uv=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,gv=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,pv=parseInt,_v=parseFloat,{round:fv}=Math;let mv={},yv=0;function vv(t){let e,i,s,n=1;switch(t.length){case 9:e=pv(t.slice(1,3),16),i=pv(t.slice(3,5),16),s=pv(t.slice(5,7),16),n=pv(t.slice(7,9),16)/255;break;case 7:e=pv(t.slice(1,3),16),i=pv(t.slice(3,5),16),s=pv(t.slice(5,7),16);break;case 5:e=pv(t[1]+t[1],16),i=pv(t[2]+t[2],16),s=pv(t[3]+t[3],16),n=pv(t[4]+t[4],16)/255;break;case 4:e=pv(t[1]+t[1],16),i=pv(t[2]+t[2],16),s=pv(t[3]+t[3],16);break;case 3:e=i=s=pv(t[1]+t[2],16);break;case 2:e=i=s=pv(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const wv=1/6,xv=.5,bv=2/3,kv=1/3;function Sv(t,e,i){return i<0?i++:i>1&&i--,i<wv?t+6*(e-t)*i:i<xv?e:i<bv?t+(e-t)*(bv-i)*6:t}function Ev(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Sv(a,s,t+kv),o=Sv(a,s,t),r=Sv(a,s,t-kv)}return{r:fv(255*n),g:fv(255*o),b:fv(255*r),a:s}}ce.add("color"),el.object=function(t,e){let i,s=!o(e)&&e<1;if(a(t)){const e=mv[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=vv(t);break;case"R":case"r":"("===t[4]&&cv.test(t)?i=function(t){const e=cv.exec(t);return{r:pv(e[1]),g:pv(e[2]),b:pv(e[3]),a:_v(e[4])}}(t):"("===t[3]&&dv.test(t)&&(i=function(t){const e=dv.exec(t);return{r:pv(e[1]),g:pv(e[2]),b:pv(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&gv.test(t)?i=function(t){const e=gv.exec(t);return Ev(_v(e[1]),_v(e[2]),_v(e[3]),_v(e[4]))}(t):"("===t[3]&&uv.test(t)&&(i=function(t){const e=uv.exec(t);return Ev(_v(e[1]),_v(e[2]),_v(e[3]),1)}(t))}if(!i){const e=lv[t.toLowerCase()];e&&(i=vv("#"+e))}i&&(yv++,yv>1e4&&(mv={},yv=0),mv[t]=Object.assign({},i))}}else g(t)&&(o(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:Bv}=Math,{fourNumber:Tv}=F,Rv={fill:Av,stroke:Av,cornerRadius:(t,e,i)=>l(t)&&l(e)?Lv(t,e,i):(t=Tv(t),e=Tv(e),t.map((t,s)=>Lv(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,n=e.length,o=Lv(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return l(t)||l(e)?F.float(Lv(t,e,i),Math.max(Ov(t),Ov(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return cl.setBetweenStyle(n,t,e,n,i,s),n},shadow:Dv,innerShadow:Dv},Cv={value:function(t,e,i){const s=l(t),n=l(e);return s&&n?t+(e-t)*i:n||s?Lv(t,e,i):t},number:Lv,color:Pv,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=cl;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,n,o)))}};function Ov(t){const e=String(t).split(".")[1];return e?e.length:0}function Lv(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Bv(n):n}function Pv(t,e,i){t=el.object(t),e=el.object(e);const s=Lv(t.r,e.r,i,1)+","+Lv(t.g,e.g,i,1)+","+Lv(t.b,e.b,i,1),n=Lv(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Av(t,e,i){return a(t)&&a(e)?Pv(t,e,i):e}function Dv(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:Lv((t=t||{}).x,e.x,i),y:Lv(t.y,e.y,i),blur:Lv(t.blur,e.blur,i),spread:Lv(t.spread,e.spread,i),color:Pv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ce.add("animate","color"),dl.canAnimate=!0,Object.assign(cl.list,Rv),Object.assign(cl,Cv);const Mv=Hl.prototype;Hl.addAttr("animation",void 0,function(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Hl.addAttr("animationOut",void 0,mo),Hl.addAttr("transition",!0,mo),Hl.addAttr("transitionOut",void 0,mo),Mv.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))},Mv.animate=function(t,e,i,s){if(o(t))return this.__animate;let n=u(t)&&!e&&i?new hv(this,t,s):new av(this,t,e,s);this.killAnimate(i,n.toStyle);const r=this.__animate;return r&&(n instanceof hv?n.list.unshift(r):n=new hv(this,[r,n])),this.__animate=n},Mv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof hv&&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)}},Mv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(rv.COMPLETED,e)};const Fv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Iv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Wv}=Math,{getDerivative:zv}=li,Yv={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,g,p,_=0,f=h/2;for(let h=0;h<Fv.length;h++)l=f*(1+Fv[h]),d=f*(1-Fv[h]),c=zv(l,t,i,n,r),u=zv(l,e,s,o,a),g=zv(d,t,i,n,r),p=zv(d,e,s,o,a),_+=Iv[h]*(Wv(c*c+u*u)+Wv(g*g+p*p));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=zv(t,e,s,o,a),d=zv(t,i,n,r,h);return Math.atan2(d,l)/W},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,g=t/e,p=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>p;)Xv(i,s,n,o,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,g=d*n+e*r,p=d*o+e*a,_=d*c+e*g,f=d*u+e*p,m=d*_+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*p+e*(d*a+e*l));t.push(Fe.C,c,u,_,f,m,y)}},{getDistance:Xv}=Yv,{M:Nv,L:Hv,C:Vv,Z:Uv}=Fe,{float:jv}=F,Gv={},qv={},Kv={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Nv:case Hv:Kv.transformPoints(t,e,s,1),s+=3;break;case Vv:Kv.transformPoints(t,e,s,3),s+=7;break;case Uv:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)Gv.x=t[n],Gv.y=t[n+1],J.toOuterPoint(e,Gv),t[n]=Gv.x,t[n+1]=Gv.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Nv:case Hv:i=t[a+1],s=t[a+2],e=n===Hv&&a>0?lt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Vv:i=t[a+5],s=t[a+6],e=Yv.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 Uv:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=il.number(e,t.total);let o,r,a,h,l,d,c,u,g,p=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Nv:case Hv:if(r=n[f+1],a=n[f+2],o=s[m],p+o>=e||!t.total)return f||(y=r,v=a),qv.x=y,qv.y=v,_.x=r,_.y=a,lt.getDistancePoint(qv,_,e-p,!0),_.rotation=lt.getAngle(qv,_),_;y=r,v=a,f+=3;break;case Vv:if(r=n[f+5],a=n[f+6],o=s[m],p+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],g=Yv.getT(e-p,o,y,v,l,d,c,u,r,a,i),li.getPointAndSet(g,y,v,l,d,c,u,r,a,_),_.rotation=Yv.getRotation(g,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case Uv:f+=1;default:o=0}m++,p+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=il.number(e,t.total);let r,a,h,l,d,c,u,g,p,_,f=0,m={},y=0,v=0,w=0,x=0;const b=n.length;for(;y<b;){switch(d=n[y],d){case Nv:case Hv:if(h=n[y+1],l=n[y+2],r=s[v],f+r>e||!t.total)return y||(w=h,x=l),qv.x=w,qv.y=x,m.x=h,m.y=l,a=jv(e-f),a&&(lt.getDistancePoint(qv,m,a,!0),o.push(d,m.x,m.y)),o;w=h,x=l,y+=3,o.push(d,w,x);break;case Vv:if(c=n[y+1],u=n[y+2],g=n[y+3],p=n[y+4],h=n[y+5],l=n[y+6],r=s[v],f+r>e)return a=jv(e-f),a&&(_=Yv.getT(a,r,w,x,c,u,g,p,h,l,i),Yv.cut(o,_,w,x,c,u,g,p,h,l)),o;w=h,x=l,y+=7,o.push(d,c,u,g,p,h,l);break;case Uv:y+=1,o.push(d);default:r=0}v++,f+=r}return o}};function Zv(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ce.add("motion-path"),cl.register("motion",function(t,e,i,s){return g(t)&&(t=il.number(t,s.getMotionTotal())),g(e)&&(e=il.number(e,s.getMotionTotal())),cl.number(t||0,e||0,i)}),cl.register("motionRotation",function(t,e,i){return cl.number(t,e,i)});const Jv=Hl.prototype,{updateMatrix:$v,updateAllMatrix:Qv}=ur,{updateBounds:tw}=Sr;function ew(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=sw(t);i.total&&(t.__.__pathForRender=Kv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Qv(t),tw(t,t)):$v(t));i&&(t.leafer.created=!0)}}function iw(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 sw(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Kv.getMotionPathData(t.getPath(!0,!0))}function nw(t,e){return po(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?dl.setStyleName(this,e,i):dl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function ow(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function rw(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 aw(t,e){g(e)||(e=void 0),dw(t,e,"in")}function hw(t,e){const{normalStyle:i}=t;g(e)||(e=void 0),i&&(e||(e=i),dw(t,e,"out"))}Hl.addAttr("motionPath",void 0,Zv),Hl.addAttr("motionPrecision",1,Zv),Hl.addAttr("motion",void 0,Zv),Hl.addAttr("motionRotation",!0,Zv),Jv.getMotionPathData=function(){return sw(iw(this))},Jv.getMotionPoint=function(t){const e=iw(this),i=sw(e);if(!i.total)return{};const s=Kv.getDistancePoint(i,t,e.motionPrecision);J.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:l(n)&&(s.rotation+=n),s},Jv.getMotionTotal=function(){return this.getMotionPathData().total},Jv.__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(),ew(t))}else ew(this)};const lw={};function dw(t,e,i){const{normalStyle:s}=t;e||(e=lw),e.scale&&(F.assignScale(e,e.scale),delete e.scale),e!==lw&&dl.canAnimate||(i=null);let n=!!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 o=n?function(t,e){const i=gw(e,t),s=t.animate();s&&gw(i,t,s.fromStyle);return i}(t,e):void 0;dl.canAnimate&&cw(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=cw(t);if(a){const{animation:s}=a;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(a,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete a.animation}t.normalStyle=uw(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=uw(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function cw(t){let e;const i={},s=rw(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&dl.isState(n,t,s)&&(e=pw(i,o));const r=i.selectedStyle||t.selectedStyle;r&&dl.isSelected(t,s)&&(e=pw(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&dl.isPlacehold(t,s)&&(e=pw(i,a)),dl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=pw(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&dl.isFocus(t,s)&&(e=pw(i,n));const o=i.hoverStyle||t.hoverStyle;o&&dl.isHover(t,s)&&(e=pw(i,o));const r=i.pressStyle||t.pressStyle;r&&dl.isPress(t,s)&&(e=pw(i,r))}return e?i:void 0}function uw(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&dl.animateExcludes[t]||(n[t]=e[t]);return n}function gw(t,e,i){return uw(t,e,i,!0)}function pw(t,e){return Object.assign(t,e),!0}function _w(t,e){const i=t[e];i&&aw(t,i),t.button&&mw(t.children,e)}function fw(t,e,i){i||(i=t.states[e]),aw(t,i),t.button&&mw(t.children,null,e)}function mw(t,e,i){if(!t)return;let s,n;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":dl.isHover(s)&&(n=!1);break;case"pressStyle":dl.isPress(s)&&(n=!1);break;case"focusStyle":dl.isFocus(s)&&(n=!1)}n&&_w(s,e)}else o(i)||fw(s,i);s.isBranch&&mw(s.children,e,i)}}function yw(t,e){const i=t[e];i&&hw(t,i),t.button&&ww(t.children,e)}function vw(t,e,i){hw(t,i),t.button&&ww(t.children,null,e)}function ww(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?yw(s,e):o(i)||vw(s,i),s.isBranch&&ww(s.children,e,i)}function xw(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=rw(e,i);o&&(s=n[t](o))}return s}function bw(t,e,i){let s=e[t];if(!s&&i){const n=rw(e,i);n&&(s=n[t])}return s}ce.add("state"),dl.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},dl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=rw(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},dl.isSelected=function(t,e){return bw("selected",t,e)},dl.isDisabled=function(t,e){return bw("disabled",t,e)},dl.isFocus=function(t,e){return xw("isFocus",t,e)},dl.isHover=function(t,e){return xw("isHover",t,e)},dl.isPress=function(t,e){return xw("isPress",t,e)},dl.isPlacehold=function(t,e){return t.__.__isPlacehold},dl.isDrag=function(t,e){return xw("isDrag",t,e)},dl.setStyleName=function(t,e,i){i?fw(t,e,t[e]):vw(t,e,t[e])},dl.set=function(t,e){const i=t.states[e];i?fw(t,e,i):vw(t,e,i)},dl.getStyle=cw,dl.updateStyle=dw,dl.updateEventStyle=function(t,e){switch(e){case nc.ENTER:_w(t,"hoverStyle");break;case nc.LEAVE:yw(t,"hoverStyle");break;case nc.DOWN:_w(t,"pressStyle");break;case nc.UP:yw(t,"pressStyle")}};const kw=Hl.prototype;Hl.addAttr("selected",!1,nw,"selectedStyle"),Hl.addAttr("disabled",!1,nw,"disabledStyle"),Hl.addAttr("states",{},ow),Hl.addAttr("state","",nw),Hl.addAttr("normalStyle",void 0,mo),Hl.addAttr("hoverStyle",void 0,ow),Hl.addAttr("pressStyle",void 0,ow),Hl.addAttr("focusStyle",void 0,ow),Hl.addAttr("selectedStyle",void 0,ow),Hl.addAttr("disabledStyle",void 0,ow),Hl.addAttr("placeholderStyle",void 0,ow),Hl.addAttr("button",!1,mo),kw.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))},kw.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?_w(this,"focusStyle"):yw(this,"focusStyle")})},kw.updateState=function(){dl.updateStyle(this,void 0,"in")};const Sw=Id.prototype,Ew="text";co(Sw,Ew,Object.assign(Object.assign({},uo(Sw,Ew)),{set(t){const e=this,i=e.text;e.__setAttr(Ew,t)&&(Eo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Bw extends yl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Tw=class extends Hl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!o(t))if(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=so.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:o,total:r}=e,{width:a,height:h}=o&&(l(o)?{width:o,height:o}:o)||(r>1?this:t);let d=n?n.x:0,c=n?n.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 jr(jr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),o(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};i([Ho(Bw)],Tw.prototype,"__",void 0),i([ko()],Tw.prototype,"robot",void 0),i([mo()],Tw.prototype,"actions",void 0),i([mo("")],Tw.prototype,"action",void 0),i([Po(0)],Tw.prototype,"now",void 0),i([mo(12)],Tw.prototype,"FPS",void 0),i([mo(!0)],Tw.prototype,"loop",void 0),Tw=i([Qo()],Tw),ce.add("robot");const{Yes:Rw,NoAndSkip:Cw,YesAndSkip:Ow}=e,Lw={},Pw={},Aw={};class Dw{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Lw.id=t.substring(1),t=Lw;break;case".":Pw.className=t.substring(1),t=Pw;break;default:Aw.tag=t,t=Aw}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?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&&ur.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),"boolean"==typeof o&&(o=o?1:0),o===Rw||o===Ow){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Cw&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Nr.REMOVE,this.__onRemoveChild,this),this.target.on_(Vr.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 Mw=Hl.prototype;function Fw(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())}Mw.find=function(t,e){return Fw(this).getBy(t,this,!1,e)},Mw.findOne=function(t,e){return Fw(this).getBy(t,this,!0,e)},ce.add("find"),ue.finder=function(t){return new Dw(t)};const{setPoint:Iw,addPoint:Ww,toBounds:zw}=vt;const Yw={syncExport(t,e,i){let s;ll.running=!0;try{const n=Kn.fileType(e),r=e.includes(".");i=Kn.getExportOptions(i);const{toURL:a}=ee,{download:h}=ee.origin;if("json"===n)r&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),s={data:!!r||t.toJSON(i.json)};else if("svg"===n)r&&h(a(t.toSVG(),"svg"),e),s={data:!!r||t.toSVG()};else{let n,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:p,trim:_,screenshot:f,padding:m,onCanvas:y}=i,v=o(i.smooth)?!c||c.config.smooth:i.smooth,w=i.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&o(i.fill)?t.fill:i.fill,b=Kn.isOpaqueImage(e)||x,k=new mt;if(f)n=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=i.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":k.set(l);break;case"local":k.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:k.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}n=t.getBounds("render",e)}const S={scaleX:1,scaleY:1};F.getScaleData(i.scale,i.size,n,S);let E=i.pixelRatio||1,{x:B,y:T,width:R,height:C}=new qt(n).scale(S.scaleX,S.scaleY);p&&(B+=p.x,T+=p.y,R=p.width,C=p.height,p.rotation&&k.rotateOfInner({x:B,y:T},-p.rotation));const O={exporting:!0,matrix:k.scale(1/S.scaleX,1/S.scaleY).invert().translate(-B,-T).withScale(1/a*S.scaleX,1/h*S.scaleY)};let L,P=ue.canvas({width:Math.floor(R),height:Math.floor(C),pixelRatio:E,smooth:v,contextSettings:w});g&&(L=t,L.__worldOpacity=0,t=c||t,O.bounds=P.bounds),P.save();const A=u&&!o(x),D=t.get("fill");if(A&&(t.fill=""),ee.render(t,P,O),A&&(t.fill=D),P.restore(),L&&L.__updateWorldOpacity(),_){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Ww(r,n,o):Iw(r={},n,o)),a++;const h=new qt;return r&&(zw(r,h),h.scale(1/t.pixelRatio).ceil()),h}(P);const t=P,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:E};P=ue.canvas(s),P.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=F.fourNumber(m),n=P,{width:o,height:r}=n;P=ue.canvas({width:o+s+e,height:r+t+i,pixelRatio:E}),P.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}b&&P.fillWorld(P.bounds,x||"#FFFFFF","destination-over"),y&&y(P);s={data:"canvas"===e?P:P.export(e,i),width:P.pixelWidth,height:P.pixelHeight,renderBounds:n,trimBounds:r};const M=c&&c.app;M&&M.canvasManager&&M.canvasManager.clearRecycled()}}catch(t){s={data:"",error:t}}return ll.running=!1,s},export(t,e,i){return ll.running=!0,function(t){Xw||(Xw=new Qn);return new Promise(e=>{Xw.add(()=>s(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(o=>{const r=()=>s(this,void 0,void 0,function*(){if(!eo.isComplete)return ee.requestRender(r);const s=ll.syncExport(t,e,i);s.data instanceof Promise&&(s.data=yield s.data),n(s),o()});t.updateLayout(),Nw(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))}};let Xw;function Nw(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Nw(t))}const Hw=Ae.prototype,Vw=ne.get("@leafer-in/export");Hw.export=function(t,e){const{quality:i,blob:s}=Kn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Hw.toBlob=function(t,e){return new Promise(i=>{ee.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Vw.error(t),i(null)})})},Hw.toDataURL=function(t,e){return ee.origin.canvasToDataURL(this.view,t,e)},Hw.saveAs=function(t,e){return new Promise(i=>{ee.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Vw.error(t),i(!1)})})},ce.add("export"),Object.assign(ll,Yw),Hl.prototype.export=function(t,e){return ll.export(this,t,e)},Hl.prototype.syncExport=function(t,e){return ll.syncExport(this,t,e)},ce.add("filter"),Object.assign(hl,{list:{},register(t,e){hl.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=hl.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=hl.list[t.type],e&&(i+=e.getSpread(t))}),i}}),ce.add("bright"),Hl.addAttr("bright",!1,Ao);const Uw={theme:"light",style:{dragBoundsType:"outer",strokeAlign:"center",strokeWidthFixed:"zoom-in",width:6,height:6,opacity:.5,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.66}},size:6,endsMargin:2,sideMargin:2,minSize:10,scaleFixed:"zoom-in",scrollType:"both",hideOnActionEnd:"hover"},jw=new qt,{float:Gw}=F,{clone:qw,assign:Kw}=f;class Zw extends Vl{get canUse(){return this.target.hasScroller}constructor(t){super(),this.targetWorldBounds=new qt,this.viewportBounds=new qt,this.contentBounds=new qt,this.scrollXBounds=new qt,this.scrollYBounds=new qt,this.target=t,this.config=qw(Uw),this.updateConfig(),this.__listenEvents(),t.waitLeafer(()=>{this.parent=t,this.__bindLeafer(t.leafer)}),this.mergedConfig.hideOnActionEnd&&(this.opacity=0)}static registerTheme(t,e){Jw.themeMap[t]=e}static getTheme(t){return t&&Jw.themeMap[t]}static hasTheme(t){return t&&!!Jw.themeMap[t]}updateConfig(){const{scrollConfig:t}=this.target,e=Jw.getTheme(t&&Jw.hasTheme(t.theme)&&t.theme||this.config.theme),i=this.mergedConfig=qw(this.config);Kw(i,e),t&&Kw(i,t),this.updateStyle(i.style)}updateStyle(t){this.scrollXBar||this.addMany(this.scrollXBar=new td,this.scrollYBar=new td);const{scrollXBar:e,scrollYBar:i}=this;e.set(t),i.set(t),e.draggable="x",i.draggable="y"}update(t=!0){if(this.dragScrolling)return;const{target:e,targetOverflow:i,targetWorldBounds:s,viewportBounds:n,contentBounds:o}=this,r=e.__layout,{overflow:a}=e.__,{childrenRenderBounds:h}=r,{boxBounds:l,worldBoxBounds:d}=r,c=t&&i===a&&s.isSame(d),u=!r.scrollConfigChanged||(this.updateConfig(),r.scrollConfigChanged=!1),g=jw.set(n).add(h);if(c&&u&&o.isSame(g))return;this.targetOverflow=a,n.set(l),s.set(d),o.set(g);const{scrollXBar:p,scrollYBar:_}=this,{size:f,endsMargin:m,minSize:y}=this.mergedConfig,{width:v,height:w}=n;this.contentRealX=o.x-e.scrollX,this.contentRealY=o.y-e.scrollY,this.ratioX=n.width/o.width,this.ratioY=n.height/o.height;const x=f+2*m+y;p.visible=Gw(o.width)>Gw(v)&&"y-scroll"!==a&&v>x,_.visible=Gw(o.height)>Gw(w)&&"x-scroll"!==a&&w>x,this.updateScrollBar()}updateScrollBar(){const{target:t,viewportBounds:e,contentBounds:i,ratioX:s,ratioY:n,scrollXBar:r,scrollYBar:a,scrollXBounds:h,scrollYBounds:l}=this;let{size:d,cornerRadius:c,endsMargin:u,sideMargin:g,minSize:p,scaleFixed:_,scrollType:f}=this.mergedConfig;const m=_?t.getClampRenderScale():1;if(u/=m,g/=m,d/=m,o(c)&&(c=d/2),r.visible){h.set(e).shrink([u,a.visible?d+g:u,g,u]);const t=this.scrollRatioX=h.width/i.width;r.set({x:h.x-i.x*t,y:h.maxY-d,width:Math.max(h.width*s,p),height:d,cornerRadius:c,dragBounds:h,hittable:"move"!==f})}if(a.visible){l.set(e).shrink([u,g,r.visible?d+g:u,u]);const t=this.scrollRatioY=l.height/i.height;a.set({x:l.maxX-d,y:l.y-i.y*t,width:d,height:Math.max(l.height*n,p),cornerRadius:c,dragBounds:l,hittable:"move"!==f})}this.x=-this.target.scrollX,this.y=-this.target.scrollY,ur.updateAllMatrix(this),Sr.updateBounds(this),ur.updateAllChange(this)}onDrag(t){if("move"===this.mergedConfig.scrollType)return;this.dragScrolling=!0;const{scrollXBar:e,scrollYBar:i,target:s,scrollXBounds:n,scrollYBounds:o}=this;t.current===e?s.scrollX=-((e.x-n.x)/this.scrollRatioX+this.contentRealX):s.scrollY=-((i.y-o.y)/this.scrollRatioY+this.contentRealY)}onDragEnd(){"move"!==this.mergedConfig.scrollType&&(this.dragScrolling=!1)}onMove(t){if(!this.canUse)return;this.onEnter();const{scrollType:e,stopDefault:i}=this.mergedConfig;if("drag"===e)return;const{viewportBounds:s,contentBounds:n,scrollXBar:o,scrollYBar:r}=this;if(o.visible||r.visible){const e=t.getInnerMove(this.target);let a;ic.getValidMove(n,s,"inner",e,!0),e.x&&o.visible&&(this.target.scrollX+=e.x,a=!0),e.y&&r.visible&&(this.target.scrollY+=e.y,a=!0),(a||i)&&t.stop(),i&&t.stopDefault()}}onMoveEnd(t){this.canUse&&(this.target.hit(t)||this.onLeave())}onEnter(){this.canUse&&(clearTimeout(this.hideTimer),this.killAnimate(),this.opacity=1)}onLeave(){this.canUse&&(clearTimeout(this.hideTimer),this.mergedConfig.hideOnActionEnd&&(this.hideTimer=setTimeout(()=>{this.set({opacity:0},ce.has("animate"))},600)))}onResize(){this.canUse&&this.update()}__listenEvents(){const{scrollXBar:t,scrollYBar:e,target:i}=this;this.__eventIds=[t.on_(ac.DRAG,this.onDrag,this),t.on_(ac.END,this.onDragEnd,this),e.on_(ac.DRAG,this.onDrag,this),e.on_(ac.END,this.onDragEnd,this),i.on_(nc.ENTER,this.onEnter,this),i.on_(nc.LEAVE,this.onLeave,this),i.on_(dc.BEFORE_MOVE,this.onMove,this),i.on_(dc.END,this.onMoveEnd,this),i.on_(Gr.WORLD,this.onResize,this),i.on_(Nr.DESTROY,this.destroy,this)]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){if(!this.destroyed){this.__removeListenEvents();const{target:t}=this;t.scroller=t.topChildren=t.hasScroller=void 0,this.target=this.config=null,super.destroy()}}}Zw.themeMap={};const Jw=Zw;ce.add("scroller");const $w=td.prototype;td.addAttr("scrollConfig",void 0,function(t){return po(t,t=>({set(e){if(this.__setAttr(t,e)){this.__layout.scrollConfigChanged=!0,Eo(this)}}}))}),$w.__checkScroll=function(t){t&&this.isOverflow?(this.scroller||(this.scroller=new Zw(this),this.topChildren||(this.topChildren=[]),this.topChildren.push(this.scroller)),this.hasScroller=!0):this.hasScroller&&!this.scroller.dragScrolling&&(this.hasScroller=void 0,this.scroller.update())},Zw.registerTheme("light",{style:{fill:"black"}}),Zw.registerTheme("dark",{style:{fill:"white"}});export{Tt as AlignHelper,av as Animate,nv as AnimateEasing,rv as AnimateEvent,hv as AnimateList,e as Answer,Yd as App,St as AroundHelper,dm as Arrow,hm as ArrowData,Zt as AutoBounds,li as BezierHelper,qt as Bounds,Gr as BoundsEvent,Vt as BoundsHelper,td as Box,xl as BoxData,Sh as Branch,Sr as BranchHelper,Na as BranchRender,Ld as Canvas,Dl as CanvasData,ve as CanvasManager,Nr as ChildEvent,el as ColorConvert,ue as Creator,Dc as Cursor,f as DataHelper,ne as Debug,xt as Direction4,bt as Direction9,ic as DragBoundsHelper,ac as DragEvent,kc as Dragger,lc as DropEvent,u_ as EditBox,n_ as EditDataHelper,l_ as EditPoint,Up as EditSelect,Xp as EditSelectHelper,Y_ as EditTool,E_ as EditToolCreator,W_ as Editor,Lp as EditorEvent,R_ as EditorGroupEvent,x_ as EditorHelper,A_ as EditorMoveEvent,M_ as EditorRotateEvent,D_ as EditorScaleEvent,F_ as EditorSkewEvent,al as Effect,od as Ellipse,Bl as EllipseData,yi as EllipseHelper,Xr as Event,me as EventCreator,da as Eventer,ll as Export,Kn as FileHelper,hl as Filter,Dw as Finder,ly as Flow,B as FourNumberHelper,ed as Frame,kl as FrameData,Vl as Group,wl as GroupData,am as HTMLText,om as HTMLTextData,Yv as HighBezierHelper,Kv as HighCurveHelper,Mc as HitCanvasManager,Cd as Image,Al as ImageData,jr as ImageEvent,so as ImageManager,v as IncrementId,z_ as InnerEditor,T_ as InnerEditorEvent,Ac as InteractionBase,mc as InteractionHelper,fc as KeyEvent,Nd as Keyboard,ea as LayoutEvent,Nh as Layouter,ph as Leaf,Wa as LeafBounds,wr as LeafBoundsHelper,y as LeafData,ka as LeafDataProxy,xa as LeafEventer,ur as LeafHelper,Yr as LeafLayout,Bh as LeafLevelList,Eh as LeafList,Oa as LeafMatrix,za as LeafRender,Gl as Leafer,Rh as LeaferCanvas,Ae as LeaferCanvasBase,bl as LeaferData,sa as LeaferEvent,ho as LeaferFilm,ao as LeaferImage,Lf as LeaferTypeCreator,lo as LeaferVideo,Rd as Line,Sl as LineData,j_ as LineEditTool,F as MathHelper,mt as Matrix,J as MatrixHelper,dc as MoveEvent,Df as MultiTouchHelper,hc as MyDragEvent,Od as MyImage,oc as MyPointerEvent,uc as MyTouchEvent,We as NeedConvertToCanvasCommandMap,W as OneRadian,z as PI2,Y as PI_2,nl as Paint,rl as PaintGradient,ol as PaintImage,Wd as Path,sl as PathArrow,ry as PathArrowModule,In as PathBounds,Bs as PathCommandDataHelper,Fe as PathCommandMap,vi as PathCommandNodeHelper,ss as PathConvert,Vn as PathCorner,Hs as PathCreator,Cl as PathData,on as PathDrawer,De as PathHelper,wm as PathMatrixHelper,t as PathNodeHandleType,Ne as PathNumberCommandLengthMap,Xe as PathNumberCommandMap,af as PathScaler,zd as Pen,Ol as PenData,qh as Picker,ee as Platform,ce as Plugin,_t as Point,lt as PointHelper,Hd as PointerButton,nc as PointerEvent,gd as Polygon,Tl as PolygonData,Vr as PropertyEvent,ql as Rect,El as RectData,He as RectHelper,Xl as RectRender,ia as RenderEvent,Vh as Renderer,Qr as ResizeEvent,eo as Resource,Tw as Robot,Bw as RobotData,gc as RotateEvent,he as Run,nm as ScrollBar,Zw as Scroller,Yp as SelectArea,Kh as Selector,wd as Star,Rl as StarData,dl as State,$t as StringNumberMap,zp as Stroker,pc as SwipeEvent,$n as TaskItem,Qn as TaskProcessor,Id as Text,tl as TextConvert,Pl as TextData,Bf as TextEditor,cc as TouchEvent,I_ as TransformTool,Uf as Transformer,cl as Transition,vt as TwoPointBoundsHelper,Hl as UI,Il as UIBounds,pe as UICreator,yl as UIData,Vd as UIEvent,zl as UIRender,il as UnitConvert,Jt as UnitConvertHelper,Or as WaitHelper,ta as WatchEvent,Lh as Watcher,Yf as WheelEventHelper,_c as ZoomEvent,Rf as addViewport,Cf as addViewportConfig,Lo as affectRenderBoundsType,Ro as affectStrokeBoundsType,lm as arrowType,_o as attr,wo as autoLayoutType,ko as boundsType,qn as canvasPatch,Pe as canvasSizeAttrs,Qh as createAttr,go as createDescriptor,No as cursorType,Ho as dataProcessor,mo as dataType,po as decorateLeafAttr,Uo as defineDataProcessor,co as defineKey,fo as defineLeafAttr,Ao as dimType,Eo as doBoundsType,Co as doStrokeType,Zh as effectType,n as emptyData,Yo as eraserType,Ur as extraPropertyEventMap,N as getBoundsData,uo as getDescriptor,H as getMatrixData,X as getPointData,Xo as hitType,u as isArray,p as isData,_ as isEmptyData,h as isFinite,r as isNull,l as isNumber,g as isObject,a as isString,o as isUndefined,Vo as layoutProcessor,ha as leaferTransformAttrMap,zo as maskType,Zv as motionPathType,So as naturalBoundsType,Do as opacityType,Un as path,Bo as pathInputType,To as pathType,jn as pen,yo as positionType,k_ as registerEditTool,S_ as registerInnerEditor,Qo as registerUI,tr as registerUIEvent,Jh as resizeType,Ko as rewrite,Zo as rewriteAble,bo as rotationType,ff as scaleResize,mf as scaleResizeFontSize,wf as scaleResizeGroup,yf as scaleResizePath,vf as scaleResizePoints,xo as scaleType,vo as scrollType,Wo as sortType,ow as stateStyleType,nw as stateType,Oo as strokeType,Po as surfaceType,Kt as tempBounds,yt as tempMatrix,ft as tempPoint,c as tryToNumber,Ch as useCanvas,$o as useModule,Th as version,Mo as visibleType,$h as zoomLayerType};
1
+ var t,e;function i(t,e,i,s){var n,o=arguments.length,r=o<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--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function s(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const n={};function o(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 p(t){return g(t)&&!u(t)}function _(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(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return m(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&m(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign: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(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=o(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,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,this.__complexData&&this.__complexData.destroy()}}const v={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=v;let x,b,S;const{max:k}=Math,E=[0,0,0,0],B={zero:[...E],tempFour:E,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>T(E,t,e,i,s),toTempAB(t,e,i){S=i?l(t)?e:t:[],l(t)?(x=C(t),b=e):l(e)?(x=t,b=C(e)):(x=t,b=e),4!==x.length&&(x=R(x)),4!==b.length&&(b=R(b))},get(t,e){let i;if(!l(t))switch(t.length){case 4:i=o(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!o(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>l(t)&&l(e)?k(t,e):(O(t,e,i),T(S,k(x[0],b[0]),k(x[1],b[1]),k(x[2],b[2]),k(x[3],b[3]))),add:(t,e,i)=>l(t)&&l(e)?t+e:(O(t,e,i),T(S,x[0]+b[0],x[1]+b[1],x[2]+b[2],x[3]+b[3])),swapAndScale(t,e,i,s){if(l(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[o,r,a,h]=4===t.length?t:R(t);return T(n,a*i,h*e,o*i,r*e)}},{set:T,get:R,setTemp:C,toTempAB:O}=B,{round:P,pow:L,max:A,floor:D,PI:M}=Math,F={},I={within:(t,e,i)=>(g(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber:B.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),I.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=o(e)?1e12:L(10,e);return-0===(t=P(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,n=(l(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&I.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,n){let{scaleX:o,scaleY:r}=t;if((s||e)&&(o<0&&(o=-o),r<0&&(r=-r)),e)if(!0===e)o=r=i?1:1/o;else{let t;l(e)?t=e:"zoom-in"===e&&(t=1),t&&(o=r=o>t||r>t?i?1:1/o:i?1:1/t)}return F.scaleX=o,F.scaleY=r,F},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>A(D(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const z=M/180,Y=2*M,X=M/2;function N(){return{x:0,y:0}}function H(){return{x:0,y:0,width:0,height:0}}function V(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:U,acos:G,sqrt:q}=Math,{float:K}=I,Z={};function J(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:J(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,t.f=r},get:V,getWorld:J,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){Q.toInnerPoint(t,e,Z),Q.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=U(e*=z),a=j(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*r},rotateOfOuter(t,e,i){Q.toInnerPoint(t,e,Z),Q.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=z,t.a=s+o*i,t.b=n+r*i),e&&(e*=z,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,Z),Q.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){Q.multiply(t,Q.tempInvert(e))},divideParent(t,e){Q.multiplyParent(t,Q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Q;return Q.copy(e,t),Q.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*z,r=U(o),a=j(o);if(s||n){const e=s*z,i=n*z;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)&&Q.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,g,p,_=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=q(n*n+o*o),c=t/d;const e=n/d;u=o>0?G(e):-G(e)}else{c=q(r*r+a*a),d=t/c;const e=r/c;u=X-(a>0?G(-e):-G(e))}const e=K(U(u)),i=j(u);d=K(d),c=K(c),g=e?K((r/c+i)/e/z,9):0,p=e?K((o/d-i)/e/z,9):0,u=K(u/z)}else d=n,c=a,u=g=p=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=q(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=$,{float:tt}=I,{toInnerPoint:et,toOuterPoint:it}=$,{sin:st,cos:nt,abs:ot,sqrt:rt,atan2:at,min:ht,round:lt}=Math,dt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=o(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?lt(t.x-.5)+.5:lt(t.x),t.y=e?lt(t.y-.5)+.5:lt(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=ct.defaultPoint);const s=nt(e*=z),n=st(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return gt(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return gt(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return gt(i,t),ct.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(gt(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),et(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){et(e,t,i)},toOuterOf(t,e,i){it(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)=>ut(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=ot(i-t),o=ot(s-e);return rt(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>ht(ut(t,e,i,s),ut(i,s,n,o)),getAngle:(t,e)=>_t(t,e)/z,getRotation:(t,e,i,s)=>(s||(s=e),ct.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/z),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const o=_t(t,e);return n&&(t=e),s||(e={}),e.x=t.x+nt(o)*i,e.y=t.y+st(o)*i,e},toNumberPoints(t){let e=t;return g(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,i)=>i?t.x===e.x&&t.y===e.y:tt(t.x)===tt(e.x)&&tt(t.y)===tt(e.y),reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:gt,setRadius:pt,getAtan2:_t}=ct;class ft{constructor(t,e){this.set(t,e)}set(t,e){return g(t)?dt.copy(this,t):dt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new ft(this)}move(t,e){return dt.move(this,t,e),this}scale(t,e){return dt.scale(this,t,e),this}scaleOf(t,e,i){return dt.scaleOf(this,t,e,i),this}rotate(t,e){return dt.rotate(this,t,e),this}rotateOf(t,e){return dt.rotate(this,e,t),this}getRotation(t,e,i){return dt.getRotation(this,t,e,i)}toInnerOf(t,e){return dt.toInnerOf(this,t,e),this}toOuterOf(t,e){return dt.toOuterOf(this,t,e),this}getCenter(t){return new ft(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new ft(dt.getDistancePoint(this,t,e,i,s))}getAngle(t){return dt.getAngle(this,t)}getAtan2(t){return dt.getAtan2(this,t)}isSame(t,e){return dt.isSame(this,t,e)}reset(){return dt.reset(this),this}}const mt=new ft;class yt{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return g(t)?$.copy(this,t):$.set(this,t,e,i,s,n,o),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new yt(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const vt=new yt,wt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){xt(t,e,i),xt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:xt}=wt;var bt,St;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(bt||(bt={})),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"}(St||(St={}));const kt=[{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}];kt.forEach(t=>t.type="percent");const Et={directionData:kt,tempPoint:{},get:Bt,toPoint(t,e,i,s,n,o){const r=Bt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(o||(i.x-=n.x,i.y-=n.y),r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i,s=!0)=>(i||(i={}),Et.toPoint(t,e,i,s),i)};function Bt(t){return a(t)?kt[St[t]]:t}const{toPoint:Tt}=Et,Rt={toPoint(t,e,i,s,n,o){Tt(t,i,s,n,e,o)}},{tempPointBounds:Ct,setPoint:Ot,addPoint:Pt,toBounds:Lt}=wt,{toOuterPoint:At}=$,{float:Dt,fourNumber:Mt}=I,{floor:Ft,ceil:It}=Math;let Wt,zt,Yt,Xt;const Nt={},Ht={},Vt={},jt={tempBounds:Vt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:o,y:r,width:a,height:h}=e;if(u(i)){const e=Mt(i);s?Ut.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ut.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ut.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,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),Ut.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?qt(e,t):e=t,i||(i=t),e.offsetX=Ut.maxX(i),e.offsetY=Ut.maxY(i),Ut.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||dt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){dt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ut.copy(Vt,t),Ut.toOuterOf(Vt,e),Vt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ut.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:o,f:r}=e;s>0?(i.width=t.width*s,i.x=o+t.x*s):(i.width=t.width*-s,i.x=o+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=r+t.y*n):(i.height=t.height*-n,i.y=r+t.y*n-i.height)}else Nt.x=t.x,Nt.y=t.y,At(e,Nt,Ht),Ot(Ct,Ht.x,Ht.y),Nt.x=t.x+t.width,At(e,Nt,Ht),Pt(Ct,Ht.x,Ht.y),Nt.y=t.y+t.height,At(e,Nt,Ht),Pt(Ct,Ht.x,Ht.y),Nt.x=t.x,At(e,Nt,Ht),Pt(Ct,Ht.x,Ht.y),Lt(Ct,i)},toInnerOf(t,e,i){i||(i=t),Ut.move(i,-e.e,-e.f),Ut.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ut.getFitScale(t,e));return new yt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),a(s)&&(s=Ut.getFitScale(t,e,"cover"===s)),Vt.width=n?e.width*=s:e.width*s,Vt.height=n?e.height*=s:e.height*s,Rt.toPoint(i,Vt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Ut.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ut.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ut.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Ft(t.x),t.y=Ft(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=i>t.y?It(t.height+i-t.y):It(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Dt(t.x,e),t.y=Dt(t.y,e),t.width=Dt(t.width,e),t.height=Dt(t.height,e)},add(t,e,i){Wt=t.x+t.width,zt=t.y+t.height,Yt=e.x,Xt=e.y,i||(Yt+=e.width,Xt+=e.height),Wt=Wt>Yt?Wt:Yt,zt=zt>Xt?zt:Xt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Wt-t.x,t.height=zt-t.y},addList(t,e){Ut.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ut.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ut.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r],r):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||qt(t,n)):Gt(t,n));o&&Ut.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ot(Ct,t.x,t.y):Pt(Ct,t.x,t.y)),Lt(Ct,t)},setPoint(t,e){Ut.set(t,e.x,e.y)},addPoint(t,e){Gt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},getPoint:(t,e,i=!1,s)=>Et.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=dt.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=dt.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=Ut.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=Ut.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=Ut.tempToOuterOf(e,i)),!Ut.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return Wt=s+o,zt=n+r,Yt=t.x+t.width,Xt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Wt=Wt<Yt?Wt:Yt,zt=zt<Xt?zt:Xt,o=Wt-s,r=zt-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Ut.copy(t,Ut.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ut.set(t)}},Ut=jt,{add:Gt,copy:qt}=Ut;class Kt{get minX(){return jt.minX(this)}get minY(){return jt.minY(this)}get maxX(){return jt.maxX(this)}get maxY(){return jt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return g(t)?jt.copy(this,t):jt.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 Kt(this)}move(t,e){return jt.move(this,t,e),this}scale(t,e,i){return jt.scale(this,t,e,i),this}scaleOf(t,e,i){return jt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return jt.toOuterOf(this,t,e),this}toInnerOf(t,e){return jt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return jt.getFitMatrix(this,t,e)}put(t,e,i){jt.put(this,t,e,i)}spread(t,e){return jt.spread(this,t,e),this}shrink(t,e){return jt.shrink(this,t,e),this}ceil(){return jt.ceil(this),this}unsign(){return jt.unsign(this),this}float(t){return jt.float(this,t),this}add(t){return jt.add(this,t),this}addList(t){return jt.setList(this,t,!0),this}setList(t){return jt.setList(this,t),this}addListWithFn(t,e){return jt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return jt.setListWithFn(this,t,e),this}setPoint(t){return jt.setPoint(this,t),this}setPoints(t){return jt.setPoints(this,t),this}addPoint(t){return jt.addPoint(this,t),this}getPoints(){return jt.getPoints(this)}getPoint(t,e,i){return jt.getPoint(this,t,e,i)}hitPoint(t,e){return jt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return jt.hitRadiusPoint(this,t,e)}hit(t,e){return jt.hit(this,t,e)}includes(t,e){return jt.includes(this,t,e)}intersect(t,e){return jt.intersect(this,t,e),this}getIntersect(t,e){return new Kt(jt.getIntersectData(this,t,e))}isSame(t){return jt.isSame(this,t)}isEmpty(){return jt.isEmpty(this)}reset(){jt.reset(this)}}const Zt=new Kt;class Jt{constructor(t,e,i,s,n,o){g(t)?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new Kt(n,e,o||t.width-n-i,r||t.height-e-s)}}const $t={number:(t,e)=>g(t)?"percent"===t.type?t.value*e:t.value:t},Qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:te,max:ee}=Math,ie={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||se.maxCacheSize),isSuperLarge:(t,e,i)=>se.isLarge(t,e,i,se.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=se;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,o,r,a,h,l){const d=ee(te(e+(s||0)),1),c=ee(te(i+(n||0)),1);let u,g,p;l&&(p=$t.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:g=!0);const _=ie.origin.createCanvas(g?2*d:d,u?2*c:c),f=_.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==r,se.canUse(t)){if(o){const s=e/o.width,n=i/o.height;f.setTransform(s,0,0,n,-o.x*s,-o.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(_,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(_,0,0,d,c,u?p:d,u?c:p,d,c))}return _},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&f.stintSet(i,"transform",e)}}},{image:se}=ie,{randColor:ne}=I;class oe{constructor(t){this.repeatMap={},this.name=t}static get(t){return new oe(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const i=ne();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===oe.showBounds,n=t.__nowWorld,o=ne();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(ae.enable){if(ae.filterList.length&&ae.filterList.every(t=>t!==this.name))return;if(ae.excludeList.length&&ae.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ae.enable&&this.warn(...t)}warn(...t){ae.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function re(t){return t?a(t)&&(t=[t]):t=[],t}oe.filterList=[],oe.excludeList=[],oe.showWarn=!0;const ae=oe,he=oe.get("RunTime"),le={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=v.create(v.RUNTIME);return de.currentId=de.idMap[i]=e?performance.now():Date.now(),de.currentName=de.nameMap[i]=t,de.nameToIdMap[t]=i,i},end(t,e){const i=de.idMap[t],s=de.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;de.idMap[t]=de.nameMap[t]=de.nameToIdMap[s]=void 0,he.log(s,n,"ms")},endOfName(t,e){const i=de.nameToIdMap[t];o(i)||de.end(i,e)}},de=le,ce=[],ue={list:{},add(t,...e){this.list[t]=!0,ce.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(()=>ce.forEach(t=>ue.has(t,!0)));const ge={editor:t=>ue.need("editor")},pe=oe.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;fe[e]&&pe.repeat(e),fe[e]=t},get(t,e,i,s,n,r){if(!fe[t])return void pe.warn("not register "+t);const a=new fe[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:fe}=_e,me=oe.get("EventCreator"),ye={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(ve[e]&&me.repeat(e),ve[e]=t)})},changeName(t,e){const i=ve[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ve[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ve[t](...e)},{nameList:ve}=ye;class we{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ge.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 xe(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}const be=[];function Se(){return(t,e)=>{be.push(e)}}const ke=[];let Ee=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||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;be.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){g(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};i([xe("imageSmoothingEnabled")],Ee.prototype,"smooth",void 0),i([xe("imageSmoothingQuality")],Ee.prototype,"smoothLevel",void 0),i([xe("globalAlpha")],Ee.prototype,"opacity",void 0),i([xe()],Ee.prototype,"fillStyle",void 0),i([xe()],Ee.prototype,"strokeStyle",void 0),i([xe("lineWidth")],Ee.prototype,"strokeWidth",void 0),i([xe("lineCap")],Ee.prototype,"strokeCap",void 0),i([xe("lineJoin")],Ee.prototype,"strokeJoin",void 0),i([xe("lineDashOffset")],Ee.prototype,"dashOffset",void 0),i([xe()],Ee.prototype,"miterLimit",void 0),i([xe()],Ee.prototype,"shadowBlur",void 0),i([xe()],Ee.prototype,"shadowColor",void 0),i([xe()],Ee.prototype,"shadowOffsetX",void 0),i([xe()],Ee.prototype,"shadowOffsetY",void 0),i([xe()],Ee.prototype,"filter",void 0),i([xe()],Ee.prototype,"font",void 0),i([xe()],Ee.prototype,"fontKerning",void 0),i([xe()],Ee.prototype,"fontStretch",void 0),i([xe()],Ee.prototype,"fontVariantCaps",void 0),i([xe()],Ee.prototype,"textAlign",void 0),i([xe()],Ee.prototype,"textBaseline",void 0),i([xe()],Ee.prototype,"textRendering",void 0),i([xe()],Ee.prototype,"wordSpacing",void 0),i([xe()],Ee.prototype,"letterSpacing",void 0),i([xe()],Ee.prototype,"direction",void 0),i([Se()],Ee.prototype,"setTransform",null),i([Se()],Ee.prototype,"resetTransform",null),i([Se()],Ee.prototype,"getTransform",null),i([Se()],Ee.prototype,"save",null),i([Se()],Ee.prototype,"restore",null),i([Se()],Ee.prototype,"translate",null),i([Se()],Ee.prototype,"scale",null),i([Se()],Ee.prototype,"rotate",null),i([Se()],Ee.prototype,"fill",null),i([Se()],Ee.prototype,"stroke",null),i([Se()],Ee.prototype,"clip",null),i([Se()],Ee.prototype,"fillRect",null),i([Se()],Ee.prototype,"strokeRect",null),i([Se()],Ee.prototype,"clearRect",null),i([Se()],Ee.prototype,"beginPath",null),i([Se()],Ee.prototype,"moveTo",null),i([Se()],Ee.prototype,"lineTo",null),i([Se()],Ee.prototype,"bezierCurveTo",null),i([Se()],Ee.prototype,"quadraticCurveTo",null),i([Se()],Ee.prototype,"closePath",null),i([Se()],Ee.prototype,"arc",null),i([Se()],Ee.prototype,"arcTo",null),i([Se()],Ee.prototype,"ellipse",null),i([Se()],Ee.prototype,"rect",null),i([Se()],Ee.prototype,"roundRect",null),i([Se()],Ee.prototype,"createConicGradient",null),i([Se()],Ee.prototype,"createLinearGradient",null),i([Se()],Ee.prototype,"createPattern",null),i([Se()],Ee.prototype,"createRadialGradient",null),i([Se()],Ee.prototype,"fillText",null),i([Se()],Ee.prototype,"measureText",null),i([Se()],Ee.prototype,"strokeText",null);const{copy:Be,multiplyParent:Te,pixelScale:Re}=$,{round:Ce}=Math,Oe=new Kt,Pe=new Kt,Le={width:1,height:1,pixelRatio:1},Ae=["width","height","pixelRatio"];class De extends Ee{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Le),this.manager=e,this.innerId=v.create(v.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||ie.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,Ae),Ae.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Te(t,e,n),Re(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Ce(n.e-.5)+.5,n.f=Ce(n.f-.5)+.5):(n.e=Ce(n.e),n.f=Ce(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Pe):i=Oe,this.drawImage(t.view,Oe.x,Oe.y,Oe.width,Oe.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,jt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Oe.x,Oe.y,Oe.width,Oe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,o){this.resetTransform(),this.copyWorld(t,e,i,s,o),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Oe.x,Oe.y,Oe.width,Oe.height),{data:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?i:e*(i/255));s.putImageData(n,Oe.x,Oe.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(Oe.x,Oe.y,Oe.width,Oe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Oe.x,Oe.y,Oe.width,Oe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Oe.x,Oe.y,Oe.width,Oe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Oe.x,Oe.y,Oe.width,Oe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Oe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Pe,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ge.canvas(Object.assign({},i));return n.save(),t&&(Be(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Me={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Fe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Fe),We={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},ze={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},Ye=Object.assign(Object.assign({},ze),Fe),Xe=Ie,Ne={};for(let t in Xe)Ne[Xe[t]]=t;const He={};for(let t in Xe)He[Xe[t]]=We[t];const Ve={drawRoundRect(t,e,i,s,n,o){const r=I.fourNumber(o,Math.min(s/2,n/2)),a=e+s,h=i+n;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:je,cos:Ue,hypot:Ge,atan2:qe,ceil:Ke,abs:Ze,PI:Je,sqrt:$e,pow:Qe}=Math,{setPoint:ti,addPoint:ei}=wt,{set:ii,toNumberPoints:si}=dt,{M:ni,L:oi,C:ri,Q:ai,Z:hi}=Ie,li={},di={points(t,e,i,s){let n=si(e);if(t.push(ni,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,g,p,_,f,m,y,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=r-e,_=a-o,f=$e(Qe(p,2)+Qe(_,2)),m=$e(Qe(h-r,2)+Qe(l-a,2)),(f||m)&&(y=f+m,f=w*f/y,m=w*m/y,h-=e,l-=o,d=r-f*h,c=a-f*l,2===i?s||t.push(ai,d,c,r,a):(p||_)&&t.push(ri,u,g,d,c,r,a),u=r+m*h,g=a+m*l);s||t.push(ai,u,g,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(oi,n[e],n[e+1]);s&&t.push(hi)},rect(t,e,i,s,n){Me.creator.path=t,Me.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,o){Me.creator.path=[],Ve.drawRoundRect(Me.creator,e,i,s,n,o),t.push(...Me.convertToCanvasData(Me.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,g=o-s,p=r-n;let _=qe(u,c),f=qe(p,g);const m=Ge(c,u),y=Ge(g,p);let v=f-_;if(v<0&&(v+=Y),m<1e-12||y<1e-12||v<1e-12||Ze(v-Je)<1e-12)return t&&t.push(oi,s,n),h&&(ti(h,e,i),ei(h,s,n)),d&&ii(d,e,i),void(l&&ii(l,s,n));const w=c*p-g*u<0,x=w?-1:1,b=a/Ue(v/2),S=s+b*Ue(_+v/2+X*x),k=n+b*je(_+v/2+X*x);return _-=X*x,f-=X*x,gi(t,S,k,a,a,0,_/z,f/z,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>gi(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,l,d,c){const u=o*z,g=je(u),p=Ue(u);let _=r*z,f=a*z;_>Je&&(_-=Y),f<0&&(f+=Y);let m=f-_;m<0?m+=Y:m>Y&&(m-=Y),h&&(m-=Y);const y=Ke(Ze(m/X)),v=m/y,w=je(v/4),x=8/3*w*w/je(v/2);f=_+v;let b,S,k,E,B,T,R,C,O=Ue(_),P=je(_),L=k=p*s*O-g*n*P,A=E=g*s*O+p*n*P,D=e+k,M=i+E;t&&t.push(t.length?oi:ni,D,M),l&&ti(l,D,M),c&&ii(c,D,M);for(let o=0;o<y;o++)b=Ue(f),S=je(f),k=p*s*b-g*n*S,E=g*s*b+p*n*S,B=e+L-x*(p*s*P+g*n*O),T=i+A-x*(g*s*P-p*n*O),R=e+k+x*(p*s*S+g*n*b),C=i+E+x*(g*s*S-p*n*b),t&&t.push(ri,B,T,R,C,e+k,i+E),l&&ui(e+L,i+A,B,T,R,C,e+k,i+E,l,!0),L=k,A=E,O=b,P=S,_=f,f+=v;d&&ii(d,e+k,i+E)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(ri,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){ui(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,g,p,_,f,m,y,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,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;p=-g/u,0<p&&p<1&&d.push(p)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?ei(h,t,e):ti(h,t,e),ei(h,r,a);for(let l=0,c=d.length;l<c;l++)ci(d[l],t,e,i,s,n,o,r,a,li),ei(h,li.x,li.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,p=t*t*t;l.x=c*e+u*s+g*o+p*a,l.y=c*i+u*n+g*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return ci(t,e,i,s,n,o,r,a,h,l),l},getDerivative(t,e,i,s,n){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:ci,toTwoPointBounds:ui,ellipse:gi}=di,{sin:pi,cos:_i,sqrt:fi,atan2:mi}=Math,{ellipse:yi}=di,vi={ellipticalArc(t,e,i,s,n,o,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=o*z,p=pi(g),_=_i(g),f=-_*c-p*u,m=-_*u+p*c,y=s*s,v=n*n,w=m*m,x=f*f,b=y*v-y*w-v*x;let S=0;if(b<0){const t=fi(1-b/(y*v));s*=t,n*=t}else S=(r===a?-1:1)*fi(b/(y*w+v*x));const k=S*s*m/n,E=-S*n*f/s,B=mi((m-E)/n,(f-k)/s),T=mi((-m-E)/n,(-f-k)/s);let R=T-B;0===a&&R>0?R-=Y:1===a&&R<0&&(R+=Y);const C=e+c+_*k-p*E,O=i+u+p*k+_*E,P=R<0?1:0;d||ie.ellipseToCurve?yi(t,C,O,s,n,o,B/z,T/z,P):s!==n||o?t.push(Ie.G,C,O,s,n,o,B/z,T/z,P):t.push(Ie.O,C,O,s,B/z,T/z,P)}},wi={toCommand:t=>[],toNode:t=>[]},{M:xi,m:bi,L:Si,l:ki,H:Ei,h:Bi,V:Ti,v:Ri,C:Ci,c:Oi,S:Pi,s:Li,Q:Ai,q:Di,T:Mi,t:Fi,A:Ii,a:Wi,Z:zi,z:Yi,N:Xi,D:Ni,X:Hi,G:Vi,F:ji,O:Ui,P:Gi,U:qi}=Ie,{rect:Ki,roundRect:Zi,arcTo:Ji,arc:$i,ellipse:Qi,quadraticCurveTo:ts}=di,{ellipticalArc:es}=vi,is=oe.get("PathConvert"),ss={},ns={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=He[s],a+=s===n?" ":Ne[s];for(let s=1;s<i;s++)a+=I.float(t[o+s],e),s===i-1||(a+=" ");n=s,o+=i}return a},parse(t,e){let i,s,n,o="";const r=[],a=e?Ye:ze;for(let e=0,h=t.length;e<h;e++)s=t[e],Qt[s]?("."===s&&(os.dot&&(rs(r,o),o=""),os.dot++),"0"===o&&"."!==s&&(rs(r,o),o=""),o+=s):Ie[s]?(o&&(rs(r,o),o=""),os.name=Ie[s],os.length=We[s],os.index=0,rs(r,os.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&rs(r,o),o=s):o&&(rs(r,o),o=""),n=s;return o&&rs(r,o),i?ns.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(n=t[c],n){case bi:t[c+1]+=a,t[c+2]+=h;case xi:a=t[c+1],h=t[c+2],g.push(xi,a,h),c+=3;break;case Bi:t[c+1]+=a;case Ei:a=t[c+1],g.push(Si,a,h),c+=2;break;case Ri:t[c+1]+=h;case Ti:h=t[c+1],g.push(Si,a,h),c+=2;break;case ki:t[c+1]+=a,t[c+2]+=h;case Si:a=t[c+1],h=t[c+2],g.push(Si,a,h),c+=3;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Pi;case Pi:r=o===Ci||o===Pi,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(Ci,l,d,i,s,a,h),c+=5;break;case Oi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ci;case Ci:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ci,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Fi:t[c+1]+=a,t[c+2]+=h,n=Mi;case Mi:r=o===Ai||o===Mi,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?ts(g,a,h,i,s,t[c+1],t[c+2]):g.push(Ai,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ai;case Ai:i=t[c+1],s=t[c+2],e?ts(g,a,h,i,s,t[c+3],t[c+4]):g.push(Ai,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Wi:t[c+6]+=a,t[c+7]+=h;case Ii:es(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 Yi:case zi:g.push(zi),c++;break;case Xi:a=t[c+1],h=t[c+2],e?Ki(g,a,h,t[c+3],t[c+4]):as(g,t,c,5),c+=5;break;case Ni: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]]):as(g,t,c,9),c+=9;break;case Hi:a=t[c+1],h=t[c+2],e?Zi(g,a,h,t[c+3],t[c+4],t[c+5]):as(g,t,c,6),c+=6;break;case Vi:Qi(e?g:as(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,ss),a=ss.x,h=ss.y,c+=9;break;case ji:e?Qi(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):as(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ui:$i(e?g:as(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ss),a=ss.x,h=ss.y,c+=7;break;case Gi:e?$i(g,t[c+1],t[c+2],t[c+3],0,360,!1):as(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case qi:Ji(e?g:as(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ss),a=ss.x,h=ss.y,c+=6;break;default:return is.error(`command: ${n} [index:${c}]`,t),g}o=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return wi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(xi,t.x,t.y);break;case"L":e.push(Si,t.x,t.y);break;case"C":e.push(Ci,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ai,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(zi)}}),e}},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){os.index===os.length&&(os.index=1,t.push(os.name)),t.push(Number(e)),os.index++,os.dot=0}},{current:os,pushData:rs,copyData:as}=ns,{M:hs,L:ls,C:ds,Q:cs,Z:us,N:gs,D:ps,X:_s,G:fs,F:ms,O:ys,P:vs,U:ws}=Ie,{getMinDistanceFrom:xs,getRadianFrom:bs}=dt,{tan:Ss,min:ks,abs:Es}=Math,Bs={},Ts={beginPath(t){t.length=0},moveTo(t,e,i){t.push(hs,e,i)},lineTo(t,e,i){t.push(ls,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(ds,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(cs,e,i,s,n)},closePath(t){t.push(us)},rect(t,e,i,s,n){t.push(gs,e,i,s,n)},roundRect(t,e,i,s,n,o){if(l(o))t.push(_s,e,i,s,n,o);else{const r=I.fourNumber(o);r?t.push(ps,e,i,s,n,...r):t.push(gs,e,i,s,n)}},ellipse(t,e,i,s,n,o,a,h,l){if(s===n)return Cs(t,e,i,s,a,h,l);r(o)?t.push(ms,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(fs,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(vs,e,i,s):(r(n)&&(n=0),r(o)&&(o=360),t.push(ys,e,i,s,n,o,a?1:0))},arcTo(t,e,i,s,n,r,a,h,l){if(!o(a)){const t=xs(a,h,e,i,s,n)/(l?1:2);r=ks(r,ks(t,t*Es(Ss(bs(a,h,e,i,s,n)/2))))}t.push(ws,e,i,s,n,r)},drawEllipse(t,e,i,s,n,o,a,h,l){di.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,Bs),t.push(hs,Bs.x,Bs.y),Rs(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){di.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,Bs),t.push(hs,Bs.x,Bs.y),Cs(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){di.points(t,e,i,s)}},{ellipse:Rs,arc:Cs}=Ts,{moveTo:Os,lineTo:Ps,quadraticCurveTo:Ls,bezierCurveTo:As,closePath:Ds,beginPath:Ms,rect:Fs,roundRect:Is,ellipse:Ws,arc:zs,arcTo:Ys,drawEllipse:Xs,drawArc:Ns,drawPoints:Hs}=Ts;class Vs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Me.parse(t):t:[],this}beginPath(){return Ms(this.__path),this.paint(),this}moveTo(t,e){return Os(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ps(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return As(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ds(this.__path),this.paint(),this}rect(t,e,i,s){return Fs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Is(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return Ws(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return zs(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return Ys(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return Xs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return Ns(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return Hs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:js,L:Us,C:Gs,Q:qs,Z:Ks,N:Zs,D:Js,X:$s,G:Qs,F:tn,O:en,P:sn,U:nn}=Ie,on=oe.get("PathDrawer"),rn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case js:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Us:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Gs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case qs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks: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 Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case $s:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*z,e[s+6]*z,e[s+7]*z,e[s+8]),s+=9;break;case tn:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,Y,!1),s+=5;break;case en:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*z,e[s+5]*z,e[s+6]),s+=7;break;case sn:t.arc(e[s+1],e[s+2],e[s+3],0,Y,!1),s+=4;break;case nn:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void on.error(`command: ${i} [index:${s}]`,e)}}},{M:an,L:hn,C:ln,Q:dn,Z:cn,N:un,D:gn,X:pn,G:_n,F:fn,O:mn,P:yn,U:vn}=Ie,{toTwoPointBounds:wn,toTwoPointBoundsByQuadraticCurve:xn,arcTo:bn,arc:Sn,ellipse:kn}=di,{addPointBounds:En,copy:Bn,addPoint:Tn,setPoint:Rn,addBounds:Cn,toBounds:On}=wt,Pn=oe.get("PathBounds");let Ln,An,Dn;const Mn={},Fn={},In={},Wn={toBounds(t,e){Wn.toTwoPointBounds(t,Fn),On(Fn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Rn(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===cn||r===ln||r===dn?Rn(e,h,l):Rn(e,t[a+1],t[a+2])),r){case an:case hn:h=t[a+1],l=t[a+2],Tn(e,h,l),a+=3;break;case ln:n=t[a+5],o=t[a+6],wn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,Mn),En(e,Mn),h=n,l=o,a+=7;break;case dn:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],xn(h,l,i,s,n,o,Mn),En(e,Mn),h=n,l=o,a+=5;break;case cn:a+=1;break;case un:h=t[a+1],l=t[a+2],Cn(e,h,l,t[a+3],t[a+4]),a+=5;break;case gn:case pn:h=t[a+1],l=t[a+2],Cn(e,h,l,t[a+3],t[a+4]),a+=r===gn?9:6;break;case _n:kn(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],Mn,In),0===a?Bn(e,Mn):En(e,Mn),h=In.x,l=In.y,a+=9;break;case fn:h=t[a+1],l=t[a+2],An=t[a+3],Dn=t[a+4],Cn(e,h-An,l-Dn,2*An,2*Dn),h+=An,a+=5;break;case mn:Sn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Mn,In),0===a?Bn(e,Mn):En(e,Mn),h=In.x,l=In.y,a+=7;break;case yn:h=t[a+1],l=t[a+2],Ln=t[a+3],Cn(e,h-Ln,l-Ln,2*Ln,2*Ln),h+=Ln,a+=4;break;case vn:bn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Mn,In),0===a?Bn(e,Mn):En(e,Mn),h=In.x,l=In.y,a+=6;break;default:return void Pn.error(`command: ${r} [index:${a}]`,t)}}},{M:zn,L:Yn,Z:Xn}=Ie,{getCenterX:Nn,getCenterY:Hn}=dt,{arcTo:Vn}=Ts,jn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,g=0,p=0,_=0;u(e)&&(e=e[0]||0);const f=t.length,m=9===f,y=[];for(;r<f;){switch(s=t[r],s){case zn:l=p=t[r+1],d=_=t[r+2],r+=3,t[r]===Yn?(c=t[r+1],g=t[r+2],m?y.push(zn,l,d):y.push(zn,Nn(l,c),Hn(d,g))):y.push(zn,l,d);break;case Yn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Yn:Vn(y,a,h,t[r+1],t[r+2],e,p,_,m);break;case Xn:Vn(y,a,h,l,d,e,p,_,m);break;default:y.push(Yn,a,h)}p=a,_=h;break;case Xn:n!==Xn&&(Vn(y,l,d,c,g,e,p,_,m),y.push(Xn)),r+=1;break;default:o=He[s];for(let e=0;e<o;e++)y.push(t[r+e]);r+=o}n=s}return s!==Xn&&(y[1]=l,y[2]=d),y}};function Un(t){return new Vs(t)}const Gn=Un();Me.creator=Un(),Me.parse=ns.parse,Me.convertToCanvasData=ns.toCanvasData;const{drawRoundRect:qn}=Ve;function Kn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){qn(this,t,e,i,s,n)})}(t)}const Zn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Jn.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{}}}},Jn=Zn;Jn.mineType=Jn.mimeType,Jn.alphaPixelTypes.forEach(t=>Jn.upperCaseTypeMap[t]=t.toUpperCase());const $n=oe.get("TaskProcessor");class Qn{constructor(t){this.parallel=!0,this.time=1,this.id=v.create(v.TASK),this.task=t}run(){return s(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){$n.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class to{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,i){let s,n,r,a;const h=new Qn(t);return h.parent=this,l(e)?a=e:e&&(n=e.parallel,s=e.start,r=e.time,a=e.delay,i||(i=e.canUse)),r&&(h.time=r),!1===n&&(h.parallel=!1),i&&(h.canUse=i),o(a)?this.push(h,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(h,s))},a)),this.isComplete=!1,h}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const eo=oe.get("Resource"),io={tasker:new to,queue:new to({parallel:1}),map:{},get isComplete(){return so.tasker.isComplete},set(t,e){so.map[t]&&eo.repeat(t),so.map[t]=e},get:t=>so.map[t],remove(t){const e=so.map[t];e&&(e.destroy&&e.destroy(),delete so.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ge.image(s)),so.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){so.map={}}},so=io,no={maxRecycled:10,recycledList:[],patternTasker:io.queue,get(t,e){let i=io.get(t.url);return i||io.set(t.url,i="film"===e?ge.film(t):ge.image(t)),i.use++,i},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(ie.image.isLarge(t)?t.url&&io.remove(t.url):(t.clearLevels(),oo.recycledList.push(t)))})},recyclePaint(t){oo.recycle(t.image)},clearRecycled(t){const e=oo.recycledList;(e.length>oo.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&io.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Zn.alphaPixelTypes.some(e=>oo.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:"+Zn.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Zn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},oo=no,{IMAGE:ro,create:ao}=v;class ho{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return o(t)?ie.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=ao(ro),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}no.isFormat("svg",t)&&(this.isSVG=!0),no.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,io.tasker.add(()=>s(this,void 0,void 0,function*(){return yield ie.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,o,r,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=ie.image.resize(this.view,t,e,n,o,void 0,r,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=ie.canvas.createPattern(t,e);return ie.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,o,r,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}class lo extends ho{get tag(){return"Film"}}class co extends ho{get tag(){return"Video"}}function uo(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function go(t,e){return Object.getOwnPropertyDescriptor(t,e)}function po(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function _o(t,e){return(i,s)=>mo(i,s,t,e&&e(s))}function fo(t){return t}function mo(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};uo(t,e,Object.assign(n,s||{})),Uo(t,e,i)}function yo(t){return _o(t)}function vo(t,e){return _o(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function wo(t,e){return _o(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function xo(t){return _o(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Bo(this))}}))}function bo(t,e){return _o(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function So(t,e){return _o(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function ko(t,e){return _o(t,t=>({set(i){this.__setAttr(t,i,e)&&Bo(this)}}))}function Eo(t){return _o(t,t=>({set(e){this.__setAttr(t,e)&&(Bo(this),this.__.__removeNaturalSize())}}))}function Bo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function To(t){return _o(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Bo(this)}}))}const Ro=ko;function Co(t,e){return _o(t,t=>({set(i){this.__setAttr(t,i)&&(Oo(this),e&&(this.__.__useStroke=!0))}}))}function Oo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Bo(t)}const Po=Co;function Lo(t){return _o(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ao(t){return _o(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Do(t){return _o(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;f.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function Mo(t){return _o(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Io(this)}}))}function Fo(t){return _o(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Wo(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Wo(this,t,e,i),this.mask&&Io(this)}}))}function Io(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Wo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Bo(t))}function zo(t){return _o(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__layout.childrenSortChange()})}}))}function Yo(t){return _o(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Xo(t){return _o(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function No(t){return _o(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function Ho(t){return _o(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Vo(t){return(e,i)=>{uo(e,"__DataProcessor",{get:()=>t})}}function jo(t){return(e,i)=>{uo(e,"__LayoutProcessor",{get:()=>t})}}function Uo(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=po(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(g(i)){const t=_(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=go(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),uo(s,e,a)}const Go=new oe("rewrite"),qo=[],Ko=["destroy","constructor"];function Zo(t){return(e,i)=>{qo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Jo(){return t=>{$o()}}function $o(t){qo.length&&(qo.forEach(e=>{t&&Go.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),qo.length=0)}function Qo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Ko.includes(s)||e&&e.includes(s)))if(t.prototype){go(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function tr(){return t=>{_e.register(t)}}function er(){return t=>{ye.register(t)}}setTimeout(()=>$o(!0));const{copy:ir,toInnerPoint:sr,toOuterPoint:nr,scaleOfOuter:or,rotateOfOuter:rr,skewOfOuter:ar,multiplyParent:hr,divideParent:lr,getLayout:dr}=$,cr={},{round:ur}=Math,gr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),fr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)_r(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++)mr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&mr(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&pr.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(vr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)yr(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,o){s||(s=t.__nowWorld),t.__worldFlipped||ie.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,o):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},renderComplex(t,e,i){},updateComplex(t){},checkComplex(t){},moveWorld(t,e,i=0,s,n){const o=g(e)?Object.assign({},e):{x:e,y:i};s?nr(t.localTransform,o,o,!0):t.parent&&sr(t.parent.scrollWorldTransform,o,o,!0),pr.moveLocal(t,o.x,o.y,n)},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=ur(e),i=ur(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){pr.zoomOfLocal(t,wr(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(l(s)||(s&&(o=s),s=i),ir(cr,r),or(cr,e,i,s),pr.hasHighPosition(t))pr.setTransform(t,cr,n,o);else{const e=t.x+cr.e-r.e,a=t.y+cr.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){pr.rotateOfLocal(t,wr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;ir(cr,n),rr(cr,e,i),pr.hasHighPosition(t)?pr.setTransform(t,cr,!1,s):t.set({x:t.x+cr.e-n.e,y:t.y+cr.f-n.f,rotation:I.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){pr.skewOfLocal(t,wr(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){ir(cr,t.__localMatrix),ar(cr,e,i,s),pr.setTransform(t,cr,n,o)},transformWorld(t,e,i,s){ir(cr,t.worldTransform),hr(cr,e),t.parent&&lr(cr,t.parent.scrollWorldTransform),pr.setTransform(t,cr,i,s)},transform(t,e,i,s){ir(cr,t.localTransform),hr(cr,e),pr.setTransform(t,cr,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&pr.getInnerOrigin(t,n.origin),r=dr(e,o,n.around&&pr.getInnerOrigin(t,n.around));if(pr.hasOffset(t)&&(r.x-=n.offsetX,r.y-=n.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){jt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=pr.getInnerOrigin(t,n.origin);dt.move(r,o.x-s.x,o.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 or(i,pr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(pr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Et.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(ir(cr,t.worldTransform),lr(cr,e.scrollWorldTransform),i?cr:Object.assign({},cr)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,i,s){t.setTransform(pr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||pr.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),ie.requestRender(()=>pr.animateMove(t,e,i))}}},pr=gr,{updateAllMatrix:_r,updateMatrix:fr,updateAllWorldOpacity:mr,updateAllChange:yr,updateChange:vr}=pr;function wr(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const xr={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds(t){const{__:e,__layout:i}=t;return e.eraser||0===e.visible?null:i.localOuterBounds||i.localRenderBounds},maskLocalBoxBounds:(t,e)=>Sr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Sr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:i}=t;return Sr(t,e)&&(i.localOuterBounds||i.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let br;function Sr(t,e){return e||(br=0),t.__.mask&&(br=1),br<0?null:(br&&(br=-1),!0)}const{updateBounds:kr}=gr,Er={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Br(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)Tr(e[t],e)},updateBounds(t,e){const i=[t];Tr(t,i),Rr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)kr(s[t]);e&&e===i||kr(i)}},move(t,e,i){let s;const{children:n}=t;for(let o=0,r=n.length;o<r;o++)s=(t=n[o]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Cr(t,e,i)},scale(t,e,i,s,n,o,r){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-o)*l+e,a.y=a.f+=(a.f-r)*d+i):(a.e+=(a.e-o)*l+e,a.f+=(a.f-r)*d+i,a.x+=(a.x-o)*l+e,a.y+=(a.y-r)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&Or(t,e,i,s,n,o,r)}},{pushAllChildBranch:Br,pushAllBranchStack:Tr,updateBoundsByBranchStack:Rr,move:Cr,scale:Or}=Er,Pr={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:Lr,updateBounds:Ar}=gr,{toOuterOf:Dr,getPoints:Mr,copy:Fr}=jt,Ir="_localContentBounds",Wr="_worldContentBounds",zr="_worldBoxBounds",Yr="_worldStrokeBounds";class Xr{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 Dr(this.contentBounds,this.leaf.__localMatrix,this[Ir]||(this[Ir]={})),this[Ir]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Dr(this.contentBounds,this.leaf.__world,this[Wr]||(this[Wr]={})),this[Wr]}get worldBoxBounds(){return Dr(this.boxBounds,this.leaf.__world,this[zr]||(this[zr]={})),this[zr]}get worldStrokeBounds(){return Dr(this.strokeBounds,this.leaf.__world,this[Yr]||(this[Yr]={})),this[Yr]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Ar(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,ie.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return $.defaultMatrix;case"page":t=e.zoomLayer;default:return Lr(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 Kt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=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},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=Lr(s,e,!0)}if(r||(r=$.getLayout(o)),Fr(r,a),dt.copy(r,n),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=Mr(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Nr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&ie.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&ie.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&ie.event.stop(this.origin)}}class Hr extends Nr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Hr.ADD="child.add",Hr.REMOVE="child.remove",Hr.CREATED="created",Hr.MOUNTED="mounted",Hr.UNMOUNTED="unmounted",Hr.DESTROY="destroy";const Vr="property.scroll";class jr extends Nr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}jr.CHANGE="property.change",jr.LEAFER_CHANGE="property.leafer_change",jr.SCROLL=Vr;const Ur={scrollX:Vr,scrollY:Vr};class Gr extends Nr{constructor(t,e){super(t),Object.assign(this,e)}}Gr.LOAD="image.load",Gr.LOADED="image.loaded",Gr.ERROR="image.error";class qr extends Nr{static checkHas(t,e,i){"on"===i?e===$r?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Kr)||t.hasEvent(Zr)||t.hasEvent(Jr),t.__hasWorldEvent=t.hasEvent($r))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Kr,t),"inner"===e&&t.emit(Zr,t)),t.emit(Jr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit($r,this)}}qr.RESIZE="bounds.resize",qr.INNER="bounds.inner",qr.LOCAL="bounds.local",qr.WORLD="bounds.world";const{RESIZE:Kr,INNER:Zr,LOCAL:Jr,WORLD:$r}=qr,Qr={};[Kr,Zr,Jr,$r].forEach(t=>Qr[t]=1);class ta extends Nr{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(ta.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}ta.RESIZE="resize";class ea extends Nr{constructor(t,e){super(t),this.data=e}}ea.REQUEST="watch.request",ea.DATA="watch.data";class ia extends Nr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ia.REQUEST="layout.request",ia.START="layout.start",ia.BEFORE="layout.before",ia.LAYOUT="layout",ia.AFTER="layout.after",ia.AGAIN="layout.again",ia.END="layout.end";class sa extends Nr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}sa.REQUEST="render.request",sa.CHILD_START="render.child_start",sa.CHILD_END="render.child_end",sa.START="render.start",sa.BEFORE="render.before",sa.RENDER="render",sa.AFTER="render.after",sa.AGAIN="render.again",sa.END="render.end",sa.NEXT="render.next";class na extends Nr{}na.START="leafer.start",na.BEFORE_READY="leafer.before_ready",na.READY="leafer.ready",na.AFTER_READY="leafer.after_ready",na.VIEW_READY="leafer.view_ready",na.VIEW_COMPLETED="leafer.view_completed",na.STOP="leafer.stop",na.RESTART="leafer.restart",na.END="leafer.end",na.UPDATE_MODE="leafer.update_mode",na.TRANSFORM="leafer.transform",na.MOVE="leafer.move",na.SCALE="leafer.scale",na.ROTATE="leafer.rotate",na.SKEW="leafer.skew";const{MOVE:oa,SCALE:ra,ROTATE:aa,SKEW:ha}=na,la={x:oa,y:oa,scaleX:ra,scaleY:ra,rotation:aa,skewX:ha,skewY:ha},da={};class ca{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const r=ua(this,s,!0),h=a(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(o=r[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):r[t]=[l],Qr[t]&&qr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=ua(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],Qr[t]&&qr.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&&ye.has(t)&&(e=ye.get(t,{type:t,target:this,current:this}));const s=ua(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ua(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:da)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:da)}}const{on:ga,on_:pa,off:_a,off_:fa,once:ma,emit:ya,emitEvent:va,hasEvent:wa,destroy:xa}=ca.prototype,ba={on:ga,on_:pa,off:_a,off_:fa,once:ma,emit:ya,emitEvent:va,hasEvent:wa,destroyEventer:xa},Sa=oe.get("setAttr"),ka={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||o(e)||(Sa.warn(this.innerName,t,e),e=void 0),g(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new jr(jr.LEAFER_CHANGE,this,t,s,e));const i=la[t];i&&(this.emitEvent(new na(i,this)),this.emitEvent(new na(na.TRANSFORM,this)))}this.emitPropertyEvent(jr.CHANGE,t,s,e);const i=Ur[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new jr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Ea,multiplyParent:Ba,translateInner:Ta,defaultWorld:Ra}=$,{toPoint:Ca,tempPoint:Oa}=Et,Pa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;Ba(this.__local||e,t?t.__scrollWorld||t.__world:Ra,i,!!e.affectScaleOrRotation,n),s&&Ta(Object.assign(s,i),n.scrollX,n.scrollY),e.scaleFixed&&gr.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Ea(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)&&(Ca(i.around||i.origin,t.boxBounds,Oa),Ta(e,-Oa.x,-Oa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:La,updateAllMatrix:Aa}=gr,{updateBounds:Da}=Er,{toOuterOf:Ma,copyAndSpread:Fa,copy:Ia}=jt,{toBounds:Wa}=Wn,za={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ma(t.renderBounds,e,e),this.__hasComplex&&gr.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&qr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&qr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.outerScale&&gr.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ma(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ma(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ma(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Wa(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(),Aa(this),Da(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Aa(this),Da(this,this))):La(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Fa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;l(i)&&i<=0?Ia(e.renderBounds,e.strokeBounds):Fa(e.renderBounds,e.boxBounds,i)}},Ya={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.ignoreOpacity?1:e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),gr.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);oe.showBounds&&oe.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:Xa}=xr,{hasSize:Na}=jt,Ha={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Na(i)){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,o=s.length;n<o;n++)i=s[n],Xa(i,e)||(i.__hasComplex?gr.renderComplex(i,t,e):i.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Xa(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Va,create:ja}=v,{stintSet:Ua}=f,{toInnerPoint:Ga,toOuterPoint:qa,multiplyParent:Ka}=$,{toOuterOf:Za}=jt,{copy:Ja,move:$a}=dt,{getScaleFixedData:Qa}=I,{moveLocal:th,zoomOfLocal:eh,rotateOfLocal:ih,skewOfLocal:sh,moveWorld:nh,zoomOfWorld:oh,rotateOfWorld:rh,skewOfWorld:ah,transform:hh,transformWorld:lh,setTransform:dh,getFlipTransform:ch,getLocalOrigin:uh,getRelativeWorld:gh,drop:ph}=gr;let _h=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 Xr}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=ja(Va),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Hr.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(Hr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Hr.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(Hr.MOUNTED),t.cacheId&&gr.cacheId(this)):this.__emitLifeEvent(Hr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ka(i,t.matrix,e,void 0,i),Za(this.__layout.renderBounds,e,e),Ua(e,"half",i.half),Ua(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e,i=!0){return Qa(no.patternLocked?this.__world:this.__nowWorld||this.__world,e,i,t)}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?gh(this,e):this.worldTransform,n=i?t:{};return Za(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ja(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ja(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ga(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){qa(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return $a(n,-o,-r),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return $a(n,o,r),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){dh(this,t,e,i)}transform(t,e,i){hh(this,t,e,i)}move(t,e,i){th(this,t,e,i)}moveInner(t,e,i){nh(this,t,e,!0,i)}scaleOf(t,e,i,s,n){eh(this,uh(this,t),e,i,s,n)}rotateOf(t,e,i){ih(this,uh(this,t),e,i)}skewOf(t,e,i,s,n){sh(this,uh(this,t),e,i,s,n)}transformWorld(t,e,i){lh(this,t,e,i)}moveWorld(t,e,i){nh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){oh(this,t,e,i,s,n)}rotateOfWorld(t,e){rh(this,t,e)}skewOfWorld(t,e,i,s,n){ah(this,t,e,i,s,n)}flip(t,e){hh(this,ch(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(t){}getMotionPathData(){return ue.need("path")}getMotionPoint(t){return ue.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){ph(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):Uo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=ko),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Hr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Hr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};_h=i([Qo(ka),Qo(Pa),Qo(za),Qo(ba),Qo(Ya)],_h);const{setListWithFn:fh}=jt,{sort:mh}=Er,{localBoxBounds:yh,localStrokeBounds:vh,localRenderBounds:wh,maskLocalBoxBounds:xh,maskLocalStrokeBounds:bh,maskLocalRenderBounds:Sh}=xr,kh=new oe("Branch");let Eh=class extends _h{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){let t;const{children:e}=this;for(let i=0,s=e.length;i<s;i++)if(t=e[i].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){fh(e||this.__layout.boxBounds,this.children,this.__hasMask?xh:yh)}__updateStrokeBounds(t){fh(t||this.__layout.strokeBounds,this.children,this.__hasMask?bh:vh)}__updateRenderBounds(t){fh(t||this.__layout.renderBounds,this.children,this.__hasMask?Sh:wh)}__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(mh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return kh.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=_e.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Hr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Hr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Hr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Hr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Hr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};Eh=i([Qo(Ha)],Eh);class Bh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Bh;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 Th{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Rh="2.0.3";class Ch extends De{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=ie.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}function Oh(t,e){ie.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Zn.mimeType(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Zn.mimeType(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:(t,e,i)=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",ie.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()}),loadContent(t){return s(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})}},ie.canvas=ge.canvas(),ie.conicGradientSupport=!!ie.canvas.context.createConicGradient}Kn(OffscreenCanvasRenderingContext2D.prototype),Kn(Path2D.prototype),Object.assign(ge,{canvas:(t,e)=>new Ch(t,e),image:t=>new ho(t)}),ie.name="web",ie.isWorker=!0,ie.backgrounder=!0,ie.requestRender=function(t){requestAnimationFrame(t)},uo(ie,"devicePixelRatio",{get:()=>1});const{userAgent:Ph}=navigator;Ph.indexOf("Firefox")>-1?(ie.conicGradientRotate90=!0,ie.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(ie.fullImageShadow=!0),Ph.indexOf("Windows")>-1?(ie.os="Windows",ie.intWheelDeltaY=!0):Ph.indexOf("Mac")>-1?ie.os="Mac":Ph.indexOf("Linux")>-1&&(ie.os="Linux");class Lh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Bh;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 Bh,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(sa.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Hr.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 ea(ea.DATA,{updatedList:this.updatedList})),this.__updatedList=new Bh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[jr.CHANGE,this.__onAttrChange,this],[[Hr.ADD,Hr.REMOVE],this.__onChildEvent,this],[ea.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ah,updateBounds:Dh,updateChange:Mh}=gr,{pushAllChildBranch:Fh,pushAllParent:Ih}=Er;const{worldBounds:Wh}=xr;class zh{constructor(t){this.updatedBounds=new Kt,this.beforeBounds=new Kt,this.afterBounds=new Kt,u(t)&&(t=new Bh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Wh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Wh),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:Yh,updateAllChange:Xh}=gr,Nh=oe.get("Layouter");class Hh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Th,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(ia.START),this.layoutOnce(),t.emitEvent(new ia(ia.END,this.layoutedBlocks,this.times))}catch(t){Nh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Nh.warn("layouting"):this.times>3?Nh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ea.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=le.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=ia,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new ia(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Ah(t,!0),e.add(t),t.isBranch&&Fh(t,e),Ih(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ih(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Dh(s[t])}Dh(i)}})}(this.__levelList),function(t){t.list.forEach(Mh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new ia(o,a,this.times)),i.emitEvent(new ia(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,le.end(e)}fullLayout(){const t=le.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=ia,o=this.getBlocks(new Bh(e));e.emitEvent(new ia(i,o,this.times)),Hh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new ia(s,o,this.times)),e.emitEvent(new ia(n,o,this.times)),this.addBlocks(o),le.end(t)}static fullLayout(t){Yh(t,!0),t.isBranch?Er.updateBounds(t):gr.updateBounds(t),Xh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new zh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new zh(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_([[ia.REQUEST,this.layout,this],[ia.AGAIN,this.layoutAgain,this],[ea.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Vh=oe.get("Renderer");class jh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ia.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(sa.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(sa.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(sa.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Kt,Vh.log(e.innerName,"---\x3e");try{this.emitRender(sa.START),this.renderOnce(t),this.emitRender(sa.END,this.totalBounds),no.clearRecycled()}catch(t){this.rendering=!1,Vh.error(t)}Vh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Vh.warn("rendering");if(this.times>3)return Vh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Kt,this.renderOptions={},t)this.emitRender(sa.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(sa.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(sa.RENDER,this.renderBounds,this.renderOptions),this.emitRender(sa.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=le.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Kt(s);i.save(),s.spread(jh.clipSpread).ceil();const{ceilPartPixel:o}=this.config;i.clipWorld(s,o),i.clearWorld(s,o),this.__render(s,n),i.restore(),le.end(e)}fullRender(){const t=le.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),le.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),o=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),oe.showRepaint&&oe.drawRepaint(i,t),this.config.useCellRender&&(o.cellList=this.getCellList()),ie.render(s,i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Kt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return ie.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};ie.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Kt(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 Kt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Vh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new sa(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[sa.REQUEST,this.update,this],[ia.END,this.__onLayoutEnd,this],[sa.AGAIN,this.renderAgain,this],[ta.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}jh.clipSpread=10;const Uh={},{copyRadiusPoint:Gh}=dt,{hitRadiusPoint:qh}=jt;class Kh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Bh(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),h=n?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 n=this.findList=new Bh;if(t.length){let e;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||gr.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&gr.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>gr.worldHittable(t))}getPath(t){const e=new Bh,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 Bh;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 Bh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:o}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],n=i.__,n.visible&&(!e||n.mask))if(s=qh(i.__world,n.hitRadius?Gh(Uh,o,n.hitRadius):o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(o,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)}}else 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,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Zh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new Kh(this.target=t,this),this.finder=ge.finder&&ge.finder(t,this.config)}getByPoint(t,e,i){const{target:s,picker:n}=this;return ie.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):ue.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Jh(t){return _o(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function $h(t){return _o(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Qh(){return(t,e)=>{const i="_"+e;uo(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 tl(t){return(e,i)=>{uo(e,i,po(i,t))}}Object.assign(ge,{watcher:(t,e)=>new Lh(t,e),layouter:(t,e)=>new Hh(t,e),renderer:(t,e,i)=>new jh(t,e,i),selector:(t,e)=>new Zh(t,e)}),ie.layout=Hh.fullLayout,ie.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Bh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const el={},il={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}},sl=$t,nl={},ol={},rl={},al={},hl={},ll={apply(){ue.need("filter")}},dl={},cl={setStyleName:()=>ue.need("state"),set:()=>ue.need("state")},ul={list:{},register(t,e){ul.list[t]=e},get:t=>ul.list[t]},{parse:gl,objectToCanvasData:pl}=ns,{stintSet:_l}=f,{hasTransparent:fl}=il,ml={originPaint:{}},yl=oe.get("UIData");class vl extends y{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,yl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,yl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(_l(this,"__isTransparentFill",fl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):g(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(_l(this,"__isTransparentStroke",fl(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?gl(t):pl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){wl(this,"shadow",t)}setInnerShadow(t){wl(this,"innerShadow",t)}setFilter(t){wl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&ol.compute("fill",this.__leaf),e&&ol.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=ml)):(this.__isStrokes=!0,this._stroke||(this._stroke=ml))}__removePaint(t,e){e&&this.__removeInput(t),rl.recycleImage(t,this),"fill"===t?(_l(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(_l(this,"__isAlphaPixelStroke",void 0),_l(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function wl(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 xl extends vl{}class bl extends xl{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 Sl extends xl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ae.forEach(t=>delete i[t]),i}}class kl extends bl{}class El extends vl{get __usePathBox(){return this.points||this.__pathInputed}}class Bl extends vl{get __boxStroke(){return!this.__pathInputed}}class Tl extends vl{get __boxStroke(){return!this.__pathInputed}}class Rl extends El{}class Cl extends vl{}class Ol extends vl{get __pathInputed(){return 2}}class Pl extends xl{}const Ll={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Al extends vl{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=Ll[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=_e.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Dl extends Bl{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Ml extends Bl{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:Fl,add:Il}=B,Wl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke||i.__useArrow)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),o&&(t=Fl(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=hl.getShadowRenderSpread(this,e)),s&&(t=Fl(t,s)),o&&(t=Il(t,ll.getSpread(o))),r&&(t=Il(t,r)),a&&(t=Il(t,a));let l=t;return i&&(l=Fl(l,hl.getInnerShadowSpread(this,i))),n&&(l=Fl(l,n)),this.__layout.renderShapeSpread=l,h?Fl(h.__updateRenderSpread(),t):t}},{stintSet:zl}=f,Yl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);zl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),zl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;zl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!hl.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),zl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Xl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=ol.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&hl.shadow(this,t,h),a&&(s.__isStrokes?ol.strokes(o,this,t,e):ol.stroke(o,this,t,e)),n&&(s.__isFills?ol.fills(n,this,t,e):ol.fill(n,this,t,e)),r&&this.__drawAfterFill(t,e),d&&hl.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?ol.strokes(o,this,t,e):ol.stroke(o,this,t,e)),c&&ll.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?ol.strokes(o,this,t,e):ol.stroke(o,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,il.string(e.color))}n&&(s.__isFills?ol.fills(n,this,t,e):ol.fill(n,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?ol.strokes(o,this,t,e):ol.stroke(o,this,t,e))}}else s.__pathForRender?Xl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?ol.fills(s,this,t,e):ol.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?ol.strokes(n,this,t,e):ol.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Xl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&ol.stroke(n,t,e,i),s&&ol.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),n&&!r&&ol.stroke(n,t,e,i)}const Nl={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),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,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var Hl;let Vl=Hl=class extends _h{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){I.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Gn.set(this.path=t||[]),t||this.__drawPathByBox(Gn),Gn}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 ue.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ue.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Gn.set(i=[]),this.__drawPathByBox(Gn,!e)),t?ns.toCanvasData(i,!0):i}getPathString(t,e,i){return ns.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||dl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius?jn.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&nl.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&nl.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?rn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,o,l(e)?[e]:e)}else t.rect(i,s,n,o);t.closePath()}drawImagePlaceholder(t,e,i){ol.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ue.need("animate")}killAnimate(t,e){}export(t,e){return ue.need("export")}syncExport(t,e){return ue.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),Hl.one(e)}static one(t,e,i,s,n){return _e.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){tr()(this)}static registerData(t){Vo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};i([Vo(vl)],Vl.prototype,"__",void 0),i([Qh()],Vl.prototype,"zoomLayer",void 0),i([yo("")],Vl.prototype,"id",void 0),i([yo("")],Vl.prototype,"name",void 0),i([yo("")],Vl.prototype,"className",void 0),i([Ao("pass-through")],Vl.prototype,"blendMode",void 0),i([Mo(1)],Vl.prototype,"opacity",void 0),i([Fo(!0)],Vl.prototype,"visible",void 0),i([Ao(!1)],Vl.prototype,"locked",void 0),i([Do(!1)],Vl.prototype,"dim",void 0),i([Do(!1)],Vl.prototype,"dimskip",void 0),i([zo(0)],Vl.prototype,"zIndex",void 0),i([Yo(!1)],Vl.prototype,"mask",void 0),i([Xo(!1)],Vl.prototype,"eraser",void 0),i([vo(0,!0)],Vl.prototype,"x",void 0),i([vo(0,!0)],Vl.prototype,"y",void 0),i([ko(100,!0)],Vl.prototype,"width",void 0),i([ko(100,!0)],Vl.prototype,"height",void 0),i([bo(1,!0)],Vl.prototype,"scaleX",void 0),i([bo(1,!0)],Vl.prototype,"scaleY",void 0),i([So(0,!0)],Vl.prototype,"rotation",void 0),i([So(0,!0)],Vl.prototype,"skewX",void 0),i([So(0,!0)],Vl.prototype,"skewY",void 0),i([vo(0,!0)],Vl.prototype,"offsetX",void 0),i([vo(0,!0)],Vl.prototype,"offsetY",void 0),i([wo(0,!0)],Vl.prototype,"scrollX",void 0),i([wo(0,!0)],Vl.prototype,"scrollY",void 0),i([xo()],Vl.prototype,"origin",void 0),i([xo()],Vl.prototype,"around",void 0),i([yo(!1)],Vl.prototype,"lazy",void 0),i([Eo(1)],Vl.prototype,"pixelRatio",void 0),i([Lo(0)],Vl.prototype,"renderSpread",void 0),i([To()],Vl.prototype,"path",void 0),i([Ro()],Vl.prototype,"windingRule",void 0),i([Ro(!0)],Vl.prototype,"closed",void 0),i([ko(0)],Vl.prototype,"padding",void 0),i([ko(!1)],Vl.prototype,"lockRatio",void 0),i([ko()],Vl.prototype,"widthRange",void 0),i([ko()],Vl.prototype,"heightRange",void 0),i([yo(!1)],Vl.prototype,"draggable",void 0),i([yo()],Vl.prototype,"dragBounds",void 0),i([yo("auto")],Vl.prototype,"dragBoundsType",void 0),i([yo(!1)],Vl.prototype,"editable",void 0),i([No(!0)],Vl.prototype,"hittable",void 0),i([No("path")],Vl.prototype,"hitFill",void 0),i([Po("path")],Vl.prototype,"hitStroke",void 0),i([No(!1)],Vl.prototype,"hitBox",void 0),i([No(!0)],Vl.prototype,"hitChildren",void 0),i([No(!0)],Vl.prototype,"hitSelf",void 0),i([No()],Vl.prototype,"hitRadius",void 0),i([Ho("")],Vl.prototype,"cursor",void 0),i([Ao()],Vl.prototype,"fill",void 0),i([Po(void 0,!0)],Vl.prototype,"stroke",void 0),i([Po("inside")],Vl.prototype,"strokeAlign",void 0),i([Po(1,!0)],Vl.prototype,"strokeWidth",void 0),i([Po(!1)],Vl.prototype,"strokeScaleFixed",void 0),i([Po("none")],Vl.prototype,"strokeCap",void 0),i([Po("miter")],Vl.prototype,"strokeJoin",void 0),i([Po()],Vl.prototype,"dashPattern",void 0),i([Po(0)],Vl.prototype,"dashOffset",void 0),i([Po(10)],Vl.prototype,"miterLimit",void 0),i([Ro(0)],Vl.prototype,"cornerRadius",void 0),i([Ro()],Vl.prototype,"cornerSmoothing",void 0),i([Jh()],Vl.prototype,"shadow",void 0),i([Jh()],Vl.prototype,"innerShadow",void 0),i([Jh()],Vl.prototype,"blur",void 0),i([Jh()],Vl.prototype,"backgroundBlur",void 0),i([Jh()],Vl.prototype,"grayscale",void 0),i([Jh()],Vl.prototype,"filter",void 0),i([Ao()],Vl.prototype,"placeholderColor",void 0),i([yo(100)],Vl.prototype,"placeholderDelay",void 0),i([yo({})],Vl.prototype,"data",void 0),i([Zo(_h.prototype.reset)],Vl.prototype,"reset",null),Vl=Hl=i([Qo(Wl),Qo(Yl),Jo()],Vl);let jl=class extends Vl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Ul;i([Vo(xl)],jl.prototype,"__",void 0),i([ko(0)],jl.prototype,"width",void 0),i([ko(0)],jl.prototype,"height",void 0),jl=i([Qo(Eh),tr()],jl);const Gl=oe.get("Leafer");let ql=Ul=class extends jl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&io.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ul.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 n=this.canvas=ge.canvas(s);this.__controllers.push(this.renderer=ge.renderer(this,n,s),this.watcher=ge.watcher(this,s),this.layouter=ge.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ge.selector(this),this.interaction=ge.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ge.hitCanvasManager()),this.canvasManager=new we,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Pr.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(na.RESTART):this.emitLeafer(na.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(na.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,Ae);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Kt(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,Ae);e.resize(t),this.updateLazyBounds(),this.__onResize(new ta(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,Ae),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 Jt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ae.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(na.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ae.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=f.copyAttrs({},s,Ae);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(na.BEFORE_READY),this.emitLeafer(na.READY),this.emitLeafer(na.AFTER_READY),Pr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(na.VIEW_READY),Pr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Pr.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(na.VIEW_COMPLETED),Pr.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 ue.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 na(t,this))}__listenEvents(){const t=le.start("FirstCreate "+this.innerName);this.once([[na.START,()=>le.end(t)],[ia.START,this.updateLazyBounds,this],[sa.START,this.__onCreated,this],[sa.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ea.DATA,this.__onWatchData,this],[ia.END,this.__onLayoutEnd,this],[sa.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ul.list.remove(this);try{this.stop(),this.emitLeafer(na.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{no.clearRecycled()},100)}catch(t){Gl.error(t)}}};t?e():setTimeout(e)}};ql.list=new Bh,i([Vo(Sl)],ql.prototype,"__",void 0),i([ko()],ql.prototype,"pixelRatio",void 0),i([yo("normal")],ql.prototype,"mode",void 0),ql=Ul=i([tr()],ql);let Kl=class extends Vl{get __tag(){return"Rect"}};i([Vo(Bl)],Kl.prototype,"__",void 0),Kl=i([Qo(Nl),Jo(),tr()],Kl);const{add:Zl,includes:Jl,scroll:$l}=jt,Ql=Kl.prototype,td=jl.prototype;let ed=class extends jl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r&&r.includes("scroll"))&&(Zl(a,o),$l(a,i)),this.__updateRectRenderBounds(),t=!Jl(o,a),t&&"show"===r&&Zl(n,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))}};i([Vo(bl)],ed.prototype,"__",void 0),i([ko(100)],ed.prototype,"width",void 0),i([ko(100)],ed.prototype,"height",void 0),i([yo(!1)],ed.prototype,"resizeChildren",void 0),i([Lo("show")],ed.prototype,"overflow",void 0),i([Zo(Ql.__updateStrokeSpread)],ed.prototype,"__updateStrokeSpread",null),i([Zo(Ql.__updateRenderSpread)],ed.prototype,"__updateRectRenderSpread",null),i([Zo(Ql.__updateBoxBounds)],ed.prototype,"__updateRectBoxBounds",null),i([Zo(Ql.__updateStrokeBounds)],ed.prototype,"__updateStrokeBounds",null),i([Zo(Ql.__updateRenderBounds)],ed.prototype,"__updateRectRenderBounds",null),i([Zo(Ql.__updateChange)],ed.prototype,"__updateRectChange",null),i([Zo(Ql.__render)],ed.prototype,"__renderRect",null),i([Zo(td.__render)],ed.prototype,"__renderGroup",null),ed=i([Jo(),tr()],ed);let id=class extends ed{get __tag(){return"Frame"}get isFrame(){return!0}};i([Vo(kl)],id.prototype,"__",void 0),i([Ao("#FFFFFF")],id.prototype,"fill",void 0),i([Lo("hide")],id.prototype,"overflow",void 0),id=i([tr()],id);const{moveTo:sd,closePath:nd,ellipse:od}=Ts;let rd=class extends Vl{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:n,endAngle:o}=t,r=e/2,a=i/2,h=t.path=[];let l;s?n||o?(s<1?od(h,r,a,r*s,a*s,0,n,o,!1):l=!0,od(h,r,a,r,a,0,o,n,!0)):(s<1&&(od(h,r,a,r*s,a*s),sd(h,e,a)),od(h,r,a,r,a,0,360,0,!0)):n||o?(sd(h,r,a),od(h,r,a,r,a,0,n,o,!1)):od(h,r,a,r,a),l||nd(h),(ie.ellipseToCurve||t.__useArrow)&&(t.path=this.getPath(!0))}};i([Vo(Tl)],rd.prototype,"__",void 0),i([Ro(0)],rd.prototype,"innerRadius",void 0),i([Ro(0)],rd.prototype,"startAngle",void 0),i([Ro(0)],rd.prototype,"endAngle",void 0),rd=i([tr()],rd);const{sin:ad,cos:hd,PI:ld}=Math,{moveTo:dd,lineTo:cd,closePath:ud,drawPoints:gd}=Ts;let pd=class extends Vl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)gd(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;dd(e,o,0);for(let t=1;t<n;t++)cd(e,o+o*ad(2*t*ld/n),r-r*hd(2*t*ld/n));ud(e)}}};i([Vo(Rl)],pd.prototype,"__",void 0),i([Ro(3)],pd.prototype,"sides",void 0),i([Ro()],pd.prototype,"points",void 0),i([Ro(0)],pd.prototype,"curve",void 0),pd=i([Jo(),tr()],pd);const{sin:_d,cos:fd,PI:md}=Math,{moveTo:yd,lineTo:vd,closePath:wd}=Ts;let xd=class extends Vl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];yd(r,n,0);for(let t=1;t<2*i;t++)vd(r,n+(t%2==0?n:n*s)*_d(t*md/i),o-(t%2==0?o:o*s)*fd(t*md/i));wd(r)}};i([Vo(Cl)],xd.prototype,"__",void 0),i([Ro(5)],xd.prototype,"corners",void 0),i([Ro(.382)],xd.prototype,"innerRadius",void 0),xd=i([tr()],xd);const{moveTo:bd,lineTo:Sd,drawPoints:kd}=Ts,{rotate:Ed,getAngle:Bd,getDistance:Td,defaultPoint:Rd}=dt;let Cd=class extends Vl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Ed(i,e),i}set toPoint(t){this.width=Td(Rd,t),this.rotation=Bd(Rd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?kd(e,t.points,t.curve,t.closed):(bd(e,0,0),Sd(e,this.width,0))}};i([Vo(El)],Cd.prototype,"__",void 0),i([Co("center")],Cd.prototype,"strokeAlign",void 0),i([ko(0)],Cd.prototype,"height",void 0),i([Ro()],Cd.prototype,"points",void 0),i([Ro(0)],Cd.prototype,"curve",void 0),i([Ro(!1)],Cd.prototype,"closed",void 0),Cd=i([tr()],Cd);let Od=class extends Kl{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}};i([Vo(Dl)],Od.prototype,"__",void 0),i([ko("")],Od.prototype,"url",void 0),Od=i([tr()],Od);const Pd=Od;let Ld=class extends Kl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ge.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ho({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Gr(Gr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new yt(t.worldTransform).invert(),o=new yt;e&&o.translate(e.x,e.y),i&&(l(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};i([Vo(Ml)],Ld.prototype,"__",void 0),i([$h(100)],Ld.prototype,"width",void 0),i([$h(100)],Ld.prototype,"height",void 0),i([$h(1)],Ld.prototype,"pixelRatio",void 0),i([$h(!0)],Ld.prototype,"smooth",void 0),i([yo(!1)],Ld.prototype,"safeResize",void 0),i([$h()],Ld.prototype,"contextSettings",void 0),Ld=i([tr()],Ld);const{copyAndSpread:Ad,includes:Dd,spread:Md,setList:Fd}=jt,{stintSet:Id}=f;let Wd=class extends Vl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=sl.number(e,n),t.__letterSpacing=sl.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n||12}px ${s||"caption"}`,Id(t,"__padding",l&&I.fourNumber(l)),Id(t,"__clipText","show"!==h&&!t.__autoSize),Id(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=el.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Md(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!Dd(h,a)),this.isOverflow?(Fd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ad(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()}};i([Vo(Al)],Wd.prototype,"__",void 0),i([ko(0)],Wd.prototype,"width",void 0),i([ko(0)],Wd.prototype,"height",void 0),i([Ao()],Wd.prototype,"boxStyle",void 0),i([yo(!1)],Wd.prototype,"resizeFontSize",void 0),i([Ao("#000000")],Wd.prototype,"fill",void 0),i([Co("outside")],Wd.prototype,"strokeAlign",void 0),i([No("all")],Wd.prototype,"hitFill",void 0),i([ko("")],Wd.prototype,"text",void 0),i([ko("")],Wd.prototype,"placeholder",void 0),i([ko("caption")],Wd.prototype,"fontFamily",void 0),i([ko(12)],Wd.prototype,"fontSize",void 0),i([ko("normal")],Wd.prototype,"fontWeight",void 0),i([ko(!1)],Wd.prototype,"italic",void 0),i([ko("none")],Wd.prototype,"textCase",void 0),i([ko("none")],Wd.prototype,"textDecoration",void 0),i([ko(0)],Wd.prototype,"letterSpacing",void 0),i([ko({type:"percent",value:1.5})],Wd.prototype,"lineHeight",void 0),i([ko(0)],Wd.prototype,"paraIndent",void 0),i([ko(0)],Wd.prototype,"paraSpacing",void 0),i([ko("x")],Wd.prototype,"writingMode",void 0),i([ko("left")],Wd.prototype,"textAlign",void 0),i([ko("top")],Wd.prototype,"verticalAlign",void 0),i([ko(!0)],Wd.prototype,"autoSizeAlign",void 0),i([ko("normal")],Wd.prototype,"textWrap",void 0),i([ko("show")],Wd.prototype,"textOverflow",void 0),i([Ao(!1)],Wd.prototype,"textEditing",void 0),Wd=i([tr()],Wd);let zd=class extends Vl{get __tag(){return"Path"}};i([Vo(Ol)],zd.prototype,"__",void 0),i([Co("center")],zd.prototype,"strokeAlign",void 0),zd=i([tr()],zd);let Yd=class extends jl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new zd(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,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};i([Vo(Pl)],Yd.prototype,"__",void 0),i([(t,e)=>{uo(t,e,{get(){return this.__path}})}],Yd.prototype,"path",void 0),Yd=i([Qo(Vs,["set","path","paint"]),tr()],Yd);let Xd=class extends ql{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ge.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new ql(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),o(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds,void 0,void 0,!0))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,Ae),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ia.END,this.__onReady,this],[sa.START,this.__onCreated,this],[sa.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(sa.END,this.__onChildRenderEnd,this))}};Xd=i([tr()],Xd);const Nd={},Hd={isHoldSpaceKey:()=>Hd.isHold("Space"),isHold:t=>Nd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Nd[t]||(Nd[t]=!0)},setUpCode(t){Nd[t]=!1}},Vd={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 jd extends Nr{get spaceKey(){return Hd.isHoldSpaceKey()}get left(){return Vd.left(this)}get right(){return Vd.right(this)}get middle(){return Vd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Hd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ye.changeName(t,e)}}const{min:Ud,max:Gd,abs:qd}=Math,{float:Kd,sign:Zd}=I,{minX:Jd,maxX:$d,minY:Qd,maxY:tc}=jt,ec=new Kt,ic=new Kt,sc={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&nc.getValidMove(t.__localBoxBounds,nc.getDragBounds(t),s,e,!0),nc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&nc.getValidScaleOf(t.__localBoxBounds,nc.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,n){const o=t.x+s.x,r=t.y+s.y,a=o+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),nc.isInnerMode(t,e,i,"width")?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),nc.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=Kd(s.x),s.y=Kd(s.y),s},getValidScaleOf(t,e,i,s,n,o,r){r||(n=Object.assign({},n)),ic.set(e),ec.set(t).scaleOf(s,n.x,n.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=1,m=1;return nc.isInnerMode(t,e,i,"width")?(n.x<0&&ec.scaleOf(s,f=1/n.x,1),p=Kd(ec.minX-ic.minX),_=Kd(ic.maxX-ec.maxX),u=a&&p>0?1+p/(a*ec.width):1,g=l&&_>0?1+_/(l*ec.width):1,f*=Gd(u,g)):(n.x<0&&((Kd(Jd(t)-Jd(e))<=0||Kd($d(e)-$d(t))<=0)&&ec.scaleOf(s,f=1/n.x,1),ec.unsign()),p=Kd(ic.minX-ec.minX),_=Kd(ec.maxX-ic.maxX),u=a&&p>0?1-p/(a*ec.width):1,g=l&&_>0?1-_/(l*ec.width):1,f*=Ud(u,g)),nc.isInnerMode(t,e,i,"height")?(n.y<0&&ec.scaleOf(s,1,m=1/n.y),p=Kd(ec.minY-ic.minY),_=Kd(ic.maxY-ec.maxY),u=d&&p>0?1+p/(d*ec.height):1,g=c&&_>0?1+_/(c*ec.height):1,m*=Gd(u,g),o&&(u=Gd(qd(f),qd(m)),f=Zd(f)*u,m=Zd(m)*u)):(n.y<0&&((Kd(Qd(t)-Qd(e))<=0||Kd(tc(e)-tc(t))<=0)&&ec.scaleOf(s,1,m=1/n.y),ec.unsign()),p=Kd(ic.minY-ec.minY),_=Kd(ec.maxY-ic.maxY),u=d&&p>0?1-p/(d*ec.height):1,g=c&&_>0?1-_/(c*ec.height):1,m*=Ud(u,g)),n.x*=h(f)?f:1,n.y*=h(m)?m:1,n}},nc=sc;let oc=class extends jd{};oc.POINTER="pointer",oc.BEFORE_DOWN="pointer.before_down",oc.BEFORE_MOVE="pointer.before_move",oc.BEFORE_UP="pointer.before_up",oc.DOWN="pointer.down",oc.MOVE="pointer.move",oc.UP="pointer.up",oc.OVER="pointer.over",oc.OUT="pointer.out",oc.ENTER="pointer.enter",oc.LEAVE="pointer.leave",oc.TAP="tap",oc.DOUBLE_TAP="double_tap",oc.CLICK="click",oc.DOUBLE_CLICK="double_click",oc.LONG_PRESS="long_press",oc.LONG_TAP="long_tap",oc.MENU="pointer.menu",oc.MENU_TAP="pointer.menu_tap",oc=i([er()],oc);const rc=oc,ac={};let hc=class extends oc{static setList(t){this.list=t instanceof Bh?t:new Bh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return dt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),sc.axisMove(t,n),n}static limitMove(t,e){sc.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(ac,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(ac,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(ac,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 jt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),jt.unsign(i),i}assignMove(t){ac.x=t?this.totalX:this.moveX,ac.y=t?this.totalY:this.moveY}};hc.BEFORE_DRAG="drag.before_drag",hc.START="drag.start",hc.DRAG="drag",hc.END="drag.end",hc.OVER="drag.over",hc.OUT="drag.out",hc.ENTER="drag.enter",hc.LEAVE="drag.leave",hc=i([er()],hc);const lc=hc;let dc=class extends oc{static setList(t){hc.setList(t)}static setData(t){hc.setData(t)}};dc.DROP="drop",dc=i([er()],dc);let cc=class extends hc{};cc.BEFORE_MOVE="move.before_move",cc.START="move.start",cc.MOVE="move",cc.DRAG_ANIMATE="move.drag_animate",cc.END="move.end",cc.PULL_DOWN="move.pull_down",cc.REACH_BOTTOM="move.reach_bottom",cc=i([er()],cc);let uc=class extends jd{};uc=i([er()],uc);const gc=uc;let pc=class extends oc{};pc.BEFORE_ROTATE="rotate.before_rotate",pc.START="rotate.start",pc.ROTATE="rotate",pc.END="rotate.end",pc=i([er()],pc);let _c=class extends hc{};_c.SWIPE="swipe",_c.LEFT="swipe.left",_c.RIGHT="swipe.right",_c.UP="swipe.up",_c.DOWN="swipe.down",_c=i([er()],_c);let fc=class extends oc{};fc.BEFORE_ZOOM="zoom.before_zoom",fc.START="zoom.start",fc.ZOOM="zoom",fc.END="zoom.end",fc=i([er()],fc);let mc=class extends jd{};mc.BEFORE_DOWN="key.before_down",mc.BEFORE_UP="key.before_up",mc.DOWN="key.down",mc.HOLD="key.hold",mc.UP="key.up",mc=i([er()],mc);const yc={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?_c.UP:t>45&&t<135?_c.DOWN:t<=45&&t>=-45?_c.RIGHT:_c.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:vc.getSwipeDirection(dt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:o(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Bh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>gr.draggable(t)||!t.isLeafer&&t.hasEvent(hc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},vc=yc,wc=new Bh,{getDragEventData:xc,getDropEventData:bc,getSwipeEventData:Sc}=yc;class kc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=xc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=hc.list||this.draggableList||wc;return this.dragging&&(s?t?wc:new Bh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}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(cc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Vd.left(t),this.dragging&&(this.interaction.emit(hc.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],gr.draggable(e)){this.draggableList=new Bh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=xc(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(cc.BEFORE_MOVE,this.dragData),e.emit(cc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(hc.BEFORE_DRAG,this.dragData),e.emit(hc.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,r=!o||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=hc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},r||s);o&&!s&&t?gr.animateMove(e,h,l(o)?o:.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(hc.OUT,t,i),e.emit(hc.OVER,t,s)):e.emit(hc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(hc.LEAVE,t,i,s),e.emit(hc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=xc(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(cc.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(hc.END,r),this.swipe(t,i,s,r),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(dt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Sc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=bc(t,e,hc.data);s.path=i,this.interaction.emit(dc.DROP,s),this.interaction.emit(hc.LEAVE,t,i)}dragReset(){hc.list=hc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Ec=oe.get("emit");const Bc=["move","zoom","rotate","key"];function Tc(t,e,i,s,n){if(Bc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Cc(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&Rc(o,e,i,s,n)}}function Rc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Cc(t,n)&&(cl.updateEventStyle&&!s&&cl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ye.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Cc(t,e){return e&&e.has(t)}const Oc={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:Pc,pathCanDrag:Lc,pathHasOutside:Ac}=yc;class Dc{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&&Vd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Vd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Hd.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(Oc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Bh(t),this.createTransformer(),this.dragger=new kc(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&&(Vd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(oc.BEFORE_DOWN,t),t.path.needUpdate&&this.updateDownData(t),this.emit(oc.DOWN,t),Vd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Vd.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&&Vd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(oc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=dt.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(oc.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;Vd.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(oc.BEFORE_UP,t),this.emit(oc.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(oc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(oc.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(mc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Hd.setDownCode(e),this.emit(mc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(mc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(mc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Hd.setUpCode(e),this.emit(mc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Bh),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(oc.OUT,t,i),this.emit(oc.OVER,t,e)):this.emit(oc.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(oc.LEAVE,t,i,e),this.emit(oc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(oc.LEAVE,t),this.dragger.dragging&&this.emit(dc.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,n=[oc.DOUBLE_TAP,oc.DOUBLE_CLICK].some(e=>Pc(t.path,e));s<e.tapTime+50&&n?(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(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:o}=this;ie.backgrounder||t.origin||o&&o.updateLayout();const r=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.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&&!Ac(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Lc(t.path))&&!Ac(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:oc.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,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&dt.round(s),s}emitTap(t){this.emit(oc.TAP,t),this.emit(oc.CLICK,t)}emitDoubleTap(t){this.emit(oc.DOUBLE_TAP,t),this.emit(oc.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(oc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(oc.LONG_TAP,t),(Pc(t.path,oc.LONG_TAP)||Pc(t.path,oc.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 Kt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ta.RESIZE,this.__onResize,this)],t.once(na.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let o=i.length-1;o>-1;o--){if(n=i.list[o],Rc(n,t,e,!0,s))return;n.isApp&&Tc(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&Tc(n,t,e,!1,s),Rc(n,t,e,!1,s))return}catch(t){Ec.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 Mc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Mc.custom={};class Fc extends we{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Bh,this.pixelList=new Bh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ge.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ge.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()}}ie.getSelector=function(t){return t.leafer?t.leafer.selector:ie.selector||(ie.selector=ge.selector())};const{toInnerRadiusPointOf:Ic,copyRadiusPoint:Wc}=dt,{hitRadiusPoint:zc,hitPoint:Yc}=jt,Xc={},Nc={},Hc=_h.prototype;Hc.hit=function(t,e=0){this.updateLayout(),Wc(Nc,t,e);const i=this.__world;return!!(e?zc(i,Nc):Yc(i,Nc))&&(this.isBranch?ie.getSelector(this).hitPoint(Object.assign({},Nc),e,{target:this}):this.__hitWorld(Nc))},Hc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,o=s.width<10&&s.height<10;if(i.hitRadius&&(Wc(Xc,t,i.hitRadius),t=Xc),Ic(t,s,Xc),i.hitBox||o){if(jt.hitRadiusPoint(n.boxBounds,Xc))return!0;if(o)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(Xc,e)},Hc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Hc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Hc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Hc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Vc=new yt,jc=Vl.prototype;jc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const o=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=ie.image.hitCanvasSize,r=o.hitScale=Zt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Zt.set(t).scale(r);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),no.patternLocked=!0,this.__renderShape(o,{matrix:Vc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),no.patternLocked=!1,o.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(e)},jc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:o,__maxStrokeWidth:r}=i,a=i.stroke&&("path"===o||"pixel"===o&&!i.__isAlphaPixelStroke)||"all"===o;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*r,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=r;break;case"outside":if(l+=2*r,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const Uc=Vl.prototype,Gc=Kl.prototype,qc=ed.prototype;Gc.__updateHitCanvas=qc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Uc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Gc.__hitFill=qc.__hitFill=function(t){return this.__hitCanvas?Uc.__hitFill.call(this,t):jt.hitRadiusPoint(this.__layout.boxBounds,t)},Wd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},jl.prototype.pick=function(t,e){return e||(e=n),this.updateLayout(),ie.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Kc=De.prototype;function Zc(t,e,i){t.__.__font?ol.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Jc(t,e,i,s,n){const o=i.__;g(t)?ol.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&ol.strokeArrow(t,i,s,n)}function $c(t,e,i,s,n){const o=i.__;g(t)?ol.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),ol.drawTextStroke(i,s,n))}function Qc(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,$c(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",ol.fillText(i,o,n),o.blendMode="normal",gr.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}Kc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Kc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Kc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Zt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Zt.x,Zt.y,Zt.width||1,Zt.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{getSpread:tu,copyAndSpread:eu,toOuterOf:iu,getOuterOf:su,getByMove:nu,move:ou,getIntersectData:ru}=jt,au={};let hu;const{stintSet:lu}=f,{hasTransparent:du}=il;function cu(t,e,i){if(!g(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout,{type:r}=e;switch(r){case"image":case"film":case"video":if(!e.url)return;s=rl.image(i,t,e,n,!hu||!hu[e.url]),"image"!==r&&rl[r](s);break;case"linear":s=al.linearGradient(e,n);break;case"radial":s=al.radialGradient(e,n);break;case"angular":s=al.conicGradient(e,n);break;case"solid":const{color:a,opacity:h}=e;s={type:r,style:il.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:il.string(e)})}if(s&&(s.originPaint=e,a(s.style)&&du(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const uu={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];u(a)||(a=[a]),hu=rl.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=cu(t,a[n],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)&&(n=!0),o=!0),"fill"===t?(lu(i,"__isAlphaPixelFill",n),lu(i,"__isTransparentFill",o)):(lu(i,"__isAlphaPixelStroke",n),lu(i,"__isTransparentStroke",o),lu(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Zc(e,i,s)},fills:function(t,e,i,s){let n,o,r;for(let a=0,h=t.length;a<h;a++){if(n=t[a],o=n.originPaint,n.image){if(r?r++:r=1,rl.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||o.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),o.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,o.scaleFixed,!1);1!==t&&i.scale(t,s)}o.blendMode&&(i.blendMode=o.blendMode),Zc(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),Zc(e,i,s),i.restoreBlendMode()):Zc(e,i,s)}},fillPathOrText:Zc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:o}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(o){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>o.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)ol.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Jc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Jc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)Jc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Jc(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),gr.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){ol.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":$c(t,1,e,i,s);break;case"inside":Qc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?$c(t,2,e,i,s):Qc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:o,decorationY:r}=n;for(let t=0,i=o.length;t<i;t++)s=o[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=n;o.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,o){let r;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(r=t[l],(!r.image||!rl.checkImage(r,!1,s,n,o))&&r.style){if(h){const{strokeStyle:t}=r;t?n.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(r.style,a.__strokeWidth*e,a)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?ol.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?ol.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,o=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;iu(r.strokeSpread?(eu(au,r.boxBounds,r.strokeSpread),au):r.boxBounds,o,a);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))g=s,h=u=a,l=o;else{let s;if(ie.fullImageShadow)s=a;else{const t=r.renderShapeSpread?tu(n,B.swapAndScale(r.renderShapeSpread,p,_)):n;s=ru(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),p*=f,_*=m),u=su(a,c),h=nu(u,-c.e,-c.f),l=su(o,c),ou(l,-c.e,-c.f);const y=i.matrix;y?(d=new yt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:p,scaleY:_}}};let gu,pu=new Kt;const{isSame:_u}=jt;function fu(t,e,i,s,n,o){const r=t.__;if("fill"===e&&!r.__naturalWidth&&(r.__naturalWidth=s.width/r.pixelRatio,r.__naturalHeight=s.height/r.pixelRatio,r.__autoSide))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",r.width),t.setProxyAttr("height",r.height)),!1;if(!n.data){rl.createData(n,s,i,o);const{transform:t}=n.data,{opacity:e,blendMode:a}=i,h=t&&!t.onlyScale||r.path||r.cornerRadius;(h||e&&e<1||a)&&(n.complex=!h||2)}return i.filter&&rl.applyFilter(n,s,i.filter,t),!0}function mu(t,e){wu(t,Gr.LOAD,e)}function yu(t,e){wu(t,Gr.LOADED,e)}function vu(t,e,i){e.error=i,t.forceUpdate("surface"),wu(t,Gr.ERROR,e)}function wu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Gr(e,i))}function xu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:bu,translate:Su}=$,ku=new Kt,Eu={},Bu={};function Tu(t,e,i,s){const n=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Ru={},Cu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Ou,set:Pu,rotateOfOuter:Lu,translate:Au,scaleOfOuter:Du,multiplyParent:Mu,scale:Fu,rotate:Iu,skew:Wu}=$;function zu(t,e,i,s,n,o,r,a){r&&Iu(t,r),a&&Wu(t,a.x,a.y),n&&Fu(t,n,o),Au(t,e.x+i,e.y+s)}const{get:Yu,scale:Xu,copy:Nu}=$,{getFloorScale:Hu}=I,{abs:Vu}=Math;const ju={image:function(t,e,i,s,n){let o,r;const a=no.get(i,i.type);return gu&&i===gu.paint&&_u(s,gu.boxBounds)?o=gu.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),gu=a.use>1?{leafPaint:o,paint:i,boxBounds:pu.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(fu(t,e,i,a,o,s),n&&(mu(t,r),yu(t,r))):a.error?n&&vu(t,r,a.error):(n&&(xu(t,!0),mu(t,r)),o.loadId=a.load(()=>{xu(t,!1),t.destroyed||(fu(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),yu(t,r)),o.loadId=void 0},e=>{xu(t,!1),vu(t,r,e),o.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,i,s,n){const{scaleX:o,scaleY:r}=rl.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:o+"-"+r,{image:h,data:l,originPaint:d}=t,{exporting:c,snapshot:u}=n;return!(!l||t.patternId===a&&!c||u)&&(e&&(l.repeat?e=!1:d.changeful||t.film||"miniapp"===ie.name&&ta.isResizing(i)||c||(e=ie.image.isLarge(h,o,r)||h.width*o>8096||h.height*r>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),rl.drawImage(t,o,r,i,s,n),!0):(!t.style||d.sync||c?rl.createPattern(t,i,s,n):rl.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,o){const{data:r,image:a,complex:h}=t;let{width:l,height:d}=a;if(h){const{blendMode:o,opacity:c}=t.originPaint,{transform:u}=r;n.save(),2===h&&n.clipUI(s),o&&(n.blendMode=o),c&&(n.opacity*=c),u&&n.transform(u),a.render(n,0,0,l,d,s,t,e,i),n.restore()}else r.scaleX&&(l*=r.scaleX,d*=r.scaleY),a.render(n,0,0,l,d,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return o&&o.scaleX&&(n.scaleX*=Math.abs(o.scaleX),n.scaleY*=Math.abs(o.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,no.recyclePaint(s),e.__willDestroy&&n.parent&&rl.recycleFilter(n,e.__leaf),n.loading&&(r||(r=e.__input&&e.__input[t]||[],u(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,i,n){t.patternTask||(t.patternTask=no.patternTasker.add(()=>s(this,void 0,void 0,function*(){rl.createPattern(t,e,i,n),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:o}=rl.getImageRenderScaleData(t,e,i,s),r=t.film?t.nowIndex:n+"-"+o;if(t.patternId!==r&&!e.destroyed&&(!ie.image.isLarge(t.image,n,o)||t.data.repeat)){const{image:i,data:s}=t,{opacity:a}=t.originPaint,{transform:h,gap:l}=s,d=rl.getPatternFixScale(t,n,o);let c,u,g,{width:p,height:_}=i;d&&(n*=d,o*=d),p*=n,_*=o,l&&(u=l.x*n/Vu(s.scaleX||1),g=l.y*o/Vu(s.scaleY||1)),(h||1!==n||1!==o)&&(n*=Hu(p+(u||0)),o*=Hu(_+(g||0)),c=Yu(),h&&Nu(c,h),Xu(c,1/n,1/o));const f=i.getCanvas(p,_,a,void 0,u,g,e.leafer&&e.leafer.config.smooth,s.interlace),m=i.getPattern(f,s.repeat||ie.origin.noRepeat||"no-repeat",c,t);t.style=m,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,o=ie.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):o>r&&(o=r),(r*=e*i)>o&&(n=Math.sqrt(o/r)),n},createData:function(t,e,i,s){t.data=rl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=ku.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:o,align:r,offset:h,scale:d,size:c,rotation:u,skew:p,clipSize:_,repeat:f,gap:m,interlace:y}=t,v=e.width===s&&e.height===n,w={mode:o},x="center"!==r&&(u||0)%180==90;let b,S;switch(jt.set(Bu,0,0,x?n:s,x?s:n),o&&"cover"!==o&&"fit"!==o?((d||c)&&(I.getScaleData(d,c,i,Eu),b=Eu.scaleX,S=Eu.scaleY),(r||m||f)&&(b&&jt.scale(Bu,b,S,!0),r&&Rt.toPoint(r,Bu,e,Bu,!0,!0))):v&&!u||(b=S=jt.getFitScale(e,Bu,"fit"!==o),jt.put(e,i,r,b,!1,Bu),jt.scale(Bu,b,S,!0)),h&&dt.move(Bu,h),o){case"stretch":v?b&&(b=S=void 0):(b=e.width/s,S=e.height/n,rl.stretchMode(w,e,b,S));break;case"normal":case"clip":if(Bu.x||Bu.y||b||_||u||p){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),rl.clipMode(w,e,Bu.x,Bu.y,b,S,u,p,t,i),t&&(b=b?b*t:t,S=S?S*i:i)}break;case"repeat":(!v||b||u||p)&&rl.repeatMode(w,e,s,n,Bu.x,Bu.y,b,S,u,p,r,t.freeTransform),f||(w.repeat="repeat");const i=g(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;g(t)?(o=t.x,r=t.y):o=r=t;return{x:Tu(o,i,n.width,e&&e.x),y:Tu(r,s,n.height,e&&e.y)}}(m,i&&f,Bu.width,Bu.height,e));break;default:b&&rl.fillOrFitMode(w,e,Bu.x,Bu.y,b,S,u)}return w.transform||(e.x||e.y)&&Su(w.transform=bu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=S),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),y&&(w.interlace=l(y)||"percent"===y.type?{type:"x",offset:y}:y),w},stretchMode:function(t,e,i,s){const n=Ou(),{x:o,y:r}=e;o||r?Au(n,o,r):i>0&&s>0&&(n.onlyScale=!0),Fu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=Ou();Au(a,e.x+i,e.y+s),Fu(a,n,o),r&&Lu(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,n,o,r,a,h,l){const d=Ou();zu(d,e,i,s,n,o,r,a),h&&(r||a?(Pu(Cu),Du(Cu,e,h,l),Mu(d,Cu)):Du(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,o,r,a,h,l,d,c){const u=Ou();if(c)zu(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Lu(u,{x:i/2,y:s/2},h);else switch(Iu(u,h),h){case 90:Au(u,s,0);break;case 180:Au(u,i,s);break;case 270:Au(u,0,i)}Ru.x=e.x+n,Ru.y=e.y+o,Au(u,Ru.x,Ru.y),r&&Du(u,Ru,r,a)}t.transform=u}},{toPoint:Uu}=Et,{hasTransparent:Gu}=il,qu={},Ku={};function Zu(t,e,i,s){if(i){let n,o,r,h;for(let t=0,l=i.length;t<l;t++)n=i[t],a(n)?(r=t/(l-1),o=il.string(n,s)):(r=n.offset,o=il.string(n.color,s)),e.addColorStop(r,o),!h&&Gu(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ju,getDistance:$u}=dt,{get:Qu,rotateOfOuter:tg,scaleOfOuter:eg}=$,{toPoint:ig}=Et,sg={},ng={};function og(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Ju(e,i);o=Qu(),n?(eg(o,e,r/a*(s||1),1),tg(o,e,t+90)):(eg(o,e,1,r/a*(s||1)),tg(o,e,t))}return o}const{getDistance:rg}=dt,{toPoint:ag}=Et,hg={},lg={};const dg={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:o}=t;Uu(i||"top",e,qu),Uu(s||"bottom",e,Ku);const r=ie.canvas.createLinearGradient(qu.x,qu.y,Ku.x,Ku.y),a={type:n,style:r};return Zu(a,r,t.stops,o),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;ig(i||"center",e,sg),ig(s||"bottom",e,ng);const a=ie.canvas.createRadialGradient(sg.x,sg.y,0,sg.x,sg.y,$u(sg,ng)),h={type:n,style:a};Zu(h,a,t.stops,o);const l=og(e,sg,ng,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;ag(i||"center",e,hg),ag(s||"bottom",e,lg);const a=ie.conicGradientSupport?ie.canvas.createConicGradient(0,hg.x,hg.y):ie.canvas.createRadialGradient(hg.x,hg.y,0,hg.x,hg.y,rg(hg,lg)),h={type:n,style:a};Zu(h,a,t.stops,o);const l=og(e,hg,lg,r||1,ie.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:og},{copy:cg,move:ug,toOffsetOutBounds:gg}=jt,{max:pg,abs:_g}=Math,fg={},mg=new yt,yg={};function vg(t,e){let i,s,n,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),n=_g(t.spread||0),r=pg(r,n+o-s),a=pg(a,n+o+i),h=pg(h,n+o+s),l=pg(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function wg(t,e,i){const{shapeBounds:s}=i;let n,o;ie.fullImageShadow?(cg(fg,t.bounds),ug(fg,e.x-s.x,e.y-s.y),n=t.bounds,o=fg):(n=s,o=e),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:xg}=jt,bg={};const Sg=vg;const kg={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;gg(h,yg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.setWorldShadow(yg.offsetX+(r.x||0)*c*f,yg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,il.string(r.color)),n=hl.getShadowTransform(t,g,i,r,yg,f),n&&g.setTransform(n),wg(g,yg,i),n&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,o,"copy"),s=o),a?g.copyWorld(a,o,o,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),gr.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;xg(h,bg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(bg.offsetX+(r.x||0)*c*f,bg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=hl.getShadowTransform(t,g,i,r,bg,f,!0),n&&g.setTransform(n),wg(g,bg,i),g.restore(),a?(g.copyWorld(g,l,o,"copy"),g.copyWorld(a,o,o,"source-out"),s=o):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,il.string(r.color),"source-in"),gr.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<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:vg,getShadowTransform:function(t,e,i,s,n,o,r){if(s.spread){const i=2*s.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return mg.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),mg}},isTransformShadow(t){},getInnerShadowSpread:Sg},{excludeRenderBounds:Eg}=xr;let Bg;function Tg(t,e,i,s,n,o,r,a){switch(e){case"grayscale":Bg||(Bg=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);Cg(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":Cg(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function Rg(t){return t.getSameCanvas(!1,!0)}function Cg(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}jl.prototype.__renderMask=function(t,e){let i,s,n,o,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&&(Tg(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||Eg(i,e)||i.__render(t,e),o=i.__.opacity,Bg=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=Rg(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Rg(t)),n||(n=Rg(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&Tg(this,r,t,n,s,o,void 0,!1),Eg(i,e)||i.__render(n||t,e),d&&Tg(this,r,t,n,s,o,d,!1)}Tg(this,r,t,n,s,o,void 0,!0)};const Og=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Pg=Og+"_#~&*+\\=|≮≯≈≠=…",Lg=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 Ag(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Dg=Ag("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Mg=Ag("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Fg=Ag(Og),Ig=Ag(Pg),Wg=Ag("- —/~|┆·");var zg;!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"}(zg||(zg={}));const{Letter:Yg,Single:Xg,Before:Ng,After:Hg,Symbol:Vg,Break:jg}=zg;function Ug(t){return Dg[t]?Yg:Wg[t]?jg:Mg[t]?Ng:Fg[t]?Hg:Ig[t]?Vg:Lg.test(t)?Xg:Yg}const Gg={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function qg(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:Kg}=Gg,{Letter:Zg,Single:Jg,Before:$g,After:Qg,Symbol:tp,Break:ep}=zg;let ip,sp,np,op,rp,ap,hp,lp,dp,cp,up,gp,pp,_p,fp,mp,yp,vp=[];function wp(t,e){dp&&!lp&&(lp=dp),ip.data.push({char:t,width:e}),np+=e}function xp(){op+=np,ip.width=np,sp.words.push(ip),ip={data:[]},np=0}function bp(){_p&&(fp.paraNumber++,sp.paraStart=!0,_p=!1),dp&&(sp.startCharSize=lp,sp.endCharSize=dp,lp=0),sp.width=op,mp.width?Kg(sp):yp&&Sp(),vp.push(sp),sp={words:[]},op=0}function Sp(){op>(fp.maxWidth||0)&&(fp.maxWidth=op)}const{top:kp,right:Ep,bottom:Bp,left:Tp}=bt;function Rp(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const Cp={getDrawData:function(t,e){a(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:r}=e;r&&(n?(i=r[Tp],n-=r[Ep]+r[Tp],!n&&(n=.01)):e.autoSizeAlign||(i=r[Tp]),o?(s=r[kp],o-=r[kp]+r[Bp],!o&&(o=.01)):e.autoSizeAlign||(s=r[kp]));const h={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:ie.canvas.font=e.__font};return function(t,e,i){fp=t,vp=t.rows,mp=t.bounds,yp=!mp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:r}=ie,{width:a}=mp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;_p=!0,up=null,lp=hp=dp=np=op=0,ip={data:[]},sp={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)ap=e[i],"\n"===ap?(np&&xp(),sp.paraEnd=!0,bp(),_p=!0):(cp=Ug(ap),cp===Zg&&"none"!==o&&(ap=qg(ap,o,!np)),hp=r.measureText(ap).width,s&&(s<0&&(dp=hp),hp+=s),gp=cp===Jg&&(up===Jg||up===Zg)||up===Jg&&cp!==Qg,pp=!(cp!==$g&&cp!==Jg||up!==tp&&up!==Qg),rp=_p&&n?a-n:a,t&&a&&op+np+hp>rp&&(h?(np&&xp(),op&&bp()):(pp||(pp=cp===Zg&&up==Qg),gp||pp||cp===ep||cp===$g||cp===Jg||np+hp>rp?(np&&xp(),op&&bp()):op&&bp()))," "===ap&&!0!==_p&&op+np===0||(cp===ep?(" "===ap&&np&&xp(),wp(ap,hp),xp()):gp||pp?(np&&xp(),wp(ap,hp)):wp(ap,hp)),up=cp);np&&xp(),op&&bp(),vp.length>0&&(vp[vp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{fp.paraNumber++,op=r.measureText(t).width,vp.push({x:n||0,text:t,width:op,paraStart:!0}),yp&&Sp()})}(h,t,e),r&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Rp(e,"x",t[Tp]);break;case"right":Rp(e,"x",-t[Ep])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Rp(e,"y",t[kp]);break;case"bottom":Rp(e,"y",-t[Bp])}}(r,h,e,n,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:p,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(e.__autoHeight?m:f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-m)/2;break;case"bottom":p+=f-m}y+=p;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=g,v.width<_||v.width>_&&!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+=o,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&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,__letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,g,p,_,f,m,y,v;s.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===_?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===_?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,d,t.data,t.isOverflow,v&&g),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):g&&(t.width+=g*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){const{rows:n,overflow:o}=t;let{textOverflow:r}=e;if(o&&n.splice(o),s&&r&&"show"!==r){let t,a;"hide"===r?r="":"ellipsis"===r&&(r="...");const h=r?ie.canvas.measureText(r).width:0,l=i+s-h;("none"===e.textWrap?n:[n[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:r,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,g(o)?(i=o.type,o.color&&(t.decorationColor=il.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const Op={string:function(t,e){if(!t)return"#000";const i=l(e)&&e<1;if(a(t)){if(!i||!il.object)return t;t=il.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function Pp(t){return t?u(t)?t:[t]:[]}Object.assign(el,Cp),Object.assign(il,Op),Object.assign(ol,uu),Object.assign(rl,ju),Object.assign(al,dg),Object.assign(hl,kg),Object.assign(ge,{interaction:(t,e,i,s)=>new Dc(t,e,i,s),hitCanvas:(t,e)=>new Ch(t,e),hitCanvasManager:()=>new Fc}),Oh();class Lp extends Nr{get list(){return Pp(this.value)}get oldList(){return Pp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function Ap(t){return(e,i)=>{const s="_"+i;uo(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const r=this;if(r.config){const t="target"===i;if(t){const{beforeSelect:t}=r.config;if(t){const i=t({target:e});if(g(i))e=i;else if(!1===i)return}const{dimOthers:i,bright:s}=r.editBox.mergedConfig||r.config;o(i)&&o(s)||(r.setDimOthers(!1),r.setBright(!1)),u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),r.single&&(delete r.element.syncEventer,delete r.element.__world.ignorePixelSnap)}const s=t?Lp.BEFORE_SELECT:Lp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Lp(s,{editor:r,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Lp.BEFORE_SELECT="editor.before_select",Lp.SELECT="editor.select",Lp.AFTER_SELECT="editor.after_select",Lp.BEFORE_HOVER="editor.before_hover",Lp.HOVER="editor.hover";const{abs:Dp}=Math,{copy:Mp}=$,{setListWithFn:Fp}=jt,{worldBounds:Ip}=xr,Wp={a:1,b:0,c:0,d:1,e:0,f:0},zp={x:0,y:0,width:0,height:0};class Yp extends Vl{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?(Fp(zp,e,Ip),t&&this.set(t),this.set(zp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:r,fill:h}=n,{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=Dp(c.scaleX),l=Dp(c.scaleY);if(Mp(Wp,c),Wp.half=r%2,t.setWorld(Wp,e.matrix),t.beginPath(),"path"===this.strokePathType||s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/Math.max(i,l),n.shadow){const e=n.shadow[0],{scaleX:i,scaleY:s}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*s,e.blur*i,il.string(e.color))}o&&(a(o)?ol.stroke(o,this,t,e):ol.strokes(o,this,t,e)),h&&(a(h)?ol.fill(h,this,t,e):ol.fills(h,this,t,e)),n.shadow&&t.restore()}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}i([Ap(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],Yp.prototype,"target",void 0),i([Ao("render-path")],Yp.prototype,"strokePathType",void 0);class Xp extends jl{constructor(t){super(t),this.strokeArea=new Kl({strokeAlign:"center"}),this.fillArea=new Kl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const Np={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Hp([t],i,e),i}};function Hp(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.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)&&n.hitSelf&&e.push(s)}s.isBranch&&Hp(s.children,e,i)}}const{findOne:Vp,findByBounds:jp}=Np;class Up extends jl{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 Yp,this.targetStroker=new Yp,this.bounds=new Kt,this.selectArea=new Xp,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:n,strokeWidth:o,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:n,strokeWidth:o},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedPathType:i,selectedStyle:s}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2),strokePathType:i},s||{}))}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,t.path.needUpdate=!0):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:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},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(),n=new Bh(jp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.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)&&!Vp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Bh(this.editor.editBox.rect)};return Vp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Vp(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_([[Lp.HOVER,this.onHover,this],[Lp.SELECT,this.onSelect,this]]),e.on_([[oc.MOVE,this.onPointerMove,this],[oc.BEFORE_DOWN,this.onBeforeDown,this],[oc.TAP,this.onTap,this],[hc.START,this.onDragStart,this,!0],[hc.DRAG,this.onDrag,this],[hc.END,this.onDragEnd,this],[cc.MOVE,this.onAutoMove,this],[[fc.ZOOM,cc.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Gp,top:qp,topRight:Kp,right:Zp,bottomRight:Jp,bottom:$p,bottomLeft:Qp,left:t_}=St,{toPoint:e_}=Et,{within:i_,sign:s_}=I,{abs:n_}=Math,o_={getScaleData(t,e,i,s,n,o,r,a){let h,d,c={},u=1,g=1;const{boxBounds:p,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,S=s_(x),k=s_(b),E=a?x:S*p.width/v,B=a?b:k*p.height/w;if(l(s))u=g=Math.sqrt(s);else{o&&(s.x*=2,s.y*=2),s.x*=a?x:S,s.y*=a?b:k;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,l=(-s.x+v)/v;switch(i){case qp:g=t,h="bottom";break;case Zp:u=e,h="left";break;case $p:g=r,h="top";break;case t_:u=l,h="right";break;case Gp:g=t,u=l,h="bottom-right";break;case Kp:g=t,u=e,h="bottom-left";break;case Jp:g=r,u=e,h="top-left";break;case Qp:g=r,u=l,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case qp:case $p:u=g;break;case t_:case Zp:g=u;break;default:d=Math.sqrt(n_(u*g)),u=s_(u)*d,g=s_(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/p.width/e.scaleX),g<0&&(g=1/p.height/e.scaleY)}if(e_(o||h,p,c,!0),m){const e={x:u,y:g};sc.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&_){const e=p.width*t.scaleX;u=i_(e*u,_)/e}if(R&&f){const e=p.height*t.scaleY;g=i_(e*g,f)/e}return T&&n_(u*y.width)<1&&(u=s_(u)/y.width),R&&n_(g*y.height)<1&&(g=s_(g)/y.height),n&&u!==g&&(d=Math.min(n_(u),n_(g)),u=s_(u)*d,g=s_(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case Gp:o="bottom-right";break;case Kp:o="bottom-left";break;case Jp:o="top-left";break;case Qp:o="top-right";break;default:o="center"}return e_(n||o,t.boxBounds,r,!0),{origin:r,rotation:dt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case qp:case Gp:o={x:.5,y:0},n="bottom",a=1;break;case $p:case Jp:o={x:.5,y:1},n="top",a=1;break;case t_:case Qp:o={x:0,y:.5},n="right",h=1;break;case Zp:case Kp:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,e_(s||n,t,r,!0);const c=dt.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.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 t_:t=Zp;break;case Gp:t=Kp;break;case Qp:t=Jp;break;case Zp:t=t_;break;case Kp:t=Gp;break;case Jp:t=Qp}if(i)switch(t){case qp:t=$p;break;case Gp:t=Qp;break;case Kp:t=Jp;break;case $p:t=qp;break;case Qp:t=Gp;break;case Jp:t=Kp}return t}},r_={};function a_(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return h_(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:p,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(p||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?g:o?c:u:v?g:y?c:u;h+=45*(o_.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(I.formatRotation(h,!0)/2);const{url:x,x:b,y:S}=w,k=x+h;r_[k]?i.cursor=r_[k]:r_[k]=i.cursor={url:l_(x,h),x:b,y:S}}function h_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function l_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class d_ extends ed{constructor(t){super(t),this.useFastShadow=!0}}const c_=["top","right","bottom","left"],u_=void 0;class g_ extends jl{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.editor.editing}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 jl,this.rect=new d_({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new d_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new jl({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:n,rotatePoints:o,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 d_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new d_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new d_({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:o,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),g=this.getResizeLinesStyle();let p;this.visible=!t.locked;for(let t=0;t<8;t++)p=o[t],p.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),p.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},g[(t-1)/2%g.length]||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:u_},e.rect||{}));const _=r(e.rectThrough)?i:e.rectThrough;s.hittable=!_,_&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&f.stintSet(t.__world,"ignorePixelSnap",d),h_(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,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:n,rotation:o,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:n,circle:r,buttons:a,resizePoints:h,rotatePoints:d,resizeLines:c}=this,{editMask:u}=e,{middlePoint:g,resizeable:p,rotateable:_,hideOnSmall:f,editBox:m,mask:y,dimOthers:v,bright:w,spread:x,hideRotatePoints:b,hideResizeLines:S}=i;if(u.visible=!!y||0,o(v)&&o(w)||(e.setDimOthers(v),e.setBright(!!v||w)),x&&jt.spread(t,x),this.view.worldOpacity){const{width:e,height:o}=t,u=l(f)?f:10,y=m&&!(f&&e<u&&o<u);let v,w,x,k={};for(let i=0;i<8;i++)Et.toPoint(Et.directionData[i],t,k),w=h[i],v=d[i],w.set(k),v.set(k),w.visible=y&&!(!p&&!_),v.visible=y&&_&&p&&!b,i%2&&(x=c[(i-1)/2],x.set(k),x.visible=w.visible&&!S,w.visible&&(w.visible=!!g),v.visible&&(v.visible=!!g),(i+1)/2%2?(x.width=e+x.height,f&&2*w.width>e&&(w.visible=!1)):(x.width=o+x.height,f&&2*w.width>o&&(w.visible=!1)));r.visible=y&&_&&!(!i.circle&&!i.rotatePoint),r.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||m})),a.visible=y&&a.children.length>0||0,a.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=c_.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=c_.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?o_.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:u_};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()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return u(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:o,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(o&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t)}a_(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(ta.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.canDragLimitAnimate&&(t instanceof hc||t instanceof cc)&&this.transformTool.onMove(t),this.resizing&&(ta.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case cc.START:this.onTransformStart(t);break;case cc.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),a(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case fc.START:this.onTransformStart(t);break;case fc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),a(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case fc.START:this.onTransformStart(t);break;case fc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){a_(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 Wd)||t.find(t=>t instanceof Wd);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_([[hc.START,this.onDragStart,this],[hc.DRAG,this.onDrag,this],[hc.END,this.onDragEnd,this],[oc.ENTER,e=>{this.enterPoint=t,a_(this,e)}],[oc.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[oc.DOUBLE_TAP,this.onDoubleTap,this],[oc.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[mc.HOLD,mc.UP],this.onKey,this],[mc.DOWN,this.onArrow,this],[[cc.START,cc.BEFORE_MOVE,cc.END],this.onMove,this,!0],[[fc.START,fc.BEFORE_ZOOM,fc.END],this.onScale,this,!0],[[pc.START,pc.BEFORE_ROTATE,pc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const p_={x:0,y:0,width:1e5,height:1e5};class __ extends Vl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,p_),Object.assign(this.__world,p_)}__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 f_='\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"/>',m_={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${f_}\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${f_}\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${f_}\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},y_=new Kt;function v_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{y_.setListWithFn(i,t=>t.getBounds("box","page")),0===y_.width&&(y_.width=.1),0===y_.height&&(y_.height=.1),e.reset(y_.get())}),s.add(e)}const w_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),x_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),b_={group(t,e,i){t.sort(x_);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new jl(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(w_);const r=new yt(e.worldTransform);return r.divideParent(n.scrollWorldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},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(w_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(x_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},S_=oe.get("EditToolCreator");function k_(){return t=>{B_.register(t)}}const E_=k_,B_={list:{},register(t){const{tag:e}=t.prototype;T_[e]&&S_.repeat(e),T_[e]=t},get:(t,e)=>new T_[t](e)},{list:T_}=B_;class R_ extends Lp{constructor(t,e){super(t,e)}}R_.BEFORE_OPEN="innerEditor.before_open",R_.OPEN="innerEditor.open",R_.BEFORE_CLOSE="innerEditor.before_close",R_.CLOSE="innerEditor.close";class C_ extends Lp{constructor(t,e){super(t,e)}}C_.BEFORE_GROUP="editor.before_group",C_.GROUP="editor.group",C_.BEFORE_UNGROUP="editor.before_ungroup",C_.UNGROUP="editor.ungroup",C_.BEFORE_OPEN="editor.before_open_group",C_.OPEN="editor.open_group",C_.BEFORE_CLOSE="editor.before_close_group",C_.CLOSE="editor.close_group";const{updateMatrix:O_}=gr,P_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},L_="top-left";class A_ extends Kl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.skipJSON=!0,this.on(jr.CHANGE,e=>{if(this.checkChange&&P_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,O_(this.parent),O_(this);const a=new yt(this.__world);switch(r[i]=s,this.__layout.rotationChange(),O_(this),this.changedTransform=new yt(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(L_,o);break;case"scaleX":t.scaleOf(L_,o,1);break;case"scaleY":t.scaleOf(L_,1,o);break;case"skewX":t.skewOf(L_,o,0);break;case"skewY":t.skewOf(L_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class D_ extends Lp{constructor(t,e){super(t,e)}}D_.BEFORE_MOVE="editor.before_move",D_.MOVE="editor.move";class M_ extends Lp{constructor(t,e){super(t,e)}}M_.BEFORE_SCALE="editor.before_scale",M_.SCALE="editor.scale";class F_ extends Lp{constructor(t,e){super(t,e)}}F_.BEFORE_ROTATE="editor.before_rotate",F_.ROTATE="editor.rotate";class I_ extends Lp{constructor(t,e){super(t,e)}}I_.BEFORE_SKEW="editor.before_skew",I_.SKEW="editor.skew";class W_{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:o}=i;const r=t.type===cc.END||t.type===hc.END,h=a(e.draggable),d=!o||r||h,c={x:t.totalX,y:t.totalY};t instanceof cc&&dt.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),n=hc.getValidMove(e,s.point,c,d),(n.x||n.y)&&(o&&!h&&r?gr.animateMove(this,n,l(o)?o:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let o,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof fc?(r||(r=e.getBoxPoint(t)),o=t.totalScale):o=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=o_.getScaleData(e,n.bounds,d,o,a,o_.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof hc&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),dt.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:o,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof pc)d=t.rotation,l=o?Et.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=o_.getRotateData(e,h,t,s,i?null:o||e.around||e.origin||n||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=I.float(I.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),dt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=o_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),o_.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;g(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=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);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new D_(D_.BEFORE_MOVE,h));const l=new D_(D_.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:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new M_(M_.BEFORE_SCALE,t));const o=new M_(M_.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,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(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new M_(M_.BEFORE_SCALE,c));const u=new M_(M_.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new yt(gr.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new M_(M_.BEFORE_SCALE,r));const a=new M_(M_.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=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=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:o,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new F_(F_.BEFORE_ROTATE,d));const c=new F_(F_.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,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(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new I_(I_.BEFORE_SKEW,c));const u=new I_(I_.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(gr.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new yt(e.worldTransform);return t(),new yt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let z_=class extends jl{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 Bh,this.openedGroupList=new Bh,this.simulateTarget=new A_(this),this.editBox=new g_(this),this.editToolList={},this.selector=new Up(this),this.editMask=new __(this),this.targetEventIds=[];let i=f.clone(m_);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),ue.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}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&&v_(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||B_.get(t,this)}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(B_.list[e]){const t=this.editTool=this.getEditTool(e);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(C_.BEFORE_GROUP),this.target=b_.group(this.list,this.element,t),this.emitGroupEvent(C_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(C_.BEFORE_UNGROUP,t)),this.target=b_.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(C_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(C_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(C_.OPEN,t)}closeGroup(t){this.emitGroupEvent(C_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(C_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!gr.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 C_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||B_.get(t,this)}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}B_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(R_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(R_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(R_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(R_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new R_(t,{editTarget:i,innerEditor:e});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&&(b_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(b_.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_(sa.START,this.onRenderStart,this),i&&i.on_(jr.SCROLL,this.onChildScroll,this),t.on_(sa.CHILD_START,this.onAppRenderStart,this),t.on_(na.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())}};i([(t,e)=>{uo(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,editTool:n,innerEditor:a,app:h}=this,l=Object.assign({},t);if(a?a.editConfig&&Object.assign(l,a.editConfig):n&&n.editConfig&&Object.assign(l,n.editConfig),e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(l,t)}return s.config&&Object.assign(l,s.config),i&&(i.editConfig&&Object.assign(l,i.editConfig),"font-size"===l.editSize&&(l.lockRatio=!0),"resize-rotate"===i.pointType&&(l.around||(l.around="center"),r(l.lockRatio)&&(l.lockRatio=!0))),o(l.dragLimitAnimate)&&(l.dragLimitAnimate=h&&h.config.pointer.dragLimitAnimate),this.mergedConfig=l}})}],z_.prototype,"mergeConfig",void 0),i([Ap(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Bh?i:new Bh(i),t.multiple&&v_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new Lp(Lp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new Lp(Lp.AFTER_SELECT,s))})],z_.prototype,"target",void 0),i([Ap(function(t,e){t.emitEvent(new Lp(Lp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],z_.prototype,"hoverTarget",void 0),z_=i([Qo(W_,["editBox","editTool","emitEvent"])],z_);class Y_{static registerInnerEditor(){B_.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this._editBox||this.editor.editBox}set editBox(t){this._editBox=t}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new jl,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 X_=class extends Y_{static registerEditTool(){B_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,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()}};X_=i([k_()],X_);const{left:N_,right:H_}=St,{move:V_,copy:j_,toNumberPoints:U_}=dt;let G_=class extends X_{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===N_;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.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=U_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(V_(t,o,r),s&&V_(e,-o,-r)):(s&&V_(t,-o,-r),V_(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=t.target;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),j_(s[7],i),j_(e[7],i),j_(s[3],a),j_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===N_||t===H_,s[t].visible=a,e[t].visible=!r&&a}};G_=i([k_()],G_);const{M:q_,L:K_,C:Z_,Q:J_,Z:$_,N:Q_,D:tf,X:ef,G:sf,F:nf,O:of,P:rf,U:af}=Ie,hf={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case q_:case K_:lf(t,e,i,n,1),n+=3;break;case Z_:lf(t,e,i,n,3),n+=7;break;case J_:lf(t,e,i,n,2),n+=5;break;case $_:n+=1;break;case Q_:lf(t,e,i,n,2),n+=5;break;case tf:lf(t,e,i,n,2),n+=9;break;case ef:lf(t,e,i,n,2),n+=6;break;case sf:lf(t,e,i,n,2),n+=9;break;case nf:lf(t,e,i,n,2),n+=5;break;case of:t[n]=sf,t.splice(n+4,0,t[n+3],0),lf(t,e,i,n,2),n+=9,o+=2;break;case rf:t[n]=nf,t.splice(n+4,0,t[n+3]),lf(t,e,i,n,2),n+=5,o+=1;break;case af:lf(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:lf}=hf,df=$.get(),{topLeft:cf,top:uf,topRight:gf,right:pf,bottom:_f,left:ff}=St;function mf(t,e,i){t.pathInputed?vf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function yf(t,e,i,s){let n=e;if(!o(s)){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case uf:case _f:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case ff:case pf:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case cf:case gf:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}function vf(t,e,i){hf.scale(t.__.path,e,i),t.path=t.__.path}function wf(t,e,i){const{points:s}=t;g(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):hf.scalePoints(s,e,i),t.points=s}function xf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)df.a=e,df.d=i,s[t].transform(df,!0)}const bf=_h.prototype;bf.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))},bf.__scaleResize=function(t,e){mf(this,t,e)},bf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},bf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Wd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)yf(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),mf(this,t,e)}},zd.prototype.__scaleResize=function(t,e){vf(this,t,e)},Cd.prototype.__scaleResize=function(t,e){this.pathInputed?vf(this,t,e):this.points?wf(this,t,e):this.width*=t},pd.prototype.__scaleResize=function(t,e){this.pathInputed?vf(this,t,e):this.points?wf(this,t,e):mf(this,t,e)},jl.prototype.__scaleResize=function(t,e){xf(this,t,e)},ed.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||mf(this,t,e),i&&xf(this,t,e)},ue.add("resize"),ue.add("editor","resize"),ge.editor=function(t,e){const i=new z_(t);return e&&e.sky.add(e.editor=i),i},ed.addAttr("textBox",!1,yo),Vl.addAttr("editConfig",void 0,yo),Vl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),yo),Vl.addAttr("editInner","PathEditor",yo),jl.addAttr("editInner","",yo),Wd.addAttr("editInner","TextEditor",yo),Vl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Vl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Vl.setEditInner=function(t){this.changeAttr("editInner",t)};const Sf={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},kf={top:"flex-start",middle:"center",bottom:"flex-end"},Ef={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Bf(t,e,i){const{style:s}=t,{fill:n,padding:r,textWrap:h,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";u(e)&&(e=e[0]);if(g(e))switch(e.type){case"solid":i=il.string(e.color);break;case"image":case"film":case"video":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=il.string(a(t)?t:t.color);break;default:o(e.r)||(i=il.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,g(d)?(c=d.type,d.color&&(s.textDecorationColor=il.string(d.color))):c=d,s.textDecoration=Ef[c],s.textTransform=Sf[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=kf[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===h?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=u(r)?r.map(t=>t*i+"px").join(" "):(r||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}let Tf=class extends Y_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Wd),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div");s.classList.add("leafer-text-editor");const{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(oc.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];t&&(a.setStartAfter(t),a.setEndAfter(t)),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth)switch(i+=20,r.textAlign){case"center":n=r.autoSizeAlign?-i/2:-10;break;case"right":n=r.autoSizeAlign?-i:-20}if(r.__autoHeight)switch(s+=20,r.verticalAlign){case"middle":o=r.autoSizeAlign?-s/2:-10;break;case"bottom":o=r.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:g,f:p}=new yt(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${g},${p})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||Bf(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};function Rf(t){const{scroll:e,disabled:i}=t.app.config.move;return!e||i?"":!0===e?"free":e}function Cf(t,e,i){Of(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(cc.BEFORE_MOVE,e=>{const i=t.getValidMove(e.moveX,e.moveY,!1);if(Rf(t).includes("limit")){const s=t.getValidMove(0,0);if(s.x||s.y){const t=100,n=200,o="drag"===e.moveType?.3:.05;Math.abs(s.x)>t?i.x=0:i.x*=o,Math.abs(s.y)>n?i.y=0:i.y*=o}}t.zoomLayer.move(i)}),t.on_(cc.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(cc.END,e=>{gr.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(fc.BEFORE_ZOOM,e=>{const{zoomLayer:i,layouter:s}=t,n=t.getValidScale(e.scale);1!==n&&(s.stop(),gr.updateMatrix(t),i.scaleOfWorld(e,n),s.start())}))}function Of(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)}Tf=i([E_()],Tf),ue.add("text-editor","editor");const Pf=oe.get("LeaferTypeCreator"),Lf={list:{},register(t,e){Af[t]&&Pf.repeat(t),Af[t]=e},run(t,e){const i=Af[t];i&&i(e)}},{list:Af,register:Df}=Lf;Df("viewport",Cf),Df("custom",function(t){Cf(t,null,!0)}),Df("design",function(t){Cf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Df("document",function(t){Cf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Mf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=dt.getCenter(e.from,i.from),n=dt.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=dt.getDistance(e.from,i.from);return{move:o,scale:dt.getDistance(e.to,i.to)/r,rotation:dt.getRotation(e.from,i.from,e.to,i.to),center:n}},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),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=Ff,s=Ff.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Ff.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)?Ff.getType(i.totalData,e):"none"},add(t,e){e&&(dt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Ff;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Ff=Mf,{abs:If,max:Wf}=Math,{sign:zf,within:Yf}=I,Xf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=If(s),r=If(n);return o>50&&(s=Wf(50,o/3)*zf(s)),r>50&&(n=Wf(50,r/3)*zf(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:o}=e;const r=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(ie.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){o=Yf(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Yf(1-If(r)/(4*i)*o,.5,2);s=r>0?n:1/n}return s}};let Nf,Hf,Vf,jf;class Uf{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),Nf=0,Hf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Nf,totalY:Hf}),e.emit(cc.START,this.moveData)),t.path=this.moveData.path,t.totalX=Nf+=t.moveX,t.totalY=Hf+=t.moveY,e.emit(cc.BEFORE_MOVE,t),e.emit(cc.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Vf=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Vf}),e.emit(fc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Vf*=t.scale,e.emit(fc.BEFORE_ZOOM,t),e.emit(fc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),jf=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:jf}),e.emit(pc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=jf+=t.rotation,e.emit(pc.BEFORE_ROTATE,t),e.emit(pc.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(cc.END,Object.assign(Object.assign({},e),{totalX:Nf,totalY:Hf})),i&&t.emit(fc.END,Object.assign(Object.assign({},i),{totalScale:Vf})),s&&t.emit(pc.END,Object.assign(Object.assign({},s),{totalRotation:jf})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Gf=ql.prototype,qf=new Kt,Kf=new ft;function Zf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Jf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Gf.initType=function(t){Lf.run(t,this)},Gf.getValidMove=function(t,e,i=!0){const{disabled:s,scrollSpread:n}=this.app.config.move;Kf.set(t,e);const o=Rf(this);return o&&(o.includes("x")?Kf.y=0:o.includes("y")?Kf.x=0:Math.abs(Kf.x)>Math.abs(Kf.y)?Kf.y=0:Kf.x=0,i&&o.includes("limit")&&(qf.set(this.__world).addPoint(this.zoomLayer),n&&qf.spread(n),sc.getValidMove(qf,this.canvas.bounds,"auto",Kf,!0),o.includes("x")?Kf.y=0:o.includes("y")&&(Kf.x=0))),{x:s?0:Kf.x,y:s?0:Kf.y}},Gf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const $f=Dc.prototype;$f.createTransformer=function(){this.transformer=new Uf(this)},$f.move=function(t){this.transformer.move(t)},$f.zoom=function(t){this.transformer.zoom(t)},$f.rotate=function(t){this.transformer.rotate(t)},$f.transformEnd=function(){this.transformer.transformEnd()},$f.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):Xf.getScale(t,e);if(1!==o)this.zoom(Jf(o,t));else{const s=e.getMove?e.getMove(t,e):Xf.getMove(t,e);i.snap&&dt.round(s),this.move(Zf(s,t))}},$f.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Mf.getData(e),{moving:o,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Mf.detect(n,g(s)?s:{})){case"move":o=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Mf.reset()}o||(n.center=Mf.state.center)}else o=r=a=!0;var h,l;Object.assign(t,n.center),t.multiTouch=!0,a&&this.rotate((h=n.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(Jf(n.scale,t)),o&&this.move(Zf(n.move,t))};const Qf=kc.prototype,{abs:tm,min:em,max:im,hypot:sm}=Math;function nm(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}Qf.checkDragEndAnimate=function(t){const{interaction:e}=this,i=this.canAnimate&&this.moving&&e.m.dragAnimate;if(i){const s=l(i)?i:.95,n=.15,o=150;let r,a,h,d=0,c=0,u=0,g=0,p=3;const{dragDataList:_}=this,f=_.length;for(let t=f-1;t>=im(f-3,0)&&(h=_[t],!(h.time&&Date.now()-h.time>100));t--)r=p--,d+=h.moveX*r,c+=h.moveY*r,g+=r,a=sm(h.moveX,h.moveY),a>u&&(u=a);if(g&&(d/=g,c/=g),u>8){const t=1.15+em((u-8)/17,1)*(1.6-1.15);d*=t,c*=t}const m=im(tm(d),tm(c));m>o&&(a=o/m,d*=a,c*=a);const y=()=>{if(d*=s,c*=s,t=Object.assign({},t),tm(d)<n&&tm(c)<n)return this.dragEndReal(t);dt.move(t,d,c),this.drag(t),this.animate(y),e.emit(cc.DRAG_ANIMATE,t)};this.animate(y)}return i},Qf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Qf.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},Qf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Qf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=jt.maxX(r),d=jt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let g=0,p=0;this.autoMoveTimer=setInterval(()=>{g+=c,p+=u,dt.move(i,c,u),dt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},Qf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},ue.add("viewport"),ue.add("view"),ql.prototype.zoom=function(t,e,i,s){let n;p(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:o}=this,h=this.canvas.bounds.clone().shrink(r(n)?30:n),d=new Kt,c={x:h.x+h.width/2,y:h.y+h.height/2};let _;o.killAnimate();const{x:f,y:m,scaleX:y,scaleY:v}=o.__,{boxBounds:w}=o;if(a(t))switch(t){case"in":_=nm(y,"in");break;case"out":_=nm(y,"out");break;case"fit":t=w;break;case"fit-width":(t=new Kt(w)).height=0;break;case"fit-height":(t=new Kt(w)).width=0}else l(t)&&(_=t/y);if(_)_=this.getValidScale(_),o.scaleOfWorld(c,_,_,!1,s);else if(g(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=u(t);if(n||t.tag){const e=n?t:[t];d.setListWithFn(e,xr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,h);d.set(o.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)):(_=this.getValidScale(Math.min(h.width/r,h.height/a)),l+=(h.width-r*_)/2,c+=(h.height-a*_)/2,dt.scaleOf(e,d,_),d.scaleOf(d,_),e.scaleX*=_,e.scaleY*=_),"x"===i?c=0:"y"===i&&(l=0),dt.move(e,l,c),d.move(l,c),o.set(e,s),d}return o.worldBoxBounds};class om extends jl{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 ed,this.scrollYBar=new ed),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:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new Kt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),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:p,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?_.width+6:2,u?p.height+6:2,2]);p.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.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_(hc.DRAG,this.onDrag,this),e.on_(hc.DRAG,this.onDrag,this),t.on_(hc.END,this.onDragEnd,this),e.on_(hc.END,this.onDragEnd,this),this.target.on_(sa.BEFORE,()=>this.update(!0)),this.target.leafer.on_(ta.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}ue.add("scroll");class rm extends Dl{setText(t){this._text=t,this.__htmlChanged=!0}}const am={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};let hm=class extends Od{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const o=t.indexOf(";",n+1);if(o>n+1&&(e=t.slice(n+1,o),i=am[e],void 0!==i)){s+=i,n=o+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){a(t)?am[t]=e:Object.assign(am,t)}};i([Vo(rm)],hm.prototype,"__",void 0),i([ko("")],hm.prototype,"text",void 0),i([yo("TextEditor")],hm.prototype,"editInner",void 0),i([Ao(!1)],hm.prototype,"textEditing",void 0),hm=i([tr()],hm),ue.add("html");class lm extends El{}function dm(t){return _o(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&Bo(this),t.__useArrow=e,Oo(this)}}}))}let cm=class extends Cd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){nl.register(t,e)}};i([Vo(lm)],cm.prototype,"__",void 0),i([dm("angle")],cm.prototype,"endArrow",void 0),cm=i([tr()],cm);const{M:um,L:gm,C:pm,Q:_m,O:fm}=Ie,{rotate:mm,copyFrom:ym,scale:vm}=dt,wm={},xm={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case um:case gm:bm(t,l+1,e,i,s,n,o,r),l+=3;break;case pm:for(h=1;h<6;h+=2)bm(t,l+h,e,i,s,n,o,r);l+=7;break;case _m:for(h=1;h<4;h+=2)bm(t,l+h,e,i,s,n,o,r);l+=5;break;case fm:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){xm.layout(t,0,0,1,1,e,i)}};function bm(t,e,i,s,n,o,r,a){ym(wm,t[e],t[e+1]),r&&mm(wm,r,a),n&&vm(wm,n,o),t[e]=i+wm.x,t[e+1]=s+wm.y}const{layout:Sm,rotate:km}=xm,{getAngle:Em}=dt,Bm={x:0},Tm={x:-.5},Rm={connect:Bm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Cm={connect:Tm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Om=[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0],Pm={connect:Bm,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[...Om]},Lm=f.clone(Pm);Lm.path=[...Om,1,-2.05,1.1,2,-2.05,-1.1],Lm.dashPath=[1,-2,0,2,-.5,0];const Am={connect:Bm,offset:Tm,path:[...Pm.path]},Dm={connect:Bm,offset:Tm,path:[...Lm.path],dashPath:[1,-2.5,0,2,-1,0]};km(Am.path,180,{x:-1.5,y:0}),km(Dm.path,180,{x:-1.5,y:0});const Mm=[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0],Fm={connect:Bm,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[...Mm]},Im=f.clone(Fm);Im.path=[...Mm,1,-2.25,.95,2,-2.25,-.95],Im.dashPath=[1,-3,0,2,-.5,0];const Wm={connect:{x:-1.8},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},zm={connect:{x:.5},path:[...Wm.path]},Ym=f.clone(zm);Ym.path=[...Wm.path,1,0,0,26,0,0,1,0,360,0],Ym.dashPath=[1,-.5,0,2,.5,0];const Xm={connect:{x:-1.4},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]},Nm={path:[...Xm.path]},Hm={path:[...Xm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Vm=f.clone(Xm);Vm.connect.x=-1.9;const jm=f.clone(Nm),Um=f.clone(Hm);km(Vm.path,45),km(jm.path,45),km(Um.path,45);const Gm={angle:Rm,"angle-side":Cm,arrow:Im,triangle:Lm,"triangle-flip":Dm,circle:Ym,"circle-line":Wm,square:Hm,"square-line":Xm,diamond:Um,"diamond-line":Vm,mark:{offset:Tm,path:[1,0,-2,2,0,2]}},qm={triangle:Pm,"triangle-flip":Am,arrow:Fm,circle:zm,square:Nm,diamond:jm};function Km(t,e,i,s,n,o,r){let a,h,l=1,d=0;const{strokeCap:c,strokeJoin:u}=t.__;if(g(e))if(e.type){if(l=e.scale||1,d=e.rotation||0,a=Gm[e.type],l>1){const t=qm[e.type];t&&(a=t,h=!0)}}else a=e;else a=Gm[e];h||(h=a.fill);const{offset:p,connect:_,path:f,dashPath:m}=a;let y=_?_.x*l:0,v=p?p.x:0;const w=[...f];r&&m&&w.push(...m),"none"!==c&&(y-=.5),p&&("round"===u&&p.roundJoin?v+=p.roundJoin:"bevel"===u&&p.bevelJoin&&(v+=p.bevelJoin)),1!==l&&Sm(w,0,0,l,l),v&&Sm(w,v,0),Sm(w,s.x,s.y,n,n,Em(i,s)+d),o.x=(y+v)*n;const x={data:w};return h&&(x.fill=h),x}const{M:Zm,L:Jm,C:$m,Q:Qm,Z:ty,N:ey,D:iy,X:sy,G:ny,F:oy,O:ry,P:ay,U:hy}=Ie,{copy:ly,copyFrom:dy,getDistancePoint:cy,isSame:uy}=dt,{stintSet:gy}=f,py={},_y={},fy={},my={},yy={},vy={},wy={list:Gm,fillList:qm,addArrows(t,e){const i=t.__,{startArrow:s,endArrow:n,__strokeWidth:o,dashPattern:r,__pathForRender:a,cornerRadius:h}=i,l=!h;let d,c,u,g;e||(i.__strokeWidthCache=o);let p,_=0,f=a.length,m=0,y=s&&"none"!==s;for(;_<f;){switch(p=a[_],p){case Zm:case Jm:(m<2||_+6>=f)&&(ly(my,vy),dy(vy,a[_+1],a[_+2]),!m&&y&&ly(_y,vy)),_+=3;break;case $m:(1===m||_+7>=f-3)&&(xy(a,yy,vy,_+3),my.x=a[_+1],my.y=a[_+2]),_+=7;break;case Qm:(1===m||_+5>=f-3)&&(xy(a,yy,vy,_+1),ly(my,yy)),_+=5;break;case ty:return;case ey:_+=5;break;case iy:_+=9;break;case sy:_+=6;break;case ny:_+=9;break;case oy:_+=5;break;case ry:_+=7;break;case ay:_+=4;break;case hy:(1===m||_+6>=f-3)&&(xy(a,yy,vy,_+1),ly(my,yy),_+6!==f&&(vy.x-=(vy.x-yy.x)/10,vy.y-=(vy.y-yy.y)/10)),_+=6}if(m++,1===m&&p!==Zm)return;if(2===m&&y&&ly(fy,p===Jm?vy:uy(my,_y)?yy:my),_===f){const e=i.__pathForRender=l?[...a]:a;if(y&&(d=Km(t,s,fy,_y,o,py,!!r),c=d.fill||r,c||e.push(...d.data),py.x&&(cy(_y,fy,-py.x,!0),e[1]=fy.x,e[2]=fy.y)),n&&"none"!==n&&(uy(yy,vy)&&ly(yy,my),u=Km(t,n,yy,vy,o,py,!!r),g=u.fill||r,g||e.push(...u.data),py.x)){let t;switch(cy(vy,yy,-py.x,!0),p){case Jm:t=_-3+1;break;case $m:t=_-7+5;break;case Qm:t=_-5+3;break;case hy:t=_-6+3}t&&by(e,yy,t)}}else ly(yy,vy);gy(i,"__startArrowPath",c&&d),gy(i,"__endArrowPath",g&&u)}},updateArrow(t){const e=t.__;e.strokeScaleFixed&&e.__strokeWidthCache!==e.__strokeWidth&&t.__updateRenderPath(!0)},register(t,e,i){this.list[t]=e,i&&(this.fillList[t]=e)},get(t){return this.list[t]}};function xy(t,e,i,s){dy(e,t[s],t[s+1]),dy(i,t[s+2],t[s+3])}function by(t,e,i){t[i]=e.x,t[i+1]=e.y}ue.add("arrow"),Vl.addAttr("startArrow","none",dm),Vl.addAttr("endArrow","none",dm),Object.assign(nl,wy),Object.assign(ol,{strokeArrow(t,e,i,s){const{__startArrowPath:n,__endArrowPath:o,dashPattern:r}=e.__;r&&(i.dashPattern=null),n&&(i.beginPath(),e.__drawPathByData(i,n.data),i.stroke(),n.fill&&(i.fillStyle=t,i.fill())),o&&(i.beginPath(),e.__drawPathByData(i,o.data),i.stroke(),o.fill&&(i.fillStyle=t,i.fill()))}});let Sy=class extends ed{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};i([Vo(class extends bl{})],Sy.prototype,"__",void 0),i([xo("x")],Sy.prototype,"flow",void 0),Sy=i([tr()],Sy);const ky={},Ey={"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"},By={"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 Ty(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;Rt.toPoint(i,e,n,ky),e.x=s.__autoWidth?n.x:ky.x,e.y=s.__autoHeight?n.y:ky.y}const{move:Ry}=dt;function Cy(t,e,i,s,n,o){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[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),Ry(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function Oy(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 Py={};function Ly(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:o,__autoHeight:r}=t.__,h=n&&(e?!o:!r);return g(i)?(Py.xGap=i.x||0,Py.yGap=i.y||0):Py.xGap=Py.yGap=c(i),Py.isAutoXGap=a(Py.xGap)&&!o,Py.isAutoYGap=a(Py.yGap)&&!r,Py.complex=h||"top-left"!==s||t.__hasGrow||Py.isAutoXGap||Py.isAutoYGap,Py.wrap=h,Py.complex&&(Py.isFitXGap="fit"===Py.xGap&&!o,Py.isFitYGap="fit"===Py.yGap&&!r,g(s)?(Py.contentAlign=s.content||"top-left",Py.rowXAlign=s.x||"from",Py.rowYAlign=s.y||"from"):(Py.contentAlign=s,Py.rowXAlign=Ey[s],Py.rowYAlign=By[s])),Py}function Ay(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function Dy(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function My(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Fy}=I;function Iy(t,e,i,s){let n,o,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++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=Wy(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=Wy(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Wy(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?Fy(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:zy}=I;function Yy(t,e,i,s){let n,o,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++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=Xy(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=Xy(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function Xy(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?zy(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:Ny}=dt;function Hy(t,e){const i="width",{children:s,itemBox:n}=t,o=Ly(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;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 o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=My(p,n),r?(p.__flowBounds=_,y||(y=Ay(m,g)),a&&y.count&&y.width+_.width>x&&(y.grow?Iy(t,y,x,e):d&&Dy(y,i,x,c),Oy(u,y,i),y=Ay(m,g)),f=_.width,p.__widthGrow&&(y.grow+=p.__widthGrow,f=0,p.__.widthRange&&(y.hasRangeSize=!0)),p.__heightGrow&&Xy(p,_,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,_.height),y.count++):(Ny(p,v-_.x,w-_.y),v+=_.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:g}=o;y.count&&(y.grow?Iy(t,y,x,e):d&&Dy(y,i,x,c),a&&Oy(u,y,i)),a?(s?Dy(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Ty(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=Ey[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],Cy(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(Ty(t,y,r),Cy(t,y,0,y.y,g,e))}}const{move:Vy}=dt;function jy(t,e,i,s,n,o){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[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),Vy(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Uy}=dt;function Gy(t,e){const i="height",{children:s,itemBox:n}=t,o=Ly(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;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 o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=My(p,n),r?(p.__flowBounds=_,y||(y=Ay(m,g)),a&&y.count&&y.height+_.height>b&&(y.grow&&Yy(t,y,b,e),d&&Dy(y,i,b,c),Oy(u,y,i),y=Ay(m,g)),f=_.height,p.__heightGrow&&(y.grow+=p.__heightGrow,f=0,p.__.heightRange&&(y.hasRangeSize=!0)),p.__widthGrow&&Wy(p,_,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,_.width),y.count++):(Uy(p,v-_.x,w-_.y),w+=_.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:g}=o;y.count&&(y.grow&&Yy(t,y,b,e),d&&Dy(y,i,b,c),a&&Oy(u,y,i)),a?(s?Dy(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Ty(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=By[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],jy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Ty(t,y,r),jy(t,y,y.x,0,l,e))}}function qy(t){return _o(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)&&Bo(this)}}))}ue.add("flow","resize");const Ky=ed.prototype,{__updateBoxBounds:Zy}=jl.prototype;Vl.addAttr("flow",!1,xo),Vl.addAttr("gap",0,ko),Vl.addAttr("flowAlign","top-left",ko),Vl.addAttr("flowWrap",!1,ko),Vl.addAttr("itemBox","box",ko),Vl.addAttr("inFlow",!0,ko),Vl.addAttr("autoWidth",void 0,qy),Vl.addAttr("autoHeight",void 0,qy),Vl.addAttr("autoBox",void 0,ko);const{copyAndSpread:Jy}=jt;Ky.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Hy(this);break;case"y":Gy(this);break;case"x-reverse":Hy(this,!0);break;case"y-reverse":Gy(this,!0)}t&&(this.leafer.created=!0)},Ky.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Jy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Ky.__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():Zy.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&&Jy(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:$y,sin:Qy,pow:tv,sqrt:ev,abs:iv,ceil:sv,floor:nv,round:ov,PI:rv}=Math,av=5*rv,hv=1.70158,lv=2.5949095,dv=7.5625,cv=2.75;function uv(t){return e=>tv(e,t)}function gv(t){return e=>1-tv(1-e,t)}function pv(t){return e=>e<.5?.5*tv(2*e,t):1-.5*tv(2-2*e,t)}function _v(t){return t<1/cv?dv*t*t:t<2/cv?dv*(t-=1.5/cv)*t+.75:t<2.5/cv?dv*(t-=2.25/cv)*t+.9375:dv*(t-=2.625/cv)*t+.984375}function fv(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=mv(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(iv(l)<1e-6));e++)c-=d/l;return n[r]=mv(c,e,s)}}function mv(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const yv={get(t){const{list:e}=yv;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){yv.list[t]=e},list:{linear:t=>t,ease:fv(.25,.1,.25,1),"ease-in":fv(.42,0,1,1),"ease-out":fv(0,0,.58,1),"ease-in-out":fv(.42,0,.58,1),"sine-in":t=>1-$y(t*rv*.5),"sine-out":t=>Qy(t*rv*.5),"sine-in-out":t=>.5*(1-$y(t*rv)),"quad-in":uv(2),"quad-out":gv(2),"quad-in-out":pv(2),"cubic-in":uv(3),"cubic-out":gv(3),"cubic-in-out":pv(3),"quart-in":uv(4),"quart-out":gv(4),"quart-in-out":pv(4),"quint-in":uv(5),"quint-out":gv(5),"quint-in-out":pv(5),"expo-in":t=>t?tv(2,10*t-10):0,"expo-out":t=>1===t?1:1-tv(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*tv(2,2*t*10-10):.5*(2-tv(2,10-2*t*10)),"circ-in":t=>1-ev(1-tv(t,2)),"circ-out":t=>ev(1-tv(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-ev(1-tv(2*t,2))):.5*(ev(1-tv(2-2*t,2))+1),"back-in":t=>((hv+1)*t-hv)*t*t,"back-out":t=>(t-=1)*t*((hv+1)*t+hv)+1,"back-in-out":t=>t<.5?(t*=2)*t*((lv+1)*t-lv)*.5:.5*((t=2*t-2)*t*((lv+1)*t+lv)+2),"elastic-in":t=>0===t||1===t?t:-tv(2,10*(t-1))*Qy((t-1.1)*av),"elastic-out":t=>0===t||1===t?t:tv(2,-10*t)*Qy((t-.1)*av)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-tv(2,10*((t*=2)-1))*Qy((t-1.1)*av)*.5:tv(2,10*(1-(t*=2)))*Qy((t-1.1)*av)*.5+1,"bounce-in":t=>1-_v(1-t),"bounce-out":_v,"bounce-in-out":t=>t<.5?.5*(1-_v(1-2*t)):.5*(1+_v(2*t-1)),"cubic-bezier":fv,steps:function(t,e="floor"){return i=>("floor"===e?nv(i*t):"ceil"===e?sv(i*t):ov(i*t))/t}}};function vv(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 wv{}wv.CREATED="created",wv.PLAY="play",wv.PAUSE="pause",wv.STOP="stop",wv.SEEK="seek",wv.UPDATE="update",wv.COMPLETED="completed";let xv=class extends ca{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&l(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=yv.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(wv.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(wv.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(wv.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;g(t)&&(t=sl.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(wv.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let a,h,d,c,u,g=0,p=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=h;o&&(d.swing=l(o)?o: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,p+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=yv.get(n))}if(!d.autoDuration&&o(d.duration)&&(n>1?s>0||r?p+=u:d.duration=0:d.duration=this.duration),n>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)}p?((this.duration<=g||!s||!s.duration)&&this.changeDuration(g+.2*p),this.allocateTime((this.duration-g)/p)):g&&this.changeDuration(g),this.emitType(wv.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let a in e)o(s[a])&&(s[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=o(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],o(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,ie.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(wv.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),ul.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(wv.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)}};i([vv("ease")],xv.prototype,"easing",void 0),i([vv(0)],xv.prototype,"delay",void 0),i([vv(.2)],xv.prototype,"duration",void 0),i([vv("auto")],xv.prototype,"ending",void 0),i([vv(!1)],xv.prototype,"reverse",void 0),i([vv(!1)],xv.prototype,"swing",void 0),i([vv(!1)],xv.prototype,"loop",void 0),i([vv(0)],xv.prototype,"loopDelay",void 0),i([vv(1)],xv.prototype,"speed",void 0),i([vv(!0)],xv.prototype,"autoplay",void 0),i([vv()],xv.prototype,"join",void 0),i([vv()],xv.prototype,"jump",void 0),i([vv()],xv.prototype,"attrs",void 0),xv=i([Qo(ba)],xv);let bv=class extends xv{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 xv(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(wv.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(wv.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(wv.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(wv.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case wv.COMPLETED:this.completed&&this.emitType(t);break;case wv.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)}};bv=i([Qo(ba)],bv);const Sv={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"},kv=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Ev=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Bv=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Tv=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Rv=parseInt,Cv=parseFloat,{round:Ov}=Math;let Pv={},Lv=0;function Av(t){let e,i,s,n=1;switch(t.length){case 9:e=Rv(t.slice(1,3),16),i=Rv(t.slice(3,5),16),s=Rv(t.slice(5,7),16),n=Rv(t.slice(7,9),16)/255;break;case 7:e=Rv(t.slice(1,3),16),i=Rv(t.slice(3,5),16),s=Rv(t.slice(5,7),16);break;case 5:e=Rv(t[1]+t[1],16),i=Rv(t[2]+t[2],16),s=Rv(t[3]+t[3],16),n=Rv(t[4]+t[4],16)/255;break;case 4:e=Rv(t[1]+t[1],16),i=Rv(t[2]+t[2],16),s=Rv(t[3]+t[3],16);break;case 3:e=i=s=Rv(t[1]+t[2],16);break;case 2:e=i=s=Rv(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const Dv=1/6,Mv=.5,Fv=2/3,Iv=1/3;function Wv(t,e,i){return i<0?i++:i>1&&i--,i<Dv?t+6*(e-t)*i:i<Mv?e:i<Fv?t+(e-t)*(Fv-i)*6:t}function zv(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Wv(a,s,t+Iv),o=Wv(a,s,t),r=Wv(a,s,t-Iv)}return{r:Ov(255*n),g:Ov(255*o),b:Ov(255*r),a:s}}ue.add("color"),il.object=function(t,e){let i,s=!o(e)&&e<1;if(a(t)){const e=Pv[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Av(t);break;case"R":case"r":"("===t[4]&&Ev.test(t)?i=function(t){const e=Ev.exec(t);return{r:Rv(e[1]),g:Rv(e[2]),b:Rv(e[3]),a:Cv(e[4])}}(t):"("===t[3]&&kv.test(t)&&(i=function(t){const e=kv.exec(t);return{r:Rv(e[1]),g:Rv(e[2]),b:Rv(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Tv.test(t)?i=function(t){const e=Tv.exec(t);return zv(Cv(e[1]),Cv(e[2]),Cv(e[3]),Cv(e[4]))}(t):"("===t[3]&&Bv.test(t)&&(i=function(t){const e=Bv.exec(t);return zv(Cv(e[1]),Cv(e[2]),Cv(e[3]),1)}(t))}if(!i){const e=Sv[t.toLowerCase()];e&&(i=Av("#"+e))}i&&(Lv++,Lv>1e4&&(Pv={},Lv=0),Pv[t]=Object.assign({},i))}}else g(t)&&(o(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:Yv}=Math,{fourNumber:Xv}=I,Nv={fill:Gv,stroke:Gv,cornerRadius:(t,e,i)=>l(t)&&l(e)?jv(t,e,i):(t=Xv(t),e=Xv(e),t.map((t,s)=>jv(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,n=e.length,o=jv(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return l(t)||l(e)?I.float(jv(t,e,i),Math.max(Vv(t),Vv(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return ul.setBetweenStyle(n,t,e,n,i,s),n},shadow:qv,innerShadow:qv},Hv={value:function(t,e,i){const s=l(t),n=l(e);return s&&n?t+(e-t)*i:n||s?jv(t,e,i):t},number:jv,color:Uv,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=ul;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,n,o)))}};function Vv(t){const e=String(t).split(".")[1];return e?e.length:0}function jv(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Yv(n):n}function Uv(t,e,i){t=il.object(t),e=il.object(e);const s=jv(t.r,e.r,i,1)+","+jv(t.g,e.g,i,1)+","+jv(t.b,e.b,i,1),n=jv(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Gv(t,e,i){return a(t)&&a(e)?Uv(t,e,i):e}function qv(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:jv((t=t||{}).x,e.x,i),y:jv(t.y,e.y,i),blur:jv(t.blur,e.blur,i),spread:jv(t.spread,e.spread,i),color:Uv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ue.add("animate","color"),cl.canAnimate=!0,Object.assign(ul.list,Nv),Object.assign(ul,Hv);const Kv=Vl.prototype;Vl.addAttr("animation",void 0,function(t){return _o(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Vl.addAttr("animationOut",void 0,yo),Vl.addAttr("transition",!0,yo),Vl.addAttr("transitionOut",void 0,yo),Kv.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))},Kv.animate=function(t,e,i,s){if(o(t))return this.__animate;let n=u(t)&&!e&&i?new bv(this,t,s):new xv(this,t,e,s);this.killAnimate(i,n.toStyle);const r=this.__animate;return r&&(n instanceof bv?n.list.unshift(r):n=new bv(this,[r,n])),this.__animate=n},Kv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof bv&&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)}},Kv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(wv.COMPLETED,e)};const Zv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Jv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:$v}=Math,{getDerivative:Qv}=di,tw={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,g,p,_=0,f=h/2;for(let h=0;h<Zv.length;h++)l=f*(1+Zv[h]),d=f*(1-Zv[h]),c=Qv(l,t,i,n,r),u=Qv(l,e,s,o,a),g=Qv(d,t,i,n,r),p=Qv(d,e,s,o,a),_+=Jv[h]*($v(c*c+u*u)+$v(g*g+p*p));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Qv(t,e,s,o,a),d=Qv(t,i,n,r,h);return Math.atan2(d,l)/z},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,g=t/e,p=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>p;)ew(i,s,n,o,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,g=d*n+e*r,p=d*o+e*a,_=d*c+e*g,f=d*u+e*p,m=d*_+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*p+e*(d*a+e*l));t.push(Ie.C,c,u,_,f,m,y)}},{getDistance:ew}=tw,{M:iw,L:sw,C:nw,Z:ow}=Ie,{float:rw}=I,aw={},hw={},lw={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case iw:case sw:lw.transformPoints(t,e,s,1),s+=3;break;case nw:lw.transformPoints(t,e,s,3),s+=7;break;case ow:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)aw.x=t[n],aw.y=t[n+1],$.toOuterPoint(e,aw),t[n]=aw.x,t[n+1]=aw.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case iw:case sw:i=t[a+1],s=t[a+2],e=n===sw&&a>0?dt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case nw:i=t[a+5],s=t[a+6],e=tw.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 ow:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=sl.number(e,t.total);let o,r,a,h,l,d,c,u,g,p=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case iw:case sw:if(r=n[f+1],a=n[f+2],o=s[m],p+o>=e||!t.total)return f||(y=r,v=a),hw.x=y,hw.y=v,_.x=r,_.y=a,dt.getDistancePoint(hw,_,e-p,!0),_.rotation=dt.getAngle(hw,_),_;y=r,v=a,f+=3;break;case nw:if(r=n[f+5],a=n[f+6],o=s[m],p+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],g=tw.getT(e-p,o,y,v,l,d,c,u,r,a,i),di.getPointAndSet(g,y,v,l,d,c,u,r,a,_),_.rotation=tw.getRotation(g,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case ow:f+=1;default:o=0}m++,p+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=sl.number(e,t.total);let r,a,h,l,d,c,u,g,p,_,f=0,m={},y=0,v=0,w=0,x=0;const b=n.length;for(;y<b;){switch(d=n[y],d){case iw:case sw:if(h=n[y+1],l=n[y+2],r=s[v],f+r>e||!t.total)return y||(w=h,x=l),hw.x=w,hw.y=x,m.x=h,m.y=l,a=rw(e-f),a&&(dt.getDistancePoint(hw,m,a,!0),o.push(d,m.x,m.y)),o;w=h,x=l,y+=3,o.push(d,w,x);break;case nw:if(c=n[y+1],u=n[y+2],g=n[y+3],p=n[y+4],h=n[y+5],l=n[y+6],r=s[v],f+r>e)return a=rw(e-f),a&&(_=tw.getT(a,r,w,x,c,u,g,p,h,l,i),tw.cut(o,_,w,x,c,u,g,p,h,l)),o;w=h,x=l,y+=7,o.push(d,c,u,g,p,h,l);break;case ow:y+=1,o.push(d);default:r=0}v++,f+=r}return o}};function dw(t){return _o(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ue.add("motion-path"),ul.register("motion",function(t,e,i,s){return g(t)&&(t=sl.number(t,s.getMotionTotal())),g(e)&&(e=sl.number(e,s.getMotionTotal())),ul.number(t||0,e||0,i)}),ul.register("motionRotation",function(t,e,i){return ul.number(t,e,i)});const cw=Vl.prototype,{updateMatrix:uw,updateAllMatrix:gw}=gr,{updateBounds:pw}=Er;function _w(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=mw(t);i.total&&(t.__.__pathForRender=lw.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(gw(t),pw(t,t)):uw(t));i&&(t.leafer.created=!0)}}function fw(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 mw(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=lw.getMotionPathData(t.getPath(!0,!0))}function yw(t,e){return _o(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?cl.setStyleName(this,e,i):cl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function vw(t){return _o(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function ww(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 xw(t,e){g(e)||(e=void 0),kw(t,e,"in")}function bw(t,e){const{normalStyle:i}=t;g(e)||(e=void 0),i&&(e||(e=i),kw(t,e,"out"))}Vl.addAttr("motionPath",void 0,dw),Vl.addAttr("motionPrecision",1,dw),Vl.addAttr("motion",void 0,dw),Vl.addAttr("motionRotation",!0,dw),cw.getMotionPathData=function(){return mw(fw(this))},cw.getMotionPoint=function(t){const e=fw(this),i=mw(e);if(!i.total)return{};const s=lw.getDistancePoint(i,t,e.motionPrecision);$.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:l(n)&&(s.rotation+=n),s},cw.getMotionTotal=function(){return this.getMotionPathData().total},cw.__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(),_w(t))}else _w(this)};const Sw={};function kw(t,e,i){const{normalStyle:s}=t;e||(e=Sw),e.scale&&(I.assignScale(e,e.scale),delete e.scale),e!==Sw&&cl.canAnimate||(i=null);let n=!!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 o=n?function(t,e){const i=Tw(e,t),s=t.animate();s&&Tw(i,t,s.fromStyle);return i}(t,e):void 0;cl.canAnimate&&Ew(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=Ew(t);if(a){const{animation:s}=a;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(a,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete a.animation}t.normalStyle=Bw(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=Bw(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Ew(t){let e;const i={},s=ww(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&cl.isState(n,t,s)&&(e=Rw(i,o));const r=i.selectedStyle||t.selectedStyle;r&&cl.isSelected(t,s)&&(e=Rw(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&cl.isPlacehold(t,s)&&(e=Rw(i,a)),cl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Rw(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&cl.isFocus(t,s)&&(e=Rw(i,n));const o=i.hoverStyle||t.hoverStyle;o&&cl.isHover(t,s)&&(e=Rw(i,o));const r=i.pressStyle||t.pressStyle;r&&cl.isPress(t,s)&&(e=Rw(i,r))}return e?i:void 0}function Bw(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&cl.animateExcludes[t]||(n[t]=e[t]);return n}function Tw(t,e,i){return Bw(t,e,i,!0)}function Rw(t,e){return Object.assign(t,e),!0}function Cw(t,e){const i=t[e];i&&xw(t,i),t.button&&Pw(t.children,e)}function Ow(t,e,i){i||(i=t.states[e]),xw(t,i),t.button&&Pw(t.children,null,e)}function Pw(t,e,i){if(!t)return;let s,n;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":cl.isHover(s)&&(n=!1);break;case"pressStyle":cl.isPress(s)&&(n=!1);break;case"focusStyle":cl.isFocus(s)&&(n=!1)}n&&Cw(s,e)}else o(i)||Ow(s,i);s.isBranch&&Pw(s.children,e,i)}}function Lw(t,e){const i=t[e];i&&bw(t,i),t.button&&Dw(t.children,e)}function Aw(t,e,i){bw(t,i),t.button&&Dw(t.children,null,e)}function Dw(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?Lw(s,e):o(i)||Aw(s,i),s.isBranch&&Dw(s.children,e,i)}function Mw(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=ww(e,i);o&&(s=n[t](o))}return s}function Fw(t,e,i){let s=e[t];if(!s&&i){const n=ww(e,i);n&&(s=n[t])}return s}ue.add("state"),cl.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},cl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=ww(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},cl.isSelected=function(t,e){return Fw("selected",t,e)},cl.isDisabled=function(t,e){return Fw("disabled",t,e)},cl.isFocus=function(t,e){return Mw("isFocus",t,e)},cl.isHover=function(t,e){return Mw("isHover",t,e)},cl.isPress=function(t,e){return Mw("isPress",t,e)},cl.isPlacehold=function(t,e){return t.__.__isPlacehold},cl.isDrag=function(t,e){return Mw("isDrag",t,e)},cl.setStyleName=function(t,e,i){i?Ow(t,e,t[e]):Aw(t,e,t[e])},cl.set=function(t,e){const i=t.states[e];i?Ow(t,e,i):Aw(t,e,i)},cl.getStyle=Ew,cl.updateStyle=kw,cl.updateEventStyle=function(t,e){switch(e){case oc.ENTER:Cw(t,"hoverStyle");break;case oc.LEAVE:Lw(t,"hoverStyle");break;case oc.DOWN:Cw(t,"pressStyle");break;case oc.UP:Lw(t,"pressStyle")}};const Iw=Vl.prototype;Vl.addAttr("selected",!1,yw,"selectedStyle"),Vl.addAttr("disabled",!1,yw,"disabledStyle"),Vl.addAttr("states",{},vw),Vl.addAttr("state","",yw),Vl.addAttr("normalStyle",void 0,yo),Vl.addAttr("hoverStyle",void 0,vw),Vl.addAttr("pressStyle",void 0,vw),Vl.addAttr("focusStyle",void 0,vw),Vl.addAttr("selectedStyle",void 0,vw),Vl.addAttr("disabledStyle",void 0,vw),Vl.addAttr("placeholderStyle",void 0,vw),Vl.addAttr("button",!1,yo),Iw.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))},Iw.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?Cw(this,"focusStyle"):Lw(this,"focusStyle")})},Iw.updateState=function(){cl.updateStyle(this,void 0,"in")};const Ww=Wd.prototype,zw="text";uo(Ww,zw,Object.assign(Object.assign({},go(Ww,zw)),{set(t){const e=this,i=e.text;e.__setAttr(zw,t)&&(Bo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Yw extends vl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Xw=class extends Vl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!o(t))if(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=no.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:o,total:r}=e,{width:a,height:h}=o&&(l(o)?{width:o,height:o}:o)||(r>1?this:t);let d=n?n.x:0,c=n?n.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 Gr(Gr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),o(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};i([Vo(Yw)],Xw.prototype,"__",void 0),i([ko()],Xw.prototype,"robot",void 0),i([yo()],Xw.prototype,"actions",void 0),i([yo("")],Xw.prototype,"action",void 0),i([Ao(0)],Xw.prototype,"now",void 0),i([yo(12)],Xw.prototype,"FPS",void 0),i([yo(!0)],Xw.prototype,"loop",void 0),Xw=i([tr()],Xw),ue.add("robot");const{Yes:Nw,NoAndSkip:Hw,YesAndSkip:Vw}=e,jw={},Uw={},Gw={};class qw{constructor(t,e){this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},this.idMap={},this.innerIdMap={};const i=t&&t.app;i&&(i.idMap?this.idMap=i.idMap:i.idMap=this.idMap,i.innerIdMap?this.innerIdMap=i.innerIdMap:i.innerIdMap=this.innerIdMap),(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":jw.id=t.substring(1),t=jw;break;case".":Uw.className=t.substring(1),t=Uw;break;default:Gw.tag=t,t=Gw}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?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&&gr.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),"boolean"==typeof o&&(o=o?1:0),o===Nw||o===Vw){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Hw&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Hr.REMOVE,this.__onRemoveChild,this),this.target.on_(jr.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 Kw=Vl.prototype;function Zw(t){return t.leafer?t.leafer.selector:ie.selector||(ie.selector=ge.selector())}Kw.find=function(t,e){return Zw(this).getBy(t,this,!1,e)},Kw.findOne=function(t,e){return Zw(this).getBy(t,this,!0,e)},ue.add("find"),ge.finder=function(t,e){return new qw(t,e)},gr.cacheId=function(t){const{leafer:e,id:i}=t;i&&(e.app.idMap[i]=t),e.cacheInnerId&&(e.app.innerIdMap[t.innerId]=t)};const{setPoint:Jw,addPoint:$w,toBounds:Qw}=wt;const tx={syncExport(t,e,i){let s;dl.running=!0;try{const n=Zn.fileType(e),r=e.includes(".");i=Zn.getExportOptions(i);const{toURL:a}=ie,{download:h}=ie.origin;if("json"===n)r&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),s={data:!!r||t.toJSON(i.json)};else if("svg"===n)r&&h(a(t.toSVG(),"svg"),e),s={data:!!r||t.toSVG()};else{let n,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:p,trim:_,screenshot:f,padding:m,onCanvas:y}=i,v=o(i.smooth)?!c||c.config.smooth:i.smooth,w=i.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&o(i.fill)?t.fill:i.fill,b=Zn.isOpaqueImage(e)||x,S=new yt;if(f)n=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=i.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":S.set(l);break;case"local":S.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:S.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}n=t.getBounds("render",e)}const k={scaleX:1,scaleY:1};I.getScaleData(i.scale,i.size,n,k);let E=i.pixelRatio||1,{x:B,y:T,width:R,height:C}=new Kt(n).scale(k.scaleX,k.scaleY);p&&(B+=p.x,T+=p.y,R=p.width,C=p.height,p.rotation&&S.rotateOfInner({x:B,y:T},-p.rotation));const O={exporting:!0,matrix:S.scale(1/k.scaleX,1/k.scaleY).invert().translate(-B,-T).withScale(1/a*k.scaleX,1/h*k.scaleY)};let P,L=ge.canvas({width:Math.floor(R),height:Math.floor(C),pixelRatio:E,smooth:v,contextSettings:w});g&&(P=t,P.__worldOpacity=0,t=c||t,O.bounds=L.bounds),L.save();const A=u&&!o(x),D=t.get("fill");if(A&&(t.fill=""),ie.render(t,L,O),A&&(t.fill=D),L.restore(),P&&P.__updateWorldOpacity(),_){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?$w(r,n,o):Jw(r={},n,o)),a++;const h=new Kt;return r&&(Qw(r,h),h.scale(1/t.pixelRatio).ceil()),h}(L);const t=L,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:E};L=ge.canvas(s),L.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=I.fourNumber(m),n=L,{width:o,height:r}=n;L=ge.canvas({width:o+s+e,height:r+t+i,pixelRatio:E}),L.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}b&&L.fillWorld(L.bounds,x||"#FFFFFF","destination-over"),y&&y(L);s={data:"canvas"===e?L:L.export(e,i),width:L.pixelWidth,height:L.pixelHeight,renderBounds:n,trimBounds:r};const M=c&&c.app;M&&M.canvasManager&&M.canvasManager.clearRecycled()}}catch(t){s={data:"",error:t}}return dl.running=!1,s},export(t,e,i){return dl.running=!0,function(t){ex||(ex=new to);return new Promise(e=>{ex.add(()=>s(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(o=>{const r=()=>s(this,void 0,void 0,function*(){if(!io.isComplete)return ie.requestRender(r);const s=dl.syncExport(t,e,i);s.data instanceof Promise&&(s.data=yield s.data),n(s),o()});t.updateLayout(),ix(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))}};let ex;function ix(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>ix(t))}const sx=De.prototype,nx=oe.get("@leafer-in/export");sx.export=function(t,e){const{quality:i,blob:s}=Zn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},sx.toBlob=function(t,e){return new Promise(i=>{ie.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{nx.error(t),i(null)})})},sx.toDataURL=function(t,e){return ie.origin.canvasToDataURL(this.view,t,e)},sx.saveAs=function(t,e){return new Promise(i=>{ie.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{nx.error(t),i(!1)})})},ue.add("export"),Object.assign(dl,tx),Vl.prototype.export=function(t,e){return dl.export(this,t,e)},Vl.prototype.syncExport=function(t,e){return dl.syncExport(this,t,e)},ue.add("filter"),Object.assign(ll,{list:{},register(t,e){ll.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=ll.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=ll.list[t.type],e&&(i+=e.getSpread(t))}),i}}),ue.add("bright"),Vl.addAttr("bright",!1,Do);const ox={theme:"light",style:{dragBoundsType:"outer",strokeAlign:"center",strokeScaleFixed:"zoom-in",width:6,height:6,opacity:.5,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.66}},size:6,endsMargin:2,sideMargin:2,minSize:10,scaleFixed:"zoom-in",scrollType:"both",hideOnActionEnd:"hover"},rx=new Kt,{float:ax}=I,{clone:hx,assign:lx}=f;class dx extends jl{get canUse(){return this.target.hasScroller}constructor(t){super(),this.targetWorldBounds=new Kt,this.viewportBounds=new Kt,this.contentBounds=new Kt,this.scrollXBounds=new Kt,this.scrollYBounds=new Kt,this.target=t,this.config=hx(ox),this.updateConfig(),this.__listenEvents(),t.waitLeafer(()=>{this.parent=t,this.__bindLeafer(t.leafer)}),this.mergedConfig.hideOnActionEnd&&(this.opacity=0)}static registerTheme(t,e){cx.themeMap[t]=e}static getTheme(t){return t&&cx.themeMap[t]}static hasTheme(t){return t&&!!cx.themeMap[t]}updateConfig(){const{scrollConfig:t}=this.target,e=cx.getTheme(t&&cx.hasTheme(t.theme)&&t.theme||this.config.theme),i=this.mergedConfig=hx(this.config);lx(i,e),t&&lx(i,t),this.updateStyle(i.style)}updateStyle(t){this.scrollXBar||this.addMany(this.scrollXBar=new ed,this.scrollYBar=new ed);const{scrollXBar:e,scrollYBar:i}=this;e.set(t),i.set(t),e.draggable="x",i.draggable="y"}update(t=!0){if(this.dragScrolling)return;const{target:e,targetOverflow:i,targetWorldBounds:s,viewportBounds:n,contentBounds:o}=this,r=e.__layout,{overflow:a}=e.__,{childrenRenderBounds:h}=r,{boxBounds:l,worldBoxBounds:d}=r,c=t&&i===a&&s.isSame(d),u=!r.scrollConfigChanged||(this.updateConfig(),r.scrollConfigChanged=!1),g=rx.set(n).add(h);if(c&&u&&o.isSame(g))return;this.targetOverflow=a,n.set(l),s.set(d),o.set(g);const{scrollXBar:p,scrollYBar:_}=this,{size:f,endsMargin:m,minSize:y}=this.mergedConfig,{width:v,height:w}=n;this.contentRealX=o.x-e.scrollX,this.contentRealY=o.y-e.scrollY,this.ratioX=n.width/o.width,this.ratioY=n.height/o.height;const x=f+2*m+y;p.visible=ax(o.width)>ax(v)&&"y-scroll"!==a&&v>x,_.visible=ax(o.height)>ax(w)&&"x-scroll"!==a&&w>x,this.updateScrollBar()}updateScrollBar(){const{target:t,viewportBounds:e,contentBounds:i,ratioX:s,ratioY:n,scrollXBar:r,scrollYBar:a,scrollXBounds:h,scrollYBounds:l}=this;let{size:d,cornerRadius:c,endsMargin:u,sideMargin:g,minSize:p,scaleFixed:_,scrollType:f}=this.mergedConfig;const m=_?t.getClampRenderScale():1;if(u/=m,g/=m,d/=m,o(c)&&(c=d/2),r.visible){h.set(e).shrink([u,a.visible?d+g:u,g,u]);const t=this.scrollRatioX=h.width/i.width;r.set({x:h.x-i.x*t,y:h.maxY-d,width:Math.max(h.width*s,p),height:d,cornerRadius:c,dragBounds:h,hittable:"move"!==f})}if(a.visible){l.set(e).shrink([u,g,r.visible?d+g:u,u]);const t=this.scrollRatioY=l.height/i.height;a.set({x:l.maxX-d,y:l.y-i.y*t,width:d,height:Math.max(l.height*n,p),cornerRadius:c,dragBounds:l,hittable:"move"!==f})}this.x=-this.target.scrollX,this.y=-this.target.scrollY,gr.updateAllMatrix(this),Er.updateBounds(this),gr.updateAllChange(this)}onDrag(t){if("move"===this.mergedConfig.scrollType)return;this.dragScrolling=!0;const{scrollXBar:e,scrollYBar:i,target:s,scrollXBounds:n,scrollYBounds:o}=this;t.current===e?s.scrollX=-((e.x-n.x)/this.scrollRatioX+this.contentRealX):s.scrollY=-((i.y-o.y)/this.scrollRatioY+this.contentRealY)}onDragEnd(){"move"!==this.mergedConfig.scrollType&&(this.dragScrolling=!1)}onMove(t){if(!this.canUse)return;this.onEnter();const{scrollType:e,stopDefault:i}=this.mergedConfig;if("drag"===e)return;const{viewportBounds:s,contentBounds:n,scrollXBar:o,scrollYBar:r}=this;if(o.visible||r.visible){const e=t.getInnerMove(this.target);let a;sc.getValidMove(n,s,"inner",e,!0),e.x&&o.visible&&(this.target.scrollX+=e.x,a=!0),e.y&&r.visible&&(this.target.scrollY+=e.y,a=!0),(a||i)&&t.stop(),i&&t.stopDefault()}}onMoveEnd(t){this.canUse&&(this.target.hit(t)||this.onLeave())}onEnter(){this.canUse&&(clearTimeout(this.hideTimer),this.killAnimate(),this.opacity=1)}onLeave(){this.canUse&&(clearTimeout(this.hideTimer),this.mergedConfig.hideOnActionEnd&&(this.hideTimer=setTimeout(()=>{this.set({opacity:0},ue.has("animate"))},600)))}onResize(){this.canUse&&this.update()}__listenEvents(){const{scrollXBar:t,scrollYBar:e,target:i}=this;this.__eventIds=[t.on_(hc.DRAG,this.onDrag,this),t.on_(hc.END,this.onDragEnd,this),e.on_(hc.DRAG,this.onDrag,this),e.on_(hc.END,this.onDragEnd,this),i.on_(oc.ENTER,this.onEnter,this),i.on_(oc.LEAVE,this.onLeave,this),i.on_(cc.BEFORE_MOVE,this.onMove,this),i.on_(cc.END,this.onMoveEnd,this),i.on_(qr.WORLD,this.onResize,this),i.on_(Hr.DESTROY,this.destroy,this)]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){if(!this.destroyed){this.__removeListenEvents();const{target:t}=this;t.scroller=t.topChildren=t.hasScroller=void 0,this.target=this.config=null,super.destroy()}}}dx.themeMap={};const cx=dx;ue.add("scroller");const ux=ed.prototype;ed.addAttr("scrollConfig",void 0,function(t){return _o(t,t=>({set(e){if(this.__setAttr(t,e)){this.__layout.scrollConfigChanged=!0,Bo(this)}}}))}),ux.__checkScroll=function(t){t&&this.isOverflow?(this.scroller||(this.scroller=new dx(this),this.topChildren||(this.topChildren=[]),this.topChildren.push(this.scroller)),this.hasScroller=!0):this.hasScroller&&!this.scroller.dragScrolling&&(this.hasScroller=void 0,this.scroller.update())},dx.registerTheme("light",{style:{fill:"black"}}),dx.registerTheme("dark",{style:{fill:"white"}});const{stintSet:gx}=f;const{scale:px}=$,{copyAndSpread:_x}=jt,{getScaleFixedData:fx}=I;gr.updateScaleFixedWorld=function(t){const{__world:e,__:i}=t,{scaleX:s,scaleY:n}=fx(e,i.scaleFixed);1!==s&&(px(e,s,n),e.scaleX*=s,e.scaleY*=n)},gr.updateOuterBounds=function(t){const e=t.__layout,{localRenderBounds:i}=e,s=e.localOuterBounds||(e.localOuterBounds={}),{width:n,height:o}=i,r=e.outerScale-1;_x(s,i,[o*r,n*r]),t.parent&&t.parent.__layout.renderChange()},ue.add("scale-fixed"),Vl.addAttr("scaleFixed",void 0,function(t){return _o(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__layout;Bo(this),l(e)||(e=e?1:0),gx(t,"scaleFixed",e),gx(t,"outerScale",e?1/e:0),!t.outerScale&&t.localOuterBounds&&(t.localOuterBounds=void 0)}}}))});export{Rt as AlignHelper,xv as Animate,yv as AnimateEasing,wv as AnimateEvent,bv as AnimateList,e as Answer,Xd as App,Et as AroundHelper,cm as Arrow,lm as ArrowData,Jt as AutoBounds,di as BezierHelper,Kt as Bounds,qr as BoundsEvent,jt as BoundsHelper,ed as Box,bl as BoxData,Eh as Branch,Er as BranchHelper,Ha as BranchRender,Ld as Canvas,Ml as CanvasData,we as CanvasManager,Hr as ChildEvent,il as ColorConvert,ge as Creator,Mc as Cursor,f as DataHelper,oe as Debug,bt as Direction4,St as Direction9,sc as DragBoundsHelper,hc as DragEvent,kc as Dragger,dc as DropEvent,g_ as EditBox,o_ as EditDataHelper,d_ as EditPoint,Up as EditSelect,Np as EditSelectHelper,X_ as EditTool,B_ as EditToolCreator,z_ as Editor,Lp as EditorEvent,C_ as EditorGroupEvent,b_ as EditorHelper,D_ as EditorMoveEvent,F_ as EditorRotateEvent,M_ as EditorScaleEvent,I_ as EditorSkewEvent,hl as Effect,rd as Ellipse,Tl as EllipseData,vi as EllipseHelper,Nr as Event,ye as EventCreator,ca as Eventer,dl as Export,Zn as FileHelper,ll as Filter,qw as Finder,Sy as Flow,B as FourNumberHelper,id as Frame,kl as FrameData,jl as Group,xl as GroupData,hm as HTMLText,rm as HTMLTextData,tw as HighBezierHelper,lw as HighCurveHelper,Fc as HitCanvasManager,Od as Image,Dl as ImageData,Gr as ImageEvent,no as ImageManager,v as IncrementId,Y_ as InnerEditor,R_ as InnerEditorEvent,Dc as InteractionBase,yc as InteractionHelper,mc as KeyEvent,Hd as Keyboard,ia as LayoutEvent,Hh as Layouter,_h as Leaf,za as LeafBounds,xr as LeafBoundsHelper,y as LeafData,ka as LeafDataProxy,ba as LeafEventer,gr as LeafHelper,Xr as LeafLayout,Th as LeafLevelList,Bh as LeafList,Pa as LeafMatrix,Ya as LeafRender,ql as Leafer,Ch as LeaferCanvas,De as LeaferCanvasBase,Sl as LeaferData,na as LeaferEvent,lo as LeaferFilm,ho as LeaferImage,Lf as LeaferTypeCreator,co as LeaferVideo,Cd as Line,El as LineData,G_ as LineEditTool,I as MathHelper,yt as Matrix,$ as MatrixHelper,cc as MoveEvent,Mf as MultiTouchHelper,lc as MyDragEvent,Pd as MyImage,rc as MyPointerEvent,gc as MyTouchEvent,ze as NeedConvertToCanvasCommandMap,z as OneRadian,Y as PI2,X as PI_2,ol as Paint,al as PaintGradient,rl as PaintImage,zd as Path,nl as PathArrow,wy as PathArrowModule,Wn as PathBounds,Ts as PathCommandDataHelper,Ie as PathCommandMap,wi as PathCommandNodeHelper,ns as PathConvert,jn as PathCorner,Vs as PathCreator,Ol as PathData,rn as PathDrawer,Me as PathHelper,xm as PathMatrixHelper,t as PathNodeHandleType,He as PathNumberCommandLengthMap,Ne as PathNumberCommandMap,hf as PathScaler,Yd as Pen,Pl as PenData,Kh as Picker,ie as Platform,ue as Plugin,ft as Point,dt as PointHelper,Vd as PointerButton,oc as PointerEvent,pd as Polygon,Rl as PolygonData,jr as PropertyEvent,Kl as Rect,Bl as RectData,Ve as RectHelper,Nl as RectRender,sa as RenderEvent,jh as Renderer,ta as ResizeEvent,io as Resource,Xw as Robot,Yw as RobotData,pc as RotateEvent,le as Run,om as ScrollBar,dx as Scroller,Xp as SelectArea,Zh as Selector,xd as Star,Cl as StarData,cl as State,Qt as StringNumberMap,Yp as Stroker,_c as SwipeEvent,Qn as TaskItem,to as TaskProcessor,Wd as Text,el as TextConvert,Al as TextData,Tf as TextEditor,uc as TouchEvent,W_ as TransformTool,Uf as Transformer,ul as Transition,wt as TwoPointBoundsHelper,Vl as UI,Wl as UIBounds,_e as UICreator,vl as UIData,jd as UIEvent,Yl as UIRender,sl as UnitConvert,$t as UnitConvertHelper,Pr as WaitHelper,ea as WatchEvent,Lh as Watcher,Xf as WheelEventHelper,fc as ZoomEvent,Cf as addViewport,Of as addViewportConfig,Lo as affectRenderBoundsType,Co as affectStrokeBoundsType,dm as arrowType,fo as attr,xo as autoLayoutType,ko as boundsType,Kn as canvasPatch,Ae as canvasSizeAttrs,tl as createAttr,po as createDescriptor,Ho as cursorType,Vo as dataProcessor,yo as dataType,_o as decorateLeafAttr,Uo as defineDataProcessor,uo as defineKey,mo as defineLeafAttr,Do as dimType,Bo as doBoundsType,Oo as doStrokeType,Jh as effectType,n as emptyData,Xo as eraserType,Ur as extraPropertyEventMap,H as getBoundsData,go as getDescriptor,V as getMatrixData,N as getPointData,No as hitType,u as isArray,p as isData,_ as isEmptyData,h as isFinite,r as isNull,l as isNumber,g as isObject,a as isString,o as isUndefined,jo as layoutProcessor,la as leaferTransformAttrMap,Yo as maskType,dw as motionPathType,Eo as naturalBoundsType,Mo as opacityType,Un as path,To as pathInputType,Ro as pathType,Gn as pen,vo as positionType,k_ as registerEditTool,E_ as registerInnerEditor,tr as registerUI,er as registerUIEvent,$h as resizeType,Zo as rewrite,Jo as rewriteAble,So as rotationType,mf as scaleResize,yf as scaleResizeFontSize,xf as scaleResizeGroup,vf as scaleResizePath,wf as scaleResizePoints,bo as scaleType,wo as scrollType,zo as sortType,vw as stateStyleType,yw as stateType,Po as strokeType,Ao as surfaceType,Zt as tempBounds,vt as tempMatrix,mt as tempPoint,c as tryToNumber,Oh as useCanvas,Qo as useModule,Rh as version,Fo as visibleType,Qh as zoomLayerType};
2
2
  //# sourceMappingURL=worker.module.min.js.map