@leafer-ui/node 1.0.0-rc.6 → 1.0.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{LeafList as t,DataHelper as e,RenderEvent as i,ChildEvent as s,WatchEvent as n,PropertyEvent as a,LeafHelper as r,BranchHelper as o,Bounds as h,LeafBoundsHelper as d,BoundsHelper as l,Debug as c,LeafLevelList as u,LayoutEvent as f,Run as _,ImageManager as g,Platform as p,AnimateEvent as y,ResizeEvent as w,Creator as m,LeaferCanvasBase as v,canvasPatch as x,LeaferImage as B,InteractionBase as b,FileHelper as R,MatrixHelper as E,ImageEvent as L,PointHelper as k,MathHelper as S,TaskProcessor as M}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{writeFileSync as A}from"fs";import{ColorConvert as C,ImageManager as O,Paint as T,Effect as I,TextConvert as W,Export as D}from"@leafer-ui/core";export*from"@leafer-ui/core";function P(t,e,i,s){return new(i||(i=Promise))((function(n,a){function r(t){try{h(s.next(t))}catch(t){a(t)}}function o(t){try{h(s.throw(t))}catch(t){a(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,o)}h((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class F{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t;return this.__updatedList.list.forEach((t=>{t.leafer&&e.push(t)})),e}return this.__updatedList}constructor(i,s){this.totalTimes=0,this.config={},this.__updatedList=new t,this.target=i,s&&(this.config=e.default(s,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(i.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===s.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.push(t.parent)),this.update()}__pushChild(t){this.__updatedList.push(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new n(n.DATA,{updatedList:this.updatedList})),this.__updatedList=new t,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(a.CHANGE,this.__onAttrChange,this),t.on_([s.ADD,s.REMOVE],this.__onChildEvent,this),t.on_(n.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllWorldMatrix:N,updateAllWorldOpacity:U}=r,{pushAllChildBranch:Y,pushAllParent:H}=o;const{worldBounds:V}=d,{setByListWithHandle:j}=l;class q{constructor(e){this.updatedBounds=new h,this.beforeBounds=new h,this.afterBounds=new h,e instanceof Array&&(e=new t(e)),this.updatedList=e}setBefore(){j(this.beforeBounds,this.updatedList.list,V)}setAfter(){j(this.afterBounds,this.updatedList.list,V),this.updatedBounds.setByList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:G,updateAllChange:X}=r,{pushAllBranchStack:z,updateWorldBoundsByBranchStack:Q}=o,Z=c.get("Layouter");class K{constructor(t,i){this.totalTimes=0,this.config={},this.__levelList=new u,this.target=t,i&&(this.config=e.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(f.START),this.layoutOnce(),t.emitEvent(new f(f.END,this.layoutedBlocks,this.times))}catch(t){Z.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Z.warn("layouting"):this.times>3?Z.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(n.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=_.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:r}=f,o=this.getBlocks(s);o.forEach((t=>{t.setBefore()})),i.emitEvent(new f(n,o,this.times)),s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(N(t),e.push(t),t.isBranch&&Y(t,e),H(t,e)):i.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),H(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&&U(t),t.__updateChange()}))}(s),o.forEach((t=>t.setAfter())),i.emitEvent(new f(a,o,this.times)),i.emitEvent(new f(r,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,_.end(e)}fullLayout(){const e=_.start("FullLayout"),{target:i}=this,{BEFORE:s,LAYOUT:n,AFTER:a}=f,r=this.getBlocks(new t(i));i.emitEvent(new f(s,r,this.times)),K.fullLayout(i),r.forEach((t=>{t.setAfter()})),i.emitEvent(new f(n,r,this.times)),i.emitEvent(new f(a,r,this.times)),this.addBlocks(r),_.end(e)}static fullLayout(t){if(G(t),t.isBranch){const e=[t];z(t,e),Q(e)}else t.__updateWorldBounds();X(t)}createBlock(t){return new q(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(f.REQUEST,this.layout,this),t.on_(f.AGAIN,this.layoutAgain,this),t.on_(n.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const $=c.get("Renderer");class J{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,i,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=i,s&&(this.config=e.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(f.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new h,$.log(e.innerName,"---\x3e");try{this.emitRender(i.START),this.renderOnce(t),this.emitRender(i.END,this.totalBounds),g.clearRecycled()}catch(t){this.rendering=!1,$.error(t)}$.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?$.warn("rendering"):this.times>3?$.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new h,this.renderOptions={},t?(this.emitRender(i.BEFORE),t()):(this.requestLayout(),this.emitRender(i.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(i.RENDER,this.renderBounds,this.renderOptions),this.emitRender(i.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return $.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=_.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=t.includes(this.target.__world),a=(new h).copy(s);i.save(),n&&!c.showRepaint?i.clear():(s.spread(1+1/this.canvas.pixelRatio).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0)),this.__render(s,n,a),i.restore(),_.end(e)}fullRender(){const t=_.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),_.end(t)}__render(t,e,i){const s=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),c.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=i||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),c.showHitView&&this.renderHitView(s),c.showBoundsView&&this.renderBoundsView(s),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new h;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();p.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(y.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:i}=t.old;new h(0,0,e,i).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||$.warn(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new i(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(i.REQUEST,this.update,this),t.on_(f.END,this.__onLayoutEnd,this),t.on_(i.AGAIN,this.renderAgain,this),t.on_(w.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:tt}=l;class et{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const a=this.findList,r=this.getBestMatchLeaf(),o=n?this.getPath(r):this.getHitablePath(r);return this.clear(),s?{path:o,leaf:r,throughPath:a.length?this.getThroughPath(a):o}:{path:o,leaf:r}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:i,y:s}=this.point,n={x:i,y:s,radiusX:0,radiusY:0};for(let i=0,s=t.length;i<s;i++)if(e=t[i],r.worldHittable(e)&&(this.hitChild(e,n),this.findList.length))return this.findList[0]}return t[0]}getPath(e){const i=new t;for(;e;)i.push(e),e=e.parent;return i.push(this.target),i}getHitablePath(e){const i=this.getPath(e);let s,n=new t;for(let t=i.list.length-1;t>-1&&(s=i.list[t],s.__.hittable)&&(n.unshift(s),s.__.hitChildren);t--);return n}getThroughPath(e){const i=new t,s=[];for(let t=e.length-1;t>-1;t--)s.push(this.getPath(e[t]));let n,a,r;for(let t=0,e=s.length;t<e;t++){n=s[t],a=s[t+1];for(let t=0,e=n.length;t<e&&(r=n.list[t],!a||!a.has(r));t++)i.push(r)}return i}eachFind(t,e){let i,s;const{point:n}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.isMask||(s=!!i.__.hitRadius||tt(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&!this.findList.length&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class it{constructor(t,i){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?this.idMap[e]=t:0,innerId:(t,e)=>t.innerId===e?this.innerIdMap[e]=t:0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0},this.target=t,i&&(this.config=e.default(i,this.config)),this.pather=new et(t,this),this.__listenEvents()}getByPoint(t,e,i){return"node"===p.name&&this.target.emit(f.CHECK_UPDATE),this.pather.getByPoint(t,e,i)}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":const s=this.getById(t.substring(1),e);return i?s:s?[s]:[];case".":return this.getByMethod(this.methods.className,e,i,t.substring(1));default:return this.getByMethod(this.methods.tag,e,i,t)}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&r.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n;for(let a=0,r=t.length;a<r;a++){if(n=t[a],e(n,s)){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(s.REMOVE,this.__onRemoveChild,this),this.target.on_(a.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.pather.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(m,{watcher:(t,e)=>new F(t,e),layouter:(t,e)=>new K(t,e),renderer:(t,e,i)=>new J(t,e,i),selector:(t,e)=>new it(t,e)}),p.layout=K.fullLayout;class st extends v{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),p.roundRectPatch&&(this.context.__proto__.roundRect=null,x(this.context.__proto__))}__createView(){this.view=p.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=t*i,this.view.height=e*i,this.clientBounds=this.bounds}}const{mineType:nt,fileType:at}=R;function rt(t,e){if(p.canvasType=t,!p.origin){if("skia"===t){const{Canvas:t,loadImage:i}=e;p.origin={createCanvas:(e,i,s)=>new t(e,i,s),canvasToDataURL:(t,e,i)=>t.toDataURLSync(e,{quality:i}),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>t.saveAs(e,{quality:i}),loadImage:i},p.roundRectPatch=!0}else if("napi"===t){const{Canvas:t,loadImage:i}=e;p.origin={createCanvas:(e,i,s)=>new t(e,i,s),canvasToDataURL:(t,e,i)=>t.toDataURL(nt(e),i),canvasToBolb:(t,e,i)=>P(this,void 0,void 0,(function*(){return t.toBuffer(nt(e),i)})),canvasSaveAs:(t,e,i)=>P(this,void 0,void 0,(function*(){return A(e,t.toBuffer(nt(at(e)),i))})),loadImage:i}}p.ellipseToCurve=!0,p.event={stopDefault(t){},stopNow(t){},stop(t){}},p.canvas=m.canvas()}}Object.assign(m,{canvas:(t,e)=>new st(t,e),image:t=>new B(t),hitCanvas:(t,e)=>new st(t,e),interaction:(t,e,i,s)=>new b(t,e,i,s)}),p.name="node",p.requestRender=function(t){setTimeout(t)},p.devicePixelRatio=1,p.conicGradientSupport=!0,p.realtimeLayout=!0;const{get:ot,rotateOfOuter:ht,translate:dt,scaleOfOuter:lt,scale:ct,rotate:ut}=E;const{get:ft,translate:_t}=E;function gt(t,e,i,s){let{width:n,height:a}=e;const{opacity:r,mode:o,offset:h,scale:d,rotation:l,blendMode:c}=i,u=s.width===n&&s.height===a;c&&(t.blendMode=c);const f=t.data={mode:o};switch(o){case"strench":u||(n=s.width,a=s.height),(s.x||s.y)&&(f.transform=ft(),_t(f.transform,s.x,s.y));break;case"clip":(h||d||l)&&function(t,e,i,s,n){const a=ot();dt(a,e.x,e.y),i&&dt(a,i.x,i.y),s&&("number"==typeof s?ct(a,s):ct(a,s.x,s.y),t.scaleX=a.a,t.scaleY=a.d),n&&ut(a,n),t.transform=a}(f,s,h,d,l);break;case"repeat":(!u||d||l)&&function(t,e,i,s,n,a){const r=ot();if(a)switch(ut(r,a),a){case 90:dt(r,s,0);break;case 180:dt(r,i,s);break;case 270:dt(r,0,i)}dt(r,e.x,e.y),n&&(lt(r,e,n),t.scaleX=t.scaleY=n),t.transform=r}(f,s,n,a,d,l);break;default:u&&!l||function(t,e,i,s,n,a){const r=ot(),o=a&&180!==a,h=i.width/(o?n:s),d=i.height/(o?s:n),l="fit"===e?Math.min(h,d):Math.max(h,d),c=i.x+(i.width-s*l)/2,u=i.y+(i.height-n*l)/2;dt(r,c,u),ct(r,l),a&&ht(r,{x:i.x+i.width/2,y:i.y+i.height/2},a),t.scaleX=t.scaleY=l,t.transform=r}(f,o,s,n,a,l)}f.width=n,f.height=a,r&&(f.opacity=r)}function pt(t,e,i){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=i.width,e.__naturalHeight=i.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),!1}return!0}function yt(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new L(t,e))}const{get:wt,scale:mt,copy:vt}=E;function xt(t,e,i){let{scaleX:s,scaleY:n}=t.__world;const a=s+"-"+n;if(e.patternId===a||t.destroyed)return!1;{e.patternId=a,s=Math.abs(s),n=Math.abs(n);const{image:t,data:r}=e,o=t.isSVG?4096:Math.min(t.width,4096),h=t.isSVG?4096:Math.min(t.height,4096);let d,l,{width:c,height:u,scaleX:f,scaleY:_,opacity:g,transform:y,mode:w}=r;f&&(l=wt(),vt(l,y),mt(l,1/f,1/_),s*=f,n*=_),s*=i,n*=i,c*=s,u*=n,(c>o||u>h)&&(d=Math.max(c/o,u/h)),d&&(s/=d,n/=d,c/=d,u/=d),f&&(s/=f,n/=_),(y||1!==s||1!==n)&&(l||(l=wt(),y&&vt(l,y)),mt(l,1/s,1/n));const m=p.canvas.createPattern(t.getCanvas(c<1?1:c,u<1?1:u,g),"repeat"===w?"repeat":p.origin.noRepeat||"no-repeat");try{e.transform&&(e.transform=null),l&&(m.setTransform?m.setTransform(l):e.transform=l)}catch(t){e.transform=l}return e.style=m,!0}}function Bt(t,e,i,s){const{scaleX:n,scaleY:a}=t.__world;if(i.data&&i.patternId!==n+"-"+a){if(s)if(i.image.isSVG&&"repeat"!==i.data.mode){let{width:t,height:r}=i.data;t*=n*e.pixelRatio,r*=a*e.pixelRatio,s=t>4096||r>4096}else s=!1;if(s){e.save(),e.clip();const{data:t}=i;return i.blendMode&&(e.blendMode=i.blendMode),t.opacity&&(e.opacity*=t.opacity),t.transform&&e.transform(t.transform),e.drawImage(i.image.view,0,0,t.width,t.height),e.restore(),!0}return i.style?i.patternTask||(i.patternTask=g.patternTasker.add((()=>P(this,void 0,void 0,(function*(){i.patternTask=null,e.bounds.hit(t.__world)&&xt(t,i,e.pixelRatio),t.forceUpdate("surface")}))),300)):xt(t,i,e.pixelRatio),!1}return!1}function bt(t,e){const i="fill"===t?e._fill:e._stroke;if(i instanceof Array){let s,n,a,r;for(let o=0,h=i.length;o<h;o++)s=i[o].image,r=s&&s.url,r&&(n||(n={}),n[r]=!0,g.recycle(s),s.loading&&(a||(a=e.__input&&e.__input[t]||[],a instanceof Array||(a=[a])),s.unload(i[o].loadId,!a.some((t=>t.url===r)))));return n}return null}function Rt(t,e){let i;const{rows:s,decorationY:n,decorationHeight:a}=t.__.__textDrawData;for(let t=0,r=s.length;t<r;t++)i=s[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),n&&e.fillRect(i.x,i.y+n,i.width,a)}function Et(t,e,i,s){const{strokeAlign:n}=e.__,a="string"!=typeof t;switch(n){case"center":i.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?St(t,!0,e,i):kt(e,i);break;case"inside":Lt("inside",t,a,e,i,s);break;case"outside":Lt("outside",t,a,e,i,s)}}function Lt(t,e,i,s,n,a){const{strokeWidth:r,__font:o}=s.__,h=n.getSameCanvas(!0);h.setStroke(i?void 0:e,2*r,s.__),h.font=o,i?St(e,!0,s,h):kt(s,h),h.blendMode="outside"===t?"destination-out":"destination-in",Rt(s,h),h.blendMode="normal",s.__hasMirror||a.matrix?n.copyWorldByReset(h):n.copyWorldToInner(h,s.__world,s.__layout.renderBounds),h.recycle()}function kt(t,e){let i;const{rows:s,decorationY:n,decorationHeight:a}=t.__.__textDrawData;for(let t=0,r=s.length;t<r;t++)i=s[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)})),n&&e.strokeRect(i.x,i.y+n,i.width,a)}function St(t,e,i,s){let n;for(let a=0,r=t.length;a<r;a++)n=t[a],n.image&&Bt(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?kt(i,s):s.stroke(),s.restoreBlendMode()):e?kt(i,s):s.stroke())}const{getSpread:Mt,getOuterOf:At,getByMove:Ct,getIntersectData:Ot}=l;const Tt={x:.5,y:0},It={x:.5,y:1};function Wt(t,e,i){let s;for(let n=0,a=e.length;n<a;n++)s=e[n],t.addColorStop(s.offset,C.string(s.color,i))}const{set:Dt,getAngle:Pt,getDistance:Ft}=k,{get:Nt,rotateOfOuter:Ut,scaleOfOuter:Yt}=E,Ht={x:.5,y:.5},Vt={x:.5,y:1},jt={},qt={};const{set:Gt,getAngle:Xt,getDistance:zt}=k,{get:Qt,rotateOfOuter:Zt,scaleOfOuter:Kt}=E,$t={x:.5,y:.5},Jt={x:.5,y:1},te={},ee={};let ie;function se(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=i.__layout;switch(e.type){case"solid":let{type:n,blendMode:a,color:r,opacity:o}=e;return{type:n,blendMode:a,style:C.string(r,o)};case"image":return function(t,e,i,s,n){const a={type:i.type},r=a.image=g.get(i),o=(n||r.loading)&&{target:t,image:r,attrName:e,attrValue:i};return r.ready?(pt(t,e,r)&&gt(a,r,i,s),n&&(yt(L.LOAD,o),yt(L.LOADED,o))):r.error?n&&(t.forceUpdate("surface"),o.error=r.error,yt(L.ERROR,o)):(n&&yt(L.LOAD,o),a.loadId=r.load((()=>{t.destroyed||(pt(t,e,r)&&(gt(a,r,i,s),t.forceUpdate("surface")),yt(L.LOADED,o))}),(e=>{t.forceUpdate("surface"),o.error=e,yt(L.ERROR,o)}))),a}(i,t,e,s,!ie||!ie[e.url]);case"linear":return function(t,e){let{from:i,to:s,type:n,blendMode:a,opacity:r}=t;i||(i=Tt),s||(s=It);const o=p.canvas.createLinearGradient(e.x+i.x*e.width,e.y+i.y*e.height,e.x+s.x*e.width,e.y+s.y*e.height);Wt(o,t.stops,r);const h={type:n,style:o};return a&&(h.blendMode=a),h}(e,s);case"radial":return function(t,e){let{from:i,to:s,type:n,opacity:a,blendMode:r,stretch:o}=t;i||(i=Ht),s||(s=Vt);const{x:h,y:d,width:l,height:c}=e;let u;Dt(jt,h+i.x*l,d+i.y*c),Dt(qt,h+s.x*l,d+s.y*c),(l!==c||o)&&(u=Nt(),Yt(u,jt,l/c*(o||1),1),Ut(u,jt,Pt(jt,qt)+90));const f=p.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Ft(jt,qt));Wt(f,t.stops,a);const _={type:n,style:f,transform:u};return r&&(_.blendMode=r),_}(e,s);case"angular":return function(t,e){let{from:i,to:s,type:n,opacity:a,blendMode:r,stretch:o}=t;i||(i=$t),s||(s=Jt);const{x:h,y:d,width:l,height:c}=e;Gt(te,h+i.x*l,d+i.y*c),Gt(ee,h+s.x*l,d+s.y*c);const u=Qt(),f=Xt(te,ee);p.conicGradientRotate90?(Kt(u,te,l/c*(o||1),1),Zt(u,te,f+90)):(Kt(u,te,1,l/c*(o||1)),Zt(u,te,f));const _=p.conicGradientSupport?p.canvas.createConicGradient(0,te.x,te.y):p.canvas.createRadialGradient(te.x,te.y,0,te.x,te.y,zt(te,ee));Wt(_,t.stops,a);const g={type:n,style:_,transform:u};return r&&(g.blendMode=r),g}(e,s);default:return e.r?{type:"solid",style:C.string(e)}:void 0}}var ne=Object.freeze({__proto__:null,compute:function(t,e){const i=[],s=e.__;let n,a,r=s.__input[t];r instanceof Array||(r=[r]),ie=bt(t,s);for(let s=0,a=r.length;s<a;s++)n=se(t,r[s],e),n&&i.push(n);if(s["_"+t]=i.length?i:void 0,1===r.length){const t=r[0];"image"===t.type&&(a=O.isPixel(t))}"fill"===t?s.__pixelFill=a:s.__pixelStroke=a},drawTextStroke:kt,fill:function(t,e,i){i.fillStyle=t,e.__.__font?Rt(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fillText:Rt,fills:function(t,e,i){let s;const{windingRule:n,__font:a}=e.__;for(let r=0,o=t.length;r<o;r++)s=t[r],s.image&&Bt(e,i,s,!a)||s.style&&(i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),a?Rt(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),a?Rt(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):a?Rt(e,i):n?i.fill(n):i.fill())},recycleImage:bt,shape:function(t,e,i){const s=e.getSameCanvas();let n,a,r,o;const{__world:h}=t;let{scaleX:d,scaleY:l}=h;if(d<0&&(d=-d),l<0&&(l=-l),e.bounds.includes(h,i.matrix))i.matrix?(d*=i.matrix.a,l*=i.matrix.d,n=r=At(h,i.matrix)):n=r=h,o=s;else{const{renderShapeSpread:s}=t.__layout,c=Ot(s?Mt(e.bounds,s*d,s*l):e.bounds,h,i.matrix);a=e.bounds.getFitMatrix(c),a.a<1&&(o=e.getSameCanvas(),t.__renderShape(o,i),d*=a.a,l*=a.d),r=At(h,a),n=Ct(r,-a.e,-a.f),i.matrix&&a.multiply(i.matrix),i=Object.assign(Object.assign({},i),{matrix:a})}return t.__renderShape(s,i),{canvas:s,matrix:a,bounds:n,worldCanvas:o,shapeBounds:r,scaleX:d,scaleY:l}},stroke:function(t,e,i,s){const n=e.__,{strokeWidth:a,strokeAlign:r,__font:o}=n;if(a)if(o)Et(t,e,i,s);else switch(r){case"center":i.setStroke(t,a,n),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*a,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const r=i.getSameCanvas(!0);r.setStroke(t,2*a,e.__),e.__drawRenderPath(r),r.stroke(),n.windingRule?r.clip(n.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__hasMirror||s.matrix?i.copyWorldByReset(r):i.copyWorldToInner(r,e.__world,e.__layout.renderBounds),r.recycle()}},strokeText:Et,strokes:function(t,e,i,s){const n=e.__,{strokeWidth:a,strokeAlign:r,__font:o}=n;if(a)if(o)Et(t,e,i,s);else switch(r){case"center":i.setStroke(void 0,a,n),St(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*a,n),n.windingRule?i.clip(n.windingRule):i.clip(),St(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0);e.__drawRenderPath(o),o.setStroke(void 0,2*a,e.__),St(t,!1,e,o),n.windingRule?o.clip(n.windingRule):o.clip(),o.clearWorld(r),e.__hasMirror||s.matrix?i.copyWorldByReset(o):i.copyWorldToInner(o,e.__world,r),o.recycle()}}});const{copy:ae,toOffsetOutBounds:re}=l,oe={},he={};function de(t,e,i,s){const{bounds:n,shapeBounds:a}=s;if(p.fullImageShadow){if(ae(oe,t.bounds),oe.x+=e.x-a.x,oe.y+=e.y-a.y,i){const{matrix:t}=s;oe.x-=(n.x+(t?t.e:0)+n.width/2)*(i-1),oe.y-=(n.y+(t?t.f:0)+n.height/2)*(i-1),oe.width*=i,oe.height*=i}t.copyWorld(s.canvas,t.bounds,oe)}else i&&(ae(oe,e),oe.x-=e.width/2*(i-1),oe.y-=e.height/2*(i-1),oe.width*=i,oe.height*=i),t.copyWorld(s.canvas,a,i?oe:e)}const{toOffsetOutBounds:le}=l,ce={};var ue=Object.freeze({__proto__:null,blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__world.a),i.copyWorldToInner(e,t.__world,t.__layout.renderBounds),i.filter="none"},innerShadow:function(t,e,i,s){let n,a;const{__world:r,__layout:o}=t,{innerShadow:h}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:u,scaleY:f}=i,_=e.getSameCanvas(),g=h.length-1;le(l,ce),h.forEach(((h,p)=>{_.save(),_.setWorldShadow(ce.offsetX+h.x*u,ce.offsetY+h.y*f,h.blur*u),a=h.spread?1-2*h.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,de(_,ce,a,i),_.restore(),d?(_.copyWorld(_,l,r,"copy"),_.copyWorld(d,r,r,"source-out"),n=r):(_.copyWorld(i.canvas,c,l,"source-out"),n=l),_.fillWorld(n,h.color,"source-in"),t.__hasMirror||s.matrix?e.copyWorldByReset(_,n,r,h.blendMode):e.copyWorldToInner(_,n,o.renderBounds,h.blendMode),g&&p<g&&_.clear()})),_.recycle()},shadow:function(t,e,i,s){let n,a;const{__world:r,__layout:o}=t,{shadow:h}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:u,scaleY:f}=i,_=e.getSameCanvas(),g=h.length-1;re(l,he),h.forEach(((h,p)=>{_.setWorldShadow(he.offsetX+h.x*u,he.offsetY+h.y*f,h.blur*u,h.color),a=h.spread?1+2*h.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,de(_,he,a,i),n=l,h.box&&(_.restore(),_.save(),d&&(_.copyWorld(_,l,r,"copy"),n=r),d?_.copyWorld(d,r,r,"destination-out"):_.copyWorld(i.canvas,c,l,"destination-out")),t.__hasMirror||s.matrix?e.copyWorldByReset(_,n,r,h.blendMode):e.copyWorldToInner(_,n,o.renderBounds,h.blendMode),g&&p<g&&_.clear()})),_.recycle()}});const fe=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",_e=fe+"_#~&*+\\=|≮≯≈≠=…",ge=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function pe(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const ye=pe("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),we=pe("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),me=pe(fe),ve=pe(_e),xe=pe("- —/~|┆·");var Be;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Be||(Be={}));const{Letter:be,Single:Re,Before:Ee,After:Le,Symbol:ke,Break:Se}=Be;function Me(t){return ye[t]?be:xe[t]?Se:we[t]?Ee:me[t]?Le:ve[t]?ke:ge.test(t)?Re:be}const Ae={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Ce(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Oe}=Ae,{Letter:Te,Single:Ie,Before:We,After:De,Symbol:Pe,Break:Fe}=Be;let Ne,Ue,Ye,He,Ve,je,qe,Ge,Xe,ze,Qe,Ze,Ke,$e,Je,ti,ei=[];function ii(t,e){Xe&&!Ge&&(Ge=Xe),Ne.data.push({char:t,width:e}),Ye+=e}function si(){He+=Ye,Ne.width=Ye,Ue.words.push(Ne),Ne={data:[]},Ye=0}function ni(){$e&&(Je.paraNumber++,Ue.paraStart=!0,$e=!1),Xe&&(Ue.startCharSize=Ge,Ue.endCharSize=Xe,Ge=0),Ue.width=He,ti.width&&Oe(Ue),ei.push(Ue),Ue={words:[]},He=0}const ai={getDrawData(t,e){"string"!=typeof t&&(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,a=e.__getInput("height")||0;const{textDecoration:r,__font:o,padding:h}=e;if(h){const[t,e,r,o]=S.fourNumber(h);n&&(i=o,n-=e+o),a&&(s=t,a-=t+r)}const d={bounds:{x:i,y:s,width:n,height:a},rows:[],paraNumber:0,font:p.canvas.font=o};return function(t,e,i){Je=t,ei=t.rows,ti=t.bounds;const{__letterSpacing:s,paraIndent:n,textCase:a}=i,{canvas:r}=p,{width:o,height:h}=ti;if(o||h||s||"none"!==a){const t="none"!==i.textWrap,h="break"===i.textWrap;$e=!0,Qe=null,Ge=qe=Xe=Ye=He=0,Ne={data:[]},Ue={words:[]};for(let i=0,d=e.length;i<d;i++)je=e[i],"\n"===je?(Ye&&si(),Ue.paraEnd=!0,ni(),$e=!0):(ze=Me(je),ze===Te&&"none"!==a&&(je=Ce(je,a,!Ye)),qe=r.measureText(je).width,s&&(s<0&&(Xe=qe),qe+=s),Ze=ze===Ie&&(Qe===Ie||Qe===Te)||Qe===Ie&&ze!==De,Ke=!(ze!==We&&ze!==Ie||Qe!==Pe&&Qe!==De),Ve=$e&&n?o-n:o,t&&o&&He+Ye+qe>Ve&&(h?(Ye&&si(),ni()):(Ke||(Ke=ze===Te&&Qe==De),Ze||Ke||ze===Fe||ze===We||ze===Ie||Ye+qe>Ve?(Ye&&si(),ni()):ni()))," "===je&&!0!==$e&&He+Ye===0||(ze===Fe?(" "===je&&Ye&&si(),ii(je,qe),si()):Ze||Ke?(Ye&&si(),ii(je,qe)):ii(je,qe)),Qe=ze);Ye&&si(),He&&ni(),ei.length>0&&(ei[ei.length-1].paraEnd=!0)}else e.split("\n").forEach((t=>{Je.paraNumber++,ei.push({x:n||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(d,t,e),function(t,e){const{rows:i,bounds:s}=t,{__lineHeight:n,__baseLine:a,__letterSpacing:r,__clipText:o,textAlign:h,verticalAlign:d,paraSpacing:l}=e;let c,u,f,{x:_,y:g,width:p,height:y}=s,w=n*i.length+(l?l*(t.paraNumber-1):0),m=a;if(o&&w>y)w=Math.max(y,n),t.overflow=i.length;else switch(d){case"middle":g+=(y-w)/2;break;case"bottom":g+=y-w}m+=g;for(let a=0,d=i.length;a<d;a++){switch(c=i[a],c.x=_,h){case"center":c.x+=(p-c.width)/2;break;case"right":c.x+=p-c.width}c.paraStart&&l&&a>0&&(m+=l),c.y=m,m+=n,t.overflow>a&&m>w&&(c.isOverflow=!0,t.overflow=a+1),u=c.x,f=c.width,r<0&&(c.width<0?(f=-c.width+e.fontSize+r,u-=f,f+=e.fontSize):f-=r),u<s.x&&(s.x=u),f>s.width&&(s.width=f),o&&p&&p<f&&(c.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(d,e),function(t,e,i,s){const{rows:n}=t,{textAlign:a,paraIndent:r,letterSpacing:o}=e;let h,d,l,c,u;n.forEach((t=>{t.words&&(l=r&&t.paraStart?r:0,d=i&&"justify"===a&&t.words.length>1?(i-t.width-l)/(t.words.length-1):0,c=o||t.isOverflow?0:d>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,h=t.x,t.data=[],t.words.forEach((e=>{1===c?(u={char:"",x:h},h=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,i){return t.forEach((t=>{" "!==t.char&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&d&&(h+=d,t.width+=d)}))),t.words=null)}))}(d,e,n),d.overflow&&function(t,e){const{rows:i,overflow:s}=t;let{textOverflow:n}=e;if(i.splice(s),"hide"!==n){let t,a;"ellipsis"===n&&(n="...");const r=p.canvas.measureText(n).width,o=e.x+e.width-r;("none"===e.textWrap?i:[i[s-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<o));s--){if(a<o&&" "!==t.char){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=r,e.data.push({char:n,x:a}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(d,e),"none"!==r&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(d,e),d}},ri={string(t,e){if("string"==typeof t)return t;let i=void 0===t.a?1:t.a;e&&(i*=e);const s=t.r+","+t.g+","+t.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}},oi={export(t,e,i){return function(t){hi||(hi=new M);return new Promise((e=>{hi.add((()=>P(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((s=>new Promise((n=>{const{leafer:a}=t;a?a.waitViewCompleted((()=>P(this,void 0,void 0,(function*(){let t,r,o,{canvas:h}=a,{unreal:d}=h;switch(d&&(h=h.getSameCanvas(),h.backgroundColor=a.config.fill,a.__render(h,{})),typeof i){case"object":i.quality&&(t=i.quality),i.blob&&(r=!0);break;case"number":t=i;break;case"boolean":r=i}o=e.includes(".")?yield h.saveAs(e,t):r?yield h.toBlob(e,t):yield h.toDataURL(e,t),s({data:o}),n(),d&&h.recycle()})))):(s({data:!1}),n())}))))}};let hi;Object.assign(T,ne),Object.assign(I,ue),Object.assign(W,ai),Object.assign(C,ri),Object.assign(D,oi);export{K as Layouter,st as LeaferCanvas,J as Renderer,it as Selector,F as Watcher,rt as useCanvas};
1
+ import{LeafList as t,DataHelper as e,RenderEvent as i,ChildEvent as s,WatchEvent as n,PropertyEvent as a,LeafHelper as r,BranchHelper as o,Bounds as d,LeafBoundsHelper as h,Debug as l,LeafLevelList as c,LayoutEvent as u,Run as f,ImageManager as _,Platform as g,AnimateEvent as p,ResizeEvent as y,BoundsHelper as w,Creator as m,LeaferCanvasBase as v,canvasPatch as x,LeaferImage as B,InteractionBase as b,FileHelper as R,MatrixHelper as E,ImageEvent as k,PointHelper as L,MathHelper as S,TaskProcessor as A}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{writeFileSync as M}from"fs";import{ColorConvert as C,ImageManager as O,Paint as T,Effect as I,TextConvert as W,Export as D}from"@leafer-ui/core";export*from"@leafer-ui/core";function P(t,e,i,s){return new(i||(i=Promise))((function(n,a){function r(t){try{d(s.next(t))}catch(t){a(t)}}function o(t){try{d(s.throw(t))}catch(t){a(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,o)}d((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class F{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(i,s){this.totalTimes=0,this.config={},this.__updatedList=new t,this.target=i,s&&(this.config=e.default(s,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(i.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===s.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new n(n.DATA,{updatedList:this.updatedList})),this.__updatedList=new t,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(a.CHANGE,this.__onAttrChange,this),t.on_([s.ADD,s.REMOVE],this.__onChildEvent,this),t.on_(n.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:N,updateBounds:Y,updateAllWorldOpacity:U}=r,{pushAllChildBranch:H,pushAllParent:V}=o;const{worldBounds:X}=h,j={x:0,y:0,width:1e5,height:1e5};class q{constructor(e){this.updatedBounds=new d,this.beforeBounds=new d,this.afterBounds=new d,e instanceof Array&&(e=new t(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,X)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(j):this.afterBounds.setListWithFn(t,X),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:z,updateAllChange:G}=r,Q=l.get("Layouter");class Z{constructor(t,i){this.totalTimes=0,this.config={},this.__levelList=new c,this.target=t,i&&(this.config=e.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(u.START),this.layoutOnce(),t.emitEvent(new u(u.END,this.layoutedBlocks,this.times))}catch(t){Q.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Q.warn("layouting"):this.times>3?Q.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(n.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=f.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:r}=u,o=this.getBlocks(s);o.forEach((t=>t.setBefore())),i.emitEvent(new u(n,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(N(t,!0),e.add(t),t.isBranch&&H(t,e),V(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),V(t,e)))}))}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach((n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Y(s[t])}Y(i)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&U(t),t.__updateChange()}))}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach((t=>t.setAfter())),i.emitEvent(new u(a,o,this.times)),i.emitEvent(new u(r,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,f.end(e)}fullLayout(){const e=f.start("FullLayout"),{target:i}=this,{BEFORE:s,LAYOUT:n,AFTER:a}=u,r=this.getBlocks(new t(i));i.emitEvent(new u(s,r,this.times)),Z.fullLayout(i),r.forEach((t=>{t.setAfter()})),i.emitEvent(new u(n,r,this.times)),i.emitEvent(new u(a,r,this.times)),this.addBlocks(r),f.end(e)}static fullLayout(t){z(t,!0),t.isBranch?o.updateBounds(t):r.updateBounds(t),G(t)}addExtra(t){const e=this.extraBlock||(this.extraBlock=new q([]));e.updatedList.add(t),e.beforeBounds.add(t.__world)}createBlock(t){return new q(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(u.REQUEST,this.layout,this),t.on_(u.AGAIN,this.layoutAgain,this),t.on_(n.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const K=l.get("Renderer");class ${get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,i,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=i,s&&(this.config=e.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(u.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new d,K.log(e.innerName,"---\x3e");try{this.emitRender(i.START),this.renderOnce(t),this.emitRender(i.END,this.totalBounds),_.clearRecycled()}catch(t){this.rendering=!1,K.error(t)}K.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?K.warn("rendering"):this.times>3?K.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new d,this.renderOptions={},t?(this.emitRender(i.BEFORE),t()):(this.requestLayout(),this.emitRender(i.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(i.RENDER,this.renderBounds,this.renderOptions),this.emitRender(i.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return K.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=f.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=t.includes(this.target.__world),a=new d(s);i.save(),n&&!l.showRepaint?i.clear():(s.spread(1+1/this.canvas.pixelRatio).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0)),this.__render(s,n,a),i.restore(),f.end(e)}fullRender(){const t=f.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),f.end(t)}__render(t,e,i){const s=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),l.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=i||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),l.showHitView&&this.renderHitView(s),l.showBoundsView&&this.renderBoundsView(s),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new d;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();g.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(p.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:i}=t.old;new d(0,0,e,i).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||K.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new i(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(i.REQUEST,this.update,this),t.on_(u.END,this.__onLayoutEnd,this),t.on_(i.AGAIN,this.renderAgain,this),t.on_(y.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}var J;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(J||(J={}));const{hitRadiusPoint:tt}=w;class et{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const a=this.findList,r=this.getBestMatchLeaf(),o=n?this.getPath(r):this.getHitablePath(r);return this.clear(),s?{path:o,leaf:r,throughPath:a.length?this.getThroughPath(a):o}:{path:o,leaf:r}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:i,y:s}=this.point,n={x:i,y:s,radiusX:0,radiusY:0};for(let i=0,s=t.length;i<s;i++)if(e=t[i],r.worldHittable(e)&&(this.hitChild(e,n),this.findList.length))return this.findList[0]}return t[0]}getPath(e){const i=new t;for(;e;)i.add(e),e=e.parent;return i.add(this.target),i}getHitablePath(e){const i=this.getPath(e);let s,n=new t;for(let t=i.list.length-1;t>-1&&(s=i.list[t],s.__.hittable)&&(n.addAt(s,0),s.__.hitChildren);t--);return n}getThroughPath(e){const i=new t,s=[];for(let t=e.length-1;t>-1;t--)s.push(this.getPath(e[t]));let n,a,r;for(let t=0,e=s.length;t<e;t++){n=s[t],a=s[t+1];for(let t=0,e=n.length;t<e&&(r=n.list[t],!a||!a.has(r));t++)i.add(r)}return i}eachFind(t,e){let i,s;const{point:n}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.isMask||(s=!!i.__.hitRadius||tt(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&!this.findList.length&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}const{Yes:it,NoAndSkip:st,YesAndSkip:nt}=J;class at{constructor(t,i){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.idMap[e]=t,1):0,innerId:(t,e)=>t.innerId===e?(this.innerIdMap[e]=t,1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0},this.target=t,i&&(this.config=e.default(i,this.config)),this.pather=new et(t,this),this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":const s=this.getById(t.substring(1),e);return i?s:s?[s]:[];case".":return this.getByMethod(this.methods.className,e,i,t.substring(1));default:return this.getByMethod(this.methods.tag,e,i,t)}case"function":return this.getByMethod(t,e,i,s)}}getByPoint(t,e,i){return"node"===g.name&&this.target.emit(u.CHECK_UPDATE),this.pather.getByPoint(t,e,i)}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&r.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,a;for(let r=0,o=t.length;r<o;r++){if(n=t[r],a=e(n,s),a===it||a===nt){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&a<st&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(s.REMOVE,this.__onRemoveChild,this),this.target.on_(a.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.pather.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(m,{watcher:(t,e)=>new F(t,e),layouter:(t,e)=>new Z(t,e),renderer:(t,e,i)=>new $(t,e,i),selector:(t,e)=>new at(t,e)}),g.layout=Z.fullLayout;class rt extends v{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),g.roundRectPatch&&(this.context.__proto__.roundRect=null,x(this.context.__proto__))}__createView(){this.view=g.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=t*i,this.view.height=e*i,this.clientBounds=this.bounds}}const{mineType:ot,fileType:dt}=R;function ht(t,e){if(g.canvasType=t,!g.origin){if("skia"===t){const{Canvas:t,loadImage:i}=e;g.origin={createCanvas:(e,i,s)=>new t(e,i,s),canvasToDataURL:(t,e,i)=>t.toDataURLSync(e,{quality:i}),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>t.saveAs(e,{quality:i}),loadImage:i},g.roundRectPatch=!0}else if("napi"===t){const{Canvas:t,loadImage:i}=e;g.origin={createCanvas:(e,i,s)=>new t(e,i,s),canvasToDataURL:(t,e,i)=>t.toDataURL(ot(e),i),canvasToBolb:(t,e,i)=>P(this,void 0,void 0,(function*(){return t.toBuffer(ot(e),i)})),canvasSaveAs:(t,e,i)=>P(this,void 0,void 0,(function*(){return M(e,t.toBuffer(ot(dt(e)),i))})),loadImage:i}}g.ellipseToCurve=!0,g.event={stopDefault(t){},stopNow(t){},stop(t){}},g.canvas=m.canvas()}}Object.assign(m,{canvas:(t,e)=>new rt(t,e),image:t=>new B(t),hitCanvas:(t,e)=>new rt(t,e),interaction:(t,e,i,s)=>new b(t,e,i,s)}),g.name="node",g.requestRender=function(t){setTimeout(t)},g.devicePixelRatio=1,g.conicGradientSupport=!0;const{get:lt,rotateOfOuter:ct,translate:ut,scaleOfOuter:ft,scale:_t,rotate:gt}=E;const{get:pt,translate:yt}=E;function wt(t,e,i,s){let{width:n,height:a}=e;const{opacity:r,mode:o,offset:d,scale:h,rotation:l,blendMode:c}=i,u=s.width===n&&s.height===a;c&&(t.blendMode=c);const f=t.data={mode:o};switch(o){case"strench":u||(n=s.width,a=s.height),(s.x||s.y)&&(f.transform=pt(),yt(f.transform,s.x,s.y));break;case"clip":(d||h||l)&&function(t,e,i,s,n){const a=lt();ut(a,e.x,e.y),i&&ut(a,i.x,i.y),s&&("number"==typeof s?_t(a,s):_t(a,s.x,s.y),t.scaleX=a.a,t.scaleY=a.d),n&&gt(a,n),t.transform=a}(f,s,d,h,l);break;case"repeat":(!u||h||l)&&function(t,e,i,s,n,a){const r=lt();if(a)switch(gt(r,a),a){case 90:ut(r,s,0);break;case 180:ut(r,i,s);break;case 270:ut(r,0,i)}ut(r,e.x,e.y),n&&(ft(r,e,n),t.scaleX=t.scaleY=n),t.transform=r}(f,s,n,a,h,l);break;default:u&&!l||function(t,e,i,s,n,a){const r=lt(),o=a&&180!==a,d=i.width/(o?n:s),h=i.height/(o?s:n),l="fit"===e?Math.min(d,h):Math.max(d,h),c=i.x+(i.width-s*l)/2,u=i.y+(i.height-n*l)/2;ut(r,c,u),_t(r,l),a&&ct(r,{x:i.x+i.width/2,y:i.y+i.height/2},a),t.scaleX=t.scaleY=l,t.transform=r}(f,o,s,n,a,l)}f.width=n,f.height=a,r&&(f.opacity=r)}function mt(t,e,i){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=i.width,e.__naturalHeight=i.height,!e.__getInput("width")||!e.__getInput("height"))return t.__proxyData&&(t.setProxyAttr("width",t.__.width),t.setProxyAttr("height",t.__.height)),t.forceUpdate("width"),!1}return!0}function vt(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new k(t,e))}const xt={},{get:Bt,scale:bt,copy:Rt}=E;function Et(t,e,i){let{scaleX:s,scaleY:n}=t.__world;const a=s+"-"+n;if(e.patternId===a||t.destroyed)return!1;{s=Math.abs(s),n=Math.abs(n);const{image:t,data:r}=e;let o,d,{width:h,height:l,scaleX:c,scaleY:u,opacity:f,transform:_,mode:p}=r;c&&(d=Bt(),Rt(d,_),bt(d,1/c,1/u),s*=c,n*=u),s*=i,n*=i,h*=s,l*=n;const y=h*l;if("repeat"!==e.data.mode&&y>g.image.maxCacheSize)return!1;let w=g.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;w>e&&(w=e)}y>w&&(o=Math.sqrt(y/w)),o&&(s/=o,n/=o,h/=o,l/=o),c&&(s/=c,n/=u),(_||1!==s||1!==n)&&(d||(d=Bt(),_&&Rt(d,_)),bt(d,1/s,1/n));const m=g.canvas.createPattern(t.getCanvas(h<1?1:h,l<1?1:l,f),"repeat"===p?"repeat":g.origin.noRepeat||"no-repeat");try{e.transform&&(e.transform=null),d&&(m.setTransform?m.setTransform(d):e.transform=d)}catch(t){e.transform=d}return e.style=m,e.patternId=a,!0}}const{abs:kt}=Math;function Lt(t,e,i,s){const{scaleX:n,scaleY:a}=t.__world;if(i.data&&i.patternId!==n+"-"+a){const{data:r}=i;if(s)if("repeat"!==r.mode){let{width:t,height:i}=r;t*=kt(n)*e.pixelRatio,i*=kt(a)*e.pixelRatio,r.scaleX&&(t*=r.scaleX,i*=r.scaleY),s=t*i>g.image.maxCacheSize}else s=!1;return s?(e.save(),e.clip(),i.blendMode&&(e.blendMode=i.blendMode),r.opacity&&(e.opacity*=r.opacity),r.transform&&e.transform(r.transform),e.drawImage(i.image.view,0,0,r.width,r.height),e.restore(),!0):(!i.style||xt.running?Et(t,i,e.pixelRatio):i.patternTask||(i.patternTask=_.patternTasker.add((()=>P(this,void 0,void 0,(function*(){i.patternTask=null,e.bounds.hit(t.__world)&&Et(t,i,e.pixelRatio),t.forceUpdate("surface")}))),300)),!1)}return!1}function St(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,a,r;for(let o=0,d=i.length;o<d;o++)s=i[o].image,r=s&&s.url,r&&(n||(n={}),n[r]=!0,_.recycle(s),s.loading&&(a||(a=e.__input&&e.__input[t]||[],a instanceof Array||(a=[a])),s.unload(i[o].loadId,!a.some((t=>t.url===r)))));return n}return null}function At(t,e){let i;const{rows:s,decorationY:n,decorationHeight:a}=t.__.__textDrawData;for(let t=0,r=s.length;t<r;t++)i=s[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),n&&e.fillRect(i.x,i.y+n,i.width,a)}function Mt(t,e,i,s){const{strokeAlign:n}=e.__,a="string"!=typeof t;switch(n){case"center":i.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?Tt(t,!0,e,i):Ot(e,i);break;case"inside":Ct("inside",t,a,e,i,s);break;case"outside":Ct("outside",t,a,e,i,s)}}function Ct(t,e,i,s,n,a){const{strokeWidth:r,__font:o}=s.__,d=n.getSameCanvas(!0);d.setStroke(i?void 0:e,2*r,s.__),d.font=o,i?Tt(e,!0,s,d):Ot(s,d),d.blendMode="outside"===t?"destination-out":"destination-in",At(s,d),d.blendMode="normal",s.__worldFlipped||a.matrix?n.copyWorldByReset(d):n.copyWorldToInner(d,s.__world,s.__layout.renderBounds),d.recycle()}function Ot(t,e){let i;const{rows:s,decorationY:n,decorationHeight:a}=t.__.__textDrawData;for(let t=0,r=s.length;t<r;t++)i=s[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)})),n&&e.strokeRect(i.x,i.y+n,i.width,a)}function Tt(t,e,i,s){let n;for(let a=0,r=t.length;a<r;a++)n=t[a],n.image&&Lt(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?Ot(i,s):s.stroke(),s.restoreBlendMode()):e?Ot(i,s):s.stroke())}const{getSpread:It,getOuterOf:Wt,getByMove:Dt,getIntersectData:Pt}=w;const Ft={x:.5,y:0},Nt={x:.5,y:1};function Yt(t,e,i){let s;for(let n=0,a=e.length;n<a;n++)s=e[n],t.addColorStop(s.offset,C.string(s.color,i))}const{set:Ut,getAngle:Ht,getDistance:Vt}=L,{get:Xt,rotateOfOuter:jt,scaleOfOuter:qt}=E,zt={x:.5,y:.5},Gt={x:.5,y:1},Qt={},Zt={};const{set:Kt,getAngle:$t,getDistance:Jt}=L,{get:te,rotateOfOuter:ee,scaleOfOuter:ie}=E,se={x:.5,y:.5},ne={x:.5,y:1},ae={},re={};let oe;function de(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=i.__layout;switch(e.type){case"solid":let{type:n,blendMode:a,color:r,opacity:o}=e;return{type:n,blendMode:a,style:C.string(r,o)};case"image":return function(t,e,i,s,n){const a={type:i.type},r=a.image=_.get(i),o=(n||r.loading)&&{target:t,image:r,attrName:e,attrValue:i};return r.ready?(mt(t,e,r)&&wt(a,r,i,s),n&&(vt(k.LOAD,o),vt(k.LOADED,o))):r.error?n&&(t.forceUpdate("surface"),o.error=r.error,vt(k.ERROR,o)):(n&&vt(k.LOAD,o),a.loadId=r.load((()=>{t.destroyed||(mt(t,e,r)&&(wt(a,r,i,s),t.forceUpdate("surface")),vt(k.LOADED,o))}),(e=>{t.forceUpdate("surface"),o.error=e,vt(k.ERROR,o)}))),a}(i,t,e,s,!oe||!oe[e.url]);case"linear":return function(t,e){let{from:i,to:s,type:n,blendMode:a,opacity:r}=t;i||(i=Ft),s||(s=Nt);const o=g.canvas.createLinearGradient(e.x+i.x*e.width,e.y+i.y*e.height,e.x+s.x*e.width,e.y+s.y*e.height);Yt(o,t.stops,r);const d={type:n,style:o};return a&&(d.blendMode=a),d}(e,s);case"radial":return function(t,e){let{from:i,to:s,type:n,opacity:a,blendMode:r,stretch:o}=t;i||(i=zt),s||(s=Gt);const{x:d,y:h,width:l,height:c}=e;let u;Ut(Qt,d+i.x*l,h+i.y*c),Ut(Zt,d+s.x*l,h+s.y*c),(l!==c||o)&&(u=Xt(),qt(u,Qt,l/c*(o||1),1),jt(u,Qt,Ht(Qt,Zt)+90));const f=g.canvas.createRadialGradient(Qt.x,Qt.y,0,Qt.x,Qt.y,Vt(Qt,Zt));Yt(f,t.stops,a);const _={type:n,style:f,transform:u};return r&&(_.blendMode=r),_}(e,s);case"angular":return function(t,e){let{from:i,to:s,type:n,opacity:a,blendMode:r,stretch:o}=t;i||(i=se),s||(s=ne);const{x:d,y:h,width:l,height:c}=e;Kt(ae,d+i.x*l,h+i.y*c),Kt(re,d+s.x*l,h+s.y*c);const u=te(),f=$t(ae,re);g.conicGradientRotate90?(ie(u,ae,l/c*(o||1),1),ee(u,ae,f+90)):(ie(u,ae,1,l/c*(o||1)),ee(u,ae,f));const _=g.conicGradientSupport?g.canvas.createConicGradient(0,ae.x,ae.y):g.canvas.createRadialGradient(ae.x,ae.y,0,ae.x,ae.y,Jt(ae,re));Yt(_,t.stops,a);const p={type:n,style:_,transform:u};return r&&(p.blendMode=r),p}(e,s);default:return e.r?{type:"solid",style:C.string(e)}:void 0}}var he=Object.freeze({__proto__:null,compute:function(t,e){const i=[],s=e.__;let n,a,r=s.__input[t];r instanceof Array||(r=[r]),oe=St(t,s);for(let s=0,a=r.length;s<a;s++)n=de(t,r[s],e),n&&i.push(n);if(s["_"+t]=i.length?i:void 0,1===r.length){const t=r[0];"image"===t.type&&(a=O.isPixel(t))}"fill"===t?s.__pixelFill=a:s.__pixelStroke=a},drawTextStroke:Ot,fill:function(t,e,i){i.fillStyle=t,e.__.__font?At(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fillText:At,fills:function(t,e,i){let s;const{windingRule:n,__font:a}=e.__;for(let r=0,o=t.length;r<o;r++)s=t[r],s.image&&Lt(e,i,s,!a)||s.style&&(i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),a?At(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),a?At(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):a?At(e,i):n?i.fill(n):i.fill())},recycleImage:St,shape:function(t,e,i){const s=e.getSameCanvas();let n,a,r,o;const{__world:d}=t;let{scaleX:h,scaleY:l}=d;if(h<0&&(h=-h),l<0&&(l=-l),e.bounds.includes(d,i.matrix))i.matrix?(h*=i.matrix.a,l*=i.matrix.d,n=r=Wt(d,i.matrix)):n=r=d,o=s;else{const{renderShapeSpread:s}=t.__layout,c=Pt(s?It(e.bounds,s*h,s*l):e.bounds,d,i.matrix);a=e.bounds.getFitMatrix(c),a.a<1&&(o=e.getSameCanvas(),t.__renderShape(o,i),h*=a.a,l*=a.d),r=Wt(d,a),n=Dt(r,-a.e,-a.f),i.matrix&&a.multiply(i.matrix),i=Object.assign(Object.assign({},i),{matrix:a})}return t.__renderShape(s,i),{canvas:s,matrix:a,bounds:n,worldCanvas:o,shapeBounds:r,scaleX:h,scaleY:l}},stroke:function(t,e,i,s){const n=e.__,{strokeWidth:a,strokeAlign:r,__font:o}=n;if(a)if(o)Mt(t,e,i,s);else switch(r){case"center":i.setStroke(t,a,n),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*a,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const r=i.getSameCanvas(!0);r.setStroke(t,2*a,e.__),e.__drawRenderPath(r),r.stroke(),n.windingRule?r.clip(n.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__worldFlipped||s.matrix?i.copyWorldByReset(r):i.copyWorldToInner(r,e.__world,e.__layout.renderBounds),r.recycle()}},strokeText:Mt,strokes:function(t,e,i,s){const n=e.__,{strokeWidth:a,strokeAlign:r,__font:o}=n;if(a)if(o)Mt(t,e,i,s);else switch(r){case"center":i.setStroke(void 0,a,n),Tt(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*a,n),n.windingRule?i.clip(n.windingRule):i.clip(),Tt(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0);e.__drawRenderPath(o),o.setStroke(void 0,2*a,e.__),Tt(t,!1,e,o),n.windingRule?o.clip(n.windingRule):o.clip(),o.clearWorld(r),e.__worldFlipped||s.matrix?i.copyWorldByReset(o):i.copyWorldToInner(o,e.__world,r),o.recycle()}}});const{copy:le,toOffsetOutBounds:ce}=w,ue={},fe={};function _e(t,e,i,s){const{bounds:n,shapeBounds:a}=s;if(g.fullImageShadow){if(le(ue,t.bounds),ue.x+=e.x-a.x,ue.y+=e.y-a.y,i){const{matrix:t}=s;ue.x-=(n.x+(t?t.e:0)+n.width/2)*(i-1),ue.y-=(n.y+(t?t.f:0)+n.height/2)*(i-1),ue.width*=i,ue.height*=i}t.copyWorld(s.canvas,t.bounds,ue)}else i&&(le(ue,e),ue.x-=e.width/2*(i-1),ue.y-=e.height/2*(i-1),ue.width*=i,ue.height*=i),t.copyWorld(s.canvas,a,i?ue:e)}const{toOffsetOutBounds:ge}=w,pe={};var ye=Object.freeze({__proto__:null,blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__world.a),i.copyWorldToInner(e,t.__world,t.__layout.renderBounds),i.filter="none"},innerShadow:function(t,e,i,s){let n,a;const{__world:r,__layout:o}=t,{innerShadow:d}=t.__,{worldCanvas:h,bounds:l,shapeBounds:c,scaleX:u,scaleY:f}=i,_=e.getSameCanvas(),g=d.length-1;ge(l,pe),d.forEach(((d,p)=>{_.save(),_.setWorldShadow(pe.offsetX+d.x*u,pe.offsetY+d.y*f,d.blur*u),a=d.spread?1-2*d.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,_e(_,pe,a,i),_.restore(),h?(_.copyWorld(_,l,r,"copy"),_.copyWorld(h,r,r,"source-out"),n=r):(_.copyWorld(i.canvas,c,l,"source-out"),n=l),_.fillWorld(n,d.color,"source-in"),t.__worldFlipped||s.matrix?e.copyWorldByReset(_,n,r,d.blendMode):e.copyWorldToInner(_,n,o.renderBounds,d.blendMode),g&&p<g&&_.clear()})),_.recycle()},shadow:function(t,e,i,s){let n,a;const{__world:r,__layout:o}=t,{shadow:d}=t.__,{worldCanvas:h,bounds:l,shapeBounds:c,scaleX:u,scaleY:f}=i,_=e.getSameCanvas(),g=d.length-1;ce(l,fe),d.forEach(((d,p)=>{_.setWorldShadow(fe.offsetX+d.x*u,fe.offsetY+d.y*f,d.blur*u,d.color),a=d.spread?1+2*d.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,_e(_,fe,a,i),n=l,d.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,r,"copy"),n=r),h?_.copyWorld(h,r,r,"destination-out"):_.copyWorld(i.canvas,c,l,"destination-out")),t.__worldFlipped||s.matrix?e.copyWorldByReset(_,n,r,d.blendMode):e.copyWorldToInner(_,n,o.renderBounds,d.blendMode),g&&p<g&&_.clear()})),_.recycle()}});const we=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",me=we+"_#~&*+\\=|≮≯≈≠=…",ve=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function xe(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Be=xe("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),be=xe("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Re=xe(we),Ee=xe(me),ke=xe("- —/~|┆·");var Le;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Le||(Le={}));const{Letter:Se,Single:Ae,Before:Me,After:Ce,Symbol:Oe,Break:Te}=Le;function Ie(t){return Be[t]?Se:ke[t]?Te:be[t]?Me:Re[t]?Ce:Ee[t]?Oe:ve.test(t)?Ae:Se}const We={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function De(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Pe}=We,{Letter:Fe,Single:Ne,Before:Ye,After:Ue,Symbol:He,Break:Ve}=Le;let Xe,je,qe,ze,Ge,Qe,Ze,Ke,$e,Je,ti,ei,ii,si,ni,ai,ri=[];function oi(t,e){$e&&!Ke&&(Ke=$e),Xe.data.push({char:t,width:e}),qe+=e}function di(){ze+=qe,Xe.width=qe,je.words.push(Xe),Xe={data:[]},qe=0}function hi(){si&&(ni.paraNumber++,je.paraStart=!0,si=!1),$e&&(je.startCharSize=Ke,je.endCharSize=$e,Ke=0),je.width=ze,ai.width&&Pe(je),ri.push(je),je={words:[]},ze=0}const li={getDrawData(t,e){"string"!=typeof t&&(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,a=e.__getInput("height")||0;const{textDecoration:r,__font:o,padding:d}=e;if(d){const[t,e,r,o]=S.fourNumber(d);n&&(i=o,n-=e+o),a&&(s=t,a-=t+r)}const h={bounds:{x:i,y:s,width:n,height:a},rows:[],paraNumber:0,font:g.canvas.font=o};return function(t,e,i){ni=t,ri=t.rows,ai=t.bounds;const{__letterSpacing:s,paraIndent:n,textCase:a}=i,{canvas:r}=g,{width:o,height:d}=ai;if(o||d||s||"none"!==a){const t="none"!==i.textWrap,d="break"===i.textWrap;si=!0,ti=null,Ke=Ze=$e=qe=ze=0,Xe={data:[]},je={words:[]};for(let i=0,h=e.length;i<h;i++)Qe=e[i],"\n"===Qe?(qe&&di(),je.paraEnd=!0,hi(),si=!0):(Je=Ie(Qe),Je===Fe&&"none"!==a&&(Qe=De(Qe,a,!qe)),Ze=r.measureText(Qe).width,s&&(s<0&&($e=Ze),Ze+=s),ei=Je===Ne&&(ti===Ne||ti===Fe)||ti===Ne&&Je!==Ue,ii=!(Je!==Ye&&Je!==Ne||ti!==He&&ti!==Ue),Ge=si&&n?o-n:o,t&&o&&ze+qe+Ze>Ge&&(d?(qe&&di(),hi()):(ii||(ii=Je===Fe&&ti==Ue),ei||ii||Je===Ve||Je===Ye||Je===Ne||qe+Ze>Ge?(qe&&di(),hi()):hi()))," "===Qe&&!0!==si&&ze+qe===0||(Je===Ve?(" "===Qe&&qe&&di(),oi(Qe,Ze),di()):ei||ii?(qe&&di(),oi(Qe,Ze)):oi(Qe,Ze)),ti=Je);qe&&di(),ze&&hi(),ri.length>0&&(ri[ri.length-1].paraEnd=!0)}else e.split("\n").forEach((t=>{ni.paraNumber++,ri.push({x:n||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(h,t,e),function(t,e){const{rows:i,bounds:s}=t,{__lineHeight:n,__baseLine:a,__letterSpacing:r,__clipText:o,textAlign:d,verticalAlign:h,paraSpacing:l}=e;let c,u,f,{x:_,y:g,width:p,height:y}=s,w=n*i.length+(l?l*(t.paraNumber-1):0),m=a;if(o&&w>y)w=Math.max(y,n),t.overflow=i.length;else switch(h){case"middle":g+=(y-w)/2;break;case"bottom":g+=y-w}m+=g;for(let a=0,h=i.length;a<h;a++){switch(c=i[a],c.x=_,d){case"center":c.x+=(p-c.width)/2;break;case"right":c.x+=p-c.width}c.paraStart&&l&&a>0&&(m+=l),c.y=m,m+=n,t.overflow>a&&m>w&&(c.isOverflow=!0,t.overflow=a+1),u=c.x,f=c.width,r<0&&(c.width<0?(f=-c.width+e.fontSize+r,u-=f,f+=e.fontSize):f-=r),u<s.x&&(s.x=u),f>s.width&&(s.width=f),o&&p&&p<f&&(c.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(h,e),function(t,e,i,s){const{rows:n}=t,{textAlign:a,paraIndent:r,letterSpacing:o}=e;let d,h,l,c,u;n.forEach((t=>{t.words&&(l=r&&t.paraStart?r:0,h=i&&"justify"===a&&t.words.length>1?(i-t.width-l)/(t.words.length-1):0,c=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,d=t.x,t.data=[],t.words.forEach((e=>{1===c?(u={char:"",x:d},d=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,i){return t.forEach((t=>{" "!==t.char&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&h&&(d+=h,t.width+=h)}))),t.words=null)}))}(h,e,n),h.overflow&&function(t,e){const{rows:i,overflow:s}=t;let{textOverflow:n}=e;if(i.splice(s),"hide"!==n){let t,a;"ellipsis"===n&&(n="...");const r=g.canvas.measureText(n).width,o=e.x+e.width-r;("none"===e.textWrap?i:[i[s-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<o));s--){if(a<o&&" "!==t.char){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=r,e.data.push({char:n,x:a}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(h,e),"none"!==r&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(h,e),h}},ci={string(t,e){if("string"==typeof t)return t;let i=void 0===t.a?1:t.a;e&&(i*=e);const s=t.r+","+t.g+","+t.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}},ui={export(t,e,i){return ui.running=!0,function(t){fi||(fi=new A);return new Promise((e=>{fi.add((()=>P(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((s=>new Promise((n=>{const{leafer:a}=t;a?a.waitViewCompleted((()=>P(this,void 0,void 0,(function*(){let t,r,o,{canvas:d}=a,{unreal:h}=d;switch(h&&(d=d.getSameCanvas(),d.backgroundColor=a.config.fill,a.__render(d,{})),typeof i){case"object":i.quality&&(t=i.quality),i.blob&&(r=!0);break;case"number":t=i;break;case"boolean":r=i}o=e.includes(".")?yield d.saveAs(e,t):r?yield d.toBlob(e,t):yield d.toDataURL(e,t),s({data:o}),n(),ui.running=!1,h&&d.recycle()})))):(s({data:!1}),n(),ui.running=!1)}))))}};let fi;Object.assign(T,he),Object.assign(I,ye),Object.assign(W,li),Object.assign(C,ci),Object.assign(D,ui);export{Z as Layouter,rt as LeaferCanvas,$ as Renderer,at as Selector,F as Watcher,ht as useCanvas};
package/dist/node.min.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("@leafer/core"),e=require("fs"),n=require("@leafer-ui/core");function s(t,e,n,s){return new(n||(n=Promise))((function(i,a){function r(t){try{d(s.next(t))}catch(t){a(t)}}function o(t){try{d(s.throw(t))}catch(t){a(t)}}function d(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,o)}d((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class i{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.push(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.push(e.parent)),this.update()}__pushChild(t){this.__updatedList.push(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllWorldMatrix:a,updateAllWorldOpacity:r}=t.LeafHelper,{pushAllChildBranch:o,pushAllParent:d}=t.BranchHelper;const{worldBounds:l}=t.LeafBoundsHelper,{setByListWithHandle:h}=t.BoundsHelper;class c{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){h(this.beforeBounds,this.updatedList.list,l)}setAfter(){h(this.afterBounds,this.updatedList.list,l),this.updatedBounds.setByList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:u,updateAllChange:f}=t.LeafHelper,{pushAllBranchStack:g,updateWorldBoundsByBranchStack:_}=t.BranchHelper,p=t.Debug.get("Layouter");class y{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){p.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?p.warn("layouting"):this.times>3?p.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:l,LAYOUT:h,AFTER:c}=t.LayoutEvent,u=this.getBlocks(i);u.forEach((t=>{t.setBefore()})),s.emitEvent(new t.LayoutEvent(l,u,this.times)),i.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(a(t),e.push(t),t.isBranch&&o(t,e),d(t,e)):n.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),d(t,e)))}))}(i,this.__levelList),function(t){let e,n;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(n=e[t],n.isBranch&&n.__tempNumber)for(let t=0,e=n.children.length;t<e;t++)n.children[t].isBranch||n.children[t].__updateWorldBounds();n.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&r(t),t.__updateChange()}))}(i),u.forEach((t=>t.setAfter())),s.emitEvent(new t.LayoutEvent(h,u,this.times)),s.emitEvent(new t.LayoutEvent(c,u,this.times)),this.addBlocks(u),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:s,LAYOUT:i,AFTER:a}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(s,r,this.times)),y.fullLayout(n),r.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(i,r,this.times)),n.emitEvent(new t.LayoutEvent(a,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(t){if(u(t),t.isBranch){const e=[t];g(t,e),_(e)}else t.__updateWorldBounds();f(t)}createBlock(t){return new c(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const m=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,s&&(this.config=t.DataHelper.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}render(e){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,m.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,m.error(t)}m.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){return this.rendering?m.warn("rendering"):this.times>3?m.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e?(this.emitRender(t.RenderEvent.BEFORE),e()):(this.requestLayout(),this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return m.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:s}=this,i=e.getIntersect(s.bounds),a=e.includes(this.target.__world),r=(new t.Bounds).copy(i);s.save(),a&&!t.Debug.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,a,r),s.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds,!0),n.restore(),t.Run.end(e)}__render(e,n,s){const i=e.includes(this.target.__world)?{includes:n}:{bounds:e,includes:n};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.Debug.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,i),this.renderBounds=s||e,this.renderOptions=i,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),t.Debug.showHitView&&this.renderHitView(i),t.Debug.showBoundsView&&this.renderBoundsView(i),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setByList(e),e.length=0,e.push(n)}}__requestRender(){const e=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(t.AnimateEvent.FRAME),this.target&&this.__requestRender()}))}__onResize(e){if(!this.canvas.unreal&&(e.bigger||!e.samePixelRatio)){const{width:n,height:s}=e.old;new t.Bounds(0,0,n,s).includes(this.target.__world)&&!this.needFill&&e.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||m.warn(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,s){this.target.emitEvent(new t.RenderEvent(e,this.times,n,s))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:w}=t.BoundsHelper;class x{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,n){e||(e=0),n||(n={});const s=n.through||!1,i=n.ignoreHittable||!1;this.exclude=n.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const a=this.findList,r=this.getBestMatchLeaf(),o=i?this.getPath(r):this.getHitablePath(r);return this.clear(),s?{path:o,leaf:r,throughPath:a.length?this.getThroughPath(a):o}:{path:o,leaf:r}}getBestMatchLeaf(){const{findList:e}=this;if(e.length>1){let n;this.findList=[];const{x:s,y:i}=this.point,a={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=e.length;s<i;s++)if(n=e[s],t.LeafHelper.worldHittable(n)&&(this.hitChild(n,a),this.findList.length))return this.findList[0]}return e[0]}getPath(e){const n=new t.LeafList;for(;e;)n.push(e),e=e.parent;return n.push(this.target),n}getHitablePath(e){const n=this.getPath(e);let s,i=new t.LeafList;for(let t=n.list.length-1;t>-1&&(s=n.list[t],s.__.hittable)&&(i.unshift(s),s.__.hitChildren);t--);return i}getThroughPath(e){const n=new t.LeafList,s=[];for(let t=e.length-1;t>-1;t--)s.push(this.getPath(e[t]));let i,a,r;for(let t=0,e=s.length;t<e;t++){i=s[t],a=s[t+1];for(let t=0,e=i.length;t<e&&(r=i.list[t],!a||!a.has(r));t++)n.push(r)}return n}eachFind(t,e){let n,s;const{point:i}=this;for(let a=t.length-1;a>-1;a--)n=t[a],!n.__.visible||e&&!n.__.isMask||(s=!!n.__.hitRadius||w(n.__world,i),n.isBranch?(s||n.__ignoreHitWorld)&&(this.eachFind(n.children,n.__onlyHitMask),n.isBranchLeaf&&!this.findList.length&&this.hitChild(n,i)):s&&this.hitChild(n,i))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,n){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?this.idMap[e]=t:0,innerId:(t,e)=>t.innerId===e?this.innerIdMap[e]=t:0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0},this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.pather=new x(e,this),this.__listenEvents()}getByPoint(e,n,s){return"node"===t.Platform.name&&this.target.emit(t.LayoutEvent.CHECK_UPDATE),this.pather.getByPoint(e,n,s)}getBy(t,e,n,s){switch(typeof t){case"number":const i=this.getByInnerId(t,e);return n?i:i?[i]:[];case"string":switch(t[0]){case"#":const s=this.getById(t.substring(1),e);return n?s:s?[s]:[];case".":return this.getByMethod(this.methods.className,e,n,t.substring(1));default:return this.getByMethod(this.methods.tag,e,n,t)}case"function":return this.getByMethod(t,e,n,s)}}getByInnerId(t,e){const n=this.innerIdMap[t];return n||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(e,n){const s=this.idMap[e];return s&&t.LeafHelper.hasParent(s,n||this.target)?s:(this.eachFind(this.toChildren(n),this.methods.id,null,e),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,n,s){const i=n?null:[];return this.eachFind(this.toChildren(e),t,i,s),i||this.findLeaf}eachFind(t,e,n,s){let i;for(let a=0,r=t.length;a<r;a++){if(i=t[a],e(i,s)){if(!n)return void(this.findLeaf=i);n.push(i)}i.isBranch&&this.eachFind(i.children,e,n,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:n}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[n]&&delete this.innerIdMap[n]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(t.ChildEvent.REMOVE,this.__onRemoveChild,this),this.target.on_(t.PropertyEvent.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.pather.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(t.Creator,{watcher:(t,e)=>new i(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>new B(t,e)}),t.Platform.layout=y.fullLayout;class E extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),t.Platform.roundRectPatch&&(this.context.__proto__.roundRect=null,t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=t*n,this.view.height=e*n,this.clientBounds=this.bounds}}const{mineType:b,fileType:L}=t.FileHelper;Object.assign(t.Creator,{canvas:(t,e)=>new E(t,e),image:e=>new t.LeaferImage(e),hitCanvas:(t,e)=>new E(t,e),interaction:(e,n,s,i)=>new t.InteractionBase(e,n,s,i)}),t.Platform.name="node",t.Platform.requestRender=function(t){setTimeout(t)},t.Platform.devicePixelRatio=1,t.Platform.conicGradientSupport=!0,t.Platform.realtimeLayout=!0;const{get:R,rotateOfOuter:k,translate:M,scaleOfOuter:C,scale:S,rotate:P}=t.MatrixHelper;const{get:I,translate:A}=t.MatrixHelper;function O(t,e,n,s){let{width:i,height:a}=e;const{opacity:r,mode:o,offset:d,scale:l,rotation:h,blendMode:c}=n,u=s.width===i&&s.height===a;c&&(t.blendMode=c);const f=t.data={mode:o};switch(o){case"strench":u||(i=s.width,a=s.height),(s.x||s.y)&&(f.transform=I(),A(f.transform,s.x,s.y));break;case"clip":(d||l||h)&&function(t,e,n,s,i){const a=R();M(a,e.x,e.y),n&&M(a,n.x,n.y),s&&("number"==typeof s?S(a,s):S(a,s.x,s.y),t.scaleX=a.a,t.scaleY=a.d),i&&P(a,i),t.transform=a}(f,s,d,l,h);break;case"repeat":(!u||l||h)&&function(t,e,n,s,i,a){const r=R();if(a)switch(P(r,a),a){case 90:M(r,s,0);break;case 180:M(r,n,s);break;case 270:M(r,0,n)}M(r,e.x,e.y),i&&(C(r,e,i),t.scaleX=t.scaleY=i),t.transform=r}(f,s,i,a,l,h);break;default:u&&!h||function(t,e,n,s,i,a){const r=R(),o=a&&180!==a,d=n.width/(o?i:s),l=n.height/(o?s:i),h="fit"===e?Math.min(d,l):Math.max(d,l),c=n.x+(n.width-s*h)/2,u=n.y+(n.height-i*h)/2;M(r,c,u),S(r,h),a&&k(r,{x:n.x+n.width/2,y:n.y+n.height/2},a),t.scaleX=t.scaleY=h,t.transform=r}(f,o,s,i,a,h)}f.width=i,f.height=a,r&&(f.opacity=r)}function T(t,e,n){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=n.width,e.__naturalHeight=n.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),!1}return!0}function W(e,n){n.target.hasEvent(e)&&n.target.emitEvent(new t.ImageEvent(e,n))}const{get:D,scale:H,copy:F}=t.MatrixHelper;function N(e,n,s){let{scaleX:i,scaleY:a}=e.__world;const r=i+"-"+a;if(n.patternId===r||e.destroyed)return!1;{n.patternId=r,i=Math.abs(i),a=Math.abs(a);const{image:e,data:o}=n,d=e.isSVG?4096:Math.min(e.width,4096),l=e.isSVG?4096:Math.min(e.height,4096);let h,c,{width:u,height:f,scaleX:g,scaleY:_,opacity:p,transform:y,mode:m}=o;g&&(c=D(),F(c,y),H(c,1/g,1/_),i*=g,a*=_),i*=s,a*=s,u*=i,f*=a,(u>d||f>l)&&(h=Math.max(u/d,f/l)),h&&(i/=h,a/=h,u/=h,f/=h),g&&(i/=g,a/=_),(y||1!==i||1!==a)&&(c||(c=D(),y&&F(c,y)),H(c,1/i,1/a));const v=t.Platform.canvas.createPattern(e.getCanvas(u<1?1:u,f<1?1:f,p),"repeat"===m?"repeat":t.Platform.origin.noRepeat||"no-repeat");try{n.transform&&(n.transform=null),c&&(v.setTransform?v.setTransform(c):n.transform=c)}catch(t){n.transform=c}return n.style=v,!0}}function j(e,n,i,a){const{scaleX:r,scaleY:o}=e.__world;if(i.data&&i.patternId!==r+"-"+o){if(a)if(i.image.isSVG&&"repeat"!==i.data.mode){let{width:t,height:e}=i.data;t*=r*n.pixelRatio,e*=o*n.pixelRatio,a=t>4096||e>4096}else a=!1;if(a){n.save(),n.clip();const{data:t}=i;return i.blendMode&&(n.blendMode=i.blendMode),t.opacity&&(n.opacity*=t.opacity),t.transform&&n.transform(t.transform),n.drawImage(i.image.view,0,0,t.width,t.height),n.restore(),!0}return i.style?i.patternTask||(i.patternTask=t.ImageManager.patternTasker.add((()=>s(this,void 0,void 0,(function*(){i.patternTask=null,n.bounds.hit(e.__world)&&N(e,i,n.pixelRatio),e.forceUpdate("surface")}))),300)):N(e,i,n.pixelRatio),!1}return!1}function U(e,n){const s="fill"===e?n._fill:n._stroke;if(s instanceof Array){let i,a,r,o;for(let d=0,l=s.length;d<l;d++)i=s[d].image,o=i&&i.url,o&&(a||(a={}),a[o]=!0,t.ImageManager.recycle(i),i.loading&&(r||(r=n.__input&&n.__input[e]||[],r instanceof Array||(r=[r])),i.unload(s[d].loadId,!r.some((t=>t.url===o)))));return a}return null}function Y(t,e){let n;const{rows:s,decorationY:i,decorationHeight:a}=t.__.__textDrawData;for(let t=0,r=s.length;t<r;t++)n=s[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)})),i&&e.fillRect(n.x,n.y+i,n.width,a)}function V(t,e,n,s){const{strokeAlign:i}=e.__,a="string"!=typeof t;switch(i){case"center":n.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?X(t,!0,e,n):G(e,n);break;case"inside":q("inside",t,a,e,n,s);break;case"outside":q("outside",t,a,e,n,s)}}function q(t,e,n,s,i,a){const{strokeWidth:r,__font:o}=s.__,d=i.getSameCanvas(!0);d.setStroke(n?void 0:e,2*r,s.__),d.font=o,n?X(e,!0,s,d):G(s,d),d.blendMode="outside"===t?"destination-out":"destination-in",Y(s,d),d.blendMode="normal",s.__hasMirror||a.matrix?i.copyWorldByReset(d):i.copyWorldToInner(d,s.__world,s.__layout.renderBounds),d.recycle()}function G(t,e){let n;const{rows:s,decorationY:i,decorationHeight:a}=t.__.__textDrawData;for(let t=0,r=s.length;t<r;t++)n=s[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)})),i&&e.strokeRect(n.x,n.y+i,n.width,a)}function X(t,e,n,s){let i;for(let a=0,r=t.length;a<r;a++)i=t[a],i.image&&j(n,s,i,!1)||i.style&&(s.strokeStyle=i.style,i.blendMode?(s.saveBlendMode(i.blendMode),e?G(n,s):s.stroke(),s.restoreBlendMode()):e?G(n,s):s.stroke())}const{getSpread:z,getOuterOf:Q,getByMove:Z,getIntersectData:K}=t.BoundsHelper;const $={x:.5,y:0},J={x:.5,y:1};function tt(t,e,s){let i;for(let a=0,r=e.length;a<r;a++)i=e[a],t.addColorStop(i.offset,n.ColorConvert.string(i.color,s))}const{set:et,getAngle:nt,getDistance:st}=t.PointHelper,{get:it,rotateOfOuter:at,scaleOfOuter:rt}=t.MatrixHelper,ot={x:.5,y:.5},dt={x:.5,y:1},lt={},ht={};const{set:ct,getAngle:ut,getDistance:ft}=t.PointHelper,{get:gt,rotateOfOuter:_t,scaleOfOuter:pt}=t.MatrixHelper,yt={x:.5,y:.5},mt={x:.5,y:1},vt={},wt={};let xt;function Bt(e,s,i){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:a}=i.__layout;switch(s.type){case"solid":let{type:r,blendMode:o,color:d,opacity:l}=s;return{type:r,blendMode:o,style:n.ColorConvert.string(d,l)};case"image":return function(e,n,s,i,a){const r={type:s.type},o=r.image=t.ImageManager.get(s),d=(a||o.loading)&&{target:e,image:o,attrName:n,attrValue:s};return o.ready?(T(e,n,o)&&O(r,o,s,i),a&&(W(t.ImageEvent.LOAD,d),W(t.ImageEvent.LOADED,d))):o.error?a&&(e.forceUpdate("surface"),d.error=o.error,W(t.ImageEvent.ERROR,d)):(a&&W(t.ImageEvent.LOAD,d),r.loadId=o.load((()=>{e.destroyed||(T(e,n,o)&&(O(r,o,s,i),e.forceUpdate("surface")),W(t.ImageEvent.LOADED,d))}),(n=>{e.forceUpdate("surface"),d.error=n,W(t.ImageEvent.ERROR,d)}))),r}(i,e,s,a,!xt||!xt[s.url]);case"linear":return function(e,n){let{from:s,to:i,type:a,blendMode:r,opacity:o}=e;s||(s=$),i||(i=J);const d=t.Platform.canvas.createLinearGradient(n.x+s.x*n.width,n.y+s.y*n.height,n.x+i.x*n.width,n.y+i.y*n.height);tt(d,e.stops,o);const l={type:a,style:d};return r&&(l.blendMode=r),l}(s,a);case"radial":return function(e,n){let{from:s,to:i,type:a,opacity:r,blendMode:o,stretch:d}=e;s||(s=ot),i||(i=dt);const{x:l,y:h,width:c,height:u}=n;let f;et(lt,l+s.x*c,h+s.y*u),et(ht,l+i.x*c,h+i.y*u),(c!==u||d)&&(f=it(),rt(f,lt,c/u*(d||1),1),at(f,lt,nt(lt,ht)+90));const g=t.Platform.canvas.createRadialGradient(lt.x,lt.y,0,lt.x,lt.y,st(lt,ht));tt(g,e.stops,r);const _={type:a,style:g,transform:f};return o&&(_.blendMode=o),_}(s,a);case"angular":return function(e,n){let{from:s,to:i,type:a,opacity:r,blendMode:o,stretch:d}=e;s||(s=yt),i||(i=mt);const{x:l,y:h,width:c,height:u}=n;ct(vt,l+s.x*c,h+s.y*u),ct(wt,l+i.x*c,h+i.y*u);const f=gt(),g=ut(vt,wt);t.Platform.conicGradientRotate90?(pt(f,vt,c/u*(d||1),1),_t(f,vt,g+90)):(pt(f,vt,1,c/u*(d||1)),_t(f,vt,g));const _=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,vt.x,vt.y):t.Platform.canvas.createRadialGradient(vt.x,vt.y,0,vt.x,vt.y,ft(vt,wt));tt(_,e.stops,r);const p={type:a,style:_,transform:f};return o&&(p.blendMode=o),p}(s,a);default:return s.r?{type:"solid",style:n.ColorConvert.string(s)}:void 0}}var Et=Object.freeze({__proto__:null,compute:function(t,e){const s=[],i=e.__;let a,r,o=i.__input[t];o instanceof Array||(o=[o]),xt=U(t,i);for(let n=0,i=o.length;n<i;n++)a=Bt(t,o[n],e),a&&s.push(a);if(i["_"+t]=s.length?s:void 0,1===o.length){const t=o[0];"image"===t.type&&(r=n.ImageManager.isPixel(t))}"fill"===t?i.__pixelFill=r:i.__pixelStroke=r},drawTextStroke:G,fill:function(t,e,n){n.fillStyle=t,e.__.__font?Y(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fillText:Y,fills:function(t,e,n){let s;const{windingRule:i,__font:a}=e.__;for(let r=0,o=t.length;r<o;r++)s=t[r],s.image&&j(e,n,s,!a)||s.style&&(n.fillStyle=s.style,s.transform?(n.save(),n.transform(s.transform),s.blendMode&&(n.blendMode=s.blendMode),a?Y(e,n):i?n.fill(i):n.fill(),n.restore()):s.blendMode?(n.saveBlendMode(s.blendMode),a?Y(e,n):i?n.fill(i):n.fill(),n.restoreBlendMode()):a?Y(e,n):i?n.fill(i):n.fill())},recycleImage:U,shape:function(t,e,n){const s=e.getSameCanvas();let i,a,r,o;const{__world:d}=t;let{scaleX:l,scaleY:h}=d;if(l<0&&(l=-l),h<0&&(h=-h),e.bounds.includes(d,n.matrix))n.matrix?(l*=n.matrix.a,h*=n.matrix.d,i=r=Q(d,n.matrix)):i=r=d,o=s;else{const{renderShapeSpread:s}=t.__layout,c=K(s?z(e.bounds,s*l,s*h):e.bounds,d,n.matrix);a=e.bounds.getFitMatrix(c),a.a<1&&(o=e.getSameCanvas(),t.__renderShape(o,n),l*=a.a,h*=a.d),r=Q(d,a),i=Z(r,-a.e,-a.f),n.matrix&&a.multiply(n.matrix),n=Object.assign(Object.assign({},n),{matrix:a})}return t.__renderShape(s,n),{canvas:s,matrix:a,bounds:i,worldCanvas:o,shapeBounds:r,scaleX:l,scaleY:h}},stroke:function(t,e,n,s){const i=e.__,{strokeWidth:a,strokeAlign:r,__font:o}=i;if(a)if(o)V(t,e,n,s);else switch(r){case"center":n.setStroke(t,a,i),n.stroke();break;case"inside":n.save(),n.setStroke(t,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const r=n.getSameCanvas(!0);r.setStroke(t,2*a,e.__),e.__drawRenderPath(r),r.stroke(),i.windingRule?r.clip(i.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__hasMirror||s.matrix?n.copyWorldByReset(r):n.copyWorldToInner(r,e.__world,e.__layout.renderBounds),r.recycle()}},strokeText:V,strokes:function(t,e,n,s){const i=e.__,{strokeWidth:a,strokeAlign:r,__font:o}=i;if(a)if(o)V(t,e,n,s);else switch(r){case"center":n.setStroke(void 0,a,i),X(t,!1,e,n);break;case"inside":n.save(),n.setStroke(void 0,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),X(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:r}=e.__layout,o=n.getSameCanvas(!0);e.__drawRenderPath(o),o.setStroke(void 0,2*a,e.__),X(t,!1,e,o),i.windingRule?o.clip(i.windingRule):o.clip(),o.clearWorld(r),e.__hasMirror||s.matrix?n.copyWorldByReset(o):n.copyWorldToInner(o,e.__world,r),o.recycle()}}});const{copy:bt,toOffsetOutBounds:Lt}=t.BoundsHelper,Rt={},kt={};function Mt(e,n,s,i){const{bounds:a,shapeBounds:r}=i;if(t.Platform.fullImageShadow){if(bt(Rt,e.bounds),Rt.x+=n.x-r.x,Rt.y+=n.y-r.y,s){const{matrix:t}=i;Rt.x-=(a.x+(t?t.e:0)+a.width/2)*(s-1),Rt.y-=(a.y+(t?t.f:0)+a.height/2)*(s-1),Rt.width*=s,Rt.height*=s}e.copyWorld(i.canvas,e.bounds,Rt)}else s&&(bt(Rt,n),Rt.x-=n.width/2*(s-1),Rt.y-=n.height/2*(s-1),Rt.width*=s,Rt.height*=s),e.copyWorld(i.canvas,r,s?Rt:n)}const{toOffsetOutBounds:Ct}=t.BoundsHelper,St={};var Pt=Object.freeze({__proto__:null,blur:function(t,e,n){const{blur:s}=t.__;n.setWorldBlur(s*t.__world.a),n.copyWorldToInner(e,t.__world,t.__layout.renderBounds),n.filter="none"},innerShadow:function(t,e,n,s){let i,a;const{__world:r,__layout:o}=t,{innerShadow:d}=t.__,{worldCanvas:l,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=n,g=e.getSameCanvas(),_=d.length-1;Ct(h,St),d.forEach(((d,p)=>{g.save(),g.setWorldShadow(St.offsetX+d.x*u,St.offsetY+d.y*f,d.blur*u),a=d.spread?1-2*d.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Mt(g,St,a,n),g.restore(),l?(g.copyWorld(g,h,r,"copy"),g.copyWorld(l,r,r,"source-out"),i=r):(g.copyWorld(n.canvas,c,h,"source-out"),i=h),g.fillWorld(i,d.color,"source-in"),t.__hasMirror||s.matrix?e.copyWorldByReset(g,i,r,d.blendMode):e.copyWorldToInner(g,i,o.renderBounds,d.blendMode),_&&p<_&&g.clear()})),g.recycle()},shadow:function(t,e,n,s){let i,a;const{__world:r,__layout:o}=t,{shadow:d}=t.__,{worldCanvas:l,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=n,g=e.getSameCanvas(),_=d.length-1;Lt(h,kt),d.forEach(((d,p)=>{g.setWorldShadow(kt.offsetX+d.x*u,kt.offsetY+d.y*f,d.blur*u,d.color),a=d.spread?1+2*d.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Mt(g,kt,a,n),i=h,d.box&&(g.restore(),g.save(),l&&(g.copyWorld(g,h,r,"copy"),i=r),l?g.copyWorld(l,r,r,"destination-out"):g.copyWorld(n.canvas,c,h,"destination-out")),t.__hasMirror||s.matrix?e.copyWorldByReset(g,i,r,d.blendMode):e.copyWorldToInner(g,i,o.renderBounds,d.blendMode),_&&p<_&&g.clear()})),g.recycle()}});const It=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",At=It+"_#~&*+\\=|≮≯≈≠=…",Ot=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function Tt(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Wt=Tt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Dt=Tt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ht=Tt(It),Ft=Tt(At),Nt=Tt("- —/~|┆·");var jt;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(jt||(jt={}));const{Letter:Ut,Single:Yt,Before:Vt,After:qt,Symbol:Gt,Break:Xt}=jt;function zt(t){return Wt[t]?Ut:Nt[t]?Xt:Dt[t]?Vt:Ht[t]?qt:Ft[t]?Gt:Ot.test(t)?Yt:Ut}const Qt={trimRight(t){const{words:e}=t;let n,s=0,i=e.length;for(let a=i-1;a>-1&&(n=e[a].data[0]," "===n.char);a--)s++,t.width-=n.width;s&&e.splice(i-s,s)}};function Zt(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Kt}=Qt,{Letter:$t,Single:Jt,Before:te,After:ee,Symbol:ne,Break:se}=jt;let ie,ae,re,oe,de,le,he,ce,ue,fe,ge,_e,pe,ye,me,ve,we=[];function xe(t,e){ue&&!ce&&(ce=ue),ie.data.push({char:t,width:e}),re+=e}function Be(){oe+=re,ie.width=re,ae.words.push(ie),ie={data:[]},re=0}function Ee(){ye&&(me.paraNumber++,ae.paraStart=!0,ye=!1),ue&&(ae.startCharSize=ce,ae.endCharSize=ue,ce=0),ae.width=oe,ve.width&&Kt(ae),we.push(ae),ae={words:[]},oe=0}const be={getDrawData(e,n){"string"!=typeof e&&(e=String(e));let s=0,i=0,a=n.__getInput("width")||0,r=n.__getInput("height")||0;const{textDecoration:o,__font:d,padding:l}=n;if(l){const[e,n,o,d]=t.MathHelper.fourNumber(l);a&&(s=d,a-=n+d),r&&(i=e,r-=e+o)}const h={bounds:{x:s,y:i,width:a,height:r},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,s){me=e,we=e.rows,ve=e.bounds;const{__letterSpacing:i,paraIndent:a,textCase:r}=s,{canvas:o}=t.Platform,{width:d,height:l}=ve;if(d||l||i||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;ye=!0,ge=null,ce=he=ue=re=oe=0,ie={data:[]},ae={words:[]};for(let s=0,l=n.length;s<l;s++)le=n[s],"\n"===le?(re&&Be(),ae.paraEnd=!0,Ee(),ye=!0):(fe=zt(le),fe===$t&&"none"!==r&&(le=Zt(le,r,!re)),he=o.measureText(le).width,i&&(i<0&&(ue=he),he+=i),_e=fe===Jt&&(ge===Jt||ge===$t)||ge===Jt&&fe!==ee,pe=!(fe!==te&&fe!==Jt||ge!==ne&&ge!==ee),de=ye&&a?d-a:d,t&&d&&oe+re+he>de&&(e?(re&&Be(),Ee()):(pe||(pe=fe===$t&&ge==ee),_e||pe||fe===se||fe===te||fe===Jt||re+he>de?(re&&Be(),Ee()):Ee()))," "===le&&!0!==ye&&oe+re===0||(fe===se?(" "===le&&re&&Be(),xe(le,he),Be()):_e||pe?(re&&Be(),xe(le,he)):xe(le,he)),ge=fe);re&&Be(),oe&&Ee(),we.length>0&&(we[we.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{me.paraNumber++,we.push({x:a||0,text:t,width:o.measureText(t).width,paraStart:!0})}))}(h,e,n),function(t,e){const{rows:n,bounds:s}=t,{__lineHeight:i,__baseLine:a,__letterSpacing:r,__clipText:o,textAlign:d,verticalAlign:l,paraSpacing:h}=e;let c,u,f,{x:g,y:_,width:p,height:y}=s,m=i*n.length+(h?h*(t.paraNumber-1):0),v=a;if(o&&m>y)m=Math.max(y,i),t.overflow=n.length;else switch(l){case"middle":_+=(y-m)/2;break;case"bottom":_+=y-m}v+=_;for(let a=0,l=n.length;a<l;a++){switch(c=n[a],c.x=g,d){case"center":c.x+=(p-c.width)/2;break;case"right":c.x+=p-c.width}c.paraStart&&h&&a>0&&(v+=h),c.y=v,v+=i,t.overflow>a&&v>m&&(c.isOverflow=!0,t.overflow=a+1),u=c.x,f=c.width,r<0&&(c.width<0?(f=-c.width+e.fontSize+r,u-=f,f+=e.fontSize):f-=r),u<s.x&&(s.x=u),f>s.width&&(s.width=f),o&&p&&p<f&&(c.isOverflow=!0,t.overflow||(t.overflow=n.length))}s.y=_,s.height=m}(h,n),function(t,e,n,s){const{rows:i}=t,{textAlign:a,paraIndent:r,letterSpacing:o}=e;let d,l,h,c,u;i.forEach((t=>{t.words&&(h=r&&t.paraStart?r:0,l=n&&"justify"===a&&t.words.length>1?(n-t.width-h)/(t.words.length-1):0,c=o||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===c?(t.x+=h,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=h,d=t.x,t.data=[],t.words.forEach((e=>{1===c?(u={char:"",x:d},d=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,n){return t.forEach((t=>{" "!==t.char&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&l&&(d+=l,t.width+=l)}))),t.words=null)}))}(h,n,a),h.overflow&&function(e,n){const{rows:s,overflow:i}=e;let{textOverflow:a}=n;if(s.splice(i),"hide"!==a){let e,r;"ellipsis"===a&&(a="...");const o=t.Platform.canvas.measureText(a).width,d=n.x+n.width-o;("none"===n.textWrap?s:[s[i-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let s=n;s>-1&&(e=t.data[s],r=e.x+e.width,!(s===n&&r<d));s--){if(r<d&&" "!==e.char){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=o,t.data.push({char:a,x:r}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(h,n),"none"!==o&&function(t,e){const{fontSize:n}=e;switch(t.decorationHeight=n/11,e.textDecoration){case"under":t.decorationY=.15*n;break;case"delete":t.decorationY=.35*-n}}(h,n),h}},Le={string(t,e){if("string"==typeof t)return t;let n=void 0===t.a?1:t.a;e&&(n*=e);const s=t.r+","+t.g+","+t.b;return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}},Re={export(e,n,i){return function(e){ke||(ke=new t.TaskProcessor);return new Promise((t=>{ke.add((()=>s(this,void 0,void 0,(function*(){return yield e(t)}))),{parallel:!1})}))}((t=>new Promise((a=>{const{leafer:r}=e;r?r.waitViewCompleted((()=>s(this,void 0,void 0,(function*(){let e,s,o,{canvas:d}=r,{unreal:l}=d;switch(l&&(d=d.getSameCanvas(),d.backgroundColor=r.config.fill,r.__render(d,{})),typeof i){case"object":i.quality&&(e=i.quality),i.blob&&(s=!0);break;case"number":e=i;break;case"boolean":s=i}o=n.includes(".")?yield d.saveAs(n,e):s?yield d.toBlob(n,e):yield d.toDataURL(n,e),t({data:o}),a(),l&&d.recycle()})))):(t({data:!1}),a())}))))}};let ke;Object.assign(n.Paint,Et),Object.assign(n.Effect,Pt),Object.assign(n.TextConvert,be),Object.assign(n.ColorConvert,Le),Object.assign(n.Export,Re),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=y,exports.LeaferCanvas=E,exports.Renderer=v,exports.Selector=B,exports.Watcher=i,exports.useCanvas=function(n,i){if(t.Platform.canvasType=n,!t.Platform.origin){if("skia"===n){const{Canvas:e,loadImage:n}=i;t.Platform.origin={createCanvas:(t,n,s)=>new e(t,n,s),canvasToDataURL:(t,e,n)=>t.toDataURLSync(e,{quality:n}),canvasToBolb:(t,e,n)=>t.toBuffer(e,{quality:n}),canvasSaveAs:(t,e,n)=>t.saveAs(e,{quality:n}),loadImage:n},t.Platform.roundRectPatch=!0}else if("napi"===n){const{Canvas:n,loadImage:a}=i;t.Platform.origin={createCanvas:(t,e,s)=>new n(t,e,s),canvasToDataURL:(t,e,n)=>t.toDataURL(b(e),n),canvasToBolb:(t,e,n)=>s(this,void 0,void 0,(function*(){return t.toBuffer(b(e),n)})),canvasSaveAs:(t,n,i)=>s(this,void 0,void 0,(function*(){return e.writeFileSync(n,t.toBuffer(b(L(n)),i))})),loadImage:a}}t.Platform.ellipseToCurve=!0,t.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},t.Platform.canvas=t.Creator.canvas()}},Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(n).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return n[t]}})}));
1
+ "use strict";var t=require("@leafer/core"),e=require("fs"),n=require("@leafer-ui/core");function i(t,e,n,i){return new(n||(n=Promise))((function(s,a){function r(t){try{d(i.next(t))}catch(t){a(t)}}function o(t){try{d(i.throw(t))}catch(t){a(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,o)}d((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class s{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:a,updateBounds:r,updateAllWorldOpacity:o}=t.LeafHelper,{pushAllChildBranch:d,pushAllParent:l}=t.BranchHelper;const{worldBounds:h}=t.LeafBoundsHelper,c={x:0,y:0,width:1e5,height:1e5};class u{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,h)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(c):this.afterBounds.setListWithFn(t,h),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:f,updateAllChange:g}=t.LeafHelper,_=t.Debug.get("Layouter");class p{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){_.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?_.warn("layouting"):this.times>3?_.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:h,LAYOUT:c,AFTER:u}=t.LayoutEvent,f=this.getBlocks(s);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(h,f,this.times)),this.extraBlock=null,s.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(a(t,!0),e.add(t),t.isBranch&&d(t,e),l(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),l(t,e)))}))}(s,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||r(i[t])}r(n)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&o(t),t.__updateChange()}))}(s),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(c,f,this.times)),i.emitEvent(new t.LayoutEvent(u,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:s,AFTER:a}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,r,this.times)),p.fullLayout(n),r.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(s,r,this.times)),n.emitEvent(new t.LayoutEvent(a,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){f(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),g(e)}addExtra(t){const e=this.extraBlock||(this.extraBlock=new u([]));e.updatedList.add(t),e.beforeBounds.add(t.__world)}createBlock(t){return new u(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const y=t.Debug.get("Renderer");class m{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}render(e){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,y.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,y.error(t)}y.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){return this.rendering?y.warn("rendering"):this.times>3?y.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e?(this.emitRender(t.RenderEvent.BEFORE),e()):(this.requestLayout(),this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return y.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,s=e.getIntersect(i.bounds),a=e.includes(this.target.__world),r=new t.Bounds(s);i.save(),a&&!t.Debug.showRepaint?i.clear():(s.spread(1+1/this.canvas.pixelRatio).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0)),this.__render(s,a,r),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds,!0),n.restore(),t.Run.end(e)}__render(e,n,i){const s=e.includes(this.target.__world)?{includes:n}:{bounds:e,includes:n};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.Debug.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,s),this.renderBounds=i||e,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),t.Debug.showHitView&&this.renderHitView(s),t.Debug.showBoundsView&&this.renderBoundsView(s),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(t.AnimateEvent.FRAME),this.target&&this.__requestRender()}))}__onResize(e){if(!this.canvas.unreal&&(e.bigger||!e.samePixelRatio)){const{width:n,height:i}=e.old;new t.Bounds(0,0,n,i).includes(this.target.__world)&&!this.needFill&&e.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||y.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}var v;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(v||(v={}));const{hitRadiusPoint:w}=t.BoundsHelper;class x{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,n){e||(e=0),n||(n={});const i=n.through||!1,s=n.ignoreHittable||!1;this.exclude=n.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const a=this.findList,r=this.getBestMatchLeaf(),o=s?this.getPath(r):this.getHitablePath(r);return this.clear(),i?{path:o,leaf:r,throughPath:a.length?this.getThroughPath(a):o}:{path:o,leaf:r}}getBestMatchLeaf(){const{findList:e}=this;if(e.length>1){let n;this.findList=[];const{x:i,y:s}=this.point,a={x:i,y:s,radiusX:0,radiusY:0};for(let i=0,s=e.length;i<s;i++)if(n=e[i],t.LeafHelper.worldHittable(n)&&(this.hitChild(n,a),this.findList.length))return this.findList[0]}return e[0]}getPath(e){const n=new t.LeafList;for(;e;)n.add(e),e=e.parent;return n.add(this.target),n}getHitablePath(e){const n=this.getPath(e);let i,s=new t.LeafList;for(let t=n.list.length-1;t>-1&&(i=n.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(e){const n=new t.LeafList,i=[];for(let t=e.length-1;t>-1;t--)i.push(this.getPath(e[t]));let s,a,r;for(let t=0,e=i.length;t<e;t++){s=i[t],a=i[t+1];for(let t=0,e=s.length;t<e&&(r=s.list[t],!a||!a.has(r));t++)n.add(r)}return n}eachFind(t,e){let n,i;const{point:s}=this;for(let a=t.length-1;a>-1;a--)n=t[a],!n.__.visible||e&&!n.__.isMask||(i=!!n.__.hitRadius||w(n.__world,s),n.isBranch?(i||n.__ignoreHitWorld)&&(this.eachFind(n.children,n.__onlyHitMask),n.isBranchLeaf&&!this.findList.length&&this.hitChild(n,s)):i&&this.hitChild(n,s))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}const{Yes:B,NoAndSkip:b,YesAndSkip:E}=v;class L{constructor(e,n){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.idMap[e]=t,1):0,innerId:(t,e)=>t.innerId===e?(this.innerIdMap[e]=t,1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0},this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.pather=new x(e,this),this.__listenEvents()}getBy(t,e,n,i){switch(typeof t){case"number":const s=this.getByInnerId(t,e);return n?s:s?[s]:[];case"string":switch(t[0]){case"#":const i=this.getById(t.substring(1),e);return n?i:i?[i]:[];case".":return this.getByMethod(this.methods.className,e,n,t.substring(1));default:return this.getByMethod(this.methods.tag,e,n,t)}case"function":return this.getByMethod(t,e,n,i)}}getByPoint(e,n,i){return"node"===t.Platform.name&&this.target.emit(t.LayoutEvent.CHECK_UPDATE),this.pather.getByPoint(e,n,i)}getByInnerId(t,e){const n=this.innerIdMap[t];return n||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(e,n){const i=this.idMap[e];return i&&t.LeafHelper.hasParent(i,n||this.target)?i:(this.eachFind(this.toChildren(n),this.methods.id,null,e),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,n,i){const s=n?null:[];return this.eachFind(this.toChildren(e),t,s,i),s||this.findLeaf}eachFind(t,e,n,i){let s,a;for(let r=0,o=t.length;r<o;r++){if(s=t[r],a=e(s,i),a===B||a===E){if(!n)return void(this.findLeaf=s);n.push(s)}s.isBranch&&a<b&&this.eachFind(s.children,e,n,i)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:n}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[n]&&delete this.innerIdMap[n]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(t.ChildEvent.REMOVE,this.__onRemoveChild,this),this.target.on_(t.PropertyEvent.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.pather.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(t.Creator,{watcher:(t,e)=>new s(t,e),layouter:(t,e)=>new p(t,e),renderer:(t,e,n)=>new m(t,e,n),selector:(t,e)=>new L(t,e)}),t.Platform.layout=p.fullLayout;class R extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),t.Platform.roundRectPatch&&(this.context.__proto__.roundRect=null,t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=t*n,this.view.height=e*n,this.clientBounds=this.bounds}}const{mineType:k,fileType:S}=t.FileHelper;Object.assign(t.Creator,{canvas:(t,e)=>new R(t,e),image:e=>new t.LeaferImage(e),hitCanvas:(t,e)=>new R(t,e),interaction:(e,n,i,s)=>new t.InteractionBase(e,n,i,s)}),t.Platform.name="node",t.Platform.requestRender=function(t){setTimeout(t)},t.Platform.devicePixelRatio=1,t.Platform.conicGradientSupport=!0;const{get:C,rotateOfOuter:M,translate:P,scaleOfOuter:A,scale:I,rotate:O}=t.MatrixHelper;const{get:T,translate:D}=t.MatrixHelper;function W(t,e,n,i){let{width:s,height:a}=e;const{opacity:r,mode:o,offset:d,scale:l,rotation:h,blendMode:c}=n,u=i.width===s&&i.height===a;c&&(t.blendMode=c);const f=t.data={mode:o};switch(o){case"strench":u||(s=i.width,a=i.height),(i.x||i.y)&&(f.transform=T(),D(f.transform,i.x,i.y));break;case"clip":(d||l||h)&&function(t,e,n,i,s){const a=C();P(a,e.x,e.y),n&&P(a,n.x,n.y),i&&("number"==typeof i?I(a,i):I(a,i.x,i.y),t.scaleX=a.a,t.scaleY=a.d),s&&O(a,s),t.transform=a}(f,i,d,l,h);break;case"repeat":(!u||l||h)&&function(t,e,n,i,s,a){const r=C();if(a)switch(O(r,a),a){case 90:P(r,i,0);break;case 180:P(r,n,i);break;case 270:P(r,0,n)}P(r,e.x,e.y),s&&(A(r,e,s),t.scaleX=t.scaleY=s),t.transform=r}(f,i,s,a,l,h);break;default:u&&!h||function(t,e,n,i,s,a){const r=C(),o=a&&180!==a,d=n.width/(o?s:i),l=n.height/(o?i:s),h="fit"===e?Math.min(d,l):Math.max(d,l),c=n.x+(n.width-i*h)/2,u=n.y+(n.height-s*h)/2;P(r,c,u),I(r,h),a&&M(r,{x:n.x+n.width/2,y:n.y+n.height/2},a),t.scaleX=t.scaleY=h,t.transform=r}(f,o,i,s,a,h)}f.width=s,f.height=a,r&&(f.opacity=r)}function H(t,e,n){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=n.width,e.__naturalHeight=n.height,!e.__getInput("width")||!e.__getInput("height"))return t.__proxyData&&(t.setProxyAttr("width",t.__.width),t.setProxyAttr("height",t.__.height)),t.forceUpdate("width"),!1}return!0}function F(e,n){n.target.hasEvent(e)&&n.target.emitEvent(new t.ImageEvent(e,n))}const N={},{get:Y,scale:j,copy:U}=t.MatrixHelper;function q(e,n,i){let{scaleX:s,scaleY:a}=e.__world;const r=s+"-"+a;if(n.patternId===r||e.destroyed)return!1;{s=Math.abs(s),a=Math.abs(a);const{image:e,data:o}=n;let d,l,{width:h,height:c,scaleX:u,scaleY:f,opacity:g,transform:_,mode:p}=o;u&&(l=Y(),U(l,_),j(l,1/u,1/f),s*=u,a*=f),s*=i,a*=i,h*=s,c*=a;const y=h*c;if("repeat"!==n.data.mode&&y>t.Platform.image.maxCacheSize)return!1;let m=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;m>t&&(m=t)}y>m&&(d=Math.sqrt(y/m)),d&&(s/=d,a/=d,h/=d,c/=d),u&&(s/=u,a/=f),(_||1!==s||1!==a)&&(l||(l=Y(),_&&U(l,_)),j(l,1/s,1/a));const v=t.Platform.canvas.createPattern(e.getCanvas(h<1?1:h,c<1?1:c,g),"repeat"===p?"repeat":t.Platform.origin.noRepeat||"no-repeat");try{n.transform&&(n.transform=null),l&&(v.setTransform?v.setTransform(l):n.transform=l)}catch(t){n.transform=l}return n.style=v,n.patternId=r,!0}}const{abs:V}=Math;function X(e,n,s,a){const{scaleX:r,scaleY:o}=e.__world;if(s.data&&s.patternId!==r+"-"+o){const{data:d}=s;if(a)if("repeat"!==d.mode){let{width:e,height:i}=d;e*=V(r)*n.pixelRatio,i*=V(o)*n.pixelRatio,d.scaleX&&(e*=d.scaleX,i*=d.scaleY),a=e*i>t.Platform.image.maxCacheSize}else a=!1;return a?(n.save(),n.clip(),s.blendMode&&(n.blendMode=s.blendMode),d.opacity&&(n.opacity*=d.opacity),d.transform&&n.transform(d.transform),n.drawImage(s.image.view,0,0,d.width,d.height),n.restore(),!0):(!s.style||N.running?q(e,s,n.pixelRatio):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>i(this,void 0,void 0,(function*(){s.patternTask=null,n.bounds.hit(e.__world)&&q(e,s,n.pixelRatio),e.forceUpdate("surface")}))),300)),!1)}return!1}function z(e,n){const i=n["_"+e];if(i instanceof Array){let s,a,r,o;for(let d=0,l=i.length;d<l;d++)s=i[d].image,o=s&&s.url,o&&(a||(a={}),a[o]=!0,t.ImageManager.recycle(s),s.loading&&(r||(r=n.__input&&n.__input[e]||[],r instanceof Array||(r=[r])),s.unload(i[d].loadId,!r.some((t=>t.url===o)))));return a}return null}function G(t,e){let n;const{rows:i,decorationY:s,decorationHeight:a}=t.__.__textDrawData;for(let t=0,r=i.length;t<r;t++)n=i[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)})),s&&e.fillRect(n.x,n.y+s,n.width,a)}function Q(t,e,n,i){const{strokeAlign:s}=e.__,a="string"!=typeof t;switch(s){case"center":n.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?$(t,!0,e,n):K(e,n);break;case"inside":Z("inside",t,a,e,n,i);break;case"outside":Z("outside",t,a,e,n,i)}}function Z(t,e,n,i,s,a){const{strokeWidth:r,__font:o}=i.__,d=s.getSameCanvas(!0);d.setStroke(n?void 0:e,2*r,i.__),d.font=o,n?$(e,!0,i,d):K(i,d),d.blendMode="outside"===t?"destination-out":"destination-in",G(i,d),d.blendMode="normal",i.__worldFlipped||a.matrix?s.copyWorldByReset(d):s.copyWorldToInner(d,i.__world,i.__layout.renderBounds),d.recycle()}function K(t,e){let n;const{rows:i,decorationY:s,decorationHeight:a}=t.__.__textDrawData;for(let t=0,r=i.length;t<r;t++)n=i[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)})),s&&e.strokeRect(n.x,n.y+s,n.width,a)}function $(t,e,n,i){let s;for(let a=0,r=t.length;a<r;a++)s=t[a],s.image&&X(n,i,s,!1)||s.style&&(i.strokeStyle=s.style,s.blendMode?(i.saveBlendMode(s.blendMode),e?K(n,i):i.stroke(),i.restoreBlendMode()):e?K(n,i):i.stroke())}const{getSpread:J,getOuterOf:tt,getByMove:et,getIntersectData:nt}=t.BoundsHelper;const it={x:.5,y:0},st={x:.5,y:1};function at(t,e,i){let s;for(let a=0,r=e.length;a<r;a++)s=e[a],t.addColorStop(s.offset,n.ColorConvert.string(s.color,i))}const{set:rt,getAngle:ot,getDistance:dt}=t.PointHelper,{get:lt,rotateOfOuter:ht,scaleOfOuter:ct}=t.MatrixHelper,ut={x:.5,y:.5},ft={x:.5,y:1},gt={},_t={};const{set:pt,getAngle:yt,getDistance:mt}=t.PointHelper,{get:vt,rotateOfOuter:wt,scaleOfOuter:xt}=t.MatrixHelper,Bt={x:.5,y:.5},bt={x:.5,y:1},Et={},Lt={};let Rt;function kt(e,i,s){if("object"!=typeof i||!1===i.visible||0===i.opacity)return;const{boxBounds:a}=s.__layout;switch(i.type){case"solid":let{type:r,blendMode:o,color:d,opacity:l}=i;return{type:r,blendMode:o,style:n.ColorConvert.string(d,l)};case"image":return function(e,n,i,s,a){const r={type:i.type},o=r.image=t.ImageManager.get(i),d=(a||o.loading)&&{target:e,image:o,attrName:n,attrValue:i};return o.ready?(H(e,n,o)&&W(r,o,i,s),a&&(F(t.ImageEvent.LOAD,d),F(t.ImageEvent.LOADED,d))):o.error?a&&(e.forceUpdate("surface"),d.error=o.error,F(t.ImageEvent.ERROR,d)):(a&&F(t.ImageEvent.LOAD,d),r.loadId=o.load((()=>{e.destroyed||(H(e,n,o)&&(W(r,o,i,s),e.forceUpdate("surface")),F(t.ImageEvent.LOADED,d))}),(n=>{e.forceUpdate("surface"),d.error=n,F(t.ImageEvent.ERROR,d)}))),r}(s,e,i,a,!Rt||!Rt[i.url]);case"linear":return function(e,n){let{from:i,to:s,type:a,blendMode:r,opacity:o}=e;i||(i=it),s||(s=st);const d=t.Platform.canvas.createLinearGradient(n.x+i.x*n.width,n.y+i.y*n.height,n.x+s.x*n.width,n.y+s.y*n.height);at(d,e.stops,o);const l={type:a,style:d};return r&&(l.blendMode=r),l}(i,a);case"radial":return function(e,n){let{from:i,to:s,type:a,opacity:r,blendMode:o,stretch:d}=e;i||(i=ut),s||(s=ft);const{x:l,y:h,width:c,height:u}=n;let f;rt(gt,l+i.x*c,h+i.y*u),rt(_t,l+s.x*c,h+s.y*u),(c!==u||d)&&(f=lt(),ct(f,gt,c/u*(d||1),1),ht(f,gt,ot(gt,_t)+90));const g=t.Platform.canvas.createRadialGradient(gt.x,gt.y,0,gt.x,gt.y,dt(gt,_t));at(g,e.stops,r);const _={type:a,style:g,transform:f};return o&&(_.blendMode=o),_}(i,a);case"angular":return function(e,n){let{from:i,to:s,type:a,opacity:r,blendMode:o,stretch:d}=e;i||(i=Bt),s||(s=bt);const{x:l,y:h,width:c,height:u}=n;pt(Et,l+i.x*c,h+i.y*u),pt(Lt,l+s.x*c,h+s.y*u);const f=vt(),g=yt(Et,Lt);t.Platform.conicGradientRotate90?(xt(f,Et,c/u*(d||1),1),wt(f,Et,g+90)):(xt(f,Et,1,c/u*(d||1)),wt(f,Et,g));const _=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Et.x,Et.y):t.Platform.canvas.createRadialGradient(Et.x,Et.y,0,Et.x,Et.y,mt(Et,Lt));at(_,e.stops,r);const p={type:a,style:_,transform:f};return o&&(p.blendMode=o),p}(i,a);default:return i.r?{type:"solid",style:n.ColorConvert.string(i)}:void 0}}var St=Object.freeze({__proto__:null,compute:function(t,e){const i=[],s=e.__;let a,r,o=s.__input[t];o instanceof Array||(o=[o]),Rt=z(t,s);for(let n=0,s=o.length;n<s;n++)a=kt(t,o[n],e),a&&i.push(a);if(s["_"+t]=i.length?i:void 0,1===o.length){const t=o[0];"image"===t.type&&(r=n.ImageManager.isPixel(t))}"fill"===t?s.__pixelFill=r:s.__pixelStroke=r},drawTextStroke:K,fill:function(t,e,n){n.fillStyle=t,e.__.__font?G(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fillText:G,fills:function(t,e,n){let i;const{windingRule:s,__font:a}=e.__;for(let r=0,o=t.length;r<o;r++)i=t[r],i.image&&X(e,n,i,!a)||i.style&&(n.fillStyle=i.style,i.transform?(n.save(),n.transform(i.transform),i.blendMode&&(n.blendMode=i.blendMode),a?G(e,n):s?n.fill(s):n.fill(),n.restore()):i.blendMode?(n.saveBlendMode(i.blendMode),a?G(e,n):s?n.fill(s):n.fill(),n.restoreBlendMode()):a?G(e,n):s?n.fill(s):n.fill())},recycleImage:z,shape:function(t,e,n){const i=e.getSameCanvas();let s,a,r,o;const{__world:d}=t;let{scaleX:l,scaleY:h}=d;if(l<0&&(l=-l),h<0&&(h=-h),e.bounds.includes(d,n.matrix))n.matrix?(l*=n.matrix.a,h*=n.matrix.d,s=r=tt(d,n.matrix)):s=r=d,o=i;else{const{renderShapeSpread:i}=t.__layout,c=nt(i?J(e.bounds,i*l,i*h):e.bounds,d,n.matrix);a=e.bounds.getFitMatrix(c),a.a<1&&(o=e.getSameCanvas(),t.__renderShape(o,n),l*=a.a,h*=a.d),r=tt(d,a),s=et(r,-a.e,-a.f),n.matrix&&a.multiply(n.matrix),n=Object.assign(Object.assign({},n),{matrix:a})}return t.__renderShape(i,n),{canvas:i,matrix:a,bounds:s,worldCanvas:o,shapeBounds:r,scaleX:l,scaleY:h}},stroke:function(t,e,n,i){const s=e.__,{strokeWidth:a,strokeAlign:r,__font:o}=s;if(a)if(o)Q(t,e,n,i);else switch(r){case"center":n.setStroke(t,a,s),n.stroke();break;case"inside":n.save(),n.setStroke(t,2*a,s),s.windingRule?n.clip(s.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const r=n.getSameCanvas(!0);r.setStroke(t,2*a,e.__),e.__drawRenderPath(r),r.stroke(),s.windingRule?r.clip(s.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__worldFlipped||i.matrix?n.copyWorldByReset(r):n.copyWorldToInner(r,e.__world,e.__layout.renderBounds),r.recycle()}},strokeText:Q,strokes:function(t,e,n,i){const s=e.__,{strokeWidth:a,strokeAlign:r,__font:o}=s;if(a)if(o)Q(t,e,n,i);else switch(r){case"center":n.setStroke(void 0,a,s),$(t,!1,e,n);break;case"inside":n.save(),n.setStroke(void 0,2*a,s),s.windingRule?n.clip(s.windingRule):n.clip(),$(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:r}=e.__layout,o=n.getSameCanvas(!0);e.__drawRenderPath(o),o.setStroke(void 0,2*a,e.__),$(t,!1,e,o),s.windingRule?o.clip(s.windingRule):o.clip(),o.clearWorld(r),e.__worldFlipped||i.matrix?n.copyWorldByReset(o):n.copyWorldToInner(o,e.__world,r),o.recycle()}}});const{copy:Ct,toOffsetOutBounds:Mt}=t.BoundsHelper,Pt={},At={};function It(e,n,i,s){const{bounds:a,shapeBounds:r}=s;if(t.Platform.fullImageShadow){if(Ct(Pt,e.bounds),Pt.x+=n.x-r.x,Pt.y+=n.y-r.y,i){const{matrix:t}=s;Pt.x-=(a.x+(t?t.e:0)+a.width/2)*(i-1),Pt.y-=(a.y+(t?t.f:0)+a.height/2)*(i-1),Pt.width*=i,Pt.height*=i}e.copyWorld(s.canvas,e.bounds,Pt)}else i&&(Ct(Pt,n),Pt.x-=n.width/2*(i-1),Pt.y-=n.height/2*(i-1),Pt.width*=i,Pt.height*=i),e.copyWorld(s.canvas,r,i?Pt:n)}const{toOffsetOutBounds:Ot}=t.BoundsHelper,Tt={};var Dt=Object.freeze({__proto__:null,blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__world.a),n.copyWorldToInner(e,t.__world,t.__layout.renderBounds),n.filter="none"},innerShadow:function(t,e,n,i){let s,a;const{__world:r,__layout:o}=t,{innerShadow:d}=t.__,{worldCanvas:l,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=n,g=e.getSameCanvas(),_=d.length-1;Ot(h,Tt),d.forEach(((d,p)=>{g.save(),g.setWorldShadow(Tt.offsetX+d.x*u,Tt.offsetY+d.y*f,d.blur*u),a=d.spread?1-2*d.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,It(g,Tt,a,n),g.restore(),l?(g.copyWorld(g,h,r,"copy"),g.copyWorld(l,r,r,"source-out"),s=r):(g.copyWorld(n.canvas,c,h,"source-out"),s=h),g.fillWorld(s,d.color,"source-in"),t.__worldFlipped||i.matrix?e.copyWorldByReset(g,s,r,d.blendMode):e.copyWorldToInner(g,s,o.renderBounds,d.blendMode),_&&p<_&&g.clear()})),g.recycle()},shadow:function(t,e,n,i){let s,a;const{__world:r,__layout:o}=t,{shadow:d}=t.__,{worldCanvas:l,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=n,g=e.getSameCanvas(),_=d.length-1;Mt(h,At),d.forEach(((d,p)=>{g.setWorldShadow(At.offsetX+d.x*u,At.offsetY+d.y*f,d.blur*u,d.color),a=d.spread?1+2*d.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,It(g,At,a,n),s=h,d.box&&(g.restore(),g.save(),l&&(g.copyWorld(g,h,r,"copy"),s=r),l?g.copyWorld(l,r,r,"destination-out"):g.copyWorld(n.canvas,c,h,"destination-out")),t.__worldFlipped||i.matrix?e.copyWorldByReset(g,s,r,d.blendMode):e.copyWorldToInner(g,s,o.renderBounds,d.blendMode),_&&p<_&&g.clear()})),g.recycle()}});const Wt=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Ht=Wt+"_#~&*+\\=|≮≯≈≠=…",Ft=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function Nt(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Yt=Nt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),jt=Nt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ut=Nt(Wt),qt=Nt(Ht),Vt=Nt("- —/~|┆·");var Xt;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Xt||(Xt={}));const{Letter:zt,Single:Gt,Before:Qt,After:Zt,Symbol:Kt,Break:$t}=Xt;function Jt(t){return Yt[t]?zt:Vt[t]?$t:jt[t]?Qt:Ut[t]?Zt:qt[t]?Kt:Ft.test(t)?Gt:zt}const te={trimRight(t){const{words:e}=t;let n,i=0,s=e.length;for(let a=s-1;a>-1&&(n=e[a].data[0]," "===n.char);a--)i++,t.width-=n.width;i&&e.splice(s-i,i)}};function ee(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:ne}=te,{Letter:ie,Single:se,Before:ae,After:re,Symbol:oe,Break:de}=Xt;let le,he,ce,ue,fe,ge,_e,pe,ye,me,ve,we,xe,Be,be,Ee,Le=[];function Re(t,e){ye&&!pe&&(pe=ye),le.data.push({char:t,width:e}),ce+=e}function ke(){ue+=ce,le.width=ce,he.words.push(le),le={data:[]},ce=0}function Se(){Be&&(be.paraNumber++,he.paraStart=!0,Be=!1),ye&&(he.startCharSize=pe,he.endCharSize=ye,pe=0),he.width=ue,Ee.width&&ne(he),Le.push(he),he={words:[]},ue=0}const Ce={getDrawData(e,n){"string"!=typeof e&&(e=String(e));let i=0,s=0,a=n.__getInput("width")||0,r=n.__getInput("height")||0;const{textDecoration:o,__font:d,padding:l}=n;if(l){const[e,n,o,d]=t.MathHelper.fourNumber(l);a&&(i=d,a-=n+d),r&&(s=e,r-=e+o)}const h={bounds:{x:i,y:s,width:a,height:r},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){be=e,Le=e.rows,Ee=e.bounds;const{__letterSpacing:s,paraIndent:a,textCase:r}=i,{canvas:o}=t.Platform,{width:d,height:l}=Ee;if(d||l||s||"none"!==r){const t="none"!==i.textWrap,e="break"===i.textWrap;Be=!0,ve=null,pe=_e=ye=ce=ue=0,le={data:[]},he={words:[]};for(let i=0,l=n.length;i<l;i++)ge=n[i],"\n"===ge?(ce&&ke(),he.paraEnd=!0,Se(),Be=!0):(me=Jt(ge),me===ie&&"none"!==r&&(ge=ee(ge,r,!ce)),_e=o.measureText(ge).width,s&&(s<0&&(ye=_e),_e+=s),we=me===se&&(ve===se||ve===ie)||ve===se&&me!==re,xe=!(me!==ae&&me!==se||ve!==oe&&ve!==re),fe=Be&&a?d-a:d,t&&d&&ue+ce+_e>fe&&(e?(ce&&ke(),Se()):(xe||(xe=me===ie&&ve==re),we||xe||me===de||me===ae||me===se||ce+_e>fe?(ce&&ke(),Se()):Se()))," "===ge&&!0!==Be&&ue+ce===0||(me===de?(" "===ge&&ce&&ke(),Re(ge,_e),ke()):we||xe?(ce&&ke(),Re(ge,_e)):Re(ge,_e)),ve=me);ce&&ke(),ue&&Se(),Le.length>0&&(Le[Le.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{be.paraNumber++,Le.push({x:a||0,text:t,width:o.measureText(t).width,paraStart:!0})}))}(h,e,n),function(t,e){const{rows:n,bounds:i}=t,{__lineHeight:s,__baseLine:a,__letterSpacing:r,__clipText:o,textAlign:d,verticalAlign:l,paraSpacing:h}=e;let c,u,f,{x:g,y:_,width:p,height:y}=i,m=s*n.length+(h?h*(t.paraNumber-1):0),v=a;if(o&&m>y)m=Math.max(y,s),t.overflow=n.length;else switch(l){case"middle":_+=(y-m)/2;break;case"bottom":_+=y-m}v+=_;for(let a=0,l=n.length;a<l;a++){switch(c=n[a],c.x=g,d){case"center":c.x+=(p-c.width)/2;break;case"right":c.x+=p-c.width}c.paraStart&&h&&a>0&&(v+=h),c.y=v,v+=s,t.overflow>a&&v>m&&(c.isOverflow=!0,t.overflow=a+1),u=c.x,f=c.width,r<0&&(c.width<0?(f=-c.width+e.fontSize+r,u-=f,f+=e.fontSize):f-=r),u<i.x&&(i.x=u),f>i.width&&(i.width=f),o&&p&&p<f&&(c.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=_,i.height=m}(h,n),function(t,e,n,i){const{rows:s}=t,{textAlign:a,paraIndent:r,letterSpacing:o}=e;let d,l,h,c,u;s.forEach((t=>{t.words&&(h=r&&t.paraStart?r:0,l=n&&"justify"===a&&t.words.length>1?(n-t.width-h)/(t.words.length-1):0,c=o||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===c?(t.x+=h,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=h,d=t.x,t.data=[],t.words.forEach((e=>{1===c?(u={char:"",x:d},d=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,n){return t.forEach((t=>{" "!==t.char&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&l&&(d+=l,t.width+=l)}))),t.words=null)}))}(h,n,a),h.overflow&&function(e,n){const{rows:i,overflow:s}=e;let{textOverflow:a}=n;if(i.splice(s),"hide"!==a){let e,r;"ellipsis"===a&&(a="...");const o=t.Platform.canvas.measureText(a).width,d=n.x+n.width-o;("none"===n.textWrap?i:[i[s-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],r=e.x+e.width,!(i===n&&r<d));i--){if(r<d&&" "!==e.char){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=o,t.data.push({char:a,x:r}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(h,n),"none"!==o&&function(t,e){const{fontSize:n}=e;switch(t.decorationHeight=n/11,e.textDecoration){case"under":t.decorationY=.15*n;break;case"delete":t.decorationY=.35*-n}}(h,n),h}},Me={string(t,e){if("string"==typeof t)return t;let n=void 0===t.a?1:t.a;e&&(n*=e);const i=t.r+","+t.g+","+t.b;return 1===n?"rgb("+i+")":"rgba("+i+","+n+")"}},Pe={export(e,n,s){return Pe.running=!0,function(e){Ae||(Ae=new t.TaskProcessor);return new Promise((t=>{Ae.add((()=>i(this,void 0,void 0,(function*(){return yield e(t)}))),{parallel:!1})}))}((t=>new Promise((a=>{const{leafer:r}=e;r?r.waitViewCompleted((()=>i(this,void 0,void 0,(function*(){let e,i,o,{canvas:d}=r,{unreal:l}=d;switch(l&&(d=d.getSameCanvas(),d.backgroundColor=r.config.fill,r.__render(d,{})),typeof s){case"object":s.quality&&(e=s.quality),s.blob&&(i=!0);break;case"number":e=s;break;case"boolean":i=s}o=n.includes(".")?yield d.saveAs(n,e):i?yield d.toBlob(n,e):yield d.toDataURL(n,e),t({data:o}),a(),Pe.running=!1,l&&d.recycle()})))):(t({data:!1}),a(),Pe.running=!1)}))))}};let Ae;Object.assign(n.Paint,St),Object.assign(n.Effect,Dt),Object.assign(n.TextConvert,Ce),Object.assign(n.ColorConvert,Me),Object.assign(n.Export,Pe),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=p,exports.LeaferCanvas=R,exports.Renderer=m,exports.Selector=L,exports.Watcher=s,exports.useCanvas=function(n,s){if(t.Platform.canvasType=n,!t.Platform.origin){if("skia"===n){const{Canvas:e,loadImage:n}=s;t.Platform.origin={createCanvas:(t,n,i)=>new e(t,n,i),canvasToDataURL:(t,e,n)=>t.toDataURLSync(e,{quality:n}),canvasToBolb:(t,e,n)=>t.toBuffer(e,{quality:n}),canvasSaveAs:(t,e,n)=>t.saveAs(e,{quality:n}),loadImage:n},t.Platform.roundRectPatch=!0}else if("napi"===n){const{Canvas:n,loadImage:a}=s;t.Platform.origin={createCanvas:(t,e,i)=>new n(t,e,i),canvasToDataURL:(t,e,n)=>t.toDataURL(k(e),n),canvasToBolb:(t,e,n)=>i(this,void 0,void 0,(function*(){return t.toBuffer(k(e),n)})),canvasSaveAs:(t,n,s)=>i(this,void 0,void 0,(function*(){return e.writeFileSync(n,t.toBuffer(k(S(n)),s))})),loadImage:a}}t.Platform.ellipseToCurve=!0,t.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},t.Platform.canvas=t.Creator.canvas()}},Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(n).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return n[t]}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/node",
3
- "version": "1.0.0-rc.6",
3
+ "version": "1.0.0-rc.7",
4
4
  "description": "@leafer-ui/node",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -30,10 +30,10 @@
30
30
  "leaferjs"
31
31
  ],
32
32
  "dependencies": {
33
- "@leafer/node": "1.0.0-rc.6",
34
- "@leafer-ui/core": "1.0.0-rc.6",
35
- "@leafer-ui/partner": "1.0.0-rc.6",
36
- "@leafer-ui/interface": "1.0.0-rc.6",
37
- "leafer-in": "1.0.0-rc.6"
33
+ "@leafer/node": "1.0.0-rc.7",
34
+ "@leafer-ui/core": "1.0.0-rc.7",
35
+ "@leafer-ui/partner": "1.0.0-rc.7",
36
+ "@leafer-ui/interface": "1.0.0-rc.7",
37
+ "leafer-in": "1.0.0-rc.7"
38
38
  }
39
39
  }