@leafer-ui/miniapp 1.7.0 → 1.9.0
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/miniapp.cjs +1227 -1090
- package/dist/miniapp.esm.js +1209 -1085
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +5714 -5144
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +12 -12
- package/src/core.ts +1 -1
package/dist/miniapp.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),i=require("@leafer-ui/draw");class n extends t.LeaferCanvasBase{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?("string"==typeof i?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.Platform.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.Platform.miniapp.getSizeView(this.viewSelect).then((t=>{this.initView(t)}))):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:n,pixelRatio:s}=this.config,a={width:i||e.width,height:n||e.height,pixelRatio:s};this.resize(a),this.context&&(this.viewSelect&&(t.Platform.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,n,s){this.context.roundRect(t,e,i,n,"number"==typeof s?[s]:s)}),t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(e){this.viewSelect&&t.Platform.miniapp.getBounds(this.viewSelect).then((t=>{this.clientBounds=t,e&&e()}))}startAutoLayout(e,i){this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.Platform.miniapp.onWindowResize(this.checkSize))}checkSize(){this.viewSelect&&setTimeout((()=>{this.updateClientBounds((()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,n={width:t,height:e,pixelRatio:i};this.isSameSize(n)||this.emitResize(n)}))}),500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.Platform.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),void 0!==this.width&&this.resizeListener(new t.ResizeEvent(e,i))}}const{mineType:s,fileType:a}=t.FileHelper;function o(e,i){t.Platform.origin={createCanvas:(t,e,n)=>{const s={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(s):i.createOffScreenCanvas(s)},canvasToDataURL:(t,e,i)=>t.toDataURL(s(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,n)=>{let o=e.toDataURL(s(a(i)),n);return o=o.substring(o.indexOf("64,")+3),t.Platform.origin.download(o,i)},download:(e,n)=>new Promise(((s,a)=>{let o;n.includes("/")||(n=`${i.env.USER_DATA_PATH}/`+n,o=!0);const r=i.getFileSystemManager();r.writeFile({filePath:n,data:e,encoding:"base64",success(){o?t.Platform.miniapp.saveToAlbum(n).then((()=>{r.unlink({filePath:n}),s()})):s()},fail(t){a(t)}})})),loadImage:e=>new Promise(((i,n)=>{const s=t.Platform.canvas.view.createImage();s.onload=()=>{i(s)},s.onerror=t=>{n(t)},s.src=t.Platform.image.getRealURL(e)})),noRepeat:"repeat-x"},t.Platform.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise((e=>{t.boundingClientRect().exec((t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})}))})),getSizeView:t=>new Promise((e=>{t.fields({node:!0,size:!0}).exec((t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})}))})),saveToAlbum:t=>new Promise((e=>{i.getSetting({success:n=>{n.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})})),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new n(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="miniapp",t.Platform.requestRender=function(e){const{view:i}=t.Platform.renderCanvas||t.Platform.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>Math.max(1,wx.getSystemInfoSync().pixelRatio)});class r{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,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,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,i=e.length;t<i;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=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.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:h,updateBounds:l,updateChange:c}=t.LeafHelper,{pushAllChildBranch:d,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class p{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,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:_}=t.LeafHelper,m=t.Debug.get("Layouter");class w{constructor(e,i){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.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.layouting||!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){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(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 i=t.Run.start("PartLayout"),{target:n,__updatedList:s}=this,{BEFORE:a,LAYOUT:o,AFTER:r}=t.LayoutEvent,f=this.getBlocks(s);f.forEach((t=>t.setBefore())),n.emitEvent(new t.LayoutEvent(a,f,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?(h(t,!0),e.add(t),t.isBranch&&d(t,e),u(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(s,this.__levelList),function(t){let e,i,n;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){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||l(n[t])}l(i)}}))}(this.__levelList),function(t){t.list.forEach(c)}(s),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),n.emitEvent(new t.LayoutEvent(o,f,this.times)),n.emitEvent(new t.LayoutEvent(r,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:a}=t.LayoutEvent,o=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,o,this.times)),w.fullLayout(i),o.forEach((t=>{t.setAfter()})),i.emitEvent(new t.LayoutEvent(s,o,this.times)),i.emitEvent(new t.LayoutEvent(a,o,this.times)),this.addBlocks(o),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new p([]));e.length?i.add(t.__world):i.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_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[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 v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=i,n&&(this.config=t.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.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,y.log(i.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){if(this.rendering)return y.warn("rendering");if(this.times>3)return y.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);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,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(e){const i=t.Run.start("PartRender"),{canvas:n}=this,s=e.getIntersect(n.bounds),a=new t.Bounds(s);n.save(),s.spread(v.clipSpread).ceil(),n.clearWorld(s,!0),n.clipWorld(s,!0),this.__render(s,a),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n}=this,s=e.includes(this.target.__world),a=s?{includes:s}:{bounds:e,includes:s};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.target.__render(n,a),this.renderBounds=i=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__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,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,n){i||(i=0),n||(n={});const s=n.through||!1,a=n.ignoreHittable||!1,o=n.target||this.target;this.exclude=n.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(n.findList),n.findList||this.hitBranch(o);const{list:r}=this.findList,h=this.getBestMatchLeaf(r,n.bottomList,a),l=a?this.getPath(h):this.getHitablePath(h);return this.clear(),s?{path:l,target:h,throughPath:r.length?this.getThroughPath(r):l}:{path:l,target:h}}getBestMatchLeaf(e,i,n){if(e.length){let i;this.findList=new t.LeafList;const{x:s,y:a}=this.point,o={x:s,y:a,radiusX:0,radiusY:0};for(let s=0,a=e.length;s<a;s++)if(i=e[s],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,o),this.findList.length))return this.findList.list[0]}if(i)for(let t=0,e=i.length;t<e;t++)if(this.hitChild(i[t].target,this.point,i[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const i=new t.LeafList;for(;e;)i.add(e),e=e.parent;return this.target&&i.add(this.target),i}getHitablePath(e){const i=this.getPath(e&&e.hittable?e:null);let n,s=new t.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(s.addAt(n,0),n.__.hitChildren);t--);return s}getThroughPath(e){const i=new t.LeafList,n=[];for(let t=e.length-1;t>-1;t--)n.push(this.getPath(e[t]));let s,a,o;for(let t=0,e=n.length;t<e;t++){s=n[t],a=n[t+1];for(let t=0,e=s.length;t<e&&(o=s.list[t],!a||!a.has(o));t++)i.add(o)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:s}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||x(i.__world,s),i.isBranch?(n||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,s)):n&&this.hitChild(i,s))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask&&!n.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class E{constructor(e,i){this.config={},i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,i,n){const{target:s,picker:a}=this;return t.Platform.backgrounder&&s&&s.updateLayout(),a.getByPoint(e,i,n)}getBy(e,i,n,s){return this.finder?this.finder.getBy(e,i,n,s):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(t.Creator,{watcher:(t,e)=>new r(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,i)=>new v(t,e,i),selector:(t,e)=>new E(t,e)}),t.Platform.layout=w.fullLayout;const L={convertTouch(t,i){const n=L.getTouch(t),s=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},s),{x:i.x,y:i.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:n.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class B extends e.InteractionBase{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return void 0!==t.x?{x:t.x,y:t.y}:super.getLocal(t,e)}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=L.getTouch(t);this.pointerDown(L.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=L.getTouch(t);this.pointerMove(L.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=L.getTouch(t);this.pointerUp(L.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const i=this.getTouches(t.touches),n=this.getKeepTouchList(this.touches,i);n.length>1&&(this.multiTouch(e.InteractionHelper.getBase(t),n),this.touches=i)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const n=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&n.push({from:this.getLocal(t),to:this.getLocal(i)})})),n}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}function R(t,e){const i=t.__,{rows:n,decorationY:s}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=n.length;t<i;t++)a=n[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach((t=>{e.fillText(t.char,t.x,a.y)}));if(s){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach((t=>s.forEach((i=>e.fillRect(t.x,t.y+i,t.width,a)))))}}function S(t,e){t.__.__font?R(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,e,i){switch(e.__.strokeAlign){case"center":P(t,1,e,i);break;case"inside":T(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?P(t,2,e,i):T(t,"outside",e,i)}}function P(t,e,i,n){const s=i.__;n.setStroke(!s.__isStrokes&&t,s.strokeWidth*e,s),s.__isStrokes?M(t,!0,i,n):A(i,n)}function T(t,e,i,n){const s=n.getSameCanvas(!0,!0);s.font=i.__.__font,P(t,2,i,s),s.blendMode="outside"===e?"destination-out":"destination-in",R(i,s),s.blendMode="normal",C(n,s,i),s.recycle(i.__nowWorld)}function C(e,i,n){n.__worldFlipped||t.Platform.fullImageShadow?e.copyWorldByReset(i,n.__nowWorld):e.copyWorldToInner(i,n.__nowWorld,n.__layout.renderBounds)}function A(t,e){let i,n=t.__.__textDrawData;const{rows:s,decorationY:a}=n;for(let t=0,n=s.length;t<n;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)}));if(a){const{decorationHeight:t}=n;s.forEach((i=>a.forEach((n=>e.strokeRect(i.x,i.y+n,i.width,t)))))}}function M(t,e,n,s){let a;for(let o=0,r=t.length;o<r;o++)a=t[o],a.image&&i.PaintImage.checkImage(n,s,a,!1)||a.style&&(s.strokeStyle=a.style,a.blendMode?(s.saveBlendMode(a.blendMode),e?A(n,s):s.stroke(),s.restoreBlendMode()):e?A(n,s):s.stroke())}function O(t,e,i){const n=e.__;if(n.__strokeWidth)if(n.__font)k(t,e,i);else switch(n.strokeAlign){case"center":W(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),W(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const n=e.__;if(n.__fillAfterStroke)W(t,2,e,i);else{const{renderBounds:s}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),W(t,2,e,a),a.clipUI(n),a.clearWorld(s),C(i,a,e),a.recycle(e.__nowWorld)}}(t,e,i)}}function W(t,e,n,s){const a=n.__;s.setStroke(!a.__isStrokes&&t,a.__strokeWidth*e,a),a.__isStrokes?M(t,!1,n,s):s.stroke(),a.__useArrow&&i.Paint.strokeArrow(t,n,s)}const{getSpread:I,getOuterOf:D,getByMove:H,getIntersectData:z}=t.BoundsHelper;let F;const{stintSet:j}=t.DataHelper,{hasTransparent:U}=i.ColorConvert;function G(t,e,n){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:a}=n.__layout;switch(e.type){case"image":s=i.PaintImage.image(n,t,e,a,!F||!F[e.url]);break;case"linear":s=i.PaintGradient.linearGradient(e,a);break;case"radial":s=i.PaintGradient.radialGradient(e,a);break;case"angular":s=i.PaintGradient.conicGradient(e,a);break;case"solid":const{type:o,color:r,opacity:h}=e;s={type:o,style:i.ColorConvert.string(r,h)};break;default:void 0!==e.r&&(s={type:"solid",style:i.ColorConvert.string(e)})}return s&&("string"==typeof s.style&&U(s.style)&&(s.isTransparent=!0),e.blendMode&&(s.blendMode=e.blendMode)),s}const Y={compute:function(t,e){const n=e.__,s=[];let a,o,r=n.__input[t];r instanceof Array||(r=[r]),F=i.PaintImage.recycleImage(t,n);for(let i,n=0,a=r.length;n<a;n++)(i=G(t,r[n],e))&&s.push(i);n["_"+t]=s.length?s:void 0,s.length&&s.every((t=>t.isTransparent))&&(s.some((t=>t.image))&&(a=!0),o=!0),"fill"===t?(j(n,"__isAlphaPixelFill",a),j(n,"__isTransparentFill",o)):(j(n,"__isAlphaPixelStroke",a),j(n,"__isTransparentStroke",o))},fill:function(t,e,i){i.fillStyle=t,S(e,i)},fills:function(t,e,n){let s;for(let a=0,o=t.length;a<o;a++){if(s=t[a],s.image){if(i.PaintImage.checkImage(e,n,s,!e.__.__font))continue;if(!s.style){!a&&s.image.isPlacehold&&e.drawImagePlaceholder(n,s.image);continue}}n.fillStyle=s.style,s.transform?(n.save(),n.transform(s.transform),s.blendMode&&(n.blendMode=s.blendMode),S(e,n),n.restore()):s.blendMode?(n.saveBlendMode(s.blendMode),S(e,n),n.restoreBlendMode()):S(e,n)}},fillPathOrText:S,fillText:R,stroke:O,strokes:function(t,e,i){O(t,e,i)},strokeText:k,drawTextStroke:A,shape:function(t,e,i){const n=e.getSameCanvas(),s=t.__nowWorld;let a,o,r,h,{scaleX:l,scaleY:c}=s;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(s))h=n,a=r=s;else{const{renderShapeSpread:n}=t.__layout,d=z(n?I(e.bounds,l===c?n*l:[n*c,n*l]):e.bounds,s);o=e.bounds.getFitMatrix(d);let{a:u,d:f}=o;if(o.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,c*=f),r=D(s,o),a=H(r,-o.e,-o.f),i.matrix){const{matrix:t}=i;o.multiply(t),u*=t.scaleX,f*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:o.withScale(u,f)})}return t.__renderShape(n,i),{canvas:n,matrix:o,bounds:a,worldCanvas:h,shapeBounds:r,scaleX:l,scaleY:c}}};let q={};const{get:N,rotateOfOuter:X,translate:V,scaleOfOuter:Q,scale:K,rotate:Z,skew:$}=t.MatrixHelper;function J(t,e,i,n,s,a,o){const r=N();V(r,e.x+i,e.y+n),K(r,s,a),o&&X(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function tt(t,e,i,n,s,a,o,r){const h=N();o&&Z(h,o),r&&$(h,r.x,r.y),s&&K(h,s,a),V(h,e.x+i,e.y+n),t.transform=h}function et(t,e,i,n,s,a,o,r,h,l){const c=N();if(h)if("center"===l)X(c,{x:i/2,y:n/2},h);else switch(Z(c,h),h){case 90:V(c,n,0);break;case 180:V(c,i,n);break;case 270:V(c,0,i)}q.x=e.x+s,q.y=e.y+a,V(c,q.x,q.y),o&&Q(c,q,o,r),t.transform=c}const{get:it,translate:nt}=t.MatrixHelper,st=new t.Bounds,at={},ot={};function rt(t,e,i,n){const{changeful:s,sync:a,editing:o}=i;s&&(t.changeful=s),a&&(t.sync=a),o&&(t.editing=o),t.data=ht(i,n,e)}function ht(e,i,n){e.padding&&(i=st.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:s,height:a}=n;const{opacity:o,mode:r,align:h,offset:l,scale:c,size:d,rotation:u,skew:f,repeat:p,filters:g}=e,_=i.width===s&&i.height===a,m={mode:r},w="center"!==h&&(u||0)%180==90;let y,v;switch(t.BoundsHelper.set(ot,0,0,w?a:s,w?s:a),r&&"cover"!==r&&"fit"!==r?((c||d)&&(t.MathHelper.getScaleData(c,d,n,at),y=at.scaleX,v=at.scaleY),h&&(y&&t.BoundsHelper.scale(ot,y,v,!0),t.AlignHelper.toPoint(h,ot,i,ot,!0,!0))):_&&!u||(y=v=t.BoundsHelper.getFitScale(i,ot,"fit"!==r),t.BoundsHelper.put(i,n,h,y,!1,ot),t.BoundsHelper.scale(ot,y,v,!0)),l&&t.PointHelper.move(ot,l),r){case"stretch":_||(s=i.width,a=i.height);break;case"normal":case"clip":(ot.x||ot.y||y||u||f)&&tt(m,i,ot.x,ot.y,y,v,u,f);break;case"repeat":(!_||y||u)&&et(m,i,s,a,ot.x,ot.y,y,v,u,h),p||(m.repeat="repeat");break;default:y&&J(m,i,ot.x,ot.y,y,v,u)}return m.transform||(i.x||i.y)&&(m.transform=it(),nt(m.transform,i.x,i.y)),y&&"stretch"!==r&&(m.scaleX=y,m.scaleY=v),m.width=s,m.height=a,o&&(m.opacity=o),g&&(m.filters=g),p&&(m.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),m}let lt,ct=new t.Bounds;const{isSame:dt}=t.BoundsHelper;function ut(t,e,i,n,s,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||rt(s,n,i,a),!0}function ft(e,i){_t(e,t.ImageEvent.LOAD,i)}function pt(e,i){_t(e,t.ImageEvent.LOADED,i)}function gt(e,i,n){i.error=n,e.forceUpdate("surface"),_t(e,t.ImageEvent.ERROR,i)}function _t(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function mt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wt,scale:yt,copy:vt}=t.MatrixHelper,{ceil:xt,abs:bt}=Math;function Et(e,i,n){let{scaleX:s,scaleY:a}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const o=s+"-"+a+"-"+n;if(i.patternId===o||e.destroyed)return!1;{s=bt(s),a=bt(a);const{image:e,data:r}=i;let h,l,{width:c,height:d,scaleX:u,scaleY:f,transform:p,repeat:g}=r;u&&(u=bt(u),f=bt(f),l=wt(),vt(l,p),yt(l,1/u,1/f),s*=u,a*=f),s*=n,a*=n,c*=s,d*=a;const _=c*d;if(!g&&_>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)}_>m&&(h=Math.sqrt(_/m)),h&&(s/=h,a/=h,c/=h,d/=h),u&&(s/=u,a/=f),(p||1!==s||1!==a)&&(l||(l=wt(),p&&vt(l,p)),yt(l,1/s,1/a));const w=e.getCanvas(xt(c)||1,xt(d)||1,r.opacity,r.filters),y=e.getPattern(w,g||t.Platform.origin.noRepeat||"no-repeat",l,i);return i.style=y,i.patternId=o,!0}}function Lt(t,e,i,n){return new(i||(i=Promise))((function(s,a){function o(t){try{h(n.next(t))}catch(t){a(t)}}function r(t){try{h(n.throw(t))}catch(t){a(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,r)}h((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:Bt}=Math;const Rt={image:function(e,i,n,s,a){let o,r;const h=t.ImageManager.get(n);return lt&&n===lt.paint&&dt(s,lt.boxBounds)?o=lt.leafPaint:(o={type:n.type,image:h},h.hasAlphaPixel&&(o.isTransparent=!0),lt=h.use>1?{leafPaint:o,paint:n,boxBounds:ct.set(s)}:null),(a||h.loading)&&(r={image:h,attrName:i,attrValue:n}),h.ready?(ut(e,i,n,h,o,s),a&&(ft(e,r),pt(e,r))):h.error?a&>(e,r,h.error):(a&&(mt(e,!0),ft(e,r)),o.loadId=h.load((()=>{mt(e,!1),e.destroyed||(ut(e,i,n,h,o,s)&&(h.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),pt(e,r)),o.loadId=void 0}),(t=>{mt(e,!1),gt(e,r,t),o.loadId=void 0})),e.placeholderColor&&(e.placeholderDelay?setTimeout((()=>{h.ready||(h.isPlacehold=!0,e.forceUpdate("surface"))}),e.placeholderDelay):h.isPlacehold=!0)),o},checkImage:function(e,n,s,a){const{scaleX:o,scaleY:r}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:h}=n,{data:l}=s;if(!l||s.patternId===o+"-"+r+"-"+h&&!i.Export.running)return!1;if(a)if(l.repeat)a=!1;else if(!(s.changeful||t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=l;e*=Bt(o)*h,i*=Bt(r)*h,l.scaleX&&(e*=l.scaleX,i*=l.scaleY),a=e*i>t.Platform.image.maxCacheSize}return a?(function(t,e,i,n){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(e,n,s,l),!0):(!s.style||s.sync||i.Export.running?Et(e,s,h):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>Lt(this,void 0,void 0,(function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&Et(e,s,h),e.forceUpdate("surface")}))),300)),!1)},createPattern:Et,recycleImage:function(e,i){const n=i["_"+e];if(n instanceof Array){let s,a,o,r,h;for(let l=0,c=n.length;l<c;l++)s=n[l],a=s.image,h=a&&a.url,h&&(o||(o={}),o[h]=!0,t.ImageManager.recycle(a),a.loading&&(r||(r=i.__input&&i.__input[e]||[],r instanceof Array||(r=[r])),a.unload(n[l].loadId,!r.some((t=>t.url===h)))));return o}return null},createData:rt,getPatternData:ht,fillOrFitMode:J,clipMode:tt,repeatMode:et},{toPoint:St}=t.AroundHelper,{hasTransparent:kt}=i.ColorConvert,Pt={},Tt={};function Ct(t,e,n,s){if(n){let a,o,r,h;for(let t=0,l=n.length;t<l;t++)a=n[t],"string"==typeof a?(r=t/(l-1),o=i.ColorConvert.string(a,s)):(r=a.offset,o=i.ColorConvert.string(a.color,s)),e.addColorStop(r,o),!h&&kt(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:At,getDistance:Mt}=t.PointHelper,{get:Ot,rotateOfOuter:Wt,scaleOfOuter:It}=t.MatrixHelper,{toPoint:Dt}=t.AroundHelper,Ht={},zt={};function Ft(t,e,i,n,s){let a;const{width:o,height:r}=t;if(o!==r||n){const t=At(e,i);a=Ot(),s?(It(a,e,o/r*(n||1),1),Wt(a,e,t+90)):(It(a,e,1,o/r*(n||1)),Wt(a,e,t))}return a}const{getDistance:jt}=t.PointHelper,{toPoint:Ut}=t.AroundHelper,Gt={},Yt={};const qt={linearGradient:function(e,i){let{from:n,to:s,type:a,opacity:o}=e;St(n||"top",i,Pt),St(s||"bottom",i,Tt);const r=t.Platform.canvas.createLinearGradient(Pt.x,Pt.y,Tt.x,Tt.y),h={type:a,style:r};return Ct(h,r,e.stops,o),h},radialGradient:function(e,i){let{from:n,to:s,type:a,opacity:o,stretch:r}=e;Dt(n||"center",i,Ht),Dt(s||"bottom",i,zt);const h=t.Platform.canvas.createRadialGradient(Ht.x,Ht.y,0,Ht.x,Ht.y,Mt(Ht,zt)),l={type:a,style:h};Ct(l,h,e.stops,o);const c=Ft(i,Ht,zt,r,!0);return c&&(l.transform=c),l},conicGradient:function(e,i){let{from:n,to:s,type:a,opacity:o,stretch:r}=e;Ut(n||"center",i,Gt),Ut(s||"bottom",i,Yt);const h=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Gt.x,Gt.y):t.Platform.canvas.createRadialGradient(Gt.x,Gt.y,0,Gt.x,Gt.y,jt(Gt,Yt)),l={type:a,style:h};Ct(l,h,e.stops,o);const c=Ft(i,Gt,Yt,r||1,t.Platform.conicGradientRotate90);return c&&(l.transform=c),l},getTransform:Ft},{copy:Nt,toOffsetOutBounds:Xt}=t.BoundsHelper,Vt={},Qt={};function Kt(e,i,n,s){const{bounds:a,shapeBounds:o}=s;if(t.Platform.fullImageShadow){if(Nt(Vt,e.bounds),Vt.x+=i.x-o.x,Vt.y+=i.y-o.y,n){const{matrix:t}=s;Vt.x-=(a.x+(t?t.e:0)+a.width/2)*(n-1),Vt.y-=(a.y+(t?t.f:0)+a.height/2)*(n-1),Vt.width*=n,Vt.height*=n}e.copyWorld(s.canvas,e.bounds,Vt)}else n&&(Nt(Vt,i),Vt.x-=i.width/2*(n-1),Vt.y-=i.height/2*(n-1),Vt.width*=n,Vt.height*=n),e.copyWorld(s.canvas,o,n?Vt:i)}const{toOffsetOutBounds:Zt}=t.BoundsHelper,$t={};const Jt={shadow:function(t,e,n){let s,a;const{__nowWorld:o,__layout:r}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:c,shapeBounds:d,scaleX:u,scaleY:f}=n,p=e.getSameCanvas(),g=h.length-1;Xt(c,Qt),h.forEach(((h,_)=>{p.setWorldShadow(Qt.offsetX+h.x*u,Qt.offsetY+h.y*f,h.blur*u,i.ColorConvert.string(h.color)),a=h.spread?1+2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Kt(p,Qt,a,n),s=c,h.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,c,o,"copy"),s=o),l?p.copyWorld(l,o,o,"destination-out"):p.copyWorld(n.canvas,d,c,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,s,o,h.blendMode):e.copyWorldToInner(p,s,r.renderBounds,h.blendMode),g&&_<g&&p.clearWorld(s,!0)})),p.recycle(s)},innerShadow:function(t,e,n){let s,a;const{__nowWorld:o,__layout:r}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:c,shapeBounds:d,scaleX:u,scaleY:f}=n,p=e.getSameCanvas(),g=h.length-1;Zt(c,$t),h.forEach(((h,_)=>{p.save(),p.setWorldShadow($t.offsetX+h.x*u,$t.offsetY+h.y*f,h.blur*u),a=h.spread?1-2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Kt(p,$t,a,n),p.restore(),l?(p.copyWorld(p,c,o,"copy"),p.copyWorld(l,o,o,"source-out"),s=o):(p.copyWorld(n.canvas,d,c,"source-out"),s=c),p.fillWorld(s,i.ColorConvert.string(h.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,s,o,h.blendMode):e.copyWorldToInner(p,s,r.renderBounds,h.blendMode),g&&_<g&&p.clearWorld(s,!0)})),p.recycle(s)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:te}=t.LeafBoundsHelper;function ee(t,e,i,n,s,a){switch(e){case"grayscale":s.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,n){const s=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,s),n.recycle(s),ne(t,e,i,1)}(t,i,n,s);break;case"opacity-path":ne(t,i,n,a);break;case"path":i.restore()}}function ie(t){return t.getSameCanvas(!1,!0)}function ne(t,e,i,n){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,s),i.recycle(s)}i.Group.prototype.__renderMask=function(t,e){let i,n,s,a,o,r;const{children:h}=this;for(let l=0,c=h.length;l<c;l++)i=h[l],r=i.__.mask,r&&(o&&(ee(this,o,t,s,n,a),n=s=null),"path"===r||"clipping-path"===r?(i.opacity<1?(o="opacity-path",a=i.opacity,s||(s=ie(t))):(o="path",t.save()),i.__clip(s||t,e)):(o="grayscale"===r?"grayscale":"alpha",n||(n=ie(t)),s||(s=ie(t)),i.__render(n,e)),"clipping"!==r&&"clipping-path"!==r)||te(i,e)||i.__render(s||t,e);ee(this,o,t,s,n,a)};const se=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ae=se+"_#~&*+\\=|≮≯≈≠=…",oe=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 re(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const he=re("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),le=re("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ce=re(se),de=re(ae),ue=re("- —/~|┆·");var fe;!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"}(fe||(fe={}));const{Letter:pe,Single:ge,Before:_e,After:me,Symbol:we,Break:ye}=fe;function ve(t){return he[t]?pe:ue[t]?ye:le[t]?_e:ce[t]?me:de[t]?we:oe.test(t)?ge:pe}const xe={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let a=s-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function be(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:Ee}=xe,{Letter:Le,Single:Be,Before:Re,After:Se,Symbol:ke,Break:Pe}=fe;let Te,Ce,Ae,Me,Oe,We,Ie,De,He,ze,Fe,je,Ue,Ge,Ye,qe,Ne,Xe=[];function Ve(t,e){He&&!De&&(De=He),Te.data.push({char:t,width:e}),Ae+=e}function Qe(){Me+=Ae,Te.width=Ae,Ce.words.push(Te),Te={data:[]},Ae=0}function Ke(){Ge&&(Ye.paraNumber++,Ce.paraStart=!0,Ge=!1),He&&(Ce.startCharSize=De,Ce.endCharSize=He,De=0),Ce.width=Me,qe.width?Ee(Ce):Ne&&Ze(),Xe.push(Ce),Ce={words:[]},Me=0}function Ze(){Me>(Ye.maxWidth||0)&&(Ye.maxWidth=Me)}const{top:$e,right:Je,bottom:ti,left:ei}=t.Direction4;function ii(t,e,i){const{bounds:n,rows:s}=t;n[e]+=i;for(let t=0;t<s.length;t++)s[t][e]+=i}const ni={getDrawData:function(e,n){"string"!=typeof e&&(e=String(e));let s=0,a=0,o=n.__getInput("width")||0,r=n.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:c}=n;c&&(o?(s=c[ei],o-=c[Je]+c[ei]):n.autoSizeAlign||(s=c[ei]),r?(a=c[$e],r-=c[$e]+c[ti]):n.autoSizeAlign||(a=c[$e]));const d={bounds:{x:s,y:a,width:o,height:r},rows:[],paraNumber:0,font:t.Platform.canvas.font=l};return function(e,i,n){Ye=e,Xe=e.rows,qe=e.bounds,Ne=!qe.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:a,textCase:o}=n,{canvas:r}=t.Platform,{width:h,height:l}=qe;if(h||l||s||"none"!==o){const t="none"!==n.textWrap,e="break"===n.textWrap;Ge=!0,Fe=null,De=Ie=He=Ae=Me=0,Te={data:[]},Ce={words:[]},s&&(i=[...i]);for(let n=0,l=i.length;n<l;n++)We=i[n],"\n"===We?(Ae&&Qe(),Ce.paraEnd=!0,Ke(),Ge=!0):(ze=ve(We),ze===Le&&"none"!==o&&(We=be(We,o,!Ae)),Ie=r.measureText(We).width,s&&(s<0&&(He=Ie),Ie+=s),je=ze===Be&&(Fe===Be||Fe===Le)||Fe===Be&&ze!==Se,Ue=!(ze!==Re&&ze!==Be||Fe!==ke&&Fe!==Se),Oe=Ge&&a?h-a:h,t&&h&&Me+Ae+Ie>Oe&&(e?(Ae&&Qe(),Me&&Ke()):(Ue||(Ue=ze===Le&&Fe==Se),je||Ue||ze===Pe||ze===Re||ze===Be||Ae+Ie>Oe?(Ae&&Qe(),Me&&Ke()):Me&&Ke()))," "===We&&!0!==Ge&&Me+Ae===0||(ze===Pe?(" "===We&&Ae&&Qe(),Ve(We,Ie),Qe()):je||Ue?(Ae&&Qe(),Ve(We,Ie)):Ve(We,Ie)),Fe=ze);Ae&&Qe(),Me&&Ke(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ye.paraNumber++,Me=r.measureText(t).width,Xe.push({x:a||0,text:t,width:Me,paraStart:!0}),Ne&&Ze()}))}(d,e,n),c&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ii(e,"x",t[ei]);break;case"right":ii(e,"x",-t[Je])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ii(e,"y",t[$e]);break;case"bottom":ii(e,"y",-t[ti])}}(c,d,n,o,r),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:a,__baseLine:o,__letterSpacing:r,__clipText:h,textAlign:l,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=n,m=a*s+(d?d*(t.paraNumber-1):0),w=o;if(h&&m>_)m=Math.max(_,a),s>1&&(t.overflow=s);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}w+=p;let y,v,x,b=g||u?g:t.maxWidth;for(let o=0,c=s;o<c;o++){if(y=i[o],y.x=f,y.width<g||y.width>g&&!h)switch(l){case"center":y.x+=(b-y.width)/2;break;case"right":y.x+=b-y.width}y.paraStart&&d&&o>0&&(w+=d),y.y=w,w+=a,t.overflow>o&&w>m&&(y.isOverflow=!0,t.overflow=o+1),v=y.x,x=y.width,r<0&&(y.width<0?(x=-y.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<n.x&&(n.x=v),x>n.width&&(n.width=x),h&&g&&g<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=p,n.height=m}(d,n),function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:a,letterSpacing:o}=e;let r,h,l,c,d,u;n.forEach((t=>{t.words&&(l=a&&t.paraStart?a:0,u=t.words.length,h=i&&("justify"===s||"both"===s)&&u>1?(i-t.width-l)/(u-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,r=t.x,t.data=[],t.words.forEach(((e,i)=>{1===c?(d={char:"",x:r},r=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,r,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):r=function(t,e,i,n){return t.forEach((t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,r,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==s||i===u-1||(r+=h,t.width+=h)}))),t.words=null)}))}(d,n,o),d.overflow&&function(e,i,n,s){if(!s)return;const{rows:a,overflow:o}=e;let{textOverflow:r}=i;if(a.splice(o),r&&"show"!==r){let e,h;"hide"===r?r="":"ellipsis"===r&&(r="...");const l=r?t.Platform.canvas.measureText(r).width:0,c=n+s-l;("none"===i.textWrap?a:[a[o-1]]).forEach((t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],h=e.x+e.width,!(n===i&&h<c));n--){if(h<c&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:r,x:h}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(d,n,s,o),"none"!==h&&function(t,e){let n;const{fontSize:s,textDecoration:a}=e;switch(t.decorationHeight=s/11,"object"==typeof a?(n=a.type,a.color&&(t.decorationColor=i.ColorConvert.string(a.color))):n=a,n){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,n),d}};const si={string:function(t,e){const n="number"==typeof e&&1!==e;if("string"==typeof t){if(!n||!i.ColorConvert.object)return t;t=i.ColorConvert.object(t)}let s=void 0===t.a?1:t.a;n&&(s*=e);const a=t.r+","+t.g+","+t.b;return 1===s?"rgb("+a+")":"rgba("+a+","+s+")"}};Object.assign(i.TextConvert,ni),Object.assign(i.ColorConvert,si),Object.assign(i.Paint,Y),Object.assign(i.PaintImage,Rt),Object.assign(i.PaintGradient,qt),Object.assign(i.Effect,Jt),Object.assign(t.Creator,{interaction:(t,e,i,n)=>new B(t,e,i,n),hitCanvas:(t,e)=>new n(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),i.Leafer.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&o(0,wx)}catch(t){}Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=B,exports.Layouter=w,exports.LeaferCanvas=n,exports.Picker=b,exports.Renderer=v,exports.Selector=E,exports.Watcher=r,exports.useCanvas=o,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(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
|
1
|
+
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),i=require("@leafer-ui/draw");class n extends t.LeaferCanvasBase{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?(t.isString(i)?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.Platform.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.Platform.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:n,pixelRatio:s}=this.config,a={width:i||e.width,height:n||e.height,pixelRatio:s};this.resize(a),this.context&&(this.viewSelect&&(t.Platform.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(e,i,n,s,a){this.context.roundRect(e,i,n,s,t.isNumber(a)?[a]:a)}),t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(e){this.viewSelect&&t.Platform.miniapp.getBounds(this.viewSelect).then(t=>{this.clientBounds=t,e&&e()})}startAutoLayout(e,i){this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.Platform.miniapp.onWindowResize(this.checkSize))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,n={width:t,height:e,pixelRatio:i};this.isSameSize(n)||this.emitResize(n)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.Platform.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),t.isUndefined(this.width)||this.resizeListener(new t.ResizeEvent(e,i))}}const{mineType:s,fileType:a}=t.FileHelper;function r(e,i){t.Platform.origin={createCanvas:(t,e,n)=>{const s={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(s):i.createOffScreenCanvas(s)},canvasToDataURL:(t,e,i)=>t.toDataURL(s(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,n)=>{let r=e.toDataURL(s(a(i)),n);return r=r.substring(r.indexOf("64,")+3),t.Platform.origin.download(r,i)},download:(e,n)=>new Promise((s,a)=>{let r;n.includes("/")||(n=`${i.env.USER_DATA_PATH}/`+n,r=!0);const o=i.getFileSystemManager();o.writeFile({filePath:n,data:e,encoding:"base64",success(){r?t.Platform.miniapp.saveToAlbum(n).then(()=>{o.unlink({filePath:n}),s()}):s()},fail(t){a(t)}})}),loadImage:e=>new Promise((i,n)=>{const s=t.Platform.canvas.view.createImage();s.onload=()=>{i(s)},s.onerror=t=>{n(t)},s.src=t.Platform.image.getRealURL(e)}),noRepeat:"repeat-x"},t.Platform.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(e=>{i.getSetting({success:n=>{n.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})}),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new n(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="miniapp",t.Platform.requestRender=function(e){const{view:i}=t.Platform.renderCanvas||t.Platform.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class o{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,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,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,i=e.length;t<i;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=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.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:h,updateChange:c}=t.LeafHelper,{pushAllChildBranch:d,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}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:p,updateAllChange:_}=t.LeafHelper,m=t.Debug.get("Layouter");class y{constructor(e,i){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.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.layouting||!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){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(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 i=t.Run.start("PartLayout"),{target:n,__updatedList:s}=this,{BEFORE:a,LAYOUT:r,AFTER:o}=t.LayoutEvent,f=this.getBlocks(s);f.forEach(t=>t.setBefore()),n.emitEvent(new t.LayoutEvent(a,f,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?(l(t,!0),e.add(t),t.isBranch&&d(t,e),u(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(s,this.__levelList),function(t){let e,i,n;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){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||h(n[t])}h(i)}})}(this.__levelList),function(t){t.list.forEach(c)}(s),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),n.emitEvent(new t.LayoutEvent(r,f,this.times)),n.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:a}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,r,this.times)),y.fullLayout(i),r.forEach(t=>{t.setAfter()}),i.emitEvent(new t.LayoutEvent(s,r,this.times)),i.emitEvent(new t.LayoutEvent(a,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){p(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new g(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_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[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 w=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=i,n&&(this.config=t.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.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(i.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,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){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 t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);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,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(e){const i=t.Run.start("PartRender"),{canvas:n}=this,s=e.getIntersect(n.bounds),a=new t.Bounds(s);n.save(),s.spread(v.clipSpread).ceil(),n.clearWorld(s,!0),n.clipWorld(s,!0),this.__render(s,a),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n}=this,s=e.includes(this.target.__world),a=s?{includes:s}:{bounds:e,includes:s};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.target.__render(n,a),this.renderBounds=i=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now();t.Platform.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()})}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__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||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,n){i||(i=0),n||(n={});const s=n.through||!1,a=n.ignoreHittable||!1,r=n.target||this.target;this.exclude=n.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(n.findList),n.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,n.bottomList,a),h=a?this.getPath(l):this.getHitablePath(l);return this.clear(),s?{path:h,target:l,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(e,i,n){const s=this.findList=new t.LeafList;if(e.length){let i;const{x:a,y:r}=this.point,o={x:a,y:r,radiusX:0,radiusY:0};for(let a=0,r=e.length;a<r;a++)if(i=e[a],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,o),s.length)){if(i.isBranchLeaf&&e.some(e=>e!==i&&t.LeafHelper.hasParent(e,i))){s.reset();break}return s.list[0]}}if(i)for(let t=0,e=i.length;t<e;t++)if(this.hitChild(i[t].target,this.point,i[t].proxy),s.length)return s.list[0];return n?e[0]:e.find(e=>t.LeafHelper.worldHittable(e))}getPath(e){const i=new t.LeafList;for(;e;)i.add(e),e=e.parent;return this.target&&i.add(this.target),i}getHitablePath(e){const i=this.getPath(e&&e.hittable?e:null);let n,s=new t.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(s.addAt(n,0),n.__.hitChildren);t--);return s}getThroughPath(e){const i=new t.LeafList,n=[];for(let t=e.length-1;t>-1;t--)n.push(this.getPath(e[t]));let s,a,r;for(let t=0,e=n.length;t<e;t++){s=n[t],a=n[t+1];for(let t=0,e=s.length;t<e&&(r=s.list[t],!a||!a.has(r));t++)i.add(r)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:s}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||x(i.__world,s),i.isBranch?(n||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,s)):n&&this.hitChild(i,s))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask){let i,s=[];const{children:a}=n;for(let n=0,r=a.length;n<r;n++)if(i=a[n],i.__.mask&&s.push(i),i===t){if(s&&!s.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class L{constructor(e,i){this.config={},i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,i,n){const{target:s,picker:a}=this;return t.Platform.backgrounder&&s&&s.updateLayout(),a.getByPoint(e,i,n)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(e,i,n,s){return this.finder?this.finder.getBy(e,i,n,s):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,i)=>new v(t,e,i),selector:(t,e)=>new L(t,e)}),t.Platform.layout=y.fullLayout;const E={convertTouch(t,i){const n=E.getTouch(t),s=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},s),{x:i.x,y:i.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:n.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class B extends e.InteractionBase{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,i){return e.isUndefined(t.x)?super.getLocal(t,i):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=E.getTouch(t);this.pointerDown(E.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=E.getTouch(t);this.pointerMove(E.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=E.getTouch(t);this.pointerUp(E.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const i=this.getTouches(t.touches),n=this.getKeepTouchList(this.touches,i);n.length>1&&(this.multiTouch(e.InteractionHelper.getBase(t),n),this.touches=i)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const n=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&n.push({from:this.getLocal(t),to:this.getLocal(i)})}),n}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function S(t,e){const i=t.__,{rows:n,decorationY:s}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=n.length;t<i;t++)a=n[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(s){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>s.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function k(t,e){t.__.__font?S(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function R(t,e,i){switch(e.__.strokeAlign){case"center":P(t,1,e,i);break;case"inside":C(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?P(t,2,e,i):C(t,"outside",e,i)}}function P(e,i,n,s){const a=n.__;t.isObject(e)?A(e,i,!0,n,s):(s.setStroke(e,a.__strokeWidth*i,a),T(n,s))}function C(e,i,n,s){const a=s.getSameCanvas(!0,!0);a.font=n.__.__font,P(e,2,n,a),a.blendMode="outside"===i?"destination-out":"destination-in",S(n,a),a.blendMode="normal",t.LeafHelper.copyCanvasByWorld(n,s,a),a.recycle(n.__nowWorld)}function T(t,e){let i,n=t.__.__textDrawData;const{rows:s,decorationY:a}=n;for(let t=0,n=s.length;t<n;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)});if(a){const{decorationHeight:t}=n;s.forEach(i=>a.forEach(n=>e.strokeRect(i.x,i.y+n,i.width,t)))}}function A(t,e,n,s,a){let r;const o=s.__,{__hasMultiStrokeStyle:l}=o;l||a.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,c=t.length;h<c;h++)if(r=t[h],(!r.image||!i.PaintImage.checkImage(s,a,r,!1))&&r.style){if(l){const{strokeStyle:t}=r;t?a.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):a.setStroke(r.style,o.__strokeWidth*e,o)}else a.strokeStyle=r.style;r.blendMode?(a.saveBlendMode(r.blendMode),n?T(s,a):a.stroke(),a.restoreBlendMode()):n?T(s,a):a.stroke()}}function M(e,i,n){const s=i.__;if(s.__strokeWidth)if(s.__font)R(e,i,n);else switch(s.strokeAlign){case"center":O(e,1,i,n);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),O(t,2,e,i),i.restore()}(e,i,n);break;case"outside":!function(e,i,n){const s=i.__;if(s.__fillAfterStroke)O(e,2,i,n);else{const{renderBounds:a}=i.__layout,r=n.getSameCanvas(!0,!0);i.__drawRenderPath(r),O(e,2,i,r),r.clipUI(s),r.clearWorld(a),t.LeafHelper.copyCanvasByWorld(i,n,r),r.recycle(i.__nowWorld)}}(e,i,n)}}function O(e,n,s,a){const r=s.__;t.isObject(e)?A(e,n,!1,s,a):(a.setStroke(e,r.__strokeWidth*n,r),a.stroke()),r.__useArrow&&i.Paint.strokeArrow(e,s,a)}const{getSpread:W,getOuterOf:H,getByMove:I,getIntersectData:D}=t.BoundsHelper;let z;const{stintSet:F}=t.DataHelper,{hasTransparent:j}=i.ColorConvert;function U(e,n,s){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let a;const{boxBounds:r}=s.__layout;switch(n.type){case"image":a=i.PaintImage.image(s,e,n,r,!z||!z[n.url]);break;case"linear":a=i.PaintGradient.linearGradient(n,r);break;case"radial":a=i.PaintGradient.radialGradient(n,r);break;case"angular":a=i.PaintGradient.conicGradient(n,r);break;case"solid":const{type:o,color:l,opacity:h}=n;a={type:o,style:i.ColorConvert.string(l,h)};break;default:t.isUndefined(n.r)||(a={type:"solid",style:i.ColorConvert.string(n)})}if(a){if(t.isString(a.style)&&j(a.style)&&(a.isTransparent=!0),n.style){if(0===n.style.strokeWidth)return;a.strokeStyle=n.style}n.editing&&(a.editing=n.editing),n.blendMode&&(a.blendMode=n.blendMode)}return a}const G={compute:function(e,n){const s=n.__,a=[];let r,o,l,h=s.__input[e];t.isArray(h)||(h=[h]),z=i.PaintImage.recycleImage(e,s);for(let t,i=0,s=h.length;i<s;i++)(t=U(e,h[i],n))&&(a.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));s["_"+e]=a.length?a:void 0,a.length&&a.every(t=>t.isTransparent)&&(a.some(t=>t.image)&&(r=!0),o=!0),"fill"===e?(F(s,"__isAlphaPixelFill",r),F(s,"__isTransparentFill",o)):(F(s,"__isAlphaPixelStroke",r),F(s,"__isTransparentStroke",o),F(s,"__hasMultiStrokeStyle",l))},fill:function(t,e,i){i.fillStyle=t,k(e,i)},fills:function(t,e,n){let s;for(let a=0,r=t.length;a<r;a++){if(s=t[a],s.image){if(i.PaintImage.checkImage(e,n,s,!e.__.__font))continue;if(!s.style){!a&&s.image.isPlacehold&&e.drawImagePlaceholder(n,s.image);continue}}if(n.fillStyle=s.style,s.transform||s.scaleFixed){if(n.save(),s.transform&&n.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&i>1)&&n.scale(1/t,1/i)}s.blendMode&&(n.blendMode=s.blendMode),k(e,n),n.restore()}else s.blendMode?(n.saveBlendMode(s.blendMode),k(e,n),n.restoreBlendMode()):k(e,n)}},fillPathOrText:k,fillText:S,stroke:M,strokes:function(t,e,i){M(t,e,i)},strokeText:R,drawTextStroke:T,shape:function(e,i,n){const s=i.getSameCanvas(),a=e.__nowWorld;let r,o,l,h,c,{scaleX:d,scaleY:u}=a;if(d<0&&(d=-d),u<0&&(u=-u),i.bounds.includes(a))c=s,r=h=a;else{const{renderShapeSpread:s}=e.__layout,f=D(s?W(i.bounds,d===u?s*d:[s*u,s*d]):i.bounds,a);l=i.bounds.getFitMatrix(f);let{a:g,d:p}=l;l.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,n),d*=g,u*=p),h=H(a,l),r=I(h,-l.e,-l.f);const _=n.matrix;_?(o=new t.Matrix(l),o.multiply(_),g*=_.scaleX,p*=_.scaleY):o=l,o.withScale(g,p),n=Object.assign(Object.assign({},n),{matrix:o})}return e.__renderShape(s,n),{canvas:s,matrix:o,fitMatrix:l,bounds:r,worldCanvas:c,shapeBounds:h,scaleX:d,scaleY:u}}};let Y={},N=t.getMatrixData();const{get:X,rotateOfOuter:q,translate:V,scaleOfOuter:Q,multiplyParent:K,scale:Z,rotate:$,skew:J}=t.MatrixHelper;function tt(t,e,i,n,s,a,r){const o=X();V(o,e.x+i,e.y+n),Z(o,s,a),r&&q(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function et(t,e,i,n,s,a,r,o,l){const h=X();nt(h,e,i,n,s,a,r,o),l&&(N.a=e.width/l.width,N.d=e.height/l.height,K(h,N)),t.transform=h}function it(t,e,i,n,s,a,r,o,l,h,c,d){const u=X();if(d)nt(u,e,s,a,r,o,l,h);else{if(l)if("center"===c)q(u,{x:i/2,y:n/2},l);else switch($(u,l),l){case 90:V(u,n,0);break;case 180:V(u,i,n);break;case 270:V(u,0,i)}Y.x=e.x+s,Y.y=e.y+a,V(u,Y.x,Y.y),r&&Q(u,Y,r,o)}t.transform=u}function nt(t,e,i,n,s,a,r,o){r&&$(t,r),o&&J(t,o.x,o.y),s&&Z(t,s,a),V(t,e.x+i,e.y+n)}const{get:st,translate:at}=t.MatrixHelper,rt=new t.Bounds,ot={},lt={};function ht(t,e,i,n){const{changeful:s,sync:a,scaleFixed:r}=i;s&&(t.changeful=s),a&&(t.sync=a),r&&(t.scaleFixed=r),t.data=ct(i,n,e)}function ct(e,i,n){e.padding&&(i=rt.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:s,height:a}=n;const{opacity:r,mode:o,align:l,offset:h,scale:c,size:d,rotation:u,skew:f,clipSize:g,repeat:p,gap:_,filters:m}=e,y=i.width===s&&i.height===a,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(lt,0,0,v?a:s,v?s:a),o&&"cover"!==o&&"fit"!==o?((c||d)&&(t.MathHelper.getScaleData(c,d,n,ot),x=ot.scaleX,b=ot.scaleY),(l||_||p)&&(x&&t.BoundsHelper.scale(lt,x,b,!0),l&&t.AlignHelper.toPoint(l,lt,i,lt,!0,!0))):y&&!u||(x=b=t.BoundsHelper.getFitScale(i,lt,"fit"!==o),t.BoundsHelper.put(i,n,l,x,!1,lt),t.BoundsHelper.scale(lt,x,b,!0)),h&&t.PointHelper.move(lt,h),o){case"stretch":y||(s=i.width,a=i.height);break;case"normal":case"clip":(lt.x||lt.y||x||g||u||f)&&et(w,i,lt.x,lt.y,x,b,u,f,e.clipSize);break;case"repeat":(!y||x||u||f)&&it(w,i,s,a,lt.x,lt.y,x,b,u,f,l,e.freeTransform),p||(w.repeat="repeat");const n=t.isObject(p);(_||n)&&(w.gap=function(e,i,n,s,a){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:dt(r,n,a.width,i&&i.x),y:dt(o,s,a.height,i&&i.y)}}(_,n&&p,lt.width,lt.height,i));break;default:x&&tt(w,i,lt.x,lt.y,x,b,u)}return w.transform||(i.x||i.y)&&(w.transform=st(),at(w.transform,i.x,i.y)),x&&"stretch"!==o&&(w.scaleX=x,w.scaleY=b),w.width=s,w.height=a,r&&(w.opacity=r),m&&(w.filters=m),p&&(w.repeat=t.isString(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),w}function dt(e,i,n,s){const a=t.isString(e)||s?(s?n-s*i:n%i)/((s||Math.floor(n/i))-1):e;return"auto"===e&&a<0?0:a}let ut,ft=new t.Bounds;const{isSame:gt}=t.BoundsHelper;function pt(t,e,i,n,s,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||ht(s,n,i,a),!0}function _t(e,i){wt(e,t.ImageEvent.LOAD,i)}function mt(e,i){wt(e,t.ImageEvent.LOADED,i)}function yt(e,i,n){i.error=n,e.forceUpdate("surface"),wt(e,t.ImageEvent.ERROR,i)}function wt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function vt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:xt,scale:bt,copy:Lt}=t.MatrixHelper,{floor:Et,max:Bt,abs:St}=Math;function kt(e,i,n){let{scaleX:s,scaleY:a}=e.getRenderScaleData(!0,i.scaleFixed);const r=s+"-"+a+"-"+n;if(i.patternId===r||e.destroyed)return!1;{const{image:e,data:o}=i;let l,h,{width:c,height:d,scaleX:u,scaleY:f,transform:g,repeat:p,gap:_}=o;s*=n,a*=n;const m=_&&_.x*s,y=_&&_.y*a;u&&(u=St(u),f=St(f),h=xt(),Lt(h,g),bt(h,1/u,1/f),s*=u,a*=f),c*=s,d*=a;const w=c*d;if(!p&&w>t.Platform.image.maxCacheSize)return!1;let v=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;v>t&&(v=t)}if(w>v&&(l=Math.sqrt(w/v)),l&&(s/=l,a/=l,c/=l,d/=l),u&&(s/=u,a/=f),(g||1!==s||1!==a)&&(h||(h=xt(),g&&Lt(h,g)),bt(h,1/s,1/a)),h){const t=c+(m||0),e=d+(y||0);bt(h,t/Bt(Et(t),1),e/Bt(Et(e),1))}const x=e.getCanvas(c,d,o.opacity,o.filters,m,y),b=e.getPattern(x,p||t.Platform.origin.noRepeat||"no-repeat",h,i);return i.style=b,i.patternId=r,!0}}function Rt(t,e,i,n){return new(i||(i=Promise))(function(s,a){function r(t){try{l(n.next(t))}catch(t){a(t)}}function o(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Pt={image:function(e,i,n,s,a){let r,o;const l=t.ImageManager.get(n);return ut&&n===ut.paint&>(s,ut.boxBounds)?r=ut.leafPaint:(r={type:n.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),ut=l.use>1?{leafPaint:r,paint:n,boxBounds:ft.set(s)}:null),(a||l.loading)&&(o={image:l,attrName:i,attrValue:n}),l.ready?(pt(e,i,n,l,r,s),a&&(_t(e,o),mt(e,o))):l.error?a&&yt(e,o,l.error):(a&&(vt(e,!0),_t(e,o)),r.loadId=l.load(()=>{vt(e,!1),e.destroyed||(pt(e,i,n,l,r,s)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),mt(e,o)),r.loadId=void 0},t=>{vt(e,!1),yt(e,o,t),r.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(e,n,s,a){const{scaleX:r,scaleY:o}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:l}=n,{data:h}=s;if(!h||s.patternId===r+"-"+o+"-"+l&&!i.Export.running)return!1;if(a)if(h.repeat)a=!1;else if(!(s.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=h;e*=r*l,i*=o*l,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),a=e*i>t.Platform.image.maxCacheSize}return a?(e.__.__isFastShadow&&(n.fillStyle=s.style||"#000",n.fill()),function(t,e,i,n){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(e,n,s,h),!0):(!s.style||s.sync||i.Export.running?kt(e,s,l):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add(()=>Rt(this,void 0,void 0,function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&kt(e,s,l),e.forceUpdate("surface")}),300)),!1)},createPattern:kt,recycleImage:function(e,i){const n=i["_"+e];if(t.isArray(n)){let s,a,r,o,l;for(let h=0,c=n.length;h<c;h++)s=n[h],a=s.image,l=a&&a.url,l&&(r||(r={}),r[l]=!0,t.ImageManager.recycle(a),a.loading&&(o||(o=i.__input&&i.__input[e]||[],t.isArray(o)||(o=[o])),a.unload(n[h].loadId,!o.some(t=>t.url===l))));return r}return null},createData:ht,getPatternData:ct,fillOrFitMode:tt,clipMode:et,repeatMode:it},{toPoint:Ct}=t.AroundHelper,{hasTransparent:Tt}=i.ColorConvert,At={},Mt={};function Ot(e,n,s,a){if(s){let r,o,l,h;for(let e=0,c=s.length;e<c;e++)r=s[e],t.isString(r)?(l=e/(c-1),o=i.ColorConvert.string(r,a)):(l=r.offset,o=i.ColorConvert.string(r.color,a)),n.addColorStop(l,o),!h&&Tt(o)&&(h=!0);h&&(e.isTransparent=!0)}}const{getAngle:Wt,getDistance:Ht}=t.PointHelper,{get:It,rotateOfOuter:Dt,scaleOfOuter:zt}=t.MatrixHelper,{toPoint:Ft}=t.AroundHelper,jt={},Ut={};function Gt(t,e,i,n,s){let a;const{width:r,height:o}=t;if(r!==o||n){const t=Wt(e,i);a=It(),s?(zt(a,e,r/o*(n||1),1),Dt(a,e,t+90)):(zt(a,e,1,r/o*(n||1)),Dt(a,e,t))}return a}const{getDistance:Yt}=t.PointHelper,{toPoint:Nt}=t.AroundHelper,Xt={},qt={};const Vt={linearGradient:function(e,i){let{from:n,to:s,type:a,opacity:r}=e;Ct(n||"top",i,At),Ct(s||"bottom",i,Mt);const o=t.Platform.canvas.createLinearGradient(At.x,At.y,Mt.x,Mt.y),l={type:a,style:o};return Ot(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:n,to:s,type:a,opacity:r,stretch:o}=e;Ft(n||"center",i,jt),Ft(s||"bottom",i,Ut);const l=t.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Ht(jt,Ut)),h={type:a,style:l};Ot(h,l,e.stops,r);const c=Gt(i,jt,Ut,o,!0);return c&&(h.transform=c),h},conicGradient:function(e,i){let{from:n,to:s,type:a,opacity:r,stretch:o}=e;Nt(n||"center",i,Xt),Nt(s||"bottom",i,qt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Xt.x,Xt.y):t.Platform.canvas.createRadialGradient(Xt.x,Xt.y,0,Xt.x,Xt.y,Yt(Xt,qt)),h={type:a,style:l};Ot(h,l,e.stops,r);const c=Gt(i,Xt,qt,o||1,t.Platform.conicGradientRotate90);return c&&(h.transform=c),h},getTransform:Gt},{copy:Qt,toOffsetOutBounds:Kt}=t.BoundsHelper,Zt={},$t={};function Jt(e,i,n,s){const{bounds:a,shapeBounds:r}=s;if(t.Platform.fullImageShadow){if(Qt(Zt,e.bounds),Zt.x+=i.x-r.x,Zt.y+=i.y-r.y,n){const{fitMatrix:t}=s;Zt.x-=(a.x+(t?t.e:0)+a.width/2)*(n-1),Zt.y-=(a.y+(t?t.f:0)+a.height/2)*(n-1),Zt.width*=n,Zt.height*=n}e.copyWorld(s.canvas,e.bounds,Zt)}else n&&(Qt(Zt,i),Zt.x-=i.width/2*(n-1),Zt.y-=i.height/2*(n-1),Zt.width*=n,Zt.height*=n),e.copyWorld(s.canvas,r,n?Zt:i)}const{toOffsetOutBounds:te}=t.BoundsHelper,ee={};const ie={shadow:function(e,n,s){let a,r;const{__nowWorld:o,__layout:l}=e,{shadow:h}=e.__,{worldCanvas:c,bounds:d,shapeBounds:u,scaleX:f,scaleY:g}=s,p=n.getSameCanvas(),_=h.length-1;Kt(d,$t),h.forEach((h,m)=>{let y=1;if(h.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.setWorldShadow($t.offsetX+h.x*f*y,$t.offsetY+h.y*g*y,h.blur*f*y,i.ColorConvert.string(h.color)),r=h.spread?1+2*h.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*y:0,Jt(p,$t,r,s),a=d,h.box&&(p.restore(),p.save(),c&&(p.copyWorld(p,d,o,"copy"),a=o),c?p.copyWorld(c,o,o,"destination-out"):p.copyWorld(s.canvas,u,d,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,n,p,a,h.blendMode),_&&m<_&&p.clearWorld(a,!0)}),p.recycle(a)},innerShadow:function(e,n,s){let a,r;const{__nowWorld:o,__layout:l}=e,{innerShadow:h}=e.__,{worldCanvas:c,bounds:d,shapeBounds:u,scaleX:f,scaleY:g}=s,p=n.getSameCanvas(),_=h.length-1;te(d,ee),h.forEach((h,m)=>{let y=1;if(h.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.save(),p.setWorldShadow(ee.offsetX+h.x*f*y,ee.offsetY+h.y*g*y,h.blur*f*y),r=h.spread?1-2*h.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*y:0,Jt(p,ee,r,s),p.restore(),c?(p.copyWorld(p,d,o,"copy"),p.copyWorld(c,o,o,"source-out"),a=o):(p.copyWorld(s.canvas,u,d,"source-out"),a=d),p.fillWorld(a,i.ColorConvert.string(h.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,n,p,a,h.blendMode),_&&m<_&&p.clearWorld(a,!0)}),p.recycle(a)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:ne}=t.LeafBoundsHelper;let se;function ae(t,e,i,n,s,a,r,o){switch(e){case"grayscale":se||(se=!0,s.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,n,s,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),a&&n.recycle(r);oe(t,e,i,1,s,a)}(t,i,n,s,r,o);break;case"opacity-path":oe(t,i,n,a,r,o);break;case"path":o&&i.restore()}}function re(t){return t.getSameCanvas(!1,!0)}function oe(t,e,i,n,s,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,r,void 0,s),a?i.recycle(r):i.clearWorld(r,!0)}i.Group.prototype.__renderMask=function(t,e){let i,n,s,a,r,o;const{children:l}=this;for(let h=0,c=l.length;h<c;h++){if(i=l[h],o=i.__.mask,o){r&&(ae(this,r,t,s,n,a,void 0,!0),n=s=null),a=i.__.opacity,se=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",s||(s=re(t))):(r="path",t.save()),i.__clip(s||t,e)):(r="grayscale"===o?"grayscale":"alpha",n||(n=re(t)),s||(s=re(t)),i.__render(n,e)),"clipping"!==o&&"clipping-path"!==o||ne(i,e)||i.__render(t,e);continue}const c=1===a&&i.__.__blendMode;c&&ae(this,r,t,s,n,a,void 0,!1),ne(i,e)||i.__render(s||t,e),c&&ae(this,r,t,s,n,a,c,!1)}ae(this,r,t,s,n,a,void 0,!0)};const le=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",he=le+"_#~&*+\\=|≮≯≈≠=…",ce=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 de(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ue=de("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),fe=de("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ge=de(le),pe=de(he),_e=de("- —/~|┆·");var me;!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"}(me||(me={}));const{Letter:ye,Single:we,Before:ve,After:xe,Symbol:be,Break:Le}=me;function Ee(t){return ue[t]?ye:_e[t]?Le:fe[t]?ve:ge[t]?xe:pe[t]?be:ce.test(t)?we:ye}const Be={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let a=s-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function Se(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:ke}=Be,{Letter:Re,Single:Pe,Before:Ce,After:Te,Symbol:Ae,Break:Me}=me;let Oe,We,He,Ie,De,ze,Fe,je,Ue,Ge,Ye,Ne,Xe,qe,Ve,Qe,Ke,Ze=[];function $e(t,e){Ue&&!je&&(je=Ue),Oe.data.push({char:t,width:e}),He+=e}function Je(){Ie+=He,Oe.width=He,We.words.push(Oe),Oe={data:[]},He=0}function ti(){qe&&(Ve.paraNumber++,We.paraStart=!0,qe=!1),Ue&&(We.startCharSize=je,We.endCharSize=Ue,je=0),We.width=Ie,Qe.width?ke(We):Ke&&ei(),Ze.push(We),We={words:[]},Ie=0}function ei(){Ie>(Ve.maxWidth||0)&&(Ve.maxWidth=Ie)}const{top:ii,right:ni,bottom:si,left:ai}=t.Direction4;function ri(t,e,i){const{bounds:n,rows:s}=t;n[e]+=i;for(let t=0;t<s.length;t++)s[t][e]+=i}const oi={getDrawData:function(e,n){t.isString(e)||(e=String(e));let s=0,a=0,r=n.__getInput("width")||0,o=n.__getInput("height")||0;const{textDecoration:l,__font:h,__padding:c}=n;c&&(r?(s=c[ai],r-=c[ni]+c[ai]):n.autoSizeAlign||(s=c[ai]),o?(a=c[ii],o-=c[ii]+c[si]):n.autoSizeAlign||(a=c[ii]));const d={bounds:{x:s,y:a,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=h};return function(e,i,n){Ve=e,Ze=e.rows,Qe=e.bounds,Ke=!Qe.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:a,textCase:r}=n,{canvas:o}=t.Platform,{width:l,height:h}=Qe;if(l||h||s||"none"!==r){const t="none"!==n.textWrap,e="break"===n.textWrap;qe=!0,Ye=null,je=Fe=Ue=He=Ie=0,Oe={data:[]},We={words:[]},s&&(i=[...i]);for(let n=0,h=i.length;n<h;n++)ze=i[n],"\n"===ze?(He&&Je(),We.paraEnd=!0,ti(),qe=!0):(Ge=Ee(ze),Ge===Re&&"none"!==r&&(ze=Se(ze,r,!He)),Fe=o.measureText(ze).width,s&&(s<0&&(Ue=Fe),Fe+=s),Ne=Ge===Pe&&(Ye===Pe||Ye===Re)||Ye===Pe&&Ge!==Te,Xe=!(Ge!==Ce&&Ge!==Pe||Ye!==Ae&&Ye!==Te),De=qe&&a?l-a:l,t&&l&&Ie+He+Fe>De&&(e?(He&&Je(),Ie&&ti()):(Xe||(Xe=Ge===Re&&Ye==Te),Ne||Xe||Ge===Me||Ge===Ce||Ge===Pe||He+Fe>De?(He&&Je(),Ie&&ti()):Ie&&ti()))," "===ze&&!0!==qe&&Ie+He===0||(Ge===Me?(" "===ze&&He&&Je(),$e(ze,Fe),Je()):Ne||Xe?(He&&Je(),$e(ze,Fe)):$e(ze,Fe)),Ye=Ge);He&&Je(),Ie&&ti(),Ze.length>0&&(Ze[Ze.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ve.paraNumber++,Ie=o.measureText(t).width,Ze.push({x:a||0,text:t,width:Ie,paraStart:!0}),Ke&&ei()})}(d,e,n),c&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ri(e,"x",t[ai]);break;case"right":ri(e,"x",-t[ni])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ri(e,"y",t[ii]);break;case"bottom":ri(e,"y",-t[si])}}(c,d,n,r,o),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:h,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=n,m=a*s+(d?d*(t.paraNumber-1):0),y=r;if(l&&m>_)m=Math.max(_,a),s>1&&(t.overflow=s);else if(_||u)switch(c){case"middle":g+=(_-m)/2;break;case"bottom":g+=_-m}y+=g;let w,v,x,b=p||u?p:t.maxWidth;for(let r=0,c=s;r<c;r++){if(w=i[r],w.x=f,w.width<p||w.width>p&&!l)switch(h){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&d&&r>0&&(y+=d),w.y=y,y+=a,t.overflow>r&&y>m&&(w.isOverflow=!0,t.overflow=r+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&&p&&p<x&&(w.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=g,n.height=m}(d,n),function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:a,letterSpacing:r}=e;let o,l,h,c,d,u;n.forEach(t=>{t.words&&(h=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===s||"both"===s)&&u>1?(i-t.width-h)/(u-1):0,c=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(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,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===c?(d={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):o=function(t,e,i,n){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==s||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(d,n,r),d.overflow&&function(e,i,n,s){if(!s)return;const{rows:a,overflow:r}=e;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?t.Platform.canvas.measureText(o).width:0,c=n+s-h;("none"===i.textWrap?a:[a[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===i&&l<c));n--){if(l<c&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=h,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(d,n,s,r),"none"!==l&&function(e,n){let s;const{fontSize:a,textDecoration:r}=n;switch(e.decorationHeight=a/11,t.isObject(r)?(s=r.type,r.color&&(e.decorationColor=i.ColorConvert.string(r.color))):s=r,s){case"under":e.decorationY=[.15*a];break;case"delete":e.decorationY=[.35*-a];break;case"under-delete":e.decorationY=[.15*a,.35*-a]}}(d,n),d}};const li={string:function(e,n){const s=t.isNumber(n)&&n<1;if(t.isString(e)){if(!s||!i.ColorConvert.object)return e;e=i.ColorConvert.object(e)}let a=t.isUndefined(e.a)?1:e.a;s&&(a*=n);const r=e.r+","+e.g+","+e.b;return 1===a?"rgb("+r+")":"rgba("+r+","+a+")"}};Object.assign(i.TextConvert,oi),Object.assign(i.ColorConvert,li),Object.assign(i.Paint,G),Object.assign(i.PaintImage,Pt),Object.assign(i.PaintGradient,Vt),Object.assign(i.Effect,ie),Object.assign(t.Creator,{interaction:(t,e,i,n)=>new B(t,e,i,n),hitCanvas:(t,e)=>new n(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),i.Leafer.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&r(0,wx)}catch(t){}Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=B,exports.Layouter=y,exports.LeaferCanvas=n,exports.Picker=b,exports.Renderer=v,exports.Selector=L,exports.Watcher=o,exports.useCanvas=r,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(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
2
2
|
//# sourceMappingURL=miniapp.min.cjs.map
|