@next2d/player 1.17.2 → 1.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/next2d.min.js +1 -1
- package/index.js +1 -1
- package/package.json +18 -18
package/dist/next2d.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";let t=0;const e=()=>t++;let i=0,s=null;const r=(t=null)=>{s=t};let n="";const a=t=>{n=t};let h=null;const o=()=>h,l=(t=null)=>{h=t};let c=1;const _=()=>c,$=window,u=$.document,d=RegExp;class g{constructor(t="",e=""){this._$name=`${t}`,this._$value=`${e}`}static toString(){return"[class URLRequestHeader]"}static get namespace(){return"next2d.net.URLRequestHeader"}toString(){return"[object URLRequestHeader]"}get namespace(){return"next2d.net.URLRequestHeader"}get name(){return this._$name}get value(){return this._$value}}let f=1,p=0,m=!1;const x=(t=!0)=>{m=t},b=1/0,v=Math,T=Array,y=Map,E=Number,A=Float32Array,M=Int32Array,S=Int16Array,w=OffscreenCanvas,C=isNaN,F=requestAnimationFrame,R=cancelAnimationFrame,B=performance,I=setTimeout,L=clearTimeout,P=new A([1,0,0,1,0,0]),O=new A([1,1,1,1,0,0,0,0]),k=-32768,N=32767,D=v.PI/180,U=180/v.PI,V=[],G=[],z=[],Y=[],X=[],q=[],H=[],j=[],W=new w(1,1).getContext("2d"),K=(t=0,e=0,i=0,s=0)=>{const r=j.pop()||{xMin:0,xMax:0,yMin:0,yMax:0};return r.xMin=t,r.xMax=e,r.yMin=i,r.yMax=s,r},Q=t=>{j.push(t)},J=(t=0,e=0,i=0,s=0)=>{const r=G.pop()||new A(4);return r[0]=t,r[1]=e,r[2]=i,r[3]=s,r},Z=t=>{G.push(t)},tt=(t=0,e=0,i=0,s=0,r=0,n=0)=>{const a=z.pop()||new A(6);return a[0]=t,a[1]=e,a[2]=i,a[3]=s,a[4]=r,a[5]=n,a},et=t=>{z.push(t)},it=(t=1,e=1,i=1,s=1,r=0,n=0,a=0,h=0)=>{const o=Y.pop()||new A(8);return o[0]=t,o[1]=e,o[2]=i,o[3]=s,o[4]=r,o[5]=n,o[6]=a,o[7]=h,o},st=t=>{Y.push(t)},rt=(t=0,e=0,i=0,s=0,r=0,n=0,a=0,h=0,o=0)=>{const l=X.pop()||new A(9);return l[0]=t,l[1]=e,l[2]=i,l[3]=s,l[4]=r,l[5]=n,l[6]=a,l[7]=h,l[8]=o,l},nt=(...t)=>{const e=q.pop()||[];return t.length&&e.push(...t),e},at=(t=null)=>{t&&(t.length&&(t.length=0),q.push(t))},ht=t=>{t.size&&t.clear(),H.push(t)},ot=()=>H.pop()||new y,lt=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t),ct=t=>{const e=-819.2*t[0]-819.2*t[2]+t[4],i=819.2*t[0]-819.2*t[2]+t[4],s=-819.2*t[0]+819.2*t[2]+t[4],r=-819.2*t[1]-819.2*t[3]+t[5],n=819.2*t[1]-819.2*t[3]+t[5];let a=s-e,h=-819.2*t[1]+819.2*t[3]+t[5]-r;const o=v.sqrt(a*a+h*h);o?(a/=o,h/=o):(a=0,h=0);const l=(i-e)*a+(n-r)*h;return J(e+l*a,r+l*h,i,n)},_t=t=>{const e=1/(t[0]*t[4]-t[3]*t[1]),i=t[3]*t[7]-t[4]*t[6],s=t[1]*t[6]-t[0]*t[7];return rt(t[4]*e,0-t[1]*e,0,0-t[3]*e,t[0]*e,0,i*e,s*e,1)},$t=(t,e,i,s=null)=>{const r=+t;return C(r)&&null!==s?s:v.min(v.max(e,C(r)?0:r),i)},ut=(t,e)=>tt(t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]),dt=(t,e)=>it(t[0]*e[0],t[1]*e[1],t[2]*e[2],t[3]*e[3],t[0]*e[4]+t[4],t[1]*e[5]+t[5],t[2]*e[6]+t[6],t[3]*e[7]+t[7]),gt=(t,e)=>{const i=t.xMax*e[0]+t.yMax*e[2]+e[4],s=t.xMax*e[0]+t.yMin*e[2]+e[4],r=t.xMin*e[0]+t.yMax*e[2]+e[4],n=t.xMin*e[0]+t.yMin*e[2]+e[4],a=t.xMax*e[1]+t.yMax*e[3]+e[5],h=t.xMax*e[1]+t.yMin*e[3]+e[5],o=t.xMin*e[1]+t.yMax*e[3]+e[5],l=t.xMin*e[1]+t.yMin*e[3]+e[5],c=v.min(E.MAX_VALUE,i,s,r,n),_=v.max(0-E.MAX_VALUE,i,s,r,n),$=v.min(E.MAX_VALUE,a,h,o,l),u=v.max(0-E.MAX_VALUE,a,h,o,l);return K(c,_,$,u)},ft=t=>{if(!W)return 0;W.fillStyle=t;const e=+`0x${W.fillStyle.slice(1)}`;return W.fillStyle="rgba(0, 0, 0, 1)",e},pt=t=>C(+t)?ft(`${t}`):+t,mt=t=>({A:t>>>24,R:(16711680&t)>>16,G:(65280&t)>>8,B:255&t}),xt=(t,e,i)=>(t>>16)*(i?e:1)/255,bt=(t,e,i)=>(t>>8&255)*(i?e:1)/255,vt=(t,e,i)=>(255&t)*(i?e:1)/255,Tt=(t,e=1)=>({R:(16711680&t)>>16,G:(65280&t)>>8,B:255&t,A:255*e}),yt=(t,e,i=!1,s=!1)=>{let r="";return i&&(r="italic "),s&&(r+="bold "),`${r}${e}px '${t}','sans-serif'`},Et=t=>{t.color&&st(t.color),t.isLayer=!1,t.isUpdated=null,t.canApply=null,t.matrix=null,t.color=null,t.filters=null,t.blendMode="normal",t.sw=0,t.sh=0,V.push(t)};new Map([[1,"normal"],[2,"layer"],[3,"multiply"],[4,"screen"],[5,"lighten"],[6,"darken"],[7,"difference"],[8,"add"],[9,"subtract"],[10,"invert"],[11,"alpha"],[12,"erase"],[13,"overlay"],[14,"hardlight"]]);const At=new class{constructor(){this._$pool=[],this._$store=new Map,this._$timerMap=new Map,this._$context=null}set context(t){this._$context=t}reset(){for(const t of this._$store.values()){for(const e of t.values())this.destroy(e);ht(t)}this._$store.clear(),this._$context&&this._$context.frameBuffer.clearCache()}destroy(t=null){if(t&&"object"==typeof t)if(t instanceof WebGLTexture)F((()=>{this._$context&&this._$context.frameBuffer.releaseTexture(t)}));else{if("canvas"in t&&t instanceof CanvasRenderingContext2D){const e=t.canvas,i=e.width,s=e.height;t.clearRect(0,0,i+1,s+1),e.width=e.height=1,this._$pool.push(e)}this._$context&&"index"in t&&this._$context.frameBuffer.textureManager.releasePosition(t)}}getCanvas(){return this._$pool.pop()||document.createElement("canvas")}remove(t,e){if(!this._$store.has(t))return;const i=this._$store.get(t);i.has(e)&&(i.delete(e),i.size||(ht(i),this._$store.delete(t)))}stopTimer(t){t=`${t}`,this._$timerMap.has(t)&&(L(this._$timerMap.get(t)),this._$timerMap.delete(t))}removeCache(t){if(t=`${t}`,this._$store.has(t)){const e=this._$store.get(t);for(const t of e.values())this.destroy(t);e.clear(),ht(e),this._$store.delete(t)}this._$timerMap.delete(t)}setRemoveTimer(t){if(t=`${t}`,this.stopTimer(t),this._$store.has(t)){const e=I((()=>{this.removeCache(t)}),5e3);this._$timerMap.set(t,e)}}get(t){const e=`${t[0]}`,i=`${t[1]}`;if(this._$store.has(e)){this.stopTimer(e);const t=this._$store.get(e);if(t.has(i))return t.get(i)}return null}set(t,e=null){const i=`${t[0]}`,s=`${t[1]}`;this._$store.has(i)||this._$store.set(i,ot());const r=this._$store.get(i);if(null===e){if(!r.has(s))return;return this.destroy(r.get(s)),r.delete(s),void(r.size||(ht(r),this._$store.delete(i)))}r.set(s,e)}has(t){const e=`${t[0]}`;return!!this._$store.has(e)&&this._$store.get(e).has(`${t[1]}`)}generateKeys(t,e=null,i=null){let s="";e&&e.length&&(s+=`${e[0]}_${e[1]}`),i&&i.length&&(s+=0===i[7]?"":`_${i[7]}`);const r=nt();if(s){let t=0;const e=s.length;for(let i=0;i<e;i++)t=(t<<5)-t+s.charCodeAt(i),t|=0;r[1]=`_${t}`}else r[1]="_0";return r[0]=`${t}`,r}};class Mt{constructor(t=""){this._$url=`${t}`,this._$contentType="application/json",this._$data="",this._$method="GET",this._$requestHeaders=nt(),this._$responseDataFormat="json",this._$withCredentials=!1}static toString(){return"[class URLRequest]"}static get namespace(){return"next2d.net.URLRequest"}toString(){return"[object URLRequest]"}get namespace(){return"next2d.net.URLRequest"}get contentType(){return this._$contentType}set contentType(t){this._$contentType=`${t}`}get data(){return this._$data}set data(t){this._$data=t}get method(){return this._$method}set method(t){this._$method=`${t}`}get requestHeaders(){return this._$requestHeaders}set requestHeaders(t){this._$requestHeaders.length=0,this._$requestHeaders.push(...t)}get url(){if(this._$url&&-1===this._$url.indexOf("//")){const t=this._$url.split("/");""!==t[0]&&"."!==t[0]||t.shift();const e=ar();if(e)return`${e.base}${t.join("/")}`}return this._$url}set url(t){this._$url=`${t}`}get responseDataFormat(){return this._$responseDataFormat}set responseDataFormat(t){this._$responseDataFormat=`${t}`}get withCredentials(){return this._$withCredentials}set withCredentials(t){this._$withCredentials=t}get headers(){const t=nt();return t.push(new g("Content-Type",`${this._$contentType}`)),this._$requestHeaders.length&&t.push(...this._$requestHeaders),t}}class St{static toString(){return"[class EventPhase]"}static get namespace(){return"next2d.events.EventPhase"}toString(){return"[object EventPhase]"}get namespace(){return"next2d.events.EventPhase"}static get AT_TARGET(){return 2}static get BUBBLING_PHASE(){return 3}static get CAPTURING_PHASE(){return 1}}class wt{constructor(t,e=!1,i=!1){this._$type=`${t}`,this._$bubbles=e,this._$cancelable=i,this._$target=null,this._$currentTarget=null,this._$eventPhase=St.AT_TARGET,this._$listener=null,this._$stopImmediatePropagation=!1,this._$stopPropagation=!1}static toString(){return"[class Event]"}static get namespace(){return"next2d.events.Event"}toString(){return this.formatToString("Event","type","bubbles","cancelable","eventPhase")}get namespace(){return"next2d.events.Event"}static get ACTIVATE(){return"activate"}static get ADDED(){return"added"}static get ADDED_TO_STAGE(){return"addedToStage"}static get CHANGE(){return"change"}static get COMPLETE(){return"complete"}static get DEACTIVATE(){return"deactivate"}static get ENTER_FRAME(){return"enterFrame"}static get EXIT_FRAME(){return"exitFrame"}static get FRAME_CONSTRUCTED(){return"frameConstructed"}static get FRAME_LABEL(){return"frameLabel"}static get INIT(){return"init"}static get LOAD(){return"load"}static get MOUSE_LEAVE(){return"mouseLeave"}static get REMOVED(){return"removed"}static get REMOVED_FROM_STAGE(){return"removedFromStage"}static get RENDER(){return"render"}static get RESIZE(){return"resize"}static get SCROLL(){return"scroll"}static get OPEN(){return"open"}static get STOP(){return"stop"}static get SOUND_COMPLETE(){return"soundComplete"}static get UPDATE(){return"update"}get bubbles(){return this._$bubbles}get cancelable(){return this._$cancelable}get currentTarget(){return this._$currentTarget}set currentTarget(t){this._$currentTarget=t}get eventPhase(){return this._$eventPhase}set eventPhase(t){this._$eventPhase=t}get listener(){return this._$listener}set listener(t){this._$listener=t}get target(){return this._$target?this._$target:this._$currentTarget}set target(t){this._$target=t}get type(){return this._$type}formatToString(...t){let e=`[${t[0]}`;for(let i=1;i<t.length;++i){const s=t[i];e+=` ${s}=`;const r=this[s];e+="string"==typeof r?`"${r}"`:`${r}`}return`${e}]`}stopImmediatePropagation(){this._$stopImmediatePropagation=!0}stopPropagation(){this._$stopPropagation=!0}}class Ct{constructor(){this._$events=null}static toString(){return"[class EventDispatcher]"}static get namespace(){return"next2d.events.EventDispatcher"}toString(){return"[object EventDispatcher]"}get namespace(){return"next2d.events.EventDispatcher"}addEventListener(t,e,i=!1,s=0){const r=ar();let n,a=!1;switch(t=`${t}`){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":r.broadcastEvents.size&&r.broadcastEvents.has(t)||r.broadcastEvents.set(t,nt()),n=r.broadcastEvents.get(t)||nt(),a=!0;break;default:this._$events||(this._$events=ot()),this._$events.size&&this._$events.has(t)||this._$events.set(t,nt()),n=this._$events.get(t)||nt()}let h=n.length;for(let t=0;t<h;++t){const s=n[t];i===s.useCapture&&s.target===this&&s.listener===e&&(h=t)}n[h]={listener:e,priority:s,useCapture:i,target:this},n.length>1&&n.sort((function(t,e){switch(!0){case t.priority>e.priority:return-1;case t.priority<e.priority:return 1;default:return 0}})),a?r.broadcastEvents.set(t,n):(this._$events||(this._$events=ot()),this._$events.set(t,n))}dispatchEvent(t){switch(t.type){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":{const e=ar();if(e&&e.broadcastEvents.size&&e.broadcastEvents.has(t.type)){const i=e.broadcastEvents.get(t.type);for(let e=0;e<i.length;++e){const s=i[e];if(s.target===this){t.eventPhase=St.AT_TARGET,t.currentTarget=s.target;try{t.listener=s.listener,s.listener.call(null,t)}catch(t){return console.error(t),!1}}}return!0}}break;default:{let e=null;this._$events&&this._$events.size&&this._$events.has(t.type)&&(e=this._$events.get(t.type),e&&(e=e.slice(0))),e||(e=nt());const i=nt();if("parent"in this){let e=this.parent;for(;e;){if(e.hasEventListener(t.type)){const s=e._$events?e._$events.get(t.type):void 0;s&&i.push(s)}e=e.parent}}if(t.target=this,e.length||i.length){if(t.eventPhase=St.CAPTURING_PHASE,i.length)switch(!0){case t._$stopImmediatePropagation:case t._$stopPropagation:break;default:i.reverse();for(let e=0;e<i.length;++e){const s=i[e];for(let e=0;e<s.length;++e){const i=s[e];if(i.useCapture){t.currentTarget=i.target,r(i.target.loaderInfo);try{t.listener=i.listener,i.listener.call(null,t)}catch(t){return console.error(t),!1}if(t._$stopImmediatePropagation)break}}if(t._$stopImmediatePropagation)break}i.reverse()}if(t.eventPhase=St.AT_TARGET,!t._$stopImmediatePropagation&&!t._$stopPropagation){const i=e.length;for(let s=0;s<i;++s){const i=e[s];if(!i.useCapture){t.currentTarget=i.target,r(i.target.loaderInfo);try{t.listener=i.listener,i.listener.call(null,t)}catch(t){return console.error(t),!1}if(t._$stopImmediatePropagation)break}}}switch(t.eventPhase=St.BUBBLING_PHASE,!0){case t._$stopImmediatePropagation:case t._$stopPropagation:case!t.bubbles:break;default:for(let e=0;e<i.length;++e){const s=i[e];for(let e=0;e<s.length;++e){const i=s[e];if(!i.useCapture){t.currentTarget=i.target,r(i.target.loaderInfo);try{t.listener=i.listener,i.listener.call(null,t)}catch(t){return console.error(t),!1}if(t._$stopImmediatePropagation)break}}if(t._$stopImmediatePropagation)break}}return at(e),at(i),!0}at(e),at(i)}}return!1}hasEventListener(t){switch(t=`${t}`){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":{const e=ar();if(e&&e.broadcastEvents.size&&e.broadcastEvents.has(t)){const i=e.broadcastEvents.get(t)||nt();for(let t=0;t<i.length;t++)if(i[t].target===this)return!0}return!1}default:return!!(this._$events&&this._$events.size&&this._$events.has(t))}}removeEventListener(t,e,i=!1){if(!e)return;if(t=`${t}`,!this.hasEventListener(t))return;const s=ar();let r=null,n=!1;switch(t){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":n=!0,s&&(r=s.broadcastEvents.get(t)||nt());break;default:this._$events&&this._$events.size&&this._$events.has(t)&&(r=this._$events.get(t)||nt())}if(r){for(let t=0;t<r.length;++t){const s=r[t];if(i===s.useCapture&&s.listener===e){r.splice(t,1);break}}if(r.length)r.length>1&&r.sort((function(t,e){switch(!0){case t.priority>e.priority:return-1;case t.priority<e.priority:return 1;default:return 0}})),n?s.broadcastEvents.set(t,r):(this._$events||(this._$events=ot()),this._$events.set(t,r));else if(n)s.broadcastEvents.delete(t);else{if(!this._$events)return;this._$events.delete(t),this._$events.size||(ht(this._$events),this._$events=null)}}}removeAllEventListener(t,e=!1){if(t=`${t}`,!this.hasEventListener(t))return;const i=ar();let s=null,r=!1;switch(t){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":r=!0,i&&(s=i.broadcastEvents.get(t)||nt());break;default:this._$events&&this._$events.size&&this._$events.has(t)&&(s=this._$events.get(t)||nt())}if(!s)return;const n=nt();for(let t=0;t<s.length;++t){const i=s[t];e!==i.useCapture&&n.push(i)}if(n.length)n.length>1&&n.sort((function(t,e){switch(!0){case t.priority>e.priority:return-1;case t.priority<e.priority:return 1;default:return 0}})),r?i.broadcastEvents.set(t,n):(this._$events||(this._$events=ot()),this._$events.set(t,n));else if(r)i.broadcastEvents.delete(t);else{if(!this._$events)return;this._$events.delete(t),this._$events.size||(ht(this._$events),this._$events=null)}}willTrigger(t){if(this.hasEventListener(t))return!0;if("parent"in this){let e=this.parent;for(;e;){if(e.hasEventListener(t))return!0;e=e.parent}}return!1}}class Ft extends wt{constructor(t,e=!0,i=!1){super(t,e,i)}static toString(){return"[class FocusEvent]"}static get namespace(){return"next2d.events.FocusEvent"}toString(){return this.formatToString("FocusEvent","type","bubbles","cancelable","eventPhase")}get namespace(){return"next2d.events.FocusEvent"}static get FOCUS_IN(){return"focusIn"}static get FOCUS_OUT(){return"focusOut"}}class Rt extends wt{constructor(t,e=!1,i=!1,s=0,r="",n=[]){super(t,e,i),this._$status=0|s,this._$responseHeaders=n,this._$responseURL=r}static toString(){return"[class HTTPStatusEvent]"}static get namespace(){return"next2d.events.HTTPStatusEvent"}toString(){return this.formatToString("HTTPStatusEvent","type","bubbles","cancelable","eventPhase","status","responseURL")}get namespace(){return"next2d.events.HTTPStatusEvent"}static get HTTP_STATUS(){return"httpStatus"}get responseHeaders(){return this._$responseHeaders}get responseURL(){return this._$responseURL}get status(){return this._$status}}class Bt extends wt{constructor(t,e=!1,i=!1,s=""){super(t,e,i),this._$text=`${s}`}static toString(){return"[class IOErrorEvent]"}static get namespace(){return"next2d.events.IOErrorEvent"}toString(){return this.formatToString("IOErrorEvent","type","bubbles","cancelable","eventPhase","text")}get namespace(){return"next2d.events.IOErrorEvent"}static get IO_ERROR(){return"ioError"}get text(){return this._$text}}class It extends wt{constructor(t,e=!0,i=!1){return super(t,e,i),new Proxy(this,{get:(t,e)=>{if(e in t)return t[e];const i=o();return i&&e in i?i[e]:void 0}})}static toString(){return"[class MouseEvent]"}static get namespace(){return"next2d.events.MouseEvent"}toString(){return this.formatToString("MouseEvent","type","bubbles","cancelable","eventPhase","localX","localY","stageX","stageY","ctrlKey","altKey","shiftKey","buttonDown","delta","commandKey","controlKey","clickCount")}get namespace(){return"next2d.events.MouseEvent"}static get CLICK(){return"click"}static get DOUBLE_CLICK(){return"dblclick"}static get MOUSE_DOWN(){return"mouseDown"}static get MOUSE_MOVE(){return"mouseMove"}static get MOUSE_OUT(){return"mouseOut"}static get MOUSE_OVER(){return"mouseOver"}static get MOUSE_UP(){return"mouseUp"}static get MOUSE_WHEEL(){return"mouseWheel"}static get ROLL_OUT(){return"rollOut"}static get ROLL_OVER(){return"rollOver"}}class Lt extends wt{constructor(t,e=!1,i=!1,s=0,r=0){super(t,e,i),this._$bytesLoaded=0|s,this._$bytesTotal=0|r}static toString(){return"[class ProgressEvent]"}static get namespace(){return"next2d.events.ProgressEvent"}toString(){return this.formatToString("ProgressEvent","type","bubbles","cancelable","eventPhase","bytesLoaded","bytesTotal")}get namespace(){return"next2d.events.ProgressEvent"}static get PROGRESS(){return"progress"}get bytesLoaded(){return this._$bytesLoaded}get bytesTotal(){return this._$bytesTotal}}class Pt extends wt{constructor(t,e=!1,i=!1,s=0,r=0){super(t,e,i),this._$bytesLoaded=0|s,this._$bytesTotal=0|r}static toString(){return"[class VideoEvent]"}static get namespace(){return"next2d.events.VideoEvent"}toString(){return this.formatToString("VideoEvent","type","bubbles","cancelable","eventPhase","bytesLoaded","bytesTotal")}get namespace(){return"next2d.events.VideoEvent"}static get PROGRESS(){return"progress"}static get PLAY(){return"play"}static get PLAY_START(){return"playStart"}static get PLAY_END(){return"playEnd"}static get PAUSE(){return"pause"}static get SEEK(){return"seek"}get bytesLoaded(){return this._$bytesLoaded}get bytesTotal(){return this._$bytesTotal}}class Ot{constructor(t=1,e=1,i=1,s=1,r=0,n=0,a=0,h=0){this._$colorTransform=it(),this.redMultiplier=t,this.greenMultiplier=e,this.blueMultiplier=i,this.alphaMultiplier=s,this.redOffset=r,this.greenOffset=n,this.blueOffset=a,this.alphaOffset=h}static toString(){return"[class ColorTransform]"}static get namespace(){return"next2d.geom.ColorTransform"}toString(){return"(redMultiplier="+this._$colorTransform[0]+", greenMultiplier="+this._$colorTransform[1]+", blueMultiplier="+this._$colorTransform[2]+", alphaMultiplier="+this._$colorTransform[3]+", redOffset="+this._$colorTransform[4]+", greenOffset="+this._$colorTransform[5]+", blueOffset="+this._$colorTransform[6]+", alphaOffset="+this._$colorTransform[7]+")"}get namespace(){return"next2d.geom.ColorTransform"}get alphaMultiplier(){return this._$colorTransform[3]}set alphaMultiplier(t){this._$colorTransform[3]=$t(+t,0,1,0)}get alphaOffset(){return this._$colorTransform[7]}set alphaOffset(t){this._$colorTransform[7]=$t(0|t,-255,255,0)}get blueMultiplier(){return this._$colorTransform[2]}set blueMultiplier(t){this._$colorTransform[2]=$t(+t,0,1,0)}get blueOffset(){return this._$colorTransform[6]}set blueOffset(t){this._$colorTransform[6]=$t(0|t,-255,255,0)}get greenMultiplier(){return this._$colorTransform[1]}set greenMultiplier(t){this._$colorTransform[1]=$t(+t,0,1,0)}get greenOffset(){return this._$colorTransform[5]}set greenOffset(t){this._$colorTransform[5]=$t(0|t,-255,255,0)}get redMultiplier(){return this._$colorTransform[0]}set redMultiplier(t){this._$colorTransform[0]=$t(+t,0,1,0)}get redOffset(){return this._$colorTransform[4]}set redOffset(t){this._$colorTransform[4]=$t(0|t,-255,255,0)}concat(t){const e=dt(this._$colorTransform,t._$colorTransform);this.redMultiplier=e[0],this.greenMultiplier=e[1],this.blueMultiplier=e[2],this.alphaMultiplier=e[3],this.redOffset=e[4],this.greenOffset=e[5],this.blueOffset=e[6],this.alphaOffset=e[7],st(e)}_$clone(){return cr(this._$colorTransform[0],this._$colorTransform[1],this._$colorTransform[2],this._$colorTransform[3],this._$colorTransform[4],this._$colorTransform[5],this._$colorTransform[6],this._$colorTransform[7])}}class kt{constructor(t=0,e=0){this._$x=0,this._$y=0,this.x=t,this.y=e}static toString(){return"[class Point]"}static get namespace(){return"next2d.geom.Point"}toString(){return`(x=${this.x}, y=${this.y})`}get namespace(){return"next2d.geom.Point"}get length(){return v.sqrt(v.pow(this.x,2)+v.pow(this.y,2))}get x(){return this._$x}set x(t){this._$x=$t(+t,k,N,0)}get y(){return this._$y}set y(t){this._$y=$t(+t,k,N,0)}add(t){return new kt(this.x+t.x,this.y+t.y)}clone(){return new kt(this.x,this.y)}copyFrom(t){this._$x=t._$x,this._$y=t._$y}static distance(t,e){return v.sqrt(v.pow(t._$x-e._$x,2)+v.pow(t._$y-e._$y,2))}equals(t){return this._$x===t._$x&&this._$y===t._$y}static interpolate(t,e,i){return new kt(t.x+(e.x-t.x)*(1-i),t.y+(e.y-t.y)*(1-i))}normalize(t){const e=this.length;this.x=this.x*t/e,this.y=this.y*t/e}offset(t,e){this.x+=t,this.y+=e}static polar(t,e){return new kt(t*v.cos(e),t*v.sin(e))}setTo(t,e){this.x=t,this.y=e}subtract(t){return new kt(this.x-t.x,this.y-t.y)}}class Nt{constructor(t=1,e=0,i=0,s=1,r=0,n=0){this._$matrix=tt(1,0,0,1,0,0),this.a=t,this.b=e,this.c=i,this.d=s,this.tx=r,this.ty=n}static toString(){return"[class Matrix]"}static get namespace(){return"next2d.geom.Matrix"}toString(){return`(a=${this.a}, b=${this.b}, c=${this.c}, d=${this.d}, tx=${this.tx}, ty=${this.ty})`}get namespace(){return"next2d.geom.Matrix"}get a(){return this._$matrix[0]}set a(t){this._$matrix[0]=$t(+t,k,N,0)}get b(){return this._$matrix[1]}set b(t){this._$matrix[1]=$t(+t,k,N,0)}get c(){return this._$matrix[2]}set c(t){this._$matrix[2]=$t(+t,k,N,0)}get d(){return this._$matrix[3]}set d(t){this._$matrix[3]=$t(+t,k,N,0)}get tx(){return this._$matrix[4]}set tx(t){this._$matrix[4]=$t(+t,k,N,0)}get ty(){return this._$matrix[5]}set ty(t){this._$matrix[5]=$t(+t,k,N,0)}_$clone(){return this.clone()}clone(){return or(this._$matrix[0],this._$matrix[1],this._$matrix[2],this._$matrix[3],this._$matrix[4],this._$matrix[5])}concat(t){const e=this._$matrix,i=t._$matrix;let s=e[0]*i[0],r=0,n=0,a=e[3]*i[3],h=e[4]*i[0]+i[4],o=e[5]*i[3]+i[5];(e[1]||e[2]||i[1]||i[2])&&(s+=e[1]*i[2],a+=e[2]*i[1],r+=e[0]*i[1]+e[1]*i[3],n+=e[2]*i[0]+e[3]*i[2],h+=e[5]*i[2],o+=e[4]*i[1]),this.a=s,this.b=r,this.c=n,this.d=a,this.tx=h,this.ty=o}copyFrom(t){this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty}createBox(t,e,i=0,s=0,r=0){this.identity(),this.rotate(i),this.scale(t,e),this.translate(s,r)}createGradientBox(t,e,i=0,s=0,r=0){this.createBox(t/1638.4,e/1638.4,i,s+t/2,r+e/2)}deltaTransformPoint(t){return new kt(t.x*this._$matrix[0]+t.y*this._$matrix[2],t.x*this._$matrix[1]+t.y*this._$matrix[3])}identity(){this._$matrix[0]=1,this._$matrix[1]=0,this._$matrix[2]=0,this._$matrix[3]=1,this._$matrix[4]=0,this._$matrix[5]=0}invert(){const t=this._$matrix[0],e=this._$matrix[1],i=this._$matrix[2],s=this._$matrix[3],r=this._$matrix[4],n=this._$matrix[5];if(0===e&&0===i)this.a=1/t,this.b=0,this.c=0,this.d=1/s,this.tx=-this.a*r,this.ty=-this.d*n;else{const a=t*s-e*i;if(a){const h=1/a;this.a=s*h,this.b=-e*h,this.c=-i*h,this.d=t*h,this.tx=-(this.a*r+this.c*n),this.ty=-(this.b*r+this.d*n)}}}rotate(t){const e=this._$matrix[0],i=this._$matrix[1],s=this._$matrix[2],r=this._$matrix[3],n=this._$matrix[4],a=this._$matrix[5];this.a=e*v.cos(t)-i*v.sin(t),this.b=e*v.sin(t)+i*v.cos(t),this.c=s*v.cos(t)-r*v.sin(t),this.d=s*v.sin(t)+r*v.cos(t),this.tx=n*v.cos(t)-a*v.sin(t),this.ty=n*v.sin(t)+a*v.cos(t)}scale(t,e){this.a*=t,this.c*=t,this.tx*=t,this.b*=e,this.d*=e,this.ty*=e}setTo(t,e,i,s,r,n){this.a=t,this.b=e,this.c=i,this.d=s,this.tx=r,this.ty=n}transformPoint(t){return new kt(t.x*this._$matrix[0]+t.y*this._$matrix[2]+this._$matrix[4],t.x*this._$matrix[1]+t.y*this._$matrix[3]+this._$matrix[5])}translate(t,e){this.tx+=t,this.ty+=e}}class Dt{constructor(t=0,e=0,i=0,s=0){this._$x=0,this._$y=0,this._$width=0,this._$height=0,this.setTo(t,e,i,s)}static toString(){return"[class Rectangle]"}static get namespace(){return"next2d.geom.Rectangle"}toString(){return`(x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height})`}get namespace(){return"next2d.geom.Rectangle"}get bottom(){return this.y+this.height}set bottom(t){this.height=+t-this.y}get bottomRight(){return new kt(this.right,this.bottom)}set bottomRight(t){this.right=t.x,this.bottom=t.y}get height(){return this._$height}set height(t){this._$height=$t(+t,k,N,0)}get left(){return this.x}set left(t){this.width=this.right-+t,this.x=t}get right(){return this.x+this.width}set right(t){this.width=+t-this.x}get size(){return new kt(this.width,this.height)}set size(t){this.width=t.x,this.height=t.y}get top(){return this.y}set top(t){this.height=+(this.bottom-+t),this.y=t}get topLeft(){return new kt(this.x,this.y)}set topLeft(t){this.left=t.x,this.top=t.y}get width(){return this._$width}set width(t){this._$width=$t(+t,k,N,0)}get x(){return this._$x}set x(t){this._$x=$t(+t,k,N,0)}get y(){return this._$y}set y(t){this._$y=$t(+t,k,N,0)}clone(){return new Dt(this.x,this.y,this.width,this.height)}contains(t,e){return this.x<=t&&this.y<=e&&this.right>t&&this.bottom>e}containsPoint(t){return this.x<=t.x&&this.y<=t.y&&this.right>t.x&&this.bottom>t.y}containsRect(t){return this.x<=t.x&&this.y<=t.y&&this.right>=t.right&&this.bottom>=t.bottom}copyFrom(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}inflate(t,e){this.x=this.x-+t,this.width=this.width+2*+t,this.y=this.y-+e,this.height=this.height+2*+e}inflatePoint(t){this.x=this.x-t.x,this.width=this.width+2*t.x,this.y=this.y-t.y,this.height=this.height+2*t.y}intersection(t){const e=v.max(this.x,t.x),i=v.max(this.y,t.y),s=v.min(this.right,t.right)-e,r=v.min(this.bottom,t.bottom)-i;return s>0&&r>0?new Dt(e,i,s,r):new Dt(0,0,0,0)}intersects(t){const e=v.max(this.x,t.x),i=v.max(this.y,t.y),s=v.min(this.right,t.right),r=v.min(this.bottom,t.bottom);return s-e>0&&r-i>0}isEmpty(){return this.width<=0||this.height<=0}offset(t,e){this.x+=t,this.y+=e}offsetPoint(t){this.x+=t.x,this.y+=t.y}setEmpty(){this._$x=0,this._$y=0,this._$width=0,this._$height=0}setTo(t,e,i,s){this.x=t,this.y=e,this.width=i,this.height=s}union(t){return this.isEmpty()?t.clone():t.isEmpty()?this.clone():new Dt(v.min(this.x,t.x),v.min(this.y,t.y),v.max(this.right-t.left,t.right-this.left),v.max(this.bottom-t.top,t.bottom-this.top))}}class Ut{constructor(){this._$updated=!0}static toString(){return"[class BitmapFilter]"}static get namespace(){return"next2d.filters.BitmapFilter"}toString(){return"[object BitmapFilter]"}get namespace(){return"next2d.filters.BitmapFilter"}_$isUpdated(){return this._$updated}_$doChanged(){this._$updated=!0,x()}}class Vt extends Ut{constructor(t=4,e=4,i=1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this.blurX=t,this.blurY=e,this.quality=i}static toString(){return"[class BlurFilter]"}static get namespace(){return"next2d.filters.BlurFilter"}toString(){return"[object BlurFilter]"}get namespace(){return"next2d.filters.BlurFilter"}static get STEP(){return[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5]}get blurX(){return this._$blurX}set blurX(t){(t=$t(+t,0,255,0))!==this._$blurX&&(this._$blurX=t,this._$doChanged())}get blurY(){return this._$blurY}set blurY(t){(t=$t(+t,0,255,0))!==this._$blurY&&(this._$blurY=t,this._$doChanged())}get quality(){return this._$quality}set quality(t){(t=$t(0|t,0,15,1))!==this._$quality&&(this._$quality=t,this._$doChanged())}clone(){return new Vt(this._$blurX,this._$blurY,this._$quality)}_$toArray(){return nt(1,this._$blurX,this._$blurY,this._$quality)}_$generateFilterRect(t,e=0,i=0){const s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$quality)return s;const r=Vt.STEP[this._$quality-1];let n=0>=this._$blurX?1:this._$blurX*r,a=0>=this._$blurY?1:this._$blurY*r;return e?n*=e:n=v.round(n),i?a*=i:a=v.round(a),s.xMin-=n,s.xMax+=2*n,s.yMin-=a,s.yMax+=2*a,s}_$canApply(){return 0!==this._$blurX&&0!==this._$blurY}_$applyFilter(t,e,i=!0){this._$updated=!1;const s=t.frameBuffer,r=s.currentAttachment,n=s.getTextureFromCurrentAttachment();if(!this._$canApply())return i?n:s.createTextureFromCurrentAttachment();let a=v.sqrt(e[0]*e[0]+e[1]*e[1]),h=v.sqrt(e[2]*e[2]+e[3]*e[3]);a/=f,h/=f,a*=2,h*=2;const o=K(0,n.width,0,n.height),l=this._$generateFilterRect(o,a,h);Q(o);const c=0|v.ceil(l.xMax),_=0|v.ceil(l.yMax),$=v.ceil(v.abs(l.xMin)+.5*v.abs(c-l.xMax)),u=v.ceil(v.abs(l.yMin)+.5*v.abs(_-l.yMax));t._$offsetX=$+t._$offsetX,t._$offsetY=u+t._$offsetY;const d=this._$blurX*a,g=this._$blurY*h;let p=1,m=1;d>128?p=.0625:d>64?p=.125:d>32?p=.25:d>16&&(p=.5),g>128?m=.0625:g>64?m=.125:g>32?m=.25:g>16&&(m=.5);const x=d*p,b=g*m,T=v.ceil(c*p),y=v.ceil(_*m),E=s.createTextureAttachment(T,y),A=[E,s.createTextureAttachment(T,y)];let M=0;t._$bind(E),t.reset(),t.setTransform(p,0,0,m,0,0),t.drawImage(n,$,u,n.width,n.height),t.blend.toOneZero();let S=s.getTextureFromCurrentAttachment();for(let e=0;e<this._$quality;++e){if(this._$blurX>0){M=(M+1)%2;const e=A[M];t._$bind(e),t._$applyBlurFilter(S,!0,x),S=s.getTextureFromCurrentAttachment()}if(this._$blurY>0){M=(M+1)%2;const e=A[M];t._$bind(e),t._$applyBlurFilter(S,!1,b),S=s.getTextureFromCurrentAttachment()}}if(t.blend.reset(),1!==p||1!==m){const e=s.createTextureAttachment(c,_);t._$bind(e),t.reset(),t.imageSmoothingEnabled=!0,t.setTransform(1/p,0,0,1/m,0,0),t.drawImage(S,0,0,T,y),S=s.getTextureFromCurrentAttachment(),t.reset(),t.setTransform(1,0,0,1,0,0),s.releaseAttachment(A[0],!0),s.releaseAttachment(A[1],!0),i?s.releaseAttachment(r,!0):s.releaseAttachment(e,!1)}else s.releaseAttachment(A[(M+1)%2],!0),i?s.releaseAttachment(r,!0):s.releaseAttachment(A[M],!1);return S}}class Gt extends Ut{constructor(t=4,e=45,i=16777215,s=1,r=0,n=1,a=4,h=4,o=1,l=1,c="inner",_=!1){super(),this._$blurFilter=new Vt(a,h,l),this._$distance=4,this._$angle=45,this._$highlightColor=16777215,this._$highlightAlpha=1,this._$shadowColor=0,this._$shadowAlpha=1,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.highlightColor=i,this.highlightAlpha=s,this.shadowColor=r,this.shadowAlpha=n,this.strength=o,this.type=c,this.knockout=_}static toString(){return"[class BevelFilter]"}static get namespace(){return"next2d.filters.BevelFilter"}toString(){return"[object BevelFilter]"}get namespace(){return"next2d.filters.BevelFilter"}get angle(){return this._$angle}set angle(t){(t%=360)!==this._$angle&&(this._$angle=$t(t,-360,360,45),this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get distance(){return this._$distance}set distance(t){(t=$t(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get highlightAlpha(){return this._$highlightAlpha}set highlightAlpha(t){(t=$t(+t,0,1,0))!==this._$highlightAlpha&&(this._$highlightAlpha=t,this._$doChanged())}get highlightColor(){return this._$highlightColor}set highlightColor(t){(t=$t(pt(t),0,16777215,16777215))!==this._$highlightColor&&(this._$highlightColor=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get shadowAlpha(){return this._$shadowAlpha}set shadowAlpha(t){(t=$t(+t,0,1,0))!==this._$shadowAlpha&&(this._$shadowAlpha=t,this._$doChanged())}get shadowColor(){return this._$shadowColor}set shadowColor(t){(t=$t(pt(t),0,16777215,0))!==this._$shadowColor&&(this._$shadowColor=t,this._$doChanged())}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){(t=`${t}`)!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new Gt(this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return nt(0,this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const r=this._$angle*D;let n=v.abs(v.cos(r)*this._$distance),a=v.abs(v.sin(r)*this._$distance);return e&&(n*=e),i&&(a*=i),s.xMin=v.min(s.xMin,n),n>0&&(s.xMax+=n),s.yMin=v.min(s.yMin,a),a>0&&(s.yMax+=a),s}_$canApply(){return this._$strength>0&&0!==this._$distance&&this._$blurFilter._$canApply()}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;if(!s)throw new Error("the current attachment is null.");t.setTransform(1,0,0,1,0,0);const r=i.getTextureFromCurrentAttachment();if(!this._$canApply())return r;const n=s.width,a=s.height,h=t._$offsetX,o=t._$offsetY;let l=v.sqrt(e[0]*e[0]+e[1]*e[1]),c=v.sqrt(e[2]*e[2]+e[3]*e[3]);l/=f,c/=f,l*=2,c*=2;const _=this._$angle*D,$=v.cos(_)*this._$distance*l,u=v.sin(_)*this._$distance*c,d=i.createTextureAttachment(n,a);t._$bind(d),t.reset(),t.drawImage(r,0,0,n,a),t.globalCompositeOperation="erase",t.drawImage(r,2*$,2*u,n,a);const g=this._$blurFilter._$applyFilter(t,e,!1),p=g.width,m=g.height,x=v.ceil(p+2*v.abs($)),b=v.ceil(m+2*v.abs(u)),T="inner"===this._$type,y=T?n:x,E=T?a:b,A=v.abs($),M=v.abs(u),S=(p-n)/2,w=(m-a)/2,C=T?0:A+S,F=T?0:M+w,R=T?-S-$:A-$,B=T?-w-u:M-u;return t._$bind(s),i.releaseAttachment(d,!0),t._$applyBitmapFilter(g,y,E,n,a,C,F,p,m,R,B,!1,this._$type,this._$knockout,this._$strength,null,null,null,xt(this._$highlightColor,this._$highlightAlpha,!0),bt(this._$highlightColor,this._$highlightAlpha,!0),vt(this._$highlightColor,this._$highlightAlpha,!0),this._$highlightAlpha,xt(this._$shadowColor,this._$shadowAlpha,!0),bt(this._$shadowColor,this._$shadowAlpha,!0),vt(this._$shadowColor,this._$shadowAlpha,!0),this._$shadowAlpha),t._$offsetX=h+C,t._$offsetY=o+F,i.releaseTexture(g),i.getTextureFromCurrentAttachment()}}class zt extends Ut{constructor(t=null){super(),this._$matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix=t}static toString(){return"[class ColorMatrixFilter]"}static get namespace(){return"next2d.filters.ColorMatrixFilter"}toString(){return"[object ColorMatrixFilter]"}get namespace(){return"next2d.filters.ColorMatrixFilter"}get matrix(){return this._$matrix}set matrix(t){if(t&&T.isArray(t)&&20===t.length){for(let e=0;e<20;++e)if(t[e]!==this._$matrix[e]){this._$doChanged();break}this._$matrix=t}}clone(){return new zt(this._$matrix)}_$toArray(){return nt(2,this._$matrix)}_$generateFilterRect(t){return t}_$canApply(){return!0}_$applyFilter(t){this._$updated=!1;const e=t.frameBuffer,i=e.currentAttachment;t.setTransform(1,0,0,1,0,0);const s=e.getTextureFromCurrentAttachment(),r=s.width,n=s.height,a=e.createTextureAttachment(r,n);return t._$bind(a),t.reset(),t._$applyColorMatrixFilter(s,this._$matrix),e.releaseAttachment(i,!0),e.getTextureFromCurrentAttachment()}}class Yt extends Ut{constructor(t=0,e=0,i=null,s=1,r=0,n=!0,a=!0,h=0,o=0){super(),this._$matrixX=0,this._$matrixY=0,this._$matrix=null,this._$divisor=1,this._$bias=0,this._$preserveAlpha=!0,this._$clamp=!0,this._$color=0,this._$alpha=0,this.matrixX=t,this.matrixY=e,this.matrix=i,this.divisor=s,this.bias=r,this.preserveAlpha=n,this.clamp=a,this.color=h,this.alpha=o}static toString(){return"[class ConvolutionFilter]"}static get namespace(){return"next2d.filters.ConvolutionFilter"}toString(){return"[object ConvolutionFilter]"}get namespace(){return"next2d.filters.ConvolutionFilter"}get alpha(){return this._$alpha}set alpha(t){(t=$t(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get bias(){return this._$bias}set bias(t){t!==this._$bias&&(this._$bias=0|t,this._$doChanged())}get clamp(){return this._$clamp}set clamp(t){t!==this._$clamp&&(this._$clamp=!!t,this._$doChanged())}get color(){return this._$color}set color(t){(t=$t(pt(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get divisor(){return this._$divisor}set divisor(t){t!==this._$divisor&&(this._$divisor=0|t,this._$doChanged())}get matrix(){return this._$matrix}set matrix(t){T.isArray(this._$matrix)&&at(this._$matrix),this._$matrix=T.isArray(t)?t:null,this._$doChanged()}get matrixX(){return this._$matrixX}set matrixX(t){(t=0|$t(0|t,0,15,0))!==this._$matrixX&&(this._$matrixX=t,this._$doChanged())}get matrixY(){return this._$matrixY}set matrixY(t){(t=0|$t(0|t,0,15,0))!==this._$matrixY&&(this._$matrixY=t,this._$doChanged())}get preserveAlpha(){return this._$preserveAlpha}set preserveAlpha(t){t!==this._$preserveAlpha&&(this._$preserveAlpha=!!t,this._$doChanged())}clone(){return new Yt(this._$matrixX,this._$matrixY,this._$matrix?this._$matrix.slice():null,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}_$toArray(){return nt(3,this._$matrixX,this._$matrixY,this._$matrix,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}_$generateFilterRect(t){return t}_$canApply(){return null!==this._$matrix&&this._$matrixX*this._$matrixY===this._$matrix.length}_$applyFilter(t){this._$updated=!1;const e=t.frameBuffer,i=e.currentAttachment;t.setTransform(1,0,0,1,0,0);const s=e.getTextureFromCurrentAttachment();return this._$canApply()&&this._$matrix?(t._$applyConvolutionFilter(s,this._$matrixX,this._$matrixY,this._$matrix,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,xt(this._$color,this._$alpha,!1),bt(this._$color,this._$alpha,!1),vt(this._$color,this._$alpha,!1),this._$alpha),e.releaseAttachment(i,!0),e.getTextureFromCurrentAttachment()):s}}class Xt extends Ut{constructor(t=null,e=null,i=0,s=0,r=0,n=0,a="wrap",h=0,o=0){super(),this._$mapBitmap=null,this._$mapPoint=null,this._$componentX=0,this._$componentY=0,this._$scaleX=0,this._$scaleY=0,this._$mode="wrap",this._$color=0,this._$alpha=0,this.mapBitmap=t,this.mapPoint=e,this.componentX=i,this.componentY=s,this.scaleX=r,this.scaleY=n,this.mode=a,this.color=h,this.alpha=o}static toString(){return"[class DisplacementMapFilter]"}static get namespace(){return"next2d.filters.DisplacementMapFilter"}toString(){return"[object DisplacementMapFilter]"}get namespace(){return"next2d.filters.DisplacementMapFilter"}get alpha(){return this._$alpha}set alpha(t){(t=$t(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get color(){return this._$color}set color(t){(t=$t(pt(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get componentX(){return this._$componentX}set componentX(t){t!==this._$componentX&&(this._$componentX=t,this._$doChanged())}get componentY(){return this._$componentY}set componentY(t){t!==this._$componentY&&(this._$componentY=t,this._$doChanged())}get mapBitmap(){return this._$mapBitmap}set mapBitmap(t){t!==this._$mapBitmap&&(this._$mapBitmap=t,this._$doChanged())}get mapPoint(){return this._$mapPoint}set mapPoint(t){t!==this._$mapPoint&&(this._$mapPoint=t,this._$doChanged())}get mode(){return this._$mode}set mode(t){t!==this._$mode&&(this._$mode=t,this._$doChanged())}get scaleX(){return this._$scaleX}set scaleX(t){(t=$t(+t,-65535,65535,0))!==this._$scaleX&&(this._$scaleX=t,this._$doChanged())}get scaleY(){return this._$scaleY}set scaleY(t){(t=$t(+t,-65535,65535,0))!==this._$scaleY&&(this._$scaleY=t,this._$doChanged())}clone(){return new Xt(this._$mapBitmap,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}_$toArray(){return nt(4,this._$mapBitmap,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}_$generateFilterRect(t){return t}_$canApply(){return null!==this._$mapBitmap&&this._$componentX>0&&this._$componentY>0&&0!==this._$scaleX&&0!==this._$scaleY}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;t.setTransform(1,0,0,1,0,0);const r=i.getTextureFromCurrentAttachment();if(!this._$canApply()||!s||!this._$mapBitmap)return r;const n=v.sqrt(e[0]*e[0]+e[1]*e[1]),a=v.sqrt(e[2]*e[2]+e[3]*e[3]);return t._$applyDisplacementMapFilter(r,this._$mapBitmap,r.width/n,r.height/a,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,xt(this._$color,this._$alpha,!0),bt(this._$color,this._$alpha,!0),vt(this._$color,this._$alpha,!0),this._$alpha),i.releaseAttachment(s,!0),i.getTextureFromCurrentAttachment()}}class qt extends Ut{constructor(t=4,e=45,i=0,s=1,r=4,n=4,a=1,h=1,o=!1,l=!1,c=!1){super(),this._$blurFilter=new Vt(r,n,h),this._$distance=4,this._$angle=45,this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this._$hideObject=!1,this.distance=t,this.angle=e,this.color=i,this.alpha=s,this.strength=a,this.inner=o,this.knockout=l,this.hideObject=c}static toString(){return"[class DropShadowFilter]"}static get namespace(){return"next2d.filters.DropShadowFilter"}toString(){return"[object DropShadowFilter]"}get namespace(){return"next2d.filters.DropShadowFilter"}get alpha(){return this._$alpha}set alpha(t){(t=$t(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get angle(){return this._$angle}set angle(t){(t%=360)!==this._$angle&&(this._$angle=$t(t,-360,360,45),this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get color(){return this._$color}set color(t){(t=$t(pt(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get distance(){return this._$distance}set distance(t){(t=$t(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get hideObject(){return this._$hideObject}set hideObject(t){t!==this._$hideObject&&(this._$hideObject=!!t,this._$doChanged())}get inner(){return this._$inner}set inner(t){t!==this._$inner&&(this._$inner=!!t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}clone(){return new qt(this._$distance,this._$angle,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout,this._$hideObject)}_$toArray(){return nt(5,this._$distance,this._$angle,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout,this._$hideObject)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const r=this._$angle*D;let n=v.cos(r)*this._$distance,a=v.sin(r)*this._$distance;return e&&(n*=e),i&&(a*=i),s.xMin=v.min(s.xMin,n),n>0&&(s.xMax+=n),s.yMin=v.min(s.yMin,a),a>0&&(s.yMax+=a),s}_$canApply(){return this._$alpha>0&&this._$strength>0&&this._$blurFilter._$canApply()}_$applyFilter(t,e){const i=t.frameBuffer,s=i.currentAttachment;if(!s)throw new Error("the current attachment is null.");if(t.setTransform(1,0,0,1,0,0),!this._$canApply())return i.getTextureFromCurrentAttachment();const r=s.width,n=s.height,a=t._$offsetX,h=t._$offsetY,o=this._$blurFilter._$applyFilter(t,e,!1),l=o.width,c=o.height,_=t._$offsetX,$=t._$offsetY,u=_-a,d=$-h;let g=v.sqrt(e[0]*e[0]+e[1]*e[1]),p=v.sqrt(e[2]*e[2]+e[3]*e[3]);g/=f,p/=f,g*=2,p*=2;const m=this._$angle*D,x=v.cos(m)*this._$distance*g,b=v.sin(m)*this._$distance*p,T=this._$inner?r:l+v.max(0,v.abs(x)-u),y=this._$inner?n:c+v.max(0,v.abs(b)-d),E=v.ceil(T),A=v.ceil(y),M=(E-T)/2,S=(A-y)/2,w=this._$inner?0:v.max(0,u-x)+M,C=this._$inner?0:v.max(0,d-b)+S,F=this._$inner?x-_:(x>0?v.max(0,x-u):0)+M,R=this._$inner?b-$:(b>0?v.max(0,b-d):0)+S;let B,I;return this._$inner?(B="inner",I=this._$knockout||this._$hideObject):!this._$knockout&&this._$hideObject?(B="full",I=!0):(B="outer",I=this._$knockout),t._$bind(s),t._$applyBitmapFilter(o,E,A,r,n,w,C,l,c,F,R,!0,B,I,this._$strength,null,null,null,xt(this._$color,this._$alpha,!0),bt(this._$color,this._$alpha,!0),vt(this._$color,this._$alpha,!0),this._$alpha,0,0,0,0),t._$offsetX=a+w,t._$offsetY=h+C,i.releaseTexture(o),i.getTextureFromCurrentAttachment()}}class Ht extends Ut{constructor(t=0,e=1,i=4,s=4,r=1,n=1,a=!1,h=!1){super(),this._$blurFilter=new Vt(i,s,n),this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this.color=t,this.alpha=e,this.strength=r,this.inner=a,this.knockout=h}static toString(){return"[class GlowFilter]"}static get namespace(){return"next2d.filters.GlowFilter"}toString(){return"[object GlowFilter]"}get namespace(){return"next2d.filters.GlowFilter"}get alpha(){return this._$alpha}set alpha(t){(t=$t(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get color(){return this._$color}set color(t){(t=$t(pt(t),0,16777215,4))!==this._$color&&(this._$color=t,this._$doChanged())}get inner(){return this._$inner}set inner(t){t!==this._$inner&&(this._$inner=!!t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}clone(){return new Ht(this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout)}_$toArray(){return nt(6,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){const s=K(t.xMin,t.xMax,t.yMin,t.yMax);return this._$canApply()?this._$blurFilter._$generateFilterRect(s,e,i):s}_$canApply(){return this._$alpha>0&&this._$strength>0&&this._$blurFilter._$canApply()}_$applyFilter(t,e){const i=t.frameBuffer,s=i.currentAttachment;if(!s)throw new Error("the current attachment is null.");if(this._$updated=!1,t.setTransform(1,0,0,1,0,0),!this._$canApply())return i.getTextureFromCurrentAttachment();const r=s.width,n=s.height,a=t._$offsetX,h=t._$offsetY,o=this._$blurFilter._$applyFilter(t,e,!1),l=o.width,c=o.height,_=t._$offsetX,$=t._$offsetY,u=this._$inner?r:l,d=this._$inner?n:c,g=this._$inner?0:_-a,f=this._$inner?0:$-h,p=this._$inner?-_:0,m=this._$inner?-$:0,x=this._$inner?"inner":"outer";return t._$bind(s),t._$applyBitmapFilter(o,u,d,r,n,g,f,l,c,p,m,!0,x,this._$knockout,this._$strength,null,null,null,xt(this._$color,this._$alpha,!0),bt(this._$color,this._$alpha,!0),vt(this._$color,this._$alpha,!0),this._$alpha,0,0,0,0),t._$offsetX=a+g,t._$offsetY=h+f,i.releaseTexture(o),i.getTextureFromCurrentAttachment()}}class jt extends Ut{constructor(t=4,e=45,i=null,s=null,r=null,n=4,a=4,h=1,o=1,l="inner",c=!1){super(),this._$blurFilter=new Vt(n,a,o),this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.colors=i,this.alphas=s,this.ratios=r,this.strength=h,this.type=l,this.knockout=c}static toString(){return"[class GradientBevelFilter]"}static get namespace(){return"next2d.filters.GradientBevelFilter"}toString(){return"[object GradientBevelFilter]"}get namespace(){return"next2d.filters.GradientBevelFilter"}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(this._$alphas=t,T.isArray(t)){for(let e=0;e<t.length;++e){const i=t[e];t[e]=$t(+i,0,1,0)}this._$alphas=t}this._$doChanged()}}get angle(){return this._$angle}set angle(t){(t=$t(t%360,-360,360,45))!==this._$angle&&(this._$angle=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(this._$colors=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(pt(t[e]),0,16777215,0);this._$colors=t}this._$doChanged()}}get distance(){return this._$distance}set distance(t){(t=$t(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(this._$ratios=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(+t[e],0,255,0);this._$ratios=t}this._$doChanged()}}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new jt(this._$distance,this._$angle,this._$colors?this._$colors.slice():null,this._$alphas?this._$alphas.slice():null,this._$ratios?this._$ratios.slice():null,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return nt(7,this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const r=this._$angle*D;let n=v.abs(v.cos(r)*this._$distance),a=v.abs(v.sin(r)*this._$distance);return e&&(n*=e),i&&(a*=i),s.xMin=v.min(s.xMin,n),n>0&&(s.xMax+=n),s.yMin=v.min(s.yMin,a),a>0&&(s.yMax+=a),s}_$canApply(){return this._$strength>0&&this._$distance>0&&null!==this._$alphas&&null!==this._$ratios&&null!==this._$colors&&this._$blurFilter._$canApply()}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;t.setTransform(1,0,0,1,0,0);const r=i.getTextureFromCurrentAttachment();if(!this._$canApply()||!s)return r;const n=s.width,a=s.height,h=t._$offsetX,o=t._$offsetY;let l=v.sqrt(e[0]*e[0]+e[1]*e[1]),c=v.sqrt(e[2]*e[2]+e[3]*e[3]);l/=f,c/=f,l*=2,c*=2;const _=+this._$angle*D,$=+v.cos(_)*this._$distance*l,u=+v.sin(_)*this._$distance*c,d=i.createTextureAttachment(n,a);t._$bind(d),t.reset(),t.drawImage(r,0,0,n,a),t.globalCompositeOperation="erase",t.drawImage(r,2*$,2*u,n,a);const g=this._$blurFilter._$applyFilter(t,e,!1),p=g.width,m=g.height,x=v.ceil(p+2*v.abs($)),b=v.ceil(m+2*v.abs(u)),T="inner"===this._$type,y=T?n:x,E=T?a:b,A=v.abs($),M=v.abs(u),S=(p-n)/2,w=(m-a)/2,C=T?0:A+S,F=T?0:M+w,R=T?-S-$:A-$,B=T?-w-u:M-u;return t._$bind(s),t._$applyBitmapFilter(g,y,E,n,a,C,F,p,m,R,B,!1,this._$type,this._$knockout,this._$strength,this._$ratios,this._$colors,this._$alphas,0,0,0,0,0,0,0,0),t._$offsetX=h+C,t._$offsetY=o+F,i.releaseAttachment(d,!0),i.getTextureFromCurrentAttachment()}}class Wt extends Ut{constructor(t=4,e=45,i=null,s=null,r=null,n=4,a=4,h=1,o=1,l="inner",c=!1){super(),this._$blurFilter=new Vt(n,a,o),this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.colors=i,this.alphas=s,this.ratios=r,this.strength=h,this.type=l,this.knockout=c}static toString(){return"[class GradientGlowFilter]"}static get namespace(){return"next2d.filters.GradientGlowFilter"}toString(){return"[object GradientGlowFilter]"}get namespace(){return"next2d.filters.GradientGlowFilter"}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(this._$alphas=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(+t[e],0,1,0);this._$alphas=t}this._$doChanged()}}get angle(){return this._$angle}set angle(t){(t=$t(t%360,-360,360,45))!==this._$angle&&(this._$angle=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(this._$colors=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(pt(t[e]),0,16777215,0);this._$colors=t}this._$doChanged()}}get distance(){return this._$distance}set distance(t){(t=$t(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(this._$ratios=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(+t[e],0,255,0);this._$ratios=t}this._$doChanged()}}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new Wt(this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return nt(8,this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const r=this._$angle*D;let n=v.abs(v.cos(r)*this._$distance),a=v.abs(v.sin(r)*this._$distance);return e&&(n*=e),i&&(a*=i),s.xMin=v.min(s.xMin,n),n>0&&(s.xMax+=n),s.yMin=v.min(s.yMin,a),a>0&&(s.yMax+=a),s}_$canApply(){return this._$strength>0&&this._$distance>0&&null!==this._$alphas&&null!==this._$ratios&&null!==this._$colors&&this._$blurFilter._$canApply()}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;if(t.setTransform(1,0,0,1,0,0),!this._$canApply()||!s)return i.getTextureFromCurrentAttachment();const r=s.width,n=s.height,a=t._$offsetX,h=t._$offsetY,o=this._$blurFilter._$applyFilter(t,e,!1),l=o.width,c=o.height,_=t._$offsetX,$=t._$offsetY,u=_-a,d=$-h;let g=v.sqrt(e[0]*e[0]+e[1]*e[1]),p=v.sqrt(e[2]*e[2]+e[3]*e[3]);g/=f,p/=f,g*=2,p*=2;const m=+this._$angle*D,x=+v.cos(m)*this._$distance*g,b=+v.sin(m)*this._$distance*p,T="inner"===this.type,y=T?r:l+v.max(0,v.abs(x)-u),E=T?n:c+v.max(0,v.abs(b)-d),A=v.ceil(y),M=v.ceil(E),S=(A-y)/2,w=(M-E)/2,C=T?0:v.max(0,u-x)+S,F=T?0:v.max(0,d-b)+w,R=T?x-_:(x>0?v.max(0,x-u):0)+S,B=T?b-$:(b>0?v.max(0,b-d):0)+w;return t._$bind(s),t._$applyBitmapFilter(o,A,M,r,n,C,F,l,c,R,B,!0,this._$type,this._$knockout,this._$strength,this._$ratios,this._$colors,this._$alphas,0,0,0,0,0,0,0,0),t._$offsetX=a+C,t._$offsetY=h+F,i.releaseTexture(o),i.getTextureFromCurrentAttachment()}}class Kt{constructor(t){this._$displayObject=t,this._$matrix=null,this._$colorTransform=null,this._$blendMode=null,this._$filters=null}static toString(){return"[class Transform]"}static get namespace(){return"next2d.geom.Transform"}toString(){return"[object Transform]"}get namespace(){return"next2d.geom.Transform"}get colorTransform(){if(this._$colorTransform)return this._$colorTransform._$clone();const t=this._$displayObject,e=t._$placeObject||t._$getPlaceObject();if(e&&e.colorTransform){const t=e.colorTransform;return cr(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7])}return this._$transform(),this._$colorTransform||(this._$colorTransform=cr()),this._$colorTransform._$clone()}set colorTransform(t){this._$transform(null,t._$colorTransform)}get concatenatedColorTransform(){let t=this._$rawColorTransform(),e=this._$displayObject._$parent;for(;e;)t=dt(e._$transform._$rawColorTransform(),t),e=e._$parent;return cr(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7])}get matrix(){if(this._$matrix)return this._$matrix._$clone();const t=this._$displayObject,e=t._$placeObject||t._$getPlaceObject();if(e&&e.matrix){const t=e.matrix;return or(t[0],t[1],t[2],t[3],t[4],t[5])}return this._$transform(),this._$matrix||(this._$matrix=or()),this._$matrix._$clone()}set matrix(t){this._$transform(t._$matrix,null)}get concatenatedMatrix(){let t=this._$rawMatrix(),e=this._$displayObject._$parent;for(;e;)t=ut(e._$transform._$rawMatrix(),t),e=e._$parent;return or(t[0],t[1],t[2],t[3],t[4],t[5])}pixelBounds(){if(!this._$displayObject)return new Dt(0,0,0,0);const t=this._$displayObject._$getBounds(null),e=new Dt(t.xMin,t.yMin,+v.abs(t.xMax-t.xMin),+v.abs(t.yMax-t.yMin));return Q(t),e}_$rawMatrix(){if(null!==this._$matrix)return this._$matrix._$matrix;const t=this._$displayObject,e=t._$placeObject||t._$getPlaceObject();if(e&&e.matrix){if(T.isArray(e.matrix)){const t=e.matrix;e.matrix=tt(t[0],t[1],t[2],t[3],t[4],t[5]),at(t)}return e.matrix}return P}_$rawColorTransform(){if(null!==this._$colorTransform)return this._$colorTransform._$colorTransform;const t=this._$displayObject,e=t._$placeObject||t._$getPlaceObject();if(e&&e.colorTransform){if(T.isArray(e.colorTransform)){const t=e.colorTransform;e.colorTransform=it(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]),at(t)}return e.colorTransform}return O}_$transform(t=null,e=null,i=null,s=""){const r=this._$displayObject,n=r._$placeObject||r._$getPlaceObject();this._$setMatrix(t,n),this._$setColorTransform(e,n),this._$setFilters(i,n),this._$setBlendMode(s,n)}_$setMatrix(t=null,e=null){if((t||e)&&(this._$displayObject._$doChanged(),x()),this._$matrix||(this._$matrix=or(1,0,0,1,0,0),!t&&e&&e.matrix&&(t=e.matrix)),t){const e=this._$matrix._$matrix;e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5]}}_$setColorTransform(t=null,e=null){if((t||e)&&(this._$displayObject._$doChanged(),x()),this._$colorTransform||(this._$colorTransform=cr(1,1,1,1,0,0,0,0),!t&&e&&e.colorTransform&&(t=e.colorTransform)),t){const e=this._$colorTransform._$colorTransform;e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7]}}_$setFilters(t=null,e=null){if(T.isArray(t))return this._$filters&&at(this._$filters),this._$filters=t.slice(0),this._$displayObject._$doChanged(),void x();if(!this._$filters)if(e){if(e.filters){this._$filters=e.filters.slice(0);for(let t=0;t<this._$filters.length;++t)this._$filters[t]=this._$filters[t].clone()}else if(e.surfaceFilterList){e.filters=this._$buildFilter(e.surfaceFilterList),this._$filters=e.filters.slice(0);for(let t=0;t<this._$filters.length;++t)this._$filters[t]=this._$filters[t].clone()}}else this._$filters=nt()}_$buildFilter(t){const e=nt(),i=t.length;for(let s=0;s<i;++s){const i=t[s];switch(null===i.params[0]&&i.params.shift(),i.class){case"BevelFilter":e.push(new Gt(...i.params));break;case"BlurFilter":e.push(new Vt(...i.params));break;case"ColorMatrixFilter":e.push(new zt(...i.params));break;case"ConvolutionFilter":e.push(new Yt(...i.params));break;case"DisplacementMapFilter":e.push(new Xt(...i.params));break;case"DropShadowFilter":e.push(new qt(...i.params));break;case"GlowFilter":e.push(new Ht(...i.params));break;case"GradientBevelFilter":e.push(new jt(...i.params));break;case"GradientGlowFilter":e.push(new Wt(...i.params))}}return e}_$setBlendMode(t="",e=null){if(t)return this._$blendMode=t,this._$displayObject._$doChanged(),void x();this._$blendMode||(e&&e.blendMode?this._$blendMode=e.blendMode:this._$blendMode="normal")}}class Qt extends Ct{constructor(){super(),this._$id=-1,this._$instanceId=e(),this._$characterId=0,this._$active=!1,this._$isMask=!1,this._$updated=!0,this._$added=!1,this._$addedStage=!1,this._$filters=null,this._$blendMode=null,this._$hitObject=null,this._$isNext=!0,this._$created=!1,this._$posted=!1,this._$postArray=null,this._$clipDepth=0,this._$name="",this._$visible=!0,this._$mask=null,this._$scale9Grid=null,this._$parent=null,this._$stage=null,this._$root=null,this._$loaderInfo=null,this._$placeId=-1,this._$startFrame=1,this._$endFrame=0,this._$transform=new Kt(this),this._$variables=null,this._$placeObject=null,this._$currentPlaceId=-1,this._$changePlace=!1,this._$scaleX=null,this._$scaleY=null,this._$rotation=null}get alpha(){const t=this._$transform._$rawColorTransform();return t[3]+t[7]/255}set alpha(t){t=$t(t,0,1,0);const e=this._$transform;if(e._$colorTransform){const i=e._$colorTransform;i._$colorTransform[3]=t,i._$colorTransform[7]=0,this._$doChanged(),x()}else{const i=e.colorTransform;i._$colorTransform[3]=t,i._$colorTransform[7]=0,e.colorTransform=i,_r(i)}}get blendMode(){if(this._$blendMode)return this._$blendMode;const t=this._$transform;if(t._$blendMode)return this._$blendMode=t._$blendMode,t._$blendMode;const e=this._$placeObject||this._$getPlaceObject();return e&&e.blendMode?(this._$blendMode=e.blendMode,e.blendMode):(this._$blendMode="normal","normal")}set blendMode(t){const e=this._$transform;e._$blendMode?(e._$blendMode=t,this._$doChanged(),x()):e._$transform(null,null,null,t),this._$blendMode=t}get filters(){if(this._$filters){const t=nt();for(let e=0;e<this._$filters.length;++e)t[e]=this._$filters[e].clone();return t}const t=this._$transform;if(t._$filters){const e=nt(),i=nt();for(let s=0;s<t._$filters.length;++s){const r=t._$filters[s];e[s]=r.clone(),i[s]=r.clone()}return this._$filters=e,i}const e=this._$placeObject||this._$getPlaceObject();if(e&&e.surfaceFilterList){e.filters||(e.filters=t._$buildFilter(e.surfaceFilterList));const i=nt(),s=nt();for(let t=0;t<e.filters.length;++t){const r=e.filters[t];i[t]=r.clone(),s[t]=r.clone()}return this._$filters=i,s}const i=nt();return this._$filters=i,i}set filters(t){t||(t=nt()),this._$transform._$transform(null,null,t),this._$filters=t}get height(){const t="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),e=gt(t,this._$transform._$rawMatrix());Q(t);const i=v.abs(e.yMax-e.yMin);switch(Q(e),i){case 0:case b:case-1/0:return 0;default:return+i.toFixed(2)}}set height(t){if(!C(t=+t)&&t>-1){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=this.rotation,s=i?gt(e,this._$transform._$rawMatrix()):e;i&&Q(e);const r=v.abs(s.yMax-s.yMin);switch(Q(s),r){case 0:case b:case-1/0:this.scaleY=0;break;default:this.scaleY=t/r}}}get loaderInfo(){return this._$loaderInfo}get mask(){return this._$mask}set mask(t){t!==this._$mask&&(this._$mask&&(Tr&&this._$mask.stage&&this._$mask._$removeWorkerInstance(),this._$mask._$isMask=!1,this._$mask=null),t&&(Tr&&"_$createWorkerInstance"in t&&"function"==typeof t._$createWorkerInstance&&t._$createWorkerInstance(),t._$isMask=!0,this._$mask=t),this._$doChanged())}get mouseX(){return o()?this.globalToLocal(hr()).x:0}get mouseY(){return o()?this.globalToLocal(hr()).y:0}get name(){return this._$name?this._$name:`instance${this._$instanceId}`}set name(t){this._$name=`${t}`;const e=this._$parent;if(e&&e._$names){e._$names.clear();const t=e._$getChildren();for(let i=0;i<t.length;++i){const s=t[i];s._$name&&e._$names.set(s.name,s)}}}get parent(){return this._$parent}get root(){return this._$root}get rotation(){if(null!==this._$rotation)return this._$rotation;const t=this._$transform._$rawMatrix();return v.atan2(t[1],t[0])*U}set rotation(t){if(t=$t(t%360,-360,360,0),this._$rotation===t)return;const e=this._$transform,i=null!==e._$matrix,s=i?e._$matrix:e.matrix,r=v.sqrt(s.a*s.a+s.b*s.b),n=v.sqrt(s.c*s.c+s.d*s.d);if(0===t)s.a=r,s.b=0,s.c=0,s.d=n;else{let e=v.atan2(s.b,s.a),i=v.atan2(0-s.c,s.d);const a=t*D;i=i+a-e,e=a,s.b=r*v.sin(e),1===s.b||-1===s.b?s.a=0:s.a=r*v.cos(e),s.c=-n*v.sin(i),1===s.c||-1===s.c?s.d=0:s.d=n*v.cos(i)}i?(this._$doChanged(),x()):(e.matrix=s,lr(s)),this._$rotation=t}get scale9Grid(){return this._$scale9Grid}set scale9Grid(t){this._$scale9Grid!==t&&(this._$scale9Grid=t,this._$doChanged(),x())}get scaleX(){if(null!==this._$scaleX)return this._$scaleX;const t=this._$transform._$rawMatrix();let e=v.sqrt(t[0]*t[0]+t[1]*t[1]);if(!E.isInteger(e)){const t=e.toString(),i=t.indexOf("e");-1!==i&&(e=+t.slice(0,i)),e=+e.toFixed(4)}return 0>t[0]?-1*e:e}set scaleX(t){if(t=$t(+t,k,N),!E.isInteger(t)){const e=t.toString(),i=e.indexOf("e");-1!==i&&(t=+e.slice(0,i)),t=+t.toFixed(4)}if(this._$scaleX===t)return;const e=this._$transform,i=null!==e._$matrix,s=i?e._$matrix:e.matrix;if(0===s.b||C(s.b))s.a=t;else{let e=v.atan2(s.b,s.a);e===-v.PI&&(e=0),s.b=t*v.sin(e),s.a=t*v.cos(e)}i?(this._$doChanged(),x()):(e.matrix=s,lr(s)),this._$scaleX=t}get scaleY(){if(null!==this._$scaleY)return this._$scaleY;const t=this._$transform._$rawMatrix();let e=v.sqrt(t[2]*t[2]+t[3]*t[3]);if(!E.isInteger(e)){const t=e.toString(),i=t.indexOf("e");-1!==i&&(e=+t.slice(0,i)),e=+e.toFixed(4)}return 0>t[3]?-1*e:e}set scaleY(t){if(t=$t(+t,k,N),!E.isInteger(t)){const e=t.toString(),i=e.indexOf("e");-1!==i&&(t=+e.slice(0,i)),t=+t.toFixed(4)}if(this._$scaleY===t)return;const e=this._$transform,i=null!==e._$matrix,s=i?e._$matrix:e.matrix;if(0===s.c||C(s.c))s.d=t;else{let e=v.atan2(-s.c,s.d);e===-v.PI&&(e=0),s.c=-t*v.sin(e),s.d=t*v.cos(e)}i?(this._$doChanged(),x()):(e.matrix=s,lr(s)),this._$scaleY=t}get stage(){if(this._$stage)return this._$stage;const t=this._$parent;return t?t._$stage:null}get transform(){return this._$transform}set transform(t){this._$transform=t}get visible(){return this._$visible}set visible(t){this._$visible!==t&&(this._$visible=!!t,this._$doChanged(),x())}get width(){const t="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),e=gt(t,this._$transform._$rawMatrix());Q(t);const i=v.abs(e.xMax-e.xMin);switch(Q(e),!0){case 0===i:case i===b:case i===-1/0:return 0;default:return+i.toFixed(2)}}set width(t){if(!C(t=+t)&&t>-1){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=this.rotation,s=i?gt(e,this._$transform._$rawMatrix()):e;i&&Q(e);const r=v.abs(s.xMax-s.xMin);switch(Q(s),!0){case 0===r:case r===b:case r===-1/0:this.scaleX=0;break;default:this.scaleX=t/r}}}get x(){return this._$transform._$rawMatrix()[4]}set x(t){const e=this._$transform;if(e._$matrix)e._$matrix.tx=t,this._$doChanged(),x();else{const i=e.matrix;i.tx=t,e.matrix=i,lr(i)}}get y(){return this._$transform._$rawMatrix()[5]}set y(t){const e=this._$transform;if(e._$matrix)e._$matrix.ty=t,this._$doChanged(),x();else{const i=e.matrix;i.ty=t,e.matrix=i,lr(i)}}getBounds(t=null){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=this._$transform.concatenatedMatrix,s=gt(e,i._$matrix);lr(i),Q(e);const r=K(s.xMin,s.xMax,s.yMin,s.yMax);Q(s),t||(t=this);const n=t._$transform.concatenatedMatrix;n.invert();const a=gt(r,n._$matrix);Q(r),lr(n);const h=a.xMin,o=a.yMin,l=a.xMax,c=a.yMax;return Q(a),new Dt(h,o,v.abs(l-h),v.abs(c-o))}globalToLocal(t){const e=this._$transform.concatenatedMatrix;e.invert();const i=new kt(t.x*e.a+t.y*e.c+e.tx,t.x*e.b+t.y*e.d+e.ty);return lr(e),i}hitTestObject(t){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=this._$transform.concatenatedMatrix,s=gt(e,i._$matrix);lr(i),Q(e);const r=t._$getBounds(null),n=t._$transform.concatenatedMatrix,a=gt(r,n._$matrix);lr(n),Q(r);const h=v.max(s.xMin,a.xMin),o=v.max(s.yMin,a.yMin),l=v.min(s.xMax,a.xMax),c=v.min(s.yMax,a.yMax);return Q(s),Q(a),l-h>=0&&c-o>=0}hitTestPoint(t,e,i=!1){if(i){let i=P,s=this._$parent;for(;s;)i=ut(s._$transform._$rawMatrix(),i),s=s._$parent;tr.setTransform(1,0,0,1,0,0),tr.beginPath();let r=!1;return"_$hit"in this&&"function"==typeof this._$hit&&(r=this._$hit(tr,i,{x:t,y:e},!0)),i!==P&&et(i),r}const s="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),r=gt(s,this._$transform._$rawMatrix());Q(s);const n=new Dt(r.xMin,r.yMin,r.xMax-r.xMin,r.yMax-r.yMin);Q(r);const a=this._$parent?this._$parent.globalToLocal(new kt(t,e)):new kt(t,e);return n.containsPoint(a)}localToGlobal(t){const e=this._$transform.concatenatedMatrix,i=new kt(t.x*e.a+t.y*e.c+e.tx,t.x*e.b+t.y*e.d+e.ty);return lr(e),i}getLocalVariable(t){return this._$variables?this._$variables.has(t)?this._$variables.get(t):void 0:null}setLocalVariable(t,e){this._$variables||(this._$variables=ot()),this._$variables.set(t,e)}hasLocalVariable(t){return!!this._$variables&&this._$variables.has(t)}deleteLocalVariable(t){this._$variables&&this._$variables.has(t)&&(this._$variables.delete(t),this._$variables.size||(ht(this._$variables),this._$variables=null))}getGlobalVariable(t){return Os.has(t)?Os.get(t):null}setGlobalVariable(t,e){Os.set(t,e)}hasGlobalVariable(t){return Os.has(t)}deleteGlobalVariable(t){Os.has(t)&&Os.delete(t)}clearGlobalVariable(){return Os.clear()}_$getPlaceObject(){if(!this._$placeObject){const t=this._$placeId;if(-1===t)return null;const e=this._$parent;if(!e||!e._$placeObjects)return null;const i=e._$placeMap;if(!i||!i.length)return null;const s=i["currentFrame"in e?e.currentFrame:1];if(!s)return null;const r=0|s[t],n=e._$placeObjects[r];return n?(this._$changePlace=r!==this._$currentPlaceId,this._$currentPlaceId=r,this._$placeObject=n,n):null}return this._$placeObject}_$baseBuild(t,e){const i=e._$loaderInfo;if(!i||!i._$data)throw new Error("the loaderInfo or data is nul.");return this._$parent=e,this._$root=e._$root,this._$stage=e._$stage,this._$loaderInfo=i,this._$characterId=0|t.characterId,this._$clipDepth=0|t.clipDepth,this._$startFrame=0|t.startFrame,this._$endFrame=0|t.endFrame,this._$name=t.name||"",i._$data.characters[t.characterId]}_$isUpdated(){return this._$updated}_$updateState(){this._$isNext=!0;const t=this._$parent;t&&t._$updateState()}_$doChanged(){this._$posted=!1,this._$isNext=!0,this._$updated=!0;const t=this._$parent;t&&(t._$updated||t._$doChanged())}_$drawFilter(t,e,i,s,r,n=null){const a=nt(this._$instanceId,"f");let h=At.get(a);const o=this._$isFilterUpdated(e,i,!0);if(h&&!o)return t.cachePosition=h,h;h&&At.set(a,null);const l=t.frameBuffer,c=n||t.getTextureFromRect(t.cachePosition),_=this._$applyFilter(t,i,c,e,s,r);l.textureManager.release(c);const $=this._$getLayerBounds(e);return h=l.createCachePosition(v.ceil(v.abs($.xMax-$.xMin)),v.ceil(v.abs($.yMax-$.yMin))),Q($),h.filterState=!0,h.matrix=`${e[0]}_${e[1]}_${e[2]}_${e[3]}_0_0`,h.offsetX=_.offsetX,h.offsetY=_.offsetY,t.drawTextureFromRect(_,h),At.set(a,h),at(a),h}_$getLayerBounds(t){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=gt(e,t);Q(e);const s=this._$filters||this.filters;if(!s.length)return i;let r=K(0,v.abs(i.xMax-i.xMin),0,v.abs(i.yMax-i.yMin));Q(i);let n=+v.sqrt(t[0]*t[0]+t[1]*t[1]),a=+v.sqrt(t[2]*t[2]+t[3]*t[3]);n/=f,a/=f,n*=2,a*=2;for(let t=0;t<s.length;++t)r=s[t]._$generateFilterRect(r,n,a);return r}_$executeAddedEvent(){this._$parent&&(this._$added||(this.willTrigger(wt.ADDED)&&this.dispatchEvent(new wt(wt.ADDED,!0)),this._$added=!0),this._$addedStage||null===this._$stage||(this.willTrigger(wt.ADDED_TO_STAGE)&&this.dispatchEvent(new wt(wt.ADDED_TO_STAGE)),this._$addedStage=!0))}_$prepareActions(){this._$nextFrame()}_$nextFrame(){return this._$executeAddedEvent(),this._$isNext=!1,!this._$posted&&Tr&&this._$postProperty(),!1}_$canApply(t=null){if(t)for(let e=0;e<t.length;++e)if(t[e]._$canApply())return!0;return!1}_$isFilterUpdated(t,e=null,i=!1){if(this._$isUpdated())return!0;if(i&&e)for(let t=0;t<e.length;++t)if(e[t]._$isUpdated())return!0;const s=At.get([this._$instanceId,"f"]);return!s||s.filterState!==i||s.matrix!==`${t[0]}_${t[1]}_${t[2]}_${t[3]}`}_$applyFilter(t,e,i,s,r,n){const a=+v.sqrt(s[0]*s[0]+s[1]*s[1]),h=+v.sqrt(s[2]*s[2]+s[3]*s[3]),o=v.atan2(s[1],s[0]),l=v.atan2(-s[2],s[3]),c=tt(v.cos(o),v.sin(o),-v.sin(l),v.cos(l),r/2,n/2),_=tt(1,0,0,1,-i.width/2,-i.height/2),$=ut(c,_);et(c),et(_);const u=t.frameBuffer,d=u.currentAttachment,g=u.createCacheAttachment(r,n);t._$bind(g),t.reset(),t.setTransform($[0],$[1],$[2],$[3],$[4],$[5]),et($),t.drawImage(i,0,0,i.width,i.height),t._$offsetX=0,t._$offsetY=0;const f=tt(a,0,0,h,0,0);let p=null;for(let i=0;i<e.length;++i)p=e[i]._$applyFilter(t,f);if(et(f),!p)return i;const m=t._$offsetX,x=t._$offsetY;return t._$offsetX=0,t._$offsetY=0,p.offsetX=m,p.offsetY=x,t._$bind(d),u.releaseAttachment(g,!1),p}_$shouldClip(t){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds(t):K(),i=v.abs(e.xMax-e.xMin),s=v.abs(e.yMax-e.yMin);return Q(e),!(!i||!s)}_$startClip(t,e){t.drawInstacedArray();const i="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds(e):K(),s=t._$startClip(i);if(Q(i),!s)return!1;t._$enterClip(),t._$beginClipDef();let r=!1;return"_$children"in this&&(r=!0,t._$updateContainerClipFlag(!0)),this._$clip(t,e),this._$updated=!1,r&&(t._$updateContainerClipFlag(!1),t._$drawContainerClip()),t._$endClipDef(),!0}_$removeWorkerInstance(){Tr&&Tr.postMessage({command:"remove",instanceId:this._$instanceId})}_$registerProperty(t,e=0){t[e++]=+this._$visible,t[e++]=this._$placeId,t[e++]=this._$clipDepth,t[e++]=+this._$isMask;const i=this._$mask;if(t[e++]=+(null!==i),i){t[e++]=i._$instanceId;let s=P,r=i._$parent;for(;r;)s=ut(r._$transform._$rawMatrix(),s),r=r._$parent;t[e++]=s[0],t[e++]=s[1],t[e++]=s[2],t[e++]=s[3],t[e++]=s[4],t[e++]=s[5]}else e+=7;if(this._$visible){const i=this._$transform,s=i._$rawMatrix();t[e++]=s[0],t[e++]=s[1],t[e++]=s[2],t[e++]=s[3],t[e++]=s[4],t[e++]=s[5];const r=i._$rawColorTransform();t[e++]=r[0],t[e++]=r[1],t[e++]=r[2],t[e++]=r[3],t[e++]=r[4],t[e++]=r[5],t[e++]=r[6],t[e++]=r[7]}else e+=6,e+=8;const s=this._$blendMode||this.blendMode;t[e++]=br(s);const r=this._$scale9Grid;t[e++]=+(null!==r),r?(t[e++]=r.x,t[e++]=r.y,t[e++]=r.width,t[e++]=r.height):e+=4}_$createMessage(){const t={command:"setProperty",buffer:new Float32Array,instanceId:this._$instanceId,parentId:this._$parent?this._$parent._$instanceId:-1,visible:this._$visible};this._$placeId>-1&&(t.depth=this._$placeId),this._$clipDepth&&(t.clipDepth=this._$clipDepth),this._$isMask&&(t.isMask=this._$isMask);const e=this._$mask;if(e){t.maskId=e._$instanceId;let i=P,s=e._$parent;for(;s;)i=ut(s._$transform._$rawMatrix(),i),s=s._$parent;t.maskMatrix=i}if(this._$visible){const e=this._$transform,i=e._$rawMatrix();1!==i[0]&&(t.a=i[0]),0!==i[1]&&(t.b=i[1]),0!==i[2]&&(t.c=i[2]),1!==i[3]&&(t.d=i[3]),0!==i[4]&&(t.tx=i[4]),0!==i[5]&&(t.ty=i[5]);const s=e._$rawColorTransform();1!==s[0]&&(t.f0=s[0]),1!==s[1]&&(t.f1=s[1]),1!==s[2]&&(t.f2=s[2]),1!==s[3]&&(t.f3=s[3]),0!==s[4]&&(t.f4=s[4]),0!==s[5]&&(t.f5=s[5]),0!==s[6]&&(t.f6=s[6]),0!==s[7]&&(t.f7=s[7]);const r=this._$filters||this.filters;if(r&&r.length){const e=nt();for(let t=0;t<r.length;++t)e.push(r[t]._$toArray());t.filters=e}const n=this._$blendMode||this.blendMode;"normal"!==n&&(t.blendMode=n);const a=this._$scale9Grid;if(a&&this._$isUpdated()){const e=this._$parent._$transform.concatenatedMatrix;t.matrixBase=e._$matrix.slice(),lr(e),t.grid={x:a.x,y:a.y,w:a.width,h:a.height}}}return t}}class Jt extends Qt{constructor(){super(),this._$mouseEnabled=!0}get mouseEnabled(){return this._$mouseEnabled}set mouseEnabled(t){this._$mouseEnabled=!!t}}class Zt extends Jt{constructor(){return super(),this._$placeMap=null,this._$placeObjects=null,this._$controller=null,this._$dictionary=null,this._$children=nt(),this._$needsChildren=!0,this._$mouseChildren=!0,this._$wait=!0,this._$names=ot(),new Proxy(this,{get:(t,e)=>t._$names.size&&t._$names.has(e)?t._$names.get(e):t[e]})}get mouseChildren(){return this._$mouseChildren}set mouseChildren(t){this._$mouseChildren=!!t}get numChildren(){return this._$needsChildren?this._$getChildren().length:this._$children.length}addChild(t){return t._$parent&&t._$parent._$remove(t,!(t._$parent._$instanceId===this._$instanceId)),this._$getChildren().push(t),t._$name&&this._$names.set(t._$name,t),this._$addChild(t)}addChildAt(t,e){t._$parent&&t._$parent._$remove(t,!(t._$parent._$instanceId===this._$instanceId));const i=this._$getChildren(),s=i.length;if(0>e||e>s)throw new RangeError(`RangeError: addChildAt: index error: ${e}`);if(s&&s>e){i.splice(e,0,t);for(let t=0;t<e;++t){const e=i[t];e._$name&&this._$names.set(e._$name,e)}}else i.push(t),t._$name&&this._$names.set(t._$name,t);return this._$addChild(t)}contains(t){if(this._$instanceId===t._$instanceId)return!0;const e=this._$getChildren();for(let i=0;i<e.length;++i){const s=e[i];if(s._$instanceId===t._$instanceId)return!0;if(s instanceof Zt&&s.contains(t))return!0}return!1}getChildAt(t){const e=this._$getChildren();if(0>t||t>e.length)throw new RangeError(`RangeError: getChildAt: index error: ${t}`);return t in e?e[t]:null}getChildByName(t){if(!t)return null;const e=this._$getChildren();for(let i=0;i<e.length;++i){const s=e[i];if(s.name===t)return s}return null}getChildIndex(t){if(t._$parent!==this)throw new Error("ArgumentError: getChildIndex: not child");const e=this._$getChildren().indexOf(t);if(-1===e)throw new Error("ArgumentError: getChildIndex: not found.");return e}removeChild(t){if(t._$parent!==this)throw new Error("ArgumentError: removeChild: not child");return this._$remove(t)}removeChildAt(t){return this._$remove(this.getChildAt(t))}removeChildren(t=0,e=2147483647){const i=this._$getChildren();if(i.length){t=$t(t,0,2147483646,0)-1,e=$t(e,1,134217727,134217727);for(let s=v.min(e,i.length-1);s>t;--s)this._$remove(i[s])}}setChildIndex(t,e){const i=this.getChildIndex(t);if(i===e)return;const s=this._$getChildren();s.splice(i,1),s.splice(e,0,t),Tr&&this._$postChildrenIds(),this._$doChanged()}swapChildren(t,e){const i=this._$getChildren(),s=this.getChildIndex(t),r=this.getChildIndex(e);i[s]=e,i[r]=t,Tr&&this._$postChildrenIds(),this._$doChanged()}swapChildrenAt(t,e){this.swapChildren(this.getChildAt(t),this.getChildAt(e))}_$getBounds(t=null){let e=P;if(t){e=t;const i=this._$transform._$rawMatrix();1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]&&0===i[4]&&0===i[5]||(e=ut(t,i))}const i=this._$needsChildren?this._$getChildren():this._$children;if(!i.length){const i=K(e[4],-e[4],e[5],-e[5]);return t&&e!==t&&et(e),i}const s=E.MAX_VALUE;let r=s,n=-s,a=s,h=-s;for(let t=0;t<i.length;++t){const s=i[t]._$getBounds(e);r=v.min(r,s.xMin),n=v.max(n,s.xMax),a=v.min(a,s.yMin),h=v.max(h,s.yMax),Q(s)}return t&&e!==t&&et(e),K(r,n,a,h)}_$getLayerBounds(t){const e=this._$needsChildren?this._$getChildren():this._$children;if(!e.length)return K(0,0,0,0);const i=E.MAX_VALUE;let s=i,r=-i,n=i,a=-i;for(let i=0;i<e.length;++i){const h=e[i];let o=t;const l=h._$transform._$rawMatrix();1===l[0]&&0===l[1]&&0===l[2]&&1===l[3]&&0===l[4]&&0===l[5]||(o=ut(t,l));const c=h._$getLayerBounds(o);s=v.min(s,c.xMin),r=v.max(r,c.xMax),n=v.min(n,c.yMin),a=v.max(a,c.yMax),Q(c),o!==t&&et(o)}const h=this._$filters||this.filters;if(!h.length)return K(s,r,n,a);let o=K(0,r-s,0,a-n),l=+v.sqrt(t[0]*t[0]+t[1]*t[1]),c=+v.sqrt(t[2]*t[2]+t[3]*t[3]);l/=f,c/=f,l*=2,c*=2;for(let t=0;t<h.length;++t)o=h[t]._$generateFilterRect(o,l,c);return r+=o.xMax-(r-s),a+=o.yMax-(a-n),s+=o.xMin,n+=o.yMin,Q(o),K(s,r,n,a)}_$getChildren(){if(this._$needsChildren){this._$needsChildren=!1;const t=this._$children;if(!this._$controller)return t;const e="_$currentFrame"in this?this._$currentFrame:1,i=this._$controller[e];if(!t.length){if(i)for(let e=0;e<i.length;++e){const s=this._$createInstance(i[e]);s._$placeId=e;const r=s.loopConfig;r&&(s._$currentFrame=s._$getLoopFrame(r)),t.push(s),s._$name&&this._$names.set(s._$name,s)}return t}const s=!!Tr&&!!this._$stage,r=ot(),n=ot();let a=0;const h=nt();for(let o=0;o<t.length;++o){const l=t[o],c=l._$parent;if(!c||c._$instanceId!==this._$instanceId)continue;const _=l._$instanceId,$=l._$startFrame,u=l._$endFrame;if(1===$&&0===u||$<=e&&u>e){if(l._$isNext=!0,l._$placeObject=null,l._$filters=null,l._$blendMode=null,-1===l._$id){h.push(l),l._$name&&this._$names.set(l._$name,l);continue}const t=i[a];if(l._$id===t){l._$placeId=a,h.push(l),l._$name&&this._$names.set(l._$name,l),n.has(t)&&n.delete(t),r.set(t,!0),a++,s&&l._$postProperty();continue}n.set(l._$id,l)}else s&&l._$removeWorkerInstance(),At.setRemoveTimer(_),l._$loaderInfo&&l._$characterId&&At.setRemoveTimer(`${l._$loaderInfo._$id}@${l._$characterId}`),l._$graphics&&At.setRemoveTimer(l._$graphics._$uniqueKey),l.willTrigger(wt.REMOVED)&&l.dispatchEvent(new wt(wt.REMOVED,!0)),l.willTrigger(wt.REMOVED_FROM_STAGE)&&l.dispatchEvent(new wt(wt.REMOVED_FROM_STAGE,!0)),l._$added=!1,l._$addedStage=!1,l._$active=!1,l._$updated=!0,l._$filters=null,l._$blendMode=null,l._$isNext=!0,l._$placeObject=null,l._$created=!1,l._$posted=!1,l instanceof Zt&&(l._$executeRemovedFromStage(),l._$removeParentAndStage())}if(i)for(let t=0;t<i.length;++t){const e=i[t];if(r.has(e))continue;const s=n.has(e)?n.get(e):this._$createInstance(e);s._$placeId=t;const a=s.loopConfig;a&&(s._$currentFrame=s._$getLoopFrame(a)),h.push(s),s._$name&&this._$names.set(s._$name,s)}ht(r),ht(n),t.length=0,t.push(...h),at(h)}return this._$children}_$clearChildren(){this._$doChanged(),x(),this._$names.clear(),this._$needsChildren=!0}_$addChild(t){return t._$parent=this,t._$stage&&t._$root||(t._$stage=this._$stage,t._$root=this._$root),t instanceof Zt&&(t._$setParentAndStage(),t._$wait=!0),t._$added||(t.willTrigger(wt.ADDED)&&t.dispatchEvent(new wt(wt.ADDED,!0)),t._$added=!0),null===this._$stage||t._$addedStage||(t.willTrigger(wt.ADDED_TO_STAGE)&&t.dispatchEvent(new wt(wt.ADDED_TO_STAGE)),t._$addedStage=!0,t instanceof Zt&&t._$executeAddedToStage(),Tr&&(t._$createWorkerInstance(),this._$postChildrenIds())),this._$doChanged(),t._$active=!0,t._$updated=!0,t._$isNext=!0,t}_$setParentAndStage(){const t=this._$needsChildren?this._$getChildren():this._$children;for(let e=0;e<t.length;++e){const i=t[e];i._$root=this._$root,i._$stage=this._$stage,i instanceof Zt&&(i._$setParentAndStage(),i._$wait=!0)}}_$executeAddedToStage(){const t=this._$needsChildren?this._$getChildren():this._$children,e=nt();for(let i=0;i<t.length;++i){const s=t[i];s&&(e.push(s._$instanceId),s._$addedStage||(Tr&&s._$createWorkerInstance(),s.willTrigger(wt.ADDED_TO_STAGE)&&s.dispatchEvent(new wt(wt.ADDED_TO_STAGE)),s._$addedStage=!0),s instanceof Zt&&s._$executeAddedToStage())}Tr&&this._$postChildrenIds(e),at(e)}_$remove(t,e=!0){t._$transform._$transform(),t.hasEventListener(wt.ENTER_FRAME)&&t.removeAllEventListener(wt.ENTER_FRAME),t.hasEventListener(wt.EXIT_FRAME)&&t.removeAllEventListener(wt.EXIT_FRAME),t.hasEventListener(wt.FRAME_CONSTRUCTED)&&t.removeAllEventListener(wt.FRAME_CONSTRUCTED),t.hasEventListener(wt.RENDER)&&t.removeAllEventListener(wt.RENDER),t.hasEventListener(wt.ACTIVATE)&&t.removeAllEventListener(wt.ACTIVATE),t.hasEventListener(wt.DEACTIVATE)&&t.removeAllEventListener(wt.DEACTIVATE),t.hasEventListener("keyDown")&&t.removeAllEventListener("keyDown"),t.hasEventListener("keyUp")&&t.removeAllEventListener("keyUp");const i=this._$needsChildren?this._$getChildren():this._$children,s=this.getChildIndex(t);return i.splice(s,1),this._$names.delete(t.name),e&&(t.willTrigger(wt.REMOVED)&&t.dispatchEvent(new wt(wt.REMOVED,!0)),null!==this._$stage&&(Tr&&(t._$removeWorkerInstance(),this._$postChildrenIds()),t.willTrigger(wt.REMOVED_FROM_STAGE)&&t.dispatchEvent(new wt(wt.REMOVED_FROM_STAGE)),t instanceof Zt&&t._$executeRemovedFromStage()),At.setRemoveTimer(t._$instanceId),t._$loaderInfo&&t._$characterId&&At.setRemoveTimer(`${t._$loaderInfo._$id}@${t._$characterId}`),t._$graphics&&At.setRemoveTimer(t._$graphics._$uniqueKey),t instanceof Zt&&t._$removeParentAndStage(),t._$stage=null,t._$parent=null,t._$root=null,t._$active=!1,t._$wait=!0,t._$updated=!0,t._$added=!1,t._$addedStage=!1,t._$created=!1,t._$posted=!1,this._$doChanged()),t}_$executeRemovedFromStage(){const t=this._$getChildren().slice(0);for(let e=0;e<t.length;++e){const i=t[e];i&&(i._$addedStage&&(Tr&&i._$removeWorkerInstance(),i.willTrigger(wt.REMOVED_FROM_STAGE)&&i.dispatchEvent(new wt(wt.REMOVED_FROM_STAGE)),i._$created=!1,i._$posted=!1,i._$addedStage=!1),i instanceof Zt&&i._$executeRemovedFromStage())}}_$removeParentAndStage(){const t=this._$needsChildren?this._$getChildren():this._$children;for(let e=0;e<t.length;++e){const i=t[e];At.setRemoveTimer(i._$instanceId),i._$loaderInfo&&i._$characterId&&At.setRemoveTimer(`${i._$loaderInfo._$id}@${i._$characterId}`),i._$graphics&&At.setRemoveTimer(i._$graphics._$uniqueKey),i instanceof Zt&&i._$removeParentAndStage(),i._$stage=null,i._$root=null,i._$addedStage=!1}if("_$sounds"in this){const t=this._$sounds;if(t.size)for(const e of t.values())for(let t=0;t<e.length;++t)e[t].stop()}this._$needsChildren=!0}_$prepareActions(){const t=this._$needsChildren?this._$getChildren():this._$children;for(let e=t.length-1;e>-1;--e)t[e]._$prepareActions();this._$executeAddedEvent()}_$nextFrame(){let t=!1;const e=this._$getChildren();for(let i=e.length-1;i>-1;--i){const s=e[i];s._$isNext&&(t?s._$nextFrame():t=s._$nextFrame())}return this._$executeAddedEvent(),this._$isNext=t,!this._$posted&&Tr&&this._$postProperty(),this._$isNext}_$clip(t,e){let i=e;const s=this._$transform._$rawMatrix();1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=ut(e,s));const r=this._$getChildren();for(let e=0;e<r.length;++e){const s=r[e];s._$isMask||(s._$clip(t,i),s._$updated=!1)}i!==e&&et(i)}_$preDraw(t,e){let i=e;const s=this._$transform._$rawMatrix();if((s!==Vs&&1!==s[0]||0!==s[1]||0!==s[2]||1!==s[3]||0!==s[4]||0!==s[5])&&(i=ut(e,s)),!i[0]&&!i[1]||!i[2]&&!i[3])return i!==e&&et(i),null;const r=V.pop()||{isLayer:!1,isUpdated:null,canApply:null,matrix:null,color:null,blendMode:"normal",filters:null,sw:0,sh:0};r.matrix=i;const n=this._$filters||this.filters,a=this._$blendMode||this.blendMode;if(n.length>0||"normal"!==a){const s=this._$getBounds(null),h=gt(s,i);Q(s);const o=+h.xMax,l=+h.xMin,c=+h.yMax,_=+h.yMin;Q(h);const $=v.ceil(v.abs(o-l)),u=v.ceil(v.abs(c-_));if(0>=$||0>=u)return Et(r),i!==e&&et(i),null;let d=+v.sqrt(i[0]*i[0]+i[1]*i[1]);if(!E.isInteger(d)){const t=d.toString(),e=t.indexOf("e");-1!==e&&(d=+t.slice(0,e)),d=+d.toFixed(4)}let g=+v.sqrt(i[2]*i[2]+i[3]*i[3]);if(!E.isInteger(g)){const t=g.toString(),e=t.indexOf("e");-1!==e&&(g=+t.slice(0,e)),g=+g.toFixed(4)}r.canApply=this._$canApply(n);let f=K(0,$,0,u);if(r.canApply&&n)for(let t=0;t<n.length;++t)f=n[t]._$generateFilterRect(f,d,g);const p=t.frameBuffer.currentAttachment;if(!p||!p.texture||l-f.xMin>p.width||_-f.yMin>p.height)return Q(f),Et(r),i!==e&&et(i),null;if(0>l+f.xMax||0>_+f.yMax)return Q(f),Et(r),i!==e&&et(i),null;let m=i[4]-l,x=i[5]-_;t._$startLayer(K(l,o,_,c));const b=this._$isFilterUpdated(i,n,r.canApply),T=this._$getLayerBounds(i),y=v.ceil(v.abs(T.xMax-T.xMin)),A=v.ceil(v.abs(T.yMax-T.yMin));Q(T);const M=y-f.xMax+f.xMin,S=A-f.yMax+f.yMin;m+=M,x+=S,r.sw=M,r.sh=S,b&&t._$saveAttachment(v.ceil($+M),v.ceil(u+S),!0),r.isLayer=!0,r.isUpdated=b,r.filters=n,r.blendMode=a,r.color=it(),r.matrix=tt(i[0],i[1],i[2],i[3],m,x),i!==e&&et(i),Q(f)}return r}_$postDraw(t,e,i,s){t.drawInstacedArray();const r=nt(this._$instanceId,"f"),n=t.frameBuffer,a=s.matrix;let h=0,o=0,l=At.get(r);if(!l||s.isUpdated){l&&At.set(r,null),l=n.getTextureFromCurrentAttachment();const i=s.filters;let c=!1;if(i&&i.length){for(let s=0;s<i.length;++s)l=i[s]._$applyFilter(t,e);c=!0,h=t._$offsetX,o=t._$offsetY,t._$offsetX=0,t._$offsetY=0}l.filterState=c,l.matrix=`${a[0]}_${a[1]}_${a[2]}_${a[3]}`,l.offsetX=h,l.offsetY=o,At.set(r,l),t._$restoreAttachment()}l.offsetX&&(h=l.offsetX),l.offsetY&&(o=l.offsetY),t.reset(),t.globalAlpha=$t(i[3]+i[7]/255,0,1),t.globalCompositeOperation=s.blendMode;const c=t.getCurrentPosition();t.setTransform(1,0,0,1,c.xMin-h-s.sw,c.yMin-o-s.sh),t.drawImage(l,0,0,l.width,l.height,i),t._$endLayer(),et(s.matrix),Et(s),t.cachePosition=null}_$draw(t,e,i){if(!this._$visible)return;let s=i;const r=this._$transform._$rawColorTransform();if((r!==O&&1!==r[0]||1!==r[1]||1!==r[2]||1!==r[3]||0!==r[4]||0!==r[5]||0!==r[6]||0!==r[7])&&(s=dt(i,r)),!$t(s[3]+s[7]/255,0,1,0))return;const n=this._$getChildren(),a=n.length;if(!a)return;const h=this._$preDraw(t,e);if(!h)return;if(h.isLayer&&!h.isUpdated)return void this._$postDraw(t,e,s,h);const o=h.matrix,l=h.isLayer&&h.color?h.color:s;let c=!0,_=0;const $=ar(),u=t.isLayer,d=this._$isUpdated();for(let e=0;e<a;++e){const i=n[e];if(d&&(i._$placeObject=null),i._$isMask)continue;const s=i._$blendMode||i.blendMode;if(("alpha"===s||"erase"===s)&&!u)continue;if(_&&(i._$placeId>_||i._$clipDepth>0)&&(t.restore(),c&&t._$leaveClip(),_=0,c=!0),!c)continue;if(i._$clipDepth>0){_=i._$clipDepth,c=i._$shouldClip(o),c&&(t.save(),c=i._$startClip(t,o));continue}const r=i._$mask;if(r){let e;if(r._$updated=!1,this===r._$parent)e=o;else{e=P;let i=r._$parent;for(;i;)e=ut(i._$transform._$rawMatrix(),e),i=i._$parent;const s=$.scaleX,n=tt(s,0,0,s,0,0);if(e=ut(n,e),et(n),t.isLayer){const i=t.getCurrentPosition();e[4]-=i.xMin,e[5]-=i.yMin}}if(!r._$shouldClip(e))continue;const i=r._$startClip(t,e);if(t.save(),!i){t.restore();continue}}i._$draw(t,o,l),i._$updated=!1,r&&(t.restore(),t._$leaveClip())}if(_&&(t.restore(),c&&t._$leaveClip()),h.isLayer)return this._$postDraw(t,e,s,h);h.matrix!==e&&et(h.matrix),s!==i&&st(s),Et(h)}_$mouseHit(t,e,i,s=!0){let r=e;const n=this._$transform._$rawMatrix();n!==P&&(r=ut(e,n));const a=this._$getChildren(),h=nt(),o=nt(),l=ot();let c=0,_=0;for(let t=0;t<a.length;++t){const e=a[t];(e._$visible||e._$hitObject)&&(e._$clipDepth?(_=h.length,c=e._$clipDepth,h.push(e)):(c&&e._$placeId>c&&(_=0,c=0),_&&l.set(e._$instanceId,_),o.push(e)))}const $=this._$mouseChildren&&s;let u=!1;const d=this._$root===this;for(;o.length;){const e=o.pop();if(e._$isMask)continue;if(d&&!(e instanceof Jt))continue;if(l.has(e._$instanceId)){const s=l.get(e._$instanceId);if(!s)continue;if(!h[s]._$hit(t,r,i,!0))continue}const s=e._$mask;if(s)if(this===s._$parent){if(!s._$hit(t,r,i,!0))continue}else{let e=P,r=s._$parent;for(;r;)e=ut(r._$transform._$rawMatrix(),e),r=r._$parent;if(!s._$hit(t,e,i,!0))continue}if(e._$mouseHit(t,r,i,$)||e._$hitArea&&e._$hitArea._$mouseHit(t,r,i,$)){if(e._$root===e)return!0;if(!$)return!0;if(u=!0,e instanceof Jt){if(!e.mouseEnabled&&!e._$hitObject)continue;return Qs||i.pointer||("_$text"in e&&"type"in e&&"input"===e.type&&(i.pointer="text"),"buttonMode"in e&&"useHandCursor"in e&&e.buttonMode&&e.useHandCursor&&(i.pointer="pointer")),i.hit||(i.hit=!e.mouseEnabled&&e._$hitObject?e._$hitObject:e),!0}}}return at(h),at(o),ht(l),r!==e&&et(r),u}_$hit(t,e,i,s=!1){let r=e;const n=this._$transform._$rawMatrix();n!==P&&(r=ut(e,n));const a=this._$getChildren();for(let e=a.length;e>-1;--e){const n=a[e];if(!n._$isMask&&n._$hit(t,r,i,s))return!0}return r!==e&&et(r),!1}_$createInstance(t){if(!this._$dictionary)throw new Error("the dictionary is null.");const e=this._$dictionary[t],i=this._$loaderInfo;if(!i||!i._$data)throw new Error("the loaderInfo or data is null.");const s=i._$data.characters[e.characterId],r=vr(s.extends);return r._$build(e,this),r._$id=t,r}_$outCheck(t,e){let i=P,s=this._$parent;for(;s;)i=ut(s._$transform._$rawMatrix(),i),s=s._$parent;tr.setTransform(1,0,0,1,0,0),tr.beginPath();const r={x:t,y:e,pointer:"",hit:null};return this._$mouseHit(tr,i,r)}_$createWorkerInstance(){if(this._$created||!Tr)return;this._$created=!0,this._$posted=!0,this._$updated=!1;let t=0;const e=sr();e[t++]=this._$instanceId,e[t++]=this._$parent?this._$parent._$instanceId:-1,this._$registerProperty(e,2);const i=rr();i.command="createDisplayObjectContainer",i.buffer=e;const s=nt(e.buffer);Tr.postMessage(i,s),nr(i),at(s),this._$postChildrenIds()}_$postProperty(){if(!Tr)return;this._$postChildrenIds();const t=nt(),e=this._$createMessage();Tr.postMessage(e,t),at(t),this._$posted=!0,this._$updated=!1}_$postChildrenIds(t=null){if(!Tr||!this._$created)return;let e=!1;if(!t){const i=this._$getChildren();t=nt();for(let e=0;e<i.length;++e)t.push(i[e]._$instanceId);e=!0}const i=new Int32Array(t.length+1);i[0]=this._$instanceId,i.set(t,1);const s=rr();s.command="setChildren",s.buffer=i;const r=nt(i.buffer);Tr.postMessage(s,r),nr(s),at(r),e&&at(t)}}class te{constructor(t=0,i=0){this._$instanceId=e(),this._$width=0|t,this._$height=0|i,this._$buffer=null,this._$image=null,this._$canvas=null,this._$texture=null}static toString(){return"[class BitmapData]"}static get namespace(){return"next2d.display.BitmapData"}toString(){return"[object BitmapData]"}get namespace(){return"next2d.display.BitmapData"}get instanceId(){return this._$instanceId}get height(){return this._$height}get buffer(){return this._$buffer}set buffer(t){if(this._$canvas=null,this._$image=null,this._$buffer=t,this._$texture){const t=ar().context;t&&t.frameBuffer.releaseTexture(this._$texture),this._$texture=null}}get image(){return this._$image}set image(t){if(this._$canvas=null,this._$buffer=null,this._$image=t,this._$texture){const t=ar().context;t&&t.frameBuffer.releaseTexture(this._$texture),this._$texture=null}t&&(this._$width=t.width,this._$height=t.height)}get canvas(){return this._$canvas}set canvas(t){if(this._$image=null,this._$buffer=null,this._$canvas=t,this._$texture){const t=ar().context;t&&t.frameBuffer.releaseTexture(this._$texture),this._$texture=null}t&&(this._$width=t.width,this._$height=t.height)}get width(){return this._$width}clone(){const t=new te(this.width,this.height);if(null!==this._$image||null!==this._$canvas){const e=At.getCanvas();e.width=this.width,e.height=this.height;const i=e.getContext("2d");if(!i)throw new Error("the context is null.");this._$image&&i.drawImage(this._$image,0,0),this._$canvas&&i.drawImage(this._$canvas,0,0),t.canvas=e}else null!==this._$buffer&&(t._$buffer=this._$buffer.slice());return t}getTexture(){const{width:t,height:e}=this;if(!t||!e)return null;const i=ar().context;if(!i)throw new Error("the context is null.");return null!==this._$texture||(null!==this._$image&&(this._$texture=i.frameBuffer.createTextureFromImage(this._$image)),null!==this._$canvas&&(this._$texture=i.frameBuffer.createTextureFromCanvas(this._$canvas)),null!==this._$buffer&&(this._$texture=i.frameBuffer.createTextureFromPixels(t,e,this._$buffer,!0))),this._$texture}draw(t,e=null,i=null,s=null,r=null){const{width:n,height:a}=this;if(!n||!a)return;const h=ar(),o=h._$width,l=h._$height;(n>o||a>l)&&(h._$width=n,h._$height=a,h._$resizeCanvas(n,a,h.scaleX));const c=i?i._$colorTransform:O;let _=e?e._$matrix:P;if(e){const e=t._$transform.matrix;e.invert(),_=ut(_,e._$matrix),lr(e)}if(s||(s=At.getCanvas()),Tr){t._$stage||(t instanceof Zt?Er&&Er(t):(t._$createWorkerInstance(),t._$postProperty())),s.width=n,s.height=a;const e=s.getContext("2d");if(!e)throw new Error("the context is null.");e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,n,a);const i=t._$instanceId;Xs.set(i,{source:t,context:e,callback:r});const h=nt(),o={command:"bitmapDraw",sourceId:i,width:n,height:a};1===_[0]&&0===_[1]&&0===_[2]&&1===_[3]&&0===_[4]&&0===_[5]||(o.matrix=_.slice(),h.push(o.matrix.buffer)),1===c[0]&&1===c[1]&&1===c[2]&&1===c[3]&&0===c[4]&&0===c[5]&&0===c[6]&&0===c[7]||(o.colorTransform=c.slice(),h.push(o.colorTransform.buffer)),Tr.postMessage(o,h),at(h)}else{const e=h.context;if(!e)throw new Error("the context is null.");e.reset(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,h._$width,h._$height),e.beginPath(),t._$draw(e,_,c),e.drawInstacedArray(),e.frameBuffer.transferToMainTexture(),s.width=n,s.height=a;const i=s.getContext("2d");if(!i)return;i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,n,a),i.drawImage(h.canvas,0,0),r&&r(s)}e&&lr(e),i&&_r(i)}}class ee extends Ct{constructor(t,e){super(),this._$name=`${t}`,this._$frame=0|e}static toString(){return"[class FrameLabel]"}static get namespace(){return"next2d.display.FrameLabel"}toString(){return"[object FrameLabel]"}get namespace(){return"next2d.display.FrameLabel"}get frame(){return this._$frame}get name(){return this._$name}}class ie{constructor(t,e=null,i=!0,s=!1){this._$bitmapData=t,this._$matrix=e,this._$repeat=i,this._$smooth=s}clone(){return new ie(this._$bitmapData.clone(),this._$matrix?this._$matrix.clone():null,this._$repeat,this._$smooth)}toArray(){return nt(this._$bitmapData,this._$matrix,this._$repeat,this._$smooth)}}class se{constructor(t,e,i,s,r=null,n="pad",a="rgb",h=0){this._$type=t,this._$colors=e,this._$alphas=i,this._$ratios=s,this._$matrix=r,this._$spreadMethod=n,this._$interpolationMethod=a,this._$focalPointRatio=h,this._$colorStops=nt()}get colorStops(){if(!this._$colorStops.length){const t=v.min(v.min(this._$alphas.length,this._$colors.length),this._$ratios.length);for(let e=0;e<t;++e){const t=this._$colors[e],i="string"==typeof t?ft(t):t,s=Tt(i,this._$alphas[e]);this._$colorStops[e]={ratio:this._$ratios[e]/255,R:s.R,G:s.G,B:s.B,A:s.A}}}return this._$colorStops}toArray(){return nt(this._$type,this.colorStops,this._$matrix?this._$matrix._$matrix:P,this._$spreadMethod,this._$interpolationMethod,this._$focalPointRatio)}clone(){return new se(this._$type,this._$colors.slice(),this._$alphas.slice(),this._$ratios.slice(),this._$matrix?this._$matrix.clone():null,this._$spreadMethod,this._$interpolationMethod,this._$focalPointRatio)}}class re{constructor(t=null){this._$displayObject=t,this._$maxAlpha=0,this._$pointerX=0,this._$pointerY=0,this._$canDraw=!1,this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillStyleR=0,this._$fillStyleG=0,this._$fillStyleB=0,this._$fillStyleA=0,this._$doFill=!1,this._$lineType=0,this._$lineGradient=null,this._$caps="none",this._$joints="round",this._$miterLimit=0,this._$lineWidth=1,this._$lineStyleR=0,this._$lineStyleG=0,this._$lineStyleB=0,this._$lineStyleA=0,this._$doLine=!1,this._$xMin=E.MAX_VALUE,this._$xMax=-E.MAX_VALUE,this._$yMin=E.MAX_VALUE,this._$yMax=-E.MAX_VALUE,this._$buffer=null,this._$recode=null,this._$fills=null,this._$lines=null,this._$uniqueKey="",this._$cacheKeys=nt(),this._$cacheParams=nt(0,0,0),this._$bitmapId=0,this._$mode="shape",this._$posted=!1}static toString(){return"[class Graphics]"}static get namespace(){return"next2d.display.Graphics"}toString(){return"[object Graphics]"}get namespace(){return"next2d.display.Graphics"}static get MOVE_TO(){return 0}static get CURVE_TO(){return 1}static get LINE_TO(){return 2}static get CUBIC(){return 3}static get ARC(){return 4}static get FILL_STYLE(){return 5}static get STROKE_STYLE(){return 6}static get END_FILL(){return 7}static get END_STROKE(){return 8}static get BEGIN_PATH(){return 9}static get GRADIENT_FILL(){return 10}static get GRADIENT_STROKE(){return 11}static get CLOSE_PATH(){return 12}static get BITMAP_FILL(){return 13}static get BITMAP_STROKE(){return 14}beginBitmapFill(t,e=null,i=!0,s=!1){return this._$doFill&&this.endFill(),this._$fills||(this._$fills=nt()),this._$maxAlpha=1,this._$doFill=!0,this._$canDraw=!0,this._$fills.push(re.BEGIN_PATH),this._$fillType=re.BITMAP_FILL,this._$fillBitmap=new ie(t,e,i,s),this}beginFill(t=0,e=1){this._$doFill&&this.endFill(),this._$fills||(this._$fills=nt()),t=$t(pt(t),0,16777215,0),e=$t(e,0,1,1),this._$maxAlpha=v.max(this._$maxAlpha,e),this._$doFill=!0,this._$canDraw=!0,this._$fills.push(re.BEGIN_PATH);const i=Tt(t,e);return this._$fillType=re.FILL_STYLE,this._$fillStyleR=i.R,this._$fillStyleG=i.G,this._$fillStyleB=i.B,this._$fillStyleA=i.A,this}beginGradientFill(t,e,i,s,r=null,n="pad",a="rgb",h=0){this._$doFill&&this.endFill(),this._$fills||(this._$fills=nt());for(let t=0;t<i.length;++t)this._$maxAlpha=v.max(this._$maxAlpha,i[t]);return this._$doFill=!0,this._$canDraw=!0,this._$fills.push(re.BEGIN_PATH),this._$fillType=re.GRADIENT_FILL,this._$fillGradient=new se(t,e,i,s,r,n,a,h),this}clear(){return this._$maxAlpha=0,this._$pointerX=0,this._$pointerY=0,this._$canDraw=!1,this._$bitmapId=0,this._$mode="shape",this._$posted=!1,this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillStyleR=0,this._$fillStyleG=0,this._$fillStyleB=0,this._$fillStyleA=0,this._$doFill=!1,this._$lineType=0,this._$lineGradient=null,this._$caps="none",this._$joints="round",this._$miterLimit=0,this._$lineWidth=1,this._$lineStyleR=0,this._$lineStyleG=0,this._$lineStyleB=0,this._$lineStyleA=0,this._$doLine=!1,this._$xMin=E.MAX_VALUE,this._$xMax=-E.MAX_VALUE,this._$yMin=E.MAX_VALUE,this._$yMax=-E.MAX_VALUE,this._$recode&&at(this._$recode),this._$fills&&at(this._$fills),this._$lines&&at(this._$lines),this._$buffer=null,this._$recode=null,this._$fills=null,this._$lines=null,this._$cacheKeys.length=0,this._$uniqueKey="",this._$cacheParams.fill(0),this._$restart(),this}clone(){const t=new re;return t.copyFrom(this),t}copyFrom(t){t._$fillGradient&&(this._$fillGradient=t._$fillGradient.clone()),t._$fillBitmap&&(this._$fillBitmap=t._$fillBitmap.clone()),this._$doFill=t._$doFill,this._$fillType=t._$fillType,this._$fillStyleR=t._$fillStyleR,this._$fillStyleG=t._$fillStyleG,this._$fillStyleB=t._$fillStyleB,this._$fillStyleA=t._$fillStyleA,t._$lineGradient&&(this._$lineGradient=t._$lineGradient.clone()),this._$doLine=t._$doLine,this._$lineType=t._$lineType,this._$caps=t._$caps,this._$joints=t._$joints,this._$miterLimit=t._$miterLimit,this._$lineWidth=t._$lineWidth,this._$lineStyleR=t._$lineStyleR,this._$lineStyleG=t._$lineStyleG,this._$lineStyleB=t._$lineStyleB,this._$lineStyleA=t._$lineStyleA,this._$xMin=t._$xMin,this._$xMax=t._$xMax,this._$yMin=t._$yMin,this._$yMax=t._$yMax,this._$maxAlpha=t._$maxAlpha,this._$pointerX=t._$pointerX,this._$pointerY=t._$pointerY,this._$canDraw=t._$canDraw,t._$fills&&(this._$fills=t._$fills.slice(0)),t._$lines&&(this._$lines=t._$lines.slice(0)),t._$recode&&(this._$recode=t._$recode.slice(0))}cubicCurveTo(t,e,i,s,r,n){return r=+r||0,n=+n||0,this._$pointerX===r&&this._$pointerY===n||(t=+t||0,e=+e||0,i=+i||0,s=+s||0,this._$setBounds(t,e),this._$setBounds(i,s),this._$setBounds(r,n),this._$margePath(nt(re.CUBIC,t,e,i,s,r,n)),this._$pointerX=r,this._$pointerY=n,this._$restart()),this}curveTo(t,e,i,s){return i=+i||0,s=+s||0,this._$pointerX===i&&this._$pointerY===s||(t=+t||0,e=+e||0,this._$setBounds(t,e),this._$setBounds(i,s),this._$margePath(nt(re.CURVE_TO,t,e,i,s)),this._$pointerX=i,this._$pointerY=s,this._$restart()),this}drawCircle(t,e,i){return t=+t||0,e=+e||0,i=+i||0,i=v.round(i),this._$setBounds(t-i,e-i),this._$setBounds(t+i,e+i),this._$margePath(nt(re.MOVE_TO,t+i,e,re.ARC,t,e,i)),this._$pointerX=t,this._$pointerY=e,this._$restart(),this}drawEllipse(t,e,i,s){t=+t||0,e=+e||0,i=+i||0,s=+s||0;const r=(i=v.round(i))/2,n=(s=v.round(s))/2,a=t+r,h=e+n,o=t+i,l=e+s,c=4/3*(v.SQRT2-1),_=c*r,$=c*n;return this.moveTo(a,e).cubicCurveTo(a+_,e,o,h-$,o,h).cubicCurveTo(o,h+$,a+_,l,a,l).cubicCurveTo(a-_,l,t,h+$,t,h).cubicCurveTo(t,h-$,a-_,e,a,e)}drawRect(t,e,i,s){t=+t||0,e=+e||0,i=+i||0,s=+s||0;const r=v.round(t+i),n=v.round(e+s);return this.moveTo(t,e).lineTo(t,n).lineTo(r,n).lineTo(r,e).lineTo(t,e)}drawRoundRect(t,e,i,s,r,n=NaN){t=+t||0,e=+e||0,i=+i||0,s=+s||0,r=+r||0,n=+n||r,i=v.round(i),s=v.round(s);const a=(r=v.round(r))/2,h=(n=v.round(n))/2,o=4/3*(v.SQRT2-1),l=o*a,c=o*h,_=t+a,$=t+i,u=$-a,d=e+h,g=e+s,f=g-h;return this.moveTo(_,e).lineTo(u,e).cubicCurveTo(u+l,e,$,d-c,$,d).lineTo($,f).cubicCurveTo($,f+c,u+l,g,u,g).lineTo(_,g).cubicCurveTo(_-l,g,t,f+c,t,f).lineTo(t,d).cubicCurveTo(t,d-c,_-l,e,_,e)}endFill(){if(this._$doFill&&this._$fills&&this._$fills.length>7)switch(this._$recode||(this._$recode=nt()),this._$fills[2]===this._$fills[this._$fills.length-2]&&this._$fills[3]===this._$fills[this._$fills.length-1]||this._$fills.push(re.LINE_TO,this._$fills[2],this._$fills[3]),this._$recode.push(...this._$fills),this._$fillType){case re.FILL_STYLE:this._$recode.push(this._$fillType,this._$fillStyleR,this._$fillStyleG,this._$fillStyleB,this._$fillStyleA,re.END_FILL);break;case re.GRADIENT_FILL:this._$fillGradient&&this._$recode.push(this._$fillType,...this._$fillGradient.toArray());break;case re.BITMAP_FILL:this._$fillBitmap&&this._$recode.push(this._$fillType,...this._$fillBitmap.toArray())}return this._$fills&&(at(this._$fills),this._$fills=null),this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillStyleR=0,this._$fillStyleG=0,this._$fillStyleB=0,this._$fillStyleA=0,this._$doFill=!1,this._$restart(),this}endLine(){if(this._$doLine&&this._$lines)switch(this._$recode||(this._$recode=nt()),this._$recode.push(...this._$lines),at(this._$lines),this._$lines=null,this._$lineType){case re.STROKE_STYLE:this._$recode.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,this._$lineStyleR,this._$lineStyleG,this._$lineStyleB,this._$lineStyleA,re.END_STROKE);break;case re.GRADIENT_STROKE:this._$lineGradient&&this._$recode.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,...this._$lineGradient.toArray());break;case re.BITMAP_STROKE:this._$fillBitmap&&this._$recode.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,...this._$fillBitmap.toArray())}return this._$lineType=0,this._$lineWidth=0,this._$lineGradient=null,this._$lineStyleR=0,this._$lineStyleG=0,this._$lineStyleB=0,this._$lineStyleA=0,this._$caps="none",this._$joints="round",this._$miterLimit=0,this._$doLine=!1,this._$restart(),this}lineBitmapStyle(t,e=null,i=!0,s=!1){return this._$doLine&&this.endLine(),this._$lines||(this._$lines=nt()),this._$maxAlpha=1,this._$doLine=!0,this._$canDraw=!0,this._$lines.push(re.BEGIN_PATH),this._$lineType=re.BITMAP_STROKE,this._$fillBitmap=new ie(t,e,i,s),this}lineGradientStyle(t,e,i,s,r=null,n="pad",a="rgb",h=0){if(!this._$doLine)return this;this._$lines||(this._$lines=nt());for(let t=0;t<i.length;++t)this._$maxAlpha=v.max(this._$maxAlpha,i[t]);return this._$lines.push(re.BEGIN_PATH),this._$lineType=re.GRADIENT_STROKE,this._$lineGradient=new se(t,e,i,s,r,n,a,h),this}lineStyle(t=1,e=0,i=1,s="round",r="round",n=3){this._$doLine&&this.endLine(),this._$lines||(this._$lines=nt()),e=$t(pt(e),0,16777215,0),i=$t(+i,0,1,1),this._$maxAlpha=v.max(this._$maxAlpha,i),this._$doLine=!0,this._$canDraw=!0,this._$pointerX||this._$pointerY?this._$lines.push(re.BEGIN_PATH,re.MOVE_TO,this._$pointerX,this._$pointerY):this._$lines.push(re.BEGIN_PATH);const a=Tt(e,i);return this._$lineType=re.STROKE_STYLE,this._$lineStyleR=a.R,this._$lineStyleG=a.G,this._$lineStyleB=a.B,this._$lineStyleA=a.A,this._$lineWidth=t,this._$caps=`${s}`,this._$joints=`${r}`,"miter"===this._$joints&&(this._$miterLimit=n),this}lineTo(t,e){return t=+t||0,e=+e||0,this._$pointerX===t&&this._$pointerY===e||(this._$setBounds(t,e),this._$margePath(nt(re.LINE_TO,t,e)),this._$pointerX=t,this._$pointerY=e,this._$restart()),this}moveTo(t,e){t=+t||0,e=+e||0,this._$pointerX=t,this._$pointerY=e,this._$setBounds(t,e);let i=!1;return this._$doFill&&this._$fills&&this._$fills[this._$fills.length-3]===re.MOVE_TO&&(i=!0,this._$fills[this._$fills.length-2]=t,this._$fills[this._$fills.length-1]=e),this._$doLine&&this._$lines&&this._$lines[this._$lines.length-3]===re.MOVE_TO&&(i=!0,this._$lines[this._$lines.length-2]=t,this._$lines[this._$lines.length-1]=e),i||this._$margePath(nt(re.MOVE_TO,t,e)),this._$restart(),this}_$clip(t,e){const i=this._$getBounds(),s=gt(i,e);Q(i);const r=v.ceil(v.abs(s.xMax-s.xMin)),n=v.ceil(v.abs(s.yMax-s.yMin));switch(Q(s),!0){case 0===r:case 0===n:case r===-1/0:case n===-1/0:case r===b:case n===b:return}t.reset(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),this._$doDraw(t,null,!0),t.clip()}_$draw(t,e,i,s="normal",r=null){if(!this._$maxAlpha)return;const n=$t(i[3]+i[7]/255,0,1),a=this._$displayObject;let h=null!==a._$scale9Grid;const o=a._$transform._$rawMatrix();h&&(h=h&&v.abs(o[1])<.001&&v.abs(o[2])<1e-4);const l=this._$getBounds(),c=gt(l,e),_=c.xMax,$=c.xMin,u=c.yMax,d=c.yMin;Q(c);const g=v.ceil(v.abs(_-$)),f=v.ceil(v.abs(u-d));switch(!0){case 0===g:case 0===f:case g===-1/0:case f===-1/0:case g===b:case f===b:return}let p=+v.sqrt(e[0]*e[0]+e[1]*e[1]);if(!E.isInteger(p)){const t=p.toString(),e=t.indexOf("e");-1!==e&&(p=+t.slice(0,e)),p=+p.toFixed(4)}let m=+v.sqrt(e[2]*e[2]+e[3]*e[3]);if(!E.isInteger(m)){const t=m.toString(),e=t.indexOf("e");-1!==e&&(m=+t.slice(0,e)),m=+m.toFixed(4)}const x=null!==r&&r.length>0&&a._$canApply(r);let T=K(0,g,0,f);if(x&&r)for(let t=0;t<r.length;++t)T=r[t]._$generateFilterRect(T,p,m);const y=t.frameBuffer,A=y.currentAttachment;if(!A||$-T.xMin>A.width||d-T.yMin>A.height)return void Q(T);if(0>$+T.xMax||0>d+T.yMax)return void Q(T);Q(T),""===this._$uniqueKey&&(!h&&a._$loaderInfo&&a._$characterId?this._$uniqueKey=`${a._$loaderInfo._$id}@${this._$bitmapId||a._$characterId}`:this._$uniqueKey=this._$createCacheKey());const M=ar();if("bitmap"===this._$mode)this._$cacheKeys.length||(this._$cacheKeys=At.generateKeys(this._$uniqueKey));else if(!this._$cacheKeys.length||this._$cacheParams[0]!==p||this._$cacheParams[1]!==m||this._$cacheParams[2]!==i[7]){const t=nt();t[0]=p,t[1]=m,this._$cacheKeys=At.generateKeys(this._$uniqueKey,t,i),at(t),this._$cacheParams[0]=p,this._$cacheParams[1]=m,this._$cacheParams[2]=i[7]}if(t.cachePosition=At.get(this._$cacheKeys),!t.cachePosition){const s=y.currentAttachment;s&&s.mask&&t.stopStencil();let r=0,n=0;if("shape"===this._$mode){r=v.ceil(v.abs(l.xMax-l.xMin)*p),n=v.ceil(v.abs(l.yMax-l.yMin)*m);const e=t._$getTextureScale(r,n);e<1&&(r*=e,n*=e)}else r=v.ceil(v.abs(l.xMax-l.xMin)),n=v.ceil(v.abs(l.yMax-l.yMin));if(t.cachePosition=y.createCachePosition(r,n),t.bindRenderBuffer(t.cachePosition),t.reset(),"shape"===this._$mode?t.setTransform(p,0,0,m,-l.xMin*p,-l.yMin*m):t.setTransform(1,0,0,1,-l.xMin,-l.yMin),h){const i=M.scaleX,s=tt(i,0,0,i,0,0),r=ut(s,o);et(s);const n=a._$parent._$transform.concatenatedMatrix._$matrix,h=tt(n[0],n[1],n[2],n[3],n[4]*i-$,n[5]*i-d);et(n);const c=ut(h,r),_=c[4]-(e[4]-$),u=c[5]-(e[5]-d);et(c);const g=gt(l,r),f=+g.xMax,p=+g.xMin,m=+g.yMax,x=+g.yMin,b=v.ceil(v.abs(f-p)),T=v.ceil(v.abs(m-x));Q(g);const y=a._$scale9Grid,E={x:y.x,y:y.y,w:y.width,h:y.height};t.grid.enable(p,x,b,T,l,E,i,r[0],r[1],r[2],r[3],r[4],r[5],h[0],h[1],h[2],h[3],h[4]-_,h[5]-u),et(r),et(h)}this._$doDraw(t,i,!1),h&&t.grid.disable(),y.transferTexture(t.cachePosition),At.set(this._$cacheKeys,t.cachePosition),t._$bind(s)}let S=0,w=0;if(x){const i=this._$createBitmapTexture(t,t.cachePosition,p,m,g,f),s=a._$drawFilter(t,e,r,g,f,i);s.offsetX&&(S=s.offsetX),s.offsetY&&(w=s.offsetY),t.cachePosition=s}if(x||"bitmap"!==this._$mode){const i=v.atan2(e[1],e[0]),s=v.atan2(-e[2],e[3]);if(x||!i&&!s)t.setTransform(1,0,0,1,$-S,d-w);else{const r=l.xMin*p,n=l.yMin*m,a=v.cos(i),h=v.sin(i),o=v.cos(s),c=v.sin(s);t.setTransform(a,h,-c,o,r*a-n*c+e[4],r*h+n*o+e[5])}}else t.setTransform(e[0],e[1],e[2],e[3],l.xMin*e[0]+l.yMin*e[2]+e[4],l.xMin*e[1]+l.yMin*e[3]+e[5]);t.cachePosition&&(t.globalAlpha=n,t.imageSmoothingEnabled="shape"===this._$mode,t.globalCompositeOperation=s,t.drawInstance($-S,d-w,_,u,i),t.cachePosition=null),Q(l)}_$createBitmapTexture(t,e,i,s,r,n){if("bitmap"!==this._$mode)return null;t.drawInstacedArray();const a=t.frameBuffer,h=a.currentAttachment,o=a.createCacheAttachment(r,n);t._$bind(o),t.reset();const l=tt(i,0,0,s,r/2,n/2),c=t.getTextureFromRect(e),_=tt(1,0,0,1,-c.width/2,-c.height/2),$=ut(l,_);et(l),et(_),t.setTransform($[0],$[1],$[2],$[3],$[4],$[5]),t.drawImage(c,0,0,c.width,c.height);const u=a.getTextureFromCurrentAttachment();return t._$bind(h),a.releaseAttachment(o),a.textureManager.release(c),u}_$doDraw(t,e=null,i=!1){t.reset(),t.beginPath(),this._$runCommand(t,e,i)}_$hit(t,e,i,s=!1){return t.beginPath(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),this._$runCommand(t,null,s,i)}_$getBounds(){const t=this._$displayObject;return t&&t._$bounds?K(t._$bounds.xMin,t._$bounds.xMax,t._$bounds.yMin,t._$bounds.yMax):K(this._$xMin,this._$xMax,this._$yMin,this._$yMax)}_$restart(){this._$displayObject&&(this._$displayObject._$posted=!1,this._$displayObject._$isUpdated()||(this._$displayObject._$doChanged(),x(),At.removeCache(this._$displayObject._$instanceId),this._$displayObject._$characterId&&At.removeCache(this._$displayObject._$characterId)))}_$setBounds(t=0,e=0){this._$setFillBounds(t,e),this._$doLine&&this._$setLineBounds(t,e)}_$setFillBounds(t=0,e=0){this._$xMin=v.min(this._$xMin,t),this._$xMax=v.max(this._$xMax,t),this._$yMin=v.min(this._$yMin,e),this._$yMax=v.max(this._$yMax,e)}_$setLineBounds(t=0,e=0){this._$xMin=v.min(this._$xMin,v.min(t,this._$pointerX)),this._$xMax=v.max(this._$xMax,v.max(t,this._$pointerX)),this._$yMin=v.min(this._$yMin,v.min(e,this._$pointerY)),this._$yMax=v.max(this._$yMax,v.max(e,this._$pointerY));const i=this._$lineWidth/2,s=.5*v.PI,r=v.atan2(e-this._$pointerY,t-this._$pointerX),n=v.atan2(this._$pointerY-e,this._$pointerX-t),a=r+s,h=r-s,o=n+s,l=n-s;let c=t+i,_=-i+t,$=this._$pointerX+i,u=-i+this._$pointerX,d=e+i,g=-i+e,f=this._$pointerY+i,p=-i+this._$pointerY;switch(this._$xMin=v.min(this._$xMin,v.min(c,v.min(_,v.min($,u)))),this._$xMax=v.max(this._$xMax,v.max(c,v.max(_,v.max($,u)))),this._$yMin=v.min(this._$yMin,v.min(d,v.min(g,v.min(f,p)))),this._$yMax=v.max(this._$yMax,v.max(d,v.max(g,v.max(f,p)))),v.abs(a)%s!=0&&(c=t+v.cos(a)*i),v.abs(h)%s!=0&&(_=t+v.cos(h)*i),v.abs(o)%s!=0&&($=this._$pointerX+v.cos(o)*i),v.abs(l)%s!=0&&(u=this._$pointerX+v.cos(l)*i),a&&v.abs(a)%v.PI!=0&&(d=e+v.sin(a)*i),h&&v.abs(h)%v.PI!=0&&(g=e+v.sin(h)*i),o&&v.abs(o)%v.PI!=0&&(f=this._$pointerY+v.sin(o)*i),l&&v.abs(l)%v.PI!=0&&(p=this._$pointerY+v.sin(l)*i),this._$xMin=v.min(this._$xMin,v.min(c,v.min(_,v.min($,u)))),this._$xMax=v.max(this._$xMax,v.max(c,v.max(_,v.max($,u)))),this._$yMin=v.min(this._$yMin,v.min(d,v.min(g,v.min(f,p)))),this._$yMax=v.max(this._$yMax,v.max(d,v.max(g,v.max(f,p)))),this._$caps){case"round":if(v.abs(r)%s!=0){const e=t+v.cos(r)*i;this._$xMin=v.min(this._$xMin,e),this._$xMax=v.max(this._$xMax,e)}if(r&&v.abs(r)%v.PI!=0){const t=e+v.sin(r)*i;this._$yMin=v.min(this._$yMin,t),this._$yMax=v.max(this._$yMax,t)}if(v.abs(n)%s!=0){const t=this._$pointerX+v.cos(n)*i;this._$xMin=v.min(this._$xMin,t),this._$xMax=v.max(this._$xMax,t)}if(n&&v.abs(n)%v.PI!=0){const t=this._$pointerY+v.sin(n)*i;this._$yMin=v.min(this._$yMin,t),this._$yMax=v.max(this._$yMax,t)}break;case"square":if(v.abs(r)%s!=0){const t=v.cos(r)*i,e=c+t,s=_+t;this._$xMin=v.min(this._$xMin,v.min(e,s)),this._$xMax=v.max(this._$xMax,v.max(e,s))}if(v.abs(n)%s!=0){const t=v.cos(n)*i,e=$+t,s=u+t;this._$xMin=v.min(this._$xMin,v.min(e,s)),this._$xMax=v.max(this._$xMax,v.max(e,s))}if(r&&v.abs(r)%v.PI!=0){const t=v.sin(r)*i,e=d+t,s=g+t;this._$yMin=v.min(this._$yMin,v.min(e,s)),this._$yMax=v.max(this._$yMax,v.max(e,s))}if(n&&v.abs(n)%v.PI!=0){const t=v.sin(n)*i,e=f+t,s=p+t;this._$yMin=v.min(this._$yMin,v.min(e,s)),this._$yMax=v.max(this._$yMax,v.max(e,s))}}}_$margePath(t){this._$doFill&&this._$fills&&this._$fills.push(...t),this._$doLine&&this._$lines&&this._$lines.push(...t),at(t)}_$createCacheKey(){if(this._$doLine&&this.endLine(),this._$doFill&&this.endFill(),!this._$recode)return"";const t=this._$getRecodes();let e=0;for(let i=0;i<t.length;i++)e=(e<<5)-e+t[i],e|=0;return`${e}`}_$getRecodes(){if(this._$doLine&&this.endLine(),this._$doFill&&this.endFill(),this._$recode||(this._$recode=nt()),!this._$buffer){const t=nt(),e=this._$recode;for(let i=0;i<e.length;){const s=e[i++];switch(t.push(s),s){case re.BEGIN_PATH:case re.END_FILL:case re.END_STROKE:case re.CLOSE_PATH:break;case re.MOVE_TO:case re.LINE_TO:t.push(e[i++],e[i++]);break;case re.CURVE_TO:case re.FILL_STYLE:t.push(e[i++],e[i++],e[i++],e[i++]);break;case re.CUBIC:t.push(e[i++],e[i++],e[i++],e[i++],e[i++],e[i++]);break;case re.STROKE_STYLE:switch(t.push(e[i++]),e[i++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2)}switch(e[i++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2)}t.push(e[i++],e[i++],e[i++],e[i++],e[i++]);break;case re.ARC:t.push(e[i++],e[i++],e[i++]);break;case re.GRADIENT_FILL:{const s=e[i++],r=e[i++],n=e[i++],a=e[i++],h=e[i++],o=e[i++];t.push("linear"===s?0:1),t.push(r.length);for(let e=0;e<r.length;++e){const i=r[e];t.push(i.ratio,i.R,i.G,i.B,i.A)}switch(t.push(n[0],n[1],n[2],n[3],n[4],n[5]),a){case"reflect":t.push(0);break;case"repeat":t.push(1);break;default:t.push(2)}t.push("linearRGB"===h?0:1),t.push(o)}break;case re.GRADIENT_STROKE:{switch(t.push(e[i++]),e[i++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2)}switch(e[i++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2)}t.push(e[i++]);const s=e[i++],r=e[i++],n=e[i++],a=e[i++],h=e[i++],o=e[i++];t.push("linear"===s?0:1),t.push(r.length);for(let e=0;e<r.length;++e){const i=r[e];t.push(i.ratio,i.R,i.G,i.B,i.A)}switch(t.push(n[0],n[1],n[2],n[3],n[4],n[5]),a){case"reflect":t.push(0);break;case"repeat":t.push(1);break;default:t.push(2)}t.push("linearRGB"===h?0:1),t.push(o)}break;case re.BITMAP_FILL:{const s=e[i++];let r;if(null!==s.image||null!==s.canvas){const t=At.getCanvas(),e=s.width,i=s.height;t.width=e,t.height=i;const n=t.getContext("2d");if(!n)throw new Error("the context is null.");n.drawImage(s.image||s.canvas,0,0),r=new Uint8Array(n.getImageData(0,0,e,i).data),At.destroy(n)}else{if(null===s._$buffer)break;r=s._$buffer}t.push(s.width,s.height,this._$xMax-this._$xMin,this._$yMax-this._$yMin,r.length);for(let e=0;e<r.length;++e)t.push(r[e]);const n=e[i++];n?t.push(n[0],n[1],n[2],n[3],n[4],n[5]):t.push(1,0,0,1,0,0);const a=e[i++];t.push(a?1:0);const h=e[i++];t.push(h?1:0)}break;case re.BITMAP_STROKE:{switch(t.push(e[i++]),e[i++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2)}switch(e[i++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2)}t.push(e[i++]);const s=e[i++];let r;if(null!==s.image||null!==s.canvas){const t=At.getCanvas(),e=s.width,i=s.height;t.width=e,t.height=i;const n=t.getContext("2d");if(!n)throw new Error("the context is null.");n.drawImage(s.image||s.canvas,0,0),r=new Uint8Array(n.getImageData(0,0,e,i).data),At.destroy(n)}else{if(null===s._$buffer)break;r=s._$buffer}t.push(s.width,s.height,this._$xMax-this._$xMin,this._$yMax-this._$yMin,r.length);for(let e=0;e<r.length;++e)t.push(r[e]);const n=e[i++];n?t.push(n[0],n[1],n[2],n[3],n[4],n[5]):t.push(1,0,0,1,0,0);const a=e[i++];t.push(a?1:0);const h=e[i++];t.push(h?1:0)}}}this._$buffer=new A(t)}return this._$buffer.slice()}_$runCommand(t,e=null,i=!1,s=null){if(this._$doLine&&this.endLine(),this._$doFill&&this.endFill(),!this._$recode)return!1;const r=this._$recode,n=r.length;for(let a=0;a<n;)switch(r[a++]){case re.BEGIN_PATH:t.beginPath();break;case re.MOVE_TO:t.moveTo(r[a++],r[a++]);break;case re.LINE_TO:t.lineTo(r[a++],r[a++]);break;case re.CURVE_TO:t.quadraticCurveTo(r[a++],r[a++],r[a++],r[a++]);break;case re.FILL_STYLE:{if(i||s){a+=4;continue}const n=J();n[0]=r[a++]/255,n[1]=r[a++]/255,n[2]=r[a++]/255,n[3]=r[a++]/255,null!==e&&0!==e[7]&&(n[3]=v.max(0,v.min(n[3]*e[7],255))/255),t.fillStyle=n}break;case re.END_FILL:if(s&&"isPointInPath"in t&&t.isPointInPath(s.x,s.y))return!0;i||s||t.fill();break;case re.STROKE_STYLE:{if(i||s){a+=8;continue}t.lineWidth=r[a++],t.lineCap=r[a++],t.lineJoin=r[a++],t.miterLimit=r[a++];const n=J();n[0]=r[a++]/255,n[1]=r[a++]/255,n[2]=r[a++]/255,n[3]=r[a++]/255,null!==e&&0!==e[7]&&(n[3]=v.max(0,v.min(n[3]+e[7],255))/255),t.strokeStyle=n}break;case re.END_STROKE:if(s&&"isPointInStroke"in t&&t.isPointInStroke(s.x,s.y))return!0;i||s||t.stroke();break;case re.CLOSE_PATH:t.closePath();break;case re.CUBIC:t.bezierCurveTo(r[a++],r[a++],r[a++],r[a++],r[a++],r[a++]);break;case re.ARC:t.arc(r[a++],r[a++],r[a++],0,2*v.PI);break;case re.GRADIENT_FILL:{if(s&&"isPointInPath"in t&&t.isPointInPath(s.x,s.y))return!0;if(i||s||t instanceof CanvasRenderingContext2D){a+=6;continue}const n=r[a++],h=r[a++],o=r[a++],l=r[a++],c=r[a++],_=r[a++];let $;if("linear"===n){const e=ct(o);$=t.createLinearGradient(e[0],e[1],e[2],e[3],c,l)}else t.save(),t.transform(o[0],o[1],o[2],o[3],o[4],o[5]),$=t.createRadialGradient(0,0,0,0,0,819.2,c,l,_);for(let t=0;t<h.length;++t){const i=h[t];let s=i.A;e&&0!==e[7]&&(s=0|v.max(0,v.min(i.A+e[7],255))),$.addColorStop(i.ratio,J(i.R,i.G,i.B,s))}t.fillStyle=$,t.fill(),"radial"===n&&t.restore()}break;case re.GRADIENT_STROKE:{if(s&&"isPointInStroke"in t&&t.isPointInStroke(s.x,s.y))return!0;if(i||s||t instanceof CanvasRenderingContext2D){a+=12;continue}t.lineWidth=r[a++],t.lineCap=r[a++],t.lineJoin=r[a++],t.miterLimit=r[a++];const n=r[a++],h=r[a++],o=r[a++],l=r[a++],c=r[a++],_=r[a++];let $;if("linear"===n){const e=ct(o);$=t.createLinearGradient(e[0],e[1],e[2],e[3],c,l)}else t.save(),t.transform(o[0],o[1],o[2],o[3],o[4],o[5]),$=t.createRadialGradient(0,0,0,0,0,819.2,c,l,_);for(let t=0;t<h.length;++t){const i=h[t];let s=i.A;e&&0!==e[7]&&(s=0|v.max(0,v.min(i.A+e[7],255))),$.addColorStop(i.ratio,J(i.R,i.G,i.B,s))}t.strokeStyle=$,t.stroke(),"radial"===n&&t.restore()}break;case re.BITMAP_FILL:{if(s&&"isPointInPath"in t&&t.isPointInPath(s.x,s.y))return!0;if(i||s||t instanceof CanvasRenderingContext2D){a+=6;continue}t.save();const n=r[a++],h=r[a++],o=r[a++],l=r[a++];h&&t.transform(h[0],h[1],h[2],h[3],h[4],h[5]);const c=n.getTexture();if(!c||!e)break;t.imageSmoothingEnabled=l,this._$bitmapId||n.width===this._$xMax-this._$xMin&&n.height===this._$yMax-this._$yMin?t.drawBitmap(c):(t.fillStyle=t.createPattern(c,o,e),t.fill()),t.restore(),t.imageSmoothingEnabled=!1}break;case re.BITMAP_STROKE:{if(s&&"isPointInStroke"in t&&t.isPointInStroke(s.x,s.y))return!0;if(i||s||t instanceof CanvasRenderingContext2D){a+=9;continue}t.save(),t.lineWidth=r[a++],t.lineCap=r[a++],t.lineJoin=r[a++],t.miterLimit=r[a++];const n=r[a++],h=r[a++],o=r[a++],l=r[a++];h&&t.transform(h[0],h[1],h[2],h[3],h[4],h[5]);const c=n.getTexture();if(!c||!e)break;t.strokeStyle=t.createPattern(c,o,e),t.imageSmoothingEnabled=l,t.stroke(),t.restore(),t.imageSmoothingEnabled=!1}}return!1}}class ne extends Ct{constructor(){super(),this._$id=i++,this._$bytesLoaded=0,this._$bytesTotal=0,this._$url="",this._$content=null,this._$data=null,this._$format="json"}static toString(){return"[class LoaderInfo]"}static get namespace(){return"next2d.display.LoaderInfo"}toString(){return"[object LoaderInfo]"}get namespace(){return"next2d.display.LoaderInfo"}get bytesLoaded(){return this._$bytesLoaded}set bytesLoaded(t){this._$bytesLoaded=0|t}get bytesTotal(){return this._$bytesTotal}set bytesTotal(t){this._$bytesTotal=0|t}get content(){return this._$content}set content(t){this._$content=t}get url(){return this._$url}set url(t){this._$url=t}get format(){return this._$format}set format(t){this._$format=t}}class ae{static toString(){return"[class SoundMixer]"}static get namespace(){return"next2d.media.SoundMixer"}toString(){return"[object SoundMixer]"}get namespace(){return"next2d.media.SoundMixer"}static get volume(){return _()}static set volume(t){(t=>{c=t})($t(t,0,1,1));const e=_(),i=ar(),s=i._$sources;for(let t=0;t<s.length;++t){const i=s[t];for(let t=0;t<i._$sources.length;++t){const s=i._$sources[t];s._$gainNode&&(s._$gainNode.gain.value=v.min(e,s._$volume))}}const r=i._$videos;for(let t=0;t<r.length;++t){const i=r[t];i._$video&&(i._$video.volume=v.min(e,i.volume))}}static stopAll(){const t=ar(),e=t._$sources;for(let t=0;t<e.length;++t)e[t].stop();const i=t._$videos;for(let t=0;t<i.length;++t)i[t].pause();t._$sources.length=0,t._$videos.length=0}}class he extends Ct{constructor(){super(),this._$bytesLoaded=0,this._$bytesTotal=0,this._$arrayBuffer=null,this._$audioBuffer=null,this._$character=null,this._$sources=nt(),this._$volume=1,this._$currentCount=0,this._$loopCount=0,this._$stopFlag=!0,this._$src=""}static toString(){return"[class Sound]"}static get namespace(){return"next2d.media.Sound"}toString(){return"[object Sound]"}get namespace(){return"next2d.media.Sound"}get bytesLoaded(){return this._$bytesLoaded}get bytesTotal(){return this._$bytesTotal}get loopCount(){return this._$loopCount}set loopCount(t){this._$loopCount=t}get src(){return this._$src}set src(t){this.load(new Mt(t))}get volume(){return this._$volume}set volume(t){this._$volume=v.min(ae.volume,$t(t,0,1,1));const e=this._$sources.length;if(e&&Ps)for(let t=0;t<e;++t){const e=this._$sources[t];e._$gainNode&&(e._$gainNode.gain.value=this._$volume,e._$volume=this._$volume)}}clone(){const t=new he;return t.volume=this.volume,t._$loopCount=this._$loopCount,this._$character?t._$character=this._$character:t._$audioBuffer=this._$audioBuffer,t}load(t){this._$src=t.url,pr({format:"arraybuffer",url:t.url,method:t.method,data:t.data,headers:t.headers,withCredentials:t.withCredentials,event:{loadstart:t=>{this._$loadStart(t)},progress:t=>{this._$progress(t)},loadend:t=>{this._$loadEnd(t)}}})}_$loadStart(t){this._$bytesLoaded=t.loaded,this._$bytesTotal=t.total,this.willTrigger(wt.OPEN)&&this.dispatchEvent(new wt(wt.OPEN)),this.willTrigger(Lt.PROGRESS)&&this.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total))}_$progress(t){this._$bytesLoaded=t.loaded,this._$bytesTotal=t.total,this.willTrigger(Lt.PROGRESS)&&this.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total))}_$loadEnd(t){this._$bytesLoaded=t.loaded,this._$bytesTotal=t.total,this.willTrigger(Lt.PROGRESS)&&this.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total));const e=t.target;if(!e)throw new Error("the Sound target is null.");199<e.status&&400>e.status?(this._$arrayBuffer=e.response,Ps?ur(this).then((t=>{(t.hasEventListener(wt.INIT)||t.hasEventListener(wt.COMPLETE))&&ar()._$loaders.push(t)})):Gs.push(this)):this.willTrigger(Bt.IO_ERROR)&&this.dispatchEvent(new Bt(Bt.IO_ERROR,!1,!1,e.statusText))}play(t=0){const e=this._$character?this._$character.audioBuffer:this._$audioBuffer;if(Ps&&e)this._$createBufferSource(t);else{const e=B.now(),i=()=>{if(null===(this._$character?this._$character.audioBuffer:this._$audioBuffer)||null===Ps)F(i);else{const i=(B.now()-e)/1e3;this._$createBufferSource(t,i)}};F(i)}}stop(){this._$stopFlag=!0;const t=this._$sources.length;if(t){const e=ar();if(Ps)for(let e=0;e<t;++e){const t=this._$sources[e];t._$gainNode&&(t._$gainNode.gain.value=0,t._$gainNode.disconnect(),t._$gainNode=null),t.onended=null,t.disconnect()}e._$sources.splice(e._$sources.indexOf(this),1),this._$currentCount=0,this._$sources.length=0}}_$build(t,e){const i=e.loaderInfo;if(!i||!i._$data)throw new Error("the loaderInfo or data is null.");if(this._$character=i._$data.characters[t.characterId],!this._$character)throw new Error("character is null.");this._$character.audioBuffer||(Ps?ur(this).then((t=>{(t.hasEventListener(wt.INIT)||t.hasEventListener(wt.COMPLETE))&&ar()._$loaders.push(t)})):Gs.push(this)),this._$loopCount=0|t.loopCount,this._$volume=v.min(ae.volume,t.volume)}_$createBufferSource(t=0,e=0){if(!Ps)throw new Error("the Audio Context is null.");const i=Ps.createBufferSource();i.onended=t=>this._$endEventHandler(t),i.buffer=this._$character?this._$character.audioBuffer:this._$audioBuffer,i._$gainNode=Ps.createGain(),i._$gainNode.connect(Ps.destination);const s=v.min(ae.volume,this._$volume);i._$gainNode.gain.value=s,i._$volume=s,i.connect(i._$gainNode),i.start(0|t,e);const r=ar();-1===r._$sources.indexOf(this)&&r._$sources.push(this),this._$sources.push(i),this._$stopFlag=!1}_$endEventHandler(t){const e=t.target;if(this._$sources.splice(this._$sources.indexOf(e),1),!this._$stopFlag&&this._$loopCount>this._$currentCount)this._$createBufferSource(),this._$currentCount++;else{if(this._$currentCount=0,Ps&&(e._$gainNode&&(e._$gainNode.gain.value=0,e._$gainNode.disconnect(),e._$gainNode=null),e.onended=null,e.disconnect()),!this._$sources.length){const t=ar();t._$sources.splice(t._$sources.indexOf(this),1)}this.willTrigger(wt.SOUND_COMPLETE)&&this.dispatchEvent(new wt(wt.SOUND_COMPLETE))}}}class oe{constructor(t=1,e=!1){this._$volume=1,this._$loop=!1,this.volume=t,this.loop=e}static toString(){return"[class SoundTransform]"}static get namespace(){return"next2d.media.SoundTransform"}toString(){return"[object SoundTransform]"}get namespace(){return"next2d.media.SoundTransform"}get loop(){return this._$loop}set loop(t){this._$loop=t}get volume(){return this._$volume}set volume(t){this._$volume=$t(+t,0,1,0)}}class le extends Qt{constructor(t=0,e=0){super(),this._$smoothing=!0,this._$loop=!1,this._$autoPlay=!0,this._$bounds=K(0,t,0,e),this._$bytesLoaded=0,this._$bytesTotal=0,this._$timerId=-1,this._$video=null,this._$stop=!0,this._$ready=!1,this._$volume=1,this._$context=null,this._$cacheKeys=nt(),this._$cacheParams=nt(0,0,0)}static toString(){return"[class Video]"}static get namespace(){return"next2d.media.Video"}toString(){return"[object Video]"}get namespace(){return"next2d.media.Video"}get bytesLoaded(){return this._$bytesLoaded}get bytesTotal(){return this._$bytesTotal}get currentTime(){return this._$video?this._$video.currentTime:0}get duration(){return this._$video?this._$video.duration:0}get loop(){return this._$loop}set loop(t){this._$loop=!!t}get autoPlay(){return this._$autoPlay}set autoPlay(t){this._$autoPlay=!!t}get smoothing(){return this._$smoothing}set smoothing(t){this._$smoothing=!!t}get src(){return this._$video?this._$video.src:""}set src(t){this._$video||(this._$video=this._$initializeVideo()),this._$video.src=t,this._$video.load()}get videoHeight(){return this._$video?this._$video.videoHeight:this._$bounds.yMax}get videoWidth(){return this._$video?this._$video.videoWidth:this._$bounds.xMax}get volume(){return this._$volume}set volume(t){this._$volume=$t(v.min(ae.volume,t),0,1,1),this._$video&&(this._$video.volume=this._$volume)}clear(){this._$video&&this._$video.pause(),this._$video=null,this._$bounds.xMax=0,this._$bounds.yMax=0,this._$doChanged()}pause(){if(this._$video&&!this._$stop){this._$stop=!0,this._$video.pause(),R(this._$timerId),this._$timerId=-1,this.hasEventListener(Pt.PAUSE)&&this.dispatchEvent(new Pt(Pt.PAUSE,!1,!1,this._$bytesLoaded,this._$bytesTotal));const t=ar();t._$videos.splice(t._$videos.indexOf(this),1)}}play(){this._$video&&this._$stop&&(this._$stop=!1,this._$video.volume=v.min(this._$volume,ae.volume),this._$video.play().then((()=>{this._$timerId=F((()=>{this._$update()})),this.hasEventListener(Pt.PLAY)&&this.dispatchEvent(new Pt(Pt.PLAY,!1,!1,this._$bytesLoaded,this._$bytesTotal));const t=ar();-1===t._$videos.indexOf(this)&&t._$videos.push(this),this._$ready=!0})))}seek(t){this._$video&&(this._$video.currentTime=t,this.hasEventListener(Pt.SEEK)&&this.dispatchEvent(new Pt(Pt.SEEK,!1,!1,this._$bytesLoaded,this._$bytesTotal)))}_$update(){const t=ar();if(!this.stage||!this._$video)return this._$video&&this._$video.pause(),R(this._$timerId),this._$timerId=-1,void t._$videos.splice(t._$videos.indexOf(this),1);Tr&&this._$postProperty(),this._$bytesLoaded=this._$video.currentTime,this._$video.currentTime&&(this.hasEventListener(Pt.PROGRESS)&&this.dispatchEvent(new Pt(Pt.PROGRESS,!1,!1,this._$bytesLoaded,this._$bytesTotal)),this._$doChanged()),this._$timerId=F((()=>{this._$update()}))}_$start(){if(!this._$video)return;this._$bounds.xMax=this._$video.videoWidth,this._$bounds.yMax=this._$video.videoHeight,this._$bytesTotal=this._$video.duration;const t=ar();this._$autoPlay&&(this._$stop=!1,this._$video.play().then((()=>{-1===t._$videos.indexOf(this)&&t._$videos.push(this),this.hasEventListener(Pt.PLAY_START)&&this.dispatchEvent(new Pt(Pt.PLAY_START,!1,!1,this._$bytesLoaded,this._$bytesTotal)),this._$timerId=F((()=>{this._$update()})),this._$ready=!0,this._$doChanged()}))),this._$createContext()}_$initializeVideo(){this._$cacheKeys.length=0;const t=u.createElement("video");return t.autoplay=!1,t.crossOrigin="anonymous",Ps||(t.muted=!0),Qs&&t.setAttribute("playsinline",""),t.addEventListener("canplaythrough",(()=>{this._$start()})),t.addEventListener("ended",(()=>{this._$loop?t.currentTime=0:(this.hasEventListener(Pt.PLAY_END)&&this.dispatchEvent(new Pt(Pt.PLAY_END,!1,!1,this._$bytesLoaded,this._$bytesTotal)),R(this._$timerId),this._$timerId=-1)})),t}_$createContext(){if(Tr){const t=new w(this._$bounds.xMax,this._$bounds.yMax);this._$context=t.getContext("2d")}}_$buildCharacter(t){t.buffer&&!t._$buffer&&(t._$buffer=new Uint8Array(t.buffer),t.buffer=null),this._$loop=t.loop,this._$autoPlay=t.autoPlay,this._$bounds.xMin=t.bounds.xMin,this._$bounds.yMin=t.bounds.yMin,this._$bounds.xMax=t.bounds.xMax,this._$bounds.yMax=t.bounds.yMax,this._$video||(this._$video=this._$initializeVideo()),this._$video.src=URL.createObjectURL(new Blob([t._$buffer],{type:"video/mp4"})),this._$video.volume=v.min(t.volume,ae.volume),this._$video.load(),Tr&&this._$stage&&this._$createWorkerInstance()}_$sync(t){this._$buildCharacter(t)}_$build(t,e){const i=this._$baseBuild(t,e);return this._$buildCharacter(i),i}_$clip(t,e){const i=this._$bounds.xMax,s=this._$bounds.yMax;if(!i||!s)return;let r=e;const n=this._$transform._$rawMatrix();1===n[0]&&0===n[1]&&0===n[2]&&1===n[3]&&0===n[4]&&0===n[5]||(r=ut(e,n)),t.reset(),t.setTransform(r[0],r[1],r[2],r[3],r[4],r[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,s),t.lineTo(0,s),t.lineTo(0,0),t.clip(),r!==e&&et(r)}_$draw(t,e,i){if(!this._$visible||!this._$video||!this._$ready)return;let s=i;const r=this._$transform._$rawColorTransform();1===r[0]&&1===r[1]&&1===r[2]&&1===r[3]&&0===r[4]&&0===r[5]&&0===r[6]&&0===r[7]||(s=dt(i,r));const n=$t(s[3]+s[7]/255,0,1,0);if(!n)return void(s!==i&&st(s));let a=e;const h=this._$transform._$rawMatrix();1===h[0]&&0===h[1]&&0===h[2]&&1===h[3]&&0===h[4]&&0===h[5]||(a=ut(e,h));const o=gt(this._$bounds,a),l=+o.xMax,c=+o.xMin,_=+o.yMax,$=+o.yMin;Q(o);const u=v.ceil(v.abs(l-c)),d=v.ceil(v.abs(_-$));switch(!0){case 0===u:case 0===d:case u===-1/0:case d===-1/0:case u===b:case d===b:return}let g=+v.sqrt(a[0]*a[0]+a[1]*a[1]);if(!E.isInteger(g)){const t=g.toString(),e=t.indexOf("e");-1!==e&&(g=+t.slice(0,e)),g=+g.toFixed(4)}let f=+v.sqrt(a[2]*a[2]+a[3]*a[3]);if(!E.isInteger(f)){const t=f.toString(),e=t.indexOf("e");-1!==e&&(f=+t.slice(0,e)),f=+f.toFixed(4)}const p=this._$filters||this.filters,m=p&&p.length>0&&this._$canApply(p);let x=K(0,u,0,d);if(m)for(let t=0;t<p.length;++t)x=p[t]._$generateFilterRect(x,g,f);const T=t.frameBuffer,y=T.currentAttachment;if(!y||c-x.xMin>y.width||$-x.yMin>y.height)return void Q(x);if(0>c+x.xMax||0>$+x.yMax)return void Q(x);if(Q(x),!this._$cacheKeys.length||this._$cacheParams[0]!==g||this._$cacheParams[1]!==f||this._$cacheParams[2]!==i[7]){const t=nt();t[0]=g,t[1]=f,this._$cacheKeys=At.generateKeys(this._$instanceId,t,i),at(t),this._$cacheParams[0]=g,this._$cacheParams[1]=f,this._$cacheParams[2]=i[7]}const A=this._$blendMode||this.blendMode;if(t.cachePosition=At.get(this._$cacheKeys),!t.cachePosition){const e=v.ceil(v.abs(this._$bounds.xMax-this._$bounds.xMin)),i=v.ceil(v.abs(this._$bounds.yMax-this._$bounds.yMin)),s=T.createCachePosition(e,i);t.cachePosition=s,At.set(this._$cacheKeys,s)}const M=T.createTextureFromVideo(this._$video,this._$smoothing);let S=0,w=0;if(m){const e=T.currentAttachment,i=T.createCacheAttachment(u,d);t._$bind(i),t.reset();const s=tt(g,0,0,f,u/2,d/2),r=tt(1,0,0,1,-M.width/2,-M.height/2),n=ut(s,r);et(s),et(r),t.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),t.drawImage(M,0,0,M.width,M.height);const h=T.getTextureFromCurrentAttachment();t._$bind(e),T.releaseAttachment(i),t.drawTextureFromRect(M,t.cachePosition);const o=this._$drawFilter(t,a,p,u,d,h);o.offsetX&&(S=o.offsetX),o.offsetY&&(w=o.offsetY),t.cachePosition=o,t.setTransform(1,0,0,1,c-S,$-w)}else t.drawTextureFromRect(M,t.cachePosition),t.setTransform(a[0],a[1],a[2],a[3],a[4],a[5]);t.cachePosition&&(t.globalAlpha=n,t.imageSmoothingEnabled=!0,t.globalCompositeOperation=A,t.drawInstance(c-S,$-w,l,_,i),t.cachePosition=null),a!==e&&et(a),s!==i&&st(s)}_$mouseHit(t,e,i){return!!this._$visible&&this._$hit(t,e,i)}_$hit(t,e,i){let s=e;const r=this._$transform._$rawMatrix();r!==P&&(s=ut(e,r));const n=this._$getBounds(null),a=gt(n,s),h=+a.xMax,o=+a.xMin,l=+a.yMax,c=+a.yMin;Q(a),Q(n);const _=v.ceil(v.abs(h-o)),$=v.ceil(v.abs(l-c));return t.setTransform(1,0,0,1,o,c),t.beginPath(),t.moveTo(0,0),t.lineTo(_,0),t.lineTo(_,$),t.lineTo(0,$),t.lineTo(0,0),s!==e&&et(s),t.isPointInPath(i.x,i.y)}_$getBounds(t=null){if(t){let e=t;const i=this._$transform._$rawMatrix();1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]&&0===i[4]&&0===i[5]||(e=ut(t,i));const s=gt(this._$bounds,e);return e!==t&&et(e),s}return K(this._$bounds.xMin,this._$bounds.xMax,this._$bounds.yMin,this._$bounds.yMax)}_$createWorkerInstance(){if(!Tr||this._$created)return;this._$created=!0;const t={command:"createVideo",buffer:new Float32Array,instanceId:this._$instanceId,parentId:this._$parent?this._$parent._$instanceId:-1,smoothing:this._$smoothing,xMin:this._$bounds.xMin,yMin:this._$bounds.yMin,xMax:this._$bounds.xMax,yMax:this._$bounds.yMax};this._$characterId>-1&&(t.characterId=this._$characterId),this._$loaderInfo&&(t.loaderInfoId=this._$loaderInfo._$id),this._$scale9Grid&&(t.grid={x:this._$scale9Grid.x,y:this._$scale9Grid.y,w:this._$scale9Grid.width,h:this._$scale9Grid.height}),Tr.postMessage(t)}_$postProperty(){if(!Tr)return;const t=this._$createMessage();t.smoothing=this._$smoothing;const e=nt(),i=this._$context;if(i&&this._$video){t.xMin=this._$bounds.xMin,t.yMin=this._$bounds.yMin,t.xMax=this._$bounds.xMax,t.yMax=this._$bounds.yMax,i.drawImage(this._$video,0,0);const s=i.canvas.transferToImageBitmap();t.imageBitmap=s,e.push(s)}Tr.postMessage(t,e),at(e),this._$posted=!0,this._$updated=!1}}class ce extends Zt{constructor(){super(),this._$buttonMode=!1,this._$hitArea=null,this._$soundTransform=null,this._$useHandCursor=!0}static toString(){return"[class Sprite]"}static get namespace(){return"next2d.display.Sprite"}toString(){return"[object Sprite]"}get namespace(){return"next2d.display.Sprite"}get buttonMode(){return this._$buttonMode}set buttonMode(t){this._$buttonMode=!!t}get dropTarget(){return ks}get hitArea(){return this._$hitArea}set hitArea(t){this._$hitArea&&(this._$hitArea._$hitObject=null),this._$hitArea=t,t&&(t._$hitObject=this)}get soundTransform(){return this._$soundTransform||(this._$soundTransform=new oe),this._$soundTransform}set soundTransform(t){this._$soundTransform=t}get useHandCursor(){return this._$useHandCursor}set useHandCursor(t){this._$useHandCursor=t}startDrag(t=!1,e=null){let i=0,s=0;if(!t){const t=this._$dragMousePoint();i=this.x-t.x,s=this.y-t.y}Ns(this),Ds.lock=t,Ds.position.x=i,Ds.position.y=s,Ds.bounds=e}stopDrag(){Ns(null),Ds.lock=!1,Ds.position.x=0,Ds.position.y=0,Ds.bounds=null}_$sync(t){Tr&&this._$stage&&this._$createWorkerInstance(),this._$controller=t.controller,this._$dictionary=t.dictionary,this._$placeMap=t.placeMap,this._$placeObjects=t.placeObjects}_$build(t,e){const i=this._$baseBuild(t,e);return Tr&&this._$stage&&this._$createWorkerInstance(),this._$controller=i.controller,this._$dictionary=i.dictionary,this._$placeMap=i.placeMap,this._$placeObjects=i.placeObjects,i}_$dragMousePoint(){return this._$parent?this._$parent.globalToLocal(hr()):this.globalToLocal(hr())}}class _e extends ce{constructor(){super(),this._$stopFlag=!1,this._$canAction=!0,this._$childRemove=!1,this._$canSound=!0,this._$actionProcess=!1,this._$actions=ot(),this._$frameCache=ot(),this._$labels=null,this._$sounds=ot(),this._$actionOffset=0,this._$actionLimit=0,this._$currentFrame=1,this._$totalFrames=1,this._$isPlaying=!1,this._$loopConfig=null,this._$tweenFrame=0}static toString(){return"[class MovieClip]"}static get namespace(){return"next2d.display.MovieClip"}toString(){return"[object MovieClip]"}get namespace(){return"next2d.display.MovieClip"}get currentFrame(){return this._$currentFrame}get currentFrameLabel(){if(!this._$labels)return null;const t=this._$currentFrame;return this._$labels.has(t)&&this._$labels.get(t)||null}get currentLabels(){return this._$labels&&this._$labels.size?T.from(this._$labels.values()):null}get isPlaying(){return this._$isPlaying}get totalFrames(){return this._$totalFrames}get loopConfig(){if(this._$loopConfig)return this._$loopConfig;const t=this._$placeObject||this._$getPlaceObject();return t&&t.loop?(this._$tweenFrame&&(this._$changePlace=this._$tweenFrame!==this._$parent._$currentFrame,this._$tweenFrame=0),t.loop.tweenFrame&&(this._$tweenFrame=t.loop.tweenFrame),t.loop):null}set loopConfig(t){this._$loopConfig=t,t&&(t.frame=this._$startFrame,this._$loopConfig=t,this._$currentFrame=this._$getLoopFrame(t))}gotoAndPlay(t){this.play(),this._$goToFrame(t)}gotoAndStop(t){this.stop(),this._$goToFrame(t)}nextFrame(){this.stop(),this._$totalFrames>this._$currentFrame&&this._$goToFrame(this._$currentFrame+1)}play(){this._$stopFlag=!1,this._$isPlaying=!0,this._$updateState()}prevFrame(){const t=this._$currentFrame-1;t&&(this.stop(),this._$goToFrame(t))}stop(){this._$stopFlag=!0,this._$isPlaying=!1}addFrameLabel(t){this._$labels||(this._$labels=ot()),this._$labels.set(t.frame,t)}addFrameScript(...t){for(let e=0;e<t.length;e+=2){const i=t[e];let s=+i;C(s)&&(s=this._$getFrameForLabel(`${i}`));const r=t[e+1];if(r&&s&&this._$totalFrames>=s&&this._$addAction(s,r),s===this._$currentFrame){const t=ar();if(t._$actionOffset=t._$actions.length,this._$canAction=!0,this._$setAction(),t._$actionOffset!==t._$actions.length){const e=t._$actions.splice(0,t._$actionOffset);t._$actions.push(...t._$actions,...e),t._$actionOffset=0}}}}_$getFrameForLabel(t){if(!this._$labels)return 0;for(const[e,i]of this._$labels)if(i.name===t)return e;return 0}_$addAction(t,e){if(t){this._$actions.has(t)||this._$actions.set(t,nt());const i=this._$actions.get(t);i&&i.push(e)}}_$setAction(){if(this._$executeAddedEvent(),this._$canAction){const t=this._$currentFrame;if(this._$labels&&this._$labels.has(t)){const e=this._$labels.get(t);e&&e.willTrigger(wt.FRAME_LABEL)&&e.dispatchEvent(new wt(wt.FRAME_LABEL))}if(this._$actions.size&&this._$actions.has(t)){const t=ar();-1===t._$actions.indexOf(this)&&t._$actions.push(this)}}}_$goToFrame(t){let e=+t;if(C(e)&&(e=this._$getFrameForLabel(`${t}`)),e<1&&(e=1),e>this._$totalFrames)return this._$currentFrame=this._$totalFrames,this._$clearChildren(),this._$canAction=!1,void(this._$wait=!1);const i=ar();switch(!0){case e!==this._$currentFrame:{this._$wait=!1;const t=this._$currentFrame;this._$actionProcess&&(this._$frameCache.set("nextFrame",e),this._$frameCache.set("stopFlag",this._$stopFlag),this._$frameCache.set("isPlaying",this._$isPlaying)),this._$currentFrame=e,this._$clearChildren(),i._$actionOffset=i._$actions.length;const s=i._$actionOffset?i._$actions.indexOf(this):-1;if(this._$canAction=!0,this._$prepareActions(),i._$actionOffset&&i._$actionOffset!==i._$actions.length){const t=i._$actions.splice(0,i._$actionOffset);i._$actions.push(...i._$actions,...t),i._$actionOffset=0}if(!this._$actionProcess&&(s>-1||!i._$actionOffset))for(;i._$actions.length&&i._$actions.length!==s;){const t=i._$actions.pop();if(!t)continue;t._$canAction=!1,t._$actionOffset=0,t._$actionLimit=0,t._$actionProcess&&t._$frameCache.size&&(t._$currentFrame=t._$frameCache.get("nextFrame"),t._$clearChildren(),t._$stopFlag=t._$frameCache.get("stopFlag"),t._$isPlaying=t._$frameCache.get("isPlaying"),t._$frameCache.clear());const e=t._$currentFrame;if(!t._$actions.has(e))continue;const s=t._$actions.get(e);if(s)for(let e=0;e<s.length;++e)try{r(t._$loaderInfo),s[e].apply(t)}catch(e){t.stop()}}this._$actionProcess&&(this._$currentFrame=t,this._$clearChildren())}break;case!this._$actionProcess&&i._$actions.indexOf(this)>-1:{if(!this._$actionLimit)break;this._$wait=!1;const t=i._$actions.splice(this._$actionOffset,this._$actionLimit);for(;t.length;){const e=t.pop();if(!e)continue;e._$canAction=!1,e._$actionOffset=0,e._$actionLimit=0;const i=e._$currentFrame;if(!e._$actions.has(i))continue;const s=e._$actions.get(i);if(s)for(let t=0;t<s.length;++t)try{r(e._$loaderInfo),s[t].apply(e)}catch(t){e.stop()}}}}r(null),this._$canSound&&this._$sounds.size&&this._$sounds.has(this._$currentFrame)&&!i._$sounds.has(this._$instanceId)&&i._$sounds.set(this._$instanceId,this)}_$prepareActions(){this._$wait=!1;const t=this._$needsChildren?this._$getChildren():this._$children;for(let e=t.length-1;e>-1;--e)t[e]._$prepareActions();this._$setAction()}_$nextFrame(){let t=this._$needsChildren;switch(!0){case this._$wait:t=!0,this._$wait=!1;break;case this._$stopFlag:case 1===this._$totalFrames:break;default:{t=!0,this._$canAction=!0,this._$canSound=!0;const e=this.loopConfig;if(e){const i=e.end?e.end:this._$totalFrames;switch(e.type){case 0:this._$changePlace?this._$currentFrame=e.start:(++this._$currentFrame,this._$currentFrame>i&&(this._$currentFrame=e.start));break;case 1:this._$changePlace?this._$currentFrame=e.start:(++this._$currentFrame,this._$currentFrame>i&&(this._$currentFrame=i,t=!1,this._$canAction=!1,this._$canSound=!1));break;case 2:this._$changePlace?this._$currentFrame=e.start:(t=!1,this._$canAction=!1,this._$canSound=!1);break;case 3:this._$changePlace?this._$currentFrame=i:(--this._$currentFrame,e.start>this._$currentFrame&&(this._$currentFrame=e.start,t=!1,this._$canAction=!1,this._$canSound=!1));break;case 4:this._$changePlace?this._$currentFrame=i:(--this._$currentFrame,e.start>this._$currentFrame&&(this._$currentFrame=i))}}else++this._$currentFrame,this._$currentFrame>this._$totalFrames&&(this._$currentFrame=1);if(t&&this._$clearChildren(),this._$canSound&&this._$sounds.size&&this._$sounds.has(this._$currentFrame)){const t=ar();t._$sounds.has(this._$instanceId)||t._$sounds.set(this._$instanceId,this)}}}const e=this._$needsChildren?this._$getChildren():this._$children;for(let i=e.length-1;i>-1;--i){const s=e[i];s._$isNext&&(t?s._$nextFrame():t=s._$nextFrame())}return this._$setAction(),this._$isNext=t,!this._$posted&&Tr&&this._$postProperty(),this._$isNext}_$getLoopFrame(t){const e=this._$parent._$currentFrame-t.frame;let i=1;switch(t.type){case 0:{const s=t.end?t.end:this._$totalFrames;i=t.start;for(let r=0;r<e;++r)++i,i>s&&(i=t.start)}break;case 1:{const s=t.end?t.end:this._$totalFrames;i=v.min(s,t.start+e)}break;case 2:i=t.start;break;case 3:i=t.end?t.end:this._$totalFrames,i=v.max(t.start,i-e);break;case 4:{const s=t.end?t.end:this._$totalFrames;i=s;for(let r=0;r<e;++r)--i,t.start>i&&(i=s)}}return i}_$buildCharacter(t){if(t.sounds)for(let e=0;e<t.sounds.length;++e){const i=t.sounds[e],s=nt();for(let t=0;t<i.sound.length;++t){const e=new he;e._$build(i.sound[t],this),s.push(e)}this._$sounds.set(i.frame,s)}if(t.actions)for(let e=0;e<t.actions.length;++e){const i=t.actions[e];i.script||(i.script=Function(i.action)),this._$addAction(i.frame,i.script)}if(t.labels)for(let e=0;e<t.labels.length;++e){const i=t.labels[e];this.addFrameLabel(new ee(i.name,i.frame))}this._$totalFrames=t.totalFrame||1}_$sync(t){super._$sync(t),this._$buildCharacter(t)}_$build(t,e){const i=super._$build(t,e);return this._$buildCharacter(i),i}_$soundPlay(){if(!this._$sounds.has(this._$currentFrame))return;const t=this._$sounds.get(this._$currentFrame);if(t.length){let e=this._$soundTransform,i=this._$parent;for(;i;)i._$soundTransform&&(e=i._$soundTransform),i=i._$parent;for(let i=0;i<t.length;++i){const s=t[i];e&&(s.loopCount=e.loop?16777215:0,s.volume=e.volume),s.play()}}this._$canSound=!1}}class $e extends Zt{constructor(){super(),this._$loaderInfo=new ne}static toString(){return"[class Loader]"}static get namespace(){return"next2d.display.Loader"}toString(){return"[object Loader]"}get namespace(){return"next2d.display.Loader"}get content(){return this._$loaderInfo?this._$loaderInfo.content:null}get contentLoaderInfo(){return this._$loaderInfo}load(t){const e=this._$loaderInfo;e&&(e.url=t.url,e.format=t.responseDataFormat,pr({format:t.responseDataFormat,url:t.url,method:t.method,data:t.data,headers:t.headers,withCredentials:t.withCredentials,event:{loadstart:t=>{this._$loadstart(t)},progress:t=>{this._$progress(t)},loadend:t=>{this._$loadend(t)}}}))}loadJSON(t){if("zlib"===t.type){if(Rr())return void Mr.push(t);Fr(!0);const e=wr(),i=new Uint8Array(t.buffer);e.onmessage=t=>{this._$unzipHandler(t)},e.postMessage(i,[i.buffer])}else this._$build(t)}_$loadend(t){const e=this._$loaderInfo;if(!e)return;e.bytesLoaded=t.loaded,e.bytesTotal=t.total,e.willTrigger(Lt.PROGRESS)&&e.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total));const i=t.target;if(e.willTrigger(Rt.HTTP_STATUS)){const t=mr(i.getAllResponseHeaders());e.dispatchEvent(new Rt(Rt.HTTP_STATUS,!1,!1,i.status,i.responseURL,t))}199<i.status&&400>i.status?"json"===e.format?this.loadJSON(i.response):e.willTrigger(Bt.IO_ERROR)&&e.dispatchEvent(new Bt(Bt.IO_ERROR,!1,!1,"LoaderInfo format is `json`")):e.willTrigger(Bt.IO_ERROR)&&e.dispatchEvent(new Bt(Bt.IO_ERROR,!1,!1,i.statusText))}_$unzipHandler(t){if(this._$build(t.data),Mr.length){const t=Mr.pop();if(!t)return;const e=new Uint8Array(t.buffer),i=wr();i.onmessage=t=>{this._$unzipHandler(t)},i.postMessage(e,[e.buffer])}else Fr(!1)}_$loadstart(t){const e=this._$loaderInfo;e&&(e.bytesLoaded=t.loaded,e.bytesTotal=t.total,e.willTrigger(wt.OPEN)&&e.dispatchEvent(new wt(wt.OPEN)),e.willTrigger(Lt.PROGRESS)&&e.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total)))}_$progress(t){const e=this._$loaderInfo;e&&(e.bytesLoaded=t.loaded,e.bytesTotal=t.total,e.willTrigger(Lt.PROGRESS)&&e.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total)))}_$build(t){const e=this._$loaderInfo;if(!e)return;const i=ot();if(t.symbols.length)for(let e=0;e<t.symbols.length;++e){const s=t.symbols[e];i.set(s[0],s[1])}e._$data={stage:t.stage,characters:t.characters,symbols:i},e._$content=new _e;const s=t.characters[0];e._$content._$build({characterId:0,clipDepth:0,depth:0,endFrame:s.controller.length,startFrame:1},this),e._$content._$parent=null,this.addChild(e._$content),e._$content._$added=!1,e._$content._$addedStage=!1;const r=ar();r._$loaders.push(e),1===r._$loadStatus&&(r._$loadStatus=2)}}class ue extends Qt{constructor(){super(),this._$graphics=null,this._$src=""}static toString(){return"[class Shape]"}static get namespace(){return"next2d.display.Shape"}toString(){return"[object Shape]"}get namespace(){return"next2d.display.Shape"}get graphics(){return this._$graphics||(this._$graphics=new re(this)),this._$graphics}get src(){return this._$src}set src(t){if(!t)return;const e=new Image;e.addEventListener("load",(()=>{const t=e.width,i=e.height,s=new te(t,i);s.image=e,this.graphics.beginBitmapFill(s).drawRect(0,0,t,i),this.hasEventListener(wt.LOAD)&&this.dispatchEvent(new wt(wt.LOAD))})),this._$src=e.src=t,this.graphics._$mode="bitmap"}_$buildCharacter(t,e){const i=this.graphics;if(!e._$data)throw new Error("the loaderInfo data is null.");if(t.recodes)switch(!0){case t.bitmapId>0:{const s=e._$data.characters[t.bitmapId];if(!s.buffer)throw new Error("the bitmap buffer is null.");const r=v.abs(s.bounds.xMax-s.bounds.xMin),n=v.abs(s.bounds.yMax-s.bounds.yMin),a=new te(r,n);s._$buffer||(s._$buffer=new Uint8Array(s.buffer),at(s.buffer),s.buffer=null),a.buffer=s._$buffer.slice(),i._$recode=nt(),r===t.bounds.xMax-t.bounds.xMin&&n===t.bounds.yMax-t.bounds.yMin&&(i._$bitmapId=t.bitmapId,i._$mode="bitmap");const h=t.recodes;if(h[h.length-1]===re.END_FILL){const t=h.length-6;for(let e=0;e<t;++e)i._$recode.push(h[e]);i._$recode.push(re.BITMAP_FILL,a,null,"repeat",!1)}else{const e=h[h.length-9],s=h[h.length-8],r=h[h.length-7],n=h[h.length-6],o=h.length-10;for(let t=0;t<o;++t)i._$recode.push(h[t]);i._$recode.push(re.BITMAP_STROKE,e,s,r,n,a,tt(1,0,0,1,t.bounds.xMin,t.bounds.yMin),"repeat",!1)}}break;case t.inBitmap:{i._$recode=nt();const e=t.recodes;for(let s=0;s<e.length;++s){const r=e[s];if(i._$recode[s]=r,"object"!=typeof r)continue;if(!r.buffer)continue;const n=new te(r.width,r.height);n.buffer=new Uint8Array(r.buffer),i._$recode[s++]=n;const a=e[s];i._$recode[s]=tt(a[0],a[1],a[2],a[3],a[4],a[5]),r.width===t.bounds.xMax-t.bounds.xMin&&r.height===t.bounds.yMax-t.bounds.yMin&&(i._$bitmapId=t.bitmapId,i._$mode="bitmap")}}break;default:i._$recode=t.recodes.slice(0)}else{i._$mode="bitmap";const e=v.abs(t.bounds.xMax-t.bounds.xMin),s=v.abs(t.bounds.yMax-t.bounds.yMin),r=new te(e,s);if(!t._$buffer){if(!t.buffer)throw new Error("the bitmap buffer is null.");t._$buffer=new Uint8Array(t.buffer),at(t.buffer),t.buffer=null}r.buffer=t._$buffer.slice(0),i.beginBitmapFill(r,null,!1).drawRect(0,0,e,s)}i._$maxAlpha=1,i._$canDraw=!0,i._$xMin=t.bounds.xMin,i._$xMax=t.bounds.xMax,i._$yMin=t.bounds.yMin,i._$yMax=t.bounds.yMax,t.grid&&(this._$scale9Grid=new Dt(t.grid.x,t.grid.y,t.grid.w,t.grid.h)),Tr&&this._$stage&&this._$createWorkerInstance()}_$sync(t){this._$loaderInfo&&this._$buildCharacter(t,this._$loaderInfo)}_$build(t,e){const i=this._$baseBuild(t,e);return this._$buildCharacter(i,e._$loaderInfo),i}_$getBounds(t=null){if(!this._$graphics)return K(0,0,0,0);const e=this._$graphics._$getBounds();if(!t)return e;let i=t;const s=this._$transform._$rawMatrix();1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=ut(t,s));const r=gt(e,i);return Q(e),i!==t&&et(i),r}_$draw(t,e,i){if(!this._$visible)return;if(!this._$graphics||!this._$graphics._$canDraw)return;let s=i;const r=this._$transform._$rawColorTransform();if((r!==O&&1!==r[0]||1!==r[1]||1!==r[2]||1!==r[3]||0!==r[4]||0!==r[5]||0!==r[6]||0!==r[7])&&(s=dt(i,r)),!$t(s[3]+s[7]/255,0,1,0))return void(s!==i&&st(s));const n=this._$filters||this.filters,a=this._$blendMode||this.blendMode;let h=e;const o=this._$transform._$rawMatrix();(o!==Vs&&1!==o[0]||0!==o[1]||0!==o[2]||1!==o[3]||0!==o[4]||0!==o[5])&&(h=ut(e,o)),this._$graphics._$draw(t,h,s,a,n),h!==e&&et(h),s!==i&&st(s)}_$clip(t,e){if(!this._$graphics)return;let i=e;const s=this._$transform._$rawMatrix();1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=ut(e,s)),this._$graphics._$clip(t,i),i!==e&&et(i)}_$mouseHit(t,e,i){return!!this._$visible&&this._$hit(t,e,i)}_$hit(t,e,i,s=!1){let r=!1;const n=this._$graphics;if(n&&n._$canDraw&&n._$getBounds()){let a=e;const h=this._$transform._$rawMatrix();1===h[0]&&0===h[1]&&0===h[2]&&1===h[3]&&0===h[4]&&0===h[5]||(a=ut(e,h)),r=n._$hit(t,a,i,s),a!==e&&et(a)}return r}_$createWorkerInstance(){if(this._$created||!Tr)return;this._$created=!0,this._$posted=!0,this._$updated=!1;const t=sr();let e=0;t[e++]=this._$instanceId,t[e++]=this._$parent?this._$parent._$instanceId:-1,t[e++]=0,t[e++]=0;const i=this._$graphics;if(i&&!i._$posted&&i._$maxAlpha>0&&i._$canDraw){i._$posted=!0;const e=rr(),s=i._$getRecodes();e.command=`shapeRecodes@${this._$instanceId}`,e.buffer=s;const r=nt(s.buffer);Tr.postMessage(e,r),nr(e),at(r),t[2]=i._$maxAlpha,t[3]=+i._$canDraw}const s=this._$getBounds();t[e++]=s.xMin,t[e++]=s.yMin,t[e++]=s.xMax,t[e++]=s.yMax,t[e++]=this._$characterId>-1?this._$characterId:-1,t[e++]=this._$loaderInfo?this._$loaderInfo._$id:-1,this._$registerProperty(t,10);const r=rr();r.command="createShape",r.buffer=t;const n=nt(t.buffer);Tr.postMessage(r,n),nr(r),at(n)}_$postProperty(){if(!this._$created||!Tr)return;const t=this._$createMessage(),e=this._$graphics;if(e&&!e._$posted){t.maxAlpha=e._$maxAlpha,t.canDraw=e._$canDraw;const i=e._$getRecodes();t.recodes=i;const s=nt(i.buffer),r=this._$getBounds();t.xMin=r.xMin,t.yMin=r.yMin,t.xMax=r.xMax,t.yMax=r.yMax,Tr.postMessage(t,s),at(s)}else Tr.postMessage(t);this._$posted=!0,this._$updated=!1}}class de extends Zt{constructor(){super(),this._$player=null,this._$root=this,this._$stage=this,this._$invalidate=!0,this._$color=4294967295,this._$frameRate=60}static toString(){return"[class Stage]"}static get namespace(){return"next2d.display.Stage"}toString(){return"[object Stage]"}get namespace(){return"next2d.display.Stage"}get color(){return this._$color}set color(t){this._$color=$t(pt(t),0,16777215,16777215);const e=this._$player;if(e&&e.context){const t=mt(this._$color);e.context._$setColor(t.R/255,t.G/255,t.B/255,t.A/255)}}get frameRate(){return this._$frameRate}set frameRate(t){this._$frameRate=$t(+t,1,60,60),this._$player&&!this._$player._$stopFlag&&(this._$player.stop(),this._$player.play())}get player(){return this._$player}get canvasHeight(){return this._$player?this._$player._$height/f:0}get canvasWidth(){return this._$player?this._$player._$width/f:0}get currentStageHeight(){return this._$player?this._$player.height*this._$player._$scale:0}get currentStageWidth(){return this._$player?this._$player.width*this._$player._$scale:0}get stageHeight(){return this._$player?this._$player.height:0}get stageWidth(){return this._$player?this._$player.width:0}invalidate(){this._$invalidate=!0}_$addChild(t){return t._$stage=this,t._$root=t,this._$created=!0,super._$addChild(t)}}class ge{static toString(){return"[class Easing]"}static get namespace(){return"next2d.ui.Easing"}toString(){return"[object Easing]"}get namespace(){return"next2d.ui.Easing"}static linear(t,e,i,s){return t/s*i+e}static inQuad(t,e,i,s){return(t/=s)*t*i+e}static outQuad(t,e,i,s){return-(t/=s)*(t-2)*i+e}static inOutQuad(t,e,i,s){return(t/=s/2)<1?t*t*i/2+e:-((t-=1)*(t-2)-1)*i/2+e}static inCubic(t,e,i,s){return(t/=s)*t*t*i+e}static outCubic(t,e,i,s){return t/=s,(--t*t*t+1)*i+e}static inOutCubic(t,e,i,s){return(t/=s/2)<1?t*t*t*i/2+e:((t-=2)*t*t+2)*i/2+e}static inQuart(t,e,i,s){return(t/=s)*t*t*t*i+e}static outQuart(t,e,i,s){return t/=s,(--t*t*t*t-1)*-i+e}static inOutQuart(t,e,i,s){return(t/=s/2)<1?t*t*t*t*i/2+e:((t-=2)*t*t*t-2)*-i/2+e}static inQuint(t,e,i,s){return(t/=s)*t*t*t*t*i+e}static outQuint(t,e,i,s){return t/=s,(--t*t*t*t*t+1)*i+e}static inOutQuint(t,e,i,s){return(t/=s/2)<1?t*t*t*t*t*i/2+e:((t-=2)*t*t*t*t+2)*i/2+e}static inSine(t,e,i,s){return-i*v.cos(t/s*(v.PI/2))+i+e}static outSine(t,e,i,s){return i*v.sin(t/s*(v.PI/2))+e}static inOutSine(t,e,i,s){return-i/2*(v.cos(v.PI*t/s)-1)+e}static inExpo(t,e,i,s){return i*v.pow(2,10*(t/s-1))+e}static outExpo(t,e,i,s){return i*(1-v.pow(2,-10*t/s))+e}static inOutExpo(t,e,i,s){return(t/=s/2)<1?i/2*v.pow(2,10*(t-1))+e:i/2*(2-v.pow(2,-10*(t-1)))+e}static inCirc(t,e,i,s){return(1-v.sqrt(1-(t/=s)*t))*i+e}static outCirc(t,e,i,s){return t/=s,v.sqrt(1- --t*t)*i+e}static inOutCirc(t,e,i,s){return(t/=2*s)<1?(v.sqrt(1-t*t)-1)/-2*i+e:(v.sqrt(1-(t-=2)*t)+1)/2*i+e}static inBack(t,e,i,s){return(2.70158*(t/=s)*t*t-1.70158*t*t)*i+e}static outBack(t,e,i,s){return(1+2.70158*v.pow((t/=s)-1,3)+1.70158*v.pow(t-1,2))*i+e}static inOutBack(t,e,i,s){let r=1.70158;return(t/=s/2)<1?t*t*((1+(r*=1.525))*t-r)*i/2+e:((t-=2)*t*((1+(r*=1.525))*t+r)+2)*i/2+e}static inElastic(t,e,i,s){return 0==(t/=s)?e:1===t?i+e:-v.pow(2,(t*=10)-10)*v.sin((t-10.75)*(2*v.PI/3))*i+e}static outElastic(t,e,i,s){return 0==(t/=s)?e:1===t?i+e:(v.pow(2,-10*t)*v.sin((10*t-.75)*(2*v.PI/3))+1)*i+e}static inOutElastic(t,e,i,s){return 0==(t/=s)?e:1===t?i+e:t<.5?-v.pow(2,20*t-10)*v.sin((20*t-11.125)*(2*v.PI/4.5))/2*i+e:(v.pow(2,-20*t+10)*v.sin((20*t-11.125)*(2*v.PI/4.5))/2+1)*i+e}static outBounce(t,e,i,s){return(t/=s)<1/2.75?7.5625*t*t*i+e:t<2/2.75?(7.5625*(t-=1.5/2.75)*t+.75)*i+e:t<2.5/2.75?(7.5625*(t-=2.25/2.75)*t+.9375)*i+e:(7.5625*(t-=2.625/2.75)*t+.984375)*i+e}static inBounce(t,e,i,s){return i-ge.outBounce(s-t,0,i,s)+e}static inOutBounce(t,e,i,s){return t<s/2?ge.inBounce(2*t,e,i/2,s):ge.outBounce(2*t-s,e+i/2,i/2,s)}}class fe extends Ct{constructor(t,e=null,i=null,s=0,r=1,n=null){super(),this._$target=t,this._$delay=s,this._$duration=r,this._$ease=n||ge.linear,this._$from=e,this._$names=null,this._$startTime=0,this._$stopFlag=!1,this._$forceStop=!1,this._$to=i,this._$currentTime=0}static toString(){return"[class Job]"}static get namespace(){return"next2d.ui.Job"}toString(){return"[object Job]"}get namespace(){return"next2d.ui.Job"}get ease(){return this._$ease}set ease(t){"function"==typeof t&&(this._$ease=t)}get delay(){return this._$delay}set delay(t){this._$delay=t}get duration(){return this._$duration}set duration(t){this._$duration=t}get from(){return this._$from}set from(t){this._$from=t}get to(){return this._$to}set to(t){this._$to=t}get target(){return this._$target}initialize(){this._$forceStop||(this._$stopFlag=!1,this._$startTime=B.now(),this._$names=this.entries(this._$from),this.addEventListener(wt.ENTER_FRAME,(t=>{this._$update(t)})))}entries(t){const e=Object.entries(t);for(let t=0;t<e.length;++t){const i=e[t],s=i[1];s&&"object"==typeof s&&(i[1]=this.entries(s))}return e}start(){return new Promise((t=>{this.hasEventListener(wt.COMPLETE)||this.addEventListener(wt.COMPLETE,(e=>{this.removeEventListener(wt.COMPLETE,e.listener),t()})),this._$delay?I((()=>{this.initialize()}),1e3*this._$delay):this.initialize()}))}stop(){this.hasEventListener(wt.STOP)&&this.dispatchEvent(new wt(wt.STOP)),this.hasEventListener(wt.ENTER_FRAME)&&this.removeAllEventListener(wt.ENTER_FRAME),this.hasEventListener(wt.UPDATE)&&this.removeAllEventListener(wt.UPDATE),this.hasEventListener(wt.COMPLETE)&&this.removeAllEventListener(wt.COMPLETE),this._$forceStop=!0,this._$stopFlag=!0}_$update(t){this._$stopFlag||(this._$currentTime=.001*(B.now()-this._$startTime),this._$names&&this._$updateProperty(this._$target,this._$from,this._$to,this._$names),this.hasEventListener(wt.UPDATE)&&this.dispatchEvent(new wt(wt.UPDATE)),this._$currentTime>=this._$duration&&(this.removeEventListener(wt.ENTER_FRAME,t.listener),this.hasEventListener(wt.COMPLETE)&&this.dispatchEvent(new wt(wt.COMPLETE))))}_$updateProperty(t,e,i,s){for(let r=0;r<s.length;++r){const n=s[r],a=n[0];if("__proto__"===a||"constructor"===a||"prototype"===a)continue;const h=n[1];if(h&&"object"==typeof h){this._$updateProperty(t[a],e[a],i[a],h);continue}if(!t.hasOwnProperty(a))continue;const o=e[a];this._$duration>this._$currentTime?t[a]=this._$ease(this._$currentTime,o,i[a]-o,this._$duration):t[a]=i[a]}}}class pe{static toString(){return"[class Tween]"}static get namespace(){return"next2d.ui.Tween"}toString(){return"[object Tween]"}get namespace(){return"next2d.ui.Tween"}static add(t,e,i,s=0,r=1,n=null){return new fe(t,e,i,s,r,n)}}class me{constructor(t=null,e=null,i=null,s=null,r=null,n=null,a=null,h=null,o=null,l=null){this._$font=t,this._$size=e,this._$color=null===i?null:$t(pt(i),0,16777215,0),this._$bold=s,this._$italic=r,this._$underline=n,this._$align=a,this._$leftMargin=h,this._$rightMargin=o,this._$leading=l,this._$letterSpacing=0}static toString(){return"[class TextFormat]"}static get namespace(){return"next2d.text.TextFormat"}toString(){return"[object TextFormat]"}get namespace(){return"next2d.text.TextFormat"}get align(){return this._$align}set align(t){this._$align=t}get bold(){return this._$bold}set bold(t){this._$bold=null!==t?!!t:null}get color(){return this._$color}set color(t){this._$color=t,t&&(this._$color=$t(pt(t),0,16777215,0))}get font(){return this._$font}set font(t){this._$font=null!==t?`${t}`:null}get italic(){return this._$italic}set italic(t){this._$italic=null!==t?!!t:null}get leading(){return this._$leading}set leading(t){this._$leading=t}get leftMargin(){return this._$leftMargin}set leftMargin(t){this._$leftMargin=t}get letterSpacing(){return this._$letterSpacing}set letterSpacing(t){this._$letterSpacing=t}get rightMargin(){return this._$rightMargin}set rightMargin(t){this._$rightMargin=t}get size(){return this._$size}set size(t){this._$size=t?0|t:null}get underline(){return this._$underline}set underline(t){this._$underline=null!==t?!!t:null}_$clone(){const t=new me(this._$font,this._$size,this._$color,this._$bold,this._$italic,this._$underline,this._$align,this._$leftMargin,this._$rightMargin,this._$leading);return t._$letterSpacing=this._$letterSpacing,t}_$setDefault(){this._$align="left",this._$bold=!1,this._$color=0,this._$font="Times New Roman",this._$italic=!1,this._$leading=0,this._$leftMargin=0,this._$letterSpacing=0,this._$rightMargin=0,this._$size=12,this._$underline=!1}_$merge(t){null===this._$align&&(this._$align=t._$align),null===this._$bold&&(this._$bold=t._$bold),null===this._$color&&(this._$color=t._$color),null===this._$font&&(this._$font=t._$font),null===this._$italic&&(this._$italic=t._$italic),null===this._$leading&&(this._$leading=t._$leading),null===this._$leftMargin&&(this._$leftMargin=t._$leftMargin),null===this._$letterSpacing&&(this._$letterSpacing=t._$letterSpacing),null===this._$rightMargin&&(this._$rightMargin=t._$rightMargin),null===this._$size&&(this._$size=t._$size),null===this._$underline&&(this._$underline=t._$underline)}_$widthMargin(){let t=0;return this._$leftMargin&&(t+=this._$leftMargin),this._$rightMargin&&(t+=this._$rightMargin),t}_$generateFontStyle(){let t="";return this._$italic&&(t="italic "),this._$bold&&(t+="bold "),`${t}${this._$size}px '${this._$font}',sans-serif`}}const xe=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((t=>t.charCodeAt(0)))),be=new Uint16Array("Ȁaglq\tɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((t=>t.charCodeAt(0))));var ve;const Te=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),ye=null!==(ve=String.fromCodePoint)&&void 0!==ve?ve:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+=String.fromCharCode(t),e};var Ee,Ae,Me,Se,we,Ce,Fe,Re;function Be(t){return t>=Ee.ZERO&&t<=Ee.NINE}!function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"}(Ee||(Ee={})),function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"}(Ae||(Ae={})),function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"}(Me||(Me={})),(we=Se||(Se={}))[we.Legacy=0]="Legacy",we[we.Strict=1]="Strict",we[we.Attribute=2]="Attribute";class Ie{constructor(t,e,i){this.decodeTree=t,this.emitCodePoint=e,this.errors=i,this.state=Me.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Se.Strict}startEntity(t){this.decodeMode=t,this.state=Me.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,e){switch(this.state){case Me.EntityStart:return t.charCodeAt(e)===Ee.NUM?(this.state=Me.NumericStart,this.consumed+=1,this.stateNumericStart(t,e+1)):(this.state=Me.NamedEntity,this.stateNamedEntity(t,e));case Me.NumericStart:return this.stateNumericStart(t,e);case Me.NumericDecimal:return this.stateNumericDecimal(t,e);case Me.NumericHex:return this.stateNumericHex(t,e);case Me.NamedEntity:return this.stateNamedEntity(t,e)}}stateNumericStart(t,e){return e>=t.length?-1:(32|t.charCodeAt(e))===Ee.LOWER_X?(this.state=Me.NumericHex,this.consumed+=1,this.stateNumericHex(t,e+1)):(this.state=Me.NumericDecimal,this.stateNumericDecimal(t,e))}addToNumericResult(t,e,i,s){if(e!==i){const r=i-e;this.result=this.result*Math.pow(s,r)+parseInt(t.substr(e,r),s),this.consumed+=r}}stateNumericHex(t,e){const i=e;for(;e<t.length;){const r=t.charCodeAt(e);if(!(Be(r)||(s=r,s>=Ee.UPPER_A&&s<=Ee.UPPER_F||s>=Ee.LOWER_A&&s<=Ee.LOWER_F)))return this.addToNumericResult(t,i,e,16),this.emitNumericEntity(r,3);e+=1}var s;return this.addToNumericResult(t,i,e,16),-1}stateNumericDecimal(t,e){const i=e;for(;e<t.length;){const s=t.charCodeAt(e);if(!Be(s))return this.addToNumericResult(t,i,e,10),this.emitNumericEntity(s,2);e+=1}return this.addToNumericResult(t,i,e,10),-1}emitNumericEntity(t,e){var i;if(this.consumed<=e)return null===(i=this.errors)||void 0===i||i.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===Ee.SEMI)this.consumed+=1;else if(this.decodeMode===Se.Strict)return 0;return this.emitCodePoint(function(t){var e;return t>=55296&&t<=57343||t>1114111?65533:null!==(e=Te.get(t))&&void 0!==e?e:t}(this.result),this.consumed),this.errors&&(t!==Ee.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,e){const{decodeTree:i}=this;let s=i[this.treeIndex],r=(s&Ae.VALUE_LENGTH)>>14;for(;e<t.length;e++,this.excess++){const a=t.charCodeAt(e);if(this.treeIndex=Pe(i,s,this.treeIndex+Math.max(1,r),a),this.treeIndex<0)return 0===this.result||this.decodeMode===Se.Attribute&&(0===r||((n=a)===Ee.EQUALS||function(t){return t>=Ee.UPPER_A&&t<=Ee.UPPER_Z||t>=Ee.LOWER_A&&t<=Ee.LOWER_Z||Be(t)}(n)))?0:this.emitNotTerminatedNamedEntity();if(s=i[this.treeIndex],r=(s&Ae.VALUE_LENGTH)>>14,0!==r){if(a===Ee.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==Se.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}var n;return-1}emitNotTerminatedNamedEntity(){var t;const{result:e,decodeTree:i}=this,s=(i[e]&Ae.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,s,this.consumed),null===(t=this.errors)||void 0===t||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,e,i){const{decodeTree:s}=this;return this.emitCodePoint(1===e?s[t]&~Ae.VALUE_LENGTH:s[t+1],i),3===e&&this.emitCodePoint(s[t+2],i),i}end(){var t;switch(this.state){case Me.NamedEntity:return 0===this.result||this.decodeMode===Se.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case Me.NumericDecimal:return this.emitNumericEntity(0,2);case Me.NumericHex:return this.emitNumericEntity(0,3);case Me.NumericStart:return null===(t=this.errors)||void 0===t||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Me.EntityStart:return 0}}}function Le(t){let e="";const i=new Ie(t,(t=>e+=ye(t)));return function(t,s){let r=0,n=0;for(;(n=t.indexOf("&",n))>=0;){e+=t.slice(r,n),i.startEntity(s);const a=i.write(t,n+1);if(a<0){r=n+i.end();break}r=n+a,n=0===a?r+1:r}const a=e+t.slice(r);return e="",a}}function Pe(t,e,i,s){const r=(e&Ae.BRANCH_LENGTH)>>7,n=e&Ae.JUMP_TABLE;if(0===r)return 0!==n&&s===n?i:-1;if(n){const e=s-n;return e<0||e>=r?-1:t[i+e]-1}let a=i,h=a+r-1;for(;a<=h;){const e=a+h>>>1,i=t[e];if(i<s)a=e+1;else{if(!(i>s))return t[e+r];h=e-1}}return-1}function Oe(t){return t===Ce.Space||t===Ce.NewLine||t===Ce.Tab||t===Ce.FormFeed||t===Ce.CarriageReturn}function ke(t){return t===Ce.Slash||t===Ce.Gt||Oe(t)}Le(xe),Le(be),function(t){t[t.Tab=9]="Tab",t[t.NewLine=10]="NewLine",t[t.FormFeed=12]="FormFeed",t[t.CarriageReturn=13]="CarriageReturn",t[t.Space=32]="Space",t[t.ExclamationMark=33]="ExclamationMark",t[t.Number=35]="Number",t[t.Amp=38]="Amp",t[t.SingleQuote=39]="SingleQuote",t[t.DoubleQuote=34]="DoubleQuote",t[t.Dash=45]="Dash",t[t.Slash=47]="Slash",t[t.Zero=48]="Zero",t[t.Nine=57]="Nine",t[t.Semi=59]="Semi",t[t.Lt=60]="Lt",t[t.Eq=61]="Eq",t[t.Gt=62]="Gt",t[t.Questionmark=63]="Questionmark",t[t.UpperA=65]="UpperA",t[t.LowerA=97]="LowerA",t[t.UpperF=70]="UpperF",t[t.LowerF=102]="LowerF",t[t.UpperZ=90]="UpperZ",t[t.LowerZ=122]="LowerZ",t[t.LowerX=120]="LowerX",t[t.OpeningSquareBracket=91]="OpeningSquareBracket"}(Ce||(Ce={})),function(t){t[t.Text=1]="Text",t[t.BeforeTagName=2]="BeforeTagName",t[t.InTagName=3]="InTagName",t[t.InSelfClosingTag=4]="InSelfClosingTag",t[t.BeforeClosingTagName=5]="BeforeClosingTagName",t[t.InClosingTagName=6]="InClosingTagName",t[t.AfterClosingTagName=7]="AfterClosingTagName",t[t.BeforeAttributeName=8]="BeforeAttributeName",t[t.InAttributeName=9]="InAttributeName",t[t.AfterAttributeName=10]="AfterAttributeName",t[t.BeforeAttributeValue=11]="BeforeAttributeValue",t[t.InAttributeValueDq=12]="InAttributeValueDq",t[t.InAttributeValueSq=13]="InAttributeValueSq",t[t.InAttributeValueNq=14]="InAttributeValueNq",t[t.BeforeDeclaration=15]="BeforeDeclaration",t[t.InDeclaration=16]="InDeclaration",t[t.InProcessingInstruction=17]="InProcessingInstruction",t[t.BeforeComment=18]="BeforeComment",t[t.CDATASequence=19]="CDATASequence",t[t.InSpecialComment=20]="InSpecialComment",t[t.InCommentLike=21]="InCommentLike",t[t.BeforeSpecialS=22]="BeforeSpecialS",t[t.SpecialStartSequence=23]="SpecialStartSequence",t[t.InSpecialTag=24]="InSpecialTag",t[t.InEntity=25]="InEntity"}(Fe||(Fe={})),function(t){t[t.NoValue=0]="NoValue",t[t.Unquoted=1]="Unquoted",t[t.Single=2]="Single",t[t.Double=3]="Double"}(Re||(Re={}));const Ne={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101])};class De{constructor({xmlMode:t=!1,decodeEntities:e=!0},i){this.cbs=i,this.state=Fe.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=Fe.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=t,this.decodeEntities=e,this.entityDecoder=new Ie(t?be:xe,((t,e)=>this.emitCodePoint(t,e)))}reset(){this.state=Fe.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=Fe.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(t){this.offset+=this.buffer.length,this.buffer=t,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(t){t===Ce.Lt||!this.decodeEntities&&this.fastForwardTo(Ce.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=Fe.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&t===Ce.Amp&&this.startEntity()}stateSpecialStartSequence(t){const e=this.sequenceIndex===this.currentSequence.length;if(e?ke(t):(32|t)===this.currentSequence[this.sequenceIndex]){if(!e)return void this.sequenceIndex++}else this.isSpecial=!1;this.sequenceIndex=0,this.state=Fe.InTagName,this.stateInTagName(t)}stateInSpecialTag(t){if(this.sequenceIndex===this.currentSequence.length){if(t===Ce.Gt||Oe(t)){const e=this.index-this.currentSequence.length;if(this.sectionStart<e){const t=this.index;this.index=e,this.cbs.ontext(this.sectionStart,e),this.index=t}return this.isSpecial=!1,this.sectionStart=e+2,void this.stateInClosingTagName(t)}this.sequenceIndex=0}(32|t)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:0===this.sequenceIndex?this.currentSequence===Ne.TitleEnd?this.decodeEntities&&t===Ce.Amp&&this.startEntity():this.fastForwardTo(Ce.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=Number(t===Ce.Lt)}stateCDATASequence(t){t===Ne.Cdata[this.sequenceIndex]?++this.sequenceIndex===Ne.Cdata.length&&(this.state=Fe.InCommentLike,this.currentSequence=Ne.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=Fe.InDeclaration,this.stateInDeclaration(t))}fastForwardTo(t){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===t)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(t){t===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Ne.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=Fe.Text):0===this.sequenceIndex?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):t!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(t){return this.xmlMode?!ke(t):function(t){return t>=Ce.LowerA&&t<=Ce.LowerZ||t>=Ce.UpperA&&t<=Ce.UpperZ}(t)}startSpecial(t,e){this.isSpecial=!0,this.currentSequence=t,this.sequenceIndex=e,this.state=Fe.SpecialStartSequence}stateBeforeTagName(t){if(t===Ce.ExclamationMark)this.state=Fe.BeforeDeclaration,this.sectionStart=this.index+1;else if(t===Ce.Questionmark)this.state=Fe.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(t)){const e=32|t;this.sectionStart=this.index,this.xmlMode||e!==Ne.TitleEnd[2]?this.state=this.xmlMode||e!==Ne.ScriptEnd[2]?Fe.InTagName:Fe.BeforeSpecialS:this.startSpecial(Ne.TitleEnd,3)}else t===Ce.Slash?this.state=Fe.BeforeClosingTagName:(this.state=Fe.Text,this.stateText(t))}stateInTagName(t){ke(t)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=Fe.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateBeforeClosingTagName(t){Oe(t)||(t===Ce.Gt?this.state=Fe.Text:(this.state=this.isTagStartChar(t)?Fe.InClosingTagName:Fe.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(t){(t===Ce.Gt||Oe(t))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=Fe.AfterClosingTagName,this.stateAfterClosingTagName(t))}stateAfterClosingTagName(t){(t===Ce.Gt||this.fastForwardTo(Ce.Gt))&&(this.state=Fe.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(t){t===Ce.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=Fe.InSpecialTag,this.sequenceIndex=0):this.state=Fe.Text,this.sectionStart=this.index+1):t===Ce.Slash?this.state=Fe.InSelfClosingTag:Oe(t)||(this.state=Fe.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(t){t===Ce.Gt?(this.cbs.onselfclosingtag(this.index),this.state=Fe.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Oe(t)||(this.state=Fe.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateInAttributeName(t){(t===Ce.Eq||ke(t))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=-1,this.state=Fe.AfterAttributeName,this.stateAfterAttributeName(t))}stateAfterAttributeName(t){t===Ce.Eq?this.state=Fe.BeforeAttributeValue:t===Ce.Slash||t===Ce.Gt?(this.cbs.onattribend(Re.NoValue,this.index),this.state=Fe.BeforeAttributeName,this.stateBeforeAttributeName(t)):Oe(t)||(this.cbs.onattribend(Re.NoValue,this.index),this.state=Fe.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(t){t===Ce.DoubleQuote?(this.state=Fe.InAttributeValueDq,this.sectionStart=this.index+1):t===Ce.SingleQuote?(this.state=Fe.InAttributeValueSq,this.sectionStart=this.index+1):Oe(t)||(this.sectionStart=this.index,this.state=Fe.InAttributeValueNq,this.stateInAttributeValueNoQuotes(t))}handleInAttributeValue(t,e){t===e||!this.decodeEntities&&this.fastForwardTo(e)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(e===Ce.DoubleQuote?Re.Double:Re.Single,this.index),this.state=Fe.BeforeAttributeName):this.decodeEntities&&t===Ce.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(t){this.handleInAttributeValue(t,Ce.DoubleQuote)}stateInAttributeValueSingleQuotes(t){this.handleInAttributeValue(t,Ce.SingleQuote)}stateInAttributeValueNoQuotes(t){Oe(t)||t===Ce.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Re.Unquoted,this.index),this.state=Fe.BeforeAttributeName,this.stateBeforeAttributeName(t)):this.decodeEntities&&t===Ce.Amp&&this.startEntity()}stateBeforeDeclaration(t){t===Ce.OpeningSquareBracket?(this.state=Fe.CDATASequence,this.sequenceIndex=0):this.state=t===Ce.Dash?Fe.BeforeComment:Fe.InDeclaration}stateInDeclaration(t){(t===Ce.Gt||this.fastForwardTo(Ce.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=Fe.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(t){(t===Ce.Gt||this.fastForwardTo(Ce.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=Fe.Text,this.sectionStart=this.index+1)}stateBeforeComment(t){t===Ce.Dash?(this.state=Fe.InCommentLike,this.currentSequence=Ne.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=Fe.InDeclaration}stateInSpecialComment(t){(t===Ce.Gt||this.fastForwardTo(Ce.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=Fe.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(t){const e=32|t;e===Ne.ScriptEnd[3]?this.startSpecial(Ne.ScriptEnd,4):e===Ne.StyleEnd[3]?this.startSpecial(Ne.StyleEnd,4):(this.state=Fe.InTagName,this.stateInTagName(t))}startEntity(){this.baseState=this.state,this.state=Fe.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?Se.Strict:this.baseState===Fe.Text||this.baseState===Fe.InSpecialTag?Se.Legacy:Se.Attribute)}stateInEntity(){const t=this.entityDecoder.write(this.buffer,this.index-this.offset);t>=0?(this.state=this.baseState,0===t&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===Fe.Text||this.state===Fe.InSpecialTag&&0===this.sequenceIndex?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):this.state!==Fe.InAttributeValueDq&&this.state!==Fe.InAttributeValueSq&&this.state!==Fe.InAttributeValueNq||(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const t=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case Fe.Text:this.stateText(t);break;case Fe.SpecialStartSequence:this.stateSpecialStartSequence(t);break;case Fe.InSpecialTag:this.stateInSpecialTag(t);break;case Fe.CDATASequence:this.stateCDATASequence(t);break;case Fe.InAttributeValueDq:this.stateInAttributeValueDoubleQuotes(t);break;case Fe.InAttributeName:this.stateInAttributeName(t);break;case Fe.InCommentLike:this.stateInCommentLike(t);break;case Fe.InSpecialComment:this.stateInSpecialComment(t);break;case Fe.BeforeAttributeName:this.stateBeforeAttributeName(t);break;case Fe.InTagName:this.stateInTagName(t);break;case Fe.InClosingTagName:this.stateInClosingTagName(t);break;case Fe.BeforeTagName:this.stateBeforeTagName(t);break;case Fe.AfterAttributeName:this.stateAfterAttributeName(t);break;case Fe.InAttributeValueSq:this.stateInAttributeValueSingleQuotes(t);break;case Fe.BeforeAttributeValue:this.stateBeforeAttributeValue(t);break;case Fe.BeforeClosingTagName:this.stateBeforeClosingTagName(t);break;case Fe.AfterClosingTagName:this.stateAfterClosingTagName(t);break;case Fe.BeforeSpecialS:this.stateBeforeSpecialS(t);break;case Fe.InAttributeValueNq:this.stateInAttributeValueNoQuotes(t);break;case Fe.InSelfClosingTag:this.stateInSelfClosingTag(t);break;case Fe.InDeclaration:this.stateInDeclaration(t);break;case Fe.BeforeDeclaration:this.stateBeforeDeclaration(t);break;case Fe.BeforeComment:this.stateBeforeComment(t);break;case Fe.InProcessingInstruction:this.stateInProcessingInstruction(t);break;case Fe.InEntity:this.stateInEntity()}this.index++}this.cleanup()}finish(){this.state===Fe.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const t=this.buffer.length+this.offset;this.sectionStart>=t||(this.state===Fe.InCommentLike?this.currentSequence===Ne.CdataEnd?this.cbs.oncdata(this.sectionStart,t,0):this.cbs.oncomment(this.sectionStart,t,0):this.state===Fe.InTagName||this.state===Fe.BeforeAttributeName||this.state===Fe.BeforeAttributeValue||this.state===Fe.AfterAttributeName||this.state===Fe.InAttributeName||this.state===Fe.InAttributeValueSq||this.state===Fe.InAttributeValueDq||this.state===Fe.InAttributeValueNq||this.state===Fe.InClosingTagName||this.cbs.ontext(this.sectionStart,t))}emitCodePoint(t,e){this.baseState!==Fe.Text&&this.baseState!==Fe.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+e,this.index=this.sectionStart-1,this.cbs.onattribentity(t)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+e,this.index=this.sectionStart-1,this.cbs.ontextentity(t,this.sectionStart))}}const Ue=new Set(["input","option","optgroup","select","button","datalist","textarea"]),Ve=new Set(["p"]),Ge=new Set(["thead","tbody"]),ze=new Set(["dd","dt"]),Ye=new Set(["rt","rp"]),Xe=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",Ve],["h1",Ve],["h2",Ve],["h3",Ve],["h4",Ve],["h5",Ve],["h6",Ve],["select",Ue],["input",Ue],["output",Ue],["button",Ue],["datalist",Ue],["textarea",Ue],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",ze],["dt",ze],["address",Ve],["article",Ve],["aside",Ve],["blockquote",Ve],["details",Ve],["div",Ve],["dl",Ve],["fieldset",Ve],["figcaption",Ve],["figure",Ve],["footer",Ve],["form",Ve],["header",Ve],["hr",Ve],["main",Ve],["nav",Ve],["ol",Ve],["pre",Ve],["section",Ve],["table",Ve],["ul",Ve],["rt",Ye],["rp",Ye],["tbody",Ge],["tfoot",Ge]]),qe=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),He=new Set(["math","svg"]),je=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),We=/\s|\//;class Ke{constructor(t,e={}){var i,s,r,n,a;this.options=e,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=null!=t?t:{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=null!==(i=e.lowerCaseTags)&&void 0!==i?i:this.htmlMode,this.lowerCaseAttributeNames=null!==(s=e.lowerCaseAttributeNames)&&void 0!==s?s:this.htmlMode,this.tokenizer=new(null!==(r=e.Tokenizer)&&void 0!==r?r:De)(this.options,this),this.foreignContext=[!this.htmlMode],null===(a=(n=this.cbs).onparserinit)||void 0===a||a.call(n,this)}ontext(t,e){var i,s;const r=this.getSlice(t,e);this.endIndex=e-1,null===(s=(i=this.cbs).ontext)||void 0===s||s.call(i,r),this.startIndex=e}ontextentity(t,e){var i,s;this.endIndex=e-1,null===(s=(i=this.cbs).ontext)||void 0===s||s.call(i,ye(t)),this.startIndex=e}isVoidElement(t){return this.htmlMode&&qe.has(t)}onopentagname(t,e){this.endIndex=e;let i=this.getSlice(t,e);this.lowerCaseTagNames&&(i=i.toLowerCase()),this.emitOpenTag(i)}emitOpenTag(t){var e,i,s,r;this.openTagStart=this.startIndex,this.tagname=t;const n=this.htmlMode&&Xe.get(t);if(n)for(;this.stack.length>0&&n.has(this.stack[0]);){const t=this.stack.shift();null===(i=(e=this.cbs).onclosetag)||void 0===i||i.call(e,t,!0)}this.isVoidElement(t)||(this.stack.unshift(t),this.htmlMode&&(He.has(t)?this.foreignContext.unshift(!0):je.has(t)&&this.foreignContext.unshift(!1))),null===(r=(s=this.cbs).onopentagname)||void 0===r||r.call(s,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var e,i;this.startIndex=this.openTagStart,this.attribs&&(null===(i=(e=this.cbs).onopentag)||void 0===i||i.call(e,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,e){var i,s,r,n,a,h,o,l;this.endIndex=e;let c=this.getSlice(t,e);if(this.lowerCaseTagNames&&(c=c.toLowerCase()),this.htmlMode&&(He.has(c)||je.has(c))&&this.foreignContext.shift(),this.isVoidElement(c))this.htmlMode&&"br"===c&&(null===(n=(r=this.cbs).onopentagname)||void 0===n||n.call(r,"br"),null===(h=(a=this.cbs).onopentag)||void 0===h||h.call(a,"br",{},!0),null===(l=(o=this.cbs).onclosetag)||void 0===l||l.call(o,"br",!1));else{const t=this.stack.indexOf(c);if(-1!==t)for(let e=0;e<=t;e++){const r=this.stack.shift();null===(s=(i=this.cbs).onclosetag)||void 0===s||s.call(i,r,e!==t)}else this.htmlMode&&"p"===c&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=e+1}onselfclosingtag(t){this.endIndex=t,this.options.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var e,i;const s=this.tagname;this.endOpenTag(t),this.stack[0]===s&&(null===(i=(e=this.cbs).onclosetag)||void 0===i||i.call(e,s,!t),this.stack.shift())}onattribname(t,e){this.startIndex=t;const i=this.getSlice(t,e);this.attribname=this.lowerCaseAttributeNames?i.toLowerCase():i}onattribdata(t,e){this.attribvalue+=this.getSlice(t,e)}onattribentity(t){this.attribvalue+=ye(t)}onattribend(t,e){var i,s;this.endIndex=e,null===(s=(i=this.cbs).onattribute)||void 0===s||s.call(i,this.attribname,this.attribvalue,t===Re.Double?'"':t===Re.Single?"'":t===Re.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const e=t.search(We);let i=e<0?t:t.substr(0,e);return this.lowerCaseTagNames&&(i=i.toLowerCase()),i}ondeclaration(t,e){this.endIndex=e;const i=this.getSlice(t,e);if(this.cbs.onprocessinginstruction){const t=this.getInstructionName(i);this.cbs.onprocessinginstruction(`!${t}`,`!${i}`)}this.startIndex=e+1}onprocessinginstruction(t,e){this.endIndex=e;const i=this.getSlice(t,e);if(this.cbs.onprocessinginstruction){const t=this.getInstructionName(i);this.cbs.onprocessinginstruction(`?${t}`,`?${i}`)}this.startIndex=e+1}oncomment(t,e,i){var s,r,n,a;this.endIndex=e,null===(r=(s=this.cbs).oncomment)||void 0===r||r.call(s,this.getSlice(t,e-i)),null===(a=(n=this.cbs).oncommentend)||void 0===a||a.call(n),this.startIndex=e+1}oncdata(t,e,i){var s,r,n,a,h,o,l,c,_,$;this.endIndex=e;const u=this.getSlice(t,e-i);!this.htmlMode||this.options.recognizeCDATA?(null===(r=(s=this.cbs).oncdatastart)||void 0===r||r.call(s),null===(a=(n=this.cbs).ontext)||void 0===a||a.call(n,u),null===(o=(h=this.cbs).oncdataend)||void 0===o||o.call(h)):(null===(c=(l=this.cbs).oncomment)||void 0===c||c.call(l,`[CDATA[${u}]]`),null===($=(_=this.cbs).oncommentend)||void 0===$||$.call(_)),this.startIndex=e+1}onend(){var t,e;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let t=0;t<this.stack.length;t++)this.cbs.onclosetag(this.stack[t],!0)}null===(e=(t=this.cbs).onend)||void 0===e||e.call(t)}reset(){var t,e,i,s;null===(e=(t=this.cbs).onreset)||void 0===e||e.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,null===(s=(i=this.cbs).onparserinit)||void 0===s||s.call(i,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,e){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let i=this.buffers[0].slice(t-this.bufferOffset,e-this.bufferOffset);for(;e-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),i+=this.buffers[0].slice(0,e-this.bufferOffset);return i}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var e,i;this.ended?null===(i=(e=this.cbs).onerror)||void 0===i||i.call(e,new Error(".write() after done!")):(this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++))}end(t){var e,i;this.ended?null===(i=(e=this.cbs).onerror)||void 0===i||i.call(e,new Error(".end() after done!")):(t&&this.write(t),this.ended=!0,this.tokenizer.end())}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}var Qe,Je;(Je=Qe||(Qe={})).Root="root",Je.Text="text",Je.Directive="directive",Je.Comment="comment",Je.Script="script",Je.Style="style",Je.Tag="tag",Je.CDATA="cdata",Je.Doctype="doctype",Qe.Root,Qe.Text,Qe.Directive,Qe.Comment,Qe.Script,Qe.Style,Qe.Tag,Qe.CDATA,Qe.Doctype;class Ze{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return oi(this,t)}}class ti extends Ze{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class ei extends ti{constructor(){super(...arguments),this.type=Qe.Text}get nodeType(){return 3}}class ii extends ti{constructor(){super(...arguments),this.type=Qe.Comment}get nodeType(){return 8}}class si extends ti{constructor(t,e){super(e),this.name=t,this.type=Qe.Directive}get nodeType(){return 1}}class ri extends Ze{constructor(t){super(),this.children=t}get firstChild(){var t;return null!==(t=this.children[0])&&void 0!==t?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class ni extends ri{constructor(){super(...arguments),this.type=Qe.CDATA}get nodeType(){return 4}}class ai extends ri{constructor(){super(...arguments),this.type=Qe.Root}get nodeType(){return 9}}class hi extends ri{constructor(t,e,i=[],s=("script"===t?Qe.Script:"style"===t?Qe.Style:Qe.Tag)){super(i),this.name=t,this.attribs=e,this.type=s}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map((t=>{var e,i;return{name:t,value:this.attribs[t],namespace:null===(e=this["x-attribsNamespace"])||void 0===e?void 0:e[t],prefix:null===(i=this["x-attribsPrefix"])||void 0===i?void 0:i[t]}}))}}function oi(t,e=!1){let i;if(function(t){return t.type===Qe.Text}(t))i=new ei(t.data);else if(function(t){return t.type===Qe.Comment}(t))i=new ii(t.data);else if(function(t){return(e=t).type===Qe.Tag||e.type===Qe.Script||e.type===Qe.Style;var e}(t)){const s=e?li(t.children):[],r=new hi(t.name,{...t.attribs},s);s.forEach((t=>t.parent=r)),null!=t.namespace&&(r.namespace=t.namespace),t["x-attribsNamespace"]&&(r["x-attribsNamespace"]={...t["x-attribsNamespace"]}),t["x-attribsPrefix"]&&(r["x-attribsPrefix"]={...t["x-attribsPrefix"]}),i=r}else if(function(t){return t.type===Qe.CDATA}(t)){const s=e?li(t.children):[],r=new ni(s);s.forEach((t=>t.parent=r)),i=r}else if(function(t){return t.type===Qe.Root}(t)){const s=e?li(t.children):[],r=new ai(s);s.forEach((t=>t.parent=r)),t["x-mode"]&&(r["x-mode"]=t["x-mode"]),i=r}else{if(!function(t){return t.type===Qe.Directive}(t))throw new Error(`Not implemented yet: ${t.type}`);{const e=new si(t.name,t.data);null!=t["x-name"]&&(e["x-name"]=t["x-name"],e["x-publicId"]=t["x-publicId"],e["x-systemId"]=t["x-systemId"]),i=e}}return i.startIndex=t.startIndex,i.endIndex=t.endIndex,null!=t.sourceCodeLocation&&(i.sourceCodeLocation=t.sourceCodeLocation),i}function li(t){const e=t.map((t=>oi(t,!0)));for(let t=1;t<e.length;t++)e[t].prev=e[t-1],e[t-1].next=e[t];return e}const ci={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};class _i{constructor(t,e,i){this.dom=[],this.root=new ai(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof e&&(i=e,e=ci),"object"==typeof t&&(e=t,t=void 0),this.callback=null!=t?t:null,this.options=null!=e?e:ci,this.elementCB=null!=i?i:null}onparserinit(t){this.parser=t}onreset(){this.dom=[],this.root=new ai(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(t){this.handleCallback(t)}onclosetag(){this.lastNode=null;const t=this.tagStack.pop();this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(t)}onopentag(t,e){const i=this.options.xmlMode?Qe.Tag:void 0,s=new hi(t,e,void 0,i);this.addNode(s),this.tagStack.push(s)}ontext(t){const{lastNode:e}=this;if(e&&e.type===Qe.Text)e.data+=t,this.options.withEndIndices&&(e.endIndex=this.parser.endIndex);else{const e=new ei(t);this.addNode(e),this.lastNode=e}}oncomment(t){if(this.lastNode&&this.lastNode.type===Qe.Comment)return void(this.lastNode.data+=t);const e=new ii(t);this.addNode(e),this.lastNode=e}oncommentend(){this.lastNode=null}oncdatastart(){const t=new ei(""),e=new ni([t]);this.addNode(e),t.parent=e,this.lastNode=t}oncdataend(){this.lastNode=null}onprocessinginstruction(t,e){const i=new si(t,e);this.addNode(i)}handleCallback(t){if("function"==typeof this.callback)this.callback(t,this.dom);else if(t)throw t}addNode(t){const e=this.tagStack[this.tagStack.length-1],i=e.children[e.children.length-1];this.options.withStartIndices&&(t.startIndex=this.parser.startIndex),this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),e.children.push(t),i&&(t.prev=i,i.next=t),t.parent=e,this.lastNode=null}}function $i(t){for(let e=1;e<t.length;e++)t[e][0]+=t[e-1][0]+1;return t}new Map($i([[9,"	"],[0,"
"],[22,"!"],[0,"""],[0,"#"],[0,"$"],[0,"%"],[0,"&"],[0,"'"],[0,"("],[0,")"],[0,"*"],[0,"+"],[0,","],[1,"."],[0,"/"],[10,":"],[0,";"],[0,{v:"<",n:8402,o:"<⃒"}],[0,{v:"=",n:8421,o:"=⃥"}],[0,{v:">",n:8402,o:">⃒"}],[0,"?"],[0,"@"],[26,"["],[0,"\"],[0,"]"],[0,"^"],[0,"_"],[0,"`"],[5,{n:106,o:"fj"}],[20,"{"],[0,"|"],[0,"}"],[34," "],[0,"¡"],[0,"¢"],[0,"£"],[0,"¤"],[0,"¥"],[0,"¦"],[0,"§"],[0,"¨"],[0,"©"],[0,"ª"],[0,"«"],[0,"¬"],[0,"­"],[0,"®"],[0,"¯"],[0,"°"],[0,"±"],[0,"²"],[0,"³"],[0,"´"],[0,"µ"],[0,"¶"],[0,"·"],[0,"¸"],[0,"¹"],[0,"º"],[0,"»"],[0,"¼"],[0,"½"],[0,"¾"],[0,"¿"],[0,"À"],[0,"Á"],[0,"Â"],[0,"Ã"],[0,"Ä"],[0,"Å"],[0,"Æ"],[0,"Ç"],[0,"È"],[0,"É"],[0,"Ê"],[0,"Ë"],[0,"Ì"],[0,"Í"],[0,"Î"],[0,"Ï"],[0,"Ð"],[0,"Ñ"],[0,"Ò"],[0,"Ó"],[0,"Ô"],[0,"Õ"],[0,"Ö"],[0,"×"],[0,"Ø"],[0,"Ù"],[0,"Ú"],[0,"Û"],[0,"Ü"],[0,"Ý"],[0,"Þ"],[0,"ß"],[0,"à"],[0,"á"],[0,"â"],[0,"ã"],[0,"ä"],[0,"å"],[0,"æ"],[0,"ç"],[0,"è"],[0,"é"],[0,"ê"],[0,"ë"],[0,"ì"],[0,"í"],[0,"î"],[0,"ï"],[0,"ð"],[0,"ñ"],[0,"ò"],[0,"ó"],[0,"ô"],[0,"õ"],[0,"ö"],[0,"÷"],[0,"ø"],[0,"ù"],[0,"ú"],[0,"û"],[0,"ü"],[0,"ý"],[0,"þ"],[0,"ÿ"],[0,"Ā"],[0,"ā"],[0,"Ă"],[0,"ă"],[0,"Ą"],[0,"ą"],[0,"Ć"],[0,"ć"],[0,"Ĉ"],[0,"ĉ"],[0,"Ċ"],[0,"ċ"],[0,"Č"],[0,"č"],[0,"Ď"],[0,"ď"],[0,"Đ"],[0,"đ"],[0,"Ē"],[0,"ē"],[2,"Ė"],[0,"ė"],[0,"Ę"],[0,"ę"],[0,"Ě"],[0,"ě"],[0,"Ĝ"],[0,"ĝ"],[0,"Ğ"],[0,"ğ"],[0,"Ġ"],[0,"ġ"],[0,"Ģ"],[1,"Ĥ"],[0,"ĥ"],[0,"Ħ"],[0,"ħ"],[0,"Ĩ"],[0,"ĩ"],[0,"Ī"],[0,"ī"],[2,"Į"],[0,"į"],[0,"İ"],[0,"ı"],[0,"IJ"],[0,"ij"],[0,"Ĵ"],[0,"ĵ"],[0,"Ķ"],[0,"ķ"],[0,"ĸ"],[0,"Ĺ"],[0,"ĺ"],[0,"Ļ"],[0,"ļ"],[0,"Ľ"],[0,"ľ"],[0,"Ŀ"],[0,"ŀ"],[0,"Ł"],[0,"ł"],[0,"Ń"],[0,"ń"],[0,"Ņ"],[0,"ņ"],[0,"Ň"],[0,"ň"],[0,"ʼn"],[0,"Ŋ"],[0,"ŋ"],[0,"Ō"],[0,"ō"],[2,"Ő"],[0,"ő"],[0,"Œ"],[0,"œ"],[0,"Ŕ"],[0,"ŕ"],[0,"Ŗ"],[0,"ŗ"],[0,"Ř"],[0,"ř"],[0,"Ś"],[0,"ś"],[0,"Ŝ"],[0,"ŝ"],[0,"Ş"],[0,"ş"],[0,"Š"],[0,"š"],[0,"Ţ"],[0,"ţ"],[0,"Ť"],[0,"ť"],[0,"Ŧ"],[0,"ŧ"],[0,"Ũ"],[0,"ũ"],[0,"Ū"],[0,"ū"],[0,"Ŭ"],[0,"ŭ"],[0,"Ů"],[0,"ů"],[0,"Ű"],[0,"ű"],[0,"Ų"],[0,"ų"],[0,"Ŵ"],[0,"ŵ"],[0,"Ŷ"],[0,"ŷ"],[0,"Ÿ"],[0,"Ź"],[0,"ź"],[0,"Ż"],[0,"ż"],[0,"Ž"],[0,"ž"],[19,"ƒ"],[34,"Ƶ"],[63,"ǵ"],[65,"ȷ"],[142,"ˆ"],[0,"ˇ"],[16,"˘"],[0,"˙"],[0,"˚"],[0,"˛"],[0,"˜"],[0,"˝"],[51,"̑"],[127,"Α"],[0,"Β"],[0,"Γ"],[0,"Δ"],[0,"Ε"],[0,"Ζ"],[0,"Η"],[0,"Θ"],[0,"Ι"],[0,"Κ"],[0,"Λ"],[0,"Μ"],[0,"Ν"],[0,"Ξ"],[0,"Ο"],[0,"Π"],[0,"Ρ"],[1,"Σ"],[0,"Τ"],[0,"Υ"],[0,"Φ"],[0,"Χ"],[0,"Ψ"],[0,"Ω"],[7,"α"],[0,"β"],[0,"γ"],[0,"δ"],[0,"ε"],[0,"ζ"],[0,"η"],[0,"θ"],[0,"ι"],[0,"κ"],[0,"λ"],[0,"μ"],[0,"ν"],[0,"ξ"],[0,"ο"],[0,"π"],[0,"ρ"],[0,"ς"],[0,"σ"],[0,"τ"],[0,"υ"],[0,"φ"],[0,"χ"],[0,"ψ"],[0,"ω"],[7,"ϑ"],[0,"ϒ"],[2,"ϕ"],[0,"ϖ"],[5,"Ϝ"],[0,"ϝ"],[18,"ϰ"],[0,"ϱ"],[3,"ϵ"],[0,"϶"],[10,"Ё"],[0,"Ђ"],[0,"Ѓ"],[0,"Є"],[0,"Ѕ"],[0,"І"],[0,"Ї"],[0,"Ј"],[0,"Љ"],[0,"Њ"],[0,"Ћ"],[0,"Ќ"],[1,"Ў"],[0,"Џ"],[0,"А"],[0,"Б"],[0,"В"],[0,"Г"],[0,"Д"],[0,"Е"],[0,"Ж"],[0,"З"],[0,"И"],[0,"Й"],[0,"К"],[0,"Л"],[0,"М"],[0,"Н"],[0,"О"],[0,"П"],[0,"Р"],[0,"С"],[0,"Т"],[0,"У"],[0,"Ф"],[0,"Х"],[0,"Ц"],[0,"Ч"],[0,"Ш"],[0,"Щ"],[0,"Ъ"],[0,"Ы"],[0,"Ь"],[0,"Э"],[0,"Ю"],[0,"Я"],[0,"а"],[0,"б"],[0,"в"],[0,"г"],[0,"д"],[0,"е"],[0,"ж"],[0,"з"],[0,"и"],[0,"й"],[0,"к"],[0,"л"],[0,"м"],[0,"н"],[0,"о"],[0,"п"],[0,"р"],[0,"с"],[0,"т"],[0,"у"],[0,"ф"],[0,"х"],[0,"ц"],[0,"ч"],[0,"ш"],[0,"щ"],[0,"ъ"],[0,"ы"],[0,"ь"],[0,"э"],[0,"ю"],[0,"я"],[1,"ё"],[0,"ђ"],[0,"ѓ"],[0,"є"],[0,"ѕ"],[0,"і"],[0,"ї"],[0,"ј"],[0,"љ"],[0,"њ"],[0,"ћ"],[0,"ќ"],[1,"ў"],[0,"џ"],[7074," "],[0," "],[0," "],[0," "],[1," "],[0," "],[0," "],[0," "],[0,"​"],[0,"‌"],[0,"‍"],[0,"‎"],[0,"‏"],[0,"‐"],[2,"–"],[0,"—"],[0,"―"],[0,"‖"],[1,"‘"],[0,"’"],[0,"‚"],[1,"“"],[0,"”"],[0,"„"],[1,"†"],[0,"‡"],[0,"•"],[2,"‥"],[0,"…"],[9,"‰"],[0,"‱"],[0,"′"],[0,"″"],[0,"‴"],[0,"‵"],[3,"‹"],[0,"›"],[3,"‾"],[2,"⁁"],[1,"⁃"],[0,"⁄"],[10,"⁏"],[7,"⁗"],[7,{v:" ",n:8202,o:"  "}],[0,"⁠"],[0,"⁡"],[0,"⁢"],[0,"⁣"],[72,"€"],[46,"⃛"],[0,"⃜"],[37,"ℂ"],[2,"℅"],[4,"ℊ"],[0,"ℋ"],[0,"ℌ"],[0,"ℍ"],[0,"ℎ"],[0,"ℏ"],[0,"ℐ"],[0,"ℑ"],[0,"ℒ"],[0,"ℓ"],[1,"ℕ"],[0,"№"],[0,"℗"],[0,"℘"],[0,"ℙ"],[0,"ℚ"],[0,"ℛ"],[0,"ℜ"],[0,"ℝ"],[0,"℞"],[3,"™"],[1,"ℤ"],[2,"℧"],[0,"ℨ"],[0,"℩"],[2,"ℬ"],[0,"ℭ"],[1,"ℯ"],[0,"ℰ"],[0,"ℱ"],[1,"ℳ"],[0,"ℴ"],[0,"ℵ"],[0,"ℶ"],[0,"ℷ"],[0,"ℸ"],[12,"ⅅ"],[0,"ⅆ"],[0,"ⅇ"],[0,"ⅈ"],[10,"⅓"],[0,"⅔"],[0,"⅕"],[0,"⅖"],[0,"⅗"],[0,"⅘"],[0,"⅙"],[0,"⅚"],[0,"⅛"],[0,"⅜"],[0,"⅝"],[0,"⅞"],[49,"←"],[0,"↑"],[0,"→"],[0,"↓"],[0,"↔"],[0,"↕"],[0,"↖"],[0,"↗"],[0,"↘"],[0,"↙"],[0,"↚"],[0,"↛"],[1,{v:"↝",n:824,o:"↝̸"}],[0,"↞"],[0,"↟"],[0,"↠"],[0,"↡"],[0,"↢"],[0,"↣"],[0,"↤"],[0,"↥"],[0,"↦"],[0,"↧"],[1,"↩"],[0,"↪"],[0,"↫"],[0,"↬"],[0,"↭"],[0,"↮"],[1,"↰"],[0,"↱"],[0,"↲"],[0,"↳"],[1,"↵"],[0,"↶"],[0,"↷"],[2,"↺"],[0,"↻"],[0,"↼"],[0,"↽"],[0,"↾"],[0,"↿"],[0,"⇀"],[0,"⇁"],[0,"⇂"],[0,"⇃"],[0,"⇄"],[0,"⇅"],[0,"⇆"],[0,"⇇"],[0,"⇈"],[0,"⇉"],[0,"⇊"],[0,"⇋"],[0,"⇌"],[0,"⇍"],[0,"⇎"],[0,"⇏"],[0,"⇐"],[0,"⇑"],[0,"⇒"],[0,"⇓"],[0,"⇔"],[0,"⇕"],[0,"⇖"],[0,"⇗"],[0,"⇘"],[0,"⇙"],[0,"⇚"],[0,"⇛"],[1,"⇝"],[6,"⇤"],[0,"⇥"],[15,"⇵"],[7,"⇽"],[0,"⇾"],[0,"⇿"],[0,"∀"],[0,"∁"],[0,{v:"∂",n:824,o:"∂̸"}],[0,"∃"],[0,"∄"],[0,"∅"],[1,"∇"],[0,"∈"],[0,"∉"],[1,"∋"],[0,"∌"],[2,"∏"],[0,"∐"],[0,"∑"],[0,"−"],[0,"∓"],[0,"∔"],[1,"∖"],[0,"∗"],[0,"∘"],[1,"√"],[2,"∝"],[0,"∞"],[0,"∟"],[0,{v:"∠",n:8402,o:"∠⃒"}],[0,"∡"],[0,"∢"],[0,"∣"],[0,"∤"],[0,"∥"],[0,"∦"],[0,"∧"],[0,"∨"],[0,{v:"∩",n:65024,o:"∩︀"}],[0,{v:"∪",n:65024,o:"∪︀"}],[0,"∫"],[0,"∬"],[0,"∭"],[0,"∮"],[0,"∯"],[0,"∰"],[0,"∱"],[0,"∲"],[0,"∳"],[0,"∴"],[0,"∵"],[0,"∶"],[0,"∷"],[0,"∸"],[1,"∺"],[0,"∻"],[0,{v:"∼",n:8402,o:"∼⃒"}],[0,{v:"∽",n:817,o:"∽̱"}],[0,{v:"∾",n:819,o:"∾̳"}],[0,"∿"],[0,"≀"],[0,"≁"],[0,{v:"≂",n:824,o:"≂̸"}],[0,"≃"],[0,"≄"],[0,"≅"],[0,"≆"],[0,"≇"],[0,"≈"],[0,"≉"],[0,"≊"],[0,{v:"≋",n:824,o:"≋̸"}],[0,"≌"],[0,{v:"≍",n:8402,o:"≍⃒"}],[0,{v:"≎",n:824,o:"≎̸"}],[0,{v:"≏",n:824,o:"≏̸"}],[0,{v:"≐",n:824,o:"≐̸"}],[0,"≑"],[0,"≒"],[0,"≓"],[0,"≔"],[0,"≕"],[0,"≖"],[0,"≗"],[1,"≙"],[0,"≚"],[1,"≜"],[2,"≟"],[0,"≠"],[0,{v:"≡",n:8421,o:"≡⃥"}],[0,"≢"],[1,{v:"≤",n:8402,o:"≤⃒"}],[0,{v:"≥",n:8402,o:"≥⃒"}],[0,{v:"≦",n:824,o:"≦̸"}],[0,{v:"≧",n:824,o:"≧̸"}],[0,{v:"≨",n:65024,o:"≨︀"}],[0,{v:"≩",n:65024,o:"≩︀"}],[0,{v:"≪",n:new Map($i([[824,"≪̸"],[7577,"≪⃒"]]))}],[0,{v:"≫",n:new Map($i([[824,"≫̸"],[7577,"≫⃒"]]))}],[0,"≬"],[0,"≭"],[0,"≮"],[0,"≯"],[0,"≰"],[0,"≱"],[0,"≲"],[0,"≳"],[0,"≴"],[0,"≵"],[0,"≶"],[0,"≷"],[0,"≸"],[0,"≹"],[0,"≺"],[0,"≻"],[0,"≼"],[0,"≽"],[0,"≾"],[0,{v:"≿",n:824,o:"≿̸"}],[0,"⊀"],[0,"⊁"],[0,{v:"⊂",n:8402,o:"⊂⃒"}],[0,{v:"⊃",n:8402,o:"⊃⃒"}],[0,"⊄"],[0,"⊅"],[0,"⊆"],[0,"⊇"],[0,"⊈"],[0,"⊉"],[0,{v:"⊊",n:65024,o:"⊊︀"}],[0,{v:"⊋",n:65024,o:"⊋︀"}],[1,"⊍"],[0,"⊎"],[0,{v:"⊏",n:824,o:"⊏̸"}],[0,{v:"⊐",n:824,o:"⊐̸"}],[0,"⊑"],[0,"⊒"],[0,{v:"⊓",n:65024,o:"⊓︀"}],[0,{v:"⊔",n:65024,o:"⊔︀"}],[0,"⊕"],[0,"⊖"],[0,"⊗"],[0,"⊘"],[0,"⊙"],[0,"⊚"],[0,"⊛"],[1,"⊝"],[0,"⊞"],[0,"⊟"],[0,"⊠"],[0,"⊡"],[0,"⊢"],[0,"⊣"],[0,"⊤"],[0,"⊥"],[1,"⊧"],[0,"⊨"],[0,"⊩"],[0,"⊪"],[0,"⊫"],[0,"⊬"],[0,"⊭"],[0,"⊮"],[0,"⊯"],[0,"⊰"],[1,"⊲"],[0,"⊳"],[0,{v:"⊴",n:8402,o:"⊴⃒"}],[0,{v:"⊵",n:8402,o:"⊵⃒"}],[0,"⊶"],[0,"⊷"],[0,"⊸"],[0,"⊹"],[0,"⊺"],[0,"⊻"],[1,"⊽"],[0,"⊾"],[0,"⊿"],[0,"⋀"],[0,"⋁"],[0,"⋂"],[0,"⋃"],[0,"⋄"],[0,"⋅"],[0,"⋆"],[0,"⋇"],[0,"⋈"],[0,"⋉"],[0,"⋊"],[0,"⋋"],[0,"⋌"],[0,"⋍"],[0,"⋎"],[0,"⋏"],[0,"⋐"],[0,"⋑"],[0,"⋒"],[0,"⋓"],[0,"⋔"],[0,"⋕"],[0,"⋖"],[0,"⋗"],[0,{v:"⋘",n:824,o:"⋘̸"}],[0,{v:"⋙",n:824,o:"⋙̸"}],[0,{v:"⋚",n:65024,o:"⋚︀"}],[0,{v:"⋛",n:65024,o:"⋛︀"}],[2,"⋞"],[0,"⋟"],[0,"⋠"],[0,"⋡"],[0,"⋢"],[0,"⋣"],[2,"⋦"],[0,"⋧"],[0,"⋨"],[0,"⋩"],[0,"⋪"],[0,"⋫"],[0,"⋬"],[0,"⋭"],[0,"⋮"],[0,"⋯"],[0,"⋰"],[0,"⋱"],[0,"⋲"],[0,"⋳"],[0,"⋴"],[0,{v:"⋵",n:824,o:"⋵̸"}],[0,"⋶"],[0,"⋷"],[1,{v:"⋹",n:824,o:"⋹̸"}],[0,"⋺"],[0,"⋻"],[0,"⋼"],[0,"⋽"],[0,"⋾"],[6,"⌅"],[0,"⌆"],[1,"⌈"],[0,"⌉"],[0,"⌊"],[0,"⌋"],[0,"⌌"],[0,"⌍"],[0,"⌎"],[0,"⌏"],[0,"⌐"],[1,"⌒"],[0,"⌓"],[1,"⌕"],[0,"⌖"],[5,"⌜"],[0,"⌝"],[0,"⌞"],[0,"⌟"],[2,"⌢"],[0,"⌣"],[9,"⌭"],[0,"⌮"],[7,"⌶"],[6,"⌽"],[1,"⌿"],[60,"⍼"],[51,"⎰"],[0,"⎱"],[2,"⎴"],[0,"⎵"],[0,"⎶"],[37,"⏜"],[0,"⏝"],[0,"⏞"],[0,"⏟"],[2,"⏢"],[4,"⏧"],[59,"␣"],[164,"Ⓢ"],[55,"─"],[1,"│"],[9,"┌"],[3,"┐"],[3,"└"],[3,"┘"],[3,"├"],[7,"┤"],[7,"┬"],[7,"┴"],[7,"┼"],[19,"═"],[0,"║"],[0,"╒"],[0,"╓"],[0,"╔"],[0,"╕"],[0,"╖"],[0,"╗"],[0,"╘"],[0,"╙"],[0,"╚"],[0,"╛"],[0,"╜"],[0,"╝"],[0,"╞"],[0,"╟"],[0,"╠"],[0,"╡"],[0,"╢"],[0,"╣"],[0,"╤"],[0,"╥"],[0,"╦"],[0,"╧"],[0,"╨"],[0,"╩"],[0,"╪"],[0,"╫"],[0,"╬"],[19,"▀"],[3,"▄"],[3,"█"],[8,"░"],[0,"▒"],[0,"▓"],[13,"□"],[8,"▪"],[0,"▫"],[1,"▭"],[0,"▮"],[2,"▱"],[1,"△"],[0,"▴"],[0,"▵"],[2,"▸"],[0,"▹"],[3,"▽"],[0,"▾"],[0,"▿"],[2,"◂"],[0,"◃"],[6,"◊"],[0,"○"],[32,"◬"],[2,"◯"],[8,"◸"],[0,"◹"],[0,"◺"],[0,"◻"],[0,"◼"],[8,"★"],[0,"☆"],[7,"☎"],[49,"♀"],[1,"♂"],[29,"♠"],[2,"♣"],[1,"♥"],[0,"♦"],[3,"♪"],[2,"♭"],[0,"♮"],[0,"♯"],[163,"✓"],[3,"✗"],[8,"✠"],[21,"✶"],[33,"❘"],[25,"❲"],[0,"❳"],[84,"⟈"],[0,"⟉"],[28,"⟦"],[0,"⟧"],[0,"⟨"],[0,"⟩"],[0,"⟪"],[0,"⟫"],[0,"⟬"],[0,"⟭"],[7,"⟵"],[0,"⟶"],[0,"⟷"],[0,"⟸"],[0,"⟹"],[0,"⟺"],[1,"⟼"],[2,"⟿"],[258,"⤂"],[0,"⤃"],[0,"⤄"],[0,"⤅"],[6,"⤌"],[0,"⤍"],[0,"⤎"],[0,"⤏"],[0,"⤐"],[0,"⤑"],[0,"⤒"],[0,"⤓"],[2,"⤖"],[2,"⤙"],[0,"⤚"],[0,"⤛"],[0,"⤜"],[0,"⤝"],[0,"⤞"],[0,"⤟"],[0,"⤠"],[2,"⤣"],[0,"⤤"],[0,"⤥"],[0,"⤦"],[0,"⤧"],[0,"⤨"],[0,"⤩"],[0,"⤪"],[8,{v:"⤳",n:824,o:"⤳̸"}],[1,"⤵"],[0,"⤶"],[0,"⤷"],[0,"⤸"],[0,"⤹"],[2,"⤼"],[0,"⤽"],[7,"⥅"],[2,"⥈"],[0,"⥉"],[0,"⥊"],[0,"⥋"],[2,"⥎"],[0,"⥏"],[0,"⥐"],[0,"⥑"],[0,"⥒"],[0,"⥓"],[0,"⥔"],[0,"⥕"],[0,"⥖"],[0,"⥗"],[0,"⥘"],[0,"⥙"],[0,"⥚"],[0,"⥛"],[0,"⥜"],[0,"⥝"],[0,"⥞"],[0,"⥟"],[0,"⥠"],[0,"⥡"],[0,"⥢"],[0,"⥣"],[0,"⥤"],[0,"⥥"],[0,"⥦"],[0,"⥧"],[0,"⥨"],[0,"⥩"],[0,"⥪"],[0,"⥫"],[0,"⥬"],[0,"⥭"],[0,"⥮"],[0,"⥯"],[0,"⥰"],[0,"⥱"],[0,"⥲"],[0,"⥳"],[0,"⥴"],[0,"⥵"],[0,"⥶"],[1,"⥸"],[0,"⥹"],[1,"⥻"],[0,"⥼"],[0,"⥽"],[0,"⥾"],[0,"⥿"],[5,"⦅"],[0,"⦆"],[4,"⦋"],[0,"⦌"],[0,"⦍"],[0,"⦎"],[0,"⦏"],[0,"⦐"],[0,"⦑"],[0,"⦒"],[0,"⦓"],[0,"⦔"],[0,"⦕"],[0,"⦖"],[3,"⦚"],[1,"⦜"],[0,"⦝"],[6,"⦤"],[0,"⦥"],[0,"⦦"],[0,"⦧"],[0,"⦨"],[0,"⦩"],[0,"⦪"],[0,"⦫"],[0,"⦬"],[0,"⦭"],[0,"⦮"],[0,"⦯"],[0,"⦰"],[0,"⦱"],[0,"⦲"],[0,"⦳"],[0,"⦴"],[0,"⦵"],[0,"⦶"],[0,"⦷"],[1,"⦹"],[1,"⦻"],[0,"⦼"],[1,"⦾"],[0,"⦿"],[0,"⧀"],[0,"⧁"],[0,"⧂"],[0,"⧃"],[0,"⧄"],[0,"⧅"],[3,"⧉"],[3,"⧍"],[0,"⧎"],[0,{v:"⧏",n:824,o:"⧏̸"}],[0,{v:"⧐",n:824,o:"⧐̸"}],[11,"⧜"],[0,"⧝"],[0,"⧞"],[4,"⧣"],[0,"⧤"],[0,"⧥"],[5,"⧫"],[8,"⧴"],[1,"⧶"],[9,"⨀"],[0,"⨁"],[0,"⨂"],[1,"⨄"],[1,"⨆"],[5,"⨌"],[0,"⨍"],[2,"⨐"],[0,"⨑"],[0,"⨒"],[0,"⨓"],[0,"⨔"],[0,"⨕"],[0,"⨖"],[0,"⨗"],[10,"⨢"],[0,"⨣"],[0,"⨤"],[0,"⨥"],[0,"⨦"],[0,"⨧"],[1,"⨩"],[0,"⨪"],[2,"⨭"],[0,"⨮"],[0,"⨯"],[0,"⨰"],[0,"⨱"],[1,"⨳"],[0,"⨴"],[0,"⨵"],[0,"⨶"],[0,"⨷"],[0,"⨸"],[0,"⨹"],[0,"⨺"],[0,"⨻"],[0,"⨼"],[2,"⨿"],[0,"⩀"],[1,"⩂"],[0,"⩃"],[0,"⩄"],[0,"⩅"],[0,"⩆"],[0,"⩇"],[0,"⩈"],[0,"⩉"],[0,"⩊"],[0,"⩋"],[0,"⩌"],[0,"⩍"],[2,"⩐"],[2,"⩓"],[0,"⩔"],[0,"⩕"],[0,"⩖"],[0,"⩗"],[0,"⩘"],[1,"⩚"],[0,"⩛"],[0,"⩜"],[0,"⩝"],[1,"⩟"],[6,"⩦"],[3,"⩪"],[2,{v:"⩭",n:824,o:"⩭̸"}],[0,"⩮"],[0,"⩯"],[0,{v:"⩰",n:824,o:"⩰̸"}],[0,"⩱"],[0,"⩲"],[0,"⩳"],[0,"⩴"],[0,"⩵"],[1,"⩷"],[0,"⩸"],[0,"⩹"],[0,"⩺"],[0,"⩻"],[0,"⩼"],[0,{v:"⩽",n:824,o:"⩽̸"}],[0,{v:"⩾",n:824,o:"⩾̸"}],[0,"⩿"],[0,"⪀"],[0,"⪁"],[0,"⪂"],[0,"⪃"],[0,"⪄"],[0,"⪅"],[0,"⪆"],[0,"⪇"],[0,"⪈"],[0,"⪉"],[0,"⪊"],[0,"⪋"],[0,"⪌"],[0,"⪍"],[0,"⪎"],[0,"⪏"],[0,"⪐"],[0,"⪑"],[0,"⪒"],[0,"⪓"],[0,"⪔"],[0,"⪕"],[0,"⪖"],[0,"⪗"],[0,"⪘"],[0,"⪙"],[0,"⪚"],[2,"⪝"],[0,"⪞"],[0,"⪟"],[0,"⪠"],[0,{v:"⪡",n:824,o:"⪡̸"}],[0,{v:"⪢",n:824,o:"⪢̸"}],[1,"⪤"],[0,"⪥"],[0,"⪦"],[0,"⪧"],[0,"⪨"],[0,"⪩"],[0,"⪪"],[0,"⪫"],[0,{v:"⪬",n:65024,o:"⪬︀"}],[0,{v:"⪭",n:65024,o:"⪭︀"}],[0,"⪮"],[0,{v:"⪯",n:824,o:"⪯̸"}],[0,{v:"⪰",n:824,o:"⪰̸"}],[2,"⪳"],[0,"⪴"],[0,"⪵"],[0,"⪶"],[0,"⪷"],[0,"⪸"],[0,"⪹"],[0,"⪺"],[0,"⪻"],[0,"⪼"],[0,"⪽"],[0,"⪾"],[0,"⪿"],[0,"⫀"],[0,"⫁"],[0,"⫂"],[0,"⫃"],[0,"⫄"],[0,{v:"⫅",n:824,o:"⫅̸"}],[0,{v:"⫆",n:824,o:"⫆̸"}],[0,"⫇"],[0,"⫈"],[2,{v:"⫋",n:65024,o:"⫋︀"}],[0,{v:"⫌",n:65024,o:"⫌︀"}],[2,"⫏"],[0,"⫐"],[0,"⫑"],[0,"⫒"],[0,"⫓"],[0,"⫔"],[0,"⫕"],[0,"⫖"],[0,"⫗"],[0,"⫘"],[0,"⫙"],[0,"⫚"],[0,"⫛"],[8,"⫤"],[1,"⫦"],[0,"⫧"],[0,"⫨"],[0,"⫩"],[1,"⫫"],[0,"⫬"],[0,"⫭"],[0,"⫮"],[0,"⫯"],[0,"⫰"],[0,"⫱"],[0,"⫲"],[0,"⫳"],[9,{v:"⫽",n:8421,o:"⫽⃥"}],[44343,{n:new Map($i([[56476,"𝒜"],[1,"𝒞"],[0,"𝒟"],[2,"𝒢"],[2,"𝒥"],[0,"𝒦"],[2,"𝒩"],[0,"𝒪"],[0,"𝒫"],[0,"𝒬"],[1,"𝒮"],[0,"𝒯"],[0,"𝒰"],[0,"𝒱"],[0,"𝒲"],[0,"𝒳"],[0,"𝒴"],[0,"𝒵"],[0,"𝒶"],[0,"𝒷"],[0,"𝒸"],[0,"𝒹"],[1,"𝒻"],[1,"𝒽"],[0,"𝒾"],[0,"𝒿"],[0,"𝓀"],[0,"𝓁"],[0,"𝓂"],[0,"𝓃"],[1,"𝓅"],[0,"𝓆"],[0,"𝓇"],[0,"𝓈"],[0,"𝓉"],[0,"𝓊"],[0,"𝓋"],[0,"𝓌"],[0,"𝓍"],[0,"𝓎"],[0,"𝓏"],[52,"𝔄"],[0,"𝔅"],[1,"𝔇"],[0,"𝔈"],[0,"𝔉"],[0,"𝔊"],[2,"𝔍"],[0,"𝔎"],[0,"𝔏"],[0,"𝔐"],[0,"𝔑"],[0,"𝔒"],[0,"𝔓"],[0,"𝔔"],[1,"𝔖"],[0,"𝔗"],[0,"𝔘"],[0,"𝔙"],[0,"𝔚"],[0,"𝔛"],[0,"𝔜"],[1,"𝔞"],[0,"𝔟"],[0,"𝔠"],[0,"𝔡"],[0,"𝔢"],[0,"𝔣"],[0,"𝔤"],[0,"𝔥"],[0,"𝔦"],[0,"𝔧"],[0,"𝔨"],[0,"𝔩"],[0,"𝔪"],[0,"𝔫"],[0,"𝔬"],[0,"𝔭"],[0,"𝔮"],[0,"𝔯"],[0,"𝔰"],[0,"𝔱"],[0,"𝔲"],[0,"𝔳"],[0,"𝔴"],[0,"𝔵"],[0,"𝔶"],[0,"𝔷"],[0,"𝔸"],[0,"𝔹"],[1,"𝔻"],[0,"𝔼"],[0,"𝔽"],[0,"𝔾"],[1,"𝕀"],[0,"𝕁"],[0,"𝕂"],[0,"𝕃"],[0,"𝕄"],[1,"𝕆"],[3,"𝕊"],[0,"𝕋"],[0,"𝕌"],[0,"𝕍"],[0,"𝕎"],[0,"𝕏"],[0,"𝕐"],[1,"𝕒"],[0,"𝕓"],[0,"𝕔"],[0,"𝕕"],[0,"𝕖"],[0,"𝕗"],[0,"𝕘"],[0,"𝕙"],[0,"𝕚"],[0,"𝕛"],[0,"𝕜"],[0,"𝕝"],[0,"𝕞"],[0,"𝕟"],[0,"𝕠"],[0,"𝕡"],[0,"𝕢"],[0,"𝕣"],[0,"𝕤"],[0,"𝕥"],[0,"𝕦"],[0,"𝕧"],[0,"𝕨"],[0,"𝕩"],[0,"𝕪"],[0,"𝕫"]]))}],[8906,"ff"],[0,"fi"],[0,"fl"],[0,"ffi"],[0,"ffl"]]));const ui=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]);function di(t,e){return function(i){let s,r=0,n="";for(;s=t.exec(i);)r!==s.index&&(n+=i.substring(r,s.index)),n+=e.get(s[0].charCodeAt(0)),r=s.index+1;return n+i.substring(r)}}var gi,fi,pi;String.prototype.codePointAt,di(/[&<>'"]/g,ui),di(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),di(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]])),function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"}(gi||(gi={})),function(t){t[t.UTF8=0]="UTF8",t[t.ASCII=1]="ASCII",t[t.Extensive=2]="Extensive",t[t.Attribute=3]="Attribute",t[t.Text=4]="Text"}(fi||(fi={})),new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map((t=>[t.toLowerCase(),t]))),new Map(["definitionURL","attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map((t=>[t.toLowerCase(),t]))),new Set(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]),new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),new Set(["svg","math"]),function(t){t[t.DISCONNECTED=1]="DISCONNECTED",t[t.PRECEDING=2]="PRECEDING",t[t.FOLLOWING=4]="FOLLOWING",t[t.CONTAINS=8]="CONTAINS",t[t.CONTAINED_BY=16]="CONTAINED_BY"}(pi||(pi={}));class mi{constructor(){this._$textWidth=-1,this._$textHeight=-1,this._$widthTable=[],this._$heightTable=[],this._$ascentTable=[],this._$textTable=[],this._$lineTable=[]}get textWidth(){if(-1===this._$textWidth){this._$textWidth=0;for(let t=0;t<this._$widthTable.length;++t)this._$textWidth=Math.max(this._$textWidth,this._$widthTable[t])}return this._$textWidth}get textHeight(){if(-1===this._$textHeight){this._$textHeight=0;for(let t=0;t<this._$heightTable.length;++t)this._$textHeight+=this._$heightTable[t],t&&(this._$textHeight+=1)}return this._$textHeight}getLineWidth(t){return t in this._$widthTable?this._$widthTable[t]:0}getLineHeight(t){return t in this._$heightTable?this._$heightTable[t]:0}get widthTable(){return this._$widthTable}get heightTable(){return this._$heightTable}get ascentTable(){return this._$ascentTable}get textTable(){return this._$textTable}get lineTable(){return this._$lineTable}}const xi=new OffscreenCanvas(1,1).getContext("2d");let bi=0;const vi=(t,e,i,s)=>{let r=i.lineTable.length-1;const n=s.width-e._$widthMargin()-4;for(let a=0;a<t.length;++a){const h=t[a],o={mode:"text",text:h,x:0,y:0,w:0,h:0,line:r,textFormat:e._$clone()},l=s.multiline&&"\n"===h||"\r"===h||"\n\r"===h;xi.font=e._$generateFontStyle();const c=xi.measureText(h||"");let _=c.width;e.letterSpacing&&(_+=e.letterSpacing);let $=c.fontBoundingBoxAscent+c.fontBoundingBoxDescent;if(e.leading&&($+=e.leading),o.x=c.actualBoundingBoxLeft,o.y=c.actualBoundingBoxAscent,o.w=_,o.h=$,bi+=_,l||s.wordWrap&&bi>n){bi=_,r++,o.line=r;const t={mode:l?"break":"wrap",text:"",x:0,y:0,w:0,h:0,line:r,textFormat:e._$clone()};i.widthTable[r]=0,i.heightTable[r]=0,i.ascentTable[r]=0,i.textTable.push(t),i.lineTable.push(t)}l||(i.widthTable[r]=bi,i.heightTable[r]=Math.max(i.heightTable[r],$),i.ascentTable[r]=Math.max(i.ascentTable[r],o.y),i.textTable.push(o))}},Ti=(t,e,i)=>{for(let s=0;s<t.length;++s){const r=t[s];switch(r.name){case"align":e.align=r.value;break;case"face":e.font=r.value;break;case"size":e.size=+r.value,i.subFontSize&&(e.size-=i.subFontSize,1>e.size&&(e.size=1));break;case"color":e.color=pt(r.value);break;case"letterSpacing":e.letterSpacing=+r.value;break;case"leading":e.leading=+r.value;break;case"leftMargin":e.leftMargin=+r.value;break;case"rightMargin":e.rightMargin=+r.value}}},yi=(t,e)=>{bi=0;const i=t.lineTable.length;xi.font=e._$generateFontStyle();const s=xi.measureText(""),r={mode:"break",text:"",x:0,y:0,w:0,h:s.fontBoundingBoxAscent+s.fontBoundingBoxDescent,line:i,textFormat:e._$clone()};t.heightTable[i]=0,t.ascentTable[i]=0,t.widthTable[i]=0,t.lineTable.push(r),t.textTable.push(r)},Ei=(t,e,i,s)=>{for(let r=0;r<t.children.length;++r){const n=t.children[r];if(3===n.nodeType){vi(n.nodeValue||"",e,i,s);continue}const a=e._$clone();switch(n.name.toUpperCase()){case"DIV":case"P":Ti(n.attributes,a,s),s.multiline&&yi(i,a),Ei(n,a,i,s),s.multiline&&yi(i,a);continue;case"U":a.underline=!0;break;case"B":a.bold=!0;break;case"I":a.italic=!0;break;case"FONT":case"SPAN":Ti(n.attributes,a,s);break;case"BR":if(!s.multiline)continue;yi(i,a)}Ei(n,a,i,s)}},Ai=t=>{const e=t.heightTable.length-1;for(let i=1;i<e;++i){if(t.heightTable[i]>0)continue;const e=t.lineTable[i];t.heightTable[i]=e.h=t.heightTable[i-1]}};class Mi extends Jt{constructor(){super(),this._$background=!1,this._$backgroundColor=16777215,this._$border=!1,this._$borderColor=0,this._$htmlText="",this._$multiline=!1,this._$text="",this._$wordWrap=!1,this._$scrollX=0,this._$scrollY=0,this._$maxChars=0;const t=new me;t._$setDefault(),this._$defaultTextFormat=t,this._$rawHtmlText="",this._$bounds={xMin:0,xMax:100,yMin:0,yMax:100},this._$originBounds={xMin:0,xMax:100,yMin:0,yMax:100},this._$restrict="",this._$isHTML=!1,this._$textData=null,this._$textarea=null,this._$autoSize="none",this._$autoFontSize=!1,this._$textAreaActive=!1,this._$scrollEnabled=!0,this._$xScrollShape=null,this._$yScrollShape=null,this._$type="static",this._$focus=!1,this._$isComposing=!1,this._$thickness=0,this._$thicknessColor=0,this._$verticalAlign="bottom",this._$cacheKeys=nt(),this._$cacheParams=nt(0,0,0)}static toString(){return"[class TextField]"}static get namespace(){return"next2d.display.TextField"}toString(){return"[object TextField]"}get namespace(){return"next2d.display.TextField"}get autoFontSize(){return this._$autoFontSize}set autoFontSize(t){t!==this._$autoFontSize&&(this._$autoFontSize=t,this._$reload())}get autoSize(){return this._$autoSize}set autoSize(t){t!==this._$autoSize&&(this._$autoSize=t,this._$reload())}get background(){return this._$background}set background(t){t!==this._$background&&(this._$background=!!t,this._$reset())}get backgroundColor(){return this._$backgroundColor}set backgroundColor(t){(t=$t(pt(t),0,16777215,16777215))!==this._$backgroundColor&&(this._$backgroundColor=t,this._$reset())}get border(){return this._$border}set border(t){t!==this._$border&&(this._$border=!!t,this._$reset())}get borderColor(){return this._$borderColor}set borderColor(t){(t=$t(pt(t),0,16777215,0))!==this._$borderColor&&(this._$borderColor=t,this._$reset())}get defaultTextFormat(){return this._$defaultTextFormat._$clone()}set defaultTextFormat(t){t._$merge(this._$defaultTextFormat),this._$defaultTextFormat=t,this._$reset()}get focus(){return this._$focus}set focus(t){if(this._$focus!==t&&"input"===this._$type)if(this._$focus=t,this._$focus){const t=ar(),e=u.getElementById(t.contentElementId);if(!e)return;this._$createTextAreaElement(t._$scale);const i=this._$textarea;if(!i)return;const s=this._$transform.concatenatedMatrix,r=this._$getBounds(null),n=Tt(pt(this._$defaultTextFormat.color),100);i.style.color=`rgb(${n.R},${n.G},${n.B})`,i.style.left=(s.tx+r.xMin+t.x/t._$scale/f)*t._$scale+"px",i.style.top=(s.ty+r.yMin+t.y/t._$scale/f)*t._$scale+"px",i.style.width=`${v.ceil(this.width*t._$scale)}px`,i.style.height=`${v.ceil(this.height*t._$scale)}px`,i.value=this.text,e.appendChild(i),F((()=>{i.focus()})),this._$doChanged(),x(),this._$textAreaActive=!0,this.willTrigger(Ft.FOCUS_IN)&&this.dispatchEvent(new Ft(Ft.FOCUS_IN))}else this._$textarea&&(this._$textarea.dispatchEvent(new Event(`${Es}_blur`)),this.willTrigger(Ft.FOCUS_OUT)&&this.dispatchEvent(new Ft(Ft.FOCUS_OUT)),this._$textarea.remove())}get htmlText(){return this._$htmlText}set htmlText(t){this._$htmlText!==t&&(this._$htmlText=`${t}`,this._$rawHtmlText="",this._$text="",this._$isHTML=!0,this._$reload())}get length(){return this.text.length}get maxChars(){return this._$maxChars}set maxChars(t){this._$maxChars=0|t}get multiline(){return this._$multiline}set multiline(t){t!==this._$multiline&&(this._$multiline=!!t,this._$reset())}get numLines(){return this.getTextData().lineTable.length}get restrict(){return this._$restrict}set restrict(t){this._$restrict=`${t}`}get scrollEnabled(){return this._$scrollEnabled}set scrollEnabled(t){this._$scrollEnabled=t}get scrollX(){return this._$scrollX}set scrollX(t){if(this._$scrollEnabled&&"none"===this._$autoSize&&!(this._$yScrollShape&&this._$yScrollShape.hasLocalVariable("job")||(t=$t(t,0,this.width,0),this._$scrollX===t))){const e=this.width;if(this._$xScrollShape&&this.textWidth>e){this._$doChanged(),this._$scrollX=t,this._$xScrollShape.width=e*e/this.textWidth;const i=this._$parent;if(i){pe.add(this._$xScrollShape,{alpha:0},{alpha:.8},0,.3,ge.outQuad),this._$xScrollShape.x=this.x+1+(e-1-this._$xScrollShape.width)/(e-1)*(this._$scrollX-1),this._$xScrollShape.y=this.y+this.height-this._$xScrollShape.height-.5,i.addChildAt(this._$xScrollShape,i.getChildIndex(this)+1),this._$xScrollShape.hasLocalVariable("job")&&this._$xScrollShape.getLocalVariable("job").stop();const t=pe.add(this._$xScrollShape,{alpha:.8},{alpha:0},.2,.6,ge.outQuad);t.addEventListener(wt.COMPLETE,(t=>{const e=t.target.target;e.deleteLocalVariable("job"),e.parent&&e.parent.removeChild(e)})),t.start(),this._$xScrollShape.setLocalVariable("job",t)}}this.willTrigger(wt.SCROLL)&&this.dispatchEvent(new wt(wt.SCROLL,!0))}}get scrollY(){return this._$scrollY}set scrollY(t){if(this._$scrollEnabled&&"none"===this._$autoSize&&(this._$multiline||this._$wordWrap)&&!(this._$xScrollShape&&this._$xScrollShape.hasLocalVariable("job")||(t=$t(t,0,this.height,0),this._$scrollY===t))){const e=this.height;if(this._$yScrollShape&&this.textHeight>e){this._$doChanged(),this._$scrollY=t,this._$yScrollShape.height=e*e/this.textHeight;const i=this._$parent;if(i){pe.add(this._$yScrollShape,{alpha:0},{alpha:.8},0,.3,ge.outQuad),this._$yScrollShape.x=this.x+this.width-this._$yScrollShape.width-.5,this._$yScrollShape.y=this.y+.5+(e-1-this._$yScrollShape.height)/(e-1)*(this._$scrollY-1),i.addChildAt(this._$yScrollShape,i.getChildIndex(this)+1),this._$yScrollShape.hasLocalVariable("job")&&this._$yScrollShape.getLocalVariable("job").stop();const t=pe.add(this._$yScrollShape,{alpha:.8},{alpha:0},.2,.6,ge.outQuad);t.addEventListener(wt.COMPLETE,(t=>{const e=t.target.target;e.deleteLocalVariable("job"),e.parent&&e.parent.removeChild(e)})),t.start(),this._$yScrollShape.setLocalVariable("job",t)}}this.willTrigger(wt.SCROLL)&&this.dispatchEvent(new wt(wt.SCROLL,!0))}}get text(){if(!this._$isHTML)return this._$text;if(this._$rawHtmlText)return this._$rawHtmlText;let t="";const e=this.getTextData();for(let i=1;i<e.textTable.length;++i){const s=e.textTable[i];switch(s.mode){case"text":t+=s.text;break;case"break":t+="\r"}}return this._$rawHtmlText=t,t}set text(t){null===t&&(t=""),(t=`${t}`)!==this._$text&&(this._$text=t,this._$htmlText="",this._$isHTML=!1,this._$reload())}get textColor(){return this._$defaultTextFormat.color||0}set textColor(t){this._$defaultTextFormat.color=t,this._$reload()}get textHeight(){return this.getTextData().textHeight}get textWidth(){return this.getTextData().textWidth}get thickness(){return this._$thickness}set thickness(t){(t|=0)!==this._$thickness&&(this._$thickness=t,this._$reset())}get thicknessColor(){return this._$thicknessColor}set thicknessColor(t){(t=$t(pt(t),0,16777215,0))!==this._$thicknessColor&&(this._$thicknessColor=t,this._$reset())}get type(){return this._$type}set type(t){this._$type=t,"static"===t&&(this._$textarea=null)}get verticalAlign(){return this._$verticalAlign}set verticalAlign(t){t!==this._$verticalAlign&&(this._$verticalAlign=t,this._$reset())}get wordWrap(){return this._$wordWrap}set wordWrap(t){this._$wordWrap!==t&&(this._$wordWrap=!!t,this._$reset())}get width(){return super.width}set width(t){if(!C(t=+t)&&t>-1){const e=this._$getBounds(null),i=v.abs(e.xMin);this._$originBounds.xMax=t+i,this._$originBounds.xMin=i,this._$bounds.xMax=this._$originBounds.xMax,this._$bounds.xMin=this._$originBounds.xMin,super.width=t,this._$reload()}}get height(){return super.height}set height(t){if(!C(t=+t)&&t>-1){const e=this._$getBounds(null),i=v.abs(e.yMin);this._$originBounds.yMax=t+i,this._$bounds.yMax=this._$originBounds.yMax,this._$bounds.yMin=this._$originBounds.yMin,super.height=t,this._$reload()}}get x(){const t=this._$transform.matrix,e=this._$getBounds(null);return t._$matrix[4]+e.xMin}set x(t){const e=this._$getBounds(null);super.x=t-e.xMin}get y(){const t=this._$transform.matrix,e=this._$getBounds(null);return t._$matrix[5]+e.yMin}set y(t){const e=this._$getBounds(null);super.y=t-e.yMin}appendText(t){const e=this.text;this.text=e+`${t}`}getLineText(t){if(!this._$text&&!this._$htmlText)return"";t|=0;let e="";const i=this.getTextData();for(let s=0;s<i.textTable.length;s++){const r=i.textTable[s];if(r.line>t)break;r.line===t&&"text"===r.mode&&(e+=r.text)}return e}replaceText(t,e,i){if(e|=0,(t|=0)>-1&&e>-1&&e>=t){const s=this.text;t>=s.length?e>=s.length&&e>=t&&(this.text=s+`${i}`):this.text=s.slice(0,t)+`${i}`+s.slice(e,s.length)}}getTextData(t=0){return null!==this._$textData||(this._$isHTML?this._$textData=((t,e,i)=>{const s=t.trim().replace(/\r?\n/g,"").replace(/\t/g,""),r=new mi,n=e._$clone();i.subFontSize&&i.subFontSize>0&&n.size&&(n.size-=i.subFontSize,1>n.size&&(n.size=1));const a=function(t,e){const i=new _i(void 0,e);return new Ke(i,e).end(t),i.root}(s);return yi(r,n),Ei(a,n,r,i),Ai(r),r})(this._$htmlText,this._$defaultTextFormat,{width:this.width,multiline:this._$multiline,wordWrap:this._$wordWrap,subFontSize:t}):this._$textData=((t,e,i)=>{const s=i.multiline?t.split("\n"):[t.replace("\n","")],r=new mi,n=e._$clone();i.subFontSize&&i.subFontSize>0&&n.size&&(n.size-=i.subFontSize,1>n.size&&(n.size=1));for(let t=0;t<s.length;++t){(i.wordWrap||i.multiline)&&yi(r,n);const e=s[t];e&&(bi=0,vi(e,n,r,i))}return Ai(r),r})(this._$text,this._$defaultTextFormat,{width:this.width,multiline:this._$multiline,wordWrap:this._$wordWrap,subFontSize:t})),this._$textData}_$reset(){this._$textData=null,this._$doChanged(),x(),At.removeCache(this._$instanceId)}_$reload(){if(this._$reset(),this.getTextData(),"none"===this._$autoSize&&this._$autoFontSize){let t=0;const e=this.getTextData();for(let i=0;i<e.textTable.length;++i){const s=e.textTable[i];t=v.max(t,s.textFormat.size||0)}let i=1;if(this.width&&this.textWidth)for(;t>i&&this.textWidth+4>this.width;)this._$reset(),this.getTextData(i++);if(this.height&&this.textHeight)for(;t>i&&this.textHeight+4>this.height;)this._$reset(),this.getTextData(i++)}this._$resize()}_$resize(){if("none"!==this._$autoSize){const t=this._$defaultTextFormat,e=this.textWidth+4+t._$widthMargin();if(this._$wordWrap)this._$bounds.xMax=this._$originBounds.xMax,this._$bounds.xMin=this._$originBounds.xMin;else switch(this._$autoSize){case"left":case"center":this._$bounds.xMax=e+this._$bounds.xMin;break;case"right":this._$bounds.xMax=this._$originBounds.xMax-(this._$originBounds.xMax-this._$originBounds.xMin-(e-this._$originBounds.xMin))}this._$bounds.yMax=this.textHeight+this._$originBounds.yMin}else this._$scrollEnabled&&(this._$xScrollShape||(this._$xScrollShape=new ue,this._$xScrollShape.graphics.beginFill("#000",.3).drawRoundRect(0,0,3,3,3),this._$xScrollShape.scale9Grid=new Dt(1.5,1.5,.1,.1)),this._$yScrollShape||(this._$yScrollShape=new ue,this._$yScrollShape.graphics.beginFill("#000",.3).drawRoundRect(0,0,3,3,3),this._$yScrollShape.scale9Grid=new Dt(1.5,1.5,.1,.1)))}_$getAlignOffset(t,e){const i=this.getTextData().getLineWidth(t.line),s=t.textFormat,r=s.leftMargin||0;if(!this._$wordWrap&&i>e)return v.max(0,r);const n=s.rightMargin||0;return"center"===s.align||"center"===this._$autoSize?v.max(0,e/2-r-n-i/2-2):"right"===s.align||"right"===this._$autoSize?v.max(0,e-r-i-n-4):v.max(0,r)}_$getBounds(t=null){if(t){let e=t;const i=this._$transform._$rawMatrix();return 1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]&&0===i[4]&&0===i[5]||(e=ut(t,i)),gt(this._$bounds,e)}return K(this._$bounds.xMin,this._$bounds.xMax,this._$bounds.yMin,this._$bounds.yMax)}_$buildCharacter(t){const e=this._$defaultTextFormat;switch(e.font=t.font,e.size=0|t.size,e.align=t.align,e.color=0|t.color,e.leading=t.leading,e.letterSpacing=t.letterSpacing,e.leftMargin=t.leftMargin,e.rightMargin=t.rightMargin,t.fontType){case 1:e.bold=!0;break;case 2:e.italic=!0;break;case 3:e.bold=!0,e.italic=!0}switch(this._$type=t.inputType,this._$multiline=!!t.multiline,this._$wordWrap=!!t.wordWrap,this._$border=!!t.border,this._$scrollEnabled=!!t.scroll,this._$thickness=0|t.thickness,this._$thicknessColor=0|t.thicknessColor,this._$bounds.xMin=t.originBounds.xMin,this._$bounds.xMax=t.originBounds.xMax,this._$bounds.yMin=t.originBounds.yMin,this._$bounds.yMax=t.originBounds.yMax,this._$originBounds.xMin=t.originBounds.xMin,this._$originBounds.xMax=t.originBounds.xMax,this._$originBounds.yMin=t.originBounds.yMin,this._$originBounds.yMax=t.originBounds.yMax,t.autoSize){case 1:this.autoSize=t.align;break;case 2:this.autoFontSize=!0}this.text=t.text,Tr&&this._$stage&&this._$createWorkerInstance()}_$sync(t){this._$buildCharacter(t)}_$build(t,e){const i=this._$baseBuild(t,e);return this._$buildCharacter(i),i}_$clip(t,e){const i=this._$getBounds(),s=i.xMax,r=i.xMin,n=i.yMax,a=i.yMin;Q(i);const h=v.ceil(v.abs(s-r)),o=v.ceil(v.abs(n-a));if(!h||!o)return;let l=e;const c=this._$transform._$rawMatrix();1===c[0]&&0===c[1]&&0===c[2]&&1===c[3]&&0===c[4]&&0===c[5]||(l=ut(e,c)),t.reset(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(h,0),t.lineTo(h,o),t.lineTo(0,o),t.lineTo(0,0),t.clip(),l!==e&&et(l)}_$draw(t,e,i){if(!this._$visible||this._$textAreaActive)return;if(!this._$background&&!this._$border&&!this.text)return;let s=i;const r=this._$transform._$rawColorTransform();1===r[0]&&1===r[1]&&1===r[2]&&1===r[3]&&0===r[4]&&0===r[5]&&0===r[6]&&0===r[7]||(s=dt(i,r));const n=$t(s[3]+s[7]/255,0,1);if(!n)return;let a=e;const h=this._$transform._$rawMatrix();1===h[0]&&0===h[1]&&0===h[2]&&1===h[3]&&0===h[4]&&0===h[5]||(a=ut(e,h));const o=this._$getBounds(null);o.xMin-=this._$thickness,o.xMax+=this._$thickness,o.yMin-=this._$thickness,o.yMax+=this._$thickness;const l=gt(o,a),c=+l.xMax,_=+l.xMin,$=+l.yMax,u=+l.yMin;Q(l);const d=v.ceil(v.abs(c-_)),g=v.ceil(v.abs($-u));switch(!0){case 0===d:case 0===g:case d===-1/0:case g===-1/0:case d===b:case g===b:return}let f=+v.sqrt(a[0]*a[0]+a[1]*a[1]);if(!E.isInteger(f)){const t=f.toString(),e=t.indexOf("e");-1!==e&&(f=+t.slice(0,e)),f=+f.toFixed(4)}let p=+v.sqrt(a[2]*a[2]+a[3]*a[3]);if(!E.isInteger(p)){const t=p.toString(),e=t.indexOf("e");-1!==e&&(p=+t.slice(0,e)),p=+p.toFixed(4)}const m=this._$filters||this.filters,x=null!==m&&m.length>0&&this._$canApply(m);let T=K(0,d,0,g);if(x&&m)for(let t=0;t<m.length;++t)T=m[t]._$generateFilterRect(T,f,p);const y=t.frameBuffer,A=y.currentAttachment;if(!A||_-T.xMin>A.width||u-T.yMin>A.height)return void Q(T);if(0>_+T.xMax||0>u+T.yMax)return void Q(T);if(Q(T),this._$isUpdated()&&(At.removeCache(this._$instanceId),t.cachePosition=null,this._$cacheKeys.length=0),!this._$cacheKeys.length||this._$cacheParams[0]!==f||this._$cacheParams[1]!==p||this._$cacheParams[2]!==i[7]){const t=nt(f,p);this._$cacheKeys=At.generateKeys(this._$instanceId,t),at(t),this._$cacheParams[0]=f,this._$cacheParams[1]=p,this._$cacheParams[2]=i[7]}const M=this._$blendMode||this.blendMode;if(t.cachePosition=At.get(this._$cacheKeys),!t.cachePosition){const e=v.min(1,v.max(f,p)),i=v.ceil(v.abs(o.xMax-o.xMin)*f),r=v.ceil(v.abs(o.yMax-o.yMin)*p),n=At.getCanvas();n.width=i+2*e,n.height=r+2*e;const a=n.getContext("2d");if(!a)throw new Error("the context is null.");if(this._$background||this._$border){if(a.beginPath(),a.moveTo(0,0),a.lineTo(i,0),a.lineTo(i,r),a.lineTo(0,r),a.lineTo(0,0),this._$background){const t=Tt(this._$backgroundColor),e=v.max(0,v.min(255*t.A+s[7],255))/255;a.fillStyle=`rgba(${t.R},${t.G},${t.B},${e})`,a.fill()}if(this._$border){const t=Tt(this._$borderColor),i=v.max(0,v.min(255*t.A+s[7],255))/255;a.lineWidth=e,a.strokeStyle=`rgba(${t.R},${t.G},${t.B},${i})`,a.stroke()}}a.save(),a.beginPath(),a.moveTo(2,2),a.lineTo(i-2,2),a.lineTo(i-2,r-2),a.lineTo(2,r-2),a.lineTo(2,2),a.clip();let h=2;if(this._$scrollY>0){const t=(this.textHeight-this.height)/this.height;h+=-this._$scrollY*t}let l=2;if(this._$scrollX>0){const t=(this.textWidth-this.width)/this.width;l+=-this._$scrollX*t}a.setTransform(f,0,0,p,l*f,h*p),a.beginPath(),this._$doDraw(a,s,i/f,e),a.restore();const c=y.createCachePosition(i,r),_=y.createTextureFromCanvas(a.canvas);t.drawTextureFromRect(_,c),t.cachePosition=c,At.set(this._$cacheKeys,c),At.destroy(a)}let S=!1,w=0,C=0;if(m&&m.length&&this._$canApply(m)){S=!0;const e=this._$drawFilter(t,a,m,d,g);e.offsetX&&(w=e.offsetX),e.offsetY&&(C=e.offsetY),t.cachePosition=e}const F=v.atan2(a[1],a[0]),R=v.atan2(-a[2],a[3]);if(S||!F&&!R)t.setTransform(1,0,0,1,_-w,u-C);else{const e=o.xMin*f,i=o.yMin*p,s=v.cos(F),r=v.sin(F),n=v.cos(R),h=v.sin(R);t.setTransform(s,r,-h,n,e*s-i*h+a[4],e*r+i*n+a[5])}t.cachePosition&&(t.globalAlpha=n,t.imageSmoothingEnabled=!0,t.globalCompositeOperation=M,t.drawInstance(_-w,u-C,c,$,i),t.cachePosition=null),Q(o),a!==e&&et(a),s!==i&&st(s)}_$doDraw(t,e,i,s){const r=this.getTextData(),n=this.width;let a=0;if(this._$scrollX>0){const t=(this.textWidth-n)/n;a=this._$scrollX*t}const h=n+a,o=this.height;let l=0;if(this._$scrollY>0){const t=(this.textHeight-o)/o;l=this._$scrollY*t}const c=o+l;let _=0,$=0,u=0,d=0,g=!1;for(let n=0;n<r.textTable.length;++n){const o=r.textTable[n];if(g&&"text"===o.mode)continue;const f=o.textFormat;if("none"===this._$autoSize){if($>c)break;if("text"===o.mode&&(a>_+o.w||_>h)){_+=o.w;continue}}const p=Tt(f.color||0),m=v.max(0,v.min(255*p.A+e[7],255))/255;if(t.fillStyle=`rgba(${p.R},${p.G},${p.B},${m})`,this._$thickness){const i=Tt(this._$thicknessColor),s=v.max(0,v.min(255*i.A+e[7],255))/255;t.lineWidth=this._$thickness,t.strokeStyle=`rgba(${i.R},${i.G},${i.B},${s})`}const x=0|o.line;switch(o.mode){case"break":case"wrap":if(_=0,x&&($+=r.heightTable[x-1]+1),l>$+r.heightTable[x]){g=!0;continue}d=r.ascentTable[x],u=this._$getAlignOffset(o,i),g=!1;break;case"text":{t.beginPath(),t.font=yt(f.font||"",f.size||0,!!f.italic,!!f.bold);const i=_+u,r=$+d;if(f.underline){const n=Tt(f.color||0),a=v.max(0,v.min(255*n.A+e[7],255))/255;t.lineWidth=s,t.strokeStyle=`rgba(${n.R},${n.G},${n.B},${a})`,t.beginPath(),t.moveTo(i,r+1),t.lineTo(i+o.w,r+1),t.stroke()}this._$thickness&&t.strokeText(o.text,i,r),t.fillText(o.text,i,r),_+=o.w}}}}_$mouseHit(t,e,i){return!!this._$visible&&this._$hit(t,e,i)}_$hit(t,e,i){let s=e;const r=this._$transform._$rawMatrix();1===r[0]&&0===r[1]&&0===r[2]&&1===r[3]&&0===r[4]&&0===r[5]||(s=ut(e,r));const n=this._$getBounds(null),a=gt(n,s),h=+a.xMax,o=+a.xMin,l=+a.yMax,c=+a.yMin;Q(a),Q(n);const _=v.ceil(v.abs(h-o)),$=v.ceil(v.abs(l-c));return t.setTransform(1,0,0,1,o,c),t.beginPath(),t.moveTo(0,0),t.lineTo(_,0),t.lineTo(_,$),t.lineTo(0,$),t.lineTo(0,0),s!==e&&et(s),t.isPointInPath(i.x,i.y)}_$createTextAreaElement(t){if(!this._$textarea){this._$textarea=u.createElement("textarea"),this._$textarea.value=this.text,this._$textarea.id=`${Es}_TextField_${this._$instanceId}`,this._$wordWrap||(this._$textarea.wrap="off");const t=this._$defaultTextFormat;let e="";e+="position: absolute;",e+="outline: 0;",e+=`padding: 2px 2px 2px ${v.max(3,t.leftMargin||0)}px;`,e+="margin: 0;",e+="appearance: none;",e+="resize: none;",e+="overflow: hidden;",e+="z-index: 2147483647;",e+="vertical-align: top;",this._$textarea.setAttribute("style",e),this._$textarea.addEventListener(`${Es}_blur`,(t=>{let e=t.target.value;if(e&&this._$restrict){let t=this._$restrict;"["!==t[0]&&(t="["+t),"]"!==t[t.length-1]&&(t+="]");const i=e.match(new d(t,"gm"));e=i?i.join(""):""}const i=ar();if(u.getElementById(i.contentElementId)){const t=u.getElementById(`${Es}_TextField_${this._$instanceId}`);t&&t.remove()}this.text=e,this._$focus=!1,this._$textAreaActive=!1,this._$doChanged(),x()})),this._$textarea.addEventListener("input",(t=>{const e=t.target,i=ar();let s=e.value;if(this._$restrict&&!this._$isComposing&&s){let t=this._$restrict;"["!==t[0]&&(t="["+t),"]"!==t[t.length-1]&&(t+="]");const e=s.match(new d(t,"gm"));s=e?e.join(""):""}if(!this._$isComposing&&this.text!==s){this.text=s,e.value=s,this.willTrigger(wt.CHANGE)&&this.dispatchEvent(new wt(wt.CHANGE,!0));const t=this._$transform.concatenatedMatrix,r=this._$getBounds(null);e.style.left=`${v.floor((t.tx+r.xMin+i.x/i._$scale/f)*i._$scale)}px`,e.style.top=`${v.floor((t.ty+r.yMin+i.y/i._$scale/f)*i._$scale)}px`,e.style.width=`${v.ceil((this.width-1)*i._$scale)}px`,e.style.height=`${v.ceil((this.height-1)*i._$scale)}px`}})),this._$textarea.addEventListener("compositionstart",(()=>{this._$isComposing=!0})),this._$textarea.addEventListener("compositionend",(t=>{this._$isComposing=!1;const e=t.target;let i=e.value;if(!this._$restrict||!i)return;let s=this._$restrict;"["!==s[0]&&(s="["+s),"]"!==s[s.length-1]&&(s+="]");const r=i.match(new d(s,"gm"));i=r?r.join(""):"",this.text=i,e.value=i})),this._$textarea.addEventListener("click",(()=>{this.willTrigger(It.CLICK)&&this.dispatchEvent(new It(It.CLICK))})),this._$textarea.addEventListener(Rs,(t=>{this.scrollY+=t.deltaY})),this._$textarea.addEventListener(Ls,(t=>{const e=t.target;this.scrollY=e.scrollTop})),this._$textarea.addEventListener(As,(()=>{ar()._$state="down"})),this._$textarea.addEventListener(Ss,(()=>{ar()._$state="up"})),this._$textarea.addEventListener(ws,(()=>{ar()._$state="down"})),this._$textarea.addEventListener(Fs,(()=>{ar()._$state="up"}))}const e=this._$defaultTextFormat,i=e.size?v.ceil(e.size*t*this._$transform.concatenatedMatrix.d):0;this._$textarea.style.fontSize=`${i}px`,this._$textarea.style.fontFamily=e.font||"Times New Roman",this._$textarea.style.lineHeight=(i+v.max(0,e.leading||0))/i+"em","none"!==this._$autoSize?this._$textarea.style.textAlign="center":this._$textarea.style.textAlign=e.align||"none",this._$textarea.addEventListener("keydown",(t=>{const e=t.target;let i=e.value;if(this._$restrict&&!this._$isComposing&&i){let t=this._$restrict;"["!==t[0]&&(t="["+t),"]"!==t[t.length-1]&&(t+="]");const e=i.match(new d(t,"gm"));i=e?e.join(""):""}if(this._$isComposing||(this.text=i,e.value=i),"Enter"===t.code&&!this._$multiline)return!1}));const s=this._$textarea.style;this._$border?s.border=`solid 1px #${this.borderColor.toString(16)}`:s.border="none",this._$border||this._$background?s.backgroundColor=`#${this.backgroundColor.toString(16)}`:s.backgroundColor="transparent",this._$textarea.maxLength=this._$maxChars?this._$maxChars:2147483647}_$createWorkerInstance(){if(this._$created||!Tr)return;this._$created=!0;const t=this._$getBounds(),e={command:"createTextField",buffer:new Float32Array,instanceId:this._$instanceId,parentId:this._$parent?this._$parent._$instanceId:-1,xMin:t.xMin,yMin:t.yMin,xMax:t.xMax,yMax:t.yMax,limitWidth:this.width,limitHeight:this.height,textHeight:this.textHeight,verticalAlign:this._$verticalAlign,autoSize:this._$autoSize,wordWrap:this._$wordWrap,border:this._$border,background:this._$background,thickness:this._$thickness};this._$border&&(e.borderColor=this._$borderColor),this._$background&&(e.backgroundColor=this._$backgroundColor),this._$thickness&&(e.thicknessColor=this._$backgroundColor),this._$characterId>-1&&(e.characterId=this._$characterId),this._$loaderInfo&&(e.loaderInfoId=this._$loaderInfo._$id),this._$scale9Grid&&(e.grid={x:this._$scale9Grid.x,y:this._$scale9Grid.y,w:this._$scale9Grid.width,h:this._$scale9Grid.height}),Tr.postMessage(e)}_$postProperty(){if(!Tr)return;const t=this._$createMessage();t.textAreaActive=this._$textAreaActive;const e=this._$getBounds(null);t.xMin=e.xMin,t.yMin=e.yMin,t.xMax=e.xMax,t.yMax=e.yMax,Q(e),this._$isUpdated()&&(t.limitWidth=this.width,t.limitHeight=this.height,t.textHeight=this.textHeight,t.verticalAlign=this._$verticalAlign,t.autoSize=this._$autoSize,t.wordWrap=this._$wordWrap,t.border=this._$border,this._$border&&(t.borderColor=this._$borderColor),t.background=this._$background,this._$background&&(t.backgroundColor=this._$backgroundColor),t.thickness=this._$thickness,this._$thickness&&(t.thicknessColor=this._$backgroundColor)),Tr.postMessage(t),this._$posted=!0,this._$updated=!1}}class Si{constructor(){this._$rgb="rgb",this._$mode="pad",this._$type="linear",this._$focalPointRatio=0,this._$points=tt(),this._$stops=nt()}dispose(){const t=this._$stops;for(let e=0;e<t.length;++e)Z(t[e][1]);et(this._$points)}get mode(){return this._$mode}get type(){return this._$type}get rgb(){return this._$rgb}get points(){return this._$points}get focalPointRatio(){return this._$focalPointRatio}get stops(){return this._$stops.sort(((t,e)=>{switch(!0){case t[0]>e[0]:return 1;case e[0]>t[0]:return-1;default:return 0}})),this._$stops}linear(t,e,i,s,r="rgb",n="pad"){return this._$type="linear",this._$points[0]=t,this._$points[1]=e,this._$points[2]=i,this._$points[3]=s,this._$rgb=r,this._$mode=n,this._$stops.length&&(this._$stops.length=0),this}radial(t,e,i,s,r,n,a="rgb",h="pad",o=0){return this._$type="radial",this._$points[0]=t,this._$points[1]=e,this._$points[2]=i,this._$points[3]=s,this._$points[4]=r,this._$points[5]=n,this._$rgb=a,this._$mode=h,this._$focalPointRatio=$t(o,-.975,.975,0),this._$stops.length&&(this._$stops.length=0),this}addColorStop(t,e){this._$stops.push(nt(t,e))}}class wi{constructor(t,e,i,s){this._$context=t,this._$texture=e,this._$repeat=i,this._$colorTransform=s}get texture(){return this._$texture}get repeat(){return this._$repeat}get colorTransform(){return this._$colorTransform}}class Ci{constructor(){this._$fillStyle=J(1,1,1,1),this._$strokeStyle=J(1,1,1,1),this._$lineWidth=1,this._$lineCap="round",this._$lineJoin="round",this._$miterLimit=5}get miterLimit(){return this._$miterLimit}set miterLimit(t){this._$miterLimit=t}get lineWidth(){return this._$lineWidth}set lineWidth(t){this._$lineWidth=t}get lineCap(){return this._$lineCap}set lineCap(t){this._$lineCap=t}get lineJoin(){return this._$lineJoin}set lineJoin(t){this._$lineJoin=t}get fillStyle(){return this._$fillStyle}set fillStyle(t){this._$fillStyle instanceof A&&Z(this._$fillStyle),this._$fillStyle=t}get strokeStyle(){return this._$strokeStyle}set strokeStyle(t){this._$strokeStyle instanceof A&&Z(this._$strokeStyle),this._$strokeStyle=t}clear(){this._$lineWidth=1,this._$lineCap="round",this._$lineJoin="round",this._$miterLimit=5,this._$clearFill(),this._$clearStroke()}_$clearFill(){if(this._$fillStyle instanceof Si)return this._$fillStyle.dispose(),void(this._$fillStyle=J(1,1,1,1));this._$fillStyle instanceof wi?this._$fillStyle=J(1,1,1,1):this._$fillStyle.fill(1)}_$clearStroke(){if(this._$strokeStyle instanceof Si)return this._$strokeStyle.dispose(),void(this._$strokeStyle=J(1,1,1,1));this._$strokeStyle instanceof wi?this._$strokeStyle=J(1,1,1,1):this._$strokeStyle.fill(1)}}let Fi=2048;class Ri{constructor(t){t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),this._$gl=t,this._$objectPool=[],this._$objectPoolArea=0,this._$activeTexture=-1,this._$boundTextures=[null,null,null],this._$maxWidth=0,this._$maxHeight=0,this._$atlasTextures=[],this._$atlasCacheMap=new Map,this._$positionObjectArray=[],this._$nodeObjectArray=[],this._$atlasNodes=new Map}createTextureAtlas(){const t=this._$gl.createTexture();t.width=Fi,t.height=Fi,this._$gl.activeTexture(this._$gl.TEXTURE3),this._$gl.bindTexture(this._$gl.TEXTURE_2D,t),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_S,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_T,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MIN_FILTER,this._$gl.NEAREST),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MAG_FILTER,this._$gl.NEAREST),this._$gl.texStorage2D(this._$gl.TEXTURE_2D,1,this._$gl.RGBA8,Fi,Fi),this._$gl.bindTexture(this._$gl.TEXTURE_2D,null),this._$activeTexture>-1&&this._$gl.activeTexture(this._$activeTexture);const e=this._$atlasTextures.length;this._$atlasNodes.set(e,[]),this._$atlasCacheMap.set(e,[]),this._$atlasTextures.push(t)}getAtlasTexture(t){return this._$atlasTextures[t]}getNode(t,e,i,s){const r=this._$nodeObjectArray.length?this._$nodeObjectArray.pop():{x:0,y:0,w:0,h:0};return r.x=t,r.y=e,r.w=i,r.h=s,r}createCachePosition(t,e){const i=this._$positionObjectArray.length?this._$positionObjectArray.pop():{index:0,x:0,y:0,w:0,h:0};i.x=i.y=0,i.w=t,i.h=e;for(const[s,r]of this._$atlasNodes){if(!r.length)return t>e?(Fi-t-1>0&&r.push(this.getNode(t+1,0,Fi-t-1,e)),Fi-e-1>0&&r.push(this.getNode(0,e+1,Fi,Fi-e-1))):(Fi-e-1>0&&r.push(this.getNode(0,e+1,t,Fi-e-1)),Fi-t-1>0&&r.push(this.getNode(t+1,0,Fi-t-1,Fi))),i.index=s,this._$atlasCacheMap.get(i.index).push(i),i;const n=r.length;for(let a=0;a<n;++a){const n=r[a];if(!(t>n.w||e>n.h))return i.index=s,i.x=n.x,i.y=n.y,this._$atlasCacheMap.get(i.index).push(i),n.w!==t||n.h!==e?t>e?(n.h-e-1>0&&r.push(this.getNode(n.x,n.y+e+1,n.w,n.h-e-1)),n.w-t-1>0?(n.x=n.x+t+1,n.w=n.w-t-1,n.h=e):(r.splice(a,1),this._$nodeObjectArray.push(n))):(n.w-t-1>0&&r.push(this.getNode(n.x+t+1,n.y,n.w-t-1,n.h)),n.h-e-1>0?(n.y=n.y+e+1,n.w=t,n.h=n.h-e-1):(r.splice(a,1),this._$nodeObjectArray.push(n))):(r.splice(a,1),this._$nodeObjectArray.push(n)),i}}const s=this._$atlasTextures.length;this.createTextureAtlas();const r=this._$atlasNodes.get(s);return t>e?(Fi-t-1>0&&r.push(this.getNode(t+1,0,Fi-t-1,e)),Fi-e-1>0&&r.push(this.getNode(0,e+1,Fi,Fi-e-1))):(Fi-e-1>0&&r.push(this.getNode(0,e+1,t,Fi-e-1)),Fi-t-1>0&&r.push(this.getNode(t+1,0,Fi-t-1,Fi))),i.index=s,this._$atlasCacheMap.get(i.index).push(i),i}releasePosition(t){var e;this._$atlasNodes.has(t.index)&&(null===(e=this._$atlasNodes.get(t.index))||void 0===e||e.unshift(this.getNode(t.x,t.y,t.w,t.h)),this._$positionObjectArray.push(t))}clearCache(){for(const t of this._$atlasCacheMap.values())t.length=0;for(const t of this._$atlasNodes.values())t.length=0}_$createTexture(t,e){const i=this._$gl.createTexture();return i.width=0,i.height=0,i.area=0,i.dirty=!0,i.smoothing=!0,this.bind0(i,!1),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_S,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_T,this._$gl.CLAMP_TO_EDGE),i.width=t,i.height=e,i.area=t*e,i.dirty=!1,this._$gl.texStorage2D(this._$gl.TEXTURE_2D,1,this._$gl.RGBA8,t,e),i}_$getTexture(t,e){for(let i=0;i<this._$objectPool.length;i++){const s=this._$objectPool[i];if(s.width===t&&s.height===e)return this._$objectPool.splice(i,1),this._$objectPoolArea-=s.area,this.bind0(s,!1),s}return this._$createTexture(t,e)}create(t,e,i=null,s=!1,r=!0){const n=this._$getTexture(t,e);return s&&this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r||this._$gl.pixelStorei(this._$gl.UNPACK_FLIP_Y_WEBGL,!1),n.width!==t||n.height!==e?(n.width=t,n.height=e,n.area=t*e,n.dirty=!1,this._$gl.texImage2D(this._$gl.TEXTURE_2D,0,this._$gl.RGBA,t,e,0,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)):i&&(n.dirty=!1,this._$gl.texSubImage2D(this._$gl.TEXTURE_2D,0,0,0,t,e,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)),s&&this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r||this._$gl.pixelStorei(this._$gl.UNPACK_FLIP_Y_WEBGL,!0),n}createFromImage(t,e=!1){return this._$createFromElement(t.width,t.height,t,e)}createFromCanvas(t){return this._$createFromElement(t.width,t.height,t,!1)}createFromVideo(t,e=!1){return this._$createFromElement(t.videoWidth,t.videoHeight,t,e)}_$createFromElement(t,e,i,s=!1){const r=this._$getTexture(t,e);return r.dirty=!1,this.bind0(r,s),this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.width!==t||r.height!==e?(r.width=t,r.height=e,r.area=t*e,this._$gl.texImage2D(this._$gl.TEXTURE_2D,0,this._$gl.RGBA,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)):this._$gl.texSubImage2D(this._$gl.TEXTURE_2D,0,0,0,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i),this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r}release(t){if(t.area>this._$maxWidth*this._$maxHeight*2)this._$gl.deleteTexture(t);else if(t.dirty=!0,this._$objectPool.push(t),this._$objectPoolArea+=t.area,this._$objectPool.length&&this._$objectPoolArea>this._$maxWidth*this._$maxHeight*10){const t=this._$objectPool.shift();this._$objectPoolArea-=t.area,this._$gl.deleteTexture(t)}}bind0(t,e=null){this._$bindTexture(2,this._$gl.TEXTURE2,null,null),this._$bindTexture(1,this._$gl.TEXTURE1,null,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,e)}bind01(t,e,i=null){this._$bindTexture(2,this._$gl.TEXTURE2,null,null),this._$bindTexture(1,this._$gl.TEXTURE1,e,i),this._$bindTexture(0,this._$gl.TEXTURE0,t,i)}bind012(t,e,i,s=null){this._$bindTexture(2,this._$gl.TEXTURE2,i,s),this._$bindTexture(1,this._$gl.TEXTURE1,e,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,null)}bind02(t,e,i=null){this._$bindTexture(2,this._$gl.TEXTURE2,e,i),this._$bindTexture(1,this._$gl.TEXTURE1,null,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,null)}_$bindTexture(t,e,i=null,s=null){const r=i!==this._$boundTextures[t],n=null!==s&&null!==i&&s!==i.smoothing;if((r||n||e===this._$gl.TEXTURE0)&&e!==this._$activeTexture&&(this._$activeTexture=e,this._$gl.activeTexture(e)),r&&(this._$boundTextures[t]=i,this._$gl.bindTexture(this._$gl.TEXTURE_2D,i)),n){i&&(i.smoothing=!!s);const t=s?this._$gl.LINEAR:this._$gl.NEAREST;this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MIN_FILTER,t),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MAG_FILTER,t)}}}class Bi{constructor(t){this._$gl=t,this._$objectPool=nt(),this._$objectPoolArea=0,this._$maxWidth=0,this._$maxHeight=0}set maxWidth(t){this._$maxWidth=t}set maxHeight(t){this._$maxHeight=t}_$createStencilBuffer(){const t=this._$gl.createRenderbuffer();if(!t)throw new Error("the stencil buffer is null.");return t.width=0,t.height=0,t.area=0,t.dirty=!0,t}_$getStencilBuffer(t,e){const i=this._$objectPool.length;for(let s=0;s<i;++s){const i=this._$objectPool[s];if(i.width===t&&i.height===e)return this._$objectPool.splice(s,1),this._$objectPoolArea-=i.area,i}if(i>100){const t=this._$objectPool.shift();if(t)return this._$objectPoolArea-=t.area,t}return this._$createStencilBuffer()}create(t,e){const i=this._$getStencilBuffer(t,e);return i.width===t&&i.height===e||(i.width=t,i.height=e,i.area=t*e,i.dirty=!1,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,i),this._$gl.renderbufferStorage(this._$gl.RENDERBUFFER,this._$gl.STENCIL_INDEX8,t,e)),i}release(t){if(t.area>this._$maxWidth*this._$maxHeight*2)this._$gl.deleteRenderbuffer(t);else if(t.dirty=!0,this._$objectPool.push(t),this._$objectPoolArea+=t.area,this._$objectPoolArea>this._$maxWidth*this._$maxHeight*10){const t=this._$objectPool.shift();t&&(this._$objectPoolArea-=t.area,this._$gl.deleteRenderbuffer(t))}}}class Ii{constructor(t,e){this._$gl=t,this._$samples=e,this._$objectPool=nt()}set samples(t){this._$samples=t}_$createColorBuffer(){const t=this._$gl.createRenderbuffer();if(!t)throw new Error("the color buffer is null.");const e=this._$gl.createRenderbuffer();if(!e)throw new Error("the stencil buffer is null.");return t.stencil=e,t.samples=0,t.width=0,t.height=0,t.area=0,t.dirty=!0,t}_$getColorBuffer(t){if(!this._$objectPool.length)return this._$createColorBuffer();const e=this._$bsearch(t);if(e<this._$objectPool.length){const t=this._$objectPool[e];return this._$objectPool.splice(e,1),t}const i=this._$objectPool.shift();if(!i)throw new Error("the color buffer is void.");return i}create(t,e,i=0){t=v.max(256,lt(t)),e=v.max(256,lt(e));const s=this._$getColorBuffer(t*e);return i||(i=this._$samples),(s.width<t||s.height<e||s.samples!==i)&&(t=v.max(t,s.width),e=v.max(e,s.height),s.samples=i,s.width=t,s.height=e,s.area=t*e,s.dirty=!1,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,s),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,i,this._$gl.RGBA8,t,e),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,s.stencil),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,i,this._$gl.STENCIL_INDEX8,t,e)),s}release(t){t.dirty=!0;const e=this._$bsearch(t.area);this._$objectPool.splice(e,0,t)}_$bsearch(t){let e=-1,i=this._$objectPool.length;for(;v.abs(i-e)>1;){const s=v.floor((i+e)/2);t<=this._$objectPool[s].area?i=s:e=s}return i}}class Li{constructor(t,e){this._$gl=t,this._$objectPool=[],this._$frameBuffer=t.createFramebuffer(),t.bindFramebuffer(t.READ_FRAMEBUFFER,this._$frameBuffer),this._$frameBufferTexture=t.createFramebuffer(),this._$currentAttachment=null,this._$isBinding=!1,this._$textureManager=new Ri(t),this._$stencilBufferPool=new Bi(t),this._$colorBufferPool=new Ii(t,e),this._$isRenderBinding=!1,this._$colorBuffer=this._$gl.createRenderbuffer(),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,e,this._$gl.RGBA8,Fi,Fi),this._$stencilBuffer=this._$gl.createRenderbuffer(),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$stencilBuffer),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,e,this._$gl.STENCIL_INDEX8,Fi,Fi)}bindRenderBuffer(){this._$isBinding||(this._$isBinding=!0,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)),this._$isRenderBinding||(this._$isRenderBinding=!0,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$stencilBuffer),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.STENCIL_ATTACHMENT,this._$gl.RENDERBUFFER,this._$stencilBuffer))}get currentAttachment(){return this._$currentAttachment}get textureManager(){return this._$textureManager}createCacheAttachment(t,e,i=!1,s=0){const r=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!1},n=this._$textureManager.create(t,e);return r.width=t,r.height=e,i?(r.color=this._$colorBufferPool.create(t,e,s),r.texture=n,r.msaa=!0,r.stencil=r.color.stencil):(r.color=n,r.texture=n,r.msaa=!1,r.stencil=this._$stencilBufferPool.create(t,e)),r.mask=!1,r.clipLevel=0,r.isActive=!0,r}clearCache(){this._$textureManager.clearCache()}setMaxSize(t,e){this._$stencilBufferPool._$maxWidth=t,this._$stencilBufferPool._$maxHeight=e,this._$textureManager._$maxWidth=t,this._$textureManager._$maxHeight=e}createTextureAttachment(t,e){const i=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!1},s=this._$textureManager.create(t,e);return i.width=t,i.height=e,i.color=s,i.texture=s,i.msaa=!1,i.stencil=null,i.mask=!1,i.clipLevel=0,i.isActive=!0,i}createTextureAttachmentFrom(t){const e=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!0};return e.width=t.width,e.height=t.height,e.color=t,e.texture=t,e.msaa=!1,e.stencil=null,e.mask=!1,e.clipLevel=0,e.isActive=!0,e}releaseAttachment(t=null,e=!1){t&&t.isActive&&(t.msaa?t.color instanceof WebGLRenderbuffer&&this._$colorBufferPool.release(t.color):t.stencil&&this._$stencilBufferPool.release(t.stencil),e&&t.texture&&this._$textureManager.release(t.texture),t.color=null,t.texture=null,t.stencil=null,t.isActive=!1,this._$objectPool.push(t))}bind(t){this._$currentAttachment=t,this._$isBinding||(this._$isBinding=!0,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)),t.msaa?t.color instanceof WebGLRenderbuffer&&(this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,t.color),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.RENDERBUFFER,t.color)):t.color instanceof WebGLTexture&&(t.color&&this._$textureManager.bind0(t.color),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,t.color,0)),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,t.stencil),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.STENCIL_ATTACHMENT,this._$gl.RENDERBUFFER,t.stencil),this._$isRenderBinding=!1}unbind(){this._$currentAttachment=null,this._$isBinding&&(this._$isBinding=!1,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,null))}transferToMainTexture(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$currentAttachment.texture;if(!i)throw new Error("the texture is null.");this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture),this._$textureManager.bind0(i),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,i,0),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,null),this._$gl.blitFramebuffer(0,0,t,e,0,0,t,e,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBuffer)}createCachePosition(t,e){return this._$textureManager.createCachePosition(t,e)}transferTexture(t){this._$gl.disable(this._$gl.SCISSOR_TEST),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture);const e=this._$textureManager.getAtlasTexture(t.index);this._$textureManager.bind0(e),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,e,0);const i=v.max(0,t.x-1),s=v.max(0,t.y-1),r=v.min(Fi,t.x+t.w+1),n=v.min(Fi,t.y+t.h+1);this._$gl.blitFramebuffer(i,s,r,n,i,s,r,n,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)}getTextureFromCurrentAttachment(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");if(!this._$currentAttachment.msaa&&this._$currentAttachment.texture)return this._$currentAttachment.texture;const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$currentAttachment.texture;if(!i)throw new Error("the texture is null.");return i.dirty=!1,this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture),this._$textureManager.bind0(i),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,i,0),this._$gl.blitFramebuffer(0,0,t,e,0,0,t,e,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer),i}createTextureFromPixels(t,e,i=null,s=!1,r=!0){return this._$textureManager.create(t,e,i,s,r)}createTextureFromCanvas(t){return this._$textureManager.createFromCanvas(t)}createTextureFromImage(t,e=!1){return this._$textureManager.createFromImage(t,e)}createTextureFromVideo(t,e=!1){return this._$textureManager.createFromVideo(t,e)}createTextureFromCurrentAttachment(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$textureManager.create(t,e);return this._$textureManager.bind0(i),this._$gl.copyTexSubImage2D(this._$gl.TEXTURE_2D,0,0,0,0,0,t,e),i}releaseTexture(t){this._$textureManager.release(t)}}class Pi{constructor(){this._$bezierConverterBuffer=new A(32)}cubicToQuad(t,e,i,s,r,n,a,h){this._$split2Cubic(t,e,i,s,r,n,a,h,0,16),this._$split2Cubic(this._$bezierConverterBuffer[0],this._$bezierConverterBuffer[1],this._$bezierConverterBuffer[2],this._$bezierConverterBuffer[3],this._$bezierConverterBuffer[4],this._$bezierConverterBuffer[5],this._$bezierConverterBuffer[6],this._$bezierConverterBuffer[7],0,8),this._$split2Cubic(this._$bezierConverterBuffer[16],this._$bezierConverterBuffer[17],this._$bezierConverterBuffer[18],this._$bezierConverterBuffer[19],this._$bezierConverterBuffer[20],this._$bezierConverterBuffer[21],this._$bezierConverterBuffer[22],this._$bezierConverterBuffer[23],16,24),this._$split2Quad(this._$bezierConverterBuffer[0],this._$bezierConverterBuffer[1],this._$bezierConverterBuffer[2],this._$bezierConverterBuffer[3],this._$bezierConverterBuffer[4],this._$bezierConverterBuffer[5],this._$bezierConverterBuffer[6],this._$bezierConverterBuffer[7],0),this._$split2Quad(this._$bezierConverterBuffer[8],this._$bezierConverterBuffer[9],this._$bezierConverterBuffer[10],this._$bezierConverterBuffer[11],this._$bezierConverterBuffer[12],this._$bezierConverterBuffer[13],this._$bezierConverterBuffer[14],this._$bezierConverterBuffer[15],8),this._$split2Quad(this._$bezierConverterBuffer[16],this._$bezierConverterBuffer[17],this._$bezierConverterBuffer[18],this._$bezierConverterBuffer[19],this._$bezierConverterBuffer[20],this._$bezierConverterBuffer[21],this._$bezierConverterBuffer[22],this._$bezierConverterBuffer[23],16),this._$split2Quad(this._$bezierConverterBuffer[24],this._$bezierConverterBuffer[25],this._$bezierConverterBuffer[26],this._$bezierConverterBuffer[27],this._$bezierConverterBuffer[28],this._$bezierConverterBuffer[29],this._$bezierConverterBuffer[30],this._$bezierConverterBuffer[31],24)}_$split2Cubic(t,e,i,s,r,n,a,h,o,l){const c=.125*(t+3*(i+r)+a),_=.125*(e+3*(s+n)+h),$=.125*(a+r-i-t),u=.125*(h+n-s-e);this._$bezierConverterBuffer[o]=t,this._$bezierConverterBuffer[o+1]=e,this._$bezierConverterBuffer[o+2]=.5*(t+i),this._$bezierConverterBuffer[o+3]=.5*(e+s),this._$bezierConverterBuffer[o+4]=c-$,this._$bezierConverterBuffer[o+5]=_-u,this._$bezierConverterBuffer[o+6]=c,this._$bezierConverterBuffer[o+7]=_,this._$bezierConverterBuffer[l]=c,this._$bezierConverterBuffer[l+1]=_,this._$bezierConverterBuffer[l+2]=c+$,this._$bezierConverterBuffer[l+3]=_+u,this._$bezierConverterBuffer[l+4]=.5*(r+a),this._$bezierConverterBuffer[l+5]=.5*(n+h),this._$bezierConverterBuffer[l+6]=a,this._$bezierConverterBuffer[l+7]=h}_$split2Quad(t,e,i,s,r,n,a,h,o){const l=.125*(t+3*(i+r)+a),c=.125*(e+3*(s+n)+h);this._$bezierConverterBuffer[o]=.25*t+.75*i,this._$bezierConverterBuffer[o+1]=.25*e+.75*s,this._$bezierConverterBuffer[o+2]=l,this._$bezierConverterBuffer[o+3]=c,this._$bezierConverterBuffer[o+4]=.75*r+.25*a,this._$bezierConverterBuffer[o+5]=.75*n+.25*h,this._$bezierConverterBuffer[o+6]=a,this._$bezierConverterBuffer[o+7]=h}}class Oi{constructor(){this._$currentPath=nt(),this._$vertices=nt(),this._$bezierConverter=new Pi}get vertices(){return this._$pushCurrentPathToVertices(),this._$vertices}begin(){for(this._$currentPath.length=0;this._$vertices.length;)at(this._$vertices.pop())}moveTo(t,e){this._$currentPath.length?this._$equalsToLastPoint(t,e)||(this._$pushCurrentPathToVertices(),this._$pushPointToCurrentPath(t,e,!1)):this._$pushPointToCurrentPath(t,e,!1)}lineTo(t,e){this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(t,e)||this._$pushPointToCurrentPath(t,e,!1)}quadTo(t,e,i,s){this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(i,s)||(this._$pushPointToCurrentPath(t,e,!0),this._$pushPointToCurrentPath(i,s,!1))}cubicTo(t,e,i,s,r,n){if(this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(r,n))return;const a=+this._$currentPath[this._$currentPath.length-3],h=+this._$currentPath[this._$currentPath.length-2];this._$bezierConverter.cubicToQuad(a,h,t,e,i,s,r,n);const o=this._$bezierConverter._$bezierConverterBuffer;for(let t=0;t<32;)this.quadTo(o[t++],o[t++],o[t++],o[t++])}drawCircle(t,e,i){const s=i,r=.5522847498307936*i;this.cubicTo(t+s,e+r,t+r,e+s,t,e+s),this.cubicTo(t-r,e+s,t-s,e+r,t-s,e),this.cubicTo(t-s,e-r,t-r,e-s,t,e-s),this.cubicTo(t+r,e-s,t+s,e-r,t+s,e)}close(){if(this._$currentPath.length<=6)return;const t=+this._$currentPath[0],e=+this._$currentPath[1];this._$equalsToLastPoint(t,e)||this._$pushPointToCurrentPath(t,e,!1)}_$equalsToLastPoint(t,e){const i=+this._$currentPath[this._$currentPath.length-3],s=+this._$currentPath[this._$currentPath.length-2];return t===i&&e===s}_$pushPointToCurrentPath(t,e,i){this._$currentPath.push(t,e,i)}_$pushCurrentPathToVertices(){this._$currentPath.length<4?this._$currentPath.length=0:(this._$vertices.push(this._$currentPath),this._$currentPath=nt())}createRectVertices(t,e,i,s){return nt(nt(t,e,!1,t+i,e,!1,t+i,e+s,!1,t,e+s,!1))}}class ki{constructor(){this.enabled=!1,this.parentMatrixA=1,this.parentMatrixB=0,this.parentMatrixC=0,this.parentMatrixD=0,this.parentMatrixE=1,this.parentMatrixF=0,this.parentMatrixG=0,this.parentMatrixH=0,this.parentMatrixI=1,this.ancestorMatrixA=1,this.ancestorMatrixB=0,this.ancestorMatrixC=0,this.ancestorMatrixD=0,this.ancestorMatrixE=1,this.ancestorMatrixF=0,this.ancestorMatrixG=0,this.ancestorMatrixH=0,this.ancestorMatrixI=1,this.parentViewportX=0,this.parentViewportY=0,this.parentViewportW=0,this.parentViewportH=0,this.minXST=1e-5,this.minYST=1e-5,this.minXPQ=1e-5,this.minYPQ=1e-5,this.maxXST=.99999,this.maxYST=.99999,this.maxXPQ=.99999,this.maxYPQ=.99999}enable(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m){const x=r.xMax-r.xMin,b=r.yMax-r.yMin,T=n.w,y=n.h,E=v.abs(v.ceil(x*a)),A=v.abs(v.ceil(b*a)),M=T>0?(n.x-r.xMin)/x:1e-5,S=y>0?(n.y-r.yMin)/b:1e-5,w=T>0?(n.x+n.w-r.xMin)/x:.99999,C=y>0?(n.y+n.h-r.yMin)/b:.99999;let F=E*M/i,R=A*S/s,B=(i-E*(1-w))/i,I=(s-A*(1-C))/s;if(F>=B){const t=M/(M+(1-w));F=v.max(t-1e-5,0),B=v.min(t+1e-5,1)}if(R>=I){const t=S/(S+(1-C));R=v.max(t-1e-5,0),I=v.min(t+1e-5,1)}this.enabled=!0,this.parentMatrixA=h,this.parentMatrixB=o,this.parentMatrixD=l,this.parentMatrixE=c,this.parentMatrixG=_,this.parentMatrixH=$,this.ancestorMatrixA=u,this.ancestorMatrixB=d,this.ancestorMatrixD=g,this.ancestorMatrixE=f,this.ancestorMatrixG=p,this.ancestorMatrixH=m,this.parentViewportX=t,this.parentViewportY=e,this.parentViewportW=i,this.parentViewportH=s,this.minXST=M,this.minYST=S,this.minXPQ=F,this.minYPQ=R,this.maxXST=w,this.maxYST=C,this.maxXPQ=B,this.maxYPQ=I}disable(){this.enabled=!1}}class Ni{constructor(t,e){this._$gl=t,this._$array=[],this._$map=ot();const i=this._$gl.getProgramParameter(e,this._$gl.ACTIVE_UNIFORMS);for(let t=0;t<i;t++){const i=this._$gl.getActiveUniform(e,t),s=i.name.endsWith("[0]")?i.name.slice(0,-3):i.name,r=this._$gl.getUniformLocation(e,s);if(i.type===this._$gl.SAMPLER_2D&&1===i.size)continue;const n={};switch(i.type){case this._$gl.FLOAT_VEC4:n.method=this._$gl.uniform4fv.bind(this._$gl,r),n.array=new A(4*i.size),n.assign=-1;break;case this._$gl.INT_VEC4:n.method=this._$gl.uniform4iv.bind(this._$gl,r),n.array=new M(4*i.size),n.assign=-1;break;case this._$gl.SAMPLER_2D:n.method=this._$gl.uniform1iv.bind(this._$gl,r),n.array=new M(i.size),n.assign=1;break;case this._$gl.FLOAT:case this._$gl.FLOAT_VEC2:case this._$gl.FLOAT_VEC3:case this._$gl.FLOAT_MAT2:case this._$gl.FLOAT_MAT3:case this._$gl.FLOAT_MAT4:case this._$gl.INT:case this._$gl.INT_VEC2:case this._$gl.INT_VEC3:default:throw new Error("Use gl.FLOAT_VEC4 or gl.INT_VEC4 instead")}this._$array.push(n),this._$map.set(s,n)}}getArray(t){const e=this._$map.get(t);if(!e||!e.array)throw new Error("the UniformData is null.");return e.array}get textures(){const t=this._$map.get("u_textures");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get highp(){const t=this._$map.get("u_highp");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get mediump(){const t=this._$map.get("u_mediump");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get integer(){const t=this._$map.get("u_integer");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}bindUniforms(){const t=this._$array.length;for(let e=0;e<t;e++){const t=this._$array[e];void 0!==t.method&&void 0!==t.assign&&(t.assign<0?t.method(t.array):t.assign>0&&(t.assign--,t.method(t.array)))}}}class Di{constructor(){this._$attributes=[],this._$count=0}get attributes(){return this._$attributes}get count(){return this._$count}set count(t){this._$count=t}clear(){this._$attributes.length=0,this._$count=0}}class Ui{constructor(t,e,i,s){this._$gl=t,this._$context=e,this._$program=this._$createProgram(i,s),this._$uniform=new Ni(t,this._$program),this._$instance=null}get instance(){return this._$instance||(this._$instance=new Di),this._$instance}get uniform(){return this._$uniform}_$createProgram(t,e){const i=this._$gl.createProgram();i.id=p++;const s=this._$gl.createShader(this._$gl.VERTEX_SHADER);this._$gl.shaderSource(s,t),this._$gl.compileShader(s);const r=this._$gl.createShader(this._$gl.FRAGMENT_SHADER);return this._$gl.shaderSource(r,e),this._$gl.compileShader(r),this._$gl.attachShader(i,s),this._$gl.attachShader(i,r),this._$gl.linkProgram(i),this._$gl.detachShader(i,s),this._$gl.detachShader(i,r),this._$gl.deleteShader(s),this._$gl.deleteShader(r),i}_$attachProgram(){const t=this._$context.shaderList;t.currentProgramId!==this._$program.id&&(t.currentProgramId=this._$program.id,this._$gl.useProgram(this._$program))}drawArraysInstanced(t){this._$attachProgram(),this._$context.vao.bindInstnceArray(t),this._$gl.drawArraysInstanced(this._$gl.TRIANGLE_STRIP,0,4,t.count)}_$drawImage(){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bindCommonVertexArray(),this._$gl.drawArrays(this._$gl.TRIANGLE_STRIP,0,4)}_$drawGradient(t,e){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bindGradientVertexArray(t,e),this._$gl.drawArrays(this._$gl.TRIANGLE_STRIP,0,4)}_$stroke(t){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawElements(this._$gl.TRIANGLES,t.indexCount,this._$gl.UNSIGNED_SHORT,0)}_$fill(t){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t);const e=t.indexRanges,i=e[e.length-1];this._$gl.drawArrays(this._$gl.TRIANGLES,0,i.first+i.count)}_$containerClip(t,e,i){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawArrays(this._$gl.TRIANGLES,e,i)}_$drawPoints(t,e,i){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawArrays(this._$gl.POINTS,e,i)}}class Vi{static FUNCTION_GRID_OFF(){return"\n\nvec2 applyMatrix(in vec2 vertex) {\n mat3 matrix = mat3(\n u_highp[0].xyz,\n u_highp[1].xyz,\n u_highp[2].xyz\n );\n\n vec2 position = (matrix * vec3(vertex, 1.0)).xy;\n\n return position;\n}\n\n"}static FUNCTION_GRID_ON(t){return`\n\nvec2 applyMatrix(in vec2 vertex) {\n mat3 parent_matrix = mat3(\n u_highp[${t}].xyz,\n u_highp[${t+1}].xyz,\n u_highp[${t+2}].xyz\n );\n mat3 ancestor_matrix = mat3(\n u_highp[${t+3}].xyz,\n u_highp[${t+4}].xyz,\n u_highp[${t+5}].xyz\n );\n vec2 parent_offset = vec2(u_highp[${t+2}].w, u_highp[${t+3}].w);\n vec2 parent_size = vec2(u_highp[${t+4}].w, u_highp[${t+5}].w);\n vec4 grid_min = u_highp[${t+6}];\n vec4 grid_max = u_highp[${t+7}];\n\n vec2 position = (parent_matrix * vec3(vertex, 1.0)).xy;\n position = (position - parent_offset) / parent_size;\n\n vec4 ga = grid_min;\n vec4 gb = grid_max - grid_min;\n vec4 gc = vec4(1.0) - grid_max;\n\n vec2 pa = position;\n vec2 pb = position - grid_min.st;\n vec2 pc = position - grid_max.st;\n\n position = (ga.pq / ga.st) * min(pa, ga.st)\n + (gb.pq / gb.st) * clamp(pb, vec2(0.0), gb.st)\n + (gc.pq / gc.st) * max(vec2(0.0), pc);\n\n position = position * parent_size + parent_offset;\n position = (ancestor_matrix * vec3(position, 1.0)).xy;\n\n return position;\n}\n\n`}}class Gi{static TEMPLATE(t,e,i,s){const r=e-1,n=i?this.VARYING_UV_ON():"",a=i?this.STATEMENT_UV_ON():"";return`#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\nlayout (location = 1) in vec2 a_option1;\nlayout (location = 2) in vec2 a_option2;\nlayout (location = 3) in float a_type;\n\nuniform vec4 u_highp[${t}];\n\n${n}\n\n${s?Vi.FUNCTION_GRID_ON(i?5:0):Vi.FUNCTION_GRID_OFF()}\n\nfloat crossVec2(in vec2 v1, in vec2 v2) {\n return v1.x * v2.y - v2.x * v1.y;\n}\n\nvec2 perpendicularVec2(in vec2 v1) {\n float face = u_highp[${r}][1];\n\n return face * vec2(v1.y, -v1.x);\n}\n\nvec2 calculateNormal(in vec2 direction) {\n vec2 normalized = normalize(direction);\n return perpendicularVec2(normalized);\n}\n\nvec2 calculateIntersection(in vec2 v1, in vec2 v2, in vec2 o1, in vec2 o2) {\n float t = crossVec2(o2 - o1, v2) / crossVec2(v1, v2);\n return (o1 + t * v1);\n}\n\nvec2 calculateAnchor(in vec2 position, in float convex, out vec2 v1, out vec2 v2, out vec2 o1, out vec2 o2) {\n float miter_limit = u_highp[${r}][2];\n\n vec2 a = applyMatrix(a_option1);\n vec2 b = applyMatrix(a_option2);\n\n v1 = convex * (position - a);\n v2 = convex * (b - position);\n o1 = calculateNormal(v1) + a;\n o2 = calculateNormal(v2) + position;\n\n vec2 anchor = calculateIntersection(v1, v2, o1, o2) - position;\n return normalize(anchor) * min(length(anchor), miter_limit);\n}\n\nvoid main() {\n vec2 viewport = vec2(u_highp[0].w, u_highp[1].w);\n float half_width = u_highp[${r}][0];\n\n vec2 position = applyMatrix(a_vertex);\n vec2 offset = vec2(0.0);\n vec2 v1, v2, o1, o2;\n\n if (a_type == 1.0 || a_type == 2.0) { // 線分\n offset = calculateNormal(a_option2 * (applyMatrix(a_option1) - position));\n } else if (a_type == 10.0) { // スクエア線端\n offset = normalize(position - applyMatrix(a_option1));\n offset += a_option2 * perpendicularVec2(offset);\n } else if (a_type == 21.0) { // マイター結合(線分Bの凸側)\n offset = calculateAnchor(position, 1.0, v1, v2, o1, o2);\n offset = calculateIntersection(v2, perpendicularVec2(offset), o2, position + offset) - position;\n } else if (a_type == 22.0) { // マイター結合(線分Aの凸側)\n offset = calculateAnchor(position, 1.0, v1, v2, o1, o2);\n offset = calculateIntersection(v1, perpendicularVec2(offset), o1, position + offset) - position;\n } else if (a_type == 23.0) { // マイター結合(線分Aの凹側)\n offset = calculateAnchor(position, -1.0, v1, v2, o1, o2);\n offset = calculateIntersection(v1, perpendicularVec2(offset), o1, position + offset) - position;\n } else if (a_type == 24.0) { // マイター結合(線分Bの凹側)\n offset = calculateAnchor(position, -1.0, v1, v2, o1, o2);\n offset = calculateIntersection(v2, perpendicularVec2(offset), o2, position + offset) - position;\n } else if (a_type >= 30.0) { // ラウンド結合\n float face = u_highp[${r}][1];\n float rad = face * (a_type - 30.0) * 0.3488888889; /* 0.3488888889 = PI / 9.0 */\n offset = mat2(cos(rad), sin(rad), -sin(rad), cos(rad)) * vec2(1.0, 0.0);\n }\n \n offset *= half_width;\n position += offset;\n ${a}\n\n position /= viewport;\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n`}static VARYING_UV_ON(){return"\nout vec2 v_uv;\n"}static STATEMENT_UV_ON(){return"\n mat3 uv_matrix = mat3(\n u_highp[0].xyz,\n u_highp[1].xyz,\n u_highp[2].xyz\n );\n mat3 inverse_matrix = mat3(\n u_highp[3].xyz,\n u_highp[4].xyz,\n vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)\n );\n\n v_uv = (uv_matrix * vec3(a_vertex, 1.0)).xy;\n v_uv += offset;\n v_uv = (inverse_matrix * vec3(v_uv, 1.0)).xy;\n"}}class zi{static TEMPLATE(t,e,i,s){const r=i?this.ATTRIBUTE_BEZIER_ON():"",n=i?this.VARYING_BEZIER_ON():e?this.VARYING_UV_ON():"",a=i?this.STATEMENT_BEZIER_ON():e?this.STATEMENT_UV_ON():"";return`#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n${r}\n\nuniform vec4 u_highp[${t}];\n\n${n}\n\n${s?Vi.FUNCTION_GRID_ON(e?5:0):Vi.FUNCTION_GRID_OFF()}\n\nvoid main() {\n vec2 viewport = vec2(u_highp[0].w, u_highp[1].w);\n\n ${a}\n\n vec2 pos = applyMatrix(a_vertex) / viewport;\n pos = pos * 2.0 - 1.0;\n gl_Position = vec4(pos.x, -pos.y, 0.0, 1.0);\n}\n\n`}static ATTRIBUTE_BEZIER_ON(){return"\nlayout (location = 1) in vec2 a_bezier;\n"}static VARYING_UV_ON(){return"\nout vec2 v_uv;\n"}static VARYING_BEZIER_ON(){return"\nout vec2 v_bezier;\n"}static STATEMENT_UV_ON(){return"\n mat3 uv_matrix = mat3(\n u_highp[0].xyz,\n u_highp[1].xyz,\n u_highp[2].xyz\n );\n mat3 inverse_matrix = mat3(\n u_highp[3].xyz,\n u_highp[4].xyz,\n vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)\n );\n\n v_uv = (inverse_matrix * uv_matrix * vec3(a_vertex, 1.0)).xy;\n"}static STATEMENT_BEZIER_ON(){return"\n v_bezier = a_bezier;\n"}}class Yi{static FUNCTION_IS_INSIDE(){return"\n\nfloat isInside(in vec2 uv) {\n return step(4.0, dot(step(vec4(0.0, uv.x, 0.0, uv.y), vec4(uv.x, 1.0, uv.y, 1.0)), vec4(1.0)));\n}\n\n"}static STATEMENT_INSTANCED_COLOR_TRANSFORM_ON(){return"\n src.rgb /= max(0.0001, src.a);\n src = clamp(src * mul + add, 0.0, 1.0);\n src.rgb *= src.a;\n"}static STATEMENT_COLOR_TRANSFORM_ON(t){return`\n vec4 mul = u_mediump[${t}];\n vec4 add = u_mediump[${t+1}];\n${Yi.STATEMENT_INSTANCED_COLOR_TRANSFORM_ON()}\n`}}class Xi{static SOLID_COLOR(){return"#version 300 es\nprecision mediump float;\n\nuniform vec4 u_mediump;\n\nout vec4 o_color;\n\nvoid main() {\n o_color = vec4(u_mediump.rgb * u_mediump.a, u_mediump.a);\n}\n\n"}static BITMAP_CLIPPED(){return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump[3];\n\nin vec2 v_uv;\nout vec4 o_color;\n\nvoid main() {\n vec2 uv = vec2(v_uv.x, u_mediump[0].y - v_uv.y) / u_mediump[0].xy;\n\n vec4 src = texture(u_texture, uv);\n ${Yi.STATEMENT_COLOR_TRANSFORM_ON(1)}\n o_color = src;\n}`}static BITMAP_PATTERN(){return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump[3];\n\nin vec2 v_uv;\nout vec4 o_color;\n\nvoid main() {\n vec2 uv = fract(vec2(v_uv.x, -v_uv.y) / u_mediump[0].xy);\n \n vec4 src = texture(u_texture, uv);\n ${Yi.STATEMENT_COLOR_TRANSFORM_ON(1)}\n o_color = src;\n}`}static MASK(){return"#version 300 es\nprecision mediump float;\n\nin vec2 v_bezier;\nout vec4 o_color;\n\nvoid main() {\n vec2 px = dFdx(v_bezier);\n vec2 py = dFdy(v_bezier);\n\n vec2 f = (2.0 * v_bezier.x) * vec2(px.x, py.x) - vec2(px.y, py.y);\n float alpha = 0.5 - (v_bezier.x * v_bezier.x - v_bezier.y) / length(f);\n\n if (alpha > 0.0) {\n o_color = vec4(min(alpha, 1.0));\n } else {\n discard;\n } \n}\n\n"}}class qi{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getSolidColorShapeShader(t,e){const i=`s${t?"y":"n"}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=(e?8:3)+(t?1:0),r=s;let n;n=t?Gi.TEMPLATE(s,r,!1,e):zi.TEMPLATE(s,!1,!1,e);const a=new Ui(this._$gl,this._$context,n,Xi.SOLID_COLOR());return this._$collection.set(i,a),a}getBitmapShapeShader(t,e,i){const s=`b${t?"y":"n"}${e?"y":"n"}${i?"y":"n"}`;if(this._$collection.has(s)){const t=this._$collection.get(s);if(t)return t}const r=(i?13:5)+(t?1:0),n=r;let a;a=t?Gi.TEMPLATE(r,n,!0,i):zi.TEMPLATE(r,!0,!1,i);const h=e?Xi.BITMAP_PATTERN():Xi.BITMAP_CLIPPED(),o=new Ui(this._$gl,this._$context,a,h);return this._$collection.set(s,o),o}getMaskShapeShader(t,e){const i=`m${t?"y":"n"}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=(e?8:3)+(t?1:0),r=s;let n;n=t?Gi.TEMPLATE(s,r,!1,e):zi.TEMPLATE(s,!1,!0,e);const a=new Ui(this._$gl,this._$context,n,Xi.MASK());return this._$collection.set(i,a),a}setSolidColorShapeUniform(t,e,i,s,r,n,a,h,o,l,c,_){const $=t.highp;let u;n?($[0]=l.parentMatrixA,$[1]=l.parentMatrixB,$[2]=l.parentMatrixC,$[4]=l.parentMatrixD,$[5]=l.parentMatrixE,$[6]=l.parentMatrixF,$[8]=l.parentMatrixG,$[9]=l.parentMatrixH,$[10]=l.parentMatrixI,$[12]=l.ancestorMatrixA,$[13]=l.ancestorMatrixB,$[14]=l.ancestorMatrixC,$[16]=l.ancestorMatrixD,$[17]=l.ancestorMatrixE,$[18]=l.ancestorMatrixF,$[20]=l.ancestorMatrixG,$[21]=l.ancestorMatrixH,$[22]=l.ancestorMatrixI,$[3]=h,$[7]=o,$[11]=l.parentViewportX,$[15]=l.parentViewportY,$[19]=l.parentViewportW,$[23]=l.parentViewportH,$[24]=l.minXST,$[25]=l.minYST,$[26]=l.minXPQ,$[27]=l.minYPQ,$[28]=l.maxXST,$[29]=l.maxYST,$[30]=l.maxXPQ,$[31]=l.maxYPQ,u=32):($[0]=a[0],$[1]=a[1],$[2]=a[2],$[4]=a[3],$[5]=a[4],$[6]=a[5],$[8]=a[6],$[9]=a[7],$[10]=a[8],$[3]=h,$[7]=o,u=12),e&&($[u]=i,$[u+1]=s,$[u+2]=r);const d=t.mediump;d[0]=c[0],d[1]=c[1],d[2]=c[2],d[3]=c[3]*_}setBitmapShapeUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m,x,b){const v=t.highp;let T;v[0]=a[0],v[1]=a[1],v[2]=a[2],v[4]=a[3],v[5]=a[4],v[6]=a[5],v[8]=a[6],v[9]=a[7],v[10]=a[8],v[12]=h[0],v[13]=h[1],v[14]=h[2],v[16]=h[3],v[17]=h[4],v[18]=h[5],v[11]=h[6],v[15]=h[7],v[19]=h[8],v[3]=o,v[7]=l,T=20,n&&(v[T]=c.parentMatrixA,v[T+1]=c.parentMatrixB,v[T+2]=c.parentMatrixC,v[T+4]=c.parentMatrixD,v[T+5]=c.parentMatrixE,v[T+6]=c.parentMatrixF,v[T+8]=c.parentMatrixG,v[T+9]=c.parentMatrixH,v[T+10]=c.parentMatrixI,v[T+12]=c.ancestorMatrixA,v[T+13]=c.ancestorMatrixB,v[T+14]=c.ancestorMatrixC,v[T+16]=c.ancestorMatrixD,v[T+17]=c.ancestorMatrixE,v[T+18]=c.ancestorMatrixF,v[T+20]=c.ancestorMatrixG,v[T+21]=c.ancestorMatrixH,v[T+22]=c.ancestorMatrixI,v[T+11]=c.parentViewportX,v[T+15]=c.parentViewportY,v[T+19]=c.parentViewportW,v[T+23]=c.parentViewportH,v[T+24]=c.minXST,v[T+25]=c.minYST,v[T+26]=c.minXPQ,v[T+27]=c.minYPQ,v[T+28]=c.maxXST,v[T+29]=c.maxYST,v[T+30]=c.maxXPQ,v[T+31]=c.maxYPQ,T=52),e&&(v[T]=i,v[T+1]=s,v[T+2]=r);const y=t.mediump;y[0]=_,y[1]=$,y[4]=u,y[5]=d,y[6]=g,y[7]=f,y[8]=p,y[9]=m,y[10]=x,y[11]=b}setMaskShapeUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u=null){const d=t.highp;e&&u?(d[0]=u.parentMatrixA,d[1]=u.parentMatrixB,d[2]=u.parentMatrixC,d[4]=u.parentMatrixD,d[5]=u.parentMatrixE,d[6]=u.parentMatrixF,d[8]=u.parentMatrixG,d[9]=u.parentMatrixH,d[10]=u.parentMatrixI,d[12]=u.ancestorMatrixA,d[13]=u.ancestorMatrixB,d[14]=u.ancestorMatrixC,d[16]=u.ancestorMatrixD,d[17]=u.ancestorMatrixE,d[18]=u.ancestorMatrixF,d[20]=u.ancestorMatrixG,d[21]=u.ancestorMatrixH,d[22]=u.ancestorMatrixI,d[3]=_,d[7]=$,d[11]=u.parentViewportX,d[15]=u.parentViewportY,d[19]=u.parentViewportW,d[23]=u.parentViewportH,d[24]=u.minXST,d[25]=u.minYST,d[26]=u.minXPQ,d[27]=u.minYPQ,d[28]=u.maxXST,d[29]=u.maxYST,d[30]=u.maxXPQ,d[31]=u.maxYPQ):(d[0]=i,d[1]=s,d[2]=r,d[4]=n,d[5]=a,d[6]=h,d[8]=o,d[9]=l,d[10]=c,d[3]=_,d[7]=$)}setMaskShapeUniformIdentity(t,e,i){const s=t.highp;s[0]=1,s[1]=0,s[2]=0,s[4]=0,s[5]=1,s[6]=0,s[8]=0,s[9]=0,s[10]=1,s[3]=e,s[7]=i}}class Hi{static TEMPLATE(t,e,i,s,r){const n=i?this.STATEMENT_GRADIENT_TYPE_RADIAL(e,s):this.STATEMENT_GRADIENT_TYPE_LINEAR(e);let a;switch(r){case"reflect":a="1.0 - abs(fract(t * 0.5) * 2.0 - 1.0)";break;case"repeat":a="fract(t)";break;default:a="clamp(t, 0.0, 1.0)"}return`#version 300 es\nprecision highp float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_highp[${t}];\n\nin vec2 v_uv;\nout vec4 o_color;\n\nvoid main() {\n vec2 p = v_uv;\n ${n}\n t = ${a};\n o_color = texture(u_texture, vec2(t, 0.5));\n}\n\n`}static STATEMENT_GRADIENT_TYPE_LINEAR(t){return`\n vec2 a = u_highp[${t}].xy;\n vec2 b = u_highp[${t}].zw;\n\n vec2 ab = b - a;\n vec2 ap = p - a;\n\n float t = dot(ab, ap) / dot(ab, ab);\n`}static STATEMENT_GRADIENT_TYPE_RADIAL(t,e){return`\n float radius = u_highp[${t}][0];\n\n vec2 coord = p / radius;\n ${e?this.STATEMENT_FOCAL_POINT_ON(t):this.STATEMENT_FOCAL_POINT_OFF()}\n`}static STATEMENT_FOCAL_POINT_OFF(){return"\n float t = length(coord);\n"}static STATEMENT_FOCAL_POINT_ON(t){return`\n vec2 focal = vec2(u_highp[${t}][1], 0.0);\n\n vec2 dir = normalize(coord - focal);\n\n float a = dot(dir, dir);\n float b = 2.0 * dot(dir, focal);\n float c = dot(focal, focal) - 1.0;\n float x = (-b + sqrt(b * b - 4.0 * a * c)) / (2.0 * a);\n\n float t = distance(focal, coord) / distance(focal, focal + dir * x);\n`}}class ji{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getGradientShapeShader(t,e,i,s,r){const n=this.createCollectionKey(t,e,i,s,r);if(this._$collection.has(n)){const t=this._$collection.get(n);if(t)return t}const a=(e?13:5)+(t?1:0)+1,h=a-1;let o;o=t?Gi.TEMPLATE(a,h,!0,e):zi.TEMPLATE(a,!0,!1,e);const l=new Ui(this._$gl,this._$context,o,Hi.TEMPLATE(a,h,i,s,r));return this._$collection.set(n,l),l}createCollectionKey(t,e,i,s,r){const n=t?"y":"n",a=e?"y":"n",h=i?"y":"n",o=i&&s?"y":"n";let l=0;switch(r){case"reflect":l=1;break;case"repeat":l=2}return`${n}${a}${h}${o}${l}`}setGradientShapeUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u){const d=t.highp;d[0]=a[0],d[1]=a[1],d[2]=a[2],d[4]=a[3],d[5]=a[4],d[6]=a[5],d[8]=a[6],d[9]=a[7],d[10]=a[8],d[12]=h[0],d[13]=h[1],d[14]=h[2],d[16]=h[3],d[17]=h[4],d[18]=h[5],d[11]=h[6],d[15]=h[7],d[19]=h[8],d[3]=o,d[7]=l;let g=20;n&&(d[g]=c.parentMatrixA,d[g+1]=c.parentMatrixB,d[g+2]=c.parentMatrixC,d[g+4]=c.parentMatrixD,d[g+5]=c.parentMatrixE,d[g+6]=c.parentMatrixF,d[g+8]=c.parentMatrixG,d[g+9]=c.parentMatrixH,d[g+10]=c.parentMatrixI,d[g+12]=c.ancestorMatrixA,d[g+13]=c.ancestorMatrixB,d[g+14]=c.ancestorMatrixC,d[g+16]=c.ancestorMatrixD,d[g+17]=c.ancestorMatrixE,d[g+18]=c.ancestorMatrixF,d[g+20]=c.ancestorMatrixG,d[g+21]=c.ancestorMatrixH,d[g+22]=c.ancestorMatrixI,d[g+11]=c.parentViewportX,d[g+15]=c.parentViewportY,d[g+19]=c.parentViewportW,d[g+23]=c.parentViewportH,d[g+24]=c.minXST,d[g+25]=c.minYST,d[g+26]=c.minXPQ,d[g+27]=c.minYPQ,d[g+28]=c.maxXST,d[g+29]=c.maxYST,d[g+30]=c.maxXPQ,d[g+31]=c.maxYPQ,g=52),e&&(d[g]=i,d[g+1]=s,d[g+2]=r,g+=4),_?(d[g]=$[5],d[g+1]=u):(d[g]=$[0],d[g+1]=$[1],d[g+2]=$[2],d[g+3]=$[3])}}class Wi{static TEXTURE(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n\nout vec2 v_coord;\n\nvoid main() {\n v_coord = a_vertex;\n\n vec2 position = a_vertex * 2.0 - 1.0;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n\n"}static BLEND(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n\nuniform vec4 u_highp[4];\n\nout vec2 v_coord;\n\nvoid main() {\n v_coord = a_vertex;\n\n vec2 offset = u_highp[0].xy;\n vec2 size = u_highp[0].zw;\n mat3 matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\n\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\n position = position * size + offset;\n position = (matrix * vec3(position, 1.0)).xy;\n position /= viewport;\n\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n"}static INSTANCE_BLEND(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n\nuniform vec4 u_highp[5];\n\nout vec2 v_src_coord;\nout vec2 v_dst_coord;\n\nvoid main() {\n vec4 rect = vec4(u_highp[0].x, u_highp[0].y, u_highp[0].z, u_highp[0].w);\n vec2 size = vec2(u_highp[4].x, u_highp[4].y);\n mat3 matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\n\n v_src_coord = a_vertex * rect.zw + rect.xy;\n v_dst_coord = a_vertex;\n\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\n position = position * size;\n position = (matrix * vec3(position, 1.0)).xy;\n position /= viewport;\n\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n"}static INSTANCE(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\nlayout (location = 1) in vec4 a_rect;\nlayout (location = 2) in vec4 a_size;\nlayout (location = 3) in vec2 a_offset;\nlayout (location = 4) in vec4 a_matrix;\nlayout (location = 5) in vec4 a_mul;\nlayout (location = 6) in vec4 a_add;\n\nout vec2 v_coord;\nout vec4 mul;\nout vec4 add;\n\nvoid main() {\n v_coord = a_vertex * a_rect.zw + a_rect.xy;\n mul = a_mul;\n add = a_add;\n\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\n position = position * a_size.xy;\n mat3 matrix = mat3(a_matrix.x, a_matrix.y, 0.0, a_matrix.z, a_matrix.w, 0.0, a_offset.x, a_offset.y, 1.0);\n position = (matrix * vec3(position, 1.0)).xy;\n position /= a_size.zw;\n\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n"}static BLEND_CLIP(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n\nuniform vec4 u_highp[4];\n\nout vec2 v_coord;\n\nvoid main() {\n v_coord = a_vertex;\n\n vec2 offset = u_highp[0].xy;\n vec2 size = u_highp[0].zw;\n mat3 inv_matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\n\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\n position *= viewport;\n position = (inv_matrix * vec3(position, 1.0)).xy;\n position = (position - offset) / size;\n\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n"}}class Ki{static TEMPLATE(t,e,i){let s="";for(let t=1;t<e;t++){const i=t-1,r=t,n=`u_mediump[${e+v.floor(i/4)}][${i%4}]`,a=`u_mediump[${e+v.floor(r/4)}][${r%4}]`;s+=`\n if (t <= ${a}) {\n return mix(u_mediump[${i}], u_mediump[${r}], (t - ${n}) / (${a} - ${n}));\n }\n`}return`#version 300 es\nprecision mediump float;\n\nuniform vec4 u_mediump[${t}];\n\nin vec2 v_coord;\nout vec4 o_color;\n\nvec4 getGradientColor(in float t) {\n if (t <= u_mediump[${e}][0]) {\n return u_mediump[0];\n }\n ${s}\n return u_mediump[${e-1}];\n}\n\nvoid main() {\n vec4 color = getGradientColor(v_coord.x);\n ${i?"color = pow(color, vec4(0.45454545));":""}\n color.rgb *= color.a;\n\n o_color = color;\n}\n\n`}}class Qi{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getGradientLUTShader(t,e){const i=`l${("00"+t).slice(-3)}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=v.ceil(5*t/4),r=new Ui(this._$gl,this._$context,Wi.TEXTURE(),Ki.TEMPLATE(s,t,e));return this._$collection.set(i,r),r}setGradientLUTUniformForShape(t,e,i,s,r){let n=0;const a=t.mediump;for(let t=i;t<s;t++){const i=e[t][1];a[n++]=r[i[0]],a[n++]=r[i[1]],a[n++]=r[i[2]],a[n++]=r[i[3]]}for(let t=i;t<s;t++)a[n++]=e[t][0]}setGradientLUTUniformForFilter(t,e,i,s,r,n){let a=0;const h=t.mediump;for(let t=r;t<n;t++){const e=i[t];h[a++]=(e>>16)/255,h[a++]=(e>>8&255)/255,h[a++]=(255&e)/255,h[a++]=s[t]}for(let t=r;t<n;t++)h[a++]=e[t]}}class Ji{static TEMPLATE(t,e,i,s,r,n,a,h,o){let l=0;const c=i?this.STATEMENT_BASE_TEXTURE_TRANSFORM(l++):"",_=s?this.STATEMENT_BLUR_TEXTURE_TRANSFORM(l++):this.STATEMENT_BLUR_TEXTURE(),$="inner"===n,u=l;let d,g,f=4*l;switch(o?d=r?this.STATEMENT_GLOW(!1,i,h,o,u,f):this.STATEMENT_BEVEL(i,s,h,o,u,f):r?(f+=4,d=this.STATEMENT_GLOW($,i,h,o,u,f)):(f+=8,d=this.STATEMENT_BEVEL(i,s,h,o,u,f)),n){case"outer":g=a?"blur - blur * base.a":"base + blur - blur * base.a";break;case"full":g=a?"blur":"base - base * blur.a + blur";break;default:g="blur"}return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_textures[${t}];\nuniform vec4 u_mediump[${e}];\n\nin vec2 v_coord;\nout vec4 o_color;\n\n${Yi.FUNCTION_IS_INSIDE()}\n\nvoid main() {\n ${c}\n ${_}\n ${d}\n o_color = ${g};\n}\n\n`}static STATEMENT_BASE_TEXTURE_TRANSFORM(t){return`\n vec2 base_scale = u_mediump[${t}].xy;\n vec2 base_offset = u_mediump[${t}].zw;\n\n vec2 uv = v_coord * base_scale - base_offset;\n vec4 base = mix(vec4(0.0), texture(u_textures[1], uv), isInside(uv));\n`}static STATEMENT_BLUR_TEXTURE(){return"\n vec4 blur = texture(u_textures[0], v_coord);\n"}static STATEMENT_BLUR_TEXTURE_TRANSFORM(t){return`\n vec2 blur_scale = u_mediump[${t}].xy;\n vec2 blur_offset = u_mediump[${t}].zw;\n\n vec2 st = v_coord * blur_scale - blur_offset;\n vec4 blur = mix(vec4(0.0), texture(u_textures[0], st), isInside(st));\n`}static STATEMENT_GLOW(t,e,i,s,r,n){return`\n ${t?"blur.a = 1.0 - blur.a;":""}\n ${i?this.STATEMENT_GLOW_STRENGTH(n):""}\n ${s?this.STATEMENT_GLOW_GRADIENT_COLOR(e):this.STATEMENT_GLOW_SOLID_COLOR(r)}\n`}static STATEMENT_GLOW_STRENGTH(t){return`\n float strength = u_mediump[${v.floor(t/4)}][${t%4}];\n blur.a = clamp(blur.a * strength, 0.0, 1.0);\n`}static STATEMENT_GLOW_SOLID_COLOR(t){return`\n vec4 color = u_mediump[${t}];\n blur = color * blur.a;\n`}static STATEMENT_GLOW_GRADIENT_COLOR(t){return`\n blur = texture(u_textures[${t?2:1}], vec2(blur.a, 0.5));\n`}static STATEMENT_BEVEL(t,e,i,s,r,n){return`\n ${e?this.STATEMENT_BLUR_TEXTURE_TRANSFORM_2():this.STATEMENT_BLUR_TEXTURE_2()}\n float highlight_alpha = blur.a - blur2.a;\n float shadow_alpha = blur2.a - blur.a;\n ${i?this.STATEMENT_BEVEL_STRENGTH(n):""}\n highlight_alpha = clamp(highlight_alpha, 0.0, 1.0);\n shadow_alpha = clamp(shadow_alpha, 0.0, 1.0);\n ${s?this.STATEMENT_BEVEL_GRADIENT_COLOR(t):this.STATEMENT_BEVEL_SOLID_COLOR(r)}\n`}static STATEMENT_BLUR_TEXTURE_2(){return"\n vec4 blur2 = texture(u_textures[0], 1.0 - v_coord);\n"}static STATEMENT_BLUR_TEXTURE_TRANSFORM_2(){return"\n vec2 pq = (1.0 - v_coord) * blur_scale - blur_offset;\n vec4 blur2 = mix(vec4(0.0), texture(u_textures[0], pq), isInside(pq));\n"}static STATEMENT_BEVEL_STRENGTH(t){return`\n float strength = u_mediump[${v.floor(t/4)}][${t%4}];\n highlight_alpha *= strength;\n shadow_alpha *= strength;\n`}static STATEMENT_BEVEL_SOLID_COLOR(t){return`\n vec4 highlight_color = u_mediump[${t}];\n vec4 shadow_color = u_mediump[${t+1}];\n blur = highlight_color * highlight_alpha + shadow_color * shadow_alpha;\n`}static STATEMENT_BEVEL_GRADIENT_COLOR(t){return`\n blur = texture(u_textures[${t?2:1}], vec2(\n 0.5019607843137255 - 0.5019607843137255 * shadow_alpha + 0.4980392156862745 * highlight_alpha,\n 0.5\n ));\n`}}class Zi{static TEMPLATE(t){const e=t.toFixed(1);return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump;\n\nin vec2 v_coord;\nout vec4 o_color;\n\nvoid main() {\n vec2 offset = u_mediump.xy;\n float fraction = u_mediump.z;\n float samples = u_mediump.w;\n \n vec4 color = texture(u_texture, v_coord);\n\n for (float i = 1.0; i < ${e}; i += 1.0) {\n color += texture(u_texture, v_coord + offset * i);\n color += texture(u_texture, v_coord - offset * i);\n }\n color += texture(u_texture, v_coord + offset * ${e}) * fraction;\n color += texture(u_texture, v_coord - offset * ${e}) * fraction;\n color /= samples;\n\n o_color = color;\n}\n\n`}}class ts{static TEMPLATE(){return"#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump[5];\n\nin vec2 v_coord;\nout vec4 o_color;\n\nvoid main() {\n mat4 mul = mat4(u_mediump[0], u_mediump[1], u_mediump[2], u_mediump[3]);\n vec4 add = u_mediump[4];\n \n vec4 color = texture(u_texture, v_coord);\n\n color.rgb /= max(0.0001, color.a);\n color = clamp(color * mul + add, 0.0, 1.0);\n color.rgb *= color.a;\n\n o_color = color;\n}\n\n"}}class es{static TEMPLATE(t,e,i,s,r){const n=v.floor(.5*e),a=v.floor(.5*i),h=e*i;let o="";const l=r?1:2;for(let t=0;t<h;++t)o+=`\n result += getWeightedColor(${t}, u_mediump[${l+v.floor(t/4)}][${t%4}]);\n`;const c=s?"result.a = texture(u_texture, v_coord).a;":"",_=r?"":"\n vec4 substitute_color = u_mediump[1];\n color = mix(substitute_color, color, isInside(uv));\n";return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump[${t}];\n\nin vec2 v_coord;\nout vec4 o_color;\n\n${Yi.FUNCTION_IS_INSIDE()}\n\nvec4 getWeightedColor (in int i, in float weight) {\n vec2 rcp_size = u_mediump[0].xy;\n\n int i_div_x = i / ${e};\n int i_mod_x = i - ${e} * i_div_x;\n vec2 offset = vec2(i_mod_x - ${n}, ${a} - i_div_x);\n vec2 uv = v_coord + offset * rcp_size;\n\n vec4 color = texture(u_texture, uv);\n color.rgb /= max(0.0001, color.a);\n ${_}\n\n return color * weight;\n}\n\nvoid main() {\n float rcp_divisor = u_mediump[0].z;\n float bias = u_mediump[0].w;\n\n vec4 result = vec4(0.0);\n ${o}\n result = clamp(result * rcp_divisor + bias, 0.0, 1.0);\n ${c}\n\n result.rgb *= result.a;\n o_color = result;\n}\n\n`}}class is{static TEMPLATE(t,e,i,s){let r,n,a;switch(e){case 1:r="map_color.r";break;case 2:r="map_color.g";break;case 4:r="map_color.b";break;case 8:r="map_color.a";break;default:r="0.5"}switch(i){case 1:n="map_color.r";break;case 2:n="map_color.g";break;case 4:n="map_color.b";break;case 8:n="map_color.a";break;default:n="0.5"}switch(s){case"clamp":a="\n vec4 source_color = texture(u_textures[0], uv);\n";break;case"ignore":a="\n vec4 source_color =texture(u_textures[0], mix(v_coord, uv, step(abs(uv - vec2(0.5)), vec2(0.5))));\n";break;case"color":a="\n vec4 substitute_color = u_mediump[2];\n vec4 source_color = mix(substitute_color, texture(u_textures[0], uv), isInside(uv));\n";break;default:a="\n vec4 source_color = texture(u_textures[0], fract(uv));\n"}return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_textures[2];\nuniform vec4 u_mediump[${t}];\n\nin vec2 v_coord;\nout vec4 o_color;\n\n${Yi.FUNCTION_IS_INSIDE()}\n\nvoid main() {\n vec2 uv_to_st_scale = u_mediump[0].xy;\n vec2 uv_to_st_offset = u_mediump[0].zw;\n vec2 scale = u_mediump[1].xy;\n\n vec2 st = v_coord * uv_to_st_scale - uv_to_st_offset;\n vec4 map_color = texture(u_textures[1], st);\n\n vec2 offset = vec2(${r}, ${n}) - 0.5;\n vec2 uv = v_coord + offset * scale;\n ${a}\n\n o_color = mix(texture(u_textures[0], v_coord), source_color, isInside(st));\n}\n\n`}}class ss{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getBlurFilterShader(t){const e=`b${t}`;if(this._$collection.has(e)){const t=this._$collection.get(e);if(t)return t}const i=new Ui(this._$gl,this._$context,Wi.TEXTURE(),Zi.TEMPLATE(t));return this._$collection.set(e,i),i}getBitmapFilterShader(t,e,i,s,r,n,a){const h=`f${t?"y":"n"}${e?"y":"n"}${i?"y":"n"}${s}${r?"y":"n"}${n?"y":"n"}`;if(this._$collection.has(h)){const t=this._$collection.get(h);if(t)return t}let o=1;t&&o++,a&&o++;let l=(t?4:0)+(e?4:0)+(n?1:0);a||(l+=i?4:8),l=v.ceil(l/4);const c=new Ui(this._$gl,this._$context,Wi.TEXTURE(),Ji.TEMPLATE(o,l,t,e,i,s,r,n,a));return this._$collection.set(h,c),c}getColorMatrixFilterShader(){if(this._$collection.has("m")){const t=this._$collection.get("m");if(t)return t}const t=new Ui(this._$gl,this._$context,Wi.TEXTURE(),ts.TEMPLATE());return this._$collection.set("m",t),t}getConvolutionFilterShader(t,e,i,s){const r=`c${("0"+t).slice(-2)}${("0"+e).slice(-2)}${i?"y":"n"}${s?"y":"n"}`;if(this._$collection.has(r)){const t=this._$collection.get(r);if(t)return t}const n=(s?1:2)+v.ceil(t*e/4),a=new Ui(this._$gl,this._$context,Wi.TEXTURE(),es.TEMPLATE(n,t,e,i,s));return this._$collection.set(r,a),a}getDisplacementMapFilterShader(t,e,i){const s=`d${t}${e}${i}`;if(this._$collection.has(s)){const t=this._$collection.get(s);if(t)return t}const r="color"===i?3:2,n=new Ui(this._$gl,this._$context,Wi.TEXTURE(),is.TEMPLATE(r,t,e,i));return this._$collection.set(s,n),n}setBlurFilterUniform(t,e,i,s,r,n){const a=t.mediump;s?(a[0]=1/e,a[1]=0):(a[0]=0,a[1]=1/i),a[2]=r,a[3]=n}setBitmapFilterUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m,x,b,v,T,y,E){let A;v?(A=t.textures,A[0]=0,A[1]=1,E&&(A[2]=2)):E&&(A=t.textures,A[0]=0,A[1]=2);const M=t.mediump;let S=0;v&&(M[S]=e/s,M[S+1]=i/r,M[S+2]=n/s,M[S+3]=(i-r-a)/r,S+=4),T&&(M[S]=e/h,M[S+1]=i/o,M[S+2]=l/h,M[S+3]=(i-o-c)/o,S+=4),E||(_?(M[S]=u,M[S+1]=d,M[S+2]=g,M[S+3]=f,S+=4):(M[S]=u,M[S+1]=d,M[S+2]=g,M[S+3]=f,M[S+4]=p,M[S+5]=m,M[S+6]=x,M[S+7]=b,S+=8)),y&&(M[S]=$)}setColorMatrixFilterUniform(t,e){const i=t.mediump;i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[5],i[5]=e[6],i[6]=e[7],i[7]=e[8],i[8]=e[10],i[9]=e[11],i[10]=e[12],i[11]=e[13],i[12]=e[15],i[13]=e[16],i[14]=e[17],i[15]=e[18],i[16]=e[4]/255,i[17]=e[9]/255,i[18]=e[14]/255,i[19]=e[19]/255}setConvolutionFilterUniform(t,e,i,s,r,n,a,h,o,l,c){const _=t.mediump;_[0]=1/e,_[1]=1/i,_[2]=1/r,_[3]=n/255;let $=4;a||(_[$]=h,_[$+1]=o,_[$+2]=l,_[$+3]=c,$+=4);const u=s.length;for(let t=0;t<u;t++)_[$++]=s[t]}setDisplacementMapFilterUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u){const d=t.textures;d[0]=0,d[1]=1;const g=t.mediump;g[0]=s/e,g[1]=r/i,g[2]=n/e,g[3]=(r-i-a)/i,g[4]=h/s,g[5]=-o/r,"color"===l&&(g[8]=c,g[9]=_,g[10]=$,g[11]=u)}}class rs{static TEMPLATE(t){return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\n${t?"uniform vec4 u_mediump[2];":""}\n\nin vec2 v_coord;\nout vec4 o_color;\n\nvoid main() {\n vec4 src = texture(u_texture, v_coord);\n ${t?Yi.STATEMENT_COLOR_TRANSFORM_ON(0):""}\n o_color = src;\n}\n\n`}static INSTANCE_TEMPLATE(){return"#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\n\nin vec4 mul;\nin vec4 add;\nin vec2 v_coord;\nout vec4 o_color;\n\nvoid main() {\n vec4 src = texture(u_texture, v_coord);\n\n if (mul.x != 1.0 || mul.y != 1.0 || mul.z != 1.0 || mul.w != 1.0\n || add.x != 0.0 || add.y != 0.0 || add.z != 0.0 || add.w != 0.0\n ) {\n src.rgb /= max(0.0001, src.a);\n src = clamp(src * mul + add, 0.0, 1.0);\n src.rgb *= src.a;\n }\n \n o_color = src;\n}\n\n"}}class ns{static TEMPLATE(t,e){let i;switch(t){case"subtract":i=this.FUNCTION_SUBTRACT();break;case"multiply":i=this.FUNCTION_MULTIPLY();break;case"lighten":i=this.FUNCTION_LIGHTEN();break;case"darken":i=this.FUNCTION_DARKEN();break;case"overlay":i=this.FUNCTION_OVERLAY();break;case"hardlight":i=this.FUNCTION_HARDLIGHT();break;case"difference":i=this.FUNCTION_DIFFERENCE();break;case"invert":i=this.FUNCTION_INVERT();break;default:i=this.FUNCTION_NORMAL()}return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_textures[2];\n${e?"uniform vec4 u_mediump[2];":""}\n\nin vec2 v_coord;\nout vec4 o_color;\n\n${i}\n\nvoid main() {\n vec4 dst = texture(u_textures[0], v_coord);\n vec4 src = texture(u_textures[1], v_coord);\n ${e?Yi.STATEMENT_COLOR_TRANSFORM_ON(0):""}\n o_color = blend(src, dst);\n}\n\n`}static INSTANCE_TEMPLATE(t,e){let i;switch(t){case"subtract":i=this.FUNCTION_SUBTRACT();break;case"multiply":i=this.FUNCTION_MULTIPLY();break;case"lighten":i=this.FUNCTION_LIGHTEN();break;case"darken":i=this.FUNCTION_DARKEN();break;case"overlay":i=this.FUNCTION_OVERLAY();break;case"hardlight":i=this.FUNCTION_HARDLIGHT();break;case"difference":i=this.FUNCTION_DIFFERENCE();break;case"invert":i=this.FUNCTION_INVERT();break;default:i=this.FUNCTION_NORMAL()}return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_textures[2];\n${e?"uniform vec4 u_mediump[2];":""}\n\nin vec2 v_src_coord;\nin vec2 v_dst_coord;\nout vec4 o_color;\n\n${i}\n\nvoid main() {\n vec4 dst = texture(u_textures[0], v_dst_coord);\n vec4 src = texture(u_textures[1], v_src_coord);\n ${e?Yi.STATEMENT_COLOR_TRANSFORM_ON(0):""}\n o_color = blend(src, dst);\n}\n\n`}static FUNCTION_NORMAL(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n return src + dst - dst * src.a;\n}\n\n"}static FUNCTION_SUBTRACT(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 c = vec4(dst.rgb - src.rgb, src.a * dst.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_MULTIPLY(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n vec4 c = src * dst;\n\n return a + b + c;\n}\n\n"}static FUNCTION_LIGHTEN(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 c = vec4(mix(src.rgb, dst.rgb, step(src.rgb, dst.rgb)), src.a * dst.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_DARKEN(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 c = vec4(mix(src.rgb, dst.rgb, step(dst.rgb, src.rgb)), src.a * dst.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_OVERLAY(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 mul = src * dst;\n vec3 c1 = 2.0 * mul.rgb;\n vec3 c2 = 2.0 * (src.rgb + dst.rgb - mul.rgb) - 1.0;\n vec4 c = vec4(mix(c1, c2, step(vec3(0.5), dst.rgb)), mul.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_HARDLIGHT(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 mul = src * dst;\n vec3 c1 = 2.0 * mul.rgb;\n vec3 c2 = 2.0 * (src.rgb + dst.rgb - mul.rgb) - 1.0;\n vec4 c = vec4(mix(c1, c2, step(vec3(0.5), src.rgb)), mul.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_DIFFERENCE(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 c = vec4(abs(src.rgb - dst.rgb), src.a * dst.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_INVERT(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 b = dst - dst * src.a;\n vec4 c = vec4(src.a - dst.rgb * src.a, src.a);\n\n return b + c;\n}\n\n"}}class as{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getInstanceShader(){if(this._$collection.has("i")){const t=this._$collection.get("i");if(t)return t}const t=new Ui(this._$gl,this._$context,Wi.INSTANCE(),rs.INSTANCE_TEMPLATE());return this._$collection.set("i",t),t}getNormalBlendShader(t){const e="n"+(t?"y":"n");if(this._$collection.has(e)){const t=this._$collection.get(e);if(t)return t}const i=new Ui(this._$gl,this._$context,Wi.BLEND(),rs.TEMPLATE(t));return this._$collection.set(e,i),i}getClipShader(){if(this._$collection.has("c")){const t=this._$collection.get("c");if(t)return t}const t=new Ui(this._$gl,this._$context,Wi.BLEND_CLIP(),rs.TEMPLATE(!1));return this._$collection.set("c",t),t}getBlendShader(t,e){const i=`${t}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=new Ui(this._$gl,this._$context,Wi.BLEND(),ns.TEMPLATE(t,e));return this._$collection.set(i,s),s}getInstanceBlendShader(t,e){const i=`i${t}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=new Ui(this._$gl,this._$context,Wi.INSTANCE_BLEND(),ns.INSTANCE_TEMPLATE(t,e));return this._$collection.set(i,s),s}setNormalBlendUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f){const p=t.highp;if(p[0]=e,p[1]=i,p[2]=s,p[3]=r,p[4]=n[0],p[5]=n[1],p[6]=n[2],p[8]=n[3],p[9]=n[4],p[10]=n[5],p[12]=n[6],p[13]=n[7],p[14]=n[8],p[7]=a,p[11]=h,o){const e=t.mediump;e[0]=l,e[1]=c,e[2]=_,e[3]=$,e[4]=u,e[5]=d,e[6]=g,e[7]=f}}pushNormalBlend(t,e,i,s,r,n,a,h,o=1,l=1,c=1,_=1,$=0,u=0,d=0,g=0){t.attributes.push(e/Fi,i/Fi,s/Fi,r/Fi,s,r,a,h,n[6],n[7],n[0],n[1],n[3],n[4],o,l,c,_,$,u,d,g),t.count++}setClipUniform(t,e,i,s,r,n,a,h){const o=t.highp;o[0]=e,o[1]=i,o[2]=s,o[3]=r,o[4]=n[0],o[5]=n[1],o[6]=n[2],o[8]=n[3],o[9]=n[4],o[10]=n[5],o[12]=n[6],o[13]=n[7],o[14]=n[8],o[7]=a,o[11]=h}setInstanceBlendUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m){const x=t.textures;x[0]=0,x[1]=1;const b=t.highp;if(b[0]=e,b[1]=i,b[2]=s,b[3]=r,b[4]=h[0],b[5]=h[1],b[6]=h[2],b[8]=h[3],b[9]=h[4],b[10]=h[5],b[12]=h[6],b[13]=h[7],b[14]=h[8],b[7]=o,b[11]=l,b[16]=n,b[17]=a,c){const e=t.mediump;e[0]=_,e[1]=$,e[2]=u,e[3]=d,e[4]=g,e[5]=f,e[6]=p,e[7]=m}}setBlendUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f){const p=t.textures;p[0]=0,p[1]=1;const m=t.highp;if(m[0]=e,m[1]=i,m[2]=s,m[3]=r,m[4]=n[0],m[5]=n[1],m[6]=n[2],m[8]=n[3],m[9]=n[4],m[10]=n[5],m[12]=n[6],m[13]=n[7],m[14]=n[8],m[7]=a,m[11]=h,o){const e=t.mediump;e[0]=l,e[1]=c,e[2]=_,e[3]=$,e[4]=u,e[5]=d,e[6]=g,e[7]=f}}}class hs{constructor(t,e){this._$currentProgramId=-1,this._$shapeShaderVariants=new qi(t,e),this._$gradientShapeShaderVariants=new ji(t,e),this._$gradientLUTShaderVariants=new Qi(t,e),this._$filterShaderVariants=new ss(t,e),this._$blendShaderVariants=new as(t,e)}get currentProgramId(){return this._$currentProgramId}set currentProgramId(t){this._$currentProgramId=t}get shapeShaderVariants(){return this._$shapeShaderVariants}get gradientShapeShaderVariants(){return this._$gradientShapeShaderVariants}get gradientLUTShaderVariants(){return this._$gradientLUTShaderVariants}get filterShaderVariants(){return this._$filterShaderVariants}get blendShaderVariants(){return this._$blendShaderVariants}}class os{constructor(t,e){this._$context=t,this._$gl=e,this._$attachment=t.frameBuffer.createTextureAttachment(512,1),this._$maxLength=v.floor(.75*e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),this._$rgbToLinearTable=new Float32Array(256),this._$rgbIdentityTable=new Float32Array(256);for(let t=0;t<256;t++){const e=t/255;this._$rgbToLinearTable[t]=v.pow(e,2.23333333),this._$rgbIdentityTable[t]=e}}generateForShape(t,e){const i=this._$context.frameBuffer.currentAttachment,s=this._$context.cachePosition;s&&this._$gl.disable(this._$gl.SCISSOR_TEST),this._$context._$bind(this._$attachment);const r=t.length,n=this._$context.shaderList.gradientLUTShaderVariants,a=e?this._$rgbToLinearTable:this._$rgbIdentityTable;this._$context.blend.toOneZero();for(let i=0;i<r;i+=this._$maxLength-1){const s=v.min(i+this._$maxLength,r),h=n.getGradientLUTShader(s-i,e),o=h.uniform;n.setGradientLUTUniformForShape(o,t,i,s,a),h._$drawGradient(0===i?0:t[i][0],s===r?1:t[s-1][0])}if(this._$context._$bind(i),!this._$attachment.texture)throw new Error("the texture is null.");return s&&this._$context.bindRenderBuffer(s),this._$attachment.texture}generateForFilter(t,e,i){const s=this._$context.frameBuffer.currentAttachment;this._$context._$bind(this._$attachment);const r=t.length,n=this._$context.shaderList.gradientLUTShaderVariants;this._$context.blend.toOneZero();for(let s=0;s<r;s+=this._$maxLength-1){const a=v.min(s+this._$maxLength,r),h=n.getGradientLUTShader(a-s,!1),o=h.uniform;n.setGradientLUTUniformForFilter(o,t,e,i,s,a),h._$drawGradient(0===s?0:t[s],a===r?1:t[a-1])}if(this._$context._$bind(s),!this._$attachment.texture)throw new Error("the texture is null.");return this._$attachment.texture}}class ls{static get indexRangePool(){return this._$indexRangePool}static generate(t){let e=0;for(let i=0;i<t.length;++i)e+=12*(t[i].length/3-2);this._$vertexBufferData=new A(e),this._$indexRanges=nt(),this._$currentIndex=0;for(let e=0;e<t.length;++e){const i=this._$currentIndex;this._$generateMesh(t[e]);const s=this._$currentIndex-i,r=this._$indexRangePool.pop()||{first:0,count:0};r.first=i,r.count=s,this._$indexRanges.push(r)}return{vertexBufferData:this._$vertexBufferData,indexRanges:this._$indexRanges}}static _$generateMesh(t){const e=this._$vertexBufferData;let i=this._$currentIndex;const s=t.length-5;for(let r=3;r<s;r+=3){let s=4*i;t[r+2]?(e[s++]=t[r-3],e[s++]=t[r-2],e[s++]=0,e[s++]=0,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=0,e[s++]=t[r+3],e[s++]=t[r+4],e[s++]=1,e[s++]=1):t[r+5]?(e[s++]=t[0],e[s++]=t[1],e[s++]=.5,e[s++]=.5,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=.5,e[s++]=t[r+6],e[s++]=t[r+7],e[s++]=.5,e[s++]=.5):(e[s++]=t[0],e[s++]=t[1],e[s++]=.5,e[s++]=.5,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=.5,e[s++]=t[r+3],e[s++]=t[r+4],e[s++]=.5,e[s++]=.5),i+=3}this._$currentIndex=i}}ls._$indexRangePool=nt();class cs{static generate(t,e,i){this._$vertexBufferData=this._$vertexBufferData||new A(1024),this._$vertexBufferPos=0,this._$indexBufferData=this._$indexBufferData||new Int16Array(256),this._$indexBufferPos=0,this._$lineCap=e,this._$lineJoin=i;for(let e=0;e<t.length;e++){const i=this._$vertexBufferPos;this._$generateLineSegment(t[e]);const s=this._$vertexBufferPos;this._$generateLineJoin(i,s),this._$generateLineCap(i,s)}return{vertexBufferData:this._$vertexBufferData.slice(0,this._$vertexBufferPos),indexBufferData:this._$indexBufferData.slice(0,this._$indexBufferPos)}}static _$expandVertexBufferIfNeeded(t){if(this._$vertexBufferPos+t>this._$vertexBufferData.length){const t=new A(2*this._$vertexBufferData.length);t.set(this._$vertexBufferData),this._$vertexBufferData=t}}static _$expandIndexBufferIfNeeded(t){if(this._$indexBufferPos+t>this._$indexBufferData.length){const t=new S(2*this._$indexBufferData.length);t.set(this._$indexBufferData),this._$indexBufferData=t}}static _$generateLineSegment(t){const e=t.length-5;for(let i=0;i<e;i+=3)t[i+2]||(t[i+5]?this._$addQuadSegmentMesh(t[i],t[i+1],t[i+3],t[i+4],t[i+6],t[i+7]):this._$addLineSegmentMesh(t[i],t[i+1],t[i+3],t[i+4]))}static _$addQuadSegmentMesh(t,e,i,s,r,n){let a=t,h=e;for(let o=1;o<11;o++){const l=o/11,c=1-l,_=(t*c+i*l)*c+(i*c+r*l)*l,$=(e*c+s*l)*c+(s*c+n*l)*l;this._$addLineSegmentMesh(a,h,_,$,2),a=_,h=$}this._$addLineSegmentMesh(a,h,r,n)}static _$addLineSegmentMesh(t,e,i,s,r=1){const n=this._$vertexBufferPos/7,a=n+1,h=n+2,o=n+3;this._$expandIndexBufferIfNeeded(6);const l=this._$indexBufferData;let c=this._$indexBufferPos;l[c++]=n,l[c++]=a,l[c++]=o,l[c++]=o,l[c++]=h,l[c++]=n,this._$indexBufferPos=c,this._$expandVertexBufferIfNeeded(28);const _=this._$vertexBufferData;let $=this._$vertexBufferPos;_[$++]=t,_[$++]=e,_[$++]=i,_[$++]=s,_[$++]=1,_[$++]=1,_[$++]=1,_[$++]=t,_[$++]=e,_[$++]=i,_[$++]=s,_[$++]=-1,_[$++]=-1,_[$++]=1,_[$++]=i,_[$++]=s,_[$++]=t,_[$++]=e,_[$++]=-1,_[$++]=-1,_[$++]=r,_[$++]=i,_[$++]=s,_[$++]=t,_[$++]=e,_[$++]=1,_[$++]=1,_[$++]=r,this._$vertexBufferPos=$}static _$generateLineJoin(t,e){const i=this._$vertexBufferData,s=e-55;for(let e=t;e<s;e+=28){const t=e/7;this._$addLineJoinMesh(i[e],i[e+1],i[e+21],i[e+22],i[e+27],i[e+49],i[e+50],t+2,t+3,t+4,t+5)}}static _$addLineJoinMesh(t,e,i,s,r,n,a,h,o,l=0,c=0){const _=i-t,$=s-e,u=n-i,d=a-s,g=this._$cross(_,$,u,d);if(!(v.abs(g)<1e-4))if(2!==r)switch(this._$lineJoin){case"round":this._$addRoundJoinMesh(i,s);break;case"miter":this._$addMiterJoinMesh(i,s,t,e,n,a,l,h,o,c);break;default:this._$addBevelJoinMesh(i,s,l,h,o,c)}else this._$addBevelJoinMesh(i,s,l,h,o,c)}static _$addRoundJoinMesh(t,e){const i=this._$vertexBufferPos/7;this._$expandIndexBufferIfNeeded(57);const s=this._$indexBufferData;let r=this._$indexBufferPos;for(let t=1;t<18;t++){const e=i+t;s[r++]=i,s[r++]=e,s[r++]=e+1}s[r++]=i,s[r++]=i+18,s[r++]=i+1,this._$indexBufferPos=r,this._$expandVertexBufferIfNeeded(133);const n=this._$vertexBufferData;let a=this._$vertexBufferPos;n[a++]=t,n[a++]=e,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0;for(let i=0;i<18;i++)n[a++]=t,n[a++]=e,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=30+i;this._$vertexBufferPos=a}static _$addMiterJoinMesh(t,e,i,s,r,n,a,h,o,l){const c=this._$vertexBufferPos/7,_=c+1,$=c+2,u=c+3,d=c+4;this._$expandIndexBufferIfNeeded(18);const g=this._$indexBufferData;let f=this._$indexBufferPos;g[f++]=c,g[f++]=a,g[f++]=_,g[f++]=c,g[f++]=_,g[f++]=$,g[f++]=c,g[f++]=$,g[f++]=h,g[f++]=c,g[f++]=o,g[f++]=u,g[f++]=c,g[f++]=u,g[f++]=d,g[f++]=c,g[f++]=d,g[f++]=l,this._$indexBufferPos=f,this._$expandVertexBufferIfNeeded(35);const p=this._$vertexBufferData;let m=this._$vertexBufferPos;p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=0,p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=21,p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=22,p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=23,p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=24,this._$vertexBufferPos=m}static _$addBevelJoinMesh(t,e,i,s,r,n){const a=this._$vertexBufferPos/7;this._$expandIndexBufferIfNeeded(6);const h=this._$indexBufferData;let o=this._$indexBufferPos;h[o++]=a,h[o++]=i,h[o++]=s,h[o++]=a,h[o++]=r,h[o++]=n,this._$indexBufferPos=o,this._$expandVertexBufferIfNeeded(7);const l=this._$vertexBufferData;let c=this._$vertexBufferPos;l[c++]=t,l[c++]=e,l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=0,this._$vertexBufferPos=c}static _$generateLineCap(t,e){const i=this._$vertexBufferData,s=i[t],r=i[t+1],n=i[t+2],a=i[t+3],h=i[e-7],o=i[e-6],l=i[e-5],c=i[e-4],_=t/7,$=e/7;s!==h||r!==o?(this._$addLineCapMesh(s,r,n,a,_,_+1),this._$addLineCapMesh(h,o,l,c,$-1,$-2)):this._$addLineJoinMesh(l,c,s,r,n,a,$-2,$-1,_,_+1)}static _$addLineCapMesh(t,e,i,s,r,n){switch(this._$lineCap){case"round":this._$addRoundJoinMesh(t,e);break;case"square":this._$addSquareCapMesh(t,e,i,s,r,n)}}static _$addSquareCapMesh(t,e,i,s,r,n){const a=this._$vertexBufferPos/7,h=a+1;this._$expandIndexBufferIfNeeded(6);const o=this._$indexBufferData;let l=this._$indexBufferPos;o[l++]=r,o[l++]=a,o[l++]=h,o[l++]=h,o[l++]=n,o[l++]=r,this._$indexBufferPos=l,this._$expandVertexBufferIfNeeded(14);const c=this._$vertexBufferData;let _=this._$vertexBufferPos;c[_++]=t,c[_++]=e,c[_++]=i,c[_++]=s,c[_++]=-1,c[_++]=-1,c[_++]=10,c[_++]=t,c[_++]=e,c[_++]=i,c[_++]=s,c[_++]=1,c[_++]=1,c[_++]=10,this._$vertexBufferPos=_}}cs._$cross=(t,e,i,s)=>t*s-i*e;class _s{constructor(t){this._$gl=t,this._$fillVertexArrayPool=[],this._$strokeVertexArrayPool=[],this._$boundVertexArray=null,this._$fillAttrib_vertex=0,this._$fillAttrib_bezier=1,this._$strokeAttrib_vertex=0,this._$strokeAttrib_option1=1,this._$strokeAttrib_option2=2,this._$strokeAttrib_type=3,this._$vertexBufferData=new Float32Array([0,0,0,1,1,0,1,1]),this._$attributeVertexBuffer=t.createBuffer(),this._$attributeBuffer=new Float32Array(22),this._$instanceVertexArray=this._$getCommonVertexArray(),this._$commonVertexArray=this._$getVertexArray(0,1)}_$getCommonVertexArray(){const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();return this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,1]),this._$gl.STATIC_DRAW),this._$gl.enableVertexAttribArray(0),this._$gl.vertexAttribPointer(0,2,this._$gl.FLOAT,!1,0,0),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,this._$attributeVertexBuffer),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$attributeBuffer.byteLength,this._$gl.DYNAMIC_DRAW),this._$gl.enableVertexAttribArray(1),this._$gl.vertexAttribPointer(1,4,this._$gl.FLOAT,!1,88,0),this._$gl.vertexAttribDivisor(1,1),this._$gl.enableVertexAttribArray(2),this._$gl.vertexAttribPointer(2,4,this._$gl.FLOAT,!1,88,16),this._$gl.vertexAttribDivisor(2,1),this._$gl.enableVertexAttribArray(3),this._$gl.vertexAttribPointer(3,2,this._$gl.FLOAT,!1,88,32),this._$gl.vertexAttribDivisor(3,1),this._$gl.enableVertexAttribArray(4),this._$gl.vertexAttribPointer(4,4,this._$gl.FLOAT,!1,88,40),this._$gl.vertexAttribDivisor(4,1),this._$gl.enableVertexAttribArray(5),this._$gl.vertexAttribPointer(5,4,this._$gl.FLOAT,!1,88,56),this._$gl.vertexAttribDivisor(5,1),this._$gl.enableVertexAttribArray(6),this._$gl.vertexAttribPointer(6,4,this._$gl.FLOAT,!1,88,72),this._$gl.vertexAttribDivisor(6,1),t}_$getVertexArray(t,e){const i=this._$gl.createVertexArray();this.bind(i);const s=this._$gl.createBuffer();return this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,s),this._$vertexBufferData[0]=t,this._$vertexBufferData[2]=t,this._$vertexBufferData[4]=e,this._$vertexBufferData[6]=e,this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$vertexBufferData,this._$gl.STATIC_DRAW),this._$gl.enableVertexAttribArray(0),this._$gl.vertexAttribPointer(0,2,this._$gl.FLOAT,!1,0,0),i}_$getFillVertexArray(){if(this._$fillVertexArrayPool.length){const t=this._$fillVertexArrayPool.pop();if(t)return t}const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();return t.vertexBuffer=e,t.vertexLength=0,this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e),this._$gl.enableVertexAttribArray(0),this._$gl.enableVertexAttribArray(1),this._$gl.vertexAttribPointer(this._$fillAttrib_vertex,2,this._$gl.FLOAT,!1,16,0),this._$gl.vertexAttribPointer(this._$fillAttrib_bezier,2,this._$gl.FLOAT,!1,16,8),t}_$getStrokeVertexArray(){if(this._$strokeVertexArrayPool.length){const t=this._$strokeVertexArrayPool.pop();if(t)return t}const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();t.vertexBuffer=e,t.vertexLength=0,this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e);const i=this._$gl.createBuffer();return t.indexBuffer=i,t.indexLength=0,this._$gl.bindBuffer(this._$gl.ELEMENT_ARRAY_BUFFER,i),this._$gl.enableVertexAttribArray(0),this._$gl.enableVertexAttribArray(1),this._$gl.enableVertexAttribArray(2),this._$gl.enableVertexAttribArray(3),this._$gl.vertexAttribPointer(this._$strokeAttrib_vertex,2,this._$gl.FLOAT,!1,28,0),this._$gl.vertexAttribPointer(this._$strokeAttrib_option1,2,this._$gl.FLOAT,!1,28,8),this._$gl.vertexAttribPointer(this._$strokeAttrib_option2,2,this._$gl.FLOAT,!1,28,16),this._$gl.vertexAttribPointer(this._$strokeAttrib_type,1,this._$gl.FLOAT,!1,28,24),t}createFill(t){const e=ls.generate(t),i=e.vertexBufferData,s=this._$getFillVertexArray();return s.indexRanges=e.indexRanges,this.bind(s),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,s.vertexBuffer),s.vertexLength<i.length&&(s.vertexLength=lt(i.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,4*s.vertexLength,this._$gl.DYNAMIC_DRAW)),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,i),s}createStroke(t,e,i){const s=cs.generate(t,e,i),r=s.vertexBufferData,n=s.indexBufferData,a=this._$getStrokeVertexArray();return a.indexCount=n.length,this.bind(a),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,a.vertexBuffer),this._$gl.bindBuffer(this._$gl.ELEMENT_ARRAY_BUFFER,a.indexBuffer),a.vertexLength<r.length&&(a.vertexLength=lt(r.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,4*a.vertexLength,this._$gl.DYNAMIC_DRAW)),a.indexLength<n.length&&(a.indexLength=lt(n.length),this._$gl.bufferData(this._$gl.ELEMENT_ARRAY_BUFFER,2*a.indexLength,this._$gl.DYNAMIC_DRAW)),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,r),this._$gl.bufferSubData(this._$gl.ELEMENT_ARRAY_BUFFER,0,n),a}releaseFill(t){this._$fillVertexArrayPool.push(t)}releaseStroke(t){this._$strokeVertexArrayPool.push(t)}bind(t=null){t!==this._$boundVertexArray&&(this._$boundVertexArray=t,this._$gl.bindVertexArray(t))}bindInstnceArray(t){this.bind(this._$instanceVertexArray),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,this._$attributeVertexBuffer),t.attributes.length>this._$attributeBuffer.length&&(this._$attributeBuffer=new Float32Array(t.attributes.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$attributeBuffer.byteLength,this._$gl.DYNAMIC_DRAW)),this._$attributeBuffer.set(t.attributes),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,this._$attributeBuffer.subarray(0,t.attributes.length))}bindCommonVertexArray(){this.bind(this._$commonVertexArray)}bindGradientVertexArray(t,e){const i=this._$getVertexArray(t,e);this.bind(i)}}class $s{constructor(t,e){this._$context=t,this._$gl=e,this._$clips=[],this._$poolClip=[],this._$clipStatus=!1,this._$containerClip=!1,this._$currentClip=!1}get containerClip(){return this._$containerClip}set containerClip(t){this._$containerClip=t}_$onClear(t){t&&(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0)}_$onBind(t){!t&&this._$currentClip?(this._$gl.disable(this._$gl.STENCIL_TEST),this._$currentClip=!1):t&&!this._$currentClip&&(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0,this._$endClipDef())}_$onClearRect(){this._$gl.disable(this._$gl.STENCIL_TEST),this._$currentClip=!1}_$enterClip(){this._$currentClip||(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0);const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");t.mask=!0,++t.clipLevel}_$beginClipDef(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.stencilMask(1<<t.clipLevel-1),this._$gl.colorMask(!1,!1,!1,!1)}_$endClipDef(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");const e=t.clipLevel;let i=0;for(let t=0;t<e;++t)i|=(1<<e-t)-1;this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.EQUAL,255&i,i),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.KEEP,this._$gl.KEEP),this._$gl.stencilMask(255),this._$gl.colorMask(!0,!0,!0,!0)}_$leaveClip(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");if(--t.clipLevel,t.mask=!!t.clipLevel,!t.clipLevel)return void this._$context._$clearRectStencil();const e=t.width,i=t.height,s=this._$context.path.createRectVertices(0,0,e,i),r=this._$context.vao.createFill(s);at(s.pop()),at(s);const n=this._$context.shaderList.shapeShaderVariants,a=n.getMaskShapeShader(!1,!1),h=a.uniform;n.setMaskShapeUniformIdentity(h,e,i);const o=r.indexRanges[0];this._$currentClip||(this._$currentClip=!0,this._$gl.enable(this._$gl.STENCIL_TEST)),this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.REPLACE,this._$gl.REPLACE,this._$gl.REPLACE),this._$gl.stencilMask(1<<t.clipLevel),this._$gl.colorMask(!1,!1,!1,!1),a._$containerClip(r,o.first,o.count);const l=r.indexRanges;for(let t=0;t<l.length;++t)ls.indexRangePool.push(l[t]);at(r.indexRanges),this._$context.vao.releaseFill(r),this._$endClipDef()}_$drawContainerClip(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");const e=t.clipLevel,i=this._$context.shaderList.shapeShaderVariants,s=i.getMaskShapeShader(!1,!1),r=s.uniform;let n=e;const a=t.width,h=t.height;this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.colorMask(!1,!1,!1,!1);const o=this._$poolClip.length;for(let t=0;t<o;++t){const t=this._$poolClip.shift();if(!t)continue;i.setMaskShapeUniform(r,!1,t.matrixA,t.matrixB,t.matrixC,t.matrixD,t.matrixE,t.matrixF,t.matrixG,t.matrixH,t.matrixI,t.viewportWidth,t.viewportHeight,null);const o=t.vertexArrayObject.indexRanges;for(let e=0;e<o.length;++e){const i=o[e];this._$gl.stencilMask(1<<n-1),s._$containerClip(t.vertexArrayObject,i.first,i.count),ls.indexRangePool.push(i)}at(o),this._$context.vao.releaseFill(t.vertexArrayObject),++n,n>7&&(this._$unionStencilMask(e,a,h),n=e)}n>e+1&&this._$unionStencilMask(e,a,h)}_$unionStencilMask(t,e,i){const s=this._$context.path.createRectVertices(0,0,e,i),r=this._$context.vao.createFill(s);at(s.pop()),at(s);const n=this._$context.shaderList.shapeShaderVariants,a=n.getMaskShapeShader(!1,!1),h=a.uniform;n.setMaskShapeUniformIdentity(h,e,i);const o=r.indexRanges[0];this._$gl.stencilFunc(this._$gl.LEQUAL,1<<t-1,255),this._$gl.stencilOp(this._$gl.ZERO,this._$gl.REPLACE,this._$gl.REPLACE),this._$gl.stencilMask(~((1<<t-1)-1)),a._$containerClip(r,o.first,o.count),this._$poolClip.length&&(this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT));const l=r.indexRanges;for(let t=0;t<l.length;++t)ls.indexRangePool.push(l[t]);at(r.indexRanges),this._$context.vao.releaseFill(r)}_$onClip(t,e,i,s){return this._$clipStatus=!0,!!this._$containerClip&&(this._$poolClip.push({vertexArrayObject:t,matrixA:e[0],matrixB:e[1],matrixC:e[2],matrixD:e[3],matrixE:e[4],matrixF:e[5],matrixG:e[6],matrixH:e[7],matrixI:e[8],viewportWidth:i,viewportHeight:s}),!0)}_$onSave(){this._$clips.push(this._$clipStatus)}_$onRestore(){this._$clips.length&&(this._$clipStatus=!!this._$clips.pop())}}class us{constructor(t,e){this._$context=t,this._$gl=e,this._$enabled=!1,this._$funcCode=600,this._$currentOperation="normal",this._$currentIndex=-1,this._$currentSmoothing=null,this._$variants=t.shaderList.blendShaderVariants,this._$instanceShader=this._$variants.getInstanceShader(),this.enable()}enable(){this._$enabled||(this._$enabled=!0,this._$gl.enable(this._$gl.BLEND)),this.reset()}disable(){this._$enabled&&(this._$enabled=!1,this._$gl.disable(this._$gl.BLEND))}reset(){613!==this._$funcCode&&(this._$funcCode=613,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ONE_MINUS_SRC_ALPHA))}toOneZero(){610!==this._$funcCode&&(this._$funcCode=610,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ZERO))}toZeroOne(){601!==this._$funcCode&&(this._$funcCode=601,this._$gl.blendFuncSeparate(this._$gl.ZERO,this._$gl.ONE,this._$gl.ONE,this._$gl.ZERO))}toAdd(){611!==this._$funcCode&&(this._$funcCode=611,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ONE))}toScreen(){641!==this._$funcCode&&(this._$funcCode=641,this._$gl.blendFunc(this._$gl.ONE_MINUS_DST_COLOR,this._$gl.ONE))}toAlpha(){606!==this._$funcCode&&(this._$funcCode=606,this._$gl.blendFunc(this._$gl.ZERO,this._$gl.SRC_ALPHA))}toErase(){603!==this._$funcCode&&(this._$funcCode=603,this._$gl.blendFunc(this._$gl.ZERO,this._$gl.ONE_MINUS_SRC_ALPHA))}toSourceAtop(){673!==this._$funcCode&&(this._$funcCode=673,this._$gl.blendFunc(this._$gl.DST_ALPHA,this._$gl.ONE_MINUS_SRC_ALPHA))}toSourceIn(){670!==this._$funcCode&&(this._$funcCode=670,this._$gl.blendFunc(this._$gl.DST_ALPHA,this._$gl.ZERO))}toOperation(t){switch(t){case"add":this.toAdd();break;case"screen":this.toScreen();break;case"alpha":this.toAlpha();break;case"erase":this.toErase();break;case"copy":this.toOneZero();break;default:this.reset()}}clearInstacedArray(){const t=this._$instanceShader.instance;t.count&&t.clear()}drawInstacedArray(){const t=this._$instanceShader.instance;if(!t.count)return;const e=this._$context.frameBuffer,i=e.textureManager.getAtlasTexture(this._$currentIndex);e.textureManager.bind0(i,this._$currentSmoothing),this.toOperation(this._$currentOperation),this._$instanceShader.drawArraysInstanced(t),t.clear()}drawInstance(t,e,i,s,r,n,a,h,o,l,c,_,$,u){this._$currentOperation||(this._$currentOperation=l),-1===this._$currentIndex&&(this._$currentIndex=t.index),null===this._$currentSmoothing&&(this._$currentSmoothing=u),this._$currentOperation===l&&this._$currentIndex===t.index&&this._$currentSmoothing===u||(this.drawInstacedArray(),this._$currentOperation=l,this._$currentIndex=t.index,this._$currentSmoothing=u),this._$variants.pushNormalBlend(this._$instanceShader.instance,t.x,t.y,t.w,t.h,$,c,_,e,i,s,r,n,a,h,o)}drawInstanceBlend(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m){this.drawInstacedArray();const x=this._$context.frameBuffer,b=x.currentAttachment,T=1!==n||1!==a||1!==h||1!==o||0!==l||0!==c||0!==_||0!==$,y=x.getTextureFromCurrentAttachment(),E=this._$context.frameBuffer.createTextureAttachment(u.w,u.h);this._$context._$bind(E),x.textureManager.bind0(y);const A=this._$variants.getClipShader(),M=A.uniform;this._$variants.setClipUniform(M,0,0,u.w,u.h,_t(p),g,f),this.reset(),A._$drawImage();const S=x.getTextureFromCurrentAttachment();this._$context._$bind(b),x.textureManager.bind01(S,t,m);const w=this._$variants.getInstanceBlendShader(d,T);this._$variants.setInstanceBlendUniform(w.uniform,u.x/t.width,u.y/t.height,u.w/t.width,u.h/t.height,u.w,u.h,p,g,f,T,n,a,h,o,l,c,_,$);const C=v.abs(s-e),F=v.abs(r-i);this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(e,f-(i+F),C,F),this.toOneZero(),w._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST),x.releaseAttachment(E,!0)}drawImage(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p){const m=this._$context.frameBuffer,x=m.currentAttachment,b=1!==n||1!==a||1!==h||1!==o||0!==l||0!==c||0!==_||0!==$;switch(u){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":{m.textureManager.bind0(t,p);const x=this._$variants.getNormalBlendShader(b);this._$variants.setNormalBlendUniform(x.uniform,e,i,s,r,f,d,g,b,n,a,h,o,l,c,_,$);const T=f[0],y=f[1],A=f[3],M=f[4],S=f[6],w=f[7];if(1!==T||0!==y||0!==A||1!==M){const t=e+s,n=i+r,a=+(t*T+n*A+S),h=+(t*T+i*A+S),o=+(e*T+n*A+S),l=+(e*T+i*A+S),c=+(t*y+n*M+w),_=+(t*y+i*M+w),$=+(e*y+n*M+w),u=+(e*y+i*M+w),f=E.MAX_VALUE,p=+v.min(v.min(v.min(v.min(f,a),h),o),l),m=+v.max(v.max(v.max(v.max(-f,a),h),o),l),x=+v.min(v.min(v.min(v.min(f,c),_),$),u),b=+v.max(v.max(v.max(v.max(-f,c),_),$),u),C=v.max(0,p),F=v.max(0,x),R=v.min(v.max(0,d-C),v.ceil(v.abs(m-p))),B=v.min(v.max(0,g-F),v.ceil(v.abs(b-x)));if(!R||!B)return;this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(C,v.max(0,g-(F+B)),R+1,B+1)}else{const t=v.max(0,e+S),n=v.max(0,i+w),a=v.min(v.max(0,d-t),s),h=v.min(v.max(0,g-n),r);if(!a||!h)return;this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t,v.max(0,g-(n+h)),a+1,h+1)}this.toOperation(u),x._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST)}break;default:{const T=v.max(0,e+f[6]),y=v.max(0,i+f[7]),E=v.min(v.max(0,d-T),s),A=v.min(v.max(0,g-y),r);if(!E||!A)return;const M=m.getTextureFromCurrentAttachment(),S=this._$context.frameBuffer.createTextureAttachment(s,r);this._$context._$bind(S),m.textureManager.bind0(M);const w=this._$variants.getClipShader(),C=w.uniform;this._$variants.setClipUniform(C,e,i,s,r,_t(f),d,g),this.reset(),w._$drawImage();const F=m.getTextureFromCurrentAttachment();this._$context._$bind(x),m.textureManager.bind01(F,t,p);const R=this._$variants.getBlendShader(u,b);this._$variants.setBlendUniform(R.uniform,e,i,s,r,f,d,g,b,n,a,h,o,l,c,_,$),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(T,v.max(0,g-(y+A)),E,A),this.toOneZero(),R._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST),m.releaseAttachment(S,!0)}}}}class ds{constructor(t,e){var i;i=t.getParameter(t.MAX_TEXTURE_SIZE),Fi=Math.min(4096,i/2),this._$gl=t;const s=v.min(e,t.getParameter(t.MAX_SAMPLES));this._$maxTextureSize=v.min(8192,t.getParameter(t.MAX_TEXTURE_SIZE))-2,this._$contextStyle=new Ci,this._$cacheBounds=K(),this._$matrix=rt(1,0,0,0,1,0,0,0,1),this._$cacheAttachment=null,this._$stack=[],this._$globalAlpha=1,this._$imageSmoothingEnabled=!1,this._$globalCompositeOperation="normal",this._$clearColorR=1,this._$clearColorG=1,this._$clearColorB=1,this._$clearColorA=1,this._$viewportWidth=0,this._$viewportHeight=0,this._$frameBufferManager=new Li(t,s),this._$path=new Oi,this._$grid=new ki,this._$offsetX=0,this._$offsetY=0,this._$blends=nt(),this._$positions=nt(),this._$isLayer=!1,this._$shaderList=new hs(this,t),this._$gradientLUT=new os(this,t),this._$vao=new _s(t),this._$mask=new $s(this,t),this._$blend=new us(this,t),this._$attachmentArray=[],this._$maskBounds=K(0,0,0,0),this._$cachePosition=null}get cachePosition(){return this._$cachePosition}set cachePosition(t){this._$cachePosition=t}reset(){this._$globalAlpha=1,this._$globalCompositeOperation="normal",this._$imageSmoothingEnabled=!1,this._$contextStyle.clear()}get isLayer(){return this._$isLayer}get canvas(){return this._$gl.canvas}get cacheAttachment(){return this._$cacheAttachment}set cacheAttachment(t){this._$cacheAttachment=t}get cacheBounds(){return this._$cacheBounds}get fillStyle(){return this._$contextStyle.fillStyle}set fillStyle(t){this._$contextStyle.fillStyle=t}get strokeStyle(){return this._$contextStyle.strokeStyle}set strokeStyle(t){this._$contextStyle.strokeStyle=t}get lineWidth(){return this._$contextStyle.lineWidth}set lineWidth(t){this._$contextStyle.lineWidth=t}get lineCap(){return this._$contextStyle.lineCap}set lineCap(t){this._$contextStyle.lineCap=t}get lineJoin(){return this._$contextStyle.lineJoin}set lineJoin(t){this._$contextStyle.lineJoin=t}get miterLimit(){return this._$contextStyle.miterLimit}set miterLimit(t){this._$contextStyle.miterLimit=t}get globalAlpha(){return this._$globalAlpha}set globalAlpha(t){this._$globalAlpha=$t(t,0,1,1)}get imageSmoothingEnabled(){return this._$imageSmoothingEnabled}set imageSmoothingEnabled(t){this._$imageSmoothingEnabled=t}get globalCompositeOperation(){return this._$globalCompositeOperation}set globalCompositeOperation(t){this._$globalCompositeOperation=t}get frameBuffer(){return this._$frameBufferManager}get shaderList(){return this._$shaderList}get path(){return this._$path}get grid(){return this._$grid}get vao(){return this._$vao}get blend(){return this._$blend}_$getCurrentPosition(){return this._$positions[this._$positions.length-1]}_$getTextureScale(t,e){const i=v.max(t,e);return i>this._$maxTextureSize?this._$maxTextureSize/i:1}drawInstacedArray(){this.blend.drawInstacedArray()}clearInstacedArray(){this.blend.clearInstacedArray()}bindRenderBuffer(t){this._$frameBufferManager.bindRenderBuffer(),this._$gl.clearColor(0,0,0,0),this._$gl.clear(this._$gl.COLOR_BUFFER_BIT|this._$gl.STENCIL_BUFFER_BIT),this._$viewportWidth=t.w,this._$viewportHeight=t.h,this._$gl.viewport(t.x,t.y,t.w,t.h),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t.x,t.y,t.w,t.h)}getTextureFromRect(t){const e=this._$frameBufferManager,i=e.textureManager.getAtlasTexture(t.index),s=e.currentAttachment,r=e.createTextureAttachment(t.w,t.h);this._$bind(r),this.save(),this.setTransform(1,0,0,1,0,0),this.reset(),this.drawImage(i,-t.x,-i.height+t.h+t.y,i.width,i.height),this.restore();const n=r.texture;return e.releaseAttachment(r),this._$bind(s),n}drawBitmap(t){const e=this._$shaderList.blendShaderVariants,i=e.getNormalBlendShader(!1);e.setNormalBlendUniform(i.uniform,0,0,t.width,t.height,this._$matrix,this._$viewportWidth,this._$viewportHeight,!1,1,1,1,1,0,0,0,0),this._$frameBufferManager.textureManager.bind0(t,this._$imageSmoothingEnabled),this.blend.toOperation("normal"),i._$drawImage()}drawTextureFromRect(t,e){const i=this._$frameBufferManager,s=i.currentAttachment;this.bindRenderBuffer(e),i.transferTexture(e);const r=i.textureManager.getAtlasTexture(e.index),n=i.createTextureAttachmentFrom(r);this._$bind(n),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(e.x,e.y,e.w,e.h),this._$gl.clearColor(0,0,0,0),this._$gl.disable(this._$gl.SCISSOR_TEST),this.save(),this.setTransform(1,0,0,1,0,0),this.reset(),this.drawImage(t,e.x,r.height-e.h-e.y,t.width,t.height),this.restore(),i.releaseAttachment(n),this._$bind(s),i.textureManager.release(t)}stopStencil(){this._$mask._$onClearRect()}_$bind(t=null){if(!t)return;this._$frameBufferManager.bind(t);const e=t.color,i=t.stencil,s=t.width,r=t.height;this._$viewportWidth===s&&this._$viewportHeight===r||(this._$viewportWidth=s,this._$viewportHeight=r,this._$gl.viewport(0,0,s,r)),(e&&e.dirty||i&&i.dirty)&&(e&&(e.dirty=!1),i&&(i.dirty=!1),this._$gl.clearColor(0,0,0,0),this.clearRect(0,0,this._$viewportWidth,this._$viewportHeight),this._$gl.clearColor(this._$clearColorR,this._$clearColorG,this._$clearColorB,this._$clearColorA),this._$mask._$onClear(t.mask)),this._$mask._$onBind(t.mask)}setTransform(t,e,i,s,r,n){this._$matrix[0]=t,this._$matrix[1]=e,this._$matrix[3]=i,this._$matrix[4]=s,this._$matrix[6]=r,this._$matrix[7]=n}setMaxSize(t,e){this._$frameBufferManager.setMaxSize(t,e)}transform(t,e,i,s,r,n){const a=this._$matrix[0],h=this._$matrix[1],o=this._$matrix[3],l=this._$matrix[4],c=this._$matrix[6],_=this._$matrix[7];this._$matrix[0]=t*a+e*o,this._$matrix[1]=t*h+e*l,this._$matrix[3]=i*a+s*o,this._$matrix[4]=i*h+s*l,this._$matrix[6]=r*a+n*o+c,this._$matrix[7]=r*h+n*l+_}debug(t=0){const e=this._$frameBufferManager,i=e.textureManager.getAtlasTexture(t),s=e.currentAttachment,r=e.createTextureAttachmentFrom(i);this._$bind(r);const n=new Uint8Array(i.width*i.height*4);this._$gl.readPixels(0,0,i.width,i.height,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,n);const a=document.createElement("canvas");a.width=i.width,a.height=i.height;const h=a.getContext("2d"),o=new ImageData(i.width,i.height);for(let t=0;t<n.length;++t)o.data[t]=n[t];null==h||h.putImageData(o,0,0),console.log(a.toDataURL()),this._$bind(s),e.releaseAttachment(r)}drawInstance(t,e,i,s,r){let n=1,a=1,h=1,o=0,l=0,c=0;const _=this._$globalAlpha;r&&(n=r[0],a=r[1],h=r[2],o=r[4]/255,l=r[5]/255,c=r[6]/255);const $=this._$cachePosition;if($)switch(this._$globalCompositeOperation){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":this.blend.drawInstance($,n,a,h,_,o,l,c,0,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled);break;default:{const r=this._$frameBufferManager.textureManager.getAtlasTexture($.index);this.blend.drawInstanceBlend(r,t,e,i,s,n,a,h,_,o,l,c,0,$,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled)}}}drawImage(t,e,i,s,r,n=null){let a=1,h=1,o=1,l=0,c=0,_=0;const $=this._$globalAlpha;n&&(a=n[0],h=n[1],o=n[2],l=n[4]/255,c=n[5]/255,_=n[6]/255),this.blend.drawImage(t,e,i,s,r,a,h,o,$,l,c,_,0,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled)}_$setColor(t=0,e=0,i=0,s=0){this._$clearColorR=t,this._$clearColorG=e,this._$clearColorB=i,this._$clearColorA=s,this._$gl.clearColor(t,e,i,s)}clearRect(t,e,i,s){this._$mask._$onClearRect(),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t,e,i,s),this._$gl.clear(this._$gl.COLOR_BUFFER_BIT|this._$gl.STENCIL_BUFFER_BIT),this._$gl.disable(this._$gl.SCISSOR_TEST)}_$clearRectStencil(){this._$mask._$onClearRect(),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(this._$maskBounds.xMin,this._$maskBounds.yMin,this._$maskBounds.xMax,this._$maskBounds.yMax),this._$gl.clear(this._$gl.STENCIL_BUFFER_BIT),this._$gl.disable(this._$gl.SCISSOR_TEST)}moveTo(t,e){this._$path.moveTo(t,e)}lineTo(t,e){this._$path.lineTo(t,e)}beginPath(){this._$path.begin()}quadraticCurveTo(t,e,i,s){this._$path.quadTo(t,e,i,s)}bezierCurveTo(t,e,i,s,r,n){this._$path.cubicTo(t,e,i,s,r,n)}fill(){const t=this._$path.vertices;if(!t.length)return;const e=nt();for(let i=0;i<t.length;++i){const s=t[i];10>s.length||e.push(s)}if(!e.length)return void at(e);const i=this._$vao.createFill(e),s=this.fillStyle;let r,n,a,h=this._$matrix;const o=this._$grid.enabled;if(s instanceof Si){const t=s.stops,e="linearRGB"===s.rgb;if(r=this._$gradientLUT.generateForShape(t,e),this._$frameBufferManager.textureManager.bind0(r,!0),this._$frameBufferManager.bindRenderBuffer(),n=this._$shaderList.gradientShapeShaderVariants,"linear"===s.type)a=n.getGradientShapeShader(!1,o,!1,!1,s.mode),n.setGradientShapeUniform(a.uniform,!1,0,0,0,o,h,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!1,s.points,0);else{h=this._$stack[this._$stack.length-1];const t=0!==s.focalPointRatio;a=n.getGradientShapeShader(!1,o,!0,t,s.mode),n.setGradientShapeUniform(a.uniform,!1,0,0,0,o,h,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!0,s.points,s.focalPointRatio)}}else if(s instanceof wi){h=this._$stack[this._$stack.length-1];const t=s.colorTransform;r=s.texture,this._$frameBufferManager.textureManager.bind0(r,this._$imageSmoothingEnabled),n=this._$shaderList.shapeShaderVariants,a=n.getBitmapShapeShader(!1,s.repeat,o),t?n.setBitmapShapeUniform(a.uniform,!1,0,0,0,o,h,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,r.width,r.height,t[0],t[1],t[2],this._$globalAlpha,t[4]/255,t[5]/255,t[6]/255,0):n.setBitmapShapeUniform(a.uniform,!1,0,0,0,o,h,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,r.width,r.height,1,1,1,this._$globalAlpha,0,0,0,0)}else n=this._$shaderList.shapeShaderVariants,a=n.getSolidColorShapeShader(!1,this._$grid.enabled),n.setSolidColorShapeUniform(a.uniform,!1,0,0,0,o,h,this._$viewportWidth,this._$viewportHeight,this._$grid,s,this._$globalAlpha);const l=this._$shaderList.shapeShaderVariants,c=l.getMaskShapeShader(!1,o);l.setMaskShapeUniform(c.uniform,o,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],this._$viewportWidth,this._$viewportHeight,this._$grid),this._$gl.enable(this._$gl.STENCIL_TEST),this._$gl.stencilMask(255),this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.colorMask(!1,!1,!1,!1),c._$fill(i),this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.NOTEQUAL,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.ZERO,this._$gl.ZERO),this._$gl.colorMask(!0,!0,!0,!0),a._$fill(i),this._$gl.disable(this._$gl.STENCIL_TEST),this.releaseFillVertexArray(i)}releaseFillVertexArray(t){this._$vao.releaseFill(t);const e=t.indexRanges;for(let t=0;t<e.length;++t)ls.indexRangePool.push(e[t]);at(e)}_$enterClip(){this._$mask._$enterClip()}_$beginClipDef(){this._$mask._$beginClipDef()}_$updateContainerClipFlag(t){this._$mask.containerClip=t}_$startClip(t){const e=t.xMin,i=t.yMin,s=Math.abs(t.xMax-t.xMin),r=Math.abs(t.yMax-t.yMin),n=this._$frameBufferManager.currentAttachment;if(!n)throw new Error("the current Attachment is null.");return!(e>n.width||i>n.height||0>e&&0>=s+e||0>i&&0>=r+i||(this._$maskBounds.xMin=v.max(0,v.min(this._$maskBounds.xMin,e)),this._$maskBounds.yMin=v.max(0,v.min(this._$maskBounds.yMin,i)),this._$maskBounds.xMax=v.min(n.width,v.min(this._$maskBounds.xMax,s)),this._$maskBounds.yMax=v.min(n.height,v.min(this._$maskBounds.yMax,r)),0))}_$endClipDef(){this._$mask._$endClipDef()}_$leaveClip(){this.drawInstacedArray(),this._$mask._$leaveClip()}_$drawContainerClip(){this._$mask._$drawContainerClip()}closePath(){this._$path.close()}stroke(){const t=this._$path.vertices;if(!t.length)return;const e=nt();for(let i=0;i<t.length;++i){const s=t[i];6>s.length||e.push(s)}if(!e.length)return void at(e);const i=this._$vao.createStroke(t,this.lineCap,this.lineJoin);let s=this._$matrix;const r=this.strokeStyle;let n=v.sign(s[0]*s[4]);n>0&&0!==s[1]&&0!==s[3]&&(n=-v.sign(s[1]*s[3]));let a,h,o=.5*this.lineWidth;this._$grid.enabled?(a=v.abs(this._$grid.ancestorMatrixA+this._$grid.ancestorMatrixD),h=v.abs(this._$grid.ancestorMatrixB+this._$grid.ancestorMatrixE)):(a=v.abs(s[0]+s[3]),h=v.abs(s[1]+s[4]));const l=v.min(a,h),c=v.max(a,h);o*=c*(1-.3*v.cos(.5*v.PI*(l/c))),o=v.max(1,o);const _=this._$grid.enabled;let $,u,d;if(r instanceof Si){"radial"===r.type&&(s=this._$stack[this._$stack.length-1]);const t=r.stops,e="linearRGB"===r.rgb;if($=this._$gradientLUT.generateForShape(t,e),this._$frameBufferManager.textureManager.bind0($,!0),u=this._$shaderList.gradientShapeShaderVariants,"linear"===r.type)d=u.getGradientShapeShader(!0,_,!1,!1,r.mode),u.setGradientShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!1,r.points,0);else{s=this._$stack[this._$stack.length-1];const t=0!==r.focalPointRatio;d=u.getGradientShapeShader(!0,_,!0,t,r.mode),u.setGradientShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!0,r.points,r.focalPointRatio)}}else if(r instanceof wi){s=this._$stack[this._$stack.length-1];const t=r.colorTransform;$=r.texture,this._$frameBufferManager.textureManager.bind0($),u=this._$shaderList.shapeShaderVariants,d=u.getBitmapShapeShader(!0,r.repeat,this._$grid.enabled),t?u.setBitmapShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,$.width,$.height,t[0],t[1],t[2],this._$globalAlpha,t[4]/255,t[5]/255,t[6]/255,0):u.setBitmapShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,$.width,$.height,1,1,1,this._$globalAlpha,0,0,0,0)}else u=this._$shaderList.shapeShaderVariants,d=u.getSolidColorShapeShader(!0,this._$grid.enabled),u.setSolidColorShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,this._$viewportWidth,this._$viewportHeight,this._$grid,r,this._$globalAlpha);d._$stroke(i),this._$vao.releaseStroke(i)}arc(t,e,i){this._$path.drawCircle(t,e,i)}clip(){const t=this._$path.vertices;if(!t.length)return;const e=nt();for(let i=0;i<t.length;++i){const s=t[i];10>s.length||e.push(s)}if(!e.length)return void at(e);const i=this._$vao.createFill(e),s=this._$shaderList.shapeShaderVariants,r=s.getMaskShapeShader(!1,!1),n=r.uniform;s.setMaskShapeUniform(n,!1,this._$matrix[0],this._$matrix[1],this._$matrix[2],this._$matrix[3],this._$matrix[4],this._$matrix[5],this._$matrix[6],this._$matrix[7],this._$matrix[8],this._$viewportWidth,this._$viewportHeight,null),this._$mask._$onClip(i,this._$matrix,this._$viewportWidth,this._$viewportHeight)||(r._$fill(i),this.beginPath())}save(){const t=this._$matrix;this._$stack.push(rt(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])),this._$mask._$onSave()}restore(){var t;this._$stack.length&&(t=this._$matrix,X.push(t),this._$matrix=this._$stack.pop()||rt()),this._$mask._$onRestore()}createPattern(t,e,i){return new wi(this,t,e,i)}createLinearGradient(t,e,i,s,r="rgb",n="pad"){return(new Si).linear(t,e,i,s,r,n)}createRadialGradient(t,e,i,s,r,n,a="rgb",h="pad",o=0){return(new Si).radial(t,e,i,s,r,n,a,h,o)}_$applyBlurFilter(t,e,i){const s=this._$frameBufferManager,r=s.currentAttachment;if(!r)throw new Error("the current attachment is null.");const n=r.width,a=r.height;s.textureManager.bind0(t,!0);const h=v.ceil(.5*i),o=1-(h-.5*i),l=1+i,c=this._$shaderList.filterShaderVariants,_=c.getBlurFilterShader(h);c.setBlurFilterUniform(_.uniform,n,a,e,o,l),_._$drawImage()}_$applyBitmapFilter(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g=null,f=null,p=null,m=0,x=0,b=0,v=0,T=0,y=0,E=0,A=0){const M=this._$frameBufferManager,S="inner"===$,w=M.currentAttachment,C=M.getTextureFromCurrentAttachment();let F=null;const R=null!==g&&null!==f&&null!==p;let B;null!==g&&null!==f&&null!==p&&(F=this._$gradientLUT.generateForFilter(g,f,p)),S?R&&F?M.textureManager.bind02(t,F,!0):M.textureManager.bind0(t):(B=this._$frameBufferManager.createTextureAttachment(e,i),this._$bind(B),R&&F?M.textureManager.bind012(t,C,F,!0):M.textureManager.bind01(t,C));const I=!(S||"full"===$&&u),L=!(e===h&&i===o&&0===l&&0===c),P=!(1===d),O=this._$shaderList.filterShaderVariants,k=O.getBitmapFilterShader(I,L,_,$,u,P,R);O.setBitmapFilterUniform(k.uniform,e,i,s,r,n,a,h,o,l,c,_,d,m,x,b,v,T,y,E,A,I,L,P,R),S?u?this.blend.toSourceIn():this.blend.toSourceAtop():this.blend.toOneZero(),k._$drawImage(),S||M.releaseAttachment(w,!0)}_$applyColorMatrixFilter(t,e){this._$frameBufferManager.textureManager.bind0(t,!0);const i=this._$shaderList.filterShaderVariants,s=i.getColorMatrixFilterShader();i.setColorMatrixFilterUniform(s.uniform,e),this.blend.reset(),s._$drawImage()}_$applyConvolutionFilter(t,e,i,s,r,n,a,h,o,l,c,_){const $=t.width,u=t.height,d=this._$frameBufferManager.createTextureAttachment($,u);this._$bind(d),this._$frameBufferManager.textureManager.bind0(t,!0);const g=this._$shaderList.filterShaderVariants,f=g.getConvolutionFilterShader(e,i,a,h);g.setConvolutionFilterUniform(f.uniform,$,u,s,r,n,h,o,l,c,_),this.blend.reset(),f._$drawImage()}_$applyDisplacementMapFilter(t,e,i,s,r,n,a,h,o,l,c,_,$,u){const d=t.width,g=t.height,f=this._$frameBufferManager.createTextureAttachment(d,g);this._$bind(f),r||(r={x:0,y:0});const p=this._$frameBufferManager.createTextureFromImage(e);this._$frameBufferManager.textureManager.bind01(t,p);const m=this._$shaderList.filterShaderVariants,x=m.getDisplacementMapFilterShader(n,a,l);m.setDisplacementMapFilterUniform(x.uniform,e.width,e.height,i,s,r.x,r.y,h,o,l,c,_,$,u),this.blend.reset(),x._$drawImage(),this._$frameBufferManager.releaseTexture(p)}_$startLayer(t){this._$positions.push(t),this._$blends.push(this._$isLayer),this._$isLayer=!0}_$endLayer(){const t=this._$positions.pop();t&&Q(t),this._$isLayer=!!this._$blends.pop()}_$saveAttachment(t,e,i=!1){this.drawInstacedArray();const s=this._$frameBufferManager;this._$attachmentArray.push(s.currentAttachment),this._$bind(s.createCacheAttachment(t,e,i))}_$restoreAttachment(t=!1){const e=this._$frameBufferManager;e.releaseAttachment(e.currentAttachment,t),this._$bind(this._$attachmentArray.pop())}getCurrentPosition(){return this._$positions[this._$positions.length-1]}textureScale(t,e){const i=v.max(t,e);return i>this._$maxTextureSize?this._$maxTextureSize/i:1}}class gs{constructor(){var t;t=window.devicePixelRatio,f=t,this._$stage=new de,this._$stage._$player=this,this._$mode="loader",this._$actionOffset=0,this._$actions=nt(),this._$loaders=nt(),this._$sounds=ot(),this._$hitObject={x:0,y:0,pointer:"",hit:null},this._$rollOverObject=null,this._$mouseOverTarget=null,this._$ratio=f,this._$stopFlag=!0,this._$startTime=0,this._$fps=16,this._$loadStatus=0,this._$width=0,this._$height=0,this._$baseWidth=0,this._$baseHeight=0,this._$scale=1,this._$matrix=tt(1,0,0,1,0,0),this._$tx=0,this._$ty=0,this._$state="up",this._$hitTestStart=!1,this._$stageX=-1,this._$stageY=-1,this._$deltaX=0,this._$deltaY=0,this._$broadcastEvents=ot(),this._$optionWidth=0,this._$optionHeight=0,this._$tagId="",this._$bgColor="transparent",this._$base="",this._$fullScreen=!1,this._$quality="high",this._$sources=nt(),this._$videos=nt(),this._$textField=null,this._$timerId=-1,this._$loadId=-1,this._$context=null,this._$attachment=null,this._$clickTarget=null,this._$actionProcess=!1,this._$canvas=u.createElement("canvas")}static get LOAD_START(){return 1}static get LOAD_END(){return 2}get cacheStore(){return At}get canvas(){return this._$canvas}get broadcastEvents(){return this._$broadcastEvents}get context(){return this._$context}set context(t){this._$context=t}get base(){return this._$base}set base(t){if(-1===t.indexOf("//")){const e=t.split("/");""!==e[0]&&"."!==e[0]||e.shift(),e.pop(),this._$base=`${location.origin}/`,e.length&&(this._$base+=`${e.join("/")}/`)}else if(-1===t.indexOf("?"))this._$base="/"===t.slice(-1)?t:`${t}/`;else{const e=t.split("?")[0];this._$base="/"===e.slice(-1)?e:`${e}/`}}get stage(){return this._$stage}get x(){return this._$tx}get y(){return this._$ty}get scaleX(){return this._$matrix[0]}get scaleY(){return this._$matrix[3]}get mode(){return this._$mode}set mode(t){this._$mode=t}get contentElementId(){return Es}get width(){return this._$baseWidth}set width(t){this._$baseWidth=0|t}get height(){return this._$baseHeight}set height(t){this._$baseHeight=0|t}get bgColor(){return this._$bgColor}set bgColor(t){this._$bgColor=`${t}`}play(){if(this._$stopFlag){this._$stopFlag=!1,this._$timerId>-1&&R(this._$timerId),this._$startTime=B.now();const t=this._$stage._$frameRate;this._$fps=1e3/t|0,this._$timerId=F((t=>{this._$run(t)}))}}stop(){this._$timerId>-1&&R(this._$timerId),this._$stopFlag=!0,this._$timerId=-1,ae.stopAll(),At.reset(),Tr&&Tr.postMessage({command:"stop"})}removeCache(t){At.removeCache(t),Tr&&Tr.postMessage({command:"removeCache",id:t})}setOptions(t=null){t&&(this._$optionWidth=t.width||this._$optionWidth,this._$optionHeight=t.height||this._$optionHeight,this._$tagId=t.tagId||this._$tagId,this.base=t.base||this._$base,this._$bgColor=t.bgColor||this._$bgColor,this._$fullScreen=!!t.fullScreen)}_$loadWebAudio(t=null){t&&this._$canvas.removeEventListener(Fs,this._$loadWebAudio),Ps||dr()}_$updateLoadStatus(){if(this._$loadStatus===gs.LOAD_END)return this._$loadId>-1&&R(this._$loadId),this._$loadId=-1,void this._$loaded();this._$loadId=F((()=>{this._$updateLoadStatus()}))}_$loaded(){const t=u.getElementById(this.contentElementId);if(t){this._$setBackgroundColor(this._$bgColor),this._$deleteNode(),t.appendChild(this._$canvas),this._$stage._$prepareActions(),this._$broadcastEvents.has(wt.FRAME_CONSTRUCTED)&&this._$dispatchEvent(new wt(wt.FRAME_CONSTRUCTED)),this._$doAction(),this._$broadcastEvents.has(wt.EXIT_FRAME)&&this._$dispatchEvent(new wt(wt.EXIT_FRAME));const e=this._$loaders.length;for(let t=0;t<e;++t){const t=this._$loaders.shift();t.hasEventListener(wt.INIT)&&t.dispatchEvent(new wt(wt.INIT)),t.hasEventListener(wt.COMPLETE)&&t.dispatchEvent(new wt(wt.COMPLETE))}this._$broadcastEvents.has(wt.ACTIVATE)&&this._$dispatchEvent(new wt(wt.ACTIVATE)),this._$doAction(),this._$draw(),this.play()}}_$initialize(){const t=this.contentElementId;if(this._$tagId){const e=u.getElementById(this._$tagId);if(!e)return void alert("Not Found Tag ID:"+this._$tagId);if(u.getElementById(t))this._$deleteNode();else{const i=u.createElement("div");i.id=t,i.tabIndex=-1,e.appendChild(i)}}else u.body.insertAdjacentHTML("beforeend",`<div id="${t}" tabindex="-1"></div>`);const e=u.getElementById(t);if(!e)throw new Error("the content element is null.");const i=e.parentElement;if(i){this._$initStyle(e),this._$buildWait();const t=this._$optionWidth?this._$optionWidth:"BODY"===i.tagName?$.innerWidth:i.offsetWidth,s=this._$optionHeight?this._$optionHeight:"BODY"===i.tagName?$.innerHeight:i.offsetHeight;"loader"===this._$mode&&t&&s&&(this._$baseWidth=t,this._$baseHeight=s,this._$resize())}"loader"===this._$mode?(this._$loadStatus=gs.LOAD_START,this._$updateLoadStatus()):(this._$resize(),this._$loaded())}_$initStyle(t){const e=t.style;e.position="relative",e.top="0",e.left="0",e.backgroundColor="transparent",e.overflow="hidden",e.padding="0",e.margin="0",e.userSelect="none",e.outline="none";const i=this._$optionWidth,s=this._$optionHeight,r=t.parentElement;if(!r)throw new Error("the parentElement is null.");if("BODY"===r.tagName)return e.width=i?`${i}px`:`${window.innerWidth}px`,void(e.height=s?`${s}px`:`${window.innerHeight}px`);e.width=i?`${i}px`:`${r.offsetWidth}px`,e.height=s?`${s}px`:`${r.offsetHeight}px`}_$buildWait(){const t=u.getElementById(this.contentElementId);if(t){const e=`${this.contentElementId}_loading`;t.innerHTML=`<style>\n#${e} {\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -24px 0 0 -24px;\n width: 50px;\n height: 50px;\n border-radius: 50px;\n border: 8px solid #dcdcdc;\n border-right-color: transparent;\n box-sizing: border-box;\n animation: ${e} 0.8s infinite linear;\n}\n@keyframes ${e} {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n</style>`;const i=u.createElement("div");i.id=e,t.appendChild(i)}}_$deleteNode(){const t=u.getElementById(this.contentElementId);if(t)for(;t.childNodes.length;)t.removeChild(t.childNodes[0])}_$initializeCanvas(){if(this._$canvas.width=1,this._$canvas.height=1,Tr){const t=this._$canvas.transferControlToOffscreen(),e=sr();let i=0;e[i++]=this._$stage._$instanceId,e[i++]=+Hs,e[i++]=f,e[i++]=this._$getSamples();const s=nt(t,e.buffer);Tr.postMessage({command:"initialize",canvas:t,buffer:e},s),at(s)}else{const t=this._$canvas.getContext("webgl2",{stencil:!0,premultipliedAlpha:!0,antialias:!1,depth:!1,preserveDrawingBuffer:!0});t?(this._$context=new ds(t,this._$getSamples()),At.context=this._$context):alert("WebGL setting is off. Please turn the setting on.")}const t=()=>{if(this._$canvas.removeEventListener(Fs,t),this._$canvas.removeEventListener(Ss,t),!Ps){dr();for(let t=0;t<this._$videos.length;++t){const e=this._$videos[t];e._$video&&(e._$video.muted=!1)}}};this._$canvas.addEventListener(Ss,t),this._$canvas.addEventListener(Fs,t),this._$canvas.addEventListener(As,(t=>{l(t),a(As),this._$hitTest()})),this._$canvas.addEventListener(Ms,(t=>{l(t),a(Ms),this._$hitTest()})),this._$canvas.addEventListener(Ss,(t=>{l(t),a(Ss),this._$hitTest()})),this._$canvas.addEventListener(Ms,(t=>{l(t),a(Ms),this._$hitTest()}),{passive:!1}),this._$canvas.addEventListener(ws,(t=>{l(t),a(ws),t.button||this._$hitTest()})),this._$canvas.addEventListener(Bs,(t=>{l(t),a(Bs),t.button||this._$hitTest()})),this._$canvas.addEventListener(Is,(t=>{l(t),a(Is),this._$hitTest(),l(null),this._$stageX=-1,this._$stageY=-1})),this._$canvas.addEventListener(Fs,(t=>{l(t),a(Fs),t.button||this._$hitTest()})),this._$canvas.addEventListener(Cs,(t=>{l(t),a(Cs),this._$hitTest()})),this._$canvas.addEventListener(Rs,(t=>{t.defaultPrevented||(l(t),a(Rs),this._$hitTest())}),{passive:!1});let e="";e+="position: absolute;",e+="top: 0;",e+="left: 0;",e+="-webkit-tap-highlight-color: rgba(0,0,0,0);",e+="backface-visibility: hidden;",e+="transform-origin: 0 0;",1!==f&&(e+=`transform: scale(${1/f});`),this._$canvas.setAttribute("style",e)}_$resize(){const t=u.getElementById(this.contentElementId);if(t){const e=t.parentElement;if(!e)throw new Error("the parentElement is null.");const i=this._$optionWidth?this._$optionWidth:"BODY"===e.tagName?$.innerWidth:e.offsetWidth?e.offsetWidth:parseFloat(e.style.width),s=this._$optionHeight?this._$optionHeight:"BODY"===e.tagName?$.innerHeight:e.offsetHeight?e.offsetHeight:parseFloat(e.style.height),r="BODY"===e.tagName?$.innerWidth:e.offsetWidth,n=v.min(i/this._$baseWidth,s/this._$baseHeight);let a=this._$fullScreen?i:this._$baseWidth*n|0,h=this._$fullScreen?s:this._$baseHeight*n|0;const o=t.style;if(o.width=`${a}px`,o.height=`${h}px`,o.top="0",o.left=this._$fullScreen?"0":r/2-a/2+"px",a*=f,h*=f,this._$width===a&&this._$height===h)return;this._$stage._$doChanged(),At.reset(),this._$scale=n,this._$width=a,this._$height=h;const l=this._$scale*this._$ratio;this._$matrix[0]=l,this._$matrix[3]=l,this._$fullScreen&&(this._$tx=(a-this._$baseWidth*n*f)/2,this._$ty=(h-this._$baseHeight*n*f)/2,this._$matrix[4]=this._$tx,this._$matrix[5]=this._$ty),this._$resizeCanvas(a,h,l,this._$tx,this._$ty),this._$ratio>1&&f>1&&(this._$canvas.style.transform=`scale(${1/this._$ratio})`),t.children.length>1&&t.children[1].dispatchEvent(new Event(`${Es}_blur`))}}_$setBackgroundColor(t="transparent"){if(Tr){const e=sr();e[0]="transparent"===t?-1:pt(t);const i=rr();i.command="setBackgroundColor",i.buffer=e;const s=nt(e.buffer);Tr.postMessage(i,s),nr(i),at(s)}else{const e=this._$context;if(!e)return;if("transparent"===t)e._$setColor(0,0,0,0);else{const i=mt(pt(t));e._$setColor(i.R/255,i.G/255,i.B/255,1)}}}_$resizeCanvas(t,e,i,s=0,r=0){if(Tr){const n=sr();let a=0;n[a++]=t,n[a++]=e,n[a++]=i,n[a++]=s,n[a++]=r;const h=rr(),o=nt(n.buffer);h.command="resize",h.buffer=n,Tr.postMessage(h,o),nr(h),at(o)}else{const i=this._$context;if(!i)return;i.clearInstacedArray(),this._$canvas.width=t,this._$canvas.height=e,i._$gl.viewport(0,0,t,e);const s=i.frameBuffer;this._$attachment&&(s.unbind(),s.releaseAttachment(this._$attachment,!0)),this._$attachment=s.createCacheAttachment(t,e,!0),i.setMaxSize(t,e),i._$bind(this._$attachment)}}_$getSamples(){switch(this._$quality){case"high":return 4;case"medium":return 2;default:return 0}}_$dispatchEvent(t){if(this._$broadcastEvents.size&&this._$broadcastEvents.has(t.type)){const e=this._$broadcastEvents.get(t.type).slice(0);t.eventPhase=St.AT_TARGET;for(let i=0;i<e.length;++i){const s=e[i];if(t.currentTarget=s.target,t.listener=s.listener,s.listener.call(null,t),t._$stopImmediatePropagation)break}return at(e),!0}return!1}_$run(t=0){if(this._$stopFlag)return;this._$doAction();const e=t-this._$startTime;if(e>this._$fps){if(this._$startTime=t-e%this._$fps,this._$action(),this._$sounds.size){for(const t of this._$sounds.values())t._$soundPlay();this._$sounds.clear()}this._$draw(),!Qs&&!this._$hitTestStart&&"up"===this._$state&&this._$stageX>-1&&this._$stageY>-1&&o()&&this._$pointerCheck()}else this._$videos.length&&!Tr&&this._$draw();this._$timerId=F((t=>{this._$run(t)}))}_$pointerCheck(){const t=this._$stageX,e=this._$stageY;this._$hitObject.x=t,this._$hitObject.y=e,this._$hitObject.pointer="",this._$hitObject.hit=null,tr.setTransform(1,0,0,1,0,0),tr.beginPath(),Vs[4]=this._$tx/this._$scale/f,Vs[5]=this._$ty/this._$scale/f,this._$stage._$mouseHit(tr,Vs,this._$hitObject,!0);let i=null,s=null,r=!1,n=!1;if(this._$hitObject.hit){if(i=this._$hitObject.hit,this._$mouseOverTarget&&this._$mouseOverTarget!==i){const t=this._$mouseOverTarget;t.willTrigger(It.MOUSE_OUT)&&t.dispatchEvent(new It(It.MOUSE_OUT,!0,!1))}if(this._$rollOverObject!==i){let r=null;if(this._$rollOverObject)for(s=this._$rollOverObject,s.willTrigger(It.ROLL_OUT)&&s.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),r=s._$parent;r&&r._$root!==r&&r!==i;){if(r._$mouseEnabled&&r._$outCheck(t,e)){let t=!1,e=i;for(;e&&e._$root!==e;){if(e===r){t=!0;break}e=e._$parent}if(!t&&r._$parent===i._$parent&&r._$index>i._$index&&(t=!0),t)break}r.willTrigger(It.ROLL_OUT)&&r.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),r=r._$parent}for(s=i;s.willTrigger(It.ROLL_OVER)&&s.dispatchEvent(new It(It.ROLL_OVER,!1,!1)),s=s._$parent,s&&s!==r&&s.stage!==s;);}switch(this._$rollOverObject=i,!0){case null===this._$mouseOverTarget:case this._$mouseOverTarget!==i:i&&i.willTrigger(It.MOUSE_OVER)&&i.dispatchEvent(new It(It.MOUSE_OVER,!0,!1)),this._$mouseOverTarget=i}if("up"===this._$state&&(this._$clickTarget=null),!Qs&&"up"===this._$state)for(s=i;s&&s.root!==s;){if("_$text"in s&&"input"===s.type){r=!0;break}if("buttonMode"in s&&s.buttonMode){n=!0;break}s=s._$parent}}else{if(this._$mouseOverTarget&&(i=this._$mouseOverTarget,i.willTrigger(It.MOUSE_OUT)&&i.dispatchEvent(new It(It.MOUSE_OUT,!0,!1))),this._$rollOverObject)for(s=this._$rollOverObject;s&&s.root!==s;)s.willTrigger(It.ROLL_OUT)&&s.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),s=s._$parent;this._$rollOverObject=null,this._$mouseOverTarget=null}switch(!0){case r:this._$canvas.style.cursor="text";break;case n:this._$canvas.style.cursor="pointer";break;case!Qs&&"up"===this._$state:this._$canvas.style.cursor="auto"}this._$actions.length>1&&this._$doAction()}_$action(){if(this._$stopFlag)return;let t=null;const e=this._$loaders.length;if(e){t=this._$loaders.slice(0),this._$loaders.length=0;for(let i=0;i<e;++i){const e=t[i];"content"in e&&e.content._$prepareActions()}}if(this._$stage._$nextFrame(),this._$broadcastEvents.has(wt.ENTER_FRAME)&&this._$dispatchEvent(new wt(wt.ENTER_FRAME)),this._$broadcastEvents.has(wt.FRAME_CONSTRUCTED)&&this._$dispatchEvent(new wt(wt.FRAME_CONSTRUCTED)),this._$doAction(),this._$broadcastEvents.has(wt.EXIT_FRAME)&&this._$dispatchEvent(new wt(wt.EXIT_FRAME)),this._$stage._$invalidate&&(this._$stage._$invalidate=!1,this._$dispatchEvent(new wt(wt.RENDER))),t){for(let e=0;e<t.length;++e){const i=t[e];i.hasEventListener(wt.INIT)&&i.dispatchEvent(new wt(wt.INIT)),i.hasEventListener(wt.COMPLETE)&&i.dispatchEvent(new wt(wt.COMPLETE))}at(t)}this._$doAction()}_$draw(){if(!this._$width||!this._$height)return;if(!this._$stage._$isUpdated())return;Tr&&Tr.postMessage({command:"draw"});const t=this._$context;t&&(t.reset(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this._$width,this._$height),t.beginPath(),this._$stage._$draw(t,this._$matrix,O),this._$stage._$updated=!1,t.drawInstacedArray(),t.frameBuffer.transferToMainTexture())}_$doAction(){for(;this._$actions.length;){this._$actionProcess=!0;const t=this._$actions.pop();if(!t)continue;t._$canAction=!1,t._$actionOffset=0,t._$actionLimit=0;const e=t._$currentFrame;if(!t._$actions.has(e))continue;const i=t._$actions.get(e);if(i){t._$actionProcess=!0;for(let e=0;e<i.length;++e)r(t._$loaderInfo),i[e].apply(t);t._$actionProcess=!1,t._$frameCache.size&&(t._$currentFrame=t._$frameCache.get("nextFrame"),t._$clearChildren(),t._$stopFlag=t._$frameCache.get("stopFlag"),t._$isPlaying=t._$frameCache.get("isPlaying"),t._$frameCache.clear())}}this._$actionProcess=!1,r(null)}_$hitTest(){if(this._$stopFlag)return;const t=o();if(!t)return;this._$hitTestStart=!0,x(!1);let e=null,i=null,s=$.scrollX,r=$.scrollY;const a=u.getElementById(this.contentElementId);if(a){const t=a.getBoundingClientRect();s+=t.left,r+=t.top}let h=0,l=0;if("changedTouches"in t){const e=t.changedTouches[0];h=e.pageX,l=e.pageY}else"pageX"in t&&(h=t.pageX,l=t.pageY);const c=(h-s)/this._$scale,_=(l-r)/this._$scale;this._$stageX=c,this._$stageY=_,this._$hitObject.x=c,this._$hitObject.y=_,this._$hitObject.pointer="",this._$hitObject.hit=null,tr.setTransform(1,0,0,1,0,0),tr.beginPath(),Vs[4]=this._$tx/this._$scale/f,Vs[5]=this._$ty/this._$scale/f,this._$stage._$mouseHit(tr,Vs,this._$hitObject,!0),this._$hitObject.hit&&t.preventDefault();let d=!1,g=!1,p=!1;const b=n;switch(b){case Ms:case Cs:if(ks){const t=ks._$dragMousePoint();let e=t.x,i=t.y;Ds.lock||(e+=Ds.position.x,i+=Ds.position.y);const s=Ds.bounds;s&&(e=$t(e,s.left,s.right),i=$t(i,s.top,s.bottom)),ks.x=e,ks.y=i}if(this._$clickTarget&&"_$text"in this._$clickTarget&&this._$clickTarget.scrollEnabled){const t=this._$deltaX-h,e=this._$deltaY-l;this._$clickTarget.scrollX+=t/(this._$clickTarget.textWidth/this._$clickTarget.width),this._$clickTarget.scrollY+=e/(this._$clickTarget.textHeight/this._$clickTarget.height)}this._$deltaX=h,this._$deltaY=l;break;case As:case ws:this._$deltaX=h,this._$deltaY=l,this._$state="down",p="pointer"===this._$canvas.style.cursor,g=!0;break;case Ss:case Fs:case Bs:this._$deltaX=0,this._$deltaY=0,this._$state="up"}switch(!0){case null===this._$hitObject.hit:case b===Is:if(this._$mouseOverTarget&&(e=this._$mouseOverTarget,e.willTrigger(It.MOUSE_OUT)&&e.dispatchEvent(new It(It.MOUSE_OUT,!0,!1))),this._$rollOverObject)for(i=this._$rollOverObject;i&&i.root!==i;)i.willTrigger(It.ROLL_OUT)&&i.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),i=i._$parent;switch(this._$rollOverObject=null,this._$mouseOverTarget=null,b){case Rs:this._$stage.hasEventListener(It.MOUSE_WHEEL)&&this._$stage.dispatchEvent(new It(It.MOUSE_WHEEL,!0,!1));break;case As:case ws:this._$stage.hasEventListener(It.MOUSE_DOWN)&&this._$stage.dispatchEvent(new It(It.MOUSE_DOWN,!0,!1)),this._$textField&&(this._$textField.focus=!1,this._$textField=null);break;case Ss:case Fs:this._$textField&&(this._$textField.focus=!1,this._$textField=null),this._$stage.hasEventListener(It.CLICK)&&this._$stage.dispatchEvent(new It(It.CLICK,!0,!1)),this._$stage.hasEventListener(It.MOUSE_UP)&&this._$stage.dispatchEvent(new It(It.MOUSE_UP,!0,!1));break;case Ms:case Cs:this._$stage.hasEventListener(It.MOUSE_MOVE)&&this._$stage.dispatchEvent(new It(It.MOUSE_MOVE,!0,!1));break;case Bs:this._$stage.hasEventListener(It.DOUBLE_CLICK)&&this._$stage.dispatchEvent(new It(It.DOUBLE_CLICK,!0,!1))}break;default:switch(e=this._$hitObject.hit,b){case Ms:case Cs:if(e.willTrigger(It.MOUSE_MOVE)&&e.dispatchEvent(new It(It.MOUSE_MOVE,!0,!1)),this._$mouseOverTarget&&this._$mouseOverTarget!==e){const t=this._$mouseOverTarget;t.willTrigger(It.MOUSE_OUT)&&t.dispatchEvent(new It(It.MOUSE_OUT,!0,!1))}if(this._$rollOverObject!==e){let t=null;if(this._$rollOverObject)for(i=this._$rollOverObject,i.willTrigger(It.ROLL_OUT)&&i.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),t=i._$parent;t&&t._$root!==t&&t!==e;){if(t._$mouseEnabled&&t._$outCheck(c,_)){let i=!1,s=e;for(;s&&s._$root!==s;){if(s===t){i=!0;break}s=s._$parent}if(!i&&t._$parent===e._$parent&&t._$index>e._$index&&(i=!0),i)break}t.willTrigger(It.ROLL_OUT)&&t.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),t=t._$parent}for(i=e;i.willTrigger(It.ROLL_OVER)&&i.dispatchEvent(new It(It.ROLL_OVER,!1,!1)),i=i._$parent,i&&i!==t&&i.stage!==i;);}switch(this._$rollOverObject=e,!0){case null===this._$mouseOverTarget:case this._$mouseOverTarget!==e:e.willTrigger(It.MOUSE_OVER)&&e.dispatchEvent(new It(It.MOUSE_OVER,!0,!1)),this._$mouseOverTarget=e}"up"===this._$state&&(this._$clickTarget=null);break;case As:case ws:e.willTrigger(It.MOUSE_DOWN)&&e.dispatchEvent(new It(It.MOUSE_DOWN,!0,!1)),this._$clickTarget=e;break;case Ss:case Fs:this._$textField&&e!==this._$textField&&"_$text"in this._$textField&&(this._$textField.focus=!1,this._$textField=null),"_$text"in e&&(e.focus=!0,this._$textField=e),e.willTrigger(It.MOUSE_UP)&&e.dispatchEvent(new It(It.MOUSE_UP,!0,!1)),this._$clickTarget===e&&e.willTrigger(It.CLICK)&&e.dispatchEvent(new It(It.CLICK,!0,!1)),this._$clickTarget=null;break;case Rs:e.willTrigger(It.MOUSE_WHEEL)&&e.dispatchEvent(new It(It.MOUSE_WHEEL)),e.scrollEnabled&&("deltaX"in t&&(e.scrollX+=t.deltaX/(e.textWidth/e.width)),"deltaY"in t&&(e.scrollY+=t.deltaY/(e.textHeight/e.height)));break;case Bs:e.willTrigger(It.DOUBLE_CLICK)&&e.dispatchEvent(new It(It.DOUBLE_CLICK))}if(!g&&!Qs&&"up"===this._$state)for(i=e;i&&i.root!==i;){if("_$text"in i){if("input"===i.type){d=!0;break}}else if(i._$buttonMode){p=!0;break}i=i._$parent}}switch(!0){case d:this._$canvas.style.cursor="text";break;case p:this._$canvas.style.cursor="pointer";break;case!Qs&&"up"===this._$state:this._$canvas.style.cursor="auto"}!this._$actionProcess&&this._$actions.length>1&&this._$doAction(),m&&(this._$stage._$prepareActions(),this._$actionProcess||this._$doAction()),this._$hitTestStart=!1}}const fs={Event:wt,EventDispatcher:Ct,EventPhase:St,FocusEvent:Ft,HTTPStatusEvent:Rt,IOErrorEvent:Bt,MouseEvent:It,ProgressEvent:Lt,VideoEvent:Pt};Object.entries(fs).forEach((([t,e])=>{Object.defineProperty(fs,t,{get:()=>e})}));const ps={DisplayObject:Qt,InteractiveObject:Jt,DisplayObjectContainer:Zt,Sprite:ce,MovieClip:_e,BitmapData:te,BlendMode:class{static toString(){return"[class BlendMode]"}static get namespace(){return"next2d.display.BlendMode"}toString(){return"[object BlendMode]"}get namespace(){return"next2d.display.BlendMode"}static get ADD(){return"add"}static get ALPHA(){return"alpha"}static get DARKEN(){return"darken"}static get DIFFERENCE(){return"difference"}static get ERASE(){return"erase"}static get HARDLIGHT(){return"hardlight"}static get INVERT(){return"invert"}static get LAYER(){return"layer"}static get LIGHTEN(){return"lighten"}static get MULTIPLY(){return"multiply"}static get NORMAL(){return"normal"}static get OVERLAY(){return"overlay"}static get SCREEN(){return"screen"}static get SUBTRACT(){return"subtract"}},FrameLabel:ee,Graphics:re,Loader:$e,LoaderInfo:ne,Shape:ue,Stage:de,TextField:Mi};Object.entries(ps).forEach((([t,e])=>{Object.defineProperty(ps,t,{get:()=>e})}));const ms={BevelFilter:Gt,BlurFilter:Vt,ColorMatrixFilter:zt,ConvolutionFilter:Yt,DisplacementMapFilter:Xt,DropShadowFilter:qt,GlowFilter:Ht,GradientBevelFilter:jt,GradientGlowFilter:Wt};Object.entries(ms).forEach((([t,e])=>{Object.defineProperty(ms,t,{get:()=>e})}));const xs={ColorTransform:Ot,Matrix:Nt,Point:kt,Rectangle:Dt,Transform:Kt};Object.entries(xs).forEach((([t,e])=>{Object.defineProperty(xs,t,{get:()=>e})}));const bs={Sound:he,SoundMixer:ae,SoundTransform:oe,Video:le};Object.entries(bs).forEach((([t,e])=>{Object.defineProperty(bs,t,{get:()=>e})}));const vs={URLRequest:Mt,URLRequestHeader:g};Object.entries(vs).forEach((([t,e])=>{Object.defineProperty(vs,t,{get:()=>e})}));const Ts={TextFormat:me};Object.entries(Ts).forEach((([t,e])=>{Object.defineProperty(Ts,t,{get:()=>e})}));const ys={Easing:ge,Job:fe,Tween:pe};Object.entries(ys).forEach((([t,e])=>{Object.defineProperty(ys,t,{get:()=>e})}));const Es="__next2d__",As="touchstart",Ms="touchmove",Ss="touchend",ws="mousedown",Cs="mousemove",Fs="mouseup",Rs="wheel",Bs="dblclick",Is="mouseleave",Ls="scroll";let Ps=null;const Os=new Map;let ks=null;const Ns=t=>{ks=t},Ds={lock:!1,position:{x:0,y:0},bounds:null},Us=new Float32Array(256);new Float32Array(256);for(let t=0;t<256;++t)Us[t]=v.pow(t/255,2.23333333),Us[t]=t/255;const Vs=new Float32Array([1,0,0,1,0,0]),Gs=[],zs=[],Ys=[],Xs=new Map;let qs=!1,Hs=!1,js=!1,Ws=!1,Ks=!1,Qs=!1;const Js=u.createElement("canvas");Js.width=1,Js.height=1;const Zs=Js.getContext("2d");if(!Zs)throw new Error("the CanvasRenderingContext2D is null.");Zs.globalAlpha=0,Zs.imageSmoothingEnabled=!1;const tr=Zs,er=[],ir=[],sr=()=>er.length?er.pop():new Float32Array(64),rr=()=>ir.length?ir.pop():{command:""},nr=t=>{t.buffer=null,ir.push(t),console.log("renderMessageArray: ",ir)},ar=()=>$.next2d.player,hr=()=>{const t=o();if(!t)return new kt;const e=ar();let i=$.scrollX,s=$.scrollY;const r=u.getElementById(e.contentElementId);if(r){const t=r.getBoundingClientRect();i+=t.left,s+=t.top}let n=0,a=0;if("changedTouches"in t){const e=t.changedTouches[0];n=e.pageX,a=e.pageY}else"pageX"in t&&(n=t.pageX,a=t.pageY);const h=(n-i)/e._$scale-e.x/e._$scale/f,l=(a-s)/e._$scale-e.y/e._$scale/f;return new kt(h,l)},or=(t=1,e=0,i=0,s=1,r=0,n=0)=>{const a=zs.pop();return a?(a.setTo(t,e,i,s,r,n),a):new Nt(t,e,i,s,r,n)},lr=t=>{zs.push(t)},cr=(t=1,e=1,i=1,s=1,r=0,n=0,a=0,h=0)=>{const o=Ys.length?Ys.pop():null;return o?(o.redMultiplier=t,o.greenMultiplier=e,o.blueMultiplier=i,o.alphaMultiplier=s,o.redOffset=r,o.greenOffset=n,o.blueOffset=a,o.alphaOffset=h,o):new Ot(t,e,i,s,r,n,a,h)},_r=t=>{Ys.push(t)},$r=(t,e)=>{t._$character?t._$character.audioBuffer=e:t._$audioBuffer=e},ur=t=>{if(!Ps)throw new Error("the AudioContext is null.");let e=null;if(t._$character){const i=t._$character.buffer;i&&(e=new Uint8Array(i).buffer,at(i),t._$character.buffer=null)}else e=t._$arrayBuffer;return e?Ps.decodeAudioData(e).then((e=>($r(t,e),Promise.resolve(t)))).catch((()=>{if(!e)throw new Error;return((t,e)=>{if(!Ps)throw new Error("the Audio Context is null.");const i=new Uint8Array(e);let s=0;for(;s=i.indexOf(255,s),-1!==s&&224!=(224&i[s+1]);)++s;if(s>-1)return Ps.decodeAudioData(i.subarray(s).buffer).then((e=>($r(t,e),Promise.resolve(t)))).catch((()=>{throw new Error("This voice data is not available.")}));throw new Error("This voice data is not available.")})(t,e)})):Promise.resolve(t)},dr=()=>{if(Ps||(Ps=new AudioContext,Ps.resume()),Ps){const t=nt();for(let e=0;e<Gs.length;++e){const i=Gs[e];i._$character&&i._$character.audioBuffer&&t.push(Promise.resolve(i)),i._$audioBuffer&&t.push(Promise.resolve(i)),t.push(ur(i))}Promise.all(t).then((t=>{Gs.length=0,ar()._$loaders.push(...t)}))}};let gr=-1;const fr=()=>{const t=ar();if(t._$loadStatus===gs.LOAD_END){t._$resize();const e=t.stage;e.willTrigger(wt.RESIZE)&&e.dispatchEvent(new wt(wt.RESIZE))}};$.addEventListener("resize",(()=>{L(gr),gr=I(fr,300)}));const pr=t=>{let e=null;switch(t.method.toUpperCase()){case"GET":if(t.data){const e=t.url.split("?");e[1]=1===e.length?t.data.toString():`${e[1]}&${t.data.toString()}`,t.url=e.join("?")}break;case"PUT":case"POST":t.data&&(e=t.data.toString())}const i=new XMLHttpRequest;if(i.open(t.method,t.url,!0),i.responseType=t.format,i.withCredentials=t.withCredentials,t.event){const e=Object.keys(t.event);for(let s=0;s<e.length;++s){const r=e[s];i.addEventListener(r,t.event[r])}at(e)}for(let e=0;e<t.headers.length;++e){const s=t.headers[e];i.setRequestHeader(s.name,s.value)}i.send(e)},mr=t=>{const e=nt();if(t){const i=t.trim().split("\n"),s=i.length;for(let t=0;t<s;++t){const s=i[t].split(":");e.push(new g(`${s[0].trim()}`,`${s[1].trim()}`))}}return e},xr=new Map([["normal",1],["layer",2],["multiply",3],["screen",4],["lighten",5],["darken",6],["difference",7],["add",8],["subtract",9],["invert",10],["alpha",11],["erase",12],["overlay",13],["hardlight",14]]),br=t=>xr.has(t)&&xr.get(t)||1,vr=t=>{switch(t){case _e.namespace:return new _e;case ue.namespace:return new ue;case Mi.namespace:return new Mi;case ce.namespace:return new ce;case le.namespace:return new le}};let Tr=null,yr=null,Er=null;const Ar=URL.createObjectURL(new Blob(['(()=>{"use strict";var r=Uint8Array,n=Uint16Array,e=Int32Array,a=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),t=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),i=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(r,a){for(var t=new n(31),i=0;i<31;++i)t[i]=a+=1<<r[i-1];var o=new e(t[30]);for(i=1;i<30;++i)for(var f=t[i];f<t[i+1];++f)o[f]=f-t[i]<<5|i;return{b:t,r:o}},f=o(a,2),u=f.b,v=f.r;u[28]=258,v[258]=28;for(var c=o(t,0),l=c.b,d=(c.r,new n(32768)),s=0;s<32768;++s){var w=(43690&s)>>1|(21845&s)<<1;w=(61680&(w=(52428&w)>>2|(13107&w)<<2))>>4|(3855&w)<<4,d[s]=((65280&w)>>8|(255&w)<<8)>>1}var h=function(r,e,a){for(var t=r.length,i=0,o=new n(e);i<t;++i)r[i]&&++o[r[i]-1];var f,u=new n(e);for(i=1;i<e;++i)u[i]=u[i-1]+o[i-1]<<1;if(a){f=new n(1<<e);var v=15-e;for(i=0;i<t;++i)if(r[i])for(var c=i<<4|r[i],l=e-r[i],s=u[r[i]-1]++<<l,w=s|(1<<l)-1;s<=w;++s)f[d[s]>>v]=c}else for(f=new n(t),i=0;i<t;++i)r[i]&&(f[i]=d[u[r[i]-1]++]>>15-r[i]);return f},y=new r(288);for(s=0;s<144;++s)y[s]=8;for(s=144;s<256;++s)y[s]=9;for(s=256;s<280;++s)y[s]=7;for(s=280;s<288;++s)y[s]=8;var b=new r(32);for(s=0;s<32;++s)b[s]=5;var g=h(y,9,1),p=h(b,5,1),m=function(r){for(var n=r[0],e=1;e<r.length;++e)r[e]>n&&(n=r[e]);return n},k=function(r,n,e){var a=n/8|0;return(r[a]|r[a+1]<<8)>>(7&n)&e},x=function(r,n){var e=n/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(7&n)},T=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],z=function(r,n,e){var a=new Error(n||T[r]);if(a.code=r,Error.captureStackTrace&&Error.captureStackTrace(a,z),!e)throw a;return a},E=function(n,e,o,f){var v=n.length,c=f?f.length:0;if(!v||e.f&&!e.l)return o||new r(0);var d=!o||2!=e.i,s=e.i;o||(o=new r(3*v));var w,y=function(n){var e=o.length;if(n>e){var a=new r(Math.max(2*e,n));a.set(o),o=a}},b=e.f||0,T=e.p||0,E=e.b||0,M=e.l,S=e.d,U=e.m,A=e.n,C=8*v;do{if(!M){b=k(n,T,1);var q=k(n,T+1,3);if(T+=3,!q){var D=n[(w=T,(G=4+((w+7)/8|0))-4)]|n[G-3]<<8,F=G+D;if(F>v){s&&z(0);break}d&&y(E+D),o.set(n.subarray(G,F),E),e.b=E+=D,e.p=T=8*F,e.f=b;continue}if(1==q)M=g,S=p,U=9,A=5;else if(2==q){var I=k(n,T,31)+257,O=k(n,T+10,15)+4,J=I+k(n,T+5,31)+1;T+=14;for(var L=new r(J),N=new r(19),P=0;P<O;++P)N[i[P]]=k(n,T+3*P,7);T+=3*O;var R=m(N),j=(1<<R)-1,B=h(N,R,1);for(P=0;P<J;){var G,H=B[k(n,T,j)];if(T+=15&H,(G=H>>4)<16)L[P++]=G;else{var K=0,Q=0;for(16==G?(Q=3+k(n,T,3),T+=2,K=L[P-1]):17==G?(Q=3+k(n,T,7),T+=3):18==G&&(Q=11+k(n,T,127),T+=7);Q--;)L[P++]=K}}var V=L.subarray(0,I),W=L.subarray(I);U=m(V),A=m(W),M=h(V,U,1),S=h(W,A,1)}else z(1);if(T>C){s&&z(0);break}}d&&y(E+131072);for(var X=(1<<U)-1,Y=(1<<A)-1,Z=T;;Z=T){var $=(K=M[x(n,T)&X])>>4;if((T+=15&K)>C){s&&z(0);break}if(K||z(2),$<256)o[E++]=$;else{if(256==$){Z=T,M=null;break}var _=$-254;if($>264){var rr=a[P=$-257];_=k(n,T,(1<<rr)-1)+u[P],T+=rr}var nr=S[x(n,T)&Y],er=nr>>4;if(nr||z(3),T+=15&nr,W=l[er],er>3&&(rr=t[er],W+=x(n,T)&(1<<rr)-1,T+=rr),T>C){s&&z(0);break}d&&y(E+131072);var ar=E+_;if(E<W){var tr=c-W,ir=Math.min(W,ar);for(tr+E<0&&z(3);E<ir;++E)o[E]=f[tr+E]}for(;E<ar;E+=4)o[E]=o[E-W],o[E+1]=o[E+1-W],o[E+2]=o[E+2-W],o[E+3]=o[E+3-W];E=ar}}e.l=M,e.p=Z,e.b=E,e.f=b,M&&(b=1,e.m=U,e.d=S,e.n=A)}while(!b);return E==o.length?o:function(n,e,a){(null==e||e<0)&&(e=0),(null==a||a>n.length)&&(a=n.length);var t=new r(a-e);return t.set(n.subarray(e,a)),t}(o,0,E)},M=new r(0);function S(n,e){var a,t,i=function(r){31==r[0]&&139==r[1]&&8==r[2]||z(6,"invalid gzip data");var n=r[3],e=10;4&n&&(e+=2+(r[10]|r[11]<<8));for(var a=(n>>3&1)+(n>>4&1);a>0;a-=!r[e++]);return e+(2&n)}(n);return i+8>n.length&&z(6,"invalid gzip data"),E(n.subarray(i,-8),{i:2},e&&e.out||new r((t=(a=n).length,(a[t-4]|a[t-3]<<8|a[t-2]<<16|a[t-1]<<24)>>>0)),e&&e.dictionary)}function U(r,n){return E(r.subarray((e=r,a=n&&n.dictionary,(8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31)&&z(6,"invalid zlib data"),(e[1]>>5&1)==+!a&&z(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),2+(e[1]>>3&4)),-4),{i:2},n&&n.out,n&&n.dictionary);var e,a}var A="undefined"!=typeof TextDecoder&&new TextDecoder;try{A.decode(M,{stream:!0})}catch(r){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;self.addEventListener("message",(r=>{return n=void 0,e=void 0,t=function*(){const n=31==(e=r.data)[0]&&139==e[1]&&8==e[2]?S(e,a):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?function(r,n){return E(r,{i:2},n&&n.out,n&&n.dictionary)}(e,a):U(e,a);var e,a;let t="";for(let r=0;r<n.length;r+=4096)t+=String.fromCharCode(...n.slice(r,r+4096));self.postMessage(JSON.parse(decodeURIComponent(t)))},new((a=void 0)||(a=Promise))((function(r,i){function o(r){try{u(t.next(r))}catch(r){i(r)}}function f(r){try{u(t.throw(r))}catch(r){i(r)}}function u(n){var e;n.done?r(n.value):(e=n.value,e instanceof a?e:new a((function(r){r(e)}))).then(o,f)}u((t=t.apply(n,e||[])).next())}));var n,e,a,t}))})();'],{type:"text/javascript"})),Mr=[];let Sr=null;const wr=()=>(Sr||(Sr=new Worker(Ar)),Sr);let Cr=!1;const Fr=t=>{Cr=t},Rr=()=>Cr,Br=()=>{if("OffscreenCanvas"in window){const t=new OffscreenCanvas(0,0).getContext("webgl2");Tr=null!==t?new Worker(URL.createObjectURL(new Blob(['(()=>{"use strict";let t=1,e=0,i=!1;const s=1/0,r=Math,n=Array,a=Map,h=Number,o=Float32Array,_=Int32Array,l=Int16Array,c=OffscreenCanvas,$=isNaN,u=requestAnimationFrame,d=setTimeout,g=clearTimeout,f=new o([1,0,0,1,0,0]),m=new o([1,1,1,1,0,0,0,0]),p=r.PI/180,x=(r.PI,[]),b=[],v=[],T=[],A=[],M=[],y=[],E=[],C=new c(1,1).getContext("2d"),S=(t=0,e=0,i=0,s=0)=>{const r=E.pop()||{xMin:0,xMax:0,yMin:0,yMax:0};return r.xMin=t,r.xMax=e,r.yMin=i,r.yMax=s,r},F=t=>{E.push(t)},B=(t=0,e=0,i=0,s=0)=>{const r=b.pop()||new o(4);return r[0]=t,r[1]=e,r[2]=i,r[3]=s,r},w=t=>{b.push(t)},R=(t=0,e=0,i=0,s=0,r=0,n=0)=>{const a=v.pop()||new o(6);return a[0]=t,a[1]=e,a[2]=i,a[3]=s,a[4]=r,a[5]=n,a},I=t=>{v.push(t)},P=(t=1,e=1,i=1,s=1,r=0,n=0,a=0,h=0)=>{const _=T.pop()||new o(8);return _[0]=t,_[1]=e,_[2]=i,_[3]=s,_[4]=r,_[5]=n,_[6]=a,_[7]=h,_},N=t=>{T.push(t)},k=(t=0,e=0,i=0,s=0,r=0,n=0,a=0,h=0,_=0)=>{const l=A.pop()||new o(9);return l[0]=t,l[1]=e,l[2]=i,l[3]=s,l[4]=r,l[5]=n,l[6]=a,l[7]=h,l[8]=_,l},L=(...t)=>{const e=M.pop()||[];return t.length&&e.push(...t),e},O=(t=null)=>{t&&(t.length&&(t.length=0),M.push(t))},U=t=>{t.size&&t.clear(),y.push(t)},D=()=>y.pop()||new a,X=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t),V=t=>{const e=1/(t[0]*t[4]-t[3]*t[1]),i=t[3]*t[7]-t[4]*t[6],s=t[1]*t[6]-t[0]*t[7];return k(t[4]*e,0-t[1]*e,0,0-t[3]*e,t[0]*e,0,i*e,s*e,1)},Y=(t,e,i,s=null)=>{const n=+t;return $(n)&&null!==s?s:r.min(r.max(e,$(n)?0:n),i)},z=(t,e)=>R(t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]),G=(t,e)=>P(t[0]*e[0],t[1]*e[1],t[2]*e[2],t[3]*e[3],t[0]*e[4]+t[4],t[1]*e[5]+t[5],t[2]*e[6]+t[6],t[3]*e[7]+t[7]),H=(t,e)=>{const i=t.xMax*e[0]+t.yMax*e[2]+e[4],s=t.xMax*e[0]+t.yMin*e[2]+e[4],n=t.xMin*e[0]+t.yMax*e[2]+e[4],a=t.xMin*e[0]+t.yMin*e[2]+e[4],o=t.xMax*e[1]+t.yMax*e[3]+e[5],_=t.xMax*e[1]+t.yMin*e[3]+e[5],l=t.xMin*e[1]+t.yMax*e[3]+e[5],c=t.xMin*e[1]+t.yMin*e[3]+e[5],$=r.min(h.MAX_VALUE,i,s,n,a),u=r.max(0-h.MAX_VALUE,i,s,n,a),d=r.min(h.MAX_VALUE,o,_,l,c),g=r.max(0-h.MAX_VALUE,o,_,l,c);return S($,u,d,g)},W=t=>$(+t)?(t=>{if(!C)return 0;C.fillStyle=t;const e=+`0x${C.fillStyle.slice(1)}`;return C.fillStyle="rgba(0, 0, 0, 1)",e})(`${t}`):+t,q=(t,e,i)=>(t>>16)*(i?e:1)/255,j=(t,e,i)=>(t>>8&255)*(i?e:1)/255,K=(t,e,i)=>(255&t)*(i?e:1)/255,Q=(t,e=1)=>({R:(16711680&t)>>16,G:(65280&t)>>8,B:255&t,A:255*e}),J=(t,e,i=!1,s=!1)=>{let r="";return i&&(r="italic "),s&&(r+="bold "),`${r}${e}px \'${t}\',\'sans-serif\'`},Z=t=>{t.color&&N(t.color),t.isLayer=!1,t.isUpdated=null,t.canApply=null,t.matrix=null,t.color=null,t.filters=null,t.blendMode="normal",t.sw=0,t.sh=0,x.push(t)},tt=new Map([[1,"normal"],[2,"layer"],[3,"multiply"],[4,"screen"],[5,"lighten"],[6,"darken"],[7,"difference"],[8,"add"],[9,"subtract"],[10,"invert"],[11,"alpha"],[12,"erase"],[13,"overlay"],[14,"hardlight"]]),et=t=>tt.has(t)&&tt.get(t)||"normal",it=new class{constructor(){this._$pool=[],this._$store=new Map,this._$timerMap=new Map,this._$context=null}set context(t){this._$context=t}reset(){for(const t of this._$store.values()){for(const e of t.values())this.destroy(e);U(t)}this._$store.clear(),this._$context&&this._$context.frameBuffer.clearCache()}destroy(t=null){if(t&&"object"==typeof t)if(t instanceof WebGLTexture)u((()=>{this._$context&&this._$context.frameBuffer.releaseTexture(t)}));else{if("canvas"in t&&t instanceof CanvasRenderingContext2D){const e=t.canvas,i=e.width,s=e.height;t.clearRect(0,0,i+1,s+1),e.width=e.height=1,this._$pool.push(e)}this._$context&&"index"in t&&this._$context.frameBuffer.textureManager.releasePosition(t)}}getCanvas(){return this._$pool.pop()||document.createElement("canvas")}remove(t,e){if(!this._$store.has(t))return;const i=this._$store.get(t);i.has(e)&&(i.delete(e),i.size||(U(i),this._$store.delete(t)))}stopTimer(t){t=`${t}`,this._$timerMap.has(t)&&(g(this._$timerMap.get(t)),this._$timerMap.delete(t))}removeCache(t){if(t=`${t}`,this._$store.has(t)){const e=this._$store.get(t);for(const t of e.values())this.destroy(t);e.clear(),U(e),this._$store.delete(t)}this._$timerMap.delete(t)}setRemoveTimer(t){if(t=`${t}`,this.stopTimer(t),this._$store.has(t)){const e=d((()=>{this.removeCache(t)}),5e3);this._$timerMap.set(t,e)}}get(t){const e=`${t[0]}`,i=`${t[1]}`;if(this._$store.has(e)){this.stopTimer(e);const t=this._$store.get(e);if(t.has(i))return t.get(i)}return null}set(t,e=null){const i=`${t[0]}`,s=`${t[1]}`;this._$store.has(i)||this._$store.set(i,D());const r=this._$store.get(i);if(null===e){if(!r.has(s))return;return this.destroy(r.get(s)),r.delete(s),void(r.size||(U(r),this._$store.delete(i)))}r.set(s,e)}has(t){const e=`${t[0]}`;return!!this._$store.has(e)&&this._$store.get(e).has(`${t[1]}`)}generateKeys(t,e=null,i=null){let s="";e&&e.length&&(s+=`${e[0]}_${e[1]}`),i&&i.length&&(s+=0===i[7]?"":`_${i[7]}`);const r=L();if(s){let t=0;const e=s.length;for(let i=0;i<e;i++)t=(t<<5)-t+s.charCodeAt(i),t|=0;r[1]=`_${t}`}else r[1]="_0";return r[0]=`${t}`,r}};class st{constructor(){this._$updated=!0}static toString(){return"[class BitmapFilter]"}static get namespace(){return"next2d.filters.BitmapFilter"}toString(){return"[object BitmapFilter]"}get namespace(){return"next2d.filters.BitmapFilter"}_$isUpdated(){return this._$updated}_$doChanged(){this._$updated=!0,((t=!0)=>{i=t})()}}class rt extends st{constructor(t=4,e=4,i=1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this.blurX=t,this.blurY=e,this.quality=i}static toString(){return"[class BlurFilter]"}static get namespace(){return"next2d.filters.BlurFilter"}toString(){return"[object BlurFilter]"}get namespace(){return"next2d.filters.BlurFilter"}static get STEP(){return[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5]}get blurX(){return this._$blurX}set blurX(t){(t=Y(+t,0,255,0))!==this._$blurX&&(this._$blurX=t,this._$doChanged())}get blurY(){return this._$blurY}set blurY(t){(t=Y(+t,0,255,0))!==this._$blurY&&(this._$blurY=t,this._$doChanged())}get quality(){return this._$quality}set quality(t){(t=Y(0|t,0,15,1))!==this._$quality&&(this._$quality=t,this._$doChanged())}clone(){return new rt(this._$blurX,this._$blurY,this._$quality)}_$toArray(){return L(1,this._$blurX,this._$blurY,this._$quality)}_$generateFilterRect(t,e=0,i=0){const s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$quality)return s;const n=rt.STEP[this._$quality-1];let a=0>=this._$blurX?1:this._$blurX*n,h=0>=this._$blurY?1:this._$blurY*n;return e?a*=e:a=r.round(a),i?h*=i:h=r.round(h),s.xMin-=a,s.xMax+=2*a,s.yMin-=h,s.yMax+=2*h,s}_$canApply(){return 0!==this._$blurX&&0!==this._$blurY}_$applyFilter(e,i,s=!0){this._$updated=!1;const n=e.frameBuffer,a=n.currentAttachment,h=n.getTextureFromCurrentAttachment();if(!this._$canApply())return s?h:n.createTextureFromCurrentAttachment();let o=r.sqrt(i[0]*i[0]+i[1]*i[1]),_=r.sqrt(i[2]*i[2]+i[3]*i[3]);o/=t,_/=t,o*=2,_*=2;const l=S(0,h.width,0,h.height),c=this._$generateFilterRect(l,o,_);F(l);const $=0|r.ceil(c.xMax),u=0|r.ceil(c.yMax),d=r.ceil(r.abs(c.xMin)+.5*r.abs($-c.xMax)),g=r.ceil(r.abs(c.yMin)+.5*r.abs(u-c.yMax));e._$offsetX=d+e._$offsetX,e._$offsetY=g+e._$offsetY;const f=this._$blurX*o,m=this._$blurY*_;let p=1,x=1;f>128?p=.0625:f>64?p=.125:f>32?p=.25:f>16&&(p=.5),m>128?x=.0625:m>64?x=.125:m>32?x=.25:m>16&&(x=.5);const b=f*p,v=m*x,T=r.ceil($*p),A=r.ceil(u*x),M=n.createTextureAttachment(T,A),y=[M,n.createTextureAttachment(T,A)];let E=0;e._$bind(M),e.reset(),e.setTransform(p,0,0,x,0,0),e.drawImage(h,d,g,h.width,h.height),e.blend.toOneZero();let C=n.getTextureFromCurrentAttachment();for(let t=0;t<this._$quality;++t){if(this._$blurX>0){E=(E+1)%2;const t=y[E];e._$bind(t),e._$applyBlurFilter(C,!0,b),C=n.getTextureFromCurrentAttachment()}if(this._$blurY>0){E=(E+1)%2;const t=y[E];e._$bind(t),e._$applyBlurFilter(C,!1,v),C=n.getTextureFromCurrentAttachment()}}if(e.blend.reset(),1!==p||1!==x){const t=n.createTextureAttachment($,u);e._$bind(t),e.reset(),e.imageSmoothingEnabled=!0,e.setTransform(1/p,0,0,1/x,0,0),e.drawImage(C,0,0,T,A),C=n.getTextureFromCurrentAttachment(),e.reset(),e.setTransform(1,0,0,1,0,0),n.releaseAttachment(y[0],!0),n.releaseAttachment(y[1],!0),s?n.releaseAttachment(a,!0):n.releaseAttachment(t,!1)}else n.releaseAttachment(y[(E+1)%2],!0),s?n.releaseAttachment(a,!0):n.releaseAttachment(y[E],!1);return C}}class nt extends st{constructor(t=4,e=45,i=16777215,s=1,r=0,n=1,a=4,h=4,o=1,_=1,l="inner",c=!1){super(),this._$blurFilter=new rt(a,h,_),this._$distance=4,this._$angle=45,this._$highlightColor=16777215,this._$highlightAlpha=1,this._$shadowColor=0,this._$shadowAlpha=1,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.highlightColor=i,this.highlightAlpha=s,this.shadowColor=r,this.shadowAlpha=n,this.strength=o,this.type=l,this.knockout=c}static toString(){return"[class BevelFilter]"}static get namespace(){return"next2d.filters.BevelFilter"}toString(){return"[object BevelFilter]"}get namespace(){return"next2d.filters.BevelFilter"}get angle(){return this._$angle}set angle(t){(t%=360)!==this._$angle&&(this._$angle=Y(t,-360,360,45),this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get distance(){return this._$distance}set distance(t){(t=Y(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get highlightAlpha(){return this._$highlightAlpha}set highlightAlpha(t){(t=Y(+t,0,1,0))!==this._$highlightAlpha&&(this._$highlightAlpha=t,this._$doChanged())}get highlightColor(){return this._$highlightColor}set highlightColor(t){(t=Y(W(t),0,16777215,16777215))!==this._$highlightColor&&(this._$highlightColor=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get shadowAlpha(){return this._$shadowAlpha}set shadowAlpha(t){(t=Y(+t,0,1,0))!==this._$shadowAlpha&&(this._$shadowAlpha=t,this._$doChanged())}get shadowColor(){return this._$shadowColor}set shadowColor(t){(t=Y(W(t),0,16777215,0))!==this._$shadowColor&&(this._$shadowColor=t,this._$doChanged())}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){(t=`${t}`)!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new nt(this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return L(0,this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const n=this._$angle*p;let a=r.abs(r.cos(n)*this._$distance),h=r.abs(r.sin(n)*this._$distance);return e&&(a*=e),i&&(h*=i),s.xMin=r.min(s.xMin,a),a>0&&(s.xMax+=a),s.yMin=r.min(s.yMin,h),h>0&&(s.yMax+=h),s}_$canApply(){return this._$strength>0&&0!==this._$distance&&this._$blurFilter._$canApply()}_$applyFilter(e,i){this._$updated=!1;const s=e.frameBuffer,n=s.currentAttachment;if(!n)throw new Error("the current attachment is null.");e.setTransform(1,0,0,1,0,0);const a=s.getTextureFromCurrentAttachment();if(!this._$canApply())return a;const h=n.width,o=n.height,_=e._$offsetX,l=e._$offsetY;let c=r.sqrt(i[0]*i[0]+i[1]*i[1]),$=r.sqrt(i[2]*i[2]+i[3]*i[3]);c/=t,$/=t,c*=2,$*=2;const u=this._$angle*p,d=r.cos(u)*this._$distance*c,g=r.sin(u)*this._$distance*$,f=s.createTextureAttachment(h,o);e._$bind(f),e.reset(),e.drawImage(a,0,0,h,o),e.globalCompositeOperation="erase",e.drawImage(a,2*d,2*g,h,o);const m=this._$blurFilter._$applyFilter(e,i,!1),x=m.width,b=m.height,v=r.ceil(x+2*r.abs(d)),T=r.ceil(b+2*r.abs(g)),A="inner"===this._$type,M=A?h:v,y=A?o:T,E=r.abs(d),C=r.abs(g),S=(x-h)/2,F=(b-o)/2,B=A?0:E+S,w=A?0:C+F,R=A?-S-d:E-d,I=A?-F-g:C-g;return e._$bind(n),s.releaseAttachment(f,!0),e._$applyBitmapFilter(m,M,y,h,o,B,w,x,b,R,I,!1,this._$type,this._$knockout,this._$strength,null,null,null,q(this._$highlightColor,this._$highlightAlpha,!0),j(this._$highlightColor,this._$highlightAlpha,!0),K(this._$highlightColor,this._$highlightAlpha,!0),this._$highlightAlpha,q(this._$shadowColor,this._$shadowAlpha,!0),j(this._$shadowColor,this._$shadowAlpha,!0),K(this._$shadowColor,this._$shadowAlpha,!0),this._$shadowAlpha),e._$offsetX=_+B,e._$offsetY=l+w,s.releaseTexture(m),s.getTextureFromCurrentAttachment()}}class at extends st{constructor(t=null){super(),this._$matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix=t}static toString(){return"[class ColorMatrixFilter]"}static get namespace(){return"next2d.filters.ColorMatrixFilter"}toString(){return"[object ColorMatrixFilter]"}get namespace(){return"next2d.filters.ColorMatrixFilter"}get matrix(){return this._$matrix}set matrix(t){if(t&&n.isArray(t)&&20===t.length){for(let e=0;e<20;++e)if(t[e]!==this._$matrix[e]){this._$doChanged();break}this._$matrix=t}}clone(){return new at(this._$matrix)}_$toArray(){return L(2,this._$matrix)}_$generateFilterRect(t){return t}_$canApply(){return!0}_$applyFilter(t){this._$updated=!1;const e=t.frameBuffer,i=e.currentAttachment;t.setTransform(1,0,0,1,0,0);const s=e.getTextureFromCurrentAttachment(),r=s.width,n=s.height,a=e.createTextureAttachment(r,n);return t._$bind(a),t.reset(),t._$applyColorMatrixFilter(s,this._$matrix),e.releaseAttachment(i,!0),e.getTextureFromCurrentAttachment()}}class ht extends st{constructor(t=0,e=0,i=null,s=1,r=0,n=!0,a=!0,h=0,o=0){super(),this._$matrixX=0,this._$matrixY=0,this._$matrix=null,this._$divisor=1,this._$bias=0,this._$preserveAlpha=!0,this._$clamp=!0,this._$color=0,this._$alpha=0,this.matrixX=t,this.matrixY=e,this.matrix=i,this.divisor=s,this.bias=r,this.preserveAlpha=n,this.clamp=a,this.color=h,this.alpha=o}static toString(){return"[class ConvolutionFilter]"}static get namespace(){return"next2d.filters.ConvolutionFilter"}toString(){return"[object ConvolutionFilter]"}get namespace(){return"next2d.filters.ConvolutionFilter"}get alpha(){return this._$alpha}set alpha(t){(t=Y(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get bias(){return this._$bias}set bias(t){t!==this._$bias&&(this._$bias=0|t,this._$doChanged())}get clamp(){return this._$clamp}set clamp(t){t!==this._$clamp&&(this._$clamp=!!t,this._$doChanged())}get color(){return this._$color}set color(t){(t=Y(W(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get divisor(){return this._$divisor}set divisor(t){t!==this._$divisor&&(this._$divisor=0|t,this._$doChanged())}get matrix(){return this._$matrix}set matrix(t){n.isArray(this._$matrix)&&O(this._$matrix),this._$matrix=n.isArray(t)?t:null,this._$doChanged()}get matrixX(){return this._$matrixX}set matrixX(t){(t=0|Y(0|t,0,15,0))!==this._$matrixX&&(this._$matrixX=t,this._$doChanged())}get matrixY(){return this._$matrixY}set matrixY(t){(t=0|Y(0|t,0,15,0))!==this._$matrixY&&(this._$matrixY=t,this._$doChanged())}get preserveAlpha(){return this._$preserveAlpha}set preserveAlpha(t){t!==this._$preserveAlpha&&(this._$preserveAlpha=!!t,this._$doChanged())}clone(){return new ht(this._$matrixX,this._$matrixY,this._$matrix?this._$matrix.slice():null,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}_$toArray(){return L(3,this._$matrixX,this._$matrixY,this._$matrix,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}_$generateFilterRect(t){return t}_$canApply(){return null!==this._$matrix&&this._$matrixX*this._$matrixY===this._$matrix.length}_$applyFilter(t){this._$updated=!1;const e=t.frameBuffer,i=e.currentAttachment;t.setTransform(1,0,0,1,0,0);const s=e.getTextureFromCurrentAttachment();return this._$canApply()&&this._$matrix?(t._$applyConvolutionFilter(s,this._$matrixX,this._$matrixY,this._$matrix,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,q(this._$color,this._$alpha,!1),j(this._$color,this._$alpha,!1),K(this._$color,this._$alpha,!1),this._$alpha),e.releaseAttachment(i,!0),e.getTextureFromCurrentAttachment()):s}}class ot extends st{constructor(t=null,e=null,i=0,s=0,r=0,n=0,a="wrap",h=0,o=0){super(),this._$mapBitmap=null,this._$mapPoint=null,this._$componentX=0,this._$componentY=0,this._$scaleX=0,this._$scaleY=0,this._$mode="wrap",this._$color=0,this._$alpha=0,this.mapBitmap=t,this.mapPoint=e,this.componentX=i,this.componentY=s,this.scaleX=r,this.scaleY=n,this.mode=a,this.color=h,this.alpha=o}static toString(){return"[class DisplacementMapFilter]"}static get namespace(){return"next2d.filters.DisplacementMapFilter"}toString(){return"[object DisplacementMapFilter]"}get namespace(){return"next2d.filters.DisplacementMapFilter"}get alpha(){return this._$alpha}set alpha(t){(t=Y(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get color(){return this._$color}set color(t){(t=Y(W(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get componentX(){return this._$componentX}set componentX(t){t!==this._$componentX&&(this._$componentX=t,this._$doChanged())}get componentY(){return this._$componentY}set componentY(t){t!==this._$componentY&&(this._$componentY=t,this._$doChanged())}get mapBitmap(){return this._$mapBitmap}set mapBitmap(t){t!==this._$mapBitmap&&(this._$mapBitmap=t,this._$doChanged())}get mapPoint(){return this._$mapPoint}set mapPoint(t){t!==this._$mapPoint&&(this._$mapPoint=t,this._$doChanged())}get mode(){return this._$mode}set mode(t){t!==this._$mode&&(this._$mode=t,this._$doChanged())}get scaleX(){return this._$scaleX}set scaleX(t){(t=Y(+t,-65535,65535,0))!==this._$scaleX&&(this._$scaleX=t,this._$doChanged())}get scaleY(){return this._$scaleY}set scaleY(t){(t=Y(+t,-65535,65535,0))!==this._$scaleY&&(this._$scaleY=t,this._$doChanged())}clone(){return new ot(this._$mapBitmap,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}_$toArray(){return L(4,this._$mapBitmap,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}_$generateFilterRect(t){return t}_$canApply(){return null!==this._$mapBitmap&&this._$componentX>0&&this._$componentY>0&&0!==this._$scaleX&&0!==this._$scaleY}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;t.setTransform(1,0,0,1,0,0);const n=i.getTextureFromCurrentAttachment();if(!this._$canApply()||!s||!this._$mapBitmap)return n;const a=r.sqrt(e[0]*e[0]+e[1]*e[1]),h=r.sqrt(e[2]*e[2]+e[3]*e[3]);return t._$applyDisplacementMapFilter(n,this._$mapBitmap,n.width/a,n.height/h,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,q(this._$color,this._$alpha,!0),j(this._$color,this._$alpha,!0),K(this._$color,this._$alpha,!0),this._$alpha),i.releaseAttachment(s,!0),i.getTextureFromCurrentAttachment()}}class _t extends st{constructor(t=4,e=45,i=0,s=1,r=4,n=4,a=1,h=1,o=!1,_=!1,l=!1){super(),this._$blurFilter=new rt(r,n,h),this._$distance=4,this._$angle=45,this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this._$hideObject=!1,this.distance=t,this.angle=e,this.color=i,this.alpha=s,this.strength=a,this.inner=o,this.knockout=_,this.hideObject=l}static toString(){return"[class DropShadowFilter]"}static get namespace(){return"next2d.filters.DropShadowFilter"}toString(){return"[object DropShadowFilter]"}get namespace(){return"next2d.filters.DropShadowFilter"}get alpha(){return this._$alpha}set alpha(t){(t=Y(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get angle(){return this._$angle}set angle(t){(t%=360)!==this._$angle&&(this._$angle=Y(t,-360,360,45),this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get color(){return this._$color}set color(t){(t=Y(W(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get distance(){return this._$distance}set distance(t){(t=Y(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get hideObject(){return this._$hideObject}set hideObject(t){t!==this._$hideObject&&(this._$hideObject=!!t,this._$doChanged())}get inner(){return this._$inner}set inner(t){t!==this._$inner&&(this._$inner=!!t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}clone(){return new _t(this._$distance,this._$angle,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout,this._$hideObject)}_$toArray(){return L(5,this._$distance,this._$angle,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout,this._$hideObject)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const n=this._$angle*p;let a=r.cos(n)*this._$distance,h=r.sin(n)*this._$distance;return e&&(a*=e),i&&(h*=i),s.xMin=r.min(s.xMin,a),a>0&&(s.xMax+=a),s.yMin=r.min(s.yMin,h),h>0&&(s.yMax+=h),s}_$canApply(){return this._$alpha>0&&this._$strength>0&&this._$blurFilter._$canApply()}_$applyFilter(e,i){const s=e.frameBuffer,n=s.currentAttachment;if(!n)throw new Error("the current attachment is null.");if(e.setTransform(1,0,0,1,0,0),!this._$canApply())return s.getTextureFromCurrentAttachment();const a=n.width,h=n.height,o=e._$offsetX,_=e._$offsetY,l=this._$blurFilter._$applyFilter(e,i,!1),c=l.width,$=l.height,u=e._$offsetX,d=e._$offsetY,g=u-o,f=d-_;let m=r.sqrt(i[0]*i[0]+i[1]*i[1]),x=r.sqrt(i[2]*i[2]+i[3]*i[3]);m/=t,x/=t,m*=2,x*=2;const b=this._$angle*p,v=r.cos(b)*this._$distance*m,T=r.sin(b)*this._$distance*x,A=this._$inner?a:c+r.max(0,r.abs(v)-g),M=this._$inner?h:$+r.max(0,r.abs(T)-f),y=r.ceil(A),E=r.ceil(M),C=(y-A)/2,S=(E-M)/2,F=this._$inner?0:r.max(0,g-v)+C,B=this._$inner?0:r.max(0,f-T)+S,w=this._$inner?v-u:(v>0?r.max(0,v-g):0)+C,R=this._$inner?T-d:(T>0?r.max(0,T-f):0)+S;let I,P;return this._$inner?(I="inner",P=this._$knockout||this._$hideObject):!this._$knockout&&this._$hideObject?(I="full",P=!0):(I="outer",P=this._$knockout),e._$bind(n),e._$applyBitmapFilter(l,y,E,a,h,F,B,c,$,w,R,!0,I,P,this._$strength,null,null,null,q(this._$color,this._$alpha,!0),j(this._$color,this._$alpha,!0),K(this._$color,this._$alpha,!0),this._$alpha,0,0,0,0),e._$offsetX=o+F,e._$offsetY=_+B,s.releaseTexture(l),s.getTextureFromCurrentAttachment()}}class lt extends st{constructor(t=0,e=1,i=4,s=4,r=1,n=1,a=!1,h=!1){super(),this._$blurFilter=new rt(i,s,n),this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this.color=t,this.alpha=e,this.strength=r,this.inner=a,this.knockout=h}static toString(){return"[class GlowFilter]"}static get namespace(){return"next2d.filters.GlowFilter"}toString(){return"[object GlowFilter]"}get namespace(){return"next2d.filters.GlowFilter"}get alpha(){return this._$alpha}set alpha(t){(t=Y(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get color(){return this._$color}set color(t){(t=Y(W(t),0,16777215,4))!==this._$color&&(this._$color=t,this._$doChanged())}get inner(){return this._$inner}set inner(t){t!==this._$inner&&(this._$inner=!!t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}clone(){return new lt(this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout)}_$toArray(){return L(6,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){const s=S(t.xMin,t.xMax,t.yMin,t.yMax);return this._$canApply()?this._$blurFilter._$generateFilterRect(s,e,i):s}_$canApply(){return this._$alpha>0&&this._$strength>0&&this._$blurFilter._$canApply()}_$applyFilter(t,e){const i=t.frameBuffer,s=i.currentAttachment;if(!s)throw new Error("the current attachment is null.");if(this._$updated=!1,t.setTransform(1,0,0,1,0,0),!this._$canApply())return i.getTextureFromCurrentAttachment();const r=s.width,n=s.height,a=t._$offsetX,h=t._$offsetY,o=this._$blurFilter._$applyFilter(t,e,!1),_=o.width,l=o.height,c=t._$offsetX,$=t._$offsetY,u=this._$inner?r:_,d=this._$inner?n:l,g=this._$inner?0:c-a,f=this._$inner?0:$-h,m=this._$inner?-c:0,p=this._$inner?-$:0,x=this._$inner?"inner":"outer";return t._$bind(s),t._$applyBitmapFilter(o,u,d,r,n,g,f,_,l,m,p,!0,x,this._$knockout,this._$strength,null,null,null,q(this._$color,this._$alpha,!0),j(this._$color,this._$alpha,!0),K(this._$color,this._$alpha,!0),this._$alpha,0,0,0,0),t._$offsetX=a+g,t._$offsetY=h+f,i.releaseTexture(o),i.getTextureFromCurrentAttachment()}}class ct extends st{constructor(t=4,e=45,i=null,s=null,r=null,n=4,a=4,h=1,o=1,_="inner",l=!1){super(),this._$blurFilter=new rt(n,a,o),this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.colors=i,this.alphas=s,this.ratios=r,this.strength=h,this.type=_,this.knockout=l}static toString(){return"[class GradientBevelFilter]"}static get namespace(){return"next2d.filters.GradientBevelFilter"}toString(){return"[object GradientBevelFilter]"}get namespace(){return"next2d.filters.GradientBevelFilter"}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(this._$alphas=t,n.isArray(t)){for(let e=0;e<t.length;++e){const i=t[e];t[e]=Y(+i,0,1,0)}this._$alphas=t}this._$doChanged()}}get angle(){return this._$angle}set angle(t){(t=Y(t%360,-360,360,45))!==this._$angle&&(this._$angle=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(this._$colors=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(W(t[e]),0,16777215,0);this._$colors=t}this._$doChanged()}}get distance(){return this._$distance}set distance(t){(t=Y(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(this._$ratios=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(+t[e],0,255,0);this._$ratios=t}this._$doChanged()}}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new ct(this._$distance,this._$angle,this._$colors?this._$colors.slice():null,this._$alphas?this._$alphas.slice():null,this._$ratios?this._$ratios.slice():null,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return L(7,this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const n=this._$angle*p;let a=r.abs(r.cos(n)*this._$distance),h=r.abs(r.sin(n)*this._$distance);return e&&(a*=e),i&&(h*=i),s.xMin=r.min(s.xMin,a),a>0&&(s.xMax+=a),s.yMin=r.min(s.yMin,h),h>0&&(s.yMax+=h),s}_$canApply(){return this._$strength>0&&this._$distance>0&&null!==this._$alphas&&null!==this._$ratios&&null!==this._$colors&&this._$blurFilter._$canApply()}_$applyFilter(e,i){this._$updated=!1;const s=e.frameBuffer,n=s.currentAttachment;e.setTransform(1,0,0,1,0,0);const a=s.getTextureFromCurrentAttachment();if(!this._$canApply()||!n)return a;const h=n.width,o=n.height,_=e._$offsetX,l=e._$offsetY;let c=r.sqrt(i[0]*i[0]+i[1]*i[1]),$=r.sqrt(i[2]*i[2]+i[3]*i[3]);c/=t,$/=t,c*=2,$*=2;const u=+this._$angle*p,d=+r.cos(u)*this._$distance*c,g=+r.sin(u)*this._$distance*$,f=s.createTextureAttachment(h,o);e._$bind(f),e.reset(),e.drawImage(a,0,0,h,o),e.globalCompositeOperation="erase",e.drawImage(a,2*d,2*g,h,o);const m=this._$blurFilter._$applyFilter(e,i,!1),x=m.width,b=m.height,v=r.ceil(x+2*r.abs(d)),T=r.ceil(b+2*r.abs(g)),A="inner"===this._$type,M=A?h:v,y=A?o:T,E=r.abs(d),C=r.abs(g),S=(x-h)/2,F=(b-o)/2,B=A?0:E+S,w=A?0:C+F,R=A?-S-d:E-d,I=A?-F-g:C-g;return e._$bind(n),e._$applyBitmapFilter(m,M,y,h,o,B,w,x,b,R,I,!1,this._$type,this._$knockout,this._$strength,this._$ratios,this._$colors,this._$alphas,0,0,0,0,0,0,0,0),e._$offsetX=_+B,e._$offsetY=l+w,s.releaseAttachment(f,!0),s.getTextureFromCurrentAttachment()}}class $t extends st{constructor(t=4,e=45,i=null,s=null,r=null,n=4,a=4,h=1,o=1,_="inner",l=!1){super(),this._$blurFilter=new rt(n,a,o),this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.colors=i,this.alphas=s,this.ratios=r,this.strength=h,this.type=_,this.knockout=l}static toString(){return"[class GradientGlowFilter]"}static get namespace(){return"next2d.filters.GradientGlowFilter"}toString(){return"[object GradientGlowFilter]"}get namespace(){return"next2d.filters.GradientGlowFilter"}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(this._$alphas=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(+t[e],0,1,0);this._$alphas=t}this._$doChanged()}}get angle(){return this._$angle}set angle(t){(t=Y(t%360,-360,360,45))!==this._$angle&&(this._$angle=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(this._$colors=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(W(t[e]),0,16777215,0);this._$colors=t}this._$doChanged()}}get distance(){return this._$distance}set distance(t){(t=Y(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(this._$ratios=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(+t[e],0,255,0);this._$ratios=t}this._$doChanged()}}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new $t(this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return L(8,this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const n=this._$angle*p;let a=r.abs(r.cos(n)*this._$distance),h=r.abs(r.sin(n)*this._$distance);return e&&(a*=e),i&&(h*=i),s.xMin=r.min(s.xMin,a),a>0&&(s.xMax+=a),s.yMin=r.min(s.yMin,h),h>0&&(s.yMax+=h),s}_$canApply(){return this._$strength>0&&this._$distance>0&&null!==this._$alphas&&null!==this._$ratios&&null!==this._$colors&&this._$blurFilter._$canApply()}_$applyFilter(e,i){this._$updated=!1;const s=e.frameBuffer,n=s.currentAttachment;if(e.setTransform(1,0,0,1,0,0),!this._$canApply()||!n)return s.getTextureFromCurrentAttachment();const a=n.width,h=n.height,o=e._$offsetX,_=e._$offsetY,l=this._$blurFilter._$applyFilter(e,i,!1),c=l.width,$=l.height,u=e._$offsetX,d=e._$offsetY,g=u-o,f=d-_;let m=r.sqrt(i[0]*i[0]+i[1]*i[1]),x=r.sqrt(i[2]*i[2]+i[3]*i[3]);m/=t,x/=t,m*=2,x*=2;const b=+this._$angle*p,v=+r.cos(b)*this._$distance*m,T=+r.sin(b)*this._$distance*x,A="inner"===this.type,M=A?a:c+r.max(0,r.abs(v)-g),y=A?h:$+r.max(0,r.abs(T)-f),E=r.ceil(M),C=r.ceil(y),S=(E-M)/2,F=(C-y)/2,B=A?0:r.max(0,g-v)+S,w=A?0:r.max(0,f-T)+F,R=A?v-u:(v>0?r.max(0,v-g):0)+S,I=A?T-d:(T>0?r.max(0,T-f):0)+F;return e._$bind(n),e._$applyBitmapFilter(l,E,C,a,h,B,w,c,$,R,I,!0,this._$type,this._$knockout,this._$strength,this._$ratios,this._$colors,this._$alphas,0,0,0,0,0,0,0,0),e._$offsetX=o+B,e._$offsetY=_+w,s.releaseTexture(l),s.getTextureFromCurrentAttachment()}}class ut{constructor(){this._$instanceId=-1,this._$parentId=-1,this._$loaderInfoId=-1,this._$characterId=-1,this._$clipDepth=0,this._$depth=0,this._$isMask=!1,this._$updated=!0,this._$matrix=R(1,0,0,1,0,0),this._$colorTransform=P(1,1,1,1,0,0,0,0),this._$blendMode="normal",this._$filters=null,this._$visible=!0,this._$maskId=-1,this._$maskMatrix=null,this._$isMask=!1,this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$scale9Grid=null,this._$matrixBase=null}_$shouldClip(t){const e=this._$getBounds(t),i=r.abs(e.xMax-e.xMin),s=r.abs(e.yMax-e.yMin);return F(e),!(!i||!s)}_$getLayerBounds(e){const i=this._$getBounds(),s=H(i,e);F(i);const n=this._$filters;if(!n||!n.length)return s;let a=S(0,r.abs(s.xMax-s.xMin),0,r.abs(s.yMax-s.yMin));F(s);let h=+r.sqrt(e[0]*e[0]+e[1]*e[1]),o=+r.sqrt(e[2]*e[2]+e[3]*e[3]);h/=t,o/=t,h*=2,o*=2;for(let t=0;t<n.length;++t)a=n[t]._$generateFilterRect(a,h,o);return a}_$getBounds(t=null){const e=S(this._$xMin,this._$xMax,this._$yMin,this._$yMax);if(!t)return e;let i=t;const s=this._$matrix;1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=z(t,s));const r=H(e,i);return F(e),i!==t&&I(i),r}_$startClip(t,e){t.drawInstacedArray();const i=this._$getBounds(e),s=t._$startClip(i);if(F(i),!s)return!1;t._$enterClip(),t._$beginClipDef();let r=!1;return"_$children"in this&&(r=!0,t._$updateContainerClipFlag(!0)),this._$clip(t,e),this._$updated=!1,r&&(t._$updateContainerClipFlag(!1),t._$drawContainerClip()),t._$endClipDef(),!0}_$doChanged(){if(this._$updated=!0,this._$parentId>-1){const t=oe.instances;if(!t.has(this._$parentId))return;const e=t.get(this._$parentId);e._$updated||e._$doChanged()}}_$update(t){if(this._$doChanged(),this._$visible=t.visible,"depth"in t&&(this._$depth=t.depth),"isMask"in t&&(this._$isMask=t.isMask),"clipDepth"in t&&(this._$clipDepth=t.clipDepth),"maskId"in t&&(this._$maskId=t.maskId,this._$maskId>-1&&t.maskMatrix&&(this._$maskMatrix=t.maskMatrix)),this._$matrix[0]="a"in t?t.a:1,this._$matrix[1]="b"in t?t.b:0,this._$matrix[2]="c"in t?t.c:0,this._$matrix[3]="d"in t?t.d:1,this._$matrix[4]="tx"in t?t.tx:0,this._$matrix[5]="ty"in t?t.ty:0,this._$colorTransform[0]="f0"in t?t.f0:1,this._$colorTransform[1]="f1"in t?t.f1:1,this._$colorTransform[2]="f2"in t?t.f2:1,this._$colorTransform[3]="f3"in t?t.f3:1,this._$colorTransform[4]="f4"in t?t.f4:0,this._$colorTransform[5]="f5"in t?t.f5:0,this._$colorTransform[6]="f6"in t?t.f6:0,this._$colorTransform[7]="f7"in t?t.f7:0,this._$blendMode=t.blendMode||"normal",this._$filters=null,t.filters&&t.filters.length){this._$filters=L();for(let e=0;e<t.filters.length;++e){const i=t.filters[e];switch(i.shift()){case 0:this._$filters.push(new nt(...i));break;case 1:this._$filters.push(new rt(...i));break;case 2:this._$filters.push(new at(...i));break;case 3:this._$filters.push(new ht(...i));break;case 4:this._$filters.push(new ot(...i));break;case 5:this._$filters.push(new _t(...i));break;case 6:this._$filters.push(new lt(...i));break;case 7:this._$filters.push(new ct(...i));break;case 8:this._$filters.push(new $t(...i))}}}t.grid&&(this._$scale9Grid=t.grid,t.matrixBase&&(this._$matrixBase=t.matrixBase))}_$canApply(t=null){if(t)for(let e=0;e<t.length;++e)if(t[e]._$canApply())return!0;return!1}_$remove(){this._$doChanged();const t=oe;it.setRemoveTimer(this._$instanceId),this._$loaderInfoId>-1&&this._$characterId&&it.setRemoveTimer(`${this._$loaderInfoId}@${this._$characterId}`),t.instances.delete(this._$instanceId),this._$instanceId=-1,this._$parentId=-1,this._$loaderInfoId=-1,this._$characterId=-1,this._$blendMode="normal",this._$filters=null,this._$visible=!0,this._$maskId=-1,this._$isMask=!1,this._$depth=0,this._$clipDepth=0,this._$scale9Grid=null}_$isUpdated(){return this._$updated}_$isFilterUpdated(t,e=null,i=!1){if(this._$isUpdated())return!0;if(i&&e)for(let t=0;t<e.length;++t)if(e[t]._$isUpdated())return!0;const s=it.get([this._$instanceId,"f"]);return!s||s.filterState!==i||s.matrix!==`${t[0]}_${t[1]}_${t[2]}_${t[3]}`}_$applyFilter(t,e,i,s,n,a){const h=+r.sqrt(s[0]*s[0]+s[1]*s[1]),o=+r.sqrt(s[2]*s[2]+s[3]*s[3]),_=r.atan2(s[1],s[0]),l=r.atan2(0-s[2],s[3]),c=R(r.cos(_),r.sin(_),0-r.sin(l),r.cos(l),n/2,a/2),$=R(1,0,0,1,0-i.width/2,0-i.height/2),u=z(c,$);I(c),I($);const d=t.frameBuffer,g=d.currentAttachment,f=d.createCacheAttachment(n,a);t._$bind(f),t.reset(),t.setTransform(u[0],u[1],u[2],u[3],u[4],u[5]),I(u),t.drawImage(i,0,0,i.width,i.height),t._$offsetX=0,t._$offsetY=0;const m=R(h,0,0,o,0,0);let p=null;for(let i=0;i<e.length;++i)p=e[i]._$applyFilter(t,m);if(I(m),!p)return i;const x=t._$offsetX,b=t._$offsetY;return t._$offsetX=0,t._$offsetY=0,p.offsetX=x,p.offsetY=b,p.matrix=s[0]+"_"+s[1]+"_"+s[2]+"_"+s[3],p.filterState=!0,t._$bind(g),d.releaseAttachment(f,!1),p}_$drawFilter(t,e,i,s,n,a=null){const h=L(this._$instanceId,"f");let o=it.get(h);const _=this._$isFilterUpdated(e,i,!0);if(o&&!_)return t.cachePosition=o,o;o&&it.set(h,null);const l=t.frameBuffer,c=a||t.getTextureFromRect(t.cachePosition),$=this._$applyFilter(t,i,c,e,s,n);l.textureManager.release(c);const u=this._$getLayerBounds(e);return o=l.createCachePosition(r.ceil(r.abs(u.xMax-u.xMin)),r.ceil(r.abs(u.yMax-u.yMin))),F(u),o.filterState=!0,o.matrix=`${e[0]}_${e[1]}_${e[2]}_${e[3]}_0_0`,o.offsetX=$.offsetX,o.offsetY=$.offsetY,t.drawTextureFromRect($,o),it.set(h,o),O(h),o}}class dt extends ut{constructor(){super(),this._$children=new Int32Array}_$clip(t,e){let i=e;const s=this._$matrix;1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=z(e,s));const r=oe.instances,n=this._$children;for(let e=0;e<this._$children.length;++e){const s=n[e];if(!r.has(s))continue;const a=r.get(s);a&&!a._$isMask&&(a._$clip(t,i),a._$updated=!1)}i!==e&&I(i)}_$draw(t,e,i){if(!this._$visible)return;let s=i;const r=this._$colorTransform;if(1===r[0]&&1===r[1]&&1===r[2]&&1===r[3]&&0===r[4]&&0===r[5]&&0===r[6]&&0===r[7]||(s=G(i,r)),!Y(s[3]+s[7]/255,0,1,0))return;const n=this._$children,a=n.length;if(!a)return;const h=this._$preDraw(t,e);if(!h)return;if(h.isLayer&&!h.isUpdated)return void this._$postDraw(t,e,s,h);const o=h.matrix,_=h.isLayer&&h.color?h.color:s;let l=!0,c=0;const $=oe.instances,u=t.isLayer;for(let e=0;e<a;++e){const i=n[e];if(!$.has(i))continue;const s=$.get(i);if(s._$isMask)continue;const r=s._$blendMode;if(("alpha"===r||"erase"===r)&&!u)continue;if(c&&(s._$depth>c||s._$clipDepth>0)&&(t.restore(),l&&t._$leaveClip(),c=0,l=!0),!l)continue;if(s._$clipDepth>0){c=s._$clipDepth,l=s._$shouldClip(o),l&&(t.save(),l=s._$startClip(t,o));continue}const a=s._$maskId>-1&&$.has(s._$maskId)?$.get(s._$maskId):null;if(a){let e;if(a._$updated=!1,this._$instanceId===a._$parentId)e=o;else{e=f;let i=$.get(a._$parentId);for(;i||i._$instanceId!==i._$parentId;)e=z(i._$matrix,e),i=$.get(i._$parentId);const s=oe.scaleX,r=R(s,0,0,s,0,0);if(e=z(r,e),I(r),t.isLayer){const i=t.getCurrentPosition();e[4]-=i.xMin,e[5]-=i.yMin}}if(!a._$shouldClip(e))continue;const i=a._$startClip(t,e);if(t.save(),!i){t.restore();continue}}s._$draw(t,o,_),s._$updated=!1,a&&(t.restore(),t._$leaveClip())}if(c&&(t.restore(),l&&t._$leaveClip()),h.isLayer)return this._$postDraw(t,e,s,h);h.matrix!==e&&I(h.matrix),s!==i&&N(s),Z(h)}_$getLayerBounds(e){const i=this._$children;if(!i.length)return S(0,0,0,0);const s=h.MAX_VALUE;let n=s,a=-s,o=s,_=-s;const l=oe.instances;for(let t=0;t<i.length;++t){const s=i[t];if(!l.has(s))continue;const h=l.get(s);let c=e;const $=h._$matrix;1===$[0]&&0===$[1]&&0===$[2]&&1===$[3]&&0===$[4]&&0===$[5]||(c=z(e,$));const u=h._$getLayerBounds(c);n=r.min(n,u.xMin),a=r.max(a,u.xMax),o=r.min(o,u.yMin),_=r.max(_,u.yMax),F(u),c!==e&&I(c)}if(!this._$filters||!this._$filters.length)return S(n,a,o,_);let c=S(0,a-n,0,_-o),$=+r.sqrt(e[0]*e[0]+e[1]*e[1]),u=+r.sqrt(e[2]*e[2]+e[3]*e[3]);$/=t,u/=t,$*=2,u*=2;for(let t=0;t<this._$filters.length;++t)c=this._$filters[t]._$generateFilterRect(c,$,u);return a+=c.xMax-(a-n),_+=c.yMax-(_-o),n+=c.xMin,o+=c.yMin,F(c),S(n,a,o,_)}_$getBounds(t=null){let e=f;if(t){e=t;const i=this._$matrix;1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]&&0===i[4]&&0===i[5]||(e=z(t,i))}const i=this._$children;if(!i.length){const i=S(e[4],-e[4],e[5],-e[5]);return t&&e!==t&&I(e),i}const s=h.MAX_VALUE;let n=s,a=-s,o=s,_=-s;const l=oe.instances;for(let t=0;t<i.length;++t){const s=i[t];if(!l.has(s))continue;const h=l.get(s)._$getBounds(e);n=r.min(n,h.xMin),a=r.max(a,h.xMax),o=r.min(o,h.yMin),_=r.max(_,h.yMax),F(h)}return t&&e!==t&&I(e),S(n,a,o,_)}_$preDraw(t,e){let i=e;const s=this._$matrix;if(1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=z(e,s)),!i[0]&&!i[1]||!i[2]&&!i[3])return null;const n=x.pop()||{isLayer:!1,isUpdated:null,canApply:null,matrix:null,color:null,blendMode:"normal",filters:null,sw:0,sh:0};n.matrix=i;const a=this._$blendMode;if("normal"!==a||this._$filters&&this._$filters.length>0){const s=this._$getBounds(null),o=H(s,i);F(s);const _=+o.xMax,l=+o.xMin,c=+o.yMax,$=+o.yMin;F(o);const u=r.ceil(r.abs(_-l)),d=r.ceil(r.abs(c-$));if(0>=u||0>=d)return Z(n),i!==e&&I(i),null;let g=+r.sqrt(i[0]*i[0]+i[1]*i[1]);if(!h.isInteger(g)){const t=g.toString(),e=t.indexOf("e");-1!==e&&(g=+t.slice(0,e)),g=+g.toFixed(4)}let f=+r.sqrt(i[2]*i[2]+i[3]*i[3]);if(!h.isInteger(f)){const t=f.toString(),e=t.indexOf("e");-1!==e&&(f=+t.slice(0,e)),f=+f.toFixed(4)}n.canApply=this._$canApply(this._$filters);let m=S(0,u,0,d);if(n.canApply&&this._$filters)for(let t=0;t<this._$filters.length;++t)m=this._$filters[t]._$generateFilterRect(m,g,f);const p=t.frameBuffer.currentAttachment;if(!p||!p.texture||l-m.xMin>p.width||$-m.yMin>p.height)return F(m),Z(n),i!==e&&I(i),null;if(0>l+m.xMax||0>$+m.yMax)return F(m),Z(n),i!==e&&I(i),null;let x=i[4]-l,b=i[5]-$;t._$startLayer(S(l,_,$,c));const v=this._$isFilterUpdated(i,this._$filters,n.canApply),T=this._$getLayerBounds(i),A=r.ceil(r.abs(T.xMax-T.xMin)),M=r.ceil(r.abs(T.yMax-T.yMin));F(T);const y=A-m.xMax+m.xMin,E=M-m.yMax+m.yMin;x+=y,b+=E,n.sw=y,n.sh=E,v&&t._$saveAttachment(r.ceil(u+y),r.ceil(d+E),!0),n.isLayer=!0,n.isUpdated=v,n.filters=this._$filters,n.blendMode=a,n.color=P(),n.matrix=R(i[0],i[1],i[2],i[3],x,b),i!==e&&I(i),F(m)}return n}_$postDraw(t,e,i,s){t.drawInstacedArray();const r=L(this._$instanceId,"f"),n=t.frameBuffer,a=s.matrix;let h=0,o=0,_=it.get(r);if(!_||s.isUpdated){_&&it.set(r,null),_=n.getTextureFromCurrentAttachment();const i=s.filters;let l=!1;if(i&&i.length){for(let s=0;s<i.length;++s)_=i[s]._$applyFilter(t,e);l=!0,h=t._$offsetX,o=t._$offsetY,t._$offsetX=0,t._$offsetY=0}_.filterState=l,_.matrix=`${a[0]}_${a[1]}_${a[2]}_${a[3]}`,_.offsetX=h,_.offsetY=o,it.set(r,_),t._$restoreAttachment()}_.offsetX&&(h=_.offsetX),_.offsetY&&(o=_.offsetY),t.reset(),t.globalAlpha=Y(i[3]+i[7]/255,0,1),t.globalCompositeOperation=s.blendMode;const l=t.getCurrentPosition();t.setTransform(1,0,0,1,l.xMin-h-s.sw,l.yMin-o-s.sh),t.drawImage(_,0,0,_.width,_.height,i),t._$endLayer(),t._$endLayer(),I(s.matrix),Z(s),t.cachePosition=null}_$remove(){this._$children=new Int32Array,super._$remove(),ce.push(this)}}class gt{constructor(){this._$rgb="rgb",this._$mode="pad",this._$type="linear",this._$focalPointRatio=0,this._$points=R(),this._$stops=L()}dispose(){const t=this._$stops;for(let e=0;e<t.length;++e)w(t[e][1]);I(this._$points)}get mode(){return this._$mode}get type(){return this._$type}get rgb(){return this._$rgb}get points(){return this._$points}get focalPointRatio(){return this._$focalPointRatio}get stops(){return this._$stops.sort(((t,e)=>{switch(!0){case t[0]>e[0]:return 1;case e[0]>t[0]:return-1;default:return 0}})),this._$stops}linear(t,e,i,s,r="rgb",n="pad"){return this._$type="linear",this._$points[0]=t,this._$points[1]=e,this._$points[2]=i,this._$points[3]=s,this._$rgb=r,this._$mode=n,this._$stops.length&&(this._$stops.length=0),this}radial(t,e,i,s,r,n,a="rgb",h="pad",o=0){return this._$type="radial",this._$points[0]=t,this._$points[1]=e,this._$points[2]=i,this._$points[3]=s,this._$points[4]=r,this._$points[5]=n,this._$rgb=a,this._$mode=h,this._$focalPointRatio=Y(o,-.975,.975,0),this._$stops.length&&(this._$stops.length=0),this}addColorStop(t,e){this._$stops.push(L(t,e))}}class ft{constructor(t,e,i,s){this._$context=t,this._$texture=e,this._$repeat=i,this._$colorTransform=s}get texture(){return this._$texture}get repeat(){return this._$repeat}get colorTransform(){return this._$colorTransform}}class mt{constructor(){this._$fillStyle=B(1,1,1,1),this._$strokeStyle=B(1,1,1,1),this._$lineWidth=1,this._$lineCap="round",this._$lineJoin="round",this._$miterLimit=5}get miterLimit(){return this._$miterLimit}set miterLimit(t){this._$miterLimit=t}get lineWidth(){return this._$lineWidth}set lineWidth(t){this._$lineWidth=t}get lineCap(){return this._$lineCap}set lineCap(t){this._$lineCap=t}get lineJoin(){return this._$lineJoin}set lineJoin(t){this._$lineJoin=t}get fillStyle(){return this._$fillStyle}set fillStyle(t){this._$fillStyle instanceof o&&w(this._$fillStyle),this._$fillStyle=t}get strokeStyle(){return this._$strokeStyle}set strokeStyle(t){this._$strokeStyle instanceof o&&w(this._$strokeStyle),this._$strokeStyle=t}clear(){this._$lineWidth=1,this._$lineCap="round",this._$lineJoin="round",this._$miterLimit=5,this._$clearFill(),this._$clearStroke()}_$clearFill(){if(this._$fillStyle instanceof gt)return this._$fillStyle.dispose(),void(this._$fillStyle=B(1,1,1,1));this._$fillStyle instanceof ft?this._$fillStyle=B(1,1,1,1):this._$fillStyle.fill(1)}_$clearStroke(){if(this._$strokeStyle instanceof gt)return this._$strokeStyle.dispose(),void(this._$strokeStyle=B(1,1,1,1));this._$strokeStyle instanceof ft?this._$strokeStyle=B(1,1,1,1):this._$strokeStyle.fill(1)}}let pt=2048;class xt{constructor(t){t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),this._$gl=t,this._$objectPool=[],this._$objectPoolArea=0,this._$activeTexture=-1,this._$boundTextures=[null,null,null],this._$maxWidth=0,this._$maxHeight=0,this._$atlasTextures=[],this._$atlasCacheMap=new Map,this._$positionObjectArray=[],this._$nodeObjectArray=[],this._$atlasNodes=new Map}createTextureAtlas(){const t=this._$gl.createTexture();t.width=pt,t.height=pt,this._$gl.activeTexture(this._$gl.TEXTURE3),this._$gl.bindTexture(this._$gl.TEXTURE_2D,t),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_S,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_T,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MIN_FILTER,this._$gl.NEAREST),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MAG_FILTER,this._$gl.NEAREST),this._$gl.texStorage2D(this._$gl.TEXTURE_2D,1,this._$gl.RGBA8,pt,pt),this._$gl.bindTexture(this._$gl.TEXTURE_2D,null),this._$activeTexture>-1&&this._$gl.activeTexture(this._$activeTexture);const e=this._$atlasTextures.length;this._$atlasNodes.set(e,[]),this._$atlasCacheMap.set(e,[]),this._$atlasTextures.push(t)}getAtlasTexture(t){return this._$atlasTextures[t]}getNode(t,e,i,s){const r=this._$nodeObjectArray.length?this._$nodeObjectArray.pop():{x:0,y:0,w:0,h:0};return r.x=t,r.y=e,r.w=i,r.h=s,r}createCachePosition(t,e){const i=this._$positionObjectArray.length?this._$positionObjectArray.pop():{index:0,x:0,y:0,w:0,h:0};i.x=i.y=0,i.w=t,i.h=e;for(const[s,r]of this._$atlasNodes){if(!r.length)return t>e?(pt-t-1>0&&r.push(this.getNode(t+1,0,pt-t-1,e)),pt-e-1>0&&r.push(this.getNode(0,e+1,pt,pt-e-1))):(pt-e-1>0&&r.push(this.getNode(0,e+1,t,pt-e-1)),pt-t-1>0&&r.push(this.getNode(t+1,0,pt-t-1,pt))),i.index=s,this._$atlasCacheMap.get(i.index).push(i),i;const n=r.length;for(let a=0;a<n;++a){const n=r[a];if(!(t>n.w||e>n.h))return i.index=s,i.x=n.x,i.y=n.y,this._$atlasCacheMap.get(i.index).push(i),n.w!==t||n.h!==e?t>e?(n.h-e-1>0&&r.push(this.getNode(n.x,n.y+e+1,n.w,n.h-e-1)),n.w-t-1>0?(n.x=n.x+t+1,n.w=n.w-t-1,n.h=e):(r.splice(a,1),this._$nodeObjectArray.push(n))):(n.w-t-1>0&&r.push(this.getNode(n.x+t+1,n.y,n.w-t-1,n.h)),n.h-e-1>0?(n.y=n.y+e+1,n.w=t,n.h=n.h-e-1):(r.splice(a,1),this._$nodeObjectArray.push(n))):(r.splice(a,1),this._$nodeObjectArray.push(n)),i}}const s=this._$atlasTextures.length;this.createTextureAtlas();const r=this._$atlasNodes.get(s);return t>e?(pt-t-1>0&&r.push(this.getNode(t+1,0,pt-t-1,e)),pt-e-1>0&&r.push(this.getNode(0,e+1,pt,pt-e-1))):(pt-e-1>0&&r.push(this.getNode(0,e+1,t,pt-e-1)),pt-t-1>0&&r.push(this.getNode(t+1,0,pt-t-1,pt))),i.index=s,this._$atlasCacheMap.get(i.index).push(i),i}releasePosition(t){var e;this._$atlasNodes.has(t.index)&&(null===(e=this._$atlasNodes.get(t.index))||void 0===e||e.unshift(this.getNode(t.x,t.y,t.w,t.h)),this._$positionObjectArray.push(t))}clearCache(){for(const t of this._$atlasCacheMap.values())t.length=0;for(const t of this._$atlasNodes.values())t.length=0}_$createTexture(t,e){const i=this._$gl.createTexture();return i.width=0,i.height=0,i.area=0,i.dirty=!0,i.smoothing=!0,this.bind0(i,!1),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_S,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_T,this._$gl.CLAMP_TO_EDGE),i.width=t,i.height=e,i.area=t*e,i.dirty=!1,this._$gl.texStorage2D(this._$gl.TEXTURE_2D,1,this._$gl.RGBA8,t,e),i}_$getTexture(t,e){for(let i=0;i<this._$objectPool.length;i++){const s=this._$objectPool[i];if(s.width===t&&s.height===e)return this._$objectPool.splice(i,1),this._$objectPoolArea-=s.area,this.bind0(s,!1),s}return this._$createTexture(t,e)}create(t,e,i=null,s=!1,r=!0){const n=this._$getTexture(t,e);return s&&this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r||this._$gl.pixelStorei(this._$gl.UNPACK_FLIP_Y_WEBGL,!1),n.width!==t||n.height!==e?(n.width=t,n.height=e,n.area=t*e,n.dirty=!1,this._$gl.texImage2D(this._$gl.TEXTURE_2D,0,this._$gl.RGBA,t,e,0,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)):i&&(n.dirty=!1,this._$gl.texSubImage2D(this._$gl.TEXTURE_2D,0,0,0,t,e,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)),s&&this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r||this._$gl.pixelStorei(this._$gl.UNPACK_FLIP_Y_WEBGL,!0),n}createFromImage(t,e=!1){return this._$createFromElement(t.width,t.height,t,e)}createFromCanvas(t){return this._$createFromElement(t.width,t.height,t,!1)}createFromVideo(t,e=!1){return this._$createFromElement(t.videoWidth,t.videoHeight,t,e)}_$createFromElement(t,e,i,s=!1){const r=this._$getTexture(t,e);return r.dirty=!1,this.bind0(r,s),this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.width!==t||r.height!==e?(r.width=t,r.height=e,r.area=t*e,this._$gl.texImage2D(this._$gl.TEXTURE_2D,0,this._$gl.RGBA,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)):this._$gl.texSubImage2D(this._$gl.TEXTURE_2D,0,0,0,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i),this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r}release(t){if(t.area>this._$maxWidth*this._$maxHeight*2)this._$gl.deleteTexture(t);else if(t.dirty=!0,this._$objectPool.push(t),this._$objectPoolArea+=t.area,this._$objectPool.length&&this._$objectPoolArea>this._$maxWidth*this._$maxHeight*10){const t=this._$objectPool.shift();this._$objectPoolArea-=t.area,this._$gl.deleteTexture(t)}}bind0(t,e=null){this._$bindTexture(2,this._$gl.TEXTURE2,null,null),this._$bindTexture(1,this._$gl.TEXTURE1,null,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,e)}bind01(t,e,i=null){this._$bindTexture(2,this._$gl.TEXTURE2,null,null),this._$bindTexture(1,this._$gl.TEXTURE1,e,i),this._$bindTexture(0,this._$gl.TEXTURE0,t,i)}bind012(t,e,i,s=null){this._$bindTexture(2,this._$gl.TEXTURE2,i,s),this._$bindTexture(1,this._$gl.TEXTURE1,e,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,null)}bind02(t,e,i=null){this._$bindTexture(2,this._$gl.TEXTURE2,e,i),this._$bindTexture(1,this._$gl.TEXTURE1,null,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,null)}_$bindTexture(t,e,i=null,s=null){const r=i!==this._$boundTextures[t],n=null!==s&&null!==i&&s!==i.smoothing;if((r||n||e===this._$gl.TEXTURE0)&&e!==this._$activeTexture&&(this._$activeTexture=e,this._$gl.activeTexture(e)),r&&(this._$boundTextures[t]=i,this._$gl.bindTexture(this._$gl.TEXTURE_2D,i)),n){i&&(i.smoothing=!!s);const t=s?this._$gl.LINEAR:this._$gl.NEAREST;this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MIN_FILTER,t),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MAG_FILTER,t)}}}class bt{constructor(t){this._$gl=t,this._$objectPool=L(),this._$objectPoolArea=0,this._$maxWidth=0,this._$maxHeight=0}set maxWidth(t){this._$maxWidth=t}set maxHeight(t){this._$maxHeight=t}_$createStencilBuffer(){const t=this._$gl.createRenderbuffer();if(!t)throw new Error("the stencil buffer is null.");return t.width=0,t.height=0,t.area=0,t.dirty=!0,t}_$getStencilBuffer(t,e){const i=this._$objectPool.length;for(let s=0;s<i;++s){const i=this._$objectPool[s];if(i.width===t&&i.height===e)return this._$objectPool.splice(s,1),this._$objectPoolArea-=i.area,i}if(i>100){const t=this._$objectPool.shift();if(t)return this._$objectPoolArea-=t.area,t}return this._$createStencilBuffer()}create(t,e){const i=this._$getStencilBuffer(t,e);return i.width===t&&i.height===e||(i.width=t,i.height=e,i.area=t*e,i.dirty=!1,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,i),this._$gl.renderbufferStorage(this._$gl.RENDERBUFFER,this._$gl.STENCIL_INDEX8,t,e)),i}release(t){if(t.area>this._$maxWidth*this._$maxHeight*2)this._$gl.deleteRenderbuffer(t);else if(t.dirty=!0,this._$objectPool.push(t),this._$objectPoolArea+=t.area,this._$objectPoolArea>this._$maxWidth*this._$maxHeight*10){const t=this._$objectPool.shift();t&&(this._$objectPoolArea-=t.area,this._$gl.deleteRenderbuffer(t))}}}class vt{constructor(t,e){this._$gl=t,this._$samples=e,this._$objectPool=L()}set samples(t){this._$samples=t}_$createColorBuffer(){const t=this._$gl.createRenderbuffer();if(!t)throw new Error("the color buffer is null.");const e=this._$gl.createRenderbuffer();if(!e)throw new Error("the stencil buffer is null.");return t.stencil=e,t.samples=0,t.width=0,t.height=0,t.area=0,t.dirty=!0,t}_$getColorBuffer(t){if(!this._$objectPool.length)return this._$createColorBuffer();const e=this._$bsearch(t);if(e<this._$objectPool.length){const t=this._$objectPool[e];return this._$objectPool.splice(e,1),t}const i=this._$objectPool.shift();if(!i)throw new Error("the color buffer is void.");return i}create(t,e,i=0){t=r.max(256,X(t)),e=r.max(256,X(e));const s=this._$getColorBuffer(t*e);return i||(i=this._$samples),(s.width<t||s.height<e||s.samples!==i)&&(t=r.max(t,s.width),e=r.max(e,s.height),s.samples=i,s.width=t,s.height=e,s.area=t*e,s.dirty=!1,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,s),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,i,this._$gl.RGBA8,t,e),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,s.stencil),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,i,this._$gl.STENCIL_INDEX8,t,e)),s}release(t){t.dirty=!0;const e=this._$bsearch(t.area);this._$objectPool.splice(e,0,t)}_$bsearch(t){let e=-1,i=this._$objectPool.length;for(;r.abs(i-e)>1;){const s=r.floor((i+e)/2);t<=this._$objectPool[s].area?i=s:e=s}return i}}class Tt{constructor(t,e){this._$gl=t,this._$objectPool=[],this._$frameBuffer=t.createFramebuffer(),t.bindFramebuffer(t.READ_FRAMEBUFFER,this._$frameBuffer),this._$frameBufferTexture=t.createFramebuffer(),this._$currentAttachment=null,this._$isBinding=!1,this._$textureManager=new xt(t),this._$stencilBufferPool=new bt(t),this._$colorBufferPool=new vt(t,e),this._$isRenderBinding=!1,this._$colorBuffer=this._$gl.createRenderbuffer(),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,e,this._$gl.RGBA8,pt,pt),this._$stencilBuffer=this._$gl.createRenderbuffer(),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$stencilBuffer),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,e,this._$gl.STENCIL_INDEX8,pt,pt)}bindRenderBuffer(){this._$isBinding||(this._$isBinding=!0,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)),this._$isRenderBinding||(this._$isRenderBinding=!0,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$stencilBuffer),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.STENCIL_ATTACHMENT,this._$gl.RENDERBUFFER,this._$stencilBuffer))}get currentAttachment(){return this._$currentAttachment}get textureManager(){return this._$textureManager}createCacheAttachment(t,e,i=!1,s=0){const r=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!1},n=this._$textureManager.create(t,e);return r.width=t,r.height=e,i?(r.color=this._$colorBufferPool.create(t,e,s),r.texture=n,r.msaa=!0,r.stencil=r.color.stencil):(r.color=n,r.texture=n,r.msaa=!1,r.stencil=this._$stencilBufferPool.create(t,e)),r.mask=!1,r.clipLevel=0,r.isActive=!0,r}clearCache(){this._$textureManager.clearCache()}setMaxSize(t,e){this._$stencilBufferPool._$maxWidth=t,this._$stencilBufferPool._$maxHeight=e,this._$textureManager._$maxWidth=t,this._$textureManager._$maxHeight=e}createTextureAttachment(t,e){const i=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!1},s=this._$textureManager.create(t,e);return i.width=t,i.height=e,i.color=s,i.texture=s,i.msaa=!1,i.stencil=null,i.mask=!1,i.clipLevel=0,i.isActive=!0,i}createTextureAttachmentFrom(t){const e=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!0};return e.width=t.width,e.height=t.height,e.color=t,e.texture=t,e.msaa=!1,e.stencil=null,e.mask=!1,e.clipLevel=0,e.isActive=!0,e}releaseAttachment(t=null,e=!1){t&&t.isActive&&(t.msaa?t.color instanceof WebGLRenderbuffer&&this._$colorBufferPool.release(t.color):t.stencil&&this._$stencilBufferPool.release(t.stencil),e&&t.texture&&this._$textureManager.release(t.texture),t.color=null,t.texture=null,t.stencil=null,t.isActive=!1,this._$objectPool.push(t))}bind(t){this._$currentAttachment=t,this._$isBinding||(this._$isBinding=!0,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)),t.msaa?t.color instanceof WebGLRenderbuffer&&(this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,t.color),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.RENDERBUFFER,t.color)):t.color instanceof WebGLTexture&&(t.color&&this._$textureManager.bind0(t.color),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,t.color,0)),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,t.stencil),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.STENCIL_ATTACHMENT,this._$gl.RENDERBUFFER,t.stencil),this._$isRenderBinding=!1}unbind(){this._$currentAttachment=null,this._$isBinding&&(this._$isBinding=!1,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,null))}transferToMainTexture(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$currentAttachment.texture;if(!i)throw new Error("the texture is null.");this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture),this._$textureManager.bind0(i),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,i,0),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,null),this._$gl.blitFramebuffer(0,0,t,e,0,0,t,e,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBuffer)}createCachePosition(t,e){return this._$textureManager.createCachePosition(t,e)}transferTexture(t){this._$gl.disable(this._$gl.SCISSOR_TEST),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture);const e=this._$textureManager.getAtlasTexture(t.index);this._$textureManager.bind0(e),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,e,0);const i=r.max(0,t.x-1),s=r.max(0,t.y-1),n=r.min(pt,t.x+t.w+1),a=r.min(pt,t.y+t.h+1);this._$gl.blitFramebuffer(i,s,n,a,i,s,n,a,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)}getTextureFromCurrentAttachment(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");if(!this._$currentAttachment.msaa&&this._$currentAttachment.texture)return this._$currentAttachment.texture;const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$currentAttachment.texture;if(!i)throw new Error("the texture is null.");return i.dirty=!1,this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture),this._$textureManager.bind0(i),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,i,0),this._$gl.blitFramebuffer(0,0,t,e,0,0,t,e,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer),i}createTextureFromPixels(t,e,i=null,s=!1,r=!0){return this._$textureManager.create(t,e,i,s,r)}createTextureFromCanvas(t){return this._$textureManager.createFromCanvas(t)}createTextureFromImage(t,e=!1){return this._$textureManager.createFromImage(t,e)}createTextureFromVideo(t,e=!1){return this._$textureManager.createFromVideo(t,e)}createTextureFromCurrentAttachment(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$textureManager.create(t,e);return this._$textureManager.bind0(i),this._$gl.copyTexSubImage2D(this._$gl.TEXTURE_2D,0,0,0,0,0,t,e),i}releaseTexture(t){this._$textureManager.release(t)}}class At{constructor(){this._$bezierConverterBuffer=new o(32)}cubicToQuad(t,e,i,s,r,n,a,h){this._$split2Cubic(t,e,i,s,r,n,a,h,0,16),this._$split2Cubic(this._$bezierConverterBuffer[0],this._$bezierConverterBuffer[1],this._$bezierConverterBuffer[2],this._$bezierConverterBuffer[3],this._$bezierConverterBuffer[4],this._$bezierConverterBuffer[5],this._$bezierConverterBuffer[6],this._$bezierConverterBuffer[7],0,8),this._$split2Cubic(this._$bezierConverterBuffer[16],this._$bezierConverterBuffer[17],this._$bezierConverterBuffer[18],this._$bezierConverterBuffer[19],this._$bezierConverterBuffer[20],this._$bezierConverterBuffer[21],this._$bezierConverterBuffer[22],this._$bezierConverterBuffer[23],16,24),this._$split2Quad(this._$bezierConverterBuffer[0],this._$bezierConverterBuffer[1],this._$bezierConverterBuffer[2],this._$bezierConverterBuffer[3],this._$bezierConverterBuffer[4],this._$bezierConverterBuffer[5],this._$bezierConverterBuffer[6],this._$bezierConverterBuffer[7],0),this._$split2Quad(this._$bezierConverterBuffer[8],this._$bezierConverterBuffer[9],this._$bezierConverterBuffer[10],this._$bezierConverterBuffer[11],this._$bezierConverterBuffer[12],this._$bezierConverterBuffer[13],this._$bezierConverterBuffer[14],this._$bezierConverterBuffer[15],8),this._$split2Quad(this._$bezierConverterBuffer[16],this._$bezierConverterBuffer[17],this._$bezierConverterBuffer[18],this._$bezierConverterBuffer[19],this._$bezierConverterBuffer[20],this._$bezierConverterBuffer[21],this._$bezierConverterBuffer[22],this._$bezierConverterBuffer[23],16),this._$split2Quad(this._$bezierConverterBuffer[24],this._$bezierConverterBuffer[25],this._$bezierConverterBuffer[26],this._$bezierConverterBuffer[27],this._$bezierConverterBuffer[28],this._$bezierConverterBuffer[29],this._$bezierConverterBuffer[30],this._$bezierConverterBuffer[31],24)}_$split2Cubic(t,e,i,s,r,n,a,h,o,_){const l=.125*(t+3*(i+r)+a),c=.125*(e+3*(s+n)+h),$=.125*(a+r-i-t),u=.125*(h+n-s-e);this._$bezierConverterBuffer[o]=t,this._$bezierConverterBuffer[o+1]=e,this._$bezierConverterBuffer[o+2]=.5*(t+i),this._$bezierConverterBuffer[o+3]=.5*(e+s),this._$bezierConverterBuffer[o+4]=l-$,this._$bezierConverterBuffer[o+5]=c-u,this._$bezierConverterBuffer[o+6]=l,this._$bezierConverterBuffer[o+7]=c,this._$bezierConverterBuffer[_]=l,this._$bezierConverterBuffer[_+1]=c,this._$bezierConverterBuffer[_+2]=l+$,this._$bezierConverterBuffer[_+3]=c+u,this._$bezierConverterBuffer[_+4]=.5*(r+a),this._$bezierConverterBuffer[_+5]=.5*(n+h),this._$bezierConverterBuffer[_+6]=a,this._$bezierConverterBuffer[_+7]=h}_$split2Quad(t,e,i,s,r,n,a,h,o){const _=.125*(t+3*(i+r)+a),l=.125*(e+3*(s+n)+h);this._$bezierConverterBuffer[o]=.25*t+.75*i,this._$bezierConverterBuffer[o+1]=.25*e+.75*s,this._$bezierConverterBuffer[o+2]=_,this._$bezierConverterBuffer[o+3]=l,this._$bezierConverterBuffer[o+4]=.75*r+.25*a,this._$bezierConverterBuffer[o+5]=.75*n+.25*h,this._$bezierConverterBuffer[o+6]=a,this._$bezierConverterBuffer[o+7]=h}}class Mt{constructor(){this._$currentPath=L(),this._$vertices=L(),this._$bezierConverter=new At}get vertices(){return this._$pushCurrentPathToVertices(),this._$vertices}begin(){for(this._$currentPath.length=0;this._$vertices.length;)O(this._$vertices.pop())}moveTo(t,e){this._$currentPath.length?this._$equalsToLastPoint(t,e)||(this._$pushCurrentPathToVertices(),this._$pushPointToCurrentPath(t,e,!1)):this._$pushPointToCurrentPath(t,e,!1)}lineTo(t,e){this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(t,e)||this._$pushPointToCurrentPath(t,e,!1)}quadTo(t,e,i,s){this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(i,s)||(this._$pushPointToCurrentPath(t,e,!0),this._$pushPointToCurrentPath(i,s,!1))}cubicTo(t,e,i,s,r,n){if(this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(r,n))return;const a=+this._$currentPath[this._$currentPath.length-3],h=+this._$currentPath[this._$currentPath.length-2];this._$bezierConverter.cubicToQuad(a,h,t,e,i,s,r,n);const o=this._$bezierConverter._$bezierConverterBuffer;for(let t=0;t<32;)this.quadTo(o[t++],o[t++],o[t++],o[t++])}drawCircle(t,e,i){const s=i,r=.5522847498307936*i;this.cubicTo(t+s,e+r,t+r,e+s,t,e+s),this.cubicTo(t-r,e+s,t-s,e+r,t-s,e),this.cubicTo(t-s,e-r,t-r,e-s,t,e-s),this.cubicTo(t+r,e-s,t+s,e-r,t+s,e)}close(){if(this._$currentPath.length<=6)return;const t=+this._$currentPath[0],e=+this._$currentPath[1];this._$equalsToLastPoint(t,e)||this._$pushPointToCurrentPath(t,e,!1)}_$equalsToLastPoint(t,e){const i=+this._$currentPath[this._$currentPath.length-3],s=+this._$currentPath[this._$currentPath.length-2];return t===i&&e===s}_$pushPointToCurrentPath(t,e,i){this._$currentPath.push(t,e,i)}_$pushCurrentPathToVertices(){this._$currentPath.length<4?this._$currentPath.length=0:(this._$vertices.push(this._$currentPath),this._$currentPath=L())}createRectVertices(t,e,i,s){return L(L(t,e,!1,t+i,e,!1,t+i,e+s,!1,t,e+s,!1))}}class yt{constructor(){this.enabled=!1,this.parentMatrixA=1,this.parentMatrixB=0,this.parentMatrixC=0,this.parentMatrixD=0,this.parentMatrixE=1,this.parentMatrixF=0,this.parentMatrixG=0,this.parentMatrixH=0,this.parentMatrixI=1,this.ancestorMatrixA=1,this.ancestorMatrixB=0,this.ancestorMatrixC=0,this.ancestorMatrixD=0,this.ancestorMatrixE=1,this.ancestorMatrixF=0,this.ancestorMatrixG=0,this.ancestorMatrixH=0,this.ancestorMatrixI=1,this.parentViewportX=0,this.parentViewportY=0,this.parentViewportW=0,this.parentViewportH=0,this.minXST=1e-5,this.minYST=1e-5,this.minXPQ=1e-5,this.minYPQ=1e-5,this.maxXST=.99999,this.maxYST=.99999,this.maxXPQ=.99999,this.maxYPQ=.99999}enable(t,e,i,s,n,a,h,o,_,l,c,$,u,d,g,f,m,p,x){const b=n.xMax-n.xMin,v=n.yMax-n.yMin,T=a.w,A=a.h,M=r.abs(r.ceil(b*h)),y=r.abs(r.ceil(v*h)),E=T>0?(a.x-n.xMin)/b:1e-5,C=A>0?(a.y-n.yMin)/v:1e-5,S=T>0?(a.x+a.w-n.xMin)/b:.99999,F=A>0?(a.y+a.h-n.yMin)/v:.99999;let B=M*E/i,w=y*C/s,R=(i-M*(1-S))/i,I=(s-y*(1-F))/s;if(B>=R){const t=E/(E+(1-S));B=r.max(t-1e-5,0),R=r.min(t+1e-5,1)}if(w>=I){const t=C/(C+(1-F));w=r.max(t-1e-5,0),I=r.min(t+1e-5,1)}this.enabled=!0,this.parentMatrixA=o,this.parentMatrixB=_,this.parentMatrixD=l,this.parentMatrixE=c,this.parentMatrixG=$,this.parentMatrixH=u,this.ancestorMatrixA=d,this.ancestorMatrixB=g,this.ancestorMatrixD=f,this.ancestorMatrixE=m,this.ancestorMatrixG=p,this.ancestorMatrixH=x,this.parentViewportX=t,this.parentViewportY=e,this.parentViewportW=i,this.parentViewportH=s,this.minXST=E,this.minYST=C,this.minXPQ=B,this.minYPQ=w,this.maxXST=S,this.maxYST=F,this.maxXPQ=R,this.maxYPQ=I}disable(){this.enabled=!1}}class Et{constructor(t,e){this._$gl=t,this._$array=[],this._$map=D();const i=this._$gl.getProgramParameter(e,this._$gl.ACTIVE_UNIFORMS);for(let t=0;t<i;t++){const i=this._$gl.getActiveUniform(e,t),s=i.name.endsWith("[0]")?i.name.slice(0,-3):i.name,r=this._$gl.getUniformLocation(e,s);if(i.type===this._$gl.SAMPLER_2D&&1===i.size)continue;const n={};switch(i.type){case this._$gl.FLOAT_VEC4:n.method=this._$gl.uniform4fv.bind(this._$gl,r),n.array=new o(4*i.size),n.assign=-1;break;case this._$gl.INT_VEC4:n.method=this._$gl.uniform4iv.bind(this._$gl,r),n.array=new _(4*i.size),n.assign=-1;break;case this._$gl.SAMPLER_2D:n.method=this._$gl.uniform1iv.bind(this._$gl,r),n.array=new _(i.size),n.assign=1;break;case this._$gl.FLOAT:case this._$gl.FLOAT_VEC2:case this._$gl.FLOAT_VEC3:case this._$gl.FLOAT_MAT2:case this._$gl.FLOAT_MAT3:case this._$gl.FLOAT_MAT4:case this._$gl.INT:case this._$gl.INT_VEC2:case this._$gl.INT_VEC3:default:throw new Error("Use gl.FLOAT_VEC4 or gl.INT_VEC4 instead")}this._$array.push(n),this._$map.set(s,n)}}getArray(t){const e=this._$map.get(t);if(!e||!e.array)throw new Error("the UniformData is null.");return e.array}get textures(){const t=this._$map.get("u_textures");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get highp(){const t=this._$map.get("u_highp");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get mediump(){const t=this._$map.get("u_mediump");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get integer(){const t=this._$map.get("u_integer");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}bindUniforms(){const t=this._$array.length;for(let e=0;e<t;e++){const t=this._$array[e];void 0!==t.method&&void 0!==t.assign&&(t.assign<0?t.method(t.array):t.assign>0&&(t.assign--,t.method(t.array)))}}}class Ct{constructor(){this._$attributes=[],this._$count=0}get attributes(){return this._$attributes}get count(){return this._$count}set count(t){this._$count=t}clear(){this._$attributes.length=0,this._$count=0}}class St{constructor(t,e,i,s){this._$gl=t,this._$context=e,this._$program=this._$createProgram(i,s),this._$uniform=new Et(t,this._$program),this._$instance=null}get instance(){return this._$instance||(this._$instance=new Ct),this._$instance}get uniform(){return this._$uniform}_$createProgram(t,i){const s=this._$gl.createProgram();s.id=e++;const r=this._$gl.createShader(this._$gl.VERTEX_SHADER);this._$gl.shaderSource(r,t),this._$gl.compileShader(r);const n=this._$gl.createShader(this._$gl.FRAGMENT_SHADER);return this._$gl.shaderSource(n,i),this._$gl.compileShader(n),this._$gl.attachShader(s,r),this._$gl.attachShader(s,n),this._$gl.linkProgram(s),this._$gl.detachShader(s,r),this._$gl.detachShader(s,n),this._$gl.deleteShader(r),this._$gl.deleteShader(n),s}_$attachProgram(){const t=this._$context.shaderList;t.currentProgramId!==this._$program.id&&(t.currentProgramId=this._$program.id,this._$gl.useProgram(this._$program))}drawArraysInstanced(t){this._$attachProgram(),this._$context.vao.bindInstnceArray(t),this._$gl.drawArraysInstanced(this._$gl.TRIANGLE_STRIP,0,4,t.count)}_$drawImage(){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bindCommonVertexArray(),this._$gl.drawArrays(this._$gl.TRIANGLE_STRIP,0,4)}_$drawGradient(t,e){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bindGradientVertexArray(t,e),this._$gl.drawArrays(this._$gl.TRIANGLE_STRIP,0,4)}_$stroke(t){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawElements(this._$gl.TRIANGLES,t.indexCount,this._$gl.UNSIGNED_SHORT,0)}_$fill(t){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t);const e=t.indexRanges,i=e[e.length-1];this._$gl.drawArrays(this._$gl.TRIANGLES,0,i.first+i.count)}_$containerClip(t,e,i){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawArrays(this._$gl.TRIANGLES,e,i)}_$drawPoints(t,e,i){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawArrays(this._$gl.POINTS,e,i)}}class Ft{static FUNCTION_GRID_OFF(){return"\\n\\nvec2 applyMatrix(in vec2 vertex) {\\n mat3 matrix = mat3(\\n u_highp[0].xyz,\\n u_highp[1].xyz,\\n u_highp[2].xyz\\n );\\n\\n vec2 position = (matrix * vec3(vertex, 1.0)).xy;\\n\\n return position;\\n}\\n\\n"}static FUNCTION_GRID_ON(t){return`\\n\\nvec2 applyMatrix(in vec2 vertex) {\\n mat3 parent_matrix = mat3(\\n u_highp[${t}].xyz,\\n u_highp[${t+1}].xyz,\\n u_highp[${t+2}].xyz\\n );\\n mat3 ancestor_matrix = mat3(\\n u_highp[${t+3}].xyz,\\n u_highp[${t+4}].xyz,\\n u_highp[${t+5}].xyz\\n );\\n vec2 parent_offset = vec2(u_highp[${t+2}].w, u_highp[${t+3}].w);\\n vec2 parent_size = vec2(u_highp[${t+4}].w, u_highp[${t+5}].w);\\n vec4 grid_min = u_highp[${t+6}];\\n vec4 grid_max = u_highp[${t+7}];\\n\\n vec2 position = (parent_matrix * vec3(vertex, 1.0)).xy;\\n position = (position - parent_offset) / parent_size;\\n\\n vec4 ga = grid_min;\\n vec4 gb = grid_max - grid_min;\\n vec4 gc = vec4(1.0) - grid_max;\\n\\n vec2 pa = position;\\n vec2 pb = position - grid_min.st;\\n vec2 pc = position - grid_max.st;\\n\\n position = (ga.pq / ga.st) * min(pa, ga.st)\\n + (gb.pq / gb.st) * clamp(pb, vec2(0.0), gb.st)\\n + (gc.pq / gc.st) * max(vec2(0.0), pc);\\n\\n position = position * parent_size + parent_offset;\\n position = (ancestor_matrix * vec3(position, 1.0)).xy;\\n\\n return position;\\n}\\n\\n`}}class Bt{static TEMPLATE(t,e,i,s){const r=e-1,n=i?this.VARYING_UV_ON():"",a=i?this.STATEMENT_UV_ON():"";return`#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\nlayout (location = 1) in vec2 a_option1;\\nlayout (location = 2) in vec2 a_option2;\\nlayout (location = 3) in float a_type;\\n\\nuniform vec4 u_highp[${t}];\\n\\n${n}\\n\\n${s?Ft.FUNCTION_GRID_ON(i?5:0):Ft.FUNCTION_GRID_OFF()}\\n\\nfloat crossVec2(in vec2 v1, in vec2 v2) {\\n return v1.x * v2.y - v2.x * v1.y;\\n}\\n\\nvec2 perpendicularVec2(in vec2 v1) {\\n float face = u_highp[${r}][1];\\n\\n return face * vec2(v1.y, -v1.x);\\n}\\n\\nvec2 calculateNormal(in vec2 direction) {\\n vec2 normalized = normalize(direction);\\n return perpendicularVec2(normalized);\\n}\\n\\nvec2 calculateIntersection(in vec2 v1, in vec2 v2, in vec2 o1, in vec2 o2) {\\n float t = crossVec2(o2 - o1, v2) / crossVec2(v1, v2);\\n return (o1 + t * v1);\\n}\\n\\nvec2 calculateAnchor(in vec2 position, in float convex, out vec2 v1, out vec2 v2, out vec2 o1, out vec2 o2) {\\n float miter_limit = u_highp[${r}][2];\\n\\n vec2 a = applyMatrix(a_option1);\\n vec2 b = applyMatrix(a_option2);\\n\\n v1 = convex * (position - a);\\n v2 = convex * (b - position);\\n o1 = calculateNormal(v1) + a;\\n o2 = calculateNormal(v2) + position;\\n\\n vec2 anchor = calculateIntersection(v1, v2, o1, o2) - position;\\n return normalize(anchor) * min(length(anchor), miter_limit);\\n}\\n\\nvoid main() {\\n vec2 viewport = vec2(u_highp[0].w, u_highp[1].w);\\n float half_width = u_highp[${r}][0];\\n\\n vec2 position = applyMatrix(a_vertex);\\n vec2 offset = vec2(0.0);\\n vec2 v1, v2, o1, o2;\\n\\n if (a_type == 1.0 || a_type == 2.0) { // 線分\\n offset = calculateNormal(a_option2 * (applyMatrix(a_option1) - position));\\n } else if (a_type == 10.0) { // スクエア線端\\n offset = normalize(position - applyMatrix(a_option1));\\n offset += a_option2 * perpendicularVec2(offset);\\n } else if (a_type == 21.0) { // マイター結合(線分Bの凸側)\\n offset = calculateAnchor(position, 1.0, v1, v2, o1, o2);\\n offset = calculateIntersection(v2, perpendicularVec2(offset), o2, position + offset) - position;\\n } else if (a_type == 22.0) { // マイター結合(線分Aの凸側)\\n offset = calculateAnchor(position, 1.0, v1, v2, o1, o2);\\n offset = calculateIntersection(v1, perpendicularVec2(offset), o1, position + offset) - position;\\n } else if (a_type == 23.0) { // マイター結合(線分Aの凹側)\\n offset = calculateAnchor(position, -1.0, v1, v2, o1, o2);\\n offset = calculateIntersection(v1, perpendicularVec2(offset), o1, position + offset) - position;\\n } else if (a_type == 24.0) { // マイター結合(線分Bの凹側)\\n offset = calculateAnchor(position, -1.0, v1, v2, o1, o2);\\n offset = calculateIntersection(v2, perpendicularVec2(offset), o2, position + offset) - position;\\n } else if (a_type >= 30.0) { // ラウンド結合\\n float face = u_highp[${r}][1];\\n float rad = face * (a_type - 30.0) * 0.3488888889; /* 0.3488888889 = PI / 9.0 */\\n offset = mat2(cos(rad), sin(rad), -sin(rad), cos(rad)) * vec2(1.0, 0.0);\\n }\\n \\n offset *= half_width;\\n position += offset;\\n ${a}\\n\\n position /= viewport;\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n`}static VARYING_UV_ON(){return"\\nout vec2 v_uv;\\n"}static STATEMENT_UV_ON(){return"\\n mat3 uv_matrix = mat3(\\n u_highp[0].xyz,\\n u_highp[1].xyz,\\n u_highp[2].xyz\\n );\\n mat3 inverse_matrix = mat3(\\n u_highp[3].xyz,\\n u_highp[4].xyz,\\n vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)\\n );\\n\\n v_uv = (uv_matrix * vec3(a_vertex, 1.0)).xy;\\n v_uv += offset;\\n v_uv = (inverse_matrix * vec3(v_uv, 1.0)).xy;\\n"}}class wt{static TEMPLATE(t,e,i,s){const r=i?this.ATTRIBUTE_BEZIER_ON():"",n=i?this.VARYING_BEZIER_ON():e?this.VARYING_UV_ON():"",a=i?this.STATEMENT_BEZIER_ON():e?this.STATEMENT_UV_ON():"";return`#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n${r}\\n\\nuniform vec4 u_highp[${t}];\\n\\n${n}\\n\\n${s?Ft.FUNCTION_GRID_ON(e?5:0):Ft.FUNCTION_GRID_OFF()}\\n\\nvoid main() {\\n vec2 viewport = vec2(u_highp[0].w, u_highp[1].w);\\n\\n ${a}\\n\\n vec2 pos = applyMatrix(a_vertex) / viewport;\\n pos = pos * 2.0 - 1.0;\\n gl_Position = vec4(pos.x, -pos.y, 0.0, 1.0);\\n}\\n\\n`}static ATTRIBUTE_BEZIER_ON(){return"\\nlayout (location = 1) in vec2 a_bezier;\\n"}static VARYING_UV_ON(){return"\\nout vec2 v_uv;\\n"}static VARYING_BEZIER_ON(){return"\\nout vec2 v_bezier;\\n"}static STATEMENT_UV_ON(){return"\\n mat3 uv_matrix = mat3(\\n u_highp[0].xyz,\\n u_highp[1].xyz,\\n u_highp[2].xyz\\n );\\n mat3 inverse_matrix = mat3(\\n u_highp[3].xyz,\\n u_highp[4].xyz,\\n vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)\\n );\\n\\n v_uv = (inverse_matrix * uv_matrix * vec3(a_vertex, 1.0)).xy;\\n"}static STATEMENT_BEZIER_ON(){return"\\n v_bezier = a_bezier;\\n"}}class Rt{static FUNCTION_IS_INSIDE(){return"\\n\\nfloat isInside(in vec2 uv) {\\n return step(4.0, dot(step(vec4(0.0, uv.x, 0.0, uv.y), vec4(uv.x, 1.0, uv.y, 1.0)), vec4(1.0)));\\n}\\n\\n"}static STATEMENT_INSTANCED_COLOR_TRANSFORM_ON(){return"\\n src.rgb /= max(0.0001, src.a);\\n src = clamp(src * mul + add, 0.0, 1.0);\\n src.rgb *= src.a;\\n"}static STATEMENT_COLOR_TRANSFORM_ON(t){return`\\n vec4 mul = u_mediump[${t}];\\n vec4 add = u_mediump[${t+1}];\\n${Rt.STATEMENT_INSTANCED_COLOR_TRANSFORM_ON()}\\n`}}class It{static SOLID_COLOR(){return"#version 300 es\\nprecision mediump float;\\n\\nuniform vec4 u_mediump;\\n\\nout vec4 o_color;\\n\\nvoid main() {\\n o_color = vec4(u_mediump.rgb * u_mediump.a, u_mediump.a);\\n}\\n\\n"}static BITMAP_CLIPPED(){return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump[3];\\n\\nin vec2 v_uv;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 uv = vec2(v_uv.x, u_mediump[0].y - v_uv.y) / u_mediump[0].xy;\\n\\n vec4 src = texture(u_texture, uv);\\n ${Rt.STATEMENT_COLOR_TRANSFORM_ON(1)}\\n o_color = src;\\n}`}static BITMAP_PATTERN(){return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump[3];\\n\\nin vec2 v_uv;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 uv = fract(vec2(v_uv.x, -v_uv.y) / u_mediump[0].xy);\\n \\n vec4 src = texture(u_texture, uv);\\n ${Rt.STATEMENT_COLOR_TRANSFORM_ON(1)}\\n o_color = src;\\n}`}static MASK(){return"#version 300 es\\nprecision mediump float;\\n\\nin vec2 v_bezier;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 px = dFdx(v_bezier);\\n vec2 py = dFdy(v_bezier);\\n\\n vec2 f = (2.0 * v_bezier.x) * vec2(px.x, py.x) - vec2(px.y, py.y);\\n float alpha = 0.5 - (v_bezier.x * v_bezier.x - v_bezier.y) / length(f);\\n\\n if (alpha > 0.0) {\\n o_color = vec4(min(alpha, 1.0));\\n } else {\\n discard;\\n } \\n}\\n\\n"}}class Pt{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getSolidColorShapeShader(t,e){const i=`s${t?"y":"n"}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=(e?8:3)+(t?1:0),r=s;let n;n=t?Bt.TEMPLATE(s,r,!1,e):wt.TEMPLATE(s,!1,!1,e);const a=new St(this._$gl,this._$context,n,It.SOLID_COLOR());return this._$collection.set(i,a),a}getBitmapShapeShader(t,e,i){const s=`b${t?"y":"n"}${e?"y":"n"}${i?"y":"n"}`;if(this._$collection.has(s)){const t=this._$collection.get(s);if(t)return t}const r=(i?13:5)+(t?1:0),n=r;let a;a=t?Bt.TEMPLATE(r,n,!0,i):wt.TEMPLATE(r,!0,!1,i);const h=e?It.BITMAP_PATTERN():It.BITMAP_CLIPPED(),o=new St(this._$gl,this._$context,a,h);return this._$collection.set(s,o),o}getMaskShapeShader(t,e){const i=`m${t?"y":"n"}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=(e?8:3)+(t?1:0),r=s;let n;n=t?Bt.TEMPLATE(s,r,!1,e):wt.TEMPLATE(s,!1,!0,e);const a=new St(this._$gl,this._$context,n,It.MASK());return this._$collection.set(i,a),a}setSolidColorShapeUniform(t,e,i,s,r,n,a,h,o,_,l,c){const $=t.highp;let u;n?($[0]=_.parentMatrixA,$[1]=_.parentMatrixB,$[2]=_.parentMatrixC,$[4]=_.parentMatrixD,$[5]=_.parentMatrixE,$[6]=_.parentMatrixF,$[8]=_.parentMatrixG,$[9]=_.parentMatrixH,$[10]=_.parentMatrixI,$[12]=_.ancestorMatrixA,$[13]=_.ancestorMatrixB,$[14]=_.ancestorMatrixC,$[16]=_.ancestorMatrixD,$[17]=_.ancestorMatrixE,$[18]=_.ancestorMatrixF,$[20]=_.ancestorMatrixG,$[21]=_.ancestorMatrixH,$[22]=_.ancestorMatrixI,$[3]=h,$[7]=o,$[11]=_.parentViewportX,$[15]=_.parentViewportY,$[19]=_.parentViewportW,$[23]=_.parentViewportH,$[24]=_.minXST,$[25]=_.minYST,$[26]=_.minXPQ,$[27]=_.minYPQ,$[28]=_.maxXST,$[29]=_.maxYST,$[30]=_.maxXPQ,$[31]=_.maxYPQ,u=32):($[0]=a[0],$[1]=a[1],$[2]=a[2],$[4]=a[3],$[5]=a[4],$[6]=a[5],$[8]=a[6],$[9]=a[7],$[10]=a[8],$[3]=h,$[7]=o,u=12),e&&($[u]=i,$[u+1]=s,$[u+2]=r);const d=t.mediump;d[0]=l[0],d[1]=l[1],d[2]=l[2],d[3]=l[3]*c}setBitmapShapeUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f,m,p,x,b){const v=t.highp;let T;v[0]=a[0],v[1]=a[1],v[2]=a[2],v[4]=a[3],v[5]=a[4],v[6]=a[5],v[8]=a[6],v[9]=a[7],v[10]=a[8],v[12]=h[0],v[13]=h[1],v[14]=h[2],v[16]=h[3],v[17]=h[4],v[18]=h[5],v[11]=h[6],v[15]=h[7],v[19]=h[8],v[3]=o,v[7]=_,T=20,n&&(v[T]=l.parentMatrixA,v[T+1]=l.parentMatrixB,v[T+2]=l.parentMatrixC,v[T+4]=l.parentMatrixD,v[T+5]=l.parentMatrixE,v[T+6]=l.parentMatrixF,v[T+8]=l.parentMatrixG,v[T+9]=l.parentMatrixH,v[T+10]=l.parentMatrixI,v[T+12]=l.ancestorMatrixA,v[T+13]=l.ancestorMatrixB,v[T+14]=l.ancestorMatrixC,v[T+16]=l.ancestorMatrixD,v[T+17]=l.ancestorMatrixE,v[T+18]=l.ancestorMatrixF,v[T+20]=l.ancestorMatrixG,v[T+21]=l.ancestorMatrixH,v[T+22]=l.ancestorMatrixI,v[T+11]=l.parentViewportX,v[T+15]=l.parentViewportY,v[T+19]=l.parentViewportW,v[T+23]=l.parentViewportH,v[T+24]=l.minXST,v[T+25]=l.minYST,v[T+26]=l.minXPQ,v[T+27]=l.minYPQ,v[T+28]=l.maxXST,v[T+29]=l.maxYST,v[T+30]=l.maxXPQ,v[T+31]=l.maxYPQ,T=52),e&&(v[T]=i,v[T+1]=s,v[T+2]=r);const A=t.mediump;A[0]=c,A[1]=$,A[4]=u,A[5]=d,A[6]=g,A[7]=f,A[8]=m,A[9]=p,A[10]=x,A[11]=b}setMaskShapeUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u=null){const d=t.highp;e&&u?(d[0]=u.parentMatrixA,d[1]=u.parentMatrixB,d[2]=u.parentMatrixC,d[4]=u.parentMatrixD,d[5]=u.parentMatrixE,d[6]=u.parentMatrixF,d[8]=u.parentMatrixG,d[9]=u.parentMatrixH,d[10]=u.parentMatrixI,d[12]=u.ancestorMatrixA,d[13]=u.ancestorMatrixB,d[14]=u.ancestorMatrixC,d[16]=u.ancestorMatrixD,d[17]=u.ancestorMatrixE,d[18]=u.ancestorMatrixF,d[20]=u.ancestorMatrixG,d[21]=u.ancestorMatrixH,d[22]=u.ancestorMatrixI,d[3]=c,d[7]=$,d[11]=u.parentViewportX,d[15]=u.parentViewportY,d[19]=u.parentViewportW,d[23]=u.parentViewportH,d[24]=u.minXST,d[25]=u.minYST,d[26]=u.minXPQ,d[27]=u.minYPQ,d[28]=u.maxXST,d[29]=u.maxYST,d[30]=u.maxXPQ,d[31]=u.maxYPQ):(d[0]=i,d[1]=s,d[2]=r,d[4]=n,d[5]=a,d[6]=h,d[8]=o,d[9]=_,d[10]=l,d[3]=c,d[7]=$)}setMaskShapeUniformIdentity(t,e,i){const s=t.highp;s[0]=1,s[1]=0,s[2]=0,s[4]=0,s[5]=1,s[6]=0,s[8]=0,s[9]=0,s[10]=1,s[3]=e,s[7]=i}}class Nt{static TEMPLATE(t,e,i,s,r){const n=i?this.STATEMENT_GRADIENT_TYPE_RADIAL(e,s):this.STATEMENT_GRADIENT_TYPE_LINEAR(e);let a;switch(r){case"reflect":a="1.0 - abs(fract(t * 0.5) * 2.0 - 1.0)";break;case"repeat":a="fract(t)";break;default:a="clamp(t, 0.0, 1.0)"}return`#version 300 es\\nprecision highp float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_highp[${t}];\\n\\nin vec2 v_uv;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 p = v_uv;\\n ${n}\\n t = ${a};\\n o_color = texture(u_texture, vec2(t, 0.5));\\n}\\n\\n`}static STATEMENT_GRADIENT_TYPE_LINEAR(t){return`\\n vec2 a = u_highp[${t}].xy;\\n vec2 b = u_highp[${t}].zw;\\n\\n vec2 ab = b - a;\\n vec2 ap = p - a;\\n\\n float t = dot(ab, ap) / dot(ab, ab);\\n`}static STATEMENT_GRADIENT_TYPE_RADIAL(t,e){return`\\n float radius = u_highp[${t}][0];\\n\\n vec2 coord = p / radius;\\n ${e?this.STATEMENT_FOCAL_POINT_ON(t):this.STATEMENT_FOCAL_POINT_OFF()}\\n`}static STATEMENT_FOCAL_POINT_OFF(){return"\\n float t = length(coord);\\n"}static STATEMENT_FOCAL_POINT_ON(t){return`\\n vec2 focal = vec2(u_highp[${t}][1], 0.0);\\n\\n vec2 dir = normalize(coord - focal);\\n\\n float a = dot(dir, dir);\\n float b = 2.0 * dot(dir, focal);\\n float c = dot(focal, focal) - 1.0;\\n float x = (-b + sqrt(b * b - 4.0 * a * c)) / (2.0 * a);\\n\\n float t = distance(focal, coord) / distance(focal, focal + dir * x);\\n`}}class kt{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getGradientShapeShader(t,e,i,s,r){const n=this.createCollectionKey(t,e,i,s,r);if(this._$collection.has(n)){const t=this._$collection.get(n);if(t)return t}const a=(e?13:5)+(t?1:0)+1,h=a-1;let o;o=t?Bt.TEMPLATE(a,h,!0,e):wt.TEMPLATE(a,!0,!1,e);const _=new St(this._$gl,this._$context,o,Nt.TEMPLATE(a,h,i,s,r));return this._$collection.set(n,_),_}createCollectionKey(t,e,i,s,r){const n=t?"y":"n",a=e?"y":"n",h=i?"y":"n",o=i&&s?"y":"n";let _=0;switch(r){case"reflect":_=1;break;case"repeat":_=2}return`${n}${a}${h}${o}${_}`}setGradientShapeUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u){const d=t.highp;d[0]=a[0],d[1]=a[1],d[2]=a[2],d[4]=a[3],d[5]=a[4],d[6]=a[5],d[8]=a[6],d[9]=a[7],d[10]=a[8],d[12]=h[0],d[13]=h[1],d[14]=h[2],d[16]=h[3],d[17]=h[4],d[18]=h[5],d[11]=h[6],d[15]=h[7],d[19]=h[8],d[3]=o,d[7]=_;let g=20;n&&(d[g]=l.parentMatrixA,d[g+1]=l.parentMatrixB,d[g+2]=l.parentMatrixC,d[g+4]=l.parentMatrixD,d[g+5]=l.parentMatrixE,d[g+6]=l.parentMatrixF,d[g+8]=l.parentMatrixG,d[g+9]=l.parentMatrixH,d[g+10]=l.parentMatrixI,d[g+12]=l.ancestorMatrixA,d[g+13]=l.ancestorMatrixB,d[g+14]=l.ancestorMatrixC,d[g+16]=l.ancestorMatrixD,d[g+17]=l.ancestorMatrixE,d[g+18]=l.ancestorMatrixF,d[g+20]=l.ancestorMatrixG,d[g+21]=l.ancestorMatrixH,d[g+22]=l.ancestorMatrixI,d[g+11]=l.parentViewportX,d[g+15]=l.parentViewportY,d[g+19]=l.parentViewportW,d[g+23]=l.parentViewportH,d[g+24]=l.minXST,d[g+25]=l.minYST,d[g+26]=l.minXPQ,d[g+27]=l.minYPQ,d[g+28]=l.maxXST,d[g+29]=l.maxYST,d[g+30]=l.maxXPQ,d[g+31]=l.maxYPQ,g=52),e&&(d[g]=i,d[g+1]=s,d[g+2]=r,g+=4),c?(d[g]=$[5],d[g+1]=u):(d[g]=$[0],d[g+1]=$[1],d[g+2]=$[2],d[g+3]=$[3])}}class Lt{static TEXTURE(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n\\nout vec2 v_coord;\\n\\nvoid main() {\\n v_coord = a_vertex;\\n\\n vec2 position = a_vertex * 2.0 - 1.0;\\n gl_Position = vec4(position, 0.0, 1.0);\\n}\\n\\n"}static BLEND(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n\\nuniform vec4 u_highp[4];\\n\\nout vec2 v_coord;\\n\\nvoid main() {\\n v_coord = a_vertex;\\n\\n vec2 offset = u_highp[0].xy;\\n vec2 size = u_highp[0].zw;\\n mat3 matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\\n\\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\\n position = position * size + offset;\\n position = (matrix * vec3(position, 1.0)).xy;\\n position /= viewport;\\n\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n"}static INSTANCE_BLEND(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n\\nuniform vec4 u_highp[5];\\n\\nout vec2 v_src_coord;\\nout vec2 v_dst_coord;\\n\\nvoid main() {\\n vec4 rect = vec4(u_highp[0].x, u_highp[0].y, u_highp[0].z, u_highp[0].w);\\n vec2 size = vec2(u_highp[4].x, u_highp[4].y);\\n mat3 matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\\n\\n v_src_coord = a_vertex * rect.zw + rect.xy;\\n v_dst_coord = a_vertex;\\n\\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\\n position = position * size;\\n position = (matrix * vec3(position, 1.0)).xy;\\n position /= viewport;\\n\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n"}static INSTANCE(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\nlayout (location = 1) in vec4 a_rect;\\nlayout (location = 2) in vec4 a_size;\\nlayout (location = 3) in vec2 a_offset;\\nlayout (location = 4) in vec4 a_matrix;\\nlayout (location = 5) in vec4 a_mul;\\nlayout (location = 6) in vec4 a_add;\\n\\nout vec2 v_coord;\\nout vec4 mul;\\nout vec4 add;\\n\\nvoid main() {\\n v_coord = a_vertex * a_rect.zw + a_rect.xy;\\n mul = a_mul;\\n add = a_add;\\n\\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\\n position = position * a_size.xy;\\n mat3 matrix = mat3(a_matrix.x, a_matrix.y, 0.0, a_matrix.z, a_matrix.w, 0.0, a_offset.x, a_offset.y, 1.0);\\n position = (matrix * vec3(position, 1.0)).xy;\\n position /= a_size.zw;\\n\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n"}static BLEND_CLIP(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n\\nuniform vec4 u_highp[4];\\n\\nout vec2 v_coord;\\n\\nvoid main() {\\n v_coord = a_vertex;\\n\\n vec2 offset = u_highp[0].xy;\\n vec2 size = u_highp[0].zw;\\n mat3 inv_matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\\n\\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\\n position *= viewport;\\n position = (inv_matrix * vec3(position, 1.0)).xy;\\n position = (position - offset) / size;\\n\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n"}}class Ot{static TEMPLATE(t,e,i){let s="";for(let t=1;t<e;t++){const i=t-1,n=t,a=`u_mediump[${e+r.floor(i/4)}][${i%4}]`,h=`u_mediump[${e+r.floor(n/4)}][${n%4}]`;s+=`\\n if (t <= ${h}) {\\n return mix(u_mediump[${i}], u_mediump[${n}], (t - ${a}) / (${h} - ${a}));\\n }\\n`}return`#version 300 es\\nprecision mediump float;\\n\\nuniform vec4 u_mediump[${t}];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvec4 getGradientColor(in float t) {\\n if (t <= u_mediump[${e}][0]) {\\n return u_mediump[0];\\n }\\n ${s}\\n return u_mediump[${e-1}];\\n}\\n\\nvoid main() {\\n vec4 color = getGradientColor(v_coord.x);\\n ${i?"color = pow(color, vec4(0.45454545));":""}\\n color.rgb *= color.a;\\n\\n o_color = color;\\n}\\n\\n`}}class Ut{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getGradientLUTShader(t,e){const i=`l${("00"+t).slice(-3)}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=r.ceil(5*t/4),n=new St(this._$gl,this._$context,Lt.TEXTURE(),Ot.TEMPLATE(s,t,e));return this._$collection.set(i,n),n}setGradientLUTUniformForShape(t,e,i,s,r){let n=0;const a=t.mediump;for(let t=i;t<s;t++){const i=e[t][1];a[n++]=r[i[0]],a[n++]=r[i[1]],a[n++]=r[i[2]],a[n++]=r[i[3]]}for(let t=i;t<s;t++)a[n++]=e[t][0]}setGradientLUTUniformForFilter(t,e,i,s,r,n){let a=0;const h=t.mediump;for(let t=r;t<n;t++){const e=i[t];h[a++]=(e>>16)/255,h[a++]=(e>>8&255)/255,h[a++]=(255&e)/255,h[a++]=s[t]}for(let t=r;t<n;t++)h[a++]=e[t]}}class Dt{static TEMPLATE(t,e,i,s,r,n,a,h,o){let _=0;const l=i?this.STATEMENT_BASE_TEXTURE_TRANSFORM(_++):"",c=s?this.STATEMENT_BLUR_TEXTURE_TRANSFORM(_++):this.STATEMENT_BLUR_TEXTURE(),$="inner"===n,u=_;let d,g,f=4*_;switch(o?d=r?this.STATEMENT_GLOW(!1,i,h,o,u,f):this.STATEMENT_BEVEL(i,s,h,o,u,f):r?(f+=4,d=this.STATEMENT_GLOW($,i,h,o,u,f)):(f+=8,d=this.STATEMENT_BEVEL(i,s,h,o,u,f)),n){case"outer":g=a?"blur - blur * base.a":"base + blur - blur * base.a";break;case"full":g=a?"blur":"base - base * blur.a + blur";break;default:g="blur"}return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_textures[${t}];\\nuniform vec4 u_mediump[${e}];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\n${Rt.FUNCTION_IS_INSIDE()}\\n\\nvoid main() {\\n ${l}\\n ${c}\\n ${d}\\n o_color = ${g};\\n}\\n\\n`}static STATEMENT_BASE_TEXTURE_TRANSFORM(t){return`\\n vec2 base_scale = u_mediump[${t}].xy;\\n vec2 base_offset = u_mediump[${t}].zw;\\n\\n vec2 uv = v_coord * base_scale - base_offset;\\n vec4 base = mix(vec4(0.0), texture(u_textures[1], uv), isInside(uv));\\n`}static STATEMENT_BLUR_TEXTURE(){return"\\n vec4 blur = texture(u_textures[0], v_coord);\\n"}static STATEMENT_BLUR_TEXTURE_TRANSFORM(t){return`\\n vec2 blur_scale = u_mediump[${t}].xy;\\n vec2 blur_offset = u_mediump[${t}].zw;\\n\\n vec2 st = v_coord * blur_scale - blur_offset;\\n vec4 blur = mix(vec4(0.0), texture(u_textures[0], st), isInside(st));\\n`}static STATEMENT_GLOW(t,e,i,s,r,n){return`\\n ${t?"blur.a = 1.0 - blur.a;":""}\\n ${i?this.STATEMENT_GLOW_STRENGTH(n):""}\\n ${s?this.STATEMENT_GLOW_GRADIENT_COLOR(e):this.STATEMENT_GLOW_SOLID_COLOR(r)}\\n`}static STATEMENT_GLOW_STRENGTH(t){return`\\n float strength = u_mediump[${r.floor(t/4)}][${t%4}];\\n blur.a = clamp(blur.a * strength, 0.0, 1.0);\\n`}static STATEMENT_GLOW_SOLID_COLOR(t){return`\\n vec4 color = u_mediump[${t}];\\n blur = color * blur.a;\\n`}static STATEMENT_GLOW_GRADIENT_COLOR(t){return`\\n blur = texture(u_textures[${t?2:1}], vec2(blur.a, 0.5));\\n`}static STATEMENT_BEVEL(t,e,i,s,r,n){return`\\n ${e?this.STATEMENT_BLUR_TEXTURE_TRANSFORM_2():this.STATEMENT_BLUR_TEXTURE_2()}\\n float highlight_alpha = blur.a - blur2.a;\\n float shadow_alpha = blur2.a - blur.a;\\n ${i?this.STATEMENT_BEVEL_STRENGTH(n):""}\\n highlight_alpha = clamp(highlight_alpha, 0.0, 1.0);\\n shadow_alpha = clamp(shadow_alpha, 0.0, 1.0);\\n ${s?this.STATEMENT_BEVEL_GRADIENT_COLOR(t):this.STATEMENT_BEVEL_SOLID_COLOR(r)}\\n`}static STATEMENT_BLUR_TEXTURE_2(){return"\\n vec4 blur2 = texture(u_textures[0], 1.0 - v_coord);\\n"}static STATEMENT_BLUR_TEXTURE_TRANSFORM_2(){return"\\n vec2 pq = (1.0 - v_coord) * blur_scale - blur_offset;\\n vec4 blur2 = mix(vec4(0.0), texture(u_textures[0], pq), isInside(pq));\\n"}static STATEMENT_BEVEL_STRENGTH(t){return`\\n float strength = u_mediump[${r.floor(t/4)}][${t%4}];\\n highlight_alpha *= strength;\\n shadow_alpha *= strength;\\n`}static STATEMENT_BEVEL_SOLID_COLOR(t){return`\\n vec4 highlight_color = u_mediump[${t}];\\n vec4 shadow_color = u_mediump[${t+1}];\\n blur = highlight_color * highlight_alpha + shadow_color * shadow_alpha;\\n`}static STATEMENT_BEVEL_GRADIENT_COLOR(t){return`\\n blur = texture(u_textures[${t?2:1}], vec2(\\n 0.5019607843137255 - 0.5019607843137255 * shadow_alpha + 0.4980392156862745 * highlight_alpha,\\n 0.5\\n ));\\n`}}class Xt{static TEMPLATE(t){const e=t.toFixed(1);return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump;\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 offset = u_mediump.xy;\\n float fraction = u_mediump.z;\\n float samples = u_mediump.w;\\n \\n vec4 color = texture(u_texture, v_coord);\\n\\n for (float i = 1.0; i < ${e}; i += 1.0) {\\n color += texture(u_texture, v_coord + offset * i);\\n color += texture(u_texture, v_coord - offset * i);\\n }\\n color += texture(u_texture, v_coord + offset * ${e}) * fraction;\\n color += texture(u_texture, v_coord - offset * ${e}) * fraction;\\n color /= samples;\\n\\n o_color = color;\\n}\\n\\n`}}class Vt{static TEMPLATE(){return"#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump[5];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvoid main() {\\n mat4 mul = mat4(u_mediump[0], u_mediump[1], u_mediump[2], u_mediump[3]);\\n vec4 add = u_mediump[4];\\n \\n vec4 color = texture(u_texture, v_coord);\\n\\n color.rgb /= max(0.0001, color.a);\\n color = clamp(color * mul + add, 0.0, 1.0);\\n color.rgb *= color.a;\\n\\n o_color = color;\\n}\\n\\n"}}class Yt{static TEMPLATE(t,e,i,s,n){const a=r.floor(.5*e),h=r.floor(.5*i),o=e*i;let _="";const l=n?1:2;for(let t=0;t<o;++t)_+=`\\n result += getWeightedColor(${t}, u_mediump[${l+r.floor(t/4)}][${t%4}]);\\n`;const c=s?"result.a = texture(u_texture, v_coord).a;":"",$=n?"":"\\n vec4 substitute_color = u_mediump[1];\\n color = mix(substitute_color, color, isInside(uv));\\n";return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump[${t}];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\n${Rt.FUNCTION_IS_INSIDE()}\\n\\nvec4 getWeightedColor (in int i, in float weight) {\\n vec2 rcp_size = u_mediump[0].xy;\\n\\n int i_div_x = i / ${e};\\n int i_mod_x = i - ${e} * i_div_x;\\n vec2 offset = vec2(i_mod_x - ${a}, ${h} - i_div_x);\\n vec2 uv = v_coord + offset * rcp_size;\\n\\n vec4 color = texture(u_texture, uv);\\n color.rgb /= max(0.0001, color.a);\\n ${$}\\n\\n return color * weight;\\n}\\n\\nvoid main() {\\n float rcp_divisor = u_mediump[0].z;\\n float bias = u_mediump[0].w;\\n\\n vec4 result = vec4(0.0);\\n ${_}\\n result = clamp(result * rcp_divisor + bias, 0.0, 1.0);\\n ${c}\\n\\n result.rgb *= result.a;\\n o_color = result;\\n}\\n\\n`}}class zt{static TEMPLATE(t,e,i,s){let r,n,a;switch(e){case 1:r="map_color.r";break;case 2:r="map_color.g";break;case 4:r="map_color.b";break;case 8:r="map_color.a";break;default:r="0.5"}switch(i){case 1:n="map_color.r";break;case 2:n="map_color.g";break;case 4:n="map_color.b";break;case 8:n="map_color.a";break;default:n="0.5"}switch(s){case"clamp":a="\\n vec4 source_color = texture(u_textures[0], uv);\\n";break;case"ignore":a="\\n vec4 source_color =texture(u_textures[0], mix(v_coord, uv, step(abs(uv - vec2(0.5)), vec2(0.5))));\\n";break;case"color":a="\\n vec4 substitute_color = u_mediump[2];\\n vec4 source_color = mix(substitute_color, texture(u_textures[0], uv), isInside(uv));\\n";break;default:a="\\n vec4 source_color = texture(u_textures[0], fract(uv));\\n"}return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_textures[2];\\nuniform vec4 u_mediump[${t}];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\n${Rt.FUNCTION_IS_INSIDE()}\\n\\nvoid main() {\\n vec2 uv_to_st_scale = u_mediump[0].xy;\\n vec2 uv_to_st_offset = u_mediump[0].zw;\\n vec2 scale = u_mediump[1].xy;\\n\\n vec2 st = v_coord * uv_to_st_scale - uv_to_st_offset;\\n vec4 map_color = texture(u_textures[1], st);\\n\\n vec2 offset = vec2(${r}, ${n}) - 0.5;\\n vec2 uv = v_coord + offset * scale;\\n ${a}\\n\\n o_color = mix(texture(u_textures[0], v_coord), source_color, isInside(st));\\n}\\n\\n`}}class Gt{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getBlurFilterShader(t){const e=`b${t}`;if(this._$collection.has(e)){const t=this._$collection.get(e);if(t)return t}const i=new St(this._$gl,this._$context,Lt.TEXTURE(),Xt.TEMPLATE(t));return this._$collection.set(e,i),i}getBitmapFilterShader(t,e,i,s,n,a,h){const o=`f${t?"y":"n"}${e?"y":"n"}${i?"y":"n"}${s}${n?"y":"n"}${a?"y":"n"}`;if(this._$collection.has(o)){const t=this._$collection.get(o);if(t)return t}let _=1;t&&_++,h&&_++;let l=(t?4:0)+(e?4:0)+(a?1:0);h||(l+=i?4:8),l=r.ceil(l/4);const c=new St(this._$gl,this._$context,Lt.TEXTURE(),Dt.TEMPLATE(_,l,t,e,i,s,n,a,h));return this._$collection.set(o,c),c}getColorMatrixFilterShader(){if(this._$collection.has("m")){const t=this._$collection.get("m");if(t)return t}const t=new St(this._$gl,this._$context,Lt.TEXTURE(),Vt.TEMPLATE());return this._$collection.set("m",t),t}getConvolutionFilterShader(t,e,i,s){const n=`c${("0"+t).slice(-2)}${("0"+e).slice(-2)}${i?"y":"n"}${s?"y":"n"}`;if(this._$collection.has(n)){const t=this._$collection.get(n);if(t)return t}const a=(s?1:2)+r.ceil(t*e/4),h=new St(this._$gl,this._$context,Lt.TEXTURE(),Yt.TEMPLATE(a,t,e,i,s));return this._$collection.set(n,h),h}getDisplacementMapFilterShader(t,e,i){const s=`d${t}${e}${i}`;if(this._$collection.has(s)){const t=this._$collection.get(s);if(t)return t}const r="color"===i?3:2,n=new St(this._$gl,this._$context,Lt.TEXTURE(),zt.TEMPLATE(r,t,e,i));return this._$collection.set(s,n),n}setBlurFilterUniform(t,e,i,s,r,n){const a=t.mediump;s?(a[0]=1/e,a[1]=0):(a[0]=0,a[1]=1/i),a[2]=r,a[3]=n}setBitmapFilterUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f,m,p,x,b,v,T,A,M){let y;v?(y=t.textures,y[0]=0,y[1]=1,M&&(y[2]=2)):M&&(y=t.textures,y[0]=0,y[1]=2);const E=t.mediump;let C=0;v&&(E[C]=e/s,E[C+1]=i/r,E[C+2]=n/s,E[C+3]=(i-r-a)/r,C+=4),T&&(E[C]=e/h,E[C+1]=i/o,E[C+2]=_/h,E[C+3]=(i-o-l)/o,C+=4),M||(c?(E[C]=u,E[C+1]=d,E[C+2]=g,E[C+3]=f,C+=4):(E[C]=u,E[C+1]=d,E[C+2]=g,E[C+3]=f,E[C+4]=m,E[C+5]=p,E[C+6]=x,E[C+7]=b,C+=8)),A&&(E[C]=$)}setColorMatrixFilterUniform(t,e){const i=t.mediump;i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[5],i[5]=e[6],i[6]=e[7],i[7]=e[8],i[8]=e[10],i[9]=e[11],i[10]=e[12],i[11]=e[13],i[12]=e[15],i[13]=e[16],i[14]=e[17],i[15]=e[18],i[16]=e[4]/255,i[17]=e[9]/255,i[18]=e[14]/255,i[19]=e[19]/255}setConvolutionFilterUniform(t,e,i,s,r,n,a,h,o,_,l){const c=t.mediump;c[0]=1/e,c[1]=1/i,c[2]=1/r,c[3]=n/255;let $=4;a||(c[$]=h,c[$+1]=o,c[$+2]=_,c[$+3]=l,$+=4);const u=s.length;for(let t=0;t<u;t++)c[$++]=s[t]}setDisplacementMapFilterUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u){const d=t.textures;d[0]=0,d[1]=1;const g=t.mediump;g[0]=s/e,g[1]=r/i,g[2]=n/e,g[3]=(r-i-a)/i,g[4]=h/s,g[5]=-o/r,"color"===_&&(g[8]=l,g[9]=c,g[10]=$,g[11]=u)}}class Ht{static TEMPLATE(t){return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\n${t?"uniform vec4 u_mediump[2];":""}\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec4 src = texture(u_texture, v_coord);\\n ${t?Rt.STATEMENT_COLOR_TRANSFORM_ON(0):""}\\n o_color = src;\\n}\\n\\n`}static INSTANCE_TEMPLATE(){return"#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\n\\nin vec4 mul;\\nin vec4 add;\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec4 src = texture(u_texture, v_coord);\\n\\n if (mul.x != 1.0 || mul.y != 1.0 || mul.z != 1.0 || mul.w != 1.0\\n || add.x != 0.0 || add.y != 0.0 || add.z != 0.0 || add.w != 0.0\\n ) {\\n src.rgb /= max(0.0001, src.a);\\n src = clamp(src * mul + add, 0.0, 1.0);\\n src.rgb *= src.a;\\n }\\n \\n o_color = src;\\n}\\n\\n"}}class Wt{static TEMPLATE(t,e){let i;switch(t){case"subtract":i=this.FUNCTION_SUBTRACT();break;case"multiply":i=this.FUNCTION_MULTIPLY();break;case"lighten":i=this.FUNCTION_LIGHTEN();break;case"darken":i=this.FUNCTION_DARKEN();break;case"overlay":i=this.FUNCTION_OVERLAY();break;case"hardlight":i=this.FUNCTION_HARDLIGHT();break;case"difference":i=this.FUNCTION_DIFFERENCE();break;case"invert":i=this.FUNCTION_INVERT();break;default:i=this.FUNCTION_NORMAL()}return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_textures[2];\\n${e?"uniform vec4 u_mediump[2];":""}\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\n${i}\\n\\nvoid main() {\\n vec4 dst = texture(u_textures[0], v_coord);\\n vec4 src = texture(u_textures[1], v_coord);\\n ${e?Rt.STATEMENT_COLOR_TRANSFORM_ON(0):""}\\n o_color = blend(src, dst);\\n}\\n\\n`}static INSTANCE_TEMPLATE(t,e){let i;switch(t){case"subtract":i=this.FUNCTION_SUBTRACT();break;case"multiply":i=this.FUNCTION_MULTIPLY();break;case"lighten":i=this.FUNCTION_LIGHTEN();break;case"darken":i=this.FUNCTION_DARKEN();break;case"overlay":i=this.FUNCTION_OVERLAY();break;case"hardlight":i=this.FUNCTION_HARDLIGHT();break;case"difference":i=this.FUNCTION_DIFFERENCE();break;case"invert":i=this.FUNCTION_INVERT();break;default:i=this.FUNCTION_NORMAL()}return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_textures[2];\\n${e?"uniform vec4 u_mediump[2];":""}\\n\\nin vec2 v_src_coord;\\nin vec2 v_dst_coord;\\nout vec4 o_color;\\n\\n${i}\\n\\nvoid main() {\\n vec4 dst = texture(u_textures[0], v_dst_coord);\\n vec4 src = texture(u_textures[1], v_src_coord);\\n ${e?Rt.STATEMENT_COLOR_TRANSFORM_ON(0):""}\\n o_color = blend(src, dst);\\n}\\n\\n`}static FUNCTION_NORMAL(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n return src + dst - dst * src.a;\\n}\\n\\n"}static FUNCTION_SUBTRACT(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 c = vec4(dst.rgb - src.rgb, src.a * dst.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_MULTIPLY(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n vec4 c = src * dst;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_LIGHTEN(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 c = vec4(mix(src.rgb, dst.rgb, step(src.rgb, dst.rgb)), src.a * dst.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_DARKEN(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 c = vec4(mix(src.rgb, dst.rgb, step(dst.rgb, src.rgb)), src.a * dst.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_OVERLAY(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 mul = src * dst;\\n vec3 c1 = 2.0 * mul.rgb;\\n vec3 c2 = 2.0 * (src.rgb + dst.rgb - mul.rgb) - 1.0;\\n vec4 c = vec4(mix(c1, c2, step(vec3(0.5), dst.rgb)), mul.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_HARDLIGHT(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 mul = src * dst;\\n vec3 c1 = 2.0 * mul.rgb;\\n vec3 c2 = 2.0 * (src.rgb + dst.rgb - mul.rgb) - 1.0;\\n vec4 c = vec4(mix(c1, c2, step(vec3(0.5), src.rgb)), mul.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_DIFFERENCE(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 c = vec4(abs(src.rgb - dst.rgb), src.a * dst.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_INVERT(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 b = dst - dst * src.a;\\n vec4 c = vec4(src.a - dst.rgb * src.a, src.a);\\n\\n return b + c;\\n}\\n\\n"}}class qt{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getInstanceShader(){if(this._$collection.has("i")){const t=this._$collection.get("i");if(t)return t}const t=new St(this._$gl,this._$context,Lt.INSTANCE(),Ht.INSTANCE_TEMPLATE());return this._$collection.set("i",t),t}getNormalBlendShader(t){const e="n"+(t?"y":"n");if(this._$collection.has(e)){const t=this._$collection.get(e);if(t)return t}const i=new St(this._$gl,this._$context,Lt.BLEND(),Ht.TEMPLATE(t));return this._$collection.set(e,i),i}getClipShader(){if(this._$collection.has("c")){const t=this._$collection.get("c");if(t)return t}const t=new St(this._$gl,this._$context,Lt.BLEND_CLIP(),Ht.TEMPLATE(!1));return this._$collection.set("c",t),t}getBlendShader(t,e){const i=`${t}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=new St(this._$gl,this._$context,Lt.BLEND(),Wt.TEMPLATE(t,e));return this._$collection.set(i,s),s}getInstanceBlendShader(t,e){const i=`i${t}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=new St(this._$gl,this._$context,Lt.INSTANCE_BLEND(),Wt.INSTANCE_TEMPLATE(t,e));return this._$collection.set(i,s),s}setNormalBlendUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f){const m=t.highp;if(m[0]=e,m[1]=i,m[2]=s,m[3]=r,m[4]=n[0],m[5]=n[1],m[6]=n[2],m[8]=n[3],m[9]=n[4],m[10]=n[5],m[12]=n[6],m[13]=n[7],m[14]=n[8],m[7]=a,m[11]=h,o){const e=t.mediump;e[0]=_,e[1]=l,e[2]=c,e[3]=$,e[4]=u,e[5]=d,e[6]=g,e[7]=f}}pushNormalBlend(t,e,i,s,r,n,a,h,o=1,_=1,l=1,c=1,$=0,u=0,d=0,g=0){t.attributes.push(e/pt,i/pt,s/pt,r/pt,s,r,a,h,n[6],n[7],n[0],n[1],n[3],n[4],o,_,l,c,$,u,d,g),t.count++}setClipUniform(t,e,i,s,r,n,a,h){const o=t.highp;o[0]=e,o[1]=i,o[2]=s,o[3]=r,o[4]=n[0],o[5]=n[1],o[6]=n[2],o[8]=n[3],o[9]=n[4],o[10]=n[5],o[12]=n[6],o[13]=n[7],o[14]=n[8],o[7]=a,o[11]=h}setInstanceBlendUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f,m,p){const x=t.textures;x[0]=0,x[1]=1;const b=t.highp;if(b[0]=e,b[1]=i,b[2]=s,b[3]=r,b[4]=h[0],b[5]=h[1],b[6]=h[2],b[8]=h[3],b[9]=h[4],b[10]=h[5],b[12]=h[6],b[13]=h[7],b[14]=h[8],b[7]=o,b[11]=_,b[16]=n,b[17]=a,l){const e=t.mediump;e[0]=c,e[1]=$,e[2]=u,e[3]=d,e[4]=g,e[5]=f,e[6]=m,e[7]=p}}setBlendUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f){const m=t.textures;m[0]=0,m[1]=1;const p=t.highp;if(p[0]=e,p[1]=i,p[2]=s,p[3]=r,p[4]=n[0],p[5]=n[1],p[6]=n[2],p[8]=n[3],p[9]=n[4],p[10]=n[5],p[12]=n[6],p[13]=n[7],p[14]=n[8],p[7]=a,p[11]=h,o){const e=t.mediump;e[0]=_,e[1]=l,e[2]=c,e[3]=$,e[4]=u,e[5]=d,e[6]=g,e[7]=f}}}class jt{constructor(t,e){this._$currentProgramId=-1,this._$shapeShaderVariants=new Pt(t,e),this._$gradientShapeShaderVariants=new kt(t,e),this._$gradientLUTShaderVariants=new Ut(t,e),this._$filterShaderVariants=new Gt(t,e),this._$blendShaderVariants=new qt(t,e)}get currentProgramId(){return this._$currentProgramId}set currentProgramId(t){this._$currentProgramId=t}get shapeShaderVariants(){return this._$shapeShaderVariants}get gradientShapeShaderVariants(){return this._$gradientShapeShaderVariants}get gradientLUTShaderVariants(){return this._$gradientLUTShaderVariants}get filterShaderVariants(){return this._$filterShaderVariants}get blendShaderVariants(){return this._$blendShaderVariants}}class Kt{constructor(t,e){this._$context=t,this._$gl=e,this._$attachment=t.frameBuffer.createTextureAttachment(512,1),this._$maxLength=r.floor(.75*e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),this._$rgbToLinearTable=new Float32Array(256),this._$rgbIdentityTable=new Float32Array(256);for(let t=0;t<256;t++){const e=t/255;this._$rgbToLinearTable[t]=r.pow(e,2.23333333),this._$rgbIdentityTable[t]=e}}generateForShape(t,e){const i=this._$context.frameBuffer.currentAttachment,s=this._$context.cachePosition;s&&this._$gl.disable(this._$gl.SCISSOR_TEST),this._$context._$bind(this._$attachment);const n=t.length,a=this._$context.shaderList.gradientLUTShaderVariants,h=e?this._$rgbToLinearTable:this._$rgbIdentityTable;this._$context.blend.toOneZero();for(let i=0;i<n;i+=this._$maxLength-1){const s=r.min(i+this._$maxLength,n),o=a.getGradientLUTShader(s-i,e),_=o.uniform;a.setGradientLUTUniformForShape(_,t,i,s,h),o._$drawGradient(0===i?0:t[i][0],s===n?1:t[s-1][0])}if(this._$context._$bind(i),!this._$attachment.texture)throw new Error("the texture is null.");return s&&this._$context.bindRenderBuffer(s),this._$attachment.texture}generateForFilter(t,e,i){const s=this._$context.frameBuffer.currentAttachment;this._$context._$bind(this._$attachment);const n=t.length,a=this._$context.shaderList.gradientLUTShaderVariants;this._$context.blend.toOneZero();for(let s=0;s<n;s+=this._$maxLength-1){const h=r.min(s+this._$maxLength,n),o=a.getGradientLUTShader(h-s,!1),_=o.uniform;a.setGradientLUTUniformForFilter(_,t,e,i,s,h),o._$drawGradient(0===s?0:t[s],h===n?1:t[h-1])}if(this._$context._$bind(s),!this._$attachment.texture)throw new Error("the texture is null.");return this._$attachment.texture}}class Qt{static get indexRangePool(){return this._$indexRangePool}static generate(t){let e=0;for(let i=0;i<t.length;++i)e+=12*(t[i].length/3-2);this._$vertexBufferData=new o(e),this._$indexRanges=L(),this._$currentIndex=0;for(let e=0;e<t.length;++e){const i=this._$currentIndex;this._$generateMesh(t[e]);const s=this._$currentIndex-i,r=this._$indexRangePool.pop()||{first:0,count:0};r.first=i,r.count=s,this._$indexRanges.push(r)}return{vertexBufferData:this._$vertexBufferData,indexRanges:this._$indexRanges}}static _$generateMesh(t){const e=this._$vertexBufferData;let i=this._$currentIndex;const s=t.length-5;for(let r=3;r<s;r+=3){let s=4*i;t[r+2]?(e[s++]=t[r-3],e[s++]=t[r-2],e[s++]=0,e[s++]=0,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=0,e[s++]=t[r+3],e[s++]=t[r+4],e[s++]=1,e[s++]=1):t[r+5]?(e[s++]=t[0],e[s++]=t[1],e[s++]=.5,e[s++]=.5,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=.5,e[s++]=t[r+6],e[s++]=t[r+7],e[s++]=.5,e[s++]=.5):(e[s++]=t[0],e[s++]=t[1],e[s++]=.5,e[s++]=.5,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=.5,e[s++]=t[r+3],e[s++]=t[r+4],e[s++]=.5,e[s++]=.5),i+=3}this._$currentIndex=i}}Qt._$indexRangePool=L();class Jt{static generate(t,e,i){this._$vertexBufferData=this._$vertexBufferData||new o(1024),this._$vertexBufferPos=0,this._$indexBufferData=this._$indexBufferData||new Int16Array(256),this._$indexBufferPos=0,this._$lineCap=e,this._$lineJoin=i;for(let e=0;e<t.length;e++){const i=this._$vertexBufferPos;this._$generateLineSegment(t[e]);const s=this._$vertexBufferPos;this._$generateLineJoin(i,s),this._$generateLineCap(i,s)}return{vertexBufferData:this._$vertexBufferData.slice(0,this._$vertexBufferPos),indexBufferData:this._$indexBufferData.slice(0,this._$indexBufferPos)}}static _$expandVertexBufferIfNeeded(t){if(this._$vertexBufferPos+t>this._$vertexBufferData.length){const t=new o(2*this._$vertexBufferData.length);t.set(this._$vertexBufferData),this._$vertexBufferData=t}}static _$expandIndexBufferIfNeeded(t){if(this._$indexBufferPos+t>this._$indexBufferData.length){const t=new l(2*this._$indexBufferData.length);t.set(this._$indexBufferData),this._$indexBufferData=t}}static _$generateLineSegment(t){const e=t.length-5;for(let i=0;i<e;i+=3)t[i+2]||(t[i+5]?this._$addQuadSegmentMesh(t[i],t[i+1],t[i+3],t[i+4],t[i+6],t[i+7]):this._$addLineSegmentMesh(t[i],t[i+1],t[i+3],t[i+4]))}static _$addQuadSegmentMesh(t,e,i,s,r,n){let a=t,h=e;for(let o=1;o<11;o++){const _=o/11,l=1-_,c=(t*l+i*_)*l+(i*l+r*_)*_,$=(e*l+s*_)*l+(s*l+n*_)*_;this._$addLineSegmentMesh(a,h,c,$,2),a=c,h=$}this._$addLineSegmentMesh(a,h,r,n)}static _$addLineSegmentMesh(t,e,i,s,r=1){const n=this._$vertexBufferPos/7,a=n+1,h=n+2,o=n+3;this._$expandIndexBufferIfNeeded(6);const _=this._$indexBufferData;let l=this._$indexBufferPos;_[l++]=n,_[l++]=a,_[l++]=o,_[l++]=o,_[l++]=h,_[l++]=n,this._$indexBufferPos=l,this._$expandVertexBufferIfNeeded(28);const c=this._$vertexBufferData;let $=this._$vertexBufferPos;c[$++]=t,c[$++]=e,c[$++]=i,c[$++]=s,c[$++]=1,c[$++]=1,c[$++]=1,c[$++]=t,c[$++]=e,c[$++]=i,c[$++]=s,c[$++]=-1,c[$++]=-1,c[$++]=1,c[$++]=i,c[$++]=s,c[$++]=t,c[$++]=e,c[$++]=-1,c[$++]=-1,c[$++]=r,c[$++]=i,c[$++]=s,c[$++]=t,c[$++]=e,c[$++]=1,c[$++]=1,c[$++]=r,this._$vertexBufferPos=$}static _$generateLineJoin(t,e){const i=this._$vertexBufferData,s=e-55;for(let e=t;e<s;e+=28){const t=e/7;this._$addLineJoinMesh(i[e],i[e+1],i[e+21],i[e+22],i[e+27],i[e+49],i[e+50],t+2,t+3,t+4,t+5)}}static _$addLineJoinMesh(t,e,i,s,n,a,h,o,_,l=0,c=0){const $=i-t,u=s-e,d=a-i,g=h-s,f=this._$cross($,u,d,g);if(!(r.abs(f)<1e-4))if(2!==n)switch(this._$lineJoin){case"round":this._$addRoundJoinMesh(i,s);break;case"miter":this._$addMiterJoinMesh(i,s,t,e,a,h,l,o,_,c);break;default:this._$addBevelJoinMesh(i,s,l,o,_,c)}else this._$addBevelJoinMesh(i,s,l,o,_,c)}static _$addRoundJoinMesh(t,e){const i=this._$vertexBufferPos/7;this._$expandIndexBufferIfNeeded(57);const s=this._$indexBufferData;let r=this._$indexBufferPos;for(let t=1;t<18;t++){const e=i+t;s[r++]=i,s[r++]=e,s[r++]=e+1}s[r++]=i,s[r++]=i+18,s[r++]=i+1,this._$indexBufferPos=r,this._$expandVertexBufferIfNeeded(133);const n=this._$vertexBufferData;let a=this._$vertexBufferPos;n[a++]=t,n[a++]=e,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0;for(let i=0;i<18;i++)n[a++]=t,n[a++]=e,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=30+i;this._$vertexBufferPos=a}static _$addMiterJoinMesh(t,e,i,s,r,n,a,h,o,_){const l=this._$vertexBufferPos/7,c=l+1,$=l+2,u=l+3,d=l+4;this._$expandIndexBufferIfNeeded(18);const g=this._$indexBufferData;let f=this._$indexBufferPos;g[f++]=l,g[f++]=a,g[f++]=c,g[f++]=l,g[f++]=c,g[f++]=$,g[f++]=l,g[f++]=$,g[f++]=h,g[f++]=l,g[f++]=o,g[f++]=u,g[f++]=l,g[f++]=u,g[f++]=d,g[f++]=l,g[f++]=d,g[f++]=_,this._$indexBufferPos=f,this._$expandVertexBufferIfNeeded(35);const m=this._$vertexBufferData;let p=this._$vertexBufferPos;m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=0,m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=21,m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=22,m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=23,m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=24,this._$vertexBufferPos=p}static _$addBevelJoinMesh(t,e,i,s,r,n){const a=this._$vertexBufferPos/7;this._$expandIndexBufferIfNeeded(6);const h=this._$indexBufferData;let o=this._$indexBufferPos;h[o++]=a,h[o++]=i,h[o++]=s,h[o++]=a,h[o++]=r,h[o++]=n,this._$indexBufferPos=o,this._$expandVertexBufferIfNeeded(7);const _=this._$vertexBufferData;let l=this._$vertexBufferPos;_[l++]=t,_[l++]=e,_[l++]=0,_[l++]=0,_[l++]=0,_[l++]=0,_[l++]=0,this._$vertexBufferPos=l}static _$generateLineCap(t,e){const i=this._$vertexBufferData,s=i[t],r=i[t+1],n=i[t+2],a=i[t+3],h=i[e-7],o=i[e-6],_=i[e-5],l=i[e-4],c=t/7,$=e/7;s!==h||r!==o?(this._$addLineCapMesh(s,r,n,a,c,c+1),this._$addLineCapMesh(h,o,_,l,$-1,$-2)):this._$addLineJoinMesh(_,l,s,r,n,a,$-2,$-1,c,c+1)}static _$addLineCapMesh(t,e,i,s,r,n){switch(this._$lineCap){case"round":this._$addRoundJoinMesh(t,e);break;case"square":this._$addSquareCapMesh(t,e,i,s,r,n)}}static _$addSquareCapMesh(t,e,i,s,r,n){const a=this._$vertexBufferPos/7,h=a+1;this._$expandIndexBufferIfNeeded(6);const o=this._$indexBufferData;let _=this._$indexBufferPos;o[_++]=r,o[_++]=a,o[_++]=h,o[_++]=h,o[_++]=n,o[_++]=r,this._$indexBufferPos=_,this._$expandVertexBufferIfNeeded(14);const l=this._$vertexBufferData;let c=this._$vertexBufferPos;l[c++]=t,l[c++]=e,l[c++]=i,l[c++]=s,l[c++]=-1,l[c++]=-1,l[c++]=10,l[c++]=t,l[c++]=e,l[c++]=i,l[c++]=s,l[c++]=1,l[c++]=1,l[c++]=10,this._$vertexBufferPos=c}}Jt._$cross=(t,e,i,s)=>t*s-i*e;class Zt{constructor(t){this._$gl=t,this._$fillVertexArrayPool=[],this._$strokeVertexArrayPool=[],this._$boundVertexArray=null,this._$fillAttrib_vertex=0,this._$fillAttrib_bezier=1,this._$strokeAttrib_vertex=0,this._$strokeAttrib_option1=1,this._$strokeAttrib_option2=2,this._$strokeAttrib_type=3,this._$vertexBufferData=new Float32Array([0,0,0,1,1,0,1,1]),this._$attributeVertexBuffer=t.createBuffer(),this._$attributeBuffer=new Float32Array(22),this._$instanceVertexArray=this._$getCommonVertexArray(),this._$commonVertexArray=this._$getVertexArray(0,1)}_$getCommonVertexArray(){const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();return this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,1]),this._$gl.STATIC_DRAW),this._$gl.enableVertexAttribArray(0),this._$gl.vertexAttribPointer(0,2,this._$gl.FLOAT,!1,0,0),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,this._$attributeVertexBuffer),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$attributeBuffer.byteLength,this._$gl.DYNAMIC_DRAW),this._$gl.enableVertexAttribArray(1),this._$gl.vertexAttribPointer(1,4,this._$gl.FLOAT,!1,88,0),this._$gl.vertexAttribDivisor(1,1),this._$gl.enableVertexAttribArray(2),this._$gl.vertexAttribPointer(2,4,this._$gl.FLOAT,!1,88,16),this._$gl.vertexAttribDivisor(2,1),this._$gl.enableVertexAttribArray(3),this._$gl.vertexAttribPointer(3,2,this._$gl.FLOAT,!1,88,32),this._$gl.vertexAttribDivisor(3,1),this._$gl.enableVertexAttribArray(4),this._$gl.vertexAttribPointer(4,4,this._$gl.FLOAT,!1,88,40),this._$gl.vertexAttribDivisor(4,1),this._$gl.enableVertexAttribArray(5),this._$gl.vertexAttribPointer(5,4,this._$gl.FLOAT,!1,88,56),this._$gl.vertexAttribDivisor(5,1),this._$gl.enableVertexAttribArray(6),this._$gl.vertexAttribPointer(6,4,this._$gl.FLOAT,!1,88,72),this._$gl.vertexAttribDivisor(6,1),t}_$getVertexArray(t,e){const i=this._$gl.createVertexArray();this.bind(i);const s=this._$gl.createBuffer();return this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,s),this._$vertexBufferData[0]=t,this._$vertexBufferData[2]=t,this._$vertexBufferData[4]=e,this._$vertexBufferData[6]=e,this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$vertexBufferData,this._$gl.STATIC_DRAW),this._$gl.enableVertexAttribArray(0),this._$gl.vertexAttribPointer(0,2,this._$gl.FLOAT,!1,0,0),i}_$getFillVertexArray(){if(this._$fillVertexArrayPool.length){const t=this._$fillVertexArrayPool.pop();if(t)return t}const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();return t.vertexBuffer=e,t.vertexLength=0,this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e),this._$gl.enableVertexAttribArray(0),this._$gl.enableVertexAttribArray(1),this._$gl.vertexAttribPointer(this._$fillAttrib_vertex,2,this._$gl.FLOAT,!1,16,0),this._$gl.vertexAttribPointer(this._$fillAttrib_bezier,2,this._$gl.FLOAT,!1,16,8),t}_$getStrokeVertexArray(){if(this._$strokeVertexArrayPool.length){const t=this._$strokeVertexArrayPool.pop();if(t)return t}const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();t.vertexBuffer=e,t.vertexLength=0,this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e);const i=this._$gl.createBuffer();return t.indexBuffer=i,t.indexLength=0,this._$gl.bindBuffer(this._$gl.ELEMENT_ARRAY_BUFFER,i),this._$gl.enableVertexAttribArray(0),this._$gl.enableVertexAttribArray(1),this._$gl.enableVertexAttribArray(2),this._$gl.enableVertexAttribArray(3),this._$gl.vertexAttribPointer(this._$strokeAttrib_vertex,2,this._$gl.FLOAT,!1,28,0),this._$gl.vertexAttribPointer(this._$strokeAttrib_option1,2,this._$gl.FLOAT,!1,28,8),this._$gl.vertexAttribPointer(this._$strokeAttrib_option2,2,this._$gl.FLOAT,!1,28,16),this._$gl.vertexAttribPointer(this._$strokeAttrib_type,1,this._$gl.FLOAT,!1,28,24),t}createFill(t){const e=Qt.generate(t),i=e.vertexBufferData,s=this._$getFillVertexArray();return s.indexRanges=e.indexRanges,this.bind(s),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,s.vertexBuffer),s.vertexLength<i.length&&(s.vertexLength=X(i.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,4*s.vertexLength,this._$gl.DYNAMIC_DRAW)),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,i),s}createStroke(t,e,i){const s=Jt.generate(t,e,i),r=s.vertexBufferData,n=s.indexBufferData,a=this._$getStrokeVertexArray();return a.indexCount=n.length,this.bind(a),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,a.vertexBuffer),this._$gl.bindBuffer(this._$gl.ELEMENT_ARRAY_BUFFER,a.indexBuffer),a.vertexLength<r.length&&(a.vertexLength=X(r.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,4*a.vertexLength,this._$gl.DYNAMIC_DRAW)),a.indexLength<n.length&&(a.indexLength=X(n.length),this._$gl.bufferData(this._$gl.ELEMENT_ARRAY_BUFFER,2*a.indexLength,this._$gl.DYNAMIC_DRAW)),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,r),this._$gl.bufferSubData(this._$gl.ELEMENT_ARRAY_BUFFER,0,n),a}releaseFill(t){this._$fillVertexArrayPool.push(t)}releaseStroke(t){this._$strokeVertexArrayPool.push(t)}bind(t=null){t!==this._$boundVertexArray&&(this._$boundVertexArray=t,this._$gl.bindVertexArray(t))}bindInstnceArray(t){this.bind(this._$instanceVertexArray),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,this._$attributeVertexBuffer),t.attributes.length>this._$attributeBuffer.length&&(this._$attributeBuffer=new Float32Array(t.attributes.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$attributeBuffer.byteLength,this._$gl.DYNAMIC_DRAW)),this._$attributeBuffer.set(t.attributes),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,this._$attributeBuffer.subarray(0,t.attributes.length))}bindCommonVertexArray(){this.bind(this._$commonVertexArray)}bindGradientVertexArray(t,e){const i=this._$getVertexArray(t,e);this.bind(i)}}class te{constructor(t,e){this._$context=t,this._$gl=e,this._$clips=[],this._$poolClip=[],this._$clipStatus=!1,this._$containerClip=!1,this._$currentClip=!1}get containerClip(){return this._$containerClip}set containerClip(t){this._$containerClip=t}_$onClear(t){t&&(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0)}_$onBind(t){!t&&this._$currentClip?(this._$gl.disable(this._$gl.STENCIL_TEST),this._$currentClip=!1):t&&!this._$currentClip&&(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0,this._$endClipDef())}_$onClearRect(){this._$gl.disable(this._$gl.STENCIL_TEST),this._$currentClip=!1}_$enterClip(){this._$currentClip||(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0);const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");t.mask=!0,++t.clipLevel}_$beginClipDef(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.stencilMask(1<<t.clipLevel-1),this._$gl.colorMask(!1,!1,!1,!1)}_$endClipDef(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");const e=t.clipLevel;let i=0;for(let t=0;t<e;++t)i|=(1<<e-t)-1;this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.EQUAL,255&i,i),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.KEEP,this._$gl.KEEP),this._$gl.stencilMask(255),this._$gl.colorMask(!0,!0,!0,!0)}_$leaveClip(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");if(--t.clipLevel,t.mask=!!t.clipLevel,!t.clipLevel)return void this._$context._$clearRectStencil();const e=t.width,i=t.height,s=this._$context.path.createRectVertices(0,0,e,i),r=this._$context.vao.createFill(s);O(s.pop()),O(s);const n=this._$context.shaderList.shapeShaderVariants,a=n.getMaskShapeShader(!1,!1),h=a.uniform;n.setMaskShapeUniformIdentity(h,e,i);const o=r.indexRanges[0];this._$currentClip||(this._$currentClip=!0,this._$gl.enable(this._$gl.STENCIL_TEST)),this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.REPLACE,this._$gl.REPLACE,this._$gl.REPLACE),this._$gl.stencilMask(1<<t.clipLevel),this._$gl.colorMask(!1,!1,!1,!1),a._$containerClip(r,o.first,o.count);const _=r.indexRanges;for(let t=0;t<_.length;++t)Qt.indexRangePool.push(_[t]);O(r.indexRanges),this._$context.vao.releaseFill(r),this._$endClipDef()}_$drawContainerClip(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");const e=t.clipLevel,i=this._$context.shaderList.shapeShaderVariants,s=i.getMaskShapeShader(!1,!1),r=s.uniform;let n=e;const a=t.width,h=t.height;this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.colorMask(!1,!1,!1,!1);const o=this._$poolClip.length;for(let t=0;t<o;++t){const t=this._$poolClip.shift();if(!t)continue;i.setMaskShapeUniform(r,!1,t.matrixA,t.matrixB,t.matrixC,t.matrixD,t.matrixE,t.matrixF,t.matrixG,t.matrixH,t.matrixI,t.viewportWidth,t.viewportHeight,null);const o=t.vertexArrayObject.indexRanges;for(let e=0;e<o.length;++e){const i=o[e];this._$gl.stencilMask(1<<n-1),s._$containerClip(t.vertexArrayObject,i.first,i.count),Qt.indexRangePool.push(i)}O(o),this._$context.vao.releaseFill(t.vertexArrayObject),++n,n>7&&(this._$unionStencilMask(e,a,h),n=e)}n>e+1&&this._$unionStencilMask(e,a,h)}_$unionStencilMask(t,e,i){const s=this._$context.path.createRectVertices(0,0,e,i),r=this._$context.vao.createFill(s);O(s.pop()),O(s);const n=this._$context.shaderList.shapeShaderVariants,a=n.getMaskShapeShader(!1,!1),h=a.uniform;n.setMaskShapeUniformIdentity(h,e,i);const o=r.indexRanges[0];this._$gl.stencilFunc(this._$gl.LEQUAL,1<<t-1,255),this._$gl.stencilOp(this._$gl.ZERO,this._$gl.REPLACE,this._$gl.REPLACE),this._$gl.stencilMask(~((1<<t-1)-1)),a._$containerClip(r,o.first,o.count),this._$poolClip.length&&(this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT));const _=r.indexRanges;for(let t=0;t<_.length;++t)Qt.indexRangePool.push(_[t]);O(r.indexRanges),this._$context.vao.releaseFill(r)}_$onClip(t,e,i,s){return this._$clipStatus=!0,!!this._$containerClip&&(this._$poolClip.push({vertexArrayObject:t,matrixA:e[0],matrixB:e[1],matrixC:e[2],matrixD:e[3],matrixE:e[4],matrixF:e[5],matrixG:e[6],matrixH:e[7],matrixI:e[8],viewportWidth:i,viewportHeight:s}),!0)}_$onSave(){this._$clips.push(this._$clipStatus)}_$onRestore(){this._$clips.length&&(this._$clipStatus=!!this._$clips.pop())}}class ee{constructor(t,e){this._$context=t,this._$gl=e,this._$enabled=!1,this._$funcCode=600,this._$currentOperation="normal",this._$currentIndex=-1,this._$currentSmoothing=null,this._$variants=t.shaderList.blendShaderVariants,this._$instanceShader=this._$variants.getInstanceShader(),this.enable()}enable(){this._$enabled||(this._$enabled=!0,this._$gl.enable(this._$gl.BLEND)),this.reset()}disable(){this._$enabled&&(this._$enabled=!1,this._$gl.disable(this._$gl.BLEND))}reset(){613!==this._$funcCode&&(this._$funcCode=613,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ONE_MINUS_SRC_ALPHA))}toOneZero(){610!==this._$funcCode&&(this._$funcCode=610,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ZERO))}toZeroOne(){601!==this._$funcCode&&(this._$funcCode=601,this._$gl.blendFuncSeparate(this._$gl.ZERO,this._$gl.ONE,this._$gl.ONE,this._$gl.ZERO))}toAdd(){611!==this._$funcCode&&(this._$funcCode=611,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ONE))}toScreen(){641!==this._$funcCode&&(this._$funcCode=641,this._$gl.blendFunc(this._$gl.ONE_MINUS_DST_COLOR,this._$gl.ONE))}toAlpha(){606!==this._$funcCode&&(this._$funcCode=606,this._$gl.blendFunc(this._$gl.ZERO,this._$gl.SRC_ALPHA))}toErase(){603!==this._$funcCode&&(this._$funcCode=603,this._$gl.blendFunc(this._$gl.ZERO,this._$gl.ONE_MINUS_SRC_ALPHA))}toSourceAtop(){673!==this._$funcCode&&(this._$funcCode=673,this._$gl.blendFunc(this._$gl.DST_ALPHA,this._$gl.ONE_MINUS_SRC_ALPHA))}toSourceIn(){670!==this._$funcCode&&(this._$funcCode=670,this._$gl.blendFunc(this._$gl.DST_ALPHA,this._$gl.ZERO))}toOperation(t){switch(t){case"add":this.toAdd();break;case"screen":this.toScreen();break;case"alpha":this.toAlpha();break;case"erase":this.toErase();break;case"copy":this.toOneZero();break;default:this.reset()}}clearInstacedArray(){const t=this._$instanceShader.instance;t.count&&t.clear()}drawInstacedArray(){const t=this._$instanceShader.instance;if(!t.count)return;const e=this._$context.frameBuffer,i=e.textureManager.getAtlasTexture(this._$currentIndex);e.textureManager.bind0(i,this._$currentSmoothing),this.toOperation(this._$currentOperation),this._$instanceShader.drawArraysInstanced(t),t.clear()}drawInstance(t,e,i,s,r,n,a,h,o,_,l,c,$,u){this._$currentOperation||(this._$currentOperation=_),-1===this._$currentIndex&&(this._$currentIndex=t.index),null===this._$currentSmoothing&&(this._$currentSmoothing=u),this._$currentOperation===_&&this._$currentIndex===t.index&&this._$currentSmoothing===u||(this.drawInstacedArray(),this._$currentOperation=_,this._$currentIndex=t.index,this._$currentSmoothing=u),this._$variants.pushNormalBlend(this._$instanceShader.instance,t.x,t.y,t.w,t.h,$,l,c,e,i,s,r,n,a,h,o)}drawInstanceBlend(t,e,i,s,n,a,h,o,_,l,c,$,u,d,g,f,m,p,x){this.drawInstacedArray();const b=this._$context.frameBuffer,v=b.currentAttachment,T=1!==a||1!==h||1!==o||1!==_||0!==l||0!==c||0!==$||0!==u,A=b.getTextureFromCurrentAttachment(),M=this._$context.frameBuffer.createTextureAttachment(d.w,d.h);this._$context._$bind(M),b.textureManager.bind0(A);const y=this._$variants.getClipShader(),E=y.uniform;this._$variants.setClipUniform(E,0,0,d.w,d.h,V(p),f,m),this.reset(),y._$drawImage();const C=b.getTextureFromCurrentAttachment();this._$context._$bind(v),b.textureManager.bind01(C,t,x);const S=this._$variants.getInstanceBlendShader(g,T);this._$variants.setInstanceBlendUniform(S.uniform,d.x/t.width,d.y/t.height,d.w/t.width,d.h/t.height,d.w,d.h,p,f,m,T,a,h,o,_,l,c,$,u);const F=r.abs(s-e),B=r.abs(n-i);this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(e,m-(i+B),F,B),this.toOneZero(),S._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST),b.releaseAttachment(M,!0)}drawImage(t,e,i,s,n,a,o,_,l,c,$,u,d,g,f,m,p,x){const b=this._$context.frameBuffer,v=b.currentAttachment,T=1!==a||1!==o||1!==_||1!==l||0!==c||0!==$||0!==u||0!==d;switch(g){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":{b.textureManager.bind0(t,x);const v=this._$variants.getNormalBlendShader(T);this._$variants.setNormalBlendUniform(v.uniform,e,i,s,n,p,f,m,T,a,o,_,l,c,$,u,d);const A=p[0],M=p[1],y=p[3],E=p[4],C=p[6],S=p[7];if(1!==A||0!==M||0!==y||1!==E){const t=e+s,a=i+n,o=+(t*A+a*y+C),_=+(t*A+i*y+C),l=+(e*A+a*y+C),c=+(e*A+i*y+C),$=+(t*M+a*E+S),u=+(t*M+i*E+S),d=+(e*M+a*E+S),g=+(e*M+i*E+S),p=h.MAX_VALUE,x=+r.min(r.min(r.min(r.min(p,o),_),l),c),b=+r.max(r.max(r.max(r.max(-p,o),_),l),c),v=+r.min(r.min(r.min(r.min(p,$),u),d),g),T=+r.max(r.max(r.max(r.max(-p,$),u),d),g),F=r.max(0,x),B=r.max(0,v),w=r.min(r.max(0,f-F),r.ceil(r.abs(b-x))),R=r.min(r.max(0,m-B),r.ceil(r.abs(T-v)));if(!w||!R)return;this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(F,r.max(0,m-(B+R)),w+1,R+1)}else{const t=r.max(0,e+C),a=r.max(0,i+S),h=r.min(r.max(0,f-t),s),o=r.min(r.max(0,m-a),n);if(!h||!o)return;this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t,r.max(0,m-(a+o)),h+1,o+1)}this.toOperation(g),v._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST)}break;default:{const h=r.max(0,e+p[6]),A=r.max(0,i+p[7]),M=r.min(r.max(0,f-h),s),y=r.min(r.max(0,m-A),n);if(!M||!y)return;const E=b.getTextureFromCurrentAttachment(),C=this._$context.frameBuffer.createTextureAttachment(s,n);this._$context._$bind(C),b.textureManager.bind0(E);const S=this._$variants.getClipShader(),F=S.uniform;this._$variants.setClipUniform(F,e,i,s,n,V(p),f,m),this.reset(),S._$drawImage();const B=b.getTextureFromCurrentAttachment();this._$context._$bind(v),b.textureManager.bind01(B,t,x);const w=this._$variants.getBlendShader(g,T);this._$variants.setBlendUniform(w.uniform,e,i,s,n,p,f,m,T,a,o,_,l,c,$,u,d),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(h,r.max(0,m-(A+y)),M,y),this.toOneZero(),w._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST),b.releaseAttachment(C,!0)}}}}class ie{constructor(t,e){var i;i=t.getParameter(t.MAX_TEXTURE_SIZE),pt=Math.min(4096,i/2),this._$gl=t;const s=r.min(e,t.getParameter(t.MAX_SAMPLES));this._$maxTextureSize=r.min(8192,t.getParameter(t.MAX_TEXTURE_SIZE))-2,this._$contextStyle=new mt,this._$cacheBounds=S(),this._$matrix=k(1,0,0,0,1,0,0,0,1),this._$cacheAttachment=null,this._$stack=[],this._$globalAlpha=1,this._$imageSmoothingEnabled=!1,this._$globalCompositeOperation="normal",this._$clearColorR=1,this._$clearColorG=1,this._$clearColorB=1,this._$clearColorA=1,this._$viewportWidth=0,this._$viewportHeight=0,this._$frameBufferManager=new Tt(t,s),this._$path=new Mt,this._$grid=new yt,this._$offsetX=0,this._$offsetY=0,this._$blends=L(),this._$positions=L(),this._$isLayer=!1,this._$shaderList=new jt(this,t),this._$gradientLUT=new Kt(this,t),this._$vao=new Zt(t),this._$mask=new te(this,t),this._$blend=new ee(this,t),this._$attachmentArray=[],this._$maskBounds=S(0,0,0,0),this._$cachePosition=null}get cachePosition(){return this._$cachePosition}set cachePosition(t){this._$cachePosition=t}reset(){this._$globalAlpha=1,this._$globalCompositeOperation="normal",this._$imageSmoothingEnabled=!1,this._$contextStyle.clear()}get isLayer(){return this._$isLayer}get canvas(){return this._$gl.canvas}get cacheAttachment(){return this._$cacheAttachment}set cacheAttachment(t){this._$cacheAttachment=t}get cacheBounds(){return this._$cacheBounds}get fillStyle(){return this._$contextStyle.fillStyle}set fillStyle(t){this._$contextStyle.fillStyle=t}get strokeStyle(){return this._$contextStyle.strokeStyle}set strokeStyle(t){this._$contextStyle.strokeStyle=t}get lineWidth(){return this._$contextStyle.lineWidth}set lineWidth(t){this._$contextStyle.lineWidth=t}get lineCap(){return this._$contextStyle.lineCap}set lineCap(t){this._$contextStyle.lineCap=t}get lineJoin(){return this._$contextStyle.lineJoin}set lineJoin(t){this._$contextStyle.lineJoin=t}get miterLimit(){return this._$contextStyle.miterLimit}set miterLimit(t){this._$contextStyle.miterLimit=t}get globalAlpha(){return this._$globalAlpha}set globalAlpha(t){this._$globalAlpha=Y(t,0,1,1)}get imageSmoothingEnabled(){return this._$imageSmoothingEnabled}set imageSmoothingEnabled(t){this._$imageSmoothingEnabled=t}get globalCompositeOperation(){return this._$globalCompositeOperation}set globalCompositeOperation(t){this._$globalCompositeOperation=t}get frameBuffer(){return this._$frameBufferManager}get shaderList(){return this._$shaderList}get path(){return this._$path}get grid(){return this._$grid}get vao(){return this._$vao}get blend(){return this._$blend}_$getCurrentPosition(){return this._$positions[this._$positions.length-1]}_$getTextureScale(t,e){const i=r.max(t,e);return i>this._$maxTextureSize?this._$maxTextureSize/i:1}drawInstacedArray(){this.blend.drawInstacedArray()}clearInstacedArray(){this.blend.clearInstacedArray()}bindRenderBuffer(t){this._$frameBufferManager.bindRenderBuffer(),this._$gl.clearColor(0,0,0,0),this._$gl.clear(this._$gl.COLOR_BUFFER_BIT|this._$gl.STENCIL_BUFFER_BIT),this._$viewportWidth=t.w,this._$viewportHeight=t.h,this._$gl.viewport(t.x,t.y,t.w,t.h),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t.x,t.y,t.w,t.h)}getTextureFromRect(t){const e=this._$frameBufferManager,i=e.textureManager.getAtlasTexture(t.index),s=e.currentAttachment,r=e.createTextureAttachment(t.w,t.h);this._$bind(r),this.save(),this.setTransform(1,0,0,1,0,0),this.reset(),this.drawImage(i,-t.x,-i.height+t.h+t.y,i.width,i.height),this.restore();const n=r.texture;return e.releaseAttachment(r),this._$bind(s),n}drawBitmap(t){const e=this._$shaderList.blendShaderVariants,i=e.getNormalBlendShader(!1);e.setNormalBlendUniform(i.uniform,0,0,t.width,t.height,this._$matrix,this._$viewportWidth,this._$viewportHeight,!1,1,1,1,1,0,0,0,0),this._$frameBufferManager.textureManager.bind0(t,this._$imageSmoothingEnabled),this.blend.toOperation("normal"),i._$drawImage()}drawTextureFromRect(t,e){const i=this._$frameBufferManager,s=i.currentAttachment;this.bindRenderBuffer(e),i.transferTexture(e);const r=i.textureManager.getAtlasTexture(e.index),n=i.createTextureAttachmentFrom(r);this._$bind(n),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(e.x,e.y,e.w,e.h),this._$gl.clearColor(0,0,0,0),this._$gl.disable(this._$gl.SCISSOR_TEST),this.save(),this.setTransform(1,0,0,1,0,0),this.reset(),this.drawImage(t,e.x,r.height-e.h-e.y,t.width,t.height),this.restore(),i.releaseAttachment(n),this._$bind(s),i.textureManager.release(t)}stopStencil(){this._$mask._$onClearRect()}_$bind(t=null){if(!t)return;this._$frameBufferManager.bind(t);const e=t.color,i=t.stencil,s=t.width,r=t.height;this._$viewportWidth===s&&this._$viewportHeight===r||(this._$viewportWidth=s,this._$viewportHeight=r,this._$gl.viewport(0,0,s,r)),(e&&e.dirty||i&&i.dirty)&&(e&&(e.dirty=!1),i&&(i.dirty=!1),this._$gl.clearColor(0,0,0,0),this.clearRect(0,0,this._$viewportWidth,this._$viewportHeight),this._$gl.clearColor(this._$clearColorR,this._$clearColorG,this._$clearColorB,this._$clearColorA),this._$mask._$onClear(t.mask)),this._$mask._$onBind(t.mask)}setTransform(t,e,i,s,r,n){this._$matrix[0]=t,this._$matrix[1]=e,this._$matrix[3]=i,this._$matrix[4]=s,this._$matrix[6]=r,this._$matrix[7]=n}setMaxSize(t,e){this._$frameBufferManager.setMaxSize(t,e)}transform(t,e,i,s,r,n){const a=this._$matrix[0],h=this._$matrix[1],o=this._$matrix[3],_=this._$matrix[4],l=this._$matrix[6],c=this._$matrix[7];this._$matrix[0]=t*a+e*o,this._$matrix[1]=t*h+e*_,this._$matrix[3]=i*a+s*o,this._$matrix[4]=i*h+s*_,this._$matrix[6]=r*a+n*o+l,this._$matrix[7]=r*h+n*_+c}debug(t=0){const e=this._$frameBufferManager,i=e.textureManager.getAtlasTexture(t),s=e.currentAttachment,r=e.createTextureAttachmentFrom(i);this._$bind(r);const n=new Uint8Array(i.width*i.height*4);this._$gl.readPixels(0,0,i.width,i.height,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,n);const a=document.createElement("canvas");a.width=i.width,a.height=i.height;const h=a.getContext("2d"),o=new ImageData(i.width,i.height);for(let t=0;t<n.length;++t)o.data[t]=n[t];null==h||h.putImageData(o,0,0),console.log(a.toDataURL()),this._$bind(s),e.releaseAttachment(r)}drawInstance(t,e,i,s,r){let n=1,a=1,h=1,o=0,_=0,l=0;const c=this._$globalAlpha;r&&(n=r[0],a=r[1],h=r[2],o=r[4]/255,_=r[5]/255,l=r[6]/255);const $=this._$cachePosition;if($)switch(this._$globalCompositeOperation){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":this.blend.drawInstance($,n,a,h,c,o,_,l,0,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled);break;default:{const r=this._$frameBufferManager.textureManager.getAtlasTexture($.index);this.blend.drawInstanceBlend(r,t,e,i,s,n,a,h,c,o,_,l,0,$,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled)}}}drawImage(t,e,i,s,r,n=null){let a=1,h=1,o=1,_=0,l=0,c=0;const $=this._$globalAlpha;n&&(a=n[0],h=n[1],o=n[2],_=n[4]/255,l=n[5]/255,c=n[6]/255),this.blend.drawImage(t,e,i,s,r,a,h,o,$,_,l,c,0,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled)}_$setColor(t=0,e=0,i=0,s=0){this._$clearColorR=t,this._$clearColorG=e,this._$clearColorB=i,this._$clearColorA=s,this._$gl.clearColor(t,e,i,s)}clearRect(t,e,i,s){this._$mask._$onClearRect(),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t,e,i,s),this._$gl.clear(this._$gl.COLOR_BUFFER_BIT|this._$gl.STENCIL_BUFFER_BIT),this._$gl.disable(this._$gl.SCISSOR_TEST)}_$clearRectStencil(){this._$mask._$onClearRect(),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(this._$maskBounds.xMin,this._$maskBounds.yMin,this._$maskBounds.xMax,this._$maskBounds.yMax),this._$gl.clear(this._$gl.STENCIL_BUFFER_BIT),this._$gl.disable(this._$gl.SCISSOR_TEST)}moveTo(t,e){this._$path.moveTo(t,e)}lineTo(t,e){this._$path.lineTo(t,e)}beginPath(){this._$path.begin()}quadraticCurveTo(t,e,i,s){this._$path.quadTo(t,e,i,s)}bezierCurveTo(t,e,i,s,r,n){this._$path.cubicTo(t,e,i,s,r,n)}fill(){const t=this._$path.vertices;if(!t.length)return;const e=L();for(let i=0;i<t.length;++i){const s=t[i];10>s.length||e.push(s)}if(!e.length)return void O(e);const i=this._$vao.createFill(e),s=this.fillStyle;let r,n,a,h=this._$matrix;const o=this._$grid.enabled;if(s instanceof gt){const t=s.stops,e="linearRGB"===s.rgb;if(r=this._$gradientLUT.generateForShape(t,e),this._$frameBufferManager.textureManager.bind0(r,!0),this._$frameBufferManager.bindRenderBuffer(),n=this._$shaderList.gradientShapeShaderVariants,"linear"===s.type)a=n.getGradientShapeShader(!1,o,!1,!1,s.mode),n.setGradientShapeUniform(a.uniform,!1,0,0,0,o,h,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!1,s.points,0);else{h=this._$stack[this._$stack.length-1];const t=0!==s.focalPointRatio;a=n.getGradientShapeShader(!1,o,!0,t,s.mode),n.setGradientShapeUniform(a.uniform,!1,0,0,0,o,h,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!0,s.points,s.focalPointRatio)}}else if(s instanceof ft){h=this._$stack[this._$stack.length-1];const t=s.colorTransform;r=s.texture,this._$frameBufferManager.textureManager.bind0(r,this._$imageSmoothingEnabled),n=this._$shaderList.shapeShaderVariants,a=n.getBitmapShapeShader(!1,s.repeat,o),t?n.setBitmapShapeUniform(a.uniform,!1,0,0,0,o,h,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,r.width,r.height,t[0],t[1],t[2],this._$globalAlpha,t[4]/255,t[5]/255,t[6]/255,0):n.setBitmapShapeUniform(a.uniform,!1,0,0,0,o,h,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,r.width,r.height,1,1,1,this._$globalAlpha,0,0,0,0)}else n=this._$shaderList.shapeShaderVariants,a=n.getSolidColorShapeShader(!1,this._$grid.enabled),n.setSolidColorShapeUniform(a.uniform,!1,0,0,0,o,h,this._$viewportWidth,this._$viewportHeight,this._$grid,s,this._$globalAlpha);const _=this._$shaderList.shapeShaderVariants,l=_.getMaskShapeShader(!1,o);_.setMaskShapeUniform(l.uniform,o,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],this._$viewportWidth,this._$viewportHeight,this._$grid),this._$gl.enable(this._$gl.STENCIL_TEST),this._$gl.stencilMask(255),this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.colorMask(!1,!1,!1,!1),l._$fill(i),this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.NOTEQUAL,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.ZERO,this._$gl.ZERO),this._$gl.colorMask(!0,!0,!0,!0),a._$fill(i),this._$gl.disable(this._$gl.STENCIL_TEST),this.releaseFillVertexArray(i)}releaseFillVertexArray(t){this._$vao.releaseFill(t);const e=t.indexRanges;for(let t=0;t<e.length;++t)Qt.indexRangePool.push(e[t]);O(e)}_$enterClip(){this._$mask._$enterClip()}_$beginClipDef(){this._$mask._$beginClipDef()}_$updateContainerClipFlag(t){this._$mask.containerClip=t}_$startClip(t){const e=t.xMin,i=t.yMin,s=Math.abs(t.xMax-t.xMin),n=Math.abs(t.yMax-t.yMin),a=this._$frameBufferManager.currentAttachment;if(!a)throw new Error("the current Attachment is null.");return!(e>a.width||i>a.height||0>e&&0>=s+e||0>i&&0>=n+i||(this._$maskBounds.xMin=r.max(0,r.min(this._$maskBounds.xMin,e)),this._$maskBounds.yMin=r.max(0,r.min(this._$maskBounds.yMin,i)),this._$maskBounds.xMax=r.min(a.width,r.min(this._$maskBounds.xMax,s)),this._$maskBounds.yMax=r.min(a.height,r.min(this._$maskBounds.yMax,n)),0))}_$endClipDef(){this._$mask._$endClipDef()}_$leaveClip(){this.drawInstacedArray(),this._$mask._$leaveClip()}_$drawContainerClip(){this._$mask._$drawContainerClip()}closePath(){this._$path.close()}stroke(){const t=this._$path.vertices;if(!t.length)return;const e=L();for(let i=0;i<t.length;++i){const s=t[i];6>s.length||e.push(s)}if(!e.length)return void O(e);const i=this._$vao.createStroke(t,this.lineCap,this.lineJoin);let s=this._$matrix;const n=this.strokeStyle;let a=r.sign(s[0]*s[4]);a>0&&0!==s[1]&&0!==s[3]&&(a=-r.sign(s[1]*s[3]));let h,o,_=.5*this.lineWidth;this._$grid.enabled?(h=r.abs(this._$grid.ancestorMatrixA+this._$grid.ancestorMatrixD),o=r.abs(this._$grid.ancestorMatrixB+this._$grid.ancestorMatrixE)):(h=r.abs(s[0]+s[3]),o=r.abs(s[1]+s[4]));const l=r.min(h,o),c=r.max(h,o);_*=c*(1-.3*r.cos(.5*r.PI*(l/c))),_=r.max(1,_);const $=this._$grid.enabled;let u,d,g;if(n instanceof gt){"radial"===n.type&&(s=this._$stack[this._$stack.length-1]);const t=n.stops,e="linearRGB"===n.rgb;if(u=this._$gradientLUT.generateForShape(t,e),this._$frameBufferManager.textureManager.bind0(u,!0),d=this._$shaderList.gradientShapeShaderVariants,"linear"===n.type)g=d.getGradientShapeShader(!0,$,!1,!1,n.mode),d.setGradientShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!1,n.points,0);else{s=this._$stack[this._$stack.length-1];const t=0!==n.focalPointRatio;g=d.getGradientShapeShader(!0,$,!0,t,n.mode),d.setGradientShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!0,n.points,n.focalPointRatio)}}else if(n instanceof ft){s=this._$stack[this._$stack.length-1];const t=n.colorTransform;u=n.texture,this._$frameBufferManager.textureManager.bind0(u),d=this._$shaderList.shapeShaderVariants,g=d.getBitmapShapeShader(!0,n.repeat,this._$grid.enabled),t?d.setBitmapShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,u.width,u.height,t[0],t[1],t[2],this._$globalAlpha,t[4]/255,t[5]/255,t[6]/255,0):d.setBitmapShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,u.width,u.height,1,1,1,this._$globalAlpha,0,0,0,0)}else d=this._$shaderList.shapeShaderVariants,g=d.getSolidColorShapeShader(!0,this._$grid.enabled),d.setSolidColorShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,this._$viewportWidth,this._$viewportHeight,this._$grid,n,this._$globalAlpha);g._$stroke(i),this._$vao.releaseStroke(i)}arc(t,e,i){this._$path.drawCircle(t,e,i)}clip(){const t=this._$path.vertices;if(!t.length)return;const e=L();for(let i=0;i<t.length;++i){const s=t[i];10>s.length||e.push(s)}if(!e.length)return void O(e);const i=this._$vao.createFill(e),s=this._$shaderList.shapeShaderVariants,r=s.getMaskShapeShader(!1,!1),n=r.uniform;s.setMaskShapeUniform(n,!1,this._$matrix[0],this._$matrix[1],this._$matrix[2],this._$matrix[3],this._$matrix[4],this._$matrix[5],this._$matrix[6],this._$matrix[7],this._$matrix[8],this._$viewportWidth,this._$viewportHeight,null),this._$mask._$onClip(i,this._$matrix,this._$viewportWidth,this._$viewportHeight)||(r._$fill(i),this.beginPath())}save(){const t=this._$matrix;this._$stack.push(k(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])),this._$mask._$onSave()}restore(){var t;this._$stack.length&&(t=this._$matrix,A.push(t),this._$matrix=this._$stack.pop()||k()),this._$mask._$onRestore()}createPattern(t,e,i){return new ft(this,t,e,i)}createLinearGradient(t,e,i,s,r="rgb",n="pad"){return(new gt).linear(t,e,i,s,r,n)}createRadialGradient(t,e,i,s,r,n,a="rgb",h="pad",o=0){return(new gt).radial(t,e,i,s,r,n,a,h,o)}_$applyBlurFilter(t,e,i){const s=this._$frameBufferManager,n=s.currentAttachment;if(!n)throw new Error("the current attachment is null.");const a=n.width,h=n.height;s.textureManager.bind0(t,!0);const o=r.ceil(.5*i),_=1-(o-.5*i),l=1+i,c=this._$shaderList.filterShaderVariants,$=c.getBlurFilterShader(o);c.setBlurFilterUniform($.uniform,a,h,e,_,l),$._$drawImage()}_$applyBitmapFilter(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g=null,f=null,m=null,p=0,x=0,b=0,v=0,T=0,A=0,M=0,y=0){const E=this._$frameBufferManager,C="inner"===$,S=E.currentAttachment,F=E.getTextureFromCurrentAttachment();let B=null;const w=null!==g&&null!==f&&null!==m;let R;null!==g&&null!==f&&null!==m&&(B=this._$gradientLUT.generateForFilter(g,f,m)),C?w&&B?E.textureManager.bind02(t,B,!0):E.textureManager.bind0(t):(R=this._$frameBufferManager.createTextureAttachment(e,i),this._$bind(R),w&&B?E.textureManager.bind012(t,F,B,!0):E.textureManager.bind01(t,F));const I=!(C||"full"===$&&u),P=!(e===h&&i===o&&0===_&&0===l),N=!(1===d),k=this._$shaderList.filterShaderVariants,L=k.getBitmapFilterShader(I,P,c,$,u,N,w);k.setBitmapFilterUniform(L.uniform,e,i,s,r,n,a,h,o,_,l,c,d,p,x,b,v,T,A,M,y,I,P,N,w),C?u?this.blend.toSourceIn():this.blend.toSourceAtop():this.blend.toOneZero(),L._$drawImage(),C||E.releaseAttachment(S,!0)}_$applyColorMatrixFilter(t,e){this._$frameBufferManager.textureManager.bind0(t,!0);const i=this._$shaderList.filterShaderVariants,s=i.getColorMatrixFilterShader();i.setColorMatrixFilterUniform(s.uniform,e),this.blend.reset(),s._$drawImage()}_$applyConvolutionFilter(t,e,i,s,r,n,a,h,o,_,l,c){const $=t.width,u=t.height,d=this._$frameBufferManager.createTextureAttachment($,u);this._$bind(d),this._$frameBufferManager.textureManager.bind0(t,!0);const g=this._$shaderList.filterShaderVariants,f=g.getConvolutionFilterShader(e,i,a,h);g.setConvolutionFilterUniform(f.uniform,$,u,s,r,n,h,o,_,l,c),this.blend.reset(),f._$drawImage()}_$applyDisplacementMapFilter(t,e,i,s,r,n,a,h,o,_,l,c,$,u){const d=t.width,g=t.height,f=this._$frameBufferManager.createTextureAttachment(d,g);this._$bind(f),r||(r={x:0,y:0});const m=this._$frameBufferManager.createTextureFromImage(e);this._$frameBufferManager.textureManager.bind01(t,m);const p=this._$shaderList.filterShaderVariants,x=p.getDisplacementMapFilterShader(n,a,_);p.setDisplacementMapFilterUniform(x.uniform,e.width,e.height,i,s,r.x,r.y,h,o,_,l,c,$,u),this.blend.reset(),x._$drawImage(),this._$frameBufferManager.releaseTexture(m)}_$startLayer(t){this._$positions.push(t),this._$blends.push(this._$isLayer),this._$isLayer=!0}_$endLayer(){const t=this._$positions.pop();t&&F(t),this._$isLayer=!!this._$blends.pop()}_$saveAttachment(t,e,i=!1){this.drawInstacedArray();const s=this._$frameBufferManager;this._$attachmentArray.push(s.currentAttachment),this._$bind(s.createCacheAttachment(t,e,i))}_$restoreAttachment(t=!1){const e=this._$frameBufferManager;e.releaseAttachment(e.currentAttachment,t),this._$bind(this._$attachmentArray.pop())}getCurrentPosition(){return this._$positions[this._$positions.length-1]}textureScale(t,e){const i=r.max(t,e);return i>this._$maxTextureSize?this._$maxTextureSize/i:1}}class se extends ut{constructor(){super(),this._$recodes=null,this._$maxAlpha=0,this._$canDraw=!1,this._$uniqueKey="",this._$cacheKeys=L(),this._$cacheParams=L(0,0,0),this._$bitmapId=0,this._$mode="shape"}_$clip(t,e){if(!this._$recodes)return;const i=this._$getBounds(),n=H(i,e);F(i);const a=r.ceil(r.abs(n.xMax-n.xMin)),h=r.ceil(r.abs(n.yMax-n.yMin));switch(F(n),!0){case 0===a:case 0===h:case a===-1/0:case h===-1/0:case a===s:case h===s:return}t.reset(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),this._$runCommand(t,this._$recodes,null,!0),t.clip()}_$createCacheKey(){if(!this._$recodes)return"";let t=0;for(let e=0;e<this._$recodes.length;e++)t=(t<<5)-t+this._$recodes[e],t|=0;return`${t}`}_$createBitmapTexture(t,e,i,s,r,n){if("bitmap"!==this._$mode)return null;t.drawInstacedArray();const a=t.frameBuffer,h=a.currentAttachment,o=a.createCacheAttachment(r,n);t._$bind(o),t.reset();const _=R(i,0,0,s,r/2,n/2),l=t.getTextureFromRect(e),c=R(1,0,0,1,-l.width/2,-l.height/2),$=z(_,c);I(_),I(c),t.setTransform($[0],$[1],$[2],$[3],$[4],$[5]),t.drawImage(l,0,0,l.width,l.height);const u=a.getTextureFromCurrentAttachment();return t._$bind(h),a.releaseAttachment(o),a.textureManager.release(l),u}_$draw(t,e,i,n="normal",a=null){if(!(this._$visible&&this._$recodes&&this._$maxAlpha&&this._$canDraw))return;const o=Y(i[3]+i[7]/255,0,1,0);if(!o)return;const _=this._$matrix;let l=null!==this._$scale9Grid;l&&(l=l&&r.abs(_[1])<.001&&r.abs(_[2])<1e-4);const c=S(this._$xMin,this._$xMax,this._$yMin,this._$yMax),$=H(c,e),u=$.xMax,d=$.xMin,g=$.yMax,f=$.yMin;F($);const m=r.ceil(r.abs(u-d)),p=r.ceil(r.abs(g-f));switch(!0){case 0===m:case 0===p:case m===-1/0:case p===-1/0:case m===s:case p===s:return}let x=+r.sqrt(e[0]*e[0]+e[1]*e[1]);if(!h.isInteger(x)){const t=x.toString(),e=t.indexOf("e");-1!==e&&(x=+t.slice(0,e)),x=+x.toFixed(4)}let b=+r.sqrt(e[2]*e[2]+e[3]*e[3]);if(!h.isInteger(b)){const t=b.toString(),e=t.indexOf("e");-1!==e&&(b=+t.slice(0,e)),b=+b.toFixed(4)}const v=null!==a&&a.length>0&&this._$canApply(a);let T=S(0,m,0,p);if(v&&a)for(let t=0;t<a.length;++t)T=a[t]._$generateFilterRect(T,x,b);const A=t.frameBuffer,M=A.currentAttachment;if(!M||d-T.xMin>M.width||f-T.yMin>M.height)return void F(T);if(0>d+T.xMax||0>f+T.yMax)return void F(T);if(F(T),""===this._$uniqueKey&&(!l&&this._$loaderInfoId>-1&&this._$characterId>-1?this._$uniqueKey=`${this._$loaderInfoId}@${this._$characterId}`:this._$uniqueKey=this._$createCacheKey()),"bitmap"===this._$mode)this._$cacheKeys.length||(this._$cacheKeys=it.generateKeys(this._$uniqueKey));else if(!this._$cacheKeys.length||this._$cacheParams[0]!==x||this._$cacheParams[1]!==b||this._$cacheParams[2]!==i[7]){const t=L();t[0]=x,t[1]=b,this._$cacheKeys=it.generateKeys(this._$uniqueKey,t,i),O(t),this._$cacheParams[0]=x,this._$cacheParams[1]=b,this._$cacheParams[2]=i[7]}if(t.cachePosition=it.get(this._$cacheKeys),!t.cachePosition){const s=A.currentAttachment;s&&s.mask&&t.stopStencil();let n=0,a=0;if("shape"===this._$mode){n=r.ceil(r.abs(c.xMax-c.xMin)*x),a=r.ceil(r.abs(c.yMax-c.yMin)*b);const e=t._$getTextureScale(n,a);e<1&&(n*=e,a*=e)}else n=r.ceil(r.abs(c.xMax-c.xMin)),a=r.ceil(r.abs(c.yMax-c.yMin));if(t.cachePosition=A.createCachePosition(n,a),t.bindRenderBuffer(t.cachePosition),t.reset(),"shape"===this._$mode?t.setTransform(x,0,0,b,-c.xMin*x,-c.yMin*b):t.setTransform(1,0,0,1,-c.xMin,-c.yMin),l){const i=oe.scaleX,s=R(i,0,0,i,0,0),n=z(s,_);I(s);const a=this._$matrixBase,h=R(a[0],a[1],a[2],a[3],a[4]*i-d,a[5]*i-f),o=z(h,n),l=o[4]-(e[4]-d),$=o[5]-(e[5]-f);I(o);const u=H(c,n),g=+u.xMax,m=+u.xMin,p=+u.yMax,x=+u.yMin,b=r.ceil(r.abs(g-m)),v=r.ceil(r.abs(p-x));F(u),t.grid.enable(m,x,b,v,c,this._$scale9Grid,i,n[0],n[1],n[2],n[3],n[4],n[5],h[0],h[1],h[2],h[3],h[4]-l,h[5]-$),I(n),I(h)}this._$runCommand(t,this._$recodes,i,!1),l&&t.grid.disable(),A.transferTexture(t.cachePosition),it.set(this._$cacheKeys,t.cachePosition),t._$bind(s)}let y=0,E=0;if(v&&a){const i=this._$createBitmapTexture(t,t.cachePosition,x,b,m,p),s=this._$drawFilter(t,e,a,m,p,i);s.offsetX&&(y=s.offsetX),s.offsetY&&(E=s.offsetY),t.cachePosition=s}if(v||"bitmap"!==this._$mode){const i=r.atan2(e[1],e[0]),s=r.atan2(-e[2],e[3]);if(v||!i&&!s)t.setTransform(1,0,0,1,d-y,f-E);else{const n=c.xMin*x,a=c.yMin*b,h=r.cos(i),o=r.sin(i),_=r.cos(s),l=r.sin(s);t.setTransform(h,o,-l,_,n*h-a*l+e[4],n*o+a*_+e[5])}}else t.setTransform(e[0],e[1],e[2],e[3],c.xMin*e[0]+c.yMin*e[2]+e[4],c.xMin*e[1]+c.yMin*e[3]+e[5]);t.cachePosition&&(t.globalAlpha=o,t.imageSmoothingEnabled="shape"===this._$mode,t.globalCompositeOperation=n,t.drawInstance(d-y,f-E,u,g,i),t.cachePosition=null),F(c)}setupStroke(t,e,i,s,r){switch(t.lineWidth=e,i){case 0:t.lineCap="none";break;case 1:t.lineCap="round";break;case 2:t.lineCap="square"}switch(s){case 0:t.lineJoin="bevel";break;case 1:t.lineJoin="miter";break;case 2:t.lineJoin="round"}t.miterLimit=r}createGradientStyle(t,e,i,s,n,a,h,o=null){let _,l="pad";switch(n){case 0:l="reflect";break;case 1:l="repeat"}if(0===e){const e=(t=>{const e=-819.2*t[0]-819.2*t[2]+t[4],i=819.2*t[0]-819.2*t[2]+t[4],s=-819.2*t[0]+819.2*t[2]+t[4],n=-819.2*t[1]-819.2*t[3]+t[5],a=819.2*t[1]-819.2*t[3]+t[5];let h=s-e,o=-819.2*t[1]+819.2*t[3]+t[5]-n;const _=r.sqrt(h*h+o*o);_?(h/=_,o/=_):(h=0,o=0);const l=(i-e)*h+(a-n)*o;return B(e+l*h,n+l*o,i,a)})(s);_=t.createLinearGradient(e[0],e[1],e[2],e[3],a?"rgb":"linearRGB",l)}else t.save(),t.transform(s[0],s[1],s[2],s[3],s[4],s[5]),_=t.createRadialGradient(0,0,0,0,0,819.2,a?"rgb":"linearRGB",l,h);for(let t=0;t<i.length;++t){const e=i[t];let s=e.A;o&&(1===o[3]&&0===o[7]||(s=0|r.max(0,r.min(e.A*o[3]+o[7],255)))),_.addColorStop(e.ratio,B(e.R,e.G,e.B,s))}return _}_$runCommand(t,e,i=null,s=!1){t.reset(),t.beginPath();const n=e.length;for(let a=0;a<n;)switch(e[a++]){case 9:t.beginPath();break;case 0:t.moveTo(e[a++],e[a++]);break;case 2:t.lineTo(e[a++],e[a++]);break;case 1:t.quadraticCurveTo(e[a++],e[a++],e[a++],e[a++]);break;case 5:{if(s){a+=4;continue}const n=B();n[0]=e[a++]/255,n[1]=e[a++]/255,n[2]=e[a++]/255,n[3]=e[a++]/255,null!==i&&(1===i[3]&&0===i[7]||(n[3]=r.max(0,r.min(n[3]*i[3]+i[7],255))/255)),t.fillStyle=n}break;case 7:s||t.fill();break;case 6:{if(s){a+=8;continue}this.setupStroke(t,e[a++],e[a++],e[a++],e[a++]);const n=B();n[0]=e[a++]/255,n[1]=e[a++]/255,n[2]=e[a++]/255,n[3]=e[a++]/255,null!==i&&(1===i[3]&&0===i[7]||(n[3]=r.max(0,r.min(n[3]*i[3]+i[7],255))/255)),t.strokeStyle=n}break;case 8:s||t.stroke();break;case 12:t.closePath();break;case 3:t.bezierCurveTo(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]);break;case 4:t.arc(e[a++],e[a++],e[a++]);break;case 10:{if(s){a+=1;const t=e[a++];a+=5*t,a+=9;continue}const r=e[a++];let n=e[a++];const h=L();for(;n;)h.push({ratio:e[a++],R:e[a++],G:e[a++],B:e[a++],A:e[a++]}),n--;const o=R(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]);t.fillStyle=this.createGradientStyle(t,r,h,o,e[a++],e[a++],e[a++],i),t.fill(),1===r&&t.restore(),I(o),O(h)}break;case 11:{if(s){a+=5;const t=e[a++];a+=5*t,a+=9;continue}this.setupStroke(t,e[a++],e[a++],e[a++],e[a++]);const r=e[a++];let n=e[a++];const h=L();for(;n;)h.push({ratio:e[a++],R:e[a++],G:e[a++],B:e[a++],A:e[a++]}),n--;const o=R(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]);t.strokeStyle=this.createGradientStyle(t,r,h,o,e[a++],e[a++],e[a++],i),t.stroke(),1===r&&t.restore(),I(o),O(h)}break;case 13:{const r=e[a++],n=e[a++],h=e[a++],o=e[a++],_=e[a++];if(s){a+=_,a+=8;continue}const l=new Uint8Array(e.subarray(a,_+a));a+=_;const c=R(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]),$=!!e[a++],u=!!e[a++];t.save(),1===c[0]&&0===c[1]&&0===c[2]&&1===c[3]&&0===c[4]&&0===c[5]||t.transform(c[0],c[1],c[2],c[3],c[4],c[5]),I(c);const d=t.frameBuffer,g=d.createTextureFromPixels(r,n,l,!0);$||r!==h||n!==o?(t.fillStyle=t.createPattern(g,$,i||P()),t.imageSmoothingEnabled=u,t.fill()):(t.drawImage(g,0,0,r,n),d.releaseTexture(g)),t.restore(),t.imageSmoothingEnabled=!1}break;case 14:{if(s){a+=4;const t=e[a++];a+=t,a+=8;continue}t.save(),this.setupStroke(t,e[a++],e[a++],e[a++],e[a++]);const r=e[a++],n=e[a++],h=e[a++],o=new Uint8Array(e.subarray(a,h+a));a+=h;const _=R(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]);1===_[0]&&0===_[1]&&0===_[2]&&1===_[3]&&0===_[4]&&0===_[5]||t.transform(_[0],_[1],_[2],_[3],_[4],_[5]),I(_);const l=!!e[a++],c=!!e[a++],$=t.frameBuffer.createTextureFromPixels(r,n,o,!0);t.strokeStyle=t.createPattern($,l,i||P()),t.imageSmoothingEnabled=c,t.stroke(),t.restore(),t.imageSmoothingEnabled=!1}}}_$update(t){super._$update(t),t.recodes&&(this._$recodes=t.recodes,this._$xMin=t.xMin,this._$yMin=t.yMin,this._$xMax=t.xMax,this._$yMax=t.yMax,this._$maxAlpha=t.maxAlpha,this._$canDraw=t.canDraw,it.removeCache(this._$instanceId),this._$loaderInfoId>-1&&this._$characterId>-1&&it.removeCache(`${this._$loaderInfoId}@${this._$characterId}`))}}class re extends se{_$clip(t,e){let i=e;const n=this._$matrix;1===n[0]&&0===n[1]&&0===n[2]&&1===n[3]&&0===n[4]&&0===n[5]||(i=z(e,n));const a=this._$getBounds(),h=H(a,i);F(a);const o=r.ceil(r.abs(h.xMax-h.xMin)),_=r.ceil(r.abs(h.yMax-h.yMin));switch(F(h),!0){case 0===o:case 0===_:case o===-1/0:case _===-1/0:case o===s:case _===s:return}super._$clip(t,i),i!==e&&I(i)}_$draw(t,e,i){if(!this._$visible||!this._$maxAlpha||!this._$canDraw)return;let s=i;const r=this._$colorTransform;if(1===r[0]&&1===r[1]&&1===r[2]&&1===r[3]&&0===r[4]&&0===r[5]&&0===r[6]&&0===r[7]||(s=G(i,r)),!Y(s[3]+s[7]/255,0,1,0))return void(s!==i&&N(s));let n=e;const a=this._$matrix;1===a[0]&&0===a[1]&&0===a[2]&&1===a[3]&&0===a[4]&&0===a[5]||(n=z(e,a)),super._$draw(t,n,s,this._$blendMode,this._$filters),n!==e&&I(n),s!==i&&N(s)}_$remove(){this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$recodes=null,super._$remove(),_e.push(this)}}class ne extends ut{constructor(){super(),this._$background=!1,this._$backgroundColor=16777215,this._$border=!1,this._$borderColor=0,this._$wordWrap=!1,this._$textData=L(),this._$textAreaActive=!1,this._$thickness=0,this._$thicknessColor=0,this._$limitWidth=0,this._$limitHeight=0,this._$autoSize="none",this._$widthTable=L(),this._$heightTable=L(),this._$objectTable=L(),this._$textHeightTable=L(),this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$maxScrollV=null,this._$scrollV=1,this._$textHeight=0,this._$verticalAlign="top",this._$cacheKeys=L(),this._$cacheParams=L(0,0,0)}get width(){const t=H(this._$getBounds(null),this._$matrix),e=r.abs(t.xMax-t.xMin);switch(F(t),!0){case 0===e:case e===s:case e===-1/0:return 0;default:return e}}get height(){const t=H(this._$getBounds(null),this._$matrix),e=r.abs(t.yMax-t.yMin);switch(F(t),e){case 0:case s:case-1/0:return 0;default:return e}}get maxScrollV(){if(null===this._$maxScrollV){this._$maxScrollV=1;const t=this._$textHeightTable.length,e=this.height;if(e>this._$textHeight)return this._$maxScrollV;let i=0,s=0;for(;t>s&&(i+=this._$textHeightTable[s++],!(i>e));)this._$maxScrollV++}return this._$maxScrollV}_$clip(t,e){const i=this._$getBounds(),s=i.xMax,n=i.xMin,a=i.yMax,h=i.yMin;F(i);const o=r.ceil(r.abs(s-n)),_=r.ceil(r.abs(a-h));if(!o||!_)return;let l=e;const c=this._$matrix;1===c[0]&&0===c[1]&&0===c[2]&&1===c[3]&&0===c[4]&&0===c[5]||(l=z(e,c)),t.reset(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(o,0),t.lineTo(o,_),t.lineTo(0,_),t.lineTo(0,0),t.clip(),l!==e&&I(l)}_$draw(t,e,i){if(!this._$visible||this._$textAreaActive)return;if(!this._$background&&!this._$border&&2>this._$textData.length)return;let n=i;const a=this._$colorTransform;1===a[0]&&1===a[1]&&1===a[2]&&1===a[3]&&0===a[4]&&0===a[5]&&0===a[6]&&0===a[7]||(n=G(i,a));const o=Y(n[3]+n[7]/255,0,1);if(!o)return;let _=e;const l=this._$matrix;1===l[0]&&0===l[1]&&0===l[2]&&1===l[3]&&0===l[4]&&0===l[5]||(_=z(e,l));const c=this._$getBounds(null);c.xMin-=this._$thickness,c.xMax+=this._$thickness,c.yMin-=this._$thickness,c.yMax+=this._$thickness;const $=H(c,_),u=+$.xMax,d=+$.xMin,g=+$.yMax,f=+$.yMin;F($);const m=r.ceil(r.abs(u-d)),p=r.ceil(r.abs(g-f));switch(!0){case 0===m:case 0===p:case m===-1/0:case p===-1/0:case m===s:case p===s:return}let x=+r.sqrt(_[0]*_[0]+_[1]*_[1]);if(!h.isInteger(x)){const t=x.toString(),e=t.indexOf("e");-1!==e&&(x=+t.slice(0,e)),x=+x.toFixed(4)}let b=+r.sqrt(_[2]*_[2]+_[3]*_[3]);if(!h.isInteger(b)){const t=b.toString(),e=t.indexOf("e");-1!==e&&(b=+t.slice(0,e)),b=+b.toFixed(4)}const v=this._$filters,T=null!==v&&v.length>0&&this._$canApply(v);let A=S(0,m,0,p);if(T&&v)for(let t=0;t<v.length;++t)A=v[t]._$generateFilterRect(A,x,b);const M=t.frameBuffer,y=M.currentAttachment;if(!y||d-A.xMin>y.width||f-A.yMin>y.height)return void F(A);if(0>d+A.xMax||0>f+A.yMax)return void F(A);if(F(A),this._$isUpdated()&&(it.removeCache(this._$instanceId),t.cachePosition=null,this._$cacheKeys.length=0),!this._$cacheKeys.length||this._$cacheParams[0]!==x||this._$cacheParams[1]!==b||this._$cacheParams[2]!==i[7]){const t=L(x,b);this._$cacheKeys=it.generateKeys(this._$instanceId,t),O(t),this._$cacheParams[0]=x,this._$cacheParams[1]=b,this._$cacheParams[2]=i[7]}if(t.cachePosition=it.get(this._$cacheKeys),!t.cachePosition){const s=r.min(1,r.max(x,b)),a=r.ceil(r.abs(c.xMax-c.xMin)*x),h=r.ceil(r.abs(c.yMax-c.yMin)*b);n[3]=1;const o=new OffscreenCanvas(a+2*s,h+2*s).getContext("2d");if(!o)return;if(this._$background||this._$border){if(o.beginPath(),o.moveTo(0,0),o.lineTo(a,0),o.lineTo(a,h),o.lineTo(0,h),o.lineTo(0,0),this._$background){const t=Q(this._$backgroundColor),e=r.max(0,r.min(255*t.A*i[3]+i[7],255))/255;o.fillStyle=`rgba(${t.R},${t.G},${t.B},${e})`,o.fill()}if(this._$border){const t=Q(this._$borderColor),e=r.max(0,r.min(255*t.A*i[3]+i[7],255))/255;o.lineWidth=s,o.strokeStyle=`rgba(${t.R},${t.G},${t.B},${e})`,o.stroke()}}o.save(),o.beginPath(),o.moveTo(2,2),o.lineTo(a-2,2),o.lineTo(a-2,h-2),o.lineTo(2,h-2),o.lineTo(2,2),o.clip(),o.beginPath(),o.setTransform(x,0,0,b,0,0),this._$doDraw(o,e,i,a/x),o.restore();const _=M.createCachePosition(m,p),l=M.createTextureFromCanvas(o.canvas);t.drawTextureFromRect(l,_),t.cachePosition=_,it.set(this._$cacheKeys,_)}let E=!1,C=0,B=0;if(v&&v.length&&this._$canApply(v)){E=!0;const e=this._$drawFilter(t,_,v,m,p);e.offsetX&&(C=e.offsetX),e.offsetY&&(B=e.offsetY),t.cachePosition=e}const w=r.atan2(_[1],_[0]),R=r.atan2(-_[2],_[3]);if(E||!w&&!R)t.setTransform(1,0,0,1,d-C,f-B);else{const e=c.xMin*x,i=c.yMin*b,s=r.cos(w),n=r.sin(w),a=r.cos(R),h=r.sin(R);t.setTransform(s,n,-h,a,e*s-i*h+_[4],e*n+i*a+_[5])}t.cachePosition&&(t.globalAlpha=o,t.imageSmoothingEnabled=!0,t.globalCompositeOperation=this._$blendMode,t.drawInstance(d-C,f-B,u,g,i),t.cachePosition=null),F(c),_!==e&&I(_),n!==i&&N(n)}_$doDraw(t,e,i,s){const n=this.width,a=this.height;let h=0,o=0,_=0,l=0;if("top"!==this._$verticalAlign&&this.height>this._$textHeight)switch(this._$verticalAlign){case"middle":l=(this.height-this._$textHeight+2)/2;break;case"bottom":l=this.height-this._$textHeight+2}const c=this._$textData.length;for(let $=0;$<c;++$){const c=this._$textData[$];if(0===c.width)continue;const u=h+c.x;if("none"===this._$autoSize&&(o>a||u>n))continue;const d=c.textFormat,g=Q(c.textFormat._$color),f=r.max(0,r.min(255*g.A*i[3]+i[7],255))/255;if(t.fillStyle=`rgba(${g.R},${g.G},${g.B},${f})`,this._$thickness){const e=Q(this._$thicknessColor),s=r.max(0,r.min(255*e.A*i[3]+i[7],255))/255;t.lineWidth=this._$thickness,t.strokeStyle=`rgba(${e.R},${e.G},${e.B},${s})`}const m=c.yIndex;switch(c.mode){case"break":case"wrap":if(_++,this._$scrollV>_)continue;if(o+=this._$textHeightTable[m],h=this._$getAlignOffset(this._$objectTable[m],s),d._$underline){const s=c.textFormat._$size/12,n=Q(d._$color),a=r.max(0,r.min(255*n.A*i[3]+i[7],255))/255;t.lineWidth=r.max(1,1/r.min(e[0],e[3])),t.strokeStyle=`rgba(${n.R},${n.G},${n.B},${a})`,t.beginPath(),t.moveTo(h,l+o-s),t.lineTo(h+this._$widthTable[m],l+o-s),t.stroke()}break;case"text":{if(this._$scrollV>_)continue;let e=o-this._$heightTable[0];he||(e+=c.textFormat._$size/12*2),t.beginPath(),t.textBaseline="top",t.font=J(d._$font,d._$size,d._$italic,d._$bold),this._$thickness&&t.strokeText(c.text,u,l+e),t.fillText(c.text,u,l+e)}break;case"image":if(!c.loaded)continue;t.beginPath(),t.drawImage(c.image,c.hspace,l+c.y,c.width,c.height)}}}_$getAlignOffset(t,e){const i=this._$widthTable[t.yIndex],s=t.textFormat,n=s._$blockIndent+s._$leftMargin>0?s._$blockIndent+s._$leftMargin:0;switch(!0){case!this._$wordWrap&&i>e:return r.max(0,n);case"center"===s._$align:case"center"===this._$autoSize:return r.max(0,e/2-n-s._$rightMargin-i/2);case"right"===s._$align:case"right"===this._$autoSize:return r.max(0,e-n-i-s._$rightMargin-2);default:return r.max(0,n+2)}}_$remove(){this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$textData.length=0,this._$widthTable.length=0,this._$heightTable.length=0,this._$objectTable.length=0,this._$textHeightTable.length=0,this._$textAreaActive=!1,super._$remove(),le.push(this)}_$updateProperty(t){this._$textAreaActive=!!t.textAreaActive,this._$textData.length=0,this._$widthTable.length=0,this._$heightTable.length=0,this._$objectTable.length=0,this._$textHeightTable.length=0,this._$textData.push(...t.textData),this._$widthTable.push(...t.widthTable),this._$heightTable.push(...t.heightTable),this._$objectTable.push(...t.objectTable),this._$textHeightTable.push(...t.textHeightTable),this._$wordWrap=t.wordWrap,this._$limitWidth=t.limitWidth,this._$limitHeight=t.limitHeight,this._$autoSize=t.autoSize,this._$scrollV=t.scrollV,this._$textHeight=t.textHeight,this._$verticalAlign=t.verticalAlign,this._$border=t.border,this._$border&&(this._$borderColor=t.borderColor),this._$background=t.background,this._$background&&(this._$backgroundColor=t.backgroundColor),"thickness"in t&&(this._$thickness=t.thickness,this._$thicknessColor=t.thicknessColor)}_$update(t){super._$update(t),this._$textAreaActive=!!t.textAreaActive,this._$xMin=t.xMin,this._$yMin=t.yMin,this._$xMax=t.xMax,this._$yMax=t.yMax,t.textData&&this._$updateProperty(t)}}class ae extends ut{constructor(){super(),this._$imageBitmap=null,this._$context=null,this._$smoothing=!0,this._$cacheKeys=L(),this._$cacheParams=L(0,0,0)}_$clip(t,e){const i=this._$xMax,s=this._$yMax;if(!i||!s)return;let r=e;const n=this._$matrix;1===n[0]&&0===n[1]&&0===n[2]&&1===n[3]&&0===n[4]&&0===n[5]||(r=z(e,n)),t.reset(),t.setTransform(r[0],r[1],r[2],r[3],r[4],r[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,s),t.lineTo(0,s),t.lineTo(0,0),t.clip(),r!==e&&I(r)}_$draw(t,e,i){if(!this._$visible||!this._$imageBitmap||!this._$context)return;let n=i;const a=this._$colorTransform;1===a[0]&&1===a[1]&&1===a[2]&&1===a[3]&&0===a[4]&&0===a[5]&&0===a[6]&&0===a[7]||(n=G(i,a));const o=Y(n[3]+n[7]/255,0,1,0);if(!o)return void(n!==i&&N(n));let _=e;const l=this._$matrix;1===l[0]&&0===l[1]&&0===l[2]&&1===l[3]&&0===l[4]&&0===l[5]||(_=z(e,l));const c=this._$getBounds();F(c);const $=H(c,_),u=+$.xMax,d=+$.xMin,g=+$.yMax,f=+$.yMin;F($);const m=r.ceil(r.abs(u-d)),p=r.ceil(r.abs(g-f));switch(!0){case 0===m:case 0===p:case m===-1/0:case p===-1/0:case m===s:case p===s:return}let x=+r.sqrt(_[0]*_[0]+_[1]*_[1]);if(!h.isInteger(x)){const t=x.toString(),e=t.indexOf("e");-1!==e&&(x=+t.slice(0,e)),x=+x.toFixed(4)}let b=+r.sqrt(_[2]*_[2]+_[3]*_[3]);if(!h.isInteger(b)){const t=b.toString(),e=t.indexOf("e");-1!==e&&(b=+t.slice(0,e)),b=+b.toFixed(4)}const v=this._$filters,T=null!==v&&v.length>0&&this._$canApply(v);let A=S(0,m,0,p);if(T&&v)for(let t=0;t<v.length;++t)A=v[t]._$generateFilterRect(A,x,b);const M=t.frameBuffer,y=M.currentAttachment;if(!y||d-A.xMin>y.width||f-A.yMin>y.height)return void F(A);if(0>d+A.xMax||0>f+A.yMax)return void F(A);if(F(A),!this._$cacheKeys.length||this._$cacheParams[0]!==x||this._$cacheParams[1]!==b||this._$cacheParams[2]!==i[7]){const t=L();t[0]=x,t[1]=b,this._$cacheKeys=it.generateKeys(this._$instanceId,t,i),O(t),this._$cacheParams[0]=x,this._$cacheParams[1]=b,this._$cacheParams[2]=i[7]}if(t.cachePosition=it.get(this._$cacheKeys),!t.cachePosition){const e=r.ceil(r.abs(this._$xMax-this._$xMin)),i=r.ceil(r.abs(this._$yMax-this._$yMin)),s=M.createCachePosition(e,i);t.cachePosition=s,it.set(this._$cacheKeys,s)}this._$context.drawImage(this._$imageBitmap,0,0);const E=M.textureManager._$createFromElement(this._$imageBitmap.width,this._$imageBitmap.height,this._$context.canvas,this._$smoothing);let C=0,B=0;if(T&&v){const e=M.currentAttachment,i=M.createCacheAttachment(m,p);t._$bind(i),t.reset();const s=R(x,0,0,b,m/2,p/2),r=R(1,0,0,1,-E.width/2,-E.height/2),n=z(s,r);I(s),I(r),t.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),t.drawImage(E,0,0,E.width,E.height);const a=M.getTextureFromCurrentAttachment();t._$bind(e),M.releaseAttachment(i),t.drawTextureFromRect(E,t.cachePosition);const h=this._$drawFilter(t,_,v,m,p,a);h.offsetX&&(C=h.offsetX),h.offsetY&&(B=h.offsetY),t.cachePosition=h,t.setTransform(1,0,0,1,d-C,f-B)}else t.drawTextureFromRect(E,t.cachePosition),t.setTransform(_[0],_[1],_[2],_[3],_[4],_[5]);t.cachePosition&&(t.globalAlpha=o,t.imageSmoothingEnabled=!0,t.globalCompositeOperation=this._$blendMode,t.drawInstance(d-C,f-B,u,g,i),t.cachePosition=null),_!==e&&I(_),n!==i&&N(n)}_$remove(){this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$context=null,this._$imageBitmap=null,this._$smoothing=!0,super._$remove(),$e.push(this)}_$updateProperty(t){if(this._$xMin=t.xMin,this._$yMin=t.yMin,this._$xMax=t.xMax,this._$yMax=t.yMax,this._$imageBitmap=t.imageBitmap,this._$smoothing=t.smoothing,!this._$context&&this._$imageBitmap){const t=new c(this._$imageBitmap.width,this._$imageBitmap.height);this._$context=t.getContext("2d")}}_$update(t){super._$update(t),this._$updateProperty(t)}}let he=!1;const oe=new class{constructor(){this._$instances=new Map,this._$matrix=R(1,0,0,1,0,0),this._$width=0,this._$height=0,this._$stage=new dt,this._$canvas=null,this._$context=null,this._$attachment=null}get instances(){return this._$instances}get context(){return this._$context}get scaleX(){return this._$matrix[0]}stop(){it.reset()}_$initialize(e,i){let s=0;var r,n;this._$setStage(e[s++]),n=1===e[s++],he=n,r=e[s++],t=r,this._$canvas=i;const a=i.getContext("webgl2",{stencil:!0,premultipliedAlpha:!0,antialias:!1,depth:!1,preserveDrawingBuffer:!0});if(a){const t=new ie(a,e[s++]);this._$context=t,it.context=t}}_$setBackgroundColor(t){if(!this._$context)return;const e=t[0];if(-1===e)this._$context._$setColor(0,0,0,0);else{const t={A:(i=e)>>>24,R:(16711680&i)>>16,G:(65280&i)>>8,B:255&i};this._$context._$setColor(t.R/255,t.G/255,t.B/255,1)}var i}_$bitmapDraw(t,e,i,s){const r=this._$context;if(!r)return;r._$bind(this._$attachment),r.reset(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,this._$width,this._$height),r.beginPath(),t._$draw(r,e,i),r.frameBuffer.transferToMainTexture();const n=s.getContext("2d");n&&this._$canvas&&n.drawImage(this._$canvas,0,0)}_$draw(){if(!this._$width||!this._$height)return;const t=this._$context;t&&(t.reset(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this._$width,this._$height),t.beginPath(),this._$stage._$draw(t,this._$matrix,m),this._$stage._$updated=!1,t.drawInstacedArray(),t.frameBuffer.transferToMainTexture())}_$resize(t){let e=0;const i=t[e++],s=t[e++];if(this._$width=i,this._$height=s,!this._$canvas)return;if(this._$canvas.width===i&&this._$canvas.height===s)return;const r=this._$context;if(!r)return;const n=t[e++];this._$matrix[0]=n,this._$matrix[3]=n,this._$matrix[4]=t[e++],this._$matrix[5]=t[e++],this._$stage._$updated=!0,it.reset(),r.clearInstacedArray(),this._$canvas.width=i,this._$canvas.height=s,r._$gl.viewport(0,0,i,s);const a=r.frameBuffer;this._$attachment&&(a.unbind(),a.releaseAttachment(this._$attachment,!0)),this._$attachment=a.createCacheAttachment(i,s,!0),r.setMaxSize(i,s),r._$bind(this._$attachment)}_$setStage(t){this._$stage._$instanceId=t,this._$instances.set(t,this._$stage)}_$updateStage(){this._$stage._$updated=!0}_$createDisplayObjectContainer(t){const e=ue();let i=0;e._$instanceId=t[i++],e._$parentId=t[i++],this._$setProperty(e,t,2),this._$instances.set(e._$instanceId,e)}_$setProperty(t,e,i){t._$visible=1===e[i++],t._$depth=e[i++],t._$clipDepth=e[i++],t._$isMask=1===e[i++],1===e[i++]?(t._$maskId=e[i++],t._$maskMatrix||(t._$maskMatrix=R()),t._$maskMatrix[0]=e[i++],t._$maskMatrix[1]=e[i++],t._$maskMatrix[2]=e[i++],t._$maskMatrix[3]=e[i++],t._$maskMatrix[4]=e[i++],t._$maskMatrix[5]=e[i++]):(t._$maskId=-1,t._$maskMatrix&&(I(t._$maskMatrix),t._$maskMatrix=null),i+=7),t._$visible?(t._$matrix[0]=e[i++],t._$matrix[1]=e[i++],t._$matrix[2]=e[i++],t._$matrix[3]=e[i++],t._$matrix[4]=e[i++],t._$matrix[5]=e[i++],t._$colorTransform[0]=e[i++],t._$colorTransform[1]=e[i++],t._$colorTransform[2]=e[i++],t._$colorTransform[3]=e[i++],t._$colorTransform[4]=e[i++],t._$colorTransform[5]=e[i++],t._$colorTransform[6]=e[i++],t._$colorTransform[7]=e[i++]):(i+=6,i+=8),t._$blendMode=et(e[i++]),e[i++]?t._$scale9Grid={x:e[i++],y:e[i++],w:e[i++],h:e[i++]}:t._$scale9Grid=null,t._$blendMode=et(e[i++]),e[i++]?t._$scale9Grid={x:e[i++],y:e[i++],w:e[i++],h:e[i++]}:t._$scale9Grid=null}_$registerShapeRecodes(t,e){this._$instances.has(t)||this._$instances.set(t,fe()),this._$instances.get(t)._$recodes=e}_$createShape(t){let e=0;const i=t[e++];this._$instances.has(i)||this._$instances.set(i,fe());const s=this._$instances.get(i);s._$instanceId=i,s._$parentId=t[e++],s._$maxAlpha=t[e++],s._$canDraw=1===t[e++],s._$xMin=t[e++],s._$yMin=t[e++],s._$xMax=t[e++],s._$yMax=t[e++],s._$characterId=t[e++],s._$loaderInfoId=t[e++],this._$setProperty(s,t,10)}_$createVideo(t){const e=ge();t.characterId&&(e._$characterId=t.characterId),"loaderInfoId"in t&&(e._$loaderInfoId=t.loaderInfoId||0),e._$updateProperty(t),this._$instances.set(e._$instanceId,e)}_$createTextField(t){const e=de();e._$xMin=t.xMin||0,e._$yMin=t.yMin||0,e._$xMax=t.xMax||0,e._$yMax=t.yMax||0,t.characterId&&(e._$characterId=t.characterId),"loaderInfoId"in t&&(e._$loaderInfoId=t.loaderInfoId||0),e._$updateProperty(t),this._$instances.set(e._$instanceId,e)}},_e=[],le=[],ce=[],$e=[],ue=()=>ce.pop()||new dt,de=()=>le.pop()||new ne,ge=()=>$e.pop()||new ae,fe=()=>_e.pop()||new re;const me=new class{constructor(){this.state="deactivate",this.queue=[],this._$options=[]}execute(){this.state="active";let t=!0;for(;this.queue.length;){const e=this.queue.shift();if(console.log(e),e){switch(t=!0,e.command){case"draw":oe._$draw();break;case"setProperty":if(!oe.instances.has(e.instanceId))continue;break;case"setChildren":{t=!1;const i=e.buffer,s=oe.instances;if(!s.has(i[0]))continue;const r=s.get(i[0]);r._$doChanged(),r._$children=i.subarray(1)}break;case"remove":{const t=oe.instances;if(!t.has(e.instanceId))continue;t.get(e.instanceId)._$remove(),t.delete(e.instanceId)}break;case"createShape":oe._$createShape(e.buffer);break;case"createDisplayObjectContainer":oe._$createDisplayObjectContainer(e.buffer);break;case"createTextField":oe._$createTextField(e);break;case"createVideo":oe._$createVideo(e);break;case"resize":oe._$resize(e.buffer);break;case"initialize":oe._$initialize(e.buffer,e.canvas);break;case"setBackgroundColor":oe._$setBackgroundColor(e.buffer);break;case"stop":oe.stop();break;case"removeCache":it.removeCache(e.id);break;case"bitmapDraw":{const t=oe.instances;if(!t.has(e.sourceId))continue;const i=t.get(e.sourceId),s=new c(e.width,e.height);oe._$bitmapDraw(i,e.matrix||f,e.colorTransform||m,s);const r=s.transferToImageBitmap();globalThis.postMessage({command:"bitmapDraw",sourceId:e.sourceId,imageBitmap:r},[r])}break;default:if(e.command.indexOf("shapeRecodes")>-1){t=!1;const i=+e.command.split("@")[1];oe._$registerShapeRecodes(i,e.buffer)}}e.buffer&&t&&(this._$options.length=0)}}this.state="deactivate"}};self.addEventListener("message",(t=>{return e=void 0,i=void 0,r=function*(){me.queue.push(t.data),"deactivate"===me.state&&me.execute()},new((s=void 0)||(s=Promise))((function(t,n){function a(t){try{o(r.next(t))}catch(t){n(t)}}function h(t){try{o(r.throw(t))}catch(t){n(t)}}function o(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(a,h)}o((r=r.apply(e,i||[])).next())}));var e,i,s,r}))})();'],{type:"text/javascript"}))):null,Tr=null,Tr&&(Er=t=>{t._$createWorkerInstance(),t._$postProperty();const e=t._$needsChildren?t._$getChildren():t._$children,i=nt();for(let t=0;t<e.length;++t){const s=e[t];s&&(i.push(s._$instanceId),"_$children"in s?Er(s):(s._$createWorkerInstance(),s._$postProperty()))}t._$postChildrenIds(i),at(i)},yr=t=>{t._$removeWorkerInstance();const e=t._$needsChildren?t._$getChildren():t._$children;for(let t=0;t<e.length;++t){const i=e[t];i&&("_$children"in i?yr(i):i._$removeWorkerInstance())}})}return new Promise((t=>{const e=navigator.userAgentData;if(e)e.getHighEntropyValues(["platform","mobile"]).then((e=>{const i=e.brands;for(let t=0;t<i.length;++t)if(-1!==i[t].brand.indexOf("Chrome")){qs=!0;break}Ws="Android"===e.platform,Ks="iOS"===e.platform,Qs=Ws||Ks,t()}));else{const e=navigator.userAgent;Ws=e.indexOf("Android")>-1,Ks=e.indexOf("iPhone")>-1||e.indexOf("iPod")>-1,qs=e.indexOf("Chrome")>-1,js=e.indexOf("Firefox")>-1,Hs=-1===e.indexOf("Chrome")&&e.indexOf("Safari")>-1,Qs=Ws||Ks,t()}}))};"next2d"in window||(console.log("%c Next2D Player %c 1.17.2 %c https://next2d.app","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),window.next2d=new class{constructor(t){this._$promises=t,this._$player=new gs,this.display=ps,this.events=fs,this.filters=ms,this.geom=xs,this.media=bs,this.net=vs,this.text=Ts,this.ui=ys}get player(){return this._$player}load(t,e){Promise.all(this._$promises).then((()=>{if(at(this._$promises),"develop"===t){const e=location.search.slice(1).split("&")[0];if(!e)return;t=`${location.origin}/${e}`}if(!t)return;"/"===t.charAt(1)&&(t=t.slice(1)),e&&"base"in e||!(t.indexOf("//")>-1)||(this._$player.base=t),this._$player.setOptions(e),this._$player._$initialize();const i=new $e;i.contentLoaderInfo.addEventListener(Bt.IO_ERROR,(t=>{t.target&&t.target.removeEventListener(Bt.IO_ERROR,t.listener),alert("Error: "+t.text)})),i.contentLoaderInfo.addEventListener(wt.COMPLETE,(t=>{const e=t.target,i=this._$player;if(e.removeEventListener(wt.COMPLETE,t.listener),e._$data){const t=e._$data.stage;i.bgColor=t.bgColor,i._$setBackgroundColor(t.bgColor),i.stage.addChild(e.content),i.width=t.width,i.height=t.height,i.stage._$frameRate=$t(+t.fps,1,60,60)}i._$resize()})),i.load(new Mt(t))}))}createRootMovieClip(t=240,e=240,i=24,s=null){return r=this,n=void 0,h=function*(){return Promise.all(this._$promises).then((()=>{at(this._$promises);const r=this._$player;r.width=0|t,r.height=0|e,r.mode="create",r.stage._$frameRate=0|i,r.setOptions(s),r._$initialize();const n=r.stage.addChild(new ce);return r._$loadStatus=gs.LOAD_END,r.play(),n}))},new((a=void 0)||(a=Promise))((function(t,e){function i(t){try{o(h.next(t))}catch(t){e(t)}}function s(t){try{o(h.throw(t))}catch(t){e(t)}}function o(e){var r;e.done?t(e.value):(r=e.value,r instanceof a?r:new a((function(t){t(r)}))).then(i,s)}o((h=h.apply(r,n||[])).next())}));var r,n,a,h}}([new Promise((t=>{if("loading"===document.readyState){const e=()=>{window.removeEventListener("DOMContentLoaded",e),Br().then((()=>{ar()._$initializeCanvas(),t()}))};window.addEventListener("DOMContentLoaded",e)}else Br().then((()=>{ar()._$initializeCanvas(),t()}))}))]))})();
|
|
1
|
+
(()=>{"use strict";let t=0;const e=()=>t++;let i=0,s=null;const r=(t=null)=>{s=t};let n="";const a=t=>{n=t};let h=null;const o=()=>h,l=(t=null)=>{h=t};let c=1;const _=()=>c,$=window,u=$.document,d=RegExp;class g{constructor(t="",e=""){this._$name=`${t}`,this._$value=`${e}`}static toString(){return"[class URLRequestHeader]"}static get namespace(){return"next2d.net.URLRequestHeader"}toString(){return"[object URLRequestHeader]"}get namespace(){return"next2d.net.URLRequestHeader"}get name(){return this._$name}get value(){return this._$value}}let f=1,p=0,m=!1;const x=(t=!0)=>{m=t},b=1/0,v=Math,T=Array,y=Map,E=Number,A=Float32Array,M=Int32Array,S=Int16Array,w=OffscreenCanvas,C=isNaN,F=requestAnimationFrame,R=cancelAnimationFrame,B=performance,I=setTimeout,L=clearTimeout,P=new A([1,0,0,1,0,0]),O=new A([1,1,1,1,0,0,0,0]),k=-32768,N=32767,D=v.PI/180,U=180/v.PI,V=[],G=[],z=[],Y=[],X=[],q=[],H=[],j=[],W=new w(1,1).getContext("2d"),K=(t=0,e=0,i=0,s=0)=>{const r=j.pop()||{xMin:0,xMax:0,yMin:0,yMax:0};return r.xMin=t,r.xMax=e,r.yMin=i,r.yMax=s,r},Q=t=>{j.push(t)},J=(t=0,e=0,i=0,s=0)=>{const r=G.pop()||new A(4);return r[0]=t,r[1]=e,r[2]=i,r[3]=s,r},Z=t=>{G.push(t)},tt=(t=0,e=0,i=0,s=0,r=0,n=0)=>{const a=z.pop()||new A(6);return a[0]=t,a[1]=e,a[2]=i,a[3]=s,a[4]=r,a[5]=n,a},et=t=>{z.push(t)},it=(t=1,e=1,i=1,s=1,r=0,n=0,a=0,h=0)=>{const o=Y.pop()||new A(8);return o[0]=t,o[1]=e,o[2]=i,o[3]=s,o[4]=r,o[5]=n,o[6]=a,o[7]=h,o},st=t=>{Y.push(t)},rt=(t=0,e=0,i=0,s=0,r=0,n=0,a=0,h=0,o=0)=>{const l=X.pop()||new A(9);return l[0]=t,l[1]=e,l[2]=i,l[3]=s,l[4]=r,l[5]=n,l[6]=a,l[7]=h,l[8]=o,l},nt=(...t)=>{const e=q.pop()||[];return t.length&&e.push(...t),e},at=(t=null)=>{t&&(t.length&&(t.length=0),q.push(t))},ht=t=>{t.size&&t.clear(),H.push(t)},ot=()=>H.pop()||new y,lt=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t),ct=t=>{const e=-819.2*t[0]-819.2*t[2]+t[4],i=819.2*t[0]-819.2*t[2]+t[4],s=-819.2*t[0]+819.2*t[2]+t[4],r=-819.2*t[1]-819.2*t[3]+t[5],n=819.2*t[1]-819.2*t[3]+t[5];let a=s-e,h=-819.2*t[1]+819.2*t[3]+t[5]-r;const o=v.sqrt(a*a+h*h);o?(a/=o,h/=o):(a=0,h=0);const l=(i-e)*a+(n-r)*h;return J(e+l*a,r+l*h,i,n)},_t=t=>{const e=1/(t[0]*t[4]-t[3]*t[1]),i=t[3]*t[7]-t[4]*t[6],s=t[1]*t[6]-t[0]*t[7];return rt(t[4]*e,0-t[1]*e,0,0-t[3]*e,t[0]*e,0,i*e,s*e,1)},$t=(t,e,i,s=null)=>{const r=+t;return C(r)&&null!==s?s:v.min(v.max(e,C(r)?0:r),i)},ut=(t,e)=>tt(t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]),dt=(t,e)=>it(t[0]*e[0],t[1]*e[1],t[2]*e[2],t[3]*e[3],t[0]*e[4]+t[4],t[1]*e[5]+t[5],t[2]*e[6]+t[6],t[3]*e[7]+t[7]),gt=(t,e)=>{const i=t.xMax*e[0]+t.yMax*e[2]+e[4],s=t.xMax*e[0]+t.yMin*e[2]+e[4],r=t.xMin*e[0]+t.yMax*e[2]+e[4],n=t.xMin*e[0]+t.yMin*e[2]+e[4],a=t.xMax*e[1]+t.yMax*e[3]+e[5],h=t.xMax*e[1]+t.yMin*e[3]+e[5],o=t.xMin*e[1]+t.yMax*e[3]+e[5],l=t.xMin*e[1]+t.yMin*e[3]+e[5],c=v.min(E.MAX_VALUE,i,s,r,n),_=v.max(0-E.MAX_VALUE,i,s,r,n),$=v.min(E.MAX_VALUE,a,h,o,l),u=v.max(0-E.MAX_VALUE,a,h,o,l);return K(c,_,$,u)},ft=t=>{if(!W)return 0;W.fillStyle=t;const e=+`0x${W.fillStyle.slice(1)}`;return W.fillStyle="rgba(0, 0, 0, 1)",e},pt=t=>C(+t)?ft(`${t}`):+t,mt=t=>({A:t>>>24,R:(16711680&t)>>16,G:(65280&t)>>8,B:255&t}),xt=(t,e,i)=>(t>>16)*(i?e:1)/255,bt=(t,e,i)=>(t>>8&255)*(i?e:1)/255,vt=(t,e,i)=>(255&t)*(i?e:1)/255,Tt=(t,e=1)=>({R:(16711680&t)>>16,G:(65280&t)>>8,B:255&t,A:255*e}),yt=(t,e,i=!1,s=!1)=>{let r="";return i&&(r="italic "),s&&(r+="bold "),`${r}${e}px '${t}','sans-serif'`},Et=t=>{t.color&&st(t.color),t.isLayer=!1,t.isUpdated=null,t.canApply=null,t.matrix=null,t.color=null,t.filters=null,t.blendMode="normal",t.sw=0,t.sh=0,V.push(t)};new Map([[1,"normal"],[2,"layer"],[3,"multiply"],[4,"screen"],[5,"lighten"],[6,"darken"],[7,"difference"],[8,"add"],[9,"subtract"],[10,"invert"],[11,"alpha"],[12,"erase"],[13,"overlay"],[14,"hardlight"]]);const At=new class{constructor(){this._$pool=[],this._$store=new Map,this._$timerMap=new Map,this._$context=null}set context(t){this._$context=t}reset(){for(const t of this._$store.values()){for(const e of t.values())this.destroy(e);ht(t)}this._$store.clear(),this._$context&&this._$context.frameBuffer.clearCache()}destroy(t=null){if(t&&"object"==typeof t)if(t instanceof WebGLTexture)F((()=>{this._$context&&this._$context.frameBuffer.releaseTexture(t)}));else{if("canvas"in t&&t instanceof CanvasRenderingContext2D){const e=t.canvas,i=e.width,s=e.height;t.clearRect(0,0,i+1,s+1),e.width=e.height=1,this._$pool.push(e)}this._$context&&"index"in t&&this._$context.frameBuffer.textureManager.releasePosition(t)}}getCanvas(){return this._$pool.pop()||document.createElement("canvas")}remove(t,e){if(!this._$store.has(t))return;const i=this._$store.get(t);i.has(e)&&(i.delete(e),i.size||(ht(i),this._$store.delete(t)))}stopTimer(t){t=`${t}`,this._$timerMap.has(t)&&(L(this._$timerMap.get(t)),this._$timerMap.delete(t))}removeCache(t){if(t=`${t}`,this._$store.has(t)){const e=this._$store.get(t);for(const t of e.values())this.destroy(t);e.clear(),ht(e),this._$store.delete(t)}this._$timerMap.delete(t)}setRemoveTimer(t){if(t=`${t}`,this.stopTimer(t),this._$store.has(t)){const e=I((()=>{this.removeCache(t)}),5e3);this._$timerMap.set(t,e)}}get(t){const e=`${t[0]}`,i=`${t[1]}`;if(this._$store.has(e)){this.stopTimer(e);const t=this._$store.get(e);if(t.has(i))return t.get(i)}return null}set(t,e=null){const i=`${t[0]}`,s=`${t[1]}`;this._$store.has(i)||this._$store.set(i,ot());const r=this._$store.get(i);if(null===e){if(!r.has(s))return;return this.destroy(r.get(s)),r.delete(s),void(r.size||(ht(r),this._$store.delete(i)))}r.set(s,e)}has(t){const e=`${t[0]}`;return!!this._$store.has(e)&&this._$store.get(e).has(`${t[1]}`)}generateKeys(t,e=null,i=null){let s="";e&&e.length&&(s+=`${e[0]}_${e[1]}`),i&&i.length&&(s+=0===i[7]?"":`_${i[7]}`);const r=nt();if(s){let t=0;const e=s.length;for(let i=0;i<e;i++)t=(t<<5)-t+s.charCodeAt(i),t|=0;r[1]=`_${t}`}else r[1]="_0";return r[0]=`${t}`,r}};class Mt{constructor(t=""){this._$url=`${t}`,this._$contentType="application/json",this._$data="",this._$method="GET",this._$requestHeaders=nt(),this._$responseDataFormat="json",this._$withCredentials=!1}static toString(){return"[class URLRequest]"}static get namespace(){return"next2d.net.URLRequest"}toString(){return"[object URLRequest]"}get namespace(){return"next2d.net.URLRequest"}get contentType(){return this._$contentType}set contentType(t){this._$contentType=`${t}`}get data(){return this._$data}set data(t){this._$data=t}get method(){return this._$method}set method(t){this._$method=`${t}`}get requestHeaders(){return this._$requestHeaders}set requestHeaders(t){this._$requestHeaders.length=0,this._$requestHeaders.push(...t)}get url(){if(this._$url&&-1===this._$url.indexOf("//")){const t=this._$url.split("/");""!==t[0]&&"."!==t[0]||t.shift();const e=ar();if(e)return`${e.base}${t.join("/")}`}return this._$url}set url(t){this._$url=`${t}`}get responseDataFormat(){return this._$responseDataFormat}set responseDataFormat(t){this._$responseDataFormat=`${t}`}get withCredentials(){return this._$withCredentials}set withCredentials(t){this._$withCredentials=t}get headers(){const t=nt();return t.push(new g("Content-Type",`${this._$contentType}`)),this._$requestHeaders.length&&t.push(...this._$requestHeaders),t}}class St{static toString(){return"[class EventPhase]"}static get namespace(){return"next2d.events.EventPhase"}toString(){return"[object EventPhase]"}get namespace(){return"next2d.events.EventPhase"}static get AT_TARGET(){return 2}static get BUBBLING_PHASE(){return 3}static get CAPTURING_PHASE(){return 1}}class wt{constructor(t,e=!1,i=!1){this._$type=`${t}`,this._$bubbles=e,this._$cancelable=i,this._$target=null,this._$currentTarget=null,this._$eventPhase=St.AT_TARGET,this._$listener=null,this._$stopImmediatePropagation=!1,this._$stopPropagation=!1}static toString(){return"[class Event]"}static get namespace(){return"next2d.events.Event"}toString(){return this.formatToString("Event","type","bubbles","cancelable","eventPhase")}get namespace(){return"next2d.events.Event"}static get ACTIVATE(){return"activate"}static get ADDED(){return"added"}static get ADDED_TO_STAGE(){return"addedToStage"}static get CHANGE(){return"change"}static get COMPLETE(){return"complete"}static get DEACTIVATE(){return"deactivate"}static get ENTER_FRAME(){return"enterFrame"}static get EXIT_FRAME(){return"exitFrame"}static get FRAME_CONSTRUCTED(){return"frameConstructed"}static get FRAME_LABEL(){return"frameLabel"}static get INIT(){return"init"}static get LOAD(){return"load"}static get MOUSE_LEAVE(){return"mouseLeave"}static get REMOVED(){return"removed"}static get REMOVED_FROM_STAGE(){return"removedFromStage"}static get RENDER(){return"render"}static get RESIZE(){return"resize"}static get SCROLL(){return"scroll"}static get OPEN(){return"open"}static get STOP(){return"stop"}static get SOUND_COMPLETE(){return"soundComplete"}static get UPDATE(){return"update"}get bubbles(){return this._$bubbles}get cancelable(){return this._$cancelable}get currentTarget(){return this._$currentTarget}set currentTarget(t){this._$currentTarget=t}get eventPhase(){return this._$eventPhase}set eventPhase(t){this._$eventPhase=t}get listener(){return this._$listener}set listener(t){this._$listener=t}get target(){return this._$target?this._$target:this._$currentTarget}set target(t){this._$target=t}get type(){return this._$type}formatToString(...t){let e=`[${t[0]}`;for(let i=1;i<t.length;++i){const s=t[i];e+=` ${s}=`;const r=this[s];e+="string"==typeof r?`"${r}"`:`${r}`}return`${e}]`}stopImmediatePropagation(){this._$stopImmediatePropagation=!0}stopPropagation(){this._$stopPropagation=!0}}class Ct{constructor(){this._$events=null}static toString(){return"[class EventDispatcher]"}static get namespace(){return"next2d.events.EventDispatcher"}toString(){return"[object EventDispatcher]"}get namespace(){return"next2d.events.EventDispatcher"}addEventListener(t,e,i=!1,s=0){const r=ar();let n,a=!1;switch(t=`${t}`){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":r.broadcastEvents.size&&r.broadcastEvents.has(t)||r.broadcastEvents.set(t,nt()),n=r.broadcastEvents.get(t)||nt(),a=!0;break;default:this._$events||(this._$events=ot()),this._$events.size&&this._$events.has(t)||this._$events.set(t,nt()),n=this._$events.get(t)||nt()}let h=n.length;for(let t=0;t<h;++t){const s=n[t];i===s.useCapture&&s.target===this&&s.listener===e&&(h=t)}n[h]={listener:e,priority:s,useCapture:i,target:this},n.length>1&&n.sort((function(t,e){switch(!0){case t.priority>e.priority:return-1;case t.priority<e.priority:return 1;default:return 0}})),a?r.broadcastEvents.set(t,n):(this._$events||(this._$events=ot()),this._$events.set(t,n))}dispatchEvent(t){switch(t.type){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":{const e=ar();if(e&&e.broadcastEvents.size&&e.broadcastEvents.has(t.type)){const i=e.broadcastEvents.get(t.type);for(let e=0;e<i.length;++e){const s=i[e];if(s.target===this){t.eventPhase=St.AT_TARGET,t.currentTarget=s.target;try{t.listener=s.listener,s.listener.call(null,t)}catch(t){return console.error(t),!1}}}return!0}}break;default:{let e=null;this._$events&&this._$events.size&&this._$events.has(t.type)&&(e=this._$events.get(t.type),e&&(e=e.slice(0))),e||(e=nt());const i=nt();if("parent"in this){let e=this.parent;for(;e;){if(e.hasEventListener(t.type)){const s=e._$events?e._$events.get(t.type):void 0;s&&i.push(s)}e=e.parent}}if(t.target=this,e.length||i.length){if(t.eventPhase=St.CAPTURING_PHASE,i.length)switch(!0){case t._$stopImmediatePropagation:case t._$stopPropagation:break;default:i.reverse();for(let e=0;e<i.length;++e){const s=i[e];for(let e=0;e<s.length;++e){const i=s[e];if(i.useCapture){t.currentTarget=i.target,r(i.target.loaderInfo);try{t.listener=i.listener,i.listener.call(null,t)}catch(t){return console.error(t),!1}if(t._$stopImmediatePropagation)break}}if(t._$stopImmediatePropagation)break}i.reverse()}if(t.eventPhase=St.AT_TARGET,!t._$stopImmediatePropagation&&!t._$stopPropagation){const i=e.length;for(let s=0;s<i;++s){const i=e[s];if(!i.useCapture){t.currentTarget=i.target,r(i.target.loaderInfo);try{t.listener=i.listener,i.listener.call(null,t)}catch(t){return console.error(t),!1}if(t._$stopImmediatePropagation)break}}}switch(t.eventPhase=St.BUBBLING_PHASE,!0){case t._$stopImmediatePropagation:case t._$stopPropagation:case!t.bubbles:break;default:for(let e=0;e<i.length;++e){const s=i[e];for(let e=0;e<s.length;++e){const i=s[e];if(!i.useCapture){t.currentTarget=i.target,r(i.target.loaderInfo);try{t.listener=i.listener,i.listener.call(null,t)}catch(t){return console.error(t),!1}if(t._$stopImmediatePropagation)break}}if(t._$stopImmediatePropagation)break}}return at(e),at(i),!0}at(e),at(i)}}return!1}hasEventListener(t){switch(t=`${t}`){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":{const e=ar();if(e&&e.broadcastEvents.size&&e.broadcastEvents.has(t)){const i=e.broadcastEvents.get(t)||nt();for(let t=0;t<i.length;t++)if(i[t].target===this)return!0}return!1}default:return!!(this._$events&&this._$events.size&&this._$events.has(t))}}removeEventListener(t,e,i=!1){if(!e)return;if(t=`${t}`,!this.hasEventListener(t))return;const s=ar();let r=null,n=!1;switch(t){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":n=!0,s&&(r=s.broadcastEvents.get(t)||nt());break;default:this._$events&&this._$events.size&&this._$events.has(t)&&(r=this._$events.get(t)||nt())}if(r){for(let t=0;t<r.length;++t){const s=r[t];if(i===s.useCapture&&s.listener===e){r.splice(t,1);break}}if(r.length)r.length>1&&r.sort((function(t,e){switch(!0){case t.priority>e.priority:return-1;case t.priority<e.priority:return 1;default:return 0}})),n?s.broadcastEvents.set(t,r):(this._$events||(this._$events=ot()),this._$events.set(t,r));else if(n)s.broadcastEvents.delete(t);else{if(!this._$events)return;this._$events.delete(t),this._$events.size||(ht(this._$events),this._$events=null)}}}removeAllEventListener(t,e=!1){if(t=`${t}`,!this.hasEventListener(t))return;const i=ar();let s=null,r=!1;switch(t){case wt.ENTER_FRAME:case wt.EXIT_FRAME:case wt.FRAME_CONSTRUCTED:case wt.RENDER:case wt.ACTIVATE:case wt.DEACTIVATE:case"keyDown":case"keyUp":r=!0,i&&(s=i.broadcastEvents.get(t)||nt());break;default:this._$events&&this._$events.size&&this._$events.has(t)&&(s=this._$events.get(t)||nt())}if(!s)return;const n=nt();for(let t=0;t<s.length;++t){const i=s[t];e!==i.useCapture&&n.push(i)}if(n.length)n.length>1&&n.sort((function(t,e){switch(!0){case t.priority>e.priority:return-1;case t.priority<e.priority:return 1;default:return 0}})),r?i.broadcastEvents.set(t,n):(this._$events||(this._$events=ot()),this._$events.set(t,n));else if(r)i.broadcastEvents.delete(t);else{if(!this._$events)return;this._$events.delete(t),this._$events.size||(ht(this._$events),this._$events=null)}}willTrigger(t){if(this.hasEventListener(t))return!0;if("parent"in this){let e=this.parent;for(;e;){if(e.hasEventListener(t))return!0;e=e.parent}}return!1}}class Ft extends wt{constructor(t,e=!0,i=!1){super(t,e,i)}static toString(){return"[class FocusEvent]"}static get namespace(){return"next2d.events.FocusEvent"}toString(){return this.formatToString("FocusEvent","type","bubbles","cancelable","eventPhase")}get namespace(){return"next2d.events.FocusEvent"}static get FOCUS_IN(){return"focusIn"}static get FOCUS_OUT(){return"focusOut"}}class Rt extends wt{constructor(t,e=!1,i=!1,s=0,r="",n=[]){super(t,e,i),this._$status=0|s,this._$responseHeaders=n,this._$responseURL=r}static toString(){return"[class HTTPStatusEvent]"}static get namespace(){return"next2d.events.HTTPStatusEvent"}toString(){return this.formatToString("HTTPStatusEvent","type","bubbles","cancelable","eventPhase","status","responseURL")}get namespace(){return"next2d.events.HTTPStatusEvent"}static get HTTP_STATUS(){return"httpStatus"}get responseHeaders(){return this._$responseHeaders}get responseURL(){return this._$responseURL}get status(){return this._$status}}class Bt extends wt{constructor(t,e=!1,i=!1,s=""){super(t,e,i),this._$text=`${s}`}static toString(){return"[class IOErrorEvent]"}static get namespace(){return"next2d.events.IOErrorEvent"}toString(){return this.formatToString("IOErrorEvent","type","bubbles","cancelable","eventPhase","text")}get namespace(){return"next2d.events.IOErrorEvent"}static get IO_ERROR(){return"ioError"}get text(){return this._$text}}class It extends wt{constructor(t,e=!0,i=!1){return super(t,e,i),new Proxy(this,{get:(t,e)=>{if(e in t)return t[e];const i=o();return i&&e in i?i[e]:void 0}})}static toString(){return"[class MouseEvent]"}static get namespace(){return"next2d.events.MouseEvent"}toString(){return this.formatToString("MouseEvent","type","bubbles","cancelable","eventPhase","localX","localY","stageX","stageY","ctrlKey","altKey","shiftKey","buttonDown","delta","commandKey","controlKey","clickCount")}get namespace(){return"next2d.events.MouseEvent"}static get CLICK(){return"click"}static get DOUBLE_CLICK(){return"dblclick"}static get MOUSE_DOWN(){return"mouseDown"}static get MOUSE_MOVE(){return"mouseMove"}static get MOUSE_OUT(){return"mouseOut"}static get MOUSE_OVER(){return"mouseOver"}static get MOUSE_UP(){return"mouseUp"}static get MOUSE_WHEEL(){return"mouseWheel"}static get ROLL_OUT(){return"rollOut"}static get ROLL_OVER(){return"rollOver"}}class Lt extends wt{constructor(t,e=!1,i=!1,s=0,r=0){super(t,e,i),this._$bytesLoaded=0|s,this._$bytesTotal=0|r}static toString(){return"[class ProgressEvent]"}static get namespace(){return"next2d.events.ProgressEvent"}toString(){return this.formatToString("ProgressEvent","type","bubbles","cancelable","eventPhase","bytesLoaded","bytesTotal")}get namespace(){return"next2d.events.ProgressEvent"}static get PROGRESS(){return"progress"}get bytesLoaded(){return this._$bytesLoaded}get bytesTotal(){return this._$bytesTotal}}class Pt extends wt{constructor(t,e=!1,i=!1,s=0,r=0){super(t,e,i),this._$bytesLoaded=0|s,this._$bytesTotal=0|r}static toString(){return"[class VideoEvent]"}static get namespace(){return"next2d.events.VideoEvent"}toString(){return this.formatToString("VideoEvent","type","bubbles","cancelable","eventPhase","bytesLoaded","bytesTotal")}get namespace(){return"next2d.events.VideoEvent"}static get PROGRESS(){return"progress"}static get PLAY(){return"play"}static get PLAY_START(){return"playStart"}static get PLAY_END(){return"playEnd"}static get PAUSE(){return"pause"}static get SEEK(){return"seek"}get bytesLoaded(){return this._$bytesLoaded}get bytesTotal(){return this._$bytesTotal}}class Ot{constructor(t=1,e=1,i=1,s=1,r=0,n=0,a=0,h=0){this._$colorTransform=it(),this.redMultiplier=t,this.greenMultiplier=e,this.blueMultiplier=i,this.alphaMultiplier=s,this.redOffset=r,this.greenOffset=n,this.blueOffset=a,this.alphaOffset=h}static toString(){return"[class ColorTransform]"}static get namespace(){return"next2d.geom.ColorTransform"}toString(){return"(redMultiplier="+this._$colorTransform[0]+", greenMultiplier="+this._$colorTransform[1]+", blueMultiplier="+this._$colorTransform[2]+", alphaMultiplier="+this._$colorTransform[3]+", redOffset="+this._$colorTransform[4]+", greenOffset="+this._$colorTransform[5]+", blueOffset="+this._$colorTransform[6]+", alphaOffset="+this._$colorTransform[7]+")"}get namespace(){return"next2d.geom.ColorTransform"}get alphaMultiplier(){return this._$colorTransform[3]}set alphaMultiplier(t){this._$colorTransform[3]=$t(+t,0,1,0)}get alphaOffset(){return this._$colorTransform[7]}set alphaOffset(t){this._$colorTransform[7]=$t(0|t,-255,255,0)}get blueMultiplier(){return this._$colorTransform[2]}set blueMultiplier(t){this._$colorTransform[2]=$t(+t,0,1,0)}get blueOffset(){return this._$colorTransform[6]}set blueOffset(t){this._$colorTransform[6]=$t(0|t,-255,255,0)}get greenMultiplier(){return this._$colorTransform[1]}set greenMultiplier(t){this._$colorTransform[1]=$t(+t,0,1,0)}get greenOffset(){return this._$colorTransform[5]}set greenOffset(t){this._$colorTransform[5]=$t(0|t,-255,255,0)}get redMultiplier(){return this._$colorTransform[0]}set redMultiplier(t){this._$colorTransform[0]=$t(+t,0,1,0)}get redOffset(){return this._$colorTransform[4]}set redOffset(t){this._$colorTransform[4]=$t(0|t,-255,255,0)}concat(t){const e=dt(this._$colorTransform,t._$colorTransform);this.redMultiplier=e[0],this.greenMultiplier=e[1],this.blueMultiplier=e[2],this.alphaMultiplier=e[3],this.redOffset=e[4],this.greenOffset=e[5],this.blueOffset=e[6],this.alphaOffset=e[7],st(e)}_$clone(){return cr(this._$colorTransform[0],this._$colorTransform[1],this._$colorTransform[2],this._$colorTransform[3],this._$colorTransform[4],this._$colorTransform[5],this._$colorTransform[6],this._$colorTransform[7])}}class kt{constructor(t=0,e=0){this._$x=0,this._$y=0,this.x=t,this.y=e}static toString(){return"[class Point]"}static get namespace(){return"next2d.geom.Point"}toString(){return`(x=${this.x}, y=${this.y})`}get namespace(){return"next2d.geom.Point"}get length(){return v.sqrt(v.pow(this.x,2)+v.pow(this.y,2))}get x(){return this._$x}set x(t){this._$x=$t(+t,k,N,0)}get y(){return this._$y}set y(t){this._$y=$t(+t,k,N,0)}add(t){return new kt(this.x+t.x,this.y+t.y)}clone(){return new kt(this.x,this.y)}copyFrom(t){this._$x=t._$x,this._$y=t._$y}static distance(t,e){return v.sqrt(v.pow(t._$x-e._$x,2)+v.pow(t._$y-e._$y,2))}equals(t){return this._$x===t._$x&&this._$y===t._$y}static interpolate(t,e,i){return new kt(t.x+(e.x-t.x)*(1-i),t.y+(e.y-t.y)*(1-i))}normalize(t){const e=this.length;this.x=this.x*t/e,this.y=this.y*t/e}offset(t,e){this.x+=t,this.y+=e}static polar(t,e){return new kt(t*v.cos(e),t*v.sin(e))}setTo(t,e){this.x=t,this.y=e}subtract(t){return new kt(this.x-t.x,this.y-t.y)}}class Nt{constructor(t=1,e=0,i=0,s=1,r=0,n=0){this._$matrix=tt(1,0,0,1,0,0),this.a=t,this.b=e,this.c=i,this.d=s,this.tx=r,this.ty=n}static toString(){return"[class Matrix]"}static get namespace(){return"next2d.geom.Matrix"}toString(){return`(a=${this.a}, b=${this.b}, c=${this.c}, d=${this.d}, tx=${this.tx}, ty=${this.ty})`}get namespace(){return"next2d.geom.Matrix"}get a(){return this._$matrix[0]}set a(t){this._$matrix[0]=$t(+t,k,N,0)}get b(){return this._$matrix[1]}set b(t){this._$matrix[1]=$t(+t,k,N,0)}get c(){return this._$matrix[2]}set c(t){this._$matrix[2]=$t(+t,k,N,0)}get d(){return this._$matrix[3]}set d(t){this._$matrix[3]=$t(+t,k,N,0)}get tx(){return this._$matrix[4]}set tx(t){this._$matrix[4]=$t(+t,k,N,0)}get ty(){return this._$matrix[5]}set ty(t){this._$matrix[5]=$t(+t,k,N,0)}_$clone(){return this.clone()}clone(){return or(this._$matrix[0],this._$matrix[1],this._$matrix[2],this._$matrix[3],this._$matrix[4],this._$matrix[5])}concat(t){const e=this._$matrix,i=t._$matrix;let s=e[0]*i[0],r=0,n=0,a=e[3]*i[3],h=e[4]*i[0]+i[4],o=e[5]*i[3]+i[5];(e[1]||e[2]||i[1]||i[2])&&(s+=e[1]*i[2],a+=e[2]*i[1],r+=e[0]*i[1]+e[1]*i[3],n+=e[2]*i[0]+e[3]*i[2],h+=e[5]*i[2],o+=e[4]*i[1]),this.a=s,this.b=r,this.c=n,this.d=a,this.tx=h,this.ty=o}copyFrom(t){this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty}createBox(t,e,i=0,s=0,r=0){this.identity(),this.rotate(i),this.scale(t,e),this.translate(s,r)}createGradientBox(t,e,i=0,s=0,r=0){this.createBox(t/1638.4,e/1638.4,i,s+t/2,r+e/2)}deltaTransformPoint(t){return new kt(t.x*this._$matrix[0]+t.y*this._$matrix[2],t.x*this._$matrix[1]+t.y*this._$matrix[3])}identity(){this._$matrix[0]=1,this._$matrix[1]=0,this._$matrix[2]=0,this._$matrix[3]=1,this._$matrix[4]=0,this._$matrix[5]=0}invert(){const t=this._$matrix[0],e=this._$matrix[1],i=this._$matrix[2],s=this._$matrix[3],r=this._$matrix[4],n=this._$matrix[5];if(0===e&&0===i)this.a=1/t,this.b=0,this.c=0,this.d=1/s,this.tx=-this.a*r,this.ty=-this.d*n;else{const a=t*s-e*i;if(a){const h=1/a;this.a=s*h,this.b=-e*h,this.c=-i*h,this.d=t*h,this.tx=-(this.a*r+this.c*n),this.ty=-(this.b*r+this.d*n)}}}rotate(t){const e=this._$matrix[0],i=this._$matrix[1],s=this._$matrix[2],r=this._$matrix[3],n=this._$matrix[4],a=this._$matrix[5];this.a=e*v.cos(t)-i*v.sin(t),this.b=e*v.sin(t)+i*v.cos(t),this.c=s*v.cos(t)-r*v.sin(t),this.d=s*v.sin(t)+r*v.cos(t),this.tx=n*v.cos(t)-a*v.sin(t),this.ty=n*v.sin(t)+a*v.cos(t)}scale(t,e){this.a*=t,this.c*=t,this.tx*=t,this.b*=e,this.d*=e,this.ty*=e}setTo(t,e,i,s,r,n){this.a=t,this.b=e,this.c=i,this.d=s,this.tx=r,this.ty=n}transformPoint(t){return new kt(t.x*this._$matrix[0]+t.y*this._$matrix[2]+this._$matrix[4],t.x*this._$matrix[1]+t.y*this._$matrix[3]+this._$matrix[5])}translate(t,e){this.tx+=t,this.ty+=e}}class Dt{constructor(t=0,e=0,i=0,s=0){this._$x=0,this._$y=0,this._$width=0,this._$height=0,this.setTo(t,e,i,s)}static toString(){return"[class Rectangle]"}static get namespace(){return"next2d.geom.Rectangle"}toString(){return`(x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height})`}get namespace(){return"next2d.geom.Rectangle"}get bottom(){return this.y+this.height}set bottom(t){this.height=+t-this.y}get bottomRight(){return new kt(this.right,this.bottom)}set bottomRight(t){this.right=t.x,this.bottom=t.y}get height(){return this._$height}set height(t){this._$height=$t(+t,k,N,0)}get left(){return this.x}set left(t){this.width=this.right-+t,this.x=t}get right(){return this.x+this.width}set right(t){this.width=+t-this.x}get size(){return new kt(this.width,this.height)}set size(t){this.width=t.x,this.height=t.y}get top(){return this.y}set top(t){this.height=+(this.bottom-+t),this.y=t}get topLeft(){return new kt(this.x,this.y)}set topLeft(t){this.left=t.x,this.top=t.y}get width(){return this._$width}set width(t){this._$width=$t(+t,k,N,0)}get x(){return this._$x}set x(t){this._$x=$t(+t,k,N,0)}get y(){return this._$y}set y(t){this._$y=$t(+t,k,N,0)}clone(){return new Dt(this.x,this.y,this.width,this.height)}contains(t,e){return this.x<=t&&this.y<=e&&this.right>t&&this.bottom>e}containsPoint(t){return this.x<=t.x&&this.y<=t.y&&this.right>t.x&&this.bottom>t.y}containsRect(t){return this.x<=t.x&&this.y<=t.y&&this.right>=t.right&&this.bottom>=t.bottom}copyFrom(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}inflate(t,e){this.x=this.x-+t,this.width=this.width+2*+t,this.y=this.y-+e,this.height=this.height+2*+e}inflatePoint(t){this.x=this.x-t.x,this.width=this.width+2*t.x,this.y=this.y-t.y,this.height=this.height+2*t.y}intersection(t){const e=v.max(this.x,t.x),i=v.max(this.y,t.y),s=v.min(this.right,t.right)-e,r=v.min(this.bottom,t.bottom)-i;return s>0&&r>0?new Dt(e,i,s,r):new Dt(0,0,0,0)}intersects(t){const e=v.max(this.x,t.x),i=v.max(this.y,t.y),s=v.min(this.right,t.right),r=v.min(this.bottom,t.bottom);return s-e>0&&r-i>0}isEmpty(){return this.width<=0||this.height<=0}offset(t,e){this.x+=t,this.y+=e}offsetPoint(t){this.x+=t.x,this.y+=t.y}setEmpty(){this._$x=0,this._$y=0,this._$width=0,this._$height=0}setTo(t,e,i,s){this.x=t,this.y=e,this.width=i,this.height=s}union(t){return this.isEmpty()?t.clone():t.isEmpty()?this.clone():new Dt(v.min(this.x,t.x),v.min(this.y,t.y),v.max(this.right-t.left,t.right-this.left),v.max(this.bottom-t.top,t.bottom-this.top))}}class Ut{constructor(){this._$updated=!0}static toString(){return"[class BitmapFilter]"}static get namespace(){return"next2d.filters.BitmapFilter"}toString(){return"[object BitmapFilter]"}get namespace(){return"next2d.filters.BitmapFilter"}_$isUpdated(){return this._$updated}_$doChanged(){this._$updated=!0,x()}}class Vt extends Ut{constructor(t=4,e=4,i=1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this.blurX=t,this.blurY=e,this.quality=i}static toString(){return"[class BlurFilter]"}static get namespace(){return"next2d.filters.BlurFilter"}toString(){return"[object BlurFilter]"}get namespace(){return"next2d.filters.BlurFilter"}static get STEP(){return[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5]}get blurX(){return this._$blurX}set blurX(t){(t=$t(+t,0,255,0))!==this._$blurX&&(this._$blurX=t,this._$doChanged())}get blurY(){return this._$blurY}set blurY(t){(t=$t(+t,0,255,0))!==this._$blurY&&(this._$blurY=t,this._$doChanged())}get quality(){return this._$quality}set quality(t){(t=$t(0|t,0,15,1))!==this._$quality&&(this._$quality=t,this._$doChanged())}clone(){return new Vt(this._$blurX,this._$blurY,this._$quality)}_$toArray(){return nt(1,this._$blurX,this._$blurY,this._$quality)}_$generateFilterRect(t,e=0,i=0){const s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$quality)return s;const r=Vt.STEP[this._$quality-1];let n=0>=this._$blurX?1:this._$blurX*r,a=0>=this._$blurY?1:this._$blurY*r;return e?n*=e:n=v.round(n),i?a*=i:a=v.round(a),s.xMin-=n,s.xMax+=2*n,s.yMin-=a,s.yMax+=2*a,s}_$canApply(){return 0!==this._$blurX&&0!==this._$blurY}_$applyFilter(t,e,i=!0){this._$updated=!1;const s=t.frameBuffer,r=s.currentAttachment,n=s.getTextureFromCurrentAttachment();if(!this._$canApply())return i?n:s.createTextureFromCurrentAttachment();let a=v.sqrt(e[0]*e[0]+e[1]*e[1]),h=v.sqrt(e[2]*e[2]+e[3]*e[3]);a/=f,h/=f,a*=2,h*=2;const o=K(0,n.width,0,n.height),l=this._$generateFilterRect(o,a,h);Q(o);const c=0|v.ceil(l.xMax),_=0|v.ceil(l.yMax),$=v.ceil(v.abs(l.xMin)+.5*v.abs(c-l.xMax)),u=v.ceil(v.abs(l.yMin)+.5*v.abs(_-l.yMax));t._$offsetX=$+t._$offsetX,t._$offsetY=u+t._$offsetY;const d=this._$blurX*a,g=this._$blurY*h;let p=1,m=1;d>128?p=.0625:d>64?p=.125:d>32?p=.25:d>16&&(p=.5),g>128?m=.0625:g>64?m=.125:g>32?m=.25:g>16&&(m=.5);const x=d*p,b=g*m,T=v.ceil(c*p),y=v.ceil(_*m),E=s.createTextureAttachment(T,y),A=[E,s.createTextureAttachment(T,y)];let M=0;t._$bind(E),t.reset(),t.setTransform(p,0,0,m,0,0),t.drawImage(n,$,u,n.width,n.height),t.blend.toOneZero();let S=s.getTextureFromCurrentAttachment();for(let e=0;e<this._$quality;++e){if(this._$blurX>0){M=(M+1)%2;const e=A[M];t._$bind(e),t._$applyBlurFilter(S,!0,x),S=s.getTextureFromCurrentAttachment()}if(this._$blurY>0){M=(M+1)%2;const e=A[M];t._$bind(e),t._$applyBlurFilter(S,!1,b),S=s.getTextureFromCurrentAttachment()}}if(t.blend.reset(),1!==p||1!==m){const e=s.createTextureAttachment(c,_);t._$bind(e),t.reset(),t.imageSmoothingEnabled=!0,t.setTransform(1/p,0,0,1/m,0,0),t.drawImage(S,0,0,T,y),S=s.getTextureFromCurrentAttachment(),t.reset(),t.setTransform(1,0,0,1,0,0),s.releaseAttachment(A[0],!0),s.releaseAttachment(A[1],!0),i?s.releaseAttachment(r,!0):s.releaseAttachment(e,!1)}else s.releaseAttachment(A[(M+1)%2],!0),i?s.releaseAttachment(r,!0):s.releaseAttachment(A[M],!1);return S}}class Gt extends Ut{constructor(t=4,e=45,i=16777215,s=1,r=0,n=1,a=4,h=4,o=1,l=1,c="inner",_=!1){super(),this._$blurFilter=new Vt(a,h,l),this._$distance=4,this._$angle=45,this._$highlightColor=16777215,this._$highlightAlpha=1,this._$shadowColor=0,this._$shadowAlpha=1,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.highlightColor=i,this.highlightAlpha=s,this.shadowColor=r,this.shadowAlpha=n,this.strength=o,this.type=c,this.knockout=_}static toString(){return"[class BevelFilter]"}static get namespace(){return"next2d.filters.BevelFilter"}toString(){return"[object BevelFilter]"}get namespace(){return"next2d.filters.BevelFilter"}get angle(){return this._$angle}set angle(t){(t%=360)!==this._$angle&&(this._$angle=$t(t,-360,360,45),this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get distance(){return this._$distance}set distance(t){(t=$t(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get highlightAlpha(){return this._$highlightAlpha}set highlightAlpha(t){(t=$t(+t,0,1,0))!==this._$highlightAlpha&&(this._$highlightAlpha=t,this._$doChanged())}get highlightColor(){return this._$highlightColor}set highlightColor(t){(t=$t(pt(t),0,16777215,16777215))!==this._$highlightColor&&(this._$highlightColor=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get shadowAlpha(){return this._$shadowAlpha}set shadowAlpha(t){(t=$t(+t,0,1,0))!==this._$shadowAlpha&&(this._$shadowAlpha=t,this._$doChanged())}get shadowColor(){return this._$shadowColor}set shadowColor(t){(t=$t(pt(t),0,16777215,0))!==this._$shadowColor&&(this._$shadowColor=t,this._$doChanged())}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){(t=`${t}`)!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new Gt(this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return nt(0,this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const r=this._$angle*D;let n=v.abs(v.cos(r)*this._$distance),a=v.abs(v.sin(r)*this._$distance);return e&&(n*=e),i&&(a*=i),s.xMin=v.min(s.xMin,n),n>0&&(s.xMax+=n),s.yMin=v.min(s.yMin,a),a>0&&(s.yMax+=a),s}_$canApply(){return this._$strength>0&&0!==this._$distance&&this._$blurFilter._$canApply()}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;if(!s)throw new Error("the current attachment is null.");t.setTransform(1,0,0,1,0,0);const r=i.getTextureFromCurrentAttachment();if(!this._$canApply())return r;const n=s.width,a=s.height,h=t._$offsetX,o=t._$offsetY;let l=v.sqrt(e[0]*e[0]+e[1]*e[1]),c=v.sqrt(e[2]*e[2]+e[3]*e[3]);l/=f,c/=f,l*=2,c*=2;const _=this._$angle*D,$=v.cos(_)*this._$distance*l,u=v.sin(_)*this._$distance*c,d=i.createTextureAttachment(n,a);t._$bind(d),t.reset(),t.drawImage(r,0,0,n,a),t.globalCompositeOperation="erase",t.drawImage(r,2*$,2*u,n,a);const g=this._$blurFilter._$applyFilter(t,e,!1),p=g.width,m=g.height,x=v.ceil(p+2*v.abs($)),b=v.ceil(m+2*v.abs(u)),T="inner"===this._$type,y=T?n:x,E=T?a:b,A=v.abs($),M=v.abs(u),S=(p-n)/2,w=(m-a)/2,C=T?0:A+S,F=T?0:M+w,R=T?-S-$:A-$,B=T?-w-u:M-u;return t._$bind(s),i.releaseAttachment(d,!0),t._$applyBitmapFilter(g,y,E,n,a,C,F,p,m,R,B,!1,this._$type,this._$knockout,this._$strength,null,null,null,xt(this._$highlightColor,this._$highlightAlpha,!0),bt(this._$highlightColor,this._$highlightAlpha,!0),vt(this._$highlightColor,this._$highlightAlpha,!0),this._$highlightAlpha,xt(this._$shadowColor,this._$shadowAlpha,!0),bt(this._$shadowColor,this._$shadowAlpha,!0),vt(this._$shadowColor,this._$shadowAlpha,!0),this._$shadowAlpha),t._$offsetX=h+C,t._$offsetY=o+F,i.releaseTexture(g),i.getTextureFromCurrentAttachment()}}class zt extends Ut{constructor(t=null){super(),this._$matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix=t}static toString(){return"[class ColorMatrixFilter]"}static get namespace(){return"next2d.filters.ColorMatrixFilter"}toString(){return"[object ColorMatrixFilter]"}get namespace(){return"next2d.filters.ColorMatrixFilter"}get matrix(){return this._$matrix}set matrix(t){if(t&&T.isArray(t)&&20===t.length){for(let e=0;e<20;++e)if(t[e]!==this._$matrix[e]){this._$doChanged();break}this._$matrix=t}}clone(){return new zt(this._$matrix)}_$toArray(){return nt(2,this._$matrix)}_$generateFilterRect(t){return t}_$canApply(){return!0}_$applyFilter(t){this._$updated=!1;const e=t.frameBuffer,i=e.currentAttachment;t.setTransform(1,0,0,1,0,0);const s=e.getTextureFromCurrentAttachment(),r=s.width,n=s.height,a=e.createTextureAttachment(r,n);return t._$bind(a),t.reset(),t._$applyColorMatrixFilter(s,this._$matrix),e.releaseAttachment(i,!0),e.getTextureFromCurrentAttachment()}}class Yt extends Ut{constructor(t=0,e=0,i=null,s=1,r=0,n=!0,a=!0,h=0,o=0){super(),this._$matrixX=0,this._$matrixY=0,this._$matrix=null,this._$divisor=1,this._$bias=0,this._$preserveAlpha=!0,this._$clamp=!0,this._$color=0,this._$alpha=0,this.matrixX=t,this.matrixY=e,this.matrix=i,this.divisor=s,this.bias=r,this.preserveAlpha=n,this.clamp=a,this.color=h,this.alpha=o}static toString(){return"[class ConvolutionFilter]"}static get namespace(){return"next2d.filters.ConvolutionFilter"}toString(){return"[object ConvolutionFilter]"}get namespace(){return"next2d.filters.ConvolutionFilter"}get alpha(){return this._$alpha}set alpha(t){(t=$t(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get bias(){return this._$bias}set bias(t){t!==this._$bias&&(this._$bias=0|t,this._$doChanged())}get clamp(){return this._$clamp}set clamp(t){t!==this._$clamp&&(this._$clamp=!!t,this._$doChanged())}get color(){return this._$color}set color(t){(t=$t(pt(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get divisor(){return this._$divisor}set divisor(t){t!==this._$divisor&&(this._$divisor=0|t,this._$doChanged())}get matrix(){return this._$matrix}set matrix(t){T.isArray(this._$matrix)&&at(this._$matrix),this._$matrix=T.isArray(t)?t:null,this._$doChanged()}get matrixX(){return this._$matrixX}set matrixX(t){(t=0|$t(0|t,0,15,0))!==this._$matrixX&&(this._$matrixX=t,this._$doChanged())}get matrixY(){return this._$matrixY}set matrixY(t){(t=0|$t(0|t,0,15,0))!==this._$matrixY&&(this._$matrixY=t,this._$doChanged())}get preserveAlpha(){return this._$preserveAlpha}set preserveAlpha(t){t!==this._$preserveAlpha&&(this._$preserveAlpha=!!t,this._$doChanged())}clone(){return new Yt(this._$matrixX,this._$matrixY,this._$matrix?this._$matrix.slice():null,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}_$toArray(){return nt(3,this._$matrixX,this._$matrixY,this._$matrix,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}_$generateFilterRect(t){return t}_$canApply(){return null!==this._$matrix&&this._$matrixX*this._$matrixY===this._$matrix.length}_$applyFilter(t){this._$updated=!1;const e=t.frameBuffer,i=e.currentAttachment;t.setTransform(1,0,0,1,0,0);const s=e.getTextureFromCurrentAttachment();return this._$canApply()&&this._$matrix?(t._$applyConvolutionFilter(s,this._$matrixX,this._$matrixY,this._$matrix,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,xt(this._$color,this._$alpha,!1),bt(this._$color,this._$alpha,!1),vt(this._$color,this._$alpha,!1),this._$alpha),e.releaseAttachment(i,!0),e.getTextureFromCurrentAttachment()):s}}class Xt extends Ut{constructor(t=null,e=null,i=0,s=0,r=0,n=0,a="wrap",h=0,o=0){super(),this._$mapBitmap=null,this._$mapPoint=null,this._$componentX=0,this._$componentY=0,this._$scaleX=0,this._$scaleY=0,this._$mode="wrap",this._$color=0,this._$alpha=0,this.mapBitmap=t,this.mapPoint=e,this.componentX=i,this.componentY=s,this.scaleX=r,this.scaleY=n,this.mode=a,this.color=h,this.alpha=o}static toString(){return"[class DisplacementMapFilter]"}static get namespace(){return"next2d.filters.DisplacementMapFilter"}toString(){return"[object DisplacementMapFilter]"}get namespace(){return"next2d.filters.DisplacementMapFilter"}get alpha(){return this._$alpha}set alpha(t){(t=$t(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get color(){return this._$color}set color(t){(t=$t(pt(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get componentX(){return this._$componentX}set componentX(t){t!==this._$componentX&&(this._$componentX=t,this._$doChanged())}get componentY(){return this._$componentY}set componentY(t){t!==this._$componentY&&(this._$componentY=t,this._$doChanged())}get mapBitmap(){return this._$mapBitmap}set mapBitmap(t){t!==this._$mapBitmap&&(this._$mapBitmap=t,this._$doChanged())}get mapPoint(){return this._$mapPoint}set mapPoint(t){t!==this._$mapPoint&&(this._$mapPoint=t,this._$doChanged())}get mode(){return this._$mode}set mode(t){t!==this._$mode&&(this._$mode=t,this._$doChanged())}get scaleX(){return this._$scaleX}set scaleX(t){(t=$t(+t,-65535,65535,0))!==this._$scaleX&&(this._$scaleX=t,this._$doChanged())}get scaleY(){return this._$scaleY}set scaleY(t){(t=$t(+t,-65535,65535,0))!==this._$scaleY&&(this._$scaleY=t,this._$doChanged())}clone(){return new Xt(this._$mapBitmap,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}_$toArray(){return nt(4,this._$mapBitmap,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}_$generateFilterRect(t){return t}_$canApply(){return null!==this._$mapBitmap&&this._$componentX>0&&this._$componentY>0&&0!==this._$scaleX&&0!==this._$scaleY}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;t.setTransform(1,0,0,1,0,0);const r=i.getTextureFromCurrentAttachment();if(!this._$canApply()||!s||!this._$mapBitmap)return r;const n=v.sqrt(e[0]*e[0]+e[1]*e[1]),a=v.sqrt(e[2]*e[2]+e[3]*e[3]);return t._$applyDisplacementMapFilter(r,this._$mapBitmap,r.width/n,r.height/a,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,xt(this._$color,this._$alpha,!0),bt(this._$color,this._$alpha,!0),vt(this._$color,this._$alpha,!0),this._$alpha),i.releaseAttachment(s,!0),i.getTextureFromCurrentAttachment()}}class qt extends Ut{constructor(t=4,e=45,i=0,s=1,r=4,n=4,a=1,h=1,o=!1,l=!1,c=!1){super(),this._$blurFilter=new Vt(r,n,h),this._$distance=4,this._$angle=45,this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this._$hideObject=!1,this.distance=t,this.angle=e,this.color=i,this.alpha=s,this.strength=a,this.inner=o,this.knockout=l,this.hideObject=c}static toString(){return"[class DropShadowFilter]"}static get namespace(){return"next2d.filters.DropShadowFilter"}toString(){return"[object DropShadowFilter]"}get namespace(){return"next2d.filters.DropShadowFilter"}get alpha(){return this._$alpha}set alpha(t){(t=$t(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get angle(){return this._$angle}set angle(t){(t%=360)!==this._$angle&&(this._$angle=$t(t,-360,360,45),this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get color(){return this._$color}set color(t){(t=$t(pt(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get distance(){return this._$distance}set distance(t){(t=$t(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get hideObject(){return this._$hideObject}set hideObject(t){t!==this._$hideObject&&(this._$hideObject=!!t,this._$doChanged())}get inner(){return this._$inner}set inner(t){t!==this._$inner&&(this._$inner=!!t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}clone(){return new qt(this._$distance,this._$angle,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout,this._$hideObject)}_$toArray(){return nt(5,this._$distance,this._$angle,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout,this._$hideObject)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const r=this._$angle*D;let n=v.cos(r)*this._$distance,a=v.sin(r)*this._$distance;return e&&(n*=e),i&&(a*=i),s.xMin=v.min(s.xMin,n),n>0&&(s.xMax+=n),s.yMin=v.min(s.yMin,a),a>0&&(s.yMax+=a),s}_$canApply(){return this._$alpha>0&&this._$strength>0&&this._$blurFilter._$canApply()}_$applyFilter(t,e){const i=t.frameBuffer,s=i.currentAttachment;if(!s)throw new Error("the current attachment is null.");if(t.setTransform(1,0,0,1,0,0),!this._$canApply())return i.getTextureFromCurrentAttachment();const r=s.width,n=s.height,a=t._$offsetX,h=t._$offsetY,o=this._$blurFilter._$applyFilter(t,e,!1),l=o.width,c=o.height,_=t._$offsetX,$=t._$offsetY,u=_-a,d=$-h;let g=v.sqrt(e[0]*e[0]+e[1]*e[1]),p=v.sqrt(e[2]*e[2]+e[3]*e[3]);g/=f,p/=f,g*=2,p*=2;const m=this._$angle*D,x=v.cos(m)*this._$distance*g,b=v.sin(m)*this._$distance*p,T=this._$inner?r:l+v.max(0,v.abs(x)-u),y=this._$inner?n:c+v.max(0,v.abs(b)-d),E=v.ceil(T),A=v.ceil(y),M=(E-T)/2,S=(A-y)/2,w=this._$inner?0:v.max(0,u-x)+M,C=this._$inner?0:v.max(0,d-b)+S,F=this._$inner?x-_:(x>0?v.max(0,x-u):0)+M,R=this._$inner?b-$:(b>0?v.max(0,b-d):0)+S;let B,I;return this._$inner?(B="inner",I=this._$knockout||this._$hideObject):!this._$knockout&&this._$hideObject?(B="full",I=!0):(B="outer",I=this._$knockout),t._$bind(s),t._$applyBitmapFilter(o,E,A,r,n,w,C,l,c,F,R,!0,B,I,this._$strength,null,null,null,xt(this._$color,this._$alpha,!0),bt(this._$color,this._$alpha,!0),vt(this._$color,this._$alpha,!0),this._$alpha,0,0,0,0),t._$offsetX=a+w,t._$offsetY=h+C,i.releaseTexture(o),i.getTextureFromCurrentAttachment()}}class Ht extends Ut{constructor(t=0,e=1,i=4,s=4,r=1,n=1,a=!1,h=!1){super(),this._$blurFilter=new Vt(i,s,n),this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this.color=t,this.alpha=e,this.strength=r,this.inner=a,this.knockout=h}static toString(){return"[class GlowFilter]"}static get namespace(){return"next2d.filters.GlowFilter"}toString(){return"[object GlowFilter]"}get namespace(){return"next2d.filters.GlowFilter"}get alpha(){return this._$alpha}set alpha(t){(t=$t(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get color(){return this._$color}set color(t){(t=$t(pt(t),0,16777215,4))!==this._$color&&(this._$color=t,this._$doChanged())}get inner(){return this._$inner}set inner(t){t!==this._$inner&&(this._$inner=!!t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}clone(){return new Ht(this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout)}_$toArray(){return nt(6,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){const s=K(t.xMin,t.xMax,t.yMin,t.yMax);return this._$canApply()?this._$blurFilter._$generateFilterRect(s,e,i):s}_$canApply(){return this._$alpha>0&&this._$strength>0&&this._$blurFilter._$canApply()}_$applyFilter(t,e){const i=t.frameBuffer,s=i.currentAttachment;if(!s)throw new Error("the current attachment is null.");if(this._$updated=!1,t.setTransform(1,0,0,1,0,0),!this._$canApply())return i.getTextureFromCurrentAttachment();const r=s.width,n=s.height,a=t._$offsetX,h=t._$offsetY,o=this._$blurFilter._$applyFilter(t,e,!1),l=o.width,c=o.height,_=t._$offsetX,$=t._$offsetY,u=this._$inner?r:l,d=this._$inner?n:c,g=this._$inner?0:_-a,f=this._$inner?0:$-h,p=this._$inner?-_:0,m=this._$inner?-$:0,x=this._$inner?"inner":"outer";return t._$bind(s),t._$applyBitmapFilter(o,u,d,r,n,g,f,l,c,p,m,!0,x,this._$knockout,this._$strength,null,null,null,xt(this._$color,this._$alpha,!0),bt(this._$color,this._$alpha,!0),vt(this._$color,this._$alpha,!0),this._$alpha,0,0,0,0),t._$offsetX=a+g,t._$offsetY=h+f,i.releaseTexture(o),i.getTextureFromCurrentAttachment()}}class jt extends Ut{constructor(t=4,e=45,i=null,s=null,r=null,n=4,a=4,h=1,o=1,l="inner",c=!1){super(),this._$blurFilter=new Vt(n,a,o),this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.colors=i,this.alphas=s,this.ratios=r,this.strength=h,this.type=l,this.knockout=c}static toString(){return"[class GradientBevelFilter]"}static get namespace(){return"next2d.filters.GradientBevelFilter"}toString(){return"[object GradientBevelFilter]"}get namespace(){return"next2d.filters.GradientBevelFilter"}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(this._$alphas=t,T.isArray(t)){for(let e=0;e<t.length;++e){const i=t[e];t[e]=$t(+i,0,1,0)}this._$alphas=t}this._$doChanged()}}get angle(){return this._$angle}set angle(t){(t=$t(t%360,-360,360,45))!==this._$angle&&(this._$angle=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(this._$colors=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(pt(t[e]),0,16777215,0);this._$colors=t}this._$doChanged()}}get distance(){return this._$distance}set distance(t){(t=$t(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(this._$ratios=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(+t[e],0,255,0);this._$ratios=t}this._$doChanged()}}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new jt(this._$distance,this._$angle,this._$colors?this._$colors.slice():null,this._$alphas?this._$alphas.slice():null,this._$ratios?this._$ratios.slice():null,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return nt(7,this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const r=this._$angle*D;let n=v.abs(v.cos(r)*this._$distance),a=v.abs(v.sin(r)*this._$distance);return e&&(n*=e),i&&(a*=i),s.xMin=v.min(s.xMin,n),n>0&&(s.xMax+=n),s.yMin=v.min(s.yMin,a),a>0&&(s.yMax+=a),s}_$canApply(){return this._$strength>0&&this._$distance>0&&null!==this._$alphas&&null!==this._$ratios&&null!==this._$colors&&this._$blurFilter._$canApply()}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;t.setTransform(1,0,0,1,0,0);const r=i.getTextureFromCurrentAttachment();if(!this._$canApply()||!s)return r;const n=s.width,a=s.height,h=t._$offsetX,o=t._$offsetY;let l=v.sqrt(e[0]*e[0]+e[1]*e[1]),c=v.sqrt(e[2]*e[2]+e[3]*e[3]);l/=f,c/=f,l*=2,c*=2;const _=+this._$angle*D,$=+v.cos(_)*this._$distance*l,u=+v.sin(_)*this._$distance*c,d=i.createTextureAttachment(n,a);t._$bind(d),t.reset(),t.drawImage(r,0,0,n,a),t.globalCompositeOperation="erase",t.drawImage(r,2*$,2*u,n,a);const g=this._$blurFilter._$applyFilter(t,e,!1),p=g.width,m=g.height,x=v.ceil(p+2*v.abs($)),b=v.ceil(m+2*v.abs(u)),T="inner"===this._$type,y=T?n:x,E=T?a:b,A=v.abs($),M=v.abs(u),S=(p-n)/2,w=(m-a)/2,C=T?0:A+S,F=T?0:M+w,R=T?-S-$:A-$,B=T?-w-u:M-u;return t._$bind(s),t._$applyBitmapFilter(g,y,E,n,a,C,F,p,m,R,B,!1,this._$type,this._$knockout,this._$strength,this._$ratios,this._$colors,this._$alphas,0,0,0,0,0,0,0,0),t._$offsetX=h+C,t._$offsetY=o+F,i.releaseAttachment(d,!0),i.getTextureFromCurrentAttachment()}}class Wt extends Ut{constructor(t=4,e=45,i=null,s=null,r=null,n=4,a=4,h=1,o=1,l="inner",c=!1){super(),this._$blurFilter=new Vt(n,a,o),this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.colors=i,this.alphas=s,this.ratios=r,this.strength=h,this.type=l,this.knockout=c}static toString(){return"[class GradientGlowFilter]"}static get namespace(){return"next2d.filters.GradientGlowFilter"}toString(){return"[object GradientGlowFilter]"}get namespace(){return"next2d.filters.GradientGlowFilter"}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(this._$alphas=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(+t[e],0,1,0);this._$alphas=t}this._$doChanged()}}get angle(){return this._$angle}set angle(t){(t=$t(t%360,-360,360,45))!==this._$angle&&(this._$angle=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(this._$colors=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(pt(t[e]),0,16777215,0);this._$colors=t}this._$doChanged()}}get distance(){return this._$distance}set distance(t){(t=$t(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(this._$ratios=t,T.isArray(t)){for(let e=0;e<t.length;++e)t[e]=$t(+t[e],0,255,0);this._$ratios=t}this._$doChanged()}}get strength(){return this._$strength}set strength(t){(t=$t(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new Wt(this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return nt(8,this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=K(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const r=this._$angle*D;let n=v.abs(v.cos(r)*this._$distance),a=v.abs(v.sin(r)*this._$distance);return e&&(n*=e),i&&(a*=i),s.xMin=v.min(s.xMin,n),n>0&&(s.xMax+=n),s.yMin=v.min(s.yMin,a),a>0&&(s.yMax+=a),s}_$canApply(){return this._$strength>0&&this._$distance>0&&null!==this._$alphas&&null!==this._$ratios&&null!==this._$colors&&this._$blurFilter._$canApply()}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;if(t.setTransform(1,0,0,1,0,0),!this._$canApply()||!s)return i.getTextureFromCurrentAttachment();const r=s.width,n=s.height,a=t._$offsetX,h=t._$offsetY,o=this._$blurFilter._$applyFilter(t,e,!1),l=o.width,c=o.height,_=t._$offsetX,$=t._$offsetY,u=_-a,d=$-h;let g=v.sqrt(e[0]*e[0]+e[1]*e[1]),p=v.sqrt(e[2]*e[2]+e[3]*e[3]);g/=f,p/=f,g*=2,p*=2;const m=+this._$angle*D,x=+v.cos(m)*this._$distance*g,b=+v.sin(m)*this._$distance*p,T="inner"===this.type,y=T?r:l+v.max(0,v.abs(x)-u),E=T?n:c+v.max(0,v.abs(b)-d),A=v.ceil(y),M=v.ceil(E),S=(A-y)/2,w=(M-E)/2,C=T?0:v.max(0,u-x)+S,F=T?0:v.max(0,d-b)+w,R=T?x-_:(x>0?v.max(0,x-u):0)+S,B=T?b-$:(b>0?v.max(0,b-d):0)+w;return t._$bind(s),t._$applyBitmapFilter(o,A,M,r,n,C,F,l,c,R,B,!0,this._$type,this._$knockout,this._$strength,this._$ratios,this._$colors,this._$alphas,0,0,0,0,0,0,0,0),t._$offsetX=a+C,t._$offsetY=h+F,i.releaseTexture(o),i.getTextureFromCurrentAttachment()}}class Kt{constructor(t){this._$displayObject=t,this._$matrix=null,this._$colorTransform=null,this._$blendMode=null,this._$filters=null}static toString(){return"[class Transform]"}static get namespace(){return"next2d.geom.Transform"}toString(){return"[object Transform]"}get namespace(){return"next2d.geom.Transform"}get colorTransform(){if(this._$colorTransform)return this._$colorTransform._$clone();const t=this._$displayObject,e=t._$placeObject||t._$getPlaceObject();if(e&&e.colorTransform){const t=e.colorTransform;return cr(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7])}return this._$transform(),this._$colorTransform||(this._$colorTransform=cr()),this._$colorTransform._$clone()}set colorTransform(t){this._$transform(null,t._$colorTransform)}get concatenatedColorTransform(){let t=this._$rawColorTransform(),e=this._$displayObject._$parent;for(;e;)t=dt(e._$transform._$rawColorTransform(),t),e=e._$parent;return cr(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7])}get matrix(){if(this._$matrix)return this._$matrix._$clone();const t=this._$displayObject,e=t._$placeObject||t._$getPlaceObject();if(e&&e.matrix){const t=e.matrix;return or(t[0],t[1],t[2],t[3],t[4],t[5])}return this._$transform(),this._$matrix||(this._$matrix=or()),this._$matrix._$clone()}set matrix(t){this._$transform(t._$matrix,null)}get concatenatedMatrix(){let t=this._$rawMatrix(),e=this._$displayObject._$parent;for(;e;)t=ut(e._$transform._$rawMatrix(),t),e=e._$parent;return or(t[0],t[1],t[2],t[3],t[4],t[5])}pixelBounds(){if(!this._$displayObject)return new Dt(0,0,0,0);const t=this._$displayObject._$getBounds(null),e=new Dt(t.xMin,t.yMin,+v.abs(t.xMax-t.xMin),+v.abs(t.yMax-t.yMin));return Q(t),e}_$rawMatrix(){if(null!==this._$matrix)return this._$matrix._$matrix;const t=this._$displayObject,e=t._$placeObject||t._$getPlaceObject();if(e&&e.matrix){if(T.isArray(e.matrix)){const t=e.matrix;e.matrix=tt(t[0],t[1],t[2],t[3],t[4],t[5]),at(t)}return e.matrix}return P}_$rawColorTransform(){if(null!==this._$colorTransform)return this._$colorTransform._$colorTransform;const t=this._$displayObject,e=t._$placeObject||t._$getPlaceObject();if(e&&e.colorTransform){if(T.isArray(e.colorTransform)){const t=e.colorTransform;e.colorTransform=it(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]),at(t)}return e.colorTransform}return O}_$transform(t=null,e=null,i=null,s=""){const r=this._$displayObject,n=r._$placeObject||r._$getPlaceObject();this._$setMatrix(t,n),this._$setColorTransform(e,n),this._$setFilters(i,n),this._$setBlendMode(s,n)}_$setMatrix(t=null,e=null){if((t||e)&&(this._$displayObject._$doChanged(),x()),this._$matrix||(this._$matrix=or(1,0,0,1,0,0),!t&&e&&e.matrix&&(t=e.matrix)),t){const e=this._$matrix._$matrix;e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5]}}_$setColorTransform(t=null,e=null){if((t||e)&&(this._$displayObject._$doChanged(),x()),this._$colorTransform||(this._$colorTransform=cr(1,1,1,1,0,0,0,0),!t&&e&&e.colorTransform&&(t=e.colorTransform)),t){const e=this._$colorTransform._$colorTransform;e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7]}}_$setFilters(t=null,e=null){if(T.isArray(t))return this._$filters&&at(this._$filters),this._$filters=t.slice(0),this._$displayObject._$doChanged(),void x();if(!this._$filters)if(e){if(e.filters){this._$filters=e.filters.slice(0);for(let t=0;t<this._$filters.length;++t)this._$filters[t]=this._$filters[t].clone()}else if(e.surfaceFilterList){e.filters=this._$buildFilter(e.surfaceFilterList),this._$filters=e.filters.slice(0);for(let t=0;t<this._$filters.length;++t)this._$filters[t]=this._$filters[t].clone()}}else this._$filters=nt()}_$buildFilter(t){const e=nt(),i=t.length;for(let s=0;s<i;++s){const i=t[s];switch(null===i.params[0]&&i.params.shift(),i.class){case"BevelFilter":e.push(new Gt(...i.params));break;case"BlurFilter":e.push(new Vt(...i.params));break;case"ColorMatrixFilter":e.push(new zt(...i.params));break;case"ConvolutionFilter":e.push(new Yt(...i.params));break;case"DisplacementMapFilter":e.push(new Xt(...i.params));break;case"DropShadowFilter":e.push(new qt(...i.params));break;case"GlowFilter":e.push(new Ht(...i.params));break;case"GradientBevelFilter":e.push(new jt(...i.params));break;case"GradientGlowFilter":e.push(new Wt(...i.params))}}return e}_$setBlendMode(t="",e=null){if(t)return this._$blendMode=t,this._$displayObject._$doChanged(),void x();this._$blendMode||(e&&e.blendMode?this._$blendMode=e.blendMode:this._$blendMode="normal")}}class Qt extends Ct{constructor(){super(),this._$id=-1,this._$instanceId=e(),this._$characterId=0,this._$active=!1,this._$isMask=!1,this._$updated=!0,this._$added=!1,this._$addedStage=!1,this._$filters=null,this._$blendMode=null,this._$hitObject=null,this._$isNext=!0,this._$created=!1,this._$posted=!1,this._$postArray=null,this._$clipDepth=0,this._$name="",this._$visible=!0,this._$mask=null,this._$scale9Grid=null,this._$parent=null,this._$stage=null,this._$root=null,this._$loaderInfo=null,this._$placeId=-1,this._$startFrame=1,this._$endFrame=0,this._$transform=new Kt(this),this._$variables=null,this._$placeObject=null,this._$currentPlaceId=-1,this._$changePlace=!1,this._$scaleX=null,this._$scaleY=null,this._$rotation=null}get alpha(){const t=this._$transform._$rawColorTransform();return t[3]+t[7]/255}set alpha(t){t=$t(t,0,1,0);const e=this._$transform;if(e._$colorTransform){const i=e._$colorTransform;i._$colorTransform[3]=t,i._$colorTransform[7]=0,this._$doChanged(),x()}else{const i=e.colorTransform;i._$colorTransform[3]=t,i._$colorTransform[7]=0,e.colorTransform=i,_r(i)}}get blendMode(){if(this._$blendMode)return this._$blendMode;const t=this._$transform;if(t._$blendMode)return this._$blendMode=t._$blendMode,t._$blendMode;const e=this._$placeObject||this._$getPlaceObject();return e&&e.blendMode?(this._$blendMode=e.blendMode,e.blendMode):(this._$blendMode="normal","normal")}set blendMode(t){const e=this._$transform;e._$blendMode?(e._$blendMode=t,this._$doChanged(),x()):e._$transform(null,null,null,t),this._$blendMode=t}get filters(){if(this._$filters){const t=nt();for(let e=0;e<this._$filters.length;++e)t[e]=this._$filters[e].clone();return t}const t=this._$transform;if(t._$filters){const e=nt(),i=nt();for(let s=0;s<t._$filters.length;++s){const r=t._$filters[s];e[s]=r.clone(),i[s]=r.clone()}return this._$filters=e,i}const e=this._$placeObject||this._$getPlaceObject();if(e&&e.surfaceFilterList){e.filters||(e.filters=t._$buildFilter(e.surfaceFilterList));const i=nt(),s=nt();for(let t=0;t<e.filters.length;++t){const r=e.filters[t];i[t]=r.clone(),s[t]=r.clone()}return this._$filters=i,s}const i=nt();return this._$filters=i,i}set filters(t){t||(t=nt()),this._$transform._$transform(null,null,t),this._$filters=t}get height(){const t="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),e=gt(t,this._$transform._$rawMatrix());Q(t);const i=v.abs(e.yMax-e.yMin);switch(Q(e),i){case 0:case b:case-1/0:return 0;default:return+i.toFixed(2)}}set height(t){if(!C(t=+t)&&t>-1){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=this.rotation,s=i?gt(e,this._$transform._$rawMatrix()):e;i&&Q(e);const r=v.abs(s.yMax-s.yMin);switch(Q(s),r){case 0:case b:case-1/0:this.scaleY=0;break;default:this.scaleY=t/r}}}get loaderInfo(){return this._$loaderInfo}get mask(){return this._$mask}set mask(t){t!==this._$mask&&(this._$mask&&(Tr&&this._$mask.stage&&this._$mask._$removeWorkerInstance(),this._$mask._$isMask=!1,this._$mask=null),t&&(Tr&&"_$createWorkerInstance"in t&&"function"==typeof t._$createWorkerInstance&&t._$createWorkerInstance(),t._$isMask=!0,this._$mask=t),this._$doChanged())}get mouseX(){return o()?this.globalToLocal(hr()).x:0}get mouseY(){return o()?this.globalToLocal(hr()).y:0}get name(){return this._$name?this._$name:`instance${this._$instanceId}`}set name(t){this._$name=`${t}`;const e=this._$parent;if(e&&e._$names){e._$names.clear();const t=e._$getChildren();for(let i=0;i<t.length;++i){const s=t[i];s._$name&&e._$names.set(s.name,s)}}}get parent(){return this._$parent}get root(){return this._$root}get rotation(){if(null!==this._$rotation)return this._$rotation;const t=this._$transform._$rawMatrix();return v.atan2(t[1],t[0])*U}set rotation(t){if(t=$t(t%360,-360,360,0),this._$rotation===t)return;const e=this._$transform,i=null!==e._$matrix,s=i?e._$matrix:e.matrix,r=v.sqrt(s.a*s.a+s.b*s.b),n=v.sqrt(s.c*s.c+s.d*s.d);if(0===t)s.a=r,s.b=0,s.c=0,s.d=n;else{let e=v.atan2(s.b,s.a),i=v.atan2(0-s.c,s.d);const a=t*D;i=i+a-e,e=a,s.b=r*v.sin(e),1===s.b||-1===s.b?s.a=0:s.a=r*v.cos(e),s.c=-n*v.sin(i),1===s.c||-1===s.c?s.d=0:s.d=n*v.cos(i)}i?(this._$doChanged(),x()):(e.matrix=s,lr(s)),this._$rotation=t}get scale9Grid(){return this._$scale9Grid}set scale9Grid(t){this._$scale9Grid!==t&&(this._$scale9Grid=t,this._$doChanged(),x())}get scaleX(){if(null!==this._$scaleX)return this._$scaleX;const t=this._$transform._$rawMatrix();let e=v.sqrt(t[0]*t[0]+t[1]*t[1]);if(!E.isInteger(e)){const t=e.toString(),i=t.indexOf("e");-1!==i&&(e=+t.slice(0,i)),e=+e.toFixed(4)}return 0>t[0]?-1*e:e}set scaleX(t){if(t=$t(+t,k,N),!E.isInteger(t)){const e=t.toString(),i=e.indexOf("e");-1!==i&&(t=+e.slice(0,i)),t=+t.toFixed(4)}if(this._$scaleX===t)return;const e=this._$transform,i=null!==e._$matrix,s=i?e._$matrix:e.matrix;if(0===s.b||C(s.b))s.a=t;else{let e=v.atan2(s.b,s.a);e===-v.PI&&(e=0),s.b=t*v.sin(e),s.a=t*v.cos(e)}i?(this._$doChanged(),x()):(e.matrix=s,lr(s)),this._$scaleX=t}get scaleY(){if(null!==this._$scaleY)return this._$scaleY;const t=this._$transform._$rawMatrix();let e=v.sqrt(t[2]*t[2]+t[3]*t[3]);if(!E.isInteger(e)){const t=e.toString(),i=t.indexOf("e");-1!==i&&(e=+t.slice(0,i)),e=+e.toFixed(4)}return 0>t[3]?-1*e:e}set scaleY(t){if(t=$t(+t,k,N),!E.isInteger(t)){const e=t.toString(),i=e.indexOf("e");-1!==i&&(t=+e.slice(0,i)),t=+t.toFixed(4)}if(this._$scaleY===t)return;const e=this._$transform,i=null!==e._$matrix,s=i?e._$matrix:e.matrix;if(0===s.c||C(s.c))s.d=t;else{let e=v.atan2(-s.c,s.d);e===-v.PI&&(e=0),s.c=-t*v.sin(e),s.d=t*v.cos(e)}i?(this._$doChanged(),x()):(e.matrix=s,lr(s)),this._$scaleY=t}get stage(){if(this._$stage)return this._$stage;const t=this._$parent;return t?t._$stage:null}get transform(){return this._$transform}set transform(t){this._$transform=t}get visible(){return this._$visible}set visible(t){this._$visible!==t&&(this._$visible=!!t,this._$doChanged(),x())}get width(){const t="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),e=gt(t,this._$transform._$rawMatrix());Q(t);const i=v.abs(e.xMax-e.xMin);switch(Q(e),!0){case 0===i:case i===b:case i===-1/0:return 0;default:return+i.toFixed(2)}}set width(t){if(!C(t=+t)&&t>-1){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=this.rotation,s=i?gt(e,this._$transform._$rawMatrix()):e;i&&Q(e);const r=v.abs(s.xMax-s.xMin);switch(Q(s),!0){case 0===r:case r===b:case r===-1/0:this.scaleX=0;break;default:this.scaleX=t/r}}}get x(){return this._$transform._$rawMatrix()[4]}set x(t){const e=this._$transform;if(e._$matrix)e._$matrix.tx=t,this._$doChanged(),x();else{const i=e.matrix;i.tx=t,e.matrix=i,lr(i)}}get y(){return this._$transform._$rawMatrix()[5]}set y(t){const e=this._$transform;if(e._$matrix)e._$matrix.ty=t,this._$doChanged(),x();else{const i=e.matrix;i.ty=t,e.matrix=i,lr(i)}}getBounds(t=null){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=this._$transform.concatenatedMatrix,s=gt(e,i._$matrix);lr(i),Q(e);const r=K(s.xMin,s.xMax,s.yMin,s.yMax);Q(s),t||(t=this);const n=t._$transform.concatenatedMatrix;n.invert();const a=gt(r,n._$matrix);Q(r),lr(n);const h=a.xMin,o=a.yMin,l=a.xMax,c=a.yMax;return Q(a),new Dt(h,o,v.abs(l-h),v.abs(c-o))}globalToLocal(t){const e=this._$transform.concatenatedMatrix;e.invert();const i=new kt(t.x*e.a+t.y*e.c+e.tx,t.x*e.b+t.y*e.d+e.ty);return lr(e),i}hitTestObject(t){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=this._$transform.concatenatedMatrix,s=gt(e,i._$matrix);lr(i),Q(e);const r=t._$getBounds(null),n=t._$transform.concatenatedMatrix,a=gt(r,n._$matrix);lr(n),Q(r);const h=v.max(s.xMin,a.xMin),o=v.max(s.yMin,a.yMin),l=v.min(s.xMax,a.xMax),c=v.min(s.yMax,a.yMax);return Q(s),Q(a),l-h>=0&&c-o>=0}hitTestPoint(t,e,i=!1){if(i){let i=P,s=this._$parent;for(;s;)i=ut(s._$transform._$rawMatrix(),i),s=s._$parent;tr.setTransform(1,0,0,1,0,0),tr.beginPath();let r=!1;return"_$hit"in this&&"function"==typeof this._$hit&&(r=this._$hit(tr,i,{x:t,y:e},!0)),i!==P&&et(i),r}const s="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),r=gt(s,this._$transform._$rawMatrix());Q(s);const n=new Dt(r.xMin,r.yMin,r.xMax-r.xMin,r.yMax-r.yMin);Q(r);const a=this._$parent?this._$parent.globalToLocal(new kt(t,e)):new kt(t,e);return n.containsPoint(a)}localToGlobal(t){const e=this._$transform.concatenatedMatrix,i=new kt(t.x*e.a+t.y*e.c+e.tx,t.x*e.b+t.y*e.d+e.ty);return lr(e),i}getLocalVariable(t){return this._$variables?this._$variables.has(t)?this._$variables.get(t):void 0:null}setLocalVariable(t,e){this._$variables||(this._$variables=ot()),this._$variables.set(t,e)}hasLocalVariable(t){return!!this._$variables&&this._$variables.has(t)}deleteLocalVariable(t){this._$variables&&this._$variables.has(t)&&(this._$variables.delete(t),this._$variables.size||(ht(this._$variables),this._$variables=null))}getGlobalVariable(t){return Os.has(t)?Os.get(t):null}setGlobalVariable(t,e){Os.set(t,e)}hasGlobalVariable(t){return Os.has(t)}deleteGlobalVariable(t){Os.has(t)&&Os.delete(t)}clearGlobalVariable(){return Os.clear()}_$getPlaceObject(){if(!this._$placeObject){const t=this._$placeId;if(-1===t)return null;const e=this._$parent;if(!e||!e._$placeObjects)return null;const i=e._$placeMap;if(!i||!i.length)return null;const s=i["currentFrame"in e?e.currentFrame:1];if(!s)return null;const r=0|s[t],n=e._$placeObjects[r];return n?(this._$changePlace=r!==this._$currentPlaceId,this._$currentPlaceId=r,this._$placeObject=n,n):null}return this._$placeObject}_$baseBuild(t,e){const i=e._$loaderInfo;if(!i||!i._$data)throw new Error("the loaderInfo or data is nul.");return this._$parent=e,this._$root=e._$root,this._$stage=e._$stage,this._$loaderInfo=i,this._$characterId=0|t.characterId,this._$clipDepth=0|t.clipDepth,this._$startFrame=0|t.startFrame,this._$endFrame=0|t.endFrame,this._$name=t.name||"",i._$data.characters[t.characterId]}_$isUpdated(){return this._$updated}_$updateState(){this._$isNext=!0;const t=this._$parent;t&&t._$updateState()}_$doChanged(){this._$posted=!1,this._$isNext=!0,this._$updated=!0;const t=this._$parent;t&&(t._$updated||t._$doChanged())}_$drawFilter(t,e,i,s,r,n=null){const a=nt(this._$instanceId,"f");let h=At.get(a);const o=this._$isFilterUpdated(e,i,!0);if(h&&!o)return t.cachePosition=h,h;h&&At.set(a,null);const l=t.frameBuffer,c=n||t.getTextureFromRect(t.cachePosition),_=this._$applyFilter(t,i,c,e,s,r);l.textureManager.release(c);const $=this._$getLayerBounds(e);return h=l.createCachePosition(v.ceil(v.abs($.xMax-$.xMin)),v.ceil(v.abs($.yMax-$.yMin))),Q($),h.filterState=!0,h.matrix=`${e[0]}_${e[1]}_${e[2]}_${e[3]}_0_0`,h.offsetX=_.offsetX,h.offsetY=_.offsetY,t.drawTextureFromRect(_,h),At.set(a,h),at(a),h}_$getLayerBounds(t){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds():K(),i=gt(e,t);Q(e);const s=this._$filters||this.filters;if(!s.length)return i;let r=K(0,v.abs(i.xMax-i.xMin),0,v.abs(i.yMax-i.yMin));Q(i);let n=+v.sqrt(t[0]*t[0]+t[1]*t[1]),a=+v.sqrt(t[2]*t[2]+t[3]*t[3]);n/=f,a/=f,n*=2,a*=2;for(let t=0;t<s.length;++t)r=s[t]._$generateFilterRect(r,n,a);return r}_$executeAddedEvent(){this._$parent&&(this._$added||(this.willTrigger(wt.ADDED)&&this.dispatchEvent(new wt(wt.ADDED,!0)),this._$added=!0),this._$addedStage||null===this._$stage||(this.willTrigger(wt.ADDED_TO_STAGE)&&this.dispatchEvent(new wt(wt.ADDED_TO_STAGE)),this._$addedStage=!0))}_$prepareActions(){this._$nextFrame()}_$nextFrame(){return this._$executeAddedEvent(),this._$isNext=!1,!this._$posted&&Tr&&this._$postProperty(),!1}_$canApply(t=null){if(t)for(let e=0;e<t.length;++e)if(t[e]._$canApply())return!0;return!1}_$isFilterUpdated(t,e=null,i=!1){if(this._$isUpdated())return!0;if(i&&e)for(let t=0;t<e.length;++t)if(e[t]._$isUpdated())return!0;const s=At.get([this._$instanceId,"f"]);return!s||s.filterState!==i||s.matrix!==`${t[0]}_${t[1]}_${t[2]}_${t[3]}`}_$applyFilter(t,e,i,s,r,n){const a=+v.sqrt(s[0]*s[0]+s[1]*s[1]),h=+v.sqrt(s[2]*s[2]+s[3]*s[3]),o=v.atan2(s[1],s[0]),l=v.atan2(-s[2],s[3]),c=tt(v.cos(o),v.sin(o),-v.sin(l),v.cos(l),r/2,n/2),_=tt(1,0,0,1,-i.width/2,-i.height/2),$=ut(c,_);et(c),et(_);const u=t.frameBuffer,d=u.currentAttachment,g=u.createCacheAttachment(r,n);t._$bind(g),t.reset(),t.setTransform($[0],$[1],$[2],$[3],$[4],$[5]),et($),t.drawImage(i,0,0,i.width,i.height),t._$offsetX=0,t._$offsetY=0;const f=tt(a,0,0,h,0,0);let p=null;for(let i=0;i<e.length;++i)p=e[i]._$applyFilter(t,f);if(et(f),!p)return i;const m=t._$offsetX,x=t._$offsetY;return t._$offsetX=0,t._$offsetY=0,p.offsetX=m,p.offsetY=x,t._$bind(d),u.releaseAttachment(g,!1),p}_$shouldClip(t){const e="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds(t):K(),i=v.abs(e.xMax-e.xMin),s=v.abs(e.yMax-e.yMin);return Q(e),!(!i||!s)}_$startClip(t,e){t.drawInstacedArray();const i="_$getBounds"in this&&"function"==typeof this._$getBounds?this._$getBounds(e):K(),s=t._$startClip(i);if(Q(i),!s)return!1;t._$enterClip(),t._$beginClipDef();let r=!1;return"_$children"in this&&(r=!0,t._$updateContainerClipFlag(!0)),this._$clip(t,e),this._$updated=!1,r&&(t._$updateContainerClipFlag(!1),t._$drawContainerClip()),t._$endClipDef(),!0}_$removeWorkerInstance(){Tr&&Tr.postMessage({command:"remove",instanceId:this._$instanceId})}_$registerProperty(t,e=0){t[e++]=+this._$visible,t[e++]=this._$placeId,t[e++]=this._$clipDepth,t[e++]=+this._$isMask;const i=this._$mask;if(t[e++]=+(null!==i),i){t[e++]=i._$instanceId;let s=P,r=i._$parent;for(;r;)s=ut(r._$transform._$rawMatrix(),s),r=r._$parent;t[e++]=s[0],t[e++]=s[1],t[e++]=s[2],t[e++]=s[3],t[e++]=s[4],t[e++]=s[5]}else e+=7;if(this._$visible){const i=this._$transform,s=i._$rawMatrix();t[e++]=s[0],t[e++]=s[1],t[e++]=s[2],t[e++]=s[3],t[e++]=s[4],t[e++]=s[5];const r=i._$rawColorTransform();t[e++]=r[0],t[e++]=r[1],t[e++]=r[2],t[e++]=r[3],t[e++]=r[4],t[e++]=r[5],t[e++]=r[6],t[e++]=r[7]}else e+=6,e+=8;const s=this._$blendMode||this.blendMode;t[e++]=br(s);const r=this._$scale9Grid;t[e++]=+(null!==r),r?(t[e++]=r.x,t[e++]=r.y,t[e++]=r.width,t[e++]=r.height):e+=4}_$createMessage(){const t={command:"setProperty",buffer:new Float32Array,instanceId:this._$instanceId,parentId:this._$parent?this._$parent._$instanceId:-1,visible:this._$visible};this._$placeId>-1&&(t.depth=this._$placeId),this._$clipDepth&&(t.clipDepth=this._$clipDepth),this._$isMask&&(t.isMask=this._$isMask);const e=this._$mask;if(e){t.maskId=e._$instanceId;let i=P,s=e._$parent;for(;s;)i=ut(s._$transform._$rawMatrix(),i),s=s._$parent;t.maskMatrix=i}if(this._$visible){const e=this._$transform,i=e._$rawMatrix();1!==i[0]&&(t.a=i[0]),0!==i[1]&&(t.b=i[1]),0!==i[2]&&(t.c=i[2]),1!==i[3]&&(t.d=i[3]),0!==i[4]&&(t.tx=i[4]),0!==i[5]&&(t.ty=i[5]);const s=e._$rawColorTransform();1!==s[0]&&(t.f0=s[0]),1!==s[1]&&(t.f1=s[1]),1!==s[2]&&(t.f2=s[2]),1!==s[3]&&(t.f3=s[3]),0!==s[4]&&(t.f4=s[4]),0!==s[5]&&(t.f5=s[5]),0!==s[6]&&(t.f6=s[6]),0!==s[7]&&(t.f7=s[7]);const r=this._$filters||this.filters;if(r&&r.length){const e=nt();for(let t=0;t<r.length;++t)e.push(r[t]._$toArray());t.filters=e}const n=this._$blendMode||this.blendMode;"normal"!==n&&(t.blendMode=n);const a=this._$scale9Grid;if(a&&this._$isUpdated()){const e=this._$parent._$transform.concatenatedMatrix;t.matrixBase=e._$matrix.slice(),lr(e),t.grid={x:a.x,y:a.y,w:a.width,h:a.height}}}return t}}class Jt extends Qt{constructor(){super(),this._$mouseEnabled=!0}get mouseEnabled(){return this._$mouseEnabled}set mouseEnabled(t){this._$mouseEnabled=!!t}}class Zt extends Jt{constructor(){return super(),this._$placeMap=null,this._$placeObjects=null,this._$controller=null,this._$dictionary=null,this._$children=nt(),this._$needsChildren=!0,this._$mouseChildren=!0,this._$wait=!0,this._$names=ot(),new Proxy(this,{get:(t,e)=>t._$names.size&&t._$names.has(e)?t._$names.get(e):t[e]})}get mouseChildren(){return this._$mouseChildren}set mouseChildren(t){this._$mouseChildren=!!t}get numChildren(){return this._$needsChildren?this._$getChildren().length:this._$children.length}addChild(t){return t._$parent&&t._$parent._$remove(t,!(t._$parent._$instanceId===this._$instanceId)),this._$getChildren().push(t),t._$name&&this._$names.set(t._$name,t),this._$addChild(t)}addChildAt(t,e){t._$parent&&t._$parent._$remove(t,!(t._$parent._$instanceId===this._$instanceId));const i=this._$getChildren(),s=i.length;if(0>e||e>s)throw new RangeError(`RangeError: addChildAt: index error: ${e}`);if(s&&s>e){i.splice(e,0,t);for(let t=0;t<e;++t){const e=i[t];e._$name&&this._$names.set(e._$name,e)}}else i.push(t),t._$name&&this._$names.set(t._$name,t);return this._$addChild(t)}contains(t){if(this._$instanceId===t._$instanceId)return!0;const e=this._$getChildren();for(let i=0;i<e.length;++i){const s=e[i];if(s._$instanceId===t._$instanceId)return!0;if(s instanceof Zt&&s.contains(t))return!0}return!1}getChildAt(t){const e=this._$getChildren();if(0>t||t>e.length)throw new RangeError(`RangeError: getChildAt: index error: ${t}`);return t in e?e[t]:null}getChildByName(t){if(!t)return null;const e=this._$getChildren();for(let i=0;i<e.length;++i){const s=e[i];if(s.name===t)return s}return null}getChildIndex(t){if(t._$parent!==this)throw new Error("ArgumentError: getChildIndex: not child");const e=this._$getChildren().indexOf(t);if(-1===e)throw new Error("ArgumentError: getChildIndex: not found.");return e}removeChild(t){if(t._$parent!==this)throw new Error("ArgumentError: removeChild: not child");return this._$remove(t)}removeChildAt(t){return this._$remove(this.getChildAt(t))}removeChildren(t=0,e=2147483647){const i=this._$getChildren();if(i.length){t=$t(t,0,2147483646,0)-1,e=$t(e,1,134217727,134217727);for(let s=v.min(e,i.length-1);s>t;--s)this._$remove(i[s])}}setChildIndex(t,e){const i=this.getChildIndex(t);if(i===e)return;const s=this._$getChildren();s.splice(i,1),s.splice(e,0,t),Tr&&this._$postChildrenIds(),this._$doChanged()}swapChildren(t,e){const i=this._$getChildren(),s=this.getChildIndex(t),r=this.getChildIndex(e);i[s]=e,i[r]=t,Tr&&this._$postChildrenIds(),this._$doChanged()}swapChildrenAt(t,e){this.swapChildren(this.getChildAt(t),this.getChildAt(e))}_$getBounds(t=null){let e=P;if(t){e=t;const i=this._$transform._$rawMatrix();1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]&&0===i[4]&&0===i[5]||(e=ut(t,i))}const i=this._$needsChildren?this._$getChildren():this._$children;if(!i.length){const i=K(e[4],-e[4],e[5],-e[5]);return t&&e!==t&&et(e),i}const s=E.MAX_VALUE;let r=s,n=-s,a=s,h=-s;for(let t=0;t<i.length;++t){const s=i[t]._$getBounds(e);r=v.min(r,s.xMin),n=v.max(n,s.xMax),a=v.min(a,s.yMin),h=v.max(h,s.yMax),Q(s)}return t&&e!==t&&et(e),K(r,n,a,h)}_$getLayerBounds(t){const e=this._$needsChildren?this._$getChildren():this._$children;if(!e.length)return K(0,0,0,0);const i=E.MAX_VALUE;let s=i,r=-i,n=i,a=-i;for(let i=0;i<e.length;++i){const h=e[i];let o=t;const l=h._$transform._$rawMatrix();1===l[0]&&0===l[1]&&0===l[2]&&1===l[3]&&0===l[4]&&0===l[5]||(o=ut(t,l));const c=h._$getLayerBounds(o);s=v.min(s,c.xMin),r=v.max(r,c.xMax),n=v.min(n,c.yMin),a=v.max(a,c.yMax),Q(c),o!==t&&et(o)}const h=this._$filters||this.filters;if(!h.length)return K(s,r,n,a);let o=K(0,r-s,0,a-n),l=+v.sqrt(t[0]*t[0]+t[1]*t[1]),c=+v.sqrt(t[2]*t[2]+t[3]*t[3]);l/=f,c/=f,l*=2,c*=2;for(let t=0;t<h.length;++t)o=h[t]._$generateFilterRect(o,l,c);return r+=o.xMax-(r-s),a+=o.yMax-(a-n),s+=o.xMin,n+=o.yMin,Q(o),K(s,r,n,a)}_$getChildren(){if(this._$needsChildren){this._$needsChildren=!1;const t=this._$children;if(!this._$controller)return t;const e="_$currentFrame"in this?this._$currentFrame:1,i=this._$controller[e];if(!t.length){if(i)for(let e=0;e<i.length;++e){const s=this._$createInstance(i[e]);s._$placeId=e;const r=s.loopConfig;r&&(s._$currentFrame=s._$getLoopFrame(r)),t.push(s),s._$name&&this._$names.set(s._$name,s)}return t}const s=!!Tr&&!!this._$stage,r=ot(),n=ot();let a=0;const h=nt();for(let o=0;o<t.length;++o){const l=t[o],c=l._$parent;if(!c||c._$instanceId!==this._$instanceId)continue;const _=l._$instanceId,$=l._$startFrame,u=l._$endFrame;if(1===$&&0===u||$<=e&&u>e){if(l._$isNext=!0,l._$placeObject=null,l._$filters=null,l._$blendMode=null,-1===l._$id){h.push(l),l._$name&&this._$names.set(l._$name,l);continue}const t=i[a];if(l._$id===t){l._$placeId=a,h.push(l),l._$name&&this._$names.set(l._$name,l),n.has(t)&&n.delete(t),r.set(t,!0),a++,s&&l._$postProperty();continue}n.set(l._$id,l)}else s&&l._$removeWorkerInstance(),At.setRemoveTimer(_),l._$loaderInfo&&l._$characterId&&At.setRemoveTimer(`${l._$loaderInfo._$id}@${l._$characterId}`),l._$graphics&&At.setRemoveTimer(l._$graphics._$uniqueKey),l.willTrigger(wt.REMOVED)&&l.dispatchEvent(new wt(wt.REMOVED,!0)),l.willTrigger(wt.REMOVED_FROM_STAGE)&&l.dispatchEvent(new wt(wt.REMOVED_FROM_STAGE,!0)),l._$added=!1,l._$addedStage=!1,l._$active=!1,l._$updated=!0,l._$filters=null,l._$blendMode=null,l._$isNext=!0,l._$placeObject=null,l._$created=!1,l._$posted=!1,l instanceof Zt&&(l._$executeRemovedFromStage(),l._$removeParentAndStage())}if(i)for(let t=0;t<i.length;++t){const e=i[t];if(r.has(e))continue;const s=n.has(e)?n.get(e):this._$createInstance(e);s._$placeId=t;const a=s.loopConfig;a&&(s._$currentFrame=s._$getLoopFrame(a)),h.push(s),s._$name&&this._$names.set(s._$name,s)}ht(r),ht(n),t.length=0,t.push(...h),at(h)}return this._$children}_$clearChildren(){this._$doChanged(),x(),this._$names.clear(),this._$needsChildren=!0}_$addChild(t){return t._$parent=this,t._$stage&&t._$root||(t._$stage=this._$stage,t._$root=this._$root),t instanceof Zt&&(t._$setParentAndStage(),t._$wait=!0),t._$added||(t.willTrigger(wt.ADDED)&&t.dispatchEvent(new wt(wt.ADDED,!0)),t._$added=!0),null===this._$stage||t._$addedStage||(t.willTrigger(wt.ADDED_TO_STAGE)&&t.dispatchEvent(new wt(wt.ADDED_TO_STAGE)),t._$addedStage=!0,t instanceof Zt&&t._$executeAddedToStage(),Tr&&(t._$createWorkerInstance(),this._$postChildrenIds())),this._$doChanged(),t._$active=!0,t._$updated=!0,t._$isNext=!0,t}_$setParentAndStage(){const t=this._$needsChildren?this._$getChildren():this._$children;for(let e=0;e<t.length;++e){const i=t[e];i._$root=this._$root,i._$stage=this._$stage,i instanceof Zt&&(i._$setParentAndStage(),i._$wait=!0)}}_$executeAddedToStage(){const t=this._$needsChildren?this._$getChildren():this._$children,e=nt();for(let i=0;i<t.length;++i){const s=t[i];s&&(e.push(s._$instanceId),s._$addedStage||(Tr&&s._$createWorkerInstance(),s.willTrigger(wt.ADDED_TO_STAGE)&&s.dispatchEvent(new wt(wt.ADDED_TO_STAGE)),s._$addedStage=!0),s instanceof Zt&&s._$executeAddedToStage())}Tr&&this._$postChildrenIds(e),at(e)}_$remove(t,e=!0){t._$transform._$transform(),t.hasEventListener(wt.ENTER_FRAME)&&t.removeAllEventListener(wt.ENTER_FRAME),t.hasEventListener(wt.EXIT_FRAME)&&t.removeAllEventListener(wt.EXIT_FRAME),t.hasEventListener(wt.FRAME_CONSTRUCTED)&&t.removeAllEventListener(wt.FRAME_CONSTRUCTED),t.hasEventListener(wt.RENDER)&&t.removeAllEventListener(wt.RENDER),t.hasEventListener(wt.ACTIVATE)&&t.removeAllEventListener(wt.ACTIVATE),t.hasEventListener(wt.DEACTIVATE)&&t.removeAllEventListener(wt.DEACTIVATE),t.hasEventListener("keyDown")&&t.removeAllEventListener("keyDown"),t.hasEventListener("keyUp")&&t.removeAllEventListener("keyUp");const i=this._$needsChildren?this._$getChildren():this._$children,s=this.getChildIndex(t);return i.splice(s,1),this._$names.delete(t.name),e&&(t.willTrigger(wt.REMOVED)&&t.dispatchEvent(new wt(wt.REMOVED,!0)),null!==this._$stage&&(Tr&&(t._$removeWorkerInstance(),this._$postChildrenIds()),t.willTrigger(wt.REMOVED_FROM_STAGE)&&t.dispatchEvent(new wt(wt.REMOVED_FROM_STAGE)),t instanceof Zt&&t._$executeRemovedFromStage()),At.setRemoveTimer(t._$instanceId),t._$loaderInfo&&t._$characterId&&At.setRemoveTimer(`${t._$loaderInfo._$id}@${t._$characterId}`),t._$graphics&&At.setRemoveTimer(t._$graphics._$uniqueKey),t instanceof Zt&&t._$removeParentAndStage(),t._$stage=null,t._$parent=null,t._$root=null,t._$active=!1,t._$wait=!0,t._$updated=!0,t._$added=!1,t._$addedStage=!1,t._$created=!1,t._$posted=!1,this._$doChanged()),t}_$executeRemovedFromStage(){const t=this._$getChildren().slice(0);for(let e=0;e<t.length;++e){const i=t[e];i&&(i._$addedStage&&(Tr&&i._$removeWorkerInstance(),i.willTrigger(wt.REMOVED_FROM_STAGE)&&i.dispatchEvent(new wt(wt.REMOVED_FROM_STAGE)),i._$created=!1,i._$posted=!1,i._$addedStage=!1),i instanceof Zt&&i._$executeRemovedFromStage())}}_$removeParentAndStage(){const t=this._$needsChildren?this._$getChildren():this._$children;for(let e=0;e<t.length;++e){const i=t[e];At.setRemoveTimer(i._$instanceId),i._$loaderInfo&&i._$characterId&&At.setRemoveTimer(`${i._$loaderInfo._$id}@${i._$characterId}`),i._$graphics&&At.setRemoveTimer(i._$graphics._$uniqueKey),i instanceof Zt&&i._$removeParentAndStage(),i._$stage=null,i._$root=null,i._$addedStage=!1}if("_$sounds"in this){const t=this._$sounds;if(t.size)for(const e of t.values())for(let t=0;t<e.length;++t)e[t].stop()}this._$needsChildren=!0}_$prepareActions(){const t=this._$needsChildren?this._$getChildren():this._$children;for(let e=t.length-1;e>-1;--e)t[e]._$prepareActions();this._$executeAddedEvent()}_$nextFrame(){let t=!1;const e=this._$getChildren();for(let i=e.length-1;i>-1;--i){const s=e[i];s._$isNext&&(t?s._$nextFrame():t=s._$nextFrame())}return this._$executeAddedEvent(),this._$isNext=t,!this._$posted&&Tr&&this._$postProperty(),this._$isNext}_$clip(t,e){let i=e;const s=this._$transform._$rawMatrix();1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=ut(e,s));const r=this._$getChildren();for(let e=0;e<r.length;++e){const s=r[e];s._$isMask||(s._$clip(t,i),s._$updated=!1)}i!==e&&et(i)}_$preDraw(t,e){let i=e;const s=this._$transform._$rawMatrix();if((s!==Vs&&1!==s[0]||0!==s[1]||0!==s[2]||1!==s[3]||0!==s[4]||0!==s[5])&&(i=ut(e,s)),!i[0]&&!i[1]||!i[2]&&!i[3])return i!==e&&et(i),null;const r=V.pop()||{isLayer:!1,isUpdated:null,canApply:null,matrix:null,color:null,blendMode:"normal",filters:null,sw:0,sh:0};r.matrix=i;const n=this._$filters||this.filters,a=this._$blendMode||this.blendMode;if(n.length>0||"normal"!==a){const s=this._$getBounds(null),h=gt(s,i);Q(s);const o=+h.xMax,l=+h.xMin,c=+h.yMax,_=+h.yMin;Q(h);const $=v.ceil(v.abs(o-l)),u=v.ceil(v.abs(c-_));if(0>=$||0>=u)return Et(r),i!==e&&et(i),null;let d=+v.sqrt(i[0]*i[0]+i[1]*i[1]);if(!E.isInteger(d)){const t=d.toString(),e=t.indexOf("e");-1!==e&&(d=+t.slice(0,e)),d=+d.toFixed(4)}let g=+v.sqrt(i[2]*i[2]+i[3]*i[3]);if(!E.isInteger(g)){const t=g.toString(),e=t.indexOf("e");-1!==e&&(g=+t.slice(0,e)),g=+g.toFixed(4)}r.canApply=this._$canApply(n);let f=K(0,$,0,u);if(r.canApply&&n)for(let t=0;t<n.length;++t)f=n[t]._$generateFilterRect(f,d,g);const p=t.frameBuffer.currentAttachment;if(!p||!p.texture||l-f.xMin>p.width||_-f.yMin>p.height)return Q(f),Et(r),i!==e&&et(i),null;if(0>l+f.xMax||0>_+f.yMax)return Q(f),Et(r),i!==e&&et(i),null;let m=i[4]-l,x=i[5]-_;t._$startLayer(K(l,o,_,c));const b=this._$isFilterUpdated(i,n,r.canApply),T=this._$getLayerBounds(i),y=v.ceil(v.abs(T.xMax-T.xMin)),A=v.ceil(v.abs(T.yMax-T.yMin));Q(T);const M=y-f.xMax+f.xMin,S=A-f.yMax+f.yMin;m+=M,x+=S,r.sw=M,r.sh=S,b&&t._$saveAttachment(v.ceil($+M),v.ceil(u+S),!0),r.isLayer=!0,r.isUpdated=b,r.filters=n,r.blendMode=a,r.color=it(),r.matrix=tt(i[0],i[1],i[2],i[3],m,x),i!==e&&et(i),Q(f)}return r}_$postDraw(t,e,i,s){t.drawInstacedArray();const r=nt(this._$instanceId,"f"),n=t.frameBuffer,a=s.matrix;let h=0,o=0,l=At.get(r);if(!l||s.isUpdated){l&&At.set(r,null),l=n.getTextureFromCurrentAttachment();const i=s.filters;let c=!1;if(i&&i.length){for(let s=0;s<i.length;++s)l=i[s]._$applyFilter(t,e);c=!0,h=t._$offsetX,o=t._$offsetY,t._$offsetX=0,t._$offsetY=0}l.filterState=c,l.matrix=`${a[0]}_${a[1]}_${a[2]}_${a[3]}`,l.offsetX=h,l.offsetY=o,At.set(r,l),t._$restoreAttachment()}l.offsetX&&(h=l.offsetX),l.offsetY&&(o=l.offsetY),t.reset(),t.globalAlpha=$t(i[3]+i[7]/255,0,1),t.globalCompositeOperation=s.blendMode;const c=t.getCurrentPosition();t.setTransform(1,0,0,1,c.xMin-h-s.sw,c.yMin-o-s.sh),t.drawImage(l,0,0,l.width,l.height,i),t._$endLayer(),et(s.matrix),Et(s),t.cachePosition=null}_$draw(t,e,i){if(!this._$visible)return;let s=i;const r=this._$transform._$rawColorTransform();if((r!==O&&1!==r[0]||1!==r[1]||1!==r[2]||1!==r[3]||0!==r[4]||0!==r[5]||0!==r[6]||0!==r[7])&&(s=dt(i,r)),!$t(s[3]+s[7]/255,0,1,0))return;const n=this._$getChildren(),a=n.length;if(!a)return;const h=this._$preDraw(t,e);if(!h)return;if(h.isLayer&&!h.isUpdated)return void this._$postDraw(t,e,s,h);const o=h.matrix,l=h.isLayer&&h.color?h.color:s;let c=!0,_=0;const $=ar(),u=t.isLayer,d=this._$isUpdated();for(let e=0;e<a;++e){const i=n[e];if(d&&(i._$placeObject=null),i._$isMask)continue;const s=i._$blendMode||i.blendMode;if(("alpha"===s||"erase"===s)&&!u)continue;if(_&&(i._$placeId>_||i._$clipDepth>0)&&(t.restore(),c&&t._$leaveClip(),_=0,c=!0),!c)continue;if(i._$clipDepth>0){_=i._$clipDepth,c=i._$shouldClip(o),c&&(t.save(),c=i._$startClip(t,o));continue}const r=i._$mask;if(r){let e;if(r._$updated=!1,this===r._$parent)e=o;else{e=P;let i=r._$parent;for(;i;)e=ut(i._$transform._$rawMatrix(),e),i=i._$parent;const s=$.scaleX,n=tt(s,0,0,s,0,0);if(e=ut(n,e),et(n),t.isLayer){const i=t.getCurrentPosition();e[4]-=i.xMin,e[5]-=i.yMin}}if(!r._$shouldClip(e))continue;const i=r._$startClip(t,e);if(t.save(),!i){t.restore();continue}}i._$draw(t,o,l),i._$updated=!1,r&&(t.restore(),t._$leaveClip())}if(_&&(t.restore(),c&&t._$leaveClip()),h.isLayer)return this._$postDraw(t,e,s,h);h.matrix!==e&&et(h.matrix),s!==i&&st(s),Et(h)}_$mouseHit(t,e,i,s=!0){let r=e;const n=this._$transform._$rawMatrix();n!==P&&(r=ut(e,n));const a=this._$getChildren(),h=nt(),o=nt(),l=ot();let c=0,_=0;for(let t=0;t<a.length;++t){const e=a[t];(e._$visible||e._$hitObject)&&(e._$clipDepth?(_=h.length,c=e._$clipDepth,h.push(e)):(c&&e._$placeId>c&&(_=0,c=0),_&&l.set(e._$instanceId,_),o.push(e)))}const $=this._$mouseChildren&&s;let u=!1;const d=this._$root===this;for(;o.length;){const e=o.pop();if(e._$isMask)continue;if(d&&!(e instanceof Jt))continue;if(l.has(e._$instanceId)){const s=l.get(e._$instanceId);if(!s)continue;if(!h[s]._$hit(t,r,i,!0))continue}const s=e._$mask;if(s)if(this===s._$parent){if(!s._$hit(t,r,i,!0))continue}else{let e=P,r=s._$parent;for(;r;)e=ut(r._$transform._$rawMatrix(),e),r=r._$parent;if(!s._$hit(t,e,i,!0))continue}if(e._$mouseHit(t,r,i,$)||e._$hitArea&&e._$hitArea._$mouseHit(t,r,i,$)){if(e._$root===e)return!0;if(!$)return!0;if(u=!0,e instanceof Jt){if(!e.mouseEnabled&&!e._$hitObject)continue;return Qs||i.pointer||("_$text"in e&&"type"in e&&"input"===e.type&&(i.pointer="text"),"buttonMode"in e&&"useHandCursor"in e&&e.buttonMode&&e.useHandCursor&&(i.pointer="pointer")),i.hit||(i.hit=!e.mouseEnabled&&e._$hitObject?e._$hitObject:e),!0}}}return at(h),at(o),ht(l),r!==e&&et(r),u}_$hit(t,e,i,s=!1){let r=e;const n=this._$transform._$rawMatrix();n!==P&&(r=ut(e,n));const a=this._$getChildren();for(let e=a.length;e>-1;--e){const n=a[e];if(!n._$isMask&&n._$hit(t,r,i,s))return!0}return r!==e&&et(r),!1}_$createInstance(t){if(!this._$dictionary)throw new Error("the dictionary is null.");const e=this._$dictionary[t],i=this._$loaderInfo;if(!i||!i._$data)throw new Error("the loaderInfo or data is null.");const s=i._$data.characters[e.characterId],r=vr(s.extends);return r._$build(e,this),r._$id=t,r}_$outCheck(t,e){let i=P,s=this._$parent;for(;s;)i=ut(s._$transform._$rawMatrix(),i),s=s._$parent;tr.setTransform(1,0,0,1,0,0),tr.beginPath();const r={x:t,y:e,pointer:"",hit:null};return this._$mouseHit(tr,i,r)}_$createWorkerInstance(){if(this._$created||!Tr)return;this._$created=!0,this._$posted=!0,this._$updated=!1;let t=0;const e=sr();e[t++]=this._$instanceId,e[t++]=this._$parent?this._$parent._$instanceId:-1,this._$registerProperty(e,2);const i=rr();i.command="createDisplayObjectContainer",i.buffer=e;const s=nt(e.buffer);Tr.postMessage(i,s),nr(i),at(s),this._$postChildrenIds()}_$postProperty(){if(!Tr)return;this._$postChildrenIds();const t=nt(),e=this._$createMessage();Tr.postMessage(e,t),at(t),this._$posted=!0,this._$updated=!1}_$postChildrenIds(t=null){if(!Tr||!this._$created)return;let e=!1;if(!t){const i=this._$getChildren();t=nt();for(let e=0;e<i.length;++e)t.push(i[e]._$instanceId);e=!0}const i=new Int32Array(t.length+1);i[0]=this._$instanceId,i.set(t,1);const s=rr();s.command="setChildren",s.buffer=i;const r=nt(i.buffer);Tr.postMessage(s,r),nr(s),at(r),e&&at(t)}}class te{constructor(t=0,i=0){this._$instanceId=e(),this._$width=0|t,this._$height=0|i,this._$buffer=null,this._$image=null,this._$canvas=null,this._$texture=null}static toString(){return"[class BitmapData]"}static get namespace(){return"next2d.display.BitmapData"}toString(){return"[object BitmapData]"}get namespace(){return"next2d.display.BitmapData"}get instanceId(){return this._$instanceId}get height(){return this._$height}get buffer(){return this._$buffer}set buffer(t){if(this._$canvas=null,this._$image=null,this._$buffer=t,this._$texture){const t=ar().context;t&&t.frameBuffer.releaseTexture(this._$texture),this._$texture=null}}get image(){return this._$image}set image(t){if(this._$canvas=null,this._$buffer=null,this._$image=t,this._$texture){const t=ar().context;t&&t.frameBuffer.releaseTexture(this._$texture),this._$texture=null}t&&(this._$width=t.width,this._$height=t.height)}get canvas(){return this._$canvas}set canvas(t){if(this._$image=null,this._$buffer=null,this._$canvas=t,this._$texture){const t=ar().context;t&&t.frameBuffer.releaseTexture(this._$texture),this._$texture=null}t&&(this._$width=t.width,this._$height=t.height)}get width(){return this._$width}clone(){const t=new te(this.width,this.height);if(null!==this._$image||null!==this._$canvas){const e=At.getCanvas();e.width=this.width,e.height=this.height;const i=e.getContext("2d");if(!i)throw new Error("the context is null.");this._$image&&i.drawImage(this._$image,0,0),this._$canvas&&i.drawImage(this._$canvas,0,0),t.canvas=e}else null!==this._$buffer&&(t._$buffer=this._$buffer.slice());return t}getTexture(){const{width:t,height:e}=this;if(!t||!e)return null;const i=ar().context;if(!i)throw new Error("the context is null.");return null!==this._$texture||(null!==this._$image&&(this._$texture=i.frameBuffer.createTextureFromImage(this._$image)),null!==this._$canvas&&(this._$texture=i.frameBuffer.createTextureFromCanvas(this._$canvas)),null!==this._$buffer&&(this._$texture=i.frameBuffer.createTextureFromPixels(t,e,this._$buffer,!0))),this._$texture}draw(t,e=null,i=null,s=null,r=null){const{width:n,height:a}=this;if(!n||!a)return;const h=ar(),o=h._$width,l=h._$height;(n>o||a>l)&&(h._$width=n,h._$height=a,h._$resizeCanvas(n,a,h.scaleX));const c=i?i._$colorTransform:O;let _=e?e._$matrix:P;if(e){const e=t._$transform.matrix;e.invert(),_=ut(_,e._$matrix),lr(e)}if(s||(s=At.getCanvas()),Tr){t._$stage||(t instanceof Zt?Er&&Er(t):(t._$createWorkerInstance(),t._$postProperty())),s.width=n,s.height=a;const e=s.getContext("2d");if(!e)throw new Error("the context is null.");e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,n,a);const i=t._$instanceId;Xs.set(i,{source:t,context:e,callback:r});const h=nt(),o={command:"bitmapDraw",sourceId:i,width:n,height:a};1===_[0]&&0===_[1]&&0===_[2]&&1===_[3]&&0===_[4]&&0===_[5]||(o.matrix=_.slice(),h.push(o.matrix.buffer)),1===c[0]&&1===c[1]&&1===c[2]&&1===c[3]&&0===c[4]&&0===c[5]&&0===c[6]&&0===c[7]||(o.colorTransform=c.slice(),h.push(o.colorTransform.buffer)),Tr.postMessage(o,h),at(h)}else{const e=h.context;if(!e)throw new Error("the context is null.");e.reset(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,h._$width,h._$height),e.beginPath(),t._$draw(e,_,c),e.drawInstacedArray(),e.frameBuffer.transferToMainTexture(),s.width=n,s.height=a;const i=s.getContext("2d");if(!i)return;i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,n,a),i.drawImage(h.canvas,0,0),r&&r(s)}e&&lr(e),i&&_r(i)}}class ee extends Ct{constructor(t,e){super(),this._$name=`${t}`,this._$frame=0|e}static toString(){return"[class FrameLabel]"}static get namespace(){return"next2d.display.FrameLabel"}toString(){return"[object FrameLabel]"}get namespace(){return"next2d.display.FrameLabel"}get frame(){return this._$frame}get name(){return this._$name}}class ie{constructor(t,e=null,i=!0,s=!1){this._$bitmapData=t,this._$matrix=e,this._$repeat=i,this._$smooth=s}clone(){return new ie(this._$bitmapData.clone(),this._$matrix?this._$matrix.clone():null,this._$repeat,this._$smooth)}toArray(){return nt(this._$bitmapData,this._$matrix,this._$repeat,this._$smooth)}}class se{constructor(t,e,i,s,r=null,n="pad",a="rgb",h=0){this._$type=t,this._$colors=e,this._$alphas=i,this._$ratios=s,this._$matrix=r,this._$spreadMethod=n,this._$interpolationMethod=a,this._$focalPointRatio=h,this._$colorStops=nt()}get colorStops(){if(!this._$colorStops.length){const t=v.min(v.min(this._$alphas.length,this._$colors.length),this._$ratios.length);for(let e=0;e<t;++e){const t=this._$colors[e],i="string"==typeof t?ft(t):t,s=Tt(i,this._$alphas[e]);this._$colorStops[e]={ratio:this._$ratios[e]/255,R:s.R,G:s.G,B:s.B,A:s.A}}}return this._$colorStops}toArray(){return nt(this._$type,this.colorStops,this._$matrix?this._$matrix._$matrix:P,this._$spreadMethod,this._$interpolationMethod,this._$focalPointRatio)}clone(){return new se(this._$type,this._$colors.slice(),this._$alphas.slice(),this._$ratios.slice(),this._$matrix?this._$matrix.clone():null,this._$spreadMethod,this._$interpolationMethod,this._$focalPointRatio)}}class re{constructor(t=null){this._$displayObject=t,this._$maxAlpha=0,this._$pointerX=0,this._$pointerY=0,this._$canDraw=!1,this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillStyleR=0,this._$fillStyleG=0,this._$fillStyleB=0,this._$fillStyleA=0,this._$doFill=!1,this._$lineType=0,this._$lineGradient=null,this._$caps="none",this._$joints="round",this._$miterLimit=0,this._$lineWidth=1,this._$lineStyleR=0,this._$lineStyleG=0,this._$lineStyleB=0,this._$lineStyleA=0,this._$doLine=!1,this._$xMin=E.MAX_VALUE,this._$xMax=-E.MAX_VALUE,this._$yMin=E.MAX_VALUE,this._$yMax=-E.MAX_VALUE,this._$buffer=null,this._$recode=null,this._$fills=null,this._$lines=null,this._$uniqueKey="",this._$cacheKeys=nt(),this._$cacheParams=nt(0,0,0),this._$bitmapId=0,this._$mode="shape",this._$posted=!1}static toString(){return"[class Graphics]"}static get namespace(){return"next2d.display.Graphics"}toString(){return"[object Graphics]"}get namespace(){return"next2d.display.Graphics"}static get MOVE_TO(){return 0}static get CURVE_TO(){return 1}static get LINE_TO(){return 2}static get CUBIC(){return 3}static get ARC(){return 4}static get FILL_STYLE(){return 5}static get STROKE_STYLE(){return 6}static get END_FILL(){return 7}static get END_STROKE(){return 8}static get BEGIN_PATH(){return 9}static get GRADIENT_FILL(){return 10}static get GRADIENT_STROKE(){return 11}static get CLOSE_PATH(){return 12}static get BITMAP_FILL(){return 13}static get BITMAP_STROKE(){return 14}beginBitmapFill(t,e=null,i=!0,s=!1){return this._$doFill&&this.endFill(),this._$fills||(this._$fills=nt()),this._$maxAlpha=1,this._$doFill=!0,this._$canDraw=!0,this._$fills.push(re.BEGIN_PATH),this._$fillType=re.BITMAP_FILL,this._$fillBitmap=new ie(t,e,i,s),this}beginFill(t=0,e=1){this._$doFill&&this.endFill(),this._$fills||(this._$fills=nt()),t=$t(pt(t),0,16777215,0),e=$t(e,0,1,1),this._$maxAlpha=v.max(this._$maxAlpha,e),this._$doFill=!0,this._$canDraw=!0,this._$fills.push(re.BEGIN_PATH);const i=Tt(t,e);return this._$fillType=re.FILL_STYLE,this._$fillStyleR=i.R,this._$fillStyleG=i.G,this._$fillStyleB=i.B,this._$fillStyleA=i.A,this}beginGradientFill(t,e,i,s,r=null,n="pad",a="rgb",h=0){this._$doFill&&this.endFill(),this._$fills||(this._$fills=nt());for(let t=0;t<i.length;++t)this._$maxAlpha=v.max(this._$maxAlpha,i[t]);return this._$doFill=!0,this._$canDraw=!0,this._$fills.push(re.BEGIN_PATH),this._$fillType=re.GRADIENT_FILL,this._$fillGradient=new se(t,e,i,s,r,n,a,h),this}clear(){return this._$maxAlpha=0,this._$pointerX=0,this._$pointerY=0,this._$canDraw=!1,this._$bitmapId=0,this._$mode="shape",this._$posted=!1,this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillStyleR=0,this._$fillStyleG=0,this._$fillStyleB=0,this._$fillStyleA=0,this._$doFill=!1,this._$lineType=0,this._$lineGradient=null,this._$caps="none",this._$joints="round",this._$miterLimit=0,this._$lineWidth=1,this._$lineStyleR=0,this._$lineStyleG=0,this._$lineStyleB=0,this._$lineStyleA=0,this._$doLine=!1,this._$xMin=E.MAX_VALUE,this._$xMax=-E.MAX_VALUE,this._$yMin=E.MAX_VALUE,this._$yMax=-E.MAX_VALUE,this._$recode&&at(this._$recode),this._$fills&&at(this._$fills),this._$lines&&at(this._$lines),this._$buffer=null,this._$recode=null,this._$fills=null,this._$lines=null,this._$cacheKeys.length=0,this._$uniqueKey="",this._$cacheParams.fill(0),this._$restart(),this}clone(){const t=new re;return t.copyFrom(this),t}copyFrom(t){t._$fillGradient&&(this._$fillGradient=t._$fillGradient.clone()),t._$fillBitmap&&(this._$fillBitmap=t._$fillBitmap.clone()),this._$doFill=t._$doFill,this._$fillType=t._$fillType,this._$fillStyleR=t._$fillStyleR,this._$fillStyleG=t._$fillStyleG,this._$fillStyleB=t._$fillStyleB,this._$fillStyleA=t._$fillStyleA,t._$lineGradient&&(this._$lineGradient=t._$lineGradient.clone()),this._$doLine=t._$doLine,this._$lineType=t._$lineType,this._$caps=t._$caps,this._$joints=t._$joints,this._$miterLimit=t._$miterLimit,this._$lineWidth=t._$lineWidth,this._$lineStyleR=t._$lineStyleR,this._$lineStyleG=t._$lineStyleG,this._$lineStyleB=t._$lineStyleB,this._$lineStyleA=t._$lineStyleA,this._$xMin=t._$xMin,this._$xMax=t._$xMax,this._$yMin=t._$yMin,this._$yMax=t._$yMax,this._$maxAlpha=t._$maxAlpha,this._$pointerX=t._$pointerX,this._$pointerY=t._$pointerY,this._$canDraw=t._$canDraw,t._$fills&&(this._$fills=t._$fills.slice(0)),t._$lines&&(this._$lines=t._$lines.slice(0)),t._$recode&&(this._$recode=t._$recode.slice(0))}cubicCurveTo(t,e,i,s,r,n){return r=+r||0,n=+n||0,this._$pointerX===r&&this._$pointerY===n||(t=+t||0,e=+e||0,i=+i||0,s=+s||0,this._$setBounds(t,e),this._$setBounds(i,s),this._$setBounds(r,n),this._$margePath(nt(re.CUBIC,t,e,i,s,r,n)),this._$pointerX=r,this._$pointerY=n,this._$restart()),this}curveTo(t,e,i,s){return i=+i||0,s=+s||0,this._$pointerX===i&&this._$pointerY===s||(t=+t||0,e=+e||0,this._$setBounds(t,e),this._$setBounds(i,s),this._$margePath(nt(re.CURVE_TO,t,e,i,s)),this._$pointerX=i,this._$pointerY=s,this._$restart()),this}drawCircle(t,e,i){return t=+t||0,e=+e||0,i=+i||0,i=v.round(i),this._$setBounds(t-i,e-i),this._$setBounds(t+i,e+i),this._$margePath(nt(re.MOVE_TO,t+i,e,re.ARC,t,e,i)),this._$pointerX=t,this._$pointerY=e,this._$restart(),this}drawEllipse(t,e,i,s){t=+t||0,e=+e||0,i=+i||0,s=+s||0;const r=(i=v.round(i))/2,n=(s=v.round(s))/2,a=t+r,h=e+n,o=t+i,l=e+s,c=4/3*(v.SQRT2-1),_=c*r,$=c*n;return this.moveTo(a,e).cubicCurveTo(a+_,e,o,h-$,o,h).cubicCurveTo(o,h+$,a+_,l,a,l).cubicCurveTo(a-_,l,t,h+$,t,h).cubicCurveTo(t,h-$,a-_,e,a,e)}drawRect(t,e,i,s){t=+t||0,e=+e||0,i=+i||0,s=+s||0;const r=v.round(t+i),n=v.round(e+s);return this.moveTo(t,e).lineTo(t,n).lineTo(r,n).lineTo(r,e).lineTo(t,e)}drawRoundRect(t,e,i,s,r,n=NaN){t=+t||0,e=+e||0,i=+i||0,s=+s||0,r=+r||0,n=+n||r,i=v.round(i),s=v.round(s);const a=(r=v.round(r))/2,h=(n=v.round(n))/2,o=4/3*(v.SQRT2-1),l=o*a,c=o*h,_=t+a,$=t+i,u=$-a,d=e+h,g=e+s,f=g-h;return this.moveTo(_,e).lineTo(u,e).cubicCurveTo(u+l,e,$,d-c,$,d).lineTo($,f).cubicCurveTo($,f+c,u+l,g,u,g).lineTo(_,g).cubicCurveTo(_-l,g,t,f+c,t,f).lineTo(t,d).cubicCurveTo(t,d-c,_-l,e,_,e)}endFill(){if(this._$doFill&&this._$fills&&this._$fills.length>7)switch(this._$recode||(this._$recode=nt()),this._$fills[2]===this._$fills[this._$fills.length-2]&&this._$fills[3]===this._$fills[this._$fills.length-1]||this._$fills.push(re.LINE_TO,this._$fills[2],this._$fills[3]),this._$recode.push(...this._$fills),this._$fillType){case re.FILL_STYLE:this._$recode.push(this._$fillType,this._$fillStyleR,this._$fillStyleG,this._$fillStyleB,this._$fillStyleA,re.END_FILL);break;case re.GRADIENT_FILL:this._$fillGradient&&this._$recode.push(this._$fillType,...this._$fillGradient.toArray());break;case re.BITMAP_FILL:this._$fillBitmap&&this._$recode.push(this._$fillType,...this._$fillBitmap.toArray())}return this._$fills&&(at(this._$fills),this._$fills=null),this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillStyleR=0,this._$fillStyleG=0,this._$fillStyleB=0,this._$fillStyleA=0,this._$doFill=!1,this._$restart(),this}endLine(){if(this._$doLine&&this._$lines)switch(this._$recode||(this._$recode=nt()),this._$recode.push(...this._$lines),at(this._$lines),this._$lines=null,this._$lineType){case re.STROKE_STYLE:this._$recode.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,this._$lineStyleR,this._$lineStyleG,this._$lineStyleB,this._$lineStyleA,re.END_STROKE);break;case re.GRADIENT_STROKE:this._$lineGradient&&this._$recode.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,...this._$lineGradient.toArray());break;case re.BITMAP_STROKE:this._$fillBitmap&&this._$recode.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,...this._$fillBitmap.toArray())}return this._$lineType=0,this._$lineWidth=0,this._$lineGradient=null,this._$lineStyleR=0,this._$lineStyleG=0,this._$lineStyleB=0,this._$lineStyleA=0,this._$caps="none",this._$joints="round",this._$miterLimit=0,this._$doLine=!1,this._$restart(),this}lineBitmapStyle(t,e=null,i=!0,s=!1){return this._$doLine&&this.endLine(),this._$lines||(this._$lines=nt()),this._$maxAlpha=1,this._$doLine=!0,this._$canDraw=!0,this._$lines.push(re.BEGIN_PATH),this._$lineType=re.BITMAP_STROKE,this._$fillBitmap=new ie(t,e,i,s),this}lineGradientStyle(t,e,i,s,r=null,n="pad",a="rgb",h=0){if(!this._$doLine)return this;this._$lines||(this._$lines=nt());for(let t=0;t<i.length;++t)this._$maxAlpha=v.max(this._$maxAlpha,i[t]);return this._$lines.push(re.BEGIN_PATH),this._$lineType=re.GRADIENT_STROKE,this._$lineGradient=new se(t,e,i,s,r,n,a,h),this}lineStyle(t=1,e=0,i=1,s="round",r="round",n=3){this._$doLine&&this.endLine(),this._$lines||(this._$lines=nt()),e=$t(pt(e),0,16777215,0),i=$t(+i,0,1,1),this._$maxAlpha=v.max(this._$maxAlpha,i),this._$doLine=!0,this._$canDraw=!0,this._$pointerX||this._$pointerY?this._$lines.push(re.BEGIN_PATH,re.MOVE_TO,this._$pointerX,this._$pointerY):this._$lines.push(re.BEGIN_PATH);const a=Tt(e,i);return this._$lineType=re.STROKE_STYLE,this._$lineStyleR=a.R,this._$lineStyleG=a.G,this._$lineStyleB=a.B,this._$lineStyleA=a.A,this._$lineWidth=t,this._$caps=`${s}`,this._$joints=`${r}`,"miter"===this._$joints&&(this._$miterLimit=n),this}lineTo(t,e){return t=+t||0,e=+e||0,this._$pointerX===t&&this._$pointerY===e||(this._$setBounds(t,e),this._$margePath(nt(re.LINE_TO,t,e)),this._$pointerX=t,this._$pointerY=e,this._$restart()),this}moveTo(t,e){t=+t||0,e=+e||0,this._$pointerX=t,this._$pointerY=e,this._$setBounds(t,e);let i=!1;return this._$doFill&&this._$fills&&this._$fills[this._$fills.length-3]===re.MOVE_TO&&(i=!0,this._$fills[this._$fills.length-2]=t,this._$fills[this._$fills.length-1]=e),this._$doLine&&this._$lines&&this._$lines[this._$lines.length-3]===re.MOVE_TO&&(i=!0,this._$lines[this._$lines.length-2]=t,this._$lines[this._$lines.length-1]=e),i||this._$margePath(nt(re.MOVE_TO,t,e)),this._$restart(),this}_$clip(t,e){const i=this._$getBounds(),s=gt(i,e);Q(i);const r=v.ceil(v.abs(s.xMax-s.xMin)),n=v.ceil(v.abs(s.yMax-s.yMin));switch(Q(s),!0){case 0===r:case 0===n:case r===-1/0:case n===-1/0:case r===b:case n===b:return}t.reset(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),this._$doDraw(t,null,!0),t.clip()}_$draw(t,e,i,s="normal",r=null){if(!this._$maxAlpha)return;const n=$t(i[3]+i[7]/255,0,1),a=this._$displayObject;let h=null!==a._$scale9Grid;const o=a._$transform._$rawMatrix();h&&(h=h&&v.abs(o[1])<.001&&v.abs(o[2])<1e-4);const l=this._$getBounds(),c=gt(l,e),_=c.xMax,$=c.xMin,u=c.yMax,d=c.yMin;Q(c);const g=v.ceil(v.abs(_-$)),f=v.ceil(v.abs(u-d));switch(!0){case 0===g:case 0===f:case g===-1/0:case f===-1/0:case g===b:case f===b:return}let p=+v.sqrt(e[0]*e[0]+e[1]*e[1]);if(!E.isInteger(p)){const t=p.toString(),e=t.indexOf("e");-1!==e&&(p=+t.slice(0,e)),p=+p.toFixed(4)}let m=+v.sqrt(e[2]*e[2]+e[3]*e[3]);if(!E.isInteger(m)){const t=m.toString(),e=t.indexOf("e");-1!==e&&(m=+t.slice(0,e)),m=+m.toFixed(4)}const x=null!==r&&r.length>0&&a._$canApply(r);let T=K(0,g,0,f);if(x&&r)for(let t=0;t<r.length;++t)T=r[t]._$generateFilterRect(T,p,m);const y=t.frameBuffer,A=y.currentAttachment;if(!A||$-T.xMin>A.width||d-T.yMin>A.height)return void Q(T);if(0>$+T.xMax||0>d+T.yMax)return void Q(T);Q(T),""===this._$uniqueKey&&(!h&&a._$loaderInfo&&a._$characterId?this._$uniqueKey=`${a._$loaderInfo._$id}@${this._$bitmapId||a._$characterId}`:this._$uniqueKey=this._$createCacheKey());const M=ar();if("bitmap"===this._$mode)this._$cacheKeys.length||(this._$cacheKeys=At.generateKeys(this._$uniqueKey));else if(!this._$cacheKeys.length||this._$cacheParams[0]!==p||this._$cacheParams[1]!==m||this._$cacheParams[2]!==i[7]){const t=nt();t[0]=p,t[1]=m,this._$cacheKeys=At.generateKeys(this._$uniqueKey,t,i),at(t),this._$cacheParams[0]=p,this._$cacheParams[1]=m,this._$cacheParams[2]=i[7]}if(t.cachePosition=At.get(this._$cacheKeys),!t.cachePosition){const s=y.currentAttachment;s&&s.mask&&t.stopStencil();let r=0,n=0;if("shape"===this._$mode){r=v.ceil(v.abs(l.xMax-l.xMin)*p),n=v.ceil(v.abs(l.yMax-l.yMin)*m);const e=t._$getTextureScale(r,n);e<1&&(r*=e,n*=e)}else r=v.ceil(v.abs(l.xMax-l.xMin)),n=v.ceil(v.abs(l.yMax-l.yMin));if(t.cachePosition=y.createCachePosition(r,n),t.bindRenderBuffer(t.cachePosition),t.reset(),"shape"===this._$mode?t.setTransform(p,0,0,m,-l.xMin*p,-l.yMin*m):t.setTransform(1,0,0,1,-l.xMin,-l.yMin),h){const i=M.scaleX,s=tt(i,0,0,i,0,0),r=ut(s,o);et(s);const n=a._$parent._$transform.concatenatedMatrix._$matrix,h=tt(n[0],n[1],n[2],n[3],n[4]*i-$,n[5]*i-d);et(n);const c=ut(h,r),_=c[4]-(e[4]-$),u=c[5]-(e[5]-d);et(c);const g=gt(l,r),f=+g.xMax,p=+g.xMin,m=+g.yMax,x=+g.yMin,b=v.ceil(v.abs(f-p)),T=v.ceil(v.abs(m-x));Q(g);const y=a._$scale9Grid,E={x:y.x,y:y.y,w:y.width,h:y.height};t.grid.enable(p,x,b,T,l,E,i,r[0],r[1],r[2],r[3],r[4],r[5],h[0],h[1],h[2],h[3],h[4]-_,h[5]-u),et(r),et(h)}this._$doDraw(t,i,!1),h&&t.grid.disable(),y.transferTexture(t.cachePosition),At.set(this._$cacheKeys,t.cachePosition),t._$bind(s)}let S=0,w=0;if(x){const i=this._$createBitmapTexture(t,t.cachePosition,p,m,g,f),s=a._$drawFilter(t,e,r,g,f,i);s.offsetX&&(S=s.offsetX),s.offsetY&&(w=s.offsetY),t.cachePosition=s}if(x||"bitmap"!==this._$mode){const i=v.atan2(e[1],e[0]),s=v.atan2(-e[2],e[3]);if(x||!i&&!s)t.setTransform(1,0,0,1,$-S,d-w);else{const r=l.xMin*p,n=l.yMin*m,a=v.cos(i),h=v.sin(i),o=v.cos(s),c=v.sin(s);t.setTransform(a,h,-c,o,r*a-n*c+e[4],r*h+n*o+e[5])}}else t.setTransform(e[0],e[1],e[2],e[3],l.xMin*e[0]+l.yMin*e[2]+e[4],l.xMin*e[1]+l.yMin*e[3]+e[5]);t.cachePosition&&(t.globalAlpha=n,t.imageSmoothingEnabled="shape"===this._$mode,t.globalCompositeOperation=s,t.drawInstance($-S,d-w,_,u,i),t.cachePosition=null),Q(l)}_$createBitmapTexture(t,e,i,s,r,n){if("bitmap"!==this._$mode)return null;t.drawInstacedArray();const a=t.frameBuffer,h=a.currentAttachment,o=a.createCacheAttachment(r,n);t._$bind(o),t.reset();const l=tt(i,0,0,s,r/2,n/2),c=t.getTextureFromRect(e),_=tt(1,0,0,1,-c.width/2,-c.height/2),$=ut(l,_);et(l),et(_),t.setTransform($[0],$[1],$[2],$[3],$[4],$[5]),t.drawImage(c,0,0,c.width,c.height);const u=a.getTextureFromCurrentAttachment();return t._$bind(h),a.releaseAttachment(o),a.textureManager.release(c),u}_$doDraw(t,e=null,i=!1){t.reset(),t.beginPath(),this._$runCommand(t,e,i)}_$hit(t,e,i,s=!1){return t.beginPath(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),this._$runCommand(t,null,s,i)}_$getBounds(){const t=this._$displayObject;return t&&t._$bounds?K(t._$bounds.xMin,t._$bounds.xMax,t._$bounds.yMin,t._$bounds.yMax):K(this._$xMin,this._$xMax,this._$yMin,this._$yMax)}_$restart(){this._$displayObject&&(this._$displayObject._$posted=!1,this._$displayObject._$isUpdated()||(this._$displayObject._$doChanged(),x(),At.removeCache(this._$displayObject._$instanceId),this._$displayObject._$characterId&&At.removeCache(this._$displayObject._$characterId)))}_$setBounds(t=0,e=0){this._$setFillBounds(t,e),this._$doLine&&this._$setLineBounds(t,e)}_$setFillBounds(t=0,e=0){this._$xMin=v.min(this._$xMin,t),this._$xMax=v.max(this._$xMax,t),this._$yMin=v.min(this._$yMin,e),this._$yMax=v.max(this._$yMax,e)}_$setLineBounds(t=0,e=0){this._$xMin=v.min(this._$xMin,v.min(t,this._$pointerX)),this._$xMax=v.max(this._$xMax,v.max(t,this._$pointerX)),this._$yMin=v.min(this._$yMin,v.min(e,this._$pointerY)),this._$yMax=v.max(this._$yMax,v.max(e,this._$pointerY));const i=this._$lineWidth/2,s=.5*v.PI,r=v.atan2(e-this._$pointerY,t-this._$pointerX),n=v.atan2(this._$pointerY-e,this._$pointerX-t),a=r+s,h=r-s,o=n+s,l=n-s;let c=t+i,_=-i+t,$=this._$pointerX+i,u=-i+this._$pointerX,d=e+i,g=-i+e,f=this._$pointerY+i,p=-i+this._$pointerY;switch(this._$xMin=v.min(this._$xMin,v.min(c,v.min(_,v.min($,u)))),this._$xMax=v.max(this._$xMax,v.max(c,v.max(_,v.max($,u)))),this._$yMin=v.min(this._$yMin,v.min(d,v.min(g,v.min(f,p)))),this._$yMax=v.max(this._$yMax,v.max(d,v.max(g,v.max(f,p)))),v.abs(a)%s!=0&&(c=t+v.cos(a)*i),v.abs(h)%s!=0&&(_=t+v.cos(h)*i),v.abs(o)%s!=0&&($=this._$pointerX+v.cos(o)*i),v.abs(l)%s!=0&&(u=this._$pointerX+v.cos(l)*i),a&&v.abs(a)%v.PI!=0&&(d=e+v.sin(a)*i),h&&v.abs(h)%v.PI!=0&&(g=e+v.sin(h)*i),o&&v.abs(o)%v.PI!=0&&(f=this._$pointerY+v.sin(o)*i),l&&v.abs(l)%v.PI!=0&&(p=this._$pointerY+v.sin(l)*i),this._$xMin=v.min(this._$xMin,v.min(c,v.min(_,v.min($,u)))),this._$xMax=v.max(this._$xMax,v.max(c,v.max(_,v.max($,u)))),this._$yMin=v.min(this._$yMin,v.min(d,v.min(g,v.min(f,p)))),this._$yMax=v.max(this._$yMax,v.max(d,v.max(g,v.max(f,p)))),this._$caps){case"round":if(v.abs(r)%s!=0){const e=t+v.cos(r)*i;this._$xMin=v.min(this._$xMin,e),this._$xMax=v.max(this._$xMax,e)}if(r&&v.abs(r)%v.PI!=0){const t=e+v.sin(r)*i;this._$yMin=v.min(this._$yMin,t),this._$yMax=v.max(this._$yMax,t)}if(v.abs(n)%s!=0){const t=this._$pointerX+v.cos(n)*i;this._$xMin=v.min(this._$xMin,t),this._$xMax=v.max(this._$xMax,t)}if(n&&v.abs(n)%v.PI!=0){const t=this._$pointerY+v.sin(n)*i;this._$yMin=v.min(this._$yMin,t),this._$yMax=v.max(this._$yMax,t)}break;case"square":if(v.abs(r)%s!=0){const t=v.cos(r)*i,e=c+t,s=_+t;this._$xMin=v.min(this._$xMin,v.min(e,s)),this._$xMax=v.max(this._$xMax,v.max(e,s))}if(v.abs(n)%s!=0){const t=v.cos(n)*i,e=$+t,s=u+t;this._$xMin=v.min(this._$xMin,v.min(e,s)),this._$xMax=v.max(this._$xMax,v.max(e,s))}if(r&&v.abs(r)%v.PI!=0){const t=v.sin(r)*i,e=d+t,s=g+t;this._$yMin=v.min(this._$yMin,v.min(e,s)),this._$yMax=v.max(this._$yMax,v.max(e,s))}if(n&&v.abs(n)%v.PI!=0){const t=v.sin(n)*i,e=f+t,s=p+t;this._$yMin=v.min(this._$yMin,v.min(e,s)),this._$yMax=v.max(this._$yMax,v.max(e,s))}}}_$margePath(t){this._$doFill&&this._$fills&&this._$fills.push(...t),this._$doLine&&this._$lines&&this._$lines.push(...t),at(t)}_$createCacheKey(){if(this._$doLine&&this.endLine(),this._$doFill&&this.endFill(),!this._$recode)return"";const t=this._$getRecodes();let e=0;for(let i=0;i<t.length;i++)e=(e<<5)-e+t[i],e|=0;return`${e}`}_$getRecodes(){if(this._$doLine&&this.endLine(),this._$doFill&&this.endFill(),this._$recode||(this._$recode=nt()),!this._$buffer){const t=nt(),e=this._$recode;for(let i=0;i<e.length;){const s=e[i++];switch(t.push(s),s){case re.BEGIN_PATH:case re.END_FILL:case re.END_STROKE:case re.CLOSE_PATH:break;case re.MOVE_TO:case re.LINE_TO:t.push(e[i++],e[i++]);break;case re.CURVE_TO:case re.FILL_STYLE:t.push(e[i++],e[i++],e[i++],e[i++]);break;case re.CUBIC:t.push(e[i++],e[i++],e[i++],e[i++],e[i++],e[i++]);break;case re.STROKE_STYLE:switch(t.push(e[i++]),e[i++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2)}switch(e[i++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2)}t.push(e[i++],e[i++],e[i++],e[i++],e[i++]);break;case re.ARC:t.push(e[i++],e[i++],e[i++]);break;case re.GRADIENT_FILL:{const s=e[i++],r=e[i++],n=e[i++],a=e[i++],h=e[i++],o=e[i++];t.push("linear"===s?0:1),t.push(r.length);for(let e=0;e<r.length;++e){const i=r[e];t.push(i.ratio,i.R,i.G,i.B,i.A)}switch(t.push(n[0],n[1],n[2],n[3],n[4],n[5]),a){case"reflect":t.push(0);break;case"repeat":t.push(1);break;default:t.push(2)}t.push("linearRGB"===h?0:1),t.push(o)}break;case re.GRADIENT_STROKE:{switch(t.push(e[i++]),e[i++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2)}switch(e[i++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2)}t.push(e[i++]);const s=e[i++],r=e[i++],n=e[i++],a=e[i++],h=e[i++],o=e[i++];t.push("linear"===s?0:1),t.push(r.length);for(let e=0;e<r.length;++e){const i=r[e];t.push(i.ratio,i.R,i.G,i.B,i.A)}switch(t.push(n[0],n[1],n[2],n[3],n[4],n[5]),a){case"reflect":t.push(0);break;case"repeat":t.push(1);break;default:t.push(2)}t.push("linearRGB"===h?0:1),t.push(o)}break;case re.BITMAP_FILL:{const s=e[i++];let r;if(null!==s.image||null!==s.canvas){const t=At.getCanvas(),e=s.width,i=s.height;t.width=e,t.height=i;const n=t.getContext("2d");if(!n)throw new Error("the context is null.");n.drawImage(s.image||s.canvas,0,0),r=new Uint8Array(n.getImageData(0,0,e,i).data),At.destroy(n)}else{if(null===s._$buffer)break;r=s._$buffer}t.push(s.width,s.height,this._$xMax-this._$xMin,this._$yMax-this._$yMin,r.length);for(let e=0;e<r.length;++e)t.push(r[e]);const n=e[i++];n?t.push(n[0],n[1],n[2],n[3],n[4],n[5]):t.push(1,0,0,1,0,0);const a=e[i++];t.push(a?1:0);const h=e[i++];t.push(h?1:0)}break;case re.BITMAP_STROKE:{switch(t.push(e[i++]),e[i++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2)}switch(e[i++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2)}t.push(e[i++]);const s=e[i++];let r;if(null!==s.image||null!==s.canvas){const t=At.getCanvas(),e=s.width,i=s.height;t.width=e,t.height=i;const n=t.getContext("2d");if(!n)throw new Error("the context is null.");n.drawImage(s.image||s.canvas,0,0),r=new Uint8Array(n.getImageData(0,0,e,i).data),At.destroy(n)}else{if(null===s._$buffer)break;r=s._$buffer}t.push(s.width,s.height,this._$xMax-this._$xMin,this._$yMax-this._$yMin,r.length);for(let e=0;e<r.length;++e)t.push(r[e]);const n=e[i++];n?t.push(n[0],n[1],n[2],n[3],n[4],n[5]):t.push(1,0,0,1,0,0);const a=e[i++];t.push(a?1:0);const h=e[i++];t.push(h?1:0)}}}this._$buffer=new A(t)}return this._$buffer.slice()}_$runCommand(t,e=null,i=!1,s=null){if(this._$doLine&&this.endLine(),this._$doFill&&this.endFill(),!this._$recode)return!1;const r=this._$recode,n=r.length;for(let a=0;a<n;)switch(r[a++]){case re.BEGIN_PATH:t.beginPath();break;case re.MOVE_TO:t.moveTo(r[a++],r[a++]);break;case re.LINE_TO:t.lineTo(r[a++],r[a++]);break;case re.CURVE_TO:t.quadraticCurveTo(r[a++],r[a++],r[a++],r[a++]);break;case re.FILL_STYLE:{if(i||s){a+=4;continue}const n=J();n[0]=r[a++]/255,n[1]=r[a++]/255,n[2]=r[a++]/255,n[3]=r[a++]/255,null!==e&&0!==e[7]&&(n[3]=v.max(0,v.min(n[3]*e[7],255))/255),t.fillStyle=n}break;case re.END_FILL:if(s&&"isPointInPath"in t&&t.isPointInPath(s.x,s.y))return!0;i||s||t.fill();break;case re.STROKE_STYLE:{if(i||s){a+=8;continue}t.lineWidth=r[a++],t.lineCap=r[a++],t.lineJoin=r[a++],t.miterLimit=r[a++];const n=J();n[0]=r[a++]/255,n[1]=r[a++]/255,n[2]=r[a++]/255,n[3]=r[a++]/255,null!==e&&0!==e[7]&&(n[3]=v.max(0,v.min(n[3]+e[7],255))/255),t.strokeStyle=n}break;case re.END_STROKE:if(s&&"isPointInStroke"in t&&t.isPointInStroke(s.x,s.y))return!0;i||s||t.stroke();break;case re.CLOSE_PATH:t.closePath();break;case re.CUBIC:t.bezierCurveTo(r[a++],r[a++],r[a++],r[a++],r[a++],r[a++]);break;case re.ARC:t.arc(r[a++],r[a++],r[a++],0,2*v.PI);break;case re.GRADIENT_FILL:{if(s&&"isPointInPath"in t&&t.isPointInPath(s.x,s.y))return!0;if(i||s||t instanceof CanvasRenderingContext2D){a+=6;continue}const n=r[a++],h=r[a++],o=r[a++],l=r[a++],c=r[a++],_=r[a++];let $;if("linear"===n){const e=ct(o);$=t.createLinearGradient(e[0],e[1],e[2],e[3],c,l)}else t.save(),t.transform(o[0],o[1],o[2],o[3],o[4],o[5]),$=t.createRadialGradient(0,0,0,0,0,819.2,c,l,_);for(let t=0;t<h.length;++t){const i=h[t];let s=i.A;e&&0!==e[7]&&(s=0|v.max(0,v.min(i.A+e[7],255))),$.addColorStop(i.ratio,J(i.R,i.G,i.B,s))}t.fillStyle=$,t.fill(),"radial"===n&&t.restore()}break;case re.GRADIENT_STROKE:{if(s&&"isPointInStroke"in t&&t.isPointInStroke(s.x,s.y))return!0;if(i||s||t instanceof CanvasRenderingContext2D){a+=12;continue}t.lineWidth=r[a++],t.lineCap=r[a++],t.lineJoin=r[a++],t.miterLimit=r[a++];const n=r[a++],h=r[a++],o=r[a++],l=r[a++],c=r[a++],_=r[a++];let $;if("linear"===n){const e=ct(o);$=t.createLinearGradient(e[0],e[1],e[2],e[3],c,l)}else t.save(),t.transform(o[0],o[1],o[2],o[3],o[4],o[5]),$=t.createRadialGradient(0,0,0,0,0,819.2,c,l,_);for(let t=0;t<h.length;++t){const i=h[t];let s=i.A;e&&0!==e[7]&&(s=0|v.max(0,v.min(i.A+e[7],255))),$.addColorStop(i.ratio,J(i.R,i.G,i.B,s))}t.strokeStyle=$,t.stroke(),"radial"===n&&t.restore()}break;case re.BITMAP_FILL:{if(s&&"isPointInPath"in t&&t.isPointInPath(s.x,s.y))return!0;if(i||s||t instanceof CanvasRenderingContext2D){a+=6;continue}t.save();const n=r[a++],h=r[a++],o=r[a++],l=r[a++];h&&t.transform(h[0],h[1],h[2],h[3],h[4],h[5]);const c=n.getTexture();if(!c||!e)break;t.imageSmoothingEnabled=l,this._$bitmapId||n.width===this._$xMax-this._$xMin&&n.height===this._$yMax-this._$yMin?t.drawBitmap(c):(t.fillStyle=t.createPattern(c,o,e),t.fill()),t.restore(),t.imageSmoothingEnabled=!1}break;case re.BITMAP_STROKE:{if(s&&"isPointInStroke"in t&&t.isPointInStroke(s.x,s.y))return!0;if(i||s||t instanceof CanvasRenderingContext2D){a+=9;continue}t.save(),t.lineWidth=r[a++],t.lineCap=r[a++],t.lineJoin=r[a++],t.miterLimit=r[a++];const n=r[a++],h=r[a++],o=r[a++],l=r[a++];h&&t.transform(h[0],h[1],h[2],h[3],h[4],h[5]);const c=n.getTexture();if(!c||!e)break;t.strokeStyle=t.createPattern(c,o,e),t.imageSmoothingEnabled=l,t.stroke(),t.restore(),t.imageSmoothingEnabled=!1}}return!1}}class ne extends Ct{constructor(){super(),this._$id=i++,this._$bytesLoaded=0,this._$bytesTotal=0,this._$url="",this._$content=null,this._$data=null,this._$format="json"}static toString(){return"[class LoaderInfo]"}static get namespace(){return"next2d.display.LoaderInfo"}toString(){return"[object LoaderInfo]"}get namespace(){return"next2d.display.LoaderInfo"}get bytesLoaded(){return this._$bytesLoaded}set bytesLoaded(t){this._$bytesLoaded=0|t}get bytesTotal(){return this._$bytesTotal}set bytesTotal(t){this._$bytesTotal=0|t}get content(){return this._$content}set content(t){this._$content=t}get url(){return this._$url}set url(t){this._$url=t}get format(){return this._$format}set format(t){this._$format=t}}class ae{static toString(){return"[class SoundMixer]"}static get namespace(){return"next2d.media.SoundMixer"}toString(){return"[object SoundMixer]"}get namespace(){return"next2d.media.SoundMixer"}static get volume(){return _()}static set volume(t){(t=>{c=t})($t(t,0,1,1));const e=_(),i=ar(),s=i._$sources;for(let t=0;t<s.length;++t){const i=s[t];for(let t=0;t<i._$sources.length;++t){const s=i._$sources[t];s._$gainNode&&(s._$gainNode.gain.value=v.min(e,s._$volume))}}const r=i._$videos;for(let t=0;t<r.length;++t){const i=r[t];i._$video&&(i._$video.volume=v.min(e,i.volume))}}static stopAll(){const t=ar(),e=t._$sources;for(let t=0;t<e.length;++t)e[t].stop();const i=t._$videos;for(let t=0;t<i.length;++t)i[t].pause();t._$sources.length=0,t._$videos.length=0}}class he extends Ct{constructor(){super(),this._$bytesLoaded=0,this._$bytesTotal=0,this._$arrayBuffer=null,this._$audioBuffer=null,this._$character=null,this._$sources=nt(),this._$volume=1,this._$currentCount=0,this._$loopCount=0,this._$stopFlag=!0,this._$src=""}static toString(){return"[class Sound]"}static get namespace(){return"next2d.media.Sound"}toString(){return"[object Sound]"}get namespace(){return"next2d.media.Sound"}get bytesLoaded(){return this._$bytesLoaded}get bytesTotal(){return this._$bytesTotal}get loopCount(){return this._$loopCount}set loopCount(t){this._$loopCount=t}get src(){return this._$src}set src(t){this.load(new Mt(t))}get volume(){return this._$volume}set volume(t){this._$volume=v.min(ae.volume,$t(t,0,1,1));const e=this._$sources.length;if(e&&Ps)for(let t=0;t<e;++t){const e=this._$sources[t];e._$gainNode&&(e._$gainNode.gain.value=this._$volume,e._$volume=this._$volume)}}clone(){const t=new he;return t.volume=this.volume,t._$loopCount=this._$loopCount,this._$character?t._$character=this._$character:t._$audioBuffer=this._$audioBuffer,t}load(t){this._$src=t.url,pr({format:"arraybuffer",url:t.url,method:t.method,data:t.data,headers:t.headers,withCredentials:t.withCredentials,event:{loadstart:t=>{this._$loadStart(t)},progress:t=>{this._$progress(t)},loadend:t=>{this._$loadEnd(t)}}})}_$loadStart(t){this._$bytesLoaded=t.loaded,this._$bytesTotal=t.total,this.willTrigger(wt.OPEN)&&this.dispatchEvent(new wt(wt.OPEN)),this.willTrigger(Lt.PROGRESS)&&this.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total))}_$progress(t){this._$bytesLoaded=t.loaded,this._$bytesTotal=t.total,this.willTrigger(Lt.PROGRESS)&&this.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total))}_$loadEnd(t){this._$bytesLoaded=t.loaded,this._$bytesTotal=t.total,this.willTrigger(Lt.PROGRESS)&&this.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total));const e=t.target;if(!e)throw new Error("the Sound target is null.");199<e.status&&400>e.status?(this._$arrayBuffer=e.response,Ps?ur(this).then((t=>{(t.hasEventListener(wt.INIT)||t.hasEventListener(wt.COMPLETE))&&ar()._$loaders.push(t)})):Gs.push(this)):this.willTrigger(Bt.IO_ERROR)&&this.dispatchEvent(new Bt(Bt.IO_ERROR,!1,!1,e.statusText))}play(t=0){const e=this._$character?this._$character.audioBuffer:this._$audioBuffer;if(Ps&&e)this._$createBufferSource(t);else{const e=B.now(),i=()=>{if(null===(this._$character?this._$character.audioBuffer:this._$audioBuffer)||null===Ps)F(i);else{const i=(B.now()-e)/1e3;this._$createBufferSource(t,i)}};F(i)}}stop(){this._$stopFlag=!0;const t=this._$sources.length;if(t){const e=ar();if(Ps)for(let e=0;e<t;++e){const t=this._$sources[e];t._$gainNode&&(t._$gainNode.gain.value=0,t._$gainNode.disconnect(),t._$gainNode=null),t.onended=null,t.disconnect()}e._$sources.splice(e._$sources.indexOf(this),1),this._$currentCount=0,this._$sources.length=0}}_$build(t,e){const i=e.loaderInfo;if(!i||!i._$data)throw new Error("the loaderInfo or data is null.");if(this._$character=i._$data.characters[t.characterId],!this._$character)throw new Error("character is null.");this._$character.audioBuffer||(Ps?ur(this).then((t=>{(t.hasEventListener(wt.INIT)||t.hasEventListener(wt.COMPLETE))&&ar()._$loaders.push(t)})):Gs.push(this)),this._$loopCount=0|t.loopCount,this._$volume=v.min(ae.volume,t.volume)}_$createBufferSource(t=0,e=0){if(!Ps)throw new Error("the Audio Context is null.");const i=Ps.createBufferSource();i.onended=t=>this._$endEventHandler(t),i.buffer=this._$character?this._$character.audioBuffer:this._$audioBuffer,i._$gainNode=Ps.createGain(),i._$gainNode.connect(Ps.destination);const s=v.min(ae.volume,this._$volume);i._$gainNode.gain.value=s,i._$volume=s,i.connect(i._$gainNode),i.start(0|t,e);const r=ar();-1===r._$sources.indexOf(this)&&r._$sources.push(this),this._$sources.push(i),this._$stopFlag=!1}_$endEventHandler(t){const e=t.target;if(this._$sources.splice(this._$sources.indexOf(e),1),!this._$stopFlag&&this._$loopCount>this._$currentCount)this._$createBufferSource(),this._$currentCount++;else{if(this._$currentCount=0,Ps&&(e._$gainNode&&(e._$gainNode.gain.value=0,e._$gainNode.disconnect(),e._$gainNode=null),e.onended=null,e.disconnect()),!this._$sources.length){const t=ar();t._$sources.splice(t._$sources.indexOf(this),1)}this.willTrigger(wt.SOUND_COMPLETE)&&this.dispatchEvent(new wt(wt.SOUND_COMPLETE))}}}class oe{constructor(t=1,e=!1){this._$volume=1,this._$loop=!1,this.volume=t,this.loop=e}static toString(){return"[class SoundTransform]"}static get namespace(){return"next2d.media.SoundTransform"}toString(){return"[object SoundTransform]"}get namespace(){return"next2d.media.SoundTransform"}get loop(){return this._$loop}set loop(t){this._$loop=t}get volume(){return this._$volume}set volume(t){this._$volume=$t(+t,0,1,0)}}class le extends Qt{constructor(t=0,e=0){super(),this._$smoothing=!0,this._$loop=!1,this._$autoPlay=!0,this._$bounds=K(0,t,0,e),this._$bytesLoaded=0,this._$bytesTotal=0,this._$timerId=-1,this._$video=null,this._$stop=!0,this._$ready=!1,this._$volume=1,this._$context=null,this._$cacheKeys=nt(),this._$cacheParams=nt(0,0,0)}static toString(){return"[class Video]"}static get namespace(){return"next2d.media.Video"}toString(){return"[object Video]"}get namespace(){return"next2d.media.Video"}get bytesLoaded(){return this._$bytesLoaded}get bytesTotal(){return this._$bytesTotal}get currentTime(){return this._$video?this._$video.currentTime:0}get duration(){return this._$video?this._$video.duration:0}get loop(){return this._$loop}set loop(t){this._$loop=!!t}get autoPlay(){return this._$autoPlay}set autoPlay(t){this._$autoPlay=!!t}get smoothing(){return this._$smoothing}set smoothing(t){this._$smoothing=!!t}get src(){return this._$video?this._$video.src:""}set src(t){this._$video||(this._$video=this._$initializeVideo()),this._$video.src=t,this._$video.load()}get videoHeight(){return this._$video?this._$video.videoHeight:this._$bounds.yMax}get videoWidth(){return this._$video?this._$video.videoWidth:this._$bounds.xMax}get volume(){return this._$volume}set volume(t){this._$volume=$t(v.min(ae.volume,t),0,1,1),this._$video&&(this._$video.volume=this._$volume)}clear(){this._$video&&this._$video.pause(),this._$video=null,this._$bounds.xMax=0,this._$bounds.yMax=0,this._$doChanged()}pause(){if(this._$video&&!this._$stop){this._$stop=!0,this._$video.pause(),R(this._$timerId),this._$timerId=-1,this.hasEventListener(Pt.PAUSE)&&this.dispatchEvent(new Pt(Pt.PAUSE,!1,!1,this._$bytesLoaded,this._$bytesTotal));const t=ar();t._$videos.splice(t._$videos.indexOf(this),1)}}play(){this._$video&&this._$stop&&(this._$stop=!1,this._$video.volume=v.min(this._$volume,ae.volume),this._$video.play().then((()=>{this._$timerId=F((()=>{this._$update()})),this.hasEventListener(Pt.PLAY)&&this.dispatchEvent(new Pt(Pt.PLAY,!1,!1,this._$bytesLoaded,this._$bytesTotal));const t=ar();-1===t._$videos.indexOf(this)&&t._$videos.push(this),this._$ready=!0})))}seek(t){this._$video&&(this._$video.currentTime=t,this.hasEventListener(Pt.SEEK)&&this.dispatchEvent(new Pt(Pt.SEEK,!1,!1,this._$bytesLoaded,this._$bytesTotal)))}_$update(){const t=ar();if(!this.stage||!this._$video)return this._$video&&this._$video.pause(),R(this._$timerId),this._$timerId=-1,void t._$videos.splice(t._$videos.indexOf(this),1);Tr&&this._$postProperty(),this._$bytesLoaded=this._$video.currentTime,this._$video.currentTime&&(this.hasEventListener(Pt.PROGRESS)&&this.dispatchEvent(new Pt(Pt.PROGRESS,!1,!1,this._$bytesLoaded,this._$bytesTotal)),this._$doChanged()),this._$timerId=F((()=>{this._$update()}))}_$start(){if(!this._$video)return;this._$bounds.xMax=this._$video.videoWidth,this._$bounds.yMax=this._$video.videoHeight,this._$bytesTotal=this._$video.duration;const t=ar();this._$autoPlay&&(this._$stop=!1,this._$video.play().then((()=>{-1===t._$videos.indexOf(this)&&t._$videos.push(this),this.hasEventListener(Pt.PLAY_START)&&this.dispatchEvent(new Pt(Pt.PLAY_START,!1,!1,this._$bytesLoaded,this._$bytesTotal)),this._$timerId=F((()=>{this._$update()})),this._$ready=!0,this._$doChanged()}))),this._$createContext()}_$initializeVideo(){this._$cacheKeys.length=0;const t=u.createElement("video");return t.autoplay=!1,t.crossOrigin="anonymous",Ps||(t.muted=!0),Qs&&t.setAttribute("playsinline",""),t.addEventListener("canplaythrough",(()=>{this._$start()})),t.addEventListener("ended",(()=>{this._$loop?t.currentTime=0:(this.hasEventListener(Pt.PLAY_END)&&this.dispatchEvent(new Pt(Pt.PLAY_END,!1,!1,this._$bytesLoaded,this._$bytesTotal)),R(this._$timerId),this._$timerId=-1)})),t}_$createContext(){if(Tr){const t=new w(this._$bounds.xMax,this._$bounds.yMax);this._$context=t.getContext("2d")}}_$buildCharacter(t){t.buffer&&!t._$buffer&&(t._$buffer=new Uint8Array(t.buffer),t.buffer=null),this._$loop=t.loop,this._$autoPlay=t.autoPlay,this._$bounds.xMin=t.bounds.xMin,this._$bounds.yMin=t.bounds.yMin,this._$bounds.xMax=t.bounds.xMax,this._$bounds.yMax=t.bounds.yMax,this._$video||(this._$video=this._$initializeVideo()),this._$video.src=URL.createObjectURL(new Blob([t._$buffer],{type:"video/mp4"})),this._$video.volume=v.min(t.volume,ae.volume),this._$video.load(),Tr&&this._$stage&&this._$createWorkerInstance()}_$sync(t){this._$buildCharacter(t)}_$build(t,e){const i=this._$baseBuild(t,e);return this._$buildCharacter(i),i}_$clip(t,e){const i=this._$bounds.xMax,s=this._$bounds.yMax;if(!i||!s)return;let r=e;const n=this._$transform._$rawMatrix();1===n[0]&&0===n[1]&&0===n[2]&&1===n[3]&&0===n[4]&&0===n[5]||(r=ut(e,n)),t.reset(),t.setTransform(r[0],r[1],r[2],r[3],r[4],r[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,s),t.lineTo(0,s),t.lineTo(0,0),t.clip(),r!==e&&et(r)}_$draw(t,e,i){if(!this._$visible||!this._$video||!this._$ready)return;let s=i;const r=this._$transform._$rawColorTransform();1===r[0]&&1===r[1]&&1===r[2]&&1===r[3]&&0===r[4]&&0===r[5]&&0===r[6]&&0===r[7]||(s=dt(i,r));const n=$t(s[3]+s[7]/255,0,1,0);if(!n)return void(s!==i&&st(s));let a=e;const h=this._$transform._$rawMatrix();1===h[0]&&0===h[1]&&0===h[2]&&1===h[3]&&0===h[4]&&0===h[5]||(a=ut(e,h));const o=gt(this._$bounds,a),l=+o.xMax,c=+o.xMin,_=+o.yMax,$=+o.yMin;Q(o);const u=v.ceil(v.abs(l-c)),d=v.ceil(v.abs(_-$));switch(!0){case 0===u:case 0===d:case u===-1/0:case d===-1/0:case u===b:case d===b:return}let g=+v.sqrt(a[0]*a[0]+a[1]*a[1]);if(!E.isInteger(g)){const t=g.toString(),e=t.indexOf("e");-1!==e&&(g=+t.slice(0,e)),g=+g.toFixed(4)}let f=+v.sqrt(a[2]*a[2]+a[3]*a[3]);if(!E.isInteger(f)){const t=f.toString(),e=t.indexOf("e");-1!==e&&(f=+t.slice(0,e)),f=+f.toFixed(4)}const p=this._$filters||this.filters,m=p&&p.length>0&&this._$canApply(p);let x=K(0,u,0,d);if(m)for(let t=0;t<p.length;++t)x=p[t]._$generateFilterRect(x,g,f);const T=t.frameBuffer,y=T.currentAttachment;if(!y||c-x.xMin>y.width||$-x.yMin>y.height)return void Q(x);if(0>c+x.xMax||0>$+x.yMax)return void Q(x);if(Q(x),!this._$cacheKeys.length||this._$cacheParams[0]!==g||this._$cacheParams[1]!==f||this._$cacheParams[2]!==i[7]){const t=nt();t[0]=g,t[1]=f,this._$cacheKeys=At.generateKeys(this._$instanceId,t,i),at(t),this._$cacheParams[0]=g,this._$cacheParams[1]=f,this._$cacheParams[2]=i[7]}const A=this._$blendMode||this.blendMode;if(t.cachePosition=At.get(this._$cacheKeys),!t.cachePosition){const e=v.ceil(v.abs(this._$bounds.xMax-this._$bounds.xMin)),i=v.ceil(v.abs(this._$bounds.yMax-this._$bounds.yMin)),s=T.createCachePosition(e,i);t.cachePosition=s,At.set(this._$cacheKeys,s)}const M=T.createTextureFromVideo(this._$video,this._$smoothing);let S=0,w=0;if(m){const e=T.currentAttachment,i=T.createCacheAttachment(u,d);t._$bind(i),t.reset();const s=tt(g,0,0,f,u/2,d/2),r=tt(1,0,0,1,-M.width/2,-M.height/2),n=ut(s,r);et(s),et(r),t.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),t.drawImage(M,0,0,M.width,M.height);const h=T.getTextureFromCurrentAttachment();t._$bind(e),T.releaseAttachment(i),t.drawTextureFromRect(M,t.cachePosition);const o=this._$drawFilter(t,a,p,u,d,h);o.offsetX&&(S=o.offsetX),o.offsetY&&(w=o.offsetY),t.cachePosition=o,t.setTransform(1,0,0,1,c-S,$-w)}else t.drawTextureFromRect(M,t.cachePosition),t.setTransform(a[0],a[1],a[2],a[3],a[4],a[5]);t.cachePosition&&(t.globalAlpha=n,t.imageSmoothingEnabled=!0,t.globalCompositeOperation=A,t.drawInstance(c-S,$-w,l,_,i),t.cachePosition=null),a!==e&&et(a),s!==i&&st(s)}_$mouseHit(t,e,i){return!!this._$visible&&this._$hit(t,e,i)}_$hit(t,e,i){let s=e;const r=this._$transform._$rawMatrix();r!==P&&(s=ut(e,r));const n=this._$getBounds(null),a=gt(n,s),h=+a.xMax,o=+a.xMin,l=+a.yMax,c=+a.yMin;Q(a),Q(n);const _=v.ceil(v.abs(h-o)),$=v.ceil(v.abs(l-c));return t.setTransform(1,0,0,1,o,c),t.beginPath(),t.moveTo(0,0),t.lineTo(_,0),t.lineTo(_,$),t.lineTo(0,$),t.lineTo(0,0),s!==e&&et(s),t.isPointInPath(i.x,i.y)}_$getBounds(t=null){if(t){let e=t;const i=this._$transform._$rawMatrix();1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]&&0===i[4]&&0===i[5]||(e=ut(t,i));const s=gt(this._$bounds,e);return e!==t&&et(e),s}return K(this._$bounds.xMin,this._$bounds.xMax,this._$bounds.yMin,this._$bounds.yMax)}_$createWorkerInstance(){if(!Tr||this._$created)return;this._$created=!0;const t={command:"createVideo",buffer:new Float32Array,instanceId:this._$instanceId,parentId:this._$parent?this._$parent._$instanceId:-1,smoothing:this._$smoothing,xMin:this._$bounds.xMin,yMin:this._$bounds.yMin,xMax:this._$bounds.xMax,yMax:this._$bounds.yMax};this._$characterId>-1&&(t.characterId=this._$characterId),this._$loaderInfo&&(t.loaderInfoId=this._$loaderInfo._$id),this._$scale9Grid&&(t.grid={x:this._$scale9Grid.x,y:this._$scale9Grid.y,w:this._$scale9Grid.width,h:this._$scale9Grid.height}),Tr.postMessage(t)}_$postProperty(){if(!Tr)return;const t=this._$createMessage();t.smoothing=this._$smoothing;const e=nt(),i=this._$context;if(i&&this._$video){t.xMin=this._$bounds.xMin,t.yMin=this._$bounds.yMin,t.xMax=this._$bounds.xMax,t.yMax=this._$bounds.yMax,i.drawImage(this._$video,0,0);const s=i.canvas.transferToImageBitmap();t.imageBitmap=s,e.push(s)}Tr.postMessage(t,e),at(e),this._$posted=!0,this._$updated=!1}}class ce extends Zt{constructor(){super(),this._$buttonMode=!1,this._$hitArea=null,this._$soundTransform=null,this._$useHandCursor=!0}static toString(){return"[class Sprite]"}static get namespace(){return"next2d.display.Sprite"}toString(){return"[object Sprite]"}get namespace(){return"next2d.display.Sprite"}get buttonMode(){return this._$buttonMode}set buttonMode(t){this._$buttonMode=!!t}get dropTarget(){return ks}get hitArea(){return this._$hitArea}set hitArea(t){this._$hitArea&&(this._$hitArea._$hitObject=null),this._$hitArea=t,t&&(t._$hitObject=this)}get soundTransform(){return this._$soundTransform||(this._$soundTransform=new oe),this._$soundTransform}set soundTransform(t){this._$soundTransform=t}get useHandCursor(){return this._$useHandCursor}set useHandCursor(t){this._$useHandCursor=t}startDrag(t=!1,e=null){let i=0,s=0;if(!t){const t=this._$dragMousePoint();i=this.x-t.x,s=this.y-t.y}Ns(this),Ds.lock=t,Ds.position.x=i,Ds.position.y=s,Ds.bounds=e}stopDrag(){Ns(null),Ds.lock=!1,Ds.position.x=0,Ds.position.y=0,Ds.bounds=null}_$sync(t){Tr&&this._$stage&&this._$createWorkerInstance(),this._$controller=t.controller,this._$dictionary=t.dictionary,this._$placeMap=t.placeMap,this._$placeObjects=t.placeObjects}_$build(t,e){const i=this._$baseBuild(t,e);return Tr&&this._$stage&&this._$createWorkerInstance(),this._$controller=i.controller,this._$dictionary=i.dictionary,this._$placeMap=i.placeMap,this._$placeObjects=i.placeObjects,i}_$dragMousePoint(){return this._$parent?this._$parent.globalToLocal(hr()):this.globalToLocal(hr())}}class _e extends ce{constructor(){super(),this._$stopFlag=!1,this._$canAction=!0,this._$childRemove=!1,this._$canSound=!0,this._$actionProcess=!1,this._$actions=ot(),this._$frameCache=ot(),this._$labels=null,this._$sounds=ot(),this._$actionOffset=0,this._$actionLimit=0,this._$currentFrame=1,this._$totalFrames=1,this._$isPlaying=!1,this._$loopConfig=null,this._$tweenFrame=0}static toString(){return"[class MovieClip]"}static get namespace(){return"next2d.display.MovieClip"}toString(){return"[object MovieClip]"}get namespace(){return"next2d.display.MovieClip"}get currentFrame(){return this._$currentFrame}get currentFrameLabel(){if(!this._$labels)return null;const t=this._$currentFrame;return this._$labels.has(t)&&this._$labels.get(t)||null}get currentLabels(){return this._$labels&&this._$labels.size?T.from(this._$labels.values()):null}get isPlaying(){return this._$isPlaying}get totalFrames(){return this._$totalFrames}get loopConfig(){if(this._$loopConfig)return this._$loopConfig;const t=this._$placeObject||this._$getPlaceObject();return t&&t.loop?(this._$tweenFrame&&(this._$changePlace=this._$tweenFrame!==this._$parent._$currentFrame,this._$tweenFrame=0),t.loop.tweenFrame&&(this._$tweenFrame=t.loop.tweenFrame),t.loop):null}set loopConfig(t){this._$loopConfig=t,t&&(t.frame=this._$startFrame,this._$loopConfig=t,this._$currentFrame=this._$getLoopFrame(t))}gotoAndPlay(t){this.play(),this._$goToFrame(t)}gotoAndStop(t){this.stop(),this._$goToFrame(t)}nextFrame(){this.stop(),this._$totalFrames>this._$currentFrame&&this._$goToFrame(this._$currentFrame+1)}play(){this._$stopFlag=!1,this._$isPlaying=!0,this._$updateState()}prevFrame(){const t=this._$currentFrame-1;t&&(this.stop(),this._$goToFrame(t))}stop(){this._$stopFlag=!0,this._$isPlaying=!1}addFrameLabel(t){this._$labels||(this._$labels=ot()),this._$labels.set(t.frame,t)}addFrameScript(...t){for(let e=0;e<t.length;e+=2){const i=t[e];let s=+i;C(s)&&(s=this._$getFrameForLabel(`${i}`));const r=t[e+1];if(r&&s&&this._$totalFrames>=s&&this._$addAction(s,r),s===this._$currentFrame){const t=ar();if(t._$actionOffset=t._$actions.length,this._$canAction=!0,this._$setAction(),t._$actionOffset!==t._$actions.length){const e=t._$actions.splice(0,t._$actionOffset);t._$actions.push(...t._$actions,...e),t._$actionOffset=0}}}}_$getFrameForLabel(t){if(!this._$labels)return 0;for(const[e,i]of this._$labels)if(i.name===t)return e;return 0}_$addAction(t,e){if(t){this._$actions.has(t)||this._$actions.set(t,nt());const i=this._$actions.get(t);i&&i.push(e)}}_$setAction(){if(this._$executeAddedEvent(),this._$canAction){const t=this._$currentFrame;if(this._$labels&&this._$labels.has(t)){const e=this._$labels.get(t);e&&e.willTrigger(wt.FRAME_LABEL)&&e.dispatchEvent(new wt(wt.FRAME_LABEL))}if(this._$actions.size&&this._$actions.has(t)){const t=ar();-1===t._$actions.indexOf(this)&&t._$actions.push(this)}}}_$goToFrame(t){let e=+t;if(C(e)&&(e=this._$getFrameForLabel(`${t}`)),e<1&&(e=1),e>this._$totalFrames)return this._$currentFrame=this._$totalFrames,this._$clearChildren(),this._$canAction=!1,void(this._$wait=!1);const i=ar();switch(!0){case e!==this._$currentFrame:{this._$wait=!1;const t=this._$currentFrame;this._$actionProcess&&(this._$frameCache.set("nextFrame",e),this._$frameCache.set("stopFlag",this._$stopFlag),this._$frameCache.set("isPlaying",this._$isPlaying)),this._$currentFrame=e,this._$clearChildren(),i._$actionOffset=i._$actions.length;const s=i._$actionOffset?i._$actions.indexOf(this):-1;if(this._$canAction=!0,this._$prepareActions(),i._$actionOffset&&i._$actionOffset!==i._$actions.length){const t=i._$actions.splice(0,i._$actionOffset);i._$actions.push(...i._$actions,...t),i._$actionOffset=0}if(!this._$actionProcess&&(s>-1||!i._$actionOffset))for(;i._$actions.length&&i._$actions.length!==s;){const t=i._$actions.pop();if(!t)continue;t._$canAction=!1,t._$actionOffset=0,t._$actionLimit=0,t._$actionProcess&&t._$frameCache.size&&(t._$currentFrame=t._$frameCache.get("nextFrame"),t._$clearChildren(),t._$stopFlag=t._$frameCache.get("stopFlag"),t._$isPlaying=t._$frameCache.get("isPlaying"),t._$frameCache.clear());const e=t._$currentFrame;if(!t._$actions.has(e))continue;const s=t._$actions.get(e);if(s)for(let e=0;e<s.length;++e)try{r(t._$loaderInfo),s[e].apply(t)}catch(e){t.stop()}}this._$actionProcess&&(this._$currentFrame=t,this._$clearChildren())}break;case!this._$actionProcess&&i._$actions.indexOf(this)>-1:{if(!this._$actionLimit)break;this._$wait=!1;const t=i._$actions.splice(this._$actionOffset,this._$actionLimit);for(;t.length;){const e=t.pop();if(!e)continue;e._$canAction=!1,e._$actionOffset=0,e._$actionLimit=0;const i=e._$currentFrame;if(!e._$actions.has(i))continue;const s=e._$actions.get(i);if(s)for(let t=0;t<s.length;++t)try{r(e._$loaderInfo),s[t].apply(e)}catch(t){e.stop()}}}}r(null),this._$canSound&&this._$sounds.size&&this._$sounds.has(this._$currentFrame)&&!i._$sounds.has(this._$instanceId)&&i._$sounds.set(this._$instanceId,this)}_$prepareActions(){this._$wait=!1;const t=this._$needsChildren?this._$getChildren():this._$children;for(let e=t.length-1;e>-1;--e)t[e]._$prepareActions();this._$setAction()}_$nextFrame(){let t=this._$needsChildren;switch(!0){case this._$wait:t=!0,this._$wait=!1;break;case this._$stopFlag:case 1===this._$totalFrames:break;default:{t=!0,this._$canAction=!0,this._$canSound=!0;const e=this.loopConfig;if(e){const i=e.end?e.end:this._$totalFrames;switch(e.type){case 0:this._$changePlace?this._$currentFrame=e.start:(++this._$currentFrame,this._$currentFrame>i&&(this._$currentFrame=e.start));break;case 1:this._$changePlace?this._$currentFrame=e.start:(++this._$currentFrame,this._$currentFrame>i&&(this._$currentFrame=i,t=!1,this._$canAction=!1,this._$canSound=!1));break;case 2:this._$changePlace?this._$currentFrame=e.start:(t=!1,this._$canAction=!1,this._$canSound=!1);break;case 3:this._$changePlace?this._$currentFrame=i:(--this._$currentFrame,e.start>this._$currentFrame&&(this._$currentFrame=e.start,t=!1,this._$canAction=!1,this._$canSound=!1));break;case 4:this._$changePlace?this._$currentFrame=i:(--this._$currentFrame,e.start>this._$currentFrame&&(this._$currentFrame=i))}}else++this._$currentFrame,this._$currentFrame>this._$totalFrames&&(this._$currentFrame=1);if(t&&this._$clearChildren(),this._$canSound&&this._$sounds.size&&this._$sounds.has(this._$currentFrame)){const t=ar();t._$sounds.has(this._$instanceId)||t._$sounds.set(this._$instanceId,this)}}}const e=this._$needsChildren?this._$getChildren():this._$children;for(let i=e.length-1;i>-1;--i){const s=e[i];s._$isNext&&(t?s._$nextFrame():t=s._$nextFrame())}return this._$setAction(),this._$isNext=t,!this._$posted&&Tr&&this._$postProperty(),this._$isNext}_$getLoopFrame(t){const e=this._$parent._$currentFrame-t.frame;let i=1;switch(t.type){case 0:{const s=t.end?t.end:this._$totalFrames;i=t.start;for(let r=0;r<e;++r)++i,i>s&&(i=t.start)}break;case 1:{const s=t.end?t.end:this._$totalFrames;i=v.min(s,t.start+e)}break;case 2:i=t.start;break;case 3:i=t.end?t.end:this._$totalFrames,i=v.max(t.start,i-e);break;case 4:{const s=t.end?t.end:this._$totalFrames;i=s;for(let r=0;r<e;++r)--i,t.start>i&&(i=s)}}return i}_$buildCharacter(t){if(t.sounds)for(let e=0;e<t.sounds.length;++e){const i=t.sounds[e],s=nt();for(let t=0;t<i.sound.length;++t){const e=new he;e._$build(i.sound[t],this),s.push(e)}this._$sounds.set(i.frame,s)}if(t.actions)for(let e=0;e<t.actions.length;++e){const i=t.actions[e];i.script||(i.script=Function(i.action)),this._$addAction(i.frame,i.script)}if(t.labels)for(let e=0;e<t.labels.length;++e){const i=t.labels[e];this.addFrameLabel(new ee(i.name,i.frame))}this._$totalFrames=t.totalFrame||1}_$sync(t){super._$sync(t),this._$buildCharacter(t)}_$build(t,e){const i=super._$build(t,e);return this._$buildCharacter(i),i}_$soundPlay(){if(!this._$sounds.has(this._$currentFrame))return;const t=this._$sounds.get(this._$currentFrame);if(t.length){let e=this._$soundTransform,i=this._$parent;for(;i;)i._$soundTransform&&(e=i._$soundTransform),i=i._$parent;for(let i=0;i<t.length;++i){const s=t[i];e&&(s.loopCount=e.loop?16777215:0,s.volume=e.volume),s.play()}}this._$canSound=!1}}class $e extends Zt{constructor(){super(),this._$loaderInfo=new ne}static toString(){return"[class Loader]"}static get namespace(){return"next2d.display.Loader"}toString(){return"[object Loader]"}get namespace(){return"next2d.display.Loader"}get content(){return this._$loaderInfo?this._$loaderInfo.content:null}get contentLoaderInfo(){return this._$loaderInfo}load(t){const e=this._$loaderInfo;e&&(e.url=t.url,e.format=t.responseDataFormat,pr({format:t.responseDataFormat,url:t.url,method:t.method,data:t.data,headers:t.headers,withCredentials:t.withCredentials,event:{loadstart:t=>{this._$loadstart(t)},progress:t=>{this._$progress(t)},loadend:t=>{this._$loadend(t)}}}))}loadJSON(t){if("zlib"===t.type){if(Rr())return void Mr.push(t);Fr(!0);const e=wr(),i=new Uint8Array(t.buffer);e.onmessage=t=>{this._$unzipHandler(t)},e.postMessage(i,[i.buffer])}else this._$build(t)}_$loadend(t){const e=this._$loaderInfo;if(!e)return;e.bytesLoaded=t.loaded,e.bytesTotal=t.total,e.willTrigger(Lt.PROGRESS)&&e.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total));const i=t.target;if(e.willTrigger(Rt.HTTP_STATUS)){const t=mr(i.getAllResponseHeaders());e.dispatchEvent(new Rt(Rt.HTTP_STATUS,!1,!1,i.status,i.responseURL,t))}199<i.status&&400>i.status?"json"===e.format?this.loadJSON(i.response):e.willTrigger(Bt.IO_ERROR)&&e.dispatchEvent(new Bt(Bt.IO_ERROR,!1,!1,"LoaderInfo format is `json`")):e.willTrigger(Bt.IO_ERROR)&&e.dispatchEvent(new Bt(Bt.IO_ERROR,!1,!1,i.statusText))}_$unzipHandler(t){if(this._$build(t.data),Mr.length){const t=Mr.pop();if(!t)return;const e=new Uint8Array(t.buffer),i=wr();i.onmessage=t=>{this._$unzipHandler(t)},i.postMessage(e,[e.buffer])}else Fr(!1)}_$loadstart(t){const e=this._$loaderInfo;e&&(e.bytesLoaded=t.loaded,e.bytesTotal=t.total,e.willTrigger(wt.OPEN)&&e.dispatchEvent(new wt(wt.OPEN)),e.willTrigger(Lt.PROGRESS)&&e.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total)))}_$progress(t){const e=this._$loaderInfo;e&&(e.bytesLoaded=t.loaded,e.bytesTotal=t.total,e.willTrigger(Lt.PROGRESS)&&e.dispatchEvent(new Lt(Lt.PROGRESS,!1,!1,t.loaded,t.total)))}_$build(t){const e=this._$loaderInfo;if(!e)return;const i=ot();if(t.symbols.length)for(let e=0;e<t.symbols.length;++e){const s=t.symbols[e];i.set(s[0],s[1])}e._$data={stage:t.stage,characters:t.characters,symbols:i},e._$content=new _e;const s=t.characters[0];e._$content._$build({characterId:0,clipDepth:0,depth:0,endFrame:s.controller.length,startFrame:1},this),e._$content._$parent=null,this.addChild(e._$content),e._$content._$added=!1,e._$content._$addedStage=!1;const r=ar();r._$loaders.push(e),1===r._$loadStatus&&(r._$loadStatus=2)}}class ue extends Qt{constructor(){super(),this._$graphics=null,this._$src=""}static toString(){return"[class Shape]"}static get namespace(){return"next2d.display.Shape"}toString(){return"[object Shape]"}get namespace(){return"next2d.display.Shape"}get graphics(){return this._$graphics||(this._$graphics=new re(this)),this._$graphics}get src(){return this._$src}set src(t){if(!t)return;const e=new Image;e.addEventListener("load",(()=>{const t=e.width,i=e.height,s=new te(t,i);s.image=e,this.graphics.beginBitmapFill(s).drawRect(0,0,t,i),this.hasEventListener(wt.LOAD)&&this.dispatchEvent(new wt(wt.LOAD))})),this._$src=e.src=t,this.graphics._$mode="bitmap"}_$buildCharacter(t,e){const i=this.graphics;if(!e._$data)throw new Error("the loaderInfo data is null.");if(t.recodes)switch(!0){case t.bitmapId>0:{const s=e._$data.characters[t.bitmapId];if(!s.buffer)throw new Error("the bitmap buffer is null.");const r=v.abs(s.bounds.xMax-s.bounds.xMin),n=v.abs(s.bounds.yMax-s.bounds.yMin),a=new te(r,n);s._$buffer||(s._$buffer=new Uint8Array(s.buffer),at(s.buffer),s.buffer=null),a.buffer=s._$buffer.slice(),i._$recode=nt(),r===t.bounds.xMax-t.bounds.xMin&&n===t.bounds.yMax-t.bounds.yMin&&(i._$bitmapId=t.bitmapId,i._$mode="bitmap");const h=t.recodes;if(h[h.length-1]===re.END_FILL){const t=h.length-6;for(let e=0;e<t;++e)i._$recode.push(h[e]);i._$recode.push(re.BITMAP_FILL,a,null,"repeat",!1)}else{const e=h[h.length-9],s=h[h.length-8],r=h[h.length-7],n=h[h.length-6],o=h.length-10;for(let t=0;t<o;++t)i._$recode.push(h[t]);i._$recode.push(re.BITMAP_STROKE,e,s,r,n,a,tt(1,0,0,1,t.bounds.xMin,t.bounds.yMin),"repeat",!1)}}break;case t.inBitmap:{i._$recode=nt();const e=t.recodes;for(let s=0;s<e.length;++s){const r=e[s];if(i._$recode[s]=r,"object"!=typeof r)continue;if(!r.buffer)continue;const n=new te(r.width,r.height);n.buffer=new Uint8Array(r.buffer),i._$recode[s++]=n;const a=e[s];i._$recode[s]=tt(a[0],a[1],a[2],a[3],a[4],a[5]),r.width===t.bounds.xMax-t.bounds.xMin&&r.height===t.bounds.yMax-t.bounds.yMin&&(i._$bitmapId=t.bitmapId,i._$mode="bitmap")}}break;default:i._$recode=t.recodes.slice(0)}else{i._$mode="bitmap";const e=v.abs(t.bounds.xMax-t.bounds.xMin),s=v.abs(t.bounds.yMax-t.bounds.yMin),r=new te(e,s);if(!t._$buffer){if(!t.buffer)throw new Error("the bitmap buffer is null.");t._$buffer=new Uint8Array(t.buffer),at(t.buffer),t.buffer=null}r.buffer=t._$buffer.slice(0),i.beginBitmapFill(r,null,!1).drawRect(0,0,e,s)}i._$maxAlpha=1,i._$canDraw=!0,i._$xMin=t.bounds.xMin,i._$xMax=t.bounds.xMax,i._$yMin=t.bounds.yMin,i._$yMax=t.bounds.yMax,t.grid&&(this._$scale9Grid=new Dt(t.grid.x,t.grid.y,t.grid.w,t.grid.h)),Tr&&this._$stage&&this._$createWorkerInstance()}_$sync(t){this._$loaderInfo&&this._$buildCharacter(t,this._$loaderInfo)}_$build(t,e){const i=this._$baseBuild(t,e);return this._$buildCharacter(i,e._$loaderInfo),i}_$getBounds(t=null){if(!this._$graphics)return K(0,0,0,0);const e=this._$graphics._$getBounds();if(!t)return e;let i=t;const s=this._$transform._$rawMatrix();1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=ut(t,s));const r=gt(e,i);return Q(e),i!==t&&et(i),r}_$draw(t,e,i){if(!this._$visible)return;if(!this._$graphics||!this._$graphics._$canDraw)return;let s=i;const r=this._$transform._$rawColorTransform();if((r!==O&&1!==r[0]||1!==r[1]||1!==r[2]||1!==r[3]||0!==r[4]||0!==r[5]||0!==r[6]||0!==r[7])&&(s=dt(i,r)),!$t(s[3]+s[7]/255,0,1,0))return void(s!==i&&st(s));const n=this._$filters||this.filters,a=this._$blendMode||this.blendMode;let h=e;const o=this._$transform._$rawMatrix();(o!==Vs&&1!==o[0]||0!==o[1]||0!==o[2]||1!==o[3]||0!==o[4]||0!==o[5])&&(h=ut(e,o)),this._$graphics._$draw(t,h,s,a,n),h!==e&&et(h),s!==i&&st(s)}_$clip(t,e){if(!this._$graphics)return;let i=e;const s=this._$transform._$rawMatrix();1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=ut(e,s)),this._$graphics._$clip(t,i),i!==e&&et(i)}_$mouseHit(t,e,i){return!!this._$visible&&this._$hit(t,e,i)}_$hit(t,e,i,s=!1){let r=!1;const n=this._$graphics;if(n&&n._$canDraw&&n._$getBounds()){let a=e;const h=this._$transform._$rawMatrix();1===h[0]&&0===h[1]&&0===h[2]&&1===h[3]&&0===h[4]&&0===h[5]||(a=ut(e,h)),r=n._$hit(t,a,i,s),a!==e&&et(a)}return r}_$createWorkerInstance(){if(this._$created||!Tr)return;this._$created=!0,this._$posted=!0,this._$updated=!1;const t=sr();let e=0;t[e++]=this._$instanceId,t[e++]=this._$parent?this._$parent._$instanceId:-1,t[e++]=0,t[e++]=0;const i=this._$graphics;if(i&&!i._$posted&&i._$maxAlpha>0&&i._$canDraw){i._$posted=!0;const e=rr(),s=i._$getRecodes();e.command=`shapeRecodes@${this._$instanceId}`,e.buffer=s;const r=nt(s.buffer);Tr.postMessage(e,r),nr(e),at(r),t[2]=i._$maxAlpha,t[3]=+i._$canDraw}const s=this._$getBounds();t[e++]=s.xMin,t[e++]=s.yMin,t[e++]=s.xMax,t[e++]=s.yMax,t[e++]=this._$characterId>-1?this._$characterId:-1,t[e++]=this._$loaderInfo?this._$loaderInfo._$id:-1,this._$registerProperty(t,10);const r=rr();r.command="createShape",r.buffer=t;const n=nt(t.buffer);Tr.postMessage(r,n),nr(r),at(n)}_$postProperty(){if(!this._$created||!Tr)return;const t=this._$createMessage(),e=this._$graphics;if(e&&!e._$posted){t.maxAlpha=e._$maxAlpha,t.canDraw=e._$canDraw;const i=e._$getRecodes();t.recodes=i;const s=nt(i.buffer),r=this._$getBounds();t.xMin=r.xMin,t.yMin=r.yMin,t.xMax=r.xMax,t.yMax=r.yMax,Tr.postMessage(t,s),at(s)}else Tr.postMessage(t);this._$posted=!0,this._$updated=!1}}class de extends Zt{constructor(){super(),this._$player=null,this._$root=this,this._$stage=this,this._$invalidate=!0,this._$color=4294967295,this._$frameRate=60}static toString(){return"[class Stage]"}static get namespace(){return"next2d.display.Stage"}toString(){return"[object Stage]"}get namespace(){return"next2d.display.Stage"}get color(){return this._$color}set color(t){this._$color=$t(pt(t),0,16777215,16777215);const e=this._$player;if(e&&e.context){const t=mt(this._$color);e.context._$setColor(t.R/255,t.G/255,t.B/255,t.A/255)}}get frameRate(){return this._$frameRate}set frameRate(t){this._$frameRate=$t(+t,1,60,60),this._$player&&!this._$player._$stopFlag&&(this._$player.stop(),this._$player.play())}get player(){return this._$player}get canvasHeight(){return this._$player?this._$player._$height/f:0}get canvasWidth(){return this._$player?this._$player._$width/f:0}get currentStageHeight(){return this._$player?this._$player.height*this._$player._$scale:0}get currentStageWidth(){return this._$player?this._$player.width*this._$player._$scale:0}get stageHeight(){return this._$player?this._$player.height:0}get stageWidth(){return this._$player?this._$player.width:0}invalidate(){this._$invalidate=!0}_$addChild(t){return t._$stage=this,t._$root=t,this._$created=!0,super._$addChild(t)}}class ge{static toString(){return"[class Easing]"}static get namespace(){return"next2d.ui.Easing"}toString(){return"[object Easing]"}get namespace(){return"next2d.ui.Easing"}static linear(t,e,i,s){return t/s*i+e}static inQuad(t,e,i,s){return(t/=s)*t*i+e}static outQuad(t,e,i,s){return-(t/=s)*(t-2)*i+e}static inOutQuad(t,e,i,s){return(t/=s/2)<1?t*t*i/2+e:-((t-=1)*(t-2)-1)*i/2+e}static inCubic(t,e,i,s){return(t/=s)*t*t*i+e}static outCubic(t,e,i,s){return t/=s,(--t*t*t+1)*i+e}static inOutCubic(t,e,i,s){return(t/=s/2)<1?t*t*t*i/2+e:((t-=2)*t*t+2)*i/2+e}static inQuart(t,e,i,s){return(t/=s)*t*t*t*i+e}static outQuart(t,e,i,s){return t/=s,(--t*t*t*t-1)*-i+e}static inOutQuart(t,e,i,s){return(t/=s/2)<1?t*t*t*t*i/2+e:((t-=2)*t*t*t-2)*-i/2+e}static inQuint(t,e,i,s){return(t/=s)*t*t*t*t*i+e}static outQuint(t,e,i,s){return t/=s,(--t*t*t*t*t+1)*i+e}static inOutQuint(t,e,i,s){return(t/=s/2)<1?t*t*t*t*t*i/2+e:((t-=2)*t*t*t*t+2)*i/2+e}static inSine(t,e,i,s){return-i*v.cos(t/s*(v.PI/2))+i+e}static outSine(t,e,i,s){return i*v.sin(t/s*(v.PI/2))+e}static inOutSine(t,e,i,s){return-i/2*(v.cos(v.PI*t/s)-1)+e}static inExpo(t,e,i,s){return i*v.pow(2,10*(t/s-1))+e}static outExpo(t,e,i,s){return i*(1-v.pow(2,-10*t/s))+e}static inOutExpo(t,e,i,s){return(t/=s/2)<1?i/2*v.pow(2,10*(t-1))+e:i/2*(2-v.pow(2,-10*(t-1)))+e}static inCirc(t,e,i,s){return(1-v.sqrt(1-(t/=s)*t))*i+e}static outCirc(t,e,i,s){return t/=s,v.sqrt(1- --t*t)*i+e}static inOutCirc(t,e,i,s){return(t/=2*s)<1?(v.sqrt(1-t*t)-1)/-2*i+e:(v.sqrt(1-(t-=2)*t)+1)/2*i+e}static inBack(t,e,i,s){return(2.70158*(t/=s)*t*t-1.70158*t*t)*i+e}static outBack(t,e,i,s){return(1+2.70158*v.pow((t/=s)-1,3)+1.70158*v.pow(t-1,2))*i+e}static inOutBack(t,e,i,s){let r=1.70158;return(t/=s/2)<1?t*t*((1+(r*=1.525))*t-r)*i/2+e:((t-=2)*t*((1+(r*=1.525))*t+r)+2)*i/2+e}static inElastic(t,e,i,s){return 0==(t/=s)?e:1===t?i+e:-v.pow(2,(t*=10)-10)*v.sin((t-10.75)*(2*v.PI/3))*i+e}static outElastic(t,e,i,s){return 0==(t/=s)?e:1===t?i+e:(v.pow(2,-10*t)*v.sin((10*t-.75)*(2*v.PI/3))+1)*i+e}static inOutElastic(t,e,i,s){return 0==(t/=s)?e:1===t?i+e:t<.5?-v.pow(2,20*t-10)*v.sin((20*t-11.125)*(2*v.PI/4.5))/2*i+e:(v.pow(2,-20*t+10)*v.sin((20*t-11.125)*(2*v.PI/4.5))/2+1)*i+e}static outBounce(t,e,i,s){return(t/=s)<1/2.75?7.5625*t*t*i+e:t<2/2.75?(7.5625*(t-=1.5/2.75)*t+.75)*i+e:t<2.5/2.75?(7.5625*(t-=2.25/2.75)*t+.9375)*i+e:(7.5625*(t-=2.625/2.75)*t+.984375)*i+e}static inBounce(t,e,i,s){return i-ge.outBounce(s-t,0,i,s)+e}static inOutBounce(t,e,i,s){return t<s/2?ge.inBounce(2*t,e,i/2,s):ge.outBounce(2*t-s,e+i/2,i/2,s)}}class fe extends Ct{constructor(t,e=null,i=null,s=0,r=1,n=null){super(),this._$target=t,this._$delay=s,this._$duration=r,this._$ease=n||ge.linear,this._$from=e,this._$names=null,this._$startTime=0,this._$stopFlag=!1,this._$forceStop=!1,this._$to=i,this._$currentTime=0}static toString(){return"[class Job]"}static get namespace(){return"next2d.ui.Job"}toString(){return"[object Job]"}get namespace(){return"next2d.ui.Job"}get ease(){return this._$ease}set ease(t){"function"==typeof t&&(this._$ease=t)}get delay(){return this._$delay}set delay(t){this._$delay=t}get duration(){return this._$duration}set duration(t){this._$duration=t}get from(){return this._$from}set from(t){this._$from=t}get to(){return this._$to}set to(t){this._$to=t}get target(){return this._$target}initialize(){this._$forceStop||(this._$stopFlag=!1,this._$startTime=B.now(),this._$names=this.entries(this._$from),this.addEventListener(wt.ENTER_FRAME,(t=>{this._$update(t)})))}entries(t){const e=Object.entries(t);for(let t=0;t<e.length;++t){const i=e[t],s=i[1];s&&"object"==typeof s&&(i[1]=this.entries(s))}return e}start(){return new Promise((t=>{this.hasEventListener(wt.COMPLETE)||this.addEventListener(wt.COMPLETE,(e=>{this.removeEventListener(wt.COMPLETE,e.listener),t()})),this._$delay?I((()=>{this.initialize()}),1e3*this._$delay):this.initialize()}))}stop(){this.hasEventListener(wt.STOP)&&this.dispatchEvent(new wt(wt.STOP)),this.hasEventListener(wt.ENTER_FRAME)&&this.removeAllEventListener(wt.ENTER_FRAME),this.hasEventListener(wt.UPDATE)&&this.removeAllEventListener(wt.UPDATE),this.hasEventListener(wt.COMPLETE)&&this.removeAllEventListener(wt.COMPLETE),this._$forceStop=!0,this._$stopFlag=!0}_$update(t){this._$stopFlag||(this._$currentTime=.001*(B.now()-this._$startTime),this._$names&&this._$updateProperty(this._$target,this._$from,this._$to,this._$names),this.hasEventListener(wt.UPDATE)&&this.dispatchEvent(new wt(wt.UPDATE)),this._$currentTime>=this._$duration&&(this.removeEventListener(wt.ENTER_FRAME,t.listener),this.hasEventListener(wt.COMPLETE)&&this.dispatchEvent(new wt(wt.COMPLETE))))}_$updateProperty(t,e,i,s){for(let r=0;r<s.length;++r){const n=s[r],a=n[0];if("__proto__"===a||"constructor"===a||"prototype"===a)continue;const h=n[1];if(h&&"object"==typeof h){this._$updateProperty(t[a],e[a],i[a],h);continue}if(!t.hasOwnProperty(a))continue;const o=e[a];this._$duration>this._$currentTime?t[a]=this._$ease(this._$currentTime,o,i[a]-o,this._$duration):t[a]=i[a]}}}class pe{static toString(){return"[class Tween]"}static get namespace(){return"next2d.ui.Tween"}toString(){return"[object Tween]"}get namespace(){return"next2d.ui.Tween"}static add(t,e,i,s=0,r=1,n=null){return new fe(t,e,i,s,r,n)}}class me{constructor(t=null,e=null,i=null,s=null,r=null,n=null,a=null,h=null,o=null,l=null){this._$font=t,this._$size=e,this._$color=null===i?null:$t(pt(i),0,16777215,0),this._$bold=s,this._$italic=r,this._$underline=n,this._$align=a,this._$leftMargin=h,this._$rightMargin=o,this._$leading=l,this._$letterSpacing=0}static toString(){return"[class TextFormat]"}static get namespace(){return"next2d.text.TextFormat"}toString(){return"[object TextFormat]"}get namespace(){return"next2d.text.TextFormat"}get align(){return this._$align}set align(t){this._$align=t}get bold(){return this._$bold}set bold(t){this._$bold=null!==t?!!t:null}get color(){return this._$color}set color(t){this._$color=t,t&&(this._$color=$t(pt(t),0,16777215,0))}get font(){return this._$font}set font(t){this._$font=null!==t?`${t}`:null}get italic(){return this._$italic}set italic(t){this._$italic=null!==t?!!t:null}get leading(){return this._$leading}set leading(t){this._$leading=t}get leftMargin(){return this._$leftMargin}set leftMargin(t){this._$leftMargin=t}get letterSpacing(){return this._$letterSpacing}set letterSpacing(t){this._$letterSpacing=t}get rightMargin(){return this._$rightMargin}set rightMargin(t){this._$rightMargin=t}get size(){return this._$size}set size(t){this._$size=t?0|t:null}get underline(){return this._$underline}set underline(t){this._$underline=null!==t?!!t:null}_$clone(){const t=new me(this._$font,this._$size,this._$color,this._$bold,this._$italic,this._$underline,this._$align,this._$leftMargin,this._$rightMargin,this._$leading);return t._$letterSpacing=this._$letterSpacing,t}_$setDefault(){this._$align="left",this._$bold=!1,this._$color=0,this._$font="Times New Roman",this._$italic=!1,this._$leading=0,this._$leftMargin=0,this._$letterSpacing=0,this._$rightMargin=0,this._$size=12,this._$underline=!1}_$merge(t){null===this._$align&&(this._$align=t._$align),null===this._$bold&&(this._$bold=t._$bold),null===this._$color&&(this._$color=t._$color),null===this._$font&&(this._$font=t._$font),null===this._$italic&&(this._$italic=t._$italic),null===this._$leading&&(this._$leading=t._$leading),null===this._$leftMargin&&(this._$leftMargin=t._$leftMargin),null===this._$letterSpacing&&(this._$letterSpacing=t._$letterSpacing),null===this._$rightMargin&&(this._$rightMargin=t._$rightMargin),null===this._$size&&(this._$size=t._$size),null===this._$underline&&(this._$underline=t._$underline)}_$widthMargin(){let t=0;return this._$leftMargin&&(t+=this._$leftMargin),this._$rightMargin&&(t+=this._$rightMargin),t}_$generateFontStyle(){let t="";return this._$italic&&(t="italic "),this._$bold&&(t+="bold "),`${t}${this._$size}px '${this._$font}',sans-serif`}}const xe=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((t=>t.charCodeAt(0)))),be=new Uint16Array("Ȁaglq\tɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((t=>t.charCodeAt(0))));var ve;const Te=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),ye=null!==(ve=String.fromCodePoint)&&void 0!==ve?ve:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+=String.fromCharCode(t),e};var Ee,Ae,Me,Se,we,Ce,Fe,Re;function Be(t){return t>=Ee.ZERO&&t<=Ee.NINE}!function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"}(Ee||(Ee={})),function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"}(Ae||(Ae={})),function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"}(Me||(Me={})),(we=Se||(Se={}))[we.Legacy=0]="Legacy",we[we.Strict=1]="Strict",we[we.Attribute=2]="Attribute";class Ie{constructor(t,e,i){this.decodeTree=t,this.emitCodePoint=e,this.errors=i,this.state=Me.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Se.Strict}startEntity(t){this.decodeMode=t,this.state=Me.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,e){switch(this.state){case Me.EntityStart:return t.charCodeAt(e)===Ee.NUM?(this.state=Me.NumericStart,this.consumed+=1,this.stateNumericStart(t,e+1)):(this.state=Me.NamedEntity,this.stateNamedEntity(t,e));case Me.NumericStart:return this.stateNumericStart(t,e);case Me.NumericDecimal:return this.stateNumericDecimal(t,e);case Me.NumericHex:return this.stateNumericHex(t,e);case Me.NamedEntity:return this.stateNamedEntity(t,e)}}stateNumericStart(t,e){return e>=t.length?-1:(32|t.charCodeAt(e))===Ee.LOWER_X?(this.state=Me.NumericHex,this.consumed+=1,this.stateNumericHex(t,e+1)):(this.state=Me.NumericDecimal,this.stateNumericDecimal(t,e))}addToNumericResult(t,e,i,s){if(e!==i){const r=i-e;this.result=this.result*Math.pow(s,r)+parseInt(t.substr(e,r),s),this.consumed+=r}}stateNumericHex(t,e){const i=e;for(;e<t.length;){const r=t.charCodeAt(e);if(!(Be(r)||(s=r,s>=Ee.UPPER_A&&s<=Ee.UPPER_F||s>=Ee.LOWER_A&&s<=Ee.LOWER_F)))return this.addToNumericResult(t,i,e,16),this.emitNumericEntity(r,3);e+=1}var s;return this.addToNumericResult(t,i,e,16),-1}stateNumericDecimal(t,e){const i=e;for(;e<t.length;){const s=t.charCodeAt(e);if(!Be(s))return this.addToNumericResult(t,i,e,10),this.emitNumericEntity(s,2);e+=1}return this.addToNumericResult(t,i,e,10),-1}emitNumericEntity(t,e){var i;if(this.consumed<=e)return null===(i=this.errors)||void 0===i||i.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===Ee.SEMI)this.consumed+=1;else if(this.decodeMode===Se.Strict)return 0;return this.emitCodePoint(function(t){var e;return t>=55296&&t<=57343||t>1114111?65533:null!==(e=Te.get(t))&&void 0!==e?e:t}(this.result),this.consumed),this.errors&&(t!==Ee.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,e){const{decodeTree:i}=this;let s=i[this.treeIndex],r=(s&Ae.VALUE_LENGTH)>>14;for(;e<t.length;e++,this.excess++){const a=t.charCodeAt(e);if(this.treeIndex=Pe(i,s,this.treeIndex+Math.max(1,r),a),this.treeIndex<0)return 0===this.result||this.decodeMode===Se.Attribute&&(0===r||((n=a)===Ee.EQUALS||function(t){return t>=Ee.UPPER_A&&t<=Ee.UPPER_Z||t>=Ee.LOWER_A&&t<=Ee.LOWER_Z||Be(t)}(n)))?0:this.emitNotTerminatedNamedEntity();if(s=i[this.treeIndex],r=(s&Ae.VALUE_LENGTH)>>14,0!==r){if(a===Ee.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==Se.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}var n;return-1}emitNotTerminatedNamedEntity(){var t;const{result:e,decodeTree:i}=this,s=(i[e]&Ae.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,s,this.consumed),null===(t=this.errors)||void 0===t||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,e,i){const{decodeTree:s}=this;return this.emitCodePoint(1===e?s[t]&~Ae.VALUE_LENGTH:s[t+1],i),3===e&&this.emitCodePoint(s[t+2],i),i}end(){var t;switch(this.state){case Me.NamedEntity:return 0===this.result||this.decodeMode===Se.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case Me.NumericDecimal:return this.emitNumericEntity(0,2);case Me.NumericHex:return this.emitNumericEntity(0,3);case Me.NumericStart:return null===(t=this.errors)||void 0===t||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Me.EntityStart:return 0}}}function Le(t){let e="";const i=new Ie(t,(t=>e+=ye(t)));return function(t,s){let r=0,n=0;for(;(n=t.indexOf("&",n))>=0;){e+=t.slice(r,n),i.startEntity(s);const a=i.write(t,n+1);if(a<0){r=n+i.end();break}r=n+a,n=0===a?r+1:r}const a=e+t.slice(r);return e="",a}}function Pe(t,e,i,s){const r=(e&Ae.BRANCH_LENGTH)>>7,n=e&Ae.JUMP_TABLE;if(0===r)return 0!==n&&s===n?i:-1;if(n){const e=s-n;return e<0||e>=r?-1:t[i+e]-1}let a=i,h=a+r-1;for(;a<=h;){const e=a+h>>>1,i=t[e];if(i<s)a=e+1;else{if(!(i>s))return t[e+r];h=e-1}}return-1}function Oe(t){return t===Ce.Space||t===Ce.NewLine||t===Ce.Tab||t===Ce.FormFeed||t===Ce.CarriageReturn}function ke(t){return t===Ce.Slash||t===Ce.Gt||Oe(t)}Le(xe),Le(be),function(t){t[t.Tab=9]="Tab",t[t.NewLine=10]="NewLine",t[t.FormFeed=12]="FormFeed",t[t.CarriageReturn=13]="CarriageReturn",t[t.Space=32]="Space",t[t.ExclamationMark=33]="ExclamationMark",t[t.Number=35]="Number",t[t.Amp=38]="Amp",t[t.SingleQuote=39]="SingleQuote",t[t.DoubleQuote=34]="DoubleQuote",t[t.Dash=45]="Dash",t[t.Slash=47]="Slash",t[t.Zero=48]="Zero",t[t.Nine=57]="Nine",t[t.Semi=59]="Semi",t[t.Lt=60]="Lt",t[t.Eq=61]="Eq",t[t.Gt=62]="Gt",t[t.Questionmark=63]="Questionmark",t[t.UpperA=65]="UpperA",t[t.LowerA=97]="LowerA",t[t.UpperF=70]="UpperF",t[t.LowerF=102]="LowerF",t[t.UpperZ=90]="UpperZ",t[t.LowerZ=122]="LowerZ",t[t.LowerX=120]="LowerX",t[t.OpeningSquareBracket=91]="OpeningSquareBracket"}(Ce||(Ce={})),function(t){t[t.Text=1]="Text",t[t.BeforeTagName=2]="BeforeTagName",t[t.InTagName=3]="InTagName",t[t.InSelfClosingTag=4]="InSelfClosingTag",t[t.BeforeClosingTagName=5]="BeforeClosingTagName",t[t.InClosingTagName=6]="InClosingTagName",t[t.AfterClosingTagName=7]="AfterClosingTagName",t[t.BeforeAttributeName=8]="BeforeAttributeName",t[t.InAttributeName=9]="InAttributeName",t[t.AfterAttributeName=10]="AfterAttributeName",t[t.BeforeAttributeValue=11]="BeforeAttributeValue",t[t.InAttributeValueDq=12]="InAttributeValueDq",t[t.InAttributeValueSq=13]="InAttributeValueSq",t[t.InAttributeValueNq=14]="InAttributeValueNq",t[t.BeforeDeclaration=15]="BeforeDeclaration",t[t.InDeclaration=16]="InDeclaration",t[t.InProcessingInstruction=17]="InProcessingInstruction",t[t.BeforeComment=18]="BeforeComment",t[t.CDATASequence=19]="CDATASequence",t[t.InSpecialComment=20]="InSpecialComment",t[t.InCommentLike=21]="InCommentLike",t[t.BeforeSpecialS=22]="BeforeSpecialS",t[t.SpecialStartSequence=23]="SpecialStartSequence",t[t.InSpecialTag=24]="InSpecialTag",t[t.InEntity=25]="InEntity"}(Fe||(Fe={})),function(t){t[t.NoValue=0]="NoValue",t[t.Unquoted=1]="Unquoted",t[t.Single=2]="Single",t[t.Double=3]="Double"}(Re||(Re={}));const Ne={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101])};class De{constructor({xmlMode:t=!1,decodeEntities:e=!0},i){this.cbs=i,this.state=Fe.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=Fe.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=t,this.decodeEntities=e,this.entityDecoder=new Ie(t?be:xe,((t,e)=>this.emitCodePoint(t,e)))}reset(){this.state=Fe.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=Fe.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(t){this.offset+=this.buffer.length,this.buffer=t,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(t){t===Ce.Lt||!this.decodeEntities&&this.fastForwardTo(Ce.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=Fe.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&t===Ce.Amp&&this.startEntity()}stateSpecialStartSequence(t){const e=this.sequenceIndex===this.currentSequence.length;if(e?ke(t):(32|t)===this.currentSequence[this.sequenceIndex]){if(!e)return void this.sequenceIndex++}else this.isSpecial=!1;this.sequenceIndex=0,this.state=Fe.InTagName,this.stateInTagName(t)}stateInSpecialTag(t){if(this.sequenceIndex===this.currentSequence.length){if(t===Ce.Gt||Oe(t)){const e=this.index-this.currentSequence.length;if(this.sectionStart<e){const t=this.index;this.index=e,this.cbs.ontext(this.sectionStart,e),this.index=t}return this.isSpecial=!1,this.sectionStart=e+2,void this.stateInClosingTagName(t)}this.sequenceIndex=0}(32|t)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:0===this.sequenceIndex?this.currentSequence===Ne.TitleEnd?this.decodeEntities&&t===Ce.Amp&&this.startEntity():this.fastForwardTo(Ce.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=Number(t===Ce.Lt)}stateCDATASequence(t){t===Ne.Cdata[this.sequenceIndex]?++this.sequenceIndex===Ne.Cdata.length&&(this.state=Fe.InCommentLike,this.currentSequence=Ne.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=Fe.InDeclaration,this.stateInDeclaration(t))}fastForwardTo(t){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===t)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(t){t===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Ne.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=Fe.Text):0===this.sequenceIndex?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):t!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(t){return this.xmlMode?!ke(t):function(t){return t>=Ce.LowerA&&t<=Ce.LowerZ||t>=Ce.UpperA&&t<=Ce.UpperZ}(t)}startSpecial(t,e){this.isSpecial=!0,this.currentSequence=t,this.sequenceIndex=e,this.state=Fe.SpecialStartSequence}stateBeforeTagName(t){if(t===Ce.ExclamationMark)this.state=Fe.BeforeDeclaration,this.sectionStart=this.index+1;else if(t===Ce.Questionmark)this.state=Fe.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(t)){const e=32|t;this.sectionStart=this.index,this.xmlMode||e!==Ne.TitleEnd[2]?this.state=this.xmlMode||e!==Ne.ScriptEnd[2]?Fe.InTagName:Fe.BeforeSpecialS:this.startSpecial(Ne.TitleEnd,3)}else t===Ce.Slash?this.state=Fe.BeforeClosingTagName:(this.state=Fe.Text,this.stateText(t))}stateInTagName(t){ke(t)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=Fe.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateBeforeClosingTagName(t){Oe(t)||(t===Ce.Gt?this.state=Fe.Text:(this.state=this.isTagStartChar(t)?Fe.InClosingTagName:Fe.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(t){(t===Ce.Gt||Oe(t))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=Fe.AfterClosingTagName,this.stateAfterClosingTagName(t))}stateAfterClosingTagName(t){(t===Ce.Gt||this.fastForwardTo(Ce.Gt))&&(this.state=Fe.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(t){t===Ce.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=Fe.InSpecialTag,this.sequenceIndex=0):this.state=Fe.Text,this.sectionStart=this.index+1):t===Ce.Slash?this.state=Fe.InSelfClosingTag:Oe(t)||(this.state=Fe.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(t){t===Ce.Gt?(this.cbs.onselfclosingtag(this.index),this.state=Fe.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Oe(t)||(this.state=Fe.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateInAttributeName(t){(t===Ce.Eq||ke(t))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=-1,this.state=Fe.AfterAttributeName,this.stateAfterAttributeName(t))}stateAfterAttributeName(t){t===Ce.Eq?this.state=Fe.BeforeAttributeValue:t===Ce.Slash||t===Ce.Gt?(this.cbs.onattribend(Re.NoValue,this.index),this.state=Fe.BeforeAttributeName,this.stateBeforeAttributeName(t)):Oe(t)||(this.cbs.onattribend(Re.NoValue,this.index),this.state=Fe.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(t){t===Ce.DoubleQuote?(this.state=Fe.InAttributeValueDq,this.sectionStart=this.index+1):t===Ce.SingleQuote?(this.state=Fe.InAttributeValueSq,this.sectionStart=this.index+1):Oe(t)||(this.sectionStart=this.index,this.state=Fe.InAttributeValueNq,this.stateInAttributeValueNoQuotes(t))}handleInAttributeValue(t,e){t===e||!this.decodeEntities&&this.fastForwardTo(e)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(e===Ce.DoubleQuote?Re.Double:Re.Single,this.index),this.state=Fe.BeforeAttributeName):this.decodeEntities&&t===Ce.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(t){this.handleInAttributeValue(t,Ce.DoubleQuote)}stateInAttributeValueSingleQuotes(t){this.handleInAttributeValue(t,Ce.SingleQuote)}stateInAttributeValueNoQuotes(t){Oe(t)||t===Ce.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Re.Unquoted,this.index),this.state=Fe.BeforeAttributeName,this.stateBeforeAttributeName(t)):this.decodeEntities&&t===Ce.Amp&&this.startEntity()}stateBeforeDeclaration(t){t===Ce.OpeningSquareBracket?(this.state=Fe.CDATASequence,this.sequenceIndex=0):this.state=t===Ce.Dash?Fe.BeforeComment:Fe.InDeclaration}stateInDeclaration(t){(t===Ce.Gt||this.fastForwardTo(Ce.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=Fe.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(t){(t===Ce.Gt||this.fastForwardTo(Ce.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=Fe.Text,this.sectionStart=this.index+1)}stateBeforeComment(t){t===Ce.Dash?(this.state=Fe.InCommentLike,this.currentSequence=Ne.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=Fe.InDeclaration}stateInSpecialComment(t){(t===Ce.Gt||this.fastForwardTo(Ce.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=Fe.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(t){const e=32|t;e===Ne.ScriptEnd[3]?this.startSpecial(Ne.ScriptEnd,4):e===Ne.StyleEnd[3]?this.startSpecial(Ne.StyleEnd,4):(this.state=Fe.InTagName,this.stateInTagName(t))}startEntity(){this.baseState=this.state,this.state=Fe.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?Se.Strict:this.baseState===Fe.Text||this.baseState===Fe.InSpecialTag?Se.Legacy:Se.Attribute)}stateInEntity(){const t=this.entityDecoder.write(this.buffer,this.index-this.offset);t>=0?(this.state=this.baseState,0===t&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===Fe.Text||this.state===Fe.InSpecialTag&&0===this.sequenceIndex?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):this.state!==Fe.InAttributeValueDq&&this.state!==Fe.InAttributeValueSq&&this.state!==Fe.InAttributeValueNq||(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const t=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case Fe.Text:this.stateText(t);break;case Fe.SpecialStartSequence:this.stateSpecialStartSequence(t);break;case Fe.InSpecialTag:this.stateInSpecialTag(t);break;case Fe.CDATASequence:this.stateCDATASequence(t);break;case Fe.InAttributeValueDq:this.stateInAttributeValueDoubleQuotes(t);break;case Fe.InAttributeName:this.stateInAttributeName(t);break;case Fe.InCommentLike:this.stateInCommentLike(t);break;case Fe.InSpecialComment:this.stateInSpecialComment(t);break;case Fe.BeforeAttributeName:this.stateBeforeAttributeName(t);break;case Fe.InTagName:this.stateInTagName(t);break;case Fe.InClosingTagName:this.stateInClosingTagName(t);break;case Fe.BeforeTagName:this.stateBeforeTagName(t);break;case Fe.AfterAttributeName:this.stateAfterAttributeName(t);break;case Fe.InAttributeValueSq:this.stateInAttributeValueSingleQuotes(t);break;case Fe.BeforeAttributeValue:this.stateBeforeAttributeValue(t);break;case Fe.BeforeClosingTagName:this.stateBeforeClosingTagName(t);break;case Fe.AfterClosingTagName:this.stateAfterClosingTagName(t);break;case Fe.BeforeSpecialS:this.stateBeforeSpecialS(t);break;case Fe.InAttributeValueNq:this.stateInAttributeValueNoQuotes(t);break;case Fe.InSelfClosingTag:this.stateInSelfClosingTag(t);break;case Fe.InDeclaration:this.stateInDeclaration(t);break;case Fe.BeforeDeclaration:this.stateBeforeDeclaration(t);break;case Fe.BeforeComment:this.stateBeforeComment(t);break;case Fe.InProcessingInstruction:this.stateInProcessingInstruction(t);break;case Fe.InEntity:this.stateInEntity()}this.index++}this.cleanup()}finish(){this.state===Fe.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const t=this.buffer.length+this.offset;this.sectionStart>=t||(this.state===Fe.InCommentLike?this.currentSequence===Ne.CdataEnd?this.cbs.oncdata(this.sectionStart,t,0):this.cbs.oncomment(this.sectionStart,t,0):this.state===Fe.InTagName||this.state===Fe.BeforeAttributeName||this.state===Fe.BeforeAttributeValue||this.state===Fe.AfterAttributeName||this.state===Fe.InAttributeName||this.state===Fe.InAttributeValueSq||this.state===Fe.InAttributeValueDq||this.state===Fe.InAttributeValueNq||this.state===Fe.InClosingTagName||this.cbs.ontext(this.sectionStart,t))}emitCodePoint(t,e){this.baseState!==Fe.Text&&this.baseState!==Fe.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+e,this.index=this.sectionStart-1,this.cbs.onattribentity(t)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+e,this.index=this.sectionStart-1,this.cbs.ontextentity(t,this.sectionStart))}}const Ue=new Set(["input","option","optgroup","select","button","datalist","textarea"]),Ve=new Set(["p"]),Ge=new Set(["thead","tbody"]),ze=new Set(["dd","dt"]),Ye=new Set(["rt","rp"]),Xe=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",Ve],["h1",Ve],["h2",Ve],["h3",Ve],["h4",Ve],["h5",Ve],["h6",Ve],["select",Ue],["input",Ue],["output",Ue],["button",Ue],["datalist",Ue],["textarea",Ue],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",ze],["dt",ze],["address",Ve],["article",Ve],["aside",Ve],["blockquote",Ve],["details",Ve],["div",Ve],["dl",Ve],["fieldset",Ve],["figcaption",Ve],["figure",Ve],["footer",Ve],["form",Ve],["header",Ve],["hr",Ve],["main",Ve],["nav",Ve],["ol",Ve],["pre",Ve],["section",Ve],["table",Ve],["ul",Ve],["rt",Ye],["rp",Ye],["tbody",Ge],["tfoot",Ge]]),qe=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),He=new Set(["math","svg"]),je=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),We=/\s|\//;class Ke{constructor(t,e={}){var i,s,r,n,a;this.options=e,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=null!=t?t:{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=null!==(i=e.lowerCaseTags)&&void 0!==i?i:this.htmlMode,this.lowerCaseAttributeNames=null!==(s=e.lowerCaseAttributeNames)&&void 0!==s?s:this.htmlMode,this.tokenizer=new(null!==(r=e.Tokenizer)&&void 0!==r?r:De)(this.options,this),this.foreignContext=[!this.htmlMode],null===(a=(n=this.cbs).onparserinit)||void 0===a||a.call(n,this)}ontext(t,e){var i,s;const r=this.getSlice(t,e);this.endIndex=e-1,null===(s=(i=this.cbs).ontext)||void 0===s||s.call(i,r),this.startIndex=e}ontextentity(t,e){var i,s;this.endIndex=e-1,null===(s=(i=this.cbs).ontext)||void 0===s||s.call(i,ye(t)),this.startIndex=e}isVoidElement(t){return this.htmlMode&&qe.has(t)}onopentagname(t,e){this.endIndex=e;let i=this.getSlice(t,e);this.lowerCaseTagNames&&(i=i.toLowerCase()),this.emitOpenTag(i)}emitOpenTag(t){var e,i,s,r;this.openTagStart=this.startIndex,this.tagname=t;const n=this.htmlMode&&Xe.get(t);if(n)for(;this.stack.length>0&&n.has(this.stack[0]);){const t=this.stack.shift();null===(i=(e=this.cbs).onclosetag)||void 0===i||i.call(e,t,!0)}this.isVoidElement(t)||(this.stack.unshift(t),this.htmlMode&&(He.has(t)?this.foreignContext.unshift(!0):je.has(t)&&this.foreignContext.unshift(!1))),null===(r=(s=this.cbs).onopentagname)||void 0===r||r.call(s,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var e,i;this.startIndex=this.openTagStart,this.attribs&&(null===(i=(e=this.cbs).onopentag)||void 0===i||i.call(e,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,e){var i,s,r,n,a,h,o,l;this.endIndex=e;let c=this.getSlice(t,e);if(this.lowerCaseTagNames&&(c=c.toLowerCase()),this.htmlMode&&(He.has(c)||je.has(c))&&this.foreignContext.shift(),this.isVoidElement(c))this.htmlMode&&"br"===c&&(null===(n=(r=this.cbs).onopentagname)||void 0===n||n.call(r,"br"),null===(h=(a=this.cbs).onopentag)||void 0===h||h.call(a,"br",{},!0),null===(l=(o=this.cbs).onclosetag)||void 0===l||l.call(o,"br",!1));else{const t=this.stack.indexOf(c);if(-1!==t)for(let e=0;e<=t;e++){const r=this.stack.shift();null===(s=(i=this.cbs).onclosetag)||void 0===s||s.call(i,r,e!==t)}else this.htmlMode&&"p"===c&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=e+1}onselfclosingtag(t){this.endIndex=t,this.options.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var e,i;const s=this.tagname;this.endOpenTag(t),this.stack[0]===s&&(null===(i=(e=this.cbs).onclosetag)||void 0===i||i.call(e,s,!t),this.stack.shift())}onattribname(t,e){this.startIndex=t;const i=this.getSlice(t,e);this.attribname=this.lowerCaseAttributeNames?i.toLowerCase():i}onattribdata(t,e){this.attribvalue+=this.getSlice(t,e)}onattribentity(t){this.attribvalue+=ye(t)}onattribend(t,e){var i,s;this.endIndex=e,null===(s=(i=this.cbs).onattribute)||void 0===s||s.call(i,this.attribname,this.attribvalue,t===Re.Double?'"':t===Re.Single?"'":t===Re.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const e=t.search(We);let i=e<0?t:t.substr(0,e);return this.lowerCaseTagNames&&(i=i.toLowerCase()),i}ondeclaration(t,e){this.endIndex=e;const i=this.getSlice(t,e);if(this.cbs.onprocessinginstruction){const t=this.getInstructionName(i);this.cbs.onprocessinginstruction(`!${t}`,`!${i}`)}this.startIndex=e+1}onprocessinginstruction(t,e){this.endIndex=e;const i=this.getSlice(t,e);if(this.cbs.onprocessinginstruction){const t=this.getInstructionName(i);this.cbs.onprocessinginstruction(`?${t}`,`?${i}`)}this.startIndex=e+1}oncomment(t,e,i){var s,r,n,a;this.endIndex=e,null===(r=(s=this.cbs).oncomment)||void 0===r||r.call(s,this.getSlice(t,e-i)),null===(a=(n=this.cbs).oncommentend)||void 0===a||a.call(n),this.startIndex=e+1}oncdata(t,e,i){var s,r,n,a,h,o,l,c,_,$;this.endIndex=e;const u=this.getSlice(t,e-i);!this.htmlMode||this.options.recognizeCDATA?(null===(r=(s=this.cbs).oncdatastart)||void 0===r||r.call(s),null===(a=(n=this.cbs).ontext)||void 0===a||a.call(n,u),null===(o=(h=this.cbs).oncdataend)||void 0===o||o.call(h)):(null===(c=(l=this.cbs).oncomment)||void 0===c||c.call(l,`[CDATA[${u}]]`),null===($=(_=this.cbs).oncommentend)||void 0===$||$.call(_)),this.startIndex=e+1}onend(){var t,e;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let t=0;t<this.stack.length;t++)this.cbs.onclosetag(this.stack[t],!0)}null===(e=(t=this.cbs).onend)||void 0===e||e.call(t)}reset(){var t,e,i,s;null===(e=(t=this.cbs).onreset)||void 0===e||e.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,null===(s=(i=this.cbs).onparserinit)||void 0===s||s.call(i,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,e){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let i=this.buffers[0].slice(t-this.bufferOffset,e-this.bufferOffset);for(;e-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),i+=this.buffers[0].slice(0,e-this.bufferOffset);return i}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var e,i;this.ended?null===(i=(e=this.cbs).onerror)||void 0===i||i.call(e,new Error(".write() after done!")):(this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++))}end(t){var e,i;this.ended?null===(i=(e=this.cbs).onerror)||void 0===i||i.call(e,new Error(".end() after done!")):(t&&this.write(t),this.ended=!0,this.tokenizer.end())}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}var Qe,Je;(Je=Qe||(Qe={})).Root="root",Je.Text="text",Je.Directive="directive",Je.Comment="comment",Je.Script="script",Je.Style="style",Je.Tag="tag",Je.CDATA="cdata",Je.Doctype="doctype",Qe.Root,Qe.Text,Qe.Directive,Qe.Comment,Qe.Script,Qe.Style,Qe.Tag,Qe.CDATA,Qe.Doctype;class Ze{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return oi(this,t)}}class ti extends Ze{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class ei extends ti{constructor(){super(...arguments),this.type=Qe.Text}get nodeType(){return 3}}class ii extends ti{constructor(){super(...arguments),this.type=Qe.Comment}get nodeType(){return 8}}class si extends ti{constructor(t,e){super(e),this.name=t,this.type=Qe.Directive}get nodeType(){return 1}}class ri extends Ze{constructor(t){super(),this.children=t}get firstChild(){var t;return null!==(t=this.children[0])&&void 0!==t?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class ni extends ri{constructor(){super(...arguments),this.type=Qe.CDATA}get nodeType(){return 4}}class ai extends ri{constructor(){super(...arguments),this.type=Qe.Root}get nodeType(){return 9}}class hi extends ri{constructor(t,e,i=[],s=("script"===t?Qe.Script:"style"===t?Qe.Style:Qe.Tag)){super(i),this.name=t,this.attribs=e,this.type=s}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map((t=>{var e,i;return{name:t,value:this.attribs[t],namespace:null===(e=this["x-attribsNamespace"])||void 0===e?void 0:e[t],prefix:null===(i=this["x-attribsPrefix"])||void 0===i?void 0:i[t]}}))}}function oi(t,e=!1){let i;if(function(t){return t.type===Qe.Text}(t))i=new ei(t.data);else if(function(t){return t.type===Qe.Comment}(t))i=new ii(t.data);else if(function(t){return(e=t).type===Qe.Tag||e.type===Qe.Script||e.type===Qe.Style;var e}(t)){const s=e?li(t.children):[],r=new hi(t.name,{...t.attribs},s);s.forEach((t=>t.parent=r)),null!=t.namespace&&(r.namespace=t.namespace),t["x-attribsNamespace"]&&(r["x-attribsNamespace"]={...t["x-attribsNamespace"]}),t["x-attribsPrefix"]&&(r["x-attribsPrefix"]={...t["x-attribsPrefix"]}),i=r}else if(function(t){return t.type===Qe.CDATA}(t)){const s=e?li(t.children):[],r=new ni(s);s.forEach((t=>t.parent=r)),i=r}else if(function(t){return t.type===Qe.Root}(t)){const s=e?li(t.children):[],r=new ai(s);s.forEach((t=>t.parent=r)),t["x-mode"]&&(r["x-mode"]=t["x-mode"]),i=r}else{if(!function(t){return t.type===Qe.Directive}(t))throw new Error(`Not implemented yet: ${t.type}`);{const e=new si(t.name,t.data);null!=t["x-name"]&&(e["x-name"]=t["x-name"],e["x-publicId"]=t["x-publicId"],e["x-systemId"]=t["x-systemId"]),i=e}}return i.startIndex=t.startIndex,i.endIndex=t.endIndex,null!=t.sourceCodeLocation&&(i.sourceCodeLocation=t.sourceCodeLocation),i}function li(t){const e=t.map((t=>oi(t,!0)));for(let t=1;t<e.length;t++)e[t].prev=e[t-1],e[t-1].next=e[t];return e}const ci={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};class _i{constructor(t,e,i){this.dom=[],this.root=new ai(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof e&&(i=e,e=ci),"object"==typeof t&&(e=t,t=void 0),this.callback=null!=t?t:null,this.options=null!=e?e:ci,this.elementCB=null!=i?i:null}onparserinit(t){this.parser=t}onreset(){this.dom=[],this.root=new ai(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(t){this.handleCallback(t)}onclosetag(){this.lastNode=null;const t=this.tagStack.pop();this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(t)}onopentag(t,e){const i=this.options.xmlMode?Qe.Tag:void 0,s=new hi(t,e,void 0,i);this.addNode(s),this.tagStack.push(s)}ontext(t){const{lastNode:e}=this;if(e&&e.type===Qe.Text)e.data+=t,this.options.withEndIndices&&(e.endIndex=this.parser.endIndex);else{const e=new ei(t);this.addNode(e),this.lastNode=e}}oncomment(t){if(this.lastNode&&this.lastNode.type===Qe.Comment)return void(this.lastNode.data+=t);const e=new ii(t);this.addNode(e),this.lastNode=e}oncommentend(){this.lastNode=null}oncdatastart(){const t=new ei(""),e=new ni([t]);this.addNode(e),t.parent=e,this.lastNode=t}oncdataend(){this.lastNode=null}onprocessinginstruction(t,e){const i=new si(t,e);this.addNode(i)}handleCallback(t){if("function"==typeof this.callback)this.callback(t,this.dom);else if(t)throw t}addNode(t){const e=this.tagStack[this.tagStack.length-1],i=e.children[e.children.length-1];this.options.withStartIndices&&(t.startIndex=this.parser.startIndex),this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),e.children.push(t),i&&(t.prev=i,i.next=t),t.parent=e,this.lastNode=null}}function $i(t){for(let e=1;e<t.length;e++)t[e][0]+=t[e-1][0]+1;return t}new Map($i([[9,"	"],[0,"
"],[22,"!"],[0,"""],[0,"#"],[0,"$"],[0,"%"],[0,"&"],[0,"'"],[0,"("],[0,")"],[0,"*"],[0,"+"],[0,","],[1,"."],[0,"/"],[10,":"],[0,";"],[0,{v:"<",n:8402,o:"<⃒"}],[0,{v:"=",n:8421,o:"=⃥"}],[0,{v:">",n:8402,o:">⃒"}],[0,"?"],[0,"@"],[26,"["],[0,"\"],[0,"]"],[0,"^"],[0,"_"],[0,"`"],[5,{n:106,o:"fj"}],[20,"{"],[0,"|"],[0,"}"],[34," "],[0,"¡"],[0,"¢"],[0,"£"],[0,"¤"],[0,"¥"],[0,"¦"],[0,"§"],[0,"¨"],[0,"©"],[0,"ª"],[0,"«"],[0,"¬"],[0,"­"],[0,"®"],[0,"¯"],[0,"°"],[0,"±"],[0,"²"],[0,"³"],[0,"´"],[0,"µ"],[0,"¶"],[0,"·"],[0,"¸"],[0,"¹"],[0,"º"],[0,"»"],[0,"¼"],[0,"½"],[0,"¾"],[0,"¿"],[0,"À"],[0,"Á"],[0,"Â"],[0,"Ã"],[0,"Ä"],[0,"Å"],[0,"Æ"],[0,"Ç"],[0,"È"],[0,"É"],[0,"Ê"],[0,"Ë"],[0,"Ì"],[0,"Í"],[0,"Î"],[0,"Ï"],[0,"Ð"],[0,"Ñ"],[0,"Ò"],[0,"Ó"],[0,"Ô"],[0,"Õ"],[0,"Ö"],[0,"×"],[0,"Ø"],[0,"Ù"],[0,"Ú"],[0,"Û"],[0,"Ü"],[0,"Ý"],[0,"Þ"],[0,"ß"],[0,"à"],[0,"á"],[0,"â"],[0,"ã"],[0,"ä"],[0,"å"],[0,"æ"],[0,"ç"],[0,"è"],[0,"é"],[0,"ê"],[0,"ë"],[0,"ì"],[0,"í"],[0,"î"],[0,"ï"],[0,"ð"],[0,"ñ"],[0,"ò"],[0,"ó"],[0,"ô"],[0,"õ"],[0,"ö"],[0,"÷"],[0,"ø"],[0,"ù"],[0,"ú"],[0,"û"],[0,"ü"],[0,"ý"],[0,"þ"],[0,"ÿ"],[0,"Ā"],[0,"ā"],[0,"Ă"],[0,"ă"],[0,"Ą"],[0,"ą"],[0,"Ć"],[0,"ć"],[0,"Ĉ"],[0,"ĉ"],[0,"Ċ"],[0,"ċ"],[0,"Č"],[0,"č"],[0,"Ď"],[0,"ď"],[0,"Đ"],[0,"đ"],[0,"Ē"],[0,"ē"],[2,"Ė"],[0,"ė"],[0,"Ę"],[0,"ę"],[0,"Ě"],[0,"ě"],[0,"Ĝ"],[0,"ĝ"],[0,"Ğ"],[0,"ğ"],[0,"Ġ"],[0,"ġ"],[0,"Ģ"],[1,"Ĥ"],[0,"ĥ"],[0,"Ħ"],[0,"ħ"],[0,"Ĩ"],[0,"ĩ"],[0,"Ī"],[0,"ī"],[2,"Į"],[0,"į"],[0,"İ"],[0,"ı"],[0,"IJ"],[0,"ij"],[0,"Ĵ"],[0,"ĵ"],[0,"Ķ"],[0,"ķ"],[0,"ĸ"],[0,"Ĺ"],[0,"ĺ"],[0,"Ļ"],[0,"ļ"],[0,"Ľ"],[0,"ľ"],[0,"Ŀ"],[0,"ŀ"],[0,"Ł"],[0,"ł"],[0,"Ń"],[0,"ń"],[0,"Ņ"],[0,"ņ"],[0,"Ň"],[0,"ň"],[0,"ʼn"],[0,"Ŋ"],[0,"ŋ"],[0,"Ō"],[0,"ō"],[2,"Ő"],[0,"ő"],[0,"Œ"],[0,"œ"],[0,"Ŕ"],[0,"ŕ"],[0,"Ŗ"],[0,"ŗ"],[0,"Ř"],[0,"ř"],[0,"Ś"],[0,"ś"],[0,"Ŝ"],[0,"ŝ"],[0,"Ş"],[0,"ş"],[0,"Š"],[0,"š"],[0,"Ţ"],[0,"ţ"],[0,"Ť"],[0,"ť"],[0,"Ŧ"],[0,"ŧ"],[0,"Ũ"],[0,"ũ"],[0,"Ū"],[0,"ū"],[0,"Ŭ"],[0,"ŭ"],[0,"Ů"],[0,"ů"],[0,"Ű"],[0,"ű"],[0,"Ų"],[0,"ų"],[0,"Ŵ"],[0,"ŵ"],[0,"Ŷ"],[0,"ŷ"],[0,"Ÿ"],[0,"Ź"],[0,"ź"],[0,"Ż"],[0,"ż"],[0,"Ž"],[0,"ž"],[19,"ƒ"],[34,"Ƶ"],[63,"ǵ"],[65,"ȷ"],[142,"ˆ"],[0,"ˇ"],[16,"˘"],[0,"˙"],[0,"˚"],[0,"˛"],[0,"˜"],[0,"˝"],[51,"̑"],[127,"Α"],[0,"Β"],[0,"Γ"],[0,"Δ"],[0,"Ε"],[0,"Ζ"],[0,"Η"],[0,"Θ"],[0,"Ι"],[0,"Κ"],[0,"Λ"],[0,"Μ"],[0,"Ν"],[0,"Ξ"],[0,"Ο"],[0,"Π"],[0,"Ρ"],[1,"Σ"],[0,"Τ"],[0,"Υ"],[0,"Φ"],[0,"Χ"],[0,"Ψ"],[0,"Ω"],[7,"α"],[0,"β"],[0,"γ"],[0,"δ"],[0,"ε"],[0,"ζ"],[0,"η"],[0,"θ"],[0,"ι"],[0,"κ"],[0,"λ"],[0,"μ"],[0,"ν"],[0,"ξ"],[0,"ο"],[0,"π"],[0,"ρ"],[0,"ς"],[0,"σ"],[0,"τ"],[0,"υ"],[0,"φ"],[0,"χ"],[0,"ψ"],[0,"ω"],[7,"ϑ"],[0,"ϒ"],[2,"ϕ"],[0,"ϖ"],[5,"Ϝ"],[0,"ϝ"],[18,"ϰ"],[0,"ϱ"],[3,"ϵ"],[0,"϶"],[10,"Ё"],[0,"Ђ"],[0,"Ѓ"],[0,"Є"],[0,"Ѕ"],[0,"І"],[0,"Ї"],[0,"Ј"],[0,"Љ"],[0,"Њ"],[0,"Ћ"],[0,"Ќ"],[1,"Ў"],[0,"Џ"],[0,"А"],[0,"Б"],[0,"В"],[0,"Г"],[0,"Д"],[0,"Е"],[0,"Ж"],[0,"З"],[0,"И"],[0,"Й"],[0,"К"],[0,"Л"],[0,"М"],[0,"Н"],[0,"О"],[0,"П"],[0,"Р"],[0,"С"],[0,"Т"],[0,"У"],[0,"Ф"],[0,"Х"],[0,"Ц"],[0,"Ч"],[0,"Ш"],[0,"Щ"],[0,"Ъ"],[0,"Ы"],[0,"Ь"],[0,"Э"],[0,"Ю"],[0,"Я"],[0,"а"],[0,"б"],[0,"в"],[0,"г"],[0,"д"],[0,"е"],[0,"ж"],[0,"з"],[0,"и"],[0,"й"],[0,"к"],[0,"л"],[0,"м"],[0,"н"],[0,"о"],[0,"п"],[0,"р"],[0,"с"],[0,"т"],[0,"у"],[0,"ф"],[0,"х"],[0,"ц"],[0,"ч"],[0,"ш"],[0,"щ"],[0,"ъ"],[0,"ы"],[0,"ь"],[0,"э"],[0,"ю"],[0,"я"],[1,"ё"],[0,"ђ"],[0,"ѓ"],[0,"є"],[0,"ѕ"],[0,"і"],[0,"ї"],[0,"ј"],[0,"љ"],[0,"њ"],[0,"ћ"],[0,"ќ"],[1,"ў"],[0,"џ"],[7074," "],[0," "],[0," "],[0," "],[1," "],[0," "],[0," "],[0," "],[0,"​"],[0,"‌"],[0,"‍"],[0,"‎"],[0,"‏"],[0,"‐"],[2,"–"],[0,"—"],[0,"―"],[0,"‖"],[1,"‘"],[0,"’"],[0,"‚"],[1,"“"],[0,"”"],[0,"„"],[1,"†"],[0,"‡"],[0,"•"],[2,"‥"],[0,"…"],[9,"‰"],[0,"‱"],[0,"′"],[0,"″"],[0,"‴"],[0,"‵"],[3,"‹"],[0,"›"],[3,"‾"],[2,"⁁"],[1,"⁃"],[0,"⁄"],[10,"⁏"],[7,"⁗"],[7,{v:" ",n:8202,o:"  "}],[0,"⁠"],[0,"⁡"],[0,"⁢"],[0,"⁣"],[72,"€"],[46,"⃛"],[0,"⃜"],[37,"ℂ"],[2,"℅"],[4,"ℊ"],[0,"ℋ"],[0,"ℌ"],[0,"ℍ"],[0,"ℎ"],[0,"ℏ"],[0,"ℐ"],[0,"ℑ"],[0,"ℒ"],[0,"ℓ"],[1,"ℕ"],[0,"№"],[0,"℗"],[0,"℘"],[0,"ℙ"],[0,"ℚ"],[0,"ℛ"],[0,"ℜ"],[0,"ℝ"],[0,"℞"],[3,"™"],[1,"ℤ"],[2,"℧"],[0,"ℨ"],[0,"℩"],[2,"ℬ"],[0,"ℭ"],[1,"ℯ"],[0,"ℰ"],[0,"ℱ"],[1,"ℳ"],[0,"ℴ"],[0,"ℵ"],[0,"ℶ"],[0,"ℷ"],[0,"ℸ"],[12,"ⅅ"],[0,"ⅆ"],[0,"ⅇ"],[0,"ⅈ"],[10,"⅓"],[0,"⅔"],[0,"⅕"],[0,"⅖"],[0,"⅗"],[0,"⅘"],[0,"⅙"],[0,"⅚"],[0,"⅛"],[0,"⅜"],[0,"⅝"],[0,"⅞"],[49,"←"],[0,"↑"],[0,"→"],[0,"↓"],[0,"↔"],[0,"↕"],[0,"↖"],[0,"↗"],[0,"↘"],[0,"↙"],[0,"↚"],[0,"↛"],[1,{v:"↝",n:824,o:"↝̸"}],[0,"↞"],[0,"↟"],[0,"↠"],[0,"↡"],[0,"↢"],[0,"↣"],[0,"↤"],[0,"↥"],[0,"↦"],[0,"↧"],[1,"↩"],[0,"↪"],[0,"↫"],[0,"↬"],[0,"↭"],[0,"↮"],[1,"↰"],[0,"↱"],[0,"↲"],[0,"↳"],[1,"↵"],[0,"↶"],[0,"↷"],[2,"↺"],[0,"↻"],[0,"↼"],[0,"↽"],[0,"↾"],[0,"↿"],[0,"⇀"],[0,"⇁"],[0,"⇂"],[0,"⇃"],[0,"⇄"],[0,"⇅"],[0,"⇆"],[0,"⇇"],[0,"⇈"],[0,"⇉"],[0,"⇊"],[0,"⇋"],[0,"⇌"],[0,"⇍"],[0,"⇎"],[0,"⇏"],[0,"⇐"],[0,"⇑"],[0,"⇒"],[0,"⇓"],[0,"⇔"],[0,"⇕"],[0,"⇖"],[0,"⇗"],[0,"⇘"],[0,"⇙"],[0,"⇚"],[0,"⇛"],[1,"⇝"],[6,"⇤"],[0,"⇥"],[15,"⇵"],[7,"⇽"],[0,"⇾"],[0,"⇿"],[0,"∀"],[0,"∁"],[0,{v:"∂",n:824,o:"∂̸"}],[0,"∃"],[0,"∄"],[0,"∅"],[1,"∇"],[0,"∈"],[0,"∉"],[1,"∋"],[0,"∌"],[2,"∏"],[0,"∐"],[0,"∑"],[0,"−"],[0,"∓"],[0,"∔"],[1,"∖"],[0,"∗"],[0,"∘"],[1,"√"],[2,"∝"],[0,"∞"],[0,"∟"],[0,{v:"∠",n:8402,o:"∠⃒"}],[0,"∡"],[0,"∢"],[0,"∣"],[0,"∤"],[0,"∥"],[0,"∦"],[0,"∧"],[0,"∨"],[0,{v:"∩",n:65024,o:"∩︀"}],[0,{v:"∪",n:65024,o:"∪︀"}],[0,"∫"],[0,"∬"],[0,"∭"],[0,"∮"],[0,"∯"],[0,"∰"],[0,"∱"],[0,"∲"],[0,"∳"],[0,"∴"],[0,"∵"],[0,"∶"],[0,"∷"],[0,"∸"],[1,"∺"],[0,"∻"],[0,{v:"∼",n:8402,o:"∼⃒"}],[0,{v:"∽",n:817,o:"∽̱"}],[0,{v:"∾",n:819,o:"∾̳"}],[0,"∿"],[0,"≀"],[0,"≁"],[0,{v:"≂",n:824,o:"≂̸"}],[0,"≃"],[0,"≄"],[0,"≅"],[0,"≆"],[0,"≇"],[0,"≈"],[0,"≉"],[0,"≊"],[0,{v:"≋",n:824,o:"≋̸"}],[0,"≌"],[0,{v:"≍",n:8402,o:"≍⃒"}],[0,{v:"≎",n:824,o:"≎̸"}],[0,{v:"≏",n:824,o:"≏̸"}],[0,{v:"≐",n:824,o:"≐̸"}],[0,"≑"],[0,"≒"],[0,"≓"],[0,"≔"],[0,"≕"],[0,"≖"],[0,"≗"],[1,"≙"],[0,"≚"],[1,"≜"],[2,"≟"],[0,"≠"],[0,{v:"≡",n:8421,o:"≡⃥"}],[0,"≢"],[1,{v:"≤",n:8402,o:"≤⃒"}],[0,{v:"≥",n:8402,o:"≥⃒"}],[0,{v:"≦",n:824,o:"≦̸"}],[0,{v:"≧",n:824,o:"≧̸"}],[0,{v:"≨",n:65024,o:"≨︀"}],[0,{v:"≩",n:65024,o:"≩︀"}],[0,{v:"≪",n:new Map($i([[824,"≪̸"],[7577,"≪⃒"]]))}],[0,{v:"≫",n:new Map($i([[824,"≫̸"],[7577,"≫⃒"]]))}],[0,"≬"],[0,"≭"],[0,"≮"],[0,"≯"],[0,"≰"],[0,"≱"],[0,"≲"],[0,"≳"],[0,"≴"],[0,"≵"],[0,"≶"],[0,"≷"],[0,"≸"],[0,"≹"],[0,"≺"],[0,"≻"],[0,"≼"],[0,"≽"],[0,"≾"],[0,{v:"≿",n:824,o:"≿̸"}],[0,"⊀"],[0,"⊁"],[0,{v:"⊂",n:8402,o:"⊂⃒"}],[0,{v:"⊃",n:8402,o:"⊃⃒"}],[0,"⊄"],[0,"⊅"],[0,"⊆"],[0,"⊇"],[0,"⊈"],[0,"⊉"],[0,{v:"⊊",n:65024,o:"⊊︀"}],[0,{v:"⊋",n:65024,o:"⊋︀"}],[1,"⊍"],[0,"⊎"],[0,{v:"⊏",n:824,o:"⊏̸"}],[0,{v:"⊐",n:824,o:"⊐̸"}],[0,"⊑"],[0,"⊒"],[0,{v:"⊓",n:65024,o:"⊓︀"}],[0,{v:"⊔",n:65024,o:"⊔︀"}],[0,"⊕"],[0,"⊖"],[0,"⊗"],[0,"⊘"],[0,"⊙"],[0,"⊚"],[0,"⊛"],[1,"⊝"],[0,"⊞"],[0,"⊟"],[0,"⊠"],[0,"⊡"],[0,"⊢"],[0,"⊣"],[0,"⊤"],[0,"⊥"],[1,"⊧"],[0,"⊨"],[0,"⊩"],[0,"⊪"],[0,"⊫"],[0,"⊬"],[0,"⊭"],[0,"⊮"],[0,"⊯"],[0,"⊰"],[1,"⊲"],[0,"⊳"],[0,{v:"⊴",n:8402,o:"⊴⃒"}],[0,{v:"⊵",n:8402,o:"⊵⃒"}],[0,"⊶"],[0,"⊷"],[0,"⊸"],[0,"⊹"],[0,"⊺"],[0,"⊻"],[1,"⊽"],[0,"⊾"],[0,"⊿"],[0,"⋀"],[0,"⋁"],[0,"⋂"],[0,"⋃"],[0,"⋄"],[0,"⋅"],[0,"⋆"],[0,"⋇"],[0,"⋈"],[0,"⋉"],[0,"⋊"],[0,"⋋"],[0,"⋌"],[0,"⋍"],[0,"⋎"],[0,"⋏"],[0,"⋐"],[0,"⋑"],[0,"⋒"],[0,"⋓"],[0,"⋔"],[0,"⋕"],[0,"⋖"],[0,"⋗"],[0,{v:"⋘",n:824,o:"⋘̸"}],[0,{v:"⋙",n:824,o:"⋙̸"}],[0,{v:"⋚",n:65024,o:"⋚︀"}],[0,{v:"⋛",n:65024,o:"⋛︀"}],[2,"⋞"],[0,"⋟"],[0,"⋠"],[0,"⋡"],[0,"⋢"],[0,"⋣"],[2,"⋦"],[0,"⋧"],[0,"⋨"],[0,"⋩"],[0,"⋪"],[0,"⋫"],[0,"⋬"],[0,"⋭"],[0,"⋮"],[0,"⋯"],[0,"⋰"],[0,"⋱"],[0,"⋲"],[0,"⋳"],[0,"⋴"],[0,{v:"⋵",n:824,o:"⋵̸"}],[0,"⋶"],[0,"⋷"],[1,{v:"⋹",n:824,o:"⋹̸"}],[0,"⋺"],[0,"⋻"],[0,"⋼"],[0,"⋽"],[0,"⋾"],[6,"⌅"],[0,"⌆"],[1,"⌈"],[0,"⌉"],[0,"⌊"],[0,"⌋"],[0,"⌌"],[0,"⌍"],[0,"⌎"],[0,"⌏"],[0,"⌐"],[1,"⌒"],[0,"⌓"],[1,"⌕"],[0,"⌖"],[5,"⌜"],[0,"⌝"],[0,"⌞"],[0,"⌟"],[2,"⌢"],[0,"⌣"],[9,"⌭"],[0,"⌮"],[7,"⌶"],[6,"⌽"],[1,"⌿"],[60,"⍼"],[51,"⎰"],[0,"⎱"],[2,"⎴"],[0,"⎵"],[0,"⎶"],[37,"⏜"],[0,"⏝"],[0,"⏞"],[0,"⏟"],[2,"⏢"],[4,"⏧"],[59,"␣"],[164,"Ⓢ"],[55,"─"],[1,"│"],[9,"┌"],[3,"┐"],[3,"└"],[3,"┘"],[3,"├"],[7,"┤"],[7,"┬"],[7,"┴"],[7,"┼"],[19,"═"],[0,"║"],[0,"╒"],[0,"╓"],[0,"╔"],[0,"╕"],[0,"╖"],[0,"╗"],[0,"╘"],[0,"╙"],[0,"╚"],[0,"╛"],[0,"╜"],[0,"╝"],[0,"╞"],[0,"╟"],[0,"╠"],[0,"╡"],[0,"╢"],[0,"╣"],[0,"╤"],[0,"╥"],[0,"╦"],[0,"╧"],[0,"╨"],[0,"╩"],[0,"╪"],[0,"╫"],[0,"╬"],[19,"▀"],[3,"▄"],[3,"█"],[8,"░"],[0,"▒"],[0,"▓"],[13,"□"],[8,"▪"],[0,"▫"],[1,"▭"],[0,"▮"],[2,"▱"],[1,"△"],[0,"▴"],[0,"▵"],[2,"▸"],[0,"▹"],[3,"▽"],[0,"▾"],[0,"▿"],[2,"◂"],[0,"◃"],[6,"◊"],[0,"○"],[32,"◬"],[2,"◯"],[8,"◸"],[0,"◹"],[0,"◺"],[0,"◻"],[0,"◼"],[8,"★"],[0,"☆"],[7,"☎"],[49,"♀"],[1,"♂"],[29,"♠"],[2,"♣"],[1,"♥"],[0,"♦"],[3,"♪"],[2,"♭"],[0,"♮"],[0,"♯"],[163,"✓"],[3,"✗"],[8,"✠"],[21,"✶"],[33,"❘"],[25,"❲"],[0,"❳"],[84,"⟈"],[0,"⟉"],[28,"⟦"],[0,"⟧"],[0,"⟨"],[0,"⟩"],[0,"⟪"],[0,"⟫"],[0,"⟬"],[0,"⟭"],[7,"⟵"],[0,"⟶"],[0,"⟷"],[0,"⟸"],[0,"⟹"],[0,"⟺"],[1,"⟼"],[2,"⟿"],[258,"⤂"],[0,"⤃"],[0,"⤄"],[0,"⤅"],[6,"⤌"],[0,"⤍"],[0,"⤎"],[0,"⤏"],[0,"⤐"],[0,"⤑"],[0,"⤒"],[0,"⤓"],[2,"⤖"],[2,"⤙"],[0,"⤚"],[0,"⤛"],[0,"⤜"],[0,"⤝"],[0,"⤞"],[0,"⤟"],[0,"⤠"],[2,"⤣"],[0,"⤤"],[0,"⤥"],[0,"⤦"],[0,"⤧"],[0,"⤨"],[0,"⤩"],[0,"⤪"],[8,{v:"⤳",n:824,o:"⤳̸"}],[1,"⤵"],[0,"⤶"],[0,"⤷"],[0,"⤸"],[0,"⤹"],[2,"⤼"],[0,"⤽"],[7,"⥅"],[2,"⥈"],[0,"⥉"],[0,"⥊"],[0,"⥋"],[2,"⥎"],[0,"⥏"],[0,"⥐"],[0,"⥑"],[0,"⥒"],[0,"⥓"],[0,"⥔"],[0,"⥕"],[0,"⥖"],[0,"⥗"],[0,"⥘"],[0,"⥙"],[0,"⥚"],[0,"⥛"],[0,"⥜"],[0,"⥝"],[0,"⥞"],[0,"⥟"],[0,"⥠"],[0,"⥡"],[0,"⥢"],[0,"⥣"],[0,"⥤"],[0,"⥥"],[0,"⥦"],[0,"⥧"],[0,"⥨"],[0,"⥩"],[0,"⥪"],[0,"⥫"],[0,"⥬"],[0,"⥭"],[0,"⥮"],[0,"⥯"],[0,"⥰"],[0,"⥱"],[0,"⥲"],[0,"⥳"],[0,"⥴"],[0,"⥵"],[0,"⥶"],[1,"⥸"],[0,"⥹"],[1,"⥻"],[0,"⥼"],[0,"⥽"],[0,"⥾"],[0,"⥿"],[5,"⦅"],[0,"⦆"],[4,"⦋"],[0,"⦌"],[0,"⦍"],[0,"⦎"],[0,"⦏"],[0,"⦐"],[0,"⦑"],[0,"⦒"],[0,"⦓"],[0,"⦔"],[0,"⦕"],[0,"⦖"],[3,"⦚"],[1,"⦜"],[0,"⦝"],[6,"⦤"],[0,"⦥"],[0,"⦦"],[0,"⦧"],[0,"⦨"],[0,"⦩"],[0,"⦪"],[0,"⦫"],[0,"⦬"],[0,"⦭"],[0,"⦮"],[0,"⦯"],[0,"⦰"],[0,"⦱"],[0,"⦲"],[0,"⦳"],[0,"⦴"],[0,"⦵"],[0,"⦶"],[0,"⦷"],[1,"⦹"],[1,"⦻"],[0,"⦼"],[1,"⦾"],[0,"⦿"],[0,"⧀"],[0,"⧁"],[0,"⧂"],[0,"⧃"],[0,"⧄"],[0,"⧅"],[3,"⧉"],[3,"⧍"],[0,"⧎"],[0,{v:"⧏",n:824,o:"⧏̸"}],[0,{v:"⧐",n:824,o:"⧐̸"}],[11,"⧜"],[0,"⧝"],[0,"⧞"],[4,"⧣"],[0,"⧤"],[0,"⧥"],[5,"⧫"],[8,"⧴"],[1,"⧶"],[9,"⨀"],[0,"⨁"],[0,"⨂"],[1,"⨄"],[1,"⨆"],[5,"⨌"],[0,"⨍"],[2,"⨐"],[0,"⨑"],[0,"⨒"],[0,"⨓"],[0,"⨔"],[0,"⨕"],[0,"⨖"],[0,"⨗"],[10,"⨢"],[0,"⨣"],[0,"⨤"],[0,"⨥"],[0,"⨦"],[0,"⨧"],[1,"⨩"],[0,"⨪"],[2,"⨭"],[0,"⨮"],[0,"⨯"],[0,"⨰"],[0,"⨱"],[1,"⨳"],[0,"⨴"],[0,"⨵"],[0,"⨶"],[0,"⨷"],[0,"⨸"],[0,"⨹"],[0,"⨺"],[0,"⨻"],[0,"⨼"],[2,"⨿"],[0,"⩀"],[1,"⩂"],[0,"⩃"],[0,"⩄"],[0,"⩅"],[0,"⩆"],[0,"⩇"],[0,"⩈"],[0,"⩉"],[0,"⩊"],[0,"⩋"],[0,"⩌"],[0,"⩍"],[2,"⩐"],[2,"⩓"],[0,"⩔"],[0,"⩕"],[0,"⩖"],[0,"⩗"],[0,"⩘"],[1,"⩚"],[0,"⩛"],[0,"⩜"],[0,"⩝"],[1,"⩟"],[6,"⩦"],[3,"⩪"],[2,{v:"⩭",n:824,o:"⩭̸"}],[0,"⩮"],[0,"⩯"],[0,{v:"⩰",n:824,o:"⩰̸"}],[0,"⩱"],[0,"⩲"],[0,"⩳"],[0,"⩴"],[0,"⩵"],[1,"⩷"],[0,"⩸"],[0,"⩹"],[0,"⩺"],[0,"⩻"],[0,"⩼"],[0,{v:"⩽",n:824,o:"⩽̸"}],[0,{v:"⩾",n:824,o:"⩾̸"}],[0,"⩿"],[0,"⪀"],[0,"⪁"],[0,"⪂"],[0,"⪃"],[0,"⪄"],[0,"⪅"],[0,"⪆"],[0,"⪇"],[0,"⪈"],[0,"⪉"],[0,"⪊"],[0,"⪋"],[0,"⪌"],[0,"⪍"],[0,"⪎"],[0,"⪏"],[0,"⪐"],[0,"⪑"],[0,"⪒"],[0,"⪓"],[0,"⪔"],[0,"⪕"],[0,"⪖"],[0,"⪗"],[0,"⪘"],[0,"⪙"],[0,"⪚"],[2,"⪝"],[0,"⪞"],[0,"⪟"],[0,"⪠"],[0,{v:"⪡",n:824,o:"⪡̸"}],[0,{v:"⪢",n:824,o:"⪢̸"}],[1,"⪤"],[0,"⪥"],[0,"⪦"],[0,"⪧"],[0,"⪨"],[0,"⪩"],[0,"⪪"],[0,"⪫"],[0,{v:"⪬",n:65024,o:"⪬︀"}],[0,{v:"⪭",n:65024,o:"⪭︀"}],[0,"⪮"],[0,{v:"⪯",n:824,o:"⪯̸"}],[0,{v:"⪰",n:824,o:"⪰̸"}],[2,"⪳"],[0,"⪴"],[0,"⪵"],[0,"⪶"],[0,"⪷"],[0,"⪸"],[0,"⪹"],[0,"⪺"],[0,"⪻"],[0,"⪼"],[0,"⪽"],[0,"⪾"],[0,"⪿"],[0,"⫀"],[0,"⫁"],[0,"⫂"],[0,"⫃"],[0,"⫄"],[0,{v:"⫅",n:824,o:"⫅̸"}],[0,{v:"⫆",n:824,o:"⫆̸"}],[0,"⫇"],[0,"⫈"],[2,{v:"⫋",n:65024,o:"⫋︀"}],[0,{v:"⫌",n:65024,o:"⫌︀"}],[2,"⫏"],[0,"⫐"],[0,"⫑"],[0,"⫒"],[0,"⫓"],[0,"⫔"],[0,"⫕"],[0,"⫖"],[0,"⫗"],[0,"⫘"],[0,"⫙"],[0,"⫚"],[0,"⫛"],[8,"⫤"],[1,"⫦"],[0,"⫧"],[0,"⫨"],[0,"⫩"],[1,"⫫"],[0,"⫬"],[0,"⫭"],[0,"⫮"],[0,"⫯"],[0,"⫰"],[0,"⫱"],[0,"⫲"],[0,"⫳"],[9,{v:"⫽",n:8421,o:"⫽⃥"}],[44343,{n:new Map($i([[56476,"𝒜"],[1,"𝒞"],[0,"𝒟"],[2,"𝒢"],[2,"𝒥"],[0,"𝒦"],[2,"𝒩"],[0,"𝒪"],[0,"𝒫"],[0,"𝒬"],[1,"𝒮"],[0,"𝒯"],[0,"𝒰"],[0,"𝒱"],[0,"𝒲"],[0,"𝒳"],[0,"𝒴"],[0,"𝒵"],[0,"𝒶"],[0,"𝒷"],[0,"𝒸"],[0,"𝒹"],[1,"𝒻"],[1,"𝒽"],[0,"𝒾"],[0,"𝒿"],[0,"𝓀"],[0,"𝓁"],[0,"𝓂"],[0,"𝓃"],[1,"𝓅"],[0,"𝓆"],[0,"𝓇"],[0,"𝓈"],[0,"𝓉"],[0,"𝓊"],[0,"𝓋"],[0,"𝓌"],[0,"𝓍"],[0,"𝓎"],[0,"𝓏"],[52,"𝔄"],[0,"𝔅"],[1,"𝔇"],[0,"𝔈"],[0,"𝔉"],[0,"𝔊"],[2,"𝔍"],[0,"𝔎"],[0,"𝔏"],[0,"𝔐"],[0,"𝔑"],[0,"𝔒"],[0,"𝔓"],[0,"𝔔"],[1,"𝔖"],[0,"𝔗"],[0,"𝔘"],[0,"𝔙"],[0,"𝔚"],[0,"𝔛"],[0,"𝔜"],[1,"𝔞"],[0,"𝔟"],[0,"𝔠"],[0,"𝔡"],[0,"𝔢"],[0,"𝔣"],[0,"𝔤"],[0,"𝔥"],[0,"𝔦"],[0,"𝔧"],[0,"𝔨"],[0,"𝔩"],[0,"𝔪"],[0,"𝔫"],[0,"𝔬"],[0,"𝔭"],[0,"𝔮"],[0,"𝔯"],[0,"𝔰"],[0,"𝔱"],[0,"𝔲"],[0,"𝔳"],[0,"𝔴"],[0,"𝔵"],[0,"𝔶"],[0,"𝔷"],[0,"𝔸"],[0,"𝔹"],[1,"𝔻"],[0,"𝔼"],[0,"𝔽"],[0,"𝔾"],[1,"𝕀"],[0,"𝕁"],[0,"𝕂"],[0,"𝕃"],[0,"𝕄"],[1,"𝕆"],[3,"𝕊"],[0,"𝕋"],[0,"𝕌"],[0,"𝕍"],[0,"𝕎"],[0,"𝕏"],[0,"𝕐"],[1,"𝕒"],[0,"𝕓"],[0,"𝕔"],[0,"𝕕"],[0,"𝕖"],[0,"𝕗"],[0,"𝕘"],[0,"𝕙"],[0,"𝕚"],[0,"𝕛"],[0,"𝕜"],[0,"𝕝"],[0,"𝕞"],[0,"𝕟"],[0,"𝕠"],[0,"𝕡"],[0,"𝕢"],[0,"𝕣"],[0,"𝕤"],[0,"𝕥"],[0,"𝕦"],[0,"𝕧"],[0,"𝕨"],[0,"𝕩"],[0,"𝕪"],[0,"𝕫"]]))}],[8906,"ff"],[0,"fi"],[0,"fl"],[0,"ffi"],[0,"ffl"]]));const ui=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]);function di(t,e){return function(i){let s,r=0,n="";for(;s=t.exec(i);)r!==s.index&&(n+=i.substring(r,s.index)),n+=e.get(s[0].charCodeAt(0)),r=s.index+1;return n+i.substring(r)}}var gi,fi,pi;String.prototype.codePointAt,di(/[&<>'"]/g,ui),di(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),di(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]])),function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"}(gi||(gi={})),function(t){t[t.UTF8=0]="UTF8",t[t.ASCII=1]="ASCII",t[t.Extensive=2]="Extensive",t[t.Attribute=3]="Attribute",t[t.Text=4]="Text"}(fi||(fi={})),new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map((t=>[t.toLowerCase(),t]))),new Map(["definitionURL","attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map((t=>[t.toLowerCase(),t]))),new Set(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]),new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),new Set(["svg","math"]),function(t){t[t.DISCONNECTED=1]="DISCONNECTED",t[t.PRECEDING=2]="PRECEDING",t[t.FOLLOWING=4]="FOLLOWING",t[t.CONTAINS=8]="CONTAINS",t[t.CONTAINED_BY=16]="CONTAINED_BY"}(pi||(pi={}));class mi{constructor(){this._$textWidth=-1,this._$textHeight=-1,this._$widthTable=[],this._$heightTable=[],this._$ascentTable=[],this._$textTable=[],this._$lineTable=[]}get textWidth(){if(-1===this._$textWidth){this._$textWidth=0;for(let t=0;t<this._$widthTable.length;++t)this._$textWidth=Math.max(this._$textWidth,this._$widthTable[t])}return this._$textWidth}get textHeight(){if(-1===this._$textHeight){this._$textHeight=0;for(let t=0;t<this._$heightTable.length;++t)this._$textHeight+=this._$heightTable[t],t&&(this._$textHeight+=1)}return this._$textHeight}getLineWidth(t){return t in this._$widthTable?this._$widthTable[t]:0}getLineHeight(t){return t in this._$heightTable?this._$heightTable[t]:0}get widthTable(){return this._$widthTable}get heightTable(){return this._$heightTable}get ascentTable(){return this._$ascentTable}get textTable(){return this._$textTable}get lineTable(){return this._$lineTable}}const xi=new OffscreenCanvas(1,1).getContext("2d");let bi=0;const vi=(t,e,i,s)=>{let r=i.lineTable.length-1;const n=s.width-e._$widthMargin()-4;for(let a=0;a<t.length;++a){const h=t[a],o={mode:"text",text:h,x:0,y:0,w:0,h:0,line:r,textFormat:e._$clone()},l=s.multiline&&"\n"===h||"\r"===h||"\n\r"===h;xi.font=e._$generateFontStyle();const c=xi.measureText(h||"");let _=c.width;e.letterSpacing&&(_+=e.letterSpacing);let $=c.fontBoundingBoxAscent+c.fontBoundingBoxDescent;if(e.leading&&($+=e.leading),o.x=c.actualBoundingBoxLeft,o.y=c.actualBoundingBoxAscent,o.w=_,o.h=$,bi+=_,l||s.wordWrap&&bi>n){bi=_,r++,o.line=r;const t={mode:l?"break":"wrap",text:"",x:0,y:0,w:0,h:0,line:r,textFormat:e._$clone()};i.widthTable[r]=0,i.heightTable[r]=0,i.ascentTable[r]=0,i.textTable.push(t),i.lineTable.push(t)}l||(i.widthTable[r]=bi,i.heightTable[r]=Math.max(i.heightTable[r],$),i.ascentTable[r]=Math.max(i.ascentTable[r],o.y),i.textTable.push(o))}},Ti=(t,e,i)=>{for(let s=0;s<t.length;++s){const r=t[s];switch(r.name){case"align":e.align=r.value;break;case"face":e.font=r.value;break;case"size":e.size=+r.value,i.subFontSize&&(e.size-=i.subFontSize,1>e.size&&(e.size=1));break;case"color":e.color=pt(r.value);break;case"letterSpacing":e.letterSpacing=+r.value;break;case"leading":e.leading=+r.value;break;case"leftMargin":e.leftMargin=+r.value;break;case"rightMargin":e.rightMargin=+r.value}}},yi=(t,e)=>{bi=0;const i=t.lineTable.length;xi.font=e._$generateFontStyle();const s=xi.measureText(""),r={mode:"break",text:"",x:0,y:0,w:0,h:s.fontBoundingBoxAscent+s.fontBoundingBoxDescent,line:i,textFormat:e._$clone()};t.heightTable[i]=0,t.ascentTable[i]=0,t.widthTable[i]=0,t.lineTable.push(r),t.textTable.push(r)},Ei=(t,e,i,s)=>{for(let r=0;r<t.children.length;++r){const n=t.children[r];if(3===n.nodeType){vi(n.nodeValue||"",e,i,s);continue}const a=e._$clone();switch(n.name.toUpperCase()){case"DIV":case"P":Ti(n.attributes,a,s),s.multiline&&yi(i,a),Ei(n,a,i,s),s.multiline&&yi(i,a);continue;case"U":a.underline=!0;break;case"B":a.bold=!0;break;case"I":a.italic=!0;break;case"FONT":case"SPAN":Ti(n.attributes,a,s);break;case"BR":if(!s.multiline)continue;yi(i,a)}Ei(n,a,i,s)}},Ai=t=>{const e=t.heightTable.length-1;for(let i=1;i<e;++i){if(t.heightTable[i]>0)continue;const e=t.lineTable[i];t.heightTable[i]=e.h=t.heightTable[i-1]}};class Mi extends Jt{constructor(){super(),this._$background=!1,this._$backgroundColor=16777215,this._$border=!1,this._$borderColor=0,this._$htmlText="",this._$multiline=!1,this._$text="",this._$wordWrap=!1,this._$scrollX=0,this._$scrollY=0,this._$maxChars=0;const t=new me;t._$setDefault(),this._$defaultTextFormat=t,this._$rawHtmlText="",this._$bounds={xMin:0,xMax:100,yMin:0,yMax:100},this._$originBounds={xMin:0,xMax:100,yMin:0,yMax:100},this._$restrict="",this._$isHTML=!1,this._$textData=null,this._$textarea=null,this._$autoSize="none",this._$autoFontSize=!1,this._$textAreaActive=!1,this._$scrollEnabled=!0,this._$xScrollShape=null,this._$yScrollShape=null,this._$type="static",this._$focus=!1,this._$isComposing=!1,this._$thickness=0,this._$thicknessColor=0,this._$verticalAlign="bottom",this._$cacheKeys=nt(),this._$cacheParams=nt(0,0,0)}static toString(){return"[class TextField]"}static get namespace(){return"next2d.display.TextField"}toString(){return"[object TextField]"}get namespace(){return"next2d.display.TextField"}get autoFontSize(){return this._$autoFontSize}set autoFontSize(t){t!==this._$autoFontSize&&(this._$autoFontSize=t,this._$reload())}get autoSize(){return this._$autoSize}set autoSize(t){t!==this._$autoSize&&(this._$autoSize=t,this._$reload())}get background(){return this._$background}set background(t){t!==this._$background&&(this._$background=!!t,this._$reset())}get backgroundColor(){return this._$backgroundColor}set backgroundColor(t){(t=$t(pt(t),0,16777215,16777215))!==this._$backgroundColor&&(this._$backgroundColor=t,this._$reset())}get border(){return this._$border}set border(t){t!==this._$border&&(this._$border=!!t,this._$reset())}get borderColor(){return this._$borderColor}set borderColor(t){(t=$t(pt(t),0,16777215,0))!==this._$borderColor&&(this._$borderColor=t,this._$reset())}get defaultTextFormat(){return this._$defaultTextFormat._$clone()}set defaultTextFormat(t){t._$merge(this._$defaultTextFormat),this._$defaultTextFormat=t,this._$reset()}get focus(){return this._$focus}set focus(t){if(this._$focus!==t&&"input"===this._$type)if(this._$focus=t,this._$focus){const t=ar(),e=u.getElementById(t.contentElementId);if(!e)return;this._$createTextAreaElement(t._$scale);const i=this._$textarea;if(!i)return;const s=this._$transform.concatenatedMatrix,r=this._$getBounds(null),n=Tt(pt(this._$defaultTextFormat.color),100);i.style.color=`rgb(${n.R},${n.G},${n.B})`,i.style.left=(s.tx+r.xMin+t.x/t._$scale/f)*t._$scale+"px",i.style.top=(s.ty+r.yMin+t.y/t._$scale/f)*t._$scale+"px",i.style.width=`${v.ceil(this.width*t._$scale)}px`,i.style.height=`${v.ceil(this.height*t._$scale)}px`,i.value=this.text,e.appendChild(i),F((()=>{i.focus()})),this._$doChanged(),x(),this._$textAreaActive=!0,this.willTrigger(Ft.FOCUS_IN)&&this.dispatchEvent(new Ft(Ft.FOCUS_IN))}else this._$textarea&&(this._$textarea.dispatchEvent(new Event(`${Es}_blur`)),this.willTrigger(Ft.FOCUS_OUT)&&this.dispatchEvent(new Ft(Ft.FOCUS_OUT)),this._$textarea.remove())}get htmlText(){return this._$htmlText}set htmlText(t){this._$htmlText!==t&&(this._$htmlText=`${t}`,this._$rawHtmlText="",this._$text="",this._$isHTML=!0,this._$reload())}get length(){return this.text.length}get maxChars(){return this._$maxChars}set maxChars(t){this._$maxChars=0|t}get multiline(){return this._$multiline}set multiline(t){t!==this._$multiline&&(this._$multiline=!!t,this._$reset())}get numLines(){return this.getTextData().lineTable.length}get restrict(){return this._$restrict}set restrict(t){this._$restrict=`${t}`}get scrollEnabled(){return this._$scrollEnabled}set scrollEnabled(t){this._$scrollEnabled=t}get scrollX(){return this._$scrollX}set scrollX(t){if(this._$scrollEnabled&&"none"===this._$autoSize&&!(this._$yScrollShape&&this._$yScrollShape.hasLocalVariable("job")||(t=$t(t,0,this.width,0),this._$scrollX===t))){const e=this.width;if(this._$xScrollShape&&this.textWidth>e){this._$doChanged(),this._$scrollX=t,this._$xScrollShape.width=e*e/this.textWidth;const i=this._$parent;if(i){pe.add(this._$xScrollShape,{alpha:0},{alpha:.8},0,.3,ge.outQuad),this._$xScrollShape.x=this.x+1+(e-1-this._$xScrollShape.width)/(e-1)*(this._$scrollX-1),this._$xScrollShape.y=this.y+this.height-this._$xScrollShape.height-.5,i.addChildAt(this._$xScrollShape,i.getChildIndex(this)+1),this._$xScrollShape.hasLocalVariable("job")&&this._$xScrollShape.getLocalVariable("job").stop();const t=pe.add(this._$xScrollShape,{alpha:.8},{alpha:0},.2,.6,ge.outQuad);t.addEventListener(wt.COMPLETE,(t=>{const e=t.target.target;e.deleteLocalVariable("job"),e.parent&&e.parent.removeChild(e)})),t.start(),this._$xScrollShape.setLocalVariable("job",t)}}this.willTrigger(wt.SCROLL)&&this.dispatchEvent(new wt(wt.SCROLL,!0))}}get scrollY(){return this._$scrollY}set scrollY(t){if(this._$scrollEnabled&&"none"===this._$autoSize&&(this._$multiline||this._$wordWrap)&&!(this._$xScrollShape&&this._$xScrollShape.hasLocalVariable("job")||(t=$t(t,0,this.height,0),this._$scrollY===t))){const e=this.height;if(this._$yScrollShape&&this.textHeight>e){this._$doChanged(),this._$scrollY=t,this._$yScrollShape.height=e*e/this.textHeight;const i=this._$parent;if(i){pe.add(this._$yScrollShape,{alpha:0},{alpha:.8},0,.3,ge.outQuad),this._$yScrollShape.x=this.x+this.width-this._$yScrollShape.width-.5,this._$yScrollShape.y=this.y+.5+(e-1-this._$yScrollShape.height)/(e-1)*(this._$scrollY-1),i.addChildAt(this._$yScrollShape,i.getChildIndex(this)+1),this._$yScrollShape.hasLocalVariable("job")&&this._$yScrollShape.getLocalVariable("job").stop();const t=pe.add(this._$yScrollShape,{alpha:.8},{alpha:0},.2,.6,ge.outQuad);t.addEventListener(wt.COMPLETE,(t=>{const e=t.target.target;e.deleteLocalVariable("job"),e.parent&&e.parent.removeChild(e)})),t.start(),this._$yScrollShape.setLocalVariable("job",t)}}this.willTrigger(wt.SCROLL)&&this.dispatchEvent(new wt(wt.SCROLL,!0))}}get text(){if(!this._$isHTML)return this._$text;if(this._$rawHtmlText)return this._$rawHtmlText;let t="";const e=this.getTextData();for(let i=1;i<e.textTable.length;++i){const s=e.textTable[i];switch(s.mode){case"text":t+=s.text;break;case"break":t+="\r"}}return this._$rawHtmlText=t,t}set text(t){null===t&&(t=""),(t=`${t}`)!==this._$text&&(this._$text=t,this._$htmlText="",this._$isHTML=!1,this._$reload())}get textColor(){return this._$defaultTextFormat.color||0}set textColor(t){this._$defaultTextFormat.color=t,this._$reload()}get textHeight(){return this.getTextData().textHeight}get textWidth(){return this.getTextData().textWidth}get thickness(){return this._$thickness}set thickness(t){(t|=0)!==this._$thickness&&(this._$thickness=t,this._$reset())}get thicknessColor(){return this._$thicknessColor}set thicknessColor(t){(t=$t(pt(t),0,16777215,0))!==this._$thicknessColor&&(this._$thicknessColor=t,this._$reset())}get type(){return this._$type}set type(t){this._$type=t,"static"===t&&(this._$textarea=null)}get verticalAlign(){return this._$verticalAlign}set verticalAlign(t){t!==this._$verticalAlign&&(this._$verticalAlign=t,this._$reset())}get wordWrap(){return this._$wordWrap}set wordWrap(t){this._$wordWrap!==t&&(this._$wordWrap=!!t,this._$reset())}get width(){return super.width}set width(t){if(!C(t=+t)&&t>-1){const e=this._$getBounds(null),i=v.abs(e.xMin);this._$originBounds.xMax=t+i,this._$originBounds.xMin=i,this._$bounds.xMax=this._$originBounds.xMax,this._$bounds.xMin=this._$originBounds.xMin,super.width=t,this._$reload()}}get height(){return super.height}set height(t){if(!C(t=+t)&&t>-1){const e=this._$getBounds(null),i=v.abs(e.yMin);this._$originBounds.yMax=t+i,this._$bounds.yMax=this._$originBounds.yMax,this._$bounds.yMin=this._$originBounds.yMin,super.height=t,this._$reload()}}get x(){const t=this._$transform.matrix,e=this._$getBounds(null);return t._$matrix[4]+e.xMin}set x(t){const e=this._$getBounds(null);super.x=t-e.xMin}get y(){const t=this._$transform.matrix,e=this._$getBounds(null);return t._$matrix[5]+e.yMin}set y(t){const e=this._$getBounds(null);super.y=t-e.yMin}appendText(t){const e=this.text;this.text=e+`${t}`}getLineText(t){if(!this._$text&&!this._$htmlText)return"";t|=0;let e="";const i=this.getTextData();for(let s=0;s<i.textTable.length;s++){const r=i.textTable[s];if(r.line>t)break;r.line===t&&"text"===r.mode&&(e+=r.text)}return e}replaceText(t,e,i){if(e|=0,(t|=0)>-1&&e>-1&&e>=t){const s=this.text;t>=s.length?e>=s.length&&e>=t&&(this.text=s+`${i}`):this.text=s.slice(0,t)+`${i}`+s.slice(e,s.length)}}getTextData(t=0){return null!==this._$textData||(this._$isHTML?this._$textData=((t,e,i)=>{const s=t.trim().replace(/\r?\n/g,"").replace(/\t/g,""),r=new mi,n=e._$clone();i.subFontSize&&i.subFontSize>0&&n.size&&(n.size-=i.subFontSize,1>n.size&&(n.size=1));const a=function(t,e){const i=new _i(void 0,e);return new Ke(i,e).end(t),i.root}(s);return yi(r,n),Ei(a,n,r,i),Ai(r),r})(this._$htmlText,this._$defaultTextFormat,{width:this.width,multiline:this._$multiline,wordWrap:this._$wordWrap,subFontSize:t}):this._$textData=((t,e,i)=>{const s=i.multiline?t.split("\n"):[t.replace("\n","")],r=new mi,n=e._$clone();i.subFontSize&&i.subFontSize>0&&n.size&&(n.size-=i.subFontSize,1>n.size&&(n.size=1));for(let t=0;t<s.length;++t){(0===t||i.wordWrap||i.multiline)&&yi(r,n);const e=s[t];e&&(bi=0,vi(e,n,r,i))}return Ai(r),r})(this._$text,this._$defaultTextFormat,{width:this.width,multiline:this._$multiline,wordWrap:this._$wordWrap,subFontSize:t})),this._$textData}_$reset(){this._$textData=null,this._$doChanged(),x(),At.removeCache(this._$instanceId)}_$reload(){if(this._$reset(),this.getTextData(),"none"===this._$autoSize&&this._$autoFontSize){let t=0;const e=this.getTextData();for(let i=0;i<e.textTable.length;++i){const s=e.textTable[i];t=v.max(t,s.textFormat.size||0)}let i=1;if(this.width&&this.textWidth)for(;t>i&&this.textWidth+4>this.width;)this._$reset(),this.getTextData(i++);if(this.height&&this.textHeight)for(;t>i&&this.textHeight+4>this.height;)this._$reset(),this.getTextData(i++)}this._$resize()}_$resize(){if("none"!==this._$autoSize){const t=this._$defaultTextFormat,e=this.textWidth+4+t._$widthMargin();if(this._$wordWrap)this._$bounds.xMax=this._$originBounds.xMax,this._$bounds.xMin=this._$originBounds.xMin;else switch(this._$autoSize){case"left":case"center":this._$bounds.xMax=e+this._$bounds.xMin;break;case"right":this._$bounds.xMax=this._$originBounds.xMax-(this._$originBounds.xMax-this._$originBounds.xMin-(e-this._$originBounds.xMin))}this._$bounds.yMax=this.textHeight+this._$originBounds.yMin}else this._$scrollEnabled&&(this._$xScrollShape||(this._$xScrollShape=new ue,this._$xScrollShape.graphics.beginFill("#000",.3).drawRoundRect(0,0,3,3,3),this._$xScrollShape.scale9Grid=new Dt(1.5,1.5,.1,.1)),this._$yScrollShape||(this._$yScrollShape=new ue,this._$yScrollShape.graphics.beginFill("#000",.3).drawRoundRect(0,0,3,3,3),this._$yScrollShape.scale9Grid=new Dt(1.5,1.5,.1,.1)))}_$getAlignOffset(t,e){const i=this.getTextData().getLineWidth(t.line),s=t.textFormat,r=s.leftMargin||0;if(!this._$wordWrap&&i>e)return v.max(0,r);const n=s.rightMargin||0;return"center"===s.align||"center"===this._$autoSize?v.max(0,e/2-r-n-i/2-2):"right"===s.align||"right"===this._$autoSize?v.max(0,e-r-i-n-4):v.max(0,r)}_$getBounds(t=null){if(t){let e=t;const i=this._$transform._$rawMatrix();return 1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]&&0===i[4]&&0===i[5]||(e=ut(t,i)),gt(this._$bounds,e)}return K(this._$bounds.xMin,this._$bounds.xMax,this._$bounds.yMin,this._$bounds.yMax)}_$buildCharacter(t){const e=this._$defaultTextFormat;switch(e.font=t.font,e.size=0|t.size,e.align=t.align,e.color=0|t.color,e.leading=t.leading,e.letterSpacing=t.letterSpacing,e.leftMargin=t.leftMargin,e.rightMargin=t.rightMargin,t.fontType){case 1:e.bold=!0;break;case 2:e.italic=!0;break;case 3:e.bold=!0,e.italic=!0}switch(this._$type=t.inputType,this._$multiline=!!t.multiline,this._$wordWrap=!!t.wordWrap,this._$border=!!t.border,this._$scrollEnabled=!!t.scroll,this._$thickness=0|t.thickness,this._$thicknessColor=0|t.thicknessColor,this._$bounds.xMin=t.originBounds.xMin,this._$bounds.xMax=t.originBounds.xMax,this._$bounds.yMin=t.originBounds.yMin,this._$bounds.yMax=t.originBounds.yMax,this._$originBounds.xMin=t.originBounds.xMin,this._$originBounds.xMax=t.originBounds.xMax,this._$originBounds.yMin=t.originBounds.yMin,this._$originBounds.yMax=t.originBounds.yMax,t.autoSize){case 1:this.autoSize=t.align;break;case 2:this.autoFontSize=!0}this.text=t.text,Tr&&this._$stage&&this._$createWorkerInstance()}_$sync(t){this._$buildCharacter(t)}_$build(t,e){const i=this._$baseBuild(t,e);return this._$buildCharacter(i),i}_$clip(t,e){const i=this._$getBounds(),s=i.xMax,r=i.xMin,n=i.yMax,a=i.yMin;Q(i);const h=v.ceil(v.abs(s-r)),o=v.ceil(v.abs(n-a));if(!h||!o)return;let l=e;const c=this._$transform._$rawMatrix();1===c[0]&&0===c[1]&&0===c[2]&&1===c[3]&&0===c[4]&&0===c[5]||(l=ut(e,c)),t.reset(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(h,0),t.lineTo(h,o),t.lineTo(0,o),t.lineTo(0,0),t.clip(),l!==e&&et(l)}_$draw(t,e,i){if(!this._$visible||this._$textAreaActive)return;if(!this._$background&&!this._$border&&!this.text)return;let s=i;const r=this._$transform._$rawColorTransform();1===r[0]&&1===r[1]&&1===r[2]&&1===r[3]&&0===r[4]&&0===r[5]&&0===r[6]&&0===r[7]||(s=dt(i,r));const n=$t(s[3]+s[7]/255,0,1);if(!n)return;let a=e;const h=this._$transform._$rawMatrix();1===h[0]&&0===h[1]&&0===h[2]&&1===h[3]&&0===h[4]&&0===h[5]||(a=ut(e,h));const o=this._$getBounds(null);o.xMin-=this._$thickness,o.xMax+=this._$thickness,o.yMin-=this._$thickness,o.yMax+=this._$thickness;const l=gt(o,a),c=+l.xMax,_=+l.xMin,$=+l.yMax,u=+l.yMin;Q(l);const d=v.ceil(v.abs(c-_)),g=v.ceil(v.abs($-u));switch(!0){case 0===d:case 0===g:case d===-1/0:case g===-1/0:case d===b:case g===b:return}let f=+v.sqrt(a[0]*a[0]+a[1]*a[1]);if(!E.isInteger(f)){const t=f.toString(),e=t.indexOf("e");-1!==e&&(f=+t.slice(0,e)),f=+f.toFixed(4)}let p=+v.sqrt(a[2]*a[2]+a[3]*a[3]);if(!E.isInteger(p)){const t=p.toString(),e=t.indexOf("e");-1!==e&&(p=+t.slice(0,e)),p=+p.toFixed(4)}const m=this._$filters||this.filters,x=null!==m&&m.length>0&&this._$canApply(m);let T=K(0,d,0,g);if(x&&m)for(let t=0;t<m.length;++t)T=m[t]._$generateFilterRect(T,f,p);const y=t.frameBuffer,A=y.currentAttachment;if(!A||_-T.xMin>A.width||u-T.yMin>A.height)return void Q(T);if(0>_+T.xMax||0>u+T.yMax)return void Q(T);if(Q(T),this._$isUpdated()&&(At.removeCache(this._$instanceId),t.cachePosition=null,this._$cacheKeys.length=0),!this._$cacheKeys.length||this._$cacheParams[0]!==f||this._$cacheParams[1]!==p||this._$cacheParams[2]!==i[7]){const t=nt(f,p);this._$cacheKeys=At.generateKeys(this._$instanceId,t),at(t),this._$cacheParams[0]=f,this._$cacheParams[1]=p,this._$cacheParams[2]=i[7]}const M=this._$blendMode||this.blendMode;if(t.cachePosition=At.get(this._$cacheKeys),!t.cachePosition){const e=v.min(1,v.max(f,p)),i=v.ceil(v.abs(o.xMax-o.xMin)*f),r=v.ceil(v.abs(o.yMax-o.yMin)*p),n=At.getCanvas();n.width=i+2*e,n.height=r+2*e;const a=n.getContext("2d");if(!a)throw new Error("the context is null.");if(this._$background||this._$border){if(a.beginPath(),a.moveTo(0,0),a.lineTo(i,0),a.lineTo(i,r),a.lineTo(0,r),a.lineTo(0,0),this._$background){const t=Tt(this._$backgroundColor),e=v.max(0,v.min(255*t.A+s[7],255))/255;a.fillStyle=`rgba(${t.R},${t.G},${t.B},${e})`,a.fill()}if(this._$border){const t=Tt(this._$borderColor),i=v.max(0,v.min(255*t.A+s[7],255))/255;a.lineWidth=e,a.strokeStyle=`rgba(${t.R},${t.G},${t.B},${i})`,a.stroke()}}a.save(),a.beginPath(),a.moveTo(2,2),a.lineTo(i-2,2),a.lineTo(i-2,r-2),a.lineTo(2,r-2),a.lineTo(2,2),a.clip();let h=2;if(this._$scrollY>0){const t=(this.textHeight-this.height)/this.height;h+=-this._$scrollY*t}let l=2;if(this._$scrollX>0){const t=(this.textWidth-this.width)/this.width;l+=-this._$scrollX*t}a.setTransform(f,0,0,p,l*f,h*p),a.beginPath(),this._$doDraw(a,s,i/f,e),a.restore();const c=y.createCachePosition(i,r),_=y.createTextureFromCanvas(a.canvas);t.drawTextureFromRect(_,c),t.cachePosition=c,At.set(this._$cacheKeys,c),At.destroy(a)}let S=!1,w=0,C=0;if(m&&m.length&&this._$canApply(m)){S=!0;const e=this._$drawFilter(t,a,m,d,g);e.offsetX&&(w=e.offsetX),e.offsetY&&(C=e.offsetY),t.cachePosition=e}const F=v.atan2(a[1],a[0]),R=v.atan2(-a[2],a[3]);if(S||!F&&!R)t.setTransform(1,0,0,1,_-w,u-C);else{const e=o.xMin*f,i=o.yMin*p,s=v.cos(F),r=v.sin(F),n=v.cos(R),h=v.sin(R);t.setTransform(s,r,-h,n,e*s-i*h+a[4],e*r+i*n+a[5])}t.cachePosition&&(t.globalAlpha=n,t.imageSmoothingEnabled=!0,t.globalCompositeOperation=M,t.drawInstance(_-w,u-C,c,$,i),t.cachePosition=null),Q(o),a!==e&&et(a),s!==i&&st(s)}_$doDraw(t,e,i,s){const r=this.getTextData(),n=this.width;let a=0;if(this._$scrollX>0){const t=(this.textWidth-n)/n;a=this._$scrollX*t}const h=n+a,o=this.height;let l=0;if(this._$scrollY>0){const t=(this.textHeight-o)/o;l=this._$scrollY*t}const c=o+l;let _=0,$=0,u=0,d=0,g=!1;for(let n=0;n<r.textTable.length;++n){const o=r.textTable[n];if(g&&"text"===o.mode)continue;const f=o.textFormat;if("none"===this._$autoSize){if($>c)break;if("text"===o.mode&&(a>_+o.w||_>h)){_+=o.w;continue}}const p=Tt(f.color||0),m=v.max(0,v.min(255*p.A+e[7],255))/255;if(t.fillStyle=`rgba(${p.R},${p.G},${p.B},${m})`,this._$thickness){const i=Tt(this._$thicknessColor),s=v.max(0,v.min(255*i.A+e[7],255))/255;t.lineWidth=this._$thickness,t.strokeStyle=`rgba(${i.R},${i.G},${i.B},${s})`}const x=0|o.line;switch(o.mode){case"break":case"wrap":if(_=0,x&&($+=r.heightTable[x-1]+1),l>$+r.heightTable[x]){g=!0;continue}d=r.ascentTable[x],u=this._$getAlignOffset(o,i),g=!1;break;case"text":{t.beginPath(),t.font=yt(f.font||"",f.size||0,!!f.italic,!!f.bold);const i=_+u,r=$+d;if(f.underline){const n=Tt(f.color||0),a=v.max(0,v.min(255*n.A+e[7],255))/255;t.lineWidth=s,t.strokeStyle=`rgba(${n.R},${n.G},${n.B},${a})`,t.beginPath(),t.moveTo(i,r+1),t.lineTo(i+o.w,r+1),t.stroke()}this._$thickness&&t.strokeText(o.text,i,r),t.fillText(o.text,i,r),_+=o.w}}}}_$mouseHit(t,e,i){return!!this._$visible&&this._$hit(t,e,i)}_$hit(t,e,i){let s=e;const r=this._$transform._$rawMatrix();1===r[0]&&0===r[1]&&0===r[2]&&1===r[3]&&0===r[4]&&0===r[5]||(s=ut(e,r));const n=this._$getBounds(null),a=gt(n,s),h=+a.xMax,o=+a.xMin,l=+a.yMax,c=+a.yMin;Q(a),Q(n);const _=v.ceil(v.abs(h-o)),$=v.ceil(v.abs(l-c));return t.setTransform(1,0,0,1,o,c),t.beginPath(),t.moveTo(0,0),t.lineTo(_,0),t.lineTo(_,$),t.lineTo(0,$),t.lineTo(0,0),s!==e&&et(s),t.isPointInPath(i.x,i.y)}_$createTextAreaElement(t){if(!this._$textarea){this._$textarea=u.createElement("textarea"),this._$textarea.value=this.text,this._$textarea.id=`${Es}_TextField_${this._$instanceId}`,this._$wordWrap||(this._$textarea.wrap="off");const t=this._$defaultTextFormat;let e="";e+="position: absolute;",e+="outline: 0;",e+=`padding: 2px 2px 2px ${v.max(3,t.leftMargin||0)}px;`,e+="margin: 0;",e+="appearance: none;",e+="resize: none;",e+="overflow: hidden;",e+="z-index: 2147483647;",e+="vertical-align: top;",this._$textarea.setAttribute("style",e),this._$textarea.addEventListener(`${Es}_blur`,(t=>{let e=t.target.value;if(e&&this._$restrict){let t=this._$restrict;"["!==t[0]&&(t="["+t),"]"!==t[t.length-1]&&(t+="]");const i=e.match(new d(t,"gm"));e=i?i.join(""):""}const i=ar();if(u.getElementById(i.contentElementId)){const t=u.getElementById(`${Es}_TextField_${this._$instanceId}`);t&&t.remove()}this.text=e,this._$focus=!1,this._$textAreaActive=!1,this._$doChanged(),x()})),this._$textarea.addEventListener("input",(t=>{const e=t.target,i=ar();let s=e.value;if(this._$restrict&&!this._$isComposing&&s){let t=this._$restrict;"["!==t[0]&&(t="["+t),"]"!==t[t.length-1]&&(t+="]");const e=s.match(new d(t,"gm"));s=e?e.join(""):""}if(!this._$isComposing&&this.text!==s){this.text=s,e.value=s,this.willTrigger(wt.CHANGE)&&this.dispatchEvent(new wt(wt.CHANGE,!0));const t=this._$transform.concatenatedMatrix,r=this._$getBounds(null);e.style.left=`${v.floor((t.tx+r.xMin+i.x/i._$scale/f)*i._$scale)}px`,e.style.top=`${v.floor((t.ty+r.yMin+i.y/i._$scale/f)*i._$scale)}px`,e.style.width=`${v.ceil((this.width-1)*i._$scale)}px`,e.style.height=`${v.ceil((this.height-1)*i._$scale)}px`}})),this._$textarea.addEventListener("compositionstart",(()=>{this._$isComposing=!0})),this._$textarea.addEventListener("compositionend",(t=>{this._$isComposing=!1;const e=t.target;let i=e.value;if(!this._$restrict||!i)return;let s=this._$restrict;"["!==s[0]&&(s="["+s),"]"!==s[s.length-1]&&(s+="]");const r=i.match(new d(s,"gm"));i=r?r.join(""):"",this.text=i,e.value=i})),this._$textarea.addEventListener("click",(()=>{this.willTrigger(It.CLICK)&&this.dispatchEvent(new It(It.CLICK))})),this._$textarea.addEventListener(Rs,(t=>{this.scrollY+=t.deltaY})),this._$textarea.addEventListener(Ls,(t=>{const e=t.target;this.scrollY=e.scrollTop})),this._$textarea.addEventListener(As,(()=>{ar()._$state="down"})),this._$textarea.addEventListener(Ss,(()=>{ar()._$state="up"})),this._$textarea.addEventListener(ws,(()=>{ar()._$state="down"})),this._$textarea.addEventListener(Fs,(()=>{ar()._$state="up"}))}const e=this._$defaultTextFormat,i=e.size?v.ceil(e.size*t*this._$transform.concatenatedMatrix.d):0;this._$textarea.style.fontSize=`${i}px`,this._$textarea.style.fontFamily=e.font||"Times New Roman",this._$textarea.style.lineHeight=(i+v.max(0,e.leading||0))/i+"em","none"!==this._$autoSize?this._$textarea.style.textAlign="center":this._$textarea.style.textAlign=e.align||"none",this._$textarea.addEventListener("keydown",(t=>{const e=t.target;let i=e.value;if(this._$restrict&&!this._$isComposing&&i){let t=this._$restrict;"["!==t[0]&&(t="["+t),"]"!==t[t.length-1]&&(t+="]");const e=i.match(new d(t,"gm"));i=e?e.join(""):""}if(this._$isComposing||(this.text=i,e.value=i),"Enter"===t.code&&!this._$multiline)return!1}));const s=this._$textarea.style;this._$border?s.border=`solid 1px #${this.borderColor.toString(16)}`:s.border="none",this._$border||this._$background?s.backgroundColor=`#${this.backgroundColor.toString(16)}`:s.backgroundColor="transparent",this._$textarea.maxLength=this._$maxChars?this._$maxChars:2147483647}_$createWorkerInstance(){if(this._$created||!Tr)return;this._$created=!0;const t=this._$getBounds(),e={command:"createTextField",buffer:new Float32Array,instanceId:this._$instanceId,parentId:this._$parent?this._$parent._$instanceId:-1,xMin:t.xMin,yMin:t.yMin,xMax:t.xMax,yMax:t.yMax,limitWidth:this.width,limitHeight:this.height,textHeight:this.textHeight,verticalAlign:this._$verticalAlign,autoSize:this._$autoSize,wordWrap:this._$wordWrap,border:this._$border,background:this._$background,thickness:this._$thickness};this._$border&&(e.borderColor=this._$borderColor),this._$background&&(e.backgroundColor=this._$backgroundColor),this._$thickness&&(e.thicknessColor=this._$backgroundColor),this._$characterId>-1&&(e.characterId=this._$characterId),this._$loaderInfo&&(e.loaderInfoId=this._$loaderInfo._$id),this._$scale9Grid&&(e.grid={x:this._$scale9Grid.x,y:this._$scale9Grid.y,w:this._$scale9Grid.width,h:this._$scale9Grid.height}),Tr.postMessage(e)}_$postProperty(){if(!Tr)return;const t=this._$createMessage();t.textAreaActive=this._$textAreaActive;const e=this._$getBounds(null);t.xMin=e.xMin,t.yMin=e.yMin,t.xMax=e.xMax,t.yMax=e.yMax,Q(e),this._$isUpdated()&&(t.limitWidth=this.width,t.limitHeight=this.height,t.textHeight=this.textHeight,t.verticalAlign=this._$verticalAlign,t.autoSize=this._$autoSize,t.wordWrap=this._$wordWrap,t.border=this._$border,this._$border&&(t.borderColor=this._$borderColor),t.background=this._$background,this._$background&&(t.backgroundColor=this._$backgroundColor),t.thickness=this._$thickness,this._$thickness&&(t.thicknessColor=this._$backgroundColor)),Tr.postMessage(t),this._$posted=!0,this._$updated=!1}}class Si{constructor(){this._$rgb="rgb",this._$mode="pad",this._$type="linear",this._$focalPointRatio=0,this._$points=tt(),this._$stops=nt()}dispose(){const t=this._$stops;for(let e=0;e<t.length;++e)Z(t[e][1]);et(this._$points)}get mode(){return this._$mode}get type(){return this._$type}get rgb(){return this._$rgb}get points(){return this._$points}get focalPointRatio(){return this._$focalPointRatio}get stops(){return this._$stops.sort(((t,e)=>{switch(!0){case t[0]>e[0]:return 1;case e[0]>t[0]:return-1;default:return 0}})),this._$stops}linear(t,e,i,s,r="rgb",n="pad"){return this._$type="linear",this._$points[0]=t,this._$points[1]=e,this._$points[2]=i,this._$points[3]=s,this._$rgb=r,this._$mode=n,this._$stops.length&&(this._$stops.length=0),this}radial(t,e,i,s,r,n,a="rgb",h="pad",o=0){return this._$type="radial",this._$points[0]=t,this._$points[1]=e,this._$points[2]=i,this._$points[3]=s,this._$points[4]=r,this._$points[5]=n,this._$rgb=a,this._$mode=h,this._$focalPointRatio=$t(o,-.975,.975,0),this._$stops.length&&(this._$stops.length=0),this}addColorStop(t,e){this._$stops.push(nt(t,e))}}class wi{constructor(t,e,i,s){this._$context=t,this._$texture=e,this._$repeat=i,this._$colorTransform=s}get texture(){return this._$texture}get repeat(){return this._$repeat}get colorTransform(){return this._$colorTransform}}class Ci{constructor(){this._$fillStyle=J(1,1,1,1),this._$strokeStyle=J(1,1,1,1),this._$lineWidth=1,this._$lineCap="round",this._$lineJoin="round",this._$miterLimit=5}get miterLimit(){return this._$miterLimit}set miterLimit(t){this._$miterLimit=t}get lineWidth(){return this._$lineWidth}set lineWidth(t){this._$lineWidth=t}get lineCap(){return this._$lineCap}set lineCap(t){this._$lineCap=t}get lineJoin(){return this._$lineJoin}set lineJoin(t){this._$lineJoin=t}get fillStyle(){return this._$fillStyle}set fillStyle(t){this._$fillStyle instanceof A&&Z(this._$fillStyle),this._$fillStyle=t}get strokeStyle(){return this._$strokeStyle}set strokeStyle(t){this._$strokeStyle instanceof A&&Z(this._$strokeStyle),this._$strokeStyle=t}clear(){this._$lineWidth=1,this._$lineCap="round",this._$lineJoin="round",this._$miterLimit=5,this._$clearFill(),this._$clearStroke()}_$clearFill(){if(this._$fillStyle instanceof Si)return this._$fillStyle.dispose(),void(this._$fillStyle=J(1,1,1,1));this._$fillStyle instanceof wi?this._$fillStyle=J(1,1,1,1):this._$fillStyle.fill(1)}_$clearStroke(){if(this._$strokeStyle instanceof Si)return this._$strokeStyle.dispose(),void(this._$strokeStyle=J(1,1,1,1));this._$strokeStyle instanceof wi?this._$strokeStyle=J(1,1,1,1):this._$strokeStyle.fill(1)}}let Fi=2048;class Ri{constructor(t){t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),this._$gl=t,this._$objectPool=[],this._$objectPoolArea=0,this._$activeTexture=-1,this._$boundTextures=[null,null,null],this._$maxWidth=0,this._$maxHeight=0,this._$atlasTextures=[],this._$atlasCacheMap=new Map,this._$positionObjectArray=[],this._$nodeObjectArray=[],this._$atlasNodes=new Map}createTextureAtlas(){const t=this._$gl.createTexture();t.width=Fi,t.height=Fi,this._$gl.activeTexture(this._$gl.TEXTURE3),this._$gl.bindTexture(this._$gl.TEXTURE_2D,t),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_S,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_T,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MIN_FILTER,this._$gl.NEAREST),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MAG_FILTER,this._$gl.NEAREST),this._$gl.texStorage2D(this._$gl.TEXTURE_2D,1,this._$gl.RGBA8,Fi,Fi),this._$gl.bindTexture(this._$gl.TEXTURE_2D,null),this._$activeTexture>-1&&this._$gl.activeTexture(this._$activeTexture);const e=this._$atlasTextures.length;this._$atlasNodes.set(e,[]),this._$atlasCacheMap.set(e,[]),this._$atlasTextures.push(t)}getAtlasTexture(t){return this._$atlasTextures[t]}getNode(t,e,i,s){const r=this._$nodeObjectArray.length?this._$nodeObjectArray.pop():{x:0,y:0,w:0,h:0};return r.x=t,r.y=e,r.w=i,r.h=s,r}createCachePosition(t,e){const i=this._$positionObjectArray.length?this._$positionObjectArray.pop():{index:0,x:0,y:0,w:0,h:0};i.x=i.y=0,i.w=t,i.h=e;for(const[s,r]of this._$atlasNodes){if(!r.length)return t>e?(Fi-t-1>0&&r.push(this.getNode(t+1,0,Fi-t-1,e)),Fi-e-1>0&&r.push(this.getNode(0,e+1,Fi,Fi-e-1))):(Fi-e-1>0&&r.push(this.getNode(0,e+1,t,Fi-e-1)),Fi-t-1>0&&r.push(this.getNode(t+1,0,Fi-t-1,Fi))),i.index=s,this._$atlasCacheMap.get(i.index).push(i),i;const n=r.length;for(let a=0;a<n;++a){const n=r[a];if(!(t>n.w||e>n.h))return i.index=s,i.x=n.x,i.y=n.y,this._$atlasCacheMap.get(i.index).push(i),n.w!==t||n.h!==e?t>e?(n.h-e-1>0&&r.push(this.getNode(n.x,n.y+e+1,n.w,n.h-e-1)),n.w-t-1>0?(n.x=n.x+t+1,n.w=n.w-t-1,n.h=e):(r.splice(a,1),this._$nodeObjectArray.push(n))):(n.w-t-1>0&&r.push(this.getNode(n.x+t+1,n.y,n.w-t-1,n.h)),n.h-e-1>0?(n.y=n.y+e+1,n.w=t,n.h=n.h-e-1):(r.splice(a,1),this._$nodeObjectArray.push(n))):(r.splice(a,1),this._$nodeObjectArray.push(n)),i}}const s=this._$atlasTextures.length;this.createTextureAtlas();const r=this._$atlasNodes.get(s);return t>e?(Fi-t-1>0&&r.push(this.getNode(t+1,0,Fi-t-1,e)),Fi-e-1>0&&r.push(this.getNode(0,e+1,Fi,Fi-e-1))):(Fi-e-1>0&&r.push(this.getNode(0,e+1,t,Fi-e-1)),Fi-t-1>0&&r.push(this.getNode(t+1,0,Fi-t-1,Fi))),i.index=s,this._$atlasCacheMap.get(i.index).push(i),i}releasePosition(t){var e;this._$atlasNodes.has(t.index)&&(null===(e=this._$atlasNodes.get(t.index))||void 0===e||e.unshift(this.getNode(t.x,t.y,t.w,t.h)),this._$positionObjectArray.push(t))}clearCache(){for(const t of this._$atlasCacheMap.values())t.length=0;for(const t of this._$atlasNodes.values())t.length=0}_$createTexture(t,e){const i=this._$gl.createTexture();return i.width=0,i.height=0,i.area=0,i.dirty=!0,i.smoothing=!0,this.bind0(i,!1),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_S,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_T,this._$gl.CLAMP_TO_EDGE),i.width=t,i.height=e,i.area=t*e,i.dirty=!1,this._$gl.texStorage2D(this._$gl.TEXTURE_2D,1,this._$gl.RGBA8,t,e),i}_$getTexture(t,e){for(let i=0;i<this._$objectPool.length;i++){const s=this._$objectPool[i];if(s.width===t&&s.height===e)return this._$objectPool.splice(i,1),this._$objectPoolArea-=s.area,this.bind0(s,!1),s}return this._$createTexture(t,e)}create(t,e,i=null,s=!1,r=!0){const n=this._$getTexture(t,e);return s&&this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r||this._$gl.pixelStorei(this._$gl.UNPACK_FLIP_Y_WEBGL,!1),n.width!==t||n.height!==e?(n.width=t,n.height=e,n.area=t*e,n.dirty=!1,this._$gl.texImage2D(this._$gl.TEXTURE_2D,0,this._$gl.RGBA,t,e,0,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)):i&&(n.dirty=!1,this._$gl.texSubImage2D(this._$gl.TEXTURE_2D,0,0,0,t,e,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)),s&&this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r||this._$gl.pixelStorei(this._$gl.UNPACK_FLIP_Y_WEBGL,!0),n}createFromImage(t,e=!1){return this._$createFromElement(t.width,t.height,t,e)}createFromCanvas(t){return this._$createFromElement(t.width,t.height,t,!1)}createFromVideo(t,e=!1){return this._$createFromElement(t.videoWidth,t.videoHeight,t,e)}_$createFromElement(t,e,i,s=!1){const r=this._$getTexture(t,e);return r.dirty=!1,this.bind0(r,s),this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.width!==t||r.height!==e?(r.width=t,r.height=e,r.area=t*e,this._$gl.texImage2D(this._$gl.TEXTURE_2D,0,this._$gl.RGBA,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)):this._$gl.texSubImage2D(this._$gl.TEXTURE_2D,0,0,0,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i),this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r}release(t){if(t.area>this._$maxWidth*this._$maxHeight*2)this._$gl.deleteTexture(t);else if(t.dirty=!0,this._$objectPool.push(t),this._$objectPoolArea+=t.area,this._$objectPool.length&&this._$objectPoolArea>this._$maxWidth*this._$maxHeight*10){const t=this._$objectPool.shift();this._$objectPoolArea-=t.area,this._$gl.deleteTexture(t)}}bind0(t,e=null){this._$bindTexture(2,this._$gl.TEXTURE2,null,null),this._$bindTexture(1,this._$gl.TEXTURE1,null,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,e)}bind01(t,e,i=null){this._$bindTexture(2,this._$gl.TEXTURE2,null,null),this._$bindTexture(1,this._$gl.TEXTURE1,e,i),this._$bindTexture(0,this._$gl.TEXTURE0,t,i)}bind012(t,e,i,s=null){this._$bindTexture(2,this._$gl.TEXTURE2,i,s),this._$bindTexture(1,this._$gl.TEXTURE1,e,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,null)}bind02(t,e,i=null){this._$bindTexture(2,this._$gl.TEXTURE2,e,i),this._$bindTexture(1,this._$gl.TEXTURE1,null,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,null)}_$bindTexture(t,e,i=null,s=null){const r=i!==this._$boundTextures[t],n=null!==s&&null!==i&&s!==i.smoothing;if((r||n||e===this._$gl.TEXTURE0)&&e!==this._$activeTexture&&(this._$activeTexture=e,this._$gl.activeTexture(e)),r&&(this._$boundTextures[t]=i,this._$gl.bindTexture(this._$gl.TEXTURE_2D,i)),n){i&&(i.smoothing=!!s);const t=s?this._$gl.LINEAR:this._$gl.NEAREST;this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MIN_FILTER,t),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MAG_FILTER,t)}}}class Bi{constructor(t){this._$gl=t,this._$objectPool=nt(),this._$objectPoolArea=0,this._$maxWidth=0,this._$maxHeight=0}set maxWidth(t){this._$maxWidth=t}set maxHeight(t){this._$maxHeight=t}_$createStencilBuffer(){const t=this._$gl.createRenderbuffer();if(!t)throw new Error("the stencil buffer is null.");return t.width=0,t.height=0,t.area=0,t.dirty=!0,t}_$getStencilBuffer(t,e){const i=this._$objectPool.length;for(let s=0;s<i;++s){const i=this._$objectPool[s];if(i.width===t&&i.height===e)return this._$objectPool.splice(s,1),this._$objectPoolArea-=i.area,i}if(i>100){const t=this._$objectPool.shift();if(t)return this._$objectPoolArea-=t.area,t}return this._$createStencilBuffer()}create(t,e){const i=this._$getStencilBuffer(t,e);return i.width===t&&i.height===e||(i.width=t,i.height=e,i.area=t*e,i.dirty=!1,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,i),this._$gl.renderbufferStorage(this._$gl.RENDERBUFFER,this._$gl.STENCIL_INDEX8,t,e)),i}release(t){if(t.area>this._$maxWidth*this._$maxHeight*2)this._$gl.deleteRenderbuffer(t);else if(t.dirty=!0,this._$objectPool.push(t),this._$objectPoolArea+=t.area,this._$objectPoolArea>this._$maxWidth*this._$maxHeight*10){const t=this._$objectPool.shift();t&&(this._$objectPoolArea-=t.area,this._$gl.deleteRenderbuffer(t))}}}class Ii{constructor(t,e){this._$gl=t,this._$samples=e,this._$objectPool=nt()}set samples(t){this._$samples=t}_$createColorBuffer(){const t=this._$gl.createRenderbuffer();if(!t)throw new Error("the color buffer is null.");const e=this._$gl.createRenderbuffer();if(!e)throw new Error("the stencil buffer is null.");return t.stencil=e,t.samples=0,t.width=0,t.height=0,t.area=0,t.dirty=!0,t}_$getColorBuffer(t){if(!this._$objectPool.length)return this._$createColorBuffer();const e=this._$bsearch(t);if(e<this._$objectPool.length){const t=this._$objectPool[e];return this._$objectPool.splice(e,1),t}const i=this._$objectPool.shift();if(!i)throw new Error("the color buffer is void.");return i}create(t,e,i=0){t=v.max(256,lt(t)),e=v.max(256,lt(e));const s=this._$getColorBuffer(t*e);return i||(i=this._$samples),(s.width<t||s.height<e||s.samples!==i)&&(t=v.max(t,s.width),e=v.max(e,s.height),s.samples=i,s.width=t,s.height=e,s.area=t*e,s.dirty=!1,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,s),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,i,this._$gl.RGBA8,t,e),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,s.stencil),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,i,this._$gl.STENCIL_INDEX8,t,e)),s}release(t){t.dirty=!0;const e=this._$bsearch(t.area);this._$objectPool.splice(e,0,t)}_$bsearch(t){let e=-1,i=this._$objectPool.length;for(;v.abs(i-e)>1;){const s=v.floor((i+e)/2);t<=this._$objectPool[s].area?i=s:e=s}return i}}class Li{constructor(t,e){this._$gl=t,this._$objectPool=[],this._$frameBuffer=t.createFramebuffer(),t.bindFramebuffer(t.READ_FRAMEBUFFER,this._$frameBuffer),this._$frameBufferTexture=t.createFramebuffer(),this._$currentAttachment=null,this._$isBinding=!1,this._$textureManager=new Ri(t),this._$stencilBufferPool=new Bi(t),this._$colorBufferPool=new Ii(t,e),this._$isRenderBinding=!1,this._$colorBuffer=this._$gl.createRenderbuffer(),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,e,this._$gl.RGBA8,Fi,Fi),this._$stencilBuffer=this._$gl.createRenderbuffer(),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$stencilBuffer),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,e,this._$gl.STENCIL_INDEX8,Fi,Fi)}bindRenderBuffer(){this._$isBinding||(this._$isBinding=!0,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)),this._$isRenderBinding||(this._$isRenderBinding=!0,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$stencilBuffer),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.STENCIL_ATTACHMENT,this._$gl.RENDERBUFFER,this._$stencilBuffer))}get currentAttachment(){return this._$currentAttachment}get textureManager(){return this._$textureManager}createCacheAttachment(t,e,i=!1,s=0){const r=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!1},n=this._$textureManager.create(t,e);return r.width=t,r.height=e,i?(r.color=this._$colorBufferPool.create(t,e,s),r.texture=n,r.msaa=!0,r.stencil=r.color.stencil):(r.color=n,r.texture=n,r.msaa=!1,r.stencil=this._$stencilBufferPool.create(t,e)),r.mask=!1,r.clipLevel=0,r.isActive=!0,r}clearCache(){this._$textureManager.clearCache()}setMaxSize(t,e){this._$stencilBufferPool._$maxWidth=t,this._$stencilBufferPool._$maxHeight=e,this._$textureManager._$maxWidth=t,this._$textureManager._$maxHeight=e}createTextureAttachment(t,e){const i=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!1},s=this._$textureManager.create(t,e);return i.width=t,i.height=e,i.color=s,i.texture=s,i.msaa=!1,i.stencil=null,i.mask=!1,i.clipLevel=0,i.isActive=!0,i}createTextureAttachmentFrom(t){const e=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!0};return e.width=t.width,e.height=t.height,e.color=t,e.texture=t,e.msaa=!1,e.stencil=null,e.mask=!1,e.clipLevel=0,e.isActive=!0,e}releaseAttachment(t=null,e=!1){t&&t.isActive&&(t.msaa?t.color instanceof WebGLRenderbuffer&&this._$colorBufferPool.release(t.color):t.stencil&&this._$stencilBufferPool.release(t.stencil),e&&t.texture&&this._$textureManager.release(t.texture),t.color=null,t.texture=null,t.stencil=null,t.isActive=!1,this._$objectPool.push(t))}bind(t){this._$currentAttachment=t,this._$isBinding||(this._$isBinding=!0,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)),t.msaa?t.color instanceof WebGLRenderbuffer&&(this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,t.color),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.RENDERBUFFER,t.color)):t.color instanceof WebGLTexture&&(t.color&&this._$textureManager.bind0(t.color),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,t.color,0)),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,t.stencil),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.STENCIL_ATTACHMENT,this._$gl.RENDERBUFFER,t.stencil),this._$isRenderBinding=!1}unbind(){this._$currentAttachment=null,this._$isBinding&&(this._$isBinding=!1,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,null))}transferToMainTexture(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$currentAttachment.texture;if(!i)throw new Error("the texture is null.");this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture),this._$textureManager.bind0(i),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,i,0),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,null),this._$gl.blitFramebuffer(0,0,t,e,0,0,t,e,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBuffer)}createCachePosition(t,e){return this._$textureManager.createCachePosition(t,e)}transferTexture(t){this._$gl.disable(this._$gl.SCISSOR_TEST),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture);const e=this._$textureManager.getAtlasTexture(t.index);this._$textureManager.bind0(e),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,e,0);const i=v.max(0,t.x-1),s=v.max(0,t.y-1),r=v.min(Fi,t.x+t.w+1),n=v.min(Fi,t.y+t.h+1);this._$gl.blitFramebuffer(i,s,r,n,i,s,r,n,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)}getTextureFromCurrentAttachment(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");if(!this._$currentAttachment.msaa&&this._$currentAttachment.texture)return this._$currentAttachment.texture;const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$currentAttachment.texture;if(!i)throw new Error("the texture is null.");return i.dirty=!1,this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture),this._$textureManager.bind0(i),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,i,0),this._$gl.blitFramebuffer(0,0,t,e,0,0,t,e,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer),i}createTextureFromPixels(t,e,i=null,s=!1,r=!0){return this._$textureManager.create(t,e,i,s,r)}createTextureFromCanvas(t){return this._$textureManager.createFromCanvas(t)}createTextureFromImage(t,e=!1){return this._$textureManager.createFromImage(t,e)}createTextureFromVideo(t,e=!1){return this._$textureManager.createFromVideo(t,e)}createTextureFromCurrentAttachment(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$textureManager.create(t,e);return this._$textureManager.bind0(i),this._$gl.copyTexSubImage2D(this._$gl.TEXTURE_2D,0,0,0,0,0,t,e),i}releaseTexture(t){this._$textureManager.release(t)}}class Pi{constructor(){this._$bezierConverterBuffer=new A(32)}cubicToQuad(t,e,i,s,r,n,a,h){this._$split2Cubic(t,e,i,s,r,n,a,h,0,16),this._$split2Cubic(this._$bezierConverterBuffer[0],this._$bezierConverterBuffer[1],this._$bezierConverterBuffer[2],this._$bezierConverterBuffer[3],this._$bezierConverterBuffer[4],this._$bezierConverterBuffer[5],this._$bezierConverterBuffer[6],this._$bezierConverterBuffer[7],0,8),this._$split2Cubic(this._$bezierConverterBuffer[16],this._$bezierConverterBuffer[17],this._$bezierConverterBuffer[18],this._$bezierConverterBuffer[19],this._$bezierConverterBuffer[20],this._$bezierConverterBuffer[21],this._$bezierConverterBuffer[22],this._$bezierConverterBuffer[23],16,24),this._$split2Quad(this._$bezierConverterBuffer[0],this._$bezierConverterBuffer[1],this._$bezierConverterBuffer[2],this._$bezierConverterBuffer[3],this._$bezierConverterBuffer[4],this._$bezierConverterBuffer[5],this._$bezierConverterBuffer[6],this._$bezierConverterBuffer[7],0),this._$split2Quad(this._$bezierConverterBuffer[8],this._$bezierConverterBuffer[9],this._$bezierConverterBuffer[10],this._$bezierConverterBuffer[11],this._$bezierConverterBuffer[12],this._$bezierConverterBuffer[13],this._$bezierConverterBuffer[14],this._$bezierConverterBuffer[15],8),this._$split2Quad(this._$bezierConverterBuffer[16],this._$bezierConverterBuffer[17],this._$bezierConverterBuffer[18],this._$bezierConverterBuffer[19],this._$bezierConverterBuffer[20],this._$bezierConverterBuffer[21],this._$bezierConverterBuffer[22],this._$bezierConverterBuffer[23],16),this._$split2Quad(this._$bezierConverterBuffer[24],this._$bezierConverterBuffer[25],this._$bezierConverterBuffer[26],this._$bezierConverterBuffer[27],this._$bezierConverterBuffer[28],this._$bezierConverterBuffer[29],this._$bezierConverterBuffer[30],this._$bezierConverterBuffer[31],24)}_$split2Cubic(t,e,i,s,r,n,a,h,o,l){const c=.125*(t+3*(i+r)+a),_=.125*(e+3*(s+n)+h),$=.125*(a+r-i-t),u=.125*(h+n-s-e);this._$bezierConverterBuffer[o]=t,this._$bezierConverterBuffer[o+1]=e,this._$bezierConverterBuffer[o+2]=.5*(t+i),this._$bezierConverterBuffer[o+3]=.5*(e+s),this._$bezierConverterBuffer[o+4]=c-$,this._$bezierConverterBuffer[o+5]=_-u,this._$bezierConverterBuffer[o+6]=c,this._$bezierConverterBuffer[o+7]=_,this._$bezierConverterBuffer[l]=c,this._$bezierConverterBuffer[l+1]=_,this._$bezierConverterBuffer[l+2]=c+$,this._$bezierConverterBuffer[l+3]=_+u,this._$bezierConverterBuffer[l+4]=.5*(r+a),this._$bezierConverterBuffer[l+5]=.5*(n+h),this._$bezierConverterBuffer[l+6]=a,this._$bezierConverterBuffer[l+7]=h}_$split2Quad(t,e,i,s,r,n,a,h,o){const l=.125*(t+3*(i+r)+a),c=.125*(e+3*(s+n)+h);this._$bezierConverterBuffer[o]=.25*t+.75*i,this._$bezierConverterBuffer[o+1]=.25*e+.75*s,this._$bezierConverterBuffer[o+2]=l,this._$bezierConverterBuffer[o+3]=c,this._$bezierConverterBuffer[o+4]=.75*r+.25*a,this._$bezierConverterBuffer[o+5]=.75*n+.25*h,this._$bezierConverterBuffer[o+6]=a,this._$bezierConverterBuffer[o+7]=h}}class Oi{constructor(){this._$currentPath=nt(),this._$vertices=nt(),this._$bezierConverter=new Pi}get vertices(){return this._$pushCurrentPathToVertices(),this._$vertices}begin(){for(this._$currentPath.length=0;this._$vertices.length;)at(this._$vertices.pop())}moveTo(t,e){this._$currentPath.length?this._$equalsToLastPoint(t,e)||(this._$pushCurrentPathToVertices(),this._$pushPointToCurrentPath(t,e,!1)):this._$pushPointToCurrentPath(t,e,!1)}lineTo(t,e){this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(t,e)||this._$pushPointToCurrentPath(t,e,!1)}quadTo(t,e,i,s){this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(i,s)||(this._$pushPointToCurrentPath(t,e,!0),this._$pushPointToCurrentPath(i,s,!1))}cubicTo(t,e,i,s,r,n){if(this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(r,n))return;const a=+this._$currentPath[this._$currentPath.length-3],h=+this._$currentPath[this._$currentPath.length-2];this._$bezierConverter.cubicToQuad(a,h,t,e,i,s,r,n);const o=this._$bezierConverter._$bezierConverterBuffer;for(let t=0;t<32;)this.quadTo(o[t++],o[t++],o[t++],o[t++])}drawCircle(t,e,i){const s=i,r=.5522847498307936*i;this.cubicTo(t+s,e+r,t+r,e+s,t,e+s),this.cubicTo(t-r,e+s,t-s,e+r,t-s,e),this.cubicTo(t-s,e-r,t-r,e-s,t,e-s),this.cubicTo(t+r,e-s,t+s,e-r,t+s,e)}close(){if(this._$currentPath.length<=6)return;const t=+this._$currentPath[0],e=+this._$currentPath[1];this._$equalsToLastPoint(t,e)||this._$pushPointToCurrentPath(t,e,!1)}_$equalsToLastPoint(t,e){const i=+this._$currentPath[this._$currentPath.length-3],s=+this._$currentPath[this._$currentPath.length-2];return t===i&&e===s}_$pushPointToCurrentPath(t,e,i){this._$currentPath.push(t,e,i)}_$pushCurrentPathToVertices(){this._$currentPath.length<4?this._$currentPath.length=0:(this._$vertices.push(this._$currentPath),this._$currentPath=nt())}createRectVertices(t,e,i,s){return nt(nt(t,e,!1,t+i,e,!1,t+i,e+s,!1,t,e+s,!1))}}class ki{constructor(){this.enabled=!1,this.parentMatrixA=1,this.parentMatrixB=0,this.parentMatrixC=0,this.parentMatrixD=0,this.parentMatrixE=1,this.parentMatrixF=0,this.parentMatrixG=0,this.parentMatrixH=0,this.parentMatrixI=1,this.ancestorMatrixA=1,this.ancestorMatrixB=0,this.ancestorMatrixC=0,this.ancestorMatrixD=0,this.ancestorMatrixE=1,this.ancestorMatrixF=0,this.ancestorMatrixG=0,this.ancestorMatrixH=0,this.ancestorMatrixI=1,this.parentViewportX=0,this.parentViewportY=0,this.parentViewportW=0,this.parentViewportH=0,this.minXST=1e-5,this.minYST=1e-5,this.minXPQ=1e-5,this.minYPQ=1e-5,this.maxXST=.99999,this.maxYST=.99999,this.maxXPQ=.99999,this.maxYPQ=.99999}enable(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m){const x=r.xMax-r.xMin,b=r.yMax-r.yMin,T=n.w,y=n.h,E=v.abs(v.ceil(x*a)),A=v.abs(v.ceil(b*a)),M=T>0?(n.x-r.xMin)/x:1e-5,S=y>0?(n.y-r.yMin)/b:1e-5,w=T>0?(n.x+n.w-r.xMin)/x:.99999,C=y>0?(n.y+n.h-r.yMin)/b:.99999;let F=E*M/i,R=A*S/s,B=(i-E*(1-w))/i,I=(s-A*(1-C))/s;if(F>=B){const t=M/(M+(1-w));F=v.max(t-1e-5,0),B=v.min(t+1e-5,1)}if(R>=I){const t=S/(S+(1-C));R=v.max(t-1e-5,0),I=v.min(t+1e-5,1)}this.enabled=!0,this.parentMatrixA=h,this.parentMatrixB=o,this.parentMatrixD=l,this.parentMatrixE=c,this.parentMatrixG=_,this.parentMatrixH=$,this.ancestorMatrixA=u,this.ancestorMatrixB=d,this.ancestorMatrixD=g,this.ancestorMatrixE=f,this.ancestorMatrixG=p,this.ancestorMatrixH=m,this.parentViewportX=t,this.parentViewportY=e,this.parentViewportW=i,this.parentViewportH=s,this.minXST=M,this.minYST=S,this.minXPQ=F,this.minYPQ=R,this.maxXST=w,this.maxYST=C,this.maxXPQ=B,this.maxYPQ=I}disable(){this.enabled=!1}}class Ni{constructor(t,e){this._$gl=t,this._$array=[],this._$map=ot();const i=this._$gl.getProgramParameter(e,this._$gl.ACTIVE_UNIFORMS);for(let t=0;t<i;t++){const i=this._$gl.getActiveUniform(e,t),s=i.name.endsWith("[0]")?i.name.slice(0,-3):i.name,r=this._$gl.getUniformLocation(e,s);if(i.type===this._$gl.SAMPLER_2D&&1===i.size)continue;const n={};switch(i.type){case this._$gl.FLOAT_VEC4:n.method=this._$gl.uniform4fv.bind(this._$gl,r),n.array=new A(4*i.size),n.assign=-1;break;case this._$gl.INT_VEC4:n.method=this._$gl.uniform4iv.bind(this._$gl,r),n.array=new M(4*i.size),n.assign=-1;break;case this._$gl.SAMPLER_2D:n.method=this._$gl.uniform1iv.bind(this._$gl,r),n.array=new M(i.size),n.assign=1;break;case this._$gl.FLOAT:case this._$gl.FLOAT_VEC2:case this._$gl.FLOAT_VEC3:case this._$gl.FLOAT_MAT2:case this._$gl.FLOAT_MAT3:case this._$gl.FLOAT_MAT4:case this._$gl.INT:case this._$gl.INT_VEC2:case this._$gl.INT_VEC3:default:throw new Error("Use gl.FLOAT_VEC4 or gl.INT_VEC4 instead")}this._$array.push(n),this._$map.set(s,n)}}getArray(t){const e=this._$map.get(t);if(!e||!e.array)throw new Error("the UniformData is null.");return e.array}get textures(){const t=this._$map.get("u_textures");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get highp(){const t=this._$map.get("u_highp");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get mediump(){const t=this._$map.get("u_mediump");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get integer(){const t=this._$map.get("u_integer");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}bindUniforms(){const t=this._$array.length;for(let e=0;e<t;e++){const t=this._$array[e];void 0!==t.method&&void 0!==t.assign&&(t.assign<0?t.method(t.array):t.assign>0&&(t.assign--,t.method(t.array)))}}}class Di{constructor(){this._$attributes=[],this._$count=0}get attributes(){return this._$attributes}get count(){return this._$count}set count(t){this._$count=t}clear(){this._$attributes.length=0,this._$count=0}}class Ui{constructor(t,e,i,s){this._$gl=t,this._$context=e,this._$program=this._$createProgram(i,s),this._$uniform=new Ni(t,this._$program),this._$instance=null}get instance(){return this._$instance||(this._$instance=new Di),this._$instance}get uniform(){return this._$uniform}_$createProgram(t,e){const i=this._$gl.createProgram();i.id=p++;const s=this._$gl.createShader(this._$gl.VERTEX_SHADER);this._$gl.shaderSource(s,t),this._$gl.compileShader(s);const r=this._$gl.createShader(this._$gl.FRAGMENT_SHADER);return this._$gl.shaderSource(r,e),this._$gl.compileShader(r),this._$gl.attachShader(i,s),this._$gl.attachShader(i,r),this._$gl.linkProgram(i),this._$gl.detachShader(i,s),this._$gl.detachShader(i,r),this._$gl.deleteShader(s),this._$gl.deleteShader(r),i}_$attachProgram(){const t=this._$context.shaderList;t.currentProgramId!==this._$program.id&&(t.currentProgramId=this._$program.id,this._$gl.useProgram(this._$program))}drawArraysInstanced(t){this._$attachProgram(),this._$context.vao.bindInstnceArray(t),this._$gl.drawArraysInstanced(this._$gl.TRIANGLE_STRIP,0,4,t.count)}_$drawImage(){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bindCommonVertexArray(),this._$gl.drawArrays(this._$gl.TRIANGLE_STRIP,0,4)}_$drawGradient(t,e){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bindGradientVertexArray(t,e),this._$gl.drawArrays(this._$gl.TRIANGLE_STRIP,0,4)}_$stroke(t){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawElements(this._$gl.TRIANGLES,t.indexCount,this._$gl.UNSIGNED_SHORT,0)}_$fill(t){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t);const e=t.indexRanges,i=e[e.length-1];this._$gl.drawArrays(this._$gl.TRIANGLES,0,i.first+i.count)}_$containerClip(t,e,i){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawArrays(this._$gl.TRIANGLES,e,i)}_$drawPoints(t,e,i){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawArrays(this._$gl.POINTS,e,i)}}class Vi{static FUNCTION_GRID_OFF(){return"\n\nvec2 applyMatrix(in vec2 vertex) {\n mat3 matrix = mat3(\n u_highp[0].xyz,\n u_highp[1].xyz,\n u_highp[2].xyz\n );\n\n vec2 position = (matrix * vec3(vertex, 1.0)).xy;\n\n return position;\n}\n\n"}static FUNCTION_GRID_ON(t){return`\n\nvec2 applyMatrix(in vec2 vertex) {\n mat3 parent_matrix = mat3(\n u_highp[${t}].xyz,\n u_highp[${t+1}].xyz,\n u_highp[${t+2}].xyz\n );\n mat3 ancestor_matrix = mat3(\n u_highp[${t+3}].xyz,\n u_highp[${t+4}].xyz,\n u_highp[${t+5}].xyz\n );\n vec2 parent_offset = vec2(u_highp[${t+2}].w, u_highp[${t+3}].w);\n vec2 parent_size = vec2(u_highp[${t+4}].w, u_highp[${t+5}].w);\n vec4 grid_min = u_highp[${t+6}];\n vec4 grid_max = u_highp[${t+7}];\n\n vec2 position = (parent_matrix * vec3(vertex, 1.0)).xy;\n position = (position - parent_offset) / parent_size;\n\n vec4 ga = grid_min;\n vec4 gb = grid_max - grid_min;\n vec4 gc = vec4(1.0) - grid_max;\n\n vec2 pa = position;\n vec2 pb = position - grid_min.st;\n vec2 pc = position - grid_max.st;\n\n position = (ga.pq / ga.st) * min(pa, ga.st)\n + (gb.pq / gb.st) * clamp(pb, vec2(0.0), gb.st)\n + (gc.pq / gc.st) * max(vec2(0.0), pc);\n\n position = position * parent_size + parent_offset;\n position = (ancestor_matrix * vec3(position, 1.0)).xy;\n\n return position;\n}\n\n`}}class Gi{static TEMPLATE(t,e,i,s){const r=e-1,n=i?this.VARYING_UV_ON():"",a=i?this.STATEMENT_UV_ON():"";return`#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\nlayout (location = 1) in vec2 a_option1;\nlayout (location = 2) in vec2 a_option2;\nlayout (location = 3) in float a_type;\n\nuniform vec4 u_highp[${t}];\n\n${n}\n\n${s?Vi.FUNCTION_GRID_ON(i?5:0):Vi.FUNCTION_GRID_OFF()}\n\nfloat crossVec2(in vec2 v1, in vec2 v2) {\n return v1.x * v2.y - v2.x * v1.y;\n}\n\nvec2 perpendicularVec2(in vec2 v1) {\n float face = u_highp[${r}][1];\n\n return face * vec2(v1.y, -v1.x);\n}\n\nvec2 calculateNormal(in vec2 direction) {\n vec2 normalized = normalize(direction);\n return perpendicularVec2(normalized);\n}\n\nvec2 calculateIntersection(in vec2 v1, in vec2 v2, in vec2 o1, in vec2 o2) {\n float t = crossVec2(o2 - o1, v2) / crossVec2(v1, v2);\n return (o1 + t * v1);\n}\n\nvec2 calculateAnchor(in vec2 position, in float convex, out vec2 v1, out vec2 v2, out vec2 o1, out vec2 o2) {\n float miter_limit = u_highp[${r}][2];\n\n vec2 a = applyMatrix(a_option1);\n vec2 b = applyMatrix(a_option2);\n\n v1 = convex * (position - a);\n v2 = convex * (b - position);\n o1 = calculateNormal(v1) + a;\n o2 = calculateNormal(v2) + position;\n\n vec2 anchor = calculateIntersection(v1, v2, o1, o2) - position;\n return normalize(anchor) * min(length(anchor), miter_limit);\n}\n\nvoid main() {\n vec2 viewport = vec2(u_highp[0].w, u_highp[1].w);\n float half_width = u_highp[${r}][0];\n\n vec2 position = applyMatrix(a_vertex);\n vec2 offset = vec2(0.0);\n vec2 v1, v2, o1, o2;\n\n if (a_type == 1.0 || a_type == 2.0) { // 線分\n offset = calculateNormal(a_option2 * (applyMatrix(a_option1) - position));\n } else if (a_type == 10.0) { // スクエア線端\n offset = normalize(position - applyMatrix(a_option1));\n offset += a_option2 * perpendicularVec2(offset);\n } else if (a_type == 21.0) { // マイター結合(線分Bの凸側)\n offset = calculateAnchor(position, 1.0, v1, v2, o1, o2);\n offset = calculateIntersection(v2, perpendicularVec2(offset), o2, position + offset) - position;\n } else if (a_type == 22.0) { // マイター結合(線分Aの凸側)\n offset = calculateAnchor(position, 1.0, v1, v2, o1, o2);\n offset = calculateIntersection(v1, perpendicularVec2(offset), o1, position + offset) - position;\n } else if (a_type == 23.0) { // マイター結合(線分Aの凹側)\n offset = calculateAnchor(position, -1.0, v1, v2, o1, o2);\n offset = calculateIntersection(v1, perpendicularVec2(offset), o1, position + offset) - position;\n } else if (a_type == 24.0) { // マイター結合(線分Bの凹側)\n offset = calculateAnchor(position, -1.0, v1, v2, o1, o2);\n offset = calculateIntersection(v2, perpendicularVec2(offset), o2, position + offset) - position;\n } else if (a_type >= 30.0) { // ラウンド結合\n float face = u_highp[${r}][1];\n float rad = face * (a_type - 30.0) * 0.3488888889; /* 0.3488888889 = PI / 9.0 */\n offset = mat2(cos(rad), sin(rad), -sin(rad), cos(rad)) * vec2(1.0, 0.0);\n }\n \n offset *= half_width;\n position += offset;\n ${a}\n\n position /= viewport;\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n`}static VARYING_UV_ON(){return"\nout vec2 v_uv;\n"}static STATEMENT_UV_ON(){return"\n mat3 uv_matrix = mat3(\n u_highp[0].xyz,\n u_highp[1].xyz,\n u_highp[2].xyz\n );\n mat3 inverse_matrix = mat3(\n u_highp[3].xyz,\n u_highp[4].xyz,\n vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)\n );\n\n v_uv = (uv_matrix * vec3(a_vertex, 1.0)).xy;\n v_uv += offset;\n v_uv = (inverse_matrix * vec3(v_uv, 1.0)).xy;\n"}}class zi{static TEMPLATE(t,e,i,s){const r=i?this.ATTRIBUTE_BEZIER_ON():"",n=i?this.VARYING_BEZIER_ON():e?this.VARYING_UV_ON():"",a=i?this.STATEMENT_BEZIER_ON():e?this.STATEMENT_UV_ON():"";return`#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n${r}\n\nuniform vec4 u_highp[${t}];\n\n${n}\n\n${s?Vi.FUNCTION_GRID_ON(e?5:0):Vi.FUNCTION_GRID_OFF()}\n\nvoid main() {\n vec2 viewport = vec2(u_highp[0].w, u_highp[1].w);\n\n ${a}\n\n vec2 pos = applyMatrix(a_vertex) / viewport;\n pos = pos * 2.0 - 1.0;\n gl_Position = vec4(pos.x, -pos.y, 0.0, 1.0);\n}\n\n`}static ATTRIBUTE_BEZIER_ON(){return"\nlayout (location = 1) in vec2 a_bezier;\n"}static VARYING_UV_ON(){return"\nout vec2 v_uv;\n"}static VARYING_BEZIER_ON(){return"\nout vec2 v_bezier;\n"}static STATEMENT_UV_ON(){return"\n mat3 uv_matrix = mat3(\n u_highp[0].xyz,\n u_highp[1].xyz,\n u_highp[2].xyz\n );\n mat3 inverse_matrix = mat3(\n u_highp[3].xyz,\n u_highp[4].xyz,\n vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)\n );\n\n v_uv = (inverse_matrix * uv_matrix * vec3(a_vertex, 1.0)).xy;\n"}static STATEMENT_BEZIER_ON(){return"\n v_bezier = a_bezier;\n"}}class Yi{static FUNCTION_IS_INSIDE(){return"\n\nfloat isInside(in vec2 uv) {\n return step(4.0, dot(step(vec4(0.0, uv.x, 0.0, uv.y), vec4(uv.x, 1.0, uv.y, 1.0)), vec4(1.0)));\n}\n\n"}static STATEMENT_INSTANCED_COLOR_TRANSFORM_ON(){return"\n src.rgb /= max(0.0001, src.a);\n src = clamp(src * mul + add, 0.0, 1.0);\n src.rgb *= src.a;\n"}static STATEMENT_COLOR_TRANSFORM_ON(t){return`\n vec4 mul = u_mediump[${t}];\n vec4 add = u_mediump[${t+1}];\n${Yi.STATEMENT_INSTANCED_COLOR_TRANSFORM_ON()}\n`}}class Xi{static SOLID_COLOR(){return"#version 300 es\nprecision mediump float;\n\nuniform vec4 u_mediump;\n\nout vec4 o_color;\n\nvoid main() {\n o_color = vec4(u_mediump.rgb * u_mediump.a, u_mediump.a);\n}\n\n"}static BITMAP_CLIPPED(){return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump[3];\n\nin vec2 v_uv;\nout vec4 o_color;\n\nvoid main() {\n vec2 uv = vec2(v_uv.x, u_mediump[0].y - v_uv.y) / u_mediump[0].xy;\n\n vec4 src = texture(u_texture, uv);\n ${Yi.STATEMENT_COLOR_TRANSFORM_ON(1)}\n o_color = src;\n}`}static BITMAP_PATTERN(){return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump[3];\n\nin vec2 v_uv;\nout vec4 o_color;\n\nvoid main() {\n vec2 uv = fract(vec2(v_uv.x, -v_uv.y) / u_mediump[0].xy);\n \n vec4 src = texture(u_texture, uv);\n ${Yi.STATEMENT_COLOR_TRANSFORM_ON(1)}\n o_color = src;\n}`}static MASK(){return"#version 300 es\nprecision mediump float;\n\nin vec2 v_bezier;\nout vec4 o_color;\n\nvoid main() {\n vec2 px = dFdx(v_bezier);\n vec2 py = dFdy(v_bezier);\n\n vec2 f = (2.0 * v_bezier.x) * vec2(px.x, py.x) - vec2(px.y, py.y);\n float alpha = 0.5 - (v_bezier.x * v_bezier.x - v_bezier.y) / length(f);\n\n if (alpha > 0.0) {\n o_color = vec4(min(alpha, 1.0));\n } else {\n discard;\n } \n}\n\n"}}class qi{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getSolidColorShapeShader(t,e){const i=`s${t?"y":"n"}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=(e?8:3)+(t?1:0),r=s;let n;n=t?Gi.TEMPLATE(s,r,!1,e):zi.TEMPLATE(s,!1,!1,e);const a=new Ui(this._$gl,this._$context,n,Xi.SOLID_COLOR());return this._$collection.set(i,a),a}getBitmapShapeShader(t,e,i){const s=`b${t?"y":"n"}${e?"y":"n"}${i?"y":"n"}`;if(this._$collection.has(s)){const t=this._$collection.get(s);if(t)return t}const r=(i?13:5)+(t?1:0),n=r;let a;a=t?Gi.TEMPLATE(r,n,!0,i):zi.TEMPLATE(r,!0,!1,i);const h=e?Xi.BITMAP_PATTERN():Xi.BITMAP_CLIPPED(),o=new Ui(this._$gl,this._$context,a,h);return this._$collection.set(s,o),o}getMaskShapeShader(t,e){const i=`m${t?"y":"n"}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=(e?8:3)+(t?1:0),r=s;let n;n=t?Gi.TEMPLATE(s,r,!1,e):zi.TEMPLATE(s,!1,!0,e);const a=new Ui(this._$gl,this._$context,n,Xi.MASK());return this._$collection.set(i,a),a}setSolidColorShapeUniform(t,e,i,s,r,n,a,h,o,l,c,_){const $=t.highp;let u;n?($[0]=l.parentMatrixA,$[1]=l.parentMatrixB,$[2]=l.parentMatrixC,$[4]=l.parentMatrixD,$[5]=l.parentMatrixE,$[6]=l.parentMatrixF,$[8]=l.parentMatrixG,$[9]=l.parentMatrixH,$[10]=l.parentMatrixI,$[12]=l.ancestorMatrixA,$[13]=l.ancestorMatrixB,$[14]=l.ancestorMatrixC,$[16]=l.ancestorMatrixD,$[17]=l.ancestorMatrixE,$[18]=l.ancestorMatrixF,$[20]=l.ancestorMatrixG,$[21]=l.ancestorMatrixH,$[22]=l.ancestorMatrixI,$[3]=h,$[7]=o,$[11]=l.parentViewportX,$[15]=l.parentViewportY,$[19]=l.parentViewportW,$[23]=l.parentViewportH,$[24]=l.minXST,$[25]=l.minYST,$[26]=l.minXPQ,$[27]=l.minYPQ,$[28]=l.maxXST,$[29]=l.maxYST,$[30]=l.maxXPQ,$[31]=l.maxYPQ,u=32):($[0]=a[0],$[1]=a[1],$[2]=a[2],$[4]=a[3],$[5]=a[4],$[6]=a[5],$[8]=a[6],$[9]=a[7],$[10]=a[8],$[3]=h,$[7]=o,u=12),e&&($[u]=i,$[u+1]=s,$[u+2]=r);const d=t.mediump;d[0]=c[0],d[1]=c[1],d[2]=c[2],d[3]=c[3]*_}setBitmapShapeUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m,x,b){const v=t.highp;let T;v[0]=a[0],v[1]=a[1],v[2]=a[2],v[4]=a[3],v[5]=a[4],v[6]=a[5],v[8]=a[6],v[9]=a[7],v[10]=a[8],v[12]=h[0],v[13]=h[1],v[14]=h[2],v[16]=h[3],v[17]=h[4],v[18]=h[5],v[11]=h[6],v[15]=h[7],v[19]=h[8],v[3]=o,v[7]=l,T=20,n&&(v[T]=c.parentMatrixA,v[T+1]=c.parentMatrixB,v[T+2]=c.parentMatrixC,v[T+4]=c.parentMatrixD,v[T+5]=c.parentMatrixE,v[T+6]=c.parentMatrixF,v[T+8]=c.parentMatrixG,v[T+9]=c.parentMatrixH,v[T+10]=c.parentMatrixI,v[T+12]=c.ancestorMatrixA,v[T+13]=c.ancestorMatrixB,v[T+14]=c.ancestorMatrixC,v[T+16]=c.ancestorMatrixD,v[T+17]=c.ancestorMatrixE,v[T+18]=c.ancestorMatrixF,v[T+20]=c.ancestorMatrixG,v[T+21]=c.ancestorMatrixH,v[T+22]=c.ancestorMatrixI,v[T+11]=c.parentViewportX,v[T+15]=c.parentViewportY,v[T+19]=c.parentViewportW,v[T+23]=c.parentViewportH,v[T+24]=c.minXST,v[T+25]=c.minYST,v[T+26]=c.minXPQ,v[T+27]=c.minYPQ,v[T+28]=c.maxXST,v[T+29]=c.maxYST,v[T+30]=c.maxXPQ,v[T+31]=c.maxYPQ,T=52),e&&(v[T]=i,v[T+1]=s,v[T+2]=r);const y=t.mediump;y[0]=_,y[1]=$,y[4]=u,y[5]=d,y[6]=g,y[7]=f,y[8]=p,y[9]=m,y[10]=x,y[11]=b}setMaskShapeUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u=null){const d=t.highp;e&&u?(d[0]=u.parentMatrixA,d[1]=u.parentMatrixB,d[2]=u.parentMatrixC,d[4]=u.parentMatrixD,d[5]=u.parentMatrixE,d[6]=u.parentMatrixF,d[8]=u.parentMatrixG,d[9]=u.parentMatrixH,d[10]=u.parentMatrixI,d[12]=u.ancestorMatrixA,d[13]=u.ancestorMatrixB,d[14]=u.ancestorMatrixC,d[16]=u.ancestorMatrixD,d[17]=u.ancestorMatrixE,d[18]=u.ancestorMatrixF,d[20]=u.ancestorMatrixG,d[21]=u.ancestorMatrixH,d[22]=u.ancestorMatrixI,d[3]=_,d[7]=$,d[11]=u.parentViewportX,d[15]=u.parentViewportY,d[19]=u.parentViewportW,d[23]=u.parentViewportH,d[24]=u.minXST,d[25]=u.minYST,d[26]=u.minXPQ,d[27]=u.minYPQ,d[28]=u.maxXST,d[29]=u.maxYST,d[30]=u.maxXPQ,d[31]=u.maxYPQ):(d[0]=i,d[1]=s,d[2]=r,d[4]=n,d[5]=a,d[6]=h,d[8]=o,d[9]=l,d[10]=c,d[3]=_,d[7]=$)}setMaskShapeUniformIdentity(t,e,i){const s=t.highp;s[0]=1,s[1]=0,s[2]=0,s[4]=0,s[5]=1,s[6]=0,s[8]=0,s[9]=0,s[10]=1,s[3]=e,s[7]=i}}class Hi{static TEMPLATE(t,e,i,s,r){const n=i?this.STATEMENT_GRADIENT_TYPE_RADIAL(e,s):this.STATEMENT_GRADIENT_TYPE_LINEAR(e);let a;switch(r){case"reflect":a="1.0 - abs(fract(t * 0.5) * 2.0 - 1.0)";break;case"repeat":a="fract(t)";break;default:a="clamp(t, 0.0, 1.0)"}return`#version 300 es\nprecision highp float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_highp[${t}];\n\nin vec2 v_uv;\nout vec4 o_color;\n\nvoid main() {\n vec2 p = v_uv;\n ${n}\n t = ${a};\n o_color = texture(u_texture, vec2(t, 0.5));\n}\n\n`}static STATEMENT_GRADIENT_TYPE_LINEAR(t){return`\n vec2 a = u_highp[${t}].xy;\n vec2 b = u_highp[${t}].zw;\n\n vec2 ab = b - a;\n vec2 ap = p - a;\n\n float t = dot(ab, ap) / dot(ab, ab);\n`}static STATEMENT_GRADIENT_TYPE_RADIAL(t,e){return`\n float radius = u_highp[${t}][0];\n\n vec2 coord = p / radius;\n ${e?this.STATEMENT_FOCAL_POINT_ON(t):this.STATEMENT_FOCAL_POINT_OFF()}\n`}static STATEMENT_FOCAL_POINT_OFF(){return"\n float t = length(coord);\n"}static STATEMENT_FOCAL_POINT_ON(t){return`\n vec2 focal = vec2(u_highp[${t}][1], 0.0);\n\n vec2 dir = normalize(coord - focal);\n\n float a = dot(dir, dir);\n float b = 2.0 * dot(dir, focal);\n float c = dot(focal, focal) - 1.0;\n float x = (-b + sqrt(b * b - 4.0 * a * c)) / (2.0 * a);\n\n float t = distance(focal, coord) / distance(focal, focal + dir * x);\n`}}class ji{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getGradientShapeShader(t,e,i,s,r){const n=this.createCollectionKey(t,e,i,s,r);if(this._$collection.has(n)){const t=this._$collection.get(n);if(t)return t}const a=(e?13:5)+(t?1:0)+1,h=a-1;let o;o=t?Gi.TEMPLATE(a,h,!0,e):zi.TEMPLATE(a,!0,!1,e);const l=new Ui(this._$gl,this._$context,o,Hi.TEMPLATE(a,h,i,s,r));return this._$collection.set(n,l),l}createCollectionKey(t,e,i,s,r){const n=t?"y":"n",a=e?"y":"n",h=i?"y":"n",o=i&&s?"y":"n";let l=0;switch(r){case"reflect":l=1;break;case"repeat":l=2}return`${n}${a}${h}${o}${l}`}setGradientShapeUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u){const d=t.highp;d[0]=a[0],d[1]=a[1],d[2]=a[2],d[4]=a[3],d[5]=a[4],d[6]=a[5],d[8]=a[6],d[9]=a[7],d[10]=a[8],d[12]=h[0],d[13]=h[1],d[14]=h[2],d[16]=h[3],d[17]=h[4],d[18]=h[5],d[11]=h[6],d[15]=h[7],d[19]=h[8],d[3]=o,d[7]=l;let g=20;n&&(d[g]=c.parentMatrixA,d[g+1]=c.parentMatrixB,d[g+2]=c.parentMatrixC,d[g+4]=c.parentMatrixD,d[g+5]=c.parentMatrixE,d[g+6]=c.parentMatrixF,d[g+8]=c.parentMatrixG,d[g+9]=c.parentMatrixH,d[g+10]=c.parentMatrixI,d[g+12]=c.ancestorMatrixA,d[g+13]=c.ancestorMatrixB,d[g+14]=c.ancestorMatrixC,d[g+16]=c.ancestorMatrixD,d[g+17]=c.ancestorMatrixE,d[g+18]=c.ancestorMatrixF,d[g+20]=c.ancestorMatrixG,d[g+21]=c.ancestorMatrixH,d[g+22]=c.ancestorMatrixI,d[g+11]=c.parentViewportX,d[g+15]=c.parentViewportY,d[g+19]=c.parentViewportW,d[g+23]=c.parentViewportH,d[g+24]=c.minXST,d[g+25]=c.minYST,d[g+26]=c.minXPQ,d[g+27]=c.minYPQ,d[g+28]=c.maxXST,d[g+29]=c.maxYST,d[g+30]=c.maxXPQ,d[g+31]=c.maxYPQ,g=52),e&&(d[g]=i,d[g+1]=s,d[g+2]=r,g+=4),_?(d[g]=$[5],d[g+1]=u):(d[g]=$[0],d[g+1]=$[1],d[g+2]=$[2],d[g+3]=$[3])}}class Wi{static TEXTURE(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n\nout vec2 v_coord;\n\nvoid main() {\n v_coord = a_vertex;\n\n vec2 position = a_vertex * 2.0 - 1.0;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n\n"}static BLEND(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n\nuniform vec4 u_highp[4];\n\nout vec2 v_coord;\n\nvoid main() {\n v_coord = a_vertex;\n\n vec2 offset = u_highp[0].xy;\n vec2 size = u_highp[0].zw;\n mat3 matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\n\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\n position = position * size + offset;\n position = (matrix * vec3(position, 1.0)).xy;\n position /= viewport;\n\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n"}static INSTANCE_BLEND(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n\nuniform vec4 u_highp[5];\n\nout vec2 v_src_coord;\nout vec2 v_dst_coord;\n\nvoid main() {\n vec4 rect = vec4(u_highp[0].x, u_highp[0].y, u_highp[0].z, u_highp[0].w);\n vec2 size = vec2(u_highp[4].x, u_highp[4].y);\n mat3 matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\n\n v_src_coord = a_vertex * rect.zw + rect.xy;\n v_dst_coord = a_vertex;\n\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\n position = position * size;\n position = (matrix * vec3(position, 1.0)).xy;\n position /= viewport;\n\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n"}static INSTANCE(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\nlayout (location = 1) in vec4 a_rect;\nlayout (location = 2) in vec4 a_size;\nlayout (location = 3) in vec2 a_offset;\nlayout (location = 4) in vec4 a_matrix;\nlayout (location = 5) in vec4 a_mul;\nlayout (location = 6) in vec4 a_add;\n\nout vec2 v_coord;\nout vec4 mul;\nout vec4 add;\n\nvoid main() {\n v_coord = a_vertex * a_rect.zw + a_rect.xy;\n mul = a_mul;\n add = a_add;\n\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\n position = position * a_size.xy;\n mat3 matrix = mat3(a_matrix.x, a_matrix.y, 0.0, a_matrix.z, a_matrix.w, 0.0, a_offset.x, a_offset.y, 1.0);\n position = (matrix * vec3(position, 1.0)).xy;\n position /= a_size.zw;\n\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n"}static BLEND_CLIP(){return"#version 300 es\n\nlayout (location = 0) in vec2 a_vertex;\n\nuniform vec4 u_highp[4];\n\nout vec2 v_coord;\n\nvoid main() {\n v_coord = a_vertex;\n\n vec2 offset = u_highp[0].xy;\n vec2 size = u_highp[0].zw;\n mat3 inv_matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\n\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\n position *= viewport;\n position = (inv_matrix * vec3(position, 1.0)).xy;\n position = (position - offset) / size;\n\n position = position * 2.0 - 1.0;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n}\n\n"}}class Ki{static TEMPLATE(t,e,i){let s="";for(let t=1;t<e;t++){const i=t-1,r=t,n=`u_mediump[${e+v.floor(i/4)}][${i%4}]`,a=`u_mediump[${e+v.floor(r/4)}][${r%4}]`;s+=`\n if (t <= ${a}) {\n return mix(u_mediump[${i}], u_mediump[${r}], (t - ${n}) / (${a} - ${n}));\n }\n`}return`#version 300 es\nprecision mediump float;\n\nuniform vec4 u_mediump[${t}];\n\nin vec2 v_coord;\nout vec4 o_color;\n\nvec4 getGradientColor(in float t) {\n if (t <= u_mediump[${e}][0]) {\n return u_mediump[0];\n }\n ${s}\n return u_mediump[${e-1}];\n}\n\nvoid main() {\n vec4 color = getGradientColor(v_coord.x);\n ${i?"color = pow(color, vec4(0.45454545));":""}\n color.rgb *= color.a;\n\n o_color = color;\n}\n\n`}}class Qi{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getGradientLUTShader(t,e){const i=`l${("00"+t).slice(-3)}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=v.ceil(5*t/4),r=new Ui(this._$gl,this._$context,Wi.TEXTURE(),Ki.TEMPLATE(s,t,e));return this._$collection.set(i,r),r}setGradientLUTUniformForShape(t,e,i,s,r){let n=0;const a=t.mediump;for(let t=i;t<s;t++){const i=e[t][1];a[n++]=r[i[0]],a[n++]=r[i[1]],a[n++]=r[i[2]],a[n++]=r[i[3]]}for(let t=i;t<s;t++)a[n++]=e[t][0]}setGradientLUTUniformForFilter(t,e,i,s,r,n){let a=0;const h=t.mediump;for(let t=r;t<n;t++){const e=i[t];h[a++]=(e>>16)/255,h[a++]=(e>>8&255)/255,h[a++]=(255&e)/255,h[a++]=s[t]}for(let t=r;t<n;t++)h[a++]=e[t]}}class Ji{static TEMPLATE(t,e,i,s,r,n,a,h,o){let l=0;const c=i?this.STATEMENT_BASE_TEXTURE_TRANSFORM(l++):"",_=s?this.STATEMENT_BLUR_TEXTURE_TRANSFORM(l++):this.STATEMENT_BLUR_TEXTURE(),$="inner"===n,u=l;let d,g,f=4*l;switch(o?d=r?this.STATEMENT_GLOW(!1,i,h,o,u,f):this.STATEMENT_BEVEL(i,s,h,o,u,f):r?(f+=4,d=this.STATEMENT_GLOW($,i,h,o,u,f)):(f+=8,d=this.STATEMENT_BEVEL(i,s,h,o,u,f)),n){case"outer":g=a?"blur - blur * base.a":"base + blur - blur * base.a";break;case"full":g=a?"blur":"base - base * blur.a + blur";break;default:g="blur"}return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_textures[${t}];\nuniform vec4 u_mediump[${e}];\n\nin vec2 v_coord;\nout vec4 o_color;\n\n${Yi.FUNCTION_IS_INSIDE()}\n\nvoid main() {\n ${c}\n ${_}\n ${d}\n o_color = ${g};\n}\n\n`}static STATEMENT_BASE_TEXTURE_TRANSFORM(t){return`\n vec2 base_scale = u_mediump[${t}].xy;\n vec2 base_offset = u_mediump[${t}].zw;\n\n vec2 uv = v_coord * base_scale - base_offset;\n vec4 base = mix(vec4(0.0), texture(u_textures[1], uv), isInside(uv));\n`}static STATEMENT_BLUR_TEXTURE(){return"\n vec4 blur = texture(u_textures[0], v_coord);\n"}static STATEMENT_BLUR_TEXTURE_TRANSFORM(t){return`\n vec2 blur_scale = u_mediump[${t}].xy;\n vec2 blur_offset = u_mediump[${t}].zw;\n\n vec2 st = v_coord * blur_scale - blur_offset;\n vec4 blur = mix(vec4(0.0), texture(u_textures[0], st), isInside(st));\n`}static STATEMENT_GLOW(t,e,i,s,r,n){return`\n ${t?"blur.a = 1.0 - blur.a;":""}\n ${i?this.STATEMENT_GLOW_STRENGTH(n):""}\n ${s?this.STATEMENT_GLOW_GRADIENT_COLOR(e):this.STATEMENT_GLOW_SOLID_COLOR(r)}\n`}static STATEMENT_GLOW_STRENGTH(t){return`\n float strength = u_mediump[${v.floor(t/4)}][${t%4}];\n blur.a = clamp(blur.a * strength, 0.0, 1.0);\n`}static STATEMENT_GLOW_SOLID_COLOR(t){return`\n vec4 color = u_mediump[${t}];\n blur = color * blur.a;\n`}static STATEMENT_GLOW_GRADIENT_COLOR(t){return`\n blur = texture(u_textures[${t?2:1}], vec2(blur.a, 0.5));\n`}static STATEMENT_BEVEL(t,e,i,s,r,n){return`\n ${e?this.STATEMENT_BLUR_TEXTURE_TRANSFORM_2():this.STATEMENT_BLUR_TEXTURE_2()}\n float highlight_alpha = blur.a - blur2.a;\n float shadow_alpha = blur2.a - blur.a;\n ${i?this.STATEMENT_BEVEL_STRENGTH(n):""}\n highlight_alpha = clamp(highlight_alpha, 0.0, 1.0);\n shadow_alpha = clamp(shadow_alpha, 0.0, 1.0);\n ${s?this.STATEMENT_BEVEL_GRADIENT_COLOR(t):this.STATEMENT_BEVEL_SOLID_COLOR(r)}\n`}static STATEMENT_BLUR_TEXTURE_2(){return"\n vec4 blur2 = texture(u_textures[0], 1.0 - v_coord);\n"}static STATEMENT_BLUR_TEXTURE_TRANSFORM_2(){return"\n vec2 pq = (1.0 - v_coord) * blur_scale - blur_offset;\n vec4 blur2 = mix(vec4(0.0), texture(u_textures[0], pq), isInside(pq));\n"}static STATEMENT_BEVEL_STRENGTH(t){return`\n float strength = u_mediump[${v.floor(t/4)}][${t%4}];\n highlight_alpha *= strength;\n shadow_alpha *= strength;\n`}static STATEMENT_BEVEL_SOLID_COLOR(t){return`\n vec4 highlight_color = u_mediump[${t}];\n vec4 shadow_color = u_mediump[${t+1}];\n blur = highlight_color * highlight_alpha + shadow_color * shadow_alpha;\n`}static STATEMENT_BEVEL_GRADIENT_COLOR(t){return`\n blur = texture(u_textures[${t?2:1}], vec2(\n 0.5019607843137255 - 0.5019607843137255 * shadow_alpha + 0.4980392156862745 * highlight_alpha,\n 0.5\n ));\n`}}class Zi{static TEMPLATE(t){const e=t.toFixed(1);return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump;\n\nin vec2 v_coord;\nout vec4 o_color;\n\nvoid main() {\n vec2 offset = u_mediump.xy;\n float fraction = u_mediump.z;\n float samples = u_mediump.w;\n \n vec4 color = texture(u_texture, v_coord);\n\n for (float i = 1.0; i < ${e}; i += 1.0) {\n color += texture(u_texture, v_coord + offset * i);\n color += texture(u_texture, v_coord - offset * i);\n }\n color += texture(u_texture, v_coord + offset * ${e}) * fraction;\n color += texture(u_texture, v_coord - offset * ${e}) * fraction;\n color /= samples;\n\n o_color = color;\n}\n\n`}}class ts{static TEMPLATE(){return"#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump[5];\n\nin vec2 v_coord;\nout vec4 o_color;\n\nvoid main() {\n mat4 mul = mat4(u_mediump[0], u_mediump[1], u_mediump[2], u_mediump[3]);\n vec4 add = u_mediump[4];\n \n vec4 color = texture(u_texture, v_coord);\n\n color.rgb /= max(0.0001, color.a);\n color = clamp(color * mul + add, 0.0, 1.0);\n color.rgb *= color.a;\n\n o_color = color;\n}\n\n"}}class es{static TEMPLATE(t,e,i,s,r){const n=v.floor(.5*e),a=v.floor(.5*i),h=e*i;let o="";const l=r?1:2;for(let t=0;t<h;++t)o+=`\n result += getWeightedColor(${t}, u_mediump[${l+v.floor(t/4)}][${t%4}]);\n`;const c=s?"result.a = texture(u_texture, v_coord).a;":"",_=r?"":"\n vec4 substitute_color = u_mediump[1];\n color = mix(substitute_color, color, isInside(uv));\n";return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\nuniform vec4 u_mediump[${t}];\n\nin vec2 v_coord;\nout vec4 o_color;\n\n${Yi.FUNCTION_IS_INSIDE()}\n\nvec4 getWeightedColor (in int i, in float weight) {\n vec2 rcp_size = u_mediump[0].xy;\n\n int i_div_x = i / ${e};\n int i_mod_x = i - ${e} * i_div_x;\n vec2 offset = vec2(i_mod_x - ${n}, ${a} - i_div_x);\n vec2 uv = v_coord + offset * rcp_size;\n\n vec4 color = texture(u_texture, uv);\n color.rgb /= max(0.0001, color.a);\n ${_}\n\n return color * weight;\n}\n\nvoid main() {\n float rcp_divisor = u_mediump[0].z;\n float bias = u_mediump[0].w;\n\n vec4 result = vec4(0.0);\n ${o}\n result = clamp(result * rcp_divisor + bias, 0.0, 1.0);\n ${c}\n\n result.rgb *= result.a;\n o_color = result;\n}\n\n`}}class is{static TEMPLATE(t,e,i,s){let r,n,a;switch(e){case 1:r="map_color.r";break;case 2:r="map_color.g";break;case 4:r="map_color.b";break;case 8:r="map_color.a";break;default:r="0.5"}switch(i){case 1:n="map_color.r";break;case 2:n="map_color.g";break;case 4:n="map_color.b";break;case 8:n="map_color.a";break;default:n="0.5"}switch(s){case"clamp":a="\n vec4 source_color = texture(u_textures[0], uv);\n";break;case"ignore":a="\n vec4 source_color =texture(u_textures[0], mix(v_coord, uv, step(abs(uv - vec2(0.5)), vec2(0.5))));\n";break;case"color":a="\n vec4 substitute_color = u_mediump[2];\n vec4 source_color = mix(substitute_color, texture(u_textures[0], uv), isInside(uv));\n";break;default:a="\n vec4 source_color = texture(u_textures[0], fract(uv));\n"}return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_textures[2];\nuniform vec4 u_mediump[${t}];\n\nin vec2 v_coord;\nout vec4 o_color;\n\n${Yi.FUNCTION_IS_INSIDE()}\n\nvoid main() {\n vec2 uv_to_st_scale = u_mediump[0].xy;\n vec2 uv_to_st_offset = u_mediump[0].zw;\n vec2 scale = u_mediump[1].xy;\n\n vec2 st = v_coord * uv_to_st_scale - uv_to_st_offset;\n vec4 map_color = texture(u_textures[1], st);\n\n vec2 offset = vec2(${r}, ${n}) - 0.5;\n vec2 uv = v_coord + offset * scale;\n ${a}\n\n o_color = mix(texture(u_textures[0], v_coord), source_color, isInside(st));\n}\n\n`}}class ss{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getBlurFilterShader(t){const e=`b${t}`;if(this._$collection.has(e)){const t=this._$collection.get(e);if(t)return t}const i=new Ui(this._$gl,this._$context,Wi.TEXTURE(),Zi.TEMPLATE(t));return this._$collection.set(e,i),i}getBitmapFilterShader(t,e,i,s,r,n,a){const h=`f${t?"y":"n"}${e?"y":"n"}${i?"y":"n"}${s}${r?"y":"n"}${n?"y":"n"}`;if(this._$collection.has(h)){const t=this._$collection.get(h);if(t)return t}let o=1;t&&o++,a&&o++;let l=(t?4:0)+(e?4:0)+(n?1:0);a||(l+=i?4:8),l=v.ceil(l/4);const c=new Ui(this._$gl,this._$context,Wi.TEXTURE(),Ji.TEMPLATE(o,l,t,e,i,s,r,n,a));return this._$collection.set(h,c),c}getColorMatrixFilterShader(){if(this._$collection.has("m")){const t=this._$collection.get("m");if(t)return t}const t=new Ui(this._$gl,this._$context,Wi.TEXTURE(),ts.TEMPLATE());return this._$collection.set("m",t),t}getConvolutionFilterShader(t,e,i,s){const r=`c${("0"+t).slice(-2)}${("0"+e).slice(-2)}${i?"y":"n"}${s?"y":"n"}`;if(this._$collection.has(r)){const t=this._$collection.get(r);if(t)return t}const n=(s?1:2)+v.ceil(t*e/4),a=new Ui(this._$gl,this._$context,Wi.TEXTURE(),es.TEMPLATE(n,t,e,i,s));return this._$collection.set(r,a),a}getDisplacementMapFilterShader(t,e,i){const s=`d${t}${e}${i}`;if(this._$collection.has(s)){const t=this._$collection.get(s);if(t)return t}const r="color"===i?3:2,n=new Ui(this._$gl,this._$context,Wi.TEXTURE(),is.TEMPLATE(r,t,e,i));return this._$collection.set(s,n),n}setBlurFilterUniform(t,e,i,s,r,n){const a=t.mediump;s?(a[0]=1/e,a[1]=0):(a[0]=0,a[1]=1/i),a[2]=r,a[3]=n}setBitmapFilterUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m,x,b,v,T,y,E){let A;v?(A=t.textures,A[0]=0,A[1]=1,E&&(A[2]=2)):E&&(A=t.textures,A[0]=0,A[1]=2);const M=t.mediump;let S=0;v&&(M[S]=e/s,M[S+1]=i/r,M[S+2]=n/s,M[S+3]=(i-r-a)/r,S+=4),T&&(M[S]=e/h,M[S+1]=i/o,M[S+2]=l/h,M[S+3]=(i-o-c)/o,S+=4),E||(_?(M[S]=u,M[S+1]=d,M[S+2]=g,M[S+3]=f,S+=4):(M[S]=u,M[S+1]=d,M[S+2]=g,M[S+3]=f,M[S+4]=p,M[S+5]=m,M[S+6]=x,M[S+7]=b,S+=8)),y&&(M[S]=$)}setColorMatrixFilterUniform(t,e){const i=t.mediump;i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[5],i[5]=e[6],i[6]=e[7],i[7]=e[8],i[8]=e[10],i[9]=e[11],i[10]=e[12],i[11]=e[13],i[12]=e[15],i[13]=e[16],i[14]=e[17],i[15]=e[18],i[16]=e[4]/255,i[17]=e[9]/255,i[18]=e[14]/255,i[19]=e[19]/255}setConvolutionFilterUniform(t,e,i,s,r,n,a,h,o,l,c){const _=t.mediump;_[0]=1/e,_[1]=1/i,_[2]=1/r,_[3]=n/255;let $=4;a||(_[$]=h,_[$+1]=o,_[$+2]=l,_[$+3]=c,$+=4);const u=s.length;for(let t=0;t<u;t++)_[$++]=s[t]}setDisplacementMapFilterUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u){const d=t.textures;d[0]=0,d[1]=1;const g=t.mediump;g[0]=s/e,g[1]=r/i,g[2]=n/e,g[3]=(r-i-a)/i,g[4]=h/s,g[5]=-o/r,"color"===l&&(g[8]=c,g[9]=_,g[10]=$,g[11]=u)}}class rs{static TEMPLATE(t){return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\n${t?"uniform vec4 u_mediump[2];":""}\n\nin vec2 v_coord;\nout vec4 o_color;\n\nvoid main() {\n vec4 src = texture(u_texture, v_coord);\n ${t?Yi.STATEMENT_COLOR_TRANSFORM_ON(0):""}\n o_color = src;\n}\n\n`}static INSTANCE_TEMPLATE(){return"#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_texture;\n\nin vec4 mul;\nin vec4 add;\nin vec2 v_coord;\nout vec4 o_color;\n\nvoid main() {\n vec4 src = texture(u_texture, v_coord);\n\n if (mul.x != 1.0 || mul.y != 1.0 || mul.z != 1.0 || mul.w != 1.0\n || add.x != 0.0 || add.y != 0.0 || add.z != 0.0 || add.w != 0.0\n ) {\n src.rgb /= max(0.0001, src.a);\n src = clamp(src * mul + add, 0.0, 1.0);\n src.rgb *= src.a;\n }\n \n o_color = src;\n}\n\n"}}class ns{static TEMPLATE(t,e){let i;switch(t){case"subtract":i=this.FUNCTION_SUBTRACT();break;case"multiply":i=this.FUNCTION_MULTIPLY();break;case"lighten":i=this.FUNCTION_LIGHTEN();break;case"darken":i=this.FUNCTION_DARKEN();break;case"overlay":i=this.FUNCTION_OVERLAY();break;case"hardlight":i=this.FUNCTION_HARDLIGHT();break;case"difference":i=this.FUNCTION_DIFFERENCE();break;case"invert":i=this.FUNCTION_INVERT();break;default:i=this.FUNCTION_NORMAL()}return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_textures[2];\n${e?"uniform vec4 u_mediump[2];":""}\n\nin vec2 v_coord;\nout vec4 o_color;\n\n${i}\n\nvoid main() {\n vec4 dst = texture(u_textures[0], v_coord);\n vec4 src = texture(u_textures[1], v_coord);\n ${e?Yi.STATEMENT_COLOR_TRANSFORM_ON(0):""}\n o_color = blend(src, dst);\n}\n\n`}static INSTANCE_TEMPLATE(t,e){let i;switch(t){case"subtract":i=this.FUNCTION_SUBTRACT();break;case"multiply":i=this.FUNCTION_MULTIPLY();break;case"lighten":i=this.FUNCTION_LIGHTEN();break;case"darken":i=this.FUNCTION_DARKEN();break;case"overlay":i=this.FUNCTION_OVERLAY();break;case"hardlight":i=this.FUNCTION_HARDLIGHT();break;case"difference":i=this.FUNCTION_DIFFERENCE();break;case"invert":i=this.FUNCTION_INVERT();break;default:i=this.FUNCTION_NORMAL()}return`#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_textures[2];\n${e?"uniform vec4 u_mediump[2];":""}\n\nin vec2 v_src_coord;\nin vec2 v_dst_coord;\nout vec4 o_color;\n\n${i}\n\nvoid main() {\n vec4 dst = texture(u_textures[0], v_dst_coord);\n vec4 src = texture(u_textures[1], v_src_coord);\n ${e?Yi.STATEMENT_COLOR_TRANSFORM_ON(0):""}\n o_color = blend(src, dst);\n}\n\n`}static FUNCTION_NORMAL(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n return src + dst - dst * src.a;\n}\n\n"}static FUNCTION_SUBTRACT(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 c = vec4(dst.rgb - src.rgb, src.a * dst.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_MULTIPLY(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n vec4 c = src * dst;\n\n return a + b + c;\n}\n\n"}static FUNCTION_LIGHTEN(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 c = vec4(mix(src.rgb, dst.rgb, step(src.rgb, dst.rgb)), src.a * dst.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_DARKEN(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 c = vec4(mix(src.rgb, dst.rgb, step(dst.rgb, src.rgb)), src.a * dst.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_OVERLAY(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 mul = src * dst;\n vec3 c1 = 2.0 * mul.rgb;\n vec3 c2 = 2.0 * (src.rgb + dst.rgb - mul.rgb) - 1.0;\n vec4 c = vec4(mix(c1, c2, step(vec3(0.5), dst.rgb)), mul.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_HARDLIGHT(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 mul = src * dst;\n vec3 c1 = 2.0 * mul.rgb;\n vec3 c2 = 2.0 * (src.rgb + dst.rgb - mul.rgb) - 1.0;\n vec4 c = vec4(mix(c1, c2, step(vec3(0.5), src.rgb)), mul.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_DIFFERENCE(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 a = src - src * dst.a;\n vec4 b = dst - dst * src.a;\n\n src.rgb /= src.a;\n dst.rgb /= dst.a;\n\n vec4 c = vec4(abs(src.rgb - dst.rgb), src.a * dst.a);\n c.rgb *= c.a;\n\n return a + b + c;\n}\n\n"}static FUNCTION_INVERT(){return"\n\nvec4 blend (in vec4 src, in vec4 dst) {\n if (src.a == 0.0) { return dst; }\n if (dst.a == 0.0) { return src; }\n\n vec4 b = dst - dst * src.a;\n vec4 c = vec4(src.a - dst.rgb * src.a, src.a);\n\n return b + c;\n}\n\n"}}class as{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=ot()}getInstanceShader(){if(this._$collection.has("i")){const t=this._$collection.get("i");if(t)return t}const t=new Ui(this._$gl,this._$context,Wi.INSTANCE(),rs.INSTANCE_TEMPLATE());return this._$collection.set("i",t),t}getNormalBlendShader(t){const e="n"+(t?"y":"n");if(this._$collection.has(e)){const t=this._$collection.get(e);if(t)return t}const i=new Ui(this._$gl,this._$context,Wi.BLEND(),rs.TEMPLATE(t));return this._$collection.set(e,i),i}getClipShader(){if(this._$collection.has("c")){const t=this._$collection.get("c");if(t)return t}const t=new Ui(this._$gl,this._$context,Wi.BLEND_CLIP(),rs.TEMPLATE(!1));return this._$collection.set("c",t),t}getBlendShader(t,e){const i=`${t}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=new Ui(this._$gl,this._$context,Wi.BLEND(),ns.TEMPLATE(t,e));return this._$collection.set(i,s),s}getInstanceBlendShader(t,e){const i=`i${t}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=new Ui(this._$gl,this._$context,Wi.INSTANCE_BLEND(),ns.INSTANCE_TEMPLATE(t,e));return this._$collection.set(i,s),s}setNormalBlendUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f){const p=t.highp;if(p[0]=e,p[1]=i,p[2]=s,p[3]=r,p[4]=n[0],p[5]=n[1],p[6]=n[2],p[8]=n[3],p[9]=n[4],p[10]=n[5],p[12]=n[6],p[13]=n[7],p[14]=n[8],p[7]=a,p[11]=h,o){const e=t.mediump;e[0]=l,e[1]=c,e[2]=_,e[3]=$,e[4]=u,e[5]=d,e[6]=g,e[7]=f}}pushNormalBlend(t,e,i,s,r,n,a,h,o=1,l=1,c=1,_=1,$=0,u=0,d=0,g=0){t.attributes.push(e/Fi,i/Fi,s/Fi,r/Fi,s,r,a,h,n[6],n[7],n[0],n[1],n[3],n[4],o,l,c,_,$,u,d,g),t.count++}setClipUniform(t,e,i,s,r,n,a,h){const o=t.highp;o[0]=e,o[1]=i,o[2]=s,o[3]=r,o[4]=n[0],o[5]=n[1],o[6]=n[2],o[8]=n[3],o[9]=n[4],o[10]=n[5],o[12]=n[6],o[13]=n[7],o[14]=n[8],o[7]=a,o[11]=h}setInstanceBlendUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m){const x=t.textures;x[0]=0,x[1]=1;const b=t.highp;if(b[0]=e,b[1]=i,b[2]=s,b[3]=r,b[4]=h[0],b[5]=h[1],b[6]=h[2],b[8]=h[3],b[9]=h[4],b[10]=h[5],b[12]=h[6],b[13]=h[7],b[14]=h[8],b[7]=o,b[11]=l,b[16]=n,b[17]=a,c){const e=t.mediump;e[0]=_,e[1]=$,e[2]=u,e[3]=d,e[4]=g,e[5]=f,e[6]=p,e[7]=m}}setBlendUniform(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f){const p=t.textures;p[0]=0,p[1]=1;const m=t.highp;if(m[0]=e,m[1]=i,m[2]=s,m[3]=r,m[4]=n[0],m[5]=n[1],m[6]=n[2],m[8]=n[3],m[9]=n[4],m[10]=n[5],m[12]=n[6],m[13]=n[7],m[14]=n[8],m[7]=a,m[11]=h,o){const e=t.mediump;e[0]=l,e[1]=c,e[2]=_,e[3]=$,e[4]=u,e[5]=d,e[6]=g,e[7]=f}}}class hs{constructor(t,e){this._$currentProgramId=-1,this._$shapeShaderVariants=new qi(t,e),this._$gradientShapeShaderVariants=new ji(t,e),this._$gradientLUTShaderVariants=new Qi(t,e),this._$filterShaderVariants=new ss(t,e),this._$blendShaderVariants=new as(t,e)}get currentProgramId(){return this._$currentProgramId}set currentProgramId(t){this._$currentProgramId=t}get shapeShaderVariants(){return this._$shapeShaderVariants}get gradientShapeShaderVariants(){return this._$gradientShapeShaderVariants}get gradientLUTShaderVariants(){return this._$gradientLUTShaderVariants}get filterShaderVariants(){return this._$filterShaderVariants}get blendShaderVariants(){return this._$blendShaderVariants}}class os{constructor(t,e){this._$context=t,this._$gl=e,this._$attachment=t.frameBuffer.createTextureAttachment(512,1),this._$maxLength=v.floor(.75*e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),this._$rgbToLinearTable=new Float32Array(256),this._$rgbIdentityTable=new Float32Array(256);for(let t=0;t<256;t++){const e=t/255;this._$rgbToLinearTable[t]=v.pow(e,2.23333333),this._$rgbIdentityTable[t]=e}}generateForShape(t,e){const i=this._$context.frameBuffer.currentAttachment,s=this._$context.cachePosition;s&&this._$gl.disable(this._$gl.SCISSOR_TEST),this._$context._$bind(this._$attachment);const r=t.length,n=this._$context.shaderList.gradientLUTShaderVariants,a=e?this._$rgbToLinearTable:this._$rgbIdentityTable;this._$context.blend.toOneZero();for(let i=0;i<r;i+=this._$maxLength-1){const s=v.min(i+this._$maxLength,r),h=n.getGradientLUTShader(s-i,e),o=h.uniform;n.setGradientLUTUniformForShape(o,t,i,s,a),h._$drawGradient(0===i?0:t[i][0],s===r?1:t[s-1][0])}if(this._$context._$bind(i),!this._$attachment.texture)throw new Error("the texture is null.");return s&&this._$context.bindRenderBuffer(s),this._$attachment.texture}generateForFilter(t,e,i){const s=this._$context.frameBuffer.currentAttachment;this._$context._$bind(this._$attachment);const r=t.length,n=this._$context.shaderList.gradientLUTShaderVariants;this._$context.blend.toOneZero();for(let s=0;s<r;s+=this._$maxLength-1){const a=v.min(s+this._$maxLength,r),h=n.getGradientLUTShader(a-s,!1),o=h.uniform;n.setGradientLUTUniformForFilter(o,t,e,i,s,a),h._$drawGradient(0===s?0:t[s],a===r?1:t[a-1])}if(this._$context._$bind(s),!this._$attachment.texture)throw new Error("the texture is null.");return this._$attachment.texture}}class ls{static get indexRangePool(){return this._$indexRangePool}static generate(t){let e=0;for(let i=0;i<t.length;++i)e+=12*(t[i].length/3-2);this._$vertexBufferData=new A(e),this._$indexRanges=nt(),this._$currentIndex=0;for(let e=0;e<t.length;++e){const i=this._$currentIndex;this._$generateMesh(t[e]);const s=this._$currentIndex-i,r=this._$indexRangePool.pop()||{first:0,count:0};r.first=i,r.count=s,this._$indexRanges.push(r)}return{vertexBufferData:this._$vertexBufferData,indexRanges:this._$indexRanges}}static _$generateMesh(t){const e=this._$vertexBufferData;let i=this._$currentIndex;const s=t.length-5;for(let r=3;r<s;r+=3){let s=4*i;t[r+2]?(e[s++]=t[r-3],e[s++]=t[r-2],e[s++]=0,e[s++]=0,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=0,e[s++]=t[r+3],e[s++]=t[r+4],e[s++]=1,e[s++]=1):t[r+5]?(e[s++]=t[0],e[s++]=t[1],e[s++]=.5,e[s++]=.5,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=.5,e[s++]=t[r+6],e[s++]=t[r+7],e[s++]=.5,e[s++]=.5):(e[s++]=t[0],e[s++]=t[1],e[s++]=.5,e[s++]=.5,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=.5,e[s++]=t[r+3],e[s++]=t[r+4],e[s++]=.5,e[s++]=.5),i+=3}this._$currentIndex=i}}ls._$indexRangePool=nt();class cs{static generate(t,e,i){this._$vertexBufferData=this._$vertexBufferData||new A(1024),this._$vertexBufferPos=0,this._$indexBufferData=this._$indexBufferData||new Int16Array(256),this._$indexBufferPos=0,this._$lineCap=e,this._$lineJoin=i;for(let e=0;e<t.length;e++){const i=this._$vertexBufferPos;this._$generateLineSegment(t[e]);const s=this._$vertexBufferPos;this._$generateLineJoin(i,s),this._$generateLineCap(i,s)}return{vertexBufferData:this._$vertexBufferData.slice(0,this._$vertexBufferPos),indexBufferData:this._$indexBufferData.slice(0,this._$indexBufferPos)}}static _$expandVertexBufferIfNeeded(t){if(this._$vertexBufferPos+t>this._$vertexBufferData.length){const t=new A(2*this._$vertexBufferData.length);t.set(this._$vertexBufferData),this._$vertexBufferData=t}}static _$expandIndexBufferIfNeeded(t){if(this._$indexBufferPos+t>this._$indexBufferData.length){const t=new S(2*this._$indexBufferData.length);t.set(this._$indexBufferData),this._$indexBufferData=t}}static _$generateLineSegment(t){const e=t.length-5;for(let i=0;i<e;i+=3)t[i+2]||(t[i+5]?this._$addQuadSegmentMesh(t[i],t[i+1],t[i+3],t[i+4],t[i+6],t[i+7]):this._$addLineSegmentMesh(t[i],t[i+1],t[i+3],t[i+4]))}static _$addQuadSegmentMesh(t,e,i,s,r,n){let a=t,h=e;for(let o=1;o<11;o++){const l=o/11,c=1-l,_=(t*c+i*l)*c+(i*c+r*l)*l,$=(e*c+s*l)*c+(s*c+n*l)*l;this._$addLineSegmentMesh(a,h,_,$,2),a=_,h=$}this._$addLineSegmentMesh(a,h,r,n)}static _$addLineSegmentMesh(t,e,i,s,r=1){const n=this._$vertexBufferPos/7,a=n+1,h=n+2,o=n+3;this._$expandIndexBufferIfNeeded(6);const l=this._$indexBufferData;let c=this._$indexBufferPos;l[c++]=n,l[c++]=a,l[c++]=o,l[c++]=o,l[c++]=h,l[c++]=n,this._$indexBufferPos=c,this._$expandVertexBufferIfNeeded(28);const _=this._$vertexBufferData;let $=this._$vertexBufferPos;_[$++]=t,_[$++]=e,_[$++]=i,_[$++]=s,_[$++]=1,_[$++]=1,_[$++]=1,_[$++]=t,_[$++]=e,_[$++]=i,_[$++]=s,_[$++]=-1,_[$++]=-1,_[$++]=1,_[$++]=i,_[$++]=s,_[$++]=t,_[$++]=e,_[$++]=-1,_[$++]=-1,_[$++]=r,_[$++]=i,_[$++]=s,_[$++]=t,_[$++]=e,_[$++]=1,_[$++]=1,_[$++]=r,this._$vertexBufferPos=$}static _$generateLineJoin(t,e){const i=this._$vertexBufferData,s=e-55;for(let e=t;e<s;e+=28){const t=e/7;this._$addLineJoinMesh(i[e],i[e+1],i[e+21],i[e+22],i[e+27],i[e+49],i[e+50],t+2,t+3,t+4,t+5)}}static _$addLineJoinMesh(t,e,i,s,r,n,a,h,o,l=0,c=0){const _=i-t,$=s-e,u=n-i,d=a-s,g=this._$cross(_,$,u,d);if(!(v.abs(g)<1e-4))if(2!==r)switch(this._$lineJoin){case"round":this._$addRoundJoinMesh(i,s);break;case"miter":this._$addMiterJoinMesh(i,s,t,e,n,a,l,h,o,c);break;default:this._$addBevelJoinMesh(i,s,l,h,o,c)}else this._$addBevelJoinMesh(i,s,l,h,o,c)}static _$addRoundJoinMesh(t,e){const i=this._$vertexBufferPos/7;this._$expandIndexBufferIfNeeded(57);const s=this._$indexBufferData;let r=this._$indexBufferPos;for(let t=1;t<18;t++){const e=i+t;s[r++]=i,s[r++]=e,s[r++]=e+1}s[r++]=i,s[r++]=i+18,s[r++]=i+1,this._$indexBufferPos=r,this._$expandVertexBufferIfNeeded(133);const n=this._$vertexBufferData;let a=this._$vertexBufferPos;n[a++]=t,n[a++]=e,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0;for(let i=0;i<18;i++)n[a++]=t,n[a++]=e,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=30+i;this._$vertexBufferPos=a}static _$addMiterJoinMesh(t,e,i,s,r,n,a,h,o,l){const c=this._$vertexBufferPos/7,_=c+1,$=c+2,u=c+3,d=c+4;this._$expandIndexBufferIfNeeded(18);const g=this._$indexBufferData;let f=this._$indexBufferPos;g[f++]=c,g[f++]=a,g[f++]=_,g[f++]=c,g[f++]=_,g[f++]=$,g[f++]=c,g[f++]=$,g[f++]=h,g[f++]=c,g[f++]=o,g[f++]=u,g[f++]=c,g[f++]=u,g[f++]=d,g[f++]=c,g[f++]=d,g[f++]=l,this._$indexBufferPos=f,this._$expandVertexBufferIfNeeded(35);const p=this._$vertexBufferData;let m=this._$vertexBufferPos;p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=0,p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=21,p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=22,p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=23,p[m++]=t,p[m++]=e,p[m++]=i,p[m++]=s,p[m++]=r,p[m++]=n,p[m++]=24,this._$vertexBufferPos=m}static _$addBevelJoinMesh(t,e,i,s,r,n){const a=this._$vertexBufferPos/7;this._$expandIndexBufferIfNeeded(6);const h=this._$indexBufferData;let o=this._$indexBufferPos;h[o++]=a,h[o++]=i,h[o++]=s,h[o++]=a,h[o++]=r,h[o++]=n,this._$indexBufferPos=o,this._$expandVertexBufferIfNeeded(7);const l=this._$vertexBufferData;let c=this._$vertexBufferPos;l[c++]=t,l[c++]=e,l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=0,this._$vertexBufferPos=c}static _$generateLineCap(t,e){const i=this._$vertexBufferData,s=i[t],r=i[t+1],n=i[t+2],a=i[t+3],h=i[e-7],o=i[e-6],l=i[e-5],c=i[e-4],_=t/7,$=e/7;s!==h||r!==o?(this._$addLineCapMesh(s,r,n,a,_,_+1),this._$addLineCapMesh(h,o,l,c,$-1,$-2)):this._$addLineJoinMesh(l,c,s,r,n,a,$-2,$-1,_,_+1)}static _$addLineCapMesh(t,e,i,s,r,n){switch(this._$lineCap){case"round":this._$addRoundJoinMesh(t,e);break;case"square":this._$addSquareCapMesh(t,e,i,s,r,n)}}static _$addSquareCapMesh(t,e,i,s,r,n){const a=this._$vertexBufferPos/7,h=a+1;this._$expandIndexBufferIfNeeded(6);const o=this._$indexBufferData;let l=this._$indexBufferPos;o[l++]=r,o[l++]=a,o[l++]=h,o[l++]=h,o[l++]=n,o[l++]=r,this._$indexBufferPos=l,this._$expandVertexBufferIfNeeded(14);const c=this._$vertexBufferData;let _=this._$vertexBufferPos;c[_++]=t,c[_++]=e,c[_++]=i,c[_++]=s,c[_++]=-1,c[_++]=-1,c[_++]=10,c[_++]=t,c[_++]=e,c[_++]=i,c[_++]=s,c[_++]=1,c[_++]=1,c[_++]=10,this._$vertexBufferPos=_}}cs._$cross=(t,e,i,s)=>t*s-i*e;class _s{constructor(t){this._$gl=t,this._$fillVertexArrayPool=[],this._$strokeVertexArrayPool=[],this._$boundVertexArray=null,this._$fillAttrib_vertex=0,this._$fillAttrib_bezier=1,this._$strokeAttrib_vertex=0,this._$strokeAttrib_option1=1,this._$strokeAttrib_option2=2,this._$strokeAttrib_type=3,this._$vertexBufferData=new Float32Array([0,0,0,1,1,0,1,1]),this._$attributeVertexBuffer=t.createBuffer(),this._$attributeBuffer=new Float32Array(22),this._$instanceVertexArray=this._$getCommonVertexArray(),this._$commonVertexArray=this._$getVertexArray(0,1)}_$getCommonVertexArray(){const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();return this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,1]),this._$gl.STATIC_DRAW),this._$gl.enableVertexAttribArray(0),this._$gl.vertexAttribPointer(0,2,this._$gl.FLOAT,!1,0,0),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,this._$attributeVertexBuffer),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$attributeBuffer.byteLength,this._$gl.DYNAMIC_DRAW),this._$gl.enableVertexAttribArray(1),this._$gl.vertexAttribPointer(1,4,this._$gl.FLOAT,!1,88,0),this._$gl.vertexAttribDivisor(1,1),this._$gl.enableVertexAttribArray(2),this._$gl.vertexAttribPointer(2,4,this._$gl.FLOAT,!1,88,16),this._$gl.vertexAttribDivisor(2,1),this._$gl.enableVertexAttribArray(3),this._$gl.vertexAttribPointer(3,2,this._$gl.FLOAT,!1,88,32),this._$gl.vertexAttribDivisor(3,1),this._$gl.enableVertexAttribArray(4),this._$gl.vertexAttribPointer(4,4,this._$gl.FLOAT,!1,88,40),this._$gl.vertexAttribDivisor(4,1),this._$gl.enableVertexAttribArray(5),this._$gl.vertexAttribPointer(5,4,this._$gl.FLOAT,!1,88,56),this._$gl.vertexAttribDivisor(5,1),this._$gl.enableVertexAttribArray(6),this._$gl.vertexAttribPointer(6,4,this._$gl.FLOAT,!1,88,72),this._$gl.vertexAttribDivisor(6,1),t}_$getVertexArray(t,e){const i=this._$gl.createVertexArray();this.bind(i);const s=this._$gl.createBuffer();return this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,s),this._$vertexBufferData[0]=t,this._$vertexBufferData[2]=t,this._$vertexBufferData[4]=e,this._$vertexBufferData[6]=e,this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$vertexBufferData,this._$gl.STATIC_DRAW),this._$gl.enableVertexAttribArray(0),this._$gl.vertexAttribPointer(0,2,this._$gl.FLOAT,!1,0,0),i}_$getFillVertexArray(){if(this._$fillVertexArrayPool.length){const t=this._$fillVertexArrayPool.pop();if(t)return t}const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();return t.vertexBuffer=e,t.vertexLength=0,this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e),this._$gl.enableVertexAttribArray(0),this._$gl.enableVertexAttribArray(1),this._$gl.vertexAttribPointer(this._$fillAttrib_vertex,2,this._$gl.FLOAT,!1,16,0),this._$gl.vertexAttribPointer(this._$fillAttrib_bezier,2,this._$gl.FLOAT,!1,16,8),t}_$getStrokeVertexArray(){if(this._$strokeVertexArrayPool.length){const t=this._$strokeVertexArrayPool.pop();if(t)return t}const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();t.vertexBuffer=e,t.vertexLength=0,this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e);const i=this._$gl.createBuffer();return t.indexBuffer=i,t.indexLength=0,this._$gl.bindBuffer(this._$gl.ELEMENT_ARRAY_BUFFER,i),this._$gl.enableVertexAttribArray(0),this._$gl.enableVertexAttribArray(1),this._$gl.enableVertexAttribArray(2),this._$gl.enableVertexAttribArray(3),this._$gl.vertexAttribPointer(this._$strokeAttrib_vertex,2,this._$gl.FLOAT,!1,28,0),this._$gl.vertexAttribPointer(this._$strokeAttrib_option1,2,this._$gl.FLOAT,!1,28,8),this._$gl.vertexAttribPointer(this._$strokeAttrib_option2,2,this._$gl.FLOAT,!1,28,16),this._$gl.vertexAttribPointer(this._$strokeAttrib_type,1,this._$gl.FLOAT,!1,28,24),t}createFill(t){const e=ls.generate(t),i=e.vertexBufferData,s=this._$getFillVertexArray();return s.indexRanges=e.indexRanges,this.bind(s),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,s.vertexBuffer),s.vertexLength<i.length&&(s.vertexLength=lt(i.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,4*s.vertexLength,this._$gl.DYNAMIC_DRAW)),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,i),s}createStroke(t,e,i){const s=cs.generate(t,e,i),r=s.vertexBufferData,n=s.indexBufferData,a=this._$getStrokeVertexArray();return a.indexCount=n.length,this.bind(a),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,a.vertexBuffer),this._$gl.bindBuffer(this._$gl.ELEMENT_ARRAY_BUFFER,a.indexBuffer),a.vertexLength<r.length&&(a.vertexLength=lt(r.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,4*a.vertexLength,this._$gl.DYNAMIC_DRAW)),a.indexLength<n.length&&(a.indexLength=lt(n.length),this._$gl.bufferData(this._$gl.ELEMENT_ARRAY_BUFFER,2*a.indexLength,this._$gl.DYNAMIC_DRAW)),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,r),this._$gl.bufferSubData(this._$gl.ELEMENT_ARRAY_BUFFER,0,n),a}releaseFill(t){this._$fillVertexArrayPool.push(t)}releaseStroke(t){this._$strokeVertexArrayPool.push(t)}bind(t=null){t!==this._$boundVertexArray&&(this._$boundVertexArray=t,this._$gl.bindVertexArray(t))}bindInstnceArray(t){this.bind(this._$instanceVertexArray),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,this._$attributeVertexBuffer),t.attributes.length>this._$attributeBuffer.length&&(this._$attributeBuffer=new Float32Array(t.attributes.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$attributeBuffer.byteLength,this._$gl.DYNAMIC_DRAW)),this._$attributeBuffer.set(t.attributes),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,this._$attributeBuffer.subarray(0,t.attributes.length))}bindCommonVertexArray(){this.bind(this._$commonVertexArray)}bindGradientVertexArray(t,e){const i=this._$getVertexArray(t,e);this.bind(i)}}class $s{constructor(t,e){this._$context=t,this._$gl=e,this._$clips=[],this._$poolClip=[],this._$clipStatus=!1,this._$containerClip=!1,this._$currentClip=!1}get containerClip(){return this._$containerClip}set containerClip(t){this._$containerClip=t}_$onClear(t){t&&(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0)}_$onBind(t){!t&&this._$currentClip?(this._$gl.disable(this._$gl.STENCIL_TEST),this._$currentClip=!1):t&&!this._$currentClip&&(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0,this._$endClipDef())}_$onClearRect(){this._$gl.disable(this._$gl.STENCIL_TEST),this._$currentClip=!1}_$enterClip(){this._$currentClip||(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0);const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");t.mask=!0,++t.clipLevel}_$beginClipDef(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.stencilMask(1<<t.clipLevel-1),this._$gl.colorMask(!1,!1,!1,!1)}_$endClipDef(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");const e=t.clipLevel;let i=0;for(let t=0;t<e;++t)i|=(1<<e-t)-1;this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.EQUAL,255&i,i),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.KEEP,this._$gl.KEEP),this._$gl.stencilMask(255),this._$gl.colorMask(!0,!0,!0,!0)}_$leaveClip(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");if(--t.clipLevel,t.mask=!!t.clipLevel,!t.clipLevel)return void this._$context._$clearRectStencil();const e=t.width,i=t.height,s=this._$context.path.createRectVertices(0,0,e,i),r=this._$context.vao.createFill(s);at(s.pop()),at(s);const n=this._$context.shaderList.shapeShaderVariants,a=n.getMaskShapeShader(!1,!1),h=a.uniform;n.setMaskShapeUniformIdentity(h,e,i);const o=r.indexRanges[0];this._$currentClip||(this._$currentClip=!0,this._$gl.enable(this._$gl.STENCIL_TEST)),this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.REPLACE,this._$gl.REPLACE,this._$gl.REPLACE),this._$gl.stencilMask(1<<t.clipLevel),this._$gl.colorMask(!1,!1,!1,!1),a._$containerClip(r,o.first,o.count);const l=r.indexRanges;for(let t=0;t<l.length;++t)ls.indexRangePool.push(l[t]);at(r.indexRanges),this._$context.vao.releaseFill(r),this._$endClipDef()}_$drawContainerClip(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");const e=t.clipLevel,i=this._$context.shaderList.shapeShaderVariants,s=i.getMaskShapeShader(!1,!1),r=s.uniform;let n=e;const a=t.width,h=t.height;this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.colorMask(!1,!1,!1,!1);const o=this._$poolClip.length;for(let t=0;t<o;++t){const t=this._$poolClip.shift();if(!t)continue;i.setMaskShapeUniform(r,!1,t.matrixA,t.matrixB,t.matrixC,t.matrixD,t.matrixE,t.matrixF,t.matrixG,t.matrixH,t.matrixI,t.viewportWidth,t.viewportHeight,null);const o=t.vertexArrayObject.indexRanges;for(let e=0;e<o.length;++e){const i=o[e];this._$gl.stencilMask(1<<n-1),s._$containerClip(t.vertexArrayObject,i.first,i.count),ls.indexRangePool.push(i)}at(o),this._$context.vao.releaseFill(t.vertexArrayObject),++n,n>7&&(this._$unionStencilMask(e,a,h),n=e)}n>e+1&&this._$unionStencilMask(e,a,h)}_$unionStencilMask(t,e,i){const s=this._$context.path.createRectVertices(0,0,e,i),r=this._$context.vao.createFill(s);at(s.pop()),at(s);const n=this._$context.shaderList.shapeShaderVariants,a=n.getMaskShapeShader(!1,!1),h=a.uniform;n.setMaskShapeUniformIdentity(h,e,i);const o=r.indexRanges[0];this._$gl.stencilFunc(this._$gl.LEQUAL,1<<t-1,255),this._$gl.stencilOp(this._$gl.ZERO,this._$gl.REPLACE,this._$gl.REPLACE),this._$gl.stencilMask(~((1<<t-1)-1)),a._$containerClip(r,o.first,o.count),this._$poolClip.length&&(this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT));const l=r.indexRanges;for(let t=0;t<l.length;++t)ls.indexRangePool.push(l[t]);at(r.indexRanges),this._$context.vao.releaseFill(r)}_$onClip(t,e,i,s){return this._$clipStatus=!0,!!this._$containerClip&&(this._$poolClip.push({vertexArrayObject:t,matrixA:e[0],matrixB:e[1],matrixC:e[2],matrixD:e[3],matrixE:e[4],matrixF:e[5],matrixG:e[6],matrixH:e[7],matrixI:e[8],viewportWidth:i,viewportHeight:s}),!0)}_$onSave(){this._$clips.push(this._$clipStatus)}_$onRestore(){this._$clips.length&&(this._$clipStatus=!!this._$clips.pop())}}class us{constructor(t,e){this._$context=t,this._$gl=e,this._$enabled=!1,this._$funcCode=600,this._$currentOperation="normal",this._$currentIndex=-1,this._$currentSmoothing=null,this._$variants=t.shaderList.blendShaderVariants,this._$instanceShader=this._$variants.getInstanceShader(),this.enable()}enable(){this._$enabled||(this._$enabled=!0,this._$gl.enable(this._$gl.BLEND)),this.reset()}disable(){this._$enabled&&(this._$enabled=!1,this._$gl.disable(this._$gl.BLEND))}reset(){613!==this._$funcCode&&(this._$funcCode=613,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ONE_MINUS_SRC_ALPHA))}toOneZero(){610!==this._$funcCode&&(this._$funcCode=610,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ZERO))}toZeroOne(){601!==this._$funcCode&&(this._$funcCode=601,this._$gl.blendFuncSeparate(this._$gl.ZERO,this._$gl.ONE,this._$gl.ONE,this._$gl.ZERO))}toAdd(){611!==this._$funcCode&&(this._$funcCode=611,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ONE))}toScreen(){641!==this._$funcCode&&(this._$funcCode=641,this._$gl.blendFunc(this._$gl.ONE_MINUS_DST_COLOR,this._$gl.ONE))}toAlpha(){606!==this._$funcCode&&(this._$funcCode=606,this._$gl.blendFunc(this._$gl.ZERO,this._$gl.SRC_ALPHA))}toErase(){603!==this._$funcCode&&(this._$funcCode=603,this._$gl.blendFunc(this._$gl.ZERO,this._$gl.ONE_MINUS_SRC_ALPHA))}toSourceAtop(){673!==this._$funcCode&&(this._$funcCode=673,this._$gl.blendFunc(this._$gl.DST_ALPHA,this._$gl.ONE_MINUS_SRC_ALPHA))}toSourceIn(){670!==this._$funcCode&&(this._$funcCode=670,this._$gl.blendFunc(this._$gl.DST_ALPHA,this._$gl.ZERO))}toOperation(t){switch(t){case"add":this.toAdd();break;case"screen":this.toScreen();break;case"alpha":this.toAlpha();break;case"erase":this.toErase();break;case"copy":this.toOneZero();break;default:this.reset()}}clearInstacedArray(){const t=this._$instanceShader.instance;t.count&&t.clear()}drawInstacedArray(){const t=this._$instanceShader.instance;if(!t.count)return;const e=this._$context.frameBuffer,i=e.textureManager.getAtlasTexture(this._$currentIndex);e.textureManager.bind0(i,this._$currentSmoothing),this.toOperation(this._$currentOperation),this._$instanceShader.drawArraysInstanced(t),t.clear()}drawInstance(t,e,i,s,r,n,a,h,o,l,c,_,$,u){this._$currentOperation||(this._$currentOperation=l),-1===this._$currentIndex&&(this._$currentIndex=t.index),null===this._$currentSmoothing&&(this._$currentSmoothing=u),this._$currentOperation===l&&this._$currentIndex===t.index&&this._$currentSmoothing===u||(this.drawInstacedArray(),this._$currentOperation=l,this._$currentIndex=t.index,this._$currentSmoothing=u),this._$variants.pushNormalBlend(this._$instanceShader.instance,t.x,t.y,t.w,t.h,$,c,_,e,i,s,r,n,a,h,o)}drawInstanceBlend(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p,m){this.drawInstacedArray();const x=this._$context.frameBuffer,b=x.currentAttachment,T=1!==n||1!==a||1!==h||1!==o||0!==l||0!==c||0!==_||0!==$,y=x.getTextureFromCurrentAttachment(),E=this._$context.frameBuffer.createTextureAttachment(u.w,u.h);this._$context._$bind(E),x.textureManager.bind0(y);const A=this._$variants.getClipShader(),M=A.uniform;this._$variants.setClipUniform(M,0,0,u.w,u.h,_t(p),g,f),this.reset(),A._$drawImage();const S=x.getTextureFromCurrentAttachment();this._$context._$bind(b),x.textureManager.bind01(S,t,m);const w=this._$variants.getInstanceBlendShader(d,T);this._$variants.setInstanceBlendUniform(w.uniform,u.x/t.width,u.y/t.height,u.w/t.width,u.h/t.height,u.w,u.h,p,g,f,T,n,a,h,o,l,c,_,$);const C=v.abs(s-e),F=v.abs(r-i);this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(e,f-(i+F),C,F),this.toOneZero(),w._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST),x.releaseAttachment(E,!0)}drawImage(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g,f,p){const m=this._$context.frameBuffer,x=m.currentAttachment,b=1!==n||1!==a||1!==h||1!==o||0!==l||0!==c||0!==_||0!==$;switch(u){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":{m.textureManager.bind0(t,p);const x=this._$variants.getNormalBlendShader(b);this._$variants.setNormalBlendUniform(x.uniform,e,i,s,r,f,d,g,b,n,a,h,o,l,c,_,$);const T=f[0],y=f[1],A=f[3],M=f[4],S=f[6],w=f[7];if(1!==T||0!==y||0!==A||1!==M){const t=e+s,n=i+r,a=+(t*T+n*A+S),h=+(t*T+i*A+S),o=+(e*T+n*A+S),l=+(e*T+i*A+S),c=+(t*y+n*M+w),_=+(t*y+i*M+w),$=+(e*y+n*M+w),u=+(e*y+i*M+w),f=E.MAX_VALUE,p=+v.min(v.min(v.min(v.min(f,a),h),o),l),m=+v.max(v.max(v.max(v.max(-f,a),h),o),l),x=+v.min(v.min(v.min(v.min(f,c),_),$),u),b=+v.max(v.max(v.max(v.max(-f,c),_),$),u),C=v.max(0,p),F=v.max(0,x),R=v.min(v.max(0,d-C),v.ceil(v.abs(m-p))),B=v.min(v.max(0,g-F),v.ceil(v.abs(b-x)));if(!R||!B)return;this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(C,v.max(0,g-(F+B)),R+1,B+1)}else{const t=v.max(0,e+S),n=v.max(0,i+w),a=v.min(v.max(0,d-t),s),h=v.min(v.max(0,g-n),r);if(!a||!h)return;this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t,v.max(0,g-(n+h)),a+1,h+1)}this.toOperation(u),x._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST)}break;default:{const T=v.max(0,e+f[6]),y=v.max(0,i+f[7]),E=v.min(v.max(0,d-T),s),A=v.min(v.max(0,g-y),r);if(!E||!A)return;const M=m.getTextureFromCurrentAttachment(),S=this._$context.frameBuffer.createTextureAttachment(s,r);this._$context._$bind(S),m.textureManager.bind0(M);const w=this._$variants.getClipShader(),C=w.uniform;this._$variants.setClipUniform(C,e,i,s,r,_t(f),d,g),this.reset(),w._$drawImage();const F=m.getTextureFromCurrentAttachment();this._$context._$bind(x),m.textureManager.bind01(F,t,p);const R=this._$variants.getBlendShader(u,b);this._$variants.setBlendUniform(R.uniform,e,i,s,r,f,d,g,b,n,a,h,o,l,c,_,$),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(T,v.max(0,g-(y+A)),E,A),this.toOneZero(),R._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST),m.releaseAttachment(S,!0)}}}}class ds{constructor(t,e){var i;i=t.getParameter(t.MAX_TEXTURE_SIZE),Fi=Math.min(4096,i/2),this._$gl=t;const s=v.min(e,t.getParameter(t.MAX_SAMPLES));this._$maxTextureSize=v.min(8192,t.getParameter(t.MAX_TEXTURE_SIZE))-2,this._$contextStyle=new Ci,this._$cacheBounds=K(),this._$matrix=rt(1,0,0,0,1,0,0,0,1),this._$cacheAttachment=null,this._$stack=[],this._$globalAlpha=1,this._$imageSmoothingEnabled=!1,this._$globalCompositeOperation="normal",this._$clearColorR=1,this._$clearColorG=1,this._$clearColorB=1,this._$clearColorA=1,this._$viewportWidth=0,this._$viewportHeight=0,this._$frameBufferManager=new Li(t,s),this._$path=new Oi,this._$grid=new ki,this._$offsetX=0,this._$offsetY=0,this._$blends=nt(),this._$positions=nt(),this._$isLayer=!1,this._$shaderList=new hs(this,t),this._$gradientLUT=new os(this,t),this._$vao=new _s(t),this._$mask=new $s(this,t),this._$blend=new us(this,t),this._$attachmentArray=[],this._$maskBounds=K(0,0,0,0),this._$cachePosition=null}get cachePosition(){return this._$cachePosition}set cachePosition(t){this._$cachePosition=t}reset(){this._$globalAlpha=1,this._$globalCompositeOperation="normal",this._$imageSmoothingEnabled=!1,this._$contextStyle.clear()}get isLayer(){return this._$isLayer}get canvas(){return this._$gl.canvas}get cacheAttachment(){return this._$cacheAttachment}set cacheAttachment(t){this._$cacheAttachment=t}get cacheBounds(){return this._$cacheBounds}get fillStyle(){return this._$contextStyle.fillStyle}set fillStyle(t){this._$contextStyle.fillStyle=t}get strokeStyle(){return this._$contextStyle.strokeStyle}set strokeStyle(t){this._$contextStyle.strokeStyle=t}get lineWidth(){return this._$contextStyle.lineWidth}set lineWidth(t){this._$contextStyle.lineWidth=t}get lineCap(){return this._$contextStyle.lineCap}set lineCap(t){this._$contextStyle.lineCap=t}get lineJoin(){return this._$contextStyle.lineJoin}set lineJoin(t){this._$contextStyle.lineJoin=t}get miterLimit(){return this._$contextStyle.miterLimit}set miterLimit(t){this._$contextStyle.miterLimit=t}get globalAlpha(){return this._$globalAlpha}set globalAlpha(t){this._$globalAlpha=$t(t,0,1,1)}get imageSmoothingEnabled(){return this._$imageSmoothingEnabled}set imageSmoothingEnabled(t){this._$imageSmoothingEnabled=t}get globalCompositeOperation(){return this._$globalCompositeOperation}set globalCompositeOperation(t){this._$globalCompositeOperation=t}get frameBuffer(){return this._$frameBufferManager}get shaderList(){return this._$shaderList}get path(){return this._$path}get grid(){return this._$grid}get vao(){return this._$vao}get blend(){return this._$blend}_$getCurrentPosition(){return this._$positions[this._$positions.length-1]}_$getTextureScale(t,e){const i=v.max(t,e);return i>this._$maxTextureSize?this._$maxTextureSize/i:1}drawInstacedArray(){this.blend.drawInstacedArray()}clearInstacedArray(){this.blend.clearInstacedArray()}bindRenderBuffer(t){this._$frameBufferManager.bindRenderBuffer(),this._$gl.clearColor(0,0,0,0),this._$gl.clear(this._$gl.COLOR_BUFFER_BIT|this._$gl.STENCIL_BUFFER_BIT),this._$viewportWidth=t.w,this._$viewportHeight=t.h,this._$gl.viewport(t.x,t.y,t.w,t.h),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t.x,t.y,t.w,t.h)}getTextureFromRect(t){const e=this._$frameBufferManager,i=e.textureManager.getAtlasTexture(t.index),s=e.currentAttachment,r=e.createTextureAttachment(t.w,t.h);this._$bind(r),this.save(),this.setTransform(1,0,0,1,0,0),this.reset(),this.drawImage(i,-t.x,-i.height+t.h+t.y,i.width,i.height),this.restore();const n=r.texture;return e.releaseAttachment(r),this._$bind(s),n}drawBitmap(t){const e=this._$shaderList.blendShaderVariants,i=e.getNormalBlendShader(!1);e.setNormalBlendUniform(i.uniform,0,0,t.width,t.height,this._$matrix,this._$viewportWidth,this._$viewportHeight,!1,1,1,1,1,0,0,0,0),this._$frameBufferManager.textureManager.bind0(t,this._$imageSmoothingEnabled),this.blend.toOperation("normal"),i._$drawImage()}drawTextureFromRect(t,e){const i=this._$frameBufferManager,s=i.currentAttachment;this.bindRenderBuffer(e),i.transferTexture(e);const r=i.textureManager.getAtlasTexture(e.index),n=i.createTextureAttachmentFrom(r);this._$bind(n),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(e.x,e.y,e.w,e.h),this._$gl.clearColor(0,0,0,0),this._$gl.disable(this._$gl.SCISSOR_TEST),this.save(),this.setTransform(1,0,0,1,0,0),this.reset(),this.drawImage(t,e.x,r.height-e.h-e.y,t.width,t.height),this.restore(),i.releaseAttachment(n),this._$bind(s),i.textureManager.release(t)}stopStencil(){this._$mask._$onClearRect()}_$bind(t=null){if(!t)return;this._$frameBufferManager.bind(t);const e=t.color,i=t.stencil,s=t.width,r=t.height;this._$viewportWidth===s&&this._$viewportHeight===r||(this._$viewportWidth=s,this._$viewportHeight=r,this._$gl.viewport(0,0,s,r)),(e&&e.dirty||i&&i.dirty)&&(e&&(e.dirty=!1),i&&(i.dirty=!1),this._$gl.clearColor(0,0,0,0),this.clearRect(0,0,this._$viewportWidth,this._$viewportHeight),this._$gl.clearColor(this._$clearColorR,this._$clearColorG,this._$clearColorB,this._$clearColorA),this._$mask._$onClear(t.mask)),this._$mask._$onBind(t.mask)}setTransform(t,e,i,s,r,n){this._$matrix[0]=t,this._$matrix[1]=e,this._$matrix[3]=i,this._$matrix[4]=s,this._$matrix[6]=r,this._$matrix[7]=n}setMaxSize(t,e){this._$frameBufferManager.setMaxSize(t,e)}transform(t,e,i,s,r,n){const a=this._$matrix[0],h=this._$matrix[1],o=this._$matrix[3],l=this._$matrix[4],c=this._$matrix[6],_=this._$matrix[7];this._$matrix[0]=t*a+e*o,this._$matrix[1]=t*h+e*l,this._$matrix[3]=i*a+s*o,this._$matrix[4]=i*h+s*l,this._$matrix[6]=r*a+n*o+c,this._$matrix[7]=r*h+n*l+_}debug(t=0){const e=this._$frameBufferManager,i=e.textureManager.getAtlasTexture(t),s=e.currentAttachment,r=e.createTextureAttachmentFrom(i);this._$bind(r);const n=new Uint8Array(i.width*i.height*4);this._$gl.readPixels(0,0,i.width,i.height,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,n);const a=document.createElement("canvas");a.width=i.width,a.height=i.height;const h=a.getContext("2d"),o=new ImageData(i.width,i.height);for(let t=0;t<n.length;++t)o.data[t]=n[t];null==h||h.putImageData(o,0,0),console.log(a.toDataURL()),this._$bind(s),e.releaseAttachment(r)}drawInstance(t,e,i,s,r){let n=1,a=1,h=1,o=0,l=0,c=0;const _=this._$globalAlpha;r&&(n=r[0],a=r[1],h=r[2],o=r[4]/255,l=r[5]/255,c=r[6]/255);const $=this._$cachePosition;if($)switch(this._$globalCompositeOperation){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":this.blend.drawInstance($,n,a,h,_,o,l,c,0,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled);break;default:{const r=this._$frameBufferManager.textureManager.getAtlasTexture($.index);this.blend.drawInstanceBlend(r,t,e,i,s,n,a,h,_,o,l,c,0,$,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled)}}}drawImage(t,e,i,s,r,n=null){let a=1,h=1,o=1,l=0,c=0,_=0;const $=this._$globalAlpha;n&&(a=n[0],h=n[1],o=n[2],l=n[4]/255,c=n[5]/255,_=n[6]/255),this.blend.drawImage(t,e,i,s,r,a,h,o,$,l,c,_,0,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled)}_$setColor(t=0,e=0,i=0,s=0){this._$clearColorR=t,this._$clearColorG=e,this._$clearColorB=i,this._$clearColorA=s,this._$gl.clearColor(t,e,i,s)}clearRect(t,e,i,s){this._$mask._$onClearRect(),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t,e,i,s),this._$gl.clear(this._$gl.COLOR_BUFFER_BIT|this._$gl.STENCIL_BUFFER_BIT),this._$gl.disable(this._$gl.SCISSOR_TEST)}_$clearRectStencil(){this._$mask._$onClearRect(),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(this._$maskBounds.xMin,this._$maskBounds.yMin,this._$maskBounds.xMax,this._$maskBounds.yMax),this._$gl.clear(this._$gl.STENCIL_BUFFER_BIT),this._$gl.disable(this._$gl.SCISSOR_TEST)}moveTo(t,e){this._$path.moveTo(t,e)}lineTo(t,e){this._$path.lineTo(t,e)}beginPath(){this._$path.begin()}quadraticCurveTo(t,e,i,s){this._$path.quadTo(t,e,i,s)}bezierCurveTo(t,e,i,s,r,n){this._$path.cubicTo(t,e,i,s,r,n)}fill(){const t=this._$path.vertices;if(!t.length)return;const e=nt();for(let i=0;i<t.length;++i){const s=t[i];10>s.length||e.push(s)}if(!e.length)return void at(e);const i=this._$vao.createFill(e),s=this.fillStyle;let r,n,a,h=this._$matrix;const o=this._$grid.enabled;if(s instanceof Si){const t=s.stops,e="linearRGB"===s.rgb;if(r=this._$gradientLUT.generateForShape(t,e),this._$frameBufferManager.textureManager.bind0(r,!0),this._$frameBufferManager.bindRenderBuffer(),n=this._$shaderList.gradientShapeShaderVariants,"linear"===s.type)a=n.getGradientShapeShader(!1,o,!1,!1,s.mode),n.setGradientShapeUniform(a.uniform,!1,0,0,0,o,h,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!1,s.points,0);else{h=this._$stack[this._$stack.length-1];const t=0!==s.focalPointRatio;a=n.getGradientShapeShader(!1,o,!0,t,s.mode),n.setGradientShapeUniform(a.uniform,!1,0,0,0,o,h,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!0,s.points,s.focalPointRatio)}}else if(s instanceof wi){h=this._$stack[this._$stack.length-1];const t=s.colorTransform;r=s.texture,this._$frameBufferManager.textureManager.bind0(r,this._$imageSmoothingEnabled),n=this._$shaderList.shapeShaderVariants,a=n.getBitmapShapeShader(!1,s.repeat,o),t?n.setBitmapShapeUniform(a.uniform,!1,0,0,0,o,h,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,r.width,r.height,t[0],t[1],t[2],this._$globalAlpha,t[4]/255,t[5]/255,t[6]/255,0):n.setBitmapShapeUniform(a.uniform,!1,0,0,0,o,h,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,r.width,r.height,1,1,1,this._$globalAlpha,0,0,0,0)}else n=this._$shaderList.shapeShaderVariants,a=n.getSolidColorShapeShader(!1,this._$grid.enabled),n.setSolidColorShapeUniform(a.uniform,!1,0,0,0,o,h,this._$viewportWidth,this._$viewportHeight,this._$grid,s,this._$globalAlpha);const l=this._$shaderList.shapeShaderVariants,c=l.getMaskShapeShader(!1,o);l.setMaskShapeUniform(c.uniform,o,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],this._$viewportWidth,this._$viewportHeight,this._$grid),this._$gl.enable(this._$gl.STENCIL_TEST),this._$gl.stencilMask(255),this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.colorMask(!1,!1,!1,!1),c._$fill(i),this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.NOTEQUAL,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.ZERO,this._$gl.ZERO),this._$gl.colorMask(!0,!0,!0,!0),a._$fill(i),this._$gl.disable(this._$gl.STENCIL_TEST),this.releaseFillVertexArray(i)}releaseFillVertexArray(t){this._$vao.releaseFill(t);const e=t.indexRanges;for(let t=0;t<e.length;++t)ls.indexRangePool.push(e[t]);at(e)}_$enterClip(){this._$mask._$enterClip()}_$beginClipDef(){this._$mask._$beginClipDef()}_$updateContainerClipFlag(t){this._$mask.containerClip=t}_$startClip(t){const e=t.xMin,i=t.yMin,s=Math.abs(t.xMax-t.xMin),r=Math.abs(t.yMax-t.yMin),n=this._$frameBufferManager.currentAttachment;if(!n)throw new Error("the current Attachment is null.");return!(e>n.width||i>n.height||0>e&&0>=s+e||0>i&&0>=r+i||(this._$maskBounds.xMin=v.max(0,v.min(this._$maskBounds.xMin,e)),this._$maskBounds.yMin=v.max(0,v.min(this._$maskBounds.yMin,i)),this._$maskBounds.xMax=v.min(n.width,v.min(this._$maskBounds.xMax,s)),this._$maskBounds.yMax=v.min(n.height,v.min(this._$maskBounds.yMax,r)),0))}_$endClipDef(){this._$mask._$endClipDef()}_$leaveClip(){this.drawInstacedArray(),this._$mask._$leaveClip()}_$drawContainerClip(){this._$mask._$drawContainerClip()}closePath(){this._$path.close()}stroke(){const t=this._$path.vertices;if(!t.length)return;const e=nt();for(let i=0;i<t.length;++i){const s=t[i];6>s.length||e.push(s)}if(!e.length)return void at(e);const i=this._$vao.createStroke(t,this.lineCap,this.lineJoin);let s=this._$matrix;const r=this.strokeStyle;let n=v.sign(s[0]*s[4]);n>0&&0!==s[1]&&0!==s[3]&&(n=-v.sign(s[1]*s[3]));let a,h,o=.5*this.lineWidth;this._$grid.enabled?(a=v.abs(this._$grid.ancestorMatrixA+this._$grid.ancestorMatrixD),h=v.abs(this._$grid.ancestorMatrixB+this._$grid.ancestorMatrixE)):(a=v.abs(s[0]+s[3]),h=v.abs(s[1]+s[4]));const l=v.min(a,h),c=v.max(a,h);o*=c*(1-.3*v.cos(.5*v.PI*(l/c))),o=v.max(1,o);const _=this._$grid.enabled;let $,u,d;if(r instanceof Si){"radial"===r.type&&(s=this._$stack[this._$stack.length-1]);const t=r.stops,e="linearRGB"===r.rgb;if($=this._$gradientLUT.generateForShape(t,e),this._$frameBufferManager.textureManager.bind0($,!0),u=this._$shaderList.gradientShapeShaderVariants,"linear"===r.type)d=u.getGradientShapeShader(!0,_,!1,!1,r.mode),u.setGradientShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!1,r.points,0);else{s=this._$stack[this._$stack.length-1];const t=0!==r.focalPointRatio;d=u.getGradientShapeShader(!0,_,!0,t,r.mode),u.setGradientShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!0,r.points,r.focalPointRatio)}}else if(r instanceof wi){s=this._$stack[this._$stack.length-1];const t=r.colorTransform;$=r.texture,this._$frameBufferManager.textureManager.bind0($),u=this._$shaderList.shapeShaderVariants,d=u.getBitmapShapeShader(!0,r.repeat,this._$grid.enabled),t?u.setBitmapShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,$.width,$.height,t[0],t[1],t[2],this._$globalAlpha,t[4]/255,t[5]/255,t[6]/255,0):u.setBitmapShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,_t(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,$.width,$.height,1,1,1,this._$globalAlpha,0,0,0,0)}else u=this._$shaderList.shapeShaderVariants,d=u.getSolidColorShapeShader(!0,this._$grid.enabled),u.setSolidColorShapeUniform(d.uniform,!0,o,n,this.miterLimit,_,s,this._$viewportWidth,this._$viewportHeight,this._$grid,r,this._$globalAlpha);d._$stroke(i),this._$vao.releaseStroke(i)}arc(t,e,i){this._$path.drawCircle(t,e,i)}clip(){const t=this._$path.vertices;if(!t.length)return;const e=nt();for(let i=0;i<t.length;++i){const s=t[i];10>s.length||e.push(s)}if(!e.length)return void at(e);const i=this._$vao.createFill(e),s=this._$shaderList.shapeShaderVariants,r=s.getMaskShapeShader(!1,!1),n=r.uniform;s.setMaskShapeUniform(n,!1,this._$matrix[0],this._$matrix[1],this._$matrix[2],this._$matrix[3],this._$matrix[4],this._$matrix[5],this._$matrix[6],this._$matrix[7],this._$matrix[8],this._$viewportWidth,this._$viewportHeight,null),this._$mask._$onClip(i,this._$matrix,this._$viewportWidth,this._$viewportHeight)||(r._$fill(i),this.beginPath())}save(){const t=this._$matrix;this._$stack.push(rt(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])),this._$mask._$onSave()}restore(){var t;this._$stack.length&&(t=this._$matrix,X.push(t),this._$matrix=this._$stack.pop()||rt()),this._$mask._$onRestore()}createPattern(t,e,i){return new wi(this,t,e,i)}createLinearGradient(t,e,i,s,r="rgb",n="pad"){return(new Si).linear(t,e,i,s,r,n)}createRadialGradient(t,e,i,s,r,n,a="rgb",h="pad",o=0){return(new Si).radial(t,e,i,s,r,n,a,h,o)}_$applyBlurFilter(t,e,i){const s=this._$frameBufferManager,r=s.currentAttachment;if(!r)throw new Error("the current attachment is null.");const n=r.width,a=r.height;s.textureManager.bind0(t,!0);const h=v.ceil(.5*i),o=1-(h-.5*i),l=1+i,c=this._$shaderList.filterShaderVariants,_=c.getBlurFilterShader(h);c.setBlurFilterUniform(_.uniform,n,a,e,o,l),_._$drawImage()}_$applyBitmapFilter(t,e,i,s,r,n,a,h,o,l,c,_,$,u,d,g=null,f=null,p=null,m=0,x=0,b=0,v=0,T=0,y=0,E=0,A=0){const M=this._$frameBufferManager,S="inner"===$,w=M.currentAttachment,C=M.getTextureFromCurrentAttachment();let F=null;const R=null!==g&&null!==f&&null!==p;let B;null!==g&&null!==f&&null!==p&&(F=this._$gradientLUT.generateForFilter(g,f,p)),S?R&&F?M.textureManager.bind02(t,F,!0):M.textureManager.bind0(t):(B=this._$frameBufferManager.createTextureAttachment(e,i),this._$bind(B),R&&F?M.textureManager.bind012(t,C,F,!0):M.textureManager.bind01(t,C));const I=!(S||"full"===$&&u),L=!(e===h&&i===o&&0===l&&0===c),P=!(1===d),O=this._$shaderList.filterShaderVariants,k=O.getBitmapFilterShader(I,L,_,$,u,P,R);O.setBitmapFilterUniform(k.uniform,e,i,s,r,n,a,h,o,l,c,_,d,m,x,b,v,T,y,E,A,I,L,P,R),S?u?this.blend.toSourceIn():this.blend.toSourceAtop():this.blend.toOneZero(),k._$drawImage(),S||M.releaseAttachment(w,!0)}_$applyColorMatrixFilter(t,e){this._$frameBufferManager.textureManager.bind0(t,!0);const i=this._$shaderList.filterShaderVariants,s=i.getColorMatrixFilterShader();i.setColorMatrixFilterUniform(s.uniform,e),this.blend.reset(),s._$drawImage()}_$applyConvolutionFilter(t,e,i,s,r,n,a,h,o,l,c,_){const $=t.width,u=t.height,d=this._$frameBufferManager.createTextureAttachment($,u);this._$bind(d),this._$frameBufferManager.textureManager.bind0(t,!0);const g=this._$shaderList.filterShaderVariants,f=g.getConvolutionFilterShader(e,i,a,h);g.setConvolutionFilterUniform(f.uniform,$,u,s,r,n,h,o,l,c,_),this.blend.reset(),f._$drawImage()}_$applyDisplacementMapFilter(t,e,i,s,r,n,a,h,o,l,c,_,$,u){const d=t.width,g=t.height,f=this._$frameBufferManager.createTextureAttachment(d,g);this._$bind(f),r||(r={x:0,y:0});const p=this._$frameBufferManager.createTextureFromImage(e);this._$frameBufferManager.textureManager.bind01(t,p);const m=this._$shaderList.filterShaderVariants,x=m.getDisplacementMapFilterShader(n,a,l);m.setDisplacementMapFilterUniform(x.uniform,e.width,e.height,i,s,r.x,r.y,h,o,l,c,_,$,u),this.blend.reset(),x._$drawImage(),this._$frameBufferManager.releaseTexture(p)}_$startLayer(t){this._$positions.push(t),this._$blends.push(this._$isLayer),this._$isLayer=!0}_$endLayer(){const t=this._$positions.pop();t&&Q(t),this._$isLayer=!!this._$blends.pop()}_$saveAttachment(t,e,i=!1){this.drawInstacedArray();const s=this._$frameBufferManager;this._$attachmentArray.push(s.currentAttachment),this._$bind(s.createCacheAttachment(t,e,i))}_$restoreAttachment(t=!1){const e=this._$frameBufferManager;e.releaseAttachment(e.currentAttachment,t),this._$bind(this._$attachmentArray.pop())}getCurrentPosition(){return this._$positions[this._$positions.length-1]}textureScale(t,e){const i=v.max(t,e);return i>this._$maxTextureSize?this._$maxTextureSize/i:1}}class gs{constructor(){var t;t=window.devicePixelRatio,f=t,this._$stage=new de,this._$stage._$player=this,this._$mode="loader",this._$actionOffset=0,this._$actions=nt(),this._$loaders=nt(),this._$sounds=ot(),this._$hitObject={x:0,y:0,pointer:"",hit:null},this._$rollOverObject=null,this._$mouseOverTarget=null,this._$ratio=f,this._$stopFlag=!0,this._$startTime=0,this._$fps=16,this._$loadStatus=0,this._$width=0,this._$height=0,this._$baseWidth=0,this._$baseHeight=0,this._$scale=1,this._$matrix=tt(1,0,0,1,0,0),this._$tx=0,this._$ty=0,this._$state="up",this._$hitTestStart=!1,this._$stageX=-1,this._$stageY=-1,this._$deltaX=0,this._$deltaY=0,this._$broadcastEvents=ot(),this._$optionWidth=0,this._$optionHeight=0,this._$tagId="",this._$bgColor="transparent",this._$base="",this._$fullScreen=!1,this._$quality="high",this._$sources=nt(),this._$videos=nt(),this._$textField=null,this._$timerId=-1,this._$loadId=-1,this._$context=null,this._$attachment=null,this._$clickTarget=null,this._$actionProcess=!1,this._$canvas=u.createElement("canvas")}static get LOAD_START(){return 1}static get LOAD_END(){return 2}get cacheStore(){return At}get canvas(){return this._$canvas}get broadcastEvents(){return this._$broadcastEvents}get context(){return this._$context}set context(t){this._$context=t}get base(){return this._$base}set base(t){if(-1===t.indexOf("//")){const e=t.split("/");""!==e[0]&&"."!==e[0]||e.shift(),e.pop(),this._$base=`${location.origin}/`,e.length&&(this._$base+=`${e.join("/")}/`)}else if(-1===t.indexOf("?"))this._$base="/"===t.slice(-1)?t:`${t}/`;else{const e=t.split("?")[0];this._$base="/"===e.slice(-1)?e:`${e}/`}}get stage(){return this._$stage}get x(){return this._$tx}get y(){return this._$ty}get scaleX(){return this._$matrix[0]}get scaleY(){return this._$matrix[3]}get mode(){return this._$mode}set mode(t){this._$mode=t}get contentElementId(){return Es}get width(){return this._$baseWidth}set width(t){this._$baseWidth=0|t}get height(){return this._$baseHeight}set height(t){this._$baseHeight=0|t}get bgColor(){return this._$bgColor}set bgColor(t){this._$bgColor=`${t}`}play(){if(this._$stopFlag){this._$stopFlag=!1,this._$timerId>-1&&R(this._$timerId),this._$startTime=B.now();const t=this._$stage._$frameRate;this._$fps=1e3/t|0,this._$timerId=F((t=>{this._$run(t)}))}}stop(){this._$timerId>-1&&R(this._$timerId),this._$stopFlag=!0,this._$timerId=-1,ae.stopAll(),At.reset(),Tr&&Tr.postMessage({command:"stop"})}removeCache(t){At.removeCache(t),Tr&&Tr.postMessage({command:"removeCache",id:t})}setOptions(t=null){t&&(this._$optionWidth=t.width||this._$optionWidth,this._$optionHeight=t.height||this._$optionHeight,this._$tagId=t.tagId||this._$tagId,this.base=t.base||this._$base,this._$bgColor=t.bgColor||this._$bgColor,this._$fullScreen=!!t.fullScreen)}_$loadWebAudio(t=null){t&&this._$canvas.removeEventListener(Fs,this._$loadWebAudio),Ps||dr()}_$updateLoadStatus(){if(this._$loadStatus===gs.LOAD_END)return this._$loadId>-1&&R(this._$loadId),this._$loadId=-1,void this._$loaded();this._$loadId=F((()=>{this._$updateLoadStatus()}))}_$loaded(){const t=u.getElementById(this.contentElementId);if(t){this._$setBackgroundColor(this._$bgColor),this._$deleteNode(),t.appendChild(this._$canvas),this._$stage._$prepareActions(),this._$broadcastEvents.has(wt.FRAME_CONSTRUCTED)&&this._$dispatchEvent(new wt(wt.FRAME_CONSTRUCTED)),this._$doAction(),this._$broadcastEvents.has(wt.EXIT_FRAME)&&this._$dispatchEvent(new wt(wt.EXIT_FRAME));const e=this._$loaders.length;for(let t=0;t<e;++t){const t=this._$loaders.shift();t.hasEventListener(wt.INIT)&&t.dispatchEvent(new wt(wt.INIT)),t.hasEventListener(wt.COMPLETE)&&t.dispatchEvent(new wt(wt.COMPLETE))}this._$broadcastEvents.has(wt.ACTIVATE)&&this._$dispatchEvent(new wt(wt.ACTIVATE)),this._$doAction(),this._$draw(),this.play()}}_$initialize(){const t=this.contentElementId;if(this._$tagId){const e=u.getElementById(this._$tagId);if(!e)return void alert("Not Found Tag ID:"+this._$tagId);if(u.getElementById(t))this._$deleteNode();else{const i=u.createElement("div");i.id=t,i.tabIndex=-1,e.appendChild(i)}}else u.body.insertAdjacentHTML("beforeend",`<div id="${t}" tabindex="-1"></div>`);const e=u.getElementById(t);if(!e)throw new Error("the content element is null.");const i=e.parentElement;if(i){this._$initStyle(e),this._$buildWait();const t=this._$optionWidth?this._$optionWidth:"BODY"===i.tagName?$.innerWidth:i.offsetWidth,s=this._$optionHeight?this._$optionHeight:"BODY"===i.tagName?$.innerHeight:i.offsetHeight;"loader"===this._$mode&&t&&s&&(this._$baseWidth=t,this._$baseHeight=s,this._$resize())}"loader"===this._$mode?(this._$loadStatus=gs.LOAD_START,this._$updateLoadStatus()):(this._$resize(),this._$loaded())}_$initStyle(t){const e=t.style;e.position="relative",e.top="0",e.left="0",e.backgroundColor="transparent",e.overflow="hidden",e.padding="0",e.margin="0",e.userSelect="none",e.outline="none";const i=this._$optionWidth,s=this._$optionHeight,r=t.parentElement;if(!r)throw new Error("the parentElement is null.");if("BODY"===r.tagName)return e.width=i?`${i}px`:`${window.innerWidth}px`,void(e.height=s?`${s}px`:`${window.innerHeight}px`);e.width=i?`${i}px`:`${r.offsetWidth}px`,e.height=s?`${s}px`:`${r.offsetHeight}px`}_$buildWait(){const t=u.getElementById(this.contentElementId);if(t){const e=`${this.contentElementId}_loading`;t.innerHTML=`<style>\n#${e} {\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -24px 0 0 -24px;\n width: 50px;\n height: 50px;\n border-radius: 50px;\n border: 8px solid #dcdcdc;\n border-right-color: transparent;\n box-sizing: border-box;\n animation: ${e} 0.8s infinite linear;\n}\n@keyframes ${e} {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n</style>`;const i=u.createElement("div");i.id=e,t.appendChild(i)}}_$deleteNode(){const t=u.getElementById(this.contentElementId);if(t)for(;t.childNodes.length;)t.removeChild(t.childNodes[0])}_$initializeCanvas(){if(this._$canvas.width=1,this._$canvas.height=1,Tr){const t=this._$canvas.transferControlToOffscreen(),e=sr();let i=0;e[i++]=this._$stage._$instanceId,e[i++]=+Hs,e[i++]=f,e[i++]=this._$getSamples();const s=nt(t,e.buffer);Tr.postMessage({command:"initialize",canvas:t,buffer:e},s),at(s)}else{const t=this._$canvas.getContext("webgl2",{stencil:!0,premultipliedAlpha:!0,antialias:!1,depth:!1,preserveDrawingBuffer:!0});t?(this._$context=new ds(t,this._$getSamples()),At.context=this._$context):alert("WebGL setting is off. Please turn the setting on.")}const t=()=>{if(this._$canvas.removeEventListener(Fs,t),this._$canvas.removeEventListener(Ss,t),!Ps){dr();for(let t=0;t<this._$videos.length;++t){const e=this._$videos[t];e._$video&&(e._$video.muted=!1)}}};this._$canvas.addEventListener(Ss,t),this._$canvas.addEventListener(Fs,t),this._$canvas.addEventListener(As,(t=>{l(t),a(As),this._$hitTest()})),this._$canvas.addEventListener(Ms,(t=>{l(t),a(Ms),this._$hitTest()})),this._$canvas.addEventListener(Ss,(t=>{l(t),a(Ss),this._$hitTest()})),this._$canvas.addEventListener(Ms,(t=>{l(t),a(Ms),this._$hitTest()}),{passive:!1}),this._$canvas.addEventListener(ws,(t=>{l(t),a(ws),t.button||this._$hitTest()})),this._$canvas.addEventListener(Bs,(t=>{l(t),a(Bs),t.button||this._$hitTest()})),this._$canvas.addEventListener(Is,(t=>{l(t),a(Is),this._$hitTest(),l(null),this._$stageX=-1,this._$stageY=-1})),this._$canvas.addEventListener(Fs,(t=>{l(t),a(Fs),t.button||this._$hitTest()})),this._$canvas.addEventListener(Cs,(t=>{l(t),a(Cs),this._$hitTest()})),this._$canvas.addEventListener(Rs,(t=>{t.defaultPrevented||(l(t),a(Rs),this._$hitTest())}),{passive:!1});let e="";e+="position: absolute;",e+="top: 0;",e+="left: 0;",e+="-webkit-tap-highlight-color: rgba(0,0,0,0);",e+="backface-visibility: hidden;",e+="transform-origin: 0 0;",1!==f&&(e+=`transform: scale(${1/f});`),this._$canvas.setAttribute("style",e)}_$resize(){const t=u.getElementById(this.contentElementId);if(t){const e=t.parentElement;if(!e)throw new Error("the parentElement is null.");const i=this._$optionWidth?this._$optionWidth:"BODY"===e.tagName?$.innerWidth:e.offsetWidth?e.offsetWidth:parseFloat(e.style.width),s=this._$optionHeight?this._$optionHeight:"BODY"===e.tagName?$.innerHeight:e.offsetHeight?e.offsetHeight:parseFloat(e.style.height),r="BODY"===e.tagName?$.innerWidth:e.offsetWidth,n=v.min(i/this._$baseWidth,s/this._$baseHeight);let a=this._$fullScreen?i:this._$baseWidth*n|0,h=this._$fullScreen?s:this._$baseHeight*n|0;const o=t.style;if(o.width=`${a}px`,o.height=`${h}px`,o.top="0",o.left=this._$fullScreen?"0":r/2-a/2+"px",a*=f,h*=f,this._$width===a&&this._$height===h)return;this._$stage._$doChanged(),At.reset(),this._$scale=n,this._$width=a,this._$height=h;const l=this._$scale*this._$ratio;this._$matrix[0]=l,this._$matrix[3]=l,this._$fullScreen&&(this._$tx=(a-this._$baseWidth*n*f)/2,this._$ty=(h-this._$baseHeight*n*f)/2,this._$matrix[4]=this._$tx,this._$matrix[5]=this._$ty),this._$resizeCanvas(a,h,l,this._$tx,this._$ty),this._$ratio>1&&f>1&&(this._$canvas.style.transform=`scale(${1/this._$ratio})`),t.children.length>1&&t.children[1].dispatchEvent(new Event(`${Es}_blur`))}}_$setBackgroundColor(t="transparent"){if(Tr){const e=sr();e[0]="transparent"===t?-1:pt(t);const i=rr();i.command="setBackgroundColor",i.buffer=e;const s=nt(e.buffer);Tr.postMessage(i,s),nr(i),at(s)}else{const e=this._$context;if(!e)return;if("transparent"===t)e._$setColor(0,0,0,0);else{const i=mt(pt(t));e._$setColor(i.R/255,i.G/255,i.B/255,1)}}}_$resizeCanvas(t,e,i,s=0,r=0){if(Tr){const n=sr();let a=0;n[a++]=t,n[a++]=e,n[a++]=i,n[a++]=s,n[a++]=r;const h=rr(),o=nt(n.buffer);h.command="resize",h.buffer=n,Tr.postMessage(h,o),nr(h),at(o)}else{const i=this._$context;if(!i)return;i.clearInstacedArray(),this._$canvas.width=t,this._$canvas.height=e,i._$gl.viewport(0,0,t,e);const s=i.frameBuffer;this._$attachment&&(s.unbind(),s.releaseAttachment(this._$attachment,!0)),this._$attachment=s.createCacheAttachment(t,e,!0),i.setMaxSize(t,e),i._$bind(this._$attachment)}}_$getSamples(){switch(this._$quality){case"high":return 4;case"medium":return 2;default:return 0}}_$dispatchEvent(t){if(this._$broadcastEvents.size&&this._$broadcastEvents.has(t.type)){const e=this._$broadcastEvents.get(t.type).slice(0);t.eventPhase=St.AT_TARGET;for(let i=0;i<e.length;++i){const s=e[i];if(t.currentTarget=s.target,t.listener=s.listener,s.listener.call(null,t),t._$stopImmediatePropagation)break}return at(e),!0}return!1}_$run(t=0){if(this._$stopFlag)return;this._$doAction();const e=t-this._$startTime;if(e>this._$fps){if(this._$startTime=t-e%this._$fps,this._$action(),this._$sounds.size){for(const t of this._$sounds.values())t._$soundPlay();this._$sounds.clear()}this._$draw(),!Qs&&!this._$hitTestStart&&"up"===this._$state&&this._$stageX>-1&&this._$stageY>-1&&o()&&this._$pointerCheck()}else this._$videos.length&&!Tr&&this._$draw();this._$timerId=F((t=>{this._$run(t)}))}_$pointerCheck(){const t=this._$stageX,e=this._$stageY;this._$hitObject.x=t,this._$hitObject.y=e,this._$hitObject.pointer="",this._$hitObject.hit=null,tr.setTransform(1,0,0,1,0,0),tr.beginPath(),Vs[4]=this._$tx/this._$scale/f,Vs[5]=this._$ty/this._$scale/f,this._$stage._$mouseHit(tr,Vs,this._$hitObject,!0);let i=null,s=null,r=!1,n=!1;if(this._$hitObject.hit){if(i=this._$hitObject.hit,this._$mouseOverTarget&&this._$mouseOverTarget!==i){const t=this._$mouseOverTarget;t.willTrigger(It.MOUSE_OUT)&&t.dispatchEvent(new It(It.MOUSE_OUT,!0,!1))}if(this._$rollOverObject!==i){let r=null;if(this._$rollOverObject)for(s=this._$rollOverObject,s.willTrigger(It.ROLL_OUT)&&s.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),r=s._$parent;r&&r._$root!==r&&r!==i;){if(r._$mouseEnabled&&r._$outCheck(t,e)){let t=!1,e=i;for(;e&&e._$root!==e;){if(e===r){t=!0;break}e=e._$parent}if(!t&&r._$parent===i._$parent&&r._$index>i._$index&&(t=!0),t)break}r.willTrigger(It.ROLL_OUT)&&r.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),r=r._$parent}for(s=i;s.willTrigger(It.ROLL_OVER)&&s.dispatchEvent(new It(It.ROLL_OVER,!1,!1)),s=s._$parent,s&&s!==r&&s.stage!==s;);}switch(this._$rollOverObject=i,!0){case null===this._$mouseOverTarget:case this._$mouseOverTarget!==i:i&&i.willTrigger(It.MOUSE_OVER)&&i.dispatchEvent(new It(It.MOUSE_OVER,!0,!1)),this._$mouseOverTarget=i}if("up"===this._$state&&(this._$clickTarget=null),!Qs&&"up"===this._$state)for(s=i;s&&s.root!==s;){if("_$text"in s&&"input"===s.type){r=!0;break}if("buttonMode"in s&&s.buttonMode){n=!0;break}s=s._$parent}}else{if(this._$mouseOverTarget&&(i=this._$mouseOverTarget,i.willTrigger(It.MOUSE_OUT)&&i.dispatchEvent(new It(It.MOUSE_OUT,!0,!1))),this._$rollOverObject)for(s=this._$rollOverObject;s&&s.root!==s;)s.willTrigger(It.ROLL_OUT)&&s.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),s=s._$parent;this._$rollOverObject=null,this._$mouseOverTarget=null}switch(!0){case r:this._$canvas.style.cursor="text";break;case n:this._$canvas.style.cursor="pointer";break;case!Qs&&"up"===this._$state:this._$canvas.style.cursor="auto"}this._$actions.length>1&&this._$doAction()}_$action(){if(this._$stopFlag)return;let t=null;const e=this._$loaders.length;if(e){t=this._$loaders.slice(0),this._$loaders.length=0;for(let i=0;i<e;++i){const e=t[i];"content"in e&&e.content._$prepareActions()}}if(this._$stage._$nextFrame(),this._$broadcastEvents.has(wt.ENTER_FRAME)&&this._$dispatchEvent(new wt(wt.ENTER_FRAME)),this._$broadcastEvents.has(wt.FRAME_CONSTRUCTED)&&this._$dispatchEvent(new wt(wt.FRAME_CONSTRUCTED)),this._$doAction(),this._$broadcastEvents.has(wt.EXIT_FRAME)&&this._$dispatchEvent(new wt(wt.EXIT_FRAME)),this._$stage._$invalidate&&(this._$stage._$invalidate=!1,this._$dispatchEvent(new wt(wt.RENDER))),t){for(let e=0;e<t.length;++e){const i=t[e];i.hasEventListener(wt.INIT)&&i.dispatchEvent(new wt(wt.INIT)),i.hasEventListener(wt.COMPLETE)&&i.dispatchEvent(new wt(wt.COMPLETE))}at(t)}this._$doAction()}_$draw(){if(!this._$width||!this._$height)return;if(!this._$stage._$isUpdated())return;Tr&&Tr.postMessage({command:"draw"});const t=this._$context;t&&(t.reset(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this._$width,this._$height),t.beginPath(),this._$stage._$draw(t,this._$matrix,O),this._$stage._$updated=!1,t.drawInstacedArray(),t.frameBuffer.transferToMainTexture())}_$doAction(){for(;this._$actions.length;){this._$actionProcess=!0;const t=this._$actions.pop();if(!t)continue;t._$canAction=!1,t._$actionOffset=0,t._$actionLimit=0;const e=t._$currentFrame;if(!t._$actions.has(e))continue;const i=t._$actions.get(e);if(i){t._$actionProcess=!0;for(let e=0;e<i.length;++e)r(t._$loaderInfo),i[e].apply(t);t._$actionProcess=!1,t._$frameCache.size&&(t._$currentFrame=t._$frameCache.get("nextFrame"),t._$clearChildren(),t._$stopFlag=t._$frameCache.get("stopFlag"),t._$isPlaying=t._$frameCache.get("isPlaying"),t._$frameCache.clear())}}this._$actionProcess=!1,r(null)}_$hitTest(){if(this._$stopFlag)return;const t=o();if(!t)return;this._$hitTestStart=!0,x(!1);let e=null,i=null,s=$.scrollX,r=$.scrollY;const a=u.getElementById(this.contentElementId);if(a){const t=a.getBoundingClientRect();s+=t.left,r+=t.top}let h=0,l=0;if("changedTouches"in t){const e=t.changedTouches[0];h=e.pageX,l=e.pageY}else"pageX"in t&&(h=t.pageX,l=t.pageY);const c=(h-s)/this._$scale,_=(l-r)/this._$scale;this._$stageX=c,this._$stageY=_,this._$hitObject.x=c,this._$hitObject.y=_,this._$hitObject.pointer="",this._$hitObject.hit=null,tr.setTransform(1,0,0,1,0,0),tr.beginPath(),Vs[4]=this._$tx/this._$scale/f,Vs[5]=this._$ty/this._$scale/f,this._$stage._$mouseHit(tr,Vs,this._$hitObject,!0),this._$hitObject.hit&&t.preventDefault();let d=!1,g=!1,p=!1;const b=n;switch(b){case Ms:case Cs:if(ks){const t=ks._$dragMousePoint();let e=t.x,i=t.y;Ds.lock||(e+=Ds.position.x,i+=Ds.position.y);const s=Ds.bounds;s&&(e=$t(e,s.left,s.right),i=$t(i,s.top,s.bottom)),ks.x=e,ks.y=i}if(this._$clickTarget&&"_$text"in this._$clickTarget&&this._$clickTarget.scrollEnabled){const t=this._$deltaX-h,e=this._$deltaY-l;this._$clickTarget.scrollX+=t/(this._$clickTarget.textWidth/this._$clickTarget.width),this._$clickTarget.scrollY+=e/(this._$clickTarget.textHeight/this._$clickTarget.height)}this._$deltaX=h,this._$deltaY=l;break;case As:case ws:this._$deltaX=h,this._$deltaY=l,this._$state="down",p="pointer"===this._$canvas.style.cursor,g=!0;break;case Ss:case Fs:case Bs:this._$deltaX=0,this._$deltaY=0,this._$state="up"}switch(!0){case null===this._$hitObject.hit:case b===Is:if(this._$mouseOverTarget&&(e=this._$mouseOverTarget,e.willTrigger(It.MOUSE_OUT)&&e.dispatchEvent(new It(It.MOUSE_OUT,!0,!1))),this._$rollOverObject)for(i=this._$rollOverObject;i&&i.root!==i;)i.willTrigger(It.ROLL_OUT)&&i.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),i=i._$parent;switch(this._$rollOverObject=null,this._$mouseOverTarget=null,b){case Rs:this._$stage.hasEventListener(It.MOUSE_WHEEL)&&this._$stage.dispatchEvent(new It(It.MOUSE_WHEEL,!0,!1));break;case As:case ws:this._$stage.hasEventListener(It.MOUSE_DOWN)&&this._$stage.dispatchEvent(new It(It.MOUSE_DOWN,!0,!1)),this._$textField&&(this._$textField.focus=!1,this._$textField=null);break;case Ss:case Fs:this._$textField&&(this._$textField.focus=!1,this._$textField=null),this._$stage.hasEventListener(It.CLICK)&&this._$stage.dispatchEvent(new It(It.CLICK,!0,!1)),this._$stage.hasEventListener(It.MOUSE_UP)&&this._$stage.dispatchEvent(new It(It.MOUSE_UP,!0,!1));break;case Ms:case Cs:this._$stage.hasEventListener(It.MOUSE_MOVE)&&this._$stage.dispatchEvent(new It(It.MOUSE_MOVE,!0,!1));break;case Bs:this._$stage.hasEventListener(It.DOUBLE_CLICK)&&this._$stage.dispatchEvent(new It(It.DOUBLE_CLICK,!0,!1))}break;default:switch(e=this._$hitObject.hit,b){case Ms:case Cs:if(e.willTrigger(It.MOUSE_MOVE)&&e.dispatchEvent(new It(It.MOUSE_MOVE,!0,!1)),this._$mouseOverTarget&&this._$mouseOverTarget!==e){const t=this._$mouseOverTarget;t.willTrigger(It.MOUSE_OUT)&&t.dispatchEvent(new It(It.MOUSE_OUT,!0,!1))}if(this._$rollOverObject!==e){let t=null;if(this._$rollOverObject)for(i=this._$rollOverObject,i.willTrigger(It.ROLL_OUT)&&i.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),t=i._$parent;t&&t._$root!==t&&t!==e;){if(t._$mouseEnabled&&t._$outCheck(c,_)){let i=!1,s=e;for(;s&&s._$root!==s;){if(s===t){i=!0;break}s=s._$parent}if(!i&&t._$parent===e._$parent&&t._$index>e._$index&&(i=!0),i)break}t.willTrigger(It.ROLL_OUT)&&t.dispatchEvent(new It(It.ROLL_OUT,!1,!1)),t=t._$parent}for(i=e;i.willTrigger(It.ROLL_OVER)&&i.dispatchEvent(new It(It.ROLL_OVER,!1,!1)),i=i._$parent,i&&i!==t&&i.stage!==i;);}switch(this._$rollOverObject=e,!0){case null===this._$mouseOverTarget:case this._$mouseOverTarget!==e:e.willTrigger(It.MOUSE_OVER)&&e.dispatchEvent(new It(It.MOUSE_OVER,!0,!1)),this._$mouseOverTarget=e}"up"===this._$state&&(this._$clickTarget=null);break;case As:case ws:e.willTrigger(It.MOUSE_DOWN)&&e.dispatchEvent(new It(It.MOUSE_DOWN,!0,!1)),this._$clickTarget=e;break;case Ss:case Fs:this._$textField&&e!==this._$textField&&"_$text"in this._$textField&&(this._$textField.focus=!1,this._$textField=null),"_$text"in e&&(e.focus=!0,this._$textField=e),e.willTrigger(It.MOUSE_UP)&&e.dispatchEvent(new It(It.MOUSE_UP,!0,!1)),this._$clickTarget===e&&e.willTrigger(It.CLICK)&&e.dispatchEvent(new It(It.CLICK,!0,!1)),this._$clickTarget=null;break;case Rs:e.willTrigger(It.MOUSE_WHEEL)&&e.dispatchEvent(new It(It.MOUSE_WHEEL)),e.scrollEnabled&&("deltaX"in t&&(e.scrollX+=t.deltaX/(e.textWidth/e.width)),"deltaY"in t&&(e.scrollY+=t.deltaY/(e.textHeight/e.height)));break;case Bs:e.willTrigger(It.DOUBLE_CLICK)&&e.dispatchEvent(new It(It.DOUBLE_CLICK))}if(!g&&!Qs&&"up"===this._$state)for(i=e;i&&i.root!==i;){if("_$text"in i){if("input"===i.type){d=!0;break}}else if(i._$buttonMode){p=!0;break}i=i._$parent}}switch(!0){case d:this._$canvas.style.cursor="text";break;case p:this._$canvas.style.cursor="pointer";break;case!Qs&&"up"===this._$state:this._$canvas.style.cursor="auto"}!this._$actionProcess&&this._$actions.length>1&&this._$doAction(),m&&(this._$stage._$prepareActions(),this._$actionProcess||this._$doAction()),this._$hitTestStart=!1}}const fs={Event:wt,EventDispatcher:Ct,EventPhase:St,FocusEvent:Ft,HTTPStatusEvent:Rt,IOErrorEvent:Bt,MouseEvent:It,ProgressEvent:Lt,VideoEvent:Pt};Object.entries(fs).forEach((([t,e])=>{Object.defineProperty(fs,t,{get:()=>e})}));const ps={DisplayObject:Qt,InteractiveObject:Jt,DisplayObjectContainer:Zt,Sprite:ce,MovieClip:_e,BitmapData:te,BlendMode:class{static toString(){return"[class BlendMode]"}static get namespace(){return"next2d.display.BlendMode"}toString(){return"[object BlendMode]"}get namespace(){return"next2d.display.BlendMode"}static get ADD(){return"add"}static get ALPHA(){return"alpha"}static get DARKEN(){return"darken"}static get DIFFERENCE(){return"difference"}static get ERASE(){return"erase"}static get HARDLIGHT(){return"hardlight"}static get INVERT(){return"invert"}static get LAYER(){return"layer"}static get LIGHTEN(){return"lighten"}static get MULTIPLY(){return"multiply"}static get NORMAL(){return"normal"}static get OVERLAY(){return"overlay"}static get SCREEN(){return"screen"}static get SUBTRACT(){return"subtract"}},FrameLabel:ee,Graphics:re,Loader:$e,LoaderInfo:ne,Shape:ue,Stage:de,TextField:Mi};Object.entries(ps).forEach((([t,e])=>{Object.defineProperty(ps,t,{get:()=>e})}));const ms={BevelFilter:Gt,BlurFilter:Vt,ColorMatrixFilter:zt,ConvolutionFilter:Yt,DisplacementMapFilter:Xt,DropShadowFilter:qt,GlowFilter:Ht,GradientBevelFilter:jt,GradientGlowFilter:Wt};Object.entries(ms).forEach((([t,e])=>{Object.defineProperty(ms,t,{get:()=>e})}));const xs={ColorTransform:Ot,Matrix:Nt,Point:kt,Rectangle:Dt,Transform:Kt};Object.entries(xs).forEach((([t,e])=>{Object.defineProperty(xs,t,{get:()=>e})}));const bs={Sound:he,SoundMixer:ae,SoundTransform:oe,Video:le};Object.entries(bs).forEach((([t,e])=>{Object.defineProperty(bs,t,{get:()=>e})}));const vs={URLRequest:Mt,URLRequestHeader:g};Object.entries(vs).forEach((([t,e])=>{Object.defineProperty(vs,t,{get:()=>e})}));const Ts={TextFormat:me};Object.entries(Ts).forEach((([t,e])=>{Object.defineProperty(Ts,t,{get:()=>e})}));const ys={Easing:ge,Job:fe,Tween:pe};Object.entries(ys).forEach((([t,e])=>{Object.defineProperty(ys,t,{get:()=>e})}));const Es="__next2d__",As="touchstart",Ms="touchmove",Ss="touchend",ws="mousedown",Cs="mousemove",Fs="mouseup",Rs="wheel",Bs="dblclick",Is="mouseleave",Ls="scroll";let Ps=null;const Os=new Map;let ks=null;const Ns=t=>{ks=t},Ds={lock:!1,position:{x:0,y:0},bounds:null},Us=new Float32Array(256);new Float32Array(256);for(let t=0;t<256;++t)Us[t]=v.pow(t/255,2.23333333),Us[t]=t/255;const Vs=new Float32Array([1,0,0,1,0,0]),Gs=[],zs=[],Ys=[],Xs=new Map;let qs=!1,Hs=!1,js=!1,Ws=!1,Ks=!1,Qs=!1;const Js=u.createElement("canvas");Js.width=1,Js.height=1;const Zs=Js.getContext("2d");if(!Zs)throw new Error("the CanvasRenderingContext2D is null.");Zs.globalAlpha=0,Zs.imageSmoothingEnabled=!1;const tr=Zs,er=[],ir=[],sr=()=>er.length?er.pop():new Float32Array(64),rr=()=>ir.length?ir.pop():{command:""},nr=t=>{t.buffer=null,ir.push(t),console.log("renderMessageArray: ",ir)},ar=()=>$.next2d.player,hr=()=>{const t=o();if(!t)return new kt;const e=ar();let i=$.scrollX,s=$.scrollY;const r=u.getElementById(e.contentElementId);if(r){const t=r.getBoundingClientRect();i+=t.left,s+=t.top}let n=0,a=0;if("changedTouches"in t){const e=t.changedTouches[0];n=e.pageX,a=e.pageY}else"pageX"in t&&(n=t.pageX,a=t.pageY);const h=(n-i)/e._$scale-e.x/e._$scale/f,l=(a-s)/e._$scale-e.y/e._$scale/f;return new kt(h,l)},or=(t=1,e=0,i=0,s=1,r=0,n=0)=>{const a=zs.pop();return a?(a.setTo(t,e,i,s,r,n),a):new Nt(t,e,i,s,r,n)},lr=t=>{zs.push(t)},cr=(t=1,e=1,i=1,s=1,r=0,n=0,a=0,h=0)=>{const o=Ys.length?Ys.pop():null;return o?(o.redMultiplier=t,o.greenMultiplier=e,o.blueMultiplier=i,o.alphaMultiplier=s,o.redOffset=r,o.greenOffset=n,o.blueOffset=a,o.alphaOffset=h,o):new Ot(t,e,i,s,r,n,a,h)},_r=t=>{Ys.push(t)},$r=(t,e)=>{t._$character?t._$character.audioBuffer=e:t._$audioBuffer=e},ur=t=>{if(!Ps)throw new Error("the AudioContext is null.");let e=null;if(t._$character){const i=t._$character.buffer;i&&(e=new Uint8Array(i).buffer,at(i),t._$character.buffer=null)}else e=t._$arrayBuffer;return e?Ps.decodeAudioData(e).then((e=>($r(t,e),Promise.resolve(t)))).catch((()=>{if(!e)throw new Error;return((t,e)=>{if(!Ps)throw new Error("the Audio Context is null.");const i=new Uint8Array(e);let s=0;for(;s=i.indexOf(255,s),-1!==s&&224!=(224&i[s+1]);)++s;if(s>-1)return Ps.decodeAudioData(i.subarray(s).buffer).then((e=>($r(t,e),Promise.resolve(t)))).catch((()=>{throw new Error("This voice data is not available.")}));throw new Error("This voice data is not available.")})(t,e)})):Promise.resolve(t)},dr=()=>{if(Ps||(Ps=new AudioContext,Ps.resume()),Ps){const t=nt();for(let e=0;e<Gs.length;++e){const i=Gs[e];i._$character&&i._$character.audioBuffer&&t.push(Promise.resolve(i)),i._$audioBuffer&&t.push(Promise.resolve(i)),t.push(ur(i))}Promise.all(t).then((t=>{Gs.length=0,ar()._$loaders.push(...t)}))}};let gr=-1;const fr=()=>{const t=ar();if(t._$loadStatus===gs.LOAD_END){t._$resize();const e=t.stage;e.willTrigger(wt.RESIZE)&&e.dispatchEvent(new wt(wt.RESIZE))}};$.addEventListener("resize",(()=>{L(gr),gr=I(fr,300)}));const pr=t=>{let e=null;switch(t.method.toUpperCase()){case"GET":if(t.data){const e=t.url.split("?");e[1]=1===e.length?t.data.toString():`${e[1]}&${t.data.toString()}`,t.url=e.join("?")}break;case"PUT":case"POST":t.data&&(e=t.data.toString())}const i=new XMLHttpRequest;if(i.open(t.method,t.url,!0),i.responseType=t.format,i.withCredentials=t.withCredentials,t.event){const e=Object.keys(t.event);for(let s=0;s<e.length;++s){const r=e[s];i.addEventListener(r,t.event[r])}at(e)}for(let e=0;e<t.headers.length;++e){const s=t.headers[e];i.setRequestHeader(s.name,s.value)}i.send(e)},mr=t=>{const e=nt();if(t){const i=t.trim().split("\n"),s=i.length;for(let t=0;t<s;++t){const s=i[t].split(":");e.push(new g(`${s[0].trim()}`,`${s[1].trim()}`))}}return e},xr=new Map([["normal",1],["layer",2],["multiply",3],["screen",4],["lighten",5],["darken",6],["difference",7],["add",8],["subtract",9],["invert",10],["alpha",11],["erase",12],["overlay",13],["hardlight",14]]),br=t=>xr.has(t)&&xr.get(t)||1,vr=t=>{switch(t){case _e.namespace:return new _e;case ue.namespace:return new ue;case Mi.namespace:return new Mi;case ce.namespace:return new ce;case le.namespace:return new le}};let Tr=null,yr=null,Er=null;const Ar=URL.createObjectURL(new Blob(['(()=>{"use strict";var r=Uint8Array,n=Uint16Array,e=Int32Array,a=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),t=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),i=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(r,a){for(var t=new n(31),i=0;i<31;++i)t[i]=a+=1<<r[i-1];var o=new e(t[30]);for(i=1;i<30;++i)for(var f=t[i];f<t[i+1];++f)o[f]=f-t[i]<<5|i;return{b:t,r:o}},f=o(a,2),u=f.b,v=f.r;u[28]=258,v[258]=28;for(var c=o(t,0),l=c.b,d=(c.r,new n(32768)),s=0;s<32768;++s){var w=(43690&s)>>1|(21845&s)<<1;w=(61680&(w=(52428&w)>>2|(13107&w)<<2))>>4|(3855&w)<<4,d[s]=((65280&w)>>8|(255&w)<<8)>>1}var h=function(r,e,a){for(var t=r.length,i=0,o=new n(e);i<t;++i)r[i]&&++o[r[i]-1];var f,u=new n(e);for(i=1;i<e;++i)u[i]=u[i-1]+o[i-1]<<1;if(a){f=new n(1<<e);var v=15-e;for(i=0;i<t;++i)if(r[i])for(var c=i<<4|r[i],l=e-r[i],s=u[r[i]-1]++<<l,w=s|(1<<l)-1;s<=w;++s)f[d[s]>>v]=c}else for(f=new n(t),i=0;i<t;++i)r[i]&&(f[i]=d[u[r[i]-1]++]>>15-r[i]);return f},y=new r(288);for(s=0;s<144;++s)y[s]=8;for(s=144;s<256;++s)y[s]=9;for(s=256;s<280;++s)y[s]=7;for(s=280;s<288;++s)y[s]=8;var b=new r(32);for(s=0;s<32;++s)b[s]=5;var g=h(y,9,1),p=h(b,5,1),m=function(r){for(var n=r[0],e=1;e<r.length;++e)r[e]>n&&(n=r[e]);return n},k=function(r,n,e){var a=n/8|0;return(r[a]|r[a+1]<<8)>>(7&n)&e},x=function(r,n){var e=n/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(7&n)},T=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],z=function(r,n,e){var a=new Error(n||T[r]);if(a.code=r,Error.captureStackTrace&&Error.captureStackTrace(a,z),!e)throw a;return a},E=function(n,e,o,f){var v=n.length,c=f?f.length:0;if(!v||e.f&&!e.l)return o||new r(0);var d=!o||2!=e.i,s=e.i;o||(o=new r(3*v));var w,y=function(n){var e=o.length;if(n>e){var a=new r(Math.max(2*e,n));a.set(o),o=a}},b=e.f||0,T=e.p||0,E=e.b||0,M=e.l,S=e.d,U=e.m,A=e.n,C=8*v;do{if(!M){b=k(n,T,1);var q=k(n,T+1,3);if(T+=3,!q){var D=n[(w=T,(G=4+((w+7)/8|0))-4)]|n[G-3]<<8,F=G+D;if(F>v){s&&z(0);break}d&&y(E+D),o.set(n.subarray(G,F),E),e.b=E+=D,e.p=T=8*F,e.f=b;continue}if(1==q)M=g,S=p,U=9,A=5;else if(2==q){var I=k(n,T,31)+257,O=k(n,T+10,15)+4,J=I+k(n,T+5,31)+1;T+=14;for(var L=new r(J),N=new r(19),P=0;P<O;++P)N[i[P]]=k(n,T+3*P,7);T+=3*O;var R=m(N),j=(1<<R)-1,B=h(N,R,1);for(P=0;P<J;){var G,H=B[k(n,T,j)];if(T+=15&H,(G=H>>4)<16)L[P++]=G;else{var K=0,Q=0;for(16==G?(Q=3+k(n,T,3),T+=2,K=L[P-1]):17==G?(Q=3+k(n,T,7),T+=3):18==G&&(Q=11+k(n,T,127),T+=7);Q--;)L[P++]=K}}var V=L.subarray(0,I),W=L.subarray(I);U=m(V),A=m(W),M=h(V,U,1),S=h(W,A,1)}else z(1);if(T>C){s&&z(0);break}}d&&y(E+131072);for(var X=(1<<U)-1,Y=(1<<A)-1,Z=T;;Z=T){var $=(K=M[x(n,T)&X])>>4;if((T+=15&K)>C){s&&z(0);break}if(K||z(2),$<256)o[E++]=$;else{if(256==$){Z=T,M=null;break}var _=$-254;if($>264){var rr=a[P=$-257];_=k(n,T,(1<<rr)-1)+u[P],T+=rr}var nr=S[x(n,T)&Y],er=nr>>4;if(nr||z(3),T+=15&nr,W=l[er],er>3&&(rr=t[er],W+=x(n,T)&(1<<rr)-1,T+=rr),T>C){s&&z(0);break}d&&y(E+131072);var ar=E+_;if(E<W){var tr=c-W,ir=Math.min(W,ar);for(tr+E<0&&z(3);E<ir;++E)o[E]=f[tr+E]}for(;E<ar;E+=4)o[E]=o[E-W],o[E+1]=o[E+1-W],o[E+2]=o[E+2-W],o[E+3]=o[E+3-W];E=ar}}e.l=M,e.p=Z,e.b=E,e.f=b,M&&(b=1,e.m=U,e.d=S,e.n=A)}while(!b);return E==o.length?o:function(n,e,a){(null==e||e<0)&&(e=0),(null==a||a>n.length)&&(a=n.length);var t=new r(a-e);return t.set(n.subarray(e,a)),t}(o,0,E)},M=new r(0);function S(n,e){var a,t,i=function(r){31==r[0]&&139==r[1]&&8==r[2]||z(6,"invalid gzip data");var n=r[3],e=10;4&n&&(e+=2+(r[10]|r[11]<<8));for(var a=(n>>3&1)+(n>>4&1);a>0;a-=!r[e++]);return e+(2&n)}(n);return i+8>n.length&&z(6,"invalid gzip data"),E(n.subarray(i,-8),{i:2},e&&e.out||new r((t=(a=n).length,(a[t-4]|a[t-3]<<8|a[t-2]<<16|a[t-1]<<24)>>>0)),e&&e.dictionary)}function U(r,n){return E(r.subarray((e=r,a=n&&n.dictionary,(8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31)&&z(6,"invalid zlib data"),(e[1]>>5&1)==+!a&&z(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),2+(e[1]>>3&4)),-4),{i:2},n&&n.out,n&&n.dictionary);var e,a}var A="undefined"!=typeof TextDecoder&&new TextDecoder;try{A.decode(M,{stream:!0})}catch(r){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;self.addEventListener("message",(r=>{return n=void 0,e=void 0,t=function*(){const n=31==(e=r.data)[0]&&139==e[1]&&8==e[2]?S(e,a):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?function(r,n){return E(r,{i:2},n&&n.out,n&&n.dictionary)}(e,a):U(e,a);var e,a;let t="";for(let r=0;r<n.length;r+=4096)t+=String.fromCharCode(...n.slice(r,r+4096));self.postMessage(JSON.parse(decodeURIComponent(t)))},new((a=void 0)||(a=Promise))((function(r,i){function o(r){try{u(t.next(r))}catch(r){i(r)}}function f(r){try{u(t.throw(r))}catch(r){i(r)}}function u(n){var e;n.done?r(n.value):(e=n.value,e instanceof a?e:new a((function(r){r(e)}))).then(o,f)}u((t=t.apply(n,e||[])).next())}));var n,e,a,t}))})();'],{type:"text/javascript"})),Mr=[];let Sr=null;const wr=()=>(Sr||(Sr=new Worker(Ar)),Sr);let Cr=!1;const Fr=t=>{Cr=t},Rr=()=>Cr,Br=()=>{if("OffscreenCanvas"in window){const t=new OffscreenCanvas(0,0).getContext("webgl2");Tr=null!==t?new Worker(URL.createObjectURL(new Blob(['(()=>{"use strict";let t=1,e=0,i=!1;const s=1/0,r=Math,n=Array,a=Map,h=Number,o=Float32Array,_=Int32Array,l=Int16Array,c=OffscreenCanvas,$=isNaN,u=requestAnimationFrame,d=setTimeout,g=clearTimeout,f=new o([1,0,0,1,0,0]),m=new o([1,1,1,1,0,0,0,0]),p=r.PI/180,x=(r.PI,[]),b=[],v=[],T=[],A=[],M=[],y=[],E=[],C=new c(1,1).getContext("2d"),S=(t=0,e=0,i=0,s=0)=>{const r=E.pop()||{xMin:0,xMax:0,yMin:0,yMax:0};return r.xMin=t,r.xMax=e,r.yMin=i,r.yMax=s,r},F=t=>{E.push(t)},B=(t=0,e=0,i=0,s=0)=>{const r=b.pop()||new o(4);return r[0]=t,r[1]=e,r[2]=i,r[3]=s,r},w=t=>{b.push(t)},R=(t=0,e=0,i=0,s=0,r=0,n=0)=>{const a=v.pop()||new o(6);return a[0]=t,a[1]=e,a[2]=i,a[3]=s,a[4]=r,a[5]=n,a},I=t=>{v.push(t)},P=(t=1,e=1,i=1,s=1,r=0,n=0,a=0,h=0)=>{const _=T.pop()||new o(8);return _[0]=t,_[1]=e,_[2]=i,_[3]=s,_[4]=r,_[5]=n,_[6]=a,_[7]=h,_},N=t=>{T.push(t)},k=(t=0,e=0,i=0,s=0,r=0,n=0,a=0,h=0,_=0)=>{const l=A.pop()||new o(9);return l[0]=t,l[1]=e,l[2]=i,l[3]=s,l[4]=r,l[5]=n,l[6]=a,l[7]=h,l[8]=_,l},L=(...t)=>{const e=M.pop()||[];return t.length&&e.push(...t),e},O=(t=null)=>{t&&(t.length&&(t.length=0),M.push(t))},U=t=>{t.size&&t.clear(),y.push(t)},D=()=>y.pop()||new a,X=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t),V=t=>{const e=1/(t[0]*t[4]-t[3]*t[1]),i=t[3]*t[7]-t[4]*t[6],s=t[1]*t[6]-t[0]*t[7];return k(t[4]*e,0-t[1]*e,0,0-t[3]*e,t[0]*e,0,i*e,s*e,1)},Y=(t,e,i,s=null)=>{const n=+t;return $(n)&&null!==s?s:r.min(r.max(e,$(n)?0:n),i)},z=(t,e)=>R(t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]),G=(t,e)=>P(t[0]*e[0],t[1]*e[1],t[2]*e[2],t[3]*e[3],t[0]*e[4]+t[4],t[1]*e[5]+t[5],t[2]*e[6]+t[6],t[3]*e[7]+t[7]),H=(t,e)=>{const i=t.xMax*e[0]+t.yMax*e[2]+e[4],s=t.xMax*e[0]+t.yMin*e[2]+e[4],n=t.xMin*e[0]+t.yMax*e[2]+e[4],a=t.xMin*e[0]+t.yMin*e[2]+e[4],o=t.xMax*e[1]+t.yMax*e[3]+e[5],_=t.xMax*e[1]+t.yMin*e[3]+e[5],l=t.xMin*e[1]+t.yMax*e[3]+e[5],c=t.xMin*e[1]+t.yMin*e[3]+e[5],$=r.min(h.MAX_VALUE,i,s,n,a),u=r.max(0-h.MAX_VALUE,i,s,n,a),d=r.min(h.MAX_VALUE,o,_,l,c),g=r.max(0-h.MAX_VALUE,o,_,l,c);return S($,u,d,g)},W=t=>$(+t)?(t=>{if(!C)return 0;C.fillStyle=t;const e=+`0x${C.fillStyle.slice(1)}`;return C.fillStyle="rgba(0, 0, 0, 1)",e})(`${t}`):+t,q=(t,e,i)=>(t>>16)*(i?e:1)/255,j=(t,e,i)=>(t>>8&255)*(i?e:1)/255,K=(t,e,i)=>(255&t)*(i?e:1)/255,Q=(t,e=1)=>({R:(16711680&t)>>16,G:(65280&t)>>8,B:255&t,A:255*e}),J=(t,e,i=!1,s=!1)=>{let r="";return i&&(r="italic "),s&&(r+="bold "),`${r}${e}px \'${t}\',\'sans-serif\'`},Z=t=>{t.color&&N(t.color),t.isLayer=!1,t.isUpdated=null,t.canApply=null,t.matrix=null,t.color=null,t.filters=null,t.blendMode="normal",t.sw=0,t.sh=0,x.push(t)},tt=new Map([[1,"normal"],[2,"layer"],[3,"multiply"],[4,"screen"],[5,"lighten"],[6,"darken"],[7,"difference"],[8,"add"],[9,"subtract"],[10,"invert"],[11,"alpha"],[12,"erase"],[13,"overlay"],[14,"hardlight"]]),et=t=>tt.has(t)&&tt.get(t)||"normal",it=new class{constructor(){this._$pool=[],this._$store=new Map,this._$timerMap=new Map,this._$context=null}set context(t){this._$context=t}reset(){for(const t of this._$store.values()){for(const e of t.values())this.destroy(e);U(t)}this._$store.clear(),this._$context&&this._$context.frameBuffer.clearCache()}destroy(t=null){if(t&&"object"==typeof t)if(t instanceof WebGLTexture)u((()=>{this._$context&&this._$context.frameBuffer.releaseTexture(t)}));else{if("canvas"in t&&t instanceof CanvasRenderingContext2D){const e=t.canvas,i=e.width,s=e.height;t.clearRect(0,0,i+1,s+1),e.width=e.height=1,this._$pool.push(e)}this._$context&&"index"in t&&this._$context.frameBuffer.textureManager.releasePosition(t)}}getCanvas(){return this._$pool.pop()||document.createElement("canvas")}remove(t,e){if(!this._$store.has(t))return;const i=this._$store.get(t);i.has(e)&&(i.delete(e),i.size||(U(i),this._$store.delete(t)))}stopTimer(t){t=`${t}`,this._$timerMap.has(t)&&(g(this._$timerMap.get(t)),this._$timerMap.delete(t))}removeCache(t){if(t=`${t}`,this._$store.has(t)){const e=this._$store.get(t);for(const t of e.values())this.destroy(t);e.clear(),U(e),this._$store.delete(t)}this._$timerMap.delete(t)}setRemoveTimer(t){if(t=`${t}`,this.stopTimer(t),this._$store.has(t)){const e=d((()=>{this.removeCache(t)}),5e3);this._$timerMap.set(t,e)}}get(t){const e=`${t[0]}`,i=`${t[1]}`;if(this._$store.has(e)){this.stopTimer(e);const t=this._$store.get(e);if(t.has(i))return t.get(i)}return null}set(t,e=null){const i=`${t[0]}`,s=`${t[1]}`;this._$store.has(i)||this._$store.set(i,D());const r=this._$store.get(i);if(null===e){if(!r.has(s))return;return this.destroy(r.get(s)),r.delete(s),void(r.size||(U(r),this._$store.delete(i)))}r.set(s,e)}has(t){const e=`${t[0]}`;return!!this._$store.has(e)&&this._$store.get(e).has(`${t[1]}`)}generateKeys(t,e=null,i=null){let s="";e&&e.length&&(s+=`${e[0]}_${e[1]}`),i&&i.length&&(s+=0===i[7]?"":`_${i[7]}`);const r=L();if(s){let t=0;const e=s.length;for(let i=0;i<e;i++)t=(t<<5)-t+s.charCodeAt(i),t|=0;r[1]=`_${t}`}else r[1]="_0";return r[0]=`${t}`,r}};class st{constructor(){this._$updated=!0}static toString(){return"[class BitmapFilter]"}static get namespace(){return"next2d.filters.BitmapFilter"}toString(){return"[object BitmapFilter]"}get namespace(){return"next2d.filters.BitmapFilter"}_$isUpdated(){return this._$updated}_$doChanged(){this._$updated=!0,((t=!0)=>{i=t})()}}class rt extends st{constructor(t=4,e=4,i=1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this.blurX=t,this.blurY=e,this.quality=i}static toString(){return"[class BlurFilter]"}static get namespace(){return"next2d.filters.BlurFilter"}toString(){return"[object BlurFilter]"}get namespace(){return"next2d.filters.BlurFilter"}static get STEP(){return[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5]}get blurX(){return this._$blurX}set blurX(t){(t=Y(+t,0,255,0))!==this._$blurX&&(this._$blurX=t,this._$doChanged())}get blurY(){return this._$blurY}set blurY(t){(t=Y(+t,0,255,0))!==this._$blurY&&(this._$blurY=t,this._$doChanged())}get quality(){return this._$quality}set quality(t){(t=Y(0|t,0,15,1))!==this._$quality&&(this._$quality=t,this._$doChanged())}clone(){return new rt(this._$blurX,this._$blurY,this._$quality)}_$toArray(){return L(1,this._$blurX,this._$blurY,this._$quality)}_$generateFilterRect(t,e=0,i=0){const s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$quality)return s;const n=rt.STEP[this._$quality-1];let a=0>=this._$blurX?1:this._$blurX*n,h=0>=this._$blurY?1:this._$blurY*n;return e?a*=e:a=r.round(a),i?h*=i:h=r.round(h),s.xMin-=a,s.xMax+=2*a,s.yMin-=h,s.yMax+=2*h,s}_$canApply(){return 0!==this._$blurX&&0!==this._$blurY}_$applyFilter(e,i,s=!0){this._$updated=!1;const n=e.frameBuffer,a=n.currentAttachment,h=n.getTextureFromCurrentAttachment();if(!this._$canApply())return s?h:n.createTextureFromCurrentAttachment();let o=r.sqrt(i[0]*i[0]+i[1]*i[1]),_=r.sqrt(i[2]*i[2]+i[3]*i[3]);o/=t,_/=t,o*=2,_*=2;const l=S(0,h.width,0,h.height),c=this._$generateFilterRect(l,o,_);F(l);const $=0|r.ceil(c.xMax),u=0|r.ceil(c.yMax),d=r.ceil(r.abs(c.xMin)+.5*r.abs($-c.xMax)),g=r.ceil(r.abs(c.yMin)+.5*r.abs(u-c.yMax));e._$offsetX=d+e._$offsetX,e._$offsetY=g+e._$offsetY;const f=this._$blurX*o,m=this._$blurY*_;let p=1,x=1;f>128?p=.0625:f>64?p=.125:f>32?p=.25:f>16&&(p=.5),m>128?x=.0625:m>64?x=.125:m>32?x=.25:m>16&&(x=.5);const b=f*p,v=m*x,T=r.ceil($*p),A=r.ceil(u*x),M=n.createTextureAttachment(T,A),y=[M,n.createTextureAttachment(T,A)];let E=0;e._$bind(M),e.reset(),e.setTransform(p,0,0,x,0,0),e.drawImage(h,d,g,h.width,h.height),e.blend.toOneZero();let C=n.getTextureFromCurrentAttachment();for(let t=0;t<this._$quality;++t){if(this._$blurX>0){E=(E+1)%2;const t=y[E];e._$bind(t),e._$applyBlurFilter(C,!0,b),C=n.getTextureFromCurrentAttachment()}if(this._$blurY>0){E=(E+1)%2;const t=y[E];e._$bind(t),e._$applyBlurFilter(C,!1,v),C=n.getTextureFromCurrentAttachment()}}if(e.blend.reset(),1!==p||1!==x){const t=n.createTextureAttachment($,u);e._$bind(t),e.reset(),e.imageSmoothingEnabled=!0,e.setTransform(1/p,0,0,1/x,0,0),e.drawImage(C,0,0,T,A),C=n.getTextureFromCurrentAttachment(),e.reset(),e.setTransform(1,0,0,1,0,0),n.releaseAttachment(y[0],!0),n.releaseAttachment(y[1],!0),s?n.releaseAttachment(a,!0):n.releaseAttachment(t,!1)}else n.releaseAttachment(y[(E+1)%2],!0),s?n.releaseAttachment(a,!0):n.releaseAttachment(y[E],!1);return C}}class nt extends st{constructor(t=4,e=45,i=16777215,s=1,r=0,n=1,a=4,h=4,o=1,_=1,l="inner",c=!1){super(),this._$blurFilter=new rt(a,h,_),this._$distance=4,this._$angle=45,this._$highlightColor=16777215,this._$highlightAlpha=1,this._$shadowColor=0,this._$shadowAlpha=1,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.highlightColor=i,this.highlightAlpha=s,this.shadowColor=r,this.shadowAlpha=n,this.strength=o,this.type=l,this.knockout=c}static toString(){return"[class BevelFilter]"}static get namespace(){return"next2d.filters.BevelFilter"}toString(){return"[object BevelFilter]"}get namespace(){return"next2d.filters.BevelFilter"}get angle(){return this._$angle}set angle(t){(t%=360)!==this._$angle&&(this._$angle=Y(t,-360,360,45),this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get distance(){return this._$distance}set distance(t){(t=Y(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get highlightAlpha(){return this._$highlightAlpha}set highlightAlpha(t){(t=Y(+t,0,1,0))!==this._$highlightAlpha&&(this._$highlightAlpha=t,this._$doChanged())}get highlightColor(){return this._$highlightColor}set highlightColor(t){(t=Y(W(t),0,16777215,16777215))!==this._$highlightColor&&(this._$highlightColor=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get shadowAlpha(){return this._$shadowAlpha}set shadowAlpha(t){(t=Y(+t,0,1,0))!==this._$shadowAlpha&&(this._$shadowAlpha=t,this._$doChanged())}get shadowColor(){return this._$shadowColor}set shadowColor(t){(t=Y(W(t),0,16777215,0))!==this._$shadowColor&&(this._$shadowColor=t,this._$doChanged())}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){(t=`${t}`)!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new nt(this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return L(0,this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const n=this._$angle*p;let a=r.abs(r.cos(n)*this._$distance),h=r.abs(r.sin(n)*this._$distance);return e&&(a*=e),i&&(h*=i),s.xMin=r.min(s.xMin,a),a>0&&(s.xMax+=a),s.yMin=r.min(s.yMin,h),h>0&&(s.yMax+=h),s}_$canApply(){return this._$strength>0&&0!==this._$distance&&this._$blurFilter._$canApply()}_$applyFilter(e,i){this._$updated=!1;const s=e.frameBuffer,n=s.currentAttachment;if(!n)throw new Error("the current attachment is null.");e.setTransform(1,0,0,1,0,0);const a=s.getTextureFromCurrentAttachment();if(!this._$canApply())return a;const h=n.width,o=n.height,_=e._$offsetX,l=e._$offsetY;let c=r.sqrt(i[0]*i[0]+i[1]*i[1]),$=r.sqrt(i[2]*i[2]+i[3]*i[3]);c/=t,$/=t,c*=2,$*=2;const u=this._$angle*p,d=r.cos(u)*this._$distance*c,g=r.sin(u)*this._$distance*$,f=s.createTextureAttachment(h,o);e._$bind(f),e.reset(),e.drawImage(a,0,0,h,o),e.globalCompositeOperation="erase",e.drawImage(a,2*d,2*g,h,o);const m=this._$blurFilter._$applyFilter(e,i,!1),x=m.width,b=m.height,v=r.ceil(x+2*r.abs(d)),T=r.ceil(b+2*r.abs(g)),A="inner"===this._$type,M=A?h:v,y=A?o:T,E=r.abs(d),C=r.abs(g),S=(x-h)/2,F=(b-o)/2,B=A?0:E+S,w=A?0:C+F,R=A?-S-d:E-d,I=A?-F-g:C-g;return e._$bind(n),s.releaseAttachment(f,!0),e._$applyBitmapFilter(m,M,y,h,o,B,w,x,b,R,I,!1,this._$type,this._$knockout,this._$strength,null,null,null,q(this._$highlightColor,this._$highlightAlpha,!0),j(this._$highlightColor,this._$highlightAlpha,!0),K(this._$highlightColor,this._$highlightAlpha,!0),this._$highlightAlpha,q(this._$shadowColor,this._$shadowAlpha,!0),j(this._$shadowColor,this._$shadowAlpha,!0),K(this._$shadowColor,this._$shadowAlpha,!0),this._$shadowAlpha),e._$offsetX=_+B,e._$offsetY=l+w,s.releaseTexture(m),s.getTextureFromCurrentAttachment()}}class at extends st{constructor(t=null){super(),this._$matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix=t}static toString(){return"[class ColorMatrixFilter]"}static get namespace(){return"next2d.filters.ColorMatrixFilter"}toString(){return"[object ColorMatrixFilter]"}get namespace(){return"next2d.filters.ColorMatrixFilter"}get matrix(){return this._$matrix}set matrix(t){if(t&&n.isArray(t)&&20===t.length){for(let e=0;e<20;++e)if(t[e]!==this._$matrix[e]){this._$doChanged();break}this._$matrix=t}}clone(){return new at(this._$matrix)}_$toArray(){return L(2,this._$matrix)}_$generateFilterRect(t){return t}_$canApply(){return!0}_$applyFilter(t){this._$updated=!1;const e=t.frameBuffer,i=e.currentAttachment;t.setTransform(1,0,0,1,0,0);const s=e.getTextureFromCurrentAttachment(),r=s.width,n=s.height,a=e.createTextureAttachment(r,n);return t._$bind(a),t.reset(),t._$applyColorMatrixFilter(s,this._$matrix),e.releaseAttachment(i,!0),e.getTextureFromCurrentAttachment()}}class ht extends st{constructor(t=0,e=0,i=null,s=1,r=0,n=!0,a=!0,h=0,o=0){super(),this._$matrixX=0,this._$matrixY=0,this._$matrix=null,this._$divisor=1,this._$bias=0,this._$preserveAlpha=!0,this._$clamp=!0,this._$color=0,this._$alpha=0,this.matrixX=t,this.matrixY=e,this.matrix=i,this.divisor=s,this.bias=r,this.preserveAlpha=n,this.clamp=a,this.color=h,this.alpha=o}static toString(){return"[class ConvolutionFilter]"}static get namespace(){return"next2d.filters.ConvolutionFilter"}toString(){return"[object ConvolutionFilter]"}get namespace(){return"next2d.filters.ConvolutionFilter"}get alpha(){return this._$alpha}set alpha(t){(t=Y(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get bias(){return this._$bias}set bias(t){t!==this._$bias&&(this._$bias=0|t,this._$doChanged())}get clamp(){return this._$clamp}set clamp(t){t!==this._$clamp&&(this._$clamp=!!t,this._$doChanged())}get color(){return this._$color}set color(t){(t=Y(W(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get divisor(){return this._$divisor}set divisor(t){t!==this._$divisor&&(this._$divisor=0|t,this._$doChanged())}get matrix(){return this._$matrix}set matrix(t){n.isArray(this._$matrix)&&O(this._$matrix),this._$matrix=n.isArray(t)?t:null,this._$doChanged()}get matrixX(){return this._$matrixX}set matrixX(t){(t=0|Y(0|t,0,15,0))!==this._$matrixX&&(this._$matrixX=t,this._$doChanged())}get matrixY(){return this._$matrixY}set matrixY(t){(t=0|Y(0|t,0,15,0))!==this._$matrixY&&(this._$matrixY=t,this._$doChanged())}get preserveAlpha(){return this._$preserveAlpha}set preserveAlpha(t){t!==this._$preserveAlpha&&(this._$preserveAlpha=!!t,this._$doChanged())}clone(){return new ht(this._$matrixX,this._$matrixY,this._$matrix?this._$matrix.slice():null,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}_$toArray(){return L(3,this._$matrixX,this._$matrixY,this._$matrix,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}_$generateFilterRect(t){return t}_$canApply(){return null!==this._$matrix&&this._$matrixX*this._$matrixY===this._$matrix.length}_$applyFilter(t){this._$updated=!1;const e=t.frameBuffer,i=e.currentAttachment;t.setTransform(1,0,0,1,0,0);const s=e.getTextureFromCurrentAttachment();return this._$canApply()&&this._$matrix?(t._$applyConvolutionFilter(s,this._$matrixX,this._$matrixY,this._$matrix,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,q(this._$color,this._$alpha,!1),j(this._$color,this._$alpha,!1),K(this._$color,this._$alpha,!1),this._$alpha),e.releaseAttachment(i,!0),e.getTextureFromCurrentAttachment()):s}}class ot extends st{constructor(t=null,e=null,i=0,s=0,r=0,n=0,a="wrap",h=0,o=0){super(),this._$mapBitmap=null,this._$mapPoint=null,this._$componentX=0,this._$componentY=0,this._$scaleX=0,this._$scaleY=0,this._$mode="wrap",this._$color=0,this._$alpha=0,this.mapBitmap=t,this.mapPoint=e,this.componentX=i,this.componentY=s,this.scaleX=r,this.scaleY=n,this.mode=a,this.color=h,this.alpha=o}static toString(){return"[class DisplacementMapFilter]"}static get namespace(){return"next2d.filters.DisplacementMapFilter"}toString(){return"[object DisplacementMapFilter]"}get namespace(){return"next2d.filters.DisplacementMapFilter"}get alpha(){return this._$alpha}set alpha(t){(t=Y(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get color(){return this._$color}set color(t){(t=Y(W(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get componentX(){return this._$componentX}set componentX(t){t!==this._$componentX&&(this._$componentX=t,this._$doChanged())}get componentY(){return this._$componentY}set componentY(t){t!==this._$componentY&&(this._$componentY=t,this._$doChanged())}get mapBitmap(){return this._$mapBitmap}set mapBitmap(t){t!==this._$mapBitmap&&(this._$mapBitmap=t,this._$doChanged())}get mapPoint(){return this._$mapPoint}set mapPoint(t){t!==this._$mapPoint&&(this._$mapPoint=t,this._$doChanged())}get mode(){return this._$mode}set mode(t){t!==this._$mode&&(this._$mode=t,this._$doChanged())}get scaleX(){return this._$scaleX}set scaleX(t){(t=Y(+t,-65535,65535,0))!==this._$scaleX&&(this._$scaleX=t,this._$doChanged())}get scaleY(){return this._$scaleY}set scaleY(t){(t=Y(+t,-65535,65535,0))!==this._$scaleY&&(this._$scaleY=t,this._$doChanged())}clone(){return new ot(this._$mapBitmap,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}_$toArray(){return L(4,this._$mapBitmap,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}_$generateFilterRect(t){return t}_$canApply(){return null!==this._$mapBitmap&&this._$componentX>0&&this._$componentY>0&&0!==this._$scaleX&&0!==this._$scaleY}_$applyFilter(t,e){this._$updated=!1;const i=t.frameBuffer,s=i.currentAttachment;t.setTransform(1,0,0,1,0,0);const n=i.getTextureFromCurrentAttachment();if(!this._$canApply()||!s||!this._$mapBitmap)return n;const a=r.sqrt(e[0]*e[0]+e[1]*e[1]),h=r.sqrt(e[2]*e[2]+e[3]*e[3]);return t._$applyDisplacementMapFilter(n,this._$mapBitmap,n.width/a,n.height/h,this._$mapPoint,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,q(this._$color,this._$alpha,!0),j(this._$color,this._$alpha,!0),K(this._$color,this._$alpha,!0),this._$alpha),i.releaseAttachment(s,!0),i.getTextureFromCurrentAttachment()}}class _t extends st{constructor(t=4,e=45,i=0,s=1,r=4,n=4,a=1,h=1,o=!1,_=!1,l=!1){super(),this._$blurFilter=new rt(r,n,h),this._$distance=4,this._$angle=45,this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this._$hideObject=!1,this.distance=t,this.angle=e,this.color=i,this.alpha=s,this.strength=a,this.inner=o,this.knockout=_,this.hideObject=l}static toString(){return"[class DropShadowFilter]"}static get namespace(){return"next2d.filters.DropShadowFilter"}toString(){return"[object DropShadowFilter]"}get namespace(){return"next2d.filters.DropShadowFilter"}get alpha(){return this._$alpha}set alpha(t){(t=Y(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get angle(){return this._$angle}set angle(t){(t%=360)!==this._$angle&&(this._$angle=Y(t,-360,360,45),this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get color(){return this._$color}set color(t){(t=Y(W(t),0,16777215,0))!==this._$color&&(this._$color=t,this._$doChanged())}get distance(){return this._$distance}set distance(t){(t=Y(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get hideObject(){return this._$hideObject}set hideObject(t){t!==this._$hideObject&&(this._$hideObject=!!t,this._$doChanged())}get inner(){return this._$inner}set inner(t){t!==this._$inner&&(this._$inner=!!t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}clone(){return new _t(this._$distance,this._$angle,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout,this._$hideObject)}_$toArray(){return L(5,this._$distance,this._$angle,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout,this._$hideObject)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const n=this._$angle*p;let a=r.cos(n)*this._$distance,h=r.sin(n)*this._$distance;return e&&(a*=e),i&&(h*=i),s.xMin=r.min(s.xMin,a),a>0&&(s.xMax+=a),s.yMin=r.min(s.yMin,h),h>0&&(s.yMax+=h),s}_$canApply(){return this._$alpha>0&&this._$strength>0&&this._$blurFilter._$canApply()}_$applyFilter(e,i){const s=e.frameBuffer,n=s.currentAttachment;if(!n)throw new Error("the current attachment is null.");if(e.setTransform(1,0,0,1,0,0),!this._$canApply())return s.getTextureFromCurrentAttachment();const a=n.width,h=n.height,o=e._$offsetX,_=e._$offsetY,l=this._$blurFilter._$applyFilter(e,i,!1),c=l.width,$=l.height,u=e._$offsetX,d=e._$offsetY,g=u-o,f=d-_;let m=r.sqrt(i[0]*i[0]+i[1]*i[1]),x=r.sqrt(i[2]*i[2]+i[3]*i[3]);m/=t,x/=t,m*=2,x*=2;const b=this._$angle*p,v=r.cos(b)*this._$distance*m,T=r.sin(b)*this._$distance*x,A=this._$inner?a:c+r.max(0,r.abs(v)-g),M=this._$inner?h:$+r.max(0,r.abs(T)-f),y=r.ceil(A),E=r.ceil(M),C=(y-A)/2,S=(E-M)/2,F=this._$inner?0:r.max(0,g-v)+C,B=this._$inner?0:r.max(0,f-T)+S,w=this._$inner?v-u:(v>0?r.max(0,v-g):0)+C,R=this._$inner?T-d:(T>0?r.max(0,T-f):0)+S;let I,P;return this._$inner?(I="inner",P=this._$knockout||this._$hideObject):!this._$knockout&&this._$hideObject?(I="full",P=!0):(I="outer",P=this._$knockout),e._$bind(n),e._$applyBitmapFilter(l,y,E,a,h,F,B,c,$,w,R,!0,I,P,this._$strength,null,null,null,q(this._$color,this._$alpha,!0),j(this._$color,this._$alpha,!0),K(this._$color,this._$alpha,!0),this._$alpha,0,0,0,0),e._$offsetX=o+F,e._$offsetY=_+B,s.releaseTexture(l),s.getTextureFromCurrentAttachment()}}class lt extends st{constructor(t=0,e=1,i=4,s=4,r=1,n=1,a=!1,h=!1){super(),this._$blurFilter=new rt(i,s,n),this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this.color=t,this.alpha=e,this.strength=r,this.inner=a,this.knockout=h}static toString(){return"[class GlowFilter]"}static get namespace(){return"next2d.filters.GlowFilter"}toString(){return"[object GlowFilter]"}get namespace(){return"next2d.filters.GlowFilter"}get alpha(){return this._$alpha}set alpha(t){(t=Y(+t,0,1,0))!==this._$alpha&&(this._$alpha=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get color(){return this._$color}set color(t){(t=Y(W(t),0,16777215,4))!==this._$color&&(this._$color=t,this._$doChanged())}get inner(){return this._$inner}set inner(t){t!==this._$inner&&(this._$inner=!!t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}clone(){return new lt(this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout)}_$toArray(){return L(6,this._$color,this._$alpha,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$inner,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){const s=S(t.xMin,t.xMax,t.yMin,t.yMax);return this._$canApply()?this._$blurFilter._$generateFilterRect(s,e,i):s}_$canApply(){return this._$alpha>0&&this._$strength>0&&this._$blurFilter._$canApply()}_$applyFilter(t,e){const i=t.frameBuffer,s=i.currentAttachment;if(!s)throw new Error("the current attachment is null.");if(this._$updated=!1,t.setTransform(1,0,0,1,0,0),!this._$canApply())return i.getTextureFromCurrentAttachment();const r=s.width,n=s.height,a=t._$offsetX,h=t._$offsetY,o=this._$blurFilter._$applyFilter(t,e,!1),_=o.width,l=o.height,c=t._$offsetX,$=t._$offsetY,u=this._$inner?r:_,d=this._$inner?n:l,g=this._$inner?0:c-a,f=this._$inner?0:$-h,m=this._$inner?-c:0,p=this._$inner?-$:0,x=this._$inner?"inner":"outer";return t._$bind(s),t._$applyBitmapFilter(o,u,d,r,n,g,f,_,l,m,p,!0,x,this._$knockout,this._$strength,null,null,null,q(this._$color,this._$alpha,!0),j(this._$color,this._$alpha,!0),K(this._$color,this._$alpha,!0),this._$alpha,0,0,0,0),t._$offsetX=a+g,t._$offsetY=h+f,i.releaseTexture(o),i.getTextureFromCurrentAttachment()}}class ct extends st{constructor(t=4,e=45,i=null,s=null,r=null,n=4,a=4,h=1,o=1,_="inner",l=!1){super(),this._$blurFilter=new rt(n,a,o),this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.colors=i,this.alphas=s,this.ratios=r,this.strength=h,this.type=_,this.knockout=l}static toString(){return"[class GradientBevelFilter]"}static get namespace(){return"next2d.filters.GradientBevelFilter"}toString(){return"[object GradientBevelFilter]"}get namespace(){return"next2d.filters.GradientBevelFilter"}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(this._$alphas=t,n.isArray(t)){for(let e=0;e<t.length;++e){const i=t[e];t[e]=Y(+i,0,1,0)}this._$alphas=t}this._$doChanged()}}get angle(){return this._$angle}set angle(t){(t=Y(t%360,-360,360,45))!==this._$angle&&(this._$angle=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(this._$colors=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(W(t[e]),0,16777215,0);this._$colors=t}this._$doChanged()}}get distance(){return this._$distance}set distance(t){(t=Y(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(this._$ratios=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(+t[e],0,255,0);this._$ratios=t}this._$doChanged()}}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new ct(this._$distance,this._$angle,this._$colors?this._$colors.slice():null,this._$alphas?this._$alphas.slice():null,this._$ratios?this._$ratios.slice():null,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return L(7,this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const n=this._$angle*p;let a=r.abs(r.cos(n)*this._$distance),h=r.abs(r.sin(n)*this._$distance);return e&&(a*=e),i&&(h*=i),s.xMin=r.min(s.xMin,a),a>0&&(s.xMax+=a),s.yMin=r.min(s.yMin,h),h>0&&(s.yMax+=h),s}_$canApply(){return this._$strength>0&&this._$distance>0&&null!==this._$alphas&&null!==this._$ratios&&null!==this._$colors&&this._$blurFilter._$canApply()}_$applyFilter(e,i){this._$updated=!1;const s=e.frameBuffer,n=s.currentAttachment;e.setTransform(1,0,0,1,0,0);const a=s.getTextureFromCurrentAttachment();if(!this._$canApply()||!n)return a;const h=n.width,o=n.height,_=e._$offsetX,l=e._$offsetY;let c=r.sqrt(i[0]*i[0]+i[1]*i[1]),$=r.sqrt(i[2]*i[2]+i[3]*i[3]);c/=t,$/=t,c*=2,$*=2;const u=+this._$angle*p,d=+r.cos(u)*this._$distance*c,g=+r.sin(u)*this._$distance*$,f=s.createTextureAttachment(h,o);e._$bind(f),e.reset(),e.drawImage(a,0,0,h,o),e.globalCompositeOperation="erase",e.drawImage(a,2*d,2*g,h,o);const m=this._$blurFilter._$applyFilter(e,i,!1),x=m.width,b=m.height,v=r.ceil(x+2*r.abs(d)),T=r.ceil(b+2*r.abs(g)),A="inner"===this._$type,M=A?h:v,y=A?o:T,E=r.abs(d),C=r.abs(g),S=(x-h)/2,F=(b-o)/2,B=A?0:E+S,w=A?0:C+F,R=A?-S-d:E-d,I=A?-F-g:C-g;return e._$bind(n),e._$applyBitmapFilter(m,M,y,h,o,B,w,x,b,R,I,!1,this._$type,this._$knockout,this._$strength,this._$ratios,this._$colors,this._$alphas,0,0,0,0,0,0,0,0),e._$offsetX=_+B,e._$offsetY=l+w,s.releaseAttachment(f,!0),s.getTextureFromCurrentAttachment()}}class $t extends st{constructor(t=4,e=45,i=null,s=null,r=null,n=4,a=4,h=1,o=1,_="inner",l=!1){super(),this._$blurFilter=new rt(n,a,o),this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.distance=t,this.angle=e,this.colors=i,this.alphas=s,this.ratios=r,this.strength=h,this.type=_,this.knockout=l}static toString(){return"[class GradientGlowFilter]"}static get namespace(){return"next2d.filters.GradientGlowFilter"}toString(){return"[object GradientGlowFilter]"}get namespace(){return"next2d.filters.GradientGlowFilter"}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(this._$alphas=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(+t[e],0,1,0);this._$alphas=t}this._$doChanged()}}get angle(){return this._$angle}set angle(t){(t=Y(t%360,-360,360,45))!==this._$angle&&(this._$angle=t,this._$doChanged())}get blurX(){return this._$blurFilter.blurX}set blurX(t){this._$blurFilter.blurX=t}get blurY(){return this._$blurFilter.blurY}set blurY(t){this._$blurFilter.blurY=t}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(this._$colors=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(W(t[e]),0,16777215,0);this._$colors=t}this._$doChanged()}}get distance(){return this._$distance}set distance(t){(t=Y(+t,-255,255,4))!==this._$distance&&(this._$distance=t,this._$doChanged())}get knockout(){return this._$knockout}set knockout(t){t!==this._$knockout&&(this._$knockout=!!t,this._$doChanged())}get quality(){return this._$blurFilter.quality}set quality(t){this._$blurFilter.quality=t}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(this._$ratios=t,n.isArray(t)){for(let e=0;e<t.length;++e)t[e]=Y(+t[e],0,255,0);this._$ratios=t}this._$doChanged()}}get strength(){return this._$strength}set strength(t){(t=Y(0|t,0,255,0))!==this._$strength&&(this._$strength=t,this._$doChanged())}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this._$doChanged())}clone(){return new $t(this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$toArray(){return L(8,this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurFilter.blurX,this._$blurFilter.blurY,this._$strength,this._$blurFilter.quality,this._$type,this._$knockout)}_$isUpdated(){return this._$updated||this._$blurFilter._$isUpdated()}_$generateFilterRect(t,e=0,i=0){let s=S(t.xMin,t.xMax,t.yMin,t.yMax);if(!this._$canApply())return s;s=this._$blurFilter._$generateFilterRect(s,e,i);const n=this._$angle*p;let a=r.abs(r.cos(n)*this._$distance),h=r.abs(r.sin(n)*this._$distance);return e&&(a*=e),i&&(h*=i),s.xMin=r.min(s.xMin,a),a>0&&(s.xMax+=a),s.yMin=r.min(s.yMin,h),h>0&&(s.yMax+=h),s}_$canApply(){return this._$strength>0&&this._$distance>0&&null!==this._$alphas&&null!==this._$ratios&&null!==this._$colors&&this._$blurFilter._$canApply()}_$applyFilter(e,i){this._$updated=!1;const s=e.frameBuffer,n=s.currentAttachment;if(e.setTransform(1,0,0,1,0,0),!this._$canApply()||!n)return s.getTextureFromCurrentAttachment();const a=n.width,h=n.height,o=e._$offsetX,_=e._$offsetY,l=this._$blurFilter._$applyFilter(e,i,!1),c=l.width,$=l.height,u=e._$offsetX,d=e._$offsetY,g=u-o,f=d-_;let m=r.sqrt(i[0]*i[0]+i[1]*i[1]),x=r.sqrt(i[2]*i[2]+i[3]*i[3]);m/=t,x/=t,m*=2,x*=2;const b=+this._$angle*p,v=+r.cos(b)*this._$distance*m,T=+r.sin(b)*this._$distance*x,A="inner"===this.type,M=A?a:c+r.max(0,r.abs(v)-g),y=A?h:$+r.max(0,r.abs(T)-f),E=r.ceil(M),C=r.ceil(y),S=(E-M)/2,F=(C-y)/2,B=A?0:r.max(0,g-v)+S,w=A?0:r.max(0,f-T)+F,R=A?v-u:(v>0?r.max(0,v-g):0)+S,I=A?T-d:(T>0?r.max(0,T-f):0)+F;return e._$bind(n),e._$applyBitmapFilter(l,E,C,a,h,B,w,c,$,R,I,!0,this._$type,this._$knockout,this._$strength,this._$ratios,this._$colors,this._$alphas,0,0,0,0,0,0,0,0),e._$offsetX=o+B,e._$offsetY=_+w,s.releaseTexture(l),s.getTextureFromCurrentAttachment()}}class ut{constructor(){this._$instanceId=-1,this._$parentId=-1,this._$loaderInfoId=-1,this._$characterId=-1,this._$clipDepth=0,this._$depth=0,this._$isMask=!1,this._$updated=!0,this._$matrix=R(1,0,0,1,0,0),this._$colorTransform=P(1,1,1,1,0,0,0,0),this._$blendMode="normal",this._$filters=null,this._$visible=!0,this._$maskId=-1,this._$maskMatrix=null,this._$isMask=!1,this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$scale9Grid=null,this._$matrixBase=null}_$shouldClip(t){const e=this._$getBounds(t),i=r.abs(e.xMax-e.xMin),s=r.abs(e.yMax-e.yMin);return F(e),!(!i||!s)}_$getLayerBounds(e){const i=this._$getBounds(),s=H(i,e);F(i);const n=this._$filters;if(!n||!n.length)return s;let a=S(0,r.abs(s.xMax-s.xMin),0,r.abs(s.yMax-s.yMin));F(s);let h=+r.sqrt(e[0]*e[0]+e[1]*e[1]),o=+r.sqrt(e[2]*e[2]+e[3]*e[3]);h/=t,o/=t,h*=2,o*=2;for(let t=0;t<n.length;++t)a=n[t]._$generateFilterRect(a,h,o);return a}_$getBounds(t=null){const e=S(this._$xMin,this._$xMax,this._$yMin,this._$yMax);if(!t)return e;let i=t;const s=this._$matrix;1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=z(t,s));const r=H(e,i);return F(e),i!==t&&I(i),r}_$startClip(t,e){t.drawInstacedArray();const i=this._$getBounds(e),s=t._$startClip(i);if(F(i),!s)return!1;t._$enterClip(),t._$beginClipDef();let r=!1;return"_$children"in this&&(r=!0,t._$updateContainerClipFlag(!0)),this._$clip(t,e),this._$updated=!1,r&&(t._$updateContainerClipFlag(!1),t._$drawContainerClip()),t._$endClipDef(),!0}_$doChanged(){if(this._$updated=!0,this._$parentId>-1){const t=oe.instances;if(!t.has(this._$parentId))return;const e=t.get(this._$parentId);e._$updated||e._$doChanged()}}_$update(t){if(this._$doChanged(),this._$visible=t.visible,"depth"in t&&(this._$depth=t.depth),"isMask"in t&&(this._$isMask=t.isMask),"clipDepth"in t&&(this._$clipDepth=t.clipDepth),"maskId"in t&&(this._$maskId=t.maskId,this._$maskId>-1&&t.maskMatrix&&(this._$maskMatrix=t.maskMatrix)),this._$matrix[0]="a"in t?t.a:1,this._$matrix[1]="b"in t?t.b:0,this._$matrix[2]="c"in t?t.c:0,this._$matrix[3]="d"in t?t.d:1,this._$matrix[4]="tx"in t?t.tx:0,this._$matrix[5]="ty"in t?t.ty:0,this._$colorTransform[0]="f0"in t?t.f0:1,this._$colorTransform[1]="f1"in t?t.f1:1,this._$colorTransform[2]="f2"in t?t.f2:1,this._$colorTransform[3]="f3"in t?t.f3:1,this._$colorTransform[4]="f4"in t?t.f4:0,this._$colorTransform[5]="f5"in t?t.f5:0,this._$colorTransform[6]="f6"in t?t.f6:0,this._$colorTransform[7]="f7"in t?t.f7:0,this._$blendMode=t.blendMode||"normal",this._$filters=null,t.filters&&t.filters.length){this._$filters=L();for(let e=0;e<t.filters.length;++e){const i=t.filters[e];switch(i.shift()){case 0:this._$filters.push(new nt(...i));break;case 1:this._$filters.push(new rt(...i));break;case 2:this._$filters.push(new at(...i));break;case 3:this._$filters.push(new ht(...i));break;case 4:this._$filters.push(new ot(...i));break;case 5:this._$filters.push(new _t(...i));break;case 6:this._$filters.push(new lt(...i));break;case 7:this._$filters.push(new ct(...i));break;case 8:this._$filters.push(new $t(...i))}}}t.grid&&(this._$scale9Grid=t.grid,t.matrixBase&&(this._$matrixBase=t.matrixBase))}_$canApply(t=null){if(t)for(let e=0;e<t.length;++e)if(t[e]._$canApply())return!0;return!1}_$remove(){this._$doChanged();const t=oe;it.setRemoveTimer(this._$instanceId),this._$loaderInfoId>-1&&this._$characterId&&it.setRemoveTimer(`${this._$loaderInfoId}@${this._$characterId}`),t.instances.delete(this._$instanceId),this._$instanceId=-1,this._$parentId=-1,this._$loaderInfoId=-1,this._$characterId=-1,this._$blendMode="normal",this._$filters=null,this._$visible=!0,this._$maskId=-1,this._$isMask=!1,this._$depth=0,this._$clipDepth=0,this._$scale9Grid=null}_$isUpdated(){return this._$updated}_$isFilterUpdated(t,e=null,i=!1){if(this._$isUpdated())return!0;if(i&&e)for(let t=0;t<e.length;++t)if(e[t]._$isUpdated())return!0;const s=it.get([this._$instanceId,"f"]);return!s||s.filterState!==i||s.matrix!==`${t[0]}_${t[1]}_${t[2]}_${t[3]}`}_$applyFilter(t,e,i,s,n,a){const h=+r.sqrt(s[0]*s[0]+s[1]*s[1]),o=+r.sqrt(s[2]*s[2]+s[3]*s[3]),_=r.atan2(s[1],s[0]),l=r.atan2(0-s[2],s[3]),c=R(r.cos(_),r.sin(_),0-r.sin(l),r.cos(l),n/2,a/2),$=R(1,0,0,1,0-i.width/2,0-i.height/2),u=z(c,$);I(c),I($);const d=t.frameBuffer,g=d.currentAttachment,f=d.createCacheAttachment(n,a);t._$bind(f),t.reset(),t.setTransform(u[0],u[1],u[2],u[3],u[4],u[5]),I(u),t.drawImage(i,0,0,i.width,i.height),t._$offsetX=0,t._$offsetY=0;const m=R(h,0,0,o,0,0);let p=null;for(let i=0;i<e.length;++i)p=e[i]._$applyFilter(t,m);if(I(m),!p)return i;const x=t._$offsetX,b=t._$offsetY;return t._$offsetX=0,t._$offsetY=0,p.offsetX=x,p.offsetY=b,p.matrix=s[0]+"_"+s[1]+"_"+s[2]+"_"+s[3],p.filterState=!0,t._$bind(g),d.releaseAttachment(f,!1),p}_$drawFilter(t,e,i,s,n,a=null){const h=L(this._$instanceId,"f");let o=it.get(h);const _=this._$isFilterUpdated(e,i,!0);if(o&&!_)return t.cachePosition=o,o;o&&it.set(h,null);const l=t.frameBuffer,c=a||t.getTextureFromRect(t.cachePosition),$=this._$applyFilter(t,i,c,e,s,n);l.textureManager.release(c);const u=this._$getLayerBounds(e);return o=l.createCachePosition(r.ceil(r.abs(u.xMax-u.xMin)),r.ceil(r.abs(u.yMax-u.yMin))),F(u),o.filterState=!0,o.matrix=`${e[0]}_${e[1]}_${e[2]}_${e[3]}_0_0`,o.offsetX=$.offsetX,o.offsetY=$.offsetY,t.drawTextureFromRect($,o),it.set(h,o),O(h),o}}class dt extends ut{constructor(){super(),this._$children=new Int32Array}_$clip(t,e){let i=e;const s=this._$matrix;1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=z(e,s));const r=oe.instances,n=this._$children;for(let e=0;e<this._$children.length;++e){const s=n[e];if(!r.has(s))continue;const a=r.get(s);a&&!a._$isMask&&(a._$clip(t,i),a._$updated=!1)}i!==e&&I(i)}_$draw(t,e,i){if(!this._$visible)return;let s=i;const r=this._$colorTransform;if(1===r[0]&&1===r[1]&&1===r[2]&&1===r[3]&&0===r[4]&&0===r[5]&&0===r[6]&&0===r[7]||(s=G(i,r)),!Y(s[3]+s[7]/255,0,1,0))return;const n=this._$children,a=n.length;if(!a)return;const h=this._$preDraw(t,e);if(!h)return;if(h.isLayer&&!h.isUpdated)return void this._$postDraw(t,e,s,h);const o=h.matrix,_=h.isLayer&&h.color?h.color:s;let l=!0,c=0;const $=oe.instances,u=t.isLayer;for(let e=0;e<a;++e){const i=n[e];if(!$.has(i))continue;const s=$.get(i);if(s._$isMask)continue;const r=s._$blendMode;if(("alpha"===r||"erase"===r)&&!u)continue;if(c&&(s._$depth>c||s._$clipDepth>0)&&(t.restore(),l&&t._$leaveClip(),c=0,l=!0),!l)continue;if(s._$clipDepth>0){c=s._$clipDepth,l=s._$shouldClip(o),l&&(t.save(),l=s._$startClip(t,o));continue}const a=s._$maskId>-1&&$.has(s._$maskId)?$.get(s._$maskId):null;if(a){let e;if(a._$updated=!1,this._$instanceId===a._$parentId)e=o;else{e=f;let i=$.get(a._$parentId);for(;i||i._$instanceId!==i._$parentId;)e=z(i._$matrix,e),i=$.get(i._$parentId);const s=oe.scaleX,r=R(s,0,0,s,0,0);if(e=z(r,e),I(r),t.isLayer){const i=t.getCurrentPosition();e[4]-=i.xMin,e[5]-=i.yMin}}if(!a._$shouldClip(e))continue;const i=a._$startClip(t,e);if(t.save(),!i){t.restore();continue}}s._$draw(t,o,_),s._$updated=!1,a&&(t.restore(),t._$leaveClip())}if(c&&(t.restore(),l&&t._$leaveClip()),h.isLayer)return this._$postDraw(t,e,s,h);h.matrix!==e&&I(h.matrix),s!==i&&N(s),Z(h)}_$getLayerBounds(e){const i=this._$children;if(!i.length)return S(0,0,0,0);const s=h.MAX_VALUE;let n=s,a=-s,o=s,_=-s;const l=oe.instances;for(let t=0;t<i.length;++t){const s=i[t];if(!l.has(s))continue;const h=l.get(s);let c=e;const $=h._$matrix;1===$[0]&&0===$[1]&&0===$[2]&&1===$[3]&&0===$[4]&&0===$[5]||(c=z(e,$));const u=h._$getLayerBounds(c);n=r.min(n,u.xMin),a=r.max(a,u.xMax),o=r.min(o,u.yMin),_=r.max(_,u.yMax),F(u),c!==e&&I(c)}if(!this._$filters||!this._$filters.length)return S(n,a,o,_);let c=S(0,a-n,0,_-o),$=+r.sqrt(e[0]*e[0]+e[1]*e[1]),u=+r.sqrt(e[2]*e[2]+e[3]*e[3]);$/=t,u/=t,$*=2,u*=2;for(let t=0;t<this._$filters.length;++t)c=this._$filters[t]._$generateFilterRect(c,$,u);return a+=c.xMax-(a-n),_+=c.yMax-(_-o),n+=c.xMin,o+=c.yMin,F(c),S(n,a,o,_)}_$getBounds(t=null){let e=f;if(t){e=t;const i=this._$matrix;1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]&&0===i[4]&&0===i[5]||(e=z(t,i))}const i=this._$children;if(!i.length){const i=S(e[4],-e[4],e[5],-e[5]);return t&&e!==t&&I(e),i}const s=h.MAX_VALUE;let n=s,a=-s,o=s,_=-s;const l=oe.instances;for(let t=0;t<i.length;++t){const s=i[t];if(!l.has(s))continue;const h=l.get(s)._$getBounds(e);n=r.min(n,h.xMin),a=r.max(a,h.xMax),o=r.min(o,h.yMin),_=r.max(_,h.yMax),F(h)}return t&&e!==t&&I(e),S(n,a,o,_)}_$preDraw(t,e){let i=e;const s=this._$matrix;if(1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&0===s[4]&&0===s[5]||(i=z(e,s)),!i[0]&&!i[1]||!i[2]&&!i[3])return null;const n=x.pop()||{isLayer:!1,isUpdated:null,canApply:null,matrix:null,color:null,blendMode:"normal",filters:null,sw:0,sh:0};n.matrix=i;const a=this._$blendMode;if("normal"!==a||this._$filters&&this._$filters.length>0){const s=this._$getBounds(null),o=H(s,i);F(s);const _=+o.xMax,l=+o.xMin,c=+o.yMax,$=+o.yMin;F(o);const u=r.ceil(r.abs(_-l)),d=r.ceil(r.abs(c-$));if(0>=u||0>=d)return Z(n),i!==e&&I(i),null;let g=+r.sqrt(i[0]*i[0]+i[1]*i[1]);if(!h.isInteger(g)){const t=g.toString(),e=t.indexOf("e");-1!==e&&(g=+t.slice(0,e)),g=+g.toFixed(4)}let f=+r.sqrt(i[2]*i[2]+i[3]*i[3]);if(!h.isInteger(f)){const t=f.toString(),e=t.indexOf("e");-1!==e&&(f=+t.slice(0,e)),f=+f.toFixed(4)}n.canApply=this._$canApply(this._$filters);let m=S(0,u,0,d);if(n.canApply&&this._$filters)for(let t=0;t<this._$filters.length;++t)m=this._$filters[t]._$generateFilterRect(m,g,f);const p=t.frameBuffer.currentAttachment;if(!p||!p.texture||l-m.xMin>p.width||$-m.yMin>p.height)return F(m),Z(n),i!==e&&I(i),null;if(0>l+m.xMax||0>$+m.yMax)return F(m),Z(n),i!==e&&I(i),null;let x=i[4]-l,b=i[5]-$;t._$startLayer(S(l,_,$,c));const v=this._$isFilterUpdated(i,this._$filters,n.canApply),T=this._$getLayerBounds(i),A=r.ceil(r.abs(T.xMax-T.xMin)),M=r.ceil(r.abs(T.yMax-T.yMin));F(T);const y=A-m.xMax+m.xMin,E=M-m.yMax+m.yMin;x+=y,b+=E,n.sw=y,n.sh=E,v&&t._$saveAttachment(r.ceil(u+y),r.ceil(d+E),!0),n.isLayer=!0,n.isUpdated=v,n.filters=this._$filters,n.blendMode=a,n.color=P(),n.matrix=R(i[0],i[1],i[2],i[3],x,b),i!==e&&I(i),F(m)}return n}_$postDraw(t,e,i,s){t.drawInstacedArray();const r=L(this._$instanceId,"f"),n=t.frameBuffer,a=s.matrix;let h=0,o=0,_=it.get(r);if(!_||s.isUpdated){_&&it.set(r,null),_=n.getTextureFromCurrentAttachment();const i=s.filters;let l=!1;if(i&&i.length){for(let s=0;s<i.length;++s)_=i[s]._$applyFilter(t,e);l=!0,h=t._$offsetX,o=t._$offsetY,t._$offsetX=0,t._$offsetY=0}_.filterState=l,_.matrix=`${a[0]}_${a[1]}_${a[2]}_${a[3]}`,_.offsetX=h,_.offsetY=o,it.set(r,_),t._$restoreAttachment()}_.offsetX&&(h=_.offsetX),_.offsetY&&(o=_.offsetY),t.reset(),t.globalAlpha=Y(i[3]+i[7]/255,0,1),t.globalCompositeOperation=s.blendMode;const l=t.getCurrentPosition();t.setTransform(1,0,0,1,l.xMin-h-s.sw,l.yMin-o-s.sh),t.drawImage(_,0,0,_.width,_.height,i),t._$endLayer(),t._$endLayer(),I(s.matrix),Z(s),t.cachePosition=null}_$remove(){this._$children=new Int32Array,super._$remove(),ce.push(this)}}class gt{constructor(){this._$rgb="rgb",this._$mode="pad",this._$type="linear",this._$focalPointRatio=0,this._$points=R(),this._$stops=L()}dispose(){const t=this._$stops;for(let e=0;e<t.length;++e)w(t[e][1]);I(this._$points)}get mode(){return this._$mode}get type(){return this._$type}get rgb(){return this._$rgb}get points(){return this._$points}get focalPointRatio(){return this._$focalPointRatio}get stops(){return this._$stops.sort(((t,e)=>{switch(!0){case t[0]>e[0]:return 1;case e[0]>t[0]:return-1;default:return 0}})),this._$stops}linear(t,e,i,s,r="rgb",n="pad"){return this._$type="linear",this._$points[0]=t,this._$points[1]=e,this._$points[2]=i,this._$points[3]=s,this._$rgb=r,this._$mode=n,this._$stops.length&&(this._$stops.length=0),this}radial(t,e,i,s,r,n,a="rgb",h="pad",o=0){return this._$type="radial",this._$points[0]=t,this._$points[1]=e,this._$points[2]=i,this._$points[3]=s,this._$points[4]=r,this._$points[5]=n,this._$rgb=a,this._$mode=h,this._$focalPointRatio=Y(o,-.975,.975,0),this._$stops.length&&(this._$stops.length=0),this}addColorStop(t,e){this._$stops.push(L(t,e))}}class ft{constructor(t,e,i,s){this._$context=t,this._$texture=e,this._$repeat=i,this._$colorTransform=s}get texture(){return this._$texture}get repeat(){return this._$repeat}get colorTransform(){return this._$colorTransform}}class mt{constructor(){this._$fillStyle=B(1,1,1,1),this._$strokeStyle=B(1,1,1,1),this._$lineWidth=1,this._$lineCap="round",this._$lineJoin="round",this._$miterLimit=5}get miterLimit(){return this._$miterLimit}set miterLimit(t){this._$miterLimit=t}get lineWidth(){return this._$lineWidth}set lineWidth(t){this._$lineWidth=t}get lineCap(){return this._$lineCap}set lineCap(t){this._$lineCap=t}get lineJoin(){return this._$lineJoin}set lineJoin(t){this._$lineJoin=t}get fillStyle(){return this._$fillStyle}set fillStyle(t){this._$fillStyle instanceof o&&w(this._$fillStyle),this._$fillStyle=t}get strokeStyle(){return this._$strokeStyle}set strokeStyle(t){this._$strokeStyle instanceof o&&w(this._$strokeStyle),this._$strokeStyle=t}clear(){this._$lineWidth=1,this._$lineCap="round",this._$lineJoin="round",this._$miterLimit=5,this._$clearFill(),this._$clearStroke()}_$clearFill(){if(this._$fillStyle instanceof gt)return this._$fillStyle.dispose(),void(this._$fillStyle=B(1,1,1,1));this._$fillStyle instanceof ft?this._$fillStyle=B(1,1,1,1):this._$fillStyle.fill(1)}_$clearStroke(){if(this._$strokeStyle instanceof gt)return this._$strokeStyle.dispose(),void(this._$strokeStyle=B(1,1,1,1));this._$strokeStyle instanceof ft?this._$strokeStyle=B(1,1,1,1):this._$strokeStyle.fill(1)}}let pt=2048;class xt{constructor(t){t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),this._$gl=t,this._$objectPool=[],this._$objectPoolArea=0,this._$activeTexture=-1,this._$boundTextures=[null,null,null],this._$maxWidth=0,this._$maxHeight=0,this._$atlasTextures=[],this._$atlasCacheMap=new Map,this._$positionObjectArray=[],this._$nodeObjectArray=[],this._$atlasNodes=new Map}createTextureAtlas(){const t=this._$gl.createTexture();t.width=pt,t.height=pt,this._$gl.activeTexture(this._$gl.TEXTURE3),this._$gl.bindTexture(this._$gl.TEXTURE_2D,t),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_S,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_T,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MIN_FILTER,this._$gl.NEAREST),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MAG_FILTER,this._$gl.NEAREST),this._$gl.texStorage2D(this._$gl.TEXTURE_2D,1,this._$gl.RGBA8,pt,pt),this._$gl.bindTexture(this._$gl.TEXTURE_2D,null),this._$activeTexture>-1&&this._$gl.activeTexture(this._$activeTexture);const e=this._$atlasTextures.length;this._$atlasNodes.set(e,[]),this._$atlasCacheMap.set(e,[]),this._$atlasTextures.push(t)}getAtlasTexture(t){return this._$atlasTextures[t]}getNode(t,e,i,s){const r=this._$nodeObjectArray.length?this._$nodeObjectArray.pop():{x:0,y:0,w:0,h:0};return r.x=t,r.y=e,r.w=i,r.h=s,r}createCachePosition(t,e){const i=this._$positionObjectArray.length?this._$positionObjectArray.pop():{index:0,x:0,y:0,w:0,h:0};i.x=i.y=0,i.w=t,i.h=e;for(const[s,r]of this._$atlasNodes){if(!r.length)return t>e?(pt-t-1>0&&r.push(this.getNode(t+1,0,pt-t-1,e)),pt-e-1>0&&r.push(this.getNode(0,e+1,pt,pt-e-1))):(pt-e-1>0&&r.push(this.getNode(0,e+1,t,pt-e-1)),pt-t-1>0&&r.push(this.getNode(t+1,0,pt-t-1,pt))),i.index=s,this._$atlasCacheMap.get(i.index).push(i),i;const n=r.length;for(let a=0;a<n;++a){const n=r[a];if(!(t>n.w||e>n.h))return i.index=s,i.x=n.x,i.y=n.y,this._$atlasCacheMap.get(i.index).push(i),n.w!==t||n.h!==e?t>e?(n.h-e-1>0&&r.push(this.getNode(n.x,n.y+e+1,n.w,n.h-e-1)),n.w-t-1>0?(n.x=n.x+t+1,n.w=n.w-t-1,n.h=e):(r.splice(a,1),this._$nodeObjectArray.push(n))):(n.w-t-1>0&&r.push(this.getNode(n.x+t+1,n.y,n.w-t-1,n.h)),n.h-e-1>0?(n.y=n.y+e+1,n.w=t,n.h=n.h-e-1):(r.splice(a,1),this._$nodeObjectArray.push(n))):(r.splice(a,1),this._$nodeObjectArray.push(n)),i}}const s=this._$atlasTextures.length;this.createTextureAtlas();const r=this._$atlasNodes.get(s);return t>e?(pt-t-1>0&&r.push(this.getNode(t+1,0,pt-t-1,e)),pt-e-1>0&&r.push(this.getNode(0,e+1,pt,pt-e-1))):(pt-e-1>0&&r.push(this.getNode(0,e+1,t,pt-e-1)),pt-t-1>0&&r.push(this.getNode(t+1,0,pt-t-1,pt))),i.index=s,this._$atlasCacheMap.get(i.index).push(i),i}releasePosition(t){var e;this._$atlasNodes.has(t.index)&&(null===(e=this._$atlasNodes.get(t.index))||void 0===e||e.unshift(this.getNode(t.x,t.y,t.w,t.h)),this._$positionObjectArray.push(t))}clearCache(){for(const t of this._$atlasCacheMap.values())t.length=0;for(const t of this._$atlasNodes.values())t.length=0}_$createTexture(t,e){const i=this._$gl.createTexture();return i.width=0,i.height=0,i.area=0,i.dirty=!0,i.smoothing=!0,this.bind0(i,!1),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_S,this._$gl.CLAMP_TO_EDGE),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_WRAP_T,this._$gl.CLAMP_TO_EDGE),i.width=t,i.height=e,i.area=t*e,i.dirty=!1,this._$gl.texStorage2D(this._$gl.TEXTURE_2D,1,this._$gl.RGBA8,t,e),i}_$getTexture(t,e){for(let i=0;i<this._$objectPool.length;i++){const s=this._$objectPool[i];if(s.width===t&&s.height===e)return this._$objectPool.splice(i,1),this._$objectPoolArea-=s.area,this.bind0(s,!1),s}return this._$createTexture(t,e)}create(t,e,i=null,s=!1,r=!0){const n=this._$getTexture(t,e);return s&&this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r||this._$gl.pixelStorei(this._$gl.UNPACK_FLIP_Y_WEBGL,!1),n.width!==t||n.height!==e?(n.width=t,n.height=e,n.area=t*e,n.dirty=!1,this._$gl.texImage2D(this._$gl.TEXTURE_2D,0,this._$gl.RGBA,t,e,0,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)):i&&(n.dirty=!1,this._$gl.texSubImage2D(this._$gl.TEXTURE_2D,0,0,0,t,e,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)),s&&this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r||this._$gl.pixelStorei(this._$gl.UNPACK_FLIP_Y_WEBGL,!0),n}createFromImage(t,e=!1){return this._$createFromElement(t.width,t.height,t,e)}createFromCanvas(t){return this._$createFromElement(t.width,t.height,t,!1)}createFromVideo(t,e=!1){return this._$createFromElement(t.videoWidth,t.videoHeight,t,e)}_$createFromElement(t,e,i,s=!1){const r=this._$getTexture(t,e);return r.dirty=!1,this.bind0(r,s),this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.width!==t||r.height!==e?(r.width=t,r.height=e,r.area=t*e,this._$gl.texImage2D(this._$gl.TEXTURE_2D,0,this._$gl.RGBA,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i)):this._$gl.texSubImage2D(this._$gl.TEXTURE_2D,0,0,0,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,i),this._$gl.pixelStorei(this._$gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r}release(t){if(t.area>this._$maxWidth*this._$maxHeight*2)this._$gl.deleteTexture(t);else if(t.dirty=!0,this._$objectPool.push(t),this._$objectPoolArea+=t.area,this._$objectPool.length&&this._$objectPoolArea>this._$maxWidth*this._$maxHeight*10){const t=this._$objectPool.shift();this._$objectPoolArea-=t.area,this._$gl.deleteTexture(t)}}bind0(t,e=null){this._$bindTexture(2,this._$gl.TEXTURE2,null,null),this._$bindTexture(1,this._$gl.TEXTURE1,null,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,e)}bind01(t,e,i=null){this._$bindTexture(2,this._$gl.TEXTURE2,null,null),this._$bindTexture(1,this._$gl.TEXTURE1,e,i),this._$bindTexture(0,this._$gl.TEXTURE0,t,i)}bind012(t,e,i,s=null){this._$bindTexture(2,this._$gl.TEXTURE2,i,s),this._$bindTexture(1,this._$gl.TEXTURE1,e,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,null)}bind02(t,e,i=null){this._$bindTexture(2,this._$gl.TEXTURE2,e,i),this._$bindTexture(1,this._$gl.TEXTURE1,null,null),this._$bindTexture(0,this._$gl.TEXTURE0,t,null)}_$bindTexture(t,e,i=null,s=null){const r=i!==this._$boundTextures[t],n=null!==s&&null!==i&&s!==i.smoothing;if((r||n||e===this._$gl.TEXTURE0)&&e!==this._$activeTexture&&(this._$activeTexture=e,this._$gl.activeTexture(e)),r&&(this._$boundTextures[t]=i,this._$gl.bindTexture(this._$gl.TEXTURE_2D,i)),n){i&&(i.smoothing=!!s);const t=s?this._$gl.LINEAR:this._$gl.NEAREST;this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MIN_FILTER,t),this._$gl.texParameteri(this._$gl.TEXTURE_2D,this._$gl.TEXTURE_MAG_FILTER,t)}}}class bt{constructor(t){this._$gl=t,this._$objectPool=L(),this._$objectPoolArea=0,this._$maxWidth=0,this._$maxHeight=0}set maxWidth(t){this._$maxWidth=t}set maxHeight(t){this._$maxHeight=t}_$createStencilBuffer(){const t=this._$gl.createRenderbuffer();if(!t)throw new Error("the stencil buffer is null.");return t.width=0,t.height=0,t.area=0,t.dirty=!0,t}_$getStencilBuffer(t,e){const i=this._$objectPool.length;for(let s=0;s<i;++s){const i=this._$objectPool[s];if(i.width===t&&i.height===e)return this._$objectPool.splice(s,1),this._$objectPoolArea-=i.area,i}if(i>100){const t=this._$objectPool.shift();if(t)return this._$objectPoolArea-=t.area,t}return this._$createStencilBuffer()}create(t,e){const i=this._$getStencilBuffer(t,e);return i.width===t&&i.height===e||(i.width=t,i.height=e,i.area=t*e,i.dirty=!1,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,i),this._$gl.renderbufferStorage(this._$gl.RENDERBUFFER,this._$gl.STENCIL_INDEX8,t,e)),i}release(t){if(t.area>this._$maxWidth*this._$maxHeight*2)this._$gl.deleteRenderbuffer(t);else if(t.dirty=!0,this._$objectPool.push(t),this._$objectPoolArea+=t.area,this._$objectPoolArea>this._$maxWidth*this._$maxHeight*10){const t=this._$objectPool.shift();t&&(this._$objectPoolArea-=t.area,this._$gl.deleteRenderbuffer(t))}}}class vt{constructor(t,e){this._$gl=t,this._$samples=e,this._$objectPool=L()}set samples(t){this._$samples=t}_$createColorBuffer(){const t=this._$gl.createRenderbuffer();if(!t)throw new Error("the color buffer is null.");const e=this._$gl.createRenderbuffer();if(!e)throw new Error("the stencil buffer is null.");return t.stencil=e,t.samples=0,t.width=0,t.height=0,t.area=0,t.dirty=!0,t}_$getColorBuffer(t){if(!this._$objectPool.length)return this._$createColorBuffer();const e=this._$bsearch(t);if(e<this._$objectPool.length){const t=this._$objectPool[e];return this._$objectPool.splice(e,1),t}const i=this._$objectPool.shift();if(!i)throw new Error("the color buffer is void.");return i}create(t,e,i=0){t=r.max(256,X(t)),e=r.max(256,X(e));const s=this._$getColorBuffer(t*e);return i||(i=this._$samples),(s.width<t||s.height<e||s.samples!==i)&&(t=r.max(t,s.width),e=r.max(e,s.height),s.samples=i,s.width=t,s.height=e,s.area=t*e,s.dirty=!1,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,s),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,i,this._$gl.RGBA8,t,e),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,s.stencil),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,i,this._$gl.STENCIL_INDEX8,t,e)),s}release(t){t.dirty=!0;const e=this._$bsearch(t.area);this._$objectPool.splice(e,0,t)}_$bsearch(t){let e=-1,i=this._$objectPool.length;for(;r.abs(i-e)>1;){const s=r.floor((i+e)/2);t<=this._$objectPool[s].area?i=s:e=s}return i}}class Tt{constructor(t,e){this._$gl=t,this._$objectPool=[],this._$frameBuffer=t.createFramebuffer(),t.bindFramebuffer(t.READ_FRAMEBUFFER,this._$frameBuffer),this._$frameBufferTexture=t.createFramebuffer(),this._$currentAttachment=null,this._$isBinding=!1,this._$textureManager=new xt(t),this._$stencilBufferPool=new bt(t),this._$colorBufferPool=new vt(t,e),this._$isRenderBinding=!1,this._$colorBuffer=this._$gl.createRenderbuffer(),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,e,this._$gl.RGBA8,pt,pt),this._$stencilBuffer=this._$gl.createRenderbuffer(),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$stencilBuffer),this._$gl.renderbufferStorageMultisample(this._$gl.RENDERBUFFER,e,this._$gl.STENCIL_INDEX8,pt,pt)}bindRenderBuffer(){this._$isBinding||(this._$isBinding=!0,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)),this._$isRenderBinding||(this._$isRenderBinding=!0,this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.RENDERBUFFER,this._$colorBuffer),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,this._$stencilBuffer),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.STENCIL_ATTACHMENT,this._$gl.RENDERBUFFER,this._$stencilBuffer))}get currentAttachment(){return this._$currentAttachment}get textureManager(){return this._$textureManager}createCacheAttachment(t,e,i=!1,s=0){const r=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!1},n=this._$textureManager.create(t,e);return r.width=t,r.height=e,i?(r.color=this._$colorBufferPool.create(t,e,s),r.texture=n,r.msaa=!0,r.stencil=r.color.stencil):(r.color=n,r.texture=n,r.msaa=!1,r.stencil=this._$stencilBufferPool.create(t,e)),r.mask=!1,r.clipLevel=0,r.isActive=!0,r}clearCache(){this._$textureManager.clearCache()}setMaxSize(t,e){this._$stencilBufferPool._$maxWidth=t,this._$stencilBufferPool._$maxHeight=e,this._$textureManager._$maxWidth=t,this._$textureManager._$maxHeight=e}createTextureAttachment(t,e){const i=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!1},s=this._$textureManager.create(t,e);return i.width=t,i.height=e,i.color=s,i.texture=s,i.msaa=!1,i.stencil=null,i.mask=!1,i.clipLevel=0,i.isActive=!0,i}createTextureAttachmentFrom(t){const e=this._$objectPool.pop()||{width:0,height:0,color:null,texture:null,msaa:!1,stencil:null,mask:!1,clipLevel:0,isActive:!0};return e.width=t.width,e.height=t.height,e.color=t,e.texture=t,e.msaa=!1,e.stencil=null,e.mask=!1,e.clipLevel=0,e.isActive=!0,e}releaseAttachment(t=null,e=!1){t&&t.isActive&&(t.msaa?t.color instanceof WebGLRenderbuffer&&this._$colorBufferPool.release(t.color):t.stencil&&this._$stencilBufferPool.release(t.stencil),e&&t.texture&&this._$textureManager.release(t.texture),t.color=null,t.texture=null,t.stencil=null,t.isActive=!1,this._$objectPool.push(t))}bind(t){this._$currentAttachment=t,this._$isBinding||(this._$isBinding=!0,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)),t.msaa?t.color instanceof WebGLRenderbuffer&&(this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,t.color),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.RENDERBUFFER,t.color)):t.color instanceof WebGLTexture&&(t.color&&this._$textureManager.bind0(t.color),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,t.color,0)),this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER,t.stencil),this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER,this._$gl.STENCIL_ATTACHMENT,this._$gl.RENDERBUFFER,t.stencil),this._$isRenderBinding=!1}unbind(){this._$currentAttachment=null,this._$isBinding&&(this._$isBinding=!1,this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,null))}transferToMainTexture(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$currentAttachment.texture;if(!i)throw new Error("the texture is null.");this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture),this._$textureManager.bind0(i),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,i,0),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,null),this._$gl.blitFramebuffer(0,0,t,e,0,0,t,e,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBuffer)}createCachePosition(t,e){return this._$textureManager.createCachePosition(t,e)}transferTexture(t){this._$gl.disable(this._$gl.SCISSOR_TEST),this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture);const e=this._$textureManager.getAtlasTexture(t.index);this._$textureManager.bind0(e),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,e,0);const i=r.max(0,t.x-1),s=r.max(0,t.y-1),n=r.min(pt,t.x+t.w+1),a=r.min(pt,t.y+t.h+1);this._$gl.blitFramebuffer(i,s,n,a,i,s,n,a,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer)}getTextureFromCurrentAttachment(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");if(!this._$currentAttachment.msaa&&this._$currentAttachment.texture)return this._$currentAttachment.texture;const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$currentAttachment.texture;if(!i)throw new Error("the texture is null.");return i.dirty=!1,this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER,this._$frameBufferTexture),this._$textureManager.bind0(i),this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER,this._$gl.COLOR_ATTACHMENT0,this._$gl.TEXTURE_2D,i,0),this._$gl.blitFramebuffer(0,0,t,e,0,0,t,e,this._$gl.COLOR_BUFFER_BIT,this._$gl.NEAREST),this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER,this._$frameBuffer),i}createTextureFromPixels(t,e,i=null,s=!1,r=!0){return this._$textureManager.create(t,e,i,s,r)}createTextureFromCanvas(t){return this._$textureManager.createFromCanvas(t)}createTextureFromImage(t,e=!1){return this._$textureManager.createFromImage(t,e)}createTextureFromVideo(t,e=!1){return this._$textureManager.createFromVideo(t,e)}createTextureFromCurrentAttachment(){if(!this._$currentAttachment)throw new Error("the current attachment is null.");const t=this._$currentAttachment.width,e=this._$currentAttachment.height,i=this._$textureManager.create(t,e);return this._$textureManager.bind0(i),this._$gl.copyTexSubImage2D(this._$gl.TEXTURE_2D,0,0,0,0,0,t,e),i}releaseTexture(t){this._$textureManager.release(t)}}class At{constructor(){this._$bezierConverterBuffer=new o(32)}cubicToQuad(t,e,i,s,r,n,a,h){this._$split2Cubic(t,e,i,s,r,n,a,h,0,16),this._$split2Cubic(this._$bezierConverterBuffer[0],this._$bezierConverterBuffer[1],this._$bezierConverterBuffer[2],this._$bezierConverterBuffer[3],this._$bezierConverterBuffer[4],this._$bezierConverterBuffer[5],this._$bezierConverterBuffer[6],this._$bezierConverterBuffer[7],0,8),this._$split2Cubic(this._$bezierConverterBuffer[16],this._$bezierConverterBuffer[17],this._$bezierConverterBuffer[18],this._$bezierConverterBuffer[19],this._$bezierConverterBuffer[20],this._$bezierConverterBuffer[21],this._$bezierConverterBuffer[22],this._$bezierConverterBuffer[23],16,24),this._$split2Quad(this._$bezierConverterBuffer[0],this._$bezierConverterBuffer[1],this._$bezierConverterBuffer[2],this._$bezierConverterBuffer[3],this._$bezierConverterBuffer[4],this._$bezierConverterBuffer[5],this._$bezierConverterBuffer[6],this._$bezierConverterBuffer[7],0),this._$split2Quad(this._$bezierConverterBuffer[8],this._$bezierConverterBuffer[9],this._$bezierConverterBuffer[10],this._$bezierConverterBuffer[11],this._$bezierConverterBuffer[12],this._$bezierConverterBuffer[13],this._$bezierConverterBuffer[14],this._$bezierConverterBuffer[15],8),this._$split2Quad(this._$bezierConverterBuffer[16],this._$bezierConverterBuffer[17],this._$bezierConverterBuffer[18],this._$bezierConverterBuffer[19],this._$bezierConverterBuffer[20],this._$bezierConverterBuffer[21],this._$bezierConverterBuffer[22],this._$bezierConverterBuffer[23],16),this._$split2Quad(this._$bezierConverterBuffer[24],this._$bezierConverterBuffer[25],this._$bezierConverterBuffer[26],this._$bezierConverterBuffer[27],this._$bezierConverterBuffer[28],this._$bezierConverterBuffer[29],this._$bezierConverterBuffer[30],this._$bezierConverterBuffer[31],24)}_$split2Cubic(t,e,i,s,r,n,a,h,o,_){const l=.125*(t+3*(i+r)+a),c=.125*(e+3*(s+n)+h),$=.125*(a+r-i-t),u=.125*(h+n-s-e);this._$bezierConverterBuffer[o]=t,this._$bezierConverterBuffer[o+1]=e,this._$bezierConverterBuffer[o+2]=.5*(t+i),this._$bezierConverterBuffer[o+3]=.5*(e+s),this._$bezierConverterBuffer[o+4]=l-$,this._$bezierConverterBuffer[o+5]=c-u,this._$bezierConverterBuffer[o+6]=l,this._$bezierConverterBuffer[o+7]=c,this._$bezierConverterBuffer[_]=l,this._$bezierConverterBuffer[_+1]=c,this._$bezierConverterBuffer[_+2]=l+$,this._$bezierConverterBuffer[_+3]=c+u,this._$bezierConverterBuffer[_+4]=.5*(r+a),this._$bezierConverterBuffer[_+5]=.5*(n+h),this._$bezierConverterBuffer[_+6]=a,this._$bezierConverterBuffer[_+7]=h}_$split2Quad(t,e,i,s,r,n,a,h,o){const _=.125*(t+3*(i+r)+a),l=.125*(e+3*(s+n)+h);this._$bezierConverterBuffer[o]=.25*t+.75*i,this._$bezierConverterBuffer[o+1]=.25*e+.75*s,this._$bezierConverterBuffer[o+2]=_,this._$bezierConverterBuffer[o+3]=l,this._$bezierConverterBuffer[o+4]=.75*r+.25*a,this._$bezierConverterBuffer[o+5]=.75*n+.25*h,this._$bezierConverterBuffer[o+6]=a,this._$bezierConverterBuffer[o+7]=h}}class Mt{constructor(){this._$currentPath=L(),this._$vertices=L(),this._$bezierConverter=new At}get vertices(){return this._$pushCurrentPathToVertices(),this._$vertices}begin(){for(this._$currentPath.length=0;this._$vertices.length;)O(this._$vertices.pop())}moveTo(t,e){this._$currentPath.length?this._$equalsToLastPoint(t,e)||(this._$pushCurrentPathToVertices(),this._$pushPointToCurrentPath(t,e,!1)):this._$pushPointToCurrentPath(t,e,!1)}lineTo(t,e){this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(t,e)||this._$pushPointToCurrentPath(t,e,!1)}quadTo(t,e,i,s){this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(i,s)||(this._$pushPointToCurrentPath(t,e,!0),this._$pushPointToCurrentPath(i,s,!1))}cubicTo(t,e,i,s,r,n){if(this._$currentPath.length||this.moveTo(0,0),this._$equalsToLastPoint(r,n))return;const a=+this._$currentPath[this._$currentPath.length-3],h=+this._$currentPath[this._$currentPath.length-2];this._$bezierConverter.cubicToQuad(a,h,t,e,i,s,r,n);const o=this._$bezierConverter._$bezierConverterBuffer;for(let t=0;t<32;)this.quadTo(o[t++],o[t++],o[t++],o[t++])}drawCircle(t,e,i){const s=i,r=.5522847498307936*i;this.cubicTo(t+s,e+r,t+r,e+s,t,e+s),this.cubicTo(t-r,e+s,t-s,e+r,t-s,e),this.cubicTo(t-s,e-r,t-r,e-s,t,e-s),this.cubicTo(t+r,e-s,t+s,e-r,t+s,e)}close(){if(this._$currentPath.length<=6)return;const t=+this._$currentPath[0],e=+this._$currentPath[1];this._$equalsToLastPoint(t,e)||this._$pushPointToCurrentPath(t,e,!1)}_$equalsToLastPoint(t,e){const i=+this._$currentPath[this._$currentPath.length-3],s=+this._$currentPath[this._$currentPath.length-2];return t===i&&e===s}_$pushPointToCurrentPath(t,e,i){this._$currentPath.push(t,e,i)}_$pushCurrentPathToVertices(){this._$currentPath.length<4?this._$currentPath.length=0:(this._$vertices.push(this._$currentPath),this._$currentPath=L())}createRectVertices(t,e,i,s){return L(L(t,e,!1,t+i,e,!1,t+i,e+s,!1,t,e+s,!1))}}class yt{constructor(){this.enabled=!1,this.parentMatrixA=1,this.parentMatrixB=0,this.parentMatrixC=0,this.parentMatrixD=0,this.parentMatrixE=1,this.parentMatrixF=0,this.parentMatrixG=0,this.parentMatrixH=0,this.parentMatrixI=1,this.ancestorMatrixA=1,this.ancestorMatrixB=0,this.ancestorMatrixC=0,this.ancestorMatrixD=0,this.ancestorMatrixE=1,this.ancestorMatrixF=0,this.ancestorMatrixG=0,this.ancestorMatrixH=0,this.ancestorMatrixI=1,this.parentViewportX=0,this.parentViewportY=0,this.parentViewportW=0,this.parentViewportH=0,this.minXST=1e-5,this.minYST=1e-5,this.minXPQ=1e-5,this.minYPQ=1e-5,this.maxXST=.99999,this.maxYST=.99999,this.maxXPQ=.99999,this.maxYPQ=.99999}enable(t,e,i,s,n,a,h,o,_,l,c,$,u,d,g,f,m,p,x){const b=n.xMax-n.xMin,v=n.yMax-n.yMin,T=a.w,A=a.h,M=r.abs(r.ceil(b*h)),y=r.abs(r.ceil(v*h)),E=T>0?(a.x-n.xMin)/b:1e-5,C=A>0?(a.y-n.yMin)/v:1e-5,S=T>0?(a.x+a.w-n.xMin)/b:.99999,F=A>0?(a.y+a.h-n.yMin)/v:.99999;let B=M*E/i,w=y*C/s,R=(i-M*(1-S))/i,I=(s-y*(1-F))/s;if(B>=R){const t=E/(E+(1-S));B=r.max(t-1e-5,0),R=r.min(t+1e-5,1)}if(w>=I){const t=C/(C+(1-F));w=r.max(t-1e-5,0),I=r.min(t+1e-5,1)}this.enabled=!0,this.parentMatrixA=o,this.parentMatrixB=_,this.parentMatrixD=l,this.parentMatrixE=c,this.parentMatrixG=$,this.parentMatrixH=u,this.ancestorMatrixA=d,this.ancestorMatrixB=g,this.ancestorMatrixD=f,this.ancestorMatrixE=m,this.ancestorMatrixG=p,this.ancestorMatrixH=x,this.parentViewportX=t,this.parentViewportY=e,this.parentViewportW=i,this.parentViewportH=s,this.minXST=E,this.minYST=C,this.minXPQ=B,this.minYPQ=w,this.maxXST=S,this.maxYST=F,this.maxXPQ=R,this.maxYPQ=I}disable(){this.enabled=!1}}class Et{constructor(t,e){this._$gl=t,this._$array=[],this._$map=D();const i=this._$gl.getProgramParameter(e,this._$gl.ACTIVE_UNIFORMS);for(let t=0;t<i;t++){const i=this._$gl.getActiveUniform(e,t),s=i.name.endsWith("[0]")?i.name.slice(0,-3):i.name,r=this._$gl.getUniformLocation(e,s);if(i.type===this._$gl.SAMPLER_2D&&1===i.size)continue;const n={};switch(i.type){case this._$gl.FLOAT_VEC4:n.method=this._$gl.uniform4fv.bind(this._$gl,r),n.array=new o(4*i.size),n.assign=-1;break;case this._$gl.INT_VEC4:n.method=this._$gl.uniform4iv.bind(this._$gl,r),n.array=new _(4*i.size),n.assign=-1;break;case this._$gl.SAMPLER_2D:n.method=this._$gl.uniform1iv.bind(this._$gl,r),n.array=new _(i.size),n.assign=1;break;case this._$gl.FLOAT:case this._$gl.FLOAT_VEC2:case this._$gl.FLOAT_VEC3:case this._$gl.FLOAT_MAT2:case this._$gl.FLOAT_MAT3:case this._$gl.FLOAT_MAT4:case this._$gl.INT:case this._$gl.INT_VEC2:case this._$gl.INT_VEC3:default:throw new Error("Use gl.FLOAT_VEC4 or gl.INT_VEC4 instead")}this._$array.push(n),this._$map.set(s,n)}}getArray(t){const e=this._$map.get(t);if(!e||!e.array)throw new Error("the UniformData is null.");return e.array}get textures(){const t=this._$map.get("u_textures");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get highp(){const t=this._$map.get("u_highp");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get mediump(){const t=this._$map.get("u_mediump");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}get integer(){const t=this._$map.get("u_integer");if(!t||!t.array)throw new Error("the UniformData is null.");return t.array}bindUniforms(){const t=this._$array.length;for(let e=0;e<t;e++){const t=this._$array[e];void 0!==t.method&&void 0!==t.assign&&(t.assign<0?t.method(t.array):t.assign>0&&(t.assign--,t.method(t.array)))}}}class Ct{constructor(){this._$attributes=[],this._$count=0}get attributes(){return this._$attributes}get count(){return this._$count}set count(t){this._$count=t}clear(){this._$attributes.length=0,this._$count=0}}class St{constructor(t,e,i,s){this._$gl=t,this._$context=e,this._$program=this._$createProgram(i,s),this._$uniform=new Et(t,this._$program),this._$instance=null}get instance(){return this._$instance||(this._$instance=new Ct),this._$instance}get uniform(){return this._$uniform}_$createProgram(t,i){const s=this._$gl.createProgram();s.id=e++;const r=this._$gl.createShader(this._$gl.VERTEX_SHADER);this._$gl.shaderSource(r,t),this._$gl.compileShader(r);const n=this._$gl.createShader(this._$gl.FRAGMENT_SHADER);return this._$gl.shaderSource(n,i),this._$gl.compileShader(n),this._$gl.attachShader(s,r),this._$gl.attachShader(s,n),this._$gl.linkProgram(s),this._$gl.detachShader(s,r),this._$gl.detachShader(s,n),this._$gl.deleteShader(r),this._$gl.deleteShader(n),s}_$attachProgram(){const t=this._$context.shaderList;t.currentProgramId!==this._$program.id&&(t.currentProgramId=this._$program.id,this._$gl.useProgram(this._$program))}drawArraysInstanced(t){this._$attachProgram(),this._$context.vao.bindInstnceArray(t),this._$gl.drawArraysInstanced(this._$gl.TRIANGLE_STRIP,0,4,t.count)}_$drawImage(){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bindCommonVertexArray(),this._$gl.drawArrays(this._$gl.TRIANGLE_STRIP,0,4)}_$drawGradient(t,e){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bindGradientVertexArray(t,e),this._$gl.drawArrays(this._$gl.TRIANGLE_STRIP,0,4)}_$stroke(t){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawElements(this._$gl.TRIANGLES,t.indexCount,this._$gl.UNSIGNED_SHORT,0)}_$fill(t){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t);const e=t.indexRanges,i=e[e.length-1];this._$gl.drawArrays(this._$gl.TRIANGLES,0,i.first+i.count)}_$containerClip(t,e,i){this._$attachProgram(),this._$context.blend.reset(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawArrays(this._$gl.TRIANGLES,e,i)}_$drawPoints(t,e,i){this._$attachProgram(),this._$uniform.bindUniforms(),this._$context.vao.bind(t),this._$gl.drawArrays(this._$gl.POINTS,e,i)}}class Ft{static FUNCTION_GRID_OFF(){return"\\n\\nvec2 applyMatrix(in vec2 vertex) {\\n mat3 matrix = mat3(\\n u_highp[0].xyz,\\n u_highp[1].xyz,\\n u_highp[2].xyz\\n );\\n\\n vec2 position = (matrix * vec3(vertex, 1.0)).xy;\\n\\n return position;\\n}\\n\\n"}static FUNCTION_GRID_ON(t){return`\\n\\nvec2 applyMatrix(in vec2 vertex) {\\n mat3 parent_matrix = mat3(\\n u_highp[${t}].xyz,\\n u_highp[${t+1}].xyz,\\n u_highp[${t+2}].xyz\\n );\\n mat3 ancestor_matrix = mat3(\\n u_highp[${t+3}].xyz,\\n u_highp[${t+4}].xyz,\\n u_highp[${t+5}].xyz\\n );\\n vec2 parent_offset = vec2(u_highp[${t+2}].w, u_highp[${t+3}].w);\\n vec2 parent_size = vec2(u_highp[${t+4}].w, u_highp[${t+5}].w);\\n vec4 grid_min = u_highp[${t+6}];\\n vec4 grid_max = u_highp[${t+7}];\\n\\n vec2 position = (parent_matrix * vec3(vertex, 1.0)).xy;\\n position = (position - parent_offset) / parent_size;\\n\\n vec4 ga = grid_min;\\n vec4 gb = grid_max - grid_min;\\n vec4 gc = vec4(1.0) - grid_max;\\n\\n vec2 pa = position;\\n vec2 pb = position - grid_min.st;\\n vec2 pc = position - grid_max.st;\\n\\n position = (ga.pq / ga.st) * min(pa, ga.st)\\n + (gb.pq / gb.st) * clamp(pb, vec2(0.0), gb.st)\\n + (gc.pq / gc.st) * max(vec2(0.0), pc);\\n\\n position = position * parent_size + parent_offset;\\n position = (ancestor_matrix * vec3(position, 1.0)).xy;\\n\\n return position;\\n}\\n\\n`}}class Bt{static TEMPLATE(t,e,i,s){const r=e-1,n=i?this.VARYING_UV_ON():"",a=i?this.STATEMENT_UV_ON():"";return`#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\nlayout (location = 1) in vec2 a_option1;\\nlayout (location = 2) in vec2 a_option2;\\nlayout (location = 3) in float a_type;\\n\\nuniform vec4 u_highp[${t}];\\n\\n${n}\\n\\n${s?Ft.FUNCTION_GRID_ON(i?5:0):Ft.FUNCTION_GRID_OFF()}\\n\\nfloat crossVec2(in vec2 v1, in vec2 v2) {\\n return v1.x * v2.y - v2.x * v1.y;\\n}\\n\\nvec2 perpendicularVec2(in vec2 v1) {\\n float face = u_highp[${r}][1];\\n\\n return face * vec2(v1.y, -v1.x);\\n}\\n\\nvec2 calculateNormal(in vec2 direction) {\\n vec2 normalized = normalize(direction);\\n return perpendicularVec2(normalized);\\n}\\n\\nvec2 calculateIntersection(in vec2 v1, in vec2 v2, in vec2 o1, in vec2 o2) {\\n float t = crossVec2(o2 - o1, v2) / crossVec2(v1, v2);\\n return (o1 + t * v1);\\n}\\n\\nvec2 calculateAnchor(in vec2 position, in float convex, out vec2 v1, out vec2 v2, out vec2 o1, out vec2 o2) {\\n float miter_limit = u_highp[${r}][2];\\n\\n vec2 a = applyMatrix(a_option1);\\n vec2 b = applyMatrix(a_option2);\\n\\n v1 = convex * (position - a);\\n v2 = convex * (b - position);\\n o1 = calculateNormal(v1) + a;\\n o2 = calculateNormal(v2) + position;\\n\\n vec2 anchor = calculateIntersection(v1, v2, o1, o2) - position;\\n return normalize(anchor) * min(length(anchor), miter_limit);\\n}\\n\\nvoid main() {\\n vec2 viewport = vec2(u_highp[0].w, u_highp[1].w);\\n float half_width = u_highp[${r}][0];\\n\\n vec2 position = applyMatrix(a_vertex);\\n vec2 offset = vec2(0.0);\\n vec2 v1, v2, o1, o2;\\n\\n if (a_type == 1.0 || a_type == 2.0) { // 線分\\n offset = calculateNormal(a_option2 * (applyMatrix(a_option1) - position));\\n } else if (a_type == 10.0) { // スクエア線端\\n offset = normalize(position - applyMatrix(a_option1));\\n offset += a_option2 * perpendicularVec2(offset);\\n } else if (a_type == 21.0) { // マイター結合(線分Bの凸側)\\n offset = calculateAnchor(position, 1.0, v1, v2, o1, o2);\\n offset = calculateIntersection(v2, perpendicularVec2(offset), o2, position + offset) - position;\\n } else if (a_type == 22.0) { // マイター結合(線分Aの凸側)\\n offset = calculateAnchor(position, 1.0, v1, v2, o1, o2);\\n offset = calculateIntersection(v1, perpendicularVec2(offset), o1, position + offset) - position;\\n } else if (a_type == 23.0) { // マイター結合(線分Aの凹側)\\n offset = calculateAnchor(position, -1.0, v1, v2, o1, o2);\\n offset = calculateIntersection(v1, perpendicularVec2(offset), o1, position + offset) - position;\\n } else if (a_type == 24.0) { // マイター結合(線分Bの凹側)\\n offset = calculateAnchor(position, -1.0, v1, v2, o1, o2);\\n offset = calculateIntersection(v2, perpendicularVec2(offset), o2, position + offset) - position;\\n } else if (a_type >= 30.0) { // ラウンド結合\\n float face = u_highp[${r}][1];\\n float rad = face * (a_type - 30.0) * 0.3488888889; /* 0.3488888889 = PI / 9.0 */\\n offset = mat2(cos(rad), sin(rad), -sin(rad), cos(rad)) * vec2(1.0, 0.0);\\n }\\n \\n offset *= half_width;\\n position += offset;\\n ${a}\\n\\n position /= viewport;\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n`}static VARYING_UV_ON(){return"\\nout vec2 v_uv;\\n"}static STATEMENT_UV_ON(){return"\\n mat3 uv_matrix = mat3(\\n u_highp[0].xyz,\\n u_highp[1].xyz,\\n u_highp[2].xyz\\n );\\n mat3 inverse_matrix = mat3(\\n u_highp[3].xyz,\\n u_highp[4].xyz,\\n vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)\\n );\\n\\n v_uv = (uv_matrix * vec3(a_vertex, 1.0)).xy;\\n v_uv += offset;\\n v_uv = (inverse_matrix * vec3(v_uv, 1.0)).xy;\\n"}}class wt{static TEMPLATE(t,e,i,s){const r=i?this.ATTRIBUTE_BEZIER_ON():"",n=i?this.VARYING_BEZIER_ON():e?this.VARYING_UV_ON():"",a=i?this.STATEMENT_BEZIER_ON():e?this.STATEMENT_UV_ON():"";return`#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n${r}\\n\\nuniform vec4 u_highp[${t}];\\n\\n${n}\\n\\n${s?Ft.FUNCTION_GRID_ON(e?5:0):Ft.FUNCTION_GRID_OFF()}\\n\\nvoid main() {\\n vec2 viewport = vec2(u_highp[0].w, u_highp[1].w);\\n\\n ${a}\\n\\n vec2 pos = applyMatrix(a_vertex) / viewport;\\n pos = pos * 2.0 - 1.0;\\n gl_Position = vec4(pos.x, -pos.y, 0.0, 1.0);\\n}\\n\\n`}static ATTRIBUTE_BEZIER_ON(){return"\\nlayout (location = 1) in vec2 a_bezier;\\n"}static VARYING_UV_ON(){return"\\nout vec2 v_uv;\\n"}static VARYING_BEZIER_ON(){return"\\nout vec2 v_bezier;\\n"}static STATEMENT_UV_ON(){return"\\n mat3 uv_matrix = mat3(\\n u_highp[0].xyz,\\n u_highp[1].xyz,\\n u_highp[2].xyz\\n );\\n mat3 inverse_matrix = mat3(\\n u_highp[3].xyz,\\n u_highp[4].xyz,\\n vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)\\n );\\n\\n v_uv = (inverse_matrix * uv_matrix * vec3(a_vertex, 1.0)).xy;\\n"}static STATEMENT_BEZIER_ON(){return"\\n v_bezier = a_bezier;\\n"}}class Rt{static FUNCTION_IS_INSIDE(){return"\\n\\nfloat isInside(in vec2 uv) {\\n return step(4.0, dot(step(vec4(0.0, uv.x, 0.0, uv.y), vec4(uv.x, 1.0, uv.y, 1.0)), vec4(1.0)));\\n}\\n\\n"}static STATEMENT_INSTANCED_COLOR_TRANSFORM_ON(){return"\\n src.rgb /= max(0.0001, src.a);\\n src = clamp(src * mul + add, 0.0, 1.0);\\n src.rgb *= src.a;\\n"}static STATEMENT_COLOR_TRANSFORM_ON(t){return`\\n vec4 mul = u_mediump[${t}];\\n vec4 add = u_mediump[${t+1}];\\n${Rt.STATEMENT_INSTANCED_COLOR_TRANSFORM_ON()}\\n`}}class It{static SOLID_COLOR(){return"#version 300 es\\nprecision mediump float;\\n\\nuniform vec4 u_mediump;\\n\\nout vec4 o_color;\\n\\nvoid main() {\\n o_color = vec4(u_mediump.rgb * u_mediump.a, u_mediump.a);\\n}\\n\\n"}static BITMAP_CLIPPED(){return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump[3];\\n\\nin vec2 v_uv;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 uv = vec2(v_uv.x, u_mediump[0].y - v_uv.y) / u_mediump[0].xy;\\n\\n vec4 src = texture(u_texture, uv);\\n ${Rt.STATEMENT_COLOR_TRANSFORM_ON(1)}\\n o_color = src;\\n}`}static BITMAP_PATTERN(){return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump[3];\\n\\nin vec2 v_uv;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 uv = fract(vec2(v_uv.x, -v_uv.y) / u_mediump[0].xy);\\n \\n vec4 src = texture(u_texture, uv);\\n ${Rt.STATEMENT_COLOR_TRANSFORM_ON(1)}\\n o_color = src;\\n}`}static MASK(){return"#version 300 es\\nprecision mediump float;\\n\\nin vec2 v_bezier;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 px = dFdx(v_bezier);\\n vec2 py = dFdy(v_bezier);\\n\\n vec2 f = (2.0 * v_bezier.x) * vec2(px.x, py.x) - vec2(px.y, py.y);\\n float alpha = 0.5 - (v_bezier.x * v_bezier.x - v_bezier.y) / length(f);\\n\\n if (alpha > 0.0) {\\n o_color = vec4(min(alpha, 1.0));\\n } else {\\n discard;\\n } \\n}\\n\\n"}}class Pt{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getSolidColorShapeShader(t,e){const i=`s${t?"y":"n"}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=(e?8:3)+(t?1:0),r=s;let n;n=t?Bt.TEMPLATE(s,r,!1,e):wt.TEMPLATE(s,!1,!1,e);const a=new St(this._$gl,this._$context,n,It.SOLID_COLOR());return this._$collection.set(i,a),a}getBitmapShapeShader(t,e,i){const s=`b${t?"y":"n"}${e?"y":"n"}${i?"y":"n"}`;if(this._$collection.has(s)){const t=this._$collection.get(s);if(t)return t}const r=(i?13:5)+(t?1:0),n=r;let a;a=t?Bt.TEMPLATE(r,n,!0,i):wt.TEMPLATE(r,!0,!1,i);const h=e?It.BITMAP_PATTERN():It.BITMAP_CLIPPED(),o=new St(this._$gl,this._$context,a,h);return this._$collection.set(s,o),o}getMaskShapeShader(t,e){const i=`m${t?"y":"n"}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=(e?8:3)+(t?1:0),r=s;let n;n=t?Bt.TEMPLATE(s,r,!1,e):wt.TEMPLATE(s,!1,!0,e);const a=new St(this._$gl,this._$context,n,It.MASK());return this._$collection.set(i,a),a}setSolidColorShapeUniform(t,e,i,s,r,n,a,h,o,_,l,c){const $=t.highp;let u;n?($[0]=_.parentMatrixA,$[1]=_.parentMatrixB,$[2]=_.parentMatrixC,$[4]=_.parentMatrixD,$[5]=_.parentMatrixE,$[6]=_.parentMatrixF,$[8]=_.parentMatrixG,$[9]=_.parentMatrixH,$[10]=_.parentMatrixI,$[12]=_.ancestorMatrixA,$[13]=_.ancestorMatrixB,$[14]=_.ancestorMatrixC,$[16]=_.ancestorMatrixD,$[17]=_.ancestorMatrixE,$[18]=_.ancestorMatrixF,$[20]=_.ancestorMatrixG,$[21]=_.ancestorMatrixH,$[22]=_.ancestorMatrixI,$[3]=h,$[7]=o,$[11]=_.parentViewportX,$[15]=_.parentViewportY,$[19]=_.parentViewportW,$[23]=_.parentViewportH,$[24]=_.minXST,$[25]=_.minYST,$[26]=_.minXPQ,$[27]=_.minYPQ,$[28]=_.maxXST,$[29]=_.maxYST,$[30]=_.maxXPQ,$[31]=_.maxYPQ,u=32):($[0]=a[0],$[1]=a[1],$[2]=a[2],$[4]=a[3],$[5]=a[4],$[6]=a[5],$[8]=a[6],$[9]=a[7],$[10]=a[8],$[3]=h,$[7]=o,u=12),e&&($[u]=i,$[u+1]=s,$[u+2]=r);const d=t.mediump;d[0]=l[0],d[1]=l[1],d[2]=l[2],d[3]=l[3]*c}setBitmapShapeUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f,m,p,x,b){const v=t.highp;let T;v[0]=a[0],v[1]=a[1],v[2]=a[2],v[4]=a[3],v[5]=a[4],v[6]=a[5],v[8]=a[6],v[9]=a[7],v[10]=a[8],v[12]=h[0],v[13]=h[1],v[14]=h[2],v[16]=h[3],v[17]=h[4],v[18]=h[5],v[11]=h[6],v[15]=h[7],v[19]=h[8],v[3]=o,v[7]=_,T=20,n&&(v[T]=l.parentMatrixA,v[T+1]=l.parentMatrixB,v[T+2]=l.parentMatrixC,v[T+4]=l.parentMatrixD,v[T+5]=l.parentMatrixE,v[T+6]=l.parentMatrixF,v[T+8]=l.parentMatrixG,v[T+9]=l.parentMatrixH,v[T+10]=l.parentMatrixI,v[T+12]=l.ancestorMatrixA,v[T+13]=l.ancestorMatrixB,v[T+14]=l.ancestorMatrixC,v[T+16]=l.ancestorMatrixD,v[T+17]=l.ancestorMatrixE,v[T+18]=l.ancestorMatrixF,v[T+20]=l.ancestorMatrixG,v[T+21]=l.ancestorMatrixH,v[T+22]=l.ancestorMatrixI,v[T+11]=l.parentViewportX,v[T+15]=l.parentViewportY,v[T+19]=l.parentViewportW,v[T+23]=l.parentViewportH,v[T+24]=l.minXST,v[T+25]=l.minYST,v[T+26]=l.minXPQ,v[T+27]=l.minYPQ,v[T+28]=l.maxXST,v[T+29]=l.maxYST,v[T+30]=l.maxXPQ,v[T+31]=l.maxYPQ,T=52),e&&(v[T]=i,v[T+1]=s,v[T+2]=r);const A=t.mediump;A[0]=c,A[1]=$,A[4]=u,A[5]=d,A[6]=g,A[7]=f,A[8]=m,A[9]=p,A[10]=x,A[11]=b}setMaskShapeUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u=null){const d=t.highp;e&&u?(d[0]=u.parentMatrixA,d[1]=u.parentMatrixB,d[2]=u.parentMatrixC,d[4]=u.parentMatrixD,d[5]=u.parentMatrixE,d[6]=u.parentMatrixF,d[8]=u.parentMatrixG,d[9]=u.parentMatrixH,d[10]=u.parentMatrixI,d[12]=u.ancestorMatrixA,d[13]=u.ancestorMatrixB,d[14]=u.ancestorMatrixC,d[16]=u.ancestorMatrixD,d[17]=u.ancestorMatrixE,d[18]=u.ancestorMatrixF,d[20]=u.ancestorMatrixG,d[21]=u.ancestorMatrixH,d[22]=u.ancestorMatrixI,d[3]=c,d[7]=$,d[11]=u.parentViewportX,d[15]=u.parentViewportY,d[19]=u.parentViewportW,d[23]=u.parentViewportH,d[24]=u.minXST,d[25]=u.minYST,d[26]=u.minXPQ,d[27]=u.minYPQ,d[28]=u.maxXST,d[29]=u.maxYST,d[30]=u.maxXPQ,d[31]=u.maxYPQ):(d[0]=i,d[1]=s,d[2]=r,d[4]=n,d[5]=a,d[6]=h,d[8]=o,d[9]=_,d[10]=l,d[3]=c,d[7]=$)}setMaskShapeUniformIdentity(t,e,i){const s=t.highp;s[0]=1,s[1]=0,s[2]=0,s[4]=0,s[5]=1,s[6]=0,s[8]=0,s[9]=0,s[10]=1,s[3]=e,s[7]=i}}class Nt{static TEMPLATE(t,e,i,s,r){const n=i?this.STATEMENT_GRADIENT_TYPE_RADIAL(e,s):this.STATEMENT_GRADIENT_TYPE_LINEAR(e);let a;switch(r){case"reflect":a="1.0 - abs(fract(t * 0.5) * 2.0 - 1.0)";break;case"repeat":a="fract(t)";break;default:a="clamp(t, 0.0, 1.0)"}return`#version 300 es\\nprecision highp float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_highp[${t}];\\n\\nin vec2 v_uv;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 p = v_uv;\\n ${n}\\n t = ${a};\\n o_color = texture(u_texture, vec2(t, 0.5));\\n}\\n\\n`}static STATEMENT_GRADIENT_TYPE_LINEAR(t){return`\\n vec2 a = u_highp[${t}].xy;\\n vec2 b = u_highp[${t}].zw;\\n\\n vec2 ab = b - a;\\n vec2 ap = p - a;\\n\\n float t = dot(ab, ap) / dot(ab, ab);\\n`}static STATEMENT_GRADIENT_TYPE_RADIAL(t,e){return`\\n float radius = u_highp[${t}][0];\\n\\n vec2 coord = p / radius;\\n ${e?this.STATEMENT_FOCAL_POINT_ON(t):this.STATEMENT_FOCAL_POINT_OFF()}\\n`}static STATEMENT_FOCAL_POINT_OFF(){return"\\n float t = length(coord);\\n"}static STATEMENT_FOCAL_POINT_ON(t){return`\\n vec2 focal = vec2(u_highp[${t}][1], 0.0);\\n\\n vec2 dir = normalize(coord - focal);\\n\\n float a = dot(dir, dir);\\n float b = 2.0 * dot(dir, focal);\\n float c = dot(focal, focal) - 1.0;\\n float x = (-b + sqrt(b * b - 4.0 * a * c)) / (2.0 * a);\\n\\n float t = distance(focal, coord) / distance(focal, focal + dir * x);\\n`}}class kt{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getGradientShapeShader(t,e,i,s,r){const n=this.createCollectionKey(t,e,i,s,r);if(this._$collection.has(n)){const t=this._$collection.get(n);if(t)return t}const a=(e?13:5)+(t?1:0)+1,h=a-1;let o;o=t?Bt.TEMPLATE(a,h,!0,e):wt.TEMPLATE(a,!0,!1,e);const _=new St(this._$gl,this._$context,o,Nt.TEMPLATE(a,h,i,s,r));return this._$collection.set(n,_),_}createCollectionKey(t,e,i,s,r){const n=t?"y":"n",a=e?"y":"n",h=i?"y":"n",o=i&&s?"y":"n";let _=0;switch(r){case"reflect":_=1;break;case"repeat":_=2}return`${n}${a}${h}${o}${_}`}setGradientShapeUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u){const d=t.highp;d[0]=a[0],d[1]=a[1],d[2]=a[2],d[4]=a[3],d[5]=a[4],d[6]=a[5],d[8]=a[6],d[9]=a[7],d[10]=a[8],d[12]=h[0],d[13]=h[1],d[14]=h[2],d[16]=h[3],d[17]=h[4],d[18]=h[5],d[11]=h[6],d[15]=h[7],d[19]=h[8],d[3]=o,d[7]=_;let g=20;n&&(d[g]=l.parentMatrixA,d[g+1]=l.parentMatrixB,d[g+2]=l.parentMatrixC,d[g+4]=l.parentMatrixD,d[g+5]=l.parentMatrixE,d[g+6]=l.parentMatrixF,d[g+8]=l.parentMatrixG,d[g+9]=l.parentMatrixH,d[g+10]=l.parentMatrixI,d[g+12]=l.ancestorMatrixA,d[g+13]=l.ancestorMatrixB,d[g+14]=l.ancestorMatrixC,d[g+16]=l.ancestorMatrixD,d[g+17]=l.ancestorMatrixE,d[g+18]=l.ancestorMatrixF,d[g+20]=l.ancestorMatrixG,d[g+21]=l.ancestorMatrixH,d[g+22]=l.ancestorMatrixI,d[g+11]=l.parentViewportX,d[g+15]=l.parentViewportY,d[g+19]=l.parentViewportW,d[g+23]=l.parentViewportH,d[g+24]=l.minXST,d[g+25]=l.minYST,d[g+26]=l.minXPQ,d[g+27]=l.minYPQ,d[g+28]=l.maxXST,d[g+29]=l.maxYST,d[g+30]=l.maxXPQ,d[g+31]=l.maxYPQ,g=52),e&&(d[g]=i,d[g+1]=s,d[g+2]=r,g+=4),c?(d[g]=$[5],d[g+1]=u):(d[g]=$[0],d[g+1]=$[1],d[g+2]=$[2],d[g+3]=$[3])}}class Lt{static TEXTURE(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n\\nout vec2 v_coord;\\n\\nvoid main() {\\n v_coord = a_vertex;\\n\\n vec2 position = a_vertex * 2.0 - 1.0;\\n gl_Position = vec4(position, 0.0, 1.0);\\n}\\n\\n"}static BLEND(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n\\nuniform vec4 u_highp[4];\\n\\nout vec2 v_coord;\\n\\nvoid main() {\\n v_coord = a_vertex;\\n\\n vec2 offset = u_highp[0].xy;\\n vec2 size = u_highp[0].zw;\\n mat3 matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\\n\\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\\n position = position * size + offset;\\n position = (matrix * vec3(position, 1.0)).xy;\\n position /= viewport;\\n\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n"}static INSTANCE_BLEND(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n\\nuniform vec4 u_highp[5];\\n\\nout vec2 v_src_coord;\\nout vec2 v_dst_coord;\\n\\nvoid main() {\\n vec4 rect = vec4(u_highp[0].x, u_highp[0].y, u_highp[0].z, u_highp[0].w);\\n vec2 size = vec2(u_highp[4].x, u_highp[4].y);\\n mat3 matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\\n\\n v_src_coord = a_vertex * rect.zw + rect.xy;\\n v_dst_coord = a_vertex;\\n\\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\\n position = position * size;\\n position = (matrix * vec3(position, 1.0)).xy;\\n position /= viewport;\\n\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n"}static INSTANCE(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\nlayout (location = 1) in vec4 a_rect;\\nlayout (location = 2) in vec4 a_size;\\nlayout (location = 3) in vec2 a_offset;\\nlayout (location = 4) in vec4 a_matrix;\\nlayout (location = 5) in vec4 a_mul;\\nlayout (location = 6) in vec4 a_add;\\n\\nout vec2 v_coord;\\nout vec4 mul;\\nout vec4 add;\\n\\nvoid main() {\\n v_coord = a_vertex * a_rect.zw + a_rect.xy;\\n mul = a_mul;\\n add = a_add;\\n\\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\\n position = position * a_size.xy;\\n mat3 matrix = mat3(a_matrix.x, a_matrix.y, 0.0, a_matrix.z, a_matrix.w, 0.0, a_offset.x, a_offset.y, 1.0);\\n position = (matrix * vec3(position, 1.0)).xy;\\n position /= a_size.zw;\\n\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n"}static BLEND_CLIP(){return"#version 300 es\\n\\nlayout (location = 0) in vec2 a_vertex;\\n\\nuniform vec4 u_highp[4];\\n\\nout vec2 v_coord;\\n\\nvoid main() {\\n v_coord = a_vertex;\\n\\n vec2 offset = u_highp[0].xy;\\n vec2 size = u_highp[0].zw;\\n mat3 inv_matrix = mat3(u_highp[1].xyz, u_highp[2].xyz, u_highp[3].xyz);\\n vec2 viewport = vec2(u_highp[1].w, u_highp[2].w);\\n\\n vec2 position = vec2(a_vertex.x, 1.0 - a_vertex.y);\\n position *= viewport;\\n position = (inv_matrix * vec3(position, 1.0)).xy;\\n position = (position - offset) / size;\\n\\n position = position * 2.0 - 1.0;\\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\\n}\\n\\n"}}class Ot{static TEMPLATE(t,e,i){let s="";for(let t=1;t<e;t++){const i=t-1,n=t,a=`u_mediump[${e+r.floor(i/4)}][${i%4}]`,h=`u_mediump[${e+r.floor(n/4)}][${n%4}]`;s+=`\\n if (t <= ${h}) {\\n return mix(u_mediump[${i}], u_mediump[${n}], (t - ${a}) / (${h} - ${a}));\\n }\\n`}return`#version 300 es\\nprecision mediump float;\\n\\nuniform vec4 u_mediump[${t}];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvec4 getGradientColor(in float t) {\\n if (t <= u_mediump[${e}][0]) {\\n return u_mediump[0];\\n }\\n ${s}\\n return u_mediump[${e-1}];\\n}\\n\\nvoid main() {\\n vec4 color = getGradientColor(v_coord.x);\\n ${i?"color = pow(color, vec4(0.45454545));":""}\\n color.rgb *= color.a;\\n\\n o_color = color;\\n}\\n\\n`}}class Ut{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getGradientLUTShader(t,e){const i=`l${("00"+t).slice(-3)}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=r.ceil(5*t/4),n=new St(this._$gl,this._$context,Lt.TEXTURE(),Ot.TEMPLATE(s,t,e));return this._$collection.set(i,n),n}setGradientLUTUniformForShape(t,e,i,s,r){let n=0;const a=t.mediump;for(let t=i;t<s;t++){const i=e[t][1];a[n++]=r[i[0]],a[n++]=r[i[1]],a[n++]=r[i[2]],a[n++]=r[i[3]]}for(let t=i;t<s;t++)a[n++]=e[t][0]}setGradientLUTUniformForFilter(t,e,i,s,r,n){let a=0;const h=t.mediump;for(let t=r;t<n;t++){const e=i[t];h[a++]=(e>>16)/255,h[a++]=(e>>8&255)/255,h[a++]=(255&e)/255,h[a++]=s[t]}for(let t=r;t<n;t++)h[a++]=e[t]}}class Dt{static TEMPLATE(t,e,i,s,r,n,a,h,o){let _=0;const l=i?this.STATEMENT_BASE_TEXTURE_TRANSFORM(_++):"",c=s?this.STATEMENT_BLUR_TEXTURE_TRANSFORM(_++):this.STATEMENT_BLUR_TEXTURE(),$="inner"===n,u=_;let d,g,f=4*_;switch(o?d=r?this.STATEMENT_GLOW(!1,i,h,o,u,f):this.STATEMENT_BEVEL(i,s,h,o,u,f):r?(f+=4,d=this.STATEMENT_GLOW($,i,h,o,u,f)):(f+=8,d=this.STATEMENT_BEVEL(i,s,h,o,u,f)),n){case"outer":g=a?"blur - blur * base.a":"base + blur - blur * base.a";break;case"full":g=a?"blur":"base - base * blur.a + blur";break;default:g="blur"}return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_textures[${t}];\\nuniform vec4 u_mediump[${e}];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\n${Rt.FUNCTION_IS_INSIDE()}\\n\\nvoid main() {\\n ${l}\\n ${c}\\n ${d}\\n o_color = ${g};\\n}\\n\\n`}static STATEMENT_BASE_TEXTURE_TRANSFORM(t){return`\\n vec2 base_scale = u_mediump[${t}].xy;\\n vec2 base_offset = u_mediump[${t}].zw;\\n\\n vec2 uv = v_coord * base_scale - base_offset;\\n vec4 base = mix(vec4(0.0), texture(u_textures[1], uv), isInside(uv));\\n`}static STATEMENT_BLUR_TEXTURE(){return"\\n vec4 blur = texture(u_textures[0], v_coord);\\n"}static STATEMENT_BLUR_TEXTURE_TRANSFORM(t){return`\\n vec2 blur_scale = u_mediump[${t}].xy;\\n vec2 blur_offset = u_mediump[${t}].zw;\\n\\n vec2 st = v_coord * blur_scale - blur_offset;\\n vec4 blur = mix(vec4(0.0), texture(u_textures[0], st), isInside(st));\\n`}static STATEMENT_GLOW(t,e,i,s,r,n){return`\\n ${t?"blur.a = 1.0 - blur.a;":""}\\n ${i?this.STATEMENT_GLOW_STRENGTH(n):""}\\n ${s?this.STATEMENT_GLOW_GRADIENT_COLOR(e):this.STATEMENT_GLOW_SOLID_COLOR(r)}\\n`}static STATEMENT_GLOW_STRENGTH(t){return`\\n float strength = u_mediump[${r.floor(t/4)}][${t%4}];\\n blur.a = clamp(blur.a * strength, 0.0, 1.0);\\n`}static STATEMENT_GLOW_SOLID_COLOR(t){return`\\n vec4 color = u_mediump[${t}];\\n blur = color * blur.a;\\n`}static STATEMENT_GLOW_GRADIENT_COLOR(t){return`\\n blur = texture(u_textures[${t?2:1}], vec2(blur.a, 0.5));\\n`}static STATEMENT_BEVEL(t,e,i,s,r,n){return`\\n ${e?this.STATEMENT_BLUR_TEXTURE_TRANSFORM_2():this.STATEMENT_BLUR_TEXTURE_2()}\\n float highlight_alpha = blur.a - blur2.a;\\n float shadow_alpha = blur2.a - blur.a;\\n ${i?this.STATEMENT_BEVEL_STRENGTH(n):""}\\n highlight_alpha = clamp(highlight_alpha, 0.0, 1.0);\\n shadow_alpha = clamp(shadow_alpha, 0.0, 1.0);\\n ${s?this.STATEMENT_BEVEL_GRADIENT_COLOR(t):this.STATEMENT_BEVEL_SOLID_COLOR(r)}\\n`}static STATEMENT_BLUR_TEXTURE_2(){return"\\n vec4 blur2 = texture(u_textures[0], 1.0 - v_coord);\\n"}static STATEMENT_BLUR_TEXTURE_TRANSFORM_2(){return"\\n vec2 pq = (1.0 - v_coord) * blur_scale - blur_offset;\\n vec4 blur2 = mix(vec4(0.0), texture(u_textures[0], pq), isInside(pq));\\n"}static STATEMENT_BEVEL_STRENGTH(t){return`\\n float strength = u_mediump[${r.floor(t/4)}][${t%4}];\\n highlight_alpha *= strength;\\n shadow_alpha *= strength;\\n`}static STATEMENT_BEVEL_SOLID_COLOR(t){return`\\n vec4 highlight_color = u_mediump[${t}];\\n vec4 shadow_color = u_mediump[${t+1}];\\n blur = highlight_color * highlight_alpha + shadow_color * shadow_alpha;\\n`}static STATEMENT_BEVEL_GRADIENT_COLOR(t){return`\\n blur = texture(u_textures[${t?2:1}], vec2(\\n 0.5019607843137255 - 0.5019607843137255 * shadow_alpha + 0.4980392156862745 * highlight_alpha,\\n 0.5\\n ));\\n`}}class Xt{static TEMPLATE(t){const e=t.toFixed(1);return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump;\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec2 offset = u_mediump.xy;\\n float fraction = u_mediump.z;\\n float samples = u_mediump.w;\\n \\n vec4 color = texture(u_texture, v_coord);\\n\\n for (float i = 1.0; i < ${e}; i += 1.0) {\\n color += texture(u_texture, v_coord + offset * i);\\n color += texture(u_texture, v_coord - offset * i);\\n }\\n color += texture(u_texture, v_coord + offset * ${e}) * fraction;\\n color += texture(u_texture, v_coord - offset * ${e}) * fraction;\\n color /= samples;\\n\\n o_color = color;\\n}\\n\\n`}}class Vt{static TEMPLATE(){return"#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump[5];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvoid main() {\\n mat4 mul = mat4(u_mediump[0], u_mediump[1], u_mediump[2], u_mediump[3]);\\n vec4 add = u_mediump[4];\\n \\n vec4 color = texture(u_texture, v_coord);\\n\\n color.rgb /= max(0.0001, color.a);\\n color = clamp(color * mul + add, 0.0, 1.0);\\n color.rgb *= color.a;\\n\\n o_color = color;\\n}\\n\\n"}}class Yt{static TEMPLATE(t,e,i,s,n){const a=r.floor(.5*e),h=r.floor(.5*i),o=e*i;let _="";const l=n?1:2;for(let t=0;t<o;++t)_+=`\\n result += getWeightedColor(${t}, u_mediump[${l+r.floor(t/4)}][${t%4}]);\\n`;const c=s?"result.a = texture(u_texture, v_coord).a;":"",$=n?"":"\\n vec4 substitute_color = u_mediump[1];\\n color = mix(substitute_color, color, isInside(uv));\\n";return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\nuniform vec4 u_mediump[${t}];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\n${Rt.FUNCTION_IS_INSIDE()}\\n\\nvec4 getWeightedColor (in int i, in float weight) {\\n vec2 rcp_size = u_mediump[0].xy;\\n\\n int i_div_x = i / ${e};\\n int i_mod_x = i - ${e} * i_div_x;\\n vec2 offset = vec2(i_mod_x - ${a}, ${h} - i_div_x);\\n vec2 uv = v_coord + offset * rcp_size;\\n\\n vec4 color = texture(u_texture, uv);\\n color.rgb /= max(0.0001, color.a);\\n ${$}\\n\\n return color * weight;\\n}\\n\\nvoid main() {\\n float rcp_divisor = u_mediump[0].z;\\n float bias = u_mediump[0].w;\\n\\n vec4 result = vec4(0.0);\\n ${_}\\n result = clamp(result * rcp_divisor + bias, 0.0, 1.0);\\n ${c}\\n\\n result.rgb *= result.a;\\n o_color = result;\\n}\\n\\n`}}class zt{static TEMPLATE(t,e,i,s){let r,n,a;switch(e){case 1:r="map_color.r";break;case 2:r="map_color.g";break;case 4:r="map_color.b";break;case 8:r="map_color.a";break;default:r="0.5"}switch(i){case 1:n="map_color.r";break;case 2:n="map_color.g";break;case 4:n="map_color.b";break;case 8:n="map_color.a";break;default:n="0.5"}switch(s){case"clamp":a="\\n vec4 source_color = texture(u_textures[0], uv);\\n";break;case"ignore":a="\\n vec4 source_color =texture(u_textures[0], mix(v_coord, uv, step(abs(uv - vec2(0.5)), vec2(0.5))));\\n";break;case"color":a="\\n vec4 substitute_color = u_mediump[2];\\n vec4 source_color = mix(substitute_color, texture(u_textures[0], uv), isInside(uv));\\n";break;default:a="\\n vec4 source_color = texture(u_textures[0], fract(uv));\\n"}return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_textures[2];\\nuniform vec4 u_mediump[${t}];\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\n${Rt.FUNCTION_IS_INSIDE()}\\n\\nvoid main() {\\n vec2 uv_to_st_scale = u_mediump[0].xy;\\n vec2 uv_to_st_offset = u_mediump[0].zw;\\n vec2 scale = u_mediump[1].xy;\\n\\n vec2 st = v_coord * uv_to_st_scale - uv_to_st_offset;\\n vec4 map_color = texture(u_textures[1], st);\\n\\n vec2 offset = vec2(${r}, ${n}) - 0.5;\\n vec2 uv = v_coord + offset * scale;\\n ${a}\\n\\n o_color = mix(texture(u_textures[0], v_coord), source_color, isInside(st));\\n}\\n\\n`}}class Gt{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getBlurFilterShader(t){const e=`b${t}`;if(this._$collection.has(e)){const t=this._$collection.get(e);if(t)return t}const i=new St(this._$gl,this._$context,Lt.TEXTURE(),Xt.TEMPLATE(t));return this._$collection.set(e,i),i}getBitmapFilterShader(t,e,i,s,n,a,h){const o=`f${t?"y":"n"}${e?"y":"n"}${i?"y":"n"}${s}${n?"y":"n"}${a?"y":"n"}`;if(this._$collection.has(o)){const t=this._$collection.get(o);if(t)return t}let _=1;t&&_++,h&&_++;let l=(t?4:0)+(e?4:0)+(a?1:0);h||(l+=i?4:8),l=r.ceil(l/4);const c=new St(this._$gl,this._$context,Lt.TEXTURE(),Dt.TEMPLATE(_,l,t,e,i,s,n,a,h));return this._$collection.set(o,c),c}getColorMatrixFilterShader(){if(this._$collection.has("m")){const t=this._$collection.get("m");if(t)return t}const t=new St(this._$gl,this._$context,Lt.TEXTURE(),Vt.TEMPLATE());return this._$collection.set("m",t),t}getConvolutionFilterShader(t,e,i,s){const n=`c${("0"+t).slice(-2)}${("0"+e).slice(-2)}${i?"y":"n"}${s?"y":"n"}`;if(this._$collection.has(n)){const t=this._$collection.get(n);if(t)return t}const a=(s?1:2)+r.ceil(t*e/4),h=new St(this._$gl,this._$context,Lt.TEXTURE(),Yt.TEMPLATE(a,t,e,i,s));return this._$collection.set(n,h),h}getDisplacementMapFilterShader(t,e,i){const s=`d${t}${e}${i}`;if(this._$collection.has(s)){const t=this._$collection.get(s);if(t)return t}const r="color"===i?3:2,n=new St(this._$gl,this._$context,Lt.TEXTURE(),zt.TEMPLATE(r,t,e,i));return this._$collection.set(s,n),n}setBlurFilterUniform(t,e,i,s,r,n){const a=t.mediump;s?(a[0]=1/e,a[1]=0):(a[0]=0,a[1]=1/i),a[2]=r,a[3]=n}setBitmapFilterUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f,m,p,x,b,v,T,A,M){let y;v?(y=t.textures,y[0]=0,y[1]=1,M&&(y[2]=2)):M&&(y=t.textures,y[0]=0,y[1]=2);const E=t.mediump;let C=0;v&&(E[C]=e/s,E[C+1]=i/r,E[C+2]=n/s,E[C+3]=(i-r-a)/r,C+=4),T&&(E[C]=e/h,E[C+1]=i/o,E[C+2]=_/h,E[C+3]=(i-o-l)/o,C+=4),M||(c?(E[C]=u,E[C+1]=d,E[C+2]=g,E[C+3]=f,C+=4):(E[C]=u,E[C+1]=d,E[C+2]=g,E[C+3]=f,E[C+4]=m,E[C+5]=p,E[C+6]=x,E[C+7]=b,C+=8)),A&&(E[C]=$)}setColorMatrixFilterUniform(t,e){const i=t.mediump;i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[5],i[5]=e[6],i[6]=e[7],i[7]=e[8],i[8]=e[10],i[9]=e[11],i[10]=e[12],i[11]=e[13],i[12]=e[15],i[13]=e[16],i[14]=e[17],i[15]=e[18],i[16]=e[4]/255,i[17]=e[9]/255,i[18]=e[14]/255,i[19]=e[19]/255}setConvolutionFilterUniform(t,e,i,s,r,n,a,h,o,_,l){const c=t.mediump;c[0]=1/e,c[1]=1/i,c[2]=1/r,c[3]=n/255;let $=4;a||(c[$]=h,c[$+1]=o,c[$+2]=_,c[$+3]=l,$+=4);const u=s.length;for(let t=0;t<u;t++)c[$++]=s[t]}setDisplacementMapFilterUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u){const d=t.textures;d[0]=0,d[1]=1;const g=t.mediump;g[0]=s/e,g[1]=r/i,g[2]=n/e,g[3]=(r-i-a)/i,g[4]=h/s,g[5]=-o/r,"color"===_&&(g[8]=l,g[9]=c,g[10]=$,g[11]=u)}}class Ht{static TEMPLATE(t){return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\n${t?"uniform vec4 u_mediump[2];":""}\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec4 src = texture(u_texture, v_coord);\\n ${t?Rt.STATEMENT_COLOR_TRANSFORM_ON(0):""}\\n o_color = src;\\n}\\n\\n`}static INSTANCE_TEMPLATE(){return"#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_texture;\\n\\nin vec4 mul;\\nin vec4 add;\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\nvoid main() {\\n vec4 src = texture(u_texture, v_coord);\\n\\n if (mul.x != 1.0 || mul.y != 1.0 || mul.z != 1.0 || mul.w != 1.0\\n || add.x != 0.0 || add.y != 0.0 || add.z != 0.0 || add.w != 0.0\\n ) {\\n src.rgb /= max(0.0001, src.a);\\n src = clamp(src * mul + add, 0.0, 1.0);\\n src.rgb *= src.a;\\n }\\n \\n o_color = src;\\n}\\n\\n"}}class Wt{static TEMPLATE(t,e){let i;switch(t){case"subtract":i=this.FUNCTION_SUBTRACT();break;case"multiply":i=this.FUNCTION_MULTIPLY();break;case"lighten":i=this.FUNCTION_LIGHTEN();break;case"darken":i=this.FUNCTION_DARKEN();break;case"overlay":i=this.FUNCTION_OVERLAY();break;case"hardlight":i=this.FUNCTION_HARDLIGHT();break;case"difference":i=this.FUNCTION_DIFFERENCE();break;case"invert":i=this.FUNCTION_INVERT();break;default:i=this.FUNCTION_NORMAL()}return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_textures[2];\\n${e?"uniform vec4 u_mediump[2];":""}\\n\\nin vec2 v_coord;\\nout vec4 o_color;\\n\\n${i}\\n\\nvoid main() {\\n vec4 dst = texture(u_textures[0], v_coord);\\n vec4 src = texture(u_textures[1], v_coord);\\n ${e?Rt.STATEMENT_COLOR_TRANSFORM_ON(0):""}\\n o_color = blend(src, dst);\\n}\\n\\n`}static INSTANCE_TEMPLATE(t,e){let i;switch(t){case"subtract":i=this.FUNCTION_SUBTRACT();break;case"multiply":i=this.FUNCTION_MULTIPLY();break;case"lighten":i=this.FUNCTION_LIGHTEN();break;case"darken":i=this.FUNCTION_DARKEN();break;case"overlay":i=this.FUNCTION_OVERLAY();break;case"hardlight":i=this.FUNCTION_HARDLIGHT();break;case"difference":i=this.FUNCTION_DIFFERENCE();break;case"invert":i=this.FUNCTION_INVERT();break;default:i=this.FUNCTION_NORMAL()}return`#version 300 es\\nprecision mediump float;\\n\\nuniform sampler2D u_textures[2];\\n${e?"uniform vec4 u_mediump[2];":""}\\n\\nin vec2 v_src_coord;\\nin vec2 v_dst_coord;\\nout vec4 o_color;\\n\\n${i}\\n\\nvoid main() {\\n vec4 dst = texture(u_textures[0], v_dst_coord);\\n vec4 src = texture(u_textures[1], v_src_coord);\\n ${e?Rt.STATEMENT_COLOR_TRANSFORM_ON(0):""}\\n o_color = blend(src, dst);\\n}\\n\\n`}static FUNCTION_NORMAL(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n return src + dst - dst * src.a;\\n}\\n\\n"}static FUNCTION_SUBTRACT(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 c = vec4(dst.rgb - src.rgb, src.a * dst.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_MULTIPLY(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n vec4 c = src * dst;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_LIGHTEN(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 c = vec4(mix(src.rgb, dst.rgb, step(src.rgb, dst.rgb)), src.a * dst.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_DARKEN(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 c = vec4(mix(src.rgb, dst.rgb, step(dst.rgb, src.rgb)), src.a * dst.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_OVERLAY(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 mul = src * dst;\\n vec3 c1 = 2.0 * mul.rgb;\\n vec3 c2 = 2.0 * (src.rgb + dst.rgb - mul.rgb) - 1.0;\\n vec4 c = vec4(mix(c1, c2, step(vec3(0.5), dst.rgb)), mul.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_HARDLIGHT(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 mul = src * dst;\\n vec3 c1 = 2.0 * mul.rgb;\\n vec3 c2 = 2.0 * (src.rgb + dst.rgb - mul.rgb) - 1.0;\\n vec4 c = vec4(mix(c1, c2, step(vec3(0.5), src.rgb)), mul.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_DIFFERENCE(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 a = src - src * dst.a;\\n vec4 b = dst - dst * src.a;\\n\\n src.rgb /= src.a;\\n dst.rgb /= dst.a;\\n\\n vec4 c = vec4(abs(src.rgb - dst.rgb), src.a * dst.a);\\n c.rgb *= c.a;\\n\\n return a + b + c;\\n}\\n\\n"}static FUNCTION_INVERT(){return"\\n\\nvec4 blend (in vec4 src, in vec4 dst) {\\n if (src.a == 0.0) { return dst; }\\n if (dst.a == 0.0) { return src; }\\n\\n vec4 b = dst - dst * src.a;\\n vec4 c = vec4(src.a - dst.rgb * src.a, src.a);\\n\\n return b + c;\\n}\\n\\n"}}class qt{constructor(t,e){this._$context=t,this._$gl=e,this._$collection=D()}getInstanceShader(){if(this._$collection.has("i")){const t=this._$collection.get("i");if(t)return t}const t=new St(this._$gl,this._$context,Lt.INSTANCE(),Ht.INSTANCE_TEMPLATE());return this._$collection.set("i",t),t}getNormalBlendShader(t){const e="n"+(t?"y":"n");if(this._$collection.has(e)){const t=this._$collection.get(e);if(t)return t}const i=new St(this._$gl,this._$context,Lt.BLEND(),Ht.TEMPLATE(t));return this._$collection.set(e,i),i}getClipShader(){if(this._$collection.has("c")){const t=this._$collection.get("c");if(t)return t}const t=new St(this._$gl,this._$context,Lt.BLEND_CLIP(),Ht.TEMPLATE(!1));return this._$collection.set("c",t),t}getBlendShader(t,e){const i=`${t}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=new St(this._$gl,this._$context,Lt.BLEND(),Wt.TEMPLATE(t,e));return this._$collection.set(i,s),s}getInstanceBlendShader(t,e){const i=`i${t}${e?"y":"n"}`;if(this._$collection.has(i)){const t=this._$collection.get(i);if(t)return t}const s=new St(this._$gl,this._$context,Lt.INSTANCE_BLEND(),Wt.INSTANCE_TEMPLATE(t,e));return this._$collection.set(i,s),s}setNormalBlendUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f){const m=t.highp;if(m[0]=e,m[1]=i,m[2]=s,m[3]=r,m[4]=n[0],m[5]=n[1],m[6]=n[2],m[8]=n[3],m[9]=n[4],m[10]=n[5],m[12]=n[6],m[13]=n[7],m[14]=n[8],m[7]=a,m[11]=h,o){const e=t.mediump;e[0]=_,e[1]=l,e[2]=c,e[3]=$,e[4]=u,e[5]=d,e[6]=g,e[7]=f}}pushNormalBlend(t,e,i,s,r,n,a,h,o=1,_=1,l=1,c=1,$=0,u=0,d=0,g=0){t.attributes.push(e/pt,i/pt,s/pt,r/pt,s,r,a,h,n[6],n[7],n[0],n[1],n[3],n[4],o,_,l,c,$,u,d,g),t.count++}setClipUniform(t,e,i,s,r,n,a,h){const o=t.highp;o[0]=e,o[1]=i,o[2]=s,o[3]=r,o[4]=n[0],o[5]=n[1],o[6]=n[2],o[8]=n[3],o[9]=n[4],o[10]=n[5],o[12]=n[6],o[13]=n[7],o[14]=n[8],o[7]=a,o[11]=h}setInstanceBlendUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f,m,p){const x=t.textures;x[0]=0,x[1]=1;const b=t.highp;if(b[0]=e,b[1]=i,b[2]=s,b[3]=r,b[4]=h[0],b[5]=h[1],b[6]=h[2],b[8]=h[3],b[9]=h[4],b[10]=h[5],b[12]=h[6],b[13]=h[7],b[14]=h[8],b[7]=o,b[11]=_,b[16]=n,b[17]=a,l){const e=t.mediump;e[0]=c,e[1]=$,e[2]=u,e[3]=d,e[4]=g,e[5]=f,e[6]=m,e[7]=p}}setBlendUniform(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g,f){const m=t.textures;m[0]=0,m[1]=1;const p=t.highp;if(p[0]=e,p[1]=i,p[2]=s,p[3]=r,p[4]=n[0],p[5]=n[1],p[6]=n[2],p[8]=n[3],p[9]=n[4],p[10]=n[5],p[12]=n[6],p[13]=n[7],p[14]=n[8],p[7]=a,p[11]=h,o){const e=t.mediump;e[0]=_,e[1]=l,e[2]=c,e[3]=$,e[4]=u,e[5]=d,e[6]=g,e[7]=f}}}class jt{constructor(t,e){this._$currentProgramId=-1,this._$shapeShaderVariants=new Pt(t,e),this._$gradientShapeShaderVariants=new kt(t,e),this._$gradientLUTShaderVariants=new Ut(t,e),this._$filterShaderVariants=new Gt(t,e),this._$blendShaderVariants=new qt(t,e)}get currentProgramId(){return this._$currentProgramId}set currentProgramId(t){this._$currentProgramId=t}get shapeShaderVariants(){return this._$shapeShaderVariants}get gradientShapeShaderVariants(){return this._$gradientShapeShaderVariants}get gradientLUTShaderVariants(){return this._$gradientLUTShaderVariants}get filterShaderVariants(){return this._$filterShaderVariants}get blendShaderVariants(){return this._$blendShaderVariants}}class Kt{constructor(t,e){this._$context=t,this._$gl=e,this._$attachment=t.frameBuffer.createTextureAttachment(512,1),this._$maxLength=r.floor(.75*e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),this._$rgbToLinearTable=new Float32Array(256),this._$rgbIdentityTable=new Float32Array(256);for(let t=0;t<256;t++){const e=t/255;this._$rgbToLinearTable[t]=r.pow(e,2.23333333),this._$rgbIdentityTable[t]=e}}generateForShape(t,e){const i=this._$context.frameBuffer.currentAttachment,s=this._$context.cachePosition;s&&this._$gl.disable(this._$gl.SCISSOR_TEST),this._$context._$bind(this._$attachment);const n=t.length,a=this._$context.shaderList.gradientLUTShaderVariants,h=e?this._$rgbToLinearTable:this._$rgbIdentityTable;this._$context.blend.toOneZero();for(let i=0;i<n;i+=this._$maxLength-1){const s=r.min(i+this._$maxLength,n),o=a.getGradientLUTShader(s-i,e),_=o.uniform;a.setGradientLUTUniformForShape(_,t,i,s,h),o._$drawGradient(0===i?0:t[i][0],s===n?1:t[s-1][0])}if(this._$context._$bind(i),!this._$attachment.texture)throw new Error("the texture is null.");return s&&this._$context.bindRenderBuffer(s),this._$attachment.texture}generateForFilter(t,e,i){const s=this._$context.frameBuffer.currentAttachment;this._$context._$bind(this._$attachment);const n=t.length,a=this._$context.shaderList.gradientLUTShaderVariants;this._$context.blend.toOneZero();for(let s=0;s<n;s+=this._$maxLength-1){const h=r.min(s+this._$maxLength,n),o=a.getGradientLUTShader(h-s,!1),_=o.uniform;a.setGradientLUTUniformForFilter(_,t,e,i,s,h),o._$drawGradient(0===s?0:t[s],h===n?1:t[h-1])}if(this._$context._$bind(s),!this._$attachment.texture)throw new Error("the texture is null.");return this._$attachment.texture}}class Qt{static get indexRangePool(){return this._$indexRangePool}static generate(t){let e=0;for(let i=0;i<t.length;++i)e+=12*(t[i].length/3-2);this._$vertexBufferData=new o(e),this._$indexRanges=L(),this._$currentIndex=0;for(let e=0;e<t.length;++e){const i=this._$currentIndex;this._$generateMesh(t[e]);const s=this._$currentIndex-i,r=this._$indexRangePool.pop()||{first:0,count:0};r.first=i,r.count=s,this._$indexRanges.push(r)}return{vertexBufferData:this._$vertexBufferData,indexRanges:this._$indexRanges}}static _$generateMesh(t){const e=this._$vertexBufferData;let i=this._$currentIndex;const s=t.length-5;for(let r=3;r<s;r+=3){let s=4*i;t[r+2]?(e[s++]=t[r-3],e[s++]=t[r-2],e[s++]=0,e[s++]=0,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=0,e[s++]=t[r+3],e[s++]=t[r+4],e[s++]=1,e[s++]=1):t[r+5]?(e[s++]=t[0],e[s++]=t[1],e[s++]=.5,e[s++]=.5,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=.5,e[s++]=t[r+6],e[s++]=t[r+7],e[s++]=.5,e[s++]=.5):(e[s++]=t[0],e[s++]=t[1],e[s++]=.5,e[s++]=.5,e[s++]=t[r],e[s++]=t[r+1],e[s++]=.5,e[s++]=.5,e[s++]=t[r+3],e[s++]=t[r+4],e[s++]=.5,e[s++]=.5),i+=3}this._$currentIndex=i}}Qt._$indexRangePool=L();class Jt{static generate(t,e,i){this._$vertexBufferData=this._$vertexBufferData||new o(1024),this._$vertexBufferPos=0,this._$indexBufferData=this._$indexBufferData||new Int16Array(256),this._$indexBufferPos=0,this._$lineCap=e,this._$lineJoin=i;for(let e=0;e<t.length;e++){const i=this._$vertexBufferPos;this._$generateLineSegment(t[e]);const s=this._$vertexBufferPos;this._$generateLineJoin(i,s),this._$generateLineCap(i,s)}return{vertexBufferData:this._$vertexBufferData.slice(0,this._$vertexBufferPos),indexBufferData:this._$indexBufferData.slice(0,this._$indexBufferPos)}}static _$expandVertexBufferIfNeeded(t){if(this._$vertexBufferPos+t>this._$vertexBufferData.length){const t=new o(2*this._$vertexBufferData.length);t.set(this._$vertexBufferData),this._$vertexBufferData=t}}static _$expandIndexBufferIfNeeded(t){if(this._$indexBufferPos+t>this._$indexBufferData.length){const t=new l(2*this._$indexBufferData.length);t.set(this._$indexBufferData),this._$indexBufferData=t}}static _$generateLineSegment(t){const e=t.length-5;for(let i=0;i<e;i+=3)t[i+2]||(t[i+5]?this._$addQuadSegmentMesh(t[i],t[i+1],t[i+3],t[i+4],t[i+6],t[i+7]):this._$addLineSegmentMesh(t[i],t[i+1],t[i+3],t[i+4]))}static _$addQuadSegmentMesh(t,e,i,s,r,n){let a=t,h=e;for(let o=1;o<11;o++){const _=o/11,l=1-_,c=(t*l+i*_)*l+(i*l+r*_)*_,$=(e*l+s*_)*l+(s*l+n*_)*_;this._$addLineSegmentMesh(a,h,c,$,2),a=c,h=$}this._$addLineSegmentMesh(a,h,r,n)}static _$addLineSegmentMesh(t,e,i,s,r=1){const n=this._$vertexBufferPos/7,a=n+1,h=n+2,o=n+3;this._$expandIndexBufferIfNeeded(6);const _=this._$indexBufferData;let l=this._$indexBufferPos;_[l++]=n,_[l++]=a,_[l++]=o,_[l++]=o,_[l++]=h,_[l++]=n,this._$indexBufferPos=l,this._$expandVertexBufferIfNeeded(28);const c=this._$vertexBufferData;let $=this._$vertexBufferPos;c[$++]=t,c[$++]=e,c[$++]=i,c[$++]=s,c[$++]=1,c[$++]=1,c[$++]=1,c[$++]=t,c[$++]=e,c[$++]=i,c[$++]=s,c[$++]=-1,c[$++]=-1,c[$++]=1,c[$++]=i,c[$++]=s,c[$++]=t,c[$++]=e,c[$++]=-1,c[$++]=-1,c[$++]=r,c[$++]=i,c[$++]=s,c[$++]=t,c[$++]=e,c[$++]=1,c[$++]=1,c[$++]=r,this._$vertexBufferPos=$}static _$generateLineJoin(t,e){const i=this._$vertexBufferData,s=e-55;for(let e=t;e<s;e+=28){const t=e/7;this._$addLineJoinMesh(i[e],i[e+1],i[e+21],i[e+22],i[e+27],i[e+49],i[e+50],t+2,t+3,t+4,t+5)}}static _$addLineJoinMesh(t,e,i,s,n,a,h,o,_,l=0,c=0){const $=i-t,u=s-e,d=a-i,g=h-s,f=this._$cross($,u,d,g);if(!(r.abs(f)<1e-4))if(2!==n)switch(this._$lineJoin){case"round":this._$addRoundJoinMesh(i,s);break;case"miter":this._$addMiterJoinMesh(i,s,t,e,a,h,l,o,_,c);break;default:this._$addBevelJoinMesh(i,s,l,o,_,c)}else this._$addBevelJoinMesh(i,s,l,o,_,c)}static _$addRoundJoinMesh(t,e){const i=this._$vertexBufferPos/7;this._$expandIndexBufferIfNeeded(57);const s=this._$indexBufferData;let r=this._$indexBufferPos;for(let t=1;t<18;t++){const e=i+t;s[r++]=i,s[r++]=e,s[r++]=e+1}s[r++]=i,s[r++]=i+18,s[r++]=i+1,this._$indexBufferPos=r,this._$expandVertexBufferIfNeeded(133);const n=this._$vertexBufferData;let a=this._$vertexBufferPos;n[a++]=t,n[a++]=e,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0;for(let i=0;i<18;i++)n[a++]=t,n[a++]=e,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=30+i;this._$vertexBufferPos=a}static _$addMiterJoinMesh(t,e,i,s,r,n,a,h,o,_){const l=this._$vertexBufferPos/7,c=l+1,$=l+2,u=l+3,d=l+4;this._$expandIndexBufferIfNeeded(18);const g=this._$indexBufferData;let f=this._$indexBufferPos;g[f++]=l,g[f++]=a,g[f++]=c,g[f++]=l,g[f++]=c,g[f++]=$,g[f++]=l,g[f++]=$,g[f++]=h,g[f++]=l,g[f++]=o,g[f++]=u,g[f++]=l,g[f++]=u,g[f++]=d,g[f++]=l,g[f++]=d,g[f++]=_,this._$indexBufferPos=f,this._$expandVertexBufferIfNeeded(35);const m=this._$vertexBufferData;let p=this._$vertexBufferPos;m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=0,m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=21,m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=22,m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=23,m[p++]=t,m[p++]=e,m[p++]=i,m[p++]=s,m[p++]=r,m[p++]=n,m[p++]=24,this._$vertexBufferPos=p}static _$addBevelJoinMesh(t,e,i,s,r,n){const a=this._$vertexBufferPos/7;this._$expandIndexBufferIfNeeded(6);const h=this._$indexBufferData;let o=this._$indexBufferPos;h[o++]=a,h[o++]=i,h[o++]=s,h[o++]=a,h[o++]=r,h[o++]=n,this._$indexBufferPos=o,this._$expandVertexBufferIfNeeded(7);const _=this._$vertexBufferData;let l=this._$vertexBufferPos;_[l++]=t,_[l++]=e,_[l++]=0,_[l++]=0,_[l++]=0,_[l++]=0,_[l++]=0,this._$vertexBufferPos=l}static _$generateLineCap(t,e){const i=this._$vertexBufferData,s=i[t],r=i[t+1],n=i[t+2],a=i[t+3],h=i[e-7],o=i[e-6],_=i[e-5],l=i[e-4],c=t/7,$=e/7;s!==h||r!==o?(this._$addLineCapMesh(s,r,n,a,c,c+1),this._$addLineCapMesh(h,o,_,l,$-1,$-2)):this._$addLineJoinMesh(_,l,s,r,n,a,$-2,$-1,c,c+1)}static _$addLineCapMesh(t,e,i,s,r,n){switch(this._$lineCap){case"round":this._$addRoundJoinMesh(t,e);break;case"square":this._$addSquareCapMesh(t,e,i,s,r,n)}}static _$addSquareCapMesh(t,e,i,s,r,n){const a=this._$vertexBufferPos/7,h=a+1;this._$expandIndexBufferIfNeeded(6);const o=this._$indexBufferData;let _=this._$indexBufferPos;o[_++]=r,o[_++]=a,o[_++]=h,o[_++]=h,o[_++]=n,o[_++]=r,this._$indexBufferPos=_,this._$expandVertexBufferIfNeeded(14);const l=this._$vertexBufferData;let c=this._$vertexBufferPos;l[c++]=t,l[c++]=e,l[c++]=i,l[c++]=s,l[c++]=-1,l[c++]=-1,l[c++]=10,l[c++]=t,l[c++]=e,l[c++]=i,l[c++]=s,l[c++]=1,l[c++]=1,l[c++]=10,this._$vertexBufferPos=c}}Jt._$cross=(t,e,i,s)=>t*s-i*e;class Zt{constructor(t){this._$gl=t,this._$fillVertexArrayPool=[],this._$strokeVertexArrayPool=[],this._$boundVertexArray=null,this._$fillAttrib_vertex=0,this._$fillAttrib_bezier=1,this._$strokeAttrib_vertex=0,this._$strokeAttrib_option1=1,this._$strokeAttrib_option2=2,this._$strokeAttrib_type=3,this._$vertexBufferData=new Float32Array([0,0,0,1,1,0,1,1]),this._$attributeVertexBuffer=t.createBuffer(),this._$attributeBuffer=new Float32Array(22),this._$instanceVertexArray=this._$getCommonVertexArray(),this._$commonVertexArray=this._$getVertexArray(0,1)}_$getCommonVertexArray(){const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();return this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,1]),this._$gl.STATIC_DRAW),this._$gl.enableVertexAttribArray(0),this._$gl.vertexAttribPointer(0,2,this._$gl.FLOAT,!1,0,0),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,this._$attributeVertexBuffer),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$attributeBuffer.byteLength,this._$gl.DYNAMIC_DRAW),this._$gl.enableVertexAttribArray(1),this._$gl.vertexAttribPointer(1,4,this._$gl.FLOAT,!1,88,0),this._$gl.vertexAttribDivisor(1,1),this._$gl.enableVertexAttribArray(2),this._$gl.vertexAttribPointer(2,4,this._$gl.FLOAT,!1,88,16),this._$gl.vertexAttribDivisor(2,1),this._$gl.enableVertexAttribArray(3),this._$gl.vertexAttribPointer(3,2,this._$gl.FLOAT,!1,88,32),this._$gl.vertexAttribDivisor(3,1),this._$gl.enableVertexAttribArray(4),this._$gl.vertexAttribPointer(4,4,this._$gl.FLOAT,!1,88,40),this._$gl.vertexAttribDivisor(4,1),this._$gl.enableVertexAttribArray(5),this._$gl.vertexAttribPointer(5,4,this._$gl.FLOAT,!1,88,56),this._$gl.vertexAttribDivisor(5,1),this._$gl.enableVertexAttribArray(6),this._$gl.vertexAttribPointer(6,4,this._$gl.FLOAT,!1,88,72),this._$gl.vertexAttribDivisor(6,1),t}_$getVertexArray(t,e){const i=this._$gl.createVertexArray();this.bind(i);const s=this._$gl.createBuffer();return this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,s),this._$vertexBufferData[0]=t,this._$vertexBufferData[2]=t,this._$vertexBufferData[4]=e,this._$vertexBufferData[6]=e,this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$vertexBufferData,this._$gl.STATIC_DRAW),this._$gl.enableVertexAttribArray(0),this._$gl.vertexAttribPointer(0,2,this._$gl.FLOAT,!1,0,0),i}_$getFillVertexArray(){if(this._$fillVertexArrayPool.length){const t=this._$fillVertexArrayPool.pop();if(t)return t}const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();return t.vertexBuffer=e,t.vertexLength=0,this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e),this._$gl.enableVertexAttribArray(0),this._$gl.enableVertexAttribArray(1),this._$gl.vertexAttribPointer(this._$fillAttrib_vertex,2,this._$gl.FLOAT,!1,16,0),this._$gl.vertexAttribPointer(this._$fillAttrib_bezier,2,this._$gl.FLOAT,!1,16,8),t}_$getStrokeVertexArray(){if(this._$strokeVertexArrayPool.length){const t=this._$strokeVertexArrayPool.pop();if(t)return t}const t=this._$gl.createVertexArray();this.bind(t);const e=this._$gl.createBuffer();t.vertexBuffer=e,t.vertexLength=0,this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,e);const i=this._$gl.createBuffer();return t.indexBuffer=i,t.indexLength=0,this._$gl.bindBuffer(this._$gl.ELEMENT_ARRAY_BUFFER,i),this._$gl.enableVertexAttribArray(0),this._$gl.enableVertexAttribArray(1),this._$gl.enableVertexAttribArray(2),this._$gl.enableVertexAttribArray(3),this._$gl.vertexAttribPointer(this._$strokeAttrib_vertex,2,this._$gl.FLOAT,!1,28,0),this._$gl.vertexAttribPointer(this._$strokeAttrib_option1,2,this._$gl.FLOAT,!1,28,8),this._$gl.vertexAttribPointer(this._$strokeAttrib_option2,2,this._$gl.FLOAT,!1,28,16),this._$gl.vertexAttribPointer(this._$strokeAttrib_type,1,this._$gl.FLOAT,!1,28,24),t}createFill(t){const e=Qt.generate(t),i=e.vertexBufferData,s=this._$getFillVertexArray();return s.indexRanges=e.indexRanges,this.bind(s),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,s.vertexBuffer),s.vertexLength<i.length&&(s.vertexLength=X(i.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,4*s.vertexLength,this._$gl.DYNAMIC_DRAW)),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,i),s}createStroke(t,e,i){const s=Jt.generate(t,e,i),r=s.vertexBufferData,n=s.indexBufferData,a=this._$getStrokeVertexArray();return a.indexCount=n.length,this.bind(a),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,a.vertexBuffer),this._$gl.bindBuffer(this._$gl.ELEMENT_ARRAY_BUFFER,a.indexBuffer),a.vertexLength<r.length&&(a.vertexLength=X(r.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,4*a.vertexLength,this._$gl.DYNAMIC_DRAW)),a.indexLength<n.length&&(a.indexLength=X(n.length),this._$gl.bufferData(this._$gl.ELEMENT_ARRAY_BUFFER,2*a.indexLength,this._$gl.DYNAMIC_DRAW)),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,r),this._$gl.bufferSubData(this._$gl.ELEMENT_ARRAY_BUFFER,0,n),a}releaseFill(t){this._$fillVertexArrayPool.push(t)}releaseStroke(t){this._$strokeVertexArrayPool.push(t)}bind(t=null){t!==this._$boundVertexArray&&(this._$boundVertexArray=t,this._$gl.bindVertexArray(t))}bindInstnceArray(t){this.bind(this._$instanceVertexArray),this._$gl.bindBuffer(this._$gl.ARRAY_BUFFER,this._$attributeVertexBuffer),t.attributes.length>this._$attributeBuffer.length&&(this._$attributeBuffer=new Float32Array(t.attributes.length),this._$gl.bufferData(this._$gl.ARRAY_BUFFER,this._$attributeBuffer.byteLength,this._$gl.DYNAMIC_DRAW)),this._$attributeBuffer.set(t.attributes),this._$gl.bufferSubData(this._$gl.ARRAY_BUFFER,0,this._$attributeBuffer.subarray(0,t.attributes.length))}bindCommonVertexArray(){this.bind(this._$commonVertexArray)}bindGradientVertexArray(t,e){const i=this._$getVertexArray(t,e);this.bind(i)}}class te{constructor(t,e){this._$context=t,this._$gl=e,this._$clips=[],this._$poolClip=[],this._$clipStatus=!1,this._$containerClip=!1,this._$currentClip=!1}get containerClip(){return this._$containerClip}set containerClip(t){this._$containerClip=t}_$onClear(t){t&&(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0)}_$onBind(t){!t&&this._$currentClip?(this._$gl.disable(this._$gl.STENCIL_TEST),this._$currentClip=!1):t&&!this._$currentClip&&(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0,this._$endClipDef())}_$onClearRect(){this._$gl.disable(this._$gl.STENCIL_TEST),this._$currentClip=!1}_$enterClip(){this._$currentClip||(this._$gl.enable(this._$gl.STENCIL_TEST),this._$currentClip=!0);const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");t.mask=!0,++t.clipLevel}_$beginClipDef(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.stencilMask(1<<t.clipLevel-1),this._$gl.colorMask(!1,!1,!1,!1)}_$endClipDef(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");const e=t.clipLevel;let i=0;for(let t=0;t<e;++t)i|=(1<<e-t)-1;this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.EQUAL,255&i,i),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.KEEP,this._$gl.KEEP),this._$gl.stencilMask(255),this._$gl.colorMask(!0,!0,!0,!0)}_$leaveClip(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");if(--t.clipLevel,t.mask=!!t.clipLevel,!t.clipLevel)return void this._$context._$clearRectStencil();const e=t.width,i=t.height,s=this._$context.path.createRectVertices(0,0,e,i),r=this._$context.vao.createFill(s);O(s.pop()),O(s);const n=this._$context.shaderList.shapeShaderVariants,a=n.getMaskShapeShader(!1,!1),h=a.uniform;n.setMaskShapeUniformIdentity(h,e,i);const o=r.indexRanges[0];this._$currentClip||(this._$currentClip=!0,this._$gl.enable(this._$gl.STENCIL_TEST)),this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.REPLACE,this._$gl.REPLACE,this._$gl.REPLACE),this._$gl.stencilMask(1<<t.clipLevel),this._$gl.colorMask(!1,!1,!1,!1),a._$containerClip(r,o.first,o.count);const _=r.indexRanges;for(let t=0;t<_.length;++t)Qt.indexRangePool.push(_[t]);O(r.indexRanges),this._$context.vao.releaseFill(r),this._$endClipDef()}_$drawContainerClip(){const t=this._$context.frameBuffer.currentAttachment;if(!t)throw new Error("mask currentAttachment is null.");const e=t.clipLevel,i=this._$context.shaderList.shapeShaderVariants,s=i.getMaskShapeShader(!1,!1),r=s.uniform;let n=e;const a=t.width,h=t.height;this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.colorMask(!1,!1,!1,!1);const o=this._$poolClip.length;for(let t=0;t<o;++t){const t=this._$poolClip.shift();if(!t)continue;i.setMaskShapeUniform(r,!1,t.matrixA,t.matrixB,t.matrixC,t.matrixD,t.matrixE,t.matrixF,t.matrixG,t.matrixH,t.matrixI,t.viewportWidth,t.viewportHeight,null);const o=t.vertexArrayObject.indexRanges;for(let e=0;e<o.length;++e){const i=o[e];this._$gl.stencilMask(1<<n-1),s._$containerClip(t.vertexArrayObject,i.first,i.count),Qt.indexRangePool.push(i)}O(o),this._$context.vao.releaseFill(t.vertexArrayObject),++n,n>7&&(this._$unionStencilMask(e,a,h),n=e)}n>e+1&&this._$unionStencilMask(e,a,h)}_$unionStencilMask(t,e,i){const s=this._$context.path.createRectVertices(0,0,e,i),r=this._$context.vao.createFill(s);O(s.pop()),O(s);const n=this._$context.shaderList.shapeShaderVariants,a=n.getMaskShapeShader(!1,!1),h=a.uniform;n.setMaskShapeUniformIdentity(h,e,i);const o=r.indexRanges[0];this._$gl.stencilFunc(this._$gl.LEQUAL,1<<t-1,255),this._$gl.stencilOp(this._$gl.ZERO,this._$gl.REPLACE,this._$gl.REPLACE),this._$gl.stencilMask(~((1<<t-1)-1)),a._$containerClip(r,o.first,o.count),this._$poolClip.length&&(this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT));const _=r.indexRanges;for(let t=0;t<_.length;++t)Qt.indexRangePool.push(_[t]);O(r.indexRanges),this._$context.vao.releaseFill(r)}_$onClip(t,e,i,s){return this._$clipStatus=!0,!!this._$containerClip&&(this._$poolClip.push({vertexArrayObject:t,matrixA:e[0],matrixB:e[1],matrixC:e[2],matrixD:e[3],matrixE:e[4],matrixF:e[5],matrixG:e[6],matrixH:e[7],matrixI:e[8],viewportWidth:i,viewportHeight:s}),!0)}_$onSave(){this._$clips.push(this._$clipStatus)}_$onRestore(){this._$clips.length&&(this._$clipStatus=!!this._$clips.pop())}}class ee{constructor(t,e){this._$context=t,this._$gl=e,this._$enabled=!1,this._$funcCode=600,this._$currentOperation="normal",this._$currentIndex=-1,this._$currentSmoothing=null,this._$variants=t.shaderList.blendShaderVariants,this._$instanceShader=this._$variants.getInstanceShader(),this.enable()}enable(){this._$enabled||(this._$enabled=!0,this._$gl.enable(this._$gl.BLEND)),this.reset()}disable(){this._$enabled&&(this._$enabled=!1,this._$gl.disable(this._$gl.BLEND))}reset(){613!==this._$funcCode&&(this._$funcCode=613,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ONE_MINUS_SRC_ALPHA))}toOneZero(){610!==this._$funcCode&&(this._$funcCode=610,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ZERO))}toZeroOne(){601!==this._$funcCode&&(this._$funcCode=601,this._$gl.blendFuncSeparate(this._$gl.ZERO,this._$gl.ONE,this._$gl.ONE,this._$gl.ZERO))}toAdd(){611!==this._$funcCode&&(this._$funcCode=611,this._$gl.blendFunc(this._$gl.ONE,this._$gl.ONE))}toScreen(){641!==this._$funcCode&&(this._$funcCode=641,this._$gl.blendFunc(this._$gl.ONE_MINUS_DST_COLOR,this._$gl.ONE))}toAlpha(){606!==this._$funcCode&&(this._$funcCode=606,this._$gl.blendFunc(this._$gl.ZERO,this._$gl.SRC_ALPHA))}toErase(){603!==this._$funcCode&&(this._$funcCode=603,this._$gl.blendFunc(this._$gl.ZERO,this._$gl.ONE_MINUS_SRC_ALPHA))}toSourceAtop(){673!==this._$funcCode&&(this._$funcCode=673,this._$gl.blendFunc(this._$gl.DST_ALPHA,this._$gl.ONE_MINUS_SRC_ALPHA))}toSourceIn(){670!==this._$funcCode&&(this._$funcCode=670,this._$gl.blendFunc(this._$gl.DST_ALPHA,this._$gl.ZERO))}toOperation(t){switch(t){case"add":this.toAdd();break;case"screen":this.toScreen();break;case"alpha":this.toAlpha();break;case"erase":this.toErase();break;case"copy":this.toOneZero();break;default:this.reset()}}clearInstacedArray(){const t=this._$instanceShader.instance;t.count&&t.clear()}drawInstacedArray(){const t=this._$instanceShader.instance;if(!t.count)return;const e=this._$context.frameBuffer,i=e.textureManager.getAtlasTexture(this._$currentIndex);e.textureManager.bind0(i,this._$currentSmoothing),this.toOperation(this._$currentOperation),this._$instanceShader.drawArraysInstanced(t),t.clear()}drawInstance(t,e,i,s,r,n,a,h,o,_,l,c,$,u){this._$currentOperation||(this._$currentOperation=_),-1===this._$currentIndex&&(this._$currentIndex=t.index),null===this._$currentSmoothing&&(this._$currentSmoothing=u),this._$currentOperation===_&&this._$currentIndex===t.index&&this._$currentSmoothing===u||(this.drawInstacedArray(),this._$currentOperation=_,this._$currentIndex=t.index,this._$currentSmoothing=u),this._$variants.pushNormalBlend(this._$instanceShader.instance,t.x,t.y,t.w,t.h,$,l,c,e,i,s,r,n,a,h,o)}drawInstanceBlend(t,e,i,s,n,a,h,o,_,l,c,$,u,d,g,f,m,p,x){this.drawInstacedArray();const b=this._$context.frameBuffer,v=b.currentAttachment,T=1!==a||1!==h||1!==o||1!==_||0!==l||0!==c||0!==$||0!==u,A=b.getTextureFromCurrentAttachment(),M=this._$context.frameBuffer.createTextureAttachment(d.w,d.h);this._$context._$bind(M),b.textureManager.bind0(A);const y=this._$variants.getClipShader(),E=y.uniform;this._$variants.setClipUniform(E,0,0,d.w,d.h,V(p),f,m),this.reset(),y._$drawImage();const C=b.getTextureFromCurrentAttachment();this._$context._$bind(v),b.textureManager.bind01(C,t,x);const S=this._$variants.getInstanceBlendShader(g,T);this._$variants.setInstanceBlendUniform(S.uniform,d.x/t.width,d.y/t.height,d.w/t.width,d.h/t.height,d.w,d.h,p,f,m,T,a,h,o,_,l,c,$,u);const F=r.abs(s-e),B=r.abs(n-i);this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(e,m-(i+B),F,B),this.toOneZero(),S._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST),b.releaseAttachment(M,!0)}drawImage(t,e,i,s,n,a,o,_,l,c,$,u,d,g,f,m,p,x){const b=this._$context.frameBuffer,v=b.currentAttachment,T=1!==a||1!==o||1!==_||1!==l||0!==c||0!==$||0!==u||0!==d;switch(g){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":{b.textureManager.bind0(t,x);const v=this._$variants.getNormalBlendShader(T);this._$variants.setNormalBlendUniform(v.uniform,e,i,s,n,p,f,m,T,a,o,_,l,c,$,u,d);const A=p[0],M=p[1],y=p[3],E=p[4],C=p[6],S=p[7];if(1!==A||0!==M||0!==y||1!==E){const t=e+s,a=i+n,o=+(t*A+a*y+C),_=+(t*A+i*y+C),l=+(e*A+a*y+C),c=+(e*A+i*y+C),$=+(t*M+a*E+S),u=+(t*M+i*E+S),d=+(e*M+a*E+S),g=+(e*M+i*E+S),p=h.MAX_VALUE,x=+r.min(r.min(r.min(r.min(p,o),_),l),c),b=+r.max(r.max(r.max(r.max(-p,o),_),l),c),v=+r.min(r.min(r.min(r.min(p,$),u),d),g),T=+r.max(r.max(r.max(r.max(-p,$),u),d),g),F=r.max(0,x),B=r.max(0,v),w=r.min(r.max(0,f-F),r.ceil(r.abs(b-x))),R=r.min(r.max(0,m-B),r.ceil(r.abs(T-v)));if(!w||!R)return;this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(F,r.max(0,m-(B+R)),w+1,R+1)}else{const t=r.max(0,e+C),a=r.max(0,i+S),h=r.min(r.max(0,f-t),s),o=r.min(r.max(0,m-a),n);if(!h||!o)return;this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t,r.max(0,m-(a+o)),h+1,o+1)}this.toOperation(g),v._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST)}break;default:{const h=r.max(0,e+p[6]),A=r.max(0,i+p[7]),M=r.min(r.max(0,f-h),s),y=r.min(r.max(0,m-A),n);if(!M||!y)return;const E=b.getTextureFromCurrentAttachment(),C=this._$context.frameBuffer.createTextureAttachment(s,n);this._$context._$bind(C),b.textureManager.bind0(E);const S=this._$variants.getClipShader(),F=S.uniform;this._$variants.setClipUniform(F,e,i,s,n,V(p),f,m),this.reset(),S._$drawImage();const B=b.getTextureFromCurrentAttachment();this._$context._$bind(v),b.textureManager.bind01(B,t,x);const w=this._$variants.getBlendShader(g,T);this._$variants.setBlendUniform(w.uniform,e,i,s,n,p,f,m,T,a,o,_,l,c,$,u,d),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(h,r.max(0,m-(A+y)),M,y),this.toOneZero(),w._$drawImage(),this._$gl.disable(this._$gl.SCISSOR_TEST),b.releaseAttachment(C,!0)}}}}class ie{constructor(t,e){var i;i=t.getParameter(t.MAX_TEXTURE_SIZE),pt=Math.min(4096,i/2),this._$gl=t;const s=r.min(e,t.getParameter(t.MAX_SAMPLES));this._$maxTextureSize=r.min(8192,t.getParameter(t.MAX_TEXTURE_SIZE))-2,this._$contextStyle=new mt,this._$cacheBounds=S(),this._$matrix=k(1,0,0,0,1,0,0,0,1),this._$cacheAttachment=null,this._$stack=[],this._$globalAlpha=1,this._$imageSmoothingEnabled=!1,this._$globalCompositeOperation="normal",this._$clearColorR=1,this._$clearColorG=1,this._$clearColorB=1,this._$clearColorA=1,this._$viewportWidth=0,this._$viewportHeight=0,this._$frameBufferManager=new Tt(t,s),this._$path=new Mt,this._$grid=new yt,this._$offsetX=0,this._$offsetY=0,this._$blends=L(),this._$positions=L(),this._$isLayer=!1,this._$shaderList=new jt(this,t),this._$gradientLUT=new Kt(this,t),this._$vao=new Zt(t),this._$mask=new te(this,t),this._$blend=new ee(this,t),this._$attachmentArray=[],this._$maskBounds=S(0,0,0,0),this._$cachePosition=null}get cachePosition(){return this._$cachePosition}set cachePosition(t){this._$cachePosition=t}reset(){this._$globalAlpha=1,this._$globalCompositeOperation="normal",this._$imageSmoothingEnabled=!1,this._$contextStyle.clear()}get isLayer(){return this._$isLayer}get canvas(){return this._$gl.canvas}get cacheAttachment(){return this._$cacheAttachment}set cacheAttachment(t){this._$cacheAttachment=t}get cacheBounds(){return this._$cacheBounds}get fillStyle(){return this._$contextStyle.fillStyle}set fillStyle(t){this._$contextStyle.fillStyle=t}get strokeStyle(){return this._$contextStyle.strokeStyle}set strokeStyle(t){this._$contextStyle.strokeStyle=t}get lineWidth(){return this._$contextStyle.lineWidth}set lineWidth(t){this._$contextStyle.lineWidth=t}get lineCap(){return this._$contextStyle.lineCap}set lineCap(t){this._$contextStyle.lineCap=t}get lineJoin(){return this._$contextStyle.lineJoin}set lineJoin(t){this._$contextStyle.lineJoin=t}get miterLimit(){return this._$contextStyle.miterLimit}set miterLimit(t){this._$contextStyle.miterLimit=t}get globalAlpha(){return this._$globalAlpha}set globalAlpha(t){this._$globalAlpha=Y(t,0,1,1)}get imageSmoothingEnabled(){return this._$imageSmoothingEnabled}set imageSmoothingEnabled(t){this._$imageSmoothingEnabled=t}get globalCompositeOperation(){return this._$globalCompositeOperation}set globalCompositeOperation(t){this._$globalCompositeOperation=t}get frameBuffer(){return this._$frameBufferManager}get shaderList(){return this._$shaderList}get path(){return this._$path}get grid(){return this._$grid}get vao(){return this._$vao}get blend(){return this._$blend}_$getCurrentPosition(){return this._$positions[this._$positions.length-1]}_$getTextureScale(t,e){const i=r.max(t,e);return i>this._$maxTextureSize?this._$maxTextureSize/i:1}drawInstacedArray(){this.blend.drawInstacedArray()}clearInstacedArray(){this.blend.clearInstacedArray()}bindRenderBuffer(t){this._$frameBufferManager.bindRenderBuffer(),this._$gl.clearColor(0,0,0,0),this._$gl.clear(this._$gl.COLOR_BUFFER_BIT|this._$gl.STENCIL_BUFFER_BIT),this._$viewportWidth=t.w,this._$viewportHeight=t.h,this._$gl.viewport(t.x,t.y,t.w,t.h),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t.x,t.y,t.w,t.h)}getTextureFromRect(t){const e=this._$frameBufferManager,i=e.textureManager.getAtlasTexture(t.index),s=e.currentAttachment,r=e.createTextureAttachment(t.w,t.h);this._$bind(r),this.save(),this.setTransform(1,0,0,1,0,0),this.reset(),this.drawImage(i,-t.x,-i.height+t.h+t.y,i.width,i.height),this.restore();const n=r.texture;return e.releaseAttachment(r),this._$bind(s),n}drawBitmap(t){const e=this._$shaderList.blendShaderVariants,i=e.getNormalBlendShader(!1);e.setNormalBlendUniform(i.uniform,0,0,t.width,t.height,this._$matrix,this._$viewportWidth,this._$viewportHeight,!1,1,1,1,1,0,0,0,0),this._$frameBufferManager.textureManager.bind0(t,this._$imageSmoothingEnabled),this.blend.toOperation("normal"),i._$drawImage()}drawTextureFromRect(t,e){const i=this._$frameBufferManager,s=i.currentAttachment;this.bindRenderBuffer(e),i.transferTexture(e);const r=i.textureManager.getAtlasTexture(e.index),n=i.createTextureAttachmentFrom(r);this._$bind(n),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(e.x,e.y,e.w,e.h),this._$gl.clearColor(0,0,0,0),this._$gl.disable(this._$gl.SCISSOR_TEST),this.save(),this.setTransform(1,0,0,1,0,0),this.reset(),this.drawImage(t,e.x,r.height-e.h-e.y,t.width,t.height),this.restore(),i.releaseAttachment(n),this._$bind(s),i.textureManager.release(t)}stopStencil(){this._$mask._$onClearRect()}_$bind(t=null){if(!t)return;this._$frameBufferManager.bind(t);const e=t.color,i=t.stencil,s=t.width,r=t.height;this._$viewportWidth===s&&this._$viewportHeight===r||(this._$viewportWidth=s,this._$viewportHeight=r,this._$gl.viewport(0,0,s,r)),(e&&e.dirty||i&&i.dirty)&&(e&&(e.dirty=!1),i&&(i.dirty=!1),this._$gl.clearColor(0,0,0,0),this.clearRect(0,0,this._$viewportWidth,this._$viewportHeight),this._$gl.clearColor(this._$clearColorR,this._$clearColorG,this._$clearColorB,this._$clearColorA),this._$mask._$onClear(t.mask)),this._$mask._$onBind(t.mask)}setTransform(t,e,i,s,r,n){this._$matrix[0]=t,this._$matrix[1]=e,this._$matrix[3]=i,this._$matrix[4]=s,this._$matrix[6]=r,this._$matrix[7]=n}setMaxSize(t,e){this._$frameBufferManager.setMaxSize(t,e)}transform(t,e,i,s,r,n){const a=this._$matrix[0],h=this._$matrix[1],o=this._$matrix[3],_=this._$matrix[4],l=this._$matrix[6],c=this._$matrix[7];this._$matrix[0]=t*a+e*o,this._$matrix[1]=t*h+e*_,this._$matrix[3]=i*a+s*o,this._$matrix[4]=i*h+s*_,this._$matrix[6]=r*a+n*o+l,this._$matrix[7]=r*h+n*_+c}debug(t=0){const e=this._$frameBufferManager,i=e.textureManager.getAtlasTexture(t),s=e.currentAttachment,r=e.createTextureAttachmentFrom(i);this._$bind(r);const n=new Uint8Array(i.width*i.height*4);this._$gl.readPixels(0,0,i.width,i.height,this._$gl.RGBA,this._$gl.UNSIGNED_BYTE,n);const a=document.createElement("canvas");a.width=i.width,a.height=i.height;const h=a.getContext("2d"),o=new ImageData(i.width,i.height);for(let t=0;t<n.length;++t)o.data[t]=n[t];null==h||h.putImageData(o,0,0),console.log(a.toDataURL()),this._$bind(s),e.releaseAttachment(r)}drawInstance(t,e,i,s,r){let n=1,a=1,h=1,o=0,_=0,l=0;const c=this._$globalAlpha;r&&(n=r[0],a=r[1],h=r[2],o=r[4]/255,_=r[5]/255,l=r[6]/255);const $=this._$cachePosition;if($)switch(this._$globalCompositeOperation){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":this.blend.drawInstance($,n,a,h,c,o,_,l,0,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled);break;default:{const r=this._$frameBufferManager.textureManager.getAtlasTexture($.index);this.blend.drawInstanceBlend(r,t,e,i,s,n,a,h,c,o,_,l,0,$,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled)}}}drawImage(t,e,i,s,r,n=null){let a=1,h=1,o=1,_=0,l=0,c=0;const $=this._$globalAlpha;n&&(a=n[0],h=n[1],o=n[2],_=n[4]/255,l=n[5]/255,c=n[6]/255),this.blend.drawImage(t,e,i,s,r,a,h,o,$,_,l,c,0,this._$globalCompositeOperation,this._$viewportWidth,this._$viewportHeight,this._$matrix,this._$imageSmoothingEnabled)}_$setColor(t=0,e=0,i=0,s=0){this._$clearColorR=t,this._$clearColorG=e,this._$clearColorB=i,this._$clearColorA=s,this._$gl.clearColor(t,e,i,s)}clearRect(t,e,i,s){this._$mask._$onClearRect(),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(t,e,i,s),this._$gl.clear(this._$gl.COLOR_BUFFER_BIT|this._$gl.STENCIL_BUFFER_BIT),this._$gl.disable(this._$gl.SCISSOR_TEST)}_$clearRectStencil(){this._$mask._$onClearRect(),this._$gl.enable(this._$gl.SCISSOR_TEST),this._$gl.scissor(this._$maskBounds.xMin,this._$maskBounds.yMin,this._$maskBounds.xMax,this._$maskBounds.yMax),this._$gl.clear(this._$gl.STENCIL_BUFFER_BIT),this._$gl.disable(this._$gl.SCISSOR_TEST)}moveTo(t,e){this._$path.moveTo(t,e)}lineTo(t,e){this._$path.lineTo(t,e)}beginPath(){this._$path.begin()}quadraticCurveTo(t,e,i,s){this._$path.quadTo(t,e,i,s)}bezierCurveTo(t,e,i,s,r,n){this._$path.cubicTo(t,e,i,s,r,n)}fill(){const t=this._$path.vertices;if(!t.length)return;const e=L();for(let i=0;i<t.length;++i){const s=t[i];10>s.length||e.push(s)}if(!e.length)return void O(e);const i=this._$vao.createFill(e),s=this.fillStyle;let r,n,a,h=this._$matrix;const o=this._$grid.enabled;if(s instanceof gt){const t=s.stops,e="linearRGB"===s.rgb;if(r=this._$gradientLUT.generateForShape(t,e),this._$frameBufferManager.textureManager.bind0(r,!0),this._$frameBufferManager.bindRenderBuffer(),n=this._$shaderList.gradientShapeShaderVariants,"linear"===s.type)a=n.getGradientShapeShader(!1,o,!1,!1,s.mode),n.setGradientShapeUniform(a.uniform,!1,0,0,0,o,h,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!1,s.points,0);else{h=this._$stack[this._$stack.length-1];const t=0!==s.focalPointRatio;a=n.getGradientShapeShader(!1,o,!0,t,s.mode),n.setGradientShapeUniform(a.uniform,!1,0,0,0,o,h,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!0,s.points,s.focalPointRatio)}}else if(s instanceof ft){h=this._$stack[this._$stack.length-1];const t=s.colorTransform;r=s.texture,this._$frameBufferManager.textureManager.bind0(r,this._$imageSmoothingEnabled),n=this._$shaderList.shapeShaderVariants,a=n.getBitmapShapeShader(!1,s.repeat,o),t?n.setBitmapShapeUniform(a.uniform,!1,0,0,0,o,h,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,r.width,r.height,t[0],t[1],t[2],this._$globalAlpha,t[4]/255,t[5]/255,t[6]/255,0):n.setBitmapShapeUniform(a.uniform,!1,0,0,0,o,h,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,r.width,r.height,1,1,1,this._$globalAlpha,0,0,0,0)}else n=this._$shaderList.shapeShaderVariants,a=n.getSolidColorShapeShader(!1,this._$grid.enabled),n.setSolidColorShapeUniform(a.uniform,!1,0,0,0,o,h,this._$viewportWidth,this._$viewportHeight,this._$grid,s,this._$globalAlpha);const _=this._$shaderList.shapeShaderVariants,l=_.getMaskShapeShader(!1,o);_.setMaskShapeUniform(l.uniform,o,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],this._$viewportWidth,this._$viewportHeight,this._$grid),this._$gl.enable(this._$gl.STENCIL_TEST),this._$gl.stencilMask(255),this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.ALWAYS,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.INVERT,this._$gl.INVERT),this._$gl.colorMask(!1,!1,!1,!1),l._$fill(i),this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE),this._$gl.stencilFunc(this._$gl.NOTEQUAL,0,255),this._$gl.stencilOp(this._$gl.KEEP,this._$gl.ZERO,this._$gl.ZERO),this._$gl.colorMask(!0,!0,!0,!0),a._$fill(i),this._$gl.disable(this._$gl.STENCIL_TEST),this.releaseFillVertexArray(i)}releaseFillVertexArray(t){this._$vao.releaseFill(t);const e=t.indexRanges;for(let t=0;t<e.length;++t)Qt.indexRangePool.push(e[t]);O(e)}_$enterClip(){this._$mask._$enterClip()}_$beginClipDef(){this._$mask._$beginClipDef()}_$updateContainerClipFlag(t){this._$mask.containerClip=t}_$startClip(t){const e=t.xMin,i=t.yMin,s=Math.abs(t.xMax-t.xMin),n=Math.abs(t.yMax-t.yMin),a=this._$frameBufferManager.currentAttachment;if(!a)throw new Error("the current Attachment is null.");return!(e>a.width||i>a.height||0>e&&0>=s+e||0>i&&0>=n+i||(this._$maskBounds.xMin=r.max(0,r.min(this._$maskBounds.xMin,e)),this._$maskBounds.yMin=r.max(0,r.min(this._$maskBounds.yMin,i)),this._$maskBounds.xMax=r.min(a.width,r.min(this._$maskBounds.xMax,s)),this._$maskBounds.yMax=r.min(a.height,r.min(this._$maskBounds.yMax,n)),0))}_$endClipDef(){this._$mask._$endClipDef()}_$leaveClip(){this.drawInstacedArray(),this._$mask._$leaveClip()}_$drawContainerClip(){this._$mask._$drawContainerClip()}closePath(){this._$path.close()}stroke(){const t=this._$path.vertices;if(!t.length)return;const e=L();for(let i=0;i<t.length;++i){const s=t[i];6>s.length||e.push(s)}if(!e.length)return void O(e);const i=this._$vao.createStroke(t,this.lineCap,this.lineJoin);let s=this._$matrix;const n=this.strokeStyle;let a=r.sign(s[0]*s[4]);a>0&&0!==s[1]&&0!==s[3]&&(a=-r.sign(s[1]*s[3]));let h,o,_=.5*this.lineWidth;this._$grid.enabled?(h=r.abs(this._$grid.ancestorMatrixA+this._$grid.ancestorMatrixD),o=r.abs(this._$grid.ancestorMatrixB+this._$grid.ancestorMatrixE)):(h=r.abs(s[0]+s[3]),o=r.abs(s[1]+s[4]));const l=r.min(h,o),c=r.max(h,o);_*=c*(1-.3*r.cos(.5*r.PI*(l/c))),_=r.max(1,_);const $=this._$grid.enabled;let u,d,g;if(n instanceof gt){"radial"===n.type&&(s=this._$stack[this._$stack.length-1]);const t=n.stops,e="linearRGB"===n.rgb;if(u=this._$gradientLUT.generateForShape(t,e),this._$frameBufferManager.textureManager.bind0(u,!0),d=this._$shaderList.gradientShapeShaderVariants,"linear"===n.type)g=d.getGradientShapeShader(!0,$,!1,!1,n.mode),d.setGradientShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!1,n.points,0);else{s=this._$stack[this._$stack.length-1];const t=0!==n.focalPointRatio;g=d.getGradientShapeShader(!0,$,!0,t,n.mode),d.setGradientShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,!0,n.points,n.focalPointRatio)}}else if(n instanceof ft){s=this._$stack[this._$stack.length-1];const t=n.colorTransform;u=n.texture,this._$frameBufferManager.textureManager.bind0(u),d=this._$shaderList.shapeShaderVariants,g=d.getBitmapShapeShader(!0,n.repeat,this._$grid.enabled),t?d.setBitmapShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,u.width,u.height,t[0],t[1],t[2],this._$globalAlpha,t[4]/255,t[5]/255,t[6]/255,0):d.setBitmapShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,V(this._$matrix),this._$viewportWidth,this._$viewportHeight,this._$grid,u.width,u.height,1,1,1,this._$globalAlpha,0,0,0,0)}else d=this._$shaderList.shapeShaderVariants,g=d.getSolidColorShapeShader(!0,this._$grid.enabled),d.setSolidColorShapeUniform(g.uniform,!0,_,a,this.miterLimit,$,s,this._$viewportWidth,this._$viewportHeight,this._$grid,n,this._$globalAlpha);g._$stroke(i),this._$vao.releaseStroke(i)}arc(t,e,i){this._$path.drawCircle(t,e,i)}clip(){const t=this._$path.vertices;if(!t.length)return;const e=L();for(let i=0;i<t.length;++i){const s=t[i];10>s.length||e.push(s)}if(!e.length)return void O(e);const i=this._$vao.createFill(e),s=this._$shaderList.shapeShaderVariants,r=s.getMaskShapeShader(!1,!1),n=r.uniform;s.setMaskShapeUniform(n,!1,this._$matrix[0],this._$matrix[1],this._$matrix[2],this._$matrix[3],this._$matrix[4],this._$matrix[5],this._$matrix[6],this._$matrix[7],this._$matrix[8],this._$viewportWidth,this._$viewportHeight,null),this._$mask._$onClip(i,this._$matrix,this._$viewportWidth,this._$viewportHeight)||(r._$fill(i),this.beginPath())}save(){const t=this._$matrix;this._$stack.push(k(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])),this._$mask._$onSave()}restore(){var t;this._$stack.length&&(t=this._$matrix,A.push(t),this._$matrix=this._$stack.pop()||k()),this._$mask._$onRestore()}createPattern(t,e,i){return new ft(this,t,e,i)}createLinearGradient(t,e,i,s,r="rgb",n="pad"){return(new gt).linear(t,e,i,s,r,n)}createRadialGradient(t,e,i,s,r,n,a="rgb",h="pad",o=0){return(new gt).radial(t,e,i,s,r,n,a,h,o)}_$applyBlurFilter(t,e,i){const s=this._$frameBufferManager,n=s.currentAttachment;if(!n)throw new Error("the current attachment is null.");const a=n.width,h=n.height;s.textureManager.bind0(t,!0);const o=r.ceil(.5*i),_=1-(o-.5*i),l=1+i,c=this._$shaderList.filterShaderVariants,$=c.getBlurFilterShader(o);c.setBlurFilterUniform($.uniform,a,h,e,_,l),$._$drawImage()}_$applyBitmapFilter(t,e,i,s,r,n,a,h,o,_,l,c,$,u,d,g=null,f=null,m=null,p=0,x=0,b=0,v=0,T=0,A=0,M=0,y=0){const E=this._$frameBufferManager,C="inner"===$,S=E.currentAttachment,F=E.getTextureFromCurrentAttachment();let B=null;const w=null!==g&&null!==f&&null!==m;let R;null!==g&&null!==f&&null!==m&&(B=this._$gradientLUT.generateForFilter(g,f,m)),C?w&&B?E.textureManager.bind02(t,B,!0):E.textureManager.bind0(t):(R=this._$frameBufferManager.createTextureAttachment(e,i),this._$bind(R),w&&B?E.textureManager.bind012(t,F,B,!0):E.textureManager.bind01(t,F));const I=!(C||"full"===$&&u),P=!(e===h&&i===o&&0===_&&0===l),N=!(1===d),k=this._$shaderList.filterShaderVariants,L=k.getBitmapFilterShader(I,P,c,$,u,N,w);k.setBitmapFilterUniform(L.uniform,e,i,s,r,n,a,h,o,_,l,c,d,p,x,b,v,T,A,M,y,I,P,N,w),C?u?this.blend.toSourceIn():this.blend.toSourceAtop():this.blend.toOneZero(),L._$drawImage(),C||E.releaseAttachment(S,!0)}_$applyColorMatrixFilter(t,e){this._$frameBufferManager.textureManager.bind0(t,!0);const i=this._$shaderList.filterShaderVariants,s=i.getColorMatrixFilterShader();i.setColorMatrixFilterUniform(s.uniform,e),this.blend.reset(),s._$drawImage()}_$applyConvolutionFilter(t,e,i,s,r,n,a,h,o,_,l,c){const $=t.width,u=t.height,d=this._$frameBufferManager.createTextureAttachment($,u);this._$bind(d),this._$frameBufferManager.textureManager.bind0(t,!0);const g=this._$shaderList.filterShaderVariants,f=g.getConvolutionFilterShader(e,i,a,h);g.setConvolutionFilterUniform(f.uniform,$,u,s,r,n,h,o,_,l,c),this.blend.reset(),f._$drawImage()}_$applyDisplacementMapFilter(t,e,i,s,r,n,a,h,o,_,l,c,$,u){const d=t.width,g=t.height,f=this._$frameBufferManager.createTextureAttachment(d,g);this._$bind(f),r||(r={x:0,y:0});const m=this._$frameBufferManager.createTextureFromImage(e);this._$frameBufferManager.textureManager.bind01(t,m);const p=this._$shaderList.filterShaderVariants,x=p.getDisplacementMapFilterShader(n,a,_);p.setDisplacementMapFilterUniform(x.uniform,e.width,e.height,i,s,r.x,r.y,h,o,_,l,c,$,u),this.blend.reset(),x._$drawImage(),this._$frameBufferManager.releaseTexture(m)}_$startLayer(t){this._$positions.push(t),this._$blends.push(this._$isLayer),this._$isLayer=!0}_$endLayer(){const t=this._$positions.pop();t&&F(t),this._$isLayer=!!this._$blends.pop()}_$saveAttachment(t,e,i=!1){this.drawInstacedArray();const s=this._$frameBufferManager;this._$attachmentArray.push(s.currentAttachment),this._$bind(s.createCacheAttachment(t,e,i))}_$restoreAttachment(t=!1){const e=this._$frameBufferManager;e.releaseAttachment(e.currentAttachment,t),this._$bind(this._$attachmentArray.pop())}getCurrentPosition(){return this._$positions[this._$positions.length-1]}textureScale(t,e){const i=r.max(t,e);return i>this._$maxTextureSize?this._$maxTextureSize/i:1}}class se extends ut{constructor(){super(),this._$recodes=null,this._$maxAlpha=0,this._$canDraw=!1,this._$uniqueKey="",this._$cacheKeys=L(),this._$cacheParams=L(0,0,0),this._$bitmapId=0,this._$mode="shape"}_$clip(t,e){if(!this._$recodes)return;const i=this._$getBounds(),n=H(i,e);F(i);const a=r.ceil(r.abs(n.xMax-n.xMin)),h=r.ceil(r.abs(n.yMax-n.yMin));switch(F(n),!0){case 0===a:case 0===h:case a===-1/0:case h===-1/0:case a===s:case h===s:return}t.reset(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),this._$runCommand(t,this._$recodes,null,!0),t.clip()}_$createCacheKey(){if(!this._$recodes)return"";let t=0;for(let e=0;e<this._$recodes.length;e++)t=(t<<5)-t+this._$recodes[e],t|=0;return`${t}`}_$createBitmapTexture(t,e,i,s,r,n){if("bitmap"!==this._$mode)return null;t.drawInstacedArray();const a=t.frameBuffer,h=a.currentAttachment,o=a.createCacheAttachment(r,n);t._$bind(o),t.reset();const _=R(i,0,0,s,r/2,n/2),l=t.getTextureFromRect(e),c=R(1,0,0,1,-l.width/2,-l.height/2),$=z(_,c);I(_),I(c),t.setTransform($[0],$[1],$[2],$[3],$[4],$[5]),t.drawImage(l,0,0,l.width,l.height);const u=a.getTextureFromCurrentAttachment();return t._$bind(h),a.releaseAttachment(o),a.textureManager.release(l),u}_$draw(t,e,i,n="normal",a=null){if(!(this._$visible&&this._$recodes&&this._$maxAlpha&&this._$canDraw))return;const o=Y(i[3]+i[7]/255,0,1,0);if(!o)return;const _=this._$matrix;let l=null!==this._$scale9Grid;l&&(l=l&&r.abs(_[1])<.001&&r.abs(_[2])<1e-4);const c=S(this._$xMin,this._$xMax,this._$yMin,this._$yMax),$=H(c,e),u=$.xMax,d=$.xMin,g=$.yMax,f=$.yMin;F($);const m=r.ceil(r.abs(u-d)),p=r.ceil(r.abs(g-f));switch(!0){case 0===m:case 0===p:case m===-1/0:case p===-1/0:case m===s:case p===s:return}let x=+r.sqrt(e[0]*e[0]+e[1]*e[1]);if(!h.isInteger(x)){const t=x.toString(),e=t.indexOf("e");-1!==e&&(x=+t.slice(0,e)),x=+x.toFixed(4)}let b=+r.sqrt(e[2]*e[2]+e[3]*e[3]);if(!h.isInteger(b)){const t=b.toString(),e=t.indexOf("e");-1!==e&&(b=+t.slice(0,e)),b=+b.toFixed(4)}const v=null!==a&&a.length>0&&this._$canApply(a);let T=S(0,m,0,p);if(v&&a)for(let t=0;t<a.length;++t)T=a[t]._$generateFilterRect(T,x,b);const A=t.frameBuffer,M=A.currentAttachment;if(!M||d-T.xMin>M.width||f-T.yMin>M.height)return void F(T);if(0>d+T.xMax||0>f+T.yMax)return void F(T);if(F(T),""===this._$uniqueKey&&(!l&&this._$loaderInfoId>-1&&this._$characterId>-1?this._$uniqueKey=`${this._$loaderInfoId}@${this._$characterId}`:this._$uniqueKey=this._$createCacheKey()),"bitmap"===this._$mode)this._$cacheKeys.length||(this._$cacheKeys=it.generateKeys(this._$uniqueKey));else if(!this._$cacheKeys.length||this._$cacheParams[0]!==x||this._$cacheParams[1]!==b||this._$cacheParams[2]!==i[7]){const t=L();t[0]=x,t[1]=b,this._$cacheKeys=it.generateKeys(this._$uniqueKey,t,i),O(t),this._$cacheParams[0]=x,this._$cacheParams[1]=b,this._$cacheParams[2]=i[7]}if(t.cachePosition=it.get(this._$cacheKeys),!t.cachePosition){const s=A.currentAttachment;s&&s.mask&&t.stopStencil();let n=0,a=0;if("shape"===this._$mode){n=r.ceil(r.abs(c.xMax-c.xMin)*x),a=r.ceil(r.abs(c.yMax-c.yMin)*b);const e=t._$getTextureScale(n,a);e<1&&(n*=e,a*=e)}else n=r.ceil(r.abs(c.xMax-c.xMin)),a=r.ceil(r.abs(c.yMax-c.yMin));if(t.cachePosition=A.createCachePosition(n,a),t.bindRenderBuffer(t.cachePosition),t.reset(),"shape"===this._$mode?t.setTransform(x,0,0,b,-c.xMin*x,-c.yMin*b):t.setTransform(1,0,0,1,-c.xMin,-c.yMin),l){const i=oe.scaleX,s=R(i,0,0,i,0,0),n=z(s,_);I(s);const a=this._$matrixBase,h=R(a[0],a[1],a[2],a[3],a[4]*i-d,a[5]*i-f),o=z(h,n),l=o[4]-(e[4]-d),$=o[5]-(e[5]-f);I(o);const u=H(c,n),g=+u.xMax,m=+u.xMin,p=+u.yMax,x=+u.yMin,b=r.ceil(r.abs(g-m)),v=r.ceil(r.abs(p-x));F(u),t.grid.enable(m,x,b,v,c,this._$scale9Grid,i,n[0],n[1],n[2],n[3],n[4],n[5],h[0],h[1],h[2],h[3],h[4]-l,h[5]-$),I(n),I(h)}this._$runCommand(t,this._$recodes,i,!1),l&&t.grid.disable(),A.transferTexture(t.cachePosition),it.set(this._$cacheKeys,t.cachePosition),t._$bind(s)}let y=0,E=0;if(v&&a){const i=this._$createBitmapTexture(t,t.cachePosition,x,b,m,p),s=this._$drawFilter(t,e,a,m,p,i);s.offsetX&&(y=s.offsetX),s.offsetY&&(E=s.offsetY),t.cachePosition=s}if(v||"bitmap"!==this._$mode){const i=r.atan2(e[1],e[0]),s=r.atan2(-e[2],e[3]);if(v||!i&&!s)t.setTransform(1,0,0,1,d-y,f-E);else{const n=c.xMin*x,a=c.yMin*b,h=r.cos(i),o=r.sin(i),_=r.cos(s),l=r.sin(s);t.setTransform(h,o,-l,_,n*h-a*l+e[4],n*o+a*_+e[5])}}else t.setTransform(e[0],e[1],e[2],e[3],c.xMin*e[0]+c.yMin*e[2]+e[4],c.xMin*e[1]+c.yMin*e[3]+e[5]);t.cachePosition&&(t.globalAlpha=o,t.imageSmoothingEnabled="shape"===this._$mode,t.globalCompositeOperation=n,t.drawInstance(d-y,f-E,u,g,i),t.cachePosition=null),F(c)}setupStroke(t,e,i,s,r){switch(t.lineWidth=e,i){case 0:t.lineCap="none";break;case 1:t.lineCap="round";break;case 2:t.lineCap="square"}switch(s){case 0:t.lineJoin="bevel";break;case 1:t.lineJoin="miter";break;case 2:t.lineJoin="round"}t.miterLimit=r}createGradientStyle(t,e,i,s,n,a,h,o=null){let _,l="pad";switch(n){case 0:l="reflect";break;case 1:l="repeat"}if(0===e){const e=(t=>{const e=-819.2*t[0]-819.2*t[2]+t[4],i=819.2*t[0]-819.2*t[2]+t[4],s=-819.2*t[0]+819.2*t[2]+t[4],n=-819.2*t[1]-819.2*t[3]+t[5],a=819.2*t[1]-819.2*t[3]+t[5];let h=s-e,o=-819.2*t[1]+819.2*t[3]+t[5]-n;const _=r.sqrt(h*h+o*o);_?(h/=_,o/=_):(h=0,o=0);const l=(i-e)*h+(a-n)*o;return B(e+l*h,n+l*o,i,a)})(s);_=t.createLinearGradient(e[0],e[1],e[2],e[3],a?"rgb":"linearRGB",l)}else t.save(),t.transform(s[0],s[1],s[2],s[3],s[4],s[5]),_=t.createRadialGradient(0,0,0,0,0,819.2,a?"rgb":"linearRGB",l,h);for(let t=0;t<i.length;++t){const e=i[t];let s=e.A;o&&(1===o[3]&&0===o[7]||(s=0|r.max(0,r.min(e.A*o[3]+o[7],255)))),_.addColorStop(e.ratio,B(e.R,e.G,e.B,s))}return _}_$runCommand(t,e,i=null,s=!1){t.reset(),t.beginPath();const n=e.length;for(let a=0;a<n;)switch(e[a++]){case 9:t.beginPath();break;case 0:t.moveTo(e[a++],e[a++]);break;case 2:t.lineTo(e[a++],e[a++]);break;case 1:t.quadraticCurveTo(e[a++],e[a++],e[a++],e[a++]);break;case 5:{if(s){a+=4;continue}const n=B();n[0]=e[a++]/255,n[1]=e[a++]/255,n[2]=e[a++]/255,n[3]=e[a++]/255,null!==i&&(1===i[3]&&0===i[7]||(n[3]=r.max(0,r.min(n[3]*i[3]+i[7],255))/255)),t.fillStyle=n}break;case 7:s||t.fill();break;case 6:{if(s){a+=8;continue}this.setupStroke(t,e[a++],e[a++],e[a++],e[a++]);const n=B();n[0]=e[a++]/255,n[1]=e[a++]/255,n[2]=e[a++]/255,n[3]=e[a++]/255,null!==i&&(1===i[3]&&0===i[7]||(n[3]=r.max(0,r.min(n[3]*i[3]+i[7],255))/255)),t.strokeStyle=n}break;case 8:s||t.stroke();break;case 12:t.closePath();break;case 3:t.bezierCurveTo(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]);break;case 4:t.arc(e[a++],e[a++],e[a++]);break;case 10:{if(s){a+=1;const t=e[a++];a+=5*t,a+=9;continue}const r=e[a++];let n=e[a++];const h=L();for(;n;)h.push({ratio:e[a++],R:e[a++],G:e[a++],B:e[a++],A:e[a++]}),n--;const o=R(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]);t.fillStyle=this.createGradientStyle(t,r,h,o,e[a++],e[a++],e[a++],i),t.fill(),1===r&&t.restore(),I(o),O(h)}break;case 11:{if(s){a+=5;const t=e[a++];a+=5*t,a+=9;continue}this.setupStroke(t,e[a++],e[a++],e[a++],e[a++]);const r=e[a++];let n=e[a++];const h=L();for(;n;)h.push({ratio:e[a++],R:e[a++],G:e[a++],B:e[a++],A:e[a++]}),n--;const o=R(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]);t.strokeStyle=this.createGradientStyle(t,r,h,o,e[a++],e[a++],e[a++],i),t.stroke(),1===r&&t.restore(),I(o),O(h)}break;case 13:{const r=e[a++],n=e[a++],h=e[a++],o=e[a++],_=e[a++];if(s){a+=_,a+=8;continue}const l=new Uint8Array(e.subarray(a,_+a));a+=_;const c=R(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]),$=!!e[a++],u=!!e[a++];t.save(),1===c[0]&&0===c[1]&&0===c[2]&&1===c[3]&&0===c[4]&&0===c[5]||t.transform(c[0],c[1],c[2],c[3],c[4],c[5]),I(c);const d=t.frameBuffer,g=d.createTextureFromPixels(r,n,l,!0);$||r!==h||n!==o?(t.fillStyle=t.createPattern(g,$,i||P()),t.imageSmoothingEnabled=u,t.fill()):(t.drawImage(g,0,0,r,n),d.releaseTexture(g)),t.restore(),t.imageSmoothingEnabled=!1}break;case 14:{if(s){a+=4;const t=e[a++];a+=t,a+=8;continue}t.save(),this.setupStroke(t,e[a++],e[a++],e[a++],e[a++]);const r=e[a++],n=e[a++],h=e[a++],o=new Uint8Array(e.subarray(a,h+a));a+=h;const _=R(e[a++],e[a++],e[a++],e[a++],e[a++],e[a++]);1===_[0]&&0===_[1]&&0===_[2]&&1===_[3]&&0===_[4]&&0===_[5]||t.transform(_[0],_[1],_[2],_[3],_[4],_[5]),I(_);const l=!!e[a++],c=!!e[a++],$=t.frameBuffer.createTextureFromPixels(r,n,o,!0);t.strokeStyle=t.createPattern($,l,i||P()),t.imageSmoothingEnabled=c,t.stroke(),t.restore(),t.imageSmoothingEnabled=!1}}}_$update(t){super._$update(t),t.recodes&&(this._$recodes=t.recodes,this._$xMin=t.xMin,this._$yMin=t.yMin,this._$xMax=t.xMax,this._$yMax=t.yMax,this._$maxAlpha=t.maxAlpha,this._$canDraw=t.canDraw,it.removeCache(this._$instanceId),this._$loaderInfoId>-1&&this._$characterId>-1&&it.removeCache(`${this._$loaderInfoId}@${this._$characterId}`))}}class re extends se{_$clip(t,e){let i=e;const n=this._$matrix;1===n[0]&&0===n[1]&&0===n[2]&&1===n[3]&&0===n[4]&&0===n[5]||(i=z(e,n));const a=this._$getBounds(),h=H(a,i);F(a);const o=r.ceil(r.abs(h.xMax-h.xMin)),_=r.ceil(r.abs(h.yMax-h.yMin));switch(F(h),!0){case 0===o:case 0===_:case o===-1/0:case _===-1/0:case o===s:case _===s:return}super._$clip(t,i),i!==e&&I(i)}_$draw(t,e,i){if(!this._$visible||!this._$maxAlpha||!this._$canDraw)return;let s=i;const r=this._$colorTransform;if(1===r[0]&&1===r[1]&&1===r[2]&&1===r[3]&&0===r[4]&&0===r[5]&&0===r[6]&&0===r[7]||(s=G(i,r)),!Y(s[3]+s[7]/255,0,1,0))return void(s!==i&&N(s));let n=e;const a=this._$matrix;1===a[0]&&0===a[1]&&0===a[2]&&1===a[3]&&0===a[4]&&0===a[5]||(n=z(e,a)),super._$draw(t,n,s,this._$blendMode,this._$filters),n!==e&&I(n),s!==i&&N(s)}_$remove(){this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$recodes=null,super._$remove(),_e.push(this)}}class ne extends ut{constructor(){super(),this._$background=!1,this._$backgroundColor=16777215,this._$border=!1,this._$borderColor=0,this._$wordWrap=!1,this._$textData=L(),this._$textAreaActive=!1,this._$thickness=0,this._$thicknessColor=0,this._$limitWidth=0,this._$limitHeight=0,this._$autoSize="none",this._$widthTable=L(),this._$heightTable=L(),this._$objectTable=L(),this._$textHeightTable=L(),this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$maxScrollV=null,this._$scrollV=1,this._$textHeight=0,this._$verticalAlign="top",this._$cacheKeys=L(),this._$cacheParams=L(0,0,0)}get width(){const t=H(this._$getBounds(null),this._$matrix),e=r.abs(t.xMax-t.xMin);switch(F(t),!0){case 0===e:case e===s:case e===-1/0:return 0;default:return e}}get height(){const t=H(this._$getBounds(null),this._$matrix),e=r.abs(t.yMax-t.yMin);switch(F(t),e){case 0:case s:case-1/0:return 0;default:return e}}get maxScrollV(){if(null===this._$maxScrollV){this._$maxScrollV=1;const t=this._$textHeightTable.length,e=this.height;if(e>this._$textHeight)return this._$maxScrollV;let i=0,s=0;for(;t>s&&(i+=this._$textHeightTable[s++],!(i>e));)this._$maxScrollV++}return this._$maxScrollV}_$clip(t,e){const i=this._$getBounds(),s=i.xMax,n=i.xMin,a=i.yMax,h=i.yMin;F(i);const o=r.ceil(r.abs(s-n)),_=r.ceil(r.abs(a-h));if(!o||!_)return;let l=e;const c=this._$matrix;1===c[0]&&0===c[1]&&0===c[2]&&1===c[3]&&0===c[4]&&0===c[5]||(l=z(e,c)),t.reset(),t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(o,0),t.lineTo(o,_),t.lineTo(0,_),t.lineTo(0,0),t.clip(),l!==e&&I(l)}_$draw(t,e,i){if(!this._$visible||this._$textAreaActive)return;if(!this._$background&&!this._$border&&2>this._$textData.length)return;let n=i;const a=this._$colorTransform;1===a[0]&&1===a[1]&&1===a[2]&&1===a[3]&&0===a[4]&&0===a[5]&&0===a[6]&&0===a[7]||(n=G(i,a));const o=Y(n[3]+n[7]/255,0,1);if(!o)return;let _=e;const l=this._$matrix;1===l[0]&&0===l[1]&&0===l[2]&&1===l[3]&&0===l[4]&&0===l[5]||(_=z(e,l));const c=this._$getBounds(null);c.xMin-=this._$thickness,c.xMax+=this._$thickness,c.yMin-=this._$thickness,c.yMax+=this._$thickness;const $=H(c,_),u=+$.xMax,d=+$.xMin,g=+$.yMax,f=+$.yMin;F($);const m=r.ceil(r.abs(u-d)),p=r.ceil(r.abs(g-f));switch(!0){case 0===m:case 0===p:case m===-1/0:case p===-1/0:case m===s:case p===s:return}let x=+r.sqrt(_[0]*_[0]+_[1]*_[1]);if(!h.isInteger(x)){const t=x.toString(),e=t.indexOf("e");-1!==e&&(x=+t.slice(0,e)),x=+x.toFixed(4)}let b=+r.sqrt(_[2]*_[2]+_[3]*_[3]);if(!h.isInteger(b)){const t=b.toString(),e=t.indexOf("e");-1!==e&&(b=+t.slice(0,e)),b=+b.toFixed(4)}const v=this._$filters,T=null!==v&&v.length>0&&this._$canApply(v);let A=S(0,m,0,p);if(T&&v)for(let t=0;t<v.length;++t)A=v[t]._$generateFilterRect(A,x,b);const M=t.frameBuffer,y=M.currentAttachment;if(!y||d-A.xMin>y.width||f-A.yMin>y.height)return void F(A);if(0>d+A.xMax||0>f+A.yMax)return void F(A);if(F(A),this._$isUpdated()&&(it.removeCache(this._$instanceId),t.cachePosition=null,this._$cacheKeys.length=0),!this._$cacheKeys.length||this._$cacheParams[0]!==x||this._$cacheParams[1]!==b||this._$cacheParams[2]!==i[7]){const t=L(x,b);this._$cacheKeys=it.generateKeys(this._$instanceId,t),O(t),this._$cacheParams[0]=x,this._$cacheParams[1]=b,this._$cacheParams[2]=i[7]}if(t.cachePosition=it.get(this._$cacheKeys),!t.cachePosition){const s=r.min(1,r.max(x,b)),a=r.ceil(r.abs(c.xMax-c.xMin)*x),h=r.ceil(r.abs(c.yMax-c.yMin)*b);n[3]=1;const o=new OffscreenCanvas(a+2*s,h+2*s).getContext("2d");if(!o)return;if(this._$background||this._$border){if(o.beginPath(),o.moveTo(0,0),o.lineTo(a,0),o.lineTo(a,h),o.lineTo(0,h),o.lineTo(0,0),this._$background){const t=Q(this._$backgroundColor),e=r.max(0,r.min(255*t.A*i[3]+i[7],255))/255;o.fillStyle=`rgba(${t.R},${t.G},${t.B},${e})`,o.fill()}if(this._$border){const t=Q(this._$borderColor),e=r.max(0,r.min(255*t.A*i[3]+i[7],255))/255;o.lineWidth=s,o.strokeStyle=`rgba(${t.R},${t.G},${t.B},${e})`,o.stroke()}}o.save(),o.beginPath(),o.moveTo(2,2),o.lineTo(a-2,2),o.lineTo(a-2,h-2),o.lineTo(2,h-2),o.lineTo(2,2),o.clip(),o.beginPath(),o.setTransform(x,0,0,b,0,0),this._$doDraw(o,e,i,a/x),o.restore();const _=M.createCachePosition(m,p),l=M.createTextureFromCanvas(o.canvas);t.drawTextureFromRect(l,_),t.cachePosition=_,it.set(this._$cacheKeys,_)}let E=!1,C=0,B=0;if(v&&v.length&&this._$canApply(v)){E=!0;const e=this._$drawFilter(t,_,v,m,p);e.offsetX&&(C=e.offsetX),e.offsetY&&(B=e.offsetY),t.cachePosition=e}const w=r.atan2(_[1],_[0]),R=r.atan2(-_[2],_[3]);if(E||!w&&!R)t.setTransform(1,0,0,1,d-C,f-B);else{const e=c.xMin*x,i=c.yMin*b,s=r.cos(w),n=r.sin(w),a=r.cos(R),h=r.sin(R);t.setTransform(s,n,-h,a,e*s-i*h+_[4],e*n+i*a+_[5])}t.cachePosition&&(t.globalAlpha=o,t.imageSmoothingEnabled=!0,t.globalCompositeOperation=this._$blendMode,t.drawInstance(d-C,f-B,u,g,i),t.cachePosition=null),F(c),_!==e&&I(_),n!==i&&N(n)}_$doDraw(t,e,i,s){const n=this.width,a=this.height;let h=0,o=0,_=0,l=0;if("top"!==this._$verticalAlign&&this.height>this._$textHeight)switch(this._$verticalAlign){case"middle":l=(this.height-this._$textHeight+2)/2;break;case"bottom":l=this.height-this._$textHeight+2}const c=this._$textData.length;for(let $=0;$<c;++$){const c=this._$textData[$];if(0===c.width)continue;const u=h+c.x;if("none"===this._$autoSize&&(o>a||u>n))continue;const d=c.textFormat,g=Q(c.textFormat._$color),f=r.max(0,r.min(255*g.A*i[3]+i[7],255))/255;if(t.fillStyle=`rgba(${g.R},${g.G},${g.B},${f})`,this._$thickness){const e=Q(this._$thicknessColor),s=r.max(0,r.min(255*e.A*i[3]+i[7],255))/255;t.lineWidth=this._$thickness,t.strokeStyle=`rgba(${e.R},${e.G},${e.B},${s})`}const m=c.yIndex;switch(c.mode){case"break":case"wrap":if(_++,this._$scrollV>_)continue;if(o+=this._$textHeightTable[m],h=this._$getAlignOffset(this._$objectTable[m],s),d._$underline){const s=c.textFormat._$size/12,n=Q(d._$color),a=r.max(0,r.min(255*n.A*i[3]+i[7],255))/255;t.lineWidth=r.max(1,1/r.min(e[0],e[3])),t.strokeStyle=`rgba(${n.R},${n.G},${n.B},${a})`,t.beginPath(),t.moveTo(h,l+o-s),t.lineTo(h+this._$widthTable[m],l+o-s),t.stroke()}break;case"text":{if(this._$scrollV>_)continue;let e=o-this._$heightTable[0];he||(e+=c.textFormat._$size/12*2),t.beginPath(),t.textBaseline="top",t.font=J(d._$font,d._$size,d._$italic,d._$bold),this._$thickness&&t.strokeText(c.text,u,l+e),t.fillText(c.text,u,l+e)}break;case"image":if(!c.loaded)continue;t.beginPath(),t.drawImage(c.image,c.hspace,l+c.y,c.width,c.height)}}}_$getAlignOffset(t,e){const i=this._$widthTable[t.yIndex],s=t.textFormat,n=s._$blockIndent+s._$leftMargin>0?s._$blockIndent+s._$leftMargin:0;switch(!0){case!this._$wordWrap&&i>e:return r.max(0,n);case"center"===s._$align:case"center"===this._$autoSize:return r.max(0,e/2-n-s._$rightMargin-i/2);case"right"===s._$align:case"right"===this._$autoSize:return r.max(0,e-n-i-s._$rightMargin-2);default:return r.max(0,n+2)}}_$remove(){this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$textData.length=0,this._$widthTable.length=0,this._$heightTable.length=0,this._$objectTable.length=0,this._$textHeightTable.length=0,this._$textAreaActive=!1,super._$remove(),le.push(this)}_$updateProperty(t){this._$textAreaActive=!!t.textAreaActive,this._$textData.length=0,this._$widthTable.length=0,this._$heightTable.length=0,this._$objectTable.length=0,this._$textHeightTable.length=0,this._$textData.push(...t.textData),this._$widthTable.push(...t.widthTable),this._$heightTable.push(...t.heightTable),this._$objectTable.push(...t.objectTable),this._$textHeightTable.push(...t.textHeightTable),this._$wordWrap=t.wordWrap,this._$limitWidth=t.limitWidth,this._$limitHeight=t.limitHeight,this._$autoSize=t.autoSize,this._$scrollV=t.scrollV,this._$textHeight=t.textHeight,this._$verticalAlign=t.verticalAlign,this._$border=t.border,this._$border&&(this._$borderColor=t.borderColor),this._$background=t.background,this._$background&&(this._$backgroundColor=t.backgroundColor),"thickness"in t&&(this._$thickness=t.thickness,this._$thicknessColor=t.thicknessColor)}_$update(t){super._$update(t),this._$textAreaActive=!!t.textAreaActive,this._$xMin=t.xMin,this._$yMin=t.yMin,this._$xMax=t.xMax,this._$yMax=t.yMax,t.textData&&this._$updateProperty(t)}}class ae extends ut{constructor(){super(),this._$imageBitmap=null,this._$context=null,this._$smoothing=!0,this._$cacheKeys=L(),this._$cacheParams=L(0,0,0)}_$clip(t,e){const i=this._$xMax,s=this._$yMax;if(!i||!s)return;let r=e;const n=this._$matrix;1===n[0]&&0===n[1]&&0===n[2]&&1===n[3]&&0===n[4]&&0===n[5]||(r=z(e,n)),t.reset(),t.setTransform(r[0],r[1],r[2],r[3],r[4],r[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,s),t.lineTo(0,s),t.lineTo(0,0),t.clip(),r!==e&&I(r)}_$draw(t,e,i){if(!this._$visible||!this._$imageBitmap||!this._$context)return;let n=i;const a=this._$colorTransform;1===a[0]&&1===a[1]&&1===a[2]&&1===a[3]&&0===a[4]&&0===a[5]&&0===a[6]&&0===a[7]||(n=G(i,a));const o=Y(n[3]+n[7]/255,0,1,0);if(!o)return void(n!==i&&N(n));let _=e;const l=this._$matrix;1===l[0]&&0===l[1]&&0===l[2]&&1===l[3]&&0===l[4]&&0===l[5]||(_=z(e,l));const c=this._$getBounds();F(c);const $=H(c,_),u=+$.xMax,d=+$.xMin,g=+$.yMax,f=+$.yMin;F($);const m=r.ceil(r.abs(u-d)),p=r.ceil(r.abs(g-f));switch(!0){case 0===m:case 0===p:case m===-1/0:case p===-1/0:case m===s:case p===s:return}let x=+r.sqrt(_[0]*_[0]+_[1]*_[1]);if(!h.isInteger(x)){const t=x.toString(),e=t.indexOf("e");-1!==e&&(x=+t.slice(0,e)),x=+x.toFixed(4)}let b=+r.sqrt(_[2]*_[2]+_[3]*_[3]);if(!h.isInteger(b)){const t=b.toString(),e=t.indexOf("e");-1!==e&&(b=+t.slice(0,e)),b=+b.toFixed(4)}const v=this._$filters,T=null!==v&&v.length>0&&this._$canApply(v);let A=S(0,m,0,p);if(T&&v)for(let t=0;t<v.length;++t)A=v[t]._$generateFilterRect(A,x,b);const M=t.frameBuffer,y=M.currentAttachment;if(!y||d-A.xMin>y.width||f-A.yMin>y.height)return void F(A);if(0>d+A.xMax||0>f+A.yMax)return void F(A);if(F(A),!this._$cacheKeys.length||this._$cacheParams[0]!==x||this._$cacheParams[1]!==b||this._$cacheParams[2]!==i[7]){const t=L();t[0]=x,t[1]=b,this._$cacheKeys=it.generateKeys(this._$instanceId,t,i),O(t),this._$cacheParams[0]=x,this._$cacheParams[1]=b,this._$cacheParams[2]=i[7]}if(t.cachePosition=it.get(this._$cacheKeys),!t.cachePosition){const e=r.ceil(r.abs(this._$xMax-this._$xMin)),i=r.ceil(r.abs(this._$yMax-this._$yMin)),s=M.createCachePosition(e,i);t.cachePosition=s,it.set(this._$cacheKeys,s)}this._$context.drawImage(this._$imageBitmap,0,0);const E=M.textureManager._$createFromElement(this._$imageBitmap.width,this._$imageBitmap.height,this._$context.canvas,this._$smoothing);let C=0,B=0;if(T&&v){const e=M.currentAttachment,i=M.createCacheAttachment(m,p);t._$bind(i),t.reset();const s=R(x,0,0,b,m/2,p/2),r=R(1,0,0,1,-E.width/2,-E.height/2),n=z(s,r);I(s),I(r),t.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),t.drawImage(E,0,0,E.width,E.height);const a=M.getTextureFromCurrentAttachment();t._$bind(e),M.releaseAttachment(i),t.drawTextureFromRect(E,t.cachePosition);const h=this._$drawFilter(t,_,v,m,p,a);h.offsetX&&(C=h.offsetX),h.offsetY&&(B=h.offsetY),t.cachePosition=h,t.setTransform(1,0,0,1,d-C,f-B)}else t.drawTextureFromRect(E,t.cachePosition),t.setTransform(_[0],_[1],_[2],_[3],_[4],_[5]);t.cachePosition&&(t.globalAlpha=o,t.imageSmoothingEnabled=!0,t.globalCompositeOperation=this._$blendMode,t.drawInstance(d-C,f-B,u,g,i),t.cachePosition=null),_!==e&&I(_),n!==i&&N(n)}_$remove(){this._$xMin=0,this._$yMin=0,this._$xMax=0,this._$yMax=0,this._$context=null,this._$imageBitmap=null,this._$smoothing=!0,super._$remove(),$e.push(this)}_$updateProperty(t){if(this._$xMin=t.xMin,this._$yMin=t.yMin,this._$xMax=t.xMax,this._$yMax=t.yMax,this._$imageBitmap=t.imageBitmap,this._$smoothing=t.smoothing,!this._$context&&this._$imageBitmap){const t=new c(this._$imageBitmap.width,this._$imageBitmap.height);this._$context=t.getContext("2d")}}_$update(t){super._$update(t),this._$updateProperty(t)}}let he=!1;const oe=new class{constructor(){this._$instances=new Map,this._$matrix=R(1,0,0,1,0,0),this._$width=0,this._$height=0,this._$stage=new dt,this._$canvas=null,this._$context=null,this._$attachment=null}get instances(){return this._$instances}get context(){return this._$context}get scaleX(){return this._$matrix[0]}stop(){it.reset()}_$initialize(e,i){let s=0;var r,n;this._$setStage(e[s++]),n=1===e[s++],he=n,r=e[s++],t=r,this._$canvas=i;const a=i.getContext("webgl2",{stencil:!0,premultipliedAlpha:!0,antialias:!1,depth:!1,preserveDrawingBuffer:!0});if(a){const t=new ie(a,e[s++]);this._$context=t,it.context=t}}_$setBackgroundColor(t){if(!this._$context)return;const e=t[0];if(-1===e)this._$context._$setColor(0,0,0,0);else{const t={A:(i=e)>>>24,R:(16711680&i)>>16,G:(65280&i)>>8,B:255&i};this._$context._$setColor(t.R/255,t.G/255,t.B/255,1)}var i}_$bitmapDraw(t,e,i,s){const r=this._$context;if(!r)return;r._$bind(this._$attachment),r.reset(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,this._$width,this._$height),r.beginPath(),t._$draw(r,e,i),r.frameBuffer.transferToMainTexture();const n=s.getContext("2d");n&&this._$canvas&&n.drawImage(this._$canvas,0,0)}_$draw(){if(!this._$width||!this._$height)return;const t=this._$context;t&&(t.reset(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this._$width,this._$height),t.beginPath(),this._$stage._$draw(t,this._$matrix,m),this._$stage._$updated=!1,t.drawInstacedArray(),t.frameBuffer.transferToMainTexture())}_$resize(t){let e=0;const i=t[e++],s=t[e++];if(this._$width=i,this._$height=s,!this._$canvas)return;if(this._$canvas.width===i&&this._$canvas.height===s)return;const r=this._$context;if(!r)return;const n=t[e++];this._$matrix[0]=n,this._$matrix[3]=n,this._$matrix[4]=t[e++],this._$matrix[5]=t[e++],this._$stage._$updated=!0,it.reset(),r.clearInstacedArray(),this._$canvas.width=i,this._$canvas.height=s,r._$gl.viewport(0,0,i,s);const a=r.frameBuffer;this._$attachment&&(a.unbind(),a.releaseAttachment(this._$attachment,!0)),this._$attachment=a.createCacheAttachment(i,s,!0),r.setMaxSize(i,s),r._$bind(this._$attachment)}_$setStage(t){this._$stage._$instanceId=t,this._$instances.set(t,this._$stage)}_$updateStage(){this._$stage._$updated=!0}_$createDisplayObjectContainer(t){const e=ue();let i=0;e._$instanceId=t[i++],e._$parentId=t[i++],this._$setProperty(e,t,2),this._$instances.set(e._$instanceId,e)}_$setProperty(t,e,i){t._$visible=1===e[i++],t._$depth=e[i++],t._$clipDepth=e[i++],t._$isMask=1===e[i++],1===e[i++]?(t._$maskId=e[i++],t._$maskMatrix||(t._$maskMatrix=R()),t._$maskMatrix[0]=e[i++],t._$maskMatrix[1]=e[i++],t._$maskMatrix[2]=e[i++],t._$maskMatrix[3]=e[i++],t._$maskMatrix[4]=e[i++],t._$maskMatrix[5]=e[i++]):(t._$maskId=-1,t._$maskMatrix&&(I(t._$maskMatrix),t._$maskMatrix=null),i+=7),t._$visible?(t._$matrix[0]=e[i++],t._$matrix[1]=e[i++],t._$matrix[2]=e[i++],t._$matrix[3]=e[i++],t._$matrix[4]=e[i++],t._$matrix[5]=e[i++],t._$colorTransform[0]=e[i++],t._$colorTransform[1]=e[i++],t._$colorTransform[2]=e[i++],t._$colorTransform[3]=e[i++],t._$colorTransform[4]=e[i++],t._$colorTransform[5]=e[i++],t._$colorTransform[6]=e[i++],t._$colorTransform[7]=e[i++]):(i+=6,i+=8),t._$blendMode=et(e[i++]),e[i++]?t._$scale9Grid={x:e[i++],y:e[i++],w:e[i++],h:e[i++]}:t._$scale9Grid=null,t._$blendMode=et(e[i++]),e[i++]?t._$scale9Grid={x:e[i++],y:e[i++],w:e[i++],h:e[i++]}:t._$scale9Grid=null}_$registerShapeRecodes(t,e){this._$instances.has(t)||this._$instances.set(t,fe()),this._$instances.get(t)._$recodes=e}_$createShape(t){let e=0;const i=t[e++];this._$instances.has(i)||this._$instances.set(i,fe());const s=this._$instances.get(i);s._$instanceId=i,s._$parentId=t[e++],s._$maxAlpha=t[e++],s._$canDraw=1===t[e++],s._$xMin=t[e++],s._$yMin=t[e++],s._$xMax=t[e++],s._$yMax=t[e++],s._$characterId=t[e++],s._$loaderInfoId=t[e++],this._$setProperty(s,t,10)}_$createVideo(t){const e=ge();t.characterId&&(e._$characterId=t.characterId),"loaderInfoId"in t&&(e._$loaderInfoId=t.loaderInfoId||0),e._$updateProperty(t),this._$instances.set(e._$instanceId,e)}_$createTextField(t){const e=de();e._$xMin=t.xMin||0,e._$yMin=t.yMin||0,e._$xMax=t.xMax||0,e._$yMax=t.yMax||0,t.characterId&&(e._$characterId=t.characterId),"loaderInfoId"in t&&(e._$loaderInfoId=t.loaderInfoId||0),e._$updateProperty(t),this._$instances.set(e._$instanceId,e)}},_e=[],le=[],ce=[],$e=[],ue=()=>ce.pop()||new dt,de=()=>le.pop()||new ne,ge=()=>$e.pop()||new ae,fe=()=>_e.pop()||new re;const me=new class{constructor(){this.state="deactivate",this.queue=[],this._$options=[]}execute(){this.state="active";let t=!0;for(;this.queue.length;){const e=this.queue.shift();if(console.log(e),e){switch(t=!0,e.command){case"draw":oe._$draw();break;case"setProperty":if(!oe.instances.has(e.instanceId))continue;break;case"setChildren":{t=!1;const i=e.buffer,s=oe.instances;if(!s.has(i[0]))continue;const r=s.get(i[0]);r._$doChanged(),r._$children=i.subarray(1)}break;case"remove":{const t=oe.instances;if(!t.has(e.instanceId))continue;t.get(e.instanceId)._$remove(),t.delete(e.instanceId)}break;case"createShape":oe._$createShape(e.buffer);break;case"createDisplayObjectContainer":oe._$createDisplayObjectContainer(e.buffer);break;case"createTextField":oe._$createTextField(e);break;case"createVideo":oe._$createVideo(e);break;case"resize":oe._$resize(e.buffer);break;case"initialize":oe._$initialize(e.buffer,e.canvas);break;case"setBackgroundColor":oe._$setBackgroundColor(e.buffer);break;case"stop":oe.stop();break;case"removeCache":it.removeCache(e.id);break;case"bitmapDraw":{const t=oe.instances;if(!t.has(e.sourceId))continue;const i=t.get(e.sourceId),s=new c(e.width,e.height);oe._$bitmapDraw(i,e.matrix||f,e.colorTransform||m,s);const r=s.transferToImageBitmap();globalThis.postMessage({command:"bitmapDraw",sourceId:e.sourceId,imageBitmap:r},[r])}break;default:if(e.command.indexOf("shapeRecodes")>-1){t=!1;const i=+e.command.split("@")[1];oe._$registerShapeRecodes(i,e.buffer)}}e.buffer&&t&&(this._$options.length=0)}}this.state="deactivate"}};self.addEventListener("message",(t=>{return e=void 0,i=void 0,r=function*(){me.queue.push(t.data),"deactivate"===me.state&&me.execute()},new((s=void 0)||(s=Promise))((function(t,n){function a(t){try{o(r.next(t))}catch(t){n(t)}}function h(t){try{o(r.throw(t))}catch(t){n(t)}}function o(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(a,h)}o((r=r.apply(e,i||[])).next())}));var e,i,s,r}))})();'],{type:"text/javascript"}))):null,Tr=null,Tr&&(Er=t=>{t._$createWorkerInstance(),t._$postProperty();const e=t._$needsChildren?t._$getChildren():t._$children,i=nt();for(let t=0;t<e.length;++t){const s=e[t];s&&(i.push(s._$instanceId),"_$children"in s?Er(s):(s._$createWorkerInstance(),s._$postProperty()))}t._$postChildrenIds(i),at(i)},yr=t=>{t._$removeWorkerInstance();const e=t._$needsChildren?t._$getChildren():t._$children;for(let t=0;t<e.length;++t){const i=e[t];i&&("_$children"in i?yr(i):i._$removeWorkerInstance())}})}return new Promise((t=>{const e=navigator.userAgentData;if(e)e.getHighEntropyValues(["platform","mobile"]).then((e=>{const i=e.brands;for(let t=0;t<i.length;++t)if(-1!==i[t].brand.indexOf("Chrome")){qs=!0;break}Ws="Android"===e.platform,Ks="iOS"===e.platform,Qs=Ws||Ks,t()}));else{const e=navigator.userAgent;Ws=e.indexOf("Android")>-1,Ks=e.indexOf("iPhone")>-1||e.indexOf("iPod")>-1,qs=e.indexOf("Chrome")>-1,js=e.indexOf("Firefox")>-1,Hs=-1===e.indexOf("Chrome")&&e.indexOf("Safari")>-1,Qs=Ws||Ks,t()}}))};"next2d"in window||(console.log("%c Next2D Player %c 1.17.5 %c https://next2d.app","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),window.next2d=new class{constructor(t){this._$promises=t,this._$player=new gs,this.display=ps,this.events=fs,this.filters=ms,this.geom=xs,this.media=bs,this.net=vs,this.text=Ts,this.ui=ys}get player(){return this._$player}load(t,e){Promise.all(this._$promises).then((()=>{if(at(this._$promises),"develop"===t){const e=location.search.slice(1).split("&")[0];if(!e)return;t=`${location.origin}/${e}`}if(!t)return;"/"===t.charAt(1)&&(t=t.slice(1)),e&&"base"in e||!(t.indexOf("//")>-1)||(this._$player.base=t),this._$player.setOptions(e),this._$player._$initialize();const i=new $e;i.contentLoaderInfo.addEventListener(Bt.IO_ERROR,(t=>{t.target&&t.target.removeEventListener(Bt.IO_ERROR,t.listener),alert("Error: "+t.text)})),i.contentLoaderInfo.addEventListener(wt.COMPLETE,(t=>{const e=t.target,i=this._$player;if(e.removeEventListener(wt.COMPLETE,t.listener),e._$data){const t=e._$data.stage;i.bgColor=t.bgColor,i._$setBackgroundColor(t.bgColor),i.stage.addChild(e.content),i.width=t.width,i.height=t.height,i.stage._$frameRate=$t(+t.fps,1,60,60)}i._$resize()})),i.load(new Mt(t))}))}createRootMovieClip(t=240,e=240,i=24,s=null){return r=this,n=void 0,h=function*(){yield Promise.all(this._$promises),at(this._$promises);const r=this._$player;r.width=0|t,r.height=0|e,r.mode="create",r.stage._$frameRate=0|i,r.setOptions(s),r._$initialize();const n=r.stage.addChild(new ce);return r._$loadStatus=gs.LOAD_END,r.play(),n},new((a=void 0)||(a=Promise))((function(t,e){function i(t){try{o(h.next(t))}catch(t){e(t)}}function s(t){try{o(h.throw(t))}catch(t){e(t)}}function o(e){var r;e.done?t(e.value):(r=e.value,r instanceof a?r:new a((function(t){t(r)}))).then(i,s)}o((h=h.apply(r,n||[])).next())}));var r,n,a,h}}([new Promise((t=>{if("loading"===document.readyState){const e=()=>{window.removeEventListener("DOMContentLoaded",e),Br().then((()=>{ar()._$initializeCanvas(),t()}))};window.addEventListener("DOMContentLoaded",e)}else Br().then((()=>{ar()._$initializeCanvas(),t()}))}))]))})();
|