@leafer-draw/node 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node.cjs +26 -16
- package/dist/node.esm.js +26 -16
- package/dist/node.esm.min.js +1 -1
- package/dist/node.esm.min.js.map +1 -1
- package/dist/node.min.cjs +1 -1
- package/dist/node.min.cjs.map +1 -1
- package/package.json +8 -8
package/dist/node.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t,e=require("@leafer/core"),a=require("fs"),n=require("@leafer-ui/draw");function i(t,e,a,n){return new(a||(a=Promise))(function(i,r){function o(t){try{l(n.next(t))}catch(t){r(t)}}function s(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(o,s)}l((n=n.apply(t,e||[])).next())})}exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError;class r extends e.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),e.Platform.roundRectPatch&&(this.context.__proto__.roundRect=null,e.canvasPatch(this.context.__proto__))}__createView(){this.view=e.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}function o(t){return i(this,arguments,void 0,function*(t,e="text"){const a=yield fetch(t);if(!a.ok)throw new Error(`${a.status}`);return yield a[e]()})}Object.assign(e.Creator,{canvas:(t,e)=>new r(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="node",e.Platform.backgrounder=!0,e.Platform.requestRender=function(t){setTimeout(t,16)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>1}),e.Platform.conicGradientSupport=!0;class s{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,a){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,a&&(this.config=e.DataHelper.default(a,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(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.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,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:c}=e.LeafHelper,{pushAllChildBranch:h,pushAllParent:u}=e.BranchHelper;const{worldBounds:f}=e.LeafBoundsHelper;class p{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),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:g,updateAllChange:_}=e.LeafHelper,m=e.Debug.get("Layouter");class y{constructor(t,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,a&&(this.config=e.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const a=e.Run.start("PartLayout"),{target:n,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:s}=e.LayoutEvent,f=this.getBlocks(i);f.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(r,f,this.times)),this.extraBlock=null,i.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&h(t,e),u(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(i,this.__levelList),function(t){let e,a,n;t.sort(!0),t.levels.forEach(i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(a=e[t],a.isBranch&&a.__tempNumber){n=a.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||d(n[t])}d(a)}})}(this.__levelList),function(t){t.list.forEach(c)}(i),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(o,f,this.times)),n.emitEvent(new e.LayoutEvent(s,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,e.Run.end(a)}fullLayout(){const t=e.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:i,AFTER:r}=e.LayoutEvent,o=this.getBlocks(new e.LeafList(a));a.emitEvent(new e.LayoutEvent(n,o,this.times)),y.fullLayout(a),o.forEach(t=>{t.setAfter()}),a.emitEvent(new e.LayoutEvent(i,o,this.times)),a.emitEvent(new e.LayoutEvent(r,o,this.times)),this.addBlocks(o),e.Run.end(t)}static fullLayout(t){g(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),_(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));e.length?a.add(t.__world):a.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const w=e.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,a,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=a,n&&(this.config=e.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:a}=this;this.times=0,this.totalBounds=new e.Bounds,w.log(a.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const a=e.Run.start("PartRender"),{canvas:n}=this,i=t.getIntersect(n.bounds),r=new e.Bounds(i);n.save(),i.spread(v.clipSpread).ceil();const{ceilPartPixel:o}=this.config;n.clipWorld(i,o),n.clearWorld(i,o),this.__render(i,r),n.restore(),e.Run.end(a)}fullRender(){const t=e.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),e.Run.end(t)}__render(t,a){const{canvas:n,target:i}=this,r=t.includes(i.__world),o=r?{includes:r}:{bounds:t,includes:r};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(o.cellList=this.getCellList()),e.Platform.render(i,n,o),this.renderBounds=a=a||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const a=new e.Bounds;a.setList(t),t.length=0,t.push(a)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(a);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:a,height:n}=t.old;if(!new e.Bounds(0,0,a,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:a}=t;a&&a.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,a)})}emitRender(t,a,n){this.target.emitEvent(new e.RenderEvent(t,this.times,a,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function x(t,e,a){t.__.__font?n.Paint.fillText(t,e,a):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function P(t,a,i,r,o){const s=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!1,i,r,o):(r.setStroke(t,s.__strokeWidth*a,s),r.stroke()),s.__useArrow&&n.Paint.strokeArrow(t,i,r,o)}function b(t,a,i,r,o){const s=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!0,i,r,o):(r.setStroke(t,s.__strokeWidth*a,s),n.Paint.drawTextStroke(i,r,o))}function S(t,a,i,r,o){const s=r.getSameCanvas(!0,!0);s.font=i.__.__font,b(t,2,i,s,o),s.blendMode="outside"===a?"destination-out":"destination-in",n.Paint.fillText(i,s,o),s.blendMode="normal",e.LeafHelper.copyCanvasByWorld(i,r,s),s.recycle(i.__nowWorld)}v.clipSpread=10,Object.assign(e.Creator,{watcher:(t,e)=>new s(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,a)=>new v(t,e,a),selector:(t,e)=>{},interaction:(t,e,a,n)=>{}}),e.Platform.layout=y.fullLayout,e.Platform.render=function(t,a,n){const i=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(a,n),n.topList.length&&n.topList.forEach(t=>t.__render(a,i))};const{getSpread:E,copyAndSpread:B,toOuterOf:L,getOuterOf:R,getByMove:k,move:C,getIntersectData:T}=e.BoundsHelper,A={};let O;const{stintSet:I}=e.DataHelper,{hasTransparent:M}=n.ColorConvert;function D(t,a,i){if(!e.isObject(a)||!1===a.visible||0===a.opacity)return;let r;const{boxBounds:o}=i.__layout,{type:s}=a;switch(s){case"image":case"film":case"video":if(!a.url)return;r=n.PaintImage.image(i,t,a,o,!O||!O[a.url]),"image"!==s&&n.PaintImage[s](r);break;case"linear":r=n.PaintGradient.linearGradient(a,o);break;case"radial":r=n.PaintGradient.radialGradient(a,o);break;case"angular":r=n.PaintGradient.conicGradient(a,o);break;case"solid":const{color:l,opacity:d}=a;r={type:s,style:n.ColorConvert.string(l,d)};break;default:e.isUndefined(a.r)||(r={type:"solid",style:n.ColorConvert.string(a)})}if(r&&(r.originPaint=a,e.isString(r.style)&&M(r.style)&&(r.isTransparent=!0),a.style)){if(0===a.style.strokeWidth)return;r.strokeStyle=a.style}return r}const W={compute:function(t,a){const i=a.__,r=[];let o,s,l,d=i.__input[t];e.isArray(d)||(d=[d]),O=n.PaintImage.recycleImage(t,i);for(let e,n=0,i=d.length;n<i;n++)(e=D(t,d[n],a))&&(r.push(e),e.strokeStyle&&(l||(l=1),e.strokeStyle.strokeWidth&&(l=Math.max(l,e.strokeStyle.strokeWidth))));i["_"+t]=r.length?r:void 0,r.length?(r.every(t=>t.isTransparent)&&(r.some(t=>t.image)&&(o=!0),s=!0),"fill"===t?(I(i,"__isAlphaPixelFill",o),I(i,"__isTransparentFill",s)):(I(i,"__isAlphaPixelStroke",o),I(i,"__isTransparentStroke",s),I(i,"__hasMultiStrokeStyle",l))):i.__removePaint(t,!1)},fill:function(t,e,a,n){a.fillStyle=t,x(e,a,n)},fills:function(t,e,a,i){let r,o,s;for(let l=0,d=t.length;l<d;l++){if(r=t[l],o=r.originPaint,r.image){if(s?s++:s=1,n.PaintImage.checkImage(r,!e.__.__font,e,a,i))continue;if(!r.style){1===s&&r.image.isPlacehold&&e.drawImagePlaceholder(r,a,i);continue}}if(a.fillStyle=r.style,r.transform||o.scaleFixed){if(a.save(),r.transform&&a.transform(r.transform),o.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0,o.scaleFixed,!1);1!==t&&a.scale(t,n)}o.blendMode&&(a.blendMode=o.blendMode),x(e,a,i),a.restore()}else o.blendMode?(a.saveBlendMode(o.blendMode),x(e,a,i),a.restoreBlendMode()):x(e,a,i)}},fillPathOrText:x,fillText:function(t,e,a){const n=t.__,{rows:i,decorationY:r}=n.__textDrawData;let o;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,a=i.length;t<a;t++)o=i[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:a}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(n=>e.fillRect(t.x,t.y+n,t.width,a)))}},stroke:function(t,a,i,r){const o=a.__;if(o.__strokeWidth)if(o.__font)n.Paint.strokeText(t,a,i,r);else if(o.__pathForStroke)n.Paint.fillStroke(t,a,i,r);else switch(o.strokeAlign){case"center":P(t,1,a,i,r);break;case"inside":!function(t,e,a,n){a.save(),a.clipUI(e),P(t,2,e,a,n),a.restore()}(t,a,i,r);break;case"outside":!function(t,a,n,i){const r=a.__;if(r.__fillAfterStroke)P(t,2,a,n,i);else{const{renderBounds:o}=a.__layout,s=n.getSameCanvas(!0,!0);a.__drawRenderPath(s),P(t,2,a,s,i),s.clipUI(r),s.clearWorld(o),e.LeafHelper.copyCanvasByWorld(a,n,s),s.recycle(a.__nowWorld)}}(t,a,i,r)}},strokes:function(t,e,a,i){n.Paint.stroke(t,e,a,i)},strokeText:function(t,e,a,n){switch(e.__.strokeAlign){case"center":b(t,1,e,a,n);break;case"inside":S(t,"inside",e,a,n);break;case"outside":e.__.__fillAfterStroke?b(t,2,e,a,n):S(t,"outside",e,a,n)}},drawTextStroke:function(t,e,a){let n,i=t.__.__textDrawData;const{rows:r,decorationY:o}=i;for(let t=0,a=r.length;t<a;t++)n=r[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)});if(o){const{decorationHeight:t}=i;r.forEach(a=>o.forEach(n=>e.strokeRect(a.x,a.y+n,a.width,t)))}},drawStrokesStyle:function(t,e,a,i,r,o){let s;const l=i.__,{__hasMultiStrokeStyle:d}=l;d||r.setStroke(void 0,l.__strokeWidth*e,l);for(let c=0,h=t.length;c<h;c++)if(s=t[c],(!s.image||!n.PaintImage.checkImage(s,!1,i,r,o))&&s.style){if(d){const{strokeStyle:t}=s;t?r.setStroke(s.style,l.__getRealStrokeWidth(t)*e,l,t):r.setStroke(s.style,l.__strokeWidth*e,l)}else r.strokeStyle=s.style;s.originPaint.blendMode?(r.saveBlendMode(s.originPaint.blendMode),a?n.Paint.drawTextStroke(i,r,o):r.stroke(),r.restoreBlendMode()):a?n.Paint.drawTextStroke(i,r,o):r.stroke()}},shape:function(t,a,n){const i=a.getSameCanvas(),r=a.bounds,o=t.__nowWorld,s=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,c,h,u,f,p;L(s.strokeSpread?(B(A,s.boxBounds,s.strokeSpread),A):s.boxBounds,o,l);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(r.includes(l))p=i,d=f=l,c=o;else{let i;if(e.Platform.fullImageShadow)i=l;else{const t=s.renderShapeSpread?E(r,e.FourNumberHelper.swapAndScale(s.renderShapeSpread,g,_)):r;i=T(t,l)}u=r.getFitMatrix(i);let{a:m,d:y}=u;u.a<1&&(p=a.getSameCanvas(),t.__renderShape(p,n),g*=m,_*=y),f=R(l,u),d=k(f,-u.e,-u.f),c=R(o,u),C(c,-u.e,-u.f);const w=n.matrix;w?(h=new e.Matrix(u),h.multiply(w),m*=w.scaleX,y*=w.scaleY):h=u,h.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:h})}return t.__renderShape(i,n),{canvas:i,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let H,F=new e.Bounds;const{isSame:U}=e.BoundsHelper;function j(t,a,i,r,o,s){let l=!0;const d=t.__;if("fill"!==a||d.__naturalWidth||(d.__naturalWidth=r.width/d.pixelRatio,d.__naturalHeight=r.height/d.pixelRatio,d.__autoSide&&(t.forceUpdate("width"),e.LeafHelper.updateBounds(t),t.__proxyData&&(t.setProxyAttr("width",d.width),t.setProxyAttr("height",d.height)),l=!1)),!o.data){n.PaintImage.createData(o,r,i,s);const{transform:t}=o.data,{opacity:e,blendMode:a}=i,l=t&&!t.onlyScale||d.path||d.cornerRadius;(l||e&&e<1||a)&&(o.complex=!l||2)}return i.filter&&n.PaintImage.applyFilter(o,r,i.filter,t),l}function Y(t,a){q(t,e.ImageEvent.LOAD,a)}function N(t,a){q(t,e.ImageEvent.LOADED,a)}function X(t,a,n){a.error=n,t.forceUpdate("surface"),q(t,e.ImageEvent.ERROR,a)}function q(t,a,n){t.hasEvent(a)&&t.emitEvent(new e.ImageEvent(a,n))}function G(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:z,translate:V}=e.MatrixHelper,Q=new e.Bounds,J={},Z={};function $(t,a,n,i){const r=e.isString(t)||i?(i?n-i*a:n%a)/((i||Math.floor(n/a))-1):t;return"auto"===t&&r<0?0:r}let K={},tt=e.getMatrixData();const{get:et,set:at,rotateOfOuter:nt,translate:it,scaleOfOuter:rt,multiplyParent:ot,scale:st,rotate:lt,skew:dt}=e.MatrixHelper;function ct(t,e,a,n,i,r,o,s){o&<(t,o),s&&dt(t,s.x,s.y),i&&st(t,i,r),it(t,e.x+a,e.y+n)}const{get:ht,scale:ut,copy:ft}=e.MatrixHelper,{getFloorScale:pt}=e.MathHelper,{abs:gt}=Math;const _t={image:function(t,a,n,i,r){let o,s;const l=e.ImageManager.get(n,n.type);return H&&n===H.paint&&U(i,H.boxBounds)?o=H.leafPaint:(o={type:n.type,image:l},l.hasAlphaPixel&&(o.isTransparent=!0),H=l.use>1?{leafPaint:o,paint:n,boxBounds:F.set(i)}:null),(r||l.loading)&&(s={image:l,attrName:a,attrValue:n}),l.ready?(j(t,a,n,l,o,i),r&&(Y(t,s),N(t,s))):l.error?r&&X(t,s,l.error):(r&&(G(t,!0),Y(t,s)),o.loadId=l.load(()=>{G(t,!1),t.destroyed||(j(t,a,n,l,o,i)&&(l.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),N(t,s)),o.loadId=void 0},e=>{G(t,!1),X(t,s,e),o.loadId=void 0},n.lod&&l.getThumbSize(n.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):l.isPlacehold=!0)),o},checkImage:function(t,a,i,r,o){const{scaleX:s,scaleY:l}=n.PaintImage.getImageRenderScaleData(t,i,r,o),d=t.film?t.nowIndex:s+"-"+l,{image:c,data:h,originPaint:u}=t,{exporting:f,snapshot:p}=o;return!(!h||t.patternId===d&&!f||p)&&(a&&(h.repeat?a=!1:u.changeful||t.film||"miniapp"===e.Platform.name||f||(a=e.Platform.image.isLarge(c,s,l)||c.width*s>8096||c.height*l>8096)),a?(i.__.__isFastShadow&&(r.fillStyle=t.style||"#000",r.fill()),n.PaintImage.drawImage(t,s,l,i,r,o),!0):(!t.style||u.sync||f?n.PaintImage.createPattern(t,i,r,o):n.PaintImage.createPatternTask(t,i,r,o),!1))},drawImage:function(t,e,a,n,i,r){const{data:o,image:s,complex:l}=t;let{width:d,height:c}=s;if(l){const{blendMode:r,opacity:h}=t.originPaint,{transform:u}=o;i.save(),2===l&&i.clipUI(n),r&&(i.blendMode=r),h&&(i.opacity*=h),u&&i.transform(u),s.render(i,0,0,d,c,n,t,e,a),i.restore()}else o.scaleX&&(d*=o.scaleX,c*=o.scaleY),s.render(i,0,0,d,c,n,t,e,a)},getImageRenderScaleData:function(t,e,a,n){const i=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(a){const{pixelRatio:t}=a;i.scaleX*=t,i.scaleY*=t}return r&&r.scaleX&&(i.scaleX*=Math.abs(r.scaleX),i.scaleY*=Math.abs(r.scaleY)),i},recycleImage:function(t,a){const i=a["_"+t];if(e.isArray(i)){let r,o,s,l,d;for(let c=0,h=i.length;c<h;c++)r=i[c],o=r.image,d=o&&o.url,d&&(s||(s={}),s[d]=!0,e.ImageManager.recyclePaint(r),a.__willDestroy&&o.parent&&n.PaintImage.recycleFilter(o,a.__leaf),o.loading&&(l||(l=a.__input&&a.__input[t]||[],e.isArray(l)||(l=[l])),o.unload(i[c].loadId,!l.some(t=>t.url===d))));return s}return null},createPatternTask:function(t,a,r,o){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>i(this,void 0,void 0,function*(){n.PaintImage.createPattern(t,a,r,o),a.forceUpdate("surface")}),0,()=>(t.patternTask=null,r.bounds.hit(a.__nowWorld))))},createPattern:function(t,a,i,r){let{scaleX:o,scaleY:s}=n.PaintImage.getImageRenderScaleData(t,a,i,r),l=t.film?t.nowIndex:o+"-"+s;if(t.patternId!==l&&!a.destroyed&&(!e.Platform.image.isLarge(t.image,o,s)||t.data.repeat)){const{image:i,data:r}=t,{opacity:d}=t.originPaint,{transform:c,gap:h}=r,u=n.PaintImage.getPatternFixScale(t,o,s);let f,p,g,{width:_,height:m}=i;u&&(o*=u,s*=u),_*=o,m*=s,h&&(p=h.x*o/gt(r.scaleX||1),g=h.y*s/gt(r.scaleY||1)),(c||1!==o||1!==s)&&(o*=pt(_+(p||0)),s*=pt(m+(g||0)),f=ht(),c&&ft(f,c),ut(f,1/o,1/s));const y=i.getCanvas(_,m,d,void 0,p,g,a.leafer&&a.leafer.config.smooth,r.interlace),w=i.getPattern(y,r.repeat||e.Platform.origin.noRepeat||"no-repeat",f,t);t.style=w,t.patternId=l}},getPatternFixScale:function(t,a,n){const{image:i}=t;let r,o=e.Platform.image.maxPatternSize,s=i.width*i.height;return i.isSVG?a>1&&(r=Math.ceil(a)/a):o>s&&(o=s),(s*=a*n)>o&&(r=Math.sqrt(o/s)),r},createData:function(t,e,a,i){t.data=n.PaintImage.getPatternData(a,i,e)},getPatternData:function(t,a,i){t.padding&&(a=Q.set(a).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:r,height:o}=i,{mode:s,align:l,offset:d,scale:c,size:h,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,interlace:m}=t,y=a.width===r&&a.height===o,w={mode:s},v="center"!==l&&(u||0)%180==90;let x,P;switch(e.BoundsHelper.set(Z,0,0,v?o:r,v?r:o),s&&"cover"!==s&&"fit"!==s?((c||h)&&(e.MathHelper.getScaleData(c,h,i,J),x=J.scaleX,P=J.scaleY),(l||_||g)&&(x&&e.BoundsHelper.scale(Z,x,P,!0),l&&e.AlignHelper.toPoint(l,Z,a,Z,!0,!0))):y&&!u||(x=P=e.BoundsHelper.getFitScale(a,Z,"fit"!==s),e.BoundsHelper.put(a,i,l,x,!1,Z),e.BoundsHelper.scale(Z,x,P,!0)),d&&e.PointHelper.move(Z,d),s){case"stretch":y?x&&(x=P=void 0):(x=a.width/r,P=a.height/o,n.PaintImage.stretchMode(w,a,x,P));break;case"normal":case"clip":if(Z.x||Z.y||x||p||u||f){let t,e;p&&(t=a.width/p.width,e=a.height/p.height),n.PaintImage.clipMode(w,a,Z.x,Z.y,x,P,u,f,t,e),t&&(x=x?x*t:t,P=P?P*e:e)}break;case"repeat":(!y||x||u||f)&&n.PaintImage.repeatMode(w,a,r,o,Z.x,Z.y,x,P,u,f,l,t.freeTransform),g||(w.repeat="repeat");const i=e.isObject(g);(_||i)&&(w.gap=function(t,a,n,i,r){let o,s;e.isObject(t)?(o=t.x,s=t.y):o=s=t;return{x:$(o,n,r.width,a&&a.x),y:$(s,i,r.height,a&&a.y)}}(_,i&&g,Z.width,Z.height,a));break;default:x&&n.PaintImage.fillOrFitMode(w,a,Z.x,Z.y,x,P,u)}return w.transform||(a.x||a.y)&&V(w.transform=z(),a.x,a.y),x&&(w.scaleX=x,w.scaleY=P),g&&(w.repeat=e.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=e.isNumber(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,a,n){const i=et(),{x:r,y:o}=e;r||o?it(i,r,o):a>0&&n>0&&(i.onlyScale=!0),st(i,a,n),t.transform=i},fillOrFitMode:function(t,e,a,n,i,r,o){const s=et();it(s,e.x+a,e.y+n),st(s,i,r),o&&nt(s,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=s},clipMode:function(t,e,a,n,i,r,o,s,l,d){const c=et();ct(c,e,a,n,i,r,o,s),l&&(o||s?(at(tt),rt(tt,e,l,d),ot(c,tt)):rt(c,e,l,d)),t.transform=c},repeatMode:function(t,e,a,n,i,r,o,s,l,d,c,h){const u=et();if(h)ct(u,e,i,r,o,s,l,d);else{if(l)if("center"===c)nt(u,{x:a/2,y:n/2},l);else switch(lt(u,l),l){case 90:it(u,n,0);break;case 180:it(u,a,n);break;case 270:it(u,0,a)}K.x=e.x+i,K.y=e.y+r,it(u,K.x,K.y),o&&rt(u,K,o,s)}t.transform=u}},{toPoint:mt}=e.AroundHelper,{hasTransparent:yt}=n.ColorConvert,wt={},vt={};function xt(t,a,i,r){if(i){let o,s,l,d;for(let t=0,c=i.length;t<c;t++)o=i[t],e.isString(o)?(l=t/(c-1),s=n.ColorConvert.string(o,r)):(l=o.offset,s=n.ColorConvert.string(o.color,r)),a.addColorStop(l,s),!d&&yt(s)&&(d=!0);d&&(t.isTransparent=!0)}}const{getAngle:Pt,getDistance:bt}=e.PointHelper,{get:St,rotateOfOuter:Et,scaleOfOuter:Bt}=e.MatrixHelper,{toPoint:Lt}=e.AroundHelper,Rt={},kt={};function Ct(t,e,a,n,i){let r;const{width:o,height:s}=t;if(o!==s||n){const t=Pt(e,a);r=St(),i?(Bt(r,e,o/s*(n||1),1),Et(r,e,t+90)):(Bt(r,e,1,o/s*(n||1)),Et(r,e,t))}return r}const{getDistance:Tt}=e.PointHelper,{toPoint:At}=e.AroundHelper,Ot={},It={};const Mt={linearGradient:function(t,a){let{from:n,to:i,type:r,opacity:o}=t;mt(n||"top",a,wt),mt(i||"bottom",a,vt);const s=e.Platform.canvas.createLinearGradient(wt.x,wt.y,vt.x,vt.y),l={type:r,style:s};return xt(l,s,t.stops,o),l},radialGradient:function(t,a){let{from:n,to:i,type:r,opacity:o,stretch:s}=t;Lt(n||"center",a,Rt),Lt(i||"bottom",a,kt);const l=e.Platform.canvas.createRadialGradient(Rt.x,Rt.y,0,Rt.x,Rt.y,bt(Rt,kt)),d={type:r,style:l};xt(d,l,t.stops,o);const c=Ct(a,Rt,kt,s,!0);return c&&(d.transform=c),d},conicGradient:function(t,a){let{from:n,to:i,type:r,opacity:o,rotation:s,stretch:l}=t;At(n||"center",a,Ot),At(i||"bottom",a,It);const d=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(s?s*e.OneRadian:0,Ot.x,Ot.y):e.Platform.canvas.createRadialGradient(Ot.x,Ot.y,0,Ot.x,Ot.y,Tt(Ot,It)),c={type:r,style:d};xt(c,d,t.stops,o);const h=Ct(a,Ot,It,l||1,e.Platform.conicGradientRotate90);return h&&(c.transform=h),c},getTransform:Ct},{copy:Dt,move:Wt,toOffsetOutBounds:Ht}=e.BoundsHelper,{max:Ft,abs:Ut}=Math,jt={},Yt=new e.Matrix,Nt={};function Xt(t,e){let a,n,i,r,o=0,s=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,n=t.y||0,r=1.5*(t.blur||0),i=Ut(t.spread||0),o=Ft(o,i+r-n),s=Ft(s,i+r+a),l=Ft(l,i+r+n),d=Ft(d,i+r-a)}),o===s&&s===l&&l===d?o:[o,s,l,d]}function qt(t,a,n){const{shapeBounds:i}=n;let r,o;e.Platform.fullImageShadow?(Dt(jt,t.bounds),Wt(jt,a.x-i.x,a.y-i.y),r=t.bounds,o=jt):(r=i,o=a),t.copyWorld(n.canvas,r,o)}const{toOffsetOutBounds:Gt}=e.BoundsHelper,zt={};const Vt=Xt;const Qt={shadow:function(t,a,i){let r,o;const{__nowWorld:s}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=i,g=a.getSameCanvas(),_=l.length-1;Ht(c,Nt,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(s.scaleX);t>1&&(y=1/t)}g.setWorldShadow(Nt.offsetX+(l.x||0)*f*y,Nt.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y,n.ColorConvert.string(l.color)),o=n.Effect.getShadowTransform(t,g,i,l,Nt,y),o&&g.setTransform(o),qt(g,Nt,i),o&&g.resetTransform(),r=h,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,h,s,"copy"),r=s),d?g.copyWorld(d,s,s,"destination-out"):g.copyWorld(i.canvas,u,c,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,a,g,r,l.blendMode),_&&m<_&&g.clearWorld(r)}),g.recycle(r)},innerShadow:function(t,a,i){let r,o;const{__nowWorld:s}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=i,g=a.getSameCanvas(),_=l.length-1;Gt(c,zt,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(s.scaleX);t>1&&(y=1/t)}g.save(),g.setWorldShadow(zt.offsetX+(l.x||0)*f*y,zt.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y),o=n.Effect.getShadowTransform(t,g,i,l,zt,y,!0),o&&g.setTransform(o),qt(g,zt,i),g.restore(),d?(g.copyWorld(g,h,s,"copy"),g.copyWorld(d,s,s,"source-out"),r=s):(g.copyWorld(i.canvas,u,c,"source-out"),r=h),g.fillWorld(r,n.ColorConvert.string(l.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,a,g,r,l.blendMode),_&&m<_&&g.clearWorld(r)}),g.recycle(r)},blur:function(t,e,a){const{blur:n}=t.__;a.setWorldBlur(n*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Xt,getShadowTransform:function(t,e,a,n,i,r,o){if(n.spread){const a=2*n.spread*r*(o?-1:1),{width:s,height:l}=t.__layout.strokeBounds;return Yt.set().scaleOfOuter({x:(i.x+i.width/2)*e.pixelRatio,y:(i.y+i.height/2)*e.pixelRatio},1+a/s,1+a/l),Yt}},isTransformShadow(t){},getInnerShadowSpread:Vt},{excludeRenderBounds:Jt}=e.LeafBoundsHelper;let Zt;function $t(t,e,a,n,i,r,o,s){switch(e){case"grayscale":Zt||(Zt=!0,i.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,n,i,r){const o=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,o),r&&n.recycle(o);te(t,e,a,1,i,r)}(t,a,n,i,o,s);break;case"opacity-path":te(t,a,n,r,o,s);break;case"path":s&&a.restore()}}function Kt(t){return t.getSameCanvas(!1,!0)}function te(t,e,a,n,i,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(a,o,void 0,i),r?a.recycle(o):a.clearWorld(o)}n.Group.prototype.__renderMask=function(t,e){let a,n,i,r,o,s;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(a=l[d],s=a.__.mask,s){o&&($t(this,o,t,i,n,r,void 0,!0),n=i=null),"clipping"!==s&&"clipping-path"!==s||Jt(a,e)||a.__render(t,e),r=a.__.opacity,Zt=!1,"path"===s||"clipping-path"===s?(r<1?(o="opacity-path",i||(i=Kt(t))):(o="path",t.save()),a.__clip(i||t,e)):(o="grayscale"===s?"grayscale":"alpha",n||(n=Kt(t)),i||(i=Kt(t)),a.__render(n,e));continue}const c=1===r&&a.__.__blendMode;c&&$t(this,o,t,i,n,r,void 0,!1),Jt(a,e)||a.__render(i||t,e),c&&$t(this,o,t,i,n,r,c,!1)}$t(this,o,t,i,n,r,void 0,!0)};const ee=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ae=ee+"_#~&*+\\=|≮≯≈≠=…",ne=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 ie(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const re=ie("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),oe=ie("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),se=ie(ee),le=ie(ae),de=ie("- —/~|┆·");var ce;!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"}(ce||(ce={}));const{Letter:he,Single:ue,Before:fe,After:pe,Symbol:ge,Break:_e}=ce;function me(t){return re[t]?he:de[t]?_e:oe[t]?fe:se[t]?pe:le[t]?ge:ne.test(t)?ue:he}const ye={trimRight(t){const{words:e}=t;let a,n=0,i=e.length;for(let r=i-1;r>-1&&(a=e[r].data[0]," "===a.char);r--)n++,t.width-=a.width;n&&e.splice(i-n,n)}};function we(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:ve}=ye,{Letter:xe,Single:Pe,Before:be,After:Se,Symbol:Ee,Break:Be}=ce;let Le,Re,ke,Ce,Te,Ae,Oe,Ie,Me,De,We,He,Fe,Ue,je,Ye,Ne,Xe=[];function qe(t,e){Me&&!Ie&&(Ie=Me),Le.data.push({char:t,width:e}),ke+=e}function Ge(){Ce+=ke,Le.width=ke,Re.words.push(Le),Le={data:[]},ke=0}function ze(){Ue&&(je.paraNumber++,Re.paraStart=!0,Ue=!1),Me&&(Re.startCharSize=Ie,Re.endCharSize=Me,Ie=0),Re.width=Ce,Ye.width?ve(Re):Ne&&Ve(),Xe.push(Re),Re={words:[]},Ce=0}function Ve(){Ce>(je.maxWidth||0)&&(je.maxWidth=Ce)}const{top:Qe,right:Je,bottom:Ze,left:$e}=e.Direction4;function Ke(t,e,a){const{bounds:n,rows:i}=t;n[e]+=a;for(let t=0;t<i.length;t++)i[t][e]+=a}const ta={getDrawData:function(t,a){e.isString(t)||(t=String(t));let i=0,r=0,o=a.__getInput("width")||0,s=a.__getInput("height")||0;const{__padding:l}=a;l&&(o?(i=l[$e],o-=l[Je]+l[$e],!o&&(o=.01)):a.autoSizeAlign||(i=l[$e]),s?(r=l[Qe],s-=l[Qe]+l[Ze],!s&&(s=.01)):a.autoSizeAlign||(r=l[Qe]));const d={bounds:{x:i,y:r,width:o,height:s},rows:[],paraNumber:0,font:e.Platform.canvas.font=a.__font};return function(t,a,n){je=t,Xe=t.rows,Ye=t.bounds,Ne=!Ye.width&&!n.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:o}=n,{canvas:s}=e.Platform,{width:l}=Ye;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;Ue=!0,We=null,Ie=Oe=Me=ke=Ce=0,Le={data:[]},Re={words:[]};for(let n=0,d=(a=[...a]).length;n<d;n++)Ae=a[n],"\n"===Ae?(ke&&Ge(),Re.paraEnd=!0,ze(),Ue=!0):(De=me(Ae),De===xe&&"none"!==o&&(Ae=we(Ae,o,!ke)),Oe=s.measureText(Ae).width,i&&(i<0&&(Me=Oe),Oe+=i),He=De===Pe&&(We===Pe||We===xe)||We===Pe&&De!==Se,Fe=!(De!==be&&De!==Pe||We!==Ee&&We!==Se),Te=Ue&&r?l-r:l,t&&l&&Ce+ke+Oe>Te&&(e?(ke&&Ge(),Ce&&ze()):(Fe||(Fe=De===xe&&We==Se),He||Fe||De===Be||De===be||De===Pe||ke+Oe>Te?(ke&&Ge(),Ce&&ze()):Ce&&ze()))," "===Ae&&!0!==Ue&&Ce+ke===0||(De===Be?(" "===Ae&&ke&&Ge(),qe(Ae,Oe),Ge()):He||Fe?(ke&&Ge(),qe(Ae,Oe)):qe(Ae,Oe)),We=De);ke&&Ge(),Ce&&ze(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{je.paraNumber++,Ce=s.measureText(t).width,Xe.push({x:r||0,text:t,width:Ce,paraStart:!0}),Ne&&Ve()})}(d,t,a),l&&function(t,e,a,n,i){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":Ke(e,"x",t[$e]);break;case"right":Ke(e,"x",-t[Je])}if(!i&&a.autoSizeAlign)switch(a.verticalAlign){case"top":Ke(e,"y",t[Qe]);break;case"bottom":Ke(e,"y",-t[Ze])}}(l,d,a,o,s),function(t,e){const{rows:a,bounds:n}=t,i=a.length,{__lineHeight:r,__baseLine:o,__letterSpacing:s,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=n,m=r*i+(h?h*(t.paraNumber-1):0),y=o;if(l&&m>_)m=Math.max(e.__autoHeight?m:_,r),i>1&&(t.overflow=i);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,P=g||u?g:t.maxWidth;for(let o=0,c=i;o<c;o++){if(w=a[o],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(P-w.width)/2;break;case"right":w.x+=P-w.width}w.paraStart&&h&&o>0&&(y+=h),w.y=y,y+=r,t.overflow>o&&y>m&&(w.isOverflow=!0,t.overflow=o+1),v=w.x,x=w.width,s<0&&(w.width<0?(x=-w.width+e.fontSize+s,v-=x,x+=e.fontSize):x-=s),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=a.length))}n.y=p,n.height=m}(d,a),a.__isCharMode&&function(t,e,a){const{rows:n}=t,{textAlign:i,paraIndent:r,__letterSpacing:o}=e,s=a&&i.includes("both"),l=s||a&&i.includes("justify"),d=l&&i.includes("letter");let c,h,u,f,p,g,_,m,y,w;n.forEach(t=>{t.words&&(p=r&&t.paraStart?r:0,m=t.words.length,l&&(w=!t.paraEnd||s,h=a-t.width-p,d?f=h/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?h/(m-1):0),g=o||t.isOverflow||d?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,c=t.x,t.data=[],t.words.forEach((e,a)=>{1===g?(_={char:"",x:c},c=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,c,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):c=function(t,e,a,n,i){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,i&&(e+=i)}),e}(e.data,c,t.data,t.isOverflow,w&&f),w&&(y=a===m-1,u?y||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(d,a,o),d.overflow&&function(t,a,n,i){const{rows:r,overflow:o}=t;let{textOverflow:s}=a;if(o&&r.splice(o),i&&s&&"show"!==s){let t,l;"hide"===s?s="":"ellipsis"===s&&(s="...");const d=s?e.Platform.canvas.measureText(s).width:0,c=n+i-d;("none"===a.textWrap?r:[r[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let n=a;n>-1&&(t=e.data[n],l=t.x+t.width,!(n===a&&l<c));n--){if(l<c&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=d,e.data.push({char:s,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,a,i,o),"none"!==a.textDecoration&&function(t,a){let i,r=0;const{fontSize:o,textDecoration:s}=a;switch(t.decorationHeight=o/11,e.isObject(s)?(i=s.type,s.color&&(t.decorationColor=n.ColorConvert.string(s.color)),s.offset&&(r=Math.min(.3*o,Math.max(s.offset,.15*-o)))):i=s,i){case"under":t.decorationY=[.15*o+r];break;case"delete":t.decorationY=[.35*-o];break;case"under-delete":t.decorationY=[.15*o+r,.35*-o]}}(d,a),d}};const ea={string:function(t,a){if(!t)return"#000";const i=e.isNumber(a)&&a<1;if(e.isString(t)){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let r=e.isUndefined(t.a)?1:t.a;i&&(r*=a);const o=t.r+","+t.g+","+t.b;return 1===r?"rgb("+o+")":"rgba("+o+","+r+")"}};Object.assign(n.TextConvert,ta),Object.assign(n.ColorConvert,ea),Object.assign(n.Paint,W),Object.assign(n.PaintImage,_t),Object.assign(n.PaintGradient,Mt),Object.assign(n.Effect,Qt);const{setPoint:aa,addPoint:na,toBounds:ia}=n.TwoPointBoundsHelper;const ra={syncExport(t,e,a){let i;n.Export.running=!0;try{const r=n.FileHelper.fileType(e),o=e.includes(".");a=n.FileHelper.getExportOptions(a);const{toURL:s}=n.Platform,{download:l}=n.Platform.origin;if("json"===r)o&&l(s(JSON.stringify(t.toJSON(a.json)),"text"),e),i={data:!!o||t.toJSON(a.json)};else if("svg"===r)o&&l(s(t.toSVG(),"svg"),e),i={data:!!o||t.toSVG()};else{let r,o,s=1,l=1;const{worldTransform:d,isLeafer:c,leafer:h,isFrame:u}=t,{slice:f,clip:p,trim:g,screenshot:_,padding:m,onCanvas:y}=a,w=n.isUndefined(a.smooth)?!h||h.config.smooth:a.smooth,v=a.contextSettings||(h?h.config.contextSettings:void 0),x=c&&_&&n.isUndefined(a.fill)?t.fill:a.fill,P=n.FileHelper.isOpaqueImage(e)||x,b=new n.Matrix;if(_)r=!0===_?c?h.canvas.bounds:t.worldRenderBounds:_;else{let e=a.relative||(c?"inner":"local");switch(s=d.scaleX,l=d.scaleY,e){case"inner":b.set(d);break;case"local":b.set(d).divide(t.localTransform),s/=t.scaleX,l/=t.scaleY;break;case"world":s=1,l=1;break;case"page":e=h||t;default:b.set(d).divide(t.getTransform(e));const a=e.worldTransform;s/=s/a.scaleX,l/=l/a.scaleY}r=t.getBounds("render",e)}const S={scaleX:1,scaleY:1};n.MathHelper.getScaleData(a.scale,a.size,r,S);let E=a.pixelRatio||1,{x:B,y:L,width:R,height:k}=new n.Bounds(r).scale(S.scaleX,S.scaleY);p&&(B+=p.x,L+=p.y,R=p.width,k=p.height,p.rotation&&b.rotateOfInner({x:B,y:L},-p.rotation));const C={exporting:!0,matrix:b.scale(1/S.scaleX,1/S.scaleY).invert().translate(-B,-L).withScale(1/s*S.scaleX,1/l*S.scaleY)};let T,A=n.Creator.canvas({width:Math.floor(R),height:Math.floor(k),pixelRatio:E,smooth:w,contextSettings:v});f&&(T=t,T.__worldOpacity=0,t=h||t,C.bounds=A.bounds),A.save();const O=u&&!n.isUndefined(x),I=t.get("fill");if(O&&(t.fill=""),n.Platform.render(t,A,C),O&&(t.fill=I),A.restore(),T&&T.__updateWorldOpacity(),g){o=function(t){const{width:e,height:a}=t.view,{data:i}=t.context.getImageData(0,0,e,a);let r,o,s,l=0;for(let t=0;t<i.length;t+=4)0!==i[t+3]&&(r=l%e,o=(l-r)/e,s?na(s,r,o):aa(s={},r,o)),l++;const d=new n.Bounds;return s&&(ia(s,d),d.scale(1/t.pixelRatio).ceil()),d}(A);const t=A,{width:e,height:a}=o,i={x:0,y:0,width:e,height:a,pixelRatio:E};A=n.Creator.canvas(i),A.copyWorld(t,o,i),t.destroy()}if(m){const[t,e,a,i]=n.MathHelper.fourNumber(m),r=A,{width:o,height:s}=r;A=n.Creator.canvas({width:o+i+e,height:s+t+a,pixelRatio:E}),A.copyWorld(r,r.bounds,{x:i,y:t,width:o,height:s}),r.destroy()}P&&A.fillWorld(A.bounds,x||"#FFFFFF","destination-over"),y&&y(A);i={data:"canvas"===e?A:A.export(e,a),width:A.pixelWidth,height:A.pixelHeight,renderBounds:r,trimBounds:o};const M=h&&h.app;M&&M.canvasManager&&M.canvasManager.clearRecycled()}}catch(t){i={data:"",error:t}}return n.Export.running=!1,i},export(t,e,a){return n.Export.running=!0,function(t){oa||(oa=new n.TaskProcessor);return new Promise(e=>{oa.add(()=>i(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(r=>new Promise(o=>{const s=()=>i(this,void 0,void 0,function*(){if(!n.Resource.isComplete)return n.Platform.requestRender(s);const i=n.Export.syncExport(t,e,a);i.data instanceof Promise&&(i.data=yield i.data),r(i),o()});t.updateLayout(),sa(t);const{leafer:l}=t;l?l.waitViewCompleted(s):s()}))}};let oa;function sa(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>sa(t))}const la=n.LeaferCanvasBase.prototype,da=n.Debug.get("@leafer-in/export");la.export=function(t,e){const{quality:a,blob:i}=n.FileHelper.getExportOptions(e);return t.includes(".")?this.saveAs(t,a):i?this.toBlob(t,a):this.toDataURL(t,a)},la.toBlob=function(t,e){return new Promise(a=>{n.Platform.origin.canvasToBolb(this.view,t,e).then(t=>{a(t)}).catch(t=>{da.error(t),a(null)})})},la.toDataURL=function(t,e){return n.Platform.origin.canvasToDataURL(this.view,t,e)},la.saveAs=function(t,e){return new Promise(a=>{n.Platform.origin.canvasSaveAs(this.view,t,e).then(()=>{a(!0)}).catch(t=>{da.error(t),a(!1)})})},n.Plugin.add("export"),Object.assign(n.Export,ra),n.UI.prototype.export=function(t,e){return n.Export.export(this,t,e)},n.UI.prototype.syncExport=function(t,e){return n.Export.syncExport(this,t,e)},Object.defineProperty(exports,"LeaferFilm",{enumerable:!0,get:function(){return e.LeaferFilm}}),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),Object.defineProperty(exports,"LeaferVideo",{enumerable:!0,get:function(){return e.LeaferVideo}}),exports.Layouter=y,exports.LeaferCanvas=r,exports.Renderer=v,exports.Watcher=s,exports.useCanvas=function(t,n){if(e.Platform.canvasType=t,!e.Platform.origin){if("skia"===t){const{Canvas:t,loadImage:a}=n;e.Platform.origin={createCanvas:(e,a,n)=>new t(e,a,n),canvasToDataURL:(t,a,n)=>t.toDataURL?t.toDataURL(e.FileHelper.mimeType(a),n):(t.toDataURLSync||t.toURLSync)(a,{quality:n}),canvasToBolb:(t,e,a)=>t.toBuffer(e,{quality:a}),canvasSaveAs:(t,e,a)=>t.saveAs(e,{quality:a}),download(t,e){},loadImage:(t,n,i)=>a(e.Platform.image.getRealURL(t)),loadContent:o},e.Platform.roundRectPatch=!0}else if("napi"===t){const{Canvas:t,loadImage:r}=n;e.Platform.origin={createCanvas:(e,a,n)=>new t(e,a,n),canvasToDataURL:(t,a,n)=>t.toDataURL(e.FileHelper.mimeType(a),n),canvasToBolb:(t,a,n)=>i(this,void 0,void 0,function*(){return t.toBuffer(e.FileHelper.mimeType(a),n)}),canvasSaveAs:(t,n,r)=>i(this,void 0,void 0,function*(){return a.writeFileSync(n,t.toBuffer(e.FileHelper.mimeType(e.FileHelper.fileType(n)),r))}),download(t,e){},loadImage:(t,a,n)=>r(e.Platform.image.getRealURL(t)),loadContent:o}}e.Platform.ellipseToCurve=!0,e.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},e.Platform.canvas=e.Creator.canvas()}},Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}),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,e=require("@leafer/core"),a=require("fs"),n=require("@leafer-ui/draw");function i(t,e,a,n){return new(a||(a=Promise))(function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(s,o)}l((n=n.apply(t,e||[])).next())})}exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError;class r extends e.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),e.Platform.roundRectPatch&&(this.context.__proto__.roundRect=null,e.canvasPatch(this.context.__proto__))}__createView(){this.view=e.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}function s(t){return i(this,arguments,void 0,function*(t,e="text"){const a=yield fetch(t);if(!a.ok)throw new Error(`${a.status}`);return yield a[e]()})}Object.assign(e.Creator,{canvas:(t,e)=>new r(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="node",e.Platform.backgrounder=!0,e.Platform.requestRender=function(t){setTimeout(t,16)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>1}),e.Platform.conicGradientSupport=!0;class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,a){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,a&&(this.config=e.DataHelper.default(a,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(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.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,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:c}=e.LeafHelper,{pushAllChildBranch:h,pushAllParent:u}=e.BranchHelper;const{worldBounds:f}=e.LeafBoundsHelper;class p{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),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:g,updateAllChange:_}=e.LeafHelper,m=e.Debug.get("Layouter");class y{constructor(t,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,a&&(this.config=e.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const a=e.Run.start("PartLayout"),{target:n,__updatedList:i}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=e.LayoutEvent,f=this.getBlocks(i);f.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(r,f,this.times)),this.extraBlock=null,i.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&h(t,e),u(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(i,this.__levelList),function(t){let e,a,n;t.sort(!0),t.levels.forEach(i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(a=e[t],a.isBranch&&a.__tempNumber){n=a.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||d(n[t])}d(a)}})}(this.__levelList),function(t){t.list.forEach(c)}(i),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(s,f,this.times)),n.emitEvent(new e.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,e.Run.end(a)}fullLayout(){const t=e.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:i,AFTER:r}=e.LayoutEvent,s=this.getBlocks(new e.LeafList(a));a.emitEvent(new e.LayoutEvent(n,s,this.times)),y.fullLayout(a),s.forEach(t=>{t.setAfter()}),a.emitEvent(new e.LayoutEvent(i,s,this.times)),a.emitEvent(new e.LayoutEvent(r,s,this.times)),this.addBlocks(s),e.Run.end(t)}static fullLayout(t){g(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),_(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));e.length?a.add(t.__world):a.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const w=e.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,a,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=a,n&&(this.config=e.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:a}=this;this.times=0,this.totalBounds=new e.Bounds,w.log(a.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const a=e.Run.start("PartRender"),{canvas:n}=this,i=t.getIntersect(n.bounds),r=new e.Bounds(i);n.save(),i.spread(v.clipSpread).ceil();const{ceilPartPixel:s}=this.config;n.clipWorld(i,s),n.clearWorld(i,s),this.__render(i,r),n.restore(),e.Run.end(a)}fullRender(){const t=e.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),e.Run.end(t)}__render(t,a){const{canvas:n,target:i}=this,r=t.includes(i.__world),s=r?{includes:r}:{bounds:t,includes:r};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(s.cellList=this.getCellList()),e.Platform.render(i,n,s),this.renderBounds=a=a||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const a=new e.Bounds;a.setList(t),t.length=0,t.push(a)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(a);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:a,height:n}=t.old;if(!new e.Bounds(0,0,a,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:a}=t;a&&a.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,a)})}emitRender(t,a,n){this.target.emitEvent(new e.RenderEvent(t,this.times,a,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function x(t,e,a){t.__.__font?n.Paint.fillText(t,e,a):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function b(t,a,i,r,s){const o=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!1,i,r,s):(r.setStroke(t,o.__strokeWidth*a,o),r.stroke()),o.__useArrow&&n.Paint.strokeArrow(t,i,r,s)}function P(t,a,i,r,s){const o=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!0,i,r,s):(r.setStroke(t,o.__strokeWidth*a,o),n.Paint.drawTextStroke(i,r,s))}function S(t,a,i,r,s){const o=r.getSameCanvas(!0,!0);o.font=i.__.__font,P(t,2,i,o,s),o.blendMode="outside"===a?"destination-out":"destination-in",n.Paint.fillText(i,o,s),o.blendMode="normal",e.LeafHelper.copyCanvasByWorld(i,r,o),o.recycle(i.__nowWorld)}v.clipSpread=10,Object.assign(e.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,a)=>new v(t,e,a),selector:(t,e)=>{},interaction:(t,e,a,n)=>{}}),e.Platform.layout=y.fullLayout,e.Platform.render=function(t,a,n){const i=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(a,n),n.topList.length&&n.topList.forEach(t=>t.__render(a,i))};const{getSpread:E,copyAndSpread:B,toOuterOf:L,getOuterOf:R,getByMove:k,move:C,getIntersectData:T}=e.BoundsHelper,A={};let O;const{stintSet:I}=e.DataHelper,{hasTransparent:M}=n.ColorConvert;function D(t,a,i){if(!e.isObject(a)||!1===a.visible||0===a.opacity)return;let r;const{boxBounds:s}=i.__layout,{type:o}=a;switch(o){case"image":case"film":case"video":if(!a.url)return;r=n.PaintImage.image(i,t,a,s,!O||!O[a.url]),"image"!==o&&n.PaintImage[o](r);break;case"linear":r=n.PaintGradient.linearGradient(a,s);break;case"radial":r=n.PaintGradient.radialGradient(a,s);break;case"angular":r=n.PaintGradient.conicGradient(a,s);break;case"solid":const{color:l,opacity:d}=a;r={type:o,style:n.ColorConvert.string(l,d)};break;default:e.isUndefined(a.r)||(r={type:"solid",style:n.ColorConvert.string(a)})}if(r&&(r.originPaint=a,e.isString(r.style)&&M(r.style)&&(r.isTransparent=!0),a.style)){if(0===a.style.strokeWidth)return;r.strokeStyle=a.style}return r}const W={compute:function(t,a){const i=a.__,r=[];let s,o,l,d=i.__input[t];e.isArray(d)||(d=[d]),O=n.PaintImage.recycleImage(t,i);for(let e,n=0,i=d.length;n<i;n++)(e=D(t,d[n],a))&&(r.push(e),e.strokeStyle&&(l||(l=1),e.strokeStyle.strokeWidth&&(l=Math.max(l,e.strokeStyle.strokeWidth))));r.length?(i["_"+t]=r,r.every(t=>t.isTransparent)&&(r.some(t=>t.image)&&(s=!0),o=!0),"fill"===t?(I(i,"__isAlphaPixelFill",s),I(i,"__isTransparentFill",o)):(I(i,"__isAlphaPixelStroke",s),I(i,"__isTransparentStroke",o),I(i,"__hasMultiStrokeStyle",l))):(i.__removePaint(t,!1),i["_"+t]="")},fill:function(t,e,a,n){a.fillStyle=t,x(e,a,n)},fills:function(t,e,a,i){let r,s,o;for(let l=0,d=t.length;l<d;l++){if(r=t[l],s=r.originPaint,r.image){if(o?o++:o=1,n.PaintImage.checkImage(r,!e.__.__font,e,a,i))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,a,i);continue}}if(a.fillStyle=r.style,r.transform||s.scaleFixed){if(a.save(),r.transform&&a.transform(r.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0,s.scaleFixed,!1);1!==t&&a.scale(t,n)}s.blendMode&&(a.blendMode=s.blendMode),x(e,a,i),a.restore()}else s.blendMode?(a.saveBlendMode(s.blendMode),x(e,a,i),a.restoreBlendMode()):x(e,a,i)}},fillPathOrText:x,fillText:function(t,e,a){const n=t.__,{rows:i,decorationY:r}=n.__textDrawData;let s;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,a=i.length;t<a;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.fillText(t.char,t.x,s.y)});if(r){const{decorationColor:t,decorationHeight:a}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(n=>e.fillRect(t.x,t.y+n,t.width,a)))}},stroke:function(t,a,i,r){const s=a.__;if(s.__strokeWidth)if(s.__font)n.Paint.strokeText(t,a,i,r);else if(s.__pathForStroke)n.Paint.fillStroke(t,a,i,r);else switch(s.strokeAlign){case"center":b(t,1,a,i,r);break;case"inside":!function(t,e,a,n){a.save(),a.clipUI(e),b(t,2,e,a,n),a.restore()}(t,a,i,r);break;case"outside":!function(t,a,n,i){const r=a.__;if(r.__fillAfterStroke)b(t,2,a,n,i);else{const{renderBounds:s}=a.__layout,o=n.getSameCanvas(!0,!0);a.__drawRenderPath(o),b(t,2,a,o,i),o.clipUI(r),o.clearWorld(s),e.LeafHelper.copyCanvasByWorld(a,n,o),o.recycle(a.__nowWorld)}}(t,a,i,r)}},strokes:function(t,e,a,i){n.Paint.stroke(t,e,a,i)},strokeText:function(t,e,a,n){switch(e.__.strokeAlign){case"center":P(t,1,e,a,n);break;case"inside":S(t,"inside",e,a,n);break;case"outside":e.__.__fillAfterStroke?P(t,2,e,a,n):S(t,"outside",e,a,n)}},drawTextStroke:function(t,e,a){let n,i=t.__.__textDrawData;const{rows:r,decorationY:s}=i;for(let t=0,a=r.length;t<a;t++)n=r[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)});if(s){const{decorationHeight:t}=i;r.forEach(a=>s.forEach(n=>e.strokeRect(a.x,a.y+n,a.width,t)))}},drawStrokesStyle:function(t,e,a,i,r,s){let o;const l=i.__,{__hasMultiStrokeStyle:d}=l;d||r.setStroke(void 0,l.__strokeWidth*e,l);for(let c=0,h=t.length;c<h;c++)if(o=t[c],(!o.image||!n.PaintImage.checkImage(o,!1,i,r,s))&&o.style){if(d){const{strokeStyle:t}=o;t?r.setStroke(o.style,l.__getRealStrokeWidth(t)*e,l,t):r.setStroke(o.style,l.__strokeWidth*e,l)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),a?n.Paint.drawTextStroke(i,r,s):r.stroke(),r.restoreBlendMode()):a?n.Paint.drawTextStroke(i,r,s):r.stroke()}},shape:function(t,a,n){const i=a.getSameCanvas(),r=a.bounds,s=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,c,h,u,f,p;L(o.strokeSpread?(B(A,o.boxBounds,o.strokeSpread),A):o.boxBounds,s,l);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(r.includes(l))p=i,d=f=l,c=s;else{let i;if(e.Platform.fullImageShadow)i=l;else{const t=o.renderShapeSpread?E(r,e.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,_)):r;i=T(t,l)}u=r.getFitMatrix(i);let{a:m,d:y}=u;u.a<1&&(p=a.getSameCanvas(),t.__renderShape(p,n),g*=m,_*=y),f=R(l,u),d=k(f,-u.e,-u.f),c=R(s,u),C(c,-u.e,-u.f);const w=n.matrix;w?(h=new e.Matrix(u),h.multiply(w),m*=w.scaleX,y*=w.scaleY):h=u,h.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:h})}return t.__renderShape(i,n),{canvas:i,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let H,F=new e.Bounds;const{isSame:U}=e.BoundsHelper;function j(t,a,i,r,s,o){let l=!0;const d=t.__;if("fill"!==a||d.__naturalWidth||(d.__naturalWidth=r.width/d.pixelRatio,d.__naturalHeight=r.height/d.pixelRatio,d.__autoSide&&(t.forceUpdate("width"),e.LeafHelper.updateBounds(t),t.__proxyData&&(t.setProxyAttr("width",d.width),t.setProxyAttr("height",d.height)),l=!1)),"brush"===i.mode&&n.PaintImage.brush(s),!s.data){n.PaintImage.createData(s,r,i,o);const{transform:t}=s.data,{opacity:e}=i,a=(t&&!t.onlyScale||d.path||d.cornerRadius)&&!s.brush;(a||e&&e<1||i.blendMode)&&(s.complex=!a||2)}return i.filter&&n.PaintImage.applyFilter(s,r,i.filter,t),l}function Y(t,a){q(t,e.ImageEvent.LOAD,a)}function N(t,a){q(t,e.ImageEvent.LOADED,a)}function X(t,a,n){a.error=n,t.forceUpdate("surface"),q(t,e.ImageEvent.ERROR,a)}function q(t,a,n){t.hasEvent(a)&&t.emitEvent(new e.ImageEvent(a,n))}function G(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:z,translate:V}=e.MatrixHelper,Q=new e.Bounds,J={},Z={};function $(t,a,n,i){const r=e.isString(t)||i?(i?n-i*a:n%a)/((i||Math.floor(n/a))-1):t;return"auto"===t&&r<0?0:r}let K={},tt=e.getMatrixData();const{get:et,set:at,rotateOfOuter:nt,translate:it,scaleOfOuter:rt,multiplyParent:st,scale:ot,rotate:lt,skew:dt}=e.MatrixHelper;function ct(t,e,a,n,i,r,s,o){s&<(t,s),o&&dt(t,o.x,o.y),i&&ot(t,i,r),it(t,e.x+a,e.y+n)}const{get:ht,scale:ut,copy:ft}=e.MatrixHelper,{getFloorScale:pt}=e.MathHelper,{abs:gt}=Math;const _t={image:function(t,a,n,i,r){let s,o;const l=e.ImageManager.get(n,n.type);return H&&n===H.paint&&U(i,H.boxBounds)?s=H.leafPaint:(s={type:n.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),H=l.use>1?{leafPaint:s,paint:n,boxBounds:F.set(i)}:null),(r||l.loading)&&(o={image:l,attrName:a,attrValue:n}),l.ready?(j(t,a,n,l,s,i),r&&(Y(t,o),N(t,o))):l.error?r&&X(t,o,l.error):(r&&(G(t,!0),Y(t,o)),s.loadId=l.load(()=>{G(t,!1),t.destroyed||(j(t,a,n,l,s,i)&&(l.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),N(t,o)),s.loadId=void 0},e=>{G(t,!1),X(t,o,e),s.loadId=void 0},n.lod&&l.getThumbSize(n.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(t,a,i,r,s){const{scaleX:o,scaleY:l}=n.PaintImage.getImageRenderScaleData(t,i,r,s),d=t.film?t.nowIndex:o+"-"+l,{image:c,brush:h,data:u,originPaint:f}=t,{exporting:p,snapshot:g}=s;if(!u||t.patternId===d&&!p||g){if(!h||!t.style)return!1}else if(a&&(u.repeat?a=!1:f.changeful||t.film||"miniapp"===e.Platform.name||p||(a=e.Platform.image.isLarge(c,o,l)||c.width*o>8096||c.height*l>8096)),a)i.__.__isFastShadow&&(r.fillStyle=t.style||"#000",r.fill());else if(!t.style||f.sync||p?n.PaintImage.createPattern(t,i,r,s):n.PaintImage.createPatternTask(t,i,r,s),!h||!t.style)return!1;return n.PaintImage.drawImage(t,o,l,i,r,s),!0},drawImage:function(t,e,a,n,i,r){const{data:s,image:o,brush:l,complex:d}=t;let{width:c,height:h}=o,u=l||o;if(d){const{blendMode:r,opacity:o}=t.originPaint,{transform:l}=s;i.save(),2===d&&i.clipUI(n),r&&(i.blendMode=r),o&&(i.opacity*=o),l&&i.transform(l),u.render(i,0,0,c,h,n,t,e,a),i.restore()}else s.scaleX&&(c*=s.scaleX,h*=s.scaleY),u.render(i,0,0,c,h,n,t,e,a)},getImageRenderScaleData:function(t,e,a,i){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:s}=t;if(t.brush&&n.PaintImage.addBrushScale(r,t,e),a){const{pixelRatio:t}=a;r.scaleX*=t,r.scaleY*=t}return s&&s.scaleX&&(r.scaleX*=Math.abs(s.scaleX),r.scaleY*=Math.abs(s.scaleY)),r},recycleImage:function(t,a){const i=a["_"+t];if(e.isArray(i)){let r,s,o,l,d;const c=a.__leaf;for(let h=0,u=i.length;h<u;h++)r=i[h],s=r.image,d=s&&s.url,d&&(o||(o={}),o[d]=!0,e.ImageManager.recyclePaint(r),r.brush&&n.PaintImage.recycleBrush(r,c),a.__willDestroy&&s.parent&&n.PaintImage.recycleFilter(s,c),s.loading&&(l||(l=a.__input&&a.__input[t]||[],e.isArray(l)||(l=[l])),s.unload(i[h].loadId,!l.some(t=>t.url===d))));return o}return null},createPatternTask:function(t,a,r,s){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>i(this,void 0,void 0,function*(){n.PaintImage.createPattern(t,a,r,s),a.forceUpdate("surface")}),0,()=>(t.patternTask=null,r.bounds.hit(a.__nowWorld))))},createPattern:function(t,a,i,r){let{scaleX:s,scaleY:o}=n.PaintImage.getImageRenderScaleData(t,a,i,r),l=t.film?t.nowIndex:s+"-"+o;if(t.patternId!==l&&!a.destroyed&&(!e.Platform.image.isLarge(t.image,s,o)||t.data.repeat)){const{image:i,brush:r,data:d}=t,{opacity:c}=t.originPaint,{transform:h,gap:u}=d,f=n.PaintImage.getPatternFixScale(t,s,o);let p,g,_,{width:m,height:y}=i;if(f&&(s*=f,o*=f),m*=s,y*=o,u&&(g=u.x*s/gt(d.scaleX||1),_=u.y*o/gt(d.scaleY||1),r)){const e=n.PaintImage.getBrushScale(t,a);g/=e,_/=e}(h||1!==s||1!==o)&&(s*=pt(m+(g||0)),o*=pt(y+(_||0)),p=ht(),h&&ft(p,h),ut(p,1/s,1/o));const w=i.getCanvas(m,y,c,void 0,g,_,a.leafer&&a.leafer.config.smooth,d.interlace),v=r?w:i.getPattern(w,d.repeat||e.Platform.origin.noRepeat||"no-repeat",p,t);t.style=v,t.patternId=l}},getPatternFixScale:function(t,a,n){const{image:i}=t;let r,s=e.Platform.image.maxPatternSize,o=i.width*i.height;return i.isSVG?a>1&&(r=Math.ceil(a)/a):s>o&&(s=o),(o*=a*n)>s&&(r=Math.sqrt(s/o)),r},createData:function(t,e,a,i){t.data=n.PaintImage.getPatternData(a,i,e)},getPatternData:function(t,a,i){t.padding&&(a=Q.set(a).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:r,height:s}=i,{mode:o,align:l,offset:d,scale:c,size:h,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,interlace:m}=t,y=a.width===r&&a.height===s,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(e.BoundsHelper.set(Z,0,0,v?s:r,v?r:s),o&&"cover"!==o&&"fit"!==o?((c||h)&&(e.MathHelper.getScaleData(c,h,i,J),x=J.scaleX,b=J.scaleY),(l||_||g)&&(x&&e.BoundsHelper.scale(Z,x,b,!0),l&&e.AlignHelper.toPoint(l,Z,a,Z,!0,!0))):y&&!u||(x=b=e.BoundsHelper.getFitScale(a,Z,"fit"!==o),e.BoundsHelper.put(a,i,l,x,!1,Z),e.BoundsHelper.scale(Z,x,b,!0)),d&&e.PointHelper.move(Z,d),o){case"stretch":y?x&&(x=b=void 0):(x=a.width/r,b=a.height/s,n.PaintImage.stretchMode(w,a,x,b));break;case"normal":case"clip":if(Z.x||Z.y||x||p||u||f){let t,e;p&&(t=a.width/p.width,e=a.height/p.height),n.PaintImage.clipMode(w,a,Z.x,Z.y,x,b,u,f,t,e),t&&(x=x?x*t:t,b=b?b*e:e)}break;case"repeat":case"brush":(!y||x||u||f)&&n.PaintImage.repeatMode(w,a,r,s,Z.x,Z.y,x,b,u,f,l,t.freeTransform),g||(w.repeat="repeat");const i=e.isObject(g);(_||i)&&(w.gap=function(t,a,n,i,r){let s,o;e.isObject(t)?(s=t.x,o=t.y):s=o=t;return{x:$(s,n,r.width,a&&a.x),y:$(o,i,r.height,a&&a.y)}}(_,i&&g,Z.width,Z.height,a));break;default:x&&n.PaintImage.fillOrFitMode(w,a,Z.x,Z.y,x,b,u)}return w.transform||(a.x||a.y)&&V(w.transform=z(),a.x,a.y),x&&(w.scaleX=x,w.scaleY=b),g&&(w.repeat=e.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=e.isNumber(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,a,n){const i=et(),{x:r,y:s}=e;r||s?it(i,r,s):a>0&&n>0&&(i.onlyScale=!0),ot(i,a,n),t.transform=i},fillOrFitMode:function(t,e,a,n,i,r,s){const o=et();it(o,e.x+a,e.y+n),ot(o,i,r),s&&nt(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o},clipMode:function(t,e,a,n,i,r,s,o,l,d){const c=et();ct(c,e,a,n,i,r,s,o),l&&(s||o?(at(tt),rt(tt,e,l,d),st(c,tt)):rt(c,e,l,d)),t.transform=c},repeatMode:function(t,e,a,n,i,r,s,o,l,d,c,h){const u=et();if(h)ct(u,e,i,r,s,o,l,d);else{if(l)if("center"===c)nt(u,{x:a/2,y:n/2},l);else switch(lt(u,l),l){case 90:it(u,n,0);break;case 180:it(u,a,n);break;case 270:it(u,0,a)}K.x=e.x+i,K.y=e.y+r,it(u,K.x,K.y),s&&rt(u,K,s,o)}t.transform=u}},{toPoint:mt}=e.AroundHelper,{hasTransparent:yt}=n.ColorConvert,wt={},vt={};function xt(t,a,i,r){if(i){let s,o,l,d;for(let t=0,c=i.length;t<c;t++)s=i[t],e.isString(s)?(l=t/(c-1),o=n.ColorConvert.string(s,r)):(l=s.offset,o=n.ColorConvert.string(s.color,r)),a.addColorStop(l,o),!d&&yt(o)&&(d=!0);d&&(t.isTransparent=!0)}}const{getAngle:bt,getDistance:Pt}=e.PointHelper,{get:St,rotateOfOuter:Et,scaleOfOuter:Bt}=e.MatrixHelper,{toPoint:Lt}=e.AroundHelper,Rt={},kt={};function Ct(t,e,a,n,i){let r;const{width:s,height:o}=t;if(s!==o||n){const t=bt(e,a);r=St(),i?(Bt(r,e,s/o*(n||1),1),Et(r,e,t+90)):(Bt(r,e,1,s/o*(n||1)),Et(r,e,t))}return r}const{getDistance:Tt}=e.PointHelper,{toPoint:At}=e.AroundHelper,Ot={},It={};const Mt={linearGradient:function(t,a){let{from:n,to:i,type:r,opacity:s}=t;mt(n||"top",a,wt),mt(i||"bottom",a,vt);const o=e.Platform.canvas.createLinearGradient(wt.x,wt.y,vt.x,vt.y),l={type:r,style:o};return xt(l,o,t.stops,s),l},radialGradient:function(t,a){let{from:n,to:i,type:r,opacity:s,stretch:o}=t;Lt(n||"center",a,Rt),Lt(i||"bottom",a,kt);const l=e.Platform.canvas.createRadialGradient(Rt.x,Rt.y,0,Rt.x,Rt.y,Pt(Rt,kt)),d={type:r,style:l};xt(d,l,t.stops,s);const c=Ct(a,Rt,kt,o,!0);return c&&(d.transform=c),d},conicGradient:function(t,a){let{from:n,to:i,type:r,opacity:s,rotation:o,stretch:l}=t;At(n||"center",a,Ot),At(i||"bottom",a,It);const d=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(o?o*e.OneRadian:0,Ot.x,Ot.y):e.Platform.canvas.createRadialGradient(Ot.x,Ot.y,0,Ot.x,Ot.y,Tt(Ot,It)),c={type:r,style:d};xt(c,d,t.stops,s);const h=Ct(a,Ot,It,l||1,e.Platform.conicGradientRotate90);return h&&(c.transform=h),c},getTransform:Ct},{copy:Dt,move:Wt,toOffsetOutBounds:Ht}=e.BoundsHelper,{max:Ft,abs:Ut}=Math,jt={},Yt=new e.Matrix,Nt={};function Xt(t,e){let a,n,i,r,s=0,o=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,n=t.y||0,r=1.5*(t.blur||0),i=Ut(t.spread||0),s=Ft(s,i+r-n),o=Ft(o,i+r+a),l=Ft(l,i+r+n),d=Ft(d,i+r-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function qt(t,a,n){const{shapeBounds:i}=n;let r,s;e.Platform.fullImageShadow?(Dt(jt,t.bounds),Wt(jt,a.x-i.x,a.y-i.y),r=t.bounds,s=jt):(r=i,s=a),t.copyWorld(n.canvas,r,s)}const{toOffsetOutBounds:Gt}=e.BoundsHelper,zt={};const Vt=Xt;const Qt={shadow:function(t,a,i){let r,s;const{__nowWorld:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=i,g=a.getSameCanvas(),_=l.length-1;Ht(c,Nt,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.setWorldShadow(Nt.offsetX+(l.x||0)*f*y,Nt.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y,n.ColorConvert.string(l.color)),s=n.Effect.getShadowTransform(t,g,i,l,Nt,y),s&&g.setTransform(s),qt(g,Nt,i),s&&g.resetTransform(),r=h,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,h,o,"copy"),r=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(i.canvas,u,c,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,a,g,r,l.blendMode),_&&m<_&&g.clearWorld(r)}),g.recycle(r)},innerShadow:function(t,a,i){let r,s;const{__nowWorld:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=i,g=a.getSameCanvas(),_=l.length-1;Gt(c,zt,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.save(),g.setWorldShadow(zt.offsetX+(l.x||0)*f*y,zt.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y),s=n.Effect.getShadowTransform(t,g,i,l,zt,y,!0),s&&g.setTransform(s),qt(g,zt,i),g.restore(),d?(g.copyWorld(g,h,o,"copy"),g.copyWorld(d,o,o,"source-out"),r=o):(g.copyWorld(i.canvas,u,c,"source-out"),r=h),g.fillWorld(r,n.ColorConvert.string(l.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,a,g,r,l.blendMode),_&&m<_&&g.clearWorld(r)}),g.recycle(r)},blur:function(t,e,a){const{blur:n}=t.__;a.setWorldBlur(n*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Xt,getShadowTransform:function(t,e,a,n,i,r,s){if(n.spread){const a=2*n.spread*r*(s?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Yt.set().scaleOfOuter({x:(i.x+i.width/2)*e.pixelRatio,y:(i.y+i.height/2)*e.pixelRatio},1+a/o,1+a/l),Yt}},isTransformShadow(t){},getInnerShadowSpread:Vt},{excludeRenderBounds:Jt}=e.LeafBoundsHelper;let Zt;function $t(t,e,a,n,i,r,s,o){switch(e){case"grayscale":Zt||(Zt=!0,i.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,n,i,r){const s=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,s),r&&n.recycle(s);te(t,e,a,1,i,r)}(t,a,n,i,s,o);break;case"opacity-path":te(t,a,n,r,s,o);break;case"path":o&&a.restore()}}function Kt(t){return t.getSameCanvas(!1,!0)}function te(t,e,a,n,i,r){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(a,s,void 0,i),r?a.recycle(s):a.clearWorld(s)}n.Group.prototype.__renderMask=function(t,e){let a,n,i,r,s,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(a=l[d],o=a.__.mask,o){s&&($t(this,s,t,i,n,r,void 0,!0),n=i=null),"clipping"!==o&&"clipping-path"!==o||Jt(a,e)||a.__render(t,e),r=a.__.opacity,Zt=!1,"path"===o||"clipping-path"===o?(r<1?(s="opacity-path",i||(i=Kt(t))):(s="path",t.save()),a.__clip(i||t,e)):(s="grayscale"===o?"grayscale":"alpha",n||(n=Kt(t)),i||(i=Kt(t)),a.__render(n,e));continue}const c=1===r&&a.__.__blendMode;c&&$t(this,s,t,i,n,r,void 0,!1),Jt(a,e)||a.__render(i||t,e),c&&$t(this,s,t,i,n,r,c,!1)}$t(this,s,t,i,n,r,void 0,!0)};const ee=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ae=ee+"_#~&*+\\=|≮≯≈≠=…",ne=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 ie(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const re=ie("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),se=ie("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),oe=ie(ee),le=ie(ae),de=ie("- —/~|┆·");var ce;!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"}(ce||(ce={}));const{Letter:he,Single:ue,Before:fe,After:pe,Symbol:ge,Break:_e}=ce;function me(t){return re[t]?he:de[t]?_e:se[t]?fe:oe[t]?pe:le[t]?ge:ne.test(t)?ue:he}const ye={trimRight(t){const{words:e}=t;let a,n=0,i=e.length;for(let r=i-1;r>-1&&(a=e[r].data[0]," "===a.char);r--)n++,t.width-=a.width;n&&e.splice(i-n,n)}};function we(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:ve}=ye,{Letter:xe,Single:be,Before:Pe,After:Se,Symbol:Ee,Break:Be}=ce;let Le,Re,ke,Ce,Te,Ae,Oe,Ie,Me,De,We,He,Fe,Ue,je,Ye,Ne,Xe=[];function qe(t,e){Me&&!Ie&&(Ie=Me),Le.data.push({char:t,width:e}),ke+=e}function Ge(){Ce+=ke,Le.width=ke,Re.words.push(Le),Le={data:[]},ke=0}function ze(){Ue&&(je.paraNumber++,Re.paraStart=!0,Ue=!1),Me&&(Re.startCharSize=Ie,Re.endCharSize=Me,Ie=0),Re.width=Ce,Ye.width?ve(Re):Ne&&Ve(),Xe.push(Re),Re={words:[]},Ce=0}function Ve(){Ce>(je.maxWidth||0)&&(je.maxWidth=Ce)}const{top:Qe,right:Je,bottom:Ze,left:$e}=e.Direction4;function Ke(t,e,a){const{bounds:n,rows:i}=t;n[e]+=a;for(let t=0;t<i.length;t++)i[t][e]+=a}const ta={getDrawData:function(t,a){e.isString(t)||(t=String(t));let i=0,r=0,s=a.__getInput("width")||0,o=a.__getInput("height")||0;const{__padding:l}=a;l&&(s?(i=l[$e],s-=l[Je]+l[$e],!s&&(s=.01)):a.autoSizeAlign||(i=l[$e]),o?(r=l[Qe],o-=l[Qe]+l[Ze],!o&&(o=.01)):a.autoSizeAlign||(r=l[Qe]));const d={bounds:{x:i,y:r,width:s,height:o},rows:[],paraNumber:0,font:e.Platform.canvas.font=a.__font};return function(t,a,n){je=t,Xe=t.rows,Ye=t.bounds,Ne=!Ye.width&&!n.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:s}=n,{canvas:o}=e.Platform,{width:l}=Ye;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;Ue=!0,We=null,Ie=Oe=Me=ke=Ce=0,Le={data:[]},Re={words:[]};for(let n=0,d=(a=[...a]).length;n<d;n++)Ae=a[n],"\n"===Ae?(ke&&Ge(),Re.paraEnd=!0,ze(),Ue=!0):(De=me(Ae),De===xe&&"none"!==s&&(Ae=we(Ae,s,!ke)),Oe=o.measureText(Ae).width,i&&(i<0&&(Me=Oe),Oe+=i),He=De===be&&(We===be||We===xe)||We===be&&De!==Se,Fe=!(De!==Pe&&De!==be||We!==Ee&&We!==Se),Te=Ue&&r?l-r:l,t&&l&&Ce+ke+Oe>Te&&(e?(ke&&Ge(),Ce&&ze()):(Fe||(Fe=De===xe&&We==Se),He||Fe||De===Be||De===Pe||De===be||ke+Oe>Te?(ke&&Ge(),Ce&&ze()):Ce&&ze()))," "===Ae&&!0!==Ue&&Ce+ke===0||(De===Be?(" "===Ae&&ke&&Ge(),qe(Ae,Oe),Ge()):He||Fe?(ke&&Ge(),qe(Ae,Oe)):qe(Ae,Oe)),We=De);ke&&Ge(),Ce&&ze(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{je.paraNumber++,Ce=o.measureText(t).width,Xe.push({x:r||0,text:t,width:Ce,paraStart:!0}),Ne&&Ve()})}(d,t,a),l&&function(t,e,a,n,i){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":Ke(e,"x",t[$e]);break;case"right":Ke(e,"x",-t[Je])}if(!i&&a.autoSizeAlign)switch(a.verticalAlign){case"top":Ke(e,"y",t[Qe]);break;case"bottom":Ke(e,"y",-t[Ze])}}(l,d,a,s,o),function(t,e){const{rows:a,bounds:n}=t,i=a.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=n,m=r*i+(h?h*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(e.__autoHeight?m:_,r),i>1&&(t.overflow=i);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,b=g||u?g:t.maxWidth;for(let s=0,c=i;s<c;s++){if(w=a[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&h&&s>0&&(y+=h),w.y=y,y+=r,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=a.length))}n.y=p,n.height=m}(d,a),a.__isCharMode&&function(t,e,a){const{rows:n}=t,{textAlign:i,paraIndent:r,__letterSpacing:s}=e,o=a&&i.includes("both"),l=o||a&&i.includes("justify"),d=l&&i.includes("letter");let c,h,u,f,p,g,_,m,y,w;n.forEach(t=>{t.words&&(p=r&&t.paraStart?r:0,m=t.words.length,l&&(w=!t.paraEnd||o,h=a-t.width-p,d?f=h/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?h/(m-1):0),g=s||t.isOverflow||d?0:u?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,c=t.x,t.data=[],t.words.forEach((e,a)=>{1===g?(_={char:"",x:c},c=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,c,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):c=function(t,e,a,n,i){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,i&&(e+=i)}),e}(e.data,c,t.data,t.isOverflow,w&&f),w&&(y=a===m-1,u?y||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(d,a,s),d.overflow&&function(t,a,n,i){const{rows:r,overflow:s}=t;let{textOverflow:o}=a;if(s&&r.splice(s),i&&o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.Platform.canvas.measureText(o).width:0,c=n+i-d;("none"===a.textWrap?r:[r[s-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let n=a;n>-1&&(t=e.data[n],l=t.x+t.width,!(n===a&&l<c));n--){if(l<c&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=d,e.data.push({char:o,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,a,i,s),"none"!==a.textDecoration&&function(t,a){let i,r=0;const{fontSize:s,textDecoration:o}=a;switch(t.decorationHeight=s/11,e.isObject(o)?(i=o.type,o.color&&(t.decorationColor=n.ColorConvert.string(o.color)),o.offset&&(r=Math.min(.3*s,Math.max(o.offset,.15*-s)))):i=o,i){case"under":t.decorationY=[.15*s+r];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s+r,.35*-s]}}(d,a),d}};const ea={string:function(t,a){if(!t)return"#000";const i=e.isNumber(a)&&a<1;if(e.isString(t)){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let r=e.isUndefined(t.a)?1:t.a;i&&(r*=a);const s=t.r+","+t.g+","+t.b;return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}};Object.assign(n.TextConvert,ta),Object.assign(n.ColorConvert,ea),Object.assign(n.Paint,W),Object.assign(n.PaintImage,_t),Object.assign(n.PaintGradient,Mt),Object.assign(n.Effect,Qt);const{setPoint:aa,addPoint:na,toBounds:ia}=n.TwoPointBoundsHelper;const ra={syncExport(t,e,a){let i;n.Export.running=!0;try{const r=n.FileHelper.fileType(e),s=e.includes(".");a=n.FileHelper.getExportOptions(a);const{toURL:o}=n.Platform,{download:l}=n.Platform.origin;if("json"===r)s&&l(o(JSON.stringify(t.toJSON(a.json)),"text"),e),i={data:!!s||t.toJSON(a.json)};else if("svg"===r)s&&l(o(t.toSVG(),"svg"),e),i={data:!!s||t.toSVG()};else{let r,s,o=1,l=1;const{worldTransform:d,isLeafer:c,leafer:h,isFrame:u}=t,{slice:f,clip:p,trim:g,screenshot:_,padding:m,onCanvas:y}=a,w=n.isUndefined(a.smooth)?!h||h.config.smooth:a.smooth,v=a.contextSettings||(h?h.config.contextSettings:void 0),x=c&&_&&n.isUndefined(a.fill)?t.fill:a.fill,b=n.FileHelper.isOpaqueImage(e)||x,P=new n.Matrix;if(_)r=!0===_?c?h.canvas.bounds:t.worldRenderBounds:_;else{let e=a.relative||(c?"inner":"local");switch(o=d.scaleX,l=d.scaleY,e){case"inner":P.set(d);break;case"local":P.set(d).divide(t.localTransform),o/=t.scaleX,l/=t.scaleY;break;case"world":o=1,l=1;break;case"page":e=h||t;default:P.set(d).divide(t.getTransform(e));const a=e.worldTransform;o/=o/a.scaleX,l/=l/a.scaleY}r=t.getBounds("render",e)}const S={scaleX:1,scaleY:1};n.MathHelper.getScaleData(a.scale,a.size,r,S);let E=a.pixelRatio||1,{x:B,y:L,width:R,height:k}=new n.Bounds(r).scale(S.scaleX,S.scaleY);p&&(B+=p.x,L+=p.y,R=p.width,k=p.height,p.rotation&&P.rotateOfInner({x:B,y:L},-p.rotation));const C={exporting:!0,matrix:P.scale(1/S.scaleX,1/S.scaleY).invert().translate(-B,-L).withScale(1/o*S.scaleX,1/l*S.scaleY)};let T,A=n.Creator.canvas({width:Math.floor(R),height:Math.floor(k),pixelRatio:E,smooth:w,contextSettings:v});f&&(T=t,T.__worldOpacity=0,t=h||t,C.bounds=A.bounds),A.save();const O=u&&!n.isUndefined(x),I=t.get("fill");if(O&&(t.fill=""),n.Platform.render(t,A,C),O&&(t.fill=I),A.restore(),T&&T.__updateWorldOpacity(),g){s=function(t){const{width:e,height:a}=t.view,{data:i}=t.context.getImageData(0,0,e,a);let r,s,o,l=0;for(let t=0;t<i.length;t+=4)0!==i[t+3]&&(r=l%e,s=(l-r)/e,o?na(o,r,s):aa(o={},r,s)),l++;const d=new n.Bounds;return o&&(ia(o,d),d.scale(1/t.pixelRatio).ceil()),d}(A);const t=A,{width:e,height:a}=s,i={x:0,y:0,width:e,height:a,pixelRatio:E};A=n.Creator.canvas(i),A.copyWorld(t,s,i),t.destroy()}if(m){const[t,e,a,i]=n.MathHelper.fourNumber(m),r=A,{width:s,height:o}=r;A=n.Creator.canvas({width:s+i+e,height:o+t+a,pixelRatio:E}),A.copyWorld(r,r.bounds,{x:i,y:t,width:s,height:o}),r.destroy()}b&&A.fillWorld(A.bounds,x||"#FFFFFF","destination-over"),y&&y(A);i={data:"canvas"===e?A:A.export(e,a),width:A.pixelWidth,height:A.pixelHeight,renderBounds:r,trimBounds:s};const M=h&&h.app;M&&M.canvasManager&&M.canvasManager.clearRecycled()}}catch(t){i={data:"",error:t}}return n.Export.running=!1,i},export(t,e,a){return n.Export.running=!0,function(t){sa||(sa=new n.TaskProcessor);return new Promise(e=>{sa.add(()=>i(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(r=>new Promise(s=>{const o=()=>i(this,void 0,void 0,function*(){if(!n.Resource.isComplete)return n.Platform.requestRender(o);const i=n.Export.syncExport(t,e,a);i.data instanceof Promise&&(i.data=yield i.data),r(i),s()});t.updateLayout(),oa(t);const{leafer:l}=t;l?l.waitViewCompleted(o):o()}))}};let sa;function oa(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>oa(t))}const la=n.LeaferCanvasBase.prototype,da=n.Debug.get("@leafer-in/export");la.export=function(t,e){const{quality:a,blob:i}=n.FileHelper.getExportOptions(e);return t.includes(".")?this.saveAs(t,a):i?this.toBlob(t,a):this.toDataURL(t,a)},la.toBlob=function(t,e){return new Promise(a=>{n.Platform.origin.canvasToBolb(this.view,t,e).then(t=>{a(t)}).catch(t=>{da.error(t),a(null)})})},la.toDataURL=function(t,e){return n.Platform.origin.canvasToDataURL(this.view,t,e)},la.saveAs=function(t,e){return new Promise(a=>{n.Platform.origin.canvasSaveAs(this.view,t,e).then(()=>{a(!0)}).catch(t=>{da.error(t),a(!1)})})},n.Plugin.add("export"),Object.assign(n.Export,ra),n.UI.prototype.export=function(t,e){return n.Export.export(this,t,e)},n.UI.prototype.syncExport=function(t,e){return n.Export.syncExport(this,t,e)},Object.defineProperty(exports,"LeaferFilm",{enumerable:!0,get:function(){return e.LeaferFilm}}),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),Object.defineProperty(exports,"LeaferVideo",{enumerable:!0,get:function(){return e.LeaferVideo}}),exports.Layouter=y,exports.LeaferCanvas=r,exports.Renderer=v,exports.Watcher=o,exports.useCanvas=function(t,n){if(e.Platform.canvasType=t,!e.Platform.origin){if("skia"===t){const{Canvas:t,loadImage:a}=n;e.Platform.origin={createCanvas:(e,a,n)=>new t(e,a,n),canvasToDataURL:(t,a,n)=>t.toDataURL?t.toDataURL(e.FileHelper.mimeType(a),n):(t.toDataURLSync||t.toURLSync)(a,{quality:n}),canvasToBolb:(t,e,a)=>t.toBuffer(e,{quality:a}),canvasSaveAs:(t,e,a)=>t.saveAs(e,{quality:a}),download(t,e){},loadImage:(t,n,i)=>a(e.Platform.image.getRealURL(t)),loadContent:s},e.Platform.roundRectPatch=!0}else if("napi"===t){const{Canvas:t,loadImage:r}=n;e.Platform.origin={createCanvas:(e,a,n)=>new t(e,a,n),canvasToDataURL:(t,a,n)=>t.toDataURL(e.FileHelper.mimeType(a),n),canvasToBolb:(t,a,n)=>i(this,void 0,void 0,function*(){return t.toBuffer(e.FileHelper.mimeType(a),n)}),canvasSaveAs:(t,n,r)=>i(this,void 0,void 0,function*(){return a.writeFileSync(n,t.toBuffer(e.FileHelper.mimeType(e.FileHelper.fileType(n)),r))}),download(t,e){},loadImage:(t,a,n)=>r(e.Platform.image.getRealURL(t)),loadContent:s}}e.Platform.ellipseToCurve=!0,e.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},e.Platform.canvas=e.Creator.canvas()}},Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}),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]}})});
|
|
2
2
|
//# sourceMappingURL=node.min.cjs.map
|