@leafer-ui/miniapp 1.6.6 → 1.7.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 +17 -11
- package/dist/miniapp.esm.js +17 -11
- 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 +88 -63
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +12 -12
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}=t.MatrixHelper;function $(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 J(t,e,i,n,s,a,o){const r=N();V(r,e.x+i,e.y+n),s&&K(r,s,a),o&&Z(r,o),t.transform=r}function tt(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:et,translate:it}=t.MatrixHelper,nt=new t.Bounds,st={},at={};function ot(t,e,i,n){const{changeful:s,sync:a}=i;s&&(t.changeful=s),a&&(t.sync=a),t.data=rt(i,n,e)}function rt(e,i,n){e.padding&&(i=nt.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,repeat:f,filters:p}=e,g=i.width===s&&i.height===a,_={mode:r},m="center"!==h&&(u||0)%180==90;let w,y;switch(t.BoundsHelper.set(at,0,0,m?a:s,m?s:a),r&&"cover"!==r&&"fit"!==r?((c||d)&&(t.MathHelper.getScaleData(c,d,n,st),w=st.scaleX,y=st.scaleY),h&&(w&&t.BoundsHelper.scale(at,w,y,!0),t.AlignHelper.toPoint(h,at,i,at,!0,!0))):g&&!u||(w=y=t.BoundsHelper.getFitScale(i,at,"fit"!==r),t.BoundsHelper.put(i,n,h,w,!1,at),t.BoundsHelper.scale(at,w,y,!0)),l&&t.PointHelper.move(at,l),r){case"stretch":g||(s=i.width,a=i.height);break;case"normal":case"clip":(at.x||at.y||w||u)&&J(_,i,at.x,at.y,w,y,u);break;case"repeat":(!g||w||u)&&tt(_,i,s,a,at.x,at.y,w,y,u,h),f||(_.repeat="repeat");break;default:w&&$(_,i,at.x,at.y,w,y,u)}return _.transform||(i.x||i.y)&&(_.transform=et(),it(_.transform,i.x,i.y)),w&&"stretch"!==r&&(_.scaleX=w,_.scaleY=y),_.width=s,_.height=a,o&&(_.opacity=o),p&&(_.filters=p),f&&(_.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),_}let ht,lt=new t.Bounds;const{isSame:ct}=t.BoundsHelper;function dt(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||ot(s,n,i,a),!0}function ut(e,i){gt(e,t.ImageEvent.LOAD,i)}function ft(e,i){gt(e,t.ImageEvent.LOADED,i)}function pt(e,i,n){i.error=n,e.forceUpdate("surface"),gt(e,t.ImageEvent.ERROR,i)}function gt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function _t(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:mt,scale:wt,copy:yt}=t.MatrixHelper,{ceil:vt,abs:xt}=Math;function bt(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=xt(s),a=xt(a);const{image:e,data:r}=i;let h,l,{width:c,height:d,scaleX:u,scaleY:f,transform:p,repeat:g}=r;u&&(l=mt(),yt(l,p),wt(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=mt(),p&&yt(l,p)),wt(l,1/s,1/a));const w=e.getCanvas(vt(c)||1,vt(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 Et(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:Lt}=Math;const Bt={image:function(e,i,n,s,a){let o,r;const h=t.ImageManager.get(n);return ht&&n===ht.paint&&ct(s,ht.boxBounds)?o=ht.leafPaint:(o={type:n.type,image:h},h.hasAlphaPixel&&(o.isTransparent=!0),ht=h.use>1?{leafPaint:o,paint:n,boxBounds:lt.set(s)}:null),(a||h.loading)&&(r={image:h,attrName:i,attrValue:n}),h.ready?(dt(e,i,n,h,o,s),a&&(ut(e,r),ft(e,r))):h.error?a&&pt(e,r,h.error):(a&&(_t(e,!0),ut(e,r)),o.loadId=h.load((()=>{_t(e,!1),e.destroyed||(dt(e,i,n,h,o,s)&&(h.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),ft(e,r)),o.loadId=null}),(t=>{_t(e,!1),pt(e,r,t),o.loadId=null})),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*=Lt(o)*h,i*=Lt(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?bt(e,s,h):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>Et(this,void 0,void 0,(function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&bt(e,s,h),e.forceUpdate("surface")}))),300)),!1)},createPattern:bt,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:ot,getPatternData:rt,fillOrFitMode:$,clipMode:J,repeatMode:tt},{toPoint:Rt}=t.AroundHelper,{hasTransparent:St}=i.ColorConvert,kt={},Pt={};function Tt(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&&St(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ct,getDistance:At}=t.PointHelper,{get:Mt,rotateOfOuter:Ot,scaleOfOuter:Wt}=t.MatrixHelper,{toPoint:It}=t.AroundHelper,Dt={},Ht={};function zt(t,e,i,n,s){let a;const{width:o,height:r}=t;if(o!==r||n){const t=Ct(e,i);a=Mt(),s?(Wt(a,e,o/r*(n||1),1),Ot(a,e,t+90)):(Wt(a,e,1,o/r*(n||1)),Ot(a,e,t))}return a}const{getDistance:Ft}=t.PointHelper,{toPoint:jt}=t.AroundHelper,Ut={},Gt={};const Yt={linearGradient:function(e,i){let{from:n,to:s,type:a,opacity:o}=e;Rt(n||"top",i,kt),Rt(s||"bottom",i,Pt);const r=t.Platform.canvas.createLinearGradient(kt.x,kt.y,Pt.x,Pt.y),h={type:a,style:r};return Tt(h,r,e.stops,o),h},radialGradient:function(e,i){let{from:n,to:s,type:a,opacity:o,stretch:r}=e;It(n||"center",i,Dt),It(s||"bottom",i,Ht);const h=t.Platform.canvas.createRadialGradient(Dt.x,Dt.y,0,Dt.x,Dt.y,At(Dt,Ht)),l={type:a,style:h};Tt(l,h,e.stops,o);const c=zt(i,Dt,Ht,r,!0);return c&&(l.transform=c),l},conicGradient:function(e,i){let{from:n,to:s,type:a,opacity:o,stretch:r}=e;jt(n||"center",i,Ut),jt(s||"bottom",i,Gt);const h=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Ut.x,Ut.y):t.Platform.canvas.createRadialGradient(Ut.x,Ut.y,0,Ut.x,Ut.y,Ft(Ut,Gt)),l={type:a,style:h};Tt(l,h,e.stops,o);const c=zt(i,Ut,Gt,r||1,t.Platform.conicGradientRotate90);return c&&(l.transform=c),l},getTransform:zt},{copy:qt,toOffsetOutBounds:Nt}=t.BoundsHelper,Xt={},Vt={};function Qt(e,i,n,s){const{bounds:a,shapeBounds:o}=s;if(t.Platform.fullImageShadow){if(qt(Xt,e.bounds),Xt.x+=i.x-o.x,Xt.y+=i.y-o.y,n){const{matrix:t}=s;Xt.x-=(a.x+(t?t.e:0)+a.width/2)*(n-1),Xt.y-=(a.y+(t?t.f:0)+a.height/2)*(n-1),Xt.width*=n,Xt.height*=n}e.copyWorld(s.canvas,e.bounds,Xt)}else n&&(qt(Xt,i),Xt.x-=i.width/2*(n-1),Xt.y-=i.height/2*(n-1),Xt.width*=n,Xt.height*=n),e.copyWorld(s.canvas,o,n?Xt:i)}const{toOffsetOutBounds:Kt}=t.BoundsHelper,Zt={};const $t={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;Nt(c,Vt),h.forEach(((h,_)=>{p.setWorldShadow(Vt.offsetX+h.x*u,Vt.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,Qt(p,Vt,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;Kt(c,Zt),h.forEach(((h,_)=>{p.save(),p.setWorldShadow(Zt.offsetX+h.x*u,Zt.offsetY+h.y*f,h.blur*u),a=h.spread?1-2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Qt(p,Zt,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:Jt}=t.LeafBoundsHelper;function te(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),ie(t,e,i,1)}(t,i,n,s);break;case"opacity-path":ie(t,i,n,a);break;case"path":i.restore()}}function ee(t){return t.getSameCanvas(!1,!0)}function ie(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&&(te(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=ee(t))):(o="path",t.save()),i.__clip(s||t,e)):(o="grayscale"===r?"grayscale":"alpha",n||(n=ee(t)),s||(s=ee(t)),i.__render(n,e)),"clipping"!==r&&"clipping-path"!==r)||Jt(i,e)||i.__render(s||t,e);te(this,o,t,s,n,a)};const ne=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",se=ne+"_#~&*+\\=|≮≯≈≠=…",ae=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 oe(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const re=oe("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),he=oe("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),le=oe(ne),ce=oe(se),de=oe("- —/~|┆·");var ue;!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"}(ue||(ue={}));const{Letter:fe,Single:pe,Before:ge,After:_e,Symbol:me,Break:we}=ue;function ye(t){return re[t]?fe:de[t]?we:he[t]?ge:le[t]?_e:ce[t]?me:ae.test(t)?pe:fe}const ve={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 xe(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:be}=ve,{Letter:Ee,Single:Le,Before:Be,After:Re,Symbol:Se,Break:ke}=ue;let Pe,Te,Ce,Ae,Me,Oe,We,Ie,De,He,ze,Fe,je,Ue,Ge,Ye,qe,Ne=[];function Xe(t,e){De&&!Ie&&(Ie=De),Pe.data.push({char:t,width:e}),Ce+=e}function Ve(){Ae+=Ce,Pe.width=Ce,Te.words.push(Pe),Pe={data:[]},Ce=0}function Qe(){Ue&&(Ge.paraNumber++,Te.paraStart=!0,Ue=!1),De&&(Te.startCharSize=Ie,Te.endCharSize=De,Ie=0),Te.width=Ae,Ye.width?be(Te):qe&&Ke(),Ne.push(Te),Te={words:[]},Ae=0}function Ke(){Ae>(Ge.maxWidth||0)&&(Ge.maxWidth=Ae)}const{top:Ze,right:$e,bottom:Je,left:ti}=t.Direction4;function ei(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 ii={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[ti],o-=c[$e]+c[ti]):n.autoSizeAlign||(s=c[ti]),r?(a=c[Ze],r-=c[Ze]+c[Je]):n.autoSizeAlign||(a=c[Ze]));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){Ge=e,Ne=e.rows,Ye=e.bounds,qe=!Ye.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:a,textCase:o}=n,{canvas:r}=t.Platform,{width:h,height:l}=Ye;if(h||l||s||"none"!==o){const t="none"!==n.textWrap,e="break"===n.textWrap;Ue=!0,ze=null,Ie=We=De=Ce=Ae=0,Pe={data:[]},Te={words:[]},s&&(i=[...i]);for(let n=0,l=i.length;n<l;n++)Oe=i[n],"\n"===Oe?(Ce&&Ve(),Te.paraEnd=!0,Qe(),Ue=!0):(He=ye(Oe),He===Ee&&"none"!==o&&(Oe=xe(Oe,o,!Ce)),We=r.measureText(Oe).width,s&&(s<0&&(De=We),We+=s),Fe=He===Le&&(ze===Le||ze===Ee)||ze===Le&&He!==Re,je=!(He!==Be&&He!==Le||ze!==Se&&ze!==Re),Me=Ue&&a?h-a:h,t&&h&&Ae+Ce+We>Me&&(e?(Ce&&Ve(),Ae&&Qe()):(je||(je=He===Ee&&ze==Re),Fe||je||He===ke||He===Be||He===Le||Ce+We>Me?(Ce&&Ve(),Ae&&Qe()):Ae&&Qe()))," "===Oe&&!0!==Ue&&Ae+Ce===0||(He===ke?(" "===Oe&&Ce&&Ve(),Xe(Oe,We),Ve()):Fe||je?(Ce&&Ve(),Xe(Oe,We)):Xe(Oe,We)),ze=He);Ce&&Ve(),Ae&&Qe(),Ne.length>0&&(Ne[Ne.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ge.paraNumber++,Ae=r.measureText(t).width,Ne.push({x:a||0,text:t,width:Ae,paraStart:!0}),qe&&Ke()}))}(d,e,n),c&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ei(e,"x",t[ti]);break;case"right":ei(e,"x",-t[$e])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ei(e,"y",t[Ze]);break;case"bottom":ei(e,"y",-t[Je])}}(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 ni={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,ii),Object.assign(i.ColorConvert,ni),Object.assign(i.Paint,Y),Object.assign(i.PaintImage,Bt),Object.assign(i.PaintGradient,Yt),Object.assign(i.Effect,$t),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?("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]}})}));
|
|
2
2
|
//# sourceMappingURL=miniapp.min.cjs.map
|