leafer-ui 1.0.0-alpha.8 → 1.0.0-alpha.9
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.js.map +1 -1
- package/package.json +9 -6
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class t{constructor(t){this.list=[],this.leafer=t}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e;const s=this.leafer.creator.canvas(t);return this.add(s),s}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destory(){this.clear(),this.leafer=void 0}}class e{constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}get length(){return this.list.length}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:i}=this;void 0===i[t.innerId]&&(e.push(t),i[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 i;for(let s=0,o=e.length;s<o;s++)void 0!==i?this.keys[e[s].innerId]=s-1:e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]);void 0!==i&&e.splice(i,1)}forEach(t){this.list.forEach(t)}clone(){const t=new e;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=void 0}}class i{constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}get length(){return this._length}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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=void 0}}class s extends t{constructor(){super(...arguments),this.pathTypeList=new e,this.imageTypeList=new e}get(t){}getImageType(t,e){return this.imageTypeList.push(t),this.leafer.creator.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),this.leafer.creator.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=void 0)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}const o={default:(t,e)=>(n(e,t),n(t,e),t),assign(t,e){let i;Object.keys(e).forEach((s=>{var o;i=e[s],(null==i?void 0:i.constructor)===Object&&(null===(o=t[s])||void 0===o?void 0:o.constructor)===Object?n(t[s],e[s]):t[s]=e[s]}))},clone:t=>JSON.parse(JSON.stringify(t))},{assign:n}=o;class r{constructor(t){this.__leaf=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]}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}destroy(){this.__leaf=void 0}}const a={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=h;return e[t]?e[t]++:(e[t]=1,0)}},h=a,d={within:(t,e,i)=>(t<e&&(t=e),t>i&&(t=i),t)},l=Math.PI/180,{sin:c,cos:u}=Math,p={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},scale(t,e,i=e){t.a*=e,t.d*=i,t.c*=e,t.b*=i,t.e*=e,t.f*=i},rotate(t,e){const i=e*l,s=u(i),o=c(i),{a:n,b:r,c:a,d:h,e:d,f:p}=t;t.a=n*s-r*o,t.b=n*o+r*s,t.c=a*s-h*o,t.d=a*o+h*s,t.e=d*s-p*o,t.f=d*o+p*s},times(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},divide(t,e){_.times(t,_.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=_;return _.copy(e,t),_.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t,a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a},toWorldPoint(t,e,i){const{x:s,y:o}=e;i||(i=e),i.x=s*t.a+o*t.c+t.e,i.y=s*t.b+o*t.d+t.f},toLocalPoint(t,e,i,s){const{x:o,y:n}=e,{a:r,b:a,c:h,d:d}=t,l=1/(r*d-a*h);if(i||(i=e),i.x=(o*d-n*h)*l,i.y=(n*r-o*a)*l,!s){const{e:e,f:s}=t;i.x-=(e*d-s*h)*l,i.y-=(s*r-e*a)*l}},empty(t){t.a=1,t.b=0,t.c=0,t.d=1,t.e=0,t.f=0}},_=p,{toLocalPoint:g,toWorldPoint:v}=p,{sin:y,cos:f,abs:m,sqrt:x,atan2:w}=Math,B={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},copy(t,e){t.x=e.x,t.y=e.y},rotate(t,e,i){i||(i=E.defaultPoint);const s=f(e*l),o=y(e*l),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o-r*s},tempToLocal(t,e){const{tempPoint:i}=E;return E.copy(i,t),g(e,i,i),i},tempToLocalRadiusPoint(t,e){const{tempRadiusPoint:i}=E;return E.copy(i,t),E.toLocalRadiusPoint(t,e,i),i},toLocalRadiusPoint(t,e,i){i||(i=t),g(e,t,i),i.radiusX=t.radiusX/e.a,i.radiusY=t.radiusY/e.d},toLocal(t,e,i){g(e,t,i)},toWorld(t,e,i){v(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const i=m(e.x-t.x),s=m(e.y-t.y);return x(i*i+s*s)},getAngle:(t,e)=>E.getAtan2(t,e)/l,getAtan2:(t,e)=>w(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i){const s=E.getAtan2(t,e);return{x:t.x+f(s)*i,y:t.y+y(s)*i}}},E=B;class b{constructor(t,e){"object"==typeof t?B.copy(this,t):B.set(this,t,e)}set(t,e){B.set(this,t,e)}copy(t){return B.copy(this,t),this}clone(){return new b(this)}rotate(t,e){B.rotate(this,t,e)}toLocal(t,e){B.toLocal(this,t,e)}toWorld(t,e){B.toWorld(this,t,e)}getCenter(t){return B.getCenter(this,t)}getDistance(t){return B.getDistance(this,t)}getAngle(t){return B.getAngle(this,t)}getAtan2(t){return B.getAtan2(this,t)}}class T{constructor(t,e,i,s,o,n){"object"==typeof t?p.copy(this,t):p.set(this,t,e,i,s,o,n)}set(t,e,i,s,o,n){p.set(this,t,e,i,s,o,n)}copy(t){return p.copy(this,t),this}clone(){return new T(this)}translate(t,e){return this.e+=t,this.f+=e,this}scale(t,e){return p.scale(this,t,e),this}rotate(t){return p.rotate(this,t),this}times(t){p.times(this,t)}divide(t){p.divide(this,t)}invert(){p.invert(this)}toWorldPoint(t,e){p.toWorldPoint(this,t,e)}toLocalPoint(t,e){p.toLocalPoint(this,t,e)}empty(){p.empty(this)}}const R={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},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}},{tempPointBounds:C,setPoint:P,addPoint:L,toBounds:k}=R,{toWorldPoint:S}=p;let M,D,O,A;const W={},I={},N={tempBounds:{},set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i){z.set(t,e.x-i,e.y-i,e.width+2*i,e.height+2*i)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,i){t.x+=e,t.y+=i},getByMove:(t,e,i)=>(t=Object.assign({},t),z.move(t,e,i),t),getOutOfBounds(t,e){const i=-(z.right(e)-t.x),s=-(z.bottom(e)-t.y),o=Object.assign(Object.assign({},t),{offsetX:i,offsetY:s});return z.move(o,-i,-s),o},tempTimesMatrix:(t,e)=>(z.copy(z.tempBounds,t),z.setByBoundsTimesMatrix(z.tempBounds,z.tempBounds,e),z.tempBounds),timesMatrix(t,e){z.setByBoundsTimesMatrix(t,t,e)},getByTimesMatrix:(t,e)=>(t=Object.assign({},t),z.setByBoundsTimesMatrix(t,t,e),t),divideMatrix(t,e){t.x=(t.x-e.e)/e.a,t.y=(t.y-e.f)/e.d,t.width/=e.a,t.height/=e.d},getFitMatrix(t,e){const i=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new T(i,0,0,i,-e.x*i,-e.y*i)},getSpread(t,e){const i={};return z.copyAndSpread(i,t,e),i},spread(t,e){z.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,D=t.y+t.height,O=e.x+e.width,A=e.y+e.height,M=M>O?M:O,D=D>A?D:A,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=D-t.y},addList(t,e){z.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,i=!1){z.setByListWithHandle(t,e,void 0,i)},addListWithHandle(t,e,i){z.setByListWithHandle(t,e,i,!0)},setByListWithHandle(t,e,i,s=!1){if(!e.length)return void z.empty(t);let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r]):e[r],(o.width||o.height)&&(n?(n=!1,s||j(t,o)):F(t,o))},setByBoundsTimesMatrix(t,e,i){0===i.b&&0===i.c?(t.x=i.e+e.x*i.a,t.y=i.f+e.y*i.d,t.width=e.width*i.a,t.height=e.height*i.d):(W.x=e.x,W.y=e.y,S(i,W,I),P(C,I.x,I.y),W.x=e.x+e.width,S(i,W,I),L(C,I.x,I.y),W.y=e.y+e.height,S(i,W,I),L(C,I.x,I.y),W.x=e.x,S(i,W,I),L(C,I.x,I.y),k(C,t))},setByPoints(t,e){e.forEach(((t,e)=>{0===e?P(C,t.x,t.y):L(C,t.x,t.y)})),k(C,t)},hitRadiusPoint:(t,e,i)=>(i&&(e=B.tempToLocalRadiusPoint(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=B.tempToLocal(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=z.tempTimesMatrix(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=z.tempTimesMatrix(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){i&&(e=z.tempTimesMatrix(e,i));let{x:s,y:o,width:n,height:r}=e;return M=s+n,D=o+r,O=t.x+t.width,A=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,M=M<O?M:O,D=D<A?D:A,n=M-s,r=D-o,{x:s,y:o,width:n,height:r}},setByIntersect(t,e,i){z.copy(t,z.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,empty(t){t.x=0,t.y=0,t.width=0,t.height=0}},z=N,{add:F,copy:j}=z;class Y{constructor(t,e,i,s){"object"==typeof t?N.copy(this,t):N.set(this,t,e,i,s)}set(t,e,i,s){N.set(this,t,e,i,s)}copy(t){return N.copy(this,t),this}clone(){return new Y(this)}timesMatrix(t){return N.timesMatrix(this,t),this}divideMatrix(t){return N.divideMatrix(this,t),this}getFitMatrix(t){return N.getFitMatrix(this,t)}spread(t){N.spread(this,t)}ceil(){N.ceil(this)}add(t){N.add(this,t)}addList(t){N.setByList(this,t,!0)}setByList(t,e){N.setByList(this,t,e)}addListWithHandle(t,e){N.setByListWithHandle(this,t,e,!0)}setByListWithHandle(t,e,i){N.setByListWithHandle(this,t,e,i)}setByBoundsTimesMatrix(t,e){N.setByBoundsTimesMatrix(this,t,e)}setByPoints(t){N.setByPoints(this,t)}hitPoint(t,e){return N.hitPoint(this,t,e)}hitRadiusPoint(t,e){return N.hitRadiusPoint(this,t,e)}hit(t,e){return N.hit(this,t,e)}includes(t,e){return N.includes(this,t,e)}getIntersect(t,e){return new Y(N.getIntersectData(this,t,e))}setByIntersect(t,e){N.setByIntersect(this,t,e)}isSame(t){return N.isSame(this,t)}isEmpty(){return N.isEmpty(this)}empty(){N.empty(this)}}class X{constructor(t,e,i,s,o,n){"object"==typeof t?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Y(o,e,n||t.width-o-i,r||t.height-e-s)}}class H{constructor(t,e){R.setPoint(this,t,e)}addPoint(t,e){R.addPoint(this,t,e)}add(t){R.add(this,t)}}const G={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};function U(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function K(t,e,i,s){return new(i||(i=Promise))((function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}h((s=s.apply(t,e||[])).next())}))}class V{constructor(t){this.name=t}static get(t){return new V(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)}error(...t){console.error(this.name,...t)}}var q;V.filterList=[],V.excludeList=[],V.__={},U([(t,e)=>{Object.defineProperty(t,e,{get:()=>t.enable?t.__[e]:q,set(t){this.__[e]=t}})}],V,"showRepaint",void 0);const Q=V;const Z=V.get("RunTime");class ${static start(t,e){const i=a.create(a.RUNTIME);return J.currentId=J.idMap[i]=e?performance.now():Date.now(),J.currentName=J.nameMap[i]=t,J.nameToIdMap[t]=i,i}static end(t,e){const i=J.idMap[t],s=J.nameMap[t];J.idMap[t]=void 0,J.nameMap[t]=void 0,J.nameToIdMap[s]=void 0,e?Z.log(s,performance.now()-i,"µs"):Z.log(s,Date.now()-i,"ms")}static endOfName(t,e){const i=J.nameToIdMap[t];i&&J.end(i,e)}}$.idMap={},$.nameMap={},$.nameToIdMap={};const J=$;function tt(t,e,i){Object.defineProperty(t,e,i)}function et(t,e){return Object.getOwnPropertyDescriptor(t,e)}function it(t){return(e,i)=>{tt(e,i,{get(){return this.__get(t)},set(e){this.root?this.__set(t,e):this.__[t]=e}})}}function st(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t}}),vt(e,i,t)}}function ot(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.positionChanged||this.__layout.positionChange()}}),vt(e,i,t)}}function nt(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.scaleChanged||this.__layout.scaleChange()}}),vt(e,i,t)}}function rt(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.rotationChanged||this.__layout.rotationChange()}}),vt(e,i,t)}}function at(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.boxBoundsChanged||this.__layout.boxBoundsChange()}}),vt(e,i,t)}}const ht=at;function dt(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.eventBoundsChanged||this.__layout.eventBoundsChange()}}),vt(e,i,t)}}function lt(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}}),vt(e,i,t)}}function ct(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.surfaceChanged||this.__layout.surfaceChange()}}),vt(e,i,t)}}function ut(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.opacityChanged||this.__layout.opacityChange()}}),vt(e,i,t)}}function pt(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.parent?this.parent.__layout.childrenSortChanged||(this.parent.__layout.childrenSortChanged=!0):this.__addParentWait((()=>{this.parent.__layout.childrenSortChanged||(this.parent.__layout.childrenSortChanged=!0)}))}}),vt(e,i,t)}}function _t(t){return(e,i)=>{tt(e,"__DataProcessor",{get:()=>t})}}function gt(t){return(e,i)=>{tt(e,"__LayoutProcessor",{get:()=>t})}}function vt(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[o];return void 0===t?i:t},set(t){this[o]=t}};void 0===i&&(r.get=function(){return this[o]});const a=et(s,e);a&&(a.set&&(r.set=a.set),a.get&&(r.get=a.get)),s[n]&&(r.set=s[n],delete s[n]),Object.defineProperty(s,e,r)}const yt=new V("rewrite"),ft=[],mt=["destroy","constructor"];function xt(t){return(e,i)=>{ft.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function wt(){return t=>{Bt()}}function Bt(t){ft.length&&(ft.forEach((e=>{t&&yt.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ft.length=0)}function Et(t){return e=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!mt.includes(i))if(t.prototype){et(t.prototype,i).writable&&(e.prototype[i]=t.prototype[i])}else e.prototype[i]=t[i]}))}}setTimeout((()=>Bt(!0)));const bt={},Tt=V.get("EventCreator"),Rt={typeList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Ct[e]?Tt.error("register the repeat EventType: ",e):Ct[e]=t)}))},get:(t,...e)=>new Ct[t](...e)},{typeList:Ct}=Rt,Pt=V.get("UICreator"),Lt={list:{},register(t){const{tag:e}=t.prototype;kt[e]?Pt.error("register the repeat UI: ",e):kt[e]=t},get:(t,e)=>new kt[t](e)},{list:kt}=Lt,St={ui:(t,e)=>Lt.get(t,e),event:(t,...e)=>Rt.get(t,...e)};function Mt(){return t=>{Lt.register(t)}}function Dt(){return t=>{Rt.register(t)}}const{setByBoundsTimesMatrix:Ot}=N;class At{constructor(t){this.leaf=t,this.renderBounds=this.eventBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.relativeRenderBounds=this.relativeEventBounds=t.__relative}update(){const{leafer:t}=this.leaf;t&&t.watcher.changed&&(t.running||t.start(),t.layouter.layout())}getTransform(t){return this.update(),"world"===t?this.leaf.__world:this.leaf.__relative}getBounds(t,e){if(this.update(),"world"===t)switch(e){case"render":return this.leaf.__world;case"box":return this.getWorldBoxBounds();case"event":return this.getWorldEventBounds()}else if("local"===t)switch(e){case"render":return this.renderBounds;case"box":return this.boxBounds;case"event":return this.eventBounds}else switch(e){case"render":return this.relativeRenderBounds;case"box":return this.leaf.__relative;case"event":return this.relativeEventBounds}return this.leaf.__world}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Ot(this._worldBoxBounds,this.boxBounds,this.leaf.__world),this._worldBoxBounds}getWorldEventBounds(){return this._worldEventBounds||(this._worldEventBounds={}),Ot(this._worldEventBounds,this.eventBounds,this.leaf.__world),this._worldEventBounds}eventBoundsSpreadCancel(){const t=this.renderBounds===this.eventBounds;this.eventBounds=this.boxBounds,this.relativeEventBounds=this.leaf.__relative,t&&this.renderBoundsSpreadCancel()}renderBoundsSpreadCancel(){this.renderBounds=this.eventBounds,this.relativeRenderBounds=this.relativeEventBounds}eventBoundsSpread(){const{x:t,y:e,width:i,height:s}=this.eventBounds;this.eventBounds={x:t,y:e,width:i,height:s},this.relativeEventBounds={x:t,y:e,width:i,height:s},this.renderBoundsSpreadWidth||this.renderBoundsSpreadCancel()}renderBoundsSpread(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this.renderBounds={x:t,y:e,width:i,height:s},this.relativeRenderBounds={x:t,y:e,width:i,height:s}}boxBoundsChange(){this.boxBoundsChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange(),this.hitCanvasChanged||(this.hitCanvasChanged=!0)}localBoxBoundsChange(){this.localBoxBoundsChanged=!0,this.boundsChanged||(this.boundsChanged=!0)}eventBoundsChange(){this.eventBoundsChanged=!0,this.eventBoundsSpreadWidth||(this.eventBoundsSpreadWidth=1),this.boundsChanged||(this.boundsChanged=!0)}renderBoundsChange(){this.renderBoundsChanged=!0,this.renderBoundsSpreadWidth||(this.renderBoundsSpreadWidth=1),this.boundsChanged||(this.boundsChanged=!0)}positionChange(){this.positionChanged=!0,this.matrixChanged||(this.matrixChanged=!0),this.localBoxBoundsChanged||this.localBoxBoundsChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation||(this.affectRotation=!0),this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation||(this.affectScaleOrRotation=!0),this.matrixChanged||(this.matrixChanged=!0),this.localBoxBoundsChanged||this.localBoxBoundsChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=void 0}}const Wt={},It={on(t,e,i){let s,o,n;if(i){const t="boolean"==typeof i;s=t?i:i.capture,o=!t&&i.once}const r=Nt(this,s,!0),a="string"==typeof t?t.split(" "):t,h=o?{listener:e,once:o}:{listener:e};a.forEach((t=>{t&&(n=r[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):r[t]=[h])}))},off(t,e,i){let s,o,n;i&&(s="boolean"==typeof i?i:i.capture);const r=Nt(this,s);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(o=r[t],o&&(n=o.findIndex((t=>t.listener===e)),n>-1&&o.splice(n,1),o.length||delete r[t]))}))},on__(t,e,i,s){return i&&(e=e.bind(i)),this.on(t,e,s),{type:t,listener:e,options:s}},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,i){this.on(t,e,{once:!0,capture:i})},emit(t,e,i){const s=Nt(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&(o=s[n],o.listener(e),o.once&&this.off(t,o.listener,i),!e||!e.isStopNow);n++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:i,__captureMap:s}=this;return void 0===e?!!(s&&s[t]||i&&i[t]):!!(e?s&&s[t]:i&&i[t])}};function Nt(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Wt)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Wt)}}class zt{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}}let Ft=class extends zt{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}};Ft.ADD="child.add",Ft.REMOVE="child.remove",Ft=U([Dt()],Ft);let jt=class extends zt{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}};var Yt;jt.CHANGE="attr.change",jt=U([Dt()],jt);let Xt=Yt=class extends zt{constructor(t,e){const i="object"==typeof t;super(i?Yt.RESIZE:t),i&&Object.assign(this,t),this.old=e}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}};Xt.RESIZE="resize",Xt=Yt=U([Dt()],Xt);let Ht=class extends zt{constructor(t,e){super(t),e&&Object.assign(this,e)}};Ht.BEFORE="transform.before",Ht.CHANGE="transform.change",Ht.AFTER="transform.after",Ht.PRE_BEFORE="transform.pre_before",Ht.PRE_CHANGE="transform.pre_change",Ht.PRE_AFTER="transform.pre_after",Ht=U([Dt()],Ht);let Gt=class extends zt{constructor(t,e){super(t),this.data=e}};Gt.REQUEST="watch.request",Gt.DATA="watch.data",Gt=U([Dt()],Gt);let Ut=class extends zt{constructor(t,e){super(t),e&&(this.data=e)}};Ut.REQUEST="layout.request",Ut.START="layout.start",Ut.BEFORE_ONCE="layout.before_once",Ut.ONCE="layout.once",Ut.AFTER_ONCE="layout.after_once",Ut.AGAIN="layout.again",Ut.LAYOUT="layout",Ut.END="layout.end",Ut=U([Dt()],Ut);let Kt=class extends zt{};Kt.REQUEST="render.request",Kt.START="render.start",Kt.BEFORE_ONCE="render.before_once",Kt.ONCE="render.once",Kt.AFTER_ONCE="render.after_once",Kt.AGAIN="render.again",Kt.RENDER="render",Kt.END="render.end",Kt=U([Dt()],Kt);const Vt={__set(t,e){const i=this.__.__getInput(t);i!==e&&(this.__[t]=e,this.root.emitEvent(new jt(jt.CHANGE,this,t,i,e)))},__get(t){return this.__.__getInput(t)},__updateAttr(t){var e;const i=this.__.__getInput(t);null===(e=this.root)||void 0===e||e.emitEvent(new jt(jt.CHANGE,this,t,i,i))}},{defaultMatrix:qt}=p,{sin:Qt,cos:Zt}=Math,$t={__updateWorldMatrix(){const t=this.parent?this.parent.__world:qt,e=this.__relative,i=this.__world;this.__layout.matrixChanged&&this.__updateRelativeMatrix(),this.__layout.affectScaleOrRotation?(i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.e=e.e*t.a+e.f*t.c+t.e,i.f=e.e*t.b+e.f*t.d+t.f):(i.a=t.a,i.b=t.b,i.c=t.c,i.d=t.d,i.e=e.e*t.a+e.f*t.c+t.e,i.f=e.e*t.b+e.f*t.d+t.f)},__updateRelativeMatrix(){const t=this.__relative,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:i,scaleY:s}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:o,skewX:n,skewY:r}=this.__;o||n||r?(o*=l,n&&(n*=l),r&&(r*=l),t.a=i*Zt(o+r),t.b=i*Qt(o+r),t.c=s*-Qt(o-n),t.d=s*Zt(o-n)):(t.a=i,t.b=0,t.c=0,t.d=s,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=i,t.d=s,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{setByBoundsTimesMatrix:Jt}=N,te={__updateWorldBounds(){var t,e,i;if(this.__layout.boundsChanged){let s;const o=this.__layout;o.boxBoundsChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),o.boxBoundsChanged=!1,s=!0),o.localBoxBoundsChanged&&(this.__updateRelativeBoxBounds(),o.localBoxBoundsChanged=!1,o.eventBoundsSpreadWidth&&(o.eventBoundsChanged=!0),o.renderBoundsSpreadWidth&&(o.renderBoundsChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxBoundsChange()),o.eventBoundsChanged&&(o.eventBoundsSpreadWidth=this.__updateEventBoundsSpreadWidth(),o.eventBoundsSpreadWidth?(o.eventBounds===o.boxBounds&&o.eventBoundsSpread(),this.__updateEventBounds(),this.__updateRelativeEventBounds(),o.eventBoundsChanged=!1,o.renderBoundsSpreadWidth&&(o.renderBoundsChanged=!0)):o.eventBoundsSpreadCancel(),null===(e=this.parent)||void 0===e||e.__layout.eventBoundsChange(),s||(s=!0)),o.renderBoundsChanged&&(o.renderBoundsSpreadWidth=this.__updateRenderBoundsSpreadWidth(),o.renderBoundsSpreadWidth?(o.renderBounds!==o.boxBounds&&o.renderBounds!==o.eventBounds||o.renderBoundsSpread(),this.__updateRenderBounds(),this.__updateRelativeRenderBounds(),o.renderBoundsChanged=!1):o.renderBoundsSpreadCancel(),null===(i=this.parent)||void 0===i||i.__layout.renderBoundsChange()),o.boundsChanged=!1,Jt(this.__world,this.__layout.renderBounds,this.__world),s&&this.__onUpdateSize()}else Jt(this.__world,this.__layout.renderBounds,this.__world)},__updateRelativeBoxBounds(){Jt(this.__relative,this.__layout.boxBounds,this.__relative)},__updateRelativeEventBounds(){Jt(this.__layout.relativeEventBounds,this.__layout.eventBounds,this.__relative)},__updateRelativeRenderBounds(){Jt(this.__layout.relativeRenderBounds,this.__layout.renderBounds,this.__relative)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height}},{toLocalRadiusPoint:ee}=B,ie={},se={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawRenderPath(this.__hitCanvas)},__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),ee(t,this.__world,ie),this.__hit(ie)}},oe={__render(t,e){this.__worldOpacity&&(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__complex?this.__draw(t,e):this.__drawFast(t,e))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{LEAF:ne,create:re}=a;let ae=class{constructor(t){this.innerId=re(ne),this.__relative={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},this.__worldOpacity=1,this.__renderTime=2,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}get tag(){return this.constructor.name}get __DataProcessor(){return r}get __LayoutProcessor(){return At}__addParentWait(t){this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}__runParentWait(){const t=this.__parentWait.length;for(let e=0;e<t;e++)this.__parentWait[e]();this.__parentWait=void 0}__setAsLeafer(){this.leafer=this}__setAsRoot(){this.__bindRoot(this),this.__isRoot=!0}__bindRoot(t){if(!this.__isRoot&&(this.root=t,this.leafer=t.leafer,this.__level=this.parent?this.parent.__level+1:1,this.__isBranch)){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindRoot(t)}}__set(t,e){}__get(t){}__updateAttr(t){}__updateWorldOpacity(){}__updateWorldMatrix(){}__updateRelativeMatrix(){}__updateWorldBounds(){}__updateRelativeBoxBounds(){}__updateRelativeEventBounds(){}__updateRelativeRenderBounds(){}__updateBoxBounds(){}__updateEventBounds(){}__updateRenderBounds(){}__updateEventBoundsSpreadWidth(){return 0}__updateRenderBoundsSpreadWidth(){return 0}__onUpdateSize(){}__hitWorld(t){return!0}__hit(t){return!0}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){}on(t,e,i){}off(t,e,i){}on__(t,e,i,s){}off__(t){}once(t,e,i){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.__&&(this.__isBranch&&(this.children.forEach((t=>{t.destroy()})),this.children=void 0),this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=void 0),this.leafer=void 0,this.root=void 0,this.parent=void 0,this.__.destroy(),this.__layout.destroy(),this.__=void 0,this.__layout=void 0,this.__captureMap=void 0,this.__bubbleMap=void 0)}};ae=U([Et(Vt),Et($t),Et(te),Et(se),Et(It),Et(oe)],ae);const he={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.__isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)le(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.__isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ce(e[t])}},updateAllChange(t){if(ce(t),t.__updateChange(),t.__isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ue(e[t])}},moveByWorld(t,e,i){const s={x:e,y:i};t.parent&&p.toLocalPoint(t.parent.__world,s,s,!0),de.move(t,s.x,s.y)},move(t,e,i){t.x=t.__.x+e,t.y=t.__.y+i},zoomByWorld(t,e,i,s){const o=t.parent?B.tempToLocal(i,t.parent.__world):i;this.zoom(t,e,o,s)},zoom(t,e,i,s){s||(s=t);const{x:o,y:n}=s.__,{scaleX:r,scaleY:a}=t.__,h=i.x-o,d=i.y-n,l=(new T).translate(h,d).scale(e).translate(-h,-d);s.x=o-l.e,s.y=n-l.f,t.scaleX=r*e,t.scaleY=a*e},rotateByWorld(t,e,i,s){const o=t.parent?B.tempToLocal(i,t.parent.__world):i;this.rotate(t,e,o,s)},rotate(t,e,i,s){s||(s=t);const{x:o,y:n}=s.__,{rotation:r}=t.__,a=i.x-o,h=i.y-n,d=(new T).translate(a,h).rotate(e).translate(-a,-h);s.x=o-d.e,s.y=n-d.f,t.rotation=r+e}},de=he,{updateAllWorldMatrix:le,updateAllWorldOpacity:ce,updateAllChange:ue}=de,pe={worldBounds:t=>t.__world,relativeBoxBounds:t=>t.__relative,relativeEventBounds:t=>t.__layout.relativeEventBounds,relativeRenderBounds:t=>t.__layout.relativeRenderBounds},_e={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__childBranchNumber){const{children:i}=t;for(let s=0,o=i.length;s<o;s++)(t=i[s]).__isBranch&&(t.__tempNumber=1,e.push(t),ge(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&void 0===i[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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].__isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ve(e[t],e)},updateWorldBoundsByBranchStack(t){let e;for(let i=t.length-1;i>-1;i--){e=t[i];for(let t=0,i=e.children.length;t<i;t++)e.children[t].__updateWorldBounds()}e.__updateWorldBounds()}},{pushAllChildBranch:ge,pushAllBranchStack:ve}=_e,{setByListWithHandle:ye}=N,{sort:fe}=_e,{relativeBoxBounds:me,relativeEventBounds:xe,relativeRenderBounds:we}=pe;class Be extends ae{constructor(){super(),this.__isBranch=!0,this.children=[]}__updateEventBoundsSpreadWidth(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.eventBoundsSpreadWidth)return 1;return 0}__updateRenderBoundsSpreadWidth(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderBoundsSpreadWidth)return 1;return 0}__updateBoxBounds(){ye(this.__layout.boxBounds,this.children,me)}__updateEventBounds(){ye(this.__layout.eventBounds,this.children,xe)}__updateRenderBounds(){ye(this.__layout.renderBounds,this.children,we)}__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1)}__updateSortChildren(){const{children:t}=this;if(t.length>1){for(let e=0,i=t.length;e<i;e++)t[e].__tempNumber=e;t.sort(fe)}}__render(t,e){if(this.__worldOpacity){let i;const{bounds:s,hideBounds:o}=e,{children:n}=this;for(let r=0,a=n.length;r<a;r++)i=n[r],s&&!s.hit(i.__world,e.matrix)||o&&o.includes(i.__world)||i.__render(t,e)}}add(t,e){if(t.parent)t.parent!==this&&console.warn("child had other parent, can not add to this, child innerId:"+t.innerId);else{if(t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.__isBranch&&(this.__childBranchNumber?this.__childBranchNumber++:this.__childBranchNumber=1),this.root){t.__bindRoot(this.root);const e=new Ft(Ft.ADD,t,this);this.hasEvent(Ft.ADD)&&this.emitEvent(e),this.root.emitEvent(e)}t.__parentWait&&t.__runParentWait()}}remove(t){if(t){const e=this.children.indexOf(t);if(e>-1){if(this.children.splice(e,1),t.__isBranch&&(this.__childBranchNumber>1?this.__childBranchNumber--:this.__childBranchNumber=0),this.root){const e=new Ft(Ft.REMOVE,t,this);this.hasEvent(Ft.REMOVE)&&this.emitEvent(e),this.root.emitEvent(e),t.root=void 0}t.parent=void 0,this.__layout.boxBoundsChange()}}else this.parent&&this.parent.remove(this)}}const Ee={};class be{static isHoldSpaceKey(){return be.hasDownCode("Space")}static setDownCode(t){Ee[t]||(Ee[t]=!0)}static setUpCode(t){Ee[t]=!1}static hasDownCode(t){return Ee[t]}}class Te{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class Re extends zt{constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}get spaceKey(){return be.isHoldSpaceKey()}get left(){return Te.left(this)}get right(){return Te.right(this)}get middle(){return Te.middle(this)}}let Ce=class extends Re{};Ce.POINTER="pointer",Ce.BEFORE_DOWN="pointer.before_down",Ce.BEFORE_MOVE="pointer.before_move",Ce.BEFORE_UP="pointer.before_up",Ce.DOWN="pointer.down",Ce.MOVE="pointer.move",Ce.UP="pointer.up",Ce.ENTER="pointer.enter",Ce.LEAVE="pointer.leave",Ce.TAP="tap",Ce.CLICK="click",Ce.DOUBLE_CLICK="doubleclick",Ce.LONG_PRESS="longpress",Ce.LONG_TAP="longtap",Ce=U([Dt()],Ce);let Pe=class extends Ce{};var Le;Pe.DRAG="drag",Pe.START="drag.start",Pe.END="drag.end",Pe=U([Dt()],Pe);let ke=Le=class extends Ce{static setList(t){Le.dragList=t instanceof e?t:new e(t)}};ke.DROP="drop",ke.ENTER="drop.enter",ke.LEAVE="drop.leave",ke=Le=U([Dt()],ke);let Se=class extends Pe{};Se.MOVE="move",Se.START="move.start",Se.END="move.end",Se=U([Dt()],Se);let Me=class extends Re{};Me.ROTATE="rotate",Me.START="rotate.start",Me.END="rotate.end",Me=U([Dt()],Me);let De=class extends Pe{};De.SWIPE="swipe",De.LEFT="swipe.left",De.RIGHT="swipe.right",De.UP="swipe.up",De.DOWN="swipe.down",De=U([Dt()],De);let Oe=class extends Re{};Oe.ZOOM="zoom",Oe.START="zoom.start",Oe.END="zoom.end",Oe=U([Dt()],Oe);let Ae=class extends Re{};Ae.DOWN="key.down",Ae.PRESS="key.press",Ae.UP="key.up",Ae=U([Dt()],Ae);class We{constructor(t,e){this.list=[],this.leafer=t}load(){}destory(){this.leafer=void 0}}const Ie={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,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},Ne={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,rect:5,roundRect:6,ellipse:9,arc:7,arcTo:6},ze={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},Fe=Ie,je={};for(let t in Fe)je[Fe[t]]=t;const Ye={};for(let t in Fe)Ye[Fe[t]]=Ne[t];const Xe={},{sin:He,cos:Ge,sqrt:Ue,atan2:Ke,ceil:Ve,abs:qe,PI:Qe}=Math,{setPoint:Ze,addPoint:$e}=R,Je={getFromACommand(t,e,i,s,o,n,r,a,h){const d=a-t,l=h-e,c=o*Qe/180,u=He(c),p=Ge(c),_=-p*d*.5-u*l*.5,g=-p*l*.5+u*d*.5,v=i*i,y=s*s,f=g*g,m=_*_,x=v*y-v*f-y*m;let w=0;if(x<0){const t=Ue(1-x/(v*y));i*=t,s*=t}else{w=(n===r?-1:1)*Ue(x/(v*f+y*m))}const B=w*i*g/s,E=-w*s*_/i,b=p*B-u*E+.5*d,T=u*B+p*E+.5*l;let R=Ke((g-E)/s,(_-B)/i),C=Ke((-g-E)/s,(-_-B)/i),P=C-R;0===r&&P>0?P-=2*Qe:1===r&&P<0&&(P+=2*Qe);const L=[],k=Ve(qe(P/Qe*2)),S=P/k,M=He(S/2),D=He(S/4),O=8/3*D*D/M;R=0,C=Ke((g-E)/s,(_-B)/i);let A,W,I,N,z,F,j,Y,X=C-R,H=X+S,G=Ge(X),U=He(X),K=0,V=0;for(let o=0;o<k;o++)A=Ge(H),W=He(H),I=p*i*A-u*s*W+b,N=u*i*A+p*s*W+T,z=K+O*(-p*i*U-u*s*G),F=V+O*(-u*i*U+p*s*G),j=I+O*(p*i*W+u*s*A),Y=N+O*(u*i*W-p*s*A),L.push(Ie.C,z+t,F+e,j+t,Y+e,I+t,N+e),K=I,V=N,X=H,G=A,U=W,H+=S;return L},toTwoPointBounds(t,e,i,s,o,n,r,a,h){const d=[];let l,c,u,p,_,g,v,y,f=t,m=i,x=o,w=r;for(let t=0;t<2;++t)if(1==t&&(f=e,m=s,x=n,w=a),l=-3*f+9*m-9*x+3*w,c=6*f-12*m+6*x,u=3*m-3*f,Math.abs(l)<1e-12){if(Math.abs(c)<1e-12)continue;p=-u/c,0<p&&p<1&&d.push(p)}else v=c*c-4*u*l,y=Math.sqrt(v),v<0||(_=(-c+y)/(2*l),0<_&&_<1&&d.push(_),g=(-c-y)/(2*l),0<g&&g<1&&d.push(g));Ze(h,t,e),$e(h,r,a);for(let l=0,c=d.length;l<c;l++)ti.getPointAndSet(d[l],t,e,i,s,o,n,r,a,Xe),$e(h,Xe.x,Xe.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,d){const l=1-t,c=l*l*l,u=3*l*l*t,p=3*l*t*t,_=t*t*t;d.x=c*e+u*s+p*n+_*a,d.y=c*i+u*o+p*r+_*h},getPoint(t,e,i,s,o,n,r,a,h){const d={};return ti.getPointAndSet(t,e,i,s,o,n,r,a,h,d),d}},ti=Je,{M:ei,m:ii,L:si,l:oi,H:ni,h:ri,V:ai,v:hi,C:di,c:li,S:ci,s:ui,Q:pi,q:_i,T:gi,t:vi,A:yi,a:fi,Z:mi,z:xi}=Ie,{getFromACommand:wi}=Je,Bi={current:{},stringify(t){let e,i,s,o=0,n=t.length,r="";for(;o<n;){i=t[o],e=Ye[i],r+=i===s?" ":je[i];for(let i=1;i<e;i++)r+=t[o+i],i===e-1||(r+=" ");s=i,o+=e}return r},parse(t,e=!0){let i,s,o="";const n=[];for(let e=0,r=t.length;e<r;e++)s=t[e],G[s]?o+=s:Ie[s]?(o&&(bi(n,Number(o)),o=""),Ei.name=Ie[s],Ei.length=Ne[s],Ei.index=0,bi(n,Ei.name),!i&&ze[s]&&(i=!0)):"-"===s?(o&&bi(n,Number(o)),o=s):o&&(bi(n,Number(o)),o="");return o&&bi(n,Number(o)),e&&i?Bi.convertToSimple(n):n},convertToSimple(t){let e,i,s,o,n,r=0,a=0,h=0,d=0,l=0,c=t.length;const u=[];for(;l<c;){switch(s=t[l],s){case ii:t[l+1]+=r,t[l+2]+=a;case ei:r=t[l+1],a=t[l+2],u.push(ei,r,a),l+=3;break;case ri:t[l+1]+=r;case ni:r=t[l+1],u.push(si,r,a),l+=2;break;case hi:t[l+1]+=a;case ai:a=t[l+1],u.push(si,r,a),l+=2;break;case oi:t[l+1]+=r,t[l+2]+=a;case si:r=t[l+1],a=t[l+2],u.push(si,r,a),l+=3;break;case ui:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,s=ci;case ci:n=o===di||o===ci,h=n?2*r-e:t[l+1],d=n?2*a-i:t[l+2],e=t[l+1],i=t[l+2],r=t[l+3],a=t[l+4],u.push(di,h,d,e,i,r,a),l+=5;break;case li:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,t[l+5]+=r,t[l+6]+=a,s=di;case di:e=t[l+3],i=t[l+4],r=t[l+5],a=t[l+6],u.push(di,t[l+1],t[l+2],e,i,r,a),l+=7;break;case vi:t[l+1]+=r,t[l+2]+=a,s=gi;case gi:n=o===pi||o===gi,e=n?2*r-e:t[l+1],i=n?2*a-i:t[l+2],r=t[l+1],a=t[l+2],u.push(pi,e,i,r,a),l+=3;break;case _i:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,s=pi;case pi:e=t[l+1],i=t[l+2],r=t[l+3],a=t[l+4],u.push(pi,e,i,r,a),l+=5;break;case fi:t[l+6]+=r,t[l+7]+=a;case yi:u.push(...wi(r,a,t[l+1],t[l+2],t[l+3],t[l+4],t[l+5],t[l+6],t[l+7])),r=t[l+6],a=t[l+7],l+=8;break;case xi:case mi:u.push(mi),l++}o=s}return u},pushData(t,e){Ei.index===Ei.length&&(Ei.index=1,t.push(Ei.name)),t.push(e),Ei.index++}},{current:Ei,pushData:bi}=Bi,{M:Ti,L:Ri,C:Ci,Q:Pi,Z:Li,ellipse:ki}=Ie,{toTwoPointBounds:Si}=Je,{add:Mi,addPoint:Di,setPoint:Oi}=R,Ai={},Wi={applyCorner:(t,e,i)=>t,toTwoPointBounds(t,e){let i,s,o,n,r,a,h,d=0;const l=t.length;for(;d<l;)switch(i=t[d],0===d&&(i===Ti?Oi(e,t[1],t[2]):Oi(e,0,0)),i){case Ti:case Ri:s=t[d+1],o=t[d+2],Di(e,s,o),d+=3;break;case Ci:a=t[d+5],h=t[d+6],Si(s,o,t[d+1],t[d+2],t[d+3],t[d+4],a,h,Ai),Mi(e,Ai),s=a,o=h,d+=7;break;case Pi:n=t[d+1],r=t[d+2],a=t[d+3],h=t[d+4],Si(s,o,n,r,n,r,a,h,Ai),Mi(e,Ai),s=a,o=h,d+=5;break;case Li:d+=1}e.minX--,e.minY--,e.maxX++,e.maxY++},drawData(t,e){let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case Ti:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ri:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ci:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Pi:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Li:t.closePath(),s+=1;break;case ki:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6],e[s+7],e[s+8]),s+=9}}};let Ii;const{M:Ni,L:zi,C:Fi,Q:ji,Z:Yi,rect:Xi,roundRect:Hi,ellipse:Gi,arc:Ui,arcTo:Ki}=Ie,Vi={begin(t){Ii=t},end(){Ii=void 0},moveTo(t,e){Ii.push(Ni,t,e)},lineTo(t,e){Ii.push(zi,t,e)},bezierCurveTo(t,e,i,s,o,n){Ii.push(Fi,t,e,i,s,o,n)},quadraticCurveTo(t,e,i,s){Ii.push(ji,t,e,i,s)},close(t){Ii.push(Yi),t&&(Ii=void 0)},rect(t,e,i,s){Ii.push(Xi,t,e,i,s)},roundRect(t,e,i,s,o){Ii.push(Hi,t,e,i,s,o)},ellipse(t,e,i,s,o,n,r,a){Ii.push(Gi,t,e,i,s,o,n,r,a)},arc(t,e,i,s,o,n){Ii.push(Ui,t,e,i,s,o,n)},arcTo(t,e,i,s,o){Ii.push(Ki,t,e,i,s,o)}},qi=V.get("plugin"),Qi={list:[]};function Zi(t,e){if(Qi.list.push(t),t.dependencies){const i={};t.dependencies.forEach((t=>{e[t]?i[t]=e[t]:qi.error(t+" non-existent")})),t.run(i)}else qi.error("no dependencies")}class $i{constructor(t){this.taskTime=1,this.id=a.create(a.TASK),this.task=t}run(){return K(this,void 0,void 0,(function*(){this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}))}complete(){this.isComplete=!0,this.parent=void 0,this.task=void 0}}const Ji=V.get("TaskProcessor");class ts{constructor(t){this.parallel=6,this.params={},this.list=[],this.index=0,t&&(this.params=t,t.parallel&&(this.parallel=t.parallel)),this.init()}get isComplete(){return this._isComplete}get running(){return this._running}get percent(){const t=this.list.length;let e=0,i=0;for(let s=0;s<t;s++)s<=this.index?(i+=this.list[s].taskTime,s===this.index&&(e=i)):e+=this.list[s].taskTime;let s=this._isComplete?1:i/e;return Number.isNaN(s)&&(s=0),s}get total(){return this.list.length}get runIndex(){return this.index}init(){this.empty(),this.index=0,this.parallelSuccessNumber=0,this._running=!1,this._isComplete=!1}empty(){this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){this._running=!1,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new $i(t),e)}addParallel(t,e){const i=new $i(t);i.parallel=!0,this.push(i,e)}addEmpty(t){this.push(new $i(t))}push(t,e){e&&(t.taskTime=e),t.parent=this,this.list.push(t)}run(){this._running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTask():this.runTask())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTask(){this.parallelList.forEach((t=>{t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.index+this.parallelSuccessNumber+i;if(e.length){if(!this._running)return;s<this.list.length&&(t=this.list[s],t.parallel&&(e.push(t),t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))))}else this.index+=this.parallelSuccessNumber,this.nextTask()}nextTask(){setTimeout((()=>{this.run()}),0)}onComplete(){this.stop(),this._isComplete=!0,this.params.onComplete&&this.params.onComplete()}onTask(t){t.complete(),this.params.onTask&&this.params.onTask(),this.index===this.list.length-1&&this.onComplete()}onParallelError(t){Ji.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.params.onError&&this.params.onError(t)}}class es{constructor(t,i){this.updatedList=new e,this.totalTimes=0,this.config={},this.changed=!0,this.target=t,i&&(this.config=o.default(i,this.config)),this.listenEvents()}start(){this.running=!0,this.changed=!1,this.update()}stop(){this.running=!1}listenEvents(){const{target:t}=this;this.eventIds=[t.on__(jt.CHANGE,this.onAttrChange,this),t.on__([Ft.ADD,Ft.REMOVE],this.onChildEvent,this),t.on__(Gt.REQUEST,this.onRquestData,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onRquestData(){this.target.emitEvent(new Gt(Gt.DATA,{updatedList:this.updatedList})),this.updatedList=new e,this.totalTimes++,this.changed=!1}onAttrChange(t){this.updatedList.push(t.target),this.update()}onChildEvent(t){this.updatedList.push(t.type===Ft.REMOVE?t.parent:t.child),this.update()}update(){this.running&&(this.changed=!0,this.target.emit(Kt.REQUEST))}destroy(){this.target&&(this.removeListenEvents(),this.target=void 0,this.updatedList=void 0)}}const{updateAllWorldMatrix:is,updateAllWorldOpacity:ss}=he,{pushAllChildBranch:os,pushAllParent:ns}=_e;const{worldBounds:rs}=pe,{setByListWithHandle:as}=N;class hs{constructor(t){this.updatedBounds=new Y,this.beforeBounds=new Y,this.afterBounds=new Y,t instanceof Array&&(t=new e(t)),this.updatedList=t}setBefore(){as(this.beforeBounds,this.updatedList.list,rs)}setAfter(){as(this.afterBounds,this.updatedList.list,rs),this.__computeChange()}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}__computeChange(){const{updatedBounds:t}=this;t.setByList([this.beforeBounds,this.afterBounds]),t.isEmpty()||(t.spread(2),t.ceil())}destroy(){this.updatedList=void 0}}const{updateAllWorldMatrix:ds,updateAllChange:ls}=he,{pushAllBranchStack:cs,updateWorldBoundsByBranchStack:us}=_e;class ps{constructor(t,e){this.totalTimes=0,this.changed=!0,this.config={partLayout:{maxTimes:3}},this.levelList=new i,this.target=t,e&&(this.config=o.default(e,this.config)),this.listenEvents()}start(){this.running=!0}stop(){this.running=!1}listenEvents(){const{target:t}=this;this.eventIds=[t.on__(Ut.REQUEST,this.layout,this),t.on__(Ut.AGAIN,this.layoutOnce,this),t.on__(Gt.DATA,this.onReceiveWatchData,this),t.on__(Kt.REQUEST,this.onChange,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onReceiveWatchData(t){this.updateList=t.data.updatedList}onChange(){this.changed=!0}layout(){if(!this.running)return;const{target:t}=this,{START:e,LAYOUT:i,END:s}=Ut;this.times=0,this.changed=!1,t.emit(e),this.layoutOnce(),t.emitEvent(new Ut(i,this.layoutedBlocks)),t.emitEvent(new Ut(s,this.layoutedBlocks)),this.layoutedBlocks=void 0}layoutOnce(){this.totalTimes++,this.times++,this.target.emit(Gt.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout()}partLayout(){var t;if(!(null===(t=this.updateList)||void 0===t?void 0:t.length))return;const e=$.start("part layout"),{target:i,updateList:s}=this,{BEFORE_ONCE:o,ONCE:n,AFTER_ONCE:r}=Ut,a=this.getBlocks(s);a.forEach((t=>{t.setBefore()})),i.emitEvent(new Ut(o,a)),s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&(i.matrixChanged?(is(t),e.push(t),t.__isBranch&&os(t,e),ns(t,e)):i.boundsChanged&&(e.push(t),t.__isBranch&&(t.__tempNumber=0),ns(t,e)))}))}(s,this.levelList),function(t){let e,i;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(i=e[t],i.__isBranch&&i.__tempNumber)for(let t=0,e=i.children.length;t<e;t++)i.children[t].__isBranch||i.children[t].__updateWorldBounds();i.__updateWorldBounds()}}))}(this.levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&ss(t),t.__updateChange()}))}(s),a.forEach((t=>{t.setAfter()})),i.emitEvent(new Ut(n,a)),i.emitEvent(new Ut(r,a)),this.setBlocks(a),this.levelList.reset(),this.updateList=void 0,$.end(e),this.__checkAgain()}fullLayout(){const t=$.start("full layout"),{target:i}=this,{BEFORE_ONCE:s,ONCE:o,AFTER_ONCE:n}=Ut,r=this.getBlocks(new e(i));i.emitEvent(new Ut(s,r)),ps.fullLayout(i),r.forEach((t=>{t.setAfter()})),i.emitEvent(new Ut(o,r)),i.emitEvent(new Ut(n,r)),this.setBlocks(r),$.end(t),this.__checkAgain()}__checkAgain(){this.changed&&this.times<=this.config.partLayout.maxTimes&&this.target.emit(Ut.AGAIN)}createBlock(t){return new hs(t)}getBlocks(t){return[this.createBlock(t)]}setBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}static fullLayout(t){if(ds(t),t.__isBranch){const e=[t];cs(t,e),us(e)}else t.__updateWorldBounds();ls(t)}destroy(){this.target&&(this.removeListenEvents(),this.target=void 0)}}class _s{constructor(t,e,i){this.totalTimes=0,this.times=0,this.FPS=60,this.config={maxFPS:60},this._changed=!1,this.target=t,this.canvas=e,i&&(this.config=o.default(i,this.config)),this.listenEvents()}set changed(t){t?this._changed||(this._changed=!0,this.requestRender()):this._changed=!1}get changed(){return this._changed}start(){this.running=!0,this.changed=!0}stop(){this.running=!1}listenEvents(){const{target:t}=this;this.eventIds=[t.on__(Kt.REQUEST,this.onRequest,this),t.on__(Ut.END,this.onLayoutEnd,this),t.on__(Kt.AGAIN,this.renderOnce,this),t.on__(Xt.RESIZE,this.onResize,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onResize(t){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;new Y(0,0,e,i).includes(this.target.__world)||(this.target.__updateAttr("fill"),this.changed=!0)}}onRequest(){this.changed=!0}requestLayout(){this.target.emit(Ut.REQUEST)}onLayoutEnd(t){this.layoutedBlocks=t.data}render(t){const{target:e}=this,{START:i,RENDER:s,END:o}=Kt;this.times=0,e.emit(i),this.renderOnce(t),e.emit(s),e.emit(o)}renderOnce(t){const{target:e}=this,{BEFORE_ONCE:i,ONCE:s,AFTER_ONCE:o}=Kt;this.times++,this.totalTimes++,this.changed=!1,t?(e.emit(i),t()):(this.requestLayout(),e.emit(i),this.totalTimes>1?this.layoutedBlocks&&this.partRender():this.fullRender()),e.emit(s),e.emit(o),this.layoutedBlocks&&(this.layoutedBlocks.forEach((t=>{t.destroy()})),this.layoutedBlocks=void 0),this.__checkAgain()}__checkAgain(){this.changed&&this.times<3&&this.target.emit(Kt.AGAIN)}partRender(){const{canvas:t,layoutedBlocks:e}=this;if(e.some((t=>t.updatedBounds.includes(this.target.__world))))this.fullRender(t.bounds);else{let i;e.forEach((e=>{i=e.updatedBounds,t.bounds.hit(i)&&!i.isEmpty()&&this.clipRender(i.getIntersect(t.bounds))}))}}clipRender(t){const e=$.start("part render"),{canvas:i,target:s}=this;i.save(),i.clearBounds(t),V.showRepaint&&i.strokeBounds(t,"red"),i.clipBounds(t),s.__render(i,{bounds:t}),i.restore(),$.end(e)}fullRender(t){const{canvas:e,target:i}=this;_s.fullRender(i,e,t),V.showRepaint&&e.strokeBounds(t||e.bounds,"red")}static fullRender(t,e,i){const s=$.start("full render");i||(i=e.bounds),e.save(),e.clear(),t.__render(e,e.bounds.includes(t.__world)?{}:{bounds:i}),e.restore(),$.end(s)}requestRender(){const t=Date.now();bt.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&this.render())}))}destroy(){this.target&&(this.removeListenEvents(),this.target=void 0,this.canvas=void 0,this.config=void 0)}}const{hitRadiusPoint:gs}=N;class vs{constructor(t,e){this.target=t,this.selector=e}getHitPointPath(t,i,s){const o=!!s&&s.through;this.exclude=s?s.exclude:void 0,this.isStop=!1,this.point={x:t.x,y:t.y,radiusX:i,radiusY:i},this.eachFind(this.target.children);const{leaf:n}=this,{defaultPath:r}=this.selector,a=this.getPath(n);let h;if(a.pushList(r.list),o){const t=this.throughPath=new e;this.eachThroughFind(this.target.children),t.pushList(r.list),h={path:a,leaf:n,throughPath:t}}else h={path:a,leaf:n};return this.clear(),h}getPath(t){const i=new e;for(;t;)i.push(t),t=t.parent;return i}eachThroughFind(t){let e;const{point:i}=this;for(let s=t.length-1;s>-1;s--)if(e=t[s],!e.__interactionOff&&gs(e.__world,i)){if(e.__isBranch&&(e.__childrenInteractionOff||this.eachThroughFind(e.children)),this.exclude&&this.exclude.has(e))continue;e.__hitWorld(i)&&this.throughPath.push(e)}}eachFind(t){let e;const{point:i}=this;for(let s=t.length-1;s>-1&&(e=t[s],e.__interactionOff||(gs(e.__world,i)&&(e.__isBranch?(e.__childrenInteractionOff||this.eachFind(e.children),e.__isBranchLeaf&&(this.isStop||this.hitChild(e,i))):this.hitChild(e,i)),!this.isStop));s--);}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&(this.leaf=t,this.isStop=!0)}clear(){this.point=void 0,this.leaf=void 0,this.throughPath=void 0,this.exclude=void 0}destroy(){this.target=void 0,this.selector=void 0}}class ys{constructor(t){this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,this.defaultPath=new e(t),this.pathFinder=new vs(t,this),this.listenEvents()}listenEvents(){this.eventIds=[this.target.on__(Ft.REMOVE,this.onRemoveChild,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=void 0),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=void 0)}getHitPointPath(t,e,i){return this.pathFinder.getHitPointPath(t,e,i)}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 i,s=this.innerIdList[t];return s||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(i=e,this.innerIdList[t]=i,!0))),i)}getById(t,e){let i,s=this.idList[t];return s||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(i=e,this.idList[t]=i,!0))),i)}getByClassName(t,e){e||(e=this.target);let i=[];return this.loopFind(e,(e=>(e.className===t&&i.push(e),!1))),i}getByTagName(t,e){e||(e=this.target);let i=[];return this.loopFind(e,(e=>(e.tag===t&&i.push(e),!1))),i}loopFind(t,e){if(e(t))return;const{children:i}=t;for(let s=0,o=i.length;s<o;s++){if(e(t=i[s]))return;t.__isBranch&&this.loopFind(t,e)}}destroy(){this.target&&(this.removeListenEvents(),this.pathFinder.destroy(),this.target=void 0,this.pathFinder=void 0,this.innerIdList=void 0,this.idList=void 0,this.classNameList=void 0,this.tagNameList=void 0)}}function fs(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,i,s)}}const ms=[];function xs(){return(t,e)=>{ms.push(e)}}class ws{bindContextMethod(){let t;ms.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=void 0}}U([fs("imageSmoothingEnabled")],ws.prototype,"smooth",void 0),U([fs("imageSmoothingQuality")],ws.prototype,"smoothLevel",void 0),U([fs("globalAlpha")],ws.prototype,"opacity",void 0),U([fs("globalCompositeOperation")],ws.prototype,"blendMode",void 0),U([fs()],ws.prototype,"fillStyle",void 0),U([fs()],ws.prototype,"strokeStyle",void 0),U([fs("lineWidth")],ws.prototype,"strokeWidth",void 0),U([fs("lineCap")],ws.prototype,"strokeCap",void 0),U([fs("lineJoin")],ws.prototype,"strokeJoin",void 0),U([fs("lineDash")],ws.prototype,"dashPattern",void 0),U([fs("lineDashOffset")],ws.prototype,"dashOffset",void 0),U([fs()],ws.prototype,"miterLimit",void 0),U([fs()],ws.prototype,"shadowBlur",void 0),U([fs()],ws.prototype,"shadowColor",void 0),U([fs()],ws.prototype,"shadowOffsetX",void 0),U([fs()],ws.prototype,"shadowOffsetY",void 0),U([fs()],ws.prototype,"filter",void 0),U([fs()],ws.prototype,"font",void 0),U([fs()],ws.prototype,"fontKerning",void 0),U([fs()],ws.prototype,"fontStretch",void 0),U([fs()],ws.prototype,"fontVariantCaps",void 0),U([fs()],ws.prototype,"textAlign",void 0),U([fs()],ws.prototype,"textBaseline",void 0),U([fs()],ws.prototype,"textRendering",void 0),U([fs()],ws.prototype,"wordSpacing",void 0),U([fs()],ws.prototype,"letterSpacing",void 0),U([fs()],ws.prototype,"direction",void 0),U([xs()],ws.prototype,"setTransform",null),U([xs()],ws.prototype,"resetTransform",null),U([xs()],ws.prototype,"getTransform",null),U([xs()],ws.prototype,"save",null),U([xs()],ws.prototype,"restore",null),U([xs()],ws.prototype,"translate",null),U([xs()],ws.prototype,"scale",null),U([xs()],ws.prototype,"rotate",null),U([xs()],ws.prototype,"fill",null),U([xs()],ws.prototype,"stroke",null),U([xs()],ws.prototype,"clip",null),U([xs()],ws.prototype,"fillRect",null),U([xs()],ws.prototype,"strokeRect",null),U([xs()],ws.prototype,"clearRect",null),U([xs()],ws.prototype,"beginPath",null),U([xs()],ws.prototype,"moveTo",null),U([xs()],ws.prototype,"lineTo",null),U([xs()],ws.prototype,"bezierCurveTo",null),U([xs()],ws.prototype,"quadraticCurveTo",null),U([xs()],ws.prototype,"closePath",null),U([xs()],ws.prototype,"arc",null),U([xs()],ws.prototype,"arcTo",null),U([xs()],ws.prototype,"ellipse",null),U([xs()],ws.prototype,"rect",null),U([xs()],ws.prototype,"roundRect",null),U([xs()],ws.prototype,"createConicGradient",null),U([xs()],ws.prototype,"createLinearGradient",null),U([xs()],ws.prototype,"createPattern",null),U([xs()],ws.prototype,"createRadialGradient",null),U([xs()],ws.prototype,"fillText",null),U([xs()],ws.prototype,"measureText",null),U([xs()],ws.prototype,"strokeText",null);const Bs=V.get("LeaferCanvas"),Es={width:1,height:1,pixelRatio:1};class bs extends ws{constructor(t,e){if(super(),t||(t=Es),this.manager=e,this.innerId=a.create(a.CNAVAS),t.view){const{view:e}=t;let i="string"==typeof e?document.getElementById(e):e;if(i)if(i instanceof HTMLCanvasElement)this.view=i;else{if(i===window||i===document){const t=document.createElement("div"),{style:e}=t;e.position="absolute",e.top=e.bottom=e.left=e.right="0px",e.overflow="hidden",document.body.appendChild(t),i=t}this.view=document.createElement("canvas"),i.appendChild(this.view)}else Bs.error(`can't find view by id: ${e}`)}this.view||(this.view=document.createElement("canvas")),this.pixelRatio=t.pixelRatio,t.webgl||(this.context=this.view.getContext("2d"),this.smooth=!0,t.fill&&(this.view.style.backgroundColor=t.fill),t.width&&t.height&&this.resize(t),this.bindContextMethod())}get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}debug(){}pixel(t){return t*this.pixelRatio}autoLayout(t,e){const i=i=>{const{x:s,y:o,width:n,height:r}=t.getBoundsFrom(i),{style:a}=this.view;if(a.marginLeft=s+"px",a.marginTop=o+"px",n!==this.width||r!==this.height){const{pixelRatio:t}=this,i={width:n,height:r,pixelRatio:t},s={width:this.width,height:this.height,pixelRatio:this.pixelRatio};this.resize(i),void 0!==this.width&&e(new Xt(i,s))}};this.resizeObserver=new ResizeObserver((t=>{for(const e of t)i(e.contentRect)}));const s=this.view.parentElement;s&&(this.resizeObserver.observe(s),i(s.getBoundingClientRect()))}stopAutoLayout(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0)}resize(t){const{style:e}=this.view,{width:i,height:s,pixelRatio:o}=t;if(this.isSameSize(t))return;let n;this.context&&this.width&&(n=this.getSameCanvas(),n.copy(this)),Object.assign(this,{width:i,height:s,pixelRatio:o}),this.bounds=new Y(0,0,i,s),e.width=i+"px",e.height=s+"px",this.view.width=i*o,this.view.height=s*o,this.context&&n&&(this.copy(n),n.recycle())}setWorld(t,e,i){const{pixelRatio:s}=this;if(e)if(i)this.setTransform(t.a*s,t.b*s,t.c*s,t.d*s,(t.e+e.e)*s,(t.f+e.f)*s);else{const{a:i,b:o,c:n,d:r,e:a,f:h}=e;this.setTransform((t.a*i+t.b*n)*s,(t.a*o+t.b*r)*s,(t.c*i+t.d*n)*s,(t.c*o+t.d*r)*s,(t.e*i+t.f*n+a)*s,(t.e*o+t.f*r+h)*s)}else this.setTransform(t.a*s,t.b*s,t.c*s,t.d*s,t.e*s,t.f*s)}useSameTransform(t){this.setTransform(t.getTransform())}setStroke(t,e,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&(this.strokeCap=i.strokeCap,this.strokeJoin=i.strokeJoin,this.dashPattern=i.dashPattern,this.miterLimit=i.miterLimit)}setShadow(t,e,i,s){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}hitPath(t,e){return this.context.isPointInPath(t.x,t.y,e)}hitStroke(t){return this.context.isPointInStroke(t.x,t.y)}replaceBy(t,e,i){t.save(),this.blendMode="copy",this.copy(t,e,i),t.restore()}copy(t,e,i,s){if(e){i||(i=e);const{pixelRatio:o}=this;s&&(this.blendMode=s),this.drawImage(t.view,e.x*o,e.y*o,e.width*o,e.height*o,i.x*o,i.y*o,i.width*o,i.height*o),s&&(this.blendMode="normal")}else this.drawImage(t.view,0,0)}copyWorldToLocal(t,e,i,s){const{pixelRatio:o}=this;s&&(this.blendMode=s),e.b||e.c?(this.save(),this.resetTransform(),this.copy(t,e,N.tempTimesMatrix(i,e)),this.restore()):this.drawImage(t.view,e.x*o,e.y*o,e.width*o,e.height*o,i.x,i.y,i.width,i.height),s&&(this.blendMode="normal")}fillBounds(t,e,i){const{pixelRatio:s}=this;i&&(this.blendMode=i),this.fillStyle=e,this.fillRect(t.x*s,t.y*s,t.width*s,t.height*s),i&&(this.blendMode="normal")}strokeBounds(t,e,i){const{pixelRatio:s}=this;i&&(this.blendMode=i),this.strokeStyle=e,this.strokeRect(t.x*s,t.y*s,t.width*s,t.height*s),i&&(this.blendMode="normal")}clearBounds(t){const{pixelRatio:e}=this;this.clearRect(t.x*e,t.y*e,t.width*e,t.height*e)}clipBounds(t){const{pixelRatio:e}=this;this.beginPath(),this.rect(t.x*e,t.y*e,t.width*e,t.height*e),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:e,height:i,pixelRatio:s}=this,o=this.manager.get({width:e,height:i,pixelRatio:s});return o.manager||(o.manager=this.manager),o.save(),t&&o.useSameTransform(this),o}getBiggerCanvas(t,e){let{width:i,height:s,pixelRatio:o}=this;t&&(i+=t),e&&(s+=e);const n=this.manager.get({width:i,height:s,pixelRatio:o});return n.manager||(n.manager=this.manager),n.save(),n}recycle(){this.restore(),this.manager.recycle(this)}destroy(){this.view&&(super.destroy(),this.stopAutoLayout(),this.manager=void 0,this.view&&this.view.parentElement&&this.view.remove(),this.view=void 0,this.bounds=void 0)}}CanvasRenderingContext2D.prototype.roundRect||(CanvasRenderingContext2D.prototype.roundRect=Path2D.prototype.roundRect=function(t,e,i,s,o){let n,r,a,h;if(o instanceof Array)switch(o.length){case 4:n=o[0],r=o[1],a=o[2],h=o[3];break;case 2:n=a=o[0],r=h=o[1];break;case 3:n=o[0],r=h=o[1],a=o[2];break;case 1:o=o[0];break;default:o=0}if(void 0===n){if(!o)return void this.rect(t,e,i,s);n=r=a=h=o}const d=Math.min(i/2,s/2);n>d&&(n=d),r>d&&(r=d),a>d&&(a=d),h>d&&(h=d);const l=this;n?l.moveTo(t+n,e):l.moveTo(t,e),r?l.arcTo(t+i,e,t+i,e+s,r):l.lineTo(t+i,e),a?l.arcTo(t+i,e+s,t,e+s,a):l.lineTo(t+i,e+s),h?l.arcTo(t,e+s,t,e,h):l.lineTo(t,e+s),n?l.arcTo(t,e,t+i,e,n):l.lineTo(t,e),l.closePath()});class Ts{constructor(t){}destory(){}}class Rs{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:i}=e.selector.getHitPointPath(t,e.hitRadius);t.path=i,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Se.START,this.moveData)}t.path=this.moveData.path,e.emit(Se.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:i}=e.selector.getHitPointPath(t,e.hitRadius);t.path=i,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Oe.START,this.zoomData)}t.path=this.zoomData.path,e.emit(Oe.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:i}=e.selector.getHitPointPath(t,e.hitRadius);t.path=i,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Me.START,this.rotateData)}t.path=this.rotateData.path,e.emit(Me.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=void 0}moveEnd(){this.moveData&&(this.interaction.emit(Se.END,this.moveData),this.moveData=void 0)}zoomEnd(){this.zoomData&&(this.interaction.emit(Oe.END,this.zoomData),this.zoomData=void 0)}rotateEnd(){this.rotateData&&(this.interaction.emit(Me.END,this.rotateData),this.rotateData=void 0)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=void 0}}const Cs={getMoveEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e)=>Object.assign(Object.assign({},e),{list:t}),getSwipeDirection:t=>t<-45&&t>-135?De.UP:t>45&&t<135?De.DOWN:t<=45&&t>=-45?De.RIGHT:De.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Ps.getSwipeDirection(B.getAngle(t,i))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons}),pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,i){const s=new e,{list:o}=t;for(let t=0,e=o.length;t<e;t++)o[t].hasEvent(i)&&s.push(o[t]);return s}},Ps=Cs,{getDragEventData:Ls,getDropEventData:ks,getSwipeEventData:Ss,filterPathByEventType:Ms}=Cs;class Ds{constructor(t){this.interaction=t}setDragData(t){this.dragData=Ls(t,t,t)}getDragList(){return this.dragging?ke.dragList||this.dragList:void 0}checkDrag(t,e){const{interaction:i}=this,{downData:s}=i;if(this.moving&&!Te.middle(t)&&!Te.left(t))return void i.pointerCancel();const{dragData:o}=this;this.moving||(this.moving=(Te.middle(t)||be.isHoldSpaceKey())&&e,this.moving&&i.emit(Se.START,o)),this.moving||this.dragStart(t,e);const{path:n,throughPath:r}=s;this.dragData=Ls(s,o,t),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.moving?i.emit(Se.MOVE,this.dragData):this.dragging&&(i.emit(Pe.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=Te.left(t)&&e,this.dragging&&(this.interaction.emit(Pe.START,this.dragData),this.dragList=Ms(this.dragData.path,Pe.DRAG),this.getDragableList(this.dragData.path)))}getDragableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],e.draggable){this.dragableList=[e];break}}dragDragableList(){if(this.dragableList){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((i=>{he.moveByWorld(i,t,e)}))}}dropEnterOrLeave(t){const{interaction:e}=this,{dropEnterPath:i}=this,{path:s}=t;e.emit(ke.ENTER,t,s,i),e.emit(ke.LEAVE,t,i,s),this.dropEnterPath=s}dragEnd(t){const{interaction:e}=this,{downData:i}=e;if(!i)return;const{path:s,throughPath:o}=i,n=Ls(i,t,t);o&&(n.throughPath=o),n.path=s,this.moving&&e.emit(Se.END,n),this.dragging&&(e.emit(Pe.END,n),this.swipe(t,n),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:i}=this,{downData:s}=i;if(B.getDistance(s,t)>i.config.pointer.swipeDistance){const t=Ss(s,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=ks(this.getDragList(),t);e.path=this.dropEnterPath,this.interaction.emit(ke.DROP,e),this.interaction.emit(ke.LEAVE,t,this.dropEnterPath)}dragReset(){ke.dragList=void 0,this.dragList=void 0,this.dragableList=void 0,this.dragData=void 0,this.dropEnterPath=void 0,this.dragging=void 0,this.moving=void 0}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:i}=e,{autoMoveDistance:s}=e.config.pointer;if(!s)return;const o=e.shrinkCanvasBounds,{x:n,y:r}=o,a=N.right(o),h=N.bottom(o),d=t.x<n?s:a<t.x?-s:0,l=t.y<r?s:h<t.y?-s:0;let c=0,u=0;this.autoMoveTimer=setInterval((()=>{c+=d,u+=l,N.move(i,d,l),N.move(this.dragData,d,l),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:l,totalX:c,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=void 0,this.dragableList=void 0}}const{pathHasEventType:Os}=Cs;class As{constructor(t,e,i,s){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{hitRadius:5,through:!1,clickTime:120,longPressTime:800,transformTime:500,dragDistance:2,swipeDistance:20,autoMoveDistance:2}},this.clickCount=0,this.target=t,this.canvas=e,this.selector=i,this.transformer=new Rs(this),this.dragger=new Ds(this),s&&(this.config=o.default(s,this.config)),this.listenEvents()}get hitRadius(){return this.config.pointer.hitRadius}start(){this.running=!0}stop(){this.running=!1}listenEvents(){const{target:t}=this;this.eventIds=[t.on__(Xt.RESIZE,this.onResize,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onResize(){this.shrinkCanvasBounds=new Y(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}pointerDown(t){this.emit(Ce.BEFORE_DOWN,t,this.selector.defaultPath);const{hitRadius:e,through:i}=this.config.pointer,s=this.selector.getHitPointPath(t,e,{through:i});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(Ce.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),Te.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){(this.downData||this.canvas.bounds.hitPoint(t))&&(this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Ce.BEFORE_MOVE,t,this.selector.defaultPath),this.downData){const e=B.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.pointerMoveIgnore)return;const e=this.selector.getHitPointPath(t,this.hitRadius,{exclude:this.dragger.getDragList()});t.path=e.path,this.emit(Ce.MOVE,t),this.pointerEnterOrLeave(t),this.dragger.dragging&&this.dragger.dropEnterOrLeave(t)}pointerUp(t){if(!this.downData)return;this.emit(Ce.BEFORE_UP,t,this.selector.defaultPath);const{through:e}=this.config.pointer,i=this.selector.getHitPointPath(t,this.hitRadius,{through:e});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(Ce.UP,t),this.emit(Ce.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.longTap(t),this.dragger.dragEnd(t),this.downData=void 0}pointerCancel(){this.pointerUp(this.dragger.dragData)}pointerEnterOrLeave(t){if(this.dragger.moving||this.dragger.dragging)return;const{path:e}=t;this.emit(Ce.ENTER,t,e,this.enterPath),this.emit(Ce.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Ce.LEAVE,t),this.dragger.dragging&&this.emit(ke.LEAVE,t))}tap(t){if(!this.waitTap)return;this.clickCount||this.emit(Ce.TAP,t);Date.now()-this.downTime<this.config.pointer.clickTime+50&&Os(t.path,Ce.DOUBLE_CLICK)?(this.clickCount++,2===this.clickCount?(this.tapWaitCancel(),this.emit(Ce.DOUBLE_CLICK,t)):(clearTimeout(this.clickTimer),this.clickTimer=window.setTimeout((()=>{this.tapWaitCancel(),this.emit(Ce.CLICK,t)}),this.config.pointer.clickTime))):(this.tapWaitCancel(),this.emit(Ce.CLICK,t))}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.clickTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.clickTimer),this.waitTap=!1,this.clickCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=window.setTimeout((()=>{this.longPressed=!0,this.emit(Ce.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){this.longPressed&&this.emit(Ce.LONG_TAP,t),this.longPressWaitCancel()}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=void 0}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);for(let n=i.length-1;n>-1;n--)if(o=i.list[n],o.hasEvent(t,!0)&&(!s||!s.has(o))){e.phase=1;const i=St.event(t,e);if(o.emitEvent(i,!0),i.isStop)return}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.hasEvent(t,!1)&&(!s||!s.has(o))){e.phase=o===e.target?2:3;const i=St.event(t,e);if(o.emitEvent(i),i.isStop)return}}(t,e,i,s)}destroy(){this.target&&(this.running=!1,this.removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.config=void 0,this.target=void 0,this.selector=void 0,this.canvas=void 0,this.dragger=void 0,this.transformer=void 0)}}const Ws={convert(t,e){const i=Cs.getBase(t),s=Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===s.pointerType&&(s.tangentialPressure=t.tangentialPressure,s.tiltX=t.tiltX,s.tiltY=t.tiltY,s.twist=t.twist),s},convertMouse(t,e){const i=Cs.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=Ws.getTouch(t),s=Cs.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Is={getData(t,e){const i=B.getCenter(t[0],t[1]),s=B.getCenter(e[0],e[1]),o={x:s.x-i.x,y:s.y-i.y},n=B.getDistance(t[0],t[1]),r=B.getDistance(e[0],e[1])/n,a=B.getAngle(t[0],t[1]),h=B.getAngle(e[0],e[1]);return{move:o,scale:r,angle:this.getChangedAngle(a,h),center:s}},getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e},getChangedAngle(t,e){const i=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return i<0?i+360:i}};let Ns=0;const zs={getMove:(t,e)=>({x:-t.deltaX*e.moveSpeed*2,y:-t.deltaY*e.moveSpeed*2}),getScale(t,e){let i,s=1,{zoomMode:o,zoomSpeed:n}=e;const r=t.deltaY||t.deltaX;if(o){const e=t.mozInputSource&&t.deltaY%18==0;e?Ns++:Ns=0,i=(Math.floor(t.deltaY)!==t.deltaY||e&&Ns>2)&&0===t.deltaX,(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)}else i=!t.shiftKey&&(t.metaKey||t.ctrlKey);if(i){n=d.within(n,0,1);s=1-r/(25*(t.deltaY?e.delta.y:e.delta.x)*(1-n)+10),s<.5&&(s=.5),s>=1.5&&(s=1.5)}return s}},{getMoveEventData:Fs,getZoomEventData:js,getRotateEventData:Ys}=Cs;class Xs extends As{listenEvents(){super.listenEvents();const t=this.view=this.canvas.view;this.onResize(),this.viewEvents={pointerdown:this.onPointerDown.bind(this),mousedown:this.onMouseDown.bind(this),touchstart:this.onTouchStart.bind(this),wheel:this.onWheel.bind(this),gesturestart:this.onGesturestart.bind(this),gesturechange:this.onGesturechange.bind(this),gestureend:this.onGestureend.bind(this)},this.windowEvents={pointermove:this.onPointerMove.bind(this),pointerup:this.onPointerUp.bind(this),pointercancel:this.onPointerCancel.bind(this),mousemove:this.onMouseMove.bind(this),mouseup:this.onMouseUp.bind(this),touchmove:this.onTouchMove.bind(this),touchend:this.onTouchEnd.bind(this),touchcancel:this.onTouchCancel.bind(this),keydown:this.onKeyDown.bind(this),keyup:this.onKeyUp.bind(this)};for(let e in this.viewEvents)t.addEventListener(e,this.viewEvents[e]);for(let t in this.windowEvents)window.addEventListener(t,this.windowEvents[t]);window.oncontextmenu=function(t){return!1}}removeListenEvents(){super.removeListenEvents();for(let t in this.viewEvents)this.view.removeEventListener(t,this.viewEvents[t]),this.viewEvents={};for(let t in this.windowEvents)window.removeEventListener(t,this.windowEvents[t]),this.windowEvents={}}onResize(){super.onResize(),this.clientBounds=new Y(this.view.getBoundingClientRect())}getLocal(t){return{x:t.clientX-this.clientBounds.x,y:t.clientY-this.clientBounds.y}}onKeyDown(t){be.setDownCode(t.code)}onKeyUp(t){be.setUpCode(t.code)}onPointerDown(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||(t.preventDefault(),this.pointerDown(Ws.convert(t,this.getLocal(t))))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(Ws.convert(t,this.getLocal(t)))}onPointerUp(t){this.useMutiTouch||(t.preventDefault(),this.pointerUp(Ws.convert(t,this.getLocal(t))))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.useTouch||this.usePointer||(t.preventDefault(),this.pointerDown(Ws.convertMouse(t,this.getLocal(t))))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(Ws.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.useTouch||this.usePointer||(t.preventDefault(),this.pointerUp(Ws.convertMouse(t,this.getLocal(t))))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.mutiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=Ws.getTouch(t);this.pointerDown(Ws.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=Ws.getTouch(t);this.pointerMove(Ws.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(t.preventDefault(),this.mutiTouchEnd(),this.usePointer)return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=window.setTimeout((()=>{this.useTouch=!1}),500);const e=Ws.getTouch(t);this.pointerUp(Ws.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Is.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Is.getTouches(t.touches),i=e.find((t=>t.identifier===this.touches[0].identifier)),s=e.find((t=>t.identifier===this.touches[1].identifier));if(i&&s){const o=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],n=[this.getLocal(i),this.getLocal(s)],{move:r,angle:a,scale:h,center:d}=Is.getData(o,n),l=Cs.getBase(t);this.rotate(Ys(d,a,l)),this.zoom(js(d,h,l)),this.move(Fs(d,r,l)),this.touches=e}}}mutiTouchEnd(){this.touches=void 0,this.useMutiTouch=!1,this.transformEnd()}onWheel(t){t.preventDefault();const{wheel:e}=this.config,i=e.getScale?e.getScale(t,e):zs.getScale(t,e),s=this.getLocal(t),o=Cs.getBase(t);1!==i?this.zoom(js(s,i,o)):this.move(Fs(s,e.getMove?e.getMove(t,e):zs.getMove(t,e),o))}onGesturestart(t){t.preventDefault(),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){t.preventDefault();const e=this.getLocal(t),i=Cs.getBase(t),s=t.scale/this.lastGestureScale,o=t.rotation-this.lastGestureRotation;let{rotateSpeed:n}=this.config.wheel;n=d.within(n,0,1),this.zoom(js(e,s*s,i)),this.rotate(Ys(e,o/Math.PI*180*(n/4+.1),i)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){t.preventDefault(),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=void 0,this.touches=void 0)}}function Hs(t){return(e,i)=>{tt(e,i,{get(){return this.__get(i)},set(t){this.root?this.__set(i,t):this.__[i]=t,this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange(),this.__.__useEffect||(this.__.__useEffect=!0)}}),vt(e,i,t)}}Object.assign(St,{canvas:(t,e)=>new bs(t,e),image:t=>new Ts(t),hitCanvas:(t,e)=>new bs(t,e),watcher:t=>new es(t),layouter:t=>new ps(t),renderer:(t,e,i)=>new _s(t,e,i),selector:t=>new ys(t),interaction:(t,e,i,s)=>new Xs(t,e,i,s)}),bt.requestRender=function(t){window.requestAnimationFrame(t)},bt.canvas=St.canvas();class Gs extends r{setBorderWidth(t){"number"==typeof t&&(this._strokeWidth=t),this._borderWidth=t}setFill(t){"string"==typeof t?(this._fill=t,this.__isFills&&(this.__isFills=!1)):t instanceof Array?(this._fill=t,this.__isFills=!0):"object"==typeof t?(this._fill=[t],this.__isFills=!0):(this._fill=t,this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"==typeof t?(this._stroke=t,this.__isStrokes&&(this.__isStrokes=!1)):t instanceof Array?(this._stroke=t,this.__isStrokes=!0):"object"==typeof t?(this._stroke=[t],this.__isStrokes=!0):(this._stroke=t,this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this._shadow=t instanceof Array?t:[t]}setInnerShadow(t){this._innerShadow=t instanceof Array?t:[t]}}class Us extends Gs{}const{parse:Ks}=Bi;const{copyAndSpread:Vs}=N,qs={__updateEventBounds(){Vs(this.__layout.eventBounds,this.__layout.boxBounds,this.__layout.eventBoundsSpreadWidth)},__updateRenderBounds(){Vs(this.__layout.renderBounds,this.__layout.eventBounds,this.__layout.renderBoundsSpreadWidth)},__updateEventBoundsSpreadWidth(){let t=0;const{stroke:e,strokeAlign:i}=this.__;if(e&&"inside"!==i){const{strokeWidth:e,miterLimit:s,path:o}=this.__,n=o?1/Math.sin(s*l/2)*Math.sqrt(e):0;t="center"===i?e/2:e,this.__.__strokeOuterWidth=t,n&&(t+=n-t)}return t||(this.__.__strokeOuterWidth=0),t},__updateRenderBoundsSpreadWidth(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o}=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)})),s&&(t=Math.max(t,s));let n=t=Math.ceil(t);return i&&i.forEach((t=>{n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),o&&(n=Math.max(n,o)),this.__layout.renderShapeBoundsSpreadWidth=n,t}},Qs={__hit(t){if(this.__.fill&&this.__hitCanvas.hitPath(t,this.__.windingRule))return!0;const e=2*((this.__.__strokeOuterWidth||0)+t.radiusX);if(e){const{__hitCanvas:i}=this;if(i.strokeWidth!==e&&(i.strokeWidth=e,i.stroke()),i.hitStroke(t))return!0}return!1}},Zs={},$s={},Js={},to={};function eo(t,e){t.forEach((t=>{e.strokeStyle=t.style,e.stroke()}))}var io=Object.freeze({__proto__:null,fill:function(t,e,i){e.fillStyle=i,e.fill(t.__.windingRule)},fills:function(t,e,i){let s;const{windingRule:o}=t.__;for(let t=0,n=i.length;t<n;t++)s=i[t],e.fillStyle=s.style,e.fill(o)},stroke:function(t,e,i){const s=t.__,{strokeWidth:o,strokeAlign:n}=s;switch(n){case"center":e.setStroke(void 0,o,s),e.strokeStyle=i,e.stroke();break;case"inside":e.save(),e.setStroke(void 0,2*o,s),e.clip(s.windingRule),e.strokeStyle=i,e.stroke(),e.restore();break;case"outside":const n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*o,t.__),n.strokeStyle=i,n.stroke(),n.clip(s.windingRule),n.clearBounds(t.__layout.renderBounds),e.copyWorldToLocal(n,t.__world,t.__layout.renderBounds),n.recycle()}},strokes:function(t,e,i){const s=t.__,{strokeWidth:o,strokeAlign:n}=s;switch(n){case"center":e.setStroke(void 0,o,s),eo(i,e);break;case"inside":e.save(),e.setStroke(void 0,2*o,s),e.clip(s.windingRule),eo(i,e),e.restore();break;case"outside":const{renderBounds:n}=t.__layout,r=e.getSameCanvas(!0);t.__drawRenderPath(r),r.setStroke(void 0,2*o,t.__),eo(i,r),r.clip(s.windingRule),r.clearBounds(n),e.copyWorldToLocal(r,t.__world,n),r.recycle()}}});Object.assign($s,io);const so={__updateChange(){let t=this.__;t.__isFills||t.__isStrokes||t.borderRadius||t.__useEffect?this.__complex||(this.__complex=!0):this.__complex&&(this.__complex=!1)},__drawFast(t,e){const{fill:i,stroke:s}=this.__;this.__drawRenderPath(t),i&&$s.fill(this,t,i),s&&$s.stroke(this,t,s)},__draw(t,e){const{fill:i,stroke:s}=this.__;this.__drawRenderPath(t),i&&(this.__.__isFills?$s.fills(this,t,i):$s.fill(this,t,i)),s&&(this.__.__isStrokes?$s.strokes(this,t,s):$s.stroke(this,t,s))}},oo={__render(t,e){const{fill:i,stroke:s}=this.__;s&&(this.__.stroke=void 0),this.__renderRect(t,e);const{clip:o}=this.__;o?(t.save(),t.clip(),this.__renderGroup(t,e),t.restore()):this.__renderGroup(t,e),s&&(this.__.stroke=s,i&&(this.__.fill=void 0),this.__renderRect(t,e),i&&(this.__.fill=i))}},no={__drawFast(t,e){const{width:i,height:s,fill:o,stroke:n}=this.__;if(o&&(t.fillStyle=o,t.fillRect(0,0,i,s)),n){const{strokeAlign:e,strokeWidth:o}=this.__;t.setStroke(n,o,this.__);const r=o/2;switch(e){case"center":t.strokeRect(0,0,i,s);break;case"inside":t.strokeRect(r,r,i-o,s-o);break;case"outside":t.strokeRect(-r,-r,i+o,s+o)}}}},ro={__drawFast(t,e){const{fill:i,stroke:s,content:o,__font:n}=this.__;t.font=n,i&&(t.fillStyle=i,t.fillText(o,0,0)),s&&(t.strokeStyle=s,t.strokeText(o,0,0))}};ro.__draw=ro.__drawFast;let ao=class extends ae{get worldTransform(){return this.__layout.getTransform("world")}get relativeTransform(){return this.__layout.getTransform("relative")}get worldBoxBounds(){return this.__layout.getBounds("world","box")}get worldRenderBounds(){return this.__layout.getBounds("world","render")}__updateRenderPath(){const{__:t}=this,{cornerRadius:e,path:i}=t;t.__renderPath=e&&i?Wi.applyCorner(i,e,t.cornerSmoothing):i}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__renderPath)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}};U([_t(Gs)],ao.prototype,"__",void 0),U([st("")],ao.prototype,"id",void 0),U([st("")],ao.prototype,"name",void 0),U([st("")],ao.prototype,"className",void 0),U([ut(1)],ao.prototype,"opacity",void 0),U([ut(!0)],ao.prototype,"visible",void 0),U([pt(0)],ao.prototype,"zIndex",void 0),U([ot(0)],ao.prototype,"x",void 0),U([ot(0)],ao.prototype,"y",void 0),U([at(100)],ao.prototype,"width",void 0),U([at(100)],ao.prototype,"height",void 0),U([nt(1)],ao.prototype,"scaleX",void 0),U([nt(1)],ao.prototype,"scaleY",void 0),U([rt(0)],ao.prototype,"rotation",void 0),U([rt(0)],ao.prototype,"skewX",void 0),U([rt(0)],ao.prototype,"skewY",void 0),U([ct()],ao.prototype,"blendMode",void 0),U([at()],ao.prototype,"mask",void 0),U([st()],ao.prototype,"locked",void 0),U([ct()],ao.prototype,"fill",void 0),U([ht()],ao.prototype,"borderRadius",void 0),U([dt(1)],ao.prototype,"borderWidth",void 0),U([dt()],ao.prototype,"stroke",void 0),U([dt("center")],ao.prototype,"strokeAlign",void 0),U([dt(1)],ao.prototype,"strokeWidth",void 0),U([ct("none")],ao.prototype,"strokeCap",void 0),U([ct("miter")],ao.prototype,"strokeJoin",void 0),U([ct()],ao.prototype,"dashPattern",void 0),U([ct()],ao.prototype,"dashOffset",void 0),U([ct(10)],ao.prototype,"miterLimit",void 0),U([ht()],ao.prototype,"cornerRadius",void 0),U([ht()],ao.prototype,"cornerSmoothing",void 0),U([Hs()],ao.prototype,"shadow",void 0),U([Hs()],ao.prototype,"innerShadow",void 0),U([Hs()],ao.prototype,"blur",void 0),U([Hs()],ao.prototype,"backgroundBlur",void 0),U([Hs()],ao.prototype,"grayscale",void 0),U([xt(Wi.drawData)],ao.prototype,"__drawPathByData",null),ao=U([Et(qs),Et(Qs),Et(so),wt()],ao);let ho=class extends ao{constructor(t){super(t),this.__isBranch=!0,this.children=[]}__updatePath(){}add(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}remove(t){}};U([_t(Us)],ho.prototype,"__",void 0),ho=U([Et(Be),Mt()],ho);let lo=class extends ao{constructor(t){super(t)}__updatePath(){}__drawPathByData(t,e){const{width:i,height:s,borderRadius:o}=this.__;o?t.roundRect(0,0,i,s,o):t.rect(0,0,i,s)}};U([_t(class extends Gs{})],lo.prototype,"__",void 0),lo=U([Et(no),Mt()],lo);const co=lo.prototype,uo=ho.prototype,po={},{copy:_o,add:go}=N;let vo=class extends ho{constructor(t){super(t),this.fill||(this.fill="#FFFFFF"),this.__isBranchLeaf=!0}__drawPathByData(t,e){}__updateBoxBounds(){if(this.__updateRectBoxBounds(),!this.__.clip){const{boxBounds:t}=this.__layout;_o(po,t),super.__updateBoxBounds(),go(t,po)}}__updateEventBounds(){if(this.__updateRectEventBounds(),!this.__.clip){const{eventBounds:t}=this.__layout;_o(po,t),super.__updateEventBounds(),go(t,po)}}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.clip){const{renderBounds:t}=this.__layout;_o(po,t),super.__updateRenderBounds(),go(t,po)}}__updateRectBoxBounds(){}__updateRectEventBounds(){}__updateRectRenderBounds(){}__renderRect(t,e){}__renderGroup(t,e){}};U([_t(class extends Us{})],vo.prototype,"__",void 0),U([at(!0)],vo.prototype,"clip",void 0),U([xt(co.__drawPathByData)],vo.prototype,"__drawPathByData",null),U([xt(co.__updateBoxBounds)],vo.prototype,"__updateRectBoxBounds",null),U([xt(co.__updateEventBounds)],vo.prototype,"__updateRectEventBounds",null),U([xt(co.__updateRenderBounds)],vo.prototype,"__updateRectRenderBounds",null),U([xt(co.__render)],vo.prototype,"__renderRect",null),U([xt(uo.__render)],vo.prototype,"__renderGroup",null),vo=U([Et(oo),wt(),Mt()],vo);const{PI:yo}=Math,{begin:fo,moveTo:mo,close:xo,ellipse:wo}=Vi;let Bo=class extends ao{constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,n=t/2,r=e/2;fo(this.__.path=[]),i?s||o?(wo(n,r,n*(1-i),r*(1-i),0,s*l,o*l,!1),wo(n,r,n,r,0,o*l,s*l,!0),xo()):(wo(n,r,n*(1-i),r*(1-i),0,0,2*yo,!1),mo(t,r),wo(n,r,n,r,0,0,2*yo,!0)):s||o?(mo(n,r),wo(n,r,n,r,0,s*l,o*l,!1),xo()):wo(n,r,n,r,0,0,2*yo,!1)}};U([_t(class extends Gs{})],Bo.prototype,"__",void 0),U([ht(0)],Bo.prototype,"innerRadius",void 0),U([ht(0)],Bo.prototype,"startAngle",void 0),U([ht(0)],Bo.prototype,"endAngle",void 0),Bo=U([Mt()],Bo);const{sin:Eo,cos:bo,PI:To}=Math,{begin:Ro,moveTo:Co,lineTo:Po,close:Lo}=Vi;let ko=class extends ao{constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:i}=this.__,s=t/2,o=e/2;Ro(this.__.path=[]),Co(s,0);for(let t=1;t<i;t++)Po(s+s*Eo(2*t*To/i),o-o*bo(2*t*To/i));Lo()}};U([_t(class extends Gs{})],ko.prototype,"__",void 0),U([ht(3)],ko.prototype,"sides",void 0),ko=U([Mt()],ko);const{sin:So,cos:Mo,PI:Do}=Math,{begin:Oo,moveTo:Ao,lineTo:Wo,close:Io}=Vi;let No=class extends ao{constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:i,innerRadius:s}=this.__,o=t/2,n=e/2;Oo(this.__.path=[]),Ao(o,0);for(let t=1;t<2*i;t++)Wo(o+(t%2==0?o:o*s)*So(t*Do/i),n-(t%2==0?n:n*s)*Mo(t*Do/i));Io()}};U([_t(class extends Gs{})],No.prototype,"__",void 0),U([ht(5)],No.prototype,"points",void 0),U([ht(.38)],No.prototype,"innerRadius",void 0),No=U([Mt()],No);const{begin:zo,moveTo:Fo,lineTo:jo,end:Yo}=Vi,{rotate:Xo,getAngle:Ho,getDistance:Go,defaultPoint:Uo}=B,{setPoint:Ko,addPoint:Vo,toBounds:qo}=R,Qo={};let Zo=class extends ao{constructor(t){super(t)}get toPoint(){if(this.__to&&!this.__layout.boxBoundsChanged)return this.__to;const{width:t,height:e,rotation:i}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&(s.y=e),i&&Xo(s,i),this.__to=s,s}set toPoint(t){this.width=Go(Uo,t),this.rotation=Ho(Uo,t),this.height&&(this.height=0)}__updatePath(){zo(this.__.path=[]),Fo(0,0);const t=this.toPoint;jo(t.x,t.y),Yo()}__updateBoxBounds(){Ko(Qo,0,0),Vo(Qo,this.__to.x,this.__to.y),qo(Qo,this.__layout.boxBounds)}};U([_t(class extends Gs{})],Zo.prototype,"__",void 0),U([at()],Zo.prototype,"rotation",void 0),Zo=U([Mt()],Zo);const{toTwoPointBounds:$o}=Wi,{toBounds:Jo}=R,tn={};let en=class extends ao{constructor(t){super(t)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__updateBoxBounds(){$o(this.__.path,tn),Jo(tn,this.__layout.boxBounds)}};U([_t(class extends Gs{setPath(t){this._path="string"==typeof t?Ks(t):t}})],en.prototype,"__",void 0),U([ht()],en.prototype,"path",void 0),U([ht()],en.prototype,"windingRule",void 0),en=U([Mt()],en);let sn=class extends ho{constructor(t){super(t)}__updatePath(){}};U([_t(class extends Gs{})],sn.prototype,"__",void 0),U([ht()],sn.prototype,"paths",void 0),sn=U([Mt()],sn);let on=class extends ao{constructor(t){super(t)}__updatePath(){}__drawPathByData(t,e){const{width:i,height:s}=this.__;t.rect(0,0,i,s)}__updateBoxBounds(){const{fontFamily:t,fontSize:e,fontWeight:i,italic:s,textCase:o,lineHeight:n}=this.__,r=this.__layout.boxBounds;this.__.__font=bt.canvas.font=`${s?"italic":""} ${"small-caps"===o?"small-caps":"normal"} ${i||"normal"} ${e}px/${n||e}px ${t}`;const a=bt.canvas.measureText(this.content).width,h=e;r.x=0,r.y=.75*-e,r.width=a,r.height=h}};U([_t(class extends Gs{})],on.prototype,"__",void 0),U([at("")],on.prototype,"content",void 0),U([at("arial")],on.prototype,"fontFamily",void 0),U([at(12)],on.prototype,"fontSize",void 0),U([at("normal")],on.prototype,"fontWeight",void 0),U([at(!1)],on.prototype,"italic",void 0),U([at("normal")],on.prototype,"textCase",void 0),U([at("normal")],on.prototype,"textDecoration",void 0),U([at()],on.prototype,"letterSpacing",void 0),U([at()],on.prototype,"lineHeight",void 0),U([at()],on.prototype,"paragraphIndent",void 0),U([at()],on.prototype,"paragraphSpacing",void 0),on=U([Et(ro),Mt()],on);let nn=class extends lo{constructor(t){super(t)}};U([_t(class extends Gs{})],nn.prototype,"__",void 0),U([at("")],nn.prototype,"url",void 0),U([at("")],nn.prototype,"thumb",void 0),nn=U([Mt()],nn);let rn=class extends ho{constructor(e,i){var o;super(),this.config={zoom:!0,move:!0,start:!0,pixelRatio:devicePixelRatio},this.__eventIds=[],this.creator=St;const{config:n}=this;this.__setAsLeafer(),this.__setConfig(e),this.canvas=St.canvas(n),this.renderer=St.renderer(this,this.canvas,n),this.isSupperLeafer?this.__level=1:(this.watcher=St.watcher(this),this.layouter=St.layouter(this)),this.__checkAutoLayout(n),i?(null===(o=i.selector)||void 0===o||o.defaultPath.unshift(this),this.selector=i.selector,this.interaction=i.interaction,this.canvasManager=i.canvasManager,this.hitCanvasManager=i.hitCanvasManager,this.imageManager=i.imageManager,i.running&&setTimeout(this.start.bind(this))):(this.selector=St.selector(this),this.interaction=St.interaction(this,this.canvas,this.selector,n),this.canvasManager=new t(this),this.hitCanvasManager=new s(this),this.imageManager=new We(this,n),n.start&&setTimeout(this.start.bind(this))),this.canvasManager.add(this.canvas),this.__listenEvents()}get isSupperLeafer(){return!1}__listenEvents(){this.once(Ut.END,this.__setAsRoot.bind(this))}__removeListenEvents(){this.off__(this.__eventIds)}__setConfig(t){t&&(this.config=o.default(t,this.config))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new X(t),this.canvas.autoLayout(this.autoLayout,this.__onResize.bind(this)))}start(){var t;this.running||(this.__interactiveWindow(),null===(t=this.interaction)||void 0===t||t.start(),this.renderer.start(),this.layouter.start(),this.watcher.start(),this.running=!0)}stop(){var t;this.running&&(null===(t=this.interaction)||void 0===t||t.stop(),this.watcher.stop(),this.layouter.stop(),this.renderer.stop(),this.running=!1)}__interactiveWindow(){const{zoom:t,move:e}=this.config;if(e){const{MOVE:e}=Se,{ZOOM:i}=Oe;this.hasEvent(e)||this.__eventIds.push(this.on__(e,(t=>{he.moveByWorld(this,t.moveX,t.moveY)}))),t&&!this.hasEvent(i)&&this.__eventIds.push(this.on__(i,(t=>{he.zoomByWorld(this,t.scale,t)})))}}resize(t){if(this.canvas.isSameSize(t))return;const{width:e,height:i,pixelRatio:s}=this.canvas,o={width:e,height:i,pixelRatio:s};this.canvas.resize(t),this.__onResize(new Xt(t,o))}__onResize(t){this.emitEvent(t),setTimeout((()=>{this.canvasManager.clearRecycled()}),0)}destory(){var t;this.canvas&&(super.destroy(),this.__removeListenEvents(),this.parent||(null===(t=this.interaction)||void 0===t||t.destroy(),this.selector.destroy(),this.renderer.destroy(),this.watcher.destroy(),this.layouter.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory()),this.canvas.destroy(),this.canvas=void 0,this.creator=void 0,this.config=void 0,this.interaction=void 0,this.selector=void 0,this.renderer=void 0,this.watcher=void 0,this.layouter=void 0,this.canvasManager=void 0,this.hitCanvasManager=void 0,this.imageManager=void 0,this.zoomLayer=void 0,this.moveLayer=void 0,this.parent=void 0)}};function an(){return(t,e)=>{const i={get(){return this.canvas[e]},set(t){const{width:i,height:s,pixelRatio:o}=this.canvas,n={width:i,height:s,pixelRatio:o};n[e]=t,this.resize(n)}};Object.defineProperty(t,e,i)}}U([an()],rn.prototype,"width",void 0),U([an()],rn.prototype,"height",void 0),U([an()],rn.prototype,"pixelRatio",void 0),rn=U([Mt()],rn);let hn=class extends rn{constructor(){super(...arguments),this.children=[]}get isSupperLeafer(){return!0}start(){this.running||(this.children.forEach((t=>{t.start()})),this.running=!1)}stop(){this.running&&(this.children.forEach((t=>{t.stop()})),this.running=!1)}addLeafer(t){const e=new rn(this.__getChildConfig(t),this);return this.add(e),this.__eventIds.push(e.on__(Kt.END,this.renderer.start,this.renderer)),e}__render(t,e){this.children.forEach((e=>{t.copy(e.canvas)}))}__onResize(t){this.emitEvent(t),this.children.forEach((e=>{e.resize(t)}))}__getChildConfig(t){let e=Object.assign({},this.config);return(t=t?o.default(t,e):e).view=void 0,this.autoLayout&&(t.width=this.width,t.height=this.height,t.pixelRatio=this.pixelRatio),t}destory(){this.children.length&&(super.destory(),this.children.forEach((t=>{t.destory()})),this.children.length=0)}};hn=U([Mt()],hn);export{Js as Animate,jt as AttrEvent,X as AutoBounds,Je as BezierHelper,Y as Bounds,N as BoundsHelper,Be as Branch,_e as BranchHelper,t as CanvasManager,Ft as ChildEvent,St as Creator,o as DataHelper,V as Debug,Pe as DragEvent,ke as DropEvent,Zs as Effect,Bo as Ellipse,zt as Event,Rt as EventCreator,to as Export,vo as Frame,oo as FrameRender,ho as Group,s as HitCanvasManager,nn as Image,We as ImageManager,a as IncrementId,Xs as Interaction,Ae as KeyEvent,be as Keyboard,Ut as LayoutEvent,ps as Layouter,ae as Leaf,te as LeafBounds,pe as LeafBoundsHelper,r as LeafData,Vt as LeafDataProxy,It as LeafEventer,he as LeafHelper,se as LeafHit,i as LeafLevelList,e as LeafList,$t as LeafMatrix,oe as LeafRender,rn as Leafer,bs as LeaferCanvas,Ts as LeaferImage,Zo as Line,d as MathHelper,T as Matrix,p as MatrixHelper,Se as MoveEvent,Ye as NumberPathCommandLengthMap,je as NumberPathCommandMap,l as OneRadian,$s as Paint,en as Path,Ie as PathCommandMap,ze as PathCommandNeedConvertMap,Bi as PathConvert,Vi as PathCreator,Wi as PathHelper,bt as Platform,Qi as Plugin,b as Point,B as PointHelper,Te as PointerButton,Ce as PointerEvent,ko as Polygon,lo as Rect,no as RectRender,Kt as RenderEvent,_s as Renderer,Xt as ResizeEvent,Me as RotateEvent,$ as Run,ys as Selector,No as Star,G as StringNumberMap,hn as SuperLeafer,De as SwipeEvent,$i as TaskItem,ts as TaskProcessor,on as Text,ro as TextRender,Ht as TransformEvent,H as TwoPointBounds,R as TwoPointBoundsHelper,ao as UI,qs as UIBounds,Lt as UICreator,Re as UIEvent,Qs as UIHit,so as UIRender,sn as Vector,Gt as WatchEvent,es as Watcher,Oe as ZoomEvent,dt as affectEventBoundsType,lt as affectRenderBoundsType,it as aliasType,at as boundsType,_t as dataProcessor,st as dataType,vt as defineDataProcessor,tt as defineKey,Hs as effectType,et as getDescriptor,gt as layoutProcessor,ut as opacityType,ht as pathType,ot as positionType,Dt as registerEvent,Mt as registerUI,xt as rewrite,wt as rewriteAble,rt as rotationType,nt as scaleType,pt as sortType,ct as surfaceType,Et as useModule,Zi as usePlugin};
|
|
1
|
+
class t{constructor(t){this.list=[],this.leafer=t}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,o=s.length;i<o;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e;const i=this.leafer.creator.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,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destory(){this.clear(),this.leafer=void 0}}class e{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 i=0,o=e.length;i<o;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new e;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=void 0}}class s{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,i=e.length;s<i;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=void 0}}class i extends t{constructor(){super(...arguments),this.pathTypeList=new e,this.imageTypeList=new e}get(t){}getImageType(t,e){return this.imageTypeList.push(t),this.leafer.creator.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),this.leafer.creator.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=void 0)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}const o={default:(t,e)=>(n(e,t),n(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var o;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(o=t[i])||void 0===o?void 0:o.constructor)===Object?n(t[i],e[i]):t[i]=e[i]}))},clone:t=>JSON.parse(JSON.stringify(t))},{assign:n}=o;class r{constructor(t){this.__leaf=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]}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}destroy(){this.__leaf=void 0}}const a={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=h;return e[t]?e[t]++:(e[t]=1,0)}},h=a,d={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t)},l=Math.PI/180,{sin:c,cos:u}=Math,p={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,o=1,n=0,r=0){t.a=e,t.b=s,t.c=i,t.d=o,t.e=n,t.f=r},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},scale(t,e,s=e){t.a*=e,t.d*=s,t.c*=e,t.b*=s,t.e*=e,t.f*=s},rotate(t,e){const s=e*l,i=u(s),o=c(s),{a:n,b:r,c:a,d:h,e:d,f:p}=t;t.a=n*i-r*o,t.b=n*o+r*i,t.c=a*i-h*o,t.d=a*o+h*i,t.e=d*i-p*o,t.f=d*o+p*i},times(t,e){const{a:s,b:i,c:o,d:n,e:r,f:a}=t;t.a=e.a*s+e.b*o,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*o,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*o+r,t.f=e.e*i+e.f*n+a},divide(t,e){_.times(t,_.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=_;return _.copy(e,t),_.invert(e),e},invert(t){const{a:e,b:s,c:i,d:o,e:n,f:r}=t,a=1/(e*o-s*i);t.a=o*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(n*o-r*i)*a,t.f=-(r*e-n*s)*a},toWorldPoint(t,e,s){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c+t.e,s.y=i*t.b+o*t.d+t.f},toLocalPoint(t,e,s,i){const{x:o,y:n}=e,{a:r,b:a,c:h,d:d}=t,l=1/(r*d-a*h);if(s||(s=e),s.x=(o*d-n*h)*l,s.y=(n*r-o*a)*l,!i){const{e:e,f:i}=t;s.x-=(e*d-i*h)*l,s.y-=(i*r-e*a)*l}},empty(t){t.a=1,t.b=0,t.c=0,t.d=1,t.e=0,t.f=0}},_=p,{toLocalPoint:g,toWorldPoint:v}=p,{sin:y,cos:f,abs:m,sqrt:x,atan2:w}=Math,B={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},rotate(t,e,s){s||(s=E.defaultPoint);const i=f(e*l),o=y(e*l),n=t.x-s.x,r=t.y-s.y;t.x=s.x+n*i-r*o,t.y=s.y+n*o-r*i},tempToLocal(t,e){const{tempPoint:s}=E;return E.copy(s,t),g(e,s,s),s},tempToLocalRadiusPoint(t,e){const{tempRadiusPoint:s}=E;return E.copy(s,t),E.toLocalRadiusPoint(t,e,s),s},toLocalRadiusPoint(t,e,s){s||(s=t),g(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toLocal(t,e,s){g(e,t,s)},toWorld(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=m(e.x-t.x),i=m(e.y-t.y);return x(s*s+i*i)},getAngle:(t,e)=>E.getAtan2(t,e)/l,getAtan2:(t,e)=>w(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=E.getAtan2(t,e);return{x:t.x+f(i)*s,y:t.y+y(i)*s}}},E=B;class b{constructor(t,e){"object"==typeof t?B.copy(this,t):B.set(this,t,e)}set(t,e){B.set(this,t,e)}copy(t){return B.copy(this,t),this}clone(){return new b(this)}rotate(t,e){B.rotate(this,t,e)}toLocal(t,e){B.toLocal(this,t,e)}toWorld(t,e){B.toWorld(this,t,e)}getCenter(t){return B.getCenter(this,t)}getDistance(t){return B.getDistance(this,t)}getAngle(t){return B.getAngle(this,t)}getAtan2(t){return B.getAtan2(this,t)}}class T{constructor(t,e,s,i,o,n){"object"==typeof t?p.copy(this,t):p.set(this,t,e,s,i,o,n)}set(t,e,s,i,o,n){p.set(this,t,e,s,i,o,n)}copy(t){return p.copy(this,t),this}clone(){return new T(this)}translate(t,e){return this.e+=t,this.f+=e,this}scale(t,e){return p.scale(this,t,e),this}rotate(t){return p.rotate(this,t),this}times(t){p.times(this,t)}divide(t){p.divide(this,t)}invert(){p.invert(this)}toWorldPoint(t,e){p.toWorldPoint(this,t,e)}toLocalPoint(t,e){p.toLocalPoint(this,t,e)}empty(){p.empty(this)}}const R={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},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}},{tempPointBounds:C,setPoint:P,addPoint:L,toBounds:k}=R,{toWorldPoint:S}=p;let M,D,O,A;const W={},I={},N={tempBounds:{},set(t,e=0,s=0,i=0,o=0){t.x=e,t.y=s,t.width=i,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){z.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),z.move(t,e,s),t),getOutOfBounds(t,e){const s=-(z.right(e)-t.x),i=-(z.bottom(e)-t.y),o=Object.assign(Object.assign({},t),{offsetX:s,offsetY:i});return z.move(o,-s,-i),o},tempTimesMatrix:(t,e)=>(z.copy(z.tempBounds,t),z.setByBoundsTimesMatrix(z.tempBounds,z.tempBounds,e),z.tempBounds),timesMatrix(t,e){z.setByBoundsTimesMatrix(t,t,e)},getByTimesMatrix:(t,e)=>(t=Object.assign({},t),z.setByBoundsTimesMatrix(t,t,e),t),divideMatrix(t,e){t.x=(t.x-e.e)/e.a,t.y=(t.y-e.f)/e.d,t.width/=e.a,t.height/=e.d},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 z.copyAndSpread(s,t,e),s},spread(t,e){z.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,D=t.y+t.height,O=e.x+e.width,A=e.y+e.height,M=M>O?M:O,D=D>A?D:A,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=D-t.y},addList(t,e){z.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){z.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){z.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){if(!e.length)return void z.empty(t);let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=s?s(e[r]):e[r],(o.width||o.height)&&(n?(n=!1,i||j(t,o)):F(t,o))},setByBoundsTimesMatrix(t,e,s){0===s.b&&0===s.c?(t.x=s.e+e.x*s.a,t.y=s.f+e.y*s.d,t.width=e.width*s.a,t.height=e.height*s.d):(W.x=e.x,W.y=e.y,S(s,W,I),P(C,I.x,I.y),W.x=e.x+e.width,S(s,W,I),L(C,I.x,I.y),W.y=e.y+e.height,S(s,W,I),L(C,I.x,I.y),W.x=e.x,S(s,W,I),L(C,I.x,I.y),k(C,t))},setByPoints(t,e){e.forEach(((t,e)=>{0===e?P(C,t.x,t.y):L(C,t.x,t.y)})),k(C,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=B.tempToLocalRadiusPoint(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=B.tempToLocal(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=z.tempTimesMatrix(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=z.tempTimesMatrix(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=z.tempTimesMatrix(e,s));let{x:i,y:o,width:n,height:r}=e;return M=i+n,D=o+r,O=t.x+t.width,A=t.y+t.height,i=i>t.x?i:t.x,o=o>t.y?o:t.y,M=M<O?M:O,D=D<A?D:A,n=M-i,r=D-o,{x:i,y:o,width:n,height:r}},setByIntersect(t,e,s){z.copy(t,z.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,empty(t){t.x=0,t.y=0,t.width=0,t.height=0}},z=N,{add:F,copy:j}=z;class Y{constructor(t,e,s,i){"object"==typeof t?N.copy(this,t):N.set(this,t,e,s,i)}set(t,e,s,i){N.set(this,t,e,s,i)}copy(t){return N.copy(this,t),this}clone(){return new Y(this)}timesMatrix(t){return N.timesMatrix(this,t),this}divideMatrix(t){return N.divideMatrix(this,t),this}getFitMatrix(t){return N.getFitMatrix(this,t)}spread(t){N.spread(this,t)}ceil(){N.ceil(this)}add(t){N.add(this,t)}addList(t){N.setByList(this,t,!0)}setByList(t,e){N.setByList(this,t,e)}addListWithHandle(t,e){N.setByListWithHandle(this,t,e,!0)}setByListWithHandle(t,e,s){N.setByListWithHandle(this,t,e,s)}setByBoundsTimesMatrix(t,e){N.setByBoundsTimesMatrix(this,t,e)}setByPoints(t){N.setByPoints(this,t)}hitPoint(t,e){return N.hitPoint(this,t,e)}hitRadiusPoint(t,e){return N.hitRadiusPoint(this,t,e)}hit(t,e){return N.hit(this,t,e)}includes(t,e){return N.includes(this,t,e)}getIntersect(t,e){return new Y(N.getIntersectData(this,t,e))}setByIntersect(t,e){N.setByIntersect(this,t,e)}isSame(t){return N.isSame(this,t)}isEmpty(){return N.isEmpty(this)}empty(){N.empty(this)}}class X{constructor(t,e,s,i,o,n){"object"==typeof t?this.copy(t):this.set(t,e,s,i,o,n)}set(t=0,e=0,s=0,i=0,o=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=o,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:o,width:n,height:r}=t;this.set(e,s,i,o,n,r)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:o,width:n,height:r}=this;return new Y(o,e,n||t.width-o-s,r||t.height-e-i)}}class H{constructor(t,e){R.setPoint(this,t,e)}addPoint(t,e){R.addPoint(this,t,e)}add(t){R.add(this,t)}}const G={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};function U(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,s,r):o(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r}function K(t,e,s,i){return new(s||(s=Promise))((function(o,n){function r(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}h((i=i.apply(t,e||[])).next())}))}class V{constructor(t){this.name=t}static get(t){return new V(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)}error(...t){console.error(this.name,...t)}}var q;V.filterList=[],V.excludeList=[],V.__={},U([(t,e)=>{Object.defineProperty(t,e,{get:()=>t.enable?t.__[e]:q,set(t){this.__[e]=t}})}],V,"showRepaint",void 0);const Q=V;const Z=V.get("RunTime");class ${static start(t,e){const s=a.create(a.RUNTIME);return J.currentId=J.idMap[s]=e?performance.now():Date.now(),J.currentName=J.nameMap[s]=t,J.nameToIdMap[t]=s,s}static end(t,e){const s=J.idMap[t],i=J.nameMap[t];J.idMap[t]=void 0,J.nameMap[t]=void 0,J.nameToIdMap[i]=void 0,e?Z.log(i,performance.now()-s,"µs"):Z.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=J.nameToIdMap[t];s&&J.end(s,e)}}$.idMap={},$.nameMap={},$.nameToIdMap={};const J=$;function tt(t,e,s){Object.defineProperty(t,e,s)}function et(t,e){return Object.getOwnPropertyDescriptor(t,e)}function st(t){return(e,s)=>{tt(e,s,{get(){return this.__get(t)},set(e){this.__set(t,e)}})}}function it(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t)}}),vt(e,s,t)}}function ot(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.positionChanged||this.__layout.positionChange()}}),vt(e,s,t)}}function nt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}}),vt(e,s,t)}}function rt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}}),vt(e,s,t)}}function at(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.boxBoundsChanged||this.__layout.boxBoundsChange()}}),vt(e,s,t)}}const ht=at;function dt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.eventBoundsChanged||this.__layout.eventBoundsChange()}}),vt(e,s,t)}}function lt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}}),vt(e,s,t)}}function ct(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}}),vt(e,s,t)}}function ut(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.root?this.__set(s,t):this.__[s]=t,this.__layout.opacityChanged||this.__layout.opacityChange()}}),vt(e,s,t)}}function pt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.parent?this.parent.__layout.childrenSortChanged=!0:this.__addParentWait((()=>{this.parent.__layout.childrenSortChanged=!0}))}}),vt(e,s,t)}}function _t(t){return(e,s)=>{tt(e,"__DataProcessor",{get:()=>t})}}function gt(t){return(e,s)=>{tt(e,"__LayoutProcessor",{get:()=>t})}}function vt(t,e,s){const i=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[o];return void 0===t?s:t},set(t){this[o]=t}};void 0===s&&(r.get=function(){return this[o]});const a=et(i,e);a&&(a.set&&(r.set=a.set),a.get&&(r.get=a.get)),i[n]&&(r.set=i[n],delete i[n]),Object.defineProperty(i,e,r)}const yt=new V("rewrite"),ft=[],mt=["destroy","constructor"];function xt(t){return(e,s)=>{ft.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function wt(){return t=>{Bt()}}function Bt(t){ft.length&&(ft.forEach((e=>{t&&yt.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ft.length=0)}function Et(t){return e=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!mt.includes(s))if(t.prototype){et(t.prototype,s).writable&&(e.prototype[s]=t.prototype[s])}else e.prototype[s]=t[s]}))}}setTimeout((()=>Bt(!0)));const bt={},Tt=V.get("EventCreator"),Rt={typeList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Ct[e]?Tt.error("register the repeat EventType: ",e):Ct[e]=t)}))},get:(t,...e)=>new Ct[t](...e)},{typeList:Ct}=Rt,Pt=V.get("UICreator"),Lt={list:{},register(t){const{tag:e}=t.prototype;kt[e]?Pt.error("register the repeat UI: ",e):kt[e]=t},get:(t,e)=>new kt[t](e)},{list:kt}=Lt,St={ui:(t,e)=>Lt.get(t,e),event:(t,...e)=>Rt.get(t,...e)};function Mt(){return t=>{Lt.register(t)}}function Dt(){return t=>{Rt.register(t)}}const{setByBoundsTimesMatrix:Ot}=N;class At{constructor(t){this.leaf=t,this.renderBounds=this.eventBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.relativeRenderBounds=this.relativeEventBounds=t.__relative}update(){const{leafer:t}=this.leaf;t&&t.watcher.changed&&(t.running||t.start(),t.layouter.layout())}getTransform(t){return this.update(),"world"===t?this.leaf.__world:this.leaf.__relative}getBounds(t,e){if(this.update(),"world"===t)switch(e){case"render":return this.leaf.__world;case"box":return this.getWorldBoxBounds();case"event":return this.getWorldEventBounds()}else if("local"===t)switch(e){case"render":return this.renderBounds;case"box":return this.boxBounds;case"event":return this.eventBounds}else switch(e){case"render":return this.relativeRenderBounds;case"box":return this.leaf.__relative;case"event":return this.relativeEventBounds}return this.leaf.__world}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Ot(this._worldBoxBounds,this.boxBounds,this.leaf.__world),this._worldBoxBounds}getWorldEventBounds(){return this._worldEventBounds||(this._worldEventBounds={}),Ot(this._worldEventBounds,this.eventBounds,this.leaf.__world),this._worldEventBounds}eventBoundsSpreadCancel(){const t=this.renderBounds===this.eventBounds;this.eventBounds=this.boxBounds,this.relativeEventBounds=this.leaf.__relative,t&&this.renderBoundsSpreadCancel()}renderBoundsSpreadCancel(){this.renderBounds=this.eventBounds,this.relativeRenderBounds=this.relativeEventBounds}eventBoundsSpread(){const{x:t,y:e,width:s,height:i}=this.eventBounds;this.eventBounds={x:t,y:e,width:s,height:i},this.relativeEventBounds={x:t,y:e,width:s,height:i},this.renderBoundsSpreadWidth||this.renderBoundsSpreadCancel()}renderBoundsSpread(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.relativeRenderBounds={x:t,y:e,width:s,height:i}}boxBoundsChange(){this.boxBoundsChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange(),this.hitCanvasChanged=!0}localBoxBoundsChange(){this.localBoxBoundsChanged=!0,this.boundsChanged=!0}eventBoundsChange(){this.eventBoundsChanged=!0,this.eventBoundsSpreadWidth||(this.eventBoundsSpreadWidth=1),this.boundsChanged=!0}renderBoundsChange(){this.renderBoundsChanged=!0,this.renderBoundsSpreadWidth||(this.renderBoundsSpreadWidth=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=void 0}}const Wt={},It={on(t,e,s){let i,o,n;if(s){const t="boolean"==typeof s;i=t?s:s.capture,o=!t&&s.once}const r=Nt(this,i,!0),a="string"==typeof t?t.split(" "):t,h=o?{listener:e,once:o}:{listener:e};a.forEach((t=>{t&&(n=r[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):r[t]=[h])}))},off(t,e,s){let i,o,n;s&&(i="boolean"==typeof s?s:s.capture);const r=Nt(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(o=r[t],o&&(n=o.findIndex((t=>t.listener===e)),n>-1&&o.splice(n,1),o.length||delete r[t]))}))},on__(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,listener:e,options:i}},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 i=Nt(this,s)[t];if(i){let o;for(let n=0,r=i.length;n<r&&(o=i[n],o.listener(e),o.once&&this.off(t,o.listener,s),!e||!e.isStopNow);n++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function Nt(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Wt)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Wt)}}class zt{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}}let Ft=class extends zt{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}};Ft.ADD="child.add",Ft.REMOVE="child.remove",Ft=U([Dt()],Ft);let jt=class extends zt{constructor(t,e,s,i,o){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=o}};var Yt;jt.CHANGE="attr.change",jt=U([Dt()],jt);let Xt=Yt=class extends zt{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){const s="object"==typeof t;super(s?Yt.RESIZE:t),s&&Object.assign(this,t),this.old=e}};Xt.RESIZE="resize",Xt=Yt=U([Dt()],Xt);let Ht=class extends zt{constructor(t,e){super(t),e&&Object.assign(this,e)}};Ht.BEFORE="transform.before",Ht.CHANGE="transform.change",Ht.AFTER="transform.after",Ht.PRE_BEFORE="transform.pre_before",Ht.PRE_CHANGE="transform.pre_change",Ht.PRE_AFTER="transform.pre_after",Ht=U([Dt()],Ht);let Gt=class extends zt{constructor(t,e){super(t),this.data=e}};Gt.REQUEST="watch.request",Gt.DATA="watch.data",Gt=U([Dt()],Gt);let Ut=class extends zt{constructor(t,e){super(t),e&&(this.data=e)}};Ut.REQUEST="layout.request",Ut.START="layout.start",Ut.BEFORE_ONCE="layout.before_once",Ut.ONCE="layout.once",Ut.AFTER_ONCE="layout.after_once",Ut.AGAIN="layout.again",Ut.LAYOUT="layout",Ut.END="layout.end",Ut=U([Dt()],Ut);let Kt=class extends zt{};Kt.REQUEST="render.request",Kt.START="render.start",Kt.BEFORE_ONCE="render.before_once",Kt.ONCE="render.once",Kt.AFTER_ONCE="render.after_once",Kt.AGAIN="render.again",Kt.RENDER="render",Kt.END="render.end",Kt=U([Dt()],Kt);const Vt={__set(t,e){if(this.root){const s=this.__.__getInput(t);s!==e&&(this.__[t]=e,this.root.emitEvent(new jt(jt.CHANGE,this,t,s,e)))}else this.__[t]=e},__get(t){return this.__.__getInput(t)},__updateAttr(t){if(this.root){const e=this.__.__getInput(t);this.root.emitEvent(new jt(jt.CHANGE,this,t,e,e))}}},{defaultMatrix:qt}=p,{sin:Qt,cos:Zt}=Math,$t={__updateWorldMatrix(){const t=this.parent?this.parent.__world:qt,e=this.__relative,s=this.__world;this.__layout.matrixChanged&&this.__updateRelativeMatrix(),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.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)},__updateRelativeMatrix(){const t=this.__relative,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:o,skewX:n,skewY:r}=this.__;o||n||r?(o*=l,n&&(n*=l),r&&(r*=l),t.a=s*Zt(o+r),t.b=s*Qt(o+r),t.c=i*-Qt(o-n),t.d=i*Zt(o-n)):(t.a=s,t.b=0,t.c=0,t.d=i,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=i,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{setByBoundsTimesMatrix:Jt}=N,te={__updateWorldBounds(){var t,e,s;if(this.__layout.boundsChanged){let i;const o=this.__layout;o.boxBoundsChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),o.boxBoundsChanged=!1,i=!0),o.localBoxBoundsChanged&&(this.__updateRelativeBoxBounds(),o.localBoxBoundsChanged=!1,o.eventBoundsSpreadWidth&&(o.eventBoundsChanged=!0),o.renderBoundsSpreadWidth&&(o.renderBoundsChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxBoundsChange()),o.eventBoundsChanged&&(o.eventBoundsSpreadWidth=this.__updateEventBoundsSpreadWidth(),o.eventBoundsSpreadWidth?(o.eventBounds===o.boxBounds&&o.eventBoundsSpread(),this.__updateEventBounds(),this.__updateRelativeEventBounds(),o.eventBoundsChanged=!1,o.renderBoundsSpreadWidth&&(o.renderBoundsChanged=!0)):o.eventBoundsSpreadCancel(),null===(e=this.parent)||void 0===e||e.__layout.eventBoundsChange(),i||(i=!0)),o.renderBoundsChanged&&(o.renderBoundsSpreadWidth=this.__updateRenderBoundsSpreadWidth(),o.renderBoundsSpreadWidth?(o.renderBounds!==o.boxBounds&&o.renderBounds!==o.eventBounds||o.renderBoundsSpread(),this.__updateRenderBounds(),this.__updateRelativeRenderBounds(),o.renderBoundsChanged=!1):o.renderBoundsSpreadCancel(),null===(s=this.parent)||void 0===s||s.__layout.renderBoundsChange()),o.boundsChanged=!1,Jt(this.__world,this.__layout.renderBounds,this.__world),i&&this.__onUpdateSize()}else Jt(this.__world,this.__layout.renderBounds,this.__world)},__updateRelativeBoxBounds(){Jt(this.__relative,this.__layout.boxBounds,this.__relative)},__updateRelativeEventBounds(){Jt(this.__layout.relativeEventBounds,this.__layout.eventBounds,this.__relative)},__updateRelativeRenderBounds(){Jt(this.__layout.relativeRenderBounds,this.__layout.renderBounds,this.__relative)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height}},{toLocalRadiusPoint:ee}=B,se={},ie={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawRenderPath(this.__hitCanvas)},__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),ee(t,this.__world,se),this.__hit(se)}},oe={__render(t,e){this.__worldOpacity&&(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__complex?this.__draw(t,e):this.__drawFast(t,e))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{LEAF:ne,create:re}=a;let ae=class{get tag(){return this.constructor.name}get __DataProcessor(){return r}get __LayoutProcessor(){return At}constructor(t){this.innerId=re(ne),this.__relative={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},this.__worldOpacity=1,this.__renderTime=2,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}__addParentWait(t){this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}__runParentWait(){const t=this.__parentWait.length;for(let e=0;e<t;e++)this.__parentWait[e]();this.__parentWait=void 0}__setAsLeafer(){this.leafer=this}__setAsRoot(){this.__bindRoot(this),this.__isRoot=!0}__bindRoot(t){if(!this.__isRoot&&(this.root=t,this.leafer=t.leafer,this.__level=this.parent?this.parent.__level+1:1,this.__isBranch)){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindRoot(t)}}__set(t,e){}__get(t){}__updateAttr(t){}__updateWorldOpacity(){}__updateWorldMatrix(){}__updateRelativeMatrix(){}__updateWorldBounds(){}__updateRelativeBoxBounds(){}__updateRelativeEventBounds(){}__updateRelativeRenderBounds(){}__updateBoxBounds(){}__updateEventBounds(){}__updateRenderBounds(){}__updateEventBoundsSpreadWidth(){return 0}__updateRenderBoundsSpreadWidth(){return 0}__onUpdateSize(){}__hitWorld(t){return!0}__hit(t){return!0}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){}on(t,e,s){}off(t,e,s){}on__(t,e,s,i){}off__(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.__&&(this.__isBranch&&(this.children.forEach((t=>{t.destroy()})),this.children=void 0),this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=void 0),this.leafer=void 0,this.root=void 0,this.parent=void 0,this.__.destroy(),this.__layout.destroy(),this.__=void 0,this.__layout=void 0,this.__captureMap=void 0,this.__bubbleMap=void 0)}};ae=U([Et(Vt),Et($t),Et(te),Et(ie),Et(It),Et(oe)],ae);const he={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)le(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ce(e[t])}},updateAllChange(t){if(ce(t),t.__updateChange(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ue(e[t])}},moveOfWorld(t,e,s){const i={x:e,y:s};t.parent&&p.toLocalPoint(t.parent.__world,i,i,!0),de.move(t,i.x,i.y)},move(t,e,s){t.x=t.__.x+e,t.y=t.__.y+s},zoomOfWorld(t,e,s,i){const o=t.parent?B.tempToLocal(s,t.parent.__world):s;this.zoom(t,e,o,i)},zoom(t,e,s,i){i||(i=t);const{x:o,y:n}=i.__,{scaleX:r,scaleY:a}=t.__,h=s.x-o,d=s.y-n,l=(new T).translate(h,d).scale(e).translate(-h,-d);i.x=o-l.e,i.y=n-l.f,t.scaleX=r*e,t.scaleY=a*e},rotateOfWorld(t,e,s,i){const o=t.parent?B.tempToLocal(s,t.parent.__world):s;this.rotate(t,e,o,i)},rotate(t,e,s,i){i||(i=t);const{x:o,y:n}=i.__,{rotation:r}=t.__,a=s.x-o,h=s.y-n,d=(new T).translate(a,h).rotate(e).translate(-a,-h);i.x=o-d.e,i.y=n-d.f,t.rotation=r+e}},de=he,{updateAllWorldMatrix:le,updateAllWorldOpacity:ce,updateAllChange:ue}=de,pe={worldBounds:t=>t.__world,relativeBoxBounds:t=>t.__relative,relativeEventBounds:t=>t.__layout.relativeEventBounds,relativeRenderBounds:t=>t.__layout.relativeRenderBounds},_e={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__childBranchNumber){const{children:s}=t;for(let i=0,o=s.length;i<o;i++)(t=s[i]).__isBranch&&(t.__tempNumber=1,e.push(t),ge(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:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].__isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)ve(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:ge,pushAllBranchStack:ve}=_e,{setByListWithHandle:ye}=N,{sort:fe}=_e,{relativeBoxBounds:me,relativeEventBounds:xe,relativeRenderBounds:we}=pe;class Be extends ae{constructor(){super(),this.__isBranch=!0,this.children=[]}__updateEventBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.eventBoundsSpreadWidth)return 1;return 0}__updateRenderBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderBoundsSpreadWidth)return 1;return 0}__updateBoxBounds(){ye(this.__layout.boxBounds,this.children,me)}__updateEventBounds(){ye(this.__layout.eventBounds,this.children,xe)}__updateRenderBounds(){ye(this.__layout.renderBounds,this.children,we)}__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1)}__updateSortChildren(){const{children:t}=this;if(t.length>1){for(let e=0,s=t.length;e<s;e++)t[e].__tempNumber=e;t.sort(fe)}}__render(t,e){if(this.__worldOpacity){let s;const{bounds:i,hideBounds:o}=e,{children:n}=this;for(let r=0,a=n.length;r<a;r++)s=n[r],i&&!i.hit(s.__world,e.matrix)||o&&o.includes(s.__world)||s.__render(t,e)}}add(t,e){if(t.parent)t.parent!==this&&console.warn("child had other parent, can not add to this, child innerId:"+t.innerId);else{if(t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.__isBranch&&(this.__childBranchNumber?this.__childBranchNumber++:this.__childBranchNumber=1),this.root){t.__bindRoot(this.root);const e=new Ft(Ft.ADD,t,this);this.hasEvent(Ft.ADD)&&this.emitEvent(e),this.root.emitEvent(e)}t.__parentWait&&t.__runParentWait()}}remove(t){if(t){const e=this.children.indexOf(t);if(e>-1){if(this.children.splice(e,1),t.__isBranch&&(this.__childBranchNumber>1?this.__childBranchNumber--:this.__childBranchNumber=0),this.root){const e=new Ft(Ft.REMOVE,t,this);this.hasEvent(Ft.REMOVE)&&this.emitEvent(e),this.root.emitEvent(e),t.root=void 0}t.parent=void 0,this.__layout.boxBoundsChange()}}else this.parent&&this.parent.remove(this)}}const Ee={};class be{static isHoldSpaceKey(){return be.hasDownCode("Space")}static setDownCode(t){Ee[t]||(Ee[t]=!0)}static setUpCode(t){Ee[t]=!1}static hasDownCode(t){return Ee[t]}}class Te{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class Re extends zt{get spaceKey(){return be.isHoldSpaceKey()}get left(){return Te.left(this)}get right(){return Te.right(this)}get middle(){return Te.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}}let Ce=class extends Re{};Ce.POINTER="pointer",Ce.BEFORE_DOWN="pointer.before_down",Ce.BEFORE_MOVE="pointer.before_move",Ce.BEFORE_UP="pointer.before_up",Ce.DOWN="pointer.down",Ce.MOVE="pointer.move",Ce.UP="pointer.up",Ce.ENTER="pointer.enter",Ce.LEAVE="pointer.leave",Ce.TAP="tap",Ce.CLICK="click",Ce.DOUBLE_CLICK="doubleclick",Ce.LONG_PRESS="longpress",Ce.LONG_TAP="longtap",Ce=U([Dt()],Ce);let Pe=class extends Ce{};var Le;Pe.DRAG="drag",Pe.START="drag.start",Pe.END="drag.end",Pe=U([Dt()],Pe);let ke=Le=class extends Ce{static setList(t){Le.dragList=t instanceof e?t:new e(t)}};ke.DROP="drop",ke.ENTER="drop.enter",ke.LEAVE="drop.leave",ke=Le=U([Dt()],ke);let Se=class extends Pe{};Se.MOVE="move",Se.START="move.start",Se.END="move.end",Se=U([Dt()],Se);let Me=class extends Re{};Me.ROTATE="rotate",Me.START="rotate.start",Me.END="rotate.end",Me=U([Dt()],Me);let De=class extends Pe{};De.SWIPE="swipe",De.LEFT="swipe.left",De.RIGHT="swipe.right",De.UP="swipe.up",De.DOWN="swipe.down",De=U([Dt()],De);let Oe=class extends Re{};Oe.ZOOM="zoom",Oe.START="zoom.start",Oe.END="zoom.end",Oe=U([Dt()],Oe);let Ae=class extends Re{};Ae.DOWN="key.down",Ae.PRESS="key.press",Ae.UP="key.up",Ae=U([Dt()],Ae);class We{constructor(t,e){this.list=[],this.leafer=t}load(){}destory(){this.leafer=void 0}}const Ie={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,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},Ne={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,rect:5,roundRect:6,ellipse:9,arc:7,arcTo:6},ze={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},Fe=Ie,je={};for(let t in Fe)je[Fe[t]]=t;const Ye={};for(let t in Fe)Ye[Fe[t]]=Ne[t];const Xe={},{sin:He,cos:Ge,sqrt:Ue,atan2:Ke,ceil:Ve,abs:qe,PI:Qe}=Math,{setPoint:Ze,addPoint:$e}=R,Je={getFromACommand(t,e,s,i,o,n,r,a,h){const d=a-t,l=h-e,c=o*Qe/180,u=He(c),p=Ge(c),_=-p*d*.5-u*l*.5,g=-p*l*.5+u*d*.5,v=s*s,y=i*i,f=g*g,m=_*_,x=v*y-v*f-y*m;let w=0;if(x<0){const t=Ue(1-x/(v*y));s*=t,i*=t}else{w=(n===r?-1:1)*Ue(x/(v*f+y*m))}const B=w*s*g/i,E=-w*i*_/s,b=p*B-u*E+.5*d,T=u*B+p*E+.5*l;let R=Ke((g-E)/i,(_-B)/s),C=Ke((-g-E)/i,(-_-B)/s),P=C-R;0===r&&P>0?P-=2*Qe:1===r&&P<0&&(P+=2*Qe);const L=[],k=Ve(qe(P/Qe*2)),S=P/k,M=He(S/2),D=He(S/4),O=8/3*D*D/M;R=0,C=Ke((g-E)/i,(_-B)/s);let A,W,I,N,z,F,j,Y,X=C-R,H=X+S,G=Ge(X),U=He(X),K=0,V=0;for(let o=0;o<k;o++)A=Ge(H),W=He(H),I=p*s*A-u*i*W+b,N=u*s*A+p*i*W+T,z=K+O*(-p*s*U-u*i*G),F=V+O*(-u*s*U+p*i*G),j=I+O*(p*s*W+u*i*A),Y=N+O*(u*s*W-p*i*A),L.push(Ie.C,z+t,F+e,j+t,Y+e,I+t,N+e),K=I,V=N,X=H,G=A,U=W,H+=S;return L},toTwoPointBounds(t,e,s,i,o,n,r,a,h){const d=[];let l,c,u,p,_,g,v,y,f=t,m=s,x=o,w=r;for(let t=0;t<2;++t)if(1==t&&(f=e,m=i,x=n,w=a),l=-3*f+9*m-9*x+3*w,c=6*f-12*m+6*x,u=3*m-3*f,Math.abs(l)<1e-12){if(Math.abs(c)<1e-12)continue;p=-u/c,0<p&&p<1&&d.push(p)}else v=c*c-4*u*l,y=Math.sqrt(v),v<0||(_=(-c+y)/(2*l),0<_&&_<1&&d.push(_),g=(-c-y)/(2*l),0<g&&g<1&&d.push(g));Ze(h,t,e),$e(h,r,a);for(let l=0,c=d.length;l<c;l++)ts.getPointAndSet(d[l],t,e,s,i,o,n,r,a,Xe),$e(h,Xe.x,Xe.y)},getPointAndSet(t,e,s,i,o,n,r,a,h,d){const l=1-t,c=l*l*l,u=3*l*l*t,p=3*l*t*t,_=t*t*t;d.x=c*e+u*i+p*n+_*a,d.y=c*s+u*o+p*r+_*h},getPoint(t,e,s,i,o,n,r,a,h){const d={};return ts.getPointAndSet(t,e,s,i,o,n,r,a,h,d),d}},ts=Je,{M:es,m:ss,L:is,l:os,H:ns,h:rs,V:as,v:hs,C:ds,c:ls,S:cs,s:us,Q:ps,q:_s,T:gs,t:vs,A:ys,a:fs,Z:ms,z:xs}=Ie,{getFromACommand:ws}=Je,Bs={current:{},stringify(t){let e,s,i,o=0,n=t.length,r="";for(;o<n;){s=t[o],e=Ye[s],r+=s===i?" ":je[s];for(let s=1;s<e;s++)r+=t[o+s],s===e-1||(r+=" ");i=s,o+=e}return r},parse(t,e=!0){let s,i,o="";const n=[];for(let e=0,r=t.length;e<r;e++)i=t[e],G[i]?o+=i:Ie[i]?(o&&(bs(n,Number(o)),o=""),Es.name=Ie[i],Es.length=Ne[i],Es.index=0,bs(n,Es.name),!s&&ze[i]&&(s=!0)):"-"===i?(o&&bs(n,Number(o)),o=i):o&&(bs(n,Number(o)),o="");return o&&bs(n,Number(o)),e&&s?Bs.convertToSimple(n):n},convertToSimple(t){let e,s,i,o,n,r=0,a=0,h=0,d=0,l=0,c=t.length;const u=[];for(;l<c;){switch(i=t[l],i){case ss:t[l+1]+=r,t[l+2]+=a;case es:r=t[l+1],a=t[l+2],u.push(es,r,a),l+=3;break;case rs:t[l+1]+=r;case ns:r=t[l+1],u.push(is,r,a),l+=2;break;case hs:t[l+1]+=a;case as:a=t[l+1],u.push(is,r,a),l+=2;break;case os:t[l+1]+=r,t[l+2]+=a;case is:r=t[l+1],a=t[l+2],u.push(is,r,a),l+=3;break;case us:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,i=cs;case cs:n=o===ds||o===cs,h=n?2*r-e:t[l+1],d=n?2*a-s:t[l+2],e=t[l+1],s=t[l+2],r=t[l+3],a=t[l+4],u.push(ds,h,d,e,s,r,a),l+=5;break;case ls:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,t[l+5]+=r,t[l+6]+=a,i=ds;case ds:e=t[l+3],s=t[l+4],r=t[l+5],a=t[l+6],u.push(ds,t[l+1],t[l+2],e,s,r,a),l+=7;break;case vs:t[l+1]+=r,t[l+2]+=a,i=gs;case gs:n=o===ps||o===gs,e=n?2*r-e:t[l+1],s=n?2*a-s:t[l+2],r=t[l+1],a=t[l+2],u.push(ps,e,s,r,a),l+=3;break;case _s:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,i=ps;case ps:e=t[l+1],s=t[l+2],r=t[l+3],a=t[l+4],u.push(ps,e,s,r,a),l+=5;break;case fs:t[l+6]+=r,t[l+7]+=a;case ys:u.push(...ws(r,a,t[l+1],t[l+2],t[l+3],t[l+4],t[l+5],t[l+6],t[l+7])),r=t[l+6],a=t[l+7],l+=8;break;case xs:case ms:u.push(ms),l++}o=i}return u},pushData(t,e){Es.index===Es.length&&(Es.index=1,t.push(Es.name)),t.push(e),Es.index++}},{current:Es,pushData:bs}=Bs,{M:Ts,L:Rs,C:Cs,Q:Ps,Z:Ls,ellipse:ks}=Ie,{toTwoPointBounds:Ss}=Je,{add:Ms,addPoint:Ds,setPoint:Os}=R,As={},Ws={smoothCorner:(t,e,s)=>t,toTwoPointBounds(t,e){let s,i,o,n,r,a,h,d=0;const l=t.length;for(;d<l;)switch(s=t[d],0===d&&(s===Ts?Os(e,t[1],t[2]):Os(e,0,0)),s){case Ts:case Rs:i=t[d+1],o=t[d+2],Ds(e,i,o),d+=3;break;case Cs:a=t[d+5],h=t[d+6],Ss(i,o,t[d+1],t[d+2],t[d+3],t[d+4],a,h,As),Ms(e,As),i=a,o=h,d+=7;break;case Ps:n=t[d+1],r=t[d+2],a=t[d+3],h=t[d+4],Ss(i,o,n,r,n,r,a,h,As),Ms(e,As),i=a,o=h,d+=5;break;case Ls:d+=1}e.minX--,e.minY--,e.maxX++,e.maxY++},drawData(t,e){let s,i=0,o=e.length;for(;i<o;)switch(s=e[i],s){case Ts:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Rs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Cs:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Ps:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ls:t.closePath(),i+=1;break;case ks:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6],e[i+7],e[i+8]),i+=9}}};let Is;const{M:Ns,L:zs,C:Fs,Q:js,Z:Ys,rect:Xs,roundRect:Hs,ellipse:Gs,arc:Us,arcTo:Ks}=Ie,Vs={begin(t){Is=t},end(){Is=void 0},moveTo(t,e){Is.push(Ns,t,e)},lineTo(t,e){Is.push(zs,t,e)},bezierCurveTo(t,e,s,i,o,n){Is.push(Fs,t,e,s,i,o,n)},quadraticCurveTo(t,e,s,i){Is.push(js,t,e,s,i)},close(t){Is.push(Ys),t&&(Is=void 0)},rect(t,e,s,i){Is.push(Xs,t,e,s,i)},roundRect(t,e,s,i,o){Is.push(Hs,t,e,s,i,o)},ellipse(t,e,s,i,o,n,r,a){Is.push(Gs,t,e,s,i,o,n,r,a)},arc(t,e,s,i,o,n){Is.push(Us,t,e,s,i,o,n)},arcTo(t,e,s,i,o){Is.push(Ks,t,e,s,i,o)}},qs=V.get("plugin"),Qs={list:[]};function Zs(t,e){if(Qs.list.push(t),t.dependencies){const s={};t.dependencies.forEach((t=>{e[t]?s[t]=e[t]:qs.error(t+" non-existent")})),t.run(s)}else qs.error("no dependencies")}class $s{constructor(t){this.taskTime=1,this.id=a.create(a.TASK),this.task=t}run(){return K(this,void 0,void 0,(function*(){this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}))}complete(){this.isComplete=!0,this.parent=void 0,this.task=void 0}}const Js=V.get("TaskProcessor");class ti{get isComplete(){return this._isComplete}get running(){return this._running}constructor(t){this.parallel=6,this.params={},this.list=[],this.index=0,t&&(this.params=t,t.parallel&&(this.parallel=t.parallel)),this.init()}get percent(){const t=this.list.length;let e=0,s=0;for(let i=0;i<t;i++)i<=this.index?(s+=this.list[i].taskTime,i===this.index&&(e=s)):e+=this.list[i].taskTime;let i=this._isComplete?1:s/e;return Number.isNaN(i)&&(i=0),i}get total(){return this.list.length}get runIndex(){return this.index}init(){this.empty(),this.index=0,this.parallelSuccessNumber=0,this._running=!1,this._isComplete=!1}empty(){this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){this._running=!1,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new $s(t),e)}addParallel(t,e){const s=new $s(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new $s(t))}push(t,e){e&&(t.taskTime=e),t.parent=this,this.list.push(t)}run(){this._running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTask():this.runTask())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTask(){this.parallelList.forEach((t=>{t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.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,i=this.index+this.parallelSuccessNumber+s;if(e.length){if(!this._running)return;i<this.list.length&&(t=this.list[i],t.parallel&&(e.push(t),t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))))}else this.index+=this.parallelSuccessNumber,this.nextTask()}nextTask(){setTimeout((()=>{this.run()}),0)}onComplete(){this.stop(),this._isComplete=!0,this.params.onComplete&&this.params.onComplete()}onTask(t){t.complete(),this.params.onTask&&this.params.onTask(),this.index===this.list.length-1&&this.onComplete()}onParallelError(t){Js.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.params.onError&&this.params.onError(t)}}class ei{constructor(t,s){this.updatedList=new e,this.totalTimes=0,this.config={},this.changed=!0,this.target=t,s&&(this.config=o.default(s,this.config)),this.listenEvents()}start(){this.running=!0,this.changed=!1,this.update()}stop(){this.running=!1}listenEvents(){const{target:t}=this;this.eventIds=[t.on__(jt.CHANGE,this.onAttrChange,this),t.on__([Ft.ADD,Ft.REMOVE],this.onChildEvent,this),t.on__(Gt.REQUEST,this.onRquestData,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onRquestData(){this.target.emitEvent(new Gt(Gt.DATA,{updatedList:this.updatedList})),this.updatedList=new e,this.totalTimes++,this.changed=!1}onAttrChange(t){this.updatedList.push(t.target),this.update()}onChildEvent(t){this.updatedList.push(t.type===Ft.REMOVE?t.parent:t.child),this.update()}update(){this.running&&(this.changed=!0,this.target.emit(Kt.REQUEST))}destroy(){this.target&&(this.removeListenEvents(),this.target=void 0,this.updatedList=void 0)}}const{updateAllWorldMatrix:si,updateAllWorldOpacity:ii}=he,{pushAllChildBranch:oi,pushAllParent:ni}=_e;const{worldBounds:ri}=pe,{setByListWithHandle:ai}=N;class hi{constructor(t){this.updatedBounds=new Y,this.beforeBounds=new Y,this.afterBounds=new Y,t instanceof Array&&(t=new e(t)),this.updatedList=t}setBefore(){ai(this.beforeBounds,this.updatedList.list,ri)}setAfter(){ai(this.afterBounds,this.updatedList.list,ri),this.__computeChange()}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}__computeChange(){const{updatedBounds:t}=this;t.setByList([this.beforeBounds,this.afterBounds]),t.isEmpty()||(t.spread(2),t.ceil())}destroy(){this.updatedList=void 0}}const{updateAllWorldMatrix:di,updateAllChange:li}=he,{pushAllBranchStack:ci,updateWorldBoundsByBranchStack:ui}=_e;class pi{constructor(t,e){this.totalTimes=0,this.changed=!0,this.config={partLayout:{maxTimes:3}},this.levelList=new s,this.target=t,e&&(this.config=o.default(e,this.config)),this.listenEvents()}start(){this.running=!0}stop(){this.running=!1}listenEvents(){const{target:t}=this;this.eventIds=[t.on__(Ut.REQUEST,this.layout,this),t.on__(Ut.AGAIN,this.layoutOnce,this),t.on__(Gt.DATA,this.onReceiveWatchData,this),t.on__(Kt.REQUEST,this.onChange,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onReceiveWatchData(t){this.updateList=t.data.updatedList}onChange(){this.changed=!0}layout(){if(!this.running)return;const{target:t}=this,{START:e,LAYOUT:s,END:i}=Ut;this.times=0,this.changed=!1,t.emit(e),this.layoutOnce(),t.emitEvent(new Ut(s,this.layoutedBlocks)),t.emitEvent(new Ut(i,this.layoutedBlocks)),this.layoutedBlocks=void 0}layoutOnce(){this.totalTimes++,this.times++,this.target.emit(Gt.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout()}partLayout(){var t;if(!(null===(t=this.updateList)||void 0===t?void 0:t.length))return;const e=$.start("part layout"),{target:s,updateList:i}=this,{BEFORE_ONCE:o,ONCE:n,AFTER_ONCE:r}=Ut,a=this.getBlocks(i);a.forEach((t=>{t.setBefore()})),s.emitEvent(new Ut(o,a)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&(s.matrixChanged?(si(t),e.push(t),t.__isBranch&&oi(t,e),ni(t,e)):s.boundsChanged&&(e.push(t),t.__isBranch&&(t.__tempNumber=0),ni(t,e)))}))}(i,this.levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;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&&ii(t),t.__updateChange()}))}(i),a.forEach((t=>{t.setAfter()})),s.emitEvent(new Ut(n,a)),s.emitEvent(new Ut(r,a)),this.setBlocks(a),this.levelList.reset(),this.updateList=void 0,$.end(e),this.__checkAgain()}fullLayout(){const t=$.start("full layout"),{target:s}=this,{BEFORE_ONCE:i,ONCE:o,AFTER_ONCE:n}=Ut,r=this.getBlocks(new e(s));s.emitEvent(new Ut(i,r)),pi.fullLayout(s),r.forEach((t=>{t.setAfter()})),s.emitEvent(new Ut(o,r)),s.emitEvent(new Ut(n,r)),this.setBlocks(r),$.end(t),this.__checkAgain()}__checkAgain(){this.changed&&this.times<=this.config.partLayout.maxTimes&&this.target.emit(Ut.AGAIN)}createBlock(t){return new hi(t)}getBlocks(t){return[this.createBlock(t)]}setBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}static fullLayout(t){if(di(t),t.__isBranch){const e=[t];ci(t,e),ui(e)}else t.__updateWorldBounds();li(t)}destroy(){this.target&&(this.removeListenEvents(),this.target=void 0)}}class _i{set changed(t){t?this._changed||(this._changed=!0,this.requestRender()):this._changed=!1}get changed(){return this._changed}constructor(t,e,s){this.totalTimes=0,this.times=0,this.FPS=60,this.config={maxFPS:60},this._changed=!1,this.target=t,this.canvas=e,s&&(this.config=o.default(s,this.config)),this.listenEvents()}start(){this.running=!0,this.changed=!0}stop(){this.running=!1}listenEvents(){const{target:t}=this;this.eventIds=[t.on__(Kt.REQUEST,this.onRequest,this),t.on__(Ut.END,this.onLayoutEnd,this),t.on__(Kt.AGAIN,this.renderOnce,this),t.on__(Xt.RESIZE,this.onResize,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onResize(t){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;new Y(0,0,e,s).includes(this.target.__world)||(this.target.__updateAttr("fill"),this.changed=!0)}}onRequest(){this.changed=!0}requestLayout(){this.target.emit(Ut.REQUEST)}onLayoutEnd(t){this.layoutedBlocks=t.data}render(t){const{target:e}=this,{START:s,RENDER:i,END:o}=Kt;this.times=0,e.emit(s),this.renderOnce(t),e.emit(i),e.emit(o)}renderOnce(t){const{target:e}=this,{BEFORE_ONCE:s,ONCE:i,AFTER_ONCE:o}=Kt;this.times++,this.totalTimes++,this.changed=!1,t?(e.emit(s),t()):(this.requestLayout(),e.emit(s),this.totalTimes>1?this.layoutedBlocks&&this.partRender():this.fullRender()),e.emit(i),e.emit(o),this.layoutedBlocks&&(this.layoutedBlocks.forEach((t=>{t.destroy()})),this.layoutedBlocks=void 0),this.__checkAgain()}__checkAgain(){this.changed&&this.times<3&&this.target.emit(Kt.AGAIN)}partRender(){const{canvas:t,layoutedBlocks:e}=this;if(e.some((t=>t.updatedBounds.includes(this.target.__world))))this.fullRender(t.bounds);else{let s;e.forEach((e=>{s=e.updatedBounds,t.bounds.hit(s)&&!s.isEmpty()&&this.clipRender(s.getIntersect(t.bounds))}))}}clipRender(t){const e=$.start("part render"),{canvas:s,target:i}=this;s.save(),s.clearBounds(t),V.showRepaint&&s.strokeBounds(t,"red"),s.clipBounds(t),i.__render(s,{bounds:t}),s.restore(),$.end(e)}fullRender(t){const{canvas:e,target:s}=this;_i.fullRender(s,e,t),V.showRepaint&&e.strokeBounds(t||e.bounds,"red")}static fullRender(t,e,s){const i=$.start("full render");s||(s=e.bounds),e.save(),e.clear(),t.__render(e,e.bounds.includes(t.__world)?{}:{bounds:s}),e.restore(),$.end(i)}requestRender(){const t=Date.now();bt.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&this.render())}))}destroy(){this.target&&(this.removeListenEvents(),this.target=void 0,this.canvas=void 0,this.config=void 0)}}const{hitRadiusPoint:gi}=N;class vi{constructor(t,e){this.target=t,this.selector=e}getHitPointPath(t,s,i){const o=!!i&&i.through;this.exclude=i?i.exclude:void 0,this.isStop=!1,this.point={x:t.x,y:t.y,radiusX:s,radiusY:s},this.eachFind(this.target.children);const{leaf:n}=this,{defaultPath:r}=this.selector,a=this.getPath(n);let h;if(a.pushList(r.list),o){const t=this.throughPath=new e;this.eachThroughFind(this.target.children),t.pushList(r.list),h={path:a,leaf:n,throughPath:t}}else h={path:a,leaf:n};return this.clear(),h}getPath(t){const s=new e;for(;t;)s.push(t),t=t.parent;return s}eachThroughFind(t){let e;const{point:s}=this;for(let i=t.length-1;i>-1;i--)if(e=t[i],!e.__interactionOff&&gi(e.__world,s)){if(e.__isBranch&&(e.__childrenInteractionOff||this.eachThroughFind(e.children)),this.exclude&&this.exclude.has(e))continue;e.__hitWorld(s)&&this.throughPath.push(e)}}eachFind(t){let e;const{point:s}=this;for(let i=t.length-1;i>-1&&(e=t[i],e.__interactionOff||(gi(e.__world,s)&&(e.__isBranch?(e.__childrenInteractionOff||this.eachFind(e.children),e.__isBranchLeaf&&(this.isStop||this.hitChild(e,s))):this.hitChild(e,s)),!this.isStop));i--);}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&(this.leaf=t,this.isStop=!0)}clear(){this.point=void 0,this.leaf=void 0,this.throughPath=void 0,this.exclude=void 0}destroy(){this.target=void 0,this.selector=void 0}}class yi{constructor(t){this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,this.defaultPath=new e(t),this.pathFinder=new vi(t,this),this.listenEvents()}listenEvents(){this.eventIds=[this.target.on__(Ft.REMOVE,this.onRemoveChild,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=void 0),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=void 0)}getHitPointPath(t,e,s){return this.pathFinder.getHitPointPath(t,e,s)}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,i=this.innerIdList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,i=this.idList[t];return i||(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 i=0,o=s.length;i<o;i++){if(e(t=s[i]))return;t.__isBranch&&this.loopFind(t,e)}}destroy(){this.target&&(this.removeListenEvents(),this.pathFinder.destroy(),this.target=void 0,this.pathFinder=void 0,this.innerIdList=void 0,this.idList=void 0,this.classNameList=void 0,this.tagNameList=void 0)}}function fi(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,i)}}const mi=[];function xi(){return(t,e)=>{mi.push(e)}}class wi{bindContextMethod(){let t;mi.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,i,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/o*h;o+=s,s=0,r+=t,h-=t}this.context.drawImage(t,e,s,i,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,s,i,o);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,o,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,o,n){}arcTo(t,e,s,i,o){}ellipse(t,e,s,i,o,n,r,a){}rect(t,e,s,i){}roundRect(t,e,s,i,o){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,o,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=void 0}}U([fi("imageSmoothingEnabled")],wi.prototype,"smooth",void 0),U([fi("imageSmoothingQuality")],wi.prototype,"smoothLevel",void 0),U([fi("globalAlpha")],wi.prototype,"opacity",void 0),U([fi("globalCompositeOperation")],wi.prototype,"blendMode",void 0),U([fi()],wi.prototype,"fillStyle",void 0),U([fi()],wi.prototype,"strokeStyle",void 0),U([fi("lineWidth")],wi.prototype,"strokeWidth",void 0),U([fi("lineCap")],wi.prototype,"strokeCap",void 0),U([fi("lineJoin")],wi.prototype,"strokeJoin",void 0),U([fi("lineDash")],wi.prototype,"dashPattern",void 0),U([fi("lineDashOffset")],wi.prototype,"dashOffset",void 0),U([fi()],wi.prototype,"miterLimit",void 0),U([fi()],wi.prototype,"shadowBlur",void 0),U([fi()],wi.prototype,"shadowColor",void 0),U([fi()],wi.prototype,"shadowOffsetX",void 0),U([fi()],wi.prototype,"shadowOffsetY",void 0),U([fi()],wi.prototype,"filter",void 0),U([fi()],wi.prototype,"font",void 0),U([fi()],wi.prototype,"fontKerning",void 0),U([fi()],wi.prototype,"fontStretch",void 0),U([fi()],wi.prototype,"fontVariantCaps",void 0),U([fi()],wi.prototype,"textAlign",void 0),U([fi()],wi.prototype,"textBaseline",void 0),U([fi()],wi.prototype,"textRendering",void 0),U([fi()],wi.prototype,"wordSpacing",void 0),U([fi()],wi.prototype,"letterSpacing",void 0),U([fi()],wi.prototype,"direction",void 0),U([xi()],wi.prototype,"setTransform",null),U([xi()],wi.prototype,"resetTransform",null),U([xi()],wi.prototype,"getTransform",null),U([xi()],wi.prototype,"save",null),U([xi()],wi.prototype,"restore",null),U([xi()],wi.prototype,"translate",null),U([xi()],wi.prototype,"scale",null),U([xi()],wi.prototype,"rotate",null),U([xi()],wi.prototype,"fill",null),U([xi()],wi.prototype,"stroke",null),U([xi()],wi.prototype,"clip",null),U([xi()],wi.prototype,"fillRect",null),U([xi()],wi.prototype,"strokeRect",null),U([xi()],wi.prototype,"clearRect",null),U([xi()],wi.prototype,"beginPath",null),U([xi()],wi.prototype,"moveTo",null),U([xi()],wi.prototype,"lineTo",null),U([xi()],wi.prototype,"bezierCurveTo",null),U([xi()],wi.prototype,"quadraticCurveTo",null),U([xi()],wi.prototype,"closePath",null),U([xi()],wi.prototype,"arc",null),U([xi()],wi.prototype,"arcTo",null),U([xi()],wi.prototype,"ellipse",null),U([xi()],wi.prototype,"rect",null),U([xi()],wi.prototype,"roundRect",null),U([xi()],wi.prototype,"createConicGradient",null),U([xi()],wi.prototype,"createLinearGradient",null),U([xi()],wi.prototype,"createPattern",null),U([xi()],wi.prototype,"createRadialGradient",null),U([xi()],wi.prototype,"fillText",null),U([xi()],wi.prototype,"measureText",null),U([xi()],wi.prototype,"strokeText",null);const Bi=V.get("LeaferCanvas"),Ei={width:1,height:1,pixelRatio:1};class bi extends wi{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}constructor(t,e){if(super(),t||(t=Ei),this.manager=e,this.innerId=a.create(a.CNAVAS),t.view){const{view:e}=t;let s="string"==typeof e?document.getElementById(e):e;if(s)if(s instanceof HTMLCanvasElement)this.view=s;else{if(s===window||s===document){const t=document.createElement("div"),{style:e}=t;e.position="absolute",e.top=e.bottom=e.left=e.right="0px",e.overflow="hidden",document.body.appendChild(t),s=t}this.view=document.createElement("canvas"),s.appendChild(this.view)}else Bi.error(`can't find view by id: ${e}`)}this.view||(this.view=document.createElement("canvas")),this.pixelRatio=t.pixelRatio,t.webgl||(this.context=this.view.getContext("2d"),this.smooth=!0,t.fill&&(this.view.style.backgroundColor=t.fill),t.width&&t.height&&this.resize(t),this.bindContextMethod())}debug(){}pixel(t){return t*this.pixelRatio}autoLayout(t,e){const s=s=>{const{x:i,y:o,width:n,height:r}=t.getBoundsFrom(s),{style:a}=this.view;if(a.marginLeft=i+"px",a.marginTop=o+"px",n!==this.width||r!==this.height){const{pixelRatio:t}=this,s={width:n,height:r,pixelRatio:t},i={width:this.width,height:this.height,pixelRatio:this.pixelRatio};this.resize(s),void 0!==this.width&&e(new Xt(s,i))}};this.resizeObserver=new ResizeObserver((t=>{for(const e of t)s(e.contentRect)}));const i=this.view.parentElement;i&&(this.resizeObserver.observe(i),s(i.getBoundingClientRect()))}stopAutoLayout(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0)}resize(t){const{style:e}=this.view,{width:s,height:i,pixelRatio:o}=t;if(this.isSameSize(t))return;let n;this.context&&this.width&&(n=this.getSameCanvas(),n.copy(this)),Object.assign(this,{width:s,height:i,pixelRatio:o}),this.bounds=new Y(0,0,s,i),e.width=s+"px",e.height=i+"px",this.view.width=s*o,this.view.height=i*o,this.context&&n&&(this.copy(n),n.recycle())}setWorld(t,e,s){const{pixelRatio:i}=this;if(e)if(s)this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,(t.e+e.e)*i,(t.f+e.f)*i);else{const{a:s,b:o,c:n,d:r,e:a,f:h}=e;this.setTransform((t.a*s+t.b*n)*i,(t.a*o+t.b*r)*i,(t.c*s+t.d*n)*i,(t.c*o+t.d*r)*i,(t.e*s+t.f*n+a)*i,(t.e*o+t.f*r+h)*i)}else this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i)}useSameTransform(t){this.setTransform(t.getTransform())}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&(this.strokeCap=s.strokeCap,this.strokeJoin=s.strokeJoin,this.dashPattern=s.dashPattern,this.miterLimit=s.miterLimit)}setShadow(t,e,s,i){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=s*o,this.shadowColor=i||"black"}setBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}hitPath(t,e){return this.context.isPointInPath(t.x,t.y,e)}hitStroke(t){return this.context.isPointInStroke(t.x,t.y)}replaceBy(t,e,s){t.save(),this.blendMode="copy",this.copy(t,e,s),t.restore()}copy(t,e,s,i){if(e){s||(s=e);const{pixelRatio:o}=this;i&&(this.blendMode=i),this.drawImage(t.view,e.x*o,e.y*o,e.width*o,e.height*o,s.x*o,s.y*o,s.width*o,s.height*o),i&&(this.blendMode="normal")}else this.drawImage(t.view,0,0)}copyWorldToLocal(t,e,s,i){const{pixelRatio:o}=this;i&&(this.blendMode=i),e.b||e.c?(this.save(),this.resetTransform(),this.copy(t,e,N.tempTimesMatrix(s,e)),this.restore()):this.drawImage(t.view,e.x*o,e.y*o,e.width*o,e.height*o,s.x,s.y,s.width,s.height),i&&(this.blendMode="normal")}fillBounds(t,e,s){const{pixelRatio:i}=this;s&&(this.blendMode=s),this.fillStyle=e,this.fillRect(t.x*i,t.y*i,t.width*i,t.height*i),s&&(this.blendMode="normal")}strokeBounds(t,e,s){const{pixelRatio:i}=this;s&&(this.blendMode=s),this.strokeStyle=e,this.strokeRect(t.x*i,t.y*i,t.width*i,t.height*i),s&&(this.blendMode="normal")}clearBounds(t){const{pixelRatio:e}=this;this.clearRect(t.x*e,t.y*e,t.width*e,t.height*e)}clipBounds(t){const{pixelRatio:e}=this;this.beginPath(),this.rect(t.x*e,t.y*e,t.width*e,t.height*e),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:e,height:s,pixelRatio:i}=this,o=this.manager.get({width:e,height:s,pixelRatio:i});return o.manager||(o.manager=this.manager),o.save(),t&&o.useSameTransform(this),o}getBiggerCanvas(t,e){let{width:s,height:i,pixelRatio:o}=this;t&&(s+=t),e&&(i+=e);const n=this.manager.get({width:s,height:i,pixelRatio:o});return n.manager||(n.manager=this.manager),n.save(),n}recycle(){this.restore(),this.manager.recycle(this)}destroy(){this.view&&(super.destroy(),this.stopAutoLayout(),this.manager=void 0,this.view&&this.view.parentElement&&this.view.remove(),this.view=void 0,this.bounds=void 0)}}CanvasRenderingContext2D.prototype.roundRect||(CanvasRenderingContext2D.prototype.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,o){let n,r,a,h;if(o instanceof Array)switch(o.length){case 4:n=o[0],r=o[1],a=o[2],h=o[3];break;case 2:n=a=o[0],r=h=o[1];break;case 3:n=o[0],r=h=o[1],a=o[2];break;case 1:o=o[0];break;default:o=0}if(void 0===n){if(!o)return void this.rect(t,e,s,i);n=r=a=h=o}const d=Math.min(s/2,i/2);n>d&&(n=d),r>d&&(r=d),a>d&&(a=d),h>d&&(h=d);const l=this;n?l.moveTo(t+n,e):l.moveTo(t,e),r?l.arcTo(t+s,e,t+s,e+i,r):l.lineTo(t+s,e),a?l.arcTo(t+s,e+i,t,e+i,a):l.lineTo(t+s,e+i),h?l.arcTo(t,e+i,t,e,h):l.lineTo(t,e+i),n?l.arcTo(t,e,t+s,e,n):l.lineTo(t,e),l.closePath()});class Ti{constructor(t){}destory(){}}class Ri{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Se.START,this.moveData)}t.path=this.moveData.path,e.emit(Se.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Oe.START,this.zoomData)}t.path=this.zoomData.path,e.emit(Oe.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Me.START,this.rotateData)}t.path=this.rotateData.path,e.emit(Me.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=void 0}moveEnd(){this.moveData&&(this.interaction.emit(Se.END,this.moveData),this.moveData=void 0)}zoomEnd(){this.zoomData&&(this.interaction.emit(Oe.END,this.zoomData),this.zoomData=void 0)}rotateEnd(){this.rotateData&&(this.interaction.emit(Me.END,this.rotateData),this.rotateData=void 0)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=void 0}}const Ci={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)=>Object.assign(Object.assign({},e),{list:t}),getSwipeDirection:t=>t<-45&&t>-135?De.UP:t>45&&t<135?De.DOWN:t<=45&&t>=-45?De.RIGHT:De.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:Pi.getSwipeDirection(B.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}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,s){const i=new e,{list:o}=t;for(let t=0,e=o.length;t<e;t++)o[t].hasEvent(s)&&i.push(o[t]);return i}},Pi=Ci,{getDragEventData:Li,getDropEventData:ki,getSwipeEventData:Si,filterPathByEventType:Mi}=Ci;class Di{constructor(t){this.interaction=t}setDragData(t){this.dragData=Li(t,t,t)}getDragList(){return this.dragging?ke.dragList||this.dragList:void 0}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!Te.middle(t)&&!Te.left(t))return void s.pointerCancel();const{dragData:o}=this;this.moving||(this.moving=(Te.middle(t)||be.isHoldSpaceKey())&&e,this.moving&&s.emit(Se.START,o)),this.moving||this.dragStart(t,e);const{path:n,throughPath:r}=i;this.dragData=Li(i,o,t),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.moving?s.emit(Se.MOVE,this.dragData):this.dragging&&(s.emit(Pe.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=Te.left(t)&&e,this.dragging&&(this.interaction.emit(Pe.START,this.dragData),this.dragList=Mi(this.dragData.path,Pe.DRAG),this.getDragableList(this.dragData.path)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.draggable){this.dragableList=[e];break}}dragDragableList(){if(this.dragableList){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{he.moveOfWorld(s,t,e)}))}}dropEnterOrLeave(t){const{interaction:e}=this,{dropEnterPath:s}=this,{path:i}=t;e.emit(ke.ENTER,t,i,s),e.emit(ke.LEAVE,t,s,i),this.dropEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:o}=s,n=Li(s,t,t);o&&(n.throughPath=o),n.path=i,this.moving&&e.emit(Se.END,n),this.dragging&&(e.emit(Pe.END,n),this.swipe(t,n),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(B.getDistance(i,t)>s.config.pointer.swipeDistance){const t=Si(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=ki(this.getDragList(),t);e.path=this.dropEnterPath,this.interaction.emit(ke.DROP,e),this.interaction.emit(ke.LEAVE,t,this.dropEnterPath)}dragReset(){ke.dragList=void 0,this.dragList=void 0,this.dragableList=void 0,this.dragData=void 0,this.dropEnterPath=void 0,this.dragging=void 0,this.moving=void 0}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,{autoMoveDistance:i}=e.config.pointer;if(!i)return;const o=e.shrinkCanvasBounds,{x:n,y:r}=o,a=N.right(o),h=N.bottom(o),d=t.x<n?i:a<t.x?-i:0,l=t.y<r?i:h<t.y?-i:0;let c=0,u=0;this.autoMoveTimer=setInterval((()=>{c+=d,u+=l,N.move(s,d,l),N.move(this.dragData,d,l),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:l,totalX:c,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=void 0,this.dragableList=void 0}}const{pathHasEventType:Oi}=Ci;class Ai{get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,i){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{hitRadius:5,through:!1,clickTime:120,longPressTime:800,transformTime:500,dragDistance:2,swipeDistance:20,autoMoveDistance:2}},this.clickCount=0,this.target=t,this.canvas=e,this.selector=s,this.transformer=new Ri(this),this.dragger=new Di(this),i&&(this.config=o.default(i,this.config)),this.listenEvents()}start(){this.running=!0}stop(){this.running=!1}listenEvents(){const{target:t}=this;this.eventIds=[t.on__(Xt.RESIZE,this.onResize,this)]}removeListenEvents(){this.target.off__(this.eventIds)}onResize(){this.shrinkCanvasBounds=new Y(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}pointerDown(t){this.emit(Ce.BEFORE_DOWN,t,this.selector.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getHitPointPath(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(Ce.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),Te.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){(this.downData||this.canvas.bounds.hitPoint(t))&&(this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Ce.BEFORE_MOVE,t,this.selector.defaultPath),this.downData){const e=B.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.pointerMoveIgnore)return;const e=this.selector.getHitPointPath(t,this.hitRadius,{exclude:this.dragger.getDragList()});t.path=e.path,this.emit(Ce.MOVE,t),this.pointerEnterOrLeave(t),this.dragger.dragging&&this.dragger.dropEnterOrLeave(t)}pointerUp(t){if(!this.downData)return;this.emit(Ce.BEFORE_UP,t,this.selector.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getHitPointPath(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(Ce.UP,t),this.emit(Ce.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.longTap(t),this.dragger.dragEnd(t),this.downData=void 0}pointerCancel(){this.pointerUp(this.dragger.dragData)}pointerEnterOrLeave(t){if(this.dragger.moving||this.dragger.dragging)return;const{path:e}=t;this.emit(Ce.ENTER,t,e,this.enterPath),this.emit(Ce.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Ce.LEAVE,t),this.dragger.dragging&&this.emit(ke.LEAVE,t))}tap(t){if(!this.waitTap)return;this.clickCount||this.emit(Ce.TAP,t);Date.now()-this.downTime<this.config.pointer.clickTime+50&&Oi(t.path,Ce.DOUBLE_CLICK)?(this.clickCount++,2===this.clickCount?(this.tapWaitCancel(),this.emit(Ce.DOUBLE_CLICK,t)):(clearTimeout(this.clickTimer),this.clickTimer=window.setTimeout((()=>{this.tapWaitCancel(),this.emit(Ce.CLICK,t)}),this.config.pointer.clickTime))):(this.tapWaitCancel(),this.emit(Ce.CLICK,t))}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.clickTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.clickTimer),this.waitTap=!1,this.clickCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=window.setTimeout((()=>{this.longPressed=!0,this.emit(Ce.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){this.longPressed&&this.emit(Ce.LONG_TAP,t),this.longPressWaitCancel()}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=void 0}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let o;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let n=s.length-1;n>-1;n--)if(o=s.list[n],o.hasEvent(t,!0)&&(!i||!i.has(o))){e.phase=1;const s=St.event(t,e);if(o.emitEvent(s,!0),s.isStop)return}for(let n=0,r=s.length;n<r;n++)if(o=s.list[n],o.hasEvent(t,!1)&&(!i||!i.has(o))){e.phase=o===e.target?2:3;const s=St.event(t,e);if(o.emitEvent(s),s.isStop)return}}(t,e,s,i)}destroy(){this.target&&(this.running=!1,this.removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.config=void 0,this.target=void 0,this.selector=void 0,this.canvas=void 0,this.dragger=void 0,this.transformer=void 0)}}const Wi={convert(t,e){const s=Ci.getBase(t),i=Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===i.pointerType&&(i.tangentialPressure=t.tangentialPressure,i.tiltX=t.tiltX,i.tiltY=t.tiltY,i.twist=t.twist),i},convertMouse(t,e){const s=Ci.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const s=Wi.getTouch(t),i=Ci.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:s.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Ii={getData(t,e){const s=B.getCenter(t[0],t[1]),i=B.getCenter(e[0],e[1]),o={x:i.x-s.x,y:i.y-s.y},n=B.getDistance(t[0],t[1]),r=B.getDistance(e[0],e[1])/n,a=B.getAngle(t[0],t[1]),h=B.getAngle(e[0],e[1]);return{move:o,scale:r,angle:this.getChangedAngle(a,h),center:i}},getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}};let Ni=0;const zi={getMove:(t,e)=>({x:-t.deltaX*e.moveSpeed*2,y:-t.deltaY*e.moveSpeed*2}),getScale(t,e){let s,i=1,{zoomMode:o,zoomSpeed:n}=e;const r=t.deltaY||t.deltaX;if(o){const e=t.mozInputSource&&t.deltaY%18==0;e?Ni++:Ni=0,s=(Math.floor(t.deltaY)!==t.deltaY||e&&Ni>2)&&0===t.deltaX,(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)}else s=!t.shiftKey&&(t.metaKey||t.ctrlKey);if(s){n=d.within(n,0,1);i=1-r/(25*(t.deltaY?e.delta.y:e.delta.x)*(1-n)+10),i<.5&&(i=.5),i>=1.5&&(i=1.5)}return i}},{getMoveEventData:Fi,getZoomEventData:ji,getRotateEventData:Yi}=Ci;class Xi extends Ai{listenEvents(){super.listenEvents();const t=this.view=this.canvas.view;this.onResize(),this.viewEvents={pointerdown:this.onPointerDown.bind(this),mousedown:this.onMouseDown.bind(this),touchstart:this.onTouchStart.bind(this),wheel:this.onWheel.bind(this),gesturestart:this.onGesturestart.bind(this),gesturechange:this.onGesturechange.bind(this),gestureend:this.onGestureend.bind(this)},this.windowEvents={pointermove:this.onPointerMove.bind(this),pointerup:this.onPointerUp.bind(this),pointercancel:this.onPointerCancel.bind(this),mousemove:this.onMouseMove.bind(this),mouseup:this.onMouseUp.bind(this),touchmove:this.onTouchMove.bind(this),touchend:this.onTouchEnd.bind(this),touchcancel:this.onTouchCancel.bind(this),keydown:this.onKeyDown.bind(this),keyup:this.onKeyUp.bind(this)};for(let e in this.viewEvents)t.addEventListener(e,this.viewEvents[e]);for(let t in this.windowEvents)window.addEventListener(t,this.windowEvents[t]);window.oncontextmenu=function(){return!1}}removeListenEvents(){super.removeListenEvents();for(let t in this.viewEvents)this.view.removeEventListener(t,this.viewEvents[t]),this.viewEvents={};for(let t in this.windowEvents)window.removeEventListener(t,this.windowEvents[t]),this.windowEvents={}}onResize(){super.onResize(),this.clientBounds=new Y(this.view.getBoundingClientRect())}getLocal(t){return{x:t.clientX-this.clientBounds.x,y:t.clientY-this.clientBounds.y}}onKeyDown(t){be.setDownCode(t.code)}onKeyUp(t){be.setUpCode(t.code)}onPointerDown(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||(t.preventDefault(),this.pointerDown(Wi.convert(t,this.getLocal(t))))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(Wi.convert(t,this.getLocal(t)))}onPointerUp(t){this.useMutiTouch||(t.preventDefault(),this.pointerUp(Wi.convert(t,this.getLocal(t))))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.useTouch||this.usePointer||(t.preventDefault(),this.pointerDown(Wi.convertMouse(t,this.getLocal(t))))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(Wi.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.useTouch||this.usePointer||(t.preventDefault(),this.pointerUp(Wi.convertMouse(t,this.getLocal(t))))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.mutiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=Wi.getTouch(t);this.pointerDown(Wi.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=Wi.getTouch(t);this.pointerMove(Wi.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(t.preventDefault(),this.mutiTouchEnd(),this.usePointer)return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=window.setTimeout((()=>{this.useTouch=!1}),500);const e=Wi.getTouch(t);this.pointerUp(Wi.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Ii.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Ii.getTouches(t.touches),s=e.find((t=>t.identifier===this.touches[0].identifier)),i=e.find((t=>t.identifier===this.touches[1].identifier));if(s&&i){const o=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],n=[this.getLocal(s),this.getLocal(i)],{move:r,angle:a,scale:h,center:d}=Ii.getData(o,n),l=Ci.getBase(t);this.rotate(Yi(d,a,l)),this.zoom(ji(d,h,l)),this.move(Fi(d,r,l)),this.touches=e}}}mutiTouchEnd(){this.touches=void 0,this.useMutiTouch=!1,this.transformEnd()}onWheel(t){t.preventDefault();const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):zi.getScale(t,e),i=this.getLocal(t),o=Ci.getBase(t);1!==s?this.zoom(ji(i,s,o)):this.move(Fi(i,e.getMove?e.getMove(t,e):zi.getMove(t,e),o))}onGesturestart(t){t.preventDefault(),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){t.preventDefault();const e=this.getLocal(t),s=Ci.getBase(t),i=t.scale/this.lastGestureScale,o=t.rotation-this.lastGestureRotation;let{rotateSpeed:n}=this.config.wheel;n=d.within(n,0,1),this.zoom(ji(e,i*i,s)),this.rotate(Yi(e,o/Math.PI*180*(n/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){t.preventDefault(),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=void 0,this.touches=void 0)}}function Hi(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__.__useEffect=!0,this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}}),vt(e,s,t)}}Object.assign(St,{canvas:(t,e)=>new bi(t,e),image:t=>new Ti(t),hitCanvas:(t,e)=>new bi(t,e),watcher:t=>new ei(t),layouter:t=>new pi(t),renderer:(t,e,s)=>new _i(t,e,s),selector:t=>new yi(t),interaction:(t,e,s,i)=>new Xi(t,e,s,i)}),bt.requestRender=function(t){window.requestAnimationFrame(t)},bt.canvas=St.canvas();class Gi extends r{setFill(t){"string"==typeof t?(this._fill=t,this.__isFills&&(this.__isFills=!1)):t instanceof Array?(this._fill=t,this.__isFills=!0):"object"==typeof t?(this._fill=[t],this.__isFills=!0):(this._fill=t,this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"==typeof t?(this._stroke=t,this.__isStrokes&&(this.__isStrokes=!1)):t instanceof Array?(this._stroke=t,this.__isStrokes=!0):"object"==typeof t?(this._stroke=[t],this.__isStrokes=!0):(this._stroke=t,this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this._shadow=t instanceof Array?t:[t]}setInnerShadow(t){this._innerShadow=t instanceof Array?t:[t]}}class Ui extends Gi{}const{parse:Ki}=Bs;const{copyAndSpread:Vi}=N,qi={__updateEventBounds(){Vi(this.__layout.eventBounds,this.__layout.boxBounds,this.__layout.eventBoundsSpreadWidth)},__updateRenderBounds(){Vi(this.__layout.renderBounds,this.__layout.eventBounds,this.__layout.renderBoundsSpreadWidth)},__updateEventBoundsSpreadWidth(){let t=0;const{stroke:e,strokeAlign:s}=this.__;if(e&&"inside"!==s){const{strokeWidth:e,miterLimit:i,path:o}=this.__,n=o?1/Math.sin(i*l/2)*Math.sqrt(e):0;t="center"===s?e/2:e,this.__.__strokeOuterWidth=t,n&&(t+=n-t)}return t||(this.__.__strokeOuterWidth=0),t},__updateRenderBoundsSpreadWidth(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:o}=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)})),i&&(t=Math.max(t,i));let n=t=Math.ceil(t);return s&&s.forEach((t=>{n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),o&&(n=Math.max(n,o)),this.__layout.renderShapeBoundsSpreadWidth=n,t}},Qi={__hit(t){if(this.__.fill&&this.__hitCanvas.hitPath(t,this.__.windingRule))return!0;const e=2*((this.__.__strokeOuterWidth||0)+t.radiusX);if(e){const{__hitCanvas:s}=this;if(s.strokeWidth!==e&&(s.strokeWidth=e,s.stroke()),s.hitStroke(t))return!0}return!1}},Zi={},$i={},Ji={},to={};function eo(t,e){t.forEach((t=>{e.strokeStyle=t.style,e.stroke()}))}var so=Object.freeze({__proto__:null,fill:function(t,e,s){e.fillStyle=s,e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:o}=t.__;for(let t=0,n=s.length;t<n;t++)i=s[t],e.fillStyle=i.style,e.fill(o)},stroke:function(t,e,s){const i=t.__,{strokeWidth:o,strokeAlign:n}=i;switch(n){case"center":e.setStroke(void 0,o,i),e.strokeStyle=s,e.stroke();break;case"inside":e.save(),e.setStroke(void 0,2*o,i),e.clip(i.windingRule),e.strokeStyle=s,e.stroke(),e.restore();break;case"outside":const n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*o,t.__),n.strokeStyle=s,n.stroke(),n.clip(i.windingRule),n.clearBounds(t.__layout.renderBounds),e.copyWorldToLocal(n,t.__world,t.__layout.renderBounds),n.recycle()}},strokes:function(t,e,s){const i=t.__,{strokeWidth:o,strokeAlign:n}=i;switch(n){case"center":e.setStroke(void 0,o,i),eo(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*o,i),e.clip(i.windingRule),eo(s,e),e.restore();break;case"outside":const{renderBounds:n}=t.__layout,r=e.getSameCanvas(!0);t.__drawRenderPath(r),r.setStroke(void 0,2*o,t.__),eo(s,r),r.clip(i.windingRule),r.clearBounds(n),e.copyWorldToLocal(r,t.__world,n),r.recycle()}}});Object.assign($i,so);const io={__updateChange(){let t=this.__;t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?this.__complex=!0:this.__complex&&(this.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&$i.fill(this,t,s),i&&$i.stroke(this,t,i)},__draw(t,e){const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&(this.__.__isFills?$i.fills(this,t,s):$i.fill(this,t,s)),i&&(this.__.__isStrokes?$i.strokes(this,t,i):$i.stroke(this,t,i))}},oo={__render(t,e){const{fill:s,stroke:i}=this.__;i&&(this.__.stroke=void 0),this.__renderRect(t,e);const{clip:o}=this.__;o?(t.save(),t.clip(),this.__renderGroup(t,e),t.restore()):this.__renderGroup(t,e),i&&(this.__.stroke=i,s&&(this.__.fill=void 0),this.__renderRect(t,e),s&&(this.__.fill=s))}},no={__drawFast(t,e){const{width:s,height:i,fill:o,stroke:n}=this.__;if(o&&(t.fillStyle=o,t.fillRect(0,0,s,i)),n){const{strokeAlign:e,strokeWidth:o}=this.__;t.setStroke(n,o,this.__);const r=o/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(r,r,s-o,i-o);break;case"outside":t.strokeRect(-r,-r,s+o,i+o)}}}},ro={__drawFast(t,e){const{fill:s,stroke:i,content:o,__font:n}=this.__;t.font=n,s&&(t.fillStyle=s,t.fillText(o,0,0)),i&&(t.strokeStyle=i,t.strokeText(o,0,0))}};ro.__draw=ro.__drawFast;let ao=class extends ae{get worldTransform(){return this.__layout.getTransform("world")}get relativeTransform(){return this.__layout.getTransform("relative")}get worldBoxBounds(){return this.__layout.getBounds("world","box")}get worldRenderBounds(){return this.__layout.getBounds("world","render")}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?Ws.smoothCorner(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){}};U([_t(Gi)],ao.prototype,"__",void 0),U([it("")],ao.prototype,"id",void 0),U([it("")],ao.prototype,"name",void 0),U([it("")],ao.prototype,"className",void 0),U([ut(1)],ao.prototype,"opacity",void 0),U([ut(!0)],ao.prototype,"visible",void 0),U([pt(0)],ao.prototype,"zIndex",void 0),U([ot(0)],ao.prototype,"x",void 0),U([ot(0)],ao.prototype,"y",void 0),U([at(100)],ao.prototype,"width",void 0),U([at(100)],ao.prototype,"height",void 0),U([nt(1)],ao.prototype,"scaleX",void 0),U([nt(1)],ao.prototype,"scaleY",void 0),U([rt(0)],ao.prototype,"rotation",void 0),U([rt(0)],ao.prototype,"skewX",void 0),U([rt(0)],ao.prototype,"skewY",void 0),U([ct()],ao.prototype,"blendMode",void 0),U([at()],ao.prototype,"mask",void 0),U([it()],ao.prototype,"locked",void 0),U([ct()],ao.prototype,"fill",void 0),U([dt()],ao.prototype,"stroke",void 0),U([dt("center")],ao.prototype,"strokeAlign",void 0),U([dt(1)],ao.prototype,"strokeWidth",void 0),U([ct("none")],ao.prototype,"strokeCap",void 0),U([ct("miter")],ao.prototype,"strokeJoin",void 0),U([ct()],ao.prototype,"dashPattern",void 0),U([ct()],ao.prototype,"dashOffset",void 0),U([ct(10)],ao.prototype,"miterLimit",void 0),U([ht()],ao.prototype,"cornerRadius",void 0),U([ht()],ao.prototype,"cornerSmoothing",void 0),U([Hi()],ao.prototype,"shadow",void 0),U([Hi()],ao.prototype,"innerShadow",void 0),U([Hi()],ao.prototype,"blur",void 0),U([Hi()],ao.prototype,"backgroundBlur",void 0),U([Hi()],ao.prototype,"grayscale",void 0),U([xt(Ws.drawData)],ao.prototype,"__drawPathByData",null),ao=U([Et(qi),Et(Qi),Et(io),wt()],ao);let ho=class extends ao{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){}};U([_t(Ui)],ho.prototype,"__",void 0),ho=U([Et(Be),Mt()],ho);let lo=class extends ao{constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:o}=this.__;o?t.roundRect(0,0,s,i,o):t.rect(0,0,s,i)}};U([_t(class extends Gi{})],lo.prototype,"__",void 0),lo=U([Et(no),Mt()],lo);const co=lo.prototype,uo=ho.prototype,po={},{copy:_o,add:go}=N;let vo=class extends ho{constructor(t){super(t),this.fill||(this.fill="#FFFFFF"),this.__isBranchLeaf=!0}__drawPathByData(t,e){}__updateBoxBounds(){if(this.__updateRectBoxBounds(),!this.__.clip){const{boxBounds:t}=this.__layout;_o(po,t),super.__updateBoxBounds(),go(t,po)}}__updateEventBounds(){if(this.__updateRectEventBounds(),!this.__.clip){const{eventBounds:t}=this.__layout;_o(po,t),super.__updateEventBounds(),go(t,po)}}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.clip){const{renderBounds:t}=this.__layout;_o(po,t),super.__updateRenderBounds(),go(t,po)}}__updateRectBoxBounds(){}__updateRectEventBounds(){}__updateRectRenderBounds(){}__renderRect(t,e){}__renderGroup(t,e){}};U([_t(class extends Ui{})],vo.prototype,"__",void 0),U([at(!0)],vo.prototype,"clip",void 0),U([xt(co.__drawPathByData)],vo.prototype,"__drawPathByData",null),U([xt(co.__updateBoxBounds)],vo.prototype,"__updateRectBoxBounds",null),U([xt(co.__updateEventBounds)],vo.prototype,"__updateRectEventBounds",null),U([xt(co.__updateRenderBounds)],vo.prototype,"__updateRectRenderBounds",null),U([xt(co.__render)],vo.prototype,"__renderRect",null),U([xt(uo.__render)],vo.prototype,"__renderGroup",null),vo=U([Et(oo),wt(),Mt()],vo);const{PI:yo}=Math,{begin:fo,moveTo:mo,close:xo,ellipse:wo}=Vs;let Bo=class extends ao{constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:o}=this.__,n=t/2,r=e/2;fo(this.__.path=[]),s?i||o?(wo(n,r,n*(1-s),r*(1-s),0,i*l,o*l,!1),wo(n,r,n,r,0,o*l,i*l,!0),xo()):(wo(n,r,n*(1-s),r*(1-s),0,0,2*yo,!1),mo(t,r),wo(n,r,n,r,0,0,2*yo,!0)):i||o?(mo(n,r),wo(n,r,n,r,0,i*l,o*l,!1),xo()):wo(n,r,n,r,0,0,2*yo,!1)}};U([_t(class extends Gi{})],Bo.prototype,"__",void 0),U([ht(0)],Bo.prototype,"innerRadius",void 0),U([ht(0)],Bo.prototype,"startAngle",void 0),U([ht(0)],Bo.prototype,"endAngle",void 0),Bo=U([Mt()],Bo);const{sin:Eo,cos:bo,PI:To}=Math,{begin:Ro,moveTo:Co,lineTo:Po,close:Lo}=Vs;let ko=class extends ao{constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,o=e/2;Ro(this.__.path=[]),Co(i,0);for(let t=1;t<s;t++)Po(i+i*Eo(2*t*To/s),o-o*bo(2*t*To/s));Lo()}};U([_t(class extends Gi{})],ko.prototype,"__",void 0),U([ht(3)],ko.prototype,"sides",void 0),ko=U([Mt()],ko);const{sin:So,cos:Mo,PI:Do}=Math,{begin:Oo,moveTo:Ao,lineTo:Wo,close:Io}=Vs;let No=class extends ao{constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,o=t/2,n=e/2;Oo(this.__.path=[]),Ao(o,0);for(let t=1;t<2*s;t++)Wo(o+(t%2==0?o:o*i)*So(t*Do/s),n-(t%2==0?n:n*i)*Mo(t*Do/s));Io()}};U([_t(class extends Gi{})],No.prototype,"__",void 0),U([ht(5)],No.prototype,"points",void 0),U([ht(.38)],No.prototype,"innerRadius",void 0),No=U([Mt()],No);const{begin:zo,moveTo:Fo,lineTo:jo,end:Yo}=Vs,{rotate:Xo,getAngle:Ho,getDistance:Go,defaultPoint:Uo}=B,{setPoint:Ko,addPoint:Vo,toBounds:qo}=R,Qo={};let Zo=class extends ao{get toPoint(){if(this.__toPoint&&!this.__layout.boxBoundsChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Xo(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Go(Uo,t),this.rotation=Ho(Uo,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){zo(this.__.path=[]),Fo(0,0);const t=this.toPoint;jo(t.x,t.y),Yo()}__updateBoxBounds(){Ko(Qo,0,0),Vo(Qo,this.__toPoint.x,this.__toPoint.y),qo(Qo,this.__layout.boxBounds)}};U([_t(class extends Gi{})],Zo.prototype,"__",void 0),U([at()],Zo.prototype,"rotation",void 0),Zo=U([Mt()],Zo);const{toTwoPointBounds:$o}=Ws,{toBounds:Jo}=R,tn={};let en=class extends ao{constructor(t){super(t)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__updateBoxBounds(){$o(this.__.path,tn),Jo(tn,this.__layout.boxBounds)}};U([_t(class extends Gi{setPath(t){this._path="string"==typeof t?Ki(t):t}})],en.prototype,"__",void 0),U([ht()],en.prototype,"path",void 0),U([ht()],en.prototype,"windingRule",void 0),en=U([Mt()],en);let sn=class extends ho{constructor(t){super(t)}__updatePath(){}};U([_t(class extends Gi{})],sn.prototype,"__",void 0),U([ht()],sn.prototype,"paths",void 0),sn=U([Mt()],sn);let on=class extends ao{constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i}=this.__;t.rect(0,0,s,i)}__updateBoxBounds(){const{fontFamily:t,fontSize:e,fontWeight:s,italic:i,textCase:o,lineHeight:n}=this.__,r=this.__layout.boxBounds;this.__.__font=bt.canvas.font=`${i?"italic":""} ${"small-caps"===o?"small-caps":"normal"} ${s||"normal"} ${e}px/${n||e}px ${t}`;const a=bt.canvas.measureText(this.content).width,h=e;r.x=0,r.y=.75*-e,r.width=a,r.height=h}};U([_t(class extends Gi{})],on.prototype,"__",void 0),U([at("")],on.prototype,"content",void 0),U([at("arial")],on.prototype,"fontFamily",void 0),U([at(12)],on.prototype,"fontSize",void 0),U([at("normal")],on.prototype,"fontWeight",void 0),U([at(!1)],on.prototype,"italic",void 0),U([at("normal")],on.prototype,"textCase",void 0),U([at("normal")],on.prototype,"textDecoration",void 0),U([at()],on.prototype,"letterSpacing",void 0),U([at()],on.prototype,"lineHeight",void 0),U([at()],on.prototype,"paragraphIndent",void 0),U([at()],on.prototype,"paragraphSpacing",void 0),on=U([Et(ro),Mt()],on);let nn=class extends lo{constructor(t){super(t)}};U([_t(class extends Gi{})],nn.prototype,"__",void 0),U([at("")],nn.prototype,"url",void 0),U([at("")],nn.prototype,"thumb",void 0),nn=U([Mt()],nn);let rn=class extends ho{get isSupperLeafer(){return!1}constructor(e,s){var o;super(),this.config={zoom:!0,move:!0,start:!0,pixelRatio:devicePixelRatio},this.__eventIds=[],this.creator=St;const{config:n}=this;this.__setAsLeafer(),this.__setConfig(e),this.canvas=St.canvas(n),this.renderer=St.renderer(this,this.canvas,n),this.isSupperLeafer?this.__level=1:(this.watcher=St.watcher(this),this.layouter=St.layouter(this)),this.__checkAutoLayout(n),s?(null===(o=s.selector)||void 0===o||o.defaultPath.unshift(this),this.selector=s.selector,this.interaction=s.interaction,this.canvasManager=s.canvasManager,this.hitCanvasManager=s.hitCanvasManager,this.imageManager=s.imageManager,s.running&&setTimeout(this.start.bind(this))):(this.selector=St.selector(this),this.interaction=St.interaction(this,this.canvas,this.selector,n),this.canvasManager=new t(this),this.hitCanvasManager=new i(this),this.imageManager=new We(this,n),n.start&&setTimeout(this.start.bind(this))),this.canvasManager.add(this.canvas),this.__listenEvents()}__listenEvents(){this.once(Ut.END,this.__setAsRoot.bind(this))}__removeListenEvents(){this.off__(this.__eventIds)}__setConfig(t){t&&(this.config=o.default(t,this.config))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new X(t),this.canvas.autoLayout(this.autoLayout,this.__onResize.bind(this)))}start(){var t;this.running||(this.__interactiveWindow(),null===(t=this.interaction)||void 0===t||t.start(),this.renderer.start(),this.layouter.start(),this.watcher.start(),this.running=!0)}stop(){var t;this.running&&(null===(t=this.interaction)||void 0===t||t.stop(),this.watcher.stop(),this.layouter.stop(),this.renderer.stop(),this.running=!1)}__interactiveWindow(){const{zoom:t,move:e}=this.config;if(e){const{MOVE:e}=Se,{ZOOM:s}=Oe;this.hasEvent(e)||this.__eventIds.push(this.on__(e,(t=>{he.moveOfWorld(this,t.moveX,t.moveY)}))),t&&!this.hasEvent(s)&&this.__eventIds.push(this.on__(s,(t=>{he.zoomOfWorld(this,t.scale,t)})))}}resize(t){if(this.canvas.isSameSize(t))return;const{width:e,height:s,pixelRatio:i}=this.canvas,o={width:e,height:s,pixelRatio:i};this.canvas.resize(t),this.__onResize(new Xt(t,o))}__onResize(t){this.emitEvent(t),setTimeout((()=>{this.canvasManager.clearRecycled()}),0)}destory(){var t;this.canvas&&(super.destroy(),this.__removeListenEvents(),this.parent||(null===(t=this.interaction)||void 0===t||t.destroy(),this.selector.destroy(),this.renderer.destroy(),this.watcher.destroy(),this.layouter.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory()),this.canvas.destroy(),this.canvas=void 0,this.creator=void 0,this.config=void 0,this.interaction=void 0,this.selector=void 0,this.renderer=void 0,this.watcher=void 0,this.layouter=void 0,this.canvasManager=void 0,this.hitCanvasManager=void 0,this.imageManager=void 0,this.zoomLayer=void 0,this.moveLayer=void 0,this.parent=void 0)}};function an(){return(t,e)=>{const s={get(){return this.canvas[e]},set(t){const{width:s,height:i,pixelRatio:o}=this.canvas,n={width:s,height:i,pixelRatio:o};n[e]=t,this.resize(n)}};Object.defineProperty(t,e,s)}}U([an()],rn.prototype,"width",void 0),U([an()],rn.prototype,"height",void 0),U([an()],rn.prototype,"pixelRatio",void 0),rn=U([Mt()],rn);let hn=class extends rn{constructor(){super(...arguments),this.children=[]}get isSupperLeafer(){return!0}start(){this.running||(this.children.forEach((t=>{t.start()})),this.running=!1)}stop(){this.running&&(this.children.forEach((t=>{t.stop()})),this.running=!1)}addLeafer(t){const e=new rn(this.__getChildConfig(t),this);return this.add(e),this.__eventIds.push(e.on__(Kt.END,this.renderer.start,this.renderer)),e}__render(t,e){this.children.forEach((e=>{t.copy(e.canvas)}))}__onResize(t){this.emitEvent(t),this.children.forEach((e=>{e.resize(t)}))}__getChildConfig(t){let e=Object.assign({},this.config);return(t=t?o.default(t,e):e).view=void 0,this.autoLayout&&(t.width=this.width,t.height=this.height,t.pixelRatio=this.pixelRatio),t}destory(){this.children.length&&(super.destory(),this.children.forEach((t=>{t.destory()})),this.children.length=0)}};hn=U([Mt()],hn);export{Ji as Animate,jt as AttrEvent,X as AutoBounds,Je as BezierHelper,Y as Bounds,N as BoundsHelper,Be as Branch,_e as BranchHelper,t as CanvasManager,Ft as ChildEvent,St as Creator,o as DataHelper,V as Debug,Pe as DragEvent,ke as DropEvent,Zi as Effect,Bo as Ellipse,zt as Event,Rt as EventCreator,to as Export,vo as Frame,oo as FrameRender,ho as Group,i as HitCanvasManager,nn as Image,We as ImageManager,a as IncrementId,Xi as Interaction,Ae as KeyEvent,be as Keyboard,Ut as LayoutEvent,pi as Layouter,ae as Leaf,te as LeafBounds,pe as LeafBoundsHelper,r as LeafData,Vt as LeafDataProxy,It as LeafEventer,he as LeafHelper,ie as LeafHit,s as LeafLevelList,e as LeafList,$t as LeafMatrix,oe as LeafRender,rn as Leafer,bi as LeaferCanvas,Ti as LeaferImage,Zo as Line,d as MathHelper,T as Matrix,p as MatrixHelper,Se as MoveEvent,Ye as NumberPathCommandLengthMap,je as NumberPathCommandMap,l as OneRadian,$i as Paint,en as Path,Ie as PathCommandMap,ze as PathCommandNeedConvertMap,Bs as PathConvert,Vs as PathCreator,Ws as PathHelper,bt as Platform,Qs as Plugin,b as Point,B as PointHelper,Te as PointerButton,Ce as PointerEvent,ko as Polygon,lo as Rect,no as RectRender,Kt as RenderEvent,_i as Renderer,Xt as ResizeEvent,Me as RotateEvent,$ as Run,yi as Selector,No as Star,G as StringNumberMap,hn as SuperLeafer,De as SwipeEvent,$s as TaskItem,ti as TaskProcessor,on as Text,ro as TextRender,Ht as TransformEvent,H as TwoPointBounds,R as TwoPointBoundsHelper,ao as UI,qi as UIBounds,Lt as UICreator,Re as UIEvent,Qi as UIHit,io as UIRender,sn as Vector,Gt as WatchEvent,ei as Watcher,Oe as ZoomEvent,dt as affectEventBoundsType,lt as affectRenderBoundsType,st as aliasType,at as boundsType,_t as dataProcessor,it as dataType,vt as defineDataProcessor,tt as defineKey,Hi as effectType,et as getDescriptor,gt as layoutProcessor,ut as opacityType,ht as pathType,ot as positionType,Dt as registerEvent,Mt as registerUI,xt as rewrite,wt as rewriteAble,rt as rotationType,nt as scaleType,pt as sortType,ct as surfaceType,Et as useModule,Zs as usePlugin};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|