@leafer-ui/node 1.0.0-beta.11 → 1.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t={},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,i={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,r,i;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=r=t[0],s=i=t[1];break;case 3:e=t[0],s=i=t[1],r=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,r,i]}},o=Math.PI/180,n=2*Math.PI,a=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:p,PI:u}=Math,_={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:g,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r=s){y.toInnerPoint(t,e,_),y.scaleOfInner(t,_,s,r)},scaleOfInner(t,e,s,r=s){y.translateInner(t,e.x,e.y),y.scale(t,s,r),y.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=o),r=h(e),{a:i,b:n,c:a,d:d}=t;t.a=i*s-n*r,t.b=i*r+n*s,t.c=a*s-d*r,t.d=a*r+d*s},rotateOfOuter(t,e,s){y.toInnerPoint(t,e,_),y.rotateOfInner(t,_,s)},rotateOfInner(t,e,s){y.translateInner(t,e.x,e.y),y.rotate(t,s),y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:a}=t;s&&(s*=o,t.a=r+n*s,t.b=i+a*s),e&&(e*=o,t.c=n+r*e,t.d=a+i*e)},skewOfOuter(t,e,s,r){y.toInnerPoint(t,e,_),y.skewOfInner(t,_,s,r)},skewOfInner(t,e,s,r){y.translateInner(t,e.x,e.y),y.skew(t,s,r),y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+n,t.f=e.e*r+e.f*o+a},preMultiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+r*e.c,t.b=s*e.b+r*e.d,t.c=i*e.a+o*e.c,t.d=i*e.b+o*e.d),t.e=n*e.a+a*e.c+e.e,t.f=n*e.b+a*e.d+e.f},divide(t,e){y.multiply(t,y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=y;return y.copy(e,t),y.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=t,a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{x:i,y:o}=e,{a:n,b:a,c:h,d:l}=t,d=1/(n*l-a*h);if(s||(s=e),s.x=(i*l-o*h)*d,s.y=(o*n-i*a)*d,!r){const{e:e,f:r}=t;s.x-=(e*l-r*h)*d,s.y-=(r*n-e*a)*d}},decompose(t){const{a:e,b:s,c:r,d:i}=t;let n=e,a=i,h=0,l=0,_=0;if(s||r){const t=e*i-s*r,g=e*r+s*i;if(s){const r=e*e+s*s;n=p(r),a=t/n;const i=e/n;h=s>0?d(i):-d(i),l=c(g/r)/o}else{const e=r*r+i*i;a=p(e),n=t/a;const s=r/a;h=u/2-(i>0?d(-s):-d(s)),_=c(g/e)/o}h/=o}return{x:t.e,y:t.f,scaleX:n,scaleY:a,rotation:h,skewX:l,skewY:_}},reset(t){y.set(t)}},y=f,{toInnerPoint:x,toOuterPoint:v}=f,{sin:m,cos:w,abs:E,sqrt:b,atan2:B}=Math,C={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=k.defaultPoint);const r=w(e*o),i=m(e*o),n=t.x-s.x,a=t.y-s.y;t.x=s.x+n*r-a*i,t.y=s.y+n*i+a*r},tempToInnerOf(t,e){const{tempPoint:s}=k;return k.copy(s,t),x(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=k;return k.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=k;return k.copy(s,t),k.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),x(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){x(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=E(e.x-t.x),r=E(e.y-t.y);return b(s*s+r*r)},getAngle:(t,e)=>k.getAtan2(t,e)/o,getAtan2:(t,e)=>B(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const r=k.getAtan2(t,e);return{x:t.x+w(r)*s,y:t.y+m(r)*s}},reset(t){k.reset(t)}},k=C;class R{constructor(t,e){"object"==typeof t?C.copy(this,t):C.set(this,t,e)}set(t,e){C.set(this,t,e)}copy(t){return C.copy(this,t),this}clone(){return new R(this)}rotate(t,e){return C.rotate(this,t,e),this}toInnerOf(t,e){return C.toInnerOf(this,t,e),this}toOuterOf(t,e){return C.toOuterOf(this,t,e),this}getCenter(t){return C.getCenter(this,t)}getDistance(t){return C.getDistance(this,t)}getAngle(t){return C.getAngle(this,t)}getAtan2(t){return C.getAtan2(this,t)}reset(){C.reset(this)}}class T{constructor(t,e,s,r,i,o){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,r,i,o)}set(t,e,s,r,i,o){f.set(this,t,e,s,r,i,o)}copy(t){return f.copy(this,t),this}clone(){return new T(this)}translate(t,e){return f.translate(this,t,e),this}translateInner(t,e){return f.translateInner(this,t,e),this}scale(t,e){return f.scale(this,t,e),this}scaleOfOuter(t,e,s){return f.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return f.scaleOfInner(this,t,e,s),this}rotate(t){return f.rotate(this,t),this}rotateOfOuter(t,e){return f.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return f.rotateOfInner(this,t,e),this}skew(t,e){return f.skew(this,t,e),this}skewOfOuter(t,e,s){return f.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return f.skewOfInner(this,t,e,s),this}multiply(t){return f.multiply(this,t),this}preMultiply(t){return f.preMultiply(this,t),this}divide(t){return f.divide(this,t),this}invert(){return f.invert(this),this}toOuterPoint(t,e){f.toOuterPoint(this,t,e)}toInnerPoint(t,e){f.toInnerPoint(this,t,e)}decompose(){return f.decompose(this)}reset(){f.reset(this)}}const P={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,r,i){L(t,e,s),L(t,e+r,s+i)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},add(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:L}=P,{tempPointBounds:S,setPoint:O,addPoint:D,toBounds:I}=P,{toOuterPoint:A}=f;let M,W,U,N;const F={},H={},z={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){Y.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),Y.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(Y.right(s)-t.x),e.offsetY=-(Y.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Y.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(Y.copy(Y.tempBounds,t),Y.toOuterOf(Y.tempBounds,e),Y.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),Y.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else F.x=t.x,F.y=t.y,A(e,F,H),O(S,H.x,H.y),F.x=t.x+t.width,A(e,F,H),D(S,H.x,H.y),F.y=t.y+t.height,A(e,F,H),D(S,H.x,H.y),F.x=t.x,A(e,F,H),D(S,H.x,H.y),I(S,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new T(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return Y.copyAndSpread(s,t,e),s},spread(t,e){Y.copyAndSpread(t,t,e)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(t.height)},add(t,e){M=t.x+t.width,W=t.y+t.height,U=e.x+e.width,N=e.y+e.height,M=M>U?M:U,W=W>N?W:N,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=M-t.x,t.height=W-t.y},addList(t,e){Y.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){Y.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){Y.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||X(t,i)):j(t,i));o&&Y.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?O(S,t.x,t.y):D(S,t.x,t.y)})),I(S,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=C.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=C.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Y.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=Y.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){s&&(e=Y.tempToOuterOf(e,s));let{x:r,y:i,width:o,height:n}=e;return M=r+o,W=i+n,U=t.x+t.width,N=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,M=M<U?M:U,W=W<N?W:N,o=M-r,n=W-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){Y.copy(t,Y.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Y.set(t)}},Y=z,{add:j,copy:X}=Y;class V{constructor(t,e,s,r){"object"==typeof t?z.copy(this,t):z.set(this,t,e,s,r)}set(t,e,s,r){z.set(this,t,e,s,r)}copy(t){return z.copy(this,t),this}clone(){return new V(this)}scale(t){return z.scale(this,t),this}toOuterOf(t,e){return z.toOuterOf(this,t,e),this}getFitMatrix(t){return z.getFitMatrix(this,t)}spread(t){return z.spread(this,t),this}ceil(){return z.ceil(this),this}add(t){return z.add(this,t),this}addList(t){return z.setByList(this,t,!0),this}setByList(t,e){return z.setByList(this,t,e),this}addListWithHandle(t,e){return z.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return z.setByListWithHandle(this,t,e,s),this}setByPoints(t){return z.setByPoints(this,t),this}hitPoint(t,e){return z.hitPoint(this,t,e)}hitRadiusPoint(t,e){return z.hitRadiusPoint(this,t,e)}hit(t,e){return z.hit(this,t,e)}includes(t,e){return z.includes(this,t,e)}intersect(t,e){return z.intersect(this,t,e),this}getIntersect(t,e){return new V(z.getIntersectData(this,t,e))}isSame(t){return z.isSame(this,t)}isEmpty(){return z.isEmpty(this)}reset(){z.reset(this)}}class G{constructor(t,e,s,r,i,o){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,o)}set(t=0,e=0,s=0,r=0,i=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=o}copy(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new V(i,e,o||t.width-i-s,n||t.height-e-r)}}class q{constructor(t,e){P.setPoint(this,t,e)}addPoint(t,e){P.addPoint(this,t,e)}addBounds(t,e,s,r){P.addBounds(this,t,e,s,r)}add(t){P.add(this,t)}}const K={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};class Z{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Z(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(Q.enable){if(Q.filterList.length&&Q.filterList.every((t=>t!==this.name)))return;if(Q.excludeList.length&&Q.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(console.warn(this.name,"repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}Z.filterList=[],Z.excludeList=[];const Q=Z,$=Z.get("RunTime");class J{static start(t,e){const r=s.create(s.RUNTIME);return tt.currentId=tt.idMap[r]=e?performance.now():Date.now(),tt.currentName=tt.nameMap[r]=t,tt.nameToIdMap[t]=r,r}static end(t,e){const s=tt.idMap[t],r=tt.nameMap[t];tt.idMap[t]=tt.nameMap[t]=tt.nameToIdMap[r]=void 0,e?$.log(r,performance.now()-s,"µs"):$.log(r,Date.now()-s,"ms")}static endOfName(t,e){const s=tt.nameToIdMap[t];void 0!==s&&tt.end(s,e)}}J.idMap={},J.nameMap={},J.nameToIdMap={};const tt=J,et=Z.get("UICreator"),st={list:{},register(t){const{__tag:e}=t.prototype;rt[e]?et.repeat(e):rt[e]=t},get(t,e,s,r,i,o){const n=new rt[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:rt}=st,it=Z.get("EventCreator"),ot={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(nt[e]?it.repeat(e):nt[e]=t)}))},changeName(t,e){const s=nt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,nt[e]=s)}},get:(t,...e)=>new nt[t](...e)},{nameList:nt}=ot;class at{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.canvas(t);return this.add(i),i}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class ht{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ht;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class lt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class dt extends at{constructor(){super(...arguments),this.pathTypeList=new ht,this.imageTypeList=new ht}get(t){}getImageType(t,s){return this.imageTypeList.push(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.push(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}const ct={default:(t,e)=>(pt(e,t),pt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?pt(t[r],e[r]):t[r]=e[r]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:pt}=ct;class ut{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];return void 0===e?this[t]:e}return this[t]}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];return void 0===e?this["_"+t]:e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={},{__input:e}=this;let s,r;for(let i in this)s=i.substring(1),void 0!==this[s]&&(r=e?e[s]:void 0,t[s]=void 0===r?this[i]:r);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__leaf=null}}const _t={mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]}};function gt(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function ft(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((r=r.apply(t,e||[])).next())}))}function yt(t){return(e,s)=>{t||(t=s);const r={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,r)}}const xt=[];function vt(){return(t,e)=>{xt.push(e)}}const mt=[];class wt{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||mt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,n,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}gt([yt("imageSmoothingEnabled")],wt.prototype,"smooth",void 0),gt([yt("imageSmoothingQuality")],wt.prototype,"smoothLevel",void 0),gt([yt("globalAlpha")],wt.prototype,"opacity",void 0),gt([yt()],wt.prototype,"fillStyle",void 0),gt([yt()],wt.prototype,"strokeStyle",void 0),gt([yt("lineWidth")],wt.prototype,"strokeWidth",void 0),gt([yt("lineCap")],wt.prototype,"strokeCap",void 0),gt([yt("lineJoin")],wt.prototype,"strokeJoin",void 0),gt([yt("lineDashOffset")],wt.prototype,"dashOffset",void 0),gt([yt()],wt.prototype,"miterLimit",void 0),gt([yt()],wt.prototype,"shadowBlur",void 0),gt([yt()],wt.prototype,"shadowColor",void 0),gt([yt()],wt.prototype,"shadowOffsetX",void 0),gt([yt()],wt.prototype,"shadowOffsetY",void 0),gt([yt()],wt.prototype,"filter",void 0),gt([yt()],wt.prototype,"font",void 0),gt([yt()],wt.prototype,"fontKerning",void 0),gt([yt()],wt.prototype,"fontStretch",void 0),gt([yt()],wt.prototype,"fontVariantCaps",void 0),gt([yt()],wt.prototype,"textAlign",void 0),gt([yt()],wt.prototype,"textBaseline",void 0),gt([yt()],wt.prototype,"textRendering",void 0),gt([yt()],wt.prototype,"wordSpacing",void 0),gt([yt()],wt.prototype,"letterSpacing",void 0),gt([yt()],wt.prototype,"direction",void 0),gt([vt()],wt.prototype,"setTransform",null),gt([vt()],wt.prototype,"resetTransform",null),gt([vt()],wt.prototype,"getTransform",null),gt([vt()],wt.prototype,"save",null),gt([vt()],wt.prototype,"restore",null),gt([vt()],wt.prototype,"translate",null),gt([vt()],wt.prototype,"scale",null),gt([vt()],wt.prototype,"rotate",null),gt([vt()],wt.prototype,"fill",null),gt([vt()],wt.prototype,"stroke",null),gt([vt()],wt.prototype,"clip",null),gt([vt()],wt.prototype,"fillRect",null),gt([vt()],wt.prototype,"strokeRect",null),gt([vt()],wt.prototype,"clearRect",null),gt([vt()],wt.prototype,"beginPath",null),gt([vt()],wt.prototype,"moveTo",null),gt([vt()],wt.prototype,"lineTo",null),gt([vt()],wt.prototype,"bezierCurveTo",null),gt([vt()],wt.prototype,"quadraticCurveTo",null),gt([vt()],wt.prototype,"closePath",null),gt([vt()],wt.prototype,"arc",null),gt([vt()],wt.prototype,"arcTo",null),gt([vt()],wt.prototype,"ellipse",null),gt([vt()],wt.prototype,"rect",null),gt([vt()],wt.prototype,"roundRect",null),gt([vt()],wt.prototype,"createConicGradient",null),gt([vt()],wt.prototype,"createLinearGradient",null),gt([vt()],wt.prototype,"createPattern",null),gt([vt()],wt.prototype,"createRadialGradient",null),gt([vt()],wt.prototype,"fillText",null),gt([vt()],wt.prototype,"measureText",null),gt([vt()],wt.prototype,"strokeText",null);const Et=new V,bt={width:1,height:1,pixelRatio:1},Bt=Z.get("LeaferCanvasBase"),Ct=["width","height","pixelRatio"];class kt extends wt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(e,r){super(),this.worldTransform={},e||(e=bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.pixelRatio=n,this.offscreen=t.isWorker||e.offscreen,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((r=>{const i=this.getSaveCanvas(e);t.origin.canvasToBolb(i.view,e,s).then((t=>{i.recycle(),r(t)})).catch((t=>{Bt.error(t),r(null)}))}))}toDataURL(e,s){const r=this.getSaveCanvas(e),i=t.origin.canvasToDataURL(r.view,e,s);return r.recycle(),i}saveAs(e,s){return new Promise((r=>{const i=this.getSaveCanvas(_t.fileType(e));t.origin.canvasSaveAs(i.view,e,s).then((()=>{i.recycle(),r(!0)})).catch((t=>{Bt.error(t),r(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,r=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&r.fillWorld(s,"#FFFFFF"),e&&r.fillWorld(s,e),r.copyWorld(this),r}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),ct.copyAttrs(this,t,Ct),this.bounds=new V(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:r}=this,i=this.worldTransform;if(e)if(s)this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=(t.e+e.e)*r,i.f=(t.f+e.f)*r);else{const{a:s,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(i.a=(t.a*s+t.b*n)*r,i.b=(t.a*o+t.b*a)*r,i.c=(t.c*s+t.d*n)*r,i.d=(t.c*o+t.d*a)*r,i.e=(t.e*s+t.f*n+h)*r,i.f=(t.e*o+t.f*a+l)*r)}else this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=t.e*r,i.f=t.f*r)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,z.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,Et.copy(t).scale(this.pixelRatio),this.fillRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Et.copy(t).scale(this.pixelRatio),this.strokeRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Et.copy(t).scale(this.pixelRatio),e&&Et.ceil(),this.clearRect(Et.x,Et.y,Et.width,Et.height)}clipWorld(t,e){this.beginPath(),Et.copy(t).scale(this.pixelRatio),e&&Et.ceil(),this.rect(Et.x,Et.y,Et.width,Et.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:r,pixelRatio:i}=this,o={width:s,height:r,pixelRatio:i},n=this.manager?this.manager.get(o):e.canvas(o);if(n.save(),t){const t=this.worldTransform;n.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return n}getBiggerCanvas(t,s){let{width:r,height:i,pixelRatio:o}=this;t&&(r+=t),s&&(i+=s);const n={width:r,height:i,pixelRatio:o},a=this.manager?this.manager.get(n):e.canvas(n);return a.save(),a}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=null,this.view=null,this.parentView=null,this.context=null,this.config=null}}const Rt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Tt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Pt=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},Tt),Lt={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},St={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},Ot=Object.assign(Object.assign({},St),Tt),Dt=Pt,It={};for(let t in Dt)It[Dt[t]]=t;const At={};for(let t in Dt)At[Dt[t]]=Lt[t];const Mt={drawRoundRect(t,e,s,r,o,n){let[a,h,l,d]=i.fourNumber(n);const c=Math.min(r/2,o/2);a>c&&(a=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),a?t.moveTo(e+a,s):t.moveTo(e,s),h?t.arcTo(e+r,s,e+r,s+o,h):t.lineTo(e+r,s),l?t.arcTo(e+r,s+o,e,s+o,l):t.lineTo(e+r,s+o),d?t.arcTo(e,s+o,e,s,d):t.lineTo(e,s+o),a?t.arcTo(e,s,e+r,s,a):t.lineTo(e,s)}},{sin:Wt,cos:Ut,atan2:Nt,ceil:Ft,abs:Ht,PI:zt}=Math,{setPoint:Yt,addPoint:jt}=P,{set:Xt}=C,Vt={},Gt={rect(t,e,s,r,i){Rt.creator.path=t,Rt.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,o){Rt.creator.path=[],Mt.drawRoundRect(Rt.creator,e,s,r,i,o),t.push(...Rt.convertToCanvasData(Rt.creator.path,!0))},arcTo(t,e,s,r,i,h,l,d,c,p,u){const _=r-e,g=i-s,f=h-r,y=l-i;let x=Nt(g,_),v=Nt(y,f),m=v-x;if(m<0&&(m+=n),m===zt||Ht(_+g)<1e-12||Ht(f+y)<1e-12)return t&&t.push(Pt.L,r,i),c&&(Yt(c,e,s),jt(c,r,i)),u&&Xt(u,e,s),void(p&&Xt(p,r,i));const w=_*y-f*g<0,E=w?-1:1,b=d/Ut(m/2),B=r+b*Ut(x+m/2+a*E),C=i+b*Wt(x+m/2+a*E);return x-=a*E,v-=a*E,Zt(t,B,C,d,d,0,x/o,v/o,w,c,p,u)},arc:(t,e,s,r,i,o,n,a,h,l)=>Zt(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,h,l,d,c,p,u,_){const g=h*o,f=Wt(g),y=Ut(g);let x=l*o,v=d*o;x>zt&&(x-=n),v<0&&(v+=n);let m=v-x;m<0?m+=n:m>n&&(m-=n),c&&(m-=n);const w=Ft(Ht(m/a)),E=m/w,b=Wt(E/4),B=8/3*b*b/Wt(E/2);v=x+E;let C,k,R,T,P,L,S,O,D=Ut(x),I=Wt(x),A=R=y*r*D-f*i*I,M=T=f*r*D+y*i*I,W=e+R,U=s+T;t&&t.push(Pt.L,W,U),p&&Yt(p,W,U),_&&Xt(_,W,U);for(let o=0;o<w;o++)C=Ut(v),k=Wt(v),R=y*r*C-f*i*k,T=f*r*C+y*i*k,P=e+A-B*(y*r*I+f*i*D),L=s+M-B*(f*r*I-y*i*D),S=e+R+B*(y*r*k+f*i*C),O=s+T+B*(f*r*k-y*i*C),t&&t.push(Pt.C,P,L,S,O,e+R,s+T),p&&Kt(e+A,s+M,P,L,S,O,e+R,s+T,p,!0),A=R,M=T,D=C,I=k,x=v,v+=E;u&&Xt(u,e+R,s+T)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(Pt.C,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){Kt(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let c,p,u,_,g,f,y,x,v=t,m=s,w=i,E=n;for(let t=0;t<2;++t)if(1==t&&(v=e,m=r,w=o,E=a),c=-3*v+9*m-9*w+3*E,p=6*v-12*m+6*w,u=3*m-3*v,Math.abs(c)<1e-12){if(Math.abs(p)<1e-12)continue;_=-u/p,0<_&&_<1&&d.push(_)}else y=p*p-4*u*c,x=Math.sqrt(y),y<0||(g=(-p+x)/(2*c),0<g&&g<1&&d.push(g),f=(-p-x)/(2*c),0<f&&f<1&&d.push(f));l?jt(h,t,e):Yt(h,t,e),jt(h,n,a);for(let l=0,c=d.length;l<c;l++)qt(d[l],t,e,s,r,i,o,n,a,Vt),jt(h,Vt.x,Vt.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,c=d*d*d,p=3*d*d*t,u=3*d*t*t,_=t*t*t;l.x=c*e+p*r+u*o+_*a,l.y=c*s+p*i+u*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return qt(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:qt,toTwoPointBounds:Kt,ellipse:Zt}=Gt,{sin:Qt,cos:$t,sqrt:Jt,atan2:te}=Math,{ellipse:ee}=Gt,se={ellipticalArc(t,e,s,r,i,a,h,l,d,c,p){const u=(d-e)/2,_=(c-s)/2,g=a*o,f=Qt(g),y=$t(g),x=-y*u-f*_,v=-y*_+f*u,m=r*r,w=i*i,E=v*v,b=x*x,B=m*w-m*E-w*b;let C=0;if(B<0){const t=Jt(1-B/(m*w));r*=t,i*=t}else C=(h===l?-1:1)*Jt(B/(m*E+w*b));const k=C*r*v/i,R=-C*i*x/r,T=te((v-R)/i,(x-k)/r),P=te((-v-R)/i,(-x-k)/r);let L=P-T;0===l&&L>0?L-=n:1===l&&L<0&&(L+=n);const S=e+u+y*k-f*R,O=s+_+f*k+y*R,D=L<0?1:0;p?ee(t,S,O,r,i,a,T/o,P/o,D):r!==i||a?t.push(Pt.G,S,O,r,i,a,T/o,P/o,D):t.push(Pt.O,S,O,r,T/o,P/o,D)}},{M:re,m:ie,L:oe,l:ne,H:ae,h:he,V:le,v:de,C:ce,c:pe,S:ue,s:_e,Q:ge,q:fe,T:ye,t:xe,A:ve,a:me,Z:we,z:Ee,N:be,D:Be,X:Ce,G:ke,F:Re,O:Te,P:Pe,U:Le}=Pt,{rect:Se,roundRect:Oe,arcTo:De,arc:Ie,ellipse:Ae,quadraticCurveTo:Me}=Gt,{ellipticalArc:We}=se,Ue=Z.get("PathConvert"),Ne={},Fe={current:{dot:0},stringify(t){let e,s,r,i=0,o=t.length,n="";for(;i<o;){s=t[i],e=At[s],n+=s===r?" ":It[s];for(let s=1;s<e;s++)n+=t[i+s],s===e-1||(n+=" ");r=s,i+=e}return n},parse(t,e){let s,r,i,o="";const n=[],a=e?Ot:St;for(let e=0,h=t.length;e<h;e++)r=t[e],K[r]?("."===r&&(He.dot++,He.dot>1&&(ze(n,o),o="")),o+=r):Pt[r]?(o&&(ze(n,o),o=""),He.name=Pt[r],He.length=Lt[r],He.index=0,ze(n,He.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&ze(n,o),o=r):o&&(ze(n,o),o=""),i=r;return o&&ze(n,o),s?Fe.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,c=0,p=t.length;const u=[];for(;c<p;){switch(i=t[c],i){case ie:t[c+1]+=a,t[c+2]+=h;case re:a=t[c+1],h=t[c+2],u.push(re,a,h),c+=3;break;case he:t[c+1]+=a;case ae:a=t[c+1],u.push(oe,a,h),c+=2;break;case de:t[c+1]+=h;case le:h=t[c+1],u.push(oe,a,h),c+=2;break;case ne:t[c+1]+=a,t[c+2]+=h;case oe:a=t[c+1],h=t[c+2],u.push(oe,a,h),c+=3;break;case _e:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=ue;case ue:n=o===ce||o===ue,l=n?2*a-s:t[c+1],d=n?2*h-r:t[c+2],s=t[c+1],r=t[c+2],a=t[c+3],h=t[c+4],u.push(ce,l,d,s,r,a,h),c+=5;break;case pe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,i=ce;case ce:s=t[c+3],r=t[c+4],a=t[c+5],h=t[c+6],u.push(ce,t[c+1],t[c+2],s,r,a,h),c+=7;break;case xe:t[c+1]+=a,t[c+2]+=h,i=ye;case ye:n=o===ge||o===ye,s=n?2*a-s:t[c+1],r=n?2*h-r:t[c+2],e?Me(u,a,h,s,r,t[c+1],t[c+2]):u.push(ge,s,r,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case fe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=ge;case ge:s=t[c+1],r=t[c+2],e?Me(u,a,h,s,r,t[c+3],t[c+4]):u.push(ge,s,r,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case me:t[c+6]+=a,t[c+7]+=h;case ve:We(u,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 Ee:case we:u.push(we),c++;break;case be:a=t[c+1],h=t[c+2],e?Se(u,a,h,t[c+3],t[c+4]):Ye(u,t,c,5),c+=5;break;case Be:a=t[c+1],h=t[c+2],e?Oe(u,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ye(u,t,c,9),c+=9;break;case Ce:a=t[c+1],h=t[c+2],e?Oe(u,a,h,t[c+3],t[c+4],t[c+5]):Ye(u,t,c,6),c+=6;break;case ke:Ae(e?u:Ye(u,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,Ne),a=Ne.x,h=Ne.y,c+=9;break;case Re:e?Ae(u,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ye(u,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Te:Ie(e?u:Ye(u,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ne),a=Ne.x,h=Ne.y,c+=7;break;case Pe:e?Ie(u,t[c+1],t[c+2],t[c+3],0,360,!1):Ye(u,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Le:De(e?u:Ye(u,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ne),a=Ne.x,h=Ne.y,c+=6;break;default:return Ue.error(`command: ${i} [index:${c}]`,t),u}o=i}return u},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){He.index===He.length&&(He.index=1,t.push(He.name)),t.push(Number(e)),He.index++,He.dot=0}},{current:He,pushData:ze,copyData:Ye}=Fe,{M:je,L:Xe,C:Ve,Q:Ge,Z:qe,N:Ke,D:Ze,X:Qe,G:$e,F:Je,O:ts,P:es,U:ss}=Pt,rs={},is={beginPath(t){t.length=0},moveTo(t,e,s){t.push(je,e,s)},lineTo(t,e,s){t.push(Xe,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(Ve,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(Ge,e,s,r,i)},closePath(t){t.push(qe)},rect(t,e,s,r,i){t.push(Ke,e,s,r,i)},roundRect(t,e,s,r,o,n){if("number"==typeof n)t.push(Qe,e,s,r,o,n);else{const a=i.fourNumber(n);a?t.push(Ze,e,s,r,o,...a):t.push(Ke,e,s,r,o)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Je,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push($e,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(es,e,s,r):(void 0===o&&(o=360),t.push(ts,e,s,r,i,o,n?1:0))},moveToEllipse(t,e,s,r,i,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),Gt.ellipse(null,e,s,r,i,o,n,a,h,null,null,rs),t.push(je,rs.x,rs.y),os(t,e,s,r,i,o,n,a,h)},moveToArc(t,e,s,r,i,o,n){void 0===i&&(i=0),void 0===o&&(o=360),Gt.arc(null,e,s,r,i,o,n,null,null,rs),t.push(je,rs.x,rs.y),ns(t,e,s,r,i,o,n)},arcTo(t,e,s,r,i,o){t.push(ss,e,s,r,i,o)}},{ellipse:os,arc:ns}=is,{moveTo:as,lineTo:hs,quadraticCurveTo:ls,bezierCurveTo:ds,closePath:cs,beginPath:ps,rect:us,roundRect:_s,ellipse:gs,arc:fs,arcTo:ys,moveToEllipse:xs,moveToArc:vs}=is;class ms{constructor(t){this.path=t?"string"==typeof t?Rt.parse(t):t:[]}beginPath(){return ps(this.path),this}moveTo(t,e){return as(this.path,t,e),this}lineTo(t,e){return hs(this.path,t,e),this}bezierCurveTo(t,e,s,r,i,o){return ds(this.path,t,e,s,r,i,o),this}quadraticCurveTo(t,e,s,r){return ls(this.path,t,e,s,r),this}closePath(){return cs(this.path),this}rect(t,e,s,r){return us(this.path,t,e,s,r),this}roundRect(t,e,s,r,i){return _s(this.path,t,e,s,r,i),this}ellipse(t,e,s,r,i,o,n,a){return gs(this.path,t,e,s,r,i,o,n,a),this}arc(t,e,s,r,i,o){return fs(this.path,t,e,s,r,i,o),this}arcTo(t,e,s,r,i){return ys(this.path,t,e,s,r,i),this}moveToEllipse(t,e,s,r,i,o,n,a){return xs(this.path,t,e,s,r,i,o,n,a),this}moveToArc(t,e,s,r,i,o){return vs(this.path,t,e,s,r,i,o),this}}const{M:ws,L:Es,C:bs,Q:Bs,Z:Cs,N:ks,D:Rs,X:Ts,G:Ps,F:Ls,O:Ss,P:Os,U:Ds}=Pt,Is=Z.get("PathDrawer"),As={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case ws:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Es:t.lineTo(e[r+1],e[r+2]),r+=3;break;case bs:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case Bs:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Cs:t.closePath(),r+=1;break;case ks:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Rs:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case Ts:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case Ps:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*o,e[r+6]*o,e[r+7]*o,e[r+8]),r+=9;break;case Ls:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,n,!1),r+=5;break;case Ss:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*o,e[r+5]*o,e[r+6]),r+=7;break;case Os:t.arc(e[r+1],e[r+2],e[r+3],0,n,!1),r+=4;break;case Ds:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void Is.error(`command: ${s} [index:${r}]`,e)}}},{M:Ms,L:Ws,C:Us,Q:Ns,Z:Fs,N:Hs,D:zs,X:Ys,G:js,F:Xs,O:Vs,P:Gs,U:qs}=Pt,{toTwoPointBounds:Ks,toTwoPointBoundsByQuadraticCurve:Zs,arcTo:Qs,arc:$s,ellipse:Js}=Gt,{add:tr,copy:er,addPoint:sr,setPoint:rr,addBounds:ir,toBounds:or}=P,nr=Z.get("PathBounds");let ar,hr,lr;const dr={},cr={},pr={},ur={toBounds(t,e){ur.toTwoPointBounds(t,cr),or(cr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return rr(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Fs||s===Us||s===Ns?rr(e,h,l):rr(e,t[a+1],t[a+2])),s){case Ms:case Ws:h=t[a+1],l=t[a+2],sr(e,h,l),a+=3;break;case Us:o=t[a+5],n=t[a+6],Ks(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,dr),tr(e,dr),h=o,l=n,a+=7;break;case Ns:r=t[a+1],i=t[a+2],o=t[a+3],n=t[a+4],Zs(h,l,r,i,o,n,dr),tr(e,dr),h=o,l=n,a+=5;break;case Fs:a+=1;break;case Hs:h=t[a+1],l=t[a+2],ir(e,h,l,t[a+3],t[a+4]),a+=5;break;case zs:case Ys:h=t[a+1],l=t[a+2],ir(e,h,l,t[a+3],t[a+4]),a+=s===zs?9:6;break;case js:Js(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],dr,pr),0===a?er(e,dr):tr(e,dr),h=pr.x,l=pr.y,a+=9;break;case Xs:h=t[a+1],l=t[a+2],hr=t[a+3],lr=t[a+4],ir(e,h-hr,l-lr,2*hr,2*lr),h+=hr,a+=5;break;case Vs:$s(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],dr,pr),0===a?er(e,dr):tr(e,dr),h=pr.x,l=pr.y,a+=7;break;case Gs:h=t[a+1],l=t[a+2],ar=t[a+3],ir(e,h-ar,l-ar,2*ar,2*ar),h+=ar,a+=4;break;case qs:Qs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],dr,pr),0===a?er(e,dr):tr(e,dr),h=pr.x,l=pr.y,a+=6;break;default:return void nr.error(`command: ${s} [index:${a}]`,t)}}},_r={smooth:(t,e,s)=>t};Rt.creator=new ms,Rt.parse=Fe.parse,Rt.convertToCanvasData=Fe.toCanvasData;const{drawRoundRect:gr}=Mt;function fr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){gr(this,t,e,s,r,i)})}(t)}function yr(t,e,s){Object.defineProperty(t,e,s)}function xr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function vr(t){return(e,s)=>{yr(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function mr(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};yr(t,e,Object.assign(i,r||{})),Nr(t,e,s)}function wr(t){return(e,s)=>{mr(e,s,t)}}function Er(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function br(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Br(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function Cr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const kr=Cr;function Rr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Tr=Rr;function Pr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Lr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Sr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Or(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function Dr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function Ir(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Ar(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),Z.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Mr(t){return(e,s)=>{yr(e,"__DataProcessor",{get:()=>t})}}function Wr(t){return(e,s)=>{yr(e,"__LayoutProcessor",{get:()=>t})}}function Ur(t,e,s){Nr(t.prototype,e,s)}function Nr(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[i]}:"width"===e?n.get=function(){const t=this[i];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[i];return void 0===t?this.__naturalHeight||s:t});const a=xr(r,e);a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),Object.defineProperty(r,e,n)}const Fr=new Z("rewrite"),Hr=[],zr=["destroy","constructor"];function Yr(t){return(e,s)=>{Hr.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function jr(){return t=>{Xr()}}function Xr(t){Hr.length&&(Hr.forEach((e=>{t&&Fr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Hr.length=0)}function Vr(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(zr.includes(r)||e&&e.includes(r)))if(t.prototype){xr(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function Gr(){return t=>{st.register(t)}}function qr(){return t=>{ot.register(t)}}setTimeout((()=>Xr(!0)));const{toOuterOf:Kr}=z;class Zr{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange(),this.positionChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),Kr(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Kr(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Kr(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:r},this.localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:r},this.localRenderBounds={x:t,y:e,width:s,height:r}}boxChange(){this.boxChanged=!0,this.localBoxChanged||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}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){this.leaf=null}}const Qr={},$r={on(t,e,s){let r,i,o;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=Jr(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){let r,i,o;s&&(r="boolean"==typeof s?s:s.capture);const n=Jr(this,r);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))},on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,listener:e,options:r}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{this.off(t.type,t.listener,t.options)})),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){const r=Jr(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&(i=r[o],i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:r}=this;return void 0===e?!!(r&&r[t]||s&&s[t]):!!(e?r&&r[t]:s&&s[t])}};function Jr(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Qr)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Qr)}}class ti{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0}stopNow(){this.isStopNow=!0,this.isStop=!0}stop(){this.isStop=!0}}class ei extends ti{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}ei.ADD="child.add",ei.REMOVE="child.remove";class si extends ti{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}si.CHANGE="property.change";class ri extends ti{constructor(t,e){super(t),Object.assign(this,e)}}ri.LOAD="image.load",ri.LOADED="image.loaded",ri.ERROR="image.error";class ii extends ti{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){"object"==typeof t?(super(ii.RESIZE),Object.assign(this,t)):super(t),this.old=e}}ii.RESIZE="resize";class oi extends ti{constructor(t,e){super(t),e&&Object.assign(this,e)}}oi.START="transform.start",oi.CHANGE="transform.change",oi.END="transform.end",oi.BEFORE_START="transform.before_start",oi.BEFORE_CHANGE="transform.before_change",oi.BEFORE_END="transform.before_end";class ni extends ti{constructor(t,e){super(t),this.data=e}}ni.REQUEST="watch.request",ni.DATA="watch.data";class ai extends ti{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}ai.CHECK_UPDATE="layout.check_update",ai.REQUEST="layout.request",ai.START="layout.start",ai.BEFORE="layout.before",ai.LAYOUT="layout.layout",ai.AFTER="layout.after",ai.AGAIN="layout.again",ai.END="layout.end";class hi extends ti{}hi.FRAME="animate.frame";class li extends ti{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}li.REQUEST="render.request",li.START="render.start",li.BEFORE="render.before",li.RENDER="render",li.AFTER="render.after",li.AGAIN="render.again",li.END="render.end";class di extends ti{}di.START="leafer.start",di.BEFORE_READY="leafer.before_ready",di.READY="leafer.ready",di.AFTER_READY="leafer.after_ready",di.VIEW_READY="leafer.view_ready",di.STOP="leafer.stop",di.RESTART="leafer.restart",di.END="leafer.end";const ci={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=si,r=new si(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{sin:pi,cos:ui}=Math,_i=Object.assign(Object.assign({},f.defaultMatrix),{scaleX:1,scaleY:1}),gi={__updateWorldMatrix(){const t=this.parent?this.parent.__world:_i,e=this.__local,s=this.__world;this.__layout.matrixChanged&&this.__updateLocalMatrix(),this.__layout.affectScaleOrRotation?(s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX*this.__.scaleX,s.scaleY=t.scaleY*this.__.scaleY):(s.a=t.a,s.b=t.b,s.c=t.c,s.d=t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX,s.scaleY=t.scaleY)},__updateLocalMatrix(){const t=this.__local,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:r}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:i,skewX:n,skewY:a}=this.__;i||n||a?(i*=o,n&&(n*=o),a&&(a*=o),t.a=s*ui(i+a),t.b=s*pi(i+a),t.c=r*-pi(i-n),t.d=r*ui(i-n)):(t.a=s,t.b=0,t.c=0,t.d=r,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=r,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:fi,copyAndSpread:yi}=z,xi={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxChanged=!1,e=!0),s.localBoxChanged&&(this.__updateLocalBoxBounds(),s.localBoxChanged=!1,s.strokeSpread&&(s.strokeChanged=!0),s.renderSpread&&(s.renderChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxChange()),s.strokeChanged&&(s.strokeSpread=this.__updateStrokeSpread(),s.strokeSpread?(s.strokeBounds===s.boxBounds&&s.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.spreadStrokeCancel(),s.strokeChanged=!1,s.renderSpread&&(s.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),e||(e=!0)),s.renderChanged&&(s.renderSpread=this.__updateRenderSpread(),s.renderSpread?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.spreadRenderCancel(),s.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),s.boundsChanged=!1,fi(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else fi(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){fi(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){fi(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){fi(this.__layout.renderBounds,this.__local,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height},__updateStrokeBounds(){yi(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){yi(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:vi}=C,mi={},wi={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),vi(t,this.__world,mi),this.__hit(mi)},__drawHitPath(t){this.__drawRenderPath(t)}},Ei={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e);const r=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?(t.resetTransform(),t.copyWorld(s,null,null,r)):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,r),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},bi={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,r=e.length;s<r;s++)(t=e[s]).isMask&&(this.__removeMask(t),r--,s--)}}},Bi={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const r=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?t.copyWorld(s,null,null,r):t.copyWorld(s,this.__world,this.__world,r),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:r}=this;if(this.__hasMask&&r.length>1){let i,o=t.getSameCanvas(),n=t.getSameCanvas();for(let a=0,h=r.length;a<h;a++)s=r[a],s.isMask?(i?(this.__renderMask(t,n,o),o.clear(),n.clear()):i=!0,s.__render(o,e)):s.__render(n,e);this.__renderMask(t,n,o),o.recycle(),n.recycle()}else{const{bounds:i,hideBounds:o}=e;for(let n=0,a=r.length;n<a;n++)s=r[n],i&&!i.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}},{copy:Ci,translate:ki,toInnerPoint:Ri,scaleOfOuter:Ti,rotateOfOuter:Pi}=f,Li={},Si={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Di(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ii(e[t])}},updateAllChange(t){if(Ii(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ai(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){t.__layout.checkUpdate();const r={x:e,y:s};t.parent&&Ri(t.parent.__world,r,r,!0),Oi.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,r,i){t.__layout.checkUpdate();const o=t.parent?C.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,o,s,r,i)},zoomOfLocal(t,e,s,r=s,i){Ci(Li,t.__local),i&&ki(Li,i.x,i.y),Ti(Li,e,s,r),i||(i=t),i.x+=Li.e-t.__local.e,i.y+=Li.f-t.__local.f,t.scaleX*=s,t.scaleY*=r},rotateOfWorld(t,e,s,r){t.__layout.checkUpdate();const i=t.parent?C.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,i,s,r)},rotateOfLocal(t,e,s,r){Ci(Li,t.__local),r&&ki(Li,r.x,r.y),Pi(Li,e,s),r||(r=t),r.x+=Li.e-t.__local.e,r.y+=Li.f-t.__local.f,t.rotation+=s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},Oi=Si,{updateAllWorldMatrix:Di,updateAllWorldOpacity:Ii,updateAllChange:Ai}=Oi,Mi={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local,localEventBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__local:null,maskLocalEventBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},Wi={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.push(t),Ui(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.push(t.parent),t=t.parent;else for(;t.parent;)e.push(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)Ni(e[t],e)},updateWorldBoundsByBranchStack(t){let e;for(let s=t.length-1;s>-1;s--){e=t[s];for(let t=0,s=e.children.length;t<s;t++)e.children[t].__updateWorldBounds()}e.__updateWorldBounds()}},{pushAllChildBranch:Ui,pushAllBranchStack:Ni}=Wi,Fi={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Hi,create:zi}=s,{toInnerPoint:Yi,toOuterPoint:ji}=f,{tempToOuterOf:Xi,copy:Vi}=C,{moveLocal:Gi,zoomOfLocal:qi,rotateOfLocal:Ki}=Si;exports.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return ut}get __LayoutProcessor(){return Zr}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.checkUpdate(),this.__worldOpacity}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}constructor(t){this.innerId=zi(Hi),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},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},this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&Fi.run(this.__leaferWait),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){void 0===t?t="x":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?Yi(this.parent.worldTransform,t,e,s):e&&Vi(e,t)}localToWorld(t,e,s){this.parent?ji(this.parent.worldTransform,t,e,s):e&&Vi(e,t)}worldToInner(t,e,s){Yi(this.worldTransform,t,e,s)}innerToWorld(t,e,s){ji(this.worldTransform,t,e,s)}move(t,e){Gi(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),qi(this,Xi(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),Ki(this,Xi(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.__&&(this.children&&this.children.length&&this.removeAll(!0),this.parent&&this.remove(),this.__hitCanvas&&this.__hitCanvas.destroy(),this.__.destroy(),this.__layout.destroy(),this.leafer=this.parent=this.__hitCanvas=this.__=this.__layout=this.__captureMap=this.__bubbleMap=null)}},exports.Leaf=gt([Vr(ci),Vr(gi),Vr(xi),Vr(wi),Vr($r),Vr(Ei)],exports.Leaf);const{setByListWithHandle:Zi}=z,{sort:Qi}=Wi,{localBoxBounds:$i,localEventBounds:Ji,localRenderBounds:to,maskLocalBoxBounds:eo,maskLocalEventBounds:so,maskLocalRenderBounds:ro}=Mi;exports.Branch=class extends exports.Leaf{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){Zi(this.__layout.boxBounds,this.children,this.__hasMask?eo:$i)}__updateStrokeBounds(){Zi(this.__layout.strokeBounds,this.children,this.__hasMask?so:Ji)}__updateRenderBounds(){Zi(this.__layout.renderBounds,this.children,this.__hasMask?ro:to)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Qi),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&Fi.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready&&this.__emitChildEvent(ei.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()}))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready&&this.__emitChildEvent(ei.REMOVE,t))}__emitChildEvent(t,e){const s=new ei(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=gt([Vr(Bi),Vr(bi)],exports.Branch);const io={};class oo{static isHoldSpaceKey(){return oo.hasDownCode("Space")}static setDownCode(t){io[t]||(io[t]=!0)}static setUpCode(t){io[t]=!1}static hasDownCode(t){return io[t]}}class no{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}const ao={};class ho extends ti{get spaceKey(){return oo.isHoldSpaceKey()}get left(){return no.left(this)}get right(){return no.right(this)}get middle(){return no.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.worldToInner(this,ao),Object.assign({},ao)}getLocal(t){return t||(t=this.current),t.worldToLocal(this,ao),Object.assign({},ao)}static changeName(t,e){ot.changeName(t,e)}}exports.PointerEvent=class extends ho{},exports.PointerEvent.POINTER="pointer",exports.PointerEvent.BEFORE_DOWN="pointer.before_down",exports.PointerEvent.BEFORE_MOVE="pointer.before_move",exports.PointerEvent.BEFORE_UP="pointer.before_up",exports.PointerEvent.DOWN="pointer.down",exports.PointerEvent.MOVE="pointer.move",exports.PointerEvent.UP="pointer.up",exports.PointerEvent.OVER="pointer.over",exports.PointerEvent.OUT="pointer.out",exports.PointerEvent.ENTER="pointer.enter",exports.PointerEvent.LEAVE="pointer.leave",exports.PointerEvent.TAP="tap",exports.PointerEvent.DOUBLE_TAP="double_tap",exports.PointerEvent.CLICK="click",exports.PointerEvent.DOUBLE_CLICK="double_click",exports.PointerEvent.LONG_PRESS="long_press",exports.PointerEvent.LONG_TAP="long_tap",exports.PointerEvent=gt([qr()],exports.PointerEvent);const lo={},co={};var po;exports.DragEvent=class extends exports.PointerEvent{getInnerMove(t){return t||(t=this.current),lo.x=this.moveX,lo.y=this.moveY,t.worldToInner(lo,co,!0),Object.assign({},co)}getLocalMove(t){return t||(t=this.current),lo.x=this.moveX,lo.y=this.moveY,t.worldToLocal(lo,co,!0),Object.assign({},co)}},exports.DragEvent.DRAG="drag",exports.DragEvent.START="drag.start",exports.DragEvent.END="drag.end",exports.DragEvent.OVER="drag.over",exports.DragEvent.OUT="drag.out",exports.DragEvent.ENTER="drag.enter",exports.DragEvent.LEAVE="drag.leave",exports.DragEvent=gt([qr()],exports.DragEvent),exports.DropEvent=po=class extends exports.PointerEvent{static setList(t){po.dragList=t instanceof ht?t:new ht(t)}static setData(t){this.dragData=t}},exports.DropEvent.DROP="drop",exports.DropEvent=po=gt([qr()],exports.DropEvent),exports.MoveEvent=class extends exports.DragEvent{},exports.MoveEvent.MOVE="move",exports.MoveEvent.START="move.start",exports.MoveEvent.END="move.end",exports.MoveEvent=gt([qr()],exports.MoveEvent),exports.RotateEvent=class extends ho{},exports.RotateEvent.ROTATE="rotate",exports.RotateEvent.START="rotate.start",exports.RotateEvent.END="rotate.end",exports.RotateEvent=gt([qr()],exports.RotateEvent),exports.SwipeEvent=class extends exports.DragEvent{},exports.SwipeEvent.SWIPE="swipe",exports.SwipeEvent.LEFT="swipe.left",exports.SwipeEvent.RIGHT="swipe.right",exports.SwipeEvent.UP="swipe.up",exports.SwipeEvent.DOWN="swipe.down",exports.SwipeEvent=gt([qr()],exports.SwipeEvent),exports.ZoomEvent=class extends ho{},exports.ZoomEvent.ZOOM="zoom",exports.ZoomEvent.START="zoom.start",exports.ZoomEvent.END="zoom.end",exports.ZoomEvent=gt([qr()],exports.ZoomEvent),exports.KeyEvent=class extends ho{},exports.KeyEvent.DOWN="key.down",exports.KeyEvent.PRESS="key.press",exports.KeyEvent.UP="key.up",exports.KeyEvent=gt([qr()],exports.KeyEvent);const uo=Z.get("TaskProcessor");class _o{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return ft(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){uo.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class go{get total(){return this.list.length}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,t&&ct.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new _o(t);return n.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(n.time=i),!1===r&&(n.parallel=!1),void 0===o?this.push(n,s):setTimeout((()=>this.push(n,s)),o),n}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=[]}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this.running)return;r<this.total&&(t=this.list[r],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.empty(),this.config={}}}const fo={map:{},recycledList:[],tasker:new go,patternTasker:new go,get isComplete(){return yo.tasker.isComplete&&yo.patternTasker.isComplete},get(t){let s=yo.map[t.url];return s||(s=e.image(t),yo.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||yo.recycledList.push(t)}))},clearRecycled(){const t=yo.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete yo.map[t.url],t.destroy())})),t.length=0)},destroy(){yo.map={},yo.tasker=null}},yo=fo,{IMAGE:xo,create:vo}=s;class mo{get url(){return this.config&&this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=vo(xo),this.config=t;const{url:e}=t;e.startsWith("data:")?e.startsWith("data:image/svg")&&(this.isSVG=!0):e.includes(".svg")&&(this.isSVG=!0)}load(e,s){return this.loading||(this.loading=!0,fo.tasker.add((()=>ft(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.config.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t){const e=this.waitComplete,s=e[t+1];s&&s({type:"stop"}),e[t]=e[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,r,i){e||(e=this.width),s||(s=this.height);const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),o}destroy(){this.view=null,this.config=null,this.waitComplete.length=0}}const wo=Z.get("plugin"),Eo={power:{},list:[],onLeafer(t){Eo.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};function bo(t,e){const s={},{power:r,list:i}=Eo;if(i.includes(t))wo.warn("repeat run",t.name);else{i.push(t),t.import?t.import.forEach((t=>{r[t]?s[t]=r[t]:wo.error(t+" non-existent")})):wo.warn("no import");try{t.run(s,e)}catch(t){wo.error(t)}}}class Bo{get updatedList(){if(this.hasRemoved){const t=new ht;return this.__updatedList.list.forEach((e=>{e.leafer&&t.push(e)})),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ht,this.target=t,e&&(this.config=ct.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(li.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===ei.ADD?this.__pushChild(t.child):(this.hasRemoved||(this.hasRemoved=!0),this.__updatedList.push(t.parent)),this.update()}__pushChild(t){this.__updatedList.push(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new ni(ni.DATA,{updatedList:this.updatedList})),this.__updatedList=new ht,this.totalTimes++,this.changed=!1,this.hasRemoved=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(si.CHANGE,this.__onAttrChange,this),t.on_([ei.ADD,ei.REMOVE],this.__onChildEvent,this),t.on_(ni.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllWorldMatrix:Co,updateAllWorldOpacity:ko}=Si,{pushAllChildBranch:Ro,pushAllParent:To}=Wi;const{worldBounds:Po}=Mi,{setByListWithHandle:Lo}=z;class So{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ht(t)),this.updatedList=t}setBefore(){Lo(this.beforeBounds,this.updatedList.list,Po)}setAfter(){Lo(this.afterBounds,this.updatedList.list,Po),this.updatedBounds.setByList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:Oo,updateAllChange:Do}=Si,{pushAllBranchStack:Io,updateWorldBoundsByBranchStack:Ao}=Wi,Mo=Z.get("Layouter");class Wo{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new lt,this.target=t,e&&(this.config=ct.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.running)return;const{target:t}=this;this.times=0;try{t.emit(ai.START),this.layoutOnce(),t.emitEvent(new ai(ai.END,this.layoutedBlocks,this.times))}catch(t){Mo.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Mo.warn("layouting"):this.times>3?Mo.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ni.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=J.start("PartLayout"),{target:s,__updatedList:r}=this,{BEFORE:i,LAYOUT:o,AFTER:n}=ai,a=this.getBlocks(r);a.forEach((t=>{t.setBefore()})),s.emitEvent(new ai(i,a,this.times)),r.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(Co(t),e.push(t),t.isBranch&&Ro(t,e),To(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),To(t,e)))}))}(r,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&ko(t),t.__updateChange()}))}(r),a.forEach((t=>t.setAfter())),s.emitEvent(new ai(o,a,this.times)),s.emitEvent(new ai(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,J.end(e)}fullLayout(){const t=J.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:r,AFTER:i}=ai,o=this.getBlocks(new ht(e));e.emitEvent(new ai(s,o,this.times)),Wo.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new ai(r,o,this.times)),e.emitEvent(new ai(i,o,this.times)),this.addBlocks(o),J.end(t)}static fullLayout(t){if(Oo(t),t.isBranch){const e=[t];Io(t,e),Ao(e)}else t.__updateWorldBounds();Do(t)}createBlock(t){return new So(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(){const{target:t}=this;this.__eventIds=[t.on_(ai.REQUEST,this.layout,this),t.on_(ai.AGAIN,this.layoutAgain,this),t.on_(ni.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Uo=Z.get("Renderer");class No{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=ct.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(ai.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new V,Uo.log(e.innerName,"---\x3e");try{this.emitRender(li.START),this.renderOnce(t),this.emitRender(li.END,this.totalBounds),fo.clearRecycled()}catch(t){Uo.error(t)}Uo.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?Uo.warn("rendering"):this.times>3?Uo.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(li.BEFORE),t()):(this.requestLayout(),this.emitRender(li.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(li.RENDER,this.renderBounds,this.renderOptions),this.emitRender(li.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return Uo.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=J.start("PartRender"),{canvas:s}=this,r=t.getIntersect(s.bounds),i=t.includes(this.target.__world),o=(new V).copy(r);s.save(),i&&!Z.showRepaint?s.clear():(r.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(r,!0),s.clipWorld(r,!0)),this.__render(r,o),s.restore(),J.end(e)}fullRender(){const t=J.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),J.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),Z.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),Z.showHitView&&this.renderHitView(s),Z.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(hi.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Uo.warn(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new li(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(li.REQUEST,this.update,this),t.on_(ai.END,this.__onLayoutEnd,this),t.on_(li.AGAIN,this.renderAgain,this),t.on_(ii.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:Fo}=z;class Ho{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const r=s.through||!1,i=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,n=this.getBestMatchLeaf(),a=i?this.getPath(n):this.getHitablePath(n);return this.clear(),r?{path:a,leaf:n,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:r}=this.point,i={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],Si.worldHittable(e)&&(this.hitChild(e,i),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ht;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,r=new ht;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(r.unshift(s),s.__.hitChildren);t--);return r}getThroughPath(t){const e=new ht,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let r,i,o;for(let t=0,n=s.length;t<n;t++){r=s[t],i=s[t+1];for(let t=0,s=r.length;t<s&&(o=r.list[t],!i||!i.has(o));t++)e.push(o)}return e}eachFind(t,e){let s,r;const{point:i}=this;for(let o=t.length-1;o>-1;o--)s=t[o],e&&!s.isMask||(r=Fo(s.__world,i),s.isBranch?(r||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,i)):r&&this.hitChild(s,i))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.target=null,this.selector=null}}class zo{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.findPath=new Ho(t,this),this.__listenEvents()}getByPoint(e,s,r){return"node"===t.name&&this.target.emit(ai.CHECK_UPDATE),this.findPath.getByPoint(e,s,r)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,r=this.innerIdList[t];return r||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,r=this.idList[t];return r||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let r=0,i=s.length;r<i;r++){if(e(t=s[r]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(ei.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.findPath.destroy(),this.target=null,this.findPath=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}Object.assign(e,{watcher:(t,e)=>new Bo(t,e),layouter:(t,e)=>new Wo(t,e),renderer:(t,e,s)=>new No(t,e,s),selector:(t,e)=>new zo(t,e)}),t.layout=Wo.fullLayout;class Yo extends kt{get allowBackgroundColor(){return!1}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;this.view.width=t*s,this.view.height=e*s,this.clientBounds=this.bounds}}class jo{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(exports.MoveEvent.START,this.moveData)}t.path=this.moveData.path,e.emit(exports.MoveEvent.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(exports.ZoomEvent.START,this.zoomData)}t.path=this.zoomData.path,e.emit(exports.ZoomEvent.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(exports.RotateEvent.START,this.rotateData)}t.path=this.rotateData.path,e.emit(exports.RotateEvent.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd(),this.transformMode=null}moveEnd(){this.moveData&&(this.interaction.emit(exports.MoveEvent.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(exports.ZoomEvent.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(exports.RotateEvent.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const Xo={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?exports.SwipeEvent.UP:t>45&&t<135?exports.SwipeEvent.DOWN:t<=45&&t>=-45?exports.SwipeEvent.RIGHT:exports.SwipeEvent.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:Vo.getSwipeDirection(C.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,r=s.length;t<r;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ht,{list:r}=t;for(let t=0,i=r.length;t<i;t++)r[t].hasEvent(e)&&s.push(r[t]);return s}},Vo=Xo,{getDragEventData:Go,getDropEventData:qo,getSwipeEventData:Ko,filterPathByEventType:Zo}=Xo;class Qo{constructor(t){this.interaction=t}setDragData(t){this.dragData=Go(t,t,t)}getDragList(){return this.dragging?exports.DropEvent.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:r}=s;if(this.moving&&!no.middle(t)&&!no.left(t))return void s.pointerCancel();const{dragData:i}=this;if(!this.moving){const o=r.target.isLeafer&&s.config.move.dragEmpty;this.moving=(no.middle(t)||oo.isHoldSpaceKey()||o)&&e,this.moving&&s.emit(exports.MoveEvent.START,i)}this.moving||this.dragStart(t,e);const{path:o,throughPath:n}=r;this.dragData=Go(r,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?s.emit(exports.MoveEvent.MOVE,this.dragData):this.dragging&&(s.emit(exports.DragEvent.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=no.left(t)&&e,this.dragging&&(this.interaction.emit(exports.DragEvent.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Zo(this.dragData.path,exports.DragEvent.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,r=t.length;s<r;s++)if(e=t.list[s],e.__.draggable&&e.__.hitSelf){this.dragableList=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{Si.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:r}=t;s?r.indexAt(0)!==s.indexAt(0)&&(e.emit(exports.DragEvent.OUT,t,s),e.emit(exports.DragEvent.OVER,t,r)):e.emit(exports.DragEvent.OVER,t,r),this.dragOverPath=r}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:r}=t;e.emit(exports.DragEvent.ENTER,t,r,s),e.emit(exports.DragEvent.LEAVE,t,s,r),this.dragEnterPath=r}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:r,throughPath:i}=s,o=Go(s,t,t);i&&(o.throughPath=i),o.path=r,this.moving&&e.emit(exports.MoveEvent.END,o),this.dragging&&(e.emit(exports.DragEvent.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:r}=s;if(C.getDistance(r,t)>s.config.pointer.swipeDistance){const t=Ko(r,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=qo(t,this.getDragList(),exports.DropEvent.dragData);e.path=this.dragEnterPath,this.interaction.emit(exports.DropEvent.DROP,e),this.interaction.emit(exports.DragEvent.LEAVE,t,this.dragEnterPath)}dragReset(){exports.DropEvent.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:r,dragOut:i}=e.config.move;if(!i||!r)return;const o=e.shrinkCanvasBounds,{x:n,y:a}=o,h=z.right(o),l=z.bottom(o),d=t.x<n?r:h<t.x?-r:0,c=t.y<a?r:l<t.y?-r:0;let p=0,u=0;this.autoMoveTimer=setInterval((()=>{p+=d,u+=c,C.move(s,d,c),C.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:p,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}const $o=["move","zoom","rotate"];function Jo(t,e,s,r,i){if($o.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!en(t,i)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!s.path.has(o)&&o.__.hittable&&tn(o,e,s,r,i)}}function tn(t,e,s,r,i){if(!t.__)return!0;if(t.__.hitSelf&&t.hasEvent(e,r)&&!en(t,i)){s.phase=r?1:t===s.target?2:3;const i=ot.get(e,s);if(t.emitEvent(i,r),i.isStop)return!0}return!1}function en(t,e){return e&&e.has(t)}const sn={getData(t){const e=t[0],s=t[1],r=C.getCenter(e.from,s.from),i=C.getCenter(e.to,s.to),o={x:i.x-r.x,y:i.y-r.y},n=C.getDistance(e.from,s.from),a=C.getDistance(e.to,s.to)/n,h=C.getAngle(e.from,s.from),l=C.getAngle(e.to,s.to);return{move:o,scale:a,angle:this.getChangedAngle(h,l),center:i}},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},{pathHasEventType:rn,getMoveEventData:on,getZoomEventData:nn,getRotateEventData:an}=Xo;class hn{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,r,i){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=e,this.canvas=s,this.selector=r,this.defaultPath=new ht(e),this.transformer=new jo(this),this.dragger=new Qo(this),i&&(this.config=ct.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){this.emit(exports.PointerEvent.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:s,through:r}=this.config.pointer,i=this.selector.getByPoint(t,s,{through:r});i.throughPath&&(t.throughPath=i.throughPath),t.path=e?this.defaultPath:i.path,this.emit(exports.PointerEvent.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),no.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&no.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(exports.PointerEvent.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=C.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:exports.PointerEvent.MOVE});t.path=e.path,this.emit(exports.PointerEvent.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))}pointerUp(t){if(!this.downData)return;this.emit(exports.PointerEvent.BEFORE_UP,t,this.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getByPoint(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(exports.PointerEvent.UP,t),this.emit(exports.PointerEvent.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:r,scale:i,center:o}=sn.getData(e);this.rotate(an(o,r,t)),this.zoom(nn(o,i,t)),this.move(on(o,s,t))}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(exports.PointerEvent.OUT,t,this.overPath),this.emit(exports.PointerEvent.OVER,t,e)):this.emit(exports.PointerEvent.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit(exports.PointerEvent.LEAVE,t,this.enterPath,e),this.emit(exports.PointerEvent.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(exports.PointerEvent.LEAVE,t),this.dragger.dragging&&this.emit(exports.DropEvent.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const r=Date.now()-this.downTime,i=[exports.PointerEvent.DOUBLE_TAP,exports.PointerEvent.DOUBLE_CLICK].some((e=>rn(t.path,e)));r<e.tapTime+50&&i?(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))}emitTap(t){this.emit(exports.PointerEvent.TAP,t),this.emit(exports.PointerEvent.CLICK,t)}emitDoubleTap(t){this.emit(exports.PointerEvent.DOUBLE_TAP,t),this.emit(exports.PointerEvent.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(exports.PointerEvent.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(exports.PointerEvent.LONG_TAP,t),rn(t.path,exports.PointerEvent.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new V(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ii.RESIZE,this.__onResize,this)],t.once(di.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds)}emit(t,e,s,r){this.running&&function(t,e,s,r){if(!s&&!e.path)return;let i;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let o=s.length-1;o>-1;o--){if(i=s.list[o],tn(i,t,e,!0,r))return;i.isApp&&Jo(i,t,e,!0,r)}for(let o=0,n=s.length;o<n;o++)if(i=s.list[o],i.isApp&&Jo(i,t,e,!1,r),tn(i,t,e,!1,r))return}(t,e,s,r)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.config=null,this.target=null,this.selector=null,this.canvas=null,this.dragger=null,this.transformer=null)}}function ln(s,r){if(!t.origin){if("skia"===s){const{Canvas:e,loadImage:s}=r;t.origin={createCanvas:(t,s,r)=>new e(t,s,r),canvasToDataURL:(t,e,s)=>t.toDataURLSync(e,{quality:s}),canvasToBolb:(t,e,s)=>t.toBuffer(e,{quality:s}),canvasSaveAs:(t,e,s)=>t.saveAs(e,{quality:s}),loadImage:s}}t.canvas=e.canvas()}}Object.assign(e,{canvas:(t,e)=>new Yo(t,e),image:t=>new mo(t),hitCanvas:(t,e)=>new Yo(t,e),interaction:(t,e,s,r)=>new hn(t,e,s,r)}),t.name="node",t.requestRender=function(t){setTimeout(t)},t.devicePixelRatio=1,t.conicGradientSupport=!0,t.realtimeLayout=!0;const dn=Z.get("LeaferTypeCreator"),cn={list:{},register(t,e){pn[t]?dn.repeat(t):pn[t]=e},run(t,e){const s=cn.list[t];s?s(e):dn.error("no",t)}},{list:pn}=cn;cn.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),cn.register("design",(function(t){const{MOVE:e}=exports.MoveEvent,{ZOOM:s}=exports.ZoomEvent;t.__eventIds.push(t.on_(e,(e=>{Si.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:r,max:i}=t.config.zoom;let{scale:o}=e;o*s<r?o=r/s:o*s>i&&(o=i/s),1!==o&&Si.zoomOfWorld(t.zoomLayer,e,o)})))}));const un={};class _n extends ut{setFill(t){this.__naturalWidth&&(this.__naturalWidth=this.__naturalHeight=void 0),"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isFills=!0,this._fill||(this._fill=un)):(this.__isFills&&(this.__removeInput("fill"),this.__recycleImage("fill"),this.__isFills=!1),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=un)):(this.__isStrokes&&(this.__removeInput("stroke"),this.__recycleImage("stroke"),this.__isStrokes=!1),this._stroke=t)}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}__recycleImage(t){const e="fill"===t?this._fill:this._stroke;if(e instanceof Array){let s,r;for(let i=0,o=e.length;i<o;i++)if(s=e[i].image,s&&s.url){const{url:o}=s;if(r||(r={}),r[o]=!0,fo.recycle(s),s.loading){const r=this.__input&&this.__input[t];r&&(r instanceof Array?r.some((t=>t.url===o)):r.url===o)||s.unload(e[i].loadId)}}return r}return null}}const gn={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class fn extends _n{}class yn extends fn{get __boxStroke(){return!0}}class xn extends _n{get __boxStroke(){return!0}}const{parse:vn}=Fe;const mn={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class wn extends xn{}function En(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function bn(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const Bn={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:r,strokeAlign:i,strokeWidth:n}=this.__;if((s||"all"===r)&&n&&"inside"!==i&&(e=t="center"===i?n/2:n,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,r="Line"!==this.__tag?1/Math.sin(e*o/2)*Math.sqrt(n)-t:0,i="none"===s?0:n;t+=Math.max(r,i)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:r,backgroundBlur:i}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),r&&(t=Math.max(t,r));let o=t=Math.ceil(t);return s&&s.forEach((t=>{o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),i&&(o=Math.max(o,i)),this.__layout.renderShapeSpread=o,t}},Cn={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this));const t=this.__hitCanvas;this.__drawHitPath(t),t.setStrokeOptions(this.__)},__hit(e){const{__hitCanvas:s}=this;"miniapp"===t.name&&this.__drawHitPath(s);const{fill:r,hitFill:i,windingRule:o}=this.__,n=r&&"path"===i||"all"===i,a=s.hitFill(e,o);if(n&&a)return!0;const{stroke:h,hitStroke:l,strokeWidth:d,strokeAlign:c}=this.__,p=h&&"path"===l||"all"===l,u=2*e.radiusX;let _=u;if(p)switch(c){case"inside":if(_+=2*d,!n&&a&&s.hitStroke(e,_))return!0;_=u;break;case"center":_+=d;break;case"outside":if(_+=2*d,!n){if(!a&&s.hitStroke(e,_))return!0;_=u}}return!!_&&s.hitStroke(e,_)}},kn={},Rn={},Tn={},Pn={export(t,e,s){return function(t){Ln||(Ln=new go);return new Promise((e=>{Ln.add((()=>ft(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((r=>new Promise((i=>{const{leafer:o}=t;o?o.waitViewLoaded((()=>ft(this,void 0,void 0,(function*(){let t,n,a,{canvas:h}=o,{unreal:l}=h;switch(l&&(h=h.getSameCanvas(),h.backgroundColor=o.config.fill,o.__render(h,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(n=!0);break;case"number":t=s;break;case"boolean":n=s}a=e.includes(".")?yield h.saveAs(e,t):n?yield h.toBlob(e,t):h.toDataURL(e,t),r({data:a}),i(),l&&h.recycle()})))):(r({data:!1}),i())}))))}};let Ln;const{copy:Sn,toOffsetOutBounds:On}=z,Dn={},In={};function An(e,s,r,i){const{bounds:o,shapeBounds:n}=i;if(t.fullImageShadow){if(Sn(Dn,e.bounds),Dn.x+=s.x-n.x,Dn.y+=s.y-n.y,r){const{matrix:t}=i;Dn.x-=(o.x+(t?t.e:0)+o.width/2)*(r-1),Dn.y-=(o.y+(t?t.f:0)+o.height/2)*(r-1),Dn.width*=r,Dn.height*=r}e.copyWorld(i.canvas,e.bounds,Dn)}else r&&(Sn(Dn,s),Dn.x-=s.width/2*(r-1),Dn.y-=s.height/2*(r-1),Dn.width*=r,Dn.height*=r),e.copyWorld(i.canvas,n,r?Dn:s)}const{toOffsetOutBounds:Mn}=z,Wn={};var Un=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:r}=t.__;s.setWorldBlur(r*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s,r){let i,o;const{__world:n,__layout:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:p,scaleY:u}=s,_=e.getSameCanvas(),g=h.length-1;Mn(d,Wn),h.forEach(((t,r)=>{_.save(),_.setWorldShadow(Wn.offsetX+t.x*p,Wn.offsetY+t.y*u,t.blur*p),o=t.spread?1-2*t.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,An(_,Wn,o,s),_.restore(),l?(_.copyWorld(_,d,n,"copy"),_.copyWorld(l,n,n,"source-out"),i=n):(_.copyWorld(s.canvas,c,d,"source-out"),i=d),_.fillWorld(i,t.color,"source-in"),e.copyWorldToInner(_,i,a.renderBounds,t.blendMode),g&&r<g&&_.clear()})),_.recycle()},shadow:function(t,e,s,r){let i,o;const{__world:n,__layout:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:p,scaleY:u}=s,_=e.getSameCanvas(),g=h.length-1;On(d,In),h.forEach(((t,r)=>{_.setWorldShadow(In.offsetX+t.x*p,In.offsetY+t.y*u,t.blur*p,t.color),o=t.spread?1+2*t.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,An(_,In,o,s),i=d,t.box&&(_.restore(),_.save(),l&&(_.copyWorld(_,d,n,"copy"),i=n),l?_.copyWorld(l,n,n,"destination-out"):_.copyWorld(s.canvas,c,d,"destination-out")),e.copyWorldToInner(_,i,a.renderBounds,t.blendMode),g&&r<g&&_.clear()})),_.recycle()}});const{get:Nn,rotateOfOuter:Fn,translate:Hn,scaleOfOuter:zn,scale:Yn,rotate:jn}=f;const{get:Xn,scale:Vn,copy:Gn}=f;function qn(e,s,r){let{scaleX:i,scaleY:o}=e.__world;const n=i+o;if(s.patternId!==n){s.patternId=n;const{image:e,data:a}=s,h=e.isSVG?4096:Math.min(e.width,4096),l=e.isSVG?4096:Math.min(e.height,4096);let d,c,{width:p,height:u,scaleX:_,scaleY:g,opacity:f,transform:y,mode:x}=a;_&&(c=Xn(),Gn(c,y),Vn(c,1/_,1/g),i*=_,o*=g),i*=r,o*=r,p*=i,u*=o,p>h||u>l?d=Math.max(p/h,u/l):(p<32||u<32)&&(d=Math.min(p/32,u/32)),d&&(i/=d,o/=d,p/=d,u/=d),_&&(i/=_,o/=g),(y||1!==i||1!==o)&&(c||(c=Xn(),y&&Gn(c,y)),Vn(c,1/i,1/o));const v=t.canvas.createPattern(e.getCanvas(p,u,f),"repeat"===x?"repeat":t.origin.noRepeat||"no-repeat");try{s.transform=null,c&&(v.setTransform?v.setTransform(c):s.transform=c)}catch(t){s.transform=c}return s.style=v,!0}return!1}const{get:Kn,translate:Zn}=f;function Qn(t,e,s,r,i){let{width:o,height:n}=s;const{opacity:a,mode:h,offset:l,scale:d,rotation:c,blendMode:p}=r,u=i.width===o&&i.height===n;p&&(e.blendMode=p);const _=e.data={mode:h};switch(h){case"strench":u||(o=i.width,n=i.height),(i.x||i.y)&&(_.transform=Kn(),Zn(_.transform,i.x,i.y));break;case"clip":(l||d||c)&&function(t,e,s,r,i){const o=Nn();Hn(o,e.x,e.y),s&&Hn(o,s.x,s.y),r&&("number"==typeof r?Yn(o,r):Yn(o,r.x,r.y),t.scaleX=o.a,t.scaleY=o.d),i&&jn(o,i),t.transform=o}(_,i,l,d,c);break;case"repeat":(!u||d||c)&&function(t,e,s,r,i,o){const n=Nn();if(o)switch(jn(n,o),o){case 90:Hn(n,r,0);break;case 180:Hn(n,s,r);break;case 270:Hn(n,0,s)}Hn(n,e.x,e.y),i&&(zn(n,e,i),t.scaleX=t.scaleY=i),t.transform=n}(_,i,o,n,d,c);break;default:u&&!c||function(t,e,s,r,i,o){const n=Nn(),a=o&&180!==o,h=s.width/(a?i:r),l=s.height/(a?r:i),d="fit"===e?Math.min(h,l):Math.max(h,l),c=s.x+(s.width-r*d)/2,p=s.y+(s.height-i*d)/2;Hn(n,c,p),Yn(n,d),o&&Fn(n,{x:s.x+s.width/2,y:s.y+s.height/2},o),t.scaleX=t.scaleY=d,t.transform=n}(_,h,i,o,n,c)}_.width=o,_.height=n,a&&(_.opacity=a);const g=t.leafer&&t.leafer.canvas;g&&g.bounds.hit(t.__world)&&qn(t,e,g.pixelRatio)}function $n(t,e,s){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=s.width,e.__naturalHeight=s.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),!1}return!0}function Jn(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new ri(t,e))}function ta(t,e,s,r){const{scaleX:i,scaleY:o}=t.__world;if(s.data&&s.patternId!==i+o){if(r)if(s.image.isSVG&&"repeat"!==s.data.mode){let{width:t,height:n}=s.data;t*=i*e.pixelRatio,n*=o*e.pixelRatio,r=t>4096||n>4096}else r=!1;if(r){e.save(),e.clip();const{data:t}=s;return s.blendMode&&(e.blendMode=s.blendMode),t.opacity&&(e.opacity*=t.opacity),t.transform&&e.transform(t.transform),e.drawImage(s.image.view,0,0,t.width,t.height),e.restore(),!0}return s.style?fo.patternTasker.add((()=>ft(this,void 0,void 0,(function*(){e.bounds.hit(t.__world)&&qn(t,s,e.pixelRatio)&&t.forceUpdate("surface")}))),300):qn(t,s,e.pixelRatio),!1}return!1}function ea(t,e){let s;const{rows:r,decorationY:i,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=r.length;t<n;t++)s=r[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),i&&e.fillRect(s.x,s.y+i,s.width,o)}function sa(t,e,s){const{strokeAlign:r}=t.__,i="string"!=typeof s;switch(r){case"center":e.setStroke(i?void 0:s,t.__.strokeWidth,t.__),i?oa(t,s,e,!0):ia(t,e);break;case"inside":ra(t,e,s,"inside",i);break;case"outside":ra(t,e,s,"outside",i)}}function ra(t,e,s,r,i){const{strokeWidth:o,__font:n}=t.__,a=e.getSameCanvas(!0);a.setStroke(i?void 0:s,2*o,t.__),a.font=n,i?oa(t,s,a,!0):ia(t,a),a.blendMode="outside"===r?"destination-out":"destination-in",ea(t,a),a.blendMode="normal",e.copyWorldToInner(a,t.__world,t.__layout.renderBounds),a.recycle()}function ia(t,e){let s;const{rows:r,decorationY:i,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=r.length;t<n;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.strokeText(t.char,t.x,s.y)})),i&&e.strokeRect(s.x,s.y+i,s.width,o)}function oa(t,e,s,r){let i;for(let o=0,n=e.length;o<n;o++)i=e[o],i.image&&ta(t,s,i,!1)||i.style&&(s.strokeStyle=i.style,i.blendMode?(s.saveBlendMode(i.blendMode),r?ia(t,s):s.stroke(),s.restoreBlendMode()):r?ia(t,s):s.stroke())}const{getSpread:na,getOuterOf:aa,getByMove:ha,getIntersectData:la}=z;const da={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const r=t.r+","+t.g+","+t.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}},ca={x:.5,y:0},pa={x:.5,y:1};function ua(t,e,s){let r;for(let i=0,o=e.length;i<o;i++)r=e[i],t.addColorStop(r.offset,da.string(r.color,s))}const{set:_a,getAngle:ga,getDistance:fa}=C,{get:ya,rotateOfOuter:xa,scaleOfOuter:va}=f,ma={x:.5,y:.5},wa={x:.5,y:1},Ea={},ba={};const{set:Ba,getAngle:Ca,getDistance:ka}=C,{get:Ra,rotateOfOuter:Ta,scaleOfOuter:Pa}=f,La={x:.5,y:.5},Sa={x:.5,y:1},Oa={},Da={};let Ia;function Aa(e,s,r){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:i}=e.__layout;switch(s.type){case"solid":let{type:o,blendMode:n,color:a,opacity:h}=s;return{type:o,blendMode:n,style:da.string(a,h)};case"image":return function(t,e,s,r,i){const o={type:s.type},n=o.image=fo.get(s);if(n.ready&&$n(t,e,n)&&Qn(t,o,n,s,r),i){const i={target:t,image:n,attrName:e,attrValue:s};n.ready?(Jn(ri.LOAD,i),Jn(ri.LOADED,i)):n.error?(t.forceUpdate("surface"),i.error=n.error,Jn(ri.ERROR,i)):(Jn(ri.LOAD,i),o.loadId=n.load((()=>{t.__&&($n(t,e,n)&&(Qn(t,o,n,s,r),t.forceUpdate("surface")),Jn(ri.LOADED,i))}),(e=>{t.forceUpdate("surface"),i.error=e,Jn(ri.ERROR,i)})))}return o}(e,r,s,i,!Ia||!Ia[s.url]);case"linear":return function(e,s){let{from:r,to:i,type:o,blendMode:n,opacity:a}=e;r||(r=ca),i||(i=pa);const h=t.canvas.createLinearGradient(s.x+r.x*s.width,s.y+r.y*s.height,s.x+i.x*s.width,s.y+i.y*s.height);ua(h,e.stops,a);const l={type:o,style:h};return n&&(l.blendMode=n),l}(s,i);case"radial":return function(e,s){let{from:r,to:i,type:o,opacity:n,blendMode:a,stretch:h}=e;r||(r=ma),i||(i=wa);const{x:l,y:d,width:c,height:p}=s;let u;_a(Ea,l+r.x*c,d+r.y*p),_a(ba,l+i.x*c,d+i.y*p),(c!==p||h)&&(u=ya(),va(u,Ea,c/p*(h||1),1),xa(u,Ea,ga(Ea,ba)+90));const _=t.canvas.createRadialGradient(Ea.x,Ea.y,0,Ea.x,Ea.y,fa(Ea,ba));ua(_,e.stops,n);const g={type:o,style:_,transform:u};return a&&(g.blendMode=a),g}(s,i);case"angular":return function(e,s){let{from:r,to:i,type:o,opacity:n,blendMode:a,stretch:h}=e;r||(r=La),i||(i=Sa);const{x:l,y:d,width:c,height:p}=s;Ba(Oa,l+r.x*c,d+r.y*p),Ba(Da,l+i.x*c,d+i.y*p);const u=Ra(),_=Ca(Oa,Da);t.conicGradientRotate90?(Pa(u,Oa,c/p*(h||1),1),Ta(u,Oa,_+90)):(Pa(u,Oa,1,c/p*(h||1)),Ta(u,Oa,_));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,Oa.x,Oa.y):t.canvas.createRadialGradient(Oa.x,Oa.y,0,Oa.x,Oa.y,ka(Oa,Da));ua(g,e.stops,n);const f={type:o,style:g,transform:u};return a&&(f.blendMode=a),f}(s,i);default:return s.r?{type:"solid",style:da.string(s)}:void 0}}var Ma=Object.freeze({__proto__:null,compute:function(t,e){const s=[];let r,i=t.__.__input[e];i instanceof Array||(i=[i]),Ia=t.__.__recycleImage(e);for(let o=0,n=i.length;o<n;o++)r=Aa(t,i[o],e),r&&s.push(r);t.__["_"+e]=s.length?s:void 0},drawTextStroke:ia,fill:function(t,e,s){e.fillStyle=s,t.__.__font?ea(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()},fillText:ea,fills:function(t,e,s){let r;const{windingRule:i,__font:o}=t.__;for(let n=0,a=s.length;n<a;n++)r=s[n],r.image&&ta(t,e,r,!o)||r.style&&(e.fillStyle=r.style,r.transform?(e.save(),e.transform(r.transform),r.blendMode&&(e.blendMode=r.blendMode),o?ea(t,e):i?e.fill(i):e.fill(),e.restore()):r.blendMode?(e.saveBlendMode(r.blendMode),o?ea(t,e):i?e.fill(i):e.fill(),e.restoreBlendMode()):o?ea(t,e):i?e.fill(i):e.fill())},shape:function(t,e,s){const r=e.getSameCanvas();let i,o,n,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))s.matrix?(l*=s.matrix.a,d*=s.matrix.d,i=n=aa(h,s.matrix)):i=n=h,a=r;else{const{renderShapeSpread:r}=t.__layout,c=la(r?na(e.bounds,r*l):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=o.a,d*=o.d),n=aa(h,o),i=ha(n,-o.e,-o.f),s.matrix&&o.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:o})}return t.__renderShape(r,s),{canvas:r,matrix:o,bounds:i,worldCanvas:a,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s){const r=t.__,{strokeWidth:i,strokeAlign:o,__font:n}=r;if(i)if(n)sa(t,e,s);else switch(o){case"center":e.setStroke(s,i,r),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*i,r),e.clip(r.windingRule),e.stroke(),e.restore();break;case"outside":const o=e.getSameCanvas(!0);o.setStroke(s,2*i,t.__),t.__drawRenderPath(o),o.stroke(),o.clip(r.windingRule),o.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}},strokeText:sa,strokes:function(t,e,s){const r=t.__,{strokeWidth:i,strokeAlign:o,__font:n}=r;if(i)if(n)sa(t,e,s);else switch(o){case"center":e.setStroke(void 0,i,r),oa(t,s,e);break;case"inside":e.save(),e.setStroke(void 0,2*i,r),e.clip(r.windingRule),oa(t,s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*i,t.__),oa(t,s,n),n.clip(r.windingRule),n.clearWorld(o),e.copyWorldToInner(n,t.__world,o),n.recycle()}}});Object.assign(kn,Un),Object.assign(Rn,Ma);const Wa={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:r,backgroundBlur:i}=this.__;t.__useEffect=!!(e||s||r||i)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:r,__drawAfterFill:i}=this.__;this.__drawRenderPath(t),s&&Rn.fill(this,t,s),i&&this.__drawAfterFill(t,e),r&&Rn.stroke(this,t,r)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:r,__drawAfterFill:i}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const o=Rn.shape(this,t,e),{shadow:n,innerShadow:a}=this.__;n&&kn.shadow(this,t,o,e),s&&(this.__.__isFills?Rn.fills(this,t,s):Rn.fill(this,t,s)),i&&this.__drawAfterFill(t,e),a&&kn.innerShadow(this,t,o,e),r&&(this.__.__isStrokes?Rn.strokes(this,t,r):Rn.stroke(this,t,r)),o.worldCanvas&&o.worldCanvas.recycle(),o.canvas.recycle()}else s&&(this.__.__isFills?Rn.fills(this,t,s):Rn.fill(this,t,s)),i&&this.__drawAfterFill(t,e),r&&(this.__.__isStrokes?Rn.strokes(this,t,r):Rn.stroke(this,t,r))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:r}=this.__;this.__drawRenderPath(t),s&&Rn.fill(this,t,"#000000"),r&&Rn.stroke(this,t,"#000000")}},Ua={__drawFast(t,e){const{width:s,height:r,fill:i,stroke:o,__drawAfterFill:n}=this.__;if(i&&(t.fillStyle=i,t.fillRect(0,0,s,r)),n&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:i}=this.__;t.setStroke(o,i,this.__);const n=i/2;switch(e){case"center":t.strokeRect(0,0,s,r);break;case"inside":t.strokeRect(n,n,s-i,r-i);break;case"outside":t.strokeRect(-n,-n,s+i,r+i)}}}};exports.UI=class extends exports.Leaf{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Fe.toCanvasData(e,!0):e:[]}getPathString(t){return Fe.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&Rn.compute(this,"fill"),e&&Rn.compute(this,"stroke")}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?_r.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}export(t,e){return Pn.export(this,t,e)}static one(t,e,s,r,i){return st.get(t.tag||this.prototype.__tag,t,e,s,r,i)}destroy(){this.fill=this.stroke=null,super.destroy()}},gt([Mr(_n)],exports.UI.prototype,"__",void 0),gt([wr("")],exports.UI.prototype,"id",void 0),gt([wr("")],exports.UI.prototype,"name",void 0),gt([wr("")],exports.UI.prototype,"className",void 0),gt([Lr("pass-through")],exports.UI.prototype,"blendMode",void 0),gt([Sr(1)],exports.UI.prototype,"opacity",void 0),gt([Sr(!0)],exports.UI.prototype,"visible",void 0),gt([Dr(!1)],exports.UI.prototype,"isMask",void 0),gt([Ir(!1)],exports.UI.prototype,"isEraser",void 0),gt([Or(0)],exports.UI.prototype,"zIndex",void 0),gt([wr()],exports.UI.prototype,"locked",void 0),gt([Er(0)],exports.UI.prototype,"x",void 0),gt([Er(0)],exports.UI.prototype,"y",void 0),gt([Cr(100)],exports.UI.prototype,"width",void 0),gt([Cr(100)],exports.UI.prototype,"height",void 0),gt([br(1)],exports.UI.prototype,"scaleX",void 0),gt([br(1)],exports.UI.prototype,"scaleY",void 0),gt([Br(0)],exports.UI.prototype,"rotation",void 0),gt([Br(0)],exports.UI.prototype,"skewX",void 0),gt([Br(0)],exports.UI.prototype,"skewY",void 0),gt([wr(!1)],exports.UI.prototype,"draggable",void 0),gt([Ar(!0)],exports.UI.prototype,"hittable",void 0),gt([Ar("path")],exports.UI.prototype,"hitFill",void 0),gt([Tr("path")],exports.UI.prototype,"hitStroke",void 0),gt([Ar(!0)],exports.UI.prototype,"hitChildren",void 0),gt([Ar(!0)],exports.UI.prototype,"hitSelf",void 0),gt([Lr()],exports.UI.prototype,"fill",void 0),gt([Tr()],exports.UI.prototype,"stroke",void 0),gt([Tr("inside")],exports.UI.prototype,"strokeAlign",void 0),gt([Tr(1)],exports.UI.prototype,"strokeWidth",void 0),gt([Tr("none")],exports.UI.prototype,"strokeCap",void 0),gt([Tr("miter")],exports.UI.prototype,"strokeJoin",void 0),gt([Tr()],exports.UI.prototype,"dashPattern",void 0),gt([Tr()],exports.UI.prototype,"dashOffset",void 0),gt([Tr(10)],exports.UI.prototype,"miterLimit",void 0),gt([kr()],exports.UI.prototype,"cornerRadius",void 0),gt([kr()],exports.UI.prototype,"cornerSmoothing",void 0),gt([En()],exports.UI.prototype,"shadow",void 0),gt([En()],exports.UI.prototype,"innerShadow",void 0),gt([En()],exports.UI.prototype,"blur",void 0),gt([En()],exports.UI.prototype,"backgroundBlur",void 0),gt([En()],exports.UI.prototype,"grayscale",void 0),gt([Yr(As.drawPathByData)],exports.UI.prototype,"__drawPathByData",null),exports.UI=gt([Vr(Bn),Vr(Cn),Vr(Wa),jr()],exports.UI),exports.Group=class extends exports.UI{get __tag(){return"Group"}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.isBranch=!0,this.children=[]}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){}remove(t,e){}removeAll(t){}},gt([Mr(fn)],exports.Group.prototype,"__",void 0),exports.Group=gt([Vr(exports.Branch),Gr()],exports.Group),exports.Rect=class extends exports.UI{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:r,cornerRadius:i}=this.__;i?t.roundRect(0,0,s,r,i):t.rect(0,0,s,r)}},gt([Mr(xn)],exports.Rect.prototype,"__",void 0),exports.Rect=gt([Vr(Ua),Gr()],exports.Rect);const Na=exports.Rect.prototype,Fa=exports.Group.prototype,Ha={},{copy:za,add:Ya}=z;exports.Box=class extends exports.Group{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;za(Ha,t),super.__updateRenderBounds(),Ya(t,Ha)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__drawPathByData(t,e){}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}},gt([Mr(yn)],exports.Box.prototype,"__",void 0),gt([Pr("show")],exports.Box.prototype,"overflow",void 0),gt([Yr(Na.__updateStrokeSpread)],exports.Box.prototype,"__updateStrokeSpread",null),gt([Yr(Na.__updateRenderSpread)],exports.Box.prototype,"__updateRectRenderSpread",null),gt([Yr(Na.__updateBoxBounds)],exports.Box.prototype,"__updateBoxBounds",null),gt([Yr(Na.__updateStrokeBounds)],exports.Box.prototype,"__updateStrokeBounds",null),gt([Yr(Na.__updateRenderBounds)],exports.Box.prototype,"__updateRectRenderBounds",null),gt([Yr(Na.__updateChange)],exports.Box.prototype,"__updateRectChange",null),gt([Yr(Na.__drawPathByData)],exports.Box.prototype,"__drawPathByData",null),gt([Yr(Na.__render)],exports.Box.prototype,"__renderRect",null),gt([Yr(Fa.__render)],exports.Box.prototype,"__renderGroup",null),exports.Box=gt([jr(),Gr()],exports.Box),exports.Frame=class extends exports.Box{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}},gt([Mr(class extends yn{})],exports.Frame.prototype,"__",void 0),gt([Pr("hide")],exports.Frame.prototype,"overflow",void 0),exports.Frame=gt([Gr()],exports.Frame);const{moveTo:ja,closePath:Xa,ellipse:Va}=is;exports.Ellipse=class extends exports.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:r,endAngle:i}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?r||i?(s<1&&Va(a,o,n,o*s,n*s,0,r,i,!1),Va(a,o,n,o,n,0,i,r,!0),s<1&&Xa(a)):(s<1&&(Va(a,o,n,o*s,n*s),ja(a,t,n)),Va(a,o,n,o,n,0,0,360,!0)):r||i?(ja(a,o,n),Va(a,o,n,o,n,0,r,i,!1),Xa(a)):Va(a,o,n,o,n)}},gt([Mr(class extends _n{get __boxStroke(){return!0}})],exports.Ellipse.prototype,"__",void 0),gt([kr(0)],exports.Ellipse.prototype,"innerRadius",void 0),gt([kr(0)],exports.Ellipse.prototype,"startAngle",void 0),gt([kr(0)],exports.Ellipse.prototype,"endAngle",void 0),exports.Ellipse=gt([Gr()],exports.Ellipse);const{sin:Ga,cos:qa,PI:Ka}=Math,{moveTo:Za,lineTo:Qa,closePath:$a}=is;exports.Polygon=class extends exports.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,r=t/2,i=e/2,o=this.__.path=[];Za(o,r,0);for(let t=1;t<s;t++)Qa(o,r+r*Ga(2*t*Ka/s),i-i*qa(2*t*Ka/s));$a(o)}},gt([Mr(class extends _n{})],exports.Polygon.prototype,"__",void 0),gt([kr(3)],exports.Polygon.prototype,"sides",void 0),exports.Polygon=gt([Gr()],exports.Polygon);const{sin:Ja,cos:th,PI:eh}=Math,{moveTo:sh,lineTo:rh,closePath:ih}=is;exports.Star=class extends exports.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:r}=this.__,i=t/2,o=e/2,n=this.__.path=[];sh(n,i,0);for(let t=1;t<2*s;t++)rh(n,i+(t%2==0?i:i*r)*Ja(t*eh/s),o-(t%2==0?o:o*r)*th(t*eh/s));ih(n)}},gt([Mr(class extends _n{})],exports.Star.prototype,"__",void 0),gt([kr(5)],exports.Star.prototype,"points",void 0),gt([kr(.382)],exports.Star.prototype,"innerRadius",void 0),exports.Star=gt([Gr()],exports.Star);const{moveTo:oh,lineTo:nh}=is,{rotate:ah,getAngle:hh,getDistance:lh,defaultPoint:dh}=C,{setPoint:ch,addPoint:ph,toBounds:uh}=P,_h={};exports.Line=class extends exports.UI{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&ah(s,e),this.__toPoint=s,s}set toPoint(t){this.width=lh(dh,t),this.rotation=hh(dh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];oh(t,0,0);const e=this.toPoint;nh(t,e.x,e.y)}__updateBoxBounds(){ch(_h,0,0),ph(_h,this.__toPoint.x,this.__toPoint.y),uh(_h,this.__layout.boxBounds)}},gt([Mr(class extends _n{})],exports.Line.prototype,"__",void 0),gt([Cr()],exports.Line.prototype,"rotation",void 0),gt([Rr("center")],exports.Line.prototype,"strokeAlign",void 0),exports.Line=gt([Gr()],exports.Line),exports.Image=class extends exports.Rect{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill=e?{type:"image",mode:"strench",url:e}:void 0,this.once(ri.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}},gt([Mr(wn)],exports.Image.prototype,"__",void 0),gt([Cr("")],exports.Image.prototype,"url",void 0),exports.Image=gt([Gr()],exports.Image),exports.Canvas=class extends exports.Rect{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,r){t.__layout.checkUpdate();const i=new T(t.__world);i.invert();const o=new T;e&&o.translate(e.x,e.y),s&&("number"==typeof s?o.scale(s):o.scale(s.x,s.y)),r&&o.rotate(r),i.preMultiply(o),t.__render(this.canvas,{matrix:i}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:r,height:i}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,r,i),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,r,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}},gt([Mr(wn)],exports.Canvas.prototype,"__",void 0),gt([bn(100)],exports.Canvas.prototype,"width",void 0),gt([bn(100)],exports.Canvas.prototype,"height",void 0),gt([bn(t.devicePixelRatio)],exports.Canvas.prototype,"pixelRatio",void 0),gt([bn(!0)],exports.Canvas.prototype,"smooth",void 0),gt([Ar("all")],exports.Canvas.prototype,"hitFill",void 0),exports.Canvas=gt([Gr()],exports.Canvas);const gh=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",fh=gh+"_#~&*+\\=|≮≯≈≠=…",yh=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 xh(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const vh=xh("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),mh=xh("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),wh=xh(gh),Eh=xh(fh),bh=xh("- —/~|┆·");var Bh;!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"}(Bh||(Bh={}));const{Letter:Ch,Single:kh,Before:Rh,After:Th,Symbol:Ph,Break:Lh}=Bh;function Sh(t){return vh[t]?Ch:bh[t]?Lh:mh[t]?Rh:wh[t]?Th:Eh[t]?Ph:yh.test(t)?kh:Ch}const Oh={trimRight(t){const{words:e}=t;let s,r=0,i=e.length;for(let o=i-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)r++,t.width-=s.width;r&&e.splice(i-r,r)}};function Dh(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Ih}=Oh,{Letter:Ah,Single:Mh,Before:Wh,After:Uh,Symbol:Nh,Break:Fh}=Bh;let Hh,zh,Yh,jh,Xh,Vh,Gh,qh,Kh,Zh,Qh,$h,Jh,tl,el=[];function sl(t,e){Hh.data.push({char:t,width:e}),Yh+=e}function rl(){jh+=Yh,Hh.width=Yh,zh.words.push(Hh),Hh={data:[]},Yh=0}function il(){$h&&(Jh.paraNumber++,zh.paraStart=!0,$h=!1),zh.width=jh,tl.width&&Ih(zh),el.push(zh),zh={words:[]},jh=0}const ol=0,nl=1,al=2;const hl={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let r=0,o=0,{width:n,height:a,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(n||(n=0),h){const[t,e,s,l]=i.fourNumber(h);n&&(r=l,n-=e+l),a&&(o=t,a-=t+s)}const p={bounds:{x:r,y:o,width:n,height:a},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,r){Jh=e,el=e.rows,tl=e.bounds;const{__letterSpacing:i,paraIndent:o,textCase:n}=r,{canvas:a}=t,{width:h,height:l}=tl;if(h||l||i||"none"!==n){$h=!0,Kh=null,Yh=jh=0,Hh={data:[]},zh={words:[]};for(let t=0,e=s.length;t<e;t++)Vh=s[t],"\n"===Vh?(Yh&&rl(),zh.paraEnd=!0,il(),$h=!0):(qh=Sh(Vh),qh===Ah&&"none"!==n&&(Vh=Dh(Vh,n,!Yh)),Gh=a.measureText(Vh).width,i&&(Gh+=i),Zh=qh===Mh&&(Kh===Mh||Kh===Ah)||Kh===Mh&&qh!==Uh,Qh=!(qh!==Wh&&qh!==Mh||Kh!==Nh&&Kh!==Uh),Xh=$h&&o?h-o:h,h&&jh+Yh+Gh>Xh&&(Qh||(Qh=qh===Ah&&Kh==Uh),Zh||Qh||qh===Fh||qh===Wh||qh===Mh||Yh+Gh>Xh?(Yh&&rl(),il()):il())," "===Vh&&!0!==$h&&jh+Yh===0||(qh===Fh?(" "===Vh&&Yh&&rl(),sl(Vh,Gh),rl()):Zh||Qh?(Yh&&rl(),sl(Vh,Gh)):sl(Vh,Gh)),Kh=qh);Yh&&rl(),jh&&il(),el.length>0&&(el[el.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{Jh.paraNumber++,el.push({x:o||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(p,e,s),function(t,e){const{rows:s,bounds:r}=t,{__lineHeight:i,__baseLine:o,textAlign:n,verticalAlign:a,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:p,width:u,height:_}=r,g=i*s.length+(h?h*(t.paraNumber-1):0),f=o;if("show"!==l&&g>_)g=Math.max(_,i),t.overflow=s.length;else switch(a){case"middle":p+=(_-g)/2;break;case"bottom":p+=_-g}f+=p;for(let e=0,o=s.length;e<o;e++){switch(d=s[e],d.x=c,n){case"center":d.x+=(u-d.width)/2;break;case"right":d.x+=u-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=i,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1),d.x<r.x&&(r.x=d.x),d.width>r.width&&(r.width=d.width)}r.y=p,r.height=g}(p,s),function(t,e,s,r){const{rows:i}=t,{textAlign:o,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,p;i.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===o&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?ol:l>.01?nl:al,c===al?(t.text="",t.x+=d,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===nl?(p={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,p)," "!==p.char&&t.data.push(p)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(p,s,n),p.overflow&&function(e,s){const{rows:r,overflow:i}=e;if(r.splice(i),"hide"!==s){"ellipsis"===s&&(s="...");const o=t.canvas.measureText(s).width,n=r[i-1];let a,h,l=n.data.length-1;const{x:d,width:c}=e.bounds,p=d+c-o;for(let t=l;t>-1&&(a=n.data[t],h=a.x+a.width,!(t===l&&h<p));t--){if(h<p&&" "!==a.char){n.data.splice(t+1),n.width-=a.width;break}n.width-=a.width}n.width+=o,n.data.push({char:s,x:h})}}(p,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(p,s),p}},{copyAndSpread:ll,includes:dl,spread:cl}=z;exports.Text=class extends exports.UI{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:r}=this.__;t.beginPath(),r.rows.forEach((r=>t.rect(r.x,r.y-s,r.width,e)))}__drawPathByData(t,e){const{x:s,y:r,width:i,height:o}=this.__layout.boxBounds;t.rect(s,r,i,o)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=hl.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:r,lineHeight:i,letterSpacing:o,fontFamily:n,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=gn.number(i,a),t.__letterSpacing=gn.number(o,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${n}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,p=e.boxBounds;t.__lineHeight<a&&cl(c,a/2),s&&r?super.__updateBoxBounds():(p.x=s?0:c.x,p.y=r?0:c.y,p.width=s||c.width,p.height=r||c.height);const u=dl(p,c)?p:c;u!==e.contentBounds&&(e.contentBounds=u,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){ll(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}},gt([Mr(class extends _n{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=mn[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],exports.Text.prototype,"__",void 0),gt([Cr(0)],exports.Text.prototype,"width",void 0),gt([Cr(0)],exports.Text.prototype,"height",void 0),gt([Cr(0)],exports.Text.prototype,"padding",void 0),gt([Rr("outside")],exports.Text.prototype,"strokeAlign",void 0),gt([Cr("")],exports.Text.prototype,"text",void 0),gt([Cr("L")],exports.Text.prototype,"fontFamily",void 0),gt([Cr(12)],exports.Text.prototype,"fontSize",void 0),gt([Cr("normal")],exports.Text.prototype,"fontWeight",void 0),gt([Cr(!1)],exports.Text.prototype,"italic",void 0),gt([Cr("none")],exports.Text.prototype,"textCase",void 0),gt([Cr("none")],exports.Text.prototype,"textDecoration",void 0),gt([Cr(0)],exports.Text.prototype,"letterSpacing",void 0),gt([Cr({type:"percent",value:150})],exports.Text.prototype,"lineHeight",void 0),gt([Cr(0)],exports.Text.prototype,"paraIndent",void 0),gt([Cr(0)],exports.Text.prototype,"paraSpacing",void 0),gt([Cr("left")],exports.Text.prototype,"textAlign",void 0),gt([Cr("top")],exports.Text.prototype,"verticalAlign",void 0),gt([Cr("show")],exports.Text.prototype,"textOverflow",void 0),exports.Text=gt([Gr()],exports.Text);const{toBounds:pl}=ur;exports.Path=class extends exports.UI{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){pl(this.__.path,this.__layout.boxBounds)}},gt([Mr(class extends _n{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=vn(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],exports.Path.prototype,"__",void 0),gt([kr()],exports.Path.prototype,"path",void 0),gt([kr()],exports.Path.prototype,"windingRule",void 0),gt([Rr("center")],exports.Path.prototype,"strokeAlign",void 0),exports.Path=gt([Gr()],exports.Path),exports.Pen=class extends exports.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new exports.Path(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,r,i,o){return this}quadraticCurveTo(t,e,s,r){return this}closePath(){return this}rect(t,e,s,r){return this}roundRect(t,e,s,r,i){return this}ellipse(t,e,s,r,i,o,n,a){return this}arc(t,e,s,r,i,o){return this}arcTo(t,e,s,r,i){return this}moveToEllipse(t,e,s,r,i,o,n,a){return this}moveToArc(t,e,s,r,i,o){return this}paint(){this.pathElement.forceUpdate("path")}},gt([Mr(class extends fn{})],exports.Pen.prototype,"__",void 0),exports.Pen=gt([Vr(ms,["beginPath"]),Gr()],exports.Pen);const ul=Z.get("Leafer");exports.Leafer=class extends exports.Group{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&fo.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,smooth:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let r;this.__setLeafer(this),t&&ct.assign(this.config,t);const{config:i}=this;cn.run(i.type,this),this.canvas=e.canvas(i),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,i),this.watcher=e.watcher(this,i),this.layouter=e.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,s?(this.__bindApp(s),r=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new at,this.hitCanvasManager=new dt,r=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),r&&(this.__startTimer=setTimeout(this.start.bind(this))),Eo.onLeafer(this)}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(di.RESTART):this.emitLeafer(di.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render(),this.running=!0)}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(di.STOP))}resize(t){const e=ct.copyAttrs({},t,Ct);Object.keys(e).forEach((t=>this[t]=e[t]))}forceLayout(){this.__layout.checkUpdate(!0)}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ct.copyAttrs({},this.canvas,Ct);this.canvas.resize(t),this.__onResize(new ii(t,e))}__onResize(t){this.emitEvent(t),ct.copyAttrs(this.__,t,Ct),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.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const r=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),r(),this.viewLoaded||(s=this.on_(hi.FRAME,r))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(Ct.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ct.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ct.copyAttrs({},this.canvas,Ct);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(di.BEFORE_READY),this.emitLeafer(di.READY),this.emitLeafer(di.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(di.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new di(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once(di.START,(()=>J.end(t))),this.once(ai.END,(()=>this.__onReady())),this.once(li.END,(()=>this.__onViewReady())),this.on(ai.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){setTimeout((()=>{if(this.canvas)try{this.stop(),this.emitEvent(new di(di.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>{this.parent&&t===this.interaction||t.destroy()})),this.__controllers.length=0,this.parent||(this.selector.destroy(),this.canvasManager.destroy(),this.hitCanvasManager.destroy()),this.canvas.destroy(),this.config=this.userConfig=this.canvas=this.view=null,this.selector=this.interaction=this.canvasManager=this.hitCanvasManager=null,super.destroy(),setTimeout((()=>{fo.clearRecycled()}),100)}catch(t){ul.error(t)}}),0)}},gt([Mr(class extends fn{})],exports.Leafer.prototype,"__",void 0),gt([Cr()],exports.Leafer.prototype,"pixelRatio",void 0),exports.Leafer=gt([Gr()],exports.Leafer),exports.App=class extends exports.Leafer{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(si.CHANGE,(()=>{Z.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new exports.Leafer(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(ai.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(li.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(li.END,this.__onChildRenderEnd,this))}waitViewLoaded(e){const s=()=>{this.children.every((t=>t.viewLoaded))&&t.requestRender(e)};this.children.forEach((t=>{t.waitViewLoaded(s)})),this.running||this.start()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&ct.assign(e,t),this.autoLayout&&ct.copyAttrs(e,this,Ct),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}},exports.App=gt([Gr()],exports.App);var _l=Object.freeze({__proto__:null,Animate:Tn,AnimateEvent:hi,get App(){return exports.App},AutoBounds:G,BezierHelper:Gt,Bounds:V,BoundsHelper:z,get Box(){return exports.Box},get Branch(){return exports.Branch},BranchHelper:Wi,BranchRender:Bi,get Canvas(){return exports.Canvas},CanvasManager:at,ChildEvent:ei,Creator:e,DataHelper:ct,Debug:Z,get DragEvent(){return exports.DragEvent},get DropEvent(){return exports.DropEvent},Effect:kn,get Ellipse(){return exports.Ellipse},EllipseHelper:se,Event:ti,EventCreator:ot,Export:Pn,FileHelper:_t,get Frame(){return exports.Frame},get Group(){return exports.Group},HitCanvasManager:dt,get Image(){return exports.Image},ImageEvent:ri,ImageManager:fo,IncrementId:s,get KeyEvent(){return exports.KeyEvent},Keyboard:oo,LayoutEvent:ai,Layouter:Wo,get Leaf(){return exports.Leaf},LeafBounds:xi,LeafBoundsHelper:Mi,LeafData:ut,LeafDataProxy:ci,LeafEventer:$r,LeafHelper:Si,LeafHit:wi,LeafLevelList:lt,LeafList:ht,LeafMask:bi,LeafMatrix:gi,LeafRender:Ei,get Leafer(){return exports.Leafer},LeaferCanvas:Yo,LeaferCanvasBase:kt,LeaferEvent:di,LeaferImage:mo,LeaferImageBase:mo,LeaferTypeCreator:cn,get Line(){return exports.Line},MathHelper:i,Matrix:T,MatrixHelper:f,get MoveEvent(){return exports.MoveEvent},NeedConvertToCanvasCommandMap:St,OneRadian:o,PI2:n,PI_2:a,Paint:Rn,get Path(){return exports.Path},PathBounds:ur,PathCommandDataHelper:is,PathCommandMap:Pt,PathConvert:Fe,PathCorner:_r,PathCreator:ms,PathDrawer:As,PathHelper:Rt,PathNumberCommandLengthMap:At,PathNumberCommandMap:It,get Pen(){return exports.Pen},Platform:t,PluginManager:Eo,Point:R,PointHelper:C,PointerButton:no,get PointerEvent(){return exports.PointerEvent},get Polygon(){return exports.Polygon},PropertyEvent:si,get Rect(){return exports.Rect},RectHelper:Mt,RectRender:Ua,RenderEvent:li,Renderer:No,ResizeEvent:ii,get RotateEvent(){return exports.RotateEvent},Run:J,Selector:zo,get Star(){return exports.Star},StringNumberMap:K,get SwipeEvent(){return exports.SwipeEvent},TaskItem:_o,TaskProcessor:go,get Text(){return exports.Text},TransformEvent:oi,TwoPointBounds:q,TwoPointBoundsHelper:P,get UI(){return exports.UI},UIBounds:Bn,UICreator:st,UIEvent:ho,UIHit:Cn,UIRender:Wa,WaitHelper:Fi,WatchEvent:ni,Watcher:Bo,get ZoomEvent(){return exports.ZoomEvent},affectRenderBoundsType:Pr,affectStrokeBoundsType:Rr,aliasType:vr,boundsType:Cr,canvasPatch:fr,canvasSizeAttrs:Ct,dataProcessor:Mr,dataType:wr,defineDataProcessor:Nr,defineKey:yr,defineLeafAttr:mr,effectType:En,eraserType:Ir,getDescriptor:xr,hitType:Ar,layoutProcessor:Wr,maskType:Dr,opacityType:Sr,pathType:kr,positionType:Er,registerUI:Gr,registerUIEvent:qr,resizeType:bn,rewrite:Yr,rewriteAble:jr,rotationType:Br,scaleType:br,setDefaultValue:Ur,sortType:Or,strokeType:Tr,surfaceType:Lr,useCanvas:ln,useModule:Vr,usePlugin:bo});Eo.power=_l,exports.Animate=Tn,exports.AnimateEvent=hi,exports.AutoBounds=G,exports.BezierHelper=Gt,exports.Bounds=V,exports.BoundsHelper=z,exports.BranchHelper=Wi,exports.BranchRender=Bi,exports.CanvasManager=at,exports.ChildEvent=ei,exports.Creator=e,exports.DataHelper=ct,exports.Debug=Z,exports.Effect=kn,exports.EllipseHelper=se,exports.Event=ti,exports.EventCreator=ot,exports.Export=Pn,exports.FileHelper=_t,exports.HitCanvasManager=dt,exports.ImageEvent=ri,exports.ImageManager=fo,exports.IncrementId=s,exports.Keyboard=oo,exports.LayoutEvent=ai,exports.Layouter=Wo,exports.LeafBounds=xi,exports.LeafBoundsHelper=Mi,exports.LeafData=ut,exports.LeafDataProxy=ci,exports.LeafEventer=$r,exports.LeafHelper=Si,exports.LeafHit=wi,exports.LeafLevelList=lt,exports.LeafList=ht,exports.LeafMask=bi,exports.LeafMatrix=gi,exports.LeafRender=Ei,exports.LeaferCanvas=Yo,exports.LeaferCanvasBase=kt,exports.LeaferEvent=di,exports.LeaferImage=mo,exports.LeaferImageBase=mo,exports.LeaferTypeCreator=cn,exports.MathHelper=i,exports.Matrix=T,exports.MatrixHelper=f,exports.NeedConvertToCanvasCommandMap=St,exports.OneRadian=o,exports.PI2=n,exports.PI_2=a,exports.Paint=Rn,exports.PathBounds=ur,exports.PathCommandDataHelper=is,exports.PathCommandMap=Pt,exports.PathConvert=Fe,exports.PathCorner=_r,exports.PathCreator=ms,exports.PathDrawer=As,exports.PathHelper=Rt,exports.PathNumberCommandLengthMap=At,exports.PathNumberCommandMap=It,exports.Platform=t,exports.PluginManager=Eo,exports.Point=R,exports.PointHelper=C,exports.PointerButton=no,exports.PropertyEvent=si,exports.RectHelper=Mt,exports.RectRender=Ua,exports.RenderEvent=li,exports.Renderer=No,exports.ResizeEvent=ii,exports.Run=J,exports.Selector=zo,exports.StringNumberMap=K,exports.TaskItem=_o,exports.TaskProcessor=go,exports.TransformEvent=oi,exports.TwoPointBounds=q,exports.TwoPointBoundsHelper=P,exports.UIBounds=Bn,exports.UICreator=st,exports.UIEvent=ho,exports.UIHit=Cn,exports.UIRender=Wa,exports.WaitHelper=Fi,exports.WatchEvent=ni,exports.Watcher=Bo,exports.affectRenderBoundsType=Pr,exports.affectStrokeBoundsType=Rr,exports.aliasType=vr,exports.boundsType=Cr,exports.canvasPatch=fr,exports.canvasSizeAttrs=Ct,exports.dataProcessor=Mr,exports.dataType=wr,exports.defineDataProcessor=Nr,exports.defineKey=yr,exports.defineLeafAttr=mr,exports.effectType=En,exports.eraserType=Ir,exports.getDescriptor=xr,exports.hitType=Ar,exports.layoutProcessor=Wr,exports.maskType=Dr,exports.opacityType=Sr,exports.pathType=kr,exports.positionType=Er,exports.registerUI=Gr,exports.registerUIEvent=qr,exports.resizeType=bn,exports.rewrite=Yr,exports.rewriteAble=jr,exports.rotationType=Br,exports.scaleType=br,exports.setDefaultValue=Ur,exports.sortType=Or,exports.strokeType=Tr,exports.surfaceType=Lr,exports.useCanvas=ln,exports.useModule=Vr,exports.usePlugin=bo;
|
|
1
|
+
"use strict";const t={imageSuffix:"leaf"},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,i={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,r,i;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=r=t[0],s=i=t[1];break;case 3:e=t[0],s=i=t[1],r=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,r,i]}},o=Math.PI/180,n=2*Math.PI,a=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:p,PI:u}=Math,_={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:g,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r=s){y.toInnerPoint(t,e,_),y.scaleOfInner(t,_,s,r)},scaleOfInner(t,e,s,r=s){y.translateInner(t,e.x,e.y),y.scale(t,s,r),y.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=o),r=h(e),{a:i,b:n,c:a,d:d}=t;t.a=i*s-n*r,t.b=i*r+n*s,t.c=a*s-d*r,t.d=a*r+d*s},rotateOfOuter(t,e,s){y.toInnerPoint(t,e,_),y.rotateOfInner(t,_,s)},rotateOfInner(t,e,s){y.translateInner(t,e.x,e.y),y.rotate(t,s),y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:a}=t;s&&(s*=o,t.a=r+n*s,t.b=i+a*s),e&&(e*=o,t.c=n+r*e,t.d=a+i*e)},skewOfOuter(t,e,s,r){y.toInnerPoint(t,e,_),y.skewOfInner(t,_,s,r)},skewOfInner(t,e,s,r){y.translateInner(t,e.x,e.y),y.skew(t,s,r),y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+n,t.f=e.e*r+e.f*o+a},preMultiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+r*e.c,t.b=s*e.b+r*e.d,t.c=i*e.a+o*e.c,t.d=i*e.b+o*e.d),t.e=n*e.a+a*e.c+e.e,t.f=n*e.b+a*e.d+e.f},divide(t,e){y.multiply(t,y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=y;return y.copy(e,t),y.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=t,a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{x:i,y:o}=e,{a:n,b:a,c:h,d:l}=t,d=1/(n*l-a*h);if(s||(s=e),s.x=(i*l-o*h)*d,s.y=(o*n-i*a)*d,!r){const{e:e,f:r}=t;s.x-=(e*l-r*h)*d,s.y-=(r*n-e*a)*d}},decompose(t){const{a:e,b:s,c:r,d:i}=t;let n=e,a=i,h=0,l=0,_=0;if(s||r){const t=e*i-s*r,g=e*r+s*i;if(s){const r=e*e+s*s;n=p(r),a=t/n;const i=e/n;h=s>0?d(i):-d(i),l=c(g/r)/o}else{const e=r*r+i*i;a=p(e),n=t/a;const s=r/a;h=u/2-(i>0?d(-s):-d(s)),_=c(g/e)/o}h/=o}return{x:t.e,y:t.f,scaleX:n,scaleY:a,rotation:h,skewX:l,skewY:_}},reset(t){y.set(t)}},y=f,{toInnerPoint:x,toOuterPoint:v}=f,{sin:m,cos:w,abs:E,sqrt:b,atan2:B}=Math,C={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=k.defaultPoint);const r=w(e*o),i=m(e*o),n=t.x-s.x,a=t.y-s.y;t.x=s.x+n*r-a*i,t.y=s.y+n*i+a*r},tempToInnerOf(t,e){const{tempPoint:s}=k;return k.copy(s,t),x(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=k;return k.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=k;return k.copy(s,t),k.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),x(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){x(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=E(e.x-t.x),r=E(e.y-t.y);return b(s*s+r*r)},getAngle:(t,e)=>k.getAtan2(t,e)/o,getAtan2:(t,e)=>B(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const r=k.getAtan2(t,e);return{x:t.x+w(r)*s,y:t.y+m(r)*s}},reset(t){k.reset(t)}},k=C;class R{constructor(t,e){"object"==typeof t?C.copy(this,t):C.set(this,t,e)}set(t,e){C.set(this,t,e)}copy(t){return C.copy(this,t),this}clone(){return new R(this)}rotate(t,e){return C.rotate(this,t,e),this}toInnerOf(t,e){return C.toInnerOf(this,t,e),this}toOuterOf(t,e){return C.toOuterOf(this,t,e),this}getCenter(t){return C.getCenter(this,t)}getDistance(t){return C.getDistance(this,t)}getAngle(t){return C.getAngle(this,t)}getAtan2(t){return C.getAtan2(this,t)}reset(){C.reset(this)}}class T{constructor(t,e,s,r,i,o){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,r,i,o)}set(t,e,s,r,i,o){f.set(this,t,e,s,r,i,o)}copy(t){return f.copy(this,t),this}clone(){return new T(this)}translate(t,e){return f.translate(this,t,e),this}translateInner(t,e){return f.translateInner(this,t,e),this}scale(t,e){return f.scale(this,t,e),this}scaleOfOuter(t,e,s){return f.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return f.scaleOfInner(this,t,e,s),this}rotate(t){return f.rotate(this,t),this}rotateOfOuter(t,e){return f.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return f.rotateOfInner(this,t,e),this}skew(t,e){return f.skew(this,t,e),this}skewOfOuter(t,e,s){return f.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return f.skewOfInner(this,t,e,s),this}multiply(t){return f.multiply(this,t),this}preMultiply(t){return f.preMultiply(this,t),this}divide(t){return f.divide(this,t),this}invert(){return f.invert(this),this}toOuterPoint(t,e){f.toOuterPoint(this,t,e)}toInnerPoint(t,e){f.toInnerPoint(this,t,e)}decompose(){return f.decompose(this)}reset(){f.reset(this)}}const P={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,r,i){L(t,e,s),L(t,e+r,s+i)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},add(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:L}=P,{tempPointBounds:S,setPoint:O,addPoint:D,toBounds:I}=P,{toOuterPoint:A}=f;let M,W,U,N;const F={},H={},z={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){Y.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),Y.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(Y.right(s)-t.x),e.offsetY=-(Y.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Y.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(Y.copy(Y.tempBounds,t),Y.toOuterOf(Y.tempBounds,e),Y.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),Y.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else F.x=t.x,F.y=t.y,A(e,F,H),O(S,H.x,H.y),F.x=t.x+t.width,A(e,F,H),D(S,H.x,H.y),F.y=t.y+t.height,A(e,F,H),D(S,H.x,H.y),F.x=t.x,A(e,F,H),D(S,H.x,H.y),I(S,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new T(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return Y.copyAndSpread(s,t,e),s},spread(t,e){Y.copyAndSpread(t,t,e)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(t.height)},add(t,e){M=t.x+t.width,W=t.y+t.height,U=e.x+e.width,N=e.y+e.height,M=M>U?M:U,W=W>N?W:N,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=M-t.x,t.height=W-t.y},addList(t,e){Y.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){Y.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){Y.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||X(t,i)):j(t,i));o&&Y.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?O(S,t.x,t.y):D(S,t.x,t.y)})),I(S,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=C.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=C.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Y.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=Y.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){s&&(e=Y.tempToOuterOf(e,s));let{x:r,y:i,width:o,height:n}=e;return M=r+o,W=i+n,U=t.x+t.width,N=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,M=M<U?M:U,W=W<N?W:N,o=M-r,n=W-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){Y.copy(t,Y.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Y.set(t)}},Y=z,{add:j,copy:X}=Y;class V{constructor(t,e,s,r){"object"==typeof t?z.copy(this,t):z.set(this,t,e,s,r)}set(t,e,s,r){z.set(this,t,e,s,r)}copy(t){return z.copy(this,t),this}clone(){return new V(this)}scale(t){return z.scale(this,t),this}toOuterOf(t,e){return z.toOuterOf(this,t,e),this}getFitMatrix(t){return z.getFitMatrix(this,t)}spread(t){return z.spread(this,t),this}ceil(){return z.ceil(this),this}add(t){return z.add(this,t),this}addList(t){return z.setByList(this,t,!0),this}setByList(t,e){return z.setByList(this,t,e),this}addListWithHandle(t,e){return z.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return z.setByListWithHandle(this,t,e,s),this}setByPoints(t){return z.setByPoints(this,t),this}hitPoint(t,e){return z.hitPoint(this,t,e)}hitRadiusPoint(t,e){return z.hitRadiusPoint(this,t,e)}hit(t,e){return z.hit(this,t,e)}includes(t,e){return z.includes(this,t,e)}intersect(t,e){return z.intersect(this,t,e),this}getIntersect(t,e){return new V(z.getIntersectData(this,t,e))}isSame(t){return z.isSame(this,t)}isEmpty(){return z.isEmpty(this)}reset(){z.reset(this)}}class G{constructor(t,e,s,r,i,o){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,o)}set(t=0,e=0,s=0,r=0,i=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=o}copy(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new V(i,e,o||t.width-i-s,n||t.height-e-r)}}class q{constructor(t,e){P.setPoint(this,t,e)}addPoint(t,e){P.addPoint(this,t,e)}addBounds(t,e,s,r){P.addBounds(this,t,e,s,r)}add(t){P.add(this,t)}}const K={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};class Z{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Z(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(Q.enable){if(Q.filterList.length&&Q.filterList.every((t=>t!==this.name)))return;if(Q.excludeList.length&&Q.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){Q.enable&&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)}}}Z.filterList=[],Z.excludeList=[];const Q=Z,$=Z.get("RunTime");class J{static start(t,e){const r=s.create(s.RUNTIME);return tt.currentId=tt.idMap[r]=e?performance.now():Date.now(),tt.currentName=tt.nameMap[r]=t,tt.nameToIdMap[t]=r,r}static end(t,e){const s=tt.idMap[t],r=tt.nameMap[t];tt.idMap[t]=tt.nameMap[t]=tt.nameToIdMap[r]=void 0,e?$.log(r,performance.now()-s,"µs"):$.log(r,Date.now()-s,"ms")}static endOfName(t,e){const s=tt.nameToIdMap[t];void 0!==s&&tt.end(s,e)}}J.idMap={},J.nameMap={},J.nameToIdMap={};const tt=J,et=Z.get("UICreator"),st={list:{},register(t){const{__tag:e}=t.prototype;rt[e]?et.repeat(e):rt[e]=t},get(t,e,s,r,i,o){const n=new rt[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:rt}=st,it=Z.get("EventCreator"),ot={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(nt[e]?it.repeat(e):nt[e]=t)}))},changeName(t,e){const s=nt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,nt[e]=s)}},get:(t,...e)=>new nt[t](...e)},{nameList:nt}=ot;class at{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.canvas(t);return this.add(i),i}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class ht{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ht;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class lt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class dt extends at{constructor(){super(...arguments),this.pathTypeList=new ht,this.imageTypeList=new ht}getImageType(t,s){return this.imageTypeList.push(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.push(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}clear(){this.clearPathType(),this.clearImageType()}}const ct={default:(t,e)=>(pt(e,t),pt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?pt(t[r],e[r]):t[r]=e[r]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:pt}=ct;class ut{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];return void 0===e?this[t]:e}return this[t]}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];return void 0===e?this["_"+t]:e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={},{__input:e}=this;let s,r;for(let i in this)s=i.substring(1),void 0!==this[s]&&(r=e?e[s]:void 0,t[s]=void 0===r?this[i]:r);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__input=this.__middle=null}}const _t={mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]}};function gt(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function ft(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((r=r.apply(t,e||[])).next())}))}function yt(t){return(e,s)=>{t||(t=s);const r={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,r)}}const xt=[];function vt(){return(t,e)=>{xt.push(e)}}const mt=[];class wt{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||mt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,n,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}gt([yt("imageSmoothingEnabled")],wt.prototype,"smooth",void 0),gt([yt("imageSmoothingQuality")],wt.prototype,"smoothLevel",void 0),gt([yt("globalAlpha")],wt.prototype,"opacity",void 0),gt([yt()],wt.prototype,"fillStyle",void 0),gt([yt()],wt.prototype,"strokeStyle",void 0),gt([yt("lineWidth")],wt.prototype,"strokeWidth",void 0),gt([yt("lineCap")],wt.prototype,"strokeCap",void 0),gt([yt("lineJoin")],wt.prototype,"strokeJoin",void 0),gt([yt("lineDashOffset")],wt.prototype,"dashOffset",void 0),gt([yt()],wt.prototype,"miterLimit",void 0),gt([yt()],wt.prototype,"shadowBlur",void 0),gt([yt()],wt.prototype,"shadowColor",void 0),gt([yt()],wt.prototype,"shadowOffsetX",void 0),gt([yt()],wt.prototype,"shadowOffsetY",void 0),gt([yt()],wt.prototype,"filter",void 0),gt([yt()],wt.prototype,"font",void 0),gt([yt()],wt.prototype,"fontKerning",void 0),gt([yt()],wt.prototype,"fontStretch",void 0),gt([yt()],wt.prototype,"fontVariantCaps",void 0),gt([yt()],wt.prototype,"textAlign",void 0),gt([yt()],wt.prototype,"textBaseline",void 0),gt([yt()],wt.prototype,"textRendering",void 0),gt([yt()],wt.prototype,"wordSpacing",void 0),gt([yt()],wt.prototype,"letterSpacing",void 0),gt([yt()],wt.prototype,"direction",void 0),gt([vt()],wt.prototype,"setTransform",null),gt([vt()],wt.prototype,"resetTransform",null),gt([vt()],wt.prototype,"getTransform",null),gt([vt()],wt.prototype,"save",null),gt([vt()],wt.prototype,"restore",null),gt([vt()],wt.prototype,"translate",null),gt([vt()],wt.prototype,"scale",null),gt([vt()],wt.prototype,"rotate",null),gt([vt()],wt.prototype,"fill",null),gt([vt()],wt.prototype,"stroke",null),gt([vt()],wt.prototype,"clip",null),gt([vt()],wt.prototype,"fillRect",null),gt([vt()],wt.prototype,"strokeRect",null),gt([vt()],wt.prototype,"clearRect",null),gt([vt()],wt.prototype,"beginPath",null),gt([vt()],wt.prototype,"moveTo",null),gt([vt()],wt.prototype,"lineTo",null),gt([vt()],wt.prototype,"bezierCurveTo",null),gt([vt()],wt.prototype,"quadraticCurveTo",null),gt([vt()],wt.prototype,"closePath",null),gt([vt()],wt.prototype,"arc",null),gt([vt()],wt.prototype,"arcTo",null),gt([vt()],wt.prototype,"ellipse",null),gt([vt()],wt.prototype,"rect",null),gt([vt()],wt.prototype,"roundRect",null),gt([vt()],wt.prototype,"createConicGradient",null),gt([vt()],wt.prototype,"createLinearGradient",null),gt([vt()],wt.prototype,"createPattern",null),gt([vt()],wt.prototype,"createRadialGradient",null),gt([vt()],wt.prototype,"fillText",null),gt([vt()],wt.prototype,"measureText",null),gt([vt()],wt.prototype,"strokeText",null);const Et=new V,bt={width:1,height:1,pixelRatio:1},Bt=Z.get("LeaferCanvasBase"),Ct=["width","height","pixelRatio"];class kt extends wt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.worldTransform={},e||(e=bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.pixelRatio=n,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((r=>{const i=this.getSaveCanvas(e);t.origin.canvasToBolb(i.view,e,s).then((t=>{i.recycle(),r(t)})).catch((t=>{Bt.error(t),r(null)}))}))}toDataURL(e,s){const r=this.getSaveCanvas(e),i=t.origin.canvasToDataURL(r.view,e,s);return r.recycle(),i}saveAs(e,s){return new Promise((r=>{const i=this.getSaveCanvas(_t.fileType(e));t.origin.canvasSaveAs(i.view,e,s).then((()=>{i.recycle(),r(!0)})).catch((t=>{Bt.error(t),r(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,r=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&r.fillWorld(s,"#FFFFFF"),e&&r.fillWorld(s,e),r.copyWorld(this),r}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),ct.copyAttrs(this,t,Ct),this.bounds=new V(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:r}=this,i=this.worldTransform;if(e)if(s)this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=(t.e+e.e)*r,i.f=(t.f+e.f)*r);else{const{a:s,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(i.a=(t.a*s+t.b*n)*r,i.b=(t.a*o+t.b*a)*r,i.c=(t.c*s+t.d*n)*r,i.d=(t.c*o+t.d*a)*r,i.e=(t.e*s+t.f*n+h)*r,i.f=(t.e*o+t.f*a+l)*r)}else this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=t.e*r,i.f=t.f*r)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,z.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,Et.copy(t).scale(this.pixelRatio),this.fillRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Et.copy(t).scale(this.pixelRatio),this.strokeRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Et.copy(t).scale(this.pixelRatio),e&&Et.ceil(),this.clearRect(Et.x,Et.y,Et.width,Et.height)}clipWorld(t,e){this.beginPath(),Et.copy(t).scale(this.pixelRatio),e&&Et.ceil(),this.rect(Et.x,Et.y,Et.width,Et.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:r,pixelRatio:i}=this,o={width:s,height:r,pixelRatio:i},n=this.manager?this.manager.get(o):e.canvas(o);if(n.save(),t){const t=this.worldTransform;n.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return n}getBiggerCanvas(t,s){let{width:r,height:i,pixelRatio:o}=this;t&&(r+=t),s&&(i+=s);const n={width:r,height:i,pixelRatio:o},a=this.manager?this.manager.get(n):e.canvas(n);return a.save(),a}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Rt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Tt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Pt=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},Tt),Lt={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},St={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},Ot=Object.assign(Object.assign({},St),Tt),Dt=Pt,It={};for(let t in Dt)It[Dt[t]]=t;const At={};for(let t in Dt)At[Dt[t]]=Lt[t];const Mt={drawRoundRect(t,e,s,r,o,n){let[a,h,l,d]=i.fourNumber(n);const c=Math.min(r/2,o/2);a>c&&(a=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),a?t.moveTo(e+a,s):t.moveTo(e,s),h?t.arcTo(e+r,s,e+r,s+o,h):t.lineTo(e+r,s),l?t.arcTo(e+r,s+o,e,s+o,l):t.lineTo(e+r,s+o),d?t.arcTo(e,s+o,e,s,d):t.lineTo(e,s+o),a?t.arcTo(e,s,e+r,s,a):t.lineTo(e,s)}},{sin:Wt,cos:Ut,atan2:Nt,ceil:Ft,abs:Ht,PI:zt}=Math,{setPoint:Yt,addPoint:jt}=P,{set:Xt}=C,Vt={},Gt={rect(t,e,s,r,i){Rt.creator.path=t,Rt.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,o){Rt.creator.path=[],Mt.drawRoundRect(Rt.creator,e,s,r,i,o),t.push(...Rt.convertToCanvasData(Rt.creator.path,!0))},arcTo(t,e,s,r,i,h,l,d,c,p,u){const _=r-e,g=i-s,f=h-r,y=l-i;let x=Nt(g,_),v=Nt(y,f),m=v-x;if(m<0&&(m+=n),m===zt||Ht(_+g)<1e-12||Ht(f+y)<1e-12)return t&&t.push(Pt.L,r,i),c&&(Yt(c,e,s),jt(c,r,i)),u&&Xt(u,e,s),void(p&&Xt(p,r,i));const w=_*y-f*g<0,E=w?-1:1,b=d/Ut(m/2),B=r+b*Ut(x+m/2+a*E),C=i+b*Wt(x+m/2+a*E);return x-=a*E,v-=a*E,Zt(t,B,C,d,d,0,x/o,v/o,w,c,p,u)},arc:(t,e,s,r,i,o,n,a,h,l)=>Zt(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,h,l,d,c,p,u,_){const g=h*o,f=Wt(g),y=Ut(g);let x=l*o,v=d*o;x>zt&&(x-=n),v<0&&(v+=n);let m=v-x;m<0?m+=n:m>n&&(m-=n),c&&(m-=n);const w=Ft(Ht(m/a)),E=m/w,b=Wt(E/4),B=8/3*b*b/Wt(E/2);v=x+E;let C,k,R,T,P,L,S,O,D=Ut(x),I=Wt(x),A=R=y*r*D-f*i*I,M=T=f*r*D+y*i*I,W=e+R,U=s+T;t&&t.push(Pt.L,W,U),p&&Yt(p,W,U),_&&Xt(_,W,U);for(let o=0;o<w;o++)C=Ut(v),k=Wt(v),R=y*r*C-f*i*k,T=f*r*C+y*i*k,P=e+A-B*(y*r*I+f*i*D),L=s+M-B*(f*r*I-y*i*D),S=e+R+B*(y*r*k+f*i*C),O=s+T+B*(f*r*k-y*i*C),t&&t.push(Pt.C,P,L,S,O,e+R,s+T),p&&Kt(e+A,s+M,P,L,S,O,e+R,s+T,p,!0),A=R,M=T,D=C,I=k,x=v,v+=E;u&&Xt(u,e+R,s+T)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(Pt.C,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){Kt(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let c,p,u,_,g,f,y,x,v=t,m=s,w=i,E=n;for(let t=0;t<2;++t)if(1==t&&(v=e,m=r,w=o,E=a),c=-3*v+9*m-9*w+3*E,p=6*v-12*m+6*w,u=3*m-3*v,Math.abs(c)<1e-12){if(Math.abs(p)<1e-12)continue;_=-u/p,0<_&&_<1&&d.push(_)}else y=p*p-4*u*c,x=Math.sqrt(y),y<0||(g=(-p+x)/(2*c),0<g&&g<1&&d.push(g),f=(-p-x)/(2*c),0<f&&f<1&&d.push(f));l?jt(h,t,e):Yt(h,t,e),jt(h,n,a);for(let l=0,c=d.length;l<c;l++)qt(d[l],t,e,s,r,i,o,n,a,Vt),jt(h,Vt.x,Vt.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,c=d*d*d,p=3*d*d*t,u=3*d*t*t,_=t*t*t;l.x=c*e+p*r+u*o+_*a,l.y=c*s+p*i+u*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return qt(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:qt,toTwoPointBounds:Kt,ellipse:Zt}=Gt,{sin:Qt,cos:$t,sqrt:Jt,atan2:te}=Math,{ellipse:ee}=Gt,se={ellipticalArc(t,e,s,r,i,a,h,l,d,c,p){const u=(d-e)/2,_=(c-s)/2,g=a*o,f=Qt(g),y=$t(g),x=-y*u-f*_,v=-y*_+f*u,m=r*r,w=i*i,E=v*v,b=x*x,B=m*w-m*E-w*b;let C=0;if(B<0){const t=Jt(1-B/(m*w));r*=t,i*=t}else C=(h===l?-1:1)*Jt(B/(m*E+w*b));const k=C*r*v/i,R=-C*i*x/r,T=te((v-R)/i,(x-k)/r),P=te((-v-R)/i,(-x-k)/r);let L=P-T;0===l&&L>0?L-=n:1===l&&L<0&&(L+=n);const S=e+u+y*k-f*R,O=s+_+f*k+y*R,D=L<0?1:0;p?ee(t,S,O,r,i,a,T/o,P/o,D):r!==i||a?t.push(Pt.G,S,O,r,i,a,T/o,P/o,D):t.push(Pt.O,S,O,r,T/o,P/o,D)}},{M:re,m:ie,L:oe,l:ne,H:ae,h:he,V:le,v:de,C:ce,c:pe,S:ue,s:_e,Q:ge,q:fe,T:ye,t:xe,A:ve,a:me,Z:we,z:Ee,N:be,D:Be,X:Ce,G:ke,F:Re,O:Te,P:Pe,U:Le}=Pt,{rect:Se,roundRect:Oe,arcTo:De,arc:Ie,ellipse:Ae,quadraticCurveTo:Me}=Gt,{ellipticalArc:We}=se,Ue=Z.get("PathConvert"),Ne={},Fe={current:{dot:0},stringify(t){let e,s,r,i=0,o=t.length,n="";for(;i<o;){s=t[i],e=At[s],n+=s===r?" ":It[s];for(let s=1;s<e;s++)n+=t[i+s],s===e-1||(n+=" ");r=s,i+=e}return n},parse(t,e){let s,r,i,o="";const n=[],a=e?Ot:St;for(let e=0,h=t.length;e<h;e++)r=t[e],K[r]?("."===r&&(He.dot++,He.dot>1&&(ze(n,o),o="")),o+=r):Pt[r]?(o&&(ze(n,o),o=""),He.name=Pt[r],He.length=Lt[r],He.index=0,ze(n,He.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&ze(n,o),o=r):o&&(ze(n,o),o=""),i=r;return o&&ze(n,o),s?Fe.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,c=0,p=t.length;const u=[];for(;c<p;){switch(i=t[c],i){case ie:t[c+1]+=a,t[c+2]+=h;case re:a=t[c+1],h=t[c+2],u.push(re,a,h),c+=3;break;case he:t[c+1]+=a;case ae:a=t[c+1],u.push(oe,a,h),c+=2;break;case de:t[c+1]+=h;case le:h=t[c+1],u.push(oe,a,h),c+=2;break;case ne:t[c+1]+=a,t[c+2]+=h;case oe:a=t[c+1],h=t[c+2],u.push(oe,a,h),c+=3;break;case _e:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=ue;case ue:n=o===ce||o===ue,l=n?2*a-s:t[c+1],d=n?2*h-r:t[c+2],s=t[c+1],r=t[c+2],a=t[c+3],h=t[c+4],u.push(ce,l,d,s,r,a,h),c+=5;break;case pe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,i=ce;case ce:s=t[c+3],r=t[c+4],a=t[c+5],h=t[c+6],u.push(ce,t[c+1],t[c+2],s,r,a,h),c+=7;break;case xe:t[c+1]+=a,t[c+2]+=h,i=ye;case ye:n=o===ge||o===ye,s=n?2*a-s:t[c+1],r=n?2*h-r:t[c+2],e?Me(u,a,h,s,r,t[c+1],t[c+2]):u.push(ge,s,r,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case fe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=ge;case ge:s=t[c+1],r=t[c+2],e?Me(u,a,h,s,r,t[c+3],t[c+4]):u.push(ge,s,r,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case me:t[c+6]+=a,t[c+7]+=h;case ve:We(u,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 Ee:case we:u.push(we),c++;break;case be:a=t[c+1],h=t[c+2],e?Se(u,a,h,t[c+3],t[c+4]):Ye(u,t,c,5),c+=5;break;case Be:a=t[c+1],h=t[c+2],e?Oe(u,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ye(u,t,c,9),c+=9;break;case Ce:a=t[c+1],h=t[c+2],e?Oe(u,a,h,t[c+3],t[c+4],t[c+5]):Ye(u,t,c,6),c+=6;break;case ke:Ae(e?u:Ye(u,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,Ne),a=Ne.x,h=Ne.y,c+=9;break;case Re:e?Ae(u,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ye(u,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Te:Ie(e?u:Ye(u,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ne),a=Ne.x,h=Ne.y,c+=7;break;case Pe:e?Ie(u,t[c+1],t[c+2],t[c+3],0,360,!1):Ye(u,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Le:De(e?u:Ye(u,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ne),a=Ne.x,h=Ne.y,c+=6;break;default:return Ue.error(`command: ${i} [index:${c}]`,t),u}o=i}return u},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){He.index===He.length&&(He.index=1,t.push(He.name)),t.push(Number(e)),He.index++,He.dot=0}},{current:He,pushData:ze,copyData:Ye}=Fe,{M:je,L:Xe,C:Ve,Q:Ge,Z:qe,N:Ke,D:Ze,X:Qe,G:$e,F:Je,O:ts,P:es,U:ss}=Pt,rs={},is={beginPath(t){t.length=0},moveTo(t,e,s){t.push(je,e,s)},lineTo(t,e,s){t.push(Xe,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(Ve,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(Ge,e,s,r,i)},closePath(t){t.push(qe)},rect(t,e,s,r,i){t.push(Ke,e,s,r,i)},roundRect(t,e,s,r,o,n){if("number"==typeof n)t.push(Qe,e,s,r,o,n);else{const a=i.fourNumber(n);a?t.push(Ze,e,s,r,o,...a):t.push(Ke,e,s,r,o)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Je,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push($e,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(es,e,s,r):(void 0===o&&(o=360),t.push(ts,e,s,r,i,o,n?1:0))},moveToEllipse(t,e,s,r,i,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),Gt.ellipse(null,e,s,r,i,o,n,a,h,null,null,rs),t.push(je,rs.x,rs.y),os(t,e,s,r,i,o,n,a,h)},moveToArc(t,e,s,r,i,o,n){void 0===i&&(i=0),void 0===o&&(o=360),Gt.arc(null,e,s,r,i,o,n,null,null,rs),t.push(je,rs.x,rs.y),ns(t,e,s,r,i,o,n)},arcTo(t,e,s,r,i,o){t.push(ss,e,s,r,i,o)}},{ellipse:os,arc:ns}=is,{moveTo:as,lineTo:hs,quadraticCurveTo:ls,bezierCurveTo:ds,closePath:cs,beginPath:ps,rect:us,roundRect:_s,ellipse:gs,arc:fs,arcTo:ys,moveToEllipse:xs,moveToArc:vs}=is;class ms{constructor(t){this.path=t?"string"==typeof t?Rt.parse(t):t:[]}beginPath(){return ps(this.path),this}moveTo(t,e){return as(this.path,t,e),this}lineTo(t,e){return hs(this.path,t,e),this}bezierCurveTo(t,e,s,r,i,o){return ds(this.path,t,e,s,r,i,o),this}quadraticCurveTo(t,e,s,r){return ls(this.path,t,e,s,r),this}closePath(){return cs(this.path),this}rect(t,e,s,r){return us(this.path,t,e,s,r),this}roundRect(t,e,s,r,i){return _s(this.path,t,e,s,r,i),this}ellipse(t,e,s,r,i,o,n,a){return gs(this.path,t,e,s,r,i,o,n,a),this}arc(t,e,s,r,i,o){return fs(this.path,t,e,s,r,i,o),this}arcTo(t,e,s,r,i){return ys(this.path,t,e,s,r,i),this}moveToEllipse(t,e,s,r,i,o,n,a){return xs(this.path,t,e,s,r,i,o,n,a),this}moveToArc(t,e,s,r,i,o){return vs(this.path,t,e,s,r,i,o),this}}const{M:ws,L:Es,C:bs,Q:Bs,Z:Cs,N:ks,D:Rs,X:Ts,G:Ps,F:Ls,O:Ss,P:Os,U:Ds}=Pt,Is=Z.get("PathDrawer"),As={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case ws:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Es:t.lineTo(e[r+1],e[r+2]),r+=3;break;case bs:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case Bs:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Cs:t.closePath(),r+=1;break;case ks:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Rs:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case Ts:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case Ps:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*o,e[r+6]*o,e[r+7]*o,e[r+8]),r+=9;break;case Ls:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,n,!1),r+=5;break;case Ss:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*o,e[r+5]*o,e[r+6]),r+=7;break;case Os:t.arc(e[r+1],e[r+2],e[r+3],0,n,!1),r+=4;break;case Ds:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void Is.error(`command: ${s} [index:${r}]`,e)}}},{M:Ms,L:Ws,C:Us,Q:Ns,Z:Fs,N:Hs,D:zs,X:Ys,G:js,F:Xs,O:Vs,P:Gs,U:qs}=Pt,{toTwoPointBounds:Ks,toTwoPointBoundsByQuadraticCurve:Zs,arcTo:Qs,arc:$s,ellipse:Js}=Gt,{add:tr,copy:er,addPoint:sr,setPoint:rr,addBounds:ir,toBounds:or}=P,nr=Z.get("PathBounds");let ar,hr,lr;const dr={},cr={},pr={},ur={toBounds(t,e){ur.toTwoPointBounds(t,cr),or(cr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return rr(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Fs||s===Us||s===Ns?rr(e,h,l):rr(e,t[a+1],t[a+2])),s){case Ms:case Ws:h=t[a+1],l=t[a+2],sr(e,h,l),a+=3;break;case Us:o=t[a+5],n=t[a+6],Ks(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,dr),tr(e,dr),h=o,l=n,a+=7;break;case Ns:r=t[a+1],i=t[a+2],o=t[a+3],n=t[a+4],Zs(h,l,r,i,o,n,dr),tr(e,dr),h=o,l=n,a+=5;break;case Fs:a+=1;break;case Hs:h=t[a+1],l=t[a+2],ir(e,h,l,t[a+3],t[a+4]),a+=5;break;case zs:case Ys:h=t[a+1],l=t[a+2],ir(e,h,l,t[a+3],t[a+4]),a+=s===zs?9:6;break;case js:Js(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],dr,pr),0===a?er(e,dr):tr(e,dr),h=pr.x,l=pr.y,a+=9;break;case Xs:h=t[a+1],l=t[a+2],hr=t[a+3],lr=t[a+4],ir(e,h-hr,l-lr,2*hr,2*lr),h+=hr,a+=5;break;case Vs:$s(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],dr,pr),0===a?er(e,dr):tr(e,dr),h=pr.x,l=pr.y,a+=7;break;case Gs:h=t[a+1],l=t[a+2],ar=t[a+3],ir(e,h-ar,l-ar,2*ar,2*ar),h+=ar,a+=4;break;case qs:Qs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],dr,pr),0===a?er(e,dr):tr(e,dr),h=pr.x,l=pr.y,a+=6;break;default:return void nr.error(`command: ${s} [index:${a}]`,t)}}},_r={smooth:(t,e,s)=>t};Rt.creator=new ms,Rt.parse=Fe.parse,Rt.convertToCanvasData=Fe.toCanvasData;const{drawRoundRect:gr}=Mt;function fr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){gr(this,t,e,s,r,i)})}(t)}function yr(t,e,s){Object.defineProperty(t,e,s)}function xr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function vr(t){return(e,s)=>{yr(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function mr(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};yr(t,e,Object.assign(i,r||{})),Nr(t,e,s)}function wr(t){return(e,s)=>{mr(e,s,t)}}function Er(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function br(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Br(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function Cr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const kr=Cr;function Rr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Tr=Rr;function Pr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Lr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Sr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Or(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function Dr(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function Ir(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Ar(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),Z.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Mr(t){return(e,s)=>{yr(e,"__DataProcessor",{get:()=>t})}}function Wr(t){return(e,s)=>{yr(e,"__LayoutProcessor",{get:()=>t})}}function Ur(t,e,s){Nr(t.prototype,e,s)}function Nr(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[i]}:"width"===e?n.get=function(){const t=this[i];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[i];return void 0===t?this.__naturalHeight||s:t});const a=xr(r,e);a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),Object.defineProperty(r,e,n)}const Fr=new Z("rewrite"),Hr=[],zr=["destroy","constructor"];function Yr(t){return(e,s)=>{Hr.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function jr(){return t=>{Xr()}}function Xr(t){Hr.length&&(Hr.forEach((e=>{t&&Fr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Hr.length=0)}function Vr(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(zr.includes(r)||e&&e.includes(r)))if(t.prototype){xr(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function Gr(){return t=>{st.register(t)}}function qr(){return t=>{ot.register(t)}}setTimeout((()=>Xr(!0)));const{toOuterOf:Kr}=z;class Zr{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange(),this.positionChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),Kr(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Kr(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Kr(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:r},this.localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:r},this.localRenderBounds={x:t,y:e,width:s,height:r}}boxChange(){this.boxChanged=!0,this.localBoxChanged||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}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const Qr={},$r={on(t,e,s){let r,i,o;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=Jr(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){let r,i,o;s&&(r="boolean"==typeof s?s:s.capture);const n=Jr(this,r);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))},on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,listener:e,options:r}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{this.off(t.type,t.listener,t.options)})),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){const r=Jr(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&(i=r[o],i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:r}=this;return void 0===e?!!(r&&r[t]||s&&s[t]):!!(e?r&&r[t]:s&&s[t])}};function Jr(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Qr)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Qr)}}class ti{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0}stopNow(){this.isStopNow=!0,this.isStop=!0}stop(){this.isStop=!0}}class ei extends ti{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}ei.ADD="child.add",ei.REMOVE="child.remove";class si extends ti{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}si.CHANGE="property.change";class ri extends ti{constructor(t,e){super(t),Object.assign(this,e)}}ri.LOAD="image.load",ri.LOADED="image.loaded",ri.ERROR="image.error";class ii extends ti{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){"object"==typeof t?(super(ii.RESIZE),Object.assign(this,t)):super(t),this.old=e}}ii.RESIZE="resize";class oi extends ti{constructor(t,e){super(t),e&&Object.assign(this,e)}}oi.START="transform.start",oi.CHANGE="transform.change",oi.END="transform.end",oi.BEFORE_START="transform.before_start",oi.BEFORE_CHANGE="transform.before_change",oi.BEFORE_END="transform.before_end";class ni extends ti{constructor(t,e){super(t),this.data=e}}ni.REQUEST="watch.request",ni.DATA="watch.data";class ai extends ti{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}ai.CHECK_UPDATE="layout.check_update",ai.REQUEST="layout.request",ai.START="layout.start",ai.BEFORE="layout.before",ai.LAYOUT="layout.layout",ai.AFTER="layout.after",ai.AGAIN="layout.again",ai.END="layout.end";class hi extends ti{}hi.FRAME="animate.frame";class li extends ti{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}li.REQUEST="render.request",li.START="render.start",li.BEFORE="render.before",li.RENDER="render",li.AFTER="render.after",li.AGAIN="render.again",li.END="render.end";class di extends ti{}di.START="leafer.start",di.BEFORE_READY="leafer.before_ready",di.READY="leafer.ready",di.AFTER_READY="leafer.after_ready",di.VIEW_READY="leafer.view_ready",di.STOP="leafer.stop",di.RESTART="leafer.restart",di.END="leafer.end";const ci={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=si,r=new si(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{sin:pi,cos:ui}=Math,_i=Object.assign(Object.assign({},f.defaultMatrix),{scaleX:1,scaleY:1}),gi={__updateWorldMatrix(){const t=this.parent?this.parent.__world:_i,e=this.__local,s=this.__world;this.__layout.matrixChanged&&this.__updateLocalMatrix(),this.__layout.affectScaleOrRotation?(s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX*this.__.scaleX,s.scaleY=t.scaleY*this.__.scaleY):(s.a=t.a,s.b=t.b,s.c=t.c,s.d=t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX,s.scaleY=t.scaleY)},__updateLocalMatrix(){const t=this.__local,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:r}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:i,skewX:n,skewY:a}=this.__;i||n||a?(i*=o,n&&(n*=o),a&&(a*=o),t.a=s*ui(i+a),t.b=s*pi(i+a),t.c=r*-pi(i-n),t.d=r*ui(i-n)):(t.a=s,t.b=0,t.c=0,t.d=r,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=r,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:fi,copyAndSpread:yi}=z,xi={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxChanged=!1,e=!0),s.localBoxChanged&&(this.__updateLocalBoxBounds(),s.localBoxChanged=!1,s.strokeSpread&&(s.strokeChanged=!0),s.renderSpread&&(s.renderChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxChange()),s.strokeChanged&&(s.strokeSpread=this.__updateStrokeSpread(),s.strokeSpread?(s.strokeBounds===s.boxBounds&&s.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.spreadStrokeCancel(),s.strokeChanged=!1,s.renderSpread&&(s.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),e||(e=!0)),s.renderChanged&&(s.renderSpread=this.__updateRenderSpread(),s.renderSpread?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.spreadRenderCancel(),s.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),s.boundsChanged=!1,fi(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else fi(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){fi(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){fi(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){fi(this.__layout.renderBounds,this.__local,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height},__updateStrokeBounds(){yi(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){yi(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:vi}=C,mi={},wi={__hitWorld(t){return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),vi(t,this.__world,mi),this.__hit(mi)},__drawHitPath(t){this.__drawRenderPath(t)}},Ei={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e);const r=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?(t.resetTransform(),t.copyWorld(s,null,null,r)):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,r),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},bi={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,r=e.length;s<r;s++)(t=e[s]).isMask&&(this.__removeMask(t),r--,s--)}}},Bi={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const r=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?t.copyWorld(s,null,null,r):t.copyWorld(s,this.__world,this.__world,r),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:r}=this;if(this.__hasMask&&r.length>1){let i,o=t.getSameCanvas(),n=t.getSameCanvas();for(let a=0,h=r.length;a<h;a++)s=r[a],s.isMask?(i?(this.__renderMask(t,n,o),o.clear(),n.clear()):i=!0,s.__render(o,e)):s.__render(n,e);this.__renderMask(t,n,o),o.recycle(),n.recycle()}else{const{bounds:i,hideBounds:o}=e;for(let n=0,a=r.length;n<a;n++)s=r[n],i&&!i.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}},{copy:Ci,translate:ki,toInnerPoint:Ri,scaleOfOuter:Ti,rotateOfOuter:Pi}=f,Li={},Si={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Di(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ii(e[t])}},updateAllChange(t){if(Ii(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ai(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){t.__layout.checkUpdate();const r={x:e,y:s};t.parent&&Ri(t.parent.__world,r,r,!0),Oi.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,r,i){t.__layout.checkUpdate();const o=t.parent?C.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,o,s,r,i)},zoomOfLocal(t,e,s,r=s,i){Ci(Li,t.__local),i&&ki(Li,i.x,i.y),Ti(Li,e,s,r),i||(i=t),i.x+=Li.e-t.__local.e,i.y+=Li.f-t.__local.f,t.scaleX*=s,t.scaleY*=r},rotateOfWorld(t,e,s,r){t.__layout.checkUpdate();const i=t.parent?C.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,i,s,r)},rotateOfLocal(t,e,s,r){Ci(Li,t.__local),r&&ki(Li,r.x,r.y),Pi(Li,e,s),r||(r=t),r.x+=Li.e-t.__local.e,r.y+=Li.f-t.__local.f,t.rotation+=s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},Oi=Si,{updateAllWorldMatrix:Di,updateAllWorldOpacity:Ii,updateAllChange:Ai}=Oi,Mi={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local,localEventBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__local:null,maskLocalEventBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},Wi={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.push(t),Ui(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.push(t.parent),t=t.parent;else for(;t.parent;)e.push(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)Ni(e[t],e)},updateWorldBoundsByBranchStack(t){let e;for(let s=t.length-1;s>-1;s--){e=t[s];for(let t=0,s=e.children.length;t<s;t++)e.children[t].__updateWorldBounds()}e.__updateWorldBounds()}},{pushAllChildBranch:Ui,pushAllBranchStack:Ni}=Wi,Fi={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Hi,create:zi}=s,{toInnerPoint:Yi,toOuterPoint:ji}=f,{tempToOuterOf:Xi,copy:Vi}=C,{moveLocal:Gi,zoomOfLocal:qi,rotateOfLocal:Ki}=Si;exports.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return ut}get __LayoutProcessor(){return Zr}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.checkUpdate(),this.__worldOpacity}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}constructor(t){this.innerId=zi(Hi),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},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},this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer=t,t&&(this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&Fi.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){void 0===t?t="x":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?Yi(this.parent.worldTransform,t,e,s):e&&Vi(e,t)}localToWorld(t,e,s){this.parent?ji(this.parent.worldTransform,t,e,s):e&&Vi(e,t)}worldToInner(t,e,s){Yi(this.worldTransform,t,e,s)}innerToWorld(t,e,s){ji(this.worldTransform,t,e,s)}move(t,e){Gi(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),qi(this,Xi(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),Ki(this,Xi(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}},exports.Leaf=gt([Vr(ci),Vr(gi),Vr(xi),Vr(wi),Vr($r),Vr(Ei)],exports.Leaf);const{setByListWithHandle:Zi}=z,{sort:Qi}=Wi,{localBoxBounds:$i,localEventBounds:Ji,localRenderBounds:to,maskLocalBoxBounds:eo,maskLocalEventBounds:so,maskLocalRenderBounds:ro}=Mi;exports.Branch=class extends exports.Leaf{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){Zi(this.__layout.boxBounds,this.children,this.__hasMask?eo:$i)}__updateStrokeBounds(){Zi(this.__layout.strokeBounds,this.children,this.__hasMask?so:Ji)}__updateRenderBounds(){Zi(this.__layout.renderBounds,this.children,this.__hasMask?ro:to)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Qi),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&Fi.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready&&this.__emitChildEvent(ei.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===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()})))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready&&this.__emitChildEvent(ei.REMOVE,t),this.leafer.hitCanvasManager.clear())}__emitChildEvent(t,e){const s=new ei(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=gt([Vr(Bi),Vr(bi)],exports.Branch);const io={};class oo{static isHoldSpaceKey(){return oo.hasDownCode("Space")}static setDownCode(t){io[t]||(io[t]=!0)}static setUpCode(t){io[t]=!1}static hasDownCode(t){return io[t]}}class no{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}const ao={};class ho extends ti{get spaceKey(){return oo.isHoldSpaceKey()}get left(){return no.left(this)}get right(){return no.right(this)}get middle(){return no.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.worldToInner(this,ao),Object.assign({},ao)}getLocal(t){return t||(t=this.current),t.worldToLocal(this,ao),Object.assign({},ao)}static changeName(t,e){ot.changeName(t,e)}}exports.PointerEvent=class extends ho{},exports.PointerEvent.POINTER="pointer",exports.PointerEvent.BEFORE_DOWN="pointer.before_down",exports.PointerEvent.BEFORE_MOVE="pointer.before_move",exports.PointerEvent.BEFORE_UP="pointer.before_up",exports.PointerEvent.DOWN="pointer.down",exports.PointerEvent.MOVE="pointer.move",exports.PointerEvent.UP="pointer.up",exports.PointerEvent.OVER="pointer.over",exports.PointerEvent.OUT="pointer.out",exports.PointerEvent.ENTER="pointer.enter",exports.PointerEvent.LEAVE="pointer.leave",exports.PointerEvent.TAP="tap",exports.PointerEvent.DOUBLE_TAP="double_tap",exports.PointerEvent.CLICK="click",exports.PointerEvent.DOUBLE_CLICK="double_click",exports.PointerEvent.LONG_PRESS="long_press",exports.PointerEvent.LONG_TAP="long_tap",exports.PointerEvent=gt([qr()],exports.PointerEvent);const lo={},co={};var po;exports.DragEvent=class extends exports.PointerEvent{getInnerMove(t){return t||(t=this.current),lo.x=this.moveX,lo.y=this.moveY,t.worldToInner(lo,co,!0),Object.assign({},co)}getLocalMove(t){return t||(t=this.current),lo.x=this.moveX,lo.y=this.moveY,t.worldToLocal(lo,co,!0),Object.assign({},co)}},exports.DragEvent.DRAG="drag",exports.DragEvent.START="drag.start",exports.DragEvent.END="drag.end",exports.DragEvent.OVER="drag.over",exports.DragEvent.OUT="drag.out",exports.DragEvent.ENTER="drag.enter",exports.DragEvent.LEAVE="drag.leave",exports.DragEvent=gt([qr()],exports.DragEvent),exports.DropEvent=po=class extends exports.PointerEvent{static setList(t){po.dragList=t instanceof ht?t:new ht(t)}static setData(t){this.dragData=t}},exports.DropEvent.DROP="drop",exports.DropEvent=po=gt([qr()],exports.DropEvent),exports.MoveEvent=class extends exports.DragEvent{},exports.MoveEvent.MOVE="move",exports.MoveEvent.START="move.start",exports.MoveEvent.END="move.end",exports.MoveEvent=gt([qr()],exports.MoveEvent),exports.RotateEvent=class extends ho{},exports.RotateEvent.ROTATE="rotate",exports.RotateEvent.START="rotate.start",exports.RotateEvent.END="rotate.end",exports.RotateEvent=gt([qr()],exports.RotateEvent),exports.SwipeEvent=class extends exports.DragEvent{},exports.SwipeEvent.SWIPE="swipe",exports.SwipeEvent.LEFT="swipe.left",exports.SwipeEvent.RIGHT="swipe.right",exports.SwipeEvent.UP="swipe.up",exports.SwipeEvent.DOWN="swipe.down",exports.SwipeEvent=gt([qr()],exports.SwipeEvent),exports.ZoomEvent=class extends ho{},exports.ZoomEvent.ZOOM="zoom",exports.ZoomEvent.START="zoom.start",exports.ZoomEvent.END="zoom.end",exports.ZoomEvent=gt([qr()],exports.ZoomEvent),exports.KeyEvent=class extends ho{},exports.KeyEvent.DOWN="key.down",exports.KeyEvent.PRESS="key.press",exports.KeyEvent.UP="key.up",exports.KeyEvent=gt([qr()],exports.KeyEvent);const uo=Z.get("TaskProcessor");class _o{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return ft(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){uo.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class go{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&ct.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new _o(t);return n.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(n.time=i),!1===r&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber--,this.push(n,s)}),o)),this.isComplete=!1,n}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=[]}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this.running)return;r<this.total&&(t=this.list[r],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 fo={map:{},recycledList:[],tasker:new go,patternTasker:new go,get isComplete(){return yo.tasker.isComplete&&yo.patternTasker.isComplete},get(t){let s=yo.map[t.url];return s||(s=e.image(t),yo.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||yo.recycledList.push(t)}))},clearRecycled(){const t=yo.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete yo.map[t.url],t.destroy())})),t.length=0)},destroy(){yo.map={}}},yo=fo,{IMAGE:xo,create:vo}=s;class mo{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=vo(xo),this.config=t||{url:""};const{url:e}=t;e.startsWith("data:")?e.startsWith("data:image/svg")&&(this.isSVG=!0):e.includes(".svg")&&(this.isSVG=!0)}load(e,s){return this.loading||(this.loading=!0,fo.tasker.add((()=>ft(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,r,i){e||(e=this.width),s||(s=this.height);const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),o}destroy(){this.config={url:""},this.waitComplete.length=0}}const wo=Z.get("plugin"),Eo={power:{},list:[],onLeafer(t){Eo.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};function bo(t,e){const s={},{power:r,list:i}=Eo;if(i.includes(t))wo.warn("repeat run",t.name);else{i.push(t),t.import?t.import.forEach((t=>{r[t]?s[t]=r[t]:wo.error(t+" non-existent")})):wo.warn("no import");try{t.run(s,e)}catch(t){wo.error(t)}}}class Bo{get updatedList(){if(this.hasRemoved){const t=new ht;return this.__updatedList.list.forEach((e=>{e.leafer&&t.push(e)})),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ht,this.target=t,e&&(this.config=ct.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(li.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===ei.ADD?this.__pushChild(t.child):(this.hasRemoved||(this.hasRemoved=!0),this.__updatedList.push(t.parent)),this.update()}__pushChild(t){this.__updatedList.push(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new ni(ni.DATA,{updatedList:this.updatedList})),this.__updatedList=new ht,this.totalTimes++,this.changed=!1,this.hasRemoved=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(si.CHANGE,this.__onAttrChange,this),t.on_([ei.ADD,ei.REMOVE],this.__onChildEvent,this),t.on_(ni.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllWorldMatrix:Co,updateAllWorldOpacity:ko}=Si,{pushAllChildBranch:Ro,pushAllParent:To}=Wi;const{worldBounds:Po}=Mi,{setByListWithHandle:Lo}=z;class So{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ht(t)),this.updatedList=t}setBefore(){Lo(this.beforeBounds,this.updatedList.list,Po)}setAfter(){Lo(this.afterBounds,this.updatedList.list,Po),this.updatedBounds.setByList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:Oo,updateAllChange:Do}=Si,{pushAllBranchStack:Io,updateWorldBoundsByBranchStack:Ao}=Wi,Mo=Z.get("Layouter");class Wo{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new lt,this.target=t,e&&(this.config=ct.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.running)return;const{target:t}=this;this.times=0;try{t.emit(ai.START),this.layoutOnce(),t.emitEvent(new ai(ai.END,this.layoutedBlocks,this.times))}catch(t){Mo.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Mo.warn("layouting"):this.times>3?Mo.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ni.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=J.start("PartLayout"),{target:s,__updatedList:r}=this,{BEFORE:i,LAYOUT:o,AFTER:n}=ai,a=this.getBlocks(r);a.forEach((t=>{t.setBefore()})),s.emitEvent(new ai(i,a,this.times)),r.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(Co(t),e.push(t),t.isBranch&&Ro(t,e),To(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),To(t,e)))}))}(r,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&ko(t),t.__updateChange()}))}(r),a.forEach((t=>t.setAfter())),s.emitEvent(new ai(o,a,this.times)),s.emitEvent(new ai(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,J.end(e)}fullLayout(){const t=J.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:r,AFTER:i}=ai,o=this.getBlocks(new ht(e));e.emitEvent(new ai(s,o,this.times)),Wo.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new ai(r,o,this.times)),e.emitEvent(new ai(i,o,this.times)),this.addBlocks(o),J.end(t)}static fullLayout(t){if(Oo(t),t.isBranch){const e=[t];Io(t,e),Ao(e)}else t.__updateWorldBounds();Do(t)}createBlock(t){return new So(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(){const{target:t}=this;this.__eventIds=[t.on_(ai.REQUEST,this.layout,this),t.on_(ai.AGAIN,this.layoutAgain,this),t.on_(ni.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Uo=Z.get("Renderer");class No{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=ct.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(ai.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new V,Uo.log(e.innerName,"---\x3e");try{this.emitRender(li.START),this.renderOnce(t),this.emitRender(li.END,this.totalBounds),fo.clearRecycled()}catch(t){Uo.error(t)}Uo.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?Uo.warn("rendering"):this.times>3?Uo.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(li.BEFORE),t()):(this.requestLayout(),this.emitRender(li.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(li.RENDER,this.renderBounds,this.renderOptions),this.emitRender(li.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return Uo.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=J.start("PartRender"),{canvas:s}=this,r=t.getIntersect(s.bounds),i=t.includes(this.target.__world),o=(new V).copy(r);s.save(),i&&!Z.showRepaint?s.clear():(r.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(r,!0),s.clipWorld(r,!0)),this.__render(r,o),s.restore(),J.end(e)}fullRender(){const t=J.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),J.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),Z.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),Z.showHitView&&this.renderHitView(s),Z.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(hi.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Uo.warn(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new li(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(li.REQUEST,this.update,this),t.on_(ai.END,this.__onLayoutEnd,this),t.on_(li.AGAIN,this.renderAgain,this),t.on_(ii.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:Fo}=z;class Ho{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const r=s.through||!1,i=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,n=this.getBestMatchLeaf(),a=i?this.getPath(n):this.getHitablePath(n);return this.clear(),r?{path:a,leaf:n,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:r}=this.point,i={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],Si.worldHittable(e)&&(this.hitChild(e,i),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ht;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,r=new ht;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(r.unshift(s),s.__.hitChildren);t--);return r}getThroughPath(t){const e=new ht,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let r,i,o;for(let t=0,n=s.length;t<n;t++){r=s[t],i=s[t+1];for(let t=0,s=r.length;t<s&&(o=r.list[t],!i||!i.has(o));t++)e.push(o)}return e}eachFind(t,e){let s,r;const{point:i}=this;for(let o=t.length-1;o>-1;o--)s=t[o],e&&!s.isMask||(r=Fo(s.__world,i),s.isBranch?(r||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,i)):r&&this.hitChild(s,i))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class zo{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.findPath=new Ho(t,this),this.__listenEvents()}getByPoint(e,s,r){return"node"===t.name&&this.target.emit(ai.CHECK_UPDATE),this.findPath.getByPoint(e,s,r)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,r=this.innerIdList[t];return r||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,r=this.idList[t];return r||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let r=0,i=s.length;r<i;r++){if(e(t=s[r]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(ei.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.findPath.destroy(),this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={})}}Object.assign(e,{watcher:(t,e)=>new Bo(t,e),layouter:(t,e)=>new Wo(t,e),renderer:(t,e,s)=>new No(t,e,s),selector:(t,e)=>new zo(t,e)}),t.layout=Wo.fullLayout;class Yo extends kt{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;this.view.width=t*s,this.view.height=e*s,this.clientBounds=this.bounds}}class jo{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(exports.MoveEvent.START,this.moveData)}t.path=this.moveData.path,e.emit(exports.MoveEvent.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(exports.ZoomEvent.START,this.zoomData)}t.path=this.zoomData.path,e.emit(exports.ZoomEvent.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(exports.RotateEvent.START,this.rotateData)}t.path=this.rotateData.path,e.emit(exports.RotateEvent.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd(),this.transformMode=null}moveEnd(){this.moveData&&(this.interaction.emit(exports.MoveEvent.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(exports.ZoomEvent.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(exports.RotateEvent.END,this.rotateData),this.rotateData=null)}destroy(){this.zoomData=this.moveData=this.rotateData=null}}const Xo={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?exports.SwipeEvent.UP:t>45&&t<135?exports.SwipeEvent.DOWN:t<=45&&t>=-45?exports.SwipeEvent.RIGHT:exports.SwipeEvent.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:Vo.getSwipeDirection(C.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,r=s.length;t<r;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ht,{list:r}=t;for(let t=0,i=r.length;t<i;t++)r[t].hasEvent(e)&&s.push(r[t]);return s}},Vo=Xo,{getDragEventData:Go,getDropEventData:qo,getSwipeEventData:Ko,filterPathByEventType:Zo}=Xo;class Qo{constructor(t){this.interaction=t}setDragData(t){this.dragData=Go(t,t,t)}getDragList(){return this.dragging?exports.DropEvent.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:r}=s;if(this.moving&&!no.middle(t)&&!no.left(t))return void s.pointerCancel();const{dragData:i}=this;if(!this.moving){const o=r.target.isLeafer&&s.config.move.dragEmpty;this.moving=(no.middle(t)||oo.isHoldSpaceKey()||o)&&e,this.moving&&s.emit(exports.MoveEvent.START,i)}this.moving||this.dragStart(t,e);const{path:o,throughPath:n}=r;this.dragData=Go(r,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?s.emit(exports.MoveEvent.MOVE,this.dragData):this.dragging&&(s.emit(exports.DragEvent.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=no.left(t)&&e,this.dragging&&(this.interaction.emit(exports.DragEvent.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Zo(this.dragData.path,exports.DragEvent.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,r=t.length;s<r;s++)if(e=t.list[s],e.__.draggable&&e.__.hitSelf){this.dragableList=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{Si.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:r}=t;s?r.indexAt(0)!==s.indexAt(0)&&(e.emit(exports.DragEvent.OUT,t,s),e.emit(exports.DragEvent.OVER,t,r)):e.emit(exports.DragEvent.OVER,t,r),this.dragOverPath=r}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:r}=t;e.emit(exports.DragEvent.LEAVE,t,s,r),e.emit(exports.DragEvent.ENTER,t,r,s),this.dragEnterPath=r}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:r,throughPath:i}=s,o=Go(s,t,t);i&&(o.throughPath=i),o.path=r,this.moving&&e.emit(exports.MoveEvent.END,o),this.dragging&&(e.emit(exports.DragEvent.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:r}=s;if(C.getDistance(r,t)>s.config.pointer.swipeDistance){const t=Ko(r,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=qo(t,this.getDragList(),exports.DropEvent.dragData);e.path=this.dragEnterPath,this.interaction.emit(exports.DropEvent.DROP,e),this.interaction.emit(exports.DragEvent.LEAVE,t,this.dragEnterPath)}dragReset(){exports.DropEvent.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:r,dragOut:i}=e.config.move;if(!i||!r)return;const o=e.shrinkCanvasBounds,{x:n,y:a}=o,h=z.right(o),l=z.bottom(o),d=t.x<n?r:h<t.x?-r:0,c=t.y<a?r:l<t.y?-r:0;let p=0,u=0;this.autoMoveTimer=setInterval((()=>{p+=d,u+=c,C.move(s,d,c),C.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:p,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.dragReset()}}const $o=["move","zoom","rotate"];function Jo(t,e,s,r,i){if($o.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!en(t,i)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!s.path.has(o)&&o.__.hittable&&tn(o,e,s,r,i)}}function tn(t,e,s,r,i){if(t.destroyed)return!0;if(t.__.hitSelf&&t.hasEvent(e,r)&&!en(t,i)){s.phase=r?1:t===s.target?2:3;const i=ot.get(e,s);if(t.emitEvent(i,r),i.isStop)return!0}return!1}function en(t,e){return e&&e.has(t)}const sn={getData(t){const e=t[0],s=t[1],r=C.getCenter(e.from,s.from),i=C.getCenter(e.to,s.to),o={x:i.x-r.x,y:i.y-r.y},n=C.getDistance(e.from,s.from),a=C.getDistance(e.to,s.to)/n,h=C.getAngle(e.from,s.from),l=C.getAngle(e.to,s.to);return{move:o,scale:a,angle:this.getChangedAngle(h,l),center:i}},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},{pathHasEventType:rn,getMoveEventData:on,getZoomEventData:nn,getRotateEventData:an}=Xo;class hn{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,r,i){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=e,this.canvas=s,this.selector=r,this.defaultPath=new ht(e),this.transformer=new jo(this),this.dragger=new Qo(this),i&&(this.config=ct.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){this.emit(exports.PointerEvent.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:s,through:r}=this.config.pointer,i=this.selector.getByPoint(t,s,{through:r});i.throughPath&&(t.throughPath=i.throughPath),t.path=e?this.defaultPath:i.path,this.emit(exports.PointerEvent.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),no.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&no.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(exports.PointerEvent.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=C.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:exports.PointerEvent.MOVE});t.path=e.path,this.emit(exports.PointerEvent.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))}pointerUp(t){if(!this.downData)return;this.emit(exports.PointerEvent.BEFORE_UP,t,this.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getByPoint(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(exports.PointerEvent.UP,t),this.emit(exports.PointerEvent.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:r,scale:i,center:o}=sn.getData(e);this.rotate(an(o,r,t)),this.zoom(nn(o,i,t)),this.move(on(o,s,t))}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(exports.PointerEvent.OUT,t,this.overPath),this.emit(exports.PointerEvent.OVER,t,e)):this.emit(exports.PointerEvent.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit(exports.PointerEvent.LEAVE,t,this.enterPath,e),this.emit(exports.PointerEvent.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(exports.PointerEvent.LEAVE,t),this.dragger.dragging&&this.emit(exports.DropEvent.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const r=Date.now()-this.downTime,i=[exports.PointerEvent.DOUBLE_TAP,exports.PointerEvent.DOUBLE_CLICK].some((e=>rn(t.path,e)));r<e.tapTime+50&&i?(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))}emitTap(t){this.emit(exports.PointerEvent.TAP,t),this.emit(exports.PointerEvent.CLICK,t)}emitDoubleTap(t){this.emit(exports.PointerEvent.DOUBLE_TAP,t),this.emit(exports.PointerEvent.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(exports.PointerEvent.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(exports.PointerEvent.LONG_TAP,t),rn(t.path,exports.PointerEvent.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new V(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ii.RESIZE,this.__onResize,this)],t.once(di.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,s,r){this.running&&function(t,e,s,r){if(!s&&!e.path)return;let i;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let o=s.length-1;o>-1;o--){if(i=s.list[o],tn(i,t,e,!0,r))return;i.isApp&&Jo(i,t,e,!0,r)}for(let o=0,n=s.length;o<n;o++)if(i=s.list[o],i.isApp&&Jo(i,t,e,!1,r),tn(i,t,e,!1,r))return}(t,e,s,r)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}function ln(s,r){if(!t.origin){if("skia"===s){const{Canvas:e,loadImage:s}=r;t.origin={createCanvas:(t,s,r)=>new e(t,s,r),canvasToDataURL:(t,e,s)=>t.toDataURLSync(e,{quality:s}),canvasToBolb:(t,e,s)=>t.toBuffer(e,{quality:s}),canvasSaveAs:(t,e,s)=>t.saveAs(e,{quality:s}),loadImage:s}}t.canvas=e.canvas()}}Object.assign(e,{canvas:(t,e)=>new Yo(t,e),image:t=>new mo(t),hitCanvas:(t,e)=>new Yo(t,e),interaction:(t,e,s,r)=>new hn(t,e,s,r)}),t.name="node",t.requestRender=function(t){setTimeout(t)},t.devicePixelRatio=1,t.conicGradientSupport=!0,t.realtimeLayout=!0;const dn=Z.get("LeaferTypeCreator"),cn={list:{},register(t,e){pn[t]?dn.repeat(t):pn[t]=e},run(t,e){const s=cn.list[t];s?s(e):dn.error("no",t)}},{list:pn}=cn;cn.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),cn.register("design",(function(t){const{MOVE:e}=exports.MoveEvent,{ZOOM:s}=exports.ZoomEvent;t.__eventIds.push(t.on_(e,(e=>{Si.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:r,max:i}=t.config.zoom;let{scale:o}=e;o*s<r?o=r/s:o*s>i&&(o=i/s),1!==o&&Si.zoomOfWorld(t.zoomLayer,e,o)})))}));const un={},_n={},gn={},fn={export(t,e,s){return function(t){yn||(yn=new go);return new Promise((e=>{yn.add((()=>ft(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((r=>new Promise((i=>{const{leafer:o}=t;o?o.waitViewLoaded((()=>ft(this,void 0,void 0,(function*(){let t,n,a,{canvas:h}=o,{unreal:l}=h;switch(l&&(h=h.getSameCanvas(),h.backgroundColor=o.config.fill,o.__render(h,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(n=!0);break;case"number":t=s;break;case"boolean":n=s}a=e.includes(".")?yield h.saveAs(e,t):n?yield h.toBlob(e,t):yield h.toDataURL(e,t),r({data:a}),i(),l&&h.recycle()})))):(r({data:!1}),i())}))))}};let yn;const{copy:xn,toOffsetOutBounds:vn}=z,mn={},wn={};function En(e,s,r,i){const{bounds:o,shapeBounds:n}=i;if(t.fullImageShadow){if(xn(mn,e.bounds),mn.x+=s.x-n.x,mn.y+=s.y-n.y,r){const{matrix:t}=i;mn.x-=(o.x+(t?t.e:0)+o.width/2)*(r-1),mn.y-=(o.y+(t?t.f:0)+o.height/2)*(r-1),mn.width*=r,mn.height*=r}e.copyWorld(i.canvas,e.bounds,mn)}else r&&(xn(mn,s),mn.x-=s.width/2*(r-1),mn.y-=s.height/2*(r-1),mn.width*=r,mn.height*=r),e.copyWorld(i.canvas,n,r?mn:s)}const{toOffsetOutBounds:bn}=z,Bn={};var Cn=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:r}=t.__;s.setWorldBlur(r*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s,r){let i,o;const{__world:n,__layout:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:p,scaleY:u}=s,_=e.getSameCanvas(),g=h.length-1;bn(d,Bn),h.forEach(((t,r)=>{_.save(),_.setWorldShadow(Bn.offsetX+t.x*p,Bn.offsetY+t.y*u,t.blur*p),o=t.spread?1-2*t.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,En(_,Bn,o,s),_.restore(),l?(_.copyWorld(_,d,n,"copy"),_.copyWorld(l,n,n,"source-out"),i=n):(_.copyWorld(s.canvas,c,d,"source-out"),i=d),_.fillWorld(i,t.color,"source-in"),e.copyWorldToInner(_,i,a.renderBounds,t.blendMode),g&&r<g&&_.clear()})),_.recycle()},shadow:function(t,e,s,r){let i,o;const{__world:n,__layout:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:p,scaleY:u}=s,_=e.getSameCanvas(),g=h.length-1;vn(d,wn),h.forEach(((t,r)=>{_.setWorldShadow(wn.offsetX+t.x*p,wn.offsetY+t.y*u,t.blur*p,t.color),o=t.spread?1+2*t.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,En(_,wn,o,s),i=d,t.box&&(_.restore(),_.save(),l&&(_.copyWorld(_,d,n,"copy"),i=n),l?_.copyWorld(l,n,n,"destination-out"):_.copyWorld(s.canvas,c,d,"destination-out")),e.copyWorldToInner(_,i,a.renderBounds,t.blendMode),g&&r<g&&_.clear()})),_.recycle()}});const{get:kn,rotateOfOuter:Rn,translate:Tn,scaleOfOuter:Pn,scale:Ln,rotate:Sn}=f;const{get:On,translate:Dn}=f;function In(t,e,s,r){let{width:i,height:o}=e;const{opacity:n,mode:a,offset:h,scale:l,rotation:d,blendMode:c}=s,p=r.width===i&&r.height===o;c&&(t.blendMode=c);const u=t.data={mode:a};switch(a){case"strench":p||(i=r.width,o=r.height),(r.x||r.y)&&(u.transform=On(),Dn(u.transform,r.x,r.y));break;case"clip":(h||l||d)&&function(t,e,s,r,i){const o=kn();Tn(o,e.x,e.y),s&&Tn(o,s.x,s.y),r&&("number"==typeof r?Ln(o,r):Ln(o,r.x,r.y),t.scaleX=o.a,t.scaleY=o.d),i&&Sn(o,i),t.transform=o}(u,r,h,l,d);break;case"repeat":(!p||l||d)&&function(t,e,s,r,i,o){const n=kn();if(o)switch(Sn(n,o),o){case 90:Tn(n,r,0);break;case 180:Tn(n,s,r);break;case 270:Tn(n,0,s)}Tn(n,e.x,e.y),i&&(Pn(n,e,i),t.scaleX=t.scaleY=i),t.transform=n}(u,r,i,o,l,d);break;default:p&&!d||function(t,e,s,r,i,o){const n=kn(),a=o&&180!==o,h=s.width/(a?i:r),l=s.height/(a?r:i),d="fit"===e?Math.min(h,l):Math.max(h,l),c=s.x+(s.width-r*d)/2,p=s.y+(s.height-i*d)/2;Tn(n,c,p),Ln(n,d),o&&Rn(n,{x:s.x+s.width/2,y:s.y+s.height/2},o),t.scaleX=t.scaleY=d,t.transform=n}(u,a,r,i,o,d)}u.width=i,u.height=o,n&&(u.opacity=n)}function An(t,e,s){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=s.width,e.__naturalHeight=s.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),!1}return!0}function Mn(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new ri(t,e))}const{get:Wn,scale:Un,copy:Nn}=f;function Fn(e,s,r){let{scaleX:i,scaleY:o}=e.__world;const n=i+o;if(s.patternId===n||e.destroyed)return!1;{s.patternId=n;const{image:e,data:a}=s,h=e.isSVG?4096:Math.min(e.width,4096),l=e.isSVG?4096:Math.min(e.height,4096);let d,c,{width:p,height:u,scaleX:_,scaleY:g,opacity:f,transform:y,mode:x}=a;_&&(c=Wn(),Nn(c,y),Un(c,1/_,1/g),i*=_,o*=g),i*=r,o*=r,p*=i,u*=o,p>h||u>l?d=Math.max(p/h,u/l):(p<32||u<32)&&(d=Math.min(p/32,u/32)),d&&(i/=d,o/=d,p/=d,u/=d),_&&(i/=_,o/=g),(y||1!==i||1!==o)&&(c||(c=Wn(),y&&Nn(c,y)),Un(c,1/i,1/o));const v=t.canvas.createPattern(e.getCanvas(p,u,f),"repeat"===x?"repeat":t.origin.noRepeat||"no-repeat");try{s.transform&&(s.transform=null),c&&(v.setTransform?v.setTransform(c):s.transform=c)}catch(t){s.transform=c}return s.style=v,!0}}function Hn(t,e,s,r){const{scaleX:i,scaleY:o}=t.__world;if(s.data&&s.patternId!==i+o){if(r)if(s.image.isSVG&&"repeat"!==s.data.mode){let{width:t,height:n}=s.data;t*=i*e.pixelRatio,n*=o*e.pixelRatio,r=t>4096||n>4096}else r=!1;if(r){e.save(),e.clip();const{data:t}=s;return s.blendMode&&(e.blendMode=s.blendMode),t.opacity&&(e.opacity*=t.opacity),t.transform&&e.transform(t.transform),e.drawImage(s.image.view,0,0,t.width,t.height),e.restore(),!0}return s.style?fo.patternTasker.add((()=>ft(this,void 0,void 0,(function*(){e.bounds.hit(t.__world)&&Fn(t,s,e.pixelRatio)&&t.forceUpdate("surface")}))),300):Fn(t,s,e.pixelRatio),!1}return!1}function zn(t,e){const s="fill"===e?t._fill:t._stroke;if(s instanceof Array){let r,i,o,n;for(let a=0,h=s.length;a<h;a++)r=s[a].image,n=r&&r.url,n&&(i||(i={}),i[n]=!0,fo.recycle(r),r.loading&&(o||(o=t.__input&&t.__input[e]||[],o instanceof Array||(o=[o])),r.unload(s[a].loadId,!o.some((t=>t.url===n)))));return i}return null}function Yn(t,e){let s;const{rows:r,decorationY:i,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=r.length;t<n;t++)s=r[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),i&&e.fillRect(s.x,s.y+i,s.width,o)}function jn(t,e,s){const{strokeAlign:r}=t.__,i="string"!=typeof s;switch(r){case"center":e.setStroke(i?void 0:s,t.__.strokeWidth,t.__),i?Gn(t,s,e,!0):Vn(t,e);break;case"inside":Xn(t,e,s,"inside",i);break;case"outside":Xn(t,e,s,"outside",i)}}function Xn(t,e,s,r,i){const{strokeWidth:o,__font:n}=t.__,a=e.getSameCanvas(!0);a.setStroke(i?void 0:s,2*o,t.__),a.font=n,i?Gn(t,s,a,!0):Vn(t,a),a.blendMode="outside"===r?"destination-out":"destination-in",Yn(t,a),a.blendMode="normal",e.copyWorldToInner(a,t.__world,t.__layout.renderBounds),a.recycle()}function Vn(t,e){let s;const{rows:r,decorationY:i,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=r.length;t<n;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.strokeText(t.char,t.x,s.y)})),i&&e.strokeRect(s.x,s.y+i,s.width,o)}function Gn(t,e,s,r){let i;for(let o=0,n=e.length;o<n;o++)i=e[o],i.image&&Hn(t,s,i,!1)||i.style&&(s.strokeStyle=i.style,i.blendMode?(s.saveBlendMode(i.blendMode),r?Vn(t,s):s.stroke(),s.restoreBlendMode()):r?Vn(t,s):s.stroke())}const{getSpread:qn,getOuterOf:Kn,getByMove:Zn,getIntersectData:Qn}=z;const $n={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const r=t.r+","+t.g+","+t.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}},Jn={x:.5,y:0},ta={x:.5,y:1};function ea(t,e,s){let r;for(let i=0,o=e.length;i<o;i++)r=e[i],t.addColorStop(r.offset,$n.string(r.color,s))}const{set:sa,getAngle:ra,getDistance:ia}=C,{get:oa,rotateOfOuter:na,scaleOfOuter:aa}=f,ha={x:.5,y:.5},la={x:.5,y:1},da={},ca={};const{set:pa,getAngle:ua,getDistance:_a}=C,{get:ga,rotateOfOuter:fa,scaleOfOuter:ya}=f,xa={x:.5,y:.5},va={x:.5,y:1},ma={},wa={};let Ea;function ba(e,s,r){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:i}=e.__layout;switch(s.type){case"solid":let{type:o,blendMode:n,color:a,opacity:h}=s;return{type:o,blendMode:n,style:$n.string(a,h)};case"image":return function(t,e,s,r,i){const o={type:s.type},n=o.image=fo.get(s),a=(i||n.loading)&&{target:t,image:n,attrName:e,attrValue:s};return n.ready?(An(t,e,n)&&In(o,n,s,r),i&&(Mn(ri.LOAD,a),Mn(ri.LOADED,a))):n.error?i&&(t.forceUpdate("surface"),a.error=n.error,Mn(ri.ERROR,a)):(i&&Mn(ri.LOAD,a),o.loadId=n.load((()=>{t.destroyed||(An(t,e,n)&&(In(o,n,s,r),t.forceUpdate("surface")),Mn(ri.LOADED,a))}),(e=>{t.forceUpdate("surface"),a.error=e,Mn(ri.ERROR,a)}))),o}(e,r,s,i,!Ea||!Ea[s.url]);case"linear":return function(e,s){let{from:r,to:i,type:o,blendMode:n,opacity:a}=e;r||(r=Jn),i||(i=ta);const h=t.canvas.createLinearGradient(s.x+r.x*s.width,s.y+r.y*s.height,s.x+i.x*s.width,s.y+i.y*s.height);ea(h,e.stops,a);const l={type:o,style:h};return n&&(l.blendMode=n),l}(s,i);case"radial":return function(e,s){let{from:r,to:i,type:o,opacity:n,blendMode:a,stretch:h}=e;r||(r=ha),i||(i=la);const{x:l,y:d,width:c,height:p}=s;let u;sa(da,l+r.x*c,d+r.y*p),sa(ca,l+i.x*c,d+i.y*p),(c!==p||h)&&(u=oa(),aa(u,da,c/p*(h||1),1),na(u,da,ra(da,ca)+90));const _=t.canvas.createRadialGradient(da.x,da.y,0,da.x,da.y,ia(da,ca));ea(_,e.stops,n);const g={type:o,style:_,transform:u};return a&&(g.blendMode=a),g}(s,i);case"angular":return function(e,s){let{from:r,to:i,type:o,opacity:n,blendMode:a,stretch:h}=e;r||(r=xa),i||(i=va);const{x:l,y:d,width:c,height:p}=s;pa(ma,l+r.x*c,d+r.y*p),pa(wa,l+i.x*c,d+i.y*p);const u=ga(),_=ua(ma,wa);t.conicGradientRotate90?(ya(u,ma,c/p*(h||1),1),fa(u,ma,_+90)):(ya(u,ma,1,c/p*(h||1)),fa(u,ma,_));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,ma.x,ma.y):t.canvas.createRadialGradient(ma.x,ma.y,0,ma.x,ma.y,_a(ma,wa));ea(g,e.stops,n);const f={type:o,style:g,transform:u};return a&&(f.blendMode=a),f}(s,i);default:return s.r?{type:"solid",style:$n.string(s)}:void 0}}var Ba=Object.freeze({__proto__:null,compute:function(t,e){const s=[];let r,i=t.__.__input[e];i instanceof Array||(i=[i]),Ea=zn(t.__,e);for(let o=0,n=i.length;o<n;o++)r=ba(t,i[o],e),r&&s.push(r);t.__["_"+e]=s.length?s:void 0},drawTextStroke:Vn,fill:function(t,e,s){e.fillStyle=s,t.__.__font?Yn(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()},fillText:Yn,fills:function(t,e,s){let r;const{windingRule:i,__font:o}=t.__;for(let n=0,a=s.length;n<a;n++)r=s[n],r.image&&Hn(t,e,r,!o)||r.style&&(e.fillStyle=r.style,r.transform?(e.save(),e.transform(r.transform),r.blendMode&&(e.blendMode=r.blendMode),o?Yn(t,e):i?e.fill(i):e.fill(),e.restore()):r.blendMode?(e.saveBlendMode(r.blendMode),o?Yn(t,e):i?e.fill(i):e.fill(),e.restoreBlendMode()):o?Yn(t,e):i?e.fill(i):e.fill())},recycleImage:zn,shape:function(t,e,s){const r=e.getSameCanvas();let i,o,n,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))s.matrix?(l*=s.matrix.a,d*=s.matrix.d,i=n=Kn(h,s.matrix)):i=n=h,a=r;else{const{renderShapeSpread:r}=t.__layout,c=Qn(r?qn(e.bounds,r*l):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=o.a,d*=o.d),n=Kn(h,o),i=Zn(n,-o.e,-o.f),s.matrix&&o.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:o})}return t.__renderShape(r,s),{canvas:r,matrix:o,bounds:i,worldCanvas:a,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s){const r=t.__,{strokeWidth:i,strokeAlign:o,__font:n}=r;if(i)if(n)jn(t,e,s);else switch(o){case"center":e.setStroke(s,i,r),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*i,r),e.clip(r.windingRule),e.stroke(),e.restore();break;case"outside":const o=e.getSameCanvas(!0);o.setStroke(s,2*i,t.__),t.__drawRenderPath(o),o.stroke(),o.clip(r.windingRule),o.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}},strokeText:jn,strokes:function(t,e,s){const r=t.__,{strokeWidth:i,strokeAlign:o,__font:n}=r;if(i)if(n)jn(t,e,s);else switch(o){case"center":e.setStroke(void 0,i,r),Gn(t,s,e);break;case"inside":e.save(),e.setStroke(void 0,2*i,r),e.clip(r.windingRule),Gn(t,s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*i,t.__),Gn(t,s,n),n.clip(r.windingRule),n.clearWorld(o),e.copyWorldToInner(n,t.__world,o),n.recycle()}}});Object.assign(un,Cn),Object.assign(_n,Ba);const Ca={};class ka extends ut{setFill(t){this.__naturalWidth&&(this.__naturalWidth=this.__naturalHeight=void 0),"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isFills=!0,this._fill||(this._fill=Ca)):(this.__isFills&&(this.__removeInput("fill"),_n.recycleImage(this,"fill"),this.__isFills=!1),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=Ca)):(this.__isStrokes&&(this.__removeInput("stroke"),_n.recycleImage(this,"stroke"),this.__isStrokes=!1),this._stroke=t)}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const Ra={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class Ta extends ka{}class Pa extends Ta{get __boxStroke(){return!0}}class La extends ka{get __boxStroke(){return!0}}const{parse:Sa}=Fe;const Oa={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Da extends La{}function Ia(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Aa(t){return(e,s)=>{mr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const Ma={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:r,strokeAlign:i,strokeWidth:n}=this.__;if((s||"all"===r)&&n&&"inside"!==i&&(e=t="center"===i?n/2:n,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,r="Line"!==this.__tag?1/Math.sin(e*o/2)*Math.sqrt(n)-t:0,i="none"===s?0:n;t+=Math.max(r,i)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:r,backgroundBlur:i}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),r&&(t=Math.max(t,r));let o=t=Math.ceil(t);return s&&s.forEach((t=>{o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),i&&(o=Math.max(o,i)),this.__layout.renderShapeSpread=o,t}},Wa={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this));const t=this.__hitCanvas;this.__drawHitPath(t),t.setStrokeOptions(this.__)},__hit(e){const{__hitCanvas:s}=this;"miniapp"===t.name&&this.__drawHitPath(s);const{fill:r,hitFill:i,windingRule:o}=this.__,n=r&&"path"===i||"all"===i,a=s.hitFill(e,o);if(n&&a)return!0;const{stroke:h,hitStroke:l,strokeWidth:d,strokeAlign:c}=this.__,p=h&&"path"===l||"all"===l,u=2*e.radiusX;let _=u;if(p)switch(c){case"inside":if(_+=2*d,!n&&a&&s.hitStroke(e,_))return!0;_=u;break;case"center":_+=d;break;case"outside":if(_+=2*d,!n){if(!a&&s.hitStroke(e,_))return!0;_=u}}return!!_&&s.hitStroke(e,_)}},Ua={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:r,backgroundBlur:i}=this.__;t.__useEffect=!!(e||s||r||i)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:r,__drawAfterFill:i}=this.__;this.__drawRenderPath(t),s&&_n.fill(this,t,s),i&&this.__drawAfterFill(t,e),r&&_n.stroke(this,t,r)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:r,__drawAfterFill:i}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const o=_n.shape(this,t,e),{shadow:n,innerShadow:a}=this.__;n&&un.shadow(this,t,o,e),s&&(this.__.__isFills?_n.fills(this,t,s):_n.fill(this,t,s)),i&&this.__drawAfterFill(t,e),a&&un.innerShadow(this,t,o,e),r&&(this.__.__isStrokes?_n.strokes(this,t,r):_n.stroke(this,t,r)),o.worldCanvas&&o.worldCanvas.recycle(),o.canvas.recycle()}else s&&(this.__.__isFills?_n.fills(this,t,s):_n.fill(this,t,s)),i&&this.__drawAfterFill(t,e),r&&(this.__.__isStrokes?_n.strokes(this,t,r):_n.stroke(this,t,r))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:r}=this.__;this.__drawRenderPath(t),s&&_n.fill(this,t,"#000000"),r&&_n.stroke(this,t,"#000000")}},Na={__drawFast(t,e){const{width:s,height:r,fill:i,stroke:o,__drawAfterFill:n}=this.__;if(i&&(t.fillStyle=i,t.fillRect(0,0,s,r)),n&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:i}=this.__;t.setStroke(o,i,this.__);const n=i/2;switch(e){case"center":t.strokeRect(0,0,s,r);break;case"inside":t.strokeRect(n,n,s-i,r-i);break;case"outside":t.strokeRect(-n,-n,s+i,r+i)}}}};exports.UI=class extends exports.Leaf{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Fe.toCanvasData(e,!0):e:[]}getPathString(t){return Fe.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&_n.compute(this,"fill"),e&&_n.compute(this,"stroke")}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?_r.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}export(t,e){return fn.export(this,t,e)}static one(t,e,s,r,i){return st.get(t.tag||this.prototype.__tag,t,e,s,r,i)}destroy(){this.fill=this.stroke=null,super.destroy()}},gt([Mr(ka)],exports.UI.prototype,"__",void 0),gt([wr("")],exports.UI.prototype,"id",void 0),gt([wr("")],exports.UI.prototype,"name",void 0),gt([wr("")],exports.UI.prototype,"className",void 0),gt([Lr("pass-through")],exports.UI.prototype,"blendMode",void 0),gt([Sr(1)],exports.UI.prototype,"opacity",void 0),gt([Sr(!0)],exports.UI.prototype,"visible",void 0),gt([Dr(!1)],exports.UI.prototype,"isMask",void 0),gt([Ir(!1)],exports.UI.prototype,"isEraser",void 0),gt([Or(0)],exports.UI.prototype,"zIndex",void 0),gt([wr()],exports.UI.prototype,"locked",void 0),gt([Er(0)],exports.UI.prototype,"x",void 0),gt([Er(0)],exports.UI.prototype,"y",void 0),gt([Cr(100)],exports.UI.prototype,"width",void 0),gt([Cr(100)],exports.UI.prototype,"height",void 0),gt([br(1)],exports.UI.prototype,"scaleX",void 0),gt([br(1)],exports.UI.prototype,"scaleY",void 0),gt([Br(0)],exports.UI.prototype,"rotation",void 0),gt([Br(0)],exports.UI.prototype,"skewX",void 0),gt([Br(0)],exports.UI.prototype,"skewY",void 0),gt([wr(!1)],exports.UI.prototype,"draggable",void 0),gt([Ar(!0)],exports.UI.prototype,"hittable",void 0),gt([Ar("path")],exports.UI.prototype,"hitFill",void 0),gt([Tr("path")],exports.UI.prototype,"hitStroke",void 0),gt([Ar(!0)],exports.UI.prototype,"hitChildren",void 0),gt([Ar(!0)],exports.UI.prototype,"hitSelf",void 0),gt([Lr()],exports.UI.prototype,"fill",void 0),gt([Tr()],exports.UI.prototype,"stroke",void 0),gt([Tr("inside")],exports.UI.prototype,"strokeAlign",void 0),gt([Tr(1)],exports.UI.prototype,"strokeWidth",void 0),gt([Tr("none")],exports.UI.prototype,"strokeCap",void 0),gt([Tr("miter")],exports.UI.prototype,"strokeJoin",void 0),gt([Tr()],exports.UI.prototype,"dashPattern",void 0),gt([Tr()],exports.UI.prototype,"dashOffset",void 0),gt([Tr(10)],exports.UI.prototype,"miterLimit",void 0),gt([kr()],exports.UI.prototype,"cornerRadius",void 0),gt([kr()],exports.UI.prototype,"cornerSmoothing",void 0),gt([Ia()],exports.UI.prototype,"shadow",void 0),gt([Ia()],exports.UI.prototype,"innerShadow",void 0),gt([Ia()],exports.UI.prototype,"blur",void 0),gt([Ia()],exports.UI.prototype,"backgroundBlur",void 0),gt([Ia()],exports.UI.prototype,"grayscale",void 0),gt([Yr(As.drawPathByData)],exports.UI.prototype,"__drawPathByData",null),exports.UI=gt([Vr(Ma),Vr(Wa),Vr(Ua),jr()],exports.UI),exports.Group=class extends exports.UI{get __tag(){return"Group"}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.isBranch=!0,this.children=[]}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){}remove(t,e){}removeAll(t){}},gt([Mr(Ta)],exports.Group.prototype,"__",void 0),exports.Group=gt([Vr(exports.Branch),Gr()],exports.Group),exports.Rect=class extends exports.UI{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:r,cornerRadius:i}=this.__;i?t.roundRect(0,0,s,r,i):t.rect(0,0,s,r)}},gt([Mr(La)],exports.Rect.prototype,"__",void 0),exports.Rect=gt([Vr(Na),Gr()],exports.Rect);const Fa=exports.Rect.prototype,Ha=exports.Group.prototype,za={},{copy:Ya,add:ja}=z;exports.Box=class extends exports.Group{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;Ya(za,t),super.__updateRenderBounds(),ja(t,za)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__drawPathByData(t,e){}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}},gt([Mr(Pa)],exports.Box.prototype,"__",void 0),gt([Pr("show")],exports.Box.prototype,"overflow",void 0),gt([Yr(Fa.__updateStrokeSpread)],exports.Box.prototype,"__updateStrokeSpread",null),gt([Yr(Fa.__updateRenderSpread)],exports.Box.prototype,"__updateRectRenderSpread",null),gt([Yr(Fa.__updateBoxBounds)],exports.Box.prototype,"__updateBoxBounds",null),gt([Yr(Fa.__updateStrokeBounds)],exports.Box.prototype,"__updateStrokeBounds",null),gt([Yr(Fa.__updateRenderBounds)],exports.Box.prototype,"__updateRectRenderBounds",null),gt([Yr(Fa.__updateChange)],exports.Box.prototype,"__updateRectChange",null),gt([Yr(Fa.__drawPathByData)],exports.Box.prototype,"__drawPathByData",null),gt([Yr(Fa.__render)],exports.Box.prototype,"__renderRect",null),gt([Yr(Ha.__render)],exports.Box.prototype,"__renderGroup",null),exports.Box=gt([jr(),Gr()],exports.Box),exports.Frame=class extends exports.Box{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}},gt([Mr(class extends Pa{})],exports.Frame.prototype,"__",void 0),gt([Pr("hide")],exports.Frame.prototype,"overflow",void 0),exports.Frame=gt([Gr()],exports.Frame);const{moveTo:Xa,closePath:Va,ellipse:Ga}=is;exports.Ellipse=class extends exports.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:r,endAngle:i}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?r||i?(s<1&&Ga(a,o,n,o*s,n*s,0,r,i,!1),Ga(a,o,n,o,n,0,i,r,!0),s<1&&Va(a)):(s<1&&(Ga(a,o,n,o*s,n*s),Xa(a,t,n)),Ga(a,o,n,o,n,0,0,360,!0)):r||i?(Xa(a,o,n),Ga(a,o,n,o,n,0,r,i,!1),Va(a)):Ga(a,o,n,o,n)}},gt([Mr(class extends ka{get __boxStroke(){return!0}})],exports.Ellipse.prototype,"__",void 0),gt([kr(0)],exports.Ellipse.prototype,"innerRadius",void 0),gt([kr(0)],exports.Ellipse.prototype,"startAngle",void 0),gt([kr(0)],exports.Ellipse.prototype,"endAngle",void 0),exports.Ellipse=gt([Gr()],exports.Ellipse);const{sin:qa,cos:Ka,PI:Za}=Math,{moveTo:Qa,lineTo:$a,closePath:Ja}=is;exports.Polygon=class extends exports.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,r=t/2,i=e/2,o=this.__.path=[];Qa(o,r,0);for(let t=1;t<s;t++)$a(o,r+r*qa(2*t*Za/s),i-i*Ka(2*t*Za/s));Ja(o)}},gt([Mr(class extends ka{})],exports.Polygon.prototype,"__",void 0),gt([kr(3)],exports.Polygon.prototype,"sides",void 0),exports.Polygon=gt([Gr()],exports.Polygon);const{sin:th,cos:eh,PI:sh}=Math,{moveTo:rh,lineTo:ih,closePath:oh}=is;exports.Star=class extends exports.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:r}=this.__,i=t/2,o=e/2,n=this.__.path=[];rh(n,i,0);for(let t=1;t<2*s;t++)ih(n,i+(t%2==0?i:i*r)*th(t*sh/s),o-(t%2==0?o:o*r)*eh(t*sh/s));oh(n)}},gt([Mr(class extends ka{})],exports.Star.prototype,"__",void 0),gt([kr(5)],exports.Star.prototype,"points",void 0),gt([kr(.382)],exports.Star.prototype,"innerRadius",void 0),exports.Star=gt([Gr()],exports.Star);const{moveTo:nh,lineTo:ah}=is,{rotate:hh,getAngle:lh,getDistance:dh,defaultPoint:ch}=C,{setPoint:ph,addPoint:uh,toBounds:_h}=P,gh={};exports.Line=class extends exports.UI{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&hh(s,e),this.__toPoint=s,s}set toPoint(t){this.width=dh(ch,t),this.rotation=lh(ch,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];nh(t,0,0);const e=this.toPoint;ah(t,e.x,e.y)}__updateBoxBounds(){ph(gh,0,0),uh(gh,this.__toPoint.x,this.__toPoint.y),_h(gh,this.__layout.boxBounds)}},gt([Mr(class extends ka{})],exports.Line.prototype,"__",void 0),gt([Cr()],exports.Line.prototype,"rotation",void 0),gt([Rr("center")],exports.Line.prototype,"strokeAlign",void 0),exports.Line=gt([Gr()],exports.Line),exports.Image=class extends exports.Rect{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill=e?{type:"image",mode:"strench",url:e}:void 0,this.once(ri.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}},gt([Mr(Da)],exports.Image.prototype,"__",void 0),gt([Cr("")],exports.Image.prototype,"url",void 0),exports.Image=gt([Gr()],exports.Image),exports.Canvas=class extends exports.Rect{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,r){t.__layout.checkUpdate();const i=new T(t.__world);i.invert();const o=new T;e&&o.translate(e.x,e.y),s&&("number"==typeof s?o.scale(s):o.scale(s.x,s.y)),r&&o.rotate(r),i.preMultiply(o),t.__render(this.canvas,{matrix:i}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:r,height:i}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,r,i),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,r,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}},gt([Mr(Da)],exports.Canvas.prototype,"__",void 0),gt([Aa(100)],exports.Canvas.prototype,"width",void 0),gt([Aa(100)],exports.Canvas.prototype,"height",void 0),gt([Aa(t.devicePixelRatio)],exports.Canvas.prototype,"pixelRatio",void 0),gt([Aa(!0)],exports.Canvas.prototype,"smooth",void 0),gt([Ar("all")],exports.Canvas.prototype,"hitFill",void 0),exports.Canvas=gt([Gr()],exports.Canvas);const fh=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",yh=fh+"_#~&*+\\=|≮≯≈≠=…",xh=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 vh(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const mh=vh("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),wh=vh("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Eh=vh(fh),bh=vh(yh),Bh=vh("- —/~|┆·");var Ch;!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"}(Ch||(Ch={}));const{Letter:kh,Single:Rh,Before:Th,After:Ph,Symbol:Lh,Break:Sh}=Ch;function Oh(t){return mh[t]?kh:Bh[t]?Sh:wh[t]?Th:Eh[t]?Ph:bh[t]?Lh:xh.test(t)?Rh:kh}const Dh={trimRight(t){const{words:e}=t;let s,r=0,i=e.length;for(let o=i-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)r++,t.width-=s.width;r&&e.splice(i-r,r)}};function Ih(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Ah}=Dh,{Letter:Mh,Single:Wh,Before:Uh,After:Nh,Symbol:Fh,Break:Hh}=Ch;let zh,Yh,jh,Xh,Vh,Gh,qh,Kh,Zh,Qh,$h,Jh,tl,el,sl=[];function rl(t,e){zh.data.push({char:t,width:e}),jh+=e}function il(){Xh+=jh,zh.width=jh,Yh.words.push(zh),zh={data:[]},jh=0}function ol(){Jh&&(tl.paraNumber++,Yh.paraStart=!0,Jh=!1),Yh.width=Xh,el.width&&Ah(Yh),sl.push(Yh),Yh={words:[]},Xh=0}const nl=0,al=1,hl=2;const ll={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let r=0,o=0,{width:n,height:a,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(n||(n=0),h){const[t,e,s,l]=i.fourNumber(h);n&&(r=l,n-=e+l),a&&(o=t,a-=t+s)}const p={bounds:{x:r,y:o,width:n,height:a},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,r){tl=e,sl=e.rows,el=e.bounds;const{__letterSpacing:i,paraIndent:o,textCase:n}=r,{canvas:a}=t,{width:h,height:l}=el;if(h||l||i||"none"!==n){Jh=!0,Zh=null,jh=Xh=0,zh={data:[]},Yh={words:[]};for(let t=0,e=s.length;t<e;t++)Gh=s[t],"\n"===Gh?(jh&&il(),Yh.paraEnd=!0,ol(),Jh=!0):(Kh=Oh(Gh),Kh===Mh&&"none"!==n&&(Gh=Ih(Gh,n,!jh)),qh=a.measureText(Gh).width,i&&(qh+=i),Qh=Kh===Wh&&(Zh===Wh||Zh===Mh)||Zh===Wh&&Kh!==Nh,$h=!(Kh!==Uh&&Kh!==Wh||Zh!==Fh&&Zh!==Nh),Vh=Jh&&o?h-o:h,h&&Xh+jh+qh>Vh&&($h||($h=Kh===Mh&&Zh==Nh),Qh||$h||Kh===Hh||Kh===Uh||Kh===Wh||jh+qh>Vh?(jh&&il(),ol()):ol())," "===Gh&&!0!==Jh&&Xh+jh===0||(Kh===Hh?(" "===Gh&&jh&&il(),rl(Gh,qh),il()):Qh||$h?(jh&&il(),rl(Gh,qh)):rl(Gh,qh)),Zh=Kh);jh&&il(),Xh&&ol(),sl.length>0&&(sl[sl.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{tl.paraNumber++,sl.push({x:o||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(p,e,s),function(t,e){const{rows:s,bounds:r}=t,{__lineHeight:i,__baseLine:o,textAlign:n,verticalAlign:a,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:p,width:u,height:_}=r,g=i*s.length+(h?h*(t.paraNumber-1):0),f=o;if("show"!==l&&g>_)g=Math.max(_,i),t.overflow=s.length;else switch(a){case"middle":p+=(_-g)/2;break;case"bottom":p+=_-g}f+=p;for(let e=0,o=s.length;e<o;e++){switch(d=s[e],d.x=c,n){case"center":d.x+=(u-d.width)/2;break;case"right":d.x+=u-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=i,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1),d.x<r.x&&(r.x=d.x),d.width>r.width&&(r.width=d.width)}r.y=p,r.height=g}(p,s),function(t,e,s,r){const{rows:i}=t,{textAlign:o,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,p;i.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===o&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?nl:l>.01?al:hl,c===hl?(t.text="",t.x+=d,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===al?(p={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,p)," "!==p.char&&t.data.push(p)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(p,s,n),p.overflow&&function(e,s){const{rows:r,overflow:i}=e;if(r.splice(i),"hide"!==s){"ellipsis"===s&&(s="...");const o=t.canvas.measureText(s).width,n=r[i-1];let a,h,l=n.data.length-1;const{x:d,width:c}=e.bounds,p=d+c-o;for(let t=l;t>-1&&(a=n.data[t],h=a.x+a.width,!(t===l&&h<p));t--){if(h<p&&" "!==a.char){n.data.splice(t+1),n.width-=a.width;break}n.width-=a.width}n.width+=o,n.data.push({char:s,x:h})}}(p,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(p,s),p}},{copyAndSpread:dl,includes:cl,spread:pl}=z;exports.Text=class extends exports.UI{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:r}=this.__;t.beginPath(),r.rows.forEach((r=>t.rect(r.x,r.y-s,r.width,e)))}__drawPathByData(t,e){const{x:s,y:r,width:i,height:o}=this.__layout.boxBounds;t.rect(s,r,i,o)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=ll.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:r,lineHeight:i,letterSpacing:o,fontFamily:n,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=Ra.number(i,a),t.__letterSpacing=Ra.number(o,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${n}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,p=e.boxBounds;t.__lineHeight<a&&pl(c,a/2),s&&r?super.__updateBoxBounds():(p.x=s?0:c.x,p.y=r?0:c.y,p.width=s||c.width,p.height=r||c.height);const u=cl(p,c)?p:c;u!==e.contentBounds&&(e.contentBounds=u,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){dl(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}},gt([Mr(class extends ka{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=Oa[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],exports.Text.prototype,"__",void 0),gt([Cr(0)],exports.Text.prototype,"width",void 0),gt([Cr(0)],exports.Text.prototype,"height",void 0),gt([Cr(0)],exports.Text.prototype,"padding",void 0),gt([Rr("outside")],exports.Text.prototype,"strokeAlign",void 0),gt([Cr("")],exports.Text.prototype,"text",void 0),gt([Cr("L")],exports.Text.prototype,"fontFamily",void 0),gt([Cr(12)],exports.Text.prototype,"fontSize",void 0),gt([Cr("normal")],exports.Text.prototype,"fontWeight",void 0),gt([Cr(!1)],exports.Text.prototype,"italic",void 0),gt([Cr("none")],exports.Text.prototype,"textCase",void 0),gt([Cr("none")],exports.Text.prototype,"textDecoration",void 0),gt([Cr(0)],exports.Text.prototype,"letterSpacing",void 0),gt([Cr({type:"percent",value:150})],exports.Text.prototype,"lineHeight",void 0),gt([Cr(0)],exports.Text.prototype,"paraIndent",void 0),gt([Cr(0)],exports.Text.prototype,"paraSpacing",void 0),gt([Cr("left")],exports.Text.prototype,"textAlign",void 0),gt([Cr("top")],exports.Text.prototype,"verticalAlign",void 0),gt([Cr("show")],exports.Text.prototype,"textOverflow",void 0),exports.Text=gt([Gr()],exports.Text);const{toBounds:ul}=ur;exports.Path=class extends exports.UI{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){ul(this.__.path,this.__layout.boxBounds)}},gt([Mr(class extends ka{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Sa(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],exports.Path.prototype,"__",void 0),gt([kr()],exports.Path.prototype,"path",void 0),gt([kr()],exports.Path.prototype,"windingRule",void 0),gt([Rr("center")],exports.Path.prototype,"strokeAlign",void 0),exports.Path=gt([Gr()],exports.Path),exports.Pen=class extends exports.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new exports.Path(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,r,i,o){return this}quadraticCurveTo(t,e,s,r){return this}closePath(){return this}rect(t,e,s,r){return this}roundRect(t,e,s,r,i){return this}ellipse(t,e,s,r,i,o,n,a){return this}arc(t,e,s,r,i,o){return this}arcTo(t,e,s,r,i){return this}moveToEllipse(t,e,s,r,i,o,n,a){return this}moveToArc(t,e,s,r,i,o){return this}paint(){this.pathElement.forceUpdate("path")}},gt([Mr(class extends Ta{})],exports.Pen.prototype,"__",void 0),exports.Pen=gt([Vr(ms,["beginPath"]),Gr()],exports.Pen);const _l=Z.get("Leafer");exports.Leafer=class extends exports.Group{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&fo.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,smooth:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let r;this.__setLeafer(this),t&&ct.assign(this.config,t);const{config:i}=this;cn.run(i.type,this),this.canvas=e.canvas(i),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,i),this.watcher=e.watcher(this,i),this.layouter=e.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,s?(this.__bindApp(s),r=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new at,this.hitCanvasManager=new dt,r=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),r&&(this.__startTimer=setTimeout(this.start.bind(this))),Eo.onLeafer(this)}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(di.RESTART):this.emitLeafer(di.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render(),this.running=!0)}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(di.STOP))}resize(t){const e=ct.copyAttrs({},t,Ct);Object.keys(e).forEach((t=>this[t]=e[t]))}forceLayout(){this.__layout.checkUpdate(!0)}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ct.copyAttrs({},this.canvas,Ct);this.canvas.resize(t),this.__onResize(new ii(t,e))}__onResize(t){this.emitEvent(t),ct.copyAttrs(this.__,t,Ct),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.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const r=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),r(),this.viewLoaded||(s=this.on_(hi.FRAME,r))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(Ct.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ct.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ct.copyAttrs({},this.canvas,Ct);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(di.BEFORE_READY),this.emitLeafer(di.READY),this.emitLeafer(di.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(di.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new di(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once(di.START,(()=>J.end(t))),this.once(ai.END,(()=>this.__onReady())),this.once(li.END,(()=>this.__onViewReady())),this.on(ai.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(){setTimeout((()=>{if(!this.destroyed)try{this.stop(),this.emitEvent(new di(di.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>{this.parent&&t===this.interaction||t.destroy()})),this.__controllers.length=0,this.parent||(this.selector.destroy(),this.canvasManager.destroy(),this.hitCanvasManager.destroy()),this.canvas.destroy(),this.config.view=this.userConfig.view=this.view=null,super.destroy(),setTimeout((()=>{fo.clearRecycled()}),100)}catch(t){_l.error(t)}}),0)}},gt([Mr(class extends Ta{})],exports.Leafer.prototype,"__",void 0),gt([Cr()],exports.Leafer.prototype,"pixelRatio",void 0),exports.Leafer=gt([Gr()],exports.Leafer),exports.App=class extends exports.Leafer{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(si.CHANGE,(()=>{Z.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new exports.Leafer(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(ai.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(li.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(li.END,this.__onChildRenderEnd,this))}waitViewLoaded(e){const s=()=>{this.children.every((t=>t.viewLoaded))&&t.requestRender(e)};this.children.forEach((t=>{t.waitViewLoaded(s)})),this.running||this.start()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&ct.assign(e,t),this.autoLayout&&ct.copyAttrs(e,this,Ct),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}},exports.App=gt([Gr()],exports.App);var gl=Object.freeze({__proto__:null,Animate:gn,AnimateEvent:hi,get App(){return exports.App},AutoBounds:G,BezierHelper:Gt,Bounds:V,BoundsHelper:z,get Box(){return exports.Box},get Branch(){return exports.Branch},BranchHelper:Wi,BranchRender:Bi,get Canvas(){return exports.Canvas},CanvasManager:at,ChildEvent:ei,Creator:e,DataHelper:ct,Debug:Z,get DragEvent(){return exports.DragEvent},get DropEvent(){return exports.DropEvent},Effect:un,get Ellipse(){return exports.Ellipse},EllipseHelper:se,Event:ti,EventCreator:ot,Export:fn,FileHelper:_t,get Frame(){return exports.Frame},get Group(){return exports.Group},HitCanvasManager:dt,get Image(){return exports.Image},ImageEvent:ri,ImageManager:fo,IncrementId:s,get KeyEvent(){return exports.KeyEvent},Keyboard:oo,LayoutEvent:ai,Layouter:Wo,get Leaf(){return exports.Leaf},LeafBounds:xi,LeafBoundsHelper:Mi,LeafData:ut,LeafDataProxy:ci,LeafEventer:$r,LeafHelper:Si,LeafHit:wi,LeafLevelList:lt,LeafList:ht,LeafMask:bi,LeafMatrix:gi,LeafRender:Ei,get Leafer(){return exports.Leafer},LeaferCanvas:Yo,LeaferCanvasBase:kt,LeaferEvent:di,LeaferImage:mo,LeaferImageBase:mo,LeaferTypeCreator:cn,get Line(){return exports.Line},MathHelper:i,Matrix:T,MatrixHelper:f,get MoveEvent(){return exports.MoveEvent},NeedConvertToCanvasCommandMap:St,OneRadian:o,PI2:n,PI_2:a,Paint:_n,get Path(){return exports.Path},PathBounds:ur,PathCommandDataHelper:is,PathCommandMap:Pt,PathConvert:Fe,PathCorner:_r,PathCreator:ms,PathDrawer:As,PathHelper:Rt,PathNumberCommandLengthMap:At,PathNumberCommandMap:It,get Pen(){return exports.Pen},Platform:t,PluginManager:Eo,Point:R,PointHelper:C,PointerButton:no,get PointerEvent(){return exports.PointerEvent},get Polygon(){return exports.Polygon},PropertyEvent:si,get Rect(){return exports.Rect},RectHelper:Mt,RectRender:Na,RenderEvent:li,Renderer:No,ResizeEvent:ii,get RotateEvent(){return exports.RotateEvent},Run:J,Selector:zo,get Star(){return exports.Star},StringNumberMap:K,get SwipeEvent(){return exports.SwipeEvent},TaskItem:_o,TaskProcessor:go,get Text(){return exports.Text},TransformEvent:oi,TwoPointBounds:q,TwoPointBoundsHelper:P,get UI(){return exports.UI},UIBounds:Ma,UICreator:st,UIEvent:ho,UIHit:Wa,UIRender:Ua,WaitHelper:Fi,WatchEvent:ni,Watcher:Bo,get ZoomEvent(){return exports.ZoomEvent},affectRenderBoundsType:Pr,affectStrokeBoundsType:Rr,aliasType:vr,boundsType:Cr,canvasPatch:fr,canvasSizeAttrs:Ct,dataProcessor:Mr,dataType:wr,defineDataProcessor:Nr,defineKey:yr,defineLeafAttr:mr,effectType:Ia,eraserType:Ir,getDescriptor:xr,hitType:Ar,layoutProcessor:Wr,maskType:Dr,opacityType:Sr,pathType:kr,positionType:Er,registerUI:Gr,registerUIEvent:qr,resizeType:Aa,rewrite:Yr,rewriteAble:jr,rotationType:Br,scaleType:br,setDefaultValue:Ur,sortType:Or,strokeType:Tr,surfaceType:Lr,useCanvas:ln,useModule:Vr,usePlugin:bo});Eo.power=gl,exports.Animate=gn,exports.AnimateEvent=hi,exports.AutoBounds=G,exports.BezierHelper=Gt,exports.Bounds=V,exports.BoundsHelper=z,exports.BranchHelper=Wi,exports.BranchRender=Bi,exports.CanvasManager=at,exports.ChildEvent=ei,exports.Creator=e,exports.DataHelper=ct,exports.Debug=Z,exports.Effect=un,exports.EllipseHelper=se,exports.Event=ti,exports.EventCreator=ot,exports.Export=fn,exports.FileHelper=_t,exports.HitCanvasManager=dt,exports.ImageEvent=ri,exports.ImageManager=fo,exports.IncrementId=s,exports.Keyboard=oo,exports.LayoutEvent=ai,exports.Layouter=Wo,exports.LeafBounds=xi,exports.LeafBoundsHelper=Mi,exports.LeafData=ut,exports.LeafDataProxy=ci,exports.LeafEventer=$r,exports.LeafHelper=Si,exports.LeafHit=wi,exports.LeafLevelList=lt,exports.LeafList=ht,exports.LeafMask=bi,exports.LeafMatrix=gi,exports.LeafRender=Ei,exports.LeaferCanvas=Yo,exports.LeaferCanvasBase=kt,exports.LeaferEvent=di,exports.LeaferImage=mo,exports.LeaferImageBase=mo,exports.LeaferTypeCreator=cn,exports.MathHelper=i,exports.Matrix=T,exports.MatrixHelper=f,exports.NeedConvertToCanvasCommandMap=St,exports.OneRadian=o,exports.PI2=n,exports.PI_2=a,exports.Paint=_n,exports.PathBounds=ur,exports.PathCommandDataHelper=is,exports.PathCommandMap=Pt,exports.PathConvert=Fe,exports.PathCorner=_r,exports.PathCreator=ms,exports.PathDrawer=As,exports.PathHelper=Rt,exports.PathNumberCommandLengthMap=At,exports.PathNumberCommandMap=It,exports.Platform=t,exports.PluginManager=Eo,exports.Point=R,exports.PointHelper=C,exports.PointerButton=no,exports.PropertyEvent=si,exports.RectHelper=Mt,exports.RectRender=Na,exports.RenderEvent=li,exports.Renderer=No,exports.ResizeEvent=ii,exports.Run=J,exports.Selector=zo,exports.StringNumberMap=K,exports.TaskItem=_o,exports.TaskProcessor=go,exports.TransformEvent=oi,exports.TwoPointBounds=q,exports.TwoPointBoundsHelper=P,exports.UIBounds=Ma,exports.UICreator=st,exports.UIEvent=ho,exports.UIHit=Wa,exports.UIRender=Ua,exports.WaitHelper=Fi,exports.WatchEvent=ni,exports.Watcher=Bo,exports.affectRenderBoundsType=Pr,exports.affectStrokeBoundsType=Rr,exports.aliasType=vr,exports.boundsType=Cr,exports.canvasPatch=fr,exports.canvasSizeAttrs=Ct,exports.dataProcessor=Mr,exports.dataType=wr,exports.defineDataProcessor=Nr,exports.defineKey=yr,exports.defineLeafAttr=mr,exports.effectType=Ia,exports.eraserType=Ir,exports.getDescriptor=xr,exports.hitType=Ar,exports.layoutProcessor=Wr,exports.maskType=Dr,exports.opacityType=Sr,exports.pathType=kr,exports.positionType=Er,exports.registerUI=Gr,exports.registerUIEvent=qr,exports.resizeType=Aa,exports.rewrite=Yr,exports.rewriteAble=jr,exports.rotationType=Br,exports.scaleType=br,exports.setDefaultValue=Ur,exports.sortType=Or,exports.strokeType=Tr,exports.surfaceType=Lr,exports.useCanvas=ln,exports.useModule=Vr,exports.usePlugin=bo;
|