0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const r=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,r)}let i;this._nodeList[e]=t;for(let r=e-1;r>=0&&(i=this._nodeList[r],!i);r--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap||!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex(i=>i===t);e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren((n,r)=>!(n===this||!t(n,r))&&(i=n,!0)),e&&this.forEachChildren(n=>{if(n.isContainer){const r=n.find(t,!0);if(r)return i=r,!0}return!1}),i}findAll(t,e=!1){let i=[];return this.forEachChildren((n,r)=>{n!==this&&t(n,r)&&i.push(n)}),e&&this.forEachChildren(n=>{if(n.isContainer){const r=n.findAll(t,!0);r.length&&(i=i.concat(r))}}),i}getElementById(t){return this.find(e=>e.id===t,!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll(e=>e.name===t,!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll(e=>e.type===t,!0)}getChildByName(t,e=!1){return this.find(i=>i.name===t,e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(i instanceof Rs))return void Nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(i,i.type,n);if(this.dispatchEvent(r,"pointerdown"),r.pointerType==="touch")this.dispatchEvent(r,"touchstart");else if(Zr(r.pointerType)){const a=r.button===2;this.dispatchEvent(r,a?"rightdown":"mousedown")}this.trackingData(i.pointerId).pressTargetsByButton[i.button]=r.composedPath(),this.freeEvent(r)},this.onPointerMove=(i,n)=>{var r,a;if(!(i instanceof Rs))return void Nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const o=this.createPointerEvent(i,i.type,n),l=Zr(o.pointerType),h=this.trackingData(i.pointerId),d=this.findMountedTarget(h.overTargets);if(h.overTargets&&d&&d!==this.rootTarget&&d!==o.target){const u=i.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(i,u,d||void 0);if(this.dispatchEvent(c,"pointerout"),l&&this.dispatchEvent(c,"mouseout"),!o.composedPath().includes(d)){const p=this.createPointerEvent(i,"pointerleave",d||void 0);for(p.eventPhase=p.AT_TARGET;p.target&&!o.composedPath().includes(p.target);)p.currentTarget=p.target,this.notifyTarget(p),l&&this.notifyTarget(p,"mouseleave"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(c)}if(d!==o.target){const u=i.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(o,u);this.dispatchEvent(c,"pointerover"),l&&this.dispatchEvent(c,"mouseover");let p=d==null?void 0:d.parent;for(;p&&p!==this.rootTarget.parent&&p!==o.target;)p=p.parent;if(!p||p===this.rootTarget.parent){const g=this.clonePointerEvent(o,"pointerenter");for(g.eventPhase=g.AT_TARGET;g.target&&g.target!==d&&g.target!==this.rootTarget.parent;)g.currentTarget=g.target,this.notifyTarget(g),l&&this.notifyTarget(g,"mouseenter"),g.target=g.target.parent;this.freeEvent(g)}this.freeEvent(c)}this.dispatchEvent(o,"pointermove"),o.pointerType==="touch"&&this.dispatchEvent(o,"touchmove"),l&&(this.dispatchEvent(o,"mousemove"),this.cursorTarget=o.target,this.cursor=((a=(r=o.target)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.cursor)||this.rootTarget.getCursor()),h.overTargets=o.composedPath(),this.freeEvent(o)},this.onPointerOver=(i,n)=>{var r,a;if(!(i instanceof Rs))return void Nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const o=this.trackingData(i.pointerId),l=this.createPointerEvent(i,i.type,n),h=Zr(l.pointerType);this.dispatchEvent(l,"pointerover"),h&&this.dispatchEvent(l,"mouseover"),l.pointerType==="mouse"&&(this.cursorTarget=l.target,this.cursor=((a=(r=l.target)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.cursor)||this.rootTarget.getCursor());const d=this.clonePointerEvent(l,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),h&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;o.overTargets=l.composedPath(),this.freeEvent(l),this.freeEvent(d)},this.onPointerOut=(i,n)=>{if(!(i instanceof Rs))return void Nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(i.pointerId);if(r.overTargets){const a=Zr(i.pointerType),o=this.findMountedTarget(r.overTargets),l=this.createPointerEvent(i,"pointerout",o||void 0);this.dispatchEvent(l),a&&this.dispatchEvent(l,"mouseout");const h=this.createPointerEvent(i,"pointerleave",o||void 0);for(h.eventPhase=h.AT_TARGET;h.target&&h.target!==this.rootTarget.parent;)h.currentTarget=h.target,this.notifyTarget(h),a&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;r.overTargets=[],this.freeEvent(l),this.freeEvent(h)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(i,n)=>{var r;if(!(i instanceof Rs))return void Nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const a=po.now(),o=this.createPointerEvent(i,i.type,n);if(this.dispatchEvent(o,"pointerup"),o.pointerType==="touch")this.dispatchEvent(o,"touchend");else if(Zr(o.pointerType)){const u=o.button===2;this.dispatchEvent(o,u?"rightup":"mouseup")}const l=this.trackingData(i.pointerId),h=this.findMountedTarget(l.pressTargetsByButton[i.button]);let d=h;if(h&&!o.composedPath().includes(h)){let u=h;for(;u&&!o.composedPath().includes(u);){if(o.currentTarget=u,this.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch")this.notifyTarget(o,"touchendoutside");else if(Zr(o.pointerType)){const c=o.button===2;this.notifyTarget(o,c?"rightupoutside":"mouseupoutside")}u=u.parent}delete l.pressTargetsByButton[i.button],d=u}if(d){const u=this.clonePointerEvent(o,"click");u.target=d,u.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:u.target,timeStamp:a});const c=l.clicksByButton[i.button];c.target===u.target&&a-c.timeStamp<((r=this._config.clickInterval)!==null&&r!==void 0?r:200)?++c.clickCount:c.clickCount=1,c.target=u.target,c.timeStamp=a,u.detail=c.clickCount,Zr(u.pointerType)?(this.dispatchEvent(u,"click"),c.clickCount===2&&this.dispatchEvent(u,"dblclick")):u.pointerType==="touch"&&(this.dispatchEvent(u,"tap"),c.clickCount===2&&this.dispatchEvent(u,"dbltap")),this.dispatchEvent(u,"pointertap"),this.freeEvent(u)}this.freeEvent(o)},this.onPointerUpOutside=(i,n)=>{if(!(i instanceof Rs))return void Nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(i.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[i.button]),o=this.createPointerEvent(i,i.type,n);if(a){let l=a;for(;l;)o.currentTarget=l,this.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch"?this.notifyTarget(o,"touchendoutside"):Zr(o.pointerType)&&this.notifyTarget(o,o.button===2?"rightupoutside":"mouseupoutside"),l=l.parent;delete r.pressTargetsByButton[i.button]}this.freeEvent(o)},this.onWheel=(i,n)=>{if(!(i instanceof Ca))return void Nt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const r=this.createWheelEvent(i,n);this.dispatchEvent(r),this.freeEvent(r)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,n)=>i.priority-n.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,r,a,o,l;if(!this.rootTarget)return;const h=this.mappingTable[t.type];let d;const u=`${t.canvasX}-${t.canvasY}`;if(!((e=this._prePointTargetCache)===null||e===void 0)&&e[u]&&(!((n=(i=this._prePointTargetCache)===null||i===void 0?void 0:i[u])===null||n===void 0)&&n.stage)&&((a=(r=this._prePointTargetCache)===null||r===void 0?void 0:r[u])===null||a===void 0?void 0:a.stage.renderCount)===((o=this._prePointTargetCache)===null||o===void 0?void 0:o.stageRenderCount)?d=this._prePointTargetCache[u]:(d=this.pickTarget(t.canvasX,t.canvasY,t),t.pickParams||(this._prePointTargetCache={[u]:d,stageRenderCount:(l=d==null?void 0:d.stage.renderCount)!==null&&l!==void 0?l:-1})),h)for(let c=0,p=h.length;c=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=e??t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y}))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=po.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=((e=this.eventPool.get(t))===null||e===void 0?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),(e=this.eventPool.get(i))===null||e===void 0||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,r=i.length;n{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.normalizeToPointerData(u);this.autoPreventDefault&&c[0].isNormalized&&(u.cancelable||!("cancelable"in u))&&u.preventDefault();for(let p=0,g=c.length;p{if(this.supportsTouchEvents&&u.pointerType==="touch"||this.isEventOutsideOfTargetElement(u))return;const c=this.normalizeToPointerData(u);for(let p=0,g=c.length;p{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.isEventOutsideOfTargetElement(u)?"outside":"",p=this.normalizeToPointerData(u);for(let g=0,f=p.length;g{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.normalizeToPointerData(u);for(let p=0,g=c.length;p{const c=this.normalizeWheelEvent(u);this.manager.mapEvent(c)};const{targetElement:e,resolution:i,rootNode:n,global:r,viewport:a,autoPreventDefault:o=!1,clickInterval:l,supportsTouchEvents:h=r.supportsTouchEvents,supportsPointerEvents:d=r.supportsPointerEvents}=t;this.manager=new OH(n,{clickInterval:l}),this.globalObj=r,this.supportsPointerEvents=d,this.supportsTouchEvents=h,this.supportsMouseEvents=r.supportsMouseEvents,this.applyStyles=r.applyStyles,this.autoPreventDefault=o,this.eventsAdded=!1,this.viewport=a,this.rootPointerEvent=new Rs,this.rootWheelEvent=new Ca,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const r=this.cursorStyles[t];r?typeof r=="string"&&i?n.style.cursor=r:typeof r=="function"?r(t):typeof r=="object"&&i&&Object.assign(n.style,r):i&&ht(t)&&!Zs(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=(e=this.globalObj)===null||e===void 0?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:r}=t,a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class Wg{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return Wg.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class Vg{static Avaliable(){return!0}avaliable(){return Vg.Avaliable()}tick(t,e){this.timerId=setTimeout(()=>{e(this)},t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class Kd{static Avaliable(){return!!et.global.getRequestAnimationFrame()}avaliable(){return Kd.Avaliable()}tick(t,e){et.global.getRequestAnimationFrame()(()=>{this.released||e(this)})}release(){this.released=!0}getTime(){return Date.now()}}var $s;(function(s){s[s.INITIAL=0]="INITIAL",s[s.RUNNING=1]="RUNNING",s[s.PAUSE=2]="PAUSE"})($s||($s={}));class DH{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(t=[]){this.handleTick=(e,i)=>{const{once:n=!1}=i??{};this.ifCanStop()?this.stop():(this._handlerTick(e),n||e.tick(this.interval,this.handleTick))},this._handlerTick=e=>{const i=this.tickerHandler.getTime();let n=0;this.lastFrameTime>=0&&(n=i-this.lastFrameTime),this.lastFrameTime=i,this.status===$s.RUNNING&&(this.tickCounts++,this.timelines.forEach(r=>{r.tick(n)}))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=$s.INITIAL,et.global.hooks.onSetEnv.tap("default-ticker",()=>{this.initHandler()}),et.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter(e=>e!==t)}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:Kd},{mode:"timeout",cons:Vg},{mode:"manual",cons:Wg}];for(let e=0;e{this.handleTick(e,{once:!0})})}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,e=>{this.handleTick(e,{once:!0})})}pause(){return this.status!==$s.INITIAL&&(this.status=$s.PAUSE,!0)}resume(){return this.status!==$s.INITIAL&&(this.status=$s.RUNNING,!0)}ifCanStop(){return!!(this.autoStop&&(!this.timelines.length||this.timelines.reduce((t,e)=>t+e.animateCount,0)===0))}start(t=!1){return this.status===$s.RUNNING||!this.tickerHandler||!t&&(this.status===$s.PAUSE||!this.timelines.length||this.timelines.reduce((e,i)=>e+i.animateCount,0)===0)?!1:(this.status=$s.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0)}stop(){this.status=$s.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}}class Wt{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return t===0?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return t===0?0:Math.pow(2,10*t-10)}static expoOut(t){return t===1?1:1-Math.pow(2,-10*t)}static expoInOut(t){return t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-Wt.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Wt.bounceIn(2*t):.5*Wt.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(i===0||i===1)return i;const n=e/jt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*jt/e)}}static getElasticOut(t,e){return function(i){if(i===0||i===1)return i;const n=e/jt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*jt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/jt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*jt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*jt/e)*.5+1}}}Wt.quadIn=Wt.getPowIn(2),Wt.quadOut=Wt.getPowOut(2),Wt.quadInOut=Wt.getPowInOut(2),Wt.cubicIn=Wt.getPowIn(3),Wt.cubicOut=Wt.getPowOut(3),Wt.cubicInOut=Wt.getPowInOut(3),Wt.quartIn=Wt.getPowIn(4),Wt.quartOut=Wt.getPowOut(4),Wt.quartInOut=Wt.getPowInOut(4),Wt.quintIn=Wt.getPowIn(5),Wt.quintOut=Wt.getPowOut(5),Wt.quintInOut=Wt.getPowInOut(5),Wt.backIn=Wt.getBackIn(1.7),Wt.backOut=Wt.getBackOut(1.7),Wt.backInOut=Wt.getBackInOut(1.7),Wt.elasticIn=Wt.getElasticIn(1,.3),Wt.elasticOut=Wt.getElasticOut(1,.3),Wt.elasticInOut=Wt.getElasticInOut(1,.3*1.5);class GR{constructor(){this.id=ii.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===Ui.END?this.removeAnimate(e):e.status===Ui.RUNNING||e.status===Ui.INITIAL?(this.animateCount++,e.advance(t)):e.status===Ui.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t,e=!0){t._onRemove&&t._onRemove.forEach(i=>i()),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const WR=new GR;class ms{constructor(t,e,i,n,r){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=r,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},(t=this.step.prev.getLastProps())!==null&&t!==void 0?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(this.updateCount===0){this.onFirstRun();const n=this.step.getLastProps();Object.keys(n).forEach(r=>{this.subAnimate.animate.validAttr(r)&&(i[r]=n[r])})}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class FH extends ms{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let Ug=class Ld{constructor(t=ii.GenAutoIncrementId(),e=WR){this.id=t,this.timeline=e,this.status=Ui.INITIAL,this.tailAnimate=new dk(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce((t,e)=>t+e.totalDuration,0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach(i=>{e=ps(i.getDuration(),e)}),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){Ld.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this.subAnimates.length===1&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t,e=Ld.mode){t&&e&wh.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:je.ANIMATE_PLAY})}runCb(t){const e=new FH(()=>{t(this,e.step.prev)});return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,r,a){const o=Ld.interpolateMap.get(t)||Ld.interpolateMap.get("");return!!o&&o(t,e,i,n,r,a)}pause(){this.status===Ui.RUNNING&&(this.status=Ui.PAUSED)}resume(){this.status===Ui.PAUSED&&(this.status=Ui.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const r=this.target.stage;r&&r.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const r=this.target.stage;r&&r.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}subAnimate(){const t=new dk(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach(e=>this.preventAttr(e))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach(e=>{e.bind(t)}),this}advance(t){if(this._duringTimee())),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Ui.RUNNING&&(this.status=Ui.END,this._onEnd&&this._onEnd.forEach(e=>e()))}setPosition(t){let e,i=0;const n=this.rawPosition,r=this.subAnimates.reduce((o,l)=>o+l.totalDuration,0);t<0&&(t=0);const a=t>=r;if(a&&(t=r),t===n)return a;for(let o=0;o=t));o++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),a}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=Ui.END}stop(t){t||this.target.onStop(),t==="start"?this.target.onStop(this.getStartProps()):t==="end"?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};Ug.mode=wh.NORMAL,Ug.interpolateMap=new Map;class dk{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new uk(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(e==null||e<0)&&(e=0);const i=t.easing,n=typeof i=="string"?Wt[i]:i,r=this._addStep(e,null,n);return r.type=_l.customAnimate,this._appendProps(t.getEndProps(),r,!1),this._appendCustomAnimate(t,r),this}to(t,e,i,n){(e==null||e<0)&&(e=0);const r=typeof i=="string"?Wt[i]:i,a=this._addStep(e,null,r);return a.type=_l.to,this._appendProps(t,a,!!n&&n.tempProps),a.propKeys||(a.propKeys=Object.keys(a.props)),n&&n.noPreventAttrs||this.target.animates.forEach(o=>{o.id!==this.animate.id&&o.preventAttrs(a.propKeys)}),this}from(t,e,i,n){this.to(t,0,i,n);const r={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach(a=>{r[a]=this.getLastPropByName(a,this.stepTail)}),this.to(r,e,i,n),this.stepTail.type=_l.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return(t=this.stepHead)===null||t===void 0?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=_l.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new uk(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const r=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach(o=>{e.props[o]===void 0&&(e.props[o]=this.target.getDefaultAttribute(o))});n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach(o=>{r[o]===void 0&&(r[o]=n.props[o])})),e.propKeys=Object.keys(e.props),n=n.prev;const a=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(r)),e.propKeys.forEach(o=>{if(a[o]===void 0){const l=this.animate.getStartProps();a[o]=l[o]=this.target.getComputedAttribute(o)}}),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,r=this.rawPosition;let a,o,l=!1;const h=(e=this._startAt)!==null&&e!==void 0?e:0;if(t<0&&(t=0),t=n*i+i,l&&(o=i,a=n,t=o*a+i),t===r)return l;const d=!this.reversed!=!(this.bounce&&a%2);return d&&(o=i-o),this._deltaPosition=o-this.position,this.position=o,this.rawPosition=t+h,this.updatePosition(l,d),l}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,r=this.duration;if(this.target&&i){let a=i.next;for(;a&&a.position<=n;)i=a,a=i.next;let o=t?r===0?1:n/r:(n-i.position)/i.duration;i.easing&&(o=i.easing(o)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,o,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach(l=>l(i,o))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let n=e.prev;for(;n&&n!==t;)n.customAnimate&&(n.customAnimate.onStart&&n.customAnimate.onStart(),n.customAnimate.onEnd&&n.customAnimate.onEnd()),n=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let n=e.next;for(;n&&n!==t;)n.customAnimate&&(n.customAnimate.onStart&&n.customAnimate.onStart(),n.customAnimate.onEnd&&n.customAnimate.onEnd()),n=n.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&i.props[t]!==void 0)return i.props[t];if(i.customAnimate){const n=i.customAnimate.getEndProps()[t];if(n!==void 0)return n}i=i.prev}return Nt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){t.props==null&&t.customAnimate==null||this.target.onStep(this,this.animate,t,e,i)}}class uk{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const ck={duration:200,easing:"cubicOut"},vl={duration:1e3,easing:"quadInOut"};var pk;(function(s){s[s.Top=1]="Top",s[s.Right=2]="Right",s[s.Bottom=4]="Bottom",s[s.Left=8]="Left",s[s.ALL=15]="ALL"})(pk||(pk={}));const pr=[!1,!1,!1,!1],jH=s=>{var t;let e=!0;if(ye(s,!0)){for(let i=0;i<4;i++)pr[i]=s,e&&(e=!((t=pr[i])!==null&&t!==void 0&&!t));e=s}else if(Array.isArray(s))for(let i=0;i<4;i++)pr[i]=!!s[i],e&&(e=!!pr[i]);else pr[0]=!1,pr[1]=!1,pr[2]=!1,pr[3]=!1;return{isFullStroke:e,stroke:pr}},cd=[0,0,0,0],Ei=s=>s?$(s)?s.length===0?0:s.length===1?s[0]:s.length===2?(cd[0]=s[0],cd[2]=s[0],cd[1]=s[1],cd[3]=s[1],cd):s:s:0,Zo=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Mp=[1,2,3,0,1,2,3,0];function c0(s,t,e,i){for(;s>=jt;)s-=jt;for(;s<0;)s+=jt;for(;s>t;)t+=jt;Zo[0].x=e,Zo[1].y=e,Zo[2].x=-e,Zo[3].y=-e;const n=Math.ceil(s/Js)%4,r=Math.ceil(t/Js)%4;if(i.add(de(s)*e,se(s)*e),i.add(de(t)*e,se(t)*e),n!==r||t-s>le){let a=!1;for(let o=0;ot.length){i=t.map(n=>{const r=new We(n.x,n.y,n.x1,n.y1);return r.defined=n.defined,r});for(let n=0;n{const r=new We(n.x,n.y,n.x1,n.y1);return r.defined=n.defined,r});for(let n=0;nzH.includes(s);function Cp(s,t){if($(s)){let e;for(let i=0;i{this.appendDuration(Date.now()-this.lastDate),t(0)},this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce((e,i)=>e+i,0)/this.durations.length,1e3/60),1e3/30)}}lm.TimeOut=1e3/60;const gk=new lm,qn=(s,t)=>ht(s)&&s[s.length-1]==="%"?t*(Number.parseFloat(s.substring(0,s.length-1))/100):s;class NH extends ms{constructor(t,e,i,n,r){super(t,e,i,n,r)}getEndProps(){return this.valid===!1?{}:{text:this.to}}onBind(){var t,e,i,n,r,a,o,l;this.fromNumber=dt((t=this.from)===null||t===void 0?void 0:t.text)?(e=this.from)===null||e===void 0?void 0:e.text:Number.parseFloat((i=this.from)===null||i===void 0?void 0:i.text),this.toNumber=dt((n=this.to)===null||n===void 0?void 0:n.text)?(r=this.to)===null||r===void 0?void 0:r.text:Number.parseFloat((a=this.to)===null||a===void 0?void 0:a.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),this.valid!==!1&&(this.decimalLength=(l=(o=this.params)===null||o===void 0?void 0:o.fixed)!==null&&l!==void 0?l:Math.max(bh(this.fromNumber),bh(this.toNumber)))}onEnd(){}onUpdate(t,e,i){this.valid!==!1&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var fk;(function(s){s[s.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",s[s.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",s[s.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",s[s.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",s[s.STROKE=4]="STROKE"})(fk||(fk={}));class VR extends ms{constructor(t,e,i,n,r){super(t,e,i,n,r),this.newPointAnimateType=(r==null?void 0:r.newPointAnimateType)==="appear"?"appear":"grow"}onBind(){var t,e;const i=(t=this.from)===null||t===void 0?void 0:t.points,n=(e=this.to)===null||e===void 0?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const r=new Map;this.fromPoints.forEach(u=>{u.context&&r.set(u.context,u)});let a,o,l=1/0,h=-1/0;for(let u=0;u=0;u-=1)if(r.has(this.toPoints[u].context)){h=u,o=r.get(this.toPoints[u].context);break}let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map((u,c)=>{const p=r.get(u.context);return p?(d=p,[p,u]):this.newPointAnimateType==="appear"?[u,u]:ch&&o?[o,u]:[d,u]}),this.points=this.interpolatePoints.map(u=>{const c=u[0],p=u[1],g=new We(c.x,c.y,c.x1,c.y1);return g.defined=p.defined,g.context=p.context,g})}onUpdate(t,e,i){this.points=this.points.map((n,r)=>{const a=zy(this.interpolatePoints[r][0],this.interpolatePoints[r][1],e);return a.context=n.context,a}),i.points=this.points}}class UR extends ms{constructor(t,e,i,n,r){super(null,null,i,n,r),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=r==null?void 0:r.group,this._clipGraphic=r==null?void 0:r.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:je.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:je.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach(r=>{n[r]=this.clipFromAttribute[r]+(this.clipToAttribute[r]-this.clipFromAttribute[r])*e}),this._clipGraphic.setAttributes(n,!1,{type:je.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class GH extends UR{constructor(t,e,i,n,r){var a,o,l,h,d,u,c,p,g,f,_,m;const v=(o=(a=r==null?void 0:r.group)===null||a===void 0?void 0:a.attribute)!==null&&o!==void 0?o:{},y=(l=v.width)!==null&&l!==void 0?l:0,b=(h=v.height)!==null&&h!==void 0?h:0,x=(d=r==null?void 0:r.animationType)!==null&&d!==void 0?d:"in",S=(u=r==null?void 0:r.startAngle)!==null&&u!==void 0?u:0,A=(c=r==null?void 0:r.orient)!==null&&c!==void 0?c:"clockwise";let k=0,w=0;A==="anticlockwise"?(w=x==="in"?S+2*Math.PI:S,w=S+2*Math.PI):(k=S,w=x==="out"?S+2*Math.PI:S);const T=et.graphicService.creator.arc({x:(g=(p=r==null?void 0:r.center)===null||p===void 0?void 0:p.x)!==null&&g!==void 0?g:y/2,y:(_=(f=r==null?void 0:r.center)===null||f===void 0?void 0:f.y)!==null&&_!==void 0?_:b/2,outerRadius:(m=r==null?void 0:r.radius)!==null&&m!==void 0?m:(y+b)/2,innerRadius:0,startAngle:k,endAngle:w,fill:!0});let M,C;A==="anticlockwise"?(M={startAngle:S+2*Math.PI},C={startAngle:S}):(M={endAngle:S},C={endAngle:S+2*Math.PI}),super(x==="in"?M:C,x==="in"?C:M,i,n,{group:r==null?void 0:r.group,clipGraphic:T})}}class _k extends UR{constructor(t,e,i,n,r){var a,o,l,h,d,u,c,p,g;const f=(o=(a=r==null?void 0:r.group)===null||a===void 0?void 0:a.attribute)!==null&&o!==void 0?o:{},_=(h=(l=r==null?void 0:r.width)!==null&&l!==void 0?l:f.width)!==null&&h!==void 0?h:0,m=(u=(d=r==null?void 0:r.height)!==null&&d!==void 0?d:f.height)!==null&&u!==void 0?u:0,v=(c=r==null?void 0:r.animationType)!==null&&c!==void 0?c:"in",y=(p=r==null?void 0:r.direction)!==null&&p!==void 0?p:"x",b=(g=r==null?void 0:r.orient)!==null&&g!==void 0?g:"positive",x=et.graphicService.creator.rect({x:0,y:0,width:v==="in"&&y==="x"?0:_,height:v==="in"&&y==="y"?0:m,fill:!0});let S={},A={};y==="y"?b==="negative"?(S={y:m,height:0},A={y:0,height:m}):(S={height:0},A={height:m}):b==="negative"?(S={x:_,width:0},A={x:0,width:_}):(S={width:0},A={width:_}),super(v==="in"?S:A,v==="in"?A:S,i,n,{group:r==null?void 0:r.group,clipGraphic:x})}}class WH extends ms{onStart(){const{center:t,r:e}=typeof this.params=="function"?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),r=this.target.getComputedAttribute("z"),a=Math.acos((n-t.y)/e);let o=Math.acos((i-t.x)/e/Math.sin(a));r-t.z<0&&(o=jt-o),this.theta=o,this.phi=a}onBind(){}onEnd(){}onUpdate(t,e,i){if(this.phi==null||this.theta==null)return;const{center:n,r,cb:a}=typeof this.params=="function"?this.params():this.params,o=2*Math.PI*e,l=this.theta+o,h=this.phi,d=r*Math.sin(h)*Math.cos(l)+n.x,u=r*Math.cos(h)+n.y,c=r*Math.sin(h)*Math.sin(l)+n.z;for(i.x=d,i.y=u,i.z=c,i.alpha=l+le/2;i.alpha>jt;)i.alpha-=jt;i.alpha=jt-i.alpha,i.zIndex=-1e4*i.z,a&&a(i)}}class VH extends ms{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class UH extends ms{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach(t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target})}getEndProps(){const t={};return this.customAnimates.forEach(e=>{Object.assign(t,e.getEndProps())}),t}onBind(){this.initAnimates(),this.customAnimates.forEach(t=>{t.onBind()})}onEnd(){this.customAnimates.forEach(t=>{t.onEnd()})}onStart(){this.customAnimates.forEach(t=>{t.onStart()})}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach(n=>{const r=n.easing;e=(typeof r=="string"?Wt[r]:r)(e),n.onUpdate(t,e,i)}),this.updating=!1)}}function mk(s,t,e,i,n,r){const a=(t-s)*n+s,o=(e-t)*n+t,l=(i-e)*n+e,h=(o-a)*n+a,d=(l-o)*n+o,u=(d-h)*n+h;r[0]=s,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=d,r[6]=l,r[7]=i}function $H(s,t){const e=s.length,i=t.length;if(e===i)return[s,t];const n=[],r=[],a=e0){const y=i/e;for(let b=-i/2;b<=i/2;b+=y){const x=Math.sin(b),S=Math.cos(b);let A=0;for(let k=0;k{gs(t,i)&&gs(e,n)||s.push(t,e,i,n,i,n)};function Hy(s){const t=s.commandList,e=[];let i,n=0,r=0,a=0,o=0;const l=(p,g)=>{i&&i.length>2&&e.push(i),i=[p,g]};let h,d,u,c;for(let p=0,g=t.length;pS:wA:O2&&e.push(i),e}function bk(s,t){for(let e=0;e2){t.moveTo(i[0],i[1]);for(let n=2;n{if(!s)return{x:0,y:0,width:0,height:0};let t=P(s.width)?s.x1-s.x:s.width,e=P(s.height)?s.y1-s.y:s.height,i=0,n=0;return t<0?(i=t,t=-t):Number.isNaN(t)&&(t=0),e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),{x:i,y:n,width:t,height:e}};function tS(s,t,e){const i=s/t;let n,r;s>=t?(r=Math.ceil(Math.sqrt(e*i)),n=Math.floor(e/r),n===0&&(n=1,r=e)):(n=Math.ceil(Math.sqrt(e/i)),r=Math.floor(e/n),r===0&&(r=1,n=e));const a=[];for(let l=0;l0)for(let l=0;l{const{width:e,height:i}=$R(s.attribute),n=tS(e,i,t),r=[],a=i/n.length;for(let o=0,l=n.length;o{const e=s.getParsedAngle(),i=e.startAngle,n=e.endAngle,r=s.getComputedAttribute("innerRadius"),a=s.getComputedAttribute("outerRadius"),o=Math.abs(i-n),l=Math.abs(a-r),h=tS(o*(r+a)/2,l,t),d=[],u=l/h.length,c=a>=r?1:-1,p=n>=i?1:-1;for(let g=0,f=h.length;g{const e=s.getComputedAttribute("startAngle"),i=s.getComputedAttribute("endAngle"),n=s.getComputedAttribute("radius"),r=Math.abs(e-i),a=tS(r*n,n,t),o=[],l=r/a[0],h=n/a.length,d=i>=e?1:-1;for(let u=0,c=a.length;u{const e=s.filter(o=>o.defined!==!1&&dt(o.x)&&dt(o.y));if(e.length===0)return[];if(e.length===1)return new Array(t).fill(0).map(o=>e[0]);const i=[];if(t<=e.length){const o=e.length/t;let l=0,h=0;for(;l{var e,i;const n=s.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce((d,u)=>{var c;return d.concat((c=u.points)!==null&&c!==void 0?c:[])},[]));const o=r.filter(d=>d.defined!==!1&&dt(d.x)&&dt(d.y));if(!o.length)return[];const l=[];o.forEach(d=>{l.push({x:d.x,y:d.y})});for(let d=o.length-1;d>=0;d--){const u=o[d];l.push({x:(e=u.x1)!==null&&e!==void 0?e:u.x,y:(i=u.y1)!==null&&i!==void 0?i:u.y})}const h=[];return Mu(r,t,h),h},iN=(s,t)=>{const e=s.attribute,i=e.points;if(i)return xk(i,t);if(e.segments){const n=e.segments.reduce((r,a)=>{var o;return r.concat((o=a.points)!==null&&o!==void 0?o:[])},[]);return xk(n,t)}return[]};function sN(s,t){return s[0]*t[1]-s[1]*t[0]}const Ny=s=>s.map(t=>({x:t.x,y:t.y})),Sk=(s,t,e)=>{const i=s.length,n=[];for(let u=0;uu.dot-c.dot);let r=n[0],a=n[n.length-1];r.edgeIndex>a.edgeIndex&&([r,a]=[a,r]);const o=r.point,l=a.point,h=[{x:o.x,y:o.y}];for(let u=r.edgeIndex+1;u<=a.edgeIndex;u++)h.push({x:s[u].x,y:s[u].y});h.push({x:l.x,y:l.y});const d=[{x:l.x,y:l.y}];for(let u=a.edgeIndex+1,c=r.edgeIndex+i;u<=c;u++){const p=s[u%i];d.push({x:p.x,y:p.y})}return d.push({x:o.x,y:o.y}),[h,d]},nN=s=>{const t=new Pi;s.forEach(r=>{t.add(r.x,r.y)});const e=t.width(),i=t.height();if(e>=i){const r=t.x1+e/2;return Sk(s,{x:r,y:t.y1},{x:r,y:t.y2})}const n=t.y1+i/2;return Sk(s,{x:t.x1,y:n},{x:t.x2,y:n})},Mu=(s,t,e)=>{if(t===1)e.push({points:s});else{const i=Math.floor(t/2),n=nN(s);Mu(n[0],i,e),Mu(n[1],t-i,e)}},rN=(s,t)=>{const e=s.attribute.points;if(!e||!e.length)return[];if(t===1)return[{points:Ny(e)}];const i=[];return Mu(e,t,i),i},aN=(s,t)=>{const e=s.getParsedPathShape(),i=Hy(e);if(!i.length||t<0)return[];const n=i.length;if(i.length>=t){const l=[],h=Math.floor(i.length/t);for(let d=0;dObject.assign(Object.assign({},c),{color:Pp(d)}))});return o?_o(h,u,e,i,n):_o(u,h,e,i,n)}if(o){if(s.gradient===t.gradient){const h=s,d=t,u=h.stops,c=d.stops;if(u.length!==c.length)return!1;if(h.gradient==="linear")return oN(h,d,e);if(h.gradient==="radial")return lN(h,d,e);if(h.gradient==="conical")return hN(h,d,e)}return!1}return n&&n(r,a),Pp(dN(r,a,e),i)}function oN(s,t,e){const i=s.stops,n=t.stops;return{gradient:"linear",x0:s.x0+(t.x0-s.x0)*e,x1:s.x1+(t.x1-s.x1)*e,y0:s.y0+(t.y0-s.y0)*e,y1:s.y1+(t.y1-s.y1)*e,stops:new Array(i.length).fill(0).map((r,a)=>({color:eS(i[a].color,n[a].color,e),offset:i[a].offset+(n[a].offset-i[a].offset)*e}))}}function lN(s,t,e){const i=s.stops,n=t.stops;return{gradient:"radial",x0:s.x0+(t.x0-s.x0)*e,x1:s.x1+(t.x1-s.x1)*e,y0:s.y0+(t.y0-s.y0)*e,y1:s.y1+(t.y1-s.y1)*e,r0:s.r0+(t.r0-s.r0)*e,r1:s.r1+(t.r1-s.r1)*e,stops:new Array(i.length).fill(0).map((r,a)=>({color:eS(i[a].color,n[a].color,e),offset:i[a].offset+(n[a].offset-i[a].offset)*e}))}}function hN(s,t,e){const i=s.stops,n=t.stops;return{gradient:"conical",startAngle:s.startAngle+(t.startAngle-s.startAngle)*e,endAngle:s.endAngle+(t.endAngle-s.endAngle)*e,x:s.x+(t.x-s.x)*e,y:s.y+(t.y-s.y)*e,stops:new Array(i.length).fill(0).map((r,a)=>({color:eS(i[a].color,n[a].color,e),offset:i[a].offset+(n[a].offset-i[a].offset)*e}))}}function dN(s,t,e){return[s[0]+(t[0]-s[0])*e,s[1]+(t[1]-s[1])*e,s[2]+(t[2]-s[2])*e,s[3]+(t[3]-s[3])*e]}const fr=[0,0,0,0],pd=[0,0,0,0];function eS(s,t,e){return Oe.Get(s,is.Color255,fr),Oe.Get(t,is.Color255,pd),`rgba(${Math.round(fr[0]+(pd[0]-fr[0])*e)},${Math.round(fr[1]+(pd[1]-fr[1])*e)},${Math.round(fr[2]+(pd[2]-fr[2])*e)},${fr[3]+(pd[3]-fr[3])*e})`}const YR=(s,t,e)=>{s.forEach(i=>{if(Number.isFinite(i.to))t[i.key]=i.from+(i.to-i.from)*e;else if(i.key==="fill"||i.key==="stroke"){const n=_o(i.from,i.to,e,!1);n&&(t[i.key]=n)}})},XR=(s,t,e)=>{const i=[],n=[];t.clear();for(let r=0;r{const i=s?Hy(s):[],n=Hy(t);e&&i&&(e.fromTransform&&bk(i,e.fromTransform.clone().getInverse()),bk(i,e.toTransfrom));const[r,a]=qH(i,n);return s?KH(r,a,10,Math.PI):a.map((o,l)=>({from:r[l],to:o,fromCp:[0,0],toCp:[0,0],rotation:0}))},uN=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],qR=(s,t)=>{if(!s||!t)return null;const e=[];let i=!1;return Object.keys(s).forEach(n=>{if(!uN.includes(n))return;const r=t[n];P(r)||P(s[n])||r===s[n]||(n==="fill"||n==="stroke"?e.push({from:typeof s[n]=="string"?Oe.Get(s[n],is.Color255):s[n],to:typeof r=="string"?Oe.Get(r,is.Color255):r,key:n}):e.push({from:s[n],to:r,key:n}),i=!0)}),i?e:null};class ZR extends ms{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,r=typeof n.pathProxy=="function"?n.pathProxy(n.attribute):n.pathProxy;XR(this.morphingData,r,e),this.otherAttrs&&this.otherAttrs.length&&YR(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const JR=(s,t,e,i)=>{var n,r,a;if(s&&(!s.valid||!s.toCustomPath))return __DEV__&&console.error(s," is not validate"),null;if(!t.valid||!t.toCustomPath)return __DEV__&&console.error(t," is not validate"),null;let o=s==null?void 0:s.globalTransMatrix;i&&o&&(o=i.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=KR((n=s==null?void 0:s.toCustomPath)===null||n===void 0?void 0:n.call(s),t.toCustomPath(),{fromTransform:o,toTransfrom:t.globalTransMatrix}),h=qR(s==null?void 0:s.attribute,t.attribute),d=t.animate(e);return e!=null&&e.delay&&d.wait(e.delay),d.play(new ZR({morphingData:l,otherAttrs:h},(r=e==null?void 0:e.duration)!==null&&r!==void 0?r:vl.duration,(a=e==null?void 0:e.easing)!==null&&a!==void 0?a:vl.easing)),d},cN=(s,t,e)=>{var i;const n=t.filter(h=>h&&h.toCustomPath&&h.valid);n.length||__DEV__&&console.error(n," is not validate"),s.valid&&s.toCustomPath||__DEV__&&console.error(s," is not validate");const r=((e==null?void 0:e.splitPath)==="clone"?tO:(i=e==null?void 0:e.splitPath)!==null&&i!==void 0?i:eO)(s,n.length,!1),a=e==null?void 0:e.onEnd;let o=n.length;const l=()=>{o--,o===0&&a&&a()};n.forEach((h,d)=>{var u;const c=r[d],p=((u=e==null?void 0:e.delay)!==null&&u!==void 0?u:0)+(e!=null&&e.individualDelay?e.individualDelay(d,n.length,c,h):0);JR(c,h,Object.assign({},e,{onEnd:l,delay:p}),s.globalTransMatrix)})};class pN extends ms{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren(t=>{t.createPathProxy()}),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren(t=>{t.pathProxy=null})}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren((n,r)=>{var a;XR(this.morphingData[r],typeof n.pathProxy=="function"?n.pathProxy(n.attribute):n.pathProxy,e),!((a=this.otherAttrs)===null||a===void 0)&&a[r]&&this.otherAttrs[r].length&&YR(this.otherAttrs[r],n.attribute,e)}),t&&(this.clearPathProxy(),this.morphingData=null)}}const iS=s=>{const t={};return Object.keys(s).forEach(e=>{HH(e)||(t[e]=s[e])}),t},QR=(s,t,e)=>{const i=iS(s.attribute),n=s.attachShadow();if(t.length)n.setTheme({[t[0].type]:i}),t.forEach(r=>{n.appendChild(r)});else{const r=s.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:i}),new Array(e).fill(0).forEach(l=>{const h=et.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(h),t.push(h)})}},tO=(s,t,e)=>{const i=[],n=e?null:iS(s.attribute),r=s.toCustomPath();for(let a=0;a{const i=[],n=e?null:iS(s.attribute);if(s.type==="rect")JH(s,t).forEach(r=>{i.push(et.graphicService.creator.rect(e?r:Object.assign({},n,r)))});else if(s.type==="arc")QH(s,t).forEach(r=>{i.push(et.graphicService.creator.arc(e?r:Object.assign({},n,r)))});else if(s.type==="circle")tN(s,t).forEach(r=>{i.push(et.graphicService.creator.arc(e?r:Object.assign({},n,r)))});else if(s.type==="line"){const r=iN(s,t),a={size:10,symbolType:"circle"};r.forEach(o=>{i.push(et.graphicService.creator.symbol(e?Object.assign({},o,a):Object.assign({},n,o,a)))})}else s.type==="polygon"?rN(s,t).forEach(r=>{i.push(et.graphicService.creator.polygon(e?r:Object.assign({},n,r)))}):s.type==="area"?eN(s,t).forEach(r=>{i.push(et.graphicService.creator.polygon(e?r:Object.assign({},n,r)))}):s.type==="path"&&aN(s,t).forEach(r=>{"path"in r?i.push(et.graphicService.creator.path(e?r:Object.assign({},n,r))):i.push(et.graphicService.creator.polygon(e?r:Object.assign({},n,r)))});return e&&QR(s,i,t),i},gN=(s,t,e)=>{var i,n,r;const a=s.filter(u=>u.toCustomPath&&u.valid);a.length||__DEV__&&console.error(s," is not validate"),t.valid&&t.toCustomPath||__DEV__&&console.error(t," is not validate");const o=((e==null?void 0:e.splitPath)==="clone"?tO:(i=e==null?void 0:e.splitPath)!==null&&i!==void 0?i:eO)(t,a.length,!0),l=t.attribute;t.setAttribute("visible",!1);const h=a.map((u,c)=>KR(u.toCustomPath(),o[c].toCustomPath(),{fromTransform:u.globalTransMatrix,toTransfrom:o[c].globalTransMatrix})),d=a.map((u,c)=>qR(u.attribute,l));if(e!=null&&e.individualDelay){const u=e.onEnd;let c=a.length;const p=()=>{c--,c===0&&(t.setAttributes({visible:!0,ratio:null},!1,{type:je.ANIMATE_END}),t.detachShadow(),u&&u())};o.forEach((g,f)=>{var _,m,v;const y=((_=e.delay)!==null&&_!==void 0?_:0)+e.individualDelay(f,a.length,s[f],g),b=g.animate(Object.assign({},e,{onEnd:p}));b.wait(y),b.play(new ZR({morphingData:h[f],saveOnEnd:!0,otherAttrs:d[f]},(m=e.duration)!==null&&m!==void 0?m:vl.duration,(v=e.easing)!==null&&v!==void 0?v:vl.easing))})}else{const u=e==null?void 0:e.onEnd,c=e?Object.assign({},e):{};c.onEnd=()=>{t.setAttribute("visible",!0,!1,{type:je.ANIMATE_END}),t.detachShadow(),u&&u()};const p=t.animate(c);e!=null&&e.delay&&p.wait(e.delay),p.play(new pN({morphingData:h,otherAttrs:d},(n=e==null?void 0:e.duration)!==null&&n!==void 0?n:vl.duration,(r=e==null?void 0:e.easing)!==null&&r!==void 0?r:vl.easing))}};class $n{static GetImage(t,e){var i;let n=$n.cache.get(t);n?n.loadState==="fail"?et.global.getRequestAnimationFrame()(()=>{e.imageLoadFail(t)}):n.loadState==="init"||n.loadState==="loading"?(i=n.waitingMark)===null||i===void 0||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},$n.cache.set(t,n),n.dataPromise=et.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then(r=>{var a;n.loadState=r!=null&&r.data?"success":"fail",n.data=r==null?void 0:r.data,(a=n.waitingMark)===null||a===void 0||a.map((o,l)=>{r!=null&&r.data?(n.loadState="success",n.data=r.data,o.imageLoadSuccess(t,r.data)):(n.loadState="fail",o.imageLoadFail(t))})})):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=$n.cache.get(t);n?n.loadState==="fail"?et.global.getRequestAnimationFrame()(()=>{e.imageLoadFail(t)}):n.loadState==="init"||n.loadState==="loading"?(i=n.waitingMark)===null||i===void 0||i.push(e):e&&et.global.getRequestAnimationFrame()(()=>{e.imageLoadSuccess(t,n.data)}):(n={type:"image",loadState:"init"},$n.cache.set(t,n),n.dataPromise=et.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then(r=>{var a;n.loadState=r!=null&&r.data?"success":"fail",n.data=r==null?void 0:r.data,(a=n.waitingMark)===null||a===void 0||a.map((o,l)=>{r!=null&&r.data?(n.loadState="success",n.data=r.data,o.imageLoadSuccess(t,r.data)):(n.loadState="fail",o.imageLoadFail(t))})})):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=$n.cache.get(t);return i?i.loadState==="init"||i.loadState==="fail"?Promise.reject():i.loadState==="loading"?i.dataPromise.then(n=>n.data):Promise.resolve(i.data):(i={type:e,loadState:"init"},$n.cache.set(t,i),e==="arrayBuffer"?i.dataPromise=et.global.loadArrayBuffer(t):e==="blob"?i.dataPromise=et.global.loadBlob(t):e==="json"&&(i.dataPromise=et.global.loadJson(t)),i.dataPromise.then(n=>n.data))}}$n.cache=new Map;const fN=new Ke,Ak=new Le,zs=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kk=["x","y"],wk=["scaleX","scaleY"],Tk=["angle"],gd=new We,Ni={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class ss extends RH{static mixin(t){const e=Object.keys(t);for(let i=0;i{this.animates.delete(e.id)}),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(et.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise"),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise"),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!P(t)||this.currentStates.includes(t))}getState(t){var e;return(e=this.states)===null||e===void 0?void 0:e[t]}applyStateAttrs(t,e,i,n){var r,a,o,l;if(i){const h=Object.keys(t),d=this.getNoWorkAnimateAttr(),u={};let c;n?h.forEach(g=>{d[g]?(c||(c={}),c[g]=t[g]):u[g]=t[g]===void 0?this.getDefaultAttribute(g):t[g]}):h.forEach(g=>{d[g]?(c||(c={}),c[g]=t[g]):u[g]=t[g]});const p=this.animate();p.stateNames=e,p.to(u,(a=(r=this.stateAnimateConfig)===null||r===void 0?void 0:r.duration)!==null&&a!==void 0?a:ck.duration,(l=(o=this.stateAnimateConfig)===null||o===void 0?void 0:o.easing)!==null&&l!==void 0?l:ck.easing),c&&this.setAttributes(c,!1,{type:je.STATE})}else this.setAttributes(t,!1,{type:je.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach(i=>{i in this.normalAttrs?(e[i]=this.normalAttrs[i],delete this.normalAttrs[i]):e[i]=this.getNormalAttribute(i)}),Object.keys(this.normalAttrs).forEach(i=>{t[i]=this.normalAttrs[i]})):Object.keys(t).forEach(i=>{e[i]=this.getNormalAttribute(i)}),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach(i=>{if(i.stateNames){const n=i.getEndProps();Zs(n,t)&&(e=n[t])}}),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter(n=>n!==t);this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||this.currentStates.length===1))return;const r=e&&(!((n=this.currentStates)===null||n===void 0)&&n.length)?this.currentStates.concat([t]):[t];this.useStates(r,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if(!(((i=this.currentStates)===null||i===void 0?void 0:i.length)!==t.length||t.some((r,a)=>this.currentStates[a]!==r)))return;const n={};t.forEach(r=>{var a;const o=this.stateProxy?this.stateProxy(r,t):(a=this.states)===null||a===void 0?void 0:a[r];o&&Object.assign(n,o)}),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=fe.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=fe.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=fe.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&fe.UPDATE_SHAPE_AND_BOUNDS)===fe.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=fe.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fe.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fe.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=fe.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=fe.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=fe.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=fe.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&fe.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],n=()=>{if(e.b)return e.b;const{scaleX:r,scaleY:a,angle:o}=this.attribute;return Ak.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Ak),this.setAttributes({scaleX:r,scaleY:a,angle:o}),e.b};if(typeof t[0]=="string"){const r=parseFloat(t[0])/100,a=n();i[0]=a.x1+(a.x2-a.x1)*r}else i[0]=t[0];if(typeof t[1]=="string"){const r=parseFloat(t[1])/100,a=n();i[1]=a.y1+(a.y2-a.y1)*r}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=vi.x,y:e=vi.y,scaleX:i=vi.scaleX,scaleY:n=vi.scaleY,angle:r=vi.angle,scaleCenter:a,anchor:o,postMatrix:l}=this.attribute;let h=[0,0];const d={};if(o&&(h=this.getAnchor(o,d)),!a||i===1&&n===1)Mj(this._transMatrix,this._transMatrix.reset(),t,e,i,n,r,o&&h);else{const c=this._transMatrix;c.reset(),c.translate(h[0],h[1]),c.rotate(r),c.translate(-h[0],-h[1]),c.translate(t,e),h=this.getAnchor(a,d),et.transformUtil.fromMatrix(c,c).scale(i,n,{x:h[0],y:h[1]})}const u=this.getOffsetXY(vi);if(this._transMatrix.e+=u.x,this._transMatrix.f+=u.y,l){const c=fN.setValue(l.a,l.b,l.c,l.d,l.e,l.f),p=this._transMatrix;c.multiply(p.a,p.b,p.c,p.d,p.e,p.f),p.setValue(c.a,c.b,c.c,c.d,c.e,c.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const i=t.getTimeline();this.animates.forEach(n=>{n.setTimeline(i)})}this._onSetStage&&this._onSetStage(this,t,e),et.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:je.ANIMATE_END})}onStep(t,e,i,n,r){const a={};if(i.customAnimate)i.customAnimate.update(r,n,a);else{const o=i.props,l=i.parsedProps,h=i.propKeys;this.stepInterpolate(t,e,a,i,n,r,o,void 0,l,h)}this.setAttributes(a,!1,{type:je.ANIMATE_UPDATE,animationState:{ratio:n,end:r,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,r,a,o,l,h,d){d||(d=Object.keys(o),n.propKeys=d),a?n.propKeys.forEach(u=>{e.validAttr(u)&&(i[u]=o[u])}):d.forEach(u=>{var c;if(!e.validAttr(u))return;const p=o[u],g=(c=l&&l[u])!==null&&c!==void 0?c:t.getLastPropByName(u,n);if(p==null||g==null)return void(i[u]=p);let f;f=e.interpolateFunc&&e.interpolateFunc(u,r,g,p,i),f||(f=e.customInterpolate(u,r,g,p,this,i),f||this.defaultInterpolate(p,g,u,i,h,r)||this._interpolate(u,r,g,p,i))}),n.parsedProps=h}defaultInterpolate(t,e,i,n,r,a){if(Number.isFinite(t))return n[i]=e+(t-e)*a,!0;if(i==="fill"){r||(r={});const o=r.fillColorArray,l=_o(e,o??t,a,!1,(h,d)=>{r.fillColorArray=d});return l&&(n[i]=l),!0}if(i==="stroke"){r||(r={});const o=r.strokeColorArray,l=_o(e,o??t,a,!1,(h,d)=>{r.strokeColorArray=d});return l&&(n[i]=l),!0}if(i==="shadowColor"){r||(r={});const o=r.shadowColorArray,l=_o(e,o??t,a,!0,(h,d)=>{r.shadowColorArray=d});return l&&(n[i]=l),!0}return!1}_interpolate(t,e,i,n,r){}getDefaultAttribute(t){return at(this)[this.type][t]}getComputedAttribute(t){var e;return(e=this.attribute[t])!==null&&e!==void 0?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=t??et.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map(t=>t.toJson())}}createPathProxy(t){return ht(t,!0)?this.pathProxy=new ai().fromString(t):this.pathProxy=new ai,this.pathProxy}loadImage(t,e=!1){if(!t||e&&_N(t))return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),typeof t=="string"?(n.state="loading",t.startsWith("{e.stop()})}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren(e=>{e.stopAnimates(t)})}release(){this.releaseStatus="released",et.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const r=new Jx(t,e);r.bubbles=!1,r.manager=(n=(i=this.stage)===null||i===void 0?void 0:i.eventSystem)===null||n===void 0?void 0:n.manager,this.dispatchEvent(r)}}}function _N(s){return!(!s.fill&&!s.stroke)}ss.mixin(IH);function mN(s,t){const e=[];let i=t.exec(s);for(;i;){const n=[];n.startIndex=t.lastIndex-i[0].length;const r=i.length;for(let a=0;a0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Mk(s,t,e,i){const n=s.indexOf(t,e);if(n===-1)throw new Error(i);return n+t.length-1}function vN(s,t,e=">"){let i,n="";for(let r=t;r"){const n=vN(s,t+1,i);if(!n)return;let r=n.data;const a=n.index,o=r.search(/\s/);let l=r,h=!0;return o!==-1&&(l=r.substr(0,o).replace(/\s\s*$/,""),r=r.substr(o+1)),{tagName:l,tagExp:r,closeIndex:a,attrExpPresent:h,rawTagName:l}}const yN=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");class bN{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const n=e.tagname;typeof n=="string"&&(e.tagname=n),t.addChild(e)}buildAttributesMap(t,e,i){const n={};if(!t)return;const r=mN(t,yN),a=r.length;for(let o=0;o",a,"Closing Tag is not closed."),l=r.lastIndexOf(".");r=r.substring(0,l),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",a=o}else if(t[a+1]==="?")a=Ck(t,a,!1,"?>").closeIndex+1;else if(t.substr(a+1,3)==="!--")a=Mk(t,"-->",a+4,"Comment is not closed.");else{const o=Ck(t,a);let l=o.tagName,h=o.tagExp;const d=o.attrExpPresent,u=o.closeIndex;if(l!==e.tagname&&(r+=r?"."+l:l),h.length>0&&h.lastIndexOf("/")===h.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),h=l):h=h.substr(0,h.length-1);const c=new p0(l);l!==h&&d&&(c[":@"]=this.buildAttributesMap(h,r,l)),this.addChild(i,c,r),r=r.substr(0,r.lastIndexOf("."))}else{const c=new p0(l);this.tagsNodeStack.push(i),l!==h&&d&&(c[":@"]=this.buildAttributesMap(h,r,l)),this.addChild(i,c,r),i=c}n="",a=u}else n+=t[a];return e.child}}function xN(s,t){return iO(s)}function iO(s,t){const e={};for(let i=0;i{et.global.getRequestAnimationFrame()(()=>{i(null)})}),e.forEach(i=>{i.subLayers.size&&i.subLayers.forEach(n=>{n.drawContribution&&n.drawContribution.hooks&&n.drawContribution.rendering&&t.push(new Promise(r=>{n.drawContribution.hooks.completeDraw.tap("outWait",()=>{n.drawContribution.hooks.completeDraw.taps=n.drawContribution.hooks.completeDraw.taps.filter(a=>a.name!=="outWait"),r(null)})}))})}),yield Promise.all(t)})}function cg(s,t,e,i=0){return s.expand(t+(i/2+(e?CN(e,t):0))),s}function CN(s,t){return s?t:0}let PN=0;function ns(){return PN++}var mo;(function(s){s[s.HORIZONTAL=0]="HORIZONTAL",s[s.VERTICAL=1]="VERTICAL"})(mo||(mo={}));function Pk(s){const t=[];let e=0,i="";for(let n=0;nsO.set(s,!0));const RN=[""],nO=new Map;function ON(s){if(sO.has(s))return!0;if(nO.has(s))return!1;let t=!1;return s.codePointAt(0)<256&&(t=!0),t}RN.forEach(s=>nO.set(s,!0));const dm=ns(),Tc=ns(),Mc=ns(),um=ns(),cm=ns(),sS=ns(),pm=ns(),Cc=ns(),gm=ns(),fm=ns(),nS=ns(),_m=ns(),rS=ns(),aS=ns(),mm=ns(),vm=ns(),rO=Symbol.for("GraphicService"),aO=Symbol.for("GraphicCreator"),oO={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},IN=Object.keys(oO);var Ek;(function(s){s[s.LESS_GROUP=0]="LESS_GROUP",s[s.MORE_GROUP=1]="MORE_GROUP"})(Ek||(Ek={}));let Kh=class Gy extends ss{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=sS,this._childUpdateTag=fe.UPDATE_BOUNDS}setMode(t){t==="3d"?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Tu),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Tu)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren(t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)})}showAll(){this.setAttribute("visible",!0),this.forEachChildren(t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)})}containsPoint(t,e,i){if(i===ku.GLOBAL){const n=new We(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(n,n),this.AABBBounds.contains(n.x,n.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&fe.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;et.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),et.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=vi.x,y:e=vi.y,dx:i=vi.dx,dy:n=vi.dy,scaleX:r=vi.scaleX,scaleY:a=vi.scaleY,angle:o=vi.angle,postMatrix:l}=this.attribute;if(t!==0||e!==0||i!==0||n!==0||r!==1||a!==1||o!==0||l)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=at(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=et.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,r=Ei(n);return r&&i.expand(r),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=fe.CLEAR_BOUNDS,this._childUpdateTag&=fe.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=fe.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&fe.UPDATE_BOUNDS||(this._childUpdateTag|=fe.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),et.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),et.graphicService.onClearIncremental(this,this.stage)}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,et.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren(t=>{et.graphicService.onRemove(t)}),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),et.graphicService.onSetStage(this,t),this.forEachChildren(i=>{i.setStage(t,this.layer)}))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren(t=>{t.isContainer&&t.addUpdateGlobalPositionTag()})}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren(t=>{t.isContainer&&t.addUpdateGlobalPositionTag()})}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const e=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&fe.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find(i=>i.name===t,e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=et.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Gy(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gy.NOWORK_ANIMATE_ATTR}};Kh.NOWORK_ANIMATE_ATTR=Ni;function oS(s){return new Kh(s)}class LN extends Kh{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var r;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:(r=n.zIndex)!==null&&r!==void 0?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new Tu,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort((i,n)=>i.zIndex-n.zIndex);this.layerHandler.merge(e.map(i=>(i.layer.subLayers.size&&i.layer.combineSubLayer(t),i.layer.getNativeHandler()))),t&&e.forEach(i=>{i.group&&(i.group.incremental=0)}),e.forEach(i=>{et.layerService.releaseLayer(this.stage,i.layer)}),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach(i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)})}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:(i=t.background)!==null&&i!==void 0?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach(r=>r(this)),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i,n,r;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:(i=e.background)!==null&&i!==void 0?i:this.background,renderService:e.renderService,x:(n=e.x)!==null&&n!==void 0?n:this.stage.x,y:(r=e.y)!==null&&r!==void 0?r:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach(a=>a(this)))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach(t=>{et.layerService.releaseLayer(this.stage,t.layer)})}drawTo(t,e){var i,n,r;this.layerHandler.drawTo(t,[this],Object.assign({background:(i=e.background)!==null&&i!==void 0?i:this.background,renderService:e.renderService,x:(n=e.x)!==null&&n!==void 0?n:this.stage.x,y:(r=e.y)!==null&&r!==void 0?r:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach(a=>a(this))}}const lO=Symbol.for("TransformUtil"),hO=Symbol.for("GraphicUtil"),lS=Symbol.for("LayerService"),dO=Symbol.for("StaticLayerHandlerContribution"),uO=Symbol.for("DynamicLayerHandlerContribution"),cO=Symbol.for("VirtualLayerHandlerContribution");var Bd,BN=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},DN=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Dd=Bd=class{static GenerateLayerId(){return`${Bd.idprefix}_${Bd.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=et.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(s){return this.layerMap.get(s)}getRecommendedLayerType(s){return s||(this.staticLayerCountInEnv!==0?"static":this.dynamicLayerCountInEnv!==0?"dynamic":"virtual")}getLayerHandler(s){let t;return t=s==="static"?Pt.get(dO):s==="dynamic"?Pt.get(uO):Pt.get(cO),t}createLayer(s,t={main:!1}){var e;this.tryInit();let i=this.getRecommendedLayerType(t.layerMode);i=t.main||t.canvasId?"static":i;const n=this.getLayerHandler(i),r=new LN(s,this.global,s.window,Object.assign(Object.assign({main:!1},t),{layerMode:i,canvasId:(e=t.canvasId)!==null&&e!==void 0?e:Bd.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(s)||[];return a.push(r),this.layerMap.set(s,a),this.staticLayerCountInEnv--,r}prepareStageLayer(s){let t;s.forEachChildren(e=>{const i=e.getNativeHandler();i.type==="virtual"?(i.mainHandler=t,t.secondaryHandlers.push(i)):(t=i,t.secondaryHandlers=[])})}releaseLayer(s,t){t.release();const e=this.layerMap.get(s)||[];this.layerMap.set(s,e.filter(i=>i!==t))}layerCount(s){return(this.layerMap.get(s)||[]).length}restLayerCount(s){return this.global.env==="browser"?10:0}};Dd.idprefix="visactor_layer",Dd.prefix_count=0,Dd=Bd=BN([ft(),DN("design:paramtypes",[])],Dd);const FN=new Et(s=>{s(Xx).to(My).inSingletonScope(),s(Ng).to(Dy),s(hO).to(Fy).inSingletonScope(),s(lO).to(jy).inSingletonScope(),s(lS).to(Dd).inSingletonScope()});function zo(s,t){return!(!s&&!t)}function qh(s,t){let e;return e=$(s)?s.some(i=>i||i===void 0):!!s,e&&t>0}function To(s,t,e){return e&&s*t>0}function hS(s,t,e,i,n){return n&&s*t>0&&e!==0&&i!==0}function dS(s,t){return s*t>0}function uS(s,t,e,i){return s*t>0&&e!==0&&i!==0}function jN(s,t,e,i,n,r,a,o){if(!s.pathProxy)return!1;const l=at(s,r==null?void 0:r.theme)[s.type],{fill:h=l.fill,stroke:d=l.stroke,opacity:u=l.opacity,fillOpacity:c=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible}=s.attribute,_=To(u,c,h),m=dS(u,g),v=zo(h),y=qh(d,p);if(!f||!v&&!y||!(_||m||a||o))return!0;t.beginPath();const b=typeof s.pathProxy=="function"?s.pathProxy(s.attribute):s.pathProxy;return Cr(b.commandList,t,e,i),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),y&&m&&(t.setStrokeStyle(s,s.attribute,e,i,l),t.stroke()),v&&_&&(t.setCommonStyle(s,s.attribute,e,i,l),t.fill()),!0}function pO(s,t,e,i,n,r,a,o){const l=e-s,h=i-t,d=a-n,u=o-r;let c=u*l-d*h;return c*cI*I+O*O&&(k=T,w=M),{cx:k,cy:w,x01:-d,y01:-u,x11:k*(n/x-1),y11:w*(n/x-1)}}function $g(s,t,e,i,n,r,a){const{startAngle:o,endAngle:l}=s.getParsedAngle(),h=Kt(l-o),d=l>o;let u=!1;if(n=jt-re)t.moveTo(e+n*de(o),i+n*se(o)),t.arc(e,i,n,o,l,!d),r>re&&(t.moveTo(e+r*de(l),i+r*se(l)),t.arc(e,i,r,l,o,d));else{const c=s.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:_,innerEndAngle:m,innerStartAngle:v}=s.getParsePadAngle(o,l),y=c,b=c,x=c,S=c,A=Math.max(b,y),k=Math.max(x,S);let w=A,T=k;const M=n*de(f),C=n*se(f),R=r*de(m),I=r*se(m);let O,L,D,j;if((k>re||A>re)&&(O=n*de(_),L=n*se(_),D=r*de(v),j=r*se(v),hre){const H=Ci(y,w),W=Ci(b,w),V=pa(D,j,M,C,n,H,Number(d)),X=pa(O,L,R,I,n,W,Number(d));w0&&t.arc(e+V.cx,i+V.cy,H,he(V.y01,V.x01),he(V.y11,V.x11),!d),t.arc(e,i,n,he(V.cy+V.y11,V.cx+V.x11),he(X.cy+X.y11,X.cx+X.x11),!d),W>0&&t.arc(e+X.cx,i+X.cy,W,he(X.y11,X.x11),he(X.y01,X.x01),!d)):W>0?t.moveTo(e+X.cx+W*de(he(X.y01,X.x01)),i+X.cy+W*se(he(X.y01,X.x01))):t.moveTo(e+O,i+n*se(_))}else!a||a[0]?(t.moveTo(e+M,i+C),t.arc(e,i,n,f,_,!d)):t.moveTo(e+n*de(_),i+n*se(_));if(!(r>re)||g<.001)!a||a[1]?t.lineTo(e+R,i+I):t.moveTo(e+R,i+I),u=!0;else if(T>re){const H=Ci(S,T),W=Ci(x,T),V=pa(R,I,O,L,r,-W,Number(d)),X=pa(M,C,D,j,r,-H,Number(d));if(!a||a[1]?t.lineTo(e+V.cx+V.x01,i+V.cy+V.y01):t.moveTo(e+V.cx+V.x01,i+V.cy+V.y01),T0&&t.arc(e+V.cx,i+V.cy,W,he(V.y01,V.x01),he(V.y11,V.x11),!d),t.arc(e,i,r,he(V.cy+V.y11,V.cx+V.x11),he(X.cy+X.y11,X.cx+X.x11),d),H>0&&t.arc(e+X.cx,i+X.cy,H,he(X.y11,X.x11),he(X.y01,X.x01),!d)):H>0?t.moveTo(e+X.cx+H*de(he(X.y01,X.x01)),i+X.cy+H*se(he(X.y01,X.x01))):t.moveTo(e+D,i+j)}else!a||a[1]?t.lineTo(e+R,i+I):t.moveTo(e+R,i+I),!a||a[2]?t.arc(e,i,r,m,v,d):t.moveTo(e+r*de(v),i+r*se(v))}return a?a[3]&&t.lineTo(e+n*de(o),i+n*se(o)):t.closePath(),u}class Ks{static GetCanvas(){try{return Ks.canvas||(Ks.canvas=et.global.createCanvas({})),Ks.canvas}catch{return null}}static GetCtx(){if(!Ks.ctx){const t=Ks.GetCanvas();Ks.ctx=t.getContext("2d")}return Ks.ctx}}class uo extends Cj{static getInstance(){return uo._instance||(uo._instance=new uo),uo._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Ks.GetCanvas(),n=Ks.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const r=n.createLinearGradient(0,0,e,0);t.forEach(a=>{r.addColorStop(a[0],a[1])}),n.fillStyle=r,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,n,r=[],a=100){let o=`${t}${e}${i}${n}`;r.forEach(h=>o+=h.join()),o+=a;let l=this.dataMap.get(o);return l||(l={data:new uo(r,a),timestamp:[]},this.addLimitedTimestamp(l,Date.now(),{}),this.dataMap.set(o,l)),this.clearCache(this.dataMap,this.cacheParams),l.data}}class Yi{static GetSize(t){for(let e=0;e=t)return Yi.ImageSize[e];return t}static Get(t,e,i,n,r,a,o){const l=Yi.GenKey(t,e,i,n,r),h=Yi.cache[l];if(!h||h.length===0)return null;for(let d=0;d=a&&h[d].height>=o)return h[d].pattern;return null}static Set(t,e,i,n,r,a,o,l){const h=Yi.GenKey(t,e,i,n,r);Yi.cache[h]?Yi.cache[h].push({width:o,height:l,pattern:a}):Yi.cache[h]=[{width:o,height:l,pattern:a}]}static GenKey(t,e,i,n,r){return`${e},${i},${n},${r},${t.join()}`}}Yi.cache={},Yi.ImageSize=[20,40,80,160,320,640,1280,2560];function zN(s,t,e,i){const{stops:n,startAngle:r,endAngle:a}=i;for(;e<0;)e+=jt;for(;e>jt;)e-=jt;if(ea)return n[0].color;let o,l,h=(e-r)/(a-r);for(let d=0;d=h){o=n[d-1],l=n[d];break}return h=(h-o.offset)/(l.offset-o.offset),_o(o.color,l.color,h,!1)}function HN(s,t,e,i,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),d=Ks.GetCanvas(),u=Ks.GetCtx();if(!u)return null;const c=Yi.GetSize(o),p=Yi.GetSize(l);let g=Yi.Get(t,e,i,r,a,c,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(e,2)+Math.pow(i,2),Math.pow(c-e,2)+Math.pow(i,2)),Math.max(Math.pow(c-e,2)+Math.pow(p-i,2),Math.pow(e,2)+Math.pow(p-i,2)))),_=h+1,m=n/Math.max(1,_-1),v=uo.getInstance().GetOrCreate(e,i,c,p,t,_),y=2*Math.PI*f/360;d.width=c,d.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,c,p),u.translate(e,i),u.rotate(r);for(let x=0,S=_-1;xa);x++){const A=v.getColor(x);u.beginPath(),u.rotate(m),u.moveTo(0,0),u.lineTo(f,-2*y),u.lineTo(f,0),u.fillStyle=A,u.closePath(),u.fill()}const b=u.getImageData(0,0,c,p);return d.width=b.width,d.height=b.height,u.putImageData(b,0,0),g=s.createPattern(d,"no-repeat"),g&&Yi.Set(t,e,i,r,a,g,c,p),g}const Wy=Symbol.for("ArcRenderContribution"),Vy=Symbol.for("AreaRenderContribution"),Uy=Symbol.for("CircleRenderContribution"),gO=Symbol.for("GroupRenderContribution"),$y=Symbol.for("ImageRenderContribution"),Yy=Symbol.for("PathRenderContribution"),Xy=Symbol.for("PolygonRenderContribution"),Fd=Symbol.for("RectRenderContribution"),Ky=Symbol.for("SymbolRenderContribution"),qy=Symbol.for("TextRenderContribution"),cS=Symbol.for("InteractiveSubRenderContribution"),Rk=["radius","startAngle","endAngle",...zs];class Cu extends ss{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=um}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=at(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=et.graphicService.updateCircleAABBBounds(i,at(this).circle,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,a=Ei(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return at(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,Rk)}needUpdateTag(t){return super.needUpdateTag(t,Rk)}toCustomPath(){var t,e,i;const n=this.attribute,r=(t=n.radius)!==null&&t!==void 0?t:this.getDefaultAttribute("radius"),a=(e=n.startAngle)!==null&&e!==void 0?e:this.getDefaultAttribute("startAngle"),o=(i=n.endAngle)!==null&&i!==void 0?i:this.getDefaultAttribute("endAngle"),l=new ai;return l.arc(0,0,r,a,o),l}clone(){return new Cu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Cu.NOWORK_ANIMATE_ATTR}}Cu.NOWORK_ANIMATE_ATTR=Ni;function NN(s){return new Cu(s)}function Zy(s,t={},e){e||(e=1);const{fontStyle:i=t.fontStyle,fontVariant:n=t.fontVariant,fontWeight:r=t.fontWeight,fontSize:a=t.fontSize,fontFamily:o=t.fontFamily}=s;return(i?i+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*e+"px "+(o||"sans-serif")}function Sr(s,t){return s==="end"||s==="right"?-t:s==="center"?-t/2:0}function Ar(s,t,e,i=0){return s==="middle"?-t/2:s==="top"?0:s==="bottom"?i-t:s&&s!=="alphabetic"?0:(e||(e=t),-(t-e)/2-.79*e)}class Jy{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if(e==="left"||e==="start")t.xOffset=0;else if(e==="center")t.xOffset=t.width/-2;else{if(e!=="right"&&e!=="end")throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset=i==="top"?0:i==="middle"?t.height/-2:i==="alphabetic"?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,r,a,o,l,h){const d=[],u=[e,i],c=[0,0];for(;t.length>0;){const{str:g}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,o,l,h);d.push({str:g,width:this.textMeasure.measureTextWidth(g,this.textOptions)}),t=t.substring(g.length)}n==="left"||n==="start"||(n==="center"?c[0]=u[0]/-2:n!=="right"&&n!=="end"||(c[0]=-u[0])),r==="top"||(r==="middle"?c[1]=u[1]/-2:r==="bottom"&&(c[1]=-u[1]));const p={xOffset:c[0],yOffset:c[1],width:u[0],height:u[1]};return this.layoutWithBBox(p,d,n,r,a)}GetLayoutByLines(t,e,i,n,r="",a,o,l="end"){t=t.map(c=>c.toString());const h=[],d=[0,0];if(typeof o=="number"&&o!==1/0){let c;for(let p=0,g=t.length;pMath.max(c,p.width),0);const u={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(u,e,i),this.layoutWithBBox(u,h,e,i,n)}layoutWithBBox(t,e,i,n,r){const a=[0,0],o=e.length*r;n==="top"||(n==="middle"?a[1]=(t.height-o)/2:n==="bottom"&&(a[1]=t.height-o));for(let l=0;ln.text).join("")!==e.text.toString():this.clipedText!=null&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&this.attribute.direction!=="vertical"}get isMultiLine(){return Array.isArray(this.attribute.text)||this.attribute.whiteSpace==="normal"}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=vm,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return $(t)?!t.every(e=>e==null||e===""):t!=null&&t!==""}doUpdateAABBBounds(){const t=at(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,n,r;const a=at(this).text,{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:c,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:_=a.fontWeight,ignoreBuf:m=a.ignoreBuf,suffixPosition:v=a.suffixPosition,heightLimit:y=0,lineClamp:b}=this.attribute,x=(e=qn(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))!==null&&e!==void 0?e:this.attribute.fontSize||a.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const O=this.cache.layoutData.bbox;return this._AABBBounds.set(O.xOffset,O.yOffset,O.xOffset+O.width,O.yOffset+O.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=et.graphicUtil.textMeasure,k=new Jy(o,{fontSize:d,fontWeight:_,fontFamily:o},A),w=$(t)?t.map(O=>O.toString()):[t.toString()],T=[],M=[0,0];let C=1/0;if(y>0&&(C=Math.max(Math.floor(y/x),1)),b&&(C=Math.min(C,b)),typeof c=="number"&&c!==1/0){if(c>0)for(let L=0;L{O=Math.max(O,L.width)}),M[0]=O}else{let O,L,D=0;for(let j=0,H=w.length;j{const M=T.direction===mo.HORIZONTAL?p:a.measureTextWidth(T.text,{fontSize:p,fontWeight:g,fontFamily:f});o+=M,T.width=M}),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=Sr(x,o),w=Ar(S,b,p);return this._AABBBounds.set(w,k,w+b,k+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const n=at(this).text,{wrap:r=n.wrap}=this.attribute;if(r)return this.updateWrapAABBBounds(t);const a=this.attribute,{fontFamily:o=n.fontFamily,textAlign:l=n.textAlign,textBaseline:h=n.textBaseline,fontSize:d=n.fontSize,fontWeight:u=n.fontWeight,ellipsis:c=n.ellipsis,maxLineWidth:p,stroke:g=n.stroke,lineWidth:f=n.lineWidth,whiteSpace:_=n.whiteSpace,suffixPosition:m=n.suffixPosition}=a,v=(e=qn(a.lineHeight,a.fontSize||n.fontSize))!==null&&e!==void 0?e:a.fontSize||n.fontSize;if(_==="normal")return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const S=this.cache.layoutData.bbox;return this._AABBBounds.set(S.xOffset,S.yOffset,S.xOffset+S.width,S.yOffset+S.height),g&&this._AABBBounds.expand(f/2),this._AABBBounds}const y=et.graphicUtil.textMeasure,b=new Jy(o,{fontSize:d,fontWeight:u,fontFamily:o},y).GetLayoutByLines(t,l,h,v,c===!0?n.ellipsis:c||void 0,!1,p,m),{bbox:x}=b;return this.cache.layoutData=b,this.clearUpdateShapeTag(),this._AABBBounds.set(x.xOffset,x.yOffset,x.xOffset+x.width,x.yOffset+x.height),g&&this._AABBBounds.expand(f/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,i,n;const r=at(this).text,a=et.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,d=h?0:2,{maxLineWidth:u=r.maxLineWidth,ellipsis:c=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:f=r.fontWeight,stroke:_=r.stroke,lineWidth:m=r.lineWidth,verticalMode:v=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=(e=qn(l.lineHeight,l.fontSize||r.fontSize))!==null&&e!==void 0?e:(l.fontSize||r.fontSize)+d;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!v){const M=x;x=(i=vr.baselineMapAlign[S])!==null&&i!==void 0?i:"left",S=(n=vr.alignMapBaseline[M])!==null&&n!==void 0?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach(I=>{const O=I.reduce((L,D)=>L+D.width,0);o=ps(O,o)});const M=Sr(x,o),C=this.cache.verticalList.length*b,R=Ar(S,C,g);return this._AABBBounds.set(R,M,R+C,M+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}const A=t.map(M=>Pk(M.toString()));A.forEach((M,C)=>{if(Number.isFinite(u))if(c){const R=c===!0?r.ellipsis:c,I=a.clipTextWithSuffixVertical(M,{fontSize:g,fontWeight:f,fontFamily:p},u,R,!1,y);A[C]=I.verticalList,o=I.width}else{const R=a.clipTextVertical(M,{fontSize:g,fontWeight:f,fontFamily:p},u,!1);A[C]=R.verticalList,o=R.width}else o=0,M.forEach(R=>{const I=R.direction===mo.HORIZONTAL?g:a.measureTextWidth(R.text,{fontSize:g,fontWeight:f,fontFamily:p});o+=I,R.width=I})}),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach(M=>{const C=M.reduce((R,I)=>R+I.width,0);o=ps(C,o)});const k=Sr(x,o),w=this.cache.verticalList.length*b,T=Ar(S,w,g);return this._AABBBounds.set(T,k,T+w,k+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return at(this).text[t]}needUpdateTags(t,e=Ok){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Ok){return super.needUpdateTag(t,e)}clone(){return new vr(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vr.NOWORK_ANIMATE_ATTR}};qd.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ni),qd.baselineMapAlign={top:"left",bottom:"right",middle:"center"},qd.alignMapBaseline={left:"top",right:"bottom",center:"middle"};function Mo(s){return new qd(s)}const Ep=["heightLimit","lineClamp"];class pS extends qd{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return $(t)?!t.every(e=>e==null||e===""):t!=null&&t!==""}updateMultilineAABBBounds(t){var e,i,n,r;const a=at(this).text,{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:c,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:_=a.fontWeight,ignoreBuf:m=a.ignoreBuf,heightLimit:v=0,suffixPosition:y=a.suffixPosition,lineClamp:b}=this.attribute,x=(e=qn(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))!==null&&e!==void 0?e:this.attribute.fontSize||a.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const O=this.cache.layoutData.bbox;return this._AABBBounds.set(O.xOffset,O.yOffset,O.xOffset+O.width,O.yOffset+O.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=et.graphicUtil.textMeasure,k=new Jy(o,{fontSize:d,fontWeight:_,fontFamily:o},A),w=t.map(O=>O.toString()),T=[],M=[0,0];let C=1/0;if(v>0&&(C=Math.max(Math.floor(v/x),1)),b&&(C=Math.min(C,b)),typeof c=="number"&&c!==1/0){if(c>0)for(let L=0;L{O=Math.max(O,L.width)}),M[0]=O}else{let O,L,D=0;for(let j=0,H=w.length;j{t.beginPath(),Cr(l.path.commandList,t,i,n,e,e),o&&o(l.path,l.attribute)}),!1):(Cr(this.path.commandList,t,i,n,e+r,e+r),!1)}draw(t,e,i,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach(o=>{t.beginPath(),Cr(o.path.commandList,t,i,n,e,e),a&&a(o.path,o.attribute)}),!1):(Cr(this.path.commandList,t,i,n,e,e),!1)}bounds(t,e){if(this.isSvg)return this.svgCache?(e.clear(),void this.svgCache.forEach(({path:i})=>{fd.x1=i.bounds.x1*t,fd.y1=i.bounds.y1*t,fd.x2=i.bounds.x2*t,fd.y2=i.bounds.y2*t,e.union(fd)})):void 0;this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const YG=[VN,XN,qN,JN,EG,sG,oG,dG,cG,gG,_G,bG,kG,eG,CG,OG,LG,DG,jG,$G,HG,GG,VG],Yg={};YG.forEach(s=>{Yg[s.type]=s});const XG={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},Rp=new Le,Jk=["symbolType","size",...zs];let Pu=class ll extends ss{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=mm}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return $(t)?t.length===2&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const t=at(this).symbol;let{symbolType:e=t.symbolType}=this.attribute,i=Yg[e];if(i)return this._parsedPath=i,i;if(i=ll.userSymbolMap[e],i)return this._parsedPath=i,i;if(e=XG[e]||e,wN(e)===!0){const l=new hm,{svg:h}=l.parse(e);if(!h)return null;const d=$(h.path)?h.path:[h.path];Rp.clear();const u=[];d.forEach(f=>{const _=new ai().fromString(f.d),m={};IN.forEach(v=>{f[v]&&(m[oO[v]]=f[v])}),u.push({path:_,attribute:m}),Rp.union(_.bounds)});const c=Rp.width(),p=Rp.height(),g=1/ps(c,p);return u.forEach(f=>f.path.transform(0,0,g,g)),this._parsedPath=new Zk(e,u,!0),ll.userSymbolMap[e]=this._parsedPath,this._parsedPath}const n=new ai().fromString(e),r=n.bounds.width(),a=n.bounds.height(),o=1/ps(r,a);return n.transform(0,0,o,o),this._parsedPath=new Zk(e,n),ll.userSymbolMap[e]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=at(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=et.graphicService.updateSymbolAABBBounds(i,at(this).symbol,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,a=Ei(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return at(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,Jk)}needUpdateTag(t){return super.needUpdateTag(t,Jk)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=$(e)?e:[e,e];return t.path?new ai().fromCustomPath2D(t.path,0,0,i[0],i[1]):new ai().fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new ll(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ll.NOWORK_ANIMATE_ATTR}};Pu.userSymbolMap={},Pu.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ni);function ym(s){return new Pu(s)}const Qk=["segments","points","curveType",...zs];let _O=class tb extends ss{constructor(t={}){super(t),this.type="line",this.numberType=Cc}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?e.length!==0:!!t&&!(t.length<=1)}_interpolate(t,e,i,n,r){t==="points"&&(r.points=Qx(i,n,e))}doUpdateAABBBounds(){const t=at(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updateLineAABBBounds(e,at(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return at(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,Qk)}needUpdateTag(t){return super.needUpdateTag(t,Qk)}toCustomPath(){const t=this.attribute,e=new ai,i=t.segments,n=r=>{if(r&&r.length){let a=!0;r.forEach(o=>{o.defined!==!1&&(a?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y),a=!1)})}};return i&&i.length?i.forEach(r=>{n(r.points)}):t.points&&n(t.points),e}clone(){return new tb(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tb.NOWORK_ANIMATE_ATTR}};_O.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ni);function fS(s){return new _O(s)}const tw=["width","x1","y1","height","cornerRadius",...zs];class Mh extends ss{constructor(t){super(t),this.type="rect",this.numberType=_m}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=at(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updateRectAABBBounds(e,at(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return at(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,tw)}needUpdateTag(t){return super.needUpdateTag(t,tw)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:r}=$R(t),a=new ai;return a.moveTo(e,i),a.rect(e,i,n,r),a}clone(){return new Mh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mh.NOWORK_ANIMATE_ATTR}}Mh.NOWORK_ANIMATE_ATTR=Ni;function Ch(s){return new Mh(s)}const ew=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class bm extends Mh{constructor(t){super(t),this.type="rect3d",this.numberType=rS}findFace(){const t={polygons:[],vertices:[],edges:[]},e=at(this).rect3d,{x1:i,y1:n,x:r,y:a,length:o=Ci(e.width,e.height)}=this.attribute;let{width:l,height:h}=this.attribute;l=l??i-r,h=h??n-a;for(let d=0;d{e.glyphHost=this,Object.setPrototypeOf(e.attribute,this.attribute)}),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach(t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})})}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach(r=>{r.addUpdateShapeAndBoundsTag(),r.addUpdatePositionTag()})}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach(n=>{n.addUpdateShapeAndBoundsTag(),n.addUpdatePositionTag()})}translate(t,e){return super.translate(t,e),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach(n=>{n.addUpdatePositionTag(),n.addUpdateBoundTag()}),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}rotate(t){return super.rotate(t),this.subGraphic.forEach(e=>{e.addUpdatePositionTag(),e.addUpdateBoundTag()}),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach(e=>{e.addUpdatePositionTag(),e.addUpdateBoundTag()}),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=et.graphicService.updateGlyphAABBBounds(this.attribute,at(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if(!(((i=this.currentStates)===null||i===void 0?void 0:i.length)!==t.length||t.some((a,o)=>this.currentStates[o]!==a)))return;const n={},r=this.subGraphic.map(()=>({}));t.forEach(a=>{var o;const l=this.glyphStateProxy?this.glyphStateProxy(a,t):this.glyphStates[a];l&&(Object.assign(n,l.attributes),!((o=l.subAttributes)===null||o===void 0)&&o.length&&r.forEach((h,d)=>{Object.assign(h,l.subAttributes[d])}))}),this.subGraphic.forEach((a,o)=>{a.updateNormalAttrs(r[o]),a.applyStateAttrs(r[o],t,e)}),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach(e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null}),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new Eu(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map(e=>e.clone())),t}getNoWorkAnimateAttr(){return Eu.NOWORK_ANIMATE_ATTR}}Eu.NOWORK_ANIMATE_ATTR=Ni;function vO(s){return new Eu(s)}class KG{constructor(t,e,i,n,r,a,o,l,h,d,u,c,p,g){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=r,this.wordBreak=a,this.verticalDirection=o,this.lines=[],this.globalAlign=l,this.globalBaseline=h,this.layoutDirection=d,this.directionKey=qx[this.layoutDirection],this.isWidthMax=u,this.isHeightMax=c,this.singleLine=p,g?(g.clear(),this.icons=g):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),r=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let a=this.isHeightMax?Math.min(this.height,n):this.height||n||0;a=Math.min(a,n);let o=0;switch(this.globalBaseline){case"top":o=0;break;case"middle":o=-a/2;break;case"bottom":o=-a}let l=0;switch(this.globalAlign){case"left":l=0;break;case"center":l=-r/2;break;case"right":l=-r}let h=this[this.directionKey.height];this.singleLine&&(h=this.lines[0].height+1);let d=!1;if(this.verticalDirection==="middle")if(this.actualHeight>=h&&h!==0)for(let u=0;uthis[this.directionKey.top]+h)return d;let g=!1;this.ellipsis&&this.lines[u+1]&&this.lines[u+1].top+this.lines[u+1].height>this[this.directionKey.top]+h&&(g=!0,d=!0),this.lines[u].draw(t,g,this.lines[u][this.directionKey.left]+l,this.lines[u][this.directionKey.top]+o,e)}else{const u=Math.floor((h-this.actualHeight)/2);this.layoutDirection==="vertical"?l+=u:o+=u;for(let c=0;cthis[this.directionKey.top]+h||gthis[this.directionKey.top]+h)return d;{let g=!1;this.ellipsis&&this.lines[u+1]&&this.lines[u+1].top+this.lines[u+1].height>this[this.directionKey.top]+h&&(g=!0,d=!0),this.lines[u].draw(t,g,this.lines[u][this.directionKey.left]+l,this.lines[u][this.directionKey.top]+o,e)}}}}return d}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:this.layoutDirection==="vertical"?e:t,height:this.layoutDirection==="vertical"?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let r=this[this.directionKey.height];if(this.singleLine&&(r=this.lines[0].height+1),this.verticalDirection==="middle")if(this.actualHeight>=r&&r!==0)for(let a=0;athis[this.directionKey.top]+r))if(this.ellipsis&&this.lines[a+1]&&this.lines[a+1].top+this.lines[a+1].height>this[this.directionKey.top]+r){const h=this.lines[a].getWidthWithEllips();h>t&&(t=h),e+=this.lines[a].height}else this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height}else{Math.floor((r-this.actualHeight)/2);for(let a=0;at&&(t=this.lines[a].actualWidth),e+=this.lines[a].height}else if(this.verticalDirection==="bottom")for(let a=0;at&&(t=this.lines[a].actualWidth),e+=this.lines[a].height;else if(!(h+l>this[this.directionKey.top]+r||ht&&(t=d),e+=this.lines[a].height}else this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height}else for(let a=0;at&&(t=this.lines[a].actualWidth),e+=this.lines[a].height;else if(!(o+lthis[this.directionKey.top]+r))if(this.ellipsis&&this.lines[a+1]&&this.lines[a+1].top+this.lines[a+1].height>this[this.directionKey.top]+r){const h=this.lines[a].getWidthWithEllips();h>t&&(t=h),e+=this.lines[a].height}else this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height}return{width:this.layoutDirection==="vertical"?e:t,height:this.layoutDirection==="vertical"?t:e}}}class Ru{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=qn(i.lineHeight,this.fontSize);this.lineHeight=typeof n=="number"?n>this.fontSize?n:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:r,height:a,descent:o,width:l}=ml(t,i);let h=0,d=0,u=0;this.height>a&&(h=(this.height-a)/2,d=Math.ceil(h),u=Math.floor(h)),this.textBaseline==="top"?(this.ascent=h,this.descent=a-h):this.textBaseline==="bottom"?(this.ascent=a-h,this.descent=h):this.textBaseline==="middle"?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=r+d,this.descent=o+u),this.length=t.length,this.width=l||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,i.direction==="vertical"&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=ml(this.text,this.character);this.width=t,this.direction==="vertical"&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,r){let a=this.text,o=this.left+i;e+=this.top;let l=this.direction;if(this.verticalEllipsis)a="...",l="vertical",e-=this.ellipsisWidth/2;else{if(this.ellipsis==="hide")return;if(this.ellipsis==="add")a+="...",r==="right"&&(o-=this.ellipsisWidth);else if(this.ellipsis==="replace"){const h=Oy(a,(l==="vertical"?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,a.length-1);if(a=a.slice(0,h),a+="...",r==="right"){const{width:d}=ml(this.text.slice(h),this.character);l==="vertical"||(o-=this.ellipsisWidth-d)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}l==="vertical"&&(t.save(),t.rotateAbout(Math.PI/2,o,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(o,e),o=0,e=0),this.character.stroke&&(bH(t,this.character),t.strokeText(a,o,e)),yH(t,this.character),this.character.fill&&t.fillText(a,o,e),this.character.fill&&(typeof this.character.lineThrough=="boolean"||typeof this.character.underline=="boolean"?(this.character.underline&&t.fillRect(o,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(o,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):this.character.textDecoration==="underline"?t.fillRect(o,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):this.character.textDecoration==="line-through"&&t.fillRect(o,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),l==="vertical"&&t.restore()}getWidthWithEllips(t){let e=this.text;const i=t==="vertical"?this.height:this.width;if(this.ellipsis==="hide")return i;if(this.ellipsis==="add")return i+this.ellipsisWidth;if(this.ellipsis==="replace"){const n=Oy(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,n),e+="...";const{width:r}=ml(this.text.slice(n),this.character);return i+this.ellipsisWidth-r}return i}}function qG(s,t){const e=s.text.slice(0,t),i=s.text.slice(t);return[new Ru(e,s.newLine,s.character),new Ru(i,!0,s.character)]}const iw=["width","height","image",...zs];class Ph extends ss{constructor(t){super(t),this.type="image",this.numberType=pm,this.loadImage(this.attribute.image)}get width(){var t;return(t=this.attribute.width)!==null&&t!==void 0?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return(t=this.attribute.height)!==null&&t!==void 0?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return(t=this.attribute.repeatX)!==null&&t!==void 0?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return(t=this.attribute.repeatY)!==null&&t!==void 0?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,()=>{this.successCallback&&this.successCallback()})}imageLoadFail(t,e){super.imageLoadFail(t,()=>{this.failCallback&&this.failCallback()})}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return t==="image"&&this.loadImage(e),super.setAttribute(t,e,i,n)}doUpdateAABBBounds(){const t=at(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updateImageAABBBounds(e,at(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return wu[t]}needUpdateTags(t){return super.needUpdateTags(t,iw)}needUpdateTag(t){return super.needUpdateTag(t,iw)}clone(){return new Ph(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ph.NOWORK_ANIMATE_ATTR}}Ph.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ni);function _S(s){return new Ph(s)}class kr extends Ph{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],t.backgroundShowMode==="always"&&(this._hovered=!0),t.margin){const e=Ei(t.margin);this._marginArray=typeof e=="number"?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(e,i,n)=>{if($(n)&&n.indexOf("margin")!==-1||n==="margin")if(i.margin){const r=Ei(i.margin);this._marginArray=typeof r=="number"?[r,r,r,r]:r}else this._marginArray=[0,0,0,0]}}get width(){var t;return((t=this.attribute.width)!==null&&t!==void 0?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return((t=this.attribute.height)!==null&&t!==void 0?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=wu.width,height:e=wu.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,r=(i-t)/2,a=(n-e)/2;return this._AABBBounds.expand([0,2*r,2*a,0]),this._AABBBounds}setHoverState(t){this.attribute.backgroundShowMode==="hover"&&this._hovered!==t&&(this._hovered=t)}}class ZG{constructor(t,e,i,n,r,a,o,l){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=r,this.top=i-n,this.paragraphs=a.map(d=>d),this.textAlign=(this.paragraphs[0]instanceof kr?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=o,this.directionKey=qx[this.direction],this.actualWidth=0;let h=0;this.paragraphs.forEach((d,u)=>{if(u===0&&d instanceof Ru){const c=vH.exec(d.text);(c==null?void 0:c.index)!==0&&(d.text=d.text.slice(c==null?void 0:c.index),d.updateWidth())}this.actualWidth+=d[this.directionKey.width],h=Math.max(d[this.directionKey.height],h)}),this.height=h,this.blankWidth=l?0:this.width-this.actualWidth,this.calcOffset(e,l)}calcOffset(t,e){const i=this.directionKey,n=this.height;let r=this.left,a=0;if(this.actualWidth=0;o--){const l=this.paragraphs[o];if(l instanceof kr)break;if(this.direction==="vertical"&&l.direction!=="vertical"){l.verticalEllipsis=!0;break}const{width:h}=ml("...",l.character),d=h||0;if(d<=this.blankWidth+a){l.ellipsis="add";break}if(d<=this.blankWidth+a+l.width){l.ellipsis="replace",l.ellipsisWidth=d,l.ellipsisOtherParagraphWidth=this.blankWidth+a;break}l.ellipsis="hide",a+=l.width}}this.paragraphs.map((a,o)=>{if(a instanceof kr)return a.setAttributes({x:i+a._x,y:n+a._y}),void r(a,t,i+a._x,n+a._y,this.ascent);a.draw(t,n+this.ascent,i,o===0,this.textAlign)})}getWidthWithEllips(){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof kr)break;const{width:r}=ml("...",n.character),a=r||0;if(a<=this.blankWidth+t){n.ellipsis="add",n.ellipsisWidth=a;break}if(a<=this.blankWidth+t+n.width){n.ellipsis="replace",n.ellipsisWidth=a,n.ellipsisOtherParagraphWidth=this.blankWidth+t;break}n.ellipsis="hide",t+=n.width}let e=0;return this.paragraphs.map((i,n)=>{e+=i instanceof kr?i.width:i.getWidthWithEllips(this.direction)}),e}}class JG{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=qx[this.direction]}store(t){if(t instanceof kr){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;t.attribute.textBaseline==="top"?(e=0,i=t.height):t.attribute.textBaseline==="bottom"?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),t.text.length!==0?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(this.lineBuffer.length===0)return;const t=this.maxAscent===0?this.maxAscentForBlank:this.maxAscent,e=this.maxDescent===0?this.maxDescentForBlank:this.maxDescent,i=new ZG(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,this.direction==="horizontal"?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof kr?this.direction==="horizontal"&&this.width===0||this.direction==="vertical"&&this.height===0||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineBuffer.length===0?(this.store(t),this.send()):(this.send(),this.deal(t)):typeof this.width!="number"||this.width<0||(t.newLine&&this.send(),t.text.length!==0&&(this.direction==="horizontal"&&this.width===0||this.direction==="vertical"&&this.height===0||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=Oy(t.text,e,t.character,i,this.frame.wordBreak==="break-word");if(n!==0){const[r,a]=qG(t,n);this.store(r),this.deal(a)}else this.lineBuffer.length!==0&&(this.send(),this.deal(t))}}const sw=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...zs];class Ou extends ss{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=aS}get width(){var t;return(t=this.attribute.width)!==null&&t!==void 0?t:Wn.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return(t=this.attribute.height)!==null&&t!==void 0?t:Wn.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return(t=this.attribute.ellipsis)!==null&&t!==void 0?t:Wn.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return(t=this.attribute.wordBreak)!==null&&t!==void 0?t:Wn.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return(t=this.attribute.verticalDirection)!==null&&t!==void 0?t:Wn.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return(t=this.attribute.textAlign)!==null&&t!==void 0?t:Wn.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return(t=this.attribute.textBaseline)!==null&&t!==void 0?t:Wn.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return(t=this.attribute.textConfig)!==null&&t!==void 0?t:Wn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=at(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updateRichTextAABBBounds(e,at(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wn[t]}needUpdateTags(t){return super.needUpdateTags(t,sw)}needUpdateTag(t){return super.needUpdateTag(t,sw)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}doUpdateFrameCache(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:d,textBaseline:u,layoutDirection:c,singleLine:p}=this.attribute,g=[];for(let x=0;x{var w;this.addUpdateBoundTag(),(w=this.stage)===null||w===void 0||w.renderNextFrame()},k.richtextId=S.id,g.push(k)}}else if(e[x].text.includes(`
`)){const S=e[x].text.split(`
`);for(let A=0;A0,_=typeof n=="number"&&Number.isFinite(n)&&n>0,m=typeof r=="number"&&Number.isFinite(r)&&r>0&&(!f||r<=i),v=typeof a=="number"&&Number.isFinite(a)&&a>0&&(!_||a<=n),y=new KG(0,0,(m?r:f?i:0)||0,(v?a:_?n:0)||0,o,l,h,d,u,c||"horizontal",!m&&f,!v&&_,p||!1,(t=this._frameCache)===null||t===void 0?void 0:t.icons),b=new JG(y);for(let x=0;x{i.setStage(t,e)})}bindIconEvent(){this.addEventListener("pointermove",t=>{var e,i,n,r,a;const o=this.pickIcon(t.global);o&&o===this._currentHoverIcon||(o?((e=this._currentHoverIcon)===null||e===void 0||e.setHoverState(!1),this._currentHoverIcon=o,this._currentHoverIcon.setHoverState(!0),(i=this.stage)===null||i===void 0||i.setCursor(o.attribute.cursor),(n=this.stage)===null||n===void 0||n.renderNextFrame()):!o&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,(r=this.stage)===null||r===void 0||r.setCursor(),(a=this.stage)===null||a===void 0||a.renderNextFrame()))}),this.addEventListener("pointerleave",t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,(e=this.stage)===null||e===void 0||e.setCursor(),(i=this.stage)===null||i===void 0||i.renderNextFrame())})}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let r;return e.icons.forEach(a=>{var o,l;a.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(r=a,r.globalX=((o=r.attribute.x)!==null&&o!==void 0?o:0)+i,r.globalY=((l=r.attribute.y)!==null&&l!==void 0?l:0)+n)}),r}getNoWorkAnimateAttr(){return Ou.NOWORK_ANIMATE_ATTR}}Ou.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ni);function yO(s){return new Ou(s)}const nw=["path","customPath",...zs];class Iu extends ss{constructor(t){super(t),this.type="path",this.numberType=gm}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return t!=null&&t!==""}getParsedPathShape(){const t=at(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof ai?e.path:(P(this.cache)&&this.doUpdatePathShape(),this.cache instanceof ai?this.cache:t.path)}doUpdateAABBBounds(){const t=at(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updatePathAABBBounds(e,at(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;ht(t.path,!0)?this.cache=new ai().fromString(t.path):t.customPath&&(this.cache=new ai,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return at(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,nw)}needUpdateTag(t){return super.needUpdateTag(t,nw)}toCustomPath(){return new ai().fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Iu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Iu.NOWORK_ANIMATE_ATTR}}Iu.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ni);function bO(s){return new Iu(s)}const rw=["segments","points","curveType",...zs];class Lu extends ss{constructor(t){super(t),this.type="area",this.numberType=Mc}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?e.length!==0:!!t&&t.length!==0}doUpdateAABBBounds(){const t=at(this).area;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updateAreaAABBBounds(e,at(this).area,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,r){t==="points"&&(r.points=Qx(i,n,e))}getDefaultAttribute(t){return at(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,rw)}needUpdateTag(t){return super.needUpdateTag(t,rw)}toCustomPath(){const t=new ai,e=this.attribute,i=e.segments,n=r=>{if(r&&r.length){let a=!0;const o=[];if(r.forEach(l=>{var h,d;l.defined!==!1&&(a?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y),o.push({x:(h=l.x1)!==null&&h!==void 0?h:l.x,y:(d=l.y1)!==null&&d!==void 0?d:l.y}),a=!1)}),o.length){for(let l=o.length-1;l>=0;l--)t.lineTo(o[l].x,o[l].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach(r=>{n(r.points)}),t}clone(){return new Lu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Lu.NOWORK_ANIMATE_ATTR}}Lu.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ni);function xO(s){return new Lu(s)}const aw=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...zs];class Eh extends ss{constructor(t){super(t),this.type="arc",this.numberType=dm}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=at(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(e===0||e==="0%")return 0;const r=Math.abs(i-n);return Math.min(dt(e,!0)?e:r*parseFloat(e)/100,r/2)}getParsedAngle(){const t=at(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,r=i-e>=0?1:-1,a=i-e;if(e=Tj(e),i=e+a,n&&Kt(a)re&&h>re)return{startAngle:e-r*c*o,endAngle:i+r*c*l,sc:r*c*o,ec:r*c*l}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=at(this).arc,{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius,padAngle:a=i.padAngle}=this.attribute,{padRadius:o=fs(n*n+r*r)}=this.attribute,l=Kt(e-t);let h=t,d=e,u=t,c=e;const p=a/2;let g=l,f=l;if(p>re&&o>re){const _=e>t?1:-1;let m=g1(Number(o)/r*se(p)),v=g1(Number(o)/n*se(p));return(g-=2*m)>re?(m*=_,u+=m,c-=m):(g=0,u=c=(t+e)/2),(f-=2*v)>re?(v*=_,h+=v,d-=v):(f=0,h=d=(t+e)/2),{outerStartAngle:h,outerEndAngle:d,innerStartAngle:u,innerEndAngle:c,innerDeltaAngle:g,outerDeltaAngle:f}}return{outerStartAngle:h,outerEndAngle:d,innerStartAngle:u,innerEndAngle:c,innerDeltaAngle:g,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=at(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=et.graphicService.updateArcAABBBounds(i,at(this).arc,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,a=Ei(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,aw)}needUpdateTag(t){return super.needUpdateTag(t,aw)}getDefaultAttribute(t){return at(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let n=t.innerRadius,r=t.outerRadius;const a=Kt(i-e),o=i>e;if(r=jt-re)l.moveTo(0+r*de(e),0+r*se(e)),l.arc(0,0,r,e,i,!o),n>re&&(l.moveTo(0+n*de(i),0+n*se(i)),l.arc(0,0,n,i,e,o));else{const h=r*de(e),d=r*se(e),u=n*de(i),c=n*se(i);l.moveTo(0+h,0+d),l.arc(0,0,r,e,i,!o),l.lineTo(0+u,0+c),l.arc(0,0,n,i,e,o),l.closePath()}return l}clone(){return new Eh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eh.NOWORK_ANIMATE_ATTR}}Eh.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ni);function mS(s){return new Eh(s)}class xm extends Eh{constructor(t){super(t),this.type="arc3d",this.numberType=Tc}doUpdateAABBBounds(){const t=at(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updateArc3dAABBBounds(e,at(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}getNoWorkAnimateAttr(){return xm.NOWORK_ANIMATE_ATTR}}xm.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ni);function SO(s){return new xm(s)}const ow=["points","cornerRadius",...zs];class Rh extends ss{constructor(t){super(t),this.type="polygon",this.numberType=fm}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=at(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updatePolygonAABBBounds(e,at(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,r){t==="points"&&(r.points=Qx(i,n,e))}getDefaultAttribute(t){return at(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,ow)}needUpdateTag(t){return super.needUpdateTag(t,ow)}toCustomPath(){const t=this.attribute.points,e=new ai;return t.forEach((i,n)=>{n===0?e.moveTo(i.x,i.y):e.lineTo(i.x,i.y)}),e.closePath(),e}clone(){return new Rh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rh.NOWORK_ANIMATE_ATTR}}Rh.NOWORK_ANIMATE_ATTR=Ni;function AO(s){return new Rh(s)}class Sm extends Rh{constructor(t){super(t),this.type="pyramid3d",this.numberType=nS}doUpdateAABBBounds(){const t=at(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=et.graphicService.updatePyramid3dAABBBounds(e,at(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Ei(n);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map((o,l)=>{const h=l===3?t[0]:t[l+1],d=o.x-h.x;return d===0?0:(o.y-h.y)/d}),i=t.map(o=>({p:o,d:0}));let n=!1,r=0;for(let o=0;o=0;o--){const l=t[o];i.unshift({p:l,d:0})}for(let o=0;o{a.vertices.push([o.p.x,o.p.y,o.d])}),a.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),a.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),a.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),a.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),a.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),a.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),a.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],a}_isValid(){return super._isValid()&&this.attribute.points.length===4}getNoWorkAnimateAttr(){return Sm.NOWORK_ANIMATE_ATTR}}Sm.NOWORK_ANIMATE_ATTR=Ni;function kO(s){return new Sm(s)}class QG extends Kh{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function tW(s){return new QG(s)}class jd{updateBounds(t,e,i,n){const{outerBorder:r,shadowBlur:a=e.shadowBlur}=t;if(r){const o=e.outerBorder,{distance:l=o.distance,lineWidth:h=o.lineWidth}=r;i.expand(l+(a+h)/2)}return i}}class eW extends jd{updateBounds(t,e,i,n){const{outerBorder:r,shadowBlur:a=e.shadowBlur,strokeBoundsBuffer:o=e.strokeBoundsBuffer}=t;if(r){const l=e.outerBorder,{distance:h=l.distance,lineWidth:d=l.lineWidth}=r;cg(i,h+(a+d)/2,!0,o)}return i}}function lw(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class iW{constructor(){this.pools=[]}allocate(t,e,i,n,r,a){if(!this.pools.length)return new Ke(t,e,i,n,r,a);const o=this.pools.pop();return o.a=t,o.b=e,o.c=i,o.d=n,o.e=r,o.f=a,o}allocateByObj(t){if(!this.pools.length)return new Ke(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}class Am{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return lw();const t=this.pools.pop();return Am.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():lw();for(let i=0;i=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},nW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},rW=function(s,t){return function(e,i){t(e,i,s)}};function aW(s){return s[0]=1,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=1,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s}function oW(s,t,e){const i=Math.sin(e),n=Math.cos(e),r=t[4],a=t[5],o=t[6],l=t[7],h=t[8],d=t[9],u=t[10],c=t[11];return t!==s&&(s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15]),s[4]=r*n+h*i,s[5]=a*n+d*i,s[6]=o*n+u*i,s[7]=l*n+c*i,s[8]=h*n-r*i,s[9]=d*n-a*i,s[10]=u*n-o*i,s[11]=c*n-l*i,s}function lW(s,t,e){const i=Math.sin(e),n=Math.cos(e),r=t[0],a=t[1],o=t[2],l=t[3],h=t[8],d=t[9],u=t[10],c=t[11];return t!==s&&(s[4]=t[4],s[5]=t[5],s[6]=t[6],s[7]=t[7],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15]),s[0]=r*n-h*i,s[1]=a*n-d*i,s[2]=o*n-u*i,s[3]=l*n-c*i,s[8]=r*i+h*n,s[9]=a*i+d*n,s[10]=o*i+u*n,s[11]=l*i+c*n,s}function hW(s,t,e){const i=Math.sin(e),n=Math.cos(e),r=t[0],a=t[1],o=t[2],l=t[3],h=t[4],d=t[5],u=t[6],c=t[7];return t!==s&&(s[8]=t[8],s[9]=t[9],s[10]=t[10],s[11]=t[11],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15]),s[0]=r*n+h*i,s[1]=a*n+d*i,s[2]=o*n+u*i,s[3]=l*n+c*i,s[4]=h*n-r*i,s[5]=d*n-a*i,s[6]=u*n-o*i,s[7]=c*n-l*i,s}function _d(s,t,e){const i=e[0],n=e[1],r=e[2];let a,o,l,h,d,u,c,p,g,f,_,m;return t===s?(s[12]=t[0]*i+t[4]*n+t[8]*r+t[12],s[13]=t[1]*i+t[5]*n+t[9]*r+t[13],s[14]=t[2]*i+t[6]*n+t[10]*r+t[14],s[15]=t[3]*i+t[7]*n+t[11]*r+t[15]):(a=t[0],o=t[1],l=t[2],h=t[3],d=t[4],u=t[5],c=t[6],p=t[7],g=t[8],f=t[9],_=t[10],m=t[11],s[0]=a,s[1]=o,s[2]=l,s[3]=h,s[4]=d,s[5]=u,s[6]=c,s[7]=p,s[8]=g,s[9]=f,s[10]=_,s[11]=m,s[12]=a*i+d*n+g*r+t[12],s[13]=o*i+u*n+f*r+t[13],s[14]=l*i+c*n+_*r+t[14],s[15]=h*i+p*n+m*r+t[15]),s}function eb(s,t){s[0]=t.a,s[1]=t.b,s[2]=0,s[3]=0,s[4]=t.c,s[5]=t.d,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1,s[11]=0,s[12]=t.e,s[13]=t.f,s[14]=0,s[15]=1}function dW(s,t,e){const i=e[0],n=e[1],r=e[2];return s[0]=t[0]*i,s[1]=t[1]*i,s[2]=t[2]*i,s[3]=t[3]*i,s[4]=t[4]*n,s[5]=t[5]*n,s[6]=t[6]*n,s[7]=t[7]*n,s[8]=t[8]*r,s[9]=t[9]*r,s[10]=t[10]*r,s[11]=t[11]*r,s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15],s}function Pc(s,t,e){const i=t[0],n=t[1],r=t[2],a=t[3],o=t[4],l=t[5],h=t[6],d=t[7],u=t[8],c=t[9],p=t[10],g=t[11],f=t[12],_=t[13],m=t[14],v=t[15];let y=e[0],b=e[1],x=e[2],S=e[3];return s[0]=y*i+b*o+x*u+S*f,s[1]=y*n+b*l+x*c+S*_,s[2]=y*r+b*h+x*p+S*m,s[3]=y*a+b*d+x*g+S*v,y=e[4],b=e[5],x=e[6],S=e[7],s[4]=y*i+b*o+x*u+S*f,s[5]=y*n+b*l+x*c+S*_,s[6]=y*r+b*h+x*p+S*m,s[7]=y*a+b*d+x*g+S*v,y=e[8],b=e[9],x=e[10],S=e[11],s[8]=y*i+b*o+x*u+S*f,s[9]=y*n+b*l+x*c+S*_,s[10]=y*r+b*h+x*p+S*m,s[11]=y*a+b*d+x*g+S*v,y=e[12],b=e[13],x=e[14],S=e[15],s[12]=y*i+b*o+x*u+S*f,s[13]=y*n+b*l+x*c+S*_,s[14]=y*r+b*h+x*p+S*m,s[15]=y*a+b*d+x*g+S*v,s}function wO(s,t,e){var i;const{x:n=e.x,y:r=e.y,z:a=e.z,dx:o=e.dx,dy:l=e.dy,dz:h=e.dz,scaleX:d=e.scaleX,scaleY:u=e.scaleY,scaleZ:c=e.scaleZ,alpha:p=e.alpha,beta:g=e.beta,angle:f=e.angle,anchor3d:_=t.attribute.anchor,anchor:m}=t.attribute,v=[0,0,0];if(_){if(typeof _[0]=="string"){const y=parseFloat(_[0])/100,b=t.AABBBounds;v[0]=b.x1+(b.x2-b.x1)*y}else v[0]=_[0];if(typeof _[1]=="string"){const y=parseFloat(_[1])/100,b=t.AABBBounds;v[1]=b.x1+(b.x2-b.x1)*y}else v[1]=_[1];v[2]=(i=_[2])!==null&&i!==void 0?i:0}if(aW(s),_d(s,s,[n+o,r+l,a+h]),_d(s,s,[v[0],v[1],v[2]]),oW(s,s,g),lW(s,s,p),_d(s,s,[-v[0],-v[1],v[2]]),dW(s,s,[d,u,c]),f){const y=ve.allocate(),b=[0,0];if(m){if(typeof _[0]=="string"){const x=parseFloat(_[0])/100,S=t.AABBBounds;b[0]=S.x1+(S.x2-S.x1)*x}else b[0]=_[0];if(typeof _[1]=="string"){const x=parseFloat(_[1])/100,S=t.AABBBounds;b[1]=S.x1+(S.x2-S.x1)*x}else b[1]=_[1]}_d(y,y,[b[0],b[1],0]),hW(y,y,f),_d(y,y,[-b[0],-b[1],0]),Pc(s,s,y)}}function uW(s){const{alpha:t,beta:e}=s.attribute;return t||e}let ib=class{constructor(s){this.creator=s,this.hooks={onAttributeUpdate:new Is(["graphic"]),onSetStage:new Is(["graphic","stage"]),onRemove:new Is(["graphic"]),onRelease:new Is(["graphic"]),onAddIncremental:new Is(["graphic","group","stage"]),onClearIncremental:new Is(["graphic","group","stage"]),beforeUpdateAABBBounds:new Is(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Is(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le,this._rectBoundsContribitions=[new jd],this._symbolBoundsContribitions=[new eW],this._circleBoundsContribitions=[new jd],this._arcBoundsContribitions=[new jd],this._pathBoundsContribitions=[new jd]}onAttributeUpdate(s){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(s)}onSetStage(s,t){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(s,t)}onRemove(s){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(s)}onRelease(s){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(s)}onAddIncremental(s,t,e){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(s,t,e)}onClearIncremental(s,t){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(s,t)}beforeUpdateAABBBounds(s,t,e,i){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(s,t,e,i)}afterUpdateAABBBounds(s,t,e,i,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(s,t,e,i,n)}updatePathProxyAABBBounds(s,t){const e=typeof t.pathProxy=="function"?t.pathProxy(t.attribute):t.pathProxy;if(!e)return!1;const i=new AR(s);return Cr(e.commandList,i,0,0),!0}updateRectAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;if(!this.updatePathProxyAABBBounds(e,i)){let{width:a,height:o}=s;const{x1:l,y1:h,x:d,y:u}=s;a=a??l-d,o=o??h-u,e.set(0,0,a||0,o||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach(a=>{a.updateBounds(s,t,n,i),e.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}),this.transformAABBBounds(s,e,t,!1,i),e}updateGroupAABBBounds(s,t,e,i){const{width:n,height:r,path:a,clip:o=t.clip}=s;a&&a.length?a.forEach(d=>{e.union(d.AABBBounds)}):n!=null&&r!=null&&e.set(0,0,n,r),o||i.forEachChildren(d=>{e.union(d.AABBBounds)});const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(e.x1,e.y1,e.x2,e.y2),h.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}updateGlyphAABBBounds(s,t,e,i){return this._validCheck(s,t,e,i)&&i.getSubGraphic().forEach(n=>{e.union(n.AABBBounds)}),e}updateRichTextAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i)||!i)return e;const{width:n=t.width,height:r=t.height,maxWidth:a=t.maxWidth,maxHeight:o=t.maxHeight,textAlign:l=t.textAlign,textBaseline:h=t.textBaseline}=s;if(n>0&&r>0)e.set(0,0,n,r);else{const g=i.getFrameCache(),{width:f,height:_}=g.getActualSize();let m=n||f||0,v=r||_||0;v=typeof o=="number"&&v>o?o:v||0,m=typeof a=="number"&&m>a?a:m||0,e.set(0,0,m,v)}let d=0;switch(h){case"top":d=0;break;case"middle":d=-e.height()/2;break;case"bottom":d=-e.height()}let u=0;switch(l){case"left":u=0;break;case"center":u=-e.width()/2;break;case"right":u=-e.width()}e.translate(u,d);const c=this.tempAABBBounds1,p=this.tempAABBBounds2;return c.setValue(e.x1,e.y1,e.x2,e.y2),p.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}updateTextAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i)||!i)return e;const{text:n=t.text}=i.attribute;Array.isArray(n)?i.updateMultilineAABBBounds(n):i.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2);const{scaleX:o=t.scaleX,scaleY:l=t.scaleY,shadowBlur:h=t.shadowBlur,strokeBoundsBuffer:d=t.strokeBoundsBuffer}=s;if(h){const u=h/Math.abs(o+l);cg(r,u,!0,d),e.union(r)}return this.combindShadowAABBBounds(e,i),ly(e,e,i.transMatrix),e}updatePathAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;this.updatePathProxyAABBBounds(e,i)||this.updatePathAABBBoundsImprecise(s,t,e,i);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach(o=>{o.updateBounds(s,t,n,i),e.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)});const{lineJoin:a=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,a==="miter",i),e}updatePathAABBBoundsImprecise(s,t,e,i){if(!i)return e;const n=i.getParsedPathShape();return e.union(n.getBounds()),e}updatePyramid3dAABBBounds(s,t,e,i){if(!i)return e;const n=i.stage;if(!n||!n.camera)return e;i.findFace().vertices.forEach(o=>{const l=o[0],h=o[1];e.add(l,h)});const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}updateArc3dAABBBounds(s,t,e,i){if(!i)return e;const n=i.stage;if(!n||!n.camera)return e;const{outerRadius:r=t.outerRadius,height:a=0}=s,o=r+a;e.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(e.x1,e.y1,e.x2,e.y2),h.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}updatePolygonAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;this.updatePathProxyAABBBounds(e,i)||this.updatePolygonAABBBoundsImprecise(s,t,e,i);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2);const{lineJoin:a=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,a==="miter",i),e}updatePolygonAABBBoundsImprecise(s,t,e,i){const{points:n=t.points}=s;return n.forEach(r=>{e.add(r.x,r.y)}),e}updateLineAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;this.updatePathProxyAABBBounds(e,i)||(s.segments?this.updateLineAABBBoundsBySegments(s,t,e,i):this.updateLineAABBBoundsByPoints(s,t,e,i));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2);const{lineJoin:a=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,a==="miter",i),e}updateLineAABBBoundsByPoints(s,t,e,i){const{points:n=t.points}=s,r=e;return n.forEach(a=>{r.add(a.x,a.y)}),r}updateLineAABBBoundsBySegments(s,t,e,i){const{segments:n=t.segments}=s,r=e;return n.forEach(a=>{a.points.forEach(o=>{r.add(o.x,o.y)})}),r}updateAreaAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;this.updatePathProxyAABBBounds(e,i)||(s.segments?this.updateAreaAABBBoundsBySegments(s,t,e,i):this.updateAreaAABBBoundsByPoints(s,t,e,i));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2);const{lineJoin:a=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,a==="miter",i),e}updateAreaAABBBoundsByPoints(s,t,e,i){const{points:n=t.points}=s,r=e;return n.forEach(a=>{var o,l;r.add(a.x,a.y),r.add((o=a.x1)!==null&&o!==void 0?o:a.x,(l=a.y1)!==null&&l!==void 0?l:a.y)}),r}updateAreaAABBBoundsBySegments(s,t,e,i){const{segments:n=t.segments}=s,r=e;return n.forEach(a=>{a.points.forEach(o=>{var l,h;r.add(o.x,o.y),r.add((l=o.x1)!==null&&l!==void 0?l:o.x,(h=o.y1)!==null&&h!==void 0?h:o.y)})}),r}updateCircleAABBBounds(s,t,e,i,n){if(!this._validCheck(s,t,e,n))return e;this.updatePathProxyAABBBounds(e,n)||(i?this.updateCircleAABBBoundsImprecise(s,t,e,n):this.updateCircleAABBBoundsAccurate(s,t,e,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach(o=>{o.updateBounds(s,t,r,n),e.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}),this.transformAABBBounds(s,e,t,!1,n),e}updateCircleAABBBoundsImprecise(s,t,e,i){const{radius:n=t.radius}=s;return e.set(-n,-n,n,n),e}updateCircleAABBBoundsAccurate(s,t,e,i){const{startAngle:n=t.startAngle,endAngle:r=t.endAngle,radius:a=t.radius}=s;return r-n>jt-re?e.set(-a,-a,a,a):c0(n,r,a,e),e}updateArcAABBBounds(s,t,e,i,n){if(!this._validCheck(s,t,e,n))return e;this.updatePathProxyAABBBounds(e,n)||(i?this.updateArcAABBBoundsImprecise(s,t,e,n):this.updateArcAABBBoundsAccurate(s,t,e,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach(l=>{l.updateBounds(s,t,r,n),e.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)});const{lineJoin:o=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,o==="miter",n),e}updateArcAABBBoundsImprecise(s,t,e,i){const{innerRadius:n=t.innerRadius}=s;let{outerRadius:r=t.outerRadius}=s;return ra){const l=o;o=a,a=l}return n<=re?e.set(0,0,0,0):Math.abs(a-o)>jt-re?e.set(-n,-n,n,n):(c0(o,a,n,e),c0(o,a,r,e)),e}updateSymbolAABBBounds(s,t,e,i,n){if(!this._validCheck(s,t,e,n))return e;this.updatePathProxyAABBBounds(e,n)||(i?this.updateSymbolAABBBoundsImprecise(s,t,e,n):this.updateSymbolAABBBoundsAccurate(s,t,e,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach(l=>{l.updateBounds(s,t,r,n),e.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)});const{lineJoin:o=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,o==="miter",n),e}updateSymbolAABBBoundsImprecise(s,t,e,i){const{size:n=t.size}=s;if($(n))e.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const r=n/2;e.set(-r,-r,r,r)}return e}updateSymbolAABBBoundsAccurate(s,t,e,i){if(!i)return e;const{size:n=t.size}=s;return i.getParsedPath().bounds(n,e),e}updateImageAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;if(!this.updatePathProxyAABBBounds(e,i)){const{width:a=t.width,height:o=t.height}=s;e.set(0,0,a,o)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}combindShadowAABBBounds(s,t){if(t&&t.shadowRoot){const e=t.shadowRoot.AABBBounds;s.union(e)}}transformAABBBounds(s,t,e,i,n){const{scaleX:r=e.scaleX,scaleY:a=e.scaleY,stroke:o=e.stroke,shadowBlur:l=e.shadowBlur,lineWidth:h=e.lineWidth,pickStrokeBuffer:d=e.pickStrokeBuffer,strokeBoundsBuffer:u=e.strokeBoundsBuffer}=s,c=this.tempAABBBounds1,p=this.tempAABBBounds2;if(o&&h){const _=(h+d)/Math.abs(r+a);cg(c,_,i,u),t.union(c),c.setValue(p.x1,p.y1,p.x2,p.y2)}if(l){const{shadowOffsetX:_=e.shadowOffsetX,shadowOffsetY:m=e.shadowOffsetY}=s,v=l/Math.abs(r+a)*2;cg(c,v,!1,u+1),c.translate(_,m),t.union(c)}this.combindShadowAABBBounds(t,n);let g=!0;const f=n.transMatrix;n&&n.isContainer&&(g=!(f.a===1&&f.b===0&&f.c===0&&f.d===1&&f.e===0&&f.f===0)),g&&ly(t,t,f)}_validCheck(s,t,e,i){if(!i)return!0;if(!i.valid)return e.clear(),!1;const{visible:n=t.visible}=s;return!!n||(e.clear(),!1)}};ib=sW([ft(),rW(0,Bt(aO)),nW("design:paramtypes",[Object])],ib);class cW{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}}const _t=new cW;let Op,Ip;function Ec(s){return Op||(Op=_t.CreateGraphic("text",{})),Op.initAttributes(s),Op.AABBBounds}function pW(s){return Ip||(Ip=_t.CreateGraphic("richtext",{})),Ip.setAttributes(s),Ip.AABBBounds}const Ze={x:0,y:0,z:0,lastModelMatrix:null};class vs{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach(e=>this._renderContribitions.push(e)),this._renderContribitions.length&&(this._renderContribitions.sort((e,i)=>i.order-e.order),this._beforeRenderContribitions=this._renderContribitions.filter(e=>e.time===Ti.beforeFillStroke),this._afterRenderContribitions=this._renderContribitions.filter(e=>e.time===Ti.afterFillStroke))}beforeRenderStep(t,e,i,n,r,a,o,l,h,d,u,c,p){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach(g=>{g.drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p)})}afterRenderStep(t,e,i,n,r,a,o,l,h,d,u,c,p){this._afterRenderContribitions&&this._afterRenderContribitions.forEach(g=>{g.drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p)})}valid(t,e,i,n){const{fill:r=e.fill,background:a,stroke:o=e.stroke,opacity:l=e.opacity,fillOpacity:h=e.fillOpacity,lineWidth:d=e.lineWidth,strokeOpacity:u=e.strokeOpacity,visible:c=e.visible}=t.attribute,p=To(l,h,r),g=dS(l,u),f=zo(r,a),_=qh(o,d);return!(!t.valid||!c)&&!(!f&&!_)&&!!(p||g||i||n||a)&&{fVisible:p,sVisible:g,doFill:f,doStroke:_}}transform(t,e,i,n=!1){const{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:d=e.angle,postMatrix:u}=t.attribute,c=i.modelMatrix,p=i.camera;Ze.x=r,Ze.y=a,Ze.z=o,Ze.lastModelMatrix=c;const g=p&&(n||uW(t)),f=g?t.transMatrix.onlyTranslate()&&!u:l===1&&h===1&&d===0&&!u;if(g){const _=ve.allocate(),m=ve.allocate();wO(m,t,e),Pc(_,c||_,m),Ze.x=0,Ze.y=0,Ze.z=0,i.modelMatrix=_,i.setTransform(1,0,0,1,0,0,!0),ve.free(m)}if(f&&!c){const _=t.getOffsetXY(e);Ze.x+=_.x,Ze.y+=_.y,Ze.z=o,i.setTransformForCurrent()}else if(g)Ze.x=0,Ze.y=0,Ze.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(p&&i.project){const _=t.getOffsetXY(e);Ze.x+=_.x,Ze.y+=_.y,this.transformWithoutTranslate(i,Ze.x,Ze.y,Ze.z,l,h,d)}else i.transformFromMatrix(t.transMatrix,!0),Ze.x=0,Ze.y=0,Ze.z=0;return Ze}transformUseContext2d(t,e,i,n){const r=n.camera;if(this.camera=r,r){const a=t.AABBBounds,o=a.x2-a.x1,l=a.y2-a.y1,h=n.project(0,0,i),d=n.project(o,0,i),u=n.project(o,l,i),c={x:0,y:0},p={x:o,y:0},g={x:o,y:l};n.camera=null;const f=1/(c.x*(g.y-p.y)-p.x*g.y+g.x*p.y+(p.x-g.x)*c.y),_=-(c.y*(u.x-d.x)-p.y*u.x+g.y*d.x+(p.y-g.y)*h.x)*f,m=(p.y*u.y+c.y*(d.y-u.y)-g.y*d.y+(g.y-p.y)*h.y)*f,v=(c.x*(u.x-d.x)-p.x*u.x+g.x*d.x+(p.x-g.x)*h.x)*f,y=-(p.x*u.y+c.x*(d.y-u.y)-g.x*d.y+(g.x-p.x)*h.y)*f,b=(c.x*(g.y*d.x-p.y*u.x)+c.y*(p.x*u.x-g.x*d.x)+(g.x*p.y-p.x*g.y)*h.x)*f,x=(c.x*(g.y*d.y-p.y*u.y)+c.y*(p.x*u.y-g.x*d.y)+(g.x*p.y-p.x*g.y)*h.y)*f;n.setTransform(_,m,v,y,b,x,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,r,a,o){const l=t.project(e,i,n);t.translate(l.x,l.y,!1),t.scale(r,a,!1),t.rotate(o,!1),t.translate(-l.x,-l.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,r){const{context:a}=n;if(!a)return;a.highPerformanceSave();const o=this.transform(t,e,a,i),{x:l,y:h,z:d,lastModelMatrix:u}=o;this.z=d,jN(t,a,l,h,n,r)||(this.drawShape(t,a,l,h,n,r),this.z=0,a.modelMatrix!==u&&ve.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}const gW=function(){const s={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i};let t="";function e(b){const x=new Error(t+": "+b);throw x.source=t,x}function i(){const b=p(n);return t.length>0&&e("Invalid input not EOF"),b}function n(){return r("linear",s.linearGradient,a)||r("radial",s.radialGradient,l)||r("conic",s.conicGradient,o)}function r(b,x,S){return function(A,k){const w=v(A);if(w){v(s.startCall)||e("Missing (");const T=k(w);return v(s.endCall)||e("Missing )"),T}}(x,function(A){const k=S();return k&&(v(s.comma)||e("Missing comma before color stops")),{type:b,orientation:k,colorStops:p(g)}})}function a(){return m("directional",s.sideOrCorner,1)||m("angular",s.angleValue,1)}function o(){return m("angular",s.fromAngleValue,1)}function l(){let b,x,S=h();return S&&(b=[],b.push(S),x=t,v(s.comma)&&(S=h(),S?b.push(S):t=x)),b}function h(){let b=function(){const x=m("shape",/^(circle)/i,0);return x&&(x.style=_()||d()),x}()||function(){const x=m("shape",/^(ellipse)/i,0);return x&&(x.style=f()||d()),x}();if(b)b.at=u();else{const x=d();if(x){b=x;const S=u();S&&(b.at=S)}else{const S=c();S&&(b={type:"default-radial",at:S})}}return b}function d(){return m("extent-keyword",s.extentKeywords,1)}function u(){if(m("position",/^at/,0)){const b=c();return b||e("Missing positioning value"),b}}function c(){const b={x:f(),y:f()};if(b.x||b.y)return{type:"position",value:b}}function p(b){let x=b();const S=[];if(x)for(S.push(x);v(s.comma);)x=b(),x?S.push(x):e("One extra comma");return S}function g(){const b=m("hex",s.hexColor,1)||m("rgba",s.rgbaColor,1)||m("rgb",s.rgbColor,1)||m("literal",s.literalColor,0);return b||e("Expected color definition"),b.length=f(),b}function f(){return m("%",s.percentageValue,1)||m("position-keyword",s.positionKeywords,1)||_()}function _(){return m("px",s.pixelValue,1)||m("em",s.emValue,1)}function m(b,x,S){const A=v(x);if(A)return{type:b,value:A[S]}}function v(b){const x=/^[\n\r\t\s]+/.exec(t);x&&y(x[0].length);const S=b.exec(t);return S&&y(S[0].length),S}function y(b){t=t.substr(b)}return function(b){return t=b.toString(),i()}}();class yl{static IsGradient(t){return!(typeof t=="string"&&t.length<10)}static IsGradientStr(t){return typeof t=="string"&&t.length>10}static Parse(t){if(yl.IsGradientStr(t))try{const e=gW(t)[0];if(e){if(e.type==="linear")return yl.ParseLinear(e);if(e.type==="radial")return yl.ParseRadial(e);if(e.type==="conic")return yl.ParseConic(e)}}catch{return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=le/2,r=parseFloat(e.value)/180*le-n;return{gradient:"conical",x:.5,y:.5,startAngle:r,endAngle:r+jt,stops:i.map(a=>({color:a.value,offset:parseFloat(a.length.value)/100}))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map(i=>({color:i.value,offset:parseFloat(i.length.value)/100}))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=le/2;let r=e.type==="angular"?parseFloat(e.value)/180*le:0;for(;r<0;)r+=jt;for(;r>jt;)r-=jt;let a=0,o=0,l=0,h=0;return r({color:d.value,offset:parseFloat(d.length.value)/100}))}}}function zi(s,t,e){let i=t;const{a:n,b:r,c:a,d:o}=s.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(i=i/Math.abs(l+h)*2*e,i)}function sb(s,t,e,i,n){if(!t||t===!0)return"black";let r,a;if($(t))for(let o=0;o{g.addColorStop(f.offset,f.color)}),g}function _W(s,t,e,i=0,n=0){var r,a,o,l,h,d;const u=e.AABBBounds;if(!u)return;let c=u.x2-u.x1,p=u.y2-u.y1,g=u.x1-i,f=u.y1-n;if(e.attribute){const{scaleX:m=1,scaleY:v=1}=e.attribute;if(m*v==0)return;g/=m,f/=v,c/=m,p/=v}const _=s.createRadialGradient(g+((r=t.x0)!==null&&r!==void 0?r:.5)*c,f+((a=t.y0)!==null&&a!==void 0?a:.5)*p,Math.max(c,p)*((o=t.r0)!==null&&o!==void 0?o:0),g+((l=t.x1)!==null&&l!==void 0?l:.5)*c,f+((h=t.y1)!==null&&h!==void 0?h:.5)*p,Math.max(c,p)*((d=t.r1)!==null&&d!==void 0?d:.5));return t.stops.forEach(m=>{_.addColorStop(m.offset,m.color)}),_}function mW(s,t,e,i=0,n=0){var r,a;const o=e.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,d=o.x1-i,u=o.y1-n;if(e.attribute){const{scaleX:p=1,scaleY:g=1}=e.attribute;if(p*g==0)return;l/=p,h/=g,d/=p,u/=g}const c=s.createConicGradient(d+((r=t.x)!==null&&r!==void 0?r:0)*l,u+((a=t.y)!==null&&a!==void 0?a:0)*h,t.startAngle,t.endAngle);return t.stops.forEach(p=>{c.addColorStop(p.offset,p.color)}),c.GetPattern(l+d,h+u,void 0)}var vW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},yW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},hw=function(s,t){return function(e,i){t(e,i,s)}};class Rc{constructor(){this.time=Ti.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p){const{background:g,backgroundMode:f=h.backgroundMode,backgroundFit:_=h.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const m=t.resources.get(g);if(m.state!=="success"||!m.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const y=at(t.parent).group,{scrollX:b=y.scrollX,scrollY:x=y.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(b,x)}e.clip();const v=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,h),this.doDrawImage(e,m.data,v,f,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n,r){if(n==="no-repeat")t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const a=i.width(),o=i.height();let l=a,h=o;if(r&&n!=="repeat"&&(e.width||e.height)){const c=e.width,p=e.height;n==="repeat-x"?(l=c*(o/p),h=o):n==="repeat-y"&&(h=p*(a/c),l=a);const g=t.dpr,f=Th.allocate({width:l,height:h,dpr:g}),_=f.getContext("2d");_&&(_.inuse=!0,_.clearMatrix(),_.setTransformForCurrent(!0),_.clearRect(0,0,l,h),_.drawImage(e,0,0,l,h),e=f.nativeCanvas),Th.free(f)}const d=t.dpr,u=t.createPattern(e,n);u.setTransform&&u.setTransform(new DOMMatrix([1/d,0,0,1/d,0,0])),t.fillStyle=u,t.translate(i.x1,i.y1),t.fillRect(0,0,a,o),t.translate(-i.x1,-i.y1)}}}const Ho=new Rc;let dn=class{constructor(s){this.subRenderContribitions=s,this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(s,t,e,i,n,r,a,o,l,h,d,u,c){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach(p=>{p.render(s,t,e,i,n,r,a,o,l,h,d,u,c)})}};dn=vW([ft(),hw(0,Bt(oi)),hw(0,wi(cS)),yW("design:paramtypes",[Object])],dn);class vS{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,r){const a=(t-2*e)/2,o=n.dpr,l=Th.allocate({width:t,height:t,dpr:o}),h=l.getContext("2d");if(!h)return null;h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,t,t),r(a,h);const d=n.createPattern(l.nativeCanvas,"repeat");return d.setTransform&&d.setTransform(new DOMMatrix([1/o,0,0,1/o,0,0])),Th.free(l),d}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{a.fillStyle=i,a.arc(r,r,r,0,jt),a.fill()})}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=t/2,l=o;a.fillStyle=i,a.moveTo(o,l-r),a.lineTo(r+o,l),a.lineTo(o,l+r),a.lineTo(o-r,l),a.closePath(),a.fill()})}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=e,l=o;a.fillStyle=i,a.fillRect(o,l,2*r,2*r)})}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=e;a.fillStyle=i,a.fillRect(o,0,2*r,t)})}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=e;a.fillStyle=i,a.fillRect(0,o,t,2*r)})}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{a.strokeStyle=i,a.lineWidth=r,a.moveTo(0,0),a.lineTo(t,t);const o=t/2,l=-o;a.moveTo(o,l),a.lineTo(o+t,l+t),a.moveTo(-o,-l),a.lineTo(-o+t,-l+t),a.stroke()})}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{a.strokeStyle=i,a.lineWidth=r,a.moveTo(t,0),a.lineTo(0,t);const o=t/2,l=o;a.moveTo(t+o,l),a.lineTo(o,l+t),a.moveTo(t-o,-l),a.lineTo(-o,-l+t),a.stroke()})}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=e,l=o;a.fillStyle=i,a.fillRect(o,l,r,r),a.fillRect(o+r,l+r,r,r)})}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p){this.textureMap||this.initTextureMap(e,t.stage);const{texture:g=h.texture,textureColor:f=h.textureColor,textureSize:_=h.textureSize,texturePadding:m=h.texturePadding}=t.attribute;g&&this.drawTexture(g,t,e,i,n,h,f,_,m)}drawTexture(t,e,i,n,r,a,o,l,h){let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(l,h,o,i);break;case"diamond":d=this.createDiamondPattern(l,h,o,i);break;case"rect":d=this.createRectPattern(l,h,o,i);break;case"vertical-line":d=this.createVerticalLinePattern(l,h,o,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(l,h,o,i);break;case"bias-lr":d=this.createBiasLRLinePattern(l,h,o,i);break;case"bias-rl":d=this.createBiasRLLinePattern(l,h,o,i);break;case"grid":d=this.createGridPattern(l,h,o,i)}d&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,n,r,a),i.fillStyle=d,i.fill(),i.highPerformanceRestore())}}const Zh=new vS;class bW{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&p.visible!==!1,_=g&&g.visible!==!1;if(!f&&!_)return;const{innerRadius:m=h.innerRadius,outerRadius:v=h.outerRadius,startAngle:y=h.startAngle,endAngle:b=h.endAngle,opacity:x=h.opacity,x:S=h.x,y:A=h.y,scaleX:k=h.scaleX,scaleY:w=h.scaleY}=t.attribute,T=!(!p||!p.stroke),M=!(!g||!g.stroke);if(f){const{distance:C=h.outerBorder.distance}=p,R=zi(e,C,e.dpr),I=C/v;if(t.setAttributes({outerRadius:v+R,innerRadius:m-R,startAngle:y-I,endAngle:b+I}),e.beginPath(),$g(t,e,i,n,v+R,m-R),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,p,h.outerBorder);else if(T){const O=h.outerBorder.opacity;h.outerBorder.opacity=x,e.setStrokeStyle(t,p,(S-i)/k,(A-n)/w,h.outerBorder),h.outerBorder.opacity=O,e.stroke()}}if(_){const{distance:C=h.innerBorder.distance}=g,R=zi(e,C,e.dpr),I=C/v;if(t.setAttributes({outerRadius:v-R,innerRadius:m+R,startAngle:y+I,endAngle:b-I}),e.beginPath(),$g(t,e,i,n,v-R,m+R),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,g,h.innerBorder);else if(M){const O=h.innerBorder.opacity;h.innerBorder.opacity=x,e.setStrokeStyle(t,g,(S-i)/k,(A-n)/w,h.innerBorder),h.innerBorder.opacity=O,e.stroke()}}t.setAttributes({outerRadius:v,innerRadius:m,startAngle:y,endAngle:b})}}const xW=new bW,SW=Zh,AW=Ho;class kW{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&p.visible!==!1,_=g&&g.visible!==!1;if(!f&&!_)return;const{radius:m=h.radius,startAngle:v=h.startAngle,endAngle:y=h.endAngle,opacity:b=h.opacity,x=h.x,y:S=h.y,scaleX:A=h.scaleX,scaleY:k=h.scaleY}=t.attribute,w=!(!p||!p.stroke),T=!(!g||!g.stroke);if(f){const{distance:M=h.outerBorder.distance}=p,C=zi(e,M,e.dpr);if(e.beginPath(),e.arc(i,n,m+C,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,p,h.outerBorder);else if(w){const R=h.outerBorder.opacity;h.outerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-n)/k,h.outerBorder),h.outerBorder.opacity=R,e.stroke()}}if(_){const{distance:M=h.innerBorder.distance}=g,C=zi(e,M,e.dpr);if(e.beginPath(),e.arc(i,n,m-C,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,g,h.innerBorder);else if(T){const R=h.innerBorder.opacity;h.innerBorder.opacity=b,e.setStrokeStyle(t,g,(x-i)/A,(S-n)/k,h.innerBorder),h.innerBorder.opacity=R,e.stroke()}}}}const wW=new kW,TW=Zh,MW=Ho;class CW extends Rc{constructor(){super(...arguments),this.time=Ti.beforeFillStroke}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{background:p,backgroundMode:g=h.backgroundMode,backgroundFit:f=h.backgroundFit}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const _=t.resources.get(p);if(_.state!=="success"||!_.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const m=t.AABBBounds;this.doDrawImage(e,_.data,m,g,f),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}}const PW=new CW,Lp=le/2;function Co(s,t,e,i,n,r){let a;if(i<0&&(t+=i,i=-i),n<0&&(e+=n,n=-n),dt(r,!0))a=[r=Kt(r),r,r,r];else if(Array.isArray(r)){const x=r;let S,A;switch(x.length){case 0:a=[0,0,0,0];break;case 1:S=Kt(x[0]),a=[S,S,S,S];break;case 2:case 3:S=Kt(x[0]),A=Kt(x[1]),a=[S,A,S,A];break;default:a=x,a[0]=Kt(a[0]),a[1]=Kt(a[1]),a[2]=Kt(a[2]),a[3]=Kt(a[3])}}else a=[0,0,0,0];if(i<0||a[0]+a[1]+a[2]+a[3]<1e-12)return s.rect(t,e,i,n);const[o,l,h,d]=[[t,e],[t+i,e],[t+i,e+n],[t,e+n]],u=Math.min(i/2,n/2),c=[Math.min(u,a[0]),Math.min(u,a[1]),Math.min(u,a[2]),Math.min(u,a[3])],p=[o[0]+c[0],o[1]],g=[o[0],o[1]+c[0]],f=[l[0]-c[1],l[1]],_=[l[0],l[1]+c[1]],m=[h[0]-c[2],h[1]],v=[h[0],h[1]-c[2]],y=[d[0]+c[3],d[1]],b=[d[0],d[1]-c[3]];if(s.moveTo(p[0],p[1]),s.lineTo(f[0],f[1]),!hp(f,_)){const x=f[0],S=f[1]+c[1];s.arc(x,S,c[1],-Lp,0,!1)}if(s.lineTo(v[0],v[1]),!hp(m,v)){const x=v[0]-c[2],S=v[1];s.arc(x,S,c[2],0,Lp,!1)}if(s.lineTo(y[0],y[1]),!hp(y,b)){const x=y[0],S=y[1]-c[3];s.arc(x,S,c[3],Lp,le,!1)}if(s.lineTo(g[0],g[1]),!hp(p,g)){const x=p[0],S=p[1]+c[0];s.arc(x,S,c[0],le,le+Lp,!1)}return s.closePath(),s}class EW extends Rc{constructor(){super(...arguments),this.time=Ti.beforeFillStroke}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{background:p,backgroundMode:g=h.backgroundMode,backgroundFit:f=h.backgroundFit}=t.attribute;if(p)if(t.backgroundImg){const _=t.resources.get(p);if(_.state!=="success"||!_.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const v=at(t.parent).group,{scrollX:y=v.scrollX,scrollY:b=v.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(y,b)}const m=t.AABBBounds;this.doDrawImage(e,_.data,m,g,f),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if($t(p)){const{stroke:_,fill:m,lineWidth:v=1,cornerRadius:y=0,expandX:b=0,expandY:x=0}=p;if(!_&&!m)return;e.beginPath();const{x:S,y:A,width:k,height:w}=RW(t);y?Co(e,S-b,A-x,k+2*b,w+2*x,y):e.rect(S-b,A-x,k+2*b,w+2*x),e.globalAlpha=1,m&&(e.fillStyle=m,e.fill()),_&&v>0&&(e.lineWidth=v,e.strokeStyle=_,e.stroke())}else{e.beginPath();const _=t.AABBBounds;e.rect(i,n,_.width(),_.height()),e.fillStyle=p,e.globalAlpha=1,e.fill()}}}function RW(s){const t=Ei(s.attribute.boundsPadding),e=s.AABBBounds;let i=e.x1,n=e.y1,r=e.width(),a=e.height();return dt(t)?(i+=t,n+=t,r-=2*t,a-=2*t):(i+=t[3],n+=t[0],r-=t[1]+t[3],a-=t[0]+t[2]),{x:i,y:n,width:r,height:a}}const OW=new EW;var TO=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};class IW{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&p.visible!==!1,_=g&&g.visible!==!1;if(!f&&!_)return;const{cornerRadius:m=h.cornerRadius,opacity:v=h.opacity,x:y=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY,x1:A,y1:k}=t.attribute;let{width:w,height:T}=t.attribute;w=(w??A-i)||0,T=(T??k-n)||0;const M=!(!p||!p.stroke),C=!(!g||!g.stroke);if(f){const{distance:R=h.outerBorder.distance}=p,I=zi(e,R,e.dpr),O=i-I,L=n-I,D=2*I;if(m===0||$(m)&&m.every(j=>j===0)?(e.beginPath(),e.rect(O,L,w+D,T+D)):(e.beginPath(),Co(e,O,L,w+D,T+D,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,p,h.outerBorder);else if(M){const j=h.outerBorder.opacity;h.outerBorder.opacity=v,e.setStrokeStyle(t,p,(y-i)/x,(b-n)/S,h.outerBorder),h.outerBorder.opacity=j,e.stroke()}}if(_){const{distance:R=h.innerBorder.distance}=g,I=zi(e,R,e.dpr),O=i+I,L=n+I,D=2*I;if(m===0||$(m)&&m.every(j=>j===0)?(e.beginPath(),e.rect(O,L,w-D,T-D)):(e.beginPath(),Co(e,O,L,w-D,T-D,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,g,h.innerBorder);else if(C){const j=h.innerBorder.opacity;h.innerBorder.opacity=v,e.setStrokeStyle(t,g,(y-i)/x,(b-n)/S,h.innerBorder),h.innerBorder.opacity=j,e.stroke()}}}}let Xg=class{constructor(){this.time=Ti.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(s,t,e,i,n,r,a,o,l,h,d,u,c){const{stroke:p=l.stroke}=s.attribute;Array.isArray(p)&&p.some(g=>g===!1)&&(c.doStroke=!1)}};Xg=TO([ft()],Xg);let Kg=class{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(s,t,e,i,n,r,a,o,l,h,d,u){const{width:c=l.width,height:p=l.height,stroke:g=l.stroke}=s.attribute;if(Array.isArray(g)&&g.some(f=>f===!1)){if(t.setStrokeStyle(s,s.attribute,e,i,l),t.beginPath(),t.moveTo(e,i),g[0]?t.lineTo(e+c,i):t.moveTo(e+c,i),g[1]?t.lineTo(e+c,i+p):t.moveTo(e+c,i+p),g[2]?t.lineTo(e,i+p):t.moveTo(e,i+p),g[3]){const f=g[0]?i-t.lineWidth/2:i;t.lineTo(e,f)}else t.moveTo(e,i);t.stroke()}}};Kg=TO([ft()],Kg);const LW=new IW,BW=Zh,DW=Ho;class FW{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const p=t.getParsedPath();if(!p)return;const{outerBorder:g,innerBorder:f}=t.attribute,_=g&&g.visible!==!1,m=f&&f.visible!==!1;if(!_&&!m)return;const{size:v=h.size,opacity:y=h.opacity,x:b=h.x,y:x=h.y,scaleX:S=h.scaleX,scaleY:A=h.scaleY}=t.attribute,k=!(!g||!g.stroke),w=!(!f||!f.stroke);if(_){const{distance:T=h.outerBorder.distance}=g,M=zi(e,T,e.dpr);if(e.beginPath(),p.drawOffset(e,v,i,n,M)===!1&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,g,h.outerBorder);else if(k){const C=h.outerBorder.opacity;h.outerBorder.opacity=y,e.setStrokeStyle(t,g,(b-i)/S,(x-n)/A,h.outerBorder),h.outerBorder.opacity=C,e.stroke()}}if(m){const{distance:T=h.innerBorder.distance}=f,M=zi(e,T,e.dpr);if(e.beginPath(),p.drawOffset(e,v,i,n,-M)===!1&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,f,h.innerBorder);else if(w){const C=h.innerBorder.opacity;h.innerBorder.opacity=y,e.setStrokeStyle(t,f,(b-i)/S,(x-n)/A,h.innerBorder),h.innerBorder.opacity=C,e.stroke()}}}}const jW=new FW,zW=Zh,HW=Ho;class NW extends vS{constructor(){super(...arguments),this.time=Ti.afterFillStroke}drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p){var g,f,_,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=p||{},{texture:y=(g=t.attribute.texture)!==null&&g!==void 0?g:Cp(h,"texture"),textureColor:b=(f=t.attribute.textureColor)!==null&&f!==void 0?f:Cp(h,"textureColor"),textureSize:x=(_=t.attribute.textureSize)!==null&&_!==void 0?_:Cp(h,"textureSize"),texturePadding:S=(m=t.attribute.texturePadding)!==null&&m!==void 0?m:Cp(h,"texturePadding")}=v;y&&this.drawTexture(y,t,e,i,n,h,b,x,S)}}var GW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},WW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},dw=function(s,t){return function(e,i){t(e,i,s)}};let qg=class extends vs{constructor(s){super(),this.arcRenderContribitions=s,this.numberType=dm,this.builtinContributions=[xW,AW,SW],this.init(s)}drawArcTailCapPath(s,t,e,i,n,r,a,o){const l=o-a,h=s.getParsedAngle(),d=h.startAngle;let u=h.endAngle;u=o;const c=Kt(u-d),p=u>d;let g=!1;if(nre||T>re)&&(j=n*de(y),H=n*se(y),W=r*de(x),V=r*se(x),cre){const X=Ci(S,C),Q=Ci(A,C),J=pa(W,V,I,O,n,X,Number(p)),nt=pa(j,H,L,D,n,Q,Number(p));if(C0&&t.arc(e+nt.cx,i+nt.cy,Q,he(nt.y11,nt.x11),he(nt.y01,nt.x01),!p)}}else t.moveTo(e+I,i+O);if(!(r>re)||m<.001)t.lineTo(e+L,i+D),g=!0;else if(R>re){const X=Ci(w,R),Q=Ci(k,R),J=pa(L,D,j,H,r,-Q,Number(p)),nt=pa(I,O,W,V,r,-X,Number(p));if(t.lineTo(e+J.cx+J.x01,i+J.cy+J.y01),R0&&t.arc(e+J.cx,i+J.cy,Q,he(J.y01,J.x01),he(J.y11,J.x11),!p);const q=he(J.cy+J.y11,J.cx+J.x11),U=u-l-.03;t.arc(e,i,r,q,U,p)}}else t.lineTo(e+r*de(x),i+r*se(x));return g}drawShape(s,t,e,i,n,r,a,o){const l=at(s,r==null?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:c=l.y}=s.attribute,p=this.valid(s,l,a,o);if(!p)return;const{fVisible:g,sVisible:f,doFill:_,doStroke:m}=p,{outerRadius:v=l.outerRadius,innerRadius:y=l.innerRadius,cap:b=l.cap,forceShowCap:x=l.forceShowCap}=s.attribute;let S=0;const A=(ye(b)&&b||b[0])&&h.gradient==="conical";if(A){const{sc:M,startAngle:C,endAngle:R}=s.getParsedAngle();Kt(R-C)=jt-re){t.beginPath();const R=Math.abs(v-y)/2/v,{endAngle:I=l.endAngle,fill:O=l.fill}=s.attribute,L=I;if(this.drawArcTailCapPath(s,t,e,i,v,y,L,L+R),k||this.beforeRenderStep(s,t,e,i,_,m,g,f,l,n,a,o),_){const D=O;if(D.gradient==="conical"){const j=zN(0,0,I,D);a||To&&(t.setCommonStyle(s,s.attribute,e,i,l),t.fillStyle=j,t.fill())}}m&&(o||f&&(t.setStrokeStyle(s,s.attribute,e,i,l),t.stroke()))}}this.afterRenderStep(s,t,e,i,_,m,g,f,l,n,a,o),A&&(h.startAngle+=S,h.endAngle+=S)}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).arc;this._draw(s,n,!1,e,i)}};qg=GW([ft(),dw(0,Bt(oi)),dw(0,wi(Wy)),WW("design:paramtypes",[Object])],qg);var VW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},UW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},uw=function(s,t){return function(e,i){t(e,i,s)}};let Zg=class extends vs{constructor(s){super(),this.circleRenderContribitions=s,this.numberType=um,this.builtinContributions=[wW,MW,TW],this.init(s)}drawShape(s,t,e,i,n,r,a,o){const l=at(s,r==null?void 0:r.theme).circle,{radius:h=l.radius,startAngle:d=l.startAngle,endAngle:u=l.endAngle,x:c=l.x,y:p=l.y}=s.attribute,g=this.valid(s,l,a,o);if(!g)return;const{fVisible:f,sVisible:_,doFill:m,doStroke:v}=g;t.beginPath(),t.arc(e,i,h,d,u),t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),this.beforeRenderStep(s,t,e,i,m,v,f,_,l,n,a,o),m&&(a?a(t,s.attribute,l):f&&(t.setCommonStyle(s,s.attribute,c-e,p-i,l),t.fill())),v&&(o?o(t,s.attribute,l):_&&(t.setStrokeStyle(s,s.attribute,c-e,p-i,l),t.stroke())),this.afterRenderStep(s,t,e,i,m,v,f,_,l,n,a,o)}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).circle;this._draw(s,n,!1,e,i)}};Zg=VW([ft(),uw(0,Bt(oi)),uw(0,wi(Uy)),UW("design:paramtypes",[Object])],Zg);function Jg(s,t,e,i){if(!t.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=i||{};if(e===1)t.p2&&t.p3?s.bezierCurveTo(n+t.p1.x,r+t.p1.y,n+t.p2.x,r+t.p2.y,n+t.p3.x,r+t.p3.y,a):s.lineTo(n+t.p1.x,r+t.p1.y,a);else if(t.p2&&t.p3){const[o]=Cy(t,e);s.bezierCurveTo(n+o.p1.x,r+o.p1.y,n+o.p2.x,r+o.p2.y,n+o.p3.x,r+o.p3.y,a)}else{const o=t.getPointAt(e);s.lineTo(n+o.x,r+o.y,a)}}function nb(s,t,e,i,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:d=!1,zeroX:u=0,zeroY:c=0}=n||{};if(d&&h==="none"||!t)return;let p=!0;const{curves:g}=t;if(e>=1){if(d){let b,x=!0;g.forEach((S,A)=>{var k;let w=S.p0;if(S.originP1!==S.originP2){if(b&&b.originP1===b.originP2&&(w=b.p0),S.defined)x||(s.lineTo(w.x+a,w.y+o,l),x=!x);else{const{originP1:T,originP2:M}=S;let C;if(T&&T.defined!==!1?C=w:T&&M.defined!==!1&&(C=(k=S.p3)!==null&&k!==void 0?k:S.p1),x){x=!x;const R=C?C.x:S.p0.x,I=C?C.y:S.p0.y;s.moveTo(R+a,I+o,l)}else C&&(x=!x,s.lineTo(C.x+a,C.y+o,l))}b=S}else b=S})}else g.forEach(b=>{b.defined?(p&&s.moveTo(b.p0.x+a,b.p0.y+o,l),Jg(s,b,1,n),p=!1):p=!0});return}if(e<=0)return;let f;i==="x"?f=Te.ROW:i==="y"?f=Te.COLUMN:i==="auto"&&(f=t.direction);const _=e*t.tryUpdateLength(f);let m=0,v=!0,y=null;for(let b=0,x=g.length;b{o.defined!==!1?s.lineTo(o.x+n,o.y+r):s.moveTo(o.x+n,o.y+r)})}function YW(s,t,e,i){const{offsetX:n=0,offsetY:r=0}=i||{},{points:a}=e,o=[];for(let l=0;l{var d,u,c,p;const g=t&&h===0?t.points[t.points.length-1]:l[0];s.moveTo(g.x+n,g.y+r),l.forEach(f=>{f.defined!==!1?s.lineTo(f.x+n,f.y+r):s.moveTo(f.x+n,f.y+r)});for(let f=l.length-1;f>=0;f--){const _=l[f];s.lineTo((d=_.x1)!==null&&d!==void 0?d:_.x,(u=_.y1)!==null&&u!==void 0?u:_.y)}s.lineTo((c=g.x1)!==null&&c!==void 0?c:g.x,(p=g.y1)!==null&&p!==void 0?p:g.y),s.closePath()})}var XW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Bu=class extends vs{constructor(){super(...arguments),this.numberType=Cc}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).line;this._draw(s,n,!1,e,i)}drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,g){var f,_,m,v,y;if(!t)return;s.beginPath();const b=(f=this.z)!==null&&f!==void 0?f:0;nb(s.camera?s:s.nativeContext,t,l,h,{offsetX:d,offsetY:u,offsetZ:b}),c.cache&&!$(c.cache)&&c.cache.curves.every(M=>M.defined)&&c.attribute.curveType&&c.attribute.curveType.includes("Closed")&&s.closePath(),s.setShadowBlendStyle&&s.setShadowBlendStyle(c,a,o);const{x=0,x:S=0}=a;e!==!1&&(p?p(s,a,o):n&&(s.setCommonStyle(c,a,x-d,S-u,o),s.fill())),i!==!1&&(g?g(s,a,o):r&&(s.setStrokeStyle(c,a,x-d,S-u,o),s.stroke()));let{connectedType:A,connectedX:k,connectedY:w,connectedStyle:T}=a;if($(o)?(A=(_=A??o[0].connectedType)!==null&&_!==void 0?_:o[1].connectedType,k=(m=k??o[0].connectedX)!==null&&m!==void 0?m:o[1].connectedX,w=(v=w??o[0].connectedY)!==null&&v!==void 0?v:o[1].connectedY,T=(y=T??o[0].connectedStyle)!==null&&y!==void 0?y:o[1].connectedStyle):(A=A??o.connectedType,k=k??o.connectedX,w=w??o.connectedY,T=T??o.connectedStyle),A!=="connect"&&A!=="zero"&&(A="none"),A!=="none"){s.beginPath(),nb(s.camera?s:s.nativeContext,t,l,h,{offsetX:d,offsetY:u,offsetZ:b,drawConnect:!0,mode:A,zeroX:k,zeroY:w});const M=[];$(o)?o.forEach(C=>M.push(C)):M.push(o),M.push(a),e!==!1&&(p?p(s,a,o):n&&(s.setCommonStyle(c,T,x-d,S-u,M),s.fill())),i!==!1&&(g?g(s,a,o):r&&(s.setStrokeStyle(c,T,x-d,S-u,M),s.stroke()))}return!1}drawLinearLineHighPerformance(s,t,e,i,n,r,a,o,l,h,d,u,c){var p;t.beginPath();const g=(p=this.z)!==null&&p!==void 0?p:0,{points:f}=s.attribute,_=f[0];t.moveTo(_.x+a,_.y+o,g);for(let y=1;yy.defined===!1)&&_==="linear")return this.drawLinearLineHighPerformance(s,t,!!h,!!d,u,c,e,i,l,n,r,a,o);if(s.shouldUpdateShape()){const{points:y,segments:b}=s.attribute,x=y;if(b&&b.length){let S,A;if(s.cache=b.map((k,w)=>{if(k.points.length<=1&&w===0)return k.points[0]&&(A={endX:k.points[0].x,endY:k.points[0].y,curves:[{defined:k.points[0].defined!==!1}]}),null;w===1?S={x:A.endX,y:A.endY,defined:A.curves[A.curves.length-1].defined}:w>1&&(S.x=A.endX,S.y=A.endY,S.defined=A.curves[A.curves.length-1].defined);const T=Ry(k.points,_,{startPoint:S});return A=T,T}).filter(k=>!!k),_==="linearClosed"){let k;for(let w=0;wb.points.length);if(y[0].points.length===1&&y.shift(),m===1){let b=!1;s.cache.forEach((x,S)=>{b||(b=this.drawSegmentItem(t,x,!!h,!!d,u,c,y[S],[l,s.attribute],m,v,e,i,s,a,o))})}else{const b=s.cache.reduce((k,w)=>k+w.getLength(),0),x=m*b;let S=0,A=!1;s.cache.forEach((k,w)=>{if(A)return;const T=k.getLength(),M=(x-S)/T;S+=T,M>0&&(A=this.drawSegmentItem(t,k,!!h,!!d,u,c,y[w],[l,s.attribute],Ci(M,1),v,e,i,s,a,o))})}}else this.drawSegmentItem(t,s.cache,!!h,!!d,u,c,s.attribute,l,m,v,e,i,s,a,o)}};Bu=XW([ft()],Bu);function KW(s,t,e,i){var n;const{drawConnect:r=!1,mode:a="none"}=i||{};if(r&&a==="none")return;const{top:o,bottom:l}=t;if(o.curves.length!==l.curves.length)return;if(e>=1){const S=[],A=[];let k=!0;if(r){let w,T,M=!0;const C=o.curves.length;o.curves.forEach((R,I)=>{const O=l.curves[C-I-1];let L=R,D=O;if(R.originP1===R.originP2)return w=R,void(T=O);if(w&&w.originP1===w.originP2&&(L=w,D=T),R.defined)M||(S.push(L),A.push(D),Jo(s,S,A,i),S.length=0,A.length=0,M=!M);else{const{originP1:j,originP2:H}=R;let W,V;j&&j.defined!==!1?(W=L,V=D):j&&H.defined!==!1&&(W=R,V=O),M?(M=!M,S.push(W||R),A.push(V||O)):W&&(M=!M,S.push(W||R),A.push(V||O),Jo(s,S,A,i),S.length=0,A.length=0)}w=R}),Jo(s,S,A,i)}else{for(let w=0,T=o.curves.length;wp?Te.ROW:Te.COLUMN),Number.isFinite(c)||(h=Te.COLUMN),Number.isFinite(p)||(h=Te.ROW);const g=e*(h===Te.ROW?c:p);let f=0,_=!0;const m=[],v=[];let y,b,x=!0;for(let S=0,A=o.curves.length;S{l.defined?(o&&s.moveTo(l.p0.x+n,l.p0.y+r,a),Jg(s,l,1,i),o=!1):o=!0}),o=!0;for(let l=e.length-1;l>=0;l--){const h=e[l];h.defined?(o&&s.lineTo(h.p0.x+n,h.p0.y+r,a),Jg(s,h,1,i),o=!1):o=!0}s.closePath()}const qW=new NW,ZW=Ho;var JW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},QW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},cw=function(s,t){return function(e,i){t(e,i,s)}};function Dp(s,t,e){switch(t){case"linear":default:return kc(s,e);case"basis":return MR(s,e);case"monotoneX":return PR(s,e);case"monotoneY":return ER(s,e);case"step":return ah(s,.5,e);case"stepBefore":return ah(s,0,e);case"stepAfter":return ah(s,1,e);case"linearClosed":return RR(s,e)}}let Du=class extends vs{constructor(s){super(),this.areaRenderContribitions=s,this.numberType=Mc,this.builtinContributions=[qW,ZW],this.init(s)}drawLinearAreaHighPerformance(s,t,e,i,n,r,a,o,l,h,d,u,c){var p,g,f,_,m;t.beginPath();const v=(p=this.z)!==null&&p!==void 0?p:0,{points:y}=s.attribute,b=y[0];t.moveTo(b.x+a,b.y+o,v);for(let A=1;A=0;A--){const k=y[A];t.lineTo(((g=k.x1)!==null&&g!==void 0?g:k.x)+a,((f=k.y1)!==null&&f!==void 0?f:k.y)+o,v)}t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),this.beforeRenderStep(s,t,a,o,!!n,!1,e,!1,l,h,u,null,{attribute:s.attribute});const{x=0,x:S=0}=s.attribute;if(e!==!1&&(u?u(t,s.attribute,l):n&&(t.setCommonStyle(s,s.attribute,x-a,S-o,l),t.fill())),this.afterRenderStep(s,t,a,o,!!n,!1,e,!1,l,h,u,null,{attribute:s.attribute}),i){const{stroke:A=l&&l.stroke}=s.attribute;if($(A)&&(A[0]||A[2])&&A[1]===!1){if(t.beginPath(),A[0]){t.moveTo(b.x+a,b.y+o,v);for(let k=1;k=0;w--){const T=y[w];t.lineTo(((_=T.x1)!==null&&_!==void 0?_:T.x)+a,((m=T.y1)!==null&&m!==void 0?m:T.y)+o,v)}}}c?c(t,s.attribute,l):(t.setStrokeStyle(s,s.attribute,x-a,S-o,l),t.stroke())}}drawShape(s,t,e,i,n,r,a,o){var l,h,d,u,c,p;const g=at(s,r==null?void 0:r.theme).area,{fill:f=g.fill,stroke:_=g.stroke,fillOpacity:m=g.fillOpacity,z:v=g.z,strokeOpacity:y=g.strokeOpacity}=s.attribute,b=this.valid(s,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:w,segments:T}=s.attribute;let{curveType:M=g.curveType}=s.attribute;if(k&&M==="linear"&&(M="linearClosed"),A===1&&!T&&!w.some(C=>C.defined===!1)&&M==="linear")return this.drawLinearAreaHighPerformance(s,t,!!f,S,m,y,e,i,g,n,r,a,o);if(s.shouldUpdateShape()){if(T&&T.length){let C,R;const I=T.map((D,j)=>{if(D.points.length<=1&&j===0)return D.points[0]&&(R={endX:D.points[0].x,endY:D.points[0].y}),null;j===1?C={x:R.endX,y:R.endY}:j>1&&(C.x=R.endX,C.y=R.endY);const H=Dp(D.points,M,{startPoint:C});return R=H,H}).filter(D=>!!D);let O;const L=[];for(let D=T.length-1;D>=0;D--){const j=T[D].points,H=[];for(let W=j.length-1;W>=0;W--)H.push({x:(l=j[W].x1)!==null&&l!==void 0?l:j[W].x,y:(h=j[W].y1)!==null&&h!==void 0?h:j[W].y});if(D!==0){const W=T[D-1].points,V=W[W.length-1];V&&H.push({x:(d=V.x1)!==null&&d!==void 0?d:V.x,y:(u=V.y1)!==null&&u!==void 0?u:V.y})}H.length>1&&(O=Dp(H,M==="stepBefore"?"stepAfter":M==="stepAfter"?"stepBefore":M),L.unshift(O))}s.cacheArea=L.map((D,j)=>({top:I[j],bottom:D}))}else{if(!w||!w.length)return s.cacheArea=null,void s.clearUpdateShapeTag();{const C=w,R=[];for(let L=w.length-1;L>=0;L--)R.push({x:(c=w[L].x1)!==null&&c!==void 0?c:w[L].x,y:(p=w[L].y1)!==null&&p!==void 0?p:w[L].y});const I=Dp(C,M),O=Dp(R,M==="stepBefore"?"stepAfter":M==="stepAfter"?"stepBefore":M);s.cacheArea={top:I,bottom:O}}}s.clearUpdateShapeTag()}if(Array.isArray(s.cacheArea)){const C=s.attribute.segments.filter(R=>R.points.length);if(C[0].points.length===1&&C.shift(),A===1){let R=!1;s.cacheArea.forEach((I,O)=>{R||(R=this.drawSegmentItem(t,I,x,m,S,y,C[O],[g,s.attribute],A,e,i,v,s,n,a,o))})}else{const R=s.cacheArea.reduce((D,j)=>D+j.top.getLength(),0),I=A*R;let O=0,L=!1;s.cacheArea.forEach((D,j)=>{if(L)return;const H=D.top.getLength(),W=(I-O)/H;O+=H,W>0&&(L=this.drawSegmentItem(t,D,x,m,S,y,C[j],[g,s.attribute],Ci(W,1),e,i,v,s,n,a,o))})}}else this.drawSegmentItem(t,s.cacheArea,x,m,S,y,s.attribute,g,A,e,i,v,s,n,a,o)}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).area;this._draw(s,n,!1,e,i)}drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,g,f){let _=!1;return _=_||this._drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,!1,g,f),_=_||this._drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,!0,g,f),_}_drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,g,f,_){var m,v,y,b;let{connectedType:x,connectedX:S,connectedY:A,connectedStyle:k}=a;const w=[];if(g&&($(o)?(x=(m=x??o[0].connectedType)!==null&&m!==void 0?m:o[1].connectedType,S=(v=S??o[0].connectedX)!==null&&v!==void 0?v:o[1].connectedX,A=(y=A??o[0].connectedY)!==null&&y!==void 0?y:o[1].connectedY,k=(b=k??o[0].connectedStyle)!==null&&b!==void 0?b:o[1].connectedStyle):(x=x??o.connectedType,S=S??o.connectedX,A=A??o.connectedY,k=k??o.connectedStyle),x!=="connect"&&x!=="zero"&&(x="none"),$(o)?o.forEach(D=>w.push(D)):w.push(o),w.push(a)),g&&x==="none")return!1;if(!t)return;s.beginPath();const{points:T,segments:M}=c.attribute;let C,R,I=Te.ROW;if(M){const D=M[M.length-1];R=M[0].points[0],C=D.points[D.points.length-1]}else R=T[0],C=T[T.length-1];I=Kt(C.x-R.x)>Kt(C.y-R.y)?Te.ROW:Te.COLUMN,KW(s.camera?s:s.nativeContext,t,l,{offsetX:h,offsetY:d,offsetZ:u,direction:I,drawConnect:g,mode:x}),this.beforeRenderStep(c,s,h,d,!!i,!1,e,!1,o,p,f,null,{attribute:a}),s.setShadowBlendStyle&&s.setShadowBlendStyle(c,a,o);const{x:O=0,x:L=0}=a;if(e!==!1&&(f?f(s,a,o):i&&(s.setCommonStyle(c,g?k:a,O-h,L-d,g?w:o),s.fill())),this.afterRenderStep(c,s,h,d,!!i,!1,e,!1,o,p,f,null,{attribute:a}),n!==!1)if(_)_(s,a,o);else{const{stroke:D=o&&o[1]&&o[1].stroke}=a;$(D)&&(D[0]||D[2])&&D[1]===!1&&(s.beginPath(),nb(s.camera?s:s.nativeContext,D[0]?t.top:t.bottom,l,I===Te.ROW?"x":"y",{offsetX:h,offsetY:d,offsetZ:u,drawConnect:g,mode:x,zeroX:S,zeroY:A})),s.setStrokeStyle(c,g?k:a,O-h,L-d,g?w:o),s.stroke()}return!1}};Du=JW([ft(),cw(0,Bt(oi)),cw(0,wi(Vy)),QW("design:paramtypes",[Object])],Du);const t5=Zh,e5=Ho;var i5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},s5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},pw=function(s,t){return function(e,i){t(e,i,s)}};let Qg=class extends vs{constructor(s){super(),this.pathRenderContribitions=s,this.numberType=gm,this.builtinContributions=[e5,t5],this.init(s)}drawShape(s,t,e,i,n,r,a,o){var l,h,d;const u=(l=this.tempTheme)!==null&&l!==void 0?l:at(s,r==null?void 0:r.theme).path,{x:c=u.x,y:p=u.y}=s.attribute,g=(h=this.z)!==null&&h!==void 0?h:0,f=this.valid(s,u,a,o);if(!f)return;const{fVisible:_,sVisible:m,doFill:v,doStroke:y}=f;if(t.beginPath(),s.pathShape)Cr(s.pathShape.commandList,t,e,i,1,1,g);else{const b=(d=s.attribute.path)!==null&&d!==void 0?d:u.path;Cr(b.commandList,t,e,i,1,1,g)}t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,u),this.beforeRenderStep(s,t,e,i,v,y,_,m,u,n,a,o),y&&(o?o(t,s.attribute,u):m&&(t.setStrokeStyle(s,s.attribute,c-e,p-i,u),t.stroke())),v&&(a?a(t,s.attribute,u):_&&(t.setCommonStyle(s,s.attribute,c-e,p-i,u),t.fill())),this.afterRenderStep(s,t,e,i,v,y,_,m,u,n,a,o)}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).path;this.tempTheme=n,this._draw(s,n,!1,e,i),this.tempTheme=null}};Qg=i5([ft(),pw(0,Bt(oi)),pw(0,wi(Yy)),s5("design:paramtypes",[Object])],Qg);var n5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},r5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},gw=function(s,t){return function(e,i){t(e,i,s)}};let tf=class extends vs{constructor(s){super(),this.rectRenderContribitions=s,this.type="rect",this.numberType=_m,this.builtinContributions=[LW,DW,BW],this.init(s)}drawShape(s,t,e,i,n,r,a,o){var l;const h=(l=this.tempTheme)!==null&&l!==void 0?l:at(s,r==null?void 0:r.theme).rect,{fill:d=h.fill,background:u,stroke:c=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:_=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:v=h.visible,x1:y,y1:b,x=h.x,y:S=h.y}=s.attribute;let{width:A,height:k}=s.attribute;A=(A??y-x)||0,k=(k??b-S)||0;const w=hS(g,f,A,k,d),T=uS(g,m,A,k),M=zo(d,u),C=qh(c,_);if(!s.valid||!v||!M&&!C||!(w||T||a||o||u))return;p===0||$(p)&&p.every(I=>I===0)?(t.beginPath(),t.rect(e,i,A,k)):(t.beginPath(),Co(t,e,i,A,k,p));const R={doFill:M,doStroke:C};t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,h),this.beforeRenderStep(s,t,e,i,M,C,w,T,h,n,a,o,R),R.doFill&&(a?a(t,s.attribute,h):w&&(t.setCommonStyle(s,s.attribute,x-e,S-i,h),t.fill())),R.doStroke&&(o?o(t,s.attribute,h):T&&(t.setStrokeStyle(s,s.attribute,x-e,S-i,h),t.stroke())),this.afterRenderStep(s,t,e,i,M,C,w,T,h,n,a,o)}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).rect;this.tempTheme=n,this._draw(s,n,!1,e,i),this.tempTheme=null}};tf=n5([ft(),gw(0,Bt(oi)),gw(0,wi(Fd)),r5("design:paramtypes",[Object])],tf);var a5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},o5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},fw=function(s,t){return function(e,i){t(e,i,s)}};let ef=class extends vs{constructor(s){super(),this.symbolRenderContribitions=s,this.numberType=mm,this.builtinContributions=[jW,HW,zW],this.init(s)}drawShape(s,t,e,i,n,r,a,o){var l;const h=at(s,r==null?void 0:r.theme).symbol,{size:d=h.size,x:u=h.x,y:c=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=s.attribute,f=this.valid(s,h,a,o);if(!f)return;const{fVisible:_,sVisible:m,doFill:v,doStroke:y}=f,b=s.getParsedPath();if(!b)return;const{keepDirIn3d:x=h.keepDirIn3d}=s.attribute,S=(l=this.z)!==null&&l!==void 0?l:0;if(t.beginPath(),x&&t.camera&&t.project){const A=t.project(e,i,S),k=t.camera;t.camera=null,b.draw(t,$(d)?[d[0]*p,d[1]*g]:d*p,A.x,A.y,void 0,(w,T)=>{var M,C,R;if(s._parsedPath.svgCache){const I=Object.assign({},T);I.fill=(M=T.fill)!==null&&M!==void 0?M:s.attribute.fill,I.opacity=(C=T.fill)!==null&&C!==void 0?C:s.attribute.opacity,I.fillOpacity=s.attribute.fillOpacity,I.stroke=(R=T.stroke)!==null&&R!==void 0?R:s.attribute.stroke,T=I}T.fill&&(a?a(t,s.attribute,h):(t.setCommonStyle(s,T,u-e,c-i,h),t.fill())),T.stroke&&(o?o(t,s.attribute,h):(t.setStrokeStyle(s,T,(u-e)/p,(c-i)/g,h),t.stroke()))})===!1&&t.closePath(),t.camera=k}else b.draw(t,d,e,i,S,(A,k)=>{var w,T,M;if(s._parsedPath.svgCache){const C=Object.assign({},k);C.fill=(w=k.fill)!==null&&w!==void 0?w:s.attribute.fill,C.opacity=(T=k.opacity)!==null&&T!==void 0?T:s.attribute.opacity,C.fillOpacity=s.attribute.fillOpacity,C.stroke=(M=k.stroke)!==null&&M!==void 0?M:s.attribute.stroke,k=C}k.fill&&(a?a(t,s.attribute,h):(t.setCommonStyle(s,k,u-e,c-i,h),t.fill())),k.stroke&&(o?o(t,s.attribute,h):(t.setStrokeStyle(s,k,(u-e)/p,(c-i)/g,h),t.stroke()))})===!1&&t.closePath();t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,h),this.beforeRenderStep(s,t,e,i,v,y,_,m,h,n,a,o),v&&!b.isSvg&&(a?a(t,s.attribute,h):_&&(t.setCommonStyle(s,s.attribute,u-e,c-i,h),t.fill())),y&&!b.isSvg&&(o?o(t,s.attribute,h):m&&(t.setStrokeStyle(s,s.attribute,(u-e)/p,(c-i)/g,h),t.stroke())),this.afterRenderStep(s,t,e,i,v,y,_,m,h,n,a,o)}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).symbol;this._draw(s,n,!1,e,i)}};ef=a5([ft(),fw(0,Bt(oi)),fw(0,wi(Ky)),o5("design:paramtypes",[Object])],ef);class l5{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,i,n){if(!this.pools.length)return new Le().setValue(t,e,i,n);const r=this.pools.pop();return r.x1=t,r.y1=e,r.x2=i,r.y2=n,r}allocateByObj(t){if(!this.pools.length)return new Le(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const sf=new l5;class h5 extends Rc{constructor(){super(...arguments),this.time=Ti.beforeFillStroke}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){var p,g,f,_,m,v,y,b,x,S;const{backgroundMode:A=h.backgroundMode,backgroundFit:k=h.backgroundFit}=t.attribute;let w,{background:T}=t.attribute;if(!T)return;const M=$t(T)&&T.background,C=t.transMatrix.onlyTranslate();if(M){const R=t.AABBBounds,I=((p=T.x)!==null&&p!==void 0?p:R.x1)+((g=T.dx)!==null&&g!==void 0?g:0),O=((f=T.y)!==null&&f!==void 0?f:R.y1)+((_=T.dy)!==null&&_!==void 0?_:0),L=(m=T.width)!==null&&m!==void 0?m:R.width(),D=(v=T.height)!==null&&v!==void 0?v:R.height();if(w=sf.allocate(I,O,I+L,O+D),T=T.background,!C){const j=w.width(),H=w.height();w.set(((y=T.x)!==null&&y!==void 0?y:0)+((b=T.dx)!==null&&b!==void 0?b:0),((x=T.y)!==null&&x!==void 0?x:0)+((S=T.dy)!==null&&S!==void 0?S:0),j,H)}}else w=t.AABBBounds,C||w.set(0,0,w.width(),w.height());if(t.backgroundImg&&t.resources){const R=t.resources.get(T);if(R.state!=="success"||!R.data)return;e.highPerformanceSave(),C&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,n,h),this.doDrawImage(e,R.data,w,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=T,e.fillRect(w.x1,w.y1,w.width(),w.height()),e.highPerformanceRestore();M&&sf.free(w)}}const MO=new h5;var d5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},u5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},_w=function(s,t){return function(e,i){t(e,i,s)}};let rb=class extends vs{constructor(s){super(),this.textRenderContribitions=s,this.numberType=vm,this.builtinContributions=[MO],this.init(s)}drawShape(s,t,e,i,n,r,a,o){var l,h,d;const u=at(s,r==null?void 0:r.theme).text,{text:c,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:_=u.direction,whiteSpace:m=u.whiteSpace,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:b=u.x,y:x=u.y}=s.attribute;let{textAlign:S=u.textAlign,textBaseline:A=u.textBaseline}=s.attribute;if(!y&&_==="vertical"){const D=S;S=(l=s.getBaselineMapAlign()[A])!==null&&l!==void 0?l:"left",A=(h=s.getAlignMapBaseline()[D])!==null&&h!==void 0?h:"top"}const k=(d=qn(s.attribute.lineHeight,v))!==null&&d!==void 0?d:v,w=this.valid(s,u,a,o);if(!w)return;const{fVisible:T,sVisible:M,doFill:C,doStroke:R}=w,I=!f,O=this.z||0;t.beginPath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,u),this.beforeRenderStep(s,t,e,i,C,R,T,M,u,n,a,o),I&&this.transformUseContext2d(s,u,O,t);const L=(D,j,H,W)=>{let V=e+j;const X=i+H;if(W){t.highPerformanceSave(),V+=v;const Q=nn.allocate(1,0,0,1,0,0);Q.rotateByCenter(Math.PI/2,V,X),t.transformFromMatrix(Q,!0),nn.free(Q)}R&&(o?o(t,s.attribute,u):M&&(t.setStrokeStyle(s,s.attribute,b-e,x-i,u),t.strokeText(D,V,X,O))),C&&(a?a(t,s.attribute,u):T&&(t.setCommonStyle(s,s.attribute,b-e,x-i,u),t.fillText(D,V,X,O),this.drawUnderLine(p,g,s,V,X,O,u,t))),W&&(t.highPerformanceRestore(),t.setTransformForCurrent())};if(s.isMultiLine)if(t.setTextStyleWithoutAlignBaseline(s.attribute,u,O),_==="horizontal"){const{multilineLayout:D}=s;if(!D)return void t.highPerformanceRestore();const{xOffset:j,yOffset:H}=D.bbox;R&&(o?o(t,s.attribute,u):M&&(t.setStrokeStyle(s,s.attribute,b-e,x-i,u),D.lines.forEach(W=>{t.strokeText(W.str,(W.leftOffset||0)+j+e,(W.topOffset||0)+H+i,O)}))),C&&(a?a(t,s.attribute,u):T&&(t.setCommonStyle(s,s.attribute,b-e,x-i,u),D.lines.forEach(W=>{t.fillText(W.str,(W.leftOffset||0)+j+e,(W.topOffset||0)+H+i,O),this.drawMultiUnderLine(p,g,s,(W.leftOffset||0)+e,(W.topOffset||0)+H+i,O,W.width,u,t)})))}else{s.tryUpdateAABBBounds();const D=s.cache,{verticalList:j}=D;t.textAlign="left",t.textBaseline="top";const H=k*j.length;let W=0;j.forEach(Q=>{const J=Q.reduce((nt,q)=>nt+(q.width||0),0);W=ps(J,W)});let V=0,X=0;A==="bottom"?X=-H:A==="middle"&&(X=-H/2),S==="center"?V-=W/2:S==="right"&&(V-=W),j.forEach((Q,J)=>{const nt=Q.reduce((it,ut)=>it+(ut.width||0),0),q=W-nt;let U=V;S==="center"?U+=q/2:S==="right"&&(U+=q),Q.forEach(it=>{const{text:ut,width:ct,direction:Rt}=it;L(ut,H-(J+1)*k+X,U,Rt),U+=ct})})}else if(_==="horizontal"){t.setTextStyle(s.attribute,u,O);const D=s.clipedText;let j=0;k!==v&&(A==="top"?j=(k-v)/2:A==="middle"||A==="bottom"&&(j=-(k-v)/2)),L(D,0,j,0)}else{s.tryUpdateAABBBounds();const D=s.cache;if(D){t.setTextStyleWithoutAlignBaseline(s.attribute,u,O);const{verticalList:j}=D;let H=0;const W=j[0].reduce((X,Q)=>X+(Q.width||0),0);let V=0;A==="bottom"?V=-k:A==="middle"&&(V=-k/2),S==="center"?H-=W/2:S==="right"&&(H-=W),t.textAlign="left",t.textBaseline="top",j[0].forEach(X=>{const{text:Q,width:J,direction:nt}=X;L(Q,V,H,nt),H+=J})}}I&&this.restoreTransformUseContext2d(s,u,O,t),this.afterRenderStep(s,t,e,i,C,R,T,M,u,n,a,o)}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=s.attribute,a=!r;this._draw(s,n,a,e,i)}drawUnderLine(s,t,e,i,n,r,a,o){if(t+s<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,fill:u=a.fill,opacity:c=a.opacity,fillOpacity:p=a.fillOpacity}=e.attribute,g=e.clipedWidth,f=Sr(l,g),_=Ar(h,d,d),m={lineWidth:0,stroke:u,opacity:c,strokeOpacity:p};if(s){m.lineWidth=s,o.setStrokeStyle(e,m,i,n,a),o.beginPath();const v=n+_+d;o.moveTo(i+f,v,r),o.lineTo(i+f+g,v,r),o.stroke()}if(t){m.lineWidth=t,o.setStrokeStyle(e,m,i,n,a),o.beginPath();const v=n+_+d/2;o.moveTo(i+f,v,r),o.lineTo(i+f+g,v,r),o.stroke()}}drawMultiUnderLine(s,t,e,i,n,r,a,o,l){if(t+s<=0)return;const{textAlign:h=o.textAlign,fontSize:d=o.fontSize,fill:u=o.fill,opacity:c=o.opacity,fillOpacity:p=o.fillOpacity}=e.attribute,g=Sr(h,a),f=Ar("alphabetic",d,d),_={lineWidth:0,stroke:u,opacity:c,strokeOpacity:p};let m=-3;if(s){_.lineWidth=s,l.setStrokeStyle(e,_,i,n,o),l.beginPath();const v=n+f+d+m;l.moveTo(i+g,v,r),l.lineTo(i+g+a,v,r),l.stroke()}if(m=-1,t){_.lineWidth=t,l.setStrokeStyle(e,_,i,n,o),l.beginPath();const v=n+f+d/2+m;l.moveTo(i+g,v,r),l.lineTo(i+g+a,v,r),l.stroke()}}};rb=d5([ft(),_w(0,Bt(oi)),_w(0,wi(qy)),u5("design:paramtypes",[Object])],rb);function CO(s,t,e,i){s.moveTo(t[0].x+e,t[0].y+i);for(let n=1;nA&&(b=A,y=A*v);const k=f0(u,b,x,p,g),w=f0(u,b,S,f,_),T=2*u.x-k.x-w.x,M=2*u.y-k.y-w.y,C=Fp(T,M),R=f0(u,Fp(b,y),C,T,M);let I=Math.atan2(k.y-R.y,k.x-R.x);const O=Math.atan2(w.y-R.y,w.x-R.x);let L=O-I;L<0&&(I=O,L=-L),L>Math.PI&&(L-=Math.PI),h===0?s.moveTo(k.x+e,k.y+i):s.lineTo(k.x+e,k.y+i),L&&s.arcTo(u.x+e,u.y+i,w.x+e,w.y+i,y),s.lineTo(w.x+e,w.y+i)}r||s.lineTo(t[l+1].x+e,t[l+1].y+i)}function Fp(s,t){return Math.sqrt(s*s+t*t)}function f0(s,t,e,i,n){const r=t/e;return{x:s.x-i*r,y:s.y-n*r}}const p5=Zh,g5=Ho;var f5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},_5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},mw=function(s,t){return function(e,i){t(e,i,s)}};let ab=class extends vs{constructor(s){super(),this.polygonRenderContribitions=s,this.numberType=fm,this.builtinContributions=[g5,p5],this.init(s)}drawShape(s,t,e,i,n,r,a,o){const l=at(s,r==null?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:d=l.cornerRadius,x:u=l.x,y:c=l.y,closePath:p=l.closePath}=s.attribute,g=this.valid(s,l,a,o);if(!g)return;const{fVisible:f,sVisible:_,doFill:m,doStroke:v}=g;t.beginPath(),d<=0||$(d)&&d.every(y=>y===0)?CO(t.camera?t:t.nativeContext,h,e,i):c5(t.camera?t:t.nativeContext,h,e,i,d,p),p&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),this.beforeRenderStep(s,t,e,i,m,v,f,_,l,n,a,o),m&&(a?a(t,s.attribute,l):f&&(t.setCommonStyle(s,s.attribute,u-e,c-i,l),t.fill())),v&&(o?o(t,s.attribute,l):_&&(t.setStrokeStyle(s,s.attribute,u-e,c-i,l),t.stroke())),this.afterRenderStep(s,t,e,i,m,v,f,_,l,n,a,o)}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).polygon;this._draw(s,n,!1,e,i)}};ab=f5([ft(),mw(0,Bt(oi)),mw(0,wi(Xy)),_5("design:paramtypes",[Object])],ab);var m5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},v5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},vw=function(s,t){return function(e,i){t(e,i,s)}};const y5=["","repeat-x","repeat-y","repeat"];let ob=class extends vs{constructor(s){super(),this.imageRenderContribitions=s,this.numberType=pm,this.builtinContributions=[OW],this.init(s)}drawShape(s,t,e,i,n,r,a){const o=at(s).image,{width:l=o.width,height:h=o.height,repeatX:d=o.repeatX,repeatY:u=o.repeatY,cornerRadius:c=o.cornerRadius,image:p}=s.attribute,g=this.valid(s,o,a);if(!g)return;const{fVisible:f,sVisible:_,doFill:m,doStroke:v}=g;if(t.setShadowBlendStyle&&t.setShadowBlendStyle(s,o),this.beforeRenderStep(s,t,e,i,m,!1,f,!1,o,n,a),m){if(a)a(t,s.attribute,o);else if(f){if(!p||!s.resources)return;const y=s.resources.get(p);if(y.state!=="success")return;let b=!1;c===0||$(c)&&c.every(S=>S===0)||(t.beginPath(),Co(t,e,i,l,h,c),t.save(),t.clip(),b=!0),t.setCommonStyle(s,s.attribute,e,i,o);let x=0;if(d==="repeat"&&(x|=1),u==="repeat"&&(x|=2),x){const S=t.createPattern(y.data,y5[x]);t.fillStyle=S,t.translate(e,i,!0),t.fillRect(0,0,l,h),t.translate(-e,-i,!0)}else t.drawImage(y.data,e,i,l,h);b&&t.restore()}}this.afterRenderStep(s,t,e,i,m,!1,f,!1,o,n,a)}draw(s,t,e){const{image:i}=s.attribute;if(!i||!s.resources||s.resources.get(i).state!=="success")return;const{context:n}=t.drawParams;if(!n)return;const r=at(s).image;this._draw(s,r,!1,e)}};ob=m5([ft(),vw(0,Bt(oi)),vw(0,wi($y)),v5("design:paramtypes",[Object])],ob);const PO=Symbol.for("IncrementalDrawContribution"),nf=Symbol.for("ArcRender"),lb=Symbol.for("Arc3dRender"),rf=Symbol.for("AreaRender"),af=Symbol.for("CircleRender"),Mi=Symbol.for("GraphicRender"),yw=Symbol.for("GroupRender"),of=Symbol.for("LineRender"),lf=Symbol.for("PathRender"),hf=Symbol.for("PolygonRender"),df=Symbol.for("RectRender"),hb=Symbol.for("Rect3DRender"),uf=Symbol.for("SymbolRender"),db=Symbol.for("TextRender"),ub=Symbol.for("RichTextRender"),cb=Symbol.for("Pyramid3dRender"),cf=Symbol.for("GlyphRender"),bw=Symbol.for("ImageRender"),yS=Symbol.for("DrawContribution");var b5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},x5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},S5=function(s,t){return function(e,i){t(e,i,s)}};const EO=Symbol.for("RenderService");let pb=class{constructor(s){this.drawContribution=s}prepare(s){s&&this.renderTreeRoots.forEach(t=>{this._prepare(t,s)})}_prepare(s,t){s.forEachChildren(e=>{this._prepare(e,t)}),s.update({bounds:t,trans:!0})}prepareRenderList(){}beforeDraw(s){}draw(s){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(s){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(s,t){this.renderTreeRoots=s,this.drawParams=t;const e=t.updateBounds;this.prepare(e),this.prepareRenderList(),this.beforeDraw(t),this.draw(t),this.afterDraw(t)}};pb=b5([ft(),S5(0,Bt(yS)),x5("design:paramtypes",[Object])],pb);const A5=new Et(s=>{s(EO).to(pb).inSingletonScope()}),oh=Symbol.for("PickerService"),xw=Symbol.for("GlobalPickerService");var bS=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};const bl=Symbol.for("PickItemInterceptor");let pf=class{constructor(){this.order=1}afterPickItem(s,t,e,i,n){return s.attribute.shadowRootIdx>0||!s.attribute.shadowRootIdx?this._pickItem(s,t,e,i,n):null}beforePickItem(s,t,e,i,n){return s.attribute.shadowRootIdx<0?this._pickItem(s,t,e,i,n):null}_pickItem(s,t,e,i,n){if(!s.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=t.pickContext;a.highPerformanceSave();const o=s.shadowRoot,l=nn.allocateByObj(r),h=new We(l.a*e.x+l.c*e.y+l.e,l.b*e.x+l.d*e.y+l.f),d=t.pickGroup(o,h,l,i);return a.highPerformanceRestore(),d}};pf=bS([ft()],pf);let gf=class{constructor(){this.order=1}beforePickItem(s,t,e,i,n){const r=s.baseGraphic;if(r&&r.parent){const a=new We(e.x,e.y),o=t.pickContext;o.highPerformanceSave();const l=r.parent.globalTransMatrix;l.transformPoint(a,a);const h=r.isContainer?t.pickGroup(r,a.clone(),l,i):t.pickItem(r,a.clone(),l,i);return o.highPerformanceRestore(),h}return null}};gf=bS([ft()],gf);let ff=class{constructor(){this.order=1}beforePickItem(s,t,e,i,n){if(!s.in3dMode||i.in3dInterceptor)return null;const r=t.pickContext,a=s.stage;if(!r||!a)return null;if(i.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,s.isContainer){let o,l=!1,h=!1;if(s.forEachChildren(d=>(l=d.numberType===Tc,!l)),s.forEachChildren(d=>(h=!!d.findFace,!h)),l){const d=s.getChildren(),u=[...d];u.sort((c,p)=>{var g,f,_,m;let v=((f=(g=c.attribute.startAngle)!==null&&g!==void 0?g:0+c.attribute.endAngle)!==null&&f!==void 0?f:0)/2,y=((m=(_=p.attribute.startAngle)!==null&&_!==void 0?_:0+p.attribute.endAngle)!==null&&m!==void 0?m:0)/2;for(;v<0;)v+=jt;for(;y<0;)y+=jt;return y-v}),u.forEach(c=>{c._next=null,c._prev=null}),s.removeAllChild(),s.update(),u.forEach(c=>{s.appendChild(c)}),i.hack_pieFace="outside",o=t.pickGroup(s,e,n.parentMatrix,i),o.graphic||(i.hack_pieFace="inside",o=t.pickGroup(s,e,n.parentMatrix,i)),o.graphic||(i.hack_pieFace="top",o=t.pickGroup(s,e,n.parentMatrix,i)),s.removeAllChild(),d.forEach(c=>{c._next=null,c._prev=null}),d.forEach(c=>{s.appendChild(c)})}else if(h){const d=s.getChildren(),u=d.map(c=>({ave_z:c.findFace().vertices.map(p=>{var g;return r.view(p[0],p[1],(g=p[2]+c.attribute.z)!==null&&g!==void 0?g:0)[2]}).reduce((p,g)=>p+g,0),g:c}));u.sort((c,p)=>p.ave_z-c.ave_z),s.removeAllChild(),u.forEach(c=>{c.g._next=null,c.g._prev=null}),s.update(),u.forEach(c=>{s.add(c.g)}),o=t.pickGroup(s,e,n.parentMatrix,i),s.removeAllChild(),d.forEach(c=>{c._next=null,c._prev=null}),s.update(),d.forEach(c=>{s.add(c)})}else o=t.pickGroup(s,e,n.parentMatrix,i);return r.camera=null,i.in3dInterceptor=!1,r.restore(),o}return r.restore(),null}initCanvasCtx(s){s.setTransformForCurrent()}};ff=bS([ft()],ff);const k5=new Et((s,t,e)=>{e(oh)||(s(xw).toSelf(),s(oh).toService(xw)),s(ff).toSelf().inSingletonScope(),s(bl).toService(ff),s(pf).toSelf().inSingletonScope(),s(bl).toService(pf),s(gf).toSelf().inSingletonScope(),s(bl).toService(gf),Fi(s,bl)}),w5=new Et(s=>{s(rO).to(ib).inSingletonScope(),s(aO).toConstantValue(_t)}),Fu=Symbol.for("AutoEnablePlugins"),RO=Symbol.for("PluginService");var T5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},M5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Sw=function(s,t){return function(e,i){t(e,i,s)}};let gb=class{constructor(s){this.autoEnablePlugins=s,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(s,t){this.stage=s,this.actived=!0;const{pluginList:e}=t;e&&Pt.isBound(Fu)&&this.autoEnablePlugins.getContributions().forEach(i=>{e.includes(i.name)&&this.register(i)})}findPluginsByName(s){const t=[];return this.onStartupFinishedPlugin.forEach(e=>{e.name===s&&t.push(e)}),this.onRegisterPlugin.forEach(e=>{e.name===s&&t.push(e)}),t}register(s){s.activeEvent==="onStartupFinished"?this.onStartupFinishedPlugin.push(s):s.activeEvent==="onRegister"&&(this.onRegisterPlugin.push(s),s.activate(this))}unRegister(s){s.activeEvent==="onStartupFinished"?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(s),1):s.activeEvent==="onRegister"&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(s),1),s.deactivate(this)}release(...s){this.onStartupFinishedPlugin.forEach(t=>{t.deactivate(this)}),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach(t=>{t.deactivate(this)}),this.onRegisterPlugin=[]}};gb=T5([ft(),Sw(0,Bt(oi)),Sw(0,wi(Fu)),M5("design:paramtypes",[Object])],gb);const C5=new Et(s=>{s(RO).to(gb),C3(s,Fu)}),P5=new Et(s=>{Fi(s,om)}),E5=new Et(s=>{s(Ly).to(By).inSingletonScope(),Fi(s,Ly)});var R5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},O5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let _f=class{constructor(){this.type="static",this.offscreen=!1,this.global=et.global}setDpr(s){this.canvas.dpr=s}init(s,t,e){if(this.layer=s,this.window=t,e.main)this.main=!0,this.context=t.getContext(),this.canvas=this.context.getCanvas();else{let i;this.main=!1,e.canvasId&&(i=this.global.getElementById(e.canvasId)),i||(i=this.global.createCanvas({width:t.width,height:t.height})),i.style&&(i.style["pointer-events"]="none");const n=t.getContext().getCanvas().nativeCanvas,r=Hg({nativeCanvas:i,width:t.width,height:t.height,dpr:t.dpr,id:e.canvasId,canvasControled:!0,container:t.getContainer(),x:n.offsetLeft,y:n.offsetTop});r.applyPosition(),this.canvas=r,this.context=r.getContext()}}resize(s,t){this.canvas.resize(s,t)}resizeView(s,t){}render(s,t,e){var i;if(!this.main){const n=this.window.getContext().getCanvas().nativeCanvas;!n||this.canvas.x===n.offsetLeft&&this.canvas.y===n.offsetTop||(this.canvas.x=n.offsetLeft,this.canvas.y=n.offsetTop,this.canvas.applyPosition())}t.renderService.render(s,Object.assign(Object.assign({context:this.context,clear:(i=t.background)!==null&&i!==void 0?i:"#ffffff"},t),e))}merge(s){s.forEach(t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)})}prepare(s,t){}drawTo(s,t,e){var i;const n=s.getContext();e.renderService.render(t,Object.assign(Object.assign({context:n},e),{clear:e.clear?(i=e.background)!==null&&i!==void 0?i:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};_f=R5([ft(),O5("design:paramtypes",[])],_f);var I5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},L5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let mf=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=et.global}setDpr(s){}init(s,t,e){if(this.layer=s,this.window=t,e.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(s,t){}resizeView(s,t){}render(s,t,e){this.mainHandler.render(s,t,Object.assign(Object.assign({},e),{clear:!1}))}merge(s){}prepare(s,t){}drawTo(s,t,e){var i;const n=s.getContext();e.renderService.render(t,Object.assign(Object.assign({context:n},e),{clear:e.clear?(i=e.background)!==null&&i!==void 0?i:"#fff":void 0}))}getContext(){return null}release(){}};mf=I5([ft(),L5("design:paramtypes",[])],mf);var B5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},D5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let vf=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=et.global}setDpr(s){this.canvas.dpr=s}init(s,t,e){this.layer=s;const i=this.global.createOffscreenCanvas({width:e.width,height:e.height,dpr:t.dpr}),n=Hg({nativeCanvas:i,width:e.width,height:e.height,dpr:t.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(s,t){this.canvas.resize(s,t)}resizeView(s,t){this.canvas.resize(s,t)}render(s,t){var e;t.renderService.render(s,Object.assign(Object.assign({context:this.context},t),{x:0,y:0,clear:(e=t.background)!==null&&e!==void 0?e:"#ffffff"}))}prepare(s,t){}release(){this.canvas.release()}getContext(){return this.context}drawTo(s,t,e){const i=s.getContext(),n=s.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=e;i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),e.clear&&i.clearRect(r,a,o,l),i.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),i.nativeContext.restore()}merge(s){}};vf=B5([ft(),D5("design:paramtypes",[])],vf);const F5=new Et(s=>{s(_f).toSelf(),s(vf).toSelf(),s(mf).toSelf(),s(dO).toService(_f),s(uO).toService(vf),s(cO).toService(mf)});function j5(s){s.load(P5),s.load(E5),s.load(F5)}var z5=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};function OO(s,t,e,i=!1,n=!1){const r={},a=[];let o=!1;if(n)o=!0;else{let l;s.forEachChildren((h,d)=>{const{zIndex:u=t}=h.attribute;if(d===0)l=u;else if(l!==u)return o=!0,!0;return!1},i)}if(o){s.forEachChildren(h=>{const{zIndex:d=t}=h.attribute;r[d]?r[d].push(h):(r[d]=[h],a.push(d))},i),a.sort((h,d)=>i?d-h:h-d);let l=!1;for(let h=0;h{var g,f;return(i?-1:1)*(((g=p.attribute.z)!==null&&g!==void 0?g:0)-((f=c.attribute.z)!==null&&f!==void 0?f:0))});for(let c=0;c{const{zIndex:u=e}=h.attribute;if(d!==0){if(u!==void 0)return a=!0,!0}return!1},i);let o=null,l=!1;if(a){s.forEachChildren(d=>{const{zIndex:u=e}=d.attribute;n[u]?n[u].push(d):(n[u]=[d],r.push(u))},i),r.sort((d,u)=>i?u-d:d-u);let h=!1;for(let d=0;dl?(o=h,!0):(h._uid===t&&(l=!0),!1),i);return o}var N5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},G5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};const yf=Symbol.for("DrawItemInterceptor"),kw=new Le;class W5{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,n,r),!1}beforeDrawItem(t,e,i,n,r){return t.attribute.shadowRootIdx<0&&this.drawItem(t,e,i,n,r),!1}drawItem(t,e,i,n,r){if(!t.shadowRoot)return!1;const{context:a}=i;if(a.highPerformanceSave(),a.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){kw.copy(n.dirtyBounds);const o=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(o)}return n.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),a.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(kw),!0}}class V5{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,r),!1}drawItem(t,e,i,n,r){if(!t.attribute._debug_bounds)return!1;const{context:a}=i;a.highPerformanceSave(),t.parent&&a.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&a.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const o=t.AABBBounds;return t.attribute._debug_bounds!==!0&&t.attribute._debug_bounds(a,t),a.strokeRect(o.x1,o.y1,o.width(),o.height()),a.highPerformanceRestore(),!0}}let bf=class{constructor(){this.order=1,this.interceptors=[new W5,new $5,new U5,new V5]}afterDrawItem(s,t,e,i,n){for(let r=0;r(u=p.numberType===Tc,!u)),t.forEachChildren(p=>(c=!!p.findFace,!c)),u){const p=t.getChildren(),g=[...p];g.sort((_,m)=>{var v,y,b,x;let S=(((v=_.attribute.startAngle)!==null&&v!==void 0?v:0)+((y=_.attribute.endAngle)!==null&&y!==void 0?y:0))/2,A=(((b=m.attribute.startAngle)!==null&&b!==void 0?b:0)+((x=m.attribute.endAngle)!==null&&x!==void 0?x:0))/2;for(;S<0;)S+=jt;for(;A<0;)A+=jt;return A-S}),g.forEach(_=>{_._next=null,_._prev=null}),t.removeAllChild(),t.update(),g.forEach(_=>{t.appendChild(_)});const f=t.parent.globalTransMatrix;i.hack_pieFace="outside",n.renderGroup(t,i,f),i.hack_pieFace="inside",n.renderGroup(t,i,f),i.hack_pieFace="top",n.renderGroup(t,i,f),t.removeAllChild(),p.forEach(_=>{_._next=null,_._prev=null}),p.forEach(_=>{t.appendChild(_)})}else if(c){const p=t.getChildren(),g=p.map(f=>({ave_z:f.findFace().vertices.map(_=>{var m;return a.view(_[0],_[1],(m=_[2]+f.attribute.z)!==null&&m!==void 0?m:0)[2]}).reduce((_,m)=>_+m,0),g:f}));g.sort((f,_)=>_.ave_z-f.ave_z),t.removeAllChild(),g.forEach(f=>{f.g._next=null,f.g._prev=null}),t.update(),g.forEach(f=>{t.add(f.g)}),n.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),p.forEach(f=>{f._next=null,f._prev=null}),t.update(),p.forEach(f=>{t.add(f)})}else n.renderGroup(t,i,t.parent.globalTransMatrix)}else n.renderItem(t,i);return a.camera=null,a.restore(),a.modelMatrix!==d&&ve.free(a.modelMatrix),a.modelMatrix=d,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Y5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},X5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},_0=function(s,t){return function(e,i){t(e,i,s)}};let xf=class{constructor(s,t){this.contributions=s,this.drawItemInterceptorContributions=t,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Pi,this.backupDirtyBounds=new Pi,this.global=et.global,this.layerService=et.layerService,this.init()}init(){this.contributions.forEach(s=>{if(s.style){const t=this.styleRenderMap.get(s.style)||new Map;t.set(s.numberType,s),this.styleRenderMap.set(s.style,t)}else this.defaultRenderMap.set(s.numberType,s)}),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort((s,t)=>s.order-t.order)}prepareForDraw(s,t){t.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!t.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(s,t){this.prepareForDraw(s,t),t.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(t.renderStyle)||this.defaultRenderMap,this.currentRenderService=s;const{context:e,stage:i,x:n=0,y:r=0,width:a,height:o}=t;if(!e)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(i.dirtyBounds&&!i.dirtyBounds.empty()){const u=xE(l,i.dirtyBounds);l.x1=Math.floor(u.x1),l.y1=Math.floor(u.y1),l.x2=Math.ceil(u.x2),l.y2=Math.ceil(u.y2)}const h=e.dpr%1;(h||h!==.5)&&(l.x1=Math.floor(l.x1*e.dpr)/e.dpr,l.y1=Math.floor(l.y1*e.dpr)/e.dpr,l.x2=Math.ceil(l.x2*e.dpr)/e.dpr,l.y2=Math.ceil(l.y2*e.dpr)/e.dpr),this.backupDirtyBounds.copy(l),e.inuse=!0,e.clearMatrix(),e.setTransformForCurrent(!0);const d=l.width()*e.dpr{var p,g;return((p=u.attribute.zIndex)!==null&&p!==void 0?p:He.zIndex)-((g=c.attribute.zIndex)!==null&&g!==void 0?g:He.zIndex)}).forEach(u=>{u.isContainer?this.renderGroup(u,t,nn.allocate(1,0,0,1,0,0)):this.renderItem(u,t)}),e.restore(),e.restore(),e.draw(),e.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(s){let t=s.parent,e=s._uid;for(;t;){const i=H5(t,e,He.zIndex);if(i)return i;e=t._uid,t=t.parent}return null}renderGroup(s,t,e,i){if(t.break||s.attribute.visibleAll===!1)return;if(s.incremental&&(t.startAtId==null||t.startAtId===s._uid))return t.break=!0,void this._increaseRender(s,t);if(this.useDirtyBounds&&!bu(s.AABBBounds,this.dirtyBounds,!1))return;let n,r=e;if(this.useDirtyBounds){n=sf.allocateByObj(this.dirtyBounds);const a=s.transMatrix;r=nn.allocateByObj(e).multiply(a.a,a.b,a.c,a.d,a.e,a.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(s,t,{drawingCb:()=>{var a;i?s.forEachChildren(o=>{t.break||(o.isContainer?this.renderGroup(o,t,r):this.renderItem(o,t))}):OO(s,He.zIndex,o=>{t.break||(o.isContainer?this.renderGroup(o,t,r):this.renderItem(o,t))},!1,!!(!((a=t.context)===null||a===void 0)&&a.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),sf.free(n),nn.free(r))}_increaseRender(s,t){const{layer:e,stage:i}=t,{subLayers:n}=e;let r=n.get(s._uid);r||(r={layer:this.layerService.createLayer(i),zIndex:n.size,group:s},n.set(s._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Pt.get(PO);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},t),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:s._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(s);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,t);else{let h=n.get(l._uid);h||(h={layer:this.layerService.createLayer(i),zIndex:n.size},n.set(l._uid,h));const d=h.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},t),{drawContribution:o,clear:"transparent",layer:h.layer,context:d,startAtId:l._uid,break:!1}))}}getRenderContribution(s){let t;return t||(t=this.selectRenderByNumberType(s.numberType)),t||(t=this.selectRenderByType(s.type)),t}renderItem(s,t,e){if(this.InterceptorContributions.length)for(let o=0;o=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},q5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},ww=function(s,t){return function(e,i){t(e,i,s)}};let fb=class{constructor(s){this.groupRenderContribitions=s,this.numberType=sS}drawShape(s,t,e,i,n,r,a,o){const l=at(s,r==null?void 0:r.theme).group,{fill:h=l.fill,background:d,stroke:u=l.stroke,opacity:c=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:_=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:y=l.path,lineWidth:b=l.lineWidth,visible:x=l.visible}=s.attribute,S=hS(c,_,p,g,h),A=uS(c,m,p,g),k=zo(h,d),w=qh(u,b);if(!s.valid||!x||!f&&(!k&&!w||!(S||A||a||o||d)))return;if(y&&y.length&&n.drawContribution){const M=t.disableFill,C=t.disableStroke,R=t.disableBeginPath;t.disableFill=!0,t.disableStroke=!0,t.disableBeginPath=!0,y.forEach(I=>{n.drawContribution.getRenderContribution(I).draw(I,n.renderService,n,r)}),t.disableFill=M,t.disableStroke=C,t.disableBeginPath=R}else v===0||$(v)&&v.every(M=>M===0)?(t.beginPath(),t.rect(e,i,p,g)):(t.beginPath(),Co(t,e,i,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(PW));const T={doFill:k,doStroke:w};this._groupRenderContribitions.forEach(M=>{M.time===Ti.beforeFillStroke&&M.drawShape(s,t,e,i,k,w,S,A,l,n,a,o,T)}),f&&t.clip(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),T.doFill&&(a?a(t,s.attribute,l):S&&(t.setCommonStyle(s,s.attribute,e,i,l),t.fill())),T.doStroke&&(o?o(t,s.attribute,l):A&&(t.setStrokeStyle(s,s.attribute,e,i,l),t.stroke())),this._groupRenderContribitions.forEach(M=>{M.time===Ti.afterFillStroke&&M.drawShape(s,t,e,i,k,w,S,A,l,n,a,o)})}draw(s,t,e,i){const{context:n}=e;if(!n)return;const{clip:r}=s.attribute;r?n.save():n.highPerformanceSave();const a=at(s,i==null?void 0:i.theme).group,o=n.modelMatrix;if(n.camera){const u=ve.allocate(),c=ve.allocate();wO(c,s,a),Pc(u,o||u,c),n.modelMatrix=u,ve.free(c),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(s.transMatrix,!0);n.beginPath(),i.skipDraw?this.drawShape(s,n,0,0,e,i,()=>!1,()=>!1):this.drawShape(s,n,0,0,e);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=s.attribute;let d;(l||h)&&n.translate(l,h),i&&i.drawingCb&&(d=i.drawingCb()),n.modelMatrix!==o&&ve.free(n.modelMatrix),n.modelMatrix=o,d&&d.then?d.then(()=>{r?n.restore():n.highPerformanceRestore()}):r?n.restore():n.highPerformanceRestore()}};fb=K5([ft(),ww(0,Bt(oi)),ww(0,wi(gO)),q5("design:paramtypes",[Object])],fb);var Z5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Sf=class extends Bu{constructor(){super(...arguments),this.numberType=Cc}drawShape(s,t,e,i,n,r,a,o){if(s.incremental&&n.multiGraphicOptions){const{startAtIdx:l,length:h}=n.multiGraphicOptions,{segments:d=[]}=s.attribute;if(l>d.length)return;const u=at(s).line,{fill:c=u.fill,stroke:p=u.stroke,opacity:g=u.opacity,fillOpacity:f=u.fillOpacity,strokeOpacity:_=u.strokeOpacity,lineWidth:m=u.lineWidth,visible:v=u.visible}=s.attribute,y=To(g,f,c),b=dS(g,_),x=zo(c),S=qh(p,m);if(!s.valid||!v||!x&&!S||!(y||b||a||o))return;const{context:A}=n;for(let k=l;k=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Af=class extends Du{constructor(){super(...arguments),this.numberType=Mc}drawShape(s,t,e,i,n,r,a){if(s.incremental&&n.multiGraphicOptions){const{startAtIdx:o,length:l}=n.multiGraphicOptions,{segments:h=[]}=s.attribute;if(o>h.length)return;const d=at(s).area,{fill:u=d.fill,fillOpacity:c=d.fillOpacity,opacity:p=d.opacity,visible:g=d.visible}=s.attribute,f=To(p,c,u),_=zo(u);if(!s.valid||!g||!_||!f&&!a)return;for(let m=o;m=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},tV=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},md=function(s,t){return function(e,i){t(e,i,s)}},Hn=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};(function(s){s[s.NORMAL=0]="NORMAL",s[s.STOP=1]="STOP"})(xl||(xl={}));let _b=class extends xf{constructor(s,t,e,i){super(s,i),this.contributions=s,this.lineRender=t,this.areaRender=e,this.drawItemInterceptorContributions=i,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xl.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Is([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(s,t){return Hn(this,void 0,void 0,function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=s,this.lastDrawContext=t,this.checkingForDrawPromise=this.checkForDraw(t);const e=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,e)return;this.currentRenderService=s;const{context:i,x:n=0,y:r=0}=t;i&&(i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0),i.save(),t.restartIncremental&&this.clearScreen(this.currentRenderService,i,t),i.translate(n,r,!0),i.save(),s.renderTreeRoots.sort((a,o)=>{var l,h;return((l=a.attribute.zIndex)!==null&&l!==void 0?l:He.zIndex)-((h=o.attribute.zIndex)!==null&&h!==void 0?h:He.zIndex)}).forEach(a=>{this.renderGroup(a,t)}),this.hooks.completeDraw.tap("top-draw",()=>{i.restore(),i.restore(),i.draw(),i.inuse=!1,this.rendering=!1}))})}_increaseRender(s,t){return Hn(this,void 0,void 0,function*(){this.rendering=!0,yield this._renderIncrementalGroup(s,t)})}_renderIncrementalGroup(s,t){return Hn(this,void 0,void 0,function*(){this.count=s.count,yield new Promise(e=>{this.renderItem(s,t,{drawingCb:()=>Hn(this,void 0,void 0,function*(){if(s.count!==2)yield Aw(s,He.zIndex,(i,n)=>{if(this.status===xl.STOP)return!0;if(i.isContainer||n{this.global.getRequestAnimationFrame()(()=>{s(!1)})})})}checkForDraw(s){return Hn(this,void 0,void 0,function*(){let t=this.rendering;return s.restartIncremental&&(t=!1,yield this.forceStop(),this.resetToInit()),t})}forceStop(){return Hn(this,void 0,void 0,function*(){this.rendering&&(this.status=xl.STOP,yield new Promise(s=>{this.hooks.completeDraw.tap("stopCb",()=>{this.status=xl.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter(t=>t.name!=="stopCb"),s(!1)})}))})}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(s,t){return Hn(this,void 0,void 0,function*(){if(!t.break&&s.attribute.visibleAll!==!1)return s.incremental&&t.startAtId===s._uid?(yield this._increaseRender(s,t),void(t.break=!0)):void(yield new Promise(e=>{this.renderItem(s,t,{drawingCb:()=>Hn(this,void 0,void 0,function*(){yield Aw(s,He.zIndex,i=>Hn(this,void 0,void 0,function*(){t.break||i.isContainer&&(yield this.renderGroup(i,t))})),e(!1)})})}))})}};_b=Q5([ft(),md(0,xR(Mi)),md(1,Bt(Sf)),md(2,Bt(Af)),md(3,Bt(oi)),md(3,wi(yf)),tV("design:paramtypes",[Array,Object,Object,Object])],_b);const eV=new Et(s=>{s(Rc).toSelf().inSingletonScope(),s(vS).toSelf().inSingletonScope(),s(yS).to(xf),s(PO).to(_b),s(yw).to(fb).inSingletonScope(),s(Mi).toService(yw),Fi(s,gO),s(dn).toSelf().inSingletonScope(),Fi(s,cS),Fi(s,Mi),s(bf).toSelf().inSingletonScope(),s(yf).toService(bf),Fi(s,yf)});function iV(s){s.load(eV)}function kf(){kf.__loaded||(kf.__loaded=!0,Pt.load(FN),Pt.load(w5),Pt.load(A5),Pt.load(k5),Pt.load(C5),j5(Pt),iV(Pt))}kf.__loaded=!1,kf();const Gt=Pt.get(Xx);et.global=Gt;const sV=Pt.get(hO);et.graphicUtil=sV;const nV=Pt.get(lO);et.transformUtil=nV;const rV=Pt.get(rO);et.graphicService=rV;const aV=Pt.get(lS);et.layerService=aV;class oV{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ii.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,et.graphicService.hooks.onAttributeUpdate.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&e.stage!=null&&e.stage.renderNextFrame()}),et.graphicService.hooks.onSetStage.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&e.stage!=null&&e.stage.renderNextFrame()})}deactivate(t){et.graphicService.hooks.onAttributeUpdate.taps=et.graphicService.hooks.onAttributeUpdate.taps.filter(e=>e.name!==this.key),et.graphicService.hooks.onSetStage.taps=et.graphicService.hooks.onSetStage.taps.filter(e=>e.name!==this.key)}}class lV{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ii.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const r=t.page.x-this.pageX,a=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const o=r/100,l=a/100;this.option3d.alpha=((e=this.option3d.alpha)!==null&&e!==void 0?e:0)+o,this.option3d.beta=((i=this.option3d.beta)!==null&&i!==void 0?i:0)+l,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class hV{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ii.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,et.graphicService.hooks.onAddIncremental.tap(this.key,(e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&e.stage!=null&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))}),et.graphicService.hooks.onClearIncremental.tap(this.key,(e,i)=>{e.stage===t.stage&&e.stage!=null&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})}deactivate(t){et.graphicService.hooks.onAddIncremental.taps=et.graphicService.hooks.onAddIncremental.taps.filter(e=>e.name!==this.key),et.graphicService.hooks.onClearIncremental.taps=et.graphicService.hooks.onClearIncremental.taps.filter(e=>e.name!==this.key)}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,et.global.getRequestAnimationFrame()(()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1}))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach(e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))}),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class dV{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ii.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}),et.graphicService.hooks.onRelease.tap(this.key,e=>{this.removeDom(e)})}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter(e=>e.name!==this.key)}drawHTML(t){et.global.env==="browser"&&t.renderTreeRoots.sort((e,i)=>{var n,r;return((n=e.attribute.zIndex)!==null&&n!==void 0?n:He.zIndex)-((r=i.attribute.zIndex)!==null&&r!==void 0?r:He.zIndex)}).forEach(e=>{this.renderGroupHTML(e)})}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren(e=>{e.isContainer?this.renderGroupHTML(e):this.renderGraphicHTML(e)})}removeDom(t){t.bindDom&&t.bindDom.size&&(t.bindDom.forEach(e=>{e.dom&&e.dom.parentElement.removeChild(e.dom)}),t.bindDom.clear())}renderGraphicHTML(t){const{html:e}=t.attribute;if(!e)return void(t.bindDom&&t.bindDom.size&&(t.bindDom.forEach(S=>{S.dom&&S.dom.parentElement.removeChild(S.dom)}),t.bindDom.clear()));const i=t.stage;if(!i)return;const{dom:n,container:r,width:a,height:o,style:l,anchorType:h="boundsLeftTop"}=e;t.bindDom||(t.bindDom=new Map);const d=t.bindDom.get(n);if(d&&(!r||r===d.container))return;let u,c;t.bindDom.forEach(({wrapGroup:S})=>{et.global.removeDom(S)}),typeof n=="string"?(u=new DOMParser().parseFromString(n,"text/html").firstChild,u.lastChild&&(u=u.lastChild.firstChild)):u=n;const p=r||(i.params.enableHtmlAttribute===!0?null:i.params.enableHtmlAttribute);c=p?typeof p=="string"?et.global.getElementById(p):p:t.stage.window.getContainer();const g=et.global.createDom({tagName:"div",width:a,height:o,style:l,parent:c});g&&(g.appendChild(u),t.bindDom.set(n,{dom:u,container:r,wrapGroup:g})),g.style.pointerEvents="none",g.style.position||(g.style.position="absolute",c.style.position="relative");let f=0,_=0;const m=t.globalAABBBounds;if(h==="position"||m.empty()){const S=t.globalTransMatrix;f=S.e,_=S.f}else f=m.x1,_=m.y1;const v=et.global.getElementTopLeft(c,!1),y=i.window.getTopLeft(!1),b=f+y.left-v.left,x=_+y.top-v.top;g.style.left=`${b}px`,g.style.top=`${x}px`}}const Tw=new Le;class uV{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ii.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,e=>{e&&e===this.pluginService.stage&&e.dirtyBounds.clear()}),et.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,(e,i,n,r)=>{e.glyphHost&&(e=e.glyphHost),i&&i===this.pluginService.stage&&i.renderCount&&(e.isContainer&&!e.shouldSelfChangeUpdateAABBBounds()||n&&(Tw.setValue(r.x1,r.y1,r.x2,r.y2),i.dirty(Tw,e.parent&&e.parent.globalTransMatrix)))}),et.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,(e,i,n,r,a)=>{i&&i===this.pluginService.stage&&i.renderCount&&(e.isContainer&&!a||i.dirty(r.globalAABBBounds))}),et.graphicService.hooks.onRemove.tap(this.key,e=>{const i=e.stage;i&&i===this.pluginService.stage&&i.renderCount&&i&&i.dirty(e.globalAABBBounds)})}deactivate(t){et.graphicService.hooks.beforeUpdateAABBBounds.taps=et.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(e=>e.name!==this.key),et.graphicService.hooks.afterUpdateAABBBounds.taps=et.graphicService.hooks.afterUpdateAABBBounds.taps.filter(e=>e.name!==this.key),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter(e=>e.name!==this.key),et.graphicService.hooks.onRemove.taps=et.graphicService.hooks.onRemove.taps.filter(e=>e.name!==this.key)}}const Mw=new Le;class cV{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ii.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Le}tryLayout(t){if(this.layouting)return;this.layouting=!0;const e=t.parent;if(!e||!t.needUpdateLayout())return;const i=at(e).group,{display:n=i.display}=e.attribute;if(n!=="flex")return;const{flexDirection:r=i.flexDirection,flexWrap:a=i.flexWrap,justifyContent:o=i.justifyContent,alignItems:l=i.alignItems,alignContent:h=i.alignContent,clip:d=i.clip}=e.attribute;let u=0,c=0,p=0;if(e.forEachChildren(w=>{const T=w.AABBBounds;r==="column"||r==="column-reverse"?(c+=T.height(),u=Math.max(u,T.width())):(u+=T.width(),c=Math.max(c,T.height())),p+=T.x1,p+=T.y1,p+=T.x2,p+=T.y2}),!isFinite(p))return;const g=e.attribute.width||u,f=e.attribute.height||c;e.attribute.width||(e.attribute.width=0),e.attribute.height||(e.attribute.height=0),this.tempBounds.copy(e._AABBBounds);const _={main:{len:g,field:"x"},cross:{len:f,field:"y"},dir:1},m=_.main,v=_.cross;r==="row-reverse"?_.dir=-1:r==="column"?(m.len=f,v.len=g,m.field="y",v.field="x"):r==="column-reverse"&&(m.len=f,v.len=g,m.field="y",v.field="x",_.dir=-1);let y=0,b=0;const x=[];e.forEachChildren(w=>{const T=w.AABBBounds,M=m.field==="x"?T.width():T.height(),C=v.field==="x"?T.width():T.height();x.push({mainLen:M,crossLen:C}),y+=M,b=Math.max(b,C)});const S=[];if(y>m.len&&a==="wrap"){let w=0,T=0;x.forEach(({mainLen:M,crossLen:C},R)=>{w+M>m.len?w===0?(S.push({idx:R,mainLen:w+M,crossLen:C}),w=0,T=0):(S.push({idx:R-1,mainLen:w,crossLen:C}),w=M,T=C):(w+=M,T=Math.max(T,C))}),S.push({idx:x.length-1,mainLen:w,crossLen:T})}else S.push({idx:x.length-1,mainLen:y,crossLen:b});const A=e.getChildren();let k=0;if(S.forEach(w=>{this.layoutMain(e,A,o,m,x,k,w),k=w.idx+1}),b=S.reduce((w,T)=>w+T.crossLen,0),S.length===1)if(l==="flex-end"){const w=v.len;this.layoutCross(A,l,v,w,x,S[0],0)}else if(l==="center"){const w=v.len/2;this.layoutCross(A,l,v,w,x,S[0],0)}else A.forEach(w=>{w.attribute[v.field]=vn(w,v.field)});else if(h==="flex-start"){k=0;let w=0;S.forEach((T,M)=>{this.layoutCross(A,"flex-start",v,w,x,S[M],k),k=T.idx+1,w+=T.crossLen})}else if(h==="center"){k=0;let w=Math.max(0,(v.len-b)/2);S.forEach((T,M)=>{this.layoutCross(A,"center",v,w+T.crossLen/2,x,S[M],k),k=T.idx+1,w+=T.crossLen})}else if(h==="space-around"){k=0;const w=Math.max(0,(v.len-b)/S.length/2);let T=w;S.forEach((M,C)=>{this.layoutCross(A,"flex-start",v,T,x,S[C],k),k=M.idx+1,T+=M.crossLen+2*w})}else if(h==="space-between"){k=0;const w=Math.max(0,(v.len-b)/(2*S.length-2));let T=0;S.forEach((M,C)=>{this.layoutCross(A,"flex-start",v,T,x,S[C],k),k=M.idx+1,T+=M.crossLen+2*w})}A.forEach((w,T)=>{w.addUpdateBoundTag(),w.addUpdatePositionTag(),w.clearUpdateLayoutTag()}),e.addUpdateLayoutTag(),d||this.tempBounds.equals(e.AABBBounds)||(this.tryLayout(e),this.layouting=!1)}layoutMain(t,e,i,n,r,a,o){if(i==="flex-start"){let l=0;for(let h=a;h<=o.idx;h++)e[h].attribute[n.field]=l+vn(e[h],n.field),l+=r[h].mainLen}else if(i==="flex-end"){let l=n.len;for(let h=a;h<=o.idx;h++)l-=r[h].mainLen,e[h].attribute[n.field]=l+vn(e[h],n.field)}else if(i==="space-around")if(o.mainLen>=n.len){let l=0;for(let h=a;h<=o.idx;h++)e[h].attribute[n.field]=l+vn(e[h],n.field),l+=r[h].mainLen}else{const l=o.idx-a+1,h=(n.len-o.mainLen)/l/2;let d=h;for(let u=a;u<=o.idx;u++)e[u].attribute[n.field]=d+vn(e[u],n.field),d+=r[u].mainLen+2*h}else if(i==="space-between")if(o.mainLen>=n.len){let l=0;for(let h=a;h<=o.idx;h++)e[h].attribute[n.field]=l+vn(e[h],n.field),l+=r[h].mainLen}else{const l=o.idx-a+1,h=(n.len-o.mainLen)/(2*l-2);let d=0;for(let u=a;u<=o.idx;u++)e[u].attribute[n.field]=d+vn(e[u],n.field),d+=r[u].mainLen+2*h}else if(i==="center"){let l=(n.len-o.mainLen)/2;for(let h=a;h<=o.idx;h++)e[h].attribute[n.field]=l+vn(e[h],n.field),l+=r[h].mainLen}}layoutCross(t,e,i,n,r,a,o){if(e==="flex-end")for(let l=o;l<=a.idx;l++)t[l].attribute[i.field]=n-r[l].crossLen+vn(t[l],i.field);else if(e==="center")for(let l=o;l<=a.idx;l++)t[l].attribute[i.field]=n-r[l].crossLen/2+vn(t[l],i.field);else for(let l=o;l<=a.idx;l++)t[l].attribute[i.field]=n+vn(t[l],i.field)}activate(t){this.pluginService=t,et.graphicService.hooks.onAttributeUpdate.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),this.tryLayout(e),this.layouting=!1}),et.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,(e,i,n,r)=>{e.glyphHost&&(e=e.glyphHost),i&&i===this.pluginService.stage&&e.isContainer&&Mw.copy(r)}),et.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,(e,i,n,r,a)=>{i&&i===this.pluginService.stage&&e.isContainer&&(Mw.equals(n)||(this.tryLayout(e),this.layouting=!1))}),et.graphicService.hooks.onSetStage.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),this.tryLayout(e),this.layouting=!1})}deactivate(t){et.graphicService.hooks.onAttributeUpdate.taps=et.graphicService.hooks.onAttributeUpdate.taps.filter(e=>e.name!==this.key),et.graphicService.hooks.onSetStage.taps=et.graphicService.hooks.onSetStage.taps.filter(e=>e.name!==this.key)}}function vn(s,t){if(!s.attribute.boundsPadding)return 0;if(kH(s.attribute.boundsPadding))return s.attribute.boundsPadding;if($(s.attribute.boundsPadding)&&s.attribute.boundsPadding.length===1)return s.attribute.boundsPadding[0];const e=Ei(s.attribute.boundsPadding);return t==="x"?e[3]:t==="y"?e[0]:0}const xS=new DH;xS.addTimeline(WR);xS.setFPS(60);class pV{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Oe.Get(e,is.Color1),this.ambient=i;const n=fs(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Ci(ps((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let r;r=ht(e)?Oe.Get(e,is.Color1):e;const a=this.colorRgb;return`rgb(${a[0]*r[0]*n}, ${a[1]*r[1]*n}, ${a[2]*r[2]*n})`}}function gV(s,t,e,i){let n,r,a,o,l,h,d,u,c,p;const g=t[0],f=t[1],_=t[2],m=i[0],v=i[1],y=i[2],b=e[0],x=e[1],S=e[2];return Math.abs(g-b){this._skipRender<0||(i?(this.dirtyBounds&&this.dirtyBounds.setValue(0,0,this._viewBox.width(),this._viewBox.height()),this._skipRender>1&&this.renderNextFrame(),this._skipRender=0):this._skipRender=1)},this.beforeRender=i=>{this._beforeRender&&this._beforeRender(i)},this.afterRender=i=>{this.renderCount++,this._afterRender&&this._afterRender(i),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach(n=>n(i)),this._afterNextRenderCbs=null},this.params=t,this.theme=new Tu,this.hooks={beforeRender:new Is(["stage"]),afterRender:new Is(["stage"])},this.global=et.global,!this.global.env&&SS()&&this.global.setEnv("browser"),this.window=Pt.get(Ng),this.renderService=Pt.get(EO),this.pluginService=Pt.get(RO),this.layerService=Pt.get(lS),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:t.canvasControled!==!1,title:t.title||"",canvas:t.canvas}),this._viewBox=new Le,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=(e=t.background)!==null&&e!==void 0?e:Pw.BACKGROUND,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.disableDirtyBounds===!1&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||xS,this.supportInteractiveLayer=t.interactiveLayer!==!1,this.timeline=new GR,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&ht(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new BH(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:this.params.optimize.skipRenderWithOutRange!==!1?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:r=0,camera:a,fieldRatio:o=1,fieldDepth:l}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:r,camera:a,fieldRatio:o,fieldDepth:l})}set3dOptions(t){var e,i,n,r,a,o;this.option3d=t;const l=this.get3dOptions(t),{light:h,center:d,camera:u,alpha:c,beta:p,fieldRatio:g,fieldDepth:f}=l,{dir:_=[1,1,-1],color:m="white",ambient:v}=h,y=((e=d.x)!==null&&e!==void 0?e:this.width/2)+((i=d.dx)!==null&&i!==void 0?i:0),b=((n=d.y)!==null&&n!==void 0?n:this.height/2)+((r=d.dy)!==null&&r!==void 0?r:0),x=[y,b,((a=d.z)!==null&&a!==void 0?a:0)+((o=d.dz)!==null&&o!==void 0?o:0)];let S=0,A=0,k=0;u||(S=Math.sin(c)+y,A=Math.sin(p)+b,k=Math.cos(c)*Math.cos(p)*1),this.light=new pV(_,m,v);const w={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:g,fieldDepth:f,viewParams:{pos:[S,A,k],center:x,up:[0,1,0]}};this.camera?this.camera.params=w:this.camera=new _V(w),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new lV))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new oV))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new hV))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Pi;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new uV,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new cV))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new dV))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach(t=>{this.pluginService.unRegister(t)}))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach(i=>{this.appendChild(i)})}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach(i=>{this.nextFrameRenderLayerSet.add(i)}),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()(()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1}))}_doRenderInThisFrame(){this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear()),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let n=0;n{n.renderCount>this.renderCount||(n.renderCount=this.renderCount+1,n.render({renderService:this.renderService,background:n===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())},Object.assign({renderStyle:this.renderStyle},e)))}),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){this.window.resize(t,e),this.forEachChildren(n=>{n.resize(t,e)}),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e,i=!0){this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren(n=>{n.resizeView(t,e)}),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,r){let a=!0;typeof t=="object"?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),e===!1&&(a=!1)):(this.viewBox.setValue(t,e,t+i,e+n),r===!1&&(a=!1)),this.forEachChildren(o=>{o.resizeView(this.viewBox.width(),this.viewBox.height())}),a&&this.render()}setDpr(t,e=!0){this.forEachChildren(i=>{i.setDpr(t)}),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){this.pickerService||(this.pickerService=Pt.get(oh));const i=this.pickerService.pick(this.children,new We(t,e),{bounds:this.AABBBounds});return!(!(i!=null&&i.graphic)&&!(i!=null&&i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach(t=>{t.release()}),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter(e=>e.name===t)[0]}renderTo(t,e){this.forEachChildren((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:n===0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())}))})}renderToNewWindow(t=!0,e){const i=Pt.get(Ng);if(t)i.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""});else{const a=e?e.width():Math.min(this.viewWidth,this.window.width-this.x),o=e?e.height():Math.min(this.viewHeight,this.window.height-this.y);i.create({width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""})}const n=e?-e.x1:0,r=e?-e.y1:0;return this.renderTo(i,{x:n,y:r,width:e?e.x2:i.width,height:e?e.y2:i.height}),i}toCanvas(t=!0,e){const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}}function yV(s){return new vV(s)}var bV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},xV=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};const m0={WIDTH:500,HEIGHT:500,DPR:1};let Zd=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(s){this._x=s}get y(){return this._y}set y(s){this._y=s}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(s){this._pixelWidth=s,this._displayWidth=s/(this._dpr||1)}get height(){return this._pixelHeight}set height(s){this._pixelHeight=s,this._displayHeight=s/(this._dpr||1)}getContext(s){return this._context}get visiable(){return this._visiable}set visiable(s){this._visiable=s,s?this.show():this.hide()}get dpr(){return this._dpr}set dpr(s){this._dpr=s,this.resize(this._displayWidth,this._displayHeight)}constructor(s){var t;const{nativeCanvas:e,width:i=m0.WIDTH,height:n=m0.HEIGHT,dpr:r=m0.DPR,x:a,y:o,id:l,canvasControled:h=!0}=s;this._x=a??0,this._y=o??0,this._pixelWidth=i*r,this._pixelHeight=n*r,this._visiable=s.visiable!==!1,this.controled=h,this._displayWidth=i,this._displayHeight=n,this._dpr=r,this._nativeCanvas=e,this._id=(t=e.id)!==null&&t!==void 0?t:l,l&&(e.id=l),this.init(s)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(s){}resize(s,t){}toDataURL(s,t){return""}readPixels(s,t,e,i){return this._context.getImageData(s,t,e,i)}convertToBlob(s){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...s){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};Zd.env="browser",Zd=bV([ft(),xV("design:paramtypes",[Object])],Zd);var SV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let wf=class{configure(s,...t){s.env===this.type&&s.setActiveEnvContribution(this)}getNativeAABBBounds(s){return new Le}removeDom(s){return!1}createDom(s){return null}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(s){return document.getElementById(s)}getRootElement(){return document.body}loadJson(s){const t=fetch(s).then(e=>e.json());return t.then(e=>({data:e,state:"success"})).catch(()=>({data:null,state:"fail"})),t}loadArrayBuffer(s){return fetch(s).then(t=>t.arrayBuffer()).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadBlob(s){return fetch(s).then(t=>t.blob()).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}getElementTop(s,t){return 0}getElementLeft(s,t){return 0}getElementTopLeft(s,t){return{top:0,left:0}}};wf=SV([ft()],wf);var AV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},kV=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Tf=class{constructor(){this._uid=ii.GenAutoIncrementId()}onChange(s){this._onChangeCb=s}configure(s,t){t.env===this.type&&s.setWindowHandler(this)}release(...s){this.releaseWindow()}isVisible(s){return!0}onVisibleChange(s){}getTopLeft(s){return{top:0,left:0}}};Tf=AV([ft(),kV("design:paramtypes",[])],Tf);var wV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},TV=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Ew=function(s,t){return function(e,i){t(e,i,s)}};let mb=class{constructor(s){this.pickItemInterceptorContributions=s,this.type="default",this.global=et.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort((s,t)=>s.order-t.order)}pick(s,t,e){let i={graphic:null,group:null};e.pickerService=this;let n=0,r=0;if(e&&e.bounds){if(!e.bounds.contains(t.x,t.y))return i;n=e.bounds.x1,r=e.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),e.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ke(1,0,0,1,n,r);let o;for(let l=s.length-1;l>=0&&(i=s[l].isContainer?this.pickGroup(s[l],t,a,e):this.pickItem(s[l],t,a,e),!i.graphic);l--)o||(o=i.group);if(i.graphic||(i.group=o),this.pickContext&&(this.pickContext.inuse=!1),i.graphic){let l=i.graphic;for(;l.parent;)l=l.parent;l.shadowHost&&(i.params={shadowTarget:i.graphic},i.graphic=l.shadowHost)}return i}containsPoint(s,t,e){var i;return!!(!((i=this.pickItem(s,t,null,e??{pickContext:this.pickContext,pickerService:this}))===null||i===void 0)&&i.graphic)}pickGroup(s,t,e,i){let n={group:null,graphic:null};if(s.attribute.visibleAll===!1)return n;const r=i.pickContext,a=r.modelMatrix;if(r.camera){const p=s.transMatrix,g=ve.allocate();if(eb(g,p),a){if(g){const f=ve.allocate();r.modelMatrix=Pc(f,a,g),ve.free(g)}}else eb(g,s.globalTransMatrix),r.modelMatrix=g}if(this.InterceptorContributions.length)for(let p=0;p{if(p.isContainer){const g=new We(t.x,t.y),f=at(s).group,{scrollX:_=f.scrollX,scrollY:m=f.scrollY}=s.attribute;g.x-=_,g.y-=m,n=this.pickGroup(p,g,l,i)}else{const g=new We(t.x,t.y);l.transformPoint(g,g);const f=at(s).group,{scrollX:_=f.scrollX,scrollY:m=f.scrollY}=s.attribute;g.x-=_,g.y-=m;const v=this.pickItem(p,g,e,i);v&&v.graphic&&(n.graphic=v.graphic,n.params=v.params)}return!!n.graphic||!!n.group},!0,!!r.camera),r.modelMatrix!==a&&ve.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!c||s.stage.camera||(n.group=s),nn.free(l),n}selectPicker(s){return this.pickerMap.get(s.numberType)||null}};mb=wV([ft(),Ew(0,Bt(oi)),Ew(0,wi(bl)),TV("design:paramtypes",[Object])],mb);let Rw=!1;const MV=new Et(s=>{Rw||(Rw=!0,s(qg).toSelf().inSingletonScope(),s(nf).to(qg).inSingletonScope(),s(Mi).toService(nf),s(Wy).toService(dn),Fi(s,Wy))});let Ow=!1;const CV=new Et(s=>{Ow||(Ow=!0,s(tf).toSelf().inSingletonScope(),s(df).to(tf).inSingletonScope(),s(Mi).toService(df),s(Kg).toSelf(),s(Xg).toSelf(),s(Fd).toService(Kg),s(Fd).toService(Xg),s(Fd).toService(dn),Fi(s,Fd))});let Iw=!1;const PV=new Et(s=>{Iw||(Iw=!0,s(Bu).toSelf().inSingletonScope(),s(Sf).toSelf().inSingletonScope(),s(of).to(Bu).inSingletonScope(),s(Mi).toService(of))});let Lw=!1;const EV=new Et(s=>{Lw||(Lw=!0,s(Du).toSelf().inSingletonScope(),s(rf).to(Du).inSingletonScope(),s(Mi).toService(rf),s(Vy).toService(dn),Fi(s,Vy),s(Af).toSelf().inSingletonScope())});let Bw=!1;const RV=new Et(s=>{Bw||(Bw=!0,s(ef).toSelf().inSingletonScope(),s(uf).to(ef).inSingletonScope(),s(Mi).toService(uf),s(Ky).toService(dn),Fi(s,Ky))});let Dw=!1;const OV=new Et(s=>{Dw||(Dw=!0,s(Zg).toSelf().inSingletonScope(),s(af).to(Zg).inSingletonScope(),s(Mi).toService(af),s(Uy).toService(dn),Fi(s,Uy))});let Fw=!1;const IV=new Et(s=>{Fw||(Fw=!0,s(db).to(rb).inSingletonScope(),s(Mi).toService(db),s(qy).toService(dn),Fi(s,qy))});let jw=!1;const LV=new Et(s=>{jw||(jw=!0,s(Qg).toSelf().inSingletonScope(),s(lf).to(Qg).inSingletonScope(),s(Mi).toService(lf),s(Yy).toService(dn),Fi(s,Yy))});let zw=!1;const BV=new Et(s=>{zw||(zw=!0,s(hf).to(ab).inSingletonScope(),s(Mi).toService(hf),s(Xy).toService(dn),Fi(s,Xy))});var DV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let vb=class{constructor(){this.numberType=cm}drawShape(s,t,e,i,n,r,a,o){n.drawContribution&&s.getSubGraphic().forEach(l=>{const h=n.drawContribution.getRenderContribution(l);h&&h.drawShape&&h.drawShape(l,t,e,i,n,r,a,o)})}draw(s,t,e,i){const{context:n}=e;if(!n||(n.highPerformanceSave(),!e.drawContribution))return;const r=at(s),a=s.getSubGraphic();a.length&&a.forEach(o=>{e.drawContribution.renderItem(o,e,{theme:r})}),n.highPerformanceRestore()}};vb=DV([ft()],vb);let Hw=!1;const FV=new Et(s=>{Hw||(Hw=!0,s(cf).to(vb).inSingletonScope(),s(Mi).toService(cf))});var jV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},zV=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let yb=class extends vs{constructor(){super(),this.numberType=aS,this.builtinContributions=[MO],this.init()}drawShape(s,t,e,i,n){const r=at(s).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=s.attribute;if(!s.valid||!h)return;const d=To(o,l,!0),u=To(o,a,!0);d&&(t.translate(e,i),this.beforeRenderStep(s,t,e,i,d,u,d,u,r,n),s.getFrameCache().draw(t,this.drawIcon),this.afterRenderStep(s,t,e,i,d,u,d,u,r,n))}drawIcon(s,t,e,i,n){var r;const a=at(s).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:d,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:c=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:_}=s.attribute,{backgroundWidth:m=o,backgroundHeight:v=l}=s.attribute;if(_&&(e+=s._marginArray[3],i+=s._marginArray[0]),s._hovered){const b=(m-o)/2,x=(v-l)/2;f===0?(t.beginPath(),t.rect(e-b,i-x,m,v)):(t.beginPath(),Co(t,e-b,i-x,m,v,f)),u&&(t.globalAlpha=c,t.fillStyle=u,t.fill()),p&&(t.globalAlpha=g,t.strokeStyle=p,t.stroke())}const y=d&&((r=s==null?void 0:s.resources)===null||r===void 0?void 0:r.get(d));y&&y.state==="success"&&(t.globalAlpha=h,t.drawImage(y.data,e,i,o,l))}draw(s,t,e){const i=at(s).richtext;this._draw(s,i,!1,e)}};yb=jV([ft(),zV("design:paramtypes",[])],yb);let Nw=!1;const HV=new Et(s=>{Nw||(Nw=!0,s(ub).to(yb).inSingletonScope(),s(Mi).toService(ub))});let Gw=!1;const NV=new Et(s=>{Gw||(Gw=!0,s(bw).to(ob).inSingletonScope(),s(Mi).toService(bw),s($y).toService(dn),Fi(s,$y))});var GV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let bb=class extends vs{constructor(){super(...arguments),this.type="rect3d",this.numberType=rS}drawShape(s,t,e,i,n,r,a,o){var l;const h=at(s,r==null?void 0:r.theme).rect3d,{fill:d=h.fill,stroke:u=h.stroke,x1:c,y1:p,x:g,y:f,opacity:_=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:b=h.visible}=s.attribute;let{width:x,height:S}=s.attribute;x=(x??c-g)||0,S=(S??p-f)||0;const A=(l=this.z)!==null&&l!==void 0?l:0,k=hS(_,m,x,S,d),w=uS(_,y,x,S),T=zo(d),M=qh(u,v);if(!s.valid||!b||!T&&!M||!(k||w||a||o))return;const{light:C,camera:R}=n.stage||{},I=s.findFace();if(d!==!1){t.setCommonStyle(s,s.attribute,e,i,h);let O=d;typeof O!="string"&&(O="black"),this.fill(e,i,A,I,O,t,C,a)}u!==!1&&(t.setStrokeStyle(s,s.attribute,e,i,h),this.stroke(e,i,A,I,t))}stroke(s,t,e,i,n){const r=i.vertices;i.edges.forEach(a=>{const o=r[a[0]],l={x:s+o[0],y:t+o[1],z:e+o[2]},h=r[a[1]],d={x:s+h[0],y:t+h[1],z:e+h[2]};n.beginPath(),n.moveTo(l.x,l.y,l.z),n.lineTo(d.x,d.y,d.z),n.stroke()})}fill(s,t,e,i,n,r,a,o){const l=Oe.Get(n,is.Color255),h=i.vertices,d=h.map(c=>r.view(c[0],c[1],c[2])[2]),u=[];i.polygons.forEach((c,p)=>{u.push({faceIdx:p,polygon:c});const{polygon:g,normal:f}=c,_=d[g[0]],m=d[g[1]],v=d[g[2]],y=d[g[3]];c.ave_z=_+m+v+y}),u.sort((c,p)=>p.polygon.ave_z-c.polygon.ave_z),u.forEach(c=>{const{polygon:p,normal:g}=c.polygon,f=h[p[0]],_=h[p[1]],m=h[p[2]],v=h[p[3]],y={x:s+f[0],y:t+f[1],z:e+f[2]},b={x:s+_[0],y:t+_[1],z:e+_[2]},x={x:s+m[0],y:t+m[1],z:e+m[2]},S={x:s+v[0],y:t+v[1],z:e+v[2]};r.beginPath(),r.moveTo(y.x,y.y,y.z),r.lineTo(b.x,b.y,b.z),r.lineTo(x.x,x.y,x.z),r.lineTo(S.x,S.y,S.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(g,l):n,r.fill())})}draw(s,t,e){const i=at(s).rect;this._draw(s,i,!1,e)}};bb=GV([ft()],bb);let Ww=!1;const WV=new Et(s=>{Ww||(Ww=!0,s(hb).to(bb).inSingletonScope(),s(Mi).toService(hb))});var VV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};function UV(s,t,e,i,n,r,a){const{startAngle:o,endAngle:l}=s.getParsedAngle(),h=Kt(l-o),d=l>o;let u=!1;if(r=jt-re)t.moveTo(e+r*de(o),i+r*se(o),n),t.arc(e,i,r,o,l,!d,n),a>re&&(t.moveTo(e+a*de(l),i+a*se(l),n),t.arc(e,i,a,l,o,d,n));else{const{outerDeltaAngle:c,innerDeltaAngle:p,outerStartAngle:g,outerEndAngle:f,innerEndAngle:_,innerStartAngle:m}=s.getParsePadAngle(o,l),v=r*de(g),y=r*se(g),b=a*de(_),x=a*se(_);c<.001?u=!0:(t.moveTo(e+v,i+y,n),t.arc(e,i,r,g,f,!d,n)),!(a>re)||p<.001?(t.lineTo(e+b,i+x,n),u=!0):(t.lineTo(e+b,i+x,n),t.arc(e,i,a,_,m,d,n))}return t.closePath(),u}function $V(s,t,e,i,n,r,a,o){const{startAngle:l,endAngle:h}=s.getParsedAngle(),d=Kt(h-l),u=h>l;let c=!1;if(a<=re)t.moveTo(e,i,n);else if(d>=jt-re)t.moveTo(e+a*de(l),i+a*se(l),n),t.arc(e,i,a,l,h,!u,n),t.lineTo(e+a*de(h),i+a*se(h),r),t.arc(e,i,a,h,l,u,r);else{const{innerouterDeltaAngle:p,innerouterStartAngle:g,innerouterEndAngle:f}=o(l,h),_=a*de(g),m=a*se(g),v=a*de(f),y=a*se(f);p<.001?c=!0:(t.moveTo(e+_,i+m,n),t.arc(e,i,a,g,f,!u,n),t.lineTo(e+v,i+y,r),t.arc(e,i,a,f,g,u,r))}return t.closePath(),c}let xb=class extends vs{constructor(){super(...arguments),this.numberType=Tc}drawShape(s,t,e,i,n,r,a,o){var l;const h=at(s,r==null?void 0:r.theme).arc,{fill:d=h.fill}=s.attribute,u=this.valid(s,h,a,o);if(!u)return;const{fVisible:c,sVisible:p,doFill:g,doStroke:f}=u,_=(l=this.z)!==null&&l!==void 0?l:0,{outerRadius:m=h.outerRadius,innerRadius:v=h.innerRadius,height:y=10}=s.attribute,b=Oe.Get(d,is.Color255),{light:x}=n.stage||{},S=n.hack_pieFace,A={top:_,bottom:_+y},k={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};S==="bottom"||S==="top"?(t.beginPath(),UV(s,t,e,i,A[S],m,v),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,h),g&&(a?a(t,s.attribute,h):c&&(t.setCommonStyle(s,s.attribute,e,i,h),t.fillStyle=x?x.computeColor(k[S],b):d,t.fill())),f&&(o?o(t,s.attribute,h):p&&(t.setStrokeStyle(s,s.attribute,e,i,h),t.stroke()))):S!=="outside"&&S!=="inside"||(S==="inside"&&(t.save(),t.beginPath(),t.arc(e,i,v,0,jt,!0,A.top),t.clip()),t.beginPath(),$V(s,t,e,i,A.top,A.bottom,S==="outside"?m:v,(w,T)=>{const{outerDeltaAngle:M,innerDeltaAngle:C,outerStartAngle:R,outerEndAngle:I,innerEndAngle:O,innerStartAngle:L}=s.getParsePadAngle(w,T);return S==="outside"?{innerouterDeltaAngle:M,innerouterEndAngle:I,innerouterStartAngle:R}:{innerouterDeltaAngle:C,innerouterEndAngle:O,innerouterStartAngle:L}}),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,h),g&&(a?a(t,s.attribute,h):c&&(t.setCommonStyle(s,s.attribute,e,i,h),t.fillStyle=x?x.computeColor(k[S],b):d,t.fill())),f&&(o?o(t,s.attribute,h):p&&(t.setStrokeStyle(s,s.attribute,e,i,h),t.stroke())),S==="inside"&&t.restore())}draw(s,t,e,i){const n=at(s,i==null?void 0:i.theme).arc;this._draw(s,n,!1,e,i)}};xb=VV([ft()],xb);let Vw=!1;const YV=new Et(s=>{Vw||(Vw=!0,s(lb).to(xb).inSingletonScope(),s(Mi).toService(lb))});var XV=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Sb=class extends vs{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=nS}drawShape(s,t,e,i,n,r,a,o){var l;const h=at(s,r==null?void 0:r.theme).polygon,{fill:d=h.fill,stroke:u=h.stroke,face:c=[!0,!0,!0,!0,!0,!0]}=s.attribute,p=(l=this.z)!==null&&l!==void 0?l:0;if(!this.valid(s,h,a,o))return;const{light:g,camera:f}=n.stage||{},_=s.findFace();if(d!==!1){t.setCommonStyle(s,s.attribute,e,i,h);let m=d;typeof m!="string"&&(m="black"),this.fill(e,i,p,_,c,m,t,g,f,s,h,a)}u!==!1&&(t.setStrokeStyle(s,s.attribute,e,i,h),this.stroke(e,i,p,_,t))}stroke(s,t,e,i,n){const r=i.vertices;i.edges.forEach(a=>{const o=r[a[0]],l=r[a[1]],h={x:s+o[0],y:t+o[1],z:e+o[2]},d={x:s+l[0],y:t+l[1],z:e+l[2]};n.beginPath(),n.moveTo(h.x,h.y,h.z),n.lineTo(d.x,d.y,d.z),n.stroke()})}fill(s,t,e,i,n,r,a,o,l,h,d,u){const c=Oe.Get(r,is.Color255),p=i.vertices,g=p.map(_=>a.view(_[0],_[1],_[2])[2]),f=[];i.polygons.forEach((_,m)=>{if(!n[m])return;f.push({faceIdx:m,polygon:_});const{polygon:v,normal:y}=_,b=g[v[0]],x=g[v[1]],S=g[v[2]],A=g[v[3]];_.ave_z=b+x+S+A}),f.sort((_,m)=>m.polygon.ave_z-_.polygon.ave_z),f.forEach(_=>{const{polygon:m,normal:v}=_.polygon,y=p[m[0]],b=p[m[1]],x=p[m[2]],S=p[m[3]],A={x:s+y[0],y:t+y[1],z:e+y[2]},k={x:s+b[0],y:t+b[1],z:e+b[2]},w={x:s+x[0],y:t+x[1],z:e+x[2]},T={x:s+S[0],y:t+S[1],z:e+S[2]};a.beginPath(),a.moveTo(A.x,A.y,A.z),a.lineTo(k.x,k.y,k.z),a.lineTo(w.x,w.y,w.z),a.lineTo(T.x,T.y,T.z),a.closePath(),u?u(a,h.attribute,d):(a.fillStyle=o?o.computeColor(v,c):r,a.fill())})}draw(s,t,e){const i=at(s).polygon;this._draw(s,i,!1,e)}};Sb=XV([ft()],Sb);let Uw=!1;const KV=new Et(s=>{Uw||(Uw=!0,s(cb).to(Sb).inSingletonScope(),s(Mi).toService(cb))});function qV(){_t.RegisterGraphicCreator("arc",mS)}function ZV(){_t.RegisterGraphicCreator("arc3d",SO)}function JV(){_t.RegisterGraphicCreator("area",xO)}function QV(){_t.RegisterGraphicCreator("circle",NN)}function tU(){_t.RegisterGraphicCreator("glyph",vO)}function eU(){_t.RegisterGraphicCreator("group",oS)}function iU(){_t.RegisterGraphicCreator("image",_S)}function sU(){_t.RegisterGraphicCreator("line",fS)}function nU(){_t.RegisterGraphicCreator("path",bO)}function rU(){_t.RegisterGraphicCreator("polygon",AO)}function aU(){_t.RegisterGraphicCreator("pyramid3d",kO)}function oU(){_t.RegisterGraphicCreator("rect",Ch)}function lU(){_t.RegisterGraphicCreator("rect3d",mO)}function hU(){_t.RegisterGraphicCreator("richtext",yO)}function dU(){_t.RegisterGraphicCreator("symbol",ym)}function uU(){_t.RegisterGraphicCreator("text",Mo)}function cU(){_t.RegisterGraphicCreator("shadowRoot",tW)}function pU(){_t.RegisterGraphicCreator("wrapText",GN)}const IO=SS(),ga=IO&&globalThis?globalThis.document:void 0;function rn(s){return(s==="desktop-browser"||s==="mobile-browser")&&IO}function Ga(s){return Wa(s)||s==="mobile-browser"}function Wa(s){return s.includes("miniApp")||s==="lynx"||s==="wx"}let v0=0;function No(){return v0>=9999999&&(v0=0),v0++}function rr(s){return s!=null&&s!==""&&(!!dt(s)||+s==+s)}function gU(s){if(N(s))return s;const t=+s;return N(t)?t:0}function Sl(s){return!(!s||s.length===0)&&!P(s[0])&&!P(s[0].dataId)&&$(s[0].fields)}const Go=(s,t,e)=>(s.fields=t||[],s.fname=e,s),fU=s=>t=>It(t,s),vo=s=>{Nt.getInstance().error(s)},_U=s=>{const t=[],e=s.length;let i,n,r,a=null,o=0,l="";s+="";const h=()=>{t.push(l+s.substring(i,n)),l="",i=n+1};for(i=0,n=0;ni&&h(),i=n+1,o=i):r==="]"&&(o||vo("Access path missing open bracket: "+s),o>0&&h(),o=0,i=n+1):n>i?h():i=n+1}return o&&vo("Access path missing closing bracket: "+s),a&&vo("Access path missing closing quote: "+s),n>i&&(n+=1,h()),t},$w=(s,t,e={})=>{if(K(s))return s;const i=_U(s),n=i.length===1?i[0]:s;return Go((e&&e.get||fU)(i),[n],n)},In=(s,t,e={})=>{if($(s)){const i=s.map(n=>$w(n,t,e));return n=>i.map(r=>r(n))}return $w(s,t,e)};In("id");const mU=Go(function(s){return s},[],"identity"),vU=Go(function(){return 0},[],"zero");Go(function(){return 1},[],"one");Go(function(){return!0},[],"true");Go(function(){return!1},[],"false");Go(function(){return{}},[],"emptyObject");const Ab=(s,t)=>{const e=K(t)?t:r=>r;let i,n;if(s&&s.length){const r=s.length;for(let a=0;a{if(t===e)return!0;if(P(t)||P(e))return P(t)&&P(e);if(!ny(t)&&!ny(e))return t===e;const n=$(t)?t:t[s],r=$(e)?e:e[s];return n===r||i!==!1&&($(r)?!(!$(n)||r.length!==n.length||!r.every((a,o)=>a===n[o])):!!$t(r)&&!(!$t(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every(a=>km(a,r,n))))},Ds=(s,t)=>P(s)?t:ht(s)?t*parseFloat(s)/100:s;function yU(s,t,e,i){const n=i-s*s,r=Math.abs(n)<1e-24?0:(e-s*t)/n;return[t-r*s,r]}function LO(s,t,e,i){let n,r,a=-1;s.forEach(o=>{n=t(o),r=e(o),!P(n)&&(n=+n)>=n&&!P(r)&&(r=+r)>=r&&i(n,r,++a)})}function bU(s,t,e,i,n){let r=0,a=0;return LO(s,t,e,(o,l)=>{const h=l-n(o),d=l-i;r+=h*h,a+=d*d}),1-r/a}function xU(s,t=i=>i.x,e=i=>i.y){let i=0,n=0,r=0,a=0,o=0;LO(s,t,e,(d,u)=>{++o,i+=(d-i)/o,n+=(u-n)/o,r+=(d*u-r)/o,a+=(d*d-a)/o});const l=yU(i,n,r,a),h=d=>l[0]+l[1]*d;return{coef:l,predict:h,rSquared:bU(s,t,e,n,h)}}function Di(s){return s==="horizontal"}function Yw(s){return s==="vertical"}var Ve;(function(s){s.Identity="identity",s.Linear="linear",s.Log="log",s.Pow="pow",s.Sqrt="sqrt",s.Symlog="symlog",s.Time="time",s.Quantile="quantile",s.Quantize="quantize",s.Threshold="threshold",s.Ordinal="ordinal",s.Point="point",s.Band="band"})(Ve||(Ve={}));const BO={};Object.values(Ve).forEach(s=>{BO[s]=!0});function qt(s){switch(s){case Ve.Linear:case Ve.Log:case Ve.Pow:case Ve.Sqrt:case Ve.Symlog:case Ve.Time:return!0;default:return!1}}function kb(s){return!!BO[s]}function ji(s){switch(s){case Ve.Ordinal:case Ve.Point:case Ve.Band:return!0;default:return!1}}function dl(s){return s}const SU=s=>s<0?-Math.sqrt(-s):Math.sqrt(s),AU=s=>s<0?-s*s:s*s,kU=s=>-Math.log(-s),wU=s=>-Math.exp(-s),TU=s=>isFinite(s)?Math.pow(10,s):s<0?0:s,Xw=s=>s===10?TU:s===Math.E?Math.exp:t=>Math.pow(s,t),Kw=s=>s===Math.E?Math.log:s===10?Math.log10:s===2?Math.log2:(s=Math.log(s),t=>Math.log(t)/s),qw=s=>t=>Math.sign(t)*Math.log1p(Math.abs(t/s)),Zw=s=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*s;function wb(s,t){if(s=Number(s),t=Number(t),t-=s)return i=>(i-s)/t;const e=Number.isNaN(t)?NaN:.5;return()=>e}function Jw(s,t,e){const i=s[0],n=s[1],r=t[0],a=t[1];let o,l;return nl(o(h))}function AS(s,t,e){let i;return i=s===1?s+2*e:s-t+2*e,s?i>0?i:1:0}function DO(s,t,e,i){return e===1&&(e=0),AS(s,e,i)*(t/(1-e))}function MU(s,t,e,i,n){const r=AS(s,e,i);let a=t/Math.max(1,r||1);n&&(a=Math.floor(a));let o=a*(1-e);return n&&(o=Math.round(o)),o}function FO(s,t){const e=(s[1]-s[0])/(t[1]-t[0]),i=s[0]-e*t[0];return[i,e+i]}function CU(s,t,e){const i=Math.min(s.length,t.length)-1,n=new Array(i),r=new Array(i);let a=-1;for(s[i]{const e=s.slice();let i=0,n=e.length-1,r=e[i],a=e[n];return a{const e=Math.floor(Math.log10(s)),i=s/Math.pow(10,e);let n;return n=t?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10,n*Math.pow(10,e)},PU=(s,t)=>{let e,i;return t[0]n>=0&&n<=1)&&(this._wholeRange=null,t[0]===0&&t[1]===1?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):E(this._rangeFactorStart)&&E(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return P(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,t!==0||!P(this._rangeFactorEnd)&&this._rangeFactorEnd!==1?(this._rangeFactorStart=t,this._rangeFactorEnd=(i=this._rangeFactorEnd)!==null&&i!==void 0?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return P(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,t!==0||!P(this._rangeFactorStart)&&this._rangeFactorStart!==0?(this._rangeFactorEnd=t,this._rangeFactorStart=(i=this._rangeFactorStart)!==null&&i!==void 0?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:n}=this._fishEyeOptions,r=this.range(),a=r[0],o=r[r.length-1],l=Math.min(a,o),h=Math.max(a,o),d=xi((t=this._fishEyeOptions.focus)!==null&&t!==void 0?t:0,l,h),u=P(n)?(h-l)*i:n;let c=Math.exp(e);c=c/(c-1)*u;const p=e/u;this._fishEyeTransform=g=>{const f=Math.abs(g-d);if(f>=u)return g;if(f<=1e-6)return d;const _=c*(1-Math.exp(-f*p))/f*.75+.25;return d+(g-d)*_}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Tb=Symbol("implicit");class Po extends HO{specified(t){var e;return t?(this._specified=Object.assign((e=this._specified)!==null&&e!==void 0?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Ve.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Tb}clone(){return new Po().domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&t.length===2?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(i!==void 0)return i;let n=this._index.get(e);if(!n){if(this._unknown!==Tb)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const r=this._ordinalRange[(n-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(r):r}invert(t){let e=0;for(;ee&&o>1;)o-=1,a=Math.floor((t-s)/o);let l=s;for(;l<=t;)r.push(l),l+=a;return n&&r.reverse(),r}function EU(s,t,e){const i=[];let n;if(t=Math.floor(+t),s=Math.floor(+s),e=Bx(1,t-s+1)(Math.floor(+e)),n=tthis._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=n,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DO(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),n=Math.min((t[1]-t[0])/i,1);if(E(this._rangeFactorStart)&&E(this._rangeFactorEnd)){if(i>0){const o=t[0]-i*this._rangeFactorStart,l=o+i;this._wholeRange=[o,l]}else{const o=t[1]+i*(1-this._rangeFactorEnd),l=o-i;this._wholeRange=[l,o]}const r=this._rangeFactorStart+n<=1,a=this._rangeFactorEnd-n>=0;e==="rangeFactorStart"&&r?this._rangeFactorEnd=this._rangeFactorStart+n:e==="rangeFactorEnd"&&a?this._rangeFactorStart=this._rangeFactorEnd-n:t[0]<=t[1]?r?this._rangeFactorEnd=this._rangeFactorStart+n:a?this._rangeFactorStart=this._rangeFactorEnd-n:(this._rangeFactorStart=0,this._rangeFactorEnd=n):a?this._rangeFactorStart=this._rangeFactorEnd-n:r?this._rangeFactorEnd=this._rangeFactorStart+n:(this._rangeFactorStart=1-n,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=n,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[Qn(t[0]),Qn(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[Qn(t[0]),Qn(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return t===-1?e:Qw(0,e.length-1,t,!1).map(i=>e[i])}tickData(t=10){return this.ticks(t).map((e,i)=>({index:i,tick:e,value:(this.scale(e)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])}))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Qw(0,e.length-1,t,!0).filter(i=>ie[i])}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return EU(0,e.length-1,t).map(i=>e[i])}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,r=this._domain.length,a=this.range(),o=a[0]>a[a.length-1];for(e=0;e=0&&e<=r-1?e:r-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return t!==void 0?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return t!==void 0?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return t!==void 0?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return t!==void 0?(this._round=t,this.rescale(e)):this._round}align(t,e){return t!==void 0?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return P(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return P(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?(t==="auto"?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth=t==="auto"?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth=t==="auto"?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&dt(this._userBandwidth)}clone(){var t,e,i;return new Wo(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth((t=this._userBandwidth)!==null&&t!==void 0?t:"auto",!0).maxBandwidth((e=this._maxBandwidth)!==null&&e!==void 0?e:"auto",!0).minBandwidth((i=this._maxBandwidth)!==null&&i!==void 0?i:"auto")}}const{interpolateRgb:y0}=Rj;function RU(s,t){const e=typeof t;let i;if(P(t)||e==="boolean")return()=>t;if(e==="number")return Wd(s,t);if(e==="string"){if(i=Qe.parseColorString(t)){const n=y0(Qe.parseColorString(s),i);return r=>n(r).formatRgb()}return Wd(Number(s),Number(t))}return t instanceof Bi?y0(s,t):t instanceof Qe?y0(s.color,t.color):t instanceof Date?vj(s,t):Wd(Number(s),Number(t))}class NO extends HO{constructor(t=dl,e=dl){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=dl,this._piecewise=Jw,this._interpolate=RU}calculateVisibleDomain(t){var e;return E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&t.length===2?[this.invert(t[0]),this.invert(t[1])]:(e=this._niceDomain)!==null&&e!==void 0?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise(((e=this._niceDomain)!==null&&e!==void 0?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),((e=this._niceDomain)!==null&&e!==void 0?e:this._domain).map(this.transformer),Wd)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return((i=this._niceDomain)!==null&&i!==void 0?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const n=Array.from(t,Qn);return this._domain=n,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=mj,this.rescale(e)}rescale(t){var e;if(t)return this;const i=(e=this._niceDomain)!==null&&e!==void 0?e:this._domain,n=i.length,r=this._range.length;let a=Math.min(n,r);if(n&&n=2?(l-i[n-2])/o:0;for(let d=1;d<=o;d++)i[n-2+d]=l-h*(o-d);a=r}return this._autoClamp&&(this._clamp=Bx(i[0],i[a-1])),this._piecewise=a>2?CU:Jw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:dl),this.rescale(i)):this._clamp!==dl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(e??[]).map((i,n)=>({index:n,tick:i,value:(this.scale(i)-this._range[0])/(this._range[1]-this._range[0])}))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return P(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return P(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const OU=Math.sqrt(50),IU=Math.sqrt(10),LU=Math.sqrt(2),jp=[1,2,5,10],tT=(s,t,e)=>{let i=1,n=s;const r=Math.floor((t-1)/2),a=Math.abs(s);return s>=0&&s<=Number.MIN_VALUE?n=0:s<0&&s>=-Number.MIN_VALUE?n=-(t-1):!e&&a<1?i=GO(a).step:(e||a>1)&&(n=Math.floor(s)-r*i),i>0?(s>0?n=Math.max(n,0):s<0&&(n=Math.min(n,-(t-1)*i)),pE(0,t).map(o=>n+o*i)):s>0?Mf(0,-(t-1)/i,i):Mf((t-1)/i,0,i)},BU=$h((s,t,e,i)=>{let n,r,a,o,l=-1;if(e=+e,(s=+s)==(t=+t))return[s];if(Math.abs(s-t)<=Number.MIN_VALUE&&e>0)return[s];if((n=t0){let h=Math.round(s/o),d=Math.round(t/o);for(h*ot&&--d,a=new Array(r=d-h+1);++lt&&--d,a=new Array(r=d-h+1);++l{let i,n,r=-1;if(e>0){let a=Math.floor(s/e),o=Math.ceil(t/e);for((a+1)*et&&--o,n=new Array(i=o-a+1);++rt&&--o,n=new Array(i=o-a+1);++r{let i;const n=s[0],r=s[s.length-1],a=t-s.length;if(r<=0){const h=[];for(i=a;i>=1;i--)h.push(n-i*e);return h.concat(s)}if(n>=0){for(i=1;i<=a;i++)s.push(r+i*e);return s}let o=[];const l=[];for(i=1;i<=a;i++)i%2==0?o=[n-Math.floor(i/2)*e].concat(o):l.push(r+Math.ceil(i/2)*e);return o.concat(s).concat(l)},Cf=$h((s,t,e,i)=>{let n,r,a;if(e=+e,(s=+s)==(t=+t)||Math.abs(s-t)<=Number.MIN_VALUE&&e>0)return tT(s,e,i==null?void 0:i.noDecimals);(n=t0){let h=1;const{power:d,gap:u}=o,c=u===10?2*10**d:1*10**d;for(;h<=5&&(r=Mf(s,t,l),r.length>e+1)&&e>2;)l+=c,h+=1;e>2&&r.length{const t=Math.floor(Math.log(s)/Math.LN10),e=s/10**t;let i=jp[0];return e>=OU?i=jp[3]:e>=IU?i=jp[2]:e>=LU&&(i=jp[1]),t>=0?{step:i*10**t,gap:i,power:t}:{step:-(10**-t)/i,gap:i,power:t}};function kS(s,t,e){const i=(t-s)/Math.max(0,e);return GO(i)}function WO(s,t,e){let i;if(e=+e,(s=+s)==(t=+t)&&e>0)return[s];if(e<=0||(i=FU(s,t,e))===0||!isFinite(i))return[];const n=new Array(e);for(let r=0;r0;){if(i=kS(a,o,t).step,i===e)return s[n]=a,s[r]=o,s;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function wS(s,t){const e=dt(t.forceMin),i=dt(t.forceMax);let n=null;const r=[];let a=null;const o=e&&i?l=>l>=t.forceMin&&l<=t.forceMax:e?l=>l>=t.forceMin:i?l=>l<=t.forceMax:null;return e?r[0]=t.forceMin:dt(t.min)&&t.min<=Math.min(s[0],s[s.length-1])&&(r[0]=t.min),i?r[1]=t.forceMax:dt(t.max)&&t.max>=Math.max(s[0],s[s.length-1])&&(r[1]=t.max),dt(r[0])&&dt(r[1])?(a=s.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=dt(r[0])||dt(r[1])?dt(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const x0=(s,t,e)=>Math.abs(t-s)<1?+e.toFixed(1):Math.round(+e),VO=$h((s,t,e,i,n,r,a)=>{let o=s,l=t;const h=l0){for(;c<=p;++c)for(d=1;dl)break;g.push(u)}}else for(;c<=p;++c)for(d=i-1;d>=1;--d)if(u=c>0?d/r(-c):d*r(c),!(ul)break;g.push(u)}2*g.lengthf!==0),a!=null&&a.noDecimals&&(g=Array.from(new Set(g.map(f=>Math.floor(f))))),h?g.reverse():g}),UO=$h((s,t,e,i,n,r)=>{const a=[],o={},l=n(s),h=n(t);let d=[];if(Number.isInteger(i))d=Cf(l,h,e);else{const u=(h-l)/(e-1);for(let c=0;c{const c=r(u),p=Number.isInteger(i)?x0(s,t,c):x0(s,t,zO(c)),g=x0(s,t,PU(p,[s,t]));!o[g]&&!isNaN(g)&&d.length>1&&(o[g]=1,a.push(g))}),a}),Pf=$h((s,t,e,i,n)=>WO(i(s),i(t),e).map(r=>zO(n(r))));class un extends NO{constructor(){super(...arguments),this.type=Ve.Linear}clone(){return new un().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return BU(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&this._range.length===2||!this._niceType)return this.d3Ticks(t,e);const n=(i=this._niceDomain)!==null&&i!==void 0?i:this._domain,r=this._domain,a=n[0],o=n[n.length-1];let l=Cf(r[0],r[r.length-1],t,e);if(!l.length)return l;if(this._domainValidator)l=l.filter(this._domainValidator);else if((l[0]!==a||l[l.length-1]!==o)&&this._niceType){const h=n.slice();if(this._niceType==="all"?(h[0]=l[0],h[h.length-1]=l[l.length-1],this._niceDomain=h,this.rescale()):this._niceType==="min"&&l[0]!==a?(h[0]=l[0],this._niceDomain=h,this.rescale()):this._niceType==="max"&&l[l.length-1]!==o&&(h[h.length-1]=l[l.length-1],this._niceDomain=h,this.rescale()),this._niceType!=="all"){const d=Math.min(h[0],h[h.length-1]),u=Math.max(h[0],h[h.length-1]);l=l.filter(c=>c>=d&&c<=u)}}return l}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return WO(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return jU(e[0],e[e.length-1],t)}nice(t=10,e){var i,n;const r=this._domain;let a=[];if(e){const o=wS(r,e);if(a=o.niceMinMax,this._domainValidator=o.domainValidator,this._niceType=o.niceType,o.niceDomain)return this._niceDomain=o.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const o=b0(r.slice(),t);this._niceType==="min"?o[o.length-1]=(i=a[1])!==null&&i!==void 0?i:o[o.length-1]:this._niceType==="max"&&(o[0]=(n=a[0])!==null&&n!==void 0?n:o[0]),this._niceDomain=o,this.rescale()}return this}niceMin(t=10){this._niceType="min";const e=this._domain[this._domain.length-1],i=b0(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(t=10){this._niceType="max";const e=this._domain[0],i=b0(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function eT(s){return t=>-s(-t)}function iT(s=Number.EPSILON){return t=>Math.max(t,s)}function zU(s=Number.EPSILON){return t=>Math.min(t,-s)}class TS extends NO{constructor(){super(Kw(10),Xw(10)),this.type=Ve.Log,this._limit=iT(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return new TS().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=Kw(this._base),n=Xw(this._base);return((e=this._niceDomain)!==null&&e!==void 0?e:this._domain)[0]<0?(this._logs=eT(i),this._pows=eT(n),this._limit=zU(),this.transformer=kU,this.untransformer=wU):(this._logs=i,this._pows=n,this._limit=iT(),this.transformer=this._logs,this.untransformer=n),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise(((e=this._niceDomain)!==null&&e!==void 0?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return dl}d3Ticks(t=10,e){const i=this.domain(),n=this._limit(i[0]),r=this._limit(i[i.length-1]);return VO(n,r,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return UO(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Pf(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Pf(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(t=10,e){var i,n;const r=this._domain;let a=[],o=null;if(e){const l=wS(r,e);if(a=l.niceMinMax,this._domainValidator=l.domainValidator,o=l.niceType,l.niceDomain)return this._niceDomain=l.niceDomain,this.rescale(),this}else o="all";if(o){const l=jO(r.slice(),{floor:h=>this._pows(Math.floor(this._logs(this._limit(h)))),ceil:h=>Math.abs(h)>=1?Math.ceil(h):this._pows(Math.ceil(this._logs(this._limit(h))))});return o==="min"?l[l.length-1]=(i=a[1])!==null&&i!==void 0?i:l[l.length-1]:o==="max"&&(l[0]=(n=a[0])!==null&&n!==void 0?n:l[0]),this._niceDomain=l,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class HU extends Wo{constructor(t){super(!1),this.type=Ve.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Ef extends un{constructor(){super(SU,AU),this.type=Ve.Sqrt}clone(){return new Ef().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class MS extends un{constructor(){super(qw(1),Zw(1)),this.type=Ve.Symlog,this._const=1}clone(){return new MS().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=qw(t),this.untransformer=Zw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),n=i[0],r=i[i.length-1];return VO(n,r,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return UO(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Pf(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Pf(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(t=10,e){var i,n;const r=this._domain;let a=[],o=null;if(e){const l=wS(r,e);if(a=l.niceMinMax,this._domainValidator=l.domainValidator,o=l.niceType,l.niceDomain)return this._niceDomain=l.niceDomain,this.rescale(),this}else o="all";if(o){const l=jO(r.slice(),{floor:h=>Math.floor(h),ceil:h=>Math.ceil(h)});return o==="min"?l[l.length-1]=(i=a[1])!==null&&i!==void 0?i:l[l.length-1]:o==="max"&&(l[0]=(n=a[0])!==null&&n!==void 0?n:l[0]),this._niceDomain=l,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class CS{constructor(){this.type=Ve.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!P(t)&&N(+t)?this._range[fE(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return new CS().domain(this._domain).range(this._range).unknown(this._unknown)}}const sT=5,PS=(s,t,e,i)=>new yi(Object.assign({defaultFontParams:Object.assign({fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14},i),getTextBounds:e?void 0:Ec,specialCharSet:`-/: .,@%'"~`+yi.ALPHABET_CHAR_SET+yi.ALPHABET_CHAR_SET.toUpperCase()},t??{}),s);function ES(s){for(;s<0;)s+=2*Math.PI;for(;s>=2*Math.PI;)s-=2*Math.PI;return s}function $O(s){let t="center",e="middle";return t=(s=ES(s))>=Math.PI*(5/3)||s<=Math.PI*(1/3)?"left":s>=Math.PI*(2/3)&&s<=Math.PI*(4/3)?"right":"center",e=s>=Math.PI*(7/6)&&s<=Math.PI*(11/6)?"bottom":s>=Math.PI*(1/6)&&s<=Math.PI*(5/6)?"top":"middle",{align:t,baseline:e}}const nr=s=>s.map((t,e)=>({index:e,value:t})),nT=(s,t,e=0)=>{const i=new Le(s).expand(e/2),n=new Le(t).expand(e/2);return i.intersects(n)};function YO(s,t,e){return e>Math.max(t.x1-s.x2,s.x1-t.x2,t.y1-s.y2,s.y1-t.y2)}function NU(s,t){for(let e,i=1,n=s.length,r=s[0];i{var i;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=e;let h=(i=n.angle)!==null&&i!==void 0?i:0;n.direction==="vertical"&&(h+=ue(90));const d=["bottom","top"].includes(r),u=["left","right"].includes(r);let c=1,p=0;d||(u?(c=0,p=1):l&&(c=Math.cos(l),p=-Math.sin(l)));const g=PS(n);return t.map((_,m)=>{var v,y;const b=o?o(_):`${_}`,{width:x,height:S}=g.quickMeasure(b),A=Math.max(x,12),k=Math.max(S,12),w=s.scale(_),T=c*w,M=p*w;let C,R,I=T,O=M;C=a&&d&&m===0?"left":a&&d&&m===t.length-1?"right":(v=n.textAlign)!==null&&v!==void 0?v:"center",C==="right"?I-=A:C==="center"&&(I-=A/2),R=a&&u&&m===0?"top":a&&u&&m===t.length-1?"bottom":(y=n.textBaseline)!==null&&y!==void 0?y:"middle",R==="bottom"?O-=k:R==="middle"&&(O-=k/2);const L=new Le().set(I,O,I+A,O+k);return h&&L.rotate(h,T,M),L})},GU=(s,t,e)=>{var i;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o}=e,l=r==null?void 0:r(),h=(i=n.angle)!==null&&i!==void 0?i:0,d=PS(n);return t.map(u=>{const c=o?o(u):`${u}`,{width:p,height:g}=d.quickMeasure(c),f=Math.max(p,12),_=Math.max(g,12),m=s.scale(u);let v=0,y=0;const b=$O(m),{x,y:S}=xn({x:0,y:0},l+a,m);return v=x+(b.align==="right"?-f:b.align==="center"?-f/2:0),y=S+(b.baseline==="bottom"?-_:b.baseline==="middle"?-_/2:0),new Le().set(v,y,v+f,y+_).rotate(h,v+f/2,y+_/2)})},WU=s=>["bottom","top","z"].includes(s),VU=(s,t)=>{if(!qt(s.type))return nr(s.domain());const e=s.range(),i=Math.abs(e[e.length-1]-e[0]);if(i<2)return nr([s.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=t;let h;if(E(a))h=s.stepTicks(a);else if(E(r))h=s.forceTicks(r);else if(t.tickMode==="d3"){const d=K(n)?n({axisLength:i,labelStyle:l}):n;h=s.d3Ticks(d??sT,{noDecimals:o})}else{const d=K(n)?n({axisLength:i,labelStyle:l}):n;h=s.ticks(d??sT,{noDecimals:o})}if(t.sampling&&(t.coordinateType==="cartesian"||t.coordinateType==="polar"&&t.axisOrientType==="radius")){const{labelGap:d=4,labelFlush:u}=t;let c=XO(s,h,t).map((g,f)=>({AABBBounds:g,value:h[f]}));for(;c.length>=3&&NU(c,d);)c=UU.parity(c);const p=c.map(g=>g.value);p.length<3&&u&&(p.length>1&&p.pop(),Ma(p)!==Ma(h)&&p.push(Ma(h))),h=p}return nr(h)},UU={parity:function(s){return s.filter((t,e)=>e%2==0)},greedy:function(s,t){let e;return s.filter((i,n)=>(!n||!YO(e.AABBBounds,i.AABBBounds,t))&&(e=i,!0))}},rT=(s,t)=>KO(0,s.length,e=>t(s[e])),KO=(s,t,e)=>{let i=s,n=t;for(;i=0?n=r:i=r+1}return i},aT=(s,t,e,i)=>XO(s,t,e).map(n=>i?[n.x1,n.x2,n.width()]:[n.y1,n.y2,n.height()]),oT=(s,t,e=0)=>Math.max(s[0],t[0])-e/2<=Math.min(s[1],t[1])+e/2,lT=(s,t)=>s[1]{var e;const i=s.domain();if(!i.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=t,d=WU(l),u=s.range(),c=s.calculateWholeRangeSize();if(c<2)return t.labelLastVisible?nr([i[i.length-1]]):nr([i[0]]);let p;if(E(a))p=s.stepTicks(a);else if(E(r))p=s.forceTicks(r);else if(E(n)){const g=K(n)?n({axisLength:c,labelStyle:h}):n;p=s.ticks(g)}else if(t.sampling){const g=((e=t.labelStyle.fontSize)!==null&&e!==void 0?e:12)+2,f=ki(u),_=ei(u);if(i.length<=c/g){const m=(_-f)/i.length,v=aT(s,i,t,d),y=Math.min(...v.map(x=>x[2])),b=YU(i,v,o,t.labelLastVisible,Math.floor(y/m));p=s.stepTicks(b.step),t.labelLastVisible&&(b.delCount&&(p=p.slice(0,p.length-b.delCount)),p.push(i[i.length-1]))}else{const m=[i[0],i[Math.floor(i.length/2)],i[i.length-1]],v=aT(s,m,t,d);let y=null;v.forEach(x=>{y?y[2]0?Math.ceil(i.length*(o+y[2])/(_-f-o)):i.length-1;p=s.stepTicks(b),!t.labelLastVisible||p.length&&p[p.length-1]===i[i.length-1]||(p.length&&Math.abs(s.scale(p[p.length-1])-s.scale(i[i.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const d=p=>{let g=!0,f=0;do f+pd(p)?1:-1);let c=u;do if(c>u&&!d(c))c++;else{if(!i){o=c;break}{const p=s.length-1;let g,f=0;g=s.length%c>0?s.length-s.length%c+c:s.length;do{if(g-=c,g!==p&&!oT(t[g],t[p],e))break;f++}while(g>0);if(g===p){o=c,a=f;break}{const _=Math.floor(s.length/c)-f+1;if(_=0?lT(t[g-c],t[g]):m,y=Math.abs(m-v);if(y{const{tickCount:e,forceTickCount:i,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=t,h=r==null?void 0:r();if(!h)return nr(s.domain());let d;if(E(n))d=s.stepTicks(n);else if(E(i))d=s.forceTicks(i);else if(E(e)){const u=s.range(),c=Math.abs(u[u.length-1]-u[0]),p=K(e)?e({axisLength:c,labelStyle:l}):e;d=s.ticks(p)}else if(t.sampling){const u=s.domain(),c=s.range(),p=GU(s,u,t),g=ki(c),f=ei(c),_=Math.abs(f-g)*(h+a)/u.length,{step:m,delCount:v}=KU(u,p,o,Math.floor(p.reduce((y,b)=>Math.min(y,b.width(),b.height()),Number.MAX_VALUE)/_));d=s.stepTicks(m),d=d.slice(0,d.length-v)}else d=s.domain();return nr(d)},KU=(s,t,e,i)=>{let n=i;do{let a=!0;n++;let o=0;do o+n2){let a=s.length-s.length%n;for(a>=s.length&&(a-=n);a>0&&nT(t[0],t[a]);)r++,a-=n}return{step:n,delCount:r}},qU=(s,t)=>{if(qt(s.type))return VU(s,t);if(ji(s.type)){if(t.coordinateType==="cartesian")return $U(s,t);if(t.coordinateType==="polar"&&t.axisOrientType==="angle")return XU(s,t)}return nr(s.domain())},pg=(s,t,e)=>{if(P(t))return s;const i=t[0];return P(i)?s:t.length===1?(s[i]=e,s):(P(s[i])&&(typeof t[1]=="number"?s[i]=[]:s[i]={}),pg(s[i],t.slice(1),e))},ZU=(s,t,e)=>{if(!P(t))return It(s,t,e)};function fa(s){return s.radius?{x:Math.cos(s.angle)*s.radius,y:Math.sin(s.angle)*s.radius}:{x:0,y:0}}function JU(s){return(s=ES(s))>0&&s<=Math.PI/2?2:s>Math.PI/2&&s<=Math.PI?3:s>Math.PI&&s<=3*Math.PI/2?4:1}function QU(s,t){let e=0,i=2*Math.PI;const n=E(s),r=E(t);for(n||r?r?n?(e=s,i=t):(e=t-2*Math.PI,i=t):(e=s,i=s+2*Math.PI):(e=0,i=2*Math.PI);i<=e;)i+=2*Math.PI;for(;e>2*Math.PI;)e-=2*Math.PI,i-=2*Math.PI;for(;i<0;)e+=2*Math.PI,i+=2*Math.PI;return{startAngle:e,endAngle:i}}function t4(s,t,e){return s.x1>t||s.x2e||s.y2{const n=+i[t];N(n)&&e.push(n)}),e.length===0?null:ki(e)}function RS(s,t){const e=[];return s.forEach(i=>{const n=+i[t];N(n)&&e.push(n)}),e.length===0?null:ei(e)}function ZO(s,t){return s.reduce((e,i)=>{const n=t?+i[t]:+i;return N(n)&&(e+=n),e},0)}function JO(s,t){let e=0,i=0;return s.forEach(n=>{const r=t?+n[t]:+n;N(r)&&(e+=r,i++)}),e/i}function QO(s,t){const e=JO(s,t);return s.length<=1?0:s.reduce((n,r)=>n+(t?+r[t]:+r-e)**2,0)/(s.length-1)}function e4(s,t){return Math.sqrt(QO(s,t))}function i4(s,t){return gj(s.map(e=>e[t]))}function s4(s,t,e){const{predict:i}=xU(s,l=>l[t],l=>l[e]),n=qO(s,t),r=RS(s,t),a=i(n),o=i(r);return[{[t]:n,[e]:a},{[t]:r,[e]:o}]}function n4(s){let t="center",e="middle";return t=(s=ES(s))>=Math.PI*(7/6)&&s<=Math.PI*(11/6)?"right":s>=Math.PI*(1/6)&&s<=Math.PI*(5/6)?"left":"center",e=s>=Math.PI*(5/3)||s<=Math.PI*(1/3)?"bottom":s>=Math.PI*(2/3)&&s<=Math.PI*(4/3)?"top":"middle",{align:t,baseline:e}}function hT(s,t){const e=Rf(s),i=Rf(t),n=Math.asin((s.x*t.y-t.x*s.y)/e/i),r=Math.acos((s.x*t.x+s.y*t.y)/e/i);return n<0?-r:r}function Rf(s,t={x:0,y:0}){return ze.distancePP(s,t)}function Ie(s,t,e){let i=!1;if(t&&K(t)){for(const n of s)for(const r of n.getSeries(e))if(i=!!t.call(null,r),i)return i}return i}function r4(s,t){const e=[];for(const i of s)for(const n of i.getSeries(t))e.push(n);return e}const OS=(s,t)=>{for(let e=0;ei==null?void 0:i[n],t):t==null?void 0:t[s],e}}var z;(function(s){s.area="area",s.line="line",s.bar="bar",s.bar3d="bar3d",s.rangeColumn="rangeColumn",s.rangeColumn3d="rangeColumn3d",s.rangeArea="rangeArea",s.dot="dot",s.geo="geo",s.link="link",s.map="map",s.pie="pie",s.pie3d="pie3d",s.radar="radar",s.rose="rose",s.scatter="scatter",s.circularProgress="circularProgress",s.wordCloud="wordCloud",s.wordCloud3d="wordCloud3d",s.funnel="funnel",s.funnel3d="funnel3d",s.linearProgress="linearProgress",s.boxPlot="boxPlot",s.sankey="sankey",s.gaugePointer="gaugePointer",s.gauge="gauge",s.treemap="treemap",s.sunburst="sunburst",s.circlePacking="circlePacking",s.waterfall="waterfall",s.heatmap="heatmap",s.correlation="correlation"})(z||(z={}));var dT;(function(s){s.label="label",s.point="point",s.line="line",s.area="area",s.bar="bar",s.bar3d="bar3d",s.boxPlot="boxPlot",s.outlier="outlier",s.circlePacking="circlePacking",s.group="group",s.gridBackground="gridBackground",s.grid="grid",s.dot="dot",s.title="title",s.subTitle="subTitle",s.symbol="symbol",s.funnel="funnel",s.funnel3d="funnel3d",s.transform="transform",s.transform3d="transform3d",s.transformLabel="transformLabel",s.outerLabel="outerLabel",s.outerLabelLine="outerLabelLine",s.pin="pin",s.pinBackground="pinBackground",s.pointer="pointer",s.segment="segment",s.track="track",s.cell="cell",s.cellBackground="cellBackground",s.link="link",s.arrow="arrow",s.pie="pie",s.pie3d="pie3d",s.labelLine="labelLine",s.progress="progress",s.minLabel="minLabel",s.maxLabel="maxLabel",s.rose="rose",s.node="node",s.sunburst="sunburst",s.nonLeaf="nonLeaf",s.leaf="leaf",s.nonLeafLabel="nonLeafLabel",s.leaderLine="leaderLine",s.stackLabel="stackLabel",s.word="word",s.fillingWord="fillingWord",s.nodePoint="nodePoint",s.ripplePoint="ripplePoint",s.centerPoint="centerPoint",s.centerLabel="centerLabel",s.barBackground="barBackground",s.lineLabel="lineLabel",s.areaLabel="areaLabel"})(dT||(dT={}));const At="__VCHART",Al=500,kl=500,a4=`${At}_LABEL_VISIBLE`,S0=`${At}_ARC_TRANSFORM_VALUE`,tI=`${At}_ARC_RATIO`,uT=`${At}_ARC_START_ANGLE`,cT=`${At}_ARC_END_ANGLE`,o4=`${At}_ARC_K`,Pr=`${At}_ARC_MIDDLE_ANGLE`,l4=`${At}_ARC_QUADRANT`,h4=`${At}_ARC_RADIAN`,wm=-Math.PI/2,IS=3*Math.PI/2,Jd=-90,fg=270,ju=.6,ra=9,ks=0;var Zn;(function(s){s.enter="enter",s.update="update",s.exit="exit",s.group="group"})(Zn||(Zn={}));var ne;(function(s){s.enter="enter",s.update="update",s.exit="exit",s.unChange="unChange"})(ne||(ne={}));var rt;(function(s){s.arc="arc",s.arc3d="arc3d",s.area="area",s.image="image",s.line="line",s.path="path",s.rect="rect",s.rect3d="rect3d",s.rule="rule",s.shape="shape",s.symbol="symbol",s.text="text",s.richtext="richtext",s.polygon="polygon",s.pyramid3d="pyramid3d",s.circle="circle",s.cell="cell",s.interval="interval",s.group="group",s.glyph="glyph",s.component="component",s.largeRects="largeRects",s.largeSymbols="largeSymbols"})(rt||(rt={}));var be;(function(s){s.axis="axis",s.grid="grid",s.legend="legend",s.slider="slider",s.label="label",s.datazoom="datazoom",s.player="player",s.title="title",s.scrollbar="scrollbar"})(be||(be={}));var pT;(function(s){s[s.player=1]="player",s[s.rollUp=2]="rollUp",s[s.drillDown=3]="drillDown",s[s.slider=4]="slider",s[s.datazoom=5]="datazoom",s[s.legend=6]="legend",s[s.scrollbar=7]="scrollbar",s[s.brush=8]="brush",s[s.normal=9]="normal"})(pT||(pT={}));var tr;(function(s){s.lineAxis="lineAxis",s.circleAxis="circleAxis"})(tr||(tr={}));var mi;(function(s){s.lineAxisGrid="lineAxisGrid",s.circleAxisGrid="circleAxisGrid"})(mi||(mi={}));var gT;(function(s){s.discreteLegend="discreteLegend",s.colorLegend="colorLegend",s.sizeLegend="sizeLegend"})(gT||(gT={}));var fT;(function(s){s.lineCrosshair="lineCrosshair",s.rectCrosshair="rectCrosshair",s.sectorCrosshair="sectorCrosshair",s.circleCrosshair="circleCrosshair",s.polygonCrosshair="polygonCrosshair",s.ringCrosshair="ringCrosshair"})(fT||(fT={}));var _T;(function(s){s.symbolLabel="symbolLabel",s.rectLabel="rectLabel",s.lineLabel="lineLabel",s.dataLabel="dataLabel"})(_T||(_T={}));var mT;(function(s){s.continuousPlayer="continuousPlayer",s.discretePlayer="discretePlayer"})(mT||(mT={}));var Ys;(function(s){s.before="before",s.layouting="layouting",s.reevaluate="reevaluate",s.after="after"})(Ys||(Ys={}));var gt;(function(s){s.BEFORE_EVALUATE_DATA="beforeEvaluateData",s.AFTER_EVALUATE_DATA="afterEvaluateData",s.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",s.AFTER_EVALUATE_SCALE="afterEvaluateScale",s.BEFORE_PARSE_VIEW="beforeParseView",s.AFTER_PARSE_VIEW="afterParseView",s.BEFORE_TRANSFORM="beforeTransform",s.AFTER_TRANSFORM="afterTransform",s.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",s.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",s.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",s.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",s.BEFORE_STAGE_RESIZE="beforeStageResize",s.AFTER_STAGE_RESIZE="afterStageResize",s.BEFORE_VRENDER_DRAW="beforeVRenderDraw",s.AFTER_VRENDER_DRAW="afterVRenderDraw",s.BEFORE_MARK_JOIN="beforeMarkJoin",s.AFTER_MARK_JOIN="afterMarkJoin",s.BEFORE_MARK_UPDATE="beforeMarkUpdate",s.AFTER_MARK_UPDATE="afterMarkUpdate",s.BEFORE_MARK_STATE="beforeMarkState",s.AFTER_MARK_STATE="afterMarkState",s.BEFORE_MARK_ENCODE="beforeMarkEncode",s.AFTER_MARK_ENCODE="afterMarkEncode",s.BEFORE_DO_LAYOUT="beforeDoLayout",s.AFTER_DO_LAYOUT="afterDoLayout",s.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",s.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",s.BEFORE_DO_RENDER="beforeDoRender",s.AFTER_DO_RENDER="afterDoRender",s.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",s.AFTER_MARK_RENDER_END="afterMarkRenderEnd",s.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",s.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",s.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",s.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",s.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",s.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",s.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",s.BEFORE_ELEMENT_STATE="beforeElementState",s.AFTER_ELEMENT_STATE="afterElementState",s.BEFORE_ELEMENT_ENCODE="beforeElementEncode",s.AFTER_ELEMENT_ENCODE="afterElementEncode",s.ANIMATION_START="animationStart",s.ANIMATION_END="animationEnd",s.ELEMENT_ANIMATION_START="elementAnimationStart",s.ELEMENT_ANIMATION_END="elementAnimationEnd",s.ALL_ANIMATION_START="allAnimationStart",s.ALL_ANIMATION_END="allAnimationEnd"})(gt||(gt={}));var Mb;(function(s){s.signal="signal",s.data="data",s.scale="scale",s.coordinate="coordinate",s.mark="mark"})(Mb||(Mb={}));var vT;(function(s){s.active="active",s.selected="selected",s.highlight="highlight",s.blur="blur"})(vT||(vT={}));const Eo="__vgrammar_scene_item__",eI=[rt.line,rt.area],d4=[rt.arc3d,rt.rect3d,rt.pyramid3d],er="key",_g=[{}],u4=["key"],c4=!0,p4=!0,g4=!1,f4=null,_4=!0,yT="VGRAMMAR_IMMEDIATE_ANIMATION",bT=0,iI=1e3,Cb=0,xT=0,ST=!1,Pb=!1,Eb="quintInOut",AT={stopWhenStateChange:!1,immediatelyApply:!0},m4="VGRAMMAR_ANIMATION_PARAMETERS";function LS(s,t){return Y(s).reduce((e,i)=>{const n=ht(i)?t.getGrammarById(i):i;return n&&e.push(n),e},[])}function v4(s){return!K(s)&&!!(s!=null&&s.signal)}function y4(s){return!K(s)&&!!(s!=null&&s.callback)}function Ki(s,t){if(P(s))return[];if(v4(s)){const e=s.signal;if(ht(e))return Y(t.getGrammarById(e));if((e==null?void 0:e.grammarType)==="signal")return[e]}else if(y4(s))return LS(s.dependency,t);return[]}function _a(s){return K(s)||(s==null?void 0:s.signal)||!!(s!=null&&s.callback)}function Ue(s,t,e,i){if(P(s))return s;if(K(s))return i?s.call(null,e,i,t):s.call(null,e,t);if(s.signal){const n=s.signal;return ht(n)?t==null?void 0:t[n]:n.output()}return s.callback?i?s.callback.call(null,e,i,t):s.callback.call(null,e,t):s}function A0(s,t){if(P(s))return s;if(K(s))return s.call(null,t);if(s.signal){const e=s.signal;return ht(e)?t==null?void 0:t[e]:e.output()}return s.callback?s.callback.call(null,t):s}function zu(s,t){return Oc(s)?s.output():t[s]}function b4(s){return s&&(s.signal||s.callback)}const Oc=s=>s&&!P(s.grammarType),lh=s=>K(s)?s:t=>t[s];function Tm(s){return!!(s!=null&&s.scale)}function BS(s){return!!(s!=null&&s.field)}function no(s,t){if(!s)return[];let e=[];return s.scale&&(e=Oc(s.scale)?[s.scale]:Y(t.getScaleById(s.scale))),e.concat(Ki(s,t))}function Of(s,t){switch(t){case"line":return s.some(e=>["x","y","defined"].includes(e));case"area":return s.some(e=>["x","y","x1","y1","defined"].includes(e));case"largeRects":return s.some(e=>["x","y","width","y1"].includes(e));case"largeSymbols":return s.some(e=>["x","y"].includes(e))}return!1}function x4(s){const{x:t,y:e,x1:i,y1:n}=s;return N(t)&&N(e)&&N(i)&&N(n)?[{x:t,y:e},{x:i,y:n}]:[]}function S4(s,t,e,i){return!s||!s.length||s.length===1&&t?[]:s.some(n=>Of(Object.keys(n.nextAttrs),"line"))?s.map((n,r)=>{var a;const o=n.nextAttrs,{x:l,y:h,x1:d,y1:u,defined:c}=(a=e==null?void 0:e[r])!==null&&a!==void 0?a:{};return P(o.x)&&(o.x=l),P(o.y)&&(o.y=h),P(o.defined)&&c===!1&&(o.defined=!1),o.context=n.key,i&&(P(o.x1)&&(o.x1=d),P(o.y1)&&(o.y1=u)),o}):e??[]}function A4(s,t,e=[]){if(!s||!s.length||s.length===1&&t)return[];const i=new Float32Array(4*s.length);return s.forEach((n,r)=>{var a,o,l,h;const d=n.nextAttrs,u=(a=d.x)!==null&&a!==void 0?a:e[4*r],c=(o=d.y)!==null&&o!==void 0?o:e[4*r+1],p=(l=d.width)!==null&&l!==void 0?l:e[4*r+2],g=(h=d.y1)!==null&&h!==void 0?h:e[4*r+3];i[4*r]=u,i[4*r+1]=c,i[4*r+2]=p,i[4*r+3]=g-c}),i}function k4(s,t,e=[]){if(!s||!s.length||s.length===1&&t)return[];const i=new Float32Array(2*s.length);return s.forEach((n,r)=>{var a,o;const l=n.nextAttrs,h=(a=l.x)!==null&&a!==void 0?a:e[2*r],d=(o=l.y)!==null&&o!==void 0?o:e[2*r+1];i[2*r]=h,i[2*r+1]=d}),i}function If(s,t){if(["x","y","dx","dy"].includes(t))return!0;switch(s){case rt.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(t);case rt.group:case rt.rect:case rt.image:return["width","height","y1"].includes(t);case rt.path:case rt.shape:return["path","customPath"].includes(t);case rt.line:return t==="defined";case rt.area:return["x1","y1","defined"].includes(t);case rt.rule:return["x1","y1"].includes(t);case rt.symbol:return t==="size";case rt.polygon:return t==="points";case rt.text:return t==="text"}return!1}function w4(s){return[rt.line,rt.area,rt.largeRects,rt.largeSymbols].includes(s)}class T4{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return ht(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let st=class $e{static registerPlotMarks(t,e){$e._plotMarks[t]=e}static createPlotMark(t,e){return $e._plotMarks[t]?new $e._plotMarks[t](e):null}static registerMark(t,e){$e._marks[t]=e}static createMark(t,e,i){return $e._marks[t]?new $e._marks[t](e,t,i):null}static hasMark(t){return!!$e._marks[t]}static registerComponent(t,e){$e._components[t]=e}static createComponent(t,e,i,n){const r=$e._components[t];return r?new r(e,i,n):null}static hasComponent(t){return!!$e._components[t]}static registerGraphicComponent(t,e){$e._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const n=$e._graphicComponents[t];return n?n(e,i):null}static registerTransform(t,e,i){$e._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return $e._transforms[t]}static unregisterRuntimeTransforms(){Object.keys($e._transforms).forEach(t=>{$e._transforms[t]&&!$e._transforms[t].isBuiltIn&&($e._transforms[t]=null)})}static registerGrammar(t,e,i){$e._grammars[t]={grammarClass:e,specKey:i??t}}static createGrammar(t,e,i){var n;const r=(n=$e._grammars[t])===null||n===void 0?void 0:n.grammarClass;return r?new r(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return $e._glyphs[t]}static createInteraction(t,e,i){const n=$e._interactions[t];return n?new n(e,i):null}};st._plotMarks={},st._marks={},st._components={},st._graphicComponents={},st._transforms={},st._grammars={},st._glyphs={},st._animations={},st._interactions={},st._graphics={},st.registerGlyph=(s,t,e,i,n)=>(st._glyphs[s]=new T4(t,e,i,n),st._glyphs[s]),st.registerAnimationType=(s,t)=>{st._animations[s]=t},st.getAnimationType=s=>st._animations[s],st.registerInteraction=(s,t)=>{st._interactions[s]=t},st.registerGraphic=(s,t)=>{st._graphics[s]=t},st.getGraphicType=s=>st._graphics[s],st.createGraphic=(s,t)=>{const e=st._graphics[s];return e?e(t):null};function xr(s,t,e,i,n){e&&(_a(e)?t.forEach(r=>{const a=Ue(e,i,r.datum,s);Object.assign(r.nextAttrs,a)}):Object.keys(e).forEach(r=>{var a,o;const l=e[r],h=n&&!If(s.mark.markType,r)?[t[0]]:t;if(Tm(l)){const d=zu(l.scale,i),u=(a=l==null?void 0:l.offset)!==null&&a!==void 0?a:0,c=!P(l.band)&&d.bandwidth?d.bandwidth()*l.band:null,p=ht(l==null?void 0:l.field),g=p?In(l.field):null;let f=p?null:P(l==null?void 0:l.value)?0:(o=d.scale)===null||o===void 0?void 0:o.call(d,l.value);h.forEach(_=>{var m;p&&(f=(m=d.scale)===null||m===void 0?void 0:m.call(d,g(_.datum))),_.nextAttrs[r]=dt(f)||dt(c)?f+u+c:f})}else if(BS(l)){const d=In(l.field);h.forEach(u=>{u.nextAttrs[r]=d(u.datum)})}else h.forEach(d=>{d.nextAttrs[r]=Ue(l,i,d.datum,s)})}))}function yo(s,t,e,i){if(!s)return null;if(_a(s))return Ue(s,i,t,e);const n={};return Object.keys(s).forEach(r=>{var a,o,l;const h=s[r];if(Tm(h)){const d=zu(h.scale,i),u=(a=h==null?void 0:h.offset)!==null&&a!==void 0?a:0,c=!P(h.band)&&d.bandwidth?d.bandwidth()*h.band:null,p=ht(h==null?void 0:h.field),g=p?In(h.field):null,f=p?(o=d.scale)===null||o===void 0?void 0:o.call(d,g(t)):P(h==null?void 0:h.value)?0:(l=d.scale)===null||l===void 0?void 0:l.call(d,h.value);n[r]=dt(f)||dt(c)?f+u+c:f}else if(BS(h)){const d=In(h.field);n[r]=d(t)}else n[r]=Ue(h,i,t,e)}),n}function M4(s,t,e){if(_a(t))return{themeEncoder:{},positionEncoder:t};const i={},n={};if(s===rt.glyph&&st.getGlyph(e)){const r=st.getGlyph(e),a=r.getProgressiveChannels();if(a)Object.keys(t).forEach(o=>{a.includes(o)?n[o]=t[o]:i[o]=t[o]});else{const o=Array.from(new Set(Object.values(r.getMarks())));Object.keys(t).forEach(l=>{o.some(h=>If(h,l))?n[l]=t[l]:i[l]=t[l]})}}else Object.keys(t).forEach(r=>{If(s,r)?n[r]=t[r]:i[r]=t[r]});return{positionEncoder:n,themeEncoder:i}}const sI=s=>!!rt[s];function Qd(s,t,e={}){var i;const n=st.getGraphicType(t)?st.createGraphic(t,e):st.createGraphicComponent(t,e,{skipDefault:(i=s==null?void 0:s.spec)===null||i===void 0?void 0:i.skipTheme});return n||Nt.getInstance().error(`create ${t} graphic failed!`),n}function C4(s,t,e={}){if(!st.getGraphicType(rt.glyph))return;const i=st.createGraphic(rt.glyph,e),n=t.getMarks(),r=Object.keys(n).map(a=>{if(st.getGraphicType(n[a])){const o=st.createGraphic(n[a]);if(o)return o.name=a,o}});return i.setSubGraphic(r),i}const Lf=s=>{s&&(s[Eo]=null,s.release(),s.parent&&s.parent.removeChild(s))},kT=["fillOpacity"],wT=(s,t,e)=>{var i;return t==="fillOpacity"?(s.fillOpacity=(i=e.fillOpacity)!==null&&i!==void 0?i:1,["fillOpacity"]):[]};function P4(s,t,e,i,n,r){const a=n.getGraphicAttribute(s,!1,r);if(a)return t.forEach(l=>{l in i&&(a[l]=i[l])}),a;const o={};return t.forEach(l=>{o[l]=i[l]}),e[s]=o,o}const Ro={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(s,t,e)=>{var i,n,r,a,o,l,h,d,u,c,p,g;N(t.width)||!N(t.x1)&&N(e.width)?(s.x=Math.min((i=e.x)!==null&&i!==void 0?i:0,(n=e.x1)!==null&&n!==void 0?n:1/0),s.width=e.width):N(t.x1)||!N(t.width)&&N(e.x1)?(s.x=Math.min(e.x,e.x1),s.width=Math.abs(e.x1-e.x)):(s.x=Math.min((r=e.x)!==null&&r!==void 0?r:0,(a=e.x1)!==null&&a!==void 0?a:1/0),s.width=e.width),N(t.height)||!N(t.y1)&&N(e.height)?(s.y=Math.min((o=e.y)!==null&&o!==void 0?o:0,(l=e.y1)!==null&&l!==void 0?l:1/0),s.height=e.height):N(t.y1)||!N(t.height)&&N(e.y1)?(s.y=Math.min(e.y,e.y1),s.height=Math.abs(e.y1-e.y)):(s.y=Math.min((h=e.y)!==null&&h!==void 0?h:0,(d=e.y1)!==null&&d!==void 0?d:1/0),s.height=e.height),N(t.length)||!N(t.z1)&&N(e.length)?(s.z=Math.min((u=e.z)!==null&&u!==void 0?u:0,(c=e.z1)!==null&&c!==void 0?c:1/0),s.length=e.length):N(t.z1)||!N(t.length)&&N(e.z1)?(s.z=Math.min(e.z,e.z1),s.length=Math.abs(e.z1-e.z)):(s.z=Math.min((p=e.z)!==null&&p!==void 0?p:0,(g=e.z1)!==null&&g!==void 0?g:1/0),s.length=e.length)},storedAttrs:"sizeAttrs"}],[rt.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(s,t,e)=>{var i,n,r,a;const o=(i=e.limit)!==null&&i!==void 0?i:1/0,l=(n=e.autoLimit)!==null&&n!==void 0?n:1/0,h=Math.min(o,l),d=Rn(e.text)&&!P(e.text.text),u=d?e.text.text:e.text;s.maxLineWidth=h===1/0?e.maxLineWidth:h,d?e.text.type==="html"?(s.html={dom:u,width:(r=t.width)!==null&&r!==void 0?r:h,height:(a=t.height)!==null&&a!==void 0?a:t.fontSize,anchorType:"position"},s.text=""):e.text.type==="rich"?s.textConfig=u:s.text=u:s.text=u},storedAttrs:"limitAttrs"}],[rt.rule]:[{channels:["x","y","x1","y1"],transform:(s,t,e)=>{const i=x4(e);s.points=i,s.x=0,s.y=0},storedAttrs:"pointAttrs"}],[rt.symbol]:[{channels:["shape","symbolType"],transform:(s,t,e)=>{var i;s.symbolType=(i=t.shape)!==null&&i!==void 0?i:t.symbolType}},{channels:["image","fill","background"],transform:(s,t,e)=>{t.image?(s.background=t.image,s.fill=!1):e.image?(s.background=e.image,s.fill=!1):(s.fill=e.fill,s.background=e.background)},storedAttrs:"imageAttrs"}],[rt.richtext]:[{channels:["text","textConfig"],transform:(s,t,e)=>{var i,n,r,a;s.text=null,((i=t.text)===null||i===void 0?void 0:i.type)==="rich"?s.textConfig=t.text.text:((n=t.textConfig)===null||n===void 0?void 0:n.type)==="html"?(s.html={dom:t.textConfig.text,width:t.width,height:(r=t.height)!==null&&r!==void 0?r:t.fontSize,anchorType:"position"},s.text=""):((a=t.textConfig)===null||a===void 0?void 0:a.type)==="rich"?s.textConfig=t.textConfig.text:s.textConfig=t.textConfig}}]};function E4(s,t){var e;return((e=Ro[s])!==null&&e!==void 0?e:[]).reduce((i,n)=>(n.channels.forEach(r=>{Zs(t,r)&&(i[r]=t[r])}),i),{})}const Hu=(s,t,e,i)=>{const n={},r=t?Object.keys(t):[],a=ht(s)?Ro[s]:s;if(a&&a.length){const o=[];r.forEach(l=>{let h=!1;a.forEach((d,u)=>{if(d.channels.includes(l)){if(!o[u])if(d.storedAttrs){const c=P4(d.storedAttrs,d.channels,n,t,e,i);d.transform(n,t,c)}else d.transform(n,t,null);o[u]=!0,h=!0}}),h||(kT.includes(l)?wT(n,l,t):n[l]=t[l])})}else r.forEach(o=>{kT.includes(o)?wT(n,o,t):n[o]=t[o]});return n},R4=(s,t)=>{var e,i;if(s===t)return!0;const n=(e=s&&s.length)!==null&&e!==void 0?e:0;return n===((i=t&&t.length)!==null&&i!==void 0?i:0)&&n!==0&&s.every((r,a)=>!r&&!t[a]||r&&t[a]&&r.color===t[a].color&&r.offset===t[a].offset)},O4=(s,t)=>{if(s===t)return!0;if(typeof s!=typeof t||ht(s)||s.gradient!==t.gradient)return!1;const e=Object.keys(s),i=Object.keys(t);return e.length===i.length&&e.every(n=>n==="stops"?R4(s[n],t[n]):s[n]===t[n])},I4=(s,t)=>s.length===t.length&&s.join("-")===t.join("-"),L4=(s,t,e)=>!(!P(s)||!P(t))||!P(s)&&!P(t)&&(e==="lineDash"?I4(s,t):e==="stroke"||e==="fill"?O4(s,t):s===t),B4=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"],nI=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],D4=B4.concat(nI);function F4(s,t,e){var i;if(!s||s.length<=1)return null;const n=((i=e==null?void 0:e.mark)===null||i===void 0?void 0:i.markType)==="area"?D4:nI,r=[];let a=null;return s.forEach((o,l)=>{a&&n.every(h=>L4(a[h],o[h],h))||(r.length&&(r[r.length-1].endIndex=l),a=o,r.push({attrs:a,startIndex:l}))}),r.length>=2?r.map(o=>{const l=Hu(rt.line,rI(o.attrs),e);return l.points=t.slice(o.startIndex,P(o.endIndex)?t.length:o.endIndex),l}):null}function j4(s){return s?s.reduce((t,e)=>t.concat(e.points),[]):null}function rI(s){const t={};return s&&Object.keys(s).forEach(e=>{e!=="x"&&e!=="y"&&e!=="x1"&&e!=="y1"&&e!=="defined"&&e!=="size"&&e!=="width"&&e!=="height"&&e!=="context"&&(t[e]=s[e])}),t}let aI=class{constructor(t){this.data=null,this.states=[],this.diffState=ne.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(e,i)=>{var n,r,a;const o=!P((n=this.runtimeStatesEncoder)===null||n===void 0?void 0:n[e]),l=o?this.runtimeStatesEncoder[e]:(r=this.mark.getSpec().encode)===null||r===void 0?void 0:r[e];if(!l)return{};if(K(l))return l(this.getDatum(),this,e,i);if(!o&&(!((a=this.graphicItem.states)===null||a===void 0)&&a[e]))return this.graphicItem.states[e];const h=this.items.map(u=>Object.assign({},u,{nextAttrs:{}}));xr(this,h,l,this.mark.parameters());const d=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[e]||(this.graphicItem.states[e]=d):this.graphicItem.states={[e]:d},d},this.mark=t}initGraphicItem(t={}){if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?Hu(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[Eo]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=i=>this.mark?Hu(e,i,this):i),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(t){if(!this.graphicItem)return;P(t.clip)||this.graphicItem.setAttribute("clip",t.clip),P(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),P(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===ne.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=this.mark.animate.getAnimationConfigs("state");e.length!==0&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&((e=(t=this.graphicItem.animates)===null||t===void 0?void 0:t.forEach)===null||e===void 0||e.call(t,i=>i.stop())),this.graphicItem&&(Lf(this.graphicItem),this.graphicItem[Eo]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return(t=this.graphicItem)===null||t===void 0?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var n;this.mark.emit(gt.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const r=lh(i);return this.items=e.map(a=>({datum:a,key:r(a),view:this.mark.view,nextAttrs:{}})),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:(n=this.items)===null||n===void 0?void 0:n[0].key,this.mark.emit(gt.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),r=this.states,a=Y(Ue(t,e,this.getDatum(),this)),o=(i=this.mark.getSpec())===null||i===void 0?void 0:i.stateSort;o&&o.sort(o);const l=a.length!==r.length||a.some((h,d)=>h!==r[d]);this.states=a,!n&&l&&this.diffState===ne.unChange&&(this.diffState=ne.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==ne.enter&&this.diffState!==ne.update||!this.states.length||this.useStates(this.states),this.mark.markType===rt.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach(i=>{i.nextAttrs={}}),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=(t=this.mark.getSpec())===null||t===void 0?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=i=>e(this.data,i,new ai))}encodeItems(t,e,i=!1,n){const r=this.mark.isCollectionMark(),a=e[Zn.update],o=e[Zn.enter],l=e[Zn.exit],h=this.mark.isLargeMode()||r&&!this.mark.getSpec().enableSegments;this.diffState===ne.enter?(o&&xr(this,t,o,n,h),a&&xr(this,t,a,n,h)):this.diffState===ne.update?((r&&o||i)&&xr(this,t,o,n,h),a&&xr(this,t,a,n,h)):this.diffState===ne.exit&&l&&(i&&xr(this,t,o,n,h),xr(this,t,l,n,h))}coordinateTransformEncode(t){if(!this.mark.coord||this.mark.markType==="arc"||this.mark.disableCoordinateTransform===!0)return;const e=this.mark.coord.output();t.forEach(i=>{const n=i.nextAttrs,r=e.convert(n);Object.assign(n,r)})}clearStates(t){const e=ye(t)?t:this.mark.animate.getAnimationConfigs("state").length!==0;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&ht(t)&&!Se(e,(i=this.runtimeStatesEncoder)===null||i===void 0?void 0:i[t])){const a=this.states.slice();return a.includes(t)?this.graphicItem.clearStates():a.push(t),this._updateRuntimeStates(t,e),this.useStates(a),!0}const n=this.mark.getSpec().encode,r=Y(t).reduce((a,o)=>(o&&!a.includes(o)&&(n!=null&&n[o])&&a.push(o),a),this.states.slice());return r.length!==this.states.length&&(this.useStates(r),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter(n=>!e.includes(n));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach(n=>{this.runtimeStatesEncoder[n]=null}),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(gt.BEFORE_ELEMENT_STATE,{states:t},this);const n=(i=this.mark.getSpec())===null||i===void 0?void 0:i.stateSort;n&&t.sort(n),this.states=t;const r=ye(e)?e:this.mark.animate.getAnimationConfigs("state").length!==0;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(gt.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)km(n,i,t)&&Zs(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,r,a,o;const l=t[0];if(!l.nextAttrs||Object.keys(l.nextAttrs).length===0)return{};let h=l.nextAttrs;if(w4(e)&&t&&t.length&&P((n=l.nextAttrs)===null||n===void 0?void 0:n.points)&&(i===!0||Of(Object.keys(l.nextAttrs),this.mark.markType))){const d=this.getGraphicAttribute("points",!1),u=this.getGraphicAttribute("segments",!1),c=this.mark.getSpec().enableSegments,p=t.map(f=>f.nextAttrs),g=this.mark.isProgressive();if(h=rI(h),e===rt.line||e===rt.area){const f=S4(t,!0,d,e===rt.area);if(c&&!g){const _=f&&f.length!==0?f:j4(u),m=F4(p,_,this);m?(h.segments=m,h.points=null):(h.segments=null,h.points=_)}else g?h.segments=((o=(a=(r=this.graphicItem)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.segments)!==null&&o!==void 0?o:[]).concat([{points:f}]):(h.points=f,h.segments=null)}else e===rt.largeRects?h.points=A4(t,!0,d):e===rt.largeSymbols&&(h.points=k4(t,!0,d))}return h}applyGraphicAttributes(t){var e,i;if(!vt(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=(e=this.getPrevGraphicAttributes())!==null&&e!==void 0?e:{},a=(i=this.getFinalGraphicAttributes())!==null&&i!==void 0?i:{};Object.keys(n).forEach(h=>{r[h]=this.getGraphicAttribute(h),a[h]=n[h]}),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=this.mark.animate.getElementAnimators(this).reduce((h,d)=>Object.assign(h,d.getEndAttributes()),{}),l=Object.assign({},o,a);this.graphicItem.setAttributes(l)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t,e=!1){var i;if(!this.graphicItem)return;if(e){let a;const o=this.getPrevGraphicAttributes();if(!P(a=It(o,t)))return a}const n=this.mark.getAttributeTransforms();let r=[t];if(n&&n.length){const a=n.find(o=>o.storedAttrs&&o.channels.includes(t));a&&(r=[a.storedAttrs,t])}return It((i=this.graphicItem)===null||i===void 0?void 0:i.attribute,r)}setGraphicAttribute(t,e,i=!0){if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),r=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),r&&!Zs(r,t)&&(r[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t,e=!0){if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach(r=>{i&&e&&(i[r]=t[r]),n&&!Zs(n,r)&&(n[r]=this.graphicItem.attribute[r])}),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(Lf(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(!((e=this.items)===null||e===void 0)&&e.length)return this.mark.isCollectionMark()?P(t)?this.items.map(n=>n.nextAttrs):this.items.map(n=>{var r;return(r=n.nextAttrs)===null||r===void 0?void 0:r[t]}):P(t)?this.items[0].nextAttrs:(i=this.items[0].nextAttrs)===null||i===void 0?void 0:i[t]}setItemAttributes(t){var e;!((e=this.items)===null||e===void 0)&&e.length&&(this.mark.isCollectionMark()?$(t)&&this.items.forEach((i,n)=>{Object.assign(i.nextAttrs,t[n])}):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?(t=this.items)!==null&&t!==void 0?t:[]:(e=this.items)===null||e===void 0?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?(t=this.data)!==null&&t!==void 0?t:[]:(e=this.data)===null||e===void 0?void 0:e[0]}};const TT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class gi extends Kh{constructor(t,e){super(t),e!=null&&e.mode&&(this.mode=e.mode,this.setMode(e.mode)),e!=null&&e.skipDefault&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(()=>{this.render(),this.bindEvents()})}setAttribute(t,e,i){Rn(this.attribute[t])&&Rn(e)&&!K(this.attribute[t])&&!K(e)?lt(this.attribute[t],e):this.attribute[t]=e,TT.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every(n=>TT.includes(n))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){P(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.target,n=this.rootNode,r=i===n;if(i&&!r){let l=function(d){if(o||(d.type="dragstart",i==null||i.dispatchEvent(d),o=!0),d.type="drag",i==null||i.dispatchEvent(d),!r){i.pickable=!1;const u=(n==null?void 0:n.pick(d.global.x,d.global.y)).graphic;i.pickable=!0,a!==u&&(a&&(d.type="dragleave",d.target=a,a.dispatchEvent(d)),u&&(d.type="dragenter",d.target=u,u.dispatchEvent(d)),a=u,a&&(d.type="dragover",d.target=a,a.dispatchEvent(d)))}},a,o=!1;n==null||n.addEventListener("pointermove",l);const h=function(){o&&(a&&(e.type="drop",e.target=a,a.dispatchEvent(e)),e.type="dragend",i.dispatchEvent(e),o=!1),n==null||n.removeEventListener("pointermove",l)};i.addEventListener("pointerup",h,{once:!0}),i.addEventListener("pointerupoutside",h,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;(t=this.rootNode)===null||t===void 0||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;(t=this.rootNode)===null||t===void 0||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const MT=(s,t)=>{const e=t.x-s.x,i=t.y-s.y;return Math.abs(e)>Math.abs(i)?e>0?"right":"left":i>0?"down":"up"},zp=(s,t)=>{const e=Math.abs(t.x-s.x),i=Math.abs(t.y-s.y);return Math.sqrt(e*e+i*i)},H4=s=>{const t=s.length;if(t===1)return{x:Math.round(s[0].x),y:Math.round(s[0].y)};let e=0,i=0,n=0;for(;n{this.reset(),this.startTime=po.now();const{cachedEvents:g,startPoints:f}=this;p&&g.push(p.clone()),f.length=g.length;for(let _=0;_